@cortexkit/aft 0.25.1 → 0.26.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.
- package/dist/adapters/pi.d.ts.map +1 -1
- package/dist/commands/doctor.d.ts +3 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/index.js +117 -55
- package/dist/lib/binary-probe.d.ts +2 -3
- package/dist/lib/binary-probe.d.ts.map +1 -1
- package/dist/lib/diagnostics.d.ts.map +1 -1
- package/dist/lib/github.d.ts +1 -0
- package/dist/lib/github.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAmIpB,qBAAa,SAAU,YAAW,cAAc;IAC9C,QAAQ,CAAC,IAAI,EAAG,IAAI,CAAU;IAC9B,QAAQ,CAAC,WAAW,QAAQ;IAC5B,QAAQ,CAAC,iBAAiB,uBAAe;IACzC,QAAQ,CAAC,sBAAsB,2BAAgB;IAE/C,WAAW,IAAI,OAAO;IAStB,cAAc,IAAI,MAAM,GAAG,IAAI;IAuB/B,iBAAiB,IAAI,kBAAkB;IAevC,cAAc,IAAI,OAAO;IAInB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAmCrD,kBAAkB,IAAI,eAAe;IA6BrC,aAAa,IAAI,MAAM;IAKvB,UAAU,IAAI,MAAM;IAIpB,cAAc,IAAI,MAAM;IAIlB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;QAC/C,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,gBAAgB,GAAG,OAAO,CAAC;QAC5E,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAUF,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAUlD"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { HarnessAdapter } from "../adapters/types.js";
|
|
2
|
+
import { type DiagnosticReport } from "../lib/diagnostics.js";
|
|
2
3
|
import { type ClearResult } from "../lib/lsp-cache.js";
|
|
3
4
|
export type DoctorClearTarget = "plugin-cache" | "lsp-cache" | "binary-cache";
|
|
4
5
|
export declare const DOCTOR_CLEAR_TARGET_OPTIONS: {
|
|
@@ -36,6 +37,7 @@ export interface CacheClearOptions {
|
|
|
36
37
|
includePluginBytes?: boolean;
|
|
37
38
|
}
|
|
38
39
|
export declare function runDoctor(options: DoctorOptions): Promise<number>;
|
|
40
|
+
export declare function hasDoctorProblems(report: DiagnosticReport): boolean;
|
|
39
41
|
export declare function clearDoctorCaches(adapters: HarnessAdapter[], targets: readonly DoctorClearTarget[], options?: CacheClearOptions): Promise<CacheClearSummary>;
|
|
40
42
|
/**
|
|
41
43
|
* Clear cached `aft` binaries except the version this CLI ships with.
|
|
@@ -58,4 +60,5 @@ export interface BinaryCacheClearResult {
|
|
|
58
60
|
keptVersion: string | null;
|
|
59
61
|
}
|
|
60
62
|
export declare function clearOldBinaries(): BinaryCacheClearResult;
|
|
63
|
+
export declare function fixPluginEntries(adapters: HarnessAdapter[]): Promise<void>;
|
|
61
64
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"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,EAAE,MAAM,WAAW,CAAC;IACnC,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAsGvE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CAWnE;AA4BD,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,cAAc,EAAE,EAC1B,OAAO,EAAE,SAAS,iBAAiB,EAAE,EACrC,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAgD5B;AAED;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,gBAAgB,IAAI,sBAAsB,CAsDzD;AAyFD,wBAAsB,gBAAgB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhF"}
|
package/dist/index.js
CHANGED
|
@@ -8208,10 +8208,8 @@ function readPiExtensionIndex() {
|
|
|
8208
8208
|
if (!existsSync4(path))
|
|
8209
8209
|
continue;
|
|
8210
8210
|
try {
|
|
8211
|
-
const
|
|
8212
|
-
const
|
|
8213
|
-
const value = JSON.parse(trimmed);
|
|
8214
|
-
const extensions = value.extensions ?? value.plugins ?? [];
|
|
8211
|
+
const { value } = readJsoncFile(path);
|
|
8212
|
+
const extensions = value?.extensions ?? value?.plugins ?? [];
|
|
8215
8213
|
if (Array.isArray(extensions)) {
|
|
8216
8214
|
const installed = extensions.map((e) => typeof e === "string" ? e : typeof e?.name === "string" ? e.name : "").filter((name) => name.length > 0);
|
|
8217
8215
|
return { installed, path };
|
|
@@ -10047,7 +10045,7 @@ var MAX_NOISE_LINES_IN_ERROR = 5;
|
|
|
10047
10045
|
var init_aft_bridge = () => {};
|
|
10048
10046
|
|
|
10049
10047
|
// src/lib/binary-probe.ts
|
|
10050
|
-
import { execSync as execSync3 } from "node:child_process";
|
|
10048
|
+
import { execSync as execSync3, spawnSync as spawnSync2 } from "node:child_process";
|
|
10051
10049
|
import { existsSync as existsSync5 } from "node:fs";
|
|
10052
10050
|
import { createRequire as createRequire2 } from "node:module";
|
|
10053
10051
|
import { homedir as homedir4 } from "node:os";
|
|
@@ -10059,29 +10057,37 @@ function normalizeVersion(output) {
|
|
|
10059
10057
|
return trimmed.replace(/^aft\s+/, "");
|
|
10060
10058
|
}
|
|
10061
10059
|
function probeBinaryVersion(preferredVersion) {
|
|
10062
|
-
const
|
|
10063
|
-
if (
|
|
10064
|
-
|
|
10065
|
-
candidates.push(join5(getAftBinaryCacheDir(), tag, getAftBinaryName()));
|
|
10066
|
-
}
|
|
10060
|
+
const candidate = findAftBinary(preferredVersion);
|
|
10061
|
+
if (!candidate)
|
|
10062
|
+
return null;
|
|
10067
10063
|
try {
|
|
10068
|
-
|
|
10069
|
-
|
|
10070
|
-
|
|
10071
|
-
|
|
10072
|
-
|
|
10073
|
-
|
|
10064
|
+
if (!existsSync5(candidate))
|
|
10065
|
+
return null;
|
|
10066
|
+
const result = spawnSync2(candidate, ["--version"], {
|
|
10067
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
10068
|
+
encoding: "utf-8"
|
|
10069
|
+
});
|
|
10070
|
+
if (result.error || result.status !== 0)
|
|
10071
|
+
return null;
|
|
10072
|
+
const output = `${result.stdout ?? ""}
|
|
10073
|
+
${result.stderr ?? ""}`;
|
|
10074
|
+
return normalizeVersion(output);
|
|
10075
|
+
} catch {
|
|
10076
|
+
return null;
|
|
10077
|
+
}
|
|
10078
|
+
}
|
|
10079
|
+
function pushCandidate(candidates, candidate) {
|
|
10080
|
+
if (!candidate)
|
|
10081
|
+
return;
|
|
10082
|
+
if (!candidates.includes(candidate))
|
|
10083
|
+
candidates.push(candidate);
|
|
10084
|
+
}
|
|
10085
|
+
function firstExisting(candidates) {
|
|
10074
10086
|
for (const candidate of candidates) {
|
|
10075
10087
|
try {
|
|
10076
10088
|
if (!existsSync5(candidate))
|
|
10077
10089
|
continue;
|
|
10078
|
-
|
|
10079
|
-
stdio: "pipe",
|
|
10080
|
-
encoding: "utf-8"
|
|
10081
|
-
});
|
|
10082
|
-
const version = normalizeVersion(output);
|
|
10083
|
-
if (version)
|
|
10084
|
-
return version;
|
|
10090
|
+
return candidate;
|
|
10085
10091
|
} catch {}
|
|
10086
10092
|
}
|
|
10087
10093
|
return null;
|
|
@@ -10098,28 +10104,24 @@ function findAftBinary(preferredVersion) {
|
|
|
10098
10104
|
const candidates = [];
|
|
10099
10105
|
if (preferredVersion) {
|
|
10100
10106
|
const tag = preferredVersion.startsWith("v") ? preferredVersion : `v${preferredVersion}`;
|
|
10101
|
-
candidates
|
|
10107
|
+
pushCandidate(candidates, join5(getAftBinaryCacheDir(), tag, getAftBinaryName()));
|
|
10102
10108
|
}
|
|
10103
10109
|
const key = platformKey();
|
|
10104
10110
|
if (key) {
|
|
10105
10111
|
try {
|
|
10106
10112
|
const require2 = createRequire2(import.meta.url);
|
|
10107
|
-
candidates
|
|
10113
|
+
pushCandidate(candidates, require2.resolve(`@cortexkit/aft-${key}/bin/${getAftBinaryName()}`));
|
|
10108
10114
|
} catch {}
|
|
10109
10115
|
}
|
|
10110
10116
|
try {
|
|
10111
10117
|
const lookup = process.platform === "win32" ? "where aft" : "which aft";
|
|
10112
10118
|
const resolved = execSync3(lookup, { stdio: "pipe", encoding: "utf-8" }).trim();
|
|
10113
10119
|
if (resolved) {
|
|
10114
|
-
candidates
|
|
10120
|
+
pushCandidate(candidates, resolved.split(/\r?\n/)[0]);
|
|
10115
10121
|
}
|
|
10116
10122
|
} catch {}
|
|
10117
|
-
candidates
|
|
10118
|
-
|
|
10119
|
-
if (existsSync5(candidate))
|
|
10120
|
-
return candidate;
|
|
10121
|
-
}
|
|
10122
|
-
return null;
|
|
10123
|
+
pushCandidate(candidates, join5(homedir4(), ".cargo", "bin", getAftBinaryName()));
|
|
10124
|
+
return firstExisting(candidates);
|
|
10123
10125
|
}
|
|
10124
10126
|
var init_binary_probe = __esm(() => {
|
|
10125
10127
|
init_paths();
|
|
@@ -10874,7 +10876,7 @@ function sanitizeValue(value) {
|
|
|
10874
10876
|
var init_sanitize = () => {};
|
|
10875
10877
|
|
|
10876
10878
|
// src/lib/diagnostics.ts
|
|
10877
|
-
import { existsSync as existsSync11,
|
|
10879
|
+
import { closeSync, existsSync as existsSync11, openSync, readSync, statSync as statSync7 } from "node:fs";
|
|
10878
10880
|
async function collectDiagnostics(adapters) {
|
|
10879
10881
|
const cliVersion = getSelfVersion();
|
|
10880
10882
|
const binaryVersion = probeBinaryVersion(cliVersion);
|
|
@@ -10901,7 +10903,7 @@ async function diagnoseHarness(adapter) {
|
|
|
10901
10903
|
const storage = adapter.getStorageDir();
|
|
10902
10904
|
const logPath = adapter.getLogFile();
|
|
10903
10905
|
const describeStorage = "describeStorageSubtrees" in adapter && typeof adapter.describeStorageSubtrees === "function" ? adapter.describeStorageSubtrees() : {};
|
|
10904
|
-
const semanticEnabled = aftConfigRead.value?.experimental_semantic_search === true;
|
|
10906
|
+
const semanticEnabled = aftConfigRead.value?.semantic_search === true || aftConfigRead.value?.experimental_semantic_search === true;
|
|
10905
10907
|
const systemOrtDir = findSystemOnnxRuntime();
|
|
10906
10908
|
const cachedOrtDir = findCachedOnnxRuntime(storage);
|
|
10907
10909
|
const systemVersion = systemOrtDir ? detectOrtVersion(systemOrtDir) : null;
|
|
@@ -11002,12 +11004,38 @@ function renderDiagnosticsMarkdown(report) {
|
|
|
11002
11004
|
function tailLogFile(path, lines) {
|
|
11003
11005
|
if (!existsSync11(path))
|
|
11004
11006
|
return "";
|
|
11007
|
+
if (lines <= 0)
|
|
11008
|
+
return "";
|
|
11009
|
+
const chunkSize = 64 * 1024;
|
|
11010
|
+
let fd = null;
|
|
11005
11011
|
try {
|
|
11006
|
-
const
|
|
11007
|
-
|
|
11012
|
+
const size = statSync7(path).size;
|
|
11013
|
+
fd = openSync(path, "r");
|
|
11014
|
+
const chunks = [];
|
|
11015
|
+
let position = size;
|
|
11016
|
+
let newlineCount = 0;
|
|
11017
|
+
while (position > 0 && newlineCount <= lines) {
|
|
11018
|
+
const readLength = Math.min(chunkSize, position);
|
|
11019
|
+
position -= readLength;
|
|
11020
|
+
const buffer = Buffer.allocUnsafe(readLength);
|
|
11021
|
+
const bytesRead = readSync(fd, buffer, 0, readLength, position);
|
|
11022
|
+
const chunk = bytesRead === readLength ? buffer : buffer.subarray(0, bytesRead);
|
|
11023
|
+
chunks.unshift(chunk);
|
|
11024
|
+
for (let i = chunk.length - 1;i >= 0; i -= 1) {
|
|
11025
|
+
if (chunk[i] === 10)
|
|
11026
|
+
newlineCount += 1;
|
|
11027
|
+
}
|
|
11028
|
+
}
|
|
11029
|
+
return Buffer.concat(chunks).toString("utf-8").trimEnd().split(/\r?\n/).slice(-lines).join(`
|
|
11008
11030
|
`).trim();
|
|
11009
11031
|
} catch {
|
|
11010
11032
|
return "";
|
|
11033
|
+
} finally {
|
|
11034
|
+
if (fd !== null) {
|
|
11035
|
+
try {
|
|
11036
|
+
closeSync(fd);
|
|
11037
|
+
} catch {}
|
|
11038
|
+
}
|
|
11011
11039
|
}
|
|
11012
11040
|
}
|
|
11013
11041
|
var init_diagnostics = __esm(() => {
|
|
@@ -11021,7 +11049,7 @@ var init_diagnostics = __esm(() => {
|
|
|
11021
11049
|
});
|
|
11022
11050
|
|
|
11023
11051
|
// src/lib/github.ts
|
|
11024
|
-
import { execSync as execSync4, spawnSync as
|
|
11052
|
+
import { execSync as execSync4, spawnSync as spawnSync3 } from "node:child_process";
|
|
11025
11053
|
function isGhInstalled() {
|
|
11026
11054
|
try {
|
|
11027
11055
|
execSync4("gh --version", { stdio: "ignore" });
|
|
@@ -11030,18 +11058,21 @@ function isGhInstalled() {
|
|
|
11030
11058
|
return false;
|
|
11031
11059
|
}
|
|
11032
11060
|
}
|
|
11061
|
+
function getOpenBrowserCommand(url, platform = process.platform) {
|
|
11062
|
+
return platform === "darwin" ? ["open", [url]] : platform === "win32" ? ["explorer.exe", [url]] : ["xdg-open", [url]];
|
|
11063
|
+
}
|
|
11033
11064
|
function openBrowser(url) {
|
|
11034
|
-
const commands =
|
|
11065
|
+
const commands = getOpenBrowserCommand(url);
|
|
11035
11066
|
try {
|
|
11036
11067
|
const [cmd, args] = commands;
|
|
11037
|
-
|
|
11068
|
+
spawnSync3(cmd, args, { stdio: "ignore" });
|
|
11038
11069
|
} catch {}
|
|
11039
11070
|
}
|
|
11040
11071
|
function createGitHubIssue(repo, title, body) {
|
|
11041
11072
|
if (!isGhInstalled()) {
|
|
11042
11073
|
return { url: null, stderr: "gh CLI not installed" };
|
|
11043
11074
|
}
|
|
11044
|
-
const result =
|
|
11075
|
+
const result = spawnSync3("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
|
|
11045
11076
|
input: body,
|
|
11046
11077
|
encoding: "utf-8",
|
|
11047
11078
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -11144,6 +11175,8 @@ var init_onnx_fix = __esm(() => {
|
|
|
11144
11175
|
var exports_doctor = {};
|
|
11145
11176
|
__export(exports_doctor, {
|
|
11146
11177
|
runDoctor: () => runDoctor,
|
|
11178
|
+
hasDoctorProblems: () => hasDoctorProblems,
|
|
11179
|
+
fixPluginEntries: () => fixPluginEntries,
|
|
11147
11180
|
clearOldBinaries: () => clearOldBinaries,
|
|
11148
11181
|
clearDoctorCaches: () => clearDoctorCaches,
|
|
11149
11182
|
DOCTOR_FORCE_CLEAR_TARGETS: () => DOCTOR_FORCE_CLEAR_TARGETS,
|
|
@@ -11174,22 +11207,21 @@ async function runDoctor(options) {
|
|
|
11174
11207
|
if (npmCount + ghCount > 0) {
|
|
11175
11208
|
O2.info(`LSP cache: ${npmCount} npm + ${ghCount} github install(s), ${formatBytes(report.lspCache.totalSize)} total`);
|
|
11176
11209
|
}
|
|
11177
|
-
|
|
11210
|
+
const hadProblems = hasDoctorProblems(report);
|
|
11178
11211
|
for (const h of report.harnesses) {
|
|
11179
11212
|
O2.step(`${h.displayName}`);
|
|
11180
11213
|
if (!h.hostInstalled) {
|
|
11181
11214
|
O2.warn(` host not installed — install from: ${describeAdapterInstallHint(h.kind)}`);
|
|
11182
|
-
hadProblems = true;
|
|
11183
11215
|
continue;
|
|
11184
11216
|
}
|
|
11185
11217
|
O2.info(` host: ${h.hostVersion ?? "unknown version"}`);
|
|
11186
11218
|
O2.info(` plugin registered: ${h.pluginRegistered ? "yes" : "no"}`);
|
|
11187
|
-
if (!h.pluginRegistered)
|
|
11188
|
-
|
|
11219
|
+
if (!h.pluginRegistered) {
|
|
11220
|
+
O2.warn(" plugin registration can be fixed with `aft setup` or `aft doctor --fix`");
|
|
11221
|
+
}
|
|
11189
11222
|
O2.info(` aft config: ${h.aftConfig.exists ? h.configPaths.aftConfig : "(not set)"}`);
|
|
11190
11223
|
if (h.aftConfig.parseError) {
|
|
11191
11224
|
O2.error(` aft config parse error: ${h.aftConfig.parseError}`);
|
|
11192
|
-
hadProblems = true;
|
|
11193
11225
|
}
|
|
11194
11226
|
O2.info(` storage: ${h.storageDir.exists ? h.storageDir.path : "(not created)"} (${formatStorageSizes(h.storageDir.sizesByKey)})`);
|
|
11195
11227
|
if (h.onnxRuntime.required) {
|
|
@@ -11203,26 +11235,46 @@ async function runDoctor(options) {
|
|
|
11203
11235
|
}
|
|
11204
11236
|
if (!h.onnxRuntime.cachedPath && !h.onnxRuntime.systemPath) {
|
|
11205
11237
|
parts.push(`not installed — ${h.onnxRuntime.installHint}`);
|
|
11206
|
-
|
|
11238
|
+
}
|
|
11239
|
+
if (h.onnxRuntime.cachedCompatible === false || h.onnxRuntime.systemCompatible === false) {
|
|
11240
|
+
parts.push("needs reinstall — run `aft doctor --fix`");
|
|
11207
11241
|
}
|
|
11208
11242
|
O2.info(` onnx runtime: ${parts.join(" · ")}`);
|
|
11243
|
+
} else {
|
|
11244
|
+
O2.info(" onnx runtime: not required (semantic search disabled; ignoring ONNX status)");
|
|
11209
11245
|
}
|
|
11210
11246
|
O2.info(` log: ${h.logFile.exists ? `${h.logFile.path} (${h.logFile.sizeKb} KB)` : "(not written yet)"}`);
|
|
11211
11247
|
}
|
|
11212
11248
|
if (options.force) {
|
|
11213
11249
|
await clearDoctorCaches(adapters, DOCTOR_FORCE_CLEAR_TARGETS, { includePluginBytes: false });
|
|
11214
11250
|
}
|
|
11215
|
-
for (const adapter of adapters) {
|
|
11216
|
-
await maybeFixPlugin(adapter);
|
|
11217
|
-
}
|
|
11218
11251
|
if (hadProblems) {
|
|
11219
|
-
wt("Run `aft setup` to register AFT with any harness showing `plugin registered: no`.", "Tips");
|
|
11252
|
+
wt("Run `aft setup` or `aft doctor --fix` to register AFT with any harness showing `plugin registered: no`. Run `aft doctor --fix` for ONNX Runtime issues.", "Tips");
|
|
11220
11253
|
gt("Done — some issues found.");
|
|
11221
11254
|
return 1;
|
|
11222
11255
|
}
|
|
11223
11256
|
gt("Everything looks good.");
|
|
11224
11257
|
return 0;
|
|
11225
11258
|
}
|
|
11259
|
+
function hasDoctorProblems(report) {
|
|
11260
|
+
return report.harnesses.some((h) => {
|
|
11261
|
+
if (!h.hostInstalled)
|
|
11262
|
+
return true;
|
|
11263
|
+
if (!h.pluginRegistered)
|
|
11264
|
+
return true;
|
|
11265
|
+
if (h.aftConfig.parseError)
|
|
11266
|
+
return true;
|
|
11267
|
+
if (!h.onnxRuntime.required)
|
|
11268
|
+
return false;
|
|
11269
|
+
if (!h.onnxRuntime.cachedPath && !h.onnxRuntime.systemPath)
|
|
11270
|
+
return true;
|
|
11271
|
+
if (h.onnxRuntime.cachedCompatible === false)
|
|
11272
|
+
return true;
|
|
11273
|
+
if (h.onnxRuntime.systemCompatible === false)
|
|
11274
|
+
return true;
|
|
11275
|
+
return false;
|
|
11276
|
+
});
|
|
11277
|
+
}
|
|
11226
11278
|
async function runClearFlow(argv) {
|
|
11227
11279
|
const targets = await selectMany("What do you want to clear?", DOCTOR_CLEAR_TARGET_OPTIONS, undefined, false);
|
|
11228
11280
|
if (targets.length === 0) {
|
|
@@ -11331,16 +11383,21 @@ async function runFixFlow(argv) {
|
|
|
11331
11383
|
});
|
|
11332
11384
|
O2.info("Running diagnostics to identify auto-fixable issues…");
|
|
11333
11385
|
const report = await collectDiagnostics(adapters);
|
|
11386
|
+
await fixPluginEntries(adapters);
|
|
11334
11387
|
const onnxResult = await runOnnxFix(adapters, report);
|
|
11335
11388
|
if (onnxResult === null) {
|
|
11336
11389
|
O2.info("No auto-fixable issues detected.");
|
|
11337
11390
|
wt("If you're still seeing 'Semantic Index: failed' in the TUI sidebar, run " + "`aft doctor` (without --fix) for a full diagnostic dump.", "Tip");
|
|
11338
|
-
|
|
11339
|
-
|
|
11391
|
+
const afterReport2 = await collectDiagnostics(adapters);
|
|
11392
|
+
const stillHasProblems2 = hasDoctorProblems(afterReport2);
|
|
11393
|
+
gt(stillHasProblems2 ? "Done — some issues remain." : "Done.");
|
|
11394
|
+
return stillHasProblems2 ? 1 : 0;
|
|
11340
11395
|
}
|
|
11341
11396
|
const hadErrors = onnxResult.errors.length > 0;
|
|
11342
|
-
|
|
11343
|
-
|
|
11397
|
+
const afterReport = await collectDiagnostics(adapters);
|
|
11398
|
+
const stillHasProblems = hasDoctorProblems(afterReport);
|
|
11399
|
+
gt(hadErrors ? "Done — some fixes failed." : stillHasProblems ? "Done — some issues remain." : "Done.");
|
|
11400
|
+
return hadErrors || stillHasProblems ? 1 : 0;
|
|
11344
11401
|
}
|
|
11345
11402
|
async function clearPluginCache(adapter, includeBytes) {
|
|
11346
11403
|
const info = adapter.getPluginCacheInfo();
|
|
@@ -11375,6 +11432,11 @@ function reportLspCacheClear(cleanup) {
|
|
|
11375
11432
|
O2.error(`LSP install cache: failed to remove ${err.path}: ${err.error}`);
|
|
11376
11433
|
}
|
|
11377
11434
|
}
|
|
11435
|
+
async function fixPluginEntries(adapters) {
|
|
11436
|
+
for (const adapter of adapters) {
|
|
11437
|
+
await maybeFixPlugin(adapter);
|
|
11438
|
+
}
|
|
11439
|
+
}
|
|
11378
11440
|
async function maybeFixPlugin(adapter) {
|
|
11379
11441
|
if (!adapter.hasPluginEntry() && adapter.isInstalled()) {
|
|
11380
11442
|
O2.info(`${adapter.displayName}: attempting to register plugin…`);
|
|
@@ -11438,7 +11500,7 @@ ${tail || "<no log output>"}
|
|
|
11438
11500
|
].join(`
|
|
11439
11501
|
`);
|
|
11440
11502
|
const body = sanitizeContent(rawBody);
|
|
11441
|
-
const title = `AFT issue: ${description.slice(0, 72)}
|
|
11503
|
+
const title = sanitizeContent(`AFT issue: ${description.slice(0, 72)}`);
|
|
11442
11504
|
const outPath = join11(process.cwd(), `aft-issue-${Date.now()}.md`);
|
|
11443
11505
|
writeFileSync2(outPath, `${body}
|
|
11444
11506
|
`);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Probe `aft --version` from
|
|
3
|
-
*
|
|
4
|
-
* 2. PATH (via `which`/`where`)
|
|
2
|
+
* Probe `aft --version` from the same prioritized candidate locations used by
|
|
3
|
+
* `findAftBinary()` (cache, npm platform package, PATH, cargo fallback).
|
|
5
4
|
*
|
|
6
5
|
* Returns the first successfully reported version, or null if nothing
|
|
7
6
|
* resolves. Errors and missing files are swallowed — callers get a signal,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"binary-probe.d.ts","sourceRoot":"","sources":["../../src/lib/binary-probe.ts"],"names":[],"mappings":"AAaA
|
|
1
|
+
{"version":3,"file":"binary-probe.d.ts","sourceRoot":"","sources":["../../src/lib/binary-probe.ts"],"names":[],"mappings":"AAaA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,G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E,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,OAAO,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,OAAO,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;CACH;AAED,wBAAsB,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAoB9F;AAiED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAkE1E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CA0C/D"}
|
package/dist/lib/github.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export declare function isGhInstalled(): boolean;
|
|
2
|
+
export declare function getOpenBrowserCommand(url: string, platform?: NodeJS.Platform): [string, string[]];
|
|
2
3
|
export declare function openBrowser(url: string): void;
|
|
3
4
|
/**
|
|
4
5
|
* Create a GitHub issue via `gh issue create`. Returns the issue URL on
|
package/dist/lib/github.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/lib/github.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,IAAI,OAAO,CAOvC;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../src/lib/github.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,IAAI,OAAO,CAOvC;AAED,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,EACX,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAMpB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAS7C;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GACX;IAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAqBzC"}
|
package/package.json
CHANGED