@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.
Files changed (109) hide show
  1. package/README.md +215 -102
  2. package/dist/adapters/biome.d.ts +1 -1
  3. package/dist/adapters/biome.js +7 -4
  4. package/dist/adapters/coveragePy.js +3 -0
  5. package/dist/adapters/deptry.js +21 -2
  6. package/dist/adapters/dpdp.d.ts +6 -0
  7. package/dist/adapters/dpdp.js +34 -0
  8. package/dist/adapters/index.d.ts +1 -0
  9. package/dist/adapters/index.js +3 -1
  10. package/dist/adapters/knip.js +29 -4
  11. package/dist/adapters/lizard.d.ts +1 -1
  12. package/dist/adapters/lizard.js +51 -2
  13. package/dist/adapters/osvScanner.js +14 -2
  14. package/dist/adapters/presidio.js +3 -1
  15. package/dist/adapters/privacyDetector.d.ts +24 -1
  16. package/dist/adapters/privacyDetector.js +91 -7
  17. package/dist/adapters/ruff.d.ts +1 -1
  18. package/dist/adapters/ruff.js +4 -1
  19. package/dist/adapters/semgrep.d.ts +1 -1
  20. package/dist/adapters/semgrep.js +17 -3
  21. package/dist/adapters/shared.d.ts +7 -0
  22. package/dist/adapters/shared.js +22 -0
  23. package/dist/adapters/tsc.js +43 -18
  24. package/dist/adapters/vulture.d.ts +1 -1
  25. package/dist/adapters/vulture.js +25 -6
  26. package/dist/agentPack/templates/index.js +7 -4
  27. package/dist/agentPack/templates/skills.js +156 -44
  28. package/dist/cli/commands/agentPlan.js +9 -1
  29. package/dist/cli/commands/dpdp.d.ts +35 -0
  30. package/dist/cli/commands/dpdp.js +103 -0
  31. package/dist/cli/commands/init.js +12 -4
  32. package/dist/cli/commands/scan.d.ts +1 -1
  33. package/dist/cli/commands/scan.js +8 -1
  34. package/dist/cli/commands/setup.js +4 -2
  35. package/dist/cli/commands/tool.d.ts +4 -0
  36. package/dist/cli/commands/tool.js +11 -0
  37. package/dist/cli/index.js +96 -0
  38. package/dist/core/config.d.ts +27 -0
  39. package/dist/core/config.js +118 -5
  40. package/dist/core/engine.d.ts +32 -1
  41. package/dist/core/engine.js +195 -30
  42. package/dist/core/finding.d.ts +1 -1
  43. package/dist/core/finding.js +1 -0
  44. package/dist/core/projectDetector.d.ts +1 -1
  45. package/dist/core/projectDetector.js +29 -12
  46. package/dist/core/scanPlanner.js +10 -2
  47. package/dist/core/toolRunner.d.ts +1 -0
  48. package/dist/core/toolRunner.js +73 -11
  49. package/dist/dpdp/artifacts.d.ts +11 -0
  50. package/dist/dpdp/artifacts.js +120 -0
  51. package/dist/dpdp/catalogue.d.ts +14 -0
  52. package/dist/dpdp/catalogue.js +661 -0
  53. package/dist/dpdp/collectors/confidence.d.ts +9 -0
  54. package/dist/dpdp/collectors/confidence.js +25 -0
  55. package/dist/dpdp/collectors/dependencies.d.ts +7 -0
  56. package/dist/dpdp/collectors/dependencies.js +63 -0
  57. package/dist/dpdp/collectors/index.d.ts +24 -0
  58. package/dist/dpdp/collectors/index.js +71 -0
  59. package/dist/dpdp/collectors/lifecycle.d.ts +2 -0
  60. package/dist/dpdp/collectors/lifecycle.js +202 -0
  61. package/dist/dpdp/collectors/optionalScanners.d.ts +14 -0
  62. package/dist/dpdp/collectors/optionalScanners.js +347 -0
  63. package/dist/dpdp/collectors/privacyBridge.d.ts +13 -0
  64. package/dist/dpdp/collectors/privacyBridge.js +152 -0
  65. package/dist/dpdp/collectors/safeguards.d.ts +5 -0
  66. package/dist/dpdp/collectors/safeguards.js +186 -0
  67. package/dist/dpdp/collectors/schema.d.ts +6 -0
  68. package/dist/dpdp/collectors/schema.js +122 -0
  69. package/dist/dpdp/collectors/shared.d.ts +10 -0
  70. package/dist/dpdp/collectors/shared.js +43 -0
  71. package/dist/dpdp/context.d.ts +28 -0
  72. package/dist/dpdp/context.js +195 -0
  73. package/dist/dpdp/dataMap.d.ts +7 -0
  74. package/dist/dpdp/dataMap.js +339 -0
  75. package/dist/dpdp/evaluators.d.ts +20 -0
  76. package/dist/dpdp/evaluators.js +522 -0
  77. package/dist/dpdp/evidence.d.ts +11 -0
  78. package/dist/dpdp/evidence.js +123 -0
  79. package/dist/dpdp/findings.d.ts +14 -0
  80. package/dist/dpdp/findings.js +99 -0
  81. package/dist/dpdp/gates.d.ts +14 -0
  82. package/dist/dpdp/gates.js +47 -0
  83. package/dist/dpdp/index.d.ts +16 -0
  84. package/dist/dpdp/index.js +32 -0
  85. package/dist/dpdp/legalSources.d.ts +10 -0
  86. package/dist/dpdp/legalSources.js +104 -0
  87. package/dist/dpdp/paths.d.ts +25 -0
  88. package/dist/dpdp/paths.js +85 -0
  89. package/dist/dpdp/report.d.ts +6 -0
  90. package/dist/dpdp/report.js +222 -0
  91. package/dist/dpdp/reviewQueue.d.ts +3 -0
  92. package/dist/dpdp/reviewQueue.js +88 -0
  93. package/dist/dpdp/scan.d.ts +26 -0
  94. package/dist/dpdp/scan.js +310 -0
  95. package/dist/dpdp/scoring.d.ts +31 -0
  96. package/dist/dpdp/scoring.js +211 -0
  97. package/dist/dpdp/types.d.ts +294 -0
  98. package/dist/dpdp/types.js +86 -0
  99. package/dist/index.d.ts +1 -0
  100. package/dist/index.js +1 -0
  101. package/dist/mcp/tools/dpdp.d.ts +11 -0
  102. package/dist/mcp/tools/dpdp.js +151 -0
  103. package/dist/mcp/tools/index.js +3 -1
  104. package/dist/mcp/tools/shared.js +8 -1
  105. package/dist/reporters/agent.js +8 -0
  106. package/dist/reporters/html.js +4 -2
  107. package/dist/reporters/json.js +8 -1
  108. package/dist/reporters/markdown.js +8 -1
  109. package/package.json +9 -2
@@ -0,0 +1,151 @@
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.dpdpMcpTools = exports.dpdpHandoffTool = exports.dpdpVerifyTool = exports.dpdpGetEvidenceTool = exports.dpdpExplainControlTool = exports.dpdpGetReviewQueueTool = exports.dpdpGetControlMatrixTool = exports.dpdpGetDataMapTool = exports.dpdpScanChangedTool = exports.dpdpScanTool = void 0;
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const scan_1 = require("../../dpdp/scan");
10
+ const artifacts_1 = require("../../dpdp/artifacts");
11
+ const report_1 = require("../../dpdp/report");
12
+ const shared_1 = require("../../cli/commands/shared");
13
+ const reviewQueue_1 = require("../../dpdp/reviewQueue");
14
+ exports.dpdpScanTool = {
15
+ name: "vibedoctor_dpdp_scan",
16
+ description: "Run deterministic DPDP technical readiness scan (not legal certification). Returns posture score, control summary, and artifact paths.",
17
+ inputSchema: {
18
+ type: "object",
19
+ properties: {
20
+ mode: { type: "string", enum: ["full", "changed", "default"] }
21
+ }
22
+ },
23
+ async call(root, args) {
24
+ const mode = args.mode === "changed" ? "changed" : args.mode === "default" ? "default" : "full";
25
+ const result = await (0, scan_1.runDpdpScan)(root, mode);
26
+ const { config } = await (0, shared_1.getConfig)(root);
27
+ return {
28
+ disclaimer: result.disclaimer,
29
+ mode: result.mode,
30
+ scores: result.scores,
31
+ statusCounts: result.scores.statusCounts,
32
+ fixNext: result.fixNext,
33
+ capabilities: result.capabilities,
34
+ exitCode: (0, scan_1.determineDpdpExitCode)(result, config),
35
+ artifactDir: artifacts_1.DPDP_ARTIFACT_DIR,
36
+ findingCount: result.findings.length
37
+ };
38
+ }
39
+ };
40
+ exports.dpdpScanChangedTool = {
41
+ name: "vibedoctor_dpdp_scan_changed",
42
+ description: "Run DPDP technical readiness with collection scoped to git changed files. Falls back to full scope if no delta. Control matrix remains full catalogue.",
43
+ inputSchema: { type: "object", properties: {} },
44
+ async call(root) {
45
+ return exports.dpdpScanTool.call(root, { mode: "changed" });
46
+ }
47
+ };
48
+ exports.dpdpGetDataMapTool = {
49
+ name: "vibedoctor_dpdp_get_data_map",
50
+ description: "Get the personal-data processing map. Uses cached artifacts unless refresh=true; scans if missing.",
51
+ inputSchema: { type: "object", properties: { refresh: { type: "boolean" } } },
52
+ async call(root, args) {
53
+ if (args.refresh !== true) {
54
+ const cached = await (0, artifacts_1.readDpdpArtifact)(root, "data-map.json");
55
+ if (cached) {
56
+ return cached;
57
+ }
58
+ }
59
+ const result = await (0, scan_1.runDpdpScan)(root, "full");
60
+ return result.dataMap;
61
+ }
62
+ };
63
+ exports.dpdpGetControlMatrixTool = {
64
+ name: "vibedoctor_dpdp_get_control_matrix",
65
+ description: "Get the DPDP control matrix. Uses cached artifacts unless refresh=true; scans if missing.",
66
+ inputSchema: { type: "object", properties: { refresh: { type: "boolean" } } },
67
+ async call(root, args) {
68
+ if (args.refresh !== true) {
69
+ const cached = await (0, artifacts_1.readDpdpArtifact)(root, "control-matrix.json");
70
+ if (cached) {
71
+ return cached;
72
+ }
73
+ }
74
+ const result = await (0, scan_1.runDpdpScan)(root, "full");
75
+ return result.controlMatrix;
76
+ }
77
+ };
78
+ exports.dpdpGetReviewQueueTool = {
79
+ name: "vibedoctor_dpdp_get_review_queue",
80
+ description: "Get DPDP human-review questions grouped by audience. Uses cache unless refresh=true.",
81
+ inputSchema: { type: "object", properties: { refresh: { type: "boolean" } } },
82
+ async call(root, args) {
83
+ const result = await (0, scan_1.loadOrScanDpdp)(root, "full", args.refresh === true);
84
+ return { markdown: (0, reviewQueue_1.renderReviewQueueMarkdown)(result.reviewQueue), items: result.reviewQueue };
85
+ }
86
+ };
87
+ exports.dpdpExplainControlTool = {
88
+ name: "vibedoctor_dpdp_explain_control",
89
+ description: "Explain a DPDP control or finding id using cached artifacts unless refresh=true.",
90
+ inputSchema: {
91
+ type: "object",
92
+ properties: {
93
+ id: { type: "string" },
94
+ refresh: { type: "boolean" }
95
+ },
96
+ required: ["id"]
97
+ },
98
+ async call(root, args) {
99
+ if (typeof args.id !== "string" || !args.id.trim()) {
100
+ throw new Error("id is required");
101
+ }
102
+ return (0, scan_1.explainDpdpTarget)(root, args.id.trim(), { refresh: args.refresh === true });
103
+ }
104
+ };
105
+ exports.dpdpGetEvidenceTool = {
106
+ name: "vibedoctor_dpdp_get_evidence",
107
+ description: "Get the DPDP evidence ledger (masked/classified; no raw PII). Uses cache unless refresh=true.",
108
+ inputSchema: { type: "object", properties: { refresh: { type: "boolean" } } },
109
+ async call(root, args) {
110
+ if (args.refresh !== true) {
111
+ const cached = await (0, artifacts_1.readDpdpArtifact)(root, "evidence-ledger.json");
112
+ if (cached) {
113
+ return cached;
114
+ }
115
+ }
116
+ const result = await (0, scan_1.runDpdpScan)(root, "full");
117
+ return result.evidenceLedger;
118
+ }
119
+ };
120
+ exports.dpdpVerifyTool = {
121
+ name: "vibedoctor_dpdp_verify",
122
+ description: "Re-run DPDP technical readiness scan for post-change verification (changed-file scope).",
123
+ inputSchema: { type: "object", properties: {} },
124
+ async call(root) {
125
+ return exports.dpdpScanTool.call(root, { mode: "changed" });
126
+ }
127
+ };
128
+ exports.dpdpHandoffTool = {
129
+ name: "vibedoctor_dpdp_generate_handoff",
130
+ description: "Generate agent handoff markdown from DPDP artifacts. Uses cache unless refresh=true.",
131
+ inputSchema: { type: "object", properties: { refresh: { type: "boolean" } } },
132
+ async call(root, args) {
133
+ const result = await (0, scan_1.loadOrScanDpdp)(root, "full", args.refresh === true);
134
+ const content = (0, report_1.renderAgentHandoff)(result);
135
+ const handoffPath = node_path_1.default.join(root, artifacts_1.DPDP_ARTIFACT_DIR, "agent-handoff.md");
136
+ await node_fs_1.promises.mkdir(node_path_1.default.dirname(handoffPath), { recursive: true });
137
+ await node_fs_1.promises.writeFile(handoffPath, content, "utf8");
138
+ return { path: node_path_1.default.join(artifacts_1.DPDP_ARTIFACT_DIR, "agent-handoff.md").replaceAll("\\", "/"), content };
139
+ }
140
+ };
141
+ exports.dpdpMcpTools = [
142
+ exports.dpdpScanTool,
143
+ exports.dpdpScanChangedTool,
144
+ exports.dpdpGetDataMapTool,
145
+ exports.dpdpGetControlMatrixTool,
146
+ exports.dpdpGetReviewQueueTool,
147
+ exports.dpdpExplainControlTool,
148
+ exports.dpdpGetEvidenceTool,
149
+ exports.dpdpVerifyTool,
150
+ exports.dpdpHandoffTool
151
+ ];
@@ -8,6 +8,7 @@ const getReport_1 = require("./getReport");
8
8
  const scanChanged_1 = require("./scanChanged");
9
9
  const scanFull_1 = require("./scanFull");
10
10
  const verify_1 = require("./verify");
11
+ const dpdp_1 = require("./dpdp");
11
12
  exports.mcpTools = [
12
13
  scanChanged_1.scanChangedTool,
13
14
  scanFull_1.scanFullTool,
@@ -15,5 +16,6 @@ exports.mcpTools = [
15
16
  getReport_1.getReportTool,
16
17
  getAgentPlan_1.getAgentPlanTool,
17
18
  explainFinding_1.explainFindingTool,
18
- verify_1.verifyTool
19
+ verify_1.verifyTool,
20
+ ...dpdp_1.dpdpMcpTools
19
21
  ];
@@ -50,7 +50,14 @@ async function prepareScan(root, mode, categories, target = "generic") {
50
50
  const filtered = categories && categories.length > 0 ? (0, engine_1.filterScanByCategories)(scan, categories, { policy, target }) : scan;
51
51
  const withPlan = {
52
52
  ...filtered,
53
- agentPlan: (0, engine_1.createAgentPlan)({ findings: filtered.findings, score: filtered.score, skippedTools: filtered.skippedTools }, { policy, target })
53
+ agentPlan: (0, engine_1.createAgentPlan)({
54
+ findings: filtered.findings,
55
+ score: filtered.score,
56
+ skippedTools: filtered.skippedTools,
57
+ toolStatuses: filtered.toolStatuses,
58
+ completeness: filtered.completeness,
59
+ recoveryActions: filtered.recoveryActions
60
+ }, { policy, target })
54
61
  };
55
62
  await (0, shared_1.ensureOutputArtifacts)(root, config, withPlan);
56
63
  return {
@@ -9,6 +9,14 @@ function renderAgentMarkdown(input) {
9
9
  const plan = getPlan(input);
10
10
  const lines = ["# VibeDoctor Agent Plan", "", `Goal: ${plan.goal}.`, "", `Target: ${plan.target}`, "", "## Workflow", ""];
11
11
  plan.workflow.forEach((step, index) => lines.push(`${index + 1}. ${step}`));
12
+ if (plan.recoveryActions.length > 0) {
13
+ lines.push("", "## Recover before editing", "");
14
+ plan.recoveryActions.forEach((action) => {
15
+ lines.push(`- ${action.tool}: \`${action.command}\``);
16
+ lines.push(` Success: ${action.successCondition}.`);
17
+ lines.push(` If it fails: ${action.onFailure}`);
18
+ });
19
+ }
12
20
  lines.push("", "## Allowed actions", "");
13
21
  plan.allowedActions.forEach((action) => lines.push(`- ${action}`));
14
22
  lines.push("", "## Forbidden actions", "");
@@ -49,7 +49,8 @@ function renderHtmlReport(scan) {
49
49
  <h1>VibeDoctor Health Report</h1>
50
50
  <div class="meta">Root: <code>${escapeHtml(scan.root)}</code> &middot; Mode: ${scan.mode} &middot; Generated for agents &amp; humans</div>
51
51
 
52
- <div class="score">Health: ${scan.score.overall}/100 ${scan.score.overall >= 85 ? "✅" : "⚠️"}</div>
52
+ <div class="score">Health: ${scan.score.overall}/100 — ${scan.completeness.status.toUpperCase()} ${scan.score.overall >= 85 ? "✅" : "⚠️"}</div>
53
+ <div class="meta">Scan coverage: ${scan.completeness.completed}/${scan.completeness.planned} checks completed.${scan.completeness.comparable ? "" : " This score is not comparable to a complete scan."}</div>
53
54
 
54
55
  <div class="summary">
55
56
  <span class="pill">Blockers: ${scan.blockers.length}</span>
@@ -71,7 +72,8 @@ function renderHtmlReport(scan) {
71
72
 
72
73
  ${toolList(scan.toolStatuses.filter(t => t.status !== "ok"), "Tool Statuses (non-ok)")}
73
74
  ${toolList(scan.skippedTools, "Skipped Tools")}
74
- ${errored.length ? toolList(errored, "Errored / Timed Out Tools") : ""}
75
+ ${errored.length ? toolList(errored, "Errored / Timed Out Tools") : ""}
76
+ ${scan.recoveryActions.length ? `<h3>Recover before editing</h3><ul>${scan.recoveryActions.map(action => `<li><code>${escapeHtml(action.command)}</code> — ${escapeHtml(action.successCondition)}</li>`).join("")}</ul>` : ""}
75
77
 
76
78
  <p class="meta" style="margin-top:32px">Run <code>vibedoctor agent-plan</code> for guided repair. Full JSON/HTML/Markdown/SARIF available via --report.</p>
77
79
  </body>
@@ -2,15 +2,22 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderJsonReport = renderJsonReport;
4
4
  function renderJsonReport(scan) {
5
+ const dpdpFindings = scan.privacyFindings.filter((finding) => finding.source === "dpdp");
5
6
  return JSON.stringify({
6
7
  score: scan.score.overall,
8
+ completeness: scan.completeness,
9
+ recoveryActions: scan.recoveryActions,
7
10
  categoryScores: scan.score.categories,
8
11
  findings: scan.findings,
9
12
  topFindings: scan.topFindings,
10
13
  privacyFindings: scan.privacyFindings,
14
+ dpdpFindings,
11
15
  privacyReview: scan.privacyReview,
12
16
  toolStatuses: scan.toolStatuses,
13
17
  skippedTools: scan.skippedTools,
14
- agentPlan: scan.agentPlan
18
+ agentPlan: scan.agentPlan,
19
+ notes: {
20
+ dpdp: "DPDP findings are technical readiness signals integrated into privacy findings. See .vibedoctor/dpdp/ for the control matrix and data map. Not legal compliance."
21
+ }
15
22
  }, null, 2) + "\n";
16
23
  }
@@ -3,7 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderMarkdownReport = renderMarkdownReport;
4
4
  function renderMarkdownReport(scan) {
5
5
  const plan = scan.agentPlan;
6
- const lines = [`# VibeDoctor Report`, "", `Health: **${scan.score.overall}/100**`, ""];
6
+ const lines = [
7
+ `# VibeDoctor Report`,
8
+ "",
9
+ `Health: **${scan.score.overall}/100** — ${scan.completeness.status.toUpperCase()}`,
10
+ `Scan coverage: **${scan.completeness.completed}/${scan.completeness.planned} checks completed**`,
11
+ ...(scan.completeness.comparable ? [] : ["This score is not comparable to a complete scan."]),
12
+ ""
13
+ ];
7
14
  lines.push("## Summary");
8
15
  lines.push(`- Blockers: ${scan.blockers.length}`);
9
16
  lines.push(`- Fix next: ${scan.fixNext.length}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuralaxis/vibedoctor",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "Health diagnosis and fix planning for JS, TS, Python, and mixed repositories.",
5
5
  "type": "commonjs",
6
6
  "publishConfig": {
@@ -68,6 +68,13 @@
68
68
  "knip": "^6.16.1",
69
69
  "tsx": "^4.20.3",
70
70
  "typescript": "^5.8.3",
71
- "vitest": "^3.2.4"
71
+ "vite": "^7.3.5",
72
+ "vitest": "^3.2.6"
73
+ },
74
+ "overrides": {
75
+ "esbuild": "0.28.1"
76
+ },
77
+ "allowScripts": {
78
+ "esbuild@0.28.1": true
72
79
  }
73
80
  }