@neuralaxis/vibedoctor 0.1.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 (135) hide show
  1. package/LICENSE +232 -0
  2. package/README.md +280 -0
  3. package/dist/adapters/biome.d.ts +2 -0
  4. package/dist/adapters/biome.js +66 -0
  5. package/dist/adapters/coveragePy.d.ts +2 -0
  6. package/dist/adapters/coveragePy.js +56 -0
  7. package/dist/adapters/customDeadChain.d.ts +20 -0
  8. package/dist/adapters/customDeadChain.js +243 -0
  9. package/dist/adapters/customLeftovers.d.ts +2 -0
  10. package/dist/adapters/customLeftovers.js +244 -0
  11. package/dist/adapters/customRefactor.d.ts +2 -0
  12. package/dist/adapters/customRefactor.js +176 -0
  13. package/dist/adapters/deptry.d.ts +2 -0
  14. package/dist/adapters/deptry.js +59 -0
  15. package/dist/adapters/gitleaks.d.ts +2 -0
  16. package/dist/adapters/gitleaks.js +47 -0
  17. package/dist/adapters/index.d.ts +16 -0
  18. package/dist/adapters/index.js +35 -0
  19. package/dist/adapters/jest.d.ts +2 -0
  20. package/dist/adapters/jest.js +62 -0
  21. package/dist/adapters/jscpd.d.ts +2 -0
  22. package/dist/adapters/jscpd.js +59 -0
  23. package/dist/adapters/knip.d.ts +2 -0
  24. package/dist/adapters/knip.js +75 -0
  25. package/dist/adapters/lizard.d.ts +2 -0
  26. package/dist/adapters/lizard.js +45 -0
  27. package/dist/adapters/osvScanner.d.ts +2 -0
  28. package/dist/adapters/osvScanner.js +68 -0
  29. package/dist/adapters/pyright.d.ts +2 -0
  30. package/dist/adapters/pyright.js +52 -0
  31. package/dist/adapters/radon.d.ts +2 -0
  32. package/dist/adapters/radon.js +45 -0
  33. package/dist/adapters/ruff.d.ts +2 -0
  34. package/dist/adapters/ruff.js +71 -0
  35. package/dist/adapters/semgrep.d.ts +2 -0
  36. package/dist/adapters/semgrep.js +64 -0
  37. package/dist/adapters/shared.d.ts +23 -0
  38. package/dist/adapters/shared.js +2 -0
  39. package/dist/adapters/tsc.d.ts +2 -0
  40. package/dist/adapters/tsc.js +57 -0
  41. package/dist/adapters/vitest.d.ts +2 -0
  42. package/dist/adapters/vitest.js +62 -0
  43. package/dist/adapters/vulture.d.ts +2 -0
  44. package/dist/adapters/vulture.js +59 -0
  45. package/dist/agentPack/generateAgentPack.d.ts +48 -0
  46. package/dist/agentPack/generateAgentPack.js +219 -0
  47. package/dist/agentPack/policy.d.ts +19 -0
  48. package/dist/agentPack/policy.js +117 -0
  49. package/dist/agentPack/templates/index.d.ts +7 -0
  50. package/dist/agentPack/templates/index.js +134 -0
  51. package/dist/agentPack/templates/skills.d.ts +7 -0
  52. package/dist/agentPack/templates/skills.js +337 -0
  53. package/dist/cli/commands/agent.d.ts +22 -0
  54. package/dist/cli/commands/agent.js +57 -0
  55. package/dist/cli/commands/agentPlan.d.ts +1 -0
  56. package/dist/cli/commands/agentPlan.js +12 -0
  57. package/dist/cli/commands/baseline.d.ts +1 -0
  58. package/dist/cli/commands/baseline.js +8 -0
  59. package/dist/cli/commands/explain.d.ts +1 -0
  60. package/dist/cli/commands/explain.js +35 -0
  61. package/dist/cli/commands/fix.d.ts +1 -0
  62. package/dist/cli/commands/fix.js +19 -0
  63. package/dist/cli/commands/init.d.ts +1 -0
  64. package/dist/cli/commands/init.js +101 -0
  65. package/dist/cli/commands/report.d.ts +1 -0
  66. package/dist/cli/commands/report.js +25 -0
  67. package/dist/cli/commands/scan.d.ts +14 -0
  68. package/dist/cli/commands/scan.js +61 -0
  69. package/dist/cli/commands/setup.d.ts +35 -0
  70. package/dist/cli/commands/setup.js +326 -0
  71. package/dist/cli/commands/shared.d.ts +8 -0
  72. package/dist/cli/commands/shared.js +29 -0
  73. package/dist/cli/index.d.ts +2 -0
  74. package/dist/cli/index.js +148 -0
  75. package/dist/core/baseline.d.ts +7 -0
  76. package/dist/core/baseline.js +33 -0
  77. package/dist/core/config.d.ts +72 -0
  78. package/dist/core/config.js +236 -0
  79. package/dist/core/engine.d.ts +87 -0
  80. package/dist/core/engine.js +437 -0
  81. package/dist/core/finding.d.ts +40 -0
  82. package/dist/core/finding.js +141 -0
  83. package/dist/core/git.d.ts +3 -0
  84. package/dist/core/git.js +67 -0
  85. package/dist/core/paths.d.ts +7 -0
  86. package/dist/core/paths.js +104 -0
  87. package/dist/core/projectDetector.d.ts +17 -0
  88. package/dist/core/projectDetector.js +160 -0
  89. package/dist/core/scanPlanner.d.ts +11 -0
  90. package/dist/core/scanPlanner.js +47 -0
  91. package/dist/core/scoring.d.ts +8 -0
  92. package/dist/core/scoring.js +57 -0
  93. package/dist/core/toolRunner.d.ts +24 -0
  94. package/dist/core/toolRunner.js +130 -0
  95. package/dist/index.d.ts +7 -0
  96. package/dist/index.js +23 -0
  97. package/dist/mcp/server.d.ts +1 -0
  98. package/dist/mcp/server.js +141 -0
  99. package/dist/mcp/tools/explainFinding.d.ts +2 -0
  100. package/dist/mcp/tools/explainFinding.js +23 -0
  101. package/dist/mcp/tools/fixSafe.d.ts +2 -0
  102. package/dist/mcp/tools/fixSafe.js +15 -0
  103. package/dist/mcp/tools/getAgentPlan.d.ts +2 -0
  104. package/dist/mcp/tools/getAgentPlan.js +31 -0
  105. package/dist/mcp/tools/getReport.d.ts +2 -0
  106. package/dist/mcp/tools/getReport.js +26 -0
  107. package/dist/mcp/tools/index.d.ts +1 -0
  108. package/dist/mcp/tools/index.js +19 -0
  109. package/dist/mcp/tools/scanChanged.d.ts +2 -0
  110. package/dist/mcp/tools/scanChanged.js +23 -0
  111. package/dist/mcp/tools/scanFull.d.ts +2 -0
  112. package/dist/mcp/tools/scanFull.js +23 -0
  113. package/dist/mcp/tools/shared.d.ts +51 -0
  114. package/dist/mcp/tools/shared.js +126 -0
  115. package/dist/mcp/tools/verify.d.ts +2 -0
  116. package/dist/mcp/tools/verify.js +21 -0
  117. package/dist/reporters/agent.d.ts +3 -0
  118. package/dist/reporters/agent.js +48 -0
  119. package/dist/reporters/html.d.ts +2 -0
  120. package/dist/reporters/html.js +81 -0
  121. package/dist/reporters/json.d.ts +2 -0
  122. package/dist/reporters/json.js +18 -0
  123. package/dist/reporters/markdown.d.ts +2 -0
  124. package/dist/reporters/markdown.js +33 -0
  125. package/dist/reporters/sarif.d.ts +2 -0
  126. package/dist/reporters/sarif.js +38 -0
  127. package/dist/reporters/terminal.d.ts +2 -0
  128. package/dist/reporters/terminal.js +11 -0
  129. package/dist/rules/leftoverPatterns.d.ts +7 -0
  130. package/dist/rules/leftoverPatterns.js +10 -0
  131. package/dist/rules/refactorRules.d.ts +13 -0
  132. package/dist/rules/refactorRules.js +16 -0
  133. package/dist/rules/severityMap.d.ts +15 -0
  134. package/dist/rules/severityMap.js +33 -0
  135. package/package.json +72 -0
@@ -0,0 +1,337 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AGENT_SKILLS = void 0;
4
+ function quoteYamlString(value) {
5
+ return JSON.stringify(value);
6
+ }
7
+ function toDisplayName(name) {
8
+ return name
9
+ .split("-")
10
+ .map((part) => part.charAt(0).toUpperCase() + part.slice(1))
11
+ .join(" ");
12
+ }
13
+ function createOpenAiMetadata(name, description) {
14
+ return [
15
+ "interface:",
16
+ ` display_name: ${quoteYamlString(toDisplayName(name))}`,
17
+ ` short_description: ${quoteYamlString(description)}`,
18
+ ` default_prompt: ${quoteYamlString(`Use ${name} for this repository.`)}`,
19
+ " brand_color: \"#2563EB\"",
20
+ "policy:",
21
+ " allow_implicit_invocation: true",
22
+ ""
23
+ ].join("\n");
24
+ }
25
+ function createSkill(name, description, body) {
26
+ return {
27
+ name,
28
+ description,
29
+ openAiMetadata: createOpenAiMetadata(name, description),
30
+ content: [
31
+ "---",
32
+ `name: ${name}`,
33
+ `description: ${quoteYamlString(description)}`,
34
+ "---",
35
+ "",
36
+ body.trim(),
37
+ ""
38
+ ].join("\n")
39
+ };
40
+ }
41
+ exports.AGENT_SKILLS = [
42
+ createSkill("vibedoctor-health-scan", "Run and interpret VibeDoctor health scans for JavaScript, TypeScript, Python, and mixed repositories. Use when asked to assess app health, check code quality, verify generated code, find blockers, review changed files, or decide what to fix next.", `
43
+ # VibeDoctor Health Scan
44
+
45
+ Use VibeDoctor before risky edits, after meaningful edits, and before merge.
46
+
47
+ Respect \`.vibedoctor/agent-policy.yml\` if it exists.
48
+
49
+ ## Default workflow
50
+
51
+ 1. Run a changed-file scan first:
52
+
53
+ \`\`\`bash
54
+ vibedoctor scan --changed --report json
55
+ \`\`\`
56
+
57
+ 2. If there are no changed files or the user asks for a full repo check, run:
58
+
59
+ \`\`\`bash
60
+ vibedoctor scan --full --report json
61
+ \`\`\`
62
+
63
+ 3. Read \`.vibedoctor/report.json\`.
64
+
65
+ 4. Prioritize findings in this order:
66
+ - security blockers
67
+ - correctness blockers
68
+ - failing tests
69
+ - dependency vulnerabilities
70
+ - high-confidence dead code
71
+ - leftover legacy, fallback, or commented code
72
+ - refactor-readiness candidates
73
+ - efficiency suggestions
74
+
75
+ ## Output to user
76
+
77
+ Give only:
78
+ - health score
79
+ - blockers
80
+ - safest next command
81
+ - top 3 fixes
82
+ - whether work is safe to continue
83
+
84
+ Do not paste the full JSON unless the user asks.
85
+ `),
86
+ createSkill("vibedoctor-safe-fix", "Safely apply VibeDoctor-approved autofixes such as formatting, lint fixes, unused imports, and simple tool fixes. Use when the user asks to clean, fix lint, improve health score, or apply safe automatic fixes without changing behavior.", `
87
+ # VibeDoctor Safe Fix
88
+
89
+ Only apply safe fixes allowed by \`.vibedoctor/agent-policy.yml\`.
90
+
91
+ ## Safe commands
92
+
93
+ Run:
94
+
95
+ \`\`\`bash
96
+ vibedoctor fix --safe
97
+ \`\`\`
98
+
99
+ Then verify:
100
+
101
+ \`\`\`bash
102
+ vibedoctor scan --changed --report json
103
+ \`\`\`
104
+
105
+ ## Rules
106
+
107
+ - Do not delete files.
108
+ - Do not remove dead code unless another skill produced a reviewed deletion plan.
109
+ - Do not upgrade dependencies unless the user asked and policy allows it.
110
+ - Do not change public APIs.
111
+ - Do not rewrite business logic.
112
+ - If tests fail after safe fix, stop and report the failing command.
113
+
114
+ ## User summary
115
+
116
+ Report:
117
+ - number of issues fixed
118
+ - files changed
119
+ - remaining blockers
120
+ - verification result
121
+ `),
122
+ createSkill("vibedoctor-dead-code-cleanup", "Review and clean high-confidence dead code chains, unused exports, unused files, unused dependencies, commented-out code, legacy fallbacks, and AI-created leftovers found by VibeDoctor. Use when asked to remove dead code, clean leftovers, reduce legacy baggage, or simplify AI-generated code.", `
123
+ # VibeDoctor Dead Code Cleanup
124
+
125
+ Use VibeDoctor findings as evidence, not as automatic truth.
126
+
127
+ ## Workflow
128
+
129
+ 1. Run:
130
+
131
+ \`\`\`bash
132
+ vibedoctor scan --full --category dead_code,leftovers --report json
133
+ \`\`\`
134
+
135
+ 2. Read \`.vibedoctor/report.json\`.
136
+
137
+ 3. Group findings into:
138
+ - high-confidence deletion candidates
139
+ - medium-confidence review candidates
140
+ - low-confidence do-not-delete candidates
141
+
142
+ 4. For each dead chain, verify:
143
+ - no active imports
144
+ - no route registration
145
+ - no test dependency
146
+ - no dynamic import or reflection warning
147
+ - no public API export
148
+ - no framework magic usage
149
+
150
+ 5. Only delete high-confidence code after verification and policy approval.
151
+
152
+ ## Never delete automatically
153
+
154
+ Do not delete if the finding involves:
155
+ - public exports
156
+ - migrations
157
+ - plugin systems
158
+ - reflection
159
+ - dynamic imports
160
+ - environment-gated fallbacks
161
+ - backward compatibility comments
162
+ - payment, auth, or security code
163
+
164
+ ## Cleanup plan format
165
+
166
+ \`\`\`text
167
+ Dead chain:
168
+ - file A
169
+ - file B
170
+ - file C
171
+
172
+ Evidence:
173
+ - no active entrypoint
174
+ - no tests
175
+ - only internal references
176
+
177
+ Action:
178
+ - safe to remove / review required / do not remove
179
+
180
+ Verification:
181
+ - test command
182
+ - VibeDoctor scan command
183
+ \`\`\`
184
+ `),
185
+ createSkill("vibedoctor-refactor-readiness", "Use VibeDoctor to decide whether large, complex, duplicated, or messy files are ready for refactor. Use when asked to refactor large files, split files, reduce complexity, simplify generated code, or improve maintainability.", `
186
+ # VibeDoctor Refactor Readiness
187
+
188
+ Do not refactor just because a file is large.
189
+
190
+ ## Workflow
191
+
192
+ 1. Run:
193
+
194
+ \`\`\`bash
195
+ vibedoctor scan --category refactor_readiness,maintainability,tests --report json
196
+ \`\`\`
197
+
198
+ 2. Read \`.vibedoctor/report.json\`.
199
+
200
+ 3. For each candidate, classify:
201
+
202
+ \`\`\`text
203
+ READY FOR REFACTOR
204
+ ADD TESTS FIRST
205
+ DO NOT TOUCH
206
+ \`\`\`
207
+
208
+ ## Ready for refactor when
209
+
210
+ - high pain score
211
+ - tests exist
212
+ - tests pass
213
+ - coverage is acceptable
214
+ - few external callers
215
+ - no high security sensitivity
216
+ - public API can be preserved
217
+
218
+ ## Add tests first when
219
+
220
+ - the file is complex
221
+ - coverage is low
222
+ - payment, auth, or security logic is involved
223
+ - behavior is unclear
224
+
225
+ ## Refactor rules
226
+
227
+ - Preserve public APIs.
228
+ - Make one extraction at a time.
229
+ - Run tests after each extraction.
230
+ - Prefer small named helpers over clever abstractions.
231
+ - Do not combine refactor with behavior changes.
232
+
233
+ ## Output
234
+
235
+ Return:
236
+ - file name
237
+ - why it is ready or not ready
238
+ - exact extraction plan
239
+ - tests to add or run
240
+ `),
241
+ createSkill("vibedoctor-pr-review", "Review pull requests and changed files using VibeDoctor. Use when asked to review a PR, check agent-generated code, prepare a PR, summarize app health, or ensure a branch is safe before merge.", `
242
+ # VibeDoctor PR Review
243
+
244
+ Focus on changed code.
245
+
246
+ ## Workflow
247
+
248
+ 1. Run:
249
+
250
+ \`\`\`bash
251
+ vibedoctor scan --changed --report json
252
+ \`\`\`
253
+
254
+ 2. If available, run tests for changed packages.
255
+
256
+ 3. Read:
257
+ - \`.vibedoctor/report.json\`
258
+ - git diff
259
+ - test output
260
+
261
+ ## Review priority
262
+
263
+ 1. security regressions
264
+ 2. test failures
265
+ 3. type errors
266
+ 4. dependency changes
267
+ 5. dead code introduced
268
+ 6. fallback or legacy leftovers introduced
269
+ 7. refactor risk
270
+
271
+ ## PR comment format
272
+
273
+ \`\`\`md
274
+ ## VibeDoctor Review
275
+
276
+ Health: <score>/100
277
+
278
+ ### Blockers
279
+ - ...
280
+
281
+ ### Should fix
282
+ - ...
283
+
284
+ ### Safe cleanup
285
+ - ...
286
+
287
+ ### Verification
288
+ - command: result
289
+ \`\`\`
290
+
291
+ Do not flood the PR with every low-severity lint issue.
292
+ `),
293
+ createSkill("vibedoctor-ci-repair", "Diagnose and repair CI failures using VibeDoctor, test output, type errors, lint errors, and dependency issues. Use when builds fail, tests fail, GitHub Actions fail, or validation pipelines fail.", `
294
+ # VibeDoctor CI Repair
295
+
296
+ Fix the smallest cause first.
297
+
298
+ ## Workflow
299
+
300
+ 1. Inspect the failing command or CI logs.
301
+ 2. Run:
302
+
303
+ \`\`\`bash
304
+ vibedoctor scan --changed --report json
305
+ \`\`\`
306
+
307
+ 3. If the failure is unclear, run:
308
+
309
+ \`\`\`bash
310
+ vibedoctor scan --full --report json
311
+ \`\`\`
312
+
313
+ 4. Fix in this order:
314
+ - syntax and type errors
315
+ - failing tests
316
+ - missing dependencies
317
+ - lint blockers
318
+ - security gates
319
+ - coverage gates
320
+
321
+ ## Rules
322
+
323
+ - Do not disable tests.
324
+ - Do not lower thresholds.
325
+ - Do not remove security checks.
326
+ - Do not edit CI config unless the failure is actually caused by CI config.
327
+ - Prefer reproducing locally before patching.
328
+
329
+ ## Final response
330
+
331
+ Include:
332
+ - root cause
333
+ - files changed
334
+ - command that now passes
335
+ - remaining risks
336
+ `)
337
+ ];
@@ -0,0 +1,22 @@
1
+ export declare function runAgentInitCommand(root: string, options: {
2
+ target?: string;
3
+ targets?: string;
4
+ force?: boolean;
5
+ }): Promise<string>;
6
+ export declare function runAgentPackCommand(root: string, options: {
7
+ target?: string;
8
+ targets?: string;
9
+ force?: boolean;
10
+ }): Promise<string>;
11
+ export declare function runAgentSyncCommand(root: string, options: {
12
+ target?: string;
13
+ targets?: string;
14
+ force?: boolean;
15
+ }): Promise<string>;
16
+ export declare function runAgentDoctorCommand(root: string, options: {
17
+ target?: string;
18
+ targets?: string;
19
+ }): Promise<{
20
+ output: string;
21
+ exitCode: number;
22
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runAgentInitCommand = runAgentInitCommand;
4
+ exports.runAgentPackCommand = runAgentPackCommand;
5
+ exports.runAgentSyncCommand = runAgentSyncCommand;
6
+ exports.runAgentDoctorCommand = runAgentDoctorCommand;
7
+ const generateAgentPack_1 = require("../../agentPack/generateAgentPack");
8
+ function formatFileSection(title, files) {
9
+ if (files.length === 0) {
10
+ return [];
11
+ }
12
+ return [title, ...files.sort().map((file) => `- ${file}`), ""];
13
+ }
14
+ function formatApplyResult(title, result, includeNextSteps = false) {
15
+ const lines = [title, ""];
16
+ lines.push(...formatFileSection("Created:", result.created));
17
+ lines.push(...formatFileSection("Updated:", result.updated));
18
+ lines.push(...formatFileSection("Skipped:", result.skipped));
19
+ if (result.created.length === 0 && result.updated.length === 0 && result.skipped.length === 0) {
20
+ lines.push("No files changed.", "");
21
+ }
22
+ if (includeNextSteps) {
23
+ lines.push("Next:", '1. Open your agent.', "2. Run /skills.", '3. Ask: "Use VibeDoctor to scan this repo."');
24
+ }
25
+ return `${lines.join("\n").trimEnd()}\n`;
26
+ }
27
+ function resolveTargets(options, defaultTargets = ["codex"]) {
28
+ const merged = options.target ? options.target : options.targets;
29
+ return (0, generateAgentPack_1.parseAgentTargets)(merged, defaultTargets);
30
+ }
31
+ async function runAgentInitCommand(root, options) {
32
+ const targets = resolveTargets(options);
33
+ const result = await (0, generateAgentPack_1.initAgentPack)(root, { targets, force: options.force });
34
+ return formatApplyResult("VibeDoctor Agent Pack installed ✅", result, true);
35
+ }
36
+ async function runAgentPackCommand(root, options) {
37
+ const manifest = await (0, generateAgentPack_1.loadAgentPackManifest)(root);
38
+ const targets = resolveTargets(options, manifest?.targets ?? ["codex"]);
39
+ const result = await (0, generateAgentPack_1.packAgentPack)(root, { targets, force: options.force });
40
+ return formatApplyResult("VibeDoctor Agent Pack regenerated ✅", result);
41
+ }
42
+ async function runAgentSyncCommand(root, options) {
43
+ const manifest = await (0, generateAgentPack_1.loadAgentPackManifest)(root);
44
+ const targets = resolveTargets(options, manifest?.targets ?? ["codex"]);
45
+ const result = await (0, generateAgentPack_1.syncAgentPack)(root, { targets, force: options.force });
46
+ return formatApplyResult("VibeDoctor Agent Pack synced ✅", result);
47
+ }
48
+ async function runAgentDoctorCommand(root, options) {
49
+ const manifest = await (0, generateAgentPack_1.loadAgentPackManifest)(root);
50
+ const targets = resolveTargets(options, manifest?.targets ?? ["codex"]);
51
+ const result = await (0, generateAgentPack_1.doctorAgentPack)(root, targets);
52
+ const lines = result.items.map((item) => `${item.status === "ok" ? "✅" : "⚠️"} ${item.message}`);
53
+ return {
54
+ output: `${lines.join("\n")}\n`,
55
+ exitCode: result.ok ? 0 : 1
56
+ };
57
+ }
@@ -0,0 +1 @@
1
+ export declare function runAgentPlanCommand(root: string, format?: "markdown" | "json", target?: "codex" | "copilot" | "claude" | "cursor" | undefined): Promise<string>;
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runAgentPlanCommand = runAgentPlanCommand;
4
+ const policy_1 = require("../../agentPack/policy");
5
+ const engine_1 = require("../../core/engine");
6
+ const agent_1 = require("../../reporters/agent");
7
+ async function runAgentPlanCommand(root, format = "markdown", target = undefined) {
8
+ const scan = await (0, engine_1.runScan)(root, "default");
9
+ const { policy } = await (0, policy_1.loadAgentPolicy)(root);
10
+ const plan = (0, engine_1.createAgentPlan)({ findings: scan.findings, score: scan.score, skippedTools: scan.skippedTools, testCommands: scan.testCommands }, { policy, target: target ?? "generic" });
11
+ return format === "json" ? `${(0, agent_1.renderAgentJson)(plan)}\n` : (0, agent_1.renderAgentMarkdown)(plan);
12
+ }
@@ -0,0 +1 @@
1
+ export declare function runBaselineCreateCommand(root: string): Promise<string>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runBaselineCreateCommand = runBaselineCreateCommand;
4
+ const engine_1 = require("../../core/engine");
5
+ async function runBaselineCreateCommand(root) {
6
+ const result = await (0, engine_1.createBaseline)(root);
7
+ return `Baseline created at ${result.file} with ${result.count} findings.\n`;
8
+ }
@@ -0,0 +1 @@
1
+ export declare function runExplainCommand(root: string, findingId: string, format?: "text" | "json"): Promise<string>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runExplainCommand = runExplainCommand;
4
+ const engine_1 = require("../../core/engine");
5
+ async function runExplainCommand(root, findingId, format = "text") {
6
+ const scan = await (0, engine_1.runScan)(root, "default");
7
+ const payload = (0, engine_1.buildExplainPayload)(scan, findingId);
8
+ if (format === "json") {
9
+ return `${JSON.stringify(payload, null, 2)}\n`;
10
+ }
11
+ if (!payload.finding) {
12
+ return `Finding not found.\nSuggestions:\n- ${payload.suggestions.join("\n- ")}\n`;
13
+ }
14
+ const finding = payload.finding;
15
+ const lines = [
16
+ `Finding: ${finding.id}`,
17
+ `Title: ${finding.title}`,
18
+ `Severity: ${finding.severity}`,
19
+ `Category: ${finding.category}`,
20
+ `File: ${finding.file ?? "n/a"}`,
21
+ `Message: ${finding.message}`,
22
+ "",
23
+ "Suggestions:"
24
+ ];
25
+ payload.suggestions.forEach((suggestion) => lines.push(`- ${suggestion}`));
26
+ if (payload.relatedFindings.length > 0) {
27
+ lines.push("", "Related findings:");
28
+ payload.relatedFindings.slice(0, 5).forEach((related) => lines.push(`- ${related.title}: ${related.message}`));
29
+ }
30
+ if (payload.skippedTools.length > 0) {
31
+ lines.push("", "Skipped tools:");
32
+ payload.skippedTools.forEach((tool) => lines.push(`- ${tool.id}${tool.installHint ? ` — ${tool.installHint}` : ""}`));
33
+ }
34
+ return `${lines.join("\n")}\n`;
35
+ }
@@ -0,0 +1 @@
1
+ export declare function runSafeFixCommand(root: string): Promise<string>;
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runSafeFixCommand = runSafeFixCommand;
4
+ const git_1 = require("../../core/git");
5
+ const engine_1 = require("../../core/engine");
6
+ async function runSafeFixCommand(root) {
7
+ const dirty = await (0, git_1.isWorkingTreeDirty)(root);
8
+ const result = await (0, engine_1.safeFix)(root);
9
+ const lines = [
10
+ dirty ? "Warning: working tree has uncommitted changes." : "Working tree looks clean.",
11
+ "",
12
+ "Safe fix results:"
13
+ ];
14
+ for (const item of result.results) {
15
+ lines.push(`- ${item.id}: ${item.status}`);
16
+ }
17
+ lines.push("", `Before: ${result.before.findings.length} findings`, `After: ${result.after.findings.length} findings`);
18
+ return `${lines.join("\n")}\n`;
19
+ }
@@ -0,0 +1 @@
1
+ export declare function runInit(root: string): Promise<string>;
@@ -0,0 +1,101 @@
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.runInit = runInit;
7
+ const node_fs_1 = require("node:fs");
8
+ const node_path_1 = __importDefault(require("node:path"));
9
+ const config_1 = require("../../core/config");
10
+ const paths_1 = require("../../core/paths");
11
+ const projectDetector_1 = require("../../core/projectDetector");
12
+ function buildYaml(detectedLanguages) {
13
+ const languagesBlock = detectedLanguages.length > 0
14
+ ? ` languages:\n${detectedLanguages.map((language) => ` - ${language}`).join("\n")}`
15
+ : " languages: []";
16
+ return `version: ${config_1.defaultConfig.version}
17
+
18
+ profile: ${config_1.defaultConfig.profile}
19
+
20
+ project:
21
+ type: ${config_1.defaultConfig.project.type}
22
+ ${languagesBlock}
23
+
24
+ paths:
25
+ include:
26
+ - src/**
27
+ - app/**
28
+ - packages/**
29
+ - services/**
30
+ exclude:
31
+ - node_modules/**
32
+ - dist/**
33
+ - build/**
34
+ - .venv/**
35
+ - coverage/**
36
+ - .next/**
37
+ - vendor/**
38
+
39
+ baseline:
40
+ enabled: true
41
+ file: .vibedoctor/baseline.json
42
+ fail_only_on_new_issues: true
43
+
44
+ score:
45
+ minimum: ${config_1.defaultConfig.score.minimum}
46
+
47
+ checks:
48
+ security:
49
+ enabled: true
50
+ fail_on_secrets: true
51
+ fail_on_new_high_vulnerabilities: true
52
+
53
+ correctness:
54
+ enabled: true
55
+ fail_on_type_errors: true
56
+ fail_on_test_failures: true
57
+
58
+ dead_code:
59
+ enabled: true
60
+ delete_automatically: false
61
+ min_confidence_to_report: medium
62
+
63
+ leftovers:
64
+ enabled: true
65
+ scan_comments: true
66
+ scan_commented_code: true
67
+ scan_legacy_fallbacks: true
68
+ delete_automatically: false
69
+
70
+ refactor_readiness:
71
+ enabled: true
72
+ min_file_lines: 500
73
+ min_complexity: 15
74
+ require_tests_before_refactor: true
75
+
76
+ tests:
77
+ enabled: true
78
+ min_coverage: 70
79
+ min_changed_code_coverage: 80
80
+
81
+ dependencies:
82
+ enabled: true
83
+ fail_on_missing_dependencies: true
84
+ fail_on_new_direct_vulnerabilities: true
85
+
86
+ output:
87
+ terminal: true
88
+ json: .vibedoctor/report.json
89
+ html: .vibedoctor/report.html
90
+ agent: .vibedoctor/agent-plan.md
91
+ `;
92
+ }
93
+ async function runInit(root) {
94
+ const project = await (0, projectDetector_1.detectProject)(root);
95
+ const configPath = node_path_1.default.join(root, "vibedoctor.yml");
96
+ const baselineDir = node_path_1.default.join(root, ".vibedoctor");
97
+ await (0, paths_1.ensureDir)(baselineDir);
98
+ await node_fs_1.promises.writeFile(configPath, buildYaml(project.languages), "utf8");
99
+ await node_fs_1.promises.writeFile(node_path_1.default.join(baselineDir, "baseline.json"), JSON.stringify({ createdAt: new Date().toISOString(), findings: [] }, null, 2), "utf8");
100
+ return configPath;
101
+ }
@@ -0,0 +1 @@
1
+ export declare function runReportCommand(root: string, format?: "json" | "html" | "markdown" | "agent" | "sarif" | "full"): Promise<string>;
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runReportCommand = runReportCommand;
4
+ const engine_1 = require("../../core/engine");
5
+ const agent_1 = require("../../reporters/agent");
6
+ const html_1 = require("../../reporters/html");
7
+ const json_1 = require("../../reporters/json");
8
+ const markdown_1 = require("../../reporters/markdown");
9
+ const sarif_1 = require("../../reporters/sarif");
10
+ async function runReportCommand(root, format = "json") {
11
+ const scan = await (0, engine_1.runScan)(root, "full");
12
+ switch (format) {
13
+ case "html":
14
+ return (0, html_1.renderHtmlReport)(scan);
15
+ case "markdown":
16
+ case "full":
17
+ return (0, markdown_1.renderMarkdownReport)(scan);
18
+ case "agent":
19
+ return (0, agent_1.renderAgentMarkdown)(scan);
20
+ case "sarif":
21
+ return (0, sarif_1.renderSarif)(scan);
22
+ default:
23
+ return (0, json_1.renderJsonReport)(scan);
24
+ }
25
+ }
@@ -0,0 +1,14 @@
1
+ import type { VibeDoctorConfig } from "../../core/config";
2
+ import { type ScanOutput } from "../../core/engine";
3
+ export type ScanCommandResult = {
4
+ output: string;
5
+ exitCode: number;
6
+ };
7
+ export declare function determineExitCode(scan: Pick<ScanOutput, "score" | "findings">, config: VibeDoctorConfig): number;
8
+ export declare function runScanCommand(root: string, options: {
9
+ changed?: boolean;
10
+ quick?: boolean;
11
+ full?: boolean;
12
+ category?: string;
13
+ report?: "terminal" | "json" | "html" | "agent" | "agent-json";
14
+ }): Promise<ScanCommandResult>;