@bragi-gmbh/codebus 1.3.0 → 1.6.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/dist/ci-hooks/ci-hooks.js +126 -0
- package/dist/ci-hooks/ci-hooks.js.map +1 -0
- package/dist/commands/agent.js +137 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/as.js +1 -1
- package/dist/commands/as.js.map +1 -1
- package/dist/commands/ask.js +1 -1
- package/dist/commands/ask.js.map +1 -1
- package/dist/commands/ci-findings.js +129 -0
- package/dist/commands/ci-findings.js.map +1 -0
- package/dist/commands/ci-reply.js +117 -0
- package/dist/commands/ci-reply.js.map +1 -0
- package/dist/commands/ci-steer-escalate.js +65 -0
- package/dist/commands/ci-steer-escalate.js.map +1 -0
- package/dist/commands/cli-mcp-correlation.js +131 -0
- package/dist/commands/cli-mcp-correlation.js.map +1 -0
- package/dist/commands/connector-attach-detach.js +542 -0
- package/dist/commands/connector-attach-detach.js.map +1 -0
- package/dist/commands/connector.js +513 -0
- package/dist/commands/connector.js.map +1 -0
- package/dist/commands/correlation.js +194 -0
- package/dist/commands/correlation.js.map +1 -0
- package/dist/commands/decision.js +63 -0
- package/dist/commands/decision.js.map +1 -1
- package/dist/commands/digest.js +14 -3
- package/dist/commands/digest.js.map +1 -1
- package/dist/commands/do.js +127 -0
- package/dist/commands/do.js.map +1 -0
- package/dist/commands/doc.js +276 -0
- package/dist/commands/doc.js.map +1 -0
- package/dist/commands/factory-attention.js +106 -0
- package/dist/commands/factory-attention.js.map +1 -0
- package/dist/commands/factory-context-read.js +171 -0
- package/dist/commands/factory-context-read.js.map +1 -0
- package/dist/commands/factory-interventions.js +102 -0
- package/dist/commands/factory-interventions.js.map +1 -0
- package/dist/commands/factory.js +187 -0
- package/dist/commands/factory.js.map +1 -1
- package/dist/commands/graph-pull.js +130 -0
- package/dist/commands/graph-pull.js.map +1 -0
- package/dist/commands/graph.js +5 -1
- package/dist/commands/graph.js.map +1 -1
- package/dist/commands/inbox.js +7 -7
- package/dist/commands/inbox.js.map +1 -1
- package/dist/commands/ingest.js +1 -1
- package/dist/commands/ingest.js.map +1 -1
- package/dist/commands/install.js +1160 -55
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/integration-ledger.js +81 -0
- package/dist/commands/integration-ledger.js.map +1 -0
- package/dist/commands/knowledge.js +178 -0
- package/dist/commands/knowledge.js.map +1 -0
- package/dist/commands/links.js +1 -1
- package/dist/commands/links.js.map +1 -1
- package/dist/commands/morning.js +50 -1
- package/dist/commands/morning.js.map +1 -1
- package/dist/commands/plan-compiler.js +260 -0
- package/dist/commands/plan-compiler.js.map +1 -0
- package/dist/commands/plan-lint.js +275 -0
- package/dist/commands/plan-lint.js.map +1 -0
- package/dist/commands/plan-score.js +203 -0
- package/dist/commands/plan-score.js.map +1 -0
- package/dist/commands/plan.js +481 -15
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/product-validity.js +168 -0
- package/dist/commands/product-validity.js.map +1 -0
- package/dist/commands/question.js +1 -1
- package/dist/commands/question.js.map +1 -1
- package/dist/commands/read-policy.js +131 -0
- package/dist/commands/read-policy.js.map +1 -0
- package/dist/commands/read.js +1 -1
- package/dist/commands/read.js.map +1 -1
- package/dist/commands/repo.js +106 -8
- package/dist/commands/repo.js.map +1 -1
- package/dist/commands/repository-protection.js +209 -0
- package/dist/commands/repository-protection.js.map +1 -0
- package/dist/commands/resolve.js +2 -2
- package/dist/commands/resolve.js.map +1 -1
- package/dist/commands/self-healing.js +26 -0
- package/dist/commands/self-healing.js.map +1 -0
- package/dist/commands/send.js +1 -1
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/serial-merge.js +303 -0
- package/dist/commands/serial-merge.js.map +1 -0
- package/dist/commands/session.js +1 -1
- package/dist/commands/session.js.map +1 -1
- package/dist/commands/task.js +92 -1
- package/dist/commands/task.js.map +1 -1
- package/dist/commands/verify.js +77 -0
- package/dist/commands/verify.js.map +1 -0
- package/dist/config/self-healing-analysis.json +158 -0
- package/dist/errors.js +18 -4
- package/dist/errors.js.map +1 -1
- package/dist/execution/client.js +53 -0
- package/dist/execution/client.js.map +1 -0
- package/dist/execution/local.js +24 -0
- package/dist/execution/local.js.map +1 -0
- package/dist/execution/ssh.js +38 -0
- package/dist/execution/ssh.js.map +1 -0
- package/dist/graph.js +78 -16
- package/dist/graph.js.map +1 -1
- package/dist/index.js +32 -0
- package/dist/index.js.map +1 -1
- package/dist/json-lite.js +248 -0
- package/dist/json-lite.js.map +1 -0
- package/dist/knowledge-drift.js +40 -0
- package/dist/knowledge-drift.js.map +1 -0
- package/dist/lint/parallelism.js +414 -0
- package/dist/lint/parallelism.js.map +1 -0
- package/dist/mail-latency.js +11 -1
- package/dist/mail-latency.js.map +1 -1
- package/dist/mcp-ci-findings.js +31 -0
- package/dist/mcp-ci-findings.js.map +1 -0
- package/dist/mcp-correlation.js +290 -0
- package/dist/mcp-correlation.js.map +1 -0
- package/dist/mcp-factory-context-read.js +81 -0
- package/dist/mcp-factory-context-read.js.map +1 -0
- package/dist/mcp-registry.js +202 -1
- package/dist/mcp-registry.js.map +1 -1
- package/dist/mcp.js +94 -5
- package/dist/mcp.js.map +1 -1
- package/dist/openrouter-reservation-guard.js +97 -0
- package/dist/openrouter-reservation-guard.js.map +1 -0
- package/dist/self-healing-analysis-loader.js +150 -0
- package/dist/self-healing-analysis-loader.js.map +1 -0
- package/dist/sender.js +11 -9
- package/dist/sender.js.map +1 -1
- package/dist/toml-lite.js +546 -0
- package/dist/toml-lite.js.map +1 -0
- package/dist/version-check.js +23 -7
- package/dist/version-check.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* doc.ts — shared documents on the bus (CB-DOC-…).
|
|
3
|
+
*
|
|
4
|
+
* `codebus doc add` stores a text document in the 0035 artifacts registry via
|
|
5
|
+
* the 0087 `artifact_add` write boundary (membership-gated, producer pinned,
|
|
6
|
+
* title/body/2MiB/kind validated server-side with typed errors). Every doc
|
|
7
|
+
* gets a CB-DOC-… display id, which cli/src/commands/refs.ts already accepts
|
|
8
|
+
* as a typed ref (`--ref CB-DOC-…[@sha]` on send/task) — that is what makes a
|
|
9
|
+
* stored doc "attached to the graph": any message or task can cite it as
|
|
10
|
+
* evidence and `codebus resolve-refs` resolves it back.
|
|
11
|
+
*
|
|
12
|
+
* Text-only for now (matching artifacts.body being a text column): `doc add`
|
|
13
|
+
* reads the file as UTF-8 and rejects binary content (NUL-byte probe) and
|
|
14
|
+
* anything over the 2 MiB cap CLIENT-side with a clear message, so the common
|
|
15
|
+
* failure never even leaves the machine — the RPC re-checks both anyway
|
|
16
|
+
* (plus the kind vocabulary, where the server stays the single authority so
|
|
17
|
+
* the list can't drift between here and 0087).
|
|
18
|
+
*
|
|
19
|
+
* Cores are exported for the MCP tools (doc_add / doc_get) — one shared core,
|
|
20
|
+
* dumb clients, per house pattern (see decision.ts / send.ts).
|
|
21
|
+
*/
|
|
22
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
23
|
+
import { basename } from "node:path";
|
|
24
|
+
import { resolveConfig } from "../config.js";
|
|
25
|
+
import { makeCtx, workspaceId } from "../client.js";
|
|
26
|
+
import { render } from "../output.js";
|
|
27
|
+
import { CodebusError } from "../errors.js";
|
|
28
|
+
import { senderDisplay } from "../sender.js";
|
|
29
|
+
/** 2 MiB, in bytes — MUST match artifact_add's own cap (0087). */
|
|
30
|
+
export const DOC_BODY_MAX_BYTES = 2 * 1024 * 1024;
|
|
31
|
+
/**
|
|
32
|
+
* The doc kind vocabulary (taxonomy.v1.json product.artifact_kind). Used for
|
|
33
|
+
* help text and as `doc list`'s default filter; the WRITE-side authority is
|
|
34
|
+
* artifact_add itself (0087) — the CLI never pre-rejects a kind, so the two
|
|
35
|
+
* lists cannot disagree about what is storable.
|
|
36
|
+
*/
|
|
37
|
+
export const DOC_KINDS = ["note", "doc", "spec", "plan", "review", "deck"];
|
|
38
|
+
/**
|
|
39
|
+
* Producer resolved the same way message senders are (sender.ts): alias the
|
|
40
|
+
* embed to `agents` so senderDisplay() works unchanged — a HUMAN producer
|
|
41
|
+
* shows their person slug, a machine agent its agent slug. The explicit
|
|
42
|
+
* `!person_id` FK hint is required (agents has two FKs to people, 0040).
|
|
43
|
+
*/
|
|
44
|
+
const PRODUCER_EMBED = "agents:producer_agent_id(slug, person:people!person_id(slug))";
|
|
45
|
+
/**
|
|
46
|
+
* Shared core: store a document via the artifact_add write boundary.
|
|
47
|
+
* Exported for reuse in the MCP doc_add tool.
|
|
48
|
+
*/
|
|
49
|
+
export async function addDocCore(ctx, opts) {
|
|
50
|
+
// The same one-rule invariant validateDocBody enforces for the CLI (sol
|
|
51
|
+
// round-2 finding 1), held HERE too so the MCP doc_add path — which never
|
|
52
|
+
// goes through argv or a file read — cannot store what the CLI refuses:
|
|
53
|
+
// no U+FFFD in stored docs (v1 limitation; see validateDocBody).
|
|
54
|
+
if (opts.body.includes("�")) {
|
|
55
|
+
throw new CodebusError("doc add: body contains the Unicode replacement character (U+FFFD) — stored docs may not " +
|
|
56
|
+
"contain it (v1 limitation: it is indistinguishable from encoding corruption); remove it, " +
|
|
57
|
+
"or store the content externally and cite it as a typed ref (path:<repo>/<file> or commit:<sha>)");
|
|
58
|
+
}
|
|
59
|
+
const ws = await workspaceId(ctx);
|
|
60
|
+
const { data, error } = await ctx.supabase.rpc("artifact_add", {
|
|
61
|
+
p_workspace_id: ws,
|
|
62
|
+
p_title: opts.title,
|
|
63
|
+
p_body: opts.body,
|
|
64
|
+
p_kind: opts.kind ?? "doc",
|
|
65
|
+
});
|
|
66
|
+
if (error)
|
|
67
|
+
throw new CodebusError(error.message);
|
|
68
|
+
const row = data;
|
|
69
|
+
return { display_id: row.display_id, kind: row.kind, title: row.title, id: row.id, created_at: row.created_at };
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Shared core: fetch one document (body included) by CB-DOC-… or uuid.
|
|
73
|
+
* Display ids are only unique per workspace (bus_counters, 0004), so the
|
|
74
|
+
* display_id lookup is workspace-scoped — same rule as decision.ts.
|
|
75
|
+
* A trailing @sha ref pin is tolerated and stripped, so an id copied
|
|
76
|
+
* verbatim out of `resolve-refs` output just works.
|
|
77
|
+
*/
|
|
78
|
+
export async function getDocCore(ctx, idOrDisplay) {
|
|
79
|
+
const bare = idOrDisplay.replace(/@[0-9a-f]{7,40}$/i, "");
|
|
80
|
+
const isDisplay = /^CB-DOC-/i.test(bare);
|
|
81
|
+
let q = ctx.supabase.from("artifacts").select(`id, display_id, kind, title, body, created_at, ${PRODUCER_EMBED}`);
|
|
82
|
+
q = isDisplay
|
|
83
|
+
? q.eq("display_id", bare.toUpperCase()).eq("workspace_id", await workspaceId(ctx))
|
|
84
|
+
: q.eq("id", bare);
|
|
85
|
+
const { data, error } = await q.single();
|
|
86
|
+
if (error || !data) {
|
|
87
|
+
throw new CodebusError(`doc not found (or not a member of its workspace): ${idOrDisplay}`);
|
|
88
|
+
}
|
|
89
|
+
const row = data;
|
|
90
|
+
return {
|
|
91
|
+
id: String(row.id),
|
|
92
|
+
display_id: String(row.display_id),
|
|
93
|
+
kind: String(row.kind ?? ""),
|
|
94
|
+
title: String(row.title),
|
|
95
|
+
body: String(row.body ?? ""),
|
|
96
|
+
producer: senderDisplay(row),
|
|
97
|
+
created_at: String(row.created_at),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Shared core: list documents in the workspace, newest first.
|
|
102
|
+
* Defaults to the doc vocabulary so registry-internal artifacts (e.g. the
|
|
103
|
+
* graph-snapshot rows graph-bootstrap writes) don't drown the listing;
|
|
104
|
+
* --kind narrows to one kind (any value — the column is open vocabulary).
|
|
105
|
+
*/
|
|
106
|
+
export async function listDocsCore(ctx, opts = {}) {
|
|
107
|
+
const ws = await workspaceId(ctx);
|
|
108
|
+
let q = ctx.supabase.from("artifacts")
|
|
109
|
+
.select(`id, display_id, kind, title, created_at, ${PRODUCER_EMBED}`)
|
|
110
|
+
.eq("workspace_id", ws)
|
|
111
|
+
.order("created_at", { ascending: false });
|
|
112
|
+
q = opts.kind ? q.eq("kind", opts.kind) : q.in("kind", DOC_KINDS);
|
|
113
|
+
const { data, error } = await q;
|
|
114
|
+
if (error)
|
|
115
|
+
throw new CodebusError(error.message);
|
|
116
|
+
return (data ?? []).map((r) => {
|
|
117
|
+
const row = r;
|
|
118
|
+
return {
|
|
119
|
+
id: String(row.id),
|
|
120
|
+
display_id: String(row.display_id),
|
|
121
|
+
kind: String(row.kind ?? ""),
|
|
122
|
+
title: String(row.title),
|
|
123
|
+
producer: senderDisplay(row),
|
|
124
|
+
created_at: String(row.created_at),
|
|
125
|
+
};
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Client-side body validation for `doc add` — fails fast with a clearer
|
|
130
|
+
* message than a round-trip would, for the rules a local check can decide
|
|
131
|
+
* (size cap, binary content, UTF-8 validity). Exported for unit tests.
|
|
132
|
+
*
|
|
133
|
+
* Decoding is FATAL (sol round-1 finding 1): Buffer.toString("utf8") would
|
|
134
|
+
* silently replace malformed byte sequences with U+FFFD, so a mis-encoded
|
|
135
|
+
* file (latin-1, UTF-16, …) would upload CORRUPTED with nobody the wiser —
|
|
136
|
+
* the exact opposite of the "we both see the same file" contract. A file
|
|
137
|
+
* that does not decode cleanly as UTF-8 is rejected loudly instead.
|
|
138
|
+
*/
|
|
139
|
+
export function validateDocBody(buf, source) {
|
|
140
|
+
if (buf.length === 0) {
|
|
141
|
+
throw new CodebusError(`doc add: ${source} is empty — a doc with no content cannot be shared`);
|
|
142
|
+
}
|
|
143
|
+
if (buf.length > DOC_BODY_MAX_BYTES) {
|
|
144
|
+
throw new CodebusError(`doc add: ${source} is ${buf.length} bytes, over the 2 MiB (${DOC_BODY_MAX_BYTES} byte) cap — ` +
|
|
145
|
+
`store large files externally and cite them as typed refs instead (path:<repo>/<file> or commit:<sha> on a message/task)`);
|
|
146
|
+
}
|
|
147
|
+
if (buf.includes(0)) {
|
|
148
|
+
throw new CodebusError(`doc add: ${source} looks binary (contains NUL bytes) — doc storage is text-only for now; ` +
|
|
149
|
+
`store the file externally and cite it as a typed ref instead (path:<repo>/<file> or commit:<sha>)`);
|
|
150
|
+
}
|
|
151
|
+
let text;
|
|
152
|
+
try {
|
|
153
|
+
text = new TextDecoder("utf-8", { fatal: true }).decode(buf);
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
throw new CodebusError(`doc add: ${source} is not valid UTF-8 — doc storage is text-only for now; re-encode it ` +
|
|
157
|
+
`(e.g. iconv -t UTF-8) or store the file externally and cite it as a typed ref instead ` +
|
|
158
|
+
`(path:<repo>/<file> or commit:<sha>)`);
|
|
159
|
+
}
|
|
160
|
+
// Sol round-2 finding 1: the fatal decoder cannot protect the --body path —
|
|
161
|
+
// Node has already converted malformed argv bytes to U+FFFD before we ever
|
|
162
|
+
// see the string, and our own re-encode makes those replacement characters
|
|
163
|
+
// VALID UTF-8. So the rule is on the DECODED text: no U+FFFD in stored
|
|
164
|
+
// docs, either path (v1 limitation — a legitimate replacement character is
|
|
165
|
+
// indistinguishable from encoding corruption at this point).
|
|
166
|
+
if (text.includes("�")) {
|
|
167
|
+
throw new CodebusError(source === "--body"
|
|
168
|
+
? `doc add: body contains the Unicode replacement character (�) — the shell likely ` +
|
|
169
|
+
`mangled a non-UTF-8 byte before it reached us; put the content in a file and use ` +
|
|
170
|
+
`doc add <file> instead`
|
|
171
|
+
: `doc add: ${source} contains the Unicode replacement character (U+FFFD) — stored docs ` +
|
|
172
|
+
`may not contain it (v1 limitation: at this point it is indistinguishable from encoding ` +
|
|
173
|
+
`corruption); remove it, or store the file externally and cite it as a typed ref ` +
|
|
174
|
+
`(path:<repo>/<file> or commit:<sha>)`);
|
|
175
|
+
}
|
|
176
|
+
return text;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Write a fetched doc body to `out` for `doc get --out`. Refuses to clobber
|
|
180
|
+
* an existing file unless `force` (sol round-1 finding 3: silent truncation
|
|
181
|
+
* of whatever already lived at that path is exactly the kind of data loss a
|
|
182
|
+
* "download" flag must not default to). The refusal is ATOMIC (sol round-2
|
|
183
|
+
* finding 2): no exists-then-open window — the file is opened with exclusive
|
|
184
|
+
* creation (O_CREAT|O_EXCL via flag "wx"), so a race or a symlink swapped in
|
|
185
|
+
* between a check and the write cannot make us truncate it; O_EXCL also
|
|
186
|
+
* refuses any symlink at the path, dangling or not. Exported for unit tests.
|
|
187
|
+
*/
|
|
188
|
+
export function writeDocBodyToFile(out, body, force) {
|
|
189
|
+
if (force) {
|
|
190
|
+
writeFileSync(out, body, "utf8");
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
writeFileSync(out, body, { encoding: "utf8", flag: "wx" });
|
|
195
|
+
}
|
|
196
|
+
catch (e) {
|
|
197
|
+
if (e.code === "EEXIST") {
|
|
198
|
+
throw new CodebusError(`doc get: ${out} already exists — pass --force to overwrite it`);
|
|
199
|
+
}
|
|
200
|
+
throw e;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function addDoc(file, o) {
|
|
204
|
+
if (file && o.body !== undefined) {
|
|
205
|
+
throw new CodebusError("doc add: pass EITHER a file argument OR --body, not both");
|
|
206
|
+
}
|
|
207
|
+
let title;
|
|
208
|
+
let body;
|
|
209
|
+
if (file) {
|
|
210
|
+
let buf;
|
|
211
|
+
try {
|
|
212
|
+
buf = readFileSync(file);
|
|
213
|
+
}
|
|
214
|
+
catch (e) {
|
|
215
|
+
throw new CodebusError(`doc add: cannot read ${file}: ${e.message}`);
|
|
216
|
+
}
|
|
217
|
+
body = validateDocBody(buf, file);
|
|
218
|
+
title = o.title ?? basename(file);
|
|
219
|
+
}
|
|
220
|
+
else {
|
|
221
|
+
if (o.body === undefined) {
|
|
222
|
+
throw new CodebusError("doc add: provide a file argument, or --body \"<text>\" with --title");
|
|
223
|
+
}
|
|
224
|
+
if (!o.title) {
|
|
225
|
+
throw new CodebusError("doc add: --body requires --title (there is no file name to default it from)");
|
|
226
|
+
}
|
|
227
|
+
body = validateDocBody(Buffer.from(o.body, "utf8"), "--body");
|
|
228
|
+
title = o.title;
|
|
229
|
+
}
|
|
230
|
+
const ctx = await makeCtx(resolveConfig(o));
|
|
231
|
+
const r = await addDocCore(ctx, { title, body, kind: o.kind });
|
|
232
|
+
console.log(render([{ display_id: r.display_id, kind: r.kind, title: r.title }], { json: !!o.json }));
|
|
233
|
+
}
|
|
234
|
+
async function getDoc(id, o) {
|
|
235
|
+
const ctx = await makeCtx(resolveConfig(o));
|
|
236
|
+
const doc = await getDocCore(ctx, id);
|
|
237
|
+
if (o.out) {
|
|
238
|
+
writeDocBodyToFile(o.out, doc.body, !!o.force);
|
|
239
|
+
const meta = { display_id: doc.display_id, kind: doc.kind, title: doc.title, bytes: Buffer.byteLength(doc.body, "utf8"), out: o.out };
|
|
240
|
+
console.log(render([meta], { json: !!o.json }));
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
if (o.json) {
|
|
244
|
+
console.log(JSON.stringify(doc, null, 2));
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
// Plain mode prints the BODY only — and EXACTLY the body: stdout.write,
|
|
248
|
+
// not console.log, so `codebus doc get CB-DOC-… > f.md` is byte-identical
|
|
249
|
+
// to what was stored, including for a body with no trailing newline (sol
|
|
250
|
+
// round-1 finding 2). Metadata lives behind --json / doc list.
|
|
251
|
+
process.stdout.write(doc.body);
|
|
252
|
+
}
|
|
253
|
+
async function listDocs(o) {
|
|
254
|
+
const ctx = await makeCtx(resolveConfig(o));
|
|
255
|
+
const rows = await listDocsCore(ctx, { kind: o.kind });
|
|
256
|
+
console.log(render(rows.map((r) => ({ display_id: r.display_id, kind: r.kind, title: r.title, producer: r.producer, created_at: r.created_at })), { json: !!o.json }));
|
|
257
|
+
}
|
|
258
|
+
export function registerDoc(program, g) {
|
|
259
|
+
const doc = program.command("doc").description("shared documents (CB-DOC-…) — stored on the bus, citable as --ref evidence");
|
|
260
|
+
g(doc.command("add").argument("[file]", "UTF-8 text file to store (≤ 2 MiB)"))
|
|
261
|
+
.description("store a document; returns its CB-DOC-… id")
|
|
262
|
+
.option("--title <t>", "doc title (defaults to the file name)")
|
|
263
|
+
.option("--kind <k>", `${DOC_KINDS.join("|")}`, "doc")
|
|
264
|
+
.option("--body <text>", "inline body instead of a file (requires --title)")
|
|
265
|
+
.action(addDoc);
|
|
266
|
+
g(doc.command("get").argument("<id>", "CB-DOC-… display id or uuid"))
|
|
267
|
+
.description("print a document's body (or write it with --out; --json for the full row)")
|
|
268
|
+
.option("--out <file>", "write the body to a file instead of stdout (refuses to overwrite without --force)")
|
|
269
|
+
.option("--force", "overwrite an existing --out file")
|
|
270
|
+
.action((id, o) => getDoc(id, o));
|
|
271
|
+
g(doc.command("list"))
|
|
272
|
+
.description("list shared documents in the workspace, newest first")
|
|
273
|
+
.option("--kind <k>", "filter to one kind")
|
|
274
|
+
.action(listDocs);
|
|
275
|
+
}
|
|
276
|
+
//# sourceMappingURL=doc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"doc.js","sourceRoot":"","sources":["../../src/commands/doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAGH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,OAAO,EAAE,WAAW,EAAO,MAAM,cAAc,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AAExD,kEAAkE;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,GAAG,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C,CAAC;AACL,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAgB,EAAE,CAA0B;IACtE,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,WAAW,CAAC,4EAA4E,CAAC,CAAC;IAC7H,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,EAAE,oCAAoC,CAAC,CAAC;SAC3E,WAAW,CAAC,2CAA2C,CAAC;SACxD,MAAM,CAAC,aAAa,EAAE,uCAAuC,CAAC;SAC9D,MAAM,CAAC,YAAY,EAAE,GAAG,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC;SACrD,MAAM,CAAC,eAAe,EAAE,kDAAkD,CAAC;SAC3E,MAAM,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC,CAAC;SAClE,WAAW,CAAC,2EAA2E,CAAC;SACxF,MAAM,CAAC,cAAc,EAAE,mFAAmF,CAAC;SAC3G,MAAM,CAAC,SAAS,EAAE,kCAAkC,CAAC;SACrD,MAAM,CAAC,CAAC,EAAU,EAAE,CAAgE,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC;IAC3G,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;SACnB,WAAW,CAAC,sDAAsD,CAAC;SACnE,MAAM,CAAC,YAAY,EAAE,oBAAoB,CAAC;SAC1C,MAAM,CAAC,QAAQ,CAAC,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Console attention view over CLI (`factory-attention`) — routes a single read
|
|
3
|
+
* through the attention_queue_v1(p_actor_login) RPC defined in 0109_attention_queue.sql.
|
|
4
|
+
*
|
|
5
|
+
* The projection yields six categories (ADR 0005: the console reads state over
|
|
6
|
+
* the API; each stuck/dead/over-cap/waiting-on-human item opens its details):
|
|
7
|
+
* blocked-question execution reported BLOCKED, waiting on a human answer
|
|
8
|
+
* stalled available non-terminal execution with a stale heartbeat
|
|
9
|
+
* dead terminal failed execution (ERROR/CANCELLED/INCOMPLETE) not resumed
|
|
10
|
+
* over-cap execution past its stage max_minutes cap (0098 deadline)
|
|
11
|
+
* receipt-ruling proposed decision awaiting a human ruling (0003/0104)
|
|
12
|
+
* gate-approval human plan gate to approve or release (0104/0107)
|
|
13
|
+
*
|
|
14
|
+
* Positive fixture: attention_queue_v1_returns_user_items
|
|
15
|
+
* — calling attention_queue_v1(p_actor_login) for the accountable person
|
|
16
|
+
* returns exactly the items they own/drive/rule on, scoped by RLS.
|
|
17
|
+
*
|
|
18
|
+
* Negative fixture: attention_returns_empty_for_other_user
|
|
19
|
+
* — the same RPC called for a login that owns/drives/none of the items
|
|
20
|
+
* returns zero rows (the actor_login filter narrows to the named person,
|
|
21
|
+
* unknown logins yield nothing, never an error).
|
|
22
|
+
*
|
|
23
|
+
* Reusable core exported for tests and future MCP parity.
|
|
24
|
+
*/
|
|
25
|
+
import { resolveConfig } from "../config.js";
|
|
26
|
+
import { makeCtx } from "../client.js";
|
|
27
|
+
import { CodebusError } from "../errors.js";
|
|
28
|
+
import { render } from "../output.js";
|
|
29
|
+
/** Resolve the current agent's accountable person slug to use as the default
|
|
30
|
+
* actor_login for attention_queue_v1. Falls back to null (the caller must
|
|
31
|
+
* supply --login) since a service agent has no person of its own. Mirrors
|
|
32
|
+
* whoami.ts's person-resolution shape. */
|
|
33
|
+
export async function resolveActorLogin(ctx) {
|
|
34
|
+
const { data, error } = await ctx.supabase
|
|
35
|
+
.from("agents")
|
|
36
|
+
.select("people!person_id(id,slug)")
|
|
37
|
+
.eq("slug", ctx.agentSlug)
|
|
38
|
+
.single();
|
|
39
|
+
if (error)
|
|
40
|
+
throw new CodebusError(`unable to resolve actor identity: ${error.message}`);
|
|
41
|
+
const me = data?.people ?? null;
|
|
42
|
+
return me?.slug ?? null;
|
|
43
|
+
}
|
|
44
|
+
/** Shared core — calls the attention_queue_v1 RPC (positive fixture: returns
|
|
45
|
+
* the named person's items; negative fixture: empty for another login). The
|
|
46
|
+
* RPC itself enforces RLS + the actor_login scope, so no extra client-side
|
|
47
|
+
* filtering is applied: the projection is authoritative. */
|
|
48
|
+
export async function factoryAttentionCore(ctx, options) {
|
|
49
|
+
const actorLogin = options.login || (await resolveActorLogin(ctx));
|
|
50
|
+
if (!actorLogin) {
|
|
51
|
+
throw new CodebusError("no actor login available — pass --login <github-login-or-slug> (your accountable person)", 2);
|
|
52
|
+
}
|
|
53
|
+
const { data, error } = await ctx.supabase.rpc("attention_queue_v1", {
|
|
54
|
+
p_actor_login: actorLogin,
|
|
55
|
+
});
|
|
56
|
+
if (error)
|
|
57
|
+
throw new CodebusError(`attention_queue_v1 RPC failed: ${error.message}`);
|
|
58
|
+
const rows = (Array.isArray(data) ? data : []);
|
|
59
|
+
return rows;
|
|
60
|
+
}
|
|
61
|
+
function attentionHumanRow(item) {
|
|
62
|
+
const plural = (n) => n === null ? "—" : `${n}s`;
|
|
63
|
+
const ageLabel = item.age_seconds !== null && item.age_seconds !== undefined
|
|
64
|
+
? `${Math.floor(item.age_seconds / 60)}m ${item.age_seconds % 60}s`
|
|
65
|
+
: "—";
|
|
66
|
+
return {
|
|
67
|
+
category: item.category,
|
|
68
|
+
severity: item.severity,
|
|
69
|
+
id: item.item_id.slice(0, 8),
|
|
70
|
+
plan: item.plan_id ? item.plan_id.slice(0, 8) : "—",
|
|
71
|
+
stage: item.stage_id ?? "—",
|
|
72
|
+
owner: item.owner_login ?? "—",
|
|
73
|
+
reason: (item.reason_or_question ?? "—").slice(0, 60),
|
|
74
|
+
age: ageLabel,
|
|
75
|
+
deadline: item.deadline
|
|
76
|
+
? new Date(item.deadline).toLocaleString("en-US", {
|
|
77
|
+
month: "short", day: "numeric", hour: "2-digit", minute: "2-digit", timeZoneName: "short",
|
|
78
|
+
})
|
|
79
|
+
: "—",
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const SEVERITY_ORDER = { critical: 0, high: 1, medium: 2, low: 3 };
|
|
83
|
+
async function attentionCmd(login, o, command) {
|
|
84
|
+
const ctx = await makeCtx(resolveConfig(command.optsWithGlobals()));
|
|
85
|
+
const items = await factoryAttentionCore(ctx, { login: login ?? "" });
|
|
86
|
+
if (o.json) {
|
|
87
|
+
console.log(JSON.stringify(items, null, 2));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if (items.length === 0) {
|
|
91
|
+
console.log("No attention items.");
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
const sorted = [...items].sort((a, b) => (SEVERITY_ORDER[a.severity] ?? 9) - (SEVERITY_ORDER[b.severity] ?? 9) || a.category.localeCompare(b.category));
|
|
95
|
+
console.log(render(sorted.map(attentionHumanRow), { json: false }));
|
|
96
|
+
}
|
|
97
|
+
export function registerFactoryAttention(program, g) {
|
|
98
|
+
const factory = program.commands.find((c) => c.name() === "factory") ??
|
|
99
|
+
program.command("factory").description("coding factory intake");
|
|
100
|
+
g(factory.command("attention")
|
|
101
|
+
.description("console attention view: items needing a human (0109 attention_queue_v1)")
|
|
102
|
+
.argument("[login]", "GitHub login or person slug to project attention for (default: your agent's person)"))
|
|
103
|
+
.option("-j, --json", "render raw JSON rows")
|
|
104
|
+
.action(attentionCmd);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=factory-attention.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-attention.js","sourceRoot":"","sources":["../../src/commands/factory-attention.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAE,aAAa,EAAa,MAAM,cAAc,CAAC;AACxD,OAAO,EAAE,OAAO,EAAO,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,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CAAC;AAED,MAAM,UAAU,wBAAwB,CAAC,OAAgB,EAAE,CAA0B;IACnF,MAAM,OAAO,GACX,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,SAAS,CAAC;QACpD,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;IAClE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC;SAC3B,WAAW,CAAC,yEAAyE,CAAC;SACtF,QAAQ,CAAC,SAAS,EAAE,qFAAqF,CAAC,CAAC;SAC3G,MAAM,CAAC,YAAY,EAAE,sBAAsB,CAAC;SAC5C,MAAM,CAAC,YAAY,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory context read command — versioned taxonomy, contracts, ADRs, specs, knowledge, repos, graphs.
|
|
3
|
+
*
|
|
4
|
+
* Shared core logic for CLI + MCP (A5: dumb client, one command core).
|
|
5
|
+
* Exported: `factoryContextReadCore(ctx, contentType?, repoSlug?)` for both paths.
|
|
6
|
+
* Auth: workspace-scoped via `makeCtx(resolveConfig({}))`.
|
|
7
|
+
* Contract: com.bragi.contract.factory-context-read-api@0.5.0-proposed + cli-mcp-parity.
|
|
8
|
+
* Parity pretest fixture: `identical_version_schema_auth_result_and_errors`.
|
|
9
|
+
* Negative fixture: `stale_local_taxonomy_or_transport_drift`.
|
|
10
|
+
*/
|
|
11
|
+
import { CodebusError } from "../errors.js";
|
|
12
|
+
/**
|
|
13
|
+
* Core factory context read logic — shared by CLI and MCP handlers.
|
|
14
|
+
*
|
|
15
|
+
* Calls CodeBus versioned RPC (pending context-read-api migration 0131),
|
|
16
|
+
* validates schema, asserts no stale/local-copy fallback, returns versioned digest.
|
|
17
|
+
*
|
|
18
|
+
* Errors: thrown as CodebusError with message (used identically by CLI exit code and MCP error).
|
|
19
|
+
* Fixtures: positive = versioned_taxonomy_contract_ADR_spec_knowledge_repo_reads_with_RLS,
|
|
20
|
+
* negative = direct_database_unversioned_or_local_copy_authority.
|
|
21
|
+
*
|
|
22
|
+
* @param ctx authenticated context with workspace/person scoping
|
|
23
|
+
* @param contentType what to read (default "taxonomy")
|
|
24
|
+
* @param repoSlug optional repo filter for repositories/graphs queries
|
|
25
|
+
* @throws CodebusError if content is stale, unversioned, or fetched from direct DB / local copy
|
|
26
|
+
*/
|
|
27
|
+
export async function factoryContextReadCore(ctx, contentType = "taxonomy", repoSlug) {
|
|
28
|
+
// Validate content type
|
|
29
|
+
const validTypes = [
|
|
30
|
+
"taxonomy",
|
|
31
|
+
"contracts",
|
|
32
|
+
"adrs",
|
|
33
|
+
"specs",
|
|
34
|
+
"knowledge",
|
|
35
|
+
"repositories",
|
|
36
|
+
"graphs",
|
|
37
|
+
"configuration",
|
|
38
|
+
];
|
|
39
|
+
if (!validTypes.includes(contentType)) {
|
|
40
|
+
throw new CodebusError(`Invalid contentType '${contentType}'. Allowed: ${validTypes.join(", ")}`);
|
|
41
|
+
}
|
|
42
|
+
// Fix #6: graphs query REQUIRES repoSlug — enforce even when omitted (checked
|
|
43
|
+
// BEFORE the generic non-empty check so the message is contract-specific)
|
|
44
|
+
if (contentType === "graphs" && !repoSlug) {
|
|
45
|
+
throw new CodebusError("repoSlug is required for 'graphs' query");
|
|
46
|
+
}
|
|
47
|
+
// Validate repo slug format when provided (non-graphs types)
|
|
48
|
+
if (repoSlug !== undefined && (typeof repoSlug !== "string" || repoSlug.trim().length === 0)) {
|
|
49
|
+
throw new CodebusError("repoSlug must be a non-empty string or undefined");
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
// RPC call (pending migration 0131: context_read_versioned RPC).
|
|
53
|
+
// For now, placeholder that demonstrates the pattern:
|
|
54
|
+
// Real implementation will query supabase RPC with auth scope.
|
|
55
|
+
// Actual RPC signature (TBD): context_read_versioned(p_content_type, p_repo_slug?, p_version?)
|
|
56
|
+
// -> {version, content, schema_id, source, digest, created_at, authenticated, cascade}
|
|
57
|
+
// Negative case: if source='local_copy' or 'direct_database' → throw "direct_database_unversioned_or_local_copy_authority"
|
|
58
|
+
const rpcResult = await ctx.supabase?.rpc?.("context_read_versioned", {
|
|
59
|
+
p_content_type: contentType,
|
|
60
|
+
p_repo_slug: repoSlug || null,
|
|
61
|
+
});
|
|
62
|
+
if (!rpcResult) {
|
|
63
|
+
throw new CodebusError(`Failed to fetch ${contentType}${repoSlug ? ` for repo ${repoSlug}` : ""}: context-read-api RPC not ready (migration 0131)`);
|
|
64
|
+
}
|
|
65
|
+
// Fix #3: inspect error field — RPC failure must surface the actual transport/database error
|
|
66
|
+
if (rpcResult.error) {
|
|
67
|
+
throw new CodebusError(`context_read_versioned RPC failed for ${contentType}${repoSlug ? ` (repo ${repoSlug})` : ""}: ${rpcResult.error.message ?? String(rpcResult.error)}`);
|
|
68
|
+
}
|
|
69
|
+
// Negative: reject direct-database or local-copy sources
|
|
70
|
+
if (rpcResult.data?.source === "direct_database") {
|
|
71
|
+
throw new CodebusError("Rejected: direct_database query source violates schema (RLS required) — use a versioned ref ('<id>@<version>') or the bounded-cache path; see 'codebus factory-context-read <id>'.");
|
|
72
|
+
}
|
|
73
|
+
if (rpcResult.data?.source === "local_copy") {
|
|
74
|
+
throw new CodebusError("Rejected: local_copy source violates contract (no authoritative local copies)");
|
|
75
|
+
}
|
|
76
|
+
// Negative: reject unversioned content
|
|
77
|
+
if (!rpcResult.data?.version) {
|
|
78
|
+
throw new CodebusError(`Unversioned ${contentType} returned; contract requires versioned read`);
|
|
79
|
+
}
|
|
80
|
+
// Fix #4: digest is content SHA-256 used for cache/staleness. Missing digest
|
|
81
|
+
// means we cannot verify content — fail-closed instead of returning "unknown".
|
|
82
|
+
if (typeof rpcResult.data?.digest !== "string" || rpcResult.data.digest.length === 0) {
|
|
83
|
+
throw new CodebusError(`Missing or empty digest for ${contentType}; content cannot be verified as authoritative`);
|
|
84
|
+
}
|
|
85
|
+
// Fix #5: authenticated must come from the RPC's authorization metadata,
|
|
86
|
+
// not hard-coded. Only trust the response's authenticated flag.
|
|
87
|
+
const authenticated = Boolean(rpcResult.data?.authenticated);
|
|
88
|
+
if (!authenticated) {
|
|
89
|
+
throw new CodebusError(`Unauthorized or unauthenticated response for ${contentType}; RLS scoping required`);
|
|
90
|
+
}
|
|
91
|
+
// Build result
|
|
92
|
+
const result = {
|
|
93
|
+
version: rpcResult.data.version,
|
|
94
|
+
contentType,
|
|
95
|
+
repoSlug,
|
|
96
|
+
content: rpcResult.data.content,
|
|
97
|
+
digest: rpcResult.data.digest,
|
|
98
|
+
timestamp: rpcResult.data.created_at || new Date().toISOString(),
|
|
99
|
+
authenticated,
|
|
100
|
+
cached: rpcResult.data.source === "bounded_cache",
|
|
101
|
+
};
|
|
102
|
+
// Validate schema (placeholder for actual contract schema check)
|
|
103
|
+
if (!result.content) {
|
|
104
|
+
throw new CodebusError(`Empty content for ${contentType}: the contract artifact returned no body — re-run 'codebus factory-context-read <id>' after republishing the artifact.`);
|
|
105
|
+
}
|
|
106
|
+
return result;
|
|
107
|
+
}
|
|
108
|
+
catch (error) {
|
|
109
|
+
// Propagate as CodebusError (identical for CLI + MCP error paths)
|
|
110
|
+
if (error instanceof CodebusError) {
|
|
111
|
+
throw error;
|
|
112
|
+
}
|
|
113
|
+
throw new CodebusError(error instanceof Error
|
|
114
|
+
? error.message
|
|
115
|
+
: `Unknown error fetching ${contentType}: ${String(error)}`);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* CLI command registration (thin adapter over factoryContextReadCore).
|
|
120
|
+
* Reads ctx, calls core, renders result to console.
|
|
121
|
+
* Commander integration for CLI arg parsing.
|
|
122
|
+
*/
|
|
123
|
+
export async function registerFactoryContextRead(program) {
|
|
124
|
+
program
|
|
125
|
+
.command("factory-context-read")
|
|
126
|
+
.alias("fcr")
|
|
127
|
+
.description("Read versioned Factory context: taxonomy, contracts, ADRs, specs, knowledge, repos, graphs, configuration")
|
|
128
|
+
.option("-t, --type <contentType>", "Content type: taxonomy|contracts|adrs|specs|knowledge|repositories|graphs|configuration (default: taxonomy)", "taxonomy")
|
|
129
|
+
.option("-r, --repo <slug>", "Optional repo slug for repositories/graphs queries")
|
|
130
|
+
.option("-j, --json", "Output raw JSON")
|
|
131
|
+
.action(async (options) => {
|
|
132
|
+
try {
|
|
133
|
+
const contentType = (options.type || "taxonomy");
|
|
134
|
+
const { makeCtx } = await import("../client.js");
|
|
135
|
+
const { resolveConfig } = await import("../config.js");
|
|
136
|
+
const ctx = await makeCtx(resolveConfig({}));
|
|
137
|
+
const result = await factoryContextReadCore(ctx, contentType, options.repo);
|
|
138
|
+
if (options.json) {
|
|
139
|
+
console.log(JSON.stringify(result, null, 2));
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// Human-readable output
|
|
143
|
+
console.log(`Factory Context Read — ${contentType}`);
|
|
144
|
+
console.log(`Version: ${result.version}`);
|
|
145
|
+
console.log(`Timestamp: ${result.timestamp}`);
|
|
146
|
+
console.log(`Digest: ${result.digest}`);
|
|
147
|
+
if (result.repoSlug)
|
|
148
|
+
console.log(`Repo: ${result.repoSlug}`);
|
|
149
|
+
if (result.cached)
|
|
150
|
+
console.log("[Cached: bounded non-authoritative]");
|
|
151
|
+
console.log(`Content:\n${JSON.stringify(result.content, null, 2)}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const message = error instanceof CodebusError
|
|
156
|
+
? error.message
|
|
157
|
+
: error instanceof Error
|
|
158
|
+
? error.message
|
|
159
|
+
: String(error);
|
|
160
|
+
console.error(`Error: ${message}`);
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Export for use by mcp-factory-context-read.ts (MCP handler imports and calls this same core).
|
|
167
|
+
*/
|
|
168
|
+
export function createFactoryContextReadCLI(program) {
|
|
169
|
+
registerFactoryContextRead(program);
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=factory-context-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"factory-context-read.js","sourceRoot":"","sources":["../../src/commands/factory-context-read.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAkC5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,GAAQ,EACR,cAAkC,UAAU,EAC5C,QAAiB;IAEjB,wBAAwB;IACxB,MAAM,UAAU,GAAyB;QACvC,UAAU;QACV,WAAW;QACX,MAAM;QACN,OAAO;QACP,WAAW;QACX,cAAc;QACd,QAAQ;QACR,eAAe;KAChB,CAAC;IACF,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACtC,MAAM,IAAI,YAAY,CAAC,wBAAwB,WAAW,eAAe,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACpG,CAAC;IAED,8EAA8E;IAC9E,0EAA0E;IAC1E,IAAI,WAAW,KAAK,QAAQ,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1C,MAAM,IAAI,YAAY,CAAC,yCAAyC,CAAC,CAAC;IACpE,CAAC;IACD,6DAA6D;IAC7D,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC,EAAE,CAAC;QAC7F,MAAM,IAAI,YAAY,CAAC,kDAAkD,CAAC,CAAC;IAC7E,CAAC;IAED,IAAI,CAAC;QACH,iEAAiE;QACjE,sDAAsD;QACtD,+DAA+D;QAC/D,+FAA+F;QAC/F,yFAAyF;QACzF,2HAA2H;QAE3H,MAAM,SAAS,GAAG,MA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