@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.
- package/README.md +298 -115
- package/dist/adapters/biome.js +135 -21
- package/dist/adapters/dpdp.d.ts +6 -0
- package/dist/adapters/dpdp.js +34 -0
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +3 -1
- package/dist/adapters/osvScanner.js +136 -17
- package/dist/adapters/presidio.js +6 -2
- package/dist/adapters/privacyDetector.d.ts +24 -1
- package/dist/adapters/privacyDetector.js +86 -2
- package/dist/adapters/shared.d.ts +6 -0
- package/dist/agentPack/templates/skills.js +159 -53
- package/dist/cli/commands/dpdp.d.ts +35 -0
- package/dist/cli/commands/dpdp.js +103 -0
- package/dist/cli/commands/init.js +105 -50
- package/dist/cli/commands/privacyReview.js +3 -4
- package/dist/cli/commands/scan.js +4 -1
- package/dist/cli/commands/setup.d.ts +13 -17
- package/dist/cli/commands/setup.js +138 -200
- package/dist/cli/index.js +84 -0
- package/dist/core/capability.d.ts +92 -0
- package/dist/core/capability.js +122 -0
- package/dist/core/config.d.ts +57 -0
- package/dist/core/config.js +194 -7
- package/dist/core/credentialHeuristics.d.ts +28 -0
- package/dist/core/credentialHeuristics.js +179 -0
- package/dist/core/engine.d.ts +21 -0
- package/dist/core/engine.js +484 -84
- package/dist/core/executable.d.ts +18 -0
- package/dist/core/executable.js +137 -0
- package/dist/core/fileRole.d.ts +24 -0
- package/dist/core/fileRole.js +125 -0
- package/dist/core/finding.d.ts +125 -1
- package/dist/core/finding.js +63 -5
- package/dist/core/findingNormalizer.d.ts +33 -0
- package/dist/core/findingNormalizer.js +171 -0
- package/dist/core/projectDetector.d.ts +13 -0
- package/dist/core/projectDetector.js +100 -15
- package/dist/core/relevance.d.ts +87 -0
- package/dist/core/relevance.js +367 -0
- package/dist/core/scanPlanner.d.ts +12 -0
- package/dist/core/scanPlanner.js +61 -29
- package/dist/core/semverLite.d.ts +27 -0
- package/dist/core/semverLite.js +163 -0
- package/dist/core/suppressions.d.ts +96 -0
- package/dist/core/suppressions.js +302 -0
- package/dist/core/toolRegistry.d.ts +58 -0
- package/dist/core/toolRegistry.js +247 -0
- package/dist/core/toolRunner.d.ts +23 -2
- package/dist/core/toolRunner.js +61 -93
- package/dist/core/toolVerification.d.ts +87 -0
- package/dist/core/toolVerification.js +370 -0
- package/dist/dpdp/artifacts.d.ts +11 -0
- package/dist/dpdp/artifacts.js +120 -0
- package/dist/dpdp/catalogue.d.ts +14 -0
- package/dist/dpdp/catalogue.js +661 -0
- package/dist/dpdp/collectors/confidence.d.ts +9 -0
- package/dist/dpdp/collectors/confidence.js +25 -0
- package/dist/dpdp/collectors/dependencies.d.ts +7 -0
- package/dist/dpdp/collectors/dependencies.js +63 -0
- package/dist/dpdp/collectors/index.d.ts +24 -0
- package/dist/dpdp/collectors/index.js +71 -0
- package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
- package/dist/dpdp/collectors/lifecycle.js +202 -0
- package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
- package/dist/dpdp/collectors/optionalScanners.js +437 -0
- package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
- package/dist/dpdp/collectors/privacyBridge.js +152 -0
- package/dist/dpdp/collectors/safeguards.d.ts +5 -0
- package/dist/dpdp/collectors/safeguards.js +186 -0
- package/dist/dpdp/collectors/schema.d.ts +6 -0
- package/dist/dpdp/collectors/schema.js +122 -0
- package/dist/dpdp/collectors/shared.d.ts +10 -0
- package/dist/dpdp/collectors/shared.js +43 -0
- package/dist/dpdp/context.d.ts +28 -0
- package/dist/dpdp/context.js +195 -0
- package/dist/dpdp/dataMap.d.ts +7 -0
- package/dist/dpdp/dataMap.js +339 -0
- package/dist/dpdp/evaluators.d.ts +20 -0
- package/dist/dpdp/evaluators.js +522 -0
- package/dist/dpdp/evidence.d.ts +11 -0
- package/dist/dpdp/evidence.js +123 -0
- package/dist/dpdp/findings.d.ts +44 -0
- package/dist/dpdp/findings.js +286 -0
- package/dist/dpdp/gates.d.ts +14 -0
- package/dist/dpdp/gates.js +47 -0
- package/dist/dpdp/index.d.ts +16 -0
- package/dist/dpdp/index.js +32 -0
- package/dist/dpdp/legalSources.d.ts +10 -0
- package/dist/dpdp/legalSources.js +104 -0
- package/dist/dpdp/paths.d.ts +25 -0
- package/dist/dpdp/paths.js +85 -0
- package/dist/dpdp/report.d.ts +6 -0
- package/dist/dpdp/report.js +222 -0
- package/dist/dpdp/reviewQueue.d.ts +3 -0
- package/dist/dpdp/reviewQueue.js +88 -0
- package/dist/dpdp/scan.d.ts +26 -0
- package/dist/dpdp/scan.js +310 -0
- package/dist/dpdp/scoring.d.ts +41 -0
- package/dist/dpdp/scoring.js +237 -0
- package/dist/dpdp/types.d.ts +312 -0
- package/dist/dpdp/types.js +86 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/mcp/tools/dpdp.d.ts +11 -0
- package/dist/mcp/tools/dpdp.js +151 -0
- package/dist/mcp/tools/index.js +3 -1
- package/dist/reporters/html.js +57 -13
- package/dist/reporters/json.js +12 -1
- package/dist/reporters/markdown.js +46 -4
- package/dist/reporters/sarif.js +54 -5
- package/package.json +4 -1
|
@@ -60,14 +60,14 @@ vibedoctor scan --changed --report json
|
|
|
60
60
|
vibedoctor scan --full --report json
|
|
61
61
|
\`\`\`
|
|
62
62
|
|
|
63
|
-
3. Read \`.vibedoctor/report.json\`.
|
|
64
|
-
|
|
65
|
-
4. Check \`completeness.status\` before changing code:
|
|
66
|
-
- \`complete\`: the score is comparable and findings can be prioritized.
|
|
67
|
-
- \`partial\` or \`invalid\`: run every command in \`recoveryActions\` first.
|
|
68
|
-
- If recovery fails, disclose the missing coverage and request human review before risky edits.
|
|
69
|
-
|
|
70
|
-
5. Prioritize validated findings in this order:
|
|
63
|
+
3. Read \`.vibedoctor/report.json\`.
|
|
64
|
+
|
|
65
|
+
4. Check \`completeness.status\` before changing code:
|
|
66
|
+
- \`complete\`: the score is comparable and findings can be prioritized.
|
|
67
|
+
- \`partial\` or \`invalid\`: run every command in \`recoveryActions\` first.
|
|
68
|
+
- If recovery fails, disclose the missing coverage and request human review before risky edits.
|
|
69
|
+
|
|
70
|
+
5. Prioritize validated findings in this order:
|
|
71
71
|
- security blockers
|
|
72
72
|
- correctness blockers
|
|
73
73
|
- failing tests
|
|
@@ -84,8 +84,8 @@ Give only:
|
|
|
84
84
|
- blockers
|
|
85
85
|
- safest next command
|
|
86
86
|
- top 3 fixes
|
|
87
|
-
- whether work is safe to continue
|
|
88
|
-
- scan completeness and any missing tool coverage
|
|
87
|
+
- whether work is safe to continue
|
|
88
|
+
- scan completeness and any missing tool coverage
|
|
89
89
|
|
|
90
90
|
Do not paste the full JSON unless the user asks.
|
|
91
91
|
`),
|
|
@@ -125,52 +125,158 @@ Report:
|
|
|
125
125
|
- remaining blockers
|
|
126
126
|
- verification result
|
|
127
127
|
`),
|
|
128
|
-
createSkill("vibedoctor-privacy-review", "Review VibeDoctor Privacy Review findings with masked evidence, deterministic scan output, and optional API-key adjudication. Use when asked to find PII, review personal data exposure, inspect shift-report data risk, or validate Privacy Review findings.", `
|
|
129
|
-
# VibeDoctor Privacy Review
|
|
130
|
-
|
|
131
|
-
Use this skill for personal-data and PII discovery findings.
|
|
132
|
-
|
|
133
|
-
## Default workflow
|
|
134
|
-
|
|
135
|
-
1. Run the deterministic privacy scan:
|
|
136
|
-
|
|
137
|
-
\`\`\`bash
|
|
138
|
-
vibedoctor scan --category privacy --report json
|
|
139
|
-
\`\`\`
|
|
140
|
-
|
|
141
|
-
2. Read \`.vibedoctor/report.json\`, focusing on \`privacyFindings\`.
|
|
142
|
-
|
|
143
|
-
3. Group findings into:
|
|
144
|
-
- confirmed regulated identifiers
|
|
145
|
-
- likely personal data
|
|
146
|
-
- combination-risk fields
|
|
147
|
-
- false positives or needs human review
|
|
148
|
-
|
|
149
|
-
4. Use masked evidence only. Do not request raw values unless the user explicitly asks and the repository policy allows it.
|
|
150
|
-
|
|
151
|
-
## Optional API-key review
|
|
152
|
-
|
|
153
|
-
Only run this command when \`checks.privacy.ai.enabled\` is true and the required env vars are configured:
|
|
154
|
-
|
|
155
|
-
\`\`\`bash
|
|
156
|
-
vibedoctor privacy-review --refresh --format markdown
|
|
157
|
-
\`\`\`
|
|
158
|
-
|
|
159
|
-
## Review rules
|
|
128
|
+
createSkill("vibedoctor-privacy-review", "Review VibeDoctor Privacy Review findings with masked evidence, deterministic scan output, and optional API-key adjudication. Use when asked to find PII, review personal data exposure, inspect shift-report data risk, or validate Privacy Review findings.", `
|
|
129
|
+
# VibeDoctor Privacy Review
|
|
130
|
+
|
|
131
|
+
Use this skill for personal-data and PII discovery findings.
|
|
132
|
+
|
|
133
|
+
## Default workflow
|
|
134
|
+
|
|
135
|
+
1. Run the deterministic privacy scan:
|
|
136
|
+
|
|
137
|
+
\`\`\`bash
|
|
138
|
+
vibedoctor scan --category privacy --report json
|
|
139
|
+
\`\`\`
|
|
140
|
+
|
|
141
|
+
2. Read \`.vibedoctor/report.json\`, focusing on \`privacyFindings\`.
|
|
142
|
+
|
|
143
|
+
3. Group findings into:
|
|
144
|
+
- confirmed regulated identifiers
|
|
145
|
+
- likely personal data
|
|
146
|
+
- combination-risk fields
|
|
147
|
+
- false positives or needs human review
|
|
148
|
+
|
|
149
|
+
4. Use masked evidence only. Do not request raw values unless the user explicitly asks and the repository policy allows it.
|
|
150
|
+
|
|
151
|
+
## Optional API-key review
|
|
152
|
+
|
|
153
|
+
Only run this command when \`checks.privacy.ai.enabled\` is true and the required env vars are configured:
|
|
154
|
+
|
|
155
|
+
\`\`\`bash
|
|
156
|
+
vibedoctor privacy-review --refresh --format markdown
|
|
157
|
+
\`\`\`
|
|
158
|
+
|
|
159
|
+
## Review rules
|
|
160
|
+
|
|
161
|
+
- Keep secrets separate from PII; Gitleaks findings are handled by the security workflow.
|
|
162
|
+
- Treat medium-confidence Privacy Review findings as review candidates, not automatic truth.
|
|
163
|
+
- For regulated identifiers or sensitive attributes, recommend removal, anonymization, or controlled test fixtures.
|
|
164
|
+
- For combination risk, explain which fields create the re-identification risk together.
|
|
165
|
+
|
|
166
|
+
## Output
|
|
167
|
+
|
|
168
|
+
Return:
|
|
169
|
+
- confirmed PII findings
|
|
170
|
+
- likely false positives
|
|
171
|
+
- evidence used
|
|
172
|
+
- recommended action
|
|
173
|
+
- whether API-key review was used
|
|
174
|
+
`),
|
|
175
|
+
createSkill("vibedoctor-dpdp-readiness-review", "Run DPDP technical readiness review using deterministic VibeDoctor DPDP artifacts. Use when asked about DPDP, India data protection technical controls, personal-data maps, consent/erasure gaps, processor signals, or engineering risk against DPDP — never for legal certification.", `
|
|
176
|
+
# VibeDoctor DPDP Readiness Review
|
|
177
|
+
|
|
178
|
+
This skill supports **DPDP technical readiness / engineering-risk assessment**.
|
|
179
|
+
It is **not** legal advice and **not** a compliance certification.
|
|
180
|
+
|
|
181
|
+
## Hard rules
|
|
182
|
+
|
|
183
|
+
1. Consume deterministic artifacts; do not implement a competing compliance engine.
|
|
184
|
+
2. Never independently mark DETERMINISTIC controls as passed if the control matrix says otherwise.
|
|
185
|
+
3. Never invent evidence.
|
|
186
|
+
4. Never claim legal certification.
|
|
187
|
+
5. Never calculate a separate legal compliance percentage or score.
|
|
188
|
+
6. Declared evidence is not deterministic verification.
|
|
189
|
+
7. Preserve provenance and uncertainty in every answer.
|
|
190
|
+
8. After code changes, re-run deterministic verification.
|
|
191
|
+
9. Treat the bundled legal-source manifest as a versioned offline baseline, not proof that the law is current.
|
|
160
192
|
|
|
161
|
-
-
|
|
162
|
-
- Treat medium-confidence Privacy Review findings as review candidates, not automatic truth.
|
|
163
|
-
- For regulated identifiers or sensitive attributes, recommend removal, anonymization, or controlled test fixtures.
|
|
164
|
-
- For combination risk, explain which fields create the re-identification risk together.
|
|
193
|
+
## Legal-source freshness gate
|
|
165
194
|
|
|
166
|
-
|
|
195
|
+
Perform this gate whenever the answer interprets a control against DPDP law, rules, commencement, or enforcement status.
|
|
167
196
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
197
|
+
1. Read \`legalSourceVersion\` and the legal citations in the control matrix or report.
|
|
198
|
+
2. Use current web research to find the latest official primary sources. Check, as applicable:
|
|
199
|
+
- the Digital Personal Data Protection Act and later amendments
|
|
200
|
+
- final Rules and later amendments or corrigenda
|
|
201
|
+
- commencement and enforcement notifications
|
|
202
|
+
- Data Protection Board or other notifications only when relevant to the controls under review
|
|
203
|
+
3. Prefer official Government of India sources, including \`meity.gov.in\`, \`indiacode.nic.in\`, and \`egazette.nic.in\`. Search results, blogs, news, and law-firm summaries may help discovery but are not authority.
|
|
204
|
+
4. For each official source used, record its title, URL, Act/Gazette/notification identifier, publication date, effective date or phased schedule, and the date checked. Use exact citations; do not reproduce long passages.
|
|
205
|
+
5. Compare the current official sources with the bundled manifest and its \`legalSourceVersion\`.
|
|
206
|
+
6. If an official source is newer or materially different, label the result \`LEGAL_SOURCE_DRIFT\`. Identify affected control IDs and citations, keep the deterministic technical statuses unchanged, and recommend updating the versioned catalogue plus qualified legal review.
|
|
207
|
+
7. If live research is unavailable, official pages cannot be reached, or currency cannot be established, label the result \`CURRENT_LEGAL_SOURCES_NOT_VERIFIED\`. You may use the bundled manifest as an offline baseline, but do not claim the legal position is current.
|
|
208
|
+
8. Never silently use live research to change deterministic findings, scores, or control statuses. Present current-law observations separately from technical scan results.
|
|
209
|
+
|
|
210
|
+
## Default workflow
|
|
211
|
+
|
|
212
|
+
1. Run or refresh the deterministic scan:
|
|
213
|
+
|
|
214
|
+
\`\`\`bash
|
|
215
|
+
vibedoctor dpdp scan --full
|
|
216
|
+
\`\`\`
|
|
217
|
+
|
|
218
|
+
2. Read these artifacts (source of truth):
|
|
219
|
+
- \`.vibedoctor/dpdp/data-map.json\`
|
|
220
|
+
- \`.vibedoctor/dpdp/control-matrix.json\`
|
|
221
|
+
- \`.vibedoctor/dpdp/evidence-ledger.json\`
|
|
222
|
+
- \`.vibedoctor/dpdp/review-queue.md\`
|
|
223
|
+
- \`.vibedoctor/dpdp/agent-handoff.md\` (or run \`vibedoctor dpdp handoff\`)
|
|
224
|
+
|
|
225
|
+
3. Do **not** re-ask questions already answered by deterministic evidence.
|
|
226
|
+
|
|
227
|
+
4. Group unresolved questions by audience from the review queue:
|
|
228
|
+
- developer
|
|
229
|
+
- security
|
|
230
|
+
- product
|
|
231
|
+
- legal
|
|
232
|
+
- operations
|
|
233
|
+
- founder
|
|
234
|
+
|
|
235
|
+
5. Ask the **minimum** number of questions needed.
|
|
236
|
+
|
|
237
|
+
6. Review any supplied policies and \`.vibedoctor/dpdp/evidence.yml\` declarations.
|
|
238
|
+
Compare declared policy against implementation signals in the data map.
|
|
239
|
+
|
|
240
|
+
7. Produce remediation grouped into:
|
|
241
|
+
- code
|
|
242
|
+
- configuration
|
|
243
|
+
- documentation
|
|
244
|
+
- organisational work
|
|
245
|
+
|
|
246
|
+
8. After code/config changes:
|
|
247
|
+
|
|
248
|
+
\`\`\`bash
|
|
249
|
+
vibedoctor dpdp verify
|
|
250
|
+
\`\`\`
|
|
251
|
+
|
|
252
|
+
## Output format
|
|
253
|
+
|
|
254
|
+
\`\`\`text
|
|
255
|
+
DPDP technical posture (not legal compliance):
|
|
256
|
+
Legal-source freshness: verified as of <date> | LEGAL_SOURCE_DRIFT | CURRENT_LEGAL_SOURCES_NOT_VERIFIED
|
|
257
|
+
Official sources checked:
|
|
258
|
+
Bundled-manifest drift:
|
|
259
|
+
Evidence completeness:
|
|
260
|
+
Personal-data categories:
|
|
261
|
+
Stores / external recipients:
|
|
262
|
+
Verified technical risks (violations):
|
|
263
|
+
Partial controls:
|
|
264
|
+
Human-review items (by audience):
|
|
265
|
+
Skipped capabilities:
|
|
266
|
+
Fix-next (code/config first):
|
|
267
|
+
Questions still needed:
|
|
268
|
+
What was not verified:
|
|
269
|
+
\`\`\`
|
|
270
|
+
|
|
271
|
+
## Scoring language
|
|
272
|
+
|
|
273
|
+
Only cite scores from the deterministic report:
|
|
274
|
+
- technical posture score
|
|
275
|
+
- evidence completeness percentage
|
|
276
|
+
- open-risk counts by severity
|
|
277
|
+
- status counts
|
|
278
|
+
|
|
279
|
+
Label them as **technical readiness**, never as legal compliance.
|
|
174
280
|
`),
|
|
175
281
|
createSkill("vibedoctor-dead-code-cleanup", "Review and clean high-confidence dead code chains, unused exports, unused files, unused dependencies, commented-out code, legacy fallbacks, and AI-created leftovers found by VibeDoctor. Use when asked to remove dead code, clean leftovers, reduce legacy baggage, or simplify AI-generated code.", `
|
|
176
282
|
# VibeDoctor Dead Code Cleanup
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ControlMatrix, DpdpScanMode, DpdpScanResult, PersonalDataMap } from "../../dpdp/types";
|
|
2
|
+
export type DpdpCommandResult = {
|
|
3
|
+
output: string;
|
|
4
|
+
exitCode: number;
|
|
5
|
+
};
|
|
6
|
+
export declare function runDpdpInitCommand(root: string): Promise<DpdpCommandResult>;
|
|
7
|
+
export declare function runDpdpScanCommand(root: string, options?: {
|
|
8
|
+
full?: boolean;
|
|
9
|
+
changed?: boolean;
|
|
10
|
+
report?: "terminal" | "json" | "html" | "markdown";
|
|
11
|
+
}): Promise<DpdpCommandResult>;
|
|
12
|
+
export declare function runDpdpMapCommand(root: string, options?: {
|
|
13
|
+
refresh?: boolean;
|
|
14
|
+
}): Promise<DpdpCommandResult>;
|
|
15
|
+
export declare function runDpdpReviewQueueCommand(root: string, options?: {
|
|
16
|
+
refresh?: boolean;
|
|
17
|
+
}): Promise<DpdpCommandResult>;
|
|
18
|
+
export declare function runDpdpReportCommand(root: string, options?: {
|
|
19
|
+
json?: boolean;
|
|
20
|
+
html?: boolean;
|
|
21
|
+
markdown?: boolean;
|
|
22
|
+
refresh?: boolean;
|
|
23
|
+
}): Promise<DpdpCommandResult>;
|
|
24
|
+
export declare function runDpdpHandoffCommand(root: string, options?: {
|
|
25
|
+
refresh?: boolean;
|
|
26
|
+
}): Promise<DpdpCommandResult>;
|
|
27
|
+
export declare function runDpdpVerifyCommand(root: string): Promise<DpdpCommandResult>;
|
|
28
|
+
export declare function runDpdpExplainCommand(root: string, id: string, options?: {
|
|
29
|
+
refresh?: boolean;
|
|
30
|
+
}): Promise<DpdpCommandResult>;
|
|
31
|
+
export declare function readCachedDataMap(root: string): Promise<PersonalDataMap | undefined>;
|
|
32
|
+
export declare function readCachedControlMatrix(root: string): Promise<ControlMatrix | undefined>;
|
|
33
|
+
export declare function ensureDpdpArtifactsExist(root: string): Promise<boolean>;
|
|
34
|
+
/** @deprecated Prefer loadOrScanDpdp from dpdp/scan — kept for internal callers. */
|
|
35
|
+
export declare function loadOrScan(root: string, mode: DpdpScanMode, refresh?: boolean): Promise<DpdpScanResult>;
|
|
@@ -0,0 +1,103 @@
|
|
|
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.runDpdpInitCommand = runDpdpInitCommand;
|
|
7
|
+
exports.runDpdpScanCommand = runDpdpScanCommand;
|
|
8
|
+
exports.runDpdpMapCommand = runDpdpMapCommand;
|
|
9
|
+
exports.runDpdpReviewQueueCommand = runDpdpReviewQueueCommand;
|
|
10
|
+
exports.runDpdpReportCommand = runDpdpReportCommand;
|
|
11
|
+
exports.runDpdpHandoffCommand = runDpdpHandoffCommand;
|
|
12
|
+
exports.runDpdpVerifyCommand = runDpdpVerifyCommand;
|
|
13
|
+
exports.runDpdpExplainCommand = runDpdpExplainCommand;
|
|
14
|
+
exports.readCachedDataMap = readCachedDataMap;
|
|
15
|
+
exports.readCachedControlMatrix = readCachedControlMatrix;
|
|
16
|
+
exports.ensureDpdpArtifactsExist = ensureDpdpArtifactsExist;
|
|
17
|
+
exports.loadOrScan = loadOrScan;
|
|
18
|
+
const node_fs_1 = require("node:fs");
|
|
19
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
20
|
+
const shared_1 = require("./shared");
|
|
21
|
+
const scan_1 = require("../../dpdp/scan");
|
|
22
|
+
const report_1 = require("../../dpdp/report");
|
|
23
|
+
const reviewQueue_1 = require("../../dpdp/reviewQueue");
|
|
24
|
+
const artifacts_1 = require("../../dpdp/artifacts");
|
|
25
|
+
const paths_1 = require("../../core/paths");
|
|
26
|
+
async function runDpdpInitCommand(root) {
|
|
27
|
+
const written = await (0, scan_1.initDpdpWorkspace)(root);
|
|
28
|
+
return {
|
|
29
|
+
output: `DPDP workspace ready.\n${written.map((item) => `- ${item}`).join("\n")}\n\nThis module provides DPDP technical readiness assessment, not legal certification.\n`,
|
|
30
|
+
exitCode: 0
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
async function runDpdpScanCommand(root, options = {}) {
|
|
34
|
+
const mode = options.changed ? "changed" : options.full ? "full" : "full";
|
|
35
|
+
const result = await (0, scan_1.runDpdpScan)(root, mode);
|
|
36
|
+
const { config } = await (0, shared_1.getConfig)(root);
|
|
37
|
+
const exitCode = (0, scan_1.determineDpdpExitCode)(result, config);
|
|
38
|
+
switch (options.report) {
|
|
39
|
+
case "json":
|
|
40
|
+
return { output: (0, report_1.renderDpdpJsonReport)(result), exitCode };
|
|
41
|
+
case "html":
|
|
42
|
+
return { output: (0, report_1.renderDpdpHtmlReport)(result), exitCode };
|
|
43
|
+
case "markdown":
|
|
44
|
+
return { output: (0, report_1.renderDpdpMarkdownReport)(result), exitCode };
|
|
45
|
+
default:
|
|
46
|
+
return { output: (0, report_1.renderDpdpTerminalReport)(result), exitCode };
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function runDpdpMapCommand(root, options = {}) {
|
|
50
|
+
const result = await (0, scan_1.loadOrScanDpdp)(root, "full", options.refresh === true);
|
|
51
|
+
return {
|
|
52
|
+
output: `${JSON.stringify(result.dataMap, null, 2)}\n`,
|
|
53
|
+
exitCode: 0
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
async function runDpdpReviewQueueCommand(root, options = {}) {
|
|
57
|
+
const result = await (0, scan_1.loadOrScanDpdp)(root, "full", options.refresh === true);
|
|
58
|
+
return {
|
|
59
|
+
output: (0, reviewQueue_1.renderReviewQueueMarkdown)(result.reviewQueue),
|
|
60
|
+
exitCode: 0
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
async function runDpdpReportCommand(root, options = {}) {
|
|
64
|
+
const result = await (0, scan_1.loadOrScanDpdp)(root, "full", options.refresh === true);
|
|
65
|
+
if (options.html) {
|
|
66
|
+
return { output: (0, report_1.renderDpdpHtmlReport)(result), exitCode: 0 };
|
|
67
|
+
}
|
|
68
|
+
if (options.markdown) {
|
|
69
|
+
return { output: (0, report_1.renderDpdpMarkdownReport)(result), exitCode: 0 };
|
|
70
|
+
}
|
|
71
|
+
return { output: (0, report_1.renderDpdpJsonReport)(result), exitCode: 0 };
|
|
72
|
+
}
|
|
73
|
+
async function runDpdpHandoffCommand(root, options = {}) {
|
|
74
|
+
const result = await (0, scan_1.loadOrScanDpdp)(root, "full", options.refresh === true);
|
|
75
|
+
const handoffPath = node_path_1.default.join(root, artifacts_1.DPDP_ARTIFACT_DIR, "agent-handoff.md");
|
|
76
|
+
const content = (0, report_1.renderAgentHandoff)(result);
|
|
77
|
+
await node_fs_1.promises.mkdir(node_path_1.default.dirname(handoffPath), { recursive: true });
|
|
78
|
+
await node_fs_1.promises.writeFile(handoffPath, content, "utf8");
|
|
79
|
+
return { output: content, exitCode: 0 };
|
|
80
|
+
}
|
|
81
|
+
async function runDpdpVerifyCommand(root) {
|
|
82
|
+
return runDpdpScanCommand(root, { changed: true, report: "terminal" });
|
|
83
|
+
}
|
|
84
|
+
async function runDpdpExplainCommand(root, id, options = {}) {
|
|
85
|
+
const explained = await (0, scan_1.explainDpdpTarget)(root, id, { refresh: options.refresh === true });
|
|
86
|
+
return {
|
|
87
|
+
output: `${JSON.stringify(explained, null, 2)}\n`,
|
|
88
|
+
exitCode: explained.type === "unknown" ? 1 : 0
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
async function readCachedDataMap(root) {
|
|
92
|
+
return (0, artifacts_1.readDpdpArtifact)(root, "data-map.json");
|
|
93
|
+
}
|
|
94
|
+
async function readCachedControlMatrix(root) {
|
|
95
|
+
return (0, artifacts_1.readDpdpArtifact)(root, "control-matrix.json");
|
|
96
|
+
}
|
|
97
|
+
async function ensureDpdpArtifactsExist(root) {
|
|
98
|
+
return (0, paths_1.pathExists)(node_path_1.default.join(root, artifacts_1.DPDP_ARTIFACT_DIR, "control-matrix.json"));
|
|
99
|
+
}
|
|
100
|
+
/** @deprecated Prefer loadOrScanDpdp from dpdp/scan — kept for internal callers. */
|
|
101
|
+
async function loadOrScan(root, mode, refresh = false) {
|
|
102
|
+
return (0, scan_1.loadOrScanDpdp)(root, mode, refresh);
|
|
103
|
+
}
|
|
@@ -9,6 +9,7 @@ const node_path_1 = __importDefault(require("node:path"));
|
|
|
9
9
|
const config_1 = require("../../core/config");
|
|
10
10
|
const paths_1 = require("../../core/paths");
|
|
11
11
|
const projectDetector_1 = require("../../core/projectDetector");
|
|
12
|
+
const suppressions_1 = require("../../core/suppressions");
|
|
12
13
|
function buildYaml(detectedLanguages) {
|
|
13
14
|
const languagesBlock = detectedLanguages.length > 0
|
|
14
15
|
? ` languages:\n${detectedLanguages.map((language) => ` - ${language}`).join("\n")}`
|
|
@@ -32,35 +33,81 @@ paths:
|
|
|
32
33
|
- dist/**
|
|
33
34
|
- build/**
|
|
34
35
|
- .venv/**
|
|
35
|
-
- coverage/**
|
|
36
|
-
- .next/**
|
|
37
|
-
- vendor/**
|
|
38
|
-
- .agents/**
|
|
39
|
-
- test/**
|
|
40
|
-
- tests/**
|
|
41
|
-
- "**/test/**"
|
|
42
|
-
- "**/tests/**"
|
|
43
|
-
- "**/*.test.*"
|
|
44
|
-
- "**/*.spec.*"
|
|
45
|
-
- "**/__tests__/**"
|
|
46
|
-
|
|
47
|
-
baseline:
|
|
36
|
+
- coverage/**
|
|
37
|
+
- .next/**
|
|
38
|
+
- vendor/**
|
|
39
|
+
- .agents/**
|
|
40
|
+
- test/**
|
|
41
|
+
- tests/**
|
|
42
|
+
- "**/test/**"
|
|
43
|
+
- "**/tests/**"
|
|
44
|
+
- "**/*.test.*"
|
|
45
|
+
- "**/*.spec.*"
|
|
46
|
+
- "**/__tests__/**"
|
|
47
|
+
|
|
48
|
+
baseline:
|
|
48
49
|
enabled: true
|
|
49
50
|
file: .vibedoctor/baseline.json
|
|
50
51
|
fail_only_on_new_issues: true
|
|
51
52
|
|
|
52
|
-
score:
|
|
53
|
-
minimum: ${config_1.defaultConfig.score.minimum}
|
|
54
|
-
|
|
55
|
-
runtime:
|
|
56
|
-
default_timeout_seconds: ${config_1.defaultConfig.runtime.defaultTimeoutSeconds}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
53
|
+
score:
|
|
54
|
+
minimum: ${config_1.defaultConfig.score.minimum}
|
|
55
|
+
|
|
56
|
+
runtime:
|
|
57
|
+
default_timeout_seconds: ${config_1.defaultConfig.runtime.defaultTimeoutSeconds}
|
|
58
|
+
# Per-tool time budgets. A tool that exceeds its budget is reported as timed
|
|
59
|
+
# out, never as passing.
|
|
60
|
+
tool_timeouts:
|
|
61
|
+
biome: ${config_1.defaultConfig.runtime.toolTimeouts.biome}
|
|
62
|
+
semgrep: ${config_1.defaultConfig.runtime.toolTimeouts.semgrep}
|
|
63
|
+
required_tools: []
|
|
64
|
+
fail_on_incomplete_scan: false
|
|
65
|
+
# Wall-clock ceiling for the whole scan; 0 means no ceiling.
|
|
66
|
+
total_budget_seconds: ${config_1.defaultConfig.runtime.totalBudgetSeconds}
|
|
67
|
+
# On timeout: scoped_retry reruns the tool over changed files only and reports
|
|
68
|
+
# the partial coverage. Alternatives: skip, fail.
|
|
69
|
+
on_timeout: ${config_1.defaultConfig.runtime.onTimeout}
|
|
70
|
+
scoped_retry_timeout_seconds: ${config_1.defaultConfig.runtime.scopedRetryTimeoutSeconds}
|
|
71
|
+
# Tools deliberately not run. The report says they were deferred rather than
|
|
72
|
+
# implying they passed — use this for tools this environment cannot support.
|
|
73
|
+
deferred_tools: []
|
|
74
|
+
verify_tools_before_scan: true
|
|
75
|
+
|
|
76
|
+
# Controls how much of what the tools report actually reaches the report.
|
|
77
|
+
# Nothing is dropped silently: every filter states what it withheld and why.
|
|
78
|
+
relevance:
|
|
79
|
+
enabled: true
|
|
80
|
+
min_confidence: ${config_1.defaultConfig.relevance.minConfidence}
|
|
81
|
+
max_findings_per_tool: ${config_1.defaultConfig.relevance.maxFindingsPerTool}
|
|
82
|
+
max_findings_total: ${config_1.defaultConfig.relevance.maxFindingsTotal}
|
|
83
|
+
# Findings in tests, fixtures, generated, and vendored files: keep, downgrade,
|
|
84
|
+
# or drop.
|
|
85
|
+
synthetic_file_policy: ${config_1.defaultConfig.relevance.syntheticFilePolicy}
|
|
86
|
+
# Check that findings claiming to be credentials look like credentials.
|
|
87
|
+
validate_secrets: true
|
|
88
|
+
per_tool:
|
|
89
|
+
vulture:
|
|
90
|
+
min_confidence: medium
|
|
91
|
+
max_findings: 50
|
|
92
|
+
pyright:
|
|
93
|
+
max_findings: 150
|
|
94
|
+
tsc:
|
|
95
|
+
max_findings: 150
|
|
96
|
+
# Correct a file-role misclassification without disabling the defaults.
|
|
97
|
+
# file_roles:
|
|
98
|
+
# source: ["fixtures/real/**"]
|
|
99
|
+
|
|
100
|
+
# Acknowledged findings live in this file. Each entry needs a reason; an expiry
|
|
101
|
+
# date is strongly recommended, because a lapsed acknowledgement resurfaces its
|
|
102
|
+
# findings instead of hiding them forever.
|
|
103
|
+
suppressions:
|
|
104
|
+
enabled: true
|
|
105
|
+
file: ${config_1.defaultConfig.suppressions.file}
|
|
106
|
+
# Turn this on to reject acknowledgements that have no expiry date: they are
|
|
107
|
+
# listed as rejected in the report and hide nothing.
|
|
108
|
+
require_expiry: false
|
|
109
|
+
|
|
110
|
+
checks:
|
|
64
111
|
security:
|
|
65
112
|
enabled: true
|
|
66
113
|
fail_on_secrets: true
|
|
@@ -94,33 +141,33 @@ checks:
|
|
|
94
141
|
min_coverage: 70
|
|
95
142
|
min_changed_code_coverage: 80
|
|
96
143
|
|
|
97
|
-
dependencies:
|
|
98
|
-
enabled: true
|
|
99
|
-
fail_on_missing_dependencies: true
|
|
100
|
-
fail_on_new_direct_vulnerabilities: true
|
|
101
|
-
|
|
102
|
-
privacy:
|
|
103
|
-
enabled: true
|
|
104
|
-
min_confidence_to_report: medium
|
|
105
|
-
mask_examples: true
|
|
106
|
-
max_file_bytes: 1048576
|
|
107
|
-
fail_on_regulated_identifiers: false
|
|
108
|
-
fail_on_sensitive_attributes: false
|
|
109
|
-
ai:
|
|
110
|
-
enabled: false
|
|
111
|
-
api_key_env: VIBEDOCTOR_AI_API_KEY
|
|
112
|
-
base_url_env: VIBEDOCTOR_AI_BASE_URL
|
|
113
|
-
model_env: VIBEDOCTOR_AI_MODEL
|
|
114
|
-
include_raw_values: false
|
|
115
|
-
presidio:
|
|
116
|
-
enabled: false
|
|
117
|
-
|
|
118
|
-
output:
|
|
144
|
+
dependencies:
|
|
145
|
+
enabled: true
|
|
146
|
+
fail_on_missing_dependencies: true
|
|
147
|
+
fail_on_new_direct_vulnerabilities: true
|
|
148
|
+
|
|
149
|
+
privacy:
|
|
150
|
+
enabled: true
|
|
151
|
+
min_confidence_to_report: medium
|
|
152
|
+
mask_examples: true
|
|
153
|
+
max_file_bytes: 1048576
|
|
154
|
+
fail_on_regulated_identifiers: false
|
|
155
|
+
fail_on_sensitive_attributes: false
|
|
156
|
+
ai:
|
|
157
|
+
enabled: false
|
|
158
|
+
api_key_env: VIBEDOCTOR_AI_API_KEY
|
|
159
|
+
base_url_env: VIBEDOCTOR_AI_BASE_URL
|
|
160
|
+
model_env: VIBEDOCTOR_AI_MODEL
|
|
161
|
+
include_raw_values: false
|
|
162
|
+
presidio:
|
|
163
|
+
enabled: false
|
|
164
|
+
|
|
165
|
+
output:
|
|
119
166
|
terminal: true
|
|
120
167
|
json: .vibedoctor/report.json
|
|
121
|
-
html: .vibedoctor/report.html
|
|
122
|
-
agent: .vibedoctor/agent-plan.md
|
|
123
|
-
privacy_review: .vibedoctor/privacy-review.json
|
|
168
|
+
html: .vibedoctor/report.html
|
|
169
|
+
agent: .vibedoctor/agent-plan.md
|
|
170
|
+
privacy_review: .vibedoctor/privacy-review.json
|
|
124
171
|
`;
|
|
125
172
|
}
|
|
126
173
|
async function runInit(root) {
|
|
@@ -130,5 +177,13 @@ async function runInit(root) {
|
|
|
130
177
|
await (0, paths_1.ensureDir)(baselineDir);
|
|
131
178
|
await node_fs_1.promises.writeFile(configPath, buildYaml(project.languages), "utf8");
|
|
132
179
|
await node_fs_1.promises.writeFile(node_path_1.default.join(baselineDir, "baseline.json"), JSON.stringify({ createdAt: new Date().toISOString(), findings: [] }, null, 2), "utf8");
|
|
180
|
+
// Scaffold the acknowledgements file with its rules explained, so the first
|
|
181
|
+
// person who needs to suppress a false positive finds the format waiting for
|
|
182
|
+
// them instead of inventing one. Never overwrite an existing file.
|
|
183
|
+
const suppressionsPath = node_path_1.default.join(root, config_1.defaultConfig.suppressions.file);
|
|
184
|
+
if (!(await (0, paths_1.pathExists)(suppressionsPath))) {
|
|
185
|
+
await (0, paths_1.ensureDir)(node_path_1.default.dirname(suppressionsPath));
|
|
186
|
+
await node_fs_1.promises.writeFile(suppressionsPath, suppressions_1.SUPPRESSIONS_TEMPLATE, "utf8");
|
|
187
|
+
}
|
|
133
188
|
return configPath;
|
|
134
189
|
}
|
|
@@ -18,10 +18,9 @@ async function loadOrRefreshScan(root, refresh) {
|
|
|
18
18
|
const parsed = JSON.parse(await node_fs_1.promises.readFile(reportPath, "utf8"));
|
|
19
19
|
if (Array.isArray(parsed.findings)) {
|
|
20
20
|
const privacyFindings = parsed.privacyFindings ?? parsed.findings.filter((finding) => finding.category === "privacy");
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
21
|
+
// A cached report may predate fields this version expects, so fill the gaps
|
|
22
|
+
// rather than handing downstream code a half-built scan.
|
|
23
|
+
return (0, engine_1.withReportingDefaults)({ ...parsed, findings: parsed.findings, privacyFindings });
|
|
25
24
|
}
|
|
26
25
|
}
|
|
27
26
|
const scan = await (0, engine_1.runScan)(root, "full");
|
|
@@ -10,6 +10,7 @@ const json_1 = require("../../reporters/json");
|
|
|
10
10
|
const html_1 = require("../../reporters/html");
|
|
11
11
|
const agent_1 = require("../../reporters/agent");
|
|
12
12
|
const shared_1 = require("./shared");
|
|
13
|
+
const gates_1 = require("../../dpdp/gates");
|
|
13
14
|
function shouldCountForFailure(isNew, config) {
|
|
14
15
|
return config.baseline.failOnlyOnNewIssues ? isNew : true;
|
|
15
16
|
}
|
|
@@ -58,13 +59,15 @@ function determineExitCode(scan, config) {
|
|
|
58
59
|
isHighConfidence(finding) &&
|
|
59
60
|
!isReviewedFalsePositive(finding) &&
|
|
60
61
|
finding.evidence?.sensitivity === "high");
|
|
62
|
+
const dpdpFailure = (0, gates_1.evaluateDpdpFailureGate)(scan.findings.map(gates_1.findingToGateCandidate).filter((item) => item !== undefined), config);
|
|
61
63
|
return secretFailure ||
|
|
62
64
|
dependencyFailure ||
|
|
63
65
|
missingDependencyFailure ||
|
|
64
66
|
typeFailure ||
|
|
65
67
|
testFailure ||
|
|
66
68
|
regulatedIdentifierFailure ||
|
|
67
|
-
sensitiveAttributeFailure
|
|
69
|
+
sensitiveAttributeFailure ||
|
|
70
|
+
dpdpFailure
|
|
68
71
|
? 1
|
|
69
72
|
: 0;
|
|
70
73
|
}
|
|
@@ -1,35 +1,31 @@
|
|
|
1
1
|
import type { CommandSpec } from "../../core/toolRunner";
|
|
2
|
-
import { type ProjectContext
|
|
2
|
+
import { type ProjectContext } from "../../core/projectDetector";
|
|
3
|
+
import { type ToolRegistryEntry } from "../../core/toolRegistry";
|
|
4
|
+
import { type RuntimeProbes, type ToolVerification } from "../../core/toolVerification";
|
|
3
5
|
export type SetupPriority = "essential" | "recommended";
|
|
4
6
|
export type SetupInclude = "essential" | "recommended" | "all" | "npm" | "python" | "manual" | "built-in";
|
|
5
7
|
export type SetupOptions = {
|
|
6
8
|
apply?: boolean;
|
|
7
9
|
include?: SetupInclude;
|
|
8
10
|
};
|
|
9
|
-
type SetupTool = {
|
|
10
|
-
id: string;
|
|
11
|
-
packageName?: string;
|
|
12
|
-
executable?: string;
|
|
13
|
-
ecosystem: "npm" | "python" | "manual" | "built-in";
|
|
14
|
-
priority: SetupPriority;
|
|
15
|
-
languages?: ProjectLanguage[];
|
|
16
|
-
requiresLockfile?: boolean;
|
|
17
|
-
reason: string;
|
|
18
|
-
installHint?: string;
|
|
19
|
-
};
|
|
20
11
|
export type SetupPlan = {
|
|
21
12
|
project: ProjectContext;
|
|
22
|
-
builtIn:
|
|
23
|
-
available:
|
|
13
|
+
builtIn: ToolRegistryEntry[];
|
|
14
|
+
available: ToolRegistryEntry[];
|
|
24
15
|
npmPackages: string[];
|
|
25
16
|
pythonPackages: string[];
|
|
26
|
-
manual:
|
|
27
|
-
skipped:
|
|
17
|
+
manual: ToolRegistryEntry[];
|
|
18
|
+
skipped: Array<ToolRegistryEntry & {
|
|
19
|
+
installHint: string;
|
|
20
|
+
}>;
|
|
28
21
|
commands: CommandSpec[];
|
|
22
|
+
/** Runtimes the selected tools need, probed once up front. */
|
|
23
|
+
runtimes: RuntimeProbes;
|
|
24
|
+
/** Verification of every relevant tool as the scanner would resolve it. */
|
|
25
|
+
verifications: ToolVerification[];
|
|
29
26
|
};
|
|
30
27
|
export declare function createSetupPlan(root: string, include?: SetupInclude): Promise<SetupPlan>;
|
|
31
28
|
export declare function runSetupCommand(root: string, options?: SetupOptions): Promise<{
|
|
32
29
|
output: string;
|
|
33
30
|
exitCode: number;
|
|
34
31
|
}>;
|
|
35
|
-
export {};
|