Repository navigation
feat(tooling): capture product screenshots of the real UI without a display - #703
Merged
Merged
Conversation
…isplay Product screenshots needed a person at a running desktop app: the desktop UI is a Tauri webview and the mobile UI is React Native, and both draw their content from a local backend a browser cannot reach. That made screenshot work impossible in CI, over SSH, or in a session without screen-recording permission. This adds a harness that renders the **real frontends** in a local headless Chrome, with fixed demo data standing in for the backend: - `desktop/shot/` + `desktop/vite.shot.config.ts` mock the `@tauri-apps/*` IPC boundary (and the loopback PTY server, via `shot/terminal-server.mjs`). - `mobile/shot/` mocks `remote/RemoteContext` and two native modules. The Metro hook that installs them is gated on `SHOT_WEB=1` *and* the web platform, so native builds are untouched. - `scripts/screenshots/` holds the Chrome DevTools Protocol driver, the scenario table, terminal-frame rendering and PDF assembly. Everything except the data source is the shipped code: components, hooks, stores, styles and i18n. Interactions are dispatched as real input events, so a capture reflects what the UI does. Two rules keep it a tool rather than a pile of binaries: captures and the generated demo figures are gitignored (never committed), and the harness-only web dependencies are installed into the mobile workspace with `--no-save`, leaving `package.json` / `package-lock.json` untouched. Also fixes a latent config bug this surfaced: `eslint.config.mjs` scoped the Tailwind plugin's `cssConfigPath` to `src/**`, so linting any second file scope made the plugin fall back to a non-existent `src/style.css` and the whole run failed. Docs: `docs/guide/screenshots.md` (en/zh) covers when to reach for this, the two commands, the scenario format, and the failure modes worth knowing.
huichen
enabled auto-merge (squash)
September 17, 2026 09:58
huichen
disabled auto-merge
September 17, 2026 09:59
…isplay Product screenshots needed a person at a running desktop app: the desktop UI is a Tauri webview and the mobile UI is React Native, and both draw their content from a local backend a browser cannot reach. That made screenshot work impossible in CI, over SSH, or in a session without screen-recording permission. This adds a harness that renders the **real frontends** in a local headless Chrome, with fixed demo data standing in for the backend: - `desktop/shot/` + `desktop/vite.shot.config.ts` mock the `@tauri-apps/*` IPC boundary (and the loopback PTY server, via `shot/terminal-server.mjs`). - `mobile/shot/` mocks `remote/RemoteContext` and two native modules. The Metro hook that installs them is gated on `SHOT_WEB=1` *and* the web platform, so native builds are untouched. - `scripts/screenshots/` holds the Chrome DevTools Protocol driver, the scenario table, terminal-frame rendering and PDF assembly. Everything except the data source is the shipped code: components, hooks, stores, styles and i18n. Interactions are dispatched as real input events, so a capture reflects what the UI does. It is driven as a script (`scripts/screenshots/capture.py serve-*` / `capture-*`, `terminal`, `pdf`), not a make target. `docs/guide/screenshots.zh-CN.md` is the entry point agents are pointed at from CLAUDE.md; it states the use cases (release notes between two versions, a single feature diagram, a mobile flow walkthrough), the commands, the scenario format, the document-assembly schema, and how to extend the mocks when a screen changes. Two rules keep it a tool rather than a pile of binaries: captures and the generated demo figures are gitignored (never committed), and the harness-only web dependencies are installed into the mobile workspace with `--no-save`, leaving `package.json` / `package-lock.json` untouched. Also fixes a latent config bug this surfaced: `eslint.config.mjs` scoped the Tailwind plugin's `cssConfigPath` to `src/**`, so linting any second file scope made the plugin fall back to a non-existent `src/style.css` and the whole run failed.
huichen
force-pushed
the
feat/screenshot-kit
branch
from
September 17, 2026 10:03
8362ee7 to
df8d9b6
Compare
huichen
enabled auto-merge (squash)
September 17, 2026 10:03
This was referenced Sep 17, 2026
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.
What
Product screenshots previously required a person sitting in front of a running app: the desktop UI is a Tauri webview and the mobile UI is React Native, and both read their content from a local backend a browser cannot reach. That made screenshots impossible in CI, over SSH, or in a session without screen-recording permission.
This adds a harness that renders the real frontends in a local headless Chrome, against fixed demo data:
desktop/src/**— every component, hook, store, worker, style@tauri-apps/*IPC, answered in-page (desktop/shot/mock/)mobile/src/**,mobile/App.tsxmobile/src/remote/RemoteContext(the NATS client) + two native modules (mobile/shot/mock/)Interactions are dispatched as real input events, so a capture reflects what the UI actually does; only the data source is fabricated.
Usage
capture.pyalso does terminal-frame rendering for CLI output and PDF assembly from captured PNGs plus captions (scripts/screenshots/examples/release-notes-1.1.8.jsonis the worked example).Deliberate boundaries
.screenshots/anddesktop/shot/assets/(generated demo figures) are gitignored;capture.pyregenerates the figures on demand.--no-save, somobile/package.jsonandpackage-lock.jsonare untouched.SHOT_WEB=1and the web platform.desktop/shot/main.tsxcan pin the UI language (?lang=en), seed app settings (?settings=…), and replay shortcuts the driver cannot send (?press=meta+f).Also fixes
desktop/eslint.config.mjsscoped the Tailwind plugin'scssConfigPathtosrc/**. The plugin loads the project's CSS entry for any linted file, so linting a second file scope (the harness) made it fall back to a non-existentsrc/style.cssand the entire eslint run errored out. The setting is now global.Verification
desktop:tsc --noEmit,eslint,vitest run(1141 tests),stylelint— all pass.mobile:tsc --noEmit,eslint,jest(1595 tests) — all pass.scripts/check-docs.py— clean for the new docs (the 4 remaining findings are pre-existing onmainundermobile/docs/, confirmed by stashing).15/15each) with the driver now failing loudly on an unreachable target.Docs
docs/guide/screenshots.md(en/zh): when to use this and when not to, the commands, the scenario format, how to extend the mocks, and the failure modes worth knowing.