@aliyunrds/ctxdb 1.0.3 → 1.0.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 +22 -12
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -127,8 +127,14 @@ var BOLD = "\x1B[1m";
|
|
|
127
127
|
var RESET = "\x1B[0m";
|
|
128
128
|
var CHECK = `${GREEN}\u2714${RESET}`;
|
|
129
129
|
var CROSS = `${RED}\u2718${RESET}`;
|
|
130
|
+
function highlightInlineCode(text, surroundingStyle = "") {
|
|
131
|
+
return text.replace(
|
|
132
|
+
/`([^`\n]+)`/g,
|
|
133
|
+
(_match, content) => `${RESET}${BOLD}${content}${RESET}${surroundingStyle}`
|
|
134
|
+
);
|
|
135
|
+
}
|
|
130
136
|
function dim(text) {
|
|
131
|
-
return `${DIM}${text}${RESET}`;
|
|
137
|
+
return `${DIM}${highlightInlineCode(text, DIM)}${RESET}`;
|
|
132
138
|
}
|
|
133
139
|
function isSetupResult(v) {
|
|
134
140
|
if (typeof v !== "object" || v === null) return false;
|
|
@@ -153,7 +159,7 @@ function formatSetupResult(r, command = "setup") {
|
|
|
153
159
|
`);
|
|
154
160
|
for (const s of r.steps) {
|
|
155
161
|
const icon = s.ok ? CHECK : CROSS;
|
|
156
|
-
const detail = s.detail ? ` ${
|
|
162
|
+
const detail = s.detail ? ` ${dim(s.detail)}` : "";
|
|
157
163
|
lines.push(` ${icon} ${s.step}${detail}`);
|
|
158
164
|
}
|
|
159
165
|
return lines.join("\n");
|
|
@@ -168,7 +174,7 @@ function formatUpgradeResult(r) {
|
|
|
168
174
|
lines.push(` ${icon} ${BOLD}${name}${RESET}`);
|
|
169
175
|
for (const s of result.steps) {
|
|
170
176
|
const sIcon = s.ok ? CHECK : CROSS;
|
|
171
|
-
const detail = s.detail ? ` ${
|
|
177
|
+
const detail = s.detail ? ` ${dim(s.detail)}` : "";
|
|
172
178
|
lines.push(` ${sIcon} ${s.step}${detail}`);
|
|
173
179
|
}
|
|
174
180
|
}
|
|
@@ -186,11 +192,11 @@ function formatMultiAgentResult(r) {
|
|
|
186
192
|
lines.push(` ${agentOk ? CHECK : CROSS} ${BOLD}${name}${RESET}`);
|
|
187
193
|
if (r.operation === "setup") {
|
|
188
194
|
for (const step of result.steps ?? []) {
|
|
189
|
-
const detail = step.detail ? ` ${
|
|
195
|
+
const detail = step.detail ? ` ${dim(step.detail)}` : "";
|
|
190
196
|
lines.push(` ${step.ok ? CHECK : CROSS} ${step.step}${detail}`);
|
|
191
197
|
}
|
|
192
198
|
for (const hint of result.hints ?? []) {
|
|
193
|
-
lines.push(` ${DIM}hint${RESET} ${hint}`);
|
|
199
|
+
lines.push(` ${DIM}hint${RESET} ${highlightInlineCode(hint)}`);
|
|
194
200
|
}
|
|
195
201
|
continue;
|
|
196
202
|
}
|
|
@@ -1518,7 +1524,7 @@ function hermesAllowlistPath() {
|
|
|
1518
1524
|
return join(dirname(hermesConfigPath()), HERMES_ALLOWLIST_FILENAME);
|
|
1519
1525
|
}
|
|
1520
1526
|
function hermesHookApprovalHint(events = HERMES_HOOK_EVENTS) {
|
|
1521
|
-
const hookNames = events.
|
|
1527
|
+
const hookNames = events.join(" and ");
|
|
1522
1528
|
return `Approve the Hermes ctxdb hooks ${hookNames}: run \`hermes --accept-hooks chat\` once. This command opens an interactive chat; after Hermes starts, exit the chat, rerun \`ctxdb setup --agent hermes\`, then restart any running Hermes CLI or gateway process.`;
|
|
1523
1529
|
}
|
|
1524
1530
|
function backupHermesConfig() {
|
|
@@ -2124,8 +2130,8 @@ FLAGS
|
|
|
2124
2130
|
--json Machine-readable JSON output
|
|
2125
2131
|
`;
|
|
2126
2132
|
var CODEX_HOOKS_TRUST_REMINDER = [
|
|
2127
|
-
"codex hooks \u914D\u7F6E\u540E\uFF0C\u9700\u8981\u91CD\u542F Codex \u5BF9\u8BDD\uFF0C\u5728\u5F39\u51FA\u7684 hooks \u786E\u8BA4\u754C\u9762\u9009\u62E9
|
|
2128
|
-
"\u5982\u679C\u4F7F\u7528\u7684\u662F Codex App \u684C\u9762\u7248\uFF0C\u64CD\u4F5C\u8DEF\u5F84\u662F\uFF1A\u5DE6\u4E0B\u89D2\u70B9\u51FB\u7528\u6237\u540D \u2192 \u70B9\u51FB\u8BBE\u7F6E \u2192 \u70B9\u51FB\u4FA7\u8FB9\u680F\u7684 Hooks\uFF08\u94A9\u5B50\uFF09
|
|
2133
|
+
"codex hooks \u914D\u7F6E\u540E\uFF0C\u9700\u8981\u91CD\u542F Codex \u5BF9\u8BDD\uFF0C\u5728\u5F39\u51FA\u7684 hooks \u786E\u8BA4\u754C\u9762\u9009\u62E9`\u63A5\u6536\u6240\u6709 hooks(\u94A9\u5B50)`\u9009\u9879\u3002",
|
|
2134
|
+
"\u5982\u679C\u4F7F\u7528\u7684\u662F Codex App \u684C\u9762\u7248\uFF0C\u64CD\u4F5C\u8DEF\u5F84\u662F\uFF1A\u5DE6\u4E0B\u89D2\u70B9\u51FB\u7528\u6237\u540D \u2192 \u70B9\u51FB\u8BBE\u7F6E \u2192 \u70B9\u51FB\u4FA7\u8FB9\u680F\u7684 `Hooks\uFF08\u94A9\u5B50\uFF09`\u2192 \u70B9\u51FB`\u7528\u6237\u914D\u7F6E`\uFF0C\u4FE1\u4EFB `UserPromptSubmit`\u3001`SessionStart` \u548C `Stop` \u91CC\u7684 `aliyunrds/ctxdb` \u94A9\u5B50\u3002"
|
|
2129
2135
|
].join("\n");
|
|
2130
2136
|
function parseAgent(args) {
|
|
2131
2137
|
const raw = args.flags.agent;
|
|
@@ -2158,9 +2164,11 @@ async function setup(args) {
|
|
|
2158
2164
|
});
|
|
2159
2165
|
printResult(result2, json);
|
|
2160
2166
|
if (!json && result2.hints) {
|
|
2161
|
-
for (const hint of result2.hints)
|
|
2162
|
-
|
|
2167
|
+
for (const hint of result2.hints) {
|
|
2168
|
+
process.stderr.write(`
|
|
2169
|
+
${highlightInlineCode(hint)}
|
|
2163
2170
|
`);
|
|
2171
|
+
}
|
|
2164
2172
|
}
|
|
2165
2173
|
if (!json && result2.agents.codex?.ok) {
|
|
2166
2174
|
process.stderr.write(
|
|
@@ -2188,9 +2196,11 @@ ${dim(CODEX_HOOKS_TRUST_REMINDER)}
|
|
|
2188
2196
|
});
|
|
2189
2197
|
printResult(result, json);
|
|
2190
2198
|
if (!json && result.hints) {
|
|
2191
|
-
for (const h of result.hints)
|
|
2192
|
-
|
|
2199
|
+
for (const h of result.hints) {
|
|
2200
|
+
process.stderr.write(`
|
|
2201
|
+
${highlightInlineCode(h)}
|
|
2193
2202
|
`);
|
|
2203
|
+
}
|
|
2194
2204
|
}
|
|
2195
2205
|
if (!json && agent === "codex" && result.ok) {
|
|
2196
2206
|
process.stderr.write(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aliyunrds/ctxdb",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.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|hermes>` installer, per-agent config, hooks/plugins, and SKILL.md.",
|
|
6
6
|
"license": "Apache-2.0",
|