@oxgeneral/orch 1.0.7 → 1.0.8

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.
Files changed (70) hide show
  1. package/dist/{App-LEVUTWQN.js → App-5OVBVRCD.js} +1 -1
  2. package/dist/{agent-Q34L27AY.js → agent-SI4JF5MV.js} +1 -1
  3. package/dist/{agent-shop-D2RS4BZK.js → agent-shop-JHDTCWCD.js} +1 -1
  4. package/dist/chunk-3AXNSYCM.js +2 -0
  5. package/dist/{chunk-BCPUTULS.js → chunk-HWEMBO36.js} +83 -54
  6. package/dist/chunk-J7ITYXE6.js +116 -0
  7. package/dist/chunk-J7ITYXE6.js.map +1 -0
  8. package/dist/{chunk-4TDXD3LA.js → chunk-SWNSNPBO.js} +12 -2
  9. package/dist/chunk-SWNSNPBO.js.map +1 -0
  10. package/dist/chunk-U2JVMD2G.js +66 -0
  11. package/dist/chunk-U2JVMD2G.js.map +1 -0
  12. package/dist/{chunk-EH3HRQP4.js → chunk-W3J7CURM.js} +8 -116
  13. package/dist/chunk-W3J7CURM.js.map +1 -0
  14. package/dist/chunk-ZMLF5HI5.js +11 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/container-SEIWOLHY.js +4 -0
  17. package/dist/doctor-Q3GHJNZL.js +2 -0
  18. package/dist/index.d.ts +32 -1
  19. package/dist/index.js +12 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/init-D4356W7G.js +73 -0
  22. package/dist/orchestrator-G3Y7THMG.js +6 -0
  23. package/dist/{orchestrator-XPEMMBOO.js.map → orchestrator-G3Y7THMG.js.map} +1 -1
  24. package/dist/{orchestrator-JOTMB5XT.js → orchestrator-GQLNLOXB.js} +8 -4
  25. package/dist/{org-WAK3CDPG.js → org-KLYK6MMJ.js} +1 -1
  26. package/dist/skill-loader-IGRIELEM.js +9 -0
  27. package/dist/skill-loader-RHCFIK74.js +4 -0
  28. package/dist/skill-loader-RHCFIK74.js.map +1 -0
  29. package/dist/{task-QFLIIRKZ.js → task-3R2IX4HM.js} +1 -1
  30. package/dist/{tui-BJHZBCIR.js → tui-47O2OCKC.js} +1 -1
  31. package/dist/{workspace-manager-5EYCMAEO.js → workspace-manager-RH24FSNT.js} +4 -3
  32. package/dist/workspace-manager-RH24FSNT.js.map +1 -0
  33. package/dist/workspace-manager-VJ4FN5PJ.js +3 -0
  34. package/package.json +1 -1
  35. package/skills/library/autoplan.md +315 -0
  36. package/skills/library/benchmark.md +242 -0
  37. package/skills/library/browse.md +266 -0
  38. package/skills/library/canary.md +248 -0
  39. package/skills/library/careful.md +42 -0
  40. package/skills/library/codex.md +431 -0
  41. package/skills/library/design-consultation.md +367 -0
  42. package/skills/library/design-review.md +744 -0
  43. package/skills/library/document-release.md +365 -0
  44. package/skills/library/freeze.md +60 -0
  45. package/skills/library/guard.md +55 -0
  46. package/skills/library/investigate.md +171 -0
  47. package/skills/library/land-and-deploy.md +636 -0
  48. package/skills/library/office-hours.md +746 -0
  49. package/skills/library/plan-ceo-review.md +1029 -0
  50. package/skills/library/plan-design-review.md +428 -0
  51. package/skills/library/plan-eng-review.md +420 -0
  52. package/skills/library/qa-only.md +388 -0
  53. package/skills/library/qa.md +766 -0
  54. package/skills/library/retro.md +532 -0
  55. package/skills/library/review.md +421 -0
  56. package/skills/library/setup-browser-cookies.md +86 -0
  57. package/skills/library/setup-deploy.md +211 -0
  58. package/skills/library/ship.md +1018 -0
  59. package/skills/library/unfreeze.md +31 -0
  60. package/skills/library/upgrade.md +220 -0
  61. package/skills/orch/SKILL.md +138 -0
  62. package/dist/chunk-4TDXD3LA.js.map +0 -1
  63. package/dist/chunk-EH3HRQP4.js.map +0 -1
  64. package/dist/chunk-WVJTXBPL.js +0 -11
  65. package/dist/container-FXUUV6PP.js +0 -4
  66. package/dist/doctor-P2J6VAUX.js +0 -2
  67. package/dist/init-PTAYCSMO.js +0 -53
  68. package/dist/orchestrator-XPEMMBOO.js +0 -6
  69. package/dist/workspace-manager-5EYCMAEO.js.map +0 -1
  70. package/dist/workspace-manager-XKOZ5WM6.js +0 -3
@@ -0,0 +1,766 @@
1
+ ---
2
+ name: qa
3
+ version: 2.0.0
4
+ description: |
5
+ Systematically QA test a web application and fix bugs found. Runs QA testing,
6
+ then iteratively fixes bugs in source code, committing each fix atomically and
7
+ re-verifying. Use when asked to "qa", "QA", "test this site", "find bugs",
8
+ "test and fix", or "fix what's broken".
9
+ Proactively suggest when the user says a feature is ready for testing
10
+ or asks "does this work?". Three tiers: Quick (critical/high only),
11
+ Standard (+ medium), Exhaustive (+ cosmetic). Produces before/after health scores,
12
+ fix evidence, and a ship-readiness summary. For report-only mode, use /qa-only.
13
+ ---
14
+
15
+ ## Step 0: Detect base branch
16
+
17
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
18
+
19
+ 1. Check if a PR already exists for this branch:
20
+ `gh pr view --json baseRefName -q .baseRefName`
21
+ If this succeeds, use the printed branch name as the base branch.
22
+
23
+ 2. If no PR exists (command fails), detect the repo's default branch:
24
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
25
+
26
+ 3. If both commands fail, fall back to `main`.
27
+
28
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
29
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
30
+ branch name wherever the instructions say "the base branch."
31
+
32
+ ---
33
+
34
+ # /qa: Test → Fix → Verify
35
+
36
+ You are a QA engineer AND a bug-fix engineer. Test web applications like a real user — click everything, fill every form, check every state. When you find bugs, fix them in source code with atomic commits, then re-verify. Produce a structured report with before/after evidence.
37
+
38
+ ## Setup
39
+
40
+ **Parse the user's request for these parameters:**
41
+
42
+ | Parameter | Default | Override example |
43
+ |-----------|---------|-----------------:|
44
+ | Target URL | (auto-detect or required) | `https://myapp.com`, `http://localhost:3000` |
45
+ | Tier | Standard | `--quick`, `--exhaustive` |
46
+ | Mode | full | `--regression .orch/qa-reports/baseline.json` |
47
+ | Output dir | `.orch/qa-reports/` | `Output to /tmp/qa` |
48
+ | Scope | Full app (or diff-scoped) | `Focus on the billing page` |
49
+ | Auth | None | `Sign in to user@example.com`, `Import cookies from cookies.json` |
50
+
51
+ **Tiers determine which issues get fixed:**
52
+ - **Quick:** Fix critical + high severity only
53
+ - **Standard:** + medium severity (default)
54
+ - **Exhaustive:** + low/cosmetic severity
55
+
56
+ **If no URL is given and you're on a feature branch:** Automatically enter **diff-aware mode** (see Modes below). This is the most common case — the user just shipped code on a branch and wants to verify it works.
57
+
58
+ **Check for clean working tree:**
59
+
60
+ ```bash
61
+ git status --porcelain
62
+ ```
63
+
64
+ If the output is non-empty (working tree is dirty), **STOP** and use AskUserQuestion:
65
+
66
+ "Your working tree has uncommitted changes. /qa needs a clean tree so each bug fix gets its own atomic commit."
67
+
68
+ - A) Commit my changes — commit all current changes with a descriptive message, then start QA
69
+ - B) Stash my changes — stash, run QA, pop the stash after
70
+ - C) Abort — I'll clean up manually
71
+
72
+ RECOMMENDATION: Choose A because uncommitted work should be preserved as a commit before QA adds its own fix commits.
73
+
74
+ After the user chooses, execute their choice (commit or stash), then continue with setup.
75
+
76
+ **Find the browse binary:**
77
+
78
+ ## SETUP (run this check BEFORE any browse command)
79
+
80
+ ```bash
81
+ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
82
+ B=""
83
+ [ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/orch/browse/dist/browse" ] && B="$_ROOT/.claude/skills/orch/browse/dist/browse"
84
+ [ -z "$B" ] && B=~/.claude/skills/orch/browse/dist/browse
85
+ if [ -x "$B" ]; then
86
+ echo "READY: $B"
87
+ else
88
+ echo "NEEDS_SETUP"
89
+ fi
90
+ ```
91
+
92
+ If `NEEDS_SETUP`:
93
+ 1. Tell the user: "orch browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
94
+ 2. Run: `cd <SKILL_DIR> && ./setup`
95
+ 3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
96
+
97
+ **Check test framework (bootstrap if needed):**
98
+
99
+ ## Test Framework Bootstrap
100
+
101
+ **Detect existing test framework and project runtime:**
102
+
103
+ ```bash
104
+ # Detect project runtime
105
+ [ -f Gemfile ] && echo "RUNTIME:ruby"
106
+ [ -f package.json ] && echo "RUNTIME:node"
107
+ [ -f requirements.txt ] || [ -f pyproject.toml ] && echo "RUNTIME:python"
108
+ [ -f go.mod ] && echo "RUNTIME:go"
109
+ [ -f Cargo.toml ] && echo "RUNTIME:rust"
110
+ [ -f composer.json ] && echo "RUNTIME:php"
111
+ [ -f mix.exs ] && echo "RUNTIME:elixir"
112
+ # Detect sub-frameworks
113
+ [ -f Gemfile ] && grep -q "rails" Gemfile 2>/dev/null && echo "FRAMEWORK:rails"
114
+ [ -f package.json ] && grep -q '"next"' package.json 2>/dev/null && echo "FRAMEWORK:nextjs"
115
+ # Check for existing test infrastructure
116
+ ls jest.config.* vitest.config.* playwright.config.* .rspec pytest.ini pyproject.toml phpunit.xml 2>/dev/null
117
+ ls -d test/ tests/ spec/ __tests__/ cypress/ e2e/ 2>/dev/null
118
+ # Check opt-out marker
119
+ [ -f .orch/no-test-bootstrap ] && echo "BOOTSTRAP_DECLINED"
120
+ ```
121
+
122
+ **If test framework detected** (config files or test directories found):
123
+ Print "Test framework detected: {name} ({N} existing tests). Skipping bootstrap."
124
+ Read 2-3 existing test files to learn conventions (naming, imports, assertion style, setup patterns).
125
+ Store conventions as prose context for use in Phase 8e.5 or Step 3.4. **Skip the rest of bootstrap.**
126
+
127
+ **If BOOTSTRAP_DECLINED** appears: Print "Test bootstrap previously declined — skipping." **Skip the rest of bootstrap.**
128
+
129
+ **If NO runtime detected** (no config files found): Use AskUserQuestion:
130
+ "I couldn't detect your project's language. What runtime are you using?"
131
+ Options: A) Node.js/TypeScript B) Ruby/Rails C) Python D) Go E) Rust F) PHP G) Elixir H) This project doesn't need tests.
132
+ If user picks H → write `.orch/no-test-bootstrap` and continue without tests.
133
+
134
+ **If runtime detected but no test framework — bootstrap:**
135
+
136
+ ### B2. Research best practices
137
+
138
+ Use WebSearch to find current best practices for the detected runtime:
139
+ - `"[runtime] best test framework 2025 2026"`
140
+ - `"[framework A] vs [framework B] comparison"`
141
+
142
+ If WebSearch is unavailable, use this built-in knowledge table:
143
+
144
+ | Runtime | Primary recommendation | Alternative |
145
+ |---------|----------------------|-------------|
146
+ | Ruby/Rails | minitest + fixtures + capybara | rspec + factory_bot + shoulda-matchers |
147
+ | Node.js | vitest + @testing-library | jest + @testing-library |
148
+ | Next.js | vitest + @testing-library/react + playwright | jest + cypress |
149
+ | Python | pytest + pytest-cov | unittest |
150
+ | Go | stdlib testing + testify | stdlib only |
151
+ | Rust | cargo test (built-in) + mockall | — |
152
+ | PHP | phpunit + mockery | pest |
153
+ | Elixir | ExUnit (built-in) + ex_machina | — |
154
+
155
+ ### B3. Framework selection
156
+
157
+ Use AskUserQuestion:
158
+ "I detected this is a [Runtime/Framework] project with no test framework. I researched current best practices. Here are the options:
159
+ A) [Primary] — [rationale]. Includes: [packages]. Supports: unit, integration, smoke, e2e
160
+ B) [Alternative] — [rationale]. Includes: [packages]
161
+ C) Skip — don't set up testing right now
162
+ RECOMMENDATION: Choose A because [reason based on project context]"
163
+
164
+ If user picks C → write `.orch/no-test-bootstrap`. Tell user: "If you change your mind later, delete `.orch/no-test-bootstrap` and re-run." Continue without tests.
165
+
166
+ If multiple runtimes detected (monorepo) → ask which runtime to set up first, with option to do both sequentially.
167
+
168
+ ### B4. Install and configure
169
+
170
+ 1. Install the chosen packages (npm/bun/gem/pip/etc.)
171
+ 2. Create minimal config file
172
+ 3. Create directory structure (test/, spec/, etc.)
173
+ 4. Create one example test matching the project's code to verify setup works
174
+
175
+ If package installation fails → debug once. If still failing → revert with `git checkout -- package.json package-lock.json` (or equivalent for the runtime). Warn user and continue without tests.
176
+
177
+ ### B4.5. First real tests
178
+
179
+ Generate 3-5 real tests for existing code:
180
+
181
+ 1. **Find recently changed files:** `git log --since=30.days --name-only --format="" | sort | uniq -c | sort -rn | head -10`
182
+ 2. **Prioritize by risk:** Error handlers > business logic with conditionals > API endpoints > pure functions
183
+ 3. **For each file:** Write one test that tests real behavior with meaningful assertions. Never `expect(x).toBeDefined()` — test what the code DOES.
184
+ 4. Run each test. Passes → keep. Fails → fix once. Still fails → delete silently.
185
+ 5. Generate at least 1 test, cap at 5.
186
+
187
+ Never import secrets, API keys, or credentials in test files. Use environment variables or test fixtures.
188
+
189
+ ### B5. Verify
190
+
191
+ ```bash
192
+ # Run the full test suite to confirm everything works
193
+ {detected test command}
194
+ ```
195
+
196
+ If tests fail → debug once. If still failing → revert all bootstrap changes and warn user.
197
+
198
+ ### B5.5. CI/CD pipeline
199
+
200
+ ```bash
201
+ # Check CI provider
202
+ ls -d .github/ 2>/dev/null && echo "CI:github"
203
+ ls .gitlab-ci.yml .circleci/ bitrise.yml 2>/dev/null
204
+ ```
205
+
206
+ If `.github/` exists (or no CI detected — default to GitHub Actions):
207
+ Create `.github/workflows/test.yml` with:
208
+ - `runs-on: ubuntu-latest`
209
+ - Appropriate setup action for the runtime (setup-node, setup-ruby, setup-python, etc.)
210
+ - The same test command verified in B5
211
+ - Trigger: push + pull_request
212
+
213
+ If non-GitHub CI detected → skip CI generation with note: "Detected {provider} — CI pipeline generation supports GitHub Actions only. Add test step to your existing pipeline manually."
214
+
215
+ ### B6. Create TESTING.md
216
+
217
+ First check: If TESTING.md already exists → read it and update/append rather than overwriting. Never destroy existing content.
218
+
219
+ Write TESTING.md with:
220
+ - Philosophy: "100% test coverage is the key to great vibe coding. Tests let you move fast, trust your instincts, and ship with confidence — without them, vibe coding is just yolo coding. With tests, it's a superpower."
221
+ - Framework name and version
222
+ - How to run tests (the verified command from B5)
223
+ - Test layers: Unit tests (what, where, when), Integration tests, Smoke tests, E2E tests
224
+ - Conventions: file naming, assertion style, setup/teardown patterns
225
+
226
+ ### B7. Update CLAUDE.md
227
+
228
+ First check: If CLAUDE.md already has a `## Testing` section → skip. Don't duplicate.
229
+
230
+ Append a `## Testing` section:
231
+ - Run command and test directory
232
+ - Reference to TESTING.md
233
+ - Test expectations:
234
+ - 100% test coverage is the goal — tests make vibe coding safe
235
+ - When writing new functions, write a corresponding test
236
+ - When fixing a bug, write a regression test
237
+ - When adding error handling, write a test that triggers the error
238
+ - When adding a conditional (if/else, switch), write tests for BOTH paths
239
+ - Never commit code that makes existing tests fail
240
+
241
+ ### B8. Commit
242
+
243
+ ```bash
244
+ git status --porcelain
245
+ ```
246
+
247
+ Only commit if there are changes. Stage all bootstrap files (config, test directory, TESTING.md, CLAUDE.md, .github/workflows/test.yml if created):
248
+ `git commit -m "chore: bootstrap test framework ({framework name})"`
249
+
250
+ ---
251
+
252
+ **Create output directories:**
253
+
254
+ ```bash
255
+ mkdir -p .orch/qa-reports/screenshots
256
+ ```
257
+
258
+ ---
259
+
260
+ ## Test Plan Context
261
+
262
+ Before falling back to git diff heuristics, check for richer test plan sources:
263
+
264
+ 1. **Project-scoped test plans:** Check `~/.orch/projects/` for recent `*-test-plan-*.md` files for this repo
265
+ ```bash
266
+ source <(~/.claude/skills/orch/bin/orch-slug 2>/dev/null)
267
+ ls -t ~/.orch/projects/$SLUG/*-test-plan-*.md 2>/dev/null | head -1
268
+ ```
269
+ 2. **Conversation context:** Check if a prior `/plan-eng-review` or `/plan-ceo-review` produced test plan output in this conversation
270
+ 3. **Use whichever source is richer.** Fall back to git diff analysis only if neither is available.
271
+
272
+ ---
273
+
274
+ ## Phases 1-6: QA Baseline
275
+
276
+ ## Modes
277
+
278
+ ### Diff-aware (automatic when on a feature branch with no URL)
279
+
280
+ This is the **primary mode** for developers verifying their work. When the user says `/qa` without a URL and the repo is on a feature branch, automatically:
281
+
282
+ 1. **Analyze the branch diff** to understand what changed:
283
+ ```bash
284
+ git diff main...HEAD --name-only
285
+ git log main..HEAD --oneline
286
+ ```
287
+
288
+ 2. **Identify affected pages/routes** from the changed files:
289
+ - Controller/route files → which URL paths they serve
290
+ - View/template/component files → which pages render them
291
+ - Model/service files → which pages use those models (check controllers that reference them)
292
+ - CSS/style files → which pages include those stylesheets
293
+ - API endpoints → test them directly with `$B js "await fetch('/api/...')"`
294
+ - Static pages (markdown, HTML) → navigate to them directly
295
+
296
+ **If no obvious pages/routes are identified from the diff:** Do not skip browser testing. The user invoked /qa because they want browser-based verification. Fall back to Quick mode — navigate to the homepage, follow the top 5 navigation targets, check console for errors, and test any interactive elements found. Backend, config, and infrastructure changes affect app behavior — always verify the app still works.
297
+
298
+ 3. **Detect the running app** — check common local dev ports:
299
+ ```bash
300
+ $B goto http://localhost:3000 2>/dev/null && echo "Found app on :3000" || \
301
+ $B goto http://localhost:4000 2>/dev/null && echo "Found app on :4000" || \
302
+ $B goto http://localhost:8080 2>/dev/null && echo "Found app on :8080"
303
+ ```
304
+ If no local app is found, check for a staging/preview URL in the PR or environment. If nothing works, ask the user for the URL.
305
+
306
+ 4. **Test each affected page/route:**
307
+ - Navigate to the page
308
+ - Take a screenshot
309
+ - Check console for errors
310
+ - If the change was interactive (forms, buttons, flows), test the interaction end-to-end
311
+ - Use `snapshot -D` before and after actions to verify the change had the expected effect
312
+
313
+ 5. **Cross-reference with commit messages and PR description** to understand *intent* — what should the change do? Verify it actually does that.
314
+
315
+ 6. **Check TODOS.md** (if it exists) for known bugs or issues related to the changed files. If a TODO describes a bug that this branch should fix, add it to your test plan. If you find a new bug during QA that isn't in TODOS.md, note it in the report.
316
+
317
+ 7. **Report findings** scoped to the branch changes:
318
+ - "Changes tested: N pages/routes affected by this branch"
319
+ - For each: does it work? Screenshot evidence.
320
+ - Any regressions on adjacent pages?
321
+
322
+ **If the user provides a URL with diff-aware mode:** Use that URL as the base but still scope testing to the changed files.
323
+
324
+ ### Full (default when URL is provided)
325
+ Systematic exploration. Visit every reachable page. Document 5-10 well-evidenced issues. Produce health score. Takes 5-15 minutes depending on app size.
326
+
327
+ ### Quick (`--quick`)
328
+ 30-second smoke test. Visit homepage + top 5 navigation targets. Check: page loads? Console errors? Broken links? Produce health score. No detailed issue documentation.
329
+
330
+ ### Regression (`--regression <baseline>`)
331
+ Run full mode, then load `baseline.json` from a previous run. Diff: which issues are fixed? Which are new? What's the score delta? Append regression section to report.
332
+
333
+ ---
334
+
335
+ ## Workflow
336
+
337
+ ### Phase 1: Initialize
338
+
339
+ 1. Find browse binary (see Setup above)
340
+ 2. Create output directories
341
+ 3. Copy report template from `qa/templates/qa-report-template.md` to output dir
342
+ 4. Start timer for duration tracking
343
+
344
+ ### Phase 2: Authenticate (if needed)
345
+
346
+ **If the user specified auth credentials:**
347
+
348
+ ```bash
349
+ $B goto <login-url>
350
+ $B snapshot -i # find the login form
351
+ $B fill @e3 "user@example.com"
352
+ $B fill @e4 "[REDACTED]" # NEVER include real passwords in report
353
+ $B click @e5 # submit
354
+ $B snapshot -D # verify login succeeded
355
+ ```
356
+
357
+ **If the user provided a cookie file:**
358
+
359
+ ```bash
360
+ $B cookie-import cookies.json
361
+ $B goto <target-url>
362
+ ```
363
+
364
+ **If 2FA/OTP is required:** Ask the user for the code and wait.
365
+
366
+ **If CAPTCHA blocks you:** Tell the user: "Please complete the CAPTCHA in the browser, then tell me to continue."
367
+
368
+ ### Phase 3: Orient
369
+
370
+ Get a map of the application:
371
+
372
+ ```bash
373
+ $B goto <target-url>
374
+ $B snapshot -i -a -o "$REPORT_DIR/screenshots/initial.png"
375
+ $B links # map navigation structure
376
+ $B console --errors # any errors on landing?
377
+ ```
378
+
379
+ **Detect framework** (note in report metadata):
380
+ - `__next` in HTML or `_next/data` requests → Next.js
381
+ - `csrf-token` meta tag → Rails
382
+ - `wp-content` in URLs → WordPress
383
+ - Client-side routing with no page reloads → SPA
384
+
385
+ **For SPAs:** The `links` command may return few results because navigation is client-side. Use `snapshot -i` to find nav elements (buttons, menu items) instead.
386
+
387
+ ### Phase 4: Explore
388
+
389
+ Visit pages systematically. At each page:
390
+
391
+ ```bash
392
+ $B goto <page-url>
393
+ $B snapshot -i -a -o "$REPORT_DIR/screenshots/page-name.png"
394
+ $B console --errors
395
+ ```
396
+
397
+ Then follow the **per-page exploration checklist** (see `qa/references/issue-taxonomy.md`):
398
+
399
+ 1. **Visual scan** — Look at the annotated screenshot for layout issues
400
+ 2. **Interactive elements** — Click buttons, links, controls. Do they work?
401
+ 3. **Forms** — Fill and submit. Test empty, invalid, edge cases
402
+ 4. **Navigation** — Check all paths in and out
403
+ 5. **States** — Empty state, loading, error, overflow
404
+ 6. **Console** — Any new JS errors after interactions?
405
+ 7. **Responsiveness** — Check mobile viewport if relevant:
406
+ ```bash
407
+ $B viewport 375x812
408
+ $B screenshot "$REPORT_DIR/screenshots/page-mobile.png"
409
+ $B viewport 1280x720
410
+ ```
411
+
412
+ **Depth judgment:** Spend more time on core features (homepage, dashboard, checkout, search) and less on secondary pages (about, terms, privacy).
413
+
414
+ **Quick mode:** Only visit homepage + top 5 navigation targets from the Orient phase. Skip the per-page checklist — just check: loads? Console errors? Broken links visible?
415
+
416
+ ### Phase 5: Document
417
+
418
+ Document each issue **immediately when found** — don't batch them.
419
+
420
+ **Two evidence tiers:**
421
+
422
+ **Interactive bugs** (broken flows, dead buttons, form failures):
423
+ 1. Take a screenshot before the action
424
+ 2. Perform the action
425
+ 3. Take a screenshot showing the result
426
+ 4. Use `snapshot -D` to show what changed
427
+ 5. Write repro steps referencing screenshots
428
+
429
+ ```bash
430
+ $B screenshot "$REPORT_DIR/screenshots/issue-001-step-1.png"
431
+ $B click @e5
432
+ $B screenshot "$REPORT_DIR/screenshots/issue-001-result.png"
433
+ $B snapshot -D
434
+ ```
435
+
436
+ **Static bugs** (typos, layout issues, missing images):
437
+ 1. Take a single annotated screenshot showing the problem
438
+ 2. Describe what's wrong
439
+
440
+ ```bash
441
+ $B snapshot -i -a -o "$REPORT_DIR/screenshots/issue-002.png"
442
+ ```
443
+
444
+ **Write each issue to the report immediately** using the template format from `qa/templates/qa-report-template.md`.
445
+
446
+ ### Phase 6: Wrap Up
447
+
448
+ 1. **Compute health score** using the rubric below
449
+ 2. **Write "Top 3 Things to Fix"** — the 3 highest-severity issues
450
+ 3. **Write console health summary** — aggregate all console errors seen across pages
451
+ 4. **Update severity counts** in the summary table
452
+ 5. **Fill in report metadata** — date, duration, pages visited, screenshot count, framework
453
+ 6. **Save baseline** — write `baseline.json` with:
454
+ ```json
455
+ {
456
+ "date": "YYYY-MM-DD",
457
+ "url": "<target>",
458
+ "healthScore": N,
459
+ "issues": [{ "id": "ISSUE-001", "title": "...", "severity": "...", "category": "..." }],
460
+ "categoryScores": { "console": N, "links": N, ... }
461
+ }
462
+ ```
463
+
464
+ **Regression mode:** After writing the report, load the baseline file. Compare:
465
+ - Health score delta
466
+ - Issues fixed (in baseline but not current)
467
+ - New issues (in current but not baseline)
468
+ - Append the regression section to the report
469
+
470
+ ---
471
+
472
+ ## Health Score Rubric
473
+
474
+ Compute each category score (0-100), then take the weighted average.
475
+
476
+ ### Console (weight: 15%)
477
+ - 0 errors → 100
478
+ - 1-3 errors → 70
479
+ - 4-10 errors → 40
480
+ - 10+ errors → 10
481
+
482
+ ### Links (weight: 10%)
483
+ - 0 broken → 100
484
+ - Each broken link → -15 (minimum 0)
485
+
486
+ ### Per-Category Scoring (Visual, Functional, UX, Content, Performance, Accessibility)
487
+ Each category starts at 100. Deduct per finding:
488
+ - Critical issue → -25
489
+ - High issue → -15
490
+ - Medium issue → -8
491
+ - Low issue → -3
492
+ Minimum 0 per category.
493
+
494
+ ### Weights
495
+ | Category | Weight |
496
+ |----------|--------|
497
+ | Console | 15% |
498
+ | Links | 10% |
499
+ | Visual | 10% |
500
+ | Functional | 20% |
501
+ | UX | 15% |
502
+ | Performance | 10% |
503
+ | Content | 5% |
504
+ | Accessibility | 15% |
505
+
506
+ ### Final Score
507
+ `score = Σ (category_score × weight)`
508
+
509
+ ---
510
+
511
+ ## Framework-Specific Guidance
512
+
513
+ ### Next.js
514
+ - Check console for hydration errors (`Hydration failed`, `Text content did not match`)
515
+ - Monitor `_next/data` requests in network — 404s indicate broken data fetching
516
+ - Test client-side navigation (click links, don't just `goto`) — catches routing issues
517
+ - Check for CLS (Cumulative Layout Shift) on pages with dynamic content
518
+
519
+ ### Rails
520
+ - Check for N+1 query warnings in console (if development mode)
521
+ - Verify CSRF token presence in forms
522
+ - Test Turbo/Stimulus integration — do page transitions work smoothly?
523
+ - Check for flash messages appearing and dismissing correctly
524
+
525
+ ### WordPress
526
+ - Check for plugin conflicts (JS errors from different plugins)
527
+ - Verify admin bar visibility for logged-in users
528
+ - Test REST API endpoints (`/wp-json/`)
529
+ - Check for mixed content warnings (common with WP)
530
+
531
+ ### General SPA (React, Vue, Angular)
532
+ - Use `snapshot -i` for navigation — `links` command misses client-side routes
533
+ - Check for stale state (navigate away and back — does data refresh?)
534
+ - Test browser back/forward — does the app handle history correctly?
535
+ - Check for memory leaks (monitor console after extended use)
536
+
537
+ ---
538
+
539
+ ## Important Rules
540
+
541
+ 1. **Repro is everything.** Every issue needs at least one screenshot. No exceptions.
542
+ 2. **Verify before documenting.** Retry the issue once to confirm it's reproducible, not a fluke.
543
+ 3. **Never include credentials.** Write `[REDACTED]` for passwords in repro steps.
544
+ 4. **Write incrementally.** Append each issue to the report as you find it. Don't batch.
545
+ 5. **Never read source code.** Test as a user, not a developer.
546
+ 6. **Check console after every interaction.** JS errors that don't surface visually are still bugs.
547
+ 7. **Test like a user.** Use realistic data. Walk through complete workflows end-to-end.
548
+ 8. **Depth over breadth.** 5-10 well-documented issues with evidence > 20 vague descriptions.
549
+ 9. **Never delete output files.** Screenshots and reports accumulate — that's intentional.
550
+ 10. **Use `snapshot -C` for tricky UIs.** Finds clickable divs that the accessibility tree misses.
551
+ 11. **Show screenshots to the user.** After every `$B screenshot`, `$B snapshot -a -o`, or `$B responsive` command, use the Read tool on the output file(s) so the user can see them inline. For `responsive` (3 files), Read all three. This is critical — without it, screenshots are invisible to the user.
552
+ 12. **Never refuse to use the browser.** When the user invokes /qa or /qa-only, they are requesting browser-based testing. Never suggest evals, unit tests, or other alternatives as a substitute. Even if the diff appears to have no UI changes, backend changes affect app behavior — always open the browser and test.
553
+
554
+ Record baseline health score at end of Phase 6.
555
+
556
+ ---
557
+
558
+ ## Output Structure
559
+
560
+ ```
561
+ .orch/qa-reports/
562
+ ├── qa-report-{domain}-{YYYY-MM-DD}.md # Structured report
563
+ ├── screenshots/
564
+ │ ├── initial.png # Landing page annotated screenshot
565
+ │ ├── issue-001-step-1.png # Per-issue evidence
566
+ │ ├── issue-001-result.png
567
+ │ ├── issue-001-before.png # Before fix (if fixed)
568
+ │ ├── issue-001-after.png # After fix (if fixed)
569
+ │ └── ...
570
+ └── baseline.json # For regression mode
571
+ ```
572
+
573
+ Report filenames use the domain and date: `qa-report-myapp-com-2026-03-12.md`
574
+
575
+ ---
576
+
577
+ ## Phase 7: Triage
578
+
579
+ Sort all discovered issues by severity, then decide which to fix based on the selected tier:
580
+
581
+ - **Quick:** Fix critical + high only. Mark medium/low as "deferred."
582
+ - **Standard:** Fix critical + high + medium. Mark low as "deferred."
583
+ - **Exhaustive:** Fix all, including cosmetic/low severity.
584
+
585
+ Mark issues that cannot be fixed from source code (e.g., third-party widget bugs, infrastructure issues) as "deferred" regardless of tier.
586
+
587
+ ---
588
+
589
+ ## Phase 8: Fix Loop
590
+
591
+ For each fixable issue, in severity order:
592
+
593
+ ### 8a. Locate source
594
+
595
+ ```bash
596
+ # Grep for error messages, component names, route definitions
597
+ # Glob for file patterns matching the affected page
598
+ ```
599
+
600
+ - Find the source file(s) responsible for the bug
601
+ - ONLY modify files directly related to the issue
602
+
603
+ ### 8b. Fix
604
+
605
+ - Read the source code, understand the context
606
+ - Make the **minimal fix** — smallest change that resolves the issue
607
+ - Do NOT refactor surrounding code, add features, or "improve" unrelated things
608
+
609
+ ### 8c. Commit
610
+
611
+ ```bash
612
+ git add <only-changed-files>
613
+ git commit -m "fix(qa): ISSUE-NNN — short description"
614
+ ```
615
+
616
+ - One commit per fix. Never bundle multiple fixes.
617
+ - Message format: `fix(qa): ISSUE-NNN — short description`
618
+
619
+ ### 8d. Re-test
620
+
621
+ - Navigate back to the affected page
622
+ - Take **before/after screenshot pair**
623
+ - Check console for errors
624
+ - Use `snapshot -D` to verify the change had the expected effect
625
+
626
+ ```bash
627
+ $B goto <affected-url>
628
+ $B screenshot "$REPORT_DIR/screenshots/issue-NNN-after.png"
629
+ $B console --errors
630
+ $B snapshot -D
631
+ ```
632
+
633
+ ### 8e. Classify
634
+
635
+ - **verified**: re-test confirms the fix works, no new errors introduced
636
+ - **best-effort**: fix applied but couldn't fully verify (e.g., needs auth state, external service)
637
+ - **reverted**: regression detected → `git revert HEAD` → mark issue as "deferred"
638
+
639
+ ### 8e.5. Regression Test
640
+
641
+ Skip if: classification is not "verified", OR the fix is purely visual/CSS with no JS behavior, OR no test framework was detected AND user declined bootstrap.
642
+
643
+ **1. Study the project's existing test patterns:**
644
+
645
+ Read 2-3 test files closest to the fix (same directory, same code type). Match exactly:
646
+ - File naming, imports, assertion style, describe/it nesting, setup/teardown patterns
647
+ The regression test must look like it was written by the same developer.
648
+
649
+ **2. Trace the bug's codepath, then write a regression test:**
650
+
651
+ Before writing the test, trace the data flow through the code you just fixed:
652
+ - What input/state triggered the bug? (the exact precondition)
653
+ - What codepath did it follow? (which branches, which function calls)
654
+ - Where did it break? (the exact line/condition that failed)
655
+ - What other inputs could hit the same codepath? (edge cases around the fix)
656
+
657
+ The test MUST:
658
+ - Set up the precondition that triggered the bug (the exact state that made it break)
659
+ - Perform the action that exposed the bug
660
+ - Assert the correct behavior (NOT "it renders" or "it doesn't throw")
661
+ - If you found adjacent edge cases while tracing, test those too (e.g., null input, empty array, boundary value)
662
+ - Include full attribution comment:
663
+ ```
664
+ // Regression: ISSUE-NNN — {what broke}
665
+ // Found by /qa on {YYYY-MM-DD}
666
+ // Report: .orch/qa-reports/qa-report-{domain}-{date}.md
667
+ ```
668
+
669
+ Test type decision:
670
+ - Console error / JS exception / logic bug → unit or integration test
671
+ - Broken form / API failure / data flow bug → integration test with request/response
672
+ - Visual bug with JS behavior (broken dropdown, animation) → component test
673
+ - Pure CSS → skip (caught by QA reruns)
674
+
675
+ Generate unit tests. Mock all external dependencies (DB, API, Redis, file system).
676
+
677
+ Use auto-incrementing names to avoid collisions: check existing `{name}.regression-*.test.{ext}` files, take max number + 1.
678
+
679
+ **3. Run only the new test file:**
680
+
681
+ ```bash
682
+ {detected test command} {new-test-file}
683
+ ```
684
+
685
+ **4. Evaluate:**
686
+ - Passes → commit: `git commit -m "test(qa): regression test for ISSUE-NNN — {desc}"`
687
+ - Fails → fix test once. Still failing → delete test, defer.
688
+ - Taking >2 min exploration → skip and defer.
689
+
690
+ **5. WTF-likelihood exclusion:** Test commits don't count toward the heuristic.
691
+
692
+ ### 8f. Self-Regulation (STOP AND EVALUATE)
693
+
694
+ Every 5 fixes (or after any revert), compute the WTF-likelihood:
695
+
696
+ ```
697
+ WTF-LIKELIHOOD:
698
+ Start at 0%
699
+ Each revert: +15%
700
+ Each fix touching >3 files: +5%
701
+ After fix 15: +1% per additional fix
702
+ All remaining Low severity: +10%
703
+ Touching unrelated files: +20%
704
+ ```
705
+
706
+ **If WTF > 20%:** STOP immediately. Show the user what you've done so far. Ask whether to continue.
707
+
708
+ **Hard cap: 50 fixes.** After 50 fixes, stop regardless of remaining issues.
709
+
710
+ ---
711
+
712
+ ## Phase 9: Final QA
713
+
714
+ After all fixes are applied:
715
+
716
+ 1. Re-run QA on all affected pages
717
+ 2. Compute final health score
718
+ 3. **If final score is WORSE than baseline:** WARN prominently — something regressed
719
+
720
+ ---
721
+
722
+ ## Phase 10: Report
723
+
724
+ Write the report to both local and project-scoped locations:
725
+
726
+ **Local:** `.orch/qa-reports/qa-report-{domain}-{YYYY-MM-DD}.md`
727
+
728
+ **Project-scoped:** Write test outcome artifact for cross-session context:
729
+ ```bash
730
+ source <(~/.claude/skills/orch/bin/orch-slug 2>/dev/null) && mkdir -p ~/.orch/projects/$SLUG
731
+ ```
732
+ Write to `~/.orch/projects/{slug}/{user}-{branch}-test-outcome-{datetime}.md`
733
+
734
+ **Per-issue additions** (beyond standard report template):
735
+ - Fix Status: verified / best-effort / reverted / deferred
736
+ - Commit SHA (if fixed)
737
+ - Files Changed (if fixed)
738
+ - Before/After screenshots (if fixed)
739
+
740
+ **Summary section:**
741
+ - Total issues found
742
+ - Fixes applied (verified: X, best-effort: Y, reverted: Z)
743
+ - Deferred issues
744
+ - Health score delta: baseline → final
745
+
746
+ **PR Summary:** Include a one-line summary suitable for PR descriptions:
747
+ > "QA found N issues, fixed M, health score X → Y."
748
+
749
+ ---
750
+
751
+ ## Phase 11: TODOS.md Update
752
+
753
+ If the repo has a `TODOS.md`:
754
+
755
+ 1. **New deferred bugs** → add as TODOs with severity, category, and repro steps
756
+ 2. **Fixed bugs that were in TODOS.md** → annotate with "Fixed by /qa on {branch}, {date}"
757
+
758
+ ---
759
+
760
+ ## Additional Rules (qa-specific)
761
+
762
+ 11. **Clean working tree required.** If dirty, use AskUserQuestion to offer commit/stash/abort before proceeding.
763
+ 12. **One commit per fix.** Never bundle multiple fixes into one commit.
764
+ 13. **Only modify tests when generating regression tests in Phase 8e.5.** Never modify CI configuration. Never modify existing tests — only create new test files.
765
+ 14. **Revert on regression.** If a fix makes things worse, `git revert HEAD` immediately.
766
+ 15. **Self-regulate.** Follow the WTF-likelihood heuristic. When in doubt, stop and ask.