Skip to content

feat(capture web): init/update-workflows --capture web, setup-skill upgrade path, docs - #117

Merged
epinnock merged 2 commits into
mainfrom
feat/capture-web-onboarding
Nov 15, 2026
Merged

epinnock merged 2 commits into
mainfrom
feat/capture-web-onboarding

Conversation

@epinnock

@epinnock epinnock commented Nov 15, 2026 •

Copy link
Copy Markdown
Collaborator

What

scry-deployer capture web (build-free Storybook capture) could only be set up by hand. This adds the option that sets it up for any project that qualifies, the docs, and the setup-skill path.

  • scry-deployer init --capture web and scry-deployer update-workflows --capture web write .github/workflows/scry-capture-web.yml.
  • Optional --config-dir <dir> (only with --capture web) for a Storybook config that is not in .storybook.
  • The project is checked before the first write: Storybook 10, a Vite framework, the React renderer, Vite, and Playwright installed in the project. The check reuses lib/capture/web/ detection (loadStorybookProject, loadVite) in a child process. A project that does not qualify gets the reason, exit 1, and no file written or changed.
  • Without the option, deploy-storybook.yml and deploy-pr-preview.yml are byte-for-byte what they were (existing snapshots unchanged; a test compares the outputs).

Release: no behaviour change

Gate note: the generated workflow installs @scrymore/scry-deployer@^0.14.0 from npm, and npm has 0.13.0 today. Nothing in this PR publishes or bumps a version. Until 0.14.0 is published, a workflow written by --capture web fails at its install step; the skill checks for the command first and leaves the project as it is when it is not there.

Decision: what --capture web does to the two existing workflows

File With --capture web
scry-capture-web.yml New. capture web then upload on a push to the default branch.
deploy-storybook.yml --with-analysis becomes --no-analysis. Still builds and hosts Storybook, still reports coverage and CI time. No second screenshot capture.
deploy-pr-preview.yml Unchanged. Pull requests keep the preview, the comment and their screenshots.

Evidence:

  • A bundle upload creates a build with an empty zipUrl and no coverage report (upload service bundle route; the web-capture plan lists "coverage report for SCF builds" as not in v1). Removing deploy-storybook.yml would lose the hosted Storybook and coverage, so it stays.
  • --no-analysis is an existing mode (0.7.0: hosted, not indexed). Coverage does not depend on the screenshots (resolveAnalysis in bin/cli.js, lib/coverage.js).
  • In the upload service only the metadata route and the bundle-complete route enqueue a build. A Storybook upload without metadata is never queued, so the hosted build cannot take search from the bundle.
  • The Scry dashboard already runs both workflows side by side; its scry-capture-web.yml header says it does not replace deploy-storybook.yml.
  • capture web runs only on the default branch, so the PR workflow has to keep --with-analysis.

Side effect to know about: each push creates two builds, the hosted one (not indexed) and the bundle (indexed).

Going back: update-workflows without the option restores --with-analysis; if a generated scry-capture-web.yml is still there, the command warns that every push is captured twice and says to delete it.

The generated workflow

  • ubuntu-24.04 (not the floating label), Node 20, timeout-minutes: 30 (measured: 1,734 stories took about 10 min to capture on a 2-core hosted runner, about 1.5 min to upload).
  • Deployer from npm into $RUNNER_TEMP/scry, floor ^0.14.0, --ignore-scripts, no --prefer-offline, never from git.
  • Chromium installed with the project's own Playwright (playwright install --with-deps chromium).
  • --max-dropped "${SCRY_MAX_DROPPED:-0}": default 0. A failed story is already retried once; a story missing from a bundle is missing from search; a red run uploads nothing, so search keeps the last complete build.
  • Same settings as the deploy workflows: secret SCRY_API_KEY (upload step only), variables SCRY_API_URL, SCRY_PROJECT_ID, optional SCRY_MAX_DROPPED.
  • workflow_dispatch: a manual run on a non-default branch only validates the bundle (upload --dry-run).
  • permissions: contents: read, packages: read; persist-credentials: false; the report is kept as an artifact for 7 days.

Docs and skill

  • README: "Capture Command (web, build-free)" next to the capture rn section.
  • docs/capture-web.md: "Set it up in CI".
  • templates/workflows/: reference copy scry-capture-web.yml (generated) and README section.
  • skills/scry-setup: new references/capture-web.md (qualify, check the deployer has the command, new setup, upgrade an existing project, how to go back, troubleshooting) and a routing bullet in SKILL.md. The "checked against" line now says which references were checked against what.

Review round 1 (second commit)

  • The check runs project code. --capture web loads the project's Storybook main file, presets and Vite config in a child process. That child now gets an environment without GITHUB_TOKEN, GH_TOKEN, GH_ENTERPRISE_TOKEN, GITHUB_ENTERPRISE_TOKEN, NPM_TOKEN, NODE_AUTH_TOKEN, npm auth settings, and every SCRY_* / STORYBOOK_DEPLOYER_* variable whose name contains KEY, TOKEN, SECRET or PASSWORD. Everything else passes through, because a project's config may read its own variables. --help, README, docs and the skill say: the check loads the project's Storybook and Vite config, as Storybook itself does; run it only in a repository you trust.
  • Repository root. --capture web compares git rev-parse --show-toplevel with the working directory before any project code is loaded. From a subfolder it stops, names the limit (the project must be at the repository root in this version) and writes nothing.
  • pnpm in the capture workflow only. pnpm/action-setup@v4. When package.json has "packageManager": "pnpm@x", no version is written and the action installs that one (it stops when both are given and differ). Otherwise the version follows the lockfile format: 10 for a version 9 lockfile, 8 for an older one. Why 10 and not 9: pnpm 9 and 10 both read and write lockfile version 9, 10 is the current major, and it is the one the measured dashboard runs used. The two deploy workflows keep action-setup@v2 with version 8; their output is byte-identical (existing snapshots unchanged).
  • yarn and bun in the capture workflow only. Yarn 2+ named in packageManager gets corepack enable before setup-node. Bun uses setup-bun@v2, has no cache: on setup-node (setup-node caches npm, yarn and pnpm only), and a project with only bun.lock is treated as bun. Not changed, and worth a follow-up: the deploy workflows write cache: 'bun' for a bun project and detect bun.lockb only.
  • init checks the project before the credentials. Safe: step 1 is a local check of the two flags.
  • "failed to load preset". When the Storybook config names a package that cannot be loaded, the stop message now says which: a framework that is not a Vite one, or a package that is not installed. Storybook's own first line and error line are kept as the detail.
  • Deployer floors. deploy-storybook.yml keeps ^0.12.1 with --capture web. --no-analysis is handled the same at 0.12.1 as here: git diff of bin/cli.js and lib/config.js from the 0.12.1 release commit (7db4821) to this branch has no line that touches the analysis option, and the option has existed since 0.7.0. So the hosting workflow needs no higher floor and its default output is not touched.
  • Default branch. The capture workflow runs on main and master, as the two existing templates do. Documented in the file header, the command's summary, README, docs and skill troubleshooting.
  • An unknown --capture value is already an error on this branch (yargs choices). A deployer older than 0.14.0 ignores the option; README, docs and skill keep @^0.14.0 in every command for that reason.

Tests

  • Red first: 14 failing in test/templates.test.js; test/capture-web-onboarding.test.js could not load.
  • Green: 108 tests in the 6 scoped suites (95 after the first commit, 13 added in review round 1). pnpm lint: 122 warnings (the limit), none new.
  • Real run on a copy of test/fixtures/capture-web (Storybook 10.0.7, Vite 7.1.6, Playwright 1.55.0, Node 20.19.2): update-workflows --capture web wrote the three files; the workflow's capture command captured 13 of 15 and exited 1 on the fixture's always-failing story with the default --max-dropped 0; upload --dry-run validated the bundle.

Not checked

  • The workflow on a real GitHub runner (needs 0.14.0 on npm).
  • pnpm, yarn and bun variants on a real project (snapshots only).
  • How the dashboard shows the two builds per push for an outside project.
  • Limit: the Storybook project must be at the repository root.

🤖 Generated with Claude Code

…pgrade path, docs

`init --capture web` and `update-workflows --capture web` write
.github/workflows/scry-capture-web.yml for a project on Storybook 10 with a
Vite framework, the React renderer and Playwright. The project is checked
before anything is written; one that does not qualify stops with the reason.

With the option, deploy-storybook.yml runs with --no-analysis (still hosts
Storybook and reports coverage, no second capture) and deploy-pr-preview.yml
is unchanged. Without the option both files are byte-for-byte what they were.

Also: README and docs/capture-web.md sections, the reference copy in
templates/workflows, and a capture-web reference in the scry-setup skill with
the upgrade path for an existing project.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@epinnock
epinnock marked this pull request as ready for review November 15, 2026 09:45
…pgrade path)

- The qualify check's child process gets no Scry, GitHub or npm credentials;
  --help, README, docs and the skill say the check loads project config.
- --capture web stops outside the repository root and writes nothing.
- Capture workflow only: pnpm from packageManager, else 10 (8 for an old
  lockfile); Corepack for Yarn 2+; setup-bun without a setup-node cache.
  The two deploy workflows are byte-identical.
- init checks the project before the credentials.
- Storybook's "failed to load preset" becomes a plain reason, raw error kept.
- Skill: custom deploy workflow by hand, final-message checklist, story
  count sources, commit and config-file notes, more troubleshooting.
- Docs: one flag spelling (--project-id / --api-key), version floor on the
  init example, Playwright resolution as the code does it, manual-run rule.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@epinnock
epinnock merged commit d2427d1 into main Nov 15, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant