@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.
- package/README.md +49 -23
- package/dist/adapters/biome.js +3 -2
- package/dist/adapters/flowDoctor.d.ts +7 -0
- package/dist/adapters/flowDoctor.js +195 -0
- package/dist/adapters/gitleaks.js +4 -2
- package/dist/adapters/index.d.ts +1 -0
- package/dist/adapters/index.js +3 -1
- package/dist/adapters/osvScanner.js +4 -2
- package/dist/adapters/ruff.js +7 -3
- package/dist/adapters/shared.d.ts +4 -0
- package/dist/cli/commands/init.js +7 -0
- package/dist/cli/commands/scan.d.ts +6 -0
- package/dist/cli/commands/scan.js +16 -2
- package/dist/cli/index.js +4 -4
- package/dist/core/agentDiagnosis.d.ts +39 -0
- package/dist/core/agentDiagnosis.js +96 -0
- package/dist/core/config.d.ts +11 -0
- package/dist/core/config.js +31 -2
- package/dist/core/engine.d.ts +8 -1
- package/dist/core/engine.js +54 -51
- package/dist/core/finding.d.ts +1 -1
- package/dist/core/finding.js +8 -3
- package/dist/core/findingCorrelator.d.ts +19 -0
- package/dist/core/findingCorrelator.js +112 -0
- package/dist/core/findingNormalizer.js +1 -0
- package/dist/core/managedTools.d.ts +25 -0
- package/dist/core/managedTools.js +186 -0
- package/dist/core/repoGraph.d.ts +62 -0
- package/dist/core/repoGraph.js +408 -0
- package/dist/core/riskRanker.d.ts +6 -0
- package/dist/core/riskRanker.js +127 -0
- package/dist/core/scanContext.d.ts +26 -0
- package/dist/core/scanContext.js +44 -0
- package/dist/core/scanPlanner.d.ts +1 -0
- package/dist/core/scanPlanner.js +10 -6
- package/dist/core/toolRegistry.js +12 -5
- package/dist/core/toolRunner.d.ts +4 -0
- package/dist/core/toolRunner.js +18 -0
- package/dist/core/toolRuntime.d.ts +40 -0
- package/dist/core/toolRuntime.js +417 -0
- package/dist/core/toolVerification.d.ts +3 -1
- package/dist/core/toolVerification.js +58 -3
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/reporters/agent.d.ts +1 -1
- package/dist/reporters/agent.js +7 -0
- package/package.json +80 -80
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RANKING_CATEGORY_HINT = void 0;
|
|
4
|
+
exports.isStyleOrHygieneFinding = isStyleOrHygieneFinding;
|
|
5
|
+
exports.isLikelyRealBug = isLikelyRealBug;
|
|
6
|
+
exports.riskScore = riskScore;
|
|
7
|
+
exports.rankFindings = rankFindings;
|
|
8
|
+
/**
|
|
9
|
+
* Holistic risk ranking. Category-first sort buried real bugs under unused-import
|
|
10
|
+
* warnings of the same scanner family. This scores likely runtime defects,
|
|
11
|
+
* secrets, and broken flows above lint and maintainability.
|
|
12
|
+
*/
|
|
13
|
+
const SEVERITY_SCORE = {
|
|
14
|
+
critical: 1000,
|
|
15
|
+
high: 700,
|
|
16
|
+
medium: 280,
|
|
17
|
+
low: 70,
|
|
18
|
+
info: 10
|
|
19
|
+
};
|
|
20
|
+
const CONFIDENCE_SCORE = {
|
|
21
|
+
high: 80,
|
|
22
|
+
medium: 30,
|
|
23
|
+
low: 0
|
|
24
|
+
};
|
|
25
|
+
const EVIDENCE_SCORE = {
|
|
26
|
+
verified: 60,
|
|
27
|
+
observed: 40,
|
|
28
|
+
heuristic: 10,
|
|
29
|
+
unproven: 0
|
|
30
|
+
};
|
|
31
|
+
const STYLE_LINT = /^(F401|F841|I00|I001|W29|E5\d|COM|Q0|T20|ISC|WPS|UP0|SIM\d)/i;
|
|
32
|
+
function isStyleOrHygieneFinding(finding) {
|
|
33
|
+
const code = finding.evidence?.toolRawId ?? finding.title;
|
|
34
|
+
if (STYLE_LINT.test(code)) {
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
return finding.category === "leftovers" || finding.category === "maintainability" || finding.category === "efficiency";
|
|
38
|
+
}
|
|
39
|
+
function isLikelyRealBug(finding) {
|
|
40
|
+
if (finding.source === "flow-doctor" && finding.evidenceGrade !== "heuristic") {
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (finding.source === "tsc" || finding.source === "pyright") {
|
|
44
|
+
return true;
|
|
45
|
+
}
|
|
46
|
+
if (finding.category === "tests" && (finding.severity === "high" || finding.severity === "critical")) {
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
const code = finding.evidence?.toolRawId ?? finding.title;
|
|
50
|
+
return /^(F8|F82|F821|E9|B0|S1|TS\d)/i.test(code);
|
|
51
|
+
}
|
|
52
|
+
function riskScore(finding) {
|
|
53
|
+
const evidence = finding.evidenceGrade ?? "observed";
|
|
54
|
+
let score = SEVERITY_SCORE[finding.severity] + CONFIDENCE_SCORE[finding.confidence] + EVIDENCE_SCORE[evidence];
|
|
55
|
+
if (finding.category === "security" || finding.source === "gitleaks" || finding.source === "osv-scanner") {
|
|
56
|
+
score += 520;
|
|
57
|
+
}
|
|
58
|
+
if (finding.source === "flow-doctor") {
|
|
59
|
+
score += evidence === "heuristic" ? 60 : 460;
|
|
60
|
+
}
|
|
61
|
+
if (isLikelyRealBug(finding)) {
|
|
62
|
+
score += 380;
|
|
63
|
+
}
|
|
64
|
+
if (finding.category === "correctness" && !isStyleOrHygieneFinding(finding)) {
|
|
65
|
+
score += 140;
|
|
66
|
+
}
|
|
67
|
+
if (finding.category === "dependencies" && (finding.severity === "high" || finding.severity === "critical")) {
|
|
68
|
+
score += 360;
|
|
69
|
+
}
|
|
70
|
+
if (finding.inChangedFile || finding.isNew) {
|
|
71
|
+
score += 70;
|
|
72
|
+
}
|
|
73
|
+
if (finding.fileRole === "source" || finding.fileRole === undefined) {
|
|
74
|
+
score += 35;
|
|
75
|
+
}
|
|
76
|
+
if (finding.fileRole === "test" || finding.fileRole === "fixture" || finding.fileRole === "generated") {
|
|
77
|
+
score -= 90;
|
|
78
|
+
}
|
|
79
|
+
if (isStyleOrHygieneFinding(finding)) {
|
|
80
|
+
score -= 220;
|
|
81
|
+
}
|
|
82
|
+
if (finding.category === "dead_code" && finding.confidence !== "high") {
|
|
83
|
+
score -= 80;
|
|
84
|
+
}
|
|
85
|
+
if (finding.corroboratedBy && finding.corroboratedBy.length > 0) {
|
|
86
|
+
score += 40 * finding.corroboratedBy.length;
|
|
87
|
+
}
|
|
88
|
+
return score;
|
|
89
|
+
}
|
|
90
|
+
function compareIds(left, right) {
|
|
91
|
+
const fileDelta = (left.file ?? "").localeCompare(right.file ?? "");
|
|
92
|
+
if (fileDelta !== 0) {
|
|
93
|
+
return fileDelta;
|
|
94
|
+
}
|
|
95
|
+
const lineDelta = (left.startLine ?? 0) - (right.startLine ?? 0);
|
|
96
|
+
if (lineDelta !== 0) {
|
|
97
|
+
return lineDelta;
|
|
98
|
+
}
|
|
99
|
+
const titleDelta = left.title.localeCompare(right.title);
|
|
100
|
+
if (titleDelta !== 0) {
|
|
101
|
+
return titleDelta;
|
|
102
|
+
}
|
|
103
|
+
return left.id.localeCompare(right.id);
|
|
104
|
+
}
|
|
105
|
+
function rankFindings(findings) {
|
|
106
|
+
return [...findings]
|
|
107
|
+
.map((finding) => ({ ...finding, priority: riskScore(finding) }))
|
|
108
|
+
.sort((left, right) => {
|
|
109
|
+
const scoreDelta = (right.priority ?? 0) - (left.priority ?? 0);
|
|
110
|
+
if (scoreDelta !== 0) {
|
|
111
|
+
return scoreDelta;
|
|
112
|
+
}
|
|
113
|
+
return compareIds(left, right);
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
exports.RANKING_CATEGORY_HINT = [
|
|
117
|
+
"security",
|
|
118
|
+
"correctness",
|
|
119
|
+
"tests",
|
|
120
|
+
"dependencies",
|
|
121
|
+
"privacy",
|
|
122
|
+
"dead_code",
|
|
123
|
+
"leftovers",
|
|
124
|
+
"refactor_readiness",
|
|
125
|
+
"maintainability",
|
|
126
|
+
"efficiency"
|
|
127
|
+
];
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type FileRoleClassifier } from "./fileRole";
|
|
2
|
+
import type { VibeDoctorConfig } from "./config";
|
|
3
|
+
import { type ProjectContext } from "./projectDetector";
|
|
4
|
+
import type { ScanMode } from "./scanPlanner";
|
|
5
|
+
import { type ToolRuntime, type ToolRuntimeOptions } from "./toolRuntime";
|
|
6
|
+
export type FileIndex = {
|
|
7
|
+
files: readonly string[];
|
|
8
|
+
byExtension(extension: string): string[];
|
|
9
|
+
};
|
|
10
|
+
export type GitContext = {
|
|
11
|
+
hasGit: boolean;
|
|
12
|
+
changedFiles: readonly string[];
|
|
13
|
+
};
|
|
14
|
+
export type RepoContext = ProjectContext;
|
|
15
|
+
export type ScanContext = {
|
|
16
|
+
root: string;
|
|
17
|
+
mode: ScanMode;
|
|
18
|
+
config: VibeDoctorConfig;
|
|
19
|
+
repo: RepoContext;
|
|
20
|
+
files: FileIndex;
|
|
21
|
+
git: GitContext;
|
|
22
|
+
classifyFile: FileRoleClassifier;
|
|
23
|
+
toolRuntime: ToolRuntime;
|
|
24
|
+
};
|
|
25
|
+
export declare function buildFileIndex(files: string[]): FileIndex;
|
|
26
|
+
export declare function buildScanContext(root: string, config: VibeDoctorConfig, mode: ScanMode, runtimeOptions?: ToolRuntimeOptions): Promise<ScanContext>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildFileIndex = buildFileIndex;
|
|
4
|
+
exports.buildScanContext = buildScanContext;
|
|
5
|
+
const fileRole_1 = require("./fileRole");
|
|
6
|
+
const projectDetector_1 = require("./projectDetector");
|
|
7
|
+
const toolRuntime_1 = require("./toolRuntime");
|
|
8
|
+
function buildFileIndex(files) {
|
|
9
|
+
const byExt = new Map();
|
|
10
|
+
for (const file of files) {
|
|
11
|
+
const dot = file.lastIndexOf(".");
|
|
12
|
+
const ext = dot >= 0 ? file.slice(dot).toLowerCase() : "";
|
|
13
|
+
const list = byExt.get(ext) ?? [];
|
|
14
|
+
list.push(file);
|
|
15
|
+
byExt.set(ext, list);
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
files,
|
|
19
|
+
byExtension(extension) {
|
|
20
|
+
const key = extension.startsWith(".") ? extension.toLowerCase() : `.${extension.toLowerCase()}`;
|
|
21
|
+
return byExt.get(key) ?? [];
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
async function buildScanContext(root, config, mode, runtimeOptions) {
|
|
26
|
+
const repo = await (0, projectDetector_1.detectProject)(root, config.paths.exclude);
|
|
27
|
+
return {
|
|
28
|
+
root,
|
|
29
|
+
mode,
|
|
30
|
+
config,
|
|
31
|
+
repo,
|
|
32
|
+
files: buildFileIndex(repo.projectFiles),
|
|
33
|
+
git: { hasGit: repo.hasGit, changedFiles: repo.changedFiles },
|
|
34
|
+
classifyFile: (0, fileRole_1.createFileRoleClassifier)(config.relevance.fileRoles),
|
|
35
|
+
toolRuntime: (0, toolRuntime_1.createToolRuntime)({
|
|
36
|
+
projectRoot: root,
|
|
37
|
+
enabled: config.runtime.managedTools.enabled,
|
|
38
|
+
preferProjectLocal: config.runtime.managedTools.preferProjectLocal,
|
|
39
|
+
allowNetwork: config.runtime.managedTools.allowNetwork,
|
|
40
|
+
cacheDir: config.runtime.managedTools.cacheDir,
|
|
41
|
+
...runtimeOptions
|
|
42
|
+
})
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -20,4 +20,5 @@ export type ScanPlan = {
|
|
|
20
20
|
changedOnly: boolean;
|
|
21
21
|
outputFull: boolean;
|
|
22
22
|
};
|
|
23
|
+
export declare const QUICK_ADAPTER_IDS: Set<string>;
|
|
23
24
|
export declare function createScanPlan(project: ProjectContext, config: VibeDoctorConfig, adapters: ToolAdapter[], mode: ScanMode): Promise<ScanPlan>;
|
package/dist/core/scanPlanner.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QUICK_ADAPTER_IDS = void 0;
|
|
3
4
|
exports.createScanPlan = createScanPlan;
|
|
4
|
-
|
|
5
|
+
exports.QUICK_ADAPTER_IDS = new Set([
|
|
5
6
|
"ruff",
|
|
6
7
|
"biome",
|
|
7
8
|
"tsc",
|
|
@@ -18,8 +19,6 @@ function disabledReason(adapter, config) {
|
|
|
18
19
|
switch (adapter.category) {
|
|
19
20
|
case "security":
|
|
20
21
|
return checks.security.enabled ? undefined : "checks.security.enabled is false";
|
|
21
|
-
case "correctness":
|
|
22
|
-
return checks.correctness.enabled ? undefined : "checks.correctness.enabled is false";
|
|
23
22
|
case "dead_code":
|
|
24
23
|
return checks.deadCode.enabled ? undefined : "checks.deadCode.enabled is false";
|
|
25
24
|
case "leftovers":
|
|
@@ -33,6 +32,11 @@ function disabledReason(adapter, config) {
|
|
|
33
32
|
return checks.dpdp.enabled ? undefined : "checks.dpdp.enabled is false";
|
|
34
33
|
}
|
|
35
34
|
return checks.privacy.enabled ? undefined : "checks.privacy.enabled is false";
|
|
35
|
+
case "correctness":
|
|
36
|
+
if (adapter.id === "flow-doctor" && checks.flowAnalysis.enabled === false) {
|
|
37
|
+
return "checks.flowAnalysis.enabled is false";
|
|
38
|
+
}
|
|
39
|
+
return checks.correctness.enabled ? undefined : "checks.correctness.enabled is false";
|
|
36
40
|
default:
|
|
37
41
|
return undefined;
|
|
38
42
|
}
|
|
@@ -55,11 +59,11 @@ async function createScanPlan(project, config, adapters, mode) {
|
|
|
55
59
|
});
|
|
56
60
|
continue;
|
|
57
61
|
}
|
|
58
|
-
if (mode === "quick" && !QUICK_ADAPTER_IDS.has(adapter.id)) {
|
|
62
|
+
if (mode === "quick" && !exports.QUICK_ADAPTER_IDS.has(adapter.id)) {
|
|
59
63
|
excluded.push({
|
|
60
64
|
id: adapter.id,
|
|
61
65
|
state: "not_selected",
|
|
62
|
-
reason: "Not part of the quick profile. Run `vibedoctor scan
|
|
66
|
+
reason: "Not part of the quick profile. Run `vibedoctor scan` for the full applicable diagnosis."
|
|
63
67
|
});
|
|
64
68
|
continue;
|
|
65
69
|
}
|
|
@@ -78,6 +82,6 @@ async function createScanPlan(project, config, adapters, mode) {
|
|
|
78
82
|
adapterIds: selected,
|
|
79
83
|
excluded,
|
|
80
84
|
changedOnly: mode === "changed",
|
|
81
|
-
outputFull: mode === "full"
|
|
85
|
+
outputFull: mode === "full" || mode === "default"
|
|
82
86
|
};
|
|
83
87
|
}
|
|
@@ -36,6 +36,12 @@ exports.TOOL_REGISTRY = [
|
|
|
36
36
|
priority: "essential",
|
|
37
37
|
reason: "Finds personal-data and Privacy Review signals without sending data to an external service."
|
|
38
38
|
},
|
|
39
|
+
{
|
|
40
|
+
id: "flow-doctor",
|
|
41
|
+
ecosystem: "built-in",
|
|
42
|
+
priority: "essential",
|
|
43
|
+
reason: "High-confidence structural flow checks: route/method mismatches and swallowed error paths."
|
|
44
|
+
},
|
|
39
45
|
{
|
|
40
46
|
id: "tsc",
|
|
41
47
|
packageName: "typescript",
|
|
@@ -89,7 +95,8 @@ exports.TOOL_REGISTRY = [
|
|
|
89
95
|
languages: ["python"],
|
|
90
96
|
runtime: "python",
|
|
91
97
|
probeArgs: ["--version"],
|
|
92
|
-
reason: "Python lint and safe-fix signal."
|
|
98
|
+
reason: "Python lint and safe-fix signal. VibeDoctor can provision a pinned managed copy.",
|
|
99
|
+
installHint: "VibeDoctor provisions Ruff into ~/.cache/vibedoctor. To pin a project-local copy, install ruff in the environment."
|
|
93
100
|
},
|
|
94
101
|
{
|
|
95
102
|
id: "pyright",
|
|
@@ -152,8 +159,8 @@ exports.TOOL_REGISTRY = [
|
|
|
152
159
|
ecosystem: "manual",
|
|
153
160
|
priority: "essential",
|
|
154
161
|
probeArgs: ["version"],
|
|
155
|
-
reason: "Secret detection across every repository.",
|
|
156
|
-
installHint: "
|
|
162
|
+
reason: "Secret detection across every repository. VibeDoctor can provision a pinned managed copy.",
|
|
163
|
+
installHint: "VibeDoctor provisions Gitleaks into ~/.cache/vibedoctor. To pin a project-local copy, install gitleaks on PATH."
|
|
157
164
|
},
|
|
158
165
|
{
|
|
159
166
|
id: "osv-scanner",
|
|
@@ -162,8 +169,8 @@ exports.TOOL_REGISTRY = [
|
|
|
162
169
|
priority: "essential",
|
|
163
170
|
requiresLockfile: true,
|
|
164
171
|
probeArgs: ["--version"],
|
|
165
|
-
reason: "Known-vulnerability detection for dependency lockfiles.",
|
|
166
|
-
installHint: "
|
|
172
|
+
reason: "Known-vulnerability detection for dependency lockfiles. VibeDoctor can provision a pinned managed copy.",
|
|
173
|
+
installHint: "VibeDoctor provisions OSV-Scanner into ~/.cache/vibedoctor. To pin a project-local copy, install osv-scanner on PATH."
|
|
167
174
|
},
|
|
168
175
|
{
|
|
169
176
|
id: "lizard",
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { buildCommandEnv, getLocalToolSearchPaths } from "./executable";
|
|
2
|
+
import { type ToolRuntime } from "./toolRuntime";
|
|
2
3
|
export { buildCommandEnv, getLocalToolSearchPaths };
|
|
3
4
|
export type CommandSpec = {
|
|
4
5
|
cmd: string;
|
|
6
|
+
/** Request a named engine; ToolRuntime resolves the executable. */
|
|
7
|
+
tool?: string;
|
|
5
8
|
args: string[];
|
|
6
9
|
cwd?: string;
|
|
7
10
|
timeoutMs?: number;
|
|
8
11
|
env?: NodeJS.ProcessEnv;
|
|
12
|
+
runtime?: ToolRuntime;
|
|
9
13
|
};
|
|
10
14
|
export type ToolResult = {
|
|
11
15
|
command: string;
|
package/dist/core/toolRunner.js
CHANGED
|
@@ -14,6 +14,7 @@ const node_child_process_2 = require("node:child_process");
|
|
|
14
14
|
const executable_1 = require("./executable");
|
|
15
15
|
Object.defineProperty(exports, "buildCommandEnv", { enumerable: true, get: function () { return executable_1.buildCommandEnv; } });
|
|
16
16
|
Object.defineProperty(exports, "getLocalToolSearchPaths", { enumerable: true, get: function () { return executable_1.getLocalToolSearchPaths; } });
|
|
17
|
+
const toolRuntime_1 = require("./toolRuntime");
|
|
17
18
|
function commandExistsOnWindowsPath(command, cwd) {
|
|
18
19
|
return (0, executable_1.resolveExecutable)(command, cwd) !== undefined;
|
|
19
20
|
}
|
|
@@ -66,6 +67,23 @@ function quoteForWindowsShell(argument) {
|
|
|
66
67
|
}
|
|
67
68
|
async function runCommand(spec, installHint) {
|
|
68
69
|
const startedAt = Date.now();
|
|
70
|
+
if (spec.tool) {
|
|
71
|
+
const runtime = spec.runtime ?? (0, toolRuntime_1.createToolRuntime)({ projectRoot: spec.cwd });
|
|
72
|
+
const resolvedTool = await runtime.resolve(spec.tool, { projectRoot: spec.cwd });
|
|
73
|
+
if (!resolvedTool.executablePath) {
|
|
74
|
+
const failedHard = resolvedTool.status === "checksum_mismatch" || resolvedTool.status === "failed";
|
|
75
|
+
return {
|
|
76
|
+
command: [spec.tool, ...spec.args].join(" "),
|
|
77
|
+
stdout: "",
|
|
78
|
+
stderr: resolvedTool.reason,
|
|
79
|
+
exitCode: null,
|
|
80
|
+
durationMs: Date.now() - startedAt,
|
|
81
|
+
status: failedHard ? "error" : "skipped",
|
|
82
|
+
installHint: resolvedTool.remediation ?? installHint
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
spec = { ...spec, cmd: resolvedTool.executablePath };
|
|
86
|
+
}
|
|
69
87
|
const env = (0, executable_1.buildCommandEnv)(spec.cwd, spec.env);
|
|
70
88
|
const resolved = resolveLaunchTarget(spec.cmd, spec.cwd, env);
|
|
71
89
|
// Build the shell command line here instead of letting spawn concatenate the
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isManagedTool, type ManagedToolSpec } from "./managedTools";
|
|
2
|
+
export type ToolResolutionStatus = "resolved" | "not_found" | "checksum_mismatch" | "unsupported_platform" | "failed";
|
|
3
|
+
export type ToolResolutionSource = "project-local" | "managed" | "path";
|
|
4
|
+
export type ToolResolution = {
|
|
5
|
+
tool: string;
|
|
6
|
+
status: ToolResolutionStatus;
|
|
7
|
+
source?: ToolResolutionSource;
|
|
8
|
+
version?: string;
|
|
9
|
+
executablePath?: string;
|
|
10
|
+
cachePath?: string;
|
|
11
|
+
reusedCache: boolean;
|
|
12
|
+
reason: string;
|
|
13
|
+
remediation?: string;
|
|
14
|
+
};
|
|
15
|
+
export type ToolRuntimeOptions = {
|
|
16
|
+
cacheDir?: string;
|
|
17
|
+
projectRoot?: string;
|
|
18
|
+
enabled?: boolean;
|
|
19
|
+
allowNetwork?: boolean;
|
|
20
|
+
preferProjectLocal?: boolean;
|
|
21
|
+
allowPathFallback?: boolean;
|
|
22
|
+
/** Test/advanced: replace the catalog for a tool. */
|
|
23
|
+
catalog?: Record<string, ManagedToolSpec>;
|
|
24
|
+
/** Test: copy this local file instead of downloading. */
|
|
25
|
+
localArtifacts?: Record<string, string>;
|
|
26
|
+
fetchArtifact?: (url: string, destFile: string) => Promise<void>;
|
|
27
|
+
};
|
|
28
|
+
export type ToolRuntime = {
|
|
29
|
+
readonly cacheDir: string;
|
|
30
|
+
resolve(tool: string, options?: {
|
|
31
|
+
projectRoot?: string;
|
|
32
|
+
}): Promise<ToolResolution>;
|
|
33
|
+
};
|
|
34
|
+
export declare const DOWNLOAD_TIMEOUT_MS = 45000;
|
|
35
|
+
export declare const MAX_DOWNLOAD_BYTES: number;
|
|
36
|
+
export declare function defaultToolCacheDir(): string;
|
|
37
|
+
export declare function createToolRuntime(options?: ToolRuntimeOptions): ToolRuntime;
|
|
38
|
+
export declare function isProjectLocalPath(candidate: string, projectRoot: string | undefined): boolean;
|
|
39
|
+
export declare function sha256File(filePath: string): Promise<string>;
|
|
40
|
+
export { isManagedTool };
|