@blazediff/agent 0.3.0 → 0.4.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
@@ -43,15 +43,15 @@ Commit `.blazediff/` (config + manifest + baselines). All commands accept `--jso
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 into Claude Code / Codex / Cursor</td></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
47
  <tr><td><code>init</code></td><td>Detect framework, write <code>.blazediff/config.json</code></td></tr>
48
48
  <tr><td><code>discover</code></td><td>BFS-crawl routes from <code>baseUrl</code></td></tr>
49
49
  <tr><td><code>capture --stdin</code></td><td>Screenshot routes from stdin JSON, write baselines/actuals</td></tr>
50
- <tr><td><code>check</code></td><td>Re-capture, diff against baseline, emit <code>CheckReport</code>. <code>--judge host</code> suspends on the first ambiguous entry; <code>--apply-judgments</code> resumes from <code>.blazediff/checkpoints/</code> once verdicts are written.</td></tr>
51
- <tr><td><code>rewrite &lt;id...&gt;</code></td><td>Re-baseline existing entries (also <code>--failed</code> / <code>--all</code>). Cleans stale <code>actual/</code>, <code>judgments/</code>, <code>summary.md</code>, <code>checkpoints/</code> for the rewritten ids.</td></tr>
50
+ <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>
51
+ <tr><td><code>rewrite &lt;id...&gt;</code></td><td>Re-baseline existing entries (also <code>--failed</code> / <code>--all</code>). Cleans stale <code>actual/</code>, <code>judgments/</code>, <code>report.json</code>, <code>checkpoints/</code> for the rewritten ids.</td></tr>
52
52
  <tr><td><code>diff &lt;id&gt;</code></td><td>Re-diff one entry without re-screenshotting</td></tr>
53
53
  <tr><td><code>manifest</code></td><td>Inspect / list manifest entries</td></tr>
54
- <tr><td><code>auth init</code></td><td>Record a login harness via Playwright codegen, rewrite credentials to env-var refs, write <code>.blazediff/harnesses/auth.js</code></td></tr>
54
+ <tr><td><code>harness record &lt;name&gt;</code></td><td>Record an interaction via Playwright codegen into <code>.blazediff/harnesses/&lt;name&gt;.js</code>. <code>--login</code> rewrites typed credentials to env-var refs</td></tr>
55
55
  <tr><td><code>serve-status</code></td><td>Start / stop / probe the dev server</td></tr>
56
56
  <tr><td><code>browsers install</code></td><td>Install bundled Playwright Chromium</td></tr>
57
57
  <tr><td><code>reset --yes</code></td><td>Wipe <code>.blazediff/</code></td></tr>
@@ -62,16 +62,25 @@ Pass `--cwd <abs-path>` to target a sub-package in a monorepo.
62
62
  ## Onboarding
63
63
 
64
64
  ```bash
65
- blazediff-agent onboard # auto-detect harness
66
- blazediff-agent onboard --harness codex # explicit
67
- blazediff-agent onboard --harness all
65
+ blazediff-agent onboard # auto-detect coding-agent stack
66
+ blazediff-agent onboard --stack codex # explicit
67
+ blazediff-agent onboard --stack all # claude + codex + cursor
68
+ blazediff-agent onboard --stack local # local judge, no host agent (Moondream + Qwen)
68
69
  ```
69
70
 
70
- Writes:
71
+ For coding-agent stacks, writes the playbook and sets `config.judge: "host"`:
71
72
  - Claude Code → `<project>/.claude/skills/blazediff/SKILL.md`
72
73
  - Codex → `~/.codex/skills/blazediff/SKILL.md`
73
74
  - Cursor → `<project>/.cursor/rules/blazediff.mdc`
74
75
 
76
+ `--stack local` writes no skill file. It sets `config.judge: "local"` so `check`
77
+ judges diffs locally in two steps: Moondream 2 describes the change, then
78
+ Qwen3.5-0.8B classifies it using that description plus the deterministic
79
+ `interpret` summary (both via the optional peer dependency
80
+ `@huggingface/transformers`; install it with `npm i @huggingface/transformers`).
81
+ Each model loads once on the first judgment and is reused for the rest of the run.
82
+ `local` cannot be combined with the coding-agent stacks.
83
+
75
84
  ## Masking
76
85
 
77
86
  Mark non-deterministic content (carousels, clocks, randomized avatars) in source:
@@ -123,13 +132,13 @@ export default {
123
132
 
124
133
  ### Auth-protected routes
125
134
 
126
- Login is a `phase:"setup"` harness. For a simple form login, the agent writes
135
+ Login is just a `phase:"setup"` harness. For a simple form login, the agent writes
127
136
  `.blazediff/harnesses/auth.js` directly — a `goto(/login)` → fill from
128
137
  `process.env.BLAZEDIFF_AUTH_<PERSONA>_EMAIL` / `..._PASSWORD` → submit → assert it
129
138
  left `/login`. No credentials ever live in the file, only env refs. For flows it
130
- can't author (OAuth/SSO, MFA, captcha), `blazediff-agent auth init` records the
131
- login interactively via Playwright codegen and rewrites the typed creds to env
132
- refs.
139
+ can't author (OAuth/SSO, MFA, captcha), `blazediff-agent harness record auth --login`
140
+ records the login interactively via Playwright codegen and rewrites the typed creds
141
+ to env refs.
133
142
 
134
143
  Attach it with `"harnesses": [{ "name": "auth", "params": { "persona": "default" } }]`,
135
144
  then put `BLAZEDIFF_AUTH_<PERSONA>_EMAIL` / `..._PASSWORD` in an env file the CLI
package/SKILL.md CHANGED
@@ -111,7 +111,7 @@ Rules:
111
111
  Login is just a `phase:"setup"` harness. Credentials live only in env vars — never in the LLM, manifest, or harness file (the harness references `process.env.BLAZEDIFF_AUTH_*`, nothing else).
112
112
 
113
113
  1. **Already present?** If `.blazediff/harnesses/auth.js` exists, skip to step 4. (Legacy `.blazediff/auth.js` from before the harness change must be regenerated.)
114
- 2. **Author it directly — preferred when creds are available.** If creds are in the env / `.blazediff/.env` (or the user can supply them), **write the harness yourself; do not make the user run `auth init`.** Identify the login form's email / password / submit selectors by reading the `/login` route's source component (prefer `name=` / `type=` / `id=` / role-based selectors; avoid `nth-child`), or by snapshotting the live page. Write `.blazediff/harnesses/auth.js`:
114
+ 2. **Author it directly — preferred when creds are available.** If creds are in the env / `.blazediff/.env` (or the user can supply them), **write the harness yourself; do not make the user run `harness record`.** Identify the login form's email / password / submit selectors by reading the `/login` route's source component (prefer `name=` / `type=` / `id=` / role-based selectors; avoid `nth-child`), or by snapshotting the live page. Write `.blazediff/harnesses/auth.js`:
115
115
  ```js
116
116
  /** @type {import("@blazediff/agent").Harness<{ persona?: string }>} */
117
117
  export default {
@@ -135,14 +135,14 @@ Login is just a `phase:"setup"` harness. Credentials live only in env vars — n
135
135
  };
136
136
  ```
137
137
  Never inline real credentials — only `process.env.BLAZEDIFF_AUTH_*` references.
138
- 3. **Fallback: interactive recorder.** Only when you can't reduce login to fill-fields-and-submit — OAuth/SSO, captcha, MFA, multi-step — tell the user to run `blazediff-agent --cwd "$TARGET" auth init --persona default --login-url <login URL>` (opens Playwright codegen; they log in once; typed creds are rewritten to env-var refs and written to `.blazediff/harnesses/auth.js`). You can't drive the recorder yourself.
138
+ 3. **Fallback: interactive recorder.** Only when you can't reduce login to fill-fields-and-submit — OAuth/SSO, captcha, MFA, multi-step — tell the user to run `blazediff-agent --cwd "$TARGET" harness record auth --login --persona default --url <login URL>` (opens Playwright codegen; they log in once; typed creds are rewritten to env-var refs and written to `.blazediff/harnesses/auth.js`). You can't drive the recorder yourself.
139
139
  4. **Per entry.** Add `{ "name": "auth", "params": { "persona": "<persona>" } }` to the entry's `harnesses` (use `"default"` unless the user specifies otherwise).
140
140
  5. **Env vars.** The harness reads `BLAZEDIFF_AUTH_<PERSONA>_EMAIL` / `..._PASSWORD` at capture time. The CLI auto-loads env files from `--cwd`: `.blazediff/.env[.local]` (blazediff-scoped, auto-gitignored) then the project-root `.env[.local]`; real exported env wins, and `.blazediff/` files beat the app root. Drop creds in `.blazediff/.env`. If the user hasn't supplied any, ask for them — don't invent placeholders.
141
141
 
142
142
  ## Hard rules
143
143
  - Never `--mode baseline` an existing manifest entry without explicit user request.
144
144
  - Never edit `.blazediff/manifest.json` directly.
145
- - Author login and interaction harnesses directly under `.blazediff/harnesses/` when you can (login: simple form, creds via env). Use `auth init` only for flows you can't author (OAuth/SSO/MFA/captcha). Never write real credentials into a harness file — env refs only.
145
+ - Author login and interaction harnesses directly under `.blazediff/harnesses/` when you can (login: simple form, creds via env). Use `harness record` only for flows you can't author (OAuth/SSO/MFA/captcha). Never write real credentials into a harness file — env refs only.
146
146
  - In CI (`CI=1` or no TTY), only `check` is allowed.
147
147
  - A route that times out is logged once in the result array and skipped — never block the run.
148
148
  - Never leave a dev server running after authoring exits. Teardown is mandatory on every exit path (success, capture failure, user interrupt). If you can't run teardown for some reason, tell the user the port number to kill manually.