@gonovus-ai/spec-flow-cli 1.0.1 → 1.1.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 CHANGED
@@ -39,7 +39,7 @@ seven-day Better Auth CLI Session. It supports the Node.js 24 runtime line;
39
39
  Node.js 22 and unverified future major versions are intentionally unsupported.
40
40
 
41
41
  ```bash
42
- npm install --global @gonovus-ai/spec-flow-cli@1.0.1
42
+ npm install --global @gonovus-ai/spec-flow-cli@1.1.0
43
43
  specflow auth login
44
44
  specflow auth status
45
45
  specflow auth logout
@@ -61,13 +61,34 @@ default, provide `SPEC_FLOW_DEFAULT_API_URL` to the CLI build command. The packe
61
61
  installation smoke uses an isolated `.invalid` test origin when no build value is
62
62
  provided; it never substitutes a deployment URL into source.
63
63
 
64
+ ## Context Documents and boards
65
+
66
+ CLI 1.1.0 reads and drafts Context Documents (engineering specifications with
67
+ Guardrails and boards) and keeps a repository's AGENTS.md current:
68
+
69
+ ```bash
70
+ specflow context index --workspace-id <workspace-id> --repository owner/name
71
+ specflow context sync-agents --workspace-id <workspace-id>
72
+ specflow context sync-agents --check
73
+ specflow context-doc read --workspace-id <workspace-id> --document-id PAY-D3
74
+ specflow context-doc draft edit --workspace-id <workspace-id> --document-id PAY-D3 --body-file body.md --expected-version 7
75
+ specflow board read --workspace-id <workspace-id> --document-id PAY-D3 --board-id <board-id> --revision draft
76
+ specflow board image --workspace-id <workspace-id> --document-id PAY-D3 --board-id <board-id> --out board.png
77
+ specflow board import --workspace-id <workspace-id> --document-id PAY-D3 --file flow.mmd --mode new --dry-run
78
+ ```
79
+
80
+ `sync-agents` writes a `<!-- specflow:context:begin -->` block that reruns leave
81
+ byte-identical; `--check` exits 1 with a diff when it is stale. Changes written by
82
+ the CLI are Agent changes: Guardrails and proposed placement wait for a person's
83
+ review in the Web application, and publishing waits until then (`REVIEW_PENDING`).
84
+
64
85
  ## Compatibility and upgrades
65
86
 
66
87
  ```bash
67
- specflow version --json --skill-version 0.6.2 --compatible-cli "^1.0.0"
88
+ specflow version --json --skill-version 0.7.0 --compatible-cli "^1.1.0"
68
89
  specflow upgrade
69
90
  specflow upgrade --yes
70
- specflow upgrade --to 1.0.1
91
+ specflow upgrade --to 1.1.0
71
92
  ```
72
93
 
73
94
  `version` shows the installed CLI and public advice from the selected origin.
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ import { type ContextCommandRuntime } from "./context-command-support.js";
3
+ export declare function registerBoardCommands(program: Command, runtime: ContextCommandRuntime): void;
@@ -0,0 +1,381 @@
1
+ import { randomUUID } from "node:crypto";
2
+ import { chmod, rename, rm, stat, writeFile } from "node:fs/promises";
3
+ import { basename, dirname, extname, join, resolve } from "node:path";
4
+ import { boardSummaries, invalidArgument, mapData, parseDocumentVersion, parseIdempotencyKey, parseIdentity, parseJsonInput, parseRepository, readTextInput, writeOptions, } from "./context-command-support.js";
5
+ const parseWorkspaceId = parseIdentity("Workspace ID");
6
+ const parseDocumentId = parseIdentity("Context Document ID");
7
+ function parseBoardId(value) {
8
+ const trimmed = value.trim();
9
+ if (!/^[A-Za-z0-9_-]{1,64}$/u.test(trimmed))
10
+ throw invalidArgument("Board ID must be the ID a board list or read printed");
11
+ return trimmed;
12
+ }
13
+ function parseRevision(value) {
14
+ const trimmed = value.trim();
15
+ if (trimmed.length === 0 || trimmed.length > 200)
16
+ throw invalidArgument("Revision must be draft, published or a Revision ID");
17
+ return trimmed;
18
+ }
19
+ function choice(label, values) {
20
+ return (value) => {
21
+ if (values.includes(value))
22
+ return value;
23
+ throw invalidArgument(`${label} must be ${values.join(" or ")}`);
24
+ };
25
+ }
26
+ /** Image waits are bounded: the server answers 503 BOARD_IMAGE_PENDING while it draws. */
27
+ const imageWaitBudgetMilliseconds = 30_000;
28
+ const maximumImageBytes = 20 * 1024 * 1024;
29
+ const maximumSourceBytes = 2 * 1024 * 1024;
30
+ const defaultSleep = (milliseconds) => new Promise((resolveSleep) => setTimeout(resolveSleep, milliseconds));
31
+ function errorCode(error) {
32
+ return typeof error === "object" &&
33
+ error !== null &&
34
+ "code" in error &&
35
+ typeof error.code === "string"
36
+ ? error.code
37
+ : null;
38
+ }
39
+ /** The document version to send with a later write, read before the board itself. */
40
+ async function draftVersion(client, path) {
41
+ const document = await client.GET("/v1/workspaces/{workspaceId}/context-documents/{documentId}", {
42
+ params: { path },
43
+ });
44
+ return document.data === undefined
45
+ ? { failure: document }
46
+ : { version: document.data.document.version };
47
+ }
48
+ export function registerBoardCommands(program, runtime) {
49
+ const board = program
50
+ .command("board")
51
+ .description("Read, picture and draw Context Document boards");
52
+ const sleep = runtime.dependencies.sleep ?? defaultSleep;
53
+ const now = runtime.dependencies.now ?? Date.now;
54
+ /** Member reads default to the published board; Read Tokens can read nothing else. */
55
+ const selectedRevision = (revision) => revision ?? "published";
56
+ board
57
+ .command("list")
58
+ .description("List the boards of one Context Document, or of every document for a repository")
59
+ .requiredOption("--workspace-id <workspaceId>", "Workspace ID", parseWorkspaceId)
60
+ .option("--document-id <documentId>", "Context Document ID", parseDocumentId)
61
+ .option("--repository <owner/name>", "List the boards of every document applying here")
62
+ .option("--revision <revision>", "draft or published (default)", choice("Revision", ["draft", "published"]))
63
+ .action(async (options) => {
64
+ if ((options.documentId === undefined) === (options.repository === undefined))
65
+ throw invalidArgument("Pass exactly one of --document-id or --repository");
66
+ const revision = selectedRevision(options.revision);
67
+ if (options.repository !== undefined) {
68
+ const repository = parseRepository(options.repository);
69
+ if (options.revision === "draft")
70
+ throw invalidArgument("--repository lists published boards; pass --document-id for a draft");
71
+ runtime.setExitCode(await runtime.run(async (client) => mapData(await client.GET("/v1/workspaces/{workspaceId}/context-index", {
72
+ params: { path: { workspaceId: options.workspaceId }, query: { repository } },
73
+ }), (index) => ({
74
+ repository: index.repository,
75
+ revision,
76
+ boards: index.documents.flatMap((document) => document.boards.map((entry) => ({
77
+ documentId: document.id,
78
+ documentTitle: document.title,
79
+ revisionId: document.currentRevisionId,
80
+ id: entry.id,
81
+ title: entry.title,
82
+ }))),
83
+ }))));
84
+ return;
85
+ }
86
+ const path = { workspaceId: options.workspaceId, documentId: options.documentId ?? "" };
87
+ if (runtime.isReadToken() && revision !== "draft") {
88
+ runtime.setExitCode(await runtime.run(async (client) => mapData(await client.GET("/v1/workspaces/{workspaceId}/published/context-documents/{documentId}/current-revision", { params: { path } }), (data) => ({
89
+ documentId: path.documentId,
90
+ revision,
91
+ revisionId: data.revision.id,
92
+ boards: boardSummaries(data.revision.boards),
93
+ }))));
94
+ return;
95
+ }
96
+ runtime.setExitCode(await runtime.run(async (client) => mapData(await client.GET("/v1/workspaces/{workspaceId}/context-documents/{documentId}", {
97
+ params: { path },
98
+ }), (data) => ({
99
+ documentId: data.document.id,
100
+ revision,
101
+ revisionId: revision === "draft" ? null : (data.published?.id ?? null),
102
+ documentVersion: data.document.version,
103
+ boards: boardSummaries(revision === "draft" ? data.document.boards : (data.published?.boards ?? [])),
104
+ })),
105
+ // A Workspace read-only Token reads published boards only.
106
+ { rejectWorkspaceReadToken: true }));
107
+ });
108
+ const boardScope = (command) => command
109
+ .requiredOption("--workspace-id <workspaceId>", "Workspace ID", parseWorkspaceId)
110
+ .requiredOption("--document-id <documentId>", "Context Document ID", parseDocumentId)
111
+ .requiredOption("--board-id <boardId>", "Board ID", parseBoardId);
112
+ boardScope(board
113
+ .command("read")
114
+ .description("Read a board's structure (nodes, edges, groups) or export it as Mermaid"))
115
+ .option("--format <format>", "topology (default) or mermaid", choice("Format", ["topology", "mermaid"]), "topology")
116
+ .option("--revision <revision>", "draft, published (default) or a Revision ID", parseRevision)
117
+ .action(async (options) => {
118
+ const revision = selectedRevision(options.revision);
119
+ const path = {
120
+ workspaceId: options.workspaceId,
121
+ documentId: options.documentId,
122
+ boardId: options.boardId,
123
+ };
124
+ const params = { params: { path, query: { revision } } };
125
+ const scope = { boardId: options.boardId, revision };
126
+ const readBoard = async (client) => options.format === "mermaid"
127
+ ? await client.GET("/v1/workspaces/{workspaceId}/context-documents/{documentId}/boards/{boardId}/mermaid", params)
128
+ : await client.GET("/v1/workspaces/{workspaceId}/context-documents/{documentId}/boards/{boardId}/topology", params);
129
+ runtime.setExitCode(await runtime.run(async (client) => {
130
+ if (revision !== "draft")
131
+ return mapData(await readBoard(client), (data) => ({ ...scope, ...data }));
132
+ // A draft read reports the document version that `board import`/`board edit`
133
+ // can send as --expected-version. The board carries no version of its own, so
134
+ // the version is read on both sides of it; a write in between retries once.
135
+ for (let attempt = 0;; attempt++) {
136
+ const before = await draftVersion(client, options);
137
+ if ("failure" in before)
138
+ return before.failure;
139
+ const read = await readBoard(client);
140
+ if (read.data === undefined)
141
+ return read;
142
+ const after = await draftVersion(client, options);
143
+ if ("failure" in after)
144
+ return after.failure;
145
+ if (after.version === before.version)
146
+ return mapData(read, (data) => ({
147
+ ...scope,
148
+ documentVersion: before.version,
149
+ ...data,
150
+ }));
151
+ if (attempt > 0)
152
+ return {
153
+ response: new Response(null, { status: 412 }),
154
+ error: {
155
+ code: "BOARD_DRAFT_CHANGING",
156
+ message: "The draft kept changing while it was read; read the board again",
157
+ },
158
+ };
159
+ }
160
+ },
161
+ // A Workspace read-only Token reads published boards only.
162
+ { rejectWorkspaceReadToken: revision === "draft" }));
163
+ });
164
+ boardScope(board
165
+ .command("image")
166
+ .description("Save a board's picture (drawn by the Web's own export) to a local file"))
167
+ .requiredOption("--out <file>", "Image file to write (replaced when it exists)")
168
+ .option("--format <format>", "png (default) or svg", choice("Format", ["png", "svg"]))
169
+ .option("--theme <theme>", "light (default) or dark", choice("Theme", ["light", "dark"]), "light")
170
+ .option("--revision <revision>", "draft, published (default) or a Revision ID", parseRevision)
171
+ .action(async (options) => {
172
+ const extension = extname(options.out).toLowerCase();
173
+ const format = options.format ?? (extension === ".svg" ? "svg" : "png");
174
+ const revision = selectedRevision(options.revision);
175
+ const out = resolve(options.out);
176
+ runtime.setExitCode(await runtime.run(async (client) => {
177
+ const started = now();
178
+ let backoff = 1_000;
179
+ for (;;) {
180
+ const result = await client.GET("/v1/workspaces/{workspaceId}/context-documents/{documentId}/boards/{boardId}/image", {
181
+ params: {
182
+ path: {
183
+ workspaceId: options.workspaceId,
184
+ documentId: options.documentId,
185
+ boardId: options.boardId,
186
+ },
187
+ query: { revision, format, theme: options.theme },
188
+ },
189
+ parseAs: "arrayBuffer",
190
+ });
191
+ if (result.data === undefined) {
192
+ if (result.response.status !== 503 ||
193
+ errorCode(result.error) !== "BOARD_IMAGE_PENDING")
194
+ return result;
195
+ // The server's Retry-After sets the pace; without one, back off.
196
+ const retryAfter = Number(result.response.headers.get("retry-after"));
197
+ const wait = Number.isFinite(retryAfter) && retryAfter > 0 ? retryAfter * 1_000 : backoff;
198
+ backoff = Math.min(backoff * 2, 8_000);
199
+ // The budget covers the whole wait, the image requests included; the last
200
+ // wait is shortened so the final request still falls inside it.
201
+ const remaining = imageWaitBudgetMilliseconds - (now() - started);
202
+ if (remaining <= 0)
203
+ return result;
204
+ await sleep(Math.min(wait, remaining));
205
+ continue;
206
+ }
207
+ const bytes = new Uint8Array(result.data);
208
+ if (bytes.byteLength > maximumImageBytes)
209
+ return {
210
+ response: new Response(null, { status: 413 }),
211
+ error: {
212
+ code: "BOARD_IMAGE_TOO_LARGE",
213
+ message: "The board image is too large",
214
+ },
215
+ };
216
+ const temporary = join(dirname(out), `.${basename(out)}.${randomUUID()}.tmp`);
217
+ let created = false;
218
+ try {
219
+ // A replaced file keeps its mode; a new one is private to the user.
220
+ const mode = await stat(out).then((existing) => (existing.isFile() ? existing.mode & 0o7777 : 0o600), () => 0o600);
221
+ await writeFile(temporary, bytes, { flag: "wx", mode });
222
+ created = true;
223
+ await chmod(temporary, mode);
224
+ await rename(temporary, out);
225
+ }
226
+ catch {
227
+ if (created)
228
+ await rm(temporary, { force: true });
229
+ return {
230
+ response: new Response(null, { status: 400 }),
231
+ error: {
232
+ code: "LOCAL_FILE_WRITE_FAILED",
233
+ message: "The image could not be written to --out; choose a writable path",
234
+ },
235
+ };
236
+ }
237
+ return {
238
+ response: result.response,
239
+ data: {
240
+ boardId: options.boardId,
241
+ revision,
242
+ format,
243
+ theme: options.theme,
244
+ outputFile: out,
245
+ size: bytes.byteLength,
246
+ contentType: result.response.headers.get("content-type"),
247
+ complete: result.response.headers.get("x-board-image-complete") !== "false",
248
+ waitedMilliseconds: Math.max(0, now() - started),
249
+ },
250
+ };
251
+ }
252
+ },
253
+ // A Workspace read-only Token pictures published boards only.
254
+ { rejectWorkspaceReadToken: revision === "draft" }));
255
+ });
256
+ board
257
+ .command("import")
258
+ .description("Draw a board from Mermaid (.mmd) or topology (.json): new board, append, or replace")
259
+ .requiredOption("--workspace-id <workspaceId>", "Workspace ID", parseWorkspaceId)
260
+ .requiredOption("--document-id <documentId>", "Context Document ID", parseDocumentId)
261
+ .requiredOption("--file <path>", "Mermaid flowchart (.mmd) or topology JSON (.json), or -")
262
+ .requiredOption("--mode <mode>", "new, append or replace", choice("Mode", ["new", "append", "replace"]))
263
+ .option("--board-id <boardId>", "The board to append to or replace", parseBoardId)
264
+ .option("--title <title>", "Board title (new board, or a new title on replace)")
265
+ .option("--dry-run", "Validate and lay out exactly as a write would, but write nothing")
266
+ .option("--expected-version <version>", "Document version from your last read; refused if the document changed since", parseDocumentVersion)
267
+ .option("--idempotency-key <key>", "Reuse a dry run's key to write the identities it reported, or to retry a write", parseIdempotencyKey)
268
+ .action(async (options) => {
269
+ if (!runtime.canWrite()) {
270
+ runtime.setExitCode(runtime.rejectWrite());
271
+ return;
272
+ }
273
+ if (options.mode === "new" && options.boardId !== undefined)
274
+ throw invalidArgument("--mode new draws a new board; drop --board-id");
275
+ if (options.mode !== "new" && options.boardId === undefined)
276
+ throw invalidArgument(`--mode ${options.mode} needs --board-id`);
277
+ const text = await readTextInput(options.file, maximumSourceBytes, "Board source");
278
+ const extension = extname(options.file).toLowerCase();
279
+ const json = extension === ".json" ||
280
+ (![".mmd", ".mermaid", ".md"].includes(extension) && text.trimStart().startsWith("{"));
281
+ const source = json
282
+ ? { kind: "topology", topology: topologyOf(parseJsonInput(text, "Topology")) }
283
+ : { kind: "mermaid", text };
284
+ const idempotencyKey = options.idempotencyKey ?? randomUUID();
285
+ const dryRun = options.dryRun === true;
286
+ runtime.setExitCode(await runtime.run(async (client) => mapData(await client.POST("/v1/workspaces/{workspaceId}/context-documents/{documentId}/boards/import", {
287
+ params: {
288
+ path: { workspaceId: options.workspaceId, documentId: options.documentId },
289
+ header: {
290
+ "idempotency-key": idempotencyKey,
291
+ ...(options.expectedVersion === undefined
292
+ ? {}
293
+ : { "if-match": options.expectedVersion }),
294
+ },
295
+ },
296
+ body: {
297
+ mode: options.mode,
298
+ ...(options.boardId === undefined ? {} : { boardId: options.boardId }),
299
+ ...(options.title === undefined ? {} : { title: options.title }),
300
+ source,
301
+ ...(dryRun ? { dryRun: true } : {}),
302
+ },
303
+ }), (data) => withWriteGuidance(data, idempotencyKey, dryRun)), dryRun ? {} : writeOptions("Board import", idempotencyKey)));
304
+ });
305
+ boardScope(board
306
+ .command("edit")
307
+ .description("Apply node, edge, group and board operations to a board, all or nothing"))
308
+ .requiredOption("--ops <path>", 'JSON array of operations (or {"operations": [...]}), or -')
309
+ .option("--dry-run", "Validate and apply exactly as a write would, but write nothing")
310
+ .option("--expected-version <version>", "Document version from your last read; refused if the document changed since", parseDocumentVersion)
311
+ .option("--idempotency-key <key>", "Reuse a dry run's key to write the identities it reported, or to retry a write", parseIdempotencyKey)
312
+ .action(async (options) => {
313
+ if (!runtime.canWrite()) {
314
+ runtime.setExitCode(runtime.rejectWrite());
315
+ return;
316
+ }
317
+ const parsed = parseJsonInput(await readTextInput(options.ops, maximumSourceBytes, "Operations"), "Operations");
318
+ const operations = Array.isArray(parsed)
319
+ ? parsed
320
+ : typeof parsed === "object" && parsed !== null && "operations" in parsed
321
+ ? parsed.operations
322
+ : undefined;
323
+ if (!Array.isArray(operations) || operations.length === 0)
324
+ throw invalidArgument('Operations must be a nonempty JSON array, or an object {"operations": [...]}');
325
+ const idempotencyKey = options.idempotencyKey ?? randomUUID();
326
+ const dryRun = options.dryRun === true;
327
+ runtime.setExitCode(await runtime.run(async (client) => mapData(await client.POST("/v1/workspaces/{workspaceId}/context-documents/{documentId}/boards/{boardId}/edit", {
328
+ params: {
329
+ path: {
330
+ workspaceId: options.workspaceId,
331
+ documentId: options.documentId,
332
+ boardId: options.boardId,
333
+ },
334
+ header: {
335
+ "idempotency-key": idempotencyKey,
336
+ ...(options.expectedVersion === undefined
337
+ ? {}
338
+ : { "if-match": options.expectedVersion }),
339
+ },
340
+ },
341
+ // The server validates each operation; its 422 names the one refused.
342
+ body: {
343
+ operations: operations,
344
+ ...(dryRun ? { dryRun: true } : {}),
345
+ },
346
+ }), (data) => withWriteGuidance(data, idempotencyKey, dryRun)), dryRun ? {} : writeOptions("Board edit", idempotencyKey)));
347
+ });
348
+ }
349
+ /** A topology file, or a `board read` result, whose extra read-only fields the server drops. */
350
+ function topologyOf(value) {
351
+ const candidate = typeof value === "object" && value !== null && "topology" in value
352
+ ? value.topology
353
+ : value;
354
+ if (typeof candidate !== "object" || candidate === null || Array.isArray(candidate))
355
+ throw invalidArgument("Topology JSON must be an object with nodes, edges and groups arrays");
356
+ const topology = candidate;
357
+ if (!Array.isArray(topology.nodes))
358
+ throw invalidArgument("Topology nodes must be a JSON array");
359
+ for (const list of ["edges", "groups"])
360
+ if (topology[list] !== undefined && !Array.isArray(topology[list]))
361
+ throw invalidArgument(`Topology ${list} must be a JSON array when present`);
362
+ // The server validates the topology itself; absent lists are empty.
363
+ return {
364
+ ...candidate,
365
+ edges: topology.edges ?? [],
366
+ groups: topology.groups ?? [],
367
+ };
368
+ }
369
+ function withWriteGuidance(data, idempotencyKey, dryRun) {
370
+ const version = "version" in data && typeof data.version === "number" ? data.version : null;
371
+ return {
372
+ ...data,
373
+ idempotencyKey,
374
+ ...(dryRun
375
+ ? {
376
+ next: `Nothing was written. Look at the result (board image --revision draft shows the board as it is now); to write exactly this, rerun without --dry-run and with ${version === null ? "" : `--expected-version ${String(version)} `}--idempotency-key ${idempotencyKey}`,
377
+ }
378
+ : {}),
379
+ };
380
+ }
381
+ //# sourceMappingURL=board-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board-commands.js","sourceRoot":"","sources":["../src/board-commands.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAItE,OAAO,EACL,cAAc,EACd,eAAe,EACf,OAAO,EACP,oBAAoB,EACpB,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,eAAe,EACf,aAAa,EACb,YAAY,GAGb,MAAM,8BAA8B,CAAC;AAGtC,MAAM,gBAAgB,GAAG,aAAa,CAAC,cAAc,CAAC,CAAC;AACvD,MAAM,eAAe,GAAG,aAAa,CAAC,qBAAqB,CAAC,CAAC;AAC7D,SAAS,YAAY,CAAC,KAAa;IACjC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,OAAO,CAAC;QACzC,MAAM,eAAe,CAAC,sDAAsD,CAAC,CAAC;IAChF,OAAO,OAAO,CAAC;AACjB,CAAC;AACD,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,GAAG;QAC9C,MAAM,eAAe,CAAC,oDAAoD,CAAC,CAAC;IAC9E,OAAO,OAAO,CAAC;AACjB,CAAC;AACD,SAAS,MAAM,CAAyB,KAAa,EAAE,MAAoB;IACzE,OAAO,CAAC,KAAa,EA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E;IACpE,OAAO;QACL,GAAG,SAAS;QACZ,KAAK,EAAG,QAAQ,CAAC,KAA+B,IAAI,EAAE;QACtD,MAAM,EAAG,QAAQ,CAAC,MAAgC,IAAI,EAAE;KAC5B,CAAC;AACjC,CAAC;AAED,SAAS,iBAAiB,CAAmB,IAAO,EAAE,cAAsB,EAAE,MAAe;IAC3F,MAAM,OAAO,GAAG,SAAS,IAAI,IAAI,IAAI,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5F,OAAO;QACL,GAAG,IAAI;QACP,cAAc;QACd,GAAG,CAAC,MAAM;YACR,CAAC,CAAC;gBACE,IAAI,EAAE,gKAAgK,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,sBAAsB,MAAM,CAAC,OAAO,CAAC,GAAG,qBAAqB,cAAc,EAAE;aAC5Q;YACH,CAAC,CAAC,EAAE,CAAC;KACR,CAAC;AACJ,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -14,6 +14,10 @@ export interface CliDependencies {
14
14
  readonly fetch: (request: Request) => Promise<Response>;
15
15
  readonly stderr: (value: string) => void;
16
16
  readonly stdout: (value: string) => void;
17
+ /** Waits between bounded retries (board images); tests replace it. */
18
+ readonly sleep?: (milliseconds: number) => Promise<void>;
19
+ /** Clock for bounded waits (board images); tests replace it. */
20
+ readonly now?: () => number;
17
21
  }
18
22
  export declare function formatResourceDiagnostic(message: string): string;
19
23
  export declare function runCli(arguments_: readonly string[], originalDependencies: CliDependencies): Promise<number>;
package/dist/cli.js CHANGED
@@ -2,8 +2,10 @@ import { CommanderError, InvalidArgumentError } from "commander";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { z } from "zod";
4
4
  import { addAuthenticationCommandTopology } from "./authentication-command-topology.js";
5
+ import { registerBoardCommands } from "./board-commands.js";
5
6
  import { registerClientCompatibilityCommands } from "./commands/client-compatibility.js";
6
7
  import { itemOutput, itemListOutput, relationListOutput, relationReceiptOutput, } from "./commands/work-item-output.js";
8
+ import { registerContextDocumentCommands } from "./context-document-commands.js";
7
9
  import { registerCustomFieldColorCommands, parseOptionColors, } from "./custom-field-color-commands.js";
8
10
  import { registerGitHubAccountCommands } from "./github-account-commands.js";
9
11
  import { readDescription, singleDescriptionSource } from "./input/text-source.js";
@@ -1656,6 +1658,18 @@ export async function runCli(arguments_, originalDependencies) {
1656
1658
  rejectWrite: () => rejectTokenWrite(dependencies),
1657
1659
  });
1658
1660
  registerWorkItemThreadCommands(workItem, resourceRuntime);
1661
+ const contextRuntime = {
1662
+ dependencies,
1663
+ run,
1664
+ setExitCode: (value) => {
1665
+ exitCode = value;
1666
+ },
1667
+ canWrite: () => !hasWorkspaceReadToken(dependencies.environment),
1668
+ rejectWrite: () => rejectTokenWrite(dependencies),
1669
+ isReadToken: () => hasWorkspaceReadToken(dependencies.environment),
1670
+ };
1671
+ registerContextDocumentCommands(program, contextRuntime);
1672
+ registerBoardCommands(program, contextRuntime);
1659
1673
  const workItemComment = workItem
1660
1674
  .command("comment")
1661
1675
  .description("Read and manage authored task comments");