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,89 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { execa } from 'execa';
|
|
5
|
+
import { join } from 'path';
|
|
6
|
+
import { existsSync } from 'fs';
|
|
7
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
8
|
+
import { getDatabase } from '../../db/client.js';
|
|
9
|
+
import { createTeam, getTeamByName } from '../../db/queries/teams.js';
|
|
10
|
+
|
|
11
|
+
export const addRepoCommand = new Command('add-repo')
|
|
12
|
+
.description('Add a repository as a git submodule with team assignment')
|
|
13
|
+
.requiredOption('--url <url>', 'Repository URL')
|
|
14
|
+
.requiredOption('--team <name>', 'Team name')
|
|
15
|
+
.option('--branch <branch>', 'Branch to track', 'main')
|
|
16
|
+
.action(async (options: { url: string; team: string; branch: string }) => {
|
|
17
|
+
const root = findHiveRoot();
|
|
18
|
+
if (!root) {
|
|
19
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const paths = getHivePaths(root);
|
|
24
|
+
const spinner = ora('Adding repository...').start();
|
|
25
|
+
|
|
26
|
+
// Extract repo name from URL
|
|
27
|
+
const repoName = options.url.split('/').pop()?.replace('.git', '') || 'repo';
|
|
28
|
+
const repoPath = join(paths.reposDir, repoName);
|
|
29
|
+
const relativeRepoPath = `repos/${repoName}`;
|
|
30
|
+
|
|
31
|
+
try {
|
|
32
|
+
// Check if team already exists
|
|
33
|
+
const db = await getDatabase(paths.hiveDir);
|
|
34
|
+
const existingTeam = getTeamByName(db.db, options.team);
|
|
35
|
+
if (existingTeam) {
|
|
36
|
+
spinner.fail(chalk.red(`Team "${options.team}" already exists`));
|
|
37
|
+
db.close();
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Check if repo path already exists
|
|
42
|
+
if (existsSync(repoPath)) {
|
|
43
|
+
spinner.fail(chalk.red(`Repository path already exists: ${repoPath}`));
|
|
44
|
+
db.close();
|
|
45
|
+
process.exit(1);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Add git submodule
|
|
49
|
+
spinner.text = 'Adding git submodule...';
|
|
50
|
+
try {
|
|
51
|
+
await execa('git', ['submodule', 'add', '-b', options.branch, options.url, relativeRepoPath], {
|
|
52
|
+
cwd: root,
|
|
53
|
+
});
|
|
54
|
+
} catch (gitErr: unknown) {
|
|
55
|
+
// If submodule already exists, try to init/update instead
|
|
56
|
+
const error = gitErr as { stderr?: string };
|
|
57
|
+
if (error.stderr?.includes('already exists')) {
|
|
58
|
+
spinner.text = 'Submodule exists, initializing...';
|
|
59
|
+
await execa('git', ['submodule', 'init', relativeRepoPath], { cwd: root });
|
|
60
|
+
await execa('git', ['submodule', 'update', relativeRepoPath], { cwd: root });
|
|
61
|
+
} else {
|
|
62
|
+
throw gitErr;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Create team in database
|
|
67
|
+
spinner.text = 'Creating team...';
|
|
68
|
+
const team = createTeam(db.db, {
|
|
69
|
+
repoUrl: options.url,
|
|
70
|
+
repoPath: relativeRepoPath,
|
|
71
|
+
name: options.team,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
db.close();
|
|
75
|
+
|
|
76
|
+
spinner.succeed(chalk.green(`Repository added successfully!`));
|
|
77
|
+
console.log();
|
|
78
|
+
console.log(chalk.bold('Team created:'));
|
|
79
|
+
console.log(chalk.gray(` ID: ${team.id}`));
|
|
80
|
+
console.log(chalk.gray(` Name: ${team.name}`));
|
|
81
|
+
console.log(chalk.gray(` Repo: ${team.repo_url}`));
|
|
82
|
+
console.log(chalk.gray(` Path: ${team.repo_path}`));
|
|
83
|
+
console.log();
|
|
84
|
+
} catch (err) {
|
|
85
|
+
spinner.fail(chalk.red('Failed to add repository'));
|
|
86
|
+
console.error(err);
|
|
87
|
+
process.exit(1);
|
|
88
|
+
}
|
|
89
|
+
});
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
4
|
+
import { getDatabase } from '../../db/client.js';
|
|
5
|
+
import { getAllAgents, getAgentById, getActiveAgents, getAgentsByStatus, deleteAgent } from '../../db/queries/agents.js';
|
|
6
|
+
import { getLogsByAgent } from '../../db/queries/logs.js';
|
|
7
|
+
import { statusColor } from '../../utils/logger.js';
|
|
8
|
+
|
|
9
|
+
export const agentsCommand = new Command('agents')
|
|
10
|
+
.description('Manage agents');
|
|
11
|
+
|
|
12
|
+
agentsCommand
|
|
13
|
+
.command('list')
|
|
14
|
+
.description('List all agents')
|
|
15
|
+
.option('--active', 'Show only active agents')
|
|
16
|
+
.option('--json', 'Output as JSON')
|
|
17
|
+
.action(async (options: { active?: boolean; json?: boolean }) => {
|
|
18
|
+
const root = findHiveRoot();
|
|
19
|
+
if (!root) {
|
|
20
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const paths = getHivePaths(root);
|
|
25
|
+
const db = await getDatabase(paths.hiveDir);
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
const agents = options.active ? getActiveAgents(db.db) : getAllAgents(db.db);
|
|
29
|
+
|
|
30
|
+
if (options.json) {
|
|
31
|
+
console.log(JSON.stringify(agents, null, 2));
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (agents.length === 0) {
|
|
36
|
+
console.log(chalk.yellow('No agents found.'));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
console.log(chalk.bold('\nAgents:\n'));
|
|
41
|
+
|
|
42
|
+
// Header
|
|
43
|
+
console.log(
|
|
44
|
+
chalk.gray(
|
|
45
|
+
`${'ID'.padEnd(25)} ${'Type'.padEnd(12)} ${'Model'.padEnd(10)} ${'Team'.padEnd(15)} ${'Status'.padEnd(12)} ${'Current Story'}`
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
console.log(chalk.gray('─'.repeat(100)));
|
|
49
|
+
|
|
50
|
+
for (const agent of agents) {
|
|
51
|
+
const team = agent.team_id || '-';
|
|
52
|
+
const story = agent.current_story_id || '-';
|
|
53
|
+
const model = agent.model || '-';
|
|
54
|
+
console.log(
|
|
55
|
+
`${chalk.cyan(agent.id.padEnd(25))} ${agent.type.padEnd(12)} ${model.padEnd(10)} ${team.padEnd(15)} ${statusColor(agent.status).padEnd(12)} ${story}`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
console.log();
|
|
59
|
+
} finally {
|
|
60
|
+
db.close();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
agentsCommand
|
|
65
|
+
.command('logs <agent-id>')
|
|
66
|
+
.description('View agent logs')
|
|
67
|
+
.option('-n, --limit <number>', 'Number of logs to show', '50')
|
|
68
|
+
.option('--json', 'Output as JSON')
|
|
69
|
+
.action(async (agentId: string, options: { limit: string; json?: boolean }) => {
|
|
70
|
+
const root = findHiveRoot();
|
|
71
|
+
if (!root) {
|
|
72
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const paths = getHivePaths(root);
|
|
77
|
+
const db = await getDatabase(paths.hiveDir);
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const agent = getAgentById(db.db, agentId);
|
|
81
|
+
if (!agent) {
|
|
82
|
+
console.error(chalk.red(`Agent not found: ${agentId}`));
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const logs = getLogsByAgent(db.db, agentId, parseInt(options.limit, 10));
|
|
87
|
+
|
|
88
|
+
if (options.json) {
|
|
89
|
+
console.log(JSON.stringify(logs, null, 2));
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (logs.length === 0) {
|
|
94
|
+
console.log(chalk.yellow('No logs found for this agent.'));
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(chalk.bold(`\nLogs for ${agentId}:\n`));
|
|
99
|
+
|
|
100
|
+
for (const log of logs) {
|
|
101
|
+
const time = log.timestamp.substring(0, 19).replace('T', ' ');
|
|
102
|
+
const storyInfo = log.story_id ? chalk.cyan(` [${log.story_id}]`) : '';
|
|
103
|
+
const message = log.message ? `: ${log.message}` : '';
|
|
104
|
+
|
|
105
|
+
console.log(`${chalk.gray(time)}${storyInfo} ${chalk.bold(log.event_type)}${message}`);
|
|
106
|
+
|
|
107
|
+
if (log.metadata) {
|
|
108
|
+
try {
|
|
109
|
+
const meta = JSON.parse(log.metadata);
|
|
110
|
+
console.log(chalk.gray(` ${JSON.stringify(meta)}`));
|
|
111
|
+
} catch {
|
|
112
|
+
// Ignore parse errors
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
console.log();
|
|
117
|
+
} finally {
|
|
118
|
+
db.close();
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
agentsCommand
|
|
123
|
+
.command('inspect <agent-id>')
|
|
124
|
+
.description('View detailed agent state')
|
|
125
|
+
.action(async (agentId: string) => {
|
|
126
|
+
const root = findHiveRoot();
|
|
127
|
+
if (!root) {
|
|
128
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const paths = getHivePaths(root);
|
|
133
|
+
const db = await getDatabase(paths.hiveDir);
|
|
134
|
+
|
|
135
|
+
try {
|
|
136
|
+
const agent = getAgentById(db.db, agentId);
|
|
137
|
+
if (!agent) {
|
|
138
|
+
console.error(chalk.red(`Agent not found: ${agentId}`));
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
console.log(chalk.bold(`\nAgent: ${agent.id}\n`));
|
|
143
|
+
console.log(chalk.gray(`Type: ${agent.type}`));
|
|
144
|
+
console.log(chalk.gray(`Model: ${agent.model || '-'}`));
|
|
145
|
+
console.log(chalk.gray(`Team: ${agent.team_id || '-'}`));
|
|
146
|
+
console.log(chalk.gray(`Status: ${statusColor(agent.status)}`));
|
|
147
|
+
console.log(chalk.gray(`Tmux Session: ${agent.tmux_session || '-'}`));
|
|
148
|
+
console.log(chalk.gray(`Current Story: ${agent.current_story_id || '-'}`));
|
|
149
|
+
console.log(chalk.gray(`Created: ${agent.created_at}`));
|
|
150
|
+
console.log(chalk.gray(`Updated: ${agent.updated_at}`));
|
|
151
|
+
|
|
152
|
+
if (agent.memory_state) {
|
|
153
|
+
console.log(chalk.bold('\nMemory State:'));
|
|
154
|
+
try {
|
|
155
|
+
const state = JSON.parse(agent.memory_state);
|
|
156
|
+
console.log(JSON.stringify(state, null, 2));
|
|
157
|
+
} catch {
|
|
158
|
+
console.log(agent.memory_state);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// Show recent logs
|
|
163
|
+
const logs = getLogsByAgent(db.db, agentId, 5);
|
|
164
|
+
if (logs.length > 0) {
|
|
165
|
+
console.log(chalk.bold('\nRecent Activity:'));
|
|
166
|
+
for (const log of logs) {
|
|
167
|
+
const time = log.timestamp.substring(11, 19);
|
|
168
|
+
const message = log.message ? `: ${log.message.substring(0, 50)}` : '';
|
|
169
|
+
console.log(chalk.gray(` ${time} | ${log.event_type}${message}`));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
console.log();
|
|
173
|
+
} finally {
|
|
174
|
+
db.close();
|
|
175
|
+
}
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
agentsCommand
|
|
179
|
+
.command('cleanup')
|
|
180
|
+
.description('Clean up terminated agents from the database')
|
|
181
|
+
.option('--dry-run', 'Show what would be deleted without actually deleting')
|
|
182
|
+
.action(async (options: { dryRun?: boolean }) => {
|
|
183
|
+
const root = findHiveRoot();
|
|
184
|
+
if (!root) {
|
|
185
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
186
|
+
process.exit(1);
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const paths = getHivePaths(root);
|
|
190
|
+
const db = await getDatabase(paths.hiveDir);
|
|
191
|
+
|
|
192
|
+
try {
|
|
193
|
+
const terminatedAgents = getAgentsByStatus(db.db, 'terminated');
|
|
194
|
+
|
|
195
|
+
if (terminatedAgents.length === 0) {
|
|
196
|
+
console.log(chalk.green('No terminated agents to clean up.'));
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
console.log(chalk.yellow(`\nFound ${terminatedAgents.length} terminated agent(s):\n`));
|
|
201
|
+
|
|
202
|
+
// Group by type for summary
|
|
203
|
+
const byType = terminatedAgents.reduce((acc, agent) => {
|
|
204
|
+
acc[agent.type] = (acc[agent.type] || 0) + 1;
|
|
205
|
+
return acc;
|
|
206
|
+
}, {} as Record<string, number>);
|
|
207
|
+
|
|
208
|
+
for (const [type, count] of Object.entries(byType)) {
|
|
209
|
+
console.log(chalk.gray(` ${type}: ${count}`));
|
|
210
|
+
}
|
|
211
|
+
console.log();
|
|
212
|
+
|
|
213
|
+
if (options.dryRun) {
|
|
214
|
+
console.log(chalk.yellow('Dry run - no agents were deleted.'));
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Delete terminated agents and their worktrees
|
|
219
|
+
let deleted = 0;
|
|
220
|
+
for (const agent of terminatedAgents) {
|
|
221
|
+
try {
|
|
222
|
+
// Remove worktree if exists
|
|
223
|
+
if (agent.worktree_path) {
|
|
224
|
+
try {
|
|
225
|
+
const { execSync } = await import('child_process');
|
|
226
|
+
const fullWorktreePath = `${root}/${agent.worktree_path}`;
|
|
227
|
+
execSync(`git worktree remove "${fullWorktreePath}" --force`, {
|
|
228
|
+
cwd: root,
|
|
229
|
+
stdio: 'pipe',
|
|
230
|
+
});
|
|
231
|
+
} catch (err) {
|
|
232
|
+
console.error(chalk.yellow(`Warning: Failed to remove worktree for ${agent.id}: ${err instanceof Error ? err.message : 'Unknown error'}`));
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
deleteAgent(db.db, agent.id);
|
|
237
|
+
deleted++;
|
|
238
|
+
} catch (err) {
|
|
239
|
+
console.error(chalk.red(`Failed to delete ${agent.id}: ${err instanceof Error ? err.message : 'Unknown error'}`));
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
console.log(chalk.green(`✓ Cleaned up ${deleted} terminated agent(s).`));
|
|
244
|
+
} finally {
|
|
245
|
+
db.close();
|
|
246
|
+
}
|
|
247
|
+
});
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import ora from 'ora';
|
|
4
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
5
|
+
import { getDatabase } from '../../db/client.js';
|
|
6
|
+
import { loadConfig } from '../../config/loader.js';
|
|
7
|
+
import { Scheduler } from '../../orchestrator/scheduler.js';
|
|
8
|
+
import { startManager, isManagerRunning } from '../../tmux/manager.js';
|
|
9
|
+
|
|
10
|
+
export const assignCommand = new Command('assign')
|
|
11
|
+
.description('Assign planned stories to agents (spawns Seniors as needed)')
|
|
12
|
+
.option('--dry-run', 'Show what would be assigned without making changes')
|
|
13
|
+
.action(async (options: { dryRun?: boolean }) => {
|
|
14
|
+
const root = findHiveRoot();
|
|
15
|
+
if (!root) {
|
|
16
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
17
|
+
process.exit(1);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const paths = getHivePaths(root);
|
|
21
|
+
const db = await getDatabase(paths.hiveDir);
|
|
22
|
+
const spinner = ora('Assigning stories...').start();
|
|
23
|
+
|
|
24
|
+
try {
|
|
25
|
+
const config = loadConfig(paths.hiveDir);
|
|
26
|
+
|
|
27
|
+
if (options.dryRun) {
|
|
28
|
+
spinner.info(chalk.yellow('Dry run - no changes will be made'));
|
|
29
|
+
// TODO: Add dry run logic
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const scheduler = new Scheduler(db.db, {
|
|
34
|
+
scaling: config.scaling,
|
|
35
|
+
models: config.models,
|
|
36
|
+
rootDir: root,
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
// Check scaling first (spawns additional seniors if needed)
|
|
40
|
+
spinner.text = 'Checking team scaling...';
|
|
41
|
+
await scheduler.checkScaling();
|
|
42
|
+
|
|
43
|
+
// Check merge queue (spawns QA agents if needed)
|
|
44
|
+
spinner.text = 'Checking merge queue...';
|
|
45
|
+
await scheduler.checkMergeQueue();
|
|
46
|
+
|
|
47
|
+
// Assign stories to agents
|
|
48
|
+
spinner.text = 'Assigning stories to agents...';
|
|
49
|
+
const result = await scheduler.assignStories();
|
|
50
|
+
|
|
51
|
+
if (result.errors.length > 0) {
|
|
52
|
+
spinner.warn(chalk.yellow(`Assigned ${result.assigned} stories with ${result.errors.length} errors`));
|
|
53
|
+
for (const error of result.errors) {
|
|
54
|
+
console.log(chalk.red(` - ${error}`));
|
|
55
|
+
}
|
|
56
|
+
} else if (result.assigned === 0) {
|
|
57
|
+
spinner.info(chalk.gray('No stories to assign'));
|
|
58
|
+
} else {
|
|
59
|
+
spinner.succeed(chalk.green(`Assigned ${result.assigned} stories`));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// Auto-start the manager if work was assigned and it's not running
|
|
63
|
+
if (result.assigned > 0) {
|
|
64
|
+
if (!await isManagerRunning()) {
|
|
65
|
+
spinner.start('Starting manager daemon...');
|
|
66
|
+
const started = await startManager(60);
|
|
67
|
+
if (started) {
|
|
68
|
+
spinner.succeed(chalk.green('Manager daemon started (checking every 60s)'));
|
|
69
|
+
} else {
|
|
70
|
+
spinner.info(chalk.gray('Manager daemon already running'));
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
console.log();
|
|
76
|
+
console.log(chalk.gray('View agent status:'));
|
|
77
|
+
console.log(chalk.cyan(' hive agents list --active'));
|
|
78
|
+
console.log();
|
|
79
|
+
} catch (err) {
|
|
80
|
+
spinner.fail(chalk.red('Failed to assign stories'));
|
|
81
|
+
console.error(err);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
} finally {
|
|
84
|
+
db.close();
|
|
85
|
+
}
|
|
86
|
+
});
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
import { stringify } from 'yaml';
|
|
4
|
+
import { findHiveRoot, getHivePaths } from '../../utils/paths.js';
|
|
5
|
+
import { loadConfig, saveConfig, getConfigValue, setConfigValue, ConfigError } from '../../config/loader.js';
|
|
6
|
+
|
|
7
|
+
export const configCommand = new Command('config')
|
|
8
|
+
.description('Manage Hive configuration');
|
|
9
|
+
|
|
10
|
+
configCommand
|
|
11
|
+
.command('show')
|
|
12
|
+
.description('Show current configuration')
|
|
13
|
+
.option('--json', 'Output as JSON')
|
|
14
|
+
.action((options: { json?: boolean }) => {
|
|
15
|
+
const root = findHiveRoot();
|
|
16
|
+
if (!root) {
|
|
17
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const paths = getHivePaths(root);
|
|
22
|
+
|
|
23
|
+
try {
|
|
24
|
+
const config = loadConfig(paths.hiveDir);
|
|
25
|
+
|
|
26
|
+
if (options.json) {
|
|
27
|
+
console.log(JSON.stringify(config, null, 2));
|
|
28
|
+
} else {
|
|
29
|
+
console.log(stringify(config, { indent: 2 }));
|
|
30
|
+
}
|
|
31
|
+
} catch (err) {
|
|
32
|
+
if (err instanceof ConfigError) {
|
|
33
|
+
console.error(chalk.red(err.message));
|
|
34
|
+
} else {
|
|
35
|
+
console.error(chalk.red('Failed to load configuration:'), err);
|
|
36
|
+
}
|
|
37
|
+
process.exit(1);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
configCommand
|
|
42
|
+
.command('get <path>')
|
|
43
|
+
.description('Get a specific configuration value')
|
|
44
|
+
.action((path: string) => {
|
|
45
|
+
const root = findHiveRoot();
|
|
46
|
+
if (!root) {
|
|
47
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const paths = getHivePaths(root);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
const config = loadConfig(paths.hiveDir);
|
|
55
|
+
const value = getConfigValue(config, path);
|
|
56
|
+
|
|
57
|
+
if (value === undefined) {
|
|
58
|
+
console.error(chalk.yellow(`Configuration key not found: ${path}`));
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (typeof value === 'object') {
|
|
63
|
+
console.log(stringify(value, { indent: 2 }));
|
|
64
|
+
} else {
|
|
65
|
+
console.log(value);
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
if (err instanceof ConfigError) {
|
|
69
|
+
console.error(chalk.red(err.message));
|
|
70
|
+
} else {
|
|
71
|
+
console.error(chalk.red('Failed to get configuration:'), err);
|
|
72
|
+
}
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
configCommand
|
|
78
|
+
.command('set <path> <value>')
|
|
79
|
+
.description('Set a configuration value')
|
|
80
|
+
.action((path: string, value: string) => {
|
|
81
|
+
const root = findHiveRoot();
|
|
82
|
+
if (!root) {
|
|
83
|
+
console.error(chalk.red('Not in a Hive workspace. Run "hive init" first.'));
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const paths = getHivePaths(root);
|
|
88
|
+
|
|
89
|
+
try {
|
|
90
|
+
const config = loadConfig(paths.hiveDir);
|
|
91
|
+
|
|
92
|
+
// Try to parse value as JSON, otherwise use as string
|
|
93
|
+
let parsedValue: unknown;
|
|
94
|
+
try {
|
|
95
|
+
parsedValue = JSON.parse(value);
|
|
96
|
+
} catch {
|
|
97
|
+
// Check for boolean strings
|
|
98
|
+
if (value.toLowerCase() === 'true') {
|
|
99
|
+
parsedValue = true;
|
|
100
|
+
} else if (value.toLowerCase() === 'false') {
|
|
101
|
+
parsedValue = false;
|
|
102
|
+
} else if (!isNaN(Number(value))) {
|
|
103
|
+
parsedValue = Number(value);
|
|
104
|
+
} else {
|
|
105
|
+
parsedValue = value;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const newConfig = setConfigValue(config, path, parsedValue);
|
|
110
|
+
saveConfig(paths.hiveDir, newConfig);
|
|
111
|
+
|
|
112
|
+
console.log(chalk.green(`Set ${chalk.bold(path)} = ${JSON.stringify(parsedValue)}`));
|
|
113
|
+
} catch (err) {
|
|
114
|
+
if (err instanceof ConfigError) {
|
|
115
|
+
console.error(chalk.red(err.message));
|
|
116
|
+
} else {
|
|
117
|
+
console.error(chalk.red('Failed to set configuration:'), err);
|
|
118
|
+
}
|
|
119
|
+
process.exit(1);
|
|
120
|
+
}
|
|
121
|
+
});
|