hungry-ghost-hive 0.43.0 → 0.43.2
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/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +4 -11
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/approach.d.ts.map +1 -1
- package/dist/cli/commands/approach.js +2 -6
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +9 -0
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +3 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts +2 -27
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +23 -1519
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/manager-utils.d.ts +9 -0
- package/dist/cli/commands/manager/manager-utils.d.ts.map +1 -0
- package/dist/cli/commands/manager/manager-utils.js +49 -0
- package/dist/cli/commands/manager/manager-utils.js.map +1 -0
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts +7 -0
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -0
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +537 -0
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -0
- package/dist/cli/commands/manager/qa-review-handler.d.ts +15 -0
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -0
- package/dist/cli/commands/manager/qa-review-handler.js +290 -0
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -0
- package/dist/cli/commands/manager/stuck-story-helpers.d.ts +32 -0
- package/dist/cli/commands/manager/stuck-story-helpers.d.ts.map +1 -0
- package/dist/cli/commands/manager/stuck-story-helpers.js +163 -0
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -0
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +8 -0
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -0
- package/dist/cli/commands/manager/stuck-story-processor.js +392 -0
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -0
- package/dist/cli/commands/manager/tech-lead-lifecycle.d.ts +3 -0
- package/dist/cli/commands/manager/tech-lead-lifecycle.d.ts.map +1 -0
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +141 -0
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -0
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +5 -20
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/pr.js +7 -22
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +2 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +3 -6
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +2 -5
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/stories.d.ts.map +1 -1
- package/dist/cli/commands/stories.js +2 -5
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cluster/adapters.d.ts +3 -2
- package/dist/cluster/adapters.d.ts.map +1 -1
- package/dist/cluster/adapters.js +2 -11
- package/dist/cluster/adapters.js.map +1 -1
- package/dist/cluster/cluster-http-server.d.ts +20 -0
- package/dist/cluster/cluster-http-server.d.ts.map +1 -0
- package/dist/cluster/cluster-http-server.js +140 -0
- package/dist/cluster/cluster-http-server.js.map +1 -0
- package/dist/cluster/heartbeat-manager.d.ts +24 -0
- package/dist/cluster/heartbeat-manager.d.ts.map +1 -0
- package/dist/cluster/heartbeat-manager.js +74 -0
- package/dist/cluster/heartbeat-manager.js.map +1 -0
- package/dist/cluster/raft-state-machine.d.ts +48 -0
- package/dist/cluster/raft-state-machine.d.ts.map +1 -0
- package/dist/cluster/raft-state-machine.js +207 -0
- package/dist/cluster/raft-state-machine.js.map +1 -0
- package/dist/cluster/runtime.d.ts +5 -29
- package/dist/cluster/runtime.d.ts.map +1 -1
- package/dist/cluster/runtime.js +58 -406
- package/dist/cluster/runtime.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +2 -5
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +116 -178
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +19 -0
- package/dist/utils/cli-helpers.d.ts.map +1 -0
- package/dist/utils/cli-helpers.js +51 -0
- package/dist/utils/cli-helpers.js.map +1 -0
- package/dist/utils/cli-helpers.test.d.ts +2 -0
- package/dist/utils/cli-helpers.test.d.ts.map +1 -0
- package/dist/utils/cli-helpers.test.js +100 -0
- package/dist/utils/cli-helpers.test.js.map +1 -0
- package/dist/utils/github-cli.d.ts +3 -0
- package/dist/utils/github-cli.d.ts.map +1 -0
- package/dist/utils/github-cli.js +4 -0
- package/dist/utils/github-cli.js.map +1 -0
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +1 -2
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/story-status.d.ts +19 -0
- package/dist/utils/story-status.d.ts.map +1 -0
- package/dist/utils/story-status.js +58 -0
- package/dist/utils/story-status.js.map +1 -0
- package/dist/utils/story-status.test.d.ts +2 -0
- package/dist/utils/story-status.test.d.ts.map +1 -0
- package/dist/utils/story-status.test.js +65 -0
- package/dist/utils/story-status.test.js.map +1 -0
- package/package.json +1 -1
- package/src/cli/commands/agents.ts +3 -11
- package/src/cli/commands/approach.ts +2 -7
- package/src/cli/commands/init.test.ts +4 -0
- package/src/cli/commands/init.ts +9 -0
- package/src/cli/commands/manager/index.ts +166 -2236
- package/src/cli/commands/manager/manager-utils.ts +85 -0
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +659 -0
- package/src/cli/commands/manager/qa-review-handler.ts +399 -0
- package/src/cli/commands/manager/stuck-story-helpers.ts +255 -0
- package/src/cli/commands/manager/stuck-story-processor.ts +604 -0
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +210 -0
- package/src/cli/commands/my-stories.ts +5 -30
- package/src/cli/commands/pr.ts +6 -22
- package/src/cli/commands/progress.ts +2 -7
- package/src/cli/commands/resume.ts +3 -6
- package/src/cli/commands/status.ts +2 -5
- package/src/cli/commands/stories.ts +2 -5
- package/src/cluster/adapters.ts +3 -12
- package/src/cluster/cluster-http-server.ts +187 -0
- package/src/cluster/heartbeat-manager.ts +112 -0
- package/src/cluster/raft-state-machine.ts +267 -0
- package/src/cluster/runtime.ts +71 -515
- package/src/integrations/jira/sync.ts +157 -215
- package/src/utils/cli-helpers.test.ts +138 -0
- package/src/utils/cli-helpers.ts +61 -0
- package/src/utils/github-cli.ts +4 -0
- package/src/utils/pr-sync.ts +1 -3
- package/src/utils/story-status.test.ts +74 -0
- package/src/utils/story-status.ts +62 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
|
+
|
|
3
|
+
import { describe, expect, it } from 'vitest';
|
|
4
|
+
import { STORY_STATUS_ORDER, isForwardTransition, isStatusRegression } from './story-status.js';
|
|
5
|
+
|
|
6
|
+
describe('STORY_STATUS_ORDER', () => {
|
|
7
|
+
it('contains all expected statuses in order', () => {
|
|
8
|
+
expect(STORY_STATUS_ORDER).toEqual([
|
|
9
|
+
'draft',
|
|
10
|
+
'estimated',
|
|
11
|
+
'planned',
|
|
12
|
+
'in_progress',
|
|
13
|
+
'review',
|
|
14
|
+
'qa',
|
|
15
|
+
'qa_failed',
|
|
16
|
+
'pr_submitted',
|
|
17
|
+
'merged',
|
|
18
|
+
]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
describe('isStatusRegression', () => {
|
|
23
|
+
it('detects regression to earlier status', () => {
|
|
24
|
+
expect(isStatusRegression('in_progress', 'draft')).toBe(true);
|
|
25
|
+
expect(isStatusRegression('merged', 'planned')).toBe(true);
|
|
26
|
+
expect(isStatusRegression('review', 'estimated')).toBe(true);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it('returns false for forward transitions', () => {
|
|
30
|
+
expect(isStatusRegression('draft', 'estimated')).toBe(false);
|
|
31
|
+
expect(isStatusRegression('planned', 'in_progress')).toBe(false);
|
|
32
|
+
expect(isStatusRegression('review', 'merged')).toBe(false);
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
it('returns false for same status', () => {
|
|
36
|
+
expect(isStatusRegression('planned', 'planned')).toBe(false);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('returns false for unknown statuses', () => {
|
|
40
|
+
expect(isStatusRegression('unknown', 'planned')).toBe(false);
|
|
41
|
+
expect(isStatusRegression('planned', 'unknown')).toBe(false);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe('isForwardTransition', () => {
|
|
46
|
+
it('allows forward transitions', () => {
|
|
47
|
+
expect(isForwardTransition('draft', 'estimated')).toBe(true);
|
|
48
|
+
expect(isForwardTransition('estimated', 'planned')).toBe(true);
|
|
49
|
+
expect(isForwardTransition('planned', 'in_progress')).toBe(true);
|
|
50
|
+
expect(isForwardTransition('in_progress', 'review')).toBe(true);
|
|
51
|
+
expect(isForwardTransition('review', 'pr_submitted')).toBe(true);
|
|
52
|
+
expect(isForwardTransition('pr_submitted', 'qa')).toBe(true);
|
|
53
|
+
expect(isForwardTransition('qa', 'merged')).toBe(true);
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('allows same-status (no-op)', () => {
|
|
57
|
+
expect(isForwardTransition('planned', 'planned')).toBe(true);
|
|
58
|
+
expect(isForwardTransition('in_progress', 'in_progress')).toBe(true);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
it('prevents backward transitions', () => {
|
|
62
|
+
expect(isForwardTransition('in_progress', 'planned')).toBe(false);
|
|
63
|
+
expect(isForwardTransition('in_progress', 'draft')).toBe(false);
|
|
64
|
+
expect(isForwardTransition('review', 'planned')).toBe(false);
|
|
65
|
+
expect(isForwardTransition('merged', 'planned')).toBe(false);
|
|
66
|
+
expect(isForwardTransition('qa', 'planned')).toBe(false);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('handles qa_failed ordering correctly', () => {
|
|
70
|
+
expect(isForwardTransition('review', 'qa_failed')).toBe(true);
|
|
71
|
+
expect(isForwardTransition('in_progress', 'qa_failed')).toBe(true);
|
|
72
|
+
expect(isForwardTransition('qa', 'qa_failed')).toBe(false);
|
|
73
|
+
});
|
|
74
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Ordered lifecycle stages for Hive stories.
|
|
5
|
+
* Used to prevent bidirectional sync from regressing story status
|
|
6
|
+
* and to determine canonical status during cluster story merges.
|
|
7
|
+
*/
|
|
8
|
+
export const STORY_STATUS_ORDER = [
|
|
9
|
+
'draft',
|
|
10
|
+
'estimated',
|
|
11
|
+
'planned',
|
|
12
|
+
'in_progress',
|
|
13
|
+
'review',
|
|
14
|
+
'qa',
|
|
15
|
+
'qa_failed',
|
|
16
|
+
'pr_submitted',
|
|
17
|
+
'merged',
|
|
18
|
+
] as const;
|
|
19
|
+
|
|
20
|
+
export type StoryStatusValue = (typeof STORY_STATUS_ORDER)[number];
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Status progression order for the Hive pipeline.
|
|
24
|
+
* Higher numbers represent further progress. Used to prevent
|
|
25
|
+
* sync from regressing stories backward.
|
|
26
|
+
*
|
|
27
|
+
* Note: qa_failed has the same order as review (4) because it
|
|
28
|
+
* represents a lateral step, not a regression.
|
|
29
|
+
*/
|
|
30
|
+
const STATUS_ORDER: Record<string, number> = {
|
|
31
|
+
draft: 0,
|
|
32
|
+
estimated: 1,
|
|
33
|
+
planned: 2,
|
|
34
|
+
in_progress: 3,
|
|
35
|
+
review: 4,
|
|
36
|
+
pr_submitted: 5,
|
|
37
|
+
qa: 6,
|
|
38
|
+
qa_failed: 4, // allowed as a backward step from qa
|
|
39
|
+
merged: 7,
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Check if transitioning from currentStatus to newStatus would be a regression.
|
|
44
|
+
* Returns true if the new status is earlier in the lifecycle than the current one.
|
|
45
|
+
* Unknown statuses are allowed through (returns false).
|
|
46
|
+
*/
|
|
47
|
+
export function isStatusRegression(currentStatus: string, newStatus: string): boolean {
|
|
48
|
+
const currentIdx = STORY_STATUS_ORDER.indexOf(currentStatus as StoryStatusValue);
|
|
49
|
+
const newIdx = STORY_STATUS_ORDER.indexOf(newStatus as StoryStatusValue);
|
|
50
|
+
if (currentIdx === -1 || newIdx === -1) return false;
|
|
51
|
+
return newIdx < currentIdx;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Check whether transitioning from currentStatus to newStatus is a
|
|
56
|
+
* forward (or lateral) move in the pipeline.
|
|
57
|
+
*/
|
|
58
|
+
export function isForwardTransition(currentStatus: string, newStatus: string): boolean {
|
|
59
|
+
const currentOrder = STATUS_ORDER[currentStatus] ?? -1;
|
|
60
|
+
const newOrder = STATUS_ORDER[newStatus] ?? -1;
|
|
61
|
+
return newOrder >= currentOrder;
|
|
62
|
+
}
|