@neuralaxis/vibedoctor 0.1.2 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +215 -102
- package/dist/adapters/biome.d.ts +1 -1
- package/dist/adapters/biome.js +7 -4
- package/dist/adapters/coveragePy.js +3 -0
- package/dist/adapters/deptry.js +21 -2
- 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/knip.js +29 -4
- package/dist/adapters/lizard.d.ts +1 -1
- package/dist/adapters/lizard.js +51 -2
- package/dist/adapters/osvScanner.js +14 -2
- package/dist/adapters/presidio.js +3 -1
- package/dist/adapters/privacyDetector.d.ts +24 -1
- package/dist/adapters/privacyDetector.js +91 -7
- package/dist/adapters/ruff.d.ts +1 -1
- package/dist/adapters/ruff.js +4 -1
- package/dist/adapters/semgrep.d.ts +1 -1
- package/dist/adapters/semgrep.js +17 -3
- package/dist/adapters/shared.d.ts +7 -0
- package/dist/adapters/shared.js +22 -0
- package/dist/adapters/tsc.js +43 -18
- package/dist/adapters/vulture.d.ts +1 -1
- package/dist/adapters/vulture.js +25 -6
- package/dist/agentPack/templates/index.js +7 -4
- package/dist/agentPack/templates/skills.js +156 -44
- package/dist/cli/commands/agentPlan.js +9 -1
- package/dist/cli/commands/dpdp.d.ts +35 -0
- package/dist/cli/commands/dpdp.js +103 -0
- package/dist/cli/commands/init.js +12 -4
- package/dist/cli/commands/scan.d.ts +1 -1
- package/dist/cli/commands/scan.js +8 -1
- package/dist/cli/commands/setup.js +4 -2
- package/dist/cli/commands/tool.d.ts +4 -0
- package/dist/cli/commands/tool.js +11 -0
- package/dist/cli/index.js +96 -0
- package/dist/core/config.d.ts +27 -0
- package/dist/core/config.js +118 -5
- package/dist/core/engine.d.ts +32 -1
- package/dist/core/engine.js +195 -30
- package/dist/core/finding.d.ts +1 -1
- package/dist/core/finding.js +1 -0
- package/dist/core/projectDetector.d.ts +1 -1
- package/dist/core/projectDetector.js +29 -12
- package/dist/core/scanPlanner.js +10 -2
- package/dist/core/toolRunner.d.ts +1 -0
- package/dist/core/toolRunner.js +73 -11
- 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 +347 -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 +14 -0
- package/dist/dpdp/findings.js +99 -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 +31 -0
- package/dist/dpdp/scoring.js +211 -0
- package/dist/dpdp/types.d.ts +294 -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/mcp/tools/shared.js +8 -1
- package/dist/reporters/agent.js +8 -0
- package/dist/reporters/html.js +4 -2
- package/dist/reporters/json.js +8 -1
- package/dist/reporters/markdown.js +8 -1
- package/package.json +9 -2
|
@@ -62,7 +62,12 @@ vibedoctor scan --full --report json
|
|
|
62
62
|
|
|
63
63
|
3. Read \`.vibedoctor/report.json\`.
|
|
64
64
|
|
|
65
|
-
4.
|
|
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:
|
|
66
71
|
- security blockers
|
|
67
72
|
- correctness blockers
|
|
68
73
|
- failing tests
|
|
@@ -80,6 +85,7 @@ Give only:
|
|
|
80
85
|
- safest next command
|
|
81
86
|
- top 3 fixes
|
|
82
87
|
- whether work is safe to continue
|
|
88
|
+
- scan completeness and any missing tool coverage
|
|
83
89
|
|
|
84
90
|
Do not paste the full JSON unless the user asks.
|
|
85
91
|
`),
|
|
@@ -119,52 +125,158 @@ Report:
|
|
|
119
125
|
- remaining blockers
|
|
120
126
|
- verification result
|
|
121
127
|
`),
|
|
122
|
-
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.", `
|
|
123
|
-
# VibeDoctor Privacy Review
|
|
124
|
-
|
|
125
|
-
Use this skill for personal-data and PII discovery findings.
|
|
126
|
-
|
|
127
|
-
## Default workflow
|
|
128
|
-
|
|
129
|
-
1. Run the deterministic privacy scan:
|
|
130
|
-
|
|
131
|
-
\`\`\`bash
|
|
132
|
-
vibedoctor scan --category privacy --report json
|
|
133
|
-
\`\`\`
|
|
134
|
-
|
|
135
|
-
2. Read \`.vibedoctor/report.json\`, focusing on \`privacyFindings\`.
|
|
136
|
-
|
|
137
|
-
3. Group findings into:
|
|
138
|
-
- confirmed regulated identifiers
|
|
139
|
-
- likely personal data
|
|
140
|
-
- combination-risk fields
|
|
141
|
-
- false positives or needs human review
|
|
142
|
-
|
|
143
|
-
4. Use masked evidence only. Do not request raw values unless the user explicitly asks and the repository policy allows it.
|
|
144
|
-
|
|
145
|
-
## Optional API-key review
|
|
146
|
-
|
|
147
|
-
Only run this command when \`checks.privacy.ai.enabled\` is true and the required env vars are configured:
|
|
148
|
-
|
|
149
|
-
\`\`\`bash
|
|
150
|
-
vibedoctor privacy-review --refresh --format markdown
|
|
151
|
-
\`\`\`
|
|
152
|
-
|
|
153
|
-
## 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.
|
|
154
192
|
|
|
155
|
-
-
|
|
156
|
-
- Treat medium-confidence Privacy Review findings as review candidates, not automatic truth.
|
|
157
|
-
- For regulated identifiers or sensitive attributes, recommend removal, anonymization, or controlled test fixtures.
|
|
158
|
-
- For combination risk, explain which fields create the re-identification risk together.
|
|
193
|
+
## Legal-source freshness gate
|
|
159
194
|
|
|
160
|
-
|
|
195
|
+
Perform this gate whenever the answer interprets a control against DPDP law, rules, commencement, or enforcement status.
|
|
161
196
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
-
|
|
167
|
-
-
|
|
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.
|
|
168
280
|
`),
|
|
169
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.", `
|
|
170
282
|
# VibeDoctor Dead Code Cleanup
|
|
@@ -7,6 +7,14 @@ const agent_1 = require("../../reporters/agent");
|
|
|
7
7
|
async function runAgentPlanCommand(root, format = "markdown", target = undefined) {
|
|
8
8
|
const scan = await (0, engine_1.runScan)(root, "default");
|
|
9
9
|
const { policy } = await (0, policy_1.loadAgentPolicy)(root);
|
|
10
|
-
const plan = (0, engine_1.createAgentPlan)({
|
|
10
|
+
const plan = (0, engine_1.createAgentPlan)({
|
|
11
|
+
findings: scan.findings,
|
|
12
|
+
score: scan.score,
|
|
13
|
+
skippedTools: scan.skippedTools,
|
|
14
|
+
toolStatuses: scan.toolStatuses,
|
|
15
|
+
completeness: scan.completeness,
|
|
16
|
+
recoveryActions: scan.recoveryActions,
|
|
17
|
+
testCommands: scan.testCommands
|
|
18
|
+
}, { policy, target: target ?? "generic" });
|
|
11
19
|
return format === "json" ? `${(0, agent_1.renderAgentJson)(plan)}\n` : (0, agent_1.renderAgentMarkdown)(plan);
|
|
12
20
|
}
|
|
@@ -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
|
+
}
|
|
@@ -49,10 +49,18 @@ baseline:
|
|
|
49
49
|
file: .vibedoctor/baseline.json
|
|
50
50
|
fail_only_on_new_issues: true
|
|
51
51
|
|
|
52
|
-
score:
|
|
53
|
-
minimum: ${config_1.defaultConfig.score.minimum}
|
|
54
|
-
|
|
55
|
-
|
|
52
|
+
score:
|
|
53
|
+
minimum: ${config_1.defaultConfig.score.minimum}
|
|
54
|
+
|
|
55
|
+
runtime:
|
|
56
|
+
default_timeout_seconds: ${config_1.defaultConfig.runtime.defaultTimeoutSeconds}
|
|
57
|
+
tool_timeouts:
|
|
58
|
+
biome: ${config_1.defaultConfig.runtime.toolTimeouts.biome}
|
|
59
|
+
semgrep: ${config_1.defaultConfig.runtime.toolTimeouts.semgrep}
|
|
60
|
+
required_tools: []
|
|
61
|
+
fail_on_incomplete_scan: false
|
|
62
|
+
|
|
63
|
+
checks:
|
|
56
64
|
security:
|
|
57
65
|
enabled: true
|
|
58
66
|
fail_on_secrets: true
|
|
@@ -4,7 +4,7 @@ export type ScanCommandResult = {
|
|
|
4
4
|
output: string;
|
|
5
5
|
exitCode: number;
|
|
6
6
|
};
|
|
7
|
-
export declare function determineExitCode(scan: Pick<ScanOutput, "score" | "findings"
|
|
7
|
+
export declare function determineExitCode(scan: Pick<ScanOutput, "score" | "findings"> & Partial<Pick<ScanOutput, "completeness">>, config: VibeDoctorConfig): number;
|
|
8
8
|
export declare function runScanCommand(root: string, options: {
|
|
9
9
|
changed?: boolean;
|
|
10
10
|
quick?: boolean;
|
|
@@ -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
|
}
|
|
@@ -23,6 +24,10 @@ function isReviewedFalsePositive(finding) {
|
|
|
23
24
|
return finding.evidence?.reviewState === "false_positive";
|
|
24
25
|
}
|
|
25
26
|
function determineExitCode(scan, config) {
|
|
27
|
+
if (scan.completeness &&
|
|
28
|
+
(scan.completeness.status === "invalid" || (config.runtime.failOnIncompleteScan && scan.completeness.status !== "complete"))) {
|
|
29
|
+
return 2;
|
|
30
|
+
}
|
|
26
31
|
if (scan.score.overall < config.score.minimum) {
|
|
27
32
|
return 1;
|
|
28
33
|
}
|
|
@@ -54,13 +59,15 @@ function determineExitCode(scan, config) {
|
|
|
54
59
|
isHighConfidence(finding) &&
|
|
55
60
|
!isReviewedFalsePositive(finding) &&
|
|
56
61
|
finding.evidence?.sensitivity === "high");
|
|
62
|
+
const dpdpFailure = (0, gates_1.evaluateDpdpFailureGate)(scan.findings.map(gates_1.findingToGateCandidate).filter((item) => item !== undefined), config);
|
|
57
63
|
return secretFailure ||
|
|
58
64
|
dependencyFailure ||
|
|
59
65
|
missingDependencyFailure ||
|
|
60
66
|
typeFailure ||
|
|
61
67
|
testFailure ||
|
|
62
68
|
regulatedIdentifierFailure ||
|
|
63
|
-
sensitiveAttributeFailure
|
|
69
|
+
sensitiveAttributeFailure ||
|
|
70
|
+
dpdpFailure
|
|
64
71
|
? 1
|
|
65
72
|
: 0;
|
|
66
73
|
}
|
|
@@ -8,6 +8,7 @@ exports.runSetupCommand = runSetupCommand;
|
|
|
8
8
|
const node_path_1 = __importDefault(require("node:path"));
|
|
9
9
|
const toolRunner_1 = require("../../core/toolRunner");
|
|
10
10
|
const projectDetector_1 = require("../../core/projectDetector");
|
|
11
|
+
const config_1 = require("../../core/config");
|
|
11
12
|
const paths_1 = require("../../core/paths");
|
|
12
13
|
const VALID_SETUP_INCLUDES = new Set(["essential", "recommended", "all", "npm", "python", "manual", "built-in"]);
|
|
13
14
|
const essentialTools = [
|
|
@@ -164,7 +165,7 @@ const recommendedTools = [
|
|
|
164
165
|
id: "presidio",
|
|
165
166
|
ecosystem: "manual",
|
|
166
167
|
priority: "recommended",
|
|
167
|
-
reason: "
|
|
168
|
+
reason: "External PII analyzer used by privacy + DPDP scans by default (skipped gracefully if missing). The normal privacy and DPDP opt-outs are independent.",
|
|
168
169
|
installHint: "Install in the project Python environment with: python -m pip install presidio-analyzer"
|
|
169
170
|
}
|
|
170
171
|
];
|
|
@@ -253,7 +254,8 @@ function resolveTools(include) {
|
|
|
253
254
|
return combined.filter((tool) => tool.ecosystem === include);
|
|
254
255
|
}
|
|
255
256
|
async function createSetupPlan(root, include = "recommended") {
|
|
256
|
-
const
|
|
257
|
+
const { config } = await (0, config_1.loadConfig)(root);
|
|
258
|
+
const project = await (0, projectDetector_1.detectProject)(root, config.paths.exclude);
|
|
257
259
|
const tools = resolveTools(include);
|
|
258
260
|
const relevantTools = tools.filter((tool) => appliesToProject(tool, project));
|
|
259
261
|
const builtIn = relevantTools.filter((tool) => tool.ecosystem === "built-in");
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.runToolRetryCommand = runToolRetryCommand;
|
|
4
|
+
const engine_1 = require("../../core/engine");
|
|
5
|
+
async function runToolRetryCommand(root, toolId, timeoutSeconds) {
|
|
6
|
+
const result = await (0, engine_1.retryTool)(root, toolId, timeoutSeconds);
|
|
7
|
+
return {
|
|
8
|
+
output: `${JSON.stringify(result, null, 2)}\n`,
|
|
9
|
+
exitCode: result.status === "ok" ? 0 : 2
|
|
10
|
+
};
|
|
11
|
+
}
|
package/dist/cli/index.js
CHANGED
|
@@ -15,9 +15,11 @@ const fix_1 = require("./commands/fix");
|
|
|
15
15
|
const init_1 = require("./commands/init");
|
|
16
16
|
const server_1 = require("../mcp/server");
|
|
17
17
|
const privacyReview_1 = require("./commands/privacyReview");
|
|
18
|
+
const dpdp_1 = require("./commands/dpdp");
|
|
18
19
|
const report_1 = require("./commands/report");
|
|
19
20
|
const scan_1 = require("./commands/scan");
|
|
20
21
|
const setup_1 = require("./commands/setup");
|
|
22
|
+
const tool_1 = require("./commands/tool");
|
|
21
23
|
function getVersion() {
|
|
22
24
|
try {
|
|
23
25
|
// After `npm version patch` + publish, package.json is shipped (see "files").
|
|
@@ -122,6 +124,17 @@ async function main() {
|
|
|
122
124
|
process.stdout.write(await (0, agent_1.runAgentSyncCommand)(process.cwd(), options));
|
|
123
125
|
process.exit(0);
|
|
124
126
|
});
|
|
127
|
+
const tool = program.command("tool").description("Inspect and recover individual scanner tools");
|
|
128
|
+
tool
|
|
129
|
+
.command("retry")
|
|
130
|
+
.description("Retry one scanner with an extended deadline")
|
|
131
|
+
.argument("<tool-id>")
|
|
132
|
+
.option("--timeout <seconds>", "Override the retry deadline in seconds", (value) => Number(value))
|
|
133
|
+
.action(async (toolId, options) => {
|
|
134
|
+
const result = await (0, tool_1.runToolRetryCommand)(process.cwd(), toolId, options.timeout);
|
|
135
|
+
process.stdout.write(result.output);
|
|
136
|
+
process.exit(result.exitCode);
|
|
137
|
+
});
|
|
125
138
|
agent
|
|
126
139
|
.command("plugin")
|
|
127
140
|
.description("Generate installable Codex and Claude plugin bundle files")
|
|
@@ -189,6 +202,89 @@ async function main() {
|
|
|
189
202
|
process.stdout.write(result.output);
|
|
190
203
|
process.exit(result.exitCode);
|
|
191
204
|
});
|
|
205
|
+
const dpdp = program
|
|
206
|
+
.command("dpdp")
|
|
207
|
+
.description("DPDP technical readiness assessment (not legal certification)");
|
|
208
|
+
dpdp
|
|
209
|
+
.command("init")
|
|
210
|
+
.description("Create optional DPDP context and declared-evidence scaffolding")
|
|
211
|
+
.action(async () => {
|
|
212
|
+
const result = await (0, dpdp_1.runDpdpInitCommand)(process.cwd());
|
|
213
|
+
process.stdout.write(result.output);
|
|
214
|
+
process.exit(result.exitCode);
|
|
215
|
+
});
|
|
216
|
+
dpdp
|
|
217
|
+
.command("scan")
|
|
218
|
+
.description("Run deterministic DPDP technical readiness scan")
|
|
219
|
+
.option("--full", "Full repository scan (default)", true)
|
|
220
|
+
.option("--changed", "Collect evidence only from git changed files (falls back to full scope if no delta); control matrix remains full catalogue")
|
|
221
|
+
.option("--report <format>", "terminal|json|html|markdown", "terminal")
|
|
222
|
+
.action(async (options) => {
|
|
223
|
+
const result = await (0, dpdp_1.runDpdpScanCommand)(process.cwd(), {
|
|
224
|
+
full: !options.changed,
|
|
225
|
+
changed: Boolean(options.changed),
|
|
226
|
+
report: options.report
|
|
227
|
+
});
|
|
228
|
+
process.stdout.write(result.output);
|
|
229
|
+
process.exit(result.exitCode);
|
|
230
|
+
});
|
|
231
|
+
dpdp
|
|
232
|
+
.command("map")
|
|
233
|
+
.description("Print the personal-data processing map JSON (uses cached artifacts unless --refresh)")
|
|
234
|
+
.option("--refresh", "Force a new scan before printing", false)
|
|
235
|
+
.action(async (options) => {
|
|
236
|
+
const result = await (0, dpdp_1.runDpdpMapCommand)(process.cwd(), { refresh: Boolean(options.refresh) });
|
|
237
|
+
process.stdout.write(result.output);
|
|
238
|
+
process.exit(result.exitCode);
|
|
239
|
+
});
|
|
240
|
+
dpdp
|
|
241
|
+
.command("review-queue")
|
|
242
|
+
.description("Print human-review questions grouped by audience (uses cached artifacts unless --refresh)")
|
|
243
|
+
.option("--refresh", "Force a new scan before printing", false)
|
|
244
|
+
.action(async (options) => {
|
|
245
|
+
const result = await (0, dpdp_1.runDpdpReviewQueueCommand)(process.cwd(), { refresh: Boolean(options.refresh) });
|
|
246
|
+
process.stdout.write(result.output);
|
|
247
|
+
process.exit(result.exitCode);
|
|
248
|
+
});
|
|
249
|
+
dpdp
|
|
250
|
+
.command("report")
|
|
251
|
+
.description("Emit DPDP readiness report (uses cached artifacts unless --refresh)")
|
|
252
|
+
.option("--json", "JSON report")
|
|
253
|
+
.option("--html", "HTML report")
|
|
254
|
+
.option("--markdown", "Markdown report")
|
|
255
|
+
.option("--refresh", "Force a new scan before reporting", false)
|
|
256
|
+
.action(async (options) => {
|
|
257
|
+
const result = await (0, dpdp_1.runDpdpReportCommand)(process.cwd(), options);
|
|
258
|
+
process.stdout.write(result.output);
|
|
259
|
+
process.exit(result.exitCode);
|
|
260
|
+
});
|
|
261
|
+
dpdp
|
|
262
|
+
.command("handoff")
|
|
263
|
+
.description("Generate agent handoff markdown from deterministic artifacts (cached unless --refresh)")
|
|
264
|
+
.option("--refresh", "Force a new scan before generating handoff", false)
|
|
265
|
+
.action(async (options) => {
|
|
266
|
+
const result = await (0, dpdp_1.runDpdpHandoffCommand)(process.cwd(), { refresh: Boolean(options.refresh) });
|
|
267
|
+
process.stdout.write(result.output);
|
|
268
|
+
process.exit(result.exitCode);
|
|
269
|
+
});
|
|
270
|
+
dpdp
|
|
271
|
+
.command("verify")
|
|
272
|
+
.description("Re-run DPDP collection on changed files for post-fix verification (same scope as scan --changed; falls back to full if no git delta)")
|
|
273
|
+
.action(async () => {
|
|
274
|
+
const result = await (0, dpdp_1.runDpdpVerifyCommand)(process.cwd());
|
|
275
|
+
process.stdout.write(result.output);
|
|
276
|
+
process.exit(result.exitCode);
|
|
277
|
+
});
|
|
278
|
+
dpdp
|
|
279
|
+
.command("explain")
|
|
280
|
+
.description("Explain a DPDP control or finding id (uses cached artifacts unless --refresh)")
|
|
281
|
+
.argument("<control-or-finding-id>")
|
|
282
|
+
.option("--refresh", "Force a new scan before explaining", false)
|
|
283
|
+
.action(async (id, options) => {
|
|
284
|
+
const result = await (0, dpdp_1.runDpdpExplainCommand)(process.cwd(), id, { refresh: Boolean(options.refresh) });
|
|
285
|
+
process.stdout.write(result.output);
|
|
286
|
+
process.exit(result.exitCode);
|
|
287
|
+
});
|
|
192
288
|
program
|
|
193
289
|
.command("mcp")
|
|
194
290
|
.description("Start the VibeDoctor MCP server over stdio")
|
package/dist/core/config.d.ts
CHANGED
|
@@ -17,6 +17,12 @@ export type VibeDoctorConfig = {
|
|
|
17
17
|
score: {
|
|
18
18
|
minimum: number;
|
|
19
19
|
};
|
|
20
|
+
runtime: {
|
|
21
|
+
defaultTimeoutSeconds: number;
|
|
22
|
+
toolTimeouts: Record<string, number>;
|
|
23
|
+
requiredTools: string[];
|
|
24
|
+
failOnIncompleteScan: boolean;
|
|
25
|
+
};
|
|
20
26
|
checks: {
|
|
21
27
|
security: {
|
|
22
28
|
enabled: boolean;
|
|
@@ -78,6 +84,27 @@ export type VibeDoctorConfig = {
|
|
|
78
84
|
enabled: boolean;
|
|
79
85
|
};
|
|
80
86
|
};
|
|
87
|
+
dpdp: {
|
|
88
|
+
enabled: boolean;
|
|
89
|
+
include: string[];
|
|
90
|
+
exclude: string[];
|
|
91
|
+
minConfidenceToReport: "low" | "medium" | "high";
|
|
92
|
+
maskExamples: boolean;
|
|
93
|
+
usePresidio: boolean;
|
|
94
|
+
useSemgrep: boolean;
|
|
95
|
+
legalSourceVersion: string;
|
|
96
|
+
contextFile: string;
|
|
97
|
+
evidenceFile: string;
|
|
98
|
+
failOnSeverity: Array<"info" | "low" | "medium" | "high" | "critical">;
|
|
99
|
+
failOnViolatedControls: string[];
|
|
100
|
+
failOnlyOnNew: boolean;
|
|
101
|
+
organization: {
|
|
102
|
+
processesPersonalData: "true" | "false" | "unknown";
|
|
103
|
+
isSignificantDataFiduciary: "true" | "false" | "unknown";
|
|
104
|
+
processesChildrenData: "true" | "false" | "unknown";
|
|
105
|
+
hasCrossBorderTransfer: "true" | "false" | "unknown";
|
|
106
|
+
};
|
|
107
|
+
};
|
|
81
108
|
};
|
|
82
109
|
output: {
|
|
83
110
|
terminal: boolean;
|