sniff-qa 0.2.0 → 0.2.1
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 +214 -411
- package/dist/cli/index.js +15 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/dev-server-detector-NJ5RN4IC.js +150 -0
- package/dist/dev-server-detector-NJ5RN4IC.js.map +1 -0
- package/dist/mcp/server.js +17 -6
- package/dist/mcp/server.js.map +1 -1
- package/dist/{report-E2JZMQED.js → report-PRUX3BIS.js} +1 -1
- package/dist/{unified-CQU7PSNJ.js → unified-6CTLKH6X.js} +1 -1
- package/package.json +1 -1
- /package/dist/{report-E2JZMQED.js.map → report-PRUX3BIS.js.map} +0 -0
- /package/dist/{unified-CQU7PSNJ.js.map → unified-6CTLKH6X.js.map} +0 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<picture>
|
|
2
2
|
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/logo-dark.svg">
|
|
3
3
|
<source media="(prefers-color-scheme: light)" srcset=".github/assets/logo-light.svg">
|
|
4
|
-
<img alt="Sniff
|
|
4
|
+
<img alt="Sniff" src=".github/assets/logo-light.svg" width="100%">
|
|
5
5
|
</picture>
|
|
6
6
|
|
|
7
7
|
<p align="center">
|
|
@@ -12,259 +12,33 @@
|
|
|
12
12
|
<a href="https://github.com/Aboudjem/sniff/stargazers"><img src="https://img.shields.io/github/stars/Aboudjem/sniff?style=flat-square&color=ef4444" alt="Stars"></a>
|
|
13
13
|
</p>
|
|
14
14
|
|
|
15
|
-
<p align="center">
|
|
16
|
-
<b>One command. Eight checks. Zero config.</b><br/>
|
|
17
|
-
<sub>Source bugs, dead links, API endpoints, accessibility, visual regression, performance, AI exploration, and cross-referencing. All in one pass.</sub>
|
|
18
|
-
</p>
|
|
15
|
+
<p align="center">Scan your source code, your live site, or both. Finds bugs before your users do.</p>
|
|
19
16
|
|
|
20
17
|
---
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
## What is this?
|
|
25
|
-
|
|
26
|
-
You ship features. But did you actually *test* them?
|
|
19
|
+
## Get started
|
|
27
20
|
|
|
28
|
-
|
|
21
|
+
### Use from the terminal
|
|
29
22
|
|
|
30
23
|
```bash
|
|
31
|
-
|
|
24
|
+
cd ~/projects/my-app # go to your project
|
|
25
|
+
npx sniff-qa # that's it
|
|
32
26
|
```
|
|
33
27
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
<br/>
|
|
37
|
-
|
|
38
|
-
### Key facts
|
|
39
|
-
|
|
40
|
-
- **What:** Open source AI-powered QA testing tool that runs 8 checks in a single command: source scanning (6 rule categories + dead links + API endpoint discovery), accessibility audits, visual regression, performance budgets, AI-driven exploration, and source/browser cross-referencing
|
|
41
|
-
- **Who it's for:** Frontend and full-stack developers who want automated QA without configuring multiple tools
|
|
42
|
-
- **How it works:** Uses Playwright for browser automation, axe-core for WCAG accessibility, Lighthouse for performance, pixelmatch for visual diffs, and Anthropic Claude for adversarial AI exploration
|
|
43
|
-
- **Install:** `npx sniff-qa` (zero config, no signup, no API keys required for base checks)
|
|
44
|
-
- **Comparable to:** Combines Lighthouse CI + Pa11y + BackstopJS into one tool, plus source code scanning and AI-driven edge case discovery that no other tool offers
|
|
45
|
-
- **Unique:** First QA tool with native MCP (Model Context Protocol) integration. Flakiness quarantine system isolates non-deterministic test results automatically
|
|
46
|
-
|
|
47
|
-
<br/>
|
|
48
|
-
|
|
49
|
-
## Quick start
|
|
50
|
-
|
|
51
|
-
| Step | Action |
|
|
52
|
-
|:----:|:-------|
|
|
53
|
-
| **1** | Run a source scan: `npx sniff-qa` |
|
|
54
|
-
| **2** | Run the full audit: `npx sniff-qa --url http://localhost:3000` |
|
|
55
|
-
| **3** | Read the report and fix what matters |
|
|
56
|
-
|
|
57
|
-
The source scan finishes in seconds. The full audit adds accessibility, visual regression, performance, and AI exploration on top of it.
|
|
58
|
-
|
|
59
|
-
> [!TIP]
|
|
60
|
-
> Drop your URL in `sniff.config.ts` once and you can just run `sniff` for the full audit every time.
|
|
61
|
-
|
|
62
|
-
<br/>
|
|
63
|
-
|
|
64
|
-
## The three modes
|
|
28
|
+
Sniff auto-detects everything: your framework, your dev server port, and your running app. If `npm run dev` is running, sniff finds it and runs browser checks too. No flags needed.
|
|
65
29
|
|
|
66
|
-
|
|
67
|
-
graph LR
|
|
68
|
-
A["🔍 Quick Scan<br/><sub>npx sniff-qa</sub>"] --> B["Source bugs only<br/><sub>No browser needed</sub>"]
|
|
69
|
-
C["🛡️ Full Audit<br/><sub>npx sniff-qa --url URL</sub>"] --> D["All 8 checks<br/><sub>Source + Browser + Xref</sub>"]
|
|
70
|
-
E["🏗️ CI Mode<br/><sub>npx sniff-qa --url URL --ci</sub>"] --> F["Deterministic<br/><sub>Skips AI explorer</sub>"]
|
|
71
|
-
|
|
72
|
-
style A fill:#fef2f2,stroke:#ef4444,color:#7f1d1d
|
|
73
|
-
style B fill:#fee2e2,stroke:#ef4444,color:#7f1d1d
|
|
74
|
-
style C fill:#fef2f2,stroke:#ef4444,color:#7f1d1d
|
|
75
|
-
style D fill:#fee2e2,stroke:#ef4444,color:#7f1d1d
|
|
76
|
-
style E fill:#fef2f2,stroke:#ef4444,color:#7f1d1d
|
|
77
|
-
style F fill:#fee2e2,stroke:#ef4444,color:#7f1d1d
|
|
78
|
-
```
|
|
30
|
+
You can also be explicit:
|
|
79
31
|
|
|
80
32
|
```bash
|
|
81
|
-
npx sniff-qa
|
|
82
|
-
npx sniff-qa --url
|
|
83
|
-
npx sniff-qa --url http://localhost:3000 --ci # ci mode (skips AI explorer)
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
CI mode auto-skips the AI explorer because it is non-deterministic. Everything else runs exactly the same.
|
|
87
|
-
|
|
88
|
-
<br/>
|
|
89
|
-
|
|
90
|
-
## What it checks
|
|
91
|
-
|
|
92
|
-
| | Check | Example finding | Details |
|
|
93
|
-
|:--|:------|:----------------|:--------|
|
|
94
|
-
| 📄 | **Source code** | `debugger` statement in `handler.ts:42` | Leftover debugger, placeholder text, hardcoded URLs, broken imports, TODO/FIXME |
|
|
95
|
-
| 🔗 | **Dead links** | Broken link `./guide.md` in `README.md:28` | Validates internal file refs, external URLs (HTTP HEAD with retry), and anchor links. Catches 404s before your users do |
|
|
96
|
-
| 🛣️ | **API endpoints** | `POST /users` has no input validation | Discovers routes from Express, Fastify, Hono, Next.js, SvelteKit, tRPC, and GraphQL. Flags missing error handling, auth, and hardcoded secrets |
|
|
97
|
-
| ♿ | **Accessibility** | Missing form label on `/login` | WCAG 2.x violations via [axe-core](https://github.com/dequelabs/axe-core) with exact fix guidance |
|
|
98
|
-
| 🖼 | **Visual regression** | `/pricing` changed 2.3% of pixels | Local pixel diffing via [pixelmatch](https://github.com/mapbox/pixelmatch). Commit baselines to track changes |
|
|
99
|
-
| ⚡ | **Performance** | LCP 4200ms on `/dashboard` (budget: 2500ms) | [Lighthouse](https://developer.chrome.com/docs/lighthouse) budgets for LCP, FCP, TTI |
|
|
100
|
-
| 🤖 | **AI explorer** | XSS in `/signup` email field crashes app | Roams your app, fills forms with adversarial inputs, reports crashes and console errors |
|
|
101
|
-
| 🔀 | **Cross-reference** | `console.log` in source confirmed at runtime | Correlates source findings with browser evidence. Corroborated issues get bumped severity and HIGH confidence tags |
|
|
102
|
-
|
|
103
|
-
<br/>
|
|
104
|
-
|
|
105
|
-
## How it works
|
|
106
|
-
|
|
107
|
-
<picture>
|
|
108
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/pipeline-dark.svg">
|
|
109
|
-
<source media="(prefers-color-scheme: light)" srcset=".github/assets/pipeline-light.svg">
|
|
110
|
-
<img alt="Sniff pipeline showing 8 checks flowing through source scanner, browser runner, cross-reference engine, and report output" src=".github/assets/pipeline-light.svg" width="100%">
|
|
111
|
-
</picture>
|
|
112
|
-
|
|
113
|
-
Your code goes in. A report with actionable findings comes out. When you provide a URL, sniff also runs browser checks and cross-references source findings with runtime behavior for high-confidence results. You don't configure anything.
|
|
114
|
-
|
|
115
|
-
<br/>
|
|
116
|
-
|
|
117
|
-
## Compared to
|
|
118
|
-
|
|
119
|
-
| | **Sniff** | Lighthouse CI | Pa11y | BackstopJS |
|
|
120
|
-
|:--|:--:|:--:|:--:|:--:|
|
|
121
|
-
| Source scanning | ✅ | ❌ | ❌ | ❌ |
|
|
122
|
-
| Dead link checking | ✅ | ❌ | ❌ | ❌ |
|
|
123
|
-
| API endpoint discovery | ✅ | ❌ | ❌ | ❌ |
|
|
124
|
-
| Accessibility | ✅ | partial | ✅ | ❌ |
|
|
125
|
-
| Visual regression | ✅ | ❌ | ❌ | ✅ |
|
|
126
|
-
| Performance | ✅ | ✅ | ❌ | ❌ |
|
|
127
|
-
| AI exploration | ✅ | ❌ | ❌ | ❌ |
|
|
128
|
-
| Cross-reference engine | ✅ | ❌ | ❌ | ❌ |
|
|
129
|
-
| Flakiness quarantine | ✅ | ❌ | ❌ | ❌ |
|
|
130
|
-
| Single command | ✅ | ❌ | ❌ | ❌ |
|
|
131
|
-
| MCP server | ✅ | ❌ | ❌ | ❌ |
|
|
132
|
-
| Zero config | ✅ | ❌ | ❌ | ❌ |
|
|
133
|
-
|
|
134
|
-
> [!IMPORTANT]
|
|
135
|
-
> Sniff is the **first QA tool with native MCP integration**. Your AI editor can trigger scans, read results, and fix issues without you switching context.
|
|
136
|
-
|
|
137
|
-
<br/>
|
|
138
|
-
|
|
139
|
-
## Source scanning rules
|
|
140
|
-
|
|
141
|
-
Sniff ships 6 rule categories that run on every scan. No browser needed.
|
|
142
|
-
|
|
143
|
-
| Rule | ID | Severity | What it catches |
|
|
144
|
-
|:-----|:---|:---------|:----------------|
|
|
145
|
-
| Debug statements | `debug-console-log`, `debug-debugger` | medium / high | `console.log`, `console.debug`, `debugger` left in production code |
|
|
146
|
-
| Placeholder text | `placeholder-lorem`, `placeholder-todo`, `placeholder-fixme`, `placeholder-tbd` | high / medium | Lorem ipsum, TODO, FIXME, TBD markers |
|
|
147
|
-
| Hardcoded URLs | `hardcoded-localhost`, `hardcoded-127` | medium | `http://localhost:*` and `http://127.0.0.1:*` in non-test files |
|
|
148
|
-
| Broken imports | `broken-import` | medium | Relative imports that don't resolve to a file (with TS extension mapping) |
|
|
149
|
-
| Dead links | `dead-link-internal`, `dead-link-external`, `dead-link-anchor` | high / medium / low | Broken file references, 404 external URLs, missing anchor targets |
|
|
150
|
-
| API endpoints | `api-no-error-handling`, `api-no-validation`, `api-no-auth`, `api-hardcoded-secret` | critical / medium / low | Route handlers missing try/catch, input validation, auth, or containing hardcoded secrets |
|
|
151
|
-
|
|
152
|
-
### Dead link checker
|
|
153
|
-
|
|
154
|
-
Scans `.md`, `.html`, `.jsx`, `.tsx`, `.vue`, `.svelte`, and `.astro` files for links and validates them:
|
|
155
|
-
|
|
156
|
-
- **Internal links:** Checks the target file exists (with extension resolution and index file fallback)
|
|
157
|
-
- **External links:** Sends HTTP HEAD requests with timeout, retry, and GET fallback for servers that reject HEAD
|
|
158
|
-
- **Anchor links:** Validates `#section` references against markdown headings and HTML `id`/`name` attributes
|
|
159
|
-
- **Smart skipping:** Ignores `mailto:`, `tel:`, `data:`, `javascript:`, and template variables
|
|
160
|
-
|
|
161
|
-
```
|
|
162
|
-
HIGH README.md:28 Broken internal link: ./missing-guide.md
|
|
163
|
-
MED docs/api.md:15 HTTP 404: https://example.com/old-endpoint
|
|
164
|
-
MED CONTRIBUTING.md:8 Anchor #setup-guide not found in ./README.md
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
### API endpoint discovery
|
|
168
|
-
|
|
169
|
-
Automatically discovers API routes from 8 frameworks:
|
|
170
|
-
|
|
171
|
-
| Framework | Detection method |
|
|
172
|
-
|:----------|:----------------|
|
|
173
|
-
| Express | `app.get()`, `router.post()`, etc. |
|
|
174
|
-
| Fastify | `fastify.get()`, `fastify.post()`, etc. |
|
|
175
|
-
| Hono | `app.get()` with `new Hono()` detection |
|
|
176
|
-
| Next.js App Router | `app/**/route.ts` with exported `GET`/`POST` handlers |
|
|
177
|
-
| Next.js Pages Router | `pages/api/**/*.ts` |
|
|
178
|
-
| SvelteKit | `routes/**/+server.ts` |
|
|
179
|
-
| tRPC | `publicProcedure.query()` / `.mutation()` |
|
|
180
|
-
| GraphQL | `type Query { }` / `type Mutation { }` definitions |
|
|
181
|
-
|
|
182
|
-
For each endpoint, sniff checks for:
|
|
183
|
-
- Missing error handling (no try/catch or error middleware)
|
|
184
|
-
- Missing input validation on POST/PUT/PATCH routes (no zod, joi, yup, etc.)
|
|
185
|
-
- Missing auth middleware on non-public routes
|
|
186
|
-
- Hardcoded secrets (API keys, tokens, Stripe keys, GitHub tokens)
|
|
187
|
-
|
|
188
|
-
```
|
|
189
|
-
CRIT src/routes.ts:12 Hardcoded Stripe key in POST /checkout handler
|
|
190
|
-
MED src/api.ts:5 POST /users has no input validation
|
|
191
|
-
MED src/api.ts:18 GET /admin/data has no error handling
|
|
192
|
-
LOW src/api.ts:25 GET /admin/data has no visible auth middleware
|
|
193
|
-
INFO Discovered 6 API endpoints (express: 4, nextjs-app: 2)
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
### Cross-reference engine
|
|
197
|
-
|
|
198
|
-
When you run sniff with `--url`, the cross-reference engine correlates source code findings with browser runtime behavior. Findings confirmed in both layers get bumped severity and a HIGH confidence tag.
|
|
199
|
-
|
|
200
|
-
**5 correlation strategies:**
|
|
201
|
-
|
|
202
|
-
| Source finding | Browser evidence | Correlation |
|
|
203
|
-
|:---------------|:-----------------|:------------|
|
|
204
|
-
| Broken import / dead link | 404 network request | `broken-import-to-404` |
|
|
205
|
-
| `console.log` statement | Console output captured | `console-log-to-runtime` |
|
|
206
|
-
| Hardcoded localhost URL | Network request to that URL | `hardcoded-url-to-network` |
|
|
207
|
-
| Missing label / a11y issue | axe-core violation | `source-a11y-to-axe` |
|
|
208
|
-
| Placeholder text in source | Text visible on page | `placeholder-to-runtime` |
|
|
209
|
-
|
|
33
|
+
npx sniff-qa --url http://localhost:3000 # specific local URL
|
|
34
|
+
npx sniff-qa --url https://myapp.com # production URL
|
|
210
35
|
```
|
|
211
|
-
CORROBORATED (source + browser evidence)
|
|
212
|
-
src/handler.ts:42 console.log("debug data")
|
|
213
|
-
Source: debug-console-log rule triggered
|
|
214
|
-
Browser: console.log output captured at /dashboard
|
|
215
|
-
Confidence: HIGH (confirmed in both layers)
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
<br/>
|
|
219
|
-
|
|
220
|
-
## Architecture
|
|
221
|
-
|
|
222
|
-
<picture>
|
|
223
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/architecture-dark.svg">
|
|
224
|
-
<source media="(prefers-color-scheme: light)" srcset=".github/assets/architecture-light.svg">
|
|
225
|
-
<img alt="Sniff architecture showing source scanner, browser runner, cross-reference engine, and report engine" src=".github/assets/architecture-light.svg" width="100%">
|
|
226
|
-
</picture>
|
|
227
|
-
|
|
228
|
-
<br/>
|
|
229
|
-
|
|
230
|
-
## Example output
|
|
231
|
-
|
|
232
|
-
<picture>
|
|
233
|
-
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/report-dark.svg">
|
|
234
|
-
<source media="(prefers-color-scheme: light)" srcset=".github/assets/report-light.svg">
|
|
235
|
-
<img alt="Sniff terminal output showing source findings, browser results, and cross-referenced corroborated findings" src=".github/assets/report-light.svg" width="100%">
|
|
236
|
-
</picture>
|
|
237
|
-
|
|
238
|
-
<br/>
|
|
239
|
-
|
|
240
|
-
## Works with your stack
|
|
241
|
-
|
|
242
|
-
No config needed. Sniff auto-detects your framework from `package.json` and source files.
|
|
243
|
-
|
|
244
|
-
<table>
|
|
245
|
-
<tr>
|
|
246
|
-
<td align="center" width="16%"><b>⚛️ React</b></td>
|
|
247
|
-
<td align="center" width="16%"><b>▲ Next.js</b></td>
|
|
248
|
-
<td align="center" width="16%"><b>💚 Vue</b></td>
|
|
249
|
-
<td align="center" width="16%"><b>🔶 Svelte</b></td>
|
|
250
|
-
<td align="center" width="16%"><b>🅰️ Angular</b></td>
|
|
251
|
-
<td align="center" width="16%"><b>🌐 Vanilla</b></td>
|
|
252
|
-
</tr>
|
|
253
|
-
<tr>
|
|
254
|
-
<td align="center">JSX / TSX</td>
|
|
255
|
-
<td align="center">App Router</td>
|
|
256
|
-
<td align="center">SFC</td>
|
|
257
|
-
<td align="center">Components</td>
|
|
258
|
-
<td align="center">Templates</td>
|
|
259
|
-
<td align="center">HTML / CSS</td>
|
|
260
|
-
</tr>
|
|
261
|
-
</table>
|
|
262
36
|
|
|
263
|
-
|
|
37
|
+
> **No API keys. No Playwright install. No config files.** Everything works out of the box. Browser checks auto-install Chromium on first run.
|
|
264
38
|
|
|
265
|
-
|
|
39
|
+
### Use from your AI editor
|
|
266
40
|
|
|
267
|
-
Sniff ships an MCP server.
|
|
41
|
+
Sniff ships as an MCP server. Add it to your editor, then ask your AI to scan.
|
|
268
42
|
|
|
269
43
|
<details>
|
|
270
44
|
<summary><b>Claude Code</b></summary>
|
|
@@ -272,51 +46,24 @@ Sniff ships an MCP server. Pick your tool and copy the snippet.
|
|
|
272
46
|
```bash
|
|
273
47
|
claude mcp add sniff-qa npx sniff-qa --mcp
|
|
274
48
|
```
|
|
275
|
-
|
|
276
|
-
Or `.mcp.json`:
|
|
277
|
-
|
|
278
|
-
```json
|
|
279
|
-
{
|
|
280
|
-
"mcpServers": {
|
|
281
|
-
"sniff-qa": { "command": "npx", "args": ["sniff-qa", "--mcp"] }
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
```
|
|
285
|
-
|
|
286
49
|
</details>
|
|
287
50
|
|
|
288
51
|
<details>
|
|
289
52
|
<summary><b>Cursor</b></summary>
|
|
290
53
|
|
|
291
|
-
|
|
292
|
-
|
|
54
|
+
Add to `~/.cursor/mcp.json`:
|
|
293
55
|
```json
|
|
294
|
-
{
|
|
295
|
-
"mcpServers": {
|
|
296
|
-
"sniff-qa": {
|
|
297
|
-
"type": "stdio",
|
|
298
|
-
"command": "npx",
|
|
299
|
-
"args": ["sniff-qa", "--mcp"]
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
56
|
+
{ "mcpServers": { "sniff-qa": { "type": "stdio", "command": "npx", "args": ["sniff-qa", "--mcp"] } } }
|
|
303
57
|
```
|
|
304
|
-
|
|
305
58
|
</details>
|
|
306
59
|
|
|
307
60
|
<details>
|
|
308
|
-
<summary><b>
|
|
309
|
-
|
|
310
|
-
`~/.codeium/windsurf/mcp_config.json`:
|
|
61
|
+
<summary><b>VS Code + Copilot</b></summary>
|
|
311
62
|
|
|
63
|
+
Add to `.vscode/mcp.json`:
|
|
312
64
|
```json
|
|
313
|
-
{
|
|
314
|
-
"mcpServers": {
|
|
315
|
-
"sniff-qa": { "command": "npx", "args": ["sniff-qa", "--mcp"] }
|
|
316
|
-
}
|
|
317
|
-
}
|
|
65
|
+
{ "servers": { "sniff-qa": { "type": "stdio", "command": "npx", "args": ["-y", "sniff-qa", "--mcp"] } } }
|
|
318
66
|
```
|
|
319
|
-
|
|
320
67
|
</details>
|
|
321
68
|
|
|
322
69
|
<details>
|
|
@@ -325,64 +72,34 @@ Or `.mcp.json`:
|
|
|
325
72
|
```bash
|
|
326
73
|
codex mcp add sniff-qa -- npx -y sniff-qa --mcp
|
|
327
74
|
```
|
|
75
|
+
</details>
|
|
328
76
|
|
|
329
|
-
|
|
77
|
+
<details>
|
|
78
|
+
<summary><b>Windsurf</b></summary>
|
|
330
79
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
args = ["-y", "sniff-qa", "--mcp"]
|
|
80
|
+
Add to `~/.codeium/windsurf/mcp_config.json`:
|
|
81
|
+
```json
|
|
82
|
+
{ "mcpServers": { "sniff-qa": { "command": "npx", "args": ["sniff-qa", "--mcp"] } } }
|
|
335
83
|
```
|
|
336
|
-
|
|
337
84
|
</details>
|
|
338
85
|
|
|
339
86
|
<details>
|
|
340
87
|
<summary><b>Gemini CLI</b></summary>
|
|
341
88
|
|
|
342
|
-
`~/.gemini/mcp_config.json`:
|
|
343
|
-
|
|
89
|
+
Add to `~/.gemini/mcp_config.json`:
|
|
344
90
|
```json
|
|
345
|
-
{
|
|
346
|
-
"mcpServers": {
|
|
347
|
-
"sniff-qa": { "command": "npx", "args": ["sniff-qa", "--mcp"] }
|
|
348
|
-
}
|
|
349
|
-
}
|
|
91
|
+
{ "mcpServers": { "sniff-qa": { "command": "npx", "args": ["sniff-qa", "--mcp"] } } }
|
|
350
92
|
```
|
|
351
|
-
|
|
352
93
|
</details>
|
|
353
94
|
|
|
354
95
|
<details>
|
|
355
96
|
<summary><b>Continue.dev</b></summary>
|
|
356
97
|
|
|
357
|
-
`.continue/mcpServers/sniff-qa.yaml`:
|
|
358
|
-
|
|
98
|
+
Add to `.continue/mcpServers/sniff-qa.yaml`:
|
|
359
99
|
```yaml
|
|
360
100
|
mcpServers:
|
|
361
|
-
sniff-qa:
|
|
362
|
-
command: npx
|
|
363
|
-
args: [sniff-qa, --mcp]
|
|
364
|
-
type: stdio
|
|
101
|
+
sniff-qa: { command: npx, args: [sniff-qa, --mcp], type: stdio }
|
|
365
102
|
```
|
|
366
|
-
|
|
367
|
-
</details>
|
|
368
|
-
|
|
369
|
-
<details>
|
|
370
|
-
<summary><b>VS Code + Copilot</b></summary>
|
|
371
|
-
|
|
372
|
-
Add to `.vscode/mcp.json`:
|
|
373
|
-
|
|
374
|
-
```json
|
|
375
|
-
{
|
|
376
|
-
"servers": {
|
|
377
|
-
"sniff-qa": {
|
|
378
|
-
"type": "stdio",
|
|
379
|
-
"command": "npx",
|
|
380
|
-
"args": ["-y", "sniff-qa", "--mcp"]
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
```
|
|
385
|
-
|
|
386
103
|
</details>
|
|
387
104
|
|
|
388
105
|
<details>
|
|
@@ -391,29 +108,13 @@ Add to `.vscode/mcp.json`:
|
|
|
391
108
|
```bash
|
|
392
109
|
clawhub install sniff-qa
|
|
393
110
|
```
|
|
394
|
-
|
|
395
|
-
Or add to `~/.openclaw/openclaw.json`:
|
|
396
|
-
|
|
397
|
-
```json
|
|
398
|
-
{
|
|
399
|
-
"mcpServers": {
|
|
400
|
-
"sniff-qa": {
|
|
401
|
-
"command": "npx",
|
|
402
|
-
"args": ["-y", "sniff-qa", "--mcp"]
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
```
|
|
407
|
-
|
|
408
111
|
</details>
|
|
409
112
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
**MCP tools exposed:** `sniff_scan` (source), `sniff_run` (browser), `sniff_report` (last results).
|
|
113
|
+
Then ask: *"Scan this project for issues"* or *"Check accessibility on localhost:3000"*
|
|
413
114
|
|
|
414
|
-
|
|
115
|
+
**MCP tools:** `sniff_scan` (source) · `sniff_run` (browser) · `sniff_report` (results)
|
|
415
116
|
|
|
416
|
-
|
|
117
|
+
### Install as a dev dependency
|
|
417
118
|
|
|
418
119
|
```bash
|
|
419
120
|
npm install -D sniff-qa
|
|
@@ -422,154 +123,256 @@ npm install -D sniff-qa
|
|
|
422
123
|
```json
|
|
423
124
|
{
|
|
424
125
|
"scripts": {
|
|
425
|
-
"qa": "sniff
|
|
126
|
+
"qa": "sniff",
|
|
127
|
+
"qa:full": "sniff --url http://localhost:3000"
|
|
426
128
|
}
|
|
427
129
|
}
|
|
428
130
|
```
|
|
429
131
|
|
|
430
|
-
|
|
132
|
+
Requires Node.js 22+. Playwright installs automatically on first browser scan.
|
|
431
133
|
|
|
432
|
-
|
|
134
|
+
---
|
|
433
135
|
|
|
434
|
-
##
|
|
136
|
+
## Usage
|
|
435
137
|
|
|
436
138
|
```bash
|
|
437
|
-
npx sniff-qa
|
|
139
|
+
npx sniff-qa # scan source + auto-detect dev server
|
|
140
|
+
npx sniff-qa --url https://myapp.com # scan source + specific URL
|
|
141
|
+
npx sniff-qa ./path/to/project # scan a specific directory
|
|
142
|
+
npx sniff-qa --ci # CI mode (JUnit output, no AI explorer)
|
|
438
143
|
```
|
|
439
144
|
|
|
440
|
-
|
|
145
|
+
Sniff auto-detects your dev server by reading `package.json` scripts and probing common ports (3000, 5173, 8080, 4200). If it finds a running server, browser checks run automatically.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## What it finds
|
|
441
150
|
|
|
442
|
-
|
|
151
|
+
<picture>
|
|
152
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/features-dark.svg">
|
|
153
|
+
<source media="(prefers-color-scheme: light)" srcset=".github/assets/features-light.svg">
|
|
154
|
+
<img alt="Sniff checks: source bugs, dead links, API endpoints, broken imports, accessibility, visual regression, performance, AI explorer" src=".github/assets/features-light.svg" width="100%">
|
|
155
|
+
</picture>
|
|
443
156
|
|
|
444
|
-
|
|
157
|
+
**Source checks** run on every scan. **Browser checks** activate when you pass `--url`.
|
|
445
158
|
|
|
446
|
-
|
|
159
|
+
---
|
|
447
160
|
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
<
|
|
161
|
+
## Example output
|
|
162
|
+
|
|
163
|
+
<picture>
|
|
164
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/report-dark.svg">
|
|
165
|
+
<source media="(prefers-color-scheme: light)" srcset=".github/assets/report-light.svg">
|
|
166
|
+
<img alt="Sniff terminal output" src=".github/assets/report-light.svg" width="100%">
|
|
167
|
+
</picture>
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Commands
|
|
172
|
+
|
|
173
|
+
### Slash commands (AI editors)
|
|
174
|
+
|
|
175
|
+
| Command | What it does |
|
|
176
|
+
|:--------|:-------------|
|
|
177
|
+
| `/sniff` | Scan the project. Auto-detects dev server, runs source + browser checks |
|
|
178
|
+
| `/sniff-fix` | Scan and auto-fix safe issues (debugger, console.log, etc.) |
|
|
179
|
+
| `/sniff-report` | Show results from the last scan |
|
|
180
|
+
|
|
181
|
+
### CLI
|
|
451
182
|
|
|
452
183
|
```
|
|
453
|
-
sniff
|
|
454
|
-
sniff --url <url>
|
|
455
|
-
sniff --url <url> --ci
|
|
456
|
-
|
|
457
|
-
sniff init
|
|
458
|
-
sniff ci
|
|
459
|
-
sniff report
|
|
460
|
-
sniff update-baselines
|
|
184
|
+
sniff Scan source + auto-detect dev server
|
|
185
|
+
sniff --url <url> Scan source + test live site
|
|
186
|
+
sniff --url <url> --ci Full audit for CI pipelines
|
|
187
|
+
sniff <path> Scan a specific directory
|
|
188
|
+
sniff init Create sniff.config.ts
|
|
189
|
+
sniff ci Generate GitHub Actions workflow
|
|
190
|
+
sniff report Show last scan results
|
|
191
|
+
sniff update-baselines Accept current visual baselines
|
|
461
192
|
```
|
|
462
193
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
| `--
|
|
469
|
-
| `--
|
|
194
|
+
<details>
|
|
195
|
+
<summary><b>All flags</b></summary>
|
|
196
|
+
|
|
197
|
+
| Flag | What it does |
|
|
198
|
+
|:-----|:-------------|
|
|
199
|
+
| `--url <url>` | Enable browser checks (accessibility, visual, performance, AI) |
|
|
200
|
+
| `--ci` | CI mode: skip AI explorer, add JUnit output, track flaky tests |
|
|
201
|
+
| `--no-explore` | Browser checks without AI explorer |
|
|
202
|
+
| `--no-browser` | Source only even if `--url` is set |
|
|
203
|
+
| `--max-steps <n>` | Limit AI explorer steps (default: 50) |
|
|
470
204
|
| `--no-headless` | Show the browser window |
|
|
471
205
|
| `--format html,json,junit` | Choose report formats |
|
|
472
|
-
| `--fail-on critical,high` | Severities that
|
|
473
|
-
| `--track-flakes` |
|
|
474
|
-
| `--json` |
|
|
206
|
+
| `--fail-on critical,high` | Severities that cause non-zero exit |
|
|
207
|
+
| `--track-flakes` | Track test flakiness across runs |
|
|
208
|
+
| `--json` | JSON output for scripts |
|
|
475
209
|
|
|
476
210
|
</details>
|
|
477
211
|
|
|
478
|
-
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Works with any stack
|
|
215
|
+
|
|
216
|
+
Sniff auto-detects your framework. No config needed.
|
|
217
|
+
|
|
218
|
+
<table>
|
|
219
|
+
<tr>
|
|
220
|
+
<td align="center" width="14%"><b>React</b><br/><sub>JSX / TSX</sub></td>
|
|
221
|
+
<td align="center" width="14%"><b>Next.js</b><br/><sub>App + Pages</sub></td>
|
|
222
|
+
<td align="center" width="14%"><b>Vue</b><br/><sub>SFC</sub></td>
|
|
223
|
+
<td align="center" width="14%"><b>Svelte</b><br/><sub>Components</sub></td>
|
|
224
|
+
<td align="center" width="14%"><b>Angular</b><br/><sub>Templates</sub></td>
|
|
225
|
+
<td align="center" width="14%"><b>Express</b><br/><sub>Routes</sub></td>
|
|
226
|
+
<td align="center" width="14%"><b>Vanilla</b><br/><sub>HTML / CSS</sub></td>
|
|
227
|
+
</tr>
|
|
228
|
+
</table>
|
|
229
|
+
|
|
230
|
+
API discovery also supports **Fastify**, **Hono**, **tRPC**, and **GraphQL**.
|
|
231
|
+
|
|
232
|
+
---
|
|
479
233
|
|
|
480
234
|
## Configuration
|
|
481
235
|
|
|
482
|
-
|
|
483
|
-
<summary><b>⚙️ sniff.config.ts reference</b></summary>
|
|
484
|
-
<br/>
|
|
236
|
+
Sniff works with zero config. Only create a config file if you want to customize.
|
|
485
237
|
|
|
486
|
-
|
|
238
|
+
```bash
|
|
239
|
+
npx sniff-qa init
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
<details>
|
|
243
|
+
<summary><b>sniff.config.ts reference</b></summary>
|
|
487
244
|
|
|
488
245
|
```typescript
|
|
489
246
|
import { defineConfig } from 'sniff-qa';
|
|
490
247
|
|
|
491
248
|
export default defineConfig({
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
249
|
+
// Save your URL so you can just run `sniff`
|
|
250
|
+
browser: { baseUrl: 'http://localhost:3000' },
|
|
251
|
+
|
|
252
|
+
// Viewports to test
|
|
495
253
|
viewports: [
|
|
496
254
|
{ name: 'mobile', width: 375, height: 667 },
|
|
497
255
|
{ name: 'desktop', width: 1280, height: 720 },
|
|
498
256
|
],
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
},
|
|
257
|
+
|
|
258
|
+
// Performance budgets (ms)
|
|
259
|
+
performance: { budgets: { lcp: 2500, fcp: 1800, tti: 3800 } },
|
|
260
|
+
|
|
261
|
+
// Visual regression threshold (0-1)
|
|
502
262
|
visual: { threshold: 0.1 },
|
|
263
|
+
|
|
264
|
+
// AI explorer
|
|
503
265
|
exploration: { maxSteps: 50 },
|
|
504
|
-
flakiness: { windowSize: 5, threshold: 3 },
|
|
505
266
|
|
|
506
|
-
// Dead link checker
|
|
267
|
+
// Dead link checker
|
|
507
268
|
deadLinks: {
|
|
508
|
-
checkExternal: true,
|
|
509
|
-
timeout: 5000,
|
|
510
|
-
retries: 2,
|
|
511
|
-
ignorePatterns: [],
|
|
512
|
-
maxConcurrent: 10,
|
|
269
|
+
checkExternal: true,
|
|
270
|
+
timeout: 5000,
|
|
271
|
+
retries: 2,
|
|
272
|
+
ignorePatterns: [],
|
|
273
|
+
maxConcurrent: 10,
|
|
513
274
|
},
|
|
514
275
|
|
|
515
|
-
// API endpoint discovery
|
|
276
|
+
// API endpoint discovery
|
|
516
277
|
apiEndpoints: {
|
|
517
|
-
checkErrorHandling: true,
|
|
518
|
-
checkValidation: true,
|
|
519
|
-
checkAuth: true,
|
|
520
|
-
checkSecrets: true,
|
|
521
|
-
frameworks: [],
|
|
278
|
+
checkErrorHandling: true,
|
|
279
|
+
checkValidation: true,
|
|
280
|
+
checkAuth: true,
|
|
281
|
+
checkSecrets: true,
|
|
282
|
+
frameworks: [], // empty = auto-detect all
|
|
522
283
|
},
|
|
523
284
|
|
|
524
|
-
//
|
|
285
|
+
// Turn off specific rules
|
|
525
286
|
rules: {
|
|
526
|
-
'debug-console-log': 'off',
|
|
527
|
-
'dead-link-internal': 'off', // example: skip dead link checks
|
|
287
|
+
'debug-console-log': 'off',
|
|
528
288
|
},
|
|
529
289
|
});
|
|
530
290
|
```
|
|
531
291
|
|
|
532
292
|
</details>
|
|
533
293
|
|
|
534
|
-
<
|
|
294
|
+
<details>
|
|
295
|
+
<summary><b>All rule IDs</b></summary>
|
|
296
|
+
|
|
297
|
+
| Rule | Severity | What it checks |
|
|
298
|
+
|:-----|:---------|:---------------|
|
|
299
|
+
| `debug-console-log` | medium | console.log/debug/info |
|
|
300
|
+
| `debug-debugger` | high | debugger statements |
|
|
301
|
+
| `placeholder-lorem` | high | Lorem ipsum text |
|
|
302
|
+
| `placeholder-todo` | medium | TODO comments |
|
|
303
|
+
| `placeholder-fixme` | high | FIXME comments |
|
|
304
|
+
| `placeholder-tbd` | medium | TBD markers |
|
|
305
|
+
| `hardcoded-localhost` | medium | localhost URLs |
|
|
306
|
+
| `hardcoded-127` | medium | 127.0.0.1 URLs |
|
|
307
|
+
| `broken-import` | medium | Unresolved imports |
|
|
308
|
+
| `dead-link-internal` | high | Broken file links |
|
|
309
|
+
| `dead-link-external` | medium | 404 external URLs |
|
|
310
|
+
| `dead-link-anchor` | medium | Missing anchors |
|
|
311
|
+
| `api-no-error-handling` | medium | Routes without try/catch |
|
|
312
|
+
| `api-no-validation` | medium | POST/PUT without validation |
|
|
313
|
+
| `api-no-auth` | low | Routes without auth |
|
|
314
|
+
| `api-hardcoded-secret` | critical | Hardcoded API keys |
|
|
315
|
+
|
|
316
|
+
Set any to `'off'` to disable.
|
|
535
317
|
|
|
536
|
-
|
|
318
|
+
</details>
|
|
537
319
|
|
|
538
|
-
|
|
539
|
-
|:--|:--|
|
|
540
|
-
| 🚫 | **No telemetry.** Sniff does not phone home. Ever. |
|
|
541
|
-
| 🔑 | **No signup.** No accounts. No API keys for core functionality. |
|
|
542
|
-
| 📦 | **No data collection.** Your code stays on your machine. |
|
|
543
|
-
| 👁️ | **Open source.** Read every line. Apache 2.0. |
|
|
320
|
+
---
|
|
544
321
|
|
|
545
|
-
|
|
546
|
-
> The AI explorer requires an Anthropic API key only if you want the chaos monkey feature. The other seven checks (source scanning, dead links, API endpoints, accessibility, visual regression, performance, cross-referencing) work completely offline with zero external calls. External link checking in the dead link scanner makes HTTP requests to validate URLs, but never sends your code.
|
|
322
|
+
## CI integration
|
|
547
323
|
|
|
548
|
-
|
|
324
|
+
```bash
|
|
325
|
+
npx sniff-qa ci
|
|
326
|
+
```
|
|
549
327
|
|
|
550
|
-
|
|
328
|
+
Generates `.github/workflows/sniff.yml` with Playwright caching, JUnit output, and report artifacts.
|
|
551
329
|
|
|
552
|
-
|
|
330
|
+
**Flakiness quarantine:** Tests that fail 3 of 5 runs get quarantined. They still run, still report, but won't block your pipeline.
|
|
553
331
|
|
|
554
|
-
|
|
332
|
+
---
|
|
555
333
|
|
|
556
|
-
##
|
|
334
|
+
## How it works
|
|
335
|
+
|
|
336
|
+
<picture>
|
|
337
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/pipeline-dark.svg">
|
|
338
|
+
<source media="(prefers-color-scheme: light)" srcset=".github/assets/pipeline-light.svg">
|
|
339
|
+
<img alt="Sniff pipeline" src=".github/assets/pipeline-light.svg" width="100%">
|
|
340
|
+
</picture>
|
|
341
|
+
|
|
342
|
+
<details>
|
|
343
|
+
<summary><b>Architecture</b></summary>
|
|
344
|
+
|
|
345
|
+
<picture>
|
|
346
|
+
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/architecture-dark.svg">
|
|
347
|
+
<source media="(prefers-color-scheme: light)" srcset=".github/assets/architecture-light.svg">
|
|
348
|
+
<img alt="Sniff architecture" src=".github/assets/architecture-light.svg" width="100%">
|
|
349
|
+
</picture>
|
|
557
350
|
|
|
558
|
-
|
|
351
|
+
</details>
|
|
559
352
|
|
|
560
|
-
|
|
561
|
-
- 🔧 Add a new source scanning rule
|
|
562
|
-
- 🐛 Report a false positive
|
|
563
|
-
- 📚 Improve documentation
|
|
353
|
+
---
|
|
564
354
|
|
|
565
|
-
|
|
355
|
+
## Privacy
|
|
566
356
|
|
|
567
|
-
|
|
357
|
+
No telemetry. No signup. No data collection. No API keys. Your code stays on your machine.
|
|
568
358
|
|
|
569
|
-
[
|
|
359
|
+
> [!NOTE]
|
|
360
|
+
> All 8 checks work without any API key. The AI explorer uses Claude Code as the AI provider when run through MCP, so no separate Anthropic key is needed. Dead link checking validates external URLs but never sends your code.
|
|
570
361
|
|
|
571
362
|
---
|
|
572
363
|
|
|
364
|
+
## Contributing
|
|
365
|
+
|
|
366
|
+
Add a source rule: each rule is a regex + severity in `src/scanners/source/rules/`. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
<p align="center">
|
|
371
|
+
<sub>
|
|
372
|
+
Built on <a href="https://playwright.dev">Playwright</a> · <a href="https://github.com/dequelabs/axe-core">axe-core</a> · <a href="https://developer.chrome.com/docs/lighthouse">Lighthouse</a> · <a href="https://github.com/mapbox/pixelmatch">pixelmatch</a> · <a href="https://zod.dev">Zod</a> · <a href="https://github.com/modelcontextprotocol/typescript-sdk">MCP SDK</a> · <a href="https://github.com/anthropics/anthropic-sdk-typescript">Anthropic SDK</a>
|
|
373
|
+
</sub>
|
|
374
|
+
</p>
|
|
375
|
+
|
|
573
376
|
<p align="center">
|
|
574
377
|
<a href="https://www.linkedin.com/in/adam-boudjemaa/"><img src="https://img.shields.io/badge/LinkedIn-0A66C2?style=flat-square&logo=linkedin&logoColor=white" alt="LinkedIn"></a>
|
|
575
378
|
<a href="https://x.com/AdamBoudj"><img src="https://img.shields.io/badge/X-000000?style=flat-square&logo=x&logoColor=white" alt="X"></a>
|
|
@@ -577,5 +380,5 @@ Easiest way in: **add a source rule.** Each rule is a regex pattern with a sever
|
|
|
577
380
|
</p>
|
|
578
381
|
|
|
579
382
|
<p align="center">
|
|
580
|
-
<sub>Built by <a href="https://github.com/Aboudjem">Adam Boudjemaa</a> · Apache 2.0
|
|
383
|
+
<sub>Built by <a href="https://github.com/Aboudjem">Adam Boudjemaa</a> · <a href="LICENSE">Apache 2.0</a></sub>
|
|
581
384
|
</p>
|
package/dist/cli/index.js
CHANGED
|
@@ -27,11 +27,23 @@ if (process.argv.includes("--mcp")) {
|
|
|
27
27
|
const program = new Command();
|
|
28
28
|
program.name("sniff").description("AI-powered QA testing framework").version("0.2.0");
|
|
29
29
|
program.argument("[target]", "Project directory to scan (default: current directory)").option("--url <url>", "Target URL \u2014 enables full audit (a11y, visual, perf, AI explorer)").option("--ci", "CI mode: headless, JUnit XML, flakiness tracking, no AI exploration").option("--no-browser", "Force source-only scan even if URL is configured").option("--no-explore", "Skip AI exploration (browser tests still run)").option("--max-steps <n>", "Cap AI exploration steps (default: 50)").option("--no-headless", "Show the browser window").option("--format <formats>", "Report formats: html, json, junit (comma-separated)").option("--fail-on <severities>", "Exit non-zero on these severities (default: critical,high)", "critical,high").option("--json", "Output results as JSON").option("--track-flakes", "Track test flakiness across runs").action(async (target, options) => {
|
|
30
|
-
const { unifiedCommand } = await import("../unified-
|
|
30
|
+
const { unifiedCommand } = await import("../unified-6CTLKH6X.js");
|
|
31
31
|
const { loadConfig } = await import("../loader-QII5CZSX.js");
|
|
32
32
|
const rootDir = target ? (await import("path")).resolve(target) : process.cwd();
|
|
33
33
|
const config = await loadConfig(rootDir);
|
|
34
|
-
|
|
34
|
+
let url = options.url ?? config.browser?.baseUrl;
|
|
35
|
+
if (!url && options.browser !== false) {
|
|
36
|
+
const { detectDevServerUrl } = await import("../dev-server-detector-NJ5RN4IC.js");
|
|
37
|
+
const detection = await detectDevServerUrl(rootDir);
|
|
38
|
+
if (detection.url) {
|
|
39
|
+
url = detection.url;
|
|
40
|
+
if (!options.json) {
|
|
41
|
+
const pc = (await import("picocolors")).default;
|
|
42
|
+
console.log(`${pc.green("[auto]")} Found dev server at ${pc.bold(url)} (${detection.detail})
|
|
43
|
+
`);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
35
47
|
const wantsBrowser = !!url && options.browser !== false;
|
|
36
48
|
const isCi = options.ci || !!process.env.CI;
|
|
37
49
|
const wantsExplore = wantsBrowser && options.explore !== false && !isCi;
|
|
@@ -60,7 +72,7 @@ if (process.argv.includes("--mcp")) {
|
|
|
60
72
|
await ciCommand(options);
|
|
61
73
|
});
|
|
62
74
|
program.command("report").description("View last scan results").option("--json", "Output as JSON").option("--format <formats>", "Regenerate report in specified formats (comma-separated: html,json,junit)").option("--output <dir>", "Output directory for regenerated reports").action(async (options) => {
|
|
63
|
-
const { reportCommand } = await import("../report-
|
|
75
|
+
const { reportCommand } = await import("../report-PRUX3BIS.js");
|
|
64
76
|
await reportCommand(options);
|
|
65
77
|
});
|
|
66
78
|
program.command("update-baselines").description("Update visual regression baselines").option("--yes", "Skip confirmation prompt").action(async (options) => {
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// MCP server mode bypasses CLI entirely\nif (process.argv.includes('--mcp')) {\n const { startMcpServer } = await import('../mcp/server.js');\n await startMcpServer();\n} else {\n const { Command } = await import('commander');\n\n async function ensurePlaywrightBrowsers(): Promise<void> {\n try {\n const { chromium } = await import('playwright');\n chromium.executablePath();\n } catch {\n const pc = (await import('picocolors')).default;\n console.log(pc.yellow('\\nPlaywright browsers not installed.'));\n console.log(pc.dim('Installing Chromium (required for browser testing)...\\n'));\n const { execSync } = await import('node:child_process');\n try {\n execSync('npx playwright install chromium', { stdio: 'inherit' });\n console.log('');\n } catch {\n console.error(pc.red('Failed to install Playwright browsers. Run manually: npx playwright install chromium'));\n process.exit(1);\n }\n }\n }\n\n const program = new Command();\n\n program\n .name('sniff')\n .description('AI-powered QA testing framework')\n .version('0.2.0');\n\n // ── Default command: unified scan ──────────────────────────────\n // `sniff` → source scan only\n // `sniff --url <url>` → everything (source + a11y + visual + perf + AI explore)\n // `sniff --url X --ci` → everything except exploration (deterministic for CI)\n program\n .argument('[target]', 'Project directory to scan (default: current directory)')\n .option('--url <url>', 'Target URL — enables full audit (a11y, visual, perf, AI explorer)')\n .option('--ci', 'CI mode: headless, JUnit XML, flakiness tracking, no AI exploration')\n .option('--no-browser', 'Force source-only scan even if URL is configured')\n .option('--no-explore', 'Skip AI exploration (browser tests still run)')\n .option('--max-steps <n>', 'Cap AI exploration steps (default: 50)')\n .option('--no-headless', 'Show the browser window')\n .option('--format <formats>', 'Report formats: html, json, junit (comma-separated)')\n .option('--fail-on <severities>', 'Exit non-zero on these severities (default: critical,high)', 'critical,high')\n .option('--json', 'Output results as JSON')\n .option('--track-flakes', 'Track test flakiness across runs')\n .action(async (target, options) => {\n const { unifiedCommand } = await import('./commands/unified.js');\n const { loadConfig } = await import('../config/loader.js');\n\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const config = await loadConfig(rootDir);\n\n // URL resolution: flag → config →
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// MCP server mode bypasses CLI entirely\nif (process.argv.includes('--mcp')) {\n const { startMcpServer } = await import('../mcp/server.js');\n await startMcpServer();\n} else {\n const { Command } = await import('commander');\n\n async function ensurePlaywrightBrowsers(): Promise<void> {\n try {\n const { chromium } = await import('playwright');\n chromium.executablePath();\n } catch {\n const pc = (await import('picocolors')).default;\n console.log(pc.yellow('\\nPlaywright browsers not installed.'));\n console.log(pc.dim('Installing Chromium (required for browser testing)...\\n'));\n const { execSync } = await import('node:child_process');\n try {\n execSync('npx playwright install chromium', { stdio: 'inherit' });\n console.log('');\n } catch {\n console.error(pc.red('Failed to install Playwright browsers. Run manually: npx playwright install chromium'));\n process.exit(1);\n }\n }\n }\n\n const program = new Command();\n\n program\n .name('sniff')\n .description('AI-powered QA testing framework')\n .version('0.2.0');\n\n // ── Default command: unified scan ──────────────────────────────\n // `sniff` → source scan only\n // `sniff --url <url>` → everything (source + a11y + visual + perf + AI explore)\n // `sniff --url X --ci` → everything except exploration (deterministic for CI)\n program\n .argument('[target]', 'Project directory to scan (default: current directory)')\n .option('--url <url>', 'Target URL — enables full audit (a11y, visual, perf, AI explorer)')\n .option('--ci', 'CI mode: headless, JUnit XML, flakiness tracking, no AI exploration')\n .option('--no-browser', 'Force source-only scan even if URL is configured')\n .option('--no-explore', 'Skip AI exploration (browser tests still run)')\n .option('--max-steps <n>', 'Cap AI exploration steps (default: 50)')\n .option('--no-headless', 'Show the browser window')\n .option('--format <formats>', 'Report formats: html, json, junit (comma-separated)')\n .option('--fail-on <severities>', 'Exit non-zero on these severities (default: critical,high)', 'critical,high')\n .option('--json', 'Output results as JSON')\n .option('--track-flakes', 'Track test flakiness across runs')\n .action(async (target, options) => {\n const { unifiedCommand } = await import('./commands/unified.js');\n const { loadConfig } = await import('../config/loader.js');\n\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const config = await loadConfig(rootDir);\n\n // URL resolution: flag → config → auto-detect\n let url = options.url ?? config.browser?.baseUrl;\n\n if (!url && options.browser !== false) {\n const { detectDevServerUrl } = await import('../config/dev-server-detector.js');\n const detection = await detectDevServerUrl(rootDir);\n if (detection.url) {\n url = detection.url;\n if (!options.json) {\n const pc = (await import('picocolors')).default;\n console.log(`${pc.green('[auto]')} Found dev server at ${pc.bold(url)} (${detection.detail})\\n`);\n }\n }\n }\n\n const wantsBrowser = !!url && options.browser !== false;\n\n // Exploration is default-ON when browser tests run, default-OFF in CI\n const isCi = options.ci || !!process.env.CI;\n const wantsExplore = wantsBrowser && options.explore !== false && !isCi;\n\n if (wantsBrowser) {\n await ensurePlaywrightBrowsers();\n }\n\n await unifiedCommand({\n rootDir,\n url: wantsBrowser ? url : undefined,\n explore: wantsExplore,\n maxSteps: options.maxSteps,\n headless: options.headless,\n format: options.format,\n failOn: options.failOn,\n json: options.json,\n ci: options.ci,\n trackFlakes: options.trackFlakes,\n });\n });\n\n // ── Utility commands ───────────────────────────────────────────\n\n program\n .command('init')\n .description('Generate a sniff config file')\n .option('--force', 'Overwrite existing config')\n .action(async (options) => {\n const { initCommand } = await import('./commands/init.js');\n await initCommand(options);\n });\n\n program\n .command('ci')\n .description('Generate a GitHub Actions workflow')\n .option('--output <path>', 'Output path for workflow file', '.github/workflows/sniff.yml')\n .option('--force', 'Overwrite existing workflow file')\n .option('--package-name <name>', 'npm package name for npx command', 'sniff-qa')\n .action(async (options) => {\n const { ciCommand } = await import('./commands/ci.js');\n await ciCommand(options);\n });\n\n program\n .command('report')\n .description('View last scan results')\n .option('--json', 'Output as JSON')\n .option('--format <formats>', 'Regenerate report in specified formats (comma-separated: html,json,junit)')\n .option('--output <dir>', 'Output directory for regenerated reports')\n .action(async (options) => {\n const { reportCommand } = await import('./commands/report.js');\n await reportCommand(options);\n });\n\n program\n .command('update-baselines')\n .description('Update visual regression baselines')\n .option('--yes', 'Skip confirmation prompt')\n .action(async (options) => {\n const { updateBaselinesCommand } = await import('./commands/update-baselines.js');\n await updateBaselinesCommand(options);\n });\n\n await program.parseAsync();\n}\n"],"mappings":";;;AAGA,IAAI,QAAQ,KAAK,SAAS,OAAO,GAAG;AAClC,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,kBAAkB;AAC1D,QAAM,eAAe;AACvB,OAAO;AACL,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,WAAW;AAE5C,iBAAe,2BAA0C;AACvD,QAAI;AACF,YAAM,EAAE,SAAS,IAAI,MAAM,OAAO,YAAY;AAC9C,eAAS,eAAe;AAAA,IAC1B,QAAQ;AACN,YAAM,MAAM,MAAM,OAAO,YAAY,GAAG;AACxC,cAAQ,IAAI,GAAG,OAAO,sCAAsC,CAAC;AAC7D,cAAQ,IAAI,GAAG,IAAI,yDAAyD,CAAC;AAC7E,YAAM,EAAE,SAAS,IAAI,MAAM,OAAO,eAAoB;AACtD,UAAI;AACF,iBAAS,mCAAmC,EAAE,OAAO,UAAU,CAAC;AAChE,gBAAQ,IAAI,EAAE;AAAA,MAChB,QAAQ;AACN,gBAAQ,MAAM,GAAG,IAAI,sFAAsF,CAAC;AAC5G,gBAAQ,KAAK,CAAC;AAAA,MAChB;AAAA,I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I,MAAM,OAAO,iCAAgC;AAChF,UAAM,uBAAuB,OAAO;AAAA,EACtC,CAAC;AAEH,QAAM,QAAQ,WAAW;AAC3B;","names":[]}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
// src/config/dev-server-detector.ts
|
|
2
|
+
import { readFile } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
var FRAMEWORK_PORTS = {
|
|
5
|
+
nextjs: [3e3, 3001],
|
|
6
|
+
vite: [5173, 5174],
|
|
7
|
+
svelte: [5173, 5174],
|
|
8
|
+
vue: [5173, 5174, 8080],
|
|
9
|
+
react: [3e3, 5173],
|
|
10
|
+
angular: [4200],
|
|
11
|
+
astro: [4321],
|
|
12
|
+
remix: [3e3],
|
|
13
|
+
nuxt: [3e3]
|
|
14
|
+
};
|
|
15
|
+
var DEV_SCRIPT_PATTERNS = [
|
|
16
|
+
{ pattern: /\bnext\s+dev\b/, ports: [3e3] },
|
|
17
|
+
{ pattern: /\bvite\b/, ports: [5173] },
|
|
18
|
+
{ pattern: /\bsvelte-kit\s+dev\b/, ports: [5173] },
|
|
19
|
+
{ pattern: /\bnuxi?\s+dev\b/, ports: [3e3] },
|
|
20
|
+
{ pattern: /\bastro\s+dev\b/, ports: [4321] },
|
|
21
|
+
{ pattern: /\bremix\s+dev\b/, ports: [3e3] },
|
|
22
|
+
{ pattern: /\bng\s+serve\b/, ports: [4200] },
|
|
23
|
+
{ pattern: /\bwebpack\s+serve\b/, ports: [8080] },
|
|
24
|
+
{ pattern: /\bparcel\b/, ports: [1234] },
|
|
25
|
+
// Explicit port flags in scripts
|
|
26
|
+
{ pattern: /-p\s+(\d+)/, ports: [] },
|
|
27
|
+
// captured dynamically
|
|
28
|
+
{ pattern: /--port[= ](\d+)/, ports: [] },
|
|
29
|
+
{ pattern: /PORT=(\d+)/, ports: [] }
|
|
30
|
+
];
|
|
31
|
+
var COMMON_PORTS = [3e3, 5173, 8080, 4200, 8e3, 5e3, 4321, 1234];
|
|
32
|
+
async function parseDevScript(rootDir) {
|
|
33
|
+
try {
|
|
34
|
+
const pkg = JSON.parse(await readFile(join(rootDir, "package.json"), "utf-8"));
|
|
35
|
+
const scripts = pkg.scripts ?? {};
|
|
36
|
+
const scriptNames = ["dev", "start", "serve", "dev:local", "start:dev"];
|
|
37
|
+
for (const name of scriptNames) {
|
|
38
|
+
const cmd = scripts[name];
|
|
39
|
+
if (!cmd || typeof cmd !== "string") continue;
|
|
40
|
+
const portMatch = cmd.match(/(?:-p|--port[= ]|PORT=)\s*(\d+)/);
|
|
41
|
+
if (portMatch) {
|
|
42
|
+
return {
|
|
43
|
+
script: name,
|
|
44
|
+
command: cmd,
|
|
45
|
+
ports: [parseInt(portMatch[1], 10)]
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
for (const { pattern, ports } of DEV_SCRIPT_PATTERNS) {
|
|
49
|
+
if (pattern.test(cmd)) {
|
|
50
|
+
return { script: name, command: cmd, ports };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
55
|
+
const detectedPorts = [];
|
|
56
|
+
for (const [fw, ports] of Object.entries(FRAMEWORK_PORTS)) {
|
|
57
|
+
const depName = fw === "nextjs" ? "next" : fw === "vue" ? "vue" : fw;
|
|
58
|
+
if (allDeps[depName]) {
|
|
59
|
+
detectedPorts.push(...ports);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (detectedPorts.length > 0) {
|
|
63
|
+
return { ports: [...new Set(detectedPorts)] };
|
|
64
|
+
}
|
|
65
|
+
return { ports: [] };
|
|
66
|
+
} catch {
|
|
67
|
+
return { ports: [] };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function isPortAlive(port, hostname = "localhost") {
|
|
71
|
+
const url = `http://${hostname}:${port}`;
|
|
72
|
+
try {
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timer = setTimeout(() => controller.abort(), 1500);
|
|
75
|
+
const response = await fetch(url, {
|
|
76
|
+
method: "HEAD",
|
|
77
|
+
signal: controller.signal,
|
|
78
|
+
redirect: "follow"
|
|
79
|
+
});
|
|
80
|
+
clearTimeout(timer);
|
|
81
|
+
return response.ok || response.status < 500;
|
|
82
|
+
} catch {
|
|
83
|
+
try {
|
|
84
|
+
const controller = new AbortController();
|
|
85
|
+
const timer = setTimeout(() => controller.abort(), 1500);
|
|
86
|
+
const response = await fetch(url, {
|
|
87
|
+
method: "GET",
|
|
88
|
+
signal: controller.signal,
|
|
89
|
+
redirect: "follow"
|
|
90
|
+
});
|
|
91
|
+
clearTimeout(timer);
|
|
92
|
+
return response.ok || response.status < 500;
|
|
93
|
+
} catch {
|
|
94
|
+
return false;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
async function detectDevServerUrl(rootDir) {
|
|
99
|
+
if (process.env.SNIFF_URL) {
|
|
100
|
+
return { url: process.env.SNIFF_URL, method: "env", detail: "SNIFF_URL" };
|
|
101
|
+
}
|
|
102
|
+
if (process.env.PORT) {
|
|
103
|
+
const port = parseInt(process.env.PORT, 10);
|
|
104
|
+
if (!isNaN(port)) {
|
|
105
|
+
const alive = await isPortAlive(port);
|
|
106
|
+
if (alive) {
|
|
107
|
+
return { url: `http://localhost:${port}`, method: "env", detail: `PORT=${port}` };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const devInfo = await parseDevScript(rootDir);
|
|
112
|
+
if (devInfo.ports.length > 0) {
|
|
113
|
+
for (const port of devInfo.ports) {
|
|
114
|
+
if (await isPortAlive(port)) {
|
|
115
|
+
const detail = devInfo.script ? `npm run ${devInfo.script} (port ${port})` : `framework default (port ${port})`;
|
|
116
|
+
return {
|
|
117
|
+
url: `http://localhost:${port}`,
|
|
118
|
+
method: devInfo.script ? "script" : "framework",
|
|
119
|
+
detail
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
for (const port of COMMON_PORTS) {
|
|
125
|
+
if (await isPortAlive(port)) {
|
|
126
|
+
return {
|
|
127
|
+
url: `http://localhost:${port}`,
|
|
128
|
+
method: "probe",
|
|
129
|
+
detail: `found server on port ${port}`
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
return { url: void 0, method: "none" };
|
|
134
|
+
}
|
|
135
|
+
async function getDevCommand(rootDir) {
|
|
136
|
+
try {
|
|
137
|
+
const pkg = JSON.parse(await readFile(join(rootDir, "package.json"), "utf-8"));
|
|
138
|
+
const scripts = pkg.scripts ?? {};
|
|
139
|
+
for (const name of ["dev", "start", "serve"]) {
|
|
140
|
+
if (scripts[name]) return `npm run ${name}`;
|
|
141
|
+
}
|
|
142
|
+
} catch {
|
|
143
|
+
}
|
|
144
|
+
return void 0;
|
|
145
|
+
}
|
|
146
|
+
export {
|
|
147
|
+
detectDevServerUrl,
|
|
148
|
+
getDevCommand
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=dev-server-detector-NJ5RN4IC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config/dev-server-detector.ts"],"sourcesContent":["import { readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\n// ---------------------------------------------------------------------------\n// Framework-to-port mappings\n// ---------------------------------------------------------------------------\n\nconst FRAMEWORK_PORTS: Record<string, number[]> = {\n nextjs: [3000, 3001],\n vite: [5173, 5174],\n svelte: [5173, 5174],\n vue: [5173, 5174, 8080],\n react: [3000, 5173],\n angular: [4200],\n astro: [4321],\n remix: [3000],\n nuxt: [3000],\n};\n\n// Dev script patterns that indicate a dev server\nconst DEV_SCRIPT_PATTERNS: Array<{ pattern: RegExp; ports: number[] }> = [\n { pattern: /\\bnext\\s+dev\\b/, ports: [3000] },\n { pattern: /\\bvite\\b/, ports: [5173] },\n { pattern: /\\bsvelte-kit\\s+dev\\b/, ports: [5173] },\n { pattern: /\\bnuxi?\\s+dev\\b/, ports: [3000] },\n { pattern: /\\bastro\\s+dev\\b/, ports: [4321] },\n { pattern: /\\bremix\\s+dev\\b/, ports: [3000] },\n { pattern: /\\bng\\s+serve\\b/, ports: [4200] },\n { pattern: /\\bwebpack\\s+serve\\b/, ports: [8080] },\n { pattern: /\\bparcel\\b/, ports: [1234] },\n // Explicit port flags in scripts\n { pattern: /-p\\s+(\\d+)/, ports: [] }, // captured dynamically\n { pattern: /--port[= ](\\d+)/, ports: [] },\n { pattern: /PORT=(\\d+)/, ports: [] },\n];\n\n// Common ports to try as last resort\nconst COMMON_PORTS = [3000, 5173, 8080, 4200, 8000, 5000, 4321, 1234];\n\n// ---------------------------------------------------------------------------\n// Package.json script parsing\n// ---------------------------------------------------------------------------\n\ninterface DetectedDevInfo {\n script?: string;\n command?: string;\n ports: number[];\n}\n\nasync function parseDevScript(rootDir: string): Promise<DetectedDevInfo> {\n try {\n const pkg = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf-8'));\n const scripts = pkg.scripts ?? {};\n\n // Try these script names in order\n const scriptNames = ['dev', 'start', 'serve', 'dev:local', 'start:dev'];\n\n for (const name of scriptNames) {\n const cmd = scripts[name];\n if (!cmd || typeof cmd !== 'string') continue;\n\n // Check for explicit port in script\n const portMatch = cmd.match(/(?:-p|--port[= ]|PORT=)\\s*(\\d+)/);\n if (portMatch) {\n return {\n script: name,\n command: cmd,\n ports: [parseInt(portMatch[1], 10)],\n };\n }\n\n // Match against known dev server patterns\n for (const { pattern, ports } of DEV_SCRIPT_PATTERNS) {\n if (pattern.test(cmd)) {\n return { script: name, command: cmd, ports };\n }\n }\n }\n\n // Check dependencies for framework hints\n const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };\n const detectedPorts: number[] = [];\n\n for (const [fw, ports] of Object.entries(FRAMEWORK_PORTS)) {\n const depName = fw === 'nextjs' ? 'next' : fw === 'vue' ? 'vue' : fw;\n if (allDeps[depName]) {\n detectedPorts.push(...ports);\n }\n }\n\n if (detectedPorts.length > 0) {\n return { ports: [...new Set(detectedPorts)] };\n }\n\n return { ports: [] };\n } catch {\n return { ports: [] };\n }\n}\n\n// ---------------------------------------------------------------------------\n// Port health check\n// ---------------------------------------------------------------------------\n\nasync function isPortAlive(port: number, hostname = 'localhost'): Promise<boolean> {\n const url = `http://${hostname}:${port}`;\n try {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), 1500);\n\n const response = await fetch(url, {\n method: 'HEAD',\n signal: controller.signal,\n redirect: 'follow',\n });\n\n clearTimeout(timer);\n return response.ok || response.status < 500;\n } catch {\n // HEAD might fail, try GET\n try {\n const controller = new AbortController();\n const timer = setTimeout(() => controller.abort(), 1500);\n\n const response = await fetch(url, {\n method: 'GET',\n signal: controller.signal,\n redirect: 'follow',\n });\n\n clearTimeout(timer);\n return response.ok || response.status < 500;\n } catch {\n return false;\n }\n }\n}\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\nexport interface DetectionResult {\n url: string | undefined;\n method: 'config' | 'env' | 'script' | 'framework' | 'probe' | 'none';\n detail?: string;\n}\n\n/**\n * Auto-detect the dev server URL by checking (in order):\n * 1. SNIFF_URL or PORT environment variables\n * 2. package.json scripts (dev, start, serve)\n * 3. Framework-default ports\n * 4. Common port probing\n */\nexport async function detectDevServerUrl(rootDir: string): Promise<DetectionResult> {\n // 1. Environment variables\n if (process.env.SNIFF_URL) {\n return { url: process.env.SNIFF_URL, method: 'env', detail: 'SNIFF_URL' };\n }\n\n if (process.env.PORT) {\n const port = parseInt(process.env.PORT, 10);\n if (!isNaN(port)) {\n const alive = await isPortAlive(port);\n if (alive) {\n return { url: `http://localhost:${port}`, method: 'env', detail: `PORT=${port}` };\n }\n }\n }\n\n // 2. Parse package.json scripts\n const devInfo = await parseDevScript(rootDir);\n\n // Try script-detected ports first\n if (devInfo.ports.length > 0) {\n for (const port of devInfo.ports) {\n if (await isPortAlive(port)) {\n const detail = devInfo.script\n ? `npm run ${devInfo.script} (port ${port})`\n : `framework default (port ${port})`;\n return {\n url: `http://localhost:${port}`,\n method: devInfo.script ? 'script' : 'framework',\n detail,\n };\n }\n }\n }\n\n // 3. Probe common ports\n for (const port of COMMON_PORTS) {\n if (await isPortAlive(port)) {\n return {\n url: `http://localhost:${port}`,\n method: 'probe',\n detail: `found server on port ${port}`,\n };\n }\n }\n\n // 4. Nothing found\n return { url: undefined, method: 'none' };\n}\n\n/**\n * Get the dev start command from package.json (for suggesting to user).\n */\nexport async function getDevCommand(rootDir: string): Promise<string | undefined> {\n try {\n const pkg = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf-8'));\n const scripts = pkg.scripts ?? {};\n\n for (const name of ['dev', 'start', 'serve']) {\n if (scripts[name]) return `npm run ${name}`;\n }\n } catch {\n // no package.json\n }\n return undefined;\n}\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,YAAY;AAMrB,IAAM,kBAA4C;AAAA,EAChD,QAAQ,CAAC,KAAM,IAAI;AAAA,EACnB,MAAM,CAAC,MAAM,IAAI;AAAA,EACjB,QAAQ,CAAC,MAAM,IAAI;AAAA,EACnB,KAAK,CAAC,MAAM,MAAM,IAAI;AAAA,EACtB,OAAO,CAAC,KAAM,IAAI;AAAA,EAClB,SAAS,CAAC,IAAI;AAAA,EACd,OAAO,CAAC,IAAI;AAAA,EACZ,OAAO,CAAC,GAAI;AAAA,EACZ,MAAM,CAAC,GAAI;AACb;AAGA,IAAM,sBAAmE;AAAA,EACvE,EAAE,SAAS,kBAAkB,OAAO,CAAC,GAAI,EAAE;AAAA,EAC3C,EAAE,SAAS,YAAY,OAAO,CAAC,IAAI,EAAE;AAAA,EACrC,EAAE,SAAS,wBAAwB,OAAO,CAAC,IAAI,EAAE;AAAA,EACjD,EAAE,SAAS,mBAAmB,OAAO,CAAC,GAAI,EAAE;AAAA,EAC5C,EAAE,SAAS,mBAAmB,OAAO,CAAC,IAAI,EAAE;AAAA,EAC5C,EAAE,SAAS,mBAAmB,OAAO,CAAC,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,11 +133,11 @@ async function handleSniffReport(rootDir, format) {
|
|
|
133
133
|
async function startMcpServer() {
|
|
134
134
|
const server = new McpServer({
|
|
135
135
|
name: "sniff",
|
|
136
|
-
version: "0.
|
|
136
|
+
version: "0.2.0"
|
|
137
137
|
});
|
|
138
138
|
server.tool(
|
|
139
139
|
"sniff_scan",
|
|
140
|
-
"
|
|
140
|
+
"Scan project source code for bugs. Finds debug statements, placeholder text, dead links, broken imports, hardcoded URLs, and API endpoint issues (missing validation, auth, error handling, secrets). Works offline, no browser or API key needed. Just pass the project path.",
|
|
141
141
|
{
|
|
142
142
|
rootDir: z.string().describe("Absolute path to the project root directory")
|
|
143
143
|
},
|
|
@@ -145,17 +145,28 @@ async function startMcpServer() {
|
|
|
145
145
|
);
|
|
146
146
|
server.tool(
|
|
147
147
|
"sniff_run",
|
|
148
|
-
"Run
|
|
148
|
+
"Run a full quality audit: source scan + browser checks (accessibility, visual regression, performance). The URL is optional -- sniff auto-detects running dev servers. If no server is found, runs source scan only. No API key needed.",
|
|
149
149
|
{
|
|
150
150
|
rootDir: z.string().describe("Absolute path to the project root directory"),
|
|
151
|
-
baseUrl: z.string().describe("
|
|
151
|
+
baseUrl: z.string().optional().describe("URL of the running app. Optional -- sniff auto-detects localhost servers if omitted."),
|
|
152
152
|
headless: z.boolean().default(true).describe("Run browser in headless mode")
|
|
153
153
|
},
|
|
154
|
-
async ({ rootDir, baseUrl, headless }) =>
|
|
154
|
+
async ({ rootDir, baseUrl, headless }) => {
|
|
155
|
+
let url = baseUrl;
|
|
156
|
+
if (!url) {
|
|
157
|
+
const { detectDevServerUrl } = await import("../dev-server-detector-NJ5RN4IC.js");
|
|
158
|
+
const detection = await detectDevServerUrl(rootDir);
|
|
159
|
+
url = detection.url;
|
|
160
|
+
}
|
|
161
|
+
if (url) {
|
|
162
|
+
return handleSniffRun(rootDir, url, headless);
|
|
163
|
+
}
|
|
164
|
+
return handleSniffScan(rootDir);
|
|
165
|
+
}
|
|
155
166
|
);
|
|
156
167
|
server.tool(
|
|
157
168
|
"sniff_report",
|
|
158
|
-
"
|
|
169
|
+
"Get the results from the most recent sniff scan. Returns findings, severities, and fix suggestions.",
|
|
159
170
|
{
|
|
160
171
|
rootDir: z.string().describe("Absolute path to the project root directory"),
|
|
161
172
|
format: z.enum(["json", "summary"]).default("summary").describe("Output format: full JSON or text summary")
|
package/dist/mcp/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/mcp/server.ts","../../src/mcp/handlers.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\nimport { handleSniffScan, handleSniffRun, handleSniffReport } from './handlers.js';\n\nexport async function startMcpServer(): Promise<void> {\n const server = new McpServer({\n name: 'sniff',\n version: '0.1.0',\n });\n\n // Tool: sniff_scan -- static source analysis\n server.tool(\n 'sniff_scan',\n 'Run static source code analysis on a project and return findings (placeholder text, TODOs, hardcoded strings, broken links)',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n },\n async ({ rootDir }) => handleSniffScan(rootDir),\n );\n\n // Tool: sniff_run -- browser E2E + quality scan\n server.tool(\n 'sniff_run',\n 'Run browser-based E2E quality scan (accessibility, visual regression, performance) against a live URL',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n baseUrl: z.string().describe('Base URL of the running application (e.g., http://localhost:3000)'),\n headless: z.boolean().default(true).describe('Run browser in headless mode'),\n },\n async ({ rootDir, baseUrl, headless }) => handleSniffRun(rootDir, baseUrl, headless),\n );\n\n // Tool: sniff_report -- load last results\n server.tool(\n 'sniff_report',\n 'Load the most recent sniff scan results and return a formatted summary',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n format: z.enum(['json', 'summary']).default('summary').describe('Output format: full JSON or text summary'),\n },\n async ({ rootDir, format }) => handleSniffReport(rootDir, format),\n );\n\n // Connect via stdio transport\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n","import { resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { Finding, BrowserFinding } from '../core/types.js';\n\nexport interface McpToolResult {\n [key: string]: unknown;\n content: Array<{ type: 'text'; text: string }>;\n}\n\n/**\n * Validate rootDir is absolute and exists on disk (T-04-15 mitigation).\n */\nfunction validateRootDir(rootDir: string): string | null {\n const resolved = resolve(rootDir);\n if (resolved !== rootDir) {\n return `rootDir must be an absolute path, got: ${rootDir}`;\n }\n if (!existsSync(resolved)) {\n return `rootDir does not exist: ${resolved}`;\n }\n return null;\n}\n\n/**\n * Validate baseUrl is a valid http/https URL (T-04-16 mitigation).\n */\nfunction validateBaseUrl(baseUrl: string): string | null {\n try {\n const parsed = new URL(baseUrl);\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n return `baseUrl must use http or https scheme, got: ${parsed.protocol}`;\n }\n return null;\n } catch {\n return `Invalid URL: ${baseUrl}`;\n }\n}\n\nexport async function handleSniffScan(rootDir: string): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const { loadConfig } = await import('../config/loader.js');\n const { ScannerRegistry } = await import('../scanners/registry.js');\n const { SourceScanner } = await import('../scanners/source/index.js');\n\n const config = await loadConfig(rootDir);\n const registry = new ScannerRegistry();\n registry.register(new SourceScanner());\n\n const results = await registry.runAll({ config, rootDir });\n return {\n content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],\n };\n}\n\nexport async function handleSniffRun(\n rootDir: string,\n baseUrl: string,\n headless: boolean,\n): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const urlErr = validateBaseUrl(baseUrl);\n if (urlErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: urlErr }) }] };\n }\n\n const { loadConfig } = await import('../config/loader.js');\n const { BrowserRunner } = await import('../browser/runner.js');\n const { AccessibilityScanner } = await import('../scanners/accessibility/index.js');\n const { VisualRegressionScanner } = await import('../scanners/visual/index.js');\n const { PerformanceScanner } = await import('../scanners/performance/index.js');\n\n const config = await loadConfig(rootDir);\n\n const runner = new BrowserRunner(config);\n runner.registerScanner(new AccessibilityScanner());\n runner.registerScanner(new VisualRegressionScanner());\n runner.registerScanner(new PerformanceScanner());\n\n const result = await runner.run({\n baseUrl,\n testFiles: ['/'],\n viewports: config.viewports ?? [{ name: 'desktop', width: 1280, height: 720 }],\n headless,\n slowMo: 0,\n timeout: config.browser?.timeout ?? 30000,\n });\n\n // Type both groups explicitly to avoid Finding vs BrowserFinding incompatibility\n const allFindings: Array<Finding | BrowserFinding> = [\n ...result.scanResults.flatMap((r) => r.findings),\n ...result.pageVisits.flatMap((v) => v.findings),\n ];\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(\n {\n findings: allFindings,\n urls: result.urls,\n duration: result.duration,\n findingCount: allFindings.length,\n },\n null,\n 2,\n ),\n },\n ],\n };\n}\n\nexport async function handleSniffReport(\n rootDir: string,\n format: 'json' | 'summary',\n): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const { loadLastResults } = await import('../core/persistence.js');\n const results = await loadLastResults(rootDir);\n\n if (!results) {\n return {\n content: [\n {\n type: 'text',\n text: 'No previous sniff results found. Run sniff_scan or sniff_run first.',\n },\n ],\n };\n }\n\n if (format === 'json') {\n return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }] };\n }\n\n // Summary format\n const totalFindings = results.results.reduce((sum, r) => sum + r.findings.length, 0);\n const bySeverity: Record<string, number> = {};\n for (const r of results.results) {\n for (const f of r.findings) {\n bySeverity[f.severity] = (bySeverity[f.severity] ?? 0) + 1;\n }\n }\n const scanners = results.results.map((r) => r.scanner).join(', ');\n const summary = [\n `Sniff Results (${results.timestamp})`,\n `Scanners: ${scanners}`,\n `Total findings: ${totalFindings}`,\n ...Object.entries(bySeverity).map(([sev, count]) => ` ${sev}: ${count}`),\n ].join('\\n');\n\n return { content: [{ type: 'text', text: summary }] };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;;;ACFlB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAW3B,SAAS,gBAAgB,SAAgC;AACvD,QAAM,WAAW,QAAQ,OAAO;AAChC,MAAI,aAAa,SAAS;AACxB,WAAO,0CAA0C,OAAO;AAAA,EAC1D;AACA,MAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,WAAO,2BAA2B,QAAQ;AAAA,EAC5C;AACA,SAAO;AACT;AAKA,SAAS,gBAAgB,SAAgC;AACvD,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,OAAO;AAC9B,QAAI,OAAO,aAAa,WAAW,OAAO,aAAa,UAAU;AAC/D,aAAO,+CAA+C,OAAO,QAAQ;AAAA,IACvE;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,gBAAgB,OAAO;AAAA,EAChC;AACF;AAEA,eAAsB,gBAAgB,SAAyC;AAC7E,QAAM,UAAU,gBAAgB,OAAO;AACvC,MAAI,SAAS;AACX,WAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,EAAE,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE;AAAA,EACjF;AAEA,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,uBAAqB;AACzD,QAAM,EAAE,gBAAgB,IAAI,MAAM,OAAO,yBAAyB;AAClE,QAAM,EAAE,cAAc,IAAI,MAAM,OAAO,uBAA6B;AAEpE,QAAM,SAAS,MAAM,WAAW,OAAO;AACvC,QAAM,WAAW,IAAI,gBAAgB;AACrC,WAAS,SAAS,IAAI,cAAc,CAAC;AAErC,QAAM,UAAU,MAAM,SAAS,OAAO,EAAE,QAA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,OAAO,EAAE,SAAS,OAAO,MAAM,kBAAkB,SAAS,MAAM;AAAA,EAClE;AAGA,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/server.ts","../../src/mcp/handlers.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { z } from 'zod';\nimport { handleSniffScan, handleSniffRun, handleSniffReport } from './handlers.js';\n\nexport async function startMcpServer(): Promise<void> {\n const server = new McpServer({\n name: 'sniff',\n version: '0.2.0',\n });\n\n // Tool: sniff_scan -- static source analysis (no browser needed)\n server.tool(\n 'sniff_scan',\n 'Scan project source code for bugs. Finds debug statements, placeholder text, dead links, broken imports, hardcoded URLs, and API endpoint issues (missing validation, auth, error handling, secrets). Works offline, no browser or API key needed. Just pass the project path.',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n },\n async ({ rootDir }) => handleSniffScan(rootDir),\n );\n\n // Tool: sniff_run -- full audit (source + browser, auto-detects URL)\n server.tool(\n 'sniff_run',\n 'Run a full quality audit: source scan + browser checks (accessibility, visual regression, performance). The URL is optional -- sniff auto-detects running dev servers. If no server is found, runs source scan only. No API key needed.',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n baseUrl: z.string().optional().describe('URL of the running app. Optional -- sniff auto-detects localhost servers if omitted.'),\n headless: z.boolean().default(true).describe('Run browser in headless mode'),\n },\n async ({ rootDir, baseUrl, headless }) => {\n // Auto-detect URL if not provided\n let url = baseUrl;\n if (!url) {\n const { detectDevServerUrl } = await import('../config/dev-server-detector.js');\n const detection = await detectDevServerUrl(rootDir);\n url = detection.url;\n }\n\n if (url) {\n return handleSniffRun(rootDir, url, headless);\n }\n\n // No server found -- fall back to source scan only\n return handleSniffScan(rootDir);\n },\n );\n\n // Tool: sniff_report -- load last results\n server.tool(\n 'sniff_report',\n 'Get the results from the most recent sniff scan. Returns findings, severities, and fix suggestions.',\n {\n rootDir: z.string().describe('Absolute path to the project root directory'),\n format: z.enum(['json', 'summary']).default('summary').describe('Output format: full JSON or text summary'),\n },\n async ({ rootDir, format }) => handleSniffReport(rootDir, format),\n );\n\n // Connect via stdio transport\n const transport = new StdioServerTransport();\n await server.connect(transport);\n}\n","import { resolve } from 'node:path';\nimport { existsSync } from 'node:fs';\nimport type { Finding, BrowserFinding } from '../core/types.js';\n\nexport interface McpToolResult {\n [key: string]: unknown;\n content: Array<{ type: 'text'; text: string }>;\n}\n\n/**\n * Validate rootDir is absolute and exists on disk (T-04-15 mitigation).\n */\nfunction validateRootDir(rootDir: string): string | null {\n const resolved = resolve(rootDir);\n if (resolved !== rootDir) {\n return `rootDir must be an absolute path, got: ${rootDir}`;\n }\n if (!existsSync(resolved)) {\n return `rootDir does not exist: ${resolved}`;\n }\n return null;\n}\n\n/**\n * Validate baseUrl is a valid http/https URL (T-04-16 mitigation).\n */\nfunction validateBaseUrl(baseUrl: string): string | null {\n try {\n const parsed = new URL(baseUrl);\n if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') {\n return `baseUrl must use http or https scheme, got: ${parsed.protocol}`;\n }\n return null;\n } catch {\n return `Invalid URL: ${baseUrl}`;\n }\n}\n\nexport async function handleSniffScan(rootDir: string): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const { loadConfig } = await import('../config/loader.js');\n const { ScannerRegistry } = await import('../scanners/registry.js');\n const { SourceScanner } = await import('../scanners/source/index.js');\n\n const config = await loadConfig(rootDir);\n const registry = new ScannerRegistry();\n registry.register(new SourceScanner());\n\n const results = await registry.runAll({ config, rootDir });\n return {\n content: [{ type: 'text', text: JSON.stringify(results, null, 2) }],\n };\n}\n\nexport async function handleSniffRun(\n rootDir: string,\n baseUrl: string,\n headless: boolean,\n): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const urlErr = validateBaseUrl(baseUrl);\n if (urlErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: urlErr }) }] };\n }\n\n const { loadConfig } = await import('../config/loader.js');\n const { BrowserRunner } = await import('../browser/runner.js');\n const { AccessibilityScanner } = await import('../scanners/accessibility/index.js');\n const { VisualRegressionScanner } = await import('../scanners/visual/index.js');\n const { PerformanceScanner } = await import('../scanners/performance/index.js');\n\n const config = await loadConfig(rootDir);\n\n const runner = new BrowserRunner(config);\n runner.registerScanner(new AccessibilityScanner());\n runner.registerScanner(new VisualRegressionScanner());\n runner.registerScanner(new PerformanceScanner());\n\n const result = await runner.run({\n baseUrl,\n testFiles: ['/'],\n viewports: config.viewports ?? [{ name: 'desktop', width: 1280, height: 720 }],\n headless,\n slowMo: 0,\n timeout: config.browser?.timeout ?? 30000,\n });\n\n // Type both groups explicitly to avoid Finding vs BrowserFinding incompatibility\n const allFindings: Array<Finding | BrowserFinding> = [\n ...result.scanResults.flatMap((r) => r.findings),\n ...result.pageVisits.flatMap((v) => v.findings),\n ];\n\n return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(\n {\n findings: allFindings,\n urls: result.urls,\n duration: result.duration,\n findingCount: allFindings.length,\n },\n null,\n 2,\n ),\n },\n ],\n };\n}\n\nexport async function handleSniffReport(\n rootDir: string,\n format: 'json' | 'summary',\n): Promise<McpToolResult> {\n const rootErr = validateRootDir(rootDir);\n if (rootErr) {\n return { content: [{ type: 'text', text: JSON.stringify({ error: rootErr }) }] };\n }\n\n const { loadLastResults } = await import('../core/persistence.js');\n const results = await loadLastResults(rootDir);\n\n if (!results) {\n return {\n content: [\n {\n type: 'text',\n text: 'No previous sniff results found. Run sniff_scan or sniff_run first.',\n },\n ],\n };\n }\n\n if (format === 'json') {\n return { content: [{ type: 'text', text: JSON.stringify(results, null, 2) }] };\n }\n\n // Summary format\n const totalFindings = results.results.reduce((sum, r) => sum + r.findings.length, 0);\n const bySeverity: Record<string, number> = {};\n for (const r of results.results) {\n for (const f of r.findings) {\n bySeverity[f.severity] = (bySeverity[f.severity] ?? 0) + 1;\n }\n }\n const scanners = results.results.map((r) => r.scanner).join(', ');\n const summary = [\n `Sniff Results (${results.timestamp})`,\n `Scanners: ${scanners}`,\n `Total findings: ${totalFindings}`,\n ...Object.entries(bySeverity).map(([sev, count]) => ` ${sev}: ${count}`),\n ].join('\\n');\n\n return { content: [{ type: 'text', text: summary }] };\n}\n"],"mappings":";AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,SAAS;;;ACFlB,SAAS,eAAe;AACxB,SAAS,kBAAkB;AAW3B,SAAS,gBAAgB,SAAgC;AACvD,QAAM,WAAW,QAAQ,OAAO;AAChC,MAAI,aAAa,SAAS;AACxB,WAAO,0CAA0C,OAAO;AAAA,EAC1D;AACA,MAAI,CAAC,WAAW,QAAQ,GAAG;AACzB,WAAO,2BAA2B,QAAQ;AAAA,EAC5C;AACA,SAAO;AACT;AAKA,SAAS,gBAAgB,SAAgC;AACvD,MAAI;AACF,UAAM,SAAS,IAAI,IAAI,OAAO;AAC9B,QAAI,OAAO,aAAa,WAAW,OAAO,aAAa,UAAU;AAC/D,aAAO,+CAA+C,OAAO,QAAQ;AAAA,IACvE;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO,gBAAgB,OAAO;AAAA,EAChC;AACF;AAEA,eAAsB,gBAAgB,SAAyC;AAC7E,QAAM,UAAU,gBAAgB,OAAO;AACvC,MAAI,SAAS;AACX,WAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAQ,MAAM,KAAK,UAAU,EAAE,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE;AAAA,EACjF;AAEA,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,uBAAqB;AACzD,QAAM,EAAE,gBAAgB,IAAI,MAAM,OAAO,yBAA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C,KAAK;AACR,cAAM,EAAE,mBAAmB,IAAI,MAAM,OAAO,oCAAkC;AAC9E,cAAM,YAAY,MAAM,mBAAmB,OAAO;AAClD,cAAM,UAAU;AAAA,MAClB;AAEA,UAAI,KAAK;AACP,eAAO,eAAe,SAAS,KAAK,QAAQ;AAAA,MAC9C;AAGA,aAAO,gBAAgB,OAAO;AAAA,IAChC;AAAA,EACF;AAGA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,SAAS,EAAE,OAAO,EAAE,SAAS,6CAA6C;AAAA,MAC1E,QAAQ,EAAE,KAAK,CAAC,QAAQ,SAAS,CAAC,EAAE,QAAQ,SAAS,EAAE,SAAS,0CAA0C;AAAA,IAC5G;AAAA,IACA,OAAO,EAAE,SAAS,OAAO,MAAM,kBAAkB,SAAS,MAAM;AAAA,EAClE;AAGA,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAChC;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sniff-qa",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "AI-powered QA testing tool. Source scanning, accessibility audits, visual regression, performance budgets, and AI exploration in one command. Uses Playwright, axe-core, and Lighthouse. Zero config.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
File without changes
|
|
File without changes
|