feat: unify smartui-storybook into smartui-cli (built-in storybook command + TUI) - #527
Draft
chaitanyas-maker wants to merge 8 commits into
Draft
feat: unify smartui-storybook into smartui-cli (built-in storybook command + TUI)#527chaitanyas-maker wants to merge 8 commits into
storybook command + TUI)#527chaitanyas-maker wants to merge 8 commits into
Conversation
docs: update README to TestMu AI branding
Stage -> Prod
Release v4.1.71
…command Vendor the proven @lambdatest/smartui-storybook v1.1.32 engine into the single smartui binary (faithful relocation hitting the same /storybook/* backend), add config:create-storybook, and resolve the colliding-bin problem. One install, one binary. Version 5.0.0-unified.1. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwQRZwr64F9fLQAW4V1bWy
…ent, log-symbols) Gradient figlet banner + launch config box + end-of-run summary box (dashboard link, screenshot/approval/change counts) around the storybook command. Summary deferred to process 'beforeExit' so it lands after the engine's polling. Verified with a live baseline build (11 stories -> 33 screenshots) on SmartUI cloud. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwQRZwr64F9fLQAW4V1bWy
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwQRZwr64F9fLQAW4V1bWy
Two bugs that broke the URL-mode capture path (surfaced by live URL testing, confirmed by @sushobhit-lt review on PR #1): - storybook.ts: merge root global flags via optsWithGlobals() so `--config` actually reaches the engine (local -c/--config collided with the global one), letting validateConfig normalize viewports->resolutions. - dom.cjs: declare `dom`/`clone`/`element` with const — they were implicit globals that throw ReferenceError once bundled into strict mode (same class as the earlier res/filename/githubURL fixes; these three were missed). - storybook.cjs: guard the URL-mode resolutions loop with a viewports fallback so `smartui storybook <url>` with no -c flag doesn't crash on the default config (per review). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CwQRZwr64F9fLQAW4V1bWy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unify
@lambdatest/smartui-storybookinto@lambdatest/smartui-cliFolds the standalone Storybook CLI into the main CLI as a built-in
storybookcommand, plus a terminal UI. Draft — opened for review/discussion; not merge-ready (see Open Questions). Tested live end-to-end.Why
Both packages declare
bin.smartui, so they collide onPATH— installing@lambdatest/smartui-storybooksilently clobbers@lambdatest/smartui-cli(and vice-versa), and users need two installs for one tool. The storybook package also re-implements auth, git, HTTP, polling, and constants the main CLI already owns. This PR makes one binary own the name and ships Storybook as a first-class command.Approach — faithful relocation (not a rewrite)
Rather than re-plumb Storybook onto the CLI's
createBuild/finalizeBuildlifecycle (which depends on an unverified backend question — see Open Questions), this vendors the proven, shipping@lambdatest/smartui-storybookv1.1.32 engine into the CLI undersrc/storybookVendor/, hitting the same/storybook/*endpoints it already uses in production. Behaviour is byte-identical to the standalone tool; only the collision and the double-install are removed. The "elegant" shared-lifecycle refactor is the documented follow-up once the backend routing is confirmed.What changed
smartui storybook <url-or-dir>— URL and DIR modes, grammar identical to the standalone package.smartui config:create-storybook+ astorybookblock in the ajvConfigSchema(andanyOf, since the top level isadditionalProperties:false).src/storybookVendor/**(12.cjsmodules), bundled by tsup. Vendored.js→.cjsso esbuild bundles them as CommonJS under the CLI's"type":"module".src/lib/tui.cjs— gradient banner + boxed launch/summary (dashboard link, screenshot/approval/change counts). Degrades gracefully without a TTY (CI-safe).puppeteer,jsdom,archiver,form-data,cli-table3, proxy agents (engine);figlet,gradient-string,boxen,log-symbols,ora(TUI).pnpm-lock.yamlupdated.Testing (live)
pnpm i → build → pack), wired to@lambdatest/playwright-driver(SDKstage), ransmartui exec -- node test.js→ build finalized. The merge does not break the exec/web-capture flow.Total Screenshots: 0from the backend/storybook/renderDOM-upload path (both 17-story and 1-story). Points at the render endpoint, not the CLI glue — see Open Questions.Fixes from review (thanks @sushobhit-lt)
dom.cjs—dom/clone/elementwere implicit globals (strict-modeReferenceErroronce bundled); declared withconst.storybook.cjs— guarded the URL-mode resolutions loop with aviewportsfallback sosmartui storybook <url>with no-cdoesn't crash on the default config.storybook.ts— merged root global flags viaoptsWithGlobals()so--configactually reaches the engine (local-c/--configcollided with the global one).Open questions for maintainers
/storybook/renderreturns 0 screenshots here; and the shared-lifecycle refactor needs confirmation that the CLI'svisualui/1.0client can reach/storybook/*. Biggest unknown.5.0.0(MAJOR) + a deprecation shim on@lambdatest/smartui-storybook. Not done here.@ts-nocheck. Needs the project's test suite;src/commander/storybook.tsuses// @ts-nocheck(vendored.cjsimport lacks types) — to be scoped down as follow-up.Not included (deliberately)
Live publish, official version bump, deprecation shim, docs updates.
🤖 Generated with Claude Code