hungry-ghost-hive 0.48.0 → 0.49.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/dist/agents/base-agent.d.ts +11 -11
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +25 -25
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/base-agent.test.js +2 -1
- package/dist/agents/base-agent.test.js.map +1 -1
- package/dist/agents/intermediate.d.ts +2 -0
- package/dist/agents/intermediate.d.ts.map +1 -1
- package/dist/agents/intermediate.js +25 -18
- package/dist/agents/intermediate.js.map +1 -1
- package/dist/agents/junior.d.ts +2 -0
- package/dist/agents/junior.d.ts.map +1 -1
- package/dist/agents/junior.js +25 -18
- package/dist/agents/junior.js.map +1 -1
- package/dist/agents/qa.d.ts +2 -0
- package/dist/agents/qa.d.ts.map +1 -1
- package/dist/agents/qa.js +47 -38
- package/dist/agents/qa.js.map +1 -1
- package/dist/agents/senior.d.ts +2 -0
- package/dist/agents/senior.d.ts.map +1 -1
- package/dist/agents/senior.js +40 -27
- package/dist/agents/senior.js.map +1 -1
- package/dist/agents/tech-lead.d.ts +2 -0
- package/dist/agents/tech-lead.d.ts.map +1 -1
- package/dist/agents/tech-lead.js +37 -31
- package/dist/agents/tech-lead.js.map +1 -1
- package/dist/cli/commands/add-repo.js +2 -2
- package/dist/cli/commands/add-repo.js.map +1 -1
- package/dist/cli/commands/add-repo.test.js +1 -1
- package/dist/cli/commands/add-repo.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +12 -10
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/agents.test.js +7 -7
- package/dist/cli/commands/agents.test.js.map +1 -1
- package/dist/cli/commands/approach.js +2 -2
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/approvals.js +7 -7
- package/dist/cli/commands/approvals.js.map +1 -1
- package/dist/cli/commands/approvals.test.js +8 -8
- package/dist/cli/commands/approvals.test.js.map +1 -1
- package/dist/cli/commands/assign.js +4 -4
- package/dist/cli/commands/assign.js.map +1 -1
- package/dist/cli/commands/assign.test.js +18 -16
- package/dist/cli/commands/assign.test.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -8
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/cleanup.test.js +5 -1
- package/dist/cli/commands/cleanup.test.js.map +1 -1
- package/dist/cli/commands/escalations.js +9 -7
- package/dist/cli/commands/escalations.js.map +1 -1
- package/dist/cli/commands/escalations.test.js +2 -2
- package/dist/cli/commands/escalations.test.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +4 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.d.ts +2 -2
- package/dist/cli/commands/manager/agent-monitoring.d.ts.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.js +3 -3
- package/dist/cli/commands/manager/auditor-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.test.js +21 -14
- package/dist/cli/commands/manager/auditor-lifecycle.test.js.map +1 -1
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js +28 -23
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.d.ts +2 -2
- package/dist/cli/commands/manager/escalation-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.js +11 -10
- package/dist/cli/commands/manager/escalation-handler.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.test.js +8 -8
- package/dist/cli/commands/manager/escalation-handler.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.js +7 -7
- package/dist/cli/commands/manager/feature-sign-off.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.test.js +40 -31
- package/dist/cli/commands/manager/feature-sign-off.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.d.ts.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.js +12 -13
- package/dist/cli/commands/manager/feature-test-result.js.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.js +14 -15
- package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +26 -26
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/index.test.js +3 -3
- package/dist/cli/commands/manager/index.test.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts +2 -2
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.js +6 -7
- package/dist/cli/commands/manager/merged-story-cleanup.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.test.js +27 -18
- package/dist/cli/commands/manager/merged-story-cleanup.test.js.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +46 -38
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.js +25 -22
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -1
- package/dist/cli/commands/manager/spin-down.d.ts.map +1 -1
- package/dist/cli/commands/manager/spin-down.js +23 -19
- package/dist/cli/commands/manager/spin-down.js.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.d.ts +2 -3
- package/dist/cli/commands/manager/stale-escalations.d.ts.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-helpers.js +8 -8
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +2 -2
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.js +23 -22
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -1
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +6 -6
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/types.d.ts +2 -3
- package/dist/cli/commands/manager/types.d.ts.map +1 -1
- package/dist/cli/commands/manager/types.js.map +1 -1
- package/dist/cli/commands/msg.test.js +2 -2
- package/dist/cli/commands/msg.test.js.map +1 -1
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +17 -18
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/my-stories.test.js +2 -2
- package/dist/cli/commands/my-stories.test.js.map +1 -1
- package/dist/cli/commands/nuke.test.js +1 -1
- package/dist/cli/commands/nuke.test.js.map +1 -1
- package/dist/cli/commands/pr.js +32 -32
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/pr.test.js +10 -6
- package/dist/cli/commands/pr.test.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +4 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/progress.test.js +1 -1
- package/dist/cli/commands/progress.test.js.map +1 -1
- package/dist/cli/commands/req-headless.test.d.ts +2 -0
- package/dist/cli/commands/req-headless.test.d.ts.map +1 -0
- package/dist/cli/commands/req-headless.test.js +128 -0
- package/dist/cli/commands/req-headless.test.js.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +5 -1
- package/dist/cli/commands/req-spawn.test.js.map +1 -1
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +13 -14
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +7 -8
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/resume.test.js +1 -1
- package/dist/cli/commands/resume.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -40
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +1 -1
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/stories.js +9 -9
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cli/commands/stories.test.js +2 -2
- package/dist/cli/commands/stories.test.js.map +1 -1
- package/dist/cli/commands/teams.js +11 -11
- package/dist/cli/commands/teams.js.map +1 -1
- package/dist/cli/commands/teams.test.js +2 -2
- package/dist/cli/commands/teams.test.js.map +1 -1
- package/dist/cli/dashboard/index.d.ts +2 -2
- package/dist/cli/dashboard/index.d.ts.map +1 -1
- package/dist/cli/dashboard/index.js +29 -20
- package/dist/cli/dashboard/index.js.map +1 -1
- package/dist/cli/dashboard/index.test.js +34 -32
- package/dist/cli/dashboard/index.test.js.map +1 -1
- package/dist/cli/dashboard/panels/activity.d.ts +3 -3
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/activity.js +1 -1
- package/dist/cli/dashboard/panels/activity.js.map +1 -1
- package/dist/cli/dashboard/panels/agents.d.ts +3 -3
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/agents.js +2 -2
- package/dist/cli/dashboard/panels/agents.js.map +1 -1
- package/dist/cli/dashboard/panels/escalations.d.ts +3 -3
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/escalations.js +1 -1
- package/dist/cli/dashboard/panels/escalations.js.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.d.ts +3 -3
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.d.ts +3 -3
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.js +1 -1
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -1
- package/dist/config/schema.d.ts +85 -82
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/connectors/project-management/operations.d.ts +7 -7
- package/dist/connectors/project-management/operations.d.ts.map +1 -1
- package/dist/connectors/project-management/operations.js +2 -3
- package/dist/connectors/project-management/operations.js.map +1 -1
- package/dist/context-files/index.test.js +1 -0
- package/dist/context-files/index.test.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/postgres-provider.d.ts +43 -0
- package/dist/db/postgres-provider.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.d.ts +2 -0
- package/dist/db/postgres-provider.integration.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.js +399 -0
- package/dist/db/postgres-provider.integration.test.js.map +1 -0
- package/dist/db/postgres-provider.js +315 -0
- package/dist/db/postgres-provider.js.map +1 -0
- package/dist/db/postgres-provider.test.d.ts +2 -0
- package/dist/db/postgres-provider.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.test.js +72 -0
- package/dist/db/postgres-provider.test.js.map +1 -0
- package/dist/db/provider.d.ts +59 -0
- package/dist/db/provider.d.ts.map +1 -0
- package/dist/db/provider.js +121 -0
- package/dist/db/provider.js.map +1 -0
- package/dist/db/provider.test.d.ts +2 -0
- package/dist/db/provider.test.d.ts.map +1 -0
- package/dist/db/provider.test.js +226 -0
- package/dist/db/provider.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +13 -13
- package/dist/db/queries/agents.d.ts.map +1 -1
- package/dist/db/queries/agents.js +27 -28
- package/dist/db/queries/agents.js.map +1 -1
- package/dist/db/queries/agents.test.js +113 -111
- package/dist/db/queries/agents.test.js.map +1 -1
- package/dist/db/queries/escalations.d.ts +16 -16
- package/dist/db/queries/escalations.d.ts.map +1 -1
- package/dist/db/queries/escalations.js +34 -35
- package/dist/db/queries/escalations.js.map +1 -1
- package/dist/db/queries/escalations.test.js +133 -131
- package/dist/db/queries/escalations.test.js.map +1 -1
- package/dist/db/queries/heartbeat.d.ts +5 -5
- package/dist/db/queries/heartbeat.d.ts.map +1 -1
- package/dist/db/queries/heartbeat.js +7 -23
- package/dist/db/queries/heartbeat.js.map +1 -1
- package/dist/db/queries/heartbeat.test.js +76 -76
- package/dist/db/queries/heartbeat.test.js.map +1 -1
- package/dist/db/queries/integration-sync.d.ts +7 -7
- package/dist/db/queries/integration-sync.d.ts.map +1 -1
- package/dist/db/queries/integration-sync.js +13 -14
- package/dist/db/queries/integration-sync.js.map +1 -1
- package/dist/db/queries/logs.d.ts +10 -10
- package/dist/db/queries/logs.d.ts.map +1 -1
- package/dist/db/queries/logs.js +44 -42
- package/dist/db/queries/logs.js.map +1 -1
- package/dist/db/queries/logs.test.js +149 -146
- package/dist/db/queries/logs.test.js.map +1 -1
- package/dist/db/queries/messages.d.ts +6 -6
- package/dist/db/queries/messages.d.ts.map +1 -1
- package/dist/db/queries/messages.js +12 -11
- package/dist/db/queries/messages.js.map +1 -1
- package/dist/db/queries/messages.test.js +47 -46
- package/dist/db/queries/messages.test.js.map +1 -1
- package/dist/db/queries/pull-requests.d.ts +18 -18
- package/dist/db/queries/pull-requests.d.ts.map +1 -1
- package/dist/db/queries/pull-requests.js +50 -48
- package/dist/db/queries/pull-requests.js.map +1 -1
- package/dist/db/queries/pull-requests.test.js +195 -198
- package/dist/db/queries/pull-requests.test.js.map +1 -1
- package/dist/db/queries/requirements.d.ts +8 -8
- package/dist/db/queries/requirements.d.ts.map +1 -1
- package/dist/db/queries/requirements.js +17 -18
- package/dist/db/queries/requirements.js.map +1 -1
- package/dist/db/queries/requirements.test.js +83 -81
- package/dist/db/queries/requirements.test.js.map +1 -1
- package/dist/db/queries/stories.d.ts +29 -29
- package/dist/db/queries/stories.d.ts.map +1 -1
- package/dist/db/queries/stories.js +58 -64
- package/dist/db/queries/stories.js.map +1 -1
- package/dist/db/queries/stories.test.js +172 -170
- package/dist/db/queries/stories.test.js.map +1 -1
- package/dist/db/queries/teams.d.ts +6 -6
- package/dist/db/queries/teams.d.ts.map +1 -1
- package/dist/db/queries/teams.js +11 -12
- package/dist/db/queries/teams.js.map +1 -1
- package/dist/db/queries/teams.test.js +36 -34
- package/dist/db/queries/teams.test.js.map +1 -1
- package/dist/integrations/jira/repair.test.js +26 -24
- package/dist/integrations/jira/repair.test.js.map +1 -1
- package/dist/integrations/jira/stories.d.ts +3 -3
- package/dist/integrations/jira/stories.d.ts.map +1 -1
- package/dist/integrations/jira/stories.js +12 -12
- package/dist/integrations/jira/stories.js.map +1 -1
- package/dist/integrations/jira/stories.test.js +10 -8
- package/dist/integrations/jira/stories.test.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +7 -7
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +17 -20
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/integrations/jira/sync.test.js +63 -62
- package/dist/integrations/jira/sync.test.js.map +1 -1
- package/dist/integrations/jira/transitions.d.ts +3 -3
- package/dist/integrations/jira/transitions.d.ts.map +1 -1
- package/dist/integrations/jira/transitions.js +3 -3
- package/dist/integrations/jira/transitions.js.map +1 -1
- package/dist/orchestrator/agent-selector.d.ts +3 -3
- package/dist/orchestrator/agent-selector.d.ts.map +1 -1
- package/dist/orchestrator/agent-selector.js +5 -6
- package/dist/orchestrator/agent-selector.js.map +1 -1
- package/dist/orchestrator/dependency-resolver.d.ts +4 -4
- package/dist/orchestrator/dependency-resolver.d.ts.map +1 -1
- package/dist/orchestrator/dependency-resolver.js +6 -6
- package/dist/orchestrator/dependency-resolver.js.map +1 -1
- package/dist/orchestrator/feature-branch.d.ts +3 -3
- package/dist/orchestrator/feature-branch.d.ts.map +1 -1
- package/dist/orchestrator/feature-branch.js +9 -10
- package/dist/orchestrator/feature-branch.js.map +1 -1
- package/dist/orchestrator/feature-branch.test.js +80 -78
- package/dist/orchestrator/feature-branch.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +2 -2
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +10 -10
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +4 -4
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +90 -76
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +496 -374
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/dist/utils/auto-merge.d.ts.map +1 -1
- package/dist/utils/auto-merge.js +74 -56
- package/dist/utils/auto-merge.js.map +1 -1
- package/dist/utils/auto-merge.test.js +101 -66
- package/dist/utils/auto-merge.test.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +5 -5
- package/dist/utils/cli-helpers.d.ts.map +1 -1
- package/dist/utils/cli-helpers.js +8 -9
- package/dist/utils/cli-helpers.js.map +1 -1
- package/dist/utils/cli-helpers.test.js +28 -30
- package/dist/utils/cli-helpers.test.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +12 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +1 -0
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/pr-sync.d.ts +10 -10
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +20 -21
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/pr-sync.test.js +52 -50
- package/dist/utils/pr-sync.test.js.map +1 -1
- package/dist/utils/with-hive-context.d.ts.map +1 -1
- package/dist/utils/with-hive-context.js +70 -1
- package/dist/utils/with-hive-context.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/base-agent.test.ts +2 -1
- package/src/agents/base-agent.ts +32 -28
- package/src/agents/intermediate.ts +27 -18
- package/src/agents/junior.ts +27 -18
- package/src/agents/qa.ts +54 -40
- package/src/agents/senior.ts +42 -27
- package/src/agents/tech-lead.ts +42 -32
- package/src/cli/commands/add-repo.test.ts +1 -1
- package/src/cli/commands/add-repo.ts +2 -2
- package/src/cli/commands/agents.test.ts +7 -7
- package/src/cli/commands/agents.ts +12 -10
- package/src/cli/commands/approach.ts +2 -2
- package/src/cli/commands/approvals.test.ts +8 -8
- package/src/cli/commands/approvals.ts +9 -7
- package/src/cli/commands/assign.test.ts +19 -18
- package/src/cli/commands/assign.ts +4 -4
- package/src/cli/commands/cleanup.test.ts +5 -1
- package/src/cli/commands/cleanup.ts +11 -9
- package/src/cli/commands/escalations.test.ts +2 -2
- package/src/cli/commands/escalations.ts +9 -7
- package/src/cli/commands/init.test.ts +5 -0
- package/src/cli/commands/init.ts +53 -5
- package/src/cli/commands/manager/agent-monitoring.ts +3 -3
- package/src/cli/commands/manager/auditor-lifecycle.test.ts +21 -14
- package/src/cli/commands/manager/auditor-lifecycle.ts +3 -3
- package/src/cli/commands/manager/auto-reject-comment-only-reviews.test.ts +28 -23
- package/src/cli/commands/manager/escalation-handler.test.ts +13 -13
- package/src/cli/commands/manager/escalation-handler.ts +19 -12
- package/src/cli/commands/manager/feature-sign-off.test.ts +40 -31
- package/src/cli/commands/manager/feature-sign-off.ts +7 -7
- package/src/cli/commands/manager/feature-test-result.ts +13 -16
- package/src/cli/commands/manager/handoff-recovery.ts +20 -20
- package/src/cli/commands/manager/index.test.ts +4 -4
- package/src/cli/commands/manager/index.ts +58 -59
- package/src/cli/commands/manager/merged-story-cleanup.test.ts +28 -19
- package/src/cli/commands/manager/merged-story-cleanup.ts +11 -14
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +115 -110
- package/src/cli/commands/manager/qa-review-handler.ts +50 -63
- package/src/cli/commands/manager/spin-down.ts +27 -25
- package/src/cli/commands/manager/stale-escalations.ts +2 -3
- package/src/cli/commands/manager/stuck-story-helpers.ts +10 -10
- package/src/cli/commands/manager/stuck-story-processor.ts +56 -62
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +6 -6
- package/src/cli/commands/manager/types.ts +2 -3
- package/src/cli/commands/msg.test.ts +2 -2
- package/src/cli/commands/my-stories.test.ts +4 -2
- package/src/cli/commands/my-stories.ts +22 -27
- package/src/cli/commands/nuke.test.ts +1 -1
- package/src/cli/commands/pr.test.ts +10 -6
- package/src/cli/commands/pr.ts +41 -32
- package/src/cli/commands/progress.test.ts +1 -1
- package/src/cli/commands/progress.ts +11 -6
- package/src/cli/commands/req-headless.test.ts +170 -0
- package/src/cli/commands/req-spawn.test.ts +12 -2
- package/src/cli/commands/req.ts +13 -14
- package/src/cli/commands/resume.test.ts +1 -1
- package/src/cli/commands/resume.ts +7 -8
- package/src/cli/commands/status.test.ts +1 -1
- package/src/cli/commands/status.ts +52 -40
- package/src/cli/commands/stories.test.ts +4 -2
- package/src/cli/commands/stories.ts +11 -11
- package/src/cli/commands/teams.test.ts +2 -2
- package/src/cli/commands/teams.ts +11 -11
- package/src/cli/dashboard/index.test.ts +35 -34
- package/src/cli/dashboard/index.ts +34 -23
- package/src/cli/dashboard/panels/activity.ts +10 -4
- package/src/cli/dashboard/panels/agents.ts +8 -5
- package/src/cli/dashboard/panels/escalations.ts +4 -4
- package/src/cli/dashboard/panels/merge-queue.ts +4 -4
- package/src/cli/dashboard/panels/pipeline.ts +10 -4
- package/src/config/schema.ts +1 -0
- package/src/connectors/project-management/operations.ts +9 -10
- package/src/context-files/index.test.ts +1 -0
- package/src/db/client.ts +17 -0
- package/src/db/pg-migrations/001-full-schema.sql +209 -0
- package/src/db/postgres-provider.integration.test.ts +574 -0
- package/src/db/postgres-provider.test.ts +97 -0
- package/src/db/postgres-provider.ts +364 -0
- package/src/db/provider.test.ts +283 -0
- package/src/db/provider.ts +161 -0
- package/src/db/queries/agents.test.ts +114 -113
- package/src/db/queries/agents.ts +50 -36
- package/src/db/queries/escalations.test.ts +134 -133
- package/src/db/queries/escalations.ts +72 -57
- package/src/db/queries/heartbeat.test.ts +77 -78
- package/src/db/queries/heartbeat.ts +24 -46
- package/src/db/queries/integration-sync.ts +26 -26
- package/src/db/queries/logs.test.ts +151 -148
- package/src/db/queries/logs.ts +78 -53
- package/src/db/queries/messages.test.ts +48 -50
- package/src/db/queries/messages.ts +26 -18
- package/src/db/queries/pull-requests.test.ts +194 -199
- package/src/db/queries/pull-requests.ts +117 -88
- package/src/db/queries/requirements.test.ts +84 -83
- package/src/db/queries/requirements.ts +33 -28
- package/src/db/queries/stories.test.ts +173 -172
- package/src/db/queries/stories.ts +141 -110
- package/src/db/queries/teams.test.ts +37 -36
- package/src/db/queries/teams.ts +22 -14
- package/src/integrations/jira/repair.test.ts +27 -26
- package/src/integrations/jira/stories.test.ts +15 -16
- package/src/integrations/jira/stories.ts +15 -15
- package/src/integrations/jira/sync.test.ts +68 -68
- package/src/integrations/jira/sync.ts +29 -39
- package/src/integrations/jira/transitions.ts +6 -6
- package/src/orchestrator/agent-selector.ts +9 -8
- package/src/orchestrator/dependency-resolver.ts +16 -7
- package/src/orchestrator/feature-branch.test.ts +85 -80
- package/src/orchestrator/feature-branch.ts +13 -14
- package/src/orchestrator/orphan-recovery.ts +14 -13
- package/src/orchestrator/scheduler.test.ts +536 -394
- package/src/orchestrator/scheduler.ts +129 -115
- package/src/utils/auto-merge.test.ts +102 -68
- package/src/utils/auto-merge.ts +161 -168
- package/src/utils/cli-helpers.test.ts +30 -32
- package/src/utils/cli-helpers.ts +15 -11
- package/src/utils/paths.test.ts +1 -0
- package/src/utils/paths.ts +14 -1
- package/src/utils/pr-sync.test.ts +55 -52
- package/src/utils/pr-sync.ts +27 -32
- package/src/utils/with-hive-context.ts +89 -1
package/src/agents/senior.ts
CHANGED
|
@@ -16,14 +16,23 @@ export class SeniorAgent extends BaseAgent {
|
|
|
16
16
|
|
|
17
17
|
constructor(context: SeniorContext) {
|
|
18
18
|
super(context);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
private async init(context: SeniorContext): Promise<void> {
|
|
19
22
|
if (context.teamId) {
|
|
20
|
-
this.team = getTeamById(this.db, context.teamId) || null;
|
|
21
|
-
this.assignedStories = getStoriesByTeam(this.db, context.teamId).filter(s =>
|
|
23
|
+
this.team = (await getTeamById(this.db, context.teamId)) || null;
|
|
24
|
+
this.assignedStories = (await getStoriesByTeam(this.db, context.teamId)).filter(s =>
|
|
22
25
|
['planned', 'in_progress', 'review'].includes(s.status)
|
|
23
26
|
);
|
|
24
27
|
}
|
|
25
28
|
}
|
|
26
29
|
|
|
30
|
+
static async create(context: SeniorContext): Promise<SeniorAgent> {
|
|
31
|
+
const agent = new SeniorAgent(context);
|
|
32
|
+
await agent.init(context);
|
|
33
|
+
return agent;
|
|
34
|
+
}
|
|
35
|
+
|
|
27
36
|
getSystemPrompt(): string {
|
|
28
37
|
const teamInfo = this.team
|
|
29
38
|
? `Team: ${this.team.name}\nRepository: ${this.team.repo_url}\nPath: ${this.team.repo_path}`
|
|
@@ -65,11 +74,11 @@ ${this.memoryState.conversationSummary || 'Starting fresh.'}`;
|
|
|
65
74
|
|
|
66
75
|
async execute(): Promise<void> {
|
|
67
76
|
if (!this.team) {
|
|
68
|
-
this.log('CODEBASE_SWEEP_STARTED', 'No team assigned, waiting for assignment');
|
|
77
|
+
await this.log('CODEBASE_SWEEP_STARTED', 'No team assigned, waiting for assignment');
|
|
69
78
|
return;
|
|
70
79
|
}
|
|
71
80
|
|
|
72
|
-
this.log('CODEBASE_SWEEP_STARTED', `Analyzing codebase for ${this.team.name}`);
|
|
81
|
+
await this.log('CODEBASE_SWEEP_STARTED', `Analyzing codebase for ${this.team.name}`);
|
|
73
82
|
|
|
74
83
|
// Perform codebase sweep
|
|
75
84
|
await this.analyzeCodebase();
|
|
@@ -101,16 +110,16 @@ This will help with story estimation and implementation.`;
|
|
|
101
110
|
const analysis = await this.chat(prompt);
|
|
102
111
|
|
|
103
112
|
this.memoryState.context.codebaseNotes = analysis;
|
|
104
|
-
this.saveMemoryState();
|
|
113
|
+
await this.saveMemoryState();
|
|
105
114
|
|
|
106
|
-
this.log('CODEBASE_SWEEP_COMPLETED', 'Codebase analysis complete', {
|
|
115
|
+
await this.log('CODEBASE_SWEEP_COMPLETED', 'Codebase analysis complete', {
|
|
107
116
|
summary: analysis.substring(0, 200),
|
|
108
117
|
});
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
private async processStory(story: StoryRow): Promise<void> {
|
|
112
|
-
this.setCurrentTask(story.id, 'processing');
|
|
113
|
-
this.log('STORY_STARTED', `Processing story: ${story.title}`, { storyId: story.id });
|
|
121
|
+
await this.setCurrentTask(story.id, 'processing');
|
|
122
|
+
await this.log('STORY_STARTED', `Processing story: ${story.title}`, { storyId: story.id });
|
|
114
123
|
|
|
115
124
|
// Implement all stories directly - the Scheduler handles routing to appropriate agents
|
|
116
125
|
await this.implementStory(story);
|
|
@@ -118,7 +127,7 @@ This will help with story estimation and implementation.`;
|
|
|
118
127
|
|
|
119
128
|
private async implementStory(story: StoryRow): Promise<void> {
|
|
120
129
|
// Update assignment
|
|
121
|
-
updateStory(
|
|
130
|
+
await updateStory(
|
|
122
131
|
this.db,
|
|
123
132
|
story.id,
|
|
124
133
|
{
|
|
@@ -127,7 +136,7 @@ This will help with story estimation and implementation.`;
|
|
|
127
136
|
},
|
|
128
137
|
this.storiesDir
|
|
129
138
|
);
|
|
130
|
-
updateAgent(this.db, this.agentId, { currentStoryId: story.id });
|
|
139
|
+
await updateAgent(this.db, this.agentId, { currentStoryId: story.id });
|
|
131
140
|
|
|
132
141
|
// Create feature branch
|
|
133
142
|
const branchName = `feature/${story.id.toLowerCase()}-${story.title
|
|
@@ -135,7 +144,7 @@ This will help with story estimation and implementation.`;
|
|
|
135
144
|
.replace(/[^a-z0-9]+/g, '-')
|
|
136
145
|
.substring(0, 30)}`;
|
|
137
146
|
|
|
138
|
-
this.log('STORY_STARTED', `Implementing: ${story.title}`, { branchName });
|
|
147
|
+
await this.log('STORY_STARTED', `Implementing: ${story.title}`, { branchName });
|
|
139
148
|
|
|
140
149
|
const prompt = `Implement this story:
|
|
141
150
|
|
|
@@ -160,14 +169,14 @@ ${story.acceptance_criteria ? JSON.parse(story.acceptance_criteria).join('\n- ')
|
|
|
160
169
|
Let me know when you're ready to proceed or if you have questions.`;
|
|
161
170
|
|
|
162
171
|
const response = await this.chat(prompt);
|
|
163
|
-
this.updateTaskProgress('Implementation started', []);
|
|
172
|
+
await this.updateTaskProgress('Implementation started', []);
|
|
164
173
|
|
|
165
174
|
// Continue the conversation to complete implementation
|
|
166
175
|
// In a real scenario, this would be an iterative process
|
|
167
|
-
this.log('STORY_PROGRESS_UPDATE', response.substring(0, 200), { storyId: story.id });
|
|
176
|
+
await this.log('STORY_PROGRESS_UPDATE', response.substring(0, 200), { storyId: story.id });
|
|
168
177
|
|
|
169
178
|
// Mark for review when done (simplified)
|
|
170
|
-
updateStory(
|
|
179
|
+
await updateStory(
|
|
171
180
|
this.db,
|
|
172
181
|
story.id,
|
|
173
182
|
{
|
|
@@ -177,7 +186,7 @@ Let me know when you're ready to proceed or if you have questions.`;
|
|
|
177
186
|
this.storiesDir
|
|
178
187
|
);
|
|
179
188
|
|
|
180
|
-
this.log('STORY_COMPLETED', `Implementation complete, ready for review`, {
|
|
189
|
+
await this.log('STORY_COMPLETED', `Implementation complete, ready for review`, {
|
|
181
190
|
storyId: story.id,
|
|
182
191
|
branchName,
|
|
183
192
|
});
|
|
@@ -186,12 +195,16 @@ Let me know when you're ready to proceed or if you have questions.`;
|
|
|
186
195
|
private async reviewStory(story: StoryRow): Promise<void> {
|
|
187
196
|
if (story.assigned_agent_id === this.agentId) {
|
|
188
197
|
// Self-review, move to QA
|
|
189
|
-
updateStory(this.db, story.id, { status: 'qa' }, this.storiesDir);
|
|
190
|
-
this.log('STORY_REVIEW_REQUESTED', 'Self-implemented, moving to QA', {
|
|
198
|
+
await updateStory(this.db, story.id, { status: 'qa' }, this.storiesDir);
|
|
199
|
+
await this.log('STORY_REVIEW_REQUESTED', 'Self-implemented, moving to QA', {
|
|
200
|
+
storyId: story.id,
|
|
201
|
+
});
|
|
191
202
|
return;
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
this.log('STORY_REVIEW_REQUESTED', `Reviewing story: ${story.title}`, {
|
|
205
|
+
await this.log('STORY_REVIEW_REQUESTED', `Reviewing story: ${story.title}`, {
|
|
206
|
+
storyId: story.id,
|
|
207
|
+
});
|
|
195
208
|
|
|
196
209
|
const prompt = `Review the code for this story:
|
|
197
210
|
|
|
@@ -217,33 +230,35 @@ If issues found, describe them. If approved, confirm.`;
|
|
|
217
230
|
|
|
218
231
|
if (hasIssues) {
|
|
219
232
|
// Send back for fixes
|
|
220
|
-
updateStory(this.db, story.id, { status: 'in_progress' }, this.storiesDir);
|
|
221
|
-
this.log('STORY_PROGRESS_UPDATE', 'Review issues found, sent back for fixes', {
|
|
233
|
+
await updateStory(this.db, story.id, { status: 'in_progress' }, this.storiesDir);
|
|
234
|
+
await this.log('STORY_PROGRESS_UPDATE', 'Review issues found, sent back for fixes', {
|
|
222
235
|
storyId: story.id,
|
|
223
236
|
review: review.substring(0, 200),
|
|
224
237
|
});
|
|
225
238
|
} else {
|
|
226
239
|
// Approve and move to QA
|
|
227
|
-
updateStory(this.db, story.id, { status: 'qa' }, this.storiesDir);
|
|
228
|
-
this.log('STORY_REVIEW_REQUESTED', 'Review passed, moving to QA', {
|
|
240
|
+
await updateStory(this.db, story.id, { status: 'qa' }, this.storiesDir);
|
|
241
|
+
await this.log('STORY_REVIEW_REQUESTED', 'Review passed, moving to QA', {
|
|
242
|
+
storyId: story.id,
|
|
243
|
+
});
|
|
229
244
|
}
|
|
230
245
|
}
|
|
231
246
|
|
|
232
247
|
async escalateToTechLead(reason: string): Promise<void> {
|
|
233
|
-
const techLead = getTechLead(this.db);
|
|
248
|
+
const techLead = await getTechLead(this.db);
|
|
234
249
|
|
|
235
|
-
const escalation = createEscalation(this.db, {
|
|
250
|
+
const escalation = await createEscalation(this.db, {
|
|
236
251
|
storyId: this.memoryState.currentTask?.storyId,
|
|
237
252
|
fromAgentId: this.agentId,
|
|
238
253
|
toAgentId: techLead?.id,
|
|
239
254
|
reason,
|
|
240
255
|
});
|
|
241
256
|
|
|
242
|
-
this.log('ESCALATION_CREATED', reason, {
|
|
257
|
+
await this.log('ESCALATION_CREATED', reason, {
|
|
243
258
|
escalationId: escalation.id,
|
|
244
259
|
});
|
|
245
260
|
|
|
246
|
-
this.updateStatus('blocked');
|
|
247
|
-
this.addBlocker(`Escalated to Tech Lead: ${reason}`);
|
|
261
|
+
await this.updateStatus('blocked');
|
|
262
|
+
await this.addBlocker(`Escalated to Tech Lead: ${reason}`);
|
|
248
263
|
}
|
|
249
264
|
}
|
package/src/agents/tech-lead.ts
CHANGED
|
@@ -4,7 +4,6 @@ import { getCliRuntimeBuilder, resolveRuntimeModelForCli } from '../cli-runtimes
|
|
|
4
4
|
import { loadConfig } from '../config/index.js';
|
|
5
5
|
import type { HiveConfig } from '../config/schema.js';
|
|
6
6
|
import { syncRequirementToProvider } from '../connectors/project-management/operations.js';
|
|
7
|
-
import { queryAll } from '../db/client.js';
|
|
8
7
|
import { createAgent, getAgentsByType, updateAgent } from '../db/queries/agents.js';
|
|
9
8
|
import { createEscalation } from '../db/queries/escalations.js';
|
|
10
9
|
import {
|
|
@@ -37,13 +36,22 @@ export class TechLeadAgent extends BaseAgent {
|
|
|
37
36
|
constructor(context: TechLeadContext) {
|
|
38
37
|
super(context);
|
|
39
38
|
this.requirementId = context.requirementId;
|
|
40
|
-
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
private async init(): Promise<void> {
|
|
42
|
+
this.teams = await getAllTeams(this.db);
|
|
41
43
|
|
|
42
44
|
if (this.requirementId) {
|
|
43
|
-
this.requirement = getRequirementById(this.db, this.requirementId);
|
|
45
|
+
this.requirement = await getRequirementById(this.db, this.requirementId);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
46
48
|
|
|
49
|
+
static async create(context: TechLeadContext): Promise<TechLeadAgent> {
|
|
50
|
+
const agent = new TechLeadAgent(context);
|
|
51
|
+
await agent.init();
|
|
52
|
+
return agent;
|
|
53
|
+
}
|
|
54
|
+
|
|
47
55
|
getSystemPrompt(): string {
|
|
48
56
|
const teamList = this.teams.map(t => `- ${t.name} (${t.repo_path}): ${t.repo_url}`).join('\n');
|
|
49
57
|
|
|
@@ -88,11 +96,11 @@ ${this.getJiraInstructions()}`;
|
|
|
88
96
|
|
|
89
97
|
async execute(): Promise<void> {
|
|
90
98
|
if (!this.requirement) {
|
|
91
|
-
this.log('PLANNING_STARTED', 'Tech Lead ready, waiting for requirement');
|
|
99
|
+
await this.log('PLANNING_STARTED', 'Tech Lead ready, waiting for requirement');
|
|
92
100
|
return;
|
|
93
101
|
}
|
|
94
102
|
|
|
95
|
-
this.log('PLANNING_STARTED', `Analyzing requirement: ${this.requirement.title}`);
|
|
103
|
+
await this.log('PLANNING_STARTED', `Analyzing requirement: ${this.requirement.title}`);
|
|
96
104
|
|
|
97
105
|
// Analyze the requirement
|
|
98
106
|
const analysis = await this.analyzeRequirement();
|
|
@@ -113,8 +121,8 @@ ${this.getJiraInstructions()}`;
|
|
|
113
121
|
await this.coordinateWithSeniors(stories);
|
|
114
122
|
|
|
115
123
|
// Update requirement status
|
|
116
|
-
updateRequirement(this.db, this.requirement.id, { status: 'planned' });
|
|
117
|
-
this.log('PLANNING_COMPLETED', `Created ${stories.length} stories`);
|
|
124
|
+
await updateRequirement(this.db, this.requirement.id, { status: 'planned' });
|
|
125
|
+
await this.log('PLANNING_COMPLETED', `Created ${stories.length} stories`);
|
|
118
126
|
}
|
|
119
127
|
|
|
120
128
|
private async analyzeRequirement(): Promise<{
|
|
@@ -202,7 +210,7 @@ Respond in JSON format:
|
|
|
202
210
|
for (const story of analysis.stories) {
|
|
203
211
|
const team = this.teams.find(t => t.name === story.teamName);
|
|
204
212
|
|
|
205
|
-
const storyRow = createStory(
|
|
213
|
+
const storyRow = await createStory(
|
|
206
214
|
this.db,
|
|
207
215
|
{
|
|
208
216
|
requirementId: this.requirement!.id,
|
|
@@ -215,7 +223,7 @@ Respond in JSON format:
|
|
|
215
223
|
);
|
|
216
224
|
|
|
217
225
|
// Update with complexity
|
|
218
|
-
updateStory(
|
|
226
|
+
await updateStory(
|
|
219
227
|
this.db,
|
|
220
228
|
storyRow.id,
|
|
221
229
|
{
|
|
@@ -229,7 +237,7 @@ Respond in JSON format:
|
|
|
229
237
|
storyIds.push(storyRow.id);
|
|
230
238
|
storyIdMap[story.title] = storyRow.id;
|
|
231
239
|
|
|
232
|
-
this.log('STORY_CREATED', story.title, {
|
|
240
|
+
await this.log('STORY_CREATED', story.title, {
|
|
233
241
|
storyId: storyRow.id,
|
|
234
242
|
teamId: team?.id,
|
|
235
243
|
complexity: story.estimatedComplexity,
|
|
@@ -243,7 +251,7 @@ Respond in JSON format:
|
|
|
243
251
|
for (const depTitle of story.dependencies) {
|
|
244
252
|
const depId = storyIdMap[depTitle];
|
|
245
253
|
if (depId) {
|
|
246
|
-
addStoryDependency(this.db, storyId, depId);
|
|
254
|
+
await addStoryDependency(this.db, storyId, depId);
|
|
247
255
|
}
|
|
248
256
|
}
|
|
249
257
|
}
|
|
@@ -256,7 +264,7 @@ Respond in JSON format:
|
|
|
256
264
|
// Get unique teams from stories
|
|
257
265
|
const teamIds = new Set<string>();
|
|
258
266
|
for (const storyId of storyIds) {
|
|
259
|
-
const story = getStoryById(this.db, storyId);
|
|
267
|
+
const story = await getStoryById(this.db, storyId);
|
|
260
268
|
if (story?.team_id) {
|
|
261
269
|
teamIds.add(story.team_id);
|
|
262
270
|
}
|
|
@@ -268,11 +276,11 @@ Respond in JSON format:
|
|
|
268
276
|
if (!team) continue;
|
|
269
277
|
|
|
270
278
|
// Check if Senior already exists for this team
|
|
271
|
-
let seniors = getAgentsByType(this.db, 'senior').filter(s => s.team_id === teamId);
|
|
279
|
+
let seniors = (await getAgentsByType(this.db, 'senior')).filter(s => s.team_id === teamId);
|
|
272
280
|
|
|
273
281
|
if (seniors.length === 0) {
|
|
274
282
|
// Create a new Senior agent
|
|
275
|
-
const senior = createAgent(this.db, {
|
|
283
|
+
const senior = await createAgent(this.db, {
|
|
276
284
|
type: 'senior',
|
|
277
285
|
teamId,
|
|
278
286
|
});
|
|
@@ -306,19 +314,19 @@ Respond in JSON format:
|
|
|
306
314
|
commandArgs,
|
|
307
315
|
});
|
|
308
316
|
|
|
309
|
-
updateAgent(this.db, senior.id, {
|
|
317
|
+
await updateAgent(this.db, senior.id, {
|
|
310
318
|
tmuxSession: sessionName,
|
|
311
319
|
status: 'working',
|
|
312
320
|
});
|
|
313
321
|
|
|
314
|
-
this.log('AGENT_SPAWNED', `Senior spawned for team ${team.name}`, {
|
|
322
|
+
await this.log('AGENT_SPAWNED', `Senior spawned for team ${team.name}`, {
|
|
315
323
|
agentId: senior.id,
|
|
316
324
|
teamId,
|
|
317
325
|
tmuxSession: sessionName,
|
|
318
326
|
godmode: this.requirement?.godmode ? true : false,
|
|
319
327
|
});
|
|
320
328
|
} catch (err) {
|
|
321
|
-
this.log(
|
|
329
|
+
await this.log(
|
|
322
330
|
'AGENT_SPAWNED',
|
|
323
331
|
`Failed to spawn Senior tmux session: ${err instanceof Error ? err.message : 'Unknown error'}`,
|
|
324
332
|
{
|
|
@@ -331,8 +339,7 @@ Respond in JSON format:
|
|
|
331
339
|
}
|
|
332
340
|
|
|
333
341
|
// Assign stories to the Senior
|
|
334
|
-
const teamStories = queryAll<{ id: string }>(
|
|
335
|
-
this.db,
|
|
342
|
+
const teamStories = await this.db.queryAll<{ id: string }>(
|
|
336
343
|
`
|
|
337
344
|
SELECT id FROM stories WHERE team_id = ? AND status = 'estimated'
|
|
338
345
|
`,
|
|
@@ -340,8 +347,8 @@ Respond in JSON format:
|
|
|
340
347
|
);
|
|
341
348
|
|
|
342
349
|
for (const story of teamStories) {
|
|
343
|
-
updateStory(this.db, story.id, { status: 'planned' });
|
|
344
|
-
this.log('STORY_ASSIGNED', `Story ${story.id} assigned to team ${team.name}`, {
|
|
350
|
+
await updateStory(this.db, story.id, { status: 'planned' });
|
|
351
|
+
await this.log('STORY_ASSIGNED', `Story ${story.id} assigned to team ${team.name}`, {
|
|
345
352
|
storyId: story.id,
|
|
346
353
|
teamId,
|
|
347
354
|
});
|
|
@@ -378,13 +385,16 @@ Respond in JSON format:
|
|
|
378
385
|
|
|
379
386
|
// Re-fetch requirement from DB to pick up external_epic_key/id that may have
|
|
380
387
|
// been set after this agent was constructed (e.g., by `hive req <epic-url>`).
|
|
381
|
-
const freshRequirement = getRequirementById(this.db, this.requirement.id);
|
|
388
|
+
const freshRequirement = await getRequirementById(this.db, this.requirement.id);
|
|
382
389
|
if (!freshRequirement) return;
|
|
383
390
|
|
|
384
391
|
// Determine team name for labels
|
|
385
392
|
const teamName = this.teams.length > 0 ? this.teams[0].name : undefined;
|
|
386
393
|
|
|
387
|
-
this.log(
|
|
394
|
+
await this.log(
|
|
395
|
+
'JIRA_SYNC_STARTED',
|
|
396
|
+
`Syncing requirement ${freshRequirement.id} to PM provider`
|
|
397
|
+
);
|
|
388
398
|
|
|
389
399
|
try {
|
|
390
400
|
const result = await syncRequirementToProvider(
|
|
@@ -396,29 +406,29 @@ Respond in JSON format:
|
|
|
396
406
|
);
|
|
397
407
|
|
|
398
408
|
if (result.epicKey) {
|
|
399
|
-
this.log(
|
|
409
|
+
await this.log(
|
|
400
410
|
freshRequirement.external_epic_key ? 'JIRA_EPIC_INGESTED' : 'JIRA_EPIC_CREATED',
|
|
401
411
|
`Epic ${result.epicKey} ${freshRequirement.external_epic_key ? 'linked (existing)' : 'created'} for ${freshRequirement.id}`
|
|
402
412
|
);
|
|
403
413
|
}
|
|
404
414
|
|
|
405
415
|
for (const story of result.stories) {
|
|
406
|
-
this.log('JIRA_STORY_CREATED', `Issue ${story.key} created for ${story.storyId}`);
|
|
416
|
+
await this.log('JIRA_STORY_CREATED', `Issue ${story.key} created for ${story.storyId}`);
|
|
407
417
|
}
|
|
408
418
|
|
|
409
419
|
if (result.errors.length > 0) {
|
|
410
420
|
for (const error of result.errors) {
|
|
411
|
-
this.log('JIRA_SYNC_WARNING', error);
|
|
421
|
+
await this.log('JIRA_SYNC_WARNING', error);
|
|
412
422
|
}
|
|
413
423
|
}
|
|
414
424
|
|
|
415
|
-
this.log(
|
|
425
|
+
await this.log(
|
|
416
426
|
'JIRA_SYNC_COMPLETED',
|
|
417
427
|
`Synced ${result.stories.length}/${storyIds.length} stories to PM provider`
|
|
418
428
|
);
|
|
419
429
|
} catch (err) {
|
|
420
430
|
// Jira sync failure should not block the pipeline
|
|
421
|
-
this.log(
|
|
431
|
+
await this.log(
|
|
422
432
|
'JIRA_SYNC_WARNING',
|
|
423
433
|
`Jira sync failed: ${err instanceof Error ? err.message : String(err)}`
|
|
424
434
|
);
|
|
@@ -426,18 +436,18 @@ Respond in JSON format:
|
|
|
426
436
|
}
|
|
427
437
|
|
|
428
438
|
private async escalateToHuman(reason: string): Promise<void> {
|
|
429
|
-
const escalation = createEscalation(this.db, {
|
|
439
|
+
const escalation = await createEscalation(this.db, {
|
|
430
440
|
storyId: null,
|
|
431
441
|
fromAgentId: this.agentId,
|
|
432
442
|
toAgentId: null, // null = human
|
|
433
443
|
reason,
|
|
434
444
|
});
|
|
435
445
|
|
|
436
|
-
this.log('ESCALATION_CREATED', reason, {
|
|
446
|
+
await this.log('ESCALATION_CREATED', reason, {
|
|
437
447
|
escalationId: escalation.id,
|
|
438
448
|
});
|
|
439
449
|
|
|
440
|
-
this.updateStatus('blocked');
|
|
441
|
-
this.addBlocker(`Waiting for human input: ${reason}`);
|
|
450
|
+
await this.updateStatus('blocked');
|
|
451
|
+
await this.addBlocker(`Waiting for human input: ${reason}`);
|
|
442
452
|
}
|
|
443
453
|
}
|
|
@@ -15,7 +15,7 @@ vi.mock('../../db/queries/teams.js', () => ({
|
|
|
15
15
|
|
|
16
16
|
vi.mock('../../utils/with-hive-context.js', () => ({
|
|
17
17
|
withHiveContext: vi.fn(callback =>
|
|
18
|
-
callback({ db: { db: {} }, root: '/tmp', paths: { reposDir: '/tmp/repos' } })
|
|
18
|
+
callback({ db: { db: {}, provider: {} }, root: '/tmp', paths: { reposDir: '/tmp/repos' } })
|
|
19
19
|
),
|
|
20
20
|
}));
|
|
21
21
|
|
|
@@ -25,7 +25,7 @@ export const addRepoCommand = new Command('add-repo')
|
|
|
25
25
|
|
|
26
26
|
try {
|
|
27
27
|
// Check if team already exists
|
|
28
|
-
const existingTeam = getTeamByName(db.
|
|
28
|
+
const existingTeam = await getTeamByName(db.provider, options.team);
|
|
29
29
|
if (existingTeam) {
|
|
30
30
|
spinner.fail(chalk.red(`Team "${options.team}" already exists`));
|
|
31
31
|
process.exit(1);
|
|
@@ -61,7 +61,7 @@ export const addRepoCommand = new Command('add-repo')
|
|
|
61
61
|
|
|
62
62
|
// Create team in database
|
|
63
63
|
spinner.text = 'Creating team...';
|
|
64
|
-
const team = createTeam(db.
|
|
64
|
+
const team = await createTeam(db.provider, {
|
|
65
65
|
repoUrl: options.url,
|
|
66
66
|
repoPath: relativeRepoPath,
|
|
67
67
|
name: options.team,
|
|
@@ -30,9 +30,9 @@ vi.mock('../../git/worktree.js', () => ({
|
|
|
30
30
|
const mockSave = vi.fn();
|
|
31
31
|
vi.mock('../../utils/with-hive-context.js', () => ({
|
|
32
32
|
withHiveContext: vi.fn(callback =>
|
|
33
|
-
callback({ db: { db: {}, save: mockSave }, root: '/tmp/hive' })
|
|
33
|
+
callback({ db: { db: {}, provider: {}, save: mockSave }, root: '/tmp/hive' })
|
|
34
34
|
),
|
|
35
|
-
withReadOnlyHiveContext: vi.fn(callback => callback({ db: { db: {} } })),
|
|
35
|
+
withReadOnlyHiveContext: vi.fn(callback => callback({ db: { db: {}, provider: {} } })),
|
|
36
36
|
}));
|
|
37
37
|
|
|
38
38
|
import { getAgentByTmuxSession, updateAgent } from '../../db/queries/agents.js';
|
|
@@ -134,7 +134,7 @@ describe('agents command', () => {
|
|
|
134
134
|
};
|
|
135
135
|
|
|
136
136
|
it('should terminate agent and clean up worktree', async () => {
|
|
137
|
-
vi.mocked(getAgentByTmuxSession).
|
|
137
|
+
vi.mocked(getAgentByTmuxSession).mockResolvedValue(mockAgent);
|
|
138
138
|
|
|
139
139
|
await selfTerminate('hive-auditor-123');
|
|
140
140
|
|
|
@@ -156,7 +156,7 @@ describe('agents command', () => {
|
|
|
156
156
|
});
|
|
157
157
|
|
|
158
158
|
it('should skip worktree cleanup when no worktree exists', async () => {
|
|
159
|
-
vi.mocked(getAgentByTmuxSession).
|
|
159
|
+
vi.mocked(getAgentByTmuxSession).mockResolvedValue({
|
|
160
160
|
...mockAgent,
|
|
161
161
|
worktree_path: null,
|
|
162
162
|
});
|
|
@@ -172,7 +172,7 @@ describe('agents command', () => {
|
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
it('should handle already terminated agent gracefully', async () => {
|
|
175
|
-
vi.mocked(getAgentByTmuxSession).
|
|
175
|
+
vi.mocked(getAgentByTmuxSession).mockResolvedValue({
|
|
176
176
|
...mockAgent,
|
|
177
177
|
status: 'terminated' as const,
|
|
178
178
|
});
|
|
@@ -185,7 +185,7 @@ describe('agents command', () => {
|
|
|
185
185
|
});
|
|
186
186
|
|
|
187
187
|
it('should exit with error when agent not found', async () => {
|
|
188
|
-
vi.mocked(getAgentByTmuxSession).
|
|
188
|
+
vi.mocked(getAgentByTmuxSession).mockResolvedValue(undefined);
|
|
189
189
|
const mockExit = vi.spyOn(process, 'exit').mockImplementation(() => {
|
|
190
190
|
throw new Error('process.exit');
|
|
191
191
|
});
|
|
@@ -198,7 +198,7 @@ describe('agents command', () => {
|
|
|
198
198
|
});
|
|
199
199
|
|
|
200
200
|
it('should continue when worktree removal fails', async () => {
|
|
201
|
-
vi.mocked(getAgentByTmuxSession).
|
|
201
|
+
vi.mocked(getAgentByTmuxSession).mockResolvedValue(mockAgent);
|
|
202
202
|
vi.mocked(removeWorktree).mockReturnValue({
|
|
203
203
|
success: false,
|
|
204
204
|
error: 'worktree not found',
|
|
@@ -26,7 +26,9 @@ agentsCommand
|
|
|
26
26
|
.option('--json', 'Output as JSON')
|
|
27
27
|
.action(async (options: { active?: boolean; json?: boolean }) => {
|
|
28
28
|
await withReadOnlyHiveContext(async ({ db }) => {
|
|
29
|
-
const agents = options.active
|
|
29
|
+
const agents = options.active
|
|
30
|
+
? await getActiveAgents(db.provider)
|
|
31
|
+
: await getAllAgents(db.provider);
|
|
30
32
|
|
|
31
33
|
if (options.json) {
|
|
32
34
|
console.log(JSON.stringify(agents, null, 2));
|
|
@@ -67,9 +69,9 @@ agentsCommand
|
|
|
67
69
|
.option('--json', 'Output as JSON')
|
|
68
70
|
.action(async (agentId: string, options: { limit: string; json?: boolean }) => {
|
|
69
71
|
await withReadOnlyHiveContext(async ({ db }) => {
|
|
70
|
-
requireAgent(db.
|
|
72
|
+
await requireAgent(db.provider, agentId);
|
|
71
73
|
|
|
72
|
-
const logs = getLogsByAgent(db.
|
|
74
|
+
const logs = await getLogsByAgent(db.provider, agentId, parseInt(options.limit, 10));
|
|
73
75
|
|
|
74
76
|
if (options.json) {
|
|
75
77
|
console.log(JSON.stringify(logs, null, 2));
|
|
@@ -108,7 +110,7 @@ agentsCommand
|
|
|
108
110
|
.description('View detailed agent state')
|
|
109
111
|
.action(async (agentId: string) => {
|
|
110
112
|
await withReadOnlyHiveContext(async ({ db }) => {
|
|
111
|
-
const agent = requireAgent(db.
|
|
113
|
+
const agent = await requireAgent(db.provider, agentId);
|
|
112
114
|
|
|
113
115
|
console.log(chalk.bold(`\nAgent: ${agent.id}\n`));
|
|
114
116
|
console.log(chalk.gray(`Type: ${agent.type}`));
|
|
@@ -131,7 +133,7 @@ agentsCommand
|
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
// Show recent logs
|
|
134
|
-
const logs = getLogsByAgent(db.
|
|
136
|
+
const logs = await getLogsByAgent(db.provider, agentId, 5);
|
|
135
137
|
if (logs.length > 0) {
|
|
136
138
|
console.log(chalk.bold('\nRecent Activity:'));
|
|
137
139
|
for (const log of logs) {
|
|
@@ -150,7 +152,7 @@ agentsCommand
|
|
|
150
152
|
.option('--dry-run', 'Show what would be deleted without actually deleting')
|
|
151
153
|
.action(async (options: { dryRun?: boolean }) => {
|
|
152
154
|
await withHiveContext(async ({ root, db }) => {
|
|
153
|
-
const terminatedAgents = getAgentsByStatus(db.
|
|
155
|
+
const terminatedAgents = await getAgentsByStatus(db.provider, 'terminated');
|
|
154
156
|
|
|
155
157
|
if (terminatedAgents.length === 0) {
|
|
156
158
|
console.log(chalk.green('No terminated agents to clean up.'));
|
|
@@ -192,7 +194,7 @@ agentsCommand
|
|
|
192
194
|
}
|
|
193
195
|
}
|
|
194
196
|
|
|
195
|
-
deleteAgent(db.
|
|
197
|
+
await deleteAgent(db.provider, agent.id);
|
|
196
198
|
deleted++;
|
|
197
199
|
} catch (err) {
|
|
198
200
|
console.error(
|
|
@@ -229,7 +231,7 @@ agentsCommand
|
|
|
229
231
|
|
|
230
232
|
export async function selfTerminate(sessionName: string): Promise<void> {
|
|
231
233
|
await withHiveContext(async ({ root, db }) => {
|
|
232
|
-
const agent = getAgentByTmuxSession(db.
|
|
234
|
+
const agent = await getAgentByTmuxSession(db.provider, sessionName);
|
|
233
235
|
if (!agent) {
|
|
234
236
|
console.error(chalk.red(`No agent found for tmux session: ${sessionName}`));
|
|
235
237
|
process.exit(1);
|
|
@@ -251,13 +253,13 @@ export async function selfTerminate(sessionName: string): Promise<void> {
|
|
|
251
253
|
}
|
|
252
254
|
|
|
253
255
|
// Mark agent as terminated in DB
|
|
254
|
-
updateAgent(db.
|
|
256
|
+
await updateAgent(db.provider, agent.id, {
|
|
255
257
|
status: 'terminated',
|
|
256
258
|
currentStoryId: null,
|
|
257
259
|
});
|
|
258
260
|
|
|
259
261
|
// Log the self-termination event
|
|
260
|
-
createLog(db.
|
|
262
|
+
await createLog(db.provider, {
|
|
261
263
|
agentId: agent.id,
|
|
262
264
|
eventType: 'AGENT_TERMINATED',
|
|
263
265
|
message: `Agent self-terminated (session: ${sessionName})`,
|
|
@@ -18,10 +18,10 @@ export const approachCommand = new Command('approach')
|
|
|
18
18
|
const agentName = options.from || 'unknown-agent';
|
|
19
19
|
|
|
20
20
|
// Look up the story
|
|
21
|
-
const story = requireStory(db.
|
|
21
|
+
const story = await requireStory(db.provider, storyId);
|
|
22
22
|
|
|
23
23
|
// Log approach to agent_logs
|
|
24
|
-
createLog(db.
|
|
24
|
+
await createLog(db.provider, {
|
|
25
25
|
agentId: agentName,
|
|
26
26
|
storyId,
|
|
27
27
|
eventType: 'APPROACH_POSTED',
|
|
@@ -61,7 +61,7 @@ describe('approvals command', () => {
|
|
|
61
61
|
await fn({
|
|
62
62
|
root: '/tmp',
|
|
63
63
|
paths: {} as any,
|
|
64
|
-
db: { db: {} as any } as any,
|
|
64
|
+
db: { db: {} as any, provider: {} as any } as any,
|
|
65
65
|
});
|
|
66
66
|
});
|
|
67
67
|
});
|
|
@@ -69,7 +69,7 @@ describe('approvals command', () => {
|
|
|
69
69
|
it('list --json should return pending human approvals', async () => {
|
|
70
70
|
const run = getCommandAction('list');
|
|
71
71
|
const approvals = [sampleEscalation({ id: 'ESC-1' })];
|
|
72
|
-
vi.mocked(getPendingHumanEscalations).
|
|
72
|
+
vi.mocked(getPendingHumanEscalations).mockResolvedValue(approvals);
|
|
73
73
|
|
|
74
74
|
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
75
75
|
|
|
@@ -83,7 +83,7 @@ describe('approvals command', () => {
|
|
|
83
83
|
const run = getCommandAction('list');
|
|
84
84
|
const humanEsc = sampleEscalation({ id: 'ESC-HUMAN', to_agent_id: null });
|
|
85
85
|
const agentEsc = sampleEscalation({ id: 'ESC-AGENT', to_agent_id: 'hive-senior-alpha' });
|
|
86
|
-
vi.mocked(getAllEscalations).
|
|
86
|
+
vi.mocked(getAllEscalations).mockResolvedValue([humanEsc, agentEsc]);
|
|
87
87
|
|
|
88
88
|
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
89
89
|
|
|
@@ -95,7 +95,7 @@ describe('approvals command', () => {
|
|
|
95
95
|
|
|
96
96
|
it('list should print a friendly message when no pending approvals exist', async () => {
|
|
97
97
|
const run = getCommandAction('list');
|
|
98
|
-
vi.mocked(getPendingHumanEscalations).
|
|
98
|
+
vi.mocked(getPendingHumanEscalations).mockResolvedValue([]);
|
|
99
99
|
|
|
100
100
|
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
101
101
|
|
|
@@ -106,7 +106,7 @@ describe('approvals command', () => {
|
|
|
106
106
|
|
|
107
107
|
it('show should exit when escalation is not human-targeted', async () => {
|
|
108
108
|
const run = getCommandAction('show');
|
|
109
|
-
vi.mocked(getEscalationById).
|
|
109
|
+
vi.mocked(getEscalationById).mockResolvedValue(
|
|
110
110
|
sampleEscalation({ to_agent_id: 'hive-senior-alpha' })
|
|
111
111
|
);
|
|
112
112
|
|
|
@@ -127,7 +127,7 @@ describe('approvals command', () => {
|
|
|
127
127
|
|
|
128
128
|
it('approve should resolve escalation with APPROVED prefix', async () => {
|
|
129
129
|
const run = getCommandAction('approve');
|
|
130
|
-
vi.mocked(getEscalationById).
|
|
130
|
+
vi.mocked(getEscalationById).mockResolvedValue(sampleEscalation({ id: 'ESC-APPROVE' }));
|
|
131
131
|
|
|
132
132
|
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
133
133
|
|
|
@@ -143,7 +143,7 @@ describe('approvals command', () => {
|
|
|
143
143
|
|
|
144
144
|
it('approve should use default approval message when none is provided', async () => {
|
|
145
145
|
const run = getCommandAction('approve');
|
|
146
|
-
vi.mocked(getEscalationById).
|
|
146
|
+
vi.mocked(getEscalationById).mockResolvedValue(sampleEscalation({ id: 'ESC-DEFAULT' }));
|
|
147
147
|
|
|
148
148
|
await run('approve', 'ESC-DEFAULT');
|
|
149
149
|
|
|
@@ -156,7 +156,7 @@ describe('approvals command', () => {
|
|
|
156
156
|
|
|
157
157
|
it('deny should resolve escalation with DENIED prefix', async () => {
|
|
158
158
|
const run = getCommandAction('deny');
|
|
159
|
-
vi.mocked(getEscalationById).
|
|
159
|
+
vi.mocked(getEscalationById).mockResolvedValue(sampleEscalation({ id: 'ESC-DENY' }));
|
|
160
160
|
|
|
161
161
|
const logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
162
162
|
|