@neuralaxis/vibedoctor 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/README.md +135 -23
  2. package/dist/adapters/biome.js +136 -21
  3. package/dist/adapters/flowDoctor.d.ts +7 -0
  4. package/dist/adapters/flowDoctor.js +195 -0
  5. package/dist/adapters/gitleaks.js +4 -2
  6. package/dist/adapters/index.d.ts +1 -0
  7. package/dist/adapters/index.js +3 -1
  8. package/dist/adapters/osvScanner.js +140 -19
  9. package/dist/adapters/presidio.js +3 -1
  10. package/dist/adapters/ruff.js +7 -3
  11. package/dist/adapters/shared.d.ts +4 -0
  12. package/dist/cli/commands/init.js +112 -50
  13. package/dist/cli/commands/privacyReview.js +3 -4
  14. package/dist/cli/commands/scan.d.ts +6 -0
  15. package/dist/cli/commands/scan.js +16 -2
  16. package/dist/cli/commands/setup.d.ts +13 -17
  17. package/dist/cli/commands/setup.js +138 -200
  18. package/dist/cli/index.js +4 -4
  19. package/dist/core/agentDiagnosis.d.ts +39 -0
  20. package/dist/core/agentDiagnosis.js +96 -0
  21. package/dist/core/capability.d.ts +92 -0
  22. package/dist/core/capability.js +122 -0
  23. package/dist/core/config.d.ts +47 -0
  24. package/dist/core/config.js +134 -3
  25. package/dist/core/credentialHeuristics.d.ts +28 -0
  26. package/dist/core/credentialHeuristics.js +179 -0
  27. package/dist/core/engine.d.ts +29 -1
  28. package/dist/core/engine.js +510 -126
  29. package/dist/core/executable.d.ts +18 -0
  30. package/dist/core/executable.js +137 -0
  31. package/dist/core/fileRole.d.ts +24 -0
  32. package/dist/core/fileRole.js +125 -0
  33. package/dist/core/finding.d.ts +125 -1
  34. package/dist/core/finding.js +70 -8
  35. package/dist/core/findingCorrelator.d.ts +19 -0
  36. package/dist/core/findingCorrelator.js +112 -0
  37. package/dist/core/findingNormalizer.d.ts +33 -0
  38. package/dist/core/findingNormalizer.js +172 -0
  39. package/dist/core/managedTools.d.ts +25 -0
  40. package/dist/core/managedTools.js +186 -0
  41. package/dist/core/projectDetector.d.ts +13 -0
  42. package/dist/core/projectDetector.js +100 -15
  43. package/dist/core/relevance.d.ts +87 -0
  44. package/dist/core/relevance.js +367 -0
  45. package/dist/core/repoGraph.d.ts +62 -0
  46. package/dist/core/repoGraph.js +408 -0
  47. package/dist/core/riskRanker.d.ts +6 -0
  48. package/dist/core/riskRanker.js +127 -0
  49. package/dist/core/scanContext.d.ts +26 -0
  50. package/dist/core/scanContext.js +44 -0
  51. package/dist/core/scanPlanner.d.ts +13 -0
  52. package/dist/core/scanPlanner.js +66 -38
  53. package/dist/core/semverLite.d.ts +27 -0
  54. package/dist/core/semverLite.js +163 -0
  55. package/dist/core/suppressions.d.ts +96 -0
  56. package/dist/core/suppressions.js +302 -0
  57. package/dist/core/toolRegistry.d.ts +58 -0
  58. package/dist/core/toolRegistry.js +254 -0
  59. package/dist/core/toolRunner.d.ts +27 -2
  60. package/dist/core/toolRunner.js +79 -93
  61. package/dist/core/toolRuntime.d.ts +40 -0
  62. package/dist/core/toolRuntime.js +417 -0
  63. package/dist/core/toolVerification.d.ts +89 -0
  64. package/dist/core/toolVerification.js +425 -0
  65. package/dist/dpdp/collectors/optionalScanners.js +120 -30
  66. package/dist/dpdp/findings.d.ts +33 -3
  67. package/dist/dpdp/findings.js +191 -4
  68. package/dist/dpdp/scan.js +2 -2
  69. package/dist/dpdp/scoring.d.ts +14 -4
  70. package/dist/dpdp/scoring.js +34 -8
  71. package/dist/dpdp/types.d.ts +19 -1
  72. package/dist/index.d.ts +5 -0
  73. package/dist/index.js +5 -0
  74. package/dist/reporters/agent.d.ts +1 -1
  75. package/dist/reporters/agent.js +7 -0
  76. package/dist/reporters/html.js +57 -13
  77. package/dist/reporters/json.js +7 -1
  78. package/dist/reporters/markdown.js +46 -4
  79. package/dist/reporters/sarif.js +54 -5
  80. package/package.json +80 -80
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.inferRootCause = inferRootCause;
4
+ exports.correlateFindings = correlateFindings;
5
+ exports.locationKeyForTests = locationKeyForTests;
6
+ const severityMap_1 = require("../rules/severityMap");
7
+ function locationKey(finding) {
8
+ if (!finding.file || finding.startLine === undefined) {
9
+ return undefined;
10
+ }
11
+ return `${finding.file}:${finding.startLine}`;
12
+ }
13
+ function token(finding) {
14
+ return (finding.evidence?.toolRawId ?? finding.title).toLowerCase().replace(/\s+/g, " ").trim();
15
+ }
16
+ function sameProblem(left, right) {
17
+ if (left.id === right.id) {
18
+ return true;
19
+ }
20
+ const corroborated = left.corroboratedBy?.includes(right.source) || right.corroboratedBy?.includes(left.source);
21
+ if (left.category !== right.category) {
22
+ return Boolean(corroborated && left.file && left.file === right.file);
23
+ }
24
+ if (left.file && left.file === right.file) {
25
+ const lineClose = left.startLine !== undefined &&
26
+ right.startLine !== undefined &&
27
+ Math.abs(left.startLine - right.startLine) <= 2;
28
+ if (lineClose) {
29
+ return true;
30
+ }
31
+ if (token(left) && token(left) === token(right)) {
32
+ return true;
33
+ }
34
+ }
35
+ if (corroborated) {
36
+ return left.file === right.file;
37
+ }
38
+ return false;
39
+ }
40
+ function pickCanonical(findings) {
41
+ return [...findings].sort((left, right) => {
42
+ const severityDelta = severityMap_1.severityRank[right.severity] - severityMap_1.severityRank[left.severity];
43
+ if (severityDelta !== 0) {
44
+ return severityDelta;
45
+ }
46
+ return left.id.localeCompare(right.id);
47
+ })[0];
48
+ }
49
+ function inferRootCause(finding) {
50
+ if (finding.source === "gitleaks") {
51
+ return "A secret or credential-like value is committed in source.";
52
+ }
53
+ if (finding.source === "osv-scanner") {
54
+ return "A declared dependency has a known advisory.";
55
+ }
56
+ if (finding.source === "flow-doctor") {
57
+ return finding.message;
58
+ }
59
+ if (finding.source === "tsc" || finding.source === "pyright") {
60
+ return "The type checker rejected this location.";
61
+ }
62
+ if (finding.category === "tests") {
63
+ return "A test suite reported a failure.";
64
+ }
65
+ return finding.message;
66
+ }
67
+ function correlateFindings(findings) {
68
+ const remaining = [...findings];
69
+ const groups = [];
70
+ while (remaining.length > 0) {
71
+ const seed = remaining.shift();
72
+ const group = [seed];
73
+ for (let index = remaining.length - 1; index >= 0; index -= 1) {
74
+ if (group.some((member) => sameProblem(member, remaining[index]))) {
75
+ group.push(remaining.splice(index, 1)[0]);
76
+ }
77
+ }
78
+ groups.push(group);
79
+ }
80
+ return groups
81
+ .map((members, index) => {
82
+ const canonical = pickCanonical(members);
83
+ const engines = Array.from(new Set(members.map((member) => member.source))).sort();
84
+ const locations = members
85
+ .map((member) => ({ file: member.file, startLine: member.startLine, endLine: member.endLine }))
86
+ .filter((location, locationIndex, all) => {
87
+ const key = `${location.file ?? ""}:${location.startLine ?? ""}`;
88
+ return all.findIndex((candidate) => `${candidate.file ?? ""}:${candidate.startLine ?? ""}` === key) === locationIndex;
89
+ })
90
+ .sort((left, right) => `${left.file}:${left.startLine ?? 0}`.localeCompare(`${right.file}:${right.startLine ?? 0}`));
91
+ return {
92
+ id: `rcg-${String(index + 1).padStart(3, "0")}`,
93
+ title: canonical.title,
94
+ severity: canonical.severity,
95
+ category: canonical.category,
96
+ findingIds: members.map((member) => member.id).sort(),
97
+ supportingEngines: engines,
98
+ likelyRootCause: inferRootCause(canonical),
99
+ locations
100
+ };
101
+ })
102
+ .sort((left, right) => {
103
+ const severityDelta = severityMap_1.severityRank[right.severity] - severityMap_1.severityRank[left.severity];
104
+ if (severityDelta !== 0) {
105
+ return severityDelta;
106
+ }
107
+ return left.id.localeCompare(right.id);
108
+ });
109
+ }
110
+ function locationKeyForTests(finding) {
111
+ return locationKey(finding);
112
+ }
@@ -0,0 +1,33 @@
1
+ import type { FileRoleClassifier } from "./fileRole";
2
+ import { type Finding } from "./finding";
3
+ /**
4
+ * Normalizes whatever adapters produce into a consistent finding.
5
+ *
6
+ * Adapters translate tool output by hand, so each one can lose a different thing:
7
+ * one drops line numbers because its tool reports byte offsets, another emits a
8
+ * severity string the report has no rendering for. The losses were invisible —
9
+ * the report simply had no location, and nothing said why. This pass fills in
10
+ * what can be recovered, records how precise each location actually is, and
11
+ * counts what could not be recovered so the capability matrix can disclose it.
12
+ */
13
+ export type NormalizationIssue = {
14
+ tool: string;
15
+ kind: "missing_location" | "unresolved_offset" | "invalid_enum" | "missing_message";
16
+ count: number;
17
+ detail: string;
18
+ };
19
+ export type NormalizationResult = {
20
+ findings: Finding[];
21
+ issues: NormalizationIssue[];
22
+ /** Share of findings from this tool with no usable position, 0..1. */
23
+ locationLossRate: number;
24
+ };
25
+ export type NormalizeOptions = {
26
+ root: string;
27
+ tool: string;
28
+ classifyFile: FileRoleClassifier;
29
+ changedFiles?: string[];
30
+ };
31
+ export declare function normalizeFindings(raw: Finding[], options: NormalizeOptions): Promise<NormalizationResult>;
32
+ /** Human-readable summary of what a tool's output lost, for the capability matrix. */
33
+ export declare function describeNormalizationIssues(issues: NormalizationIssue[]): string | undefined;
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.normalizeFindings = normalizeFindings;
7
+ exports.describeNormalizationIssues = describeNormalizationIssues;
8
+ const node_fs_1 = require("node:fs");
9
+ const node_path_1 = __importDefault(require("node:path"));
10
+ const finding_1 = require("./finding");
11
+ /**
12
+ * Default evidence grade per source. A tool that reports what the compiler
13
+ * proved is not making the same kind of claim as one matching a regex against
14
+ * identifiers, and the report should not present them identically.
15
+ */
16
+ const DEFAULT_EVIDENCE_GRADE = {
17
+ tsc: "verified",
18
+ pyright: "verified",
19
+ biome: "verified",
20
+ ruff: "verified",
21
+ vitest: "verified",
22
+ jest: "verified",
23
+ "coverage.py": "verified",
24
+ "osv-scanner": "verified",
25
+ deptry: "verified",
26
+ radon: "verified",
27
+ lizard: "verified",
28
+ jscpd: "verified",
29
+ semgrep: "observed",
30
+ gitleaks: "observed",
31
+ presidio: "observed",
32
+ knip: "observed",
33
+ vulture: "heuristic",
34
+ "privacy-detector": "heuristic",
35
+ "telemetry-detector": "heuristic",
36
+ "privacy-ai-review": "heuristic",
37
+ "custom-leftovers": "observed",
38
+ "custom-refactor": "verified",
39
+ "custom-dead-chain": "heuristic",
40
+ "flow-doctor": "verified",
41
+ dpdp: "heuristic"
42
+ };
43
+ const VALID_CATEGORIES = new Set(finding_1.FINDING_CATEGORIES);
44
+ const VALID_SEVERITIES = new Set(["info", "low", "medium", "high", "critical"]);
45
+ const VALID_CONFIDENCE = new Set(["low", "medium", "high"]);
46
+ function locationQualityFor(finding) {
47
+ if (!finding.file) {
48
+ return "repository";
49
+ }
50
+ if (finding.startLine === undefined) {
51
+ return "file_only";
52
+ }
53
+ return finding.startColumn === undefined ? "line_only" : "exact";
54
+ }
55
+ /**
56
+ * Converts a byte offset into a 1-based line and column. Tools that report
57
+ * offsets (Biome among them) otherwise arrive with no position at all, because
58
+ * the report only understands lines.
59
+ */
60
+ function offsetToPosition(content, offset) {
61
+ if (offset < 0 || offset > Buffer.byteLength(content, "utf8")) {
62
+ return undefined;
63
+ }
64
+ // Walk by byte length so multi-byte characters do not shift the result.
65
+ let bytes = 0;
66
+ let line = 1;
67
+ let column = 1;
68
+ for (const character of content) {
69
+ if (bytes >= offset) {
70
+ break;
71
+ }
72
+ bytes += Buffer.byteLength(character, "utf8");
73
+ if (character === "\n") {
74
+ line += 1;
75
+ column = 1;
76
+ }
77
+ else {
78
+ column += 1;
79
+ }
80
+ }
81
+ return { line, column };
82
+ }
83
+ function createFileReader(root) {
84
+ const cache = new Map();
85
+ return async (file) => {
86
+ if (cache.has(file)) {
87
+ return cache.get(file);
88
+ }
89
+ let content;
90
+ try {
91
+ content = await node_fs_1.promises.readFile(node_path_1.default.join(root, file), "utf8");
92
+ }
93
+ catch {
94
+ content = undefined;
95
+ }
96
+ cache.set(file, content);
97
+ return content;
98
+ };
99
+ }
100
+ async function normalizeFindings(raw, options) {
101
+ const issues = new Map();
102
+ const readFile = createFileReader(options.root);
103
+ const changed = new Set(options.changedFiles ?? []);
104
+ const findings = [];
105
+ let withoutLocation = 0;
106
+ function note(kind, detail) {
107
+ const existing = issues.get(kind);
108
+ if (existing) {
109
+ existing.count += 1;
110
+ return;
111
+ }
112
+ issues.set(kind, { tool: options.tool, kind, count: 1, detail });
113
+ }
114
+ for (const item of raw) {
115
+ const finding = { ...item };
116
+ if (!VALID_CATEGORIES.has(finding.category)) {
117
+ note("invalid_enum", `Unknown category "${finding.category}" was reported as maintainability.`);
118
+ finding.category = "maintainability";
119
+ }
120
+ if (!VALID_SEVERITIES.has(finding.severity)) {
121
+ note("invalid_enum", `Unknown severity "${finding.severity}" was reported as medium.`);
122
+ finding.severity = "medium";
123
+ }
124
+ if (!VALID_CONFIDENCE.has(finding.confidence)) {
125
+ note("invalid_enum", `Unknown confidence "${finding.confidence}" was reported as low.`);
126
+ finding.confidence = "low";
127
+ }
128
+ if (!finding.message?.trim()) {
129
+ note("missing_message", "A finding arrived with no message; its title was used instead.");
130
+ finding.message = finding.title || `${options.tool} reported an issue.`;
131
+ }
132
+ // Recover a position from a byte offset when the tool reports offsets only.
133
+ if (finding.file && finding.startLine === undefined && finding.evidence?.startOffset !== undefined) {
134
+ const content = await readFile(finding.file);
135
+ const position = content ? offsetToPosition(content, finding.evidence.startOffset) : undefined;
136
+ if (position) {
137
+ finding.startLine = position.line;
138
+ finding.startColumn = position.column;
139
+ if (finding.evidence.endOffset !== undefined && content) {
140
+ finding.endLine = offsetToPosition(content, finding.evidence.endOffset)?.line ?? position.line;
141
+ }
142
+ }
143
+ else {
144
+ note("unresolved_offset", `${options.tool} reported byte offsets that could not be mapped to lines (file unreadable or offset out of range).`);
145
+ }
146
+ }
147
+ finding.locationQuality = locationQualityFor(finding);
148
+ if (finding.locationQuality === "file_only" || finding.locationQuality === "repository") {
149
+ withoutLocation += 1;
150
+ if (finding.locationQuality === "file_only") {
151
+ note("missing_location", `${options.tool} reported findings without a line number.`);
152
+ }
153
+ }
154
+ finding.evidenceGrade ??= DEFAULT_EVIDENCE_GRADE[finding.source] ?? "observed";
155
+ finding.fileRole ??= options.classifyFile(finding.file);
156
+ finding.inChangedFile ??= finding.file ? changed.has(finding.file) : false;
157
+ finding.tags = Array.from(new Set(finding.tags ?? []));
158
+ findings.push(finding);
159
+ }
160
+ return {
161
+ findings,
162
+ issues: Array.from(issues.values()),
163
+ locationLossRate: raw.length === 0 ? 0 : withoutLocation / raw.length
164
+ };
165
+ }
166
+ /** Human-readable summary of what a tool's output lost, for the capability matrix. */
167
+ function describeNormalizationIssues(issues) {
168
+ if (issues.length === 0) {
169
+ return undefined;
170
+ }
171
+ return issues.map((issue) => `${issue.detail} (${issue.count})`).join(" ");
172
+ }
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Pinned managed-tool catalog.
3
+ *
4
+ * Adapters ask for `tool: "ruff"`; ToolRuntime maps that name onto a
5
+ * versioned, checksummed artifact in the VibeDoctor cache. Other engines plug
6
+ * into the same shape without changing adapters.
7
+ */
8
+ export type ManagedArchiveKind = "zip" | "tar.gz" | "none";
9
+ export type ManagedArtifact = {
10
+ url: string;
11
+ sha256: string;
12
+ archive: ManagedArchiveKind;
13
+ /** File name of the executable inside the archive (or the copied file). */
14
+ binary: string;
15
+ };
16
+ export type ManagedToolSpec = {
17
+ id: string;
18
+ version: string;
19
+ artifacts: Record<string, ManagedArtifact>;
20
+ };
21
+ export declare const MANAGED_TOOLS: Record<string, ManagedToolSpec>;
22
+ export declare function isManagedTool(id: string): boolean;
23
+ export declare function getManagedTool(id: string): ManagedToolSpec | undefined;
24
+ export declare function currentPlatformKey(): string;
25
+ export declare function artifactFor(spec: ManagedToolSpec, platformKey?: string): ManagedArtifact | undefined;
@@ -0,0 +1,186 @@
1
+ "use strict";
2
+ /**
3
+ * Pinned managed-tool catalog.
4
+ *
5
+ * Adapters ask for `tool: "ruff"`; ToolRuntime maps that name onto a
6
+ * versioned, checksummed artifact in the VibeDoctor cache. Other engines plug
7
+ * into the same shape without changing adapters.
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.MANAGED_TOOLS = void 0;
11
+ exports.isManagedTool = isManagedTool;
12
+ exports.getManagedTool = getManagedTool;
13
+ exports.currentPlatformKey = currentPlatformKey;
14
+ exports.artifactFor = artifactFor;
15
+ const RUFF_VERSION = "0.16.3";
16
+ const RUFF_BASE = `https://releases.astral.sh/github/ruff/releases/download/${RUFF_VERSION}`;
17
+ const GITLEAKS_VERSION = "8.30.1";
18
+ const GITLEAKS_BASE = `https://github.com/gitleaks/gitleaks/releases/download/v${GITLEAKS_VERSION}`;
19
+ const OSV_VERSION = "2.5.0";
20
+ const OSV_BASE = `https://github.com/google/osv-scanner/releases/download/v${OSV_VERSION}`;
21
+ exports.MANAGED_TOOLS = {
22
+ ruff: {
23
+ id: "ruff",
24
+ version: RUFF_VERSION,
25
+ artifacts: {
26
+ "win32-x64": {
27
+ url: `${RUFF_BASE}/ruff-x86_64-pc-windows-msvc.zip`,
28
+ sha256: "f10c709755b393fd9821506b21070bcca969b9966504edd1e490efd08e3662ba",
29
+ archive: "zip",
30
+ binary: "ruff.exe"
31
+ },
32
+ "win32-arm64": {
33
+ url: `${RUFF_BASE}/ruff-aarch64-pc-windows-msvc.zip`,
34
+ sha256: "9a9915c54b27b26c972271fbd603845610bb379a7f29571daf923fd8d2bda33e",
35
+ archive: "zip",
36
+ binary: "ruff.exe"
37
+ },
38
+ "darwin-x64": {
39
+ url: `${RUFF_BASE}/ruff-x86_64-apple-darwin.tar.gz`,
40
+ sha256: "05c2a6705e7c0c056d6d93ff538978583f0c47b4c28d334ab9d58d2e8daf4c24",
41
+ archive: "tar.gz",
42
+ binary: "ruff"
43
+ },
44
+ "darwin-arm64": {
45
+ url: `${RUFF_BASE}/ruff-aarch64-apple-darwin.tar.gz`,
46
+ sha256: "136a4db6512d9b16dda56ac8604696ed65c3b1a914a142de029e7f8d5006f1d9",
47
+ archive: "tar.gz",
48
+ binary: "ruff"
49
+ },
50
+ "linux-x64": {
51
+ url: `${RUFF_BASE}/ruff-x86_64-unknown-linux-gnu.tar.gz`,
52
+ sha256: "7ab3b978d2c0b1c96b2323d4e5c4f35284ae1cdf35d2f7399595c74c805f5fa3",
53
+ archive: "tar.gz",
54
+ binary: "ruff"
55
+ },
56
+ "linux-arm64": {
57
+ url: `${RUFF_BASE}/ruff-aarch64-unknown-linux-gnu.tar.gz`,
58
+ sha256: "b9cc833f5db856484b38718c9da195a6ec990707307bda30530913a09705419a",
59
+ archive: "tar.gz",
60
+ binary: "ruff"
61
+ },
62
+ "linux-x64-musl": {
63
+ url: `${RUFF_BASE}/ruff-x86_64-unknown-linux-musl.tar.gz`,
64
+ sha256: "d67c9b5949981698c48915abf65e0b3406ba9184ad73521cdf20a926bc889c73",
65
+ archive: "tar.gz",
66
+ binary: "ruff"
67
+ }
68
+ }
69
+ },
70
+ gitleaks: {
71
+ id: "gitleaks",
72
+ version: GITLEAKS_VERSION,
73
+ artifacts: {
74
+ "win32-x64": {
75
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_windows_x64.zip`,
76
+ sha256: "d29144deff3a68aa93ced33dddf84b7fdc26070add4aa0f4513094c8332afc4e",
77
+ archive: "zip",
78
+ binary: "gitleaks.exe"
79
+ },
80
+ "win32-arm64": {
81
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_windows_arm64.zip`,
82
+ sha256: "b95f5e4f5c425cedca7ee203d9afd29597e692c4924a12ed42f970537c72cc0f",
83
+ archive: "zip",
84
+ binary: "gitleaks.exe"
85
+ },
86
+ "darwin-x64": {
87
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_darwin_x64.tar.gz`,
88
+ sha256: "dfe101a4db2255fc85120ac7f3d25e4342c3c20cf749f2c20a18081af1952709",
89
+ archive: "tar.gz",
90
+ binary: "gitleaks"
91
+ },
92
+ "darwin-arm64": {
93
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_darwin_arm64.tar.gz`,
94
+ sha256: "b40ab0ae55c505963e365f271a8d3846efbc170aa17f2607f13df610a9aeb6a5",
95
+ archive: "tar.gz",
96
+ binary: "gitleaks"
97
+ },
98
+ "linux-x64": {
99
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_linux_x64.tar.gz`,
100
+ sha256: "551f6fc83ea457d62a0d98237cbad105af8d557003051f41f3e7ca7b3f2470eb",
101
+ archive: "tar.gz",
102
+ binary: "gitleaks"
103
+ },
104
+ "linux-arm64": {
105
+ url: `${GITLEAKS_BASE}/gitleaks_${GITLEAKS_VERSION}_linux_arm64.tar.gz`,
106
+ sha256: "e4a487ee7ccd7d3a7f7ec08657610aa3606637dab924210b3aee62570fb4b080",
107
+ archive: "tar.gz",
108
+ binary: "gitleaks"
109
+ }
110
+ }
111
+ },
112
+ "osv-scanner": {
113
+ id: "osv-scanner",
114
+ version: OSV_VERSION,
115
+ artifacts: {
116
+ "win32-x64": {
117
+ url: `${OSV_BASE}/osv-scanner_windows_amd64.exe`,
118
+ sha256: "4342285bd8be36b9f113468f3eea86e7900befbcd19ca8dc6ac4f0f6cbe7c362",
119
+ archive: "none",
120
+ binary: "osv-scanner.exe"
121
+ },
122
+ "win32-arm64": {
123
+ url: `${OSV_BASE}/osv-scanner_windows_arm64.exe`,
124
+ sha256: "b8bb8d499e0636e193688c96834a11a8f74e353734053f9641e546d76a0cb857",
125
+ archive: "none",
126
+ binary: "osv-scanner.exe"
127
+ },
128
+ "darwin-x64": {
129
+ url: `${OSV_BASE}/osv-scanner_darwin_amd64`,
130
+ sha256: "baef4f4a4ce2924a9241869c36d4bd9d6c04b632cae6637a0f6347ab9272eb16",
131
+ archive: "none",
132
+ binary: "osv-scanner"
133
+ },
134
+ "darwin-arm64": {
135
+ url: `${OSV_BASE}/osv-scanner_darwin_arm64`,
136
+ sha256: "fff5a2e351b7f0a60001e87cbf862e82fb82e2792d368b533fec7a5865a73da2",
137
+ archive: "none",
138
+ binary: "osv-scanner"
139
+ },
140
+ "linux-x64": {
141
+ url: `${OSV_BASE}/osv-scanner_linux_amd64`,
142
+ sha256: "edcfc41d257db36148f065055655fe3fcfc434b0b423ea67468a84c207524e0c",
143
+ archive: "none",
144
+ binary: "osv-scanner"
145
+ },
146
+ "linux-arm64": {
147
+ url: `${OSV_BASE}/osv-scanner_linux_arm64`,
148
+ sha256: "fe152e1a546af223e6c557cc3111a8bb3e5dc02fcbf7dbe95d26567c0f0041f2",
149
+ archive: "none",
150
+ binary: "osv-scanner"
151
+ }
152
+ }
153
+ }
154
+ };
155
+ function isManagedTool(id) {
156
+ return Boolean(exports.MANAGED_TOOLS[id]);
157
+ }
158
+ function getManagedTool(id) {
159
+ return exports.MANAGED_TOOLS[id];
160
+ }
161
+ function currentPlatformKey() {
162
+ const os = process.platform === "win32" || process.platform === "darwin" || process.platform === "linux" ? process.platform : "linux";
163
+ const arch = process.arch === "x64" || process.arch === "arm64" || process.arch === "ia32" || process.arch === "arm" ? process.arch : "x64";
164
+ if (os === "linux" && arch === "x64" && typeof process.report?.getReport === "function" && isMusl()) {
165
+ return "linux-x64-musl";
166
+ }
167
+ if (os === "win32" && arch === "ia32") {
168
+ return "win32-x64";
169
+ }
170
+ return `${os}-${arch === "ia32" ? "x64" : arch}`;
171
+ }
172
+ function isMusl() {
173
+ try {
174
+ const report = process.report?.getReport();
175
+ if (report && typeof report === "object") {
176
+ return !report.header?.glibcVersionRuntime;
177
+ }
178
+ }
179
+ catch {
180
+ // Best-effort; fall back to gnu.
181
+ }
182
+ return false;
183
+ }
184
+ function artifactFor(spec, platformKey = currentPlatformKey()) {
185
+ return spec.artifacts[platformKey];
186
+ }
@@ -1,5 +1,17 @@
1
1
  export type ProjectLanguage = "python" | "javascript" | "typescript";
2
2
  export type PackageManager = "npm" | "pnpm" | "yarn" | "bun" | "pip" | "uv" | "poetry" | "pdm";
3
+ /**
4
+ * Dependencies the project declares, split by how they reach production.
5
+ *
6
+ * Vulnerability findings arrive from lockfiles, which flatten that distinction
7
+ * away. Without it, an advisory in a build-time dev server is presented as
8
+ * equivalent to one in a library that handles user input.
9
+ */
10
+ export type DeclaredDependencies = {
11
+ runtime: string[];
12
+ dev: string[];
13
+ optional: string[];
14
+ };
3
15
  export type ProjectContext = {
4
16
  root: string;
5
17
  languages: ProjectLanguage[];
@@ -13,5 +25,6 @@ export type ProjectContext = {
13
25
  frameworkHints: string[];
14
26
  entryFiles: string[];
15
27
  projectFiles: string[];
28
+ declaredDependencies?: DeclaredDependencies;
16
29
  };
17
30
  export declare function detectProject(root: string, excludePatterns?: string[]): Promise<ProjectContext>;