@neuralaxis/vibedoctor 0.1.0 → 0.1.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 +30 -20
- package/dist/cli/commands/setup.js +36 -9
- package/dist/cli/index.js +39 -7
- package/dist/core/toolRunner.js +25 -4
- package/package.json +3 -2
package/README.md
CHANGED
|
@@ -92,8 +92,9 @@ vibedoctor scan
|
|
|
92
92
|
The remaining examples use the `vibedoctor` binary; prefix them with `npx @neuralaxis/vibedoctor` if you skip the global install.
|
|
93
93
|
|
|
94
94
|
Want the strongest first scan? Run `vibedoctor setup --apply`. VibeDoctor will
|
|
95
|
-
install the
|
|
96
|
-
|
|
95
|
+
install the recommended project-local npm/Python tools (core essentials + high-value
|
|
96
|
+
extras like duplication, coverage, and complexity) it can install safely, and
|
|
97
|
+
print exact manual steps for native tools such as Gitleaks, OSV-Scanner, Semgrep, and Lizard.
|
|
97
98
|
|
|
98
99
|
For the strongest signal in monorepos, run VibeDoctor from the package or service root you are actively changing. Running from the monorepo root is supported, but package roots usually produce tighter dependency and test-tool signal.
|
|
99
100
|
|
|
@@ -141,27 +142,36 @@ VibeDoctor prefers tools already installed by the repository because that matche
|
|
|
141
142
|
your real CI versions and config. It never treats a missing tool as a clean pass:
|
|
142
143
|
missing tools are shown as skipped with install guidance.
|
|
143
144
|
|
|
144
|
-
For a smoother first run, `vibedoctor setup` gives you the
|
|
145
|
-
|
|
146
|
-
|
|
145
|
+
For a smoother first run, `vibedoctor setup` (or `setup --apply`) gives you the
|
|
146
|
+
curated recommended install plan out of the box. Many users don't know which
|
|
147
|
+
extra packages will give the best signal, so the default now includes the
|
|
148
|
+
essentials plus high-value "recommended" tools:
|
|
147
149
|
|
|
148
150
|
- built-in detectors: leftovers, dead-chain candidates, and refactor readiness
|
|
149
|
-
- JS/TS: TypeScript, Biome,
|
|
150
|
-
- Python: Ruff, Pyright,
|
|
151
|
+
- JS/TS: TypeScript, Biome, Knip
|
|
152
|
+
- Python: Ruff, Pyright, Vulture
|
|
151
153
|
- security/dependencies: Gitleaks and OSV-Scanner
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
- `vibedoctor setup --include
|
|
163
|
-
- `vibedoctor setup --include
|
|
164
|
-
- `vibedoctor setup --include
|
|
154
|
+
- **Recommended extras (included by default)**: jscpd (duplication), coverage.py,
|
|
155
|
+
radon (complexity), deptry (dependency hygiene), semgrep (rules), and lizard
|
|
156
|
+
(function-level complexity hotspots)
|
|
157
|
+
|
|
158
|
+
`vibedoctor setup --apply` installs the automatable package-manager tools (npm/pip/uv/poetry/etc).
|
|
159
|
+
Native binaries (Gitleaks, OSV-Scanner, Semgrep, Lizard, ...) are listed with
|
|
160
|
+
clear one-line install hints instead of being downloaded automatically.
|
|
161
|
+
|
|
162
|
+
If you want the absolute minimal core only, or to target just one ecosystem:
|
|
163
|
+
|
|
164
|
+
- `vibedoctor setup --include essential` — smallest core set only
|
|
165
|
+
- `vibedoctor setup --include all` — recommended set plus any extended tools
|
|
166
|
+
- `vibedoctor setup --include npm` — JS/TS package installs only
|
|
167
|
+
- `vibedoctor setup --include python` — Python package installs only
|
|
168
|
+
- `vibedoctor setup --include manual` — native/manual binaries only (hints)
|
|
169
|
+
- `vibedoctor setup --include built-in` — VibeDoctor's built-in detectors only
|
|
170
|
+
|
|
171
|
+
After setup (or any manual installs), re-run `vibedoctor scan --quick` or
|
|
172
|
+
`scan --full` to see the richer findings and a stronger health score. The setup
|
|
173
|
+
command itself always prints suggestions for additional tools you may not have
|
|
174
|
+
thought of.
|
|
165
175
|
|
|
166
176
|
## Reports
|
|
167
177
|
|
|
@@ -138,6 +138,14 @@ const recommendedTools = [
|
|
|
138
138
|
languages: ["python"],
|
|
139
139
|
reason: "Python dependency hygiene signal."
|
|
140
140
|
},
|
|
141
|
+
{
|
|
142
|
+
id: "lizard",
|
|
143
|
+
executable: "lizard",
|
|
144
|
+
ecosystem: "manual",
|
|
145
|
+
priority: "recommended",
|
|
146
|
+
reason: "Function-level complexity and code size hotspots (great for spotting refactor candidates).",
|
|
147
|
+
installHint: "Install Lizard with: pipx install lizard, uv tool install lizard, or your OS package manager."
|
|
148
|
+
},
|
|
141
149
|
{
|
|
142
150
|
id: "semgrep",
|
|
143
151
|
executable: "semgrep",
|
|
@@ -223,16 +231,15 @@ function resolveTools(include) {
|
|
|
223
231
|
if (include === "essential") {
|
|
224
232
|
return essentialTools;
|
|
225
233
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
return allTools;
|
|
234
|
+
const combined = [...essentialTools, ...recommendedTools];
|
|
235
|
+
if (include === "recommended" || include === "all") {
|
|
236
|
+
// "recommended" is the sensible default experience (essential + high-value extras).
|
|
237
|
+
// "all" currently resolves to the same set (add future extended tools here if needed).
|
|
238
|
+
return combined;
|
|
232
239
|
}
|
|
233
|
-
return
|
|
240
|
+
return combined.filter((tool) => tool.ecosystem === include);
|
|
234
241
|
}
|
|
235
|
-
async function createSetupPlan(root, include = "
|
|
242
|
+
async function createSetupPlan(root, include = "recommended") {
|
|
236
243
|
const project = await (0, projectDetector_1.detectProject)(root);
|
|
237
244
|
const tools = resolveTools(include);
|
|
238
245
|
const relevantTools = tools.filter((tool) => appliesToProject(tool, project));
|
|
@@ -307,10 +314,30 @@ function renderPlan(plan, include, results = []) {
|
|
|
307
314
|
else if (plan.commands.length === 0 && plan.manual.length === 0 && plan.skipped.length === 0) {
|
|
308
315
|
lines.push(`All relevant ${include} tools are already available.`);
|
|
309
316
|
}
|
|
317
|
+
// Always surface guidance + suggestions for users who may not know what else exists
|
|
318
|
+
if (include !== "all") {
|
|
319
|
+
lines.push("");
|
|
320
|
+
lines.push("Want richer analysis or not sure what else to add?");
|
|
321
|
+
if (include === "essential") {
|
|
322
|
+
lines.push(" The default `vibedoctor setup` (recommended) already adds jscpd, coverage, radon, deptry, lizard, and semgrep on top of the core essentials.");
|
|
323
|
+
lines.push(" Try `vibedoctor setup --include all` (or just `setup --apply` with no flag) for the full curated set.");
|
|
324
|
+
}
|
|
325
|
+
else {
|
|
326
|
+
lines.push(" `vibedoctor setup` / `--include recommended` (the default) already includes the best balance for most projects.");
|
|
327
|
+
lines.push(" `vibedoctor setup --include all` currently matches recommended (more extended tools may be added here in the future).");
|
|
328
|
+
}
|
|
329
|
+
lines.push("");
|
|
330
|
+
lines.push("Still want more? Common high-value additions and next steps:");
|
|
331
|
+
lines.push(" - Configure coverage reporting in your test framework (Jest/Vitest/Coverage.py) — VibeDoctor reads the reports automatically");
|
|
332
|
+
lines.push(" - Manually install lizard or semgrep (shown above with one-line hints) for deeper complexity + rule-based checks");
|
|
333
|
+
lines.push(" - Add jscpd (npm) if you want duplication heatmaps for large refactors");
|
|
334
|
+
lines.push("");
|
|
335
|
+
lines.push("Tip: Re-run `vibedoctor scan --quick` (or `scan --full`) after changes to see updated health + findings.");
|
|
336
|
+
}
|
|
310
337
|
return `${lines.join("\n")}\n`;
|
|
311
338
|
}
|
|
312
339
|
async function runSetupCommand(root, options = {}) {
|
|
313
|
-
const include = VALID_SETUP_INCLUDES.has(options.include ?? "
|
|
340
|
+
const include = VALID_SETUP_INCLUDES.has(options.include ?? "recommended") ? (options.include ?? "recommended") : "recommended";
|
|
314
341
|
const plan = await createSetupPlan(root, include);
|
|
315
342
|
if (!options.apply) {
|
|
316
343
|
return { output: renderPlan(plan, include), exitCode: 0 };
|
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
3
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
7
|
const commander_1 = require("commander");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
5
10
|
const agent_1 = require("./commands/agent");
|
|
6
11
|
const agentPlan_1 = require("./commands/agentPlan");
|
|
7
12
|
const baseline_1 = require("./commands/baseline");
|
|
@@ -12,14 +17,30 @@ const server_1 = require("../mcp/server");
|
|
|
12
17
|
const report_1 = require("./commands/report");
|
|
13
18
|
const scan_1 = require("./commands/scan");
|
|
14
19
|
const setup_1 = require("./commands/setup");
|
|
20
|
+
function getVersion() {
|
|
21
|
+
try {
|
|
22
|
+
// After `npm version patch` + publish, package.json is shipped (see "files").
|
|
23
|
+
// When executed from dist/cli/index.js (in the installed package), it lives at ../../package.json.
|
|
24
|
+
const pkgPath = node_path_1.default.resolve(__dirname, "..", "..", "package.json");
|
|
25
|
+
const pkg = JSON.parse(node_fs_1.default.readFileSync(pkgPath, "utf8"));
|
|
26
|
+
if (pkg && typeof pkg.version === "string") {
|
|
27
|
+
return pkg.version;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// fall through to hardcoded fallback
|
|
32
|
+
}
|
|
33
|
+
return "0.1.0";
|
|
34
|
+
}
|
|
15
35
|
async function main() {
|
|
16
36
|
const program = new commander_1.Command();
|
|
17
|
-
program.name("vibedoctor").description("Brutally simple repo health diagnosis.").version(
|
|
37
|
+
program.name("vibedoctor").description("Brutally simple repo health diagnosis.").version(getVersion());
|
|
18
38
|
program
|
|
19
39
|
.command("init")
|
|
20
40
|
.description("Create vibedoctor.yml and .vibedoctor baseline scaffolding")
|
|
21
41
|
.action(async () => {
|
|
22
42
|
process.stdout.write(`Created ${await (0, init_1.runInit)(process.cwd())}\n`);
|
|
43
|
+
process.exit(0);
|
|
23
44
|
});
|
|
24
45
|
program
|
|
25
46
|
.command("scan")
|
|
@@ -32,17 +53,20 @@ async function main() {
|
|
|
32
53
|
.action(async (options) => {
|
|
33
54
|
const result = await (0, scan_1.runScanCommand)(process.cwd(), options);
|
|
34
55
|
process.stdout.write(result.output);
|
|
35
|
-
|
|
56
|
+
// Force exit: some child processes / native tool wrappers (especially on Windows)
|
|
57
|
+
// can leave event-loop handles open even after 'close'. Explicit exit guarantees
|
|
58
|
+
// the CLI terminates promptly for terminals and CI after printing the report.
|
|
59
|
+
process.exit(result.exitCode);
|
|
36
60
|
});
|
|
37
61
|
program
|
|
38
62
|
.command("setup")
|
|
39
63
|
.description("Print or install scanner tools for the selected setup set")
|
|
40
64
|
.option("--apply", "Install automatable tools")
|
|
41
|
-
.option("--include <level>", "essential|recommended|all|npm|python|manual|built-in", "
|
|
65
|
+
.option("--include <level>", "essential|recommended|all|npm|python|manual|built-in (default: recommended)", "recommended")
|
|
42
66
|
.action(async (options) => {
|
|
43
67
|
const result = await (0, setup_1.runSetupCommand)(process.cwd(), options);
|
|
44
68
|
process.stdout.write(result.output);
|
|
45
|
-
process.
|
|
69
|
+
process.exit(result.exitCode);
|
|
46
70
|
});
|
|
47
71
|
program
|
|
48
72
|
.command("fix")
|
|
@@ -50,6 +74,7 @@ async function main() {
|
|
|
50
74
|
.option("--safe", "Only allow safe fixes", true)
|
|
51
75
|
.action(async () => {
|
|
52
76
|
process.stdout.write(await (0, fix_1.runSafeFixCommand)(process.cwd()));
|
|
77
|
+
process.exit(0);
|
|
53
78
|
});
|
|
54
79
|
program
|
|
55
80
|
.command("report")
|
|
@@ -63,6 +88,7 @@ async function main() {
|
|
|
63
88
|
.action(async (options) => {
|
|
64
89
|
const format = options.full ? "full" : options.html ? "html" : options.markdown ? "markdown" : options.agent ? "agent" : options.sarif ? "sarif" : "json";
|
|
65
90
|
process.stdout.write(await (0, report_1.runReportCommand)(process.cwd(), format));
|
|
91
|
+
process.exit(0);
|
|
66
92
|
});
|
|
67
93
|
const agent = program.command("agent").description("Manage the VibeDoctor agent pack");
|
|
68
94
|
agent
|
|
@@ -73,6 +99,7 @@ async function main() {
|
|
|
73
99
|
.option("--force", "Overwrite generated files")
|
|
74
100
|
.action(async (options) => {
|
|
75
101
|
process.stdout.write(await (0, agent_1.runAgentInitCommand)(process.cwd(), options));
|
|
102
|
+
process.exit(0);
|
|
76
103
|
});
|
|
77
104
|
agent
|
|
78
105
|
.command("pack")
|
|
@@ -82,6 +109,7 @@ async function main() {
|
|
|
82
109
|
.option("--force", "Overwrite generated files")
|
|
83
110
|
.action(async (options) => {
|
|
84
111
|
process.stdout.write(await (0, agent_1.runAgentPackCommand)(process.cwd(), options));
|
|
112
|
+
process.exit(0);
|
|
85
113
|
});
|
|
86
114
|
agent
|
|
87
115
|
.command("sync")
|
|
@@ -91,6 +119,7 @@ async function main() {
|
|
|
91
119
|
.option("--force", "Overwrite generated files")
|
|
92
120
|
.action(async (options) => {
|
|
93
121
|
process.stdout.write(await (0, agent_1.runAgentSyncCommand)(process.cwd(), options));
|
|
122
|
+
process.exit(0);
|
|
94
123
|
});
|
|
95
124
|
agent
|
|
96
125
|
.command("doctor")
|
|
@@ -100,7 +129,7 @@ async function main() {
|
|
|
100
129
|
.action(async (options) => {
|
|
101
130
|
const result = await (0, agent_1.runAgentDoctorCommand)(process.cwd(), options);
|
|
102
131
|
process.stdout.write(result.output);
|
|
103
|
-
process.
|
|
132
|
+
process.exit(result.exitCode);
|
|
104
133
|
});
|
|
105
134
|
const baseline = program.command("baseline").description("Manage baselines");
|
|
106
135
|
baseline
|
|
@@ -108,6 +137,7 @@ async function main() {
|
|
|
108
137
|
.description("Create a baseline file from the current findings")
|
|
109
138
|
.action(async () => {
|
|
110
139
|
process.stdout.write(await (0, baseline_1.runBaselineCreateCommand)(process.cwd()));
|
|
140
|
+
process.exit(0);
|
|
111
141
|
});
|
|
112
142
|
program
|
|
113
143
|
.command("agent-plan")
|
|
@@ -116,6 +146,7 @@ async function main() {
|
|
|
116
146
|
.option("--for <target>", "codex|copilot|claude|cursor")
|
|
117
147
|
.action(async (options) => {
|
|
118
148
|
process.stdout.write(await (0, agentPlan_1.runAgentPlanCommand)(process.cwd(), options.format, options.for));
|
|
149
|
+
process.exit(0);
|
|
119
150
|
});
|
|
120
151
|
program
|
|
121
152
|
.command("explain")
|
|
@@ -124,6 +155,7 @@ async function main() {
|
|
|
124
155
|
.option("--format <format>", "text|json", "text")
|
|
125
156
|
.action(async (findingId, options) => {
|
|
126
157
|
process.stdout.write(await (0, explain_1.runExplainCommand)(process.cwd(), findingId, options.format));
|
|
158
|
+
process.exit(0);
|
|
127
159
|
});
|
|
128
160
|
program
|
|
129
161
|
.command("verify")
|
|
@@ -131,7 +163,7 @@ async function main() {
|
|
|
131
163
|
.action(async () => {
|
|
132
164
|
const result = await (0, scan_1.runScanCommand)(process.cwd(), { changed: true });
|
|
133
165
|
process.stdout.write(result.output);
|
|
134
|
-
process.
|
|
166
|
+
process.exit(result.exitCode);
|
|
135
167
|
});
|
|
136
168
|
program
|
|
137
169
|
.command("mcp")
|
|
@@ -144,5 +176,5 @@ async function main() {
|
|
|
144
176
|
main().catch((error) => {
|
|
145
177
|
const message = error instanceof Error ? error.stack ?? error.message : String(error);
|
|
146
178
|
process.stderr.write(`${message}\n`);
|
|
147
|
-
process.
|
|
179
|
+
process.exit(1);
|
|
148
180
|
});
|
package/dist/core/toolRunner.js
CHANGED
|
@@ -67,11 +67,29 @@ async function runCommand(spec, installHint) {
|
|
|
67
67
|
child.stderr.on("data", (chunk) => {
|
|
68
68
|
stderr += chunk.toString();
|
|
69
69
|
});
|
|
70
|
+
function cleanup() {
|
|
71
|
+
try {
|
|
72
|
+
if (timeoutHandle) {
|
|
73
|
+
clearTimeout(timeoutHandle);
|
|
74
|
+
timeoutHandle = undefined;
|
|
75
|
+
}
|
|
76
|
+
child.stdout?.removeAllListeners("data");
|
|
77
|
+
child.stderr?.removeAllListeners("data");
|
|
78
|
+
child.removeAllListeners();
|
|
79
|
+
// Release stdio handles so they don't keep the event loop referenced on some platforms
|
|
80
|
+
child.stdout?.destroy();
|
|
81
|
+
child.stderr?.destroy();
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// best effort
|
|
85
|
+
}
|
|
86
|
+
}
|
|
70
87
|
child.on("error", (error) => {
|
|
71
88
|
if (settled) {
|
|
72
89
|
return;
|
|
73
90
|
}
|
|
74
91
|
settled = true;
|
|
92
|
+
cleanup();
|
|
75
93
|
resolve({
|
|
76
94
|
command: [spec.cmd, ...spec.args].join(" "),
|
|
77
95
|
stdout,
|
|
@@ -87,9 +105,7 @@ async function runCommand(spec, installHint) {
|
|
|
87
105
|
return;
|
|
88
106
|
}
|
|
89
107
|
settled = true;
|
|
90
|
-
|
|
91
|
-
clearTimeout(timeoutHandle);
|
|
92
|
-
}
|
|
108
|
+
cleanup();
|
|
93
109
|
resolve({
|
|
94
110
|
command: [spec.cmd, ...spec.args].join(" "),
|
|
95
111
|
stdout,
|
|
@@ -110,7 +126,12 @@ async function runCommand(spec, installHint) {
|
|
|
110
126
|
return;
|
|
111
127
|
}
|
|
112
128
|
settled = true;
|
|
113
|
-
|
|
129
|
+
const killSignal = process.platform === "win32" ? undefined : "SIGTERM";
|
|
130
|
+
try {
|
|
131
|
+
child.kill(killSignal);
|
|
132
|
+
}
|
|
133
|
+
catch { }
|
|
134
|
+
cleanup();
|
|
114
135
|
resolve({
|
|
115
136
|
command: [spec.cmd, ...spec.args].join(" "),
|
|
116
137
|
stdout,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuralaxis/vibedoctor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Health diagnosis and fix planning for JS, TS, Python, and mixed repositories.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"publishConfig": {
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
"files": [
|
|
21
21
|
"dist",
|
|
22
22
|
"README.md",
|
|
23
|
-
"LICENSE"
|
|
23
|
+
"LICENSE",
|
|
24
|
+
"package.json"
|
|
24
25
|
],
|
|
25
26
|
"engines": {
|
|
26
27
|
"node": ">=18"
|