ghost-qa 1.3.1 โ†’ 2.0.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.
Files changed (81) hide show
  1. package/README.md +88 -32
  2. package/SKILL.md +83 -80
  3. package/dist/bin/ghost-qa.d.ts +11 -3
  4. package/dist/bin/ghost-qa.d.ts.map +1 -1
  5. package/dist/bin/ghost-qa.js +498 -405
  6. package/dist/bin/ghost-qa.js.map +1 -1
  7. package/dist/src/engine/audit-runner.d.ts +6 -5
  8. package/dist/src/engine/audit-runner.d.ts.map +1 -1
  9. package/dist/src/engine/audit-runner.js +117 -60
  10. package/dist/src/engine/audit-runner.js.map +1 -1
  11. package/dist/src/engine/browser-session.d.ts +3 -3
  12. package/dist/src/engine/browser-session.d.ts.map +1 -1
  13. package/dist/src/engine/browser-session.js +18 -7
  14. package/dist/src/engine/browser-session.js.map +1 -1
  15. package/dist/src/engine/compare.d.ts +37 -0
  16. package/dist/src/engine/compare.d.ts.map +1 -0
  17. package/dist/src/engine/compare.js +63 -0
  18. package/dist/src/engine/compare.js.map +1 -0
  19. package/dist/src/engine/health-score.d.ts +14 -0
  20. package/dist/src/engine/health-score.d.ts.map +1 -0
  21. package/dist/src/engine/health-score.js +74 -0
  22. package/dist/src/engine/health-score.js.map +1 -0
  23. package/dist/src/engine/version.d.ts +14 -0
  24. package/dist/src/engine/version.d.ts.map +1 -0
  25. package/dist/src/engine/version.js +43 -0
  26. package/dist/src/engine/version.js.map +1 -0
  27. package/dist/src/index.d.ts +6 -0
  28. package/dist/src/index.d.ts.map +1 -1
  29. package/dist/src/index.js +6 -0
  30. package/dist/src/index.js.map +1 -1
  31. package/dist/src/mcp/server.d.ts +25 -5
  32. package/dist/src/mcp/server.d.ts.map +1 -1
  33. package/dist/src/mcp/server.js +45 -7
  34. package/dist/src/mcp/server.js.map +1 -1
  35. package/dist/src/reporter/agent-diagnostic.d.ts +6 -0
  36. package/dist/src/reporter/agent-diagnostic.d.ts.map +1 -1
  37. package/dist/src/reporter/agent-diagnostic.js +53 -3
  38. package/dist/src/reporter/agent-diagnostic.js.map +1 -1
  39. package/dist/src/reporter/html-report.d.ts.map +1 -1
  40. package/dist/src/reporter/html-report.js +79 -4
  41. package/dist/src/reporter/html-report.js.map +1 -1
  42. package/dist/src/reporter/terminal-summary.d.ts.map +1 -1
  43. package/dist/src/reporter/terminal-summary.js +6 -0
  44. package/dist/src/reporter/terminal-summary.js.map +1 -1
  45. package/dist/src/traps/a11y-trap.d.ts +23 -0
  46. package/dist/src/traps/a11y-trap.d.ts.map +1 -1
  47. package/dist/src/traps/a11y-trap.js +185 -0
  48. package/dist/src/traps/a11y-trap.js.map +1 -1
  49. package/dist/src/traps/console-trap.d.ts +3 -1
  50. package/dist/src/traps/console-trap.d.ts.map +1 -1
  51. package/dist/src/traps/console-trap.js +41 -0
  52. package/dist/src/traps/console-trap.js.map +1 -1
  53. package/dist/src/traps/layout-trap.d.ts +31 -0
  54. package/dist/src/traps/layout-trap.d.ts.map +1 -1
  55. package/dist/src/traps/layout-trap.js +173 -0
  56. package/dist/src/traps/layout-trap.js.map +1 -1
  57. package/dist/src/traps/links-trap.d.ts +34 -0
  58. package/dist/src/traps/links-trap.d.ts.map +1 -0
  59. package/dist/src/traps/links-trap.js +136 -0
  60. package/dist/src/traps/links-trap.js.map +1 -0
  61. package/dist/src/traps/network-trap.d.ts +4 -1
  62. package/dist/src/traps/network-trap.d.ts.map +1 -1
  63. package/dist/src/traps/network-trap.js +29 -2
  64. package/dist/src/traps/network-trap.js.map +1 -1
  65. package/dist/src/traps/perf-trap.d.ts +18 -0
  66. package/dist/src/traps/perf-trap.d.ts.map +1 -1
  67. package/dist/src/traps/perf-trap.js +148 -8
  68. package/dist/src/traps/perf-trap.js.map +1 -1
  69. package/dist/src/traps/seo-trap.d.ts +30 -0
  70. package/dist/src/traps/seo-trap.d.ts.map +1 -0
  71. package/dist/src/traps/seo-trap.js +98 -0
  72. package/dist/src/traps/seo-trap.js.map +1 -0
  73. package/dist/src/traps/theme-trap.d.ts +32 -0
  74. package/dist/src/traps/theme-trap.d.ts.map +1 -0
  75. package/dist/src/traps/theme-trap.js +109 -0
  76. package/dist/src/traps/theme-trap.js.map +1 -0
  77. package/dist/src/types.d.ts +55 -3
  78. package/dist/src/types.d.ts.map +1 -1
  79. package/dist/src/types.js +30 -2
  80. package/dist/src/types.js.map +1 -1
  81. package/package.json +99 -91
package/README.md CHANGED
@@ -1,9 +1,10 @@
1
1
  # ๐Ÿ‘ป ghost-qa
2
2
 
3
- **Autonomous headless browser QA & self-healing verification loop for coding agents.**
3
+ **Autonomous headless browser QA & self-healing verification loop for coding agents.** `v2.0.0` โ€” the 8-Trap Deep Browser Inspection Engine: 3 viewports ร— light/dark, QA Health Score (A+โ€ฆF), interactive HTML dashboard, and regression diffing.
4
4
 
5
5
  [![CI](https://github.com/avivgerz-hue/ghost-qa/actions/workflows/ci.yml/badge.svg)](https://github.com/avivgerz-hue/ghost-qa/actions/workflows/ci.yml)
6
6
  [![npm version](https://img.shields.io/npm/v/ghost-qa.svg)](https://www.npmjs.com/package/ghost-qa)
7
+ [![npm downloads](https://img.shields.io/npm/dm/ghost-qa.svg)](https://www.npmjs.com/package/ghost-qa)
7
8
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
8
9
  [![Node >= 20](https://img.shields.io/badge/node-%3E%3D20-brightgreen.svg)](https://nodejs.org)
9
10
  [![Powered by Playwright](https://img.shields.io/badge/powered%20by-Playwright-45ba4b.svg)](https://playwright.dev)
@@ -15,11 +16,13 @@ Coding agents (Claude Code, Codex, Cursor, Windsurf) write code **blind** โ€” th
15
16
  `ghost-qa` fixes that. One command launches a headless browser against your running app, crawls the live DOM, safely pokes every button, traps runtime/network/layout failures, and hands the agent a structured **Self-Healing Bug Report** so it fixes its own bugs *before* telling you it's done.
16
17
 
17
18
  ```bash
18
- npx github:avivgerz-hue/ghost-qa test http://localhost:3000
19
+ npx -y ghost-qa test http://localhost:3000
19
20
  ```
20
21
 
21
22
  No test scripts. No config. No mercy for "it works on my machine".
22
23
 
24
+ > Prefer running straight from GitHub instead of npm? `npx -y github:avivgerz-hue/ghost-qa test http://localhost:3000` works identically โ€” every command in this README accepts either package source (`ghost-qa mcp`, `ghost-qa init`, โ€ฆ).
25
+
23
26
  ---
24
27
 
25
28
  ## โšก Quickstart
@@ -30,10 +33,10 @@ npm run dev # โ†’ http://localhost:3000
30
33
 
31
34
  # 2. Verify it in a real browser (one-time: downloads Chromium)
32
35
  npx playwright install chromium
33
- npx github:avivgerz-hue/ghost-qa test http://localhost:3000
36
+ npx -y ghost-qa test http://localhost:3000
34
37
 
35
38
  # 3. Teach your coding agent to do this automatically, forever
36
- npx github:avivgerz-hue/ghost-qa init
39
+ npx -y ghost-qa init
37
40
  ```
38
41
 
39
42
  `ghost-qa init` installs `.claude/skills/ghost-qa/SKILL.md` and appends the strict **"Verify in Browser Before Done"** protocol to `CLAUDE.md`, `AGENTS.md`, and `.cursorrules`. From then on, your agent runs ghost-qa itself, fixes what it finds, and only reports completion on a PASS.
@@ -63,76 +66,124 @@ npx github:avivgerz-hue/ghost-qa init
63
66
  โ”‚ โ–ผ โ–ผ โ”‚
64
67
  โ”‚ โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚
65
68
  โ”‚ โ”‚ CONSOLE โ”‚ โ”‚ NETWORK โ”‚ โ”‚ LAYOUT โ”‚ โ”‚
66
- โ”‚ โ”‚ A11Y โ”‚ โ”‚ PERF โ”‚ โ”‚ 5 TRAPS โ”‚ โ”‚
69
+ โ”‚ โ”‚ A11Y โ”‚ โ”‚ PERF โ”‚ โ”‚ 8 TRAPS โ”‚ โ”‚
67
70
  โ”‚ โ”‚ TRAP โ”‚ โ”‚ TRAP โ”‚ โ”‚ TRAP โ”‚ โ”‚
68
71
  โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
69
- โ”‚ Desktop 1440ร—900 + Mobile 390ร—844 (iPhone) โ”‚
72
+ โ”‚ Desktop 1440ร—900 ยท Tablet 768ร—1024 ยท Mobile 375ร—812 โ”‚
70
73
  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
71
74
  โ”‚
72
75
  fix bugs โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ re-run until โœ” PASS
73
76
  ```
74
77
 
75
78
  1. The agent writes code and starts the dev server.
76
- 2. `ghost-qa test` crawls every internal route on **desktop + mobile**, exercising interactive controls.
77
- 3. Five traps capture everything the browser actually experienced.
78
- 4. Failures return as a token-efficient diagnostic; the agent fixes the root causes and re-runs.
79
- 5. The loop ends only at **PASS** โ€” that's when the agent may tell you it's done.
79
+ 2. `ghost-qa test` crawls every internal route on **Desktop 1440ร—900, Tablet 768ร—1024 and Mobile 375ร—812**, in **light + dark** colour schemes, exercising interactive controls.
80
+ 3. Eight traps capture everything the browser actually experienced, scored into a deterministic **QA Health Score (0โ€“100, Grade A+โ€ฆF)**.
81
+ 4. Failures return as a token-efficient diagnostic (`GHOST-QA-REPORT.md` + `PATCH-PROMPT.md` with exact selectors); the agent fixes root causes and re-runs.
82
+ 5. `ghost-qa compare before.json after.json` proves the fix: the loop ends only at **score 95โ€“100 (A+)**, zero critical/major remaining, and **zero new regressions**.
80
83
 
81
84
  ---
82
85
 
83
- ## ๐Ÿชค The 5-Trap Engine
86
+ ## ๐Ÿชค The 8-Trap Deep Browser Inspection Engine *(v2.0.0)*
84
87
 
85
- ### 1. Console Trap โ€” `src/traps/console-trap.ts`
88
+ ### 1. Console & Framework Runtime Trap โ€” `src/traps/console-trap.ts`
86
89
  - Uncaught `pageerror` exceptions with stack traces
87
90
  - Unhandled promise rejections
88
91
  - **React hydration mismatches** ("Text content did not match", "A tree hydrated butโ€ฆ")
92
+ - **Duplicate-key warnings** and **Content-Security-Policy violations** *(new in v2)*
89
93
  - `console.error` (major) and `console.warning` (minor) โ€” with dev-server noise (`[vite]`, HMR, React DevTools banners) filtered out
90
94
 
91
- ### 2. Network Trap โ€” `src/traps/network-trap.ts`
95
+ ### 2. Network & Asset Integrity Trap โ€” `src/traps/network-trap.ts`
92
96
  - HTTP `5xx` API crashes (critical) and `4xx` responses (major)
93
- - Failed `fetch`/`XHR` requests and connection failures
94
- - **CORS-blocked requests** with remediation guidance
95
- - Broken static assets (JS/CSS/images/fonts) and missing favicons (minor)
97
+ - Failed `fetch`/`XHR` requests, **timed-out requests**, and connection failures
98
+ - **CORS-blocked requests and failed CORS preflights** with remediation guidance
99
+ - Broken static assets, broken images (`naturalWidth === 0`), **broken inline SVGs (0ร—0)**, **>500KB unoptimized payloads**, and missing favicons (minor)
96
100
 
97
- ### 3. Layout Trap โ€” `src/traps/layout-trap.ts`
101
+ ### 3. Layout, Responsive Geometry & Collision Trap โ€” `src/traps/layout-trap.ts`
98
102
  - **Horizontal overflow**: `scrollWidth > innerWidth`, with the offending elements named (critical on mobile)
103
+ - **Overlapping interactive elements** via bounding-box collision math, with exact selectors + boxes *(new in v2)*
104
+ - **Touch targets < 44ร—44px** on touch viewports (WCAG 2.5.5 / Apple HIG), **clipped text**, and **off-screen interactives** *(new in v2)*
99
105
  - Zero-dimension interactive elements โ€” buttons rendered at 0ร—0 that no human could tap
100
- - Broken images (`naturalWidth === 0`)
101
106
  - Missing `<meta name="viewport">` on mobile
102
107
 
103
- ### 4. Accessibility Trap โ€” `src/traps/a11y-trap.ts` *(new in v1.1.0)*
108
+ ### 4. Accessibility (WCAG 2.1 AA) & Keyboard Focus Trap โ€” `src/traps/a11y-trap.ts`
104
109
  - Buttons and links with **no accessible name** (icon-only controls screen readers can't identify)
105
110
  - Images **missing `alt`** attributes (descriptive alt, or `alt=""` for decorative)
106
111
  - Form inputs with **no associated label** โ€” a placeholder is not a label
112
+ - **Real computed contrast ratios** (`getComputedStyle` foreground vs effective background, WCAG formula) *(new in v2)*
113
+ - **Heading hierarchy** (missing `<h1>`, h1โ†’h3 skips) and **automated Tab-order verification** โ€” simulated Tab presses catch invisible or dead focus states *(new in v2)*
107
114
  - Missing document `<title>` and missing `<html lang>`
108
115
 
109
- ### 5. Performance & Asset Trap โ€” `src/traps/perf-trap.ts` *(new in v1.1.0)*
116
+ ### 5. Performance & Core Web Vitals Trap โ€” `src/traps/perf-trap.ts`
117
+ - **Core Web Vitals**: TTFB, FCP, LCP estimation, and CLS (Cumulative Layout Shift) *(new in v2)*
110
118
  - Slow page loads via Navigation Timing (DOMContentLoaded / load budgets, 2ร— = critical)
111
- - **Oversized resources** (> 1MB single asset) and excessive total payload (> 3MB)
119
+ - **Oversized resources** (> 1MB single asset), **unoptimized >500KB images/scripts**, and excessive total payload (> 3MB)
112
120
  - Main-thread jank / layout-thrashing indicators from the Long Tasks API
113
- - Render-blocking `<head>` resources and excessive DOM size
121
+ - Render-blocking `<head>` resources, excessive DOM size (>1500 nodes) and **DOM depth > 32**
122
+
123
+ ### 6. Safe Interactive & Link Integrity Trap โ€” `src/traps/links-trap.ts` *(new in v2)*
124
+ - Placeholder links (`href=""`, `href="#"`, `javascript:void(0)`) and **dead anchors/routes** found during crawling
125
+ - Buttons inside `<form>` with **no `type`** (they silently become submit buttons)
126
+ - Disabled/stuck interactive controls โ€” all observational, this trap never clicks anything
127
+
128
+ ### 7. SEO, Metadata & Social Graph Trap โ€” `src/traps/seo-trap.ts` *(new in v2)*
129
+ - `<title>` (missing, <10 or >60 chars), meta description, `<html lang>`, viewport meta, canonical tag
130
+ - OpenGraph set (`og:title`, `og:description`, `og:image`) for link unfurls
131
+ - **Duplicate `id` attributes** in the live, post-hydration DOM
132
+
133
+ ### 8. Dark / Light Theme Emulation Trap โ€” `src/traps/theme-trap.ts` *(new in v2)*
134
+ - Every page also renders under `colorScheme: 'dark'` and `'light'` emulation
135
+ - Computed contrast is re-evaluated per scheme โ€” invisible dark-mode text (dark-on-dark) is caught automatically and tagged with the failing scheme
114
136
 
115
137
  Plus a **safety-first Interaction Runner**: it fills forms with inert data (`ghost-qa@example.com`), opens tabs/modals/menus, and clicks ordinary buttons โ€” but *never* destructive ones (`delete`, `checkout`, `pay`, `logout`, `publish`โ€ฆ are blocked by a tested safety gate).
116
138
 
117
139
  ---
118
140
 
119
- ## ๐Ÿ”Œ Native MCP Server *(new in v1.1.0)*
141
+ ## ๐Ÿ“Š QA Health Score, Artifacts & Interactive Dashboard *(new in v2)*
142
+
143
+ Every run computes a deterministic **QA Health Score (0โ€“100)** and **Letter Grade (A+ โ€ฆ F)**: each trap starts at 100 and loses 25 per critical, 10 per major, 3 per minor finding; the overall score is the mean of the eight trap sub-scores (Console, Network, Layout, A11y, Performance, Links/UX, SEO/DOM, Theme Parity).
144
+
145
+ ```bash
146
+ npx -y ghost-qa test http://localhost:3000 --out-dir ghost-qa-out --screenshots
147
+ ```
148
+
149
+ | Artifact | Contents |
150
+ | --- | --- |
151
+ | `report.json` | Complete machine-readable telemetry: per-trap scores, viewport matrices, exact DOM selectors (`#id`, `data-testid`, CSS path) and bounding boxes |
152
+ | `GHOST-QA-REPORT.md` | Human + agent Self-Healing Bug Report with root-cause analysis and the fix playbook |
153
+ | `PATCH-PROMPT.md` | Copy-paste remediation prompt: every finding with selector, bounding box, parent-component hints and the compare loop |
154
+ | `report.html` | Self-contained, zero-dependency, dark-mode **interactive QA Dashboard**: Grade hero (A+โ€ฆF), 8-Trap Scorecard, Route & Viewport Matrix, filterable findings (severity/trap/viewport), embedded screenshots when captured |
155
+
156
+ ## ๐Ÿ”€ Regression Diffing โ€” `ghost-qa compare` / `ghost_qa_compare` *(new in v2)*
157
+
158
+ ```bash
159
+ npx -y ghost-qa test http://localhost:3000 --json > before.json # baseline
160
+ # โ€ฆagent fixes the bugsโ€ฆ
161
+ npx -y ghost-qa test http://localhost:3000 --json > after.json # re-audit
162
+ npx -y ghost-qa compare before.json after.json # Regression & Verification Delta Report
163
+ ```
164
+
165
+ The delta matches findings by stable fingerprint id and reports **`scoreDelta`, `fixedFindings`, `newRegressions`, `remainingFindings`** โ€” so a coding agent can *prove* its fix resolved the bug without introducing regressions. `verified` requires score โ‰ฅ 95, zero regressions and no blocking findings left. Also available as the `ghost_qa_compare` MCP tool.
166
+
167
+ ---
168
+
169
+ ## ๐Ÿ”Œ Native MCP Server
120
170
 
121
171
  ghost-qa ships a zero-dependency **Model Context Protocol** server (JSON-RPC 2.0 over stdio), so MCP hosts can invoke browser verification as a native tool instead of shelling out:
122
172
 
123
173
  ```bash
124
- npx github:avivgerz-hue/ghost-qa mcp
174
+ npx -y ghost-qa mcp
125
175
  ```
126
176
 
127
177
  | MCP tool | What it does |
128
178
  | --- | --- |
129
- | `ghost_qa_audit_url` | Runs the full crawl + 5-trap suite against a running URL and returns the Self-Healing Bug Report (text + structured content) |
179
+ | `ghost_qa_audit_url` | Runs the full 8-trap deep inspection (3 viewports ร— light/dark) and returns the Self-Healing Bug Report + QA Health Score (structured content includes the full report for baselining) |
180
+ | `ghost_qa_compare` | *(new in v2)* Diffs two report JSONs into the Regression & Verification Delta Report (`scoreDelta`, `fixedFindings`, `newRegressions`, `remainingFindings`) |
130
181
  | `ghost_qa_doctor` | Verifies Node, Chromium availability, and runs a live browser smoke test |
131
182
 
132
- `npx github:avivgerz-hue/ghost-qa init` writes the ready-to-use `.mcp.json` entry for you (merging with any servers you already have):
183
+ `npx -y ghost-qa init` writes the ready-to-use `.mcp.json` entry for you (merging with any servers you already have):
133
184
 
134
185
  ```json
135
- { "mcpServers": { "ghost-qa": { "command": "npx", "args": ["-y", "github:avivgerz-hue/ghost-qa", "mcp"] } } }
186
+ { "mcpServers": { "ghost-qa": { "command": "npx", "args": ["-y", "ghost-qa", "mcp"] } } }
136
187
  ```
137
188
 
138
189
  Works with Claude Code, Claude Desktop, Cursor, Codex โ€” any MCP host.
@@ -151,7 +202,7 @@ docker run -i ghost-qa # MCP JSON-RPC over stdin/stdout
151
202
  Don't even start the dev server yourself โ€” ghost-qa will spawn it, wait for the URL to respond, audit, and terminate the whole process tree afterward:
152
203
 
153
204
  ```bash
154
- npx github:avivgerz-hue/ghost-qa test http://localhost:3000 --server-cmd "npm run dev"
205
+ npx -y ghost-qa test http://localhost:3000 --server-cmd "npm run dev"
155
206
  ```
156
207
 
157
208
  Pair it with `--html ghost-qa-report.html` for a self-contained, dark-mode **visual evidence dashboard** (routes, interactions, every trap finding per viewport) you can attach to CI artifacts or PRs.
@@ -163,7 +214,7 @@ Pair it with `--html ghost-qa-report.html` for a self-contained, dark-mode **vis
163
214
  ```
164
215
  ๐Ÿ‘ป ghost-qa โ€” autonomous browser verification
165
216
  Target: http://localhost:3000/
166
- Duration: 8.4s ยท Viewports: desktop + mobile ยท Depth: 2
217
+ Duration: 14.2s ยท Viewports: desktop + tablet + mobile ยท Schemes: light + dark ยท Depth: 2
167
218
 
168
219
  Routes crawled
169
220
  / Home [200] 3 issues
@@ -174,6 +225,7 @@ Coverage
174
225
  Routes visited: 3
175
226
  Interactions tested: 21 passed ยท 1 failed ยท 4 skipped (safety)
176
227
  Issues: 5 total โ€” 2 critical, 3 major, 0 minor
228
+ QA Health Score: 62/100 โ€” Grade D (8 traps ยท per-trap: console 65 ยท network 75 ยท layout 90 ยท a11y 100 ยท perf 100 ยท links 100 ยท seo 100 ยท theme 65)
177
229
 
178
230
  Failures caught
179
231
  โœ– CRITICAL [console] React hydration mismatch: Text content did not matchโ€ฆ
@@ -196,7 +248,8 @@ The agent-facing report (`--report ghost-qa-report.md`) groups the same bugs by
196
248
  | --- | --- |
197
249
  | `ghost-qa test <url>` | Crawl a running app and trap browser failures. Exit `0` = PASS, `1` = blocking issues, `2` = runner error |
198
250
  | `ghost-qa init [--force]` | Install `.claude/skills/ghost-qa/SKILL.md`, verification protocol (`CLAUDE.md`, `AGENTS.md`, `.cursorrules`) + MCP config (`.mcp.json`) โ€” all idempotent |
199
- | `ghost-qa mcp` | Run the native MCP server (JSON-RPC 2.0 over stdio) exposing `ghost_qa_audit_url` and `ghost_qa_doctor` |
251
+ | `ghost-qa compare <before.json> <after.json>` | Regression & Verification Delta Report between two report JSONs. Exit `1` if new regressions appeared |
252
+ | `ghost-qa mcp` | Run the native MCP server (JSON-RPC 2.0 over stdio) exposing `ghost_qa_audit_url`, `ghost_qa_compare` and `ghost_qa_doctor` |
200
253
  | `ghost-qa doctor` | Diagnose Node โ‰ฅ 20, Playwright and Chromium setup, with a live browser smoke test |
201
254
  | `ghost-qa --version` / `--help` | Version / usage |
202
255
 
@@ -207,7 +260,10 @@ The agent-facing report (`--report ghost-qa-report.md`) groups the same bugs by
207
260
  | `--max-depth <n>` | `2` | Link-following depth from the start URL |
208
261
  | `--max-routes <n>` | `25` | Maximum routes to visit |
209
262
  | `--timeout <ms>` | `15000` | Per-navigation timeout |
210
- | `--viewport <name>` | `both` | `both` \| `desktop` \| `mobile` |
263
+ | `--viewport <name>` | `all` | `all` \| `both` (desktop+mobile) \| `desktop` \| `tablet` \| `mobile` |
264
+ | `--color-scheme <name>` | `both` | `both` \| `light` \| `dark` โ€” colour schemes emulated per viewport |
265
+ | `--screenshots` | off | Capture a screenshot per route/viewport for the HTML dashboard |
266
+ | `--out-dir <dir>` | โ€” | Write `report.json` + `GHOST-QA-REPORT.md` + `PATCH-PROMPT.md` + `report.html` into this directory |
211
267
  | `--no-interactions` | off | Load pages only; don't click or fill anything |
212
268
  | `--headed` | off | Show the browser window (debugging) |
213
269
  | `--fail-on <severity>` | `major` | Exit 1 on `critical` \| `major` \| `minor` issues |
@@ -224,7 +280,7 @@ Works with any stack that serves HTML on localhost โ€” Next.js, Vite, Remix, Ast
224
280
 
225
281
  ## ๐Ÿค– The Agent Skill
226
282
 
227
- `SKILL.md` (repo root) is the master skill. `npx github:avivgerz-hue/ghost-qa init` installs it for:
283
+ `SKILL.md` (repo root) is the master skill. `npx -y ghost-qa init` installs it for:
228
284
 
229
285
  - **Claude Code** โ†’ `.claude/skills/ghost-qa/SKILL.md` + protocol in `CLAUDE.md`
230
286
  - **Codex / generic agents** โ†’ protocol in `AGENTS.md`
package/SKILL.md CHANGED
@@ -1,18 +1,16 @@
1
1
  ---
2
2
  name: ghost-qa
3
- description: Verify frontend work in a real headless browser before reporting a task complete. Use after building or changing any UI, route, form, API integration, or client-side logic โ€” crawls the running app on desktop and mobile, runs a 5-trap engine (console/hydration, network, layout, accessibility, performance), exercises interactive controls, and returns a self-healing bug report to fix from. Also usable via the ghost_qa_audit_url MCP tool.
3
+ description: Verify frontend work in a real headless browser before reporting a task complete. The autonomous Staff QA Engineer protocol โ€” doctor readiness, multi-viewport 8-Trap baseline audit (Desktop/Tablet/Mobile, light + dark), DOM-to-source root-cause mapping, surgical remediation, and closed-loop delta verification with ghost_qa_compare until QA Health Score is 95โ€“100 (Grade A+). Use after building or changing any UI, route, form, API integration, or client-side logic.
4
4
  license: MIT
5
5
  ---
6
6
 
7
- # ๐Ÿ‘ป ghost-qa โ€” Verify in Browser Before Done
7
+ # ๐Ÿ‘ป ghost-qa โ€” Autonomous Staff QA Engineer Protocol
8
8
 
9
- Coding agents write code blind. Code that type-checks can still ship with React hydration mismatches, uncaught exceptions, 500ing APIs, dead buttons, icon-only controls no screen reader can name, and mobile layouts that scroll sideways. **The browser is the source of truth โ€” never your mental model of the DOM.**
9
+ Coding agents write code blind. Code that type-checks can still ship with React hydration mismatches, uncaught exceptions, 500ing APIs, dead links, invisible dark-mode text, 30px tap targets, and mobile layouts that scroll sideways. **The browser is the source of truth โ€” never your mental model of the DOM.**
10
10
 
11
- ## The Rule
11
+ > **The Rule:** Before reporting ANY task that touches frontend code as complete, you MUST execute all five phases below, in order, and finish with a verified delta: QA Health Score 95โ€“100 (Grade A+ band), zero critical/major findings, zero new regressions.
12
12
 
13
- > Before reporting ANY task that touches frontend code as complete, you MUST run the app in a real browser with ghost-qa, fix everything blocking it catches, and re-run until it passes.
14
-
15
- Unit tests, type-checking, linting and code review do **not** satisfy this rule. They cannot see hydration, layout, network or accessibility failures.
13
+ Unit tests, type-checking, linting and code review do **not** satisfy this rule. They cannot see hydration, layout, network, contrast or focus failures.
16
14
 
17
15
  ## When to use this skill
18
16
 
@@ -20,86 +18,91 @@ Unit tests, type-checking, linting and code review do **not** satisfy this rule.
20
18
  - โœ… You fixed a bug that manifested in the browser
21
19
  - โœ… You are about to tell the user a UI task is "done"
22
20
 
23
- **Not a substitute for:** your unit/E2E test suites, a full WCAG accessibility audit (ghost-qa's a11y trap covers common machine-checkable failures, not full WCAG conformance), load testing, or manual exploratory QA.
21
+ **Not a substitute for:** your unit/E2E suites, a full manual WCAG audit (the a11y trap covers machine-checkable WCAG 2.1 AA failures), load testing, or exploratory QA.
24
22
 
25
- ## Choose your path
23
+ ## The 8-Trap Deep Browser Inspection Engine
26
24
 
27
- | Situation | Command |
28
- | --- | --- |
29
- | Dev server already running | `npx github:avivgerz-hue/ghost-qa test <url>` |
30
- | Server not running (most common) | `npx github:avivgerz-hue/ghost-qa test <url> --server-cmd "npm run dev"` โ€” ghost-qa spawns it, waits for it, audits, and kills the process tree afterward |
31
- | Your host exposes MCP tools | Call **`ghost_qa_audit_url`** with the URL (call `ghost_qa_doctor` first if it errors) โ€” identical engine, identical report |
32
- | Mobile-only bug hunt | add `--viewport mobile` |
33
- | Large app | add `--max-depth 3 --max-routes 50` |
34
- | Evidence for a PR/CI | add `--report ghost-qa-report.md --html ghost-qa-report.html` |
35
-
36
- Common local URLs: Next.js / CRA `http://localhost:3000`, Vite `http://localhost:5173`, Astro `http://localhost:4321`, Angular `http://localhost:4200`. If unsure, check the dev server output or `package.json` scripts โ€” never guess silently; state the URL you verified in your completion message.
37
-
38
- ## The Self-Healing Loop
39
-
40
- 1. **Run the audit** (path table above). The 5-Trap Engine checks, on Desktop 1440ร—900 *and* Mobile 390ร—844:
41
- - **Console** โ€” uncaught errors, unhandled promise rejections, React hydration mismatches, `console.error`
42
- - **Network** โ€” HTTP 4xx/5xx, failed fetch/XHR, CORS failures, broken assets
43
- - **Layout** โ€” horizontal overflow, zero-size interactive elements, broken images, missing viewport meta
44
- - **Accessibility** โ€” buttons/links with no accessible name, images missing `alt`, inputs with no label, missing `<title>` / `<html lang>`
45
- - **Performance** โ€” slow loads, oversized assets/payloads, main-thread long-task jank, render-blocking resources, excessive DOM
46
- 2. **Read the Self-Healing Bug Report.** Every issue has a stable `#id`, a severity (`critical` / `major` / `minor`), the route, and the viewport. Fix **critical and major** issues. Note minors; fix them when cheap.
47
- 3. **Fix root causes in source** (fix guidance below). Reference issues by `#id` in your own narration so the user can follow along.
48
- 4. **Re-run the identical command.** A fix that breaks a different route or viewport only shows up on re-run.
49
- 5. **Repeat until `GHOST-QA PASS`.** If you have looped 5 times on the same `#id`, stop and report to the user what is stuck and why โ€” do not silently give up or declare success.
50
- 6. **Only then** report completion, using the completion template below.
51
-
52
- ## Fix guidance per trap
53
-
54
- | Trap | Typical root causes | Fix like this |
25
+ Every audit crawls each route on **Desktop 1440ร—900, Tablet 768ร—1024 and Mobile 375ร—812**, under **light + dark** colour schemes:
26
+
27
+ | # | Trap | What it catches |
55
28
  | --- | --- | --- |
56
- | Hydration mismatch | `Date.now()`/`Math.random()`/`window` during render, server/client branching, invalid HTML nesting (`<p>` in `<p>`, `<div>` in `<p>`) | Make server and client render identical markup; move time/random/client-only values into `useEffect` + state; fix the nesting |
57
- | Uncaught page error | undefined data, missing null checks on async data, bad imports | Reproduce via the stack trace in the report; guard the actual data path |
58
- | Console error | failed state updates, rejected promises, React warnings treated seriously by the app | Trace the first error, not the cascade after it |
59
- | HTTP 5xx | API route crash, bad env var, DB down | Read the server logs for that endpoint; the browser found it, the fix is server-side |
60
- | HTTP 404 / broken asset | wrong path, case-sensitivity, asset not emitted by the build | Compare the URL in the report with the actual build output / public dir |
61
- | CORS failure | API missing `Access-Control-Allow-Origin` for the page origin | Fix the API's CORS config (or the dev proxy), not the fetch call |
62
- | Horizontal overflow | `100vw` + scrollbar, fixed-width children, flex/grid children without `min-width: 0` | Constrain widths (`max-width: 100%`, `min-width: 0`, `overflow-wrap`); the report names the offending elements |
63
- | Zero-size interactive | collapsed CSS, `display: contents` misuse, content that never rendered | Restore a real, tappable size (โ‰ฅ 24px, ideally โ‰ฅ 40px on mobile) |
64
- | No accessible name | icon-only `<button>`/`<a>` | Add visible text or `aria-label` describing the action/destination |
65
- | Missing `alt` | forgotten attribute | Descriptive alt; `alt=""` only if purely decorative |
66
- | Input without label | placeholder used as label | Real `<label for>`, wrapping `<label>`, or `aria-label` |
67
- | Slow load / oversized asset | unoptimized images, giant bundles, blocking scripts | Compress/lazy-load, `defer`/`async`, code-split; check the named resource first |
68
- | Long-task jank | heavy sync JS, layout reads in loops after writes | Break up work, memoize, batch DOM reads before writes |
69
-
70
- ## Anti-cheating rules (this is the point of the skill)
71
-
72
- - โŒ Never silence the checker: no deleting the failing UI, no blanket `try/catch`, no `suppressHydrationWarning`, no removing the code path "so the error goes away"
73
- - โŒ Never use `--no-interactions` or narrow `--viewport`/`--max-depth` to hide failures (legitimate only when a page has side-effectful controls, and you must say so)
74
- - โŒ Never edit ghost-qa's report, thresholds, or your project's ghost-qa invocation to manufacture a PASS
75
- - โœ… If a finding is a genuine false positive, say so explicitly in your completion message with the `#id` and why โ€” a human can overrule the tool; you may not quietly ignore it
76
-
77
- ## Safety guarantees you can rely on
78
-
79
- ghost-qa never clicks destructive controls (delete, checkout, pay, logout, publish, sign-inโ€ฆ), never submits real orders/payments, fills forms only with inert data (`ghost-qa@example.com`, `ghost-qa test`), stays on same-origin links, and is designed for localhost/dev servers. **Do not point it at production systems you do not own or have permission to test.** Pages behind authentication will typically redirect to a login page โ€” ghost-qa will audit what an anonymous visitor sees; say so if that's what happened.
29
+ | 1 | Console & Framework Runtime | `pageerror`, `console.error`, unhandled rejections, React/Next.js hydration mismatches, duplicate-key warnings, CSP violations |
30
+ | 2 | Network & Asset Integrity | 4xx/5xx, timed-out/aborted requests, failed CORS preflights, broken images (`naturalWidth === 0`), broken inline SVGs (0ร—0), >500KB unoptimized payloads |
31
+ | 3 | Layout, Responsive Geometry & Collision | Horizontal overflow, overlapping interactive elements (bounding-box collision math), <44ร—44px touch targets, clipped text, off-screen interactives |
32
+ | 4 | Accessibility (WCAG 2.1 AA) & Keyboard Focus | Missing accessible names/labels/alt, heading hierarchy breaks, real computed contrast ratios, automated Tab-order verification (invisible/dead focus) |
33
+ | 5 | Performance & Core Web Vitals | TTFB, FCP, LCP, CLS, DOM bloat (>1500 nodes), DOM depth (>32), render-blocking scripts, long tasks |
34
+ | 6 | Safe Interactive & Link Integrity | Placeholder hrefs (`""`, `#`, `javascript:void(0)`), dead anchors/routes, in-form buttons without `type`, stuck disabled controls |
35
+ | 7 | SEO, Metadata & Social Graph | Title length, meta description, `<html lang>`, viewport meta, canonical, OpenGraph set, duplicate `id`s |
36
+ | 8 | Dark / Light Theme Emulation | Contrast/visibility recomputed under `colorScheme: light` and `dark` โ€” catches invisible dark-mode text |
80
37
 
81
- ## Troubleshooting
38
+ Scoring is deterministic: each trap starts at 100, โˆ’25 per critical, โˆ’10 per major, โˆ’3 per minor. The **QA Health Score** is the mean of the 8 trap scores, graded **A+ (97+) โ€ฆ F (<60)**.
82
39
 
83
- | Symptom | Do this |
84
- | --- | --- |
85
- | "could not launch Chromium" | `npx playwright install chromium` (one-time), then `npx github:avivgerz-hue/ghost-qa doctor` |
86
- | `navigation-failed` on every route | Server isn't on that URL/port โ€” start it, or re-run with `--server-cmd "npm run dev"` |
87
- | Everything 404s | Wrong port or base path โ€” confirm the URL in a browser/`curl` yourself first |
88
- | Audit seems to test a login page | The app requires auth for those routes; report that limitation instead of claiming full verification |
89
- | Perf findings vary between runs | Machine load affects timings; re-run once before treating a borderline perf major as real |
90
- | MCP tool unavailable | Fall back to the CLI โ€” the audit engine and report are identical |
40
+ ---
41
+
42
+ ## Phase 1 โ€” Environment & Server Readiness (`ghost_qa_doctor`)
43
+
44
+ 1. Call the **`ghost_qa_doctor`** MCP tool, or run `npx -y ghost-qa doctor`.
45
+ 2. It must report **READY**: Node โ‰ฅ 20, Chromium installed, live browser smoke test passing.
46
+ 3. If Chromium is missing: `npx playwright install chromium` (one-time), then re-run doctor. **Never skip to Phase 2 on a red doctor** โ€” a failed launch is not a passing audit.
47
+ 4. Start the app (`npm run dev`) or plan to use `--server-cmd "npm run dev"` / let the audit spawn it.
48
+
49
+ ## Phase 2 โ€” Multi-Viewport 8-Trap Baseline Audit (`ghost_qa_audit_url`)
50
+
51
+ Run the baseline BEFORE changing code (or before your fix, when debugging):
52
+
53
+ - MCP: call **`ghost_qa_audit_url`** with the app URL. Save the full returned report JSON as **`before.json`**.
54
+ - CLI equivalent: `npx -y ghost-qa test <local-url> --out-dir ghost-qa-out` โ†’ writes `report.json` (copy to `before.json`), `GHOST-QA-REPORT.md`, `PATCH-PROMPT.md`, and the interactive `report.html` dashboard. Add `--screenshots` for embedded route screenshots; `--server-cmd "npm run dev"` if the server isn't running.
55
+
56
+ Record the baseline: **QA Health Score, grade, per-trap scores, and every finding's `#id`.** Common local URLs: Next.js/CRA `http://localhost:3000`, Vite `http://localhost:5173`, Astro `http://localhost:4321`, Angular `http://localhost:4200`. Never guess silently โ€” state the URL you verified.
91
57
 
92
- ## Completion template
58
+ ## Phase 3 โ€” DOM-to-Source Root-Cause Mapping
93
59
 
94
- When the final run passes, report completion like this:
60
+ For every critical/major finding, trace it back to the exact source component before editing:
95
61
 
96
- > โœ… Done. Verified in a real browser with ghost-qa: `npx github:avivgerz-hue/ghost-qa test <url>` โ†’ **GHOST-QA PASS**
97
- > Routes crawled: N ยท Interactions tested: N ยท Issues fixed this session: (list `#id`s, or "none found")
98
- > Stack: desktop 1440ร—900 + mobile 390ร—844, 5 traps (console, network, layout, accessibility, performance)
62
+ - **Exact selectors:** findings carry `#id`, `[data-testid=โ€ฆ]`, or a CSS path, plus the live **bounding box**. Search the codebase for that id/testid/class or the element's visible text to find the React/Next.js/Vue/Svelte component that renders it.
63
+ - **Collisions/overflow:** the two colliding selectors + boxes tell you which siblings overlap โ€” inspect their flex/grid/absolute layout in that component, on the failing viewport.
64
+ - **Console stacks:** follow the first app-owned stack frames to the throwing component/effect. Hydration mismatches mean server and client rendered different markup (Date/random/`window` at render, invalid nesting like `<p>` in `<p>`).
65
+ - **Dark-mode contrast:** a `theme-contrast` finding names the scheme that fails โ€” find the hard-coded colour in that component and replace it with the theme token.
66
+ - **Network:** map the failing URL to its route handler/client fetch; 5xx is server code, CORS preflight is API config.
99
67
 
100
- ## Completion checklist
68
+ Write the mapping down (finding `#id` โ†’ file โ†’ root cause) before Phase 4. If you cannot map a finding, say so โ€” do not guess-fix.
69
+
70
+ ## Phase 4 โ€” Surgical Code Remediation
71
+
72
+ Fix root causes, one finding at a time, in severity order (critical โ†’ major โ†’ minor):
73
+
74
+ - **Hydration:** identical server/client markup; defer client-only values to effects; fix invalid HTML nesting. Never `suppressHydrationWarning` to silence it.
75
+ - **Responsive geometry:** `min-width: 0` on flex/grid children, `max-width: 100%`, no `100vw` + scrollbar overflow, reserve image space with width/height or `aspect-ratio` (also fixes CLS).
76
+ - **Tap targets:** every touch target โ‰ฅ 44ร—44px (padding or min-height/min-width).
77
+ - **ARIA/labels:** visible text or `aria-label` on icon controls, `<label for>` (or wrapping label) per input, `alt` on images (`alt=""` only if decorative), one `<h1>`, no heading level skips, visible `:focus-visible` rings โ€” never `outline: none` without a replacement.
78
+ - **Dark-mode tokens:** CSS variables / `dark:` variants driven by `prefers-color-scheme` or the app theme โ€” never hard-coded hex that only works in one scheme.
79
+ - **Links/forms:** real hrefs or `<button type="button">`; dead anchors get real targets; in-form buttons get explicit `type`.
80
+ - **Performance:** defer/async non-critical scripts, compress/resize/lazy-load >500KB assets, code-split, break up long tasks.
81
+
82
+ **Anti-cheating rules (absolute):** never delete failing UI, never loosen the checker, never hide elements from the traps, never stub network responses. Fixing the checker instead of the bug is a failed task.
83
+
84
+ ## Phase 5 โ€” Closed-Loop Delta Verification (`ghost_qa_compare`)
85
+
86
+ 1. Re-run the identical audit (same URL/viewports) โ†’ save as **`after.json`**.
87
+ 2. Compare: MCP **`ghost_qa_compare`** with `{ before, after }`, or `npx -y ghost-qa compare before.json after.json`.
88
+ 3. Read the **Regression & Verification Delta Report**: `scoreDelta`, `fixedFindings`, `newRegressions`, `remainingFindings`.
89
+ 4. **Done only when ALL hold:** QA Health Score **95โ€“100 (Grade A+ band)** ยท zero critical/major remaining ยท **zero new regressions** (`verified: true`). Otherwise loop back to Phase 3 with the delta as your new worklist.
90
+ 5. If the same `#id` survives 5 loops, stop and report honestly what you tried โ€” never declare success on a red delta.
91
+
92
+ ## Completion report (required format)
93
+
94
+ > โœ… Done. Verified in a real browser with ghost-qa: `ghost_qa_audit_url` on `<url>`
95
+ > Stack: Desktop 1440ร—900 + Tablet 768ร—1024 + Mobile 375ร—812, light + dark, 8 traps
96
+ > QA Health Score: `<before>` โ†’ `<after>` (Grade `<grade>`) ยท Delta: `<n>` fixed, 0 new regressions
97
+ > Routes crawled: `<n>` ยท Interactions tested: `<n>` ยท Artifacts: `report.json`, `GHOST-QA-REPORT.md`, `PATCH-PROMPT.md`, `report.html`
98
+
99
+ ## Troubleshooting
100
+
101
+ | Symptom | Fix |
102
+ | --- | --- |
103
+ | "could not launch Chromium" | `npx playwright install chromium` (one-time), then `npx -y ghost-qa doctor` |
104
+ | Navigation failures on every route | The dev server isn't running (or wrong port) โ€” start it, or use `--server-cmd "npm run dev"` |
105
+ | Score stuck below 95 | Work the delta's remaining findings by severity; re-check Phase 3 mapping before editing |
106
+ | A trap flags a healthy page | File an issue with `report.json` attached โ€” false positives are the most valuable bug reports |
101
107
 
102
- - [ ] Final code state audited (not an earlier draft of the change)
103
- - [ ] All critical/major issues fixed at the root cause, or explicitly reported as false positives with reasoning
104
- - [ ] Final run prints `GHOST-QA PASS`
105
- - [ ] Completion message uses the template above and names the URL verified
108
+ > All commands use the published npm package (`npx -y ghost-qa โ€ฆ`). If npm is unavailable, `npx -y github:avivgerz-hue/ghost-qa โ€ฆ` runs the identical CLI straight from GitHub.
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { type GhostQAOptions } from '../src/types.js';
3
- export declare const VERSION = "1.3.0";
4
- export declare const AGENT_PROTOCOL = "<!-- ghost-qa:start -->\n## \uD83D\uDC7B ghost-qa \u2014 Browser Verification Protocol (MANDATORY)\n\nBefore reporting any task that touches frontend code as complete, you MUST verify it in a real browser:\n\n1. Ensure the app is running locally (e.g. `npm run dev`).\n2. Run: `npx github:avivgerz-hue/ghost-qa test <local-url>` (e.g. `npx github:avivgerz-hue/ghost-qa test http://localhost:3000`) \u2014 or call the `ghost_qa_audit_url` MCP tool if your host exposes it. Add `--server-cmd \"npm run dev\"` to let ghost-qa manage the dev server itself.\n3. If ghost-qa reports ANY critical or major issue (hydration errors, console errors, 4xx/5xx responses, mobile overflow, accessibility or performance failures, broken interactions), fix the root cause in source and re-run.\n4. Repeat until ghost-qa prints **PASS**. Only then may you tell the user the task is done.\n\nNever declare a UI task finished based only on code review, type-checking, or unit tests. The browser is the source of truth.\n<!-- ghost-qa:end -->";
3
+ export declare const VERSION: string;
4
+ export declare const AGENT_PROTOCOL = "<!-- ghost-qa:start -->\n## \uD83D\uDC7B ghost-qa \u2014 Browser Verification Protocol (MANDATORY)\n\nBefore reporting any task that touches frontend code as complete, you MUST verify it in a real browser \u2014 the closed-loop Self-Healing Browser Verification Protocol:\n\n1. **Readiness:** run `ghost-qa doctor` (or the `ghost_qa_doctor` MCP tool). Do not proceed on red.\n2. **Baseline audit:** ensure the app runs locally, then `npx -y ghost-qa test <local-url> --out-dir ghost-qa-out` (add `--server-cmd \"npm run dev\"` to let ghost-qa manage the server) \u2014 or call `ghost_qa_audit_url`. This runs the 8-Trap Engine on Desktop 1440\u00D7900, Tablet 768\u00D71024 and Mobile 375\u00D7812, light + dark. Save the baseline as `before.json` (it is `ghost-qa-out/report.json`).\n3. **Root-cause mapping:** for every critical/major finding, map the exact DOM selector, bounding box, stack trace or dark-mode contrast failure back to the component file that renders it.\n4. **Surgical remediation:** fix root causes in source (hydration, overflow, tap targets, ARIA/labels, dark-mode tokens\u2026). Never silence the checker or delete failing UI.\n5. **Delta verification:** re-run the audit to `after.json`, then `npx -y ghost-qa compare before.json after.json` (or `ghost_qa_compare`). Repeat until QA Health Score is **95\u2013100 (A+)**, zero critical/major remain, and the delta shows **zero new regressions**. Only then report done, citing score, routes, viewports and the delta.\n\nNever declare a UI task finished based only on code review, type-checking, or unit tests. The browser is the source of truth.\n<!-- ghost-qa:end -->";
5
5
  export interface ParsedTestArgs {
6
6
  target: string;
7
7
  options: GhostQAOptions;
@@ -9,10 +9,18 @@ export interface ParsedTestArgs {
9
9
  quiet: boolean;
10
10
  reportFile?: string;
11
11
  htmlFile?: string;
12
+ outDir?: string;
12
13
  serverCmd?: string;
13
14
  serverTimeoutMs: number;
14
15
  }
15
16
  export declare function parseTestArgs(args: string[]): ParsedTestArgs;
17
+ export interface ParsedCompareArgs {
18
+ beforeFile: string;
19
+ afterFile: string;
20
+ json: boolean;
21
+ outFile?: string;
22
+ }
23
+ export declare function parseCompareArgs(args: string[]): ParsedCompareArgs;
16
24
  export declare function installSkill(targetDir: string, force?: boolean): Promise<Array<{
17
25
  file: string;
18
26
  action: string;
@@ -20,7 +28,7 @@ export declare function installSkill(targetDir: string, force?: boolean): Promis
20
28
  /**
21
29
  * Writes (or merges into) `.mcp.json`, preserving any MCP servers the
22
30
  * project already configured. The ghost-qa entry is always refreshed so
23
- * hosts invoke the published CLI: `npx -y github:avivgerz-hue/ghost-qa mcp`.
31
+ * hosts invoke the published CLI: `npx -y ghost-qa mcp`.
24
32
  */
25
33
  export declare function installMcpConfig(mcpJsonPath: string, force?: boolean): Promise<string>;
26
34
  export declare function main(argv?: string[]): Promise<number>;
@@ -1 +1 @@
1
- {"version":3,"file":"ghost-qa.d.ts","sourceRoot":"","sources":["../../bin/ghost-qa.ts"],"names":[],"mappings":";AAWA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEvE,eAAO,MAAM,OAAO,UAAmB,CAAC;AAKxC,eAAO,MAAM,cAAc,mgCAWX,CAAC;AAyEjB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CA+E5D;AAyDD,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,UAAQ,GACZ,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAqBlD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,UAAQ,GACZ,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAuCD,wBAAsB,IAAI,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoDxE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,GAAE,MAAwB,GAClC,OAAO,CAOT"}
1
+ {"version":3,"file":"ghost-qa.d.ts","sourceRoot":"","sources":["../../bin/ghost-qa.ts"],"names":[],"mappings":";AAYA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEvE,eAAO,MAAM,OAAO,QAAmB,CAAC;AAKxC,eAAO,MAAM,cAAc,8mDAYX,CAAC;AAoFjB,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,cAAc,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,cAAc,CAgG5D;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,iBAAiB,CAiBlE;AAiFD,wBAAsB,YAAY,CAChC,SAAS,EAAE,MAAM,EACjB,KAAK,UAAQ,GACZ,OAAO,CAAC,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAqBlD;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,WAAW,EAAE,MAAM,EACnB,KAAK,UAAQ,GACZ,OAAO,CAAC,MAAM,CAAC,CAuBjB;AAuCD,wBAAsB,IAAI,CAAC,IAAI,WAAwB,GAAG,OAAO,CAAC,MAAM,CAAC,CAiExE;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,SAAS,GAAE,MAAwB,GAClC,OAAO,CAOT"}