@cortexkit/aft 0.40.0 → 0.40.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/dist/adapters/opencode.d.ts.map +1 -1
- package/dist/adapters/pi.d.ts.map +1 -1
- package/dist/index.js +181 -161
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/adapters/opencode.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"opencode.d.ts","sourceRoot":"","sources":["../../src/adapters/opencode.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAkIpB,qBAAa,eAAgB,YAAW,cAAc;IACpD,QAAQ,CAAC,IAAI,EAAG,UAAU,CAAU;IACpC,QAAQ,CAAC,WAAW,cAAc;IAClC,QAAQ,CAAC,iBAAiB,6BAAe;IACzC,QAAQ,CAAC,sBAAsB,oCAAgB;IAE/C,WAAW,IAAI,OAAO;IAqBtB,cAAc,IAAI,MAAM,GAAG,IAAI;IAY/B,iBAAiB,IAAI,kBAAkB;IAqBvC,cAAc,IAAI,OAAO;IAOnB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAkDrD,kBAAkB,IAAI,eAAe;IA0BrC,aAAa,IAAI,MAAM;IAIvB,UAAU,IAAI,MAAM;IAIpB,cAAc,IAAI,MAAM;IAIlB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC;QAC9C,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;IAgCF,qEAAqE;IACrE,mBAAmB,IAAI,MAAM;IAI7B,mEAAmE;IACnE,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAUlD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AASA,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;IAUtB,cAAc,IAAI,MAAM,GAAG,IAAI;IAwB/B,iBAAiB,IAAI,kBAAkB;IAoBvC,cAAc,IAAI,OAAO;IAInB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAmCrD,kBAAkB,IAAI,eAAe;IA6BrC,aAAa,IAAI,MAAM;IAIvB,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"}
|
package/dist/index.js
CHANGED
|
@@ -1062,6 +1062,22 @@ var init_downloader = __esm(() => {
|
|
|
1062
1062
|
DOWNLOAD_LOCK_STALE_MS = 10 * 60000;
|
|
1063
1063
|
});
|
|
1064
1064
|
// ../aft-bridge/dist/paths.js
|
|
1065
|
+
import { homedir as homedir2 } from "node:os";
|
|
1066
|
+
import { dirname, isAbsolute, join as join2, resolve as resolve2 } from "node:path";
|
|
1067
|
+
function homeDir() {
|
|
1068
|
+
if (process.platform === "win32")
|
|
1069
|
+
return process.env.USERPROFILE || process.env.HOME || homedir2();
|
|
1070
|
+
return process.env.HOME || homedir2();
|
|
1071
|
+
}
|
|
1072
|
+
function configHome() {
|
|
1073
|
+
const xdg = process.env.XDG_CONFIG_HOME;
|
|
1074
|
+
if (xdg && isAbsolute(xdg))
|
|
1075
|
+
return xdg;
|
|
1076
|
+
return join2(homeDir(), ".config");
|
|
1077
|
+
}
|
|
1078
|
+
function resolveCortexKitUserConfigPath() {
|
|
1079
|
+
return join2(configHome(), "cortexkit", "aft.jsonc");
|
|
1080
|
+
}
|
|
1065
1081
|
var init_paths = () => {};
|
|
1066
1082
|
|
|
1067
1083
|
// ../aft-bridge/dist/resolver.js
|
|
@@ -1113,13 +1129,13 @@ var init_migration = __esm(() => {
|
|
|
1113
1129
|
|
|
1114
1130
|
// ../aft-bridge/dist/npm-resolver.js
|
|
1115
1131
|
import { readdirSync, statSync } from "node:fs";
|
|
1116
|
-
import { homedir as
|
|
1117
|
-
import { delimiter, dirname, isAbsolute, join as
|
|
1132
|
+
import { homedir as homedir3 } from "node:os";
|
|
1133
|
+
import { delimiter, dirname as dirname2, isAbsolute as isAbsolute2, join as join3 } from "node:path";
|
|
1118
1134
|
function defaultDeps() {
|
|
1119
1135
|
return {
|
|
1120
1136
|
platform: process.platform,
|
|
1121
1137
|
env: process.env,
|
|
1122
|
-
home:
|
|
1138
|
+
home: homedir3(),
|
|
1123
1139
|
execPath: process.execPath
|
|
1124
1140
|
};
|
|
1125
1141
|
}
|
|
@@ -1138,16 +1154,16 @@ function npmFromPath(deps) {
|
|
|
1138
1154
|
const raw = deps.env.PATH ?? deps.env.Path ?? "";
|
|
1139
1155
|
for (const entry of raw.split(delimiter)) {
|
|
1140
1156
|
const dir = entry.trim().replace(/^"|"$/g, "");
|
|
1141
|
-
if (!dir || !
|
|
1157
|
+
if (!dir || !isAbsolute2(dir))
|
|
1142
1158
|
continue;
|
|
1143
|
-
if (isFile(
|
|
1159
|
+
if (isFile(join3(dir, name)))
|
|
1144
1160
|
return dir;
|
|
1145
1161
|
}
|
|
1146
1162
|
return null;
|
|
1147
1163
|
}
|
|
1148
1164
|
function npmAdjacentToNode(deps) {
|
|
1149
|
-
const dir =
|
|
1150
|
-
return isFile(
|
|
1165
|
+
const dir = dirname2(deps.execPath);
|
|
1166
|
+
return isFile(join3(dir, npmBinaryName(deps.platform))) ? dir : null;
|
|
1151
1167
|
}
|
|
1152
1168
|
function highestVersionedNodeBin(installsDir, name) {
|
|
1153
1169
|
let entries;
|
|
@@ -1156,8 +1172,8 @@ function highestVersionedNodeBin(installsDir, name) {
|
|
|
1156
1172
|
} catch {
|
|
1157
1173
|
return null;
|
|
1158
1174
|
}
|
|
1159
|
-
const candidates = entries.filter((v) => isFile(
|
|
1160
|
-
return candidates.length > 0 ?
|
|
1175
|
+
const candidates = entries.filter((v) => isFile(join3(installsDir, v, "bin", name))).sort((a, b) => compareVersionsDesc(a, b));
|
|
1176
|
+
return candidates.length > 0 ? join3(installsDir, candidates[0], "bin") : null;
|
|
1161
1177
|
}
|
|
1162
1178
|
function compareVersionsDesc(a, b) {
|
|
1163
1179
|
const pa = a.replace(/^v/, "").split(".").map((n) => Number.parseInt(n, 10));
|
|
@@ -1182,22 +1198,22 @@ function wellKnownNpmDirs(deps) {
|
|
|
1182
1198
|
const programFiles = env.ProgramFiles || "C:\\Program Files";
|
|
1183
1199
|
const appData = env.APPDATA;
|
|
1184
1200
|
const localAppData = env.LOCALAPPDATA;
|
|
1185
|
-
push(
|
|
1201
|
+
push(join3(programFiles, "nodejs"));
|
|
1186
1202
|
if (appData)
|
|
1187
|
-
push(
|
|
1203
|
+
push(join3(appData, "npm"));
|
|
1188
1204
|
if (localAppData)
|
|
1189
|
-
push(
|
|
1205
|
+
push(join3(localAppData, "Volta", "bin"));
|
|
1190
1206
|
if (env.NVM_SYMLINK)
|
|
1191
1207
|
push(env.NVM_SYMLINK);
|
|
1192
1208
|
} else {
|
|
1193
1209
|
if (env.NVM_BIN)
|
|
1194
1210
|
push(env.NVM_BIN);
|
|
1195
|
-
push(highestVersionedNodeBin(
|
|
1196
|
-
push(highestVersionedNodeBin(
|
|
1197
|
-
push(highestVersionedNodeBin(
|
|
1198
|
-
push(
|
|
1199
|
-
push(
|
|
1200
|
-
const systemDirs = deps.systemNpmDirs ?? (platform === "darwin" ? ["/opt/homebrew/bin", "/usr/local/bin"] : ["/usr/local/bin", "/usr/bin",
|
|
1211
|
+
push(highestVersionedNodeBin(join3(home, ".nvm", "versions", "node"), name));
|
|
1212
|
+
push(highestVersionedNodeBin(join3(home, ".local", "share", "mise", "installs", "node"), name));
|
|
1213
|
+
push(highestVersionedNodeBin(join3(home, ".asdf", "installs", "nodejs"), name));
|
|
1214
|
+
push(join3(home, ".volta", "bin"));
|
|
1215
|
+
push(join3(home, ".asdf", "shims"));
|
|
1216
|
+
const systemDirs = deps.systemNpmDirs ?? (platform === "darwin" ? ["/opt/homebrew/bin", "/usr/local/bin"] : ["/usr/local/bin", "/usr/bin", join3(home, ".local", "bin")]);
|
|
1201
1217
|
for (const dir of systemDirs)
|
|
1202
1218
|
push(dir);
|
|
1203
1219
|
}
|
|
@@ -1207,12 +1223,12 @@ function resolveNpm(deps = defaultDeps()) {
|
|
|
1207
1223
|
const name = npmBinaryName(deps.platform);
|
|
1208
1224
|
const onPath = npmFromPath(deps);
|
|
1209
1225
|
if (onPath)
|
|
1210
|
-
return { command:
|
|
1226
|
+
return { command: join3(onPath, name), binDir: onPath };
|
|
1211
1227
|
const adjacent = npmAdjacentToNode(deps);
|
|
1212
1228
|
if (adjacent)
|
|
1213
|
-
return { command:
|
|
1229
|
+
return { command: join3(adjacent, name), binDir: adjacent };
|
|
1214
1230
|
for (const dir of wellKnownNpmDirs(deps)) {
|
|
1215
|
-
const candidate =
|
|
1231
|
+
const candidate = join3(dir, name);
|
|
1216
1232
|
if (isFile(candidate))
|
|
1217
1233
|
return { command: candidate, binDir: dir };
|
|
1218
1234
|
}
|
|
@@ -1272,14 +1288,14 @@ var init_onnx_runtime = __esm(() => {
|
|
|
1272
1288
|
|
|
1273
1289
|
// ../aft-bridge/dist/project-identity.js
|
|
1274
1290
|
import { realpathSync } from "node:fs";
|
|
1275
|
-
import { resolve as
|
|
1291
|
+
import { resolve as resolve3 } from "node:path";
|
|
1276
1292
|
function canonicalizeProjectRoot(dir) {
|
|
1277
1293
|
const trimmed = dir.replace(/[/\\]+$/, "");
|
|
1278
1294
|
let canonical;
|
|
1279
1295
|
try {
|
|
1280
1296
|
canonical = realpathSync(trimmed);
|
|
1281
1297
|
} catch {
|
|
1282
|
-
canonical =
|
|
1298
|
+
canonical = resolve3(trimmed);
|
|
1283
1299
|
}
|
|
1284
1300
|
return normalizeWindowsRoot(canonical);
|
|
1285
1301
|
}
|
|
@@ -1500,65 +1516,65 @@ var init_dist = __esm(() => {
|
|
|
1500
1516
|
});
|
|
1501
1517
|
|
|
1502
1518
|
// src/lib/paths.ts
|
|
1503
|
-
import { homedir as
|
|
1504
|
-
import { join as
|
|
1519
|
+
import { homedir as homedir4, tmpdir } from "node:os";
|
|
1520
|
+
import { join as join4 } from "node:path";
|
|
1505
1521
|
function getAftBinaryCacheDir() {
|
|
1506
1522
|
if (process.env.AFT_CACHE_DIR) {
|
|
1507
|
-
return
|
|
1523
|
+
return join4(process.env.AFT_CACHE_DIR, "bin");
|
|
1508
1524
|
}
|
|
1509
1525
|
if (process.platform === "win32") {
|
|
1510
1526
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
1511
|
-
const base2 = localAppData ||
|
|
1512
|
-
return
|
|
1527
|
+
const base2 = localAppData || join4(homedir4(), "AppData", "Local");
|
|
1528
|
+
return join4(base2, "aft", "bin");
|
|
1513
1529
|
}
|
|
1514
|
-
const base = process.env.XDG_CACHE_HOME ||
|
|
1515
|
-
return
|
|
1530
|
+
const base = process.env.XDG_CACHE_HOME || join4(homedir4(), ".cache");
|
|
1531
|
+
return join4(base, "aft", "bin");
|
|
1516
1532
|
}
|
|
1517
1533
|
function getAftBinaryName() {
|
|
1518
1534
|
return process.platform === "win32" ? "aft.exe" : "aft";
|
|
1519
1535
|
}
|
|
1520
1536
|
function getAftLspPackagesDir() {
|
|
1521
1537
|
if (process.env.AFT_CACHE_DIR) {
|
|
1522
|
-
return
|
|
1538
|
+
return join4(process.env.AFT_CACHE_DIR, "lsp-packages");
|
|
1523
1539
|
}
|
|
1524
1540
|
if (process.platform === "win32") {
|
|
1525
1541
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
1526
|
-
const base2 = localAppData ||
|
|
1527
|
-
return
|
|
1542
|
+
const base2 = localAppData || join4(homedir4(), "AppData", "Local");
|
|
1543
|
+
return join4(base2, "aft", "lsp-packages");
|
|
1528
1544
|
}
|
|
1529
|
-
const base = process.env.XDG_CACHE_HOME ||
|
|
1530
|
-
return
|
|
1545
|
+
const base = process.env.XDG_CACHE_HOME || join4(homedir4(), ".cache");
|
|
1546
|
+
return join4(base, "aft", "lsp-packages");
|
|
1531
1547
|
}
|
|
1532
1548
|
function getAftLspBinariesDir() {
|
|
1533
1549
|
if (process.env.AFT_CACHE_DIR) {
|
|
1534
|
-
return
|
|
1550
|
+
return join4(process.env.AFT_CACHE_DIR, "lsp-binaries");
|
|
1535
1551
|
}
|
|
1536
1552
|
if (process.platform === "win32") {
|
|
1537
1553
|
const localAppData = process.env.LOCALAPPDATA || process.env.APPDATA;
|
|
1538
|
-
const base2 = localAppData ||
|
|
1539
|
-
return
|
|
1554
|
+
const base2 = localAppData || join4(homedir4(), "AppData", "Local");
|
|
1555
|
+
return join4(base2, "aft", "lsp-binaries");
|
|
1540
1556
|
}
|
|
1541
|
-
const base = process.env.XDG_CACHE_HOME ||
|
|
1542
|
-
return
|
|
1557
|
+
const base = process.env.XDG_CACHE_HOME || join4(homedir4(), ".cache");
|
|
1558
|
+
return join4(base, "aft", "lsp-binaries");
|
|
1543
1559
|
}
|
|
1544
|
-
function
|
|
1560
|
+
function homeDir2() {
|
|
1545
1561
|
if (process.platform === "win32")
|
|
1546
|
-
return process.env.USERPROFILE || process.env.HOME ||
|
|
1547
|
-
return process.env.HOME ||
|
|
1562
|
+
return process.env.USERPROFILE || process.env.HOME || homedir4();
|
|
1563
|
+
return process.env.HOME || homedir4();
|
|
1548
1564
|
}
|
|
1549
1565
|
function dataHome() {
|
|
1550
1566
|
if (process.env.XDG_DATA_HOME)
|
|
1551
1567
|
return process.env.XDG_DATA_HOME;
|
|
1552
1568
|
if (process.platform === "win32") {
|
|
1553
|
-
return process.env.LOCALAPPDATA || process.env.APPDATA ||
|
|
1569
|
+
return process.env.LOCALAPPDATA || process.env.APPDATA || join4(homeDir2(), "AppData", "Local");
|
|
1554
1570
|
}
|
|
1555
|
-
return
|
|
1571
|
+
return join4(homeDir2(), ".local", "share");
|
|
1556
1572
|
}
|
|
1557
1573
|
function getCortexKitStorageRoot() {
|
|
1558
|
-
return
|
|
1574
|
+
return join4(dataHome(), "cortexkit", "aft");
|
|
1559
1575
|
}
|
|
1560
1576
|
function getTmpLogPath(filename) {
|
|
1561
|
-
return
|
|
1577
|
+
return join4(tmpdir(), filename);
|
|
1562
1578
|
}
|
|
1563
1579
|
var init_paths2 = () => {};
|
|
1564
1580
|
|
|
@@ -1566,8 +1582,8 @@ var init_paths2 = () => {};
|
|
|
1566
1582
|
import { execSync, spawnSync } from "node:child_process";
|
|
1567
1583
|
import { existsSync as existsSync3 } from "node:fs";
|
|
1568
1584
|
import { createRequire } from "node:module";
|
|
1569
|
-
import { homedir as
|
|
1570
|
-
import { join as
|
|
1585
|
+
import { homedir as homedir5 } from "node:os";
|
|
1586
|
+
import { join as join5 } from "node:path";
|
|
1571
1587
|
async function loadPluginVersion() {
|
|
1572
1588
|
try {
|
|
1573
1589
|
const bridgePackageName = "@cortexkit/aft-bridge";
|
|
@@ -1690,7 +1706,7 @@ function aftBinaryCandidates(preferredVersion) {
|
|
|
1690
1706
|
const candidates = [];
|
|
1691
1707
|
if (preferredVersion) {
|
|
1692
1708
|
const tag = preferredVersion.startsWith("v") ? preferredVersion : `v${preferredVersion}`;
|
|
1693
|
-
pushCandidate(candidates,
|
|
1709
|
+
pushCandidate(candidates, join5(getAftBinaryCacheDir(), tag, getAftBinaryName()));
|
|
1694
1710
|
}
|
|
1695
1711
|
const key = platformKey2();
|
|
1696
1712
|
if (key) {
|
|
@@ -1713,7 +1729,7 @@ function aftBinaryCandidates(preferredVersion) {
|
|
|
1713
1729
|
}
|
|
1714
1730
|
}
|
|
1715
1731
|
} catch {}
|
|
1716
|
-
pushCandidate(candidates,
|
|
1732
|
+
pushCandidate(candidates, join5(homedir5(), ".cargo", "bin", getAftBinaryName()));
|
|
1717
1733
|
return candidates;
|
|
1718
1734
|
}
|
|
1719
1735
|
function findAftBinary(preferredVersion) {
|
|
@@ -1729,7 +1745,7 @@ var init_binary_probe = __esm(async () => {
|
|
|
1729
1745
|
|
|
1730
1746
|
// src/lib/fs-util.ts
|
|
1731
1747
|
import { existsSync as existsSync4, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
1732
|
-
import { join as
|
|
1748
|
+
import { join as join6 } from "node:path";
|
|
1733
1749
|
function dirSize(path) {
|
|
1734
1750
|
if (!existsSync4(path)) {
|
|
1735
1751
|
return 0;
|
|
@@ -1743,7 +1759,7 @@ function dirSize(path) {
|
|
|
1743
1759
|
}
|
|
1744
1760
|
let total = 0;
|
|
1745
1761
|
for (const entry of readdirSync2(path)) {
|
|
1746
|
-
total += dirSize(
|
|
1762
|
+
total += dirSize(join6(path, entry));
|
|
1747
1763
|
}
|
|
1748
1764
|
return total;
|
|
1749
1765
|
}
|
|
@@ -9366,10 +9382,10 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
9366
9382
|
replacer = null;
|
|
9367
9383
|
indent = EMPTY;
|
|
9368
9384
|
};
|
|
9369
|
-
var
|
|
9385
|
+
var join7 = (one, two, gap) => one ? two ? one + two.trim() + LF + gap : one.trimRight() + repeat_line_breaks(Math.max(1, count_trailing_line_breaks(one, gap)), gap) : two ? two.trimRight() + repeat_line_breaks(Math.max(1, count_trailing_line_breaks(two, gap)), gap) : EMPTY;
|
|
9370
9386
|
var join_content = (inside, value, gap) => {
|
|
9371
9387
|
const comment = process_comments(value, PREFIX_BEFORE, gap + indent, true);
|
|
9372
|
-
return
|
|
9388
|
+
return join7(comment, inside, gap);
|
|
9373
9389
|
};
|
|
9374
9390
|
var stringify_string = (holder, key, value) => {
|
|
9375
9391
|
const raw = get_raw_string_literal(holder, key);
|
|
@@ -9391,13 +9407,13 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
9391
9407
|
if (i !== 0) {
|
|
9392
9408
|
inside += COMMA;
|
|
9393
9409
|
}
|
|
9394
|
-
const before =
|
|
9410
|
+
const before = join7(after_comma, process_comments(value, BEFORE(i), deeper_gap), deeper_gap);
|
|
9395
9411
|
inside += before || LF + deeper_gap;
|
|
9396
9412
|
inside += stringify(i, value, deeper_gap) || STR_NULL;
|
|
9397
9413
|
inside += process_comments(value, AFTER_VALUE(i), deeper_gap);
|
|
9398
9414
|
after_comma = process_comments(value, AFTER(i), deeper_gap);
|
|
9399
9415
|
}
|
|
9400
|
-
inside +=
|
|
9416
|
+
inside += join7(after_comma, process_comments(value, PREFIX_AFTER, deeper_gap), deeper_gap);
|
|
9401
9417
|
return BRACKET_OPEN + join_content(inside, value, gap) + BRACKET_CLOSE;
|
|
9402
9418
|
};
|
|
9403
9419
|
var object_stringify = (value, gap) => {
|
|
@@ -9418,13 +9434,13 @@ var require_stringify = __commonJS((exports, module) => {
|
|
|
9418
9434
|
inside += COMMA;
|
|
9419
9435
|
}
|
|
9420
9436
|
first = false;
|
|
9421
|
-
const before =
|
|
9437
|
+
const before = join7(after_comma, process_comments(value, BEFORE(key), deeper_gap), deeper_gap);
|
|
9422
9438
|
inside += before || LF + deeper_gap;
|
|
9423
9439
|
inside += quote(key) + process_comments(value, AFTER_PROP(key), deeper_gap) + COLON + process_comments(value, AFTER_COLON(key), deeper_gap) + SPACE + sv + process_comments(value, AFTER_VALUE(key), deeper_gap);
|
|
9424
9440
|
after_comma = process_comments(value, AFTER(key), deeper_gap);
|
|
9425
9441
|
};
|
|
9426
9442
|
keys.forEach(iteratee);
|
|
9427
|
-
inside +=
|
|
9443
|
+
inside += join7(after_comma, process_comments(value, PREFIX_AFTER, deeper_gap), deeper_gap);
|
|
9428
9444
|
return CURLY_BRACKET_OPEN + join_content(inside, value, gap) + CURLY_BRACKET_CLOSE;
|
|
9429
9445
|
};
|
|
9430
9446
|
function stringify(key, holder, gap) {
|
|
@@ -9518,7 +9534,7 @@ var require_src2 = __commonJS((exports, module) => {
|
|
|
9518
9534
|
|
|
9519
9535
|
// src/lib/jsonc.ts
|
|
9520
9536
|
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "node:fs";
|
|
9521
|
-
import { dirname as
|
|
9537
|
+
import { dirname as dirname3 } from "node:path";
|
|
9522
9538
|
function detectJsoncFile(configDir, baseName) {
|
|
9523
9539
|
const jsoncPath = `${configDir}/${baseName}.jsonc`;
|
|
9524
9540
|
const jsonPath = `${configDir}/${baseName}.json`;
|
|
@@ -9546,7 +9562,7 @@ function readJsoncFile(path) {
|
|
|
9546
9562
|
}
|
|
9547
9563
|
}
|
|
9548
9564
|
function writeJsoncFile(path, value, format = "json") {
|
|
9549
|
-
mkdirSync2(
|
|
9565
|
+
mkdirSync2(dirname3(path), { recursive: true });
|
|
9550
9566
|
const serialized = format === "jsonc" ? import_comment_json.stringify(value, null, 2) : JSON.stringify(value, null, 2);
|
|
9551
9567
|
writeFileSync(path, `${serialized}
|
|
9552
9568
|
`);
|
|
@@ -9606,25 +9622,25 @@ var init_self_version = () => {};
|
|
|
9606
9622
|
// src/adapters/opencode.ts
|
|
9607
9623
|
import { execSync as execSync2 } from "node:child_process";
|
|
9608
9624
|
import { existsSync as existsSync6, readFileSync as readFileSync3, rmSync, statSync as statSync3 } from "node:fs";
|
|
9609
|
-
import { homedir as
|
|
9610
|
-
import { dirname as
|
|
9625
|
+
import { homedir as homedir6 } from "node:os";
|
|
9626
|
+
import { dirname as dirname4, join as join7, parse, resolve as resolve4 } from "node:path";
|
|
9611
9627
|
import { fileURLToPath } from "node:url";
|
|
9612
9628
|
function getOpenCodeConfigDir() {
|
|
9613
9629
|
const envDir = process.env.OPENCODE_CONFIG_DIR?.trim();
|
|
9614
9630
|
if (envDir)
|
|
9615
|
-
return
|
|
9616
|
-
const xdg = process.env.XDG_CONFIG_HOME ||
|
|
9617
|
-
return
|
|
9631
|
+
return resolve4(envDir);
|
|
9632
|
+
const xdg = process.env.XDG_CONFIG_HOME || join7(homedir6(), ".config");
|
|
9633
|
+
return join7(xdg, "opencode");
|
|
9618
9634
|
}
|
|
9619
9635
|
function getOpenCodeCacheDir() {
|
|
9620
9636
|
const xdg = process.env.XDG_CACHE_HOME;
|
|
9621
9637
|
if (xdg)
|
|
9622
|
-
return
|
|
9638
|
+
return join7(xdg, "opencode");
|
|
9623
9639
|
if (process.platform === "win32") {
|
|
9624
|
-
const localAppData = process.env.LOCALAPPDATA ??
|
|
9625
|
-
return
|
|
9640
|
+
const localAppData = process.env.LOCALAPPDATA ?? join7(homedir6(), "AppData", "Local");
|
|
9641
|
+
return join7(localAppData, "opencode");
|
|
9626
9642
|
}
|
|
9627
|
-
return
|
|
9643
|
+
return join7(homedir6(), ".cache", "opencode");
|
|
9628
9644
|
}
|
|
9629
9645
|
function hasOpenCodeCli() {
|
|
9630
9646
|
try {
|
|
@@ -9637,12 +9653,12 @@ function hasOpenCodeCli() {
|
|
|
9637
9653
|
function openCodeDesktopAppExists() {
|
|
9638
9654
|
const candidates = [];
|
|
9639
9655
|
if (process.platform === "darwin") {
|
|
9640
|
-
candidates.push("/Applications/OpenCode.app", "/Applications/OpenCode Beta.app",
|
|
9656
|
+
candidates.push("/Applications/OpenCode.app", "/Applications/OpenCode Beta.app", join7(homedir6(), "Applications", "OpenCode.app"), join7(homedir6(), "Applications", "OpenCode Beta.app"));
|
|
9641
9657
|
} else if (process.platform === "win32") {
|
|
9642
|
-
const localAppData = process.env.LOCALAPPDATA ??
|
|
9643
|
-
candidates.push(
|
|
9658
|
+
const localAppData = process.env.LOCALAPPDATA ?? join7(homedir6(), "AppData", "Local");
|
|
9659
|
+
candidates.push(join7(localAppData, "Programs", "opencode"), join7(localAppData, "opencode"));
|
|
9644
9660
|
} else {
|
|
9645
|
-
candidates.push("/opt/OpenCode", "/usr/lib/opencode",
|
|
9661
|
+
candidates.push("/opt/OpenCode", "/usr/lib/opencode", join7(homedir6(), ".local", "share", "applications", "opencode.desktop"));
|
|
9646
9662
|
}
|
|
9647
9663
|
return candidates.some((p) => {
|
|
9648
9664
|
try {
|
|
@@ -9671,15 +9687,15 @@ function pathPointsToOurPlugin(entry) {
|
|
|
9671
9687
|
try {
|
|
9672
9688
|
if (!existsSync6(fsPath))
|
|
9673
9689
|
return false;
|
|
9674
|
-
let searchDir = statSync3(fsPath).isDirectory() ? fsPath :
|
|
9690
|
+
let searchDir = statSync3(fsPath).isDirectory() ? fsPath : dirname4(fsPath);
|
|
9675
9691
|
let pkgJsonPath = null;
|
|
9676
9692
|
while (true) {
|
|
9677
|
-
const candidate =
|
|
9693
|
+
const candidate = join7(searchDir, "package.json");
|
|
9678
9694
|
if (existsSync6(candidate)) {
|
|
9679
9695
|
pkgJsonPath = candidate;
|
|
9680
9696
|
break;
|
|
9681
9697
|
}
|
|
9682
|
-
const parent =
|
|
9698
|
+
const parent = dirname4(searchDir);
|
|
9683
9699
|
if (parent === searchDir || searchDir === parse(searchDir).root)
|
|
9684
9700
|
break;
|
|
9685
9701
|
searchDir = parent;
|
|
@@ -9726,14 +9742,15 @@ class OpenCodeAdapter {
|
|
|
9726
9742
|
detectConfigPaths() {
|
|
9727
9743
|
const configDir = getOpenCodeConfigDir();
|
|
9728
9744
|
const harness = detectJsoncFile(configDir, "opencode");
|
|
9729
|
-
const
|
|
9745
|
+
const aftConfigPath = resolveCortexKitUserConfigPath();
|
|
9746
|
+
const aftConfigExists = existsSync6(aftConfigPath);
|
|
9730
9747
|
const tui = detectJsoncFile(configDir, "tui");
|
|
9731
9748
|
return {
|
|
9732
9749
|
configDir,
|
|
9733
9750
|
harnessConfig: harness.path,
|
|
9734
9751
|
harnessConfigFormat: harness.format,
|
|
9735
|
-
aftConfig:
|
|
9736
|
-
aftConfigFormat:
|
|
9752
|
+
aftConfig: aftConfigPath,
|
|
9753
|
+
aftConfigFormat: aftConfigExists ? "jsonc" : "none",
|
|
9737
9754
|
tuiConfig: tui.path,
|
|
9738
9755
|
tuiConfigFormat: tui.format
|
|
9739
9756
|
};
|
|
@@ -9787,10 +9804,10 @@ class OpenCodeAdapter {
|
|
|
9787
9804
|
};
|
|
9788
9805
|
}
|
|
9789
9806
|
getPluginCacheInfo() {
|
|
9790
|
-
const path =
|
|
9807
|
+
const path = join7(getOpenCodeCacheDir(), "packages", PLUGIN_ENTRY);
|
|
9791
9808
|
let cached;
|
|
9792
9809
|
try {
|
|
9793
|
-
const installedPkgPath =
|
|
9810
|
+
const installedPkgPath = join7(path, "node_modules", "@cortexkit", "aft-opencode", "package.json");
|
|
9794
9811
|
if (existsSync6(installedPkgPath)) {
|
|
9795
9812
|
const pkg = JSON.parse(readFileSync3(installedPkgPath, "utf-8"));
|
|
9796
9813
|
cached = typeof pkg.version === "string" ? pkg.version : undefined;
|
|
@@ -9851,16 +9868,17 @@ class OpenCodeAdapter {
|
|
|
9851
9868
|
describeStorageSubtrees() {
|
|
9852
9869
|
const storage = this.getStorageDir();
|
|
9853
9870
|
return {
|
|
9854
|
-
index: dirSize(
|
|
9855
|
-
semantic: dirSize(
|
|
9856
|
-
backups: dirSize(
|
|
9857
|
-
url_cache: dirSize(
|
|
9858
|
-
onnxruntime: dirSize(
|
|
9871
|
+
index: dirSize(join7(storage, "index")),
|
|
9872
|
+
semantic: dirSize(join7(storage, "semantic")),
|
|
9873
|
+
backups: dirSize(join7(storage, "backups")),
|
|
9874
|
+
url_cache: dirSize(join7(storage, "url_cache")),
|
|
9875
|
+
onnxruntime: dirSize(join7(storage, "onnxruntime"))
|
|
9859
9876
|
};
|
|
9860
9877
|
}
|
|
9861
9878
|
}
|
|
9862
9879
|
var PLUGIN_NAME = "@cortexkit/aft-opencode", PLUGIN_ENTRY;
|
|
9863
9880
|
var init_opencode = __esm(() => {
|
|
9881
|
+
init_dist();
|
|
9864
9882
|
init_fs_util();
|
|
9865
9883
|
init_jsonc();
|
|
9866
9884
|
init_paths2();
|
|
@@ -9871,15 +9889,15 @@ var init_opencode = __esm(() => {
|
|
|
9871
9889
|
// src/adapters/pi.ts
|
|
9872
9890
|
import { execSync as execSync3, spawnSync as spawnSync2 } from "node:child_process";
|
|
9873
9891
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
9874
|
-
import { homedir as
|
|
9875
|
-
import { join as
|
|
9892
|
+
import { homedir as homedir7 } from "node:os";
|
|
9893
|
+
import { join as join8 } from "node:path";
|
|
9876
9894
|
function getPiAgentDir() {
|
|
9877
9895
|
const envHome = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
|
|
9878
|
-
const home = envHome && envHome.length > 0 ? envHome :
|
|
9879
|
-
return
|
|
9896
|
+
const home = envHome && envHome.length > 0 ? envHome : homedir7();
|
|
9897
|
+
return join8(home, ".pi", "agent");
|
|
9880
9898
|
}
|
|
9881
9899
|
function readPiExtensionIndex() {
|
|
9882
|
-
const settingsPath =
|
|
9900
|
+
const settingsPath = join8(getPiAgentDir(), "settings.json");
|
|
9883
9901
|
if (existsSync7(settingsPath)) {
|
|
9884
9902
|
try {
|
|
9885
9903
|
const raw = readFileSync4(settingsPath, "utf-8");
|
|
@@ -9893,10 +9911,10 @@ function readPiExtensionIndex() {
|
|
|
9893
9911
|
} catch {}
|
|
9894
9912
|
}
|
|
9895
9913
|
const candidates = [
|
|
9896
|
-
|
|
9897
|
-
|
|
9898
|
-
|
|
9899
|
-
|
|
9914
|
+
join8(getPiAgentDir(), "extensions.json"),
|
|
9915
|
+
join8(getPiAgentDir(), "extensions.jsonc"),
|
|
9916
|
+
join8(getPiAgentDir(), "config.json"),
|
|
9917
|
+
join8(getPiAgentDir(), "config.jsonc")
|
|
9900
9918
|
];
|
|
9901
9919
|
for (const path of candidates) {
|
|
9902
9920
|
if (!existsSync7(path))
|
|
@@ -9932,14 +9950,14 @@ function piEntryMatchesAft(entry) {
|
|
|
9932
9950
|
} else if (entry.startsWith("/")) {
|
|
9933
9951
|
resolved = entry;
|
|
9934
9952
|
} else if (entry.length > 0) {
|
|
9935
|
-
resolved =
|
|
9953
|
+
resolved = join8(getPiAgentDir(), entry);
|
|
9936
9954
|
}
|
|
9937
9955
|
if (!resolved)
|
|
9938
9956
|
return false;
|
|
9939
9957
|
try {
|
|
9940
9958
|
if (!existsSync7(resolved))
|
|
9941
9959
|
return false;
|
|
9942
|
-
const pkgPath =
|
|
9960
|
+
const pkgPath = join8(resolved, "package.json");
|
|
9943
9961
|
if (!existsSync7(pkgPath))
|
|
9944
9962
|
return false;
|
|
9945
9963
|
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
@@ -9987,13 +10005,14 @@ class PiAdapter {
|
|
|
9987
10005
|
detectConfigPaths() {
|
|
9988
10006
|
const configDir = getPiAgentDir();
|
|
9989
10007
|
const index = readPiExtensionIndex();
|
|
9990
|
-
const
|
|
10008
|
+
const aftConfigPath = resolveCortexKitUserConfigPath();
|
|
10009
|
+
const aftConfigExists = existsSync7(aftConfigPath);
|
|
9991
10010
|
return {
|
|
9992
10011
|
configDir,
|
|
9993
|
-
harnessConfig: index.path ??
|
|
10012
|
+
harnessConfig: index.path ?? join8(configDir, "extensions.json"),
|
|
9994
10013
|
harnessConfigFormat: index.path ? "json" : "none",
|
|
9995
|
-
aftConfig:
|
|
9996
|
-
aftConfigFormat:
|
|
10014
|
+
aftConfig: aftConfigPath,
|
|
10015
|
+
aftConfigFormat: aftConfigExists ? "jsonc" : "none"
|
|
9997
10016
|
};
|
|
9998
10017
|
}
|
|
9999
10018
|
hasPluginEntry() {
|
|
@@ -10035,8 +10054,8 @@ class PiAdapter {
|
|
|
10035
10054
|
}
|
|
10036
10055
|
getPluginCacheInfo() {
|
|
10037
10056
|
const candidates = [
|
|
10038
|
-
|
|
10039
|
-
|
|
10057
|
+
join8(getPiAgentDir(), "node_modules", "@cortexkit", "aft-pi", "package.json"),
|
|
10058
|
+
join8(getPiAgentDir(), "extensions", "node_modules", "@cortexkit", "aft-pi", "package.json")
|
|
10040
10059
|
];
|
|
10041
10060
|
for (const candidate of candidates) {
|
|
10042
10061
|
if (!existsSync7(candidate))
|
|
@@ -10053,7 +10072,7 @@ class PiAdapter {
|
|
|
10053
10072
|
} catch {}
|
|
10054
10073
|
}
|
|
10055
10074
|
return {
|
|
10056
|
-
path:
|
|
10075
|
+
path: join8(getPiAgentDir(), "extensions"),
|
|
10057
10076
|
exists: false
|
|
10058
10077
|
};
|
|
10059
10078
|
}
|
|
@@ -10075,16 +10094,17 @@ class PiAdapter {
|
|
|
10075
10094
|
describeStorageSubtrees() {
|
|
10076
10095
|
const storage = this.getStorageDir();
|
|
10077
10096
|
return {
|
|
10078
|
-
index: dirSize(
|
|
10079
|
-
semantic: dirSize(
|
|
10080
|
-
backups: dirSize(
|
|
10081
|
-
url_cache: dirSize(
|
|
10082
|
-
onnxruntime: dirSize(
|
|
10097
|
+
index: dirSize(join8(storage, "index")),
|
|
10098
|
+
semantic: dirSize(join8(storage, "semantic")),
|
|
10099
|
+
backups: dirSize(join8(storage, "backups")),
|
|
10100
|
+
url_cache: dirSize(join8(storage, "url_cache")),
|
|
10101
|
+
onnxruntime: dirSize(join8(storage, "onnxruntime"))
|
|
10083
10102
|
};
|
|
10084
10103
|
}
|
|
10085
10104
|
}
|
|
10086
10105
|
var PLUGIN_NAME2 = "@cortexkit/aft-pi", PLUGIN_ENTRY2;
|
|
10087
10106
|
var init_pi = __esm(() => {
|
|
10107
|
+
init_dist();
|
|
10088
10108
|
init_fs_util();
|
|
10089
10109
|
init_jsonc();
|
|
10090
10110
|
init_paths2();
|
|
@@ -11696,7 +11716,7 @@ function isResponseForRequest(parsed, expectedIds) {
|
|
|
11696
11716
|
return expectedIds.has(id);
|
|
11697
11717
|
}
|
|
11698
11718
|
async function sendAftRequests(binaryPath, requests) {
|
|
11699
|
-
return new Promise((
|
|
11719
|
+
return new Promise((resolve5, reject) => {
|
|
11700
11720
|
const child = spawn2(binaryPath, [], {
|
|
11701
11721
|
stdio: ["pipe", "pipe", "pipe"]
|
|
11702
11722
|
});
|
|
@@ -11733,7 +11753,7 @@ async function sendAftRequests(binaryPath, requests) {
|
|
|
11733
11753
|
const response = parsed;
|
|
11734
11754
|
responses.push(response);
|
|
11735
11755
|
if (responses.length === requests.length) {
|
|
11736
|
-
finish(() =>
|
|
11756
|
+
finish(() => resolve5(responses));
|
|
11737
11757
|
}
|
|
11738
11758
|
};
|
|
11739
11759
|
child.stdout.setEncoding("utf-8");
|
|
@@ -11809,24 +11829,24 @@ __export(exports_lsp, {
|
|
|
11809
11829
|
findProjectRootForFile: () => findProjectRootForFile
|
|
11810
11830
|
});
|
|
11811
11831
|
import { existsSync as existsSync8, readdirSync as readdirSync3, statSync as statSync4 } from "node:fs";
|
|
11812
|
-
import { dirname as
|
|
11832
|
+
import { dirname as dirname5, join as join9, resolve as resolve5 } from "node:path";
|
|
11813
11833
|
function findProjectRootForFile(filePath, fallbackCwd = process.cwd()) {
|
|
11814
|
-
const resolvedFile =
|
|
11815
|
-
let dir =
|
|
11834
|
+
const resolvedFile = resolve5(fallbackCwd, filePath);
|
|
11835
|
+
let dir = dirname5(resolvedFile);
|
|
11816
11836
|
try {
|
|
11817
11837
|
if (existsSync8(resolvedFile) && statSync4(resolvedFile).isDirectory()) {
|
|
11818
11838
|
dir = resolvedFile;
|
|
11819
11839
|
}
|
|
11820
11840
|
} catch {
|
|
11821
|
-
dir =
|
|
11841
|
+
dir = dirname5(resolvedFile);
|
|
11822
11842
|
}
|
|
11823
11843
|
while (true) {
|
|
11824
|
-
if (PROJECT_ROOT_MARKERS.some((marker) => existsSync8(
|
|
11844
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => existsSync8(join9(dir, marker)))) {
|
|
11825
11845
|
return dir;
|
|
11826
11846
|
}
|
|
11827
|
-
const parent =
|
|
11847
|
+
const parent = dirname5(dir);
|
|
11828
11848
|
if (parent === dir)
|
|
11829
|
-
return
|
|
11849
|
+
return resolve5(fallbackCwd);
|
|
11830
11850
|
dir = parent;
|
|
11831
11851
|
}
|
|
11832
11852
|
}
|
|
@@ -11857,7 +11877,7 @@ async function runLspDoctor(options) {
|
|
|
11857
11877
|
O2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
|
|
11858
11878
|
return 1;
|
|
11859
11879
|
}
|
|
11860
|
-
const resolvedFile =
|
|
11880
|
+
const resolvedFile = resolve5(file);
|
|
11861
11881
|
const projectRoot = findProjectRootForFile(resolvedFile);
|
|
11862
11882
|
const config = buildConfigureParams(adapter, projectRoot);
|
|
11863
11883
|
const inspectRequest = {
|
|
@@ -11944,8 +11964,8 @@ function parseFileArg(argv) {
|
|
|
11944
11964
|
function buildConfigureParams(adapter, projectRoot) {
|
|
11945
11965
|
const userConfigPath = adapter.detectConfigPaths().aftConfig;
|
|
11946
11966
|
const dir = adapter.kind === "pi" ? ".pi" : ".opencode";
|
|
11947
|
-
const projectJsonc =
|
|
11948
|
-
const projectJson =
|
|
11967
|
+
const projectJsonc = join9(projectRoot, dir, "aft.jsonc");
|
|
11968
|
+
const projectJson = join9(projectRoot, dir, "aft.json");
|
|
11949
11969
|
const projectConfigPath = existsSync8(projectJsonc) ? projectJsonc : projectJson;
|
|
11950
11970
|
return {
|
|
11951
11971
|
id: "doctor-lsp-configure",
|
|
@@ -11959,10 +11979,10 @@ function buildConfigureParams(adapter, projectRoot) {
|
|
|
11959
11979
|
function inferLspPathsExtra(_lsp) {
|
|
11960
11980
|
const paths = new Set;
|
|
11961
11981
|
for (const entry of childDirs(getAftLspPackagesDir())) {
|
|
11962
|
-
paths.add(
|
|
11982
|
+
paths.add(join9(entry, "node_modules", ".bin"));
|
|
11963
11983
|
}
|
|
11964
11984
|
for (const entry of childDirs(getAftLspBinariesDir())) {
|
|
11965
|
-
paths.add(
|
|
11985
|
+
paths.add(join9(entry, "bin"));
|
|
11966
11986
|
}
|
|
11967
11987
|
return [...paths];
|
|
11968
11988
|
}
|
|
@@ -11970,7 +11990,7 @@ function childDirs(path) {
|
|
|
11970
11990
|
if (!existsSync8(path))
|
|
11971
11991
|
return [];
|
|
11972
11992
|
try {
|
|
11973
|
-
return readdirSync3(path).map((entry) =>
|
|
11993
|
+
return readdirSync3(path).map((entry) => join9(path, entry)).filter((entry) => {
|
|
11974
11994
|
try {
|
|
11975
11995
|
return statSync4(entry).isDirectory();
|
|
11976
11996
|
} catch {
|
|
@@ -12048,8 +12068,8 @@ __export(exports_doctor_filters, {
|
|
|
12048
12068
|
printDoctorFiltersHelp: () => printDoctorFiltersHelp
|
|
12049
12069
|
});
|
|
12050
12070
|
import { existsSync as existsSync9 } from "node:fs";
|
|
12051
|
-
import { homedir as
|
|
12052
|
-
import { relative, resolve as
|
|
12071
|
+
import { homedir as homedir8 } from "node:os";
|
|
12072
|
+
import { relative, resolve as resolve6 } from "node:path";
|
|
12053
12073
|
function printDoctorFiltersHelp() {
|
|
12054
12074
|
console.log("Usage: aft doctor filters [--show <name>] [trust|untrust]");
|
|
12055
12075
|
console.log("");
|
|
@@ -12084,7 +12104,7 @@ async function runDoctorFilters(options) {
|
|
|
12084
12104
|
O2.error("Could not find the aft binary in the cache, platform package, PATH, or ~/.cargo/bin.");
|
|
12085
12105
|
return 1;
|
|
12086
12106
|
}
|
|
12087
|
-
const projectRoot =
|
|
12107
|
+
const projectRoot = resolve6(process.cwd());
|
|
12088
12108
|
const list = await listFilters(binary, adapter, projectRoot, options.sendRequests ?? sendAftRequests);
|
|
12089
12109
|
if (!list.success) {
|
|
12090
12110
|
O2.error(list.message ?? list.code ?? "list_filters failed");
|
|
@@ -12266,7 +12286,7 @@ function truncate(value) {
|
|
|
12266
12286
|
return value.length <= 80 ? value : `${value.slice(0, 77)}…`;
|
|
12267
12287
|
}
|
|
12268
12288
|
function formatHome(path) {
|
|
12269
|
-
const home =
|
|
12289
|
+
const home = homedir8();
|
|
12270
12290
|
return path.startsWith(home) ? `~${path.slice(home.length)}` : path;
|
|
12271
12291
|
}
|
|
12272
12292
|
function formatProjectPath(path, projectRoot) {
|
|
@@ -12290,7 +12310,7 @@ var init_doctor_filters = __esm(async () => {
|
|
|
12290
12310
|
|
|
12291
12311
|
// src/lib/binary-cache.ts
|
|
12292
12312
|
import { existsSync as existsSync10, readdirSync as readdirSync4, statSync as statSync5 } from "node:fs";
|
|
12293
|
-
import { join as
|
|
12313
|
+
import { join as join10 } from "node:path";
|
|
12294
12314
|
function getBinaryCacheInfo(activeVersion) {
|
|
12295
12315
|
const path = getAftBinaryCacheDir();
|
|
12296
12316
|
if (!existsSync10(path)) {
|
|
@@ -12303,7 +12323,7 @@ function getBinaryCacheInfo(activeVersion) {
|
|
|
12303
12323
|
}
|
|
12304
12324
|
const versions = readdirSync4(path).filter((entry) => {
|
|
12305
12325
|
try {
|
|
12306
|
-
return statSync5(
|
|
12326
|
+
return statSync5(join10(path, entry)).isDirectory();
|
|
12307
12327
|
} catch {
|
|
12308
12328
|
return false;
|
|
12309
12329
|
}
|
|
@@ -12324,7 +12344,7 @@ var init_binary_cache = __esm(() => {
|
|
|
12324
12344
|
|
|
12325
12345
|
// src/lib/sanitize.ts
|
|
12326
12346
|
import { realpathSync as realpathSync2 } from "node:fs";
|
|
12327
|
-
import { homedir as
|
|
12347
|
+
import { homedir as homedir9, userInfo } from "node:os";
|
|
12328
12348
|
function escapeRegex(value) {
|
|
12329
12349
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
12330
12350
|
}
|
|
@@ -12355,7 +12375,7 @@ function redactSecrets(content) {
|
|
|
12355
12375
|
}
|
|
12356
12376
|
function sanitizeContent(content) {
|
|
12357
12377
|
const username = userInfo().username;
|
|
12358
|
-
const home =
|
|
12378
|
+
const home = homedir9();
|
|
12359
12379
|
let sanitized = redactSecrets(content);
|
|
12360
12380
|
const cwd = process.cwd();
|
|
12361
12381
|
for (const candidate of new Set([cwd, safeRealpath(cwd)])) {
|
|
@@ -12403,10 +12423,10 @@ var init_sanitize = __esm(() => {
|
|
|
12403
12423
|
// src/lib/bridge-tool-failures.ts
|
|
12404
12424
|
import { closeSync as closeSync2, existsSync as existsSync11, openSync as openSync2, readSync as readSync2, statSync as statSync6 } from "node:fs";
|
|
12405
12425
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
12406
|
-
import { join as
|
|
12426
|
+
import { join as join11 } from "node:path";
|
|
12407
12427
|
function resolveBridgePluginLogPath() {
|
|
12408
12428
|
const isTestEnv = process.env.BUN_TEST === "1" || false;
|
|
12409
|
-
return
|
|
12429
|
+
return join11(tmpdir2(), isTestEnv ? "aft-plugin-test.log" : "aft-plugin.log");
|
|
12410
12430
|
}
|
|
12411
12431
|
function tailLogFileBytes(path, maxBytes) {
|
|
12412
12432
|
if (!existsSync11(path) || maxBytes <= 0)
|
|
@@ -12545,7 +12565,7 @@ var init_bridge_tool_failures = __esm(() => {
|
|
|
12545
12565
|
|
|
12546
12566
|
// src/lib/lsp-cache.ts
|
|
12547
12567
|
import { existsSync as existsSync12, readdirSync as readdirSync5, rmSync as rmSync2, statSync as statSync7 } from "node:fs";
|
|
12548
|
-
import { join as
|
|
12568
|
+
import { join as join12 } from "node:path";
|
|
12549
12569
|
function inspectDir(path) {
|
|
12550
12570
|
if (!existsSync12(path)) {
|
|
12551
12571
|
return { entries: [], totalSize: 0 };
|
|
@@ -12559,7 +12579,7 @@ function inspectDir(path) {
|
|
|
12559
12579
|
return { entries: [], totalSize: 0 };
|
|
12560
12580
|
}
|
|
12561
12581
|
for (const name of names) {
|
|
12562
|
-
const full =
|
|
12582
|
+
const full = join12(path, name);
|
|
12563
12583
|
try {
|
|
12564
12584
|
if (!statSync7(full).isDirectory())
|
|
12565
12585
|
continue;
|
|
@@ -12618,7 +12638,7 @@ var init_lsp_cache = __esm(() => {
|
|
|
12618
12638
|
|
|
12619
12639
|
// src/lib/onnx.ts
|
|
12620
12640
|
import { existsSync as existsSync13, readdirSync as readdirSync6, readlinkSync, realpathSync as realpathSync3, statSync as statSync8 } from "node:fs";
|
|
12621
|
-
import { basename, isAbsolute as
|
|
12641
|
+
import { basename, isAbsolute as isAbsolute3, join as join13, resolve as resolve7, win32 } from "node:path";
|
|
12622
12642
|
function getOnnxLibraryName() {
|
|
12623
12643
|
if (process.platform === "darwin")
|
|
12624
12644
|
return "libonnxruntime.dylib";
|
|
@@ -12655,7 +12675,7 @@ function pathEntriesForPlatform() {
|
|
|
12655
12675
|
return pathEnvValue().split(delimiter2).map((entry) => entry.trim().replace(/^"|"$/g, "")).filter((entry) => {
|
|
12656
12676
|
if (!entry || entry === "." || entry.includes("\x00"))
|
|
12657
12677
|
return false;
|
|
12658
|
-
return
|
|
12678
|
+
return isAbsolute3(entry) || win32.isAbsolute(entry);
|
|
12659
12679
|
});
|
|
12660
12680
|
}
|
|
12661
12681
|
function directoryContainsLibrary(dir, libName) {
|
|
@@ -12681,12 +12701,12 @@ function findSystemOnnxRuntime() {
|
|
|
12681
12701
|
searchPaths.push(...pathEntriesForPlatform());
|
|
12682
12702
|
const programFiles = process.env.ProgramFiles ?? "C:\\Program Files";
|
|
12683
12703
|
const programFilesX86 = process.env["ProgramFiles(x86)"] ?? "C:\\Program Files (x86)";
|
|
12684
|
-
searchPaths.push(
|
|
12704
|
+
searchPaths.push(join13(programFiles, "onnxruntime", "lib"), join13(programFiles, "Microsoft ONNX Runtime", "lib"), join13(programFiles, "Microsoft Machine Learning", "lib"), join13(programFilesX86, "onnxruntime", "lib"), ...(() => {
|
|
12685
12705
|
const nugetPaths = [];
|
|
12686
12706
|
const userProfile = process.env.USERPROFILE ?? "";
|
|
12687
12707
|
if (!userProfile)
|
|
12688
12708
|
return nugetPaths;
|
|
12689
|
-
const nugetPackageDir =
|
|
12709
|
+
const nugetPackageDir = join13(userProfile, ".nuget", "packages", "microsoft.ml.onnxruntime");
|
|
12690
12710
|
if (!existsSync13(nugetPackageDir))
|
|
12691
12711
|
return nugetPaths;
|
|
12692
12712
|
try {
|
|
@@ -12695,7 +12715,7 @@ function findSystemOnnxRuntime() {
|
|
|
12695
12715
|
continue;
|
|
12696
12716
|
if (entry.name === "__globalPackagesFolder" || entry.name.startsWith("."))
|
|
12697
12717
|
continue;
|
|
12698
|
-
nugetPaths.push(
|
|
12718
|
+
nugetPaths.push(join13(nugetPackageDir, entry.name, "runtimes", "win-x64", "native"), join13(nugetPackageDir, entry.name, "runtimes", "win-arm64", "native"));
|
|
12699
12719
|
}
|
|
12700
12720
|
} catch {}
|
|
12701
12721
|
return nugetPaths;
|
|
@@ -12705,7 +12725,7 @@ function findSystemOnnxRuntime() {
|
|
|
12705
12725
|
const seen = new Set;
|
|
12706
12726
|
const unknownVersionPaths = [];
|
|
12707
12727
|
for (const dir of searchPaths) {
|
|
12708
|
-
let key =
|
|
12728
|
+
let key = resolve7(dir).replace(/[/\\]+$/, "");
|
|
12709
12729
|
if (normalizeCase)
|
|
12710
12730
|
key = key.toLowerCase();
|
|
12711
12731
|
if (seen.has(key))
|
|
@@ -12725,12 +12745,12 @@ function findSystemOnnxRuntime() {
|
|
|
12725
12745
|
return unknownVersionPaths[0] ?? null;
|
|
12726
12746
|
}
|
|
12727
12747
|
function findCachedOnnxRuntime(storageDir) {
|
|
12728
|
-
const ortDir =
|
|
12748
|
+
const ortDir = join13(storageDir, "onnxruntime", ONNX_RUNTIME_VERSION);
|
|
12729
12749
|
const libName = getOnnxLibraryName();
|
|
12730
|
-
if (existsSync13(
|
|
12750
|
+
if (existsSync13(join13(ortDir, libName)))
|
|
12731
12751
|
return ortDir;
|
|
12732
|
-
const libSubdir =
|
|
12733
|
-
if (existsSync13(
|
|
12752
|
+
const libSubdir = join13(ortDir, "lib");
|
|
12753
|
+
if (existsSync13(join13(libSubdir, libName)))
|
|
12734
12754
|
return libSubdir;
|
|
12735
12755
|
return null;
|
|
12736
12756
|
}
|
|
@@ -12766,7 +12786,7 @@ function detectOrtVersion(libDir) {
|
|
|
12766
12786
|
if (version)
|
|
12767
12787
|
return version;
|
|
12768
12788
|
}
|
|
12769
|
-
const base =
|
|
12789
|
+
const base = join13(libDir, libName);
|
|
12770
12790
|
if (existsSync13(base)) {
|
|
12771
12791
|
try {
|
|
12772
12792
|
const real = realpathSync3(base);
|
|
@@ -13264,7 +13284,7 @@ var init_issue_body = __esm(() => {
|
|
|
13264
13284
|
|
|
13265
13285
|
// src/lib/onnx-fix.ts
|
|
13266
13286
|
import { existsSync as existsSync15, rmSync as rmSync3 } from "node:fs";
|
|
13267
|
-
import { join as
|
|
13287
|
+
import { join as join14 } from "node:path";
|
|
13268
13288
|
function findOnnxFixCandidates(report) {
|
|
13269
13289
|
const candidates = [];
|
|
13270
13290
|
for (const harness of report.harnesses) {
|
|
@@ -13272,7 +13292,7 @@ function findOnnxFixCandidates(report) {
|
|
|
13272
13292
|
continue;
|
|
13273
13293
|
if (!harness.storageDir.exists)
|
|
13274
13294
|
continue;
|
|
13275
|
-
const storageOnnxDir =
|
|
13295
|
+
const storageOnnxDir = join14(harness.storageDir.path, "onnxruntime");
|
|
13276
13296
|
const systemTooOld = harness.onnxRuntime.systemPath !== null && harness.onnxRuntime.systemCompatible === false;
|
|
13277
13297
|
const cachedTooOld = harness.onnxRuntime.cachedPath !== null && harness.onnxRuntime.cachedCompatible === false;
|
|
13278
13298
|
const hasCompatibleCached = harness.onnxRuntime.cachedCompatible === true;
|
|
@@ -13348,8 +13368,8 @@ var init_onnx_fix = __esm(() => {
|
|
|
13348
13368
|
// src/lib/sessions.ts
|
|
13349
13369
|
import { existsSync as existsSync16, readdirSync as readdirSync7, readFileSync as readFileSync5, statSync as statSync10 } from "node:fs";
|
|
13350
13370
|
import { createRequire as createRequire3 } from "node:module";
|
|
13351
|
-
import { homedir as
|
|
13352
|
-
import { basename as basename2, join as
|
|
13371
|
+
import { homedir as homedir10 } from "node:os";
|
|
13372
|
+
import { basename as basename2, join as join15 } from "node:path";
|
|
13353
13373
|
function listRecentSessions(adapter) {
|
|
13354
13374
|
try {
|
|
13355
13375
|
if (adapter.kind === "opencode")
|
|
@@ -13378,7 +13398,7 @@ function mapOpenCodeSessionRows(rows) {
|
|
|
13378
13398
|
}).filter((session) => session !== null).sort((a, b) => b.lastActivity - a.lastActivity).slice(0, MAX_RECENT_SESSIONS);
|
|
13379
13399
|
}
|
|
13380
13400
|
function listRecentOpenCodeSessions() {
|
|
13381
|
-
const dbPath =
|
|
13401
|
+
const dbPath = join15(getXdgDataHome(), "opencode", "opencode.db");
|
|
13382
13402
|
if (!existsSync16(dbPath))
|
|
13383
13403
|
return [];
|
|
13384
13404
|
let db = null;
|
|
@@ -13398,14 +13418,14 @@ function listRecentOpenCodeSessions() {
|
|
|
13398
13418
|
}
|
|
13399
13419
|
function getXdgDataHome() {
|
|
13400
13420
|
const xdgDataHome = process.env.XDG_DATA_HOME;
|
|
13401
|
-
return xdgDataHome && xdgDataHome.length > 0 ? xdgDataHome :
|
|
13421
|
+
return xdgDataHome && xdgDataHome.length > 0 ? xdgDataHome : join15(homedir10(), ".local", "share");
|
|
13402
13422
|
}
|
|
13403
13423
|
function listRecentPiSessions() {
|
|
13404
|
-
return listPiSessionsFromDir(
|
|
13424
|
+
return listPiSessionsFromDir(join15(getHomeDir(), ".pi", "agent", "sessions"));
|
|
13405
13425
|
}
|
|
13406
13426
|
function getHomeDir() {
|
|
13407
13427
|
const envHome = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
|
|
13408
|
-
return envHome && envHome.length > 0 ? envHome :
|
|
13428
|
+
return envHome && envHome.length > 0 ? envHome : homedir10();
|
|
13409
13429
|
}
|
|
13410
13430
|
function listPiSessionsFromDir(sessionsDir) {
|
|
13411
13431
|
try {
|
|
@@ -13447,7 +13467,7 @@ function collectJsonlFiles(root) {
|
|
|
13447
13467
|
continue;
|
|
13448
13468
|
}
|
|
13449
13469
|
for (const entry of entries) {
|
|
13450
|
-
const path =
|
|
13470
|
+
const path = join15(dir, entry.name);
|
|
13451
13471
|
if (entry.isDirectory()) {
|
|
13452
13472
|
stack.push(path);
|
|
13453
13473
|
} else if (entry.isFile() && entry.name.endsWith(".jsonl")) {
|
|
@@ -13557,7 +13577,7 @@ import {
|
|
|
13557
13577
|
writeFileSync as writeFileSync2
|
|
13558
13578
|
} from "node:fs";
|
|
13559
13579
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
13560
|
-
import { join as
|
|
13580
|
+
import { join as join16 } from "node:path";
|
|
13561
13581
|
async function runDoctor(options) {
|
|
13562
13582
|
if (options.issue) {
|
|
13563
13583
|
return runIssueFlow(options.argv);
|
|
@@ -13721,7 +13741,7 @@ function clearOldBinaries() {
|
|
|
13721
13741
|
return result;
|
|
13722
13742
|
}
|
|
13723
13743
|
for (const version of stale) {
|
|
13724
|
-
const dir =
|
|
13744
|
+
const dir = join16(info.path, version);
|
|
13725
13745
|
let bytes = 0;
|
|
13726
13746
|
try {
|
|
13727
13747
|
bytes = statSync11(dir).isDirectory() ? dirSize(dir) : 0;
|
|
@@ -14149,11 +14169,11 @@ function deriveIssueTitleFromBody(body) {
|
|
|
14149
14169
|
function writeIssueReviewFile(body) {
|
|
14150
14170
|
let reviewDir = null;
|
|
14151
14171
|
try {
|
|
14152
|
-
reviewDir = mkdtempSync(
|
|
14172
|
+
reviewDir = mkdtempSync(join16(tmpdir3(), "aft-issue-"));
|
|
14153
14173
|
if (process.platform !== "win32") {
|
|
14154
14174
|
chmodSync2(reviewDir, 448);
|
|
14155
14175
|
}
|
|
14156
|
-
const outPath =
|
|
14176
|
+
const outPath = join16(reviewDir, "issue.md");
|
|
14157
14177
|
writeFileSync2(outPath, `${body}
|
|
14158
14178
|
`, { encoding: "utf8", mode: 384, flag: "wx" });
|
|
14159
14179
|
return { path: outPath, realPath: realpathSync4(outPath) };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft",
|
|
3
|
-
"version": "0.40.
|
|
3
|
+
"version": "0.40.2",
|
|
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",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@clack/prompts": "^1.2.0",
|
|
27
|
-
"@cortexkit/aft-bridge": "0.40.
|
|
27
|
+
"@cortexkit/aft-bridge": "0.40.2",
|
|
28
28
|
"comment-json": "^4.6.2"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|