forge-cc 0.1.41 → 1.0.1

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 (203) hide show
  1. package/README.md +454 -338
  2. package/dist/cli.js +194 -935
  3. package/dist/cli.js.map +1 -1
  4. package/dist/config/loader.d.ts +1 -1
  5. package/dist/config/loader.js +49 -56
  6. package/dist/config/loader.js.map +1 -1
  7. package/dist/config/schema.d.ts +37 -125
  8. package/dist/config/schema.js +13 -28
  9. package/dist/config/schema.js.map +1 -1
  10. package/dist/doctor.d.ts +10 -0
  11. package/dist/doctor.js +148 -0
  12. package/dist/doctor.js.map +1 -0
  13. package/dist/gates/index.d.ts +14 -12
  14. package/dist/gates/index.js +53 -105
  15. package/dist/gates/index.js.map +1 -1
  16. package/dist/gates/lint-gate.d.ts +2 -2
  17. package/dist/gates/lint-gate.js +60 -66
  18. package/dist/gates/lint-gate.js.map +1 -1
  19. package/dist/gates/tests-gate.d.ts +2 -4
  20. package/dist/gates/tests-gate.js +75 -203
  21. package/dist/gates/tests-gate.js.map +1 -1
  22. package/dist/gates/types-gate.d.ts +2 -2
  23. package/dist/gates/types-gate.js +53 -59
  24. package/dist/gates/types-gate.js.map +1 -1
  25. package/dist/linear/client.d.ts +31 -108
  26. package/dist/linear/client.js +88 -388
  27. package/dist/linear/client.js.map +1 -1
  28. package/dist/linear/sync.d.ts +15 -0
  29. package/dist/linear/sync.js +102 -0
  30. package/dist/linear/sync.js.map +1 -0
  31. package/dist/runner/loop.d.ts +4 -0
  32. package/dist/runner/loop.js +168 -0
  33. package/dist/runner/loop.js.map +1 -0
  34. package/dist/runner/prompt.d.ts +14 -0
  35. package/dist/runner/prompt.js +59 -0
  36. package/dist/runner/prompt.js.map +1 -0
  37. package/dist/runner/update.d.ts +1 -0
  38. package/dist/runner/update.js +72 -0
  39. package/dist/runner/update.js.map +1 -0
  40. package/dist/server.d.ts +6 -2
  41. package/dist/server.js +43 -101
  42. package/dist/server.js.map +1 -1
  43. package/dist/setup.d.ts +5 -0
  44. package/dist/setup.js +208 -0
  45. package/dist/setup.js.map +1 -0
  46. package/dist/state/cache.d.ts +3 -0
  47. package/dist/state/cache.js +23 -0
  48. package/dist/state/cache.js.map +1 -0
  49. package/dist/state/status.d.ts +66 -0
  50. package/dist/state/status.js +96 -0
  51. package/dist/state/status.js.map +1 -0
  52. package/dist/types.d.ts +46 -114
  53. package/dist/worktree/manager.d.ts +6 -103
  54. package/dist/worktree/manager.js +25 -296
  55. package/dist/worktree/manager.js.map +1 -1
  56. package/hooks/pre-commit-verify.js +109 -109
  57. package/package.json +5 -3
  58. package/skills/forge-go.md +20 -13
  59. package/skills/forge-setup.md +149 -388
  60. package/skills/forge-spec.md +367 -342
  61. package/skills/forge-triage.md +179 -133
  62. package/skills/forge-update.md +87 -93
  63. package/dist/gates/codex-gate.d.ts +0 -51
  64. package/dist/gates/codex-gate.js +0 -121
  65. package/dist/gates/codex-gate.js.map +0 -1
  66. package/dist/gates/prd-gate.d.ts +0 -7
  67. package/dist/gates/prd-gate.js +0 -193
  68. package/dist/gates/prd-gate.js.map +0 -1
  69. package/dist/gates/remediation.d.ts +0 -46
  70. package/dist/gates/remediation.js +0 -423
  71. package/dist/gates/remediation.js.map +0 -1
  72. package/dist/gates/review-gate.d.ts +0 -16
  73. package/dist/gates/review-gate.js +0 -479
  74. package/dist/gates/review-gate.js.map +0 -1
  75. package/dist/gates/runtime-gate.d.ts +0 -5
  76. package/dist/gates/runtime-gate.js +0 -99
  77. package/dist/gates/runtime-gate.js.map +0 -1
  78. package/dist/gates/test-analysis.d.ts +0 -21
  79. package/dist/gates/test-analysis.js +0 -394
  80. package/dist/gates/test-analysis.js.map +0 -1
  81. package/dist/gates/visual-capture.d.ts +0 -24
  82. package/dist/gates/visual-capture.js +0 -144
  83. package/dist/gates/visual-capture.js.map +0 -1
  84. package/dist/gates/visual-gate.d.ts +0 -18
  85. package/dist/gates/visual-gate.js +0 -234
  86. package/dist/gates/visual-gate.js.map +0 -1
  87. package/dist/gates/visual-reviewer.d.ts +0 -11
  88. package/dist/gates/visual-reviewer.js +0 -211
  89. package/dist/gates/visual-reviewer.js.map +0 -1
  90. package/dist/go/auto-chain.d.ts +0 -136
  91. package/dist/go/auto-chain.js +0 -389
  92. package/dist/go/auto-chain.js.map +0 -1
  93. package/dist/go/executor.d.ts +0 -137
  94. package/dist/go/executor.js +0 -447
  95. package/dist/go/executor.js.map +0 -1
  96. package/dist/go/finalize.d.ts +0 -108
  97. package/dist/go/finalize.js +0 -331
  98. package/dist/go/finalize.js.map +0 -1
  99. package/dist/go/linear-sync-cli.d.ts +0 -55
  100. package/dist/go/linear-sync-cli.js +0 -192
  101. package/dist/go/linear-sync-cli.js.map +0 -1
  102. package/dist/go/linear-sync.d.ts +0 -112
  103. package/dist/go/linear-sync.js +0 -375
  104. package/dist/go/linear-sync.js.map +0 -1
  105. package/dist/go/prd-queue.d.ts +0 -43
  106. package/dist/go/prd-queue.js +0 -67
  107. package/dist/go/prd-queue.js.map +0 -1
  108. package/dist/go/prd-selector.d.ts +0 -57
  109. package/dist/go/prd-selector.js +0 -101
  110. package/dist/go/prd-selector.js.map +0 -1
  111. package/dist/go/verify-loop.d.ts +0 -64
  112. package/dist/go/verify-loop.js +0 -327
  113. package/dist/go/verify-loop.js.map +0 -1
  114. package/dist/hooks/pre-commit.d.ts +0 -5
  115. package/dist/hooks/pre-commit.js +0 -75
  116. package/dist/hooks/pre-commit.js.map +0 -1
  117. package/dist/linear/issues.d.ts +0 -22
  118. package/dist/linear/issues.js +0 -51
  119. package/dist/linear/issues.js.map +0 -1
  120. package/dist/linear/milestones.d.ts +0 -11
  121. package/dist/linear/milestones.js +0 -32
  122. package/dist/linear/milestones.js.map +0 -1
  123. package/dist/linear/projects.d.ts +0 -16
  124. package/dist/linear/projects.js +0 -51
  125. package/dist/linear/projects.js.map +0 -1
  126. package/dist/reporter/human.d.ts +0 -7
  127. package/dist/reporter/human.js +0 -93
  128. package/dist/reporter/human.js.map +0 -1
  129. package/dist/reporter/json.d.ts +0 -2
  130. package/dist/reporter/json.js +0 -4
  131. package/dist/reporter/json.js.map +0 -1
  132. package/dist/setup/structural-templates.d.ts +0 -12
  133. package/dist/setup/structural-templates.js +0 -288
  134. package/dist/setup/structural-templates.js.map +0 -1
  135. package/dist/setup/templates.d.ts +0 -17
  136. package/dist/setup/templates.js +0 -109
  137. package/dist/setup/templates.js.map +0 -1
  138. package/dist/setup/test-planner.d.ts +0 -38
  139. package/dist/setup/test-planner.js +0 -91
  140. package/dist/setup/test-planner.js.map +0 -1
  141. package/dist/setup/test-scaffold.d.ts +0 -31
  142. package/dist/setup/test-scaffold.js +0 -209
  143. package/dist/setup/test-scaffold.js.map +0 -1
  144. package/dist/setup/test-templates.d.ts +0 -37
  145. package/dist/setup/test-templates.js +0 -313
  146. package/dist/setup/test-templates.js.map +0 -1
  147. package/dist/spec/generator.d.ts +0 -34
  148. package/dist/spec/generator.js +0 -227
  149. package/dist/spec/generator.js.map +0 -1
  150. package/dist/spec/interview.d.ts +0 -142
  151. package/dist/spec/interview.js +0 -287
  152. package/dist/spec/interview.js.map +0 -1
  153. package/dist/spec/linear-sync.d.ts +0 -48
  154. package/dist/spec/linear-sync.js +0 -125
  155. package/dist/spec/linear-sync.js.map +0 -1
  156. package/dist/spec/scanner.d.ts +0 -79
  157. package/dist/spec/scanner.js +0 -566
  158. package/dist/spec/scanner.js.map +0 -1
  159. package/dist/spec/templates.d.ts +0 -375
  160. package/dist/spec/templates.js +0 -95
  161. package/dist/spec/templates.js.map +0 -1
  162. package/dist/state/prd-status.d.ts +0 -62
  163. package/dist/state/prd-status.js +0 -122
  164. package/dist/state/prd-status.js.map +0 -1
  165. package/dist/state/reader.d.ts +0 -7
  166. package/dist/state/reader.js +0 -43
  167. package/dist/state/reader.js.map +0 -1
  168. package/dist/state/writer.d.ts +0 -21
  169. package/dist/state/writer.js +0 -106
  170. package/dist/state/writer.js.map +0 -1
  171. package/dist/team/consensus.d.ts +0 -28
  172. package/dist/team/consensus.js +0 -130
  173. package/dist/team/consensus.js.map +0 -1
  174. package/dist/team/index.d.ts +0 -4
  175. package/dist/team/index.js +0 -5
  176. package/dist/team/index.js.map +0 -1
  177. package/dist/team/lifecycle.d.ts +0 -37
  178. package/dist/team/lifecycle.js +0 -92
  179. package/dist/team/lifecycle.js.map +0 -1
  180. package/dist/team/reviewer.d.ts +0 -10
  181. package/dist/team/reviewer.js +0 -345
  182. package/dist/team/reviewer.js.map +0 -1
  183. package/dist/team/types.d.ts +0 -269
  184. package/dist/team/types.js +0 -70
  185. package/dist/team/types.js.map +0 -1
  186. package/dist/utils/browser.d.ts +0 -10
  187. package/dist/utils/browser.js +0 -96
  188. package/dist/utils/browser.js.map +0 -1
  189. package/dist/utils/platform.d.ts +0 -29
  190. package/dist/utils/platform.js +0 -90
  191. package/dist/utils/platform.js.map +0 -1
  192. package/dist/worktree/identity.d.ts +0 -9
  193. package/dist/worktree/identity.js +0 -32
  194. package/dist/worktree/identity.js.map +0 -1
  195. package/dist/worktree/parallel.d.ts +0 -87
  196. package/dist/worktree/parallel.js +0 -328
  197. package/dist/worktree/parallel.js.map +0 -1
  198. package/dist/worktree/session.d.ts +0 -67
  199. package/dist/worktree/session.js +0 -194
  200. package/dist/worktree/session.js.map +0 -1
  201. package/dist/worktree/state-merge.d.ts +0 -43
  202. package/dist/worktree/state-merge.js +0 -162
  203. package/dist/worktree/state-merge.js.map +0 -1
@@ -1,112 +0,0 @@
1
- /**
2
- * Linear Status Sync for Execution Engine
3
- *
4
- * Bridges the milestone executor with the Linear project management client.
5
- * Manages issue and project state transitions during the go execution flow:
6
- *
7
- * - Milestone start: issues -> In Progress, project -> In Progress
8
- * - Mid-execution: progress comments on milestone issues
9
- * - Milestone complete: issues -> In Review (last milestone) or progress comment
10
- * - Project done: issues -> Done, project -> Done (post-merge)
11
- *
12
- * All operations degrade gracefully — the execution engine must never fail
13
- * because Linear is unavailable or misconfigured.
14
- */
15
- export interface LinearSyncOptions {
16
- projectId: string;
17
- milestoneNumber: number;
18
- milestoneName: string;
19
- teamId?: string;
20
- apiKey?: string;
21
- }
22
- export interface MilestoneStartSync {
23
- linearMilestoneId: string | null;
24
- issuesUpdated: number;
25
- projectUpdated: boolean;
26
- }
27
- export interface MilestoneCompleteOptions extends LinearSyncOptions {
28
- isLastMilestone: boolean;
29
- prUrl?: string;
30
- }
31
- export interface MilestoneCompleteSync {
32
- issuesUpdated: number;
33
- projectUpdated: boolean;
34
- finalState: string;
35
- }
36
- export interface ProgressCommentOptions {
37
- projectId: string;
38
- milestoneNumber: number;
39
- milestoneName: string;
40
- message: string;
41
- apiKey?: string;
42
- }
43
- export interface ProjectIssueIdentifiers {
44
- identifiers: string[];
45
- issues: Array<{
46
- id: string;
47
- identifier: string;
48
- title: string;
49
- }>;
50
- }
51
- export interface ProjectDoneSync {
52
- issuesUpdated: number;
53
- projectUpdated: boolean;
54
- }
55
- /**
56
- * Execute a Linear operation safely — catches LinearClientError and logs
57
- * a warning instead of crashing. The execution engine should never fail
58
- * because Linear is unavailable.
59
- *
60
- * Returns the function's result on success, or null on failure.
61
- */
62
- export declare function syncLinearSafe<T>(fn: () => Promise<T>): Promise<T | null>;
63
- /**
64
- * Sync Linear state when a milestone starts execution.
65
- *
66
- * - Finds the Linear milestone by name
67
- * - Transitions all milestone issues to "In Progress"
68
- * - Transitions the project to "In Progress" (if not already)
69
- *
70
- * Degrades gracefully if Linear is unavailable or the milestone is not found.
71
- */
72
- export declare function syncMilestoneStart(options: LinearSyncOptions): Promise<MilestoneStartSync>;
73
- /**
74
- * Sync Linear state when a milestone completes.
75
- *
76
- * - If NOT the last milestone: adds a progress comment to each issue
77
- * - If IS the last milestone: transitions all project issues to "In Review",
78
- * transitions the project to "In Review"
79
- *
80
- * Degrades gracefully if Linear is unavailable.
81
- */
82
- export declare function syncMilestoneComplete(options: MilestoneCompleteOptions): Promise<MilestoneCompleteSync>;
83
- /**
84
- * Add a progress comment to all issues in a milestone.
85
- * Used during execution to keep Linear updated with wave progress.
86
- *
87
- * Degrades gracefully if Linear is unavailable or the milestone is not found.
88
- */
89
- export declare function addMilestoneProgressComment(options: ProgressCommentOptions): Promise<void>;
90
- /**
91
- * Fetch all issue identifiers for a project (e.g., ["MSIG-123", "MSIG-124"]).
92
- * Used to inject `Closes TEAM-XXX` into PR descriptions so Linear's GitHub
93
- * integration auto-closes issues on merge.
94
- *
95
- * Degrades gracefully if Linear is unavailable.
96
- */
97
- export declare function fetchProjectIssueIdentifiers(options: {
98
- projectId: string;
99
- apiKey?: string;
100
- }): Promise<ProjectIssueIdentifiers | null>;
101
- /**
102
- * Transition all project issues and the project itself to "Done".
103
- * Intended for post-merge cleanup — run after a PR is merged to complete
104
- * the Linear lifecycle.
105
- *
106
- * Skips issues already in Done or Canceled state.
107
- * Degrades gracefully if Linear is unavailable.
108
- */
109
- export declare function syncProjectDone(options: {
110
- projectId: string;
111
- apiKey?: string;
112
- }): Promise<ProjectDoneSync>;
@@ -1,375 +0,0 @@
1
- /**
2
- * Linear Status Sync for Execution Engine
3
- *
4
- * Bridges the milestone executor with the Linear project management client.
5
- * Manages issue and project state transitions during the go execution flow:
6
- *
7
- * - Milestone start: issues -> In Progress, project -> In Progress
8
- * - Mid-execution: progress comments on milestone issues
9
- * - Milestone complete: issues -> In Review (last milestone) or progress comment
10
- * - Project done: issues -> Done, project -> Done (post-merge)
11
- *
12
- * All operations degrade gracefully — the execution engine must never fail
13
- * because Linear is unavailable or misconfigured.
14
- */
15
- import { LinearClient, LinearClientError } from "../linear/client.js";
16
- import { transitionProject } from "../linear/projects.js";
17
- import { transitionMilestoneIssues, resolveStateId } from "../linear/issues.js";
18
- import { findMilestoneByName } from "../linear/milestones.js";
19
- // ---------------------------------------------------------------------------
20
- // Safe Wrapper
21
- // ---------------------------------------------------------------------------
22
- /**
23
- * Execute a Linear operation safely — catches LinearClientError and logs
24
- * a warning instead of crashing. The execution engine should never fail
25
- * because Linear is unavailable.
26
- *
27
- * Returns the function's result on success, or null on failure.
28
- */
29
- export async function syncLinearSafe(fn) {
30
- try {
31
- return await fn();
32
- }
33
- catch (error) {
34
- if (error instanceof LinearClientError) {
35
- console.warn(`[linear-sync] Linear operation failed: ${error.message}`);
36
- return null;
37
- }
38
- // Re-throw unexpected errors — they indicate bugs, not Linear issues
39
- throw error;
40
- }
41
- }
42
- // ---------------------------------------------------------------------------
43
- // Client Creation
44
- // ---------------------------------------------------------------------------
45
- /**
46
- * Attempt to create a LinearClient. Returns null and logs a warning
47
- * if no API key is available (graceful degradation).
48
- */
49
- function createClientSafe(apiKey) {
50
- try {
51
- return new LinearClient(apiKey);
52
- }
53
- catch (error) {
54
- if (error instanceof LinearClientError) {
55
- console.warn(`[linear-sync] Linear client unavailable: ${error.message}`);
56
- return null;
57
- }
58
- throw error;
59
- }
60
- }
61
- // ---------------------------------------------------------------------------
62
- // Milestone Start
63
- // ---------------------------------------------------------------------------
64
- /**
65
- * Sync Linear state when a milestone starts execution.
66
- *
67
- * - Finds the Linear milestone by name
68
- * - Transitions all milestone issues to "In Progress"
69
- * - Transitions the project to "In Progress" (if not already)
70
- *
71
- * Degrades gracefully if Linear is unavailable or the milestone is not found.
72
- */
73
- export async function syncMilestoneStart(options) {
74
- const noopResult = {
75
- linearMilestoneId: null,
76
- issuesUpdated: 0,
77
- projectUpdated: false,
78
- };
79
- const client = createClientSafe(options.apiKey);
80
- if (!client)
81
- return noopResult;
82
- const result = await syncLinearSafe(async () => {
83
- // Find the milestone in Linear
84
- const milestone = await findMilestoneByName(client, options.projectId, options.milestoneName);
85
- if (!milestone) {
86
- console.warn(`[linear-sync] Milestone "${options.milestoneName}" not found in project ${options.projectId}. Skipping issue transitions.`);
87
- // Still try to transition the project
88
- let projectUpdated = false;
89
- try {
90
- await transitionProject(client, options.projectId, "In Progress");
91
- projectUpdated = true;
92
- }
93
- catch {
94
- // Project may already be In Progress or beyond — that's fine
95
- }
96
- return {
97
- linearMilestoneId: null,
98
- issuesUpdated: 0,
99
- projectUpdated,
100
- };
101
- }
102
- // Derive teamId from options or from milestone issues
103
- let teamId = options.teamId;
104
- if (!teamId) {
105
- const milestoneIssues = await client.listIssues({
106
- projectId: options.projectId,
107
- milestoneId: milestone.id,
108
- });
109
- teamId = milestoneIssues[0]?.teamId;
110
- }
111
- if (!teamId) {
112
- console.warn(`[linear-sync] No teamId available — cannot resolve state UUIDs. Skipping issue transitions.`);
113
- // Still try to transition the project
114
- let projectUpdated = false;
115
- try {
116
- await transitionProject(client, options.projectId, "In Progress");
117
- projectUpdated = true;
118
- }
119
- catch {
120
- // Project may already be In Progress or beyond — that's fine
121
- }
122
- return {
123
- linearMilestoneId: milestone.id,
124
- issuesUpdated: 0,
125
- projectUpdated,
126
- };
127
- }
128
- // Transition milestone issues to In Progress
129
- const { updated } = await transitionMilestoneIssues(client, options.projectId, milestone.id, "In Progress", teamId);
130
- // Transition project to In Progress
131
- let projectUpdated = false;
132
- try {
133
- await transitionProject(client, options.projectId, "In Progress");
134
- projectUpdated = true;
135
- }
136
- catch {
137
- // Project may already be In Progress or beyond — that's fine
138
- }
139
- return {
140
- linearMilestoneId: milestone.id,
141
- issuesUpdated: updated,
142
- projectUpdated,
143
- };
144
- });
145
- return result ?? noopResult;
146
- }
147
- // ---------------------------------------------------------------------------
148
- // Milestone Complete
149
- // ---------------------------------------------------------------------------
150
- /**
151
- * Sync Linear state when a milestone completes.
152
- *
153
- * - If NOT the last milestone: adds a progress comment to each issue
154
- * - If IS the last milestone: transitions all project issues to "In Review",
155
- * transitions the project to "In Review"
156
- *
157
- * Degrades gracefully if Linear is unavailable.
158
- */
159
- export async function syncMilestoneComplete(options) {
160
- const noopResult = {
161
- issuesUpdated: 0,
162
- projectUpdated: false,
163
- finalState: "unknown",
164
- };
165
- const client = createClientSafe(options.apiKey);
166
- if (!client)
167
- return noopResult;
168
- const result = await syncLinearSafe(async () => {
169
- if (!options.isLastMilestone) {
170
- // Mid-project milestone — add progress comments
171
- const milestone = await findMilestoneByName(client, options.projectId, options.milestoneName);
172
- if (milestone) {
173
- const issues = await client.listIssues({
174
- projectId: options.projectId,
175
- milestoneId: milestone.id,
176
- });
177
- const commentBody = `Milestone ${options.milestoneNumber} complete. Moving to next milestone.`;
178
- for (const issue of issues) {
179
- await client.createComment(issue.id, commentBody);
180
- }
181
- return {
182
- issuesUpdated: issues.length,
183
- projectUpdated: false,
184
- finalState: "In Progress",
185
- };
186
- }
187
- return {
188
- issuesUpdated: 0,
189
- projectUpdated: false,
190
- finalState: "In Progress",
191
- };
192
- }
193
- // Last milestone — move everything to In Review
194
- // Get ALL project issues (not just this milestone's)
195
- const allIssues = await client.listIssues({
196
- projectId: options.projectId,
197
- });
198
- // Resolve state UUIDs per team (state IDs are team-scoped)
199
- const stateIdByTeam = new Map();
200
- if (options.teamId) {
201
- try {
202
- const id = await resolveStateId(client, options.teamId, "In Review");
203
- stateIdByTeam.set(options.teamId, id);
204
- }
205
- catch {
206
- // State resolution failed for this team
207
- }
208
- }
209
- for (const issue of allIssues) {
210
- if (issue.teamId && !stateIdByTeam.has(issue.teamId)) {
211
- try {
212
- const id = await resolveStateId(client, issue.teamId, "In Review");
213
- stateIdByTeam.set(issue.teamId, id);
214
- }
215
- catch {
216
- // State resolution failed for this team — will fall back to name
217
- }
218
- }
219
- }
220
- let updatedCount = 0;
221
- for (const issue of allIssues) {
222
- if (issue.state !== "In Review" && issue.state !== "Done") {
223
- try {
224
- const issueStateId = issue.teamId ? stateIdByTeam.get(issue.teamId) : undefined;
225
- await client.updateIssue(issue.id, issueStateId ? { stateId: issueStateId } : { state: "In Review" });
226
- updatedCount++;
227
- }
228
- catch {
229
- // Some issues may not support this transition — skip them
230
- }
231
- }
232
- }
233
- // Add PR link comment if available
234
- if (options.prUrl) {
235
- for (const issue of allIssues) {
236
- try {
237
- await client.createComment(issue.id, `PR created: ${options.prUrl}`);
238
- }
239
- catch {
240
- // Comment failures are non-critical
241
- }
242
- }
243
- }
244
- // Transition project to In Review
245
- let projectUpdated = false;
246
- try {
247
- await transitionProject(client, options.projectId, "In Review");
248
- projectUpdated = true;
249
- }
250
- catch {
251
- // Project may already be In Review or beyond — that's fine
252
- }
253
- return {
254
- issuesUpdated: updatedCount,
255
- projectUpdated,
256
- finalState: "In Review",
257
- };
258
- });
259
- return result ?? noopResult;
260
- }
261
- // ---------------------------------------------------------------------------
262
- // Progress Comments
263
- // ---------------------------------------------------------------------------
264
- /**
265
- * Add a progress comment to all issues in a milestone.
266
- * Used during execution to keep Linear updated with wave progress.
267
- *
268
- * Degrades gracefully if Linear is unavailable or the milestone is not found.
269
- */
270
- export async function addMilestoneProgressComment(options) {
271
- const client = createClientSafe(options.apiKey);
272
- if (!client)
273
- return;
274
- await syncLinearSafe(async () => {
275
- const milestone = await findMilestoneByName(client, options.projectId, options.milestoneName);
276
- if (!milestone) {
277
- console.warn(`[linear-sync] Milestone "${options.milestoneName}" not found. Skipping progress comment.`);
278
- return;
279
- }
280
- const issues = await client.listIssues({
281
- projectId: options.projectId,
282
- milestoneId: milestone.id,
283
- });
284
- for (const issue of issues) {
285
- await client.createComment(issue.id, options.message);
286
- }
287
- });
288
- }
289
- // ---------------------------------------------------------------------------
290
- // Fetch Project Issue Identifiers
291
- // ---------------------------------------------------------------------------
292
- /**
293
- * Fetch all issue identifiers for a project (e.g., ["MSIG-123", "MSIG-124"]).
294
- * Used to inject `Closes TEAM-XXX` into PR descriptions so Linear's GitHub
295
- * integration auto-closes issues on merge.
296
- *
297
- * Degrades gracefully if Linear is unavailable.
298
- */
299
- export async function fetchProjectIssueIdentifiers(options) {
300
- const client = createClientSafe(options.apiKey);
301
- if (!client)
302
- return null;
303
- return syncLinearSafe(async () => {
304
- const allIssues = await client.listIssues({
305
- projectId: options.projectId,
306
- });
307
- return {
308
- identifiers: allIssues.map((issue) => issue.identifier),
309
- issues: allIssues.map((issue) => ({
310
- id: issue.id,
311
- identifier: issue.identifier,
312
- title: issue.title,
313
- })),
314
- };
315
- });
316
- }
317
- // ---------------------------------------------------------------------------
318
- // Project Done
319
- // ---------------------------------------------------------------------------
320
- /**
321
- * Transition all project issues and the project itself to "Done".
322
- * Intended for post-merge cleanup — run after a PR is merged to complete
323
- * the Linear lifecycle.
324
- *
325
- * Skips issues already in Done or Canceled state.
326
- * Degrades gracefully if Linear is unavailable.
327
- */
328
- export async function syncProjectDone(options) {
329
- const noopResult = { issuesUpdated: 0, projectUpdated: false };
330
- const client = createClientSafe(options.apiKey);
331
- if (!client)
332
- return noopResult;
333
- const result = await syncLinearSafe(async () => {
334
- const allIssues = await client.listIssues({
335
- projectId: options.projectId,
336
- });
337
- // Resolve state UUIDs per team (state IDs are team-scoped)
338
- const stateIdByTeam = new Map();
339
- for (const issue of allIssues) {
340
- if (issue.teamId && !stateIdByTeam.has(issue.teamId)) {
341
- try {
342
- const id = await resolveStateId(client, issue.teamId, "Done");
343
- stateIdByTeam.set(issue.teamId, id);
344
- }
345
- catch {
346
- // State resolution failed for this team — will fall back to name
347
- }
348
- }
349
- }
350
- let updatedCount = 0;
351
- for (const issue of allIssues) {
352
- if (issue.state !== "Done" && issue.state !== "Canceled") {
353
- try {
354
- const issueStateId = issue.teamId ? stateIdByTeam.get(issue.teamId) : undefined;
355
- await client.updateIssue(issue.id, issueStateId ? { stateId: issueStateId } : { state: "Done" });
356
- updatedCount++;
357
- }
358
- catch {
359
- // Some issues may not support this transition — skip them
360
- }
361
- }
362
- }
363
- let projectUpdated = false;
364
- try {
365
- await transitionProject(client, options.projectId, "Done");
366
- projectUpdated = true;
367
- }
368
- catch {
369
- // Project may already be Done or the transition may be invalid
370
- }
371
- return { issuesUpdated: updatedCount, projectUpdated };
372
- });
373
- return result ?? noopResult;
374
- }
375
- //# sourceMappingURL=linear-sync.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"linear-sync.js","sourceRoot":"","sources":["../../src/go/linear-sync.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC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BAAC,MAAM,CAAC;oBACP,0DAA0D;gBAC5D,CAAC;YACH,CAAC;QACH,CAAC;QAED,IAAI,cAAc,GAAG,KAAK,CAAC;QAC3B,IAAI,CAAC;YACH,MAAM,iBAAiB,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;YAC3D,cAAc,GAAG,IAAI,CAAC;QACxB,CAAC;QAAC,MAAM,CAAC;YACP,+DAA+D;QACjE,CAAC;QAED,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,IAAI,UAAU,CAAC;AAC9B,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * PRD Queue — Multi-PRD Execution Queue Manager
3
- *
4
- * Scans all PRDs, determines which have pending milestones, and tracks
5
- * which PRDs are currently being executed by active sessions.
6
- * Used by `npx forge run --all` to dispatch parallel PRD execution.
7
- */
8
- export interface PRDQueueEntry {
9
- slug: string;
10
- project: string;
11
- branch: string;
12
- pendingMilestones: number;
13
- nextMilestone: number | null;
14
- isExecuting: boolean;
15
- }
16
- export declare class PRDQueue {
17
- private projectDir;
18
- private repoRoot;
19
- constructor(projectDir: string);
20
- /**
21
- * Scan all PRDs and return queue entries with execution status.
22
- *
23
- * For each discovered PRD:
24
- * - Counts pending milestones
25
- * - Finds the next pending milestone number
26
- * - Checks the session registry for active sessions with a matching prdSlug
27
- */
28
- scanPRDs(): Promise<PRDQueueEntry[]>;
29
- /**
30
- * Get PRDs that are ready to execute.
31
- *
32
- * A PRD is ready when it has pending milestones and is not currently
33
- * being executed by any active session.
34
- */
35
- getReadyPRDs(): Promise<PRDQueueEntry[]>;
36
- /**
37
- * Check if a PRD is currently being executed by any active session.
38
- *
39
- * Loads the session registry and checks for active sessions whose
40
- * `prdSlug` field matches the given slug.
41
- */
42
- isExecuting(slug: string): boolean;
43
- }
@@ -1,67 +0,0 @@
1
- /**
2
- * PRD Queue — Multi-PRD Execution Queue Manager
3
- *
4
- * Scans all PRDs, determines which have pending milestones, and tracks
5
- * which PRDs are currently being executed by active sessions.
6
- * Used by `npx forge run --all` to dispatch parallel PRD execution.
7
- */
8
- import { discoverPRDs, findNextPendingMilestone, countPendingMilestones, } from "../state/prd-status.js";
9
- import { getActiveSessions } from "../worktree/session.js";
10
- import { getRepoRoot } from "../worktree/manager.js";
11
- // ---------------------------------------------------------------------------
12
- // PRDQueue
13
- // ---------------------------------------------------------------------------
14
- export class PRDQueue {
15
- projectDir;
16
- repoRoot;
17
- constructor(projectDir) {
18
- this.projectDir = projectDir;
19
- this.repoRoot = getRepoRoot(projectDir);
20
- }
21
- /**
22
- * Scan all PRDs and return queue entries with execution status.
23
- *
24
- * For each discovered PRD:
25
- * - Counts pending milestones
26
- * - Finds the next pending milestone number
27
- * - Checks the session registry for active sessions with a matching prdSlug
28
- */
29
- async scanPRDs() {
30
- const prds = await discoverPRDs(this.projectDir);
31
- const entries = [];
32
- for (const prd of prds) {
33
- const pending = await countPendingMilestones(this.projectDir, prd.slug);
34
- const nextPending = await findNextPendingMilestone(this.projectDir, prd.slug);
35
- entries.push({
36
- slug: prd.slug,
37
- project: prd.status.project,
38
- branch: prd.status.branch,
39
- pendingMilestones: pending,
40
- nextMilestone: nextPending ? nextPending.number : null,
41
- isExecuting: this.isExecuting(prd.slug),
42
- });
43
- }
44
- return entries;
45
- }
46
- /**
47
- * Get PRDs that are ready to execute.
48
- *
49
- * A PRD is ready when it has pending milestones and is not currently
50
- * being executed by any active session.
51
- */
52
- async getReadyPRDs() {
53
- const all = await this.scanPRDs();
54
- return all.filter((entry) => entry.pendingMilestones > 0 && !entry.isExecuting);
55
- }
56
- /**
57
- * Check if a PRD is currently being executed by any active session.
58
- *
59
- * Loads the session registry and checks for active sessions whose
60
- * `prdSlug` field matches the given slug.
61
- */
62
- isExecuting(slug) {
63
- const activeSessions = getActiveSessions(this.repoRoot);
64
- return activeSessions.some((session) => session.prdSlug === slug);
65
- }
66
-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C,IAAI;gBACtD,WAAW,EAAE,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC;aACxC,CAAC,CAAC;QACL,CAAC;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,YAAY;QAChB,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAClC,OAAO,GAAG,CAAC,MAAM,CACf,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,iBAAiB,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAC7D,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,WAAW,CAAC,IAAY;QACtB,MAAM,cAAc,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACxD,OAAO,cAAc,CAAC,IAAI,CACxB,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,OAAO,KAAK,IAAI,CACtC,CAAC;IACJ,CAAC;CACF"}
@@ -1,57 +0,0 @@
1
- /**
2
- * PRD Selector — Discovery and Presentation for PRD Picking
3
- *
4
- * Wraps the low-level prd-status module to provide higher-level functions
5
- * for the /forge:go skill's PRD selection UI. Discovers PRDs with pending
6
- * milestones, formats them for AskUserQuestion pickers, and handles
7
- * single-PRD auto-selection.
8
- */
9
- export interface PendingPRD {
10
- slug: string;
11
- project: string;
12
- branch: string;
13
- pendingCount: number;
14
- completeCount: number;
15
- totalCount: number;
16
- }
17
- export interface PRDPickerOption {
18
- label: string;
19
- description: string;
20
- }
21
- export interface ModePickerOption {
22
- label: string;
23
- description: string;
24
- }
25
- export interface SelectPRDResult {
26
- prd: PendingPRD;
27
- autoSelected: boolean;
28
- }
29
- /**
30
- * Discover all PRDs that have at least one pending milestone.
31
- *
32
- * Wraps `discoverPRDs()` from prd-status, filters to those with pending
33
- * milestones, and computes completion counts for each.
34
- */
35
- export declare function discoverPendingPRDs(projectDir: string): Promise<PendingPRD[]>;
36
- /**
37
- * Format pending PRDs as label/description pairs for AskUserQuestion.
38
- *
39
- * Each option shows the project name, branch, and milestone progress.
40
- * Example label: "forge-agent-teams (2/5 complete)"
41
- * Example description: "Branch: feat/agent-teams | 3 milestones remaining"
42
- */
43
- export declare function presentPRDPicker(prds: PendingPRD[]): PRDPickerOption[];
44
- /**
45
- * Return the two execution mode options for AskUserQuestion.
46
- *
47
- * - "Single milestone" — execute one milestone, then stop for review
48
- * - "Auto (all milestones)" — chain through all pending milestones
49
- */
50
- export declare function presentModePicker(): ModePickerOption[];
51
- /**
52
- * Convenience function: discover pending PRDs and auto-select if only one.
53
- *
54
- * Returns the selected PRD and whether it was auto-selected (skipping the
55
- * picker). Returns null if no PRDs have pending milestones.
56
- */
57
- export declare function selectPRD(projectDir: string): Promise<SelectPRDResult | null>;