@softdesignbrasil/productdock-cli 0.9.3 → 0.12.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 +394 -35
  2. package/dist/productdock.js +102 -102
  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
@@ -178,7 +186,7 @@ productdock logout
178
186
 
179
187
  ### `productdock link`
180
188
 
181
- 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:
189
+ 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:
182
190
 
183
191
  1. write the MCP configuration for your IDEs, and
184
192
  2. install every skill and agent published under the `productdock` category.
@@ -189,19 +197,34 @@ productdock link
189
197
  # Skip interactive project selection
190
198
  productdock link --project-id <uuid>
191
199
 
192
- # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts)
200
+ # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts).
201
+ # Run inside the repository: the repository comes from its git remote
202
+ productdock link --project-id <uuid> --ide claude-code --yes --json
203
+
204
+ # Pin the repository explicitly, wherever you run it
193
205
  productdock link --project-id <uuid> --repository-id <uuid> --ide claude-code --yes --json
194
206
  ```
195
207
 
208
+ #### How the repository is chosen
209
+
210
+ In this order, and the first rule that decides wins:
211
+
212
+ 1. `--repository-id` — that repository, or the command is refused when the id is not in the project.
213
+ 2. The project has no repository — the link is written without one.
214
+ 3. The project has exactly one repository — that one.
215
+ 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.
216
+ 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.
217
+
196
218
  Every point where `link` would ask a question has a flag, so the command runs
197
219
  to completion in a process with no terminal — the way an IDE agent executes
198
220
  step 2 of the prompt copied from the "Connect to your IDE" drawer. Without a
199
221
  TTY and with no flag, each install decision takes the same value the prompt
200
222
  offered by default (yes); `--no-install-mcp` / `--no-install-skills` opt out.
201
- When the project has more than one repository and no `--repository-id` is
202
- given, the link is written **without** a repository (a valid state — every
203
- operation that needs one asks for `--repository-id` at the point of use) and
204
- the accepted ids are printed to `stderr`.
223
+ When the project has more than one repository, no `--repository-id` is given
224
+ and the git remote matches none of them, the link is written **without** a
225
+ repository (a valid state — every operation that needs one asks for
226
+ `--repository-id` at the point of use), the exit code is still `0`, and the
227
+ accepted ids are printed to `stderr`.
205
228
 
206
229
  Nothing is written until every decision is made: a `link` that fails leaves the
207
230
  directory exactly as it was, instead of a `productdock.json` carrying only the
@@ -211,7 +234,7 @@ project.
211
234
  | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
212
235
  | `--project-id <uuid>` | Skip interactive project selection |
213
236
  | `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
214
- | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Replaces running `productdock init`, which needs a terminal |
237
+ | `--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 |
215
238
  | `--install-mcp` | Install the MCP configuration without asking |
216
239
  | `--no-install-mcp` | Do not install the MCP configuration |
217
240
  | `--install-skills` | Install skills and agents without asking |
@@ -284,6 +307,13 @@ productdock skill install pd-workflow --version 1.4.0
284
307
  # Overwrite something already on disk
285
308
  productdock skill install pd-workflow --force
286
309
 
310
+ # Install every item of one source — what `link` installs, on demand
311
+ productdock agent install --source productdock
312
+ productdock skill install --source productdock --json
313
+
314
+ # Same, overwriting what is already on disk
315
+ productdock agent install --source productdock --force
316
+
287
317
  # Update one, or everything installed
288
318
  productdock skill update pd-workflow
289
319
  productdock agent update
@@ -299,10 +329,37 @@ productdock agent status
299
329
  | Subcommand | Description |
300
330
  | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
301
331
  | `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
302
- | `install <name>` | Install into every target derived from `productdock.json`. `--version <version>`. Refuses if it already exists on disk unless `--force` |
332
+ | `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 |
303
333
  | `update [name]` | Update one, or every installed item. Up-to-date and locally modified items are skipped unless `--force` |
304
334
  | `status` | Report `up to date` / `outdated` / `modified` per installed item |
305
335
 
336
+ `install` takes **either** a name **or** `--source`: both together, or neither,
337
+ is a usage error (exit `1`). A source outside `internal`, `third-party` and
338
+ `productdock` is refused (exit `1`), naming the accepted values. The source is
339
+ the registry's `category` — the same dimension `list --source` filters by.
340
+
341
+ Under `--json`, `install --source` reports the effect item by item:
342
+
343
+ ```jsonc
344
+ {
345
+ "ok": true,
346
+ "operation": "agent_install", // or "skill_install"
347
+ "data": {
348
+ "kind": "agent",
349
+ "source": "productdock",
350
+ "targets": ["claude", "copilot"],
351
+ "installed": ["pd-reviewer"], // written now
352
+ "skipped": ["pd-planner"], // already installed, left untouched (no --force); an empty or partial folder is reinstalled
353
+ "failed": [], // the registry refused it
354
+ },
355
+ }
356
+ ```
357
+
358
+ A partial batch is a success (exit `0`) — `failed` names what is missing. When
359
+ **nothing** was installed and something failed (the registry is down, every
360
+ download refused), the command exits `1` — or `2` when the cause is the
361
+ session — with the error document instead.
362
+
306
363
  `status` compares a SHA256 fingerprint of the installed directory against the versions the registry knows about:
307
364
 
308
365
  | Symbol | Meaning |
@@ -316,9 +373,9 @@ productdock agent status
316
373
 
317
374
  ### `productdock wi` — work items
318
375
 
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 —
376
+ Eight operations over the work items of a project, served by the
377
+ `/cli/work-items/*` endpoints of the ProductDock API. Six of them read
378
+ (`list`, `prd`, `spec-context`, `bugs`, `prototypes`, `attachments`); two of them write to the work item —
322
379
  `comment` posts a comment, `evidence` uploads a QA screenshot. Each has its own
323
380
  subsection below.
324
381
 
@@ -547,6 +604,102 @@ The general table above holds; this is how each condition maps to it:
547
604
  | `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
605
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
549
606
 
607
+ #### `productdock wi attachments`
608
+
609
+ Lists the attachments of a work item — the files on its **Attachments** tab
610
+ (images, PDF, CSV, spreadsheets), served by the `/cli/work-items/attachments`
611
+ endpoint of the ProductDock API, and with `--download <dir>` saves their bytes
612
+ to disk, served by `/cli/work-items/attachments/content`. It is the same operation the MCP server
613
+ exposes as the `get_work_item_attachments` tool, and it returns the same body —
614
+ the CLI and the MCP call the same code on the server, so the ordering, the
615
+ author lookup and the signed read URLs are one implementation, not two.
616
+
617
+ **An attachment belongs to the work item, not to a repository.** The
618
+ `project.repository` of `productdock.json` is **not** sent, exactly as in
619
+ `wi prototypes`.
620
+
621
+ **Only members of the project read it.** The server reads as you, with your
622
+ token. A non-member and a portal client get a `403` with `not_member`; someone
623
+ who only has "Ver todos os projetos" gets a `403` with
624
+ `project_membership_required`. Every one of them exits `1`.
625
+
626
+ ```bash
627
+ # Every attachment of the work item, most recent first
628
+ productdock wi attachments PROD-261
629
+
630
+ # Machine-readable, saved to a file
631
+ productdock wi attachments PROD-261 --json --out attachments.json
632
+
633
+ # Save the bytes of every attachment under ./attachments (created if missing)
634
+ productdock wi attachments PROD-261 --download ./attachments
635
+
636
+ # Same, machine-readable: the document is the listing, the saved paths go to stderr
637
+ productdock wi attachments PROD-261 --download ./attachments --json
638
+ ```
639
+
640
+ ##### Parameters
641
+
642
+ | Subcommand | Argument | Options |
643
+ | ------------------- | -------- | -------------------------------- |
644
+ | `attachments <ref>` | `<ref>` | `--download <dir>` · `--out <file>` |
645
+
646
+ | Parameter | Description |
647
+ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
648
+ | `<ref>` | **Required.** Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
649
+ | `--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` |
650
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
651
+
652
+ ##### Response format
653
+
654
+ Under `--json`, `stdout` carries one document with the API response under
655
+ `data`:
656
+
657
+ ```jsonc
658
+ {
659
+ "ok": true,
660
+ "operation": "get_work_item_attachments",
661
+ "data": {
662
+ /* the body below */
663
+ },
664
+ }
665
+ ```
666
+
667
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
668
+ per attachment — name, MIME type, size, date and author.
669
+
670
+ `data` is `{ work_item_id, count, attachments[] }`:
671
+
672
+ | Field | Meaning |
673
+ | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
674
+ | `work_item_id` | The work item the reference resolved to |
675
+ | `count` | How many attachments came back — always `attachments.length` |
676
+ | `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) |
677
+
678
+ `signed_url` is meant for an agent over MCP. Under `--json` its token comes out
679
+ masked (`token=***`), like every token the CLI writes — so it cannot be used
680
+ from here: to get the files, use `--download <dir>`. When the server could not sign one attachment, that item comes back
681
+ with `signed_url: null` and `expires_in: null`, and the rest of the list is
682
+ unaffected.
683
+
684
+ A work item with no attachments returns `count: 0` and `attachments: []`, which
685
+ is a **success**, not an error — the summary says "Nenhum anexo neste work
686
+ item.".
687
+
688
+ **With `--download`, `data` is still the listing, untouched.** No local path and
689
+ no byte goes into the document. Each file written is reported on `stderr` as
690
+ `Gravado: <path>` — also under `--json`, since it is the only place the path of
691
+ each file appears.
692
+
693
+ ##### Exit codes
694
+
695
+ The general table above holds; this is how each condition maps to it:
696
+
697
+ | Code | When |
698
+ | ---- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
699
+ | `0` | The attachments were read — including a work item with no attachments |
700
+ | `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 |
701
+ | `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 |
702
+
550
703
  #### `productdock wi comment`
551
704
 
552
705
  Posts a comment on a work item, served by the `/cli/work-items/comments`
@@ -1115,10 +1268,13 @@ The general table above holds; this is how each condition maps to it:
1115
1268
 
1116
1269
  ### `productdock eval` — project evaluations
1117
1270
 
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.
1271
+ Served by the `/cli/evaluations` endpoints of the ProductDock API. They are the
1272
+ same operations the MCP server exposes as the `submit_eval` tool (`eval submit`,
1273
+ the write), the `get_eval_report` tool (`eval latest`, the read) and the
1274
+ `list_eval_repositories` tool (`eval list`, the evaluated repositories), and they
1275
+ return the same body — the CLI and the MCP call the same code on the server, so
1276
+ the envelope validation, the write and the report selection are one
1277
+ implementation, not two.
1122
1278
 
1123
1279
  It is the destination of the three eval skills — `pd-security-eval`,
1124
1280
  `pd-observability-eval`, `pd-frontend-audit-eval`. Each of them writes an
@@ -1126,18 +1282,30 @@ envelope (`schema_version` 1.0) to `latest.json` and a human report next to it;
1126
1282
  this command sends the envelope, and the file goes to the server untouched —
1127
1283
  not transcribed, not truncated.
1128
1284
 
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.
1285
+ **An evaluation belongs to a project, not to a work item.** Every submission is
1286
+ an **execution**, versioned on the server by the evaluated repository and by
1287
+ `executed_at`: submitting the same `eval_type` again adds an execution to the
1288
+ history, it does not overwrite the previous one (resubmitting the very same
1289
+ envelope — same repository, same `executed_at` — is idempotent). Per
1290
+ `(project_id, eval_type)` the server also keeps the "latest" evaluation, which
1291
+ only moves forward with a submission as new as it or newer. In evals that
1292
+ produce one subfolder per backend plus a consolidated report at the root,
1293
+ **submit only the consolidated one**.
1294
+
1295
+ **`evaluation_id` is not `execution_id`.** `eval submit` returns
1296
+ `evaluation_id`, the id of the project's "latest" evaluation for that
1297
+ `eval_type` — stable across submissions. `eval latest` returns `execution_id`,
1298
+ the id of one execution of the history — the value `--execution-id` takes.
1299
+
1300
+ **Submission requires access to the project.** No named permission is
1301
+ required: a call from someone with no access to the project exits `1` with a
1302
+ `403`, and nothing is written.
1303
+
1304
+ **`--repository-id` is refused, not ignored.** The submission does not use the
1305
+ repository UUID: the repository of the execution comes from the envelope's
1306
+ label (`target.repositories[0]`) or, when the envelope carries none, from
1307
+ `--repository-name`. Passing `--repository-id` exits `1` before any network
1308
+ call.
1141
1309
 
1142
1310
  ```bash
1143
1311
  # The normal case: the envelope the skill just wrote
@@ -1149,6 +1317,16 @@ productdock eval submit .productdock/evals/observability/latest.json \
1149
1317
 
1150
1318
  # Label the evaluated repository when the envelope carries no target
1151
1319
  productdock eval submit latest.json --repository-name productdock-api
1320
+
1321
+ # Read the latest security evaluation of the project — the same report the Eval screen shows
1322
+ productdock eval latest --type security --json
1323
+
1324
+ # The latest execution of one evaluated repository, saved to a file
1325
+ productdock eval latest --type observability --repository productdock-api \
1326
+ --json --out eval-observability.json
1327
+
1328
+ # Which repositories have a security evaluation — the keys --repository takes
1329
+ productdock eval list --type security --json
1152
1330
  ```
1153
1331
 
1154
1332
  The subcommand also accepts `--json` and `--project-id`, documented once at the
@@ -1163,7 +1341,7 @@ top of this section.
1163
1341
  | Parameter | Description |
1164
1342
  | -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1165
1343
  | `<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 |
1344
+ | `--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
1345
  | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1168
1346
 
1169
1347
  #### Response format
@@ -1186,7 +1364,7 @@ Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
1186
1364
  | Field | Meaning |
1187
1365
  | --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1188
1366
  | `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 |
1367
+ | `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
1368
  | `project_id` | The project the evaluation was recorded under — the one the server authorized, not the one you asked for |
1191
1369
  | `eval_type` | `security`, `observability` or `frontend_quality`, read from the envelope |
1192
1370
 
@@ -1197,9 +1375,187 @@ The general table above holds; this is how each condition maps to it:
1197
1375
  | Code | When |
1198
1376
  | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1199
1377
  | `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 |
1378
+ | `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
1379
  | `2` | The API rejected the token (`401`) — run `productdock login` again |
1202
1380
 
1381
+ #### `productdock eval latest`
1382
+
1383
+ Reads the report of the most recent evaluation of the project for one
1384
+ `eval_type` — the score, rating, per-dimension scores, findings with
1385
+ `file:line`, `executed_at`, the evaluated repository and the `view` the Eval
1386
+ screen renders. Served by `GET /cli/evaluations/report`; it is the same
1387
+ operation the MCP server exposes as the `get_eval_report` tool, and it returns
1388
+ the same body.
1389
+
1390
+ **Only members of the project read it.** A portal client, a non-member and
1391
+ someone who only has "Ver todos os projetos" get a `403`, and the server reads
1392
+ as you, with your token. The `code` of the refusal depends on who you are: a
1393
+ non-member and a portal client get `not_member` (the API's access check, which
1394
+ runs before the operation's own gate); someone who only has "Ver todos os
1395
+ projetos" passes that check and gets `project_membership_required`. Over the
1396
+ MCP, the `get_eval_report` tool answers `project_membership_required` to all
1397
+ three. Every one of them exits `1` — treat both codes as the same refusal.
1398
+
1399
+ Without `--repository` no repository is sent — the `project.repository` of
1400
+ `productdock.json` does **not** go along — and the answer is the latest
1401
+ execution of the type, whatever the repository. `--repository` takes the
1402
+ `repository_key` a previous answer brought; it is sent as is, not normalized.
1403
+
1404
+ **`--repository-id` is refused, not ignored.** It is the repository _UUID_, and
1405
+ the evaluation is not filtered by it: passing it exits `1` before any network
1406
+ call, pointing to `--repository <key>` and to `productdock eval list --type
1407
+ <eval_type>` for the keys. It is not translated into a `repository_key`.
1408
+
1409
+ ```bash
1410
+ # The latest security evaluation of the project
1411
+ productdock eval latest --type security --json
1412
+
1413
+ # One execution of the history, by id
1414
+ productdock eval latest --type security --execution-id <execution_id> --json
1415
+ ```
1416
+
1417
+ ##### Parameters
1418
+
1419
+ | Subcommand | Argument | Options |
1420
+ | ---------- | -------- | ---------------------------------------------------------- |
1421
+ | `latest` | — | `--type` · `--repository` · `--execution-id` · `--out` |
1422
+
1423
+ | Parameter | Description |
1424
+ | --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1425
+ | `--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 |
1426
+ | `--repository <key>` | The `repository_key` of a previous answer: the latest execution of that repository. Not a UUID and not the `--repository-name` label |
1427
+ | `--execution-id <id>` | The `execution_id` of a previous answer: that execution. It is **not** the `evaluation_id` that `eval submit` returns |
1428
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1429
+
1430
+ ##### Response format
1431
+
1432
+ Under `--json`, `stdout` carries one document with the API response untouched
1433
+ under `data`:
1434
+
1435
+ ```jsonc
1436
+ {
1437
+ "ok": true,
1438
+ "operation": "get_eval_report",
1439
+ "data": {
1440
+ /* the body below — or null */
1441
+ },
1442
+ }
1443
+ ```
1444
+
1445
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: score and
1446
+ rating, `executed_at`, the repository and the `execution_id`. The repository is
1447
+ shown by its `repository_key` — the value `--repository` takes — with the label
1448
+ next to it in quotes when the two differ (`agent-api (rótulo "Agent-API ")`), so
1449
+ a trailing space in the label is visible and is not mistaken for the key.
1450
+
1451
+ `data` is the evaluation envelope as the eval skill submitted it (`eval_type`,
1452
+ `score`, `rating`, `executed_at`, `dimensions`, `findings`, `counts`, …), plus:
1453
+
1454
+ | Field | Meaning |
1455
+ | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1456
+ | `execution_id` | Id of the execution that was read — the value `--execution-id` takes |
1457
+ | `repository_key` | Key of the evaluated repository — the value `--repository` takes |
1458
+ | `repository_label` | Label of the evaluated repository, as the skill sent it |
1459
+ | `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` |
1460
+
1461
+ **No evaluation is a success, not an error.** When the project has no
1462
+ evaluation of that type (or none for that repository, or no such execution),
1463
+ the API answers `200` with `null`: `data` is `null`, the exit code is `0`, and
1464
+ the summary on `stderr` tells the two cases apart. Without `--repository` and
1465
+ `--execution-id`, it says the project has no evaluation of that type. With
1466
+ either of them, it says only that no execution matched that filter — the type
1467
+ may well have executions of other repositories — and points to
1468
+ `productdock eval list --type <eval_type>` for the keys `--repository` takes.
1469
+
1470
+ ##### Exit codes
1471
+
1472
+ The general table above holds; this is how each condition maps to it:
1473
+
1474
+ | Code | When |
1475
+ | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1476
+ | `0` | The report was read — including no evaluation (`data: null`) |
1477
+ | `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 |
1478
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1479
+
1480
+ #### `productdock eval list`
1481
+
1482
+ Lists the repositories of the project that have an evaluation of one
1483
+ `eval_type` — the most recently executed first. Served by
1484
+ `GET /cli/evaluations/repositories`; it is the same operation the MCP server
1485
+ exposes as the `list_eval_repositories` tool, and it returns the same body —
1486
+ the one the repository filter of the Eval screen gets.
1487
+
1488
+ It is how you find out what to pass to `eval latest --repository`: the `key` of
1489
+ each item is that `repository_key`.
1490
+
1491
+ **Only members of the project read it**, exactly as `eval latest`: a portal
1492
+ client, a non-member and someone who only has "Ver todos os projetos" get a
1493
+ `403` — `not_member` for the first two, `project_membership_required` for the
1494
+ third, the same codes as `eval latest` — and the server reads as you, with your
1495
+ token. No repository is sent — the `project.repository` of `productdock.json`
1496
+ does **not** go along — and `--repository-id` is refused exactly as in
1497
+ `eval latest`: exit `1` before any network call.
1498
+
1499
+ ```bash
1500
+ # The evaluated repositories of the project, for one type
1501
+ productdock eval list --type security
1502
+
1503
+ # Machine-readable, saved to a file
1504
+ productdock eval list --type observability --json --out eval-repositories.json
1505
+ ```
1506
+
1507
+ ##### Parameters
1508
+
1509
+ | Subcommand | Argument | Options |
1510
+ | ---------- | -------- | -------------------- |
1511
+ | `list` | — | `--type` · `--out` |
1512
+
1513
+ | Parameter | Description |
1514
+ | -------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1515
+ | `--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 |
1516
+ | `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
1517
+
1518
+ ##### Response format
1519
+
1520
+ Under `--json`, `stdout` carries one document with the API response untouched
1521
+ under `data`:
1522
+
1523
+ ```jsonc
1524
+ {
1525
+ "ok": true,
1526
+ "operation": "list_eval_repositories",
1527
+ "data": [
1528
+ /* one entry per repository, as below */
1529
+ ],
1530
+ }
1531
+ ```
1532
+
1533
+ Without `--json`, `stdout` stays empty and a summary goes to `stderr`: one line
1534
+ per repository — key, label, number of executions and the date of the latest.
1535
+
1536
+ `data` is an array, the repository of the most recent execution first:
1537
+
1538
+ | Field | Meaning |
1539
+ | ---------------- | ------------------------------------------------------------------------------------------------- |
1540
+ | `key` | The `repository_key` — the value `eval latest --repository` takes |
1541
+ | `label` | Label of the repository in its most recent execution; `sem repositório` when the skill sent none |
1542
+ | `executionCount` | How many executions of the type the repository has |
1543
+ | `lastExecutedAt` | `executed_at` of its most recent execution |
1544
+
1545
+ **Nothing evaluated is a success, not an error.** When the project has no
1546
+ evaluation of that type, the API answers `200` with `[]`: `data` is `[]`, the
1547
+ exit code is `0`, and the summary on `stderr` says no repository was evaluated.
1548
+
1549
+ ##### Exit codes
1550
+
1551
+ The general table above holds; this is how each condition maps to it:
1552
+
1553
+ | Code | When |
1554
+ | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
1555
+ | `0` | The list was read — including an empty one (`data: []`) |
1556
+ | `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
+ | `2` | The API rejected the token (`401`) — run `productdock login` again |
1558
+
1203
1559
  ### `productdock state` — the SDLC state of a work item
1204
1560
 
1205
1561
  Served by the `/cli/state` endpoints of the ProductDock API. They are the same
@@ -1511,9 +1867,12 @@ Checks performed:
1511
1867
  3. `productdock.json` exists with an IDE list
1512
1868
  4. The directory is linked to a ProductDock project
1513
1869
  5. MCP server is reachable
1514
- 6. MCP config files exist for each configured IDE and point at the correct URL
1870
+ 6. MCP config files exist for each configured IDE, point at the correct URL and carry the project and repository of the
1871
+ current link — after re-linking to another repository, `--fix` rewrites them. The MCP is legacy and optional: in a
1872
+ directory that never configured it (no `mcp` in `productdock.json`, no `productdock` entry in any IDE file, as after
1873
+ `link --no-install-mcp`) this check passes and `--fix` does not install it
1515
1874
  7. `AI_TOOLS_BRANCH` is not silently overriding the skill/agent source
1516
- 8. Every skill and agent recorded in `productdock.json` is present on disk
1875
+ 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
1517
1876
 
1518
1877
  ---
1519
1878
 
@@ -1672,17 +2031,17 @@ bun test test/output.test.ts
1672
2031
  | `lib/git.ts` | `origin` remote detection, Azure DevOps URL parsing (SSH, HTTPS, legacy), and the worktree helpers of `watch` |
1673
2032
  | `lib/ide.ts` | IDE detection and MCP config writing |
1674
2033
  | `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 |
2034
+ | `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, binary download, HTTP status kept in the error |
1676
2035
  | `lib/scope.ts` | Project scope — `project_id`/`repository_id` from `productdock.json`, flags override |
1677
2036
  | `lib/artifacts.ts` | Install core: destinations, zip extraction, SHA256 fingerprint, drift |
1678
2037
  | `lib/frontmatter.ts` | Frontmatter adaptation per platform (agents) — port of the ai-tools installer |
1679
2038
  | `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/*` |
2039
+ | `lib/work-items.ts` | The `wi` command group — `list`, `prd`, `spec-context`, `bugs`, `prototypes` and `attachments` (with `--download`) over `/cli/work-items/*` |
1681
2040
  | `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
1682
2041
  | `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
1683
2042
  | `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
1684
2043
  | `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 |
2044
+ | `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
2045
  | `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
2046
  | `lib/prd-review-jobs.ts` | Tech Review queue client — `claim`, `heartbeat`, `release` and `finish` over `/cli/prd-review-jobs/*` |
1688
2047
  | `lib/watch.ts` | The `watch` command — the PRD Tech Review runner: disposable worktree, the two Claude Code stages, heartbeat — no question during the round |