@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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { McpToolDefinition } from "./shared";
|
|
2
|
+
export declare const dpdpScanTool: McpToolDefinition;
|
|
3
|
+
export declare const dpdpScanChangedTool: McpToolDefinition;
|
|
4
|
+
export declare const dpdpGetDataMapTool: McpToolDefinition;
|
|
5
|
+
export declare const dpdpGetControlMatrixTool: McpToolDefinition;
|
|
6
|
+
export declare const dpdpGetReviewQueueTool: McpToolDefinition;
|
|
7
|
+
export declare const dpdpExplainControlTool: McpToolDefinition;
|
|
8
|
+
export declare const dpdpGetEvidenceTool: McpToolDefinition;
|
|
9
|
+
export declare const dpdpVerifyTool: McpToolDefinition;
|
|
10
|
+
export declare const dpdpHandoffTool: McpToolDefinition;
|
|
11
|
+
export declare const dpdpMcpTools: McpToolDefinition[];
|
|
@@ -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
|
+
];
|
package/dist/mcp/tools/index.js
CHANGED
|
@@ -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
|
];
|
package/dist/reporters/html.js
CHANGED
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderHtmlReport = renderHtmlReport;
|
|
4
|
+
const capability_1 = require("../core/capability");
|
|
5
|
+
const relevance_1 = require("../core/relevance");
|
|
6
|
+
const suppressions_1 = require("../core/suppressions");
|
|
7
|
+
function formatDuration(durationMs) {
|
|
8
|
+
if (durationMs === undefined) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
return durationMs >= 1000 ? `${(durationMs / 1000).toFixed(1)}s` : `${durationMs}ms`;
|
|
12
|
+
}
|
|
13
|
+
function formatLocation(finding) {
|
|
14
|
+
if (!finding.file) {
|
|
15
|
+
return "";
|
|
16
|
+
}
|
|
17
|
+
const line = finding.startLine ? `:${finding.startLine}` : "";
|
|
18
|
+
const column = finding.startLine && finding.startColumn ? `:${finding.startColumn}` : "";
|
|
19
|
+
return `${finding.file}${line}${column}`;
|
|
20
|
+
}
|
|
4
21
|
function renderHtmlReport(scan) {
|
|
5
22
|
const severityColor = (sev) => {
|
|
6
23
|
if (sev === "critical")
|
|
@@ -15,7 +32,7 @@ function renderHtmlReport(scan) {
|
|
|
15
32
|
if (!items.length)
|
|
16
33
|
return "";
|
|
17
34
|
const lis = items
|
|
18
|
-
.map((f) => `<li style="margin-bottom:8px"><strong style="color:${severityColor(f.severity)}">${escapeHtml(f.title)}</strong> <span style="color:#6b7280">(${f.severity}, ${f.confidence})</span>${f.file ? ` <code>${escapeHtml(f
|
|
35
|
+
.map((f) => `<li style="margin-bottom:8px"><strong style="color:${severityColor(f.severity)}">${escapeHtml(f.title)}</strong> <span style="color:#6b7280">(${f.severity}, ${f.confidence})</span>${f.file ? ` <code>${escapeHtml(formatLocation(f))}</code>` : ""}<br><span>${escapeHtml(f.message)}</span></li>`)
|
|
19
36
|
.join("");
|
|
20
37
|
return `<h3>${title} (${items.length})</h3><ul style="padding-left:20px">${lis}</ul>`;
|
|
21
38
|
};
|
|
@@ -28,6 +45,27 @@ function renderHtmlReport(scan) {
|
|
|
28
45
|
return `<h3>${label}</h3><ul>${lis}</ul>`;
|
|
29
46
|
};
|
|
30
47
|
const errored = scan.toolStatuses.filter((t) => t.status === "error" || t.status === "timeout");
|
|
48
|
+
const capabilitySection = () => {
|
|
49
|
+
if (!scan.capabilityMatrix.tools.length)
|
|
50
|
+
return "";
|
|
51
|
+
const rows = scan.capabilityMatrix.tools
|
|
52
|
+
.map((tool) => `<tr><td><strong>${escapeHtml(tool.id)}</strong></td><td>${escapeHtml((0, capability_1.capabilityStateLabel)(tool.state))}</td><td>${tool.findingsSurfaced}/${tool.findingsReported}</td><td>${escapeHtml(formatDuration(tool.durationMs))}</td><td>${escapeHtml(tool.reason)}</td></tr>`)
|
|
53
|
+
.join("");
|
|
54
|
+
const remediations = scan.capabilityMatrix.tools.filter((tool) => tool.remediation && (0, capability_1.isCoverageGap)(tool));
|
|
55
|
+
const restore = remediations.length
|
|
56
|
+
? `<h4>To restore coverage</h4><ul>${remediations
|
|
57
|
+
.map((tool) => `<li><strong>${escapeHtml(tool.id)}</strong> — ${escapeHtml(tool.remediation)}</li>`)
|
|
58
|
+
.join("")}</ul>`
|
|
59
|
+
: "";
|
|
60
|
+
return `<div class="section"><h3>Tool coverage</h3><table><thead><tr><th>Tool</th><th>State</th><th>Findings shown/reported</th><th>Time</th><th>Detail</th></tr></thead><tbody>${rows}</tbody></table>${restore}</div>`;
|
|
61
|
+
};
|
|
62
|
+
const lineSection = (title, sectionLines) => {
|
|
63
|
+
if (!sectionLines.length)
|
|
64
|
+
return "";
|
|
65
|
+
return `<div class="section"><h3>${escapeHtml(title)}</h3><ul>${sectionLines
|
|
66
|
+
.map((line) => `<li>${escapeHtml(line.replace(/^- /, ""))}</li>`)
|
|
67
|
+
.join("")}</ul></div>`;
|
|
68
|
+
};
|
|
31
69
|
return `<!doctype html>
|
|
32
70
|
<html>
|
|
33
71
|
<head>
|
|
@@ -43,37 +81,43 @@ function renderHtmlReport(scan) {
|
|
|
43
81
|
ul { margin: 8px 0; }
|
|
44
82
|
.section { margin-top: 24px; }
|
|
45
83
|
.meta { color: #6b7280; font-size: 0.85em; }
|
|
84
|
+
table { border-collapse: collapse; width: 100%; font-size: 0.9em; }
|
|
85
|
+
th, td { border-bottom: 1px solid #e5e7eb; padding: 6px 8px; text-align: left; vertical-align: top; }
|
|
86
|
+
th { color: #374151; font-weight: 600; }
|
|
46
87
|
</style>
|
|
47
88
|
</head>
|
|
48
89
|
<body>
|
|
49
90
|
<h1>VibeDoctor Health Report</h1>
|
|
50
91
|
<div class="meta">Root: <code>${escapeHtml(scan.root)}</code> · Mode: ${scan.mode} · Generated for agents & humans</div>
|
|
51
92
|
|
|
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>
|
|
93
|
+
<div class="score">Health: ${scan.score.overall}/100 — ${scan.completeness.status.toUpperCase()} ${scan.score.overall >= 85 ? "✅" : "⚠️"}</div>
|
|
94
|
+
<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>
|
|
54
95
|
|
|
55
96
|
<div class="summary">
|
|
56
|
-
<span class="pill">Blockers: ${scan.blockers.length}</span>
|
|
57
|
-
<span class="pill">Fix next: ${scan.fixNext.length}</span>
|
|
58
|
-
<span class="pill">Privacy Review: ${scan.privacyFindings.length}</span>
|
|
59
|
-
<span class="pill">Leftovers: ${scan.leftovers.length}</span>
|
|
97
|
+
<span class="pill">Blockers: ${scan.blockers.length}</span>
|
|
98
|
+
<span class="pill">Fix next: ${scan.fixNext.length}</span>
|
|
99
|
+
<span class="pill">Privacy Review: ${scan.privacyFindings.length}</span>
|
|
100
|
+
<span class="pill">Leftovers: ${scan.leftovers.length}</span>
|
|
60
101
|
<span class="pill">Dead chains: ${scan.deadCodeCandidates.length}</span>
|
|
61
102
|
<span class="pill">Refactor: ${scan.refactorCandidates.length}</span>
|
|
62
103
|
</div>
|
|
63
104
|
|
|
64
105
|
<div class="section">
|
|
65
|
-
${renderFindingList(scan.blockers, "BLOCKERS")}
|
|
66
|
-
${renderFindingList(scan.fixNext, "FIX NEXT")}
|
|
67
|
-
${renderFindingList(scan.privacyFindings.slice(0, 10), "PRIVACY REVIEW FINDINGS")}
|
|
68
|
-
${renderFindingList(scan.leftovers, "LEFTOVERS")}
|
|
106
|
+
${renderFindingList(scan.blockers, "BLOCKERS")}
|
|
107
|
+
${renderFindingList(scan.fixNext, "FIX NEXT")}
|
|
108
|
+
${renderFindingList(scan.privacyFindings.slice(0, 10), "PRIVACY REVIEW FINDINGS")}
|
|
109
|
+
${renderFindingList(scan.leftovers, "LEFTOVERS")}
|
|
69
110
|
${renderFindingList(scan.deadCodeCandidates, "DEAD CHAINS")}
|
|
70
111
|
${renderFindingList(scan.refactorCandidates, "REFACTOR CANDIDATES")}
|
|
71
112
|
</div>
|
|
72
113
|
|
|
73
114
|
${toolList(scan.toolStatuses.filter(t => t.status !== "ok"), "Tool Statuses (non-ok)")}
|
|
74
115
|
${toolList(scan.skippedTools, "Skipped Tools")}
|
|
75
|
-
${errored.length ? toolList(errored, "Errored / Timed Out Tools") : ""}
|
|
76
|
-
${
|
|
116
|
+
${errored.length ? toolList(errored, "Errored / Timed Out Tools") : ""}
|
|
117
|
+
${capabilitySection()}
|
|
118
|
+
${lineSection("Report filtering", (0, relevance_1.renderRelevanceLines)(scan.relevance))}
|
|
119
|
+
${lineSection("Acknowledged", (0, suppressions_1.renderSuppressionLines)(scan.suppressions))}
|
|
120
|
+
${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>` : ""}
|
|
77
121
|
|
|
78
122
|
<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>
|
|
79
123
|
</body>
|
package/dist/reporters/json.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
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,
|
|
7
8
|
completeness: scan.completeness,
|
|
@@ -10,9 +11,19 @@ function renderJsonReport(scan) {
|
|
|
10
11
|
findings: scan.findings,
|
|
11
12
|
topFindings: scan.topFindings,
|
|
12
13
|
privacyFindings: scan.privacyFindings,
|
|
14
|
+
dpdpFindings,
|
|
13
15
|
privacyReview: scan.privacyReview,
|
|
14
16
|
toolStatuses: scan.toolStatuses,
|
|
15
17
|
skippedTools: scan.skippedTools,
|
|
16
|
-
|
|
18
|
+
capabilityMatrix: scan.capabilityMatrix,
|
|
19
|
+
relevance: scan.relevance,
|
|
20
|
+
suppressions: scan.suppressions,
|
|
21
|
+
suppressedFindings: scan.suppressedFindings,
|
|
22
|
+
verifications: scan.verifications,
|
|
23
|
+
agentPlan: scan.agentPlan,
|
|
24
|
+
notes: {
|
|
25
|
+
dpdp: "DPDP findings are technical readiness signals integrated into privacy findings. See .vibedoctor/dpdp/ for the control matrix and data map. Not legal compliance.",
|
|
26
|
+
coverage: "capabilityMatrix is authoritative for what actually ran: toolStatuses and skippedTools are views of it. relevance explains any difference between findings a tool reported and findings shown here, so a short report is never a clean one."
|
|
27
|
+
}
|
|
17
28
|
}, null, 2) + "\n";
|
|
18
29
|
}
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderMarkdownReport = renderMarkdownReport;
|
|
4
|
+
const capability_1 = require("../core/capability");
|
|
5
|
+
const relevance_1 = require("../core/relevance");
|
|
6
|
+
const suppressions_1 = require("../core/suppressions");
|
|
7
|
+
function formatDuration(durationMs) {
|
|
8
|
+
if (durationMs === undefined) {
|
|
9
|
+
return "";
|
|
10
|
+
}
|
|
11
|
+
return durationMs >= 1000 ? `${(durationMs / 1000).toFixed(1)}s` : `${durationMs}ms`;
|
|
12
|
+
}
|
|
13
|
+
/** Cell content has to be escaped or a `|` in a tool's reason breaks the table. */
|
|
14
|
+
function escapeTableCell(value) {
|
|
15
|
+
return value.replaceAll("|", "\\|").replaceAll("\n", " ");
|
|
16
|
+
}
|
|
17
|
+
function formatLocation(finding) {
|
|
18
|
+
if (!finding.file) {
|
|
19
|
+
return "";
|
|
20
|
+
}
|
|
21
|
+
const line = finding.startLine ? `:${finding.startLine}` : "";
|
|
22
|
+
const column = finding.startLine && finding.startColumn ? `:${finding.startColumn}` : "";
|
|
23
|
+
return ` — \`${finding.file}${line}${column}\``;
|
|
24
|
+
}
|
|
4
25
|
function renderMarkdownReport(scan) {
|
|
5
26
|
const plan = scan.agentPlan;
|
|
6
27
|
const lines = [
|
|
@@ -23,24 +44,45 @@ function renderMarkdownReport(scan) {
|
|
|
23
44
|
lines.push("- None");
|
|
24
45
|
}
|
|
25
46
|
else {
|
|
26
|
-
scan.blockers.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
47
|
+
scan.blockers.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.message}`));
|
|
27
48
|
}
|
|
28
49
|
lines.push("", "## Fix next");
|
|
29
|
-
scan.fixNext.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
50
|
+
scan.fixNext.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}`));
|
|
30
51
|
if (scan.privacyFindings.length > 0) {
|
|
31
52
|
lines.push("", "## Privacy Review findings");
|
|
32
53
|
scan.privacyFindings
|
|
33
54
|
.slice(0, 10)
|
|
34
|
-
.forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
55
|
+
.forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.evidence?.maskedValue ?? finding.evidence?.entityType ?? finding.message}`));
|
|
35
56
|
}
|
|
36
57
|
if (scan.deadCodeCandidates.length > 0) {
|
|
37
58
|
lines.push("", "## Dead chains and dead code");
|
|
38
|
-
scan.deadCodeCandidates.slice(0, 5).forEach((finding) => lines.push(`- ${finding.title}${finding
|
|
59
|
+
scan.deadCodeCandidates.slice(0, 5).forEach((finding) => lines.push(`- ${finding.title}${formatLocation(finding)}: ${finding.message}`));
|
|
39
60
|
}
|
|
40
61
|
if (scan.skippedTools.length > 0) {
|
|
41
62
|
lines.push("", "## Skipped tools");
|
|
42
63
|
scan.skippedTools.forEach((tool) => lines.push(`- ${tool.id}${tool.installHint ? ` — ${tool.installHint}` : ""}`));
|
|
43
64
|
}
|
|
65
|
+
if (scan.capabilityMatrix.tools.length > 0) {
|
|
66
|
+
lines.push("", "## Tool coverage");
|
|
67
|
+
lines.push("| Tool | State | Findings shown/reported | Time | Detail |");
|
|
68
|
+
lines.push("| --- | --- | --- | --- | --- |");
|
|
69
|
+
scan.capabilityMatrix.tools.forEach((tool) => lines.push(`| ${escapeTableCell(tool.id)} | ${(0, capability_1.capabilityStateLabel)(tool.state)} | ${tool.findingsSurfaced}/${tool.findingsReported} | ${formatDuration(tool.durationMs)} | ${escapeTableCell(tool.reason)} |`));
|
|
70
|
+
const remediations = scan.capabilityMatrix.tools.filter((tool) => tool.remediation && (0, capability_1.isCoverageGap)(tool));
|
|
71
|
+
if (remediations.length > 0) {
|
|
72
|
+
lines.push("", "### To restore coverage");
|
|
73
|
+
remediations.forEach((tool) => lines.push(`- ${tool.id}: ${tool.remediation}`));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
const relevanceLines = (0, relevance_1.renderRelevanceLines)(scan.relevance);
|
|
77
|
+
if (relevanceLines.length > 0) {
|
|
78
|
+
lines.push("", "## Report filtering");
|
|
79
|
+
relevanceLines.forEach((line) => lines.push(line));
|
|
80
|
+
}
|
|
81
|
+
const suppressionLines = (0, suppressions_1.renderSuppressionLines)(scan.suppressions);
|
|
82
|
+
if (suppressionLines.length > 0) {
|
|
83
|
+
lines.push("", "## Acknowledged");
|
|
84
|
+
suppressionLines.forEach((line) => lines.push(line));
|
|
85
|
+
}
|
|
44
86
|
lines.push("", "## Agent tasks");
|
|
45
87
|
plan.tasks.forEach((task) => lines.push(`- ${task.title}`));
|
|
46
88
|
return `${lines.join("\n")}\n`;
|
package/dist/reporters/sarif.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.renderSarif = renderSarif;
|
|
4
|
+
const capability_1 = require("../core/capability");
|
|
5
|
+
// SARIF forbids a region that carries columns without a line, so positions are
|
|
6
|
+
// emitted together or not at all.
|
|
7
|
+
function buildRegion(finding) {
|
|
8
|
+
if (finding.startLine === undefined) {
|
|
9
|
+
return undefined;
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
startLine: finding.startLine,
|
|
13
|
+
endLine: finding.endLine,
|
|
14
|
+
startColumn: finding.startColumn,
|
|
15
|
+
endColumn: finding.endColumn
|
|
16
|
+
};
|
|
17
|
+
}
|
|
4
18
|
function renderSarif(scan) {
|
|
19
|
+
const gaps = scan.capabilityMatrix.tools.filter(capability_1.isCoverageGap);
|
|
5
20
|
return JSON.stringify({
|
|
6
21
|
version: "2.1.0",
|
|
22
|
+
$schema: "https://json.schemastore.org/sarif-2.1.0.json",
|
|
7
23
|
runs: [
|
|
8
24
|
{
|
|
9
25
|
tool: {
|
|
@@ -11,6 +27,22 @@ function renderSarif(scan) {
|
|
|
11
27
|
name: "VibeDoctor"
|
|
12
28
|
}
|
|
13
29
|
},
|
|
30
|
+
invocations: [
|
|
31
|
+
{
|
|
32
|
+
executionSuccessful: scan.completeness.status !== "invalid",
|
|
33
|
+
// Every tool that did not fully cover the repository is reported
|
|
34
|
+
// here, so a consumer never reads an incomplete scan as a clean one.
|
|
35
|
+
toolExecutionNotifications: gaps.map((tool) => ({
|
|
36
|
+
level: tool.trust === "absent" ? "error" : "warning",
|
|
37
|
+
message: {
|
|
38
|
+
text: `${tool.id} (${(0, capability_1.capabilityStateLabel)(tool.state)}): ${tool.reason}${tool.remediation ? ` ${tool.remediation}` : ""}`
|
|
39
|
+
},
|
|
40
|
+
descriptor: {
|
|
41
|
+
id: `vibedoctor.coverage.${tool.id}`
|
|
42
|
+
}
|
|
43
|
+
}))
|
|
44
|
+
}
|
|
45
|
+
],
|
|
14
46
|
results: scan.findings.map((finding) => ({
|
|
15
47
|
ruleId: finding.id,
|
|
16
48
|
level: finding.severity === "critical" || finding.severity === "high" ? "error" : "warning",
|
|
@@ -21,8 +53,22 @@ function renderSarif(scan) {
|
|
|
21
53
|
category: finding.category,
|
|
22
54
|
confidence: finding.confidence,
|
|
23
55
|
entityType: finding.evidence?.entityType,
|
|
24
|
-
sensitivity: finding.evidence?.sensitivity
|
|
56
|
+
sensitivity: finding.evidence?.sensitivity,
|
|
57
|
+
evidenceGrade: finding.evidenceGrade,
|
|
58
|
+
fileRole: finding.fileRole,
|
|
59
|
+
baselineState: finding.baselineState,
|
|
60
|
+
priority: finding.priority,
|
|
61
|
+
package: finding.package
|
|
25
62
|
},
|
|
63
|
+
suppressions: finding.suppression
|
|
64
|
+
? [
|
|
65
|
+
{
|
|
66
|
+
kind: "external",
|
|
67
|
+
status: finding.suppression.expired ? "rejected" : "accepted",
|
|
68
|
+
justification: `${finding.suppression.ruleId} (${finding.suppression.classification}): ${finding.suppression.reason}`
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
: undefined,
|
|
26
72
|
locations: finding.file
|
|
27
73
|
? [
|
|
28
74
|
{
|
|
@@ -30,14 +76,17 @@ function renderSarif(scan) {
|
|
|
30
76
|
artifactLocation: {
|
|
31
77
|
uri: finding.file
|
|
32
78
|
},
|
|
33
|
-
region:
|
|
34
|
-
startLine: finding.startLine
|
|
35
|
-
}
|
|
79
|
+
region: buildRegion(finding)
|
|
36
80
|
}
|
|
37
81
|
}
|
|
38
82
|
]
|
|
39
83
|
: undefined
|
|
40
|
-
}))
|
|
84
|
+
})),
|
|
85
|
+
properties: {
|
|
86
|
+
capabilityMatrix: scan.capabilityMatrix,
|
|
87
|
+
relevance: scan.relevance,
|
|
88
|
+
suppressions: scan.suppressions
|
|
89
|
+
}
|
|
41
90
|
}
|
|
42
91
|
]
|
|
43
92
|
}, null, 2);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuralaxis/vibedoctor",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Health diagnosis and fix planning for JS, TS, Python, and mixed repositories.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"publishConfig": {
|
|
@@ -73,5 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"overrides": {
|
|
75
75
|
"esbuild": "0.28.1"
|
|
76
|
+
},
|
|
77
|
+
"allowScripts": {
|
|
78
|
+
"esbuild@0.28.1": true
|
|
76
79
|
}
|
|
77
80
|
}
|