forge-cc 1.0.0 → 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.
- package/package.json +3 -2
- package/dist/gates/codex-gate.d.ts +0 -51
- package/dist/gates/codex-gate.js +0 -121
- package/dist/gates/codex-gate.js.map +0 -1
- package/dist/gates/prd-gate.d.ts +0 -7
- package/dist/gates/prd-gate.js +0 -193
- package/dist/gates/prd-gate.js.map +0 -1
- package/dist/gates/remediation.d.ts +0 -46
- package/dist/gates/remediation.js +0 -423
- package/dist/gates/remediation.js.map +0 -1
- package/dist/gates/review-gate.d.ts +0 -16
- package/dist/gates/review-gate.js +0 -479
- package/dist/gates/review-gate.js.map +0 -1
- package/dist/gates/runtime-gate.d.ts +0 -5
- package/dist/gates/runtime-gate.js +0 -99
- package/dist/gates/runtime-gate.js.map +0 -1
- package/dist/gates/test-analysis.d.ts +0 -21
- package/dist/gates/test-analysis.js +0 -394
- package/dist/gates/test-analysis.js.map +0 -1
- package/dist/gates/visual-capture.d.ts +0 -24
- package/dist/gates/visual-capture.js +0 -144
- package/dist/gates/visual-capture.js.map +0 -1
- package/dist/gates/visual-gate.d.ts +0 -18
- package/dist/gates/visual-gate.js +0 -234
- package/dist/gates/visual-gate.js.map +0 -1
- package/dist/gates/visual-reviewer.d.ts +0 -11
- package/dist/gates/visual-reviewer.js +0 -211
- package/dist/gates/visual-reviewer.js.map +0 -1
- package/dist/go/auto-chain.d.ts +0 -136
- package/dist/go/auto-chain.js +0 -389
- package/dist/go/auto-chain.js.map +0 -1
- package/dist/go/executor.d.ts +0 -137
- package/dist/go/executor.js +0 -447
- package/dist/go/executor.js.map +0 -1
- package/dist/go/finalize.d.ts +0 -108
- package/dist/go/finalize.js +0 -331
- package/dist/go/finalize.js.map +0 -1
- package/dist/go/linear-sync-cli.d.ts +0 -55
- package/dist/go/linear-sync-cli.js +0 -192
- package/dist/go/linear-sync-cli.js.map +0 -1
- package/dist/go/linear-sync.d.ts +0 -112
- package/dist/go/linear-sync.js +0 -375
- package/dist/go/linear-sync.js.map +0 -1
- package/dist/go/prd-queue.d.ts +0 -43
- package/dist/go/prd-queue.js +0 -67
- package/dist/go/prd-queue.js.map +0 -1
- package/dist/go/prd-selector.d.ts +0 -57
- package/dist/go/prd-selector.js +0 -101
- package/dist/go/prd-selector.js.map +0 -1
- package/dist/go/verify-loop.d.ts +0 -64
- package/dist/go/verify-loop.js +0 -327
- package/dist/go/verify-loop.js.map +0 -1
- package/dist/hooks/pre-commit.d.ts +0 -5
- package/dist/hooks/pre-commit.js +0 -75
- package/dist/hooks/pre-commit.js.map +0 -1
- package/dist/linear/issues.d.ts +0 -22
- package/dist/linear/issues.js +0 -51
- package/dist/linear/issues.js.map +0 -1
- package/dist/linear/milestones.d.ts +0 -11
- package/dist/linear/milestones.js +0 -32
- package/dist/linear/milestones.js.map +0 -1
- package/dist/linear/projects.d.ts +0 -16
- package/dist/linear/projects.js +0 -51
- package/dist/linear/projects.js.map +0 -1
- package/dist/reporter/human.d.ts +0 -7
- package/dist/reporter/human.js +0 -93
- package/dist/reporter/human.js.map +0 -1
- package/dist/reporter/json.d.ts +0 -2
- package/dist/reporter/json.js +0 -4
- package/dist/reporter/json.js.map +0 -1
- package/dist/setup/structural-templates.d.ts +0 -12
- package/dist/setup/structural-templates.js +0 -288
- package/dist/setup/structural-templates.js.map +0 -1
- package/dist/setup/templates.d.ts +0 -17
- package/dist/setup/templates.js +0 -109
- package/dist/setup/templates.js.map +0 -1
- package/dist/setup/test-planner.d.ts +0 -38
- package/dist/setup/test-planner.js +0 -91
- package/dist/setup/test-planner.js.map +0 -1
- package/dist/setup/test-scaffold.d.ts +0 -31
- package/dist/setup/test-scaffold.js +0 -209
- package/dist/setup/test-scaffold.js.map +0 -1
- package/dist/setup/test-templates.d.ts +0 -37
- package/dist/setup/test-templates.js +0 -313
- package/dist/setup/test-templates.js.map +0 -1
- package/dist/spec/generator.d.ts +0 -34
- package/dist/spec/generator.js +0 -227
- package/dist/spec/generator.js.map +0 -1
- package/dist/spec/interview.d.ts +0 -142
- package/dist/spec/interview.js +0 -287
- package/dist/spec/interview.js.map +0 -1
- package/dist/spec/linear-sync.d.ts +0 -48
- package/dist/spec/linear-sync.js +0 -125
- package/dist/spec/linear-sync.js.map +0 -1
- package/dist/spec/scanner.d.ts +0 -79
- package/dist/spec/scanner.js +0 -566
- package/dist/spec/scanner.js.map +0 -1
- package/dist/spec/templates.d.ts +0 -375
- package/dist/spec/templates.js +0 -95
- package/dist/spec/templates.js.map +0 -1
- package/dist/state/prd-status.d.ts +0 -62
- package/dist/state/prd-status.js +0 -122
- package/dist/state/prd-status.js.map +0 -1
- package/dist/state/reader.d.ts +0 -7
- package/dist/state/reader.js +0 -43
- package/dist/state/reader.js.map +0 -1
- package/dist/state/writer.d.ts +0 -21
- package/dist/state/writer.js +0 -106
- package/dist/state/writer.js.map +0 -1
- package/dist/team/consensus.d.ts +0 -28
- package/dist/team/consensus.js +0 -130
- package/dist/team/consensus.js.map +0 -1
- package/dist/team/index.d.ts +0 -4
- package/dist/team/index.js +0 -5
- package/dist/team/index.js.map +0 -1
- package/dist/team/lifecycle.d.ts +0 -37
- package/dist/team/lifecycle.js +0 -92
- package/dist/team/lifecycle.js.map +0 -1
- package/dist/team/reviewer.d.ts +0 -10
- package/dist/team/reviewer.js +0 -345
- package/dist/team/reviewer.js.map +0 -1
- package/dist/team/types.d.ts +0 -269
- package/dist/team/types.js +0 -70
- package/dist/team/types.js.map +0 -1
- package/dist/utils/browser.d.ts +0 -10
- package/dist/utils/browser.js +0 -96
- package/dist/utils/browser.js.map +0 -1
- package/dist/utils/platform.d.ts +0 -29
- package/dist/utils/platform.js +0 -90
- package/dist/utils/platform.js.map +0 -1
- package/dist/worktree/identity.d.ts +0 -9
- package/dist/worktree/identity.js +0 -32
- package/dist/worktree/identity.js.map +0 -1
- package/dist/worktree/parallel.d.ts +0 -87
- package/dist/worktree/parallel.js +0 -328
- package/dist/worktree/parallel.js.map +0 -1
- package/dist/worktree/session.d.ts +0 -67
- package/dist/worktree/session.js +0 -194
- package/dist/worktree/session.js.map +0 -1
- package/dist/worktree/state-merge.d.ts +0 -43
- package/dist/worktree/state-merge.js +0 -162
- package/dist/worktree/state-merge.js.map +0 -1
package/dist/go/linear-sync.d.ts
DELETED
|
@@ -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>;
|
package/dist/go/linear-sync.js
DELETED
|
@@ -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;AAEtE,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAiD9D,8EAA8E;AAC9E,eAAe;AACf,8EAA8E;AAE9E;;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,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"}
|
package/dist/go/prd-queue.d.ts
DELETED
|
@@ -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
|
-
}
|
package/dist/go/prd-queue.js
DELETED
|
@@ -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
|
-
}
|
|
67
|
-
//# sourceMappingURL=prd-queue.js.map
|
package/dist/go/prd-queue.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"prd-queue.js","sourceRoot":"","sources":["../../src/go/prd-queue.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,YAAY,EACZ,wBAAwB,EACxB,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAerD,8EAA8E;AAC9E,WAAW;AACX,8EAA8E;AAE9E,MAAM,OAAO,QAAQ;IACX,UAAU,CAAS;IACnB,Q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AAW,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>;
|