@softdesignbrasil/productdock-cli 0.12.0 → 0.14.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.
Files changed (3) hide show
  1. package/README.md +165 -121
  2. package/dist/productdock.js +83 -82
  3. package/package.json +1 -1
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
@@ -952,10 +956,8 @@ The general table above holds; this is how each condition maps to it:
952
956
 
953
957
  ### `productdock artifact` — writing SDLC phase artifacts
954
958
 
955
- Two write operations over the phase artifacts of a work item. `submit` records a
956
- version **on the platform**; `commit` versions the same body **in Git**. They are
957
- different operations on different stores — the usual sequence is one after the
958
- other — and each has its own subsection below.
959
+ One write operation over the phase artifacts of a work item: `submit` records a
960
+ version **on the platform**. It has its own subsection below.
959
961
 
960
962
  #### `productdock artifact submit`
961
963
 
@@ -1062,102 +1064,6 @@ The general table above holds; this is how each condition maps to it:
1062
1064
  | `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 |
1063
1065
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1064
1066
 
1065
- #### `productdock artifact commit`
1066
-
1067
- Served by the `/cli/artifacts/commit` endpoint of the ProductDock API. It is the
1068
- same operation the MCP server exposes as the `commit_artifact` tool, and it
1069
- returns the same body — the path derivation, the branch creation, the
1070
- add-vs-edit decision and the Azure DevOps push are one implementation on the
1071
- server, not two.
1072
-
1073
- **The destination is not yours to choose.** The path in the repository is
1074
- derived server-side from the work item — `.productdock/{N}-{slug}/{type}.md`,
1075
- with `plan` written as `plan.md` and `qa-report` as `qa-run.md` — so there is no
1076
- path flag to pass, and the name of the file on your disk is irrelevant. The
1077
- `path` in the response is read, never proposed.
1078
-
1079
- **The repository target is mandatory and explicit.** This is the strictest scope
1080
- contract of the CLI: a call without a project **or** without a repository is
1081
- refused rather than completed with a default. Committing to the wrong repository
1082
- writes a version nobody is reading.
1083
-
1084
- The Azure DevOps credential is resolved server-side from your ProductDock
1085
- session — there is nothing to configure locally, and no token to pass.
1086
-
1087
- ```bash
1088
- # The body comes from a file — the normal case
1089
- productdock artifact commit .productdock/work-items/PROD-168/spec.md \
1090
- --ref PROD-168 --phase specify --type spec
1091
-
1092
- # Inline, for a short artifact
1093
- productdock artifact commit --ref PROD-168 --phase implement --type plan \
1094
- --content '# Plano
1095
-
1096
- Passo 1.'
1097
-
1098
- # On a branch of its own — created from the default branch if it does not exist
1099
- productdock artifact commit qa-report.md --ref PROD-168 \
1100
- --phase qa-run --type qa-report --branch specs/PROD-168-substituir-mcp
1101
-
1102
- # Machine-readable, saved to a file
1103
- productdock artifact commit spec.md --ref PROD-168 --phase specify --type spec \
1104
- --json --out committed.json
1105
- ```
1106
-
1107
- The subcommand also accepts `--json`, `--project-id` and `--repository-id`,
1108
- documented once at the top of this section.
1109
-
1110
- ##### Parameters
1111
-
1112
- | Subcommand | Argument | Options |
1113
- | --------------- | -------- | ----------------------------------------------------------------------------------------- |
1114
- | `commit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--branch` · `--repository-name` · `--out` |
1115
-
1116
- | Parameter | Description |
1117
- | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1118
- | `[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** |
1119
- | `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
1120
- | `--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 |
1121
- | `--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` |
1122
- | `--content <text>` | The artifact body inline, as an alternative to the file |
1123
- | `--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 |
1124
- | `--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`) |
1125
- | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1126
-
1127
- ##### Response format
1128
-
1129
- Under `--json`, `stdout` carries one document with the API response untouched
1130
- under `data`:
1131
-
1132
- ```jsonc
1133
- {
1134
- "ok": true,
1135
- "operation": "commit_artifact",
1136
- "data": {
1137
- /* the body below */
1138
- },
1139
- }
1140
- ```
1141
-
1142
- Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
1143
-
1144
- | Field | Meaning |
1145
- | ----------- | ------------------------------------------------------------------------------ |
1146
- | `success` | Always `true` on a `0` exit — the push was applied |
1147
- | `path` | Path the artifact was written to, **derived server-side** from the work item |
1148
- | `branch` | Branch the commit landed on — the one you asked for, or the repository default |
1149
- | `commit_id` | SHA of the commit, or `null` when Azure DevOps returned no commit for the push |
1150
-
1151
- ##### Exit codes
1152
-
1153
- The general table above holds; this is how each condition maps to it:
1154
-
1155
- | Code | When |
1156
- | ---- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1157
- | `0` | The commit was pushed |
1158
- | `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 |
1159
- | `2` | The API rejected the token (`401`) — run `productdock login` again |
1160
-
1161
1067
  ### `productdock prd-review` — the PRD critical review
1162
1068
 
1163
1069
  Two operations over the inline review threads of a PRD (the PRD Tech Review),
@@ -1167,11 +1073,24 @@ same operations the MCP server exposes as the `get_prd_review` and
1167
1073
  call the same code on the server, so the envelope validation, the reconciliation
1168
1074
  by `finding_key` and the `tech_review` badge are one implementation, not two.
1169
1075
 
1076
+ Two more operations hold the **Tech Review request** of the work item for an
1077
+ interactive review (the skill in the IDE): `claim` takes it before the analysis
1078
+ and `release` gives it back if the review is abandoned. They are the
1079
+ `claim_prd_review_job` and `release_prd_review_job` operations of the
1080
+ `/cli/prd-review-jobs` queue — the same ones [`productdock watch`](#productdock-watch)
1081
+ uses —, with the filter by work item and the interactive lease.
1082
+
1170
1083
  **`get` is a mandatory read-back before every `submit`.** This is not style, it
1171
1084
  is an incident: without it, round N+1 re-emits findings the PM has already
1172
1085
  answered, resolved or ignored — and the failure is **silent**, because the round
1173
- still returns `success: true`. Read the review, check `summary.open` and
1174
- `has_human_reply`, and only then compose the next round.
1086
+ still returns `success: true`. Read the review, check `summary.open` and the
1087
+ `status` of each thread, and only then compose the next round.
1088
+
1089
+ **A round enters only through a Tech Review request.** With `--job-id`, the
1090
+ request must be running for you; without it, the reviewed PRD version must have
1091
+ an open request. Otherwise the server refuses the round before writing anything —
1092
+ a review that arrives after the PM cancelled the request creates no thread, no
1093
+ badge and no status.
1175
1094
 
1176
1095
  ```bash
1177
1096
  # The state of the review — the read-back
@@ -1190,22 +1109,39 @@ productdock prd-review submit --ref PROD-168 --content "$(cat prd-review.md)"
1190
1109
  # The whole cycle, machine-readable: read the state, then record the round
1191
1110
  productdock prd-review get PROD-168 --json --out before.json
1192
1111
  productdock prd-review submit prd-review.md --ref PROD-168 --json --out round.json
1112
+
1113
+ # Interactive Tech Review: take the request of the work item, record the round
1114
+ # through it, or give it back if the review is abandoned
1115
+ productdock prd-review claim PROD-168 --json --out claim.json
1116
+ productdock prd-review submit prd-review.md --ref PROD-168 --job-id <uuid>
1117
+ productdock prd-review release PROD-168
1193
1118
  ```
1194
1119
 
1195
- Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
1120
+ Every subcommand also accepts `--json`, `--project-id` and `--repository-id`,
1196
1121
  documented once at the top of this section.
1197
1122
 
1123
+ **The interactive lease.** `claim` takes the request with a 60-minute lease,
1124
+ renewed by the server on every `prd-review get` of that work item made by whoever
1125
+ took it — there is no heartbeat command. A session that goes 60 minutes without a
1126
+ read-back loses the request, which goes back to the queue without counting an
1127
+ attempt. The request id and the session of the claim are kept on this machine,
1128
+ in `prd-review-claims.json` under the configuration directory (next to
1129
+ `credentials.json`), and that is where `release` reads them from.
1130
+
1198
1131
  #### Parameters
1199
1132
 
1200
1133
  | Subcommand | Argument | Options |
1201
1134
  | --------------- | -------- | ---------------------------------------------------- |
1202
1135
  | `get <ref>` | `<ref>` | `--status <status>` · `--limit <n>` · `--out <file>` |
1203
- | `submit [file]` | `[file]` | `--ref` · `--content` · `--out` |
1136
+ | `submit [file]` | `[file]` | `--ref` · `--content` · `--job-id` · `--out` |
1137
+ | `claim <ref>` | `<ref>` | `--out <file>` |
1138
+ | `release <ref>` | `<ref>` | `--out <file>` |
1204
1139
 
1205
1140
  | Parameter | Description |
1206
1141
  | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1207
- | `<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 |
1208
- | `--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 |
1142
+ | `<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 |
1143
+ | `--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 |
1144
+ | `--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 |
1209
1145
  | `--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 |
1210
1146
  | `[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 |
1211
1147
  | `--content <text>` | The review body inline, as an alternative to the file |
@@ -1226,20 +1162,20 @@ under `data`:
1226
1162
  }
1227
1163
  ```
1228
1164
 
1229
- `operation` is the canonical operation name — `get_prd_review` or
1230
- `submit_prd_review`. Without `--json`, `stdout` stays empty and a human-readable
1165
+ `operation` is the canonical operation name — `get_prd_review`,
1166
+ `submit_prd_review`, `claim_prd_review_job` or `release_prd_review_job`. Without `--json`, `stdout` stays empty and a human-readable
1231
1167
  summary goes to `stderr`.
1232
1168
 
1233
1169
  `get` returns `{ work_item_id, brief_version, summary, count, threads[] }`:
1234
1170
 
1235
1171
  | Field | Meaning |
1236
1172
  | ------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1237
- | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded }`. **`summary.open` is the number to check before composing the next round** |
1173
+ | `summary` | Thread counts by status: `{ open, resolved, ignored, superseded, archived }`. **`summary.open` is the number to check before composing the next round** |
1238
1174
  | `count` | How many threads came back — after `--status` and `--limit` |
1239
1175
  | `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 |
1240
- | `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 |
1241
- | `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 |
1242
- | `threads[].messages[]` | The whole conversation, authors already hydrated (`author`, `source`, `text`). Human messages arrive as plain text — the stored HTML is converted server-side |
1176
+ | `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 |
1177
+ | `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 |
1178
+ | `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 |
1243
1179
  | `threads[].outdated` | `true` when the thread is anchored to a PRD version older than the current one |
1244
1180
  | `brief_version` | The current PRD version the review is being read against |
1245
1181
 
@@ -1251,19 +1187,27 @@ summary goes to `stderr`.
1251
1187
  | `review_round` | Number of this round. It equals the artifact version of the envelope snapshot |
1252
1188
  | `threads_created` | Findings that had no live thread — a new thread each |
1253
1189
  | `threads_updated` | Findings matched to an **open** thread by `finding_key`: the round was appended and the PM's reply survived |
1254
- | `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 |
1190
+ | `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 |
1191
+ | `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 |
1255
1192
  | `threads_superseded` | Threads that were open and did **not** come back in this round: the review considered them settled |
1256
1193
  | `tech_review` | The badge written on the PRD: `none` (a clean review), `changes_requested_gaps` or `changes_requested_blocking` |
1257
1194
  | `artifact_id` · `artifact_version` | The snapshot of the raw envelope kept as a phase artifact |
1258
1195
 
1196
+ `claim` and `release` return `{ job, runner_session }`:
1197
+
1198
+ | Field | Meaning |
1199
+ | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
1200
+ | `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 }` |
1201
+ | `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 |
1202
+
1259
1203
  #### Exit codes
1260
1204
 
1261
1205
  The general table above holds; this is how each condition maps to it:
1262
1206
 
1263
1207
  | Code | When |
1264
1208
  | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1265
- | `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** |
1266
- | `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 |
1209
+ | `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 |
1210
+ | `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 |
1267
1211
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1268
1212
 
1269
1213
  ### `productdock eval` — project evaluations
@@ -1556,6 +1500,98 @@ The general table above holds; this is how each condition maps to it:
1556
1500
  | `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 |
1557
1501
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1558
1502
 
1503
+ ### `productdock test-report` — test suite reports
1504
+
1505
+ Served by the `/cli/test-reports` endpoint of the ProductDock API. It is the
1506
+ same operation the MCP server exposes as the `submit_test_report` tool, and it
1507
+ returns the same body — the CLI and the MCP call the same code on the server,
1508
+ so the report validation and the write are one implementation, not two.
1509
+
1510
+ It is the destination of the test suite report: when the suite finishes, the
1511
+ skill writes a JSON report with everything the run showed on screen —
1512
+ execution, modules, scenarios and coverage —, and this command sends it. The
1513
+ file goes to the server untouched — not transcribed, not truncated.
1514
+
1515
+ **A report belongs to a project, not to a work item.** Every submission is an
1516
+ **execution** of the project's test suite, numbered on the server
1517
+ (`run_number`). Resubmitting the same report updates that execution instead of
1518
+ adding another one — the response then carries `created: false`.
1519
+
1520
+ **The CLI does not validate the report.** It only checks that the file is a
1521
+ JSON **object**; the schema is the server's, and a report it refuses comes back
1522
+ as `400` naming the offending field. There is no size limit in the CLI either:
1523
+ the ceiling is the server's, and a report above it comes back as `413`. The CLI
1524
+ then replaces the server's message with a single one, saying the size of the
1525
+ body it sent and what to do — the ceiling itself is not quoted, because the
1526
+ server does not return it.
1527
+
1528
+ **Submission requires being a member of the project.** A call from someone who
1529
+ is not a member exits `1` with a `403`, and nothing is written.
1530
+
1531
+ **`--repository-id` is refused, not ignored.** The suite belongs to the
1532
+ project: the submission does not use the repository UUID, and the
1533
+ `project.repository` of `productdock.json` is not sent. Passing
1534
+ `--repository-id` exits `1` before any network call.
1535
+
1536
+ ```bash
1537
+ # The normal case: the report the skill just wrote
1538
+ productdock test-report submit test-report.json
1539
+
1540
+ # Machine-readable, saved to a file
1541
+ productdock test-report submit test-report.json --json --out submitted.json
1542
+
1543
+ # Another project, for this call only
1544
+ productdock test-report submit test-report.json --project-id <uuid>
1545
+ ```
1546
+
1547
+ The subcommand also accepts `--json`, documented once at the top of
1548
+ [Commands](#commands).
1549
+
1550
+ #### Parameters
1551
+
1552
+ | Subcommand | Argument | Options |
1553
+ | --------------- | -------- | ------------------------ |
1554
+ | `submit <file>` | `<file>` | `--project-id` · `--out` |
1555
+
1556
+ | Parameter | Description |
1557
+ | --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1558
+ | `<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 |
1559
+ | `--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) |
1560
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1561
+
1562
+ #### Response format
1563
+
1564
+ Under `--json`, `stdout` carries one document with the API response untouched
1565
+ under `data`:
1566
+
1567
+ ```jsonc
1568
+ {
1569
+ "ok": true,
1570
+ "operation": "submit_test_report",
1571
+ "data": {
1572
+ /* the body below */
1573
+ },
1574
+ }
1575
+ ```
1576
+
1577
+ Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
1578
+
1579
+ | Field | Meaning |
1580
+ | ------------ | ---------------------------------------------------------------------------------------------------- |
1581
+ | `id` | Id of the execution |
1582
+ | `run_number` | Number of the execution in the project's history |
1583
+ | `created` | `true` when the submission added an execution; `false` when it updated one already recorded with the same report |
1584
+
1585
+ #### Exit codes
1586
+
1587
+ The general table above holds; this is how each condition maps to it:
1588
+
1589
+ | Code | When |
1590
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1591
+ | `0` | The execution was recorded |
1592
+ | `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 |
1593
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1594
+
1559
1595
  ### `productdock state` — the SDLC state of a work item
1560
1596
 
1561
1597
  Served by the `/cli/state` endpoints of the ProductDock API. They are the same
@@ -1569,7 +1605,8 @@ same operation, not a replacement: the agent picks the channel per call.
1569
1605
  The two commands are the **read/write pair over the same state**, which is why
1570
1606
  they live together. `phase` reads it — current phase, next phase, artifacts,
1571
1607
  `uses_plan`, task progress — and `update` writes it: decision, blocker, lesson,
1572
- review gate, phase change, phase progress, PRD verdict and flow change. Whatever
1608
+ review gate, phase change, phase progress and flow change. The PRD verdict is not
1609
+ written here: it enters only through `prd-review submit`. Whatever
1573
1610
  you write here is what the other channel reads next, because there is a single
1574
1611
  row behind both.
1575
1612
 
@@ -1646,7 +1683,7 @@ the same work item, with no error anywhere — cannot happen by accident.
1646
1683
  | ------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1647
1684
  | `<ref>` | **Required** on `phase`. The work item — `PREFIX-N` (`PROD-168`), a number, a UUID or a title |
1648
1685
  | `--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 |
1649
- | `--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 |
1686
+ | `--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 |
1650
1687
  | `[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 |
1651
1688
  | `--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 |
1652
1689
  | `--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` |
@@ -1761,7 +1798,13 @@ repository, that `claude` (Claude Code) is on the `PATH`, that the
1761
1798
  4. **Version check** — if the PRD changed during the round, or the request was
1762
1799
  cancelled, the round is **discarded**: no Stage B, nothing submitted.
1763
1800
  5. **Stage B** — `claude --resume` submits the review **once**, right after the
1764
- version check, with no pause. Submitting closes the request on the server.
1801
+ version check, with no pause, through the request of the round (`--job-id`).
1802
+ Submitting closes the request on the server. A request the PM cancelled
1803
+ during Stage B refuses the submission, and the round is **discarded** — not
1804
+ failed, and its files are not kept.
1805
+
1806
+ Both stages receive the id of the request in their prompt, as the `<job_id>`
1807
+ variable of the runner.
1765
1808
 
1766
1809
  A `runner-handoff.json` in the round's folder comes from an outdated
1767
1810
  (pre-release) skill: it is **ignored**, never asked, and a one-line warning says so
@@ -2039,11 +2082,12 @@ bun test test/output.test.ts
2039
2082
  | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context`, `bugs`, `prototypes` and `attachments` (with `--download`) over `/cli/work-items/*` |
2040
2083
  | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
2041
2084
  | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
2042
- | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
2043
- | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
2085
+ | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts`, body from a file |
2086
+ | `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 |
2044
2087
  | `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 |
2088
+ | `lib/test-reports.ts` | The `test-report` command group — `submit` over `/cli/test-reports` (report from a file), project-level |
2045
2089
  | `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 |
2046
- | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim`, `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
2090
+ | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim` (by work item, interactive), `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
2047
2091
  | `lib/watch.ts` | The `watch` command — the PRD Tech Review runner: disposable worktree, the two Claude Code stages, heartbeat — no question during the round |
2048
2092
  | `lib/user-config.ts` | The user's `config.json` in the configuration directory, and the private atomic writer shared with the credentials |
2049
2093
  | `lib/doctor.ts` | Diagnostics |