@swarmify/agents-cli 1.13.4 → 1.14.0
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/README.md +2 -319
- package/bin/agents.js +2 -0
- package/package.json +13 -79
- package/scripts/postinstall.js +4 -71
- package/CHANGELOG.md +0 -316
- package/LICENSE +0 -21
- package/dist/commands/__tests__/sessions-tail.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions-tail.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions-tail.test.js +0 -108
- package/dist/commands/__tests__/sessions-tail.test.js.map +0 -1
- 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/cloud.d.ts +0 -11
- package/dist/commands/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.js +0 -363
- package/dist/commands/cloud.js.map +0 -1
- package/dist/commands/commands.d.ts +0 -12
- package/dist/commands/commands.d.ts.map +0 -1
- package/dist/commands/commands.js +0 -629
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -11
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js +0 -119
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts +0 -11
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js +0 -175
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts +0 -11
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js +0 -251
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/factory.d.ts +0 -11
- package/dist/commands/factory.d.ts.map +0 -1
- package/dist/commands/factory.js +0 -445
- package/dist/commands/factory.js.map +0 -1
- package/dist/commands/fork.d.ts +0 -11
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js +0 -147
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts +0 -12
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js +0 -690
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts +0 -15
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -137
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -12
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js +0 -583
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts +0 -11
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js +0 -170
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts +0 -11
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js +0 -551
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts +0 -12
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js +0 -724
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts +0 -11
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js +0 -393
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/profiles.d.ts +0 -12
- package/dist/commands/profiles.d.ts.map +0 -1
- package/dist/commands/profiles.js +0 -255
- package/dist/commands/profiles.js.map +0 -1
- package/dist/commands/pty.d.ts +0 -21
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js +0 -391
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -11
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -456
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -11
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -188
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts +0 -16
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js +0 -52
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts +0 -39
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js +0 -197
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts +0 -11
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js +0 -590
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts +0 -12
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js +0 -489
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/secrets.d.ts +0 -11
- package/dist/commands/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.js +0 -352
- package/dist/commands/secrets.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts +0 -18
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js +0 -265
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions-tail.d.ts +0 -20
- package/dist/commands/sessions-tail.d.ts.map +0 -1
- package/dist/commands/sessions-tail.js +0 -236
- package/dist/commands/sessions-tail.js.map +0 -1
- package/dist/commands/sessions.d.ts +0 -18
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js +0 -1173
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts +0 -12
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js +0 -717
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts +0 -10
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -26
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts +0 -11
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js +0 -361
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts +0 -11
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js +0 -70
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts +0 -18
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js +0 -290
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts +0 -18
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js +0 -1144
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts +0 -45
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js +0 -106
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts +0 -11
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js +0 -701
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts +0 -43
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js +0 -894
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -496
- 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 -239
- package/dist/lib/__tests__/models.test.js.map +0 -1
- package/dist/lib/__tests__/rotate.test.d.ts +0 -2
- package/dist/lib/__tests__/rotate.test.d.ts.map +0 -1
- package/dist/lib/__tests__/rotate.test.js +0 -80
- package/dist/lib/__tests__/rotate.test.js.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets-bundles.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets-bundles.test.js +0 -104
- package/dist/lib/__tests__/secrets-bundles.test.js.map +0 -1
- package/dist/lib/__tests__/secrets.test.d.ts +0 -2
- package/dist/lib/__tests__/secrets.test.d.ts.map +0 -1
- package/dist/lib/__tests__/secrets.test.js +0 -90
- package/dist/lib/__tests__/secrets.test.js.map +0 -1
- package/dist/lib/__tests__/shims.test.d.ts +0 -2
- package/dist/lib/__tests__/shims.test.d.ts.map +0 -1
- package/dist/lib/__tests__/shims.test.js +0 -57
- package/dist/lib/__tests__/shims.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 -220
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/__tests__/versions.test.d.ts +0 -2
- package/dist/lib/__tests__/versions.test.d.ts.map +0 -1
- package/dist/lib/__tests__/versions.test.js +0 -63
- package/dist/lib/__tests__/versions.test.js.map +0 -1
- package/dist/lib/agents.d.ts +0 -158
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js +0 -1159
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts +0 -27
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js +0 -58
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/cloud/codex.d.ts +0 -26
- package/dist/lib/cloud/codex.d.ts.map +0 -1
- package/dist/lib/cloud/codex.js +0 -237
- package/dist/lib/cloud/codex.js.map +0 -1
- package/dist/lib/cloud/factory.d.ts +0 -32
- package/dist/lib/cloud/factory.d.ts.map +0 -1
- package/dist/lib/cloud/factory.js +0 -43
- package/dist/lib/cloud/factory.js.map +0 -1
- package/dist/lib/cloud/registry.d.ts +0 -16
- package/dist/lib/cloud/registry.d.ts.map +0 -1
- package/dist/lib/cloud/registry.js +0 -68
- package/dist/lib/cloud/registry.js.map +0 -1
- package/dist/lib/cloud/rush.d.ts +0 -37
- package/dist/lib/cloud/rush.d.ts.map +0 -1
- package/dist/lib/cloud/rush.js +0 -230
- package/dist/lib/cloud/rush.js.map +0 -1
- package/dist/lib/cloud/rush.test.d.ts +0 -2
- package/dist/lib/cloud/rush.test.d.ts.map +0 -1
- package/dist/lib/cloud/rush.test.js +0 -63
- package/dist/lib/cloud/rush.test.js.map +0 -1
- package/dist/lib/cloud/store.d.ts +0 -23
- package/dist/lib/cloud/store.d.ts.map +0 -1
- package/dist/lib/cloud/store.js +0 -116
- package/dist/lib/cloud/store.js.map +0 -1
- package/dist/lib/cloud/stream.d.ts +0 -24
- package/dist/lib/cloud/stream.d.ts.map +0 -1
- package/dist/lib/cloud/stream.js +0 -145
- package/dist/lib/cloud/stream.js.map +0 -1
- package/dist/lib/cloud/types.d.ts +0 -109
- package/dist/lib/cloud/types.d.ts.map +0 -1
- package/dist/lib/cloud/types.js +0 -33
- package/dist/lib/cloud/types.js.map +0 -1
- package/dist/lib/cloud/types.test.d.ts +0 -2
- package/dist/lib/cloud/types.test.d.ts.map +0 -1
- package/dist/lib/cloud/types.test.js +0 -41
- package/dist/lib/cloud/types.test.js.map +0 -1
- package/dist/lib/commands.d.ts +0 -141
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js +0 -514
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts +0 -21
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js +0 -54
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts +0 -43
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js +0 -332
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts +0 -46
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js +0 -209
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts +0 -101
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js +0 -450
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/factory/__tests__/config.test.d.ts +0 -2
- package/dist/lib/factory/__tests__/config.test.d.ts.map +0 -1
- package/dist/lib/factory/__tests__/config.test.js +0 -128
- package/dist/lib/factory/__tests__/config.test.js.map +0 -1
- package/dist/lib/factory/config.d.ts +0 -49
- package/dist/lib/factory/config.d.ts.map +0 -1
- package/dist/lib/factory/config.js +0 -127
- package/dist/lib/factory/config.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 -107
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts +0 -157
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js +0 -647
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts +0 -10
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js +0 -66
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts +0 -125
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js +0 -846
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/local.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/local.test.js +0 -177
- package/dist/lib/ledger/__tests__/local.test.js.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.d.ts +0 -2
- package/dist/lib/ledger/__tests__/sync.test.d.ts.map +0 -1
- package/dist/lib/ledger/__tests__/sync.test.js +0 -117
- package/dist/lib/ledger/__tests__/sync.test.js.map +0 -1
- package/dist/lib/ledger/index.d.ts +0 -18
- package/dist/lib/ledger/index.d.ts.map +0 -1
- package/dist/lib/ledger/index.js +0 -32
- package/dist/lib/ledger/index.js.map +0 -1
- package/dist/lib/ledger/local.d.ts +0 -22
- package/dist/lib/ledger/local.d.ts.map +0 -1
- package/dist/lib/ledger/local.js +0 -333
- package/dist/lib/ledger/local.js.map +0 -1
- package/dist/lib/ledger/r2.d.ts +0 -41
- package/dist/lib/ledger/r2.d.ts.map +0 -1
- package/dist/lib/ledger/r2.js +0 -335
- package/dist/lib/ledger/r2.js.map +0 -1
- package/dist/lib/ledger/sync.d.ts +0 -33
- package/dist/lib/ledger/sync.d.ts.map +0 -1
- package/dist/lib/ledger/sync.js +0 -106
- package/dist/lib/ledger/sync.js.map +0 -1
- package/dist/lib/ledger/types.d.ts +0 -100
- package/dist/lib/ledger/types.d.ts.map +0 -1
- package/dist/lib/ledger/types.js +0 -21
- package/dist/lib/ledger/types.js.map +0 -1
- package/dist/lib/manifest.d.ts +0 -14
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js +0 -48
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts +0 -5
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js +0 -17
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts +0 -64
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js +0 -327
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts +0 -65
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js +0 -174
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts +0 -64
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js +0 -275
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts +0 -98
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js +0 -728
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts +0 -227
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js +0 -1085
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts +0 -27
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js +0 -110
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts +0 -80
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js +0 -556
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/profiles-keychain.d.ts +0 -11
- package/dist/lib/profiles-keychain.d.ts.map +0 -1
- package/dist/lib/profiles-keychain.js +0 -14
- package/dist/lib/profiles-keychain.js.map +0 -1
- package/dist/lib/profiles-presets.d.ts +0 -25
- package/dist/lib/profiles-presets.d.ts.map +0 -1
- package/dist/lib/profiles-presets.js +0 -104
- package/dist/lib/profiles-presets.js.map +0 -1
- package/dist/lib/profiles.d.ts +0 -70
- package/dist/lib/profiles.d.ts.map +0 -1
- package/dist/lib/profiles.js +0 -145
- package/dist/lib/profiles.js.map +0 -1
- package/dist/lib/pty-client.d.ts +0 -23
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js +0 -181
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts +0 -21
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js +0 -427
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts +0 -45
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js +0 -220
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts +0 -55
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js +0 -103
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/rotate.d.ts +0 -58
- package/dist/lib/rotate.d.ts.map +0 -1
- package/dist/lib/rotate.js +0 -93
- package/dist/lib/rotate.js.map +0 -1
- package/dist/lib/routines.d.ts +0 -99
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js +0 -352
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts +0 -26
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js +0 -325
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts +0 -26
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js +0 -218
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts +0 -26
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js +0 -77
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/secrets-bundles.d.ts +0 -38
- package/dist/lib/secrets-bundles.d.ts.map +0 -1
- package/dist/lib/secrets-bundles.js +0 -176
- package/dist/lib/secrets-bundles.js.map +0 -1
- package/dist/lib/secrets.d.ts +0 -53
- package/dist/lib/secrets.d.ts.map +0 -1
- package/dist/lib/secrets.js +0 -140
- package/dist/lib/secrets.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/active.d.ts +0 -44
- package/dist/lib/session/active.d.ts.map +0 -1
- package/dist/lib/session/active.js +0 -379
- package/dist/lib/session/active.js.map +0 -1
- package/dist/lib/session/artifacts.d.ts +0 -15
- package/dist/lib/session/artifacts.d.ts.map +0 -1
- package/dist/lib/session/artifacts.js +0 -86
- package/dist/lib/session/artifacts.js.map +0 -1
- package/dist/lib/session/db.d.ts +0 -140
- package/dist/lib/session/db.d.ts.map +0 -1
- package/dist/lib/session/db.js +0 -599
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts +0 -72
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js +0 -1315
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts +0 -34
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js +0 -663
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts +0 -13
- package/dist/lib/session/prompt.d.ts.map +0 -1
- package/dist/lib/session/prompt.js +0 -79
- 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 +0 -103
- package/dist/lib/session/render.d.ts.map +0 -1
- package/dist/lib/session/render.js +0 -798
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts +0 -35
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- package/dist/lib/session/team-filter.js +0 -75
- 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 +0 -84
- package/dist/lib/session/types.d.ts.map +0 -1
- package/dist/lib/session/types.js +0 -11
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts +0 -272
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js +0 -1322
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts +0 -142
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js +0 -791
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts +0 -87
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js +0 -333
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts +0 -84
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js +0 -410
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/oracle.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/oracle.test.js +0 -89
- package/dist/lib/teams/__tests__/oracle.test.js.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.d.ts +0 -2
- package/dist/lib/teams/__tests__/supervisor.test.d.ts.map +0 -1
- package/dist/lib/teams/__tests__/supervisor.test.js +0 -179
- package/dist/lib/teams/__tests__/supervisor.test.js.map +0 -1
- package/dist/lib/teams/agents.d.ts +0 -247
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js +0 -1244
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts +0 -91
- package/dist/lib/teams/api.d.ts.map +0 -1
- package/dist/lib/teams/api.js +0 -239
- 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 +0 -8
- package/dist/lib/teams/debug.d.ts.map +0 -1
- package/dist/lib/teams/debug.js +0 -12
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts +0 -13
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js +0 -66
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/index.d.ts +0 -16
- package/dist/lib/teams/index.d.ts.map +0 -1
- package/dist/lib/teams/index.js +0 -15
- package/dist/lib/teams/index.js.map +0 -1
- package/dist/lib/teams/oracle.d.ts +0 -20
- package/dist/lib/teams/oracle.d.ts.map +0 -1
- package/dist/lib/teams/oracle.js +0 -59
- package/dist/lib/teams/oracle.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts +0 -9
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js +0 -837
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts +0 -43
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- package/dist/lib/teams/persistence.js +0 -299
- 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 +0 -18
- package/dist/lib/teams/registry.d.ts.map +0 -1
- package/dist/lib/teams/registry.js +0 -68
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts +0 -73
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js +0 -780
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/teams/supervisor.d.ts +0 -49
- package/dist/lib/teams/supervisor.d.ts.map +0 -1
- package/dist/lib/teams/supervisor.js +0 -74
- package/dist/lib/teams/supervisor.js.map +0 -1
- package/dist/lib/template.d.ts +0 -27
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js +0 -60
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts +0 -331
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js +0 -29
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts +0 -105
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js +0 -686
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts +0 -253
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js +0 -1796
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
package/dist/commands/view.js
DELETED
|
@@ -1,894 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import ora from 'ora';
|
|
3
|
-
import * as fs from 'fs';
|
|
4
|
-
import * as path from 'path';
|
|
5
|
-
import * as yaml from 'yaml';
|
|
6
|
-
import { AGENTS, ALL_AGENT_IDS, getAllCliStates, getAccountInfo, resolveAgentName, formatAgentError, agentLabel, colorAgent, } from '../lib/agents.js';
|
|
7
|
-
import { formatUsageSection, formatUsageSummary, getUsageInfoForIdentity, getUsageInfoByIdentity, getUsageLookupKey, } from '../lib/usage.js';
|
|
8
|
-
import { readManifest } from '../lib/manifest.js';
|
|
9
|
-
import { listInstalledVersions, getGlobalDefault, getVersionHomePath, getVersionDir, getAvailableResources, getActuallySyncedResources, getNewResources, hasNewResources, promptNewResourceSelection, syncResourcesToVersion, removeVersion, } from '../lib/versions.js';
|
|
10
|
-
import { getShimsDir, isShimsInPath, ensureVersionedAliasCurrent, removeShim, } from '../lib/shims.js';
|
|
11
|
-
import { getAgentResources } from '../lib/resources.js';
|
|
12
|
-
import { getAgentsDir, getPromptcutsPath } from '../lib/state.js';
|
|
13
|
-
import { isGitRepo, getGitSyncStatus } from '../lib/git.js';
|
|
14
|
-
import { getCentralMemoryFileName } from '../lib/memory.js';
|
|
15
|
-
import { confirm } from '@inquirer/prompts';
|
|
16
|
-
import { formatPath, isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
17
|
-
function formatLastActive(date) {
|
|
18
|
-
if (!date)
|
|
19
|
-
return '';
|
|
20
|
-
const now = Date.now();
|
|
21
|
-
const diff = now - date.getTime();
|
|
22
|
-
const mins = Math.floor(diff / 60000);
|
|
23
|
-
const hours = Math.floor(diff / 3600000);
|
|
24
|
-
const days = Math.floor(diff / 86400000);
|
|
25
|
-
if (mins < 1)
|
|
26
|
-
return chalk.green('just now');
|
|
27
|
-
if (mins < 60)
|
|
28
|
-
return chalk.green(`${mins}m ago`);
|
|
29
|
-
if (hours < 24)
|
|
30
|
-
return chalk.white(`${hours}h ago`);
|
|
31
|
-
if (days < 7)
|
|
32
|
-
return chalk.gray(`${days}d ago`);
|
|
33
|
-
return chalk.gray(`${days}d ago`);
|
|
34
|
-
}
|
|
35
|
-
function visibleWidth(s) {
|
|
36
|
-
return s.replace(/\u001b\[[0-9;]*m/g, '').length;
|
|
37
|
-
}
|
|
38
|
-
function compareVersions(a, b) {
|
|
39
|
-
const partsA = a.split('.').map(Number);
|
|
40
|
-
const partsB = b.split('.').map(Number);
|
|
41
|
-
for (let i = 0; i < 3; i++) {
|
|
42
|
-
if (partsA[i] > partsB[i])
|
|
43
|
-
return 1;
|
|
44
|
-
if (partsA[i] < partsB[i])
|
|
45
|
-
return -1;
|
|
46
|
-
}
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
function getProjectVersionFromCwd(agent) {
|
|
50
|
-
const manifestPath = path.join(process.cwd(), '.agents', 'agents.yaml');
|
|
51
|
-
if (!fs.existsSync(manifestPath)) {
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
|
-
try {
|
|
55
|
-
const manifest = readManifest(process.cwd());
|
|
56
|
-
return manifest?.agents?.[agent] || null;
|
|
57
|
-
}
|
|
58
|
-
catch {
|
|
59
|
-
return null;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Show installed versions for one or all agents.
|
|
64
|
-
* Called when: `agents view` or `agents view claude`
|
|
65
|
-
*/
|
|
66
|
-
async function showInstalledVersions(filterAgentId) {
|
|
67
|
-
const spinnerText = filterAgentId
|
|
68
|
-
? `Checking ${agentLabel(filterAgentId)} agents...`
|
|
69
|
-
: 'Checking installed agents...';
|
|
70
|
-
const spinner = ora({ text: spinnerText, isSilent: !process.stdout.isTTY }).start();
|
|
71
|
-
const cliStates = await getAllCliStates();
|
|
72
|
-
spinner.stop();
|
|
73
|
-
const agentsToShow = filterAgentId ? [filterAgentId] : ALL_AGENT_IDS;
|
|
74
|
-
const showPaths = !!filterAgentId;
|
|
75
|
-
// Auto-heal stale versioned aliases. Pre-v2 aliases (e.g. pre-CLAUDE_CONFIG_DIR
|
|
76
|
-
// claude shims) silently route login through the default version's symlinked
|
|
77
|
-
// home, so `agents view` would never reflect the right account. Regenerate on
|
|
78
|
-
// sight — it's safe, idempotent, and fixes the symptom exactly where the user
|
|
79
|
-
// notices it.
|
|
80
|
-
const healedAliases = [];
|
|
81
|
-
for (const agentId of agentsToShow) {
|
|
82
|
-
for (const version of listInstalledVersions(agentId)) {
|
|
83
|
-
const status = ensureVersionedAliasCurrent(agentId, version);
|
|
84
|
-
if (status === 'updated' || status === 'created') {
|
|
85
|
-
healedAliases.push(`${agentId}@${version}`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
if (healedAliases.length > 0) {
|
|
90
|
-
console.log(chalk.gray(`Refreshed stale shims: ${healedAliases.join(', ')}`));
|
|
91
|
-
console.log();
|
|
92
|
-
}
|
|
93
|
-
console.log(chalk.bold('Installed Agent CLIs\n'));
|
|
94
|
-
// Pre-fetch account info for all versions in parallel
|
|
95
|
-
const infoFetches = [];
|
|
96
|
-
const globalInfoFetches = [];
|
|
97
|
-
for (const agentId of agentsToShow) {
|
|
98
|
-
const versions = listInstalledVersions(agentId);
|
|
99
|
-
if (versions.length > 0) {
|
|
100
|
-
for (const ver of versions) {
|
|
101
|
-
const home = getVersionHomePath(agentId, ver);
|
|
102
|
-
infoFetches.push(getAccountInfo(agentId, home).then((info) => ({
|
|
103
|
-
agentId,
|
|
104
|
-
version: ver,
|
|
105
|
-
home,
|
|
106
|
-
info,
|
|
107
|
-
})));
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
else {
|
|
111
|
-
globalInfoFetches.push(getAccountInfo(agentId).then((info) => ({
|
|
112
|
-
agentId,
|
|
113
|
-
cliVersion: cliStates[agentId]?.version || null,
|
|
114
|
-
info,
|
|
115
|
-
})));
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
const infoResults = await Promise.all(infoFetches);
|
|
119
|
-
const globalInfoResults = await Promise.all(globalInfoFetches);
|
|
120
|
-
// Build lookup: agentId:version -> AccountInfo
|
|
121
|
-
const infoMap = new Map();
|
|
122
|
-
for (const { agentId, version, info } of infoResults) {
|
|
123
|
-
infoMap.set(`${agentId}:${version}`, info);
|
|
124
|
-
}
|
|
125
|
-
const globalInfoMap = new Map();
|
|
126
|
-
for (const { agentId, info } of globalInfoResults) {
|
|
127
|
-
globalInfoMap.set(agentId, info);
|
|
128
|
-
}
|
|
129
|
-
// Usage status, plan, and overage credits belong to the same underlying account
|
|
130
|
-
// or org scope, not a specific installed version. Version homes cache those
|
|
131
|
-
// values independently, so older installs can show stale values. Reuse the
|
|
132
|
-
// freshest cache entry per stable usage identity and keep lastActive per version.
|
|
133
|
-
const { canonicalByUsageKey, usageByKey } = await getUsageInfoByIdentity([
|
|
134
|
-
...infoResults.map(({ agentId, home, version, info }) => ({
|
|
135
|
-
agentId,
|
|
136
|
-
home,
|
|
137
|
-
cliVersion: version,
|
|
138
|
-
info,
|
|
139
|
-
})),
|
|
140
|
-
...globalInfoResults.map(({ agentId, cliVersion, info }) => ({
|
|
141
|
-
agentId,
|
|
142
|
-
cliVersion,
|
|
143
|
-
info,
|
|
144
|
-
})),
|
|
145
|
-
]);
|
|
146
|
-
const mergeCanonical = (info) => {
|
|
147
|
-
const key = getUsageLookupKey(info);
|
|
148
|
-
if (!key)
|
|
149
|
-
return info;
|
|
150
|
-
const canon = canonicalByUsageKey.get(key);
|
|
151
|
-
if (!canon)
|
|
152
|
-
return info;
|
|
153
|
-
return {
|
|
154
|
-
...info,
|
|
155
|
-
plan: canon.plan,
|
|
156
|
-
usageStatus: canon.usageStatus,
|
|
157
|
-
overageCredits: canon.overageCredits,
|
|
158
|
-
};
|
|
159
|
-
};
|
|
160
|
-
// Separate version-managed from globally-installed agents
|
|
161
|
-
const versionManaged = [];
|
|
162
|
-
const globallyInstalled = [];
|
|
163
|
-
for (const agentId of agentsToShow) {
|
|
164
|
-
const versions = listInstalledVersions(agentId);
|
|
165
|
-
const cliState = cliStates[agentId];
|
|
166
|
-
if (versions.length > 0) {
|
|
167
|
-
versionManaged.push(agentId);
|
|
168
|
-
}
|
|
169
|
-
else if (cliState?.installed) {
|
|
170
|
-
globallyInstalled.push(agentId);
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
// Show version-managed agents
|
|
174
|
-
if (versionManaged.length > 0) {
|
|
175
|
-
// Calculate column widths across all agents for alignment
|
|
176
|
-
let maxVerLabel = 0;
|
|
177
|
-
let maxEmail = 0;
|
|
178
|
-
let maxPlanWidth = 3;
|
|
179
|
-
let maxUsageWidth = 0;
|
|
180
|
-
for (const agentId of versionManaged) {
|
|
181
|
-
const versions = listInstalledVersions(agentId);
|
|
182
|
-
const globalDefault = getGlobalDefault(agentId);
|
|
183
|
-
for (const v of versions) {
|
|
184
|
-
const label = v === globalDefault ? `${v} (default)` : v;
|
|
185
|
-
maxVerLabel = Math.max(maxVerLabel, label.length);
|
|
186
|
-
const rawInfo = infoMap.get(`${agentId}:${v}`);
|
|
187
|
-
const info = rawInfo ? mergeCanonical(rawInfo) : undefined;
|
|
188
|
-
if (info?.email)
|
|
189
|
-
maxEmail = Math.max(maxEmail, info.email.length);
|
|
190
|
-
if (info?.plan)
|
|
191
|
-
maxPlanWidth = Math.max(maxPlanWidth, info.plan.length);
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
// Second pass: compute max visible usage width (now that maxPlanWidth is settled)
|
|
195
|
-
for (const agentId of versionManaged) {
|
|
196
|
-
const versions = listInstalledVersions(agentId);
|
|
197
|
-
for (const v of versions) {
|
|
198
|
-
const rawInfo = infoMap.get(`${agentId}:${v}`);
|
|
199
|
-
const info = rawInfo ? mergeCanonical(rawInfo) : undefined;
|
|
200
|
-
const usageKey = getUsageLookupKey(info);
|
|
201
|
-
const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
|
|
202
|
-
const usageStr = formatUsageSummary(info?.plan || null, usageInfo?.snapshot || null, maxPlanWidth);
|
|
203
|
-
maxUsageWidth = Math.max(maxUsageWidth, visibleWidth(usageStr));
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
for (const agentId of versionManaged) {
|
|
207
|
-
const agent = AGENTS[agentId];
|
|
208
|
-
const versions = listInstalledVersions(agentId);
|
|
209
|
-
const globalDefault = getGlobalDefault(agentId);
|
|
210
|
-
const noDefaultLabel = !globalDefault ? chalk.yellow(' (no default)') : '';
|
|
211
|
-
console.log(` ${chalk.bold(agentLabel(agentId))}${noDefaultLabel}`);
|
|
212
|
-
// Sort versions with default first, then by semver descending
|
|
213
|
-
const sortedVersions = [...versions].sort((a, b) => {
|
|
214
|
-
if (a === globalDefault)
|
|
215
|
-
return -1;
|
|
216
|
-
if (b === globalDefault)
|
|
217
|
-
return 1;
|
|
218
|
-
return compareVersions(b, a);
|
|
219
|
-
});
|
|
220
|
-
for (const version of sortedVersions) {
|
|
221
|
-
const isDefault = version === globalDefault;
|
|
222
|
-
const base = isDefault ? `${version} (default)` : version;
|
|
223
|
-
const padded = base.padEnd(maxVerLabel);
|
|
224
|
-
const label = isDefault ? `${version}${chalk.green(' (default)')}${' '.repeat(maxVerLabel - base.length)}` : padded;
|
|
225
|
-
const rawInfo = infoMap.get(`${agentId}:${version}`);
|
|
226
|
-
const vInfo = rawInfo ? mergeCanonical(rawInfo) : undefined;
|
|
227
|
-
const usageKey = getUsageLookupKey(vInfo);
|
|
228
|
-
const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
|
|
229
|
-
// Build columns, trimming trailing whitespace when columns are empty
|
|
230
|
-
const parts = [` ${label}`];
|
|
231
|
-
const hasEmail = !!vInfo?.email;
|
|
232
|
-
const usageStr = formatUsageSummary(vInfo?.plan || null, usageInfo?.snapshot || null, maxPlanWidth);
|
|
233
|
-
const hasUsage = usageStr.length > 0;
|
|
234
|
-
// Only show lastActive for versions with an actual logged-in account.
|
|
235
|
-
// Otherwise it reflects install time (misleading "just now" for fresh installs).
|
|
236
|
-
const activeStr = vInfo && hasEmail ? formatLastActive(vInfo.lastActive) : '';
|
|
237
|
-
const hasActive = activeStr.length > 0;
|
|
238
|
-
if (!hasEmail && !hasUsage) {
|
|
239
|
-
// Installed but never signed in
|
|
240
|
-
parts.push(chalk.gray('(not signed in — run ' + agent.cliCommand + ' to log in)'));
|
|
241
|
-
}
|
|
242
|
-
else {
|
|
243
|
-
if (hasEmail || hasUsage || hasActive) {
|
|
244
|
-
const emailCol = (vInfo?.email || '').padEnd(maxEmail);
|
|
245
|
-
parts.push(hasEmail ? chalk.cyan(emailCol) : ' '.repeat(maxEmail));
|
|
246
|
-
}
|
|
247
|
-
if (hasUsage || hasActive) {
|
|
248
|
-
const usagePad = ' '.repeat(Math.max(0, maxUsageWidth - visibleWidth(usageStr)));
|
|
249
|
-
parts.push(usageStr + usagePad);
|
|
250
|
-
}
|
|
251
|
-
if (hasActive)
|
|
252
|
-
parts.push(activeStr);
|
|
253
|
-
}
|
|
254
|
-
console.log(parts.join(' '));
|
|
255
|
-
if (showPaths) {
|
|
256
|
-
const versionDir = getVersionDir(agentId, version);
|
|
257
|
-
console.log(chalk.gray(` ${versionDir}`));
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
// Check for project override
|
|
261
|
-
const projectVersion = getProjectVersionFromCwd(agentId);
|
|
262
|
-
if (projectVersion && projectVersion !== globalDefault) {
|
|
263
|
-
console.log(chalk.cyan(` -> ${projectVersion} (project)`));
|
|
264
|
-
}
|
|
265
|
-
console.log();
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
// Show globally installed (not managed) agents
|
|
269
|
-
if (globallyInstalled.length > 0) {
|
|
270
|
-
console.log(chalk.bold('Not Managed by Agents CLI\n'));
|
|
271
|
-
// Calculate max version label width for alignment
|
|
272
|
-
const globalMaxVerLabel = Math.max(...globallyInstalled.map((agentId) => {
|
|
273
|
-
const cliState = cliStates[agentId];
|
|
274
|
-
return `${cliState?.version || 'installed'} (global)`.length;
|
|
275
|
-
}));
|
|
276
|
-
for (const agentId of globallyInstalled) {
|
|
277
|
-
const agent = AGENTS[agentId];
|
|
278
|
-
const cliState = cliStates[agentId];
|
|
279
|
-
console.log(` ${chalk.bold(agentLabel(agentId))}`);
|
|
280
|
-
const gInfoRaw = globalInfoMap.get(agentId);
|
|
281
|
-
const gInfo = gInfoRaw ? mergeCanonical(gInfoRaw) : undefined;
|
|
282
|
-
const verLabel = `${cliState?.version || 'installed'} ${chalk.gray('(global)')}`;
|
|
283
|
-
const verLabelLen = `${cliState?.version || 'installed'} (global)`.length;
|
|
284
|
-
const padding = ' '.repeat(Math.max(0, globalMaxVerLabel - verLabelLen));
|
|
285
|
-
const parts = [` ${verLabel}${padding}`];
|
|
286
|
-
const gUsageKey = getUsageLookupKey(gInfo);
|
|
287
|
-
const gUsage = gUsageKey ? usageByKey.get(gUsageKey) : undefined;
|
|
288
|
-
const gUsageStr = formatUsageSummary(gInfo?.plan || null, gUsage?.snapshot || null);
|
|
289
|
-
const gActiveStr = gInfo ? formatLastActive(gInfo.lastActive) : '';
|
|
290
|
-
if (gInfo?.email || gUsageStr || gActiveStr)
|
|
291
|
-
parts.push(gInfo?.email ? chalk.cyan(gInfo.email) : '');
|
|
292
|
-
if (gUsageStr || gActiveStr)
|
|
293
|
-
parts.push(gUsageStr);
|
|
294
|
-
if (gActiveStr)
|
|
295
|
-
parts.push(gActiveStr);
|
|
296
|
-
console.log(parts.join(' '));
|
|
297
|
-
if (showPaths && cliState?.path) {
|
|
298
|
-
console.log(chalk.gray(` ${cliState.path}`));
|
|
299
|
-
}
|
|
300
|
-
if (agent.npmPackage && cliState?.version) {
|
|
301
|
-
console.log(chalk.gray(` Manage: agents add ${agentId}@${cliState.version} -y`));
|
|
302
|
-
}
|
|
303
|
-
console.log();
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
// If filtering to a specific agent and not found
|
|
307
|
-
if (filterAgentId && versionManaged.length === 0 && globallyInstalled.length === 0) {
|
|
308
|
-
console.log(` ${chalk.bold(agentLabel(filterAgentId))}: ${chalk.gray('not installed')}`);
|
|
309
|
-
console.log();
|
|
310
|
-
}
|
|
311
|
-
// No agents installed at all
|
|
312
|
-
if (versionManaged.length === 0 && globallyInstalled.length === 0 && !filterAgentId) {
|
|
313
|
-
console.log(chalk.gray(' No agent CLIs installed.'));
|
|
314
|
-
console.log(chalk.gray(' Run: agents add claude@latest'));
|
|
315
|
-
console.log();
|
|
316
|
-
}
|
|
317
|
-
// Show shims path status at the end (only for full list with managed versions)
|
|
318
|
-
if (versionManaged.length > 0 && !filterAgentId) {
|
|
319
|
-
const shimsDir = getShimsDir();
|
|
320
|
-
if (isShimsInPath()) {
|
|
321
|
-
console.log(chalk.gray(`Shims: ${shimsDir} (in PATH)`));
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
console.log(chalk.yellow(`Shims: ${shimsDir} (not in PATH)`));
|
|
325
|
-
console.log(chalk.gray('Add to PATH for automatic version switching'));
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
// Check for new resources when viewing a specific agent
|
|
329
|
-
if (filterAgentId && versionManaged.length > 0) {
|
|
330
|
-
const defaultVersion = getGlobalDefault(filterAgentId);
|
|
331
|
-
if (defaultVersion) {
|
|
332
|
-
const available = getAvailableResources();
|
|
333
|
-
const synced = getActuallySyncedResources(filterAgentId, defaultVersion);
|
|
334
|
-
const newResources = getNewResources(available, synced);
|
|
335
|
-
if (hasNewResources(newResources, filterAgentId)) {
|
|
336
|
-
try {
|
|
337
|
-
const selection = await promptNewResourceSelection(filterAgentId, newResources);
|
|
338
|
-
if (selection && Object.keys(selection).length > 0) {
|
|
339
|
-
const result = syncResourcesToVersion(filterAgentId, defaultVersion, selection);
|
|
340
|
-
const synced = [];
|
|
341
|
-
if (result.commands)
|
|
342
|
-
synced.push('commands');
|
|
343
|
-
if (result.skills)
|
|
344
|
-
synced.push('skills');
|
|
345
|
-
if (result.hooks)
|
|
346
|
-
synced.push('hooks');
|
|
347
|
-
if (result.memory.length > 0)
|
|
348
|
-
synced.push('memory');
|
|
349
|
-
if (result.permissions)
|
|
350
|
-
synced.push('permissions');
|
|
351
|
-
if (result.mcp.length > 0)
|
|
352
|
-
synced.push('mcp');
|
|
353
|
-
if (result.plugins.length > 0)
|
|
354
|
-
synced.push('plugins');
|
|
355
|
-
if (synced.length > 0) {
|
|
356
|
-
console.log(chalk.green(`\nSynced to ${agentLabel(filterAgentId)}@${defaultVersion}: ${synced.join(', ')}`));
|
|
357
|
-
}
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
catch (err) {
|
|
361
|
-
if (isPromptCancelled(err))
|
|
362
|
-
return;
|
|
363
|
-
throw err;
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
/**
|
|
370
|
-
* Show detailed resources for a specific agent version.
|
|
371
|
-
* Called when: `agents view claude@2.0.65` or `agents view claude@default`
|
|
372
|
-
*/
|
|
373
|
-
async function showAgentResources(agentId, requestedVersion) {
|
|
374
|
-
const spinner = ora({ text: 'Loading...', isSilent: !process.stdout.isTTY }).start();
|
|
375
|
-
const cwd = process.cwd();
|
|
376
|
-
const agentsDir = getAgentsDir();
|
|
377
|
-
const cliStates = await getAllCliStates();
|
|
378
|
-
// Resolve 'default' to actual version
|
|
379
|
-
let version = null;
|
|
380
|
-
if (requestedVersion === 'default') {
|
|
381
|
-
version = getGlobalDefault(agentId);
|
|
382
|
-
if (!version) {
|
|
383
|
-
spinner.stop();
|
|
384
|
-
console.log(chalk.yellow(`No default version set for ${agentLabel(agentId)}`));
|
|
385
|
-
console.log(chalk.gray(`Run: agents use ${agentId}@<version>`));
|
|
386
|
-
return;
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
else {
|
|
390
|
-
const versions = listInstalledVersions(agentId);
|
|
391
|
-
if (versions.includes(requestedVersion)) {
|
|
392
|
-
version = requestedVersion;
|
|
393
|
-
}
|
|
394
|
-
else {
|
|
395
|
-
spinner.stop();
|
|
396
|
-
console.log(chalk.red(`Version ${requestedVersion} not installed for ${agentLabel(agentId)}`));
|
|
397
|
-
console.log(chalk.gray(`Installed versions: ${versions.join(', ') || 'none'}`));
|
|
398
|
-
return;
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
const home = getVersionHomePath(agentId, version);
|
|
402
|
-
// Get git sync status if ~/.agents/ is a git repo
|
|
403
|
-
const hasGitRepo = isGitRepo(agentsDir);
|
|
404
|
-
const commandsSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'commands') : null;
|
|
405
|
-
const skillsSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'skills') : null;
|
|
406
|
-
const hooksSync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'hooks') : null;
|
|
407
|
-
const memorySync = hasGitRepo ? await getGitSyncStatus(agentsDir, 'memory') : null;
|
|
408
|
-
// Helper to determine sync state for a resource
|
|
409
|
-
const getSyncState = (resourceName, resourceType, syncStatus) => {
|
|
410
|
-
if (!syncStatus)
|
|
411
|
-
return undefined;
|
|
412
|
-
let relativePath;
|
|
413
|
-
if (resourceType === 'commands') {
|
|
414
|
-
relativePath = `commands/${resourceName}.md`;
|
|
415
|
-
}
|
|
416
|
-
else if (resourceType === 'skills') {
|
|
417
|
-
relativePath = `skills/${resourceName}`;
|
|
418
|
-
}
|
|
419
|
-
else if (resourceType === 'hooks') {
|
|
420
|
-
relativePath = `hooks/${resourceName}`;
|
|
421
|
-
}
|
|
422
|
-
else {
|
|
423
|
-
// Memory files: map agent-specific name (CLAUDE.md) back to canonical (AGENTS.md)
|
|
424
|
-
const centralName = getCentralMemoryFileName(agentId);
|
|
425
|
-
relativePath = `memory/${centralName}`;
|
|
426
|
-
}
|
|
427
|
-
const matchesPath = (f) => f === relativePath || f.startsWith(relativePath + '/');
|
|
428
|
-
const isNew = syncStatus.new.some(matchesPath);
|
|
429
|
-
const isStaged = syncStatus.staged.some(matchesPath);
|
|
430
|
-
const isModified = syncStatus.modified.some(matchesPath);
|
|
431
|
-
const isDeleted = syncStatus.deleted.some(matchesPath);
|
|
432
|
-
const isSynced = syncStatus.synced.some(matchesPath);
|
|
433
|
-
if (isNew || isStaged) {
|
|
434
|
-
return 'new';
|
|
435
|
-
}
|
|
436
|
-
if (isModified) {
|
|
437
|
-
return 'modified';
|
|
438
|
-
}
|
|
439
|
-
if (isDeleted) {
|
|
440
|
-
return 'deleted';
|
|
441
|
-
}
|
|
442
|
-
if (isSynced) {
|
|
443
|
-
return 'synced';
|
|
444
|
-
}
|
|
445
|
-
// Not in any array = local-only (untracked with no files)
|
|
446
|
-
return 'new';
|
|
447
|
-
};
|
|
448
|
-
const resources = getAgentResources(agentId, {
|
|
449
|
-
cwd,
|
|
450
|
-
scope: 'all',
|
|
451
|
-
cliInstalled: cliStates[agentId]?.installed ?? false,
|
|
452
|
-
home,
|
|
453
|
-
});
|
|
454
|
-
const agentData = {
|
|
455
|
-
agentId,
|
|
456
|
-
agentName: agentLabel(agentId),
|
|
457
|
-
version,
|
|
458
|
-
commands: resources.commands.map(r => ({
|
|
459
|
-
...r,
|
|
460
|
-
syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'commands', commandsSync),
|
|
461
|
-
})),
|
|
462
|
-
skills: resources.skills.map(r => ({
|
|
463
|
-
...r,
|
|
464
|
-
syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'skills', skillsSync),
|
|
465
|
-
})),
|
|
466
|
-
skillErrors: resources.skillErrors,
|
|
467
|
-
mcp: resources.mcp.map(r => ({ name: r.name, scope: r.scope, syncState: r.scope === 'project' ? undefined : 'synced' })),
|
|
468
|
-
memory: resources.memory.map(r => ({
|
|
469
|
-
...r,
|
|
470
|
-
syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'memory', memorySync),
|
|
471
|
-
})),
|
|
472
|
-
hooks: resources.hooks.map(r => ({
|
|
473
|
-
...r,
|
|
474
|
-
syncState: r.scope === 'project' ? undefined : getSyncState(r.name, 'hooks', hooksSync),
|
|
475
|
-
})),
|
|
476
|
-
};
|
|
477
|
-
spinner.stop();
|
|
478
|
-
// Render helper for resources
|
|
479
|
-
function renderSection(title, items) {
|
|
480
|
-
console.log(chalk.bold(`\n${title}\n`));
|
|
481
|
-
if (items.length === 0) {
|
|
482
|
-
console.log(` ${chalk.gray('none')}`);
|
|
483
|
-
return;
|
|
484
|
-
}
|
|
485
|
-
const versionStr = agentData.version ? ` (${agentData.version})` : '';
|
|
486
|
-
console.log(` ${chalk.bold(agentData.agentName)}${chalk.gray(versionStr)}:`);
|
|
487
|
-
for (const r of items) {
|
|
488
|
-
let nameColor = chalk.cyan;
|
|
489
|
-
if (r.syncState === 'synced')
|
|
490
|
-
nameColor = chalk.green;
|
|
491
|
-
else if (r.syncState === 'new')
|
|
492
|
-
nameColor = chalk.blue;
|
|
493
|
-
else if (r.syncState === 'modified')
|
|
494
|
-
nameColor = chalk.yellow;
|
|
495
|
-
else if (r.syncState === 'deleted')
|
|
496
|
-
nameColor = chalk.red;
|
|
497
|
-
let display = nameColor(r.name);
|
|
498
|
-
if (r.ruleCount !== undefined)
|
|
499
|
-
display += chalk.gray(` (${r.ruleCount} rules)`);
|
|
500
|
-
if (r.scope === 'project') {
|
|
501
|
-
display += chalk.gray(' [project]');
|
|
502
|
-
}
|
|
503
|
-
const pathStr = r.path ? chalk.gray(formatPath(r.path, cwd)) : '';
|
|
504
|
-
const syncStr = r.syncState ? chalk.gray(` [${r.syncState}]`) : '';
|
|
505
|
-
console.log(` ${display.padEnd(24)} ${pathStr}${syncStr}`);
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
// Render the single ~/.agents/promptcuts.yaml (cross-agent, not per-version).
|
|
509
|
-
// Reads the file to surface the shortcut count — cheap (<1KB typical).
|
|
510
|
-
function renderPromptcuts() {
|
|
511
|
-
console.log(chalk.bold(`\nPromptcuts\n`));
|
|
512
|
-
const promptcutsPath = getPromptcutsPath();
|
|
513
|
-
if (!fs.existsSync(promptcutsPath)) {
|
|
514
|
-
console.log(` ${chalk.gray('none')}`);
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
let count = 0;
|
|
518
|
-
try {
|
|
519
|
-
const parsed = yaml.parse(fs.readFileSync(promptcutsPath, 'utf-8'));
|
|
520
|
-
count = parsed?.shortcuts ? Object.keys(parsed.shortcuts).length : 0;
|
|
521
|
-
}
|
|
522
|
-
catch {
|
|
523
|
-
count = 0;
|
|
524
|
-
}
|
|
525
|
-
const label = `${count} shortcut${count === 1 ? '' : 's'}`;
|
|
526
|
-
console.log(` ${chalk.green(label).padEnd(24)} ${chalk.gray(formatPath(promptcutsPath, cwd))}`);
|
|
527
|
-
}
|
|
528
|
-
// 1. Agent CLI info
|
|
529
|
-
console.log(chalk.bold('Agent CLIs\n'));
|
|
530
|
-
const accountInfo = await getAccountInfo(agentId, home);
|
|
531
|
-
const usageInfo = await getUsageInfoForIdentity({
|
|
532
|
-
agentId,
|
|
533
|
-
home,
|
|
534
|
-
cliVersion: version,
|
|
535
|
-
info: accountInfo,
|
|
536
|
-
});
|
|
537
|
-
const emailStr = accountInfo.email ? chalk.cyan(` ${accountInfo.email}`) : '';
|
|
538
|
-
const status = chalk.green(version);
|
|
539
|
-
const usageStr = formatUsageSummary(accountInfo.plan, null);
|
|
540
|
-
const usagePart = usageStr ? ` ${usageStr}` : '';
|
|
541
|
-
console.log(` ${colorAgent(agentId)(AGENTS[agentId].name.padEnd(14))} ${status}${emailStr}${usagePart}`);
|
|
542
|
-
const usageLines = formatUsageSection(usageInfo);
|
|
543
|
-
if (usageLines.length > 0) {
|
|
544
|
-
console.log();
|
|
545
|
-
for (const line of usageLines) {
|
|
546
|
-
console.log(line);
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
// 2. Resources
|
|
550
|
-
renderSection('Commands', agentData.commands);
|
|
551
|
-
renderSection('Skills', agentData.skills);
|
|
552
|
-
// Show skill parse errors if any
|
|
553
|
-
if (agentData.skillErrors.length > 0) {
|
|
554
|
-
console.log(`\n ${chalk.red('Skill Errors')}:`);
|
|
555
|
-
for (const err of agentData.skillErrors) {
|
|
556
|
-
console.log(` ${chalk.red(err.name.padEnd(20))} ${chalk.gray(err.error)}`);
|
|
557
|
-
console.log(` ${chalk.gray(formatPath(err.path, cwd))}`);
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
renderSection('MCP Servers', agentData.mcp);
|
|
561
|
-
renderSection('Rules', agentData.memory);
|
|
562
|
-
renderSection('Hooks', agentData.hooks);
|
|
563
|
-
renderPromptcuts();
|
|
564
|
-
// Show legend at the end if git repo exists
|
|
565
|
-
if (hasGitRepo) {
|
|
566
|
-
console.log();
|
|
567
|
-
console.log(chalk.gray('Legend:'), chalk.green('Tracked'), chalk.blue('Local-only'), chalk.yellow('Modified'), chalk.red('Deleted'));
|
|
568
|
-
}
|
|
569
|
-
}
|
|
570
|
-
/**
|
|
571
|
-
* Collect structured info for one or more agents without rendering to the
|
|
572
|
-
* terminal. Used by `--json` output and any programmatic consumer (e.g. the
|
|
573
|
-
* swarmify extension's "resume current session in best available version"
|
|
574
|
-
* command).
|
|
575
|
-
*/
|
|
576
|
-
async function collectAgentsJson(filterAgentId) {
|
|
577
|
-
const agentsToShow = filterAgentId ? [filterAgentId] : ALL_AGENT_IDS;
|
|
578
|
-
const infoFetches = [];
|
|
579
|
-
for (const agentId of agentsToShow) {
|
|
580
|
-
for (const ver of listInstalledVersions(agentId)) {
|
|
581
|
-
const home = getVersionHomePath(agentId, ver);
|
|
582
|
-
infoFetches.push(getAccountInfo(agentId, home).then((info) => ({ agentId, version: ver, home, info })));
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
const infoResults = await Promise.all(infoFetches);
|
|
586
|
-
const { canonicalByUsageKey, usageByKey } = await getUsageInfoByIdentity(infoResults.map(({ agentId, home, version, info }) => ({
|
|
587
|
-
agentId,
|
|
588
|
-
home,
|
|
589
|
-
cliVersion: version,
|
|
590
|
-
info,
|
|
591
|
-
})));
|
|
592
|
-
const mergeCanonical = (info) => {
|
|
593
|
-
const key = getUsageLookupKey(info);
|
|
594
|
-
if (!key)
|
|
595
|
-
return info;
|
|
596
|
-
const canon = canonicalByUsageKey.get(key);
|
|
597
|
-
if (!canon)
|
|
598
|
-
return info;
|
|
599
|
-
return {
|
|
600
|
-
...info,
|
|
601
|
-
plan: canon.plan,
|
|
602
|
-
usageStatus: canon.usageStatus,
|
|
603
|
-
overageCredits: canon.overageCredits,
|
|
604
|
-
};
|
|
605
|
-
};
|
|
606
|
-
const byAgent = new Map();
|
|
607
|
-
for (const { agentId, version, info: rawInfo } of infoResults) {
|
|
608
|
-
const info = mergeCanonical(rawInfo);
|
|
609
|
-
const globalDefault = getGlobalDefault(agentId);
|
|
610
|
-
const usageKey = getUsageLookupKey(info);
|
|
611
|
-
const usageInfo = usageKey ? usageByKey.get(usageKey) : undefined;
|
|
612
|
-
const snapshot = usageInfo?.snapshot ?? null;
|
|
613
|
-
const entry = {
|
|
614
|
-
version,
|
|
615
|
-
isDefault: version === globalDefault,
|
|
616
|
-
signedIn: !!info.email,
|
|
617
|
-
email: info.email,
|
|
618
|
-
plan: info.plan,
|
|
619
|
-
usageStatus: info.usageStatus,
|
|
620
|
-
windows: snapshot
|
|
621
|
-
? snapshot.windows.map((w) => ({
|
|
622
|
-
key: w.key,
|
|
623
|
-
usedPercent: w.usedPercent,
|
|
624
|
-
resetsAt: w.resetsAt ? w.resetsAt.toISOString() : null,
|
|
625
|
-
}))
|
|
626
|
-
: [],
|
|
627
|
-
lastActive: info.lastActive ? info.lastActive.toISOString() : null,
|
|
628
|
-
path: getVersionDir(agentId, version),
|
|
629
|
-
};
|
|
630
|
-
const existing = byAgent.get(agentId);
|
|
631
|
-
if (existing)
|
|
632
|
-
existing.push(entry);
|
|
633
|
-
else
|
|
634
|
-
byAgent.set(agentId, [entry]);
|
|
635
|
-
}
|
|
636
|
-
const out = [];
|
|
637
|
-
for (const agentId of agentsToShow) {
|
|
638
|
-
const versions = byAgent.get(agentId) ?? [];
|
|
639
|
-
versions.sort((a, b) => {
|
|
640
|
-
if (a.isDefault !== b.isDefault)
|
|
641
|
-
return a.isDefault ? -1 : 1;
|
|
642
|
-
return compareVersions(b.version, a.version);
|
|
643
|
-
});
|
|
644
|
-
out.push({ agent: agentId, versions });
|
|
645
|
-
}
|
|
646
|
-
return out;
|
|
647
|
-
}
|
|
648
|
-
async function buildAgentPrunePlan(agentId) {
|
|
649
|
-
const entries = await Promise.all(listInstalledVersions(agentId).map(async (version) => {
|
|
650
|
-
const home = getVersionHomePath(agentId, version);
|
|
651
|
-
const info = await getAccountInfo(agentId, home);
|
|
652
|
-
return { version, info };
|
|
653
|
-
}));
|
|
654
|
-
const globalDefault = getGlobalDefault(agentId);
|
|
655
|
-
const byEmail = new Map();
|
|
656
|
-
for (const e of entries) {
|
|
657
|
-
if (!e.info.email)
|
|
658
|
-
continue;
|
|
659
|
-
const key = e.info.email.toLowerCase();
|
|
660
|
-
const list = byEmail.get(key) ?? [];
|
|
661
|
-
list.push(e);
|
|
662
|
-
byEmail.set(key, list);
|
|
663
|
-
}
|
|
664
|
-
const toPrune = [];
|
|
665
|
-
const skippedDefaults = [];
|
|
666
|
-
for (const [, group] of byEmail) {
|
|
667
|
-
if (group.length < 2)
|
|
668
|
-
continue;
|
|
669
|
-
const sorted = [...group].sort((a, b) => compareVersions(b.version, a.version));
|
|
670
|
-
const keeper = sorted[0].version;
|
|
671
|
-
for (const older of sorted.slice(1)) {
|
|
672
|
-
const plan = {
|
|
673
|
-
agentId,
|
|
674
|
-
version: older.version,
|
|
675
|
-
email: older.info.email,
|
|
676
|
-
keeper,
|
|
677
|
-
isDefault: older.version === globalDefault,
|
|
678
|
-
};
|
|
679
|
-
if (plan.isDefault)
|
|
680
|
-
skippedDefaults.push(plan);
|
|
681
|
-
else
|
|
682
|
-
toPrune.push(plan);
|
|
683
|
-
}
|
|
684
|
-
}
|
|
685
|
-
return { agentId, toPrune, skippedDefaults };
|
|
686
|
-
}
|
|
687
|
-
async function executePrunePlan(plan) {
|
|
688
|
-
let removed = 0;
|
|
689
|
-
for (const p of plan.toPrune) {
|
|
690
|
-
console.log(chalk.gray(`Removing ${agentLabel(p.agentId)}@${p.version}...`));
|
|
691
|
-
const ok = removeVersion(p.agentId, p.version);
|
|
692
|
-
if (ok) {
|
|
693
|
-
console.log(chalk.green(`Removed ${agentLabel(p.agentId)}@${p.version}`));
|
|
694
|
-
removed++;
|
|
695
|
-
}
|
|
696
|
-
else {
|
|
697
|
-
console.log(chalk.yellow(`Already gone: ${agentLabel(p.agentId)}@${p.version}`));
|
|
698
|
-
}
|
|
699
|
-
}
|
|
700
|
-
if (listInstalledVersions(plan.agentId).length === 0) {
|
|
701
|
-
removeShim(plan.agentId);
|
|
702
|
-
}
|
|
703
|
-
return removed;
|
|
704
|
-
}
|
|
705
|
-
function printPrunePlan(plan, isFirst) {
|
|
706
|
-
if (plan.skippedDefaults.length > 0) {
|
|
707
|
-
console.log(chalk.yellow(`Skipping default versions for ${agentLabel(plan.agentId)} (switch default first):`));
|
|
708
|
-
for (const s of plan.skippedDefaults) {
|
|
709
|
-
console.log(` ${agentLabel(s.agentId)}@${s.version} ${chalk.cyan(s.email)} ` +
|
|
710
|
-
chalk.gray(`— duplicate of ${s.agentId}@${s.keeper}. Run: agents use ${s.agentId}@${s.keeper}`));
|
|
711
|
-
}
|
|
712
|
-
console.log();
|
|
713
|
-
}
|
|
714
|
-
if (plan.toPrune.length === 0)
|
|
715
|
-
return;
|
|
716
|
-
const heading = isFirst ? `Will prune ${agentLabel(plan.agentId)}:` : `Also found duplicates for ${agentLabel(plan.agentId)}:`;
|
|
717
|
-
console.log(chalk.bold(heading));
|
|
718
|
-
for (const p of plan.toPrune) {
|
|
719
|
-
console.log(` ${agentLabel(p.agentId)}@${p.version} ${chalk.cyan(p.email)} ` +
|
|
720
|
-
chalk.gray(`— keeping ${p.agentId}@${p.keeper}`));
|
|
721
|
-
}
|
|
722
|
-
console.log();
|
|
723
|
-
}
|
|
724
|
-
/**
|
|
725
|
-
* Prune older installed versions that share an email with a newer installed
|
|
726
|
-
* version. Keeps the highest semver per email, skips the global default (with
|
|
727
|
-
* a warning so the user can switch first).
|
|
728
|
-
*
|
|
729
|
-
* When filterAgentId is set, prunes that agent first, then cascades: after
|
|
730
|
-
* each agent, offers the next agent with duplicates. User answering "no"
|
|
731
|
-
* stops the chain.
|
|
732
|
-
*/
|
|
733
|
-
async function pruneDuplicates(filterAgentId, yes) {
|
|
734
|
-
const ordered = filterAgentId
|
|
735
|
-
? [filterAgentId, ...ALL_AGENT_IDS.filter((a) => a !== filterAgentId)]
|
|
736
|
-
: [...ALL_AGENT_IDS];
|
|
737
|
-
const spinner = ora({ text: 'Scanning installed versions...', isSilent: !process.stdout.isTTY }).start();
|
|
738
|
-
const plans = await Promise.all(ordered.map((a) => buildAgentPrunePlan(a)));
|
|
739
|
-
spinner.stop();
|
|
740
|
-
const actionable = plans.filter((p) => p.toPrune.length > 0 || p.skippedDefaults.length > 0);
|
|
741
|
-
if (actionable.length === 0) {
|
|
742
|
-
console.log(chalk.gray('Nothing to prune — no older versions share an account with a newer version.'));
|
|
743
|
-
return;
|
|
744
|
-
}
|
|
745
|
-
let totalRemoved = 0;
|
|
746
|
-
let isFirst = true;
|
|
747
|
-
let processedAny = false;
|
|
748
|
-
for (const plan of actionable) {
|
|
749
|
-
printPrunePlan(plan, isFirst);
|
|
750
|
-
if (plan.toPrune.length === 0) {
|
|
751
|
-
// Only skippedDefaults for this agent; move on.
|
|
752
|
-
isFirst = false;
|
|
753
|
-
continue;
|
|
754
|
-
}
|
|
755
|
-
if (!yes) {
|
|
756
|
-
if (!isInteractiveTerminal()) {
|
|
757
|
-
console.log(chalk.red('Refusing to prune in a non-interactive shell without --yes.'));
|
|
758
|
-
console.log(chalk.gray('Re-run with: agents view' + (filterAgentId ? ` ${filterAgentId}` : '') + ' --prune -y'));
|
|
759
|
-
process.exit(1);
|
|
760
|
-
}
|
|
761
|
-
const n = plan.toPrune.length;
|
|
762
|
-
const message = isFirst
|
|
763
|
-
? `Prune ${n} ${agentLabel(plan.agentId)} version${n === 1 ? '' : 's'}?`
|
|
764
|
-
: `Also prune ${n} ${agentLabel(plan.agentId)} version${n === 1 ? '' : 's'}?`;
|
|
765
|
-
let proceed = false;
|
|
766
|
-
try {
|
|
767
|
-
proceed = await confirm({ message, default: false });
|
|
768
|
-
}
|
|
769
|
-
catch (err) {
|
|
770
|
-
if (isPromptCancelled(err)) {
|
|
771
|
-
console.log(chalk.gray('Cancelled'));
|
|
772
|
-
break;
|
|
773
|
-
}
|
|
774
|
-
throw err;
|
|
775
|
-
}
|
|
776
|
-
if (!proceed) {
|
|
777
|
-
console.log(chalk.gray('Stopping here.'));
|
|
778
|
-
break;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
totalRemoved += await executePrunePlan(plan);
|
|
782
|
-
processedAny = true;
|
|
783
|
-
isFirst = false;
|
|
784
|
-
console.log();
|
|
785
|
-
}
|
|
786
|
-
if (processedAny) {
|
|
787
|
-
console.log(chalk.bold(`Pruned ${totalRemoved} version${totalRemoved === 1 ? '' : 's'}.`));
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Main view action handler.
|
|
792
|
-
* Exported for use by deprecated aliases.
|
|
793
|
-
*/
|
|
794
|
-
export async function viewAction(agentArg, options) {
|
|
795
|
-
const json = options?.json === true;
|
|
796
|
-
const prune = options?.prune === true;
|
|
797
|
-
const yes = options?.yes === true;
|
|
798
|
-
if (!agentArg) {
|
|
799
|
-
if (prune) {
|
|
800
|
-
await pruneDuplicates(undefined, yes);
|
|
801
|
-
return;
|
|
802
|
-
}
|
|
803
|
-
if (json) {
|
|
804
|
-
const data = await collectAgentsJson();
|
|
805
|
-
console.log(JSON.stringify(data, null, 2));
|
|
806
|
-
return;
|
|
807
|
-
}
|
|
808
|
-
// No argument: show all installed versions
|
|
809
|
-
await showInstalledVersions();
|
|
810
|
-
return;
|
|
811
|
-
}
|
|
812
|
-
// Parse agent@version syntax
|
|
813
|
-
const parts = agentArg.split('@');
|
|
814
|
-
const agentName = parts[0];
|
|
815
|
-
const requestedVersion = parts[1] || null;
|
|
816
|
-
const agentId = resolveAgentName(agentName);
|
|
817
|
-
if (!agentId) {
|
|
818
|
-
if (json) {
|
|
819
|
-
console.log(JSON.stringify({ error: formatAgentError(agentName) }));
|
|
820
|
-
process.exit(1);
|
|
821
|
-
}
|
|
822
|
-
console.log(chalk.red(formatAgentError(agentName)));
|
|
823
|
-
process.exit(1);
|
|
824
|
-
}
|
|
825
|
-
if (prune) {
|
|
826
|
-
if (requestedVersion) {
|
|
827
|
-
console.log(chalk.red('--prune does not take a @version suffix.'));
|
|
828
|
-
console.log(chalk.gray(`Run: agents view ${agentId} --prune`));
|
|
829
|
-
process.exit(1);
|
|
830
|
-
}
|
|
831
|
-
await pruneDuplicates(agentId, yes);
|
|
832
|
-
return;
|
|
833
|
-
}
|
|
834
|
-
if (json) {
|
|
835
|
-
// --json ignores the @version suffix (detailed resource view is not yet
|
|
836
|
-
// exposed as structured data). Emit the version list for the agent.
|
|
837
|
-
const data = await collectAgentsJson(agentId);
|
|
838
|
-
console.log(JSON.stringify(data[0] ?? { agent: agentId, versions: [] }, null, 2));
|
|
839
|
-
return;
|
|
840
|
-
}
|
|
841
|
-
if (requestedVersion) {
|
|
842
|
-
// Specific version requested: show detailed resources
|
|
843
|
-
await showAgentResources(agentId, requestedVersion);
|
|
844
|
-
}
|
|
845
|
-
else {
|
|
846
|
-
// Just agent name: show versions for that agent
|
|
847
|
-
await showInstalledVersions(agentId);
|
|
848
|
-
}
|
|
849
|
-
}
|
|
850
|
-
/** Register the `agents view` command. */
|
|
851
|
-
export function registerViewCommand(program) {
|
|
852
|
-
program
|
|
853
|
-
.command('view [agent]')
|
|
854
|
-
.description('Show what agent CLIs are installed and which versions you have. Inspect resources when you pass agent@version.')
|
|
855
|
-
.option('--json', 'Emit machine-readable JSON (version list, usage, signed-in status).')
|
|
856
|
-
.option('--prune', 'Remove older installed versions that share an account with a newer installed version. Skips the global default.')
|
|
857
|
-
.option('-y, --yes', 'Skip the prune confirmation prompt.')
|
|
858
|
-
.addHelpText('after', `
|
|
859
|
-
Examples:
|
|
860
|
-
# Show all installed agents with versions, accounts, and usage
|
|
861
|
-
agents view
|
|
862
|
-
|
|
863
|
-
# Show versions for one agent
|
|
864
|
-
agents view claude
|
|
865
|
-
|
|
866
|
-
# Detailed view: resources, commands, skills, MCP servers for a specific version
|
|
867
|
-
agents view claude@2.1.112
|
|
868
|
-
agents view claude@default
|
|
869
|
-
|
|
870
|
-
# Machine-readable output (used by tools that pick a version programmatically)
|
|
871
|
-
agents view claude --json
|
|
872
|
-
|
|
873
|
-
# Prune older versions that duplicate an account already used by a newer version
|
|
874
|
-
agents view claude --prune
|
|
875
|
-
agents view claude --prune -y
|
|
876
|
-
|
|
877
|
-
When to use:
|
|
878
|
-
- Checking which agents are installed and what their default versions are
|
|
879
|
-
- Seeing which account each version is logged into (useful for multi-account setups)
|
|
880
|
-
- Inspecting commands, skills, hooks, and MCP servers synced to a version
|
|
881
|
-
- Verifying a version is installed before running it
|
|
882
|
-
- Cleaning up stale versions left behind after upgrading (--prune)
|
|
883
|
-
|
|
884
|
-
Output:
|
|
885
|
-
- Without arguments: table of all agents with versions, emails, usage stats
|
|
886
|
-
- With agent name: versions for that agent, showing which is the default
|
|
887
|
-
- With agent@version: detailed breakdown of resources synced to that version
|
|
888
|
-
- With --json: structured JSON with version, isDefault, signedIn, email, plan,
|
|
889
|
-
usageStatus, per-window usedPercent, lastActive, and path
|
|
890
|
-
- With --prune: plan of which older versions will be removed, then confirm
|
|
891
|
-
`)
|
|
892
|
-
.action((agentArg, options) => viewAction(agentArg, options));
|
|
893
|
-
}
|
|
894
|
-
//# sourceMappingURL=view.js.map
|