@blazediff/agent 0.4.0 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -24,27 +24,26 @@ Visual regression testing your coding agent can judge. Discovers routes, screens
24
24
  npm install --save-dev @blazediff/agent
25
25
  ```
26
26
 
27
- First run prompts to install bundled Chromium.
28
-
29
27
  ## Quickstart
30
28
 
31
29
  ```bash
32
- blazediff-agent init # write .blazediff/config.json
33
- blazediff-agent browsers install # ensure chromium
34
- echo '[{"id":"home","url":"/"}]' \
35
- | blazediff-agent capture --stdin --mode baseline
36
- blazediff-agent check --judge host # CI
37
- blazediff-agent rewrite home # accept intentional change
30
+ blazediff-agent onboard # interactive: config + chromium + playbook + baselines
31
+ blazediff-agent check --judge host # CI: re-capture, diff, judge
32
+ blazediff-agent rewrite home # accept an intentional change
38
33
  ```
39
34
 
40
- Commit `.blazediff/` (config + manifest + baselines). All commands accept `--json`.
35
+ `onboard` writes `.blazediff/config.json`, installs bundled Chromium, installs the
36
+ playbook for your coding agent, and offers to capture baselines on the spot. The
37
+ second command (`check`, or `capture` if you declined the baseline offer) starts
38
+ capturing. Commit `.blazediff/` (config + manifest + baselines). All commands
39
+ accept `--json`; under `--json`/CI, `onboard` runs non-interactively (no prompts,
40
+ no capture) — a scriptable config + chromium step.
41
41
 
42
42
  ## Commands
43
43
 
44
44
  <table>
45
45
  <tr><th width="200">Command</th><th>Description</th></tr>
46
- <tr><td><code>onboard</code></td><td>Install the playbook for your stack: Claude Code / Codex / Cursor, or <code>local</code> for a local (Moondream + Qwen) judge</td></tr>
47
- <tr><td><code>init</code></td><td>Detect framework, write <code>.blazediff/config.json</code></td></tr>
46
+ <tr><td><code>onboard</code></td><td>Interactive setup: write <code>.blazediff/config.json</code>, install Chromium, install the playbook for your stack (Claude Code / Codex / Cursor, or <code>local</code> for a Moondream + Qwen judge), and optionally capture baselines</td></tr>
48
47
  <tr><td><code>discover</code></td><td>BFS-crawl routes from <code>baseUrl</code></td></tr>
49
48
  <tr><td><code>capture --stdin</code></td><td>Screenshot routes from stdin JSON, write baselines/actuals</td></tr>
50
49
  <tr><td><code>check</code></td><td>Re-capture, diff against baseline, emit <code>CheckReport</code>. Judge backend defaults to <code>config.judge</code> (set by <code>onboard</code>), overridable with <code>--judge host|none|local</code>. <code>--judge host</code> suspends on the first ambiguous entry (<code>--apply-judgments</code> resumes once verdicts are written); <code>--judge local</code> judges inline with local models (Moondream describes, Qwen classifies) — no host round-trip.</td></tr>
@@ -59,15 +58,21 @@ Commit `.blazediff/` (config + manifest + baselines). All commands accept `--jso
59
58
 
60
59
  Pass `--cwd <abs-path>` to target a sub-package in a monorepo.
61
60
 
62
- ## Onboarding
61
+ ## Onboard options
62
+
63
+ `onboard` auto-detects your coding agent; override or scope the playbook with `--stack`:
63
64
 
64
65
  ```bash
65
- blazediff-agent onboard # auto-detect coding-agent stack
66
66
  blazediff-agent onboard --stack codex # explicit
67
67
  blazediff-agent onboard --stack all # claude + codex + cursor
68
68
  blazediff-agent onboard --stack local # local judge, no host agent (Moondream + Qwen)
69
+ blazediff-agent onboard --no-browsers --no-capture # config + playbook only
69
70
  ```
70
71
 
72
+ Other flags: `--url <baseUrl>` (external/running server), `--dev-command <cmd>` /
73
+ `--port <n>` / `--dev-script <name>` (override detection), `--yes` (accept prompts),
74
+ `--force` (rewrite config + playbook).
75
+
71
76
  For coding-agent stacks, writes the playbook and sets `config.judge: "host"`:
72
77
  - Claude Code → `<project>/.claude/skills/blazediff/SKILL.md`
73
78
  - Codex → `~/.codex/skills/blazediff/SKILL.md`
package/SKILL.md CHANGED
@@ -56,20 +56,21 @@ When the user asks to wipe blazediff's state and start over (manifest stale beyo
56
56
  - Then re-run the full **authoring** flow below. Do not call `reset` without explicit user request — it discards committed baselines.
57
57
 
58
58
  ## authoring
59
- 1. **Config.**
60
- - User points at a URL ("test https://blazediff.dev", "server's running on :3001") → `blazediff-agent --cwd "$TARGET" init --url <url> --json`.
61
- - Local app, dev script ambiguous or wrong → `init --dev-command "<cmd>" --port <n> --json`.
62
- - Local app, single obvious dev script → `init --json`. On error or ambiguity, the CLI lists candidates; pick one with `--dev-script <name>`.
63
- 2. **Chromium.** `blazediff-agent browsers install --check --json`. If `installed: false`, run `blazediff-agent browsers install`. This uses the bundled playwright — no sudo, no `npx playwright install --with-deps`. (On Linux, OS-level deps for chromium may still need `npx playwright install-deps chromium` if the run fails on missing libs; tell the user.)
64
- 3. **Dev server.** If `config.devServer` is non-null, run `blazediff-agent --cwd "$TARGET" serve-status --detach --json`. **Expect this to wait up to 60s** for the port to open before returning. Do not background or poll it.
65
- 4. **Discover routes.** Prefer reading the router source directly:
59
+ 1. **Setup (config + Chromium).** One `onboard --json` call writes `.blazediff/config.json` and ensures bundled Chromium (no prompts under `--json`; no capture step):
60
+ - User points at a URL ("test https://blazediff.dev", "server's running on :3001") → `blazediff-agent --cwd "$TARGET" onboard --url <url> --json`.
61
+ - Local app, dev script ambiguous or wrong → `onboard --dev-command "<cmd>" --port <n> --json`.
62
+ - Local app, single obvious dev script → `onboard --json`. When multiple dev scripts exist, non-interactive picks the highest-priority one (`dev`); override with `--dev-script <name>`.
63
+
64
+ Chromium uses the bundled playwright — no sudo, no `npx playwright install --with-deps`. (On Linux, OS-level deps may still need `npx playwright install-deps chromium` if a run fails on missing libs; tell the user.) Skip either step with `--no-browsers`.
65
+ 2. **Dev server.** If `config.devServer` is non-null, run `blazediff-agent --cwd "$TARGET" serve-status --detach --json`. **Expect this to wait up to 60s** for the port to open before returning. Do not background or poll it.
66
+ 3. **Discover routes.** Prefer reading the router source directly:
66
67
  - Next.js: `app/**/page.{tsx,jsx,mdx}` + `pages/**/*.{tsx,jsx}` (skip `api/`, `_app`, `_document`, `_error`).
67
68
  - Vite + react-router: parse `<Route path=...>` in `router.{ts,tsx}`.
68
69
  - Remix / SvelteKit / Astro: walk `app/routes` or `src/routes`.
69
70
 
70
71
  If the framework is unknown or the router source is opaque, call `blazediff-agent --cwd "$TARGET" discover --json`. That command does a BFS crawl from the configured `baseUrl` (depth 2, up to 50 routes), reads `.next/routes-manifest.json` if present, and reads `/sitemap.xml`. It's a fallback for when source-walking fails.
71
- 5. **Filter.** Drop `/api/*`, dynamic segments without sample data, redirects/404s. For routes that need login or any pre-screenshot interaction, attach a harness via `harnesses: [...]` on the entry. See **harnesses** below.
72
- 6. **Capture in one call.** Build a JSON array of route entries and pipe it through stdin:
72
+ 4. **Filter.** Drop `/api/*`, dynamic segments without sample data, redirects/404s. For routes that need login or any pre-screenshot interaction, attach a harness via `harnesses: [...]` on the entry. See **harnesses** below.
73
+ 5. **Capture in one call.** Build a JSON array of route entries and pipe it through stdin:
73
74
  ```
74
75
  cat <<'EOF' | blazediff-agent --cwd "$TARGET" capture --stdin --mode baseline --json
75
76
  [