@softdesignbrasil/productdock-cli 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1170 -34
- package/dist/productdock.js +198 -189
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# ProductDock CLI
|
|
2
2
|
|
|
3
|
-
Official CLI for [ProductDock](https://productdock.softdesign.com.br) — connects your local development environment to the ProductDock platform
|
|
3
|
+
Official CLI for [ProductDock](https://productdock.softdesign.com.br) — connects your local development environment to the ProductDock platform, handling authentication, project linking, IDE configuration, the installation of shared **skills** and **agents**, and the SDLC operations themselves.
|
|
4
|
+
|
|
5
|
+
**There are two channels into the platform, and both are current.** The CLI authenticates on its own and calls the project endpoints (`/cli/*`) of the ProductDock API directly — that is every command under [Commands](#commands). The **MCP server stays up**, serving the same operations to the IDEs that speak it; `productdock mcp setup` is what points an IDE at it. The two share one OAuth flow, one session and one implementation on the server — see [How authentication works](#how-authentication-works). Pick the channel per call: the CLI is the one that can read a file from your disk and send it untouched.
|
|
4
6
|
|
|
5
7
|
## Installation
|
|
6
8
|
|
|
@@ -35,21 +37,24 @@ irm https://raw.githubusercontent.com/softdesignbrasil/productdock-cli/main/inst
|
|
|
35
37
|
|
|
36
38
|
Binaries are available for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, and `windows-x64` on the [Releases page](https://github.com/softdesignbrasil/productdock-cli/releases).
|
|
37
39
|
|
|
40
|
+
> **This option is not verified.** `install.sh` and `install.ps1` do not exist in this repository, and the release pipeline is Azure DevOps (`azure-pipelines.yml`), which delegates the whole stage to the `productdock-devops` repository — nothing here publishes to a GitHub Releases page. Until installation in the target environments is settled, use option 1 or 2. The binaries themselves do build locally: see [Building](#building).
|
|
41
|
+
|
|
38
42
|
---
|
|
39
43
|
|
|
40
44
|
## Quick Start
|
|
41
45
|
|
|
42
46
|
```bash
|
|
43
|
-
# 1.
|
|
47
|
+
# 1. Declare which IDEs your team uses (writes productdock.json)
|
|
48
|
+
productdock init
|
|
49
|
+
|
|
50
|
+
# 2. Authenticate with your Azure AD account
|
|
44
51
|
productdock login
|
|
45
52
|
|
|
46
|
-
#
|
|
53
|
+
# 3. Link the directory to a ProductDock project
|
|
54
|
+
# Offers to set up MCP and install the ProductDock skills + agents
|
|
47
55
|
cd my-project
|
|
48
56
|
productdock link
|
|
49
57
|
|
|
50
|
-
# 3. Write MCP configuration for your IDEs
|
|
51
|
-
productdock mcp setup
|
|
52
|
-
|
|
53
58
|
# 4. Verify everything is working
|
|
54
59
|
productdock doctor
|
|
55
60
|
```
|
|
@@ -58,6 +63,96 @@ productdock doctor
|
|
|
58
63
|
|
|
59
64
|
## Commands
|
|
60
65
|
|
|
66
|
+
Every command accepts `--json` and shares the same exit code contract. Both are
|
|
67
|
+
documented here once and hold for every command below — including the ones added
|
|
68
|
+
later.
|
|
69
|
+
|
|
70
|
+
### Non-interactive mode — `--json`
|
|
71
|
+
|
|
72
|
+
Pass `--json` to any command, in any position, to drive the CLI from an agent or
|
|
73
|
+
a script:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
productdock skill status --json
|
|
77
|
+
productdock --json doctor
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Under `--json` the CLI:
|
|
81
|
+
|
|
82
|
+
- writes **exactly one JSON document to `stdout`** — in success *and* in failure;
|
|
83
|
+
- suppresses prose and spinners, and sends every error message to `stderr`;
|
|
84
|
+
- never prompts: a command that would have to ask something fails immediately
|
|
85
|
+
instead of waiting for input that will never come.
|
|
86
|
+
|
|
87
|
+
```jsonc
|
|
88
|
+
{ "ok": true } // success
|
|
89
|
+
{ "ok": false, "error": { "code": 1, "message": "…" } } // failure
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
`error.code` is the process exit code, so an agent can branch either on the
|
|
93
|
+
document or on the exit status.
|
|
94
|
+
|
|
95
|
+
Without `--json`, `stdout` still carries nothing but what a shell expects to find
|
|
96
|
+
there — `--help` and `--version`. Prose, spinners and error messages always go to
|
|
97
|
+
`stderr`, which keeps `stdout` free for machine-readable output.
|
|
98
|
+
|
|
99
|
+
### Exit codes
|
|
100
|
+
|
|
101
|
+
| Code | Meaning |
|
|
102
|
+
| ---- | ------------------------------------------------------------------------ |
|
|
103
|
+
| `0` | Success — also when the user cancels a prompt (Ctrl-C) |
|
|
104
|
+
| `1` | Business error — bad usage, missing configuration, failed remote call |
|
|
105
|
+
| `2` | Authentication error — no session, or the refresh token was rejected |
|
|
106
|
+
|
|
107
|
+
An operation that would need a terminal and does not have one (`--json`, no TTY,
|
|
108
|
+
CI) exits `1` with an explanation on `stderr` — it never blocks.
|
|
109
|
+
|
|
110
|
+
### Project scope — `--project-id` / `--repository-id`
|
|
111
|
+
|
|
112
|
+
Every operation that runs against a ProductDock project takes its scope from
|
|
113
|
+
`productdock.json` — `project.id` and `project.repository`, both written by
|
|
114
|
+
`productdock link`. Resolving scope is a file read: no network call, no prompt,
|
|
115
|
+
no UUID an agent would have to know.
|
|
116
|
+
|
|
117
|
+
The file is looked up in the current directory **and in every directory above
|
|
118
|
+
it**, the way Git finds `.git`. So a command run from inside
|
|
119
|
+
`.productdock/work-items/<WI>/` — where the artifacts of a work item live, and
|
|
120
|
+
therefore where you are working — resolves the same scope as one run from the
|
|
121
|
+
repository root. `productdock init` and `productdock link` still *write* in the
|
|
122
|
+
current directory: linking from a subdirectory must not rewrite the parent's
|
|
123
|
+
link.
|
|
124
|
+
|
|
125
|
+
Both flags override the file, for a one-off call against another project or
|
|
126
|
+
repository:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
# Scope from productdock.json — the normal case
|
|
130
|
+
productdock <operation>
|
|
131
|
+
|
|
132
|
+
# Override for this call only
|
|
133
|
+
productdock <operation> --project-id <uuid>
|
|
134
|
+
productdock <operation> --repository-id <uuid>
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
| Flag | Description |
|
|
138
|
+
| ------------------------ | ---------------------------------------------------------------- |
|
|
139
|
+
| `--project-id <uuid>` | Project the operation runs against — overrides `project.id` |
|
|
140
|
+
| `--repository-id <uuid>` | Repository the operation runs against — overrides `project.repository` |
|
|
141
|
+
|
|
142
|
+
In a tree that was never linked, an operation that needs a project exits `1`,
|
|
143
|
+
naming **the directories it searched** — from the current one up to the
|
|
144
|
+
filesystem root — and telling you to run `productdock link` at the repository
|
|
145
|
+
root. It never asks. The scope travels as a request parameter, never as a
|
|
146
|
+
header: that is what the API reads.
|
|
147
|
+
|
|
148
|
+
### `productdock init`
|
|
149
|
+
|
|
150
|
+
Writes `productdock.json` in the current directory with the list of IDEs your team uses. Pre-selects any IDE it detects locally. Every other command derives its behaviour from this list — which MCP config files to write, and where skills and agents get installed.
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
productdock init
|
|
154
|
+
```
|
|
155
|
+
|
|
61
156
|
### `productdock login`
|
|
62
157
|
|
|
63
158
|
Authenticates with Azure AD using OAuth 2.1 + PKCE. Opens a browser window and saves credentials to `~/.productdock/credentials.json`.
|
|
@@ -76,23 +171,54 @@ productdock logout
|
|
|
76
171
|
|
|
77
172
|
### `productdock link`
|
|
78
173
|
|
|
79
|
-
Links the current directory to a ProductDock project
|
|
174
|
+
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:
|
|
175
|
+
|
|
176
|
+
1. write the MCP configuration for your IDEs, and
|
|
177
|
+
2. install every skill and agent published under the `productdock` category.
|
|
80
178
|
|
|
81
179
|
```bash
|
|
82
180
|
productdock link
|
|
83
181
|
|
|
84
|
-
# Skip interactive
|
|
85
|
-
productdock link --project-id <uuid>
|
|
182
|
+
# Skip interactive project selection
|
|
183
|
+
productdock link --project-id <uuid>
|
|
184
|
+
|
|
185
|
+
# Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts)
|
|
186
|
+
productdock link --project-id <uuid> --repository-id <uuid> --ide claude-code --yes --json
|
|
86
187
|
```
|
|
87
188
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
189
|
+
Every point where `link` would ask a question has a flag, so the command runs
|
|
190
|
+
to completion in a process with no terminal — the way an IDE agent executes
|
|
191
|
+
step 2 of the prompt copied from the "Connect to your IDE" drawer. Without a
|
|
192
|
+
TTY and with no flag, each install decision takes the same value the prompt
|
|
193
|
+
offered by default (yes); `--no-install-mcp` / `--no-install-skills` opt out.
|
|
194
|
+
When the project has more than one repository and no `--repository-id` is
|
|
195
|
+
given, the link is written **without** a repository (a valid state — every
|
|
196
|
+
operation that needs one asks for `--repository-id` at the point of use) and
|
|
197
|
+
the accepted ids are printed to `stderr`.
|
|
198
|
+
|
|
199
|
+
Nothing is written until every decision is made: a `link` that fails leaves the
|
|
200
|
+
directory exactly as it was, instead of a `productdock.json` carrying only the
|
|
201
|
+
project.
|
|
202
|
+
|
|
203
|
+
| Flag | Description |
|
|
204
|
+
| ------------------------ | ------------------------------------------------------------------------------ |
|
|
205
|
+
| `--project-id <uuid>` | Skip interactive project selection |
|
|
206
|
+
| `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
|
|
207
|
+
| `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Replaces running `productdock init`, which needs a terminal |
|
|
208
|
+
| `--install-mcp` | Install the MCP configuration without asking |
|
|
209
|
+
| `--no-install-mcp` | Do not install the MCP configuration |
|
|
210
|
+
| `--install-skills` | Install skills and agents without asking |
|
|
211
|
+
| `--no-install-skills` | Do not install skills or agents |
|
|
212
|
+
| `-y, --yes` | Answer yes to every confirmation |
|
|
213
|
+
|
|
214
|
+
Under `--json` the response document reports the resulting state of the link —
|
|
215
|
+
project, repository (`null` when none was bound), IDEs, and whether the MCP and
|
|
216
|
+
the skills were installed — so the caller confirms the step by its effect and
|
|
217
|
+
not by an empty `ok`.
|
|
92
218
|
|
|
93
219
|
### `productdock mcp setup`
|
|
94
220
|
|
|
95
|
-
Writes MCP server configuration for the IDEs declared in `productdock.json
|
|
221
|
+
Writes MCP server configuration for the IDEs declared in `productdock.json`, pointing each IDE at the ProductDock MCP server — a one-time operation. **The MCP server is not going away**: it is the IDEs' channel into the same operations the commands below reach over `/cli/*`, and this command is unchanged by them.
|
|
96
222
|
|
|
97
223
|
```bash
|
|
98
224
|
productdock mcp setup
|
|
@@ -117,6 +243,906 @@ Checks token validity and IDE configuration status.
|
|
|
117
243
|
productdock mcp status
|
|
118
244
|
```
|
|
119
245
|
|
|
246
|
+
### `productdock skill` / `productdock agent`
|
|
247
|
+
|
|
248
|
+
Both groups share the same four subcommands and the same behaviour — `skill` manages skills, `agent` manages subagent definitions. Install targets are derived from the IDEs in `productdock.json`.
|
|
249
|
+
|
|
250
|
+
An agent is a **single file** upstream (`agents/{name}.agent.md`), not a folder like a skill, and it is installed under the name each platform expects:
|
|
251
|
+
|
|
252
|
+
| Target | Written to | Frontmatter |
|
|
253
|
+
| --- | --- | --- |
|
|
254
|
+
| Claude Code (`claude-code`, `claude-desktop`) | `.claude/agents/{name}.md` | kept, minus the platform override blocks |
|
|
255
|
+
| GitHub Copilot (`vscode`) | `.github/agents/{name}.agent.md` | `name`, `description`, `argument-hint`, plus the source's `copilot:` block |
|
|
256
|
+
| Cursor | — | Cursor has no destination for agents; the target is skipped |
|
|
257
|
+
|
|
258
|
+
This is the same layout the `ai-tools` installer writes, so an agent installed by either route is one file in one place.
|
|
259
|
+
|
|
260
|
+
> `productdock agent status` reports `up to date` / `outdated` but never `modified`: the installed file is a per-platform adaptation of the source, so its bytes cannot be compared with the registry's hash of the source. Skills, installed verbatim, still detect local edits.
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
# Browse what the registry offers
|
|
264
|
+
productdock skill list
|
|
265
|
+
productdock agent list
|
|
266
|
+
|
|
267
|
+
# Filter by source
|
|
268
|
+
productdock skill list --source productdock
|
|
269
|
+
|
|
270
|
+
# Install into the current project
|
|
271
|
+
productdock skill install pd-workflow
|
|
272
|
+
productdock agent install pd-reviewer
|
|
273
|
+
|
|
274
|
+
# Pin a specific version
|
|
275
|
+
productdock skill install pd-workflow --version 1.4.0
|
|
276
|
+
|
|
277
|
+
# Update one, or everything installed
|
|
278
|
+
productdock skill update pd-workflow
|
|
279
|
+
productdock agent update
|
|
280
|
+
|
|
281
|
+
# Compare what is on disk against the registry
|
|
282
|
+
productdock skill status
|
|
283
|
+
productdock agent status
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
| Subcommand | Description |
|
|
287
|
+
| ----------------------- | ------------------------------------------------------------------------------- |
|
|
288
|
+
| `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
|
|
289
|
+
| `install <name>` | Install into every target derived from `productdock.json`. `--version <version>` |
|
|
290
|
+
| `update [name]` | Update one, or every installed item. Locally modified items are skipped |
|
|
291
|
+
| `status` | Report `up to date` / `outdated` / `modified` per installed item |
|
|
292
|
+
|
|
293
|
+
`status` compares a SHA256 fingerprint of the installed directory against the versions the registry knows about:
|
|
294
|
+
|
|
295
|
+
| Symbol | Meaning |
|
|
296
|
+
| ------ | ------------------------------------------------------------------- |
|
|
297
|
+
| `✔` | Matches the latest registry version |
|
|
298
|
+
| `↑` | Matches an older registry version — run `update` |
|
|
299
|
+
| `~` | Matches no registry version — edited locally, `update` will skip it |
|
|
300
|
+
| `⇄` | Installed from a different `ai-tools` branch than the active one |
|
|
301
|
+
| `✖` | Recorded in `productdock.json` but missing on disk — reinstall |
|
|
302
|
+
| `?` | Not found in the registry |
|
|
303
|
+
|
|
304
|
+
### `productdock wi` — work items
|
|
305
|
+
|
|
306
|
+
Five operations over the work items of a project, served by the
|
|
307
|
+
`/cli/work-items/*` endpoints of the ProductDock API. Three of them read
|
|
308
|
+
(`list`, `prd`, `spec-context`); two of them write to the work item —
|
|
309
|
+
`comment` posts a comment, `evidence` uploads a QA screenshot. Each has its own
|
|
310
|
+
subsection below.
|
|
311
|
+
|
|
312
|
+
Every subcommand accepts `--json`, `--project-id` and `--repository-id`,
|
|
313
|
+
documented once at the top of the Commands section.
|
|
314
|
+
|
|
315
|
+
#### Reading — `list`, `prd`, `spec-context`
|
|
316
|
+
|
|
317
|
+
They are the same operations the MCP server exposes as the `get_prd`,
|
|
318
|
+
`list_work_items` and `get_spec_context` tools, and they return the same body —
|
|
319
|
+
the CLI and the MCP call the same code on the server.
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
# Every work item of the linked project
|
|
323
|
+
productdock wi list
|
|
324
|
+
|
|
325
|
+
# Filter and search — the search matches title OR description OR type
|
|
326
|
+
productdock wi list --status backlog --search "authentication"
|
|
327
|
+
productdock wi list --search improvement # matches the type
|
|
328
|
+
|
|
329
|
+
# The PRD of one work item — ref is PREFIX-N, a number, a UUID or a title
|
|
330
|
+
productdock wi prd PROD-168
|
|
331
|
+
productdock wi prd 168
|
|
332
|
+
productdock wi prd 11111111-1111-4111-8111-111111111111
|
|
333
|
+
productdock wi prd "Replace MCP with the CLI"
|
|
334
|
+
|
|
335
|
+
# Everything needed to write the Spec of a work item
|
|
336
|
+
productdock wi spec-context PROD-168 --json --out spec-context.json
|
|
337
|
+
```
|
|
338
|
+
|
|
339
|
+
##### Parameters
|
|
340
|
+
|
|
341
|
+
| Subcommand | Argument | Options |
|
|
342
|
+
| -------------------- | -------- | -------------------------------------------------------------------------------------------------- |
|
|
343
|
+
| `list` | — | `--status <status>` · `--search <term>` · `--repository-name <name>` · `--out <file>` |
|
|
344
|
+
| `prd <ref>` | `<ref>` | `--out <file>` |
|
|
345
|
+
| `spec-context <ref>` | `<ref>` | `--out <file>` |
|
|
346
|
+
|
|
347
|
+
| Parameter | Description |
|
|
348
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------- |
|
|
349
|
+
| `<ref>` | Work item reference in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title. A number and a `PREFIX-N` are only resolvable with a project in scope — which the linked directory always provides |
|
|
350
|
+
| `--status <status>` | Kanban column: `backlog`, `prd`, `specification`, `development`, `review`, `testing`, `homologation`, `production` |
|
|
351
|
+
| `--search <term>` | Matches the work item **title OR description OR type** — one term, three columns |
|
|
352
|
+
| `--repository-name <name>`| Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`), not silently resolved one way |
|
|
353
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
354
|
+
|
|
355
|
+
##### Response format
|
|
356
|
+
|
|
357
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
358
|
+
under `data`:
|
|
359
|
+
|
|
360
|
+
```jsonc
|
|
361
|
+
{ "ok": true, "operation": "get_prd", "data": { /* the body below */ } }
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
`operation` is the canonical operation name — `get_prd`, `list_work_items` or
|
|
365
|
+
`get_spec_context`. Without `--json`, `stdout` stays empty and a human-readable
|
|
366
|
+
summary goes to `stderr`.
|
|
367
|
+
|
|
368
|
+
| Subcommand | `data` |
|
|
369
|
+
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
370
|
+
| `prd` | `{ content, status, version, updated_at }` — the latest PRD version. A work item with no PRD returns `{ content: null, message }`, which is a **success**, not an error |
|
|
371
|
+
| `list` | `{ project_id, work_item_prefix, repository_id, has_more, items[] }`; each item is `{ id, item_number, title, description, type, status, flow_mode, current_phase }`. Capped at 100 items — `has_more: true` says the cap was hit |
|
|
372
|
+
| `spec-context` | `{ product_brief, product_brief_status, product_vision, domain_model, discovery_insights, non_functional_requirements, sibling_specs, skill_mode, current_state, repository_id }`. `skill_mode` is the project's Lite Mode toggle (`full` / `lite`) |
|
|
373
|
+
|
|
374
|
+
##### Exit codes
|
|
375
|
+
|
|
376
|
+
The general table above holds; this is how each condition maps to it:
|
|
377
|
+
|
|
378
|
+
| Code | When |
|
|
379
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
380
|
+
| `0` | The operation ran — including a work item with no PRD |
|
|
381
|
+
| `1` | Directory not linked and no `--project-id`; missing `<ref>`; `--repository-id` and `--repository-name` together; missing required scope (`400`); no access to the project (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
|
|
382
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
383
|
+
|
|
384
|
+
#### `productdock wi comment`
|
|
385
|
+
|
|
386
|
+
Posts a comment on a work item, served by the `/cli/work-items/comments`
|
|
387
|
+
endpoint of the ProductDock API. It is the same operation the MCP server exposes
|
|
388
|
+
as the `post_work_item_comment` tool, and it writes the same row — the CLI and
|
|
389
|
+
the MCP call the same code on the server.
|
|
390
|
+
|
|
391
|
+
**The author is not yours to choose.** The comment is signed by whoever ran
|
|
392
|
+
`productdock login`: the server derives the author from the JWT of the session.
|
|
393
|
+
There is no author flag, and a body field claiming one has nowhere to go — the
|
|
394
|
+
command does not send it and the server does not read it.
|
|
395
|
+
|
|
396
|
+
The comment is recorded as an **agent** comment, with a label that shows next to
|
|
397
|
+
it on the work item screen. `--label` sets that label; without it the server
|
|
398
|
+
applies its own default.
|
|
399
|
+
|
|
400
|
+
```bash
|
|
401
|
+
# The body comes from a file — the normal case for a long review
|
|
402
|
+
productdock wi comment prd-review.md --ref PROD-168
|
|
403
|
+
|
|
404
|
+
# Inline, for one line
|
|
405
|
+
productdock wi comment --ref PROD-168 --content "QA finished: 12 of 12 passed."
|
|
406
|
+
|
|
407
|
+
# Under another label, machine-readable
|
|
408
|
+
productdock wi comment qa-summary.md --ref PROD-168 \
|
|
409
|
+
--label "QA Execution" --json --out comment.json
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
##### Parameters
|
|
413
|
+
|
|
414
|
+
| Subcommand | Argument | Options |
|
|
415
|
+
| ------------------ | -------- | -------------------------------------------------- |
|
|
416
|
+
| `comment [file]` | `[file]` | `--ref` · `--content` · `--label` · `--out` |
|
|
417
|
+
|
|
418
|
+
| Parameter | Description |
|
|
419
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
420
|
+
| `[file]` | Path to the comment body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional only in the sense that `--content` replaces it; passing both is refused (exit `1`), not silently resolved one way |
|
|
421
|
+
| `--ref <ref>` | **Required.** Work item the comment belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
|
|
422
|
+
| `--content <text>` | The comment body inline, as an alternative to the file |
|
|
423
|
+
| `--label <label>` | Label of the agent signing the comment. Defaults to whatever the server applies — the CLI keeps no copy of that default |
|
|
424
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
425
|
+
|
|
426
|
+
##### Response format
|
|
427
|
+
|
|
428
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
429
|
+
under `data`:
|
|
430
|
+
|
|
431
|
+
```jsonc
|
|
432
|
+
{ "ok": true, "operation": "post_work_item_comment", "data": { /* the body below */ } }
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
|
|
436
|
+
|
|
437
|
+
| Field | Meaning |
|
|
438
|
+
| -------------- | ---------------------------------------------------------------------------- |
|
|
439
|
+
| `success` | Always `true` on a `0` exit — the comment was written |
|
|
440
|
+
| `comment_id` | Id of the comment just created |
|
|
441
|
+
| `work_item_id` | The work item it landed on, resolved server-side from `--ref` |
|
|
442
|
+
|
|
443
|
+
##### Exit codes
|
|
444
|
+
|
|
445
|
+
The general table above holds; this is how each condition maps to it:
|
|
446
|
+
|
|
447
|
+
| Code | When |
|
|
448
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
449
|
+
| `0` | The comment was written |
|
|
450
|
+
| `1` | Missing `--ref`; no body (no file and no `--content`); file and `--content` together; unreadable file; directory not linked and no `--project-id`; empty body (`400`); no permission to edit work items (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
|
|
451
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
452
|
+
|
|
453
|
+
#### `productdock wi evidence`
|
|
454
|
+
|
|
455
|
+
Uploads a QA screenshot **from a local file**, served by the
|
|
456
|
+
`/cli/work-items/qa-evidence` endpoint of the ProductDock API. It is the same
|
|
457
|
+
operation the MCP server exposes as the `upload_qa_evidence` tool, and it lands
|
|
458
|
+
in the same private `qa-evidence` bucket, under the same path scheme — but it is
|
|
459
|
+
the one operation of the CLI whose **transport differs by design**, and the
|
|
460
|
+
difference is the point of the command.
|
|
461
|
+
|
|
462
|
+
Over MCP the tool cannot see your filesystem, so it returns a `signed_url` per
|
|
463
|
+
filename and instructs the caller to `PUT` the bytes to Storage itself: the
|
|
464
|
+
second half happens outside the contract, and the server never sees the file —
|
|
465
|
+
the MIME and the size it checks are the ones you *declared*. Here the file goes
|
|
466
|
+
up in a single call, and MIME and size are revalidated **on the bytes that
|
|
467
|
+
arrived**. Anything that is not a PNG, JPEG, GIF or WEBP is refused, as is
|
|
468
|
+
anything over 10 MB.
|
|
469
|
+
|
|
470
|
+
**The path in the bucket is not yours to choose.** It is derived server-side
|
|
471
|
+
from the project and the work item — `{project_id}/{work_item_id}/{uuid}-{name}`
|
|
472
|
+
— so there is no path flag to pass. The first segment is what the bucket policy
|
|
473
|
+
reads to decide who can see the object; a client-supplied path is exactly how
|
|
474
|
+
one writes under another project's scope. The `path` in the response is read,
|
|
475
|
+
never proposed.
|
|
476
|
+
|
|
477
|
+
**That `path` is the `storage-url`** the `qa-result/v1` envelope asks for in
|
|
478
|
+
`evidence[].url`. Record the path, never the signed URL: signed URLs expire, and
|
|
479
|
+
the platform regenerates one for reading whenever the QA drawer is opened.
|
|
480
|
+
|
|
481
|
+
One file per call — several screenshots are several calls.
|
|
482
|
+
|
|
483
|
+
```bash
|
|
484
|
+
# One screenshot of a QA journey
|
|
485
|
+
productdock wi evidence ./qa/screenshots/j01-step3.png --ref PROD-168
|
|
486
|
+
|
|
487
|
+
# Machine-readable, saved to a file — this is where the path comes from
|
|
488
|
+
productdock wi evidence ./qa/screenshots/j01-step3.png --ref PROD-168 \
|
|
489
|
+
--json --out evidence.json
|
|
490
|
+
|
|
491
|
+
# A whole directory, one call each
|
|
492
|
+
for shot in ./qa/screenshots/*.png; do
|
|
493
|
+
productdock wi evidence "$shot" --ref PROD-168 --json
|
|
494
|
+
done
|
|
495
|
+
```
|
|
496
|
+
|
|
497
|
+
##### Parameters
|
|
498
|
+
|
|
499
|
+
| Subcommand | Argument | Options |
|
|
500
|
+
| -------------------- | -------- | -------------------- |
|
|
501
|
+
| `evidence <file>` | `<file>` | `--ref` · `--out` |
|
|
502
|
+
|
|
503
|
+
| Parameter | Description |
|
|
504
|
+
| ---------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
505
|
+
| `<file>` | **Required.** Path to the screenshot on disk. The bytes are sent as `multipart/form-data`, unchanged. The name on your disk becomes the readable tail of the path in the bucket, sanitised server-side; it has no bearing on *where* the object lands |
|
|
506
|
+
| `--ref <ref>` | **Required.** Work item the evidence belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
|
|
507
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
508
|
+
|
|
509
|
+
The work item and the project travel as **query parameters**, not as form
|
|
510
|
+
fields. That is not a preference: on the server, guards run before the multipart
|
|
511
|
+
parser, so a `work_item_ref` inside the form would be invisible to the
|
|
512
|
+
authorisation gate.
|
|
513
|
+
|
|
514
|
+
##### Response format
|
|
515
|
+
|
|
516
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
517
|
+
under `data`:
|
|
518
|
+
|
|
519
|
+
```jsonc
|
|
520
|
+
{ "ok": true, "operation": "upload_qa_evidence", "data": { /* the body below */ } }
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
|
|
524
|
+
|
|
525
|
+
| Field | Meaning |
|
|
526
|
+
| -------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
527
|
+
| `success` | Always `true` on a `0` exit — the object was written |
|
|
528
|
+
| `bucket` | `qa-evidence` — the private bucket, the same one the portal and the IDE write to |
|
|
529
|
+
| `path` | Path of the object, **derived server-side**. This is the value that goes in `evidence[].url` of `qa-result/v1` |
|
|
530
|
+
| `name` | The filename as it was sent |
|
|
531
|
+
| `content_type` | MIME the server accepted the file as |
|
|
532
|
+
| `size` | Bytes received |
|
|
533
|
+
| `work_item_id` | The work item it was attached to, resolved server-side from `--ref` |
|
|
534
|
+
|
|
535
|
+
##### Exit codes
|
|
536
|
+
|
|
537
|
+
The general table above holds; this is how each condition maps to it:
|
|
538
|
+
|
|
539
|
+
| Code | When |
|
|
540
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
541
|
+
| `0` | The evidence was stored |
|
|
542
|
+
| `1` | Missing `<file>` or `--ref`; unreadable file; directory not linked and no `--project-id`; **file type not accepted (`400` `unsupported_file_type`)**; **file over 10 MB (`400` `file_too_large`, or `413` when the request itself is cut short)**; empty file (`400` `empty_file`); no file received (`400` `file_required`); no permission to edit work items (`403`); work item not found **or not visible to you** (`404` — the two are deliberately indistinguishable); any other API failure |
|
|
543
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
544
|
+
|
|
545
|
+
### `productdock code` — reading the repository and its code
|
|
546
|
+
|
|
547
|
+
Two read operations over the **indexed** repositories of a project, served by
|
|
548
|
+
the `/cli/code/*` endpoints of the ProductDock API. They are the same
|
|
549
|
+
operations the MCP server exposes as the `get_repo_map` and `search_code`
|
|
550
|
+
tools, and they return the same body — the CLI and the MCP call the same code
|
|
551
|
+
on the server. Semantic search lives there and only there: the embeddings and
|
|
552
|
+
the vector index are the platform's, never a local index.
|
|
553
|
+
|
|
554
|
+
```bash
|
|
555
|
+
# Structural map of every indexed repository of the linked project
|
|
556
|
+
productdock code map
|
|
557
|
+
|
|
558
|
+
# One repository only
|
|
559
|
+
productdock code map --repository-id <uuid>
|
|
560
|
+
|
|
561
|
+
# Semantic search over the indexed code of the project
|
|
562
|
+
productdock code search "how the login flow works"
|
|
563
|
+
|
|
564
|
+
# Narrow the search and cap the number of snippets
|
|
565
|
+
productdock code search "pkce verifier" --repository-id <uuid> --top-k 5
|
|
566
|
+
|
|
567
|
+
# Machine-readable, saved to a file
|
|
568
|
+
productdock code search "retry policy" --json --out hits.json
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
|
|
572
|
+
documented once at the top of this section.
|
|
573
|
+
|
|
574
|
+
#### Parameters
|
|
575
|
+
|
|
576
|
+
| Subcommand | Argument | Options |
|
|
577
|
+
| ------------------ | ------------- | --------------------------------------------- |
|
|
578
|
+
| `map` | — | `--out <file>` |
|
|
579
|
+
| `search <query>` | `<query>` | `--top-k <n>` · `--out <file>` |
|
|
580
|
+
|
|
581
|
+
| Parameter | Description |
|
|
582
|
+
| ------------------------ | ----------------------------------------------------------------------------------------------------------------- |
|
|
583
|
+
| `<query>` | What to look for, in natural language. It is embedded and matched server-side against the indexed code |
|
|
584
|
+
| `--repository-id <uuid>` | Narrows the operation to one repository **of the project in scope**. Unlike `wi list`, the `project.repository` of `productdock.json` is **not** applied by default: narrowing a map or a search without being asked hides results, and a hidden result is the one nobody notices. An id from another project returns an empty set, exactly as it does over MCP |
|
|
585
|
+
| `--top-k <n>` | How many snippets to return — a positive integer. The server caps it (50) and defaults to 10. A non-numeric value is refused (exit `1`), never silently ignored |
|
|
586
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
587
|
+
|
|
588
|
+
#### Response format
|
|
589
|
+
|
|
590
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
591
|
+
under `data`:
|
|
592
|
+
|
|
593
|
+
```jsonc
|
|
594
|
+
{ "ok": true, "operation": "search_code", "data": { /* the body below */ } }
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
`operation` is the canonical operation name — `get_repo_map` or `search_code`.
|
|
598
|
+
Without `--json`, `stdout` stays empty and a human-readable summary goes to
|
|
599
|
+
`stderr`.
|
|
600
|
+
|
|
601
|
+
| Subcommand | `data` |
|
|
602
|
+
| ---------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
603
|
+
| `map` | `{ repositories[] }`; each entry is `{ repository_id, repository_name, default_branch, indexed, summaries_pending, entry_points[], file_map[], total_files, total_chunks, last_indexed_at }`. `file_map` is capped at 200 files. A repository that was never indexed comes back with `indexed: false` — a **success**, not an error |
|
|
604
|
+
| `search` | `{ results[] }`; each hit is `{ file_path, repository_id, repository_name, content, language, similarity }` — the snippet plus where it came from. `content` is truncated at 1500 characters. Nothing indexed for the scope means `results: []`, which is also a success |
|
|
605
|
+
|
|
606
|
+
#### Exit codes
|
|
607
|
+
|
|
608
|
+
The general table above holds; this is how each condition maps to it:
|
|
609
|
+
|
|
610
|
+
| Code | When |
|
|
611
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
612
|
+
| `0` | The operation ran — including an empty map and an empty result set |
|
|
613
|
+
| `1` | Directory not linked and no `--project-id`; missing `<query>`; non-numeric `--top-k`; missing required scope (`400`); no access to the project — or to **any** of the projects owning the repositories asked for (`403`); any other API failure |
|
|
614
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
615
|
+
|
|
616
|
+
### `productdock artifact` — writing SDLC phase artifacts
|
|
617
|
+
|
|
618
|
+
Two write operations over the phase artifacts of a work item. `submit` records a
|
|
619
|
+
version **on the platform**; `commit` versions the same body **in Git**. They are
|
|
620
|
+
different operations on different stores — the usual sequence is one after the
|
|
621
|
+
other — and each has its own subsection below.
|
|
622
|
+
|
|
623
|
+
#### `productdock artifact submit`
|
|
624
|
+
|
|
625
|
+
Served by the `/cli/artifacts` endpoint of the ProductDock API. It is the same
|
|
626
|
+
operation the MCP server exposes as the `submit_artifact` tool, and it returns
|
|
627
|
+
the same body — the CLI and the MCP call the same code on the server, so the
|
|
628
|
+
envelope validation, the patch merge and the version numbering are one
|
|
629
|
+
implementation, not two.
|
|
630
|
+
|
|
631
|
+
It is the one operation whose **payload shape** differs between the two
|
|
632
|
+
channels. Over MCP the artifact body only exists inline, transcribed by the
|
|
633
|
+
agent into the tool argument. Here it can come from a file on disk and reach the
|
|
634
|
+
server untouched — which is what makes a 200 kB `tasks` artifact a normal call
|
|
635
|
+
instead of a transcription problem. Inline is still available (`--content`).
|
|
636
|
+
|
|
637
|
+
```bash
|
|
638
|
+
# The body comes from a file — the normal case
|
|
639
|
+
productdock artifact submit .productdock/work-items/PROD-168/spec.md \
|
|
640
|
+
--ref PROD-168 --phase specify --type spec
|
|
641
|
+
|
|
642
|
+
# Inline, for a short artifact
|
|
643
|
+
productdock artifact submit --ref PROD-168 --phase design --type design \
|
|
644
|
+
--content '# Design
|
|
645
|
+
|
|
646
|
+
Decisão X.'
|
|
647
|
+
|
|
648
|
+
# A pointed correction: only the entries that changed, merged server-side over
|
|
649
|
+
# the last version. The markdown body is inherited — it is not resent
|
|
650
|
+
productdock artifact submit --ref PROD-168 --phase tasks --type tasks \
|
|
651
|
+
--mode patch --patch '{"tasks":[{"id":"T12","status":"done"}]}'
|
|
652
|
+
|
|
653
|
+
# A skipped phase carries no artifact list
|
|
654
|
+
productdock artifact submit plan.md --ref PROD-168 \
|
|
655
|
+
--phase test-design --type test-plan --status skip
|
|
656
|
+
|
|
657
|
+
# A rehearsal: validates the envelope (and the patch merge) and writes nothing
|
|
658
|
+
productdock artifact submit tasks.md --ref PROD-168 --phase tasks --type tasks \
|
|
659
|
+
--dry-run
|
|
660
|
+
|
|
661
|
+
# Machine-readable, saved to a file
|
|
662
|
+
productdock artifact submit spec.md --ref PROD-168 --phase specify --type spec \
|
|
663
|
+
--json --out submitted.json
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
The subcommand also accepts `--json`, `--project-id` and `--repository-id`,
|
|
667
|
+
documented once at the top of this section.
|
|
668
|
+
|
|
669
|
+
##### Parameters
|
|
670
|
+
|
|
671
|
+
| Subcommand | Argument | Options |
|
|
672
|
+
| ------------------ | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
673
|
+
| `submit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--mode` · `--patch` · `--status` · `--dry-run` · `--repository-name` · `--out` |
|
|
674
|
+
|
|
675
|
+
| Parameter | Description |
|
|
676
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
677
|
+
| `[file]` | Path to the artifact body on disk, read as UTF-8 and sent verbatim — not trimmed, not re-encoded, not truncated. Optional: replaced by `--content`, and not needed at all under `--mode patch`. Passing both the file and `--content` is refused (exit `1`), not silently resolved one way |
|
|
678
|
+
| `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
|
|
679
|
+
| `--phase <phase>` | **Required.** SDLC phase of the artifact — e.g. `specify`, `design`, `tasks`, `test-design`, `qa-run`. The CLI keeps no list of its own: whatever the server accepts, the command sends |
|
|
680
|
+
| `--type <type>` | **Required.** Artifact type — e.g. `spec`, `design`, `tasks`, `qa-plan`, `qa-result`, `qa-issue`. Same rule as `--phase` |
|
|
681
|
+
| `--content <text>` | The artifact body inline, as an alternative to the file |
|
|
682
|
+
| `--mode <full\|patch>` | `full` (default) sends the whole artifact; `patch` sends only the entries that changed. Any other value is refused (exit `1`) before any network call |
|
|
683
|
+
| `--patch <json>` | Required under `--mode patch`, and only there: a JSON object with the entries to reconcile by key — tasks by `id`, `qa-result` test cases by `tc_ref`, gates by `name`, coverage by `criterion`, scalars under `set`. Malformed JSON fails locally, naming the flag. Passing it without `--mode patch` is refused (exit `1`) rather than ignored: an ignored patch would silently become a full submission |
|
|
684
|
+
| `--status <done\|skip>` | `done` (default) records a real artifact; `skip` records a phase that was deliberately skipped |
|
|
685
|
+
| `--dry-run` | Runs the whole server-side validation — envelope, patch merge, `BUG-N` collision — and writes **no version**. It exists because every submission creates a new version: resending "to see if it works now" was recorded in the work item's history as if it were work, and there is no way to clean it up. The response carries `dry_run: true` and `would_write_version` instead of `artifact_id`/`version` |
|
|
686
|
+
| `--repository-name <name>` | Repository by name, resolved server-side. It **replaces** the repository of the linked directory for this call — `repository_id` is not sent alongside it, or the server would ignore the name. Passing it together with `--repository-id` is refused (exit `1`). The repository is part of the artifact's lineage, so picking the wrong one writes a version nobody is reading |
|
|
687
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
688
|
+
|
|
689
|
+
##### Response format
|
|
690
|
+
|
|
691
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
692
|
+
under `data`:
|
|
693
|
+
|
|
694
|
+
```jsonc
|
|
695
|
+
{ "ok": true, "operation": "submit_artifact", "data": { /* the body below */ } }
|
|
696
|
+
```
|
|
697
|
+
|
|
698
|
+
Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
|
|
699
|
+
|
|
700
|
+
| Field | Meaning |
|
|
701
|
+
| ------------------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
702
|
+
| `success` | Always `true` on a `0` exit. It says the call was accepted — **not** that the JSON envelope inside the body was read; for that, see `patched` |
|
|
703
|
+
| `artifact_id` | Id of the version just written. It is a **new id on every submission**: the artifact's identity is (work item + phase + type), and each submission is one more version of that lineage |
|
|
704
|
+
| `version` | Version number within the lineage, starting at 1. It never collides: concurrent submissions retry server-side |
|
|
705
|
+
| `phase_advanced_to` | The phase the work item moved to, or `null`. Submitting an artifact does not advance a phase by itself |
|
|
706
|
+
| `repository_id` | Repository the version was recorded under, or `null` for artifacts whose scope is the whole work item (`prd`, and anything in the `define` phase) |
|
|
707
|
+
| `repository_name` | Reserved; currently `null` |
|
|
708
|
+
| `patched` | **Only under `--mode patch`:** which keys the merge actually matched or appended. It is the proof that the envelope was read and the patch landed where it was meant to |
|
|
709
|
+
| `parsed` | **Only for `--type tasks`, in both modes:** the task ids the server read inside the `tasks/v1` envelope. Same job as `patched` — it answers "did the server *interpret* my body?", which `success: true` cannot |
|
|
710
|
+
| `dry_run` | **Only under `--dry-run`:** `true`, alongside `would_write_version`. Nothing was written |
|
|
711
|
+
|
|
712
|
+
##### Exit codes
|
|
713
|
+
|
|
714
|
+
The general table above holds; this is how each condition maps to it:
|
|
715
|
+
|
|
716
|
+
| Code | When |
|
|
717
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
718
|
+
| `0` | The version was written |
|
|
719
|
+
| `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 |
|
|
720
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
721
|
+
|
|
722
|
+
#### `productdock artifact commit`
|
|
723
|
+
|
|
724
|
+
Served by the `/cli/artifacts/commit` endpoint of the ProductDock API. It is the
|
|
725
|
+
same operation the MCP server exposes as the `commit_artifact` tool, and it
|
|
726
|
+
returns the same body — the path derivation, the branch creation, the
|
|
727
|
+
add-vs-edit decision and the Azure DevOps push are one implementation on the
|
|
728
|
+
server, not two.
|
|
729
|
+
|
|
730
|
+
**The destination is not yours to choose.** The path in the repository is
|
|
731
|
+
derived server-side from the work item — `.productdock/{N}-{slug}/{type}.md`,
|
|
732
|
+
with `plan` written as `plan.md` and `qa-report` as `qa-run.md` — so there is no
|
|
733
|
+
path flag to pass, and the name of the file on your disk is irrelevant. The
|
|
734
|
+
`path` in the response is read, never proposed.
|
|
735
|
+
|
|
736
|
+
**The repository target is mandatory and explicit.** This is the strictest scope
|
|
737
|
+
contract of the CLI: a call without a project **or** without a repository is
|
|
738
|
+
refused rather than completed with a default. Committing to the wrong repository
|
|
739
|
+
writes a version nobody is reading.
|
|
740
|
+
|
|
741
|
+
The Azure DevOps credential is resolved server-side from your ProductDock
|
|
742
|
+
session — there is nothing to configure locally, and no token to pass.
|
|
743
|
+
|
|
744
|
+
```bash
|
|
745
|
+
# The body comes from a file — the normal case
|
|
746
|
+
productdock artifact commit .productdock/work-items/PROD-168/spec.md \
|
|
747
|
+
--ref PROD-168 --phase specify --type spec
|
|
748
|
+
|
|
749
|
+
# Inline, for a short artifact
|
|
750
|
+
productdock artifact commit --ref PROD-168 --phase implement --type plan \
|
|
751
|
+
--content '# Plano
|
|
752
|
+
|
|
753
|
+
Passo 1.'
|
|
754
|
+
|
|
755
|
+
# On a branch of its own — created from the default branch if it does not exist
|
|
756
|
+
productdock artifact commit qa-report.md --ref PROD-168 \
|
|
757
|
+
--phase qa-run --type qa-report --branch specs/PROD-168-substituir-mcp
|
|
758
|
+
|
|
759
|
+
# Machine-readable, saved to a file
|
|
760
|
+
productdock artifact commit spec.md --ref PROD-168 --phase specify --type spec \
|
|
761
|
+
--json --out committed.json
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
The subcommand also accepts `--json`, `--project-id` and `--repository-id`,
|
|
765
|
+
documented once at the top of this section.
|
|
766
|
+
|
|
767
|
+
##### Parameters
|
|
768
|
+
|
|
769
|
+
| Subcommand | Argument | Options |
|
|
770
|
+
| ------------------ | ------------ | --------------------------------------------------------------------------------------------- |
|
|
771
|
+
| `commit [file]` | `[file]` | `--ref` · `--phase` · `--type` · `--content` · `--branch` · `--repository-name` · `--out` |
|
|
772
|
+
|
|
773
|
+
| Parameter | Description |
|
|
774
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
775
|
+
| `[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** |
|
|
776
|
+
| `--ref <ref>` | **Required.** Work item the artifact belongs to, in any of the four accepted formats: `PREFIX-N`, item number, UUID, or title |
|
|
777
|
+
| `--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 |
|
|
778
|
+
| `--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` |
|
|
779
|
+
| `--content <text>` | The artifact body inline, as an alternative to the file |
|
|
780
|
+
| `--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 |
|
|
781
|
+
| `--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`) |
|
|
782
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
783
|
+
|
|
784
|
+
##### Response format
|
|
785
|
+
|
|
786
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
787
|
+
under `data`:
|
|
788
|
+
|
|
789
|
+
```jsonc
|
|
790
|
+
{ "ok": true, "operation": "commit_artifact", "data": { /* the body below */ } }
|
|
791
|
+
```
|
|
792
|
+
|
|
793
|
+
Without `--json`, `stdout` stays empty and a two-line summary goes to `stderr`.
|
|
794
|
+
|
|
795
|
+
| Field | Meaning |
|
|
796
|
+
| ----------- | ------------------------------------------------------------------------------------------------------------ |
|
|
797
|
+
| `success` | Always `true` on a `0` exit — the push was applied |
|
|
798
|
+
| `path` | Path the artifact was written to, **derived server-side** from the work item |
|
|
799
|
+
| `branch` | Branch the commit landed on — the one you asked for, or the repository default |
|
|
800
|
+
| `commit_id` | SHA of the commit, or `null` when Azure DevOps returned no commit for the push |
|
|
801
|
+
|
|
802
|
+
##### Exit codes
|
|
803
|
+
|
|
804
|
+
The general table above holds; this is how each condition maps to it:
|
|
805
|
+
|
|
806
|
+
| Code | When |
|
|
807
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
808
|
+
| `0` | The commit was pushed |
|
|
809
|
+
| `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 |
|
|
810
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
811
|
+
|
|
812
|
+
### `productdock prd-review` — the PRD critical review
|
|
813
|
+
|
|
814
|
+
Two operations over the inline review threads of a PRD (the PRD Tech Review),
|
|
815
|
+
served by the `/cli/prd-review` endpoint of the ProductDock API. They are the
|
|
816
|
+
same operations the MCP server exposes as the `get_prd_review` and
|
|
817
|
+
`submit_prd_review` tools, and they return the same body — the CLI and the MCP
|
|
818
|
+
call the same code on the server, so the envelope validation, the reconciliation
|
|
819
|
+
by `finding_key` and the `tech_review` badge are one implementation, not two.
|
|
820
|
+
|
|
821
|
+
**`get` is a mandatory read-back before every `submit`.** This is not style, it
|
|
822
|
+
is an incident: without it, round N+1 re-emits findings the PM has already
|
|
823
|
+
answered, resolved or ignored — and the failure is **silent**, because the round
|
|
824
|
+
still returns `success: true`. Read the review, check `summary.open` and
|
|
825
|
+
`has_human_reply`, and only then compose the next round.
|
|
826
|
+
|
|
827
|
+
```bash
|
|
828
|
+
# The state of the review — the read-back
|
|
829
|
+
productdock prd-review get PROD-168
|
|
830
|
+
|
|
831
|
+
# Only what is still pending, machine-readable
|
|
832
|
+
productdock prd-review get PROD-168 --status open --json --out review.json
|
|
833
|
+
|
|
834
|
+
# Record a round of review — the body comes from a file, the normal case
|
|
835
|
+
productdock prd-review submit prd-review.md --ref PROD-168
|
|
836
|
+
|
|
837
|
+
# Inline. The body still starts with the fenced JSON envelope, so the file is
|
|
838
|
+
# almost always the better option
|
|
839
|
+
productdock prd-review submit --ref PROD-168 --content "$(cat prd-review.md)"
|
|
840
|
+
|
|
841
|
+
# The whole cycle, machine-readable: read the state, then record the round
|
|
842
|
+
productdock prd-review get PROD-168 --json --out before.json
|
|
843
|
+
productdock prd-review submit prd-review.md --ref PROD-168 --json --out round.json
|
|
844
|
+
```
|
|
845
|
+
|
|
846
|
+
Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
|
|
847
|
+
documented once at the top of this section.
|
|
848
|
+
|
|
849
|
+
#### Parameters
|
|
850
|
+
|
|
851
|
+
| Subcommand | Argument | Options |
|
|
852
|
+
| ----------------- | -------- | -------------------------------------------------------------- |
|
|
853
|
+
| `get <ref>` | `<ref>` | `--status <status>` · `--limit <n>` · `--out <file>` |
|
|
854
|
+
| `submit [file]` | `[file]` | `--ref` · `--content` · `--out` |
|
|
855
|
+
|
|
856
|
+
| Parameter | Description |
|
|
857
|
+
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
858
|
+
| `<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 |
|
|
859
|
+
| `--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 |
|
|
860
|
+
| `--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 |
|
|
861
|
+
| `[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 |
|
|
862
|
+
| `--content <text>` | The review body inline, as an alternative to the file |
|
|
863
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
864
|
+
|
|
865
|
+
#### Response format
|
|
866
|
+
|
|
867
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
868
|
+
under `data`:
|
|
869
|
+
|
|
870
|
+
```jsonc
|
|
871
|
+
{ "ok": true, "operation": "get_prd_review", "data": { /* the body below */ } }
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
`operation` is the canonical operation name — `get_prd_review` or
|
|
875
|
+
`submit_prd_review`. Without `--json`, `stdout` stays empty and a human-readable
|
|
876
|
+
summary goes to `stderr`.
|
|
877
|
+
|
|
878
|
+
`get` returns `{ work_item_id, brief_version, summary, count, threads[] }`:
|
|
879
|
+
|
|
880
|
+
| Field | Meaning |
|
|
881
|
+
| --------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
882
|
+
| `summary` | Thread counts by status: `{ open, resolved, ignored, superseded }`. **`summary.open` is the number to check before composing the next round** |
|
|
883
|
+
| `count` | How many threads came back — after `--status` and `--limit` |
|
|
884
|
+
| `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 |
|
|
885
|
+
| `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 |
|
|
886
|
+
| `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 |
|
|
887
|
+
| `threads[].messages[]` | The whole conversation, authors already hydrated (`author`, `source`, `text`). Human messages arrive as plain text — the stored HTML is converted server-side |
|
|
888
|
+
| `threads[].outdated` | `true` when the thread is anchored to a PRD version older than the current one |
|
|
889
|
+
| `brief_version` | The current PRD version the review is being read against |
|
|
890
|
+
|
|
891
|
+
`submit` returns the round's outcome — this is what decides the next round:
|
|
892
|
+
|
|
893
|
+
| Field | Meaning |
|
|
894
|
+
| ------------------------ | ------------------------------------------------------------------------------------------------------------------ |
|
|
895
|
+
| `success` | Always `true` on a `0` exit. It says the round was accepted — **not** that anything was posted; see the counters below |
|
|
896
|
+
| `review_round` | Number of this round. It equals the artifact version of the envelope snapshot |
|
|
897
|
+
| `threads_created` | Findings that had no live thread — a new thread each |
|
|
898
|
+
| `threads_updated` | Findings matched to an **open** thread by `finding_key`: the round was appended and the PM's reply survived |
|
|
899
|
+
| `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 |
|
|
900
|
+
| `threads_superseded` | Threads that were open and did **not** come back in this round: the review considered them settled |
|
|
901
|
+
| `tech_review` | The badge written on the PRD: `none` (a clean review), `changes_requested_gaps` or `changes_requested_blocking` |
|
|
902
|
+
| `artifact_id` · `artifact_version` | The snapshot of the raw envelope kept as a phase artifact |
|
|
903
|
+
|
|
904
|
+
#### Exit codes
|
|
905
|
+
|
|
906
|
+
The general table above holds; this is how each condition maps to it:
|
|
907
|
+
|
|
908
|
+
| Code | When |
|
|
909
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
910
|
+
| `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** |
|
|
911
|
+
| `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 |
|
|
912
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
913
|
+
|
|
914
|
+
### `productdock eval` — project evaluations
|
|
915
|
+
|
|
916
|
+
Served by the `/cli/evaluations` endpoint of the ProductDock API. It is the same
|
|
917
|
+
operation the MCP server exposes as the `submit_eval` tool, and it returns the
|
|
918
|
+
same body — the CLI and the MCP call the same code on the server, so the
|
|
919
|
+
envelope validation and the upsert are one implementation, not two.
|
|
920
|
+
|
|
921
|
+
It is the destination of the three eval skills — `pd-security-eval`,
|
|
922
|
+
`pd-observability-eval`, `pd-frontend-audit-eval`. Each of them writes an
|
|
923
|
+
envelope (`schema_version` 1.0) to `latest.json` and a human report next to it;
|
|
924
|
+
this command sends the envelope, and the file goes to the server untouched —
|
|
925
|
+
not transcribed, not truncated.
|
|
926
|
+
|
|
927
|
+
**An evaluation belongs to a project, not to a repository or a work item.** Its
|
|
928
|
+
identity on the server is `(project_id, eval_type)`: submitting the same
|
|
929
|
+
`eval_type` again **replaces** the previous evaluation, it does not add a
|
|
930
|
+
version. In evals that produce one subfolder per backend plus a consolidated
|
|
931
|
+
report at the root, **submit only the consolidated one** — submitting each
|
|
932
|
+
backend would leave you with whichever one went last.
|
|
933
|
+
|
|
934
|
+
**Submission requires the "Gerenciar avaliações do projeto" permission**
|
|
935
|
+
(`project.evaluations.manage`). Being a member of the project is no longer
|
|
936
|
+
enough: a call without the permission exits `1` with a `403`, and nothing is
|
|
937
|
+
written. Reading evaluations in the portal is unaffected — it still only needs
|
|
938
|
+
project membership.
|
|
939
|
+
|
|
940
|
+
```bash
|
|
941
|
+
# The normal case: the envelope the skill just wrote
|
|
942
|
+
productdock eval submit .productdock/evals/security/latest.json
|
|
943
|
+
|
|
944
|
+
# Machine-readable, saved to a file
|
|
945
|
+
productdock eval submit .productdock/evals/observability/latest.json \
|
|
946
|
+
--json --out submitted.json
|
|
947
|
+
|
|
948
|
+
# Label the evaluated repository when the envelope carries no target
|
|
949
|
+
productdock eval submit latest.json --repository-name productdock-api
|
|
950
|
+
```
|
|
951
|
+
|
|
952
|
+
The subcommand also accepts `--json` and `--project-id`, documented once at the
|
|
953
|
+
top of this section.
|
|
954
|
+
|
|
955
|
+
#### Parameters
|
|
956
|
+
|
|
957
|
+
| Subcommand | Argument | Options |
|
|
958
|
+
| ----------------- | ------------ | ----------------------------------------------- |
|
|
959
|
+
| `submit <file>` | `<file>` | `--repository-name` · `--out` |
|
|
960
|
+
|
|
961
|
+
| Parameter | Description |
|
|
962
|
+
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
963
|
+
| `<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 |
|
|
964
|
+
| `--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 |
|
|
965
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
966
|
+
|
|
967
|
+
#### Response format
|
|
968
|
+
|
|
969
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
970
|
+
under `data`:
|
|
971
|
+
|
|
972
|
+
```jsonc
|
|
973
|
+
{ "ok": true, "operation": "submit_eval", "data": { /* the body below */ } }
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
Without `--json`, `stdout` stays empty and a one-line summary goes to `stderr`.
|
|
977
|
+
|
|
978
|
+
| Field | Meaning |
|
|
979
|
+
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
|
|
980
|
+
| `success` | Always `true` on a `0` exit |
|
|
981
|
+
| `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 |
|
|
982
|
+
| `project_id` | The project the evaluation was recorded under — the one the server authorized, not the one you asked for |
|
|
983
|
+
| `eval_type` | `security`, `observability` or `frontend_quality`, read from the envelope |
|
|
984
|
+
|
|
985
|
+
#### Exit codes
|
|
986
|
+
|
|
987
|
+
The general table above holds; this is how each condition maps to it:
|
|
988
|
+
|
|
989
|
+
| Code | When |
|
|
990
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
991
|
+
| `0` | The evaluation was recorded |
|
|
992
|
+
| `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 |
|
|
993
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
994
|
+
|
|
995
|
+
### `productdock state` — the SDLC state of a work item
|
|
996
|
+
|
|
997
|
+
Served by the `/cli/state` endpoints of the ProductDock API. They are the same
|
|
998
|
+
operations the MCP server exposes as the `detect_phase` and `update_state`
|
|
999
|
+
tools, and they return the same body — the CLI and the MCP call the same code on
|
|
1000
|
+
the server, so reading and writing the state is one implementation, not two.
|
|
1001
|
+
|
|
1002
|
+
**Both tools stay on the MCP.** This command group is one more channel for the
|
|
1003
|
+
same operation, not a replacement: the agent picks the channel per call.
|
|
1004
|
+
|
|
1005
|
+
The two commands are the **read/write pair over the same state**, which is why
|
|
1006
|
+
they live together. `phase` reads it — current phase, next phase, artifacts,
|
|
1007
|
+
`uses_plan`, task progress — and `update` writes it: decision, blocker, lesson,
|
|
1008
|
+
review gate, phase change, phase progress, PRD verdict and flow change. Whatever
|
|
1009
|
+
you write here is what the other channel reads next, because there is a single
|
|
1010
|
+
row behind both.
|
|
1011
|
+
|
|
1012
|
+
```bash
|
|
1013
|
+
# Where the work item is — phase, flow, artifacts and task progress
|
|
1014
|
+
productdock state phase PROD-168
|
|
1015
|
+
|
|
1016
|
+
# Machine-readable, saved to a file
|
|
1017
|
+
productdock state phase PROD-168 --json --out phase.json
|
|
1018
|
+
|
|
1019
|
+
# Record a decision — the body comes from a file, the normal case
|
|
1020
|
+
productdock state update decision.json --ref PROD-168 --type decision
|
|
1021
|
+
|
|
1022
|
+
# Inline, for a short body
|
|
1023
|
+
productdock state update --ref PROD-168 --type phase_change \
|
|
1024
|
+
--content '{"phase":"design"}'
|
|
1025
|
+
|
|
1026
|
+
# Close an Execution Plan phase (no body needed beyond the counters)
|
|
1027
|
+
productdock state update --ref PROD-168 --type phase_progress \
|
|
1028
|
+
--content '{"fase_index":2,"fase_total":6,"fase_name":"Sidebar"}'
|
|
1029
|
+
|
|
1030
|
+
# Turn on the Fluxo Rápido of an improvement — never without explicit human
|
|
1031
|
+
# confirmation, and only while the item is in backlog, prd or specification
|
|
1032
|
+
productdock state update --ref PROD-168 --type flow_change \
|
|
1033
|
+
--content '{"flow_mode":"fast"}'
|
|
1034
|
+
|
|
1035
|
+
# A rehearsal: validates the body server-side and writes nothing
|
|
1036
|
+
productdock state update --ref PROD-168 --type lesson \
|
|
1037
|
+
--content '{"title":"…","description":"…"}' --dry-run
|
|
1038
|
+
```
|
|
1039
|
+
|
|
1040
|
+
`productdock state update --help` prints the accepted `content` fields **per
|
|
1041
|
+
`--type`**, so finding them out does not cost a probe against a real work item.
|
|
1042
|
+
|
|
1043
|
+
|
|
1044
|
+
|
|
1045
|
+
Both subcommands also accept `--json`, `--project-id` and `--repository-id`,
|
|
1046
|
+
documented once at the top of this section.
|
|
1047
|
+
|
|
1048
|
+
**The repository travels with both.** The state is repo-aware: `feature_state`
|
|
1049
|
+
has one row per `(work item, repository)`, and the artifact list is filtered the
|
|
1050
|
+
same way. The repository of `productdock.json` is sent by `phase` *and* by
|
|
1051
|
+
`update`, so reading with one scope and writing with another — two truths for
|
|
1052
|
+
the same work item, with no error anywhere — cannot happen by accident.
|
|
1053
|
+
|
|
1054
|
+
**Three server behaviours worth knowing before you use `update`:**
|
|
1055
|
+
|
|
1056
|
+
- the `id` you send in a decision is **ignored** — the server numbers the
|
|
1057
|
+
entries (`AD-001`, `B-001`, `L-001`) and returns the one it assigned in
|
|
1058
|
+
`applied.id`;
|
|
1059
|
+
- every `content` key the server did not consume comes back in
|
|
1060
|
+
**`ignored_fields`**. If a field is on that list, **its text was not stored** —
|
|
1061
|
+
`feature_state` is a resumption index, not a record;
|
|
1062
|
+
- re-sending the same entry is **idempotent** by `(title, description)`: the
|
|
1063
|
+
response carries `idempotent: true` and the id the entry already had, instead
|
|
1064
|
+
of a second copy of the same text;
|
|
1065
|
+
- a body the server **cannot interpret** is now **refused** with the schema in
|
|
1066
|
+
the message, and nothing is written. Two shapes are refused: one where no key
|
|
1067
|
+
at all was recognised (`{"foo":"bar"}` used to become the decision `AD-002`),
|
|
1068
|
+
and one where a decision/blocker/lesson would end up with an empty body
|
|
1069
|
+
because the text arrived under keys this operation does not read. An entry
|
|
1070
|
+
with only a title is still accepted — a short record is not a loss;
|
|
1071
|
+
- in a `lesson`, the four fields of the skill's *Lessons Learned* template
|
|
1072
|
+
(`context`, `problem`, `solution`, `prevents`) are accepted and composed into
|
|
1073
|
+
`description`. They used to be dropped in silence, leaving the lesson with
|
|
1074
|
+
nothing but its title.
|
|
1075
|
+
|
|
1076
|
+
#### Parameters
|
|
1077
|
+
|
|
1078
|
+
| Subcommand | Argument | Options |
|
|
1079
|
+
| ------------------ | ---------- | -------------------------------------------- |
|
|
1080
|
+
| `phase <ref>` | `<ref>` | `--out` |
|
|
1081
|
+
| `update [file]` | `[file]` | `--ref` · `--type` · `--content` · `--dry-run` · `--out` |
|
|
1082
|
+
|
|
1083
|
+
| Parameter | Description |
|
|
1084
|
+
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
1085
|
+
| `<ref>` | **Required** on `phase`. The work item — `PREFIX-N` (`PROD-168`), a number, a UUID or a title |
|
|
1086
|
+
| `--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 |
|
|
1087
|
+
| `--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 |
|
|
1088
|
+
| `[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 |
|
|
1089
|
+
| `--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 |
|
|
1090
|
+
| `--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` |
|
|
1091
|
+
| `--out <file>` | Writes the response document to this file as well. The file gets the exact text `stdout` gets, written atomically |
|
|
1092
|
+
|
|
1093
|
+
#### Response format
|
|
1094
|
+
|
|
1095
|
+
Under `--json`, `stdout` carries one document with the API response untouched
|
|
1096
|
+
under `data`:
|
|
1097
|
+
|
|
1098
|
+
```jsonc
|
|
1099
|
+
{ "ok": true, "operation": "detect_phase", "data": { /* the body below */ } }
|
|
1100
|
+
{ "ok": true, "operation": "update_state", "data": { /* the body below */ } }
|
|
1101
|
+
```
|
|
1102
|
+
|
|
1103
|
+
Without `--json`, `stdout` stays empty and a summary goes to `stderr` — including
|
|
1104
|
+
the `ignored_fields` warning, spelled out as "not stored".
|
|
1105
|
+
|
|
1106
|
+
`detect_phase`:
|
|
1107
|
+
|
|
1108
|
+
| Field | Meaning |
|
|
1109
|
+
| ------------------------- | ------------------------------------------------------------------------------------------------------------ |
|
|
1110
|
+
| `feature_id` | The work item the reference resolved to |
|
|
1111
|
+
| `status` | Kanban column (`backlog` … `production`) |
|
|
1112
|
+
| `current_phase`/`next_phase` | The current skill phase, and the one after it. Reconciled **monotonically** from two sources: the phase derived from the Kanban status and the one `phase_change` wrote to `feature_state` — whichever is further along wins. They used to disagree: entering `validation` (which stays in the `development` column on purpose) made this field answer `implement` while `update_state` answered `validation` |
|
|
1113
|
+
| `artifacts_found` | Artifact types already submitted for this work item (and repository) |
|
|
1114
|
+
| `work_item_type`/`flow_mode` | Type and **Fluxo Rápido** of the item (`full`/`fast`, only meaningful on `improvement`) |
|
|
1115
|
+
| `uses_plan` | **Route by this**, not by recombining type and flow in prose: `true` means the Plan track (`plan.md`) |
|
|
1116
|
+
| `mode` | **Modo Lite** of the project (`full`/`lite`) — whether Test Design runs. Not the Fluxo Rápido, and not the UI's "Modo Light"; the two vocabularies share the word `full` by accident |
|
|
1117
|
+
| `tasks_progress` | `{ done, total, percent, parallel }` read from the latest `tasks` artifact — from the `tasks/v1` envelope, with the legacy Markdown as a fallback. `null` when there is no `tasks` artifact |
|
|
1118
|
+
| `implementation_complete` | `true` when every task is done — or when an `implement` artifact was submitted with `--status done`, which is the only path for work items that skip the `tasks` phase |
|
|
1119
|
+
| `state_content` | The recorded state as an **object**: `decisions[]`, `blockers[]`, `lessons[]`, `reviews[]`. Reading a decision back used to require `wi spec-context` — a command whose name does not suggest it — and two levels of parsing |
|
|
1120
|
+
|
|
1121
|
+
`update_state`:
|
|
1122
|
+
|
|
1123
|
+
| Field | Meaning |
|
|
1124
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------ |
|
|
1125
|
+
| `success` | Always `true` on a `0` exit |
|
|
1126
|
+
| `work_item_id` | The work item the state was written to |
|
|
1127
|
+
| `applied` | `{ update_type, id?, phase? }` — `id` is the one **the server assigned**, the only piece of the mutation you cannot derive |
|
|
1128
|
+
| `current_phase` | The internal phase after the update |
|
|
1129
|
+
| `accepted_fields` | Keys of `content` the server **did** use. The positive side of `ignored_fields`: `success: true` says the call was accepted, this says the body was read |
|
|
1130
|
+
| `ignored_fields` | Keys of `content` the server did not use. **Present means not stored** — absent means everything landed |
|
|
1131
|
+
| `dry_run` | Only under `--dry-run`: `true`, with `would_apply` in place of `applied`. Nothing was written |
|
|
1132
|
+
| `idempotent` | `true` when the entry already existed and was matched instead of duplicated |
|
|
1133
|
+
| `flow_mode`/`previous_flow_mode` | Only on `flow_change` |
|
|
1134
|
+
| `progress` | Only on `phase_progress` — the marker written to the work item (`Fase 2/6 · Sidebar`) |
|
|
1135
|
+
|
|
1136
|
+
#### Exit codes
|
|
1137
|
+
|
|
1138
|
+
The general table above holds; this is how each condition maps to it:
|
|
1139
|
+
|
|
1140
|
+
| Code | When |
|
|
1141
|
+
| ---- | ---------------------------------------------------------------------------------------------------------------------------- |
|
|
1142
|
+
| `0` | The phase was read, or the state was written |
|
|
1143
|
+
| `1` | Missing `<ref>`/`--ref`/`--type`; body file unreadable; body that is not a JSON object; file **and** `--content` together; directory not linked and no `--project-id`; **`flow_change` refused (`400`) — wrong type, or outside the `backlog`/`prd`/`specification` window**; **body the server could not interpret (`400`) — the message carries the schema of the `--type`, and nothing was written**; unknown `update_type` (`400`); no permission for the write (`403`); no access to the work item (`404` — the same answer as "does not exist", on purpose); any other API failure |
|
|
1144
|
+
| `2` | The API rejected the token (`401`) — run `productdock login` again |
|
|
1145
|
+
|
|
120
1146
|
### `productdock doctor`
|
|
121
1147
|
|
|
122
1148
|
Runs a full diagnostic and reports any configuration issues with suggested fixes.
|
|
@@ -132,10 +1158,12 @@ Checks performed:
|
|
|
132
1158
|
|
|
133
1159
|
1. `~/.productdock/credentials.json` exists and is valid
|
|
134
1160
|
2. Access token is renewable (refresh token not expired)
|
|
135
|
-
3. `productdock.json` exists
|
|
136
|
-
4.
|
|
137
|
-
5. MCP
|
|
138
|
-
6. IDE
|
|
1161
|
+
3. `productdock.json` exists with an IDE list
|
|
1162
|
+
4. The directory is linked to a ProductDock project
|
|
1163
|
+
5. MCP server is reachable
|
|
1164
|
+
6. MCP config files exist for each configured IDE and point at the correct URL
|
|
1165
|
+
7. `AI_TOOLS_BRANCH` is not silently overriding the skill/agent source
|
|
1166
|
+
8. Every skill and agent recorded in `productdock.json` is present on disk
|
|
139
1167
|
|
|
140
1168
|
---
|
|
141
1169
|
|
|
@@ -156,31 +1184,98 @@ Checks performed:
|
|
|
156
1184
|
|
|
157
1185
|
---
|
|
158
1186
|
|
|
1187
|
+
## Where skills and agents are installed
|
|
1188
|
+
|
|
1189
|
+
Install locations are derived from the IDE list in `productdock.json` — a skill or agent is written once per distinct target, with identical content:
|
|
1190
|
+
|
|
1191
|
+
| IDE key | Target | Skills | Agents |
|
|
1192
|
+
| ------------------------------- | --------- | ------------------------- | ------------------------- |
|
|
1193
|
+
| `claude-code`, `claude-desktop` | `claude` | `.claude/skills/<name>/` | `.claude/agents/<name>/` |
|
|
1194
|
+
| `vscode` | `copilot` | `.github/skills/<name>/` | `.github/agents/<name>/` |
|
|
1195
|
+
| `cursor` | `cursor` | `.cursor/skills/<name>/` | `.cursor/agents/<name>/` |
|
|
1196
|
+
|
|
1197
|
+
Agents get a directory of their own rather than a bare `.md` file: Claude Code scans `.claude/agents/` recursively and takes a subagent's identity from its `name` frontmatter, not from its path, so nesting is safe and keeps multi-file agents intact.
|
|
1198
|
+
|
|
1199
|
+
Everything installed is recorded in `productdock.json`, which is what `update` and `status` compare against:
|
|
1200
|
+
|
|
1201
|
+
```jsonc
|
|
1202
|
+
{
|
|
1203
|
+
"ides": ["claude-code", "cursor"],
|
|
1204
|
+
"project": { "id": "…", "name": "ProductDock", "repositoryName": "productdock-cli" },
|
|
1205
|
+
"mcp": { "url": "https://productdock-api.softdesign.com.br/mcp" },
|
|
1206
|
+
"skills": {
|
|
1207
|
+
"pd-workflow": {
|
|
1208
|
+
"version": "1.4.0",
|
|
1209
|
+
"sha256": "…", // fingerprint of the installed tree
|
|
1210
|
+
"targets": ["claude", "cursor"],
|
|
1211
|
+
"installedAt": "2026-08-31T12:00:00.000Z",
|
|
1212
|
+
"branch": "feature/new-phases" // only when it differs from `main`; absent means `main`
|
|
1213
|
+
}
|
|
1214
|
+
},
|
|
1215
|
+
"agents": {
|
|
1216
|
+
/* same shape as skills */
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
Commit this file — it is how the rest of the team gets the same skills and agents at the same versions.
|
|
1222
|
+
|
|
1223
|
+
---
|
|
1224
|
+
|
|
1225
|
+
## Installing from an `ai-tools` branch
|
|
1226
|
+
|
|
1227
|
+
By default the registry serves skills and agents from the default branch of the `ai-tools` repository (`main`). Set `AI_TOOLS_BRANCH` to resolve them from another branch instead — useful for testing a skill before it is merged:
|
|
1228
|
+
|
|
1229
|
+
```bash
|
|
1230
|
+
AI_TOOLS_BRANCH=feature/new-phases productdock skill install pd-workflow
|
|
1231
|
+
|
|
1232
|
+
# Or for a whole session
|
|
1233
|
+
export AI_TOOLS_BRANCH=feature/new-phases
|
|
1234
|
+
productdock skill list
|
|
1235
|
+
productdock agent install pd-reviewer
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
The branch is passed to the registry as a `?branch=` query parameter, and every command that reads from the registry honours it. Notes:
|
|
1239
|
+
|
|
1240
|
+
- This is the **same variable** the legacy `@softdesignbrasil/ai-tools` installer uses, so one `export` points both tools at the same branch.
|
|
1241
|
+
- Any command running under an override prints a `Origem: branch <name> do ai-tools` line, and `productdock doctor` reports the override as a warning — a branch install should never be a silent surprise.
|
|
1242
|
+
- **The branch is recorded in `productdock.json` only when it differs from `main`.** No `branch` field therefore means the default branch — which is what the vast majority of installs are — and `"branch": "main"` is never written: it would say the same thing while making every reader compare two spellings of one state. Setting `AI_TOOLS_BRANCH=main` is a no-op end to end: no `?branch=` on the registry URL, no field in the file, no warning from `doctor`.
|
|
1243
|
+
- When you later switch branches, `status` flags the item with `⇄` instead of a misleading `modified`, and `update` reinstalls it from the branch now active. An older CLI did write `"branch": "main"`; such a record is read as the default, so it does not show up as a branch switch.
|
|
1244
|
+
|
|
1245
|
+
---
|
|
1246
|
+
|
|
159
1247
|
## How authentication works
|
|
160
1248
|
|
|
161
|
-
|
|
1249
|
+
There is **one** OAuth 2.1 + PKCE flow and it lives at `/oauth/*` on the ProductDock API — not under `/mcp`. Two channels ride on it: the CLI, which authenticates on its own and calls the project endpoints directly, and the IDEs, which keep talking to the MCP server. Both end up with credentials in `~/.productdock/credentials.json` (mode `0600`), refreshed silently as they expire.
|
|
162
1250
|
|
|
163
1251
|
```
|
|
164
|
-
IDE (Claude Code / Cursor / VS Code)
|
|
165
|
-
│ MCP config: url =
|
|
166
|
-
│
|
|
167
|
-
▼
|
|
168
|
-
ProductDock MCP server
|
|
169
|
-
│
|
|
170
|
-
│
|
|
171
|
-
▼
|
|
172
|
-
Authenticated tool dispatch
|
|
1252
|
+
productdock login IDE (Claude Code / Cursor / VS Code)
|
|
1253
|
+
│ browser + loopback callback │ MCP config: url = <api>/mcp
|
|
1254
|
+
│ │
|
|
1255
|
+
▼ ▼
|
|
1256
|
+
<api>/oauth/authorize · /token · /revoke ProductDock MCP server
|
|
1257
|
+
│ PKCE S256 (RFC 7636) │ same OAuth endpoints, discovered
|
|
1258
|
+
│ refresh + revoke (RFC 6749/7009) │ via /.well-known/oauth-*
|
|
1259
|
+
▼ ▼
|
|
1260
|
+
<api>/cli/* project endpoints Authenticated tool dispatch
|
|
173
1261
|
```
|
|
174
1262
|
|
|
1263
|
+
`<api>` is `PRODUCTDOCK_API_URL` — `https://productdock-api.softdesign.com.br` by default. The endpoints an IDE uses are announced by `/.well-known/oauth-authorization-server`, so an IDE picks the new namespace up on its own; the old `/mcp/oauth/*` prefix is still served while clients migrate.
|
|
1264
|
+
|
|
175
1265
|
---
|
|
176
1266
|
|
|
177
1267
|
## Environment variables
|
|
178
1268
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
| `
|
|
1269
|
+
All optional — defaults point at production.
|
|
1270
|
+
|
|
1271
|
+
| Variable | Default | Description |
|
|
1272
|
+
| -------------------------- | -------------------------------------------------- | ---------------------------------------------------------------------------------- |
|
|
1273
|
+
| `PRODUCTDOCK_API_URL` | `https://productdock-api.softdesign.com.br` | ProductDock API base URL — root of the OAuth (`/oauth/*`) and project (`/cli/*`) endpoints |
|
|
1274
|
+
| `PRODUCTDOCK_MCP_URL` | `<PRODUCTDOCK_API_URL>/mcp` | MCP server URL, written into each IDE config by `mcp setup`. Legacy: when it is set and `PRODUCTDOCK_API_URL` is not, this value minus the `/mcp` suffix becomes the API base |
|
|
1275
|
+
| `PRODUCTDOCK_REGISTRY_URL` | `https://productdock-core-api.softdesign.com.br` | Skill and agent registry URL |
|
|
1276
|
+
| `AI_TOOLS_BRANCH` | _(registry default branch, `main`)_ | Resolve skills and agents from this `ai-tools` branch. Setting it to `main` is the same as not setting it |
|
|
1277
|
+
|
|
1278
|
+
When running from source, these are also read from a `.env` file in the repository root — see `.env.example`.
|
|
184
1279
|
|
|
185
1280
|
---
|
|
186
1281
|
|
|
@@ -189,7 +1284,7 @@ Authenticated tool dispatch
|
|
|
189
1284
|
Requirements: [Bun](https://bun.sh) ≥ 1.1
|
|
190
1285
|
|
|
191
1286
|
```bash
|
|
192
|
-
git clone
|
|
1287
|
+
git clone git@ssh.dev.azure.com:v3/SoftDesignBrasil/ProductDock/productdock-cli
|
|
193
1288
|
cd productdock-cli
|
|
194
1289
|
bun install
|
|
195
1290
|
|
|
@@ -197,8 +1292,49 @@ bun install
|
|
|
197
1292
|
bun run bin/productdock.ts login
|
|
198
1293
|
bun run bin/productdock.ts link
|
|
199
1294
|
bun run bin/productdock.ts doctor
|
|
1295
|
+
bun run bin/productdock.ts skill list
|
|
1296
|
+
bun run bin/productdock.ts agent list
|
|
1297
|
+
|
|
1298
|
+
# Typecheck
|
|
1299
|
+
bun run typecheck
|
|
1300
|
+
|
|
1301
|
+
# Tests (Bun's built-in runner)
|
|
1302
|
+
bun run test
|
|
1303
|
+
|
|
1304
|
+
# A single test file
|
|
1305
|
+
bun test test/output.test.ts
|
|
200
1306
|
```
|
|
201
1307
|
|
|
1308
|
+
### Source layout
|
|
1309
|
+
|
|
1310
|
+
| File | Responsibility |
|
|
1311
|
+
| ------------------------- | -------------------------------------------------------------------------- |
|
|
1312
|
+
| `bin/productdock.ts` | Commander program — command definitions and dispatch |
|
|
1313
|
+
| `lib/constants.ts` | Version, base URLs and environment overrides — the `/oauth/*` and `/cli/*` root, the MCP server URL, the registry, `AI_TOOLS_BRANCH`; loads `.env` when running from source |
|
|
1314
|
+
| `lib/auth.ts` | OAuth 2.1 + PKCE flow, credential store, token refresh |
|
|
1315
|
+
| `lib/config.ts` | `productdock.json` read/write/migrate, `init` and `link` |
|
|
1316
|
+
| `lib/api.ts` | Project and repository lookup behind `link` — `/cli/projects` and `/cli/projects/{id}/repositories` |
|
|
1317
|
+
| `lib/git.ts` | `origin` remote detection and Azure DevOps URL parsing (SSH, HTTPS, legacy) |
|
|
1318
|
+
| `lib/ide.ts` | IDE detection and MCP config writing |
|
|
1319
|
+
| `lib/registry.ts` | Registry HTTP client — one code path for skills and agents, `?branch=` |
|
|
1320
|
+
| `lib/http.ts` | HTTP client for the `/cli/*` endpoints — file bodies, `multipart`, HTTP status kept in the error |
|
|
1321
|
+
| `lib/scope.ts` | Project scope — `project_id`/`repository_id` from `productdock.json`, flags override |
|
|
1322
|
+
| `lib/artifacts.ts` | Install core: destinations, zip extraction, SHA256 fingerprint, drift |
|
|
1323
|
+
| `lib/frontmatter.ts` | Frontmatter adaptation per platform (agents) — port of the ai-tools installer |
|
|
1324
|
+
| `lib/artifact-commands.ts`| The `skill` and `agent` command groups, generic over artifact kind |
|
|
1325
|
+
| `lib/work-items.ts` | The `wi` command group — `list`, `prd` and `spec-context` over `/cli/work-items/*` |
|
|
1326
|
+
| `lib/work-item-attachments.ts` | The `wi` writes — `comment` over `/cli/work-items/comments` and `evidence` (multipart) over `/cli/work-items/qa-evidence` |
|
|
1327
|
+
| `lib/code.ts` | The `code` command group — `map` and `search` over `/cli/code/*` |
|
|
1328
|
+
| `lib/phase-artifacts.ts` | The `artifact` command group — `submit` over `/cli/artifacts` and `commit` over `/cli/artifacts/commit`, body from a file |
|
|
1329
|
+
| `lib/prd-review.ts` | The `prd-review` command group — `get` (mandatory read-back) and `submit` over `/cli/prd-review` |
|
|
1330
|
+
| `lib/evaluations.ts` | The `eval` command group — `submit` over `/cli/evaluations`, envelope from a file, project-level |
|
|
1331
|
+
| `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 |
|
|
1332
|
+
| `lib/doctor.ts` | Diagnostics |
|
|
1333
|
+
| `lib/exit.ts` | Exit code taxonomy — `CliError` and the error → code mapping |
|
|
1334
|
+
| `lib/output.ts` | Output layer — JSON on `stdout`, prose on `stderr`, credential redaction |
|
|
1335
|
+
| `lib/tty.ts` | TTY guard — fails fast instead of blocking on a prompt |
|
|
1336
|
+
| `lib/types.d.ts` | Shared types — IDE keys, install targets, `productdock.json` shape |
|
|
1337
|
+
|
|
202
1338
|
### Building
|
|
203
1339
|
|
|
204
1340
|
```bash
|