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,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 { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
4
|
+
import { SqliteProvider } from '../db/provider.js';
|
|
5
5
|
import { createAgent, getAgentById, updateAgent } from '../db/queries/agents.js';
|
|
6
6
|
import {
|
|
7
7
|
createPullRequest,
|
|
@@ -32,21 +32,22 @@ import { autoMergeApprovedPRs, checkPreexistingCIFailures } from './auto-merge.j
|
|
|
32
32
|
const mockLoadConfig = vi.mocked(loadConfig);
|
|
33
33
|
|
|
34
34
|
describe('auto-merge functionality', () => {
|
|
35
|
-
let db:
|
|
35
|
+
let db: SqliteProvider;
|
|
36
36
|
let teamId: string;
|
|
37
37
|
let storyId: string;
|
|
38
38
|
|
|
39
39
|
beforeEach(async () => {
|
|
40
|
-
|
|
40
|
+
const rawDb = await createTestDatabase();
|
|
41
|
+
db = new SqliteProvider(rawDb);
|
|
41
42
|
|
|
42
|
-
const team = createTeam(db, {
|
|
43
|
+
const team = await createTeam(db, {
|
|
43
44
|
repoUrl: 'https://github.com/test/repo.git',
|
|
44
45
|
repoPath: '/path/to/repo',
|
|
45
46
|
name: 'Test Team',
|
|
46
47
|
});
|
|
47
48
|
teamId = team.id;
|
|
48
49
|
|
|
49
|
-
const story = createStory(db, {
|
|
50
|
+
const story = await createStory(db, {
|
|
50
51
|
title: 'Test Story',
|
|
51
52
|
description: 'Test description',
|
|
52
53
|
teamId,
|
|
@@ -55,13 +56,13 @@ describe('auto-merge functionality', () => {
|
|
|
55
56
|
});
|
|
56
57
|
|
|
57
58
|
describe('getApprovedPullRequests', () => {
|
|
58
|
-
it('should return empty list when no approved PRs exist', () => {
|
|
59
|
-
const approved = getApprovedPullRequests(db);
|
|
59
|
+
it('should return empty list when no approved PRs exist', async () => {
|
|
60
|
+
const approved = await getApprovedPullRequests(db);
|
|
60
61
|
expect(approved).toHaveLength(0);
|
|
61
62
|
});
|
|
62
63
|
|
|
63
|
-
it('should return only approved PRs, not queued or reviewing', () => {
|
|
64
|
-
const pr1 = createPullRequest(db, {
|
|
64
|
+
it('should return only approved PRs, not queued or reviewing', async () => {
|
|
65
|
+
const pr1 = await createPullRequest(db, {
|
|
65
66
|
storyId,
|
|
66
67
|
teamId,
|
|
67
68
|
branchName: 'feature/test-1',
|
|
@@ -69,7 +70,7 @@ describe('auto-merge functionality', () => {
|
|
|
69
70
|
githubPrUrl: 'https://github.com/test/repo/pull/111',
|
|
70
71
|
});
|
|
71
72
|
|
|
72
|
-
const pr2 = createPullRequest(db, {
|
|
73
|
+
const pr2 = await createPullRequest(db, {
|
|
73
74
|
storyId,
|
|
74
75
|
teamId,
|
|
75
76
|
branchName: 'feature/test-2',
|
|
@@ -77,59 +78,59 @@ describe('auto-merge functionality', () => {
|
|
|
77
78
|
githubPrUrl: 'https://github.com/test/repo/pull/222',
|
|
78
79
|
});
|
|
79
80
|
|
|
80
|
-
updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
81
|
-
updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
81
|
+
await updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
82
|
+
await updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
82
83
|
|
|
83
|
-
const approved = getApprovedPullRequests(db);
|
|
84
|
+
const approved = await getApprovedPullRequests(db);
|
|
84
85
|
|
|
85
86
|
expect(approved).toHaveLength(1);
|
|
86
87
|
expect(approved[0].id).toBe(pr1.id);
|
|
87
88
|
expect(approved[0].status).toBe('approved');
|
|
88
89
|
});
|
|
89
90
|
|
|
90
|
-
it('should return approved PRs in creation order (oldest first)', () => {
|
|
91
|
-
const pr1 = createPullRequest(db, {
|
|
91
|
+
it('should return approved PRs in creation order (oldest first)', async () => {
|
|
92
|
+
const pr1 = await createPullRequest(db, {
|
|
92
93
|
storyId,
|
|
93
94
|
teamId,
|
|
94
95
|
branchName: 'feature/test-1',
|
|
95
96
|
githubPrNumber: 111,
|
|
96
97
|
});
|
|
97
98
|
|
|
98
|
-
const pr2 = createPullRequest(db, {
|
|
99
|
+
const pr2 = await createPullRequest(db, {
|
|
99
100
|
storyId,
|
|
100
101
|
teamId,
|
|
101
102
|
branchName: 'feature/test-2',
|
|
102
103
|
githubPrNumber: 222,
|
|
103
104
|
});
|
|
104
105
|
|
|
105
|
-
updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
106
|
-
updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
106
|
+
await updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
107
|
+
await updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
107
108
|
|
|
108
|
-
const approved = getApprovedPullRequests(db);
|
|
109
|
+
const approved = await getApprovedPullRequests(db);
|
|
109
110
|
|
|
110
111
|
expect(approved).toHaveLength(2);
|
|
111
112
|
expect(approved[0].id).toBe(pr1.id);
|
|
112
113
|
expect(approved[1].id).toBe(pr2.id);
|
|
113
114
|
});
|
|
114
115
|
|
|
115
|
-
it('should require github_pr_number for merging to be possible', () => {
|
|
116
|
-
const prWithNumber = createPullRequest(db, {
|
|
116
|
+
it('should require github_pr_number for merging to be possible', async () => {
|
|
117
|
+
const prWithNumber = await createPullRequest(db, {
|
|
117
118
|
storyId,
|
|
118
119
|
teamId,
|
|
119
120
|
branchName: 'feature/with-number',
|
|
120
121
|
githubPrNumber: 333,
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
const prWithoutNumber = createPullRequest(db, {
|
|
124
|
+
const prWithoutNumber = await createPullRequest(db, {
|
|
124
125
|
storyId,
|
|
125
126
|
teamId,
|
|
126
127
|
branchName: 'feature/without-number',
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
updatePullRequest(db, prWithNumber.id, { status: 'approved' });
|
|
130
|
-
updatePullRequest(db, prWithoutNumber.id, { status: 'approved' });
|
|
130
|
+
await updatePullRequest(db, prWithNumber.id, { status: 'approved' });
|
|
131
|
+
await updatePullRequest(db, prWithoutNumber.id, { status: 'approved' });
|
|
131
132
|
|
|
132
|
-
const approved = getApprovedPullRequests(db);
|
|
133
|
+
const approved = await getApprovedPullRequests(db);
|
|
133
134
|
|
|
134
135
|
expect(approved).toHaveLength(2);
|
|
135
136
|
expect(approved.filter(p => p.github_pr_number)).toHaveLength(1);
|
|
@@ -137,64 +138,64 @@ describe('auto-merge functionality', () => {
|
|
|
137
138
|
});
|
|
138
139
|
|
|
139
140
|
describe('agent cleanup on story merge', () => {
|
|
140
|
-
it('should allow agent currentStoryId to be cleared when story is merged', () => {
|
|
141
|
+
it('should allow agent currentStoryId to be cleared when story is merged', async () => {
|
|
141
142
|
// Create an agent assigned to the story
|
|
142
|
-
const agent = createAgent(db, {
|
|
143
|
+
const agent = await createAgent(db, {
|
|
143
144
|
type: 'senior',
|
|
144
145
|
teamId,
|
|
145
146
|
model: 'claude-sonnet-4-20250514',
|
|
146
147
|
});
|
|
147
|
-
updateAgent(db, agent.id, { status: 'working', currentStoryId: storyId });
|
|
148
|
+
await updateAgent(db, agent.id, { status: 'working', currentStoryId: storyId });
|
|
148
149
|
|
|
149
150
|
// Assign story to agent
|
|
150
|
-
updateStory(db, storyId, { assignedAgentId: agent.id, status: 'in_progress' });
|
|
151
|
+
await updateStory(db, storyId, { assignedAgentId: agent.id, status: 'in_progress' });
|
|
151
152
|
|
|
152
153
|
// Simulate what auto-merge now does: clear agent's currentStoryId
|
|
153
|
-
const story = getStoryById(db, storyId);
|
|
154
|
+
const story = await getStoryById(db, storyId);
|
|
154
155
|
expect(story?.assigned_agent_id).toBe(agent.id);
|
|
155
156
|
|
|
156
|
-
const agentBefore = getAgentById(db, agent.id);
|
|
157
|
+
const agentBefore = await getAgentById(db, agent.id);
|
|
157
158
|
expect(agentBefore?.current_story_id).toBe(storyId);
|
|
158
159
|
expect(agentBefore?.status).toBe('working');
|
|
159
160
|
|
|
160
161
|
// Clear the agent's currentStoryId (as auto-merge now does)
|
|
161
|
-
updateAgent(db, agent.id, { currentStoryId: null, status: 'idle' });
|
|
162
|
+
await updateAgent(db, agent.id, { currentStoryId: null, status: 'idle' });
|
|
162
163
|
|
|
163
|
-
const agentAfter = getAgentById(db, agent.id);
|
|
164
|
+
const agentAfter = await getAgentById(db, agent.id);
|
|
164
165
|
expect(agentAfter?.current_story_id).toBeNull();
|
|
165
166
|
expect(agentAfter?.status).toBe('idle');
|
|
166
167
|
});
|
|
167
168
|
|
|
168
|
-
it('should not clear agent currentStoryId if agent moved to different story', () => {
|
|
169
|
-
const agent = createAgent(db, {
|
|
169
|
+
it('should not clear agent currentStoryId if agent moved to different story', async () => {
|
|
170
|
+
const agent = await createAgent(db, {
|
|
170
171
|
type: 'senior',
|
|
171
172
|
teamId,
|
|
172
173
|
model: 'claude-sonnet-4-20250514',
|
|
173
174
|
});
|
|
174
175
|
|
|
175
176
|
// Create a second story
|
|
176
|
-
const story2 = createStory(db, {
|
|
177
|
+
const story2 = await createStory(db, {
|
|
177
178
|
title: 'Second Story',
|
|
178
179
|
description: 'Another story',
|
|
179
180
|
teamId,
|
|
180
181
|
});
|
|
181
182
|
|
|
182
183
|
// Agent is now working on story2, not the original storyId
|
|
183
|
-
updateAgent(db, agent.id, { status: 'working', currentStoryId: story2.id });
|
|
184
|
+
await updateAgent(db, agent.id, { status: 'working', currentStoryId: story2.id });
|
|
184
185
|
|
|
185
186
|
// When the original story merges, agent's currentStoryId is story2 (different)
|
|
186
187
|
// so we should NOT clear it
|
|
187
|
-
const agentCheck = getAgentById(db, agent.id);
|
|
188
|
+
const agentCheck = await getAgentById(db, agent.id);
|
|
188
189
|
expect(agentCheck?.current_story_id).toBe(story2.id);
|
|
189
190
|
expect(agentCheck?.current_story_id).not.toBe(storyId);
|
|
190
191
|
|
|
191
192
|
// The guard condition: only clear if agent.current_story_id === storyId
|
|
192
193
|
if (agentCheck?.current_story_id === storyId) {
|
|
193
|
-
updateAgent(db, agent.id, { currentStoryId: null, status: 'idle' });
|
|
194
|
+
await updateAgent(db, agent.id, { currentStoryId: null, status: 'idle' });
|
|
194
195
|
}
|
|
195
196
|
|
|
196
197
|
// Agent should still have story2 as current story
|
|
197
|
-
const agentAfter = getAgentById(db, agent.id);
|
|
198
|
+
const agentAfter = await getAgentById(db, agent.id);
|
|
198
199
|
expect(agentAfter?.current_story_id).toBe(story2.id);
|
|
199
200
|
expect(agentAfter?.status).toBe('working');
|
|
200
201
|
});
|
|
@@ -207,13 +208,13 @@ describe('auto-merge functionality', () => {
|
|
|
207
208
|
|
|
208
209
|
it('should skip auto-merge when autonomy level is partial', async () => {
|
|
209
210
|
// Setup: Create an approved PR
|
|
210
|
-
const pr = createPullRequest(db, {
|
|
211
|
+
const pr = await createPullRequest(db, {
|
|
211
212
|
storyId,
|
|
212
213
|
teamId,
|
|
213
214
|
branchName: 'feature/test',
|
|
214
215
|
githubPrNumber: 123,
|
|
215
216
|
});
|
|
216
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
217
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
217
218
|
|
|
218
219
|
// Mock config with partial autonomy
|
|
219
220
|
mockLoadConfig.mockReturnValue({
|
|
@@ -228,7 +229,8 @@ describe('auto-merge functionality', () => {
|
|
|
228
229
|
|
|
229
230
|
// Create a minimal database client wrapper
|
|
230
231
|
const dbClient = {
|
|
231
|
-
db,
|
|
232
|
+
db: db.db,
|
|
233
|
+
provider: db,
|
|
232
234
|
save: vi.fn(),
|
|
233
235
|
close: vi.fn(),
|
|
234
236
|
runMigrations: vi.fn(),
|
|
@@ -256,7 +258,8 @@ describe('auto-merge functionality', () => {
|
|
|
256
258
|
|
|
257
259
|
// Create a minimal database client wrapper (no approved PRs)
|
|
258
260
|
const dbClient = {
|
|
259
|
-
db,
|
|
261
|
+
db: db.db,
|
|
262
|
+
provider: db,
|
|
260
263
|
save: vi.fn(),
|
|
261
264
|
close: vi.fn(),
|
|
262
265
|
runMigrations: vi.fn(),
|
|
@@ -272,13 +275,13 @@ describe('auto-merge functionality', () => {
|
|
|
272
275
|
});
|
|
273
276
|
|
|
274
277
|
it('should keep PR as queued when auto-merge is pending (PR still open after gh pr merge --auto)', async () => {
|
|
275
|
-
const pr = createPullRequest(db, {
|
|
278
|
+
const pr = await createPullRequest(db, {
|
|
276
279
|
storyId,
|
|
277
280
|
teamId,
|
|
278
281
|
branchName: 'feature/auto-merge-pending',
|
|
279
282
|
githubPrNumber: 456,
|
|
280
283
|
});
|
|
281
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
284
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
282
285
|
|
|
283
286
|
mockLoadConfig.mockReturnValue({
|
|
284
287
|
integrations: {
|
|
@@ -302,23 +305,29 @@ describe('auto-merge functionality', () => {
|
|
|
302
305
|
|
|
303
306
|
vi.doMock('child_process', () => ({ execSync: mockExecSync }));
|
|
304
307
|
|
|
305
|
-
const dbClient = {
|
|
308
|
+
const dbClient = {
|
|
309
|
+
db: db.db,
|
|
310
|
+
provider: db,
|
|
311
|
+
save: vi.fn(),
|
|
312
|
+
close: vi.fn(),
|
|
313
|
+
runMigrations: vi.fn(),
|
|
314
|
+
};
|
|
306
315
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
307
316
|
|
|
308
317
|
// Should return 0 because the PR was not actually merged yet
|
|
309
318
|
expect(result).toBe(0);
|
|
310
319
|
// PR should remain 'queued' (not rolled back to 'approved' or advanced to 'merged')
|
|
311
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('queued');
|
|
320
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('queued');
|
|
312
321
|
});
|
|
313
322
|
|
|
314
323
|
it('should reset stale branch PR to approved after updating behind branch', async () => {
|
|
315
|
-
const pr = createPullRequest(db, {
|
|
324
|
+
const pr = await createPullRequest(db, {
|
|
316
325
|
storyId,
|
|
317
326
|
teamId,
|
|
318
327
|
branchName: 'feature/stale-branch',
|
|
319
328
|
githubPrNumber: 789,
|
|
320
329
|
});
|
|
321
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
330
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
322
331
|
|
|
323
332
|
mockLoadConfig.mockReturnValue({
|
|
324
333
|
integrations: {
|
|
@@ -338,23 +347,29 @@ describe('auto-merge functionality', () => {
|
|
|
338
347
|
|
|
339
348
|
vi.doMock('child_process', () => ({ execSync: mockExecSync }));
|
|
340
349
|
|
|
341
|
-
const dbClient = {
|
|
350
|
+
const dbClient = {
|
|
351
|
+
db: db.db,
|
|
352
|
+
provider: db,
|
|
353
|
+
save: vi.fn(),
|
|
354
|
+
close: vi.fn(),
|
|
355
|
+
runMigrations: vi.fn(),
|
|
356
|
+
};
|
|
342
357
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
343
358
|
|
|
344
359
|
// Should return 0 because no merge happened yet
|
|
345
360
|
expect(result).toBe(0);
|
|
346
361
|
// PR should be reset to 'approved' to be retried on next cycle
|
|
347
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('approved');
|
|
362
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('approved');
|
|
348
363
|
});
|
|
349
364
|
|
|
350
365
|
it('should skip approved PRs marked for manual merge', async () => {
|
|
351
|
-
const pr = createPullRequest(db, {
|
|
366
|
+
const pr = await createPullRequest(db, {
|
|
352
367
|
storyId,
|
|
353
368
|
teamId,
|
|
354
369
|
branchName: 'feature/manual-merge',
|
|
355
370
|
githubPrNumber: 999,
|
|
356
371
|
});
|
|
357
|
-
updatePullRequest(db, pr.id, {
|
|
372
|
+
await updatePullRequest(db, pr.id, {
|
|
358
373
|
status: 'approved',
|
|
359
374
|
reviewNotes: '[manual-merge-required]',
|
|
360
375
|
});
|
|
@@ -370,7 +385,8 @@ describe('auto-merge functionality', () => {
|
|
|
370
385
|
} as any);
|
|
371
386
|
|
|
372
387
|
const dbClient = {
|
|
373
|
-
db,
|
|
388
|
+
db: db.db,
|
|
389
|
+
provider: db,
|
|
374
390
|
save: vi.fn(),
|
|
375
391
|
close: vi.fn(),
|
|
376
392
|
runMigrations: vi.fn(),
|
|
@@ -378,17 +394,17 @@ describe('auto-merge functionality', () => {
|
|
|
378
394
|
|
|
379
395
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
380
396
|
expect(result).toBe(0);
|
|
381
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('approved');
|
|
397
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('approved');
|
|
382
398
|
});
|
|
383
399
|
|
|
384
400
|
it('should bypass BLOCKED status when all CI failures are pre-existing on base branch', async () => {
|
|
385
|
-
const pr = createPullRequest(db, {
|
|
401
|
+
const pr = await createPullRequest(db, {
|
|
386
402
|
storyId,
|
|
387
403
|
teamId,
|
|
388
404
|
branchName: 'feature/preexisting-ci',
|
|
389
405
|
githubPrNumber: 555,
|
|
390
406
|
});
|
|
391
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
407
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
392
408
|
|
|
393
409
|
mockLoadConfig.mockReturnValue({
|
|
394
410
|
integrations: {
|
|
@@ -424,21 +440,27 @@ describe('auto-merge functionality', () => {
|
|
|
424
440
|
|
|
425
441
|
vi.doMock('child_process', () => ({ execSync: mockExecSync }));
|
|
426
442
|
|
|
427
|
-
const dbClient = {
|
|
443
|
+
const dbClient = {
|
|
444
|
+
db: db.db,
|
|
445
|
+
provider: db,
|
|
446
|
+
save: vi.fn(),
|
|
447
|
+
close: vi.fn(),
|
|
448
|
+
runMigrations: vi.fn(),
|
|
449
|
+
};
|
|
428
450
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
429
451
|
|
|
430
452
|
expect(result).toBe(1);
|
|
431
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('merged');
|
|
453
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('merged');
|
|
432
454
|
});
|
|
433
455
|
|
|
434
456
|
it('should not bypass BLOCKED status when PR has new CI failures not on base branch', async () => {
|
|
435
|
-
const pr = createPullRequest(db, {
|
|
457
|
+
const pr = await createPullRequest(db, {
|
|
436
458
|
storyId,
|
|
437
459
|
teamId,
|
|
438
460
|
branchName: 'feature/new-ci-failure',
|
|
439
461
|
githubPrNumber: 556,
|
|
440
462
|
});
|
|
441
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
463
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
442
464
|
|
|
443
465
|
mockLoadConfig.mockReturnValue({
|
|
444
466
|
integrations: {
|
|
@@ -472,23 +494,29 @@ describe('auto-merge functionality', () => {
|
|
|
472
494
|
|
|
473
495
|
vi.doMock('child_process', () => ({ execSync: mockExecSync }));
|
|
474
496
|
|
|
475
|
-
const dbClient = {
|
|
497
|
+
const dbClient = {
|
|
498
|
+
db: db.db,
|
|
499
|
+
provider: db,
|
|
500
|
+
save: vi.fn(),
|
|
501
|
+
close: vi.fn(),
|
|
502
|
+
runMigrations: vi.fn(),
|
|
503
|
+
};
|
|
476
504
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
477
505
|
|
|
478
506
|
// Should not merge — 'build' is a new failure
|
|
479
507
|
expect(result).toBe(0);
|
|
480
508
|
// PR should be reset to approved (ci_blocked outcome)
|
|
481
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('approved');
|
|
509
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('approved');
|
|
482
510
|
});
|
|
483
511
|
|
|
484
512
|
it('should skip BLOCKED PR when allow_preexisting_ci_failures is false', async () => {
|
|
485
|
-
const pr = createPullRequest(db, {
|
|
513
|
+
const pr = await createPullRequest(db, {
|
|
486
514
|
storyId,
|
|
487
515
|
teamId,
|
|
488
516
|
branchName: 'feature/ci-blocked-no-bypass',
|
|
489
517
|
githubPrNumber: 557,
|
|
490
518
|
});
|
|
491
|
-
updatePullRequest(db, pr.id, { status: 'approved' });
|
|
519
|
+
await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
492
520
|
|
|
493
521
|
mockLoadConfig.mockReturnValue({
|
|
494
522
|
integrations: {
|
|
@@ -506,11 +534,17 @@ describe('auto-merge functionality', () => {
|
|
|
506
534
|
|
|
507
535
|
vi.doMock('child_process', () => ({ execSync: mockExecSync }));
|
|
508
536
|
|
|
509
|
-
const dbClient = {
|
|
537
|
+
const dbClient = {
|
|
538
|
+
db: db.db,
|
|
539
|
+
provider: db,
|
|
540
|
+
save: vi.fn(),
|
|
541
|
+
close: vi.fn(),
|
|
542
|
+
runMigrations: vi.fn(),
|
|
543
|
+
};
|
|
510
544
|
const result = await autoMergeApprovedPRs('/mock/root', dbClient);
|
|
511
545
|
|
|
512
546
|
expect(result).toBe(0);
|
|
513
|
-
expect(getPullRequestById(db, pr.id)?.status).toBe('approved');
|
|
547
|
+
expect((await getPullRequestById(db, pr.id))?.status).toBe('approved');
|
|
514
548
|
});
|
|
515
549
|
});
|
|
516
550
|
|