@aliyunrds/ctxdb 1.0.0-beta.3 → 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 +24 -14
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -237,8 +237,8 @@ import {
|
|
|
237
237
|
statSync
|
|
238
238
|
} from "fs";
|
|
239
239
|
import { homedir } from "os";
|
|
240
|
-
import { join, dirname } from "path";
|
|
241
|
-
import { fileURLToPath
|
|
240
|
+
import { join, dirname, resolve } from "path";
|
|
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`";
|
|
244
244
|
var UNINSTALL_ORDER_HINT = "When you eventually want to uninstall: run `ctxdb uninstall --purge-all` FIRST, then `npm uninstall -g @aliyunrds/ctxdb @aliyunrds/ctxdb-shared`. (npm 7+ removed uninstall lifecycle hooks, so the order matters \u2014 otherwise agent settings.json hooks + ~/.ctxdb/ residue stay behind.)";
|
|
@@ -875,7 +875,7 @@ function checkOpencodeShimHealth() {
|
|
|
875
875
|
detail: `opencode shim malformed: ${path} \u2014 re-run \`ctxdb setup --agent opencode\``
|
|
876
876
|
};
|
|
877
877
|
}
|
|
878
|
-
const targetPath = target.startsWith("file:") ? fileURLToPath(target) : target;
|
|
878
|
+
const targetPath = target.startsWith("file:") ? fileURLToPath(target) : resolve(dirname(path), target);
|
|
879
879
|
if (!existsSync(targetPath)) {
|
|
880
880
|
return {
|
|
881
881
|
installed: true,
|
|
@@ -1113,6 +1113,10 @@ var OPENCODE_SHIM_FILENAME = "ctxdb.ts";
|
|
|
1113
1113
|
function opencodeShimPath() {
|
|
1114
1114
|
return join(homedir(), ".config", "opencode", "plugins", OPENCODE_SHIM_FILENAME);
|
|
1115
1115
|
}
|
|
1116
|
+
var OPENCODE_BUNDLE_FILENAME = "ctxdb-bundle.js";
|
|
1117
|
+
function opencodeBundlePath() {
|
|
1118
|
+
return join(homedir(), ".config", "opencode", "plugins", OPENCODE_BUNDLE_FILENAME);
|
|
1119
|
+
}
|
|
1116
1120
|
function resolveOpencodePluginEntry() {
|
|
1117
1121
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
1118
1122
|
const pkgRoot = walkUpToPackageJson(here, "@aliyunrds/ctxdb");
|
|
@@ -1125,22 +1129,28 @@ function resolveOpencodePluginEntry() {
|
|
|
1125
1129
|
}
|
|
1126
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";
|
|
1127
1131
|
function writeOpencodeShim(absEntry) {
|
|
1128
|
-
const
|
|
1129
|
-
|
|
1130
|
-
|
|
1132
|
+
const shimPath = opencodeShimPath();
|
|
1133
|
+
const bundlePath = opencodeBundlePath();
|
|
1134
|
+
mkdirSync(dirname(shimPath), { recursive: true });
|
|
1135
|
+
copyFileSync(absEntry, bundlePath);
|
|
1136
|
+
const importSpec = "./" + OPENCODE_BUNDLE_FILENAME;
|
|
1131
1137
|
const body = `${OPENCODE_SHIM_HEADER}export { default } from ${JSON.stringify(importSpec)};
|
|
1132
1138
|
`;
|
|
1133
|
-
writeFileSync(
|
|
1139
|
+
writeFileSync(shimPath, body, "utf-8");
|
|
1134
1140
|
}
|
|
1135
1141
|
function removeOpencodeShim() {
|
|
1136
|
-
const
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
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
|
+
}
|
|
1143
1152
|
}
|
|
1153
|
+
return removed;
|
|
1144
1154
|
}
|
|
1145
1155
|
var ENTRY_MARKER_KEY = "_ctxdb";
|
|
1146
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",
|