@phnx-labs/agents-cli 1.20.3 → 1.20.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/README.md +48 -17
  3. package/dist/commands/cli.js +1 -1
  4. package/dist/commands/cloud.js +1 -1
  5. package/dist/commands/commands.js +2 -0
  6. package/dist/commands/doctor.js +1 -1
  7. package/dist/commands/exec.js +52 -16
  8. package/dist/commands/hooks.js +6 -6
  9. package/dist/commands/import.js +90 -37
  10. package/dist/commands/inspect.d.ts +26 -0
  11. package/dist/commands/inspect.js +590 -0
  12. package/dist/commands/mcp.js +17 -16
  13. package/dist/commands/models.js +1 -1
  14. package/dist/commands/packages.js +6 -4
  15. package/dist/commands/permissions.js +13 -12
  16. package/dist/commands/plugins.d.ts +13 -0
  17. package/dist/commands/plugins.js +100 -11
  18. package/dist/commands/prune.js +3 -2
  19. package/dist/commands/pull.d.ts +12 -5
  20. package/dist/commands/pull.js +26 -422
  21. package/dist/commands/push.d.ts +14 -0
  22. package/dist/commands/push.js +30 -0
  23. package/dist/commands/repo.d.ts +1 -1
  24. package/dist/commands/repo.js +155 -112
  25. package/dist/commands/resource-view.d.ts +2 -0
  26. package/dist/commands/resource-view.js +12 -3
  27. package/dist/commands/routines.js +32 -7
  28. package/dist/commands/rules.js +1 -1
  29. package/dist/commands/sessions.js +1 -0
  30. package/dist/commands/setup.d.ts +3 -3
  31. package/dist/commands/setup.js +15 -15
  32. package/dist/commands/skills.js +6 -5
  33. package/dist/commands/subagents.js +5 -4
  34. package/dist/commands/sync.d.ts +18 -5
  35. package/dist/commands/sync.js +251 -65
  36. package/dist/commands/teams.js +1 -0
  37. package/dist/commands/tmux.d.ts +25 -0
  38. package/dist/commands/tmux.js +415 -0
  39. package/dist/commands/trash.d.ts +2 -2
  40. package/dist/commands/trash.js +1 -1
  41. package/dist/commands/versions.js +2 -2
  42. package/dist/commands/view.js +14 -4
  43. package/dist/commands/workflows.js +4 -3
  44. package/dist/commands/worktree.d.ts +4 -5
  45. package/dist/commands/worktree.js +4 -4
  46. package/dist/index.js +68 -20
  47. package/dist/lib/agents.d.ts +19 -10
  48. package/dist/lib/agents.js +102 -28
  49. package/dist/lib/auto-pull-worker.d.ts +1 -1
  50. package/dist/lib/auto-pull-worker.js +2 -2
  51. package/dist/lib/auto-pull.d.ts +1 -1
  52. package/dist/lib/auto-pull.js +1 -1
  53. package/dist/lib/beta.d.ts +1 -1
  54. package/dist/lib/beta.js +1 -1
  55. package/dist/lib/capabilities.js +2 -0
  56. package/dist/lib/commands.d.ts +28 -1
  57. package/dist/lib/commands.js +125 -20
  58. package/dist/lib/doctor-diff.js +2 -2
  59. package/dist/lib/exec.d.ts +14 -0
  60. package/dist/lib/exec.js +39 -5
  61. package/dist/lib/fuzzy.d.ts +12 -2
  62. package/dist/lib/fuzzy.js +29 -4
  63. package/dist/lib/git.js +8 -1
  64. package/dist/lib/hooks.d.ts +2 -2
  65. package/dist/lib/hooks.js +97 -10
  66. package/dist/lib/import.d.ts +21 -0
  67. package/dist/lib/import.js +55 -2
  68. package/dist/lib/mcp.js +32 -2
  69. package/dist/lib/migrate.d.ts +51 -0
  70. package/dist/lib/migrate.js +227 -1
  71. package/dist/lib/models.js +62 -15
  72. package/dist/lib/permissions.d.ts +36 -2
  73. package/dist/lib/permissions.js +217 -7
  74. package/dist/lib/plugin-marketplace.d.ts +108 -40
  75. package/dist/lib/plugin-marketplace.js +243 -94
  76. package/dist/lib/plugins.d.ts +21 -4
  77. package/dist/lib/plugins.js +130 -49
  78. package/dist/lib/profiles-presets.js +12 -12
  79. package/dist/lib/project-launch.d.ts +65 -0
  80. package/dist/lib/project-launch.js +367 -0
  81. package/dist/lib/pty-client.js +1 -1
  82. package/dist/lib/pty-server.d.ts +1 -1
  83. package/dist/lib/pty-server.js +28 -4
  84. package/dist/lib/refresh.d.ts +26 -0
  85. package/dist/lib/refresh.js +315 -0
  86. package/dist/lib/resource-patterns.d.ts +1 -1
  87. package/dist/lib/resource-patterns.js +1 -1
  88. package/dist/lib/resources/commands.js +2 -2
  89. package/dist/lib/resources/hooks.d.ts +1 -1
  90. package/dist/lib/resources/hooks.js +1 -1
  91. package/dist/lib/resources/mcp.d.ts +1 -1
  92. package/dist/lib/resources/mcp.js +5 -6
  93. package/dist/lib/resources/permissions.js +5 -2
  94. package/dist/lib/resources/rules.js +3 -2
  95. package/dist/lib/resources/skills.js +3 -2
  96. package/dist/lib/resources/types.d.ts +1 -1
  97. package/dist/lib/resources.js +2 -2
  98. package/dist/lib/rotate.d.ts +1 -1
  99. package/dist/lib/rotate.js +1 -1
  100. package/dist/lib/routines.d.ts +16 -4
  101. package/dist/lib/routines.js +67 -17
  102. package/dist/lib/rules/compile.js +22 -10
  103. package/dist/lib/rules/rules.js +3 -3
  104. package/dist/lib/runner.js +16 -3
  105. package/dist/lib/scheduler.js +15 -1
  106. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  107. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  108. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
  109. package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
  110. package/dist/lib/secrets/linux.d.ts +44 -9
  111. package/dist/lib/secrets/linux.js +302 -48
  112. package/dist/lib/session/db.js +15 -2
  113. package/dist/lib/session/discover.js +118 -3
  114. package/dist/lib/session/parse.js +3 -0
  115. package/dist/lib/session/types.d.ts +1 -1
  116. package/dist/lib/session/types.js +1 -1
  117. package/dist/lib/shims.d.ts +10 -9
  118. package/dist/lib/shims.js +101 -50
  119. package/dist/lib/skills.d.ts +1 -1
  120. package/dist/lib/skills.js +10 -9
  121. package/dist/lib/staleness/detectors/commands.d.ts +3 -0
  122. package/dist/lib/staleness/detectors/commands.js +46 -0
  123. package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
  124. package/dist/lib/staleness/detectors/hooks.js +44 -0
  125. package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
  126. package/dist/lib/staleness/detectors/mcp.js +31 -0
  127. package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
  128. package/dist/lib/staleness/detectors/permissions.js +201 -0
  129. package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
  130. package/dist/lib/staleness/detectors/plugins.js +23 -0
  131. package/dist/lib/staleness/detectors/rules.d.ts +3 -0
  132. package/dist/lib/staleness/detectors/rules.js +34 -0
  133. package/dist/lib/staleness/detectors/skills.d.ts +3 -0
  134. package/dist/lib/staleness/detectors/skills.js +71 -0
  135. package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
  136. package/dist/lib/staleness/detectors/subagents.js +50 -0
  137. package/dist/lib/staleness/detectors/types.d.ts +22 -0
  138. package/dist/lib/staleness/detectors/types.js +1 -0
  139. package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
  140. package/dist/lib/staleness/detectors/workflows.js +28 -0
  141. package/dist/lib/staleness/registry.d.ts +26 -0
  142. package/dist/lib/staleness/registry.js +123 -0
  143. package/dist/lib/staleness/writers/commands.d.ts +3 -0
  144. package/dist/lib/staleness/writers/commands.js +111 -0
  145. package/dist/lib/staleness/writers/hooks.d.ts +3 -0
  146. package/dist/lib/staleness/writers/hooks.js +47 -0
  147. package/dist/lib/staleness/writers/kinds.d.ts +10 -0
  148. package/dist/lib/staleness/writers/kinds.js +15 -0
  149. package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
  150. package/dist/lib/staleness/writers/lazy-map.js +19 -0
  151. package/dist/lib/staleness/writers/mcp.d.ts +10 -0
  152. package/dist/lib/staleness/writers/mcp.js +19 -0
  153. package/dist/lib/staleness/writers/permissions.d.ts +13 -0
  154. package/dist/lib/staleness/writers/permissions.js +26 -0
  155. package/dist/lib/staleness/writers/plugins.d.ts +7 -0
  156. package/dist/lib/staleness/writers/plugins.js +31 -0
  157. package/dist/lib/staleness/writers/rules.d.ts +7 -0
  158. package/dist/lib/staleness/writers/rules.js +55 -0
  159. package/dist/lib/staleness/writers/skills.d.ts +3 -0
  160. package/dist/lib/staleness/writers/skills.js +81 -0
  161. package/dist/lib/staleness/writers/sources.d.ts +16 -0
  162. package/dist/lib/staleness/writers/sources.js +72 -0
  163. package/dist/lib/staleness/writers/subagents.d.ts +3 -0
  164. package/dist/lib/staleness/writers/subagents.js +53 -0
  165. package/dist/lib/staleness/writers/types.d.ts +36 -0
  166. package/dist/lib/staleness/writers/types.js +1 -0
  167. package/dist/lib/staleness/writers/workflows.d.ts +7 -0
  168. package/dist/lib/staleness/writers/workflows.js +31 -0
  169. package/dist/lib/state.d.ts +34 -11
  170. package/dist/lib/state.js +58 -13
  171. package/dist/lib/subagents.d.ts +0 -2
  172. package/dist/lib/subagents.js +6 -6
  173. package/dist/lib/teams/agents.js +1 -1
  174. package/dist/lib/teams/parsers.d.ts +1 -1
  175. package/dist/lib/tmux/binary.d.ts +67 -0
  176. package/dist/lib/tmux/binary.js +141 -0
  177. package/dist/lib/tmux/index.d.ts +8 -0
  178. package/dist/lib/tmux/index.js +8 -0
  179. package/dist/lib/tmux/paths.d.ts +17 -0
  180. package/dist/lib/tmux/paths.js +30 -0
  181. package/dist/lib/tmux/session.d.ts +122 -0
  182. package/dist/lib/tmux/session.js +305 -0
  183. package/dist/lib/types.d.ts +58 -7
  184. package/dist/lib/types.js +1 -1
  185. package/dist/lib/usage.js +1 -1
  186. package/dist/lib/versions.d.ts +4 -4
  187. package/dist/lib/versions.js +154 -491
  188. package/dist/lib/workflows.d.ts +2 -4
  189. package/dist/lib/workflows.js +3 -4
  190. package/package.json +7 -7
  191. package/scripts/postinstall.js +16 -63
  192. package/dist/commands/status.d.ts +0 -9
  193. package/dist/commands/status.js +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ## 1.20.5
6
+
7
+ **`agents inspect` — per-agent+version detail view with drill-down (#217)**
8
+
9
+ - New top-level command `agents inspect <agent>[@version]`. Summary mode shows install path, config symlink target, shim path, versioned alias, run strategy, capability table (`hooks`/`mcp`/`skills`/`commands`/`subagents`/`plugins`/`workflows`/`rules`/`allowlist`), resource counts with project/user/system scope breakdown, and session total. Replaces the awkward `agents view <agent>@<version>` deep-detail mode as a dedicated verb; `view` itself is unchanged.
10
+ - Drill-down flags for every resource kind — `--commands`, `--skills`, `--hooks`, `--mcp`, `--rules`, `--plugins`, `--workflows`, `--subagents`. Bare flag lists every entry; passing a positional query fuzzy-searches that kind, ranking exact > substring > Damerau-Levenshtein. Zero matches exit 1 with the three closest names as suggestions. One drill-down at a time (validation error otherwise). `--json` works with summary and every drill-down for scriptable consumption.
11
+ - Resource names render as OSC-8 terminal hyperlinks to the marker file (`SKILL.md` / `WORKFLOW.md` / `AGENT.md`) for clickable navigation in modern terminals (Ghostty, iTerm2, WezTerm) — no inline path noise. Plain text on terminals without OSC-8 support.
12
+ - MCP detail intentionally suppresses path and env values to avoid leaking secrets — only the server name, scope, and version reach the output.
13
+ - Removes the deprecated `agents status` alias for `view @default`. Top-level help text updated; no consumers referenced it.
14
+
15
+ **Headless Linux: encrypted-file fallback when libsecret collection is locked (#183)**
16
+
17
+ - On server-class Linux (Ubuntu 24.04 over SSH on the reporter's box), `agents secrets create x` failed with `secret-tool: Cannot create an item in a locked collection`. Diagnosis in the issue: `gnome-keyring-daemon` is running and D-Bus is reachable, but the default `login` collection is locked because no graphical login has fed the daemon the passphrase, and `secret-tool` from `libsecret-tools` has no `--collection` flag so it can't target the unlocked `session` collection. This made `agents secrets` effectively macOS-only on any headless box.
18
+ - `src/lib/secrets/linux.ts` now transparently falls back to a file-based AES-256-GCM encrypted store at `~/.agents/.cache/secrets/<item>.enc` (mode 0600, per-file random scrypt salt + 96-bit IV, GCM auth tag). The encryption key is scrypt-derived from a passphrase read from `AGENTS_SECRETS_PASSPHRASE` (preferred) or a TTY prompt via `/dev/tty` with `stty -echo` for non-echoing input. The fallback also activates when `libsecret-tools` is not installed at all but `AGENTS_SECRETS_PASSPHRASE` is set, so a fresh install can store secrets without any apt-get step.
19
+ - The decision is cached per process; on first activation we emit one stderr line: `[agents] secret-service collection locked, using file-based store at <dir>`. The `KeychainBackend` interface in `src/lib/secrets/index.ts` is unchanged — `has`/`get`/`set`/`delete`/`list` work identically against either backend, so `bundles.ts`, `sync.ts`, and every consumer above it sees no API change.
20
+ - Items written into the file store before the fallback was added remain accessible only via libsecret if/when the collection is later unlocked; this PR does not migrate stranded items in either direction — the user simply re-creates them on a freshly headless box.
21
+
22
+ ## 1.20.4
23
+
24
+ **Plugin marketplace sync (skip outside-pointing symlinks)**
25
+
26
+ - `copyPluginToMarketplace` used `fs.cpSync(plugin.root, dest, { recursive: true, dereference: false })`, which faithfully preserved every symlink — including the ones plugin authors put at the top of their plugin source for prompt-side references (the rush plugin's `app -> ../../../rush/app`, `web -> rush/web`, `widgets -> rush/widgets`). Those targets resolve to the rush monorepo (~8.7 GB of `app/` including node_modules + .next builds, 782 MB of `web/`, plus 463 MB brand-assets). Every claude version got a full set of those symlinks in `~/.claude/plugins/marketplaces/agents-cli/plugins/rush/`. When the consumer (Claude Code, OpenClaw) discovers plugins, it walks the marketplace tree and follows those symlinks — producing multi-minute startup hangs.
27
+ - The copy now walks the source tree and drops symlinks whose `realpath` escapes the plugin root, leaving internal symlinks intact (cpSync rewrites internal targets to absolute paths into the source tree, which the consumer still resolves correctly). One informational line per plugin lists the skipped names so plugin authors notice.
28
+ - Existing per-version marketplace directories still hold the bloat from prior syncs; clean up with `rm` against `~/.claude/plugins/marketplaces/agents-cli/plugins/*/{app,web,widgets,*-symlinks-that-escaped}` then re-run `agents pull` or any plugin sync to re-copy with the filter.
29
+
3
30
  ## 1.20.3
4
31
 
5
32
  **`agents run` startup latency (stale-while-revalidate the usage probe + memoize agents.yaml)**
package/README.md CHANGED
@@ -641,23 +641,54 @@ By default, secrets sync via iCloud Keychain to your other Macs. With `--no-iclo
641
641
 
642
642
  ## Compatibility
643
643
 
644
- | Agent | Versions | MCP | Commands | Skills | Rules | Hooks | Plugins | Permissions | Routines | Teams |
645
- |-------|----------|-----|----------|--------|-------|-------|---------|-------------|----------|-------|
646
- | Claude Code | yes | yes | yes | yes | CLAUDE.md | yes | yes | yes | yes | yes |
647
- | Codex CLI | yes | yes | yes | yes | AGENTS.md | yes (>= 0.116.0) | -- | yes | yes | yes |
648
- | Gemini CLI | yes | yes | yes | yes | GEMINI.md | yes (>= 0.26.0) | -- | -- | yes | yes |
649
- | OpenClaw | yes | yes | -- | yes | workspace/AGENTS.md | yes | yes | -- | -- | -- |
650
- | Cursor | yes | yes | yes | yes | .cursorrules | -- | -- | -- | -- | yes |
651
- | OpenCode | yes | yes | yes | yes | AGENTS.md | -- | -- | yes | -- | yes |
652
- | Copilot | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
653
- | Amp | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
654
- | Kiro | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
655
- | Goose | yes | yes | -- | -- | AGENTS.md | -- | -- | -- | -- | -- |
656
- | Roo Code | yes | yes | yes | yes | AGENTS.md | -- | -- | -- | -- | -- |
657
-
658
- Hooks columns marked `yes (>= X.Y.Z)` are version-gated: `agents hooks add` skips with a clear message when the installed binary is older than the listed version, instead of writing config the older binary would silently ignore. OpenCode's plugin-based hook system is on the roadmap; the entry is `--` until a writer ships.
659
-
660
- Codex command sync is version-aware: Codex `0.116.x` and older receive slash commands in `.codex/prompts/`; Codex `0.117.0+` receives those commands as generated skills so they can be invoked with `$name`.
644
+ Which DotAgents resources each agent CLI can load. Source of truth: [src/lib/agents.ts](src/lib/agents.ts) (`capabilities`); gates use `supports(agent, cap, version)` from [src/lib/capabilities.ts](src/lib/capabilities.ts). Full matrix also in [docs/00-concepts.md](docs/00-concepts.md).
645
+
646
+ | Agent | Versions | Hooks | MCP | Permissions | Skills | Commands | Plugins | Subagents | Rules | Workflows |
647
+ |-------|----------|-------|-----|-------------|--------|----------|---------|-----------|-------|-----------|
648
+ | Claude Code | yes | yes | yes | yes | yes | yes | yes | yes | `CLAUDE.md` | yes |
649
+ | Codex CLI | yes | >= 0.116.0 | yes | no | yes | < 0.117.0 · skills ($name, >= 0.117) | >= 0.128.0 | no | `AGENTS.md` | no |
650
+ | Gemini CLI | yes | >= 0.26.0 | yes | no | yes | yes (.toml) | no | no | `GEMINI.md` | no |
651
+ | Antigravity | yes | yes | yes | yes | yes | yes | yes | no | `AGENTS.md` | no |
652
+ | Grok Build | yes | yes | yes | yes | yes | skills ($name) | yes | no | `AGENTS.md` | no |
653
+ | OpenClaw | yes | yes | yes | no | yes | gateway | yes | yes | `workspace/AGENTS.md` | no |
654
+ | Cursor | yes | no | yes | no | yes | yes | no | no | `.cursorrules` | no |
655
+ | OpenCode | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
656
+ | Copilot | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
657
+ | Amp | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
658
+ | Kiro | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
659
+ | Goose | yes | no | yes | no | no | no | no | no | `AGENTS.md` | no |
660
+ | Roo Code | yes | no | yes | no | yes | yes | no | no | `AGENTS.md` | no |
661
+
662
+ **Legend:** `yes` / `no` = synced or skipped at install time. `skills ($name)` = no file-based slash-command dir; behavior ships as a generated skill invoked with `$command`. `gateway` = OpenClaw resolves slash commands at runtime, not from synced files. Version suffixes are enforced at sync time — out-of-range versions are skipped with a clear message.
663
+
664
+ **Host CLIs** (`agents cli`) are separate: YAML manifests under `~/.agents/cli/` install binaries onto your PATH (`gh`, `higgsfield`, etc.). They are not copied into per-agent version homes.
665
+
666
+ ### agents-cli features (not agent-native resources)
667
+
668
+ | Agent | Routines | Teams | Session index |
669
+ |-------|----------|-------|---------------|
670
+ | Claude Code | yes | yes | yes |
671
+ | Codex CLI | yes | yes | yes |
672
+ | Gemini CLI | yes | yes | yes |
673
+ | Cursor | -- | yes | -- |
674
+ | OpenCode | -- | yes | -- |
675
+ | Grok Build | -- | yes | yes |
676
+ | Antigravity | -- | yes | -- |
677
+ | Copilot | -- | -- | yes |
678
+ | OpenClaw, Amp, Kiro, Goose, Roo | -- | -- | -- |
679
+
680
+ ### Version-gated sync
681
+
682
+ | Capability | Agent | Gate |
683
+ |------------|-------|------|
684
+ | Hooks | Codex | >= 0.116.0 |
685
+ | Hooks | Gemini | >= 0.26.0 |
686
+ | File-based commands | Codex | < 0.117.0 (0.117+ uses command-as-skill) |
687
+ | Plugins | Codex | >= 0.128.0 |
688
+
689
+ Codex `0.117.0+` no longer reads `.codex/prompts/`; agents-cli converts slash commands into skills so they stay invocable as `$name`. OpenCode's plugin-based hook system is on the roadmap; hooks stay `no` until a writer ships.
690
+
691
+ Slash commands can declare per-agent/version targeting in frontmatter (`agents:`, `since:`, `until:`). Gating applies when syncing from `~/.agents/commands/` (user/system) into version homes — project `.agents/commands/` files are read in place and are not filtered by `agents:`. This repo ships `.agents/commands/version.md` as `/version` for Claude, Codex, Gemini, Cursor, OpenCode, Copilot, and Grok; Antigravity excluded until verified.
661
692
 
662
693
  ## FAQ
663
694
 
@@ -52,7 +52,7 @@ Examples:
52
52
  agents cli check
53
53
 
54
54
  When to use:
55
- - After 'agents pull' on a new machine, to materialize host binaries
55
+ - After 'agents repo refresh' on a new machine, to materialize host binaries
56
56
  - In a team setup: commit cli/ entries so teammates get the same toolchain
57
57
  `);
58
58
  cliCmd
@@ -123,7 +123,7 @@ Examples:
123
123
  # Codex Cloud
124
124
  agents cloud run "add auth tests" --provider codex --env env_abc123
125
125
 
126
- # Default provider (set in ~/.agents-system/agents.yaml)
126
+ # Default provider (set in ~/.agents/agents.yaml)
127
127
  agents cloud run "refactor auth module" --repo user/repo
128
128
  `)
129
129
  .action(async (positionalPrompt, options) => {
@@ -506,6 +506,8 @@ function buildCommandRows(opts) {
506
506
  status = 'synced';
507
507
  else if (diff.toUpdate.includes(name))
508
508
  status = 'stale';
509
+ else if (diff.toRemove.includes(name))
510
+ status = 'stale';
509
511
  else
510
512
  status = 'missing';
511
513
  targets.push({
@@ -310,7 +310,7 @@ function renderTargetText(report, options) {
310
310
  }
311
311
  else {
312
312
  console.log(` Verdict: ${verdictParts.join(', ')}.`);
313
- console.log(chalk.gray(` Run \`agents sync --agent ${report.agent} --agent-version ${report.version}\` to reconcile, or \`agents prune cleanup\` to drop extras.`));
313
+ console.log(chalk.gray(` Run \`agents sync ${report.agent}@${report.version}\` to reconcile, or \`agents prune cleanup\` to drop extras.`));
314
314
  }
315
315
  }
316
316
  // ─── command registration ────────────────────────────────────────────────────
@@ -85,7 +85,7 @@ export function registerRunCommand(program) {
85
85
  `,
86
86
  });
87
87
  runCmd.action(async (agentSpec, prompt, options) => {
88
- const [{ buildExecCommand, parseExecEnv, execAgent, runWithFallback, normalizeMode, resolveMode }, { ALL_AGENT_IDS }, { profileExists, resolveProfileForRun }, { readAndResolveBundleEnv, describeBundle }, { getConfiguredRunStrategy, normalizeRunStrategy, resolveRunVersion, RUN_STRATEGIES }, { getGlobalDefault, getVersionHomePath, resolveVersionAlias }, { buildDiscoveredPlugin, loadPluginManifest, syncPluginToVersion }, { parseWorkflowFrontmatter, resolveWorkflowRef },] = await Promise.all([
88
+ const [{ buildExecCommand, parseExecEnv, execAgent, runWithFallback, normalizeMode, resolveMode, defaultModeFor }, { ALL_AGENT_IDS }, { profileExists, resolveProfileForRun }, { readAndResolveBundleEnv, describeBundle }, { getConfiguredRunStrategy, normalizeRunStrategy, resolveRunVersion, RUN_STRATEGIES }, { getGlobalDefault, getVersionHomePath, resolveVersionAlias }, { buildDiscoveredPlugin, loadPluginManifest, syncPluginToVersion }, { parseWorkflowFrontmatter, resolveWorkflowRef },] = await Promise.all([
89
89
  import('../lib/exec.js'),
90
90
  import('../lib/agents.js'),
91
91
  import('../lib/profiles.js'),
@@ -202,10 +202,20 @@ export function registerRunCommand(program) {
202
202
  process.stderr.write(chalk.gray(`Workflow '${rawAgent}' → claude (${subagentCount} subagents)\n`));
203
203
  }
204
204
  else {
205
- console.error(chalk.red(`Unknown agent: ${rawAgent}`));
206
- console.error(chalk.gray(`Available agents: ${ALL_AGENT_IDS.join(', ')}`));
207
- console.error(chalk.gray(`Or add a profile: agents profiles add <name>`));
208
- process.exit(1);
205
+ // Smart pick: auto-correct a single typo (insertion/deletion/substitution/transposition)
206
+ // against the known agent ids before giving up. Example: `cladue` -> `claude`, `grk` -> `grok`.
207
+ const { fuzzyMatch, FUZZY_PRESETS } = await import('../lib/fuzzy.js');
208
+ const suggested = fuzzyMatch(rawAgent, ALL_AGENT_IDS, FUZZY_PRESETS.agents);
209
+ if (suggested && isValidAgent(suggested)) {
210
+ process.stderr.write(chalk.gray(`Resolved '${rawAgent}' -> '${suggested}' (single-edit match)\n`));
211
+ agent = suggested;
212
+ }
213
+ else {
214
+ console.error(chalk.red(`Unknown agent: ${rawAgent}`));
215
+ console.error(chalk.gray(`Available agents: ${ALL_AGENT_IDS.join(', ')}`));
216
+ console.error(chalk.gray(`Or add a profile: agents profiles add <name>`));
217
+ process.exit(1);
218
+ }
209
219
  }
210
220
  version = resolveVersionAlias(agent, version);
211
221
  const configuredStrategy = getConfiguredRunStrategy(agent, cwd);
@@ -254,20 +264,34 @@ export function registerRunCommand(program) {
254
264
  }
255
265
  // Accept the four canonical modes plus 'full' as a permanent silent
256
266
  // alias for 'skip' (rewritten downstream by normalizeMode in exec.ts).
257
- const mode = options.mode;
267
+ let mode = options.mode;
258
268
  if (!['plan', 'edit', 'auto', 'skip', 'full'].includes(mode)) {
259
269
  console.error(chalk.red(`Invalid mode: ${mode}. Use plan, edit, auto, or skip ('full' accepted as alias for skip).`));
260
270
  process.exit(1);
261
271
  }
262
- // Surface capability errors as a clean CLI message instead of a stack
263
- // trace from buildExecCommand. resolveMode degrades 'auto' silently and
264
- // throws on unsupported 'plan'/'skip' we catch and pretty-print.
272
+ // When the user did not pass --mode explicitly, the default is the
273
+ // generic 'plan'. Some agents (antigravity: edit/skip only, grok in some
274
+ // configurations) do not support plan. For implicit defaults, degrade
275
+ // silently to the agent's first listed mode rather than throwing — the
276
+ // user did not ask for read-only, they asked for "just run it." An
277
+ // explicit --mode plan still throws (see resolveMode), because silently
278
+ // elevating an explicit read-only request to edit is unsafe.
279
+ const modeSource = runCmd.getOptionValueSource('mode');
280
+ const modeIsDefault = modeSource === 'default';
265
281
  try {
266
282
  resolveMode(agent, normalizeMode(mode));
267
283
  }
268
284
  catch (err) {
269
- console.error(chalk.red(err.message));
270
- process.exit(1);
285
+ if (modeIsDefault) {
286
+ mode = defaultModeFor(agent);
287
+ if (!options.quiet) {
288
+ process.stderr.write(chalk.gray(`[agents] ${agent} has no '${options.mode}' mode; using '${mode}'\n`));
289
+ }
290
+ }
291
+ else {
292
+ console.error(chalk.red(err.message));
293
+ process.exit(1);
294
+ }
271
295
  }
272
296
  const effort = options.effort;
273
297
  if (!['low', 'medium', 'high', 'xhigh', 'max', 'auto'].includes(effort)) {
@@ -344,12 +368,24 @@ export function registerRunCommand(program) {
344
368
  process.exit(1);
345
369
  }
346
370
  const entries = options.fallback.split(',').map(s => s.trim()).filter(Boolean);
371
+ const { fuzzyMatch: fuzzyFb, FUZZY_PRESETS: PRESETS_FB } = await import('../lib/fuzzy.js');
347
372
  for (const entry of entries) {
348
- const [fbAgent, fbVersion] = entry.split('@');
349
- if (!isValidAgent(fbAgent)) {
350
- console.error(chalk.red(`Unknown fallback agent: ${fbAgent}`));
351
- console.error(chalk.gray(`Available: ${ALL_AGENT_IDS.join(', ')}`));
352
- process.exit(1);
373
+ const [rawFbAgent, fbVersion] = entry.split('@');
374
+ let fbAgent;
375
+ if (isValidAgent(rawFbAgent)) {
376
+ fbAgent = rawFbAgent;
377
+ }
378
+ else {
379
+ const suggested = fuzzyFb(rawFbAgent, ALL_AGENT_IDS, PRESETS_FB.agents);
380
+ if (suggested && isValidAgent(suggested)) {
381
+ process.stderr.write(chalk.gray(`Resolved fallback '${rawFbAgent}' -> '${suggested}' (single-edit match)\n`));
382
+ fbAgent = suggested;
383
+ }
384
+ else {
385
+ console.error(chalk.red(`Unknown fallback agent: ${rawFbAgent}`));
386
+ console.error(chalk.gray(`Available: ${ALL_AGENT_IDS.join(', ')}`));
387
+ process.exit(1);
388
+ }
353
389
  }
354
390
  if (fbAgent === agent) {
355
391
  console.error(chalk.red(`Fallback cannot include the primary agent (${agent}). Rate-limit fallback only helps when switching providers.`));
@@ -4,8 +4,8 @@ import * as fs from 'fs';
4
4
  import * as os from 'os';
5
5
  import * as path from 'path';
6
6
  import { checkbox } from '@inquirer/prompts';
7
- import { AGENTS, HOOKS_CAPABLE_AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/agents.js';
8
- import { supports } from '../lib/capabilities.js';
7
+ import { AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/agents.js';
8
+ import { supports, capableAgents } from '../lib/capabilities.js';
9
9
  import { cloneRepo } from '../lib/git.js';
10
10
  import { discoverHooksFromRepo, installHooksCentrally, listCentralHooks, listInstalledHooksWithScope, getHookInfo, parseHookManifest, iterHooksCapableVersions, removeHookFromVersion, } from '../lib/hooks.js';
11
11
  import { listInstalledVersions, getGlobalDefault, resolveVersionAlias, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveInstalledAgentTargets, } from '../lib/versions.js';
@@ -58,7 +58,7 @@ When to use:
58
58
  agentId = resolveAgentName(agentName);
59
59
  if (!agentId) {
60
60
  spinner.stop();
61
- console.log(chalk.red(formatAgentError(agentName, [...HOOKS_CAPABLE_AGENTS])));
61
+ console.log(chalk.red(formatAgentError(agentName, [...capableAgents('hooks')])));
62
62
  process.exit(1);
63
63
  }
64
64
  requestedVersion = resolveVersionAlias(agentId, parts[1]) ?? null;
@@ -185,7 +185,7 @@ When to use:
185
185
  }
186
186
  // No agent specified - show default version for each hooks-capable agent
187
187
  console.log(chalk.bold('Installed Hooks\n'));
188
- for (const aid of HOOKS_CAPABLE_AGENTS) {
188
+ for (const aid of capableAgents('hooks')) {
189
189
  const agent = AGENTS[aid];
190
190
  const installedVersions = listInstalledVersions(aid);
191
191
  const defaultVer = getGlobalDefault(aid);
@@ -338,7 +338,7 @@ Examples:
338
338
  // Get agent and version selection
339
339
  let selectedAgents;
340
340
  let versionSelections;
341
- const hooksCapableAgents = Array.from(HOOKS_CAPABLE_AGENTS);
341
+ const hooksCapableAgents = Array.from(capableAgents('hooks'));
342
342
  if (options.agents) {
343
343
  const result = await resolveAgentTargetsAutoInstalling(options.agents, hooksCapableAgents, { yes: options.yes });
344
344
  if (!result) {
@@ -468,7 +468,7 @@ Examples:
468
468
  // agent@x.y.z, agent@all, literal all) works here too.
469
469
  let availableTargets = hookInfo.targets;
470
470
  if (options?.agents) {
471
- const requestedTargets = resolveInstalledAgentTargets(options.agents, [...HOOKS_CAPABLE_AGENTS]);
471
+ const requestedTargets = resolveInstalledAgentTargets(options.agents, [...capableAgents('hooks')]);
472
472
  const requested = new Set();
473
473
  for (const aid of requestedTargets.directAgents) {
474
474
  for (const ver of listInstalledVersions(aid)) {
@@ -23,12 +23,13 @@
23
23
  import chalk from 'chalk';
24
24
  import ora from 'ora';
25
25
  import * as fs from 'fs';
26
+ import * as os from 'os';
26
27
  import * as path from 'path';
27
28
  import { confirm } from '@inquirer/prompts';
28
29
  import { ALL_AGENT_IDS } from '../lib/agents.js';
29
30
  import { AGENTS, getCliPath, getCliVersion, agentLabel } from '../lib/agents.js';
30
31
  import { getVersionDir } from '../lib/versions.js';
31
- import { finalizeImport, importAgentBinary, importAgentConfig, isValidImportVersion, resolvePackageDirFromBinary, } from '../lib/import.js';
32
+ import { finalizeImport, importAgentBinary, importAgentConfig, importInstallScriptBinary, isValidImportVersion, resolvePackageDirFromBinary, } from '../lib/import.js';
32
33
  import { isPromptCancelled, isInteractiveTerminal } from './utils.js';
33
34
  function isValidAgentId(value) {
34
35
  return ALL_AGENT_IDS.includes(value);
@@ -41,54 +42,94 @@ async function runImport(agentArg, opts) {
41
42
  }
42
43
  const agentId = agentArg;
43
44
  const agent = AGENTS[agentId];
44
- // Reject agents that don't ship via npm before we spin up PATH lookups and
45
- // prompts. cursor/kiro/goose/roo all have npmPackage='' and use custom
46
- // install scripts the symlink-farm import doesn't apply to them.
47
- if (!agent.npmPackage) {
48
- console.error(chalk.red(`${agentLabel(agentId)} doesn't install via npm — \`agents import\` only handles npm-style packages.`));
49
- console.error(chalk.gray(`Use \`agents add ${agentId}\` to install via its native script.`));
50
- process.exit(1);
51
- }
45
+ // installScript-based agents (Grok, Antigravity, Cursor, Kiro, Goose, Roo)
46
+ // don't have an npm package; their binary lives wherever the curl/brew
47
+ // installer dropped it. We adopt by symlinking that PATH binary directly
48
+ // into the version's `node_modules/.bin/`. No package.json walk.
49
+ const isInstallScriptAgent = !agent.npmPackage;
52
50
  let globalPath = null;
51
+ let installScriptBinary = null;
53
52
  if (opts.fromPath) {
54
53
  globalPath = path.resolve(opts.fromPath);
55
54
  if (!fs.existsSync(globalPath)) {
56
55
  console.error(chalk.red(`Path does not exist: ${globalPath}`));
57
56
  process.exit(1);
58
57
  }
58
+ if (isInstallScriptAgent) {
59
+ // With --from-path on an installScript agent, the path is the binary
60
+ // itself (or a directory containing it). Accept either.
61
+ if (fs.statSync(globalPath).isDirectory()) {
62
+ const candidate = path.join(globalPath, agent.cliCommand);
63
+ if (!fs.existsSync(candidate)) {
64
+ console.error(chalk.red(`No "${agent.cliCommand}" in ${globalPath}`));
65
+ process.exit(1);
66
+ }
67
+ installScriptBinary = candidate;
68
+ }
69
+ else {
70
+ installScriptBinary = globalPath;
71
+ }
72
+ }
59
73
  }
60
74
  else {
61
75
  const binary = await getCliPath(agentId);
62
76
  if (!binary) {
63
- // Use || (not ??) so empty-string npmPackage falls back to cliCommand.
64
- // Defensive: agents with empty npmPackage are rejected above, but keep
65
- // the operator correct in case that early check is ever relaxed.
66
- const installName = agent.npmPackage || agent.cliCommand;
77
+ const installHint = isInstallScriptAgent
78
+ ? `Run \`agents add ${agentId}\` to install via the official script, or pass --from-path.`
79
+ : `Install it first (e.g. \`npm i -g ${agent.npmPackage || agent.cliCommand}\`) or pass --from-path.`;
67
80
  console.error(chalk.red(`No "${agent.cliCommand}" found on PATH.`));
68
- console.error(chalk.gray(`Install it first (e.g. \`npm i -g ${installName}\`) or pass --from-path.`));
81
+ console.error(chalk.gray(installHint));
69
82
  process.exit(1);
70
83
  }
71
- globalPath = resolvePackageDirFromBinary(binary);
72
- if (!globalPath) {
73
- console.error(chalk.red(`Could not resolve npm package for binary: ${binary}`));
74
- console.error(chalk.gray('Pass --from-path <dir> with the package directory explicitly.'));
75
- process.exit(1);
84
+ if (isInstallScriptAgent) {
85
+ installScriptBinary = binary;
86
+ }
87
+ else {
88
+ globalPath = resolvePackageDirFromBinary(binary);
89
+ if (!globalPath) {
90
+ console.error(chalk.red(`Could not resolve npm package for binary: ${binary}`));
91
+ console.error(chalk.gray('Pass --from-path <dir> with the package directory explicitly.'));
92
+ process.exit(1);
93
+ }
94
+ }
95
+ }
96
+ // For Grok, the binary on PATH is typically `~/.grok/bin/grok` (a moving
97
+ // pointer to the latest install). Prefer the exact versioned file in
98
+ // `~/.grok/downloads/` so the v<x.y.z> alias is pinned to that file and
99
+ // doesn't drift when the user upgrades externally.
100
+ if (isInstallScriptAgent && agentId === 'grok' && !opts.fromPath) {
101
+ const detected = await getCliVersion(agentId);
102
+ if (detected) {
103
+ const downloads = path.join(os.homedir(), '.grok', 'downloads');
104
+ try {
105
+ const entries = fs.readdirSync(downloads);
106
+ const exact = entries.find((e) => e.startsWith('grok-') && e.includes(detected));
107
+ if (exact) {
108
+ installScriptBinary = path.join(downloads, exact);
109
+ }
110
+ }
111
+ catch {
112
+ /* fall back to PATH binary already set above */
113
+ }
76
114
  }
77
115
  }
78
116
  let version = opts.version;
79
117
  if (!version) {
80
- try {
81
- const pkg = JSON.parse(fs.readFileSync(path.join(globalPath, 'package.json'), 'utf8'));
82
- version = typeof pkg.version === 'string' ? pkg.version : undefined;
83
- }
84
- catch {
85
- /* fall through */
118
+ if (!isInstallScriptAgent && globalPath) {
119
+ try {
120
+ const pkg = JSON.parse(fs.readFileSync(path.join(globalPath, 'package.json'), 'utf8'));
121
+ version = typeof pkg.version === 'string' ? pkg.version : undefined;
122
+ }
123
+ catch {
124
+ /* fall through */
125
+ }
86
126
  }
87
127
  // Only fall back to running the PATH binary's --version when we're
88
- // auto-detecting. With --from-path, the PATH binary may belong to a
89
- // different install entirely; reporting its version here would silently
90
- // mis-attribute the imported version.
91
- if (!version && !opts.fromPath) {
128
+ // auto-detecting. With --from-path on an npm agent, the PATH binary may
129
+ // belong to a different install entirely; reporting its version here
130
+ // would silently mis-attribute the imported version. installScript agents
131
+ // always use `<bin> --version` since they have no package.json to read.
132
+ if (!version && (isInstallScriptAgent || !opts.fromPath)) {
92
133
  const detected = await getCliVersion(agentId);
93
134
  version = detected ?? undefined;
94
135
  }
@@ -104,8 +145,9 @@ async function runImport(agentArg, opts) {
104
145
  process.exit(1);
105
146
  }
106
147
  const versionDir = getVersionDir(agentId, version);
148
+ const fromLabel = isInstallScriptAgent ? installScriptBinary : globalPath;
107
149
  console.log(chalk.bold(`\nImport ${agentLabel(agentId)} v${version}`));
108
- console.log(` from: ${chalk.gray(globalPath)}`);
150
+ console.log(` from: ${chalk.gray(fromLabel)}`);
109
151
  console.log(` into: ${chalk.gray(versionDir)}`);
110
152
  const configDirExists = fs.existsSync(agent.configDir);
111
153
  let configAlreadyManaged = false;
@@ -146,7 +188,8 @@ async function runImport(agentArg, opts) {
146
188
  const cfgSpinner = ora(`Importing config dir for ${agentLabel(agentId)} v${version}...`).start();
147
189
  const cfgResult = await importAgentConfig(agentId, version);
148
190
  if (cfgResult.success) {
149
- cfgSpinner.succeed(`Config imported (${agent.configDir} -> ${versionDir}/home/.${agentId})`);
191
+ const relConfig = path.relative(os.homedir(), agent.configDir);
192
+ cfgSpinner.succeed(`Config imported (${agent.configDir} -> ${versionDir}/home/${relConfig})`);
150
193
  }
151
194
  else if (cfgResult.skipped) {
152
195
  cfgSpinner.warn(`Config: ${cfgResult.error}`);
@@ -157,9 +200,11 @@ async function runImport(agentArg, opts) {
157
200
  }
158
201
  }
159
202
  const binSpinner = ora(`Registering ${agentLabel(agentId)} v${version} binary...`).start();
160
- const binResult = importAgentBinary({ agentId, npmPackage: agent.npmPackage, cliCommand: agent.cliCommand }, version, globalPath, versionDir);
203
+ const binResult = isInstallScriptAgent
204
+ ? importInstallScriptBinary({ agentId, npmPackage: agent.npmPackage, cliCommand: agent.cliCommand }, version, installScriptBinary, versionDir)
205
+ : importAgentBinary({ agentId, npmPackage: agent.npmPackage, cliCommand: agent.cliCommand }, version, globalPath, versionDir);
161
206
  if (binResult.success) {
162
- binSpinner.succeed(`Binary registered (${agent.cliCommand} -> ${globalPath})`);
207
+ binSpinner.succeed(`Binary registered (${agent.cliCommand} -> ${binResult.resolvedFromPath})`);
163
208
  }
164
209
  else if (binResult.skipped) {
165
210
  binSpinner.warn(`Binary: ${binResult.error}`);
@@ -198,11 +243,19 @@ Examples:
198
243
  $ agents import openclaw --version 2026.3.8 Pin a version label
199
244
  $ agents import openclaw --from-path /opt/homebrew/lib/node_modules/openclaw
200
245
 
246
+ # installScript-based agents (curl/brew installers, no npm package):
247
+ $ agents import grok Adopt ~/.grok/downloads/grok-<ver>
248
+ $ agents import antigravity Adopt ~/.local/bin/agy
249
+ $ agents import cursor Adopt ~/.local/bin/cursor-agent
250
+ $ agents import antigravity --from-path ~/.local/bin/agy
251
+
201
252
  When to use:
202
- When an agent CLI is already installed globally via npm or homebrew and you
203
- want to bring it under agents-cli management without reinstalling. Creates a
204
- symlink farm pointing at the existing install — nothing is copied or moved
205
- (except the agent's config dir, which is moved into the version's home).
253
+ When an agent CLI is already installed globally and you want to bring it
254
+ under agents-cli management without reinstalling. Creates a symlink farm
255
+ pointing at the existing install — nothing is copied or moved (except the
256
+ agent's config dir, which is moved into the version's home). Works for both
257
+ npm-style packages (claude, codex, gemini, opencode, openclaw) and
258
+ installScript-based agents (grok, antigravity, cursor, kiro, goose, roo).
206
259
  `)
207
260
  .action(runImport);
208
261
  }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * `agents inspect <agent>[@version]` — single-agent, single-version detail view.
3
+ *
4
+ * Summary mode shows the per-version header (paths, shim, capabilities, resource
5
+ * counts, sessions). Drill-down flags (`--skills`, `--hooks`, `--mcp`, ...) list
6
+ * one resource kind; passing a positional query to the same flag fuzzy-searches
7
+ * for a single resource and prints its detail. Resource names render as OSC-8
8
+ * hyperlinks to the marker file (SKILL.md / WORKFLOW.md / AGENT.md / the file
9
+ * itself) so users can click straight to the source.
10
+ */
11
+ import { Command } from 'commander';
12
+ interface InspectOptions {
13
+ brief?: boolean;
14
+ json?: boolean;
15
+ commands?: boolean | string;
16
+ skills?: boolean | string;
17
+ hooks?: boolean | string;
18
+ mcp?: boolean | string;
19
+ rules?: boolean | string;
20
+ plugins?: boolean | string;
21
+ workflows?: boolean | string;
22
+ subagents?: boolean | string;
23
+ }
24
+ export declare function registerInspectCommand(program: Command): void;
25
+ export declare function inspectAction(target: string, options: InspectOptions): Promise<void>;
26
+ export {};