@cortexkit/aft 0.16.1 → 0.17.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,34 @@
1
+ import type { HarnessAdapter } from "../adapters/types.js";
2
+ import { type ClearResult } from "../lib/lsp-cache.js";
3
+ export type DoctorClearTarget = "plugin-cache" | "lsp-cache";
4
+ export declare const DOCTOR_CLEAR_TARGET_OPTIONS: {
5
+ label: string;
6
+ value: DoctorClearTarget;
7
+ }[];
8
+ export declare const DOCTOR_FORCE_CLEAR_TARGETS: DoctorClearTarget[];
1
9
  export interface DoctorOptions {
10
+ clear: boolean;
2
11
  force: boolean;
3
12
  issue: boolean;
4
13
  argv: string[];
5
14
  }
15
+ export interface CacheClearSummary {
16
+ hadErrors: boolean;
17
+ pluginCache?: {
18
+ cleared: number;
19
+ totalBytes: number;
20
+ errors: number;
21
+ };
22
+ lspCache?: {
23
+ cleared: number;
24
+ totalBytes: number;
25
+ errors: number;
26
+ };
27
+ }
28
+ export interface CacheClearOptions {
29
+ clearLspCaches?: () => ClearResult;
30
+ includePluginBytes?: boolean;
31
+ }
6
32
  export declare function runDoctor(options: DoctorOptions): Promise<number>;
33
+ export declare function clearDoctorCaches(adapters: HarnessAdapter[], targets: readonly DoctorClearTarget[], options?: CacheClearOptions): Promise<CacheClearSummary>;
7
34
  //# sourceMappingURL=doctor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,CAgFvE"}
1
+ {"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts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-bridge.js";
2
+ import { sendAftRequests } from "../lib/aft-bridge.js";
3
+ import { findAftBinary } from "../lib/binary-probe.js";
4
+ import { resolveAdaptersForCommand } from "../lib/harness-select.js";
5
+ export interface LspDoctorOptions {
6
+ argv: string[];
7
+ sendRequest?: typeof sendAftRequest;
8
+ sendRequests?: typeof sendAftRequests;
9
+ findBinary?: typeof findAftBinary;
10
+ resolveAdapters?: typeof resolveAdaptersForCommand;
11
+ }
12
+ export interface LspInspectResponse {
13
+ success: boolean;
14
+ code?: string;
15
+ message?: string;
16
+ file?: string;
17
+ extension?: string;
18
+ project_root?: string | null;
19
+ experimental_lsp_ty?: boolean;
20
+ disabled_lsp?: string[];
21
+ lsp_paths_extra?: string[];
22
+ matching_servers?: LspServerInspection[];
23
+ diagnostics_count?: number;
24
+ diagnostics?: LspDiagnostic[];
25
+ }
26
+ export interface LspServerInspection {
27
+ id: string;
28
+ name: string;
29
+ kind: string;
30
+ extensions: string[];
31
+ root_markers: string[];
32
+ binary_name: string;
33
+ binary_path: string | null;
34
+ binary_source: "path" | "lsp_paths_extra" | "project_node_modules" | "not_found" | string;
35
+ workspace_root: string | null;
36
+ spawn_status: string;
37
+ args: string[];
38
+ }
39
+ export interface LspDiagnostic {
40
+ file: string;
41
+ line: number;
42
+ column: number;
43
+ end_line?: number;
44
+ end_column?: number;
45
+ severity: string;
46
+ message: string;
47
+ code?: string | null;
48
+ source?: string | null;
49
+ }
50
+ export declare function printLspDoctorHelp(): void;
51
+ export declare function runLspDoctor(options: LspDoctorOptions): Promise<number>;
52
+ export declare function renderLspInspection(inputFile: string, response: LspInspectResponse): string;
53
+ //# sourceMappingURL=lsp.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lsp.d.ts","sourceRoot":"","sources":["../../src/commands/lsp.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAc,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC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;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,wBAAgB,kBAAkB,IAAI,IAAI,CAIzC;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0D7E;AAED,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,MAAM,CAmD3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,QAAA,MAAM,OAAO,QAAkB,CAAC;AAChC,QAAA,MAAM,IAAI,UAAwB,CAAC;AAEnC,iBAAS,SAAS,IAAI,IAAI,CAqBzB;AAED,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAarC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,QAAA,MAAM,OAAO,QAAkB,CAAC;AAChC,QAAA,MAAM,IAAI,UAAwB,CAAC;AAEnC,iBAAS,SAAS,IAAI,IAAI,CAwBzB;AAED,iBAAe,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAkBrC"}
package/dist/index.js CHANGED
@@ -7892,6 +7892,30 @@ function getAftBinaryCacheDir() {
7892
7892
  function getAftBinaryName() {
7893
7893
  return process.platform === "win32" ? "aft.exe" : "aft";
7894
7894
  }
7895
+ function getAftLspPackagesDir() {
7896
+ if (process.env.AFT_CACHE_DIR) {
7897
+ return join2(process.env.AFT_CACHE_DIR, "lsp-packages");
7898
+ }
7899
+ if (process.platform === "win32") {
7900
+ const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
7901
+ const base2 = localAppData || join2(homedir(), "AppData", "Local");
7902
+ return join2(base2, "aft", "lsp-packages");
7903
+ }
7904
+ const base = process.env.XDG_CACHE_HOME || join2(homedir(), ".cache");
7905
+ return join2(base, "aft", "lsp-packages");
7906
+ }
7907
+ function getAftLspBinariesDir() {
7908
+ if (process.env.AFT_CACHE_DIR) {
7909
+ return join2(process.env.AFT_CACHE_DIR, "lsp-binaries");
7910
+ }
7911
+ if (process.platform === "win32") {
7912
+ const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
7913
+ const base2 = localAppData || join2(homedir(), "AppData", "Local");
7914
+ return join2(base2, "aft", "lsp-binaries");
7915
+ }
7916
+ const base = process.env.XDG_CACHE_HOME || join2(homedir(), ".cache");
7917
+ return join2(base, "aft", "lsp-binaries");
7918
+ }
7895
7919
  function getTmpLogPath(filename) {
7896
7920
  return join2(tmpdir(), filename);
7897
7921
  }
@@ -9607,13 +9631,13 @@ async function selectOne(message, options) {
9607
9631
  handleCancel(result);
9608
9632
  return result;
9609
9633
  }
9610
- async function selectMany(message, options, initialValues) {
9634
+ async function selectMany(message, options, initialValues, required = true) {
9611
9635
  const clackOptions = options.map((option) => option.hint === undefined ? { label: option.label, value: option.value } : { label: option.label, value: option.value, hint: option.hint });
9612
9636
  const result = await yt({
9613
9637
  message,
9614
9638
  options: clackOptions,
9615
9639
  ...initialValues ? { initialValues } : {},
9616
- required: true
9640
+ required
9617
9641
  });
9618
9642
  handleCancel(result);
9619
9643
  return result;
@@ -9757,44 +9781,79 @@ var init_setup = __esm(() => {
9757
9781
  init_prompts();
9758
9782
  });
9759
9783
 
9760
- // src/lib/binary-cache.ts
9761
- import { existsSync as existsSync5, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
9762
- import { join as join5 } from "node:path";
9763
- function getBinaryCacheInfo(activeVersion) {
9764
- const path = getAftBinaryCacheDir();
9765
- if (!existsSync5(path)) {
9766
- return {
9767
- versions: [],
9768
- activeVersion: null,
9769
- totalSize: 0,
9770
- path
9784
+ // src/lib/aft-bridge.ts
9785
+ import { spawn } from "node:child_process";
9786
+ async function sendAftRequests(binaryPath, requests) {
9787
+ return new Promise((resolve2, reject) => {
9788
+ const child = spawn(binaryPath, [], {
9789
+ stdio: ["pipe", "pipe", "pipe"]
9790
+ });
9791
+ const responses = [];
9792
+ let stdout = "";
9793
+ let stderr = "";
9794
+ let settled = false;
9795
+ const finish = (fn) => {
9796
+ if (settled)
9797
+ return;
9798
+ settled = true;
9799
+ child.kill();
9800
+ fn();
9771
9801
  };
9772
- }
9773
- const versions = readdirSync2(path).filter((entry) => {
9774
- try {
9775
- return statSync2(join5(path, entry)).isDirectory();
9776
- } catch {
9777
- return false;
9802
+ const handleLine = (line) => {
9803
+ if (!line)
9804
+ return;
9805
+ try {
9806
+ responses.push(JSON.parse(line));
9807
+ } catch (error) {
9808
+ finish(() => reject(error));
9809
+ return;
9810
+ }
9811
+ if (responses.length === requests.length) {
9812
+ finish(() => resolve2(responses));
9813
+ }
9814
+ };
9815
+ child.stdout.setEncoding("utf-8");
9816
+ child.stdout.on("data", (chunk) => {
9817
+ stdout += chunk;
9818
+ while (true) {
9819
+ const newline = stdout.indexOf(`
9820
+ `);
9821
+ if (newline === -1)
9822
+ break;
9823
+ const line = stdout.slice(0, newline).trim();
9824
+ stdout = stdout.slice(newline + 1);
9825
+ handleLine(line);
9826
+ if (settled)
9827
+ break;
9828
+ }
9829
+ });
9830
+ child.stderr.setEncoding("utf-8");
9831
+ child.stderr.on("data", (chunk) => {
9832
+ stderr += chunk;
9833
+ });
9834
+ child.on("error", (error) => {
9835
+ finish(() => reject(error));
9836
+ });
9837
+ child.on("exit", (code) => {
9838
+ if (settled)
9839
+ return;
9840
+ finish(() => reject(new Error(`aft exited before responding (code ${code}): ${stderr.trim()}`)));
9841
+ });
9842
+ for (const request of requests) {
9843
+ child.stdin.write(`${JSON.stringify(request)}
9844
+ `);
9778
9845
  }
9779
- }).sort(compareVersionLabels);
9780
- const tag = activeVersion ? activeVersion.startsWith("v") ? activeVersion : `v${activeVersion}` : null;
9781
- const resolvedActive = tag && versions.includes(tag) ? tag : null;
9782
- return {
9783
- versions,
9784
- activeVersion: resolvedActive,
9785
- totalSize: dirSize(path),
9786
- path
9787
- };
9846
+ child.stdin.end();
9847
+ });
9788
9848
  }
9789
- var init_binary_cache = __esm(() => {
9790
- init_fs_util();
9791
- init_paths();
9792
- });
9849
+ var init_aft_bridge = () => {};
9793
9850
 
9794
9851
  // src/lib/binary-probe.ts
9795
9852
  import { execSync as execSync3 } from "node:child_process";
9796
- import { existsSync as existsSync6 } from "node:fs";
9797
- import { join as join6 } from "node:path";
9853
+ import { existsSync as existsSync5 } from "node:fs";
9854
+ import { createRequire as createRequire2 } from "node:module";
9855
+ import { homedir as homedir4 } from "node:os";
9856
+ import { join as join5 } from "node:path";
9798
9857
  function normalizeVersion(output) {
9799
9858
  const trimmed = output.trim();
9800
9859
  if (!trimmed)
@@ -9805,7 +9864,7 @@ function probeBinaryVersion(preferredVersion) {
9805
9864
  const candidates = [];
9806
9865
  if (preferredVersion) {
9807
9866
  const tag = preferredVersion.startsWith("v") ? preferredVersion : `v${preferredVersion}`;
9808
- candidates.push(join6(getAftBinaryCacheDir(), tag, getAftBinaryName()));
9867
+ candidates.push(join5(getAftBinaryCacheDir(), tag, getAftBinaryName()));
9809
9868
  }
9810
9869
  try {
9811
9870
  const lookup = process.platform === "win32" ? "where aft" : "which aft";
@@ -9816,7 +9875,7 @@ function probeBinaryVersion(preferredVersion) {
9816
9875
  } catch {}
9817
9876
  for (const candidate of candidates) {
9818
9877
  try {
9819
- if (!existsSync6(candidate))
9878
+ if (!existsSync5(candidate))
9820
9879
  continue;
9821
9880
  const output = execSync3(`"${candidate}" --version`, {
9822
9881
  stdio: "pipe",
@@ -9829,13 +9888,426 @@ function probeBinaryVersion(preferredVersion) {
9829
9888
  }
9830
9889
  return null;
9831
9890
  }
9891
+ function platformKey(platform = process.platform, arch = process.arch) {
9892
+ const table = {
9893
+ darwin: { arm64: "darwin-arm64", x64: "darwin-x64" },
9894
+ linux: { arm64: "linux-arm64", x64: "linux-x64" },
9895
+ win32: { x64: "win32-x64" }
9896
+ };
9897
+ return table[platform]?.[arch] ?? null;
9898
+ }
9899
+ function findAftBinary(preferredVersion) {
9900
+ const candidates = [];
9901
+ if (preferredVersion) {
9902
+ const tag = preferredVersion.startsWith("v") ? preferredVersion : `v${preferredVersion}`;
9903
+ candidates.push(join5(getAftBinaryCacheDir(), tag, getAftBinaryName()));
9904
+ }
9905
+ const key = platformKey();
9906
+ if (key) {
9907
+ try {
9908
+ const require2 = createRequire2(import.meta.url);
9909
+ candidates.push(require2.resolve(`@cortexkit/aft-${key}/bin/${getAftBinaryName()}`));
9910
+ } catch {}
9911
+ }
9912
+ try {
9913
+ const lookup = process.platform === "win32" ? "where aft" : "which aft";
9914
+ const resolved = execSync3(lookup, { stdio: "pipe", encoding: "utf-8" }).trim();
9915
+ if (resolved) {
9916
+ candidates.push(resolved.split(/\r?\n/)[0]);
9917
+ }
9918
+ } catch {}
9919
+ candidates.push(join5(homedir4(), ".cargo", "bin", getAftBinaryName()));
9920
+ for (const candidate of candidates) {
9921
+ if (existsSync5(candidate))
9922
+ return candidate;
9923
+ }
9924
+ return null;
9925
+ }
9832
9926
  var init_binary_probe = __esm(() => {
9833
9927
  init_paths();
9834
9928
  });
9835
9929
 
9836
- // src/lib/onnx.ts
9837
- import { existsSync as existsSync7, readdirSync as readdirSync3, readlinkSync, realpathSync, statSync as statSync3 } from "node:fs";
9930
+ // src/commands/lsp.ts
9931
+ var exports_lsp = {};
9932
+ __export(exports_lsp, {
9933
+ runLspDoctor: () => runLspDoctor,
9934
+ renderLspInspection: () => renderLspInspection,
9935
+ printLspDoctorHelp: () => printLspDoctorHelp
9936
+ });
9937
+ import { existsSync as existsSync6, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
9938
+ import { join as join6, resolve as resolve2 } from "node:path";
9939
+ function printLspDoctorHelp() {
9940
+ console.log("Usage: aft doctor lsp <file> [--harness opencode|pi]");
9941
+ console.log("");
9942
+ console.log("Inspect what AFT's LSP layer would do for a file.");
9943
+ }
9944
+ async function runLspDoctor(options) {
9945
+ const file = parseFileArg(options.argv);
9946
+ if (!file) {
9947
+ printLspDoctorHelp();
9948
+ return 1;
9949
+ }
9950
+ const resolveAdapters = options.resolveAdapters ?? resolveAdaptersForCommand;
9951
+ const adapters = await resolveAdapters(options.argv, {
9952
+ allowMulti: false,
9953
+ verb: "inspect LSP for"
9954
+ });
9955
+ const adapter = adapters[0];
9956
+ if (!adapter) {
9957
+ O2.error("No harness selected.");
9958
+ return 1;
9959
+ }
9960
+ const findBinary = options.findBinary ?? findAftBinary;
9961
+ const binary = findBinary(getSelfVersion());
9962
+ if (!binary) {
9963
+ O2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
9964
+ return 1;
9965
+ }
9966
+ const projectRoot = resolve2(process.cwd());
9967
+ const config = buildConfigureParams(adapter, projectRoot);
9968
+ const inspectRequest = {
9969
+ id: "doctor-lsp-inspect",
9970
+ command: "lsp_inspect",
9971
+ file: resolve2(file)
9972
+ };
9973
+ const responses = options.sendRequests ? await options.sendRequests(binary, [config, inspectRequest]) : options.sendRequest ? [await options.sendRequest(binary, inspectRequest)] : await sendAftRequests(binary, [config, inspectRequest]);
9974
+ const configure = responses.length > 1 ? responses[0] : undefined;
9975
+ if (configure && !configure.success) {
9976
+ O2.error(configure.message ?? configure.code ?? "configure failed");
9977
+ return 1;
9978
+ }
9979
+ const inspect = responses[responses.length - 1];
9980
+ if (!inspect) {
9981
+ O2.error("aft exited before returning lsp_inspect response");
9982
+ return 1;
9983
+ }
9984
+ if (!inspect.success) {
9985
+ O2.error(inspect.message ?? inspect.code ?? "lsp_inspect failed");
9986
+ return 1;
9987
+ }
9988
+ console.log(renderLspInspection(file, inspect));
9989
+ return 0;
9990
+ }
9991
+ function renderLspInspection(inputFile, response) {
9992
+ const lines = [];
9993
+ lines.push(`LSP inspection — ${inputFile}`);
9994
+ lines.push("");
9995
+ lines.push(`Resolved file: ${response.file ?? "(unknown)"}`);
9996
+ lines.push(`File extension: ${response.extension ? `.${response.extension}` : "(none)"}`);
9997
+ lines.push(`Project root: ${response.project_root ?? "(not configured)"}`);
9998
+ lines.push("");
9999
+ lines.push(`Active config: experimental_lsp_ty=${response.experimental_lsp_ty === true ? "true" : "false"}, disabled_lsp=${formatList(response.disabled_lsp ?? [])}`);
10000
+ lines.push(`lsp_paths_extra: ${formatList(response.lsp_paths_extra ?? [])}`);
10001
+ lines.push("");
10002
+ lines.push("Server attempts:");
10003
+ const active = new Set(response.matching_servers?.map((server) => server.id) ?? []);
10004
+ for (const id of response.disabled_lsp ?? []) {
10005
+ if (!active.has(id)) {
10006
+ lines.push(` • ${id}: disabled by config`);
10007
+ }
10008
+ }
10009
+ const servers = response.matching_servers ?? [];
10010
+ if (servers.length === 0) {
10011
+ lines.push(" (no registered LSP servers match this file extension)");
10012
+ }
10013
+ for (const server of servers) {
10014
+ const ok = server.spawn_status === "ok";
10015
+ lines.push(` ${ok ? "✓" : "✗"} ${server.id}`);
10016
+ lines.push(` Binary: ${formatBinary(server)}`);
10017
+ lines.push(` Workspace root: ${formatWorkspaceRoot(server)}`);
10018
+ lines.push(` Args: ${JSON.stringify(server.args)}`);
10019
+ lines.push(` Status: ${formatSpawnStatus(server)}`);
10020
+ if (server.binary_source === "not_found") {
10021
+ lines.push(` Action: ${installHint(server.binary_name)}`);
10022
+ }
10023
+ }
10024
+ const diagnostics = response.diagnostics ?? [];
10025
+ lines.push("");
10026
+ lines.push(`Diagnostics (${response.diagnostics_count ?? diagnostics.length} found):`);
10027
+ if (diagnostics.length === 0) {
10028
+ lines.push(" (none)");
10029
+ }
10030
+ for (const diagnostic of diagnostics) {
10031
+ lines.push(` ${diagnostic.file}:${diagnostic.line}:${diagnostic.column} [${diagnostic.severity}] ${diagnostic.message}`);
10032
+ }
10033
+ return lines.join(`
10034
+ `);
10035
+ }
10036
+ function parseFileArg(argv) {
10037
+ for (let i = 0;i < argv.length; i += 1) {
10038
+ const arg = argv[i];
10039
+ if (arg === "--harness") {
10040
+ i += 1;
10041
+ continue;
10042
+ }
10043
+ if (arg.startsWith("--"))
10044
+ continue;
10045
+ return arg;
10046
+ }
10047
+ return null;
10048
+ }
10049
+ function buildConfigureParams(adapter, projectRoot) {
10050
+ const paths = adapter.detectConfigPaths();
10051
+ const userConfig = readJsoncFile(paths.aftConfig).value ?? {};
10052
+ const projectConfig = readProjectConfig(adapter.kind, projectRoot);
10053
+ const merged = mergeConfig(userConfig, projectConfig);
10054
+ const lsp = isRecord(merged.lsp) ? merged.lsp : {};
10055
+ const lspConfig = resolveLspConfig(merged);
10056
+ return {
10057
+ id: "doctor-lsp-configure",
10058
+ command: "configure",
10059
+ project_root: projectRoot,
10060
+ ...lspConfig,
10061
+ lsp_paths_extra: inferLspPathsExtra(lsp)
10062
+ };
10063
+ }
10064
+ function readProjectConfig(kind, projectRoot) {
10065
+ const dir = kind === "pi" ? ".pi" : ".opencode";
10066
+ const jsonc = join6(projectRoot, dir, "aft.jsonc");
10067
+ const json = join6(projectRoot, dir, "aft.json");
10068
+ if (existsSync6(jsonc))
10069
+ return readJsoncFile(jsonc).value ?? {};
10070
+ if (existsSync6(json))
10071
+ return readJsoncFile(json).value ?? {};
10072
+ return {};
10073
+ }
10074
+ function mergeConfig(userConfig, projectConfig) {
10075
+ const userLsp = isRecord(userConfig.lsp) ? userConfig.lsp : {};
10076
+ const projectLsp = isRecord(projectConfig.lsp) ? projectConfig.lsp : {};
10077
+ return {
10078
+ ...userConfig,
10079
+ ...projectConfig,
10080
+ lsp: {
10081
+ ...userLsp,
10082
+ ...projectLsp,
10083
+ ...isRecord(userLsp.servers) ? { servers: userLsp.servers } : {},
10084
+ ...Array.isArray(userLsp.disabled) ? { disabled: userLsp.disabled } : {}
10085
+ }
10086
+ };
10087
+ }
10088
+ function resolveLspConfig(config) {
10089
+ const lsp = isRecord(config.lsp) ? config.lsp : {};
10090
+ const disabled = new Set;
10091
+ for (const entry of Array.isArray(lsp.disabled) ? lsp.disabled : []) {
10092
+ if (typeof entry === "string")
10093
+ disabled.add(entry.toLowerCase());
10094
+ }
10095
+ let experimentalTy = typeof config.experimental_lsp_ty === "boolean" ? config.experimental_lsp_ty : undefined;
10096
+ if (lsp.python === "ty") {
10097
+ experimentalTy = true;
10098
+ disabled.add("python");
10099
+ } else if (lsp.python === "pyright") {
10100
+ experimentalTy = false;
10101
+ disabled.add("ty");
10102
+ }
10103
+ const result = {};
10104
+ if (experimentalTy !== undefined)
10105
+ result.experimental_lsp_ty = experimentalTy;
10106
+ if (disabled.size > 0)
10107
+ result.disabled_lsp = [...disabled];
10108
+ const servers = resolveCustomServers(lsp.servers);
10109
+ if (servers.length > 0)
10110
+ result.lsp_servers = servers;
10111
+ return result;
10112
+ }
10113
+ function resolveCustomServers(servers) {
10114
+ if (!isRecord(servers))
10115
+ return [];
10116
+ return Object.entries(servers).filter(([, server]) => isRecord(server)).map(([id, server]) => {
10117
+ const entry = server;
10118
+ return {
10119
+ id,
10120
+ extensions: Array.isArray(entry.extensions) ? entry.extensions : [],
10121
+ binary: typeof entry.binary === "string" ? entry.binary : "",
10122
+ args: Array.isArray(entry.args) ? entry.args : [],
10123
+ root_markers: Array.isArray(entry.root_markers) ? entry.root_markers : [".git"],
10124
+ disabled: entry.disabled === true,
10125
+ ...isRecord(entry.env) ? { env: entry.env } : {},
10126
+ ...entry.initialization_options !== undefined ? { initialization_options: entry.initialization_options } : {}
10127
+ };
10128
+ }).filter((server) => typeof server.binary === "string" && server.binary.length > 0);
10129
+ }
10130
+ function inferLspPathsExtra(lsp) {
10131
+ if (lsp.auto_install === false)
10132
+ return [];
10133
+ const paths = new Set;
10134
+ for (const entry of childDirs(getAftLspPackagesDir())) {
10135
+ paths.add(join6(entry, "node_modules", ".bin"));
10136
+ }
10137
+ for (const entry of childDirs(getAftLspBinariesDir())) {
10138
+ paths.add(join6(entry, "bin"));
10139
+ }
10140
+ return [...paths];
10141
+ }
10142
+ function childDirs(path) {
10143
+ if (!existsSync6(path))
10144
+ return [];
10145
+ try {
10146
+ return readdirSync2(path).map((entry) => join6(path, entry)).filter((entry) => {
10147
+ try {
10148
+ return statSync2(entry).isDirectory();
10149
+ } catch {
10150
+ return false;
10151
+ }
10152
+ });
10153
+ } catch {
10154
+ return [];
10155
+ }
10156
+ }
10157
+ function formatBinary(server) {
10158
+ if (!server.binary_path) {
10159
+ return `${server.binary_name} (NOT FOUND on PATH or in lsp_paths_extra)`;
10160
+ }
10161
+ return `${server.binary_path} (found via ${server.binary_source})`;
10162
+ }
10163
+ function formatWorkspaceRoot(server) {
10164
+ if (!server.workspace_root) {
10165
+ return `(not found; markers: ${server.root_markers.join(", ") || "none"})`;
10166
+ }
10167
+ return `${server.workspace_root} (markers: ${server.root_markers.join(", ") || "none"})`;
10168
+ }
10169
+ function formatSpawnStatus(server) {
10170
+ if (server.spawn_status === "ok")
10171
+ return "spawned successfully";
10172
+ if (server.spawn_status === "binary_not_installed")
10173
+ return "binary not installed";
10174
+ if (server.spawn_status === "no_root_marker")
10175
+ return "no workspace root marker found";
10176
+ return server.spawn_status;
10177
+ }
10178
+ function formatList(values) {
10179
+ return values.length === 0 ? "(none)" : values.join(", ");
10180
+ }
10181
+ function installHint(binaryName) {
10182
+ if (binaryName === "ty")
10183
+ return "Install with `uv tool install ty` or `pip install ty`.";
10184
+ if (binaryName === "pyright-langserver")
10185
+ return "Install with `npm install -g pyright`.";
10186
+ return `Install ${binaryName} and ensure it is on PATH or in lsp_paths_extra.`;
10187
+ }
10188
+ function isRecord(value) {
10189
+ return typeof value === "object" && value !== null && !Array.isArray(value);
10190
+ }
10191
+ var init_lsp = __esm(() => {
10192
+ init_aft_bridge();
10193
+ init_binary_probe();
10194
+ init_harness_select();
10195
+ init_jsonc();
10196
+ init_paths();
10197
+ init_prompts();
10198
+ init_self_version();
10199
+ });
10200
+
10201
+ // src/lib/binary-cache.ts
10202
+ import { existsSync as existsSync7, readdirSync as readdirSync3, statSync as statSync3 } from "node:fs";
9838
10203
  import { join as join7 } from "node:path";
10204
+ function getBinaryCacheInfo(activeVersion) {
10205
+ const path = getAftBinaryCacheDir();
10206
+ if (!existsSync7(path)) {
10207
+ return {
10208
+ versions: [],
10209
+ activeVersion: null,
10210
+ totalSize: 0,
10211
+ path
10212
+ };
10213
+ }
10214
+ const versions = readdirSync3(path).filter((entry) => {
10215
+ try {
10216
+ return statSync3(join7(path, entry)).isDirectory();
10217
+ } catch {
10218
+ return false;
10219
+ }
10220
+ }).sort(compareVersionLabels);
10221
+ const tag = activeVersion ? activeVersion.startsWith("v") ? activeVersion : `v${activeVersion}` : null;
10222
+ const resolvedActive = tag && versions.includes(tag) ? tag : null;
10223
+ return {
10224
+ versions,
10225
+ activeVersion: resolvedActive,
10226
+ totalSize: dirSize(path),
10227
+ path
10228
+ };
10229
+ }
10230
+ var init_binary_cache = __esm(() => {
10231
+ init_fs_util();
10232
+ init_paths();
10233
+ });
10234
+
10235
+ // src/lib/lsp-cache.ts
10236
+ import { existsSync as existsSync8, readdirSync as readdirSync4, rmSync as rmSync2, statSync as statSync4 } from "node:fs";
10237
+ import { join as join8 } from "node:path";
10238
+ function inspectDir(path) {
10239
+ if (!existsSync8(path)) {
10240
+ return { entries: [], totalSize: 0 };
10241
+ }
10242
+ const entries = [];
10243
+ let totalSize = 0;
10244
+ let names;
10245
+ try {
10246
+ names = readdirSync4(path);
10247
+ } catch {
10248
+ return { entries: [], totalSize: 0 };
10249
+ }
10250
+ for (const name of names) {
10251
+ const full = join8(path, name);
10252
+ try {
10253
+ if (!statSync4(full).isDirectory())
10254
+ continue;
10255
+ const size = dirSize(full);
10256
+ entries.push({
10257
+ name: decodeURIComponent(name),
10258
+ path: full,
10259
+ size
10260
+ });
10261
+ totalSize += size;
10262
+ } catch {}
10263
+ }
10264
+ entries.sort((a, b) => b.size - a.size);
10265
+ return { entries, totalSize };
10266
+ }
10267
+ function getLspCacheReport() {
10268
+ const npmPath = getAftLspPackagesDir();
10269
+ const githubPath = getAftLspBinariesDir();
10270
+ const npm = inspectDir(npmPath);
10271
+ const github = inspectDir(githubPath);
10272
+ return {
10273
+ npm: {
10274
+ path: npmPath,
10275
+ entries: npm.entries,
10276
+ totalSize: npm.totalSize
10277
+ },
10278
+ github: {
10279
+ path: githubPath,
10280
+ entries: github.entries,
10281
+ totalSize: github.totalSize
10282
+ },
10283
+ totalSize: npm.totalSize + github.totalSize
10284
+ };
10285
+ }
10286
+ function clearLspCaches() {
10287
+ const result = { cleared: [], errors: [], totalBytes: 0 };
10288
+ const report = getLspCacheReport();
10289
+ for (const entry of [...report.npm.entries, ...report.github.entries]) {
10290
+ try {
10291
+ rmSync2(entry.path, { recursive: true, force: true });
10292
+ result.cleared.push({ name: entry.name, path: entry.path, size: entry.size });
10293
+ result.totalBytes += entry.size;
10294
+ } catch (err) {
10295
+ result.errors.push({
10296
+ path: entry.path,
10297
+ error: err instanceof Error ? err.message : String(err)
10298
+ });
10299
+ }
10300
+ }
10301
+ return result;
10302
+ }
10303
+ var init_lsp_cache = __esm(() => {
10304
+ init_fs_util();
10305
+ init_paths();
10306
+ });
10307
+
10308
+ // src/lib/onnx.ts
10309
+ import { existsSync as existsSync9, readdirSync as readdirSync5, readlinkSync, realpathSync, statSync as statSync5 } from "node:fs";
10310
+ import { join as join9 } from "node:path";
9839
10311
  function getOnnxLibraryName() {
9840
10312
  if (process.platform === "darwin")
9841
10313
  return "libonnxruntime.dylib";
@@ -9868,21 +10340,21 @@ function findSystemOnnxRuntime() {
9868
10340
  const libName = getOnnxLibraryName();
9869
10341
  const searchPaths = process.platform === "darwin" ? ["/opt/homebrew/lib", "/usr/local/lib"] : process.platform === "linux" ? ["/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib/aarch64-linux-gnu", "/usr/local/lib"] : [];
9870
10342
  for (const path of searchPaths) {
9871
- if (existsSync7(join7(path, libName)))
10343
+ if (existsSync9(join9(path, libName)))
9872
10344
  return path;
9873
10345
  }
9874
10346
  return null;
9875
10347
  }
9876
10348
  function findCachedOnnxRuntime(storageDir) {
9877
- const ortDir = join7(storageDir, "onnxruntime", ONNX_RUNTIME_VERSION);
9878
- return existsSync7(join7(ortDir, getOnnxLibraryName())) ? ortDir : null;
10349
+ const ortDir = join9(storageDir, "onnxruntime", ONNX_RUNTIME_VERSION);
10350
+ return existsSync9(join9(ortDir, getOnnxLibraryName())) ? ortDir : null;
9879
10351
  }
9880
10352
  function detectOrtVersion(libDir) {
9881
- if (!existsSync7(libDir))
10353
+ if (!existsSync9(libDir))
9882
10354
  return null;
9883
10355
  const libName = getOnnxLibraryName();
9884
10356
  try {
9885
- const entries = readdirSync3(libDir);
10357
+ const entries = readdirSync5(libDir);
9886
10358
  for (const entry of entries) {
9887
10359
  if (!entry.startsWith(libName))
9888
10360
  continue;
@@ -9890,8 +10362,8 @@ function detectOrtVersion(libDir) {
9890
10362
  if (match)
9891
10363
  return match[1];
9892
10364
  }
9893
- const base = join7(libDir, libName);
9894
- if (existsSync7(base)) {
10365
+ const base = join9(libDir, libName);
10366
+ if (existsSync9(base)) {
9895
10367
  try {
9896
10368
  const real = realpathSync(base);
9897
10369
  const suffix = real.match(/\.(\d+\.\d+\.\d+)$/);
@@ -9921,13 +10393,13 @@ var ONNX_RUNTIME_VERSION = "1.24.4", REQUIRED_ORT_MAJOR = 1, REQUIRED_ORT_MIN_MI
9921
10393
  var init_onnx = () => {};
9922
10394
 
9923
10395
  // src/lib/sanitize.ts
9924
- import { homedir as homedir4, userInfo } from "node:os";
10396
+ import { homedir as homedir5, userInfo } from "node:os";
9925
10397
  function escapeRegex(value) {
9926
10398
  return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
9927
10399
  }
9928
10400
  function sanitizeContent(content) {
9929
10401
  const username = userInfo().username;
9930
- const home = homedir4();
10402
+ const home = homedir5();
9931
10403
  let sanitized = content;
9932
10404
  if (home) {
9933
10405
  sanitized = sanitized.replace(new RegExp(escapeRegex(home), "g"), "~");
@@ -9956,7 +10428,7 @@ function sanitizeValue(value) {
9956
10428
  var init_sanitize = () => {};
9957
10429
 
9958
10430
  // src/lib/diagnostics.ts
9959
- import { existsSync as existsSync8, readFileSync as readFileSync4, statSync as statSync4 } from "node:fs";
10431
+ import { existsSync as existsSync10, readFileSync as readFileSync4, statSync as statSync6 } from "node:fs";
9960
10432
  async function collectDiagnostics(adapters) {
9961
10433
  const cliVersion = getSelfVersion();
9962
10434
  const binaryVersion = probeBinaryVersion(cliVersion);
@@ -9972,7 +10444,8 @@ async function collectDiagnostics(adapters) {
9972
10444
  cliVersion,
9973
10445
  binaryVersion,
9974
10446
  harnesses,
9975
- binaryCache: getBinaryCacheInfo(cliVersion)
10447
+ binaryCache: getBinaryCacheInfo(cliVersion),
10448
+ lspCache: getLspCacheReport()
9976
10449
  };
9977
10450
  }
9978
10451
  async function diagnoseHarness(adapter) {
@@ -9995,14 +10468,14 @@ async function diagnoseHarness(adapter) {
9995
10468
  pluginRegistered: adapter.hasPluginEntry(),
9996
10469
  configPaths,
9997
10470
  aftConfig: {
9998
- exists: existsSync8(configPaths.aftConfig),
10471
+ exists: existsSync10(configPaths.aftConfig),
9999
10472
  ...aftConfigRead.error ? { parseError: aftConfigRead.error } : {},
10000
10473
  flags: aftFlags
10001
10474
  },
10002
10475
  pluginCache: adapter.getPluginCacheInfo(),
10003
10476
  storageDir: {
10004
10477
  path: storage,
10005
- exists: existsSync8(storage),
10478
+ exists: existsSync10(storage),
10006
10479
  sizesByKey: describeStorage
10007
10480
  },
10008
10481
  onnxRuntime: {
@@ -10019,8 +10492,8 @@ async function diagnoseHarness(adapter) {
10019
10492
  },
10020
10493
  logFile: {
10021
10494
  path: logPath,
10022
- exists: existsSync8(logPath),
10023
- sizeKb: existsSync8(logPath) ? Math.round(statSync4(logPath).size / 1024) : 0
10495
+ exists: existsSync10(logPath),
10496
+ sizeKb: existsSync10(logPath) ? Math.round(statSync6(logPath).size / 1024) : 0
10024
10497
  }
10025
10498
  };
10026
10499
  }
@@ -10071,11 +10544,16 @@ function renderDiagnosticsMarkdown(report) {
10071
10544
  lines.push("```json");
10072
10545
  lines.push(JSON.stringify(report.binaryCache, null, 2));
10073
10546
  lines.push("```");
10547
+ lines.push("");
10548
+ lines.push("### LSP cache");
10549
+ lines.push("```json");
10550
+ lines.push(JSON.stringify(report.lspCache, null, 2));
10551
+ lines.push("```");
10074
10552
  return lines.join(`
10075
10553
  `);
10076
10554
  }
10077
10555
  function tailLogFile(path, lines) {
10078
- if (!existsSync8(path))
10556
+ if (!existsSync10(path))
10079
10557
  return "";
10080
10558
  try {
10081
10559
  const raw = readFileSync4(path, "utf-8");
@@ -10089,6 +10567,7 @@ var init_diagnostics = __esm(() => {
10089
10567
  init_binary_cache();
10090
10568
  init_binary_probe();
10091
10569
  init_jsonc();
10570
+ init_lsp_cache();
10092
10571
  init_onnx();
10093
10572
  init_sanitize();
10094
10573
  init_self_version();
@@ -10134,15 +10613,21 @@ var init_github = () => {};
10134
10613
  // src/commands/doctor.ts
10135
10614
  var exports_doctor = {};
10136
10615
  __export(exports_doctor, {
10137
- runDoctor: () => runDoctor
10616
+ runDoctor: () => runDoctor,
10617
+ clearDoctorCaches: () => clearDoctorCaches,
10618
+ DOCTOR_FORCE_CLEAR_TARGETS: () => DOCTOR_FORCE_CLEAR_TARGETS,
10619
+ DOCTOR_CLEAR_TARGET_OPTIONS: () => DOCTOR_CLEAR_TARGET_OPTIONS
10138
10620
  });
10139
10621
  import { writeFileSync as writeFileSync2 } from "node:fs";
10140
- import { join as join8 } from "node:path";
10622
+ import { join as join10 } from "node:path";
10141
10623
  async function runDoctor(options) {
10142
10624
  if (options.issue) {
10143
10625
  return runIssueFlow(options.argv);
10144
10626
  }
10145
10627
  mt("AFT doctor");
10628
+ if (options.clear) {
10629
+ return runClearFlow(options.argv);
10630
+ }
10146
10631
  const adapters = await resolveAdaptersForCommand(options.argv, {
10147
10632
  allowMulti: true,
10148
10633
  verb: "diagnose"
@@ -10150,6 +10635,11 @@ async function runDoctor(options) {
10150
10635
  const report = await collectDiagnostics(adapters);
10151
10636
  O2.info(`CLI v${report.cliVersion}, binary ${report.binaryVersion ?? "unknown"}`);
10152
10637
  O2.info(`Binary cache: ${report.binaryCache.versions.length} version(s), ${formatBytes(report.binaryCache.totalSize)} at ${report.binaryCache.path}`);
10638
+ const npmCount = report.lspCache.npm.entries.length;
10639
+ const ghCount = report.lspCache.github.entries.length;
10640
+ if (npmCount + ghCount > 0) {
10641
+ O2.info(`LSP cache: ${npmCount} npm + ${ghCount} github install(s), ${formatBytes(report.lspCache.totalSize)} total`);
10642
+ }
10153
10643
  let hadProblems = false;
10154
10644
  for (const h of report.harnesses) {
10155
10645
  O2.step(`${h.displayName}`);
@@ -10185,8 +10675,11 @@ async function runDoctor(options) {
10185
10675
  }
10186
10676
  O2.info(` log: ${h.logFile.exists ? `${h.logFile.path} (${h.logFile.sizeKb} KB)` : "(not written yet)"}`);
10187
10677
  }
10678
+ if (options.force) {
10679
+ await clearDoctorCaches(adapters, DOCTOR_FORCE_CLEAR_TARGETS, { includePluginBytes: false });
10680
+ }
10188
10681
  for (const adapter of adapters) {
10189
- await maybeFixPlugin(adapter, options.force);
10682
+ await maybeFixPlugin(adapter);
10190
10683
  }
10191
10684
  if (hadProblems) {
10192
10685
  wt("Run `aft setup` to register AFT with any harness showing `plugin registered: no`.", "Tips");
@@ -10196,19 +10689,87 @@ async function runDoctor(options) {
10196
10689
  gt("Everything looks good.");
10197
10690
  return 0;
10198
10691
  }
10199
- async function maybeFixPlugin(adapter, force) {
10200
- if (force) {
10201
- const result = await adapter.clearPluginCache(true);
10202
- if (result.action === "cleared") {
10203
- O2.success(`${adapter.displayName}: cleared plugin cache at ${result.path}`);
10204
- } else if (result.action === "not_applicable") {
10205
- O2.info(`${adapter.displayName}: no user-managed plugin cache to clear`);
10206
- } else if (result.action === "not_found") {
10207
- O2.info(`${adapter.displayName}: no plugin cache found at ${result.path}`);
10208
- } else if (result.action === "error") {
10209
- O2.error(`${adapter.displayName}: cache clear failed: ${result.error ?? "unknown"}`);
10692
+ async function runClearFlow(argv) {
10693
+ const targets = await selectMany("What do you want to clear?", DOCTOR_CLEAR_TARGET_OPTIONS, undefined, false);
10694
+ if (targets.length === 0) {
10695
+ O2.info("No cache categories selected; nothing to clear.");
10696
+ gt("Done.");
10697
+ return 0;
10698
+ }
10699
+ const adapters = targets.includes("plugin-cache") ? await resolveAdaptersForCommand(argv, {
10700
+ allowMulti: true,
10701
+ verb: "clear plugin cache for"
10702
+ }) : [];
10703
+ const summary = await clearDoctorCaches(adapters, targets);
10704
+ gt(summary.hadErrors ? "Done — some cache entries could not be cleared." : "Done.");
10705
+ return summary.hadErrors ? 1 : 0;
10706
+ }
10707
+ async function clearDoctorCaches(adapters, targets, options = {}) {
10708
+ const summary = { hadErrors: false };
10709
+ if (targets.includes("plugin-cache")) {
10710
+ let cleared = 0;
10711
+ let totalBytes = 0;
10712
+ let errors = 0;
10713
+ for (const adapter of adapters) {
10714
+ const result = await clearPluginCache(adapter, options.includePluginBytes ?? true);
10715
+ if (result.action === "cleared") {
10716
+ cleared += 1;
10717
+ totalBytes += result.bytes;
10718
+ } else if (result.action === "error") {
10719
+ errors += 1;
10720
+ summary.hadErrors = true;
10721
+ }
10210
10722
  }
10723
+ summary.pluginCache = { cleared, totalBytes, errors };
10211
10724
  }
10725
+ if (targets.includes("lsp-cache")) {
10726
+ const cleanup = (options.clearLspCaches ?? clearLspCaches)();
10727
+ reportLspCacheClear(cleanup);
10728
+ if (cleanup.errors.length > 0) {
10729
+ summary.hadErrors = true;
10730
+ }
10731
+ summary.lspCache = {
10732
+ cleared: cleanup.cleared.length,
10733
+ totalBytes: cleanup.totalBytes,
10734
+ errors: cleanup.errors.length
10735
+ };
10736
+ }
10737
+ return summary;
10738
+ }
10739
+ async function clearPluginCache(adapter, includeBytes) {
10740
+ const info = adapter.getPluginCacheInfo();
10741
+ const bytes = info.exists ? dirSize(info.path) : 0;
10742
+ const result = await adapter.clearPluginCache(true);
10743
+ if (result.action === "cleared") {
10744
+ const suffix = includeBytes ? `, reclaimed ${formatBytes(bytes)}` : "";
10745
+ O2.success(`${adapter.displayName}: cleared plugin cache at ${result.path}${suffix}`);
10746
+ return { action: "cleared", bytes };
10747
+ }
10748
+ if (result.action === "not_applicable") {
10749
+ O2.info(`${adapter.displayName}: no user-managed plugin cache to clear`);
10750
+ return { action: "not_applicable", bytes: 0 };
10751
+ }
10752
+ if (result.action === "not_found") {
10753
+ O2.info(`${adapter.displayName}: no plugin cache found at ${result.path}`);
10754
+ return { action: "not_found", bytes: 0 };
10755
+ }
10756
+ if (result.action === "error") {
10757
+ O2.error(`${adapter.displayName}: cache clear failed: ${result.error ?? "unknown"}`);
10758
+ return { action: "error", bytes: 0 };
10759
+ }
10760
+ return { action: "not_found", bytes: 0 };
10761
+ }
10762
+ function reportLspCacheClear(cleanup) {
10763
+ if (cleanup.cleared.length === 0) {
10764
+ O2.info("LSP install cache: nothing to clear, reclaimed 0 B");
10765
+ } else {
10766
+ O2.success(`LSP install cache: cleared ${cleanup.cleared.length} install(s), reclaimed ${formatBytes(cleanup.totalBytes)}`);
10767
+ }
10768
+ for (const err of cleanup.errors) {
10769
+ O2.error(`LSP install cache: failed to remove ${err.path}: ${err.error}`);
10770
+ }
10771
+ }
10772
+ async function maybeFixPlugin(adapter) {
10212
10773
  if (!adapter.hasPluginEntry() && adapter.isInstalled()) {
10213
10774
  O2.info(`${adapter.displayName}: attempting to register plugin…`);
10214
10775
  const r = await adapter.ensurePluginEntry();
@@ -10272,7 +10833,7 @@ ${tail || "<no log output>"}
10272
10833
  `);
10273
10834
  const body = sanitizeContent(rawBody);
10274
10835
  const title = `AFT issue: ${description.slice(0, 72)}`;
10275
- const outPath = join8(process.cwd(), `aft-issue-${Date.now()}.md`);
10836
+ const outPath = join10(process.cwd(), `aft-issue-${Date.now()}.md`);
10276
10837
  writeFileSync2(outPath, `${body}
10277
10838
  `);
10278
10839
  O2.success(`Wrote sanitized issue body to ${outPath}`);
@@ -10294,13 +10855,26 @@ ${tail || "<no log output>"}
10294
10855
  gt("Done.");
10295
10856
  return 0;
10296
10857
  }
10858
+ var DOCTOR_CLEAR_TARGET_OPTIONS, DOCTOR_FORCE_CLEAR_TARGETS;
10297
10859
  var init_doctor = __esm(() => {
10298
10860
  init_diagnostics();
10299
10861
  init_fs_util();
10300
10862
  init_github();
10301
10863
  init_harness_select();
10864
+ init_lsp_cache();
10302
10865
  init_prompts();
10303
10866
  init_sanitize();
10867
+ DOCTOR_CLEAR_TARGET_OPTIONS = [
10868
+ {
10869
+ label: "Plugin npm cache (~/.cache/opencode/packages/@cortexkit/aft-opencode@latest, etc.)",
10870
+ value: "plugin-cache"
10871
+ },
10872
+ {
10873
+ label: "LSP install cache (~/.cache/aft/lsp-packages/, ~/.cache/aft/lsp-binaries/)",
10874
+ value: "lsp-cache"
10875
+ }
10876
+ ];
10877
+ DOCTOR_FORCE_CLEAR_TARGETS = ["plugin-cache"];
10304
10878
  });
10305
10879
 
10306
10880
  // src/index.ts
@@ -10314,7 +10888,8 @@ function printHelp() {
10314
10888
  console.log(" Commands:");
10315
10889
  console.log(" setup Interactive setup wizard");
10316
10890
  console.log(" doctor Check and fix configuration issues");
10317
- console.log(" doctor --force Force clear plugin cache (fixes stale versions)");
10891
+ console.log(" doctor lsp <file> Inspect LSP setup for one file");
10892
+ console.log(" doctor --clear Select caches to clear with an interactive prompt");
10318
10893
  console.log(" doctor --issue Collect diagnostics and open a GitHub issue");
10319
10894
  console.log("");
10320
10895
  console.log(" Harness selection:");
@@ -10325,6 +10900,8 @@ function printHelp() {
10325
10900
  console.log(" Usage:");
10326
10901
  console.log(" bunx --bun @cortexkit/aft setup");
10327
10902
  console.log(" bunx --bun @cortexkit/aft doctor");
10903
+ console.log(" bunx --bun @cortexkit/aft doctor lsp ./src/main.py");
10904
+ console.log(" bunx --bun @cortexkit/aft doctor --clear");
10328
10905
  console.log(" bunx --bun @cortexkit/aft doctor --issue");
10329
10906
  console.log("");
10330
10907
  }
@@ -10334,10 +10911,15 @@ async function main() {
10334
10911
  return runSetup2(args);
10335
10912
  }
10336
10913
  if (command === "doctor") {
10914
+ if (args[0] === "lsp") {
10915
+ const { runLspDoctor: runLspDoctor2 } = await Promise.resolve().then(() => (init_lsp(), exports_lsp));
10916
+ return runLspDoctor2({ argv: args.slice(1) });
10917
+ }
10337
10918
  const { runDoctor: runDoctor2 } = await Promise.resolve().then(() => (init_doctor(), exports_doctor));
10338
10919
  const force = args.includes("--force");
10920
+ const clear = args.includes("--clear");
10339
10921
  const issue = args.includes("--issue");
10340
- return runDoctor2({ force, issue, argv: args });
10922
+ return runDoctor2({ clear, force, issue, argv: args });
10341
10923
  }
10342
10924
  printHelp();
10343
10925
  return command ? 1 : 0;
@@ -0,0 +1,15 @@
1
+ export interface AftRequest {
2
+ id: string;
3
+ command: string;
4
+ [key: string]: unknown;
5
+ }
6
+ export interface AftResponse {
7
+ id: string;
8
+ success: boolean;
9
+ code?: string;
10
+ message?: string;
11
+ [key: string]: unknown;
12
+ }
13
+ export declare function sendAftRequest(binaryPath: string, request: AftRequest): Promise<AftResponse>;
14
+ export declare function sendAftRequests(binaryPath: string, requests: AftRequest[]): Promise<AftResponse[]>;
15
+ //# sourceMappingURL=aft-bridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aft-bridge.d.ts","sourceRoot":"","sources":["../../src/lib/aft-bridge.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wBAAsB,cAAc,CAClC,UAAU,EAAE,MAAM,EAClB,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,WAAW,CAAC,CAKtB;AAED,wBAAsB,eAAe,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,UAAU,EAAE,GACrB,OAAO,CAAC,WAAW,EAAE,CAAC,CAgExB"}
@@ -8,4 +8,6 @@
8
8
  * not an exception.
9
9
  */
10
10
  export declare function probeBinaryVersion(preferredVersion?: string): string | null;
11
+ export declare function platformKey(platform?: string, arch?: string): string | null;
12
+ export declare function findAftBinary(preferredVersion?: string): string | null;
11
13
  //# sourceMappingURL=binary-probe.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"binary-probe.d.ts","sourceRoot":"","sources":["../../src/lib/binary-probe.ts"],"names":[],"mappings":"AAWA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgC3E"}
1
+ {"version":3,"file":"binary-probe.d.ts","sourceRoot":"","sources":["../../src/lib/binary-probe.ts"],"names":[],"mappings":"AAaA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAgC3E;AAED,wBAAgB,WAAW,CACzB,QAAQ,GAAE,MAAyB,EACnC,IAAI,GAAE,MAAqB,GAC1B,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,aAAa,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkCtE"}
@@ -1,5 +1,6 @@
1
1
  import type { HarnessAdapter } from "../adapters/types.js";
2
2
  import { type BinaryCacheInfo } from "./binary-cache.js";
3
+ import { type LspCacheReport } from "./lsp-cache.js";
3
4
  export interface DiagnosticReport {
4
5
  timestamp: string;
5
6
  platform: string;
@@ -9,6 +10,8 @@ export interface DiagnosticReport {
9
10
  binaryVersion: string | null;
10
11
  harnesses: HarnessDiagnostic[];
11
12
  binaryCache: BinaryCacheInfo;
13
+ /** LSP package and binary caches populated by plugin auto-install. */
14
+ lspCache: LspCacheReport;
12
15
  }
13
16
  export interface HarnessDiagnostic {
14
17
  kind: string;
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostics.d.ts","sourceRoot":"","sources":["../../src/lib/diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,mBAAmB,CAAC;AAe7E,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,SAAS,EAAE,iBAAiB,EAAE,CAAC;IAC/B,WAAW,EAAE,eAAe,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,WAAW,EAAE,UAAU,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC7D,SAAS,EAAE;QACT,MAAM,EAAE,OAAO,CAAC;QAChB,UAAU,CAAC,E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I,CAAC;QAC7B,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;QACjC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;QAC1B,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;QAC7B,gBAAgB,EAAE,OAAO,GAAG,IAAI,CAAC;QACjC,QAAQ,EAAE,MAAM,CAAC;QACjB,WAAW,EAAE,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;AAgED,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA0D1E;AAED,yDAAyD;AACzD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ/D"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Inspection and cleanup helpers for the AFT plugin's LSP cache.
3
+ *
4
+ * Two roots are populated by the plugin auto-installer at startup:
5
+ *
6
+ * <aft-cache-root>/lsp-packages/<urlencoded-pkg>/ ← npm installs
7
+ * <aft-cache-root>/lsp-binaries/<id>/ ← GitHub-release downloads
8
+ *
9
+ * The CLI reports their disk usage in `aft doctor` and can purge them via
10
+ * `aft doctor --force`. Purging is non-destructive in the sense that the
11
+ * plugin will simply re-install whatever the project needs on next session;
12
+ * it does not delete user-installed binaries (those live on PATH).
13
+ */
14
+ export interface LspCacheEntry {
15
+ /** Display name (npm package name or GitHub server id). */
16
+ name: string;
17
+ /** Absolute path to the entry root. */
18
+ path: string;
19
+ /** Total bytes occupied by this entry. */
20
+ size: number;
21
+ }
22
+ export interface LspCacheReport {
23
+ /** npm-installed servers (`<root>/lsp-packages/`). */
24
+ npm: {
25
+ path: string;
26
+ entries: LspCacheEntry[];
27
+ totalSize: number;
28
+ };
29
+ /** GitHub-installed servers (`<root>/lsp-binaries/`). */
30
+ github: {
31
+ path: string;
32
+ entries: LspCacheEntry[];
33
+ totalSize: number;
34
+ };
35
+ /** Combined size of both subtrees. Convenience for the doctor display. */
36
+ totalSize: number;
37
+ }
38
+ /** Build a full inspection report for both LSP cache subtrees. */
39
+ export declare function getLspCacheReport(): LspCacheReport;
40
+ export interface ClearResult {
41
+ cleared: {
42
+ name: string;
43
+ path: string;
44
+ size: number;
45
+ }[];
46
+ errors: {
47
+ path: string;
48
+ error: string;
49
+ }[];
50
+ totalBytes: number;
51
+ }
52
+ /**
53
+ * Remove every entry under both LSP cache subtrees.
54
+ *
55
+ * Returns metadata for the doctor output (number of entries cleared, bytes
56
+ * reclaimed, individual failures). Errors don't abort — we want to clean
57
+ * as much as possible even when some directories are locked or have unusual
58
+ * permissions.
59
+ */
60
+ export declare function clearLspCaches(): ClearResult;
61
+ //# sourceMappingURL=lsp-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"lsp-cache.d.ts","sourceRoot":"","sources":["../../src/lib/lsp-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAOH,MAAM,WAAW,aAAa;IAC5B,2DAA2D;IAC3D,IAAI,EAAE,MAAM,CAAC;IACb,uCAAuC;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,cAAc;IAC7B,sDAAsD;IACtD,GAAG,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,aAAa,EAAE,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,yDAAyD;IACzD,MAAM,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,aAAa,EAAE,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAC;CACnB;AA0CD,kEAAkE;AAClE,wBAAgB,iBAAiB,IAAI,cAAc,CAkBlD;AAED,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IACxD,MAAM,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC1C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAkB5C"}
@@ -1,6 +1,20 @@
1
1
  /** `~/.cache/aft/bin/` (or the platform equivalent) — same as plugin's `getCacheDir`. */
2
2
  export declare function getAftBinaryCacheDir(): string;
3
3
  export declare function getAftBinaryName(): string;
4
+ /**
5
+ * Root of the LSP package cache populated by the OpenCode/Pi plugin.
6
+ *
7
+ * `~/.cache/aft/lsp-packages/<urlencoded-pkg>/node_modules/.bin/<binary>` for
8
+ * npm-distributed servers (typescript-language-server, pyright, etc.).
9
+ */
10
+ export declare function getAftLspPackagesDir(): string;
11
+ /**
12
+ * Root of the LSP binary cache populated by the OpenCode/Pi plugin.
13
+ *
14
+ * `~/.cache/aft/lsp-binaries/<id>/bin/<binary>` for GitHub-distributed
15
+ * servers (clangd, lua-ls, zls, tinymist, texlab).
16
+ */
17
+ export declare function getAftLspBinariesDir(): string;
4
18
  /** Resolve the plugin log file path. Shared with the plugin's logger. */
5
19
  export declare function getTmpLogPath(filename: string): string;
6
20
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAGA,yFAAyF;AACzF,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/lib/paths.ts"],"names":[],"mappings":"AAGA,yFAAyF;AACzF,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,wBAAgB,gBAAgB,IAAI,MAAM,CAEzC;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,CAW7C;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEtD"}
@@ -13,7 +13,7 @@ interface PromptOption<T extends string> {
13
13
  recommended?: boolean;
14
14
  }
15
15
  export declare function selectOne<T extends string>(message: string, options: PromptOption<T>[]): Promise<T>;
16
- export declare function selectMany<T extends string>(message: string, options: PromptOption<T>[], initialValues?: T[]): Promise<T[]>;
16
+ export declare function selectMany<T extends string>(message: string, options: PromptOption<T>[], initialValues?: T[], required?: boolean): Promise<T[]>;
17
17
  export declare function text(message: string, options?: {
18
18
  placeholder?: string;
19
19
  defaultValue?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/lib/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,EAEL,GAAG,EAEH,IAAI,EACJ,KAAK,EAEL,OAAO,EACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;AAS5C,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CAOlF;AAED;;;;GAIG;AACH,UAAU,YAAY,CAAC,CAAC,SAAS,MAAM;IACrC,KAAK,EAA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M,CAAC;IACd,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,EAC9C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,GACzB,OAAO,CAAC,CAAC,CAAC,CAWZ;AAED,wBAAsB,UAAU,CAAC,CAAC,SAAS,MAAM,EAC/C,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,EAAE,EAC1B,aAAa,CAAC,EAAE,CAAC,EAAE,EACnB,QAAQ,UAAO,GACd,OAAO,CAAC,CAAC,EAAE,CAAC,CAcd;AAED,wBAAsB,IAAI,CACxB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,CAAC;CACrD,GACL,OAAO,CAAC,MAAM,CAAC,CAcjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/aft",
3
- "version": "0.16.1",
3
+ "version": "0.17.1",
4
4
  "type": "module",
5
5
  "description": "Unified CLI for Agent File Tools (AFT) — setup, doctor, and diagnostics across supported agent harnesses (OpenCode, Pi)",
6
6
  "license": "MIT",