@softdesignbrasil/productdock-cli 0.9.2 → 0.11.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 +332 -25
  2. package/dist/productdock.js +104 -104
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -146,6 +146,14 @@ productdock <operation> --repository-id <uuid>
146
146
  | `--project-id <uuid>` | Project the operation runs against — overrides `project.id` |
147
147
  | `--repository-id <uuid>` | Repository the operation runs against — overrides `project.repository` |
148
148
 
149
+ One exception: the `eval` commands work on a project-level evaluation and
150
+ never use the repository UUID. `eval latest` and `eval list` filter by
151
+ `repository_key` (`--repository <key>`); `eval submit` takes the repository of
152
+ the execution from the envelope's label (`target.repositories[0]`) or from
153
+ `--repository-name`. None of them offers `--repository-id`, and passing it
154
+ exits `1` before any network call — see `productdock eval` below and
155
+ [`productdock eval latest`](#productdock-eval-latest).
156
+
149
157
  In a tree that was never linked, an operation that needs a project exits `1`,
150
158
  naming **the directories it searched** — from the current one up to the
151
159
  filesystem root — and telling you to run `productdock link` at the repository
@@ -316,9 +324,9 @@ productdock agent status
316
324
 
317
325
  ### `productdock wi` — work items
318
326
 
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 —
327
+ Eight operations over the work items of a project, served by the
328
+ `/cli/work-items/*` endpoints of the ProductDock API. Six of them read
329
+ (`list`, `prd`, `spec-context`, `bugs`, `prototypes`, `attachments`); two of them write to the work item —
322
330
  `comment` posts a comment, `evidence` uploads a QA screenshot. Each has its own
323
331
  subsection below.
324
332
 
@@ -547,6 +555,102 @@ The general table above holds; this is how each condition maps to it:
547
555
  | `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
556
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
549
557
 
558
+ #### `productdock wi attachments`
559
+
560
+ Lists the attachments of a work item — the files on its **Attachments** tab
561
+ (images, PDF, CSV, spreadsheets), served by the `/cli/work-items/attachments`
562
+ endpoint of the ProductDock API, and with `--download <dir>` saves their bytes
563
+ to disk, served by `/cli/work-items/attachments/content`. It is the same operation the MCP server
564
+ exposes as the `get_work_item_attachments` tool, and it returns the same body —
565
+ the CLI and the MCP call the same code on the server, so the ordering, the
566
+ author lookup and the signed read URLs are one implementation, not two.
567
+
568
+ **An attachment belongs to the work item, not to a repository.** The
569
+ `project.repository` of `productdock.json` is **not** sent, exactly as in
570
+ `wi prototypes`.
571
+
572
+ **Only members of the project read it.** The server reads as you, with your
573
+ token. A non-member and a portal client get a `403` with `not_member`; someone
574
+ who only has "Ver todos os projetos" gets a `403` with
575
+ `project_membership_required`. Every one of them exits `1`.
576
+
577
+ ```bash
578
+ # Every attachment of the work item, most recent first
579
+ productdock wi attachments PROD-261
580
+
581
+ # Machine-readable, saved to a file
582
+ productdock wi attachments PROD-261 --json --out attachments.json
583
+
584
+ # Save the bytes of every attachment under ./attachments (created if missing)
585
+ productdock wi attachments PROD-261 --download ./attachments
586
+
587
+ # Same, machine-readable: the document is the listing, the saved paths go to stderr
588
+ productdock wi attachments PROD-261 --download ./attachments --json
589
+ ```
590
+
591
+ ##### Parameters
592
+
593
+ | Subcommand | Argument | Options |
594
+ | ------------------- | -------- | -------------------------------- |
595
+ | `attachments <ref>` | `<ref>` | `--download <dir>` · `--out <file>` |
596
+
597
+ | Parameter | Description |
598
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
599
+ | `<ref>` | **Required.** Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
600
+ | `--download <dir>` | Writes the bytes of every attachment of the list into `<dir>`, one `GET /cli/work-items/attachments/content` per attachment — never through the `signed_url`. The bytes go to disk exactly as served: not decoded as UTF-8 and not masked. `<dir>` is created when it does not exist. The file name is the base name of `file_name` (`../` and folders are dropped, so nothing lands outside `<dir>`). **A file that already exists is overwritten.** When two attachments share a name, the second gets `-<n>` before the extension (`print.png`, `print-2.png`; compared ignoring case). An empty list writes nothing and creates nothing. A failure in the middle stops the command with its exit code and **keeps what was already written** — those paths are on `stderr` |
601
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
602
+
603
+ ##### Response format
604
+
605
+ Under `--json`, `stdout` carries one document with the API response under
606
+ `data`:
607
+
608
+ ```jsonc
609
+ {
610
+ "ok": true,
611
+ "operation": "get_work_item_attachments",
612
+ "data": {
613
+ /* the body below */
614
+ },
615
+ }
616
+ ```
617
+
618
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
619
+ per attachment — name, MIME type, size, date and author.
620
+
621
+ `data` is `{ work_item_id, count, attachments[] }`:
622
+
623
+ | Field | Meaning |
624
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
625
+ | `work_item_id` | The work item the reference resolved to |
626
+ | `count` | How many attachments came back — always `attachments.length` |
627
+ | `attachments[]` | Most recent first: `{ id, file_name, mime_type, file_size, created_at, uploaded_by, author_name, signed_url, expires_in }`. `file_size` is in bytes; `author_name` is the author's full name, or their e-mail, or `Sem nome`, and `null` when there is no author. `signed_url` is a read URL of the private bucket, valid for `expires_in` seconds (300) |
628
+
629
+ `signed_url` is meant for an agent over MCP. Under `--json` its token comes out
630
+ masked (`token=***`), like every token the CLI writes — so it cannot be used
631
+ from here: to get the files, use `--download <dir>`. When the server could not sign one attachment, that item comes back
632
+ with `signed_url: null` and `expires_in: null`, and the rest of the list is
633
+ unaffected.
634
+
635
+ A work item with no attachments returns `count: 0` and `attachments: []`, which
636
+ is a **success**, not an error — the summary says "Nenhum anexo neste work
637
+ item.".
638
+
639
+ **With `--download`, `data` is still the listing, untouched.** No local path and
640
+ no byte goes into the document. Each file written is reported on `stderr` as
641
+ `Gravado: <path>` — also under `--json`, since it is the only place the path of
642
+ each file appears.
643
+
644
+ ##### Exit codes
645
+
646
+ The general table above holds; this is how each condition maps to it:
647
+
648
+ | Code | When |
649
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
650
+ | `0` | The attachments were read — including a work item with no attachments |
651
+ | `1` | Missing `<ref>`; directory not linked and no `--project-id`; missing reference (`400`); not a member of the project (`403` — `not_member`, or `project_membership_required` with only "Ver todos os projetos"); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure; **with `--download`**, the download of one attachment refused (`403`), not found (`404`) or not writable to disk — what was written before the failure stays in `<dir>`, and `stderr` names it |
652
+ | `2` | The API rejected the token (`401`) — run `productdock login` again; with `--download`, also when it happens in the middle of the downloads, keeping what was already written |
653
+
550
654
  #### `productdock wi comment`
551
655
 
552
656
  Posts a comment on a work item, served by the `/cli/work-items/comments`
@@ -1115,10 +1219,13 @@ The general table above holds; this is how each condition maps to it:
1115
1219
 
1116
1220
  ### `productdock eval` — project evaluations
1117
1221
 
1118
- Served by the `/cli/evaluations` endpoint of the ProductDock API. It is the same
1119
- operation the MCP server exposes as the `submit_eval` tool, and it returns the
1120
- same body — the CLI and the MCP call the same code on the server, so the
1121
- envelope validation and the upsert are one implementation, not two.
1222
+ Served by the `/cli/evaluations` endpoints of the ProductDock API. They are the
1223
+ same operations the MCP server exposes as the `submit_eval` tool (`eval submit`,
1224
+ the write), the `get_eval_report` tool (`eval latest`, the read) and the
1225
+ `list_eval_repositories` tool (`eval list`, the evaluated repositories), and they
1226
+ return the same body — the CLI and the MCP call the same code on the server, so
1227
+ the envelope validation, the write and the report selection are one
1228
+ implementation, not two.
1122
1229
 
1123
1230
  It is the destination of the three eval skills — `pd-security-eval`,
1124
1231
  `pd-observability-eval`, `pd-frontend-audit-eval`. Each of them writes an
@@ -1126,18 +1233,30 @@ envelope (`schema_version` 1.0) to `latest.json` and a human report next to it;
1126
1233
  this command sends the envelope, and the file goes to the server untouched —
1127
1234
  not transcribed, not truncated.
1128
1235
 
1129
- **An evaluation belongs to a project, not to a repository or a work item.** Its
1130
- identity on the server is `(project_id, eval_type)`: submitting the same
1131
- `eval_type` again **replaces** the previous evaluation, it does not add a
1132
- version. In evals that produce one subfolder per backend plus a consolidated
1133
- report at the root, **submit only the consolidated one** — submitting each
1134
- backend would leave you with whichever one went last.
1135
-
1136
- **Submission requires the "Gerenciar avaliações do projeto" permission**
1137
- (`project.evaluations.manage`). Being a member of the project is no longer
1138
- enough: a call without the permission exits `1` with a `403`, and nothing is
1139
- written. Reading evaluations in the portal is unaffected — it still only needs
1140
- project membership.
1236
+ **An evaluation belongs to a project, not to a work item.** Every submission is
1237
+ an **execution**, versioned on the server by the evaluated repository and by
1238
+ `executed_at`: submitting the same `eval_type` again adds an execution to the
1239
+ history, it does not overwrite the previous one (resubmitting the very same
1240
+ envelope — same repository, same `executed_at` — is idempotent). Per
1241
+ `(project_id, eval_type)` the server also keeps the "latest" evaluation, which
1242
+ only moves forward with a submission as new as it or newer. In evals that
1243
+ produce one subfolder per backend plus a consolidated report at the root,
1244
+ **submit only the consolidated one**.
1245
+
1246
+ **`evaluation_id` is not `execution_id`.** `eval submit` returns
1247
+ `evaluation_id`, the id of the project's "latest" evaluation for that
1248
+ `eval_type` — stable across submissions. `eval latest` returns `execution_id`,
1249
+ the id of one execution of the history — the value `--execution-id` takes.
1250
+
1251
+ **Submission requires access to the project.** No named permission is
1252
+ required: a call from someone with no access to the project exits `1` with a
1253
+ `403`, and nothing is written.
1254
+
1255
+ **`--repository-id` is refused, not ignored.** The submission does not use the
1256
+ repository UUID: the repository of the execution comes from the envelope's
1257
+ label (`target.repositories[0]`) or, when the envelope carries none, from
1258
+ `--repository-name`. Passing `--repository-id` exits `1` before any network
1259
+ call.
1141
1260
 
1142
1261
  ```bash
1143
1262
  # The normal case: the envelope the skill just wrote
@@ -1149,6 +1268,16 @@ productdock eval submit .productdock/evals/observability/latest.json \
1149
1268
 
1150
1269
  # Label the evaluated repository when the envelope carries no target
1151
1270
  productdock eval submit latest.json --repository-name productdock-api
1271
+
1272
+ # Read the latest security evaluation of the project — the same report the Eval screen shows
1273
+ productdock eval latest --type security --json
1274
+
1275
+ # The latest execution of one evaluated repository, saved to a file
1276
+ productdock eval latest --type observability --repository productdock-api \
1277
+ --json --out eval-observability.json
1278
+
1279
+ # Which repositories have a security evaluation — the keys --repository takes
1280
+ productdock eval list --type security --json
1152
1281
  ```
1153
1282
 
1154
1283
  The subcommand also accepts `--json` and `--project-id`, documented once at the
@@ -1163,7 +1292,7 @@ top of this section.
1163
1292
  | Parameter | Description |
1164
1293
  | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1165
1294
  | `<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 |
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 |
1295
+ | `--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 the `project.repository` of `productdock.json` is not sent, and `--repository-id` is refused (exit `1`, before any network call) |
1167
1296
  | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1168
1297
 
1169
1298
  #### Response format
@@ -1186,7 +1315,7 @@ Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
1186
1315
  | Field | Meaning |
1187
1316
  | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1188
1317
  | `success` | Always `true` on a `0` exit |
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 |
1318
+ | `evaluation_id` | Id of the project's "latest" evaluation for the `eval_type`. It is **stable across submissions** of the same `(project, eval_type)`; the submission itself is recorded as an execution of the history, whose id (`execution_id`) is what `eval latest` returns — the two are different ids |
1190
1319
  | `project_id` | The project the evaluation was recorded under — the one the server authorized, not the one you asked for |
1191
1320
  | `eval_type` | `security`, `observability` or `frontend_quality`, read from the envelope |
1192
1321
 
@@ -1197,9 +1326,187 @@ The general table above holds; this is how each condition maps to it:
1197
1326
  | Code | When |
1198
1327
  | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1199
1328
  | `0` | The evaluation was recorded |
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 |
1329
+ | `1` | Missing `<file>`; unreadable file; the file is not a JSON object; `--repository-id` given (refused before any network call — the repository comes from the envelope or `--repository-name`); directory not linked and no `--project-id`; **invalid envelope (`400`) — the response names the offending field, and nothing was written**; no access to the project (`403`); any other API failure |
1201
1330
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1202
1331
 
1332
+ #### `productdock eval latest`
1333
+
1334
+ Reads the report of the most recent evaluation of the project for one
1335
+ `eval_type` — the score, rating, per-dimension scores, findings with
1336
+ `file:line`, `executed_at`, the evaluated repository and the `view` the Eval
1337
+ screen renders. Served by `GET /cli/evaluations/report`; it is the same
1338
+ operation the MCP server exposes as the `get_eval_report` tool, and it returns
1339
+ the same body.
1340
+
1341
+ **Only members of the project read it.** A portal client, a non-member and
1342
+ someone who only has "Ver todos os projetos" get a `403`, and the server reads
1343
+ as you, with your token. The `code` of the refusal depends on who you are: a
1344
+ non-member and a portal client get `not_member` (the API's access check, which
1345
+ runs before the operation's own gate); someone who only has "Ver todos os
1346
+ projetos" passes that check and gets `project_membership_required`. Over the
1347
+ MCP, the `get_eval_report` tool answers `project_membership_required` to all
1348
+ three. Every one of them exits `1` — treat both codes as the same refusal.
1349
+
1350
+ Without `--repository` no repository is sent — the `project.repository` of
1351
+ `productdock.json` does **not** go along — and the answer is the latest
1352
+ execution of the type, whatever the repository. `--repository` takes the
1353
+ `repository_key` a previous answer brought; it is sent as is, not normalized.
1354
+
1355
+ **`--repository-id` is refused, not ignored.** It is the repository _UUID_, and
1356
+ the evaluation is not filtered by it: passing it exits `1` before any network
1357
+ call, pointing to `--repository <key>` and to `productdock eval list --type
1358
+ <eval_type>` for the keys. It is not translated into a `repository_key`.
1359
+
1360
+ ```bash
1361
+ # The latest security evaluation of the project
1362
+ productdock eval latest --type security --json
1363
+
1364
+ # One execution of the history, by id
1365
+ productdock eval latest --type security --execution-id <execution_id> --json
1366
+ ```
1367
+
1368
+ ##### Parameters
1369
+
1370
+ | Subcommand | Argument | Options |
1371
+ | ---------- | -------- | ---------------------------------------------------------- |
1372
+ | `latest` | — | `--type` · `--repository` · `--execution-id` · `--out` |
1373
+
1374
+ | Parameter | Description |
1375
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1376
+ | `--type <eval_type>` | **Required.** `security`, `observability`, `frontend_quality` or `backend_quality`. Sent as typed — the list of types is the server's, and an unknown type comes back as a `400` naming the options |
1377
+ | `--repository <key>` | The `repository_key` of a previous answer: the latest execution of that repository. Not a UUID and not the `--repository-name` label |
1378
+ | `--execution-id <id>` | The `execution_id` of a previous answer: that execution. It is **not** the `evaluation_id` that `eval submit` returns |
1379
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1380
+
1381
+ ##### Response format
1382
+
1383
+ Under `--json`, `stdout` carries one document with the API response untouched
1384
+ under `data`:
1385
+
1386
+ ```jsonc
1387
+ {
1388
+ "ok": true,
1389
+ "operation": "get_eval_report",
1390
+ "data": {
1391
+ /* the body below — or null */
1392
+ },
1393
+ }
1394
+ ```
1395
+
1396
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: score and
1397
+ rating, `executed_at`, the repository and the `execution_id`. The repository is
1398
+ shown by its `repository_key` — the value `--repository` takes — with the label
1399
+ next to it in quotes when the two differ (`agent-api (rótulo "Agent-API ")`), so
1400
+ a trailing space in the label is visible and is not mistaken for the key.
1401
+
1402
+ `data` is the evaluation envelope as the eval skill submitted it (`eval_type`,
1403
+ `score`, `rating`, `executed_at`, `dimensions`, `findings`, `counts`, …), plus:
1404
+
1405
+ | Field | Meaning |
1406
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1407
+ | `execution_id` | Id of the execution that was read — the value `--execution-id` takes |
1408
+ | `repository_key` | Key of the evaluated repository — the value `--repository` takes |
1409
+ | `repository_label` | Label of the evaluated repository, as the skill sent it |
1410
+ | `view` | The findings as the Eval screen shows them: `categories` (dimension, label, score), `findings` (id, title, severity, category, `location` `{ file, line }`, linked `work_item`), `positives` and `totals` |
1411
+
1412
+ **No evaluation is a success, not an error.** When the project has no
1413
+ evaluation of that type (or none for that repository, or no such execution),
1414
+ the API answers `200` with `null`: `data` is `null`, the exit code is `0`, and
1415
+ the summary on `stderr` tells the two cases apart. Without `--repository` and
1416
+ `--execution-id`, it says the project has no evaluation of that type. With
1417
+ either of them, it says only that no execution matched that filter — the type
1418
+ may well have executions of other repositories — and points to
1419
+ `productdock eval list --type <eval_type>` for the keys `--repository` takes.
1420
+
1421
+ ##### Exit codes
1422
+
1423
+ The general table above holds; this is how each condition maps to it:
1424
+
1425
+ | Code | When |
1426
+ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1427
+ | `0` | The report was read — including no evaluation (`data: null`) |
1428
+ | `1` | Missing `--type`; `--repository-id` given (refused before any network call — use `--repository <key>`); directory not linked and no `--project-id`; invalid parameter (`400` — unknown `eval_type`, malformed `execution_id`); not a member of the project (`403` — `not_member`, or `project_membership_required` with only "Ver todos os projetos"); any other API failure |
1429
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1430
+
1431
+ #### `productdock eval list`
1432
+
1433
+ Lists the repositories of the project that have an evaluation of one
1434
+ `eval_type` — the most recently executed first. Served by
1435
+ `GET /cli/evaluations/repositories`; it is the same operation the MCP server
1436
+ exposes as the `list_eval_repositories` tool, and it returns the same body —
1437
+ the one the repository filter of the Eval screen gets.
1438
+
1439
+ It is how you find out what to pass to `eval latest --repository`: the `key` of
1440
+ each item is that `repository_key`.
1441
+
1442
+ **Only members of the project read it**, exactly as `eval latest`: a portal
1443
+ client, a non-member and someone who only has "Ver todos os projetos" get a
1444
+ `403` — `not_member` for the first two, `project_membership_required` for the
1445
+ third, the same codes as `eval latest` — and the server reads as you, with your
1446
+ token. No repository is sent — the `project.repository` of `productdock.json`
1447
+ does **not** go along — and `--repository-id` is refused exactly as in
1448
+ `eval latest`: exit `1` before any network call.
1449
+
1450
+ ```bash
1451
+ # The evaluated repositories of the project, for one type
1452
+ productdock eval list --type security
1453
+
1454
+ # Machine-readable, saved to a file
1455
+ productdock eval list --type observability --json --out eval-repositories.json
1456
+ ```
1457
+
1458
+ ##### Parameters
1459
+
1460
+ | Subcommand | Argument | Options |
1461
+ | ---------- | -------- | -------------------- |
1462
+ | `list` | — | `--type` · `--out` |
1463
+
1464
+ | Parameter | Description |
1465
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1466
+ | `--type <eval_type>` | **Required.** `security`, `observability`, `frontend_quality` or `backend_quality`. Sent as typed — the list of types is the server's, and an unknown type comes back as a `400` naming the options |
1467
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1468
+
1469
+ ##### Response format
1470
+
1471
+ Under `--json`, `stdout` carries one document with the API response untouched
1472
+ under `data`:
1473
+
1474
+ ```jsonc
1475
+ {
1476
+ "ok": true,
1477
+ "operation": "list_eval_repositories",
1478
+ "data": [
1479
+ /* one entry per repository, as below */
1480
+ ],
1481
+ }
1482
+ ```
1483
+
1484
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
1485
+ per repository — key, label, number of executions and the date of the latest.
1486
+
1487
+ `data` is an array, the repository of the most recent execution first:
1488
+
1489
+ | Field | Meaning |
1490
+ | ---------------- | ------------------------------------------------------------------------------------------------- |
1491
+ | `key` | The `repository_key` — the value `eval latest --repository` takes |
1492
+ | `label` | Label of the repository in its most recent execution; `sem repositório` when the skill sent none |
1493
+ | `executionCount` | How many executions of the type the repository has |
1494
+ | `lastExecutedAt` | `executed_at` of its most recent execution |
1495
+
1496
+ **Nothing evaluated is a success, not an error.** When the project has no
1497
+ evaluation of that type, the API answers `200` with `[]`: `data` is `[]`, the
1498
+ exit code is `0`, and the summary on `stderr` says no repository was evaluated.
1499
+
1500
+ ##### Exit codes
1501
+
1502
+ The general table above holds; this is how each condition maps to it:
1503
+
1504
+ | Code | When |
1505
+ | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1506
+ | `0` | The list was read — including an empty one (`data: []`) |
1507
+ | `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
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1509
+
1203
1510
  ### `productdock state` — the SDLC state of a work item
1204
1511
 
1205
1512
  Served by the `/cli/state` endpoints of the ProductDock API. They are the same
@@ -1672,17 +1979,17 @@ bun test test/output.test.ts
1672
1979
  | `lib/git.ts` | `origin` remote detection, Azure DevOps URL parsing (SSH, HTTPS, legacy), and the worktree helpers of `watch` |
1673
1980
  | `lib/ide.ts` | IDE detection and MCP config writing |
1674
1981
  | `lib/registry.ts` | Registry HTTP client — one code path for skills and agents, `?branch=` |
1675
- | `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, HTTP status kept in the error |
1982
+ | `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, binary download, HTTP status kept in the error |
1676
1983
  | `lib/scope.ts` | Project scope — `project_id`/`repository_id` from `productdock.json`, flags override |
1677
1984
  | `lib/artifacts.ts` | Install core: destinations, zip extraction, SHA256 fingerprint, drift |
1678
1985
  | `lib/frontmatter.ts` | Frontmatter adaptation per platform (agents) — port of the ai-tools installer |
1679
1986
  | `lib/artifact-commands.ts` | The `skill` and `agent` command groups, generic over artifact kind |
1680
- | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context`, `bugs` and `prototypes` over `/cli/work-items/*` |
1987
+ | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context`, `bugs`, `prototypes` and `attachments` (with `--download`) over `/cli/work-items/*` |
1681
1988
  | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
1682
1989
  | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
1683
1990
  | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
1684
1991
  | `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
1685
- | `lib/evaluations.ts` | The `eval` command group — `submit` over `/cli/evaluations`, envelope from a file, project-level |
1992
+ | `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 |
1686
1993
  | `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 |
1687
1994
  | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim`, `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
1688
1995
  | `lib/watch.ts` | The `watch` command — the PRD Tech Review runner: disposable worktree, the two Claude Code stages, heartbeat — no question during the round |