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
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { Database } from 'sql.js';
|
|
4
3
|
import initSqlJs from 'sql.js';
|
|
5
4
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
6
5
|
|
|
7
6
|
import type { HiveConfig } from '../config/schema.js';
|
|
7
|
+
import { SqliteProvider } from '../db/provider.js';
|
|
8
8
|
import { getLogsByEventType } from '../db/queries/logs.js';
|
|
9
9
|
import {
|
|
10
10
|
createRequirement,
|
|
@@ -125,7 +125,7 @@ CREATE TABLE IF NOT EXISTS requirements (
|
|
|
125
125
|
);
|
|
126
126
|
`;
|
|
127
127
|
|
|
128
|
-
let db:
|
|
128
|
+
let db: SqliteProvider;
|
|
129
129
|
|
|
130
130
|
const mockHiveConfigWithE2E: HiveConfig = {
|
|
131
131
|
e2e_tests: { path: './e2e' },
|
|
@@ -135,10 +135,11 @@ const mockHiveConfigWithoutE2E: HiveConfig = {} as HiveConfig;
|
|
|
135
135
|
|
|
136
136
|
beforeEach(async () => {
|
|
137
137
|
const SQL = await initSqlJs();
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
138
|
+
const rawDb = new SQL.Database();
|
|
139
|
+
rawDb.run('PRAGMA foreign_keys = ON');
|
|
140
|
+
rawDb.run(INITIAL_MIGRATION);
|
|
141
|
+
rawDb.run("INSERT INTO migrations (name) VALUES ('001-initial.sql')");
|
|
142
|
+
db = new SqliteProvider(rawDb);
|
|
142
143
|
vi.clearAllMocks();
|
|
143
144
|
});
|
|
144
145
|
|
|
@@ -167,46 +168,46 @@ describe('requiresFeatureBranch', () => {
|
|
|
167
168
|
});
|
|
168
169
|
|
|
169
170
|
describe('isEligibleForFeatureBranch', () => {
|
|
170
|
-
it('should return true for planned requirement with e2e_tests and no feature branch', () => {
|
|
171
|
-
const req = createRequirement(db, {
|
|
171
|
+
it('should return true for planned requirement with e2e_tests and no feature branch', async () => {
|
|
172
|
+
const req = await createRequirement(db, {
|
|
172
173
|
title: 'Test',
|
|
173
174
|
description: 'Test req',
|
|
174
175
|
});
|
|
175
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
176
|
-
const updated = getRequirementById(db, req.id)!;
|
|
176
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
177
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
177
178
|
|
|
178
179
|
expect(isEligibleForFeatureBranch(updated, mockHiveConfigWithE2E)).toBe(true);
|
|
179
180
|
});
|
|
180
181
|
|
|
181
|
-
it('should return false when requirement already has a feature branch', () => {
|
|
182
|
-
const req = createRequirement(db, {
|
|
182
|
+
it('should return false when requirement already has a feature branch', async () => {
|
|
183
|
+
const req = await createRequirement(db, {
|
|
183
184
|
title: 'Test',
|
|
184
185
|
description: 'Test req',
|
|
185
186
|
});
|
|
186
|
-
updateRequirement(db, req.id, { status: 'planned', featureBranch: 'feature/REQ-123' });
|
|
187
|
-
const updated = getRequirementById(db, req.id)!;
|
|
187
|
+
await updateRequirement(db, req.id, { status: 'planned', featureBranch: 'feature/REQ-123' });
|
|
188
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
188
189
|
|
|
189
190
|
expect(isEligibleForFeatureBranch(updated, mockHiveConfigWithE2E)).toBe(false);
|
|
190
191
|
});
|
|
191
192
|
|
|
192
|
-
it('should return false when requirement is not in planned status', () => {
|
|
193
|
-
const req = createRequirement(db, {
|
|
193
|
+
it('should return false when requirement is not in planned status', async () => {
|
|
194
|
+
const req = await createRequirement(db, {
|
|
194
195
|
title: 'Test',
|
|
195
196
|
description: 'Test req',
|
|
196
197
|
});
|
|
197
|
-
updateRequirement(db, req.id, { status: 'in_progress' });
|
|
198
|
-
const updated = getRequirementById(db, req.id)!;
|
|
198
|
+
await updateRequirement(db, req.id, { status: 'in_progress' });
|
|
199
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
199
200
|
|
|
200
201
|
expect(isEligibleForFeatureBranch(updated, mockHiveConfigWithE2E)).toBe(false);
|
|
201
202
|
});
|
|
202
203
|
|
|
203
|
-
it('should return false when e2e_tests is not configured', () => {
|
|
204
|
-
const req = createRequirement(db, {
|
|
204
|
+
it('should return false when e2e_tests is not configured', async () => {
|
|
205
|
+
const req = await createRequirement(db, {
|
|
205
206
|
title: 'Test',
|
|
206
207
|
description: 'Test req',
|
|
207
208
|
});
|
|
208
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
209
|
-
const updated = getRequirementById(db, req.id)!;
|
|
209
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
210
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
210
211
|
|
|
211
212
|
expect(isEligibleForFeatureBranch(updated, mockHiveConfigWithoutE2E)).toBe(false);
|
|
212
213
|
});
|
|
@@ -217,11 +218,11 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
217
218
|
const { execa } = await import('execa');
|
|
218
219
|
const mockExeca = vi.mocked(execa);
|
|
219
220
|
|
|
220
|
-
const req = createRequirement(db, {
|
|
221
|
+
const req = await createRequirement(db, {
|
|
221
222
|
title: 'Test Feature',
|
|
222
223
|
description: 'Test feature req',
|
|
223
224
|
});
|
|
224
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
225
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
225
226
|
|
|
226
227
|
const saveFn = vi.fn();
|
|
227
228
|
const result = await createRequirementFeatureBranch(db, '/tmp/repo', req.id, saveFn);
|
|
@@ -242,7 +243,7 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
242
243
|
);
|
|
243
244
|
|
|
244
245
|
// Verify requirement was updated
|
|
245
|
-
const updated = getRequirementById(db, req.id)!;
|
|
246
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
246
247
|
expect(updated.feature_branch).toBe(`feature/${req.id}`);
|
|
247
248
|
expect(updated.target_branch).toBe(`feature/${req.id}`);
|
|
248
249
|
expect(updated.status).toBe('in_progress');
|
|
@@ -251,7 +252,7 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
251
252
|
expect(saveFn).toHaveBeenCalled();
|
|
252
253
|
|
|
253
254
|
// Verify log was created
|
|
254
|
-
const logs = getLogsByEventType(db, 'FEATURE_BRANCH_CREATED');
|
|
255
|
+
const logs = await getLogsByEventType(db, 'FEATURE_BRANCH_CREATED');
|
|
255
256
|
expect(logs.length).toBe(1);
|
|
256
257
|
expect(logs[0].message).toContain(req.id);
|
|
257
258
|
});
|
|
@@ -261,7 +262,7 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
261
262
|
|
|
262
263
|
expect(result).toBeNull();
|
|
263
264
|
|
|
264
|
-
const logs = getLogsByEventType(db, 'FEATURE_BRANCH_FAILED');
|
|
265
|
+
const logs = await getLogsByEventType(db, 'FEATURE_BRANCH_FAILED');
|
|
265
266
|
expect(logs.length).toBe(1);
|
|
266
267
|
expect(logs[0].message).toContain('not found');
|
|
267
268
|
});
|
|
@@ -273,23 +274,23 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
273
274
|
mockExeca.mockRejectedValueOnce(new Error('fetch failed')); // fetch (non-fatal)
|
|
274
275
|
mockExeca.mockRejectedValueOnce(new Error('branch already exists'));
|
|
275
276
|
|
|
276
|
-
const req = createRequirement(db, {
|
|
277
|
+
const req = await createRequirement(db, {
|
|
277
278
|
title: 'Test',
|
|
278
279
|
description: 'Test req',
|
|
279
280
|
});
|
|
280
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
281
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
281
282
|
|
|
282
283
|
const result = await createRequirementFeatureBranch(db, '/tmp/repo', req.id);
|
|
283
284
|
|
|
284
285
|
expect(result).toBeNull();
|
|
285
286
|
|
|
286
287
|
// Requirement should still transition to in_progress as a fallback
|
|
287
|
-
const updated = getRequirementById(db, req.id)!;
|
|
288
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
288
289
|
expect(updated.status).toBe('in_progress');
|
|
289
290
|
// feature_branch should NOT be set on failure
|
|
290
291
|
expect(updated.feature_branch).toBeNull();
|
|
291
292
|
|
|
292
|
-
const logs = getLogsByEventType(db, 'FEATURE_BRANCH_FAILED');
|
|
293
|
+
const logs = await getLogsByEventType(db, 'FEATURE_BRANCH_FAILED');
|
|
293
294
|
expect(logs.length).toBe(1);
|
|
294
295
|
});
|
|
295
296
|
|
|
@@ -302,11 +303,11 @@ describe('createRequirementFeatureBranch', () => {
|
|
|
302
303
|
mockExeca.mockResolvedValueOnce({ stdout: '', stderr: '' } as any);
|
|
303
304
|
mockExeca.mockResolvedValueOnce({ stdout: '', stderr: '' } as any);
|
|
304
305
|
|
|
305
|
-
const req = createRequirement(db, {
|
|
306
|
+
const req = await createRequirement(db, {
|
|
306
307
|
title: 'Test',
|
|
307
308
|
description: 'Test req',
|
|
308
309
|
});
|
|
309
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
310
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
310
311
|
|
|
311
312
|
const result = await createRequirementFeatureBranch(db, '/tmp/repo', req.id);
|
|
312
313
|
|
|
@@ -318,16 +319,16 @@ describe('createFeatureBranchPR', () => {
|
|
|
318
319
|
it('should create PR from feature branch to main', async () => {
|
|
319
320
|
const { createPullRequest } = await import('../git/github.js');
|
|
320
321
|
|
|
321
|
-
const req = createRequirement(db, {
|
|
322
|
+
const req = await createRequirement(db, {
|
|
322
323
|
title: 'Test Feature',
|
|
323
324
|
description: 'Test feature req',
|
|
324
325
|
});
|
|
325
|
-
updateRequirement(db, req.id, {
|
|
326
|
+
await updateRequirement(db, req.id, {
|
|
326
327
|
status: 'sign_off_passed',
|
|
327
328
|
featureBranch: `feature/${req.id}`,
|
|
328
329
|
});
|
|
329
330
|
|
|
330
|
-
const updated = getRequirementById(db, req.id)!;
|
|
331
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
331
332
|
const result = await createFeatureBranchPR('/tmp/repo', updated);
|
|
332
333
|
|
|
333
334
|
expect(result).not.toBeNull();
|
|
@@ -343,11 +344,11 @@ describe('createFeatureBranchPR', () => {
|
|
|
343
344
|
});
|
|
344
345
|
|
|
345
346
|
it('should return null when requirement has no feature branch', async () => {
|
|
346
|
-
const req = createRequirement(db, {
|
|
347
|
+
const req = await createRequirement(db, {
|
|
347
348
|
title: 'Test',
|
|
348
349
|
description: 'Test req',
|
|
349
350
|
});
|
|
350
|
-
const updated = getRequirementById(db, req.id)!;
|
|
351
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
351
352
|
|
|
352
353
|
const result = await createFeatureBranchPR('/tmp/repo', updated);
|
|
353
354
|
expect(result).toBeNull();
|
|
@@ -357,121 +358,125 @@ describe('createFeatureBranchPR', () => {
|
|
|
357
358
|
const { createPullRequest } = await import('../git/github.js');
|
|
358
359
|
vi.mocked(createPullRequest).mockRejectedValueOnce(new Error('PR creation failed'));
|
|
359
360
|
|
|
360
|
-
const req = createRequirement(db, {
|
|
361
|
+
const req = await createRequirement(db, {
|
|
361
362
|
title: 'Test',
|
|
362
363
|
description: 'Test req',
|
|
363
364
|
featureBranch: 'feature/REQ-TEST',
|
|
364
365
|
});
|
|
365
366
|
|
|
366
|
-
const updated = getRequirementById(db, req.id)!;
|
|
367
|
+
const updated = (await getRequirementById(db, req.id))!;
|
|
367
368
|
const result = await createFeatureBranchPR('/tmp/repo', updated);
|
|
368
369
|
expect(result).toBeNull();
|
|
369
370
|
});
|
|
370
371
|
});
|
|
371
372
|
|
|
372
373
|
describe('getRequirementsNeedingFeatureBranch', () => {
|
|
373
|
-
it('should return requirement IDs for stories with eligible requirements', () => {
|
|
374
|
-
const team = createTeam(db, {
|
|
374
|
+
it('should return requirement IDs for stories with eligible requirements', async () => {
|
|
375
|
+
const team = await createTeam(db, {
|
|
375
376
|
name: 'Test Team',
|
|
376
377
|
repoUrl: 'https://github.com/test/repo',
|
|
377
378
|
repoPath: 'test',
|
|
378
379
|
});
|
|
379
380
|
|
|
380
|
-
const req = createRequirement(db, {
|
|
381
|
+
const req = await createRequirement(db, {
|
|
381
382
|
title: 'Test',
|
|
382
383
|
description: 'Test req',
|
|
383
384
|
});
|
|
384
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
385
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
385
386
|
|
|
386
|
-
const story = createStory(db, {
|
|
387
|
+
const story = await createStory(db, {
|
|
387
388
|
teamId: team.id,
|
|
388
389
|
title: 'Story 1',
|
|
389
390
|
description: 'Test',
|
|
390
391
|
requirementId: req.id,
|
|
391
392
|
});
|
|
392
393
|
|
|
393
|
-
const result = getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
394
|
+
const result = await getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
394
395
|
|
|
395
396
|
expect(result).toEqual([req.id]);
|
|
396
397
|
});
|
|
397
398
|
|
|
398
|
-
it('should not return requirements that already have feature branches', () => {
|
|
399
|
-
const team = createTeam(db, {
|
|
399
|
+
it('should not return requirements that already have feature branches', async () => {
|
|
400
|
+
const team = await createTeam(db, {
|
|
400
401
|
name: 'Test Team',
|
|
401
402
|
repoUrl: 'https://github.com/test/repo',
|
|
402
403
|
repoPath: 'test',
|
|
403
404
|
});
|
|
404
405
|
|
|
405
|
-
const req = createRequirement(db, {
|
|
406
|
+
const req = await createRequirement(db, {
|
|
406
407
|
title: 'Test',
|
|
407
408
|
description: 'Test req',
|
|
408
409
|
});
|
|
409
|
-
updateRequirement(db, req.id, { status: 'planned', featureBranch: 'feature/REQ-123' });
|
|
410
|
+
await updateRequirement(db, req.id, { status: 'planned', featureBranch: 'feature/REQ-123' });
|
|
410
411
|
|
|
411
|
-
const story = createStory(db, {
|
|
412
|
+
const story = await createStory(db, {
|
|
412
413
|
teamId: team.id,
|
|
413
414
|
title: 'Story 1',
|
|
414
415
|
description: 'Test',
|
|
415
416
|
requirementId: req.id,
|
|
416
417
|
});
|
|
417
418
|
|
|
418
|
-
const result = getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
419
|
+
const result = await getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
419
420
|
|
|
420
421
|
expect(result).toEqual([]);
|
|
421
422
|
});
|
|
422
423
|
|
|
423
|
-
it('should return empty array when e2e_tests is not configured', () => {
|
|
424
|
-
const team = createTeam(db, {
|
|
424
|
+
it('should return empty array when e2e_tests is not configured', async () => {
|
|
425
|
+
const team = await createTeam(db, {
|
|
425
426
|
name: 'Test Team',
|
|
426
427
|
repoUrl: 'https://github.com/test/repo',
|
|
427
428
|
repoPath: 'test',
|
|
428
429
|
});
|
|
429
430
|
|
|
430
|
-
const req = createRequirement(db, {
|
|
431
|
+
const req = await createRequirement(db, {
|
|
431
432
|
title: 'Test',
|
|
432
433
|
description: 'Test req',
|
|
433
434
|
});
|
|
434
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
435
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
435
436
|
|
|
436
|
-
const story = createStory(db, {
|
|
437
|
+
const story = await createStory(db, {
|
|
437
438
|
teamId: team.id,
|
|
438
439
|
title: 'Story 1',
|
|
439
440
|
description: 'Test',
|
|
440
441
|
requirementId: req.id,
|
|
441
442
|
});
|
|
442
443
|
|
|
443
|
-
const result = getRequirementsNeedingFeatureBranch(
|
|
444
|
+
const result = await getRequirementsNeedingFeatureBranch(
|
|
445
|
+
db,
|
|
446
|
+
[story.id],
|
|
447
|
+
mockHiveConfigWithoutE2E
|
|
448
|
+
);
|
|
444
449
|
|
|
445
450
|
expect(result).toEqual([]);
|
|
446
451
|
});
|
|
447
452
|
|
|
448
|
-
it('should deduplicate requirements from multiple stories', () => {
|
|
449
|
-
const team = createTeam(db, {
|
|
453
|
+
it('should deduplicate requirements from multiple stories', async () => {
|
|
454
|
+
const team = await createTeam(db, {
|
|
450
455
|
name: 'Test Team',
|
|
451
456
|
repoUrl: 'https://github.com/test/repo',
|
|
452
457
|
repoPath: 'test',
|
|
453
458
|
});
|
|
454
459
|
|
|
455
|
-
const req = createRequirement(db, {
|
|
460
|
+
const req = await createRequirement(db, {
|
|
456
461
|
title: 'Test',
|
|
457
462
|
description: 'Test req',
|
|
458
463
|
});
|
|
459
|
-
updateRequirement(db, req.id, { status: 'planned' });
|
|
464
|
+
await updateRequirement(db, req.id, { status: 'planned' });
|
|
460
465
|
|
|
461
|
-
const story1 = createStory(db, {
|
|
466
|
+
const story1 = await createStory(db, {
|
|
462
467
|
teamId: team.id,
|
|
463
468
|
title: 'Story 1',
|
|
464
469
|
description: 'Test',
|
|
465
470
|
requirementId: req.id,
|
|
466
471
|
});
|
|
467
|
-
const story2 = createStory(db, {
|
|
472
|
+
const story2 = await createStory(db, {
|
|
468
473
|
teamId: team.id,
|
|
469
474
|
title: 'Story 2',
|
|
470
475
|
description: 'Test',
|
|
471
476
|
requirementId: req.id,
|
|
472
477
|
});
|
|
473
478
|
|
|
474
|
-
const result = getRequirementsNeedingFeatureBranch(
|
|
479
|
+
const result = await getRequirementsNeedingFeatureBranch(
|
|
475
480
|
db,
|
|
476
481
|
[story1.id, story2.id],
|
|
477
482
|
mockHiveConfigWithE2E
|
|
@@ -481,62 +486,62 @@ describe('getRequirementsNeedingFeatureBranch', () => {
|
|
|
481
486
|
expect(result).toEqual([req.id]);
|
|
482
487
|
});
|
|
483
488
|
|
|
484
|
-
it('should return empty array for empty story list', () => {
|
|
485
|
-
const result = getRequirementsNeedingFeatureBranch(db, [], mockHiveConfigWithE2E);
|
|
489
|
+
it('should return empty array for empty story list', async () => {
|
|
490
|
+
const result = await getRequirementsNeedingFeatureBranch(db, [], mockHiveConfigWithE2E);
|
|
486
491
|
expect(result).toEqual([]);
|
|
487
492
|
});
|
|
488
493
|
|
|
489
|
-
it('should skip stories without requirement_id', () => {
|
|
490
|
-
const team = createTeam(db, {
|
|
494
|
+
it('should skip stories without requirement_id', async () => {
|
|
495
|
+
const team = await createTeam(db, {
|
|
491
496
|
name: 'Test Team',
|
|
492
497
|
repoUrl: 'https://github.com/test/repo',
|
|
493
498
|
repoPath: 'test',
|
|
494
499
|
});
|
|
495
500
|
|
|
496
|
-
const story = createStory(db, {
|
|
501
|
+
const story = await createStory(db, {
|
|
497
502
|
teamId: team.id,
|
|
498
503
|
title: 'Story without requirement',
|
|
499
504
|
description: 'Test',
|
|
500
505
|
});
|
|
501
506
|
|
|
502
|
-
const result = getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
507
|
+
const result = await getRequirementsNeedingFeatureBranch(db, [story.id], mockHiveConfigWithE2E);
|
|
503
508
|
|
|
504
509
|
expect(result).toEqual([]);
|
|
505
510
|
});
|
|
506
511
|
|
|
507
|
-
it('should handle multiple requirements from different stories', () => {
|
|
508
|
-
const team = createTeam(db, {
|
|
512
|
+
it('should handle multiple requirements from different stories', async () => {
|
|
513
|
+
const team = await createTeam(db, {
|
|
509
514
|
name: 'Test Team',
|
|
510
515
|
repoUrl: 'https://github.com/test/repo',
|
|
511
516
|
repoPath: 'test',
|
|
512
517
|
});
|
|
513
518
|
|
|
514
|
-
const req1 = createRequirement(db, {
|
|
519
|
+
const req1 = await createRequirement(db, {
|
|
515
520
|
title: 'Req 1',
|
|
516
521
|
description: 'Test req 1',
|
|
517
522
|
});
|
|
518
|
-
updateRequirement(db, req1.id, { status: 'planned' });
|
|
523
|
+
await updateRequirement(db, req1.id, { status: 'planned' });
|
|
519
524
|
|
|
520
|
-
const req2 = createRequirement(db, {
|
|
525
|
+
const req2 = await createRequirement(db, {
|
|
521
526
|
title: 'Req 2',
|
|
522
527
|
description: 'Test req 2',
|
|
523
528
|
});
|
|
524
|
-
updateRequirement(db, req2.id, { status: 'planned' });
|
|
529
|
+
await updateRequirement(db, req2.id, { status: 'planned' });
|
|
525
530
|
|
|
526
|
-
const story1 = createStory(db, {
|
|
531
|
+
const story1 = await createStory(db, {
|
|
527
532
|
teamId: team.id,
|
|
528
533
|
title: 'Story 1',
|
|
529
534
|
description: 'Test',
|
|
530
535
|
requirementId: req1.id,
|
|
531
536
|
});
|
|
532
|
-
const story2 = createStory(db, {
|
|
537
|
+
const story2 = await createStory(db, {
|
|
533
538
|
teamId: team.id,
|
|
534
539
|
title: 'Story 2',
|
|
535
540
|
description: 'Test',
|
|
536
541
|
requirementId: req2.id,
|
|
537
542
|
});
|
|
538
543
|
|
|
539
|
-
const result = getRequirementsNeedingFeatureBranch(
|
|
544
|
+
const result = await getRequirementsNeedingFeatureBranch(
|
|
540
545
|
db,
|
|
541
546
|
[story1.id, story2.id],
|
|
542
547
|
mockHiveConfigWithE2E
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
3
|
import { execa } from 'execa';
|
|
4
|
-
import type { Database } from 'sql.js';
|
|
5
4
|
import type { HiveConfig } from '../config/schema.js';
|
|
6
|
-
import {
|
|
5
|
+
import type { DatabaseProvider } from '../db/provider.js';
|
|
7
6
|
import { createLog } from '../db/queries/logs.js';
|
|
8
7
|
import {
|
|
9
8
|
getRequirementById,
|
|
@@ -59,14 +58,14 @@ export function isEligibleForFeatureBranch(
|
|
|
59
58
|
* @returns The feature branch name, or null if creation failed
|
|
60
59
|
*/
|
|
61
60
|
export async function createRequirementFeatureBranch(
|
|
62
|
-
db:
|
|
61
|
+
db: DatabaseProvider,
|
|
63
62
|
repoPath: string,
|
|
64
63
|
requirementId: string,
|
|
65
64
|
saveFn?: () => void
|
|
66
65
|
): Promise<string | null> {
|
|
67
|
-
const requirement = getRequirementById(db, requirementId);
|
|
66
|
+
const requirement = await getRequirementById(db, requirementId);
|
|
68
67
|
if (!requirement) {
|
|
69
|
-
createLog(db, {
|
|
68
|
+
await createLog(db, {
|
|
70
69
|
agentId: 'scheduler',
|
|
71
70
|
eventType: 'FEATURE_BRANCH_FAILED',
|
|
72
71
|
status: 'error',
|
|
@@ -101,7 +100,7 @@ export async function createRequirementFeatureBranch(
|
|
|
101
100
|
});
|
|
102
101
|
|
|
103
102
|
// Update the requirement with the feature branch info
|
|
104
|
-
updateRequirement(db, requirementId, {
|
|
103
|
+
await updateRequirement(db, requirementId, {
|
|
105
104
|
featureBranch,
|
|
106
105
|
targetBranch: featureBranch,
|
|
107
106
|
status: 'in_progress',
|
|
@@ -109,7 +108,7 @@ export async function createRequirementFeatureBranch(
|
|
|
109
108
|
|
|
110
109
|
if (saveFn) saveFn();
|
|
111
110
|
|
|
112
|
-
createLog(db, {
|
|
111
|
+
await createLog(db, {
|
|
113
112
|
agentId: 'scheduler',
|
|
114
113
|
eventType: 'FEATURE_BRANCH_CREATED',
|
|
115
114
|
message: `Created feature branch ${featureBranch} for requirement ${requirementId}`,
|
|
@@ -120,7 +119,7 @@ export async function createRequirementFeatureBranch(
|
|
|
120
119
|
} catch (err) {
|
|
121
120
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
122
121
|
|
|
123
|
-
createLog(db, {
|
|
122
|
+
await createLog(db, {
|
|
124
123
|
agentId: 'scheduler',
|
|
125
124
|
eventType: 'FEATURE_BRANCH_FAILED',
|
|
126
125
|
status: 'error',
|
|
@@ -130,7 +129,7 @@ export async function createRequirementFeatureBranch(
|
|
|
130
129
|
|
|
131
130
|
// Still transition requirement to in_progress even if branch creation fails,
|
|
132
131
|
// but without the feature branch. Stories will target main as fallback.
|
|
133
|
-
updateRequirement(db, requirementId, { status: 'in_progress' });
|
|
132
|
+
await updateRequirement(db, requirementId, { status: 'in_progress' });
|
|
134
133
|
if (saveFn) saveFn();
|
|
135
134
|
|
|
136
135
|
return null;
|
|
@@ -170,22 +169,22 @@ export async function createFeatureBranchPR(
|
|
|
170
169
|
* Returns requirement IDs for stories being assigned where the requirement
|
|
171
170
|
* is in 'planned' status and doesn't have a feature branch yet.
|
|
172
171
|
*/
|
|
173
|
-
export function getRequirementsNeedingFeatureBranch(
|
|
174
|
-
db:
|
|
172
|
+
export async function getRequirementsNeedingFeatureBranch(
|
|
173
|
+
db: DatabaseProvider,
|
|
175
174
|
storyIds: string[],
|
|
176
175
|
hiveConfig: HiveConfig | undefined
|
|
177
|
-
): string[] {
|
|
176
|
+
): Promise<string[]> {
|
|
178
177
|
if (!requiresFeatureBranch(hiveConfig)) return [];
|
|
179
178
|
if (storyIds.length === 0) return [];
|
|
180
179
|
|
|
181
180
|
const requirementIds = new Set<string>();
|
|
182
181
|
|
|
183
182
|
for (const storyId of storyIds) {
|
|
184
|
-
const stories = queryAll<StoryRow>(
|
|
183
|
+
const stories = await db.queryAll<StoryRow>('SELECT * FROM stories WHERE id = ?', [storyId]);
|
|
185
184
|
const story = stories[0];
|
|
186
185
|
if (!story?.requirement_id) continue;
|
|
187
186
|
|
|
188
|
-
const requirement = getRequirementById(db, story.requirement_id);
|
|
187
|
+
const requirement = await getRequirementById(db, story.requirement_id);
|
|
189
188
|
if (!requirement) continue;
|
|
190
189
|
|
|
191
190
|
if (isEligibleForFeatureBranch(requirement, hiveConfig)) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { Database } from 'sql.js';
|
|
4
3
|
import { syncStatusForStory } from '../connectors/project-management/operations.js';
|
|
4
|
+
import type { DatabaseProvider } from '../db/provider.js';
|
|
5
5
|
import { createLog } from '../db/queries/logs.js';
|
|
6
6
|
import {
|
|
7
7
|
getInProgressStoriesWithInconsistentAssignments,
|
|
@@ -14,14 +14,15 @@ import {
|
|
|
14
14
|
* Detect and recover orphaned stories (assigned to terminated agents).
|
|
15
15
|
* Returns the story IDs that were recovered.
|
|
16
16
|
*/
|
|
17
|
-
export function detectAndRecoverOrphanedStories(
|
|
18
|
-
db:
|
|
17
|
+
export async function detectAndRecoverOrphanedStories(
|
|
18
|
+
db: DatabaseProvider,
|
|
19
19
|
rootDir: string,
|
|
20
20
|
storiesDir?: string
|
|
21
|
-
): string[] {
|
|
22
|
-
const orphanedAssignments = getStoriesWithOrphanedAssignments(db);
|
|
23
|
-
const staleInProgressStories = getStaleInProgressStoriesWithoutAssignment(db);
|
|
24
|
-
const inconsistentInProgressAssignments =
|
|
21
|
+
): Promise<string[]> {
|
|
22
|
+
const orphanedAssignments = await getStoriesWithOrphanedAssignments(db);
|
|
23
|
+
const staleInProgressStories = await getStaleInProgressStoriesWithoutAssignment(db);
|
|
24
|
+
const inconsistentInProgressAssignments =
|
|
25
|
+
await getInProgressStoriesWithInconsistentAssignments(db);
|
|
25
26
|
const recovered: string[] = [];
|
|
26
27
|
const recoveredSet = new Set<string>();
|
|
27
28
|
|
|
@@ -30,7 +31,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
30
31
|
if (recoveredSet.has(assignment.id)) continue;
|
|
31
32
|
|
|
32
33
|
// Update story in single atomic operation
|
|
33
|
-
updateStory(
|
|
34
|
+
await updateStory(
|
|
34
35
|
db,
|
|
35
36
|
assignment.id,
|
|
36
37
|
{
|
|
@@ -39,7 +40,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
39
40
|
},
|
|
40
41
|
storiesDir
|
|
41
42
|
);
|
|
42
|
-
createLog(db, {
|
|
43
|
+
await createLog(db, {
|
|
43
44
|
agentId: 'scheduler',
|
|
44
45
|
storyId: assignment.id,
|
|
45
46
|
eventType: 'ORPHANED_STORY_RECOVERED',
|
|
@@ -61,7 +62,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
61
62
|
try {
|
|
62
63
|
if (recoveredSet.has(story.id)) continue;
|
|
63
64
|
|
|
64
|
-
updateStory(
|
|
65
|
+
await updateStory(
|
|
65
66
|
db,
|
|
66
67
|
story.id,
|
|
67
68
|
{
|
|
@@ -70,7 +71,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
70
71
|
},
|
|
71
72
|
storiesDir
|
|
72
73
|
);
|
|
73
|
-
createLog(db, {
|
|
74
|
+
await createLog(db, {
|
|
74
75
|
agentId: 'scheduler',
|
|
75
76
|
storyId: story.id,
|
|
76
77
|
eventType: 'ORPHANED_STORY_RECOVERED',
|
|
@@ -92,7 +93,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
92
93
|
try {
|
|
93
94
|
if (recoveredSet.has(assignment.id)) continue;
|
|
94
95
|
|
|
95
|
-
updateStory(
|
|
96
|
+
await updateStory(
|
|
96
97
|
db,
|
|
97
98
|
assignment.id,
|
|
98
99
|
{
|
|
@@ -101,7 +102,7 @@ export function detectAndRecoverOrphanedStories(
|
|
|
101
102
|
},
|
|
102
103
|
storiesDir
|
|
103
104
|
);
|
|
104
|
-
createLog(db, {
|
|
105
|
+
await createLog(db, {
|
|
105
106
|
agentId: 'scheduler',
|
|
106
107
|
storyId: assignment.id,
|
|
107
108
|
eventType: 'ORPHANED_STORY_RECOVERED',
|