@softdesignbrasil/productdock-cli 0.7.0 → 0.9.1

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.
Files changed (3) hide show
  1. package/README.md +604 -324
  2. package/dist/productdock.js +121 -201
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -79,7 +79,7 @@ productdock --json doctor
79
79
 
80
80
  Under `--json` the CLI:
81
81
 
82
- - writes **exactly one JSON document to `stdout`** — in success *and* in failure;
82
+ - writes **exactly one JSON document to `stdout`** — in success _and_ in failure;
83
83
  - suppresses prose and spinners, and sends every error message to `stderr`;
84
84
  - never prompts: a command that would have to ask something fails immediately
85
85
  instead of waiting for input that will never come.
@@ -92,17 +92,24 @@ Under `--json` the CLI:
92
92
  `error.code` is the process exit code, so an agent can branch either on the
93
93
  document or on the exit status.
94
94
 
95
+ **One documented exception: `productdock watch`.** It does not end on its own,
96
+ so under `--json` it writes **one JSON event per line** (NDJSON) as things
97
+ happen, and the closing document above is its last line. A round asks nothing,
98
+ so it runs without a terminal; the two things that do ask — the model on the
99
+ first run and `--confirm` — still prompt with `--json` on, on `stderr`, and
100
+ need a terminal. See [`productdock watch`](#productdock-watch).
101
+
95
102
  Without `--json`, `stdout` still carries nothing but what a shell expects to find
96
103
  there — `--help` and `--version`. Prose, spinners and error messages always go to
97
104
  `stderr`, which keeps `stdout` free for machine-readable output.
98
105
 
99
106
  ### Exit codes
100
107
 
101
- | Code | Meaning |
102
- | ---- | ------------------------------------------------------------------------ |
103
- | `0` | Success — also when the user cancels a prompt (Ctrl-C) |
104
- | `1` | Business error — bad usage, missing configuration, failed remote call |
105
- | `2` | Authentication error — no session, or the refresh token was rejected |
108
+ | Code | Meaning |
109
+ | ---- | --------------------------------------------------------------------- |
110
+ | `0` | Success — also when the user cancels a prompt (Ctrl-C) |
111
+ | `1` | Business error — bad usage, missing configuration, failed remote call |
112
+ | `2` | Authentication error — no session, or the refresh token was rejected |
106
113
 
107
114
  An operation that would need a terminal and does not have one (`--json`, no TTY,
108
115
  CI) exits `1` with an explanation on `stderr` — it never blocks.
@@ -118,7 +125,7 @@ The file is looked up in the current directory **and in every directory above
118
125
  it**, the way Git finds `.git`. So a command run from inside
119
126
  `.productdock/work-items/<WI>/` — where the artifacts of a work item live, and
120
127
  therefore where you are working — resolves the same scope as one run from the
121
- repository root. `productdock init` and `productdock link` still *write* in the
128
+ repository root. `productdock init` and `productdock link` still _write_ in the
122
129
  current directory: linking from a subdirectory must not rewrite the parent's
123
130
  link.
124
131
 
@@ -134,9 +141,9 @@ productdock <operation> --project-id <uuid>
134
141
  productdock <operation> --repository-id <uuid>
135
142
  ```
136
143
 
137
- | Flag | Description |
138
- | ------------------------ | ---------------------------------------------------------------- |
139
- | `--project-id <uuid>` | Project the operation runs against — overrides `project.id` |
144
+ | Flag | Description |
145
+ | ------------------------ | ---------------------------------------------------------------------- |
146
+ | `--project-id <uuid>` | Project the operation runs against — overrides `project.id` |
140
147
  | `--repository-id <uuid>` | Repository the operation runs against — overrides `project.repository` |
141
148
 
142
149
  In a tree that was never linked, an operation that needs a project exits `1`,
@@ -155,7 +162,7 @@ productdock init
155
162
 
156
163
  ### `productdock login`
157
164
 
158
- Authenticates with Azure AD using OAuth 2.1 + PKCE. Opens a browser window and saves credentials to `~/.productdock/credentials.json`.
165
+ Authenticates with Azure AD using OAuth 2.1 + PKCE. Opens a browser window and saves credentials to `~/.productdock/credentials.json` — or to the directory in `PRODUCTDOCK_CONFIG_DIR`, which `login`, the silent refresh and `logout` all honour.
159
166
 
160
167
  ```bash
161
168
  productdock login
@@ -200,16 +207,16 @@ Nothing is written until every decision is made: a `link` that fails leaves the
200
207
  directory exactly as it was, instead of a `productdock.json` carrying only the
201
208
  project.
202
209
 
203
- | Flag | Description |
204
- | ------------------------ | ------------------------------------------------------------------------------ |
205
- | `--project-id <uuid>` | Skip interactive project selection |
206
- | `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
210
+ | Flag | Description |
211
+ | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
212
+ | `--project-id <uuid>` | Skip interactive project selection |
213
+ | `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
207
214
  | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Replaces running `productdock init`, which needs a terminal |
208
- | `--install-mcp` | Install the MCP configuration without asking |
209
- | `--no-install-mcp` | Do not install the MCP configuration |
210
- | `--install-skills` | Install skills and agents without asking |
211
- | `--no-install-skills` | Do not install skills or agents |
212
- | `-y, --yes` | Answer yes to every confirmation |
215
+ | `--install-mcp` | Install the MCP configuration without asking |
216
+ | `--no-install-mcp` | Do not install the MCP configuration |
217
+ | `--install-skills` | Install skills and agents without asking |
218
+ | `--no-install-skills` | Do not install skills or agents |
219
+ | `-y, --yes` | Answer yes to every confirmation |
213
220
 
214
221
  Under `--json` the response document reports the resulting state of the link —
215
222
  project, repository (`null` when none was bound), IDEs, and whether the MCP and
@@ -249,11 +256,11 @@ Both groups share the same four subcommands and the same behaviour — `skill` m
249
256
 
250
257
  An agent is a **single file** upstream (`agents/{name}.agent.md`), not a folder like a skill, and it is installed under the name each platform expects:
251
258
 
252
- | Target | Written to | Frontmatter |
253
- | --- | --- | --- |
254
- | Claude Code (`claude-code`, `claude-desktop`) | `.claude/agents/{name}.md` | kept, minus the platform override blocks |
255
- | GitHub Copilot (`vscode`) | `.github/agents/{name}.agent.md` | `name`, `description`, `argument-hint`, plus the source's `copilot:` block |
256
- | Cursor | — | Cursor has no destination for agents; the target is skipped |
259
+ | Target | Written to | Frontmatter |
260
+ | --------------------------------------------- | -------------------------------- | -------------------------------------------------------------------------- |
261
+ | Claude Code (`claude-code`, `claude-desktop`) | `.claude/agents/{name}.md` | kept, minus the platform override blocks |
262
+ | GitHub Copilot (`vscode`) | `.github/agents/{name}.agent.md` | `name`, `description`, `argument-hint`, plus the source's `copilot:` block |
263
+ | Cursor | — | Cursor has no destination for agents; the target is skipped |
257
264
 
258
265
  This is the same layout the `ai-tools` installer writes, so an agent installed by either route is one file in one place.
259
266
 
@@ -289,12 +296,12 @@ productdock skill status
289
296
  productdock agent status
290
297
  ```
291
298
 
292
- | Subcommand | Description |
293
- | ----------------------- | ------------------------------------------------------------------------------- |
294
- | `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
295
- | `install <name>` | Install into every target derived from `productdock.json`. `--version <version>`. Refuses if it already exists on disk unless `--force` |
296
- | `update [name]` | Update one, or every installed item. Up-to-date and locally modified items are skipped unless `--force` |
297
- | `status` | Report `up to date` / `outdated` / `modified` per installed item |
299
+ | Subcommand | Description |
300
+ | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
301
+ | `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
302
+ | `install <name>` | Install into every target derived from `productdock.json`. `--version <version>`. Refuses if it already exists on disk unless `--force` |
303
+ | `update [name]` | Update one, or every installed item. Up-to-date and locally modified items are skipped unless `--force` |
304
+ | `status` | Report `up to date` / `outdated` / `modified` per installed item |
298
305
 
299
306
  `status` compares a SHA256 fingerprint of the installed directory against the versions the registry knows about:
300
307
 
@@ -309,9 +316,9 @@ productdock agent status
309
316
 
310
317
  ### `productdock wi` — work items
311
318
 
312
- Six operations over the work items of a project, served by the
313
- `/cli/work-items/*` endpoints of the ProductDock API. Four of them read
314
- (`list`, `prd`, `spec-context`, `bugs`); two of them write to the work item —
319
+ Seven operations over the work items of a project, served by the
320
+ `/cli/work-items/*` endpoints of the ProductDock API. Five of them read
321
+ (`list`, `prd`, `spec-context`, `bugs`, `prototypes`); two of them write to the work item —
315
322
  `comment` posts a comment, `evidence` uploads a QA screenshot. Each has its own
316
323
  subsection below.
317
324
 
@@ -344,19 +351,19 @@ productdock wi spec-context PROD-168 --json --out spec-context.json
344
351
 
345
352
  ##### Parameters
346
353
 
347
- | Subcommand | Argument | Options |
348
- | -------------------- | -------- | -------------------------------------------------------------------------------------------------- |
349
- | `list` | — | `--status <status>` · `--search <term>` · `--repository-name <name>` · `--out <file>` |
350
- | `prd <ref>` | `<ref>` | `--out <file>` |
351
- | `spec-context <ref>` | `<ref>` | `--out <file>` |
354
+ | Subcommand | Argument | Options |
355
+ | -------------------- | -------- | ------------------------------------------------------------------------------------- |
356
+ | `list` | — | `--status <status>` · `--search <term>` · `--repository-name <name>` · `--out <file>` |
357
+ | `prd <ref>` | `<ref>` | `--out <file>` |
358
+ | `spec-context <ref>` | `<ref>` | `--out <file>` |
352
359
 
353
- | Parameter | Description |
354
- | ------------------------- | ------------------------------------------------------------------------------------------------------------- |
355
- | `<ref>` | Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title. A number and a `PREFIX-N` are only resolvable with a project in scope — which the linked directory always provides |
356
- | `--status <status>` | Kanban column: `backlog`, `prd`, `specification`, `development`, `review`, `testing`, `homologation`, `production` |
357
- | `--search <term>` | Matches the work item **title OR description OR type** — one term, three columns |
358
- | `--repository-name <name>`| Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`), not silently resolved one way |
359
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
360
+ | Parameter | Description |
361
+ | -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
362
+ | `<ref>` | Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title. A number and a `PREFIX-N` are only resolvable with a project in scope — which the linked directory always provides |
363
+ | `--status <status>` | Kanban column: `backlog`, `prd`, `specification`, `development`, `review`, `testing`, `homologation`, `production` |
364
+ | `--search <term>` | Matches the work item **title OR description OR type** — one term, three columns |
365
+ | `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`), not silently resolved one way |
366
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
360
367
 
361
368
  ##### Response format
362
369
 
@@ -364,28 +371,34 @@ Under `--json`, `stdout` carries one document with the API response untouched
364
371
  under `data`:
365
372
 
366
373
  ```jsonc
367
- { "ok": true, "operation": "get_prd", "data": { /* the body below */ } }
374
+ {
375
+ "ok": true,
376
+ "operation": "get_prd",
377
+ "data": {
378
+ /* the body below */
379
+ },
380
+ }
368
381
  ```
369
382
 
370
383
  `operation` is the canonical operation name — `get_prd`, `list_work_items` or
371
384
  `get_spec_context`. Without `--json`, `stdout` stays empty and a human-readable
372
385
  summary goes to `stderr`.
373
386
 
374
- | Subcommand | `data` |
375
- | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
376
- | `prd` | `{ content, status, version, updated_at }` — the latest PRD version. A work item with no PRD returns `{ content: null, message }`, which is a **success**, not an error |
377
- | `list` | `{ project_id, work_item_prefix, repository_id, has_more, items[] }`; each item is `{ id, item_number, title, description, type, status, flow_mode, current_phase }`. Capped at 100 items — `has_more: true` says the cap was hit |
378
- | `spec-context` | `{ product_brief, product_brief_status, product_vision, domain_model, discovery_insights, non_functional_requirements, sibling_specs, skill_mode, current_state, repository_id }`. `skill_mode` is the project's Lite Mode toggle (`full` / `lite`) |
387
+ | Subcommand | `data` |
388
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
389
+ | `prd` | `{ content, status, version, updated_at }` — the latest PRD version. A work item with no PRD returns `{ content: null, message }`, which is a **success**, not an error |
390
+ | `list` | `{ project_id, work_item_prefix, repository_id, has_more, items[] }`; each item is `{ id, item_number, title, description, type, status, flow_mode, current_phase }`. Capped at 100 items — `has_more: true` says the cap was hit |
391
+ | `spec-context` | `{ product_brief, product_brief_status, product_vision, domain_model, discovery_insights, non_functional_requirements, sibling_specs, skill_mode, current_state, repository_id }`. `skill_mode` is the project's Lite Mode toggle (`full` / `lite`) |
379
392
 
380
393
  ##### Exit codes
381
394
 
382
395
  The general table above holds; this is how each condition maps to it:
383
396
 
384
- | Code | When |
385
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
386
- | `0` | The operation ran — including a work item with no PRD |
397
+ | Code | When |
398
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
399
+ | `0` | The operation ran — including a work item with no PRD |
387
400
  | `1` | Directory not linked and no `--project-id`; missing `<ref>`; `--repository-id` and `--repository-name` together; missing required scope (`400`); no access to the project (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
388
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
401
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
389
402
 
390
403
  #### `productdock wi bugs`
391
404
 
@@ -414,15 +427,15 @@ productdock wi bugs PROD-222 --json --out bugs.json
414
427
 
415
428
  ##### Parameters
416
429
 
417
- | Subcommand | Argument | Options |
418
- | ------------- | -------- | -------------------------------------- |
419
- | `bugs <ref>` | `<ref>` | `--status <status>` · `--out <file>` |
430
+ | Subcommand | Argument | Options |
431
+ | ------------ | -------- | ------------------------------------ |
432
+ | `bugs <ref>` | `<ref>` | `--status <status>` · `--out <file>` |
420
433
 
421
- | Parameter | Description |
422
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
423
- | `<ref>` | **Required.** Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
434
+ | Parameter | Description |
435
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
436
+ | `<ref>` | **Required.** Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
424
437
  | `--status <status>` | Bug status at its latest version: `open`, `resolved`, `invalid`, or `all`. Sent as-is — the CLI keeps no list of its own, and an unknown value is refused **by the server**, which names the accepted ones. Without the flag no filter is sent and the server's default (`all`) applies |
425
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
438
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
426
439
 
427
440
  ##### Response format
428
441
 
@@ -430,7 +443,13 @@ Under `--json`, `stdout` carries one document with the API response untouched
430
443
  under `data`:
431
444
 
432
445
  ```jsonc
433
- { "ok": true, "operation": "get_qa_issues", "data": { /* the body below */ } }
446
+ {
447
+ "ok": true,
448
+ "operation": "get_qa_issues",
449
+ "data": {
450
+ /* the body below */
451
+ },
452
+ }
434
453
  ```
435
454
 
436
455
  Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
@@ -438,11 +457,11 @@ per bug — id, status, severity, title — and the count of open ones.
438
457
 
439
458
  `data` is `{ summary, count, issues[] }`:
440
459
 
441
- | Field | Meaning |
442
- | ------------------ | -------------------------------------------------------------------------------------------------------------------------- |
443
- | `summary` | Bug counts by status — `{ open, resolved, invalid }` — over the bugs that came back, after `--status` |
444
- | `count` | How many bugs came back |
445
- | `issues[]` | One entry per bug id, at its latest version: `{ id, title, severity, priority, type, status, tc_ref, evidence[], body, source, repository_id, version, edited_by, created_at }`. `body` is the bug's markdown, untouched; `evidence[]` is `{ label, url? }` |
460
+ | Field | Meaning |
461
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
462
+ | `summary` | Bug counts by status — `{ open, resolved, invalid }` — over the bugs that came back, after `--status` |
463
+ | `count` | How many bugs came back |
464
+ | `issues[]` | One entry per bug id, at its latest version: `{ id, title, severity, priority, type, status, tc_ref, evidence[], body, source, repository_id, version, edited_by, created_at }`. `body` is the bug's markdown, untouched; `evidence[]` is `{ label, url? }` |
446
465
 
447
466
  A work item with no bugs returns `count: 0` and `issues: []`, which is a
448
467
  **success**, not an error.
@@ -451,11 +470,82 @@ A work item with no bugs returns `count: 0` and `issues: []`, which is a
451
470
 
452
471
  The general table above holds; this is how each condition maps to it:
453
472
 
454
- | Code | When |
455
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
456
- | `0` | The bugs were read — including a work item with no bugs |
473
+ | Code | When |
474
+ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
475
+ | `0` | The bugs were read — including a work item with no bugs |
457
476
  | `1` | Missing `<ref>`; directory not linked and no `--project-id`; unknown `--status` (`400`, refused by the server); no access to the project (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
458
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
477
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
478
+
479
+ #### `productdock wi prototypes`
480
+
481
+ Lists the prototypes registered on a work item — the links on its
482
+ **Refinement** tab (Figma, Claude Design or any other link), served by the
483
+ `/cli/work-items/prototypes` endpoint of the ProductDock API. It is the same
484
+ operation the MCP server exposes as the `get_work_item_prototypes` tool, and it
485
+ returns the same body — the CLI and the MCP call the same code on the server, so
486
+ the ordering and the author lookup are one implementation, not two.
487
+
488
+ **A prototype belongs to the work item, not to a repository.** The
489
+ `project.repository` of `productdock.json` is **not** sent, exactly as in
490
+ `wi bugs`.
491
+
492
+ ```bash
493
+ # Every prototype of the work item, oldest first
494
+ productdock wi prototypes PROD-227
495
+
496
+ # Machine-readable, saved to a file — what the workflow skill reads
497
+ productdock wi prototypes PROD-227 --json --out prototypes.json
498
+ ```
499
+
500
+ ##### Parameters
501
+
502
+ | Subcommand | Argument | Options |
503
+ | ------------------ | -------- | -------------- |
504
+ | `prototypes <ref>` | `<ref>` | `--out <file>` |
505
+
506
+ | Parameter | Description |
507
+ | -------------- | ----------------------------------------------------------------------------------------------------------------- |
508
+ | `<ref>` | **Required.** Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
509
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
510
+
511
+ ##### Response format
512
+
513
+ Under `--json`, `stdout` carries one document with the API response untouched
514
+ under `data`:
515
+
516
+ ```jsonc
517
+ {
518
+ "ok": true,
519
+ "operation": "get_work_item_prototypes",
520
+ "data": {
521
+ /* the body below */
522
+ },
523
+ }
524
+ ```
525
+
526
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
527
+ per prototype — tool, name, URL.
528
+
529
+ `data` is `{ work_item_id, count, prototypes[] }`:
530
+
531
+ | Field | Meaning |
532
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
533
+ | `work_item_id` | The work item the reference resolved to |
534
+ | `count` | How many prototypes came back — always `prototypes.length` |
535
+ | `prototypes[]` | In order of creation, oldest first: `{ id, url, name, tool, created_by, author_name, created_at, updated_at }`. `tool` is `figma`, `claude_design` or `link`; `author_name` is the author's full name, or their e-mail when there is none. `created_by` and `author_name` may be `null` |
536
+
537
+ A work item with no prototypes returns `count: 0` and `prototypes: []`, which
538
+ is a **success**, not an error.
539
+
540
+ ##### Exit codes
541
+
542
+ The general table above holds; this is how each condition maps to it:
543
+
544
+ | Code | When |
545
+ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
546
+ | `0` | The prototypes were read — including a work item with no prototypes |
547
+ | `1` | Missing `<ref>`; directory not linked and no `--project-id`; missing reference (`400`); no access to the project (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
548
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
459
549
 
460
550
  #### `productdock wi comment`
461
551
 
@@ -487,17 +577,17 @@ productdock wi comment qa-summary.md --ref PROD-168 \
487
577
 
488
578
  ##### Parameters
489
579
 
490
- | Subcommand | Argument | Options |
491
- | ------------------ | -------- | -------------------------------------------------- |
492
- | `comment [file]` | `[file]` | `--ref` · `--content` · `--label` · `--out` |
580
+ | Subcommand | Argument | Options |
581
+ | ---------------- | -------- | ------------------------------------------- |
582
+ | `comment [file]` | `[file]` | `--ref` · `--content` · `--label` · `--out` |
493
583
 
494
- | Parameter | Description |
495
- | ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
496
- | `[file]` | Path to the comment body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional only in the sense that `--content` replaces it; passing both is refused (exit `1`), not silently resolved one way |
497
- | `--ref <ref>` | **Required.** Work item the comment belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
498
- | `--content <text>` | The comment body inline, as an alternative to the file |
499
- | `--label <label>` | Label of the agent signing the comment. Defaults to whatever the server applies — the CLI keeps no copy of that default |
500
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
584
+ | Parameter | Description |
585
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
586
+ | `[file]` | Path to the comment body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional only in the sense that `--content` replaces it; passing both is refused (exit `1`), not silently resolved one way |
587
+ | `--ref <ref>` | **Required.** Work item the comment belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
588
+ | `--content <text>` | The comment body inline, as an alternative to the file |
589
+ | `--label <label>` | Label of the agent signing the comment. Defaults to whatever the server applies — the CLI keeps no copy of that default |
590
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
501
591
 
502
592
  ##### Response format
503
593
 
@@ -505,26 +595,32 @@ Under `--json`, `stdout` carries one document with the API response untouched
505
595
  under `data`:
506
596
 
507
597
  ```jsonc
508
- { "ok": true, "operation": "post_work_item_comment", "data": { /* the body below */ } }
598
+ {
599
+ "ok": true,
600
+ "operation": "post_work_item_comment",
601
+ "data": {
602
+ /* the body below */
603
+ },
604
+ }
509
605
  ```
510
606
 
511
607
  Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
512
608
 
513
- | Field | Meaning |
514
- | -------------- | ---------------------------------------------------------------------------- |
515
- | `success` | Always `true` on a `0` exit — the comment was written |
516
- | `comment_id` | Id of the comment just created |
517
- | `work_item_id` | The work item it landed on, resolved server-side from `--ref` |
609
+ | Field | Meaning |
610
+ | -------------- | ------------------------------------------------------------- |
611
+ | `success` | Always `true` on a `0` exit — the comment was written |
612
+ | `comment_id` | Id of the comment just created |
613
+ | `work_item_id` | The work item it landed on, resolved server-side from `--ref` |
518
614
 
519
615
  ##### Exit codes
520
616
 
521
617
  The general table above holds; this is how each condition maps to it:
522
618
 
523
- | Code | When |
524
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
525
- | `0` | The comment was written |
619
+ | Code | When |
620
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
621
+ | `0` | The comment was written |
526
622
  | `1` | Missing `--ref`; no body (no file and no `--content`); file and `--content` together; unreadable file; directory not linked and no `--project-id`; empty body (`400`); no permission to edit work items (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
527
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
623
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
528
624
 
529
625
  #### `productdock wi evidence`
530
626
 
@@ -538,7 +634,7 @@ difference is the point of the command.
538
634
  Over MCP the tool cannot see your filesystem, so it returns a `signed_url` per
539
635
  filename and instructs the caller to `PUT` the bytes to Storage itself: the
540
636
  second half happens outside the contract, and the server never sees the file —
541
- the MIME and the size it checks are the ones you *declared*. Here the file goes
637
+ the MIME and the size it checks are the ones you _declared_. Here the file goes
542
638
  up in a single call, and MIME and size are revalidated **on the bytes that
543
639
  arrived**. Anything that is not a PNG, JPEG, GIF or WEBP is refused, as is
544
640
  anything over 10 MB.
@@ -572,15 +668,15 @@ done
572
668
 
573
669
  ##### Parameters
574
670
 
575
- | Subcommand | Argument | Options |
576
- | -------------------- | -------- | -------------------- |
577
- | `evidence <file>` | `<file>` | `--ref` · `--out` |
671
+ | Subcommand | Argument | Options |
672
+ | ----------------- | -------- | ----------------- |
673
+ | `evidence <file>` | `<file>` | `--ref` · `--out` |
578
674
 
579
- | Parameter | Description |
580
- | ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
581
- | `<file>` | **Required.** Path to the screenshot on disk. The bytes are sent as `multipart/form-data`, unchanged. The name on your disk becomes the readable tail of the path in the bucket, sanitised server-side; it has no bearing on *where* the object lands |
582
- | `--ref <ref>` | **Required.** Work item the evidence belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
583
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
675
+ | Parameter | Description |
676
+ | -------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
677
+ | `<file>` | **Required.** Path to the screenshot on disk. The bytes are sent as `multipart/form-data`, unchanged. The name on your disk becomes the readable tail of the path in the bucket, sanitised server-side; it has no bearing on _where_ the object lands |
678
+ | `--ref <ref>` | **Required.** Work item the evidence belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
679
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
584
680
 
585
681
  The work item and the project travel as **query parameters**, not as form
586
682
  fields. That is not a preference: on the server, guards run before the multipart
@@ -593,13 +689,19 @@ Under `--json`, `stdout` carries one document with the API response untouched
593
689
  under `data`:
594
690
 
595
691
  ```jsonc
596
- { "ok": true, "operation": "upload_qa_evidence", "data": { /* the body below */ } }
692
+ {
693
+ "ok": true,
694
+ "operation": "upload_qa_evidence",
695
+ "data": {
696
+ /* the body below */
697
+ },
698
+ }
597
699
  ```
598
700
 
599
701
  Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
600
702
 
601
- | Field | Meaning |
602
- | -------------- | ----------------------------------------------------------------------------------------------------------------- |
703
+ | Field | Meaning |
704
+ | -------------- | -------------------------------------------------------------------------------------------------------------- |
603
705
  | `success` | Always `true` on a `0` exit — the object was written |
604
706
  | `bucket` | `qa-evidence` — the private bucket, the same one the portal and the IDE write to |
605
707
  | `path` | Path of the object, **derived server-side**. This is the value that goes in `evidence[].url` of `qa-result/v1` |
@@ -612,11 +714,11 @@ Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
612
714
 
613
715
  The general table above holds; this is how each condition maps to it:
614
716
 
615
- | Code | When |
616
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
617
- | `0` | The evidence was stored |
717
+ | Code | When |
718
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
719
+ | `0` | The evidence was stored |
618
720
  | `1` | Missing `<file>` or `--ref`; unreadable file; directory not linked and no `--project-id`; **file type not accepted (`400` `unsupported_file_type`)**; **file over 10 MB (`400` `file_too_large`, or `413` when the request itself is cut short)**; empty file (`400` `empty_file`); no file received (`400` `file_required`); no permission to edit work items (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
619
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
721
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
620
722
 
621
723
  ### `productdock code` — reading the repository and its code
622
724
 
@@ -649,17 +751,17 @@ documented once at the top of this section.
649
751
 
650
752
  #### Parameters
651
753
 
652
- | Subcommand | Argument | Options |
653
- | ------------------ | ------------- | --------------------------------------------- |
654
- | `map` | — | `--out <file>` |
655
- | `search <query>` | `<query>` | `--top-k <n>` · `--out <file>` |
754
+ | Subcommand | Argument | Options |
755
+ | ---------------- | --------- | ------------------------------ |
756
+ | `map` | — | `--out <file>` |
757
+ | `search <query>` | `<query>` | `--top-k <n>` · `--out <file>` |
656
758
 
657
- | Parameter | Description |
658
- | ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
659
- | `<query>` | What to look for, in natural language. It is embedded and matched server-side against the indexed code |
759
+ | Parameter | Description |
760
+ | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
761
+ | `<query>` | What to look for, in natural language. It is embedded and matched server-side against the indexed code |
660
762
  | `--repository-id <uuid>` | Narrows the operation to one repository **of the project in scope**. Unlike `wi list`, the `project.repository` of `productdock.json` is **not** applied by default: narrowing a map or a search without being asked hides results, and a hidden result is the one nobody notices. An id from another project returns an empty set, exactly as it does over MCP |
661
- | `--top-k <n>` | How many snippets to return — a positive integer. The server caps it (50) and defaults to 10. A non-numeric value is refused (exit `1`), never silently ignored |
662
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
763
+ | `--top-k <n>` | How many snippets to return — a positive integer. The server caps it (50) and defaults to 10. A non-numeric value is refused (exit `1`), never silently ignored |
764
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
663
765
 
664
766
  #### Response format
665
767
 
@@ -667,27 +769,33 @@ Under `--json`, `stdout` carries one document with the API response untouched
667
769
  under `data`:
668
770
 
669
771
  ```jsonc
670
- { "ok": true, "operation": "search_code", "data": { /* the body below */ } }
772
+ {
773
+ "ok": true,
774
+ "operation": "search_code",
775
+ "data": {
776
+ /* the body below */
777
+ },
778
+ }
671
779
  ```
672
780
 
673
781
  `operation` is the canonical operation name — `get_repo_map` or `search_code`.
674
782
  Without `--json`, `stdout` stays empty and a human-readable summary goes to
675
783
  `stderr`.
676
784
 
677
- | Subcommand | `data` |
678
- | ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
785
+ | Subcommand | `data` |
786
+ | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
679
787
  | `map` | `{ repositories[] }`; each entry is `{ repository_id, repository_name, default_branch, indexed, summaries_pending, entry_points[], file_map[], total_files, total_chunks, last_indexed_at }`. `file_map` is capped at 200 files. A repository that was never indexed comes back with `indexed: false` — a **success**, not an error |
680
- | `search` | `{ results[] }`; each hit is `{ file_path, repository_id, repository_name, content, language, similarity }` — the snippet plus where it came from. `content` is truncated at 1500 characters. Nothing indexed for the scope means `results: []`, which is also a success |
788
+ | `search` | `{ results[] }`; each hit is `{ file_path, repository_id, repository_name, content, language, similarity }` — the snippet plus where it came from. `content` is truncated at 1500 characters. Nothing indexed for the scope means `results: []`, which is also a success |
681
789
 
682
790
  #### Exit codes
683
791
 
684
792
  The general table above holds; this is how each condition maps to it:
685
793
 
686
- | Code | When |
687
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
688
- | `0` | The operation ran — including an empty map and an empty result set |
794
+ | Code | When |
795
+ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
796
+ | `0` | The operation ran — including an empty map and an empty result set |
689
797
  | `1` | Directory not linked and no `--project-id`; missing `<query>`; non-numeric `--top-k`; missing required scope (`400`); no access to the project — or to **any** of the projects owning the repositories asked for (`403`); any other API failure |
690
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
798
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
691
799
 
692
800
  ### `productdock artifact` — writing SDLC phase artifacts
693
801
 
@@ -744,23 +852,23 @@ documented once at the top of this section.
744
852
 
745
853
  ##### Parameters
746
854
 
747
- | Subcommand | Argument | Options |
748
- | ------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
749
- | `submit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--mode` · `--patch` · `--status` · `--dry-run` · `--repository-name` · `--out` |
750
-
751
- | Parameter | Description |
752
- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
753
- | `[file]` | Path to the artifact body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional: replaced by `--content`, and not needed at all under `--mode patch`. Passing both the file and `--content` is refused (exit `1`), not silently resolved one way |
754
- | `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
755
- | `--phase <phase>` | **Required.** SDLC phase of the artifact — e.g. `specify`, `design`, `tasks`, `test-design`, `qa-run`. The CLI keeps no list of its own: whatever the server accepts, the command sends |
756
- | `--type <type>` | **Required.** Artifact type — e.g. `spec`, `design`, `tasks`, `qa-plan`, `qa-result`, `qa-issue`. Same rule as `--phase` |
757
- | `--content <text>` | The artifact body inline, as an alternative to the file |
758
- | `--mode <full\|patch>` | `full` (default) sends the whole artifact; `patch` sends only the entries that changed. Any other value is refused (exit `1`) before any network call |
759
- | `--patch <json>` | Required under `--mode patch`, and only there: a JSON object with the entries to reconcile by key — tasks by `id`, `qa-result` test cases by `tc_ref`, gates by `name`, coverage by `criterion`, scalars under `set`. Malformed JSON fails locally, naming the flag. Passing it without `--mode patch` is refused (exit `1`) rather than ignored: an ignored patch would silently become a full submission |
760
- | `--status <done\|skip>` | `done` (default) records a real artifact; `skip` records a phase that was deliberately skipped |
855
+ | Subcommand | Argument | Options |
856
+ | --------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------ |
857
+ | `submit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--mode` · `--patch` · `--status` · `--dry-run` · `--repository-name` · `--out` |
858
+
859
+ | Parameter | Description |
860
+ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
861
+ | `[file]` | Path to the artifact body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional: replaced by `--content`, and not needed at all under `--mode patch`. Passing both the file and `--content` is refused (exit `1`), not silently resolved one way |
862
+ | `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
863
+ | `--phase <phase>` | **Required.** SDLC phase of the artifact — e.g. `specify`, `design`, `tasks`, `test-design`, `qa-run`. The CLI keeps no list of its own: whatever the server accepts, the command sends |
864
+ | `--type <type>` | **Required.** Artifact type — e.g. `spec`, `design`, `tasks`, `qa-plan`, `qa-result`, `qa-issue`. Same rule as `--phase` |
865
+ | `--content <text>` | The artifact body inline, as an alternative to the file |
866
+ | `--mode <full\|patch>` | `full` (default) sends the whole artifact; `patch` sends only the entries that changed. Any other value is refused (exit `1`) before any network call |
867
+ | `--patch <json>` | Required under `--mode patch`, and only there: a JSON object with the entries to reconcile by key — tasks by `id`, `qa-result` test cases by `tc_ref`, gates by `name`, coverage by `criterion`, scalars under `set`. Malformed JSON fails locally, naming the flag. Passing it without `--mode patch` is refused (exit `1`) rather than ignored: an ignored patch would silently become a full submission |
868
+ | `--status <done\|skip>` | `done` (default) records a real artifact; `skip` records a phase that was deliberately skipped |
761
869
  | `--dry-run` | Runs the whole server-side validation — envelope, patch merge, `BUG-N` collision — and writes **no version**. It exists because every submission creates a new version: resending "to see if it works now" was recorded in the work item's history as if it were work, and there is no way to clean it up. The response carries `dry_run: true` and `would_write_version` instead of `artifact_id`/`version` |
762
- | `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`). The repository is part of the artifact's lineage, so picking the wrong one writes a version nobody is reading |
763
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
870
+ | `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`). The repository is part of the artifact's lineage, so picking the wrong one writes a version nobody is reading |
871
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
764
872
 
765
873
  ##### Response format
766
874
 
@@ -768,32 +876,38 @@ Under `--json`, `stdout` carries one document with the API response untouched
768
876
  under `data`:
769
877
 
770
878
  ```jsonc
771
- { "ok": true, "operation": "submit_artifact", "data": { /* the body below */ } }
879
+ {
880
+ "ok": true,
881
+ "operation": "submit_artifact",
882
+ "data": {
883
+ /* the body below */
884
+ },
885
+ }
772
886
  ```
773
887
 
774
888
  Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
775
889
 
776
- | Field | Meaning |
777
- | ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
778
- | `success` | Always `true` on a `0` exit. It says the call was accepted — **not** that the JSON envelope inside the body was read; for that, see `patched` |
779
- | `artifact_id` | Id of the version just written. It is a **new id on every submission**: the artifact's identity is (work item + phase + type), and each submission is one more version of that lineage |
780
- | `version` | Version number within the lineage, starting at 1. It never collides: concurrent submissions retry server-side |
781
- | `phase_advanced_to` | The phase the work item moved to, or `null`. Submitting an artifact does not advance a phase by itself |
782
- | `repository_id` | Repository the version was recorded under, or `null` for artifacts whose scope is the whole work item (`prd`, and anything in the `define` phase) |
783
- | `repository_name` | Reserved; currently `null` |
784
- | `patched` | **Only under `--mode patch`:** which keys the merge actually matched or appended. It is the proof that the envelope was read and the patch landed where it was meant to |
785
- | `parsed` | **Only for `--type tasks`, in both modes:** the task ids the server read inside the `tasks/v1` envelope. Same job as `patched` — it answers "did the server *interpret* my body?", which `success: true` cannot |
786
- | `dry_run` | **Only under `--dry-run`:** `true`, alongside `would_write_version`. Nothing was written |
890
+ | Field | Meaning |
891
+ | ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
892
+ | `success` | Always `true` on a `0` exit. It says the call was accepted — **not** that the JSON envelope inside the body was read; for that, see `patched` |
893
+ | `artifact_id` | Id of the version just written. It is a **new id on every submission**: the artifact's identity is (work item + phase + type), and each submission is one more version of that lineage |
894
+ | `version` | Version number within the lineage, starting at 1. It never collides: concurrent submissions retry server-side |
895
+ | `phase_advanced_to` | The phase the work item moved to, or `null`. Submitting an artifact does not advance a phase by itself |
896
+ | `repository_id` | Repository the version was recorded under, or `null` for artifacts whose scope is the whole work item (`prd`, and anything in the `define` phase) |
897
+ | `repository_name` | Reserved; currently `null` |
898
+ | `patched` | **Only under `--mode patch`:** which keys the merge actually matched or appended. It is the proof that the envelope was read and the patch landed where it was meant to |
899
+ | `parsed` | **Only for `--type tasks`, in both modes:** the task ids the server read inside the `tasks/v1` envelope. Same job as `patched` — it answers "did the server _interpret_ my body?", which `success: true` cannot |
900
+ | `dry_run` | **Only under `--dry-run`:** `true`, alongside `would_write_version`. Nothing was written |
787
901
 
788
902
  ##### Exit codes
789
903
 
790
904
  The general table above holds; this is how each condition maps to it:
791
905
 
792
- | Code | When |
793
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
794
- | `0` | The version was written |
906
+ | Code | When |
907
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
908
+ | `0` | The version was written |
795
909
  | `1` | Missing `--ref`, `--phase` or `--type`; no body in `--mode full`; file and `--content` together; unreadable file; `--mode` outside `full\|patch`; `--mode patch` without `--patch`, or with malformed `--patch`; `--patch` without `--mode patch`; `--repository-id` and `--repository-name` together; directory not linked and no `--project-id`; **invalid envelope (`400`) — the response names the offending field, and nothing was written**; no permission to edit work items (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
796
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
910
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
797
911
 
798
912
  #### `productdock artifact commit`
799
913
 
@@ -842,20 +956,20 @@ documented once at the top of this section.
842
956
 
843
957
  ##### Parameters
844
958
 
845
- | Subcommand | Argument | Options |
846
- | ------------------ | ------------ | --------------------------------------------------------------------------------------------- |
847
- | `commit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--branch` · `--repository-name` · `--out` |
959
+ | Subcommand | Argument | Options |
960
+ | --------------- | -------- | ----------------------------------------------------------------------------------------- |
961
+ | `commit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--branch` · `--repository-name` · `--out` |
848
962
 
849
- | Parameter | Description |
850
- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
963
+ | Parameter | Description |
964
+ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
851
965
  | `[file]` | Path to the artifact body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional: replaced by `--content`. Passing both the file and `--content` is refused (exit `1`), not silently resolved one way. **It has no bearing on where the file lands in the repository** |
852
- | `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
853
- | `--phase <phase>` | **Required.** SDLC phase of the artifact — e.g. `specify`, `design`, `tasks`, `qa-run`. The CLI keeps no list of its own: whatever the server accepts, the command sends |
854
- | `--type <type>` | **Required.** Artifact type — e.g. `spec`, `design`, `tasks`, `plan`, `qa-report`. It decides the filename: `plan` → `plan.md`, `qa-report` → `qa-run.md`, anything else → `{type}.md` |
855
- | `--content <text>` | The artifact body inline, as an alternative to the file |
856
- | `--branch <branch>` | Branch of the commit. Defaults to the repository's default branch; a branch that does not exist yet is created from the default one, server-side |
857
- | `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`) |
858
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
966
+ | `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
967
+ | `--phase <phase>` | **Required.** SDLC phase of the artifact — e.g. `specify`, `design`, `tasks`, `qa-run`. The CLI keeps no list of its own: whatever the server accepts, the command sends |
968
+ | `--type <type>` | **Required.** Artifact type — e.g. `spec`, `design`, `tasks`, `plan`, `qa-report`. It decides the filename: `plan` → `plan.md`, `qa-report` → `qa-run.md`, anything else → `{type}.md` |
969
+ | `--content <text>` | The artifact body inline, as an alternative to the file |
970
+ | `--branch <branch>` | Branch of the commit. Defaults to the repository's default branch; a branch that does not exist yet is created from the default one, server-side |
971
+ | `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`) |
972
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
859
973
 
860
974
  ##### Response format
861
975
 
@@ -863,27 +977,33 @@ Under `--json`, `stdout` carries one document with the API response untouched
863
977
  under `data`:
864
978
 
865
979
  ```jsonc
866
- { "ok": true, "operation": "commit_artifact", "data": { /* the body below */ } }
980
+ {
981
+ "ok": true,
982
+ "operation": "commit_artifact",
983
+ "data": {
984
+ /* the body below */
985
+ },
986
+ }
867
987
  ```
868
988
 
869
989
  Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
870
990
 
871
- | Field | Meaning |
872
- | ----------- | ------------------------------------------------------------------------------------------------------------ |
873
- | `success` | Always `true` on a `0` exit — the push was applied |
874
- | `path` | Path the artifact was written to, **derived server-side** from the work item |
875
- | `branch` | Branch the commit landed on — the one you asked for, or the repository default |
876
- | `commit_id` | SHA of the commit, or `null` when Azure DevOps returned no commit for the push |
991
+ | Field | Meaning |
992
+ | ----------- | ------------------------------------------------------------------------------ |
993
+ | `success` | Always `true` on a `0` exit — the push was applied |
994
+ | `path` | Path the artifact was written to, **derived server-side** from the work item |
995
+ | `branch` | Branch the commit landed on — the one you asked for, or the repository default |
996
+ | `commit_id` | SHA of the commit, or `null` when Azure DevOps returned no commit for the push |
877
997
 
878
998
  ##### Exit codes
879
999
 
880
1000
  The general table above holds; this is how each condition maps to it:
881
1001
 
882
- | Code | When |
883
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
884
- | `0` | The commit was pushed |
1002
+ | Code | When |
1003
+ | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1004
+ | `0` | The commit was pushed |
885
1005
  | `1` | Missing `--ref`, `--phase` or `--type`; no body (no file and no `--content`); file and `--content` together; unreadable file; `--repository-id` and `--repository-name` together; directory not linked and no `--project-id`; **linked directory with no repository, and no `--repository-name`** — the target is mandatory; missing required scope (`400`); work item outside the project in scope (`400`); repository not found in the project (`400`); **your Microsoft connection needs to be re-established (`409` `azure_reconnect_required`) — reconnect the account in ProductDock and run the command again**; no permission to edit work items (`403`); no access to the project (`403`); any other API failure |
886
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
1006
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
887
1007
 
888
1008
  ### `productdock prd-review` — the PRD critical review
889
1009
 
@@ -924,19 +1044,19 @@ documented once at the top of this section.
924
1044
 
925
1045
  #### Parameters
926
1046
 
927
- | Subcommand | Argument | Options |
928
- | ----------------- | -------- | -------------------------------------------------------------- |
929
- | `get <ref>` | `<ref>` | `--status <status>` · `--limit <n>` · `--out <file>` |
930
- | `submit [file]` | `[file]` | `--ref` · `--content` · `--out` |
1047
+ | Subcommand | Argument | Options |
1048
+ | --------------- | -------- | ---------------------------------------------------- |
1049
+ | `get <ref>` | `<ref>` | `--status <status>` · `--limit <n>` · `--out <file>` |
1050
+ | `submit [file]` | `[file]` | `--ref` · `--content` · `--out` |
931
1051
 
932
- | Parameter | Description |
933
- | -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
934
- | `<ref>` / `--ref` | **Required.** Work item under review, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title. It is the positional argument of `get` and the `--ref` flag of `submit`, so the two can never be swapped by accident |
935
- | `--status <status>` | Thread status filter: `open`, `resolved`, `ignored`, `superseded`, or `all` (the default). The CLI keeps no list of its own — an unknown value is refused **by the server**, which names the accepted ones |
936
- | `--limit <n>` | Cap on how many threads come back, most recent first — a positive integer. The server defaults to 50 and caps at 200. A non-numeric value is refused locally (exit `1`), never silently ignored |
937
- | `[file]` | Path to the review body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. The fenced JSON block with the `prd-review/v1` envelope, at the top of it, is **mandatory** — a body without it is refused by the server. Optional only in the sense that `--content` replaces it; passing both is refused (exit `1`), not silently resolved one way |
938
- | `--content <text>` | The review body inline, as an alternative to the file |
939
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1052
+ | Parameter | Description |
1053
+ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1054
+ | `<ref>` / `--ref` | **Required.** Work item under review, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title. It is the positional argument of `get` and the `--ref` flag of `submit`, so the two can never be swapped by accident |
1055
+ | `--status <status>` | Thread status filter: `open`, `resolved`, `ignored`, `superseded`, or `all` (the default). The CLI keeps no list of its own — an unknown value is refused **by the server**, which names the accepted ones |
1056
+ | `--limit <n>` | Cap on how many threads come back, most recent first — a positive integer. The server defaults to 50 and caps at 200. A non-numeric value is refused locally (exit `1`), never silently ignored |
1057
+ | `[file]` | Path to the review body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. The fenced JSON block with the `prd-review/v1` envelope, at the top of it, is **mandatory** — a body without it is refused by the server. Optional only in the sense that `--content` replaces it; passing both is refused (exit `1`), not silently resolved one way |
1058
+ | `--content <text>` | The review body inline, as an alternative to the file |
1059
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
940
1060
 
941
1061
  #### Response format
942
1062
 
@@ -944,7 +1064,13 @@ Under `--json`, `stdout` carries one document with the API response untouched
944
1064
  under `data`:
945
1065
 
946
1066
  ```jsonc
947
- { "ok": true, "operation": "get_prd_review", "data": { /* the body below */ } }
1067
+ {
1068
+ "ok": true,
1069
+ "operation": "get_prd_review",
1070
+ "data": {
1071
+ /* the body below */
1072
+ },
1073
+ }
948
1074
  ```
949
1075
 
950
1076
  `operation` is the canonical operation name — `get_prd_review` or
@@ -953,39 +1079,39 @@ summary goes to `stderr`.
953
1079
 
954
1080
  `get` returns `{ work_item_id, brief_version, summary, count, threads[] }`:
955
1081
 
956
- | Field | Meaning |
957
- | --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
958
- | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded }`. **`summary.open` is the number to check before composing the next round** |
959
- | `count` | How many threads came back — after `--status` and `--limit` |
960
- | `threads[].finding_key` | The stable correlation key of the finding **across rounds**. Reusing it in the next round updates the existing thread instead of creating a new one; `null` on human threads and on threads created before the key existed |
961
- | `threads[].status` | `open`, `resolved`, `ignored` or `superseded`. A finding whose thread is `resolved` or `ignored` must not be re-emitted — the PM already closed it |
962
- | `threads[].reply_count` · `has_human_reply` | How many replies came after the agent's root message, and whether **any of them is human**. `has_human_reply: true` is the signal that a person answered this finding |
963
- | `threads[].messages[]` | The whole conversation, authors already hydrated (`author`, `source`, `text`). Human messages arrive as plain text — the stored HTML is converted server-side |
964
- | `threads[].outdated` | `true` when the thread is anchored to a PRD version older than the current one |
965
- | `brief_version` | The current PRD version the review is being read against |
1082
+ | Field | Meaning |
1083
+ | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1084
+ | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded }`. **`summary.open` is the number to check before composing the next round** |
1085
+ | `count` | How many threads came back — after `--status` and `--limit` |
1086
+ | `threads[].finding_key` | The stable correlation key of the finding **across rounds**. Reusing it in the next round updates the existing thread instead of creating a new one; `null` on human threads and on threads created before the key existed |
1087
+ | `threads[].status` | `open`, `resolved`, `ignored` or `superseded`. A finding whose thread is `resolved` or `ignored` must not be re-emitted — the PM already closed it |
1088
+ | `threads[].reply_count` · `has_human_reply` | How many replies came after the agent's root message, and whether **any of them is human**. `has_human_reply: true` is the signal that a person answered this finding |
1089
+ | `threads[].messages[]` | The whole conversation, authors already hydrated (`author`, `source`, `text`). Human messages arrive as plain text — the stored HTML is converted server-side |
1090
+ | `threads[].outdated` | `true` when the thread is anchored to a PRD version older than the current one |
1091
+ | `brief_version` | The current PRD version the review is being read against |
966
1092
 
967
1093
  `submit` returns the round's outcome — this is what decides the next round:
968
1094
 
969
- | Field | Meaning |
970
- | ------------------------ | ------------------------------------------------------------------------------------------------------------------ |
971
- | `success` | Always `true` on a `0` exit. It says the round was accepted — **not** that anything was posted; see the counters below |
972
- | `review_round` | Number of this round. It equals the artifact version of the envelope snapshot |
973
- | `threads_created` | Findings that had no live thread — a new thread each |
974
- | `threads_updated` | Findings matched to an **open** thread by `finding_key`: the round was appended and the PM's reply survived |
975
- | `threads_skipped_closed` | Findings the PM had already **resolved or ignored**. Nothing was posted for them, and they were not reopened — this is a normal, successful outcome |
976
- | `threads_superseded` | Threads that were open and did **not** come back in this round: the review considered them settled |
977
- | `tech_review` | The badge written on the PRD: `none` (a clean review), `changes_requested_gaps` or `changes_requested_blocking` |
978
- | `artifact_id` · `artifact_version` | The snapshot of the raw envelope kept as a phase artifact |
1095
+ | Field | Meaning |
1096
+ | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- |
1097
+ | `success` | Always `true` on a `0` exit. It says the round was accepted — **not** that anything was posted; see the counters below |
1098
+ | `review_round` | Number of this round. It equals the artifact version of the envelope snapshot |
1099
+ | `threads_created` | Findings that had no live thread — a new thread each |
1100
+ | `threads_updated` | Findings matched to an **open** thread by `finding_key`: the round was appended and the PM's reply survived |
1101
+ | `threads_skipped_closed` | Findings the PM had already **resolved or ignored**. Nothing was posted for them, and they were not reopened — this is a normal, successful outcome |
1102
+ | `threads_superseded` | Threads that were open and did **not** come back in this round: the review considered them settled |
1103
+ | `tech_review` | The badge written on the PRD: `none` (a clean review), `changes_requested_gaps` or `changes_requested_blocking` |
1104
+ | `artifact_id` · `artifact_version` | The snapshot of the raw envelope kept as a phase artifact |
979
1105
 
980
1106
  #### Exit codes
981
1107
 
982
1108
  The general table above holds; this is how each condition maps to it:
983
1109
 
984
- | Code | When |
985
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
986
- | `0` | The read-back ran — including a work item with no review at all — or the round was recorded, **including a round that posted nothing because every finding was already closed** |
1110
+ | Code | When |
1111
+ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1112
+ | `0` | The read-back ran — including a work item with no review at all — or the round was recorded, **including a round that posted nothing because every finding was already closed** |
987
1113
  | `1` | Missing `<ref>`/`--ref`; non-numeric `--limit`; unknown `--status` (`400`, refused by the server); no body (no file and no `--content`); file and `--content` together; unreadable file; directory not linked and no `--project-id`; **invalid envelope (`400`) — the response names the offending field, and nothing was written**; no permission to edit work items (`403`, `submit` only); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
988
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
1114
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
989
1115
 
990
1116
  ### `productdock eval` — project evaluations
991
1117
 
@@ -1030,15 +1156,15 @@ top of this section.
1030
1156
 
1031
1157
  #### Parameters
1032
1158
 
1033
- | Subcommand | Argument | Options |
1034
- | ----------------- | ------------ | ----------------------------------------------- |
1035
- | `submit <file>` | `<file>` | `--repository-name` · `--out` |
1159
+ | Subcommand | Argument | Options |
1160
+ | --------------- | -------- | ----------------------------- |
1161
+ | `submit <file>` | `<file>` | `--repository-name` · `--out` |
1036
1162
 
1037
- | Parameter | Description |
1038
- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1163
+ | Parameter | Description |
1164
+ | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1039
1165
  | `<file>` | **Required.** Path to the eval envelope on disk — the `latest.json` the eval skill writes. Read as UTF-8 and parsed locally: it must be a JSON **object** (`schema_version` 1.0). Malformed JSON, an array or a scalar fails locally (exit `1`) without a network call; everything inside the object is validated by the server |
1040
- | `--repository-name <name>` | Label of the evaluated repository, used only when the envelope carries no `target.repositories`. There is no repository *id* in this operation: the evaluation is project-level, so `--repository-id` and the `project.repository` of `productdock.json` are not sent |
1041
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1166
+ | `--repository-name <name>` | Label of the evaluated repository, used only when the envelope carries no `target.repositories`. There is no repository _id_ in this operation: the evaluation is project-level, so `--repository-id` and the `project.repository` of `productdock.json` are not sent |
1167
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1042
1168
 
1043
1169
  #### Response format
1044
1170
 
@@ -1046,27 +1172,33 @@ Under `--json`, `stdout` carries one document with the API response untouched
1046
1172
  under `data`:
1047
1173
 
1048
1174
  ```jsonc
1049
- { "ok": true, "operation": "submit_eval", "data": { /* the body below */ } }
1175
+ {
1176
+ "ok": true,
1177
+ "operation": "submit_eval",
1178
+ "data": {
1179
+ /* the body below */
1180
+ },
1181
+ }
1050
1182
  ```
1051
1183
 
1052
1184
  Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
1053
1185
 
1054
- | Field | Meaning |
1055
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
1056
- | `success` | Always `true` on a `0` exit |
1186
+ | Field | Meaning |
1187
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1188
+ | `success` | Always `true` on a `0` exit |
1057
1189
  | `evaluation_id` | Id of the evaluation row. Unlike a phase artifact, it is **stable across submissions** of the same `(project, eval_type)`: the row is replaced, not versioned |
1058
- | `project_id` | The project the evaluation was recorded under — the one the server authorized, not the one you asked for |
1059
- | `eval_type` | `security`, `observability` or `frontend_quality`, read from the envelope |
1190
+ | `project_id` | The project the evaluation was recorded under — the one the server authorized, not the one you asked for |
1191
+ | `eval_type` | `security`, `observability` or `frontend_quality`, read from the envelope |
1060
1192
 
1061
1193
  #### Exit codes
1062
1194
 
1063
1195
  The general table above holds; this is how each condition maps to it:
1064
1196
 
1065
- | Code | When |
1066
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
1067
- | `0` | The evaluation was recorded |
1197
+ | Code | When |
1198
+ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1199
+ | `0` | The evaluation was recorded |
1068
1200
  | `1` | Missing `<file>`; unreadable file; the file is not a JSON object; directory not linked and no `--project-id`; **invalid envelope (`400`) — the response names the offending field, and nothing was written**; **no `project.evaluations.manage` permission (`403`)**; no access to the project (`403`); any other API failure |
1069
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
1201
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1070
1202
 
1071
1203
  ### `productdock state` — the SDLC state of a work item
1072
1204
 
@@ -1116,14 +1248,12 @@ productdock state update --ref PROD-168 --type lesson \
1116
1248
  `productdock state update --help` prints the accepted `content` fields **per
1117
1249
  `--type`**, so finding them out does not cost a probe against a real work item.
1118
1250
 
1119
-
1120
-
1121
1251
  Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
1122
1252
  documented once at the top of this section.
1123
1253
 
1124
1254
  **The repository travels with both.** The state is repo-aware: `feature_state`
1125
1255
  has one row per `(work item, repository)`, and the artifact list is filtered the
1126
- same way. The repository of `productdock.json` is sent by `phase` *and* by
1256
+ same way. The repository of `productdock.json` is sent by `phase` _and_ by
1127
1257
  `update`, so reading with one scope and writing with another — two truths for
1128
1258
  the same work item, with no error anywhere — cannot happen by accident.
1129
1259
 
@@ -1144,27 +1274,27 @@ the same work item, with no error anywhere — cannot happen by accident.
1144
1274
  and one where a decision/blocker/lesson would end up with an empty body
1145
1275
  because the text arrived under keys this operation does not read. An entry
1146
1276
  with only a title is still accepted — a short record is not a loss;
1147
- - in a `lesson`, the four fields of the skill's *Lessons Learned* template
1277
+ - in a `lesson`, the four fields of the skill's _Lessons Learned_ template
1148
1278
  (`context`, `problem`, `solution`, `prevents`) are accepted and composed into
1149
1279
  `description`. They used to be dropped in silence, leaving the lesson with
1150
1280
  nothing but its title.
1151
1281
 
1152
1282
  #### Parameters
1153
1283
 
1154
- | Subcommand | Argument | Options |
1155
- | ------------------ | ---------- | -------------------------------------------- |
1156
- | `phase <ref>` | `<ref>` | `--out` |
1157
- | `update [file]` | `[file]` | `--ref` · `--type` · `--content` · `--dry-run` · `--out` |
1158
-
1159
- | Parameter | Description |
1160
- | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
1161
- | `<ref>` | **Required** on `phase`. The work item — `PREFIX-N` (`PROD-168`), a number, a UUID or a title |
1162
- | `--ref <ref>` | **Required** on `update`. Same four formats. It is a flag, not a positional, so its order with the body file can never be swapped |
1163
- | `--type <type>` | **Required** on `update`. The kind of update: `decision`, `blocker`, `lesson`, `review`, `phase_change`, `phase_progress`, `prd_review`, `flow_change`. Sent as-is: the enum belongs to the server, which rejects what it does not know and lists the options |
1164
- | `[file]` | Path to the update body on disk. Read as UTF-8 and parsed locally: it must be a JSON **object**. Malformed JSON, an array or a scalar fails locally (exit `1`) without a network call; the keys inside are the server's business |
1165
- | `--content <json>` | The same body inline. Passing the file **and** `--content` is refused, not resolved by precedence: they are the same choice with different answers. Neither one is required — an update may have no body at all, and an empty `{}` is not invented here |
1284
+ | Subcommand | Argument | Options |
1285
+ | --------------- | -------- | -------------------------------------------------------- |
1286
+ | `phase <ref>` | `<ref>` | `--out` |
1287
+ | `update [file]` | `[file]` | `--ref` · `--type` · `--content` · `--dry-run` · `--out` |
1288
+
1289
+ | Parameter | Description |
1290
+ | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1291
+ | `<ref>` | **Required** on `phase`. The work item — `PREFIX-N` (`PROD-168`), a number, a UUID or a title |
1292
+ | `--ref <ref>` | **Required** on `update`. Same four formats. It is a flag, not a positional, so its order with the body file can never be swapped |
1293
+ | `--type <type>` | **Required** on `update`. The kind of update: `decision`, `blocker`, `lesson`, `review`, `phase_change`, `phase_progress`, `prd_review`, `flow_change`. Sent as-is: the enum belongs to the server, which rejects what it does not know and lists the options |
1294
+ | `[file]` | Path to the update body on disk. Read as UTF-8 and parsed locally: it must be a JSON **object**. Malformed JSON, an array or a scalar fails locally (exit `1`) without a network call; the keys inside are the server's business |
1295
+ | `--content <json>` | The same body inline. Passing the file **and** `--content` is refused, not resolved by precedence: they are the same choice with different answers. Neither one is required — an update may have no body at all, and an empty `{}` is not invented here |
1166
1296
  | `--dry-run` | Validates the body server-side — the same schema check, the same refusals, the same numbering — and writes **nothing**. It exists because probing the schema against a real work item created one entry per attempt, and the CLI offers no way to read or delete a decision or a lesson. The response carries `dry_run: true` and `would_apply` in place of `applied` |
1167
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1297
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1168
1298
 
1169
1299
  #### Response format
1170
1300
 
@@ -1181,44 +1311,186 @@ the `ignored_fields` warning, spelled out as "not stored".
1181
1311
 
1182
1312
  `detect_phase`:
1183
1313
 
1184
- | Field | Meaning |
1185
- | ------------------------- | ------------------------------------------------------------------------------------------------------------ |
1186
- | `feature_id` | The work item the reference resolved to |
1187
- | `status` | Kanban column (`backlog` … `production`) |
1314
+ | Field | Meaning |
1315
+ | ---------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1316
+ | `feature_id` | The work item the reference resolved to |
1317
+ | `status` | Kanban column (`backlog` … `production`) |
1188
1318
  | `current_phase`/`next_phase` | The current skill phase, and the one after it. Reconciled **monotonically** from two sources: the phase derived from the Kanban status and the one `phase_change` wrote to `feature_state` — whichever is further along wins. They used to disagree: entering `validation` (which stays in the `development` column on purpose) made this field answer `implement` while `update_state` answered `validation` |
1189
- | `artifacts_found` | Artifact types already submitted for this work item (and repository) |
1190
- | `work_item_type`/`flow_mode` | Type and **Fluxo Rápido** of the item (`full`/`fast`, only meaningful on `improvement`) |
1191
- | `uses_plan` | **Route by this**, not by recombining type and flow in prose: `true` means the Plan track (`plan.md`) |
1192
- | `mode` | **Modo Lite** of the project (`full`/`lite`) — whether Test Design runs. Not the Fluxo Rápido, and not the UI's "Modo Light"; the two vocabularies share the word `full` by accident |
1193
- | `tasks_progress` | `{ done, total, percent, parallel }` read from the latest `tasks` artifact — from the `tasks/v1` envelope, with the legacy Markdown as a fallback. `null` when there is no `tasks` artifact |
1194
- | `implementation_complete` | `true` when every task is done — or when an `implement` artifact was submitted with `--status done`, which is the only path for work items that skip the `tasks` phase |
1195
- | `open_qa_bugs` | Number of bugs still `open` in the work item's Quality tab — the platform's own and the ones the skills submitted, on any repository. `0` when there are none. Read them with [`wi bugs`](#productdock-wi-bugs) |
1196
- | `state_content` | The recorded state as an **object**: `decisions[]`, `blockers[]`, `lessons[]`, `reviews[]`. Reading a decision back used to require `wi spec-context` — a command whose name does not suggest it — and two levels of parsing |
1319
+ | `artifacts_found` | Artifact types already submitted for this work item (and repository) |
1320
+ | `work_item_type`/`flow_mode` | Type and **Fluxo Rápido** of the item (`full`/`fast`, only meaningful on `improvement`) |
1321
+ | `uses_plan` | **Route by this**, not by recombining type and flow in prose: `true` means the Plan track (`plan.md`) |
1322
+ | `mode` | **Modo Lite** of the project (`full`/`lite`) — whether Test Design runs. Not the Fluxo Rápido, and not the UI's "Modo Light"; the two vocabularies share the word `full` by accident |
1323
+ | `tasks_progress` | `{ done, total, percent, parallel }` read from the latest `tasks` artifact — from the `tasks/v1` envelope, with the legacy Markdown as a fallback. `null` when there is no `tasks` artifact |
1324
+ | `implementation_complete` | `true` when every task is done — or when an `implement` artifact was submitted with `--status done`, which is the only path for work items that skip the `tasks` phase |
1325
+ | `open_qa_bugs` | Number of bugs still `open` in the work item's Quality tab — the platform's own and the ones the skills submitted, on any repository. `0` when there are none. Read them with [`wi bugs`](#productdock-wi-bugs) |
1326
+ | `state_content` | The recorded state as an **object**: `decisions[]`, `blockers[]`, `lessons[]`, `reviews[]`. Reading a decision back used to require `wi spec-context` — a command whose name does not suggest it — and two levels of parsing |
1197
1327
 
1198
1328
  `update_state`:
1199
1329
 
1200
- | Field | Meaning |
1201
- | ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
1202
- | `success` | Always `true` on a `0` exit |
1203
- | `work_item_id` | The work item the state was written to |
1204
- | `applied` | `{ update_type, id?, phase? }` — `id` is the one **the server assigned**, the only piece of the mutation you cannot derive |
1205
- | `current_phase` | The internal phase after the update |
1206
- | `accepted_fields` | Keys of `content` the server **did** use. The positive side of `ignored_fields`: `success: true` says the call was accepted, this says the body was read |
1207
- | `ignored_fields` | Keys of `content` the server did not use. **Present means not stored** — absent means everything landed |
1208
- | `dry_run` | Only under `--dry-run`: `true`, with `would_apply` in place of `applied`. Nothing was written |
1209
- | `idempotent` | `true` when the entry already existed and was matched instead of duplicated |
1210
- | `flow_mode`/`previous_flow_mode` | Only on `flow_change` |
1211
- | `progress` | Only on `phase_progress` — the marker written to the work item (`Fase 2/6 · Sidebar`) |
1330
+ | Field | Meaning |
1331
+ | -------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
1332
+ | `success` | Always `true` on a `0` exit |
1333
+ | `work_item_id` | The work item the state was written to |
1334
+ | `applied` | `{ update_type, id?, phase? }` — `id` is the one **the server assigned**, the only piece of the mutation you cannot derive |
1335
+ | `current_phase` | The internal phase after the update |
1336
+ | `accepted_fields` | Keys of `content` the server **did** use. The positive side of `ignored_fields`: `success: true` says the call was accepted, this says the body was read |
1337
+ | `ignored_fields` | Keys of `content` the server did not use. **Present means not stored** — absent means everything landed |
1338
+ | `dry_run` | Only under `--dry-run`: `true`, with `would_apply` in place of `applied`. Nothing was written |
1339
+ | `idempotent` | `true` when the entry already existed and was matched instead of duplicated |
1340
+ | `flow_mode`/`previous_flow_mode` | Only on `flow_change` |
1341
+ | `progress` | Only on `phase_progress` — the marker written to the work item (`Fase 2/6 · Sidebar`) |
1212
1342
 
1213
1343
  #### Exit codes
1214
1344
 
1215
1345
  The general table above holds; this is how each condition maps to it:
1216
1346
 
1217
- | Code | When |
1218
- | ---- | ---------------------------------------------------------------------------------------------------------------------------- |
1219
- | `0` | The phase was read, or the state was written |
1347
+ | Code | When |
1348
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1349
+ | `0` | The phase was read, or the state was written |
1220
1350
  | `1` | Missing `<ref>`/`--ref`/`--type`; body file unreadable; body that is not a JSON object; file **and** `--content` together; directory not linked and no `--project-id`; **`flow_change` refused (`400`) — wrong type, or outside the `backlog`/`prd`/`specification` window**; **body the server could not interpret (`400`) — the message carries the schema of the `--type`, and nothing was written**; unknown `update_type` (`400`); no permission for the write (`403`); no access to the work item (`404` — the same answer as "does not exist", on purpose); any other API failure |
1221
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
1351
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1352
+
1353
+ ### `productdock watch`
1354
+
1355
+ The runner of the **PRD Tech Review**. Run it in the directory of a linked
1356
+ project and the terminal serves that project's Tech Review requests on its own:
1357
+ it takes a request, runs the two stages of the review with Claude Code in a
1358
+ disposable copy of the code, **without asking you anything**, and the request
1359
+ ends closed. The purely technical questions are left pending for the Spec, in
1360
+ the body of the review and in the work item's state. One request at a time.
1361
+
1362
+ ```bash
1363
+ # Serve the project linked to this directory
1364
+ productdock watch
1365
+
1366
+ # Only work items assigned to you, asking before each run
1367
+ productdock watch --mine --confirm
1368
+
1369
+ # Another project, polling every 30 s, machine-readable events
1370
+ productdock watch --project-id <uuid> --interval 30 --json
1371
+
1372
+ # Follow what Claude is doing in each stage, live
1373
+ productdock watch --follow
1374
+ ```
1375
+
1376
+ **One project per terminal.** The project is the one in `productdock.json`
1377
+ (looked up the way every command does) or `--project-id`. To serve two projects,
1378
+ open two terminals.
1379
+
1380
+ **It needs a terminal only for what asks.** A round asks nothing, so with the
1381
+ model already stored and without `--confirm` it runs with no TTY — `--json`
1382
+ included. Without a TTY it exits `1` at start-up in two cases: no model stored
1383
+ yet (run it once in a terminal to choose one, or write it to
1384
+ `~/.productdock/config.json`), and `--confirm` (it asks before each run). It
1385
+ also checks, before taking any request: that the directory is inside a Git
1386
+ repository, that `claude` (Claude Code) is on the `PATH`, that the
1387
+ `pd-workflow` skill is installed, and that there is a CLI session.
1388
+
1389
+ **What a round does.**
1390
+
1391
+ 1. **Claim** the oldest queued request of the project (`/cli/prd-review-jobs/claim`).
1392
+ The server decides what you may take — member of the project with permission
1393
+ to edit work items — and two runners never take the same request.
1394
+ 2. **Disposable copy** — `git worktree add --detach` of `HEAD` in the temp
1395
+ directory, with submodules initialised, and the installed `pd-workflow` skill
1396
+ copied into it (the repository's `.claude/skills/pd-workflow`, else the user's
1397
+ `~/.claude/skills/pd-workflow`). Your working tree is not touched; the copy is
1398
+ removed at the end of the round, failure included. A copy left behind by a
1399
+ runner that died — still on disk, still registered in your repository — is
1400
+ cleared when the same request is taken again, and every such leftover is
1401
+ cleared when `watch` starts; a copy that belongs to a runner still alive in
1402
+ another terminal is kept (the runner locks its copy with its process id).
1403
+ 3. **Stage A** — `claude -p` analyses the PRD against the code, following the
1404
+ skill's autonomous-mode reference. It submits nothing.
1405
+ 4. **Version check** — if the PRD changed during the round, or the request was
1406
+ cancelled, the round is **discarded**: no Stage B, nothing submitted.
1407
+ 5. **Stage B** — `claude --resume` submits the review **once**, right after the
1408
+ version check, with no pause. Submitting closes the request on the server.
1409
+
1410
+ A `runner-handoff.json` in the round's folder comes from an outdated
1411
+ (pre-release) skill: it is **ignored**, never asked, and a one-line warning says so
1412
+ ("skill desatualizada — atualize a pd-workflow"). Stage B still runs, and with
1413
+ that skill it fails the round for lack of answers — the warning is the cause.
1414
+
1415
+ While a round runs the runner sends a heartbeat every minute — the lease is 15
1416
+ minutes — and the request stays `running` throughout. A failed heartbeat or a
1417
+ network blip does not end the round. A round that fails ends the request as
1418
+ `failed`, with the cause; its files are kept and the path is printed.
1419
+
1420
+ **How Claude Code runs.** With your account and the model you chose, but with the
1421
+ project's configuration only: `--setting-sources project`,
1422
+ `--strict-mcp-config`, no web access, notebooks denied. Writing is granted **only
1423
+ in the round's folder** (passed with `--add-dir`), by an `Edit(<folder>/**)`
1424
+ rule — in Claude Code 2.1.x path rules for writing are `Edit` rules and cover
1425
+ every tool that writes a file, while a `Write(<path>)` rule never matches —
1426
+ and writing in the disposable copy of the code is denied by name, so a project
1427
+ setting cannot reopen it. Stage A may read, search, delegate to a subagent,
1428
+ write in the round's folder and run `productdock wi prd`, `wi spec-context`, `prd-review get`,
1429
+ `code search` and `code map`; Stage B adds `prd-review submit` and
1430
+ `state update`. There is no spending cap: the run uses your Claude Code quota,
1431
+ like any request made in the IDE. The `productdock` calls Claude makes reuse your
1432
+ session through `PRODUCTDOCK_CONFIG_DIR`, set by the runner — your `HOME` is not
1433
+ changed.
1434
+
1435
+ **The model.** On the first run the command asks which Claude Code model to use,
1436
+ suggesting the default of the installed Claude Code when it can read one
1437
+ (`ANTHROPIC_MODEL`, or `model` in the Claude Code `settings.json` under
1438
+ `CLAUDE_CONFIG_DIR` or `~/.claude`), and stores the answer in
1439
+ `~/.productdock/config.json` (`{ "watch": { "model": "…" } }`). Edit or delete
1440
+ that file to change it.
1441
+
1442
+ **Following a round (`--follow`).** By default Claude Code runs headless
1443
+ (`claude -p --output-format json`) and the terminal only shows the request, the
1444
+ stages and the outcome — the review is not a chat, there and in production alike.
1445
+ With `--follow` each stage runs with `--output-format stream-json --verbose` and
1446
+ the runner prints one line per action as it happens: the file read (`📄`, relative
1447
+ to the disposable copy), the search (`🔎`), the `productdock` command (`▸`), the
1448
+ subagent (`🤖`), the file written in the round's folder (`✍`) and the first line of
1449
+ what the model says (`💬`). Only the target of each tool is shown, never its
1450
+ content. The round itself — tools, permissions, files, outcome — does not change.
1451
+
1452
+ **Ctrl+C.** The first one finishes the current round and exits. The second one
1453
+ gives the request back to the queue (`release`) and exits — both with `0`.
1454
+
1455
+ #### Parameters
1456
+
1457
+ | Flag | Description |
1458
+ | ---------------------- | ---------------------------------------------------------------------------------------------------------------------- |
1459
+ | `--project-id <uuid>` | Project to serve — overrides `project.id` of `productdock.json` |
1460
+ | `--mine` | Only work items assigned to you. Filtered by the server, in the claim |
1461
+ | `--confirm` | Ask before each run — needs a terminal. Declining gives the request back to the queue, and this session does not receive it again |
1462
+ | `--interval <seconds>` | Seconds between queue polls while idle — a positive integer, `10` by default. A non-numeric value is refused (exit `1`) |
1463
+ | `--follow` | Print what Claude does in each stage, live — one line per tool call (file read, search, command, subagent, file written) |
1464
+ | `--json` | One JSON event per line on `stdout` (NDJSON); prose and the questions of the first run and `--confirm` on `stderr` |
1465
+
1466
+ #### Response format
1467
+
1468
+ Without `--json`, `stdout` stays empty and each round is reported on `stderr`:
1469
+ the request in progress, the outcome and its duration (and turns). Under
1470
+ `--json`, one event per line:
1471
+
1472
+ | `event` | When |
1473
+ | ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
1474
+ | `watch_started` | The runner is up — `project_id`, `runner_label`, `model`, `only_assigned`, `confirm`, `follow`, `skill_version` |
1475
+ | `job_started` | A request was taken — `job_id`, `work_item_ref`, `brief_version`, `title`, `skill_version` (the `SKILL.md` version copied into the round) |
1476
+ | `job_released` | A request declined under `--confirm` went back to the queue |
1477
+ | `job_finished` | The round ended — `outcome` (`completed`, `failed`, `discarded`, `released`), `duration_ms`, `turns`, and the verdict counts (`tech_pending`, or the `tech_decisions` of a 2.3.0 skill) or the `error` |
1478
+ | `activity` | Only with `--follow` — one action of Claude: `job_id`, `stage` (`A`/`B`), `kind` (`tool`/`text`), `tool`, `detail` |
1479
+ | `warning` | Something that did not end the round — a failed heartbeat, an unreachable queue |
1480
+ | `stopping` | The first Ctrl+C |
1481
+
1482
+ The last line is the closing document — `{ "ok": true, "event": "watch_stopped", "rounds": n }`,
1483
+ or the error document.
1484
+
1485
+ #### Exit codes
1486
+
1487
+ The general table above holds; this is how each condition maps to it:
1488
+
1489
+ | Code | When |
1490
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1491
+ | `0` | The runner was stopped with Ctrl+C — once or twice |
1492
+ | `1` | Directory not linked and no `--project-id` (no network call is made); no terminal (`--json` included) with no model stored yet, or with `--confirm`; not inside a Git repository; `claude` not on the `PATH`; `pd-workflow` not installed; non-numeric `--interval`; the queue refused the call for good — no permission on the project (`403`), bad request (`400`) |
1493
+ | `2` | No CLI session, or the API rejected the token (`401`) — run `productdock login` again |
1222
1494
 
1223
1495
  ### `productdock doctor`
1224
1496
 
@@ -1265,11 +1537,11 @@ Checks performed:
1265
1537
 
1266
1538
  Install locations are derived from the IDE list in `productdock.json` — a skill or agent is written once per distinct target, with identical content:
1267
1539
 
1268
- | IDE key | Target | Skills | Agents |
1269
- | ------------------------------- | --------- | ------------------------- | ------------------------- |
1270
- | `claude-code`, `claude-desktop` | `claude` | `.claude/skills/<name>/` | `.claude/agents/<name>/` |
1271
- | `vscode` | `copilot` | `.github/skills/<name>/` | `.github/agents/<name>/` |
1272
- | `cursor` | `cursor` | `.cursor/skills/<name>/` | `.cursor/agents/<name>/` |
1540
+ | IDE key | Target | Skills | Agents |
1541
+ | ------------------------------- | --------- | ------------------------ | ------------------------ |
1542
+ | `claude-code`, `claude-desktop` | `claude` | `.claude/skills/<name>/` | `.claude/agents/<name>/` |
1543
+ | `vscode` | `copilot` | `.github/skills/<name>/` | `.github/agents/<name>/` |
1544
+ | `cursor` | `cursor` | `.cursor/skills/<name>/` | `.cursor/agents/<name>/` |
1273
1545
 
1274
1546
  Agents get a directory of their own rather than a bare `.md` file: Claude Code scans `.claude/agents/` recursively and takes a subagent's identity from its `name` frontmatter, not from its path, so nesting is safe and keeps multi-file agents intact.
1275
1547
 
@@ -1278,20 +1550,24 @@ Everything installed is recorded in `productdock.json`, which is what `update` a
1278
1550
  ```jsonc
1279
1551
  {
1280
1552
  "ides": ["claude-code", "cursor"],
1281
- "project": { "id": "…", "name": "ProductDock", "repositoryName": "productdock-cli" },
1553
+ "project": {
1554
+ "id": "…",
1555
+ "name": "ProductDock",
1556
+ "repositoryName": "productdock-cli",
1557
+ },
1282
1558
  "mcp": { "url": "https://productdock-api.softdesign.com.br/mcp" },
1283
1559
  "skills": {
1284
1560
  "pd-workflow": {
1285
1561
  "version": "1.4.0",
1286
- "sha256": "…", // fingerprint of the installed tree
1562
+ "sha256": "…", // fingerprint of the installed tree
1287
1563
  "targets": ["claude", "cursor"],
1288
1564
  "installedAt": "2026-08-31T12:00:00.000Z",
1289
- "branch": "feature/new-phases" // only when it differs from `main`; absent means `main`
1290
- }
1565
+ "branch": "feature/new-phases", // only when it differs from `main`; absent means `main`
1566
+ },
1291
1567
  },
1292
1568
  "agents": {
1293
1569
  /* same shape as skills */
1294
- }
1570
+ },
1295
1571
  }
1296
1572
  ```
1297
1573
 
@@ -1323,7 +1599,7 @@ The branch is passed to the registry as a `?branch=` query parameter, and every
1323
1599
 
1324
1600
  ## How authentication works
1325
1601
 
1326
- There is **one** OAuth 2.1 + PKCE flow and it lives at `/oauth/*` on the ProductDock API — not under `/mcp`. Two channels ride on it: the CLI, which authenticates on its own and calls the project endpoints directly, and the IDEs, which keep talking to the MCP server. Both end up with credentials in `~/.productdock/credentials.json` (mode `0600`), refreshed silently as they expire.
1602
+ There is **one** OAuth 2.1 + PKCE flow and it lives at `/oauth/*` on the ProductDock API — not under `/mcp`. Two channels ride on it: the CLI, which authenticates on its own and calls the project endpoints directly, and the IDEs, which keep talking to the MCP server. Both end up with credentials in `~/.productdock/credentials.json` (mode `0600`, written atomically), refreshed silently as they expire. The credentials are deleted only when the server rejects the session (`invalid_grant` or `401`); a `5xx` or a network failure during the refresh keeps them and exits `1`. Before giving up, the CLI rereads the file: another process (the `productdock` calls of a `watch` round, for instance) may have renewed the session in the meantime.
1327
1603
 
1328
1604
  ```
1329
1605
  productdock login IDE (Claude Code / Cursor / VS Code)
@@ -1345,12 +1621,13 @@ productdock login IDE (Claude Code / Cursor / VS Code)
1345
1621
 
1346
1622
  All optional — defaults point at production.
1347
1623
 
1348
- | Variable | Default | Description |
1349
- | -------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------- |
1350
- | `PRODUCTDOCK_API_URL` | `https://productdock-api.softdesign.com.br` | ProductDock API base URL — root of the OAuth (`/oauth/*`) and project (`/cli/*`) endpoints |
1351
- | `PRODUCTDOCK_MCP_URL` | `<PRODUCTDOCK_API_URL>/mcp` | MCP server URL, written into each IDE config by `mcp setup`. Legacy: when it is set and `PRODUCTDOCK_API_URL` is not, this value minus the `/mcp` suffix becomes the API base |
1352
- | `PRODUCTDOCK_REGISTRY_URL` | `https://productdock-core-api.softdesign.com.br` | Skill and agent registry URL |
1353
- | `AI_TOOLS_BRANCH` | _(registry default branch, `main`)_ | Resolve skills and agents from this `ai-tools` branch. Setting it to `main` is the same as not setting it |
1624
+ | Variable | Default | Description |
1625
+ | -------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1626
+ | `PRODUCTDOCK_API_URL` | `https://productdock-api.softdesign.com.br` | ProductDock API base URL — root of the OAuth (`/oauth/*`) and project (`/cli/*`) endpoints |
1627
+ | `PRODUCTDOCK_MCP_URL` | `<PRODUCTDOCK_API_URL>/mcp` | MCP server URL, written into each IDE config by `mcp setup`. Legacy: when it is set and `PRODUCTDOCK_API_URL` is not, this value minus the `/mcp` suffix becomes the API base |
1628
+ | `PRODUCTDOCK_REGISTRY_URL` | `https://productdock-core-api.softdesign.com.br` | Skill and agent registry URL |
1629
+ | `AI_TOOLS_BRANCH` | _(registry default branch, `main`)_ | Resolve skills and agents from this `ai-tools` branch. Setting it to `main` is the same as not setting it |
1630
+ | `PRODUCTDOCK_CONFIG_DIR` | `~/.productdock` | Directory of `credentials.json` and of the user's `config.json`. `login`, the token refresh and `logout` honour it; `productdock watch` sets it for the `productdock` calls Claude makes, so they share your session without changing `HOME` |
1354
1631
 
1355
1632
  When running from source, these are also read from a `.env` file in the repository root — see `.env.example`.
1356
1633
 
@@ -1384,33 +1661,36 @@ bun test test/output.test.ts
1384
1661
 
1385
1662
  ### Source layout
1386
1663
 
1387
- | File | Responsibility |
1388
- | ------------------------- | -------------------------------------------------------------------------- |
1389
- | `bin/productdock.ts` | Commander program — command definitions and dispatch |
1390
- | `lib/constants.ts` | Version, base URLs and environment overrides — the `/oauth/*` and `/cli/*` root, the MCP server URL, the registry, `AI_TOOLS_BRANCH`; loads `.env` when running from source |
1391
- | `lib/auth.ts` | OAuth 2.1 + PKCE flow, credential store, token refresh |
1392
- | `lib/config.ts` | `productdock.json` read/write/migrate, `init` and `link` |
1393
- | `lib/api.ts` | Project and repository lookup behind `link` — `/cli/projects` and `/cli/projects/{id}/repositories` |
1394
- | `lib/git.ts` | `origin` remote detection and Azure DevOps URL parsing (SSH, HTTPS, legacy) |
1395
- | `lib/ide.ts` | IDE detection and MCP config writing |
1396
- | `lib/registry.ts` | Registry HTTP client — one code path for skills and agents, `?branch=` |
1397
- | `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, HTTP status kept in the error |
1398
- | `lib/scope.ts` | Project scope — `project_id`/`repository_id` from `productdock.json`, flags override |
1399
- | `lib/artifacts.ts` | Install core: destinations, zip extraction, SHA256 fingerprint, drift |
1400
- | `lib/frontmatter.ts` | Frontmatter adaptation per platform (agents) — port of the ai-tools installer |
1401
- | `lib/artifact-commands.ts`| The `skill` and `agent` command groups, generic over artifact kind |
1402
- | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context` and `bugs` over `/cli/work-items/*` |
1403
- | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
1404
- | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
1405
- | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
1406
- | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
1407
- | `lib/evaluations.ts` | The `eval` command group — `submit` over `/cli/evaluations`, envelope from a file, project-level |
1408
- | `lib/sdlc-state.ts` | The `state` command group — `phase` over `/cli/state/phase` and `update` over `/cli/state`, the read/write pair over the same state |
1409
- | `lib/doctor.ts` | Diagnostics |
1410
- | `lib/exit.ts` | Exit code taxonomy — `CliError` and the error → code mapping |
1411
- | `lib/output.ts` | Output layer — JSON on `stdout`, prose on `stderr`, credential redaction |
1412
- | `lib/tty.ts` | TTY guard — fails fast instead of blocking on a prompt |
1413
- | `lib/types.d.ts` | Shared types — IDE keys, install targets, `productdock.json` shape |
1664
+ | File | Responsibility |
1665
+ | ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1666
+ | `bin/productdock.ts` | Commander program — command definitions and dispatch |
1667
+ | `lib/constants.ts` | Version, base URLs and environment overrides — the `/oauth/*` and `/cli/*` root, the MCP server URL, the registry, `AI_TOOLS_BRANCH`; loads `.env` when running from source |
1668
+ | `lib/auth.ts` | OAuth 2.1 + PKCE flow, credential store (`PRODUCTDOCK_CONFIG_DIR`), token refresh |
1669
+ | `lib/config.ts` | `productdock.json` read/write/migrate, `init` and `link` |
1670
+ | `lib/api.ts` | Project and repository lookup behind `link` — `/cli/projects` and `/cli/projects/{id}/repositories` |
1671
+ | `lib/git.ts` | `origin` remote detection, Azure DevOps URL parsing (SSH, HTTPS, legacy), and the worktree helpers of `watch` |
1672
+ | `lib/ide.ts` | IDE detection and MCP config writing |
1673
+ | `lib/registry.ts` | Registry HTTP client — one code path for skills and agents, `?branch=` |
1674
+ | `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, HTTP status kept in the error |
1675
+ | `lib/scope.ts` | Project scope — `project_id`/`repository_id` from `productdock.json`, flags override |
1676
+ | `lib/artifacts.ts` | Install core: destinations, zip extraction, SHA256 fingerprint, drift |
1677
+ | `lib/frontmatter.ts` | Frontmatter adaptation per platform (agents) — port of the ai-tools installer |
1678
+ | `lib/artifact-commands.ts` | The `skill` and `agent` command groups, generic over artifact kind |
1679
+ | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context`, `bugs` and `prototypes` over `/cli/work-items/*` |
1680
+ | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
1681
+ | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
1682
+ | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
1683
+ | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
1684
+ | `lib/evaluations.ts` | The `eval` command group — `submit` over `/cli/evaluations`, envelope from a file, project-level |
1685
+ | `lib/sdlc-state.ts` | The `state` command group — `phase` over `/cli/state/phase` and `update` over `/cli/state`, the read/write pair over the same state |
1686
+ | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim`, `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
1687
+ | `lib/watch.ts` | The `watch` command — the PRD Tech Review runner: disposable worktree, the two Claude Code stages, heartbeat — no question during the round |
1688
+ | `lib/user-config.ts` | The user's `config.json` in the configuration directory, and the private atomic writer shared with the credentials |
1689
+ | `lib/doctor.ts` | Diagnostics |
1690
+ | `lib/exit.ts` | Exit code taxonomy — `CliError` and the error → code mapping |
1691
+ | `lib/output.ts` | Output layer — JSON on `stdout`, prose on `stderr`, credential redaction |
1692
+ | `lib/tty.ts` | TTY guard — fails fast instead of blocking on a prompt |
1693
+ | `lib/types.d.ts` | Shared types — IDE keys, install targets, `productdock.json` shape |
1414
1694
 
1415
1695
  ### Building
1416
1696