@phnx-labs/agents-cli 1.12.0 → 1.14.2
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 +308 -297
- package/dist/commands/alias.d.ts +11 -0
- package/dist/commands/alias.js +117 -0
- package/dist/commands/beta.d.ts +2 -0
- package/dist/commands/beta.js +53 -0
- package/dist/commands/cloud.d.ts +10 -0
- package/dist/commands/cloud.js +408 -0
- package/dist/commands/commands.d.ts +9 -1
- package/dist/commands/commands.js +24 -172
- package/dist/commands/daemon.d.ts +8 -1
- package/dist/commands/daemon.js +13 -5
- package/dist/commands/doctor.d.ts +15 -0
- package/dist/commands/doctor.js +132 -0
- package/dist/commands/drive.d.ts +8 -1
- package/dist/commands/drive.js +20 -3
- package/dist/commands/exec.d.ts +8 -1
- package/dist/commands/exec.js +207 -20
- package/dist/commands/factory.d.ts +19 -0
- package/dist/commands/factory.js +71 -0
- package/dist/commands/fork.d.ts +8 -1
- package/dist/commands/fork.js +11 -4
- package/dist/commands/hooks.d.ts +9 -1
- package/dist/commands/hooks.js +30 -182
- package/dist/commands/init.d.ts +15 -1
- package/dist/commands/init.js +168 -74
- package/dist/commands/mcp.d.ts +9 -1
- package/dist/commands/mcp.js +11 -7
- package/dist/commands/models.d.ts +8 -1
- package/dist/commands/models.js +45 -6
- package/dist/commands/packages.d.ts +8 -1
- package/dist/commands/packages.js +13 -7
- package/dist/commands/permissions.d.ts +9 -1
- package/dist/commands/permissions.js +3 -3
- package/dist/commands/plugins.d.ts +8 -1
- package/dist/commands/plugins.js +13 -2
- package/dist/commands/profiles.d.ts +11 -0
- package/dist/commands/profiles.js +291 -0
- package/dist/commands/prune.d.ts +22 -0
- package/dist/commands/prune.js +191 -0
- package/dist/commands/pty.d.ts +1 -1
- package/dist/commands/pty.js +2 -1
- package/dist/commands/pull.d.ts +8 -1
- package/dist/commands/pull.js +93 -129
- package/dist/commands/refresh-memory.d.ts +7 -1
- package/dist/commands/refresh-memory.js +7 -1
- package/dist/commands/repo.d.ts +15 -0
- package/dist/commands/repo.js +570 -0
- package/dist/commands/resource-view.d.ts +10 -3
- package/dist/commands/resource-view.js +18 -5
- package/dist/commands/routines.d.ts +8 -1
- package/dist/commands/routines.js +17 -4
- package/dist/commands/rules.d.ts +9 -1
- package/dist/commands/rules.js +16 -11
- package/dist/commands/secrets.d.ts +10 -0
- package/dist/commands/secrets.js +518 -0
- package/dist/commands/sessions-picker.d.ts +2 -1
- package/dist/commands/sessions-picker.js +88 -11
- package/dist/commands/sessions-tail.d.ts +19 -0
- package/dist/commands/sessions-tail.js +235 -0
- package/dist/commands/sessions.d.ts +2 -1
- package/dist/commands/sessions.js +288 -7
- package/dist/commands/skills.d.ts +9 -1
- package/dist/commands/skills.js +28 -178
- package/dist/commands/status.d.ts +7 -1
- package/dist/commands/status.js +7 -1
- package/dist/commands/subagents.d.ts +8 -1
- package/dist/commands/subagents.js +11 -1
- package/dist/commands/sync.d.ts +8 -1
- package/dist/commands/sync.js +8 -1
- package/dist/commands/teams-picker.d.ts +4 -1
- package/dist/commands/teams-picker.js +55 -3
- package/dist/commands/teams.d.ts +15 -1
- package/dist/commands/teams.js +323 -69
- package/dist/commands/usage.d.ts +11 -0
- package/dist/commands/usage.js +60 -0
- package/dist/commands/utils.d.ts +6 -1
- package/dist/commands/utils.js +6 -1
- package/dist/commands/versions.d.ts +8 -1
- package/dist/commands/versions.js +4 -3
- package/dist/commands/view.d.ts +47 -2
- package/dist/commands/view.js +353 -20
- package/dist/index.d.ts +7 -2
- package/dist/index.js +205 -38
- package/dist/lib/acp/client.d.ts +31 -0
- package/dist/lib/acp/client.js +117 -0
- package/dist/lib/acp/harnesses.d.ts +26 -0
- package/dist/lib/acp/harnesses.js +65 -0
- package/dist/lib/acp/run.d.ts +18 -0
- package/dist/lib/acp/run.js +39 -0
- package/dist/lib/agents.d.ts +74 -2
- package/dist/lib/agents.js +207 -23
- package/dist/lib/artifact-actions.d.ts +8 -4
- package/dist/lib/artifact-actions.js +8 -6
- package/dist/lib/auto-pull-worker.d.ts +11 -0
- package/dist/lib/auto-pull-worker.js +121 -0
- package/dist/lib/auto-pull.d.ts +31 -0
- package/dist/lib/auto-pull.js +97 -0
- package/dist/lib/beta.d.ts +23 -0
- package/dist/lib/beta.js +90 -0
- package/dist/lib/capabilities.d.ts +29 -0
- package/dist/lib/capabilities.js +74 -0
- package/dist/lib/cloud/codex.d.ts +25 -0
- package/dist/lib/cloud/codex.js +250 -0
- package/dist/lib/cloud/factory.d.ts +31 -0
- package/dist/lib/cloud/factory.js +53 -0
- package/dist/lib/cloud/registry.d.ts +15 -0
- package/dist/lib/cloud/registry.js +67 -0
- package/dist/lib/cloud/rush.d.ts +75 -0
- package/dist/lib/cloud/rush.js +438 -0
- package/dist/lib/cloud/store.d.ts +22 -0
- package/dist/lib/cloud/store.js +115 -0
- package/dist/lib/cloud/stream.d.ts +23 -0
- package/dist/lib/cloud/stream.js +194 -0
- package/dist/lib/cloud/types.d.ts +205 -0
- package/dist/lib/cloud/types.js +34 -0
- package/dist/lib/command-skills.d.ts +20 -0
- package/dist/lib/command-skills.js +142 -0
- package/dist/lib/commands.d.ts +22 -2
- package/dist/lib/commands.js +51 -11
- package/dist/lib/convert.d.ts +10 -1
- package/dist/lib/convert.js +9 -1
- package/dist/lib/daemon.d.ts +21 -1
- package/dist/lib/daemon.js +97 -4
- package/dist/lib/drive-sync.d.ts +18 -1
- package/dist/lib/drive-sync.js +57 -15
- package/dist/lib/exec.d.ts +25 -5
- package/dist/lib/exec.js +72 -27
- package/dist/lib/fs-walk.d.ts +2 -0
- package/dist/lib/fs-walk.js +40 -0
- package/dist/lib/fuzzy.d.ts +53 -0
- package/dist/lib/fuzzy.js +72 -0
- package/dist/lib/gemini-settings.d.ts +4 -0
- package/dist/lib/gemini-settings.js +33 -0
- package/dist/lib/git.d.ts +12 -2
- package/dist/lib/git.js +17 -6
- package/dist/lib/help.d.ts +20 -1
- package/dist/lib/help.js +45 -6
- package/dist/lib/hooks/match.d.ts +32 -0
- package/dist/lib/hooks/match.js +120 -0
- package/dist/lib/hooks.d.ts +17 -4
- package/dist/lib/hooks.js +191 -21
- package/dist/lib/manifest.d.ts +6 -1
- package/dist/lib/manifest.js +15 -4
- package/dist/lib/markdown.d.ts +0 -1
- package/dist/lib/markdown.js +6 -1
- package/dist/lib/mcp.d.ts +0 -1
- package/dist/lib/mcp.js +29 -33
- package/dist/lib/memory-compile.d.ts +13 -3
- package/dist/lib/memory-compile.js +31 -9
- package/dist/lib/memory.d.ts +14 -7
- package/dist/lib/memory.js +67 -38
- package/dist/lib/migrate.d.ts +8 -0
- package/dist/lib/migrate.js +85 -0
- package/dist/lib/models.d.ts +25 -11
- package/dist/lib/models.js +405 -16
- package/dist/lib/onepassword.d.ts +63 -0
- package/dist/lib/onepassword.js +186 -0
- package/dist/lib/paths.d.ts +8 -0
- package/dist/lib/paths.js +20 -0
- package/dist/lib/permissions.d.ts +24 -2
- package/dist/lib/permissions.js +117 -48
- package/dist/lib/picker.d.ts +10 -1
- package/dist/lib/picker.js +15 -1
- package/dist/lib/plugins.d.ts +7 -1
- package/dist/lib/plugins.js +10 -1
- package/dist/lib/profiles-presets.d.ts +24 -0
- package/dist/lib/profiles-presets.js +103 -0
- package/dist/lib/profiles.d.ts +69 -0
- package/dist/lib/profiles.js +144 -0
- package/dist/lib/pty-client.d.ts +1 -1
- package/dist/lib/pty-client.js +0 -1
- package/dist/lib/pty-server.d.ts +16 -2
- package/dist/lib/pty-server.js +92 -3
- package/dist/lib/registry.d.ts +23 -3
- package/dist/lib/registry.js +153 -8
- package/dist/lib/resources.d.ts +28 -1
- package/dist/lib/resources.js +79 -1
- package/dist/lib/rotate.d.ts +89 -0
- package/dist/lib/rotate.js +327 -0
- package/dist/lib/routines.d.ts +29 -1
- package/dist/lib/routines.js +32 -5
- package/dist/lib/runner.d.ts +14 -1
- package/dist/lib/runner.js +22 -3
- package/dist/lib/sandbox.d.ts +16 -1
- package/dist/lib/sandbox.js +39 -16
- package/dist/lib/scheduler.d.ts +8 -1
- package/dist/lib/scheduler.js +8 -1
- package/dist/lib/secrets/AgentsKeychain.app/Contents/CodeResources +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/Info.plist +22 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/MacOS/AgentsKeychain +0 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/_CodeSignature/CodeResources +123 -0
- package/dist/lib/secrets/AgentsKeychain.app/Contents/embedded.provisionprofile +0 -0
- package/dist/lib/secrets/bundles.d.ts +39 -0
- package/dist/lib/secrets/bundles.js +189 -0
- package/dist/lib/secrets/index.d.ts +55 -0
- package/dist/lib/secrets/index.js +211 -0
- package/dist/lib/secrets/profiles.d.ts +10 -0
- package/dist/lib/secrets/profiles.js +13 -0
- package/dist/lib/session/active.d.ts +43 -0
- package/dist/lib/session/active.js +392 -0
- package/dist/lib/session/artifacts.d.ts +16 -0
- package/dist/lib/session/artifacts.js +95 -0
- package/dist/lib/session/cloud.d.ts +30 -0
- package/dist/lib/session/cloud.js +121 -0
- package/dist/lib/session/db.d.ts +23 -2
- package/dist/lib/session/db.js +76 -12
- package/dist/lib/session/discover.d.ts +19 -4
- package/dist/lib/session/discover.js +344 -48
- package/dist/lib/session/parse.d.ts +28 -1
- package/dist/lib/session/parse.js +267 -9
- package/dist/lib/session/prompt.d.ts +9 -1
- package/dist/lib/session/prompt.js +17 -3
- package/dist/lib/session/render.d.ts +13 -1
- package/dist/lib/session/render.js +20 -1
- package/dist/lib/session/team-filter.d.ts +9 -1
- package/dist/lib/session/team-filter.js +11 -2
- package/dist/lib/session/types.d.ts +24 -2
- package/dist/lib/session/types.js +10 -2
- package/dist/lib/shims.d.ts +93 -5
- package/dist/lib/shims.js +380 -67
- package/dist/lib/skills.d.ts +27 -2
- package/dist/lib/skills.js +127 -65
- package/dist/lib/sqlite.d.ts +43 -0
- package/dist/lib/sqlite.js +94 -0
- package/dist/lib/state.d.ts +114 -22
- package/dist/lib/state.js +323 -138
- package/dist/lib/subagents.d.ts +9 -1
- package/dist/lib/subagents.js +70 -63
- package/dist/lib/sync-manifest.d.ts +81 -0
- package/dist/lib/sync-manifest.js +450 -0
- package/dist/lib/teams/agents.d.ts +103 -5
- package/dist/lib/teams/agents.js +414 -91
- package/dist/lib/teams/api.d.ts +26 -3
- package/dist/lib/teams/api.js +63 -3
- package/dist/lib/teams/debug.d.ts +6 -1
- package/dist/lib/teams/debug.js +6 -1
- package/dist/lib/teams/file_ops.d.ts +7 -1
- package/dist/lib/teams/file_ops.js +7 -1
- package/dist/lib/teams/index.d.ts +15 -0
- package/dist/lib/teams/index.js +14 -0
- package/dist/lib/teams/parsers.d.ts +4 -1
- package/dist/lib/teams/parsers.js +11 -1
- package/dist/lib/teams/persistence.d.ts +15 -1
- package/dist/lib/teams/persistence.js +102 -20
- package/dist/lib/teams/registry.d.ts +12 -1
- package/dist/lib/teams/registry.js +116 -33
- package/dist/lib/teams/summarizer.d.ts +15 -1
- package/dist/lib/teams/summarizer.js +14 -1
- package/dist/lib/teams/supervisor.d.ts +48 -0
- package/dist/lib/teams/supervisor.js +73 -0
- package/dist/lib/template.d.ts +8 -6
- package/dist/lib/template.js +8 -6
- package/dist/lib/types.d.ts +147 -8
- package/dist/lib/types.js +26 -3
- package/dist/lib/usage.d.ts +48 -1
- package/dist/lib/usage.js +97 -16
- package/dist/lib/version-duplicates.d.ts +21 -0
- package/dist/lib/version-duplicates.js +90 -0
- package/dist/lib/versions.d.ts +39 -4
- package/dist/lib/versions.js +401 -111
- package/package.json +33 -18
- package/scripts/postinstall.js +126 -30
- package/dist/commands/__tests__/sessions.test.d.ts +0 -2
- package/dist/commands/__tests__/sessions.test.d.ts.map +0 -1
- package/dist/commands/__tests__/sessions.test.js +0 -636
- package/dist/commands/__tests__/sessions.test.js.map +0 -1
- package/dist/commands/commands.d.ts.map +0 -1
- package/dist/commands/commands.js.map +0 -1
- package/dist/commands/daemon.d.ts.map +0 -1
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/drive.d.ts.map +0 -1
- package/dist/commands/drive.js.map +0 -1
- package/dist/commands/exec.d.ts.map +0 -1
- package/dist/commands/exec.js.map +0 -1
- package/dist/commands/fork.d.ts.map +0 -1
- package/dist/commands/fork.js.map +0 -1
- package/dist/commands/hooks.d.ts.map +0 -1
- package/dist/commands/hooks.js.map +0 -1
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/mcp.d.ts.map +0 -1
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/models.d.ts.map +0 -1
- package/dist/commands/models.js.map +0 -1
- package/dist/commands/packages.d.ts.map +0 -1
- package/dist/commands/packages.js.map +0 -1
- package/dist/commands/permissions.d.ts.map +0 -1
- package/dist/commands/permissions.js.map +0 -1
- package/dist/commands/plugins.d.ts.map +0 -1
- package/dist/commands/plugins.js.map +0 -1
- package/dist/commands/pty.d.ts.map +0 -1
- package/dist/commands/pty.js.map +0 -1
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -3
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -180
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/refresh-memory.d.ts.map +0 -1
- package/dist/commands/refresh-memory.js.map +0 -1
- package/dist/commands/resource-view.d.ts.map +0 -1
- package/dist/commands/resource-view.js.map +0 -1
- package/dist/commands/routines.d.ts.map +0 -1
- package/dist/commands/routines.js.map +0 -1
- package/dist/commands/rules.d.ts.map +0 -1
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/sessions-picker.d.ts.map +0 -1
- package/dist/commands/sessions-picker.js.map +0 -1
- package/dist/commands/sessions.d.ts.map +0 -1
- package/dist/commands/sessions.js.map +0 -1
- package/dist/commands/skills.d.ts.map +0 -1
- package/dist/commands/skills.js.map +0 -1
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js.map +0 -1
- package/dist/commands/subagents.d.ts.map +0 -1
- package/dist/commands/subagents.js.map +0 -1
- package/dist/commands/sync.d.ts.map +0 -1
- package/dist/commands/sync.js.map +0 -1
- package/dist/commands/teams-picker.d.ts.map +0 -1
- package/dist/commands/teams-picker.js.map +0 -1
- package/dist/commands/teams.d.ts.map +0 -1
- package/dist/commands/teams.js.map +0 -1
- package/dist/commands/utils.d.ts.map +0 -1
- package/dist/commands/utils.js.map +0 -1
- package/dist/commands/versions.d.ts.map +0 -1
- package/dist/commands/versions.js.map +0 -1
- package/dist/commands/view.d.ts.map +0 -1
- package/dist/commands/view.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.d.ts +0 -2
- package/dist/lib/__tests__/bugfixes.test.d.ts.map +0 -1
- package/dist/lib/__tests__/bugfixes.test.js +0 -192
- package/dist/lib/__tests__/bugfixes.test.js.map +0 -1
- package/dist/lib/__tests__/exec.test.d.ts +0 -2
- package/dist/lib/__tests__/exec.test.d.ts.map +0 -1
- package/dist/lib/__tests__/exec.test.js +0 -446
- package/dist/lib/__tests__/exec.test.js.map +0 -1
- package/dist/lib/__tests__/git-sync.test.d.ts +0 -2
- package/dist/lib/__tests__/git-sync.test.d.ts.map +0 -1
- package/dist/lib/__tests__/git-sync.test.js +0 -138
- package/dist/lib/__tests__/git-sync.test.js.map +0 -1
- package/dist/lib/__tests__/hooks.test.d.ts +0 -2
- package/dist/lib/__tests__/hooks.test.d.ts.map +0 -1
- package/dist/lib/__tests__/hooks.test.js +0 -203
- package/dist/lib/__tests__/hooks.test.js.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.d.ts +0 -2
- package/dist/lib/__tests__/memory-compile.test.d.ts.map +0 -1
- package/dist/lib/__tests__/memory-compile.test.js +0 -95
- package/dist/lib/__tests__/memory-compile.test.js.map +0 -1
- package/dist/lib/__tests__/models.test.d.ts +0 -2
- package/dist/lib/__tests__/models.test.d.ts.map +0 -1
- package/dist/lib/__tests__/models.test.js +0 -184
- package/dist/lib/__tests__/models.test.js.map +0 -1
- package/dist/lib/__tests__/usage.test.d.ts +0 -2
- package/dist/lib/__tests__/usage.test.d.ts.map +0 -1
- package/dist/lib/__tests__/usage.test.js +0 -218
- package/dist/lib/__tests__/usage.test.js.map +0 -1
- package/dist/lib/agents.d.ts.map +0 -1
- package/dist/lib/agents.js.map +0 -1
- package/dist/lib/artifact-actions.d.ts.map +0 -1
- package/dist/lib/artifact-actions.js.map +0 -1
- package/dist/lib/commands.d.ts.map +0 -1
- package/dist/lib/commands.js.map +0 -1
- package/dist/lib/convert.d.ts.map +0 -1
- package/dist/lib/convert.js.map +0 -1
- package/dist/lib/daemon.d.ts.map +0 -1
- package/dist/lib/daemon.js.map +0 -1
- package/dist/lib/drive-sync.d.ts.map +0 -1
- package/dist/lib/drive-sync.js.map +0 -1
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/factory.d.ts +0 -57
- package/dist/lib/factory.d.ts.map +0 -1
- package/dist/lib/factory.js +0 -110
- package/dist/lib/factory.js.map +0 -1
- package/dist/lib/git.d.ts.map +0 -1
- package/dist/lib/git.js.map +0 -1
- package/dist/lib/help.d.ts.map +0 -1
- package/dist/lib/help.js.map +0 -1
- package/dist/lib/hooks.d.ts.map +0 -1
- package/dist/lib/hooks.js.map +0 -1
- package/dist/lib/manifest.d.ts.map +0 -1
- package/dist/lib/manifest.js.map +0 -1
- package/dist/lib/markdown.d.ts.map +0 -1
- package/dist/lib/markdown.js.map +0 -1
- package/dist/lib/mcp.d.ts.map +0 -1
- package/dist/lib/mcp.js.map +0 -1
- package/dist/lib/memory-compile.d.ts.map +0 -1
- package/dist/lib/memory-compile.js.map +0 -1
- package/dist/lib/memory.d.ts.map +0 -1
- package/dist/lib/memory.js.map +0 -1
- package/dist/lib/models.d.ts.map +0 -1
- package/dist/lib/models.js.map +0 -1
- package/dist/lib/permissions.d.ts.map +0 -1
- package/dist/lib/permissions.js.map +0 -1
- package/dist/lib/picker.d.ts.map +0 -1
- package/dist/lib/picker.js.map +0 -1
- package/dist/lib/plugins.d.ts.map +0 -1
- package/dist/lib/plugins.js.map +0 -1
- package/dist/lib/pty-client.d.ts.map +0 -1
- package/dist/lib/pty-client.js.map +0 -1
- package/dist/lib/pty-server.d.ts.map +0 -1
- package/dist/lib/pty-server.js.map +0 -1
- package/dist/lib/registry.d.ts.map +0 -1
- package/dist/lib/registry.js.map +0 -1
- package/dist/lib/resources.d.ts.map +0 -1
- package/dist/lib/resources.js.map +0 -1
- package/dist/lib/routines.d.ts.map +0 -1
- package/dist/lib/routines.js.map +0 -1
- package/dist/lib/runner.d.ts.map +0 -1
- package/dist/lib/runner.js.map +0 -1
- package/dist/lib/sandbox.d.ts.map +0 -1
- package/dist/lib/sandbox.js.map +0 -1
- package/dist/lib/scheduler.d.ts.map +0 -1
- package/dist/lib/scheduler.js.map +0 -1
- package/dist/lib/session/__tests__/db.test.d.ts +0 -2
- package/dist/lib/session/__tests__/db.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/db.test.js +0 -54
- package/dist/lib/session/__tests__/db.test.js.map +0 -1
- package/dist/lib/session/__tests__/discover.test.d.ts +0 -2
- package/dist/lib/session/__tests__/discover.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/discover.test.js +0 -63
- package/dist/lib/session/__tests__/discover.test.js.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.d.ts +0 -2
- package/dist/lib/session/__tests__/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/prompt.test.js +0 -44
- package/dist/lib/session/__tests__/prompt.test.js.map +0 -1
- package/dist/lib/session/__tests__/render.test.d.ts +0 -2
- package/dist/lib/session/__tests__/render.test.d.ts.map +0 -1
- package/dist/lib/session/__tests__/render.test.js +0 -602
- package/dist/lib/session/__tests__/render.test.js.map +0 -1
- package/dist/lib/session/db.d.ts.map +0 -1
- package/dist/lib/session/db.js.map +0 -1
- package/dist/lib/session/discover.d.ts.map +0 -1
- package/dist/lib/session/discover.js.map +0 -1
- package/dist/lib/session/parse.d.ts.map +0 -1
- package/dist/lib/session/parse.js.map +0 -1
- package/dist/lib/session/prompt.d.ts.map +0 -1
- package/dist/lib/session/prompt.js.map +0 -1
- package/dist/lib/session/prompt.test.d.ts +0 -2
- package/dist/lib/session/prompt.test.d.ts.map +0 -1
- package/dist/lib/session/prompt.test.js +0 -57
- package/dist/lib/session/prompt.test.js.map +0 -1
- package/dist/lib/session/render.d.ts.map +0 -1
- package/dist/lib/session/render.js.map +0 -1
- package/dist/lib/session/team-filter.d.ts.map +0 -1
- package/dist/lib/session/team-filter.js.map +0 -1
- package/dist/lib/session/team-filter.test.d.ts +0 -2
- package/dist/lib/session/team-filter.test.d.ts.map +0 -1
- package/dist/lib/session/team-filter.test.js +0 -157
- package/dist/lib/session/team-filter.test.js.map +0 -1
- package/dist/lib/session/types.d.ts.map +0 -1
- package/dist/lib/session/types.js.map +0 -1
- package/dist/lib/shims.d.ts.map +0 -1
- package/dist/lib/shims.js.map +0 -1
- package/dist/lib/skills.d.ts.map +0 -1
- package/dist/lib/skills.js.map +0 -1
- package/dist/lib/state.d.ts.map +0 -1
- package/dist/lib/state.js.map +0 -1
- package/dist/lib/subagents.d.ts.map +0 -1
- package/dist/lib/subagents.js.map +0 -1
- package/dist/lib/teams/agents.d.ts.map +0 -1
- package/dist/lib/teams/agents.js.map +0 -1
- package/dist/lib/teams/api.d.ts.map +0 -1
- package/dist/lib/teams/api.js.map +0 -1
- package/dist/lib/teams/cloud.d.ts +0 -11
- package/dist/lib/teams/cloud.d.ts.map +0 -1
- package/dist/lib/teams/cloud.js +0 -169
- package/dist/lib/teams/cloud.js.map +0 -1
- package/dist/lib/teams/debug.d.ts.map +0 -1
- package/dist/lib/teams/debug.js.map +0 -1
- package/dist/lib/teams/file_ops.d.ts.map +0 -1
- package/dist/lib/teams/file_ops.js.map +0 -1
- package/dist/lib/teams/parsers.d.ts.map +0 -1
- package/dist/lib/teams/parsers.js.map +0 -1
- package/dist/lib/teams/persistence.d.ts.map +0 -1
- package/dist/lib/teams/persistence.js.map +0 -1
- package/dist/lib/teams/ralph.d.ts +0 -8
- package/dist/lib/teams/ralph.d.ts.map +0 -1
- package/dist/lib/teams/ralph.js +0 -59
- package/dist/lib/teams/ralph.js.map +0 -1
- package/dist/lib/teams/registry.d.ts.map +0 -1
- package/dist/lib/teams/registry.js.map +0 -1
- package/dist/lib/teams/summarizer.d.ts.map +0 -1
- package/dist/lib/teams/summarizer.js.map +0 -1
- package/dist/lib/template.d.ts.map +0 -1
- package/dist/lib/template.js.map +0 -1
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/usage.d.ts.map +0 -1
- package/dist/lib/usage.js.map +0 -1
- package/dist/lib/versions.d.ts.map +0 -1
- package/dist/lib/versions.js.map +0 -1
- package/scripts/rebuild-sqlite.sh +0 -46
|
@@ -0,0 +1,570 @@
|
|
|
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 os from 'os';
|
|
6
|
+
import simpleGit from 'simple-git';
|
|
7
|
+
import { confirm, input } from '@inquirer/prompts';
|
|
8
|
+
import { isInteractiveTerminal, isPromptCancelled } from './utils.js';
|
|
9
|
+
const HOME = os.homedir();
|
|
10
|
+
/**
|
|
11
|
+
* Resolve a target argument to an absolute path.
|
|
12
|
+
* - No arg: ~/.agents/
|
|
13
|
+
* - Looks like a path (starts with /, ~, .): resolve as path
|
|
14
|
+
* - Otherwise: ~/.agents-{name}/
|
|
15
|
+
*/
|
|
16
|
+
function resolveRepoPath(target) {
|
|
17
|
+
if (!target)
|
|
18
|
+
return path.join(HOME, '.agents');
|
|
19
|
+
const trimmed = target.trim();
|
|
20
|
+
if (trimmed.startsWith('/') || trimmed.startsWith('~') || trimmed.startsWith('.')) {
|
|
21
|
+
return path.resolve(trimmed.replace(/^~/, HOME));
|
|
22
|
+
}
|
|
23
|
+
return path.join(HOME, `.agents-${trimmed}`);
|
|
24
|
+
}
|
|
25
|
+
import { ensureAgentsDir, getExtraRepoDir, getSystemAgentsDir, getUserAgentsDir, readMeta, resolveExtraRepoDir, updateMeta, } from '../lib/state.js';
|
|
26
|
+
import { parseSource, pullRepo, commitAndPush, isGitRepo, isSystemRepoOrigin } from '../lib/git.js';
|
|
27
|
+
import { DEFAULT_SYSTEM_REPO } from '../lib/types.js';
|
|
28
|
+
const ALIAS_PATTERN = /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,63}$/;
|
|
29
|
+
/** Derive a default alias from a source URL (e.g. gh:foo/.agents-work -> agents-work). */
|
|
30
|
+
function deriveAlias(source) {
|
|
31
|
+
const parsed = parseSource(source);
|
|
32
|
+
let base;
|
|
33
|
+
if (parsed.type === 'local') {
|
|
34
|
+
base = path.basename(parsed.url);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
const match = parsed.url.match(/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?$/);
|
|
38
|
+
base = match ? match[2] : parsed.url;
|
|
39
|
+
}
|
|
40
|
+
// Strip leading dots and any "agents-" prefix so the alias is short and
|
|
41
|
+
// becomes ~/.agents-<alias>/ on disk (e.g. ".agents-work" -> "work").
|
|
42
|
+
return base.replace(/^\.+/, '').replace(/^agents-/, '') || 'repo';
|
|
43
|
+
}
|
|
44
|
+
/** Get the last commit short hash for a repo, or null if unavailable. */
|
|
45
|
+
async function getShortCommit(repoDir) {
|
|
46
|
+
try {
|
|
47
|
+
const git = simpleGit(repoDir);
|
|
48
|
+
const log = await git.log({ maxCount: 1 });
|
|
49
|
+
return log.latest?.hash.slice(0, 8) || null;
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/** Register the `agents repo` command tree. */
|
|
56
|
+
export function registerRepoCommands(program) {
|
|
57
|
+
const repoCmd = program
|
|
58
|
+
.command('repo')
|
|
59
|
+
.description('Manage extra DotAgent repos alongside ~/.agents/ (for private or team skills)')
|
|
60
|
+
.addHelpText('after', `
|
|
61
|
+
Managed extras live at ~/.agents-<alias>/ as peer dirs to ~/.agents/. User-owned
|
|
62
|
+
repos can also live anywhere and be registered by path. Their skills, commands,
|
|
63
|
+
and hooks merge into agent version homes after the user repo's — so ~/.agents/
|
|
64
|
+
wins on name collisions.
|
|
65
|
+
|
|
66
|
+
Examples:
|
|
67
|
+
# Scaffold your own editable repo (default: ~/.agents/)
|
|
68
|
+
agents repo init
|
|
69
|
+
|
|
70
|
+
# Scaffold a named repo (creates ~/.agents-work/)
|
|
71
|
+
agents repo init work
|
|
72
|
+
|
|
73
|
+
# Scaffold at a custom path
|
|
74
|
+
agents repo init ~/my-agents
|
|
75
|
+
|
|
76
|
+
# Add a private repo for work-only skills
|
|
77
|
+
agents repo add gh:yourname/.agents-work
|
|
78
|
+
|
|
79
|
+
# Add with a custom alias
|
|
80
|
+
agents repo add git@github.com:acme/team-skills.git --as acme
|
|
81
|
+
|
|
82
|
+
# Show all registered repos
|
|
83
|
+
agents repo list
|
|
84
|
+
|
|
85
|
+
# Temporarily disable without deleting
|
|
86
|
+
agents repo disable acme
|
|
87
|
+
|
|
88
|
+
# Unregister it
|
|
89
|
+
agents repo remove acme
|
|
90
|
+
`);
|
|
91
|
+
repoCmd
|
|
92
|
+
.command('init [target]')
|
|
93
|
+
.description('Create a user-owned repo from a template and register it as an extra')
|
|
94
|
+
.option('--from <source>', 'Template repo to clone from', DEFAULT_SYSTEM_REPO)
|
|
95
|
+
.option('--as <alias>', 'Alias to register under (defaults to the directory name)')
|
|
96
|
+
.action(async (target, options) => {
|
|
97
|
+
let targetDir = resolveRepoPath(target);
|
|
98
|
+
if (!target && fs.existsSync(targetDir)) {
|
|
99
|
+
if (!isInteractiveTerminal()) {
|
|
100
|
+
console.log(chalk.red(`Path already exists: ${targetDir}`));
|
|
101
|
+
console.log(chalk.gray('Pass a name (e.g. `agents repo init work` -> ~/.agents-work) or a path.'));
|
|
102
|
+
process.exitCode = 1;
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
try {
|
|
106
|
+
const name = await input({
|
|
107
|
+
message: 'Name for your repo:',
|
|
108
|
+
default: 'work',
|
|
109
|
+
validate: (raw) => {
|
|
110
|
+
const v = raw.trim();
|
|
111
|
+
if (!v)
|
|
112
|
+
return 'Required';
|
|
113
|
+
if (!ALIAS_PATTERN.test(v))
|
|
114
|
+
return 'Letters, digits, "_" or "-"; must start with letter/digit';
|
|
115
|
+
const candidate = path.join(HOME, `.agents-${v}`);
|
|
116
|
+
if (fs.existsSync(candidate))
|
|
117
|
+
return `~/.agents-${v} already exists`;
|
|
118
|
+
return true;
|
|
119
|
+
},
|
|
120
|
+
theme: { prefix: chalk.gray('Will be created at $HOME/.agents-<name>/') },
|
|
121
|
+
});
|
|
122
|
+
targetDir = path.join(HOME, `.agents-${name.trim()}`);
|
|
123
|
+
}
|
|
124
|
+
catch (err) {
|
|
125
|
+
if (isPromptCancelled(err)) {
|
|
126
|
+
process.exit(130);
|
|
127
|
+
}
|
|
128
|
+
throw err;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
const alias = options.as ? options.as.trim() : (path.basename(targetDir).replace(/^\.+/, '') || 'repo');
|
|
132
|
+
if (!ALIAS_PATTERN.test(alias)) {
|
|
133
|
+
console.log(chalk.red(`Invalid alias "${alias}".`));
|
|
134
|
+
process.exitCode = 1;
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const meta = readMeta();
|
|
138
|
+
const extras = { ...(meta.extraRepos || {}) };
|
|
139
|
+
if (extras[alias]) {
|
|
140
|
+
console.log(chalk.red(`Alias "${alias}" is already registered.`));
|
|
141
|
+
process.exitCode = 1;
|
|
142
|
+
return;
|
|
143
|
+
}
|
|
144
|
+
if (fs.existsSync(targetDir)) {
|
|
145
|
+
console.log(chalk.red(`Path already exists: ${targetDir}`));
|
|
146
|
+
process.exitCode = 1;
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
149
|
+
const parsed = parseSource(options.from);
|
|
150
|
+
const spinner = ora(`Cloning ${options.from} into ${targetDir}...`).start();
|
|
151
|
+
try {
|
|
152
|
+
fs.mkdirSync(path.dirname(targetDir), { recursive: true });
|
|
153
|
+
await simpleGit().clone(parsed.url, targetDir);
|
|
154
|
+
await simpleGit(targetDir).removeRemote('origin');
|
|
155
|
+
const log = await simpleGit(targetDir).log({ maxCount: 1 });
|
|
156
|
+
const commit = log.latest?.hash.slice(0, 8) || 'unknown';
|
|
157
|
+
extras[alias] = { url: targetDir, path: targetDir, enabled: true };
|
|
158
|
+
updateMeta({ extraRepos: extras });
|
|
159
|
+
spinner.succeed(`Created ${targetDir} (${commit})`);
|
|
160
|
+
console.log(chalk.gray(`\nRegistered as "${alias}". Edit files there, then add your own git remote when ready.`));
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
spinner.fail(`Init failed: ${err.message}`);
|
|
164
|
+
try {
|
|
165
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
/* best-effort cleanup */
|
|
169
|
+
}
|
|
170
|
+
process.exitCode = 1;
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
repoCmd
|
|
174
|
+
.command('add <source>')
|
|
175
|
+
.description('Register an existing local repo or clone a remote repo into ~/.agents-<alias>/')
|
|
176
|
+
.option('--as <alias>', 'Override the auto-derived alias (letters, digits, _ or -)')
|
|
177
|
+
.action(async (source, options) => {
|
|
178
|
+
const meta = readMeta();
|
|
179
|
+
const extras = { ...(meta.extraRepos || {}) };
|
|
180
|
+
const alias = options.as ? options.as.trim() : deriveAlias(source);
|
|
181
|
+
if (!ALIAS_PATTERN.test(alias)) {
|
|
182
|
+
console.log(chalk.red(`Invalid alias "${alias}".`));
|
|
183
|
+
console.log(chalk.gray('Alias must start with a letter/digit and contain only letters, digits, "_" or "-".'));
|
|
184
|
+
process.exitCode = 1;
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (extras[alias]) {
|
|
188
|
+
console.log(chalk.red(`Alias "${alias}" is already registered.`));
|
|
189
|
+
console.log(chalk.gray(`Existing: ${extras[alias].url}`));
|
|
190
|
+
console.log(chalk.gray(`Use --as <other-alias>, or: agents repo remove ${alias}`));
|
|
191
|
+
process.exitCode = 1;
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
let parsed;
|
|
195
|
+
try {
|
|
196
|
+
parsed = parseSource(source);
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
console.log(chalk.red(err.message));
|
|
200
|
+
process.exitCode = 1;
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (parsed.type === 'local') {
|
|
204
|
+
extras[alias] = { url: parsed.url, path: parsed.url, enabled: true };
|
|
205
|
+
updateMeta({ extraRepos: extras });
|
|
206
|
+
console.log(chalk.green(`Registered local repo "${alias}" -> ${parsed.url}`));
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
ensureAgentsDir();
|
|
210
|
+
const targetDir = getExtraRepoDir(alias);
|
|
211
|
+
if (fs.existsSync(targetDir)) {
|
|
212
|
+
console.log(chalk.red(`Directory already exists: ${targetDir}`));
|
|
213
|
+
console.log(chalk.gray('Remove it manually or pick a different alias with --as.'));
|
|
214
|
+
process.exitCode = 1;
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
const spinner = ora(`Cloning ${source}...`).start();
|
|
218
|
+
try {
|
|
219
|
+
fs.mkdirSync(path.dirname(targetDir), { recursive: true });
|
|
220
|
+
await simpleGit().clone(parsed.url, targetDir);
|
|
221
|
+
if (parsed.ref) {
|
|
222
|
+
await simpleGit(targetDir).checkout(parsed.ref);
|
|
223
|
+
}
|
|
224
|
+
const log = await simpleGit(targetDir).log({ maxCount: 1 });
|
|
225
|
+
const commit = log.latest?.hash.slice(0, 8) || 'unknown';
|
|
226
|
+
spinner.succeed(`Cloned ${source} -> ${targetDir} (${commit})`);
|
|
227
|
+
}
|
|
228
|
+
catch (err) {
|
|
229
|
+
spinner.fail(`Clone failed: ${err.message}`);
|
|
230
|
+
try {
|
|
231
|
+
fs.rmSync(targetDir, { recursive: true, force: true });
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
/* best-effort cleanup */
|
|
235
|
+
}
|
|
236
|
+
process.exitCode = 1;
|
|
237
|
+
return;
|
|
238
|
+
}
|
|
239
|
+
extras[alias] = { url: parsed.url, path: targetDir, enabled: true };
|
|
240
|
+
updateMeta({ extraRepos: extras });
|
|
241
|
+
console.log(chalk.gray(`\nRegistered as "${alias}". Skills and commands from this repo will be`));
|
|
242
|
+
console.log(chalk.gray(`picked up automatically the next time you launch any agent.`));
|
|
243
|
+
});
|
|
244
|
+
repoCmd
|
|
245
|
+
.command('list')
|
|
246
|
+
.alias('ls')
|
|
247
|
+
.description('Show all repos: system, user, and any registered extras')
|
|
248
|
+
.action(async () => {
|
|
249
|
+
const meta = readMeta();
|
|
250
|
+
console.log('');
|
|
251
|
+
// System repo
|
|
252
|
+
const systemUrl = meta.source || DEFAULT_SYSTEM_REPO;
|
|
253
|
+
const systemDir = getSystemAgentsDir();
|
|
254
|
+
const systemOnDisk = fs.existsSync(systemDir);
|
|
255
|
+
const systemIsGit = systemOnDisk && isGitRepo(systemDir);
|
|
256
|
+
const systemCommit = systemIsGit ? await getShortCommit(systemDir) : null;
|
|
257
|
+
const systemStatus = !systemOnDisk
|
|
258
|
+
? chalk.red('missing')
|
|
259
|
+
: !systemIsGit
|
|
260
|
+
? chalk.yellow('not a git repo — run: agents init')
|
|
261
|
+
: chalk.green('cloned');
|
|
262
|
+
const systemCommitLabel = systemCommit ? chalk.gray(`(${systemCommit})`) : '';
|
|
263
|
+
console.log(chalk.bold('System (~/.agents-system/)'));
|
|
264
|
+
console.log(` ${chalk.cyan('system'.padEnd(12))} ${systemUrl} ${systemStatus} ${systemCommitLabel}`);
|
|
265
|
+
// User repo
|
|
266
|
+
const userDir = getUserAgentsDir();
|
|
267
|
+
const userOnDisk = fs.existsSync(userDir);
|
|
268
|
+
const userIsGit = userOnDisk && isGitRepo(userDir);
|
|
269
|
+
const userCommit = userIsGit ? await getShortCommit(userDir) : null;
|
|
270
|
+
let userRemoteUrl = '';
|
|
271
|
+
if (userIsGit) {
|
|
272
|
+
try {
|
|
273
|
+
const git = simpleGit(userDir);
|
|
274
|
+
const remotes = await git.getRemotes(true);
|
|
275
|
+
const origin = remotes.find(r => r.name === 'origin');
|
|
276
|
+
userRemoteUrl = origin?.refs?.fetch || '';
|
|
277
|
+
}
|
|
278
|
+
catch { /* no remote */ }
|
|
279
|
+
}
|
|
280
|
+
const userStatus = !userOnDisk
|
|
281
|
+
? chalk.gray('not created')
|
|
282
|
+
: !userIsGit
|
|
283
|
+
? chalk.gray('local (no remote)')
|
|
284
|
+
: chalk.green('cloned');
|
|
285
|
+
const userCommitLabel = userCommit ? chalk.gray(`(${userCommit})`) : '';
|
|
286
|
+
console.log(chalk.bold('\nUser (~/.agents/)'));
|
|
287
|
+
console.log(` ${chalk.cyan('user'.padEnd(12))} ${userRemoteUrl || '~/.agents/'} ${userStatus} ${userCommitLabel}`);
|
|
288
|
+
if (!userIsGit) {
|
|
289
|
+
console.log(chalk.gray(` ${''.padEnd(12)} scaffold one with: agents repo init`));
|
|
290
|
+
}
|
|
291
|
+
// Extra repos
|
|
292
|
+
const extras = meta.extraRepos || {};
|
|
293
|
+
const aliases = Object.keys(extras);
|
|
294
|
+
console.log(chalk.bold('\nExtras:'));
|
|
295
|
+
if (aliases.length === 0) {
|
|
296
|
+
console.log(chalk.gray(' (none — add one with `agents repo add <source>`)\n'));
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
for (const alias of aliases) {
|
|
300
|
+
const config = extras[alias];
|
|
301
|
+
const dir = resolveExtraRepoDir(alias, config);
|
|
302
|
+
const onDisk = fs.existsSync(dir);
|
|
303
|
+
const commit = onDisk ? await getShortCommit(dir) : null;
|
|
304
|
+
const status = !config.enabled
|
|
305
|
+
? chalk.yellow('disabled')
|
|
306
|
+
: !onDisk
|
|
307
|
+
? chalk.red('missing')
|
|
308
|
+
: chalk.green('enabled');
|
|
309
|
+
const commitLabel = commit ? chalk.gray(`(${commit})`) : '';
|
|
310
|
+
console.log(` ${chalk.cyan(alias.padEnd(12))} ${config.url} ${status} ${commitLabel}`);
|
|
311
|
+
}
|
|
312
|
+
console.log('');
|
|
313
|
+
});
|
|
314
|
+
repoCmd
|
|
315
|
+
.command('remove <alias>')
|
|
316
|
+
.alias('rm')
|
|
317
|
+
.description('Unregister an extra repo. Managed clones are deleted; external paths are kept.')
|
|
318
|
+
.action(async (alias) => {
|
|
319
|
+
const meta = readMeta();
|
|
320
|
+
const extras = { ...(meta.extraRepos || {}) };
|
|
321
|
+
if (!extras[alias]) {
|
|
322
|
+
console.log(chalk.red(`No extra repo registered as "${alias}".`));
|
|
323
|
+
process.exitCode = 1;
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
const dir = resolveExtraRepoDir(alias, extras[alias]);
|
|
327
|
+
// Managed clones live at the default ~/.agents-<alias>/ — those we own
|
|
328
|
+
// and should delete on remove. Anything else is user-owned, leave alone.
|
|
329
|
+
const isManagedClone = path.resolve(dir) === path.resolve(getExtraRepoDir(alias));
|
|
330
|
+
try {
|
|
331
|
+
if (isManagedClone && fs.existsSync(dir)) {
|
|
332
|
+
fs.rmSync(dir, { recursive: true, force: true });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
catch (err) {
|
|
336
|
+
console.log(chalk.yellow(`Warning: could not delete ${dir}: ${err.message}`));
|
|
337
|
+
}
|
|
338
|
+
delete extras[alias];
|
|
339
|
+
updateMeta({ extraRepos: extras });
|
|
340
|
+
console.log(chalk.green(`Removed "${alias}"`));
|
|
341
|
+
});
|
|
342
|
+
repoCmd
|
|
343
|
+
.command('enable <alias>')
|
|
344
|
+
.description('Re-enable a previously disabled extra repo')
|
|
345
|
+
.action(async (alias) => {
|
|
346
|
+
await toggle(alias, true);
|
|
347
|
+
});
|
|
348
|
+
repoCmd
|
|
349
|
+
.command('disable <alias>')
|
|
350
|
+
.description('Stop merging this repo during sync without deleting the clone')
|
|
351
|
+
.action(async (alias) => {
|
|
352
|
+
await toggle(alias, false);
|
|
353
|
+
});
|
|
354
|
+
repoCmd
|
|
355
|
+
.command('pull [alias]')
|
|
356
|
+
.description('Pull updates. Aliases: "system" (~/.agents-system/), "user" (~/.agents/), or any registered extra. No arg pulls all.')
|
|
357
|
+
.action(async (alias) => {
|
|
358
|
+
const targets = collectRepoTargets(alias);
|
|
359
|
+
if (!targets) {
|
|
360
|
+
process.exitCode = 1;
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
if (targets.length === 0) {
|
|
364
|
+
console.log(chalk.gray('No repos to pull.'));
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
for (const t of targets) {
|
|
368
|
+
if (!fs.existsSync(t.dir) || !isGitRepo(t.dir)) {
|
|
369
|
+
console.log(chalk.yellow(` ${t.alias}: not a git repo, skipping`));
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
if (t.alias === 'system') {
|
|
373
|
+
// Skip system repo unless explicitly requested
|
|
374
|
+
if (alias !== 'system')
|
|
375
|
+
continue;
|
|
376
|
+
// User explicitly asked for system repo — show status and offer to pull
|
|
377
|
+
try {
|
|
378
|
+
const git = simpleGit(t.dir);
|
|
379
|
+
await git.fetch();
|
|
380
|
+
const status = await git.status();
|
|
381
|
+
const behind = status.behind ?? 0;
|
|
382
|
+
if (behind === 0) {
|
|
383
|
+
console.log(chalk.green('Up to date'));
|
|
384
|
+
}
|
|
385
|
+
else {
|
|
386
|
+
// Count changed resources by type
|
|
387
|
+
const diff = await git.diff(['--name-only', 'HEAD..@{upstream}']);
|
|
388
|
+
const files = diff.split('\n').filter(Boolean);
|
|
389
|
+
const counts = {};
|
|
390
|
+
for (const f of files) {
|
|
391
|
+
if (f.startsWith('skills/'))
|
|
392
|
+
counts['skills'] = (counts['skills'] || 0) + 1;
|
|
393
|
+
else if (f.startsWith('commands/'))
|
|
394
|
+
counts['commands'] = (counts['commands'] || 0) + 1;
|
|
395
|
+
else if (f.startsWith('hooks/'))
|
|
396
|
+
counts['hooks'] = (counts['hooks'] || 0) + 1;
|
|
397
|
+
else if (f.startsWith('rules/'))
|
|
398
|
+
counts['rules'] = (counts['rules'] || 0) + 1;
|
|
399
|
+
else
|
|
400
|
+
counts['other'] = (counts['other'] || 0) + 1;
|
|
401
|
+
}
|
|
402
|
+
const parts = [];
|
|
403
|
+
if (counts['skills'])
|
|
404
|
+
parts.push(`${counts['skills']} skill${counts['skills'] > 1 ? 's' : ''}`);
|
|
405
|
+
if (counts['commands'])
|
|
406
|
+
parts.push(`${counts['commands']} command${counts['commands'] > 1 ? 's' : ''}`);
|
|
407
|
+
if (counts['hooks'])
|
|
408
|
+
parts.push(`${counts['hooks']} hook${counts['hooks'] > 1 ? 's' : ''}`);
|
|
409
|
+
if (counts['rules'])
|
|
410
|
+
parts.push(`${counts['rules']} rule${counts['rules'] > 1 ? 's' : ''}`);
|
|
411
|
+
if (counts['other'])
|
|
412
|
+
parts.push(`${counts['other']} other`);
|
|
413
|
+
const summary = parts.length > 0 ? parts.join(', ') : `${behind} update${behind > 1 ? 's' : ''}`;
|
|
414
|
+
console.log(chalk.yellow(`${summary} available`));
|
|
415
|
+
if (isInteractiveTerminal()) {
|
|
416
|
+
const doPull = await confirm({ message: 'Pull now?', default: true });
|
|
417
|
+
if (doPull) {
|
|
418
|
+
const result = await pullRepo(t.dir);
|
|
419
|
+
if (result.success) {
|
|
420
|
+
console.log(chalk.green('Updated'));
|
|
421
|
+
}
|
|
422
|
+
else {
|
|
423
|
+
console.log(chalk.red(result.error || 'Pull failed'));
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
catch (err) {
|
|
430
|
+
console.log(chalk.red(err.message));
|
|
431
|
+
}
|
|
432
|
+
continue;
|
|
433
|
+
}
|
|
434
|
+
const spinner = ora(`Pulling ${t.alias}...`).start();
|
|
435
|
+
const result = await pullRepo(t.dir);
|
|
436
|
+
if (result.success) {
|
|
437
|
+
spinner.succeed(`${t.alias} -> ${result.commit}`);
|
|
438
|
+
}
|
|
439
|
+
else {
|
|
440
|
+
spinner.fail(`${t.alias}: ${result.error}`);
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
repoCmd
|
|
445
|
+
.command('push [alias]')
|
|
446
|
+
.description('Commit and push the user repo or a user-owned extra. Refuses to push the system repo.')
|
|
447
|
+
.option('-m, --message <msg>', 'Commit message', 'Update via agents repo push')
|
|
448
|
+
.action(async (alias, options) => {
|
|
449
|
+
const targets = collectRepoTargets(alias);
|
|
450
|
+
if (!targets) {
|
|
451
|
+
process.exitCode = 1;
|
|
452
|
+
return;
|
|
453
|
+
}
|
|
454
|
+
// Drop system-repo targets — read-only by design.
|
|
455
|
+
const pushable = [];
|
|
456
|
+
for (const t of targets) {
|
|
457
|
+
if (t.alias === 'system') {
|
|
458
|
+
console.log(chalk.yellow('Skipping system repo (read-only — managed via the agents-cli upstream).'));
|
|
459
|
+
continue;
|
|
460
|
+
}
|
|
461
|
+
if (!fs.existsSync(t.dir) || !isGitRepo(t.dir)) {
|
|
462
|
+
console.log(chalk.yellow(` ${t.alias}: not a git repo, skipping`));
|
|
463
|
+
continue;
|
|
464
|
+
}
|
|
465
|
+
// Defense in depth: refuse if origin happens to be the system upstream.
|
|
466
|
+
if (await isSystemRepoOrigin(t.dir)) {
|
|
467
|
+
console.log(chalk.red(` ${t.alias}: origin tracks the system repo — refusing to push.`));
|
|
468
|
+
continue;
|
|
469
|
+
}
|
|
470
|
+
pushable.push(t);
|
|
471
|
+
}
|
|
472
|
+
if (pushable.length === 0) {
|
|
473
|
+
console.log(chalk.gray('No pushable repos.'));
|
|
474
|
+
return;
|
|
475
|
+
}
|
|
476
|
+
for (const t of pushable) {
|
|
477
|
+
const spinner = ora(`Pushing ${t.alias}...`).start();
|
|
478
|
+
const result = await commitAndPush(t.dir, options.message);
|
|
479
|
+
if (result.success) {
|
|
480
|
+
spinner.succeed(`${t.alias} pushed`);
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
spinner.fail(`${t.alias}: ${result.error}`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
});
|
|
487
|
+
repoCmd
|
|
488
|
+
.command('status [alias]')
|
|
489
|
+
.description('Per-repo summary: branch, ahead/behind upstream, working-tree state')
|
|
490
|
+
.action(async (alias) => {
|
|
491
|
+
const targets = collectRepoTargets(alias) || [];
|
|
492
|
+
if (targets.length === 0) {
|
|
493
|
+
console.log(chalk.gray('No git repos found.'));
|
|
494
|
+
return;
|
|
495
|
+
}
|
|
496
|
+
console.log('');
|
|
497
|
+
console.log(` ${chalk.gray('REPO'.padEnd(12))} ${chalk.gray('BRANCH'.padEnd(28))} ${chalk.gray('REMOTE'.padEnd(12))} ${chalk.gray('LOCAL')}`);
|
|
498
|
+
for (const t of targets) {
|
|
499
|
+
if (!fs.existsSync(t.dir)) {
|
|
500
|
+
console.log(` ${chalk.cyan(t.alias.padEnd(12))} ${chalk.red('missing')} ${chalk.gray(t.dir)}`);
|
|
501
|
+
continue;
|
|
502
|
+
}
|
|
503
|
+
if (!isGitRepo(t.dir)) {
|
|
504
|
+
console.log(` ${chalk.cyan(t.alias.padEnd(12))} ${chalk.gray('not a git repo')} ${chalk.gray(t.dir)}`);
|
|
505
|
+
continue;
|
|
506
|
+
}
|
|
507
|
+
try {
|
|
508
|
+
const git = simpleGit(t.dir);
|
|
509
|
+
const status = await git.status();
|
|
510
|
+
const branch = status.tracking || status.current || '(detached)';
|
|
511
|
+
const remoteRaw = (status.ahead ?? 0) === 0 && (status.behind ?? 0) === 0
|
|
512
|
+
? 'in sync'
|
|
513
|
+
: `+${status.ahead ?? 0} -${status.behind ?? 0}`;
|
|
514
|
+
const remoteColored = (status.ahead ?? 0) === 0 && (status.behind ?? 0) === 0
|
|
515
|
+
? chalk.green(remoteRaw)
|
|
516
|
+
: chalk.yellow(remoteRaw);
|
|
517
|
+
const tree = status.isClean()
|
|
518
|
+
? chalk.green('clean')
|
|
519
|
+
: chalk.yellow(`${status.files.length} uncommitted`);
|
|
520
|
+
const remotePad = ' '.repeat(Math.max(0, 12 - remoteRaw.length));
|
|
521
|
+
console.log(` ${chalk.cyan(t.alias.padEnd(12))} ${branch.padEnd(28)} ${remoteColored}${remotePad} ${tree}`);
|
|
522
|
+
}
|
|
523
|
+
catch (err) {
|
|
524
|
+
console.log(` ${chalk.cyan(t.alias.padEnd(12))} ${chalk.red('error')} ${err.message}`);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
console.log('');
|
|
528
|
+
});
|
|
529
|
+
}
|
|
530
|
+
/**
|
|
531
|
+
* Resolve an alias (or undefined for "all") to a list of repo targets.
|
|
532
|
+
* Returns null when a named alias isn't found (callers should set exit code).
|
|
533
|
+
*/
|
|
534
|
+
function collectRepoTargets(alias) {
|
|
535
|
+
const meta = readMeta();
|
|
536
|
+
const extras = meta.extraRepos || {};
|
|
537
|
+
const all = [
|
|
538
|
+
{ alias: 'system', dir: getSystemAgentsDir() },
|
|
539
|
+
{ alias: 'user', dir: getUserAgentsDir() },
|
|
540
|
+
...Object.keys(extras)
|
|
541
|
+
.filter((a) => extras[a].enabled)
|
|
542
|
+
.map((a) => ({ alias: a, dir: resolveExtraRepoDir(a, extras[a]) })),
|
|
543
|
+
];
|
|
544
|
+
if (!alias)
|
|
545
|
+
return all;
|
|
546
|
+
const found = all.find((t) => t.alias === alias) || (extras[alias]
|
|
547
|
+
? { alias, dir: resolveExtraRepoDir(alias, extras[alias]) }
|
|
548
|
+
: null);
|
|
549
|
+
if (!found) {
|
|
550
|
+
console.log(chalk.red(`Unknown repo "${alias}". Use "system", "user", or a registered extra alias.`));
|
|
551
|
+
return null;
|
|
552
|
+
}
|
|
553
|
+
return [found];
|
|
554
|
+
}
|
|
555
|
+
async function toggle(alias, enabled) {
|
|
556
|
+
const meta = readMeta();
|
|
557
|
+
const extras = { ...(meta.extraRepos || {}) };
|
|
558
|
+
if (!extras[alias]) {
|
|
559
|
+
console.log(chalk.red(`No extra repo registered as "${alias}".`));
|
|
560
|
+
process.exitCode = 1;
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
if (extras[alias].enabled === enabled) {
|
|
564
|
+
console.log(chalk.gray(`"${alias}" is already ${enabled ? 'enabled' : 'disabled'}.`));
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
extras[alias] = { ...extras[alias], enabled };
|
|
568
|
+
updateMeta({ extraRepos: extras });
|
|
569
|
+
console.log(chalk.green(`${enabled ? 'Enabled' : 'Disabled'} "${alias}"`));
|
|
570
|
+
}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared resource list and detail view.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable picker (TTY) / table (piped) presentation layer
|
|
5
|
+
* for resource-type commands (plugins, subagents, skills, etc.). Each
|
|
6
|
+
* resource supplies rows with sync targets; this module handles layout,
|
|
7
|
+
* filtering, and paging.
|
|
8
|
+
*/
|
|
1
9
|
import type { AgentId } from '../lib/types.js';
|
|
2
10
|
export type SyncStatus = 'synced' | 'stale' | 'missing';
|
|
3
11
|
export interface SyncTarget {
|
|
@@ -24,8 +32,7 @@ export interface ResourceViewOptions {
|
|
|
24
32
|
filterAgent?: AgentId;
|
|
25
33
|
filterVersion?: string;
|
|
26
34
|
}
|
|
27
|
-
/**
|
|
35
|
+
/** Display a resource list: interactive picker in TTY mode, plain table otherwise. */
|
|
28
36
|
export declare function showResourceList(opts: ResourceViewOptions): Promise<void>;
|
|
29
|
-
/** Build the
|
|
37
|
+
/** Build the sync targets section showing version pills grouped by agent. */
|
|
30
38
|
export declare function buildTargetsSection(targets: SyncTarget[]): string;
|
|
31
|
-
//# sourceMappingURL=resource-view.d.ts.map
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared resource list and detail view.
|
|
3
|
+
*
|
|
4
|
+
* Provides a reusable picker (TTY) / table (piped) presentation layer
|
|
5
|
+
* for resource-type commands (plugins, subagents, skills, etc.). Each
|
|
6
|
+
* resource supplies rows with sync targets; this module handles layout,
|
|
7
|
+
* filtering, and paging.
|
|
8
|
+
*/
|
|
1
9
|
import chalk from 'chalk';
|
|
2
10
|
import { agentLabel } from '../lib/agents.js';
|
|
3
11
|
import { itemPicker } from '../lib/picker.js';
|
|
4
12
|
import { isInteractiveTerminal, isPromptCancelled, printWithPager } from './utils.js';
|
|
5
|
-
/**
|
|
13
|
+
/** Display a resource list: interactive picker in TTY mode, plain table otherwise. */
|
|
6
14
|
export async function showResourceList(opts) {
|
|
7
15
|
if (opts.rows.length === 0) {
|
|
8
16
|
console.log(chalk.gray(opts.emptyMessage));
|
|
@@ -37,6 +45,7 @@ export async function showResourceList(opts) {
|
|
|
37
45
|
const lines = detail.split('\n');
|
|
38
46
|
printWithPager(detail, lines.length);
|
|
39
47
|
}
|
|
48
|
+
/** Build the prompt message shown above the picker, including any scope label. */
|
|
40
49
|
function buildPickerMessage(opts) {
|
|
41
50
|
const scope = opts.filterVersion
|
|
42
51
|
? ` (${opts.filterAgent}@${opts.filterVersion})`
|
|
@@ -45,6 +54,7 @@ function buildPickerMessage(opts) {
|
|
|
45
54
|
: '';
|
|
46
55
|
return `Search ${opts.resourcePlural}${scope}:`;
|
|
47
56
|
}
|
|
57
|
+
/** Filter rows by a case-insensitive substring match on name or description. */
|
|
48
58
|
function filterRows(rows, query) {
|
|
49
59
|
const q = query.trim().toLowerCase();
|
|
50
60
|
if (!q)
|
|
@@ -63,7 +73,7 @@ function formatPickerRow(row, opts) {
|
|
|
63
73
|
const sync = formatSyncSummary(row.targets, opts);
|
|
64
74
|
return `${name} ${extra}${desc} ${sync}`;
|
|
65
75
|
}
|
|
66
|
-
/**
|
|
76
|
+
/** Render resources as a plain-text table (used when output is piped). */
|
|
67
77
|
function printResourceTable(opts) {
|
|
68
78
|
const header = buildTableHeader(opts);
|
|
69
79
|
console.log(header);
|
|
@@ -87,6 +97,7 @@ function printResourceTable(opts) {
|
|
|
87
97
|
}
|
|
88
98
|
console.log(chalk.gray(summary.join(' · ')));
|
|
89
99
|
}
|
|
100
|
+
/** Build the column header line for the plain-text table. */
|
|
90
101
|
function buildTableHeader(opts) {
|
|
91
102
|
const name = chalk.bold(padRight('Name', 22));
|
|
92
103
|
const extra = opts.extraLabel
|
|
@@ -96,7 +107,7 @@ function buildTableHeader(opts) {
|
|
|
96
107
|
const sync = chalk.bold('Synced');
|
|
97
108
|
return `${name} ${extra}${desc} ${sync}`;
|
|
98
109
|
}
|
|
99
|
-
/**
|
|
110
|
+
/** Compact sync summary: "everywhere", "14 of 16 installs", or "not installed". */
|
|
100
111
|
function formatSyncSummary(targets, opts) {
|
|
101
112
|
if (targets.length === 0) {
|
|
102
113
|
return chalk.gray('no installed versions');
|
|
@@ -137,7 +148,7 @@ function formatSyncSummary(targets, opts) {
|
|
|
137
148
|
}
|
|
138
149
|
return parts.join(chalk.gray(' · '));
|
|
139
150
|
}
|
|
140
|
-
/** Build the
|
|
151
|
+
/** Build the sync targets section showing version pills grouped by agent. */
|
|
141
152
|
export function buildTargetsSection(targets) {
|
|
142
153
|
if (targets.length === 0)
|
|
143
154
|
return chalk.gray(' No capable agent versions installed.');
|
|
@@ -156,6 +167,7 @@ export function buildTargetsSection(targets) {
|
|
|
156
167
|
}
|
|
157
168
|
return lines.join('\n');
|
|
158
169
|
}
|
|
170
|
+
/** Render a single version as a colored pill (green/yellow/strikethrough). */
|
|
159
171
|
function formatVersionPill(t) {
|
|
160
172
|
const star = t.isDefault ? chalk.yellow('★ ') : '';
|
|
161
173
|
const vtxt = `v${t.version}`;
|
|
@@ -168,6 +180,7 @@ function formatVersionPill(t) {
|
|
|
168
180
|
return star + chalk.gray.strikethrough(vtxt);
|
|
169
181
|
}
|
|
170
182
|
}
|
|
183
|
+
/** Pad a string to a fixed width, accounting for ANSI escape codes in length calculation. */
|
|
171
184
|
function padRight(s, width) {
|
|
172
185
|
// Strip ANSI for length calc
|
|
173
186
|
const raw = s.replace(/\x1b\[[0-9;]*m/g, '');
|
|
@@ -175,9 +188,9 @@ function padRight(s, width) {
|
|
|
175
188
|
return s;
|
|
176
189
|
return s + ' '.repeat(width - raw.length);
|
|
177
190
|
}
|
|
191
|
+
/** Truncate a string to a maximum length, appending an ellipsis if needed. */
|
|
178
192
|
function truncate(s, max) {
|
|
179
193
|
if (s.length <= max)
|
|
180
194
|
return s;
|
|
181
195
|
return s.slice(0, max - 1) + '…';
|
|
182
196
|
}
|
|
183
|
-
//# sourceMappingURL=resource-view.js.map
|