@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.
- package/CHANGELOG.md +19 -0
- package/README.md +49 -18
- package/dist/commands/browser.js +31 -4
- package/dist/commands/cli.js +1 -1
- package/dist/commands/cloud.js +1 -1
- package/dist/commands/commands.js +2 -0
- package/dist/commands/computer.js +10 -2
- package/dist/commands/defaults.d.ts +7 -0
- package/dist/commands/defaults.js +89 -0
- package/dist/commands/doctor.js +1 -1
- package/dist/commands/exec.js +73 -19
- package/dist/commands/hooks.js +6 -6
- package/dist/commands/inspect.d.ts +26 -0
- package/dist/commands/inspect.js +590 -0
- package/dist/commands/mcp.js +17 -16
- package/dist/commands/models.js +1 -1
- package/dist/commands/packages.js +6 -4
- package/dist/commands/permissions.js +13 -12
- package/dist/commands/plugins.d.ts +13 -0
- package/dist/commands/plugins.js +100 -11
- package/dist/commands/prune.js +3 -2
- package/dist/commands/pull.d.ts +12 -5
- package/dist/commands/pull.js +26 -422
- package/dist/commands/push.d.ts +14 -0
- package/dist/commands/push.js +30 -0
- package/dist/commands/repo.d.ts +1 -1
- package/dist/commands/repo.js +155 -112
- package/dist/commands/resource-view.d.ts +2 -0
- package/dist/commands/resource-view.js +12 -3
- package/dist/commands/routines.js +32 -7
- package/dist/commands/rules.js +4 -4
- package/dist/commands/secrets.js +46 -9
- package/dist/commands/sessions.js +1 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +17 -17
- package/dist/commands/skills.js +6 -5
- package/dist/commands/subagents.js +5 -4
- package/dist/commands/sync.d.ts +18 -5
- package/dist/commands/sync.js +251 -65
- package/dist/commands/teams.js +109 -11
- package/dist/commands/tmux.d.ts +25 -0
- package/dist/commands/tmux.js +415 -0
- package/dist/commands/trash.d.ts +2 -2
- package/dist/commands/trash.js +1 -1
- package/dist/commands/versions.js +2 -2
- package/dist/commands/view.d.ts +12 -1
- package/dist/commands/view.js +128 -40
- package/dist/commands/workflows.js +4 -3
- package/dist/commands/worktree.d.ts +4 -5
- package/dist/commands/worktree.js +4 -4
- package/dist/index.js +106 -41
- package/dist/lib/agents.d.ts +23 -10
- package/dist/lib/agents.js +88 -25
- package/dist/lib/auto-pull-worker.d.ts +1 -1
- package/dist/lib/auto-pull-worker.js +2 -2
- package/dist/lib/auto-pull.d.ts +1 -1
- package/dist/lib/auto-pull.js +1 -1
- package/dist/lib/beta.d.ts +1 -1
- package/dist/lib/beta.js +1 -1
- package/dist/lib/browser/chrome.d.ts +10 -0
- package/dist/lib/browser/chrome.js +84 -3
- package/dist/lib/capabilities.js +2 -0
- package/dist/lib/commands.d.ts +28 -1
- package/dist/lib/commands.js +125 -20
- package/dist/lib/doctor-diff.js +2 -2
- package/dist/lib/exec.d.ts +14 -0
- package/dist/lib/exec.js +59 -5
- package/dist/lib/fuzzy.d.ts +12 -2
- package/dist/lib/fuzzy.js +29 -4
- package/dist/lib/git.js +8 -1
- package/dist/lib/hooks.d.ts +2 -2
- package/dist/lib/hooks.js +97 -10
- package/dist/lib/mcp.js +32 -2
- package/dist/lib/migrate.d.ts +51 -0
- package/dist/lib/migrate.js +233 -5
- package/dist/lib/models.js +62 -15
- package/dist/lib/permissions.d.ts +59 -2
- package/dist/lib/permissions.js +299 -7
- package/dist/lib/plugin-marketplace.d.ts +98 -40
- package/dist/lib/plugin-marketplace.js +196 -93
- package/dist/lib/plugins.d.ts +21 -4
- package/dist/lib/plugins.js +130 -49
- package/dist/lib/profiles-presets.js +12 -12
- package/dist/lib/project-launch.d.ts +70 -0
- package/dist/lib/project-launch.js +404 -0
- package/dist/lib/pty-client.js +1 -1
- package/dist/lib/pty-server.d.ts +1 -1
- package/dist/lib/pty-server.js +8 -5
- package/dist/lib/refresh.d.ts +26 -0
- package/dist/lib/refresh.js +315 -0
- package/dist/lib/resource-patterns.d.ts +1 -1
- package/dist/lib/resource-patterns.js +1 -1
- package/dist/lib/resources/commands.js +2 -2
- package/dist/lib/resources/hooks.d.ts +1 -1
- package/dist/lib/resources/hooks.js +1 -1
- package/dist/lib/resources/mcp.d.ts +1 -1
- package/dist/lib/resources/mcp.js +5 -6
- package/dist/lib/resources/permissions.js +5 -2
- package/dist/lib/resources/rules.js +3 -2
- package/dist/lib/resources/skills.js +3 -2
- package/dist/lib/resources/types.d.ts +1 -1
- package/dist/lib/resources.d.ts +2 -0
- package/dist/lib/resources.js +4 -3
- package/dist/lib/rotate.d.ts +1 -1
- package/dist/lib/rotate.js +7 -19
- package/dist/lib/routines.d.ts +16 -4
- package/dist/lib/routines.js +67 -17
- package/dist/lib/rules/compile.js +22 -10
- package/dist/lib/rules/rules.js +3 -3
- package/dist/lib/run-config.d.ts +9 -0
- package/dist/lib/run-config.js +35 -0
- package/dist/lib/run-defaults.d.ts +42 -0
- package/dist/lib/run-defaults.js +180 -0
- package/dist/lib/runner.js +16 -3
- package/dist/lib/scheduler.js +15 -1
- package/dist/lib/secrets/Agents CLI.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/MacOS/Agents CLI +0 -0
- package/dist/lib/secrets/Agents CLI.app/Contents/_CodeSignature/CodeResources +9 -1
- package/dist/lib/secrets/Agents CLI.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/secrets/install-helper.d.ts +11 -3
- package/dist/lib/secrets/install-helper.js +48 -6
- package/dist/lib/secrets/linux.d.ts +56 -9
- package/dist/lib/secrets/linux.js +327 -59
- package/dist/lib/session/db.js +15 -2
- package/dist/lib/session/discover.js +118 -3
- package/dist/lib/session/parse.js +3 -0
- package/dist/lib/session/types.d.ts +1 -1
- package/dist/lib/session/types.js +1 -1
- package/dist/lib/shims.d.ts +18 -9
- package/dist/lib/shims.js +133 -50
- package/dist/lib/skills.d.ts +1 -1
- package/dist/lib/skills.js +10 -9
- package/dist/lib/staleness/detectors/commands.d.ts +3 -0
- package/dist/lib/staleness/detectors/commands.js +46 -0
- package/dist/lib/staleness/detectors/hooks.d.ts +3 -0
- package/dist/lib/staleness/detectors/hooks.js +44 -0
- package/dist/lib/staleness/detectors/mcp.d.ts +3 -0
- package/dist/lib/staleness/detectors/mcp.js +31 -0
- package/dist/lib/staleness/detectors/permissions.d.ts +3 -0
- package/dist/lib/staleness/detectors/permissions.js +201 -0
- package/dist/lib/staleness/detectors/plugins.d.ts +8 -0
- package/dist/lib/staleness/detectors/plugins.js +23 -0
- package/dist/lib/staleness/detectors/rules.d.ts +3 -0
- package/dist/lib/staleness/detectors/rules.js +34 -0
- package/dist/lib/staleness/detectors/skills.d.ts +3 -0
- package/dist/lib/staleness/detectors/skills.js +71 -0
- package/dist/lib/staleness/detectors/subagents.d.ts +3 -0
- package/dist/lib/staleness/detectors/subagents.js +50 -0
- package/dist/lib/staleness/detectors/types.d.ts +22 -0
- package/dist/lib/staleness/detectors/types.js +1 -0
- package/dist/lib/staleness/detectors/workflows.d.ts +3 -0
- package/dist/lib/staleness/detectors/workflows.js +28 -0
- package/dist/lib/staleness/registry.d.ts +26 -0
- package/dist/lib/staleness/registry.js +123 -0
- package/dist/lib/staleness/writers/commands.d.ts +3 -0
- package/dist/lib/staleness/writers/commands.js +111 -0
- package/dist/lib/staleness/writers/hooks.d.ts +3 -0
- package/dist/lib/staleness/writers/hooks.js +47 -0
- package/dist/lib/staleness/writers/kinds.d.ts +10 -0
- package/dist/lib/staleness/writers/kinds.js +15 -0
- package/dist/lib/staleness/writers/lazy-map.d.ts +13 -0
- package/dist/lib/staleness/writers/lazy-map.js +19 -0
- package/dist/lib/staleness/writers/mcp.d.ts +10 -0
- package/dist/lib/staleness/writers/mcp.js +19 -0
- package/dist/lib/staleness/writers/permissions.d.ts +13 -0
- package/dist/lib/staleness/writers/permissions.js +26 -0
- package/dist/lib/staleness/writers/plugins.d.ts +7 -0
- package/dist/lib/staleness/writers/plugins.js +31 -0
- package/dist/lib/staleness/writers/rules.d.ts +7 -0
- package/dist/lib/staleness/writers/rules.js +55 -0
- package/dist/lib/staleness/writers/skills.d.ts +3 -0
- package/dist/lib/staleness/writers/skills.js +81 -0
- package/dist/lib/staleness/writers/sources.d.ts +16 -0
- package/dist/lib/staleness/writers/sources.js +72 -0
- package/dist/lib/staleness/writers/subagents.d.ts +3 -0
- package/dist/lib/staleness/writers/subagents.js +53 -0
- package/dist/lib/staleness/writers/types.d.ts +36 -0
- package/dist/lib/staleness/writers/types.js +1 -0
- package/dist/lib/staleness/writers/workflows.d.ts +7 -0
- package/dist/lib/staleness/writers/workflows.js +31 -0
- package/dist/lib/state.d.ts +34 -11
- package/dist/lib/state.js +58 -13
- package/dist/lib/subagents.d.ts +0 -2
- package/dist/lib/subagents.js +6 -6
- package/dist/lib/teams/agents.js +1 -1
- package/dist/lib/teams/api.d.ts +67 -0
- package/dist/lib/teams/api.js +78 -0
- package/dist/lib/teams/parsers.d.ts +1 -1
- package/dist/lib/tmux/binary.d.ts +67 -0
- package/dist/lib/tmux/binary.js +141 -0
- package/dist/lib/tmux/index.d.ts +8 -0
- package/dist/lib/tmux/index.js +8 -0
- package/dist/lib/tmux/paths.d.ts +17 -0
- package/dist/lib/tmux/paths.js +30 -0
- package/dist/lib/tmux/session.d.ts +122 -0
- package/dist/lib/tmux/session.js +305 -0
- package/dist/lib/types.d.ts +73 -13
- package/dist/lib/types.js +1 -1
- package/dist/lib/usage.js +1 -1
- package/dist/lib/versions.d.ts +4 -4
- package/dist/lib/versions.js +138 -496
- package/dist/lib/workflows.d.ts +2 -4
- package/dist/lib/workflows.js +3 -4
- package/package.json +6 -3
- package/scripts/postinstall.js +16 -63
- package/dist/commands/status.d.ts +0 -9
- 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
|
|
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
|
|
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;
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -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;
|
package/dist/commands/view.js
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
home
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
console.log();
|
|
737
|
-
|
|
738
|
-
|
|
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
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
if (
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
console.log(
|
|
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
|
-
|
|
753
|
-
|
|
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 (
|
|
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
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
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 {
|
|
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,
|
|
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(
|
|
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>/.
|
|
14
|
-
* named
|
|
15
|
-
*
|
|
16
|
-
*
|
|
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('.
|
|
10
|
-
const BRANCH_PREFIX = '
|
|
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>/.
|
|
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 .
|
|
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) => {
|