sniff-qa 0.8.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/icon.png +0 -0
- package/.claude-plugin/plugin.json +9 -2
- package/CHANGELOG.md +34 -0
- package/README.md +144 -105
- package/dist/{anthropic-api-ZR3UEB3Z.js → anthropic-api-7PHYF6PN.js} +2 -2
- package/dist/{chunk-7ZOFYET5.js → chunk-64FUDSRY.js} +30 -13
- package/dist/chunk-64FUDSRY.js.map +1 -0
- package/dist/{chunk-CZKMOAXU.js → chunk-7BLJCICM.js} +2 -2
- package/dist/{chunk-EGANHIIE.js → chunk-T72SLMTY.js} +48 -5
- package/dist/chunk-T72SLMTY.js.map +1 -0
- package/dist/{claude-code-ZFTBQXY4.js → claude-code-GJPWO6DN.js} +2 -2
- package/dist/{claude-exploration-provider-QJH6IPYU.js → claude-exploration-provider-XOVJPJ23.js} +2 -2
- package/dist/claude-exploration-provider-XOVJPJ23.js.map +1 -0
- package/dist/cli/index.js +28 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/crawl-XPHT3KIZ.js +23 -0
- package/dist/{crawl-command-RDWGHZC4.js → crawl-command-JHZN4GK7.js} +10 -6
- package/dist/{crawl-command-RDWGHZC4.js.map → crawl-command-JHZN4GK7.js.map} +1 -1
- package/dist/{ensure-browsers-AYKMLUHV.js → ensure-browsers-5NAQQMEC.js} +29 -15
- package/dist/ensure-browsers-5NAQQMEC.js.map +1 -0
- package/dist/{formatter-HC3LT3VH.js → formatter-4VI3ZX5Y.js} +29 -6
- package/dist/formatter-4VI3ZX5Y.js.map +1 -0
- package/dist/generator-AFHVMWC3.js +7 -0
- package/dist/index.d.ts +15 -5
- package/dist/index.js +3 -3
- package/dist/mcp/server.js +22 -9
- package/dist/mcp/server.js.map +1 -1
- package/dist/{prompt-builder-D3FBH534.js → prompt-builder-JT3GQBYP.js} +2 -2
- package/dist/prompt-builder-JT3GQBYP.js.map +1 -0
- package/dist/{provider-BCKFVPTN.js → provider-MMQ6EIBV.js} +6 -6
- package/dist/{quality-run-YAURB242.js → quality-run-KJMBBAQT.js} +2 -2
- package/dist/{report-7FQFH4HW.js → report-XK2MCX2N.js} +3 -3
- package/dist/{unified-YSOTPG5B.js → unified-OEGLPOGE.js} +7 -7
- package/dist/{write-report-6RJWN54I.js → write-report-Y4UPVXUO.js} +2 -2
- package/package.json +6 -8
- package/dist/chunk-7ZOFYET5.js.map +0 -1
- package/dist/chunk-EGANHIIE.js.map +0 -1
- package/dist/claude-exploration-provider-QJH6IPYU.js.map +0 -1
- package/dist/crawl-ZXZRF4Q7.js +0 -15
- package/dist/ensure-browsers-AYKMLUHV.js.map +0 -1
- package/dist/formatter-HC3LT3VH.js.map +0 -1
- package/dist/generator-HIFV67NI.js +0 -7
- package/dist/prompt-builder-D3FBH534.js.map +0 -1
- /package/dist/{anthropic-api-ZR3UEB3Z.js.map → anthropic-api-7PHYF6PN.js.map} +0 -0
- /package/dist/{chunk-CZKMOAXU.js.map → chunk-7BLJCICM.js.map} +0 -0
- /package/dist/{claude-code-ZFTBQXY4.js.map → claude-code-GJPWO6DN.js.map} +0 -0
- /package/dist/{crawl-ZXZRF4Q7.js.map → crawl-XPHT3KIZ.js.map} +0 -0
- /package/dist/{generator-HIFV67NI.js.map → generator-AFHVMWC3.js.map} +0 -0
- /package/dist/{provider-BCKFVPTN.js.map → provider-MMQ6EIBV.js.map} +0 -0
- /package/dist/{quality-run-YAURB242.js.map → quality-run-KJMBBAQT.js.map} +0 -0
- /package/dist/{report-7FQFH4HW.js.map → report-XK2MCX2N.js.map} +0 -0
- /package/dist/{unified-YSOTPG5B.js.map → unified-OEGLPOGE.js.map} +0 -0
- /package/dist/{write-report-6RJWN54I.js.map → write-report-Y4UPVXUO.js.map} +0 -0
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 { parseCaps, CapsError } = await import('../mcp/caps.js');\n let caps;\n try {\n caps = parseCaps(process.argv);\n } catch (err) {\n // stdout is the MCP protocol channel, so a startup error goes to stderr.\n console.error(err instanceof CapsError ? err.message : String(err));\n process.exit(1);\n }\n const { startMcpServer } = await import('../mcp/server.js');\n await startMcpServer(caps);\n} else {\n const { Command } = await import('commander');\n\n const { ensurePlaywrightBrowsers } = await import('../core/ensure-browsers.js');\n\n const { getVersion } = await import('../version.js');\n\n const program = new Command();\n\n program\n .name('sniff')\n .description('AI-powered QA testing framework')\n .version(getVersion());\n\n // ── Default command: unified scan ──────────────────────────────\n // `sniff` → source scan + auto-detect dev server\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 browser audit (a11y, visual, perf, runtime hooks)')\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('--explore', 'Run optional AI exploration after browser checks', false)\n .option('--no-explore', 'Skip AI exploration (kept for compatibility; exploration is off by default)')\n .option('--max-steps <n>', 'Cap AI exploration steps when --explore is used (default: 50)')\n .option('--headed', 'Show the browser window (alias for --no-headless)')\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('--report', 'Write a self-contained HTML report to sniff-reports/sniff-report.html')\n .option('--all', 'Show low-confidence findings too (hidden by default)')\n .option('--max-pages <n>', 'Max pages to crawl during the flow-walk (default: 25)')\n .option('--no-mobile', 'Skip the mobile (375px) responsive pass')\n .option('--storage-state <path>', 'Playwright storage-state JSON, so the walk runs as a logged-in user. Cookie and token values from it are redacted from every written report.')\n .option('--track-flakes', 'Track test flakiness across runs')\n .option('--discover', 'Run autonomous E2E discovery (scenarios + edge cases)')\n .option('--max-scenarios <n>', 'Cap total scenarios for discovery (default: 50)')\n .option('--max-variants-per-scenario <n>', 'Cap edge variants per scenario (default: 3)')\n .option('--max-variants-per-run <n>', 'Cap edge variants per run (default: 40)')\n .option('--realism <profile>', 'Discovery realism: robot, careful-user, casual-user, frustrated-user, power-user')\n .option('--seed <n>', 'Replay a specific random seed')\n .option('--only <filter>', 'Filter discovery scenarios by id substring or app type')\n .option('--app-type <types>', 'Filter discovery app types (comma-separated); only generates scenarios for these types if the classifier matches them')\n .option('--force-app-type <type>', 'Force a single app type, bypassing the classifier entirely (use when classification returns blank)')\n .option('--no-llm', 'Disable LLM-backed discovery polish')\n .option('--non-interactive', 'Non-interactive mode for discovery (skips prompts and countdown)')\n .option('--regenerate', 'Regenerate sniff-scenarios/ before running (prompts on hand-edits)')\n .option('--regenerate-only', 'Regenerate sniff-scenarios/ and exit without running')\n .option('--force-regenerate', 'Regenerate sniff-scenarios/ and overwrite hand-edits')\n .option('--verbose', 'Print classification breakdown (top 3 guesses + matched signals per dimension)')\n .option('--dry-run', 'Discover: generate scenarios + classify without running browser or writing reports')\n .action(async (target, options) => {\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n\n if (options.discover || options.regenerate || options.regenerateOnly || options.forceRegenerate || options.dryRun) {\n const { loadConfig } = await import('../config/loader.js');\n const config = await loadConfig(rootDir);\n if (!options.regenerateOnly && !options.dryRun) {\n await ensurePlaywrightBrowsers(config.browser?.projects);\n }\n const { discoverCommand } = await import('./commands/discover.js');\n const appTypes = typeof options.appType === 'string'\n ? options.appType.split(',').map((s: string) => s.trim()).filter(Boolean)\n : undefined;\n const result = await discoverCommand({\n rootDir,\n url: options.url,\n headless: options.headed ? false : options.headless,\n ci: options.ci,\n json: options.json,\n ...(options.maxScenarios ? { maxScenarios: parseInt(options.maxScenarios, 10) } : {}),\n ...(options.maxVariantsPerScenario ? { maxVariantsPerScenario: parseInt(options.maxVariantsPerScenario, 10) } : {}),\n ...(options.maxVariantsPerRun ? { maxVariantsPerRun: parseInt(options.maxVariantsPerRun, 10) } : {}),\n ...(options.realism ? { realism: options.realism } : {}),\n ...(options.seed ? { seed: parseInt(options.seed, 10) } : {}),\n ...(options.only ? { only: options.only } : {}),\n ...(appTypes ? { appType: appTypes } : {}),\n ...(options.forceAppType ? { forceAppType: options.forceAppType } : {}),\n ...(options.llm === false ? { noLlm: true } : {}),\n ...(options.nonInteractive ? { nonInteractive: true } : {}),\n ...(options.format ? { format: options.format } : {}),\n ...(options.regenerate ? { regenerate: true } : {}),\n ...(options.regenerateOnly ? { regenerateOnly: true } : {}),\n ...(options.forceRegenerate ? { regenerate: true, forceRegenerate: true } : {}),\n ...(options.verbose ? { verbose: true } : {}),\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n process.exit(result.exitCode);\n }\n\n const { unifiedCommand } = await import('./commands/unified.js');\n const { loadConfig } = await import('../config/loader.js');\n\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 const isCi = options.ci || !!process.env.CI;\n const pc = (await import('picocolors')).default;\n\n // Default experience: a running app → walk its real user flows.\n if (wantsBrowser) {\n await ensurePlaywrightBrowsers(config.browser?.projects);\n const { crawlCommand } = await import('./commands/crawl-command.js');\n // crawlCommand does not load config itself, so resolve the flag\n // against the config key here. The flag wins.\n const storageState = options.storageState\n ? (await import('node:path')).resolve(options.storageState)\n : config.browser?.storageState;\n const code = await crawlCommand({\n rootDir,\n url: url!,\n ...(storageState ? { storageState } : {}),\n ...(config.assert ? { assert: config.assert } : {}),\n headless: options.headed ? false : options.headless,\n json: options.json,\n report: options.report,\n all: options.all,\n ...(options.maxPages ? { maxPages: parseInt(options.maxPages, 10) } : {}),\n mobile: options.mobile !== false,\n failOn: options.failOn,\n ci: isCi,\n });\n process.exit(code);\n }\n\n // No running app → source-only scan, with clear guidance (don't go silent).\n if (!options.json) {\n const { getDevCommand } = await import('../config/dev-server-detector.js');\n const devCmd = await getDevCommand(rootDir).catch(() => null);\n console.log(`${pc.yellow('No running app detected')}: no --url and no dev server.`);\n console.log(pc.dim('Running a source-only scan. For the full flow-walk that finds real bugs,'));\n console.log(`${pc.dim(`start your app${devCmd ? ` (${devCmd})` : ''} then re-run, or pass`)} ${pc.bold('--url <url>')}${pc.dim('.')} ${pc.dim('See')} ${pc.bold('sniff doctor')}${pc.dim('.')}\\n`);\n }\n\n await unifiedCommand({\n rootDir,\n url: undefined,\n explore: false,\n maxSteps: options.maxSteps,\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 (auto-detects .ts vs .js based on project)')\n .option('--force', 'Overwrite existing config')\n .option('--ts', 'Force TypeScript config (sniff.config.ts)')\n .option('--js', 'Force JavaScript config (sniff.config.mjs if ESM, sniff.config.js if CJS)')\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('scan')\n .description('Source-only scan (no browser): placeholder/TODO/console.log/dead links/etc.')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--json', 'Output results as JSON')\n .option('--fail-on <severities>', 'Exit non-zero on these severities (default: critical,high)', 'critical,high')\n .action(async (target, options) => {\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const { unifiedCommand } = await import('./commands/unified.js');\n await unifiedCommand({ rootDir, explore: false, json: options.json, failOn: options.failOn });\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 program\n .command('discover')\n .description('Run autonomous E2E discovery (scenarios + edge cases)')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--url <url>', 'Target URL (default: auto-detect dev server)')\n .option('--ci', 'CI mode: headless, robot realism, no countdown, JUnit output')\n .option('--headed', 'Show the browser window (alias for --no-headless)')\n .option('--no-headless', 'Show the browser window')\n .option('--format <formats>', 'Report formats: html, json, junit (comma-separated)')\n .option('--json', 'Output results as JSON')\n .option('--max-scenarios <n>', 'Cap total scenarios (default: 50)')\n .option('--max-variants-per-scenario <n>', 'Cap edge variants per scenario (default: 3)')\n .option('--max-variants-per-run <n>', 'Cap edge variants per run (default: 40)')\n .option('--realism <profile>', 'Realism: robot, careful-user, casual-user, frustrated-user, power-user')\n .option('--seed <n>', 'Replay a specific random seed')\n .option('--only <filter>', 'Filter scenarios by id substring or app type')\n .option('--app-type <types>', 'Filter discovery app types (comma-separated); only generates scenarios for these types if the classifier matches them')\n .option('--force-app-type <type>', 'Force a single app type, bypassing the classifier entirely (use when classification returns blank)')\n .option('--no-llm', 'Disable LLM-backed polish')\n .option('--non-interactive', 'Skip prompts and the production-URL countdown')\n .option('--regenerate', 'Regenerate sniff-scenarios/ before running (prompts on hand-edits)')\n .option('--regenerate-only', 'Regenerate sniff-scenarios/ and exit without running')\n .option('--force-regenerate', 'Regenerate sniff-scenarios/ and overwrite hand-edits')\n .option('--verbose', 'Print classification breakdown (top 3 guesses + matched signals per dimension)')\n .option('--dry-run', 'Generate scenarios + classify without running browser or writing reports')\n .action(async (target, options) => {\n if (!options.regenerateOnly && !options.dryRun) {\n const { loadConfig } = await import('../config/loader.js');\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const config = await loadConfig(rootDir);\n await ensurePlaywrightBrowsers(config.browser?.projects);\n }\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const { discoverCommand } = await import('./commands/discover.js');\n const appTypes = typeof options.appType === 'string'\n ? options.appType.split(',').map((s: string) => s.trim()).filter(Boolean)\n : undefined;\n const result = await discoverCommand({\n rootDir,\n // commander 14 can route --url to the program (default command) opts when\n // both the default command and this subcommand declare it; fall back so\n // `sniff discover --url <url>` works.\n url: options.url ?? program.opts().url,\n headless: options.headed ? false : options.headless,\n ci: options.ci,\n json: options.json,\n ...(options.maxScenarios ? { maxScenarios: parseInt(options.maxScenarios, 10) } : {}),\n ...(options.maxVariantsPerScenario ? { maxVariantsPerScenario: parseInt(options.maxVariantsPerScenario, 10) } : {}),\n ...(options.maxVariantsPerRun ? { maxVariantsPerRun: parseInt(options.maxVariantsPerRun, 10) } : {}),\n ...(options.realism ? { realism: options.realism } : {}),\n ...(options.seed ? { seed: parseInt(options.seed, 10) } : {}),\n ...(options.only ? { only: options.only } : {}),\n ...(appTypes ? { appType: appTypes } : {}),\n ...(options.forceAppType ? { forceAppType: options.forceAppType } : {}),\n ...(options.llm === false ? { noLlm: true } : {}),\n ...(options.nonInteractive ? { nonInteractive: true } : {}),\n ...(options.format ? { format: options.format } : {}),\n ...(options.regenerate ? { regenerate: true } : {}),\n ...(options.regenerateOnly ? { regenerateOnly: true } : {}),\n ...(options.forceRegenerate ? { regenerate: true, forceRegenerate: true } : {}),\n ...(options.verbose ? { verbose: true } : {}),\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n process.exit(result.exitCode);\n });\n\n program\n .command('fix')\n .description('Auto-fix safe issues (removes debugger, console.log/debug/info)')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--check', 'Dry run: show what would be fixed without changing files')\n .option('--json', 'Output results as JSON')\n .action(async (target, options) => {\n const { fixCommand } = await import('./commands/fix.js');\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n await fixCommand({ rootDir, dryRun: !!options.check, json: !!options.json });\n });\n\n program\n .command('doctor')\n .description('Check your environment: Node.js, Playwright, config, dev server')\n .action(async () => {\n const pc = (await import('picocolors')).default;\n const rootDir = process.cwd();\n\n console.log(`\\n${pc.bold('sniff doctor')}\\n`);\n\n // Node.js\n const nodeVersion = process.version;\n const nodeMajor = parseInt(nodeVersion.slice(1), 10);\n const nodeOk = nodeMajor >= 22;\n console.log(` ${nodeOk ? pc.green('OK') : pc.red('!! ')} Node.js ${nodeVersion} ${nodeOk ? '' : '(need 22+)'}`);\n\n // Playwright\n let playwrightOk = false;\n try {\n const { chromium } = await import('playwright');\n chromium.executablePath();\n playwrightOk = true;\n } catch { /* not installed */ }\n console.log(` ${playwrightOk ? pc.green('OK') : pc.yellow('--')} Playwright ${playwrightOk ? 'installed' : 'not installed (auto-installs on first browser scan)'}`);\n\n // Config file\n const { loadConfig } = await import('../config/loader.js');\n let hasConfig = false;\n try {\n const config = await loadConfig(rootDir);\n hasConfig = !!config.browser?.baseUrl;\n console.log(` ${pc.green('OK')} Config loaded${hasConfig ? ` (baseUrl: ${config.browser?.baseUrl})` : ' (defaults)'}`);\n } catch {\n console.log(` ${pc.green('OK')} No config file (using defaults)`);\n }\n\n // Dev server detection\n const { detectDevServerUrl, getDevCommand } = await import('../config/dev-server-detector.js');\n const detection = await detectDevServerUrl(rootDir);\n if (detection.url) {\n console.log(` ${pc.green('OK')} Dev server found at ${pc.bold(detection.url)} (${detection.detail})`);\n } else {\n const devCmd = await getDevCommand(rootDir);\n console.log(` ${pc.yellow('--')} No dev server running${devCmd ? ` (try: ${devCmd})` : ''}`);\n }\n\n // Package.json\n try {\n const { readFile } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const pkg = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf-8'));\n console.log(` ${pc.green('OK')} package.json found (${pkg.name ?? 'unnamed'})`);\n } catch {\n console.log(` ${pc.yellow('--')} No package.json in current directory`);\n }\n\n // sniff-scenarios/ (discovery baselines)\n try {\n const { readdir, stat } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const scenariosDir = join(rootDir, 'sniff-scenarios');\n const st = await stat(scenariosDir);\n if (st.isDirectory()) {\n const entries = await readdir(scenariosDir, { recursive: true });\n const count = entries.filter(\n (e) => typeof e === 'string' && e.endsWith('.scenario.md'),\n ).length;\n if (count > 0) {\n console.log(` ${pc.green('OK')} sniff-scenarios/ found (${count} scenario${count === 1 ? '' : 's'})`);\n } else {\n console.log(` ${pc.yellow('--')} sniff-scenarios/ exists but has no .scenario.md files`);\n }\n }\n } catch {\n console.log(` ${pc.yellow('--')} No sniff-scenarios/ (run 'sniff discover' to generate)`);\n }\n\n console.log('');\n });\n\n await program.parseAsync();\n}\n"],"mappings":";;;AAGA,IAAI,QAAQ,KAAK,SAAS,OAAO,GAAG;AAClC,QAAM,EAAE,WAAW,UAAU,IAAI,MAAM,OAAO,qBAAgB;AAC9D,MAAI;AACJ,MAAI;AACF,WAAO,UAAU,QAAQ,IAAI;AAAA,EAC/B,SAAS,KAAK;AAEZ,YAAQ,MAAM,eAAe,YAAY,IAAI,UAAU,OAAO,GAAG,CAAC;AAClE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,kBAAkB;AAC1D,QAAM,eAAe,IAAI;AAC3B,OAAO;AACL,QAAM,EAAE,QAAQ,IAAI,MAA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AAC,yDAAyD;AAAA,IAC3F;AAEA,YAAQ,IAAI,EAAE;AAAA,EAChB,CAAC;AAEH,QAAM,QAAQ,WAAW;AAC3B;","names":["loadConfig","config","pc","rootDir"]}
|
|
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 { parseCaps, CapsError } = await import('../mcp/caps.js');\n let caps;\n try {\n caps = parseCaps(process.argv);\n } catch (err) {\n // stdout is the MCP protocol channel, so a startup error goes to stderr.\n console.error(err instanceof CapsError ? err.message : String(err));\n process.exit(1);\n }\n const { startMcpServer } = await import('../mcp/server.js');\n await startMcpServer(caps);\n} else {\n const { Command } = await import('commander');\n\n const { ensurePlaywrightBrowsers } = await import('../core/ensure-browsers.js');\n\n const { getVersion } = await import('../version.js');\n\n const program = new Command();\n\n program\n .name('sniff')\n .description(\n 'Walks your running app in a real browser and reports what is broken, with the steps that reproduce it.\\n' +\n 'With no app running it reads your source instead. No API key, no account.',\n )\n .version(getVersion())\n .addHelpText('after', `\nStart here:\n $ sniff --url http://localhost:3000 walk a running app and print the report\n $ sniff --url http://localhost:3000 --report\n also write sniff-reports/sniff-report.html\n $ sniff scan read the source only, no browser\n $ sniff doctor check Node, the browser and the dev server\n\nExit codes:\n 0 no finding reached the --fail-on severities (default: critical,high)\n 1 a finding reached them, an assert budget was breached, or sniff could not run\n\nA walk clicks buttons and submits forms. Point it at a dev or staging app.\nDocs: https://github.com/Aboudjem/sniff#readme`);\n\n // ── Default command: unified scan ──────────────────────────────\n // `sniff` → source scan + auto-detect dev server\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>', 'URL of the running app to walk (default: the dev server found on a common port)')\n .option('--ci', 'CI mode: headless and non-interactive')\n .option('--no-browser', 'Force source-only scan even if URL is configured')\n .option('--explore', 'Run optional AI exploration after browser checks', false)\n .option('--no-explore', 'Skip AI exploration (kept for compatibility; exploration is off by default)')\n .option('--max-steps <n>', 'Cap AI exploration steps when --explore is used (default: 50)')\n .option('--headed', 'Show the browser window (alias for --no-headless)')\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('--report', 'Write a self-contained HTML report to sniff-reports/sniff-report.html')\n .option('--all', 'Show low-confidence findings too (hidden by default)')\n .option('--max-pages <n>', 'Max pages to crawl during the flow-walk (default: 25)')\n .option('--no-mobile', 'Skip the mobile (375px) responsive pass')\n .option('--storage-state <path>', 'Playwright storage-state JSON, so the walk runs as a logged-in user. Cookie and token values from it are redacted from every written report.')\n .option('--track-flakes', 'Track test flakiness across runs')\n .option('--discover', 'Run autonomous E2E discovery (scenarios + edge cases)')\n .option('--max-scenarios <n>', 'Cap total scenarios for discovery (default: 50)')\n .option('--max-variants-per-scenario <n>', 'Cap edge variants per scenario (default: 3)')\n .option('--max-variants-per-run <n>', 'Cap edge variants per run (default: 40)')\n .option('--realism <profile>', 'Discovery realism: robot, careful-user, casual-user, frustrated-user, power-user')\n .option('--seed <n>', 'Replay a specific random seed')\n .option('--only <filter>', 'Filter discovery scenarios by id substring or app type')\n .option('--app-type <types>', 'Filter discovery app types (comma-separated); only generates scenarios for these types if the classifier matches them')\n .option('--force-app-type <type>', 'Force a single app type, bypassing the classifier entirely (use when classification returns blank)')\n .option('--no-llm', 'Disable LLM-backed discovery polish')\n .option('--non-interactive', 'Non-interactive mode for discovery (skips prompts and countdown)')\n .option('--regenerate', 'Regenerate sniff-scenarios/ before running (prompts on hand-edits)')\n .option('--regenerate-only', 'Regenerate sniff-scenarios/ and exit without running')\n .option('--force-regenerate', 'Regenerate sniff-scenarios/ and overwrite hand-edits')\n .option('--verbose', 'Print classification breakdown (top 3 guesses + matched signals per dimension)')\n .option('--dry-run', 'Discover: generate scenarios + classify without running browser or writing reports')\n .action(async (target, options) => {\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n\n if (options.discover || options.regenerate || options.regenerateOnly || options.forceRegenerate || options.dryRun) {\n const { loadConfig } = await import('../config/loader.js');\n const config = await loadConfig(rootDir);\n if (!options.regenerateOnly && !options.dryRun) {\n await ensurePlaywrightBrowsers(config.browser?.projects);\n }\n const { discoverCommand } = await import('./commands/discover.js');\n const appTypes = typeof options.appType === 'string'\n ? options.appType.split(',').map((s: string) => s.trim()).filter(Boolean)\n : undefined;\n const result = await discoverCommand({\n rootDir,\n url: options.url,\n headless: options.headed ? false : options.headless,\n ci: options.ci,\n json: options.json,\n ...(options.maxScenarios ? { maxScenarios: parseInt(options.maxScenarios, 10) } : {}),\n ...(options.maxVariantsPerScenario ? { maxVariantsPerScenario: parseInt(options.maxVariantsPerScenario, 10) } : {}),\n ...(options.maxVariantsPerRun ? { maxVariantsPerRun: parseInt(options.maxVariantsPerRun, 10) } : {}),\n ...(options.realism ? { realism: options.realism } : {}),\n ...(options.seed ? { seed: parseInt(options.seed, 10) } : {}),\n ...(options.only ? { only: options.only } : {}),\n ...(appTypes ? { appType: appTypes } : {}),\n ...(options.forceAppType ? { forceAppType: options.forceAppType } : {}),\n ...(options.llm === false ? { noLlm: true } : {}),\n ...(options.nonInteractive ? { nonInteractive: true } : {}),\n ...(options.format ? { format: options.format } : {}),\n ...(options.regenerate ? { regenerate: true } : {}),\n ...(options.regenerateOnly ? { regenerateOnly: true } : {}),\n ...(options.forceRegenerate ? { regenerate: true, forceRegenerate: true } : {}),\n ...(options.verbose ? { verbose: true } : {}),\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n process.exit(result.exitCode);\n }\n\n const { unifiedCommand } = await import('./commands/unified.js');\n const { loadConfig } = await import('../config/loader.js');\n\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 const isCi = options.ci || !!process.env.CI;\n const pc = (await import('picocolors')).default;\n\n // Default experience: a running app → walk its real user flows.\n if (wantsBrowser) {\n await ensurePlaywrightBrowsers(config.browser?.projects);\n const { crawlCommand } = await import('./commands/crawl-command.js');\n // crawlCommand does not load config itself, so resolve the flag\n // against the config key here. The flag wins.\n const storageState = options.storageState\n ? (await import('node:path')).resolve(options.storageState)\n : config.browser?.storageState;\n const code = await crawlCommand({\n rootDir,\n url: url!,\n ...(storageState ? { storageState } : {}),\n ...(config.assert ? { assert: config.assert } : {}),\n headless: options.headed ? false : options.headless,\n json: options.json,\n report: options.report,\n all: options.all,\n ...(options.maxPages ? { maxPages: parseInt(options.maxPages, 10) } : {}),\n mobile: options.mobile !== false,\n failOn: options.failOn,\n ci: isCi,\n });\n process.exit(code);\n }\n\n // No running app → source-only scan, with clear guidance (don't go silent).\n if (!options.json) {\n const { getDevCommand } = await import('../config/dev-server-detector.js');\n const devCmd = await getDevCommand(rootDir).catch(() => null);\n console.log(`${pc.yellow('No running app detected')}: no --url and no dev server.`);\n console.log(pc.dim('Running a source-only scan. For the full flow-walk that finds real bugs,'));\n console.log(`${pc.dim(`start your app${devCmd ? ` (${devCmd})` : ''} then re-run, or pass`)} ${pc.bold('--url <url>')}${pc.dim('.')} ${pc.dim('See')} ${pc.bold('sniff doctor')}${pc.dim('.')}\\n`);\n }\n\n await unifiedCommand({\n rootDir,\n url: undefined,\n explore: false,\n maxSteps: options.maxSteps,\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 (auto-detects .ts vs .js based on project)')\n .option('--force', 'Overwrite existing config')\n .option('--ts', 'Force TypeScript config (sniff.config.ts)')\n .option('--js', 'Force JavaScript config (sniff.config.mjs if ESM, sniff.config.js if CJS)')\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('scan')\n .description('Source-only scan (no browser): placeholder/TODO/console.log/dead links/etc.')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--json', 'Output results as JSON')\n .option('--fail-on <severities>', 'Exit non-zero on these severities (default: critical,high)', 'critical,high')\n .action(async (target, options) => {\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const { unifiedCommand } = await import('./commands/unified.js');\n await unifiedCommand({ rootDir, explore: false, json: options.json, failOn: options.failOn });\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 program\n .command('discover')\n .description('Run autonomous E2E discovery (scenarios + edge cases)')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--url <url>', 'Target URL (default: auto-detect dev server)')\n .option('--ci', 'CI mode: headless, robot realism, no countdown, JUnit output')\n .option('--headed', 'Show the browser window (alias for --no-headless)')\n .option('--no-headless', 'Show the browser window')\n .option('--format <formats>', 'Report formats: html, json, junit (comma-separated)')\n .option('--json', 'Output results as JSON')\n .option('--max-scenarios <n>', 'Cap total scenarios (default: 50)')\n .option('--max-variants-per-scenario <n>', 'Cap edge variants per scenario (default: 3)')\n .option('--max-variants-per-run <n>', 'Cap edge variants per run (default: 40)')\n .option('--realism <profile>', 'Realism: robot, careful-user, casual-user, frustrated-user, power-user')\n .option('--seed <n>', 'Replay a specific random seed')\n .option('--only <filter>', 'Filter scenarios by id substring or app type')\n .option('--app-type <types>', 'Filter discovery app types (comma-separated); only generates scenarios for these types if the classifier matches them')\n .option('--force-app-type <type>', 'Force a single app type, bypassing the classifier entirely (use when classification returns blank)')\n .option('--no-llm', 'Disable LLM-backed polish')\n .option('--non-interactive', 'Skip prompts and the production-URL countdown')\n .option('--regenerate', 'Regenerate sniff-scenarios/ before running (prompts on hand-edits)')\n .option('--regenerate-only', 'Regenerate sniff-scenarios/ and exit without running')\n .option('--force-regenerate', 'Regenerate sniff-scenarios/ and overwrite hand-edits')\n .option('--verbose', 'Print classification breakdown (top 3 guesses + matched signals per dimension)')\n .option('--dry-run', 'Generate scenarios + classify without running browser or writing reports')\n .action(async (target, options) => {\n if (!options.regenerateOnly && !options.dryRun) {\n const { loadConfig } = await import('../config/loader.js');\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const config = await loadConfig(rootDir);\n await ensurePlaywrightBrowsers(config.browser?.projects);\n }\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const { discoverCommand } = await import('./commands/discover.js');\n const appTypes = typeof options.appType === 'string'\n ? options.appType.split(',').map((s: string) => s.trim()).filter(Boolean)\n : undefined;\n const result = await discoverCommand({\n rootDir,\n // commander 14 can route --url to the program (default command) opts when\n // both the default command and this subcommand declare it; fall back so\n // `sniff discover --url <url>` works.\n url: options.url ?? program.opts().url,\n headless: options.headed ? false : options.headless,\n ci: options.ci,\n json: options.json,\n ...(options.maxScenarios ? { maxScenarios: parseInt(options.maxScenarios, 10) } : {}),\n ...(options.maxVariantsPerScenario ? { maxVariantsPerScenario: parseInt(options.maxVariantsPerScenario, 10) } : {}),\n ...(options.maxVariantsPerRun ? { maxVariantsPerRun: parseInt(options.maxVariantsPerRun, 10) } : {}),\n ...(options.realism ? { realism: options.realism } : {}),\n ...(options.seed ? { seed: parseInt(options.seed, 10) } : {}),\n ...(options.only ? { only: options.only } : {}),\n ...(appTypes ? { appType: appTypes } : {}),\n ...(options.forceAppType ? { forceAppType: options.forceAppType } : {}),\n ...(options.llm === false ? { noLlm: true } : {}),\n ...(options.nonInteractive ? { nonInteractive: true } : {}),\n ...(options.format ? { format: options.format } : {}),\n ...(options.regenerate ? { regenerate: true } : {}),\n ...(options.regenerateOnly ? { regenerateOnly: true } : {}),\n ...(options.forceRegenerate ? { regenerate: true, forceRegenerate: true } : {}),\n ...(options.verbose ? { verbose: true } : {}),\n ...(options.dryRun ? { dryRun: true } : {}),\n });\n process.exit(result.exitCode);\n });\n\n program\n .command('fix')\n .description('Auto-fix safe issues (removes debugger, console.log/debug/info)')\n .argument('[target]', 'Project directory (default: current directory)')\n .option('--check', 'Dry run: show what would be fixed without changing files')\n .option('--json', 'Output results as JSON')\n .action(async (target, options) => {\n const { fixCommand } = await import('./commands/fix.js');\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n await fixCommand({ rootDir, dryRun: !!options.check, json: !!options.json });\n });\n\n program\n .command('doctor')\n .description('Check your environment: Node.js, Playwright, config, dev server')\n .action(async () => {\n const pc = (await import('picocolors')).default;\n const rootDir = process.cwd();\n\n console.log(`\\n${pc.bold('sniff doctor')}\\n`);\n\n // Node.js\n const nodeVersion = process.version;\n const nodeMajor = parseInt(nodeVersion.slice(1), 10);\n const nodeOk = nodeMajor >= 22;\n console.log(` ${nodeOk ? pc.green('OK') : pc.red('!! ')} Node.js ${nodeVersion} ${nodeOk ? '' : '(need 22+)'}`);\n\n // Browser. The Playwright package ships with sniff; the Chromium build\n // is a separate download, so test that it is really on disk.\n const { checkPlaywrightBrowsers } = await import('../core/ensure-browsers.js');\n const browser = await checkPlaywrightBrowsers(['chromium']);\n if (browser.status === 'installed') {\n console.log(` ${pc.green('OK')} Chromium downloaded`);\n } else {\n console.log(` ${pc.yellow('--')} Chromium not downloaded yet (the first walk downloads it, about 165 MB, or run: npx playwright install chromium)`);\n }\n\n // Config file\n const { loadConfig } = await import('../config/loader.js');\n let hasConfig = false;\n try {\n const config = await loadConfig(rootDir);\n hasConfig = !!config.browser?.baseUrl;\n console.log(` ${pc.green('OK')} Config loaded${hasConfig ? ` (baseUrl: ${config.browser?.baseUrl})` : ' (defaults)'}`);\n } catch {\n console.log(` ${pc.green('OK')} No config file (using defaults)`);\n }\n\n // Dev server detection\n const { detectDevServerUrl, getDevCommand } = await import('../config/dev-server-detector.js');\n const detection = await detectDevServerUrl(rootDir);\n if (detection.url) {\n console.log(` ${pc.green('OK')} Dev server found at ${pc.bold(detection.url)} (${detection.detail})`);\n } else {\n const devCmd = await getDevCommand(rootDir);\n console.log(` ${pc.yellow('--')} No dev server running${devCmd ? ` (try: ${devCmd})` : ''}`);\n }\n\n // Package.json\n try {\n const { readFile } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const pkg = JSON.parse(await readFile(join(rootDir, 'package.json'), 'utf-8'));\n console.log(` ${pc.green('OK')} package.json found (${pkg.name ?? 'unnamed'})`);\n } catch {\n console.log(` ${pc.yellow('--')} No package.json in current directory`);\n }\n\n // sniff-scenarios/ (discovery baselines)\n try {\n const { readdir, stat } = await import('node:fs/promises');\n const { join } = await import('node:path');\n const scenariosDir = join(rootDir, 'sniff-scenarios');\n const st = await stat(scenariosDir);\n if (st.isDirectory()) {\n const entries = await readdir(scenariosDir, { recursive: true });\n const count = entries.filter(\n (e) => typeof e === 'string' && e.endsWith('.scenario.md'),\n ).length;\n if (count > 0) {\n console.log(` ${pc.green('OK')} sniff-scenarios/ found (${count} scenario${count === 1 ? '' : 's'})`);\n } else {\n console.log(` ${pc.yellow('--')} sniff-scenarios/ exists but has no .scenario.md files`);\n }\n }\n } catch {\n console.log(` ${pc.yellow('--')} No sniff-scenarios/ (run 'sniff discover' to generate)`);\n }\n\n console.log('');\n });\n\n await program.parseAsync();\n}\n"],"mappings":";;;AAGA,IAAI,QAAQ,KAAK,SAAS,OAAO,GAAG;AAClC,QAAM,EAAE,WAAW,UAAU,IAAI,MAAM,OAAO,qBAAgB;AAC9D,MAAI;AACJ,MAAI;AACF,WAAO,UAAU,QAAQ,IAAI;AAAA,EAC/B,SAAS,KAAK;AAEZ,YAAQ,MAAM,eAAe,YAAY,IAAI,UAAU,OAAO,GAAG,CAAC;AAClE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACA,QAAM,EAAE,eAAe,IAAI,MAAM,OAAO,kBAAkB;AAC1D,QAAM,eAAe,IAAI;AAC3B,OAAO;AACL,QAAM,EAAE,QAAQ,IAAI,MAAM,OAAO,WAAW;AAE5C,QAAM,EAAE,yBAAyB,IAAI,MAAM,OAAO,gCAA4B;AAE9E,QAAM,EAAE,WAAW,IAAI,MAAM,OAAO,wBAAe;AAEnD,QAAM,UAAU,IAAI,QAAQ;AAE5B,UACG,KAAK,OAAO,EACZ;AAAA,IACC;AAAA,EAEF,EACC,QAAQ,WAAW,CAAC,EACpB,YAAY,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+CAaqB;AAM7C,UACG,SAAS,YAAY,wDAAwD,EAC7E,OAAO,eAAe,iFAAiF,EACvG,OAAO,QAAQ,uCAAuC,EACtD,OAAO,gBAAgB,kDAAkD,EACzE,OAAO,aAAa,oDAAoD,KAAK,EAC7E,OAAO,gBAAgB,6EAA6E,EACpG,OAAO,mBAAmB,+DAA+D,EACzF,OAAO,YAAY,mDAAmD,EACtE,OAAO,iBAAiB,yBAAyB,EACjD,OAAO,sBAAsB,qDAAqD,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;AACN,cAAQ,IAAI,KAAK,GAAG,OAAO,IAAI,CAAC,uCAAuC;AAAA,IACzE;AAGA,QAAI;AACF,YAAM,EAAE,SAAS,KAAK,IAAI,MAAM,OAAO,aAAkB;AACzD,YAAM,EAAE,KAAK,IAAI,MAAM,OAAO,MAAW;AACzC,YAAM,eAAe,KAAK,SAAS,iBAAiB;AACpD,YAAM,KAAK,MAAM,KAAK,YAAY;AAClC,UAAI,GAAG,YAAY,GAAG;AACpB,cAAM,UAAU,MAAM,QAAQ,cAAc,EAAE,WAAW,KAAK,CAAC;AAC/D,cAAM,QAAQ,QAAQ;AAAA,UACpB,CAAC,MAAM,OAAO,MAAM,YAAY,EAAE,SAAS,cAAc;AAAA,QAC3D,EAAE;AACF,YAAI,QAAQ,GAAG;AACb,kBAAQ,IAAI,KAAK,GAAG,MAAM,IAAI,CAAC,4BAA4B,KAAK,YAAY,UAAU,IAAI,KAAK,GAAG,GAAG;AAAA,QACvG,OAAO;AACL,kBAAQ,IAAI,KAAK,GAAG,OAAO,IAAI,CAAC,wDAAwD;AAAA,QAC1F;AAAA,MACF;AAAA,IACF,QAAQ;AACN,cAAQ,IAAI,KAAK,GAAG,OAAO,IAAI,CAAC,yDAAyD;AAAA,IAC3F;AAEA,YAAQ,IAAI,EAAE;AAAA,EAChB,CAAC;AAEH,QAAM,QAAQ,WAAW;AAC3B;","names":["loadConfig","config","pc","rootDir"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
formatReportText,
|
|
3
|
+
runCrawl
|
|
4
|
+
} from "./chunk-64FUDSRY.js";
|
|
5
|
+
import {
|
|
6
|
+
fixFirst,
|
|
7
|
+
isFailing,
|
|
8
|
+
renderHtmlReport,
|
|
9
|
+
severityCounts,
|
|
10
|
+
verdictLine
|
|
11
|
+
} from "./chunk-T72SLMTY.js";
|
|
12
|
+
import "./chunk-GX36BPK7.js";
|
|
13
|
+
import "./chunk-IXDUD2UG.js";
|
|
14
|
+
export {
|
|
15
|
+
fixFirst,
|
|
16
|
+
formatReportText,
|
|
17
|
+
isFailing,
|
|
18
|
+
renderHtmlReport,
|
|
19
|
+
runCrawl,
|
|
20
|
+
severityCounts,
|
|
21
|
+
verdictLine
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=crawl-XPHT3KIZ.js.map
|
|
@@ -19,8 +19,8 @@ function decideCrawlExit(input) {
|
|
|
19
19
|
}
|
|
20
20
|
async function crawlCommand(opts) {
|
|
21
21
|
const pc = (await import("picocolors")).default;
|
|
22
|
-
const { runCrawl, formatReportText } = await import("./crawl-
|
|
23
|
-
const { writeCrawlArtifacts } = await import("./write-report-
|
|
22
|
+
const { runCrawl, formatReportText } = await import("./crawl-XPHT3KIZ.js");
|
|
23
|
+
const { writeCrawlArtifacts } = await import("./write-report-Y4UPVXUO.js");
|
|
24
24
|
const reportDir = join(opts.rootDir, "sniff-reports");
|
|
25
25
|
const isCi = opts.ci || !!process.env.CI;
|
|
26
26
|
if (!opts.json) {
|
|
@@ -60,11 +60,15 @@ ${pc.bold("sniff")} v${getVersion()} ${pc.dim("walking")} ${pc.bold(opts.url)}
|
|
|
60
60
|
if (opts.json) {
|
|
61
61
|
console.log(JSON.stringify(report, null, 2));
|
|
62
62
|
} else {
|
|
63
|
-
console.log(formatReportText(report, {
|
|
63
|
+
console.log(formatReportText(report, {
|
|
64
|
+
...opts.all !== void 0 ? { all: opts.all } : {},
|
|
65
|
+
failed: hasFailure,
|
|
66
|
+
cwd: process.cwd()
|
|
67
|
+
}));
|
|
64
68
|
if (hasFailure) {
|
|
65
|
-
console.log(pc.
|
|
69
|
+
console.log(pc.dim("Exit code 1, so CI fails on these. Pass ") + pc.bold("--fail-on none") + pc.dim(" to always exit 0."));
|
|
66
70
|
} else {
|
|
67
|
-
console.log(pc.
|
|
71
|
+
console.log(pc.dim("Exit code 0."));
|
|
68
72
|
}
|
|
69
73
|
}
|
|
70
74
|
return hasFailure ? 1 : 0;
|
|
@@ -73,4 +77,4 @@ export {
|
|
|
73
77
|
crawlCommand,
|
|
74
78
|
decideCrawlExit
|
|
75
79
|
};
|
|
76
|
-
//# sourceMappingURL=crawl-command-
|
|
80
|
+
//# sourceMappingURL=crawl-command-JHZN4GK7.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/crawl-command.ts"],"sourcesContent":["import { join } from 'node:path';\nimport type { Severity } from '../../core/types.js';\nimport type { AssertConfig } from '../../config/schema.js';\nimport type { QaFinding as CrawlFinding } from '../../crawl/types.js';\nimport { evaluateSeverityBudget, printBudgetViolations } from '../../core/assert-budget.js';\n\nexport interface CrawlCommandOptions {\n rootDir: string;\n url: string;\n headless?: boolean;\n json?: boolean;\n /** Write a self-contained HTML report. */\n report?: boolean;\n /** Show low-confidence (uncertain) findings too. */\n all?: boolean;\n maxPages?: number;\n /** Include the mobile (375px) pass. Default true. */\n mobile?: boolean;\n failOn?: string;\n ci?: boolean;\n /** Playwright storage-state file, so the walk runs as a logged-in user. */\n storageState?: string;\n /** Assertion budgets from config, enforced on top of `failOn`. */\n assert?: AssertConfig;\n}\n\nconst VALID_SEVERITIES = new Set(['critical', 'high', 'medium', 'low', 'info']);\n\n/**\n * The exit decision for a walk, pulled out so it can be tested without a\n * browser. `failOn` and the assert budget are both evaluated over the SHOWN\n * findings, the same set the report displays, so a hidden low-confidence\n * finding can never fail CI on its own.\n */\nexport function decideCrawlExit(input: {\n findings: readonly CrawlFinding[];\n all?: boolean;\n failOn?: string;\n assert?: AssertConfig;\n}): { exitCode: number; shown: CrawlFinding[]; violations: string[] } {\n const failOn = (input.failOn ?? 'critical,high')\n .split(',').map((s) => s.trim()).filter((s): s is Severity => VALID_SEVERITIES.has(s));\n const shown = input.findings.filter((f) => input.all || f.confidence !== 'uncertain');\n const failsOnSeverity = shown.some((f) => failOn.includes(f.severity));\n const budget = evaluateSeverityBudget(shown, input.assert);\n return {\n exitCode: failsOnSeverity || !budget.passed ? 1 : 0,\n shown,\n violations: budget.violations,\n };\n}\n\n/**\n * The default browser experience: drive a real browser, walk the app's flows,\n * and report real issues with proof. Returns the process exit code.\n */\nexport async function crawlCommand(opts: CrawlCommandOptions): Promise<number> {\n const pc = (await import('picocolors')).default;\n const { runCrawl, formatReportText } = await import('../../crawl/index.js');\n const { writeCrawlArtifacts } = await import('../../crawl/write-report.js');\n\n const reportDir = join(opts.rootDir, 'sniff-reports');\n const isCi = opts.ci || !!process.env.CI;\n\n if (!opts.json) {\n const { getVersion } = await import('../../version.js');\n console.log(`\\n${pc.bold('sniff')} v${getVersion()} ${pc.dim('walking')} ${pc.bold(opts.url)}\\n`);\n }\n\n const report = await runCrawl({\n startUrl: opts.url,\n headless: opts.headless ?? true,\n includeMobile: opts.mobile ?? true,\n ...(opts.maxPages ? { maxPages: opts.maxPages } : {}),\n outputDir: join(reportDir, 'crawl'),\n ...(opts.storageState ? { storageState: opts.storageState } : {}),\n onProgress: opts.json ? undefined : (m) => process.stderr.write(` ${pc.dim('·')} ${pc.dim(m)}\\n`),\n });\n\n // Persist the machine-readable report so `sniff` integrates with CI/agents.\n // Both artifacts go through one writer, which redacts before rendering.\n const artifacts = await writeCrawlArtifacts({\n reportDir,\n report,\n html: opts.report === true,\n title: `sniff: ${new URL(opts.url).host}`,\n });\n\n if (opts.report && artifacts.htmlPath && !opts.json) {\n console.log(pc.dim(` HTML report: ${artifacts.htmlPath}`));\n }\n\n // Exit code: fail on shown findings at the configured severities, or on a\n // breached assert budget.\n const decision = decideCrawlExit({\n findings: report.findings,\n ...(opts.all !== undefined ? { all: opts.all } : {}),\n ...(opts.failOn !== undefined ? { failOn: opts.failOn } : {}),\n ...(opts.assert !== undefined ? { assert: opts.assert } : {}),\n });\n const shown = decision.shown;\n printBudgetViolations({ passed: decision.violations.length === 0, violations: decision.violations });\n const hasFailure = decision.exitCode === 1;\n\n if (opts.json) {\n console.log(JSON.stringify(report, null, 2));\n } else {\n console.log(formatReportText(report, { all: opts.all }));\n //
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/crawl-command.ts"],"sourcesContent":["import { join } from 'node:path';\nimport type { Severity } from '../../core/types.js';\nimport type { AssertConfig } from '../../config/schema.js';\nimport type { QaFinding as CrawlFinding } from '../../crawl/types.js';\nimport { evaluateSeverityBudget, printBudgetViolations } from '../../core/assert-budget.js';\n\nexport interface CrawlCommandOptions {\n rootDir: string;\n url: string;\n headless?: boolean;\n json?: boolean;\n /** Write a self-contained HTML report. */\n report?: boolean;\n /** Show low-confidence (uncertain) findings too. */\n all?: boolean;\n maxPages?: number;\n /** Include the mobile (375px) pass. Default true. */\n mobile?: boolean;\n failOn?: string;\n ci?: boolean;\n /** Playwright storage-state file, so the walk runs as a logged-in user. */\n storageState?: string;\n /** Assertion budgets from config, enforced on top of `failOn`. */\n assert?: AssertConfig;\n}\n\nconst VALID_SEVERITIES = new Set(['critical', 'high', 'medium', 'low', 'info']);\n\n/**\n * The exit decision for a walk, pulled out so it can be tested without a\n * browser. `failOn` and the assert budget are both evaluated over the SHOWN\n * findings, the same set the report displays, so a hidden low-confidence\n * finding can never fail CI on its own.\n */\nexport function decideCrawlExit(input: {\n findings: readonly CrawlFinding[];\n all?: boolean;\n failOn?: string;\n assert?: AssertConfig;\n}): { exitCode: number; shown: CrawlFinding[]; violations: string[] } {\n const failOn = (input.failOn ?? 'critical,high')\n .split(',').map((s) => s.trim()).filter((s): s is Severity => VALID_SEVERITIES.has(s));\n const shown = input.findings.filter((f) => input.all || f.confidence !== 'uncertain');\n const failsOnSeverity = shown.some((f) => failOn.includes(f.severity));\n const budget = evaluateSeverityBudget(shown, input.assert);\n return {\n exitCode: failsOnSeverity || !budget.passed ? 1 : 0,\n shown,\n violations: budget.violations,\n };\n}\n\n/**\n * The default browser experience: drive a real browser, walk the app's flows,\n * and report real issues with proof. Returns the process exit code.\n */\nexport async function crawlCommand(opts: CrawlCommandOptions): Promise<number> {\n const pc = (await import('picocolors')).default;\n const { runCrawl, formatReportText } = await import('../../crawl/index.js');\n const { writeCrawlArtifacts } = await import('../../crawl/write-report.js');\n\n const reportDir = join(opts.rootDir, 'sniff-reports');\n const isCi = opts.ci || !!process.env.CI;\n\n if (!opts.json) {\n const { getVersion } = await import('../../version.js');\n console.log(`\\n${pc.bold('sniff')} v${getVersion()} ${pc.dim('walking')} ${pc.bold(opts.url)}\\n`);\n }\n\n const report = await runCrawl({\n startUrl: opts.url,\n headless: opts.headless ?? true,\n includeMobile: opts.mobile ?? true,\n ...(opts.maxPages ? { maxPages: opts.maxPages } : {}),\n outputDir: join(reportDir, 'crawl'),\n ...(opts.storageState ? { storageState: opts.storageState } : {}),\n onProgress: opts.json ? undefined : (m) => process.stderr.write(` ${pc.dim('·')} ${pc.dim(m)}\\n`),\n });\n\n // Persist the machine-readable report so `sniff` integrates with CI/agents.\n // Both artifacts go through one writer, which redacts before rendering.\n const artifacts = await writeCrawlArtifacts({\n reportDir,\n report,\n html: opts.report === true,\n title: `sniff: ${new URL(opts.url).host}`,\n });\n\n if (opts.report && artifacts.htmlPath && !opts.json) {\n console.log(pc.dim(` HTML report: ${artifacts.htmlPath}`));\n }\n\n // Exit code: fail on shown findings at the configured severities, or on a\n // breached assert budget.\n const decision = decideCrawlExit({\n findings: report.findings,\n ...(opts.all !== undefined ? { all: opts.all } : {}),\n ...(opts.failOn !== undefined ? { failOn: opts.failOn } : {}),\n ...(opts.assert !== undefined ? { assert: opts.assert } : {}),\n });\n const shown = decision.shown;\n printBudgetViolations({ passed: decision.violations.length === 0, violations: decision.violations });\n const hasFailure = decision.exitCode === 1;\n\n if (opts.json) {\n console.log(JSON.stringify(report, null, 2));\n } else {\n console.log(formatReportText(report, {\n ...(opts.all !== undefined ? { all: opts.all } : {}),\n failed: hasFailure,\n cwd: process.cwd(),\n }));\n // A non-zero exit must not read like a crash, so say why it is non-zero.\n if (hasFailure) {\n console.log(pc.dim('Exit code 1, so CI fails on these. Pass ') + pc.bold('--fail-on none') + pc.dim(' to always exit 0.'));\n } else {\n console.log(pc.dim('Exit code 0.'));\n }\n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KAAK,QAAQ,SAAY,EAAE,KAAK,KAAK,IAAI,IAAI,CAAC;AAAA,MAClD,QAAQ;AAAA,MACR,KAAK,QAAQ,IAAI;AAAA,IACnB,CAAC,CAAC;AAEF,QAAI,YAAY;AACd,cAAQ,IAAI,GAAG,IAAI,0CAA0C,IAAI,GAAG,KAAK,gBAAgB,IAAI,GAAG,IAAI,oBAAoB,CAAC;AAAA,IAC3H,OAAO;AACL,cAAQ,IAAI,GAAG,IAAI,cAAc,CAAC;AAAA,IACpC;AAAA,EACF;AACA,SAAO,aAAa,IAAI;AAC1B;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// src/core/ensure-browsers.ts
|
|
2
|
+
import { existsSync } from "fs";
|
|
2
3
|
var ESTIMATED_BROWSER_SIZE_MB = {
|
|
3
4
|
chromium: 165,
|
|
4
5
|
firefox: 95,
|
|
@@ -10,13 +11,27 @@ function normalizeProjects(projects) {
|
|
|
10
11
|
function installCommand(projects) {
|
|
11
12
|
return `npx playwright install ${projects.join(" ")}`;
|
|
12
13
|
}
|
|
13
|
-
|
|
14
|
+
var defaultProbe = {
|
|
15
|
+
async executablePath(project) {
|
|
16
|
+
const playwright = await import("playwright");
|
|
17
|
+
return playwright[project].executablePath();
|
|
18
|
+
},
|
|
19
|
+
exists: existsSync
|
|
20
|
+
};
|
|
21
|
+
function isBrowserOnDisk(project, path, probe) {
|
|
22
|
+
if (!path) return false;
|
|
23
|
+
if (probe.exists(path)) return true;
|
|
24
|
+
if (project !== "chromium") return false;
|
|
25
|
+
const m = path.match(/^(.*[\\/])chromium-(\d+)[\\/]/);
|
|
26
|
+
return m ? probe.exists(`${m[1]}chromium_headless_shell-${m[2]}`) : false;
|
|
27
|
+
}
|
|
28
|
+
async function checkPlaywrightBrowsers(projects, probe = defaultProbe) {
|
|
14
29
|
const requestedProjects = normalizeProjects(projects);
|
|
15
30
|
try {
|
|
16
|
-
const playwright = await import("playwright");
|
|
17
31
|
const missingProjects = [];
|
|
18
32
|
for (const project of requestedProjects) {
|
|
19
|
-
|
|
33
|
+
const path = await probe.executablePath(project);
|
|
34
|
+
if (!isBrowserOnDisk(project, path, probe)) missingProjects.push(project);
|
|
20
35
|
}
|
|
21
36
|
if (missingProjects.length === 0) {
|
|
22
37
|
return { status: "installed", projects: requestedProjects };
|
|
@@ -28,7 +43,7 @@ async function checkPlaywrightBrowsers(projects) {
|
|
|
28
43
|
installCommand: installCommand(missingProjects),
|
|
29
44
|
installSizeMb: missingProjects.reduce((sum, project) => sum + ESTIMATED_BROWSER_SIZE_MB[project], 0)
|
|
30
45
|
};
|
|
31
|
-
} catch
|
|
46
|
+
} catch {
|
|
32
47
|
return {
|
|
33
48
|
status: "missing",
|
|
34
49
|
projects: requestedProjects,
|
|
@@ -43,20 +58,19 @@ async function ensurePlaywrightBrowsers(projects) {
|
|
|
43
58
|
const check = await checkPlaywrightBrowsers(requestedProjects);
|
|
44
59
|
if (check.status === "installed") return;
|
|
45
60
|
const pc = (await import("picocolors")).default;
|
|
46
|
-
|
|
47
|
-
const installSizeMb =
|
|
48
|
-
console.
|
|
61
|
+
const toInstall = check.status === "missing" ? check.missingProjects : requestedProjects;
|
|
62
|
+
const installSizeMb = toInstall.reduce((sum, project) => sum + ESTIMATED_BROWSER_SIZE_MB[project], 0);
|
|
63
|
+
console.error(pc.yellow(`
|
|
64
|
+
Browser not downloaded yet: ${toInstall.join(", ")}.`));
|
|
65
|
+
console.error(pc.dim(`Downloading it once (about ${installSizeMb} MB). Later runs skip this step.
|
|
49
66
|
`));
|
|
50
67
|
const { execSync } = await import("child_process");
|
|
51
68
|
try {
|
|
52
|
-
execSync(installCommand(
|
|
53
|
-
console.
|
|
69
|
+
execSync(installCommand(toInstall), { stdio: ["ignore", process.stderr, process.stderr] });
|
|
70
|
+
console.error("");
|
|
54
71
|
} catch {
|
|
55
|
-
console.error(
|
|
56
|
-
|
|
57
|
-
`Failed to install Playwright browsers. Run manually: ${installCommand(requestedProjects)}`
|
|
58
|
-
)
|
|
59
|
-
);
|
|
72
|
+
console.error(pc.red(`Could not download the browser. Run this, then retry: ${installCommand(toInstall)}`));
|
|
73
|
+
console.error(pc.dim("No network? `sniff scan` reads your source and needs no browser."));
|
|
60
74
|
process.exit(1);
|
|
61
75
|
}
|
|
62
76
|
}
|
|
@@ -83,4 +97,4 @@ export {
|
|
|
83
97
|
installPlaywrightBrowserProjects,
|
|
84
98
|
installPlaywrightBrowsers
|
|
85
99
|
};
|
|
86
|
-
//# sourceMappingURL=ensure-browsers-
|
|
100
|
+
//# sourceMappingURL=ensure-browsers-5NAQQMEC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/ensure-browsers.ts"],"sourcesContent":["// Shared Playwright-browser bootstrap for CLI and MCP paths.\n//\n// CLI: runs `npx playwright install chromium` inline — users see progress\n// and wait the 30-60s once. MCP: does NOT silently shell out, because MCP\n// stdio transports commonly time out, leaving the agent stuck. Instead the\n// MCP surface returns a structured `needsSetup` payload so the agent can\n// ask the user to run `sniff install` explicitly.\n\nimport { existsSync } from 'node:fs';\nimport type { BrowserProject } from '../config/schema.js';\n\nexport type BrowserCheckStatus =\n | { status: 'installed'; projects: BrowserProject[] }\n | { status: 'missing'; projects: BrowserProject[]; missingProjects: BrowserProject[]; installCommand: string; installSizeMb: number }\n | { status: 'error'; error: string };\n\nconst ESTIMATED_BROWSER_SIZE_MB: Record<BrowserProject, number> = {\n chromium: 165,\n firefox: 95,\n webkit: 120,\n};\n\nfunction normalizeProjects(projects?: BrowserProject[]): BrowserProject[] {\n return projects && projects.length > 0 ? [...new Set(projects)] : ['chromium'];\n}\n\nfunction installCommand(projects: BrowserProject[]): string {\n return `npx playwright install ${projects.join(' ')}`;\n}\n\n/** What the check needs from the outside world. Injected in tests. */\nexport interface BrowserProbe {\n /** Where Playwright expects the browser binary. Throws when Playwright is absent. */\n executablePath(project: BrowserProject): Promise<string>;\n exists(path: string): boolean;\n}\n\nconst defaultProbe: BrowserProbe = {\n async executablePath(project) {\n const playwright = await import('playwright');\n return playwright[project].executablePath();\n },\n exists: existsSync,\n};\n\n/**\n * True when the browser for `project` is on disk.\n *\n * `executablePath()` returns the expected path whether or not the file is\n * there, so the path must be tested. A headless walk runs on the Chromium\n * headless shell, which `playwright install --only-shell` downloads without\n * the full browser, so that build counts as installed too.\n */\nfunction isBrowserOnDisk(project: BrowserProject, path: string, probe: BrowserProbe): boolean {\n if (!path) return false;\n if (probe.exists(path)) return true;\n if (project !== 'chromium') return false;\n const m = path.match(/^(.*[\\\\/])chromium-(\\d+)[\\\\/]/);\n return m ? probe.exists(`${m[1]}chromium_headless_shell-${m[2]}`) : false;\n}\n\n/**\n * Non-invasive check. Does NOT install. Safe to call from MCP handlers.\n */\nexport async function checkPlaywrightBrowsers(\n projects?: BrowserProject[],\n probe: BrowserProbe = defaultProbe,\n): Promise<BrowserCheckStatus> {\n const requestedProjects = normalizeProjects(projects);\n try {\n const missingProjects: BrowserProject[] = [];\n for (const project of requestedProjects) {\n const path = await probe.executablePath(project);\n if (!isBrowserOnDisk(project, path, probe)) missingProjects.push(project);\n }\n if (missingProjects.length === 0) {\n return { status: 'installed', projects: requestedProjects };\n }\n return {\n status: 'missing',\n projects: requestedProjects,\n missingProjects,\n installCommand: installCommand(missingProjects),\n installSizeMb: missingProjects.reduce((sum, project) => sum + ESTIMATED_BROWSER_SIZE_MB[project], 0),\n };\n } catch {\n // Playwright itself is not installed, or the platform is unsupported.\n return {\n status: 'missing',\n projects: requestedProjects,\n missingProjects: requestedProjects,\n installCommand: installCommand(requestedProjects),\n installSizeMb: requestedProjects.reduce((sum, project) => sum + ESTIMATED_BROWSER_SIZE_MB[project], 0),\n };\n }\n}\n\n/**\n * CLI path. Installs inline if missing. Exits the process on failure.\n * Do NOT call from MCP handlers — use `checkPlaywrightBrowsers` instead.\n */\nexport async function ensurePlaywrightBrowsers(projects?: BrowserProject[]): Promise<void> {\n const requestedProjects = normalizeProjects(projects);\n const check = await checkPlaywrightBrowsers(requestedProjects);\n if (check.status === 'installed') return;\n\n const pc = (await import('picocolors')).default;\n const toInstall = check.status === 'missing' ? check.missingProjects : requestedProjects;\n const installSizeMb = toInstall.reduce((sum, project) => sum + ESTIMATED_BROWSER_SIZE_MB[project], 0);\n // stderr, so `--json` output on stdout stays parseable.\n console.error(pc.yellow(`\\nBrowser not downloaded yet: ${toInstall.join(', ')}.`));\n console.error(pc.dim(`Downloading it once (about ${installSizeMb} MB). Later runs skip this step.\\n`));\n\n const { execSync } = await import('node:child_process');\n try {\n execSync(installCommand(toInstall), { stdio: ['ignore', process.stderr, process.stderr] });\n console.error('');\n } catch {\n console.error(pc.red(`Could not download the browser. Run this, then retry: ${installCommand(toInstall)}`));\n console.error(pc.dim('No network? `sniff scan` reads your source and needs no browser.'));\n process.exit(1);\n }\n}\n\n/**\n * Install via the tool surface (used by the `sniff_install` MCP tool).\n * Returns a structured result so the MCP response can report status\n * without leaking raw stdio to the agent.\n */\nexport async function installPlaywrightBrowsers(): Promise<\n | { status: 'ok' }\n | { status: 'failed'; error: string }\n> {\n return installPlaywrightBrowserProjects();\n}\n\nexport async function installPlaywrightBrowserProjects(projects?: BrowserProject[]): Promise<\n | { status: 'ok'; projects: BrowserProject[] }\n | { status: 'failed'; projects: BrowserProject[]; error: string }\n> {\n const requestedProjects = normalizeProjects(projects);\n const { execSync } = await import('node:child_process');\n try {\n execSync(installCommand(requestedProjects), { stdio: 'pipe' });\n return { status: 'ok', projects: requestedProjects };\n } catch (e) {\n return {\n status: 'failed',\n projects: requestedProjects,\n error: e instanceof Error ? e.message : 'unknown error',\n };\n }\n}\n"],"mappings":";AAQA,SAAS,kBAAkB;AAQ3B,IAAM,4BAA4D;AAAA,EAChE,UAAU;AAAA,EACV,SAAS;AAAA,EACT,QAAQ;AACV;AAEA,SAAS,kBAAkB,UAA+C;AACxE,SAAO,YAAY,SAAS,SAAS,IAAI,CAAC,GAAG,IAAI,IAAI,QAAQ,CAAC,IAAI,CAAC,UAAU;AAC/E;AA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AO,aAAa,QAAQ,EAAE,UAAU;AAAA,IAC1C;AAAA,EACF;AACF;","names":[]}
|
|
@@ -28,11 +28,33 @@ function groupBySeverity(findings) {
|
|
|
28
28
|
}
|
|
29
29
|
return groups;
|
|
30
30
|
}
|
|
31
|
+
var FAILING = ["critical", "high"];
|
|
32
|
+
function verdictHeader(findings) {
|
|
33
|
+
if (findings.length === 0) {
|
|
34
|
+
return [`${pc.bold("VERDICT")} ${pc.green("PASS")}: no issues found`];
|
|
35
|
+
}
|
|
36
|
+
const groups = groupBySeverity(findings);
|
|
37
|
+
const counts = SEVERITY_ORDER.filter((sev) => groups[sev].length > 0).map((sev) => `${groups[sev].length} ${sev}`).join(", ");
|
|
38
|
+
const failing = findings.some((f) => FAILING.includes(f.severity));
|
|
39
|
+
const word = failing ? pc.red("FAIL") : pc.green("PASS");
|
|
40
|
+
const gate = failing ? "" : ", none at a failing severity";
|
|
41
|
+
const lines = [
|
|
42
|
+
`${pc.bold("VERDICT")} ${word}: ${findings.length} issue${findings.length === 1 ? "" : "s"} (${counts})${gate}`,
|
|
43
|
+
""
|
|
44
|
+
];
|
|
45
|
+
const first = [...findings].sort((a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity)).slice(0, 3);
|
|
46
|
+
lines.push(first.length === findings.length ? "Fix these:" : "Fix these first:");
|
|
47
|
+
first.forEach((f, i) => {
|
|
48
|
+
const where = isBrowserFinding(f) ? f.url : `${f.filePath}:${f.line}`;
|
|
49
|
+
lines.push(` ${i + 1}. ${f.message} in ${where} [${f.severity}]`);
|
|
50
|
+
});
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
31
53
|
function formatFindings(findings) {
|
|
32
54
|
if (findings.length === 0) {
|
|
33
|
-
return
|
|
55
|
+
return verdictHeader(findings).join("\n");
|
|
34
56
|
}
|
|
35
|
-
const lines =
|
|
57
|
+
const lines = verdictHeader(findings);
|
|
36
58
|
const groups = groupBySeverity(findings);
|
|
37
59
|
for (const severity of SEVERITY_ORDER) {
|
|
38
60
|
const group = groups[severity];
|
|
@@ -79,9 +101,9 @@ function isBrowserFinding(finding) {
|
|
|
79
101
|
}
|
|
80
102
|
function formatBrowserFindings(findings) {
|
|
81
103
|
if (findings.length === 0) {
|
|
82
|
-
return
|
|
104
|
+
return verdictHeader(findings).join("\n");
|
|
83
105
|
}
|
|
84
|
-
const lines =
|
|
106
|
+
const lines = verdictHeader(findings);
|
|
85
107
|
const scannerGroups = /* @__PURE__ */ new Map();
|
|
86
108
|
for (const finding of findings) {
|
|
87
109
|
const prefix = getScannerPrefix(finding.ruleId);
|
|
@@ -141,6 +163,7 @@ function formatProgress(viewport, url, findingCount) {
|
|
|
141
163
|
export {
|
|
142
164
|
formatBrowserFindings,
|
|
143
165
|
formatFindings,
|
|
144
|
-
formatProgress
|
|
166
|
+
formatProgress,
|
|
167
|
+
verdictHeader
|
|
145
168
|
};
|
|
146
|
-
//# sourceMappingURL=formatter-
|
|
169
|
+
//# sourceMappingURL=formatter-4VI3ZX5Y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/formatter.ts"],"sourcesContent":["import pc from 'picocolors';\nimport type { Finding, Severity, BrowserFinding } from '../core/types.js';\n\nconst SEVERITY_ORDER: Severity[] = ['critical', 'high', 'medium', 'low', 'info'];\n\nconst severityColors: Record<Severity, (s: string) => string> = {\n critical: pc.red,\n high: pc.red,\n medium: pc.yellow,\n low: pc.cyan,\n info: pc.gray,\n};\n\nconst severityIcons: Record<Severity, string> = {\n critical: 'X',\n high: '!',\n medium: '~',\n low: '-',\n info: 'i',\n};\n\nfunction groupBySeverity(findings: Finding[]): Record<Severity, Finding[]> {\n const groups: Record<Severity, Finding[]> = {\n critical: [],\n high: [],\n medium: [],\n low: [],\n info: [],\n };\n\n for (const finding of findings) {\n groups[finding.severity].push(finding);\n }\n\n return groups;\n}\n\nconst FAILING: readonly Severity[] = ['critical', 'high'];\n\n/**\n * The top of every report: the verdict, then the findings to fix first. The\n * detail follows. A report that opens with 200 lines of findings makes the\n * reader hunt for the answer.\n */\nexport function verdictHeader(findings: Finding[]): string[] {\n if (findings.length === 0) {\n return [`${pc.bold('VERDICT')} ${pc.green('PASS')}: no issues found`];\n }\n const groups = groupBySeverity(findings);\n const counts = SEVERITY_ORDER\n .filter((sev) => groups[sev].length > 0)\n .map((sev) => `${groups[sev].length} ${sev}`)\n .join(', ');\n const failing = findings.some((f) => FAILING.includes(f.severity));\n const word = failing ? pc.red('FAIL') : pc.green('PASS');\n const gate = failing ? '' : ', none at a failing severity';\n const lines = [\n `${pc.bold('VERDICT')} ${word}: ${findings.length} issue${findings.length === 1 ? '' : 's'} (${counts})${gate}`,\n '',\n ];\n const first = [...findings]\n .sort((a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity))\n .slice(0, 3);\n lines.push(first.length === findings.length ? 'Fix these:' : 'Fix these first:');\n first.forEach((f, i) => {\n const where = isBrowserFinding(f) ? f.url : `${f.filePath}:${f.line}`;\n lines.push(` ${i + 1}. ${f.message} in ${where} [${f.severity}]`);\n });\n return lines;\n}\n\nexport function formatFindings(findings: Finding[]): string {\n if (findings.length === 0) {\n return verdictHeader(findings).join('\\n');\n }\n\n const lines: string[] = verdictHeader(findings);\n const groups = groupBySeverity(findings);\n\n for (const severity of SEVERITY_ORDER) {\n const group = groups[severity];\n if (group.length === 0) continue;\n\n const color = severityColors[severity];\n const icon = severityIcons[severity];\n\n lines.push('');\n lines.push(color(`${icon} ${severity.toUpperCase()} (${group.length})`));\n\n for (const finding of group) {\n lines.push(\n ` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))} ${finding.message}`,\n );\n lines.push(` ${pc.dim(finding.snippet)}`);\n }\n }\n\n // Summary line\n const parts: string[] = [];\n for (const severity of SEVERITY_ORDER) {\n const count = groups[severity].length;\n if (count > 0) {\n parts.push(severityColors[severity](`${count} ${severity}`));\n }\n }\n\n lines.push('');\n lines.push(`Found ${pc.bold(String(findings.length))} issues: ${parts.join(', ')}`);\n\n return lines.join('\\n');\n}\n\n// Scanner display name mapping\nconst SCANNER_DISPLAY_NAMES: Record<string, string> = {\n 'e2e/': 'Browser Tests',\n 'a11y/': 'Accessibility',\n 'visual/': 'Visual Regression',\n 'perf/': 'Performance',\n 'source/': 'Source Code',\n};\n\nfunction getScannerPrefix(ruleId: string): string {\n for (const prefix of Object.keys(SCANNER_DISPLAY_NAMES)) {\n if (ruleId.startsWith(prefix)) {\n return prefix;\n }\n }\n return 'other/';\n}\n\nfunction isBrowserFinding(finding: Finding): finding is BrowserFinding {\n return 'url' in finding && 'viewport' in finding;\n}\n\nexport function formatBrowserFindings(findings: Finding[]): string {\n if (findings.length === 0) {\n return verdictHeader(findings).join('\\n');\n }\n\n const lines: string[] = verdictHeader(findings);\n\n // Group findings by scanner prefix\n const scannerGroups = new Map<string, Finding[]>();\n for (const finding of findings) {\n const prefix = getScannerPrefix(finding.ruleId);\n if (!scannerGroups.has(prefix)) {\n scannerGroups.set(prefix, []);\n }\n scannerGroups.get(prefix)!.push(finding);\n }\n\n let scannerCount = 0;\n\n // Render each scanner group\n for (const [prefix, groupFindings] of scannerGroups) {\n scannerCount++;\n const displayName = SCANNER_DISPLAY_NAMES[prefix] ?? prefix.replace('/', '');\n\n lines.push('');\n lines.push(pc.blue(pc.bold(`[${displayName}]`)));\n\n // Sort by severity within group\n const sorted = [...groupFindings].sort(\n (a, b) => SEVERITY_ORDER.indexOf(a.severity) - SEVERITY_ORDER.indexOf(b.severity),\n );\n\n for (const finding of sorted) {\n const color = severityColors[finding.severity];\n const icon = severityIcons[finding.severity];\n\n // Viewport label for browser findings\n const vpLabel = isBrowserFinding(finding)\n ? ` ${pc.magenta(`[${finding.viewport}]`)}`\n : '';\n\n lines.push(\n ` ${color(`${icon}`)} ${color(finding.severity.toUpperCase())}${vpLabel} ${finding.message}`,\n );\n lines.push(\n ` ${pc.dim(finding.filePath)}:${pc.yellow(String(finding.line))}`,\n );\n\n if (finding.snippet) {\n lines.push(` ${pc.dim(finding.snippet)}`);\n }\n\n // Screenshot path for browser findings\n if (isBrowserFinding(finding) && finding.screenshotPath) {\n lines.push(` ${pc.dim(pc.underline(finding.screenshotPath))}`);\n }\n\n // Fix suggestion\n if (isBrowserFinding(finding) && finding.fixSuggestion) {\n lines.push(` ${pc.green('Fix:')} ${finding.fixSuggestion}`);\n }\n }\n }\n\n // Summary line\n const parts: string[] = [];\n const groups = groupBySeverity(findings);\n for (const severity of SEVERITY_ORDER) {\n const count = groups[severity].length;\n if (count > 0) {\n parts.push(severityColors[severity](`${count} ${severity}`));\n }\n }\n\n lines.push('');\n lines.push(\n `Found ${pc.bold(String(findings.length))} issues across ${scannerCount} scanners: ${parts.join(', ')}`,\n );\n\n return lines.join('\\n');\n}\n\nexport function formatProgress(viewport: string, url: string, findingCount: number): string {\n const suffix =\n findingCount === 0\n ? pc.green('0 findings')\n : pc.yellow(`${findingCount} finding${findingCount !== 1 ? 's' : ''}`);\n return ` ${pc.dim(`[${viewport}]`)} ${pc.dim(url)}... done (${suffix})`;\n}\n"],"mappings":";AAAA,OAAO,QAAQ;AAGf,IAAM,iBAA6B,CAAC,YAAY,QAAQ,UAAU,OAAO,MAAM;AAE/E,IAAM,iBAA0D;AAAA,EAC9D,UAAU,GAAG;AAAA,EACb,MAAM,GAAG;AAAA,EACT,QAAQ,GAAG;AAAA,EACX,KAAK,GAAG;AAAA,EACR,MAAM,GAAG;AACX;AAEA,IAAM,gBAA0C;AAAA,EAC9C,UAAU;AAAA,EACV,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,KAAK;AAAA,EACL,MAAM;AACR;AAEA,SAAS,gBAAgB,UAAkD;AACzE,QAAM,SAAsC;AAAA,IAC1C,UAAU,CAAC;AAAA,IACX,MAAM,CAAC;AAAA,IACP,QAAQ,CAAC;AAAA,IACT,KAAK,CAAC;AAAA,IACN,MAAM,CAAC;AAAA,EACT;AAEA,aAAW,WAAW,UAAU;AAC9B,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O,KAAK,GAAG,IAAI,IAAI,QAAQ,GAAG,CAAC,IAAI,GAAG,IAAI,GAAG,CAAC,aAAa,MAAM;AACvE;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -350,12 +350,22 @@ declare function renderHtmlReport(report: CrawlReport, opts?: {
|
|
|
350
350
|
title?: string;
|
|
351
351
|
}): string;
|
|
352
352
|
|
|
353
|
+
interface ReportTextOptions {
|
|
354
|
+
/** Show `uncertain` findings too. */
|
|
355
|
+
all?: boolean;
|
|
356
|
+
/**
|
|
357
|
+
* The real exit decision, when the caller has it (`--fail-on` plus the
|
|
358
|
+
* assert budget). Left out, the verdict fails on a critical or high finding.
|
|
359
|
+
*/
|
|
360
|
+
failed?: boolean;
|
|
361
|
+
/** Screenshot paths under this folder print relative to it. */
|
|
362
|
+
cwd?: string;
|
|
363
|
+
}
|
|
353
364
|
/**
|
|
354
|
-
* Render a CrawlReport
|
|
355
|
-
* findings
|
|
365
|
+
* Render a CrawlReport for the terminal. The order is fixed: the verdict, the
|
|
366
|
+
* findings to fix first, then every finding by severity. By default
|
|
367
|
+
* `uncertain` findings are hidden (shown with `all: true`).
|
|
356
368
|
*/
|
|
357
|
-
declare function formatReportText(report: CrawlReport, opts?:
|
|
358
|
-
all?: boolean;
|
|
359
|
-
}): string;
|
|
369
|
+
declare function formatReportText(report: CrawlReport, opts?: ReportTextOptions): string;
|
|
360
370
|
|
|
361
371
|
export { type AIProvider, type AnalysisResult, type ComponentInfo, type Confidence, type CrawlOptions, type CrawlReport, type ElementInfo, type Finding, type FrameworkInfo, type GeneratedTest, type QaFinding, type Reproduction, type RouteInfo, type RouteTestContext, type Severity, type SniffConfig, type SniffUserConfig, defineConfig, formatReportText, generateTests, renderHtmlReport, runCrawl };
|
package/dist/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generateTests
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-7BLJCICM.js";
|
|
4
4
|
import {
|
|
5
5
|
formatReportText,
|
|
6
6
|
runCrawl
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-64FUDSRY.js";
|
|
8
8
|
import {
|
|
9
9
|
renderHtmlReport
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-T72SLMTY.js";
|
|
11
11
|
import "./chunk-GX36BPK7.js";
|
|
12
12
|
import "./chunk-IXDUD2UG.js";
|
|
13
13
|
|
package/dist/mcp/server.js
CHANGED
|
@@ -41,7 +41,7 @@ async function handleSniffScan(rootDir) {
|
|
|
41
41
|
return { content: [{ type: "text", text: JSON.stringify({ error: rootErr }) }] };
|
|
42
42
|
}
|
|
43
43
|
const { loadConfig } = await import("../loader-Z2DUGG5Z.js");
|
|
44
|
-
const { runSourceScan } = await import("../quality-run-
|
|
44
|
+
const { runSourceScan } = await import("../quality-run-KJMBBAQT.js");
|
|
45
45
|
const { saveResults } = await import("../persistence-XLFJ5EY4.js");
|
|
46
46
|
await loadConfig(rootDir);
|
|
47
47
|
const { results } = await runSourceScan(rootDir);
|
|
@@ -59,10 +59,10 @@ async function handleSniffRun(rootDir, baseUrl, headless) {
|
|
|
59
59
|
if (urlErr) {
|
|
60
60
|
return { content: [{ type: "text", text: JSON.stringify({ error: urlErr }) }] };
|
|
61
61
|
}
|
|
62
|
-
const { runSourceScan, routesFromAnalysis, runBrowserAudit } = await import("../quality-run-
|
|
62
|
+
const { runSourceScan, routesFromAnalysis, runBrowserAudit } = await import("../quality-run-KJMBBAQT.js");
|
|
63
63
|
const { saveResults } = await import("../persistence-XLFJ5EY4.js");
|
|
64
64
|
const sourceRun = await runSourceScan(rootDir);
|
|
65
|
-
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-
|
|
65
|
+
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-5NAQQMEC.js");
|
|
66
66
|
const check = await checkPlaywrightBrowsers(sourceRun.config.browser?.projects);
|
|
67
67
|
if (check.status !== "installed") {
|
|
68
68
|
return {
|
|
@@ -132,7 +132,7 @@ async function handleSniffWalk(options) {
|
|
|
132
132
|
if (urlErr) return { content: [{ type: "text", text: JSON.stringify({ error: urlErr }) }] };
|
|
133
133
|
const { loadConfig } = await import("../loader-Z2DUGG5Z.js");
|
|
134
134
|
const config = await loadConfig(options.rootDir);
|
|
135
|
-
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-
|
|
135
|
+
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-5NAQQMEC.js");
|
|
136
136
|
const check = await checkPlaywrightBrowsers(config.browser?.projects);
|
|
137
137
|
if (check.status !== "installed") {
|
|
138
138
|
return {
|
|
@@ -149,7 +149,7 @@ async function handleSniffWalk(options) {
|
|
|
149
149
|
};
|
|
150
150
|
}
|
|
151
151
|
const { join } = await import("path");
|
|
152
|
-
const { runCrawl } = await import("../crawl-
|
|
152
|
+
const { runCrawl, isFailing, verdictLine, fixFirst } = await import("../crawl-XPHT3KIZ.js");
|
|
153
153
|
const report = await runCrawl({
|
|
154
154
|
startUrl: url,
|
|
155
155
|
headless: options.headless ?? true,
|
|
@@ -164,7 +164,20 @@ async function handleSniffWalk(options) {
|
|
|
164
164
|
return {
|
|
165
165
|
content: [{
|
|
166
166
|
type: "text",
|
|
167
|
-
|
|
167
|
+
// Verdict first, so an agent reads the answer before the detail.
|
|
168
|
+
text: JSON.stringify({
|
|
169
|
+
verdict: isFailing(shown) ? "fail" : "pass",
|
|
170
|
+
verdictLine: verdictLine(shown),
|
|
171
|
+
fixFirst: fixFirst(shown).map((f) => ({
|
|
172
|
+
title: f.title,
|
|
173
|
+
route: f.reproduction.route,
|
|
174
|
+
severity: f.severity,
|
|
175
|
+
suggestedFix: f.suggestedFix
|
|
176
|
+
})),
|
|
177
|
+
stats: report.stats,
|
|
178
|
+
summary: report.summary,
|
|
179
|
+
findings: shown
|
|
180
|
+
}, null, 2)
|
|
168
181
|
}]
|
|
169
182
|
};
|
|
170
183
|
}
|
|
@@ -194,7 +207,7 @@ async function handleSniffDiscover(options) {
|
|
|
194
207
|
if (!options.dryRun) {
|
|
195
208
|
const { loadConfig } = await import("../loader-Z2DUGG5Z.js");
|
|
196
209
|
const config = await loadConfig(options.rootDir);
|
|
197
|
-
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-
|
|
210
|
+
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-5NAQQMEC.js");
|
|
198
211
|
const check = await checkPlaywrightBrowsers(config.browser?.projects);
|
|
199
212
|
if (check.status !== "installed") {
|
|
200
213
|
return {
|
|
@@ -305,7 +318,7 @@ async function handleSniffUnified(options) {
|
|
|
305
318
|
}
|
|
306
319
|
}
|
|
307
320
|
async function handleSniffInstall(projects) {
|
|
308
|
-
const { installPlaywrightBrowserProjects } = await import("../ensure-browsers-
|
|
321
|
+
const { installPlaywrightBrowserProjects } = await import("../ensure-browsers-5NAQQMEC.js");
|
|
309
322
|
const requestedProjects = projects && projects.length > 0 ? projects : ["chromium"];
|
|
310
323
|
const result = await installPlaywrightBrowserProjects(requestedProjects);
|
|
311
324
|
return {
|
|
@@ -413,7 +426,7 @@ async function startMcpServer(caps = CAPABILITIES, transport) {
|
|
|
413
426
|
if (url) {
|
|
414
427
|
const { loadConfig } = await import("../loader-Z2DUGG5Z.js");
|
|
415
428
|
const config = await loadConfig(rootDir);
|
|
416
|
-
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-
|
|
429
|
+
const { checkPlaywrightBrowsers } = await import("../ensure-browsers-5NAQQMEC.js");
|
|
417
430
|
const check = await checkPlaywrightBrowsers(config.browser?.projects);
|
|
418
431
|
if (check.status !== "installed") {
|
|
419
432
|
return {
|