@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/dist/index.js CHANGED
@@ -56,11 +56,12 @@ if (IS_DEV_BUILD) {
56
56
  }
57
57
  // Import command registrations
58
58
  import { registerPullCommand } from './commands/pull.js';
59
+ import { registerPushCommand } from './commands/push.js';
59
60
  import { registerRepoCommands } from './commands/repo.js';
60
61
  import { registerSetupCommand, runSetup } from './commands/setup.js';
61
- import { registerStatusCommand } from './commands/status.js';
62
62
  import { registerFeedbackCommand } from './commands/feedback.js';
63
63
  import { registerViewCommand } from './commands/view.js';
64
+ import { registerInspectCommand } from './commands/inspect.js';
64
65
  import { registerCommandsCommands } from './commands/commands.js';
65
66
  import { registerHooksCommands } from './commands/hooks.js';
66
67
  import { registerSkillsCommands } from './commands/skills.js';
@@ -86,6 +87,7 @@ import { registerSyncCommand } from './commands/sync.js';
86
87
  import { registerRefreshRulesCommand } from './commands/refresh-rules.js';
87
88
  import { registerDriveCommands } from './commands/drive.js';
88
89
  import { registerPtyCommands } from './commands/pty.js';
90
+ import { registerTmuxCommands } from './commands/tmux.js';
89
91
  import { registerBrowserCommand } from './commands/browser.js';
90
92
  import { registerComputerCommand } from './commands/computer.js';
91
93
  import { registerProfilesCommands } from './commands/profiles.js';
@@ -99,7 +101,7 @@ import { applyGlobalHelpConventions } from './lib/help.js';
99
101
  import { isInteractiveTerminal, isPromptCancelled } from './commands/utils.js';
100
102
  import { AGENTS } from './lib/agents.js';
101
103
  import { getGlobalDefault, listInstalledVersions } from './lib/versions.js';
102
- import { addShimsToPath, ensureShimCurrent, ensureVersionedAliasCurrent, getPathShadowingExecutable, getPathSetupInstructions, hasAliasShadowingShim, isShimsInPath, listAgentsWithInstalledVersions, removeLegacyUserShim, } from './lib/shims.js';
104
+ import { addShimsToPath, ensureShimCurrent, ensureVersionedAliasCurrent, getPathShadowingExecutable, getPathSetupInstructions, getShimsDir, isShimsInPath, listAgentsWithInstalledVersions, removeLegacyUserShim, } from './lib/shims.js';
103
105
  const program = new Command();
104
106
  program
105
107
  .name('agents')
@@ -131,6 +133,7 @@ Agent versions:
131
133
  prune cleanup [target] Remove orphan resources and older duplicate version installs
132
134
  trash Inspect and restore soft-deleted version directories
133
135
  view [agent[@version]] List versions, or inspect one in detail
136
+ inspect <agent>[@version] Deep details for one agent+version — paths, capabilities, resources, drill into any kind
134
137
 
135
138
  Agent configuration (synced across versions):
136
139
  rules Instructions given to agents (CLAUDE.md, etc.)
@@ -164,7 +167,7 @@ Diagnostics:
164
167
 
165
168
  Config sync:
166
169
  drive Sync session history across machines via rsync
167
- pull Clone or pull the system repo at ~/.agents-system/
170
+ pull Clone or pull the system repo at ~/.agents/.system/
168
171
  repo init --path <dir> Scaffold your own editable repo from a template
169
172
  repo add <path|gh:user/repo> Merge an extra repo after the system repo
170
173
 
@@ -182,7 +185,7 @@ Options:
182
185
  -V, --version Show version number
183
186
  -h, --help Show help
184
187
 
185
- System config lives in ~/.agents-system/. Run 'agents <command> --help' for details.
188
+ System config lives in ~/.agents/.system/. Run 'agents <command> --help' for details.
186
189
  `;
187
190
  }
188
191
  return originalHelpInformation();
@@ -409,10 +412,17 @@ async function checkForUpdates() {
409
412
  }
410
413
  }
411
414
  }
412
- async function maybeBootstrapShimIntegration(requestedCommand) {
415
+ async function maybeBootstrapShimIntegration(requestedCommand, helpOrVersionRequested) {
413
416
  if (!process.stdin.isTTY || !process.stdout.isTTY) {
414
417
  return;
415
418
  }
419
+ // Pure documentation paths must never trigger interactive repair — mirrors
420
+ // the helpOrVersionRequested gate around ensureInitialized below. Covers
421
+ // both bare `agents --version` (requestedCommand === undefined) and
422
+ // `agents <subcommand> --help` (requestedCommand === subcommand name).
423
+ if (helpOrVersionRequested) {
424
+ return;
425
+ }
416
426
  if (requestedCommand === 'sync' || requestedCommand === 'refresh-rules') {
417
427
  return;
418
428
  }
@@ -447,11 +457,13 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
447
457
  const shadowed = defaultAgents
448
458
  .map((agent) => ({ agent, shadowedBy: getPathShadowingExecutable(agent) }))
449
459
  .filter((item) => Boolean(item.shadowedBy));
450
- // Also check for shell aliases that shadow the shim
451
- const aliased = defaultAgents.filter((agent) => hasAliasShadowingShim(agent));
452
- // If shims are in PATH and nothing is binary-shadowing, we're done.
453
460
  // Shell aliases that call the same command with extra flags are intentional
454
- // customization and don't break shim integration.
461
+ // customization and don't break shim integration — `addShimsToPath` cannot
462
+ // touch them, so they don't belong in the repair prompt. We previously
463
+ // computed an `aliased` list here and inserted it into `affected`, which
464
+ // contradicted the comment below and surfaced false positives (e.g. an
465
+ // earlier `alias codex=...` cancelled by a later `unalias codex` was
466
+ // reported because the detector did a static rc-file regex).
455
467
  if (shadowed.length === 0 && isShimsInPath()) {
456
468
  return;
457
469
  }
@@ -468,14 +480,11 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
468
480
  for (const { agent, shadowedBy } of shadowed) {
469
481
  affected.push(`${AGENTS[agent].cliCommand} -> ${shadowedBy}`);
470
482
  }
471
- for (const agent of aliased) {
472
- if (!shadowed.some((s) => s.agent === agent)) {
473
- affected.push(`${AGENTS[agent].cliCommand} (alias)`);
474
- }
475
- }
476
483
  if (affected.length === 0) {
477
- // PATH issue - show all installed agents
478
- affected.push(...installedAgents.map((agent) => AGENTS[agent].cliCommand));
484
+ // Pure PATH-not-loaded case: rc may already have the shim block, but the
485
+ // running shell hasn't sourced it. Don't list agents here — they aren't
486
+ // broken; only the PATH is stale. The prompt + post-message handle it.
487
+ affected.push('PATH entry missing');
479
488
  }
480
489
  const shouldRepair = await confirm({
481
490
  message: `Repair shim integration now? ${affected.join(', ')}`,
@@ -494,15 +503,38 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
494
503
  if (!pathResult.success) {
495
504
  console.log(chalk.yellow('Could not repair shim PATH setup automatically.'));
496
505
  console.log(chalk.gray(pathResult.error || getPathSetupInstructions()));
506
+ // Write the sentinel even on failure — otherwise an unwritable rc file
507
+ // re-prompts every invocation in the same shell. The user opens a new
508
+ // terminal (new PPID) to retry.
509
+ try {
510
+ fs.writeFileSync(sentinelPath, '1');
511
+ }
512
+ catch { /* best-effort */ }
497
513
  return;
498
514
  }
515
+ // When the rc file already has the canonical shim block, `addShimsToPath`
516
+ // is a no-op — re-emitting produced byte-identical content. In this branch
517
+ // the user clicked "Yes" but nothing changed on disk, AND the underlying
518
+ // cause (a real binary shadow, or a stale shell PATH) is unaffected by
519
+ // this command. Be honest about it and point at the actual action.
499
520
  if (pathResult.alreadyPresent) {
500
- console.log(chalk.yellow('Shim PATH entry is already in your shell config, but this shell has not reloaded it yet.'));
521
+ if (shadowed.length > 0) {
522
+ const targets = shadowed
523
+ .map(({ agent, shadowedBy }) => ` ${AGENTS[agent].cliCommand}: ${shadowedBy}`)
524
+ .join('\n');
525
+ console.log(chalk.yellow('Repair could not change anything — the shim is shadowed by another binary on PATH:'));
526
+ console.log(chalk.gray(targets));
527
+ console.log(chalk.gray(`Fix it by removing or reordering that binary, or making sure ${getShimsDir()} appears earlier in PATH than its parent dir.`));
528
+ }
529
+ else {
530
+ console.log(chalk.yellow(`Shim PATH entry is already in ~/${pathResult.rcFile} — this shell just needs to reload it.`));
531
+ console.log(chalk.gray(`Run: source ~/${pathResult.rcFile} (or open a new terminal)`));
532
+ }
501
533
  }
502
534
  else {
503
535
  console.log(chalk.green(`Repaired shim PATH setup in ~/${pathResult.rcFile}`));
536
+ console.log(chalk.gray(getPathSetupInstructions()));
504
537
  }
505
- console.log(chalk.gray(getPathSetupInstructions()));
506
538
  try {
507
539
  fs.writeFileSync(sentinelPath, '1');
508
540
  }
@@ -510,7 +542,7 @@ async function maybeBootstrapShimIntegration(requestedCommand) {
510
542
  }
511
543
  // Register all commands
512
544
  registerViewCommand(program);
513
- registerStatusCommand(program);
545
+ registerInspectCommand(program);
514
546
  registerFeedbackCommand(program);
515
547
  registerCommandsCommands(program);
516
548
  registerHooksCommands(program);
@@ -577,6 +609,7 @@ registerFactoryCommands(program);
577
609
  registerUsageCommand(program);
578
610
  registerAliasCommand(program);
579
611
  registerPtyCommands(program);
612
+ registerTmuxCommands(program);
580
613
  registerBrowserCommand(program);
581
614
  registerComputerCommand(program);
582
615
  // Deprecated 'jobs' and 'cron' aliases for 'routines'
@@ -632,6 +665,7 @@ program
632
665
  }
633
666
  });
634
667
  registerPullCommand(program);
668
+ registerPushCommand(program);
635
669
  registerRepoCommands(program);
636
670
  registerSetupCommand(program);
637
671
  applyGlobalHelpConventions(program);
@@ -742,6 +776,20 @@ const SETUP_EXEMPT_COMMANDS = new Set(['setup', 'help']);
742
776
  // Help and version output are pure documentation — they must never gate on
743
777
  // setup, otherwise `agents <cmd> --help` becomes useless on a fresh box.
744
778
  const helpOrVersionRequested = passedArgs.some((arg) => arg === '--help' || arg === '-h' || arg === '--version' || arg === '-V');
779
+ // Fold legacy ~/.agents-system/ into ~/.agents/.system/ BEFORE ensureInitialized
780
+ // runs. ensureInitialized checks for .git inside the new path; if the user is
781
+ // upgrading from a layout where .git lives under the legacy path, the check
782
+ // would fail and exit before the migrator ever runs. Also runs outside the
783
+ // sentinel guard below because the sentinel was set by pre-fold releases and
784
+ // would otherwise skip this step on every existing install. Idempotent —
785
+ // no-ops when legacy is missing or already a symlink.
786
+ if (process.env.AGENTS_SKIP_MIGRATION !== '1') {
787
+ try {
788
+ const { foldLegacySystemRepo } = await import('./lib/migrate.js');
789
+ foldLegacySystemRepo();
790
+ }
791
+ catch { /* must never block CLI startup */ }
792
+ }
745
793
  if (!firstRun &&
746
794
  requestedCommand &&
747
795
  !SETUP_EXEMPT_COMMANDS.has(requestedCommand) &&
@@ -783,7 +831,7 @@ if (process.env.AGENTS_SKIP_MIGRATION !== '1') {
783
831
  catch { /* migration must never block CLI startup */ }
784
832
  }
785
833
  try {
786
- await maybeBootstrapShimIntegration(requestedCommand);
834
+ await maybeBootstrapShimIntegration(requestedCommand, helpOrVersionRequested);
787
835
  await program.parseAsync();
788
836
  }
789
837
  catch (err) {
@@ -23,16 +23,6 @@ export declare const GEMINI_HOOKS_MIN_VERSION = "0.26.0";
23
23
  export declare const AGENTS: Record<AgentId, AgentConfig>;
24
24
  /** All registered agent IDs derived from the AGENTS registry. */
25
25
  export declare const ALL_AGENT_IDS: AgentId[];
26
- /** Agents that support MCP (Model Context Protocol) server integration. */
27
- export declare const MCP_CAPABLE_AGENTS: AgentId[];
28
- /** Agents that support skills (SKILL.md + rules/ bundles). */
29
- export declare const SKILLS_CAPABLE_AGENTS: AgentId[];
30
- /** Agents that support file-based slash commands. */
31
- export declare const COMMANDS_CAPABLE_AGENTS: AgentId[];
32
- /** Agents that support event hooks (pre/post lifecycle callbacks). */
33
- export declare const HOOKS_CAPABLE_AGENTS: readonly AgentId[];
34
- /** Agents that support the plugin system. */
35
- export declare const PLUGINS_CAPABLE_AGENTS: AgentId[];
36
26
  /** Get the chalk color function for an agent. Works for any AgentId or SessionAgentId. */
37
27
  export declare function colorAgent(agentId: string): (s: string) => string;
38
28
  /** Return the agent's display name, colored. */
@@ -59,6 +49,13 @@ export interface UnmanagedInstall {
59
49
  configDir: string;
60
50
  version: string | null;
61
51
  }
52
+ /**
53
+ * Agents that `agents setup` probes for pre-existing native installations
54
+ * (i.e., a config dir present before agents-cli took over). Add an agent here
55
+ * once its `cliCommand` reports a usable `--version` and its session dir is
56
+ * wired into `getSessionDir`.
57
+ */
58
+ export declare const UNMANAGED_DETECTION_CANDIDATES: AgentId[];
62
59
  /**
63
60
  * Detect existing agent installations that are NOT yet managed by agents-cli.
64
61
  * Returns agents whose config dir exists as a real directory (not a symlink).
@@ -68,6 +65,18 @@ export declare function getUnmanagedAgentInstalls(): Promise<UnmanagedInstall[]>
68
65
  export declare function ensureCommandsDir(agentId: AgentId): void;
69
66
  /** Create the agent's skills directory if it does not exist. */
70
67
  export declare function ensureSkillsDir(agentId: AgentId): void;
68
+ /**
69
+ * The agent's config-dir name relative to $HOME — e.g. '.claude',
70
+ * '.gemini/antigravity-cli', '.config/amp', '.kimi-code'.
71
+ *
72
+ * This is the path segment to join onto a (version) home root when locating an
73
+ * agent's commands/skills/plugins. Do NOT hardcode `.${agentId}`: it is wrong
74
+ * for every agent whose config dir is nested or lives under ~/.config —
75
+ * antigravity (~/.gemini/antigravity-cli), amp (~/.config/amp),
76
+ * goose (~/.config/goose), kimi (~/.kimi-code). Mirrors the shim `configDirName`
77
+ * derivation in shims.ts.
78
+ */
79
+ export declare function agentConfigDirName(agentId: AgentId): string;
71
80
  /** Account identity and billing information extracted from an agent's auth config. */
72
81
  export interface AccountInfo {
73
82
  accountKey: string | null;
@@ -55,13 +55,25 @@ function saveCliVersionCache() {
55
55
  /* best-effort cache persist */
56
56
  }
57
57
  }
58
- /** Synchronous PATH search -- no subprocess. Returns first matching binary path. */
58
+ /**
59
+ * Synchronous PATH search -- no subprocess. Returns first matching binary path.
60
+ *
61
+ * Skips our own shims dir (`~/.agents/.cache/shims/`) — those shims are
62
+ * dispatch helpers, not real installs. Counting them as installed produced a
63
+ * false positive where agents with NO real binary on the host (e.g. a
64
+ * never-installed Cursor whose only PATH entry was our `cursor-agent` shim
65
+ * dispatcher) showed up under `agents view`'s "Not Managed by Agents CLI"
66
+ * section, even though the user had nothing to import.
67
+ */
59
68
  function findInPath(command) {
60
69
  const pathEnv = process.env.PATH || '';
61
70
  const pathExt = process.platform === 'win32' ? (process.env.PATHEXT || '').split(';') : [''];
71
+ const shimsDir = getShimsDir();
62
72
  for (const dir of pathEnv.split(path.delimiter)) {
63
73
  if (!dir)
64
74
  continue;
75
+ if (path.resolve(dir) === path.resolve(shimsDir))
76
+ continue;
65
77
  for (const ext of pathExt) {
66
78
  const full = path.join(dir, command + ext);
67
79
  try {
@@ -191,7 +203,7 @@ export const AGENTS = {
191
203
  format: 'markdown',
192
204
  variableSyntax: '$ARGUMENTS',
193
205
  supportsHooks: true,
194
- capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true },
206
+ capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, subagents: true, rules: { file: 'CLAUDE.md' }, workflows: true, modes: ['plan', 'edit', 'auto', 'skip'], rulesImports: true },
195
207
  },
196
208
  // codex hooks: gated to >= 0.116.0 (introduced [features] codex_hooks flag).
197
209
  codex: {
@@ -210,7 +222,7 @@ export const AGENTS = {
210
222
  format: 'markdown',
211
223
  variableSyntax: '$ARGUMENTS',
212
224
  supportsHooks: true,
213
- capabilities: { hooks: { since: '0.116.0' }, mcp: true, allowlist: false, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, modes: ['plan', 'edit', 'skip'] },
225
+ capabilities: { hooks: { since: '0.116.0' }, mcp: true, allowlist: false, skills: true, commands: { until: '0.117.0' }, plugins: { since: '0.128.0' }, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'skip'] },
214
226
  },
215
227
  gemini: {
216
228
  id: 'gemini',
@@ -229,7 +241,7 @@ export const AGENTS = {
229
241
  supportsHooks: true,
230
242
  nativeAgentsSkillsDir: true,
231
243
  // gemini hooks: shipped in v0.26.0 (Jan 2026); older binaries silently ignore the `hooks` key.
232
- capabilities: { hooks: { since: '0.26.0' }, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit', 'skip'], rulesImports: true },
244
+ capabilities: { hooks: { since: '0.26.0' }, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'GEMINI.md' }, workflows: false, modes: ['plan', 'edit', 'skip'], rulesImports: true },
233
245
  },
234
246
  cursor: {
235
247
  id: 'cursor',
@@ -247,7 +259,7 @@ export const AGENTS = {
247
259
  format: 'markdown',
248
260
  variableSyntax: '$ARGUMENTS',
249
261
  supportsHooks: false,
250
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['edit', 'skip'] },
262
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: '.cursorrules' }, workflows: false, modes: ['edit', 'skip'] },
251
263
  },
252
264
  opencode: {
253
265
  id: 'opencode',
@@ -264,7 +276,7 @@ export const AGENTS = {
264
276
  format: 'markdown',
265
277
  variableSyntax: '$ARGUMENTS',
266
278
  supportsHooks: false,
267
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
279
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
268
280
  },
269
281
  openclaw: {
270
282
  id: 'openclaw',
@@ -281,7 +293,7 @@ export const AGENTS = {
281
293
  format: 'markdown',
282
294
  variableSyntax: '{{ARGUMENTS}}',
283
295
  supportsHooks: true,
284
- capabilities: { hooks: true, mcp: true, allowlist: false, skills: true, commands: false, plugins: true, modes: ['plan', 'edit', 'skip'] },
296
+ capabilities: { hooks: true, mcp: true, allowlist: false, skills: true, commands: false, plugins: true, subagents: true, rules: { file: 'workspace/AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'skip'] },
285
297
  },
286
298
  copilot: {
287
299
  id: 'copilot',
@@ -298,7 +310,7 @@ export const AGENTS = {
298
310
  format: 'markdown',
299
311
  variableSyntax: '$ARGUMENTS',
300
312
  supportsHooks: false,
301
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit', 'auto', 'skip'] },
313
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit', 'auto', 'skip'] },
302
314
  },
303
315
  amp: {
304
316
  id: 'amp',
@@ -315,7 +327,7 @@ export const AGENTS = {
315
327
  format: 'markdown',
316
328
  variableSyntax: '$ARGUMENTS',
317
329
  supportsHooks: false,
318
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
330
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
319
331
  },
320
332
  kiro: {
321
333
  id: 'kiro',
@@ -333,7 +345,7 @@ export const AGENTS = {
333
345
  format: 'markdown',
334
346
  variableSyntax: '$ARGUMENTS',
335
347
  supportsHooks: false,
336
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['edit'] },
348
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit'] },
337
349
  },
338
350
  goose: {
339
351
  id: 'goose',
@@ -351,7 +363,7 @@ export const AGENTS = {
351
363
  format: 'markdown',
352
364
  variableSyntax: '$ARGUMENTS',
353
365
  supportsHooks: false,
354
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: false, commands: false, plugins: false, modes: ['edit'] },
366
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: false, commands: false, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit'] },
355
367
  },
356
368
  roo: {
357
369
  id: 'roo',
@@ -369,7 +381,7 @@ export const AGENTS = {
369
381
  format: 'markdown',
370
382
  variableSyntax: '$ARGUMENTS',
371
383
  supportsHooks: false,
372
- capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, modes: ['plan', 'edit'] },
384
+ capabilities: { hooks: false, mcp: true, allowlist: false, skills: true, commands: true, plugins: false, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['plan', 'edit'] },
373
385
  },
374
386
  // Google Antigravity CLI (`agy`) — official replacement for Gemini CLI as of IO 2026.
375
387
  // configDir nests inside `~/.gemini/` since agy shares the parent dir with the Gemini
@@ -396,7 +408,7 @@ export const AGENTS = {
396
408
  format: 'markdown',
397
409
  variableSyntax: '{{args}}',
398
410
  supportsHooks: true,
399
- capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, modes: ['edit', 'skip'], rulesImports: false },
411
+ capabilities: { hooks: true, mcp: true, allowlist: true, skills: true, commands: true, plugins: true, subagents: false, rules: { file: 'AGENTS.md' }, workflows: false, modes: ['edit', 'skip'], rulesImports: false },
400
412
  },
401
413
  // xAI Grok Build CLI (`grok`) — early beta, SuperGrok Heavy. Auth via OAuth on
402
414
  // first launch, or XAI_API_KEY env var for headless. MCP servers configured inline
@@ -427,23 +439,51 @@ export const AGENTS = {
427
439
  skills: true,
428
440
  commands: false, // covered by skills
429
441
  plugins: true,
442
+ subagents: false,
443
+ rules: { file: 'AGENTS.md' },
444
+ workflows: false,
430
445
  modes: ['plan', 'edit', 'skip'],
431
446
  rulesImports: true,
432
447
  },
433
448
  },
449
+ kimi: {
450
+ id: 'kimi',
451
+ name: 'Kimi',
452
+ color: 'magentaBright',
453
+ cliCommand: 'kimi-code',
454
+ npmPackage: '',
455
+ installScript: '',
456
+ configDir: path.join(HOME, '.kimi-code'),
457
+ commandsDir: '',
458
+ commandsSubdir: '',
459
+ skillsDir: path.join(HOME, '.kimi-code', 'skills'),
460
+ hooksDir: path.join(HOME, '.kimi-code', 'hooks'),
461
+ instructionsFile: 'AGENTS.md',
462
+ format: 'markdown',
463
+ variableSyntax: '$ARGUMENTS',
464
+ supportsHooks: true,
465
+ capabilities: {
466
+ hooks: true,
467
+ mcp: true,
468
+ allowlist: false,
469
+ skills: false,
470
+ commands: false,
471
+ plugins: false,
472
+ subagents: false,
473
+ rules: { file: 'AGENTS.md' },
474
+ workflows: false,
475
+ modes: ['plan', 'edit', 'skip'],
476
+ rulesImports: false,
477
+ },
478
+ },
434
479
  };
435
480
  /** All registered agent IDs derived from the AGENTS registry. */
436
481
  export const ALL_AGENT_IDS = Object.keys(AGENTS);
437
- /** Agents that support MCP (Model Context Protocol) server integration. */
438
- export const MCP_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.mcp);
439
- /** Agents that support skills (SKILL.md + rules/ bundles). */
440
- export const SKILLS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.skills);
441
- /** Agents that support file-based slash commands. */
442
- export const COMMANDS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.commands);
443
- /** Agents that support event hooks (pre/post lifecycle callbacks). */
444
- export const HOOKS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.hooks !== false);
445
- /** Agents that support the plugin system. */
446
- export const PLUGINS_CAPABLE_AGENTS = ALL_AGENT_IDS.filter((id) => AGENTS[id].capabilities.plugins !== false);
482
+ // Capability-filtered agent lists used to live here as `*_CAPABLE_AGENTS`
483
+ // constants. They were a frequent source of silent-skip bugs (e.g. grok
484
+ // rules sync gated on `COMMANDS_CAPABLE_AGENTS`). Use `capableAgents(cap)`
485
+ // from `./capabilities.js` instead it consults the AgentConfig matrix
486
+ // directly, so a single source of truth drives every gate.
447
487
  /** Get the chalk color function for an agent. Works for any AgentId or SessionAgentId. */
448
488
  export function colorAgent(agentId) {
449
489
  const agent = AGENTS[agentId];
@@ -507,8 +547,16 @@ async function getCachedVersionForBinary(agentId, binaryPath) {
507
547
  /* version command failed */
508
548
  version = null;
509
549
  }
510
- cache[agentId] = { binaryPath, mtime, version };
511
- saveCliVersionCache();
550
+ // Skip persisting null results the most common cause is a transient
551
+ // `--version` failure (slow startup, stdout race, etc.). A sticky-null
552
+ // entry kept users in a broken state where every subsequent
553
+ // `getCachedVersionForBinary` short-circuited to null forever, even
554
+ // after the binary started working. Re-probing on the next call costs
555
+ // one execFile; persisting null costs the whole feature.
556
+ if (version !== null) {
557
+ cache[agentId] = { binaryPath, mtime, version };
558
+ saveCliVersionCache();
559
+ }
512
560
  return version;
513
561
  }
514
562
  /**
@@ -590,14 +638,26 @@ export function isConfigured(agentId) {
590
638
  const agent = AGENTS[agentId];
591
639
  return fs.existsSync(agent.configDir);
592
640
  }
641
+ /**
642
+ * Agents that `agents setup` probes for pre-existing native installations
643
+ * (i.e., a config dir present before agents-cli took over). Add an agent here
644
+ * once its `cliCommand` reports a usable `--version` and its session dir is
645
+ * wired into `getSessionDir`.
646
+ */
647
+ export const UNMANAGED_DETECTION_CANDIDATES = [
648
+ 'claude',
649
+ 'codex',
650
+ 'gemini',
651
+ 'grok',
652
+ 'copilot',
653
+ ];
593
654
  /**
594
655
  * Detect existing agent installations that are NOT yet managed by agents-cli.
595
656
  * Returns agents whose config dir exists as a real directory (not a symlink).
596
657
  */
597
658
  export async function getUnmanagedAgentInstalls() {
598
659
  const unmanaged = [];
599
- const candidates = ['claude', 'codex', 'gemini', 'grok'];
600
- for (const agentId of candidates) {
660
+ for (const agentId of UNMANAGED_DETECTION_CANDIDATES) {
601
661
  const agent = AGENTS[agentId];
602
662
  try {
603
663
  const stat = fs.lstatSync(agent.configDir);
@@ -626,6 +686,20 @@ export function ensureSkillsDir(agentId) {
626
686
  fs.mkdirSync(agent.skillsDir, { recursive: true });
627
687
  }
628
688
  }
689
+ /**
690
+ * The agent's config-dir name relative to $HOME — e.g. '.claude',
691
+ * '.gemini/antigravity-cli', '.config/amp', '.kimi-code'.
692
+ *
693
+ * This is the path segment to join onto a (version) home root when locating an
694
+ * agent's commands/skills/plugins. Do NOT hardcode `.${agentId}`: it is wrong
695
+ * for every agent whose config dir is nested or lives under ~/.config —
696
+ * antigravity (~/.gemini/antigravity-cli), amp (~/.config/amp),
697
+ * goose (~/.config/goose), kimi (~/.kimi-code). Mirrors the shim `configDirName`
698
+ * derivation in shims.ts.
699
+ */
700
+ export function agentConfigDirName(agentId) {
701
+ return path.relative(os.homedir(), AGENTS[agentId].configDir);
702
+ }
629
703
  /** Return the email address associated with the agent's auth config, or null. */
630
704
  export async function getAccountEmail(agentId, home) {
631
705
  const info = await getAccountInfo(agentId, home);
@@ -1260,7 +1334,7 @@ export function getMcpConfigPathForHome(agentId, home) {
1260
1334
  case 'grok':
1261
1335
  return path.join(home, '.grok', 'config.toml');
1262
1336
  default:
1263
- return path.join(home, `.${agentId}`, 'settings.json');
1337
+ return path.join(home, agentConfigDirName(agentId), 'settings.json');
1264
1338
  }
1265
1339
  }
1266
1340
  /**
@@ -5,7 +5,7 @@
5
5
  * For the user repo + enabled extras: `git fetch` + write a status marker the foreground
6
6
  * CLI surfaces on its next invocation.
7
7
  *
8
- * Per-repo lock files at ~/.agents-system/.fetch/<alias>.lock prevent concurrent fetches.
8
+ * Per-repo lock files at ~/.agents/.system/.fetch/<alias>.lock prevent concurrent fetches.
9
9
  * Lock mtime under 5 min => skip (another invocation already in flight).
10
10
  */
11
11
  export {};
@@ -5,7 +5,7 @@
5
5
  * For the user repo + enabled extras: `git fetch` + write a status marker the foreground
6
6
  * CLI surfaces on its next invocation.
7
7
  *
8
- * Per-repo lock files at ~/.agents-system/.fetch/<alias>.lock prevent concurrent fetches.
8
+ * Per-repo lock files at ~/.agents/.system/.fetch/<alias>.lock prevent concurrent fetches.
9
9
  * Lock mtime under 5 min => skip (another invocation already in flight).
10
10
  */
11
11
  import * as fs from 'fs';
@@ -15,7 +15,7 @@ import { getSystemAgentsDir, getUserAgentsDir, getEnabledExtraRepos, getFetchCac
15
15
  import { lockFilePath, statusFilePath } from './auto-pull.js';
16
16
  const LOCK_TTL_MS = 5 * 60 * 1000;
17
17
  /**
18
- * Background auto-pull of ~/.agents-system/ is off by default. When enabled it
18
+ * Background auto-pull of ~/.agents/.system/ is off by default. When enabled it
19
19
  * silently fast-forwards a tracked source tree that the CLI then reads as a
20
20
  * source of skills, hooks, install manifests, and commands — anyone with push
21
21
  * access to that upstream gets remote code execution on every user the next
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Background sync for tracked git repos:
3
- * - System repo (~/.agents-system/) is read-only locally — fast-forward auto-pull is safe.
3
+ * - System repo (~/.agents/.system/) is read-only locally — fast-forward auto-pull is safe.
4
4
  * - User repo (~/.agents/) and enabled extras may have local commits, so we only
5
5
  * `git fetch` and write a status marker. Next CLI invocation surfaces a one-line
6
6
  * notice if upstream is ahead. Pulling is left to the user via `agents repo pull`.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Background sync for tracked git repos:
3
- * - System repo (~/.agents-system/) is read-only locally — fast-forward auto-pull is safe.
3
+ * - System repo (~/.agents/.system/) is read-only locally — fast-forward auto-pull is safe.
4
4
  * - User repo (~/.agents/) and enabled extras may have local commits, so we only
5
5
  * `git fetch` and write a status marker. Next CLI invocation surfaces a one-line
6
6
  * notice if upstream is ahead. Pulling is left to the user via `agents repo pull`.
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Preview features live in the git-trackable user repo (~/.agents/agents.yaml)
5
5
  * when present, and otherwise fall back to the local system state file
6
- * (~/.agents-system/agents.yaml). This keeps opt-ins portable for users with a
6
+ * (~/.agents/.system/agents.yaml). This keeps opt-ins portable for users with a
7
7
  * personal agents repo without mixing them into unrelated version capability
8
8
  * checks.
9
9
  */
package/dist/lib/beta.js CHANGED
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * Preview features live in the git-trackable user repo (~/.agents/agents.yaml)
5
5
  * when present, and otherwise fall back to the local system state file
6
- * (~/.agents-system/agents.yaml). This keeps opt-ins portable for users with a
6
+ * (~/.agents/.system/agents.yaml). This keeps opt-ins portable for users with a
7
7
  * personal agents repo without mixing them into unrelated version capability
8
8
  * checks.
9
9
  */
@@ -46,6 +46,8 @@ export function supports(agent, cap, version) {
46
46
  return { ok: false, reason: 'unsupported' };
47
47
  if (c === true)
48
48
  return { ok: true };
49
+ if ('file' in c)
50
+ return { ok: true };
49
51
  if (!version)
50
52
  return { ok: true };
51
53
  if (c.since && compareVersions(version, c.since) < 0) {