ctxpipe 0.1.1 → 0.3.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/README.md +72 -3
- package/dist/auth.d.ts +18 -0
- package/dist/auth.js +92 -1
- package/dist/auth.js.map +1 -1
- package/dist/commands.d.ts +23 -3
- package/dist/commands.js +71 -27
- package/dist/commands.js.map +1 -1
- package/dist/fs-operations.d.ts +1 -1
- package/dist/fs-operations.js +28 -1
- package/dist/fs-operations.js.map +1 -1
- package/dist/mcp/doctor.d.ts +21 -0
- package/dist/mcp/doctor.js +326 -0
- package/dist/mcp/doctor.js.map +1 -0
- package/dist/mcp/mcp-operations.d.ts +39 -4
- package/dist/mcp/mcp-operations.js +176 -54
- package/dist/mcp/mcp-operations.js.map +1 -1
- package/dist/memory/capture.d.ts +72 -0
- package/dist/memory/capture.js +677 -0
- package/dist/memory/capture.js.map +1 -0
- package/dist/memory/hooks.d.ts +16 -0
- package/dist/memory/hooks.js +393 -0
- package/dist/memory/hooks.js.map +1 -0
- package/dist/memory/index.d.ts +3 -0
- package/dist/memory/index.js +4 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/paths.d.ts +4 -0
- package/dist/memory/paths.js +17 -0
- package/dist/memory/paths.js.map +1 -0
- package/dist/memory/run-capture.d.ts +12 -0
- package/dist/memory/run-capture.js +116 -0
- package/dist/memory/run-capture.js.map +1 -0
- package/dist/memory/run-init.d.ts +10 -0
- package/dist/memory/run-init.js +88 -0
- package/dist/memory/run-init.js.map +1 -0
- package/dist/memory/run-meta.d.ts +11 -0
- package/dist/memory/run-meta.js +87 -0
- package/dist/memory/run-meta.js.map +1 -0
- package/dist/memory/seed.d.ts +18 -0
- package/dist/memory/seed.js +239 -0
- package/dist/memory/seed.js.map +1 -0
- package/dist/memory/upgrade.d.ts +16 -0
- package/dist/memory/upgrade.js +283 -0
- package/dist/memory/upgrade.js.map +1 -0
- package/dist/program.js +148 -16
- package/dist/program.js.map +1 -1
- package/dist/prompts.d.ts +15 -0
- package/dist/prompts.js +138 -1
- package/dist/prompts.js.map +1 -1
- package/dist/ui.js +12 -1
- package/dist/ui.js.map +1 -1
- package/package.json +4 -2
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
+
import { join, resolve } from "node:path";
|
|
3
|
+
import { createOperationContext } from "../mcp/mcp-operations.js";
|
|
4
|
+
import { isObject } from "../mcp/json.js";
|
|
5
|
+
import { relativePath } from "../mcp/paths.js";
|
|
6
|
+
import { LESSONS_SEED, MEMORY_README_SEED } from "./seed.js";
|
|
7
|
+
/** Legacy AgentMemory / ConKeeper guidance that must not survive re-init. */
|
|
8
|
+
export function isLegacyMemoryDoc(text) {
|
|
9
|
+
// Require multiple signals so a single negated mention ("do not use AgentMemory")
|
|
10
|
+
// does not wipe a custom README.
|
|
11
|
+
let score = 0;
|
|
12
|
+
if (/\bagentmemory\b/i.test(text) &&
|
|
13
|
+
!/\b(?:do not|don't|never|without|no longer)\b[^\n]{0,40}\bagentmemory\b/i.test(text)) {
|
|
14
|
+
score += 1;
|
|
15
|
+
}
|
|
16
|
+
if (/\bctxpipe-memory\b/i.test(text) &&
|
|
17
|
+
!/\b(?:do not|don't|never|without|strips?|remove[sd]?)\b[^\n]{0,48}\bctxpipe-memory\b/i.test(text)) {
|
|
18
|
+
score += 1;
|
|
19
|
+
}
|
|
20
|
+
if (/npx\s+[^\n]*\bmemory\s+mcp\b/i.test(text) &&
|
|
21
|
+
!/\b(?:do not|don't|never|without|avoid)\b[^\n]{0,48}npx\s+[^\n]*\bmemory\s+mcp\b/i.test(text)) {
|
|
22
|
+
score += 2;
|
|
23
|
+
}
|
|
24
|
+
if (/conkeeper/i.test(text))
|
|
25
|
+
score += 2;
|
|
26
|
+
if (/memory-(?:sync|init|reflect|insights|search)/i.test(text))
|
|
27
|
+
score += 1;
|
|
28
|
+
if (/\bpatterns\.md\b/i.test(text) && /lessons-learned/i.test(text)) {
|
|
29
|
+
score += 1;
|
|
30
|
+
}
|
|
31
|
+
return score >= 2;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Strip retired local-memory MCP tables from Codex config.toml
|
|
35
|
+
* (e.g. `[mcp_servers.ctxpipe-memory]` from `codex mcp add`).
|
|
36
|
+
*/
|
|
37
|
+
export function stripLegacyCodexMemoryToml(existing) {
|
|
38
|
+
// Match section headers even when indented; stop at the next header line.
|
|
39
|
+
let text = existing.replace(/^[ \t]*\[(?:mcp_servers|mcp\.servers)\.ctxpipe-memory\][^\n]*(?:\n(?![ \t]*\[)[^\n]*)*/gm, "");
|
|
40
|
+
// Drop orphaned blank runs introduced by section removal.
|
|
41
|
+
text = text.replace(/\n{3,}/g, "\n\n");
|
|
42
|
+
if (!text.trim())
|
|
43
|
+
return text.endsWith("\n") ? "\n" : text;
|
|
44
|
+
return text.endsWith("\n") ? text : `${text}\n`;
|
|
45
|
+
}
|
|
46
|
+
const RETIRED_SKILLS = [
|
|
47
|
+
"memory-init",
|
|
48
|
+
"memory-sync",
|
|
49
|
+
// memory-search is reintroduced as Markdown+rg recall (ADR-024) — do not delete.
|
|
50
|
+
"memory-reflect",
|
|
51
|
+
"memory-insights",
|
|
52
|
+
"session-handoff",
|
|
53
|
+
];
|
|
54
|
+
const RETIRED_RULES = ["project-memory.mdc"];
|
|
55
|
+
/** True only for the retired local memory MCP / hook paths — not the remote product MCP. */
|
|
56
|
+
function isLegacyLocalMemoryServer(key, value) {
|
|
57
|
+
if (key === "ctxpipe-memory")
|
|
58
|
+
return true;
|
|
59
|
+
if (typeof value === "string") {
|
|
60
|
+
return /memory mcp|memory hook|agentmemory/i.test(value);
|
|
61
|
+
}
|
|
62
|
+
if (!isObject(value))
|
|
63
|
+
return false;
|
|
64
|
+
const cmd = typeof value.command === "string" ? value.command : "";
|
|
65
|
+
const args = Array.isArray(value.args)
|
|
66
|
+
? value.args.filter((a) => typeof a === "string").join(" ")
|
|
67
|
+
: "";
|
|
68
|
+
const joined = `${cmd} ${args}`;
|
|
69
|
+
// Keep remote streamable-http `ctxpipe` entries (url-based, no memory mcp/hook).
|
|
70
|
+
if (typeof value.url === "string" && value.url.includes("/mcp"))
|
|
71
|
+
return false;
|
|
72
|
+
return (/memory mcp|agentmemory/i.test(joined) ||
|
|
73
|
+
(/memory hook/i.test(joined) && !/memory capture/i.test(joined)));
|
|
74
|
+
}
|
|
75
|
+
function stripServerMap(servers) {
|
|
76
|
+
const next = {};
|
|
77
|
+
for (const [key, value] of Object.entries(servers)) {
|
|
78
|
+
if (isLegacyLocalMemoryServer(key, value))
|
|
79
|
+
continue;
|
|
80
|
+
next[key] = value;
|
|
81
|
+
}
|
|
82
|
+
return next;
|
|
83
|
+
}
|
|
84
|
+
/** Strip legacy AgentMemory MCP + memory stanza from JSON configs. */
|
|
85
|
+
export function stripLegacyMemoryMcp(existing) {
|
|
86
|
+
const next = { ...existing };
|
|
87
|
+
for (const key of ["mcpServers", "servers", "mcp"]) {
|
|
88
|
+
if (isObject(next[key])) {
|
|
89
|
+
next[key] = stripServerMap(next[key]);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if ("memory" in next) {
|
|
93
|
+
delete next.memory;
|
|
94
|
+
}
|
|
95
|
+
return next;
|
|
96
|
+
}
|
|
97
|
+
function stripMcpJsonOperation(path, context) {
|
|
98
|
+
return {
|
|
99
|
+
type: "write-json",
|
|
100
|
+
path,
|
|
101
|
+
description: `remove legacy ctxpipe-memory MCP from ${relativePath(path, context.cwd)}`,
|
|
102
|
+
content(existing = {}) {
|
|
103
|
+
return stripLegacyMemoryMcp(existing);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
function isLegacyMemoryHookCommand(cmd) {
|
|
108
|
+
if (/memory capture/i.test(cmd))
|
|
109
|
+
return false;
|
|
110
|
+
return /memory hook|memory mcp|agentmemory/i.test(cmd);
|
|
111
|
+
}
|
|
112
|
+
function stripLegacyClaudeHooks(existing) {
|
|
113
|
+
if (!isObject(existing.hooks))
|
|
114
|
+
return existing;
|
|
115
|
+
const hooks = { ...existing.hooks };
|
|
116
|
+
for (const [event, matchers] of Object.entries(hooks)) {
|
|
117
|
+
if (!Array.isArray(matchers))
|
|
118
|
+
continue;
|
|
119
|
+
hooks[event] = matchers
|
|
120
|
+
.map((matcher) => {
|
|
121
|
+
if (!isObject(matcher))
|
|
122
|
+
return matcher;
|
|
123
|
+
const inner = Array.isArray(matcher.hooks) ? matcher.hooks : null;
|
|
124
|
+
if (!inner) {
|
|
125
|
+
const cmd = typeof matcher.command === "string" ? matcher.command : "";
|
|
126
|
+
if (isLegacyMemoryHookCommand(cmd))
|
|
127
|
+
return null;
|
|
128
|
+
return matcher;
|
|
129
|
+
}
|
|
130
|
+
const nextInner = inner.filter((hook) => {
|
|
131
|
+
if (!isObject(hook))
|
|
132
|
+
return true;
|
|
133
|
+
const cmd = typeof hook.command === "string" ? hook.command : "";
|
|
134
|
+
return !isLegacyMemoryHookCommand(cmd);
|
|
135
|
+
});
|
|
136
|
+
if (nextInner.length === 0)
|
|
137
|
+
return null;
|
|
138
|
+
return { ...matcher, hooks: nextInner };
|
|
139
|
+
})
|
|
140
|
+
.filter((m) => m !== null);
|
|
141
|
+
}
|
|
142
|
+
return { ...existing, hooks };
|
|
143
|
+
}
|
|
144
|
+
function migratePatternsToLessonsOperation(context) {
|
|
145
|
+
const memoryRoot = resolve(context.cwd, ".ai", "memory");
|
|
146
|
+
const patternsPath = resolve(memoryRoot, "patterns.md");
|
|
147
|
+
const lessonsPath = resolve(memoryRoot, "lessons-learned.md");
|
|
148
|
+
return {
|
|
149
|
+
type: "write-text",
|
|
150
|
+
path: lessonsPath,
|
|
151
|
+
description: "migrate patterns.md into lessons-learned.md when present",
|
|
152
|
+
content(existing) {
|
|
153
|
+
if (!existsSync(patternsPath)) {
|
|
154
|
+
return existing ?? LESSONS_SEED;
|
|
155
|
+
}
|
|
156
|
+
const patterns = readFileSync(patternsPath, "utf8");
|
|
157
|
+
if (!patterns.trim())
|
|
158
|
+
return existing ?? LESSONS_SEED;
|
|
159
|
+
if (existing && existing.includes("Migrated from former `patterns.md`")) {
|
|
160
|
+
return existing;
|
|
161
|
+
}
|
|
162
|
+
const header = existing && existing.trim()
|
|
163
|
+
? existing.trimEnd()
|
|
164
|
+
: LESSONS_SEED.trimEnd();
|
|
165
|
+
return `${header}\n\n## Migrated from former \`patterns.md\`\n\n${patterns.trim()}\n`;
|
|
166
|
+
},
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
function pushRetiredSkillAndRuleRemovals(ops, root) {
|
|
170
|
+
const skillsRoot = resolve(root, "skills");
|
|
171
|
+
const rulesRoot = resolve(root, "rules");
|
|
172
|
+
for (const name of RETIRED_SKILLS) {
|
|
173
|
+
ops.push({
|
|
174
|
+
type: "remove-path",
|
|
175
|
+
path: resolve(skillsRoot, name),
|
|
176
|
+
description: `remove retired skill ${name} under ${relativePath(skillsRoot, root)}`,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
for (const name of RETIRED_RULES) {
|
|
180
|
+
ops.push({
|
|
181
|
+
type: "remove-path",
|
|
182
|
+
path: resolve(rulesRoot, name),
|
|
183
|
+
description: `remove retired rule ${name}`,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* One-shot upgrade ops so re-init leaves no AgentMemory / ConKeeper dual layout.
|
|
189
|
+
*/
|
|
190
|
+
export function buildMemoryUpgradeOperations({ context = createOperationContext(), } = {}) {
|
|
191
|
+
const ops = [];
|
|
192
|
+
const cwd = context.cwd;
|
|
193
|
+
const memoryRoot = resolve(cwd, ".ai", "memory");
|
|
194
|
+
// MCP / config cleanup — only touch files that already exist (do not create empties).
|
|
195
|
+
for (const path of [
|
|
196
|
+
resolve(cwd, ".cursor", "mcp.json"),
|
|
197
|
+
resolve(cwd, ".agents", "mcp.json"),
|
|
198
|
+
resolve(cwd, ".mcp.json"),
|
|
199
|
+
resolve(cwd, ".vscode", "mcp.json"),
|
|
200
|
+
resolve(cwd, "opencode.json"),
|
|
201
|
+
join(context.homeDir, ".config", "opencode", "opencode.json"),
|
|
202
|
+
resolve(cwd, ".ctxpipe", "config.json"),
|
|
203
|
+
join(context.homeDir, ".cursor", "mcp.json"),
|
|
204
|
+
]) {
|
|
205
|
+
if (existsSync(path))
|
|
206
|
+
ops.push(stripMcpJsonOperation(path, context));
|
|
207
|
+
}
|
|
208
|
+
// Codex TOML (user + repo): strip ctxpipe-memory MCP tables from `codex mcp add`.
|
|
209
|
+
for (const path of [
|
|
210
|
+
resolve(cwd, ".codex", "config.toml"),
|
|
211
|
+
join(context.homeDir, ".codex", "config.toml"),
|
|
212
|
+
]) {
|
|
213
|
+
if (!existsSync(path))
|
|
214
|
+
continue;
|
|
215
|
+
ops.push({
|
|
216
|
+
type: "write-text",
|
|
217
|
+
path,
|
|
218
|
+
description: `strip legacy ctxpipe-memory from Codex config ${relativePath(path, context.cwd)}`,
|
|
219
|
+
content(existing) {
|
|
220
|
+
return stripLegacyCodexMemoryToml(existing ?? "");
|
|
221
|
+
},
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
// Replace AgentMemory-era README so skipIfExists seed cannot leave dual guidance.
|
|
225
|
+
const readmePath = resolve(memoryRoot, "README.md");
|
|
226
|
+
if (existsSync(readmePath)) {
|
|
227
|
+
ops.push({
|
|
228
|
+
type: "write-text",
|
|
229
|
+
path: readmePath,
|
|
230
|
+
description: "replace legacy AgentMemory README with ADR-024 seed when detected",
|
|
231
|
+
content(existing) {
|
|
232
|
+
if (existing && isLegacyMemoryDoc(existing))
|
|
233
|
+
return MEMORY_README_SEED;
|
|
234
|
+
return existing ?? MEMORY_README_SEED;
|
|
235
|
+
},
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
// Claude settings: strip retired memory hook commands (user + project).
|
|
239
|
+
for (const path of [
|
|
240
|
+
join(context.homeDir, ".claude", "settings.json"),
|
|
241
|
+
join(context.homeDir, ".claude", "settings.local.json"),
|
|
242
|
+
resolve(cwd, ".claude", "settings.json"),
|
|
243
|
+
resolve(cwd, ".claude", "settings.local.json"),
|
|
244
|
+
]) {
|
|
245
|
+
if (!existsSync(path))
|
|
246
|
+
continue;
|
|
247
|
+
ops.push({
|
|
248
|
+
type: "write-json",
|
|
249
|
+
path,
|
|
250
|
+
description: `strip legacy Claude memory hooks from ${relativePath(path, context.cwd)}`,
|
|
251
|
+
content(existing = {}) {
|
|
252
|
+
return stripLegacyClaudeHooks(existing);
|
|
253
|
+
},
|
|
254
|
+
});
|
|
255
|
+
}
|
|
256
|
+
// Migrate patterns → lessons, then remove patterns.md
|
|
257
|
+
ops.push(migratePatternsToLessonsOperation(context));
|
|
258
|
+
ops.push({
|
|
259
|
+
type: "remove-path",
|
|
260
|
+
path: resolve(memoryRoot, "patterns.md"),
|
|
261
|
+
description: "remove legacy patterns.md after migration",
|
|
262
|
+
});
|
|
263
|
+
// Retired ConKeeper skills / rule — both Cursor-primary and legacy .agents roots
|
|
264
|
+
pushRetiredSkillAndRuleRemovals(ops, resolve(cwd, ".cursor"));
|
|
265
|
+
// Only if .agents is a real directory (not the same inode as .cursor via symlink).
|
|
266
|
+
const agentsRoot = resolve(cwd, ".agents");
|
|
267
|
+
if (existsSync(agentsRoot)) {
|
|
268
|
+
pushRetiredSkillAndRuleRemovals(ops, agentsRoot);
|
|
269
|
+
}
|
|
270
|
+
// Legacy decisions/sessions README routers (replaced by index.md)
|
|
271
|
+
ops.push({
|
|
272
|
+
type: "remove-path",
|
|
273
|
+
path: resolve(memoryRoot, "decisions", "README.md"),
|
|
274
|
+
description: "remove legacy decisions/README.md (use index.md)",
|
|
275
|
+
});
|
|
276
|
+
ops.push({
|
|
277
|
+
type: "remove-path",
|
|
278
|
+
path: resolve(memoryRoot, "sessions", "README.md"),
|
|
279
|
+
description: "remove legacy sessions/README.md (use index.md)",
|
|
280
|
+
});
|
|
281
|
+
return ops;
|
|
282
|
+
}
|
|
283
|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 @@
|
|
|
1
|
-
import { Command } from "commander";
|
|
1
|
+
import { Command, Option } from "commander";
|
|
2
|
+
import { runAuthLogin, runAuthLogout, runAuthWhoami, runDoctor, runInit, runMcpAdd, runMcpDoctor, } from "./commands.js";
|
|
2
3
|
import { DEFAULT_BASE_URL } from "./constants.js";
|
|
4
|
+
import { runMemoryCaptureDismiss, runMemoryCaptureFinalize, runMemoryCaptureObserve, runMemoryCapturePromote, runMemoryCaptureSummary, runMemoryDoctor, runMemoryInit, runMemoryStatus, runMemoryStop, } from "./memory/index.js";
|
|
3
5
|
import { packageVersion } from "./version.js";
|
|
4
|
-
import { runAuthLogin, runAuthLogout, runAuthWhoami, runDoctor, runInit, runMcpAdd, } from "./commands.js";
|
|
5
6
|
function collectList(value, previous) {
|
|
6
7
|
return [
|
|
7
8
|
...previous,
|
|
@@ -11,6 +12,14 @@ function collectList(value, previous) {
|
|
|
11
12
|
.filter(Boolean),
|
|
12
13
|
];
|
|
13
14
|
}
|
|
15
|
+
function resolveNonInteractive(raw) {
|
|
16
|
+
return Boolean(raw.nonInteractive || raw.yes);
|
|
17
|
+
}
|
|
18
|
+
function addNonInteractiveOption(command) {
|
|
19
|
+
return command
|
|
20
|
+
.option("--non-interactive, -y", "Apply without prompts; required for scripts/CI when stdin is not a TTY", false)
|
|
21
|
+
.addOption(new Option("--yes", "Deprecated alias for --non-interactive").hideHelp());
|
|
22
|
+
}
|
|
14
23
|
export async function runProgram(argv) {
|
|
15
24
|
const program = new Command()
|
|
16
25
|
.name("ctxpipe")
|
|
@@ -21,11 +30,12 @@ Human setup:
|
|
|
21
30
|
npx ctxpipe init
|
|
22
31
|
|
|
23
32
|
Examples (non-interactive):
|
|
24
|
-
npx ctxpipe init --org acme --agents codex,claude --scope repo --
|
|
25
|
-
npx ctxpipe mcp add --org acme --client cursor --scope repo --
|
|
33
|
+
npx ctxpipe init --org acme --agents codex,claude --scope repo --non-interactive
|
|
34
|
+
npx ctxpipe mcp add --org acme --client cursor --scope repo --non-interactive
|
|
26
35
|
npx ctxpipe doctor --json
|
|
36
|
+
npx ctxpipe doctor mcp --url "https://app.example.com/mcp?orgSlug=acme"
|
|
27
37
|
`);
|
|
28
|
-
program
|
|
38
|
+
addNonInteractiveOption(program
|
|
29
39
|
.command("init")
|
|
30
40
|
.description("Initialize the current repo (or user scope) for ctx|. Writes .ctxpipe/config.json and optional MCP client configs.")
|
|
31
41
|
.option("--org <slug>", "ctx| organization slug (required when not interactive)")
|
|
@@ -35,10 +45,10 @@ Examples (non-interactive):
|
|
|
35
45
|
.option("--agent <names>", "Alias for --agents (same comma-separated / repeatable rules).", collectList, [])
|
|
36
46
|
.option("--client <names>", "Alias for --agents (same comma-separated / repeatable rules).", collectList, [])
|
|
37
47
|
.option("--dry-run", "Print planned changes without writing files", false)
|
|
38
|
-
.option("--json", "Print machine-readable JSON (use with --
|
|
39
|
-
.option("-y, --yes", "Do not prompt; required for non-interactive apply", false)
|
|
48
|
+
.option("--json", "Print machine-readable JSON (use with --non-interactive to apply; init only for apply summary)", false)
|
|
40
49
|
.option("--no-mcp", "Skip MCP client configuration (still writes .ctxpipe/config.json with org and MCP URL)")
|
|
41
|
-
.
|
|
50
|
+
.option("--memory", "Enable Markdown .ai/memory layout, capture skills/rule, and host hooks for selected agents")
|
|
51
|
+
.option("--no-memory", "Skip local memory setup even if interactive selection would suggest it")).action(async (rawOpts) => {
|
|
42
52
|
const opts = rawOpts;
|
|
43
53
|
const agents = [
|
|
44
54
|
...(opts.agents ?? []),
|
|
@@ -52,11 +62,12 @@ Examples (non-interactive):
|
|
|
52
62
|
agents,
|
|
53
63
|
dryRun: opts.dryRun,
|
|
54
64
|
json: opts.json,
|
|
55
|
-
|
|
65
|
+
nonInteractive: resolveNonInteractive(rawOpts),
|
|
56
66
|
mcp: opts.mcp,
|
|
67
|
+
memory: opts.memory,
|
|
57
68
|
});
|
|
58
69
|
});
|
|
59
|
-
program
|
|
70
|
+
const doctor = program
|
|
60
71
|
.command("doctor")
|
|
61
72
|
.description("Print environment diagnostics (Node version, cwd, detected client CLIs).")
|
|
62
73
|
.option("--json", "Print diagnostics as JSON", false)
|
|
@@ -64,8 +75,32 @@ Examples (non-interactive):
|
|
|
64
75
|
const opts = rawOpts;
|
|
65
76
|
runDoctor({ json: opts.json });
|
|
66
77
|
});
|
|
78
|
+
doctor
|
|
79
|
+
.command("mcp")
|
|
80
|
+
.description("Diagnose a ctx| Streamable HTTP endpoint and its OAuth discovery metadata.")
|
|
81
|
+
.requiredOption("--url <url>", "ctx| MCP URL, including /mcp?orgSlug=<slug>")
|
|
82
|
+
.option("--timeout <ms>", "Per-request timeout in milliseconds", "10000")
|
|
83
|
+
.option("--json", "Print diagnostics as JSON", false)
|
|
84
|
+
.addHelpText("after", `
|
|
85
|
+
This command diagnoses ctx| HTTP routing, TLS/reachability, the unauthenticated
|
|
86
|
+
Bearer challenge, and OAuth discovery. It does not run browser OAuth, list
|
|
87
|
+
authenticated tools, invoke ctx_advisor, or test STDIO servers. A successful
|
|
88
|
+
result means the endpoint is ready for OAuth, not that authenticated tools work.
|
|
89
|
+
`)
|
|
90
|
+
.action(async (rawOpts) => {
|
|
91
|
+
const opts = rawOpts;
|
|
92
|
+
const timeoutMs = Number(opts.timeout);
|
|
93
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0) {
|
|
94
|
+
throw new Error("--timeout must be a positive integer");
|
|
95
|
+
}
|
|
96
|
+
await runMcpDoctor({
|
|
97
|
+
url: opts.url,
|
|
98
|
+
timeoutMs,
|
|
99
|
+
json: opts.json,
|
|
100
|
+
});
|
|
101
|
+
});
|
|
67
102
|
const mcp = program.command("mcp").description("MCP-only commands for ctx|.");
|
|
68
|
-
mcp
|
|
103
|
+
addNonInteractiveOption(mcp
|
|
69
104
|
.command("add")
|
|
70
105
|
.description("Configure ctx| MCP for one or more clients without re-running full init.")
|
|
71
106
|
.option("--org <slug>", "ctx| organization slug (required when not interactive)")
|
|
@@ -74,9 +109,7 @@ Examples (non-interactive):
|
|
|
74
109
|
.option("--client <names>", "Comma-separated client ids. Repeatable; merged with --clients.", collectList, [])
|
|
75
110
|
.option("--clients <names>", "Alias for --client (same comma-separated / repeatable rules).", collectList, [])
|
|
76
111
|
.option("--dry-run", "Print planned changes without writing files", false)
|
|
77
|
-
.option("--json", "Print machine-readable JSON (use with --
|
|
78
|
-
.option("-y, --yes", "Do not prompt; required for non-interactive apply", false)
|
|
79
|
-
.action(async (rawOpts) => {
|
|
112
|
+
.option("--json", "Print machine-readable JSON (use with --non-interactive to apply)", false)).action(async (rawOpts) => {
|
|
80
113
|
const opts = rawOpts;
|
|
81
114
|
const clients = [...(opts.client ?? []), ...(opts.clients ?? [])];
|
|
82
115
|
await runMcpAdd({
|
|
@@ -86,10 +119,12 @@ Examples (non-interactive):
|
|
|
86
119
|
clients,
|
|
87
120
|
dryRun: opts.dryRun,
|
|
88
121
|
json: opts.json,
|
|
89
|
-
|
|
122
|
+
nonInteractive: resolveNonInteractive(rawOpts),
|
|
90
123
|
});
|
|
91
124
|
});
|
|
92
|
-
const auth = program
|
|
125
|
+
const auth = program
|
|
126
|
+
.command("auth")
|
|
127
|
+
.description("Setup sign-in for listing organizations (separate from MCP OAuth).");
|
|
93
128
|
auth
|
|
94
129
|
.command("login")
|
|
95
130
|
.description("Sign in with a browser/device code and store credentials for setup commands.")
|
|
@@ -116,6 +151,103 @@ Examples (non-interactive):
|
|
|
116
151
|
const opts = rawOpts;
|
|
117
152
|
await runAuthLogout({ baseUrl: opts.baseUrl, json: opts.json });
|
|
118
153
|
});
|
|
154
|
+
const memory = program
|
|
155
|
+
.command("memory")
|
|
156
|
+
.description("Markdown-only local agent memory under .ai/memory with candidate capture hooks.");
|
|
157
|
+
addNonInteractiveOption(memory
|
|
158
|
+
.command("init")
|
|
159
|
+
.description("Seed .ai/memory layout, capture skills/rule, and install host hooks for selected agents (no remote ctxpipe MCP).")
|
|
160
|
+
.option("--org <slug>", "ctx| organization slug (optional; stored in .ctxpipe/config.json)")
|
|
161
|
+
.option("--base-url <url>", `ctx| app origin for auth (default: ${DEFAULT_BASE_URL})`, DEFAULT_BASE_URL)
|
|
162
|
+
.option("--scope <repo|user|both>", "Where to install host hooks (non-interactive default: repo)")
|
|
163
|
+
.option("--agents <names>", "Comma-separated client ids. Repeatable; merged with --agent and --client.", collectList, [])
|
|
164
|
+
.option("--agent <names>", "Alias for --agents.", collectList, [])
|
|
165
|
+
.option("--client <names>", "Alias for --agents.", collectList, [])
|
|
166
|
+
.option("--dry-run", "Print planned changes without writing files", false)
|
|
167
|
+
.option("--json", "Print machine-readable JSON (use with --non-interactive to apply)", false)).action(async (rawOpts) => {
|
|
168
|
+
const opts = rawOpts;
|
|
169
|
+
const agents = [
|
|
170
|
+
...(opts.agents ?? []),
|
|
171
|
+
...(opts.agent ?? []),
|
|
172
|
+
...(opts.client ?? []),
|
|
173
|
+
];
|
|
174
|
+
await runMemoryInit({
|
|
175
|
+
baseUrl: opts.baseUrl,
|
|
176
|
+
org: opts.org,
|
|
177
|
+
scope: opts.scope,
|
|
178
|
+
agents,
|
|
179
|
+
dryRun: opts.dryRun,
|
|
180
|
+
json: opts.json,
|
|
181
|
+
nonInteractive: resolveNonInteractive(rawOpts),
|
|
182
|
+
});
|
|
183
|
+
});
|
|
184
|
+
const capture = memory
|
|
185
|
+
.command("capture")
|
|
186
|
+
.description("Candidate capture pipeline invoked by host hooks (observe/summary).");
|
|
187
|
+
capture
|
|
188
|
+
.command("observe")
|
|
189
|
+
.description("Classify stdin JSON from a host hook and append candidates under .ai/memory/events/ (fail-open).")
|
|
190
|
+
.requiredOption("--host <name>", "Host id: cursor | claude | codex | opencode | vscode")
|
|
191
|
+
.option("--event <type>", "Host event type", "unknown")
|
|
192
|
+
.action(async (rawOpts) => {
|
|
193
|
+
const opts = rawOpts;
|
|
194
|
+
await runMemoryCaptureObserve({ host: opts.host, event: opts.event });
|
|
195
|
+
});
|
|
196
|
+
capture
|
|
197
|
+
.command("summary")
|
|
198
|
+
.description("Print unsummarized memory candidates as JSON for the host stop hook (does not write durable Markdown).")
|
|
199
|
+
.action(async () => {
|
|
200
|
+
await runMemoryCaptureSummary();
|
|
201
|
+
});
|
|
202
|
+
capture
|
|
203
|
+
.command("finalize")
|
|
204
|
+
.description("Observe stdin JSON then print a candidate summary (serialized Stop hook for Claude).")
|
|
205
|
+
.requiredOption("--host <name>", "Host id: cursor | claude | codex | opencode | vscode")
|
|
206
|
+
.option("--event <type>", "Host event type", "Stop")
|
|
207
|
+
.action(async (rawOpts) => {
|
|
208
|
+
const opts = rawOpts;
|
|
209
|
+
await runMemoryCaptureFinalize({ host: opts.host, event: opts.event });
|
|
210
|
+
});
|
|
211
|
+
capture
|
|
212
|
+
.command("promote")
|
|
213
|
+
.description("Mark candidate ids as promoted into durable Markdown (pending/surfaced → promoted).")
|
|
214
|
+
.argument("<ids...>", "Candidate ids from capture summary")
|
|
215
|
+
.action(async (ids) => {
|
|
216
|
+
await runMemoryCapturePromote(ids);
|
|
217
|
+
});
|
|
218
|
+
capture
|
|
219
|
+
.command("dismiss")
|
|
220
|
+
.description("Mark candidate ids as dismissed without promoting (pending/surfaced → dismissed).")
|
|
221
|
+
.argument("<ids...>", "Candidate ids from capture summary")
|
|
222
|
+
.action(async (ids) => {
|
|
223
|
+
await runMemoryCaptureDismiss(ids);
|
|
224
|
+
});
|
|
225
|
+
memory
|
|
226
|
+
.command("status")
|
|
227
|
+
.description("Report Markdown memory layout status for this repo.")
|
|
228
|
+
.option("--base-url <url>", `ctx| app origin (default: ${DEFAULT_BASE_URL})`, DEFAULT_BASE_URL)
|
|
229
|
+
.option("--json", "Print status as JSON", false)
|
|
230
|
+
.action(async (rawOpts) => {
|
|
231
|
+
const opts = rawOpts;
|
|
232
|
+
await runMemoryStatus({ baseUrl: opts.baseUrl, json: opts.json });
|
|
233
|
+
});
|
|
234
|
+
memory
|
|
235
|
+
.command("doctor")
|
|
236
|
+
.description("Diagnose local Markdown memory setup (layout, indexes, events).")
|
|
237
|
+
.option("--base-url <url>", `ctx| app origin (default: ${DEFAULT_BASE_URL})`, DEFAULT_BASE_URL)
|
|
238
|
+
.option("--json", "Print diagnostics as JSON", false)
|
|
239
|
+
.action(async (rawOpts) => {
|
|
240
|
+
const opts = rawOpts;
|
|
241
|
+
await runMemoryDoctor({ baseUrl: opts.baseUrl, json: opts.json });
|
|
242
|
+
});
|
|
243
|
+
memory
|
|
244
|
+
.command("stop")
|
|
245
|
+
.description("No-op compatibility command (no local memory runtime in Markdown-only mode).")
|
|
246
|
+
.option("--json", "Print result as JSON", false)
|
|
247
|
+
.action(async (rawOpts) => {
|
|
248
|
+
const opts = rawOpts;
|
|
249
|
+
await runMemoryStop({ json: opts.json });
|
|
250
|
+
});
|
|
119
251
|
if (argv.length === 0) {
|
|
120
252
|
program.outputHelp();
|
|
121
253
|
return;
|
package/dist/program.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"program.js","sourceRoot":"","sources":["../src/program.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAC3C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,aAAa,EACb,SAAS,EACT,OAAO,EACP,SAAS,EACT,YAAY,GACb,MAAM,eAAe,CAAA;AACtB,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,uBAAuB,EACvB,uBAAuB,EACvB,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,GACd,MAAM,mBAAmB,CAAA;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,SAAS,WAAW,CAAC,KAAa,EAAE,QAAkB;IACpD,OAAO;QACL,GAAG,QAAQ;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
agents: string[];
|
|
6
6
|
scope: string | null;
|
|
7
7
|
mcp: boolean;
|
|
8
|
+
/** Tri-state from CLI flags. undefined means "ask". */
|
|
9
|
+
memory?: boolean | undefined;
|
|
8
10
|
};
|
|
9
11
|
export type InitPromptAnswers = {
|
|
10
12
|
org?: string;
|
|
11
13
|
scope?: "repo" | "user" | "both";
|
|
12
14
|
agents?: Client[];
|
|
15
|
+
memory?: boolean;
|
|
13
16
|
};
|
|
14
17
|
export type McpPromptState = {
|
|
15
18
|
org: string | null;
|
|
@@ -21,6 +24,18 @@ export type McpPromptAnswers = {
|
|
|
21
24
|
scope?: "repo" | "user" | "both";
|
|
22
25
|
clients?: Client[];
|
|
23
26
|
};
|
|
27
|
+
export type MemoryInitPromptState = {
|
|
28
|
+
org: string | null;
|
|
29
|
+
baseUrl: string;
|
|
30
|
+
agents: Client[];
|
|
31
|
+
scope: string | null;
|
|
32
|
+
};
|
|
33
|
+
export type MemoryInitPromptAnswers = {
|
|
34
|
+
org?: string | null;
|
|
35
|
+
scope?: "repo" | "user" | "both";
|
|
36
|
+
agents?: Client[];
|
|
37
|
+
};
|
|
38
|
+
export declare function promptMemoryInitWizard(current: MemoryInitPromptState): Promise<MemoryInitPromptAnswers>;
|
|
24
39
|
export declare function promptInitWizard(current: InitPromptState): Promise<InitPromptAnswers>;
|
|
25
40
|
export declare function promptMcpWizard(current: McpPromptState): Promise<McpPromptAnswers>;
|
|
26
41
|
export declare function detectDefaultOrgSlug(): string | undefined;
|