@neuralaxis/vibedoctor 0.2.1 → 0.3.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 (57) hide show
  1. package/README.md +70 -24
  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 +17 -3
  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 +17 -4
  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 +9 -1
  13. package/dist/cli/commands/scan.js +37 -3
  14. package/dist/cli/index.js +40 -11
  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 +73 -51
  21. package/dist/core/executable.js +14 -6
  22. package/dist/core/executionPolicy.d.ts +55 -0
  23. package/dist/core/executionPolicy.js +144 -0
  24. package/dist/core/finding.d.ts +1 -1
  25. package/dist/core/finding.js +8 -3
  26. package/dist/core/findingCorrelator.d.ts +19 -0
  27. package/dist/core/findingCorrelator.js +112 -0
  28. package/dist/core/findingNormalizer.js +1 -0
  29. package/dist/core/git.d.ts +2 -0
  30. package/dist/core/git.js +26 -1
  31. package/dist/core/managedTools.d.ts +25 -0
  32. package/dist/core/managedTools.js +186 -0
  33. package/dist/core/repoGraph.d.ts +62 -0
  34. package/dist/core/repoGraph.js +408 -0
  35. package/dist/core/riskRanker.d.ts +6 -0
  36. package/dist/core/riskRanker.js +127 -0
  37. package/dist/core/scanContext.d.ts +26 -0
  38. package/dist/core/scanContext.js +44 -0
  39. package/dist/core/scanPlanner.d.ts +1 -0
  40. package/dist/core/scanPlanner.js +18 -6
  41. package/dist/core/toolRegistry.js +12 -5
  42. package/dist/core/toolRunner.d.ts +4 -0
  43. package/dist/core/toolRunner.js +28 -3
  44. package/dist/core/toolRuntime.d.ts +40 -0
  45. package/dist/core/toolRuntime.js +417 -0
  46. package/dist/core/toolVerification.d.ts +3 -1
  47. package/dist/core/toolVerification.js +58 -3
  48. package/dist/index.d.ts +5 -0
  49. package/dist/index.js +5 -0
  50. package/dist/integration/envelope.d.ts +72 -0
  51. package/dist/integration/envelope.js +61 -0
  52. package/dist/integration/sourceFingerprint.d.ts +21 -0
  53. package/dist/integration/sourceFingerprint.js +68 -0
  54. package/dist/reporters/agent.d.ts +1 -1
  55. package/dist/reporters/agent.js +7 -0
  56. package/package.json +81 -80
  57. package/schemas/machine-envelope.v1.schema.json +92 -0
@@ -17,6 +17,7 @@ const executable_1 = require("./executable");
17
17
  const semverLite_1 = require("./semverLite");
18
18
  const toolRegistry_1 = require("./toolRegistry");
19
19
  const toolRunner_1 = require("./toolRunner");
20
+ const toolRuntime_1 = require("./toolRuntime");
20
21
  function isVerificationBlocking(verification) {
21
22
  return verification.state === "not_found" || verification.state === "broken" || verification.state === "incompatible_runtime";
22
23
  }
@@ -212,6 +213,60 @@ async function verifyTool(entry, options) {
212
213
  runtime
213
214
  };
214
215
  }
216
+ if (options.toolRuntime && (0, toolRuntime_1.isManagedTool)(entry.id)) {
217
+ const managed = await options.toolRuntime.resolve(entry.id, { projectRoot: root });
218
+ if (managed.executablePath) {
219
+ if (depth === "resolve") {
220
+ return {
221
+ id: entry.id,
222
+ state: "verified",
223
+ resolvedPath: managed.executablePath,
224
+ version: managed.version,
225
+ reason: managed.reason,
226
+ runtime
227
+ };
228
+ }
229
+ const probeArgs = entry.probeArgs ?? ["--version"];
230
+ const result = await (0, toolRunner_1.runCommand)({
231
+ cmd: managed.executablePath,
232
+ args: probeArgs,
233
+ cwd: root,
234
+ timeoutMs: PROBE_TIMEOUT_MS
235
+ });
236
+ const probeCommand = [managed.executablePath, ...probeArgs].join(" ");
237
+ if (result.status !== "ok") {
238
+ return {
239
+ id: entry.id,
240
+ state: "broken",
241
+ resolvedPath: managed.executablePath,
242
+ version: managed.version,
243
+ probeCommand,
244
+ reason: `Managed ${entry.id} at ${managed.executablePath} failed its version probe.`,
245
+ remediation: managed.remediation ?? (0, toolRegistry_1.installHintFor)(entry),
246
+ runtime
247
+ };
248
+ }
249
+ return {
250
+ id: entry.id,
251
+ state: "verified",
252
+ resolvedPath: managed.executablePath,
253
+ version: extractVersion(`${result.stdout}\n${result.stderr}`, entry.versionPattern) ?? managed.version,
254
+ probeCommand,
255
+ reason: `Ran managed ${entry.id} at ${managed.executablePath}.`,
256
+ runtime
257
+ };
258
+ }
259
+ if (managed.status === "checksum_mismatch" || managed.status === "failed") {
260
+ return {
261
+ id: entry.id,
262
+ state: "broken",
263
+ version: managed.version,
264
+ reason: managed.reason,
265
+ remediation: managed.remediation,
266
+ runtime
267
+ };
268
+ }
269
+ }
215
270
  const resolved = (0, executable_1.resolveExecutable)(entry.executable, root);
216
271
  if (!resolved) {
217
272
  const searched = (0, executable_1.describeSearchPaths)(root);
@@ -318,11 +373,11 @@ async function saveVerificationCache(root, entries) {
318
373
  // A cache that cannot be written only costs time on the next run.
319
374
  }
320
375
  }
321
- async function verifyTools(entries, root, depth = "execute") {
376
+ async function verifyTools(entries, root, depth = "execute", toolRuntime) {
322
377
  const runtimes = await probeRuntimesFor(entries, root, depth);
323
378
  if (depth === "resolve") {
324
379
  // Resolution is a filesystem lookup; caching it would only add staleness.
325
- return Promise.all(entries.map((entry) => verifyTool(entry, { root, runtimes, depth })));
380
+ return Promise.all(entries.map((entry) => verifyTool(entry, { root, runtimes, depth, toolRuntime })));
326
381
  }
327
382
  const cache = await loadVerificationCache(root);
328
383
  const results = await Promise.all(entries.map(async (entry) => {
@@ -334,7 +389,7 @@ async function verifyTools(entries, root, depth = "execute") {
334
389
  return { verification, cacheEntry: cached };
335
390
  }
336
391
  }
337
- const verification = await verifyTool(entry, { root, runtimes, depth });
392
+ const verification = await verifyTool(entry, { root, runtimes, depth, toolRuntime });
338
393
  const fingerprint = fingerprintFile(verification.resolvedPath);
339
394
  return {
340
395
  verification,
package/dist/index.d.ts CHANGED
@@ -1,10 +1,15 @@
1
1
  export * from "./agentPack/generateAgentPack";
2
2
  export * from "./agentPack/policy";
3
3
  export { AGENT_SKILLS, DEFAULT_SKILL_NAMES, type SkillTemplate } from "./agentPack/templates";
4
+ export * from "./core/agentDiagnosis";
4
5
  export * from "./core/config";
5
6
  export * from "./core/engine";
6
7
  export * from "./core/finding";
8
+ export * from "./core/findingCorrelator";
7
9
  export * from "./core/privacyReview";
8
10
  export * from "./core/projectDetector";
11
+ export * from "./core/scanContext";
12
+ export * from "./core/scanPlanner";
13
+ export * from "./core/toolRuntime";
9
14
  export * from "./mcp/server";
10
15
  export * from "./dpdp";
package/dist/index.js CHANGED
@@ -20,10 +20,15 @@ __exportStar(require("./agentPack/policy"), exports);
20
20
  var templates_1 = require("./agentPack/templates");
21
21
  Object.defineProperty(exports, "AGENT_SKILLS", { enumerable: true, get: function () { return templates_1.AGENT_SKILLS; } });
22
22
  Object.defineProperty(exports, "DEFAULT_SKILL_NAMES", { enumerable: true, get: function () { return templates_1.DEFAULT_SKILL_NAMES; } });
23
+ __exportStar(require("./core/agentDiagnosis"), exports);
23
24
  __exportStar(require("./core/config"), exports);
24
25
  __exportStar(require("./core/engine"), exports);
25
26
  __exportStar(require("./core/finding"), exports);
27
+ __exportStar(require("./core/findingCorrelator"), exports);
26
28
  __exportStar(require("./core/privacyReview"), exports);
27
29
  __exportStar(require("./core/projectDetector"), exports);
30
+ __exportStar(require("./core/scanContext"), exports);
31
+ __exportStar(require("./core/scanPlanner"), exports);
32
+ __exportStar(require("./core/toolRuntime"), exports);
28
33
  __exportStar(require("./mcp/server"), exports);
29
34
  __exportStar(require("./dpdp"), exports);
@@ -0,0 +1,72 @@
1
+ import type { VibeDoctorConfig } from "../core/config";
2
+ import type { ScanOutput } from "../core/engine";
3
+ import type { ExecutionPolicy } from "../core/executionPolicy";
4
+ import { type Finding } from "../core/finding";
5
+ import type { SourceFingerprint } from "./sourceFingerprint";
6
+ /**
7
+ * Versioned machine envelope (`scan --report envelope`).
8
+ *
9
+ * It wraps the unchanged `--report json` document with what an integrating tool needs to trust
10
+ * and reuse a result: producer version, run identity and timing, the execution profile, the
11
+ * exact source snapshot, the configuration fingerprint, a stable fingerprint per finding, and
12
+ * the policy-gate outcome kept separate from completeness. Contract: docs/machine-envelope.md
13
+ * and schemas/machine-envelope.v1.schema.json. Additive changes keep the major version.
14
+ */
15
+ export declare const ENVELOPE_SCHEMA = "vibedoctor.machine-envelope";
16
+ export declare const ENVELOPE_VERSION = "1.0.0";
17
+ type JsonReport = Record<string, unknown> & {
18
+ findings: Finding[];
19
+ };
20
+ export type MachineEnvelope = {
21
+ schema: typeof ENVELOPE_SCHEMA;
22
+ schemaVersion: string;
23
+ producer: {
24
+ name: string;
25
+ version: string;
26
+ };
27
+ run: {
28
+ id: string;
29
+ startedAt: string;
30
+ finishedAt: string;
31
+ mode: string;
32
+ profile: ExecutionPolicy["profile"];
33
+ network: boolean;
34
+ categories: string[] | null;
35
+ };
36
+ repository: {
37
+ root: string;
38
+ source: SourceFingerprint;
39
+ git: {
40
+ head: string | null;
41
+ dirty: boolean | null;
42
+ changedFiles: number | null;
43
+ };
44
+ };
45
+ config: {
46
+ path: string | null;
47
+ fingerprint: string;
48
+ };
49
+ /** Whether the scan ran to completion; a crash never produces an envelope. */
50
+ execution: {
51
+ status: "completed";
52
+ };
53
+ /** Policy gate, independent of completeness: 0 pass, 1 finding/score gate, 2 incomplete. */
54
+ gate: {
55
+ exitCode: number;
56
+ status: "pass" | "fail" | "incomplete";
57
+ };
58
+ /** The `--report json` document; findings additionally carry `fingerprint`. */
59
+ report: JsonReport;
60
+ };
61
+ export declare function buildMachineEnvelope(input: {
62
+ scan: ScanOutput;
63
+ config: VibeDoctorConfig;
64
+ policy: ExecutionPolicy;
65
+ version: string;
66
+ startedAt: Date;
67
+ finishedAt: Date;
68
+ exitCode: number;
69
+ categories: string[] | null;
70
+ source: SourceFingerprint;
71
+ }): Promise<MachineEnvelope>;
72
+ export {};
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ENVELOPE_VERSION = exports.ENVELOPE_SCHEMA = void 0;
4
+ exports.buildMachineEnvelope = buildMachineEnvelope;
5
+ const node_crypto_1 = require("node:crypto");
6
+ const finding_1 = require("../core/finding");
7
+ const git_1 = require("../core/git");
8
+ const json_1 = require("../reporters/json");
9
+ /**
10
+ * Versioned machine envelope (`scan --report envelope`).
11
+ *
12
+ * It wraps the unchanged `--report json` document with what an integrating tool needs to trust
13
+ * and reuse a result: producer version, run identity and timing, the execution profile, the
14
+ * exact source snapshot, the configuration fingerprint, a stable fingerprint per finding, and
15
+ * the policy-gate outcome kept separate from completeness. Contract: docs/machine-envelope.md
16
+ * and schemas/machine-envelope.v1.schema.json. Additive changes keep the major version.
17
+ */
18
+ exports.ENVELOPE_SCHEMA = "vibedoctor.machine-envelope";
19
+ exports.ENVELOPE_VERSION = "1.0.0";
20
+ const withFingerprint = (findings) => Array.isArray(findings)
21
+ ? findings.map((f) => ({ ...f, fingerprint: (0, finding_1.fingerprintFinding)(f) }))
22
+ : findings;
23
+ async function buildMachineEnvelope(input) {
24
+ const { scan, config, policy } = input;
25
+ const report = JSON.parse((0, json_1.renderJsonReport)(scan));
26
+ for (const key of ["findings", "topFindings", "privacyFindings", "dpdpFindings", "suppressedFindings"])
27
+ if (key in report)
28
+ report[key] = withFingerprint(report[key]);
29
+ const git = (await (0, git_1.isGitRepo)(scan.root))
30
+ ? {
31
+ head: await (0, git_1.getHeadCommit)(scan.root),
32
+ dirty: await (0, git_1.isWorkingTreeDirty)(scan.root),
33
+ changedFiles: (await (0, git_1.getChangedFiles)(scan.root)).length
34
+ }
35
+ : { head: null, dirty: null, changedFiles: null };
36
+ return {
37
+ schema: exports.ENVELOPE_SCHEMA,
38
+ schemaVersion: exports.ENVELOPE_VERSION,
39
+ producer: { name: "@neuralaxis/vibedoctor", version: input.version },
40
+ run: {
41
+ id: (0, node_crypto_1.randomUUID)(),
42
+ startedAt: input.startedAt.toISOString(),
43
+ finishedAt: input.finishedAt.toISOString(),
44
+ mode: scan.mode,
45
+ profile: policy.profile,
46
+ network: policy.allowNetwork,
47
+ categories: input.categories
48
+ },
49
+ repository: { root: scan.root, source: input.source, git },
50
+ config: {
51
+ path: scan.configPath ?? null,
52
+ fingerprint: (0, node_crypto_1.createHash)("sha256").update(JSON.stringify(config)).digest("hex")
53
+ },
54
+ execution: { status: "completed" },
55
+ gate: {
56
+ exitCode: input.exitCode,
57
+ status: input.exitCode === 0 ? "pass" : input.exitCode === 2 ? "incomplete" : "fail"
58
+ },
59
+ report
60
+ };
61
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * `sha256-tree-v1`: identifies the exact file contents a scan saw, including uncommitted edits
3
+ * (a commit hash alone does not). Documented in docs/machine-envelope.md so other tools can
4
+ * recompute it independently:
5
+ *
6
+ * for every regular file under the root, skipping the directories in SKIPPED_DIRECTORIES and
7
+ * symbolic links, take the POSIX path relative to the root and sha256(content) in hex;
8
+ * sort by path (code-unit order); hash the concatenation of `${path}\0${hash}\n`.
9
+ *
10
+ * At most MAX_FILES files are hashed; beyond that `truncated` is true and the value covers
11
+ * only the first MAX_FILES paths in sorted order.
12
+ */
13
+ export declare const SKIPPED_DIRECTORIES: Set<string>;
14
+ export declare const MAX_FILES = 50000;
15
+ export type SourceFingerprint = {
16
+ algorithm: "sha256-tree-v1";
17
+ value: string;
18
+ files: number;
19
+ truncated: boolean;
20
+ };
21
+ export declare function sourceFingerprint(root: string): Promise<SourceFingerprint>;
@@ -0,0 +1,68 @@
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.MAX_FILES = exports.SKIPPED_DIRECTORIES = void 0;
7
+ exports.sourceFingerprint = sourceFingerprint;
8
+ const node_crypto_1 = require("node:crypto");
9
+ const node_fs_1 = require("node:fs");
10
+ const node_path_1 = __importDefault(require("node:path"));
11
+ /**
12
+ * `sha256-tree-v1`: identifies the exact file contents a scan saw, including uncommitted edits
13
+ * (a commit hash alone does not). Documented in docs/machine-envelope.md so other tools can
14
+ * recompute it independently:
15
+ *
16
+ * for every regular file under the root, skipping the directories in SKIPPED_DIRECTORIES and
17
+ * symbolic links, take the POSIX path relative to the root and sha256(content) in hex;
18
+ * sort by path (code-unit order); hash the concatenation of `${path}\0${hash}\n`.
19
+ *
20
+ * At most MAX_FILES files are hashed; beyond that `truncated` is true and the value covers
21
+ * only the first MAX_FILES paths in sorted order.
22
+ */
23
+ exports.SKIPPED_DIRECTORIES = new Set([
24
+ ".git",
25
+ ".vibedoctor",
26
+ "node_modules",
27
+ ".venv",
28
+ "venv",
29
+ "__pycache__",
30
+ ".world",
31
+ // Tool caches are scratch output, not source; skipping them keeps identity stable when a
32
+ // scanner (for example ruff in the default profile) writes its cache into the repository.
33
+ ".ruff_cache",
34
+ ".mypy_cache",
35
+ ".pytest_cache"
36
+ ]);
37
+ exports.MAX_FILES = 50_000;
38
+ async function sourceFingerprint(root) {
39
+ const files = [];
40
+ let truncated = false;
41
+ async function walk(dir) {
42
+ const entries = await node_fs_1.promises.readdir(dir, { withFileTypes: true });
43
+ for (const entry of entries) {
44
+ if (entry.isSymbolicLink())
45
+ continue;
46
+ const absolute = node_path_1.default.join(dir, entry.name);
47
+ if (entry.isDirectory()) {
48
+ if (!exports.SKIPPED_DIRECTORIES.has(entry.name))
49
+ await walk(absolute);
50
+ }
51
+ else if (entry.isFile()) {
52
+ files.push(node_path_1.default.relative(root, absolute).split(node_path_1.default.sep).join("/"));
53
+ }
54
+ }
55
+ }
56
+ await walk(root);
57
+ files.sort();
58
+ if (files.length > exports.MAX_FILES) {
59
+ truncated = true;
60
+ files.length = exports.MAX_FILES;
61
+ }
62
+ const tree = (0, node_crypto_1.createHash)("sha256");
63
+ for (const file of files) {
64
+ const content = await node_fs_1.promises.readFile(node_path_1.default.join(root, file));
65
+ tree.update(`${file}\0${(0, node_crypto_1.createHash)("sha256").update(content).digest("hex")}\n`);
66
+ }
67
+ return { algorithm: "sha256-tree-v1", value: tree.digest("hex"), files: files.length, truncated };
68
+ }
@@ -1,3 +1,3 @@
1
1
  import type { AgentPlan, ScanOutput } from "../core/engine";
2
2
  export declare function renderAgentMarkdown(input: Pick<ScanOutput, "agentPlan"> | AgentPlan): string;
3
- export declare function renderAgentJson(input: Pick<ScanOutput, "agentPlan"> | AgentPlan): string;
3
+ export declare function renderAgentJson(input: Pick<ScanOutput, "agentPlan"> | AgentPlan | ScanOutput): string;
@@ -2,9 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.renderAgentMarkdown = renderAgentMarkdown;
4
4
  exports.renderAgentJson = renderAgentJson;
5
+ const agentDiagnosis_1 = require("../core/agentDiagnosis");
5
6
  function getPlan(input) {
6
7
  return "agentPlan" in input ? input.agentPlan : input;
7
8
  }
9
+ function isScanOutput(input) {
10
+ return "findings" in input && "completeness" in input && "score" in input;
11
+ }
8
12
  function renderAgentMarkdown(input) {
9
13
  const plan = getPlan(input);
10
14
  const lines = ["# VibeDoctor Agent Plan", "", `Goal: ${plan.goal}.`, "", `Target: ${plan.target}`, "", "## Workflow", ""];
@@ -52,5 +56,8 @@ function renderAgentMarkdown(input) {
52
56
  return `${lines.join("\n")}\n`;
53
57
  }
54
58
  function renderAgentJson(input) {
59
+ if (isScanOutput(input)) {
60
+ return JSON.stringify(input.diagnosis ?? (0, agentDiagnosis_1.buildAgentDiagnosis)(input), null, 2);
61
+ }
55
62
  return JSON.stringify(getPlan(input), null, 2);
56
63
  }
package/package.json CHANGED
@@ -1,80 +1,81 @@
1
- {
2
- "name": "@neuralaxis/vibedoctor",
3
- "version": "0.2.1",
4
- "description": "Health diagnosis and fix planning for JS, TS, Python, and mixed repositories.",
5
- "type": "commonjs",
6
- "publishConfig": {
7
- "access": "public"
8
- },
9
- "bin": {
10
- "vibedoctor": "dist/cli/index.js"
11
- },
12
- "main": "dist/index.js",
13
- "types": "dist/index.d.ts",
14
- "exports": {
15
- ".": {
16
- "types": "./dist/index.d.ts",
17
- "require": "./dist/index.js"
18
- }
19
- },
20
- "files": [
21
- "dist",
22
- "README.md",
23
- "LICENSE",
24
- "package.json"
25
- ],
26
- "engines": {
27
- "node": ">=18"
28
- },
29
- "packageManager": "npm@10.8.2",
30
- "keywords": [
31
- "code-health",
32
- "cli",
33
- "static-analysis",
34
- "technical-debt",
35
- "agent-tools"
36
- ],
37
- "scripts": {
38
- "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
39
- "build": "npm run clean && tsc -p tsconfig.build.json",
40
- "typecheck": "tsc -p tsconfig.json --noEmit",
41
- "check": "npm run typecheck && npm test && npm run build && (npm run health || echo 'Health scan completed (non-fatal in this gate)')",
42
- "prepack": "npm run build",
43
- "test": "vitest run",
44
- "prepublishOnly": "npm run build && npm test",
45
- "dev": "tsx src/cli/index.ts",
46
- "health": "tsx src/cli/index.ts scan --quick --report terminal"
47
- },
48
- "license": "GPL-3.0-or-later",
49
- "author": "neuralaxis",
50
- "repository": {
51
- "type": "git",
52
- "url": "git+https://github.com/neural-axis/VibeDoctor.git"
53
- },
54
- "homepage": "https://github.com/neural-axis/VibeDoctor#readme",
55
- "bugs": {
56
- "url": "https://github.com/neural-axis/VibeDoctor/issues"
57
- },
58
- "dependencies": {
59
- "commander": "^14.0.0",
60
- "minimatch": "^10.0.1",
61
- "yaml": "^2.8.1"
62
- },
63
- "devDependencies": {
64
- "@biomejs/biome": "^2.5.0",
65
- "@types/node": "^24.0.1",
66
- "@vitest/coverage-v8": "^3.2.6",
67
- "jscpd": "^5.0.9",
68
- "knip": "^6.16.1",
69
- "tsx": "^4.20.3",
70
- "typescript": "^5.8.3",
71
- "vite": "^7.3.5",
72
- "vitest": "^3.2.6"
73
- },
74
- "overrides": {
75
- "esbuild": "0.28.1"
76
- },
77
- "allowScripts": {
78
- "esbuild@0.28.1": true
79
- }
80
- }
1
+ {
2
+ "name": "@neuralaxis/vibedoctor",
3
+ "version": "0.3.0",
4
+ "description": "Health diagnosis and fix planning for JS, TS, Python, and mixed repositories.",
5
+ "type": "commonjs",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ },
9
+ "bin": {
10
+ "vibedoctor": "dist/cli/index.js"
11
+ },
12
+ "main": "dist/index.js",
13
+ "types": "dist/index.d.ts",
14
+ "exports": {
15
+ ".": {
16
+ "types": "./dist/index.d.ts",
17
+ "require": "./dist/index.js"
18
+ }
19
+ },
20
+ "files": [
21
+ "dist",
22
+ "schemas",
23
+ "README.md",
24
+ "LICENSE",
25
+ "package.json"
26
+ ],
27
+ "engines": {
28
+ "node": ">=18"
29
+ },
30
+ "packageManager": "npm@10.8.2",
31
+ "keywords": [
32
+ "code-health",
33
+ "cli",
34
+ "static-analysis",
35
+ "technical-debt",
36
+ "agent-tools"
37
+ ],
38
+ "scripts": {
39
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\"",
40
+ "build": "npm run clean && tsc -p tsconfig.build.json",
41
+ "typecheck": "tsc -p tsconfig.json --noEmit",
42
+ "check": "npm run typecheck && npm test && npm run build && (npm run health || echo 'Health scan completed (non-fatal in this gate)')",
43
+ "prepack": "npm run build",
44
+ "test": "vitest run",
45
+ "prepublishOnly": "npm run build && npm test",
46
+ "dev": "tsx src/cli/index.ts",
47
+ "health": "tsx src/cli/index.ts scan --quick --report terminal"
48
+ },
49
+ "license": "GPL-3.0-or-later",
50
+ "author": "neuralaxis",
51
+ "repository": {
52
+ "type": "git",
53
+ "url": "git+https://github.com/neural-axis/VibeDoctor.git"
54
+ },
55
+ "homepage": "https://github.com/neural-axis/VibeDoctor#readme",
56
+ "bugs": {
57
+ "url": "https://github.com/neural-axis/VibeDoctor/issues"
58
+ },
59
+ "dependencies": {
60
+ "commander": "^14.0.0",
61
+ "minimatch": "^10.0.1",
62
+ "yaml": "^2.8.1"
63
+ },
64
+ "devDependencies": {
65
+ "@biomejs/biome": "^2.5.0",
66
+ "@types/node": "^24.0.1",
67
+ "@vitest/coverage-v8": "^3.2.6",
68
+ "jscpd": "^5.0.9",
69
+ "knip": "^6.16.1",
70
+ "tsx": "^4.20.3",
71
+ "typescript": "^5.8.3",
72
+ "vite": "^7.3.5",
73
+ "vitest": "^3.2.6"
74
+ },
75
+ "overrides": {
76
+ "esbuild": "0.28.1"
77
+ },
78
+ "allowScripts": {
79
+ "esbuild@0.28.1": true
80
+ }
81
+ }
@@ -0,0 +1,92 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/neuralaxis/vibedoctor/schemas/machine-envelope.v1.schema.json",
4
+ "title": "VibeDoctor machine envelope v1",
5
+ "description": "Output of `vibedoctor scan --report envelope`. See docs/machine-envelope.md. Additive fields keep the major version.",
6
+ "type": "object",
7
+ "required": ["schema", "schemaVersion", "producer", "run", "repository", "config", "execution", "gate", "report"],
8
+ "properties": {
9
+ "schema": { "const": "vibedoctor.machine-envelope" },
10
+ "schemaVersion": { "type": "string", "pattern": "^1\\.\\d+\\.\\d+$" },
11
+ "producer": {
12
+ "type": "object",
13
+ "required": ["name", "version"],
14
+ "properties": { "name": { "type": "string" }, "version": { "type": "string" } }
15
+ },
16
+ "run": {
17
+ "type": "object",
18
+ "required": ["id", "startedAt", "finishedAt", "mode", "profile", "network", "categories"],
19
+ "properties": {
20
+ "id": { "type": "string" },
21
+ "startedAt": { "type": "string", "format": "date-time" },
22
+ "finishedAt": { "type": "string", "format": "date-time" },
23
+ "mode": { "type": "string" },
24
+ "profile": { "enum": ["default", "static", "trusted"] },
25
+ "network": { "type": "boolean" },
26
+ "categories": { "type": ["array", "null"], "items": { "type": "string" } }
27
+ }
28
+ },
29
+ "repository": {
30
+ "type": "object",
31
+ "required": ["root", "source", "git"],
32
+ "properties": {
33
+ "root": { "type": "string" },
34
+ "source": {
35
+ "type": "object",
36
+ "required": ["algorithm", "value", "files", "truncated"],
37
+ "properties": {
38
+ "algorithm": { "const": "sha256-tree-v1" },
39
+ "value": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
40
+ "files": { "type": "integer", "minimum": 0 },
41
+ "truncated": { "type": "boolean" }
42
+ }
43
+ },
44
+ "git": {
45
+ "type": "object",
46
+ "required": ["head", "dirty", "changedFiles"],
47
+ "properties": {
48
+ "head": { "type": ["string", "null"] },
49
+ "dirty": { "type": ["boolean", "null"] },
50
+ "changedFiles": { "type": ["integer", "null"] }
51
+ }
52
+ }
53
+ }
54
+ },
55
+ "config": {
56
+ "type": "object",
57
+ "required": ["path", "fingerprint"],
58
+ "properties": {
59
+ "path": { "type": ["string", "null"] },
60
+ "fingerprint": { "type": "string", "pattern": "^[0-9a-f]{64}$" }
61
+ }
62
+ },
63
+ "execution": {
64
+ "type": "object",
65
+ "required": ["status"],
66
+ "properties": { "status": { "const": "completed" } }
67
+ },
68
+ "gate": {
69
+ "type": "object",
70
+ "required": ["exitCode", "status"],
71
+ "properties": {
72
+ "exitCode": { "enum": [0, 1, 2] },
73
+ "status": { "enum": ["pass", "fail", "incomplete"] }
74
+ }
75
+ },
76
+ "report": {
77
+ "type": "object",
78
+ "description": "The `scan --report json` document. Findings additionally carry `fingerprint`.",
79
+ "required": ["score", "completeness", "findings", "capabilityMatrix"],
80
+ "properties": {
81
+ "findings": {
82
+ "type": "array",
83
+ "items": {
84
+ "type": "object",
85
+ "required": ["id", "source", "category", "severity", "title", "fingerprint"],
86
+ "properties": { "fingerprint": { "type": "string" } }
87
+ }
88
+ }
89
+ }
90
+ }
91
+ }
92
+ }