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 { createAgent } from './agents.js';
|
|
6
6
|
import {
|
|
7
7
|
acknowledgeEscalation,
|
|
@@ -25,24 +25,25 @@ import { createTeam } from './teams.js';
|
|
|
25
25
|
import { createTestDatabase } from './test-helpers.js';
|
|
26
26
|
|
|
27
27
|
describe('escalations queries', () => {
|
|
28
|
-
let db:
|
|
28
|
+
let db: SqliteProvider;
|
|
29
29
|
let teamId: string;
|
|
30
30
|
let agentId: string;
|
|
31
31
|
let storyId: string;
|
|
32
32
|
|
|
33
33
|
beforeEach(async () => {
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
const rawDb = await createTestDatabase();
|
|
35
|
+
db = new SqliteProvider(rawDb);
|
|
36
|
+
const team = await createTeam(db, {
|
|
36
37
|
repoUrl: 'https://github.com/test/repo.git',
|
|
37
38
|
repoPath: '/path/to/repo',
|
|
38
39
|
name: 'Test Team',
|
|
39
40
|
});
|
|
40
41
|
teamId = team.id;
|
|
41
42
|
|
|
42
|
-
const agent = createAgent(db, { type: 'senior', teamId });
|
|
43
|
+
const agent = await createAgent(db, { type: 'senior', teamId });
|
|
43
44
|
agentId = agent.id;
|
|
44
45
|
|
|
45
|
-
const story = createStory(db, {
|
|
46
|
+
const story = await createStory(db, {
|
|
46
47
|
title: 'Test Story',
|
|
47
48
|
description: 'Test description',
|
|
48
49
|
teamId,
|
|
@@ -51,10 +52,10 @@ describe('escalations queries', () => {
|
|
|
51
52
|
});
|
|
52
53
|
|
|
53
54
|
describe('createEscalation', () => {
|
|
54
|
-
it('should create an escalation with all fields', () => {
|
|
55
|
-
const agent2 = createAgent(db, { type: 'tech_lead', teamId });
|
|
55
|
+
it('should create an escalation with all fields', async () => {
|
|
56
|
+
const agent2 = await createAgent(db, { type: 'tech_lead', teamId });
|
|
56
57
|
|
|
57
|
-
const escalation = createEscalation(db, {
|
|
58
|
+
const escalation = await createEscalation(db, {
|
|
58
59
|
storyId,
|
|
59
60
|
fromAgentId: agentId,
|
|
60
61
|
toAgentId: agent2.id,
|
|
@@ -70,8 +71,8 @@ describe('escalations queries', () => {
|
|
|
70
71
|
expect(escalation.created_at).toBeDefined();
|
|
71
72
|
});
|
|
72
73
|
|
|
73
|
-
it('should create escalation with null fields', () => {
|
|
74
|
-
const escalation = createEscalation(db, {
|
|
74
|
+
it('should create escalation with null fields', async () => {
|
|
75
|
+
const escalation = await createEscalation(db, {
|
|
75
76
|
reason: 'General question',
|
|
76
77
|
});
|
|
77
78
|
|
|
@@ -80,64 +81,64 @@ describe('escalations queries', () => {
|
|
|
80
81
|
expect(escalation.to_agent_id).toBeNull();
|
|
81
82
|
});
|
|
82
83
|
|
|
83
|
-
it('should generate unique IDs', () => {
|
|
84
|
-
const esc1 = createEscalation(db, { reason: 'Reason 1' });
|
|
85
|
-
const esc2 = createEscalation(db, { reason: 'Reason 2' });
|
|
84
|
+
it('should generate unique IDs', async () => {
|
|
85
|
+
const esc1 = await createEscalation(db, { reason: 'Reason 1' });
|
|
86
|
+
const esc2 = await createEscalation(db, { reason: 'Reason 2' });
|
|
86
87
|
|
|
87
88
|
expect(esc1.id).not.toBe(esc2.id);
|
|
88
89
|
});
|
|
89
90
|
});
|
|
90
91
|
|
|
91
92
|
describe('getEscalationById', () => {
|
|
92
|
-
it('should retrieve an escalation by ID', () => {
|
|
93
|
-
const created = createEscalation(db, {
|
|
93
|
+
it('should retrieve an escalation by ID', async () => {
|
|
94
|
+
const created = await createEscalation(db, {
|
|
94
95
|
storyId,
|
|
95
96
|
fromAgentId: agentId,
|
|
96
97
|
reason: 'Test escalation',
|
|
97
98
|
});
|
|
98
99
|
|
|
99
|
-
const retrieved = getEscalationById(db, created.id);
|
|
100
|
+
const retrieved = await getEscalationById(db, created.id);
|
|
100
101
|
|
|
101
102
|
expect(retrieved).toBeDefined();
|
|
102
103
|
expect(retrieved?.id).toBe(created.id);
|
|
103
104
|
expect(retrieved?.reason).toBe('Test escalation');
|
|
104
105
|
});
|
|
105
106
|
|
|
106
|
-
it('should return undefined for non-existent escalation', () => {
|
|
107
|
-
const result = getEscalationById(db, 'non-existent-id');
|
|
107
|
+
it('should return undefined for non-existent escalation', async () => {
|
|
108
|
+
const result = await getEscalationById(db, 'non-existent-id');
|
|
108
109
|
expect(result).toBeUndefined();
|
|
109
110
|
});
|
|
110
111
|
});
|
|
111
112
|
|
|
112
113
|
describe('getEscalationsByStory', () => {
|
|
113
|
-
it('should return escalations for a specific story', () => {
|
|
114
|
-
const esc1 = createEscalation(db, { storyId, reason: 'Reason 1' });
|
|
115
|
-
const esc2 = createEscalation(db, { storyId, reason: 'Reason 2' });
|
|
114
|
+
it('should return escalations for a specific story', async () => {
|
|
115
|
+
const esc1 = await createEscalation(db, { storyId, reason: 'Reason 1' });
|
|
116
|
+
const esc2 = await createEscalation(db, { storyId, reason: 'Reason 2' });
|
|
116
117
|
|
|
117
|
-
const story2 = createStory(db, {
|
|
118
|
+
const story2 = await createStory(db, {
|
|
118
119
|
title: 'Story 2',
|
|
119
120
|
description: 'Description',
|
|
120
121
|
teamId,
|
|
121
122
|
});
|
|
122
|
-
createEscalation(db, { storyId: story2.id, reason: 'Reason 3' });
|
|
123
|
+
await createEscalation(db, { storyId: story2.id, reason: 'Reason 3' });
|
|
123
124
|
|
|
124
|
-
const escalations = getEscalationsByStory(db, storyId);
|
|
125
|
+
const escalations = await getEscalationsByStory(db, storyId);
|
|
125
126
|
|
|
126
127
|
expect(escalations).toHaveLength(2);
|
|
127
128
|
expect(escalations.map(e => e.id)).toContain(esc1.id);
|
|
128
129
|
expect(escalations.map(e => e.id)).toContain(esc2.id);
|
|
129
130
|
});
|
|
130
131
|
|
|
131
|
-
it('should return empty array when no escalations for story', () => {
|
|
132
|
-
const escalations = getEscalationsByStory(db, 'non-existent-story');
|
|
132
|
+
it('should return empty array when no escalations for story', async () => {
|
|
133
|
+
const escalations = await getEscalationsByStory(db, 'non-existent-story');
|
|
133
134
|
expect(escalations).toEqual([]);
|
|
134
135
|
});
|
|
135
136
|
|
|
136
|
-
it('should order by created_at DESC', () => {
|
|
137
|
-
const esc1 = createEscalation(db, { storyId, reason: 'First' });
|
|
138
|
-
const esc2 = createEscalation(db, { storyId, reason: 'Second' });
|
|
137
|
+
it('should order by created_at DESC', async () => {
|
|
138
|
+
const esc1 = await createEscalation(db, { storyId, reason: 'First' });
|
|
139
|
+
const esc2 = await createEscalation(db, { storyId, reason: 'Second' });
|
|
139
140
|
|
|
140
|
-
const escalations = getEscalationsByStory(db, storyId);
|
|
141
|
+
const escalations = await getEscalationsByStory(db, storyId);
|
|
141
142
|
|
|
142
143
|
expect(escalations).toHaveLength(2);
|
|
143
144
|
// Verify both escalations are present
|
|
@@ -147,14 +148,14 @@ describe('escalations queries', () => {
|
|
|
147
148
|
});
|
|
148
149
|
|
|
149
150
|
describe('getEscalationsByFromAgent', () => {
|
|
150
|
-
it('should return escalations from a specific agent', () => {
|
|
151
|
-
const esc1 = createEscalation(db, { fromAgentId: agentId, reason: 'Reason 1' });
|
|
152
|
-
const esc2 = createEscalation(db, { fromAgentId: agentId, reason: 'Reason 2' });
|
|
151
|
+
it('should return escalations from a specific agent', async () => {
|
|
152
|
+
const esc1 = await createEscalation(db, { fromAgentId: agentId, reason: 'Reason 1' });
|
|
153
|
+
const esc2 = await createEscalation(db, { fromAgentId: agentId, reason: 'Reason 2' });
|
|
153
154
|
|
|
154
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
155
|
-
createEscalation(db, { fromAgentId: agent2.id, reason: 'Reason 3' });
|
|
155
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
156
|
+
await createEscalation(db, { fromAgentId: agent2.id, reason: 'Reason 3' });
|
|
156
157
|
|
|
157
|
-
const escalations = getEscalationsByFromAgent(db, agentId);
|
|
158
|
+
const escalations = await getEscalationsByFromAgent(db, agentId);
|
|
158
159
|
|
|
159
160
|
expect(escalations).toHaveLength(2);
|
|
160
161
|
expect(escalations.map(e => e.id)).toContain(esc1.id);
|
|
@@ -163,38 +164,38 @@ describe('escalations queries', () => {
|
|
|
163
164
|
});
|
|
164
165
|
|
|
165
166
|
describe('getEscalationsByToAgent', () => {
|
|
166
|
-
it('should return escalations to a specific agent', () => {
|
|
167
|
-
const techLead = createAgent(db, { type: 'tech_lead', teamId });
|
|
167
|
+
it('should return escalations to a specific agent', async () => {
|
|
168
|
+
const techLead = await createAgent(db, { type: 'tech_lead', teamId });
|
|
168
169
|
|
|
169
|
-
const esc1 = createEscalation(db, {
|
|
170
|
+
const esc1 = await createEscalation(db, {
|
|
170
171
|
fromAgentId: agentId,
|
|
171
172
|
toAgentId: techLead.id,
|
|
172
173
|
reason: 'Reason 1',
|
|
173
174
|
});
|
|
174
175
|
|
|
175
|
-
createEscalation(db, { fromAgentId: agentId, reason: 'Reason 2' });
|
|
176
|
+
await createEscalation(db, { fromAgentId: agentId, reason: 'Reason 2' });
|
|
176
177
|
|
|
177
|
-
const escalations = getEscalationsByToAgent(db, techLead.id);
|
|
178
|
+
const escalations = await getEscalationsByToAgent(db, techLead.id);
|
|
178
179
|
|
|
179
180
|
expect(escalations).toHaveLength(1);
|
|
180
181
|
expect(escalations[0].id).toBe(esc1.id);
|
|
181
182
|
});
|
|
182
183
|
|
|
183
|
-
it('should return escalations with null toAgentId when passed null', () => {
|
|
184
|
-
createEscalation(db, {
|
|
184
|
+
it('should return escalations with null toAgentId when passed null', async () => {
|
|
185
|
+
await createEscalation(db, {
|
|
185
186
|
fromAgentId: agentId,
|
|
186
187
|
toAgentId: null,
|
|
187
188
|
reason: 'To human',
|
|
188
189
|
});
|
|
189
190
|
|
|
190
|
-
const techLead = createAgent(db, { type: 'tech_lead', teamId });
|
|
191
|
-
createEscalation(db, {
|
|
191
|
+
const techLead = await createAgent(db, { type: 'tech_lead', teamId });
|
|
192
|
+
await createEscalation(db, {
|
|
192
193
|
fromAgentId: agentId,
|
|
193
194
|
toAgentId: techLead.id,
|
|
194
195
|
reason: 'To tech lead',
|
|
195
196
|
});
|
|
196
197
|
|
|
197
|
-
const humanEscalations = getEscalationsByToAgent(db, null);
|
|
198
|
+
const humanEscalations = await getEscalationsByToAgent(db, null);
|
|
198
199
|
|
|
199
200
|
expect(humanEscalations).toHaveLength(1);
|
|
200
201
|
expect(humanEscalations[0].reason).toBe('To human');
|
|
@@ -202,13 +203,13 @@ describe('escalations queries', () => {
|
|
|
202
203
|
});
|
|
203
204
|
|
|
204
205
|
describe('getEscalationsByStatus', () => {
|
|
205
|
-
it('should filter escalations by status', () => {
|
|
206
|
-
const esc1 = createEscalation(db, { reason: 'Pending' });
|
|
207
|
-
const esc2 = createEscalation(db, { reason: 'Acknowledged' });
|
|
208
|
-
updateEscalation(db, esc2.id, { status: 'acknowledged' });
|
|
206
|
+
it('should filter escalations by status', async () => {
|
|
207
|
+
const esc1 = await createEscalation(db, { reason: 'Pending' });
|
|
208
|
+
const esc2 = await createEscalation(db, { reason: 'Acknowledged' });
|
|
209
|
+
await updateEscalation(db, esc2.id, { status: 'acknowledged' });
|
|
209
210
|
|
|
210
|
-
const pending = getEscalationsByStatus(db, 'pending');
|
|
211
|
-
const acknowledged = getEscalationsByStatus(db, 'acknowledged');
|
|
211
|
+
const pending = await getEscalationsByStatus(db, 'pending');
|
|
212
|
+
const acknowledged = await getEscalationsByStatus(db, 'acknowledged');
|
|
212
213
|
|
|
213
214
|
expect(pending).toHaveLength(1);
|
|
214
215
|
expect(pending[0].id).toBe(esc1.id);
|
|
@@ -218,13 +219,13 @@ describe('escalations queries', () => {
|
|
|
218
219
|
});
|
|
219
220
|
|
|
220
221
|
describe('getPendingEscalations', () => {
|
|
221
|
-
it('should return all pending escalations', () => {
|
|
222
|
-
const esc1 = createEscalation(db, { reason: 'Pending 1' });
|
|
223
|
-
const esc2 = createEscalation(db, { reason: 'Pending 2' });
|
|
224
|
-
const esc3 = createEscalation(db, { reason: 'Resolved' });
|
|
225
|
-
updateEscalation(db, esc3.id, { status: 'resolved', resolution: 'Fixed' });
|
|
222
|
+
it('should return all pending escalations', async () => {
|
|
223
|
+
const esc1 = await createEscalation(db, { reason: 'Pending 1' });
|
|
224
|
+
const esc2 = await createEscalation(db, { reason: 'Pending 2' });
|
|
225
|
+
const esc3 = await createEscalation(db, { reason: 'Resolved' });
|
|
226
|
+
await updateEscalation(db, esc3.id, { status: 'resolved', resolution: 'Fixed' });
|
|
226
227
|
|
|
227
|
-
const pending = getPendingEscalations(db);
|
|
228
|
+
const pending = await getPendingEscalations(db);
|
|
228
229
|
|
|
229
230
|
expect(pending).toHaveLength(2);
|
|
230
231
|
expect(pending.map(e => e.id)).toContain(esc1.id);
|
|
@@ -233,45 +234,45 @@ describe('escalations queries', () => {
|
|
|
233
234
|
});
|
|
234
235
|
|
|
235
236
|
describe('getPendingHumanEscalations', () => {
|
|
236
|
-
it('should return pending escalations with null toAgentId', () => {
|
|
237
|
-
const esc1 = createEscalation(db, {
|
|
237
|
+
it('should return pending escalations with null toAgentId', async () => {
|
|
238
|
+
const esc1 = await createEscalation(db, {
|
|
238
239
|
fromAgentId: agentId,
|
|
239
240
|
toAgentId: null,
|
|
240
241
|
reason: 'Need human help',
|
|
241
242
|
});
|
|
242
243
|
|
|
243
|
-
const techLead = createAgent(db, { type: 'tech_lead', teamId });
|
|
244
|
-
createEscalation(db, {
|
|
244
|
+
const techLead = await createAgent(db, { type: 'tech_lead', teamId });
|
|
245
|
+
await createEscalation(db, {
|
|
245
246
|
fromAgentId: agentId,
|
|
246
247
|
toAgentId: techLead.id,
|
|
247
248
|
reason: 'Need tech lead help',
|
|
248
249
|
});
|
|
249
250
|
|
|
250
|
-
const humanEscalations = getPendingHumanEscalations(db);
|
|
251
|
+
const humanEscalations = await getPendingHumanEscalations(db);
|
|
251
252
|
|
|
252
253
|
expect(humanEscalations).toHaveLength(1);
|
|
253
254
|
expect(humanEscalations[0].id).toBe(esc1.id);
|
|
254
255
|
});
|
|
255
256
|
|
|
256
|
-
it('should not return resolved human escalations', () => {
|
|
257
|
-
const esc = createEscalation(db, {
|
|
257
|
+
it('should not return resolved human escalations', async () => {
|
|
258
|
+
const esc = await createEscalation(db, {
|
|
258
259
|
toAgentId: null,
|
|
259
260
|
reason: 'Need help',
|
|
260
261
|
});
|
|
261
|
-
updateEscalation(db, esc.id, { status: 'resolved', resolution: 'Fixed' });
|
|
262
|
+
await updateEscalation(db, esc.id, { status: 'resolved', resolution: 'Fixed' });
|
|
262
263
|
|
|
263
|
-
const humanEscalations = getPendingHumanEscalations(db);
|
|
264
|
+
const humanEscalations = await getPendingHumanEscalations(db);
|
|
264
265
|
|
|
265
266
|
expect(humanEscalations).toEqual([]);
|
|
266
267
|
});
|
|
267
268
|
});
|
|
268
269
|
|
|
269
270
|
describe('getAllEscalations', () => {
|
|
270
|
-
it('should return all escalations ordered by created_at DESC', () => {
|
|
271
|
-
const esc1 = createEscalation(db, { reason: 'First' });
|
|
272
|
-
const esc2 = createEscalation(db, { reason: 'Second' });
|
|
271
|
+
it('should return all escalations ordered by created_at DESC', async () => {
|
|
272
|
+
const esc1 = await createEscalation(db, { reason: 'First' });
|
|
273
|
+
const esc2 = await createEscalation(db, { reason: 'Second' });
|
|
273
274
|
|
|
274
|
-
const escalations = getAllEscalations(db);
|
|
275
|
+
const escalations = await getAllEscalations(db);
|
|
275
276
|
|
|
276
277
|
expect(escalations).toHaveLength(2);
|
|
277
278
|
// Verify both escalations are present
|
|
@@ -281,18 +282,18 @@ describe('escalations queries', () => {
|
|
|
281
282
|
});
|
|
282
283
|
|
|
283
284
|
describe('updateEscalation', () => {
|
|
284
|
-
it('should update escalation status', () => {
|
|
285
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
285
|
+
it('should update escalation status', async () => {
|
|
286
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
286
287
|
|
|
287
|
-
const updated = updateEscalation(db, esc.id, { status: 'acknowledged' });
|
|
288
|
+
const updated = await updateEscalation(db, esc.id, { status: 'acknowledged' });
|
|
288
289
|
|
|
289
290
|
expect(updated?.status).toBe('acknowledged');
|
|
290
291
|
});
|
|
291
292
|
|
|
292
|
-
it('should set resolved_at when status is resolved', () => {
|
|
293
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
293
|
+
it('should set resolved_at when status is resolved', async () => {
|
|
294
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
294
295
|
|
|
295
|
-
const updated = updateEscalation(db, esc.id, {
|
|
296
|
+
const updated = await updateEscalation(db, esc.id, {
|
|
296
297
|
status: 'resolved',
|
|
297
298
|
resolution: 'Issue fixed',
|
|
298
299
|
});
|
|
@@ -302,34 +303,34 @@ describe('escalations queries', () => {
|
|
|
302
303
|
expect(updated?.resolution).toBe('Issue fixed');
|
|
303
304
|
});
|
|
304
305
|
|
|
305
|
-
it('should update toAgentId', () => {
|
|
306
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
307
|
-
const techLead = createAgent(db, { type: 'tech_lead', teamId });
|
|
306
|
+
it('should update toAgentId', async () => {
|
|
307
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
308
|
+
const techLead = await createAgent(db, { type: 'tech_lead', teamId });
|
|
308
309
|
|
|
309
|
-
const updated = updateEscalation(db, esc.id, { toAgentId: techLead.id });
|
|
310
|
+
const updated = await updateEscalation(db, esc.id, { toAgentId: techLead.id });
|
|
310
311
|
|
|
311
312
|
expect(updated?.to_agent_id).toBe(techLead.id);
|
|
312
313
|
});
|
|
313
314
|
|
|
314
|
-
it('should return escalation when no updates provided', () => {
|
|
315
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
315
|
+
it('should return escalation when no updates provided', async () => {
|
|
316
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
316
317
|
|
|
317
|
-
const updated = updateEscalation(db, esc.id, {});
|
|
318
|
+
const updated = await updateEscalation(db, esc.id, {});
|
|
318
319
|
|
|
319
320
|
expect(updated?.id).toBe(esc.id);
|
|
320
321
|
});
|
|
321
322
|
|
|
322
|
-
it('should return undefined for non-existent escalation', () => {
|
|
323
|
-
const updated = updateEscalation(db, 'non-existent-id', { status: 'acknowledged' });
|
|
323
|
+
it('should return undefined for non-existent escalation', async () => {
|
|
324
|
+
const updated = await updateEscalation(db, 'non-existent-id', { status: 'acknowledged' });
|
|
324
325
|
expect(updated).toBeUndefined();
|
|
325
326
|
});
|
|
326
327
|
});
|
|
327
328
|
|
|
328
329
|
describe('resolveEscalation', () => {
|
|
329
|
-
it('should resolve an escalation with resolution text', () => {
|
|
330
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
330
|
+
it('should resolve an escalation with resolution text', async () => {
|
|
331
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
331
332
|
|
|
332
|
-
const resolved = resolveEscalation(db, esc.id, 'Issue has been fixed');
|
|
333
|
+
const resolved = await resolveEscalation(db, esc.id, 'Issue has been fixed');
|
|
333
334
|
|
|
334
335
|
expect(resolved?.status).toBe('resolved');
|
|
335
336
|
expect(resolved?.resolution).toBe('Issue has been fixed');
|
|
@@ -338,49 +339,49 @@ describe('escalations queries', () => {
|
|
|
338
339
|
});
|
|
339
340
|
|
|
340
341
|
describe('acknowledgeEscalation', () => {
|
|
341
|
-
it('should acknowledge an escalation', () => {
|
|
342
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
342
|
+
it('should acknowledge an escalation', async () => {
|
|
343
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
343
344
|
|
|
344
|
-
const acknowledged = acknowledgeEscalation(db, esc.id);
|
|
345
|
+
const acknowledged = await acknowledgeEscalation(db, esc.id);
|
|
345
346
|
|
|
346
347
|
expect(acknowledged?.status).toBe('acknowledged');
|
|
347
348
|
});
|
|
348
349
|
});
|
|
349
350
|
|
|
350
351
|
describe('deleteEscalation', () => {
|
|
351
|
-
it('should delete an escalation', () => {
|
|
352
|
-
const esc = createEscalation(db, { reason: 'To delete' });
|
|
352
|
+
it('should delete an escalation', async () => {
|
|
353
|
+
const esc = await createEscalation(db, { reason: 'To delete' });
|
|
353
354
|
|
|
354
|
-
deleteEscalation(db, esc.id);
|
|
355
|
+
await deleteEscalation(db, esc.id);
|
|
355
356
|
|
|
356
|
-
const retrieved = getEscalationById(db, esc.id);
|
|
357
|
+
const retrieved = await getEscalationById(db, esc.id);
|
|
357
358
|
expect(retrieved).toBeUndefined();
|
|
358
359
|
});
|
|
359
360
|
|
|
360
|
-
it('should not throw when deleting non-existent escalation', () => {
|
|
361
|
-
expect(
|
|
361
|
+
it('should not throw when deleting non-existent escalation', async () => {
|
|
362
|
+
await expect(deleteEscalation(db, 'non-existent-id')).resolves.not.toThrow();
|
|
362
363
|
});
|
|
363
364
|
});
|
|
364
365
|
|
|
365
366
|
describe('edge cases', () => {
|
|
366
|
-
it('should handle very long reason text', () => {
|
|
367
|
+
it('should handle very long reason text', async () => {
|
|
367
368
|
const longReason = 'A'.repeat(10000);
|
|
368
|
-
const esc = createEscalation(db, { reason: longReason });
|
|
369
|
+
const esc = await createEscalation(db, { reason: longReason });
|
|
369
370
|
|
|
370
|
-
const retrieved = getEscalationById(db, esc.id);
|
|
371
|
+
const retrieved = await getEscalationById(db, esc.id);
|
|
371
372
|
expect(retrieved?.reason).toBe(longReason);
|
|
372
373
|
});
|
|
373
374
|
|
|
374
|
-
it('should handle special characters in reason', () => {
|
|
375
|
+
it('should handle special characters in reason', async () => {
|
|
375
376
|
const reason = 'Reason with \'quotes\' and "double" and\nnewlines';
|
|
376
|
-
const esc = createEscalation(db, { reason });
|
|
377
|
+
const esc = await createEscalation(db, { reason });
|
|
377
378
|
|
|
378
|
-
const retrieved = getEscalationById(db, esc.id);
|
|
379
|
+
const retrieved = await getEscalationById(db, esc.id);
|
|
379
380
|
expect(retrieved?.reason).toBe(reason);
|
|
380
381
|
});
|
|
381
382
|
|
|
382
|
-
it('should handle null resolution', () => {
|
|
383
|
-
const esc = createEscalation(db, { reason: 'Test' });
|
|
383
|
+
it('should handle null resolution', async () => {
|
|
384
|
+
const esc = await createEscalation(db, { reason: 'Test' });
|
|
384
385
|
|
|
385
386
|
expect(esc.resolution).toBeNull();
|
|
386
387
|
expect(esc.resolved_at).toBeNull();
|
|
@@ -388,30 +389,30 @@ describe('escalations queries', () => {
|
|
|
388
389
|
});
|
|
389
390
|
|
|
390
391
|
describe('getRecentEscalationsForAgent', () => {
|
|
391
|
-
it('should return recent escalations for an agent', () => {
|
|
392
|
-
const esc1 = createEscalation(db, { fromAgentId: agentId, reason: 'Recent 1' });
|
|
393
|
-
const esc2 = createEscalation(db, { fromAgentId: agentId, reason: 'Recent 2' });
|
|
392
|
+
it('should return recent escalations for an agent', async () => {
|
|
393
|
+
const esc1 = await createEscalation(db, { fromAgentId: agentId, reason: 'Recent 1' });
|
|
394
|
+
const esc2 = await createEscalation(db, { fromAgentId: agentId, reason: 'Recent 2' });
|
|
394
395
|
|
|
395
|
-
const agent2 = createAgent(db, { type: 'junior', teamId });
|
|
396
|
-
createEscalation(db, { fromAgentId: agent2.id, reason: 'Other agent' });
|
|
396
|
+
const agent2 = await createAgent(db, { type: 'junior', teamId });
|
|
397
|
+
await createEscalation(db, { fromAgentId: agent2.id, reason: 'Other agent' });
|
|
397
398
|
|
|
398
|
-
const recent = getRecentEscalationsForAgent(db, agentId, 30);
|
|
399
|
+
const recent = await getRecentEscalationsForAgent(db, agentId, 30);
|
|
399
400
|
|
|
400
401
|
expect(recent).toHaveLength(2);
|
|
401
402
|
expect(recent.map(e => e.id)).toContain(esc1.id);
|
|
402
403
|
expect(recent.map(e => e.id)).toContain(esc2.id);
|
|
403
404
|
});
|
|
404
405
|
|
|
405
|
-
it('should return empty array for agent with no recent escalations', () => {
|
|
406
|
-
const recent = getRecentEscalationsForAgent(db, 'non-existent-agent', 30);
|
|
406
|
+
it('should return empty array for agent with no recent escalations', async () => {
|
|
407
|
+
const recent = await getRecentEscalationsForAgent(db, 'non-existent-agent', 30);
|
|
407
408
|
expect(recent).toEqual([]);
|
|
408
409
|
});
|
|
409
410
|
|
|
410
|
-
it('should return escalations in DESC order', () => {
|
|
411
|
-
const esc1 = createEscalation(db, { fromAgentId: agentId, reason: 'First' });
|
|
412
|
-
const esc2 = createEscalation(db, { fromAgentId: agentId, reason: 'Second' });
|
|
411
|
+
it('should return escalations in DESC order', async () => {
|
|
412
|
+
const esc1 = await createEscalation(db, { fromAgentId: agentId, reason: 'First' });
|
|
413
|
+
const esc2 = await createEscalation(db, { fromAgentId: agentId, reason: 'Second' });
|
|
413
414
|
|
|
414
|
-
const recent = getRecentEscalationsForAgent(db, agentId, 30);
|
|
415
|
+
const recent = await getRecentEscalationsForAgent(db, agentId, 30);
|
|
415
416
|
|
|
416
417
|
expect(recent).toHaveLength(2);
|
|
417
418
|
// Both escalations should be present
|
|
@@ -421,15 +422,15 @@ describe('escalations queries', () => {
|
|
|
421
422
|
});
|
|
422
423
|
|
|
423
424
|
describe('getActiveEscalationsForAgent', () => {
|
|
424
|
-
it('should return pending and acknowledged escalations for an agent', () => {
|
|
425
|
-
const esc1 = createEscalation(db, { fromAgentId: agentId, reason: 'Pending' });
|
|
426
|
-
const esc2 = createEscalation(db, { fromAgentId: agentId, reason: 'Acknowledged' });
|
|
427
|
-
updateEscalation(db, esc2.id, { status: 'acknowledged' });
|
|
425
|
+
it('should return pending and acknowledged escalations for an agent', async () => {
|
|
426
|
+
const esc1 = await createEscalation(db, { fromAgentId: agentId, reason: 'Pending' });
|
|
427
|
+
const esc2 = await createEscalation(db, { fromAgentId: agentId, reason: 'Acknowledged' });
|
|
428
|
+
await updateEscalation(db, esc2.id, { status: 'acknowledged' });
|
|
428
429
|
|
|
429
|
-
const esc3 = createEscalation(db, { fromAgentId: agentId, reason: 'Resolved' });
|
|
430
|
-
updateEscalation(db, esc3.id, { status: 'resolved', resolution: 'Fixed' });
|
|
430
|
+
const esc3 = await createEscalation(db, { fromAgentId: agentId, reason: 'Resolved' });
|
|
431
|
+
await updateEscalation(db, esc3.id, { status: 'resolved', resolution: 'Fixed' });
|
|
431
432
|
|
|
432
|
-
const active = getActiveEscalationsForAgent(db, agentId);
|
|
433
|
+
const active = await getActiveEscalationsForAgent(db, agentId);
|
|
433
434
|
|
|
434
435
|
expect(active).toHaveLength(2);
|
|
435
436
|
expect(active.map(e => e.id)).toContain(esc1.id);
|
|
@@ -437,19 +438,19 @@ describe('escalations queries', () => {
|
|
|
437
438
|
expect(active.map(e => e.id)).not.toContain(esc3.id);
|
|
438
439
|
});
|
|
439
440
|
|
|
440
|
-
it('should not return resolved escalations', () => {
|
|
441
|
-
createEscalation(db, { fromAgentId: agentId, reason: 'Pending' });
|
|
442
|
-
const esc2 = createEscalation(db, { fromAgentId: agentId, reason: 'Will resolve' });
|
|
443
|
-
updateEscalation(db, esc2.id, { status: 'resolved', resolution: 'Fixed' });
|
|
441
|
+
it('should not return resolved escalations', async () => {
|
|
442
|
+
await createEscalation(db, { fromAgentId: agentId, reason: 'Pending' });
|
|
443
|
+
const esc2 = await createEscalation(db, { fromAgentId: agentId, reason: 'Will resolve' });
|
|
444
|
+
await updateEscalation(db, esc2.id, { status: 'resolved', resolution: 'Fixed' });
|
|
444
445
|
|
|
445
|
-
const active = getActiveEscalationsForAgent(db, agentId);
|
|
446
|
+
const active = await getActiveEscalationsForAgent(db, agentId);
|
|
446
447
|
|
|
447
448
|
expect(active).toHaveLength(1);
|
|
448
449
|
expect(active[0].reason).toBe('Pending');
|
|
449
450
|
});
|
|
450
451
|
|
|
451
|
-
it('should return empty array for agent with no active escalations', () => {
|
|
452
|
-
const active = getActiveEscalationsForAgent(db, 'non-existent-agent');
|
|
452
|
+
it('should return empty array for agent with no active escalations', async () => {
|
|
453
|
+
const active = await getActiveEscalationsForAgent(db, 'non-existent-agent');
|
|
453
454
|
expect(active).toEqual([]);
|
|
454
455
|
});
|
|
455
456
|
});
|