sniff-qa 0.3.0 → 0.5.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/README.md +75 -5
- package/dist/classifier-MWQMQ727.js +1701 -0
- package/dist/classifier-MWQMQ727.js.map +1 -0
- package/dist/cli/index.js +92 -27
- package/dist/cli/index.js.map +1 -1
- package/dist/dev-server-detector-XQ5AYPDT.js +319 -0
- package/dist/dev-server-detector-XQ5AYPDT.js.map +1 -0
- package/dist/discover-JRU5E4FR.js +327 -0
- package/dist/discover-JRU5E4FR.js.map +1 -0
- package/dist/domain-UQ34YE4B.js +1817 -0
- package/dist/domain-UQ34YE4B.js.map +1 -0
- package/dist/edge-cases-ZADKDZHL.js +246 -0
- package/dist/edge-cases-ZADKDZHL.js.map +1 -0
- package/dist/ensure-browsers-ACHCEQCT.js +60 -0
- package/dist/ensure-browsers-ACHCEQCT.js.map +1 -0
- package/dist/flakiness-OLJAY7CS.js +53 -0
- package/dist/flakiness-OLJAY7CS.js.map +1 -0
- package/dist/init-IQKT4ANC.js +148 -0
- package/dist/init-IQKT4ANC.js.map +1 -0
- package/dist/llm-VJAI6H6G.js +126 -0
- package/dist/llm-VJAI6H6G.js.map +1 -0
- package/dist/mcp/server.js +219 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/persistence-KTCRIGHU.js +270 -0
- package/dist/persistence-KTCRIGHU.js.map +1 -0
- package/dist/{repo-analyzer-WK5WP7NT.js → repo-analyzer-4OURSITY.js} +1 -1
- package/dist/{report-WLDV72FM.js → report-IKRVVIW4.js} +1 -1
- package/dist/report-SDZWX25B.js +280 -0
- package/dist/report-SDZWX25B.js.map +1 -0
- package/dist/runner-OYTN2NFD.js +996 -0
- package/dist/runner-OYTN2NFD.js.map +1 -0
- package/dist/scenarios-I7YYVTD2.js +987 -0
- package/dist/scenarios-I7YYVTD2.js.map +1 -0
- package/dist/tiebreak-L5UFNKU2.js +60 -0
- package/dist/tiebreak-L5UFNKU2.js.map +1 -0
- package/dist/{unified-7RKNG3EI.js → unified-JCUBP6UO.js} +2 -2
- package/package.json +2 -2
- package/dist/dev-server-detector-NJ5RN4IC.js +0 -150
- package/dist/dev-server-detector-NJ5RN4IC.js.map +0 -1
- package/dist/init-75MMIW4A.js +0 -66
- package/dist/init-75MMIW4A.js.map +0 -1
- /package/dist/{repo-analyzer-WK5WP7NT.js.map → repo-analyzer-4OURSITY.js.map} +0 -0
- /package/dist/{report-WLDV72FM.js.map → report-IKRVVIW4.js.map} +0 -0
- /package/dist/{unified-7RKNG3EI.js.map → unified-JCUBP6UO.js.map} +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// src/core/ensure-browsers.ts
|
|
2
|
+
var CHROMIUM_INSTALL_SIZE_MB = 165;
|
|
3
|
+
async function checkPlaywrightBrowsers() {
|
|
4
|
+
try {
|
|
5
|
+
const { chromium } = await import("playwright");
|
|
6
|
+
chromium.executablePath();
|
|
7
|
+
return { status: "installed" };
|
|
8
|
+
} catch (e) {
|
|
9
|
+
if (e instanceof Error && /Executable doesn't exist|browserType\.executablePath/i.test(e.message)) {
|
|
10
|
+
return {
|
|
11
|
+
status: "missing",
|
|
12
|
+
installCommand: "npx playwright install chromium",
|
|
13
|
+
installSizeMb: CHROMIUM_INSTALL_SIZE_MB
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
status: "missing",
|
|
18
|
+
installCommand: "npx playwright install chromium",
|
|
19
|
+
installSizeMb: CHROMIUM_INSTALL_SIZE_MB
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async function ensurePlaywrightBrowsers() {
|
|
24
|
+
const check = await checkPlaywrightBrowsers();
|
|
25
|
+
if (check.status === "installed") return;
|
|
26
|
+
const pc = (await import("picocolors")).default;
|
|
27
|
+
console.log(pc.yellow("\nPlaywright browsers not installed."));
|
|
28
|
+
console.log(pc.dim(`Installing Chromium (~${CHROMIUM_INSTALL_SIZE_MB}MB, one-time)...
|
|
29
|
+
`));
|
|
30
|
+
const { execSync } = await import("child_process");
|
|
31
|
+
try {
|
|
32
|
+
execSync("npx playwright install chromium", { stdio: "inherit" });
|
|
33
|
+
console.log("");
|
|
34
|
+
} catch {
|
|
35
|
+
console.error(
|
|
36
|
+
pc.red(
|
|
37
|
+
"Failed to install Playwright browsers. Run manually: npx playwright install chromium"
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
async function installPlaywrightBrowsers() {
|
|
44
|
+
const { execSync } = await import("child_process");
|
|
45
|
+
try {
|
|
46
|
+
execSync("npx playwright install chromium", { stdio: "pipe" });
|
|
47
|
+
return { status: "ok" };
|
|
48
|
+
} catch (e) {
|
|
49
|
+
return {
|
|
50
|
+
status: "failed",
|
|
51
|
+
error: e instanceof Error ? e.message : "unknown error"
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
export {
|
|
56
|
+
checkPlaywrightBrowsers,
|
|
57
|
+
ensurePlaywrightBrowsers,
|
|
58
|
+
installPlaywrightBrowsers
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=ensure-browsers-ACHCEQCT.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\nexport type BrowserCheckStatus =\n | { status: 'installed' }\n | { status: 'missing'; installCommand: string; installSizeMb: number }\n | { status: 'error'; error: string };\n\nconst CHROMIUM_INSTALL_SIZE_MB = 165;\n\n/**\n * Non-invasive check. Does NOT install. Safe to call from MCP handlers.\n */\nexport async function checkPlaywrightBrowsers(): Promise<BrowserCheckStatus> {\n try {\n const { chromium } = await import('playwright');\n // executablePath throws if the binary isn't present.\n chromium.executablePath();\n return { status: 'installed' };\n } catch (e) {\n if (e instanceof Error && /Executable doesn't exist|browserType\\.executablePath/i.test(e.message)) {\n return {\n status: 'missing',\n installCommand: 'npx playwright install chromium',\n installSizeMb: CHROMIUM_INSTALL_SIZE_MB,\n };\n }\n // playwright itself not installed, or something else — expose as missing\n return {\n status: 'missing',\n installCommand: 'npx playwright install chromium',\n installSizeMb: CHROMIUM_INSTALL_SIZE_MB,\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(): Promise<void> {\n const check = await checkPlaywrightBrowsers();\n if (check.status === 'installed') return;\n\n const pc = (await import('picocolors')).default;\n console.log(pc.yellow('\\nPlaywright browsers not installed.'));\n console.log(pc.dim(`Installing Chromium (~${CHROMIUM_INSTALL_SIZE_MB}MB, one-time)...\\n`));\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(\n pc.red(\n 'Failed to install Playwright browsers. Run manually: npx playwright install chromium',\n ),\n );\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 const { execSync } = await import('node:child_process');\n try {\n execSync('npx playwright install chromium', { stdio: 'pipe' });\n return { status: 'ok' };\n } catch (e) {\n return {\n status: 'failed',\n error: e instanceof Error ? e.message : 'unknown error',\n };\n }\n}\n"],"mappings":";AAaA,IAAM,2BAA2B;AAKjC,eAAsB,0BAAuD;AAC3E,MAAI;AACF,UAAM,EAAE,SAAS,IAAI,MAAM,OAAO,YA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+
// src/discovery/report/flakiness.ts
|
|
6
|
+
function buildScenarioTestId(scenarioId, baseUrl) {
|
|
7
|
+
return `discovery::${scenarioId}::${baseUrl}`;
|
|
8
|
+
}
|
|
9
|
+
function buildScenarioTestRunRecords(report, runId, baseUrl) {
|
|
10
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
11
|
+
const records = [];
|
|
12
|
+
for (const result of report.scenarios) {
|
|
13
|
+
if (result.status === "skip") continue;
|
|
14
|
+
records.push({
|
|
15
|
+
runId,
|
|
16
|
+
timestamp,
|
|
17
|
+
testId: buildScenarioTestId(result.scenario.id, baseUrl),
|
|
18
|
+
passed: result.status === "pass",
|
|
19
|
+
duration: result.durationMs
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return records;
|
|
23
|
+
}
|
|
24
|
+
function markQuarantinedScenarios(report, history, baseUrl, options = {}) {
|
|
25
|
+
const windowSize = options.windowSize ?? 5;
|
|
26
|
+
const threshold = options.threshold ?? 3;
|
|
27
|
+
const scenarios = report.scenarios.map((result) => {
|
|
28
|
+
if (result.status !== "fail") return result;
|
|
29
|
+
const testId = buildScenarioTestId(result.scenario.id, baseUrl);
|
|
30
|
+
const flake = computeFlakeStatus(history, testId, windowSize, threshold);
|
|
31
|
+
if (!flake.isFlaky) return result;
|
|
32
|
+
return {
|
|
33
|
+
...result,
|
|
34
|
+
quarantined: true,
|
|
35
|
+
quarantineReason: `quarantined: ${flake.failureCount}/${flake.runCount} recent runs failed`
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
const stats = {
|
|
39
|
+
...report.stats,
|
|
40
|
+
quarantined: scenarios.filter((s) => s.quarantined === true).length
|
|
41
|
+
};
|
|
42
|
+
return { ...report, scenarios, stats };
|
|
43
|
+
}
|
|
44
|
+
function shouldFailCi(report) {
|
|
45
|
+
return report.scenarios.some((s) => s.status === "fail" && s.quarantined !== true);
|
|
46
|
+
}
|
|
47
|
+
export {
|
|
48
|
+
buildScenarioTestId,
|
|
49
|
+
buildScenarioTestRunRecords,
|
|
50
|
+
markQuarantinedScenarios,
|
|
51
|
+
shouldFailCi
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=flakiness-OLJAY7CS.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/discovery/report/flakiness.ts"],"sourcesContent":["import type { FlakinessHistory, TestRunRecord } from '../../core/types.js';\nimport { computeFlakeStatus } from '../../core/flakiness.js';\nimport type { DiscoveryReport, ScenarioResult } from '../run-types.js';\n\nexport function buildScenarioTestId(scenarioId: string, baseUrl: string): string {\n return `discovery::${scenarioId}::${baseUrl}`;\n}\n\nexport function buildScenarioTestRunRecords(\n report: DiscoveryReport,\n runId: string,\n baseUrl: string,\n): TestRunRecord[] {\n const timestamp = new Date().toISOString();\n const records: TestRunRecord[] = [];\n\n for (const result of report.scenarios) {\n if (result.status === 'skip') continue;\n records.push({\n runId,\n timestamp,\n testId: buildScenarioTestId(result.scenario.id, baseUrl),\n passed: result.status === 'pass',\n duration: result.durationMs,\n });\n }\n\n return records;\n}\n\nexport interface QuarantineOptions {\n windowSize?: number;\n threshold?: number;\n}\n\nexport function markQuarantinedScenarios(\n report: DiscoveryReport,\n history: FlakinessHistory,\n baseUrl: string,\n options: QuarantineOptions = {},\n): DiscoveryReport {\n const windowSize = options.windowSize ?? 5;\n const threshold = options.threshold ?? 3;\n\n const scenarios: ScenarioResult[] = report.scenarios.map((result) => {\n if (result.status !== 'fail') return result;\n const testId = buildScenarioTestId(result.scenario.id, baseUrl);\n const flake = computeFlakeStatus(history, testId, windowSize, threshold);\n if (!flake.isFlaky) return result;\n return {\n ...result,\n quarantined: true,\n quarantineReason: `quarantined: ${flake.failureCount}/${flake.runCount} recent runs failed`,\n };\n });\n\n const stats = {\n ...report.stats,\n quarantined: scenarios.filter((s) => s.quarantined === true).length,\n };\n\n return { ...report, scenarios, stats };\n}\n\nexport function shouldFailCi(report: DiscoveryReport): boolean {\n return report.scenarios.some((s) =>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IAAI;AACnF;","names":[]}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
// src/cli/commands/init.ts
|
|
2
|
+
import { writeFile, readFile, access } from "fs/promises";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
var CONFIG_TEMPLATE_TS = `import { defineConfig } from 'sniff-qa';
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
// Severity threshold for CLI exit code
|
|
8
|
+
// failOn: ['critical', 'high'],
|
|
9
|
+
|
|
10
|
+
// File patterns to exclude from scanning
|
|
11
|
+
// exclude: ['node_modules/**', 'dist/**'],
|
|
12
|
+
|
|
13
|
+
// Rule configuration
|
|
14
|
+
// rules: {
|
|
15
|
+
// 'placeholder-lorem': 'off',
|
|
16
|
+
// 'placeholder-todo': 'medium',
|
|
17
|
+
// },
|
|
18
|
+
});
|
|
19
|
+
`;
|
|
20
|
+
var CONFIG_TEMPLATE_ESM = `import { defineConfig } from 'sniff-qa';
|
|
21
|
+
|
|
22
|
+
export default defineConfig({
|
|
23
|
+
// Severity threshold for CLI exit code
|
|
24
|
+
// failOn: ['critical', 'high'],
|
|
25
|
+
|
|
26
|
+
// File patterns to exclude from scanning
|
|
27
|
+
// exclude: ['node_modules/**', 'dist/**'],
|
|
28
|
+
|
|
29
|
+
// Rule configuration
|
|
30
|
+
// rules: {
|
|
31
|
+
// 'placeholder-lorem': 'off',
|
|
32
|
+
// 'placeholder-todo': 'medium',
|
|
33
|
+
// },
|
|
34
|
+
});
|
|
35
|
+
`;
|
|
36
|
+
var CONFIG_TEMPLATE_CJS = `const { defineConfig } = require('sniff-qa');
|
|
37
|
+
|
|
38
|
+
module.exports = defineConfig({
|
|
39
|
+
// Severity threshold for CLI exit code
|
|
40
|
+
// failOn: ['critical', 'high'],
|
|
41
|
+
|
|
42
|
+
// File patterns to exclude from scanning
|
|
43
|
+
// exclude: ['node_modules/**', 'dist/**'],
|
|
44
|
+
|
|
45
|
+
// Rule configuration
|
|
46
|
+
// rules: {
|
|
47
|
+
// 'placeholder-lorem': 'off',
|
|
48
|
+
// 'placeholder-todo': 'medium',
|
|
49
|
+
// },
|
|
50
|
+
});
|
|
51
|
+
`;
|
|
52
|
+
async function detectInitFlavor(cwd) {
|
|
53
|
+
const pkgPath = join(cwd, "package.json");
|
|
54
|
+
let pkg = {};
|
|
55
|
+
try {
|
|
56
|
+
pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
|
|
57
|
+
} catch {
|
|
58
|
+
}
|
|
59
|
+
const deps = { ...pkg.dependencies ?? {}, ...pkg.devDependencies ?? {} };
|
|
60
|
+
const hasTypescriptDep = "typescript" in deps;
|
|
61
|
+
let hasTsconfig = false;
|
|
62
|
+
try {
|
|
63
|
+
await access(join(cwd, "tsconfig.json"));
|
|
64
|
+
hasTsconfig = true;
|
|
65
|
+
} catch {
|
|
66
|
+
}
|
|
67
|
+
if (hasTypescriptDep || hasTsconfig) return "ts";
|
|
68
|
+
if (pkg.type === "module") return "esm";
|
|
69
|
+
return "cjs";
|
|
70
|
+
}
|
|
71
|
+
function templateFor(flavor) {
|
|
72
|
+
switch (flavor) {
|
|
73
|
+
case "ts":
|
|
74
|
+
return CONFIG_TEMPLATE_TS;
|
|
75
|
+
case "esm":
|
|
76
|
+
return CONFIG_TEMPLATE_ESM;
|
|
77
|
+
case "cjs":
|
|
78
|
+
return CONFIG_TEMPLATE_CJS;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
function filenameFor(flavor) {
|
|
82
|
+
switch (flavor) {
|
|
83
|
+
case "ts":
|
|
84
|
+
return "sniff.config.ts";
|
|
85
|
+
case "esm":
|
|
86
|
+
return "sniff.config.mjs";
|
|
87
|
+
case "cjs":
|
|
88
|
+
return "sniff.config.js";
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
async function initCommand(options) {
|
|
92
|
+
const { cosmiconfig } = await import("cosmiconfig");
|
|
93
|
+
const cwd = process.cwd();
|
|
94
|
+
const explorer = cosmiconfig("sniff", {
|
|
95
|
+
searchPlaces: [
|
|
96
|
+
"package.json",
|
|
97
|
+
".sniffrc",
|
|
98
|
+
".sniffrc.json",
|
|
99
|
+
".sniffrc.yaml",
|
|
100
|
+
".sniffrc.yml",
|
|
101
|
+
".sniffrc.js",
|
|
102
|
+
".sniffrc.ts",
|
|
103
|
+
".sniffrc.cjs",
|
|
104
|
+
".sniffrc.mjs",
|
|
105
|
+
"sniff.config.js",
|
|
106
|
+
"sniff.config.ts",
|
|
107
|
+
"sniff.config.cjs",
|
|
108
|
+
"sniff.config.mjs"
|
|
109
|
+
]
|
|
110
|
+
});
|
|
111
|
+
const existing = await explorer.search(cwd);
|
|
112
|
+
if (existing && !options.force) {
|
|
113
|
+
console.log(
|
|
114
|
+
`Config already exists at ${existing.filepath}. Use --force to overwrite.`
|
|
115
|
+
);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
let flavor;
|
|
119
|
+
if (options.ts) {
|
|
120
|
+
flavor = "ts";
|
|
121
|
+
} else if (options.js) {
|
|
122
|
+
const detected = await detectInitFlavor(cwd);
|
|
123
|
+
flavor = detected === "ts" ? "esm" : detected;
|
|
124
|
+
} else {
|
|
125
|
+
flavor = await detectInitFlavor(cwd);
|
|
126
|
+
}
|
|
127
|
+
const filename = filenameFor(flavor);
|
|
128
|
+
const configPath = join(cwd, filename);
|
|
129
|
+
await writeFile(configPath, templateFor(flavor));
|
|
130
|
+
console.log(`Created ${filename} (${flavor} flavor)`);
|
|
131
|
+
const gitignorePath = join(cwd, ".gitignore");
|
|
132
|
+
try {
|
|
133
|
+
await access(gitignorePath);
|
|
134
|
+
const content = await readFile(gitignorePath, "utf-8");
|
|
135
|
+
if (!content.includes(".sniff")) {
|
|
136
|
+
await writeFile(gitignorePath, content.trimEnd() + "\n.sniff/\n");
|
|
137
|
+
console.log("Added .sniff/ to .gitignore");
|
|
138
|
+
}
|
|
139
|
+
} catch {
|
|
140
|
+
await writeFile(gitignorePath, ".sniff/\n");
|
|
141
|
+
console.log("Added .sniff/ to .gitignore");
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
export {
|
|
145
|
+
detectInitFlavor,
|
|
146
|
+
initCommand
|
|
147
|
+
};
|
|
148
|
+
//# sourceMappingURL=init-IQKT4ANC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/cli/commands/init.ts"],"sourcesContent":["import { writeFile, readFile, access } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nconst CONFIG_TEMPLATE_TS = `import { defineConfig } from 'sniff-qa';\n\nexport default defineConfig({\n // Severity threshold for CLI exit code\n // failOn: ['critical', 'high'],\n\n // File patterns to exclude from scanning\n // exclude: ['node_modules/**', 'dist/**'],\n\n // Rule configuration\n // rules: {\n // 'placeholder-lorem': 'off',\n // 'placeholder-todo': 'medium',\n // },\n});\n`;\n\nconst CONFIG_TEMPLATE_ESM = `import { defineConfig } from 'sniff-qa';\n\nexport default defineConfig({\n // Severity threshold for CLI exit code\n // failOn: ['critical', 'high'],\n\n // File patterns to exclude from scanning\n // exclude: ['node_modules/**', 'dist/**'],\n\n // Rule configuration\n // rules: {\n // 'placeholder-lorem': 'off',\n // 'placeholder-todo': 'medium',\n // },\n});\n`;\n\nconst CONFIG_TEMPLATE_CJS = `const { defineConfig } = require('sniff-qa');\n\nmodule.exports = defineConfig({\n // Severity threshold for CLI exit code\n // failOn: ['critical', 'high'],\n\n // File patterns to exclude from scanning\n // exclude: ['node_modules/**', 'dist/**'],\n\n // Rule configuration\n // rules: {\n // 'placeholder-lorem': 'off',\n // 'placeholder-todo': 'medium',\n // },\n});\n`;\n\nexport type InitFlavor = 'ts' | 'esm' | 'cjs';\n\n/**\n * Detect which flavor to write based on the project.\n * - TypeScript project (tsconfig.json or typescript dep) → .ts\n * - ESM project (package.json \"type\": \"module\") → .js ESM\n * - Anything else → .js CJS\n */\nexport async function detectInitFlavor(cwd: string): Promise<InitFlavor> {\n const pkgPath = join(cwd, 'package.json');\n let pkg: Record<string, unknown> = {};\n try {\n pkg = JSON.parse(await readFile(pkgPath, 'utf-8'));\n } catch {\n // no package.json — default to plain JS\n }\n\n const deps = { ...(pkg.dependencies as Record<string, string> ?? {}), ...(pkg.devDependencies as Record<string, string> ?? {}) };\n const hasTypescriptDep = 'typescript' in deps;\n\n let hasTsconfig = false;\n try {\n await access(join(cwd, 'tsconfig.json'));\n hasTsconfig = true;\n } catch {\n // ok\n }\n\n if (hasTypescriptDep || hasTsconfig) return 'ts';\n if (pkg.type === 'module') return 'esm';\n return 'cjs';\n}\n\nfunction templateFor(flavor: InitFlavor): string {\n switch (flavor) {\n case 'ts':\n return CONFIG_TEMPLATE_TS;\n case 'esm':\n return CONFIG_TEMPLATE_ESM;\n case 'cjs':\n return CONFIG_TEMPLATE_CJS;\n }\n}\n\nfunction filenameFor(flavor: InitFlavor): string {\n switch (flavor) {\n case 'ts':\n return 'sniff.config.ts';\n case 'esm':\n return 'sniff.config.mjs';\n case 'cjs':\n return 'sniff.config.js';\n }\n}\n\nexport interface InitCommandOptions {\n force?: boolean;\n ts?: boolean;\n js?: boolean;\n}\n\nexport async function initCommand(options: InitCommandOptions): Promise<void> {\n const { cosmiconfig } = await import('cosmiconfig');\n const cwd = process.cwd();\n\n // Check for existing config\n const explorer = cosmiconfig('sniff', {\n searchPlaces: [\n 'package.json',\n '.sniffrc',\n '.sniffrc.json',\n '.sniffrc.yaml',\n '.sniffrc.yml',\n '.sniffrc.js',\n '.sniffrc.ts',\n '.sniffrc.cjs',\n '.sniffrc.mjs',\n 'sniff.config.js',\n 'sniff.config.ts',\n 'sniff.config.cjs',\n 'sniff.config.mjs',\n ],\n });\n\n const existing = await explorer.search(cwd);\n if (existing && !options.force) {\n console.log(\n `Config already exists at ${existing.filepath}. Use --force to overwrite.`,\n );\n return;\n }\n\n // Flag overrides auto-detect\n let flavor: InitFlavor;\n if (options.ts) {\n flavor = 'ts';\n } else if (options.js) {\n // --js respects the ESM/CJS shape\n const detected = await detectInitFlavor(cwd);\n flavor = detected === 'ts' ? 'esm' : detected;\n } else {\n flavor = await detectInitFlavor(cwd);\n }\n\n const filename = filenameFor(flavor);\n const configPath = join(cwd, filename);\n await writeFile(configPath, templateFor(flavor));\n console.log(`Created ${filename} (${flavor} flavor)`);\n\n // Handle .gitignore\n const gitignorePath = join(cwd, '.gitignore');\n try {\n await access(gitignorePath);\n const content = await readFile(gitignorePath, 'utf-8');\n if (!content.includes('.sniff')) {\n await writeFile(gitignorePath, content.trimEnd() + '\\n.sniff/\\n');\n console.log('Added .sniff/ to .gitignore');\n }\n } catch {\n await writeFile(gitignorePath, '.sniff/\\n');\n console.log('Added .sniff/ to .gitignore');\n }\n}\n"],"mappings":";AAAA,SAAS,WAAW,UAAU,cAAc;AAC5C,SAAS,YAAY;AAErB,IAAM,qBAAqB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB3B,IAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiB5B,IAAM,sBAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyB5B,eAAsB,iBAAiB,KAAkC;AACvE,QAAM,UAAU,KAAK,KAAK,cAAc;AACxC,MAAI,MAA+B,CAAC;AACpC,MAAI;AACF,UAAM,KAAK,MAAM,MAAM,SAAS,SAAS,OAAO,CAAC;AAAA,EACnD,QAAQ;AAAA,EAER;AAEA,QAAM,OAAO,EAAE,GAAI,IAAI,gBAA0C,CAAC,GAAI,GAAI,IAAI,mBAA6C,CAAC,EAAG;AAC/H,QAAM,mBAAmB,gBAAgB;AAEzC,MAAI,cAAc;AAClB,MAAI;AACF,UAAM,OAAO,KAAK,KAAK,eAAe,CAAC;AACvC,kBAAc;AAAA,EAChB,QAAQ;AAAA,EAER;AAEA,MA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AM,gBAAgB,KAAK,KAAK,YAAY;AAC5C,MAAI;AACF,UAAM,OAAO,aAAa;AAC1B,UAAM,UAAU,MAAM,SAAS,eAAe,OAAO;AACrD,QAAI,CAAC,QAAQ,SAAS,QAAQ,GAAG;AAC/B,YAAM,UAAU,eAAe,QAAQ,QAAQ,IAAI,aAAa;AAChE,cAAQ,IAAI,6BAA6B;AAAA,IAC3C;AAAA,EACF,QAAQ;AACN,UAAM,UAAU,eAAe,WAAW;AAC1C,YAAQ,IAAI,6BAA6B;AAAA,EAC3C;AACF;","names":[]}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// src/discovery/llm/cache.ts
|
|
2
|
+
import { createHash } from "crypto";
|
|
3
|
+
import { mkdir, readFile, writeFile } from "fs/promises";
|
|
4
|
+
import { join } from "path";
|
|
5
|
+
function keyFor(system, user, purpose) {
|
|
6
|
+
return createHash("sha256").update(`${purpose}::${system}::${user}`, "utf-8").digest("hex");
|
|
7
|
+
}
|
|
8
|
+
async function readLlmCache(input) {
|
|
9
|
+
const key = keyFor(input.system, input.user, input.purpose);
|
|
10
|
+
const path = join(input.rootDir, input.cacheDir, `${key}.json`);
|
|
11
|
+
try {
|
|
12
|
+
const raw = await readFile(path, "utf-8");
|
|
13
|
+
const parsed = JSON.parse(raw);
|
|
14
|
+
return typeof parsed.response === "string" ? parsed.response : null;
|
|
15
|
+
} catch {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function writeLlmCache(input, response) {
|
|
20
|
+
const key = keyFor(input.system, input.user, input.purpose);
|
|
21
|
+
const dir = join(input.rootDir, input.cacheDir);
|
|
22
|
+
await mkdir(dir, { recursive: true });
|
|
23
|
+
const path = join(dir, `${key}.json`);
|
|
24
|
+
await writeFile(
|
|
25
|
+
path,
|
|
26
|
+
JSON.stringify({ purpose: input.purpose, response, cachedAt: (/* @__PURE__ */ new Date()).toISOString() }, null, 2),
|
|
27
|
+
"utf-8"
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// src/discovery/llm/cached-provider.ts
|
|
32
|
+
var CachedDiscoveryLLM = class {
|
|
33
|
+
constructor(inner, options) {
|
|
34
|
+
this.inner = inner;
|
|
35
|
+
this.options = options;
|
|
36
|
+
this.name = `${inner.name}+cache`;
|
|
37
|
+
}
|
|
38
|
+
inner;
|
|
39
|
+
options;
|
|
40
|
+
name;
|
|
41
|
+
available() {
|
|
42
|
+
return this.inner.available();
|
|
43
|
+
}
|
|
44
|
+
async complete(request) {
|
|
45
|
+
const hit = await readLlmCache({
|
|
46
|
+
rootDir: this.options.rootDir,
|
|
47
|
+
cacheDir: this.options.cacheDir,
|
|
48
|
+
system: request.system,
|
|
49
|
+
user: request.user,
|
|
50
|
+
purpose: request.purpose
|
|
51
|
+
});
|
|
52
|
+
if (hit !== null) return hit;
|
|
53
|
+
const fresh = await this.inner.complete(request);
|
|
54
|
+
await writeLlmCache(
|
|
55
|
+
{
|
|
56
|
+
rootDir: this.options.rootDir,
|
|
57
|
+
cacheDir: this.options.cacheDir,
|
|
58
|
+
system: request.system,
|
|
59
|
+
user: request.user,
|
|
60
|
+
purpose: request.purpose
|
|
61
|
+
},
|
|
62
|
+
fresh
|
|
63
|
+
);
|
|
64
|
+
return fresh;
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
// src/discovery/llm/claude-code.ts
|
|
69
|
+
import { execFile as execFileCb } from "child_process";
|
|
70
|
+
import { promisify } from "util";
|
|
71
|
+
var execFile = promisify(execFileCb);
|
|
72
|
+
var ClaudeCodeLLM = class {
|
|
73
|
+
name = "claude-code-cli";
|
|
74
|
+
cliPath;
|
|
75
|
+
timeoutMs;
|
|
76
|
+
maxBufferBytes;
|
|
77
|
+
constructor(options = {}) {
|
|
78
|
+
this.cliPath = options.cliPath ?? "claude";
|
|
79
|
+
this.timeoutMs = options.timeoutMs ?? 6e4;
|
|
80
|
+
this.maxBufferBytes = options.maxBufferBytes ?? 1024 * 1024 * 2;
|
|
81
|
+
}
|
|
82
|
+
async available() {
|
|
83
|
+
try {
|
|
84
|
+
await execFile(this.cliPath, ["--version"], { timeout: 3e3, maxBuffer: 1024 * 64 });
|
|
85
|
+
return true;
|
|
86
|
+
} catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
async complete(request) {
|
|
91
|
+
const { stdout } = await execFile(
|
|
92
|
+
this.cliPath,
|
|
93
|
+
[
|
|
94
|
+
"--print",
|
|
95
|
+
"--output-format",
|
|
96
|
+
"json",
|
|
97
|
+
"--system-prompt",
|
|
98
|
+
request.system,
|
|
99
|
+
request.user
|
|
100
|
+
],
|
|
101
|
+
{ timeout: this.timeoutMs, maxBuffer: this.maxBufferBytes }
|
|
102
|
+
);
|
|
103
|
+
try {
|
|
104
|
+
const parsed = JSON.parse(stdout);
|
|
105
|
+
return typeof parsed.result === "string" ? parsed.result : stdout;
|
|
106
|
+
} catch {
|
|
107
|
+
return stdout;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/discovery/llm/index.ts
|
|
113
|
+
async function resolveDiscoveryLLM(options) {
|
|
114
|
+
const inner = new ClaudeCodeLLM(options.cliPath ? { cliPath: options.cliPath } : {});
|
|
115
|
+
if (!await inner.available()) return null;
|
|
116
|
+
return new CachedDiscoveryLLM(inner, { rootDir: options.rootDir, cacheDir: options.cacheDir });
|
|
117
|
+
}
|
|
118
|
+
export {
|
|
119
|
+
CachedDiscoveryLLM,
|
|
120
|
+
ClaudeCodeLLM,
|
|
121
|
+
keyFor as cacheKeyFor,
|
|
122
|
+
readLlmCache,
|
|
123
|
+
resolveDiscoveryLLM,
|
|
124
|
+
writeLlmCache
|
|
125
|
+
};
|
|
126
|
+
//# sourceMappingURL=llm-VJAI6H6G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/discovery/llm/cache.ts","../src/discovery/llm/cached-provider.ts","../src/discovery/llm/claude-code.ts","../src/discovery/llm/index.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport { mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nfunction keyFor(system: string, user: string, purpose: string): string {\n return createHash('sha256').update(`${purpose}::${system}::${user}`, 'utf-8').digest('hex');\n}\n\nexport interface CacheLookupInput {\n rootDir: string;\n cacheDir: string;\n system: string;\n user: string;\n purpose: string;\n}\n\nexport async function readLlmCache(input: CacheLookupInput): Promise<string | null> {\n const key = keyFor(input.system, input.user, input.purpose);\n const path = join(input.rootDir, input.cacheDir, `${key}.json`);\n try {\n const raw = await readFile(path, 'utf-8');\n const parsed = JSON.parse(raw) as { response?: string };\n return typeof parsed.response === 'string' ? parsed.response : null;\n } catch {\n return null;\n }\n}\n\nexport async function writeLlmCache(input: CacheLookupInput, response: string): Promise<void> {\n const key = keyFor(input.system, input.user, input.purpose);\n const dir = join(input.rootDir, input.cacheDir);\n await mkdir(dir, { recursive: true });\n const path = join(dir, `${key}.json`);\n await writeFile(\n path,\n JSON.stringify({ purpose: input.purpose, response, cachedAt: new Date().toISOString() }, null, 2),\n 'utf-8',\n );\n}\n\nexport { keyFor as cacheKeyFor };\n","import { readLlmCache, writeLlmCache } from './cache.js';\nimport type { DiscoveryLLM, LLMCompleteRequest } from './types.js';\n\nexport interface CachedProviderOptions {\n rootDir: string;\n cacheDir: string;\n}\n\nexport class CachedDiscoveryLLM implements DiscoveryLLM {\n readonly name: string;\n\n constructor(private readonly inner: DiscoveryLLM, private readonly options: CachedProviderOptions) {\n this.name = `${inner.name}+cache`;\n }\n\n available(): Promise<boolean> {\n return this.inner.available();\n }\n\n async complete(request: LLMCompleteRequest): Promise<string> {\n const hit = await readLlmCache({\n rootDir: this.options.rootDir,\n cacheDir: this.options.cacheDir,\n system: request.system,\n user: request.user,\n purpose: request.purpose,\n });\n if (hit !== null) return hit;\n\n const fresh = await this.inner.complete(request);\n await writeLlmCache(\n {\n rootDir: this.options.rootDir,\n cacheDir: this.options.cacheDir,\n system: request.system,\n user: request.user,\n purpose: request.purpose,\n },\n fresh,\n );\n return fresh;\n }\n}\n","import { execFile as execFileCb } from 'node:child_process';\nimport { promisify } from 'node:util';\nimport type { DiscoveryLLM, LLMCompleteRequest } from './types.js';\n\nconst execFile = promisify(execFileCb);\n\nexport interface ClaudeCodeLLMOptions {\n cliPath?: string;\n timeoutMs?: number;\n maxBufferBytes?: number;\n}\n\nexport class ClaudeCodeLLM implements DiscoveryLLM {\n readonly name = 'claude-code-cli';\n private readonly cliPath: string;\n private readonly timeoutMs: number;\n private readonly maxBufferBytes: number;\n\n constructor(options: ClaudeCodeLLMOptions = {}) {\n this.cliPath = options.cliPath ?? 'claude';\n this.timeoutMs = options.timeoutMs ?? 60_000;\n this.maxBufferBytes = options.maxBufferBytes ?? 1024 * 1024 * 2;\n }\n\n async available(): Promise<boolean> {\n try {\n await execFile(this.cliPath, ['--version'], { timeout: 3_000, maxBuffer: 1024 * 64 });\n return true;\n } catch {\n return false;\n }\n }\n\n async complete(request: LLMCompleteRequest): Promise<string> {\n const { stdout } = await execFile(\n this.cliPath,\n [\n '--print',\n '--output-format',\n 'json',\n '--system-prompt',\n request.system,\n request.user,\n ],\n { timeout: this.timeoutMs, maxBuffer: this.maxBufferBytes },\n );\n\n try {\n const parsed = JSON.parse(stdout) as { result?: string };\n return typeof parsed.result === 'string' ? parsed.result : stdout;\n } catch {\n return stdout;\n }\n }\n}\n","import { CachedDiscoveryLLM } from './cached-provider.js';\nimport { ClaudeCodeLLM } from './claude-code.js';\nimport type { DiscoveryLLM } from './types.js';\n\nexport interface ResolveOptions {\n rootDir: string;\n cacheDir: string;\n cliPath?: string;\n}\n\nexport async function resolveDiscoveryLLM(options: ResolveOptions): Promise<DiscoveryLLM | null> {\n const inner = new ClaudeCodeLLM(options.cliPath ? { cliPath: options.cliPath } : {});\n if (!(await inner.available())) return null;\n return new CachedDiscoveryLLM(inner, { rootDir: options.rootDir, cacheDir: options.cacheDir });\n}\n\nexport { ClaudeCodeLLM } from './claude-code.js';\nexport { CachedDiscoveryLLM } from './cached-provider.js';\nexport { readLlmCache, writeLlmCache, cacheKeyFor } from './cache.js';\nexport type { DiscoveryLLM, LLMCompleteRequest } from './types.js';\n"],"mappings":";AAAA,SAAS,kBAAkB;AAC3B,SAAS,OAAO,UAAU,iBAAiB;AAC3C,SAAS,YAAY;AAErB,SAAS,OAAO,QAAgB,MAAc,SAAyB;AACrE,SAAO,WAAW,QAAQ,EAAE,OAAO,GAAG,OAAO,KAAK,MAAM,KAAK,IAAI,IAAI,OAAO,EAAE,OAAO,KAAK;AAC5F;AAUA,eAAsB,aAAa,OAAiD;AAClF,QAAM,MAAM,OAAO,MAAM,QAAQ,MAAM,MAAM,MAAM,OAAO;AAC1D,QAAM,OAAO,KAAK,MAAM,SAAS,MAAM,UAAU,GAAG,GAAG,OAAO;AAC9D,MAAI;AACF,UAAM,MAAM,MAAM,SAAS,MAAM,OAAO;AACxC,UAAM,SAAS,KAAK,MAAM,GAAG;AAC7B,WAAO,OAAO,OAAO,aAAa,WAAW,OAAO,WAAW;AAAA,EACjE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,cAAc,OAAyB,UAAiC;AAC5F,QAAM,MAAM,OAAO,MAAM,QAAQ,MAAM,MAAM,MAAM,OAAO;AAC1D,QAAM,MAAM,KAAK,MAAM,SAAS,MAAM,QAAQ;AAC9C,QAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AACpC,QAAM,OAAO,KAAK,KAAK,GAAG,GAAG,OAAO;AACpC,QAAM;AAAA,IACJ;AAAA,IACA,KAAK,UAAU,EAAE,SAAS,MAAM,SAAS,UAAU,WAAU,oBAAI,KAAK,GAAE,YAAY,EAAE,GAAG,MAAM,CAAC;AAAA,IAChG;AAAA,EACF;AACF;;;AC9BO,IAAM,qBAAN,MAAiD;AAAA,EAGtD,YAA6B,OAAsC,SAAgC;AAAtE;AAAsC;AACjE,S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