hungry-ghost-hive 0.43.2 → 0.45.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.
Files changed (201) hide show
  1. package/dist/agents/base-agent.d.ts +1 -0
  2. package/dist/agents/base-agent.d.ts.map +1 -1
  3. package/dist/agents/base-agent.js +4 -0
  4. package/dist/agents/base-agent.js.map +1 -1
  5. package/dist/agents/intermediate.js +2 -2
  6. package/dist/agents/intermediate.js.map +1 -1
  7. package/dist/agents/junior.js +2 -2
  8. package/dist/agents/junior.js.map +1 -1
  9. package/dist/agents/qa.d.ts.map +1 -1
  10. package/dist/agents/qa.js +5 -5
  11. package/dist/agents/qa.js.map +1 -1
  12. package/dist/agents/senior.d.ts.map +1 -1
  13. package/dist/agents/senior.js +5 -5
  14. package/dist/agents/senior.js.map +1 -1
  15. package/dist/agents/tech-lead.d.ts.map +1 -1
  16. package/dist/agents/tech-lead.js +8 -3
  17. package/dist/agents/tech-lead.js.map +1 -1
  18. package/dist/cli/commands/assign.d.ts.map +1 -1
  19. package/dist/cli/commands/assign.js +4 -2
  20. package/dist/cli/commands/assign.js.map +1 -1
  21. package/dist/cli/commands/assign.test.js +5 -0
  22. package/dist/cli/commands/assign.test.js.map +1 -1
  23. package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
  24. package/dist/cli/commands/manager/handoff-recovery.js +4 -2
  25. package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
  26. package/dist/cli/commands/manager/index.d.ts.map +1 -1
  27. package/dist/cli/commands/manager/index.js +16 -12
  28. package/dist/cli/commands/manager/index.js.map +1 -1
  29. package/dist/cli/commands/manager/tech-lead-lifecycle.d.ts.map +1 -1
  30. package/dist/cli/commands/manager/tech-lead-lifecycle.js +8 -3
  31. package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
  32. package/dist/cli/commands/msg.d.ts.map +1 -1
  33. package/dist/cli/commands/msg.js +8 -7
  34. package/dist/cli/commands/msg.js.map +1 -1
  35. package/dist/cli/commands/my-stories.js +3 -3
  36. package/dist/cli/commands/my-stories.js.map +1 -1
  37. package/dist/cli/commands/nuke.d.ts.map +1 -1
  38. package/dist/cli/commands/nuke.js +18 -7
  39. package/dist/cli/commands/nuke.js.map +1 -1
  40. package/dist/cli/commands/nuke.test.js +24 -0
  41. package/dist/cli/commands/nuke.test.js.map +1 -1
  42. package/dist/cli/commands/pr.js +5 -0
  43. package/dist/cli/commands/pr.js.map +1 -1
  44. package/dist/cli/commands/pr.test.js +43 -1
  45. package/dist/cli/commands/pr.test.js.map +1 -1
  46. package/dist/cli/commands/req.d.ts +1 -1
  47. package/dist/cli/commands/req.d.ts.map +1 -1
  48. package/dist/cli/commands/req.js +9 -6
  49. package/dist/cli/commands/req.js.map +1 -1
  50. package/dist/cli/commands/resume.d.ts.map +1 -1
  51. package/dist/cli/commands/resume.js +4 -1
  52. package/dist/cli/commands/resume.js.map +1 -1
  53. package/dist/cli/commands/stories.js +3 -3
  54. package/dist/cli/commands/stories.js.map +1 -1
  55. package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
  56. package/dist/cli/dashboard/panels/agents.js +7 -3
  57. package/dist/cli/dashboard/panels/agents.js.map +1 -1
  58. package/dist/cli-runtimes/chrome.d.ts +17 -0
  59. package/dist/cli-runtimes/chrome.d.ts.map +1 -0
  60. package/dist/cli-runtimes/chrome.js +36 -0
  61. package/dist/cli-runtimes/chrome.js.map +1 -0
  62. package/dist/cli-runtimes/claude.d.ts +3 -3
  63. package/dist/cli-runtimes/claude.d.ts.map +1 -1
  64. package/dist/cli-runtimes/claude.js +14 -8
  65. package/dist/cli-runtimes/claude.js.map +1 -1
  66. package/dist/cli-runtimes/codex.d.ts +3 -3
  67. package/dist/cli-runtimes/codex.d.ts.map +1 -1
  68. package/dist/cli-runtimes/codex.js +2 -2
  69. package/dist/cli-runtimes/codex.js.map +1 -1
  70. package/dist/cli-runtimes/gemini.d.ts +3 -3
  71. package/dist/cli-runtimes/gemini.d.ts.map +1 -1
  72. package/dist/cli-runtimes/gemini.js +2 -2
  73. package/dist/cli-runtimes/gemini.js.map +1 -1
  74. package/dist/cli-runtimes/index.d.ts +3 -2
  75. package/dist/cli-runtimes/index.d.ts.map +1 -1
  76. package/dist/cli-runtimes/index.js +1 -0
  77. package/dist/cli-runtimes/index.js.map +1 -1
  78. package/dist/cli-runtimes/index.test.js +133 -1
  79. package/dist/cli-runtimes/index.test.js.map +1 -1
  80. package/dist/cli-runtimes/types.d.ts +9 -2
  81. package/dist/cli-runtimes/types.d.ts.map +1 -1
  82. package/dist/config/schema.d.ts +8 -0
  83. package/dist/config/schema.d.ts.map +1 -1
  84. package/dist/config/schema.js +6 -0
  85. package/dist/config/schema.js.map +1 -1
  86. package/dist/context-files/generator.d.ts +1 -1
  87. package/dist/context-files/generator.d.ts.map +1 -1
  88. package/dist/context-files/generator.js +3 -2
  89. package/dist/context-files/generator.js.map +1 -1
  90. package/dist/context-files/index.test.js +2 -0
  91. package/dist/context-files/index.test.js.map +1 -1
  92. package/dist/db/client.d.ts +1 -0
  93. package/dist/db/client.d.ts.map +1 -1
  94. package/dist/db/client.js +6 -0
  95. package/dist/db/client.js.map +1 -1
  96. package/dist/db/migrations/015-add-story-markdown-path.sql +5 -0
  97. package/dist/db/queries/stories.d.ts +3 -3
  98. package/dist/db/queries/stories.d.ts.map +1 -1
  99. package/dist/db/queries/stories.js +23 -5
  100. package/dist/db/queries/stories.js.map +1 -1
  101. package/dist/db/queries/test-helpers.d.ts.map +1 -1
  102. package/dist/db/queries/test-helpers.js +1 -0
  103. package/dist/db/queries/test-helpers.js.map +1 -1
  104. package/dist/git/worktree.d.ts.map +1 -1
  105. package/dist/git/worktree.js +7 -0
  106. package/dist/git/worktree.js.map +1 -1
  107. package/dist/git/worktree.test.js +30 -0
  108. package/dist/git/worktree.test.js.map +1 -1
  109. package/dist/orchestrator/prompt-templates.d.ts +3 -1
  110. package/dist/orchestrator/prompt-templates.d.ts.map +1 -1
  111. package/dist/orchestrator/prompt-templates.js +16 -8
  112. package/dist/orchestrator/prompt-templates.js.map +1 -1
  113. package/dist/orchestrator/prompt-templates.test.js +4 -0
  114. package/dist/orchestrator/prompt-templates.test.js.map +1 -1
  115. package/dist/orchestrator/scheduler.d.ts.map +1 -1
  116. package/dist/orchestrator/scheduler.js +23 -12
  117. package/dist/orchestrator/scheduler.js.map +1 -1
  118. package/dist/orchestrator/scheduler.test.js +1 -0
  119. package/dist/orchestrator/scheduler.test.js.map +1 -1
  120. package/dist/tmux/manager.d.ts +7 -6
  121. package/dist/tmux/manager.d.ts.map +1 -1
  122. package/dist/tmux/manager.js +29 -13
  123. package/dist/tmux/manager.js.map +1 -1
  124. package/dist/utils/auto-merge.d.ts.map +1 -1
  125. package/dist/utils/auto-merge.js +66 -5
  126. package/dist/utils/auto-merge.js.map +1 -1
  127. package/dist/utils/auto-merge.test.js +62 -0
  128. package/dist/utils/auto-merge.test.js.map +1 -1
  129. package/dist/utils/instance.d.ts +32 -0
  130. package/dist/utils/instance.d.ts.map +1 -0
  131. package/dist/utils/instance.js +82 -0
  132. package/dist/utils/instance.js.map +1 -0
  133. package/dist/utils/instance.test.d.ts +2 -0
  134. package/dist/utils/instance.test.d.ts.map +1 -0
  135. package/dist/utils/instance.test.js +103 -0
  136. package/dist/utils/instance.test.js.map +1 -0
  137. package/dist/utils/paths.d.ts +2 -0
  138. package/dist/utils/paths.d.ts.map +1 -1
  139. package/dist/utils/paths.js +2 -0
  140. package/dist/utils/paths.js.map +1 -1
  141. package/dist/utils/paths.test.js +6 -0
  142. package/dist/utils/paths.test.js.map +1 -1
  143. package/dist/utils/story-markdown.d.ts +16 -0
  144. package/dist/utils/story-markdown.d.ts.map +1 -0
  145. package/dist/utils/story-markdown.js +82 -0
  146. package/dist/utils/story-markdown.js.map +1 -0
  147. package/dist/utils/story-markdown.test.d.ts +2 -0
  148. package/dist/utils/story-markdown.test.d.ts.map +1 -0
  149. package/dist/utils/story-markdown.test.js +143 -0
  150. package/dist/utils/story-markdown.test.js.map +1 -0
  151. package/package.json +1 -1
  152. package/src/agents/base-agent.ts +5 -0
  153. package/src/agents/intermediate.ts +2 -2
  154. package/src/agents/junior.ts +2 -2
  155. package/src/agents/qa.ts +13 -8
  156. package/src/agents/senior.ts +21 -11
  157. package/src/agents/tech-lead.ts +28 -13
  158. package/src/cli/commands/assign.test.ts +5 -0
  159. package/src/cli/commands/assign.ts +4 -2
  160. package/src/cli/commands/manager/handoff-recovery.ts +4 -2
  161. package/src/cli/commands/manager/index.ts +16 -11
  162. package/src/cli/commands/manager/tech-lead-lifecycle.ts +9 -3
  163. package/src/cli/commands/msg.ts +8 -7
  164. package/src/cli/commands/my-stories.ts +22 -13
  165. package/src/cli/commands/nuke.test.ts +31 -0
  166. package/src/cli/commands/nuke.ts +18 -7
  167. package/src/cli/commands/pr.test.ts +77 -1
  168. package/src/cli/commands/pr.ts +5 -0
  169. package/src/cli/commands/req.ts +13 -6
  170. package/src/cli/commands/resume.ts +4 -1
  171. package/src/cli/commands/stories.ts +22 -13
  172. package/src/cli/dashboard/panels/agents.ts +7 -3
  173. package/src/cli-runtimes/chrome.ts +43 -0
  174. package/src/cli-runtimes/claude.ts +26 -9
  175. package/src/cli-runtimes/codex.ts +12 -3
  176. package/src/cli-runtimes/gemini.ts +12 -3
  177. package/src/cli-runtimes/index.test.ts +158 -0
  178. package/src/cli-runtimes/index.ts +3 -2
  179. package/src/cli-runtimes/types.ts +19 -2
  180. package/src/config/schema.ts +6 -0
  181. package/src/context-files/generator.ts +3 -2
  182. package/src/context-files/index.test.ts +2 -0
  183. package/src/db/client.ts +7 -0
  184. package/src/db/migrations/015-add-story-markdown-path.sql +5 -0
  185. package/src/db/queries/stories.ts +29 -5
  186. package/src/db/queries/test-helpers.ts +1 -0
  187. package/src/git/worktree.test.ts +43 -0
  188. package/src/git/worktree.ts +10 -0
  189. package/src/orchestrator/prompt-templates.test.ts +4 -0
  190. package/src/orchestrator/prompt-templates.ts +20 -8
  191. package/src/orchestrator/scheduler.test.ts +1 -0
  192. package/src/orchestrator/scheduler.ts +33 -12
  193. package/src/tmux/manager.ts +42 -13
  194. package/src/utils/auto-merge.test.ts +81 -0
  195. package/src/utils/auto-merge.ts +78 -5
  196. package/src/utils/instance.test.ts +129 -0
  197. package/src/utils/instance.ts +95 -0
  198. package/src/utils/paths.test.ts +8 -0
  199. package/src/utils/paths.ts +3 -0
  200. package/src/utils/story-markdown.test.ts +176 -0
  201. package/src/utils/story-markdown.ts +94 -0
@@ -0,0 +1,94 @@
1
+ // Licensed under the Hungry Ghost Hive License. See LICENSE.
2
+
3
+ import { existsSync, mkdirSync, rmSync, writeFileSync } from 'fs';
4
+ import { join } from 'path';
5
+ import type { StoryRow } from '../db/client.js';
6
+
7
+ /**
8
+ * Generate markdown content for a story.
9
+ */
10
+ export function generateStoryMarkdown(story: StoryRow): string {
11
+ const lines: string[] = [];
12
+
13
+ lines.push(`# ${story.title}`);
14
+ lines.push('');
15
+ lines.push(`**Story ID:** ${story.id}`);
16
+ lines.push(`**Status:** ${story.status}`);
17
+
18
+ if (story.team_id) {
19
+ lines.push(`**Team:** ${story.team_id}`);
20
+ }
21
+ if (story.requirement_id) {
22
+ lines.push(`**Requirement:** ${story.requirement_id}`);
23
+ }
24
+ if (story.assigned_agent_id) {
25
+ lines.push(`**Assigned Agent:** ${story.assigned_agent_id}`);
26
+ }
27
+ if (story.complexity_score !== null) {
28
+ lines.push(`**Complexity:** ${story.complexity_score}`);
29
+ }
30
+ if (story.story_points !== null) {
31
+ lines.push(`**Story Points:** ${story.story_points}`);
32
+ }
33
+ if (story.branch_name) {
34
+ lines.push(`**Branch:** ${story.branch_name}`);
35
+ }
36
+ if (story.pr_url) {
37
+ lines.push(`**PR:** ${story.pr_url}`);
38
+ }
39
+
40
+ lines.push('');
41
+ lines.push('## Description');
42
+ lines.push('');
43
+ lines.push(story.description);
44
+
45
+ if (story.acceptance_criteria) {
46
+ lines.push('');
47
+ lines.push('## Acceptance Criteria');
48
+ lines.push('');
49
+ try {
50
+ const criteria = JSON.parse(story.acceptance_criteria) as string[];
51
+ for (const criterion of criteria) {
52
+ lines.push(`- [ ] ${criterion}`);
53
+ }
54
+ } catch {
55
+ lines.push(story.acceptance_criteria);
56
+ }
57
+ }
58
+
59
+ lines.push('');
60
+ lines.push('---');
61
+ lines.push('');
62
+ lines.push(`*Created: ${story.created_at}*`);
63
+ lines.push(`*Updated: ${story.updated_at}*`);
64
+ lines.push('');
65
+
66
+ return lines.join('\n');
67
+ }
68
+
69
+ /**
70
+ * Write a story as a markdown file in the storiesDir.
71
+ * Creates the directory if it does not exist.
72
+ * Returns the path to the written file.
73
+ */
74
+ export function writeStoryMarkdown(storiesDir: string, story: StoryRow): string {
75
+ mkdirSync(storiesDir, { recursive: true });
76
+
77
+ const fileName = `${story.id}.md`;
78
+ const filePath = join(storiesDir, fileName);
79
+ const content = generateStoryMarkdown(story);
80
+
81
+ writeFileSync(filePath, content, 'utf-8');
82
+
83
+ return filePath;
84
+ }
85
+
86
+ /**
87
+ * Delete a story's markdown file if it exists.
88
+ */
89
+ export function deleteStoryMarkdown(storiesDir: string, storyId: string): void {
90
+ const filePath = join(storiesDir, `${storyId}.md`);
91
+ if (existsSync(filePath)) {
92
+ rmSync(filePath);
93
+ }
94
+ }