@neuralaxis/vibedoctor 0.2.0 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +86 -0
  2. package/dist/adapters/biome.js +135 -21
  3. package/dist/adapters/osvScanner.js +136 -17
  4. package/dist/adapters/presidio.js +3 -1
  5. package/dist/cli/commands/init.js +105 -50
  6. package/dist/cli/commands/privacyReview.js +3 -4
  7. package/dist/cli/commands/setup.d.ts +13 -17
  8. package/dist/cli/commands/setup.js +138 -200
  9. package/dist/core/capability.d.ts +92 -0
  10. package/dist/core/capability.js +122 -0
  11. package/dist/core/config.d.ts +36 -0
  12. package/dist/core/config.js +105 -3
  13. package/dist/core/credentialHeuristics.d.ts +28 -0
  14. package/dist/core/credentialHeuristics.js +179 -0
  15. package/dist/core/engine.d.ts +21 -0
  16. package/dist/core/engine.js +466 -85
  17. package/dist/core/executable.d.ts +18 -0
  18. package/dist/core/executable.js +137 -0
  19. package/dist/core/fileRole.d.ts +24 -0
  20. package/dist/core/fileRole.js +125 -0
  21. package/dist/core/finding.d.ts +124 -0
  22. package/dist/core/finding.js +62 -5
  23. package/dist/core/findingNormalizer.d.ts +33 -0
  24. package/dist/core/findingNormalizer.js +171 -0
  25. package/dist/core/projectDetector.d.ts +13 -0
  26. package/dist/core/projectDetector.js +100 -15
  27. package/dist/core/relevance.d.ts +87 -0
  28. package/dist/core/relevance.js +367 -0
  29. package/dist/core/scanPlanner.d.ts +12 -0
  30. package/dist/core/scanPlanner.js +61 -37
  31. package/dist/core/semverLite.d.ts +27 -0
  32. package/dist/core/semverLite.js +163 -0
  33. package/dist/core/suppressions.d.ts +96 -0
  34. package/dist/core/suppressions.js +302 -0
  35. package/dist/core/toolRegistry.d.ts +58 -0
  36. package/dist/core/toolRegistry.js +247 -0
  37. package/dist/core/toolRunner.d.ts +23 -2
  38. package/dist/core/toolRunner.js +61 -93
  39. package/dist/core/toolVerification.d.ts +87 -0
  40. package/dist/core/toolVerification.js +370 -0
  41. package/dist/dpdp/collectors/optionalScanners.js +120 -30
  42. package/dist/dpdp/findings.d.ts +33 -3
  43. package/dist/dpdp/findings.js +191 -4
  44. package/dist/dpdp/scan.js +2 -2
  45. package/dist/dpdp/scoring.d.ts +14 -4
  46. package/dist/dpdp/scoring.js +34 -8
  47. package/dist/dpdp/types.d.ts +19 -1
  48. package/dist/reporters/html.js +57 -13
  49. package/dist/reporters/json.js +7 -1
  50. package/dist/reporters/markdown.js +46 -4
  51. package/dist/reporters/sarif.js +54 -5
  52. package/package.json +1 -1
@@ -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.file ? ` — \`${finding.file}\`` : ""}: ${finding.message}`));
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.file ? ` — \`${finding.file}\`` : ""}`));
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.file ? ` — \`${finding.file}${finding.startLine ? `:${finding.startLine}` : ""}\`` : ""}: ${finding.evidence?.maskedValue ?? finding.evidence?.entityType ?? finding.message}`));
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.file ? ` — \`${finding.file}\`` : ""}: ${finding.message}`));
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`;
@@ -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.2.0",
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": {