@aliyunrds/ctxdb 1.0.0-beta.2 → 1.0.0-beta.4
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/main.js +28 -17
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -237,7 +237,7 @@ import {
|
|
|
237
237
|
statSync
|
|
238
238
|
} from "fs";
|
|
239
239
|
import { homedir } from "os";
|
|
240
|
-
import { join, dirname } from "path";
|
|
240
|
+
import { join, dirname, resolve } from "path";
|
|
241
241
|
import { fileURLToPath } from "url";
|
|
242
242
|
import { execFileSync } from "child_process";
|
|
243
243
|
var UNINSTALL_NPM_HINT = "To also remove the npm binaries: `npm uninstall -g @aliyunrds/ctxdb @aliyunrds/ctxdb-shared`";
|
|
@@ -875,19 +875,20 @@ function checkOpencodeShimHealth() {
|
|
|
875
875
|
detail: `opencode shim malformed: ${path} \u2014 re-run \`ctxdb setup --agent opencode\``
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
|
-
|
|
878
|
+
const targetPath = target.startsWith("file:") ? fileURLToPath(target) : resolve(dirname(path), target);
|
|
879
|
+
if (!existsSync(targetPath)) {
|
|
879
880
|
return {
|
|
880
881
|
installed: true,
|
|
881
|
-
nodePaths: [
|
|
882
|
+
nodePaths: [targetPath],
|
|
882
883
|
nodeOk: false,
|
|
883
|
-
detail: `opencode shim target missing: ${
|
|
884
|
+
detail: `opencode shim target missing: ${targetPath} \u2014 re-run \`ctxdb setup --agent opencode\``
|
|
884
885
|
};
|
|
885
886
|
}
|
|
886
887
|
return {
|
|
887
888
|
installed: true,
|
|
888
|
-
nodePaths: [
|
|
889
|
+
nodePaths: [targetPath],
|
|
889
890
|
nodeOk: true,
|
|
890
|
-
detail: `opencode shim: ${path} \u2192 ${
|
|
891
|
+
detail: `opencode shim: ${path} \u2192 ${targetPath}`
|
|
891
892
|
};
|
|
892
893
|
}
|
|
893
894
|
var SETTINGS_BACKUP_KEEP = 5;
|
|
@@ -1112,6 +1113,10 @@ var OPENCODE_SHIM_FILENAME = "ctxdb.ts";
|
|
|
1112
1113
|
function opencodeShimPath() {
|
|
1113
1114
|
return join(homedir(), ".config", "opencode", "plugins", OPENCODE_SHIM_FILENAME);
|
|
1114
1115
|
}
|
|
1116
|
+
var OPENCODE_BUNDLE_FILENAME = "ctxdb-bundle.js";
|
|
1117
|
+
function opencodeBundlePath() {
|
|
1118
|
+
return join(homedir(), ".config", "opencode", "plugins", OPENCODE_BUNDLE_FILENAME);
|
|
1119
|
+
}
|
|
1115
1120
|
function resolveOpencodePluginEntry() {
|
|
1116
1121
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
1117
1122
|
const pkgRoot = walkUpToPackageJson(here, "@aliyunrds/ctxdb");
|
|
@@ -1124,22 +1129,28 @@ function resolveOpencodePluginEntry() {
|
|
|
1124
1129
|
}
|
|
1125
1130
|
var OPENCODE_SHIM_HEADER = "// Generated by ctxdb setup --agent opencode. Do not edit by hand.\n// To refresh after moving ctxdb's install directory, run ctxdb upgrade --agent opencode or re-run setup.\n// To remove, run: ctxdb setup --remove --agent opencode\n";
|
|
1126
1131
|
function writeOpencodeShim(absEntry) {
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1129
|
-
|
|
1132
|
+
const shimPath = opencodeShimPath();
|
|
1133
|
+
const bundlePath = opencodeBundlePath();
|
|
1134
|
+
mkdirSync(dirname(shimPath), { recursive: true });
|
|
1135
|
+
copyFileSync(absEntry, bundlePath);
|
|
1136
|
+
const importSpec = "./" + OPENCODE_BUNDLE_FILENAME;
|
|
1130
1137
|
const body = `${OPENCODE_SHIM_HEADER}export { default } from ${JSON.stringify(importSpec)};
|
|
1131
1138
|
`;
|
|
1132
|
-
writeFileSync(
|
|
1139
|
+
writeFileSync(shimPath, body, "utf-8");
|
|
1133
1140
|
}
|
|
1134
1141
|
function removeOpencodeShim() {
|
|
1135
|
-
const
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
+
const shimPath = opencodeShimPath();
|
|
1143
|
+
const bundlePath = opencodeBundlePath();
|
|
1144
|
+
let removed = false;
|
|
1145
|
+
for (const p of [shimPath, bundlePath]) {
|
|
1146
|
+
if (!existsSync(p)) continue;
|
|
1147
|
+
try {
|
|
1148
|
+
unlinkSync(p);
|
|
1149
|
+
removed = true;
|
|
1150
|
+
} catch {
|
|
1151
|
+
}
|
|
1142
1152
|
}
|
|
1153
|
+
return removed;
|
|
1143
1154
|
}
|
|
1144
1155
|
var ENTRY_MARKER_KEY = "_ctxdb";
|
|
1145
1156
|
var ENTRY_MARKER_VALUE = "@aliyunrds/ctxdb";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliyunrds/ctxdb",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Unified access layer for RDS ContextDatabase: `ctxdb` CLI (memory + KB ops), one-shot `setup --agent <qoder|qoderwork|codex|claude|opencode>` installer, per-agent config, hooks/plugins, and SKILL.md.",
|
|
6
6
|
"license": "Apache-2.0",
|