hungry-ghost-hive 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/base-agent.d.ts +11 -11
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +25 -25
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/base-agent.test.js +2 -1
- package/dist/agents/base-agent.test.js.map +1 -1
- package/dist/agents/intermediate.d.ts +2 -0
- package/dist/agents/intermediate.d.ts.map +1 -1
- package/dist/agents/intermediate.js +25 -18
- package/dist/agents/intermediate.js.map +1 -1
- package/dist/agents/junior.d.ts +2 -0
- package/dist/agents/junior.d.ts.map +1 -1
- package/dist/agents/junior.js +25 -18
- package/dist/agents/junior.js.map +1 -1
- package/dist/agents/qa.d.ts +2 -0
- package/dist/agents/qa.d.ts.map +1 -1
- package/dist/agents/qa.js +47 -38
- package/dist/agents/qa.js.map +1 -1
- package/dist/agents/senior.d.ts +2 -0
- package/dist/agents/senior.d.ts.map +1 -1
- package/dist/agents/senior.js +40 -27
- package/dist/agents/senior.js.map +1 -1
- package/dist/agents/tech-lead.d.ts +2 -0
- package/dist/agents/tech-lead.d.ts.map +1 -1
- package/dist/agents/tech-lead.js +37 -31
- package/dist/agents/tech-lead.js.map +1 -1
- package/dist/cli/commands/add-repo.js +2 -2
- package/dist/cli/commands/add-repo.js.map +1 -1
- package/dist/cli/commands/add-repo.test.js +1 -1
- package/dist/cli/commands/add-repo.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +12 -10
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/agents.test.js +7 -7
- package/dist/cli/commands/agents.test.js.map +1 -1
- package/dist/cli/commands/approach.js +2 -2
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/approvals.js +7 -7
- package/dist/cli/commands/approvals.js.map +1 -1
- package/dist/cli/commands/approvals.test.js +8 -8
- package/dist/cli/commands/approvals.test.js.map +1 -1
- package/dist/cli/commands/assign.js +4 -4
- package/dist/cli/commands/assign.js.map +1 -1
- package/dist/cli/commands/assign.test.js +18 -16
- package/dist/cli/commands/assign.test.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -8
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/cleanup.test.js +5 -1
- package/dist/cli/commands/cleanup.test.js.map +1 -1
- package/dist/cli/commands/escalations.js +9 -7
- package/dist/cli/commands/escalations.js.map +1 -1
- package/dist/cli/commands/escalations.test.js +2 -2
- package/dist/cli/commands/escalations.test.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +4 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.d.ts +2 -2
- package/dist/cli/commands/manager/agent-monitoring.d.ts.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.js +3 -3
- package/dist/cli/commands/manager/auditor-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.test.js +21 -14
- package/dist/cli/commands/manager/auditor-lifecycle.test.js.map +1 -1
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js +28 -23
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.d.ts +2 -2
- package/dist/cli/commands/manager/escalation-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.js +11 -10
- package/dist/cli/commands/manager/escalation-handler.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.test.js +8 -8
- package/dist/cli/commands/manager/escalation-handler.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.js +7 -7
- package/dist/cli/commands/manager/feature-sign-off.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.test.js +40 -31
- package/dist/cli/commands/manager/feature-sign-off.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.d.ts.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.js +12 -13
- package/dist/cli/commands/manager/feature-test-result.js.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.js +14 -15
- package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +26 -26
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/index.test.js +3 -3
- package/dist/cli/commands/manager/index.test.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts +2 -2
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.js +6 -7
- package/dist/cli/commands/manager/merged-story-cleanup.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.test.js +27 -18
- package/dist/cli/commands/manager/merged-story-cleanup.test.js.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +46 -38
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.js +25 -22
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -1
- package/dist/cli/commands/manager/spin-down.d.ts.map +1 -1
- package/dist/cli/commands/manager/spin-down.js +23 -19
- package/dist/cli/commands/manager/spin-down.js.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.d.ts +2 -3
- package/dist/cli/commands/manager/stale-escalations.d.ts.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-helpers.js +8 -8
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +2 -2
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.js +23 -22
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -1
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +6 -6
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/types.d.ts +2 -3
- package/dist/cli/commands/manager/types.d.ts.map +1 -1
- package/dist/cli/commands/manager/types.js.map +1 -1
- package/dist/cli/commands/msg.test.js +2 -2
- package/dist/cli/commands/msg.test.js.map +1 -1
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +17 -18
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/my-stories.test.js +2 -2
- package/dist/cli/commands/my-stories.test.js.map +1 -1
- package/dist/cli/commands/nuke.test.js +1 -1
- package/dist/cli/commands/nuke.test.js.map +1 -1
- package/dist/cli/commands/pr.js +32 -32
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/pr.test.js +10 -6
- package/dist/cli/commands/pr.test.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +4 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/progress.test.js +1 -1
- package/dist/cli/commands/progress.test.js.map +1 -1
- package/dist/cli/commands/req-headless.test.d.ts +2 -0
- package/dist/cli/commands/req-headless.test.d.ts.map +1 -0
- package/dist/cli/commands/req-headless.test.js +128 -0
- package/dist/cli/commands/req-headless.test.js.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +5 -1
- package/dist/cli/commands/req-spawn.test.js.map +1 -1
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +13 -14
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +7 -8
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/resume.test.js +1 -1
- package/dist/cli/commands/resume.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -40
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +1 -1
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/stories.js +9 -9
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cli/commands/stories.test.js +2 -2
- package/dist/cli/commands/stories.test.js.map +1 -1
- package/dist/cli/commands/teams.js +11 -11
- package/dist/cli/commands/teams.js.map +1 -1
- package/dist/cli/commands/teams.test.js +2 -2
- package/dist/cli/commands/teams.test.js.map +1 -1
- package/dist/cli/dashboard/index.d.ts +2 -2
- package/dist/cli/dashboard/index.d.ts.map +1 -1
- package/dist/cli/dashboard/index.js +29 -20
- package/dist/cli/dashboard/index.js.map +1 -1
- package/dist/cli/dashboard/index.test.js +34 -32
- package/dist/cli/dashboard/index.test.js.map +1 -1
- package/dist/cli/dashboard/panels/activity.d.ts +3 -3
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/activity.js +1 -1
- package/dist/cli/dashboard/panels/activity.js.map +1 -1
- package/dist/cli/dashboard/panels/agents.d.ts +3 -3
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/agents.js +2 -2
- package/dist/cli/dashboard/panels/agents.js.map +1 -1
- package/dist/cli/dashboard/panels/escalations.d.ts +3 -3
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/escalations.js +1 -1
- package/dist/cli/dashboard/panels/escalations.js.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.d.ts +3 -3
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.d.ts +3 -3
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.js +1 -1
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -1
- package/dist/config/schema.d.ts +85 -82
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/connectors/project-management/operations.d.ts +7 -7
- package/dist/connectors/project-management/operations.d.ts.map +1 -1
- package/dist/connectors/project-management/operations.js +2 -3
- package/dist/connectors/project-management/operations.js.map +1 -1
- package/dist/context-files/index.test.js +1 -0
- package/dist/context-files/index.test.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/postgres-provider.d.ts +43 -0
- package/dist/db/postgres-provider.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.d.ts +2 -0
- package/dist/db/postgres-provider.integration.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.js +399 -0
- package/dist/db/postgres-provider.integration.test.js.map +1 -0
- package/dist/db/postgres-provider.js +315 -0
- package/dist/db/postgres-provider.js.map +1 -0
- package/dist/db/postgres-provider.test.d.ts +2 -0
- package/dist/db/postgres-provider.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.test.js +72 -0
- package/dist/db/postgres-provider.test.js.map +1 -0
- package/dist/db/provider.d.ts +59 -0
- package/dist/db/provider.d.ts.map +1 -0
- package/dist/db/provider.js +121 -0
- package/dist/db/provider.js.map +1 -0
- package/dist/db/provider.test.d.ts +2 -0
- package/dist/db/provider.test.d.ts.map +1 -0
- package/dist/db/provider.test.js +226 -0
- package/dist/db/provider.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +13 -13
- package/dist/db/queries/agents.d.ts.map +1 -1
- package/dist/db/queries/agents.js +27 -28
- package/dist/db/queries/agents.js.map +1 -1
- package/dist/db/queries/agents.test.js +113 -111
- package/dist/db/queries/agents.test.js.map +1 -1
- package/dist/db/queries/escalations.d.ts +16 -16
- package/dist/db/queries/escalations.d.ts.map +1 -1
- package/dist/db/queries/escalations.js +34 -35
- package/dist/db/queries/escalations.js.map +1 -1
- package/dist/db/queries/escalations.test.js +133 -131
- package/dist/db/queries/escalations.test.js.map +1 -1
- package/dist/db/queries/heartbeat.d.ts +5 -5
- package/dist/db/queries/heartbeat.d.ts.map +1 -1
- package/dist/db/queries/heartbeat.js +7 -23
- package/dist/db/queries/heartbeat.js.map +1 -1
- package/dist/db/queries/heartbeat.test.js +76 -76
- package/dist/db/queries/heartbeat.test.js.map +1 -1
- package/dist/db/queries/integration-sync.d.ts +7 -7
- package/dist/db/queries/integration-sync.d.ts.map +1 -1
- package/dist/db/queries/integration-sync.js +13 -14
- package/dist/db/queries/integration-sync.js.map +1 -1
- package/dist/db/queries/logs.d.ts +10 -10
- package/dist/db/queries/logs.d.ts.map +1 -1
- package/dist/db/queries/logs.js +44 -42
- package/dist/db/queries/logs.js.map +1 -1
- package/dist/db/queries/logs.test.js +149 -146
- package/dist/db/queries/logs.test.js.map +1 -1
- package/dist/db/queries/messages.d.ts +6 -6
- package/dist/db/queries/messages.d.ts.map +1 -1
- package/dist/db/queries/messages.js +12 -11
- package/dist/db/queries/messages.js.map +1 -1
- package/dist/db/queries/messages.test.js +47 -46
- package/dist/db/queries/messages.test.js.map +1 -1
- package/dist/db/queries/pull-requests.d.ts +18 -18
- package/dist/db/queries/pull-requests.d.ts.map +1 -1
- package/dist/db/queries/pull-requests.js +50 -48
- package/dist/db/queries/pull-requests.js.map +1 -1
- package/dist/db/queries/pull-requests.test.js +195 -198
- package/dist/db/queries/pull-requests.test.js.map +1 -1
- package/dist/db/queries/requirements.d.ts +8 -8
- package/dist/db/queries/requirements.d.ts.map +1 -1
- package/dist/db/queries/requirements.js +17 -18
- package/dist/db/queries/requirements.js.map +1 -1
- package/dist/db/queries/requirements.test.js +83 -81
- package/dist/db/queries/requirements.test.js.map +1 -1
- package/dist/db/queries/stories.d.ts +29 -29
- package/dist/db/queries/stories.d.ts.map +1 -1
- package/dist/db/queries/stories.js +58 -64
- package/dist/db/queries/stories.js.map +1 -1
- package/dist/db/queries/stories.test.js +172 -170
- package/dist/db/queries/stories.test.js.map +1 -1
- package/dist/db/queries/teams.d.ts +6 -6
- package/dist/db/queries/teams.d.ts.map +1 -1
- package/dist/db/queries/teams.js +11 -12
- package/dist/db/queries/teams.js.map +1 -1
- package/dist/db/queries/teams.test.js +36 -34
- package/dist/db/queries/teams.test.js.map +1 -1
- package/dist/integrations/jira/repair.test.js +26 -24
- package/dist/integrations/jira/repair.test.js.map +1 -1
- package/dist/integrations/jira/stories.d.ts +3 -3
- package/dist/integrations/jira/stories.d.ts.map +1 -1
- package/dist/integrations/jira/stories.js +12 -12
- package/dist/integrations/jira/stories.js.map +1 -1
- package/dist/integrations/jira/stories.test.js +10 -8
- package/dist/integrations/jira/stories.test.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +7 -7
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +17 -20
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/integrations/jira/sync.test.js +63 -62
- package/dist/integrations/jira/sync.test.js.map +1 -1
- package/dist/integrations/jira/transitions.d.ts +3 -3
- package/dist/integrations/jira/transitions.d.ts.map +1 -1
- package/dist/integrations/jira/transitions.js +3 -3
- package/dist/integrations/jira/transitions.js.map +1 -1
- package/dist/orchestrator/agent-selector.d.ts +3 -3
- package/dist/orchestrator/agent-selector.d.ts.map +1 -1
- package/dist/orchestrator/agent-selector.js +5 -6
- package/dist/orchestrator/agent-selector.js.map +1 -1
- package/dist/orchestrator/dependency-resolver.d.ts +4 -4
- package/dist/orchestrator/dependency-resolver.d.ts.map +1 -1
- package/dist/orchestrator/dependency-resolver.js +6 -6
- package/dist/orchestrator/dependency-resolver.js.map +1 -1
- package/dist/orchestrator/feature-branch.d.ts +3 -3
- package/dist/orchestrator/feature-branch.d.ts.map +1 -1
- package/dist/orchestrator/feature-branch.js +9 -10
- package/dist/orchestrator/feature-branch.js.map +1 -1
- package/dist/orchestrator/feature-branch.test.js +80 -78
- package/dist/orchestrator/feature-branch.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +2 -2
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +10 -10
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +4 -4
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +90 -76
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +496 -374
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/dist/utils/auto-merge.d.ts.map +1 -1
- package/dist/utils/auto-merge.js +74 -56
- package/dist/utils/auto-merge.js.map +1 -1
- package/dist/utils/auto-merge.test.js +101 -66
- package/dist/utils/auto-merge.test.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +5 -5
- package/dist/utils/cli-helpers.d.ts.map +1 -1
- package/dist/utils/cli-helpers.js +8 -9
- package/dist/utils/cli-helpers.js.map +1 -1
- package/dist/utils/cli-helpers.test.js +28 -30
- package/dist/utils/cli-helpers.test.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +12 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +1 -0
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/pr-sync.d.ts +10 -10
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +20 -21
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/pr-sync.test.js +52 -50
- package/dist/utils/pr-sync.test.js.map +1 -1
- package/dist/utils/with-hive-context.d.ts.map +1 -1
- package/dist/utils/with-hive-context.js +70 -1
- package/dist/utils/with-hive-context.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/base-agent.test.ts +2 -1
- package/src/agents/base-agent.ts +32 -28
- package/src/agents/intermediate.ts +27 -18
- package/src/agents/junior.ts +27 -18
- package/src/agents/qa.ts +54 -40
- package/src/agents/senior.ts +42 -27
- package/src/agents/tech-lead.ts +42 -32
- package/src/cli/commands/add-repo.test.ts +1 -1
- package/src/cli/commands/add-repo.ts +2 -2
- package/src/cli/commands/agents.test.ts +7 -7
- package/src/cli/commands/agents.ts +12 -10
- package/src/cli/commands/approach.ts +2 -2
- package/src/cli/commands/approvals.test.ts +8 -8
- package/src/cli/commands/approvals.ts +9 -7
- package/src/cli/commands/assign.test.ts +19 -18
- package/src/cli/commands/assign.ts +4 -4
- package/src/cli/commands/cleanup.test.ts +5 -1
- package/src/cli/commands/cleanup.ts +11 -9
- package/src/cli/commands/escalations.test.ts +2 -2
- package/src/cli/commands/escalations.ts +9 -7
- package/src/cli/commands/init.test.ts +5 -0
- package/src/cli/commands/init.ts +53 -5
- package/src/cli/commands/manager/agent-monitoring.ts +3 -3
- package/src/cli/commands/manager/auditor-lifecycle.test.ts +21 -14
- package/src/cli/commands/manager/auditor-lifecycle.ts +3 -3
- package/src/cli/commands/manager/auto-reject-comment-only-reviews.test.ts +28 -23
- package/src/cli/commands/manager/escalation-handler.test.ts +13 -13
- package/src/cli/commands/manager/escalation-handler.ts +19 -12
- package/src/cli/commands/manager/feature-sign-off.test.ts +40 -31
- package/src/cli/commands/manager/feature-sign-off.ts +7 -7
- package/src/cli/commands/manager/feature-test-result.ts +13 -16
- package/src/cli/commands/manager/handoff-recovery.ts +20 -20
- package/src/cli/commands/manager/index.test.ts +4 -4
- package/src/cli/commands/manager/index.ts +58 -59
- package/src/cli/commands/manager/merged-story-cleanup.test.ts +28 -19
- package/src/cli/commands/manager/merged-story-cleanup.ts +11 -14
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +115 -110
- package/src/cli/commands/manager/qa-review-handler.ts +50 -63
- package/src/cli/commands/manager/spin-down.ts +27 -25
- package/src/cli/commands/manager/stale-escalations.ts +2 -3
- package/src/cli/commands/manager/stuck-story-helpers.ts +10 -10
- package/src/cli/commands/manager/stuck-story-processor.ts +56 -62
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +6 -6
- package/src/cli/commands/manager/types.ts +2 -3
- package/src/cli/commands/msg.test.ts +2 -2
- package/src/cli/commands/my-stories.test.ts +4 -2
- package/src/cli/commands/my-stories.ts +22 -27
- package/src/cli/commands/nuke.test.ts +1 -1
- package/src/cli/commands/pr.test.ts +10 -6
- package/src/cli/commands/pr.ts +41 -32
- package/src/cli/commands/progress.test.ts +1 -1
- package/src/cli/commands/progress.ts +11 -6
- package/src/cli/commands/req-headless.test.ts +170 -0
- package/src/cli/commands/req-spawn.test.ts +12 -2
- package/src/cli/commands/req.ts +13 -14
- package/src/cli/commands/resume.test.ts +1 -1
- package/src/cli/commands/resume.ts +7 -8
- package/src/cli/commands/status.test.ts +1 -1
- package/src/cli/commands/status.ts +52 -40
- package/src/cli/commands/stories.test.ts +4 -2
- package/src/cli/commands/stories.ts +11 -11
- package/src/cli/commands/teams.test.ts +2 -2
- package/src/cli/commands/teams.ts +11 -11
- package/src/cli/dashboard/index.test.ts +35 -34
- package/src/cli/dashboard/index.ts +34 -23
- package/src/cli/dashboard/panels/activity.ts +10 -4
- package/src/cli/dashboard/panels/agents.ts +8 -5
- package/src/cli/dashboard/panels/escalations.ts +4 -4
- package/src/cli/dashboard/panels/merge-queue.ts +4 -4
- package/src/cli/dashboard/panels/pipeline.ts +10 -4
- package/src/config/schema.ts +1 -0
- package/src/connectors/project-management/operations.ts +9 -10
- package/src/context-files/index.test.ts +1 -0
- package/src/db/client.ts +17 -0
- package/src/db/pg-migrations/001-full-schema.sql +209 -0
- package/src/db/postgres-provider.integration.test.ts +574 -0
- package/src/db/postgres-provider.test.ts +97 -0
- package/src/db/postgres-provider.ts +364 -0
- package/src/db/provider.test.ts +283 -0
- package/src/db/provider.ts +161 -0
- package/src/db/queries/agents.test.ts +114 -113
- package/src/db/queries/agents.ts +50 -36
- package/src/db/queries/escalations.test.ts +134 -133
- package/src/db/queries/escalations.ts +72 -57
- package/src/db/queries/heartbeat.test.ts +77 -78
- package/src/db/queries/heartbeat.ts +24 -46
- package/src/db/queries/integration-sync.ts +26 -26
- package/src/db/queries/logs.test.ts +151 -148
- package/src/db/queries/logs.ts +78 -53
- package/src/db/queries/messages.test.ts +48 -50
- package/src/db/queries/messages.ts +26 -18
- package/src/db/queries/pull-requests.test.ts +194 -199
- package/src/db/queries/pull-requests.ts +117 -88
- package/src/db/queries/requirements.test.ts +84 -83
- package/src/db/queries/requirements.ts +33 -28
- package/src/db/queries/stories.test.ts +173 -172
- package/src/db/queries/stories.ts +141 -110
- package/src/db/queries/teams.test.ts +37 -36
- package/src/db/queries/teams.ts +22 -14
- package/src/integrations/jira/repair.test.ts +27 -26
- package/src/integrations/jira/stories.test.ts +15 -16
- package/src/integrations/jira/stories.ts +15 -15
- package/src/integrations/jira/sync.test.ts +68 -68
- package/src/integrations/jira/sync.ts +29 -39
- package/src/integrations/jira/transitions.ts +6 -6
- package/src/orchestrator/agent-selector.ts +9 -8
- package/src/orchestrator/dependency-resolver.ts +16 -7
- package/src/orchestrator/feature-branch.test.ts +85 -80
- package/src/orchestrator/feature-branch.ts +13 -14
- package/src/orchestrator/orphan-recovery.ts +14 -13
- package/src/orchestrator/scheduler.test.ts +536 -394
- package/src/orchestrator/scheduler.ts +129 -115
- package/src/utils/auto-merge.test.ts +102 -68
- package/src/utils/auto-merge.ts +161 -168
- package/src/utils/cli-helpers.test.ts +30 -32
- package/src/utils/cli-helpers.ts +15 -11
- package/src/utils/paths.test.ts +1 -0
- package/src/utils/paths.ts +14 -1
- package/src/utils/pr-sync.test.ts +55 -52
- package/src/utils/pr-sync.ts +27 -32
- package/src/utils/with-hive-context.ts +89 -1
package/src/db/queries/teams.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
3
|
import { nanoid } from 'nanoid';
|
|
4
|
-
import type
|
|
5
|
-
import {
|
|
4
|
+
import { type TeamRow } from '../client.js';
|
|
5
|
+
import type { DatabaseProvider } from '../provider.js';
|
|
6
6
|
|
|
7
7
|
export type { TeamRow };
|
|
8
8
|
|
|
@@ -12,12 +12,14 @@ export interface CreateTeamInput {
|
|
|
12
12
|
name: string;
|
|
13
13
|
}
|
|
14
14
|
|
|
15
|
-
export function createTeam(
|
|
15
|
+
export async function createTeam(
|
|
16
|
+
provider: DatabaseProvider,
|
|
17
|
+
input: CreateTeamInput
|
|
18
|
+
): Promise<TeamRow> {
|
|
16
19
|
const id = `team-${nanoid(10)}`;
|
|
17
20
|
const now = new Date().toISOString();
|
|
18
21
|
|
|
19
|
-
run(
|
|
20
|
-
db,
|
|
22
|
+
await provider.run(
|
|
21
23
|
`
|
|
22
24
|
INSERT INTO teams (id, repo_url, repo_path, name, created_at)
|
|
23
25
|
VALUES (?, ?, ?, ?, ?)
|
|
@@ -25,21 +27,27 @@ export function createTeam(db: Database, input: CreateTeamInput): TeamRow {
|
|
|
25
27
|
[id, input.repoUrl, input.repoPath, input.name, now]
|
|
26
28
|
);
|
|
27
29
|
|
|
28
|
-
return getTeamById(
|
|
30
|
+
return (await getTeamById(provider, id))!;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
|
-
export function getTeamById(
|
|
32
|
-
|
|
33
|
+
export async function getTeamById(
|
|
34
|
+
provider: DatabaseProvider,
|
|
35
|
+
id: string
|
|
36
|
+
): Promise<TeamRow | undefined> {
|
|
37
|
+
return await provider.queryOne<TeamRow>('SELECT * FROM teams WHERE id = ?', [id]);
|
|
33
38
|
}
|
|
34
39
|
|
|
35
|
-
export function getTeamByName(
|
|
36
|
-
|
|
40
|
+
export async function getTeamByName(
|
|
41
|
+
provider: DatabaseProvider,
|
|
42
|
+
name: string
|
|
43
|
+
): Promise<TeamRow | undefined> {
|
|
44
|
+
return await provider.queryOne<TeamRow>('SELECT * FROM teams WHERE name = ?', [name]);
|
|
37
45
|
}
|
|
38
46
|
|
|
39
|
-
export function getAllTeams(
|
|
40
|
-
return queryAll<TeamRow>(
|
|
47
|
+
export async function getAllTeams(provider: DatabaseProvider): Promise<TeamRow[]> {
|
|
48
|
+
return await provider.queryAll<TeamRow>('SELECT * FROM teams ORDER BY created_at');
|
|
41
49
|
}
|
|
42
50
|
|
|
43
|
-
export function deleteTeam(
|
|
44
|
-
run(
|
|
51
|
+
export async function deleteTeam(provider: DatabaseProvider, id: string): Promise<void> {
|
|
52
|
+
await provider.run('DELETE FROM teams WHERE id = ?', [id]);
|
|
45
53
|
}
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
import { mkdtempSync, writeFileSync } from 'fs';
|
|
4
4
|
import { tmpdir } from 'os';
|
|
5
5
|
import { join } from 'path';
|
|
6
|
-
import type { Database } from 'sql.js';
|
|
7
6
|
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
8
7
|
import { TokenStore } from '../../auth/token-store.js';
|
|
9
8
|
import type { JiraConfig } from '../../config/schema.js';
|
|
10
9
|
import { queryAll, run } from '../../db/client.js';
|
|
10
|
+
import { SqliteProvider } from '../../db/provider.js';
|
|
11
11
|
import { createStory, getStoryById } from '../../db/queries/stories.js';
|
|
12
12
|
import { createTestDatabase } from '../../db/queries/test-helpers.js';
|
|
13
13
|
import { repairMissedAssignmentHooks } from './sync.js';
|
|
@@ -20,7 +20,7 @@ vi.mock('./stories.js');
|
|
|
20
20
|
vi.mock('./transitions.js');
|
|
21
21
|
|
|
22
22
|
describe('repairMissedAssignmentHooks', () => {
|
|
23
|
-
let db:
|
|
23
|
+
let db: SqliteProvider;
|
|
24
24
|
let envDir: string;
|
|
25
25
|
|
|
26
26
|
const baseConfig: JiraConfig = {
|
|
@@ -53,34 +53,35 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
53
53
|
|
|
54
54
|
function addJiraColumnsToStories(): void {
|
|
55
55
|
// The test helper schema only has jira_issue_key. Add the other Jira columns.
|
|
56
|
-
const columnInfo = queryAll<{ name: string }>(db, 'PRAGMA table_info(stories)');
|
|
56
|
+
const columnInfo = queryAll<{ name: string }>(db.db, 'PRAGMA table_info(stories)');
|
|
57
57
|
const columnNames = columnInfo.map(c => c.name);
|
|
58
58
|
|
|
59
59
|
if (!columnNames.includes('jira_issue_id')) {
|
|
60
|
-
run(db, 'ALTER TABLE stories ADD COLUMN jira_issue_id TEXT');
|
|
60
|
+
run(db.db, 'ALTER TABLE stories ADD COLUMN jira_issue_id TEXT');
|
|
61
61
|
}
|
|
62
62
|
if (!columnNames.includes('jira_project_key')) {
|
|
63
|
-
run(db, 'ALTER TABLE stories ADD COLUMN jira_project_key TEXT');
|
|
63
|
+
run(db.db, 'ALTER TABLE stories ADD COLUMN jira_project_key TEXT');
|
|
64
64
|
}
|
|
65
65
|
if (!columnNames.includes('jira_subtask_key')) {
|
|
66
|
-
run(db, 'ALTER TABLE stories ADD COLUMN jira_subtask_key TEXT');
|
|
66
|
+
run(db.db, 'ALTER TABLE stories ADD COLUMN jira_subtask_key TEXT');
|
|
67
67
|
}
|
|
68
68
|
if (!columnNames.includes('jira_subtask_id')) {
|
|
69
|
-
run(db, 'ALTER TABLE stories ADD COLUMN jira_subtask_id TEXT');
|
|
69
|
+
run(db.db, 'ALTER TABLE stories ADD COLUMN jira_subtask_id TEXT');
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
beforeEach(async () => {
|
|
74
|
-
|
|
74
|
+
const rawDb = await createTestDatabase();
|
|
75
|
+
db = new SqliteProvider(rawDb);
|
|
75
76
|
envDir = mkdtempSync(join(tmpdir(), 'hive-repair-test-'));
|
|
76
77
|
// Create a manager agent for logging purposes
|
|
77
|
-
db.run(`INSERT INTO agents (id, type, status) VALUES ('manager', 'tech_lead', 'idle')`);
|
|
78
|
+
db.db.run(`INSERT INTO agents (id, type, status) VALUES ('manager', 'tech_lead', 'idle')`);
|
|
78
79
|
// Create a team
|
|
79
|
-
db.run(
|
|
80
|
+
db.db.run(
|
|
80
81
|
`INSERT INTO teams (id, repo_url, repo_path, name) VALUES ('team-test', 'https://github.com/test/test.git', 'repos/test', 'test-team')`
|
|
81
82
|
);
|
|
82
83
|
// Create a working agent
|
|
83
|
-
db.run(
|
|
84
|
+
db.db.run(
|
|
84
85
|
`INSERT INTO agents (id, type, status, team_id, tmux_session) VALUES ('agent-senior-1', 'senior', 'working', 'team-test', 'hive-senior-test-team')`
|
|
85
86
|
);
|
|
86
87
|
// Add missing Jira columns to test schema
|
|
@@ -94,12 +95,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
94
95
|
});
|
|
95
96
|
|
|
96
97
|
it('skips stories that already have a subtask key', async () => {
|
|
97
|
-
const story = createStory(db, {
|
|
98
|
+
const story = await createStory(db, {
|
|
98
99
|
title: 'Already has subtask',
|
|
99
100
|
description: 'Test',
|
|
100
101
|
});
|
|
101
102
|
run(
|
|
102
|
-
db,
|
|
103
|
+
db.db,
|
|
103
104
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, assigned_agent_id = ?, jira_subtask_key = ?, external_subtask_key = ?, status = ? WHERE id = ?`,
|
|
104
105
|
['TEST-1', 'TEST-1', 'agent-senior-1', 'TEST-2', 'TEST-2', 'in_progress', story.id]
|
|
105
106
|
);
|
|
@@ -110,11 +111,11 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
it('skips stories without jira_issue_key', async () => {
|
|
113
|
-
const story = createStory(db, {
|
|
114
|
+
const story = await createStory(db, {
|
|
114
115
|
title: 'No Jira key',
|
|
115
116
|
description: 'Test',
|
|
116
117
|
});
|
|
117
|
-
run(db, `UPDATE stories SET assigned_agent_id = ?, status = ? WHERE id = ?`, [
|
|
118
|
+
run(db.db, `UPDATE stories SET assigned_agent_id = ?, status = ? WHERE id = ?`, [
|
|
118
119
|
'agent-senior-1',
|
|
119
120
|
'in_progress',
|
|
120
121
|
story.id,
|
|
@@ -126,12 +127,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
it('skips stories without assigned_agent_id', async () => {
|
|
129
|
-
const story = createStory(db, {
|
|
130
|
+
const story = await createStory(db, {
|
|
130
131
|
title: 'Not assigned',
|
|
131
132
|
description: 'Test',
|
|
132
133
|
});
|
|
133
134
|
run(
|
|
134
|
-
db,
|
|
135
|
+
db.db,
|
|
135
136
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, status = ? WHERE id = ?`,
|
|
136
137
|
['TEST-1', 'TEST-1', 'planned', story.id]
|
|
137
138
|
);
|
|
@@ -142,12 +143,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
142
143
|
});
|
|
143
144
|
|
|
144
145
|
it('repairs assigned story missing subtask by creating subtask and posting comment', async () => {
|
|
145
|
-
const story = createStory(db, {
|
|
146
|
+
const story = await createStory(db, {
|
|
146
147
|
title: 'Needs repair',
|
|
147
148
|
description: 'Test',
|
|
148
149
|
});
|
|
149
150
|
run(
|
|
150
|
-
db,
|
|
151
|
+
db.db,
|
|
151
152
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, jira_project_key = ?, external_project_key = ?, assigned_agent_id = ?, status = ? WHERE id = ?`,
|
|
152
153
|
['TEST-10', 'TEST-10', 'TEST', 'TEST', 'agent-senior-1', 'in_progress', story.id]
|
|
153
154
|
);
|
|
@@ -199,7 +200,7 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
199
200
|
);
|
|
200
201
|
|
|
201
202
|
// Verify subtask key was persisted to DB (both legacy and external columns)
|
|
202
|
-
const updatedStory = getStoryById(db, story.id);
|
|
203
|
+
const updatedStory = await getStoryById(db, story.id);
|
|
203
204
|
expect(updatedStory?.jira_subtask_key).toBe('TEST-11');
|
|
204
205
|
expect(updatedStory?.jira_subtask_id).toBe('20001');
|
|
205
206
|
expect(updatedStory?.external_subtask_key).toBe('TEST-11');
|
|
@@ -216,12 +217,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
216
217
|
});
|
|
217
218
|
|
|
218
219
|
it('does not create duplicate subtasks when repair runs twice', async () => {
|
|
219
|
-
const story = createStory(db, {
|
|
220
|
+
const story = await createStory(db, {
|
|
220
221
|
title: 'Repair idempotency',
|
|
221
222
|
description: 'Test',
|
|
222
223
|
});
|
|
223
224
|
run(
|
|
224
|
-
db,
|
|
225
|
+
db.db,
|
|
225
226
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, assigned_agent_id = ?, status = ? WHERE id = ?`,
|
|
226
227
|
['TEST-20', 'TEST-20', 'agent-senior-1', 'in_progress', story.id]
|
|
227
228
|
);
|
|
@@ -258,12 +259,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
258
259
|
});
|
|
259
260
|
|
|
260
261
|
it('skips merged stories', async () => {
|
|
261
|
-
const story = createStory(db, {
|
|
262
|
+
const story = await createStory(db, {
|
|
262
263
|
title: 'Merged story',
|
|
263
264
|
description: 'Test',
|
|
264
265
|
});
|
|
265
266
|
run(
|
|
266
|
-
db,
|
|
267
|
+
db.db,
|
|
267
268
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, assigned_agent_id = ?, status = ? WHERE id = ?`,
|
|
268
269
|
['TEST-30', 'TEST-30', 'agent-senior-1', 'merged', story.id]
|
|
269
270
|
);
|
|
@@ -274,12 +275,12 @@ describe('repairMissedAssignmentHooks', () => {
|
|
|
274
275
|
});
|
|
275
276
|
|
|
276
277
|
it('handles API errors gracefully without crashing', async () => {
|
|
277
|
-
const story = createStory(db, {
|
|
278
|
+
const story = await createStory(db, {
|
|
278
279
|
title: 'Error story',
|
|
279
280
|
description: 'Test',
|
|
280
281
|
});
|
|
281
282
|
run(
|
|
282
|
-
db,
|
|
283
|
+
db.db,
|
|
283
284
|
`UPDATE stories SET jira_issue_key = ?, external_issue_key = ?, assigned_agent_id = ?, status = ? WHERE id = ?`,
|
|
284
285
|
['TEST-40', 'TEST-40', 'agent-senior-1', 'in_progress', story.id]
|
|
285
286
|
);
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { mkdtempSync, rmSync } from 'fs';
|
|
4
4
|
import { tmpdir } from 'os';
|
|
5
5
|
import { join } from 'path';
|
|
6
|
-
import type { Database } from 'sql.js';
|
|
7
6
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
8
7
|
import { TokenStore } from '../../auth/token-store.js';
|
|
9
8
|
import type { JiraConfig } from '../../config/schema.js';
|
|
9
|
+
import { SqliteProvider } from '../../db/provider.js';
|
|
10
10
|
import { createStory } from '../../db/queries/stories.js';
|
|
11
11
|
import { createTestDatabase } from '../../db/queries/test-helpers.js';
|
|
12
12
|
import { AnthropicProvider } from '../../llm/anthropic.js';
|
|
@@ -260,7 +260,7 @@ describe('Jira Story Creation', () => {
|
|
|
260
260
|
});
|
|
261
261
|
|
|
262
262
|
describe('Story Points Fallback', () => {
|
|
263
|
-
let db:
|
|
263
|
+
let db: SqliteProvider;
|
|
264
264
|
let envDir: string;
|
|
265
265
|
let tokenStore: TokenStore;
|
|
266
266
|
|
|
@@ -274,7 +274,8 @@ describe('Jira Story Creation', () => {
|
|
|
274
274
|
};
|
|
275
275
|
|
|
276
276
|
beforeEach(async () => {
|
|
277
|
-
|
|
277
|
+
const rawDb = await createTestDatabase();
|
|
278
|
+
db = new SqliteProvider(rawDb);
|
|
278
279
|
envDir = mkdtempSync(join(tmpdir(), 'hive-test-'));
|
|
279
280
|
tokenStore = new TokenStore(envDir);
|
|
280
281
|
|
|
@@ -296,7 +297,7 @@ describe('Jira Story Creation', () => {
|
|
|
296
297
|
|
|
297
298
|
it('should use complexity_score when story_points is null', async () => {
|
|
298
299
|
const { updateStory } = await import('../../db/queries/stories.js');
|
|
299
|
-
const story = createStory(db, {
|
|
300
|
+
const story = await createStory(db, {
|
|
300
301
|
title: 'Test Story',
|
|
301
302
|
description: 'Test description',
|
|
302
303
|
requirementId: null,
|
|
@@ -305,15 +306,14 @@ describe('Jira Story Creation', () => {
|
|
|
305
306
|
});
|
|
306
307
|
|
|
307
308
|
// Update with complexity_score but leave story_points null
|
|
308
|
-
updateStory(db, story.id, {
|
|
309
|
+
await updateStory(db, story.id, {
|
|
309
310
|
complexityScore: 5,
|
|
310
311
|
storyPoints: null,
|
|
311
312
|
});
|
|
312
313
|
|
|
313
|
-
const updatedStory = (await
|
|
314
|
-
db
|
|
315
|
-
|
|
316
|
-
)!;
|
|
314
|
+
const updatedStory = (await (
|
|
315
|
+
await import('../../db/queries/stories.js')
|
|
316
|
+
).getStoryById(db, story.id))!;
|
|
317
317
|
|
|
318
318
|
await syncStoryToJira(db, tokenStore, mockConfig, updatedStory);
|
|
319
319
|
|
|
@@ -329,7 +329,7 @@ describe('Jira Story Creation', () => {
|
|
|
329
329
|
|
|
330
330
|
it('should use story_points when both story_points and complexity_score are set', async () => {
|
|
331
331
|
const { updateStory } = await import('../../db/queries/stories.js');
|
|
332
|
-
const story = createStory(db, {
|
|
332
|
+
const story = await createStory(db, {
|
|
333
333
|
title: 'Test Story',
|
|
334
334
|
description: 'Test description',
|
|
335
335
|
requirementId: null,
|
|
@@ -338,15 +338,14 @@ describe('Jira Story Creation', () => {
|
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
// Update with both complexity_score and story_points
|
|
341
|
-
updateStory(db, story.id, {
|
|
341
|
+
await updateStory(db, story.id, {
|
|
342
342
|
complexityScore: 5,
|
|
343
343
|
storyPoints: 8,
|
|
344
344
|
});
|
|
345
345
|
|
|
346
|
-
const updatedStory = (await
|
|
347
|
-
db
|
|
348
|
-
|
|
349
|
-
)!;
|
|
346
|
+
const updatedStory = (await (
|
|
347
|
+
await import('../../db/queries/stories.js')
|
|
348
|
+
).getStoryById(db, story.id))!;
|
|
350
349
|
|
|
351
350
|
await syncStoryToJira(db, tokenStore, mockConfig, updatedStory);
|
|
352
351
|
|
|
@@ -361,7 +360,7 @@ describe('Jira Story Creation', () => {
|
|
|
361
360
|
});
|
|
362
361
|
|
|
363
362
|
it('should not include story points field when both are null', async () => {
|
|
364
|
-
const story = createStory(db, {
|
|
363
|
+
const story = await createStory(db, {
|
|
365
364
|
title: 'Test Story',
|
|
366
365
|
description: 'Test description',
|
|
367
366
|
requirementId: null,
|
|
@@ -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 { loadEnvIntoProcess } from '../../auth/env-store.js';
|
|
5
4
|
import type { TokenStore } from '../../auth/token-store.js';
|
|
6
5
|
import type { JiraConfig } from '../../config/schema.js';
|
|
7
6
|
import type { StoryRow } from '../../db/client.js';
|
|
7
|
+
import type { DatabaseProvider } from '../../db/provider.js';
|
|
8
8
|
import { createSyncRecord, getSyncRecordByEntity } from '../../db/queries/integration-sync.js';
|
|
9
9
|
import { updateRequirement, type RequirementRow } from '../../db/queries/requirements.js';
|
|
10
10
|
import { getStoryById, getStoryDependencies, updateStory } from '../../db/queries/stories.js';
|
|
@@ -204,7 +204,7 @@ export async function tryMoveToActiveSprint(
|
|
|
204
204
|
* and moves stories to the active sprint.
|
|
205
205
|
*/
|
|
206
206
|
export async function syncRequirementToJira(
|
|
207
|
-
db:
|
|
207
|
+
db: DatabaseProvider,
|
|
208
208
|
tokenStore: TokenStore,
|
|
209
209
|
config: JiraConfig,
|
|
210
210
|
requirement: RequirementRow,
|
|
@@ -260,14 +260,14 @@ export async function syncRequirementToJira(
|
|
|
260
260
|
result.epicId = epic.id;
|
|
261
261
|
|
|
262
262
|
// Update requirement with epic info (provider-agnostic)
|
|
263
|
-
updateRequirement(db, requirement.id, {
|
|
263
|
+
await updateRequirement(db, requirement.id, {
|
|
264
264
|
externalEpicKey: epic.key,
|
|
265
265
|
externalEpicId: epic.id,
|
|
266
266
|
externalProvider: 'jira',
|
|
267
267
|
});
|
|
268
268
|
|
|
269
269
|
// Record sync state
|
|
270
|
-
createSyncRecord(db, {
|
|
270
|
+
await createSyncRecord(db, {
|
|
271
271
|
entityType: 'requirement',
|
|
272
272
|
entityId: requirement.id,
|
|
273
273
|
provider: 'jira',
|
|
@@ -284,7 +284,7 @@ export async function syncRequirementToJira(
|
|
|
284
284
|
const createdStoryKeys: string[] = [];
|
|
285
285
|
|
|
286
286
|
for (const storyId of storyIds) {
|
|
287
|
-
const story = getStoryById(db, storyId);
|
|
287
|
+
const story = await getStoryById(db, storyId);
|
|
288
288
|
if (!story) {
|
|
289
289
|
result.errors.push(`Story ${storyId} not found in local DB`);
|
|
290
290
|
continue;
|
|
@@ -296,7 +296,7 @@ export async function syncRequirementToJira(
|
|
|
296
296
|
storyKeyMap[storyId] = story.jira_issue_key;
|
|
297
297
|
continue;
|
|
298
298
|
}
|
|
299
|
-
const existingSync = getSyncRecordByEntity(db, 'story', storyId, 'jira');
|
|
299
|
+
const existingSync = await getSyncRecordByEntity(db, 'story', storyId, 'jira');
|
|
300
300
|
if (existingSync && existingSync.sync_status === 'synced') {
|
|
301
301
|
logger.debug(`Story ${storyId} already has sync record, skipping Jira creation`);
|
|
302
302
|
continue;
|
|
@@ -330,7 +330,7 @@ export async function syncRequirementToJira(
|
|
|
330
330
|
const jiraStory = await createIssue(client, { fields } as any);
|
|
331
331
|
|
|
332
332
|
// Update local story with external integration info
|
|
333
|
-
updateStory(db, storyId, {
|
|
333
|
+
await updateStory(db, storyId, {
|
|
334
334
|
externalIssueKey: jiraStory.key,
|
|
335
335
|
externalIssueId: jiraStory.id,
|
|
336
336
|
externalProjectKey: config.project_key,
|
|
@@ -338,7 +338,7 @@ export async function syncRequirementToJira(
|
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
// Record sync state
|
|
341
|
-
createSyncRecord(db, {
|
|
341
|
+
await createSyncRecord(db, {
|
|
342
342
|
entityType: 'story',
|
|
343
343
|
entityId: storyId,
|
|
344
344
|
provider: 'jira',
|
|
@@ -363,7 +363,7 @@ export async function syncRequirementToJira(
|
|
|
363
363
|
const jiraKey = storyKeyMap[storyId];
|
|
364
364
|
if (!jiraKey) continue;
|
|
365
365
|
|
|
366
|
-
const dependencies = getStoryDependencies(db, storyId);
|
|
366
|
+
const dependencies = await getStoryDependencies(db, storyId);
|
|
367
367
|
for (const dep of dependencies) {
|
|
368
368
|
const depJiraKey = storyKeyMap[dep.id];
|
|
369
369
|
if (!depJiraKey) continue;
|
|
@@ -385,7 +385,7 @@ export async function syncRequirementToJira(
|
|
|
385
385
|
const movedToSprint = await tryMoveToActiveSprint(client, config, createdStoryKeys);
|
|
386
386
|
if (movedToSprint) {
|
|
387
387
|
for (const { storyId } of result.stories) {
|
|
388
|
-
updateStory(db, storyId, { inSprint: true });
|
|
388
|
+
await updateStory(db, storyId, { inSprint: true });
|
|
389
389
|
}
|
|
390
390
|
}
|
|
391
391
|
|
|
@@ -398,7 +398,7 @@ export async function syncRequirementToJira(
|
|
|
398
398
|
* Moves the story to the active sprint after creation.
|
|
399
399
|
*/
|
|
400
400
|
export async function syncStoryToJira(
|
|
401
|
-
db:
|
|
401
|
+
db: DatabaseProvider,
|
|
402
402
|
tokenStore: TokenStore,
|
|
403
403
|
config: JiraConfig,
|
|
404
404
|
story: StoryRow,
|
|
@@ -416,7 +416,7 @@ export async function syncStoryToJira(
|
|
|
416
416
|
let epicKey: string | undefined;
|
|
417
417
|
if (story.requirement_id) {
|
|
418
418
|
const { getRequirementById } = await import('../../db/queries/requirements.js');
|
|
419
|
-
const req = getRequirementById(db, story.requirement_id);
|
|
419
|
+
const req = await getRequirementById(db, story.requirement_id);
|
|
420
420
|
if (req?.external_epic_key) {
|
|
421
421
|
epicKey = req.external_epic_key;
|
|
422
422
|
}
|
|
@@ -449,7 +449,7 @@ export async function syncStoryToJira(
|
|
|
449
449
|
const jiraStory = await createIssue(client, { fields } as any);
|
|
450
450
|
|
|
451
451
|
// Update local story with external integration info
|
|
452
|
-
updateStory(db, story.id, {
|
|
452
|
+
await updateStory(db, story.id, {
|
|
453
453
|
externalIssueKey: jiraStory.key,
|
|
454
454
|
externalIssueId: jiraStory.id,
|
|
455
455
|
externalProjectKey: config.project_key,
|
|
@@ -457,7 +457,7 @@ export async function syncStoryToJira(
|
|
|
457
457
|
});
|
|
458
458
|
|
|
459
459
|
// Record sync
|
|
460
|
-
createSyncRecord(db, {
|
|
460
|
+
await createSyncRecord(db, {
|
|
461
461
|
entityType: 'story',
|
|
462
462
|
entityId: story.id,
|
|
463
463
|
provider: 'jira',
|
|
@@ -467,7 +467,7 @@ export async function syncStoryToJira(
|
|
|
467
467
|
// Move to active sprint
|
|
468
468
|
const movedToSprint = await tryMoveToActiveSprint(client, config, [jiraStory.key]);
|
|
469
469
|
if (movedToSprint) {
|
|
470
|
-
updateStory(db, story.id, { inSprint: true });
|
|
470
|
+
await updateStory(db, story.id, { inSprint: true });
|
|
471
471
|
}
|
|
472
472
|
|
|
473
473
|
return { jiraKey: jiraStory.key, jiraId: jiraStory.id };
|