@phnx-labs/agents-cli 0.1.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 +283 -372
- 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 +8 -1
- package/dist/commands/cloud.js +108 -22
- 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 +96 -27
- 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 +16 -4
- 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 +9 -1
- package/dist/commands/profiles.js +56 -7
- 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 +58 -128
- 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 +8 -1
- package/dist/commands/secrets.js +235 -63
- 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 +188 -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 +317 -24
- package/dist/index.d.ts +7 -2
- package/dist/index.js +172 -34
- 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 +197 -21
- 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 +9 -3
- package/dist/lib/cloud/codex.js +53 -13
- package/dist/lib/cloud/factory.d.ts +8 -3
- package/dist/lib/cloud/factory.js +19 -3
- package/dist/lib/cloud/registry.d.ts +10 -1
- package/dist/lib/cloud/registry.js +14 -3
- package/dist/lib/cloud/rush.d.ts +63 -3
- package/dist/lib/cloud/rush.js +273 -20
- package/dist/lib/cloud/store.d.ts +13 -1
- package/dist/lib/cloud/store.js +23 -4
- package/dist/lib/cloud/stream.d.ts +6 -1
- package/dist/lib/cloud/stream.js +95 -39
- package/dist/lib/cloud/types.d.ts +153 -8
- package/dist/lib/cloud/types.js +34 -2
- 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 +23 -6
- package/dist/lib/exec.js +53 -17
- 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 +119 -101
- 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 +10 -4
- package/dist/lib/models.js +36 -15
- 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 +10 -1
- package/dist/lib/profiles-presets.js +9 -1
- package/dist/lib/profiles.d.ts +35 -1
- package/dist/lib/profiles.js +36 -15
- 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 +40 -13
- package/dist/lib/rotate.js +238 -40
- 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 → secrets/bundles.d.ts} +12 -2
- package/dist/lib/{secrets-bundles.js → secrets/bundles.js} +38 -17
- 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 +12 -1
- package/dist/lib/session/artifacts.js +25 -5
- 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 +16 -2
- package/dist/lib/session/types.js +10 -2
- package/dist/lib/shims.d.ts +64 -5
- package/dist/lib/shims.js +309 -47
- 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 +112 -27
- package/dist/lib/state.js +320 -148
- 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 +32 -1
- package/dist/lib/usage.js +70 -6
- package/dist/lib/version-duplicates.d.ts +21 -0
- package/dist/lib/version-duplicates.js +90 -0
- package/dist/lib/versions.d.ts +33 -4
- package/dist/lib/versions.js +376 -108
- package/package.json +32 -17
- 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/cloud.d.ts.map +0 -1
- package/dist/commands/cloud.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/profiles.d.ts.map +0 -1
- package/dist/commands/profiles.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/secrets.d.ts.map +0 -1
- package/dist/commands/secrets.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 -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 -39
- 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.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/cloud/codex.d.ts.map +0 -1
- package/dist/lib/cloud/codex.js.map +0 -1
- package/dist/lib/cloud/factory.d.ts.map +0 -1
- package/dist/lib/cloud/factory.js.map +0 -1
- package/dist/lib/cloud/registry.d.ts.map +0 -1
- package/dist/lib/cloud/registry.js.map +0 -1
- package/dist/lib/cloud/rush.d.ts.map +0 -1
- package/dist/lib/cloud/rush.js.map +0 -1
- package/dist/lib/cloud/store.d.ts.map +0 -1
- package/dist/lib/cloud/store.js.map +0 -1
- package/dist/lib/cloud/stream.d.ts.map +0 -1
- package/dist/lib/cloud/stream.js.map +0 -1
- package/dist/lib/cloud/types.d.ts.map +0 -1
- package/dist/lib/cloud/types.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/profiles-keychain.d.ts +0 -3
- package/dist/lib/profiles-keychain.d.ts.map +0 -1
- package/dist/lib/profiles-keychain.js +0 -10
- package/dist/lib/profiles-keychain.js.map +0 -1
- package/dist/lib/profiles-presets.d.ts.map +0 -1
- package/dist/lib/profiles-presets.js.map +0 -1
- package/dist/lib/profiles.d.ts.map +0 -1
- package/dist/lib/profiles.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/rotate.d.ts.map +0 -1
- package/dist/lib/rotate.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/secrets-bundles.d.ts.map +0 -1
- package/dist/lib/secrets-bundles.js.map +0 -1
- package/dist/lib/secrets.d.ts +0 -27
- package/dist/lib/secrets.d.ts.map +0 -1
- package/dist/lib/secrets.js +0 -127
- 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/artifacts.d.ts.map +0 -1
- package/dist/lib/session/artifacts.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
package/dist/commands/hooks.js
CHANGED
|
@@ -3,13 +3,15 @@ import ora from 'ora';
|
|
|
3
3
|
import * as fs from 'fs';
|
|
4
4
|
import * as os from 'os';
|
|
5
5
|
import * as path from 'path';
|
|
6
|
-
import { checkbox
|
|
7
|
-
import { AGENTS, HOOKS_CAPABLE_AGENTS,
|
|
6
|
+
import { checkbox } from '@inquirer/prompts';
|
|
7
|
+
import { AGENTS, HOOKS_CAPABLE_AGENTS, resolveAgentName, formatAgentError, agentLabel, } from '../lib/agents.js';
|
|
8
|
+
import { supports } from '../lib/capabilities.js';
|
|
8
9
|
import { cloneRepo } from '../lib/git.js';
|
|
9
|
-
import { discoverHooksFromRepo, installHooksCentrally, listCentralHooks, listInstalledHooksWithScope, removeHook, getHookInfo, parseHookManifest,
|
|
10
|
-
import { listInstalledVersions, getGlobalDefault, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveAgentVersionTargets,
|
|
10
|
+
import { discoverHooksFromRepo, installHooksCentrally, listCentralHooks, listInstalledHooksWithScope, removeHook, getHookInfo, parseHookManifest, } from '../lib/hooks.js';
|
|
11
|
+
import { listInstalledVersions, getGlobalDefault, resolveVersionAlias, syncResourcesToVersion, promptAgentVersionSelection, getVersionHomePath, resolveAgentVersionTargets, } from '../lib/versions.js';
|
|
11
12
|
import { recordVersionResources } from '../lib/state.js';
|
|
12
13
|
import { isPromptCancelled, isInteractiveTerminal, parseCommaSeparatedList, printWithPager, requireInteractiveSelection, } from './utils.js';
|
|
14
|
+
/** Register the `agents hooks` command tree (list, add, remove, sync, prune, view). */
|
|
13
15
|
export function registerHooksCommands(program) {
|
|
14
16
|
const hooksCmd = program.command('hooks')
|
|
15
17
|
.description('Automate workflows by running shell scripts in response to agent events')
|
|
@@ -53,13 +55,13 @@ When to use:
|
|
|
53
55
|
if (agentInput) {
|
|
54
56
|
const parts = agentInput.split('@');
|
|
55
57
|
const agentName = parts[0];
|
|
56
|
-
requestedVersion = parts[1] || null;
|
|
57
58
|
agentId = resolveAgentName(agentName);
|
|
58
59
|
if (!agentId) {
|
|
59
60
|
spinner.stop();
|
|
60
61
|
console.log(chalk.red(formatAgentError(agentName, [...HOOKS_CAPABLE_AGENTS])));
|
|
61
62
|
process.exit(1);
|
|
62
63
|
}
|
|
64
|
+
requestedVersion = resolveVersionAlias(agentId, parts[1]) ?? null;
|
|
63
65
|
}
|
|
64
66
|
// Load hook manifest for event display
|
|
65
67
|
const hookManifest = parseHookManifest();
|
|
@@ -79,14 +81,12 @@ When to use:
|
|
|
79
81
|
const agent = AGENTS[agentId];
|
|
80
82
|
const defaultLabel = isDefault ? ' default' : '';
|
|
81
83
|
const versionStr = chalk.gray(` (${version}${defaultLabel})`);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
if (agentId === 'codex' && compareVersions(version, CODEX_HOOKS_MIN_VERSION) < 0) {
|
|
89
|
-
console.log(` ${chalk.bold(agentLabel(agentId))}${versionStr}: ${chalk.gray(`unsupported (codex@${version} < ${CODEX_HOOKS_MIN_VERSION})`)}`);
|
|
84
|
+
const gate = supports(agentId, 'hooks', version);
|
|
85
|
+
if (!gate.ok) {
|
|
86
|
+
const detail = gate.reason === 'unsupported'
|
|
87
|
+
? 'hooks not supported'
|
|
88
|
+
: `unsupported (${agentId}@${version} requires ${gate.need})`;
|
|
89
|
+
console.log(` ${chalk.bold(agentLabel(agent.id))}${versionStr}: ${chalk.gray(detail)}`);
|
|
90
90
|
console.log();
|
|
91
91
|
return;
|
|
92
92
|
}
|
|
@@ -455,177 +455,26 @@ Examples:
|
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
});
|
|
458
|
+
// `hooks sync` is gone — sync runs automatically when the agent launches.
|
|
458
459
|
hooksCmd
|
|
459
|
-
.command('sync')
|
|
460
|
-
.
|
|
461
|
-
.
|
|
462
|
-
.
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
agents hooks
|
|
466
|
-
|
|
467
|
-
# Scope to one agent or version
|
|
468
|
-
agents hooks sync --agent claude
|
|
469
|
-
agents hooks sync --agent claude@2.1.113
|
|
470
|
-
|
|
471
|
-
Sync reconciles the hook script files in each version home against the central
|
|
472
|
-
source of truth in ~/.agents/hooks/. It does NOT touch settings.json
|
|
473
|
-
registrations — those point at central paths and are managed on install.
|
|
474
|
-
|
|
475
|
-
Sync is additive: to remove orphan scripts, use 'agents hooks prune'.
|
|
476
|
-
`)
|
|
477
|
-
.action(async (options) => {
|
|
478
|
-
let filter;
|
|
479
|
-
if (options.agent) {
|
|
480
|
-
const [name, version] = String(options.agent).split('@');
|
|
481
|
-
const agentId = resolveAgentName(name);
|
|
482
|
-
if (!agentId) {
|
|
483
|
-
console.log(chalk.red(formatAgentError(name, HOOKS_CAPABLE_AGENTS)));
|
|
484
|
-
process.exit(1);
|
|
485
|
-
}
|
|
486
|
-
filter = { agent: agentId, version: version || undefined };
|
|
487
|
-
}
|
|
488
|
-
const pairs = iterHooksCapableVersions(filter);
|
|
489
|
-
if (pairs.length === 0) {
|
|
490
|
-
console.log(chalk.gray('No matching installed versions.'));
|
|
491
|
-
return;
|
|
492
|
-
}
|
|
493
|
-
const diffs = pairs.map(({ agent, version }) => diffVersionHooks(agent, version));
|
|
494
|
-
const plan = diffs.filter((d) => d.toAdd.length > 0 || d.toUpdate.length > 0);
|
|
495
|
-
if (plan.length === 0) {
|
|
496
|
-
console.log(chalk.green('All version homes are up to date with central.'));
|
|
497
|
-
if (diffs.some((d) => d.orphans.length > 0)) {
|
|
498
|
-
console.log(chalk.gray('Orphan hooks present. Run \'agents hooks prune --dry-run\' to review.'));
|
|
499
|
-
}
|
|
500
|
-
return;
|
|
501
|
-
}
|
|
502
|
-
console.log(chalk.bold('Syncing hooks\n'));
|
|
503
|
-
let adds = 0, updates = 0, failures = 0;
|
|
504
|
-
for (const diff of plan) {
|
|
505
|
-
const label = `${diff.agent}@${diff.version}`;
|
|
506
|
-
if (diff.toAdd.length > 0) {
|
|
507
|
-
console.log(` ${chalk.cyan(label)} ${chalk.gray('add:')} ${diff.toAdd.join(', ')}`);
|
|
508
|
-
for (const name of diff.toAdd) {
|
|
509
|
-
const r = installHookToVersion(diff.agent, diff.version, name);
|
|
510
|
-
if (r.success)
|
|
511
|
-
adds++;
|
|
512
|
-
else {
|
|
513
|
-
failures++;
|
|
514
|
-
console.log(chalk.red(` ! ${name}: ${r.error}`));
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
}
|
|
518
|
-
if (diff.toUpdate.length > 0) {
|
|
519
|
-
console.log(` ${chalk.cyan(label)} ${chalk.gray('update:')} ${diff.toUpdate.join(', ')}`);
|
|
520
|
-
for (const name of diff.toUpdate) {
|
|
521
|
-
const r = installHookToVersion(diff.agent, diff.version, name);
|
|
522
|
-
if (r.success)
|
|
523
|
-
updates++;
|
|
524
|
-
else {
|
|
525
|
-
failures++;
|
|
526
|
-
console.log(chalk.red(` ! ${name}: ${r.error}`));
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
}
|
|
531
|
-
console.log();
|
|
532
|
-
console.log(chalk.green(`Synced: ${adds} added, ${updates} updated${failures > 0 ? chalk.red(`, ${failures} failed`) : ''}.`));
|
|
533
|
-
const totalOrphans = diffs.reduce((n, d) => n + d.orphans.length, 0);
|
|
534
|
-
if (totalOrphans > 0) {
|
|
535
|
-
console.log(chalk.gray(`${totalOrphans} orphan(s) remain. Run 'agents hooks prune --dry-run' to review.`));
|
|
536
|
-
}
|
|
460
|
+
.command('sync', { hidden: true })
|
|
461
|
+
.allowUnknownOption()
|
|
462
|
+
.allowExcessArguments()
|
|
463
|
+
.action(() => {
|
|
464
|
+
console.error(chalk.red('"agents hooks sync" is gone.'));
|
|
465
|
+
console.error(chalk.gray('Sync runs automatically when you launch the agent.'));
|
|
466
|
+
console.error(chalk.gray('To remove orphans, use: agents prune hooks'));
|
|
467
|
+
process.exit(1);
|
|
537
468
|
});
|
|
469
|
+
// `hooks prune` moved to the top-level `agents prune` command.
|
|
538
470
|
hooksCmd
|
|
539
|
-
.command('prune')
|
|
540
|
-
.
|
|
541
|
-
.
|
|
542
|
-
.
|
|
543
|
-
.
|
|
544
|
-
.
|
|
545
|
-
|
|
546
|
-
# See what would be pruned
|
|
547
|
-
agents hooks prune --dry-run
|
|
548
|
-
|
|
549
|
-
# Prune across every installed version (prompts for confirmation)
|
|
550
|
-
agents hooks prune
|
|
551
|
-
|
|
552
|
-
# Scope to one agent or version
|
|
553
|
-
agents hooks prune --agent claude@2.1.80
|
|
554
|
-
|
|
555
|
-
# Skip confirmation (for scripts)
|
|
556
|
-
agents hooks prune -y
|
|
557
|
-
|
|
558
|
-
Prune removes hook SCRIPT FILES from version homes. It does not edit
|
|
559
|
-
settings.json registrations — those are keyed off central paths and remain
|
|
560
|
-
consistent as long as central ~/.agents/hooks/ and ~/.agents/hooks.yaml are
|
|
561
|
-
the source of truth.
|
|
562
|
-
`)
|
|
563
|
-
.action(async (options) => {
|
|
564
|
-
let filter;
|
|
565
|
-
if (options.agent) {
|
|
566
|
-
const [name, version] = String(options.agent).split('@');
|
|
567
|
-
const agentId = resolveAgentName(name);
|
|
568
|
-
if (!agentId) {
|
|
569
|
-
console.log(chalk.red(formatAgentError(name, HOOKS_CAPABLE_AGENTS)));
|
|
570
|
-
process.exit(1);
|
|
571
|
-
}
|
|
572
|
-
filter = { agent: agentId, version: version || undefined };
|
|
573
|
-
}
|
|
574
|
-
const pairs = iterHooksCapableVersions(filter);
|
|
575
|
-
const diffs = pairs
|
|
576
|
-
.map(({ agent, version }) => diffVersionHooks(agent, version))
|
|
577
|
-
.filter((d) => d.orphans.length > 0);
|
|
578
|
-
if (diffs.length === 0) {
|
|
579
|
-
console.log(chalk.green('No orphan hooks.'));
|
|
580
|
-
return;
|
|
581
|
-
}
|
|
582
|
-
const total = diffs.reduce((n, d) => n + d.orphans.length, 0);
|
|
583
|
-
console.log(chalk.bold(`Orphans (in version home, not in central)\n`));
|
|
584
|
-
for (const d of diffs) {
|
|
585
|
-
console.log(` ${chalk.cyan(`${d.agent}@${d.version}`)} ${d.orphans.join(', ')}`);
|
|
586
|
-
}
|
|
587
|
-
console.log();
|
|
588
|
-
if (options.dryRun) {
|
|
589
|
-
console.log(chalk.gray(`${total} orphan(s). Run without --dry-run to delete.`));
|
|
590
|
-
return;
|
|
591
|
-
}
|
|
592
|
-
if (!options.yes) {
|
|
593
|
-
if (!isInteractiveTerminal()) {
|
|
594
|
-
console.log(chalk.yellow('Non-interactive shell: pass -y to confirm, or --dry-run to preview.'));
|
|
595
|
-
process.exit(1);
|
|
596
|
-
}
|
|
597
|
-
let ok = false;
|
|
598
|
-
try {
|
|
599
|
-
ok = await confirm({
|
|
600
|
-
message: `Delete ${total} orphan hook${total === 1 ? '' : 's'}?`,
|
|
601
|
-
default: false,
|
|
602
|
-
});
|
|
603
|
-
}
|
|
604
|
-
catch (err) {
|
|
605
|
-
if (isPromptCancelled(err)) {
|
|
606
|
-
console.log(chalk.gray('Cancelled'));
|
|
607
|
-
return;
|
|
608
|
-
}
|
|
609
|
-
throw err;
|
|
610
|
-
}
|
|
611
|
-
if (!ok) {
|
|
612
|
-
console.log(chalk.gray('Cancelled'));
|
|
613
|
-
return;
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
let removed = 0, failures = 0;
|
|
617
|
-
for (const d of diffs) {
|
|
618
|
-
for (const name of d.orphans) {
|
|
619
|
-
const r = removeHookFromVersion(d.agent, d.version, name);
|
|
620
|
-
if (r.success)
|
|
621
|
-
removed++;
|
|
622
|
-
else {
|
|
623
|
-
failures++;
|
|
624
|
-
console.log(chalk.red(` ! ${d.agent}@${d.version} ${name}: ${r.error}`));
|
|
625
|
-
}
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
console.log(chalk.green(`Pruned ${removed} orphan(s)${failures > 0 ? chalk.red(`, ${failures} failed`) : ''}.`));
|
|
471
|
+
.command('prune', { hidden: true })
|
|
472
|
+
.allowUnknownOption()
|
|
473
|
+
.allowExcessArguments()
|
|
474
|
+
.action(() => {
|
|
475
|
+
console.error(chalk.red('"agents hooks prune" moved.'));
|
|
476
|
+
console.error(chalk.gray('Use: agents prune hooks (or `agents prune` for everything)'));
|
|
477
|
+
process.exit(1);
|
|
629
478
|
});
|
|
630
479
|
hooksCmd
|
|
631
480
|
.command('view [name]')
|
|
@@ -686,4 +535,3 @@ Examples:
|
|
|
686
535
|
}
|
|
687
536
|
});
|
|
688
537
|
}
|
|
689
|
-
//# sourceMappingURL=hooks.js.map
|
package/dist/commands/init.d.ts
CHANGED
|
@@ -1,6 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-run initialization command.
|
|
3
|
+
*
|
|
4
|
+
* Registers the `agents init` command which clones the system repo into
|
|
5
|
+
* ~/.agents-system/ and installs agent CLIs with resource syncing.
|
|
6
|
+
*/
|
|
1
7
|
import type { Command } from 'commander';
|
|
8
|
+
/** First-run setup. Clones ~/.agents-system/ from the system repo if needed. */
|
|
2
9
|
export declare function runInit(program: Command, options?: {
|
|
3
10
|
force?: boolean;
|
|
4
11
|
}): Promise<void>;
|
|
12
|
+
/**
|
|
13
|
+
* Ensure the system repo exists before running a command that needs it.
|
|
14
|
+
* If ~/.agents-system/ is not a git repo AND we're in an interactive TTY,
|
|
15
|
+
* prompt the user to run init now. In non-interactive mode, print a clear
|
|
16
|
+
* error and exit.
|
|
17
|
+
*/
|
|
18
|
+
export declare function ensureInitialized(program: Command): Promise<void>;
|
|
19
|
+
/** Register the `agents init` command. */
|
|
5
20
|
export declare function registerInitCommand(program: Command): void;
|
|
6
|
-
//# sourceMappingURL=init.d.ts.map
|
package/dist/commands/init.js
CHANGED
|
@@ -1,115 +1,210 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* First-run initialization command.
|
|
3
|
+
*
|
|
4
|
+
* Registers the `agents init` command which clones the system repo into
|
|
5
|
+
* ~/.agents-system/ and installs agent CLIs with resource syncing.
|
|
6
|
+
*/
|
|
1
7
|
import chalk from 'chalk';
|
|
8
|
+
import ora from 'ora';
|
|
2
9
|
import * as fs from 'fs';
|
|
3
10
|
import * as path from 'path';
|
|
4
|
-
import
|
|
11
|
+
import * as os from 'os';
|
|
12
|
+
import { confirm } from '@inquirer/prompts';
|
|
5
13
|
import { DEFAULT_SYSTEM_REPO, systemRepoSlug } from '../lib/types.js';
|
|
6
|
-
import { getAgentsDir } from '../lib/state.js';
|
|
7
|
-
import { isGitRepo } from '../lib/git.js';
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
import { getAgentsDir, getVersionsDir, ensureAgentsDir } from '../lib/state.js';
|
|
15
|
+
import { isGitRepo, cloneIntoExisting, pullRepo } from '../lib/git.js';
|
|
16
|
+
import { isPromptCancelled, isInteractiveTerminal } from './utils.js';
|
|
17
|
+
import { AGENTS, getUnmanagedAgentInstalls, countSessionFiles, agentLabel } from '../lib/agents.js';
|
|
18
|
+
import { setGlobalDefault } from '../lib/versions.js';
|
|
19
|
+
import { ensureShimCurrent, switchHomeFileSymlinks, isShimsInPath, addShimsToPath, getPathSetupInstructions } from '../lib/shims.js';
|
|
20
|
+
const HOME = os.homedir();
|
|
21
|
+
/**
|
|
22
|
+
* Import an existing unmanaged agent installation into agents-cli.
|
|
23
|
+
* Moves the config dir into the versions structure and creates a symlink.
|
|
24
|
+
*/
|
|
25
|
+
async function importAgent(agentId, version) {
|
|
26
|
+
const agent = AGENTS[agentId];
|
|
27
|
+
const configDir = agent.configDir;
|
|
28
|
+
const versionsDir = getVersionsDir();
|
|
29
|
+
const versionHome = path.join(versionsDir, agentId, version, 'home');
|
|
30
|
+
const versionConfigDir = path.join(versionHome, `.${agentId}`);
|
|
31
|
+
// Skip if version dir already exists (collision)
|
|
32
|
+
if (fs.existsSync(versionConfigDir)) {
|
|
33
|
+
return { success: false, skipped: true, error: `${version} already installed` };
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
// Create version home directory
|
|
37
|
+
fs.mkdirSync(versionHome, { recursive: true });
|
|
38
|
+
// Move existing config dir into version home
|
|
39
|
+
fs.renameSync(configDir, versionConfigDir);
|
|
40
|
+
// Create symlink from original location to version config
|
|
41
|
+
fs.symlinkSync(versionConfigDir, configDir);
|
|
42
|
+
// Set as global default
|
|
43
|
+
setGlobalDefault(agentId, version);
|
|
44
|
+
// Handle home-level files (e.g. ~/.claude.json)
|
|
45
|
+
switchHomeFileSymlinks(agentId, version);
|
|
46
|
+
// Ensure shim exists
|
|
47
|
+
ensureShimCurrent(agentId);
|
|
48
|
+
return { success: true };
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
return { success: false, error: err.message };
|
|
20
52
|
}
|
|
21
|
-
return 'Format: gh:owner/repo';
|
|
22
53
|
}
|
|
54
|
+
/** First-run setup. Clones ~/.agents-system/ from the system repo if needed. */
|
|
23
55
|
export async function runInit(program, options = {}) {
|
|
24
56
|
const agentsDir = getAgentsDir();
|
|
25
|
-
const
|
|
26
|
-
const alreadyConfigured = fs.existsSync(metaFile) || isGitRepo(agentsDir);
|
|
57
|
+
const alreadyConfigured = isGitRepo(agentsDir);
|
|
27
58
|
if (alreadyConfigured && !options.force) {
|
|
28
|
-
console.log(chalk.
|
|
29
|
-
console.log(chalk.gray('\nTo sync updates: agents pull'));
|
|
59
|
+
console.log(chalk.gray('~/.agents-system/ is already set up.'));
|
|
60
|
+
console.log(chalk.gray('\nTo sync updates: agents repo pull system'));
|
|
30
61
|
console.log(chalk.gray('To re-initialize: agents init --force'));
|
|
31
62
|
return;
|
|
32
63
|
}
|
|
33
|
-
if
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
process.exit(1);
|
|
64
|
+
// Detect existing installations BEFORE cloning (they won't exist after if we import)
|
|
65
|
+
const unmanaged = await getUnmanagedAgentInstalls();
|
|
66
|
+
const sessionCounts = {};
|
|
67
|
+
for (const install of unmanaged) {
|
|
68
|
+
sessionCounts[install.agentId] = countSessionFiles(install.agentId);
|
|
39
69
|
}
|
|
40
70
|
console.log(chalk.bold('\nWelcome to agents-cli.'));
|
|
41
|
-
console.log(chalk.gray(
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
description: 'Use an existing .agents repo you own.',
|
|
54
|
-
},
|
|
55
|
-
],
|
|
56
|
-
});
|
|
57
|
-
let source;
|
|
58
|
-
if (choice === 'default') {
|
|
59
|
-
source = DEFAULT_SYSTEM_REPO;
|
|
71
|
+
console.log(chalk.gray(`Cloning the system repo from ${systemRepoSlug(DEFAULT_SYSTEM_REPO)} into ~/.agents-system/.\n`));
|
|
72
|
+
ensureAgentsDir();
|
|
73
|
+
const spinner = ora('Cloning system repo...').start();
|
|
74
|
+
if (isGitRepo(agentsDir)) {
|
|
75
|
+
// --force on an existing repo: pull instead of re-clone
|
|
76
|
+
const result = await pullRepo(agentsDir);
|
|
77
|
+
if (!result.success) {
|
|
78
|
+
spinner.fail(`Pull failed: ${result.error}`);
|
|
79
|
+
console.log(chalk.gray('Fix the issue and re-run: agents init --force'));
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
spinner.succeed(`Updated to ${result.commit}`);
|
|
60
83
|
}
|
|
61
84
|
else {
|
|
62
|
-
const
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
85
|
+
const result = await cloneIntoExisting(DEFAULT_SYSTEM_REPO, agentsDir);
|
|
86
|
+
if (!result.success) {
|
|
87
|
+
spinner.fail(`Clone failed: ${result.error}`);
|
|
88
|
+
console.log(chalk.gray('Fix the issue and re-run: agents init --force'));
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
spinner.succeed(`Cloned ${systemRepoSlug(DEFAULT_SYSTEM_REPO)} (${result.commit})`);
|
|
67
92
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
93
|
+
// Offer to import existing unmanaged installations
|
|
94
|
+
if (unmanaged.length > 0 && isInteractiveTerminal()) {
|
|
95
|
+
console.log(chalk.bold('\nFound existing installations:\n'));
|
|
96
|
+
const maxAgentLen = Math.max(...unmanaged.map(i => agentLabel(i.agentId).length));
|
|
97
|
+
for (const install of unmanaged) {
|
|
98
|
+
const label = agentLabel(install.agentId).padEnd(maxAgentLen);
|
|
99
|
+
const sessions = sessionCounts[install.agentId] || 0;
|
|
100
|
+
const sessionStr = sessions > 0 ? `${sessions} sessions` : 'no sessions';
|
|
101
|
+
const versionStr = install.version ? `v${install.version}` : '';
|
|
102
|
+
console.log(` ${chalk.cyan(label)} ${install.configDir} ${chalk.gray(sessionStr)} ${chalk.gray(versionStr)}`);
|
|
103
|
+
}
|
|
104
|
+
console.log();
|
|
105
|
+
const shouldImport = await confirm({
|
|
106
|
+
message: 'Import these under agents-cli management?',
|
|
107
|
+
default: true,
|
|
108
|
+
});
|
|
109
|
+
if (shouldImport) {
|
|
110
|
+
console.log();
|
|
111
|
+
for (const install of unmanaged) {
|
|
112
|
+
const version = install.version || 'unknown';
|
|
113
|
+
const spinner = ora(`Importing ${agentLabel(install.agentId)} v${version}...`).start();
|
|
114
|
+
const result = await importAgent(install.agentId, version);
|
|
115
|
+
if (result.success) {
|
|
116
|
+
spinner.succeed(`${agentLabel(install.agentId)} imported`);
|
|
117
|
+
}
|
|
118
|
+
else if (result.skipped) {
|
|
119
|
+
spinner.warn(`${agentLabel(install.agentId)}: ${result.error} (skipped)`);
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
spinner.fail(`${agentLabel(install.agentId)}: ${result.error}`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// Ensure shims are in PATH
|
|
126
|
+
if (!isShimsInPath()) {
|
|
127
|
+
const pathResult = addShimsToPath();
|
|
128
|
+
if (pathResult.success && !pathResult.alreadyPresent) {
|
|
129
|
+
console.log(chalk.green(`\nAdded shims to ~/${pathResult.rcFile}`));
|
|
130
|
+
console.log(chalk.gray('Restart your shell or run: source ~/' + pathResult.rcFile));
|
|
131
|
+
}
|
|
132
|
+
else if (!pathResult.success) {
|
|
133
|
+
console.log(chalk.yellow('\nTo enable version switching, add shims to PATH:'));
|
|
134
|
+
console.log(chalk.gray(getPathSetupInstructions()));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
// Show total session count
|
|
138
|
+
const totalSessions = Object.values(sessionCounts).reduce((a, b) => a + (b || 0), 0);
|
|
139
|
+
if (totalSessions > 0) {
|
|
140
|
+
const breakdown = unmanaged
|
|
141
|
+
.filter(i => (sessionCounts[i.agentId] || 0) > 0)
|
|
142
|
+
.map(i => `${agentLabel(i.agentId)} (${sessionCounts[i.agentId] || 0})`)
|
|
143
|
+
.join(', ');
|
|
144
|
+
console.log(chalk.gray(`\n${totalSessions} sessions available across ${breakdown}`));
|
|
145
|
+
console.log(chalk.cyan(' agents sessions') + chalk.gray(' # browse them'));
|
|
146
|
+
}
|
|
147
|
+
}
|
|
77
148
|
}
|
|
78
149
|
console.log(chalk.bold('\nSetup complete. Try:'));
|
|
79
150
|
console.log(chalk.cyan(' agents view ') + chalk.gray(' # see what\'s installed'));
|
|
80
151
|
console.log(chalk.cyan(' agents run <agent> "hello" ') + chalk.gray(' # run an agent'));
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
152
|
+
console.log(chalk.gray('\nWhen you want your own editable repo, scaffold one with:'));
|
|
153
|
+
console.log(chalk.cyan(' agents repo init'));
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Ensure the system repo exists before running a command that needs it.
|
|
157
|
+
* If ~/.agents-system/ is not a git repo AND we're in an interactive TTY,
|
|
158
|
+
* prompt the user to run init now. In non-interactive mode, print a clear
|
|
159
|
+
* error and exit.
|
|
160
|
+
*/
|
|
161
|
+
export async function ensureInitialized(program) {
|
|
162
|
+
const agentsDir = getAgentsDir();
|
|
163
|
+
if (isGitRepo(agentsDir))
|
|
164
|
+
return;
|
|
165
|
+
if (!isInteractiveTerminal()) {
|
|
166
|
+
console.error(chalk.red('agents-cli is not initialized. Run: agents init'));
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
console.log(chalk.yellow('\nagents-cli has not been set up yet.'));
|
|
170
|
+
const proceed = await confirm({
|
|
171
|
+
message: 'Run `agents init` now?',
|
|
172
|
+
default: true,
|
|
173
|
+
}).catch(() => false);
|
|
174
|
+
if (!proceed) {
|
|
175
|
+
console.log(chalk.gray('Skipped. Run `agents init` when ready.'));
|
|
176
|
+
process.exit(0);
|
|
84
177
|
}
|
|
178
|
+
await runInit(program);
|
|
179
|
+
process.exit(0);
|
|
85
180
|
}
|
|
181
|
+
/** Register the `agents init` command. */
|
|
86
182
|
export function registerInitCommand(program) {
|
|
87
183
|
program
|
|
88
184
|
.command('init')
|
|
89
185
|
.description('Set up agents-cli for the first time. Clones a config repo and installs agent CLIs.')
|
|
90
|
-
.option('-f, --force', 'Reinitialize even if ~/.agents/ already exists (use with caution)')
|
|
186
|
+
.option('-f, --force', 'Reinitialize even if ~/.agents-system/ already exists (use with caution)')
|
|
91
187
|
.addHelpText('after', `
|
|
92
188
|
Examples:
|
|
93
|
-
#
|
|
189
|
+
# First-time setup (clones the system repo into ~/.agents-system/)
|
|
94
190
|
agents init
|
|
95
191
|
|
|
96
|
-
# Re-initialize after corruption
|
|
192
|
+
# Re-initialize after corruption
|
|
97
193
|
agents init --force
|
|
98
194
|
|
|
99
195
|
When to use:
|
|
100
196
|
- First time running agents-cli: this is your starting point
|
|
101
|
-
- Onboarding a new machine:
|
|
102
|
-
-
|
|
197
|
+
- Onboarding a new machine: restore the system repo and installed CLIs
|
|
198
|
+
- Repairing ~/.agents-system/ after accidental deletion or corruption
|
|
103
199
|
|
|
104
200
|
What it does:
|
|
105
|
-
1.
|
|
106
|
-
2.
|
|
107
|
-
3.
|
|
108
|
-
4. Syncs commands, skills, hooks, and MCP servers to each version
|
|
201
|
+
1. Clones the system repo into ~/.agents-system/
|
|
202
|
+
2. Installs agent CLIs based on agents.yaml in that repo
|
|
203
|
+
3. Syncs commands, skills, hooks, and MCP servers to each version
|
|
109
204
|
|
|
110
205
|
Non-interactive alternative:
|
|
111
|
-
|
|
112
|
-
agents pull
|
|
206
|
+
Skip 'init' and run:
|
|
207
|
+
agents pull
|
|
113
208
|
`)
|
|
114
209
|
.action(async (options) => {
|
|
115
210
|
try {
|
|
@@ -124,4 +219,3 @@ Non-interactive alternative:
|
|
|
124
219
|
}
|
|
125
220
|
});
|
|
126
221
|
}
|
|
127
|
-
//# sourceMappingURL=init.js.map
|
package/dist/commands/mcp.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP (Model Context Protocol) server management commands.
|
|
3
|
+
*
|
|
4
|
+
* Implements `agents mcp` -- list, add, remove, view, and register MCP
|
|
5
|
+
* servers that give agents runtime access to databases, APIs, and external
|
|
6
|
+
* services. Servers are declared in ~/.agents/mcp/ YAML files or the
|
|
7
|
+
* agents.yaml manifest, then registered into each agent version's config.
|
|
8
|
+
*/
|
|
1
9
|
import type { Command } from 'commander';
|
|
10
|
+
/** Register the `agents mcp` command tree (list, add, remove, view, register). */
|
|
2
11
|
export declare function registerMcpCommands(program: Command): void;
|
|
3
|
-
//# sourceMappingURL=mcp.d.ts.map
|
package/dist/commands/mcp.js
CHANGED
|
@@ -5,10 +5,11 @@ import { AGENTS, MCP_CAPABLE_AGENTS, getAllCliStates, resolveAgentName, formatAg
|
|
|
5
5
|
import { readManifest, writeManifest, createDefaultManifest } from '../lib/manifest.js';
|
|
6
6
|
import { listMcpServerConfigs } from '../lib/mcp.js';
|
|
7
7
|
import { getMcpDir } from '../lib/state.js';
|
|
8
|
-
import { getEffectiveHome, getGlobalDefault, listInstalledVersions, getVersionHomePath, resolveInstalledAgentTargets, resolveConfiguredAgentTargets, } from '../lib/versions.js';
|
|
8
|
+
import { getEffectiveHome, getGlobalDefault, listInstalledVersions, getVersionHomePath, resolveInstalledAgentTargets, resolveConfiguredAgentTargets, resolveVersionAlias, } from '../lib/versions.js';
|
|
9
9
|
import { getAgentsDir } from '../lib/state.js';
|
|
10
10
|
import { isPromptCancelled, isInteractiveTerminal, requireInteractiveSelection } from './utils.js';
|
|
11
11
|
import { showResourceList, buildTargetsSection, } from './resource-view.js';
|
|
12
|
+
/** Parse a comma-separated --agents string into validated agent IDs and optional version targets. */
|
|
12
13
|
function parseMcpAgentTargets(value) {
|
|
13
14
|
const agents = [];
|
|
14
15
|
const agentVersions = {};
|
|
@@ -49,12 +50,15 @@ function parseMcpAgentTargets(value) {
|
|
|
49
50
|
if (installedVersions.length === 0) {
|
|
50
51
|
throw new Error(`No managed versions are installed for ${AGENTS[agentId].name}. Run: agents add ${agentId}@latest`);
|
|
51
52
|
}
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
const resolvedVersion = versionToken === 'latest'
|
|
54
|
+
? installedVersions[installedVersions.length - 1]
|
|
55
|
+
: versionToken;
|
|
56
|
+
if (!installedVersions.includes(resolvedVersion)) {
|
|
57
|
+
throw new Error(`Version ${resolvedVersion} is not installed for ${AGENTS[agentId].name}. Installed versions: ${installedVersions.join(', ')}`);
|
|
54
58
|
}
|
|
55
59
|
const versions = agentVersions[agentId] || [];
|
|
56
|
-
if (!versions.includes(
|
|
57
|
-
versions.push(
|
|
60
|
+
if (!versions.includes(resolvedVersion)) {
|
|
61
|
+
versions.push(resolvedVersion);
|
|
58
62
|
agentVersions[agentId] = versions;
|
|
59
63
|
}
|
|
60
64
|
}
|
|
@@ -66,6 +70,7 @@ function parseMcpAgentTargets(value) {
|
|
|
66
70
|
function formatTargetLabel(agentId, version) {
|
|
67
71
|
return version ? `${agentLabel(agentId)}@${version}` : agentLabel(agentId);
|
|
68
72
|
}
|
|
73
|
+
/** Register the `agents mcp` command tree (list, add, remove, view, register). */
|
|
69
74
|
export function registerMcpCommands(program) {
|
|
70
75
|
const mcpCmd = program
|
|
71
76
|
.command('mcp')
|
|
@@ -112,7 +117,7 @@ When to use:
|
|
|
112
117
|
process.exit(1);
|
|
113
118
|
}
|
|
114
119
|
filterAgent = resolved;
|
|
115
|
-
filterVersion = parts[1]
|
|
120
|
+
filterVersion = resolveVersionAlias(resolved, parts[1]);
|
|
116
121
|
}
|
|
117
122
|
const rows = buildMcpRows({ filterAgent, filterVersion });
|
|
118
123
|
spinner.stop();
|
|
@@ -578,4 +583,3 @@ function truncateString(s, max) {
|
|
|
578
583
|
return s;
|
|
579
584
|
return s.slice(0, max - 1) + '…';
|
|
580
585
|
}
|
|
581
|
-
//# sourceMappingURL=mcp.js.map
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Model catalog inspection command.
|
|
3
|
+
*
|
|
4
|
+
* Registers the hidden `agents models` command for listing models
|
|
5
|
+
* supported by installed agent versions. Extracts model catalogs from
|
|
6
|
+
* each agent's CLI bundle and displays IDs, aliases, and metadata.
|
|
7
|
+
*/
|
|
1
8
|
import type { Command } from 'commander';
|
|
9
|
+
/** Register the hidden `agents models` command. */
|
|
2
10
|
export declare function registerModelsCommand(program: Command): void;
|
|
3
|
-
//# sourceMappingURL=models.d.ts.map
|