@cortexkit/aft-opencode 0.11.1 → 0.11.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/cli/doctor.d.ts.map +1 -1
- package/dist/cli/logs.d.ts +10 -1
- package/dist/cli/logs.d.ts.map +1 -1
- package/dist/cli.js +93 -41
- package/package.json +6 -6
package/dist/cli/doctor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/cli/doctor.ts"],"names":[],"mappings":"AA4QA,wBAAsB,SAAS,CAC7B,OAAO,GAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,KAAK,CAAC,EAAE,OAAO,CAAA;CAAO,GACjD,OAAO,CAAC,MAAM,CAAC,CAsIjB"}
|
package/dist/cli/logs.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import type { DiagnosticReport } from "./diagnostics.js";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Strip personally identifiable path segments from arbitrary text.
|
|
4
|
+
* Used on both log contents and the full doctor --issue body so diagnostic
|
|
5
|
+
* reports never leak usernames or home directory paths.
|
|
6
|
+
*/
|
|
7
|
+
export declare function sanitizeContent(content: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated Use sanitizeContent. Kept as an alias for backward compatibility.
|
|
10
|
+
*/
|
|
11
|
+
export declare const sanitizeLogContent: typeof sanitizeContent;
|
|
3
12
|
export declare function bundleIssueReport(report: DiagnosticReport, description: string, _title: string): Promise<{
|
|
4
13
|
path: string;
|
|
5
14
|
bodyMarkdown: string;
|
package/dist/cli/logs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/cli/logs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOzD,wBAAgB,
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/cli/logs.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAOzD;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAgBvD;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,wBAAkB,CAAC;AAelD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,CAAC,CA0CjD"}
|
package/dist/cli.js
CHANGED
|
@@ -7849,8 +7849,8 @@ var require_src3 = __commonJS((exports, module) => {
|
|
|
7849
7849
|
// src/cli/doctor.ts
|
|
7850
7850
|
var import_comment_json3 = __toESM(require_src2(), 1);
|
|
7851
7851
|
import { execSync as execSync3, spawnSync } from "node:child_process";
|
|
7852
|
-
import { existsSync as
|
|
7853
|
-
import { dirname as dirname2 } from "node:path";
|
|
7852
|
+
import { existsSync as existsSync5, mkdirSync as mkdirSync2, readdirSync as readdirSync3, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7853
|
+
import path2, { dirname as dirname2 } from "node:path";
|
|
7854
7854
|
|
|
7855
7855
|
// src/shared/tui-config.ts
|
|
7856
7856
|
var import_comment_json = __toESM(require_src2(), 1);
|
|
@@ -8521,16 +8521,17 @@ import { join as join8 } from "node:path";
|
|
|
8521
8521
|
function escapeRegex2(value) {
|
|
8522
8522
|
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
8523
8523
|
}
|
|
8524
|
-
function
|
|
8524
|
+
function sanitizeContent(content) {
|
|
8525
8525
|
const username = userInfo2().username;
|
|
8526
8526
|
const home = homedir6();
|
|
8527
8527
|
let sanitized = content;
|
|
8528
8528
|
if (home) {
|
|
8529
8529
|
sanitized = sanitized.replace(new RegExp(escapeRegex2(home), "g"), "~");
|
|
8530
8530
|
}
|
|
8531
|
-
sanitized = sanitized.replace(/\/Users\/[
|
|
8532
|
-
sanitized = sanitized.replace(/\/home\/[
|
|
8533
|
-
sanitized = sanitized.replace(/C:\\\\Users\\\\[^\\\\]
|
|
8531
|
+
sanitized = sanitized.replace(/\/Users\/[^/\s"']+/g, "/Users/<USER>");
|
|
8532
|
+
sanitized = sanitized.replace(/\/home\/[^/\s"']+/g, "/home/<USER>");
|
|
8533
|
+
sanitized = sanitized.replace(/C:\\\\Users\\\\[^\\\\"'\s]+/g, "C:\\\\Users\\\\<USER>");
|
|
8534
|
+
sanitized = sanitized.replace(/C:\\Users\\[^\\"'\s]+/g, "C:\\Users\\<USER>");
|
|
8534
8535
|
if (username) {
|
|
8535
8536
|
sanitized = sanitized.replace(new RegExp(escapeRegex2(username), "g"), "<USER>");
|
|
8536
8537
|
}
|
|
@@ -8550,10 +8551,10 @@ function formatTimestamp(date) {
|
|
|
8550
8551
|
}
|
|
8551
8552
|
async function bundleIssueReport(report, description, _title) {
|
|
8552
8553
|
const logLines = report.logFile.exists ? readFileSync4(report.logFile.path, "utf-8").split(/\r?\n/) : [];
|
|
8553
|
-
const recentLog =
|
|
8554
|
-
`)
|
|
8554
|
+
const recentLog = logLines.slice(-200).join(`
|
|
8555
|
+
`).trim();
|
|
8555
8556
|
const configBody = JSON.stringify(report.aftConfig.flags, null, 2);
|
|
8556
|
-
const
|
|
8557
|
+
const rawBody = [
|
|
8557
8558
|
"## Description",
|
|
8558
8559
|
description,
|
|
8559
8560
|
"",
|
|
@@ -8565,7 +8566,7 @@ async function bundleIssueReport(report, description, _title) {
|
|
|
8565
8566
|
`- OpenCode: ${report.opencodeVersion ?? "not installed"}`,
|
|
8566
8567
|
"",
|
|
8567
8568
|
"## Configuration",
|
|
8568
|
-
`Enabled flags from \`${report.configPaths.aftConfig
|
|
8569
|
+
`Enabled flags from \`${report.configPaths.aftConfig}\`:`,
|
|
8569
8570
|
"```jsonc",
|
|
8570
8571
|
configBody,
|
|
8571
8572
|
"```",
|
|
@@ -8573,12 +8574,15 @@ async function bundleIssueReport(report, description, _title) {
|
|
|
8573
8574
|
"## Diagnostics",
|
|
8574
8575
|
renderDiagnosticsMarkdown(report),
|
|
8575
8576
|
"",
|
|
8576
|
-
"## Log (last 200 lines
|
|
8577
|
+
"## Log (last 200 lines)",
|
|
8577
8578
|
"```",
|
|
8578
8579
|
recentLog || "<no log output>",
|
|
8579
|
-
"```"
|
|
8580
|
+
"```",
|
|
8581
|
+
"",
|
|
8582
|
+
"_Username and home paths have been stripped from this report._"
|
|
8580
8583
|
].join(`
|
|
8581
8584
|
`);
|
|
8585
|
+
const bodyMarkdown = sanitizeContent(rawBody);
|
|
8582
8586
|
const path2 = join8(process.cwd(), `aft-issue-${formatTimestamp(new Date)}.md`);
|
|
8583
8587
|
writeFileSync2(path2, `${bodyMarkdown}
|
|
8584
8588
|
`);
|
|
@@ -9754,15 +9758,15 @@ async function text(message, options = {}) {
|
|
|
9754
9758
|
// src/cli/doctor.ts
|
|
9755
9759
|
var PLUGIN_NAME4 = "@cortexkit/aft-opencode";
|
|
9756
9760
|
var PLUGIN_ENTRY2 = `${PLUGIN_NAME4}@latest`;
|
|
9757
|
-
function ensureDir(
|
|
9758
|
-
mkdirSync2(dirname2(
|
|
9761
|
+
function ensureDir(path3) {
|
|
9762
|
+
mkdirSync2(dirname2(path3), { recursive: true });
|
|
9759
9763
|
}
|
|
9760
|
-
function parseConfig(
|
|
9761
|
-
if (!
|
|
9764
|
+
function parseConfig(path3) {
|
|
9765
|
+
if (!existsSync5(path3)) {
|
|
9762
9766
|
return null;
|
|
9763
9767
|
}
|
|
9764
9768
|
try {
|
|
9765
|
-
return import_comment_json3.parse(readFileSync5(
|
|
9769
|
+
return import_comment_json3.parse(readFileSync5(path3, "utf-8")) ?? {};
|
|
9766
9770
|
} catch {
|
|
9767
9771
|
return null;
|
|
9768
9772
|
}
|
|
@@ -9836,12 +9840,67 @@ function summarizeFlags(flags) {
|
|
|
9836
9840
|
const entries = Object.entries(flags).filter(([, value]) => value !== undefined).map(([key, value]) => `${key}=${JSON.stringify(value)}`);
|
|
9837
9841
|
return entries.length > 0 ? entries.join(", ") : "using defaults";
|
|
9838
9842
|
}
|
|
9843
|
+
var REQUIRED_ORT_MAJOR = 1;
|
|
9844
|
+
var REQUIRED_ORT_MIN_MINOR = 20;
|
|
9845
|
+
function detectOrtVersion(libDir) {
|
|
9846
|
+
try {
|
|
9847
|
+
const entries = readdirSync3(libDir);
|
|
9848
|
+
for (const entry of entries) {
|
|
9849
|
+
if (!entry.startsWith("libonnxruntime"))
|
|
9850
|
+
continue;
|
|
9851
|
+
const match = entry.match(/(\d+\.\d+\.\d+)/);
|
|
9852
|
+
if (match)
|
|
9853
|
+
return match[1];
|
|
9854
|
+
}
|
|
9855
|
+
} catch {}
|
|
9856
|
+
return null;
|
|
9857
|
+
}
|
|
9858
|
+
function checkOrtVersion(report) {
|
|
9859
|
+
let issues = 0;
|
|
9860
|
+
if (report.onnxRuntime.cachedPath) {
|
|
9861
|
+
const cachedDir = path2.dirname(report.onnxRuntime.cachedPath);
|
|
9862
|
+
const version = detectOrtVersion(cachedDir);
|
|
9863
|
+
if (version) {
|
|
9864
|
+
O2.success(`ONNX Runtime v${version} (auto-downloaded) at ${report.onnxRuntime.cachedPath}`);
|
|
9865
|
+
return 0;
|
|
9866
|
+
}
|
|
9867
|
+
}
|
|
9868
|
+
const systemPaths = process.platform === "darwin" ? ["/opt/homebrew/lib", "/usr/local/lib"] : ["/usr/local/lib", "/usr/lib", "/usr/lib/x86_64-linux-gnu", "/usr/lib/aarch64-linux-gnu"];
|
|
9869
|
+
for (const dir of systemPaths) {
|
|
9870
|
+
const version = detectOrtVersion(dir);
|
|
9871
|
+
if (version) {
|
|
9872
|
+
const parts = version.split(".").map(Number);
|
|
9873
|
+
const [major, minor] = [parts[0], parts[1]];
|
|
9874
|
+
if (major === REQUIRED_ORT_MAJOR && minor >= REQUIRED_ORT_MIN_MINOR) {
|
|
9875
|
+
O2.success(`ONNX Runtime v${version} (compatible) at ${dir}`);
|
|
9876
|
+
return 0;
|
|
9877
|
+
}
|
|
9878
|
+
O2.error(`ONNX Runtime v${version} found at ${dir} — INCOMPATIBLE (need v1.${REQUIRED_ORT_MIN_MINOR}+)`);
|
|
9879
|
+
O2.info("This version mismatch causes AFT to crash when semantic search initializes.");
|
|
9880
|
+
O2.info("Solutions:");
|
|
9881
|
+
if (process.platform === "linux") {
|
|
9882
|
+
O2.info(` 1. Remove old version: sudo rm ${dir}/libonnxruntime* && sudo ldconfig`);
|
|
9883
|
+
O2.info(" Then restart OpenCode — AFT auto-downloads the correct version.");
|
|
9884
|
+
} else {
|
|
9885
|
+
O2.info(` 1. Remove old version: sudo rm ${dir}/libonnxruntime*`);
|
|
9886
|
+
O2.info(" Then restart OpenCode — AFT auto-downloads the correct version.");
|
|
9887
|
+
}
|
|
9888
|
+
O2.info(" 2. Or install v1.24: https://github.com/microsoft/onnxruntime/releases/tag/v1.24.0");
|
|
9889
|
+
issues++;
|
|
9890
|
+
return issues;
|
|
9891
|
+
}
|
|
9892
|
+
}
|
|
9893
|
+
if (report.onnxRuntime.required && !report.onnxRuntime.cachedPath) {
|
|
9894
|
+
O2.warn("ONNX Runtime not found — AFT will attempt auto-download on startup");
|
|
9895
|
+
}
|
|
9896
|
+
return issues;
|
|
9897
|
+
}
|
|
9839
9898
|
function warnAboutLinuxLdconfig(systemPath) {
|
|
9840
9899
|
if (process.platform !== "linux") {
|
|
9841
9900
|
return false;
|
|
9842
9901
|
}
|
|
9843
9902
|
const libPath = "/usr/local/lib/libonnxruntime.so";
|
|
9844
|
-
if (!
|
|
9903
|
+
if (!existsSync5(libPath)) {
|
|
9845
9904
|
return false;
|
|
9846
9905
|
}
|
|
9847
9906
|
try {
|
|
@@ -9985,14 +10044,7 @@ async function runDoctor(options = {}) {
|
|
|
9985
10044
|
O2.info("Run `rm -rf ~/.cache/aft/bin/<version>` to clean them up");
|
|
9986
10045
|
}
|
|
9987
10046
|
if (report.onnxRuntime.required) {
|
|
9988
|
-
|
|
9989
|
-
O2.success(`ONNX Runtime cached at ${report.onnxRuntime.cachedPath}`);
|
|
9990
|
-
} else if (report.onnxRuntime.systemPath) {
|
|
9991
|
-
O2.success(`ONNX Runtime found at ${report.onnxRuntime.systemPath}`);
|
|
9992
|
-
} else {
|
|
9993
|
-
O2.warn(`ONNX Runtime missing - install hint: ${report.onnxRuntime.installHint}`);
|
|
9994
|
-
issues++;
|
|
9995
|
-
}
|
|
10047
|
+
issues += checkOrtVersion(report);
|
|
9996
10048
|
if (warnAboutLinuxLdconfig(report.onnxRuntime.systemPath)) {
|
|
9997
10049
|
issues++;
|
|
9998
10050
|
}
|
|
@@ -10017,39 +10069,39 @@ async function runDoctor(options = {}) {
|
|
|
10017
10069
|
|
|
10018
10070
|
// src/cli/setup.ts
|
|
10019
10071
|
var import_comment_json4 = __toESM(require_src2(), 1);
|
|
10020
|
-
import { existsSync as
|
|
10072
|
+
import { existsSync as existsSync6, mkdirSync as mkdirSync3, readFileSync as readFileSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
10021
10073
|
import { dirname as dirname3 } from "node:path";
|
|
10022
10074
|
var PLUGIN_NAME5 = "@cortexkit/aft-opencode";
|
|
10023
10075
|
var PLUGIN_ENTRY3 = `${PLUGIN_NAME5}@latest`;
|
|
10024
|
-
function ensureDir2(
|
|
10025
|
-
mkdirSync3(dirname3(
|
|
10076
|
+
function ensureDir2(path3) {
|
|
10077
|
+
mkdirSync3(dirname3(path3), { recursive: true });
|
|
10026
10078
|
}
|
|
10027
|
-
function readJsonc(
|
|
10028
|
-
if (!
|
|
10079
|
+
function readJsonc(path3) {
|
|
10080
|
+
if (!existsSync6(path3)) {
|
|
10029
10081
|
return null;
|
|
10030
10082
|
}
|
|
10031
|
-
return import_comment_json4.parse(readFileSync6(
|
|
10083
|
+
return import_comment_json4.parse(readFileSync6(path3, "utf-8")) ?? {};
|
|
10032
10084
|
}
|
|
10033
|
-
function writeJsonc(
|
|
10034
|
-
ensureDir2(
|
|
10035
|
-
writeFileSync4(
|
|
10085
|
+
function writeJsonc(path3, config) {
|
|
10086
|
+
ensureDir2(path3);
|
|
10087
|
+
writeFileSync4(path3, `${import_comment_json4.stringify(config, null, 2)}
|
|
10036
10088
|
`);
|
|
10037
10089
|
}
|
|
10038
|
-
function ensurePluginInOpenCodeConfig(
|
|
10090
|
+
function ensurePluginInOpenCodeConfig(path3, format) {
|
|
10039
10091
|
if (format === "none") {
|
|
10040
|
-
writeJsonc(
|
|
10092
|
+
writeJsonc(path3, { plugin: [PLUGIN_ENTRY3] });
|
|
10041
10093
|
return;
|
|
10042
10094
|
}
|
|
10043
|
-
const existing = readJsonc(
|
|
10095
|
+
const existing = readJsonc(path3);
|
|
10044
10096
|
if (!existing) {
|
|
10045
|
-
throw new Error(`Could not parse ${
|
|
10097
|
+
throw new Error(`Could not parse ${path3}`);
|
|
10046
10098
|
}
|
|
10047
10099
|
const plugins = Array.isArray(existing.plugin) ? existing.plugin.filter((entry) => typeof entry === "string") : [];
|
|
10048
10100
|
if (!plugins.some((entry) => entry === PLUGIN_NAME5 || entry.startsWith(`${PLUGIN_NAME5}@`))) {
|
|
10049
10101
|
plugins.push(PLUGIN_ENTRY3);
|
|
10050
10102
|
}
|
|
10051
10103
|
existing.plugin = plugins;
|
|
10052
|
-
writeJsonc(
|
|
10104
|
+
writeJsonc(path3, existing);
|
|
10053
10105
|
}
|
|
10054
10106
|
async function runSetup() {
|
|
10055
10107
|
mt("AFT Setup");
|
|
@@ -10073,7 +10125,7 @@ async function runSetup() {
|
|
|
10073
10125
|
return 1;
|
|
10074
10126
|
}
|
|
10075
10127
|
const tuiAdded = ensureTuiPluginEntry();
|
|
10076
|
-
if (tuiAdded ||
|
|
10128
|
+
if (tuiAdded || existsSync6(paths.tuiConfig)) {
|
|
10077
10129
|
O2.success("TUI plugin entry configured");
|
|
10078
10130
|
} else {
|
|
10079
10131
|
O2.warn("Could not verify the TUI plugin entry");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/aft-opencode",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "OpenCode plugin for Agent File Tools (AFT) — tree-sitter and lsp powered code analysis",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"zod": "^4.1.8"
|
|
36
36
|
},
|
|
37
37
|
"optionalDependencies": {
|
|
38
|
-
"@cortexkit/aft-darwin-arm64": "0.11.
|
|
39
|
-
"@cortexkit/aft-darwin-x64": "0.11.
|
|
40
|
-
"@cortexkit/aft-linux-arm64": "0.11.
|
|
41
|
-
"@cortexkit/aft-linux-x64": "0.11.
|
|
42
|
-
"@cortexkit/aft-win32-x64": "0.11.
|
|
38
|
+
"@cortexkit/aft-darwin-arm64": "0.11.2",
|
|
39
|
+
"@cortexkit/aft-darwin-x64": "0.11.2",
|
|
40
|
+
"@cortexkit/aft-linux-arm64": "0.11.2",
|
|
41
|
+
"@cortexkit/aft-linux-x64": "0.11.2",
|
|
42
|
+
"@cortexkit/aft-win32-x64": "0.11.2"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@types/node": "^22.0.0",
|