@softdesignbrasil/productdock-cli 0.11.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -154,6 +154,10 @@ the execution from the envelope's label (`target.repositories[0]`) or from
154
154
  exits `1` before any network call — see `productdock eval` below and
155
155
  [`productdock eval latest`](#productdock-eval-latest).
156
156
 
157
+ The same holds for `test-report submit`: the test suite report belongs to the
158
+ project, so the repository UUID is not sent and `--repository-id` exits `1`
159
+ before any network call — see `productdock test-report` below.
160
+
157
161
  In a tree that was never linked, an operation that needs a project exits `1`,
158
162
  naming **the directories it searched** — from the current one up to the
159
163
  filesystem root — and telling you to run `productdock link` at the repository
@@ -186,7 +190,7 @@ productdock logout
186
190
 
187
191
  ### `productdock link`
188
192
 
189
- Links the current directory to a ProductDock project, recording it in `productdock.json`. Prompts you to select a project, auto-detects the matching repository from your git remote, then offers to:
193
+ Links the current directory to a ProductDock project, recording it in `productdock.json`. Prompts you to select a project, picks the matching repository from your git remote (see [How the repository is chosen](#how-the-repository-is-chosen)), then offers to:
190
194
 
191
195
  1. write the MCP configuration for your IDEs, and
192
196
  2. install every skill and agent published under the `productdock` category.
@@ -197,19 +201,34 @@ productdock link
197
201
  # Skip interactive project selection
198
202
  productdock link --project-id <uuid>
199
203
 
200
- # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts)
204
+ # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts).
205
+ # Run inside the repository: the repository comes from its git remote
206
+ productdock link --project-id <uuid> --ide claude-code --yes --json
207
+
208
+ # Pin the repository explicitly, wherever you run it
201
209
  productdock link --project-id <uuid> --repository-id <uuid> --ide claude-code --yes --json
202
210
  ```
203
211
 
212
+ #### How the repository is chosen
213
+
214
+ In this order, and the first rule that decides wins:
215
+
216
+ 1. `--repository-id` — that repository, or the command is refused when the id is not in the project.
217
+ 2. The project has no repository — the link is written without one.
218
+ 3. The project has exactly one repository — that one.
219
+ 4. **The `origin` remote of the current directory.** When it is an Azure DevOps URL — SSH (`git@ssh.dev.azure.com:v3/<org>/<project>/<repo>`), HTTPS (`https://dev.azure.com/<org>/<project>/_git/<repo>`) or legacy (`https://<org>.visualstudio.com/<project>/_git/<repo>`) — the repository whose **organization, Azure project and name all match** it is chosen, without asking. The comparison ignores case and reads the URL-encoded parts decoded (`Meu%20Projeto` matches `Meu Projeto`). The name alone never decides: two repositories called `portal` in different Azure projects are told apart by the project in the remote.
220
+ 5. Nothing matched exactly one repository (no `origin`, a remote that is not Azure DevOps, or no repository with that organization + project + name) — with a terminal, `link` asks; without one, see below.
221
+
204
222
  Every point where `link` would ask a question has a flag, so the command runs
205
223
  to completion in a process with no terminal — the way an IDE agent executes
206
224
  step 2 of the prompt copied from the "Connect to your IDE" drawer. Without a
207
225
  TTY and with no flag, each install decision takes the same value the prompt
208
226
  offered by default (yes); `--no-install-mcp` / `--no-install-skills` opt out.
209
- When the project has more than one repository and no `--repository-id` is
210
- given, the link is written **without** a repository (a valid state — every
211
- operation that needs one asks for `--repository-id` at the point of use) and
212
- the accepted ids are printed to `stderr`.
227
+ When the project has more than one repository, no `--repository-id` is given
228
+ and the git remote matches none of them, the link is written **without** a
229
+ repository (a valid state — every operation that needs one asks for
230
+ `--repository-id` at the point of use), the exit code is still `0`, and the
231
+ accepted ids are printed to `stderr`.
213
232
 
214
233
  Nothing is written until every decision is made: a `link` that fails leaves the
215
234
  directory exactly as it was, instead of a `productdock.json` carrying only the
@@ -219,7 +238,7 @@ project.
219
238
  | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
220
239
  | `--project-id <uuid>` | Skip interactive project selection |
221
240
  | `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
222
- | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Replaces running `productdock init`, which needs a terminal |
241
+ | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Added to the IDEs already in `productdock.json` (never replaces what `productdock init` wrote); without a prior `init`, it stands in for it |
223
242
  | `--install-mcp` | Install the MCP configuration without asking |
224
243
  | `--no-install-mcp` | Do not install the MCP configuration |
225
244
  | `--install-skills` | Install skills and agents without asking |
@@ -292,6 +311,13 @@ productdock skill install pd-workflow --version 1.4.0
292
311
  # Overwrite something already on disk
293
312
  productdock skill install pd-workflow --force
294
313
 
314
+ # Install every item of one source — what `link` installs, on demand
315
+ productdock agent install --source productdock
316
+ productdock skill install --source productdock --json
317
+
318
+ # Same, overwriting what is already on disk
319
+ productdock agent install --source productdock --force
320
+
295
321
  # Update one, or everything installed
296
322
  productdock skill update pd-workflow
297
323
  productdock agent update
@@ -307,10 +333,37 @@ productdock agent status
307
333
  | Subcommand | Description |
308
334
  | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
309
335
  | `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
310
- | `install <name>` | Install into every target derived from `productdock.json`. `--version <version>`. Refuses if it already exists on disk unless `--force` |
336
+ | `install [name]` | Install into every target derived from `productdock.json` — one item by `name`, or every item of a source with `--source internal\|third-party\|productdock`. `--version <version>` (by name only). `--force` overwrites what is already on disk: without it, `install <name>` refuses and `install --source` skips an item installed in every target, installs it only in the targets where it is missing (an empty or partial folder counts as missing) and reports it |
311
337
  | `update [name]` | Update one, or every installed item. Up-to-date and locally modified items are skipped unless `--force` |
312
338
  | `status` | Report `up to date` / `outdated` / `modified` per installed item |
313
339
 
340
+ `install` takes **either** a name **or** `--source`: both together, or neither,
341
+ is a usage error (exit `1`). A source outside `internal`, `third-party` and
342
+ `productdock` is refused (exit `1`), naming the accepted values. The source is
343
+ the registry's `category` — the same dimension `list --source` filters by.
344
+
345
+ Under `--json`, `install --source` reports the effect item by item:
346
+
347
+ ```jsonc
348
+ {
349
+ "ok": true,
350
+ "operation": "agent_install", // or "skill_install"
351
+ "data": {
352
+ "kind": "agent",
353
+ "source": "productdock",
354
+ "targets": ["claude", "copilot"],
355
+ "installed": ["pd-reviewer"], // written now
356
+ "skipped": ["pd-planner"], // already installed, left untouched (no --force); an empty or partial folder is reinstalled
357
+ "failed": [], // the registry refused it
358
+ },
359
+ }
360
+ ```
361
+
362
+ A partial batch is a success (exit `0`) — `failed` names what is missing. When
363
+ **nothing** was installed and something failed (the registry is down, every
364
+ download refused), the command exits `1` — or `2` when the cause is the
365
+ session — with the error document instead.
366
+
314
367
  `status` compares a SHA256 fingerprint of the installed directory against the versions the registry knows about:
315
368
 
316
369
  | Symbol | Meaning |
@@ -1118,11 +1171,24 @@ same operations the MCP server exposes as the `get_prd_review` and
1118
1171
  call the same code on the server, so the envelope validation, the reconciliation
1119
1172
  by `finding_key` and the `tech_review` badge are one implementation, not two.
1120
1173
 
1174
+ Two more operations hold the **Tech Review request** of the work item for an
1175
+ interactive review (the skill in the IDE): `claim` takes it before the analysis
1176
+ and `release` gives it back if the review is abandoned. They are the
1177
+ `claim_prd_review_job` and `release_prd_review_job` operations of the
1178
+ `/cli/prd-review-jobs` queue — the same ones [`productdock watch`](#productdock-watch)
1179
+ uses —, with the filter by work item and the interactive lease.
1180
+
1121
1181
  **`get` is a mandatory read-back before every `submit`.** This is not style, it
1122
1182
  is an incident: without it, round N+1 re-emits findings the PM has already
1123
1183
  answered, resolved or ignored — and the failure is **silent**, because the round
1124
- still returns `success: true`. Read the review, check `summary.open` and
1125
- `has_human_reply`, and only then compose the next round.
1184
+ still returns `success: true`. Read the review, check `summary.open` and the
1185
+ `status` of each thread, and only then compose the next round.
1186
+
1187
+ **A round enters only through a Tech Review request.** With `--job-id`, the
1188
+ request must be running for you; without it, the reviewed PRD version must have
1189
+ an open request. Otherwise the server refuses the round before writing anything —
1190
+ a review that arrives after the PM cancelled the request creates no thread, no
1191
+ badge and no status.
1126
1192
 
1127
1193
  ```bash
1128
1194
  # The state of the review — the read-back
@@ -1141,22 +1207,39 @@ productdock prd-review submit --ref PROD-168 --content "$(cat prd-review.md)"
1141
1207
  # The whole cycle, machine-readable: read the state, then record the round
1142
1208
  productdock prd-review get PROD-168 --json --out before.json
1143
1209
  productdock prd-review submit prd-review.md --ref PROD-168 --json --out round.json
1210
+
1211
+ # Interactive Tech Review: take the request of the work item, record the round
1212
+ # through it, or give it back if the review is abandoned
1213
+ productdock prd-review claim PROD-168 --json --out claim.json
1214
+ productdock prd-review submit prd-review.md --ref PROD-168 --job-id <uuid>
1215
+ productdock prd-review release PROD-168
1144
1216
  ```
1145
1217
 
1146
- Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
1218
+ Every subcommand also accepts `--json`, `--project-id` and `--repository-id`,
1147
1219
  documented once at the top of this section.
1148
1220
 
1221
+ **The interactive lease.** `claim` takes the request with a 60-minute lease,
1222
+ renewed by the server on every `prd-review get` of that work item made by whoever
1223
+ took it — there is no heartbeat command. A session that goes 60 minutes without a
1224
+ read-back loses the request, which goes back to the queue without counting an
1225
+ attempt. The request id and the session of the claim are kept on this machine,
1226
+ in `prd-review-claims.json` under the configuration directory (next to
1227
+ `credentials.json`), and that is where `release` reads them from.
1228
+
1149
1229
  #### Parameters
1150
1230
 
1151
1231
  | Subcommand | Argument | Options |
1152
1232
  | --------------- | -------- | ---------------------------------------------------- |
1153
1233
  | `get <ref>` | `<ref>` | `--status <status>` · `--limit <n>` · `--out <file>` |
1154
- | `submit [file]` | `[file]` | `--ref` · `--content` · `--out` |
1234
+ | `submit [file]` | `[file]` | `--ref` · `--content` · `--job-id` · `--out` |
1235
+ | `claim <ref>` | `<ref>` | `--out <file>` |
1236
+ | `release <ref>` | `<ref>` | `--out <file>` |
1155
1237
 
1156
1238
  | Parameter | Description |
1157
1239
  | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1158
- | `<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 |
1159
- | `--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 |
1240
+ | `<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`, `claim` and `release`, and the `--ref` flag of `submit`, so the two can never be swapped by accident |
1241
+ | `--job-id <uuid>` | The Tech Review request the round enters through — the `job.id` that `claim` returned, or the request of the `watch` round. Sent only when given; the server refuses a request that is not running for you (cancelled included) and writes nothing |
1242
+ | `--status <status>` | Thread status filter: `open`, `resolved`, `ignored`, `superseded`, `archived`, 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 |
1160
1243
  | `--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 |
1161
1244
  | `[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 |
1162
1245
  | `--content <text>` | The review body inline, as an alternative to the file |
@@ -1177,20 +1260,20 @@ under `data`:
1177
1260
  }
1178
1261
  ```
1179
1262
 
1180
- `operation` is the canonical operation name — `get_prd_review` or
1181
- `submit_prd_review`. Without `--json`, `stdout` stays empty and a human-readable
1263
+ `operation` is the canonical operation name — `get_prd_review`,
1264
+ `submit_prd_review`, `claim_prd_review_job` or `release_prd_review_job`. Without `--json`, `stdout` stays empty and a human-readable
1182
1265
  summary goes to `stderr`.
1183
1266
 
1184
1267
  `get` returns `{ work_item_id, brief_version, summary, count, threads[] }`:
1185
1268
 
1186
1269
  | Field | Meaning |
1187
1270
  | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1188
- | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded }`. **`summary.open` is the number to check before composing the next round** |
1271
+ | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded, archived }`. **`summary.open` is the number to check before composing the next round** |
1189
1272
  | `count` | How many threads came back — after `--status` and `--limit` |
1190
1273
  | `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 |
1191
- | `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 |
1192
- | `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 |
1193
- | `threads[].messages[]` | The whole conversation, authors already hydrated (`author`, `source`, `text`). Human messages arrive as plain text — the stored HTML is converted server-side |
1274
+ | `threads[].status` | `open`, `resolved`, `ignored`, `superseded` or `archived`. An `ignored` finding must not be re-emitted. A resolved Blocker or Gap that the PRD still has is reopened by the next round (`threads_reopened`); a resolved Suggestion is not |
1275
+ | `threads[].archived_from_status` | The status an `archived` finding had when it left the panel — on publishing, skipping the Tech Review or restoring a version. `null` while not archived |
1276
+ | `threads[].messages[]` | The messages of the review rounds, authors already hydrated (`author`, `source`, `text`). The human conversation does not come: the state of the finding is the PM's decision, and it is what the next round needs |
1194
1277
  | `threads[].outdated` | `true` when the thread is anchored to a PRD version older than the current one |
1195
1278
  | `brief_version` | The current PRD version the review is being read against |
1196
1279
 
@@ -1202,19 +1285,27 @@ summary goes to `stderr`.
1202
1285
  | `review_round` | Number of this round. It equals the artifact version of the envelope snapshot |
1203
1286
  | `threads_created` | Findings that had no live thread — a new thread each |
1204
1287
  | `threads_updated` | Findings matched to an **open** thread by `finding_key`: the round was appended and the PM's reply survived |
1205
- | `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 |
1288
+ | `threads_reopened` | Blockers and Gaps the PM had **resolved** that this round emitted again — the PRD still has them, so the thread is open again |
1289
+ | `threads_skipped_closed` | Findings the PM had already **ignored**, or resolved Suggestions. Nothing was posted for them, and they were not reopened — a normal outcome |
1206
1290
  | `threads_superseded` | Threads that were open and did **not** come back in this round: the review considered them settled |
1207
1291
  | `tech_review` | The badge written on the PRD: `none` (a clean review), `changes_requested_gaps` or `changes_requested_blocking` |
1208
1292
  | `artifact_id` · `artifact_version` | The snapshot of the raw envelope kept as a phase artifact |
1209
1293
 
1294
+ `claim` and `release` return `{ job, runner_session }`:
1295
+
1296
+ | Field | Meaning |
1297
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1298
+ | `job` | The request as the queue returned it on `claim` — `id` (the value of `--job-id`), `status`, `brief_version`, `work_item_ref`, … `null` on `claim` when the work item has no queued request: nothing to review. On `release`, the request of the claim with the fields the release resets: `status: "queued"`, `interactive: false`, and `claimed_by`, `runner_label`, `lease_until` and `started_at` `null`. `attempts` and `attempt_history` stay as the claim returned them — the server recalculates them and answers only `{ released: true }` |
1299
+ | `runner_session` | The session of the claim. `release` sends it back with the request, so the queue knows who gave it back. `null` when `claim` took nothing |
1300
+
1210
1301
  #### Exit codes
1211
1302
 
1212
1303
  The general table above holds; this is how each condition maps to it:
1213
1304
 
1214
1305
  | Code | When |
1215
1306
  | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1216
- | `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** |
1217
- | `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 |
1307
+ | `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**; `claim` ran, **including when there was no request to take** (`job: null`); `release` gave the request back |
1308
+ | `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**; **round refused for its request — the `--job-id` request is not running for you, cancelled included (`400`, `prd_review_job_not_running`), no open request for the reviewed version (`400`, `prd_review_job_required`), or unknown request (`404`, `prd_review_job_not_found`) — and nothing was written**; `release` with no `claim` of that work item on this machine; no permission to edit work items (`403`, `submit`, `claim` and `release`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
1218
1309
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1219
1310
 
1220
1311
  ### `productdock eval` — project evaluations
@@ -1507,6 +1598,98 @@ The general table above holds; this is how each condition maps to it:
1507
1598
  | `1` | Missing `--type`; `--repository-id` given (refused before any network call); directory not linked and no `--project-id`; unknown `eval_type` (`400`); not a member of the project (`403` — `not_member`, or `project_membership_required` with only "Ver todos os projetos"); any other API failure |
1508
1599
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1509
1600
 
1601
+ ### `productdock test-report` — test suite reports
1602
+
1603
+ Served by the `/cli/test-reports` endpoint of the ProductDock API. It is the
1604
+ same operation the MCP server exposes as the `submit_test_report` tool, and it
1605
+ returns the same body — the CLI and the MCP call the same code on the server,
1606
+ so the report validation and the write are one implementation, not two.
1607
+
1608
+ It is the destination of the test suite report: when the suite finishes, the
1609
+ skill writes a JSON report with everything the run showed on screen —
1610
+ execution, modules, scenarios and coverage —, and this command sends it. The
1611
+ file goes to the server untouched — not transcribed, not truncated.
1612
+
1613
+ **A report belongs to a project, not to a work item.** Every submission is an
1614
+ **execution** of the project's test suite, numbered on the server
1615
+ (`run_number`). Resubmitting the same report updates that execution instead of
1616
+ adding another one — the response then carries `created: false`.
1617
+
1618
+ **The CLI does not validate the report.** It only checks that the file is a
1619
+ JSON **object**; the schema is the server's, and a report it refuses comes back
1620
+ as `400` naming the offending field. There is no size limit in the CLI either:
1621
+ the ceiling is the server's, and a report above it comes back as `413`. The CLI
1622
+ then replaces the server's message with a single one, saying the size of the
1623
+ body it sent and what to do — the ceiling itself is not quoted, because the
1624
+ server does not return it.
1625
+
1626
+ **Submission requires being a member of the project.** A call from someone who
1627
+ is not a member exits `1` with a `403`, and nothing is written.
1628
+
1629
+ **`--repository-id` is refused, not ignored.** The suite belongs to the
1630
+ project: the submission does not use the repository UUID, and the
1631
+ `project.repository` of `productdock.json` is not sent. Passing
1632
+ `--repository-id` exits `1` before any network call.
1633
+
1634
+ ```bash
1635
+ # The normal case: the report the skill just wrote
1636
+ productdock test-report submit test-report.json
1637
+
1638
+ # Machine-readable, saved to a file
1639
+ productdock test-report submit test-report.json --json --out submitted.json
1640
+
1641
+ # Another project, for this call only
1642
+ productdock test-report submit test-report.json --project-id <uuid>
1643
+ ```
1644
+
1645
+ The subcommand also accepts `--json`, documented once at the top of
1646
+ [Commands](#commands).
1647
+
1648
+ #### Parameters
1649
+
1650
+ | Subcommand | Argument | Options |
1651
+ | --------------- | -------- | ------------------------ |
1652
+ | `submit <file>` | `<file>` | `--project-id` · `--out` |
1653
+
1654
+ | Parameter | Description |
1655
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1656
+ | `<file>` | **Required.** Path to the test suite report 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; everything inside the object is validated by the server |
1657
+ | `--project-id <uuid>` | Project the execution is recorded under — overrides `project.id` of `productdock.json`, for this call only. There is no repository in this operation: `--repository-id` is refused (exit `1`, before any network call) |
1658
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1659
+
1660
+ #### Response format
1661
+
1662
+ Under `--json`, `stdout` carries one document with the API response untouched
1663
+ under `data`:
1664
+
1665
+ ```jsonc
1666
+ {
1667
+ "ok": true,
1668
+ "operation": "submit_test_report",
1669
+ "data": {
1670
+ /* the body below */
1671
+ },
1672
+ }
1673
+ ```
1674
+
1675
+ Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
1676
+
1677
+ | Field | Meaning |
1678
+ | ------------ | ---------------------------------------------------------------------------------------------------- |
1679
+ | `id` | Id of the execution |
1680
+ | `run_number` | Number of the execution in the project's history |
1681
+ | `created` | `true` when the submission added an execution; `false` when it updated one already recorded with the same report |
1682
+
1683
+ #### Exit codes
1684
+
1685
+ The general table above holds; this is how each condition maps to it:
1686
+
1687
+ | Code | When |
1688
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1689
+ | `0` | The execution was recorded |
1690
+ | `1` | Missing `<file>`; unreadable file; the file is not a JSON object; `--repository-id` given (refused before any network call); directory not linked and no `--project-id`; **invalid report (`400`) — the response names the offending field, and nothing was written**; not a member of the project (`403`); report above the server's size limit (`413`) — one message, with the size that was sent; any other API failure |
1691
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1692
+
1510
1693
  ### `productdock state` — the SDLC state of a work item
1511
1694
 
1512
1695
  Served by the `/cli/state` endpoints of the ProductDock API. They are the same
@@ -1520,7 +1703,8 @@ same operation, not a replacement: the agent picks the channel per call.
1520
1703
  The two commands are the **read/write pair over the same state**, which is why
1521
1704
  they live together. `phase` reads it — current phase, next phase, artifacts,
1522
1705
  `uses_plan`, task progress — and `update` writes it: decision, blocker, lesson,
1523
- review gate, phase change, phase progress, PRD verdict and flow change. Whatever
1706
+ review gate, phase change, phase progress and flow change. The PRD verdict is not
1707
+ written here: it enters only through `prd-review submit`. Whatever
1524
1708
  you write here is what the other channel reads next, because there is a single
1525
1709
  row behind both.
1526
1710
 
@@ -1597,7 +1781,7 @@ the same work item, with no error anywhere — cannot happen by accident.
1597
1781
  | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1598
1782
  | `<ref>` | **Required** on `phase`. The work item — `PREFIX-N` (`PROD-168`), a number, a UUID or a title |
1599
1783
  | `--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 |
1600
- | `--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 |
1784
+ | `--type <type>` | **Required** on `update`. The kind of update: `decision`, `blocker`, `lesson`, `review`, `phase_change`, `phase_progress`, `flow_change`. Sent as-is: the enum belongs to the server, which rejects what it does not know and lists the options |
1601
1785
  | `[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 |
1602
1786
  | `--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 |
1603
1787
  | `--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` |
@@ -1712,7 +1896,13 @@ repository, that `claude` (Claude Code) is on the `PATH`, that the
1712
1896
  4. **Version check** — if the PRD changed during the round, or the request was
1713
1897
  cancelled, the round is **discarded**: no Stage B, nothing submitted.
1714
1898
  5. **Stage B** — `claude --resume` submits the review **once**, right after the
1715
- version check, with no pause. Submitting closes the request on the server.
1899
+ version check, with no pause, through the request of the round (`--job-id`).
1900
+ Submitting closes the request on the server. A request the PM cancelled
1901
+ during Stage B refuses the submission, and the round is **discarded** — not
1902
+ failed, and its files are not kept.
1903
+
1904
+ Both stages receive the id of the request in their prompt, as the `<job_id>`
1905
+ variable of the runner.
1716
1906
 
1717
1907
  A `runner-handoff.json` in the round's folder comes from an outdated
1718
1908
  (pre-release) skill: it is **ignored**, never asked, and a one-line warning says so
@@ -1818,9 +2008,12 @@ Checks performed:
1818
2008
  3. `productdock.json` exists with an IDE list
1819
2009
  4. The directory is linked to a ProductDock project
1820
2010
  5. MCP server is reachable
1821
- 6. MCP config files exist for each configured IDE and point at the correct URL
2011
+ 6. MCP config files exist for each configured IDE, point at the correct URL and carry the project and repository of the
2012
+ current link — after re-linking to another repository, `--fix` rewrites them. The MCP is legacy and optional: in a
2013
+ directory that never configured it (no `mcp` in `productdock.json`, no `productdock` entry in any IDE file, as after
2014
+ `link --no-install-mcp`) this check passes and `--fix` does not install it
1822
2015
  7. `AI_TOOLS_BRANCH` is not silently overriding the skill/agent source
1823
- 8. Every skill and agent recorded in `productdock.json` is present on disk
2016
+ 8. Every skill and agent recorded in `productdock.json` is installed on disk — a skill folder without its `SKILL.md`, or an empty agent file, counts as missing
1824
2017
 
1825
2018
  ---
1826
2019
 
@@ -1988,10 +2181,11 @@ bun test test/output.test.ts
1988
2181
  | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
1989
2182
  | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
1990
2183
  | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
1991
- | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
2184
+ | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review`, and `claim`/`release` of the interactive Tech Review request |
1992
2185
  | `lib/evaluations.ts` | The `eval` command group — `submit` over `/cli/evaluations` (envelope from a file), `latest` over `/cli/evaluations/report` and `list` over `/cli/evaluations/repositories`, project-level |
2186
+ | `lib/test-reports.ts` | The `test-report` command group — `submit` over `/cli/test-reports` (report from a file), project-level |
1993
2187
  | `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 |
1994
- | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim`, `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
2188
+ | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim` (by work item, interactive), `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
1995
2189
  | `lib/watch.ts` | The `watch` command — the PRD Tech Review runner: disposable worktree, the two Claude Code stages, heartbeat — no question during the round |
1996
2190
  | `lib/user-config.ts` | The user's `config.json` in the configuration directory, and the private atomic writer shared with the credentials |
1997
2191
  | `lib/doctor.ts` | Diagnostics |