hungry-ghost-hive 0.3.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 +111 -0
- package/README.md +352 -0
- package/dist/agents/base-agent.d.ts +63 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +189 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/index.d.ts +7 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +7 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/intermediate.d.ts +15 -0
- package/dist/agents/intermediate.d.ts.map +1 -0
- package/dist/agents/intermediate.js +142 -0
- package/dist/agents/intermediate.js.map +1 -0
- package/dist/agents/junior.d.ts +15 -0
- package/dist/agents/junior.d.ts.map +1 -0
- package/dist/agents/junior.js +147 -0
- package/dist/agents/junior.js.map +1 -0
- package/dist/agents/qa.d.ts +23 -0
- package/dist/agents/qa.d.ts.map +1 -0
- package/dist/agents/qa.js +238 -0
- package/dist/agents/qa.js.map +1 -0
- package/dist/agents/senior.d.ts +18 -0
- package/dist/agents/senior.d.ts.map +1 -0
- package/dist/agents/senior.js +267 -0
- package/dist/agents/senior.js.map +1 -0
- package/dist/agents/tech-lead.d.ts +17 -0
- package/dist/agents/tech-lead.d.ts.map +1 -0
- package/dist/agents/tech-lead.js +274 -0
- package/dist/agents/tech-lead.js.map +1 -0
- package/dist/cli/commands/add-repo.d.ts +3 -0
- package/dist/cli/commands/add-repo.d.ts.map +1 -0
- package/dist/cli/commands/add-repo.js +84 -0
- package/dist/cli/commands/add-repo.js.map +1 -0
- package/dist/cli/commands/agents.d.ts +3 -0
- package/dist/cli/commands/agents.d.ts.map +1 -0
- package/dist/cli/commands/agents.js +214 -0
- package/dist/cli/commands/agents.js.map +1 -0
- package/dist/cli/commands/assign.d.ts +3 -0
- package/dist/cli/commands/assign.d.ts.map +1 -0
- package/dist/cli/commands/assign.js +81 -0
- package/dist/cli/commands/assign.js.map +1 -0
- package/dist/cli/commands/config.d.ts +3 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +118 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/escalations.d.ts +3 -0
- package/dist/cli/commands/escalations.d.ts.map +1 -0
- package/dist/cli/commands/escalations.js +157 -0
- package/dist/cli/commands/escalations.js.map +1 -0
- package/dist/cli/commands/index.d.ts +17 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +17 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/init.d.ts +3 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +59 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/manager.d.ts +3 -0
- package/dist/cli/commands/manager.d.ts.map +1 -0
- package/dist/cli/commands/manager.js +775 -0
- package/dist/cli/commands/manager.js.map +1 -0
- package/dist/cli/commands/manager.test.d.ts +2 -0
- package/dist/cli/commands/manager.test.d.ts.map +1 -0
- package/dist/cli/commands/manager.test.js +45 -0
- package/dist/cli/commands/manager.test.js.map +1 -0
- package/dist/cli/commands/msg.d.ts +3 -0
- package/dist/cli/commands/msg.d.ts.map +1 -0
- package/dist/cli/commands/msg.js +190 -0
- package/dist/cli/commands/msg.js.map +1 -0
- package/dist/cli/commands/my-stories.d.ts +3 -0
- package/dist/cli/commands/my-stories.d.ts.map +1 -0
- package/dist/cli/commands/my-stories.js +174 -0
- package/dist/cli/commands/my-stories.js.map +1 -0
- package/dist/cli/commands/nuke.d.ts +3 -0
- package/dist/cli/commands/nuke.d.ts.map +1 -0
- package/dist/cli/commands/nuke.js +189 -0
- package/dist/cli/commands/nuke.js.map +1 -0
- package/dist/cli/commands/pr.d.ts +3 -0
- package/dist/cli/commands/pr.d.ts.map +1 -0
- package/dist/cli/commands/pr.js +488 -0
- package/dist/cli/commands/pr.js.map +1 -0
- package/dist/cli/commands/req.d.ts +3 -0
- package/dist/cli/commands/req.d.ts.map +1 -0
- package/dist/cli/commands/req.js +212 -0
- package/dist/cli/commands/req.js.map +1 -0
- package/dist/cli/commands/resume.d.ts +3 -0
- package/dist/cli/commands/resume.d.ts.map +1 -0
- package/dist/cli/commands/resume.js +114 -0
- package/dist/cli/commands/resume.js.map +1 -0
- package/dist/cli/commands/status.d.ts +3 -0
- package/dist/cli/commands/status.d.ts.map +1 -0
- package/dist/cli/commands/status.js +259 -0
- package/dist/cli/commands/status.js.map +1 -0
- package/dist/cli/commands/stories.d.ts +3 -0
- package/dist/cli/commands/stories.d.ts.map +1 -0
- package/dist/cli/commands/stories.js +111 -0
- package/dist/cli/commands/stories.js.map +1 -0
- package/dist/cli/commands/teams.d.ts +3 -0
- package/dist/cli/commands/teams.d.ts.map +1 -0
- package/dist/cli/commands/teams.js +137 -0
- package/dist/cli/commands/teams.js.map +1 -0
- package/dist/cli/dashboard/index.d.ts +5 -0
- package/dist/cli/dashboard/index.d.ts.map +1 -0
- package/dist/cli/dashboard/index.js +128 -0
- package/dist/cli/dashboard/index.js.map +1 -0
- package/dist/cli/dashboard/panels/activity.d.ts +5 -0
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/activity.js +64 -0
- package/dist/cli/dashboard/panels/activity.js.map +1 -0
- package/dist/cli/dashboard/panels/agents.d.ts +5 -0
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/agents.js +196 -0
- package/dist/cli/dashboard/panels/agents.js.map +1 -0
- package/dist/cli/dashboard/panels/escalations.d.ts +5 -0
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/escalations.js +93 -0
- package/dist/cli/dashboard/panels/escalations.js.map +1 -0
- package/dist/cli/dashboard/panels/merge-queue.d.ts +5 -0
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/merge-queue.js +57 -0
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -0
- package/dist/cli/dashboard/panels/pipeline.d.ts +5 -0
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/pipeline.js +54 -0
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -0
- package/dist/cli/dashboard/panels/stories.d.ts +5 -0
- package/dist/cli/dashboard/panels/stories.d.ts.map +1 -0
- package/dist/cli/dashboard/panels/stories.js +79 -0
- package/dist/cli/dashboard/panels/stories.js.map +1 -0
- package/dist/cli-runtimes/claude.d.ts +8 -0
- package/dist/cli-runtimes/claude.d.ts.map +1 -0
- package/dist/cli-runtimes/claude.js +27 -0
- package/dist/cli-runtimes/claude.js.map +1 -0
- package/dist/cli-runtimes/codex.d.ts +8 -0
- package/dist/cli-runtimes/codex.d.ts.map +1 -0
- package/dist/cli-runtimes/codex.js +27 -0
- package/dist/cli-runtimes/codex.js.map +1 -0
- package/dist/cli-runtimes/gemini.d.ts +8 -0
- package/dist/cli-runtimes/gemini.d.ts.map +1 -0
- package/dist/cli-runtimes/gemini.js +29 -0
- package/dist/cli-runtimes/gemini.js.map +1 -0
- package/dist/cli-runtimes/index.d.ts +25 -0
- package/dist/cli-runtimes/index.d.ts.map +1 -0
- package/dist/cli-runtimes/index.js +48 -0
- package/dist/cli-runtimes/index.js.map +1 -0
- package/dist/cli-runtimes/index.test.d.ts +2 -0
- package/dist/cli-runtimes/index.test.d.ts.map +1 -0
- package/dist/cli-runtimes/index.test.js +216 -0
- package/dist/cli-runtimes/index.test.js.map +1 -0
- package/dist/cli-runtimes/types.d.ts +27 -0
- package/dist/cli-runtimes/types.d.ts.map +1 -0
- package/dist/cli-runtimes/types.js +2 -0
- package/dist/cli-runtimes/types.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +3 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/loader.d.ts +11 -0
- package/dist/config/loader.d.ts.map +1 -0
- package/dist/config/loader.js +72 -0
- package/dist/config/loader.js.map +1 -0
- package/dist/config/schema.d.ts +660 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +217 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/config/schema.test.d.ts +2 -0
- package/dist/config/schema.test.d.ts.map +1 -0
- package/dist/config/schema.test.js +123 -0
- package/dist/config/schema.test.js.map +1 -0
- package/dist/context-files/generator.d.ts +32 -0
- package/dist/context-files/generator.d.ts.map +1 -0
- package/dist/context-files/generator.js +120 -0
- package/dist/context-files/generator.js.map +1 -0
- package/dist/context-files/index.d.ts +38 -0
- package/dist/context-files/index.d.ts.map +1 -0
- package/dist/context-files/index.js +76 -0
- package/dist/context-files/index.js.map +1 -0
- package/dist/context-files/index.test.d.ts +2 -0
- package/dist/context-files/index.test.d.ts.map +1 -0
- package/dist/context-files/index.test.js +265 -0
- package/dist/context-files/index.test.js.map +1 -0
- package/dist/context-files/templates.d.ts +19 -0
- package/dist/context-files/templates.d.ts.map +1 -0
- package/dist/context-files/templates.js +266 -0
- package/dist/context-files/templates.js.map +1 -0
- package/dist/db/client.d.ts +95 -0
- package/dist/db/client.d.ts.map +1 -0
- package/dist/db/client.js +343 -0
- package/dist/db/client.js.map +1 -0
- package/dist/db/lock.d.ts +25 -0
- package/dist/db/lock.d.ts.map +1 -0
- package/dist/db/lock.js +56 -0
- package/dist/db/lock.js.map +1 -0
- package/dist/db/lock.test.d.ts +2 -0
- package/dist/db/lock.test.d.ts.map +1 -0
- package/dist/db/lock.test.js +73 -0
- package/dist/db/lock.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +31 -0
- package/dist/db/queries/agents.d.ts.map +1 -0
- package/dist/db/queries/agents.js +76 -0
- package/dist/db/queries/agents.js.map +1 -0
- package/dist/db/queries/escalations.d.ts +29 -0
- package/dist/db/queries/escalations.d.ts.map +1 -0
- package/dist/db/queries/escalations.js +105 -0
- package/dist/db/queries/escalations.js.map +1 -0
- package/dist/db/queries/heartbeat.d.ts +20 -0
- package/dist/db/queries/heartbeat.d.ts.map +1 -0
- package/dist/db/queries/heartbeat.js +61 -0
- package/dist/db/queries/heartbeat.js.map +1 -0
- package/dist/db/queries/index.d.ts +8 -0
- package/dist/db/queries/index.d.ts.map +1 -0
- package/dist/db/queries/index.js +8 -0
- package/dist/db/queries/index.js.map +1 -0
- package/dist/db/queries/logs.d.ts +21 -0
- package/dist/db/queries/logs.d.ts.map +1 -0
- package/dist/db/queries/logs.js +72 -0
- package/dist/db/queries/logs.js.map +1 -0
- package/dist/db/queries/messages.d.ts +17 -0
- package/dist/db/queries/messages.d.ts.map +1 -0
- package/dist/db/queries/messages.js +22 -0
- package/dist/db/queries/messages.js.map +1 -0
- package/dist/db/queries/pull-requests.d.ts +33 -0
- package/dist/db/queries/pull-requests.d.ts.map +1 -0
- package/dist/db/queries/pull-requests.js +130 -0
- package/dist/db/queries/pull-requests.js.map +1 -0
- package/dist/db/queries/requirements.d.ts +22 -0
- package/dist/db/queries/requirements.d.ts.map +1 -0
- package/dist/db/queries/requirements.js +53 -0
- package/dist/db/queries/requirements.js.map +1 -0
- package/dist/db/queries/stories.d.ts +42 -0
- package/dist/db/queries/stories.d.ts.map +1 -0
- package/dist/db/queries/stories.js +163 -0
- package/dist/db/queries/stories.js.map +1 -0
- package/dist/db/queries/teams.d.ts +14 -0
- package/dist/db/queries/teams.d.ts.map +1 -0
- package/dist/db/queries/teams.js +24 -0
- package/dist/db/queries/teams.js.map +1 -0
- package/dist/git/branches.d.ts +52 -0
- package/dist/git/branches.d.ts.map +1 -0
- package/dist/git/branches.js +133 -0
- package/dist/git/branches.js.map +1 -0
- package/dist/git/github.d.ts +75 -0
- package/dist/git/github.d.ts.map +1 -0
- package/dist/git/github.js +162 -0
- package/dist/git/github.js.map +1 -0
- package/dist/git/index.d.ts +4 -0
- package/dist/git/index.d.ts.map +1 -0
- package/dist/git/index.js +4 -0
- package/dist/git/index.js.map +1 -0
- package/dist/git/submodules.d.ts +47 -0
- package/dist/git/submodules.d.ts.map +1 -0
- package/dist/git/submodules.js +115 -0
- package/dist/git/submodules.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/llm/anthropic.d.ts +18 -0
- package/dist/llm/anthropic.d.ts.map +1 -0
- package/dist/llm/anthropic.js +111 -0
- package/dist/llm/anthropic.js.map +1 -0
- package/dist/llm/index.d.ts +6 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +24 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/openai.d.ts +18 -0
- package/dist/llm/openai.d.ts.map +1 -0
- package/dist/llm/openai.js +103 -0
- package/dist/llm/openai.js.map +1 -0
- package/dist/llm/provider.d.ts +38 -0
- package/dist/llm/provider.d.ts.map +1 -0
- package/dist/llm/provider.js +17 -0
- package/dist/llm/provider.js.map +1 -0
- package/dist/orchestrator/index.d.ts +4 -0
- package/dist/orchestrator/index.d.ts.map +1 -0
- package/dist/orchestrator/index.js +4 -0
- package/dist/orchestrator/index.js.map +1 -0
- package/dist/orchestrator/scaler.d.ts +42 -0
- package/dist/orchestrator/scaler.d.ts.map +1 -0
- package/dist/orchestrator/scaler.js +154 -0
- package/dist/orchestrator/scaler.js.map +1 -0
- package/dist/orchestrator/scheduler.d.ts +90 -0
- package/dist/orchestrator/scheduler.d.ts.map +1 -0
- package/dist/orchestrator/scheduler.js +1003 -0
- package/dist/orchestrator/scheduler.js.map +1 -0
- package/dist/orchestrator/scheduler.test.d.ts +2 -0
- package/dist/orchestrator/scheduler.test.d.ts.map +1 -0
- package/dist/orchestrator/scheduler.test.js +242 -0
- package/dist/orchestrator/scheduler.test.js.map +1 -0
- package/dist/orchestrator/workflow.d.ts +18 -0
- package/dist/orchestrator/workflow.d.ts.map +1 -0
- package/dist/orchestrator/workflow.js +106 -0
- package/dist/orchestrator/workflow.js.map +1 -0
- package/dist/state-detectors/claude.d.ts +33 -0
- package/dist/state-detectors/claude.d.ts.map +1 -0
- package/dist/state-detectors/claude.js +237 -0
- package/dist/state-detectors/claude.js.map +1 -0
- package/dist/state-detectors/claude.test.d.ts +2 -0
- package/dist/state-detectors/claude.test.d.ts.map +1 -0
- package/dist/state-detectors/claude.test.js +127 -0
- package/dist/state-detectors/claude.test.js.map +1 -0
- package/dist/state-detectors/codex.d.ts +34 -0
- package/dist/state-detectors/codex.d.ts.map +1 -0
- package/dist/state-detectors/codex.js +233 -0
- package/dist/state-detectors/codex.js.map +1 -0
- package/dist/state-detectors/codex.test.d.ts +2 -0
- package/dist/state-detectors/codex.test.d.ts.map +1 -0
- package/dist/state-detectors/codex.test.js +85 -0
- package/dist/state-detectors/codex.test.js.map +1 -0
- package/dist/state-detectors/factory.d.ts +22 -0
- package/dist/state-detectors/factory.d.ts.map +1 -0
- package/dist/state-detectors/factory.js +37 -0
- package/dist/state-detectors/factory.js.map +1 -0
- package/dist/state-detectors/factory.test.d.ts +2 -0
- package/dist/state-detectors/factory.test.d.ts.map +1 -0
- package/dist/state-detectors/factory.test.js +44 -0
- package/dist/state-detectors/factory.test.js.map +1 -0
- package/dist/state-detectors/gemini.d.ts +34 -0
- package/dist/state-detectors/gemini.d.ts.map +1 -0
- package/dist/state-detectors/gemini.js +236 -0
- package/dist/state-detectors/gemini.js.map +1 -0
- package/dist/state-detectors/gemini.test.d.ts +2 -0
- package/dist/state-detectors/gemini.test.d.ts.map +1 -0
- package/dist/state-detectors/gemini.test.js +93 -0
- package/dist/state-detectors/gemini.test.js.map +1 -0
- package/dist/state-detectors/index.d.ts +20 -0
- package/dist/state-detectors/index.d.ts.map +1 -0
- package/dist/state-detectors/index.js +21 -0
- package/dist/state-detectors/index.js.map +1 -0
- package/dist/state-detectors/types.d.ts +67 -0
- package/dist/state-detectors/types.d.ts.map +1 -0
- package/dist/state-detectors/types.js +28 -0
- package/dist/state-detectors/types.js.map +1 -0
- package/dist/tmux/index.d.ts +2 -0
- package/dist/tmux/index.d.ts.map +1 -0
- package/dist/tmux/index.js +2 -0
- package/dist/tmux/index.js.map +1 -0
- package/dist/tmux/manager.d.ts +45 -0
- package/dist/tmux/manager.d.ts.map +1 -0
- package/dist/tmux/manager.js +252 -0
- package/dist/tmux/manager.js.map +1 -0
- package/dist/utils/claude-code-state.d.ts +46 -0
- package/dist/utils/claude-code-state.d.ts.map +1 -0
- package/dist/utils/claude-code-state.js +252 -0
- package/dist/utils/claude-code-state.js.map +1 -0
- package/dist/utils/cli-builder.d.ts +19 -0
- package/dist/utils/cli-builder.d.ts.map +1 -0
- package/dist/utils/cli-builder.js +58 -0
- package/dist/utils/cli-builder.js.map +1 -0
- package/dist/utils/cli-commands.d.ts +27 -0
- package/dist/utils/cli-commands.d.ts.map +1 -0
- package/dist/utils/cli-commands.js +69 -0
- package/dist/utils/cli-commands.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +77 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/paths.d.ts +17 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.js +33 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/utils/timeout.d.ts +25 -0
- package/dist/utils/timeout.d.ts.map +1 -0
- package/dist/utils/timeout.js +57 -0
- package/dist/utils/timeout.js.map +1 -0
- package/package.json +78 -0
- package/src/agents/base-agent.ts +255 -0
- package/src/agents/index.ts +6 -0
- package/src/agents/intermediate.ts +161 -0
- package/src/agents/junior.ts +166 -0
- package/src/agents/qa.ts +272 -0
- package/src/agents/senior.ts +307 -0
- package/src/agents/tech-lead.ts +324 -0
- package/src/cli/commands/add-repo.ts +89 -0
- package/src/cli/commands/agents.ts +247 -0
- package/src/cli/commands/assign.ts +86 -0
- package/src/cli/commands/config.ts +121 -0
- package/src/cli/commands/escalations.ts +179 -0
- package/src/cli/commands/index.ts +16 -0
- package/src/cli/commands/init.ts +66 -0
- package/src/cli/commands/manager.test.ts +52 -0
- package/src/cli/commands/manager.ts +916 -0
- package/src/cli/commands/msg.ts +232 -0
- package/src/cli/commands/my-stories.ts +198 -0
- package/src/cli/commands/nuke.ts +223 -0
- package/src/cli/commands/pr.ts +559 -0
- package/src/cli/commands/req.ts +231 -0
- package/src/cli/commands/resume.ts +129 -0
- package/src/cli/commands/status.ts +284 -0
- package/src/cli/commands/stories.ts +131 -0
- package/src/cli/commands/teams.ts +158 -0
- package/src/cli/dashboard/index.ts +141 -0
- package/src/cli/dashboard/panels/activity.ts +77 -0
- package/src/cli/dashboard/panels/agents.ts +244 -0
- package/src/cli/dashboard/panels/escalations.ts +109 -0
- package/src/cli/dashboard/panels/merge-queue.ts +65 -0
- package/src/cli/dashboard/panels/pipeline.ts +65 -0
- package/src/cli/dashboard/panels/stories.ts +87 -0
- package/src/cli-runtimes/claude.ts +31 -0
- package/src/cli-runtimes/codex.ts +31 -0
- package/src/cli-runtimes/gemini.ts +33 -0
- package/src/cli-runtimes/index.test.ts +261 -0
- package/src/cli-runtimes/index.ts +52 -0
- package/src/cli-runtimes/types.ts +30 -0
- package/src/config/index.ts +2 -0
- package/src/config/loader.ts +89 -0
- package/src/config/schema.test.ts +135 -0
- package/src/config/schema.ts +238 -0
- package/src/context-files/generator.ts +132 -0
- package/src/context-files/index.test.ts +323 -0
- package/src/context-files/index.ts +102 -0
- package/src/context-files/templates.ts +279 -0
- package/src/db/client.ts +475 -0
- package/src/db/lock.test.ts +93 -0
- package/src/db/lock.ts +74 -0
- package/src/db/migrations/001-initial.sql +121 -0
- package/src/db/migrations/005-add-agent-heartbeat.sql +4 -0
- package/src/db/queries/agents.ts +113 -0
- package/src/db/queries/escalations.ts +140 -0
- package/src/db/queries/heartbeat.ts +92 -0
- package/src/db/queries/index.ts +7 -0
- package/src/db/queries/logs.ts +136 -0
- package/src/db/queries/messages.ts +38 -0
- package/src/db/queries/pull-requests.ts +170 -0
- package/src/db/queries/requirements.ts +81 -0
- package/src/db/queries/stories.ts +223 -0
- package/src/db/queries/teams.ts +39 -0
- package/src/git/branches.ts +186 -0
- package/src/git/github.ts +247 -0
- package/src/git/index.ts +3 -0
- package/src/git/submodules.ts +141 -0
- package/src/index.ts +93 -0
- package/src/llm/anthropic.ts +134 -0
- package/src/llm/index.ts +26 -0
- package/src/llm/openai.ts +125 -0
- package/src/llm/provider.ts +60 -0
- package/src/orchestrator/index.ts +3 -0
- package/src/orchestrator/scaler.ts +201 -0
- package/src/orchestrator/scheduler.test.ts +288 -0
- package/src/orchestrator/scheduler.ts +1130 -0
- package/src/orchestrator/workflow.ts +137 -0
- package/src/state-detectors/claude.test.ts +149 -0
- package/src/state-detectors/claude.ts +256 -0
- package/src/state-detectors/codex.test.ts +100 -0
- package/src/state-detectors/codex.ts +252 -0
- package/src/state-detectors/factory.test.ts +51 -0
- package/src/state-detectors/factory.ts +40 -0
- package/src/state-detectors/gemini.test.ts +110 -0
- package/src/state-detectors/gemini.ts +255 -0
- package/src/state-detectors/index.ts +25 -0
- package/src/state-detectors/types.ts +80 -0
- package/src/tmux/index.ts +1 -0
- package/src/tmux/manager.ts +310 -0
- package/src/types/sql.js.d.ts +34 -0
- package/src/utils/claude-code-state.ts +281 -0
- package/src/utils/cli-builder.ts +78 -0
- package/src/utils/cli-commands.ts +84 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/logger.ts +93 -0
- package/src/utils/paths.ts +49 -0
- package/src/utils/timeout.ts +84 -0
- package/tsconfig.json +25 -0
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { nanoid } from 'nanoid';
|
|
4
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
5
|
+
import { getDatabase, queryAll, queryOne, run } from '../../db/client.js';
|
|
6
|
+
|
|
7
|
+
interface MessageRow {
|
|
8
|
+
id: string;
|
|
9
|
+
from_session: string;
|
|
10
|
+
to_session: string;
|
|
11
|
+
subject: string | null;
|
|
12
|
+
body: string;
|
|
13
|
+
reply: string | null;
|
|
14
|
+
status: 'pending' | 'read' | 'replied';
|
|
15
|
+
created_at: string;
|
|
16
|
+
replied_at: string | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export const msgCommand = new Command('msg')
|
|
20
|
+
.description('Inter-agent messaging');
|
|
21
|
+
|
|
22
|
+
msgCommand
|
|
23
|
+
.command('send <to-session> <message>')
|
|
24
|
+
.description('Send a message to another agent')
|
|
25
|
+
.option('-s, --subject <subject>', 'Message subject')
|
|
26
|
+
.option('-f, --from <session>', 'Your session name (defaults to hive-tech-lead)')
|
|
27
|
+
.action(async (toSession: string, message: string, options: { subject?: string; from?: string }) => {
|
|
28
|
+
const root = findHiveRoot();
|
|
29
|
+
if (!root) {
|
|
30
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const paths = getHivePaths(root);
|
|
35
|
+
const db = await getDatabase(paths.hiveDir);
|
|
36
|
+
|
|
37
|
+
try {
|
|
38
|
+
const id = `msg-${nanoid(8)}`;
|
|
39
|
+
const fromSession = options.from || 'hive-tech-lead';
|
|
40
|
+
|
|
41
|
+
run(db.db, `
|
|
42
|
+
INSERT INTO messages (id, from_session, to_session, subject, body, status, created_at)
|
|
43
|
+
VALUES (?, ?, ?, ?, ?, 'pending', datetime('now'))
|
|
44
|
+
`, [id, fromSession, toSession, options.subject || null, message]);
|
|
45
|
+
db.save();
|
|
46
|
+
|
|
47
|
+
console.log(chalk.green(`Message sent: ${id}`));
|
|
48
|
+
console.log(chalk.gray(`To: ${toSession}`));
|
|
49
|
+
console.log(chalk.gray(`Subject: ${options.subject || '(none)'}`));
|
|
50
|
+
} finally {
|
|
51
|
+
db.close();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
msgCommand
|
|
56
|
+
.command('inbox [session]')
|
|
57
|
+
.description('Check inbox for messages')
|
|
58
|
+
.option('--all', 'Show all messages including read')
|
|
59
|
+
.action(async (session: string | undefined, options: { all?: boolean }) => {
|
|
60
|
+
const root = findHiveRoot();
|
|
61
|
+
if (!root) {
|
|
62
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const paths = getHivePaths(root);
|
|
67
|
+
const db = await getDatabase(paths.hiveDir);
|
|
68
|
+
|
|
69
|
+
try {
|
|
70
|
+
const targetSession = session || 'hive-tech-lead';
|
|
71
|
+
|
|
72
|
+
let query = `
|
|
73
|
+
SELECT * FROM messages
|
|
74
|
+
WHERE to_session = ?
|
|
75
|
+
`;
|
|
76
|
+
if (!options.all) {
|
|
77
|
+
query += ` AND status = 'pending'`;
|
|
78
|
+
}
|
|
79
|
+
query += ` ORDER BY created_at DESC`;
|
|
80
|
+
|
|
81
|
+
const messages = queryAll<MessageRow>(db.db, query, [targetSession]);
|
|
82
|
+
|
|
83
|
+
if (messages.length === 0) {
|
|
84
|
+
console.log(chalk.gray(`No ${options.all ? '' : 'pending '}messages for ${targetSession}`));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
console.log(chalk.bold(`\nInbox for ${targetSession} (${messages.length} messages):\n`));
|
|
89
|
+
|
|
90
|
+
for (const msg of messages) {
|
|
91
|
+
const statusIcon = msg.status === 'pending' ? chalk.yellow('●') :
|
|
92
|
+
msg.status === 'replied' ? chalk.green('✓') : chalk.gray('○');
|
|
93
|
+
const time = msg.created_at.substring(0, 16).replace('T', ' ');
|
|
94
|
+
|
|
95
|
+
console.log(`${statusIcon} ${chalk.cyan(msg.id)} from ${chalk.bold(msg.from_session)}`);
|
|
96
|
+
console.log(` ${chalk.gray(time)} ${msg.subject || ''}`);
|
|
97
|
+
console.log(` ${msg.body.substring(0, 80)}${msg.body.length > 80 ? '...' : ''}`);
|
|
98
|
+
if (msg.reply) {
|
|
99
|
+
console.log(chalk.green(` Reply: ${msg.reply.substring(0, 60)}${msg.reply.length > 60 ? '...' : ''}`));
|
|
100
|
+
}
|
|
101
|
+
console.log();
|
|
102
|
+
}
|
|
103
|
+
} finally {
|
|
104
|
+
db.close();
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
msgCommand
|
|
109
|
+
.command('read <msg-id>')
|
|
110
|
+
.description('Read a specific message')
|
|
111
|
+
.action(async (msgId: string) => {
|
|
112
|
+
const root = findHiveRoot();
|
|
113
|
+
if (!root) {
|
|
114
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
const paths = getHivePaths(root);
|
|
119
|
+
const db = await getDatabase(paths.hiveDir);
|
|
120
|
+
|
|
121
|
+
try {
|
|
122
|
+
const msg = queryOne<MessageRow>(db.db, 'SELECT * FROM messages WHERE id = ?', [msgId]);
|
|
123
|
+
|
|
124
|
+
if (!msg) {
|
|
125
|
+
console.error(chalk.red(`Message not found: ${msgId}`));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Mark as read
|
|
130
|
+
if (msg.status === 'pending') {
|
|
131
|
+
run(db.db, `UPDATE messages SET status = 'read' WHERE id = ?`, [msgId]);
|
|
132
|
+
db.save();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
console.log(chalk.bold(`\nMessage: ${msg.id}\n`));
|
|
136
|
+
console.log(`From: ${chalk.cyan(msg.from_session)}`);
|
|
137
|
+
console.log(`To: ${msg.to_session}`);
|
|
138
|
+
console.log(`Subject: ${msg.subject || '(none)'}`);
|
|
139
|
+
console.log(`Time: ${msg.created_at}`);
|
|
140
|
+
console.log(`Status: ${msg.status}`);
|
|
141
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
142
|
+
console.log(msg.body);
|
|
143
|
+
|
|
144
|
+
if (msg.reply) {
|
|
145
|
+
console.log(chalk.gray('─'.repeat(50)));
|
|
146
|
+
console.log(chalk.green('Reply:'));
|
|
147
|
+
console.log(msg.reply);
|
|
148
|
+
}
|
|
149
|
+
console.log();
|
|
150
|
+
} finally {
|
|
151
|
+
db.close();
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
msgCommand
|
|
156
|
+
.command('reply <msg-id> <response>')
|
|
157
|
+
.description('Reply to a message')
|
|
158
|
+
.action(async (msgId: string, response: string) => {
|
|
159
|
+
const root = findHiveRoot();
|
|
160
|
+
if (!root) {
|
|
161
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
162
|
+
process.exit(1);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const paths = getHivePaths(root);
|
|
166
|
+
const db = await getDatabase(paths.hiveDir);
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const msg = queryOne<MessageRow>(db.db, 'SELECT * FROM messages WHERE id = ?', [msgId]);
|
|
170
|
+
|
|
171
|
+
if (!msg) {
|
|
172
|
+
console.error(chalk.red(`Message not found: ${msgId}`));
|
|
173
|
+
process.exit(1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
run(db.db, `
|
|
177
|
+
UPDATE messages
|
|
178
|
+
SET reply = ?, status = 'replied', replied_at = datetime('now')
|
|
179
|
+
WHERE id = ?
|
|
180
|
+
`, [response, msgId]);
|
|
181
|
+
db.save();
|
|
182
|
+
|
|
183
|
+
console.log(chalk.green(`Reply sent to ${msg.from_session}`));
|
|
184
|
+
} finally {
|
|
185
|
+
db.close();
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
msgCommand
|
|
190
|
+
.command('outbox [session]')
|
|
191
|
+
.description('Check sent messages and their replies')
|
|
192
|
+
.action(async (session: string | undefined) => {
|
|
193
|
+
const root = findHiveRoot();
|
|
194
|
+
if (!root) {
|
|
195
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
196
|
+
process.exit(1);
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const paths = getHivePaths(root);
|
|
200
|
+
const db = await getDatabase(paths.hiveDir);
|
|
201
|
+
|
|
202
|
+
try {
|
|
203
|
+
const fromSession = session || 'hive-tech-lead';
|
|
204
|
+
|
|
205
|
+
const messages = queryAll<MessageRow>(db.db, `
|
|
206
|
+
SELECT * FROM messages
|
|
207
|
+
WHERE from_session = ?
|
|
208
|
+
ORDER BY created_at DESC
|
|
209
|
+
`, [fromSession]);
|
|
210
|
+
|
|
211
|
+
if (messages.length === 0) {
|
|
212
|
+
console.log(chalk.gray(`No sent messages from ${fromSession}`));
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
console.log(chalk.bold(`\nSent messages from ${fromSession} (${messages.length}):\n`));
|
|
217
|
+
|
|
218
|
+
for (const msg of messages) {
|
|
219
|
+
const statusIcon = msg.status === 'replied' ? chalk.green('✓ REPLIED') :
|
|
220
|
+
msg.status === 'read' ? chalk.yellow('○ READ') : chalk.gray('● PENDING');
|
|
221
|
+
|
|
222
|
+
console.log(`${chalk.cyan(msg.id)} → ${chalk.bold(msg.to_session)} ${statusIcon}`);
|
|
223
|
+
console.log(` ${msg.body.substring(0, 60)}${msg.body.length > 60 ? '...' : ''}`);
|
|
224
|
+
if (msg.reply) {
|
|
225
|
+
console.log(chalk.green(` ↳ ${msg.reply.substring(0, 60)}${msg.reply.length > 60 ? '...' : ''}`));
|
|
226
|
+
}
|
|
227
|
+
console.log();
|
|
228
|
+
}
|
|
229
|
+
} finally {
|
|
230
|
+
db.close();
|
|
231
|
+
}
|
|
232
|
+
});
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
4
|
+
import { getDatabase, queryAll, queryOne, run, type StoryRow } from '../../db/client.js';
|
|
5
|
+
|
|
6
|
+
export const myStoriesCommand = new Command('my-stories')
|
|
7
|
+
.description('View and manage stories assigned to an agent')
|
|
8
|
+
.argument('[session]', 'Tmux session name (e.g., hive-senior-myteam)')
|
|
9
|
+
.option('--all', 'Show all stories for the team, not just assigned')
|
|
10
|
+
.action(async (session: string | undefined, options: { all?: boolean }) => {
|
|
11
|
+
const root = findHiveRoot();
|
|
12
|
+
if (!root) {
|
|
13
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
14
|
+
process.exit(1);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const paths = getHivePaths(root);
|
|
18
|
+
const db = await getDatabase(paths.hiveDir);
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
if (!session) {
|
|
22
|
+
// Show all in-progress stories
|
|
23
|
+
const stories = queryAll<StoryRow & { tmux_session?: string }>(db.db, `
|
|
24
|
+
SELECT s.*, a.tmux_session
|
|
25
|
+
FROM stories s
|
|
26
|
+
LEFT JOIN agents a ON s.assigned_agent_id = a.id
|
|
27
|
+
WHERE s.status IN ('planned', 'in_progress', 'review', 'qa', 'qa_failed')
|
|
28
|
+
ORDER BY s.status, s.created_at
|
|
29
|
+
`);
|
|
30
|
+
|
|
31
|
+
if (stories.length === 0) {
|
|
32
|
+
console.log(chalk.gray('No active stories found.'));
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
console.log(chalk.bold('\nActive Stories:\n'));
|
|
37
|
+
for (const story of stories) {
|
|
38
|
+
printStory(story, story.tmux_session);
|
|
39
|
+
}
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Find agent by tmux session
|
|
44
|
+
const agent = queryOne<{ id: string; team_id: string }>(db.db,
|
|
45
|
+
'SELECT id, team_id FROM agents WHERE tmux_session = ?', [session]);
|
|
46
|
+
|
|
47
|
+
if (!agent) {
|
|
48
|
+
console.error(chalk.red(`No agent found with session: ${session}`));
|
|
49
|
+
console.log(chalk.gray('Available sessions:'));
|
|
50
|
+
const agents = queryAll<{ tmux_session: string }>(db.db,
|
|
51
|
+
'SELECT tmux_session FROM agents WHERE tmux_session IS NOT NULL');
|
|
52
|
+
for (const a of agents) {
|
|
53
|
+
console.log(chalk.gray(` - ${a.tmux_session}`));
|
|
54
|
+
}
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
let stories: StoryRow[];
|
|
59
|
+
if (options.all && agent.team_id) {
|
|
60
|
+
// Show all team stories
|
|
61
|
+
stories = queryAll<StoryRow>(db.db, `
|
|
62
|
+
SELECT * FROM stories
|
|
63
|
+
WHERE team_id = ?
|
|
64
|
+
ORDER BY
|
|
65
|
+
CASE status
|
|
66
|
+
WHEN 'in_progress' THEN 1
|
|
67
|
+
WHEN 'planned' THEN 2
|
|
68
|
+
WHEN 'review' THEN 3
|
|
69
|
+
WHEN 'qa' THEN 4
|
|
70
|
+
ELSE 5
|
|
71
|
+
END,
|
|
72
|
+
complexity_score DESC
|
|
73
|
+
`, [agent.team_id]);
|
|
74
|
+
} else {
|
|
75
|
+
// Show only assigned active stories (exclude merged/terminal states)
|
|
76
|
+
stories = queryAll<StoryRow>(db.db, `
|
|
77
|
+
SELECT * FROM stories
|
|
78
|
+
WHERE assigned_agent_id = ?
|
|
79
|
+
AND status IN ('planned', 'in_progress', 'review', 'qa', 'qa_failed', 'pr_submitted')
|
|
80
|
+
ORDER BY created_at
|
|
81
|
+
`, [agent.id]);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (stories.length === 0) {
|
|
85
|
+
console.log(chalk.yellow(`No stories ${options.all ? 'for your team' : 'assigned to you'}.`));
|
|
86
|
+
if (!options.all) {
|
|
87
|
+
console.log(chalk.gray('Use --all to see all team stories.'));
|
|
88
|
+
}
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
console.log(chalk.bold(`\nStories for ${session}${options.all ? ' (all team)' : ''}:\n`));
|
|
93
|
+
|
|
94
|
+
for (const story of stories) {
|
|
95
|
+
printStory(story);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
} finally {
|
|
99
|
+
db.close();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
myStoriesCommand
|
|
104
|
+
.command('claim <story-id>')
|
|
105
|
+
.description('Claim a story to work on')
|
|
106
|
+
.requiredOption('-s, --session <session>', 'Your tmux session name')
|
|
107
|
+
.action(async (storyId: string, options: { session: string }) => {
|
|
108
|
+
const root = findHiveRoot();
|
|
109
|
+
if (!root) {
|
|
110
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
111
|
+
process.exit(1);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
const paths = getHivePaths(root);
|
|
115
|
+
const db = await getDatabase(paths.hiveDir);
|
|
116
|
+
|
|
117
|
+
try {
|
|
118
|
+
// Find agent by session
|
|
119
|
+
const agent = queryOne<{ id: string }>(db.db,
|
|
120
|
+
'SELECT id FROM agents WHERE tmux_session = ?', [options.session]);
|
|
121
|
+
|
|
122
|
+
if (!agent) {
|
|
123
|
+
console.error(chalk.red(`No agent found with session: ${options.session}`));
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Check story exists and is available
|
|
128
|
+
const story = queryOne<StoryRow>(db.db, 'SELECT * FROM stories WHERE id = ?', [storyId]);
|
|
129
|
+
if (!story) {
|
|
130
|
+
console.error(chalk.red(`Story not found: ${storyId}`));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
if (story.assigned_agent_id && story.assigned_agent_id !== agent.id) {
|
|
135
|
+
console.error(chalk.red(`Story already assigned to another agent.`));
|
|
136
|
+
process.exit(1);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// Claim the story
|
|
140
|
+
run(db.db, `
|
|
141
|
+
UPDATE stories
|
|
142
|
+
SET assigned_agent_id = ?, status = 'in_progress', updated_at = datetime('now')
|
|
143
|
+
WHERE id = ?
|
|
144
|
+
`, [agent.id, storyId]);
|
|
145
|
+
db.save();
|
|
146
|
+
|
|
147
|
+
console.log(chalk.green(`Claimed story: ${storyId}`));
|
|
148
|
+
console.log(chalk.gray(`Title: ${story.title}`));
|
|
149
|
+
} finally {
|
|
150
|
+
db.close();
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
myStoriesCommand
|
|
155
|
+
.command('complete <story-id>')
|
|
156
|
+
.description('Mark a story as complete (ready for review)')
|
|
157
|
+
.action(async (storyId: string) => {
|
|
158
|
+
const root = findHiveRoot();
|
|
159
|
+
if (!root) {
|
|
160
|
+
console.error(chalk.red('Not in a Hive workspace.'));
|
|
161
|
+
process.exit(1);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const paths = getHivePaths(root);
|
|
165
|
+
const db = await getDatabase(paths.hiveDir);
|
|
166
|
+
|
|
167
|
+
try {
|
|
168
|
+
const story = queryOne<StoryRow>(db.db, 'SELECT * FROM stories WHERE id = ?', [storyId]);
|
|
169
|
+
if (!story) {
|
|
170
|
+
console.error(chalk.red(`Story not found: ${storyId}`));
|
|
171
|
+
process.exit(1);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
run(db.db, `
|
|
175
|
+
UPDATE stories
|
|
176
|
+
SET status = 'review', updated_at = datetime('now')
|
|
177
|
+
WHERE id = ?
|
|
178
|
+
`, [storyId]);
|
|
179
|
+
db.save();
|
|
180
|
+
|
|
181
|
+
console.log(chalk.green(`Story ${storyId} marked as ready for review.`));
|
|
182
|
+
} finally {
|
|
183
|
+
db.close();
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
function printStory(story: StoryRow, assignedSession?: string): void {
|
|
188
|
+
console.log(chalk.cyan(`[${story.id}]`) + ` ${story.title}`);
|
|
189
|
+
console.log(` Status: ${story.status.toUpperCase()} | Complexity: ${story.complexity_score || '?'}`);
|
|
190
|
+
if (assignedSession) {
|
|
191
|
+
console.log(` Assigned: ${assignedSession}`);
|
|
192
|
+
}
|
|
193
|
+
if (story.description) {
|
|
194
|
+
const desc = story.description.substring(0, 100);
|
|
195
|
+
console.log(chalk.gray(` ${desc}${story.description.length > 100 ? '...' : ''}`));
|
|
196
|
+
}
|
|
197
|
+
console.log();
|
|
198
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import readline from 'readline';
|
|
4
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
5
|
+
import { getDatabase } from '../../db/client.js';
|
|
6
|
+
import { queryOne, run } from '../../db/client.js';
|
|
7
|
+
import { killAllHiveSessions } from '../../tmux/manager.js';
|
|
8
|
+
|
|
9
|
+
async function confirm(message: string): Promise<boolean> {
|
|
10
|
+
const rl = readline.createInterface({
|
|
11
|
+
input: process.stdin,
|
|
12
|
+
output: process.stdout,
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
return new Promise((resolve) => {
|
|
16
|
+
rl.question(`${message} (yes/no): `, (answer) => {
|
|
17
|
+
rl.close();
|
|
18
|
+
resolve(answer.toLowerCase() === 'yes' || answer.toLowerCase() === 'y');
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const nukeCommand = new Command('nuke')
|
|
24
|
+
.description('Delete data (use with caution)')
|
|
25
|
+
.addCommand(
|
|
26
|
+
new Command('stories')
|
|
27
|
+
.description('Delete all stories')
|
|
28
|
+
.option('--force', 'Skip confirmation')
|
|
29
|
+
.action(async (options: { force?: boolean }) => {
|
|
30
|
+
const root = findHiveRoot();
|
|
31
|
+
if (!root) {
|
|
32
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
33
|
+
process.exit(1);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const paths = getHivePaths(root);
|
|
37
|
+
const db = await getDatabase(paths.hiveDir);
|
|
38
|
+
|
|
39
|
+
try {
|
|
40
|
+
// Count stories
|
|
41
|
+
const count = queryOne<{ count: number }>(db.db, 'SELECT COUNT(*) as count FROM stories');
|
|
42
|
+
const storyCount = count?.count || 0;
|
|
43
|
+
|
|
44
|
+
if (storyCount === 0) {
|
|
45
|
+
console.log(chalk.yellow('No stories to delete.'));
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
console.log(chalk.yellow(`\nThis will delete ${storyCount} stories and their dependencies.`));
|
|
50
|
+
console.log(chalk.red('This action cannot be undone.\n'));
|
|
51
|
+
|
|
52
|
+
if (!options.force) {
|
|
53
|
+
const confirmed = await confirm(chalk.bold('Are you sure you want to delete all stories?'));
|
|
54
|
+
if (!confirmed) {
|
|
55
|
+
console.log(chalk.gray('Aborted.'));
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Delete in order to respect foreign keys
|
|
61
|
+
run(db.db, 'DELETE FROM pull_requests');
|
|
62
|
+
run(db.db, 'UPDATE escalations SET story_id = NULL');
|
|
63
|
+
run(db.db, 'DELETE FROM story_dependencies');
|
|
64
|
+
run(db.db, 'DELETE FROM stories');
|
|
65
|
+
db.save();
|
|
66
|
+
|
|
67
|
+
console.log(chalk.green(`\nDeleted ${storyCount} stories.`));
|
|
68
|
+
} finally {
|
|
69
|
+
db.close();
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
)
|
|
73
|
+
.addCommand(
|
|
74
|
+
new Command('agents')
|
|
75
|
+
.description('Kill all agent tmux sessions and delete from database')
|
|
76
|
+
.option('--force', 'Skip confirmation')
|
|
77
|
+
.action(async (options: { force?: boolean }) => {
|
|
78
|
+
const root = findHiveRoot();
|
|
79
|
+
if (!root) {
|
|
80
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
81
|
+
process.exit(1);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const paths = getHivePaths(root);
|
|
85
|
+
const db = await getDatabase(paths.hiveDir);
|
|
86
|
+
|
|
87
|
+
try {
|
|
88
|
+
const count = queryOne<{ count: number }>(db.db, 'SELECT COUNT(*) as count FROM agents');
|
|
89
|
+
const agentCount = count?.count || 0;
|
|
90
|
+
|
|
91
|
+
console.log(chalk.yellow(`\nThis will kill all hive tmux sessions and delete ${agentCount} agents.`));
|
|
92
|
+
console.log(chalk.red('This action cannot be undone.\n'));
|
|
93
|
+
|
|
94
|
+
if (!options.force) {
|
|
95
|
+
const confirmed = await confirm(chalk.bold('Are you sure you want to kill all agents?'));
|
|
96
|
+
if (!confirmed) {
|
|
97
|
+
console.log(chalk.gray('Aborted.'));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Kill all hive tmux sessions
|
|
103
|
+
const killed = await killAllHiveSessions();
|
|
104
|
+
console.log(chalk.gray(`Killed ${killed} tmux sessions.`));
|
|
105
|
+
|
|
106
|
+
// Clear agent references from stories first
|
|
107
|
+
run(db.db, 'UPDATE stories SET assigned_agent_id = NULL');
|
|
108
|
+
// Delete from database
|
|
109
|
+
run(db.db, 'DELETE FROM agent_logs');
|
|
110
|
+
run(db.db, 'DELETE FROM escalations');
|
|
111
|
+
run(db.db, 'DELETE FROM agents');
|
|
112
|
+
db.save();
|
|
113
|
+
|
|
114
|
+
console.log(chalk.green(`\nDeleted ${agentCount} agents.`));
|
|
115
|
+
} finally {
|
|
116
|
+
db.close();
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
)
|
|
120
|
+
.addCommand(
|
|
121
|
+
new Command('requirements')
|
|
122
|
+
.description('Delete all requirements')
|
|
123
|
+
.option('--force', 'Skip confirmation')
|
|
124
|
+
.action(async (options: { force?: boolean }) => {
|
|
125
|
+
const root = findHiveRoot();
|
|
126
|
+
if (!root) {
|
|
127
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
128
|
+
process.exit(1);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const paths = getHivePaths(root);
|
|
132
|
+
const db = await getDatabase(paths.hiveDir);
|
|
133
|
+
|
|
134
|
+
try {
|
|
135
|
+
const count = queryOne<{ count: number }>(db.db, 'SELECT COUNT(*) as count FROM requirements');
|
|
136
|
+
const reqCount = count?.count || 0;
|
|
137
|
+
|
|
138
|
+
if (reqCount === 0) {
|
|
139
|
+
console.log(chalk.yellow('No requirements to delete.'));
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const storyCount = queryOne<{ count: number }>(db.db, 'SELECT COUNT(*) as count FROM stories')?.count || 0;
|
|
144
|
+
|
|
145
|
+
console.log(chalk.yellow(`\nThis will delete ${reqCount} requirements and ${storyCount} related stories.`));
|
|
146
|
+
console.log(chalk.red('This action cannot be undone.\n'));
|
|
147
|
+
|
|
148
|
+
if (!options.force) {
|
|
149
|
+
const confirmed = await confirm(chalk.bold('Are you sure you want to delete all requirements?'));
|
|
150
|
+
if (!confirmed) {
|
|
151
|
+
console.log(chalk.gray('Aborted.'));
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Delete stories first (they reference requirements)
|
|
157
|
+
run(db.db, 'DELETE FROM pull_requests');
|
|
158
|
+
run(db.db, 'UPDATE escalations SET story_id = NULL');
|
|
159
|
+
run(db.db, 'DELETE FROM story_dependencies');
|
|
160
|
+
run(db.db, 'DELETE FROM stories');
|
|
161
|
+
run(db.db, 'DELETE FROM requirements');
|
|
162
|
+
db.save();
|
|
163
|
+
|
|
164
|
+
console.log(chalk.green(`\nDeleted ${reqCount} requirements and ${storyCount} stories.`));
|
|
165
|
+
} finally {
|
|
166
|
+
db.close();
|
|
167
|
+
}
|
|
168
|
+
})
|
|
169
|
+
)
|
|
170
|
+
.addCommand(
|
|
171
|
+
new Command('all')
|
|
172
|
+
.description('Kill all agents and delete all data')
|
|
173
|
+
.option('--force', 'Skip confirmation')
|
|
174
|
+
.action(async (options: { force?: boolean }) => {
|
|
175
|
+
const root = findHiveRoot();
|
|
176
|
+
if (!root) {
|
|
177
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
178
|
+
process.exit(1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
const paths = getHivePaths(root);
|
|
182
|
+
const db = await getDatabase(paths.hiveDir);
|
|
183
|
+
|
|
184
|
+
try {
|
|
185
|
+
console.log(chalk.red('\nThis will:'));
|
|
186
|
+
console.log(chalk.yellow(' - Kill all hive tmux sessions'));
|
|
187
|
+
console.log(chalk.yellow(' - Delete all stories and dependencies'));
|
|
188
|
+
console.log(chalk.yellow(' - Delete all agents and logs'));
|
|
189
|
+
console.log(chalk.yellow(' - Delete all requirements'));
|
|
190
|
+
console.log(chalk.yellow(' - Delete all escalations'));
|
|
191
|
+
console.log(chalk.yellow(' - Delete all pull requests'));
|
|
192
|
+
console.log(chalk.red('\nThis action cannot be undone.\n'));
|
|
193
|
+
|
|
194
|
+
if (!options.force) {
|
|
195
|
+
const confirmed = await confirm(chalk.bold('Are you sure you want to nuke EVERYTHING?'));
|
|
196
|
+
if (!confirmed) {
|
|
197
|
+
console.log(chalk.gray('Aborted.'));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Kill all hive tmux sessions first
|
|
203
|
+
const killed = await killAllHiveSessions();
|
|
204
|
+
console.log(chalk.gray(`Killed ${killed} tmux sessions.`));
|
|
205
|
+
|
|
206
|
+
// Clear foreign key references first
|
|
207
|
+
run(db.db, 'UPDATE stories SET assigned_agent_id = NULL');
|
|
208
|
+
// Delete in order to respect foreign keys
|
|
209
|
+
run(db.db, 'DELETE FROM pull_requests');
|
|
210
|
+
run(db.db, 'DELETE FROM escalations');
|
|
211
|
+
run(db.db, 'DELETE FROM agent_logs');
|
|
212
|
+
run(db.db, 'DELETE FROM story_dependencies');
|
|
213
|
+
run(db.db, 'DELETE FROM stories');
|
|
214
|
+
run(db.db, 'DELETE FROM agents');
|
|
215
|
+
run(db.db, 'DELETE FROM requirements');
|
|
216
|
+
db.save();
|
|
217
|
+
|
|
218
|
+
console.log(chalk.green('\nAll data deleted.'));
|
|
219
|
+
} finally {
|
|
220
|
+
db.close();
|
|
221
|
+
}
|
|
222
|
+
})
|
|
223
|
+
);
|