hungry-ghost-hive 0.48.0 → 0.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agents/base-agent.d.ts +11 -11
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +25 -25
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/base-agent.test.js +2 -1
- package/dist/agents/base-agent.test.js.map +1 -1
- package/dist/agents/intermediate.d.ts +2 -0
- package/dist/agents/intermediate.d.ts.map +1 -1
- package/dist/agents/intermediate.js +25 -18
- package/dist/agents/intermediate.js.map +1 -1
- package/dist/agents/junior.d.ts +2 -0
- package/dist/agents/junior.d.ts.map +1 -1
- package/dist/agents/junior.js +25 -18
- package/dist/agents/junior.js.map +1 -1
- package/dist/agents/qa.d.ts +2 -0
- package/dist/agents/qa.d.ts.map +1 -1
- package/dist/agents/qa.js +47 -38
- package/dist/agents/qa.js.map +1 -1
- package/dist/agents/senior.d.ts +2 -0
- package/dist/agents/senior.d.ts.map +1 -1
- package/dist/agents/senior.js +40 -27
- package/dist/agents/senior.js.map +1 -1
- package/dist/agents/tech-lead.d.ts +2 -0
- package/dist/agents/tech-lead.d.ts.map +1 -1
- package/dist/agents/tech-lead.js +37 -31
- package/dist/agents/tech-lead.js.map +1 -1
- package/dist/cli/commands/add-repo.js +2 -2
- package/dist/cli/commands/add-repo.js.map +1 -1
- package/dist/cli/commands/add-repo.test.js +1 -1
- package/dist/cli/commands/add-repo.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +12 -10
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/agents.test.js +7 -7
- package/dist/cli/commands/agents.test.js.map +1 -1
- package/dist/cli/commands/approach.js +2 -2
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/approvals.js +7 -7
- package/dist/cli/commands/approvals.js.map +1 -1
- package/dist/cli/commands/approvals.test.js +8 -8
- package/dist/cli/commands/approvals.test.js.map +1 -1
- package/dist/cli/commands/assign.js +4 -4
- package/dist/cli/commands/assign.js.map +1 -1
- package/dist/cli/commands/assign.test.js +18 -16
- package/dist/cli/commands/assign.test.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -8
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/cleanup.test.js +5 -1
- package/dist/cli/commands/cleanup.test.js.map +1 -1
- package/dist/cli/commands/escalations.js +9 -7
- package/dist/cli/commands/escalations.js.map +1 -1
- package/dist/cli/commands/escalations.test.js +2 -2
- package/dist/cli/commands/escalations.test.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +4 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.d.ts +2 -2
- package/dist/cli/commands/manager/agent-monitoring.d.ts.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.js +3 -3
- package/dist/cli/commands/manager/auditor-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.test.js +21 -14
- package/dist/cli/commands/manager/auditor-lifecycle.test.js.map +1 -1
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js +28 -23
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.d.ts +2 -2
- package/dist/cli/commands/manager/escalation-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.js +11 -10
- package/dist/cli/commands/manager/escalation-handler.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.test.js +8 -8
- package/dist/cli/commands/manager/escalation-handler.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.js +7 -7
- package/dist/cli/commands/manager/feature-sign-off.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.test.js +40 -31
- package/dist/cli/commands/manager/feature-sign-off.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.d.ts.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.js +12 -13
- package/dist/cli/commands/manager/feature-test-result.js.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.js +14 -15
- package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +26 -26
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/index.test.js +3 -3
- package/dist/cli/commands/manager/index.test.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts +2 -2
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.js +6 -7
- package/dist/cli/commands/manager/merged-story-cleanup.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.test.js +27 -18
- package/dist/cli/commands/manager/merged-story-cleanup.test.js.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +46 -38
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.js +25 -22
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -1
- package/dist/cli/commands/manager/spin-down.d.ts.map +1 -1
- package/dist/cli/commands/manager/spin-down.js +23 -19
- package/dist/cli/commands/manager/spin-down.js.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.d.ts +2 -3
- package/dist/cli/commands/manager/stale-escalations.d.ts.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-helpers.js +8 -8
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +2 -2
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.js +23 -22
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -1
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +6 -6
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/types.d.ts +2 -3
- package/dist/cli/commands/manager/types.d.ts.map +1 -1
- package/dist/cli/commands/manager/types.js.map +1 -1
- package/dist/cli/commands/msg.test.js +2 -2
- package/dist/cli/commands/msg.test.js.map +1 -1
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +17 -18
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/my-stories.test.js +2 -2
- package/dist/cli/commands/my-stories.test.js.map +1 -1
- package/dist/cli/commands/nuke.test.js +1 -1
- package/dist/cli/commands/nuke.test.js.map +1 -1
- package/dist/cli/commands/pr.js +32 -32
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/pr.test.js +10 -6
- package/dist/cli/commands/pr.test.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +4 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/progress.test.js +1 -1
- package/dist/cli/commands/progress.test.js.map +1 -1
- package/dist/cli/commands/req-headless.test.d.ts +2 -0
- package/dist/cli/commands/req-headless.test.d.ts.map +1 -0
- package/dist/cli/commands/req-headless.test.js +128 -0
- package/dist/cli/commands/req-headless.test.js.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +5 -1
- package/dist/cli/commands/req-spawn.test.js.map +1 -1
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +13 -14
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +7 -8
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/resume.test.js +1 -1
- package/dist/cli/commands/resume.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -40
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +1 -1
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/stories.js +9 -9
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cli/commands/stories.test.js +2 -2
- package/dist/cli/commands/stories.test.js.map +1 -1
- package/dist/cli/commands/teams.js +11 -11
- package/dist/cli/commands/teams.js.map +1 -1
- package/dist/cli/commands/teams.test.js +2 -2
- package/dist/cli/commands/teams.test.js.map +1 -1
- package/dist/cli/dashboard/index.d.ts +2 -2
- package/dist/cli/dashboard/index.d.ts.map +1 -1
- package/dist/cli/dashboard/index.js +29 -20
- package/dist/cli/dashboard/index.js.map +1 -1
- package/dist/cli/dashboard/index.test.js +34 -32
- package/dist/cli/dashboard/index.test.js.map +1 -1
- package/dist/cli/dashboard/panels/activity.d.ts +3 -3
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/activity.js +1 -1
- package/dist/cli/dashboard/panels/activity.js.map +1 -1
- package/dist/cli/dashboard/panels/agents.d.ts +3 -3
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/agents.js +2 -2
- package/dist/cli/dashboard/panels/agents.js.map +1 -1
- package/dist/cli/dashboard/panels/escalations.d.ts +3 -3
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/escalations.js +1 -1
- package/dist/cli/dashboard/panels/escalations.js.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.d.ts +3 -3
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.d.ts +3 -3
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.js +1 -1
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -1
- package/dist/config/schema.d.ts +85 -82
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/connectors/project-management/operations.d.ts +7 -7
- package/dist/connectors/project-management/operations.d.ts.map +1 -1
- package/dist/connectors/project-management/operations.js +2 -3
- package/dist/connectors/project-management/operations.js.map +1 -1
- package/dist/context-files/index.test.js +1 -0
- package/dist/context-files/index.test.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/postgres-provider.d.ts +43 -0
- package/dist/db/postgres-provider.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.d.ts +2 -0
- package/dist/db/postgres-provider.integration.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.js +399 -0
- package/dist/db/postgres-provider.integration.test.js.map +1 -0
- package/dist/db/postgres-provider.js +315 -0
- package/dist/db/postgres-provider.js.map +1 -0
- package/dist/db/postgres-provider.test.d.ts +2 -0
- package/dist/db/postgres-provider.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.test.js +72 -0
- package/dist/db/postgres-provider.test.js.map +1 -0
- package/dist/db/provider.d.ts +59 -0
- package/dist/db/provider.d.ts.map +1 -0
- package/dist/db/provider.js +121 -0
- package/dist/db/provider.js.map +1 -0
- package/dist/db/provider.test.d.ts +2 -0
- package/dist/db/provider.test.d.ts.map +1 -0
- package/dist/db/provider.test.js +226 -0
- package/dist/db/provider.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +13 -13
- package/dist/db/queries/agents.d.ts.map +1 -1
- package/dist/db/queries/agents.js +27 -28
- package/dist/db/queries/agents.js.map +1 -1
- package/dist/db/queries/agents.test.js +113 -111
- package/dist/db/queries/agents.test.js.map +1 -1
- package/dist/db/queries/escalations.d.ts +16 -16
- package/dist/db/queries/escalations.d.ts.map +1 -1
- package/dist/db/queries/escalations.js +34 -35
- package/dist/db/queries/escalations.js.map +1 -1
- package/dist/db/queries/escalations.test.js +133 -131
- package/dist/db/queries/escalations.test.js.map +1 -1
- package/dist/db/queries/heartbeat.d.ts +5 -5
- package/dist/db/queries/heartbeat.d.ts.map +1 -1
- package/dist/db/queries/heartbeat.js +7 -23
- package/dist/db/queries/heartbeat.js.map +1 -1
- package/dist/db/queries/heartbeat.test.js +76 -76
- package/dist/db/queries/heartbeat.test.js.map +1 -1
- package/dist/db/queries/integration-sync.d.ts +7 -7
- package/dist/db/queries/integration-sync.d.ts.map +1 -1
- package/dist/db/queries/integration-sync.js +13 -14
- package/dist/db/queries/integration-sync.js.map +1 -1
- package/dist/db/queries/logs.d.ts +10 -10
- package/dist/db/queries/logs.d.ts.map +1 -1
- package/dist/db/queries/logs.js +44 -42
- package/dist/db/queries/logs.js.map +1 -1
- package/dist/db/queries/logs.test.js +149 -146
- package/dist/db/queries/logs.test.js.map +1 -1
- package/dist/db/queries/messages.d.ts +6 -6
- package/dist/db/queries/messages.d.ts.map +1 -1
- package/dist/db/queries/messages.js +12 -11
- package/dist/db/queries/messages.js.map +1 -1
- package/dist/db/queries/messages.test.js +47 -46
- package/dist/db/queries/messages.test.js.map +1 -1
- package/dist/db/queries/pull-requests.d.ts +18 -18
- package/dist/db/queries/pull-requests.d.ts.map +1 -1
- package/dist/db/queries/pull-requests.js +50 -48
- package/dist/db/queries/pull-requests.js.map +1 -1
- package/dist/db/queries/pull-requests.test.js +195 -198
- package/dist/db/queries/pull-requests.test.js.map +1 -1
- package/dist/db/queries/requirements.d.ts +8 -8
- package/dist/db/queries/requirements.d.ts.map +1 -1
- package/dist/db/queries/requirements.js +17 -18
- package/dist/db/queries/requirements.js.map +1 -1
- package/dist/db/queries/requirements.test.js +83 -81
- package/dist/db/queries/requirements.test.js.map +1 -1
- package/dist/db/queries/stories.d.ts +29 -29
- package/dist/db/queries/stories.d.ts.map +1 -1
- package/dist/db/queries/stories.js +58 -64
- package/dist/db/queries/stories.js.map +1 -1
- package/dist/db/queries/stories.test.js +172 -170
- package/dist/db/queries/stories.test.js.map +1 -1
- package/dist/db/queries/teams.d.ts +6 -6
- package/dist/db/queries/teams.d.ts.map +1 -1
- package/dist/db/queries/teams.js +11 -12
- package/dist/db/queries/teams.js.map +1 -1
- package/dist/db/queries/teams.test.js +36 -34
- package/dist/db/queries/teams.test.js.map +1 -1
- package/dist/integrations/jira/repair.test.js +26 -24
- package/dist/integrations/jira/repair.test.js.map +1 -1
- package/dist/integrations/jira/stories.d.ts +3 -3
- package/dist/integrations/jira/stories.d.ts.map +1 -1
- package/dist/integrations/jira/stories.js +12 -12
- package/dist/integrations/jira/stories.js.map +1 -1
- package/dist/integrations/jira/stories.test.js +10 -8
- package/dist/integrations/jira/stories.test.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +7 -7
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +17 -20
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/integrations/jira/sync.test.js +63 -62
- package/dist/integrations/jira/sync.test.js.map +1 -1
- package/dist/integrations/jira/transitions.d.ts +3 -3
- package/dist/integrations/jira/transitions.d.ts.map +1 -1
- package/dist/integrations/jira/transitions.js +3 -3
- package/dist/integrations/jira/transitions.js.map +1 -1
- package/dist/orchestrator/agent-selector.d.ts +3 -3
- package/dist/orchestrator/agent-selector.d.ts.map +1 -1
- package/dist/orchestrator/agent-selector.js +5 -6
- package/dist/orchestrator/agent-selector.js.map +1 -1
- package/dist/orchestrator/dependency-resolver.d.ts +4 -4
- package/dist/orchestrator/dependency-resolver.d.ts.map +1 -1
- package/dist/orchestrator/dependency-resolver.js +6 -6
- package/dist/orchestrator/dependency-resolver.js.map +1 -1
- package/dist/orchestrator/feature-branch.d.ts +3 -3
- package/dist/orchestrator/feature-branch.d.ts.map +1 -1
- package/dist/orchestrator/feature-branch.js +9 -10
- package/dist/orchestrator/feature-branch.js.map +1 -1
- package/dist/orchestrator/feature-branch.test.js +80 -78
- package/dist/orchestrator/feature-branch.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +2 -2
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +10 -10
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +4 -4
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +90 -76
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +496 -374
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/dist/utils/auto-merge.d.ts.map +1 -1
- package/dist/utils/auto-merge.js +74 -56
- package/dist/utils/auto-merge.js.map +1 -1
- package/dist/utils/auto-merge.test.js +101 -66
- package/dist/utils/auto-merge.test.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +5 -5
- package/dist/utils/cli-helpers.d.ts.map +1 -1
- package/dist/utils/cli-helpers.js +8 -9
- package/dist/utils/cli-helpers.js.map +1 -1
- package/dist/utils/cli-helpers.test.js +28 -30
- package/dist/utils/cli-helpers.test.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +12 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +1 -0
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/pr-sync.d.ts +10 -10
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +20 -21
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/pr-sync.test.js +52 -50
- package/dist/utils/pr-sync.test.js.map +1 -1
- package/dist/utils/with-hive-context.d.ts.map +1 -1
- package/dist/utils/with-hive-context.js +70 -1
- package/dist/utils/with-hive-context.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/base-agent.test.ts +2 -1
- package/src/agents/base-agent.ts +32 -28
- package/src/agents/intermediate.ts +27 -18
- package/src/agents/junior.ts +27 -18
- package/src/agents/qa.ts +54 -40
- package/src/agents/senior.ts +42 -27
- package/src/agents/tech-lead.ts +42 -32
- package/src/cli/commands/add-repo.test.ts +1 -1
- package/src/cli/commands/add-repo.ts +2 -2
- package/src/cli/commands/agents.test.ts +7 -7
- package/src/cli/commands/agents.ts +12 -10
- package/src/cli/commands/approach.ts +2 -2
- package/src/cli/commands/approvals.test.ts +8 -8
- package/src/cli/commands/approvals.ts +9 -7
- package/src/cli/commands/assign.test.ts +19 -18
- package/src/cli/commands/assign.ts +4 -4
- package/src/cli/commands/cleanup.test.ts +5 -1
- package/src/cli/commands/cleanup.ts +11 -9
- package/src/cli/commands/escalations.test.ts +2 -2
- package/src/cli/commands/escalations.ts +9 -7
- package/src/cli/commands/init.test.ts +5 -0
- package/src/cli/commands/init.ts +53 -5
- package/src/cli/commands/manager/agent-monitoring.ts +3 -3
- package/src/cli/commands/manager/auditor-lifecycle.test.ts +21 -14
- package/src/cli/commands/manager/auditor-lifecycle.ts +3 -3
- package/src/cli/commands/manager/auto-reject-comment-only-reviews.test.ts +28 -23
- package/src/cli/commands/manager/escalation-handler.test.ts +13 -13
- package/src/cli/commands/manager/escalation-handler.ts +19 -12
- package/src/cli/commands/manager/feature-sign-off.test.ts +40 -31
- package/src/cli/commands/manager/feature-sign-off.ts +7 -7
- package/src/cli/commands/manager/feature-test-result.ts +13 -16
- package/src/cli/commands/manager/handoff-recovery.ts +20 -20
- package/src/cli/commands/manager/index.test.ts +4 -4
- package/src/cli/commands/manager/index.ts +58 -59
- package/src/cli/commands/manager/merged-story-cleanup.test.ts +28 -19
- package/src/cli/commands/manager/merged-story-cleanup.ts +11 -14
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +115 -110
- package/src/cli/commands/manager/qa-review-handler.ts +50 -63
- package/src/cli/commands/manager/spin-down.ts +27 -25
- package/src/cli/commands/manager/stale-escalations.ts +2 -3
- package/src/cli/commands/manager/stuck-story-helpers.ts +10 -10
- package/src/cli/commands/manager/stuck-story-processor.ts +56 -62
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +6 -6
- package/src/cli/commands/manager/types.ts +2 -3
- package/src/cli/commands/msg.test.ts +2 -2
- package/src/cli/commands/my-stories.test.ts +4 -2
- package/src/cli/commands/my-stories.ts +22 -27
- package/src/cli/commands/nuke.test.ts +1 -1
- package/src/cli/commands/pr.test.ts +10 -6
- package/src/cli/commands/pr.ts +41 -32
- package/src/cli/commands/progress.test.ts +1 -1
- package/src/cli/commands/progress.ts +11 -6
- package/src/cli/commands/req-headless.test.ts +170 -0
- package/src/cli/commands/req-spawn.test.ts +12 -2
- package/src/cli/commands/req.ts +13 -14
- package/src/cli/commands/resume.test.ts +1 -1
- package/src/cli/commands/resume.ts +7 -8
- package/src/cli/commands/status.test.ts +1 -1
- package/src/cli/commands/status.ts +52 -40
- package/src/cli/commands/stories.test.ts +4 -2
- package/src/cli/commands/stories.ts +11 -11
- package/src/cli/commands/teams.test.ts +2 -2
- package/src/cli/commands/teams.ts +11 -11
- package/src/cli/dashboard/index.test.ts +35 -34
- package/src/cli/dashboard/index.ts +34 -23
- package/src/cli/dashboard/panels/activity.ts +10 -4
- package/src/cli/dashboard/panels/agents.ts +8 -5
- package/src/cli/dashboard/panels/escalations.ts +4 -4
- package/src/cli/dashboard/panels/merge-queue.ts +4 -4
- package/src/cli/dashboard/panels/pipeline.ts +10 -4
- package/src/config/schema.ts +1 -0
- package/src/connectors/project-management/operations.ts +9 -10
- package/src/context-files/index.test.ts +1 -0
- package/src/db/client.ts +17 -0
- package/src/db/pg-migrations/001-full-schema.sql +209 -0
- package/src/db/postgres-provider.integration.test.ts +574 -0
- package/src/db/postgres-provider.test.ts +97 -0
- package/src/db/postgres-provider.ts +364 -0
- package/src/db/provider.test.ts +283 -0
- package/src/db/provider.ts +161 -0
- package/src/db/queries/agents.test.ts +114 -113
- package/src/db/queries/agents.ts +50 -36
- package/src/db/queries/escalations.test.ts +134 -133
- package/src/db/queries/escalations.ts +72 -57
- package/src/db/queries/heartbeat.test.ts +77 -78
- package/src/db/queries/heartbeat.ts +24 -46
- package/src/db/queries/integration-sync.ts +26 -26
- package/src/db/queries/logs.test.ts +151 -148
- package/src/db/queries/logs.ts +78 -53
- package/src/db/queries/messages.test.ts +48 -50
- package/src/db/queries/messages.ts +26 -18
- package/src/db/queries/pull-requests.test.ts +194 -199
- package/src/db/queries/pull-requests.ts +117 -88
- package/src/db/queries/requirements.test.ts +84 -83
- package/src/db/queries/requirements.ts +33 -28
- package/src/db/queries/stories.test.ts +173 -172
- package/src/db/queries/stories.ts +141 -110
- package/src/db/queries/teams.test.ts +37 -36
- package/src/db/queries/teams.ts +22 -14
- package/src/integrations/jira/repair.test.ts +27 -26
- package/src/integrations/jira/stories.test.ts +15 -16
- package/src/integrations/jira/stories.ts +15 -15
- package/src/integrations/jira/sync.test.ts +68 -68
- package/src/integrations/jira/sync.ts +29 -39
- package/src/integrations/jira/transitions.ts +6 -6
- package/src/orchestrator/agent-selector.ts +9 -8
- package/src/orchestrator/dependency-resolver.ts +16 -7
- package/src/orchestrator/feature-branch.test.ts +85 -80
- package/src/orchestrator/feature-branch.ts +13 -14
- package/src/orchestrator/orphan-recovery.ts +14 -13
- package/src/orchestrator/scheduler.test.ts +536 -394
- package/src/orchestrator/scheduler.ts +129 -115
- package/src/utils/auto-merge.test.ts +102 -68
- package/src/utils/auto-merge.ts +161 -168
- package/src/utils/cli-helpers.test.ts +30 -32
- package/src/utils/cli-helpers.ts +15 -11
- package/src/utils/paths.test.ts +1 -0
- package/src/utils/paths.ts +14 -1
- package/src/utils/pr-sync.test.ts +55 -52
- package/src/utils/pr-sync.ts +27 -32
- package/src/utils/with-hive-context.ts +89 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
|
|
3
|
-
import type { Database } from 'sql.js';
|
|
4
3
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
4
|
+
import { SqliteProvider } from '../provider.js';
|
|
5
5
|
import {
|
|
6
6
|
createRequirement,
|
|
7
7
|
deleteRequirement,
|
|
@@ -14,15 +14,16 @@ import {
|
|
|
14
14
|
import { createTestDatabase } from './test-helpers.js';
|
|
15
15
|
|
|
16
16
|
describe('requirements queries', () => {
|
|
17
|
-
let db:
|
|
17
|
+
let db: SqliteProvider;
|
|
18
18
|
|
|
19
19
|
beforeEach(async () => {
|
|
20
|
-
|
|
20
|
+
const rawDb = await createTestDatabase();
|
|
21
|
+
db = new SqliteProvider(rawDb);
|
|
21
22
|
});
|
|
22
23
|
|
|
23
24
|
describe('createRequirement', () => {
|
|
24
|
-
it('should create a requirement with all fields', () => {
|
|
25
|
-
const req = createRequirement(db, {
|
|
25
|
+
it('should create a requirement with all fields', async () => {
|
|
26
|
+
const req = await createRequirement(db, {
|
|
26
27
|
title: 'New Feature',
|
|
27
28
|
description: 'Add new feature to the app',
|
|
28
29
|
submittedBy: 'user123',
|
|
@@ -36,8 +37,8 @@ describe('requirements queries', () => {
|
|
|
36
37
|
expect(req.created_at).toBeDefined();
|
|
37
38
|
});
|
|
38
39
|
|
|
39
|
-
it('should default submittedBy to "human"', () => {
|
|
40
|
-
const req = createRequirement(db, {
|
|
40
|
+
it('should default submittedBy to "human"', async () => {
|
|
41
|
+
const req = await createRequirement(db, {
|
|
41
42
|
title: 'New Feature',
|
|
42
43
|
description: 'Add new feature',
|
|
43
44
|
});
|
|
@@ -45,8 +46,8 @@ describe('requirements queries', () => {
|
|
|
45
46
|
expect(req.submitted_by).toBe('human');
|
|
46
47
|
});
|
|
47
48
|
|
|
48
|
-
it('should create a requirement with godmode enabled', () => {
|
|
49
|
-
const req = createRequirement(db, {
|
|
49
|
+
it('should create a requirement with godmode enabled', async () => {
|
|
50
|
+
const req = await createRequirement(db, {
|
|
50
51
|
title: 'Godmode Feature',
|
|
51
52
|
description: 'Add feature with godmode',
|
|
52
53
|
godmode: true,
|
|
@@ -56,8 +57,8 @@ describe('requirements queries', () => {
|
|
|
56
57
|
expect(req.godmode).toBe(1);
|
|
57
58
|
});
|
|
58
59
|
|
|
59
|
-
it('should default godmode to 0 when not specified', () => {
|
|
60
|
-
const req = createRequirement(db, {
|
|
60
|
+
it('should default godmode to 0 when not specified', async () => {
|
|
61
|
+
const req = await createRequirement(db, {
|
|
61
62
|
title: 'Normal Feature',
|
|
62
63
|
description: 'Add feature without godmode',
|
|
63
64
|
});
|
|
@@ -65,8 +66,8 @@ describe('requirements queries', () => {
|
|
|
65
66
|
expect(req.godmode).toBe(0);
|
|
66
67
|
});
|
|
67
68
|
|
|
68
|
-
it('should create a requirement with custom target branch', () => {
|
|
69
|
-
const req = createRequirement(db, {
|
|
69
|
+
it('should create a requirement with custom target branch', async () => {
|
|
70
|
+
const req = await createRequirement(db, {
|
|
70
71
|
title: 'Feature on Release Branch',
|
|
71
72
|
description: 'Targeting a release branch',
|
|
72
73
|
targetBranch: 'release/v2',
|
|
@@ -76,8 +77,8 @@ describe('requirements queries', () => {
|
|
|
76
77
|
expect(req.target_branch).toBe('release/v2');
|
|
77
78
|
});
|
|
78
79
|
|
|
79
|
-
it('should default target_branch to main when not specified', () => {
|
|
80
|
-
const req = createRequirement(db, {
|
|
80
|
+
it('should default target_branch to main when not specified', async () => {
|
|
81
|
+
const req = await createRequirement(db, {
|
|
81
82
|
title: 'Normal Feature',
|
|
82
83
|
description: 'Default target branch',
|
|
83
84
|
});
|
|
@@ -85,13 +86,13 @@ describe('requirements queries', () => {
|
|
|
85
86
|
expect(req.target_branch).toBe('main');
|
|
86
87
|
});
|
|
87
88
|
|
|
88
|
-
it('should generate unique IDs', () => {
|
|
89
|
-
const req1 = createRequirement(db, {
|
|
89
|
+
it('should generate unique IDs', async () => {
|
|
90
|
+
const req1 = await createRequirement(db, {
|
|
90
91
|
title: 'Feature 1',
|
|
91
92
|
description: 'Description 1',
|
|
92
93
|
});
|
|
93
94
|
|
|
94
|
-
const req2 = createRequirement(db, {
|
|
95
|
+
const req2 = await createRequirement(db, {
|
|
95
96
|
title: 'Feature 2',
|
|
96
97
|
description: 'Description 2',
|
|
97
98
|
});
|
|
@@ -101,43 +102,43 @@ describe('requirements queries', () => {
|
|
|
101
102
|
});
|
|
102
103
|
|
|
103
104
|
describe('getRequirementById', () => {
|
|
104
|
-
it('should retrieve a requirement by ID', () => {
|
|
105
|
-
const created = createRequirement(db, {
|
|
105
|
+
it('should retrieve a requirement by ID', async () => {
|
|
106
|
+
const created = await createRequirement(db, {
|
|
106
107
|
title: 'Test Requirement',
|
|
107
108
|
description: 'Test description',
|
|
108
109
|
});
|
|
109
110
|
|
|
110
|
-
const retrieved = getRequirementById(db, created.id);
|
|
111
|
+
const retrieved = await getRequirementById(db, created.id);
|
|
111
112
|
|
|
112
113
|
expect(retrieved).toBeDefined();
|
|
113
114
|
expect(retrieved?.id).toBe(created.id);
|
|
114
115
|
expect(retrieved?.title).toBe('Test Requirement');
|
|
115
116
|
});
|
|
116
117
|
|
|
117
|
-
it('should return undefined for non-existent requirement', () => {
|
|
118
|
-
const result = getRequirementById(db, 'non-existent-id');
|
|
118
|
+
it('should return undefined for non-existent requirement', async () => {
|
|
119
|
+
const result = await getRequirementById(db, 'non-existent-id');
|
|
119
120
|
expect(result).toBeUndefined();
|
|
120
121
|
});
|
|
121
122
|
});
|
|
122
123
|
|
|
123
124
|
describe('getAllRequirements', () => {
|
|
124
|
-
it('should return empty array when no requirements exist', () => {
|
|
125
|
-
const requirements = getAllRequirements(db);
|
|
125
|
+
it('should return empty array when no requirements exist', async () => {
|
|
126
|
+
const requirements = await getAllRequirements(db);
|
|
126
127
|
expect(requirements).toEqual([]);
|
|
127
128
|
});
|
|
128
129
|
|
|
129
|
-
it('should return all requirements ordered by created_at DESC', () => {
|
|
130
|
-
const req1 = createRequirement(db, {
|
|
130
|
+
it('should return all requirements ordered by created_at DESC', async () => {
|
|
131
|
+
const req1 = await createRequirement(db, {
|
|
131
132
|
title: 'First',
|
|
132
133
|
description: 'First requirement',
|
|
133
134
|
});
|
|
134
135
|
|
|
135
|
-
const req2 = createRequirement(db, {
|
|
136
|
+
const req2 = await createRequirement(db, {
|
|
136
137
|
title: 'Second',
|
|
137
138
|
description: 'Second requirement',
|
|
138
139
|
});
|
|
139
140
|
|
|
140
|
-
const requirements = getAllRequirements(db);
|
|
141
|
+
const requirements = await getAllRequirements(db);
|
|
141
142
|
|
|
142
143
|
expect(requirements).toHaveLength(2);
|
|
143
144
|
// Verify both requirements are present
|
|
@@ -147,59 +148,59 @@ describe('requirements queries', () => {
|
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
describe('getRequirementsByStatus', () => {
|
|
150
|
-
it('should filter requirements by status', () => {
|
|
151
|
-
createRequirement(db, {
|
|
151
|
+
it('should filter requirements by status', async () => {
|
|
152
|
+
await createRequirement(db, {
|
|
152
153
|
title: 'Pending Req',
|
|
153
154
|
description: 'Description',
|
|
154
155
|
});
|
|
155
156
|
|
|
156
|
-
const req2 = createRequirement(db, {
|
|
157
|
+
const req2 = await createRequirement(db, {
|
|
157
158
|
title: 'In Progress Req',
|
|
158
159
|
description: 'Description',
|
|
159
160
|
});
|
|
160
161
|
|
|
161
|
-
updateRequirement(db, req2.id, { status: 'in_progress' });
|
|
162
|
+
await updateRequirement(db, req2.id, { status: 'in_progress' });
|
|
162
163
|
|
|
163
|
-
const pending = getRequirementsByStatus(db, 'pending');
|
|
164
|
-
const inProgress = getRequirementsByStatus(db, 'in_progress');
|
|
164
|
+
const pending = await getRequirementsByStatus(db, 'pending');
|
|
165
|
+
const inProgress = await getRequirementsByStatus(db, 'in_progress');
|
|
165
166
|
|
|
166
167
|
expect(pending).toHaveLength(1);
|
|
167
168
|
expect(inProgress).toHaveLength(1);
|
|
168
169
|
expect(inProgress[0].id).toBe(req2.id);
|
|
169
170
|
});
|
|
170
171
|
|
|
171
|
-
it('should return empty array when no requirements match status', () => {
|
|
172
|
-
const completed = getRequirementsByStatus(db, 'completed');
|
|
172
|
+
it('should return empty array when no requirements match status', async () => {
|
|
173
|
+
const completed = await getRequirementsByStatus(db, 'completed');
|
|
173
174
|
expect(completed).toEqual([]);
|
|
174
175
|
});
|
|
175
176
|
});
|
|
176
177
|
|
|
177
178
|
describe('getPendingRequirements', () => {
|
|
178
|
-
it('should return requirements with pending, planning, or in_progress status', () => {
|
|
179
|
-
const req1 = createRequirement(db, {
|
|
179
|
+
it('should return requirements with pending, planning, or in_progress status', async () => {
|
|
180
|
+
const req1 = await createRequirement(db, {
|
|
180
181
|
title: 'Pending',
|
|
181
182
|
description: 'Pending req',
|
|
182
183
|
});
|
|
183
184
|
|
|
184
|
-
const req2 = createRequirement(db, {
|
|
185
|
+
const req2 = await createRequirement(db, {
|
|
185
186
|
title: 'Planning',
|
|
186
187
|
description: 'Planning req',
|
|
187
188
|
});
|
|
188
|
-
updateRequirement(db, req2.id, { status: 'planning' });
|
|
189
|
+
await updateRequirement(db, req2.id, { status: 'planning' });
|
|
189
190
|
|
|
190
|
-
const req3 = createRequirement(db, {
|
|
191
|
+
const req3 = await createRequirement(db, {
|
|
191
192
|
title: 'In Progress',
|
|
192
193
|
description: 'In progress req',
|
|
193
194
|
});
|
|
194
|
-
updateRequirement(db, req3.id, { status: 'in_progress' });
|
|
195
|
+
await updateRequirement(db, req3.id, { status: 'in_progress' });
|
|
195
196
|
|
|
196
|
-
const req4 = createRequirement(db, {
|
|
197
|
+
const req4 = await createRequirement(db, {
|
|
197
198
|
title: 'Completed',
|
|
198
199
|
description: 'Completed req',
|
|
199
200
|
});
|
|
200
|
-
updateRequirement(db, req4.id, { status: 'completed' });
|
|
201
|
+
await updateRequirement(db, req4.id, { status: 'completed' });
|
|
201
202
|
|
|
202
|
-
const pending = getPendingRequirements(db);
|
|
203
|
+
const pending = await getPendingRequirements(db);
|
|
203
204
|
|
|
204
205
|
expect(pending).toHaveLength(3);
|
|
205
206
|
expect(pending.map(r => r.id)).toContain(req1.id);
|
|
@@ -210,13 +211,13 @@ describe('requirements queries', () => {
|
|
|
210
211
|
});
|
|
211
212
|
|
|
212
213
|
describe('updateRequirement', () => {
|
|
213
|
-
it('should update requirement title', () => {
|
|
214
|
-
const req = createRequirement(db, {
|
|
214
|
+
it('should update requirement title', async () => {
|
|
215
|
+
const req = await createRequirement(db, {
|
|
215
216
|
title: 'Original Title',
|
|
216
217
|
description: 'Description',
|
|
217
218
|
});
|
|
218
219
|
|
|
219
|
-
const updated = updateRequirement(db, req.id, {
|
|
220
|
+
const updated = await updateRequirement(db, req.id, {
|
|
220
221
|
title: 'Updated Title',
|
|
221
222
|
});
|
|
222
223
|
|
|
@@ -224,34 +225,34 @@ describe('requirements queries', () => {
|
|
|
224
225
|
expect(updated?.description).toBe('Description'); // Unchanged
|
|
225
226
|
});
|
|
226
227
|
|
|
227
|
-
it('should update requirement description', () => {
|
|
228
|
-
const req = createRequirement(db, {
|
|
228
|
+
it('should update requirement description', async () => {
|
|
229
|
+
const req = await createRequirement(db, {
|
|
229
230
|
title: 'Title',
|
|
230
231
|
description: 'Original Description',
|
|
231
232
|
});
|
|
232
233
|
|
|
233
|
-
const updated = updateRequirement(db, req.id, {
|
|
234
|
+
const updated = await updateRequirement(db, req.id, {
|
|
234
235
|
description: 'Updated Description',
|
|
235
236
|
});
|
|
236
237
|
|
|
237
238
|
expect(updated?.description).toBe('Updated Description');
|
|
238
239
|
});
|
|
239
240
|
|
|
240
|
-
it('should update requirement status', () => {
|
|
241
|
-
const req = createRequirement(db, {
|
|
241
|
+
it('should update requirement status', async () => {
|
|
242
|
+
const req = await createRequirement(db, {
|
|
242
243
|
title: 'Title',
|
|
243
244
|
description: 'Description',
|
|
244
245
|
});
|
|
245
246
|
|
|
246
|
-
const updated = updateRequirement(db, req.id, {
|
|
247
|
+
const updated = await updateRequirement(db, req.id, {
|
|
247
248
|
status: 'completed',
|
|
248
249
|
});
|
|
249
250
|
|
|
250
251
|
expect(updated?.status).toBe('completed');
|
|
251
252
|
});
|
|
252
253
|
|
|
253
|
-
it('should update requirement godmode flag', () => {
|
|
254
|
-
const req = createRequirement(db, {
|
|
254
|
+
it('should update requirement godmode flag', async () => {
|
|
255
|
+
const req = await createRequirement(db, {
|
|
255
256
|
title: 'Title',
|
|
256
257
|
description: 'Description',
|
|
257
258
|
godmode: false,
|
|
@@ -259,35 +260,35 @@ describe('requirements queries', () => {
|
|
|
259
260
|
|
|
260
261
|
expect(req.godmode).toBe(0);
|
|
261
262
|
|
|
262
|
-
const updated = updateRequirement(db, req.id, {
|
|
263
|
+
const updated = await updateRequirement(db, req.id, {
|
|
263
264
|
godmode: true,
|
|
264
265
|
});
|
|
265
266
|
|
|
266
267
|
expect(updated?.godmode).toBe(1);
|
|
267
268
|
});
|
|
268
269
|
|
|
269
|
-
it('should update requirement target branch', () => {
|
|
270
|
-
const req = createRequirement(db, {
|
|
270
|
+
it('should update requirement target branch', async () => {
|
|
271
|
+
const req = await createRequirement(db, {
|
|
271
272
|
title: 'Title',
|
|
272
273
|
description: 'Description',
|
|
273
274
|
});
|
|
274
275
|
|
|
275
276
|
expect(req.target_branch).toBe('main');
|
|
276
277
|
|
|
277
|
-
const updated = updateRequirement(db, req.id, {
|
|
278
|
+
const updated = await updateRequirement(db, req.id, {
|
|
278
279
|
targetBranch: 'develop',
|
|
279
280
|
});
|
|
280
281
|
|
|
281
282
|
expect(updated?.target_branch).toBe('develop');
|
|
282
283
|
});
|
|
283
284
|
|
|
284
|
-
it('should update multiple fields at once', () => {
|
|
285
|
-
const req = createRequirement(db, {
|
|
285
|
+
it('should update multiple fields at once', async () => {
|
|
286
|
+
const req = await createRequirement(db, {
|
|
286
287
|
title: 'Original',
|
|
287
288
|
description: 'Original',
|
|
288
289
|
});
|
|
289
290
|
|
|
290
|
-
const updated = updateRequirement(db, req.id, {
|
|
291
|
+
const updated = await updateRequirement(db, req.id, {
|
|
291
292
|
title: 'New Title',
|
|
292
293
|
description: 'New Description',
|
|
293
294
|
status: 'planned',
|
|
@@ -298,20 +299,20 @@ describe('requirements queries', () => {
|
|
|
298
299
|
expect(updated?.status).toBe('planned');
|
|
299
300
|
});
|
|
300
301
|
|
|
301
|
-
it('should return original requirement when no updates provided', () => {
|
|
302
|
-
const req = createRequirement(db, {
|
|
302
|
+
it('should return original requirement when no updates provided', async () => {
|
|
303
|
+
const req = await createRequirement(db, {
|
|
303
304
|
title: 'Title',
|
|
304
305
|
description: 'Description',
|
|
305
306
|
});
|
|
306
307
|
|
|
307
|
-
const updated = updateRequirement(db, req.id, {});
|
|
308
|
+
const updated = await updateRequirement(db, req.id, {});
|
|
308
309
|
|
|
309
310
|
expect(updated?.id).toBe(req.id);
|
|
310
311
|
expect(updated?.title).toBe(req.title);
|
|
311
312
|
});
|
|
312
313
|
|
|
313
|
-
it('should return undefined for non-existent requirement', () => {
|
|
314
|
-
const updated = updateRequirement(db, 'non-existent-id', {
|
|
314
|
+
it('should return undefined for non-existent requirement', async () => {
|
|
315
|
+
const updated = await updateRequirement(db, 'non-existent-id', {
|
|
315
316
|
title: 'New Title',
|
|
316
317
|
});
|
|
317
318
|
|
|
@@ -320,26 +321,26 @@ describe('requirements queries', () => {
|
|
|
320
321
|
});
|
|
321
322
|
|
|
322
323
|
describe('deleteRequirement', () => {
|
|
323
|
-
it('should delete a requirement', () => {
|
|
324
|
-
const req = createRequirement(db, {
|
|
324
|
+
it('should delete a requirement', async () => {
|
|
325
|
+
const req = await createRequirement(db, {
|
|
325
326
|
title: 'To Delete',
|
|
326
327
|
description: 'Will be deleted',
|
|
327
328
|
});
|
|
328
329
|
|
|
329
|
-
deleteRequirement(db, req.id);
|
|
330
|
+
await deleteRequirement(db, req.id);
|
|
330
331
|
|
|
331
|
-
const retrieved = getRequirementById(db, req.id);
|
|
332
|
+
const retrieved = await getRequirementById(db, req.id);
|
|
332
333
|
expect(retrieved).toBeUndefined();
|
|
333
334
|
});
|
|
334
335
|
|
|
335
|
-
it('should not throw when deleting non-existent requirement', () => {
|
|
336
|
-
expect(
|
|
336
|
+
it('should not throw when deleting non-existent requirement', async () => {
|
|
337
|
+
await expect(deleteRequirement(db, 'non-existent-id')).resolves.not.toThrow();
|
|
337
338
|
});
|
|
338
339
|
});
|
|
339
340
|
|
|
340
341
|
describe('edge cases', () => {
|
|
341
|
-
it('should handle empty strings in title and description', () => {
|
|
342
|
-
const req = createRequirement(db, {
|
|
342
|
+
it('should handle empty strings in title and description', async () => {
|
|
343
|
+
const req = await createRequirement(db, {
|
|
343
344
|
title: '',
|
|
344
345
|
description: '',
|
|
345
346
|
});
|
|
@@ -348,25 +349,25 @@ describe('requirements queries', () => {
|
|
|
348
349
|
expect(req.description).toBe('');
|
|
349
350
|
});
|
|
350
351
|
|
|
351
|
-
it('should handle very long text fields', () => {
|
|
352
|
+
it('should handle very long text fields', async () => {
|
|
352
353
|
const longText = 'A'.repeat(10000);
|
|
353
|
-
const req = createRequirement(db, {
|
|
354
|
+
const req = await createRequirement(db, {
|
|
354
355
|
title: longText,
|
|
355
356
|
description: longText,
|
|
356
357
|
});
|
|
357
358
|
|
|
358
|
-
const retrieved = getRequirementById(db, req.id);
|
|
359
|
+
const retrieved = await getRequirementById(db, req.id);
|
|
359
360
|
expect(retrieved?.title).toBe(longText);
|
|
360
361
|
expect(retrieved?.description).toBe(longText);
|
|
361
362
|
});
|
|
362
363
|
|
|
363
|
-
it('should handle special characters', () => {
|
|
364
|
-
const req = createRequirement(db, {
|
|
364
|
+
it('should handle special characters', async () => {
|
|
365
|
+
const req = await createRequirement(db, {
|
|
365
366
|
title: 'Title with \'quotes\' and "double" quotes',
|
|
366
367
|
description: 'Description with\nnewlines\tand\ttabs',
|
|
367
368
|
});
|
|
368
369
|
|
|
369
|
-
const retrieved = getRequirementById(db, req.id);
|
|
370
|
+
const retrieved = await getRequirementById(db, req.id);
|
|
370
371
|
expect(retrieved?.title).toBe('Title with \'quotes\' and "double" quotes');
|
|
371
372
|
expect(retrieved?.description).toBe('Description with\nnewlines\tand\ttabs');
|
|
372
373
|
});
|
|
@@ -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 RequirementRow } from '../client.js';
|
|
5
|
+
import type { DatabaseProvider } from '../provider.js';
|
|
6
6
|
|
|
7
7
|
export type { RequirementRow };
|
|
8
8
|
|
|
@@ -41,12 +41,14 @@ export interface UpdateRequirementInput {
|
|
|
41
41
|
featureBranch?: string | null;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
export function createRequirement(
|
|
44
|
+
export async function createRequirement(
|
|
45
|
+
provider: DatabaseProvider,
|
|
46
|
+
input: CreateRequirementInput
|
|
47
|
+
): Promise<RequirementRow> {
|
|
45
48
|
const id = `REQ-${nanoid(8).toUpperCase()}`;
|
|
46
49
|
const now = new Date().toISOString();
|
|
47
50
|
|
|
48
|
-
run(
|
|
49
|
-
db,
|
|
51
|
+
await provider.run(
|
|
50
52
|
`
|
|
51
53
|
INSERT INTO requirements (id, title, description, submitted_by, godmode, target_branch, feature_branch, created_at)
|
|
52
54
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
|
@@ -63,44 +65,47 @@ export function createRequirement(db: Database, input: CreateRequirementInput):
|
|
|
63
65
|
]
|
|
64
66
|
);
|
|
65
67
|
|
|
66
|
-
return getRequirementById(
|
|
68
|
+
return (await getRequirementById(provider, id))!;
|
|
67
69
|
}
|
|
68
70
|
|
|
69
|
-
export function getRequirementById(
|
|
70
|
-
|
|
71
|
+
export async function getRequirementById(
|
|
72
|
+
provider: DatabaseProvider,
|
|
73
|
+
id: string
|
|
74
|
+
): Promise<RequirementRow | undefined> {
|
|
75
|
+
return await provider.queryOne<RequirementRow>('SELECT * FROM requirements WHERE id = ?', [id]);
|
|
71
76
|
}
|
|
72
77
|
|
|
73
|
-
export function getAllRequirements(
|
|
74
|
-
return queryAll<RequirementRow>(
|
|
75
|
-
db,
|
|
78
|
+
export async function getAllRequirements(provider: DatabaseProvider): Promise<RequirementRow[]> {
|
|
79
|
+
return await provider.queryAll<RequirementRow>(
|
|
76
80
|
'SELECT * FROM requirements ORDER BY created_at DESC, rowid DESC'
|
|
77
81
|
);
|
|
78
82
|
}
|
|
79
83
|
|
|
80
|
-
export function getRequirementsByStatus(
|
|
81
|
-
|
|
82
|
-
|
|
84
|
+
export async function getRequirementsByStatus(
|
|
85
|
+
provider: DatabaseProvider,
|
|
86
|
+
status: RequirementStatus
|
|
87
|
+
): Promise<RequirementRow[]> {
|
|
88
|
+
return await provider.queryAll<RequirementRow>(
|
|
83
89
|
'SELECT * FROM requirements WHERE status = ? ORDER BY created_at DESC, rowid DESC',
|
|
84
90
|
[status]
|
|
85
91
|
);
|
|
86
92
|
}
|
|
87
93
|
|
|
88
|
-
export function getPendingRequirements(
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
94
|
+
export async function getPendingRequirements(
|
|
95
|
+
provider: DatabaseProvider
|
|
96
|
+
): Promise<RequirementRow[]> {
|
|
97
|
+
return await provider.queryAll<RequirementRow>(`
|
|
92
98
|
SELECT * FROM requirements
|
|
93
99
|
WHERE status IN ('pending', 'planning', 'in_progress')
|
|
94
100
|
ORDER BY created_at, rowid
|
|
95
|
-
`
|
|
96
|
-
);
|
|
101
|
+
`);
|
|
97
102
|
}
|
|
98
103
|
|
|
99
|
-
export function updateRequirement(
|
|
100
|
-
|
|
104
|
+
export async function updateRequirement(
|
|
105
|
+
provider: DatabaseProvider,
|
|
101
106
|
id: string,
|
|
102
107
|
input: UpdateRequirementInput
|
|
103
|
-
): RequirementRow | undefined {
|
|
108
|
+
): Promise<RequirementRow | undefined> {
|
|
104
109
|
const updates: string[] = [];
|
|
105
110
|
const values: unknown[] = [];
|
|
106
111
|
|
|
@@ -150,14 +155,14 @@ export function updateRequirement(
|
|
|
150
155
|
}
|
|
151
156
|
|
|
152
157
|
if (updates.length === 0) {
|
|
153
|
-
return getRequirementById(
|
|
158
|
+
return await getRequirementById(provider, id);
|
|
154
159
|
}
|
|
155
160
|
|
|
156
161
|
values.push(id);
|
|
157
|
-
run(
|
|
158
|
-
return getRequirementById(
|
|
162
|
+
await provider.run(`UPDATE requirements SET ${updates.join(', ')} WHERE id = ?`, values);
|
|
163
|
+
return await getRequirementById(provider, id);
|
|
159
164
|
}
|
|
160
165
|
|
|
161
|
-
export function deleteRequirement(
|
|
162
|
-
run(
|
|
166
|
+
export async function deleteRequirement(provider: DatabaseProvider, id: string): Promise<void> {
|
|
167
|
+
await provider.run('DELETE FROM requirements WHERE id = ?', [id]);
|
|
163
168
|
}
|