@softdesignbrasil/productdock-cli 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -186,7 +186,7 @@ productdock logout
186
186
 
187
187
  ### `productdock link`
188
188
 
189
- Links the current directory to a ProductDock project, recording it in `productdock.json`. Prompts you to select a project, auto-detects the matching repository from your git remote, then offers to:
189
+ Links the current directory to a ProductDock project, recording it in `productdock.json`. Prompts you to select a project, picks the matching repository from your git remote (see [How the repository is chosen](#how-the-repository-is-chosen)), then offers to:
190
190
 
191
191
  1. write the MCP configuration for your IDEs, and
192
192
  2. install every skill and agent published under the `productdock` category.
@@ -197,19 +197,34 @@ productdock link
197
197
  # Skip interactive project selection
198
198
  productdock link --project-id <uuid>
199
199
 
200
- # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts)
200
+ # Fully non-interactive — the way an IDE agent runs it (no TTY, no prompts).
201
+ # Run inside the repository: the repository comes from its git remote
202
+ productdock link --project-id <uuid> --ide claude-code --yes --json
203
+
204
+ # Pin the repository explicitly, wherever you run it
201
205
  productdock link --project-id <uuid> --repository-id <uuid> --ide claude-code --yes --json
202
206
  ```
203
207
 
208
+ #### How the repository is chosen
209
+
210
+ In this order, and the first rule that decides wins:
211
+
212
+ 1. `--repository-id` — that repository, or the command is refused when the id is not in the project.
213
+ 2. The project has no repository — the link is written without one.
214
+ 3. The project has exactly one repository — that one.
215
+ 4. **The `origin` remote of the current directory.** When it is an Azure DevOps URL — SSH (`git@ssh.dev.azure.com:v3/<org>/<project>/<repo>`), HTTPS (`https://dev.azure.com/<org>/<project>/_git/<repo>`) or legacy (`https://<org>.visualstudio.com/<project>/_git/<repo>`) — the repository whose **organization, Azure project and name all match** it is chosen, without asking. The comparison ignores case and reads the URL-encoded parts decoded (`Meu%20Projeto` matches `Meu Projeto`). The name alone never decides: two repositories called `portal` in different Azure projects are told apart by the project in the remote.
216
+ 5. Nothing matched exactly one repository (no `origin`, a remote that is not Azure DevOps, or no repository with that organization + project + name) — with a terminal, `link` asks; without one, see below.
217
+
204
218
  Every point where `link` would ask a question has a flag, so the command runs
205
219
  to completion in a process with no terminal — the way an IDE agent executes
206
220
  step 2 of the prompt copied from the "Connect to your IDE" drawer. Without a
207
221
  TTY and with no flag, each install decision takes the same value the prompt
208
222
  offered by default (yes); `--no-install-mcp` / `--no-install-skills` opt out.
209
- When the project has more than one repository and no `--repository-id` is
210
- given, the link is written **without** a repository (a valid state — every
211
- operation that needs one asks for `--repository-id` at the point of use) and
212
- the accepted ids are printed to `stderr`.
223
+ When the project has more than one repository, no `--repository-id` is given
224
+ and the git remote matches none of them, the link is written **without** a
225
+ repository (a valid state — every operation that needs one asks for
226
+ `--repository-id` at the point of use), the exit code is still `0`, and the
227
+ accepted ids are printed to `stderr`.
213
228
 
214
229
  Nothing is written until every decision is made: a `link` that fails leaves the
215
230
  directory exactly as it was, instead of a `productdock.json` carrying only the
@@ -219,7 +234,7 @@ project.
219
234
  | ------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |
220
235
  | `--project-id <uuid>` | Skip interactive project selection |
221
236
  | `--repository-id <uuid>` | Skip interactive repository selection; refused when the id is not in the project |
222
- | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Replaces running `productdock init`, which needs a terminal |
237
+ | `--ide <ide>` | IDE to configure — `claude-code`, `cursor`, `vscode`, `claude-desktop` (repeatable). Added to the IDEs already in `productdock.json` (never replaces what `productdock init` wrote); without a prior `init`, it stands in for it |
223
238
  | `--install-mcp` | Install the MCP configuration without asking |
224
239
  | `--no-install-mcp` | Do not install the MCP configuration |
225
240
  | `--install-skills` | Install skills and agents without asking |
@@ -292,6 +307,13 @@ productdock skill install pd-workflow --version 1.4.0
292
307
  # Overwrite something already on disk
293
308
  productdock skill install pd-workflow --force
294
309
 
310
+ # Install every item of one source — what `link` installs, on demand
311
+ productdock agent install --source productdock
312
+ productdock skill install --source productdock --json
313
+
314
+ # Same, overwriting what is already on disk
315
+ productdock agent install --source productdock --force
316
+
295
317
  # Update one, or everything installed
296
318
  productdock skill update pd-workflow
297
319
  productdock agent update
@@ -307,10 +329,37 @@ productdock agent status
307
329
  | Subcommand | Description |
308
330
  | ---------------- | --------------------------------------------------------------------------------------------------------------------------------------- |
309
331
  | `list` | List what the registry offers. `--source internal\|third-party\|productdock` |
310
- | `install <name>` | Install into every target derived from `productdock.json`. `--version <version>`. Refuses if it already exists on disk unless `--force` |
332
+ | `install [name]` | Install into every target derived from `productdock.json` — one item by `name`, or every item of a source with `--source internal\|third-party\|productdock`. `--version <version>` (by name only). `--force` overwrites what is already on disk: without it, `install <name>` refuses and `install --source` skips an item installed in every target, installs it only in the targets where it is missing (an empty or partial folder counts as missing) and reports it |
311
333
  | `update [name]` | Update one, or every installed item. Up-to-date and locally modified items are skipped unless `--force` |
312
334
  | `status` | Report `up to date` / `outdated` / `modified` per installed item |
313
335
 
336
+ `install` takes **either** a name **or** `--source`: both together, or neither,
337
+ is a usage error (exit `1`). A source outside `internal`, `third-party` and
338
+ `productdock` is refused (exit `1`), naming the accepted values. The source is
339
+ the registry's `category` — the same dimension `list --source` filters by.
340
+
341
+ Under `--json`, `install --source` reports the effect item by item:
342
+
343
+ ```jsonc
344
+ {
345
+ "ok": true,
346
+ "operation": "agent_install", // or "skill_install"
347
+ "data": {
348
+ "kind": "agent",
349
+ "source": "productdock",
350
+ "targets": ["claude", "copilot"],
351
+ "installed": ["pd-reviewer"], // written now
352
+ "skipped": ["pd-planner"], // already installed, left untouched (no --force); an empty or partial folder is reinstalled
353
+ "failed": [], // the registry refused it
354
+ },
355
+ }
356
+ ```
357
+
358
+ A partial batch is a success (exit `0`) — `failed` names what is missing. When
359
+ **nothing** was installed and something failed (the registry is down, every
360
+ download refused), the command exits `1` — or `2` when the cause is the
361
+ session — with the error document instead.
362
+
314
363
  `status` compares a SHA256 fingerprint of the installed directory against the versions the registry knows about:
315
364
 
316
365
  | Symbol | Meaning |
@@ -1818,9 +1867,12 @@ Checks performed:
1818
1867
  3. `productdock.json` exists with an IDE list
1819
1868
  4. The directory is linked to a ProductDock project
1820
1869
  5. MCP server is reachable
1821
- 6. MCP config files exist for each configured IDE and point at the correct URL
1870
+ 6. MCP config files exist for each configured IDE, point at the correct URL and carry the project and repository of the
1871
+ current link — after re-linking to another repository, `--fix` rewrites them. The MCP is legacy and optional: in a
1872
+ directory that never configured it (no `mcp` in `productdock.json`, no `productdock` entry in any IDE file, as after
1873
+ `link --no-install-mcp`) this check passes and `--fix` does not install it
1822
1874
  7. `AI_TOOLS_BRANCH` is not silently overriding the skill/agent source
1823
- 8. Every skill and agent recorded in `productdock.json` is present on disk
1875
+ 8. Every skill and agent recorded in `productdock.json` is installed on disk — a skill folder without its `SKILL.md`, or an empty agent file, counts as missing
1824
1876
 
1825
1877
  ---
1826
1878