@phnx-labs/agents-cli 1.12.0 → 1.14.1
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 +7 -1
- package/README.md +293 -300
- package/dist/commands/alias.d.ts +11 -0
- package/dist/commands/alias.js +117 -0
- package/dist/commands/beta.d.ts +2 -0
- package/dist/commands/beta.js +53 -0
- package/dist/commands/cloud.d.ts +10 -0
- package/dist/commands/cloud.js +408 -0
- package/dist/commands/commands.d.ts +9 -1
- package/dist/commands/commands.js +24 -172
- package/dist/commands/daemon.d.ts +8 -1
- package/dist/commands/daemon.js +13 -5
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/doctor.js +132 -0
- package/dist/commands/drive.d.ts +8 -1
- package/dist/commands/drive.js +20 -3
- package/dist/commands/exec.d.ts +8 -1
- package/dist/commands/exec.js +207 -20
- package/dist/commands/factory.d.ts +19 -0
- package/dist/commands/factory.js +71 -0
- package/dist/commands/fork.d.ts +8 -1
- package/dist/commands/fork.js +11 -4
- package/dist/commands/hooks.d.ts +9 -1
- package/dist/commands/hooks.js +30 -182
- package/dist/commands/init.d.ts +15 -1
- package/dist/commands/init.js +168 -74
- package/dist/commands/mcp.d.ts +9 -1
- package/dist/commands/mcp.js +11 -7
- package/dist/commands/models.d.ts +8 -1
- package/dist/commands/models.js +45 -6
- package/dist/commands/packages.d.ts +8 -1
- package/dist/commands/packages.js +13 -7
- package/dist/commands/permissions.d.ts +9 -1
- package/dist/commands/permissions.js +3 -3
- package/dist/commands/plugins.d.ts +8 -1
- package/dist/commands/plugins.js +13 -2
- package/dist/commands/profiles.d.ts +11 -0
- package/dist/commands/profiles.js +291 -0
- package/dist/commands/prune.d.ts +22 -0
- package/dist/commands/prune.js +191 -0
- package/dist/commands/pty.d.ts +1 -1
- package/dist/commands/pty.js +2 -1
- package/dist/commands/pull.d.ts +8 -1
- package/dist/commands/pull.js +93 -129
- package/dist/commands/refresh-memory.d.ts +7 -1
- package/dist/commands/refresh-memory.js +7 -1
- package/dist/commands/repo.d.ts +15 -0
- package/dist/commands/repo.js +570 -0
- package/dist/commands/resource-view.d.ts +10 -3
- package/dist/commands/resource-view.js +18 -5
- package/dist/commands/routines.d.ts +8 -1
- package/dist/commands/routines.js +17 -4
- package/dist/commands/rules.d.ts +9 -1
- package/dist/commands/rules.js +16 -11
- package/dist/commands/secrets.d.ts +10 -0
- package/dist/commands/secrets.js +511 -0
- package/dist/commands/sessions-picker.d.ts +2 -1
- package/dist/commands/sessions-picker.js +88 -11
- package/dist/commands/sessions-tail.d.ts +19 -0
- package/dist/commands/sessions-tail.js +235 -0
- package/dist/commands/sessions.d.ts +2 -1
- package/dist/commands/sessions.js +288 -7
- package/dist/commands/skills.d.ts +9 -1
- package/dist/commands/skills.js +28 -178
- package/dist/commands/status.d.ts +7 -1
- package/dist/commands/status.js +7 -1
- package/dist/commands/subagents.d.ts +8 -1
- package/dist/commands/subagents.js +11 -1
- package/dist/commands/sync.d.ts +8 -1
- package/dist/commands/sync.js +8 -1
- package/dist/commands/teams-picker.d.ts +4 -1
- package/dist/commands/teams-picker.js +55 -3
- package/dist/commands/teams.d.ts +15 -1
- package/dist/commands/teams.js +323 -69
- package/dist/commands/usage.d.ts +11 -0
- package/dist/commands/usage.js +60 -0
- package/dist/commands/utils.d.ts +6 -1
- package/dist/commands/utils.js +6 -1
- package/dist/commands/versions.d.ts +8 -1
- package/dist/commands/versions.js +4 -3
- package/dist/commands/view.d.ts +47 -2
- package/dist/commands/view.js +353 -20
- package/dist/index.d.ts +7 -2
- package/dist/index.js +205 -38
- package/dist/lib/acp/client.d.ts +31 -0
- package/dist/lib/acp/client.js +117 -0
- package/dist/lib/acp/harnesses.d.ts +26 -0
- package/dist/lib/acp/harnesses.js +65 -0
- package/dist/lib/acp/run.d.ts +18 -0
- package/dist/lib/acp/run.js +39 -0
- package/dist/lib/agents.d.ts +74 -2
- package/dist/lib/agents.js +207 -23
- package/dist/lib/artifact-actions.d.ts +8 -4
- package/dist/lib/artifact-actions.js +8 -6
- package/dist/lib/auto-pull-worker.d.ts +11 -0
- package/dist/lib/auto-pull-worker.js +121 -0
- package/dist/lib/auto-pull.d.ts +31 -0
- package/dist/lib/auto-pull.js +97 -0
- package/dist/lib/beta.d.ts +23 -0
- package/dist/lib/beta.js +90 -0
- package/dist/lib/capabilities.d.ts +29 -0
- package/dist/lib/capabilities.js +74 -0
- package/dist/lib/cloud/codex.d.ts +25 -0
- package/dist/lib/cloud/codex.js +250 -0
- package/dist/lib/cloud/factory.d.ts +31 -0
- package/dist/lib/cloud/factory.js +53 -0
- package/dist/lib/cloud/registry.d.ts +15 -0
- package/dist/lib/cloud/registry.js +67 -0
- package/dist/lib/cloud/rush.d.ts +75 -0
- package/dist/lib/cloud/rush.js +438 -0
- package/dist/lib/cloud/store.d.ts +22 -0
- package/dist/lib/cloud/store.js +115 -0
- package/dist/lib/cloud/stream.d.ts +23 -0
- package/dist/lib/cloud/stream.js +194 -0
- package/dist/lib/cloud/types.d.ts +205 -0
- package/dist/lib/cloud/types.js +34 -0
- package/dist/lib/command-skills.d.ts +20 -0
- package/dist/lib/command-skills.js +142 -0
- package/dist/lib/commands.d.ts +22 -2
- package/dist/lib/commands.js +51 -11
- package/dist/lib/convert.d.ts +10 -1
- package/dist/lib/convert.js +9 -1
- package/dist/lib/daemon.d.ts +21 -1
- package/dist/lib/daemon.js +97 -4
- package/dist/lib/drive-sync.d.ts +18 -1
- package/dist/lib/drive-sync.js +57 -15
- package/dist/lib/exec.d.ts +25 -5
- package/dist/lib/exec.js +72 -27
- package/dist/lib/fs-walk.d.ts +2 -0
- package/dist/lib/fs-walk.js +40 -0
- package/dist/lib/fuzzy.d.ts +53 -0
- package/dist/lib/fuzzy.js +72 -0
- package/dist/lib/gemini-settings.d.ts +4 -0
- package/dist/lib/gemini-settings.js +33 -0
- package/dist/lib/git.d.ts +12 -2
- package/dist/lib/git.js +17 -6
- package/dist/lib/help.d.ts +20 -1
- package/dist/lib/help.js +45 -6
- package/dist/lib/hooks/match.d.ts +32 -0
- package/dist/lib/hooks/match.js +120 -0
- package/dist/lib/hooks.d.ts +17 -4
- package/dist/lib/hooks.js +191 -21
- package/dist/lib/manifest.d.ts +6 -1
- package/dist/lib/manifest.js +15 -4
- package/dist/lib/markdown.d.ts +0 -1
- package/dist/lib/markdown.js +6 -1
- package/dist/lib/mcp.d.ts +0 -1
- package/dist/lib/mcp.js +29 -33
- package/dist/lib/memory-compile.d.ts +13 -3
- package/dist/lib/memory-compile.js +31 -9
- package/dist/lib/memory.d.ts +14 -7
- package/dist/lib/memory.js +67 -38
- package/dist/lib/migrate.d.ts +8 -0
- package/dist/lib/migrate.js +85 -0
- package/dist/lib/models.d.ts +25 -11
- package/dist/lib/models.js +405 -16
- package/dist/lib/onepassword.d.ts +63 -0
- package/dist/lib/onepassword.js +186 -0
- package/dist/lib/paths.d.ts +8 -0
- package/dist/lib/paths.js +20 -0
- package/dist/lib/permissions.d.ts +24 -2
- package/dist/lib/permissions.js +117 -48
- package/dist/lib/picker.d.ts +10 -1
- package/dist/lib/picker.js +15 -1
- package/dist/lib/plugins.d.ts +7 -1
- package/dist/lib/plugins.js +10 -1
- package/dist/lib/profiles-presets.d.ts +24 -0
- package/dist/lib/profiles-presets.js +103 -0
- package/dist/lib/profiles.d.ts +69 -0
- package/dist/lib/profiles.js +144 -0
- package/dist/lib/pty-client.d.ts +1 -1
- package/dist/lib/pty-client.js +0 -1
- package/dist/lib/pty-server.d.ts +16 -2
- package/dist/lib/pty-server.js +92 -3
- package/dist/lib/registry.d.ts +23 -3
- package/dist/lib/registry.js +153 -8
- package/dist/lib/resources.d.ts +28 -1
- package/dist/lib/resources.js +79 -1
- package/dist/lib/rotate.d.ts +79 -0
- package/dist/lib/rotate.js +285 -0
- package/dist/lib/routines.d.ts +29 -1
- package/dist/lib/routines.js +32 -5
- package/dist/lib/runner.d.ts +14 -1
- package/dist/lib/runner.js +22 -3
- package/dist/lib/sandbox.d.ts +16 -1
- package/dist/lib/sandbox.js +39 -16
- package/dist/lib/scheduler.d.ts +8 -1
- package/dist/lib/scheduler.js +8 -1
- package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/secrets/bundles.d.ts +39 -0
- package/dist/lib/secrets/bundles.js +189 -0
- package/dist/lib/secrets/index.d.ts +55 -0
- package/dist/lib/secrets/index.js +211 -0
- package/dist/lib/secrets/profiles.d.ts +10 -0
- package/dist/lib/secrets/profiles.js +13 -0
- package/dist/lib/session/active.d.ts +43 -0
- package/dist/lib/session/active.js +392 -0
- package/dist/lib/session/artifacts.d.ts +16 -0
- package/dist/lib/session/artifacts.js +95 -0
- package/dist/lib/session/cloud.d.ts +30 -0
- package/dist/lib/session/cloud.js +121 -0
- package/dist/lib/session/db.d.ts +23 -2
- package/dist/lib/session/db.js +76 -12
- package/dist/lib/session/discover.d.ts +19 -4
- package/dist/lib/session/discover.js +344 -48
- package/dist/lib/session/parse.d.ts +28 -1
- package/dist/lib/session/parse.js +267 -9
- package/dist/lib/session/prompt.d.ts +9 -1
- package/dist/lib/session/prompt.js +17 -3
- package/dist/lib/session/render.d.ts +13 -1
- package/dist/lib/session/render.js +20 -1
- package/dist/lib/session/team-filter.d.ts +9 -1
- package/dist/lib/session/team-filter.js +11 -2
- package/dist/lib/session/types.d.ts +24 -2
- package/dist/lib/session/types.js +10 -2
- package/dist/lib/shims.d.ts +93 -5
- package/dist/lib/shims.js +380 -67
- package/dist/lib/skills.d.ts +27 -2
- package/dist/lib/skills.js +127 -65
- package/dist/lib/sqlite.d.ts +43 -0
- package/dist/lib/sqlite.js +94 -0
- package/dist/lib/state.d.ts +114 -22
- package/dist/lib/state.js +323 -138
- package/dist/lib/subagents.d.ts +9 -1
- package/dist/lib/subagents.js +70 -63
- package/dist/lib/sync-manifest.d.ts +81 -0
- package/dist/lib/sync-manifest.js +450 -0
- package/dist/lib/teams/agents.d.ts +103 -5
- package/dist/lib/teams/agents.js +414 -91
- package/dist/lib/teams/api.d.ts +26 -3
- package/dist/lib/teams/api.js +63 -3
- package/dist/lib/teams/debug.d.ts +6 -1
- package/dist/lib/teams/debug.js +6 -1
- package/dist/lib/teams/file_ops.d.ts +7 -1
- package/dist/lib/teams/file_ops.js +7 -1
- package/dist/lib/teams/index.d.ts +15 -0
- package/dist/lib/teams/index.js +14 -0
- package/dist/lib/teams/parsers.d.ts +4 -1
- package/dist/lib/teams/parsers.js +11 -1
- package/dist/lib/teams/persistence.d.ts +15 -1
- package/dist/lib/teams/persistence.js +102 -20
- package/dist/lib/teams/registry.d.ts +12 -1
- package/dist/lib/teams/registry.js +116 -33
- package/dist/lib/teams/summarizer.d.ts +15 -1
- package/dist/lib/teams/summarizer.js +14 -1
- package/dist/lib/teams/supervisor.d.ts +48 -0
- package/dist/lib/teams/supervisor.js +73 -0
- package/dist/lib/template.d.ts +8 -6
- package/dist/lib/template.js +8 -6
- package/dist/lib/types.d.ts +147 -8
- package/dist/lib/types.js +26 -3
- package/dist/lib/usage.d.ts +48 -1
- package/dist/lib/usage.js +97 -16
- package/dist/lib/version-duplicates.d.ts +21 -0
- package/dist/lib/version-duplicates.js +90 -0
- package/dist/lib/versions.d.ts +39 -4
- package/dist/lib/versions.js +401 -111
- package/package.json +33 -18
- package/scripts/postinstall.js +126 -30
- package/dist/commands/__tests__/sessions.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions.test.js +0 -636
- package/dist/commands/__tests__/sessions.test.js.map +0 -1
- package/dist/commands/commands.d.ts.map +0 -1
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -180
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
- package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.js +0 -192
- package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
- package/dist/lib/__tests__/exec.test.d.ts +0 -2
- package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
- package/dist/lib/__tests__/exec.test.js +0 -446
- package/dist/lib/__tests__/exec.test.js.map +0 -1
- package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
- package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
- package/dist/lib/__tests__/git-sync.test.js +0 -138
- package/dist/lib/__tests__/git-sync.test.js.map +0 -1
- package/dist/lib/__tests__/hooks.test.d.ts +0 -2
- package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
- package/dist/lib/__tests__/hooks.test.js +0 -203
- package/dist/lib/__tests__/hooks.test.js.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
- package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.js +0 -95
- package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
- package/dist/lib/__tests__/models.test.d.ts +0 -2
- package/dist/lib/__tests__/models.test.d.ts.map +0 -1
- package/dist/lib/__tests__/models.test.js +0 -184
- package/dist/lib/__tests__/models.test.js.map +0 -1
- package/dist/lib/__tests__/usage.test.d.ts +0 -2
- package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
- package/dist/lib/__tests__/usage.test.js +0 -218
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/factory.d.ts +0 -57
- package/dist/lib/factory.d.ts.map +0 -1
- package/dist/lib/factory.js +0 -110
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/session/__tests__/db.test.d.ts +0 -2
- package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/db.test.js +0 -54
- package/dist/lib/session/__tests__/db.test.js.map +0 -1
- package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
- package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/discover.test.js +0 -63
- package/dist/lib/session/__tests__/discover.test.js.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
- package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.js +0 -44
- package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
- package/dist/lib/session/__tests__/render.test.d.ts +0 -2
- package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/render.test.js +0 -602
- package/dist/lib/session/__tests__/render.test.js.map +0 -1
- package/dist/lib/session/db.d.ts.map +0 -1
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts.map +0 -1
- package/dist/lib/session/prompt.js.map +0 -1
- package/dist/lib/session/prompt.test.d.ts +0 -2
- package/dist/lib/session/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/prompt.test.js +0 -57
- package/dist/lib/session/prompt.test.js.map +0 -1
- package/dist/lib/session/render.d.ts.map +0 -1
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- package/dist/lib/session/team-filter.js.map +0 -1
- package/dist/lib/session/team-filter.test.d.ts +0 -2
- package/dist/lib/session/team-filter.test.d.ts.map +0 -1
- package/dist/lib/session/team-filter.test.js +0 -157
- package/dist/lib/session/team-filter.test.js.map +0 -1
- package/dist/lib/session/types.d.ts.map +0 -1
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts.map +0 -1
- package/dist/lib/teams/api.js.map +0 -1
- package/dist/lib/teams/cloud.d.ts +0 -11
- package/dist/lib/teams/cloud.d.ts.map +0 -1
- package/dist/lib/teams/cloud.js +0 -169
- package/dist/lib/teams/cloud.js.map +0 -1
- package/dist/lib/teams/debug.d.ts.map +0 -1
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- package/dist/lib/teams/persistence.js.map +0 -1
- package/dist/lib/teams/ralph.d.ts +0 -8
- package/dist/lib/teams/ralph.d.ts.map +0 -1
- package/dist/lib/teams/ralph.js +0 -59
- package/dist/lib/teams/ralph.js.map +0 -1
- package/dist/lib/teams/registry.d.ts.map +0 -1
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Version management commands for installing, switching, and removing agent CLIs.
|
|
3
|
+
*
|
|
4
|
+
* Implements `agents add`, `agents remove`, `agents use`, and the deprecated
|
|
5
|
+
* `agents list`. Handles npm-based installation, shim creation, config symlink
|
|
6
|
+
* switching, resource sync prompts, and project-level version pinning.
|
|
7
|
+
*/
|
|
1
8
|
import type { Command } from 'commander';
|
|
9
|
+
/** Register `agents add`, `agents remove`, `agents use`, and `agents list` (deprecated). */
|
|
2
10
|
export declare function registerVersionsCommands(program: Command): void;
|
|
3
|
-
//# sourceMappingURL=versions.d.ts.map
|
|
@@ -77,6 +77,7 @@ function warnIfShimShadowed(agent) {
|
|
|
77
77
|
console.log(chalk.gray(` Managed shim: ${getShimPath(agent)}`));
|
|
78
78
|
console.log(chalk.gray(` ${getPathSetupInstructions().split('\n').join('\n ')}`));
|
|
79
79
|
}
|
|
80
|
+
/** Register `agents add`, `agents remove`, `agents use`, and `agents list` (deprecated). */
|
|
80
81
|
export function registerVersionsCommands(program) {
|
|
81
82
|
program
|
|
82
83
|
.command('add <specs...>')
|
|
@@ -443,11 +444,11 @@ Important: This is the ONLY command that sets the default version. If you want a
|
|
|
443
444
|
.action(async (agentArg, versionArg, options) => {
|
|
444
445
|
try {
|
|
445
446
|
const skipPrompts = options.yes || !isInteractiveTerminal();
|
|
446
|
-
// Auto-pull ~/.agents if it's a git repo with remote (silent on success)
|
|
447
|
+
// Auto-pull ~/.agents-system if it's a git repo with remote (silent on success)
|
|
447
448
|
const agentsDir = getAgentsDir();
|
|
448
449
|
const pullResult = await tryAutoPull(agentsDir);
|
|
449
450
|
if (pullResult.pulled) {
|
|
450
|
-
console.log(chalk.gray('Synced ~/.agents from remote'));
|
|
451
|
+
console.log(chalk.gray('Synced ~/.agents-system from remote'));
|
|
451
452
|
}
|
|
452
453
|
// Support both "claude 2.0.65" and "claude@2.0.65" formats
|
|
453
454
|
let agent;
|
|
@@ -660,6 +661,7 @@ Important: This is the ONLY command that sets the default version. If you want a
|
|
|
660
661
|
throw err;
|
|
661
662
|
}
|
|
662
663
|
}
|
|
664
|
+
const previousDefault = getGlobalDefault(agentId);
|
|
663
665
|
// Set global default
|
|
664
666
|
setGlobalDefault(agentId, finalVersion);
|
|
665
667
|
// Regenerate shim so it uses the latest script format
|
|
@@ -697,4 +699,3 @@ Important: This is the ONLY command that sets the default version. If you want a
|
|
|
697
699
|
await viewAction(agentArg);
|
|
698
700
|
});
|
|
699
701
|
}
|
|
700
|
-
//# sourceMappingURL=versions.js.map
|
package/dist/commands/view.d.ts
CHANGED
|
@@ -1,8 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* View command for inspecting installed agents, versions, accounts, and resources.
|
|
3
|
+
*
|
|
4
|
+
* Implements `agents view` -- shows installed agent CLIs with version info,
|
|
5
|
+
* account emails, usage stats, and active status. When given an agent@version
|
|
6
|
+
* argument, displays a detailed breakdown of commands, skills, MCP servers,
|
|
7
|
+
* rules, hooks, and promptcuts synced to that version.
|
|
8
|
+
*/
|
|
1
9
|
import type { Command } from 'commander';
|
|
10
|
+
import type { AgentId } from '../lib/types.js';
|
|
11
|
+
/** Machine-readable entry for a single installed version. */
|
|
12
|
+
export interface ViewJsonVersion {
|
|
13
|
+
version: string;
|
|
14
|
+
isDefault: boolean;
|
|
15
|
+
signedIn: boolean;
|
|
16
|
+
email: string | null;
|
|
17
|
+
plan: string | null;
|
|
18
|
+
usageStatus: 'available' | 'rate_limited' | 'out_of_credits' | null;
|
|
19
|
+
windows: Array<{
|
|
20
|
+
key: 'session' | 'week' | 'sonnet_week';
|
|
21
|
+
usedPercent: number;
|
|
22
|
+
resetsAt: string | null;
|
|
23
|
+
}>;
|
|
24
|
+
lastActive: string | null;
|
|
25
|
+
path: string;
|
|
26
|
+
}
|
|
27
|
+
/** Machine-readable entry for one agent's installed versions. */
|
|
28
|
+
export interface ViewJsonAgent {
|
|
29
|
+
agent: AgentId;
|
|
30
|
+
versions: ViewJsonVersion[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Prune older installed versions that share an email with a newer installed
|
|
34
|
+
* version. Keeps the highest semver per email, skips the global default (with
|
|
35
|
+
* a warning so the user can switch first).
|
|
36
|
+
*
|
|
37
|
+
* When filterAgentId is set, prunes that agent first, then cascades: after
|
|
38
|
+
* each agent, offers the next agent with duplicates. User answering "no"
|
|
39
|
+
* stops the chain.
|
|
40
|
+
*/
|
|
41
|
+
export declare function pruneDuplicates(filterAgentId: AgentId | undefined, yes: boolean, dryRun: boolean): Promise<void>;
|
|
2
42
|
/**
|
|
3
43
|
* Main view action handler.
|
|
4
44
|
* Exported for use by deprecated aliases.
|
|
5
45
|
*/
|
|
6
|
-
export declare function viewAction(agentArg?: string
|
|
46
|
+
export declare function viewAction(agentArg?: string, options?: {
|
|
47
|
+
json?: boolean;
|
|
48
|
+
prune?: boolean;
|
|
49
|
+
yes?: boolean;
|
|
50
|
+
dryRun?: boolean;
|
|
51
|
+
}): Promise<void>;
|
|
52
|
+
/** Register the `agents view` command. */
|
|
7
53
|
export declare function registerViewCommand(program: Command): void;
|
|
8
|
-
//# sourceMappingURL=view.d.ts.map
|
package/dist/commands/view.js
CHANGED
|
@@ -2,16 +2,19 @@ import chalk from 'chalk';
|
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import * as path from 'path';
|
|
5
|
+
import * as yaml from 'yaml';
|
|
5
6
|
import { AGENTS, ALL_AGENT_IDS, getAllCliStates, getAccountInfo, resolveAgentName, formatAgentError, agentLabel, colorAgent, } from '../lib/agents.js';
|
|
6
7
|
import { formatUsageSection, formatUsageSummary, getUsageInfoForIdentity, getUsageInfoByIdentity, getUsageLookupKey, } from '../lib/usage.js';
|
|
7
8
|
import { readManifest } from '../lib/manifest.js';
|
|
8
|
-
import { listInstalledVersions, getGlobalDefault, getVersionHomePath, getVersionDir, getAvailableResources, getActuallySyncedResources, getNewResources, hasNewResources, promptNewResourceSelection, syncResourcesToVersion, } from '../lib/versions.js';
|
|
9
|
-
import { getShimsDir, isShimsInPath, } from '../lib/shims.js';
|
|
9
|
+
import { listInstalledVersions, getGlobalDefault, getVersionHomePath, getVersionDir, resolveVersionAlias, getAvailableResources, getActuallySyncedResources, getNewResources, hasNewResources, promptNewResourceSelection, syncResourcesToVersion, removeVersion, } from '../lib/versions.js';
|
|
10
|
+
import { getShimsDir, isShimsInPath, ensureVersionedAliasCurrent, removeShim, } from '../lib/shims.js';
|
|
10
11
|
import { getAgentResources } from '../lib/resources.js';
|
|
11
|
-
import { getAgentsDir } from '../lib/state.js';
|
|
12
|
+
import { getAgentsDir, getUserAgentsDir, getPromptcutsPath } from '../lib/state.js';
|
|
12
13
|
import { isGitRepo, getGitSyncStatus } from '../lib/git.js';
|
|
13
14
|
import { getCentralMemoryFileName } from '../lib/memory.js';
|
|
14
|
-
import {
|
|
15
|
+
import { getConfiguredRunStrategy } from '../lib/rotate.js';
|
|
16
|
+
import { confirm } from '@inquirer/prompts';
|
|
17
|
+
import { formatPath, isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
15
18
|
function formatLastActive(date) {
|
|
16
19
|
if (!date)
|
|
17
20
|
return '';
|
|
@@ -70,6 +73,25 @@ async function showInstalledVersions(filterAgentId) {
|
|
|
70
73
|
spinner.stop();
|
|
71
74
|
const agentsToShow = filterAgentId ? [filterAgentId] : ALL_AGENT_IDS;
|
|
72
75
|
const showPaths = !!filterAgentId;
|
|
76
|
+
// Auto-heal stale versioned aliases. Pre-v2 aliases (e.g. pre-CLAUDE_CONFIG_DIR
|
|
77
|
+
// claude shims) silently route login through the default version's symlinked
|
|
78
|
+
// home, so `agents view` would never reflect the right account. Regenerate on
|
|
79
|
+
// sight — it's safe, idempotent, and fixes the symptom exactly where the user
|
|
80
|
+
// notices it.
|
|
81
|
+
// Yield between agents so the heal loop doesn't block the event loop as one
|
|
82
|
+
// long sync burst — per-version readFileSync+writeFileSync across 5 agents
|
|
83
|
+
// can otherwise stall spinners and stdout flushes.
|
|
84
|
+
const healedAliases = [];
|
|
85
|
+
for (const agentId of agentsToShow) {
|
|
86
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
87
|
+
for (const version of listInstalledVersions(agentId)) {
|
|
88
|
+
const status = ensureVersionedAliasCurrent(agentId, version);
|
|
89
|
+
if (status === 'updated' || status === 'created') {
|
|
90
|
+
healedAliases.push(`${agentId}@${version}`);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// Shim healing is silent — users don't need to know about internal repairs
|
|
73
95
|
console.log(chalk.bold('Installed Agent CLIs\n'));
|
|
74
96
|
// Pre-fetch account info for all versions in parallel
|
|
75
97
|
const infoFetches = [];
|
|
@@ -187,8 +209,10 @@ async function showInstalledVersions(filterAgentId) {
|
|
|
187
209
|
const agent = AGENTS[agentId];
|
|
188
210
|
const versions = listInstalledVersions(agentId);
|
|
189
211
|
const globalDefault = getGlobalDefault(agentId);
|
|
212
|
+
const runStrategy = getConfiguredRunStrategy(agentId);
|
|
213
|
+
const strategyLabel = chalk.gray(` (${runStrategy})`);
|
|
190
214
|
const noDefaultLabel = !globalDefault ? chalk.yellow(' (no default)') : '';
|
|
191
|
-
console.log(` ${chalk.bold(agentLabel(agentId))}${noDefaultLabel}`);
|
|
215
|
+
console.log(` ${chalk.bold(agentLabel(agentId))}${strategyLabel}${noDefaultLabel}`);
|
|
192
216
|
// Sort versions with default first, then by semver descending
|
|
193
217
|
const sortedVersions = [...versions].sort((a, b) => {
|
|
194
218
|
if (a === globalDefault)
|
|
@@ -380,11 +404,12 @@ async function showAgentResources(agentId, requestedVersion) {
|
|
|
380
404
|
}
|
|
381
405
|
const home = getVersionHomePath(agentId, version);
|
|
382
406
|
// Get git sync status if ~/.agents/ is a git repo
|
|
383
|
-
const
|
|
384
|
-
const
|
|
385
|
-
const
|
|
386
|
-
const
|
|
387
|
-
const
|
|
407
|
+
const userAgentsDir = getUserAgentsDir();
|
|
408
|
+
const hasGitRepo = isGitRepo(userAgentsDir);
|
|
409
|
+
const commandsSync = hasGitRepo ? await getGitSyncStatus(userAgentsDir, 'commands') : null;
|
|
410
|
+
const skillsSync = hasGitRepo ? await getGitSyncStatus(userAgentsDir, 'skills') : null;
|
|
411
|
+
const hooksSync = hasGitRepo ? await getGitSyncStatus(userAgentsDir, 'hooks') : null;
|
|
412
|
+
const memorySync = hasGitRepo ? await getGitSyncStatus(userAgentsDir, 'rules') : null;
|
|
388
413
|
// Helper to determine sync state for a resource
|
|
389
414
|
const getSyncState = (resourceName, resourceType, syncStatus) => {
|
|
390
415
|
if (!syncStatus)
|
|
@@ -400,9 +425,9 @@ async function showAgentResources(agentId, requestedVersion) {
|
|
|
400
425
|
relativePath = `hooks/${resourceName}`;
|
|
401
426
|
}
|
|
402
427
|
else {
|
|
403
|
-
//
|
|
428
|
+
// Rules files: map agent-specific name (CLAUDE.md) back to canonical (AGENTS.md)
|
|
404
429
|
const centralName = getCentralMemoryFileName(agentId);
|
|
405
|
-
relativePath = `
|
|
430
|
+
relativePath = `rules/${centralName}`;
|
|
406
431
|
}
|
|
407
432
|
const matchesPath = (f) => f === relativePath || f.startsWith(relativePath + '/');
|
|
408
433
|
const isNew = syncStatus.new.some(matchesPath);
|
|
@@ -477,13 +502,35 @@ async function showAgentResources(agentId, requestedVersion) {
|
|
|
477
502
|
let display = nameColor(r.name);
|
|
478
503
|
if (r.ruleCount !== undefined)
|
|
479
504
|
display += chalk.gray(` (${r.ruleCount} rules)`);
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
505
|
+
// Source annotation: project overrides user, user overrides system
|
|
506
|
+
const sourceTag = r.scope === 'project' ? chalk.blue('[project]')
|
|
507
|
+
: r.scope === 'user' ? chalk.cyan('[user]')
|
|
508
|
+
: chalk.gray('[system]');
|
|
509
|
+
display += ` ${sourceTag}`;
|
|
483
510
|
const pathStr = r.path ? chalk.gray(formatPath(r.path, cwd)) : '';
|
|
484
511
|
const syncStr = r.syncState ? chalk.gray(` [${r.syncState}]`) : '';
|
|
485
|
-
console.log(` ${display.padEnd(
|
|
512
|
+
console.log(` ${display.padEnd(38)} ${pathStr}${syncStr}`);
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
// Render the single ~/.agents/promptcuts.yaml (cross-agent, not per-version).
|
|
516
|
+
// Reads the file to surface the shortcut count — cheap (<1KB typical).
|
|
517
|
+
function renderPromptcuts() {
|
|
518
|
+
console.log(chalk.bold(`\nPromptcuts\n`));
|
|
519
|
+
const promptcutsPath = getPromptcutsPath();
|
|
520
|
+
if (!fs.existsSync(promptcutsPath)) {
|
|
521
|
+
console.log(` ${chalk.gray('none')}`);
|
|
522
|
+
return;
|
|
486
523
|
}
|
|
524
|
+
let count = 0;
|
|
525
|
+
try {
|
|
526
|
+
const parsed = yaml.parse(fs.readFileSync(promptcutsPath, 'utf-8'));
|
|
527
|
+
count = parsed?.shortcuts ? Object.keys(parsed.shortcuts).length : 0;
|
|
528
|
+
}
|
|
529
|
+
catch {
|
|
530
|
+
count = 0;
|
|
531
|
+
}
|
|
532
|
+
const label = `${count} shortcut${count === 1 ? '' : 's'}`;
|
|
533
|
+
console.log(` ${chalk.green(label).padEnd(24)} ${chalk.gray(formatPath(promptcutsPath, cwd))}`);
|
|
487
534
|
}
|
|
488
535
|
// 1. Agent CLI info
|
|
489
536
|
console.log(chalk.bold('Agent CLIs\n'));
|
|
@@ -520,18 +567,267 @@ async function showAgentResources(agentId, requestedVersion) {
|
|
|
520
567
|
renderSection('MCP Servers', agentData.mcp);
|
|
521
568
|
renderSection('Rules', agentData.memory);
|
|
522
569
|
renderSection('Hooks', agentData.hooks);
|
|
570
|
+
renderPromptcuts();
|
|
523
571
|
// Show legend at the end if git repo exists
|
|
524
572
|
if (hasGitRepo) {
|
|
525
573
|
console.log();
|
|
526
574
|
console.log(chalk.gray('Legend:'), chalk.green('Tracked'), chalk.blue('Local-only'), chalk.yellow('Modified'), chalk.red('Deleted'));
|
|
527
575
|
}
|
|
528
576
|
}
|
|
577
|
+
/**
|
|
578
|
+
* Collect structured info for one or more agents without rendering to the
|
|
579
|
+
* terminal. Used by `--json` output and any programmatic consumer (e.g. the
|
|
580
|
+
* agents-cli extension's "resume current session in best available version"
|
|
581
|
+
* command).
|
|
582
|
+
*/
|
|
583
|
+
async function collectAgentsJson(filterAgentId) {
|
|
584
|
+
const agentsToShow = filterAgentId ? [filterAgentId] : ALL_AGENT_IDS;
|
|
585
|
+
const infoFetches = [];
|
|
586
|
+
for (const agentId of agentsToShow) {
|
|
587
|
+
for (const ver of listInstalledVersions(agentId)) {
|
|
588
|
+
const home = getVersionHomePath(agentId, ver);
|
|
589
|
+
infoFetches.push(getAccountInfo(agentId, home).then((info) => ({ agentId, version: ver, home, info })));
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
const infoResults = await Promise.all(infoFetches);
|
|
593
|
+
const { canonicalByUsageKey, usageByKey } = await getUsageInfoByIdentity(infoResults.map(({ agentId, home, version, info }) => ({
|
|
594
|
+
agentId,
|
|
595
|
+
home,
|
|
596
|
+
cliVersion: version,
|
|
597
|
+
info,
|
|
598
|
+
})));
|
|
599
|
+
const mergeCanonical = (info) => {
|
|
600
|
+
const key = getUsageLookupKey(info);
|
|
601
|
+
if (!key)
|
|
602
|
+
return info;
|
|
603
|
+
const canon = canonicalByUsageKey.get(key);
|
|
604
|
+
if (!canon)
|
|
605
|
+
return info;
|
|
606
|
+
return {
|
|
607
|
+
...info,
|
|
608
|
+
plan: canon.plan,
|
|
609
|
+
usageStatus: canon.usageStatus,
|
|
610
|
+
overageCredits: canon.overageCredits,
|
|
611
|
+
};
|
|
612
|
+
};
|
|
613
|
+
const byAgent = new Map();
|
|
614
|
+
for (const { agentId, version, info: rawInfo } of infoResults) {
|
|
615
|
+
const info = mergeCanonical(rawInfo);
|
|
616
|
+
const globalDefault = getGlobalDefault(agentId);
|
|
617
|
+
const usageKey = getUsageLookupKey(info);
|
|
618
|
+
const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
|
|
619
|
+
const snapshot = usageInfo?.snapshot ?? null;
|
|
620
|
+
const entry = {
|
|
621
|
+
version,
|
|
622
|
+
isDefault: version === globalDefault,
|
|
623
|
+
signedIn: !!info.email,
|
|
624
|
+
email: info.email,
|
|
625
|
+
plan: info.plan,
|
|
626
|
+
usageStatus: info.usageStatus,
|
|
627
|
+
windows: snapshot
|
|
628
|
+
? snapshot.windows.map((w) => ({
|
|
629
|
+
key: w.key,
|
|
630
|
+
usedPercent: w.usedPercent,
|
|
631
|
+
resetsAt: w.resetsAt ? w.resetsAt.toISOString() : null,
|
|
632
|
+
}))
|
|
633
|
+
: [],
|
|
634
|
+
lastActive: info.lastActive ? info.lastActive.toISOString() : null,
|
|
635
|
+
path: getVersionDir(agentId, version),
|
|
636
|
+
};
|
|
637
|
+
const existing = byAgent.get(agentId);
|
|
638
|
+
if (existing)
|
|
639
|
+
existing.push(entry);
|
|
640
|
+
else
|
|
641
|
+
byAgent.set(agentId, [entry]);
|
|
642
|
+
}
|
|
643
|
+
const out = [];
|
|
644
|
+
for (const agentId of agentsToShow) {
|
|
645
|
+
const versions = byAgent.get(agentId) ?? [];
|
|
646
|
+
versions.sort((a, b) => {
|
|
647
|
+
if (a.isDefault !== b.isDefault)
|
|
648
|
+
return a.isDefault ? -1 : 1;
|
|
649
|
+
return compareVersions(b.version, a.version);
|
|
650
|
+
});
|
|
651
|
+
out.push({ agent: agentId, versions });
|
|
652
|
+
}
|
|
653
|
+
return out;
|
|
654
|
+
}
|
|
655
|
+
async function buildAgentPrunePlan(agentId) {
|
|
656
|
+
const entries = await Promise.all(listInstalledVersions(agentId).map(async (version) => {
|
|
657
|
+
const home = getVersionHomePath(agentId, version);
|
|
658
|
+
const info = await getAccountInfo(agentId, home);
|
|
659
|
+
return { version, info };
|
|
660
|
+
}));
|
|
661
|
+
const globalDefault = getGlobalDefault(agentId);
|
|
662
|
+
const byEmail = new Map();
|
|
663
|
+
for (const e of entries) {
|
|
664
|
+
if (!e.info.email)
|
|
665
|
+
continue;
|
|
666
|
+
const key = e.info.email.toLowerCase();
|
|
667
|
+
const list = byEmail.get(key) ?? [];
|
|
668
|
+
list.push(e);
|
|
669
|
+
byEmail.set(key, list);
|
|
670
|
+
}
|
|
671
|
+
const toPrune = [];
|
|
672
|
+
const skippedDefaults = [];
|
|
673
|
+
for (const [, group] of byEmail) {
|
|
674
|
+
if (group.length < 2)
|
|
675
|
+
continue;
|
|
676
|
+
const sorted = [...group].sort((a, b) => compareVersions(b.version, a.version));
|
|
677
|
+
const keeper = sorted[0].version;
|
|
678
|
+
for (const older of sorted.slice(1)) {
|
|
679
|
+
const plan = {
|
|
680
|
+
agentId,
|
|
681
|
+
version: older.version,
|
|
682
|
+
email: older.info.email,
|
|
683
|
+
keeper,
|
|
684
|
+
isDefault: older.version === globalDefault,
|
|
685
|
+
};
|
|
686
|
+
if (plan.isDefault)
|
|
687
|
+
skippedDefaults.push(plan);
|
|
688
|
+
else
|
|
689
|
+
toPrune.push(plan);
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
return { agentId, toPrune, skippedDefaults };
|
|
693
|
+
}
|
|
694
|
+
async function executePrunePlan(plan) {
|
|
695
|
+
let removed = 0;
|
|
696
|
+
for (const p of plan.toPrune) {
|
|
697
|
+
console.log(chalk.gray(`Removing ${agentLabel(p.agentId)}@${p.version}...`));
|
|
698
|
+
const ok = removeVersion(p.agentId, p.version);
|
|
699
|
+
if (ok) {
|
|
700
|
+
console.log(chalk.green(`Removed ${agentLabel(p.agentId)}@${p.version}`));
|
|
701
|
+
removed++;
|
|
702
|
+
}
|
|
703
|
+
else {
|
|
704
|
+
console.log(chalk.yellow(`Already gone: ${agentLabel(p.agentId)}@${p.version}`));
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
if (listInstalledVersions(plan.agentId).length === 0) {
|
|
708
|
+
removeShim(plan.agentId);
|
|
709
|
+
}
|
|
710
|
+
return removed;
|
|
711
|
+
}
|
|
712
|
+
function printPrunePlan(plan, isFirst) {
|
|
713
|
+
if (plan.skippedDefaults.length > 0) {
|
|
714
|
+
console.log(chalk.yellow(`Skipping default versions for ${agentLabel(plan.agentId)} (switch default first):`));
|
|
715
|
+
for (const s of plan.skippedDefaults) {
|
|
716
|
+
console.log(` ${agentLabel(s.agentId)}@${s.version} ${chalk.cyan(s.email)} ` +
|
|
717
|
+
chalk.gray(`— duplicate of ${s.agentId}@${s.keeper}. Run: agents use ${s.agentId}@${s.keeper}`));
|
|
718
|
+
}
|
|
719
|
+
console.log();
|
|
720
|
+
}
|
|
721
|
+
if (plan.toPrune.length === 0)
|
|
722
|
+
return;
|
|
723
|
+
const heading = isFirst ? `Will prune ${agentLabel(plan.agentId)}:` : `Also found duplicates for ${agentLabel(plan.agentId)}:`;
|
|
724
|
+
console.log(chalk.bold(heading));
|
|
725
|
+
for (const p of plan.toPrune) {
|
|
726
|
+
console.log(` ${agentLabel(p.agentId)}@${p.version} ${chalk.cyan(p.email)} ` +
|
|
727
|
+
chalk.gray(`— keeping ${p.agentId}@${p.keeper}`));
|
|
728
|
+
}
|
|
729
|
+
console.log();
|
|
730
|
+
}
|
|
731
|
+
/**
|
|
732
|
+
* Prune older installed versions that share an email with a newer installed
|
|
733
|
+
* version. Keeps the highest semver per email, skips the global default (with
|
|
734
|
+
* a warning so the user can switch first).
|
|
735
|
+
*
|
|
736
|
+
* When filterAgentId is set, prunes that agent first, then cascades: after
|
|
737
|
+
* each agent, offers the next agent with duplicates. User answering "no"
|
|
738
|
+
* stops the chain.
|
|
739
|
+
*/
|
|
740
|
+
export async function pruneDuplicates(filterAgentId, yes, dryRun) {
|
|
741
|
+
const ordered = filterAgentId
|
|
742
|
+
? [filterAgentId, ...ALL_AGENT_IDS.filter((a) => a !== filterAgentId)]
|
|
743
|
+
: [...ALL_AGENT_IDS];
|
|
744
|
+
const spinner = ora({ text: 'Scanning installed versions...', isSilent: !process.stdout.isTTY }).start();
|
|
745
|
+
const plans = await Promise.all(ordered.map((a) => buildAgentPrunePlan(a)));
|
|
746
|
+
spinner.stop();
|
|
747
|
+
const actionable = plans.filter((p) => p.toPrune.length > 0 || p.skippedDefaults.length > 0);
|
|
748
|
+
if (actionable.length === 0) {
|
|
749
|
+
console.log(chalk.gray('Nothing to prune — no older versions share an account with a newer version.'));
|
|
750
|
+
return;
|
|
751
|
+
}
|
|
752
|
+
const totalCandidates = actionable.reduce((n, plan) => n + plan.toPrune.length, 0);
|
|
753
|
+
let totalRemoved = 0;
|
|
754
|
+
let isFirst = true;
|
|
755
|
+
let processedAny = false;
|
|
756
|
+
for (const plan of actionable) {
|
|
757
|
+
printPrunePlan(plan, isFirst);
|
|
758
|
+
if (plan.toPrune.length === 0) {
|
|
759
|
+
// Only skippedDefaults for this agent; move on.
|
|
760
|
+
isFirst = false;
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
if (dryRun) {
|
|
764
|
+
processedAny = true;
|
|
765
|
+
isFirst = false;
|
|
766
|
+
continue;
|
|
767
|
+
}
|
|
768
|
+
if (!yes) {
|
|
769
|
+
if (!isInteractiveTerminal()) {
|
|
770
|
+
console.log(chalk.red('Refusing to prune in a non-interactive shell without --yes.'));
|
|
771
|
+
if (filterAgentId) {
|
|
772
|
+
console.log(chalk.gray(`Re-run with: agents prune ${filterAgentId} --dry-run`));
|
|
773
|
+
}
|
|
774
|
+
else {
|
|
775
|
+
console.log(chalk.gray('Re-run with: agents prune --dry-run'));
|
|
776
|
+
}
|
|
777
|
+
process.exit(1);
|
|
778
|
+
}
|
|
779
|
+
const n = plan.toPrune.length;
|
|
780
|
+
const message = isFirst
|
|
781
|
+
? `Prune ${n} ${agentLabel(plan.agentId)} version${n === 1 ? '' : 's'}?`
|
|
782
|
+
: `Also prune ${n} ${agentLabel(plan.agentId)} version${n === 1 ? '' : 's'}?`;
|
|
783
|
+
let proceed = false;
|
|
784
|
+
try {
|
|
785
|
+
proceed = await confirm({ message, default: false });
|
|
786
|
+
}
|
|
787
|
+
catch (err) {
|
|
788
|
+
if (isPromptCancelled(err)) {
|
|
789
|
+
console.log(chalk.gray('Cancelled'));
|
|
790
|
+
break;
|
|
791
|
+
}
|
|
792
|
+
throw err;
|
|
793
|
+
}
|
|
794
|
+
if (!proceed) {
|
|
795
|
+
console.log(chalk.gray('Stopping here.'));
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
totalRemoved += await executePrunePlan(plan);
|
|
800
|
+
processedAny = true;
|
|
801
|
+
isFirst = false;
|
|
802
|
+
console.log();
|
|
803
|
+
}
|
|
804
|
+
if (dryRun) {
|
|
805
|
+
console.log(chalk.gray(`${totalCandidates} version${totalCandidates === 1 ? '' : 's'} would be pruned. Run without --dry-run to delete.`));
|
|
806
|
+
return;
|
|
807
|
+
}
|
|
808
|
+
if (processedAny) {
|
|
809
|
+
console.log(chalk.bold(`Pruned ${totalRemoved} version${totalRemoved === 1 ? '' : 's'}.`));
|
|
810
|
+
}
|
|
811
|
+
}
|
|
529
812
|
/**
|
|
530
813
|
* Main view action handler.
|
|
531
814
|
* Exported for use by deprecated aliases.
|
|
532
815
|
*/
|
|
533
|
-
export async function viewAction(agentArg) {
|
|
816
|
+
export async function viewAction(agentArg, options) {
|
|
817
|
+
const json = options?.json === true;
|
|
818
|
+
const prune = options?.prune === true;
|
|
819
|
+
const yes = options?.yes === true;
|
|
820
|
+
const dryRun = options?.dryRun === true;
|
|
534
821
|
if (!agentArg) {
|
|
822
|
+
if (prune) {
|
|
823
|
+
await pruneDuplicates(undefined, yes, dryRun);
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (json) {
|
|
827
|
+
const data = await collectAgentsJson();
|
|
828
|
+
console.log(JSON.stringify(data, null, 2));
|
|
829
|
+
return;
|
|
830
|
+
}
|
|
535
831
|
// No argument: show all installed versions
|
|
536
832
|
await showInstalledVersions();
|
|
537
833
|
return;
|
|
@@ -539,12 +835,32 @@ export async function viewAction(agentArg) {
|
|
|
539
835
|
// Parse agent@version syntax
|
|
540
836
|
const parts = agentArg.split('@');
|
|
541
837
|
const agentName = parts[0];
|
|
542
|
-
const requestedVersion = parts[1] || null;
|
|
543
838
|
const agentId = resolveAgentName(agentName);
|
|
544
839
|
if (!agentId) {
|
|
840
|
+
if (json) {
|
|
841
|
+
console.log(JSON.stringify({ error: formatAgentError(agentName) }));
|
|
842
|
+
process.exit(1);
|
|
843
|
+
}
|
|
545
844
|
console.log(chalk.red(formatAgentError(agentName)));
|
|
546
845
|
process.exit(1);
|
|
547
846
|
}
|
|
847
|
+
const requestedVersion = resolveVersionAlias(agentId, parts[1]) ?? null;
|
|
848
|
+
if (prune) {
|
|
849
|
+
if (requestedVersion) {
|
|
850
|
+
console.log(chalk.red('--prune does not take a @version suffix.'));
|
|
851
|
+
console.log(chalk.gray(`Run: agents view ${agentId} --prune`));
|
|
852
|
+
process.exit(1);
|
|
853
|
+
}
|
|
854
|
+
await pruneDuplicates(agentId, yes, dryRun);
|
|
855
|
+
return;
|
|
856
|
+
}
|
|
857
|
+
if (json) {
|
|
858
|
+
// --json ignores the @version suffix (detailed resource view is not yet
|
|
859
|
+
// exposed as structured data). Emit the version list for the agent.
|
|
860
|
+
const data = await collectAgentsJson(agentId);
|
|
861
|
+
console.log(JSON.stringify(data[0] ?? { agent: agentId, versions: [] }, null, 2));
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
548
864
|
if (requestedVersion) {
|
|
549
865
|
// Specific version requested: show detailed resources
|
|
550
866
|
await showAgentResources(agentId, requestedVersion);
|
|
@@ -554,10 +870,15 @@ export async function viewAction(agentArg) {
|
|
|
554
870
|
await showInstalledVersions(agentId);
|
|
555
871
|
}
|
|
556
872
|
}
|
|
873
|
+
/** Register the `agents view` command. */
|
|
557
874
|
export function registerViewCommand(program) {
|
|
558
875
|
program
|
|
559
876
|
.command('view [agent]')
|
|
560
877
|
.description('Show what agent CLIs are installed and which versions you have. Inspect resources when you pass agent@version.')
|
|
878
|
+
.option('--json', 'Emit machine-readable JSON (version list, usage, signed-in status).')
|
|
879
|
+
.option('--prune', 'Remove older installed versions that share an account with a newer installed version. Skips the global default.')
|
|
880
|
+
.option('--dry-run', 'With --prune, show duplicate versions without deleting')
|
|
881
|
+
.option('-y, --yes', 'Skip the prune confirmation prompt.')
|
|
561
882
|
.addHelpText('after', `
|
|
562
883
|
Examples:
|
|
563
884
|
# Show all installed agents with versions, accounts, and usage
|
|
@@ -570,17 +891,29 @@ Examples:
|
|
|
570
891
|
agents view claude@2.1.112
|
|
571
892
|
agents view claude@default
|
|
572
893
|
|
|
894
|
+
# Machine-readable output (used by tools that pick a version programmatically)
|
|
895
|
+
agents view claude --json
|
|
896
|
+
|
|
897
|
+
# Prune older versions that duplicate an account already used by a newer version
|
|
898
|
+
agents view --prune --dry-run
|
|
899
|
+
agents view claude --prune
|
|
900
|
+
agents view claude --prune -y
|
|
901
|
+
|
|
573
902
|
When to use:
|
|
574
903
|
- Checking which agents are installed and what their default versions are
|
|
575
904
|
- Seeing which account each version is logged into (useful for multi-account setups)
|
|
576
905
|
- Inspecting commands, skills, hooks, and MCP servers synced to a version
|
|
577
906
|
- Verifying a version is installed before running it
|
|
907
|
+
- Cleaning up stale versions left behind after upgrading (--prune)
|
|
578
908
|
|
|
579
909
|
Output:
|
|
580
910
|
- Without arguments: table of all agents with versions, emails, usage stats
|
|
581
911
|
- With agent name: versions for that agent, showing which is the default
|
|
582
912
|
- With agent@version: detailed breakdown of resources synced to that version
|
|
913
|
+
- With --json: structured JSON with version, isDefault, signedIn, email, plan,
|
|
914
|
+
usageStatus, per-window usedPercent, lastActive, and path
|
|
915
|
+
- With --prune: plan of which older versions will be removed, then confirm
|
|
916
|
+
- With --prune --dry-run: preview only, no deletions
|
|
583
917
|
`)
|
|
584
|
-
.action(viewAction);
|
|
918
|
+
.action((agentArg, options) => viewAction(agentArg, options));
|
|
585
919
|
}
|
|
586
|
-
//# sourceMappingURL=view.js.map
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env -S node --no-warnings=ExperimentalWarning
|
|
2
|
+
/**
|
|
3
|
+
* CLI entry point for agents-cli.
|
|
4
|
+
*
|
|
5
|
+
* Registers all commands, handles update checks, auto-corrects typos,
|
|
6
|
+
* and launches the first-run interactive init when appropriate.
|
|
7
|
+
*/
|
|
2
8
|
export {};
|
|
3
|
-
//# sourceMappingURL=index.d.ts.map
|