@proletariat/cli 0.3.93 → 0.3.95
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/dist/commands/action/create.d.ts +1 -1
- package/dist/commands/action/delete.d.ts +1 -1
- package/dist/commands/action/index.d.ts +1 -1
- package/dist/commands/action/list.d.ts +1 -1
- package/dist/commands/action/run.d.ts +1 -1
- package/dist/commands/action/show.d.ts +1 -1
- package/dist/commands/action/update.d.ts +1 -1
- package/dist/commands/agent/cleanup.d.ts +3 -4
- package/dist/commands/agent/cleanup.js +5 -4
- package/dist/commands/agent/cleanup.js.map +1 -1
- package/dist/commands/agent/gc.d.ts +3 -4
- package/dist/commands/agent/gc.js +5 -4
- package/dist/commands/agent/gc.js.map +1 -1
- package/dist/commands/agent/index.d.ts +3 -4
- package/dist/commands/agent/index.js +5 -4
- package/dist/commands/agent/index.js.map +1 -1
- package/dist/commands/agent/list.d.ts +3 -4
- package/dist/commands/agent/list.js +5 -4
- package/dist/commands/agent/list.js.map +1 -1
- package/dist/commands/agent/login.d.ts +1 -1
- package/dist/commands/agent/rebuild.d.ts +1 -1
- package/dist/commands/agent/remove.d.ts +3 -4
- package/dist/commands/agent/remove.js +5 -4
- package/dist/commands/agent/remove.js.map +1 -1
- package/dist/commands/agent/restart.d.ts +1 -1
- package/dist/commands/agent/shell.d.ts +1 -1
- package/dist/commands/agent/staff/index.d.ts +3 -4
- package/dist/commands/agent/staff/index.js +5 -4
- package/dist/commands/agent/staff/index.js.map +1 -1
- package/dist/commands/agent/staff/remove.d.ts +3 -4
- package/dist/commands/agent/staff/remove.js +5 -4
- package/dist/commands/agent/staff/remove.js.map +1 -1
- package/dist/commands/agent/status.d.ts +3 -4
- package/dist/commands/agent/status.js +5 -4
- package/dist/commands/agent/status.js.map +1 -1
- package/dist/commands/agent/visit.d.ts +3 -4
- package/dist/commands/agent/visit.js +5 -4
- package/dist/commands/agent/visit.js.map +1 -1
- package/dist/commands/asana/import.d.ts +1 -1
- package/dist/commands/branch/create.d.ts +1 -1
- package/dist/commands/branch/create.js +1 -12
- package/dist/commands/branch/create.js.map +1 -1
- package/dist/commands/branch/index.d.ts +1 -1
- package/dist/commands/branch/list.d.ts +3 -4
- package/dist/commands/branch/list.js +5 -4
- package/dist/commands/branch/list.js.map +1 -1
- package/dist/commands/branch/validate.d.ts +3 -4
- package/dist/commands/branch/validate.js +6 -5
- package/dist/commands/branch/validate.js.map +1 -1
- package/dist/commands/branch/where.d.ts +3 -4
- package/dist/commands/branch/where.js +5 -4
- package/dist/commands/branch/where.js.map +1 -1
- package/dist/commands/commit.js +1 -1
- package/dist/commands/commit.js.map +1 -1
- package/dist/commands/config/index.js +2 -2
- package/dist/commands/config/index.js.map +1 -1
- package/dist/commands/db/backup.d.ts +16 -0
- package/dist/commands/db/backup.js +125 -0
- package/dist/commands/db/backup.js.map +1 -0
- package/dist/commands/db/repair.js +8 -11
- package/dist/commands/db/repair.js.map +1 -1
- package/dist/commands/diet.d.ts +1 -1
- package/dist/commands/docker/index.js +2 -0
- package/dist/commands/docker/index.js.map +1 -1
- package/dist/commands/docker/rebuild-cache.d.ts +12 -0
- package/dist/commands/docker/rebuild-cache.js +144 -0
- package/dist/commands/docker/rebuild-cache.js.map +1 -0
- package/dist/commands/execution/config.d.ts +3 -4
- package/dist/commands/execution/config.js +5 -4
- package/dist/commands/execution/config.js.map +1 -1
- package/dist/commands/execution/index.d.ts +3 -4
- package/dist/commands/execution/index.js +5 -4
- package/dist/commands/execution/index.js.map +1 -1
- package/dist/commands/execution/list.d.ts +3 -4
- package/dist/commands/execution/list.js +5 -4
- package/dist/commands/execution/list.js.map +1 -1
- package/dist/commands/execution/logs.d.ts +3 -4
- package/dist/commands/execution/logs.js +5 -4
- package/dist/commands/execution/logs.js.map +1 -1
- package/dist/commands/execution/stop.d.ts +3 -4
- package/dist/commands/execution/stop.js +5 -4
- package/dist/commands/execution/stop.js.map +1 -1
- package/dist/commands/execution/view.d.ts +3 -4
- package/dist/commands/execution/view.js +5 -4
- package/dist/commands/execution/view.js.map +1 -1
- package/dist/commands/hook/export.d.ts +3 -4
- package/dist/commands/hook/export.js +5 -4
- package/dist/commands/hook/export.js.map +1 -1
- package/dist/commands/hook/fire.d.ts +3 -4
- package/dist/commands/hook/fire.js +5 -4
- package/dist/commands/hook/fire.js.map +1 -1
- package/dist/commands/hook/index.d.ts +1 -1
- package/dist/commands/hook/list.d.ts +3 -4
- package/dist/commands/hook/list.js +5 -4
- package/dist/commands/hook/list.js.map +1 -1
- package/dist/commands/hook/preset.d.ts +3 -4
- package/dist/commands/hook/preset.js +5 -4
- package/dist/commands/hook/preset.js.map +1 -1
- package/dist/commands/linear/auth.d.ts +1 -1
- package/dist/commands/linear/connect.d.ts +1 -1
- package/dist/commands/linear/import.d.ts +1 -1
- package/dist/commands/linear/status.d.ts +1 -1
- package/dist/commands/linear/sync.d.ts +1 -1
- package/dist/commands/mcp-server.d.ts +8 -2
- package/dist/commands/mcp-server.js +15 -28
- package/dist/commands/mcp-server.js.map +1 -1
- package/dist/commands/monday/connect.d.ts +1 -1
- package/dist/commands/monday/sync.d.ts +1 -1
- package/dist/commands/orchestrate/index.d.ts +3 -4
- package/dist/commands/orchestrate/index.js +5 -4
- package/dist/commands/orchestrate/index.js.map +1 -1
- package/dist/commands/orchestrator/index.d.ts +3 -4
- package/dist/commands/orchestrator/index.js +5 -4
- package/dist/commands/orchestrator/index.js.map +1 -1
- package/dist/commands/orchestrator/start.d.ts +3 -3
- package/dist/commands/orchestrator/start.js +38 -40
- package/dist/commands/orchestrator/start.js.map +1 -1
- package/dist/commands/pr/checks.d.ts +3 -4
- package/dist/commands/pr/checks.js +5 -4
- package/dist/commands/pr/checks.js.map +1 -1
- package/dist/commands/pr/close.d.ts +1 -1
- package/dist/commands/pr/create.d.ts +1 -1
- package/dist/commands/pr/index.d.ts +1 -1
- package/dist/commands/pr/link.d.ts +1 -1
- package/dist/commands/pr/list.d.ts +1 -1
- package/dist/commands/pr/merge.d.ts +1 -1
- package/dist/commands/pr/status.d.ts +1 -1
- package/dist/commands/pull.d.ts +1 -1
- package/dist/commands/repo/add.d.ts +3 -4
- package/dist/commands/repo/add.js +5 -4
- package/dist/commands/repo/add.js.map +1 -1
- package/dist/commands/repo/create.d.ts +3 -4
- package/dist/commands/repo/create.js +5 -4
- package/dist/commands/repo/create.js.map +1 -1
- package/dist/commands/repo/fix-remotes.d.ts +3 -4
- package/dist/commands/repo/fix-remotes.js +5 -4
- package/dist/commands/repo/fix-remotes.js.map +1 -1
- package/dist/commands/repo/index.d.ts +3 -4
- package/dist/commands/repo/index.js +5 -4
- package/dist/commands/repo/index.js.map +1 -1
- package/dist/commands/repo/list.d.ts +3 -4
- package/dist/commands/repo/list.js +5 -4
- package/dist/commands/repo/list.js.map +1 -1
- package/dist/commands/repo/remove.d.ts +1 -1
- package/dist/commands/repo/view.d.ts +1 -1
- package/dist/commands/session/attach.d.ts +1 -1
- package/dist/commands/session/cleanup.d.ts +3 -4
- package/dist/commands/session/cleanup.js +5 -4
- package/dist/commands/session/cleanup.js.map +1 -1
- package/dist/commands/session/create.d.ts +3 -4
- package/dist/commands/session/create.js +5 -4
- package/dist/commands/session/create.js.map +1 -1
- package/dist/commands/session/exec.d.ts +3 -4
- package/dist/commands/session/exec.js +5 -4
- package/dist/commands/session/exec.js.map +1 -1
- package/dist/commands/session/health.d.ts +1 -1
- package/dist/commands/session/health.js +18 -0
- package/dist/commands/session/health.js.map +1 -1
- package/dist/commands/session/index.d.ts +3 -4
- package/dist/commands/session/index.js +9 -4
- package/dist/commands/session/index.js.map +1 -1
- package/dist/commands/session/inspect.d.ts +3 -4
- package/dist/commands/session/inspect.js +5 -4
- package/dist/commands/session/inspect.js.map +1 -1
- package/dist/commands/session/list.d.ts +3 -4
- package/dist/commands/session/list.js +19 -5
- package/dist/commands/session/list.js.map +1 -1
- package/dist/commands/session/peek.d.ts +1 -1
- package/dist/commands/session/prune.d.ts +3 -4
- package/dist/commands/session/prune.js +5 -4
- package/dist/commands/session/prune.js.map +1 -1
- package/dist/commands/session/report.d.ts +25 -5
- package/dist/commands/session/report.js +201 -5
- package/dist/commands/session/report.js.map +1 -1
- package/dist/commands/session/restart.d.ts +3 -4
- package/dist/commands/session/restart.js +5 -4
- package/dist/commands/session/restart.js.map +1 -1
- package/dist/commands/session/watch.d.ts +17 -0
- package/dist/commands/session/watch.js +139 -0
- package/dist/commands/session/watch.js.map +1 -0
- package/dist/commands/shortcut/connect.d.ts +1 -1
- package/dist/commands/support/logs.d.ts +1 -1
- package/dist/commands/ticket/create.d.ts +1 -1
- package/dist/commands/ticket/delete.d.ts +1 -1
- package/dist/commands/ticket/edit.d.ts +1 -1
- package/dist/commands/ticket/index.d.ts +3 -4
- package/dist/commands/ticket/index.js +11 -40
- package/dist/commands/ticket/index.js.map +1 -1
- package/dist/commands/ticket/list.d.ts +1 -1
- package/dist/commands/ticket/move.d.ts +1 -1
- package/dist/commands/ticket/show.d.ts +8 -7
- package/dist/commands/ticket/show.js +101 -8
- package/dist/commands/ticket/show.js.map +1 -1
- package/dist/commands/ticket/update.d.ts +1 -1
- package/dist/commands/trello/configure.d.ts +1 -1
- package/dist/commands/trello/import.d.ts +1 -1
- package/dist/commands/trello/sync.d.ts +1 -1
- package/dist/commands/{dashboard/index.d.ts → web.d.ts} +10 -4
- package/dist/commands/web.js +82 -0
- package/dist/commands/web.js.map +1 -0
- package/dist/commands/work/asana.d.ts +1 -1
- package/dist/commands/work/complete.d.ts +1 -1
- package/dist/commands/work/groom.d.ts +1 -1
- package/dist/commands/work/hooks/add.d.ts +3 -4
- package/dist/commands/work/hooks/add.js +5 -4
- package/dist/commands/work/hooks/add.js.map +1 -1
- package/dist/commands/work/hooks/index.d.ts +1 -1
- package/dist/commands/work/hooks/list.d.ts +3 -4
- package/dist/commands/work/hooks/list.js +5 -4
- package/dist/commands/work/hooks/list.js.map +1 -1
- package/dist/commands/work/hooks/remove.d.ts +1 -1
- package/dist/commands/work/hooks/toggle.d.ts +3 -4
- package/dist/commands/work/hooks/toggle.js +5 -4
- package/dist/commands/work/hooks/toggle.js.map +1 -1
- package/dist/commands/work/implement.d.ts +1 -1
- package/dist/commands/work/index.d.ts +1 -1
- package/dist/commands/work/jira.d.ts +1 -1
- package/dist/commands/work/linear.d.ts +1 -1
- package/dist/commands/work/peek.d.ts +3 -4
- package/dist/commands/work/peek.js +5 -4
- package/dist/commands/work/peek.js.map +1 -1
- package/dist/commands/{ticket/cancel.d.ts → work/propose.d.ts} +11 -5
- package/dist/commands/work/propose.js +57 -0
- package/dist/commands/work/propose.js.map +1 -0
- package/dist/commands/work/ready.d.ts +1 -1
- package/dist/commands/work/ready.js +2 -2
- package/dist/commands/work/ready.js.map +1 -1
- package/dist/commands/work/rebase.d.ts +2 -2
- package/dist/commands/work/rebase.js +52 -49
- package/dist/commands/work/rebase.js.map +1 -1
- package/dist/commands/work/resolve.d.ts +1 -1
- package/dist/commands/work/review.d.ts +1 -1
- package/dist/commands/work/ship.d.ts +7 -1
- package/dist/commands/work/ship.js +217 -48
- package/dist/commands/work/ship.js.map +1 -1
- package/dist/commands/work/shortcut.d.ts +1 -1
- package/dist/commands/work/source/set.d.ts +1 -1
- package/dist/commands/work/source.d.ts +1 -1
- package/dist/commands/work/spawn.d.ts +1 -1
- package/dist/commands/work/start.d.ts +1 -1
- package/dist/commands/work/start.js +3 -6
- package/dist/commands/work/start.js.map +1 -1
- package/dist/commands/work/status.d.ts +1 -1
- package/dist/commands/work/stop.d.ts +3 -4
- package/dist/commands/work/stop.js +5 -4
- package/dist/commands/work/stop.js.map +1 -1
- package/dist/commands/work/watch.d.ts +1 -1
- package/dist/hooks/init.js +12 -2
- package/dist/hooks/init.js.map +1 -1
- package/dist/lib/asana/config.js +13 -7
- package/dist/lib/asana/config.js.map +1 -1
- package/dist/lib/branch/index.d.ts +6 -5
- package/dist/lib/branch/index.js +8 -13
- package/dist/lib/branch/index.js.map +1 -1
- package/dist/lib/clickup/client.d.ts +92 -0
- package/dist/lib/clickup/client.js +150 -0
- package/dist/lib/clickup/client.js.map +1 -0
- package/dist/lib/clickup/config.d.ts +41 -0
- package/dist/lib/clickup/config.js +104 -0
- package/dist/lib/clickup/config.js.map +1 -0
- package/dist/lib/clickup/index.d.ts +4 -0
- package/dist/lib/clickup/index.js +4 -0
- package/dist/lib/clickup/index.js.map +1 -0
- package/dist/lib/clickup/types.d.ts +104 -0
- package/dist/lib/clickup/types.js +34 -0
- package/dist/lib/clickup/types.js.map +1 -0
- package/dist/lib/dashboard/html.d.ts +2 -1
- package/dist/lib/dashboard/html.js +150 -522
- package/dist/lib/dashboard/html.js.map +1 -1
- package/dist/lib/database/credential-store.d.ts +64 -0
- package/dist/lib/database/credential-store.js +306 -0
- package/dist/lib/database/credential-store.js.map +1 -0
- package/dist/lib/database/db-safety.d.ts +48 -9
- package/dist/lib/database/db-safety.js +308 -43
- package/dist/lib/database/db-safety.js.map +1 -1
- package/dist/lib/database/index.d.ts +2 -1
- package/dist/lib/database/index.js +3 -1
- package/dist/lib/database/index.js.map +1 -1
- package/dist/lib/database/pmo-bootstrap.d.ts +7 -0
- package/dist/lib/database/pmo-bootstrap.js +45 -20
- package/dist/lib/database/pmo-bootstrap.js.map +1 -1
- package/dist/lib/database/workspace.js +7 -1
- package/dist/lib/database/workspace.js.map +1 -1
- package/dist/lib/execution/devcontainer.js +51 -0
- package/dist/lib/execution/devcontainer.js.map +1 -1
- package/dist/lib/execution/runners/docker-management.d.ts +23 -0
- package/dist/lib/execution/runners/docker-management.js +99 -7
- package/dist/lib/execution/runners/docker-management.js.map +1 -1
- package/dist/lib/execution/runners/docker.js +8 -0
- package/dist/lib/execution/runners/docker.js.map +1 -1
- package/dist/lib/execution/runners/prompt-builder.js +9 -6
- package/dist/lib/execution/runners/prompt-builder.js.map +1 -1
- package/dist/lib/execution/session-utils.d.ts +4 -0
- package/dist/lib/execution/session-utils.js +34 -24
- package/dist/lib/execution/session-utils.js.map +1 -1
- package/dist/lib/execution/spawner.js +2 -4
- package/dist/lib/execution/spawner.js.map +1 -1
- package/dist/lib/execution/storage.d.ts +29 -1
- package/dist/lib/execution/storage.js +77 -0
- package/dist/lib/execution/storage.js.map +1 -1
- package/dist/lib/execution/types.d.ts +17 -6
- package/dist/lib/execution/types.js +11 -8
- package/dist/lib/execution/types.js.map +1 -1
- package/dist/lib/external-issues/types.d.ts +3 -3
- package/dist/lib/external-issues/types.js +1 -1
- package/dist/lib/external-issues/types.js.map +1 -1
- package/dist/lib/jira/config.js +10 -4
- package/dist/lib/jira/config.js.map +1 -1
- package/dist/lib/linear/config.js +13 -8
- package/dist/lib/linear/config.js.map +1 -1
- package/dist/lib/machine-config.d.ts +8 -0
- package/dist/lib/machine-config.js +37 -0
- package/dist/lib/machine-config.js.map +1 -1
- package/dist/lib/mcp/generator.d.ts +26 -0
- package/dist/lib/mcp/generator.js +219 -0
- package/dist/lib/mcp/generator.js.map +1 -0
- package/dist/lib/mcp/index.d.ts +1 -0
- package/dist/lib/mcp/index.js +1 -0
- package/dist/lib/mcp/index.js.map +1 -1
- package/dist/lib/mcp/tools/index.d.ts +0 -11
- package/dist/lib/mcp/tools/index.js +0 -11
- package/dist/lib/mcp/tools/index.js.map +1 -1
- package/dist/lib/mcp/tools/overrides/index.d.ts +23 -0
- package/dist/lib/mcp/tools/overrides/index.js +30 -0
- package/dist/lib/mcp/tools/overrides/index.js.map +1 -0
- package/dist/lib/mcp/tools/overrides/tmux.d.ts +11 -0
- package/dist/lib/mcp/tools/overrides/tmux.js +184 -0
- package/dist/lib/mcp/tools/overrides/tmux.js.map +1 -0
- package/dist/lib/mcp/tools/overrides/work-start.d.ts +12 -0
- package/dist/lib/mcp/tools/overrides/work-start.js +108 -0
- package/dist/lib/mcp/tools/overrides/work-start.js.map +1 -0
- package/dist/lib/mcp/tools/ticket.js +10 -48
- package/dist/lib/mcp/tools/ticket.js.map +1 -1
- package/dist/lib/monday/config.js +11 -5
- package/dist/lib/monday/config.js.map +1 -1
- package/dist/lib/orchestrate/poller.d.ts +1 -1
- package/dist/lib/orchestrate/poller.js +1 -1
- package/dist/lib/pmo/base-command.d.ts +20 -152
- package/dist/lib/pmo/base-command.js +32 -198
- package/dist/lib/pmo/base-command.js.map +1 -1
- package/dist/lib/pmo/index.d.ts +1 -0
- package/dist/lib/pmo/index.js +3 -0
- package/dist/lib/pmo/index.js.map +1 -1
- package/dist/lib/pmo/storage/base.d.ts +0 -18
- package/dist/lib/pmo/storage/base.js +5 -234
- package/dist/lib/pmo/storage/base.js.map +1 -1
- package/dist/lib/pmo/storage/index.d.ts +1 -76
- package/dist/lib/pmo/storage/index.js +1 -215
- package/dist/lib/pmo/storage/index.js.map +1 -1
- package/dist/lib/pmo/storage/tickets.d.ts +2 -2
- package/dist/lib/pmo/storage/tickets.js +4 -34
- package/dist/lib/pmo/storage/tickets.js.map +1 -1
- package/dist/lib/pmo/types.d.ts +0 -37
- package/dist/lib/providers/clickup-provider.d.ts +28 -0
- package/dist/lib/providers/clickup-provider.js +353 -0
- package/dist/lib/providers/clickup-provider.js.map +1 -0
- package/dist/lib/providers/index.d.ts +1 -0
- package/dist/lib/providers/index.js +1 -0
- package/dist/lib/providers/index.js.map +1 -1
- package/dist/lib/providers/resolver.d.ts +1 -1
- package/dist/lib/providers/resolver.js +32 -5
- package/dist/lib/providers/resolver.js.map +1 -1
- package/dist/lib/providers/trello-provider.d.ts +28 -0
- package/dist/lib/providers/trello-provider.js +381 -0
- package/dist/lib/providers/trello-provider.js.map +1 -0
- package/dist/lib/providers/types.d.ts +1 -1
- package/dist/lib/runners/claude-code-runner.js +13 -4
- package/dist/lib/runners/claude-code-runner.js.map +1 -1
- package/dist/lib/runtime-command.d.ts +219 -0
- package/dist/lib/runtime-command.js +320 -0
- package/dist/lib/runtime-command.js.map +1 -0
- package/dist/lib/session/heartbeat.d.ts +45 -0
- package/dist/lib/session/heartbeat.js +150 -0
- package/dist/lib/session/heartbeat.js.map +1 -0
- package/dist/lib/session/index.d.ts +7 -0
- package/dist/lib/session/index.js +8 -0
- package/dist/lib/session/index.js.map +1 -0
- package/dist/lib/session/watcher.d.ts +79 -0
- package/dist/lib/session/watcher.js +142 -0
- package/dist/lib/session/watcher.js.map +1 -0
- package/dist/lib/shipping/auto-merge.d.ts +57 -0
- package/dist/lib/shipping/auto-merge.js +311 -0
- package/dist/lib/shipping/auto-merge.js.map +1 -0
- package/dist/lib/shipping/github.d.ts +68 -0
- package/dist/lib/shipping/github.js +217 -0
- package/dist/lib/shipping/github.js.map +1 -0
- package/dist/lib/shipping/index.d.ts +13 -0
- package/dist/lib/shipping/index.js +11 -0
- package/dist/lib/shipping/index.js.map +1 -0
- package/dist/lib/shipping/rebase.d.ts +35 -0
- package/dist/lib/shipping/rebase.js +107 -0
- package/dist/lib/shipping/rebase.js.map +1 -0
- package/dist/lib/shipping/types.d.ts +181 -0
- package/dist/lib/shipping/types.js +9 -0
- package/dist/lib/shipping/types.js.map +1 -0
- package/dist/lib/shortcut/config.js +13 -7
- package/dist/lib/shortcut/config.js.map +1 -1
- package/dist/lib/trello/client.d.ts +1 -0
- package/dist/lib/trello/client.js +6 -0
- package/dist/lib/trello/client.js.map +1 -1
- package/dist/lib/trello/config.js +17 -12
- package/dist/lib/trello/config.js.map +1 -1
- package/dist/lib/work-lifecycle/events.d.ts +1 -1
- package/dist/lib/work-source/config.d.ts +1 -1
- package/dist/lib/work-source/config.js +11 -1
- package/dist/lib/work-source/config.js.map +1 -1
- package/dist/lib/work-source/provider-sources.js +6 -1
- package/dist/lib/work-source/provider-sources.js.map +1 -1
- package/oclif.manifest.json +3810 -5723
- package/package.json +8 -8
- package/dist/commands/board/index.d.ts +0 -21
- package/dist/commands/board/index.js +0 -263
- package/dist/commands/board/index.js.map +0 -1
- package/dist/commands/board/view.d.ts +0 -15
- package/dist/commands/board/view.js +0 -137
- package/dist/commands/board/view.js.map +0 -1
- package/dist/commands/board/watch.d.ts +0 -15
- package/dist/commands/board/watch.js +0 -59
- package/dist/commands/board/watch.js.map +0 -1
- package/dist/commands/dashboard/index.js +0 -117
- package/dist/commands/dashboard/index.js.map +0 -1
- package/dist/commands/dashboard.d.ts +0 -38
- package/dist/commands/dashboard.js +0 -353
- package/dist/commands/dashboard.js.map +0 -1
- package/dist/commands/pmo/init.d.ts +0 -28
- package/dist/commands/pmo/init.js +0 -410
- package/dist/commands/pmo/init.js.map +0 -1
- package/dist/commands/project/archive.d.ts +0 -18
- package/dist/commands/project/archive.js +0 -79
- package/dist/commands/project/archive.js.map +0 -1
- package/dist/commands/project/create.d.ts +0 -24
- package/dist/commands/project/create.js +0 -191
- package/dist/commands/project/create.js.map +0 -1
- package/dist/commands/project/delete.d.ts +0 -18
- package/dist/commands/project/delete.js +0 -115
- package/dist/commands/project/delete.js.map +0 -1
- package/dist/commands/project/index.d.ts +0 -14
- package/dist/commands/project/index.js +0 -60
- package/dist/commands/project/index.js.map +0 -1
- package/dist/commands/project/list.d.ts +0 -16
- package/dist/commands/project/list.js +0 -115
- package/dist/commands/project/list.js.map +0 -1
- package/dist/commands/project/spec.d.ts +0 -19
- package/dist/commands/project/spec.js +0 -218
- package/dist/commands/project/spec.js.map +0 -1
- package/dist/commands/project/unarchive.d.ts +0 -17
- package/dist/commands/project/unarchive.js +0 -55
- package/dist/commands/project/unarchive.js.map +0 -1
- package/dist/commands/project/update.d.ts +0 -19
- package/dist/commands/project/update.js +0 -161
- package/dist/commands/project/update.js.map +0 -1
- package/dist/commands/project/view.d.ts +0 -17
- package/dist/commands/project/view.js +0 -107
- package/dist/commands/project/view.js.map +0 -1
- package/dist/commands/ticket/bulk.d.ts +0 -14
- package/dist/commands/ticket/bulk.js +0 -141
- package/dist/commands/ticket/bulk.js.map +0 -1
- package/dist/commands/ticket/cancel.js +0 -206
- package/dist/commands/ticket/cancel.js.map +0 -1
- package/dist/commands/ticket/category.d.ts +0 -15
- package/dist/commands/ticket/category.js +0 -64
- package/dist/commands/ticket/category.js.map +0 -1
- package/dist/commands/ticket/complete.d.ts +0 -17
- package/dist/commands/ticket/complete.js +0 -193
- package/dist/commands/ticket/complete.js.map +0 -1
- package/dist/commands/ticket/epic.d.ts +0 -21
- package/dist/commands/ticket/epic.js +0 -306
- package/dist/commands/ticket/epic.js.map +0 -1
- package/dist/commands/ticket/link/block.d.ts +0 -15
- package/dist/commands/ticket/link/block.js +0 -96
- package/dist/commands/ticket/link/block.js.map +0 -1
- package/dist/commands/ticket/link/duplicates.d.ts +0 -15
- package/dist/commands/ticket/link/duplicates.js +0 -96
- package/dist/commands/ticket/link/duplicates.js.map +0 -1
- package/dist/commands/ticket/link/index.d.ts +0 -14
- package/dist/commands/ticket/link/index.js +0 -99
- package/dist/commands/ticket/link/index.js.map +0 -1
- package/dist/commands/ticket/link/relates.d.ts +0 -15
- package/dist/commands/ticket/link/relates.js +0 -96
- package/dist/commands/ticket/link/relates.js.map +0 -1
- package/dist/commands/ticket/project.d.ts +0 -19
- package/dist/commands/ticket/project.js +0 -257
- package/dist/commands/ticket/project.js.map +0 -1
- package/dist/commands/ticket/reassign.d.ts +0 -20
- package/dist/commands/ticket/reassign.js +0 -340
- package/dist/commands/ticket/reassign.js.map +0 -1
- package/dist/commands/ticket/resolve.d.ts +0 -68
- package/dist/commands/ticket/resolve.js +0 -306
- package/dist/commands/ticket/resolve.js.map +0 -1
- package/dist/commands/ticket/spec.d.ts +0 -19
- package/dist/commands/ticket/spec.js +0 -260
- package/dist/commands/ticket/spec.js.map +0 -1
- package/dist/commands/ticket/status.d.ts +0 -14
- package/dist/commands/ticket/status.js +0 -84
- package/dist/commands/ticket/status.js.map +0 -1
- package/dist/commands/ticket/view.d.ts +0 -14
- package/dist/commands/ticket/view.js +0 -113
- package/dist/commands/ticket/view.js.map +0 -1
- package/dist/lib/mcp/tools/board.d.ts +0 -6
- package/dist/lib/mcp/tools/board.js +0 -190
- package/dist/lib/mcp/tools/board.js.map +0 -1
- package/dist/lib/mcp/tools/category.d.ts +0 -6
- package/dist/lib/mcp/tools/category.js +0 -85
- package/dist/lib/mcp/tools/category.js.map +0 -1
- package/dist/lib/mcp/tools/epic.d.ts +0 -6
- package/dist/lib/mcp/tools/epic.js +0 -184
- package/dist/lib/mcp/tools/epic.js.map +0 -1
- package/dist/lib/mcp/tools/label.d.ts +0 -6
- package/dist/lib/mcp/tools/label.js +0 -339
- package/dist/lib/mcp/tools/label.js.map +0 -1
- package/dist/lib/mcp/tools/phase.d.ts +0 -6
- package/dist/lib/mcp/tools/phase.js +0 -132
- package/dist/lib/mcp/tools/phase.js.map +0 -1
- package/dist/lib/mcp/tools/project.d.ts +0 -6
- package/dist/lib/mcp/tools/project.js +0 -197
- package/dist/lib/mcp/tools/project.js.map +0 -1
- package/dist/lib/mcp/tools/roadmap.d.ts +0 -6
- package/dist/lib/mcp/tools/roadmap.js +0 -124
- package/dist/lib/mcp/tools/roadmap.js.map +0 -1
- package/dist/lib/mcp/tools/status.d.ts +0 -6
- package/dist/lib/mcp/tools/status.js +0 -110
- package/dist/lib/mcp/tools/status.js.map +0 -1
- package/dist/lib/mcp/tools/template.d.ts +0 -6
- package/dist/lib/mcp/tools/template.js +0 -108
- package/dist/lib/mcp/tools/template.js.map +0 -1
- package/dist/lib/mcp/tools/view.d.ts +0 -6
- package/dist/lib/mcp/tools/view.js +0 -77
- package/dist/lib/mcp/tools/view.js.map +0 -1
- package/dist/lib/mcp/tools/workflow.d.ts +0 -6
- package/dist/lib/mcp/tools/workflow.js +0 -96
- package/dist/lib/mcp/tools/workflow.js.map +0 -1
- package/dist/lib/pmo/storage/categories.d.ts +0 -50
- package/dist/lib/pmo/storage/categories.js +0 -206
- package/dist/lib/pmo/storage/categories.js.map +0 -1
- package/dist/lib/pmo/storage/labels.d.ts +0 -55
- package/dist/lib/pmo/storage/labels.js +0 -347
- package/dist/lib/pmo/storage/labels.js.map +0 -1
- package/dist/lib/pmo/storage/phases.d.ts +0 -65
- package/dist/lib/pmo/storage/phases.js +0 -393
- package/dist/lib/pmo/storage/phases.js.map +0 -1
- package/dist/lib/pmo/storage/roadmaps.d.ts +0 -64
- package/dist/lib/pmo/storage/roadmaps.js +0 -373
- package/dist/lib/pmo/storage/roadmaps.js.map +0 -1
- package/dist/lib/pmo/storage/views.d.ts +0 -57
- package/dist/lib/pmo/storage/views.js +0 -456
- package/dist/lib/pmo/storage/views.js.map +0 -1
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuntimeCommand - Base class for commands that need workspace.db access.
|
|
3
|
+
*
|
|
4
|
+
* Hierarchy: PromptCommand → RuntimeCommand → PMOCommand
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - HQ workspace resolution (this.hqPath)
|
|
8
|
+
* - workspace.db lifecycle (this.db, auto-close on cleanup)
|
|
9
|
+
* - SettingsStore for workspace_settings (this.settings)
|
|
10
|
+
* - execute()/cleanup() lifecycle pattern
|
|
11
|
+
* - Generic prompt utilities (selectFromList, promptForInput, handleError)
|
|
12
|
+
*
|
|
13
|
+
* Use this base class for commands that need workspace database access
|
|
14
|
+
* but do NOT require a ticket provider (PMO, Linear, etc.). For commands
|
|
15
|
+
* that need ticket/project operations, use PMOCommand which extends this.
|
|
16
|
+
*
|
|
17
|
+
* Commands that don't need workspace.db should extend PromptCommand directly.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { RuntimeCommand, runtimeBaseFlags } from '../../lib/runtime-command.js';
|
|
22
|
+
*
|
|
23
|
+
* export default class MyCommand extends RuntimeCommand {
|
|
24
|
+
* static flags = { ...runtimeBaseFlags };
|
|
25
|
+
*
|
|
26
|
+
* async execute(): Promise<void> {
|
|
27
|
+
* // HQ path and workspace.db are available
|
|
28
|
+
* const hqPath = this.requireHQ();
|
|
29
|
+
* const db = this.requireDB();
|
|
30
|
+
* const apiKey = this.settings?.get('linear.api_key');
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import type Database from 'better-sqlite3';
|
|
36
|
+
import { PromptCommand } from './prompt-command.js';
|
|
37
|
+
import { type WorkspaceConfig } from './database/index.js';
|
|
38
|
+
import { SettingsStore } from './database/settings-store.js';
|
|
39
|
+
import { type JsonFlags } from './prompt-json.js';
|
|
40
|
+
/**
|
|
41
|
+
* Base flags for machine-readable output mode.
|
|
42
|
+
* Include these in your command's flags by spreading: ...machineOutputFlags
|
|
43
|
+
*/
|
|
44
|
+
export declare const machineOutputFlags: {
|
|
45
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
46
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Base flags for RuntimeCommand subclasses.
|
|
50
|
+
* Includes machine output flags. Add command-specific flags alongside.
|
|
51
|
+
*/
|
|
52
|
+
export declare const runtimeBaseFlags: {
|
|
53
|
+
json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
54
|
+
machine: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
55
|
+
};
|
|
56
|
+
export declare abstract class RuntimeCommand extends PromptCommand {
|
|
57
|
+
/**
|
|
58
|
+
* Workspace database connection.
|
|
59
|
+
* Available after init() runs. May be null if no HQ found or DB failed to open.
|
|
60
|
+
*/
|
|
61
|
+
private _db;
|
|
62
|
+
/**
|
|
63
|
+
* Settings store for workspace_settings table.
|
|
64
|
+
* Available after init() runs. May be null if no DB available.
|
|
65
|
+
*/
|
|
66
|
+
private _settings;
|
|
67
|
+
/**
|
|
68
|
+
* HQ workspace root path.
|
|
69
|
+
* Available after init() runs. May be null if not in an HQ workspace.
|
|
70
|
+
*/
|
|
71
|
+
private _hqPath;
|
|
72
|
+
/**
|
|
73
|
+
* Workspace configuration from workspace.db.
|
|
74
|
+
* Available after init() runs. May be null if no DB available.
|
|
75
|
+
*/
|
|
76
|
+
private _workspaceConfig;
|
|
77
|
+
/**
|
|
78
|
+
* Flag to track if runtime context was successfully initialized
|
|
79
|
+
*/
|
|
80
|
+
private _runtimeInitialized;
|
|
81
|
+
/**
|
|
82
|
+
* oclif init hook - runs before the command executes.
|
|
83
|
+
* Resolves HQ workspace and opens workspace.db.
|
|
84
|
+
*/
|
|
85
|
+
init(): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Override run() to delegate to execute() and ensure cleanup.
|
|
88
|
+
* Subclasses should implement execute() instead of run().
|
|
89
|
+
*/
|
|
90
|
+
run(): Promise<void>;
|
|
91
|
+
/**
|
|
92
|
+
* Main command logic — implement this instead of run().
|
|
93
|
+
* Runtime context (hqPath, db, settings) is available via getters.
|
|
94
|
+
*/
|
|
95
|
+
protected abstract execute(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Cleanup handler — ensures database connections are closed.
|
|
98
|
+
* Called automatically after execute() completes or throws.
|
|
99
|
+
* Override in subclasses to add additional cleanup (call super.cleanup()).
|
|
100
|
+
*/
|
|
101
|
+
protected cleanup(): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* oclif catch hook — called when an error occurs.
|
|
104
|
+
* Ensures cleanup even on errors.
|
|
105
|
+
*/
|
|
106
|
+
catch(error: Error & {
|
|
107
|
+
exitCode?: number;
|
|
108
|
+
}): Promise<void>;
|
|
109
|
+
/**
|
|
110
|
+
* oclif finally hook — called after run() completes.
|
|
111
|
+
*/
|
|
112
|
+
finally(_: Error | undefined): Promise<void>;
|
|
113
|
+
/** HQ workspace root path, or null if not in an HQ workspace. */
|
|
114
|
+
protected get hqPath(): string | null;
|
|
115
|
+
/** Workspace database connection, or null if not available. */
|
|
116
|
+
protected get db(): Database.Database | null;
|
|
117
|
+
/** Settings store for workspace_settings, or null if not available. */
|
|
118
|
+
protected get settings(): SettingsStore | null;
|
|
119
|
+
/** Workspace configuration, or null if not available. */
|
|
120
|
+
protected get workspaceConfig(): WorkspaceConfig | null;
|
|
121
|
+
/** Whether the runtime context was successfully initialized. */
|
|
122
|
+
protected get runtimeInitialized(): boolean;
|
|
123
|
+
/**
|
|
124
|
+
* Require HQ workspace to be available. Throws with a helpful
|
|
125
|
+
* error message if no HQ was found.
|
|
126
|
+
*/
|
|
127
|
+
protected requireHQ(): string;
|
|
128
|
+
/**
|
|
129
|
+
* Require workspace database to be available. Throws with a helpful
|
|
130
|
+
* error message if the DB could not be opened.
|
|
131
|
+
*/
|
|
132
|
+
protected requireDB(): Database.Database;
|
|
133
|
+
/**
|
|
134
|
+
* Require settings store to be available.
|
|
135
|
+
*/
|
|
136
|
+
protected requireSettings(): SettingsStore;
|
|
137
|
+
/**
|
|
138
|
+
* Select from a list of items with JSON mode support for AI agents.
|
|
139
|
+
*
|
|
140
|
+
* In JSON mode: outputs choices as JSON with command field and exits
|
|
141
|
+
* In interactive mode: shows prompt and returns selected value
|
|
142
|
+
*
|
|
143
|
+
* @param options Configuration for the selection
|
|
144
|
+
* @returns The selected value (only in interactive mode)
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```typescript
|
|
148
|
+
* const ticketId = await this.selectFromList({
|
|
149
|
+
* message: 'Select ticket:',
|
|
150
|
+
* items: tickets,
|
|
151
|
+
* getName: (t) => `${t.id}: ${t.title}`,
|
|
152
|
+
* getValue: (t) => t.id,
|
|
153
|
+
* getCommand: (t) => `prlt ticket view ${t.id} --json`,
|
|
154
|
+
* jsonMode: { flags, commandName: 'ticket view' },
|
|
155
|
+
* });
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
protected selectFromList<T>(options: {
|
|
159
|
+
/** Prompt message shown to user */
|
|
160
|
+
message: string;
|
|
161
|
+
/** Items to select from */
|
|
162
|
+
items: T[];
|
|
163
|
+
/** Extract display name from item */
|
|
164
|
+
getName: (item: T) => string;
|
|
165
|
+
/** Extract value from item */
|
|
166
|
+
getValue: (item: T) => string;
|
|
167
|
+
/** Build command string for item (should include --json) */
|
|
168
|
+
getCommand: (item: T) => string;
|
|
169
|
+
/** JSON mode config — if provided and flags indicate JSON mode, outputs JSON */
|
|
170
|
+
jsonMode?: {
|
|
171
|
+
flags: JsonFlags & Record<string, unknown>;
|
|
172
|
+
commandName: string;
|
|
173
|
+
} | null;
|
|
174
|
+
/** Optional: include a Cancel option */
|
|
175
|
+
allowCancel?: boolean;
|
|
176
|
+
/** Optional: custom cancel value (default: null returned) */
|
|
177
|
+
cancelValue?: string;
|
|
178
|
+
}): Promise<string | null>;
|
|
179
|
+
/**
|
|
180
|
+
* Prompt for input with JSON mode support for AI agents.
|
|
181
|
+
*
|
|
182
|
+
* In JSON mode: outputs field info as JSON and exits
|
|
183
|
+
* In interactive mode: shows prompt and returns input value
|
|
184
|
+
*
|
|
185
|
+
* @param options Configuration for the input
|
|
186
|
+
* @returns The input value (only in interactive mode)
|
|
187
|
+
*/
|
|
188
|
+
protected promptForInput(options: {
|
|
189
|
+
/** Prompt message shown to user */
|
|
190
|
+
message: string;
|
|
191
|
+
/** Field name for the prompt */
|
|
192
|
+
fieldName: string;
|
|
193
|
+
/** Default value */
|
|
194
|
+
defaultValue?: string;
|
|
195
|
+
/** Validation function */
|
|
196
|
+
validate?: (input: string) => boolean | string;
|
|
197
|
+
/** JSON mode config */
|
|
198
|
+
jsonMode?: {
|
|
199
|
+
flags: JsonFlags & Record<string, unknown>;
|
|
200
|
+
commandName: string;
|
|
201
|
+
/** Hint for how to provide this value */
|
|
202
|
+
commandHint: string;
|
|
203
|
+
/** Example command */
|
|
204
|
+
example?: string;
|
|
205
|
+
} | null;
|
|
206
|
+
}): Promise<string>;
|
|
207
|
+
/**
|
|
208
|
+
* Unified error handler for JSON/interactive modes.
|
|
209
|
+
*
|
|
210
|
+
* Consolidates error handling to avoid message drift between JSON and interactive modes.
|
|
211
|
+
* In JSON mode: outputs structured error JSON and exits
|
|
212
|
+
* In interactive mode: calls this.error() with the message
|
|
213
|
+
*/
|
|
214
|
+
protected handleError(code: string, message: string, options: {
|
|
215
|
+
jsonMode: boolean;
|
|
216
|
+
commandName: string;
|
|
217
|
+
flags: Record<string, unknown>;
|
|
218
|
+
}): void;
|
|
219
|
+
}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RuntimeCommand - Base class for commands that need workspace.db access.
|
|
3
|
+
*
|
|
4
|
+
* Hierarchy: PromptCommand → RuntimeCommand → PMOCommand
|
|
5
|
+
*
|
|
6
|
+
* Provides:
|
|
7
|
+
* - HQ workspace resolution (this.hqPath)
|
|
8
|
+
* - workspace.db lifecycle (this.db, auto-close on cleanup)
|
|
9
|
+
* - SettingsStore for workspace_settings (this.settings)
|
|
10
|
+
* - execute()/cleanup() lifecycle pattern
|
|
11
|
+
* - Generic prompt utilities (selectFromList, promptForInput, handleError)
|
|
12
|
+
*
|
|
13
|
+
* Use this base class for commands that need workspace database access
|
|
14
|
+
* but do NOT require a ticket provider (PMO, Linear, etc.). For commands
|
|
15
|
+
* that need ticket/project operations, use PMOCommand which extends this.
|
|
16
|
+
*
|
|
17
|
+
* Commands that don't need workspace.db should extend PromptCommand directly.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { RuntimeCommand, runtimeBaseFlags } from '../../lib/runtime-command.js';
|
|
22
|
+
*
|
|
23
|
+
* export default class MyCommand extends RuntimeCommand {
|
|
24
|
+
* static flags = { ...runtimeBaseFlags };
|
|
25
|
+
*
|
|
26
|
+
* async execute(): Promise<void> {
|
|
27
|
+
* // HQ path and workspace.db are available
|
|
28
|
+
* const hqPath = this.requireHQ();
|
|
29
|
+
* const db = this.requireDB();
|
|
30
|
+
* const apiKey = this.settings?.get('linear.api_key');
|
|
31
|
+
* }
|
|
32
|
+
* }
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
import { Flags } from '@oclif/core';
|
|
36
|
+
import inquirer from 'inquirer';
|
|
37
|
+
import { PromptCommand } from './prompt-command.js';
|
|
38
|
+
import { findHQRoot } from './workspace.js';
|
|
39
|
+
import { openWorkspaceDatabase, getWorkspaceConfig } from './database/index.js';
|
|
40
|
+
import { SettingsStore } from './database/settings-store.js';
|
|
41
|
+
import { shouldOutputJson, isNonTTY, outputPromptAsJson, outputErrorAsJson, createMetadata, } from './prompt-json.js';
|
|
42
|
+
import { withSignalSafePrompt } from './signal-handler.js';
|
|
43
|
+
/**
|
|
44
|
+
* Base flags for machine-readable output mode.
|
|
45
|
+
* Include these in your command's flags by spreading: ...machineOutputFlags
|
|
46
|
+
*/
|
|
47
|
+
export const machineOutputFlags = {
|
|
48
|
+
json: Flags.boolean({
|
|
49
|
+
description: 'Output as JSON for AI agents/scripts',
|
|
50
|
+
default: false,
|
|
51
|
+
}),
|
|
52
|
+
machine: Flags.boolean({
|
|
53
|
+
char: 'm',
|
|
54
|
+
description: 'Output as JSON for AI agents/scripts',
|
|
55
|
+
default: false,
|
|
56
|
+
}),
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Base flags for RuntimeCommand subclasses.
|
|
60
|
+
* Includes machine output flags. Add command-specific flags alongside.
|
|
61
|
+
*/
|
|
62
|
+
export const runtimeBaseFlags = {
|
|
63
|
+
...machineOutputFlags,
|
|
64
|
+
};
|
|
65
|
+
export class RuntimeCommand extends PromptCommand {
|
|
66
|
+
/**
|
|
67
|
+
* Workspace database connection.
|
|
68
|
+
* Available after init() runs. May be null if no HQ found or DB failed to open.
|
|
69
|
+
*/
|
|
70
|
+
_db = null;
|
|
71
|
+
/**
|
|
72
|
+
* Settings store for workspace_settings table.
|
|
73
|
+
* Available after init() runs. May be null if no DB available.
|
|
74
|
+
*/
|
|
75
|
+
_settings = null;
|
|
76
|
+
/**
|
|
77
|
+
* HQ workspace root path.
|
|
78
|
+
* Available after init() runs. May be null if not in an HQ workspace.
|
|
79
|
+
*/
|
|
80
|
+
_hqPath = null;
|
|
81
|
+
/**
|
|
82
|
+
* Workspace configuration from workspace.db.
|
|
83
|
+
* Available after init() runs. May be null if no DB available.
|
|
84
|
+
*/
|
|
85
|
+
_workspaceConfig = null;
|
|
86
|
+
/**
|
|
87
|
+
* Flag to track if runtime context was successfully initialized
|
|
88
|
+
*/
|
|
89
|
+
_runtimeInitialized = false;
|
|
90
|
+
/**
|
|
91
|
+
* oclif init hook - runs before the command executes.
|
|
92
|
+
* Resolves HQ workspace and opens workspace.db.
|
|
93
|
+
*/
|
|
94
|
+
async init() {
|
|
95
|
+
await super.init();
|
|
96
|
+
this._hqPath = findHQRoot(process.cwd());
|
|
97
|
+
if (!this._hqPath) {
|
|
98
|
+
return; // No HQ found — subclass decides whether to error
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
this._db = openWorkspaceDatabase(this._hqPath);
|
|
102
|
+
this._settings = new SettingsStore(this._db);
|
|
103
|
+
this._workspaceConfig = getWorkspaceConfig(this._hqPath);
|
|
104
|
+
this._runtimeInitialized = true;
|
|
105
|
+
}
|
|
106
|
+
catch {
|
|
107
|
+
// Database open failed — subclass decides how to handle
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Override run() to delegate to execute() and ensure cleanup.
|
|
112
|
+
* Subclasses should implement execute() instead of run().
|
|
113
|
+
*/
|
|
114
|
+
async run() {
|
|
115
|
+
try {
|
|
116
|
+
await this.execute();
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
await this.cleanup();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Cleanup handler — ensures database connections are closed.
|
|
124
|
+
* Called automatically after execute() completes or throws.
|
|
125
|
+
* Override in subclasses to add additional cleanup (call super.cleanup()).
|
|
126
|
+
*/
|
|
127
|
+
async cleanup() {
|
|
128
|
+
if (this._runtimeInitialized && this._db) {
|
|
129
|
+
try {
|
|
130
|
+
this._db.close();
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
// Ignore close errors — database might already be closed
|
|
134
|
+
}
|
|
135
|
+
this._db = null;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* oclif catch hook — called when an error occurs.
|
|
140
|
+
* Ensures cleanup even on errors.
|
|
141
|
+
*/
|
|
142
|
+
async catch(error) {
|
|
143
|
+
await this.cleanup();
|
|
144
|
+
throw error;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* oclif finally hook — called after run() completes.
|
|
148
|
+
*/
|
|
149
|
+
async finally(_) {
|
|
150
|
+
await this.cleanup();
|
|
151
|
+
}
|
|
152
|
+
// ─── Getters ────────────────────────────────────────────────
|
|
153
|
+
/** HQ workspace root path, or null if not in an HQ workspace. */
|
|
154
|
+
get hqPath() {
|
|
155
|
+
return this._hqPath;
|
|
156
|
+
}
|
|
157
|
+
/** Workspace database connection, or null if not available. */
|
|
158
|
+
get db() {
|
|
159
|
+
return this._db;
|
|
160
|
+
}
|
|
161
|
+
/** Settings store for workspace_settings, or null if not available. */
|
|
162
|
+
get settings() {
|
|
163
|
+
return this._settings;
|
|
164
|
+
}
|
|
165
|
+
/** Workspace configuration, or null if not available. */
|
|
166
|
+
get workspaceConfig() {
|
|
167
|
+
return this._workspaceConfig;
|
|
168
|
+
}
|
|
169
|
+
/** Whether the runtime context was successfully initialized. */
|
|
170
|
+
get runtimeInitialized() {
|
|
171
|
+
return this._runtimeInitialized;
|
|
172
|
+
}
|
|
173
|
+
// ─── Require helpers (throw if missing) ─────────────────────
|
|
174
|
+
/**
|
|
175
|
+
* Require HQ workspace to be available. Throws with a helpful
|
|
176
|
+
* error message if no HQ was found.
|
|
177
|
+
*/
|
|
178
|
+
requireHQ() {
|
|
179
|
+
if (!this._hqPath) {
|
|
180
|
+
throw new Error('Not in an HQ workspace. Run "prlt new" first.');
|
|
181
|
+
}
|
|
182
|
+
return this._hqPath;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Require workspace database to be available. Throws with a helpful
|
|
186
|
+
* error message if the DB could not be opened.
|
|
187
|
+
*/
|
|
188
|
+
requireDB() {
|
|
189
|
+
if (!this._db) {
|
|
190
|
+
throw new Error('Workspace database not available. Run "prlt new" first.');
|
|
191
|
+
}
|
|
192
|
+
return this._db;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Require settings store to be available.
|
|
196
|
+
*/
|
|
197
|
+
requireSettings() {
|
|
198
|
+
if (!this._settings) {
|
|
199
|
+
throw new Error('Workspace settings not available. Run "prlt new" first.');
|
|
200
|
+
}
|
|
201
|
+
return this._settings;
|
|
202
|
+
}
|
|
203
|
+
// ─── Prompt utilities ───────────────────────────────────────
|
|
204
|
+
/**
|
|
205
|
+
* Select from a list of items with JSON mode support for AI agents.
|
|
206
|
+
*
|
|
207
|
+
* In JSON mode: outputs choices as JSON with command field and exits
|
|
208
|
+
* In interactive mode: shows prompt and returns selected value
|
|
209
|
+
*
|
|
210
|
+
* @param options Configuration for the selection
|
|
211
|
+
* @returns The selected value (only in interactive mode)
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const ticketId = await this.selectFromList({
|
|
216
|
+
* message: 'Select ticket:',
|
|
217
|
+
* items: tickets,
|
|
218
|
+
* getName: (t) => `${t.id}: ${t.title}`,
|
|
219
|
+
* getValue: (t) => t.id,
|
|
220
|
+
* getCommand: (t) => `prlt ticket view ${t.id} --json`,
|
|
221
|
+
* jsonMode: { flags, commandName: 'ticket view' },
|
|
222
|
+
* });
|
|
223
|
+
* ```
|
|
224
|
+
*/
|
|
225
|
+
async selectFromList(options) {
|
|
226
|
+
const { message, items, getName, getValue, getCommand, jsonMode, allowCancel = false, cancelValue, } = options;
|
|
227
|
+
// Auto-detect non-TTY: switch to JSON mode when no TTY present
|
|
228
|
+
const effectiveJsonMode = jsonMode ?? (isNonTTY()
|
|
229
|
+
? { flags: { json: true }, commandName: this.id ?? 'unknown' }
|
|
230
|
+
: null);
|
|
231
|
+
// Build choices with command field
|
|
232
|
+
const choices = items.map(item => ({
|
|
233
|
+
name: getName(item),
|
|
234
|
+
value: getValue(item),
|
|
235
|
+
command: getCommand(item),
|
|
236
|
+
}));
|
|
237
|
+
// Check for JSON mode
|
|
238
|
+
if (effectiveJsonMode && shouldOutputJson(effectiveJsonMode.flags)) {
|
|
239
|
+
outputPromptAsJson({
|
|
240
|
+
type: 'list',
|
|
241
|
+
name: 'selection',
|
|
242
|
+
message,
|
|
243
|
+
choices,
|
|
244
|
+
}, createMetadata(effectiveJsonMode.commandName, effectiveJsonMode.flags));
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
// Interactive mode
|
|
248
|
+
const interactiveChoices = choices.map(c => ({
|
|
249
|
+
name: c.name,
|
|
250
|
+
value: c.value,
|
|
251
|
+
}));
|
|
252
|
+
if (allowCancel) {
|
|
253
|
+
interactiveChoices.push({ name: '─'.repeat(20), value: '__separator__' }, { name: 'Cancel', value: cancelValue ?? '__cancel__' });
|
|
254
|
+
}
|
|
255
|
+
const { selection } = await withSignalSafePrompt(() => inquirer.prompt([{
|
|
256
|
+
type: 'list',
|
|
257
|
+
name: 'selection',
|
|
258
|
+
message,
|
|
259
|
+
choices: interactiveChoices,
|
|
260
|
+
}]));
|
|
261
|
+
if (selection === '__cancel__' || selection === '__separator__') {
|
|
262
|
+
return null;
|
|
263
|
+
}
|
|
264
|
+
return selection;
|
|
265
|
+
}
|
|
266
|
+
/**
|
|
267
|
+
* Prompt for input with JSON mode support for AI agents.
|
|
268
|
+
*
|
|
269
|
+
* In JSON mode: outputs field info as JSON and exits
|
|
270
|
+
* In interactive mode: shows prompt and returns input value
|
|
271
|
+
*
|
|
272
|
+
* @param options Configuration for the input
|
|
273
|
+
* @returns The input value (only in interactive mode)
|
|
274
|
+
*/
|
|
275
|
+
async promptForInput(options) {
|
|
276
|
+
const { message, fieldName, defaultValue, validate, jsonMode } = options;
|
|
277
|
+
// Auto-detect non-TTY: switch to JSON mode when no TTY present
|
|
278
|
+
const effectiveJsonMode = jsonMode ?? (isNonTTY()
|
|
279
|
+
? { flags: { json: true }, commandName: this.id ?? 'unknown', commandHint: '', example: undefined }
|
|
280
|
+
: null);
|
|
281
|
+
// Check for JSON mode
|
|
282
|
+
if (effectiveJsonMode && shouldOutputJson(effectiveJsonMode.flags)) {
|
|
283
|
+
outputPromptAsJson({
|
|
284
|
+
type: 'input',
|
|
285
|
+
name: fieldName,
|
|
286
|
+
message,
|
|
287
|
+
default: defaultValue,
|
|
288
|
+
context: {
|
|
289
|
+
hint: effectiveJsonMode.commandHint,
|
|
290
|
+
example: effectiveJsonMode.example,
|
|
291
|
+
},
|
|
292
|
+
}, createMetadata(effectiveJsonMode.commandName, effectiveJsonMode.flags));
|
|
293
|
+
return '';
|
|
294
|
+
}
|
|
295
|
+
// Interactive mode
|
|
296
|
+
const { value } = await withSignalSafePrompt(() => inquirer.prompt([{
|
|
297
|
+
type: 'input',
|
|
298
|
+
name: 'value',
|
|
299
|
+
message,
|
|
300
|
+
default: defaultValue,
|
|
301
|
+
validate,
|
|
302
|
+
}]));
|
|
303
|
+
return value;
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Unified error handler for JSON/interactive modes.
|
|
307
|
+
*
|
|
308
|
+
* Consolidates error handling to avoid message drift between JSON and interactive modes.
|
|
309
|
+
* In JSON mode: outputs structured error JSON and exits
|
|
310
|
+
* In interactive mode: calls this.error() with the message
|
|
311
|
+
*/
|
|
312
|
+
handleError(code, message, options) {
|
|
313
|
+
if (options.jsonMode) {
|
|
314
|
+
outputErrorAsJson(code, message, createMetadata(options.commandName, options.flags));
|
|
315
|
+
return;
|
|
316
|
+
}
|
|
317
|
+
this.error(message);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
//# sourceMappingURL=runtime-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-command.js","sourceRoot":"","sources":["../../src/lib/runtime-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,aAAa,EAAE,MAA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EAAE,YAAY;gBACrB,QAAQ;aACT,CAAC,CAAC,CACJ,CAAC;QAEF,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;;;;;OAMG;IACO,WAAW,CACnB,IAAY,EACZ,OAAe,EACf,OAIC;QAED,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;YACrB,iBAAiB,CAAC,IAAI,EAAE,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,WAAW,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;YACrF,OAAM;QACR,CAAC;QACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACtB,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Heartbeat
|
|
3
|
+
*
|
|
4
|
+
* Heartbeat recording and checking for agent executions.
|
|
5
|
+
* The heartbeat system has two sides:
|
|
6
|
+
*
|
|
7
|
+
* 1. Agent-side (push): Agents update their heartbeat when alive/active.
|
|
8
|
+
* This is done by checking tmux pane liveness and JSONL file activity.
|
|
9
|
+
*
|
|
10
|
+
* 2. Host-side (pull): The watcher checks heartbeat timestamps and marks
|
|
11
|
+
* stale executions as failed. This catches the case where the agent is
|
|
12
|
+
* so dead it can't self-report (OOM, zombie processes).
|
|
13
|
+
*/
|
|
14
|
+
import { ExecutionStorage } from '../execution/storage.js';
|
|
15
|
+
import type { AgentWork } from '../execution/types.js';
|
|
16
|
+
/**
|
|
17
|
+
* Record a heartbeat for an execution by checking if its tmux session is alive.
|
|
18
|
+
* Uses tmux pane inspection to determine if the agent is still active.
|
|
19
|
+
*
|
|
20
|
+
* Returns the detected health state, or null if the session couldn't be found.
|
|
21
|
+
*/
|
|
22
|
+
export declare function recordHeartbeatFromSession(storage: ExecutionStorage, execution: AgentWork): string | null;
|
|
23
|
+
/**
|
|
24
|
+
* Record heartbeats for all running executions.
|
|
25
|
+
* Returns a map of execution ID to detected state.
|
|
26
|
+
*/
|
|
27
|
+
export declare function recordAllHeartbeats(storage: ExecutionStorage): Map<string, string>;
|
|
28
|
+
/**
|
|
29
|
+
* Information about a stale execution detected by heartbeat timeout.
|
|
30
|
+
*/
|
|
31
|
+
export interface StaleExecution {
|
|
32
|
+
execution: AgentWork;
|
|
33
|
+
lastHeartbeat: Date | null;
|
|
34
|
+
staleDurationMinutes: number;
|
|
35
|
+
reason: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Check for stale executions that have exceeded the heartbeat timeout.
|
|
39
|
+
*/
|
|
40
|
+
export declare function detectStaleExecutions(storage: ExecutionStorage, timeoutMinutes: number): StaleExecution[];
|
|
41
|
+
/**
|
|
42
|
+
* Kill a Docker container by ID.
|
|
43
|
+
* Returns true if the container was killed or already stopped.
|
|
44
|
+
*/
|
|
45
|
+
export declare function killContainer(containerId: string): boolean;
|