sniff-qa 0.2.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +51 -4
  2. package/dist/chunk-VEI2O6AK.js +34 -0
  3. package/dist/chunk-VEI2O6AK.js.map +1 -0
  4. package/dist/classifier-XEA6ZGE7.js +673 -0
  5. package/dist/classifier-XEA6ZGE7.js.map +1 -0
  6. package/dist/cli/index.js +132 -5
  7. package/dist/cli/index.js.map +1 -1
  8. package/dist/discover-BLUSO42Q.js +228 -0
  9. package/dist/discover-BLUSO42Q.js.map +1 -0
  10. package/dist/domain-UQ34YE4B.js +1817 -0
  11. package/dist/domain-UQ34YE4B.js.map +1 -0
  12. package/dist/edge-cases-ZADKDZHL.js +246 -0
  13. package/dist/edge-cases-ZADKDZHL.js.map +1 -0
  14. package/dist/fix-R33D34NP.js +110 -0
  15. package/dist/fix-R33D34NP.js.map +1 -0
  16. package/dist/flakiness-OLJAY7CS.js +53 -0
  17. package/dist/flakiness-OLJAY7CS.js.map +1 -0
  18. package/dist/llm-VJAI6H6G.js +126 -0
  19. package/dist/llm-VJAI6H6G.js.map +1 -0
  20. package/dist/mcp/server.js +95 -2
  21. package/dist/mcp/server.js.map +1 -1
  22. package/dist/{model-SRPWXU63.js → model-2DTSAX7T.js} +6 -6
  23. package/dist/model-2DTSAX7T.js.map +1 -0
  24. package/dist/persistence-KTCRIGHU.js +270 -0
  25. package/dist/persistence-KTCRIGHU.js.map +1 -0
  26. package/dist/report-SDZWX25B.js +280 -0
  27. package/dist/report-SDZWX25B.js.map +1 -0
  28. package/dist/{report-PRUX3BIS.js → report-STC6CAVJ.js} +2 -2
  29. package/dist/runner-OYTN2NFD.js +996 -0
  30. package/dist/runner-OYTN2NFD.js.map +1 -0
  31. package/dist/scenarios-25UAZY6F.js +982 -0
  32. package/dist/scenarios-25UAZY6F.js.map +1 -0
  33. package/dist/{source-D5KLH46F.js → source-4DOO224X.js} +3 -3
  34. package/dist/source-4DOO224X.js.map +1 -0
  35. package/dist/tiebreak-L5UFNKU2.js +60 -0
  36. package/dist/tiebreak-L5UFNKU2.js.map +1 -0
  37. package/dist/{unified-6CTLKH6X.js → unified-2PM442OY.js} +5 -4
  38. package/dist/unified-2PM442OY.js.map +1 -0
  39. package/dist/version-FLE7ZHDX.js +7 -0
  40. package/dist/version-FLE7ZHDX.js.map +1 -0
  41. package/package.json +1 -1
  42. package/dist/model-SRPWXU63.js.map +0 -1
  43. package/dist/source-D5KLH46F.js.map +0 -1
  44. package/dist/unified-6CTLKH6X.js.map +0 -1
  45. /package/dist/{report-PRUX3BIS.js.map → report-STC6CAVJ.js.map} +0 -0
package/README.md CHANGED
@@ -123,12 +123,13 @@ npm install -D sniff-qa
123
123
  ```json
124
124
  {
125
125
  "scripts": {
126
- "qa": "sniff",
127
- "qa:full": "sniff --url http://localhost:3000"
126
+ "qa": "sniff"
128
127
  }
129
128
  }
130
129
  ```
131
130
 
131
+ That's all you need. Sniff auto-detects your dev server when it's running.
132
+
132
133
  Requires Node.js 22+. Playwright installs automatically on first browser scan.
133
134
 
134
135
  ---
@@ -154,7 +155,7 @@ Sniff auto-detects your dev server by reading `package.json` scripts and probing
154
155
  <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
156
  </picture>
156
157
 
157
- **Source checks** run on every scan. **Browser checks** activate when you pass `--url`.
158
+ **Source checks** run on every scan. **Browser checks** run automatically when sniff detects a running dev server, or when you pass `--url`.
158
159
 
159
160
  ---
160
161
 
@@ -182,13 +183,20 @@ Sniff auto-detects your dev server by reading `package.json` scripts and probing
182
183
 
183
184
  ```
184
185
  sniff Scan source + auto-detect dev server
185
- sniff --url <url> Scan source + test live site
186
+ sniff --url <url> Scan source + test specific URL
186
187
  sniff --url <url> --ci Full audit for CI pipelines
187
188
  sniff <path> Scan a specific directory
189
+ sniff discover Autonomous E2E discovery (scenarios + edge cases)
190
+ sniff discover --regenerate-only Write sniff-scenarios/ tree without running
191
+ sniff fix Auto-fix safe issues (debugger, console.log)
192
+ sniff fix --check Dry run: show what would be fixed
188
193
  sniff init Create sniff.config.ts
189
194
  sniff ci Generate GitHub Actions workflow
190
195
  sniff report Show last scan results
191
196
  sniff update-baselines Accept current visual baselines
197
+ sniff doctor Check your environment (Node, Playwright, config, dev server)
198
+ sniff --help Show all commands and flags
199
+ sniff --version Show version
192
200
  ```
193
201
 
194
202
  <details>
@@ -331,6 +339,45 @@ Generates `.github/workflows/sniff.yml` with Playwright caching, JUnit output, a
331
339
 
332
340
  ---
333
341
 
342
+ ## Autonomous discovery
343
+
344
+ ```bash
345
+ sniff discover # run against the detected dev server
346
+ sniff discover --regenerate-only # write sniff-scenarios/ and exit (no run)
347
+ ```
348
+
349
+ `sniff discover` reads your source (Prisma, Drizzle, TypeORM, Zod, GraphQL, OpenAPI, TS types), classifies what the app is (ecommerce, booking, saas, social, content, crm, auth-only, marketing, admin), generates happy-path journeys with real personas, enumerates edge variants (invalid email, XSS, payment declined, empty cart, offline, and more), and drives everything through Playwright.
350
+
351
+ **What you get:**
352
+
353
+ - `sniff-scenarios/_generated/<app-type>/<journey>.<variant>.scenario.md` — reviewable scenarios with JSON frontmatter. Track them in git. Hand-edit them — sniff detects the change and asks before regenerating.
354
+ - `sniff-reports/discovery/` — HTML, JSON, and JUnit reports per run.
355
+ - Flakiness quarantine for scenarios that fail 3 of the last 5 runs.
356
+
357
+ **Flags:**
358
+
359
+ | Flag | What it does |
360
+ |:-----|:-------------|
361
+ | `--url <url>` | Target URL (default: auto-detect dev server) |
362
+ | `--max-scenarios <n>` | Cap total scenarios (default: 50) |
363
+ | `--max-variants-per-scenario <n>` | Cap edge variants per scenario (default: 3) |
364
+ | `--max-variants-per-run <n>` | Cap edge variants per run (default: 40) |
365
+ | `--realism <profile>` | `robot`, `careful-user`, `casual-user` (default), `frustrated-user`, `power-user` |
366
+ | `--seed <n>` | Replay a specific random seed |
367
+ | `--only <filter>` | Filter scenarios by id substring or app type |
368
+ | `--app-type <types>` | Force app types (comma-separated) |
369
+ | `--regenerate` | Regenerate `sniff-scenarios/` before running |
370
+ | `--regenerate-only` | Regenerate and exit (no browser) |
371
+ | `--force-regenerate` | Overwrite hand-edits without prompting |
372
+ | `--non-interactive` | Skip prompts and the production-URL countdown |
373
+ | `--no-llm` | Skip Claude Code CLI polish (deterministic only) |
374
+
375
+ **Production-URL safety:** when the target is not a local address, sniff prints a 5-second countdown banner before running. Hit Ctrl+C to cancel. No `--allow-destructive` flag.
376
+
377
+ **LLM polish (optional):** if the `claude` CLI is available, sniff uses it to break close-call app-type classifications. Responses are cached under `.sniff/discover/cache/`. Pass `--no-llm` to skip.
378
+
379
+ ---
380
+
334
381
  ## How it works
335
382
 
336
383
  <picture>
@@ -0,0 +1,34 @@
1
+ // src/version.ts
2
+ import { readFileSync } from "fs";
3
+ import { join, dirname } from "path";
4
+ import { fileURLToPath } from "url";
5
+ var _version = "";
6
+ function getVersion() {
7
+ if (_version) return _version;
8
+ try {
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const paths = [
11
+ join(__dirname, "..", "package.json"),
12
+ join(__dirname, "..", "..", "package.json")
13
+ ];
14
+ for (const p of paths) {
15
+ try {
16
+ const pkg = JSON.parse(readFileSync(p, "utf-8"));
17
+ if (pkg.version) {
18
+ _version = pkg.version;
19
+ return _version;
20
+ }
21
+ } catch {
22
+ continue;
23
+ }
24
+ }
25
+ } catch {
26
+ }
27
+ _version = "0.0.0";
28
+ return _version;
29
+ }
30
+
31
+ export {
32
+ getVersion
33
+ };
34
+ //# sourceMappingURL=chunk-VEI2O6AK.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/version.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\n/**\n * Single source of truth for the version string.\n * Reads from package.json at build time via the bundled constant,\n * or falls back to reading package.json at runtime.\n */\nlet _version = '';\n\nexport function getVersion(): string {\n if (_version) return _version;\n\n try {\n const __dirname = dirname(fileURLToPath(import.meta.url));\n const paths = [\n join(__dirname, '..', 'package.json'),\n join(__dirname, '..', '..', 'package.json'),\n ];\n\n for (const p of paths) {\n try {\n const pkg = JSON.parse(readFileSync(p, 'utf-8'));\n if (pkg.version) {\n _version = pkg.version as string;\n return _version;\n }\n } catch {\n continue;\n }\n }\n } catch {\n // fallback\n }\n\n _version = '0.0.0';\n return _version;\n}\n"],"mappings":";AAAA,SAAS,oBAAoB;AAC7B,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAO9B,IAAI,WAAW;AAER,SAAS,aAAqB;AACnC,MAAI,SAAU,QAAO;AAErB,MAAI;AACF,UAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AACxD,UAAM,QAAQ;AAAA,MACZ,KAAK,WAAW,MAAM,cAAc;AAAA,MACpC,KAAK,WAAW,MAAM,MAAM,cAAc;AAAA,IAC5C;AAEA,eAAW,KAAK,OAAO;AACrB,UAAI;AACF,cAAM,MAAM,KAAK,MAAM,aAAa,GAAG,OAAO,CAAC;AAC/C,YAAI,IAAI,SAAS;AACf,qBAAW,IAAI;AACf,iBAAO;AAAA,QACT;AAAA,MACF,QAAQ;AACN;AAAA,MACF;AAAA,IACF;AAAA,EACF,QAAQ;AAAA,EAER;AAEA,aAAW;AACX,SAAO;AACT;","names":[]}