@neuralaxis/vibedoctor 0.2.1 → 0.2.2

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 (47) hide show
  1. package/README.md +49 -23
  2. package/dist/adapters/biome.js +3 -2
  3. package/dist/adapters/flowDoctor.d.ts +7 -0
  4. package/dist/adapters/flowDoctor.js +195 -0
  5. package/dist/adapters/gitleaks.js +4 -2
  6. package/dist/adapters/index.d.ts +1 -0
  7. package/dist/adapters/index.js +3 -1
  8. package/dist/adapters/osvScanner.js +4 -2
  9. package/dist/adapters/ruff.js +7 -3
  10. package/dist/adapters/shared.d.ts +4 -0
  11. package/dist/cli/commands/init.js +7 -0
  12. package/dist/cli/commands/scan.d.ts +6 -0
  13. package/dist/cli/commands/scan.js +16 -2
  14. package/dist/cli/index.js +4 -4
  15. package/dist/core/agentDiagnosis.d.ts +39 -0
  16. package/dist/core/agentDiagnosis.js +96 -0
  17. package/dist/core/config.d.ts +11 -0
  18. package/dist/core/config.js +31 -2
  19. package/dist/core/engine.d.ts +8 -1
  20. package/dist/core/engine.js +54 -51
  21. package/dist/core/finding.d.ts +1 -1
  22. package/dist/core/finding.js +8 -3
  23. package/dist/core/findingCorrelator.d.ts +19 -0
  24. package/dist/core/findingCorrelator.js +112 -0
  25. package/dist/core/findingNormalizer.js +1 -0
  26. package/dist/core/managedTools.d.ts +25 -0
  27. package/dist/core/managedTools.js +186 -0
  28. package/dist/core/repoGraph.d.ts +62 -0
  29. package/dist/core/repoGraph.js +408 -0
  30. package/dist/core/riskRanker.d.ts +6 -0
  31. package/dist/core/riskRanker.js +127 -0
  32. package/dist/core/scanContext.d.ts +26 -0
  33. package/dist/core/scanContext.js +44 -0
  34. package/dist/core/scanPlanner.d.ts +1 -0
  35. package/dist/core/scanPlanner.js +10 -6
  36. package/dist/core/toolRegistry.js +12 -5
  37. package/dist/core/toolRunner.d.ts +4 -0
  38. package/dist/core/toolRunner.js +18 -0
  39. package/dist/core/toolRuntime.d.ts +40 -0
  40. package/dist/core/toolRuntime.js +417 -0
  41. package/dist/core/toolVerification.d.ts +3 -1
  42. package/dist/core/toolVerification.js +58 -3
  43. package/dist/index.d.ts +5 -0
  44. package/dist/index.js +5 -0
  45. package/dist/reporters/agent.d.ts +1 -1
  46. package/dist/reporters/agent.js +7 -0
  47. package/package.json +80 -80
package/README.md CHANGED
@@ -1,42 +1,45 @@
1
1
  # VibeDoctor
2
2
 
3
+ <p align="center">
4
+ <img src="website/public/logo-lockup.png" alt="VibeDoctor, a NeuralAxis product" width="360" />
5
+ </p>
6
+
3
7
  **A local health check for code you did not write line by line.**
8
+ **Give VibeDoctor a repository. It figures out what applies, runs the diagnosis, and tells you or your coding agent what to fix first.**
4
9
 
5
- VibeDoctor scans JavaScript, TypeScript, Python, and mixed repositories for code-health, security, privacy, testing, and maintainability problems. It combines repository-local scanner output into one ranked report, one normalized finding format, and a fix-next plan that humans and coding agents can use without interpreting a wall of unrelated logs.
10
+ VibeDoctor scans JavaScript, TypeScript, Python, and mixed repositories for code-health, security, privacy, testing, and maintainability problems. It combines engine output into one ranked report, one normalized finding format, and a fix-next plan that humans and coding agents can use without interpreting a wall of unrelated logs.
6
11
 
7
12
  ```bash
8
- npx @neuralaxis/vibedoctor scan --changed
13
+ npx @neuralaxis/vibedoctor scan
9
14
  ```
10
15
 
11
- VibeDoctor runs locally by default. Missing or failed scanners are reported as incomplete evidence, never silently counted as a clean result.
16
+ That is the default path: full applicable diagnosis, local by default. Missing or failed scanners are reported as incomplete evidence, never silently counted as a clean result.
17
+
18
+ The public product site lives in [`website/`](website/README.md) and deploys from GitHub Pages.
12
19
 
13
20
  ## Start here
14
21
 
15
- Choose the shortest path for what you are doing:
22
+ ```bash
23
+ npx @neuralaxis/vibedoctor scan
24
+ ```
16
25
 
17
- | Goal | Command |
18
- | --- | --- |
19
- | Check files changed in Git | `npx @neuralaxis/vibedoctor scan --changed` |
20
- | Run a fast repository check | `npx @neuralaxis/vibedoctor scan --quick` |
21
- | Run the most complete check | `npx @neuralaxis/vibedoctor scan --full` |
22
- | Prepare local scanner tools | `npx @neuralaxis/vibedoctor setup` |
23
- | Get a repair plan for an AI agent | `npx @neuralaxis/vibedoctor agent-plan --format markdown` |
24
- | Check India DPDP technical readiness | `npx @neuralaxis/vibedoctor dpdp scan --full` |
26
+ That is enough for a first diagnosis. VibeDoctor detects the repository, runs the capabilities that apply, correlates overlapping evidence, and ranks what to fix first.
25
27
 
26
- For a new repository, initialize the config and review the scanner setup plan:
28
+ For an AI coding agent:
27
29
 
28
30
  ```bash
29
- npx @neuralaxis/vibedoctor init
30
- npx @neuralaxis/vibedoctor setup
31
- npx @neuralaxis/vibedoctor setup --apply
32
- npx @neuralaxis/vibedoctor scan --quick
31
+ npx @neuralaxis/vibedoctor scan --report agent-json
33
32
  ```
34
33
 
35
- `setup --apply` installs supported recommended tools, so review the plan before applying it. To use the shorter `vibedoctor` command everywhere:
34
+ Optional narrower runs:
36
35
 
37
- ```bash
38
- npm install -g @neuralaxis/vibedoctor
39
- ```
36
+ | Goal | Command |
37
+ | --- | --- |
38
+ | Fast profile | `npx @neuralaxis/vibedoctor scan --quick` |
39
+ | Git-changed files | `npx @neuralaxis/vibedoctor scan --changed` |
40
+ | Explicit full alias | `npx @neuralaxis/vibedoctor scan --full` |
41
+ | Agent repair plan file | `npx @neuralaxis/vibedoctor agent-plan --format markdown` |
42
+ | India DPDP technical readiness | `npx @neuralaxis/vibedoctor dpdp scan --full` |
40
43
 
41
44
  ## What you get
42
45
 
@@ -51,7 +54,29 @@ Default artifacts are written under `.vibedoctor/`:
51
54
  └── agent-plan.md # ordered repair work
52
55
  ```
53
56
 
54
- Use the terminal report for quick triage, HTML for review, JSON for automation, and `agent-plan.md` for a coding agent.
57
+ Use the terminal report for quick triage, HTML for review, JSON for automation, `agent-json` for a coding agent, and `agent-plan.md` for a file-based handoff.
58
+
59
+ ## Advanced setup and troubleshooting
60
+
61
+ You do not need to install Ruff, Gitleaks, or OSV-Scanner just to run VibeDoctor. The default scan uses built-in detectors plus managed copies of those three engines when they apply. Other engines are used when they are already on PATH or installed in the project; missing ones are reported as incomplete evidence.
62
+
63
+ To install extra project-local scanners, or to debug a tool that did not run:
64
+
65
+ ```bash
66
+ npx @neuralaxis/vibedoctor init
67
+ npx @neuralaxis/vibedoctor setup
68
+ npx @neuralaxis/vibedoctor setup --apply
69
+ ```
70
+
71
+ `setup --apply` can mutate the scanned project (it installs recommended tools there), so review the plan first. Managed Ruff, Gitleaks, and OSV-Scanner are cached under `~/.cache/vibedoctor/` and do not edit `package.json`, lockfiles, or Python manifests.
72
+
73
+ To use the shorter `vibedoctor` command everywhere:
74
+
75
+ ```bash
76
+ npm install -g @neuralaxis/vibedoctor
77
+ ```
78
+
79
+ Override the tool cache with `VIBEDOCTOR_TOOL_CACHE`. Disable downloads with `VIBEDOCTOR_ALLOW_NETWORK=0`.
55
80
 
56
81
  ## What VibeDoctor checks
57
82
 
@@ -349,7 +374,8 @@ Human-review-only DPDP items do not fail CI. Configure `checks.dpdp.fail_on_seve
349
374
  | --- | --- |
350
375
  | Initialize configuration | `vibedoctor init` |
351
376
  | Plan or apply scanner setup | `vibedoctor setup` / `vibedoctor setup --apply` |
352
- | Quick, changed, or full scan | `vibedoctor scan --quick` / `--changed` / `--full` |
377
+ | Full applicable diagnosis | `vibedoctor scan` |
378
+ | Quick, changed, or explicit full | `vibedoctor scan --quick` / `--changed` / `--full` |
353
379
  | Scan selected categories | `vibedoctor scan --category dead_code,leftovers` |
354
380
  | Render a fresh full report | `vibedoctor report --json`, `--html`, `--markdown`, `--sarif`, or `--agent` |
355
381
  | Apply supported safe fixes | `vibedoctor fix --safe` |
@@ -58,8 +58,9 @@ function readMessage(item) {
58
58
  return item.description;
59
59
  }
60
60
  function readFile(item) {
61
- const path = item.location?.path;
62
- return typeof path === "string" ? path : path?.file;
61
+ const locationPath = item.location?.path;
62
+ const file = typeof locationPath === "string" ? locationPath : locationPath?.file;
63
+ return file?.replaceAll("\\", "/");
63
64
  }
64
65
  function mapSeverity(level) {
65
66
  if (level === "fatal") {
@@ -0,0 +1,7 @@
1
+ import type { Finding } from "../core/finding";
2
+ import { type RepoGraph } from "../core/repoGraph";
3
+ import type { ToolAdapter } from "./shared";
4
+ export declare function analyzeFlows(graph: RepoGraph, options?: {
5
+ reportHeuristics?: boolean;
6
+ }): Finding[];
7
+ export declare const flowDoctorAdapter: ToolAdapter;
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.flowDoctorAdapter = void 0;
4
+ exports.analyzeFlows = analyzeFlows;
5
+ const repoGraph_1 = require("../core/repoGraph");
6
+ function findingBase(partial) {
7
+ return {
8
+ isNew: true,
9
+ isAutofixable: false,
10
+ safeToAutofix: false,
11
+ scoreImpact: 0,
12
+ tags: partial.tags ?? ["flow"],
13
+ ...partial
14
+ };
15
+ }
16
+ function describeRoute(route) {
17
+ return `${route.method} ${route.path} (${route.file}:${route.line})`;
18
+ }
19
+ function mismatchFinding(call, routes, verified) {
20
+ const available = routes.slice(0, 6).map(describeRoute).join("; ");
21
+ return findingBase({
22
+ id: `flow-doctor:${call.file}:${call.line}:route-mismatch`,
23
+ source: "flow-doctor",
24
+ category: "correctness",
25
+ severity: verified ? "high" : "medium",
26
+ confidence: verified ? "high" : "medium",
27
+ evidenceGrade: verified ? "verified" : "heuristic",
28
+ title: "HTTP call has no matching backend route",
29
+ message: `${call.method} ${call.path} has no matching server route.`,
30
+ file: call.file,
31
+ startLine: call.line,
32
+ agentInstruction: `Add a ${call.method} handler for ${call.path}, or change the client call to a route the server actually exposes.`,
33
+ evidence: { toolRawId: "flow-route-mismatch", detectionPath: available },
34
+ remediation: {
35
+ kind: "code",
36
+ steps: [
37
+ `Align the client ${call.method} ${call.path} call with an existing route, or add that route on the server.`
38
+ ],
39
+ requiredEvidence: "A server handler exists for the same method and path."
40
+ }
41
+ });
42
+ }
43
+ function heuristicCallFinding(call) {
44
+ return findingBase({
45
+ id: `flow-doctor:${call.file}:${call.line}:dynamic-route`,
46
+ source: "flow-doctor",
47
+ category: "correctness",
48
+ severity: "low",
49
+ confidence: "low",
50
+ evidenceGrade: "heuristic",
51
+ title: "Dynamic HTTP path could not be verified",
52
+ message: `Call uses a constructed path (${call.path}); Flow Doctor cannot prove a route match.`,
53
+ file: call.file,
54
+ startLine: call.line,
55
+ agentInstruction: "Leave this unless a concrete method/path mismatch is visible nearby.",
56
+ evidence: { toolRawId: "flow-dynamic-path" },
57
+ tags: ["flow", "heuristic"]
58
+ });
59
+ }
60
+ function errorPathFinding(file, line, kind, detail) {
61
+ const verified = kind === "empty_handler" || kind === "success_after_failure";
62
+ return findingBase({
63
+ id: `flow-doctor:${file}:${line}:${kind}`,
64
+ source: "flow-doctor",
65
+ category: "correctness",
66
+ severity: kind === "success_after_failure" ? "high" : "medium",
67
+ confidence: "high",
68
+ evidenceGrade: verified ? "verified" : "heuristic",
69
+ title: kind === "empty_handler" ? "Swallowed error path" : "Success response after a caught failure",
70
+ message: detail,
71
+ file,
72
+ startLine: line,
73
+ agentInstruction: kind === "empty_handler"
74
+ ? "Log, rethrow, or return an explicit error from this handler. Do not leave it empty."
75
+ : "Return a failure status from the catch/except path, or rethrow after recording the error.",
76
+ evidence: { toolRawId: `flow-${kind}` }
77
+ });
78
+ }
79
+ function missingHandlerFinding(route) {
80
+ return findingBase({
81
+ id: `flow-doctor:${route.file}:${route.line}:missing-handler`,
82
+ source: "flow-doctor",
83
+ category: "correctness",
84
+ severity: "high",
85
+ confidence: "high",
86
+ evidenceGrade: "verified",
87
+ title: "Route handler is not defined",
88
+ message: `${route.method} ${route.path} is wired to ${route.handler}, but that function is not defined or imported.`,
89
+ file: route.file,
90
+ startLine: route.line,
91
+ agentInstruction: `Define ${route.handler} or point this route at a function that exists.`,
92
+ evidence: { toolRawId: "flow-missing-handler" },
93
+ remediation: {
94
+ kind: "code",
95
+ steps: [`Add ${route.handler} in this file or import it, then keep the ${route.method} ${route.path} wiring.`],
96
+ requiredEvidence: `A function named ${route.handler} is defined or imported.`
97
+ }
98
+ });
99
+ }
100
+ function orphanedHandlerFinding(symbol) {
101
+ return findingBase({
102
+ id: `flow-doctor:${symbol.file}:${symbol.line}:orphaned-handler`,
103
+ source: "flow-doctor",
104
+ category: "correctness",
105
+ severity: "medium",
106
+ confidence: "high",
107
+ evidenceGrade: "verified",
108
+ title: "Unreachable handler in a route file",
109
+ message: `${symbol.name} is defined next to routes but is never called and is not wired to any route.`,
110
+ file: symbol.file,
111
+ startLine: symbol.line,
112
+ agentInstruction: `Wire ${symbol.name} to a route, call it, or delete it if it is leftover.`,
113
+ evidence: { toolRawId: "flow-orphaned-handler" }
114
+ });
115
+ }
116
+ function handlerIsBound(route) {
117
+ return Boolean(route.handlerFile || route.handlerExternal || route.handlerMember);
118
+ }
119
+ function isReferenced(symbol, graph) {
120
+ if (graph.routes.some((route) => route.handler === symbol.name && (route.handlerFile === symbol.file || route.file === symbol.file))) {
121
+ return true;
122
+ }
123
+ return graph.calls.some((call) => call.callee === symbol.name && call.file === symbol.file && call.line !== symbol.line);
124
+ }
125
+ function analyzeFlows(graph, options = {}) {
126
+ const findings = [];
127
+ const reportHeuristics = options.reportHeuristics ?? false;
128
+ const backendPresent = graph.routes.length > 0;
129
+ if (backendPresent) {
130
+ for (const call of graph.httpCalls) {
131
+ if (call.absolute) {
132
+ continue;
133
+ }
134
+ if (call.dynamic || !call.methodExplicit) {
135
+ if (reportHeuristics) {
136
+ findings.push(heuristicCallFinding(call));
137
+ }
138
+ continue;
139
+ }
140
+ const match = graph.routes.some((route) => (0, repoGraph_1.routeMatchesCall)(call, route));
141
+ if (match) {
142
+ continue;
143
+ }
144
+ const samePath = graph.routes.some((route) => (0, repoGraph_1.pathsCompatible)(call.path, route.path));
145
+ // Same path, wrong method is a real bug. Unrelated paths in a monorepo are not.
146
+ if (samePath) {
147
+ findings.push(mismatchFinding(call, graph.routes, true));
148
+ }
149
+ else if (reportHeuristics) {
150
+ findings.push(mismatchFinding(call, graph.routes, false));
151
+ }
152
+ }
153
+ }
154
+ for (const errorPath of graph.errorPaths) {
155
+ findings.push(errorPathFinding(errorPath.file, errorPath.line, errorPath.kind, errorPath.detail));
156
+ }
157
+ for (const route of graph.routes) {
158
+ if (!route.handler || route.handlerMember || handlerIsBound(route)) {
159
+ continue;
160
+ }
161
+ if (route.handler.length < 2) {
162
+ continue;
163
+ }
164
+ findings.push(missingHandlerFinding(route));
165
+ }
166
+ const routerFiles = new Set(graph.routes.map((route) => route.file));
167
+ for (const symbol of graph.symbols) {
168
+ if (symbol.kind !== "function" || symbol.exported || symbol.name.startsWith("_")) {
169
+ continue;
170
+ }
171
+ if (!routerFiles.has(symbol.file)) {
172
+ continue;
173
+ }
174
+ if (isReferenced(symbol, graph)) {
175
+ continue;
176
+ }
177
+ findings.push(orphanedHandlerFinding(symbol));
178
+ }
179
+ return findings;
180
+ }
181
+ exports.flowDoctorAdapter = {
182
+ id: "flow-doctor",
183
+ category: "correctness",
184
+ async detect(project, config) {
185
+ if (config.checks.flowAnalysis.enabled === false) {
186
+ return false;
187
+ }
188
+ return project.languages.length > 0;
189
+ },
190
+ async runStandalone(ctx) {
191
+ const graph = await (0, repoGraph_1.buildRepoGraph)(ctx.root, ctx.project.projectFiles);
192
+ return { findings: analyzeFlows(graph) };
193
+ },
194
+ installHint: "Built-in Flow Doctor. No external install."
195
+ };
@@ -14,10 +14,12 @@ exports.gitleaksAdapter = {
14
14
  },
15
15
  buildScanCommand(ctx) {
16
16
  return {
17
+ tool: "gitleaks",
17
18
  cmd: "gitleaks",
18
19
  args: ["detect", "--no-banner", "--redact", "--report-format", "json", "--report-path", "-"],
19
20
  cwd: ctx.root,
20
- timeoutMs: 60_000
21
+ timeoutMs: 60_000,
22
+ runtime: ctx.toolRuntime
21
23
  };
22
24
  },
23
25
  parseResult(result, ctx) {
@@ -43,5 +45,5 @@ exports.gitleaksAdapter = {
43
45
  scoreImpact: 0
44
46
  }));
45
47
  },
46
- installHint: "Install Gitleaks from https://gitleaks.io/ or your package manager."
48
+ installHint: "VibeDoctor provisions a pinned Gitleaks into ~/.cache/vibedoctor when needed. To use a project-local copy, put gitleaks on PATH."
47
49
  };
@@ -18,3 +18,4 @@ export { vultureAdapter } from "./vulture";
18
18
  export { privacyDetectorAdapter } from "./privacyDetector";
19
19
  export { dpdpAdapter } from "./dpdp";
20
20
  export { telemetryDetectorAdapter } from "./telemetryDetector";
21
+ export { flowDoctorAdapter } from "./flowDoctor";
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.telemetryDetectorAdapter = exports.dpdpAdapter = exports.privacyDetectorAdapter = exports.vultureAdapter = exports.vitestAdapter = exports.tscAdapter = exports.semgrepAdapter = exports.ruffAdapter = exports.radonAdapter = exports.pyrightAdapter = exports.presidioAdapter = exports.osvScannerAdapter = exports.lizardAdapter = exports.knipAdapter = exports.jscpdAdapter = exports.jestAdapter = exports.gitleaksAdapter = exports.deptryAdapter = exports.coveragePyAdapter = exports.biomeAdapter = void 0;
3
+ exports.flowDoctorAdapter = exports.telemetryDetectorAdapter = exports.dpdpAdapter = exports.privacyDetectorAdapter = exports.vultureAdapter = exports.vitestAdapter = exports.tscAdapter = exports.semgrepAdapter = exports.ruffAdapter = exports.radonAdapter = exports.pyrightAdapter = exports.presidioAdapter = exports.osvScannerAdapter = exports.lizardAdapter = exports.knipAdapter = exports.jscpdAdapter = exports.jestAdapter = exports.gitleaksAdapter = exports.deptryAdapter = exports.coveragePyAdapter = exports.biomeAdapter = void 0;
4
4
  var biome_1 = require("./biome");
5
5
  Object.defineProperty(exports, "biomeAdapter", { enumerable: true, get: function () { return biome_1.biomeAdapter; } });
6
6
  var coveragePy_1 = require("./coveragePy");
@@ -41,3 +41,5 @@ var dpdp_1 = require("./dpdp");
41
41
  Object.defineProperty(exports, "dpdpAdapter", { enumerable: true, get: function () { return dpdp_1.dpdpAdapter; } });
42
42
  var telemetryDetector_1 = require("./telemetryDetector");
43
43
  Object.defineProperty(exports, "telemetryDetectorAdapter", { enumerable: true, get: function () { return telemetryDetector_1.telemetryDetectorAdapter; } });
44
+ var flowDoctor_1 = require("./flowDoctor");
45
+ Object.defineProperty(exports, "flowDoctorAdapter", { enumerable: true, get: function () { return flowDoctor_1.flowDoctorAdapter; } });
@@ -104,6 +104,7 @@ exports.osvScannerAdapter = {
104
104
  },
105
105
  buildScanCommand(ctx) {
106
106
  return {
107
+ tool: "osv-scanner",
107
108
  cmd: "osv-scanner",
108
109
  args: [
109
110
  "scan",
@@ -115,7 +116,8 @@ exports.osvScannerAdapter = {
115
116
  "error"
116
117
  ],
117
118
  cwd: ctx.root,
118
- timeoutMs: 60_000
119
+ timeoutMs: 60_000,
120
+ runtime: ctx.toolRuntime
119
121
  };
120
122
  },
121
123
  parseResult(result, ctx) {
@@ -195,5 +197,5 @@ exports.osvScannerAdapter = {
195
197
  };
196
198
  });
197
199
  },
198
- installHint: "Install OSV-Scanner from https://google.github.io/osv-scanner/"
200
+ installHint: "VibeDoctor provisions a pinned OSV-Scanner into ~/.cache/vibedoctor when needed. To use a project-local copy, put osv-scanner on PATH."
199
201
  };
@@ -29,10 +29,12 @@ exports.ruffAdapter = {
29
29
  const targets = (0, shared_1.adapterTargets)(ctx, /\.py$/i);
30
30
  const excludePatterns = ctx.config.paths.exclude.length > 0 ? ["--exclude", ctx.config.paths.exclude.join(",")] : [];
31
31
  return {
32
+ tool: "ruff",
32
33
  cmd: "ruff",
33
34
  args: ["check", ...targets, "--output-format", "json", ...excludePatterns],
34
35
  cwd: ctx.root,
35
- timeoutMs: 60_000
36
+ timeoutMs: 60_000,
37
+ runtime: ctx.toolRuntime
36
38
  };
37
39
  },
38
40
  parseResult(result, ctx) {
@@ -64,11 +66,13 @@ exports.ruffAdapter = {
64
66
  },
65
67
  buildFixCommand(ctx) {
66
68
  return {
69
+ tool: "ruff",
67
70
  cmd: "ruff",
68
71
  args: ["check", ".", "--fix"],
69
72
  cwd: ctx.root,
70
- timeoutMs: 60_000
73
+ timeoutMs: 60_000,
74
+ runtime: ctx.toolRuntime
71
75
  };
72
76
  },
73
- installHint: "Install Ruff with: pipx install ruff, uv tool install ruff, or add it to your project."
77
+ installHint: "VibeDoctor provisions a pinned Ruff into ~/.cache/vibedoctor when needed. To use a project-local copy, install it in the environment."
74
78
  };
@@ -1,12 +1,16 @@
1
1
  import type { VibeDoctorConfig } from "../core/config";
2
2
  import type { Finding, FindingCategory } from "../core/finding";
3
3
  import type { ProjectContext } from "../core/projectDetector";
4
+ import type { ScanContext } from "../core/scanContext";
5
+ import type { ToolRuntime } from "../core/toolRuntime";
4
6
  import type { CommandSpec, ToolResult } from "../core/toolRunner";
5
7
  export type ToolAdapterContext = {
6
8
  root: string;
7
9
  project: ProjectContext;
8
10
  config: VibeDoctorConfig;
9
11
  scanMode: "default" | "changed" | "quick" | "full";
12
+ toolRuntime?: ToolRuntime;
13
+ scanContext?: ScanContext;
10
14
  /** Results already produced by the scan engine, available to dependent adapters for reuse. */
11
15
  sharedToolResults?: Record<string, SharedToolExecution>;
12
16
  };
@@ -72,6 +72,10 @@ runtime:
72
72
  # implying they passed — use this for tools this environment cannot support.
73
73
  deferred_tools: []
74
74
  verify_tools_before_scan: true
75
+ managed_tools:
76
+ enabled: true
77
+ allow_network: true
78
+ prefer_project_local: true
75
79
 
76
80
  # Controls how much of what the tools report actually reaches the report.
77
81
  # Nothing is dropped silently: every filter states what it withheld and why.
@@ -118,6 +122,9 @@ checks:
118
122
  fail_on_type_errors: true
119
123
  fail_on_test_failures: true
120
124
 
125
+ flow_analysis:
126
+ enabled: true
127
+
121
128
  dead_code:
122
129
  enabled: true
123
130
  delete_automatically: false
@@ -1,10 +1,16 @@
1
1
  import type { VibeDoctorConfig } from "../../core/config";
2
2
  import { type ScanOutput } from "../../core/engine";
3
+ import type { ScanMode } from "../../core/scanPlanner";
3
4
  export type ScanCommandResult = {
4
5
  output: string;
5
6
  exitCode: number;
6
7
  };
7
8
  export declare function determineExitCode(scan: Pick<ScanOutput, "score" | "findings"> & Partial<Pick<ScanOutput, "completeness">>, config: VibeDoctorConfig): number;
9
+ export declare function resolveScanMode(options: {
10
+ changed?: boolean;
11
+ quick?: boolean;
12
+ full?: boolean;
13
+ }): ScanMode;
8
14
  export declare function runScanCommand(root: string, options: {
9
15
  changed?: boolean;
10
16
  quick?: boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.determineExitCode = determineExitCode;
4
+ exports.resolveScanMode = resolveScanMode;
4
5
  exports.runScanCommand = runScanCommand;
5
6
  const engine_1 = require("../../core/engine");
6
7
  const finding_1 = require("../../core/finding");
@@ -43,7 +44,11 @@ function determineExitCode(scan, config) {
43
44
  failingFindings.some((finding) => finding.source === "deptry" && finding.title === "DEP002");
44
45
  const typeFailure = config.checks.correctness.enabled &&
45
46
  config.checks.correctness.failOnTypeErrors &&
46
- failingFindings.some((finding) => ["tsc", "pyright"].includes(finding.source) || (finding.category === "correctness" && isHighSeverity(finding)));
47
+ failingFindings.some((finding) => finding.source === "tsc" ||
48
+ finding.source === "pyright" ||
49
+ (finding.category === "correctness" &&
50
+ isHighSeverity(finding) &&
51
+ finding.source !== "flow-doctor"));
47
52
  const testFailure = config.checks.correctness.enabled &&
48
53
  config.checks.correctness.failOnTestFailures &&
49
54
  failingFindings.some((finding) => finding.category === "tests" && isHighSeverity(finding));
@@ -71,8 +76,17 @@ function determineExitCode(scan, config) {
71
76
  ? 1
72
77
  : 0;
73
78
  }
79
+ function resolveScanMode(options) {
80
+ if (options.changed) {
81
+ return "changed";
82
+ }
83
+ if (options.quick) {
84
+ return "quick";
85
+ }
86
+ return "full";
87
+ }
74
88
  async function runScanCommand(root, options) {
75
- const mode = options.changed ? "changed" : options.quick ? "quick" : options.full ? "full" : "default";
89
+ const mode = resolveScanMode(options);
76
90
  const scan = await (0, engine_1.runScan)(root, mode);
77
91
  const categories = (0, finding_1.parseFindingCategoryList)(options.category);
78
92
  const filteredScan = categories ? (0, engine_2.filterScanByCategories)(scan, categories) : scan;
package/dist/cli/index.js CHANGED
@@ -47,10 +47,10 @@ async function main() {
47
47
  });
48
48
  program
49
49
  .command("scan")
50
- .description("Run relevant checks and print a short health report")
51
- .option("--changed", "Only report changed-file issues")
52
- .option("--quick", "Quick mode")
53
- .option("--full", "Full mode")
50
+ .description("Run the full applicable diagnosis and print a ranked health report")
51
+ .option("--changed", "Optimize for git-changed files")
52
+ .option("--quick", "Narrower opt-in profile")
53
+ .option("--full", "Alias for the default full applicable diagnosis")
54
54
  .option("--category <categories>", "Comma-separated finding categories")
55
55
  .option("--report <format>", "terminal|json|html|agent|agent-json", "terminal")
56
56
  .action(async (options) => {
@@ -0,0 +1,39 @@
1
+ import type { AgentPlan, RecoveryAction, ScanCompleteness, ScanOutput, ToolStatusSummary } from "./engine";
2
+ import type { EvidenceGrade, Finding, FindingCategory, Severity, Confidence } from "./finding";
3
+ import { type FindingLocation, type RootCauseGroup } from "./findingCorrelator";
4
+ export type AgentIssue = {
5
+ id: string;
6
+ ruleId: string;
7
+ title: string;
8
+ severity: Severity;
9
+ confidence: Confidence;
10
+ evidenceGrade: EvidenceGrade;
11
+ category: FindingCategory;
12
+ locations: FindingLocation[];
13
+ impact: string;
14
+ likelyRootCause: string;
15
+ supportingEngines: string[];
16
+ recommendedRepair: string;
17
+ verificationGuidance: string;
18
+ };
19
+ export type AgentDiagnosisSummary = {
20
+ score: number;
21
+ mode: ScanOutput["mode"];
22
+ planned: number;
23
+ completed: number;
24
+ findingCount: number;
25
+ blockerCount: number;
26
+ topIssueCount: number;
27
+ };
28
+ export type AgentDiagnosis = {
29
+ completeness: ScanCompleteness;
30
+ summary: AgentDiagnosisSummary;
31
+ topIssues: AgentIssue[];
32
+ rootCauseGroups: RootCauseGroup[];
33
+ toolStatuses: ToolStatusSummary[];
34
+ recoveryActions: RecoveryAction[];
35
+ recommendedOrder: string[];
36
+ agentPlan: AgentPlan;
37
+ };
38
+ export declare function findingToAgentIssue(finding: Finding, testCommands?: string[]): AgentIssue;
39
+ export declare function buildAgentDiagnosis(scan: ScanOutput): AgentDiagnosis;