@ag-eco/agentplate-cli 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +462 -0
- package/agents/ap-co-creation.md +90 -0
- package/agents/builder.md +144 -0
- package/agents/coordinator.md +377 -0
- package/agents/lead.md +435 -0
- package/agents/merger.md +164 -0
- package/agents/monitor.md +214 -0
- package/agents/orchestrator.md +239 -0
- package/agents/reviewer.md +140 -0
- package/agents/scout.md +125 -0
- package/agents/supervisor.md +427 -0
- package/package.json +66 -0
- package/src/agents/capabilities.test.ts +85 -0
- package/src/agents/capabilities.ts +125 -0
- package/src/agents/checkpoint.test.ts +88 -0
- package/src/agents/checkpoint.ts +101 -0
- package/src/agents/copilot-hooks-deployer.test.ts +162 -0
- package/src/agents/copilot-hooks-deployer.ts +93 -0
- package/src/agents/guard-rules.test.ts +372 -0
- package/src/agents/guard-rules.ts +97 -0
- package/src/agents/headless-mail-injector.test.ts +709 -0
- package/src/agents/headless-mail-injector.ts +377 -0
- package/src/agents/headless-prompt.test.ts +102 -0
- package/src/agents/headless-prompt.ts +68 -0
- package/src/agents/hooks-deployer.test.ts +3119 -0
- package/src/agents/hooks-deployer.ts +804 -0
- package/src/agents/identity.test.ts +604 -0
- package/src/agents/identity.ts +384 -0
- package/src/agents/lifecycle.test.ts +196 -0
- package/src/agents/lifecycle.ts +183 -0
- package/src/agents/mail-poll-detect.test.ts +153 -0
- package/src/agents/mail-poll-detect.ts +73 -0
- package/src/agents/manifest.test.ts +1026 -0
- package/src/agents/manifest.ts +376 -0
- package/src/agents/overlay.test.ts +1058 -0
- package/src/agents/overlay.ts +490 -0
- package/src/agents/scope-detect.test.ts +190 -0
- package/src/agents/scope-detect.ts +146 -0
- package/src/agents/turn-lock.test.ts +181 -0
- package/src/agents/turn-lock.ts +235 -0
- package/src/agents/turn-runner-dispatch.test.ts +182 -0
- package/src/agents/turn-runner-dispatch.ts +105 -0
- package/src/agents/turn-runner.test.ts +2312 -0
- package/src/agents/turn-runner.ts +1383 -0
- package/src/beads/client.test.ts +217 -0
- package/src/beads/client.ts +230 -0
- package/src/beads/molecules.test.ts +338 -0
- package/src/beads/molecules.ts +198 -0
- package/src/commands/agents.test.ts +328 -0
- package/src/commands/agents.ts +299 -0
- package/src/commands/clean.test.ts +797 -0
- package/src/commands/clean.ts +791 -0
- package/src/commands/completions.test.ts +348 -0
- package/src/commands/completions.ts +981 -0
- package/src/commands/coordinator.test.ts +2975 -0
- package/src/commands/coordinator.ts +1841 -0
- package/src/commands/costs.test.ts +1183 -0
- package/src/commands/costs.ts +599 -0
- package/src/commands/dashboard.test.ts +954 -0
- package/src/commands/dashboard.ts +1212 -0
- package/src/commands/discover.test.ts +288 -0
- package/src/commands/discover.ts +202 -0
- package/src/commands/doctor.test.ts +303 -0
- package/src/commands/doctor.ts +311 -0
- package/src/commands/ecosystem.test.ts +226 -0
- package/src/commands/ecosystem.ts +248 -0
- package/src/commands/errors.test.ts +654 -0
- package/src/commands/errors.ts +197 -0
- package/src/commands/feed.test.ts +709 -0
- package/src/commands/feed.ts +260 -0
- package/src/commands/group.test.ts +475 -0
- package/src/commands/group.ts +546 -0
- package/src/commands/hooks.test.ts +458 -0
- package/src/commands/hooks.ts +263 -0
- package/src/commands/init.test.ts +1011 -0
- package/src/commands/init.ts +967 -0
- package/src/commands/inspect.test.ts +1239 -0
- package/src/commands/inspect.ts +648 -0
- package/src/commands/log.test.ts +1913 -0
- package/src/commands/log.ts +958 -0
- package/src/commands/logs.test.ts +801 -0
- package/src/commands/logs.ts +483 -0
- package/src/commands/mail.test.ts +1501 -0
- package/src/commands/mail.ts +848 -0
- package/src/commands/merge.test.ts +864 -0
- package/src/commands/merge.ts +381 -0
- package/src/commands/metrics.test.ts +458 -0
- package/src/commands/metrics.ts +129 -0
- package/src/commands/monitor.test.ts +191 -0
- package/src/commands/monitor.ts +409 -0
- package/src/commands/nudge.test.ts +579 -0
- package/src/commands/nudge.ts +646 -0
- package/src/commands/orchestrator.ts +42 -0
- package/src/commands/prime.test.ts +612 -0
- package/src/commands/prime.ts +359 -0
- package/src/commands/replay.test.ts +757 -0
- package/src/commands/replay.ts +231 -0
- package/src/commands/run.test.ts +469 -0
- package/src/commands/run.ts +353 -0
- package/src/commands/serve/agent-actions.test.ts +210 -0
- package/src/commands/serve/agent-actions.ts +192 -0
- package/src/commands/serve/build.test.ts +202 -0
- package/src/commands/serve/build.ts +206 -0
- package/src/commands/serve/coordinator-actions.test.ts +339 -0
- package/src/commands/serve/coordinator-actions.ts +410 -0
- package/src/commands/serve/dev.test.ts +168 -0
- package/src/commands/serve/dev.ts +117 -0
- package/src/commands/serve/mail-actions.test.ts +312 -0
- package/src/commands/serve/mail-actions.ts +167 -0
- package/src/commands/serve/rest.test.ts +1680 -0
- package/src/commands/serve/rest.ts +1130 -0
- package/src/commands/serve/static.ts +51 -0
- package/src/commands/serve/ws.test.ts +361 -0
- package/src/commands/serve/ws.ts +332 -0
- package/src/commands/serve.test.ts +459 -0
- package/src/commands/serve.ts +654 -0
- package/src/commands/sling.test.ts +1583 -0
- package/src/commands/sling.ts +1351 -0
- package/src/commands/spec.test.ts +179 -0
- package/src/commands/spec.ts +105 -0
- package/src/commands/status.test.ts +614 -0
- package/src/commands/status.ts +403 -0
- package/src/commands/stop.test.ts +964 -0
- package/src/commands/stop.ts +319 -0
- package/src/commands/supervisor.test.ts +185 -0
- package/src/commands/supervisor.ts +537 -0
- package/src/commands/trace.test.ts +762 -0
- package/src/commands/trace.ts +205 -0
- package/src/commands/update.test.ts +466 -0
- package/src/commands/update.ts +263 -0
- package/src/commands/upgrade.test.ts +48 -0
- package/src/commands/upgrade.ts +240 -0
- package/src/commands/watch.test.ts +257 -0
- package/src/commands/watch.ts +308 -0
- package/src/commands/worktree.test.ts +1297 -0
- package/src/commands/worktree.ts +451 -0
- package/src/config.test.ts +1535 -0
- package/src/config.ts +1064 -0
- package/src/doctor/agents.test.ts +523 -0
- package/src/doctor/agents.ts +399 -0
- package/src/doctor/config-check.test.ts +191 -0
- package/src/doctor/config-check.ts +183 -0
- package/src/doctor/consistency.test.ts +807 -0
- package/src/doctor/consistency.ts +347 -0
- package/src/doctor/databases.test.ts +350 -0
- package/src/doctor/databases.ts +243 -0
- package/src/doctor/dependencies.test.ts +296 -0
- package/src/doctor/dependencies.ts +272 -0
- package/src/doctor/ecosystem.test.ts +308 -0
- package/src/doctor/ecosystem.ts +156 -0
- package/src/doctor/logs.test.ts +253 -0
- package/src/doctor/logs.ts +295 -0
- package/src/doctor/merge-queue.test.ts +315 -0
- package/src/doctor/merge-queue.ts +167 -0
- package/src/doctor/providers.test.ts +409 -0
- package/src/doctor/providers.ts +250 -0
- package/src/doctor/serve.test.ts +95 -0
- package/src/doctor/serve.ts +86 -0
- package/src/doctor/structure.test.ts +423 -0
- package/src/doctor/structure.ts +285 -0
- package/src/doctor/types.ts +43 -0
- package/src/doctor/version.test.ts +241 -0
- package/src/doctor/version.ts +132 -0
- package/src/doctor/watchdog.test.ts +167 -0
- package/src/doctor/watchdog.ts +214 -0
- package/src/e2e/init-sling-lifecycle.test.ts +283 -0
- package/src/errors.test.ts +350 -0
- package/src/errors.ts +217 -0
- package/src/events/store.test.ts +660 -0
- package/src/events/store.ts +369 -0
- package/src/events/tailer.test.ts +719 -0
- package/src/events/tailer.ts +332 -0
- package/src/events/tool-filter.test.ts +330 -0
- package/src/events/tool-filter.ts +126 -0
- package/src/index.ts +533 -0
- package/src/insights/analyzer.test.ts +466 -0
- package/src/insights/analyzer.ts +203 -0
- package/src/insights/quality-gates.test.ts +141 -0
- package/src/insights/quality-gates.ts +156 -0
- package/src/json.test.ts +72 -0
- package/src/json.ts +53 -0
- package/src/loam/client.test.ts +752 -0
- package/src/loam/client.ts +664 -0
- package/src/logging/color.test.ts +252 -0
- package/src/logging/color.ts +105 -0
- package/src/logging/format.test.ts +110 -0
- package/src/logging/format.ts +255 -0
- package/src/logging/logger.test.ts +814 -0
- package/src/logging/logger.ts +266 -0
- package/src/logging/reporter.test.ts +259 -0
- package/src/logging/reporter.ts +110 -0
- package/src/logging/sanitizer.test.ts +190 -0
- package/src/logging/sanitizer.ts +57 -0
- package/src/logging/theme.ts +140 -0
- package/src/mail/broadcast.test.ts +204 -0
- package/src/mail/broadcast.ts +92 -0
- package/src/mail/client.test.ts +774 -0
- package/src/mail/client.ts +236 -0
- package/src/mail/store.test.ts +898 -0
- package/src/mail/store.ts +425 -0
- package/src/merge/lock.test.ts +149 -0
- package/src/merge/lock.ts +140 -0
- package/src/merge/predict.test.ts +387 -0
- package/src/merge/predict.ts +249 -0
- package/src/merge/queue.test.ts +426 -0
- package/src/merge/queue.ts +246 -0
- package/src/merge/resolver.test.ts +1993 -0
- package/src/merge/resolver.ts +926 -0
- package/src/metrics/pricing.test.ts +258 -0
- package/src/metrics/pricing.ts +135 -0
- package/src/metrics/store.test.ts +978 -0
- package/src/metrics/store.ts +501 -0
- package/src/metrics/summary.test.ts +398 -0
- package/src/metrics/summary.ts +178 -0
- package/src/metrics/transcript.test.ts +483 -0
- package/src/metrics/transcript.ts +114 -0
- package/src/runtimes/__fixtures__/claude-stream-fixture.ts +22 -0
- package/src/runtimes/aider.test.ts +124 -0
- package/src/runtimes/aider.ts +147 -0
- package/src/runtimes/amp.test.ts +164 -0
- package/src/runtimes/amp.ts +154 -0
- package/src/runtimes/claude.test.ts +1474 -0
- package/src/runtimes/claude.ts +579 -0
- package/src/runtimes/codex.test.ts +805 -0
- package/src/runtimes/codex.ts +273 -0
- package/src/runtimes/connections.test.ts +214 -0
- package/src/runtimes/connections.ts +103 -0
- package/src/runtimes/copilot.test.ts +707 -0
- package/src/runtimes/copilot.ts +316 -0
- package/src/runtimes/cursor.test.ts +497 -0
- package/src/runtimes/cursor.ts +205 -0
- package/src/runtimes/gemini.test.ts +537 -0
- package/src/runtimes/gemini.ts +243 -0
- package/src/runtimes/goose.test.ts +133 -0
- package/src/runtimes/goose.ts +157 -0
- package/src/runtimes/headless-connection.test.ts +264 -0
- package/src/runtimes/headless-connection.ts +158 -0
- package/src/runtimes/opencode.test.ts +325 -0
- package/src/runtimes/opencode.ts +188 -0
- package/src/runtimes/pi-guards.test.ts +486 -0
- package/src/runtimes/pi-guards.ts +367 -0
- package/src/runtimes/pi.test.ts +789 -0
- package/src/runtimes/pi.ts +305 -0
- package/src/runtimes/registry.test.ts +196 -0
- package/src/runtimes/registry.ts +99 -0
- package/src/runtimes/sapling.test.ts +1267 -0
- package/src/runtimes/sapling.ts +710 -0
- package/src/runtimes/types.ts +266 -0
- package/src/schema-consistency.test.ts +246 -0
- package/src/sessions/compat.test.ts +281 -0
- package/src/sessions/compat.ts +105 -0
- package/src/sessions/store.test.ts +1748 -0
- package/src/sessions/store.ts +858 -0
- package/src/test-helpers.test.ts +124 -0
- package/src/test-helpers.ts +145 -0
- package/src/test-setup.test.ts +31 -0
- package/src/test-setup.ts +28 -0
- package/src/tools/loam/api.ts +368 -0
- package/src/tools/loam/cli.ts +278 -0
- package/src/tools/loam/commands/add.ts +52 -0
- package/src/tools/loam/commands/archive.ts +214 -0
- package/src/tools/loam/commands/audit.ts +276 -0
- package/src/tools/loam/commands/compact.ts +1062 -0
- package/src/tools/loam/commands/completions.ts +79 -0
- package/src/tools/loam/commands/config.ts +381 -0
- package/src/tools/loam/commands/delete-domain.ts +121 -0
- package/src/tools/loam/commands/delete.ts +316 -0
- package/src/tools/loam/commands/diff.ts +200 -0
- package/src/tools/loam/commands/doctor.ts +1113 -0
- package/src/tools/loam/commands/edit.ts +226 -0
- package/src/tools/loam/commands/init.ts +31 -0
- package/src/tools/loam/commands/learn.ts +179 -0
- package/src/tools/loam/commands/move.ts +323 -0
- package/src/tools/loam/commands/onboard.ts +374 -0
- package/src/tools/loam/commands/outcome.ts +185 -0
- package/src/tools/loam/commands/prime.ts +688 -0
- package/src/tools/loam/commands/prune.ts +614 -0
- package/src/tools/loam/commands/query.ts +218 -0
- package/src/tools/loam/commands/rank.ts +180 -0
- package/src/tools/loam/commands/ready.ts +189 -0
- package/src/tools/loam/commands/record.ts +1210 -0
- package/src/tools/loam/commands/restore.ts +166 -0
- package/src/tools/loam/commands/search.ts +327 -0
- package/src/tools/loam/commands/setup.ts +887 -0
- package/src/tools/loam/commands/status.ts +103 -0
- package/src/tools/loam/commands/sync.ts +298 -0
- package/src/tools/loam/commands/update.ts +19 -0
- package/src/tools/loam/commands/upgrade.ts +93 -0
- package/src/tools/loam/commands/validate.ts +190 -0
- package/src/tools/loam/index.ts +62 -0
- package/src/tools/loam/log.ts +127 -0
- package/src/tools/loam/registry/builtins.ts +409 -0
- package/src/tools/loam/registry/custom.ts +431 -0
- package/src/tools/loam/registry/init.ts +55 -0
- package/src/tools/loam/registry/template.ts +40 -0
- package/src/tools/loam/registry/type-registry.ts +113 -0
- package/src/tools/loam/schemas/config-schema.ts +489 -0
- package/src/tools/loam/schemas/config.ts +245 -0
- package/src/tools/loam/schemas/index.ts +18 -0
- package/src/tools/loam/schemas/record-schema.ts +191 -0
- package/src/tools/loam/schemas/record.ts +115 -0
- package/src/tools/loam/utils/active-work.ts +205 -0
- package/src/tools/loam/utils/anchor-validity.ts +80 -0
- package/src/tools/loam/utils/archive.ts +146 -0
- package/src/tools/loam/utils/audit.ts +667 -0
- package/src/tools/loam/utils/bm25.ts +238 -0
- package/src/tools/loam/utils/budget.ts +142 -0
- package/src/tools/loam/utils/config.ts +344 -0
- package/src/tools/loam/utils/dir-anchors.ts +62 -0
- package/src/tools/loam/utils/domain-rules.ts +114 -0
- package/src/tools/loam/utils/expertise.ts +393 -0
- package/src/tools/loam/utils/format-helpers.ts +96 -0
- package/src/tools/loam/utils/format.ts +1234 -0
- package/src/tools/loam/utils/git-context.ts +50 -0
- package/src/tools/loam/utils/git.ts +183 -0
- package/src/tools/loam/utils/hooks.ts +299 -0
- package/src/tools/loam/utils/index.ts +52 -0
- package/src/tools/loam/utils/json-output.ts +13 -0
- package/src/tools/loam/utils/lock.ts +76 -0
- package/src/tools/loam/utils/markers.ts +48 -0
- package/src/tools/loam/utils/numeric-flags.ts +20 -0
- package/src/tools/loam/utils/palette.ts +44 -0
- package/src/tools/loam/utils/prime-ranking.ts +135 -0
- package/src/tools/loam/utils/recipe-discovery.ts +195 -0
- package/src/tools/loam/utils/runtime-flags.ts +28 -0
- package/src/tools/loam/utils/scoring.ts +94 -0
- package/src/tools/loam/utils/version.ts +116 -0
- package/src/tools/sprout/commands/block.ts +64 -0
- package/src/tools/sprout/commands/blocked.ts +86 -0
- package/src/tools/sprout/commands/close.ts +129 -0
- package/src/tools/sprout/commands/completions.ts +198 -0
- package/src/tools/sprout/commands/config.ts +238 -0
- package/src/tools/sprout/commands/create.ts +164 -0
- package/src/tools/sprout/commands/dep.ts +148 -0
- package/src/tools/sprout/commands/doctor.ts +979 -0
- package/src/tools/sprout/commands/init.ts +83 -0
- package/src/tools/sprout/commands/label.ts +178 -0
- package/src/tools/sprout/commands/list.ts +210 -0
- package/src/tools/sprout/commands/migrate.ts +133 -0
- package/src/tools/sprout/commands/onboard.ts +207 -0
- package/src/tools/sprout/commands/plan-show.ts +278 -0
- package/src/tools/sprout/commands/plan.ts +2526 -0
- package/src/tools/sprout/commands/prime.ts +399 -0
- package/src/tools/sprout/commands/ready.ts +245 -0
- package/src/tools/sprout/commands/search.ts +221 -0
- package/src/tools/sprout/commands/show.ts +277 -0
- package/src/tools/sprout/commands/stats.ts +146 -0
- package/src/tools/sprout/commands/sync.ts +134 -0
- package/src/tools/sprout/commands/tpl.ts +364 -0
- package/src/tools/sprout/commands/unblock.ts +115 -0
- package/src/tools/sprout/commands/update.ts +257 -0
- package/src/tools/sprout/commands/upgrade.ts +91 -0
- package/src/tools/sprout/config-schema.ts +152 -0
- package/src/tools/sprout/config.ts +355 -0
- package/src/tools/sprout/filter.ts +107 -0
- package/src/tools/sprout/format.ts +43 -0
- package/src/tools/sprout/id.ts +22 -0
- package/src/tools/sprout/index.ts +204 -0
- package/src/tools/sprout/log.ts +76 -0
- package/src/tools/sprout/markers.ts +22 -0
- package/src/tools/sprout/output.ts +121 -0
- package/src/tools/sprout/plan-backref.ts +93 -0
- package/src/tools/sprout/plan-context.ts +81 -0
- package/src/tools/sprout/plan-domain.ts +139 -0
- package/src/tools/sprout/plan-lifecycle.ts +65 -0
- package/src/tools/sprout/plan-loam.ts +207 -0
- package/src/tools/sprout/plan-schema.ts +209 -0
- package/src/tools/sprout/sort.ts +31 -0
- package/src/tools/sprout/store.ts +172 -0
- package/src/tools/sprout/types.ts +118 -0
- package/src/tools/sprout/validation.ts +119 -0
- package/src/tools/sprout/version.ts +1 -0
- package/src/tools/sprout/yaml.ts +387 -0
- package/src/tools/trellis/commands/archive.ts +87 -0
- package/src/tools/trellis/commands/completions.ts +610 -0
- package/src/tools/trellis/commands/config.ts +382 -0
- package/src/tools/trellis/commands/create.ts +252 -0
- package/src/tools/trellis/commands/diff.ts +150 -0
- package/src/tools/trellis/commands/doctor.ts +771 -0
- package/src/tools/trellis/commands/emit.ts +365 -0
- package/src/tools/trellis/commands/history.ts +83 -0
- package/src/tools/trellis/commands/import.ts +198 -0
- package/src/tools/trellis/commands/init.ts +81 -0
- package/src/tools/trellis/commands/list.ts +103 -0
- package/src/tools/trellis/commands/onboard.ts +156 -0
- package/src/tools/trellis/commands/pin.ts +172 -0
- package/src/tools/trellis/commands/prime.ts +193 -0
- package/src/tools/trellis/commands/render.ts +122 -0
- package/src/tools/trellis/commands/schema.ts +353 -0
- package/src/tools/trellis/commands/show.ts +115 -0
- package/src/tools/trellis/commands/stats.ts +65 -0
- package/src/tools/trellis/commands/sync.ts +112 -0
- package/src/tools/trellis/commands/tree.ts +123 -0
- package/src/tools/trellis/commands/update.ts +330 -0
- package/src/tools/trellis/commands/upgrade.ts +95 -0
- package/src/tools/trellis/commands/validate.ts +166 -0
- package/src/tools/trellis/config-schema.ts +81 -0
- package/src/tools/trellis/config.ts +108 -0
- package/src/tools/trellis/frontmatter.ts +348 -0
- package/src/tools/trellis/id.ts +24 -0
- package/src/tools/trellis/index.ts +209 -0
- package/src/tools/trellis/markers.ts +28 -0
- package/src/tools/trellis/output.ts +84 -0
- package/src/tools/trellis/render.ts +212 -0
- package/src/tools/trellis/store.ts +144 -0
- package/src/tools/trellis/types.ts +82 -0
- package/src/tools/trellis/validate.ts +199 -0
- package/src/tools/trellis/yaml.ts +309 -0
- package/src/tracker/beads.test.ts +454 -0
- package/src/tracker/beads.ts +56 -0
- package/src/tracker/factory.test.ts +90 -0
- package/src/tracker/factory.ts +65 -0
- package/src/tracker/sprout.test.ts +461 -0
- package/src/tracker/sprout.ts +182 -0
- package/src/tracker/types.ts +52 -0
- package/src/trellis/client.test.ts +107 -0
- package/src/trellis/client.ts +179 -0
- package/src/types.ts +970 -0
- package/src/utils/bin.test.ts +10 -0
- package/src/utils/bin.ts +37 -0
- package/src/utils/browser.test.ts +49 -0
- package/src/utils/browser.ts +48 -0
- package/src/utils/fs.test.ts +119 -0
- package/src/utils/fs.ts +62 -0
- package/src/utils/pid.test.ts +152 -0
- package/src/utils/pid.ts +130 -0
- package/src/utils/process-scan.test.ts +53 -0
- package/src/utils/process-scan.ts +76 -0
- package/src/utils/time.test.ts +43 -0
- package/src/utils/time.ts +37 -0
- package/src/utils/version.test.ts +33 -0
- package/src/utils/version.ts +70 -0
- package/src/version.ts +5 -0
- package/src/watchdog/daemon.test.ts +3721 -0
- package/src/watchdog/daemon.ts +1257 -0
- package/src/watchdog/health.test.ts +830 -0
- package/src/watchdog/health.ts +434 -0
- package/src/watchdog/triage.test.ts +205 -0
- package/src/watchdog/triage.ts +205 -0
- package/src/worktree/manager.test.ts +720 -0
- package/src/worktree/manager.ts +405 -0
- package/src/worktree/process.test.ts +172 -0
- package/src/worktree/process.ts +131 -0
- package/src/worktree/tmux.test.ts +1616 -0
- package/src/worktree/tmux.ts +721 -0
- package/templates/CLAUDE.md.tmpl +100 -0
- package/templates/copilot-hooks.json.tmpl +13 -0
- package/templates/hooks.json.tmpl +109 -0
- package/templates/overlay.md.tmpl +88 -0
- package/ui/dist/apple-touch-icon-bdy6teep.png +0 -0
- package/ui/dist/chunk-8s31f05k.css +1 -0
- package/ui/dist/chunk-vm5rz679.js +300 -0
- package/ui/dist/favicon-nzb39vza.svg +4 -0
- package/ui/dist/index.html +17 -0
|
@@ -0,0 +1,981 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shell completion generation for agentplate CLI.
|
|
3
|
+
*
|
|
4
|
+
* Generates completion scripts for bash, zsh, and fish shells.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { Command } from "commander";
|
|
8
|
+
import { printError } from "../logging/color.ts";
|
|
9
|
+
|
|
10
|
+
interface FlagDef {
|
|
11
|
+
name: string;
|
|
12
|
+
desc: string;
|
|
13
|
+
takesValue?: boolean;
|
|
14
|
+
values?: readonly string[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
interface SubcommandDef {
|
|
18
|
+
name: string;
|
|
19
|
+
desc: string;
|
|
20
|
+
flags?: readonly FlagDef[];
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
interface CommandDef {
|
|
24
|
+
name: string;
|
|
25
|
+
desc: string;
|
|
26
|
+
flags?: readonly FlagDef[];
|
|
27
|
+
subcommands?: readonly SubcommandDef[];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const COMMANDS: readonly CommandDef[] = [
|
|
31
|
+
{
|
|
32
|
+
name: "agents",
|
|
33
|
+
desc: "Discover and query agents",
|
|
34
|
+
flags: [
|
|
35
|
+
{ name: "--json", desc: "JSON output" },
|
|
36
|
+
{ name: "--help", desc: "Show help" },
|
|
37
|
+
],
|
|
38
|
+
subcommands: [
|
|
39
|
+
{
|
|
40
|
+
name: "discover",
|
|
41
|
+
desc: "Find active agents by capability",
|
|
42
|
+
flags: [
|
|
43
|
+
{
|
|
44
|
+
name: "--capability",
|
|
45
|
+
desc: "Filter by capability",
|
|
46
|
+
takesValue: true,
|
|
47
|
+
values: [
|
|
48
|
+
"builder",
|
|
49
|
+
"scout",
|
|
50
|
+
"reviewer",
|
|
51
|
+
"lead",
|
|
52
|
+
"merger",
|
|
53
|
+
"orchestrator",
|
|
54
|
+
"coordinator",
|
|
55
|
+
"supervisor",
|
|
56
|
+
],
|
|
57
|
+
},
|
|
58
|
+
{ name: "--all", desc: "Include completed and zombie agents" },
|
|
59
|
+
{ name: "--json", desc: "JSON output" },
|
|
60
|
+
{ name: "--help", desc: "Show help" },
|
|
61
|
+
],
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: "init",
|
|
67
|
+
desc: "Initialize .agentplate/ and bootstrap ag-eco ecosystem tools",
|
|
68
|
+
flags: [
|
|
69
|
+
{ name: "--force", desc: "Overwrite existing configuration" },
|
|
70
|
+
{ name: "--yes", desc: "Accept all defaults without prompting" },
|
|
71
|
+
{ name: "-y", desc: "Alias for --yes" },
|
|
72
|
+
{ name: "--name", desc: "Project name", takesValue: true },
|
|
73
|
+
{ name: "--tools", desc: "Comma-separated list of tools to bootstrap", takesValue: true },
|
|
74
|
+
{ name: "--skip-loam", desc: "Skip loam bootstrap" },
|
|
75
|
+
{ name: "--skip-sprout", desc: "Skip sprout bootstrap" },
|
|
76
|
+
{ name: "--skip-trellis", desc: "Skip trellis bootstrap" },
|
|
77
|
+
{ name: "--skip-onboard", desc: "Skip CLAUDE.md onboarding step" },
|
|
78
|
+
{ name: "--json", desc: "Output result as JSON" },
|
|
79
|
+
{ name: "--help", desc: "Show help" },
|
|
80
|
+
],
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: "sling",
|
|
84
|
+
desc: "Spawn a worker agent",
|
|
85
|
+
flags: [
|
|
86
|
+
{
|
|
87
|
+
name: "--capability",
|
|
88
|
+
desc: "Agent capability type",
|
|
89
|
+
takesValue: true,
|
|
90
|
+
values: ["builder", "scout", "reviewer", "lead", "merger"],
|
|
91
|
+
},
|
|
92
|
+
{ name: "--name", desc: "Unique agent name", takesValue: true },
|
|
93
|
+
{ name: "--spec", desc: "Path to task spec file", takesValue: true },
|
|
94
|
+
{ name: "--files", desc: "Exclusive file scope (comma-separated)", takesValue: true },
|
|
95
|
+
{ name: "--parent", desc: "Parent agent name", takesValue: true },
|
|
96
|
+
{ name: "--depth", desc: "Current hierarchy depth", takesValue: true },
|
|
97
|
+
{ name: "--skip-scout", desc: "Skip scout phase for lead agents" },
|
|
98
|
+
{ name: "--skip-review", desc: "Skip review phase for lead agents" },
|
|
99
|
+
{ name: "--skip-task-check", desc: "Skip task existence validation" },
|
|
100
|
+
{ name: "--force-hierarchy", desc: "Bypass hierarchy validation" },
|
|
101
|
+
{ name: "--max-agents", desc: "Max children per lead", takesValue: true },
|
|
102
|
+
{ name: "--dispatch-max-agents", desc: "Per-lead max agents ceiling", takesValue: true },
|
|
103
|
+
{ name: "--runtime", desc: "Runtime adapter", takesValue: true },
|
|
104
|
+
{ name: "--json", desc: "JSON output" },
|
|
105
|
+
{ name: "--help", desc: "Show help" },
|
|
106
|
+
],
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
name: "prime",
|
|
110
|
+
desc: "Load context for orchestrator/agent",
|
|
111
|
+
flags: [
|
|
112
|
+
{ name: "--agent", desc: "Per-agent priming", takesValue: true },
|
|
113
|
+
{ name: "--compact", desc: "Less context (for PreCompact hook)" },
|
|
114
|
+
{ name: "--help", desc: "Show help" },
|
|
115
|
+
],
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: "stop",
|
|
119
|
+
desc: "Terminate a running agent",
|
|
120
|
+
flags: [
|
|
121
|
+
{ name: "--force", desc: "Force kill and force-delete branch" },
|
|
122
|
+
{ name: "--clean-worktree", desc: "Remove the agent's worktree after stopping" },
|
|
123
|
+
{ name: "--json", desc: "JSON output" },
|
|
124
|
+
{ name: "--help", desc: "Show help" },
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
name: "status",
|
|
129
|
+
desc: "Show all active agents and project state",
|
|
130
|
+
flags: [
|
|
131
|
+
{ name: "--json", desc: "JSON output" },
|
|
132
|
+
{ name: "--verbose", desc: "Extra per-agent detail" },
|
|
133
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
134
|
+
{ name: "--all", desc: "Show sessions from all runs" },
|
|
135
|
+
{ name: "--watch", desc: "Watch mode" },
|
|
136
|
+
{ name: "--interval", desc: "Poll interval in ms", takesValue: true },
|
|
137
|
+
{ name: "--help", desc: "Show help" },
|
|
138
|
+
],
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
name: "dashboard",
|
|
142
|
+
desc: "Live TUI dashboard for agent monitoring",
|
|
143
|
+
flags: [
|
|
144
|
+
{ name: "--interval", desc: "Poll interval in ms (default 2000)", takesValue: true },
|
|
145
|
+
{ name: "--help", desc: "Show help" },
|
|
146
|
+
],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
name: "inspect",
|
|
150
|
+
desc: "Deep inspection of a single agent",
|
|
151
|
+
flags: [
|
|
152
|
+
{ name: "--json", desc: "JSON output" },
|
|
153
|
+
{ name: "--follow", desc: "Poll and refresh continuously" },
|
|
154
|
+
{ name: "--interval", desc: "Polling interval in ms", takesValue: true },
|
|
155
|
+
{ name: "--limit", desc: "Recent tool calls to show", takesValue: true },
|
|
156
|
+
{ name: "--no-tmux", desc: "Skip tmux capture-pane" },
|
|
157
|
+
{ name: "--help", desc: "Show help" },
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: "merge",
|
|
162
|
+
desc: "Merge agent branches into canonical",
|
|
163
|
+
flags: [
|
|
164
|
+
{ name: "--branch", desc: "Specific branch to merge", takesValue: true },
|
|
165
|
+
{ name: "--all", desc: "All completed branches" },
|
|
166
|
+
{ name: "--into", desc: "Target branch to merge into", takesValue: true },
|
|
167
|
+
{ name: "--dry-run", desc: "Check for conflicts only" },
|
|
168
|
+
{ name: "--json", desc: "JSON output" },
|
|
169
|
+
{ name: "--help", desc: "Show help" },
|
|
170
|
+
],
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: "nudge",
|
|
174
|
+
desc: "Send a text nudge to an agent",
|
|
175
|
+
flags: [
|
|
176
|
+
{ name: "--from", desc: "Sender name", takesValue: true },
|
|
177
|
+
{ name: "--force", desc: "Skip debounce check" },
|
|
178
|
+
{ name: "--json", desc: "JSON output" },
|
|
179
|
+
{ name: "--help", desc: "Show help" },
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: "clean",
|
|
184
|
+
desc: "Wipe runtime state (nuclear cleanup)",
|
|
185
|
+
flags: [
|
|
186
|
+
{ name: "--all", desc: "Wipe everything" },
|
|
187
|
+
{ name: "--mail", desc: "Clean mail database" },
|
|
188
|
+
{ name: "--sessions", desc: "Clean sessions database" },
|
|
189
|
+
{ name: "--metrics", desc: "Clean metrics database" },
|
|
190
|
+
{ name: "--logs", desc: "Clean log files" },
|
|
191
|
+
{ name: "--worktrees", desc: "Clean worktrees" },
|
|
192
|
+
{ name: "--branches", desc: "Clean branches" },
|
|
193
|
+
{ name: "--agents", desc: "Clean agent state" },
|
|
194
|
+
{ name: "--specs", desc: "Clean specs" },
|
|
195
|
+
{ name: "--json", desc: "JSON output" },
|
|
196
|
+
{ name: "--help", desc: "Show help" },
|
|
197
|
+
],
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
name: "doctor",
|
|
201
|
+
desc: "Run health checks on agentplate setup",
|
|
202
|
+
flags: [
|
|
203
|
+
{ name: "--json", desc: "JSON output" },
|
|
204
|
+
{ name: "--verbose", desc: "Show passing checks too" },
|
|
205
|
+
{
|
|
206
|
+
name: "--category",
|
|
207
|
+
desc: "Run one category only",
|
|
208
|
+
takesValue: true,
|
|
209
|
+
values: [
|
|
210
|
+
"dependencies",
|
|
211
|
+
"structure",
|
|
212
|
+
"config",
|
|
213
|
+
"databases",
|
|
214
|
+
"consistency",
|
|
215
|
+
"agents",
|
|
216
|
+
"merge",
|
|
217
|
+
"logs",
|
|
218
|
+
"version",
|
|
219
|
+
"ecosystem",
|
|
220
|
+
],
|
|
221
|
+
},
|
|
222
|
+
{ name: "--fix", desc: "Attempt to auto-fix issues" },
|
|
223
|
+
{ name: "--help", desc: "Show help" },
|
|
224
|
+
],
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
name: "log",
|
|
228
|
+
desc: "Log a hook event",
|
|
229
|
+
flags: [
|
|
230
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
231
|
+
{ name: "--tool-name", desc: "Tool name", takesValue: true },
|
|
232
|
+
{ name: "--transcript", desc: "Transcript path", takesValue: true },
|
|
233
|
+
{ name: "--stdin", desc: "Read from stdin" },
|
|
234
|
+
{ name: "--help", desc: "Show help" },
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: "logs",
|
|
239
|
+
desc: "Query NDJSON logs across agents",
|
|
240
|
+
flags: [
|
|
241
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
242
|
+
{
|
|
243
|
+
name: "--level",
|
|
244
|
+
desc: "Filter by log level",
|
|
245
|
+
takesValue: true,
|
|
246
|
+
values: ["debug", "info", "warn", "error"],
|
|
247
|
+
},
|
|
248
|
+
{ name: "--since", desc: "Time filter (ISO 8601 or relative)", takesValue: true },
|
|
249
|
+
{ name: "--until", desc: "Time filter (ISO 8601)", takesValue: true },
|
|
250
|
+
{ name: "--limit", desc: "Max entries", takesValue: true },
|
|
251
|
+
{ name: "--follow", desc: "Tail logs in real time" },
|
|
252
|
+
{ name: "--json", desc: "JSON output" },
|
|
253
|
+
{ name: "--help", desc: "Show help" },
|
|
254
|
+
],
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
name: "watch",
|
|
258
|
+
desc: "Start watchdog daemon",
|
|
259
|
+
flags: [
|
|
260
|
+
{ name: "--interval", desc: "Check interval in ms", takesValue: true },
|
|
261
|
+
{ name: "--background", desc: "Run in background" },
|
|
262
|
+
{ name: "--help", desc: "Show help" },
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "trace",
|
|
267
|
+
desc: "Chronological event timeline for agent or task",
|
|
268
|
+
flags: [
|
|
269
|
+
{ name: "--json", desc: "JSON output" },
|
|
270
|
+
{ name: "--since", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
271
|
+
{ name: "--until", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
272
|
+
{ name: "--limit", desc: "Max events", takesValue: true },
|
|
273
|
+
{ name: "--help", desc: "Show help" },
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "errors",
|
|
278
|
+
desc: "Aggregated error view across agents",
|
|
279
|
+
flags: [
|
|
280
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
281
|
+
{ name: "--run", desc: "Filter by run", takesValue: true },
|
|
282
|
+
{ name: "--since", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
283
|
+
{ name: "--until", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
284
|
+
{ name: "--limit", desc: "Max errors", takesValue: true },
|
|
285
|
+
{ name: "--json", desc: "JSON output" },
|
|
286
|
+
{ name: "--help", desc: "Show help" },
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
name: "feed",
|
|
291
|
+
desc: "Unified real-time event stream across all agents",
|
|
292
|
+
flags: [
|
|
293
|
+
{ name: "--follow", desc: "Continuously poll for new events" },
|
|
294
|
+
{ name: "-f", desc: "Alias for --follow" },
|
|
295
|
+
{ name: "--interval", desc: "Polling interval in ms", takesValue: true },
|
|
296
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
297
|
+
{ name: "--run", desc: "Filter by run", takesValue: true },
|
|
298
|
+
{ name: "--since", desc: "Start time (ISO 8601)", takesValue: true },
|
|
299
|
+
{ name: "--limit", desc: "Max initial events", takesValue: true },
|
|
300
|
+
{ name: "--json", desc: "JSON output" },
|
|
301
|
+
{ name: "--help", desc: "Show help" },
|
|
302
|
+
],
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
name: "replay",
|
|
306
|
+
desc: "Interleaved chronological replay across agents",
|
|
307
|
+
flags: [
|
|
308
|
+
{ name: "--run", desc: "Filter by run", takesValue: true },
|
|
309
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
310
|
+
{ name: "--since", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
311
|
+
{ name: "--until", desc: "Time range filter (ISO 8601)", takesValue: true },
|
|
312
|
+
{ name: "--limit", desc: "Max events", takesValue: true },
|
|
313
|
+
{ name: "--json", desc: "JSON output" },
|
|
314
|
+
{ name: "--help", desc: "Show help" },
|
|
315
|
+
],
|
|
316
|
+
},
|
|
317
|
+
{
|
|
318
|
+
name: "costs",
|
|
319
|
+
desc: "Token/cost analysis and breakdown",
|
|
320
|
+
flags: [
|
|
321
|
+
{ name: "--live", desc: "Show real-time token usage for active agents" },
|
|
322
|
+
{ name: "--agent", desc: "Filter by agent", takesValue: true },
|
|
323
|
+
{ name: "--run", desc: "Filter by run", takesValue: true },
|
|
324
|
+
{ name: "--by-capability", desc: "Group by capability with subtotals" },
|
|
325
|
+
{ name: "--last", desc: "Recent sessions", takesValue: true },
|
|
326
|
+
{ name: "--json", desc: "JSON output" },
|
|
327
|
+
{ name: "--help", desc: "Show help" },
|
|
328
|
+
],
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: "metrics",
|
|
332
|
+
desc: "Show session metrics",
|
|
333
|
+
flags: [
|
|
334
|
+
{ name: "--last", desc: "Recent sessions", takesValue: true },
|
|
335
|
+
{ name: "--json", desc: "JSON output" },
|
|
336
|
+
{ name: "--help", desc: "Show help" },
|
|
337
|
+
],
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "spec",
|
|
341
|
+
desc: "Manage task specs",
|
|
342
|
+
flags: [{ name: "--help", desc: "Show help" }],
|
|
343
|
+
subcommands: [
|
|
344
|
+
{
|
|
345
|
+
name: "write",
|
|
346
|
+
desc: "Write a spec file",
|
|
347
|
+
flags: [
|
|
348
|
+
{ name: "--body", desc: "Spec content", takesValue: true },
|
|
349
|
+
{ name: "--agent", desc: "Agent attribution", takesValue: true },
|
|
350
|
+
{ name: "--help", desc: "Show help" },
|
|
351
|
+
],
|
|
352
|
+
},
|
|
353
|
+
],
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
name: "orchestrator",
|
|
357
|
+
desc: "Persistent ecosystem orchestrator agent",
|
|
358
|
+
flags: [
|
|
359
|
+
{ name: "--json", desc: "JSON output" },
|
|
360
|
+
{ name: "--help", desc: "Show help" },
|
|
361
|
+
],
|
|
362
|
+
subcommands: [
|
|
363
|
+
{
|
|
364
|
+
name: "start",
|
|
365
|
+
desc: "Start orchestrator",
|
|
366
|
+
flags: [
|
|
367
|
+
{ name: "--attach", desc: "Attach to tmux session" },
|
|
368
|
+
{ name: "--no-attach", desc: "Do not attach to tmux session" },
|
|
369
|
+
{ name: "--watchdog", desc: "Auto-start watchdog daemon" },
|
|
370
|
+
{ name: "--json", desc: "JSON output" },
|
|
371
|
+
],
|
|
372
|
+
},
|
|
373
|
+
{
|
|
374
|
+
name: "stop",
|
|
375
|
+
desc: "Stop orchestrator",
|
|
376
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
name: "status",
|
|
380
|
+
desc: "Show orchestrator state",
|
|
381
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
382
|
+
},
|
|
383
|
+
],
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
name: "coordinator",
|
|
387
|
+
desc: "Persistent coordinator agent",
|
|
388
|
+
flags: [
|
|
389
|
+
{ name: "--json", desc: "JSON output" },
|
|
390
|
+
{ name: "--help", desc: "Show help" },
|
|
391
|
+
],
|
|
392
|
+
subcommands: [
|
|
393
|
+
{
|
|
394
|
+
name: "start",
|
|
395
|
+
desc: "Start coordinator",
|
|
396
|
+
flags: [
|
|
397
|
+
{ name: "--attach", desc: "Attach to tmux session" },
|
|
398
|
+
{ name: "--no-attach", desc: "Do not attach to tmux session" },
|
|
399
|
+
{ name: "--watchdog", desc: "Auto-start watchdog daemon" },
|
|
400
|
+
{ name: "--json", desc: "JSON output" },
|
|
401
|
+
],
|
|
402
|
+
},
|
|
403
|
+
{
|
|
404
|
+
name: "stop",
|
|
405
|
+
desc: "Stop coordinator",
|
|
406
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
407
|
+
},
|
|
408
|
+
{
|
|
409
|
+
name: "status",
|
|
410
|
+
desc: "Show coordinator state",
|
|
411
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
412
|
+
},
|
|
413
|
+
],
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: "supervisor",
|
|
417
|
+
desc: "[DEPRECATED] Per-project supervisor agent",
|
|
418
|
+
flags: [
|
|
419
|
+
{ name: "--json", desc: "JSON output" },
|
|
420
|
+
{ name: "--help", desc: "Show help" },
|
|
421
|
+
],
|
|
422
|
+
subcommands: [
|
|
423
|
+
{
|
|
424
|
+
name: "start",
|
|
425
|
+
desc: "Start supervisor",
|
|
426
|
+
flags: [
|
|
427
|
+
{ name: "--task", desc: "Task ID", takesValue: true },
|
|
428
|
+
{ name: "--name", desc: "Unique name", takesValue: true },
|
|
429
|
+
{ name: "--parent", desc: "Parent agent", takesValue: true },
|
|
430
|
+
{ name: "--depth", desc: "Hierarchy depth", takesValue: true },
|
|
431
|
+
{ name: "--json", desc: "JSON output" },
|
|
432
|
+
],
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
name: "stop",
|
|
436
|
+
desc: "Stop supervisor",
|
|
437
|
+
flags: [
|
|
438
|
+
{ name: "--name", desc: "Supervisor name", takesValue: true },
|
|
439
|
+
{ name: "--json", desc: "JSON output" },
|
|
440
|
+
],
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
name: "status",
|
|
444
|
+
desc: "Show supervisor state",
|
|
445
|
+
flags: [
|
|
446
|
+
{ name: "--name", desc: "Supervisor name", takesValue: true },
|
|
447
|
+
{ name: "--json", desc: "JSON output" },
|
|
448
|
+
],
|
|
449
|
+
},
|
|
450
|
+
],
|
|
451
|
+
},
|
|
452
|
+
{
|
|
453
|
+
name: "hooks",
|
|
454
|
+
desc: "Manage orchestrator hooks",
|
|
455
|
+
flags: [
|
|
456
|
+
{ name: "--json", desc: "JSON output" },
|
|
457
|
+
{ name: "--help", desc: "Show help" },
|
|
458
|
+
],
|
|
459
|
+
subcommands: [
|
|
460
|
+
{
|
|
461
|
+
name: "install",
|
|
462
|
+
desc: "Install hooks",
|
|
463
|
+
flags: [
|
|
464
|
+
{ name: "--force", desc: "Overwrite existing hooks" },
|
|
465
|
+
{ name: "--json", desc: "JSON output" },
|
|
466
|
+
],
|
|
467
|
+
},
|
|
468
|
+
{
|
|
469
|
+
name: "uninstall",
|
|
470
|
+
desc: "Uninstall hooks",
|
|
471
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
472
|
+
},
|
|
473
|
+
{
|
|
474
|
+
name: "status",
|
|
475
|
+
desc: "Check if hooks are installed",
|
|
476
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
477
|
+
},
|
|
478
|
+
],
|
|
479
|
+
},
|
|
480
|
+
{
|
|
481
|
+
name: "monitor",
|
|
482
|
+
desc: "Tier 2 monitor agent",
|
|
483
|
+
flags: [
|
|
484
|
+
{ name: "--json", desc: "JSON output" },
|
|
485
|
+
{ name: "--help", desc: "Show help" },
|
|
486
|
+
],
|
|
487
|
+
subcommands: [
|
|
488
|
+
{
|
|
489
|
+
name: "start",
|
|
490
|
+
desc: "Start monitor",
|
|
491
|
+
flags: [
|
|
492
|
+
{ name: "--attach", desc: "Attach to tmux session" },
|
|
493
|
+
{ name: "--no-attach", desc: "Do not attach to tmux session" },
|
|
494
|
+
{ name: "--json", desc: "JSON output" },
|
|
495
|
+
],
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
name: "stop",
|
|
499
|
+
desc: "Stop monitor",
|
|
500
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
name: "status",
|
|
504
|
+
desc: "Show monitor state",
|
|
505
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
506
|
+
},
|
|
507
|
+
],
|
|
508
|
+
},
|
|
509
|
+
{
|
|
510
|
+
name: "mail",
|
|
511
|
+
desc: "Mail system",
|
|
512
|
+
flags: [{ name: "--help", desc: "Show help" }],
|
|
513
|
+
subcommands: [
|
|
514
|
+
{
|
|
515
|
+
name: "send",
|
|
516
|
+
desc: "Send a message",
|
|
517
|
+
flags: [
|
|
518
|
+
{ name: "--to", desc: "Recipient agent", takesValue: true },
|
|
519
|
+
{ name: "--subject", desc: "Message subject", takesValue: true },
|
|
520
|
+
{ name: "--body", desc: "Message body", takesValue: true },
|
|
521
|
+
{ name: "--from", desc: "Sender name", takesValue: true },
|
|
522
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
523
|
+
{
|
|
524
|
+
name: "--type",
|
|
525
|
+
desc: "Message type",
|
|
526
|
+
takesValue: true,
|
|
527
|
+
values: [
|
|
528
|
+
"status",
|
|
529
|
+
"question",
|
|
530
|
+
"result",
|
|
531
|
+
"error",
|
|
532
|
+
"worker_done",
|
|
533
|
+
"merge_ready",
|
|
534
|
+
"merged",
|
|
535
|
+
"merge_failed",
|
|
536
|
+
"escalation",
|
|
537
|
+
"health_check",
|
|
538
|
+
"dispatch",
|
|
539
|
+
"assign",
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
name: "--priority",
|
|
544
|
+
desc: "Message priority",
|
|
545
|
+
takesValue: true,
|
|
546
|
+
values: ["low", "normal", "high", "urgent"],
|
|
547
|
+
},
|
|
548
|
+
{ name: "--payload", desc: "Structured JSON payload", takesValue: true },
|
|
549
|
+
{ name: "--json", desc: "JSON output" },
|
|
550
|
+
],
|
|
551
|
+
},
|
|
552
|
+
{
|
|
553
|
+
name: "check",
|
|
554
|
+
desc: "Check inbox (unread messages)",
|
|
555
|
+
flags: [
|
|
556
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
557
|
+
{ name: "--inject", desc: "Inject messages" },
|
|
558
|
+
{ name: "--debounce", desc: "Debounce interval in ms", takesValue: true },
|
|
559
|
+
{ name: "--json", desc: "JSON output" },
|
|
560
|
+
],
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
name: "list",
|
|
564
|
+
desc: "List messages with filters",
|
|
565
|
+
flags: [
|
|
566
|
+
{ name: "--from", desc: "Filter by sender", takesValue: true },
|
|
567
|
+
{ name: "--to", desc: "Filter by recipient", takesValue: true },
|
|
568
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
569
|
+
{ name: "--unread", desc: "Show only unread messages" },
|
|
570
|
+
{ name: "--json", desc: "JSON output" },
|
|
571
|
+
],
|
|
572
|
+
},
|
|
573
|
+
{
|
|
574
|
+
name: "read",
|
|
575
|
+
desc: "Mark message as read",
|
|
576
|
+
},
|
|
577
|
+
{
|
|
578
|
+
name: "reply",
|
|
579
|
+
desc: "Reply to a message",
|
|
580
|
+
flags: [
|
|
581
|
+
{ name: "--body", desc: "Reply body", takesValue: true },
|
|
582
|
+
{ name: "--from", desc: "Sender name", takesValue: true },
|
|
583
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
584
|
+
{ name: "--json", desc: "JSON output" },
|
|
585
|
+
],
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
name: "purge",
|
|
589
|
+
desc: "Delete old messages",
|
|
590
|
+
flags: [
|
|
591
|
+
{ name: "--all", desc: "Delete all messages" },
|
|
592
|
+
{ name: "--days", desc: "Delete messages older than N days", takesValue: true },
|
|
593
|
+
{ name: "--agent", desc: "Agent name", takesValue: true },
|
|
594
|
+
{ name: "--json", desc: "JSON output" },
|
|
595
|
+
],
|
|
596
|
+
},
|
|
597
|
+
],
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
name: "group",
|
|
601
|
+
desc: "Task groups",
|
|
602
|
+
flags: [
|
|
603
|
+
{ name: "--json", desc: "JSON output" },
|
|
604
|
+
{ name: "--skip-validation", desc: "Skip task validation" },
|
|
605
|
+
{ name: "--help", desc: "Show help" },
|
|
606
|
+
],
|
|
607
|
+
subcommands: [
|
|
608
|
+
{ name: "create", desc: "Create a new task group" },
|
|
609
|
+
{ name: "status", desc: "Show progress for one or all groups" },
|
|
610
|
+
{ name: "add", desc: "Add issues to a group" },
|
|
611
|
+
{ name: "remove", desc: "Remove issues from a group" },
|
|
612
|
+
{ name: "list", desc: "List all groups (summary)" },
|
|
613
|
+
],
|
|
614
|
+
},
|
|
615
|
+
{
|
|
616
|
+
name: "worktree",
|
|
617
|
+
desc: "Manage worktrees",
|
|
618
|
+
flags: [
|
|
619
|
+
{ name: "--json", desc: "JSON output" },
|
|
620
|
+
{ name: "--help", desc: "Show help" },
|
|
621
|
+
],
|
|
622
|
+
subcommands: [
|
|
623
|
+
{
|
|
624
|
+
name: "list",
|
|
625
|
+
desc: "List worktrees with status",
|
|
626
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
name: "clean",
|
|
630
|
+
desc: "Remove completed worktrees",
|
|
631
|
+
flags: [
|
|
632
|
+
{ name: "--completed", desc: "Only finished agents" },
|
|
633
|
+
{ name: "--all", desc: "Force remove all" },
|
|
634
|
+
{ name: "--json", desc: "JSON output" },
|
|
635
|
+
],
|
|
636
|
+
},
|
|
637
|
+
],
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
name: "run",
|
|
641
|
+
desc: "Manage runs",
|
|
642
|
+
flags: [
|
|
643
|
+
{ name: "--json", desc: "JSON output" },
|
|
644
|
+
{ name: "--help", desc: "Show help" },
|
|
645
|
+
],
|
|
646
|
+
subcommands: [
|
|
647
|
+
{
|
|
648
|
+
name: "list",
|
|
649
|
+
desc: "List recent runs",
|
|
650
|
+
flags: [
|
|
651
|
+
{ name: "--last", desc: "Number of runs to show", takesValue: true },
|
|
652
|
+
{ name: "--json", desc: "JSON output" },
|
|
653
|
+
],
|
|
654
|
+
},
|
|
655
|
+
{
|
|
656
|
+
name: "show",
|
|
657
|
+
desc: "Show run details",
|
|
658
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
name: "complete",
|
|
662
|
+
desc: "Mark current run as completed",
|
|
663
|
+
flags: [{ name: "--json", desc: "JSON output" }],
|
|
664
|
+
},
|
|
665
|
+
],
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
name: "ecosystem",
|
|
669
|
+
desc: "Show a summary dashboard of all installed ag-eco tools",
|
|
670
|
+
flags: [
|
|
671
|
+
{ name: "--json", desc: "JSON output" },
|
|
672
|
+
{ name: "--help", desc: "Show help" },
|
|
673
|
+
],
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
name: "upgrade",
|
|
677
|
+
desc: "Upgrade agentplate to the latest version",
|
|
678
|
+
flags: [
|
|
679
|
+
{ name: "--check", desc: "Compare current vs latest without installing" },
|
|
680
|
+
{ name: "--all", desc: "Upgrade all ag-eco tools" },
|
|
681
|
+
{ name: "--json", desc: "JSON output" },
|
|
682
|
+
{ name: "--help", desc: "Show help" },
|
|
683
|
+
],
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
name: "completions",
|
|
687
|
+
desc: "Generate shell completions",
|
|
688
|
+
flags: [{ name: "--help", desc: "Show help" }],
|
|
689
|
+
},
|
|
690
|
+
] as const;
|
|
691
|
+
|
|
692
|
+
export function generateBash(): string {
|
|
693
|
+
const lines: string[] = [
|
|
694
|
+
"# Bash completion for ap",
|
|
695
|
+
"# Source this file to enable completions:",
|
|
696
|
+
"# source <(ap --completions bash)",
|
|
697
|
+
"",
|
|
698
|
+
"_ap() {",
|
|
699
|
+
" local cur prev words cword",
|
|
700
|
+
" _init_completion || return",
|
|
701
|
+
"",
|
|
702
|
+
" local commands='agents init sling prime stop status dashboard inspect merge nudge clean doctor log logs watch trace errors feed replay costs metrics spec coordinator supervisor hooks monitor mail group worktree run ecosystem upgrade completions'",
|
|
703
|
+
"",
|
|
704
|
+
" # Top-level completion",
|
|
705
|
+
" if [[ $cword -eq 1 ]]; then",
|
|
706
|
+
' COMPREPLY=($(compgen -W "$commands --help --version --completions" -- "$cur"))',
|
|
707
|
+
" return",
|
|
708
|
+
" fi",
|
|
709
|
+
"",
|
|
710
|
+
// Shell variable expansion - not a template string placeholder
|
|
711
|
+
` local command="\${words[1]}"`,
|
|
712
|
+
"",
|
|
713
|
+
];
|
|
714
|
+
|
|
715
|
+
// Generate command-specific completions
|
|
716
|
+
for (const cmd of COMMANDS) {
|
|
717
|
+
lines.push(` if [[ $command == "${cmd.name}" ]]; then`);
|
|
718
|
+
|
|
719
|
+
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
720
|
+
// Command with subcommands
|
|
721
|
+
const subcmdNames = cmd.subcommands.map((s) => s.name).join(" ");
|
|
722
|
+
lines.push(" if [[ $cword -eq 2 ]]; then");
|
|
723
|
+
lines.push(` COMPREPLY=($(compgen -W "${subcmdNames}" -- "$cur"))`);
|
|
724
|
+
lines.push(" return");
|
|
725
|
+
lines.push(" fi");
|
|
726
|
+
|
|
727
|
+
// Subcommand flags
|
|
728
|
+
for (const subcmd of cmd.subcommands) {
|
|
729
|
+
if (subcmd.flags && subcmd.flags.length > 0) {
|
|
730
|
+
const subcmdFlags = subcmd.flags.map((f) => f.name).join(" ");
|
|
731
|
+
lines.push(` if [[ \${words[2]} == "${subcmd.name}" ]]; then`);
|
|
732
|
+
lines.push(` COMPREPLY=($(compgen -W "${subcmdFlags}" -- "$cur"))`);
|
|
733
|
+
lines.push(" return");
|
|
734
|
+
lines.push(" fi");
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
// Command-level flags
|
|
740
|
+
if (cmd.flags && cmd.flags.length > 0) {
|
|
741
|
+
const cmdFlags = cmd.flags.map((f) => f.name).join(" ");
|
|
742
|
+
lines.push(` COMPREPLY=($(compgen -W "${cmdFlags}" -- "$cur"))`);
|
|
743
|
+
lines.push(" return");
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
lines.push(" fi");
|
|
747
|
+
lines.push("");
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
lines.push(" return 0");
|
|
751
|
+
lines.push("}");
|
|
752
|
+
lines.push("");
|
|
753
|
+
lines.push("complete -F _ap ap");
|
|
754
|
+
|
|
755
|
+
return lines.join("\n");
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
export function generateZsh(): string {
|
|
759
|
+
const lines: string[] = [
|
|
760
|
+
"#compdef ap",
|
|
761
|
+
"# Zsh completion for ap",
|
|
762
|
+
"# Place this file in your fpath or source it:",
|
|
763
|
+
"# source <(ap --completions zsh)",
|
|
764
|
+
"",
|
|
765
|
+
"_ap() {",
|
|
766
|
+
" local -a commands",
|
|
767
|
+
" commands=(",
|
|
768
|
+
];
|
|
769
|
+
|
|
770
|
+
// List all commands
|
|
771
|
+
for (const cmd of COMMANDS) {
|
|
772
|
+
lines.push(` '${cmd.name}:${cmd.desc}'`);
|
|
773
|
+
}
|
|
774
|
+
lines.push(" )");
|
|
775
|
+
lines.push("");
|
|
776
|
+
|
|
777
|
+
lines.push(" local -a global_opts");
|
|
778
|
+
lines.push(" global_opts=(");
|
|
779
|
+
lines.push(" '--help[Show help]'");
|
|
780
|
+
lines.push(" '--version[Show version]'");
|
|
781
|
+
lines.push(" '--completions[Generate shell completions]:shell:(bash zsh fish)'");
|
|
782
|
+
lines.push(" )");
|
|
783
|
+
lines.push("");
|
|
784
|
+
|
|
785
|
+
lines.push(" if (( CURRENT == 2 )); then");
|
|
786
|
+
lines.push(" _describe 'command' commands");
|
|
787
|
+
lines.push(" _arguments $global_opts");
|
|
788
|
+
lines.push(" return");
|
|
789
|
+
lines.push(" fi");
|
|
790
|
+
lines.push("");
|
|
791
|
+
|
|
792
|
+
lines.push(' local command="$words[2]"');
|
|
793
|
+
lines.push("");
|
|
794
|
+
lines.push(' case "$command" in');
|
|
795
|
+
|
|
796
|
+
// Generate completions for each command
|
|
797
|
+
for (const cmd of COMMANDS) {
|
|
798
|
+
lines.push(` ${cmd.name})`);
|
|
799
|
+
|
|
800
|
+
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
801
|
+
lines.push(" local -a subcommands");
|
|
802
|
+
lines.push(" subcommands=(");
|
|
803
|
+
for (const subcmd of cmd.subcommands) {
|
|
804
|
+
lines.push(` '${subcmd.name}:${subcmd.desc}'`);
|
|
805
|
+
}
|
|
806
|
+
lines.push(" )");
|
|
807
|
+
lines.push("");
|
|
808
|
+
lines.push(" if (( CURRENT == 3 )); then");
|
|
809
|
+
lines.push(" _describe 'subcommand' subcommands");
|
|
810
|
+
lines.push(" return");
|
|
811
|
+
lines.push(" fi");
|
|
812
|
+
|
|
813
|
+
// Subcommand-specific flags
|
|
814
|
+
for (const subcmd of cmd.subcommands) {
|
|
815
|
+
if (subcmd.flags && subcmd.flags.length > 0) {
|
|
816
|
+
lines.push(` if [[ $words[3] == "${subcmd.name}" ]]; then`);
|
|
817
|
+
lines.push(" _arguments \\");
|
|
818
|
+
for (const flag of subcmd.flags) {
|
|
819
|
+
if (flag.values) {
|
|
820
|
+
const vals = flag.values.join(" ");
|
|
821
|
+
lines.push(` '${flag.name}[${flag.desc}]:value:(${vals})' \\`);
|
|
822
|
+
} else if (flag.takesValue) {
|
|
823
|
+
lines.push(` '${flag.name}[${flag.desc}]:value:' \\`);
|
|
824
|
+
} else {
|
|
825
|
+
lines.push(` '${flag.name}[${flag.desc}]' \\`);
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
const lastLine = lines[lines.length - 1];
|
|
829
|
+
if (lastLine) {
|
|
830
|
+
lines[lines.length - 1] = lastLine.replace(" \\", "");
|
|
831
|
+
}
|
|
832
|
+
lines.push(" return");
|
|
833
|
+
lines.push(" fi");
|
|
834
|
+
}
|
|
835
|
+
}
|
|
836
|
+
}
|
|
837
|
+
|
|
838
|
+
// Command-level flags
|
|
839
|
+
if (cmd.flags && cmd.flags.length > 0) {
|
|
840
|
+
lines.push(" _arguments \\");
|
|
841
|
+
for (const flag of cmd.flags) {
|
|
842
|
+
if (flag.values) {
|
|
843
|
+
const vals = flag.values.join(" ");
|
|
844
|
+
lines.push(` '${flag.name}[${flag.desc}]:value:(${vals})' \\`);
|
|
845
|
+
} else if (flag.takesValue) {
|
|
846
|
+
lines.push(` '${flag.name}[${flag.desc}]:value:' \\`);
|
|
847
|
+
} else {
|
|
848
|
+
lines.push(` '${flag.name}[${flag.desc}]' \\`);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
const lastLine = lines[lines.length - 1];
|
|
852
|
+
if (lastLine) {
|
|
853
|
+
lines[lines.length - 1] = lastLine.replace(" \\", "");
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
lines.push(" ;;");
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
lines.push(" esac");
|
|
861
|
+
lines.push("}");
|
|
862
|
+
lines.push("");
|
|
863
|
+
lines.push('_ap "$@"');
|
|
864
|
+
|
|
865
|
+
return lines.join("\n");
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
export function generateFish(): string {
|
|
869
|
+
const lines: string[] = [
|
|
870
|
+
"# Fish completion for ap",
|
|
871
|
+
"# Place this file in ~/.config/fish/completions/ap.fish or source it:",
|
|
872
|
+
"# ap --completions fish | source",
|
|
873
|
+
"",
|
|
874
|
+
"# Remove all existing completions for ap",
|
|
875
|
+
"complete -c ap -e",
|
|
876
|
+
"",
|
|
877
|
+
"# Global options",
|
|
878
|
+
"complete -c ap -l help -d 'Show help'",
|
|
879
|
+
"complete -c ap -l version -d 'Show version'",
|
|
880
|
+
"complete -c ap -l completions -d 'Generate shell completions' -xa 'bash zsh fish'",
|
|
881
|
+
"",
|
|
882
|
+
];
|
|
883
|
+
|
|
884
|
+
// Generate completions for each command
|
|
885
|
+
for (const cmd of COMMANDS) {
|
|
886
|
+
// Command name
|
|
887
|
+
lines.push(`# ${cmd.desc}`);
|
|
888
|
+
lines.push(`complete -c ap -f -n '__fish_use_subcommand' -a '${cmd.name}' -d '${cmd.desc}'`);
|
|
889
|
+
|
|
890
|
+
if (cmd.subcommands && cmd.subcommands.length > 0) {
|
|
891
|
+
// Subcommand names
|
|
892
|
+
for (const subcmd of cmd.subcommands) {
|
|
893
|
+
lines.push(
|
|
894
|
+
`complete -c ap -f -n '__fish_seen_subcommand_from ${cmd.name}; and not __fish_seen_subcommand_from ${cmd.subcommands.map((s) => s.name).join(" ")}' -a '${subcmd.name}' -d '${subcmd.desc}'`,
|
|
895
|
+
);
|
|
896
|
+
|
|
897
|
+
// Subcommand flags
|
|
898
|
+
if (subcmd.flags && subcmd.flags.length > 0) {
|
|
899
|
+
for (const flag of subcmd.flags) {
|
|
900
|
+
const flagName = flag.name.replace(/^--/, "");
|
|
901
|
+
const cond = `'__fish_seen_subcommand_from ${cmd.name}; and __fish_seen_subcommand_from ${subcmd.name}'`;
|
|
902
|
+
|
|
903
|
+
if (flag.values) {
|
|
904
|
+
lines.push(
|
|
905
|
+
`complete -c ap -f -n ${cond} -l '${flagName}' -d '${flag.desc}' -xa '${flag.values.join(" ")}'`,
|
|
906
|
+
);
|
|
907
|
+
} else if (flag.takesValue) {
|
|
908
|
+
lines.push(`complete -c ap -n ${cond} -l '${flagName}' -d '${flag.desc}'`);
|
|
909
|
+
} else {
|
|
910
|
+
lines.push(`complete -c ap -f -n ${cond} -l '${flagName}' -d '${flag.desc}'`);
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
// Command-level flags
|
|
918
|
+
if (cmd.flags && cmd.flags.length > 0) {
|
|
919
|
+
for (const flag of cmd.flags) {
|
|
920
|
+
const flagName = flag.name.replace(/^--/, "");
|
|
921
|
+
const cond = `'__fish_seen_subcommand_from ${cmd.name}'`;
|
|
922
|
+
|
|
923
|
+
if (flag.values) {
|
|
924
|
+
lines.push(
|
|
925
|
+
`complete -c ap -f -n ${cond} -l '${flagName}' -d '${flag.desc}' -xa '${flag.values.join(" ")}'`,
|
|
926
|
+
);
|
|
927
|
+
} else if (flag.takesValue) {
|
|
928
|
+
lines.push(`complete -c ap -n ${cond} -l '${flagName}' -d '${flag.desc}'`);
|
|
929
|
+
} else {
|
|
930
|
+
lines.push(`complete -c ap -f -n ${cond} -l '${flagName}' -d '${flag.desc}'`);
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
|
|
935
|
+
lines.push("");
|
|
936
|
+
}
|
|
937
|
+
|
|
938
|
+
return lines.join("\n");
|
|
939
|
+
}
|
|
940
|
+
|
|
941
|
+
/**
|
|
942
|
+
* Create the Commander command for `agentplate completions`.
|
|
943
|
+
*/
|
|
944
|
+
export function createCompletionsCommand(): Command {
|
|
945
|
+
return new Command("completions")
|
|
946
|
+
.description("Generate shell completions")
|
|
947
|
+
.argument("<shell>", "Shell to generate completions for (bash, zsh, fish)")
|
|
948
|
+
.action((shell: string) => {
|
|
949
|
+
completionsCommand([shell]);
|
|
950
|
+
});
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
export function completionsCommand(args: string[]): void {
|
|
954
|
+
const shell = args[0];
|
|
955
|
+
|
|
956
|
+
if (!shell) {
|
|
957
|
+
printError("missing shell argument", "Usage: ap --completions <bash|zsh|fish>");
|
|
958
|
+
process.exitCode = 1;
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
let script: string;
|
|
963
|
+
switch (shell.toLowerCase()) {
|
|
964
|
+
case "bash":
|
|
965
|
+
script = generateBash();
|
|
966
|
+
break;
|
|
967
|
+
case "zsh":
|
|
968
|
+
script = generateZsh();
|
|
969
|
+
break;
|
|
970
|
+
case "fish":
|
|
971
|
+
script = generateFish();
|
|
972
|
+
break;
|
|
973
|
+
default:
|
|
974
|
+
printError(`unknown shell '${shell}'`, "Supported shells: bash, zsh, fish");
|
|
975
|
+
process.exitCode = 1;
|
|
976
|
+
return;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
process.stdout.write(script);
|
|
980
|
+
process.stdout.write("\n");
|
|
981
|
+
}
|