@cortexkit/aft 0.23.0 → 0.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/pi.d.ts.map +1 -1
- package/dist/index.js +75 -13
- package/dist/lib/diagnostics.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../src/adapters/pi.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAqIpB,qBAAa,SAAU,YAAW,cAAc;IAC9C,QAAQ,CAAC,IAAI,EAAG,IAAI,CAAU;IAC9B,QAAQ,CAAC,WAAW,QAAQ;IAC5B,QAAQ,CAAC,iBAAiB,uBAAe;IACzC,QAAQ,CAAC,sBAAsB,2BAAgB;IAE/C,WAAW,IAAI,OAAO;IAStB,cAAc,IAAI,MAAM,GAAG,IAAI;IAuB/B,iBAAiB,IAAI,kBAAkB;IAevC,cAAc,IAAI,OAAO;IAInB,iBAAiB,IAAI,OAAO,CAAC,iBAAiB,CAAC;IAmCrD,kBAAkB,IAAI,eAAe;IA6BrC,aAAa,IAAI,MAAM;IAKvB,UAAU,IAAI,MAAM;IAIpB,cAAc,IAAI,MAAM;IAIlB,gBAAgB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC;QAC/C,MAAM,EAAE,SAAS,GAAG,YAAY,GAAG,WAAW,GAAG,gBAAgB,GAAG,OAAO,CAAC;QAC5E,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IAUF,uBAAuB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;CAUlD"}
|
package/dist/index.js
CHANGED
|
@@ -8175,14 +8175,29 @@ var init_opencode = __esm(() => {
|
|
|
8175
8175
|
});
|
|
8176
8176
|
|
|
8177
8177
|
// src/adapters/pi.ts
|
|
8178
|
-
import { execSync as execSync2 } from "node:child_process";
|
|
8178
|
+
import { execSync as execSync2, spawnSync } from "node:child_process";
|
|
8179
8179
|
import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
|
|
8180
8180
|
import { homedir as homedir3 } from "node:os";
|
|
8181
8181
|
import { join as join4 } from "node:path";
|
|
8182
8182
|
function getPiAgentDir() {
|
|
8183
|
-
|
|
8183
|
+
const envHome = process.platform === "win32" ? process.env.USERPROFILE : process.env.HOME;
|
|
8184
|
+
const home = envHome && envHome.length > 0 ? envHome : homedir3();
|
|
8185
|
+
return join4(home, ".pi", "agent");
|
|
8184
8186
|
}
|
|
8185
8187
|
function readPiExtensionIndex() {
|
|
8188
|
+
const settingsPath = join4(getPiAgentDir(), "settings.json");
|
|
8189
|
+
if (existsSync4(settingsPath)) {
|
|
8190
|
+
try {
|
|
8191
|
+
const raw = readFileSync3(settingsPath, "utf-8");
|
|
8192
|
+
const trimmed = raw.replace(/^\uFEFF/, "");
|
|
8193
|
+
const value = JSON.parse(trimmed);
|
|
8194
|
+
const packages = value.packages;
|
|
8195
|
+
if (Array.isArray(packages)) {
|
|
8196
|
+
const installed = packages.filter((p) => typeof p === "string");
|
|
8197
|
+
return { installed, path: settingsPath };
|
|
8198
|
+
}
|
|
8199
|
+
} catch {}
|
|
8200
|
+
}
|
|
8186
8201
|
const candidates = [
|
|
8187
8202
|
join4(getPiAgentDir(), "extensions.json"),
|
|
8188
8203
|
join4(getPiAgentDir(), "extensions.jsonc"),
|
|
@@ -8205,9 +8220,45 @@ function readPiExtensionIndex() {
|
|
|
8205
8220
|
}
|
|
8206
8221
|
return { installed: [], path: null };
|
|
8207
8222
|
}
|
|
8223
|
+
function piEntryMatchesAft(entry) {
|
|
8224
|
+
if (entry.startsWith("npm:")) {
|
|
8225
|
+
const spec = entry.slice("npm:".length).trim();
|
|
8226
|
+
if (spec === PLUGIN_NAME2)
|
|
8227
|
+
return true;
|
|
8228
|
+
if (spec.startsWith(`${PLUGIN_NAME2}@`))
|
|
8229
|
+
return true;
|
|
8230
|
+
return false;
|
|
8231
|
+
}
|
|
8232
|
+
let resolved = null;
|
|
8233
|
+
if (entry.startsWith("file:")) {
|
|
8234
|
+
try {
|
|
8235
|
+
const stripped = entry.slice("file:".length);
|
|
8236
|
+
resolved = stripped.startsWith("//") ? stripped.slice(2) : stripped;
|
|
8237
|
+
} catch {
|
|
8238
|
+
return false;
|
|
8239
|
+
}
|
|
8240
|
+
} else if (entry.startsWith("/")) {
|
|
8241
|
+
resolved = entry;
|
|
8242
|
+
} else if (entry.length > 0) {
|
|
8243
|
+
resolved = join4(getPiAgentDir(), entry);
|
|
8244
|
+
}
|
|
8245
|
+
if (!resolved)
|
|
8246
|
+
return false;
|
|
8247
|
+
try {
|
|
8248
|
+
if (!existsSync4(resolved))
|
|
8249
|
+
return false;
|
|
8250
|
+
const pkgPath = join4(resolved, "package.json");
|
|
8251
|
+
if (!existsSync4(pkgPath))
|
|
8252
|
+
return false;
|
|
8253
|
+
const pkg = JSON.parse(readFileSync3(pkgPath, "utf-8"));
|
|
8254
|
+
return pkg.name === PLUGIN_NAME2;
|
|
8255
|
+
} catch {
|
|
8256
|
+
return false;
|
|
8257
|
+
}
|
|
8258
|
+
}
|
|
8208
8259
|
function piHasOurExtension() {
|
|
8209
8260
|
const { installed } = readPiExtensionIndex();
|
|
8210
|
-
return installed.some(
|
|
8261
|
+
return installed.some(piEntryMatchesAft);
|
|
8211
8262
|
}
|
|
8212
8263
|
|
|
8213
8264
|
class PiAdapter {
|
|
@@ -8225,7 +8276,17 @@ class PiAdapter {
|
|
|
8225
8276
|
}
|
|
8226
8277
|
getHostVersion() {
|
|
8227
8278
|
try {
|
|
8228
|
-
|
|
8279
|
+
const result = spawnSync("pi", ["--version"], {
|
|
8280
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
8281
|
+
encoding: "utf-8"
|
|
8282
|
+
});
|
|
8283
|
+
if (result.status !== 0)
|
|
8284
|
+
return null;
|
|
8285
|
+
const stdout = (result.stdout ?? "").trim();
|
|
8286
|
+
const stderr = (result.stderr ?? "").trim();
|
|
8287
|
+
const text = stdout || stderr;
|
|
8288
|
+
const semverLine = text.split(/\r?\n/).find((l) => /^\d+\.\d+\.\d+/.test(l.trim()));
|
|
8289
|
+
return semverLine?.trim() ?? text ?? null;
|
|
8229
8290
|
} catch {
|
|
8230
8291
|
return null;
|
|
8231
8292
|
}
|
|
@@ -10885,14 +10946,15 @@ async function diagnoseHarness(adapter) {
|
|
|
10885
10946
|
function renderDiagnosticsMarkdown(report) {
|
|
10886
10947
|
const lines = [];
|
|
10887
10948
|
lines.push(`- Timestamp: ${report.timestamp}`);
|
|
10888
|
-
lines.push(`- CLI: v${report.cliVersion}`);
|
|
10889
|
-
lines.push(`-
|
|
10949
|
+
lines.push(`- AFT CLI: v${report.cliVersion}`);
|
|
10950
|
+
lines.push(`- AFT binary: ${report.binaryVersion ?? "unknown"}`);
|
|
10890
10951
|
lines.push(`- OS: ${report.platform} ${report.arch}`);
|
|
10891
10952
|
lines.push(`- Node: ${report.nodeVersion}`);
|
|
10892
10953
|
for (const h of report.harnesses) {
|
|
10893
10954
|
lines.push("");
|
|
10894
10955
|
lines.push(`### ${h.displayName}`);
|
|
10895
|
-
lines.push(`- Host installed: ${h.hostInstalled}
|
|
10956
|
+
lines.push(`- Host installed: ${h.hostInstalled}`);
|
|
10957
|
+
lines.push(`- Host version: ${h.hostVersion ?? "unknown"}`);
|
|
10896
10958
|
lines.push(`- Plugin registered: ${h.pluginRegistered}`);
|
|
10897
10959
|
lines.push(`- AFT config parse error: ${h.aftConfig.parseError ?? "none"}`);
|
|
10898
10960
|
lines.push("");
|
|
@@ -10959,7 +11021,7 @@ var init_diagnostics = __esm(() => {
|
|
|
10959
11021
|
});
|
|
10960
11022
|
|
|
10961
11023
|
// src/lib/github.ts
|
|
10962
|
-
import { execSync as execSync4, spawnSync } from "node:child_process";
|
|
11024
|
+
import { execSync as execSync4, spawnSync as spawnSync2 } from "node:child_process";
|
|
10963
11025
|
function isGhInstalled() {
|
|
10964
11026
|
try {
|
|
10965
11027
|
execSync4("gh --version", { stdio: "ignore" });
|
|
@@ -10972,14 +11034,14 @@ function openBrowser(url) {
|
|
|
10972
11034
|
const commands = process.platform === "darwin" ? ["open", [url]] : process.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
|
|
10973
11035
|
try {
|
|
10974
11036
|
const [cmd, args] = commands;
|
|
10975
|
-
|
|
11037
|
+
spawnSync2(cmd, args, { stdio: "ignore" });
|
|
10976
11038
|
} catch {}
|
|
10977
11039
|
}
|
|
10978
11040
|
function createGitHubIssue(repo, title, body) {
|
|
10979
11041
|
if (!isGhInstalled()) {
|
|
10980
11042
|
return { url: null, stderr: "gh CLI not installed" };
|
|
10981
11043
|
}
|
|
10982
|
-
const result =
|
|
11044
|
+
const result = spawnSync2("gh", ["issue", "create", "--repo", repo, "--title", title, "--body-file", "-"], {
|
|
10983
11045
|
input: body,
|
|
10984
11046
|
encoding: "utf-8",
|
|
10985
11047
|
stdio: ["pipe", "pipe", "pipe"]
|
|
@@ -11105,7 +11167,7 @@ async function runDoctor(options) {
|
|
|
11105
11167
|
verb: "diagnose"
|
|
11106
11168
|
});
|
|
11107
11169
|
const report = await collectDiagnostics(adapters);
|
|
11108
|
-
O2.info(`CLI v${report.cliVersion}, binary ${report.binaryVersion ?? "unknown"}`);
|
|
11170
|
+
O2.info(`AFT CLI v${report.cliVersion}, AFT binary ${report.binaryVersion ?? "unknown"}`);
|
|
11109
11171
|
O2.info(`Binary cache: ${report.binaryCache.versions.length} version(s), ${formatBytes(report.binaryCache.totalSize)} at ${report.binaryCache.path}`);
|
|
11110
11172
|
const npmCount = report.lspCache.npm.entries.length;
|
|
11111
11173
|
const ghCount = report.lspCache.github.entries.length;
|
|
@@ -11362,8 +11424,8 @@ ${tail || "<no log output>"}
|
|
|
11362
11424
|
description,
|
|
11363
11425
|
"",
|
|
11364
11426
|
"## Environment",
|
|
11365
|
-
`- CLI: v${report.cliVersion}`,
|
|
11366
|
-
`-
|
|
11427
|
+
`- AFT CLI: v${report.cliVersion}`,
|
|
11428
|
+
`- AFT binary: ${report.binaryVersion ?? "unknown"}`,
|
|
11367
11429
|
`- OS: ${report.platform} ${report.arch}`,
|
|
11368
11430
|
`- Node: ${report.nodeVersion}`,
|
|
11369
11431
|
"",
|
|
@@ -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;AAG7E,OAAO,EAAqB,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAaxE,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;IAC7B,sEAAsE;IACtE,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aA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