sniff-qa 0.2.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/LICENSE +172 -0
- package/README.md +581 -0
- package/dist/accessibility-UNJB57T6.js +93 -0
- package/dist/accessibility-UNJB57T6.js.map +1 -0
- package/dist/anthropic-api-MRDZ7BJA.js +33 -0
- package/dist/anthropic-api-MRDZ7BJA.js.map +1 -0
- package/dist/chunk-623BAIU2.js +73 -0
- package/dist/chunk-623BAIU2.js.map +1 -0
- package/dist/chunk-CBDOJUXB.js +157 -0
- package/dist/chunk-CBDOJUXB.js.map +1 -0
- package/dist/chunk-IXDUD2UG.js +14 -0
- package/dist/chunk-IXDUD2UG.js.map +1 -0
- package/dist/chunk-MMISGY2Q.js +52 -0
- package/dist/chunk-MMISGY2Q.js.map +1 -0
- package/dist/chunk-ZM6MGWO4.js +49 -0
- package/dist/chunk-ZM6MGWO4.js.map +1 -0
- package/dist/ci-2MVD2ISE.js +52 -0
- package/dist/ci-2MVD2ISE.js.map +1 -0
- package/dist/claude-code-F722EIIC.js +42 -0
- package/dist/claude-code-F722EIIC.js.map +1 -0
- package/dist/claude-exploration-provider-QJH6IPYU.js +126 -0
- package/dist/claude-exploration-provider-QJH6IPYU.js.map +1 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/index.js +72 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cross-reference-MHNPSLEN.js +218 -0
- package/dist/cross-reference-MHNPSLEN.js.map +1 -0
- package/dist/element-extractor-OZTFBVKZ.js +250 -0
- package/dist/element-extractor-OZTFBVKZ.js.map +1 -0
- package/dist/errors-RFEOR527.js +7 -0
- package/dist/errors-RFEOR527.js.map +1 -0
- package/dist/flakiness-OVC7KGN2.js +11 -0
- package/dist/flakiness-OVC7KGN2.js.map +1 -0
- package/dist/formatter-HC3LT3VH.js +146 -0
- package/dist/formatter-HC3LT3VH.js.map +1 -0
- package/dist/framework-detector-ISSM2Q2I.js +95 -0
- package/dist/framework-detector-ISSM2Q2I.js.map +1 -0
- package/dist/generator-OZY3HMJW.js +7 -0
- package/dist/generator-OZY3HMJW.js.map +1 -0
- package/dist/index.d.ts +212 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/init-75MMIW4A.js +66 -0
- package/dist/init-75MMIW4A.js.map +1 -0
- package/dist/json-YDWEB33Q.js +8 -0
- package/dist/json-YDWEB33Q.js.map +1 -0
- package/dist/junit-GL44ATRR.js +52 -0
- package/dist/junit-GL44ATRR.js.map +1 -0
- package/dist/loader-QII5CZSX.js +161 -0
- package/dist/loader-QII5CZSX.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +171 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/model-SRPWXU63.js +92 -0
- package/dist/model-SRPWXU63.js.map +1 -0
- package/dist/page-hooks-DOZWXF7Z.js +13 -0
- package/dist/page-hooks-DOZWXF7Z.js.map +1 -0
- package/dist/page-state-extractor-GYYLYRFR.js +75 -0
- package/dist/page-state-extractor-GYYLYRFR.js.map +1 -0
- package/dist/performance-FBUGBRB3.js +134 -0
- package/dist/performance-FBUGBRB3.js.map +1 -0
- package/dist/persistence-RHUFBQAY.js +86 -0
- package/dist/persistence-RHUFBQAY.js.map +1 -0
- package/dist/prompt-builder-D3FBH534.js +53 -0
- package/dist/prompt-builder-D3FBH534.js.map +1 -0
- package/dist/provider-7IHXYR6V.js +13 -0
- package/dist/provider-7IHXYR6V.js.map +1 -0
- package/dist/registry-NB5CZB6W.js +43 -0
- package/dist/registry-NB5CZB6W.js.map +1 -0
- package/dist/repo-analyzer-4OURSITY.js +49 -0
- package/dist/repo-analyzer-4OURSITY.js.map +1 -0
- package/dist/report-E2JZMQED.js +61 -0
- package/dist/report-E2JZMQED.js.map +1 -0
- package/dist/response-parser-PUGNWF7S.js +46 -0
- package/dist/response-parser-PUGNWF7S.js.map +1 -0
- package/dist/route-discoverer-QBZCRQLJ.js +304 -0
- package/dist/route-discoverer-QBZCRQLJ.js.map +1 -0
- package/dist/runner-MS2SNTMR.js +153 -0
- package/dist/runner-MS2SNTMR.js.map +1 -0
- package/dist/runner-Z4I2YVVM.js +237 -0
- package/dist/runner-Z4I2YVVM.js.map +1 -0
- package/dist/source-D5KLH46F.js +896 -0
- package/dist/source-D5KLH46F.js.map +1 -0
- package/dist/unified-CQU7PSNJ.js +275 -0
- package/dist/unified-CQU7PSNJ.js.map +1 -0
- package/dist/update-baselines-MDTCFO2U.js +71 -0
- package/dist/update-baselines-MDTCFO2U.js.map +1 -0
- package/dist/visual-ZSQPDE7A.js +125 -0
- package/dist/visual-ZSQPDE7A.js.map +1 -0
- package/dist/workflow-template-3KFPCVIC.js +119 -0
- package/dist/workflow-template-3KFPCVIC.js.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import {
|
|
2
|
+
selectPayload
|
|
3
|
+
} from "./chunk-MMISGY2Q.js";
|
|
4
|
+
|
|
5
|
+
// src/exploration/claude-exploration-provider.ts
|
|
6
|
+
import { execFile as execFileCb } from "child_process";
|
|
7
|
+
import { promisify } from "util";
|
|
8
|
+
var execFile = promisify(execFileCb);
|
|
9
|
+
var VALID_ACTIONS = /* @__PURE__ */ new Set(["click", "fill", "navigate", "scroll", "done"]);
|
|
10
|
+
var ClaudeExplorationProvider = class {
|
|
11
|
+
async decideNextAction(pageState, history) {
|
|
12
|
+
try {
|
|
13
|
+
return await this.callClaude(pageState, history);
|
|
14
|
+
} catch (err) {
|
|
15
|
+
if (err instanceof Error && "code" in err && err.code === "ENOENT") {
|
|
16
|
+
return this.deterministicFallback(pageState, history);
|
|
17
|
+
}
|
|
18
|
+
return this.deterministicFallback(pageState, history);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
async callClaude(pageState, history) {
|
|
22
|
+
const systemPrompt = `You are a chaos monkey exploring a web application to find bugs.
|
|
23
|
+
You will be given the current page state (URL, title, interactive elements, form fields) and recent action history.
|
|
24
|
+
Respond with ONLY a JSON object matching this shape:
|
|
25
|
+
{
|
|
26
|
+
"action": "click" | "fill" | "navigate" | "scroll" | "done",
|
|
27
|
+
"selector": "CSS selector for click/fill targets",
|
|
28
|
+
"value": "value to fill for fill actions \u2014 use edge-case data like XSS payloads, SQL injection, Unicode, boundary values",
|
|
29
|
+
"url": "URL for navigate actions",
|
|
30
|
+
"reasoning": "why you chose this action"
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
Priorities:
|
|
34
|
+
1. Fill form fields with hostile/edge-case values (XSS, SQLi, Unicode, boundary)
|
|
35
|
+
2. Click submit buttons to trigger form validation
|
|
36
|
+
3. Click buttons and interactive elements not yet visited
|
|
37
|
+
4. Navigate to unvisited links
|
|
38
|
+
5. Return {"action":"done","reasoning":"..."} when all elements have been tested`;
|
|
39
|
+
const recentHistory = history.slice(-5).map((h) => ({
|
|
40
|
+
step: h.step,
|
|
41
|
+
action: h.action,
|
|
42
|
+
selector: h.target.selector,
|
|
43
|
+
url: h.url
|
|
44
|
+
}));
|
|
45
|
+
const userPrompt = JSON.stringify({
|
|
46
|
+
currentPage: {
|
|
47
|
+
url: pageState.url,
|
|
48
|
+
title: pageState.title,
|
|
49
|
+
interactiveElements: pageState.interactiveElements.slice(0, 20),
|
|
50
|
+
formFields: pageState.formFields.slice(0, 15)
|
|
51
|
+
},
|
|
52
|
+
recentHistory
|
|
53
|
+
});
|
|
54
|
+
const { stdout } = await execFile("claude", [
|
|
55
|
+
"--print",
|
|
56
|
+
"--output-format",
|
|
57
|
+
"json",
|
|
58
|
+
"--system-prompt",
|
|
59
|
+
systemPrompt,
|
|
60
|
+
userPrompt
|
|
61
|
+
], {
|
|
62
|
+
timeout: 3e4,
|
|
63
|
+
maxBuffer: 1024 * 1024
|
|
64
|
+
});
|
|
65
|
+
const envelope = JSON.parse(stdout);
|
|
66
|
+
const rawContent = envelope.result ?? stdout;
|
|
67
|
+
const jsonStr = typeof rawContent === "string" ? rawContent.replace(/```json?\n?/g, "").replace(/```/g, "").trim() : JSON.stringify(rawContent);
|
|
68
|
+
const decision = JSON.parse(jsonStr);
|
|
69
|
+
if (!decision.action || !VALID_ACTIONS.has(decision.action)) {
|
|
70
|
+
return { action: "done", reasoning: "Invalid action type in AI response" };
|
|
71
|
+
}
|
|
72
|
+
if (!decision.reasoning) {
|
|
73
|
+
decision.reasoning = "AI provided no reasoning";
|
|
74
|
+
}
|
|
75
|
+
return decision;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Deterministic fallback when Claude Code CLI is unavailable.
|
|
79
|
+
* Strategy: fill first unfilled form field -> click first unvisited button -> navigate first unvisited link -> done.
|
|
80
|
+
*/
|
|
81
|
+
deterministicFallback(pageState, history) {
|
|
82
|
+
const stepIndex = history.length;
|
|
83
|
+
const visitedSelectors = new Set(history.map((h) => h.target.selector));
|
|
84
|
+
for (const field of pageState.formFields) {
|
|
85
|
+
if (!visitedSelectors.has(field.selector)) {
|
|
86
|
+
const { value } = selectPayload(field.type, stepIndex);
|
|
87
|
+
return {
|
|
88
|
+
action: "fill",
|
|
89
|
+
selector: field.selector,
|
|
90
|
+
value,
|
|
91
|
+
reasoning: `Deterministic fallback: filling form field "${field.name}" (${field.type}) with edge-case payload`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const buttons = pageState.interactiveElements.filter(
|
|
96
|
+
(el) => el.tag === "button" || el.type === "submit"
|
|
97
|
+
);
|
|
98
|
+
for (const btn of buttons) {
|
|
99
|
+
if (!visitedSelectors.has(btn.selector)) {
|
|
100
|
+
return {
|
|
101
|
+
action: "click",
|
|
102
|
+
selector: btn.selector,
|
|
103
|
+
reasoning: `Deterministic fallback: clicking unvisited button "${btn.text}"`
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
const links = pageState.interactiveElements.filter((el) => el.tag === "a");
|
|
108
|
+
for (const link of links) {
|
|
109
|
+
if (!visitedSelectors.has(link.selector)) {
|
|
110
|
+
return {
|
|
111
|
+
action: "click",
|
|
112
|
+
selector: link.selector,
|
|
113
|
+
reasoning: `Deterministic fallback: clicking unvisited link "${link.text}"`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
return {
|
|
118
|
+
action: "done",
|
|
119
|
+
reasoning: "Deterministic fallback: all visible elements have been visited"
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
export {
|
|
124
|
+
ClaudeExplorationProvider
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=claude-exploration-provider-QJH6IPYU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/exploration/claude-exploration-provider.ts"],"sourcesContent":["import { execFile as execFileCb } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { ExplorationProvider } from '../ai/types.js';\nimport type { PageState, ExplorationActionLog, ExplorationDecision } from './types.js';\nimport { selectPayload } from './edge-cases.js';\n\nconst execFile = promisify(execFileCb);\n\nconst VALID_ACTIONS = new Set(['click', 'fill', 'navigate', 'scroll', 'done']);\n\n/**\n * Claude Code CLI-based ExplorationProvider.\n * Falls back to a deterministic heuristic if the CLI is unavailable.\n */\nexport class ClaudeExplorationProvider implements ExplorationProvider {\n async decideNextAction(\n pageState: PageState,\n history: ExplorationActionLog[],\n ): Promise<ExplorationDecision> {\n try {\n return await this.callClaude(pageState, history);\n } catch (err) {\n // Fallback on ENOENT (CLI not installed) or any other error\n if (\n err instanceof Error &&\n 'code' in err &&\n (err as NodeJS.ErrnoException).code === 'ENOENT'\n ) {\n return this.deterministicFallback(pageState, history);\n }\n // On any other error (timeout, parse failure, etc.), also fall back\n return this.deterministicFallback(pageState, history);\n }\n }\n\n private async callClaude(\n pageState: PageState,\n history: ExplorationActionLog[],\n ): Promise<ExplorationDecision> {\n const systemPrompt = `You are a chaos monkey exploring a web application to find bugs.\nYou will be given the current page state (URL, title, interactive elements, form fields) and recent action history.\nRespond with ONLY a JSON object matching this shape:\n{\n \"action\": \"click\" | \"fill\" | \"navigate\" | \"scroll\" | \"done\",\n \"selector\": \"CSS selector for click/fill targets\",\n \"value\": \"value to fill for fill actions — use edge-case data like XSS payloads, SQL injection, Unicode, boundary values\",\n \"url\": \"URL for navigate actions\",\n \"reasoning\": \"why you chose this action\"\n}\n\nPriorities:\n1. Fill form fields with hostile/edge-case values (XSS, SQLi, Unicode, boundary)\n2. Click submit buttons to trigger form validation\n3. Click buttons and interactive elements not yet visited\n4. Navigate to unvisited links\n5. Return {\"action\":\"done\",\"reasoning\":\"...\"} when all elements have been tested`;\n\n const recentHistory = history.slice(-5).map((h) => ({\n step: h.step,\n action: h.action,\n selector: h.target.selector,\n url: h.url,\n }));\n\n const userPrompt = JSON.stringify({\n currentPage: {\n url: pageState.url,\n title: pageState.title,\n interactiveElements: pageState.interactiveElements.slice(0, 20),\n formFields: pageState.formFields.slice(0, 15),\n },\n recentHistory,\n });\n\n const { stdout } = await execFile('claude', [\n '--print',\n '--output-format', 'json',\n '--system-prompt', systemPrompt,\n userPrompt,\n ], {\n timeout: 30_000,\n maxBuffer: 1024 * 1024,\n });\n\n // Parse Claude Code JSON envelope: {\"type\":\"result\",\"subtype\":\"success\",\"result\":\"...\"}\n const envelope = JSON.parse(stdout);\n const rawContent = envelope.result ?? stdout;\n\n // Extract JSON from the response (may contain markdown fences)\n const jsonStr = typeof rawContent === 'string'\n ? rawContent.replace(/```json?\\n?/g, '').replace(/```/g, '').trim()\n : JSON.stringify(rawContent);\n\n const decision = JSON.parse(jsonStr) as ExplorationDecision;\n\n // Validate decision shape (T-04-05: reject unknown action types)\n if (!decision.action || !VALID_ACTIONS.has(decision.action)) {\n return { action: 'done', reasoning: 'Invalid action type in AI response' };\n }\n\n if (!decision.reasoning) {\n decision.reasoning = 'AI provided no reasoning';\n }\n\n return decision;\n }\n\n /**\n * Deterministic fallback when Claude Code CLI is unavailable.\n * Strategy: fill first unfilled form field -> click first unvisited button -> navigate first unvisited link -> done.\n */\n private deterministicFallback(\n pageState: PageState,\n history: ExplorationActionLog[],\n ): ExplorationDecision {\n const stepIndex = history.length;\n const visitedSelectors = new Set(history.map((h) => h.target.selector));\n\n // 1. Fill first unfilled form field\n for (const field of pageState.formFields) {\n if (!visitedSelectors.has(field.selector)) {\n const { value } = selectPayload(field.type, stepIndex);\n return {\n action: 'fill',\n selector: field.selector,\n value,\n reasoning: `Deterministic fallback: filling form field \"${field.name}\" (${field.type}) with edge-case payload`,\n };\n }\n }\n\n // 2. Click first unvisited button/submit\n const buttons = pageState.interactiveElements.filter(\n (el) => el.tag === 'button' || el.type === 'submit',\n );\n for (const btn of buttons) {\n if (!visitedSelectors.has(btn.selector)) {\n return {\n action: 'click',\n selector: btn.selector,\n reasoning: `Deterministic fallback: clicking unvisited button \"${btn.text}\"`,\n };\n }\n }\n\n // 3. Navigate to first unvisited link\n const links = pageState.interactiveElements.filter((el) => el.tag === 'a');\n for (const link of links) {\n if (!visitedSelectors.has(link.selector)) {\n return {\n action: 'click',\n selector: link.selector,\n reasoning: `Deterministic fallback: clicking unvisited link \"${link.text}\"`,\n };\n }\n }\n\n // 4. Done — all elements visited\n return {\n action: 'done',\n reasoning: 'Deterministic fallback: all visible elements have been visited',\n };\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,YAAY,kBAAkB;AACvC,SAAS,iBAAiB;AAK1B,IAAM,WAAW,UAAU,UAAU;AAErC,IAAM,gBAAgB,oBAAI,IAAI,CAAC,SAAS,QAAQ,YAAY,UAAU,MAAM,CAAC;AAMtE,IAAM,4BAAN,MAA+D;AAAA,EACpE,MAAM,iBACJ,WACA,SAC8B;AAC9B,QAAI;AACF,aAAO,MAAM,KAAK,WAAW,WAAW,OAAO;AAAA,IACjD,SAAS,KAAK;AAEZ,UACE,eAAe,SACf,UAAU,OACT,IAA8B,SAAS,UACxC;AACA,eAAO,KAAK,sBAAsB,WAAW,OAAO;AAAA,MACtD;AAEA,aAAO,KAAK,sBAAsB,WAAW,OAA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|
|
3
|
+
// src/cli/index.ts
|
|
4
|
+
if (process.argv.includes("--mcp")) {
|
|
5
|
+
const { startMcpServer } = await import("../mcp/server.js");
|
|
6
|
+
await startMcpServer();
|
|
7
|
+
} else {
|
|
8
|
+
const { Command } = await import("commander");
|
|
9
|
+
async function ensurePlaywrightBrowsers() {
|
|
10
|
+
try {
|
|
11
|
+
const { chromium } = await import("playwright");
|
|
12
|
+
chromium.executablePath();
|
|
13
|
+
} catch {
|
|
14
|
+
const pc = (await import("picocolors")).default;
|
|
15
|
+
console.log(pc.yellow("\nPlaywright browsers not installed."));
|
|
16
|
+
console.log(pc.dim("Installing Chromium (required for browser testing)...\n"));
|
|
17
|
+
const { execSync } = await import("child_process");
|
|
18
|
+
try {
|
|
19
|
+
execSync("npx playwright install chromium", { stdio: "inherit" });
|
|
20
|
+
console.log("");
|
|
21
|
+
} catch {
|
|
22
|
+
console.error(pc.red("Failed to install Playwright browsers. Run manually: npx playwright install chromium"));
|
|
23
|
+
process.exit(1);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const program = new Command();
|
|
28
|
+
program.name("sniff").description("AI-powered QA testing framework").version("0.2.0");
|
|
29
|
+
program.argument("[target]", "Project directory to scan (default: current directory)").option("--url <url>", "Target URL \u2014 enables full audit (a11y, visual, perf, AI explorer)").option("--ci", "CI mode: headless, JUnit XML, flakiness tracking, no AI exploration").option("--no-browser", "Force source-only scan even if URL is configured").option("--no-explore", "Skip AI exploration (browser tests still run)").option("--max-steps <n>", "Cap AI exploration steps (default: 50)").option("--no-headless", "Show the browser window").option("--format <formats>", "Report formats: html, json, junit (comma-separated)").option("--fail-on <severities>", "Exit non-zero on these severities (default: critical,high)", "critical,high").option("--json", "Output results as JSON").option("--track-flakes", "Track test flakiness across runs").action(async (target, options) => {
|
|
30
|
+
const { unifiedCommand } = await import("../unified-CQU7PSNJ.js");
|
|
31
|
+
const { loadConfig } = await import("../loader-QII5CZSX.js");
|
|
32
|
+
const rootDir = target ? (await import("path")).resolve(target) : process.cwd();
|
|
33
|
+
const config = await loadConfig(rootDir);
|
|
34
|
+
const url = options.url ?? config.browser?.baseUrl;
|
|
35
|
+
const wantsBrowser = !!url && options.browser !== false;
|
|
36
|
+
const isCi = options.ci || !!process.env.CI;
|
|
37
|
+
const wantsExplore = wantsBrowser && options.explore !== false && !isCi;
|
|
38
|
+
if (wantsBrowser) {
|
|
39
|
+
await ensurePlaywrightBrowsers();
|
|
40
|
+
}
|
|
41
|
+
await unifiedCommand({
|
|
42
|
+
rootDir,
|
|
43
|
+
url: wantsBrowser ? url : void 0,
|
|
44
|
+
explore: wantsExplore,
|
|
45
|
+
maxSteps: options.maxSteps,
|
|
46
|
+
headless: options.headless,
|
|
47
|
+
format: options.format,
|
|
48
|
+
failOn: options.failOn,
|
|
49
|
+
json: options.json,
|
|
50
|
+
ci: options.ci,
|
|
51
|
+
trackFlakes: options.trackFlakes
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
program.command("init").description("Generate a sniff config file").option("--force", "Overwrite existing config").action(async (options) => {
|
|
55
|
+
const { initCommand } = await import("../init-75MMIW4A.js");
|
|
56
|
+
await initCommand(options);
|
|
57
|
+
});
|
|
58
|
+
program.command("ci").description("Generate a GitHub Actions workflow").option("--output <path>", "Output path for workflow file", ".github/workflows/sniff.yml").option("--force", "Overwrite existing workflow file").option("--package-name <name>", "npm package name for npx command", "sniff-qa").action(async (options) => {
|
|
59
|
+
const { ciCommand } = await import("../ci-2MVD2ISE.js");
|
|
60
|
+
await ciCommand(options);
|
|
61
|
+
});
|
|
62
|
+
program.command("report").description("View last scan results").option("--json", "Output as JSON").option("--format <formats>", "Regenerate report in specified formats (comma-separated: html,json,junit)").option("--output <dir>", "Output directory for regenerated reports").action(async (options) => {
|
|
63
|
+
const { reportCommand } = await import("../report-E2JZMQED.js");
|
|
64
|
+
await reportCommand(options);
|
|
65
|
+
});
|
|
66
|
+
program.command("update-baselines").description("Update visual regression baselines").option("--yes", "Skip confirmation prompt").action(async (options) => {
|
|
67
|
+
const { updateBaselinesCommand } = await import("../update-baselines-MDTCFO2U.js");
|
|
68
|
+
await updateBaselinesCommand(options);
|
|
69
|
+
});
|
|
70
|
+
await program.parseAsync();
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/cli/index.ts"],"sourcesContent":["#!/usr/bin/env node\n\n// MCP server mode bypasses CLI entirely\nif (process.argv.includes('--mcp')) {\n const { startMcpServer } = await import('../mcp/server.js');\n await startMcpServer();\n} else {\n const { Command } = await import('commander');\n\n async function ensurePlaywrightBrowsers(): Promise<void> {\n try {\n const { chromium } = await import('playwright');\n chromium.executablePath();\n } catch {\n const pc = (await import('picocolors')).default;\n console.log(pc.yellow('\\nPlaywright browsers not installed.'));\n console.log(pc.dim('Installing Chromium (required for browser testing)...\\n'));\n const { execSync } = await import('node:child_process');\n try {\n execSync('npx playwright install chromium', { stdio: 'inherit' });\n console.log('');\n } catch {\n console.error(pc.red('Failed to install Playwright browsers. Run manually: npx playwright install chromium'));\n process.exit(1);\n }\n }\n }\n\n const program = new Command();\n\n program\n .name('sniff')\n .description('AI-powered QA testing framework')\n .version('0.2.0');\n\n // ── Default command: unified scan ──────────────────────────────\n // `sniff` → source scan only\n // `sniff --url <url>` → everything (source + a11y + visual + perf + AI explore)\n // `sniff --url X --ci` → everything except exploration (deterministic for CI)\n program\n .argument('[target]', 'Project directory to scan (default: current directory)')\n .option('--url <url>', 'Target URL — enables full audit (a11y, visual, perf, AI explorer)')\n .option('--ci', 'CI mode: headless, JUnit XML, flakiness tracking, no AI exploration')\n .option('--no-browser', 'Force source-only scan even if URL is configured')\n .option('--no-explore', 'Skip AI exploration (browser tests still run)')\n .option('--max-steps <n>', 'Cap AI exploration steps (default: 50)')\n .option('--no-headless', 'Show the browser window')\n .option('--format <formats>', 'Report formats: html, json, junit (comma-separated)')\n .option('--fail-on <severities>', 'Exit non-zero on these severities (default: critical,high)', 'critical,high')\n .option('--json', 'Output results as JSON')\n .option('--track-flakes', 'Track test flakiness across runs')\n .action(async (target, options) => {\n const { unifiedCommand } = await import('./commands/unified.js');\n const { loadConfig } = await import('../config/loader.js');\n\n const rootDir = target ? (await import('node:path')).resolve(target) : process.cwd();\n const config = await loadConfig(rootDir);\n\n // URL resolution: flag → config → none\n const url = options.url ?? config.browser?.baseUrl;\n const wantsBrowser = !!url && options.browser !== false;\n\n // Exploration is default-ON when browser tests run, default-OFF in CI\n const isCi = options.ci || !!process.env.CI;\n const wantsExplore = wantsBrowser && options.explore !== false && !isCi;\n\n if (wantsBrowser) {\n await ensurePlaywrightBrowsers();\n }\n\n await unifiedCommand({\n rootDir,\n url: wantsBrowser ? url : undefined,\n explore: wantsExplore,\n maxSteps: options.maxSteps,\n headless: options.headless,\n format: options.format,\n failOn: options.failOn,\n json: options.json,\n ci: options.ci,\n trackFlakes: options.trackFlakes,\n });\n });\n\n // ── Utility commands ───────────────────────────────────────────\n\n program\n .command('init')\n .description('Generate a sniff config file')\n .option('--force', 'Overwrite existing config')\n .action(async (options) => {\n const { initCommand } = await import('./commands/init.js');\n await initCommand(options);\n });\n\n program\n .command('ci')\n .description('Generate a GitHub Actions workflow')\n .option('--output <path>', 'Output path for workflow file', '.github/workflows/sniff.yml')\n .option('--force', 'Overwrite existing workflow file')\n .option('--package-name <name>', 'npm package name for npx command', 'sniff-qa')\n .action(async (options) => {\n const { ciCommand } = await import('./commands/ci.js');\n await ciCommand(options);\n });\n\n program\n .command('report')\n .description('View last scan results')\n .option('--json', 'Output as JSON')\n .option('--format <formats>', 'Regenerate report in specified formats (comma-separated: html,json,junit)')\n .option('--output <dir>', 'Output directory for regenerated reports')\n .action(async (options) => {\n const { reportCommand } = await import('./commands/report.js');\n await reportCommand(options);\n });\n\n program\n .command('update-baselines')\n .description('Update visual regression baselines')\n .option('--yes', 'Skip confirmation prompt')\n .action(async (options) => {\n const { updateBaselinesCommand } = await import('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Y,wBAAwB,EACpC,OAAO,UAAU,gBAAgB,EACjC,OAAO,sBAAsB,2EAA2E,EACxG,OAAO,kBAAkB,0CAA0C,EACnE,OAAO,OAAO,YAAY;AACzB,UAAM,EAAE,cAAc,IAAI,MAAM,OAAO,uBAAsB;AAC7D,UAAM,cAAc,OAAO;AAAA,EAC7B,CAAC;AAEH,UACG,QAAQ,kBAAkB,EAC1B,YAAY,oCAAoC,EAChD,OAAO,SAAS,0BAA0B,EAC1C,OAAO,OAAO,YAAY;AACzB,UAAM,EAAE,uBAAuB,IAAI,MAAM,OAAO,iCAAgC;AAChF,UAAM,uBAAuB,OAAO;AAAA,EACtC,CAAC;AAEH,QAAM,QAAQ,WAAW;AAC3B;","names":[]}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
// src/analyzers/cross-reference.ts
|
|
2
|
+
var SEVERITY_ORDER = ["info", "low", "medium", "high", "critical"];
|
|
3
|
+
function bumpSeverity(current, steps = 1) {
|
|
4
|
+
const idx = SEVERITY_ORDER.indexOf(current);
|
|
5
|
+
const newIdx = Math.min(idx + steps, SEVERITY_ORDER.length - 1);
|
|
6
|
+
return SEVERITY_ORDER[newIdx];
|
|
7
|
+
}
|
|
8
|
+
var correlateImportsTo404s = (source, browser) => {
|
|
9
|
+
const results = [];
|
|
10
|
+
const importFindings = source.filter(
|
|
11
|
+
(f) => f.ruleId === "broken-import" || f.ruleId === "dead-link-internal"
|
|
12
|
+
);
|
|
13
|
+
const notFoundFindings = browser.filter(
|
|
14
|
+
(f) => /404|not\s*found/i.test(f.message) || /404|not\s*found/i.test(f.snippet)
|
|
15
|
+
);
|
|
16
|
+
for (const imp of importFindings) {
|
|
17
|
+
const pathMatch = imp.snippet.match(/['"`]([^'"`]+)['"`]/) ?? imp.snippet.match(/\]\(([^)]+)\)/) ?? imp.message.match(/:\s*(.+)$/);
|
|
18
|
+
const importPath = pathMatch?.[1]?.replace(/^\.\//, "") ?? "";
|
|
19
|
+
for (const nf of notFoundFindings) {
|
|
20
|
+
const browserPath = nf.snippet || nf.message;
|
|
21
|
+
if (importPath && browserPath.includes(importPath)) {
|
|
22
|
+
results.push({
|
|
23
|
+
ruleId: "corroborated-broken-resource",
|
|
24
|
+
severity: bumpSeverity(imp.severity),
|
|
25
|
+
message: `Broken resource confirmed in both source and browser: ${importPath}`,
|
|
26
|
+
filePath: imp.filePath,
|
|
27
|
+
line: imp.line,
|
|
28
|
+
column: imp.column,
|
|
29
|
+
snippet: imp.snippet,
|
|
30
|
+
corroboration: {
|
|
31
|
+
sourceEvidence: imp,
|
|
32
|
+
browserEvidence: nf,
|
|
33
|
+
correlation: "broken-import-to-404",
|
|
34
|
+
confidence: "high"
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return results;
|
|
41
|
+
};
|
|
42
|
+
var correlateConsoleStatements = (source, browser) => {
|
|
43
|
+
const results = [];
|
|
44
|
+
const consoleLogs = source.filter(
|
|
45
|
+
(f) => f.ruleId === "debug-console-log"
|
|
46
|
+
);
|
|
47
|
+
const browserConsole = browser.filter(
|
|
48
|
+
(f) => /console/i.test(f.ruleId) || /console\.\w+/i.test(f.message)
|
|
49
|
+
);
|
|
50
|
+
if (consoleLogs.length === 0 || browserConsole.length === 0) return results;
|
|
51
|
+
for (const src of consoleLogs) {
|
|
52
|
+
const logContent = src.snippet.match(/console\.\w+\s*\(\s*['"`]([^'"`]*)['"`]/)?.[1];
|
|
53
|
+
const match = logContent ? browserConsole.find((b) => b.message.includes(logContent) || b.snippet.includes(logContent)) : browserConsole[0];
|
|
54
|
+
if (match) {
|
|
55
|
+
results.push({
|
|
56
|
+
ruleId: "corroborated-debug-console",
|
|
57
|
+
severity: bumpSeverity(src.severity),
|
|
58
|
+
message: `Debug console.log confirmed at runtime: ${logContent ?? src.snippet}`,
|
|
59
|
+
filePath: src.filePath,
|
|
60
|
+
line: src.line,
|
|
61
|
+
column: src.column,
|
|
62
|
+
snippet: src.snippet,
|
|
63
|
+
corroboration: {
|
|
64
|
+
sourceEvidence: src,
|
|
65
|
+
browserEvidence: match,
|
|
66
|
+
correlation: "console-log-to-runtime",
|
|
67
|
+
confidence: logContent ? "high" : "medium"
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return results;
|
|
73
|
+
};
|
|
74
|
+
var correlateHardcodedUrls = (source, browser) => {
|
|
75
|
+
const results = [];
|
|
76
|
+
const hardcodedFindings = source.filter(
|
|
77
|
+
(f) => f.ruleId.startsWith("hardcoded-")
|
|
78
|
+
);
|
|
79
|
+
for (const hc of hardcodedFindings) {
|
|
80
|
+
const urlMatch = hc.snippet.match(/https?:\/\/[^\s'"`,)]+/);
|
|
81
|
+
if (!urlMatch) continue;
|
|
82
|
+
const url = urlMatch[0];
|
|
83
|
+
const browserMatch = browser.find(
|
|
84
|
+
(f) => f.message.includes(url) || f.snippet.includes(url) || "url" in f && f.url?.includes(url)
|
|
85
|
+
);
|
|
86
|
+
if (browserMatch) {
|
|
87
|
+
results.push({
|
|
88
|
+
ruleId: "corroborated-hardcoded-url",
|
|
89
|
+
severity: bumpSeverity(hc.severity),
|
|
90
|
+
message: `Hardcoded URL ${url} confirmed active at runtime`,
|
|
91
|
+
filePath: hc.filePath,
|
|
92
|
+
line: hc.line,
|
|
93
|
+
column: hc.column,
|
|
94
|
+
snippet: hc.snippet,
|
|
95
|
+
corroboration: {
|
|
96
|
+
sourceEvidence: hc,
|
|
97
|
+
browserEvidence: browserMatch,
|
|
98
|
+
correlation: "hardcoded-url-to-network",
|
|
99
|
+
confidence: "high"
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return results;
|
|
105
|
+
};
|
|
106
|
+
var correlateA11yViolations = (source, browser) => {
|
|
107
|
+
const results = [];
|
|
108
|
+
const sourceA11y = source.filter(
|
|
109
|
+
(f) => /label|aria|alt|role/i.test(f.message) || /placeholder/i.test(f.ruleId)
|
|
110
|
+
);
|
|
111
|
+
const browserA11y = browser.filter(
|
|
112
|
+
(f) => /label|aria|alt|role|form/i.test(f.ruleId) || /label|aria/i.test(f.message)
|
|
113
|
+
);
|
|
114
|
+
if (sourceA11y.length === 0 || browserA11y.length === 0) return results;
|
|
115
|
+
for (const src of sourceA11y) {
|
|
116
|
+
const match = browserA11y.find((b) => {
|
|
117
|
+
const srcElement = src.snippet.match(/<(\w+)/)?.[1]?.toLowerCase();
|
|
118
|
+
return srcElement && (b.message.toLowerCase().includes(srcElement) || b.snippet.toLowerCase().includes(srcElement));
|
|
119
|
+
});
|
|
120
|
+
if (match) {
|
|
121
|
+
results.push({
|
|
122
|
+
ruleId: "corroborated-a11y-violation",
|
|
123
|
+
severity: bumpSeverity(src.severity),
|
|
124
|
+
message: `Accessibility issue confirmed by axe-core: ${src.message}`,
|
|
125
|
+
filePath: src.filePath,
|
|
126
|
+
line: src.line,
|
|
127
|
+
column: src.column,
|
|
128
|
+
snippet: src.snippet,
|
|
129
|
+
corroboration: {
|
|
130
|
+
sourceEvidence: src,
|
|
131
|
+
browserEvidence: match,
|
|
132
|
+
correlation: "source-a11y-to-axe",
|
|
133
|
+
confidence: "medium"
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return results;
|
|
139
|
+
};
|
|
140
|
+
var correlatePlaceholders = (source, browser) => {
|
|
141
|
+
const results = [];
|
|
142
|
+
const placeholders = source.filter(
|
|
143
|
+
(f) => f.ruleId.startsWith("placeholder-")
|
|
144
|
+
);
|
|
145
|
+
for (const ph of placeholders) {
|
|
146
|
+
const isLorem = ph.ruleId === "placeholder-lorem";
|
|
147
|
+
const searchTerm = isLorem ? "lorem" : ph.ruleId.replace("placeholder-", "").toUpperCase();
|
|
148
|
+
const match = browser.find(
|
|
149
|
+
(f) => f.message.toLowerCase().includes(searchTerm.toLowerCase()) || f.snippet.toLowerCase().includes(searchTerm.toLowerCase())
|
|
150
|
+
);
|
|
151
|
+
if (match) {
|
|
152
|
+
results.push({
|
|
153
|
+
ruleId: "corroborated-placeholder",
|
|
154
|
+
severity: bumpSeverity(ph.severity),
|
|
155
|
+
message: `Placeholder text "${searchTerm}" visible at runtime`,
|
|
156
|
+
filePath: ph.filePath,
|
|
157
|
+
line: ph.line,
|
|
158
|
+
column: ph.column,
|
|
159
|
+
snippet: ph.snippet,
|
|
160
|
+
corroboration: {
|
|
161
|
+
sourceEvidence: ph,
|
|
162
|
+
browserEvidence: match,
|
|
163
|
+
correlation: "placeholder-to-runtime",
|
|
164
|
+
confidence: "medium"
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return results;
|
|
170
|
+
};
|
|
171
|
+
var ALL_STRATEGIES = [
|
|
172
|
+
correlateImportsTo404s,
|
|
173
|
+
correlateConsoleStatements,
|
|
174
|
+
correlateHardcodedUrls,
|
|
175
|
+
correlateA11yViolations,
|
|
176
|
+
correlatePlaceholders
|
|
177
|
+
];
|
|
178
|
+
function crossReference(sourceFindings, browserFindings) {
|
|
179
|
+
if (sourceFindings.length === 0 || browserFindings.length === 0) return [];
|
|
180
|
+
const allCorroborated = [];
|
|
181
|
+
for (const strategy of ALL_STRATEGIES) {
|
|
182
|
+
const matches = strategy(sourceFindings, browserFindings);
|
|
183
|
+
allCorroborated.push(...matches);
|
|
184
|
+
}
|
|
185
|
+
const seen = /* @__PURE__ */ new Set();
|
|
186
|
+
const deduped = [];
|
|
187
|
+
for (const finding of allCorroborated) {
|
|
188
|
+
const key = `${finding.corroboration.sourceEvidence.filePath}:${finding.corroboration.sourceEvidence.line}:${finding.corroboration.sourceEvidence.ruleId}`;
|
|
189
|
+
if (!seen.has(key)) {
|
|
190
|
+
seen.add(key);
|
|
191
|
+
deduped.push(finding);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
return deduped;
|
|
195
|
+
}
|
|
196
|
+
function crossReferenceSummary(corroborated) {
|
|
197
|
+
if (corroborated.length === 0) return null;
|
|
198
|
+
const byCorrelation = /* @__PURE__ */ new Map();
|
|
199
|
+
for (const f of corroborated) {
|
|
200
|
+
const key = f.corroboration.correlation;
|
|
201
|
+
byCorrelation.set(key, (byCorrelation.get(key) ?? 0) + 1);
|
|
202
|
+
}
|
|
203
|
+
const details = [...byCorrelation.entries()].map(([type, count]) => `${type}: ${count}`).join(", ");
|
|
204
|
+
return {
|
|
205
|
+
ruleId: "cross-reference-summary",
|
|
206
|
+
severity: "info",
|
|
207
|
+
message: `Cross-referenced ${corroborated.length} finding(s) with both source and browser evidence (${details})`,
|
|
208
|
+
filePath: "",
|
|
209
|
+
line: 0,
|
|
210
|
+
column: 0,
|
|
211
|
+
snippet: ""
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
export {
|
|
215
|
+
crossReference,
|
|
216
|
+
crossReferenceSummary
|
|
217
|
+
};
|
|
218
|
+
//# sourceMappingURL=cross-reference-MHNPSLEN.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/analyzers/cross-reference.ts"],"sourcesContent":["import type { Finding, BrowserFinding, Severity } from '../core/types.js';\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\nexport interface CorrelationMatch {\n sourceRule: string;\n browserRule: string;\n description: string;\n}\n\nexport interface CorroboratedFinding extends Finding {\n corroboration: {\n sourceEvidence: Finding;\n browserEvidence: Finding;\n correlation: string;\n confidence: 'high' | 'medium';\n };\n}\n\n// ---------------------------------------------------------------------------\n// Severity bump logic\n// ---------------------------------------------------------------------------\n\nconst SEVERITY_ORDER: Severity[] = ['info', 'low', 'medium', 'high', 'critical'];\n\nfunction bumpSeverity(current: Severity, steps: number = 1): Severity {\n const idx = SEVERITY_ORDER.indexOf(current);\n const newIdx = Math.min(idx + steps, SEVERITY_ORDER.length - 1);\n return SEVERITY_ORDER[newIdx];\n}\n\n// ---------------------------------------------------------------------------\n// Correlation strategies\n// ---------------------------------------------------------------------------\n\ntype CorrelationStrategy = (\n sourceFindings: Finding[],\n browserFindings: Finding[],\n) => CorroboratedFinding[];\n\n/**\n * Broken import in source -> 404 network request in browser\n * Source: broken-import or dead-link-internal rule\n * Browser: finding with \"404\" or \"not found\" in message/snippet\n */\nconst correlateImportsTo404s: CorrelationStrategy = (source, browser) => {\n const results: CorroboratedFinding[] = [];\n\n const importFindings = source.filter(\n (f) => f.ruleId === 'broken-import' || f.ruleId === 'dead-link-internal',\n );\n\n const notFoundFindings = browser.filter(\n (f) => /404|not\\s*found/i.test(f.message) || /404|not\\s*found/i.test(f.snippet),\n );\n\n for (const imp of importFindings) {\n // Extract the path/URL from the import finding\n // Try quoted strings first, then markdown link syntax, then the message\n const pathMatch = imp.snippet.match(/['\"`]([^'\"`]+)['\"`]/)\n ?? imp.snippet.match(/\\]\\(([^)]+)\\)/)\n ?? imp.message.match(/:\\s*(.+)$/);\n const importPath = pathMatch?.[1]?.replace(/^\\.\\//, '') ?? '';\n\n for (const nf of notFoundFindings) {\n // Check if the browser 404 references a similar path\n const browserPath = nf.snippet || nf.message;\n if (importPath && browserPath.includes(importPath)) {\n results.push({\n ruleId: 'corroborated-broken-resource',\n severity: bumpSeverity(imp.severity),\n message: `Broken resource confirmed in both source and browser: ${importPath}`,\n filePath: imp.filePath,\n line: imp.line,\n column: imp.column,\n snippet: imp.snippet,\n corroboration: {\n sourceEvidence: imp,\n browserEvidence: nf,\n correlation: 'broken-import-to-404',\n confidence: 'high',\n },\n });\n }\n }\n }\n\n return results;\n};\n\n/**\n * Console.log in source -> console output captured in browser\n * Source: debug-console-log rule\n * Browser: finding with \"console\" in ruleId or message\n */\nconst correlateConsoleStatements: CorrelationStrategy = (source, browser) => {\n const results: CorroboratedFinding[] = [];\n\n const consoleLogs = source.filter(\n (f) => f.ruleId === 'debug-console-log',\n );\n\n const browserConsole = browser.filter(\n (f) => /console/i.test(f.ruleId) || /console\\.\\w+/i.test(f.message),\n );\n\n if (consoleLogs.length === 0 || browserConsole.length === 0) return results;\n\n // If both exist, correlate them (exact line matching is impractical\n // since browser captures runtime output, not source locations)\n for (const src of consoleLogs) {\n // Try to find a matching browser console entry\n const logContent = src.snippet.match(/console\\.\\w+\\s*\\(\\s*['\"`]([^'\"`]*)['\"`]/)?.[1];\n\n const match = logContent\n ? browserConsole.find((b) => b.message.includes(logContent) || b.snippet.includes(logContent))\n : browserConsole[0]; // Fall back to first browser console finding\n\n if (match) {\n results.push({\n ruleId: 'corroborated-debug-console',\n severity: bumpSeverity(src.severity),\n message: `Debug console.log confirmed at runtime: ${logContent ?? src.snippet}`,\n filePath: src.filePath,\n line: src.line,\n column: src.column,\n snippet: src.snippet,\n corroboration: {\n sourceEvidence: src,\n browserEvidence: match,\n correlation: 'console-log-to-runtime',\n confidence: logContent ? 'high' : 'medium',\n },\n });\n }\n }\n\n return results;\n};\n\n/**\n * Hardcoded URL in source -> that URL appearing in network log\n * Source: hardcoded-localhost or hardcoded-127 rule\n * Browser: any finding referencing the same URL pattern\n */\nconst correlateHardcodedUrls: CorrelationStrategy = (source, browser) => {\n const results: CorroboratedFinding[] = [];\n\n const hardcodedFindings = source.filter(\n (f) => f.ruleId.startsWith('hardcoded-'),\n );\n\n for (const hc of hardcodedFindings) {\n // Extract the URL from the snippet\n const urlMatch = hc.snippet.match(/https?:\\/\\/[^\\s'\"`,)]+/);\n if (!urlMatch) continue;\n const url = urlMatch[0];\n\n // Check if any browser finding references this URL\n const browserMatch = browser.find(\n (f) => f.message.includes(url) || f.snippet.includes(url)\n || ('url' in f && (f as BrowserFinding).url?.includes(url)),\n );\n\n if (browserMatch) {\n results.push({\n ruleId: 'corroborated-hardcoded-url',\n severity: bumpSeverity(hc.severity),\n message: `Hardcoded URL ${url} confirmed active at runtime`,\n filePath: hc.filePath,\n line: hc.line,\n column: hc.column,\n snippet: hc.snippet,\n corroboration: {\n sourceEvidence: hc,\n browserEvidence: browserMatch,\n correlation: 'hardcoded-url-to-network',\n confidence: 'high',\n },\n });\n }\n }\n\n return results;\n};\n\n/**\n * Missing form label in source (JSX without htmlFor) -> axe-core violation\n * Source: any finding about labels, htmlFor, or accessibility\n * Browser: axe-core violations (ruleId contains 'label' or 'aria')\n */\nconst correlateA11yViolations: CorrelationStrategy = (source, browser) => {\n const results: CorroboratedFinding[] = [];\n\n // Source findings about placeholder text, missing attributes\n const sourceA11y = source.filter(\n (f) => /label|aria|alt|role/i.test(f.message) || /placeholder/i.test(f.ruleId),\n );\n\n // Browser axe-core findings about labels\n const browserA11y = browser.filter(\n (f) => /label|aria|alt|role|form/i.test(f.ruleId) || /label|aria/i.test(f.message),\n );\n\n if (sourceA11y.length === 0 || browserA11y.length === 0) return results;\n\n // Try to match source file findings to browser accessibility violations\n for (const src of sourceA11y) {\n // Find browser findings that reference similar elements\n const match = browserA11y.find((b) => {\n // Match by element type or component name\n const srcElement = src.snippet.match(/<(\\w+)/)?.[1]?.toLowerCase();\n return srcElement && (\n b.message.toLowerCase().includes(srcElement)\n || b.snippet.toLowerCase().includes(srcElement)\n );\n });\n\n if (match) {\n results.push({\n ruleId: 'corroborated-a11y-violation',\n severity: bumpSeverity(src.severity),\n message: `Accessibility issue confirmed by axe-core: ${src.message}`,\n filePath: src.filePath,\n line: src.line,\n column: src.column,\n snippet: src.snippet,\n corroboration: {\n sourceEvidence: src,\n browserEvidence: match,\n correlation: 'source-a11y-to-axe',\n confidence: 'medium',\n },\n });\n }\n }\n\n return results;\n};\n\n/**\n * Placeholder text in source -> visible in browser screenshot\n * Source: placeholder-lorem or placeholder-tbd\n * Browser: any finding that references similar text\n */\nconst correlatePlaceholders: CorrelationStrategy = (source, browser) => {\n const results: CorroboratedFinding[] = [];\n\n const placeholders = source.filter(\n (f) => f.ruleId.startsWith('placeholder-'),\n );\n\n for (const ph of placeholders) {\n // Extract the placeholder text\n const isLorem = ph.ruleId === 'placeholder-lorem';\n const searchTerm = isLorem ? 'lorem' : ph.ruleId.replace('placeholder-', '').toUpperCase();\n\n const match = browser.find(\n (f) => f.message.toLowerCase().includes(searchTerm.toLowerCase())\n || f.snippet.toLowerCase().includes(searchTerm.toLowerCase()),\n );\n\n if (match) {\n results.push({\n ruleId: 'corroborated-placeholder',\n severity: bumpSeverity(ph.severity),\n message: `Placeholder text \"${searchTerm}\" visible at runtime`,\n filePath: ph.filePath,\n line: ph.line,\n column: ph.column,\n snippet: ph.snippet,\n corroboration: {\n sourceEvidence: ph,\n browserEvidence: match,\n correlation: 'placeholder-to-runtime',\n confidence: 'medium',\n },\n });\n }\n }\n\n return results;\n};\n\n// ---------------------------------------------------------------------------\n// All strategies\n// ---------------------------------------------------------------------------\n\nconst ALL_STRATEGIES: CorrelationStrategy[] = [\n correlateImportsTo404s,\n correlateConsoleStatements,\n correlateHardcodedUrls,\n correlateA11yViolations,\n correlatePlaceholders,\n];\n\n// ---------------------------------------------------------------------------\n// Public API\n// ---------------------------------------------------------------------------\n\n/**\n * Cross-reference source scan findings with browser scan findings.\n * Produces corroborated findings with higher confidence and bumped severity.\n *\n * Call this after both source and browser scans have completed.\n */\nexport function crossReference(\n sourceFindings: Finding[],\n browserFindings: Finding[],\n): CorroboratedFinding[] {\n if (sourceFindings.length === 0 || browserFindings.length === 0) return [];\n\n const allCorroborated: CorroboratedFinding[] = [];\n\n for (const strategy of ALL_STRATEGIES) {\n const matches = strategy(sourceFindings, browserFindings);\n allCorroborated.push(...matches);\n }\n\n // Deduplicate: same source finding should only be corroborated once\n const seen = new Set<string>();\n const deduped: CorroboratedFinding[] = [];\n\n for (const finding of allCorroborated) {\n const key = `${finding.corroboration.sourceEvidence.filePath}:${finding.corroboration.sourceEvidence.line}:${finding.corroboration.sourceEvidence.ruleId}`;\n if (!seen.has(key)) {\n seen.add(key);\n deduped.push(finding);\n }\n }\n\n return deduped;\n}\n\n/**\n * Returns a summary finding describing the cross-reference results.\n */\nexport function crossReferenceSummary(corroborated: CorroboratedFinding[]): Finding | null {\n if (corroborated.length === 0) return null;\n\n const byCorrelation = new Map<string, number>();\n for (const f of corroborated) {\n const key = f.corroboration.correlation;\n byCorrelation.set(key, (byCorrelation.get(key) ?? 0) + 1);\n }\n\n const details = [...byCorrelation.entries()]\n .map(([type, count]) => `${type}: ${count}`)\n .join(', ');\n\n return {\n ruleId: 'cross-reference-summary',\n severity: 'info',\n message: `Cross-referenced ${corroborated.length} finding(s) with both source and browser evidence (${details})`,\n filePath: '',\n line: 0,\n column: 0,\n snippet: '',\n };\n}\n"],"mappings":";AAyBA,IAAM,iBAA6B,CAAC,QAAQ,OAAO,UAAU,QAAQ,UAAU;AAE/E,SAAS,aAAa,SAAmB,QAAgB,GAAa;AACpE,QAAM,MAAM,eAAe,QAAQ,OAAO;AAC1C,QAAM,SAAS,KAAK,IAAI,MAAM,OAAO,eAAe,SAAS,CAAC;AAC9D,SAAO,eAAe,MAAM;AAC9B;AAgBA,IAAM,yBAA8C,CAAC,QAAQ,YAAY;AACvE,QAAM,UAAiC,CAAC;AAExC,QAAM,iBAAiB,OAAO;AAAA,IAC5B,CAAC,MAAM,EAAE,WAAW,mBAAmB,EAAE,WAAW;AAAA,EACtD;AAEA,QAAM,mBAAmB,QAAQ;AAAA,IAC/B,CAAC,MAAM,mBAAmB,KAAK,EAAE,OAAO,KAAK,mBAAmB,KAAK,EAAE,OAAO;AAAA,EAChF;AAEA,aAAW,OAAO,gBAAgB;AAGhC,UAAM,YAAY,IAAI,QAAQ,MAAM,qBAAqB,KACpD,IAAI,QAAQ,MAAM,eAAe,KACjC,IAAI,QAAQ,MAAM,WAAW;AAClC,UAAM,aAAa,YAAY,CAAC,GAAG,QAAQ,SAAS,EAAE,KAAK;AAE3D,eAAW,MAAM,kBAAkB;AAEjC,YAAM,cAAc,GAAG,WAAW,GAAG;AACrC,UAAI,cAAc,YAAY,SAAS,UAAU,GAAG;AAClD,gBAAQ,KAAK;AAAA,UACX,QAAQ;AAAA,UACR,UAAU,aAAa,IAAI,QAAQ;AAAA,UACnC,SAAS,yDAAyD,UAAU;AAAA,UAC5E,UAAU,IAAI;AA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