@neuralaxis/vibedoctor 0.1.3 → 0.2.1

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 (112) hide show
  1. package/README.md +298 -115
  2. package/dist/adapters/biome.js +135 -21
  3. package/dist/adapters/dpdp.d.ts +6 -0
  4. package/dist/adapters/dpdp.js +34 -0
  5. package/dist/adapters/index.d.ts +1 -0
  6. package/dist/adapters/index.js +3 -1
  7. package/dist/adapters/osvScanner.js +136 -17
  8. package/dist/adapters/presidio.js +6 -2
  9. package/dist/adapters/privacyDetector.d.ts +24 -1
  10. package/dist/adapters/privacyDetector.js +86 -2
  11. package/dist/adapters/shared.d.ts +6 -0
  12. package/dist/agentPack/templates/skills.js +159 -53
  13. package/dist/cli/commands/dpdp.d.ts +35 -0
  14. package/dist/cli/commands/dpdp.js +103 -0
  15. package/dist/cli/commands/init.js +105 -50
  16. package/dist/cli/commands/privacyReview.js +3 -4
  17. package/dist/cli/commands/scan.js +4 -1
  18. package/dist/cli/commands/setup.d.ts +13 -17
  19. package/dist/cli/commands/setup.js +138 -200
  20. package/dist/cli/index.js +84 -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 +57 -0
  24. package/dist/core/config.js +194 -7
  25. package/dist/core/credentialHeuristics.d.ts +28 -0
  26. package/dist/core/credentialHeuristics.js +179 -0
  27. package/dist/core/engine.d.ts +21 -0
  28. package/dist/core/engine.js +484 -84
  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 +63 -5
  35. package/dist/core/findingNormalizer.d.ts +33 -0
  36. package/dist/core/findingNormalizer.js +171 -0
  37. package/dist/core/projectDetector.d.ts +13 -0
  38. package/dist/core/projectDetector.js +100 -15
  39. package/dist/core/relevance.d.ts +87 -0
  40. package/dist/core/relevance.js +367 -0
  41. package/dist/core/scanPlanner.d.ts +12 -0
  42. package/dist/core/scanPlanner.js +61 -29
  43. package/dist/core/semverLite.d.ts +27 -0
  44. package/dist/core/semverLite.js +163 -0
  45. package/dist/core/suppressions.d.ts +96 -0
  46. package/dist/core/suppressions.js +302 -0
  47. package/dist/core/toolRegistry.d.ts +58 -0
  48. package/dist/core/toolRegistry.js +247 -0
  49. package/dist/core/toolRunner.d.ts +23 -2
  50. package/dist/core/toolRunner.js +61 -93
  51. package/dist/core/toolVerification.d.ts +87 -0
  52. package/dist/core/toolVerification.js +370 -0
  53. package/dist/dpdp/artifacts.d.ts +11 -0
  54. package/dist/dpdp/artifacts.js +120 -0
  55. package/dist/dpdp/catalogue.d.ts +14 -0
  56. package/dist/dpdp/catalogue.js +661 -0
  57. package/dist/dpdp/collectors/confidence.d.ts +9 -0
  58. package/dist/dpdp/collectors/confidence.js +25 -0
  59. package/dist/dpdp/collectors/dependencies.d.ts +7 -0
  60. package/dist/dpdp/collectors/dependencies.js +63 -0
  61. package/dist/dpdp/collectors/index.d.ts +24 -0
  62. package/dist/dpdp/collectors/index.js +71 -0
  63. package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
  64. package/dist/dpdp/collectors/lifecycle.js +202 -0
  65. package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
  66. package/dist/dpdp/collectors/optionalScanners.js +437 -0
  67. package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
  68. package/dist/dpdp/collectors/privacyBridge.js +152 -0
  69. package/dist/dpdp/collectors/safeguards.d.ts +5 -0
  70. package/dist/dpdp/collectors/safeguards.js +186 -0
  71. package/dist/dpdp/collectors/schema.d.ts +6 -0
  72. package/dist/dpdp/collectors/schema.js +122 -0
  73. package/dist/dpdp/collectors/shared.d.ts +10 -0
  74. package/dist/dpdp/collectors/shared.js +43 -0
  75. package/dist/dpdp/context.d.ts +28 -0
  76. package/dist/dpdp/context.js +195 -0
  77. package/dist/dpdp/dataMap.d.ts +7 -0
  78. package/dist/dpdp/dataMap.js +339 -0
  79. package/dist/dpdp/evaluators.d.ts +20 -0
  80. package/dist/dpdp/evaluators.js +522 -0
  81. package/dist/dpdp/evidence.d.ts +11 -0
  82. package/dist/dpdp/evidence.js +123 -0
  83. package/dist/dpdp/findings.d.ts +44 -0
  84. package/dist/dpdp/findings.js +286 -0
  85. package/dist/dpdp/gates.d.ts +14 -0
  86. package/dist/dpdp/gates.js +47 -0
  87. package/dist/dpdp/index.d.ts +16 -0
  88. package/dist/dpdp/index.js +32 -0
  89. package/dist/dpdp/legalSources.d.ts +10 -0
  90. package/dist/dpdp/legalSources.js +104 -0
  91. package/dist/dpdp/paths.d.ts +25 -0
  92. package/dist/dpdp/paths.js +85 -0
  93. package/dist/dpdp/report.d.ts +6 -0
  94. package/dist/dpdp/report.js +222 -0
  95. package/dist/dpdp/reviewQueue.d.ts +3 -0
  96. package/dist/dpdp/reviewQueue.js +88 -0
  97. package/dist/dpdp/scan.d.ts +26 -0
  98. package/dist/dpdp/scan.js +310 -0
  99. package/dist/dpdp/scoring.d.ts +41 -0
  100. package/dist/dpdp/scoring.js +237 -0
  101. package/dist/dpdp/types.d.ts +312 -0
  102. package/dist/dpdp/types.js +86 -0
  103. package/dist/index.d.ts +1 -0
  104. package/dist/index.js +1 -0
  105. package/dist/mcp/tools/dpdp.d.ts +11 -0
  106. package/dist/mcp/tools/dpdp.js +151 -0
  107. package/dist/mcp/tools/index.js +3 -1
  108. package/dist/reporters/html.js +57 -13
  109. package/dist/reporters/json.js +12 -1
  110. package/dist/reporters/markdown.js +46 -4
  111. package/dist/reporters/sarif.js +54 -5
  112. package/package.json +4 -1
@@ -0,0 +1,96 @@
1
+ import { type Finding } from "./finding";
2
+ /**
3
+ * Acknowledgement of findings that are known and accepted, with a reason and an
4
+ * expiry date.
5
+ *
6
+ * The only existing lever was the baseline, which answers "was this here
7
+ * before?" and nothing else. There was no way to say "this is a synthetic
8
+ * fixture", "we accept this risk until the Q3 migration", or "this is a false
9
+ * positive because the identifier is a cache key, not a credential" — so the
10
+ * same rejected findings came back every scan and users learned to ignore whole
11
+ * categories. A suppression here must carry a rationale, and one with an expiry
12
+ * stops hiding its findings the day it lapses rather than quietly living forever.
13
+ */
14
+ export declare const SUPPRESSIONS_FILE = ".vibedoctor/suppressions.yml";
15
+ export type SuppressionClassification = "false_positive" | "accepted_risk" | "deferred" | "fixture";
16
+ export type SuppressionMatch = {
17
+ /** Finding sources this rule applies to. */
18
+ tools?: string[];
19
+ /** Glob patterns against repository-relative paths. */
20
+ paths?: string[];
21
+ /** Finding titles / rule ids, matched case-insensitively as substrings. */
22
+ rules?: string[];
23
+ categories?: string[];
24
+ /** Exact fingerprints, for pinning a single finding. */
25
+ fingerprints?: string[];
26
+ };
27
+ export type SuppressionRule = {
28
+ id: string;
29
+ reason: string;
30
+ classification: SuppressionClassification;
31
+ owner?: string;
32
+ /** ISO date. Absent means a permanent exemption, which reports call out. */
33
+ expiresAt?: string;
34
+ match: SuppressionMatch;
35
+ };
36
+ export type InvalidSuppression = {
37
+ id: string;
38
+ problem: string;
39
+ };
40
+ export type SuppressionReport = {
41
+ file: string;
42
+ /** Rules in force. */
43
+ active: SuppressionRule[];
44
+ /** Rules past their expiry date; their findings are shown again. */
45
+ expired: SuppressionRule[];
46
+ /** Rules that could not be loaded, with the reason. Never silently dropped. */
47
+ invalid: InvalidSuppression[];
48
+ /** Rules with no expiry date, which never lapse on their own. */
49
+ permanent: string[];
50
+ /** How many findings each active rule hid this scan. */
51
+ hits: Record<string, number>;
52
+ /**
53
+ * How many findings each lapsed rule would have hidden. Counted separately
54
+ * from `hits` because these findings are shown, not suppressed; folding them
55
+ * together let a report claim the same finding was both hidden and resurfaced.
56
+ */
57
+ expiredHits: Record<string, number>;
58
+ /** Rules that matched nothing, so they can be cleaned up. */
59
+ unused: string[];
60
+ /** Findings that reappeared because a suppression lapsed. */
61
+ resurfaced: number;
62
+ /**
63
+ * Set when these counts cover more findings than the report they appear in
64
+ * (a category-filtered view), so they are not mistaken for the filtered slice.
65
+ */
66
+ scopeNote?: string;
67
+ };
68
+ export type LoadedSuppressions = {
69
+ file: string;
70
+ rules: SuppressionRule[];
71
+ invalid: InvalidSuppression[];
72
+ };
73
+ export declare function loadSuppressions(root: string, file?: string): Promise<LoadedSuppressions>;
74
+ export type ApplySuppressionsResult = {
75
+ /** Findings that survived. Suppressed findings are removed, not hidden in place. */
76
+ findings: Finding[];
77
+ /** Suppressed findings, kept so reports can show what was acknowledged. */
78
+ suppressed: Finding[];
79
+ report: SuppressionReport;
80
+ };
81
+ export type ApplySuppressionsOptions = {
82
+ now?: Date;
83
+ /**
84
+ * Reject acknowledgements with no expiry date rather than letting them hide
85
+ * findings forever. Rejected rules appear in `invalid` with the reason.
86
+ */
87
+ requireExpiry?: boolean;
88
+ };
89
+ /**
90
+ * Applies suppressions to findings. Expired rules do not suppress; instead their
91
+ * findings are marked `resurfaced` so a lapsed acknowledgement is visible rather
92
+ * than being mistaken for a new regression.
93
+ */
94
+ export declare function applySuppressions(findings: Finding[], loaded: LoadedSuppressions, options?: ApplySuppressionsOptions): ApplySuppressionsResult;
95
+ export declare function renderSuppressionLines(report: SuppressionReport): string[];
96
+ export declare const SUPPRESSIONS_TEMPLATE = "# VibeDoctor acknowledgements.\n#\n# Each entry hides findings that are known and accepted. A reason is required,\n# and an expiry date is strongly recommended: when it passes, the findings come\n# back marked \"resurfaced\" instead of staying hidden indefinitely.\nversion: 1\nsuppressions:\n # - id: fixture-credentials\n # reason: Synthetic credentials in test fixtures, never used against real systems.\n # classification: fixture # false_positive | accepted_risk | deferred | fixture\n # owner: platform-team\n # expires: 2026-12-31\n # match:\n # tools: [gitleaks]\n # paths: [\"fixtures/**\"]\n";
@@ -0,0 +1,302 @@
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.SUPPRESSIONS_TEMPLATE = exports.SUPPRESSIONS_FILE = void 0;
7
+ exports.loadSuppressions = loadSuppressions;
8
+ exports.applySuppressions = applySuppressions;
9
+ exports.renderSuppressionLines = renderSuppressionLines;
10
+ const node_fs_1 = require("node:fs");
11
+ const node_path_1 = __importDefault(require("node:path"));
12
+ const yaml_1 = __importDefault(require("yaml"));
13
+ const minimatch_1 = require("minimatch");
14
+ const finding_1 = require("./finding");
15
+ /**
16
+ * Acknowledgement of findings that are known and accepted, with a reason and an
17
+ * expiry date.
18
+ *
19
+ * The only existing lever was the baseline, which answers "was this here
20
+ * before?" and nothing else. There was no way to say "this is a synthetic
21
+ * fixture", "we accept this risk until the Q3 migration", or "this is a false
22
+ * positive because the identifier is a cache key, not a credential" — so the
23
+ * same rejected findings came back every scan and users learned to ignore whole
24
+ * categories. A suppression here must carry a rationale, and one with an expiry
25
+ * stops hiding its findings the day it lapses rather than quietly living forever.
26
+ */
27
+ exports.SUPPRESSIONS_FILE = ".vibedoctor/suppressions.yml";
28
+ const VALID_CLASSIFICATIONS = new Set([
29
+ "false_positive",
30
+ "accepted_risk",
31
+ "deferred",
32
+ "fixture"
33
+ ]);
34
+ const MIN_REASON_LENGTH = 12;
35
+ function asStringArray(value) {
36
+ if (!Array.isArray(value)) {
37
+ return typeof value === "string" ? [value] : undefined;
38
+ }
39
+ const items = value.filter((item) => typeof item === "string");
40
+ return items.length > 0 ? items : undefined;
41
+ }
42
+ function parseRule(raw, index) {
43
+ if (typeof raw !== "object" || raw === null) {
44
+ return { id: `#${index + 1}`, problem: "Entry is not a mapping." };
45
+ }
46
+ const record = raw;
47
+ const id = typeof record.id === "string" && record.id.trim() ? record.id.trim() : `#${index + 1}`;
48
+ const reason = typeof record.reason === "string" ? record.reason.trim() : "";
49
+ // A suppression without a stated reason is indistinguishable from forgetting
50
+ // why something was hidden, which is the problem this file exists to solve.
51
+ if (reason.length < MIN_REASON_LENGTH) {
52
+ return {
53
+ id,
54
+ problem: `A reason of at least ${MIN_REASON_LENGTH} characters is required explaining why this is acceptable.`
55
+ };
56
+ }
57
+ const classification = record.classification ?? record.kind;
58
+ if (typeof classification !== "string" || !VALID_CLASSIFICATIONS.has(classification)) {
59
+ return {
60
+ id,
61
+ problem: `classification must be one of ${Array.from(VALID_CLASSIFICATIONS).join(", ")}.`
62
+ };
63
+ }
64
+ const rawMatch = (record.match ?? record.matches ?? {});
65
+ const match = {
66
+ tools: asStringArray(rawMatch.tools ?? rawMatch.sources ?? rawMatch.tool),
67
+ paths: asStringArray(rawMatch.paths ?? rawMatch.path ?? rawMatch.files),
68
+ rules: asStringArray(rawMatch.rules ?? rawMatch.rule ?? rawMatch.titles),
69
+ categories: asStringArray(rawMatch.categories ?? rawMatch.category),
70
+ fingerprints: asStringArray(rawMatch.fingerprints ?? rawMatch.fingerprint ?? record.fingerprints)
71
+ };
72
+ // Without at least one criterion the rule would hide the entire report.
73
+ if (!match.tools && !match.paths && !match.rules && !match.categories && !match.fingerprints) {
74
+ return {
75
+ id,
76
+ problem: "At least one match criterion (tools, paths, rules, categories, or fingerprints) is required."
77
+ };
78
+ }
79
+ const expiresRaw = record.expires ?? record.expiresAt ?? record.expires_at;
80
+ let expiresAt;
81
+ if (expiresRaw !== undefined && expiresRaw !== null) {
82
+ const parsed = expiresRaw instanceof Date ? expiresRaw : new Date(String(expiresRaw));
83
+ if (Number.isNaN(parsed.getTime())) {
84
+ return { id, problem: `expires must be a date (got "${String(expiresRaw)}").` };
85
+ }
86
+ expiresAt = parsed.toISOString().slice(0, 10);
87
+ }
88
+ return {
89
+ id,
90
+ reason,
91
+ classification: classification,
92
+ owner: typeof record.owner === "string" ? record.owner : undefined,
93
+ expiresAt,
94
+ match
95
+ };
96
+ }
97
+ function isInvalid(value) {
98
+ return "problem" in value;
99
+ }
100
+ async function loadSuppressions(root, file = exports.SUPPRESSIONS_FILE) {
101
+ const absolute = node_path_1.default.join(root, file);
102
+ let content;
103
+ try {
104
+ content = await node_fs_1.promises.readFile(absolute, "utf8");
105
+ }
106
+ catch {
107
+ return { file, rules: [], invalid: [] };
108
+ }
109
+ let parsed;
110
+ try {
111
+ parsed = file.endsWith(".json") ? JSON.parse(content) : yaml_1.default.parse(content);
112
+ }
113
+ catch (error) {
114
+ return {
115
+ file,
116
+ rules: [],
117
+ invalid: [{ id: file, problem: `Could not parse: ${error instanceof Error ? error.message : String(error)}` }]
118
+ };
119
+ }
120
+ const record = (parsed ?? {});
121
+ const entries = record.suppressions ?? record.acknowledgements ?? record.rules;
122
+ if (!Array.isArray(entries)) {
123
+ return entries === undefined
124
+ ? { file, rules: [], invalid: [] }
125
+ : { file, rules: [], invalid: [{ id: file, problem: "`suppressions` must be a list." }] };
126
+ }
127
+ const parsedRules = entries.map(parseRule);
128
+ return {
129
+ file,
130
+ rules: parsedRules.filter((rule) => !isInvalid(rule)),
131
+ invalid: parsedRules.filter(isInvalid)
132
+ };
133
+ }
134
+ function compile(rule, now) {
135
+ return {
136
+ rule,
137
+ pathMatchers: rule.match.paths?.map((pattern) => new minimatch_1.Minimatch(pattern, { dot: true })),
138
+ expired: rule.expiresAt !== undefined && new Date(`${rule.expiresAt}T23:59:59Z`).getTime() < now.getTime()
139
+ };
140
+ }
141
+ function matches(compiled, finding, fingerprint) {
142
+ const { match } = compiled.rule;
143
+ // Every declared criterion must hold, so rules narrow rather than widen. A
144
+ // fingerprint is a criterion like any other: when it is listed alongside a
145
+ // path or tool, a fingerprint that collides or goes stale must not be able to
146
+ // suppress something the rest of the rule excludes.
147
+ if (match.fingerprints && !match.fingerprints.includes(fingerprint)) {
148
+ return false;
149
+ }
150
+ if (match.tools && !match.tools.includes(finding.source)) {
151
+ return false;
152
+ }
153
+ if (match.categories && !match.categories.includes(finding.category)) {
154
+ return false;
155
+ }
156
+ if (compiled.pathMatchers) {
157
+ const file = finding.file;
158
+ if (!file || !compiled.pathMatchers.some((matcher) => matcher.match(file))) {
159
+ return false;
160
+ }
161
+ }
162
+ if (match.rules) {
163
+ const haystack = `${finding.title} ${finding.evidence?.toolRawId ?? ""}`.toLowerCase();
164
+ if (!match.rules.some((rule) => haystack.includes(rule.toLowerCase()))) {
165
+ return false;
166
+ }
167
+ }
168
+ // A rule with no criteria at all would match everything; parsing rejects those,
169
+ // and this guards against one slipping through.
170
+ return Boolean(match.tools || match.categories || match.paths || match.rules || match.fingerprints);
171
+ }
172
+ /**
173
+ * Applies suppressions to findings. Expired rules do not suppress; instead their
174
+ * findings are marked `resurfaced` so a lapsed acknowledgement is visible rather
175
+ * than being mistaken for a new regression.
176
+ */
177
+ function applySuppressions(findings, loaded, options = {}) {
178
+ const now = options.now ?? new Date();
179
+ // Enforced here rather than at parse time because whether a permanent
180
+ // acknowledgement is acceptable is a policy question the config answers.
181
+ const invalid = [...loaded.invalid];
182
+ const usable = [];
183
+ for (const rule of loaded.rules) {
184
+ if (options.requireExpiry && !rule.expiresAt) {
185
+ invalid.push({
186
+ id: rule.id,
187
+ problem: "An expiry date is required (suppressions.require_expiry is on), so this rule was not applied."
188
+ });
189
+ continue;
190
+ }
191
+ usable.push(rule);
192
+ }
193
+ const compiled = usable.map((rule) => compile(rule, now));
194
+ const hits = {};
195
+ const expiredHits = {};
196
+ const kept = [];
197
+ const suppressed = [];
198
+ let resurfaced = 0;
199
+ for (const finding of findings) {
200
+ const fingerprint = (0, finding_1.fingerprintFinding)(finding);
201
+ const hit = compiled.find((candidate) => matches(candidate, finding, fingerprint));
202
+ if (!hit) {
203
+ kept.push(finding);
204
+ continue;
205
+ }
206
+ const tally = hit.expired ? expiredHits : hits;
207
+ tally[hit.rule.id] = (tally[hit.rule.id] ?? 0) + 1;
208
+ const suppression = {
209
+ ruleId: hit.rule.id,
210
+ classification: hit.rule.classification,
211
+ reason: hit.rule.reason,
212
+ owner: hit.rule.owner,
213
+ expiresAt: hit.rule.expiresAt,
214
+ expired: hit.expired
215
+ };
216
+ if (hit.expired) {
217
+ resurfaced += 1;
218
+ kept.push({
219
+ ...finding,
220
+ suppression,
221
+ baselineState: "resurfaced",
222
+ // Surface the lapse in the message itself; a report reader should not
223
+ // have to cross-reference the suppressions file to understand why this
224
+ // reappeared.
225
+ message: `${finding.message} (suppression "${hit.rule.id}" expired ${hit.rule.expiresAt})`
226
+ });
227
+ continue;
228
+ }
229
+ suppressed.push({ ...finding, suppression });
230
+ }
231
+ const active = compiled.filter((candidate) => !candidate.expired).map((candidate) => candidate.rule);
232
+ const expired = compiled.filter((candidate) => candidate.expired).map((candidate) => candidate.rule);
233
+ return {
234
+ findings: kept,
235
+ suppressed,
236
+ report: {
237
+ file: loaded.file,
238
+ active,
239
+ expired,
240
+ invalid,
241
+ permanent: active.filter((rule) => !rule.expiresAt).map((rule) => rule.id),
242
+ hits,
243
+ expiredHits,
244
+ // A lapsed rule that matched is still in use, so it is not dead weight to
245
+ // clean up — only a rule that matched nothing is.
246
+ unused: usable.filter((rule) => !hits[rule.id] && !expiredHits[rule.id]).map((rule) => rule.id),
247
+ resurfaced
248
+ }
249
+ };
250
+ }
251
+ function renderSuppressionLines(report) {
252
+ const lines = [];
253
+ const suppressedTotal = Object.values(report.hits).reduce((sum, count) => sum + count, 0);
254
+ if (suppressedTotal > 0) {
255
+ lines.push(`Suppressed: ${suppressedTotal} finding(s) via ${Object.keys(report.hits).length} acknowledgement(s)`);
256
+ if (report.scopeNote) {
257
+ lines.push(`- ${report.scopeNote}`);
258
+ }
259
+ for (const [ruleId, count] of Object.entries(report.hits)) {
260
+ const rule = report.active.find((candidate) => candidate.id === ruleId);
261
+ const expiry = rule?.expiresAt ? `expires ${rule.expiresAt}` : "no expiry";
262
+ lines.push(`- ${ruleId}: ${count} finding(s) — ${rule?.reason ?? "reason unavailable"} (${expiry})`);
263
+ }
264
+ }
265
+ if (report.expired.length > 0) {
266
+ lines.push(`Expired acknowledgements: ${report.expired
267
+ .map((rule) => {
268
+ const count = report.expiredHits[rule.id] ?? 0;
269
+ return `${rule.id} (${rule.expiresAt}${count > 0 ? `, ${count} finding(s) shown again` : ""})`;
270
+ })
271
+ .join(", ")} — their findings are no longer hidden.`);
272
+ }
273
+ if (report.invalid.length > 0) {
274
+ lines.push(`Rejected acknowledgements in ${report.file}:`);
275
+ for (const invalid of report.invalid) {
276
+ lines.push(`- ${invalid.id}: ${invalid.problem}`);
277
+ }
278
+ }
279
+ if (report.permanent.length > 0) {
280
+ lines.push(`Permanent acknowledgements (no expiry): ${report.permanent.join(", ")}`);
281
+ }
282
+ if (report.unused.length > 0) {
283
+ lines.push(`Acknowledgements that matched nothing: ${report.unused.join(", ")}`);
284
+ }
285
+ return lines;
286
+ }
287
+ exports.SUPPRESSIONS_TEMPLATE = `# VibeDoctor acknowledgements.
288
+ #
289
+ # Each entry hides findings that are known and accepted. A reason is required,
290
+ # and an expiry date is strongly recommended: when it passes, the findings come
291
+ # back marked "resurfaced" instead of staying hidden indefinitely.
292
+ version: 1
293
+ suppressions:
294
+ # - id: fixture-credentials
295
+ # reason: Synthetic credentials in test fixtures, never used against real systems.
296
+ # classification: fixture # false_positive | accepted_risk | deferred | fixture
297
+ # owner: platform-team
298
+ # expires: 2026-12-31
299
+ # match:
300
+ # tools: [gitleaks]
301
+ # paths: ["fixtures/**"]
302
+ `;
@@ -0,0 +1,58 @@
1
+ import type { ProjectLanguage } from "./projectDetector";
2
+ /**
3
+ * The single description of every tool VibeDoctor can run.
4
+ *
5
+ * Setup and the scanner used to keep separate lists, which let them disagree
6
+ * about what a tool is called, how to find it, and whether it was installed.
7
+ * Both now read this registry, so a tool that setup claims to have installed is
8
+ * by construction the same tool the scanner looks for.
9
+ */
10
+ export type ToolEcosystem = "npm" | "python" | "manual" | "built-in";
11
+ export type ToolPriority = "essential" | "recommended";
12
+ export type RuntimeEngine = "node" | "python";
13
+ export type ToolRegistryEntry = {
14
+ /** Matches the adapter id and the `source` on findings the tool produces. */
15
+ id: string;
16
+ ecosystem: ToolEcosystem;
17
+ priority: ToolPriority;
18
+ reason: string;
19
+ /** Command name the scanner invokes. Absent for built-in checks. */
20
+ executable?: string;
21
+ /** Package to install, when the ecosystem has a package manager. */
22
+ packageName?: string;
23
+ /** Arguments that make the tool report its version and exit successfully. */
24
+ probeArgs?: string[];
25
+ /** Extracts a version string from probe output; defaults to the first x.y.z found. */
26
+ versionPattern?: RegExp;
27
+ /**
28
+ * Runtime the tool executes on. Used to preflight compatibility before a tool
29
+ * is installed into an interpreter that cannot run it.
30
+ */
31
+ runtime?: RuntimeEngine;
32
+ languages?: ProjectLanguage[];
33
+ requiresLockfile?: boolean;
34
+ installHint?: string;
35
+ /**
36
+ * Set when the tool has no executable of its own and is exercised through
37
+ * another runtime (Presidio runs as a Python module, not a binary).
38
+ */
39
+ moduleProbe?: {
40
+ runtime: RuntimeEngine;
41
+ module: string;
42
+ };
43
+ };
44
+ export declare const TOOL_REGISTRY: ToolRegistryEntry[];
45
+ export declare function getToolEntry(id: string): ToolRegistryEntry | undefined;
46
+ /** Command names the scanner may invoke, for availability probing. */
47
+ export declare function registryExecutables(): string[];
48
+ export declare function toolsForPriority(priority: ToolPriority | "all"): ToolRegistryEntry[];
49
+ export declare function installHintFor(entry: ToolRegistryEntry): string;
50
+ /**
51
+ * Reads the runtime requirement a tool declares for itself, from the package
52
+ * metadata of the copy that is actually installed. Hardcoding "knip needs Node
53
+ * 20.19" would go stale on the next release; the package says so itself.
54
+ */
55
+ export declare function readDeclaredNodeRequirement(root: string, packageName: string | undefined): Promise<{
56
+ range?: string;
57
+ source?: string;
58
+ }>;