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,9 +1,9 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
3
|
import { nanoid } from 'nanoid';
|
|
4
|
-
import type { Database } from 'sql.js';
|
|
5
4
|
import { deleteStoryMarkdown, writeStoryMarkdown } from '../../utils/story-markdown.js';
|
|
6
|
-
import {
|
|
5
|
+
import { type StoryRow } from '../client.js';
|
|
6
|
+
import type { DatabaseProvider } from '../provider.js';
|
|
7
7
|
|
|
8
8
|
export type { StoryRow };
|
|
9
9
|
|
|
@@ -56,15 +56,18 @@ export interface UpdateStoryInput {
|
|
|
56
56
|
inSprint?: boolean;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
export function createStory(
|
|
59
|
+
export async function createStory(
|
|
60
|
+
provider: DatabaseProvider,
|
|
61
|
+
input: CreateStoryInput,
|
|
62
|
+
storiesDir?: string
|
|
63
|
+
): Promise<StoryRow> {
|
|
60
64
|
const id = `STORY-${nanoid(6).toUpperCase()}`;
|
|
61
65
|
const acceptanceCriteria = input.acceptanceCriteria
|
|
62
66
|
? JSON.stringify(input.acceptanceCriteria)
|
|
63
67
|
: null;
|
|
64
68
|
const now = new Date().toISOString();
|
|
65
69
|
|
|
66
|
-
run(
|
|
67
|
-
db,
|
|
70
|
+
await provider.run(
|
|
68
71
|
`
|
|
69
72
|
INSERT INTO stories (id, requirement_id, team_id, title, description, acceptance_criteria, created_at, updated_at)
|
|
70
73
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
@@ -81,52 +84,71 @@ export function createStory(db: Database, input: CreateStoryInput, storiesDir?:
|
|
|
81
84
|
]
|
|
82
85
|
);
|
|
83
86
|
|
|
84
|
-
const story = getStoryById(
|
|
87
|
+
const story = (await getStoryById(provider, id))!;
|
|
85
88
|
|
|
86
89
|
if (storiesDir) {
|
|
87
90
|
const markdownPath = writeStoryMarkdown(storiesDir, story);
|
|
88
|
-
run(
|
|
91
|
+
await provider.run('UPDATE stories SET markdown_path = ? WHERE id = ?', [markdownPath, id]);
|
|
89
92
|
story.markdown_path = markdownPath;
|
|
90
93
|
}
|
|
91
94
|
|
|
92
95
|
return story;
|
|
93
96
|
}
|
|
94
97
|
|
|
95
|
-
export function getStoryById(
|
|
96
|
-
|
|
98
|
+
export async function getStoryById(
|
|
99
|
+
provider: DatabaseProvider,
|
|
100
|
+
id: string
|
|
101
|
+
): Promise<StoryRow | undefined> {
|
|
102
|
+
return await provider.queryOne<StoryRow>('SELECT * FROM stories WHERE id = ? COLLATE NOCASE', [
|
|
103
|
+
id,
|
|
104
|
+
]);
|
|
97
105
|
}
|
|
98
106
|
|
|
99
|
-
export function getStoriesByRequirement(
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
export async function getStoriesByRequirement(
|
|
108
|
+
provider: DatabaseProvider,
|
|
109
|
+
requirementId: string
|
|
110
|
+
): Promise<StoryRow[]> {
|
|
111
|
+
return await provider.queryAll<StoryRow>(
|
|
102
112
|
'SELECT * FROM stories WHERE requirement_id = ? ORDER BY created_at',
|
|
103
113
|
[requirementId]
|
|
104
114
|
);
|
|
105
115
|
}
|
|
106
116
|
|
|
107
|
-
export function getStoriesByTeam(
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
export async function getStoriesByTeam(
|
|
118
|
+
provider: DatabaseProvider,
|
|
119
|
+
teamId: string
|
|
120
|
+
): Promise<StoryRow[]> {
|
|
121
|
+
return await provider.queryAll<StoryRow>(
|
|
122
|
+
'SELECT * FROM stories WHERE team_id = ? ORDER BY created_at',
|
|
123
|
+
[teamId]
|
|
124
|
+
);
|
|
111
125
|
}
|
|
112
126
|
|
|
113
|
-
export function getStoriesByStatus(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
export async function getStoriesByStatus(
|
|
128
|
+
provider: DatabaseProvider,
|
|
129
|
+
status: StoryStatus
|
|
130
|
+
): Promise<StoryRow[]> {
|
|
131
|
+
return await provider.queryAll<StoryRow>(
|
|
132
|
+
'SELECT * FROM stories WHERE status = ? ORDER BY created_at',
|
|
133
|
+
[status]
|
|
134
|
+
);
|
|
117
135
|
}
|
|
118
136
|
|
|
119
|
-
export function getStoriesByAgent(
|
|
120
|
-
|
|
121
|
-
|
|
137
|
+
export async function getStoriesByAgent(
|
|
138
|
+
provider: DatabaseProvider,
|
|
139
|
+
agentId: string
|
|
140
|
+
): Promise<StoryRow[]> {
|
|
141
|
+
return await provider.queryAll<StoryRow>(
|
|
122
142
|
'SELECT * FROM stories WHERE assigned_agent_id = ? ORDER BY created_at',
|
|
123
143
|
[agentId]
|
|
124
144
|
);
|
|
125
145
|
}
|
|
126
146
|
|
|
127
|
-
export function getActiveStoriesByAgent(
|
|
128
|
-
|
|
129
|
-
|
|
147
|
+
export async function getActiveStoriesByAgent(
|
|
148
|
+
provider: DatabaseProvider,
|
|
149
|
+
agentId: string
|
|
150
|
+
): Promise<StoryRow[]> {
|
|
151
|
+
return await provider.queryAll<StoryRow>(
|
|
130
152
|
`
|
|
131
153
|
SELECT * FROM stories
|
|
132
154
|
WHERE assigned_agent_id = ?
|
|
@@ -137,35 +159,31 @@ export function getActiveStoriesByAgent(db: Database, agentId: string): StoryRow
|
|
|
137
159
|
);
|
|
138
160
|
}
|
|
139
161
|
|
|
140
|
-
export function getAllStories(
|
|
141
|
-
return queryAll<StoryRow>(
|
|
162
|
+
export async function getAllStories(provider: DatabaseProvider): Promise<StoryRow[]> {
|
|
163
|
+
return await provider.queryAll<StoryRow>('SELECT * FROM stories ORDER BY created_at DESC');
|
|
142
164
|
}
|
|
143
165
|
|
|
144
|
-
export function getPlannedStories(
|
|
145
|
-
return queryAll<StoryRow>(
|
|
146
|
-
db,
|
|
147
|
-
`
|
|
166
|
+
export async function getPlannedStories(provider: DatabaseProvider): Promise<StoryRow[]> {
|
|
167
|
+
return await provider.queryAll<StoryRow>(`
|
|
148
168
|
SELECT * FROM stories
|
|
149
169
|
WHERE status = 'planned'
|
|
150
170
|
ORDER BY story_points DESC, created_at
|
|
151
|
-
`
|
|
152
|
-
);
|
|
171
|
+
`);
|
|
153
172
|
}
|
|
154
173
|
|
|
155
|
-
export function getInProgressStories(
|
|
156
|
-
return queryAll<StoryRow>(
|
|
157
|
-
db,
|
|
158
|
-
`
|
|
174
|
+
export async function getInProgressStories(provider: DatabaseProvider): Promise<StoryRow[]> {
|
|
175
|
+
return await provider.queryAll<StoryRow>(`
|
|
159
176
|
SELECT * FROM stories
|
|
160
177
|
WHERE status IN ('in_progress', 'review', 'qa', 'qa_failed')
|
|
161
178
|
ORDER BY created_at
|
|
162
|
-
`
|
|
163
|
-
);
|
|
179
|
+
`);
|
|
164
180
|
}
|
|
165
181
|
|
|
166
|
-
export function getStoryPointsByTeam(
|
|
167
|
-
|
|
168
|
-
|
|
182
|
+
export async function getStoryPointsByTeam(
|
|
183
|
+
provider: DatabaseProvider,
|
|
184
|
+
teamId: string
|
|
185
|
+
): Promise<number> {
|
|
186
|
+
const result = await provider.queryOne<{ total: number }>(
|
|
169
187
|
`
|
|
170
188
|
SELECT COALESCE(SUM(story_points), 0) as total
|
|
171
189
|
FROM stories
|
|
@@ -176,12 +194,12 @@ export function getStoryPointsByTeam(db: Database, teamId: string): number {
|
|
|
176
194
|
return result?.total || 0;
|
|
177
195
|
}
|
|
178
196
|
|
|
179
|
-
export function updateStory(
|
|
180
|
-
|
|
197
|
+
export async function updateStory(
|
|
198
|
+
provider: DatabaseProvider,
|
|
181
199
|
id: string,
|
|
182
200
|
input: UpdateStoryInput,
|
|
183
201
|
storiesDir?: string
|
|
184
|
-
): StoryRow | undefined {
|
|
202
|
+
): Promise<StoryRow | undefined> {
|
|
185
203
|
const updates: string[] = ['updated_at = ?'];
|
|
186
204
|
const values: (string | number | null)[] = [new Date().toISOString()];
|
|
187
205
|
|
|
@@ -276,18 +294,18 @@ export function updateStory(
|
|
|
276
294
|
}
|
|
277
295
|
|
|
278
296
|
if (updates.length === 1) {
|
|
279
|
-
return getStoryById(
|
|
297
|
+
return await getStoryById(provider, id);
|
|
280
298
|
}
|
|
281
299
|
|
|
282
300
|
values.push(id);
|
|
283
|
-
run(
|
|
301
|
+
await provider.run(`UPDATE stories SET ${updates.join(', ')} WHERE id = ?`, values);
|
|
284
302
|
|
|
285
|
-
const updatedStory = getStoryById(
|
|
303
|
+
const updatedStory = await getStoryById(provider, id);
|
|
286
304
|
|
|
287
305
|
if (storiesDir && updatedStory) {
|
|
288
306
|
const markdownPath = writeStoryMarkdown(storiesDir, updatedStory);
|
|
289
307
|
if (updatedStory.markdown_path !== markdownPath) {
|
|
290
|
-
run(
|
|
308
|
+
await provider.run('UPDATE stories SET markdown_path = ? WHERE id = ?', [markdownPath, id]);
|
|
291
309
|
updatedStory.markdown_path = markdownPath;
|
|
292
310
|
}
|
|
293
311
|
}
|
|
@@ -295,18 +313,28 @@ export function updateStory(
|
|
|
295
313
|
return updatedStory;
|
|
296
314
|
}
|
|
297
315
|
|
|
298
|
-
export function deleteStory(
|
|
316
|
+
export async function deleteStory(
|
|
317
|
+
provider: DatabaseProvider,
|
|
318
|
+
id: string,
|
|
319
|
+
storiesDir?: string
|
|
320
|
+
): Promise<void> {
|
|
299
321
|
if (storiesDir) {
|
|
300
322
|
deleteStoryMarkdown(storiesDir, id);
|
|
301
323
|
}
|
|
302
|
-
run(
|
|
303
|
-
|
|
324
|
+
await provider.run(
|
|
325
|
+
'DELETE FROM story_dependencies WHERE story_id = ? OR depends_on_story_id = ?',
|
|
326
|
+
[id, id]
|
|
327
|
+
);
|
|
328
|
+
await provider.run('DELETE FROM stories WHERE id = ?', [id]);
|
|
304
329
|
}
|
|
305
330
|
|
|
306
331
|
// Story dependencies
|
|
307
|
-
export function addStoryDependency(
|
|
308
|
-
|
|
309
|
-
|
|
332
|
+
export async function addStoryDependency(
|
|
333
|
+
provider: DatabaseProvider,
|
|
334
|
+
storyId: string,
|
|
335
|
+
dependsOnStoryId: string
|
|
336
|
+
): Promise<void> {
|
|
337
|
+
await provider.run(
|
|
310
338
|
`
|
|
311
339
|
INSERT OR IGNORE INTO story_dependencies (story_id, depends_on_story_id)
|
|
312
340
|
VALUES (?, ?)
|
|
@@ -315,20 +343,22 @@ export function addStoryDependency(db: Database, storyId: string, dependsOnStory
|
|
|
315
343
|
);
|
|
316
344
|
}
|
|
317
345
|
|
|
318
|
-
export function removeStoryDependency(
|
|
319
|
-
|
|
346
|
+
export async function removeStoryDependency(
|
|
347
|
+
provider: DatabaseProvider,
|
|
320
348
|
storyId: string,
|
|
321
349
|
dependsOnStoryId: string
|
|
322
|
-
): void {
|
|
323
|
-
run(
|
|
324
|
-
|
|
325
|
-
dependsOnStoryId
|
|
326
|
-
|
|
350
|
+
): Promise<void> {
|
|
351
|
+
await provider.run(
|
|
352
|
+
'DELETE FROM story_dependencies WHERE story_id = ? AND depends_on_story_id = ?',
|
|
353
|
+
[storyId, dependsOnStoryId]
|
|
354
|
+
);
|
|
327
355
|
}
|
|
328
356
|
|
|
329
|
-
export function getStoryDependencies(
|
|
330
|
-
|
|
331
|
-
|
|
357
|
+
export async function getStoryDependencies(
|
|
358
|
+
provider: DatabaseProvider,
|
|
359
|
+
storyId: string
|
|
360
|
+
): Promise<StoryRow[]> {
|
|
361
|
+
return await provider.queryAll<StoryRow>(
|
|
332
362
|
`
|
|
333
363
|
SELECT s.* FROM stories s
|
|
334
364
|
JOIN story_dependencies sd ON s.id = sd.depends_on_story_id
|
|
@@ -338,9 +368,11 @@ export function getStoryDependencies(db: Database, storyId: string): StoryRow[]
|
|
|
338
368
|
);
|
|
339
369
|
}
|
|
340
370
|
|
|
341
|
-
export function getStoriesDependingOn(
|
|
342
|
-
|
|
343
|
-
|
|
371
|
+
export async function getStoriesDependingOn(
|
|
372
|
+
provider: DatabaseProvider,
|
|
373
|
+
storyId: string
|
|
374
|
+
): Promise<StoryRow[]> {
|
|
375
|
+
return await provider.queryAll<StoryRow>(
|
|
344
376
|
`
|
|
345
377
|
SELECT s.* FROM stories s
|
|
346
378
|
JOIN story_dependencies sd ON s.id = sd.story_id
|
|
@@ -357,12 +389,14 @@ export function getStoriesDependingOn(db: Database, storyId: string): StoryRow[]
|
|
|
357
389
|
* @param storyIds Array of story IDs to get dependencies for
|
|
358
390
|
* @returns Map of story ID to array of dependent story IDs
|
|
359
391
|
*/
|
|
360
|
-
export function getBatchStoryDependencies(
|
|
392
|
+
export async function getBatchStoryDependencies(
|
|
393
|
+
provider: DatabaseProvider,
|
|
394
|
+
storyIds: string[]
|
|
395
|
+
): Promise<Map<string, string[]>> {
|
|
361
396
|
if (storyIds.length === 0) return new Map();
|
|
362
397
|
|
|
363
398
|
const placeholders = storyIds.map(() => '?').join(',');
|
|
364
|
-
const rows = queryAll<{ story_id: string; depends_on_story_id: string }>(
|
|
365
|
-
db,
|
|
399
|
+
const rows = await provider.queryAll<{ story_id: string; depends_on_story_id: string }>(
|
|
366
400
|
`
|
|
367
401
|
SELECT sd.story_id, sd.depends_on_story_id
|
|
368
402
|
FROM story_dependencies sd
|
|
@@ -385,15 +419,14 @@ export function getBatchStoryDependencies(db: Database, storyIds: string[]): Map
|
|
|
385
419
|
return deps;
|
|
386
420
|
}
|
|
387
421
|
|
|
388
|
-
export function getStoryCounts(
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
422
|
+
export async function getStoryCounts(
|
|
423
|
+
provider: DatabaseProvider
|
|
424
|
+
): Promise<Record<StoryStatus, number>> {
|
|
425
|
+
const rows = await provider.queryAll<{ status: StoryStatus; count: number }>(`
|
|
392
426
|
SELECT status, COUNT(*) as count
|
|
393
427
|
FROM stories
|
|
394
428
|
GROUP BY status
|
|
395
|
-
`
|
|
396
|
-
);
|
|
429
|
+
`);
|
|
397
430
|
|
|
398
431
|
const counts: Record<StoryStatus, number> = {
|
|
399
432
|
draft: 0,
|
|
@@ -414,40 +447,34 @@ export function getStoryCounts(db: Database): Record<StoryStatus, number> {
|
|
|
414
447
|
return counts;
|
|
415
448
|
}
|
|
416
449
|
|
|
417
|
-
export function getStoriesWithOrphanedAssignments(
|
|
418
|
-
|
|
419
|
-
): Array<{ id: string; agent_id: string }
|
|
420
|
-
return queryAll<{ id: string; agent_id: string }>(
|
|
421
|
-
db,
|
|
422
|
-
`
|
|
450
|
+
export async function getStoriesWithOrphanedAssignments(
|
|
451
|
+
provider: DatabaseProvider
|
|
452
|
+
): Promise<Array<{ id: string; agent_id: string }>> {
|
|
453
|
+
return await provider.queryAll<{ id: string; agent_id: string }>(`
|
|
423
454
|
SELECT s.id, s.assigned_agent_id as agent_id
|
|
424
455
|
FROM stories s
|
|
425
456
|
WHERE s.assigned_agent_id IS NOT NULL
|
|
426
457
|
AND s.assigned_agent_id NOT IN (
|
|
427
458
|
SELECT id FROM agents WHERE status != 'terminated'
|
|
428
459
|
)
|
|
429
|
-
`
|
|
430
|
-
);
|
|
460
|
+
`);
|
|
431
461
|
}
|
|
432
462
|
|
|
433
|
-
export function getStaleInProgressStoriesWithoutAssignment(
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
463
|
+
export async function getStaleInProgressStoriesWithoutAssignment(
|
|
464
|
+
provider: DatabaseProvider
|
|
465
|
+
): Promise<Array<{ id: string }>> {
|
|
466
|
+
return await provider.queryAll<{ id: string }>(`
|
|
437
467
|
SELECT id
|
|
438
468
|
FROM stories
|
|
439
469
|
WHERE status = 'in_progress'
|
|
440
470
|
AND assigned_agent_id IS NULL
|
|
441
|
-
`
|
|
442
|
-
);
|
|
471
|
+
`);
|
|
443
472
|
}
|
|
444
473
|
|
|
445
|
-
export function getInProgressStoriesWithInconsistentAssignments(
|
|
446
|
-
|
|
447
|
-
): Array<{ id: string; agent_id: string }
|
|
448
|
-
return queryAll<{ id: string; agent_id: string }>(
|
|
449
|
-
db,
|
|
450
|
-
`
|
|
474
|
+
export async function getInProgressStoriesWithInconsistentAssignments(
|
|
475
|
+
provider: DatabaseProvider
|
|
476
|
+
): Promise<Array<{ id: string; agent_id: string }>> {
|
|
477
|
+
return await provider.queryAll<{ id: string; agent_id: string }>(`
|
|
451
478
|
SELECT s.id, s.assigned_agent_id as agent_id
|
|
452
479
|
FROM stories s
|
|
453
480
|
JOIN agents a ON a.id = s.assigned_agent_id
|
|
@@ -459,32 +486,36 @@ export function getInProgressStoriesWithInconsistentAssignments(
|
|
|
459
486
|
OR a.current_story_id IS NULL
|
|
460
487
|
OR a.current_story_id != s.id
|
|
461
488
|
)
|
|
462
|
-
`
|
|
463
|
-
);
|
|
489
|
+
`);
|
|
464
490
|
}
|
|
465
491
|
|
|
466
492
|
/** @deprecated Use getStoryByExternalKey instead */
|
|
467
|
-
export function getStoryByJiraKey(
|
|
468
|
-
|
|
469
|
-
|
|
493
|
+
export async function getStoryByJiraKey(
|
|
494
|
+
provider: DatabaseProvider,
|
|
495
|
+
jiraIssueKey: string
|
|
496
|
+
): Promise<StoryRow | undefined> {
|
|
497
|
+
return await provider.queryOne<StoryRow>(
|
|
470
498
|
'SELECT * FROM stories WHERE external_issue_key = ? OR jira_issue_key = ?',
|
|
471
499
|
[jiraIssueKey, jiraIssueKey]
|
|
472
500
|
);
|
|
473
501
|
}
|
|
474
502
|
|
|
475
|
-
export function getStoryByExternalKey(
|
|
476
|
-
|
|
503
|
+
export async function getStoryByExternalKey(
|
|
504
|
+
provider: DatabaseProvider,
|
|
477
505
|
externalIssueKey: string
|
|
478
|
-
): StoryRow | undefined {
|
|
479
|
-
return queryOne<StoryRow>(
|
|
480
|
-
db,
|
|
506
|
+
): Promise<StoryRow | undefined> {
|
|
507
|
+
return await provider.queryOne<StoryRow>(
|
|
481
508
|
'SELECT * FROM stories WHERE external_issue_key = ? OR jira_issue_key = ?',
|
|
482
509
|
[externalIssueKey, externalIssueKey]
|
|
483
510
|
);
|
|
484
511
|
}
|
|
485
512
|
|
|
486
|
-
export function updateStoryAssignment(
|
|
487
|
-
|
|
513
|
+
export async function updateStoryAssignment(
|
|
514
|
+
provider: DatabaseProvider,
|
|
515
|
+
storyId: string,
|
|
516
|
+
agentId: string | null
|
|
517
|
+
): Promise<void> {
|
|
518
|
+
await provider.run('UPDATE stories SET assigned_agent_id = ?, updated_at = ? WHERE id = ?', [
|
|
488
519
|
agentId,
|
|
489
520
|
new Date().toISOString(),
|
|
490
521
|
storyId,
|
|
@@ -1,20 +1,21 @@
|
|
|
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 } from 'vitest';
|
|
4
|
+
import { SqliteProvider } from '../provider.js';
|
|
5
5
|
import { createTeam, deleteTeam, getAllTeams, getTeamById, getTeamByName } from './teams.js';
|
|
6
6
|
import { createTestDatabase } from './test-helpers.js';
|
|
7
7
|
|
|
8
8
|
describe('teams queries', () => {
|
|
9
|
-
let db:
|
|
9
|
+
let db: SqliteProvider;
|
|
10
10
|
|
|
11
11
|
beforeEach(async () => {
|
|
12
|
-
|
|
12
|
+
const rawDb = await createTestDatabase();
|
|
13
|
+
db = new SqliteProvider(rawDb);
|
|
13
14
|
});
|
|
14
15
|
|
|
15
16
|
describe('createTeam', () => {
|
|
16
|
-
it('should create a team with all fields', () => {
|
|
17
|
-
const team = createTeam(db, {
|
|
17
|
+
it('should create a team with all fields', async () => {
|
|
18
|
+
const team = await createTeam(db, {
|
|
18
19
|
repoUrl: 'https://github.com/test/repo.git',
|
|
19
20
|
repoPath: '/path/to/repo',
|
|
20
21
|
name: 'Test Team',
|
|
@@ -27,14 +28,14 @@ describe('teams queries', () => {
|
|
|
27
28
|
expect(team.created_at).toBeDefined();
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
it('should generate unique IDs for each team', () => {
|
|
31
|
-
const team1 = createTeam(db, {
|
|
31
|
+
it('should generate unique IDs for each team', async () => {
|
|
32
|
+
const team1 = await createTeam(db, {
|
|
32
33
|
repoUrl: 'https://github.com/test/repo1.git',
|
|
33
34
|
repoPath: '/path/to/repo1',
|
|
34
35
|
name: 'Team 1',
|
|
35
36
|
});
|
|
36
37
|
|
|
37
|
-
const team2 = createTeam(db, {
|
|
38
|
+
const team2 = await createTeam(db, {
|
|
38
39
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
39
40
|
repoPath: '/path/to/repo2',
|
|
40
41
|
name: 'Team 2',
|
|
@@ -45,66 +46,66 @@ describe('teams queries', () => {
|
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
describe('getTeamById', () => {
|
|
48
|
-
it('should retrieve a team by ID', () => {
|
|
49
|
-
const created = createTeam(db, {
|
|
49
|
+
it('should retrieve a team by ID', async () => {
|
|
50
|
+
const created = await createTeam(db, {
|
|
50
51
|
repoUrl: 'https://github.com/test/repo.git',
|
|
51
52
|
repoPath: '/path/to/repo',
|
|
52
53
|
name: 'Test Team',
|
|
53
54
|
});
|
|
54
55
|
|
|
55
|
-
const retrieved = getTeamById(db, created.id);
|
|
56
|
+
const retrieved = await getTeamById(db, created.id);
|
|
56
57
|
|
|
57
58
|
expect(retrieved).toBeDefined();
|
|
58
59
|
expect(retrieved?.id).toBe(created.id);
|
|
59
60
|
expect(retrieved?.name).toBe('Test Team');
|
|
60
61
|
});
|
|
61
62
|
|
|
62
|
-
it('should return undefined for non-existent team', () => {
|
|
63
|
-
const result = getTeamById(db, 'non-existent-id');
|
|
63
|
+
it('should return undefined for non-existent team', async () => {
|
|
64
|
+
const result = await getTeamById(db, 'non-existent-id');
|
|
64
65
|
expect(result).toBeUndefined();
|
|
65
66
|
});
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
describe('getTeamByName', () => {
|
|
69
|
-
it('should retrieve a team by name', () => {
|
|
70
|
-
createTeam(db, {
|
|
70
|
+
it('should retrieve a team by name', async () => {
|
|
71
|
+
await createTeam(db, {
|
|
71
72
|
repoUrl: 'https://github.com/test/repo.git',
|
|
72
73
|
repoPath: '/path/to/repo',
|
|
73
74
|
name: 'Unique Team',
|
|
74
75
|
});
|
|
75
76
|
|
|
76
|
-
const retrieved = getTeamByName(db, 'Unique Team');
|
|
77
|
+
const retrieved = await getTeamByName(db, 'Unique Team');
|
|
77
78
|
|
|
78
79
|
expect(retrieved).toBeDefined();
|
|
79
80
|
expect(retrieved?.name).toBe('Unique Team');
|
|
80
81
|
});
|
|
81
82
|
|
|
82
|
-
it('should return undefined for non-existent team name', () => {
|
|
83
|
-
const result = getTeamByName(db, 'Non Existent Team');
|
|
83
|
+
it('should return undefined for non-existent team name', async () => {
|
|
84
|
+
const result = await getTeamByName(db, 'Non Existent Team');
|
|
84
85
|
expect(result).toBeUndefined();
|
|
85
86
|
});
|
|
86
87
|
});
|
|
87
88
|
|
|
88
89
|
describe('getAllTeams', () => {
|
|
89
|
-
it('should return empty array when no teams exist', () => {
|
|
90
|
-
const teams = getAllTeams(db);
|
|
90
|
+
it('should return empty array when no teams exist', async () => {
|
|
91
|
+
const teams = await getAllTeams(db);
|
|
91
92
|
expect(teams).toEqual([]);
|
|
92
93
|
});
|
|
93
94
|
|
|
94
|
-
it('should return all teams ordered by created_at', () => {
|
|
95
|
-
const team1 = createTeam(db, {
|
|
95
|
+
it('should return all teams ordered by created_at', async () => {
|
|
96
|
+
const team1 = await createTeam(db, {
|
|
96
97
|
repoUrl: 'https://github.com/test/repo1.git',
|
|
97
98
|
repoPath: '/path/to/repo1',
|
|
98
99
|
name: 'Team 1',
|
|
99
100
|
});
|
|
100
101
|
|
|
101
|
-
const team2 = createTeam(db, {
|
|
102
|
+
const team2 = await createTeam(db, {
|
|
102
103
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
103
104
|
repoPath: '/path/to/repo2',
|
|
104
105
|
name: 'Team 2',
|
|
105
106
|
});
|
|
106
107
|
|
|
107
|
-
const teams = getAllTeams(db);
|
|
108
|
+
const teams = await getAllTeams(db);
|
|
108
109
|
|
|
109
110
|
expect(teams).toHaveLength(2);
|
|
110
111
|
expect(teams[0].id).toBe(team1.id);
|
|
@@ -113,45 +114,45 @@ describe('teams queries', () => {
|
|
|
113
114
|
});
|
|
114
115
|
|
|
115
116
|
describe('deleteTeam', () => {
|
|
116
|
-
it('should delete a team', () => {
|
|
117
|
-
const team = createTeam(db, {
|
|
117
|
+
it('should delete a team', async () => {
|
|
118
|
+
const team = await createTeam(db, {
|
|
118
119
|
repoUrl: 'https://github.com/test/repo.git',
|
|
119
120
|
repoPath: '/path/to/repo',
|
|
120
121
|
name: 'Team to Delete',
|
|
121
122
|
});
|
|
122
123
|
|
|
123
|
-
deleteTeam(db, team.id);
|
|
124
|
+
await deleteTeam(db, team.id);
|
|
124
125
|
|
|
125
|
-
const retrieved = getTeamById(db, team.id);
|
|
126
|
+
const retrieved = await getTeamById(db, team.id);
|
|
126
127
|
expect(retrieved).toBeUndefined();
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
it('should not throw when deleting non-existent team', () => {
|
|
130
|
-
expect(
|
|
130
|
+
it('should not throw when deleting non-existent team', async () => {
|
|
131
|
+
await expect(deleteTeam(db, 'non-existent-id')).resolves.not.toThrow();
|
|
131
132
|
});
|
|
132
133
|
});
|
|
133
134
|
|
|
134
135
|
describe('edge cases', () => {
|
|
135
|
-
it('should handle special characters in team name', () => {
|
|
136
|
-
const team = createTeam(db, {
|
|
136
|
+
it('should handle special characters in team name', async () => {
|
|
137
|
+
const team = await createTeam(db, {
|
|
137
138
|
repoUrl: 'https://github.com/test/repo.git',
|
|
138
139
|
repoPath: '/path/to/repo',
|
|
139
140
|
name: 'Team with \'quotes\' and "double quotes"',
|
|
140
141
|
});
|
|
141
142
|
|
|
142
|
-
const retrieved = getTeamById(db, team.id);
|
|
143
|
+
const retrieved = await getTeamById(db, team.id);
|
|
143
144
|
expect(retrieved?.name).toBe('Team with \'quotes\' and "double quotes"');
|
|
144
145
|
});
|
|
145
146
|
|
|
146
|
-
it('should handle very long team names', () => {
|
|
147
|
+
it('should handle very long team names', async () => {
|
|
147
148
|
const longName = 'A'.repeat(500);
|
|
148
|
-
const team = createTeam(db, {
|
|
149
|
+
const team = await createTeam(db, {
|
|
149
150
|
repoUrl: 'https://github.com/test/repo.git',
|
|
150
151
|
repoPath: '/path/to/repo',
|
|
151
152
|
name: longName,
|
|
152
153
|
});
|
|
153
154
|
|
|
154
|
-
const retrieved = getTeamById(db, team.id);
|
|
155
|
+
const retrieved = await getTeamById(db, team.id);
|
|
155
156
|
expect(retrieved?.name).toBe(longName);
|
|
156
157
|
});
|
|
157
158
|
});
|