@phnx-labs/agents-cli 1.20.4 → 1.20.6

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 (207) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/README.md +49 -18
  3. package/dist/commands/browser.js +31 -4
  4. package/dist/commands/cli.js +1 -1
  5. package/dist/commands/cloud.js +1 -1
  6. package/dist/commands/commands.js +2 -0
  7. package/dist/commands/computer.js +10 -2
  8. package/dist/commands/defaults.d.ts +7 -0
  9. package/dist/commands/defaults.js +89 -0
  10. package/dist/commands/doctor.js +1 -1
  11. package/dist/commands/exec.js +73 -19
  12. package/dist/commands/hooks.js +6 -6
  13. package/dist/commands/inspect.d.ts +26 -0
  14. package/dist/commands/inspect.js +590 -0
  15. package/dist/commands/mcp.js +17 -16
  16. package/dist/commands/models.js +1 -1
  17. package/dist/commands/packages.js +6 -4
  18. package/dist/commands/permissions.js +13 -12
  19. package/dist/commands/plugins.d.ts +13 -0
  20. package/dist/commands/plugins.js +100 -11
  21. package/dist/commands/prune.js +3 -2
  22. package/dist/commands/pull.d.ts +12 -5
  23. package/dist/commands/pull.js +26 -422
  24. package/dist/commands/push.d.ts +14 -0
  25. package/dist/commands/push.js +30 -0
  26. package/dist/commands/repo.d.ts +1 -1
  27. package/dist/commands/repo.js +155 -112
  28. package/dist/commands/resource-view.d.ts +2 -0
  29. package/dist/commands/resource-view.js +12 -3
  30. package/dist/commands/routines.js +32 -7
  31. package/dist/commands/rules.js +4 -4
  32. package/dist/commands/secrets.js +46 -9
  33. package/dist/commands/sessions.js +1 -0
  34. package/dist/commands/setup.d.ts +3 -3
  35. package/dist/commands/setup.js +17 -17
  36. package/dist/commands/skills.js +6 -5
  37. package/dist/commands/subagents.js +5 -4
  38. package/dist/commands/sync.d.ts +18 -5
  39. package/dist/commands/sync.js +251 -65
  40. package/dist/commands/teams.js +109 -11
  41. package/dist/commands/tmux.d.ts +25 -0
  42. package/dist/commands/tmux.js +415 -0
  43. package/dist/commands/trash.d.ts +2 -2
  44. package/dist/commands/trash.js +1 -1
  45. package/dist/commands/versions.js +2 -2
  46. package/dist/commands/view.d.ts +12 -1
  47. package/dist/commands/view.js +128 -40
  48. package/dist/commands/workflows.js +4 -3
  49. package/dist/commands/worktree.d.ts +4 -5
  50. package/dist/commands/worktree.js +4 -4
  51. package/dist/index.js +106 -41
  52. package/dist/lib/agents.d.ts +23 -10
  53. package/dist/lib/agents.js +88 -25
  54. package/dist/lib/auto-pull-worker.d.ts +1 -1
  55. package/dist/lib/auto-pull-worker.js +2 -2
  56. package/dist/lib/auto-pull.d.ts +1 -1
  57. package/dist/lib/auto-pull.js +1 -1
  58. package/dist/lib/beta.d.ts +1 -1
  59. package/dist/lib/beta.js +1 -1
  60. package/dist/lib/browser/chrome.d.ts +10 -0
  61. package/dist/lib/browser/chrome.js +84 -3
  62. package/dist/lib/capabilities.js +2 -0
  63. package/dist/lib/commands.d.ts +28 -1
  64. package/dist/lib/commands.js +125 -20
  65. package/dist/lib/doctor-diff.js +2 -2
  66. package/dist/lib/exec.d.ts +14 -0
  67. package/dist/lib/exec.js +59 -5
  68. package/dist/lib/fuzzy.d.ts +12 -2
  69. package/dist/lib/fuzzy.js +29 -4
  70. package/dist/lib/git.js +8 -1
  71. package/dist/lib/hooks.d.ts +2 -2
  72. package/dist/lib/hooks.js +97 -10
  73. package/dist/lib/mcp.js +32 -2
  74. package/dist/lib/migrate.d.ts +51 -0
  75. package/dist/lib/migrate.js +233 -5
  76. package/dist/lib/models.js +62 -15
  77. package/dist/lib/permissions.d.ts +59 -2
  78. package/dist/lib/permissions.js +299 -7
  79. package/dist/lib/plugin-marketplace.d.ts +98 -40
  80. package/dist/lib/plugin-marketplace.js +196 -93
  81. package/dist/lib/plugins.d.ts +21 -4
  82. package/dist/lib/plugins.js +130 -49
  83. package/dist/lib/profiles-presets.js +12 -12
  84. package/dist/lib/project-launch.d.ts +70 -0
  85. package/dist/lib/project-launch.js +404 -0
  86. package/dist/lib/pty-client.js +1 -1
  87. package/dist/lib/pty-server.d.ts +1 -1
  88. package/dist/lib/pty-server.js +8 -5
  89. package/dist/lib/refresh.d.ts +26 -0
  90. package/dist/lib/refresh.js +315 -0
  91. package/dist/lib/resource-patterns.d.ts +1 -1
  92. package/dist/lib/resource-patterns.js +1 -1
  93. package/dist/lib/resources/commands.js +2 -2
  94. package/dist/lib/resources/hooks.d.ts +1 -1
  95. package/dist/lib/resources/hooks.js +1 -1
  96. package/dist/lib/resources/mcp.d.ts +1 -1
  97. package/dist/lib/resources/mcp.js +5 -6
  98. package/dist/lib/resources/permissions.js +5 -2
  99. package/dist/lib/resources/rules.js +3 -2
  100. package/dist/lib/resources/skills.js +3 -2
  101. package/dist/lib/resources/types.d.ts +1 -1
  102. package/dist/lib/resources.d.ts +2 -0
  103. package/dist/lib/resources.js +4 -3
  104. package/dist/lib/rotate.d.ts +1 -1
  105. package/dist/lib/rotate.js +7 -19
  106. package/dist/lib/routines.d.ts +16 -4
  107. package/dist/lib/routines.js +67 -17
  108. package/dist/lib/rules/compile.js +22 -10
  109. package/dist/lib/rules/rules.js +3 -3
  110. package/dist/lib/run-config.d.ts +9 -0
  111. package/dist/lib/run-config.js +35 -0
  112. package/dist/lib/run-defaults.d.ts +42 -0
  113. package/dist/lib/run-defaults.js +180 -0
  114. package/dist/lib/runner.js +16 -3
  115. package/dist/lib/scheduler.js +15 -1
  116. package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
  117. package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
  118. package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
  119. package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
  120. package/dist/lib/secrets/install-helper.d.ts +11 -3
  121. package/dist/lib/secrets/install-helper.js +48 -6
  122. package/dist/lib/secrets/linux.d.ts +56 -9
  123. package/dist/lib/secrets/linux.js +327 -59
  124. package/dist/lib/session/db.js +15 -2
  125. package/dist/lib/session/discover.js +118 -3
  126. package/dist/lib/session/parse.js +3 -0
  127. package/dist/lib/session/types.d.ts +1 -1
  128. package/dist/lib/session/types.js +1 -1
  129. package/dist/lib/shims.d.ts +18 -9
  130. package/dist/lib/shims.js +133 -50
  131. package/dist/lib/skills.d.ts +1 -1
  132. package/dist/lib/skills.js +10 -9
  133. package/dist/lib/staleness/detectors/commands.d.ts +3 -0
  134. package/dist/lib/staleness/detectors/commands.js +46 -0
  135. package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
  136. package/dist/lib/staleness/detectors/hooks.js +44 -0
  137. package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
  138. package/dist/lib/staleness/detectors/mcp.js +31 -0
  139. package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
  140. package/dist/lib/staleness/detectors/permissions.js +201 -0
  141. package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
  142. package/dist/lib/staleness/detectors/plugins.js +23 -0
  143. package/dist/lib/staleness/detectors/rules.d.ts +3 -0
  144. package/dist/lib/staleness/detectors/rules.js +34 -0
  145. package/dist/lib/staleness/detectors/skills.d.ts +3 -0
  146. package/dist/lib/staleness/detectors/skills.js +71 -0
  147. package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
  148. package/dist/lib/staleness/detectors/subagents.js +50 -0
  149. package/dist/lib/staleness/detectors/types.d.ts +22 -0
  150. package/dist/lib/staleness/detectors/types.js +1 -0
  151. package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
  152. package/dist/lib/staleness/detectors/workflows.js +28 -0
  153. package/dist/lib/staleness/registry.d.ts +26 -0
  154. package/dist/lib/staleness/registry.js +123 -0
  155. package/dist/lib/staleness/writers/commands.d.ts +3 -0
  156. package/dist/lib/staleness/writers/commands.js +111 -0
  157. package/dist/lib/staleness/writers/hooks.d.ts +3 -0
  158. package/dist/lib/staleness/writers/hooks.js +47 -0
  159. package/dist/lib/staleness/writers/kinds.d.ts +10 -0
  160. package/dist/lib/staleness/writers/kinds.js +15 -0
  161. package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
  162. package/dist/lib/staleness/writers/lazy-map.js +19 -0
  163. package/dist/lib/staleness/writers/mcp.d.ts +10 -0
  164. package/dist/lib/staleness/writers/mcp.js +19 -0
  165. package/dist/lib/staleness/writers/permissions.d.ts +13 -0
  166. package/dist/lib/staleness/writers/permissions.js +26 -0
  167. package/dist/lib/staleness/writers/plugins.d.ts +7 -0
  168. package/dist/lib/staleness/writers/plugins.js +31 -0
  169. package/dist/lib/staleness/writers/rules.d.ts +7 -0
  170. package/dist/lib/staleness/writers/rules.js +55 -0
  171. package/dist/lib/staleness/writers/skills.d.ts +3 -0
  172. package/dist/lib/staleness/writers/skills.js +81 -0
  173. package/dist/lib/staleness/writers/sources.d.ts +16 -0
  174. package/dist/lib/staleness/writers/sources.js +72 -0
  175. package/dist/lib/staleness/writers/subagents.d.ts +3 -0
  176. package/dist/lib/staleness/writers/subagents.js +53 -0
  177. package/dist/lib/staleness/writers/types.d.ts +36 -0
  178. package/dist/lib/staleness/writers/types.js +1 -0
  179. package/dist/lib/staleness/writers/workflows.d.ts +7 -0
  180. package/dist/lib/staleness/writers/workflows.js +31 -0
  181. package/dist/lib/state.d.ts +34 -11
  182. package/dist/lib/state.js +58 -13
  183. package/dist/lib/subagents.d.ts +0 -2
  184. package/dist/lib/subagents.js +6 -6
  185. package/dist/lib/teams/agents.js +1 -1
  186. package/dist/lib/teams/api.d.ts +67 -0
  187. package/dist/lib/teams/api.js +78 -0
  188. package/dist/lib/teams/parsers.d.ts +1 -1
  189. package/dist/lib/tmux/binary.d.ts +67 -0
  190. package/dist/lib/tmux/binary.js +141 -0
  191. package/dist/lib/tmux/index.d.ts +8 -0
  192. package/dist/lib/tmux/index.js +8 -0
  193. package/dist/lib/tmux/paths.d.ts +17 -0
  194. package/dist/lib/tmux/paths.js +30 -0
  195. package/dist/lib/tmux/session.d.ts +122 -0
  196. package/dist/lib/tmux/session.js +305 -0
  197. package/dist/lib/types.d.ts +73 -13
  198. package/dist/lib/types.js +1 -1
  199. package/dist/lib/usage.js +1 -1
  200. package/dist/lib/versions.d.ts +4 -4
  201. package/dist/lib/versions.js +138 -496
  202. package/dist/lib/workflows.d.ts +2 -4
  203. package/dist/lib/workflows.js +3 -4
  204. package/package.json +6 -3
  205. package/scripts/postinstall.js +16 -63
  206. package/dist/commands/status.d.ts +0 -9
  207. package/dist/commands/status.js +0 -25
@@ -461,11 +461,11 @@ export function registerVersionsCommands(program) {
461
461
  useCmd.action(async (agentArg, versionArg, options) => {
462
462
  try {
463
463
  const skipPrompts = options.yes || !isInteractiveTerminal();
464
- // Auto-pull ~/.agents-system if it's a git repo with remote (silent on success)
464
+ // Auto-pull ~/.agents/.system if it's a git repo with remote (silent on success)
465
465
  const agentsDir = getAgentsDir();
466
466
  const pullResult = await tryAutoPull(agentsDir);
467
467
  if (pullResult.pulled) {
468
- console.log(chalk.gray('Synced ~/.agents-system from remote'));
468
+ console.log(chalk.gray('Synced ~/.agents/.system from remote'));
469
469
  }
470
470
  // Support both "claude 2.0.65" and "claude@2.0.65" formats
471
471
  let agent;
@@ -9,6 +9,17 @@
9
9
  import type { Command } from 'commander';
10
10
  import type { AgentId } from '../lib/types.js';
11
11
  import { type ProfileSummary } from '../lib/profiles.js';
12
+ /** Per-section filter flags. When any are true, only those sections render. */
13
+ export interface ViewSectionFilter {
14
+ commands?: boolean;
15
+ skills?: boolean;
16
+ mcp?: boolean;
17
+ workflows?: boolean;
18
+ plugins?: boolean;
19
+ rules?: boolean;
20
+ hooks?: boolean;
21
+ promptcuts?: boolean;
22
+ }
12
23
  /** Machine-readable entry for a single installed version. */
13
24
  export interface ViewJsonVersion {
14
25
  version: string;
@@ -54,6 +65,6 @@ export declare function viewAction(agentArg?: string, options?: {
54
65
  prune?: boolean;
55
66
  yes?: boolean;
56
67
  dryRun?: boolean;
57
- }): Promise<void>;
68
+ } & ViewSectionFilter): Promise<void>;
58
69
  /** Register the `agents view` command. */
59
70
  export declare function registerViewCommand(program: Command): void;
@@ -8,15 +8,16 @@ import { readManifest } from '../lib/manifest.js';
8
8
  import { listInstalledVersions, listInstalledVersionDirs, getGlobalDefault, getVersionHomePath, getVersionDir, resolveVersionAlias, getAvailableResources, getActuallySyncedResources, getNewResources, getProjectOnlyResources, hasNewResources, promptNewResourceSelection, syncResourcesToVersion, removeVersion, printTrashFooter, } from '../lib/versions.js';
9
9
  import { getShimsDir, isShimsInPath, ensureVersionedAliasCurrent, removeShim, } from '../lib/shims.js';
10
10
  import { getAgentResources } from '../lib/resources.js';
11
- import { WORKFLOW_CAPABLE_AGENTS } from '../lib/workflows.js';
11
+ import { isCapable } from '../lib/capabilities.js';
12
12
  import { discoverPlugins, pluginSupportsAgent } from '../lib/plugins.js';
13
- import { PLUGINS_CAPABLE_AGENTS } from '../lib/agents.js';
14
13
  import { getAgentsDir, getUserAgentsDir, getEffectivePromptcutsPath, readMergedPromptcuts } from '../lib/state.js';
15
14
  import { isGitRepo, getGitSyncStatus } from '../lib/git.js';
16
15
  import { getCentralRulesFileName } from '../lib/rules/rules.js';
17
16
  import { composeRulesFromState } from '../lib/rules/compose.js';
18
17
  import { getConfiguredRunStrategy } from '../lib/rotate.js';
18
+ import { resolveRunDefaults } from '../lib/run-defaults.js';
19
19
  import { listProfiles, profileSummary } from '../lib/profiles.js';
20
+ import { loadManifest, isStale } from '../lib/staleness/index.js';
20
21
  import { confirm } from '@inquirer/prompts';
21
22
  import { formatPath, isInteractiveTerminal, isPromptCancelled } from './utils.js';
22
23
  /**
@@ -113,6 +114,29 @@ function getProjectVersionFromCwd(agent) {
113
114
  return null;
114
115
  }
115
116
  }
117
+ const SECTION_KEYS = ['commands', 'skills', 'mcp', 'workflows', 'plugins', 'rules', 'hooks', 'promptcuts'];
118
+ /**
119
+ * Decide whether a section should render given the filter. If no flags are set,
120
+ * everything renders (current behavior). If any flag is set, only those sections
121
+ * render — flags are additive.
122
+ */
123
+ function shouldRenderSection(key, filter) {
124
+ if (!filter)
125
+ return true;
126
+ const anySet = SECTION_KEYS.some((k) => filter[k]);
127
+ if (!anySet)
128
+ return true;
129
+ return filter[key] === true;
130
+ }
131
+ /** Trim a description to a column-friendly snippet. Strips newlines, collapses whitespace. */
132
+ function summarizeDescription(desc, maxLen = 80) {
133
+ if (!desc)
134
+ return '';
135
+ const cleaned = desc.replace(/\s+/g, ' ').trim();
136
+ if (cleaned.length <= maxLen)
137
+ return cleaned;
138
+ return cleaned.slice(0, maxLen - 1).trimEnd() + '…';
139
+ }
116
140
  function getProfileSummaries(filterAgentId) {
117
141
  return listProfiles()
118
142
  .filter((profile) => !filterAgentId || profile.host.agent === filterAgentId)
@@ -338,6 +362,12 @@ async function showInstalledVersions(filterAgentId) {
338
362
  // Otherwise it reflects install time (misleading "just now" for fresh installs).
339
363
  const activeStr = vInfo && hasEmail ? formatLastActive(vInfo.lastActive) : '';
340
364
  const hasActive = activeStr.length > 0;
365
+ const runDefaults = resolveRunDefaults(agentId, version);
366
+ const runDefaultBits = [];
367
+ if (runDefaults.mode)
368
+ runDefaultBits.push(`mode:${runDefaults.mode}`);
369
+ if (runDefaults.model)
370
+ runDefaultBits.push(`model:${runDefaults.model}`);
341
371
  if (!hasEmail && !hasUsage) {
342
372
  // Installed but never signed in
343
373
  parts.push(chalk.gray('(not signed in — run ' + agent.cliCommand + ' to log in)'));
@@ -359,6 +389,9 @@ async function showInstalledVersions(filterAgentId) {
359
389
  if (hasActive)
360
390
  parts.push(activeStr);
361
391
  }
392
+ if (runDefaultBits.length > 0) {
393
+ parts.push(chalk.gray(`run ${runDefaultBits.join(' ')}`));
394
+ }
362
395
  console.log(parts.join(' '));
363
396
  if (showPaths) {
364
397
  const versionDir = getVersionDir(agentId, version);
@@ -519,6 +552,11 @@ async function showInstalledVersions(filterAgentId) {
519
552
  if (filterAgentId && versionManaged.length > 0) {
520
553
  const defaultVersion = getGlobalDefault(filterAgentId);
521
554
  if (defaultVersion) {
555
+ const manifest = loadManifest(filterAgentId, defaultVersion);
556
+ const cwd = process.cwd();
557
+ if (manifest && !isStale(manifest, filterAgentId, defaultVersion, cwd)) {
558
+ return;
559
+ }
522
560
  const available = getAvailableResources();
523
561
  const synced = getActuallySyncedResources(filterAgentId, defaultVersion);
524
562
  const projectOnly = getProjectOnlyResources();
@@ -563,7 +601,7 @@ async function showInstalledVersions(filterAgentId) {
563
601
  * Show detailed resources for a specific agent version.
564
602
  * Called when: `agents view claude@2.0.65` or `agents view claude@default`
565
603
  */
566
- async function showAgentResources(agentId, requestedVersion) {
604
+ async function showAgentResources(agentId, requestedVersion, filter) {
567
605
  const spinner = ora({ text: 'Loading...', isSilent: !process.stdout.isTTY }).start();
568
606
  const cwd = process.cwd();
569
607
  const agentsDir = getAgentsDir();
@@ -655,6 +693,8 @@ async function showAgentResources(agentId, requestedVersion) {
655
693
  })),
656
694
  skills: resources.skills.map(r => ({
657
695
  ...r,
696
+ // ruleCount of 0 is noise — every skill has 0 unless it ships subrules, which is rare.
697
+ ruleCount: r.ruleCount && r.ruleCount > 0 ? r.ruleCount : undefined,
658
698
  syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'skills', skillsSync),
659
699
  })),
660
700
  skillErrors: resources.skillErrors,
@@ -700,7 +740,9 @@ async function showAgentResources(agentId, requestedVersion) {
700
740
  : chalk.gray('[system]');
701
741
  display += ` ${sourceTag}`;
702
742
  const syncStr = r.syncState ? chalk.gray(` [${r.syncState}]`) : '';
703
- console.log(` ${display}${syncStr}`);
743
+ const descSnippet = summarizeDescription(r.description);
744
+ const descStr = descSnippet ? chalk.gray(` ${descSnippet}`) : '';
745
+ console.log(` ${display}${syncStr}${descStr}`);
704
746
  }
705
747
  }
706
748
  // Render promptcuts (cross-agent, not per-version). Shortcuts are layered
@@ -717,43 +759,53 @@ async function showAgentResources(agentId, requestedVersion) {
717
759
  const label = `${count} shortcut${count === 1 ? '' : 's'}`;
718
760
  console.log(` ${chalk.green(label).padEnd(24)} ${chalk.gray(formatPath(getEffectivePromptcutsPath(), cwd))}`);
719
761
  }
720
- // 1. Agent CLI info
721
- console.log(chalk.bold('Agent CLIs\n'));
722
- const accountInfo = await getAccountInfo(agentId, home);
723
- const usageInfo = await getUsageInfoForIdentity({
724
- agentId,
725
- home,
726
- cliVersion: version,
727
- info: accountInfo,
728
- });
729
- const emailStr = accountInfo.email ? chalk.cyan(` ${accountInfo.email}`) : '';
730
- const status = chalk.green(version);
731
- const usageStr = formatUsageSummary(accountInfo.plan, null);
732
- const usagePart = usageStr ? ` ${usageStr}` : '';
733
- console.log(` ${colorAgent(agentId)(AGENTS[agentId].name.padEnd(14))} ${status}${emailStr}${usagePart}`);
734
- const usageLines = formatUsageSection(usageInfo);
735
- if (usageLines.length > 0) {
736
- console.log();
737
- for (const line of usageLines) {
738
- console.log(line);
762
+ const anyFilterSet = filter && SECTION_KEYS.some((k) => filter[k]);
763
+ // 1. Agent CLI info — skip the header entirely when the user asked for a
764
+ // specific section. They want "nothing more or less."
765
+ if (!anyFilterSet) {
766
+ console.log(chalk.bold('Agent CLIs\n'));
767
+ const accountInfo = await getAccountInfo(agentId, home);
768
+ const usageInfo = await getUsageInfoForIdentity({
769
+ agentId,
770
+ home,
771
+ cliVersion: version,
772
+ info: accountInfo,
773
+ });
774
+ const emailStr = accountInfo.email ? chalk.cyan(` ${accountInfo.email}`) : '';
775
+ const status = chalk.green(version);
776
+ const usageStr = formatUsageSummary(accountInfo.plan, null);
777
+ const usagePart = usageStr ? ` ${usageStr}` : '';
778
+ console.log(` ${colorAgent(agentId)(AGENTS[agentId].name.padEnd(14))} ${status}${emailStr}${usagePart}`);
779
+ const usageLines = formatUsageSection(usageInfo);
780
+ if (usageLines.length > 0) {
781
+ console.log();
782
+ for (const line of usageLines) {
783
+ console.log(line);
784
+ }
739
785
  }
740
786
  }
741
787
  // 2. Resources
742
- renderSection('Commands', agentData.commands);
743
- renderSection('Skills', agentData.skills);
744
- // Show skill parse errors if any
745
- if (agentData.skillErrors.length > 0) {
746
- console.log(`\n ${chalk.red('Skill Errors')}:`);
747
- for (const err of agentData.skillErrors) {
748
- console.log(` ${chalk.red(err.name.padEnd(20))} ${chalk.gray(err.error)}`);
749
- console.log(` ${chalk.gray(formatPath(err.path, cwd))}`);
788
+ if (shouldRenderSection('commands', filter)) {
789
+ renderSection('Commands', agentData.commands);
790
+ }
791
+ if (shouldRenderSection('skills', filter)) {
792
+ renderSection('Skills', agentData.skills);
793
+ // Show skill parse errors only when skills section is visible
794
+ if (agentData.skillErrors.length > 0) {
795
+ console.log(`\n ${chalk.red('Skill Errors')}:`);
796
+ for (const err of agentData.skillErrors) {
797
+ console.log(` ${chalk.red(err.name.padEnd(20))} ${chalk.gray(err.error)}`);
798
+ console.log(` ${chalk.gray(formatPath(err.path, cwd))}`);
799
+ }
750
800
  }
751
801
  }
752
- renderSection('MCP Servers', agentData.mcp);
753
- if (WORKFLOW_CAPABLE_AGENTS.includes(agentId)) {
802
+ if (shouldRenderSection('mcp', filter)) {
803
+ renderSection('MCP Servers', agentData.mcp);
804
+ }
805
+ if (shouldRenderSection('workflows', filter) && isCapable(agentId, 'workflows')) {
754
806
  renderSection('Workflows', agentData.workflows);
755
807
  }
756
- if (PLUGINS_CAPABLE_AGENTS.includes(agentId)) {
808
+ if (shouldRenderSection('plugins', filter) && isCapable(agentId, 'plugins')) {
757
809
  const plugins = discoverPlugins().filter(p => pluginSupportsAgent(p, agentId));
758
810
  console.log(chalk.bold('\nPlugins\n'));
759
811
  if (plugins.length === 0) {
@@ -842,11 +894,18 @@ async function showAgentResources(agentId, requestedVersion) {
842
894
  }
843
895
  }
844
896
  }
845
- renderRulesSection();
846
- renderSection('Hooks', agentData.hooks);
847
- renderPromptcuts();
848
- // Show legend at the end if git repo exists
849
- if (hasGitRepo) {
897
+ if (shouldRenderSection('rules', filter)) {
898
+ renderRulesSection();
899
+ }
900
+ if (shouldRenderSection('hooks', filter)) {
901
+ renderSection('Hooks', agentData.hooks);
902
+ }
903
+ if (shouldRenderSection('promptcuts', filter)) {
904
+ renderPromptcuts();
905
+ }
906
+ // Show legend at the end if git repo exists and we showed all sections.
907
+ // Filtered single-section views skip it — noise for promptcuts or plugins.
908
+ if (hasGitRepo && !anyFilterSet) {
850
909
  console.log();
851
910
  console.log(chalk.gray('Legend:'), chalk.green('Tracked'), chalk.blue('Local-only'), chalk.yellow('Modified'), chalk.red('Deleted'));
852
911
  }
@@ -1126,6 +1185,17 @@ export async function viewAction(agentArg, options) {
1126
1185
  const prune = options?.prune === true;
1127
1186
  const yes = options?.yes === true;
1128
1187
  const dryRun = options?.dryRun === true;
1188
+ const filter = {
1189
+ commands: options?.commands,
1190
+ skills: options?.skills,
1191
+ mcp: options?.mcp,
1192
+ workflows: options?.workflows,
1193
+ plugins: options?.plugins,
1194
+ rules: options?.rules,
1195
+ hooks: options?.hooks,
1196
+ promptcuts: options?.promptcuts,
1197
+ };
1198
+ const filterIsSet = SECTION_KEYS.some((k) => filter[k]);
1129
1199
  if (!agentArg) {
1130
1200
  if (prune) {
1131
1201
  await pruneDuplicates(undefined, yes, dryRun);
@@ -1175,7 +1245,12 @@ export async function viewAction(agentArg, options) {
1175
1245
  }
1176
1246
  if (requestedVersion) {
1177
1247
  // Specific version requested: show detailed resources
1178
- await showAgentResources(agentId, requestedVersion);
1248
+ await showAgentResources(agentId, requestedVersion, filter);
1249
+ }
1250
+ else if (filterIsSet) {
1251
+ // `agents view claude --skills` → fall through to detail view on default.
1252
+ // Section filters only make sense for the per-version detail view.
1253
+ await showAgentResources(agentId, 'default', filter);
1179
1254
  }
1180
1255
  else {
1181
1256
  // Just agent name: show versions for that agent
@@ -1191,6 +1266,14 @@ export function registerViewCommand(program) {
1191
1266
  .option('--prune', 'Remove older installed versions that share an account with a newer installed version. Skips the global default.')
1192
1267
  .option('--dry-run', 'With --prune, show duplicate versions without deleting')
1193
1268
  .option('-y, --yes', 'Skip the prune confirmation prompt.')
1269
+ .option('--commands', 'Show only commands in the detail view.')
1270
+ .option('--skills', 'Show only skills in the detail view.')
1271
+ .option('--mcp', 'Show only MCP servers in the detail view.')
1272
+ .option('--workflows', 'Show only workflows in the detail view.')
1273
+ .option('--plugins', 'Show only plugins in the detail view.')
1274
+ .option('--rules', 'Show only rules in the detail view.')
1275
+ .option('--hooks', 'Show only hooks in the detail view.')
1276
+ .option('--promptcuts', 'Show only promptcuts in the detail view.')
1194
1277
  .addHelpText('after', `
1195
1278
  Examples:
1196
1279
  # Show all installed agents with versions, accounts, and usage
@@ -1211,6 +1294,11 @@ Examples:
1211
1294
  agents view claude --prune
1212
1295
  agents view claude --prune -y
1213
1296
 
1297
+ # Filter the detail view to a single section (combinable)
1298
+ agents view claude@default --skills
1299
+ agents view claude@default --plugins --workflows
1300
+ agents view claude --commands # implicitly the default version
1301
+
1214
1302
  When to use:
1215
1303
  - Checking which agents are installed and what their default versions are
1216
1304
  - Seeing which account each version is logged into (useful for multi-account setups)
@@ -5,8 +5,9 @@ import * as os from 'os';
5
5
  import * as path from 'path';
6
6
  import { select, checkbox } from '@inquirer/prompts';
7
7
  import { resolveAgentName, agentLabel } from '../lib/agents.js';
8
+ import { capableAgents } from '../lib/capabilities.js';
8
9
  import { cloneRepo } from '../lib/git.js';
9
- import { WORKFLOW_CAPABLE_AGENTS, discoverWorkflowsFromRepo, installWorkflowCentrally, removeWorkflow, listInstalledWorkflows, listWorkflowsForAgent, removeWorkflowFromVersion, iterWorkflowsCapableVersions, } from '../lib/workflows.js';
10
+ import { discoverWorkflowsFromRepo, installWorkflowCentrally, removeWorkflow, listInstalledWorkflows, listWorkflowsForAgent, removeWorkflowFromVersion, iterWorkflowsCapableVersions, } from '../lib/workflows.js';
10
11
  import { getVersionHomePath, getGlobalDefault, resolveVersionAlias, syncResourcesToVersion, promptAgentVersionSelection, } from '../lib/versions.js';
11
12
  import { recordVersionResources, getUserWorkflowsDir } from '../lib/state.js';
12
13
  import { isPromptCancelled, isInteractiveTerminal, requireInteractiveSelection, printWithPager, promptRemovalTargets, parseCommaSeparatedList, resolveAgentTargetsAutoInstalling, } from './utils.js';
@@ -210,7 +211,7 @@ Examples:
210
211
  let selectedAgents;
211
212
  let versionSelections;
212
213
  if (options.agents) {
213
- const result = await resolveAgentTargetsAutoInstalling(options.agents, WORKFLOW_CAPABLE_AGENTS, { yes: options.yes });
214
+ const result = await resolveAgentTargetsAutoInstalling(options.agents, capableAgents('workflows'), { yes: options.yes });
214
215
  if (!result) {
215
216
  console.log(chalk.gray('Cancelled.'));
216
217
  return;
@@ -219,7 +220,7 @@ Examples:
219
220
  versionSelections = result.versionSelections;
220
221
  }
221
222
  else {
222
- const result = await promptAgentVersionSelection(WORKFLOW_CAPABLE_AGENTS, {
223
+ const result = await promptAgentVersionSelection(capableAgents('workflows'), {
223
224
  skipPrompts: options.yes,
224
225
  });
225
226
  selectedAgents = result.selectedAgents;
@@ -10,11 +10,10 @@
10
10
  * agents worktree release <terminal-id> -> removes if clean + merged
11
11
  * agents worktree prune -> removes every clean+merged one
12
12
  *
13
- * Worktrees live at <repo>/.history/worktrees/<terminal-id>, on a branch
14
- * named agent/<terminal-id>. The branch starts at HEAD of the parent repo.
15
- * .history/ mirrors the agents-cli runtime-state convention at ~/.agents/.history/
16
- * but scoped to the repo. .agents/ is reserved for project resources
17
- * (skills, hooks, commands) per the agents-cli DotAgents repo layout.
13
+ * Worktrees live at <repo>/.agents/worktrees/<terminal-id>, on a branch
14
+ * named agents/<terminal-id>. The branch starts at HEAD of the parent repo.
15
+ * This matches the agent-system rule that keeps all coding-agent worktrees
16
+ * under the repo-local .agents/ state directory.
18
17
  */
19
18
  import type { Command } from 'commander';
20
19
  export declare function registerWorktreeCommands(program: Command): void;
@@ -6,8 +6,8 @@ import * as fsSync from 'fs';
6
6
  import * as path from 'path';
7
7
  import { setHelpSections } from '../lib/help.js';
8
8
  const execFileAsync = promisify(execFile);
9
- const WORKTREE_SUBDIR = path.join('.history', 'worktrees');
10
- const BRANCH_PREFIX = 'agent/';
9
+ const WORKTREE_SUBDIR = path.join('.agents', 'worktrees');
10
+ const BRANCH_PREFIX = 'agents/';
11
11
  function die(msg, code = 1) {
12
12
  console.error(chalk.red(msg));
13
13
  process.exit(code);
@@ -165,7 +165,7 @@ export function registerWorktreeCommands(program) {
165
165
  agents worktree prune
166
166
  `,
167
167
  notes: `
168
- Worktrees live at <repo>/.history/worktrees/<terminal-id> on branch agent/<terminal-id>.
168
+ Worktrees live at <repo>/.agents/worktrees/<terminal-id> on branch agents/<terminal-id>.
169
169
  Use --force on 'release' to skip safety checks (DANGEROUS — discards unpushed work).
170
170
  `,
171
171
  });
@@ -198,7 +198,7 @@ export function registerWorktreeCommands(program) {
198
198
  }
199
199
  });
200
200
  wt.command('prune')
201
- .description('Try to release every agent worktree under .history/worktrees/. Skips dirty or unpushed ones.')
201
+ .description('Try to release every agent worktree under .agents/worktrees/. Skips dirty or unpushed ones.')
202
202
  .option('--root <path>', 'Repo root (defaults to current working directory)')
203
203
  .option('--dry-run', 'Report what would be removed without touching anything')
204
204
  .action(async (opts) => {