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
|
@@ -1,38 +1,165 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveRepoRoot } from "../memory/paths.js";
|
|
4
|
+
import { CLIENTS, DEFAULT_BASE_URL } from "../constants.js";
|
|
5
|
+
import { AI_MEMORY_RULE, DECISIONS_INDEX_SEED, GLOSSARY_SEED, LESSONS_SEED, MEMORY_INDEX_SEED, MEMORY_README_SEED, PRDS_INDEX_SEED, PRODUCT_CONTEXT_SEED, SESSIONS_INDEX_SEED, SKILL_CAPTURE_ADR, SKILL_CAPTURE_DECISION, SKILL_CAPTURE_GLOSSARY, SKILL_CAPTURE_LESSON, SKILL_MEMORY_SEARCH, mergeGitignoreForMemory, } from "../memory/seed.js";
|
|
4
6
|
import { isObject } from "./json.js";
|
|
5
|
-
import { mcpUrl, relativePath, scopesFor } from "./paths.js";
|
|
7
|
+
import { mcpUrl, normalizeBaseUrl, relativePath, scopesFor } from "./paths.js";
|
|
6
8
|
export function createOperationContext(overrides = {}) {
|
|
9
|
+
const resolvedCwd = resolveRepoRoot(overrides.cwd ?? process.cwd());
|
|
7
10
|
return {
|
|
8
|
-
cwd: process.cwd(),
|
|
9
11
|
homeDir: homedir(),
|
|
10
12
|
commandExists: () => false,
|
|
11
13
|
...overrides,
|
|
14
|
+
cwd: resolvedCwd,
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
function minimalRepoConfigFields({ org, baseUrl, existing = {}, }) {
|
|
18
|
+
const next = {};
|
|
19
|
+
const orgSlug = org ?? (typeof existing.orgSlug === "string" ? existing.orgSlug : undefined);
|
|
20
|
+
if (orgSlug)
|
|
21
|
+
next.orgSlug = orgSlug;
|
|
22
|
+
const urlSource = normalizeBaseUrl(baseUrl) !== DEFAULT_BASE_URL
|
|
23
|
+
? baseUrl
|
|
24
|
+
: typeof existing.baseUrl === "string"
|
|
25
|
+
? existing.baseUrl
|
|
26
|
+
: baseUrl;
|
|
27
|
+
const normalized = normalizeBaseUrl(urlSource);
|
|
28
|
+
if (normalized !== DEFAULT_BASE_URL) {
|
|
29
|
+
next.baseUrl = normalized;
|
|
30
|
+
}
|
|
31
|
+
return next;
|
|
32
|
+
}
|
|
33
|
+
export function buildCtxpipeConfigOperation({ baseUrl, org, context = createOperationContext(), }) {
|
|
15
34
|
const configPath = resolve(context.cwd, ".ctxpipe", "config.json");
|
|
16
35
|
return {
|
|
17
36
|
type: "write-json",
|
|
18
37
|
path: configPath,
|
|
19
38
|
description: `write repo ctxpipe config at ${relativePath(configPath, context.cwd)}`,
|
|
39
|
+
content() {
|
|
40
|
+
return minimalRepoConfigFields({ org, baseUrl });
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/** Memory-only init: records org/baseUrl when org is known; preserves existing org on re-run. */
|
|
45
|
+
export function buildMemoryConfigOperation({ org, baseUrl, context = createOperationContext(), }) {
|
|
46
|
+
const configPath = resolve(context.cwd, ".ctxpipe", "config.json");
|
|
47
|
+
return {
|
|
48
|
+
type: "write-json",
|
|
49
|
+
path: configPath,
|
|
50
|
+
description: `write memory config at ${relativePath(configPath, context.cwd)}`,
|
|
20
51
|
content(existing = {}) {
|
|
21
|
-
return {
|
|
22
|
-
...existing,
|
|
23
|
-
orgSlug: org,
|
|
24
|
-
baseUrl: baseUrl.replace(/\/+$/, ""),
|
|
25
|
-
mcp: {
|
|
26
|
-
...(isObject(existing.mcp) ? existing.mcp : {}),
|
|
27
|
-
url: mcpUrl({ baseUrl, org }),
|
|
28
|
-
clients,
|
|
29
|
-
},
|
|
30
|
-
};
|
|
52
|
+
return minimalRepoConfigFields({ org, baseUrl, existing });
|
|
31
53
|
},
|
|
32
54
|
};
|
|
33
55
|
}
|
|
34
|
-
|
|
35
|
-
return
|
|
56
|
+
function seedText(path, cwd, content) {
|
|
57
|
+
return {
|
|
58
|
+
type: "write-text",
|
|
59
|
+
path,
|
|
60
|
+
description: `seed ${relativePath(path, cwd)} (only if absent)`,
|
|
61
|
+
skipIfExists: true,
|
|
62
|
+
content: () => content,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export function buildMemoryArtifactOperations({ context = createOperationContext(), } = {}) {
|
|
66
|
+
const memoryRoot = resolve(context.cwd, ".ai", "memory");
|
|
67
|
+
const decisions = resolve(memoryRoot, "decisions");
|
|
68
|
+
const sessions = resolve(memoryRoot, "sessions");
|
|
69
|
+
const prds = resolve(memoryRoot, "PRDs");
|
|
70
|
+
const events = resolve(memoryRoot, "events");
|
|
71
|
+
const skillsRoot = resolve(context.cwd, ".cursor", "skills");
|
|
72
|
+
const rulesRoot = resolve(context.cwd, ".cursor", "rules");
|
|
73
|
+
const gitignore = resolve(context.cwd, ".gitignore");
|
|
74
|
+
return [
|
|
75
|
+
{
|
|
76
|
+
type: "mkdir",
|
|
77
|
+
path: memoryRoot,
|
|
78
|
+
description: `create canonical memory root at ${relativePath(memoryRoot, context.cwd)}`,
|
|
79
|
+
},
|
|
80
|
+
{ type: "mkdir", path: decisions, description: "create decisions/" },
|
|
81
|
+
{ type: "mkdir", path: sessions, description: "create sessions/" },
|
|
82
|
+
{ type: "mkdir", path: prds, description: "create PRDs/" },
|
|
83
|
+
{ type: "mkdir", path: events, description: "create events/" },
|
|
84
|
+
seedText(resolve(memoryRoot, "README.md"), context.cwd, MEMORY_README_SEED),
|
|
85
|
+
seedText(resolve(memoryRoot, "index.md"), context.cwd, MEMORY_INDEX_SEED),
|
|
86
|
+
seedText(resolve(memoryRoot, "lessons-learned.md"), context.cwd, LESSONS_SEED),
|
|
87
|
+
seedText(resolve(memoryRoot, "glossary.md"), context.cwd, GLOSSARY_SEED),
|
|
88
|
+
seedText(resolve(memoryRoot, "product-context.md"), context.cwd, PRODUCT_CONTEXT_SEED),
|
|
89
|
+
seedText(resolve(decisions, "index.md"), context.cwd, DECISIONS_INDEX_SEED),
|
|
90
|
+
seedText(resolve(sessions, "index.md"), context.cwd, SESSIONS_INDEX_SEED),
|
|
91
|
+
seedText(resolve(prds, "index.md"), context.cwd, PRDS_INDEX_SEED),
|
|
92
|
+
{
|
|
93
|
+
type: "write-text",
|
|
94
|
+
path: resolve(events, ".gitkeep"),
|
|
95
|
+
description: "keep events/ in git",
|
|
96
|
+
skipIfExists: true,
|
|
97
|
+
content: () => "",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
type: "write-text",
|
|
101
|
+
path: gitignore,
|
|
102
|
+
description: "ensure .ai/memory/events is gitignored",
|
|
103
|
+
content: (existing) => mergeGitignoreForMemory(existing ?? null),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
type: "mkdir",
|
|
107
|
+
path: rulesRoot,
|
|
108
|
+
description: "create .cursor/rules",
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
type: "write-text",
|
|
112
|
+
path: resolve(rulesRoot, "ai-memory.mdc"),
|
|
113
|
+
description: "install alwaysApply ai-memory rule",
|
|
114
|
+
content: () => AI_MEMORY_RULE,
|
|
115
|
+
},
|
|
116
|
+
{ type: "mkdir", path: skillsRoot, description: "create .cursor/skills" },
|
|
117
|
+
// Always refresh managed skills so upgrades pick up lifecycle/recall guidance.
|
|
118
|
+
{
|
|
119
|
+
type: "write-text",
|
|
120
|
+
path: resolve(skillsRoot, "capture-adr", "SKILL.md"),
|
|
121
|
+
description: "install capture-adr skill",
|
|
122
|
+
content: () => SKILL_CAPTURE_ADR,
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
type: "write-text",
|
|
126
|
+
path: resolve(skillsRoot, "capture-lesson", "SKILL.md"),
|
|
127
|
+
description: "install capture-lesson skill",
|
|
128
|
+
content: () => SKILL_CAPTURE_LESSON,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
type: "write-text",
|
|
132
|
+
path: resolve(skillsRoot, "capture-glossary", "SKILL.md"),
|
|
133
|
+
description: "install capture-glossary skill",
|
|
134
|
+
content: () => SKILL_CAPTURE_GLOSSARY,
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "write-text",
|
|
138
|
+
path: resolve(skillsRoot, "capture-decision", "SKILL.md"),
|
|
139
|
+
description: "install capture-decision skill",
|
|
140
|
+
content: () => SKILL_CAPTURE_DECISION,
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
type: "write-text",
|
|
144
|
+
path: resolve(skillsRoot, "memory-search", "SKILL.md"),
|
|
145
|
+
description: "install memory-search skill (Markdown + rg)",
|
|
146
|
+
content: () => SKILL_MEMORY_SEARCH,
|
|
147
|
+
},
|
|
148
|
+
];
|
|
149
|
+
}
|
|
150
|
+
/** Markdown-only memory init does not install an MCP server (ADR-024). */
|
|
151
|
+
export function buildMemoryMcpOperations(_opts) {
|
|
152
|
+
return [];
|
|
153
|
+
}
|
|
154
|
+
export function buildMcpOperations({ clients, baseUrl, org, scope, memory, context = createOperationContext(), }) {
|
|
155
|
+
void memory;
|
|
156
|
+
return clients.flatMap((client) => scopesFor(scope).flatMap((singleScope) => buildClientOperations({
|
|
157
|
+
client,
|
|
158
|
+
baseUrl,
|
|
159
|
+
org,
|
|
160
|
+
scope: singleScope,
|
|
161
|
+
context,
|
|
162
|
+
})));
|
|
36
163
|
}
|
|
37
164
|
export function buildClientOperations({ client, baseUrl, org, scope, context = createOperationContext(), }) {
|
|
38
165
|
const url = mcpUrl({ baseUrl, org });
|
|
@@ -50,8 +177,7 @@ export function buildClientOperations({ client, baseUrl, org, scope, context = c
|
|
|
50
177
|
];
|
|
51
178
|
case "claude":
|
|
52
179
|
if (scope === "user" && context.commandExists("claude")) {
|
|
53
|
-
return [
|
|
54
|
-
{
|
|
180
|
+
return [{
|
|
55
181
|
type: "run",
|
|
56
182
|
command: [
|
|
57
183
|
"claude",
|
|
@@ -65,8 +191,7 @@ export function buildClientOperations({ client, baseUrl, org, scope, context = c
|
|
|
65
191
|
url,
|
|
66
192
|
],
|
|
67
193
|
description: "run Claude Code MCP add command",
|
|
68
|
-
}
|
|
69
|
-
];
|
|
194
|
+
}];
|
|
70
195
|
}
|
|
71
196
|
return [
|
|
72
197
|
writeMcpServersOperation({
|
|
@@ -88,13 +213,11 @@ export function buildClientOperations({ client, baseUrl, org, scope, context = c
|
|
|
88
213
|
];
|
|
89
214
|
case "vscode":
|
|
90
215
|
if (scope === "user") {
|
|
91
|
-
return [
|
|
92
|
-
{
|
|
216
|
+
return [{
|
|
93
217
|
type: "manual",
|
|
94
218
|
description: "open VS Code MCP install link",
|
|
95
219
|
detail: `Open vscode:mcp/install?${encodeURIComponent(JSON.stringify({ name: "ctxpipe", type: "http", url }))}`,
|
|
96
|
-
}
|
|
97
|
-
];
|
|
220
|
+
}];
|
|
98
221
|
}
|
|
99
222
|
return [
|
|
100
223
|
writeVsCodeOperation({
|
|
@@ -105,21 +228,17 @@ export function buildClientOperations({ client, baseUrl, org, scope, context = c
|
|
|
105
228
|
];
|
|
106
229
|
case "codex":
|
|
107
230
|
if (scope === "user" && context.commandExists("codex")) {
|
|
108
|
-
return [
|
|
109
|
-
{
|
|
231
|
+
return [{
|
|
110
232
|
type: "run",
|
|
111
233
|
command: ["codex", "mcp", "add", "ctxpipe", "--url", url],
|
|
112
234
|
description: "run Codex MCP add command",
|
|
113
|
-
}
|
|
114
|
-
];
|
|
235
|
+
}];
|
|
115
236
|
}
|
|
116
|
-
return [
|
|
117
|
-
{
|
|
237
|
+
return [{
|
|
118
238
|
type: "manual",
|
|
119
239
|
description: "show Codex MCP add command",
|
|
120
240
|
detail: `Run: codex mcp add ctxpipe --url ${url}`,
|
|
121
|
-
}
|
|
122
|
-
];
|
|
241
|
+
}];
|
|
123
242
|
}
|
|
124
243
|
}
|
|
125
244
|
export function writeMcpServersOperation({ path, url, label, cwd, }) {
|
|
@@ -128,15 +247,16 @@ export function writeMcpServersOperation({ path, url, label, cwd, }) {
|
|
|
128
247
|
path,
|
|
129
248
|
description: `configure ${label} MCP at ${relativePath(path, cwd)}`,
|
|
130
249
|
content(existing = {}) {
|
|
250
|
+
const servers = {
|
|
251
|
+
...(isObject(existing.mcpServers) ? existing.mcpServers : {}),
|
|
252
|
+
};
|
|
253
|
+
servers.ctxpipe = {
|
|
254
|
+
type: "streamable-http",
|
|
255
|
+
url,
|
|
256
|
+
};
|
|
131
257
|
return {
|
|
132
258
|
...existing,
|
|
133
|
-
mcpServers:
|
|
134
|
-
...(isObject(existing.mcpServers) ? existing.mcpServers : {}),
|
|
135
|
-
ctxpipe: {
|
|
136
|
-
type: "streamable-http",
|
|
137
|
-
url,
|
|
138
|
-
},
|
|
139
|
-
},
|
|
259
|
+
mcpServers: servers,
|
|
140
260
|
};
|
|
141
261
|
},
|
|
142
262
|
};
|
|
@@ -147,16 +267,17 @@ export function writeOpenCodeOperation({ path, url, cwd, }) {
|
|
|
147
267
|
path,
|
|
148
268
|
description: `configure OpenCode MCP at ${relativePath(path, cwd)}`,
|
|
149
269
|
content(existing = {}) {
|
|
270
|
+
const mcp = {
|
|
271
|
+
...(isObject(existing.mcp) ? existing.mcp : {}),
|
|
272
|
+
};
|
|
273
|
+
mcp.ctxpipe = {
|
|
274
|
+
type: "remote",
|
|
275
|
+
url,
|
|
276
|
+
enabled: true,
|
|
277
|
+
};
|
|
150
278
|
return {
|
|
151
279
|
...existing,
|
|
152
|
-
mcp
|
|
153
|
-
...(isObject(existing.mcp) ? existing.mcp : {}),
|
|
154
|
-
ctxpipe: {
|
|
155
|
-
type: "remote",
|
|
156
|
-
url,
|
|
157
|
-
enabled: true,
|
|
158
|
-
},
|
|
159
|
-
},
|
|
280
|
+
mcp,
|
|
160
281
|
};
|
|
161
282
|
},
|
|
162
283
|
};
|
|
@@ -167,15 +288,16 @@ export function writeVsCodeOperation({ path, url, cwd, }) {
|
|
|
167
288
|
path,
|
|
168
289
|
description: `configure VS Code MCP at ${relativePath(path, cwd)}`,
|
|
169
290
|
content(existing = {}) {
|
|
291
|
+
const servers = {
|
|
292
|
+
...(isObject(existing.servers) ? existing.servers : {}),
|
|
293
|
+
};
|
|
294
|
+
servers.ctxpipe = {
|
|
295
|
+
type: "http",
|
|
296
|
+
url,
|
|
297
|
+
};
|
|
170
298
|
return {
|
|
171
299
|
...existing,
|
|
172
|
-
servers
|
|
173
|
-
...(isObject(existing.servers) ? existing.servers : {}),
|
|
174
|
-
ctxpipe: {
|
|
175
|
-
type: "http",
|
|
176
|
-
url,
|
|
177
|
-
},
|
|
178
|
-
},
|
|
300
|
+
servers,
|
|
179
301
|
};
|
|
180
302
|
},
|
|
181
303
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-operations.js","sourceRoot":"","sources":["../../src/mcp/mcp-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"mcp-operations.js","sourceRoot":"","sources":["../../src/mcp/mcp-operations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAEpD,OAAO,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAC3D,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,mBAAmB,EACnB,uBAAuB,GACxB,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,QAAQ,EAAE,MAAM,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ode" | "vscode" | "unknown";
|
|
3
|
+
export type ClassificationKind = "lesson" | "decision" | "requirement" | "glossary";
|
|
4
|
+
export type Classification = {
|
|
5
|
+
kind: ClassificationKind;
|
|
6
|
+
destination: string;
|
|
7
|
+
action: string;
|
|
8
|
+
confidence: "high" | "medium";
|
|
9
|
+
};
|
|
10
|
+
export declare function memoryRoot(repoRoot: string): string;
|
|
11
|
+
export declare function eventsRoot(repoRoot: string): string;
|
|
12
|
+
export declare function redactText(input: string): {
|
|
13
|
+
text: string;
|
|
14
|
+
redacted: boolean;
|
|
15
|
+
};
|
|
16
|
+
export declare function classifyText(text: string): Classification[];
|
|
17
|
+
export declare function extractWorkspaceCwd(payload: Record<string, unknown>, filePath?: string): string | undefined;
|
|
18
|
+
export type ObserveResult = {
|
|
19
|
+
ok: true;
|
|
20
|
+
wrote: boolean;
|
|
21
|
+
candidateCount: number;
|
|
22
|
+
eventId?: string;
|
|
23
|
+
};
|
|
24
|
+
export declare function observeCapture(opts: {
|
|
25
|
+
host: CaptureHost;
|
|
26
|
+
eventType: string;
|
|
27
|
+
payload: Record<string, unknown>;
|
|
28
|
+
cwd?: string;
|
|
29
|
+
}): ObserveResult;
|
|
30
|
+
export type SummaryCandidate = {
|
|
31
|
+
candidateId: string;
|
|
32
|
+
kind: string;
|
|
33
|
+
destination: string;
|
|
34
|
+
action: string;
|
|
35
|
+
excerpt: string;
|
|
36
|
+
};
|
|
37
|
+
export type SummaryResult = {
|
|
38
|
+
priority: "low" | "medium" | "high";
|
|
39
|
+
message: string;
|
|
40
|
+
candidates: SummaryCandidate[];
|
|
41
|
+
/** IDs listed in this summary; call acknowledgeSurfaced after successful delivery. */
|
|
42
|
+
surfacedIds: string[];
|
|
43
|
+
parseErrors: number;
|
|
44
|
+
};
|
|
45
|
+
/** Host-specific Stop/summary stdout. Empty object = allow stop / no follow-up. */
|
|
46
|
+
export declare function formatStopHookOutput(host: CaptureHost, result: SummaryResult, payload?: Record<string, unknown>): Record<string, unknown>;
|
|
47
|
+
/**
|
|
48
|
+
* Persist pending→surfaced only after the host successfully received the summary.
|
|
49
|
+
* Call this after stdout write succeeds — never before.
|
|
50
|
+
*/
|
|
51
|
+
export declare function acknowledgeSurfaced(ids: string[], opts?: {
|
|
52
|
+
cwd?: string;
|
|
53
|
+
}): void;
|
|
54
|
+
/** Mark candidates promoted into durable Markdown (surfaced → promoted). */
|
|
55
|
+
export declare function markPromoted(ids: string[], opts?: {
|
|
56
|
+
cwd?: string;
|
|
57
|
+
}): void;
|
|
58
|
+
/** Mark candidates dismissed without promoting (surfaced → dismissed). */
|
|
59
|
+
export declare function markDismissed(ids: string[], opts?: {
|
|
60
|
+
cwd?: string;
|
|
61
|
+
}): void;
|
|
62
|
+
/**
|
|
63
|
+
* Build a summary of pending candidates (batch of SUMMARY_BATCH).
|
|
64
|
+
* Does **not** advance lifecycle — caller must acknowledgeSurfaced after delivery.
|
|
65
|
+
*/
|
|
66
|
+
export declare function summarizeCapture(opts?: {
|
|
67
|
+
cwd?: string;
|
|
68
|
+
}): SummaryResult;
|
|
69
|
+
export declare function readStdinJson(): Promise<Record<string, unknown>>;
|
|
70
|
+
export declare function parseHost(value: string | undefined): CaptureHost;
|
|
71
|
+
/** Resolve path under repo for tests */
|
|
72
|
+
export declare function resolveUnderRepo(repoRoot: string, ...parts: string[]): string;
|