@phnx-labs/agents-cli 1.20.4 → 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 (190) hide show
  1. package/CHANGELOG.md +19 -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/inspect.d.ts +26 -0
  10. package/dist/commands/inspect.js +590 -0
  11. package/dist/commands/mcp.js +17 -16
  12. package/dist/commands/models.js +1 -1
  13. package/dist/commands/packages.js +6 -4
  14. package/dist/commands/permissions.js +13 -12
  15. package/dist/commands/plugins.d.ts +13 -0
  16. package/dist/commands/plugins.js +100 -11
  17. package/dist/commands/prune.js +3 -2
  18. package/dist/commands/pull.d.ts +12 -5
  19. package/dist/commands/pull.js +26 -422
  20. package/dist/commands/push.d.ts +14 -0
  21. package/dist/commands/push.js +30 -0
  22. package/dist/commands/repo.d.ts +1 -1
  23. package/dist/commands/repo.js +155 -112
  24. package/dist/commands/resource-view.d.ts +2 -0
  25. package/dist/commands/resource-view.js +12 -3
  26. package/dist/commands/routines.js +32 -7
  27. package/dist/commands/rules.js +1 -1
  28. package/dist/commands/sessions.js +1 -0
  29. package/dist/commands/setup.d.ts +3 -3
  30. package/dist/commands/setup.js +15 -15
  31. package/dist/commands/skills.js +6 -5
  32. package/dist/commands/subagents.js +5 -4
  33. package/dist/commands/sync.d.ts +18 -5
  34. package/dist/commands/sync.js +251 -65
  35. package/dist/commands/teams.js +1 -0
  36. package/dist/commands/tmux.d.ts +25 -0
  37. package/dist/commands/tmux.js +415 -0
  38. package/dist/commands/trash.d.ts +2 -2
  39. package/dist/commands/trash.js +1 -1
  40. package/dist/commands/versions.js +2 -2
  41. package/dist/commands/view.js +9 -4
  42. package/dist/commands/workflows.js +4 -3
  43. package/dist/commands/worktree.d.ts +4 -5
  44. package/dist/commands/worktree.js +4 -4
  45. package/dist/index.js +68 -20
  46. package/dist/lib/agents.d.ts +19 -10
  47. package/dist/lib/agents.js +79 -25
  48. package/dist/lib/auto-pull-worker.d.ts +1 -1
  49. package/dist/lib/auto-pull-worker.js +2 -2
  50. package/dist/lib/auto-pull.d.ts +1 -1
  51. package/dist/lib/auto-pull.js +1 -1
  52. package/dist/lib/beta.d.ts +1 -1
  53. package/dist/lib/beta.js +1 -1
  54. package/dist/lib/capabilities.js +2 -0
  55. package/dist/lib/commands.d.ts +28 -1
  56. package/dist/lib/commands.js +125 -20
  57. package/dist/lib/doctor-diff.js +2 -2
  58. package/dist/lib/exec.d.ts +14 -0
  59. package/dist/lib/exec.js +39 -5
  60. package/dist/lib/fuzzy.d.ts +12 -2
  61. package/dist/lib/fuzzy.js +29 -4
  62. package/dist/lib/git.js +8 -1
  63. package/dist/lib/hooks.d.ts +2 -2
  64. package/dist/lib/hooks.js +97 -10
  65. package/dist/lib/mcp.js +32 -2
  66. package/dist/lib/migrate.d.ts +51 -0
  67. package/dist/lib/migrate.js +227 -1
  68. package/dist/lib/models.js +62 -15
  69. package/dist/lib/permissions.d.ts +36 -2
  70. package/dist/lib/permissions.js +217 -7
  71. package/dist/lib/plugin-marketplace.d.ts +98 -40
  72. package/dist/lib/plugin-marketplace.js +196 -93
  73. package/dist/lib/plugins.d.ts +21 -4
  74. package/dist/lib/plugins.js +130 -49
  75. package/dist/lib/profiles-presets.js +12 -12
  76. package/dist/lib/project-launch.d.ts +65 -0
  77. package/dist/lib/project-launch.js +367 -0
  78. package/dist/lib/pty-client.js +1 -1
  79. package/dist/lib/pty-server.d.ts +1 -1
  80. package/dist/lib/pty-server.js +1 -1
  81. package/dist/lib/refresh.d.ts +26 -0
  82. package/dist/lib/refresh.js +315 -0
  83. package/dist/lib/resource-patterns.d.ts +1 -1
  84. package/dist/lib/resource-patterns.js +1 -1
  85. package/dist/lib/resources/commands.js +2 -2
  86. package/dist/lib/resources/hooks.d.ts +1 -1
  87. package/dist/lib/resources/hooks.js +1 -1
  88. package/dist/lib/resources/mcp.d.ts +1 -1
  89. package/dist/lib/resources/mcp.js +5 -6
  90. package/dist/lib/resources/permissions.js +5 -2
  91. package/dist/lib/resources/rules.js +3 -2
  92. package/dist/lib/resources/skills.js +3 -2
  93. package/dist/lib/resources/types.d.ts +1 -1
  94. package/dist/lib/resources.js +2 -2
  95. package/dist/lib/rotate.d.ts +1 -1
  96. package/dist/lib/rotate.js +1 -1
  97. package/dist/lib/routines.d.ts +16 -4
  98. package/dist/lib/routines.js +67 -17
  99. package/dist/lib/rules/compile.js +22 -10
  100. package/dist/lib/rules/rules.js +3 -3
  101. package/dist/lib/runner.js +16 -3
  102. package/dist/lib/scheduler.js +15 -1
  103. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  104. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  105. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
  106. package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
  107. package/dist/lib/secrets/linux.d.ts +44 -9
  108. package/dist/lib/secrets/linux.js +302 -48
  109. package/dist/lib/session/db.js +15 -2
  110. package/dist/lib/session/discover.js +118 -3
  111. package/dist/lib/session/parse.js +3 -0
  112. package/dist/lib/session/types.d.ts +1 -1
  113. package/dist/lib/session/types.js +1 -1
  114. package/dist/lib/shims.d.ts +10 -9
  115. package/dist/lib/shims.js +101 -50
  116. package/dist/lib/skills.d.ts +1 -1
  117. package/dist/lib/skills.js +10 -9
  118. package/dist/lib/staleness/detectors/commands.d.ts +3 -0
  119. package/dist/lib/staleness/detectors/commands.js +46 -0
  120. package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
  121. package/dist/lib/staleness/detectors/hooks.js +44 -0
  122. package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
  123. package/dist/lib/staleness/detectors/mcp.js +31 -0
  124. package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
  125. package/dist/lib/staleness/detectors/permissions.js +201 -0
  126. package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
  127. package/dist/lib/staleness/detectors/plugins.js +23 -0
  128. package/dist/lib/staleness/detectors/rules.d.ts +3 -0
  129. package/dist/lib/staleness/detectors/rules.js +34 -0
  130. package/dist/lib/staleness/detectors/skills.d.ts +3 -0
  131. package/dist/lib/staleness/detectors/skills.js +71 -0
  132. package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
  133. package/dist/lib/staleness/detectors/subagents.js +50 -0
  134. package/dist/lib/staleness/detectors/types.d.ts +22 -0
  135. package/dist/lib/staleness/detectors/types.js +1 -0
  136. package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
  137. package/dist/lib/staleness/detectors/workflows.js +28 -0
  138. package/dist/lib/staleness/registry.d.ts +26 -0
  139. package/dist/lib/staleness/registry.js +123 -0
  140. package/dist/lib/staleness/writers/commands.d.ts +3 -0
  141. package/dist/lib/staleness/writers/commands.js +111 -0
  142. package/dist/lib/staleness/writers/hooks.d.ts +3 -0
  143. package/dist/lib/staleness/writers/hooks.js +47 -0
  144. package/dist/lib/staleness/writers/kinds.d.ts +10 -0
  145. package/dist/lib/staleness/writers/kinds.js +15 -0
  146. package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
  147. package/dist/lib/staleness/writers/lazy-map.js +19 -0
  148. package/dist/lib/staleness/writers/mcp.d.ts +10 -0
  149. package/dist/lib/staleness/writers/mcp.js +19 -0
  150. package/dist/lib/staleness/writers/permissions.d.ts +13 -0
  151. package/dist/lib/staleness/writers/permissions.js +26 -0
  152. package/dist/lib/staleness/writers/plugins.d.ts +7 -0
  153. package/dist/lib/staleness/writers/plugins.js +31 -0
  154. package/dist/lib/staleness/writers/rules.d.ts +7 -0
  155. package/dist/lib/staleness/writers/rules.js +55 -0
  156. package/dist/lib/staleness/writers/skills.d.ts +3 -0
  157. package/dist/lib/staleness/writers/skills.js +81 -0
  158. package/dist/lib/staleness/writers/sources.d.ts +16 -0
  159. package/dist/lib/staleness/writers/sources.js +72 -0
  160. package/dist/lib/staleness/writers/subagents.d.ts +3 -0
  161. package/dist/lib/staleness/writers/subagents.js +53 -0
  162. package/dist/lib/staleness/writers/types.d.ts +36 -0
  163. package/dist/lib/staleness/writers/types.js +1 -0
  164. package/dist/lib/staleness/writers/workflows.d.ts +7 -0
  165. package/dist/lib/staleness/writers/workflows.js +31 -0
  166. package/dist/lib/state.d.ts +34 -11
  167. package/dist/lib/state.js +58 -13
  168. package/dist/lib/subagents.d.ts +0 -2
  169. package/dist/lib/subagents.js +6 -6
  170. package/dist/lib/teams/agents.js +1 -1
  171. package/dist/lib/teams/parsers.d.ts +1 -1
  172. package/dist/lib/tmux/binary.d.ts +67 -0
  173. package/dist/lib/tmux/binary.js +141 -0
  174. package/dist/lib/tmux/index.d.ts +8 -0
  175. package/dist/lib/tmux/index.js +8 -0
  176. package/dist/lib/tmux/paths.d.ts +17 -0
  177. package/dist/lib/tmux/paths.js +30 -0
  178. package/dist/lib/tmux/session.d.ts +122 -0
  179. package/dist/lib/tmux/session.js +305 -0
  180. package/dist/lib/types.d.ts +58 -7
  181. package/dist/lib/types.js +1 -1
  182. package/dist/lib/usage.js +1 -1
  183. package/dist/lib/versions.d.ts +4 -4
  184. package/dist/lib/versions.js +135 -493
  185. package/dist/lib/workflows.d.ts +2 -4
  186. package/dist/lib/workflows.js +3 -4
  187. package/package.json +2 -2
  188. package/scripts/postinstall.js +16 -63
  189. package/dist/commands/status.d.ts +0 -9
  190. package/dist/commands/status.js +0 -25
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
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
+
3
22
  ## 1.20.4
4
23
 
5
24
  **Plugin marketplace sync (skip outside-pointing symlinks)**
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)) {
@@ -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 {};