@agentic-sdlc/dispatch 0.3.0 → 0.3.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/dist/src/orchestrator.js +140 -50
- package/dist/src/orchestrator.js.map +1 -1
- package/package.json +1 -1
- package/src/orchestrator.ts +157 -52
package/dist/src/orchestrator.js
CHANGED
|
@@ -31,7 +31,7 @@ export function orchestrateStage(ctx) {
|
|
|
31
31
|
const artifactPath = join(artifactsDir, stage.produces);
|
|
32
32
|
if (!existsSync(artifactPath)) {
|
|
33
33
|
console.error(`[dispatch] Artifact not found: ${artifactPath}`);
|
|
34
|
-
|
|
34
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Agent did not produce \`${stage.produces}\`. Escalating.`);
|
|
35
35
|
applyLabel(repo, issueNumber, "escalated", label);
|
|
36
36
|
return { stage: stage.name, action: "no-artifact", nextLabel: "escalated" };
|
|
37
37
|
}
|
|
@@ -51,7 +51,12 @@ export function orchestrateStage(ctx) {
|
|
|
51
51
|
}
|
|
52
52
|
function handleGateNone(ctx, stage, stageIndex) {
|
|
53
53
|
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
54
|
-
|
|
54
|
+
const branchPattern = stage.branch_pattern;
|
|
55
|
+
if (branchPattern) {
|
|
56
|
+
// Stage with a branch pattern: push to branch and open/update draft PR
|
|
57
|
+
return handleBranchStage(ctx, stage, stageIndex);
|
|
58
|
+
}
|
|
59
|
+
// Simple stage (triage, plan): commit to main and advance
|
|
55
60
|
try {
|
|
56
61
|
execFileSync("git", ["add", artifactsDir]);
|
|
57
62
|
execFileSync("git", ["commit", "-m", `chore: add ${stage.produces} for issue #${issueNumber}`]);
|
|
@@ -60,11 +65,51 @@ function handleGateNone(ctx, stage, stageIndex) {
|
|
|
60
65
|
catch (err) {
|
|
61
66
|
console.error(`[dispatch] Git commit/push failed for gate=none:`, err);
|
|
62
67
|
}
|
|
63
|
-
|
|
68
|
+
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
69
|
+
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
70
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Complete. Advancing to \`${nextLabel ?? "done"}\`.\n\n<details>\n<summary>${stage.produces}</summary>\n\n${artifactContent}\n</details>`);
|
|
71
|
+
if (nextLabel) {
|
|
72
|
+
applyLabel(repo, issueNumber, nextLabel, label);
|
|
73
|
+
}
|
|
74
|
+
return { stage: stage.name, action: "advanced", nextLabel };
|
|
75
|
+
}
|
|
76
|
+
function handleBranchStage(ctx, stage, stageIndex) {
|
|
77
|
+
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
78
|
+
const branchName = renderTemplate(stage.branch_pattern, issueNumber);
|
|
79
|
+
// Create or checkout branch
|
|
80
|
+
try {
|
|
81
|
+
execFileSync("git", ["checkout", "-b", branchName], { stdio: "pipe" });
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
try {
|
|
85
|
+
execFileSync("git", ["checkout", branchName], { stdio: "pipe" });
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
console.error(`[dispatch] Failed to checkout branch ${branchName}:`, err);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
// Commit and push
|
|
92
|
+
try {
|
|
93
|
+
execFileSync("git", ["add", artifactsDir]);
|
|
94
|
+
execFileSync("git", ["commit", "-m", `feat: ${stage.name} for issue #${issueNumber}`], { stdio: "pipe" });
|
|
95
|
+
}
|
|
96
|
+
catch { /* may be nothing to commit */ }
|
|
97
|
+
try {
|
|
98
|
+
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName], { stdio: "pipe" });
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
console.error(`[dispatch] Git push failed:`, err);
|
|
102
|
+
}
|
|
103
|
+
// Open draft PR if none exists, or find existing
|
|
104
|
+
const prNumber = ensureDraftPr(repo, issueNumber, branchName, stage.name);
|
|
105
|
+
// Post build log as PR comment
|
|
64
106
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
107
|
+
if (prNumber && artifactContent) {
|
|
108
|
+
postPrComment(repo, prNumber, `## Build Log\n\n${artifactContent}`);
|
|
109
|
+
}
|
|
110
|
+
// Advance to next stage
|
|
65
111
|
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
66
|
-
|
|
67
|
-
// Advance to next stage label
|
|
112
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Complete. Draft PR opened. Advancing to \`${nextLabel ?? "done"}\`.`);
|
|
68
113
|
if (nextLabel) {
|
|
69
114
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
70
115
|
}
|
|
@@ -75,49 +120,40 @@ function handleGatePrReview(ctx, stage, stageIndex) {
|
|
|
75
120
|
const branchName = renderTemplate(stage.branch_pattern ?? `${stage.name}/issue-{{ issue.number }}`, issueNumber);
|
|
76
121
|
// Create or checkout branch
|
|
77
122
|
try {
|
|
78
|
-
execFileSync("git", ["checkout", "-b", branchName]);
|
|
123
|
+
execFileSync("git", ["checkout", "-b", branchName], { stdio: "pipe" });
|
|
79
124
|
}
|
|
80
125
|
catch {
|
|
81
|
-
// Branch may already exist — try checking it out
|
|
82
126
|
try {
|
|
83
|
-
execFileSync("git", ["checkout", branchName]);
|
|
127
|
+
execFileSync("git", ["checkout", branchName], { stdio: "pipe" });
|
|
84
128
|
}
|
|
85
129
|
catch (err) {
|
|
86
130
|
console.error(`[dispatch] Failed to checkout branch ${branchName}:`, err);
|
|
87
131
|
}
|
|
88
132
|
}
|
|
89
|
-
// Commit
|
|
133
|
+
// Commit and push
|
|
90
134
|
try {
|
|
91
135
|
execFileSync("git", ["add", artifactsDir]);
|
|
92
|
-
execFileSync("git", ["commit", "-m", `feat: add ${stage.produces} for issue #${issueNumber}`]);
|
|
136
|
+
execFileSync("git", ["commit", "-m", `feat: add ${stage.produces} for issue #${issueNumber}`], { stdio: "pipe" });
|
|
93
137
|
}
|
|
94
|
-
catch
|
|
95
|
-
console.error(`[dispatch] Git commit failed for pr-review gate:`, err);
|
|
96
|
-
}
|
|
97
|
-
// Push branch (force to handle re-runs where branch already exists)
|
|
138
|
+
catch { /* may be nothing to commit */ }
|
|
98
139
|
try {
|
|
99
|
-
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName]);
|
|
140
|
+
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName], { stdio: "pipe" });
|
|
100
141
|
}
|
|
101
142
|
catch (err) {
|
|
102
143
|
console.error(`[dispatch] Git push failed:`, err);
|
|
103
144
|
}
|
|
104
|
-
// Open PR
|
|
145
|
+
// Open PR (not draft — this is for human review)
|
|
105
146
|
let prCreated = false;
|
|
106
147
|
try {
|
|
107
148
|
const existing = execFileSync("gh", [
|
|
108
|
-
"pr", "list",
|
|
109
|
-
|
|
110
|
-
"--head", branchName,
|
|
111
|
-
"--json", "number",
|
|
112
|
-
]).toString().trim();
|
|
149
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
150
|
+
], { stdio: "pipe" }).toString().trim();
|
|
113
151
|
const prs = JSON.parse(existing || "[]");
|
|
114
152
|
if (prs.length === 0) {
|
|
115
153
|
execFileSync("gh", [
|
|
116
|
-
"pr", "create",
|
|
117
|
-
"--repo", repo,
|
|
118
|
-
"--head", branchName,
|
|
154
|
+
"pr", "create", "--repo", repo, "--head", branchName,
|
|
119
155
|
"--title", `[#${issueNumber}] ${stage.name}: ${stage.produces}`,
|
|
120
|
-
"--body", `Automated PR for issue #${issueNumber}
|
|
156
|
+
"--body", `Automated PR for issue #${issueNumber}.\n\nReview and merge to advance the pipeline.\n\nCloses #${issueNumber}`,
|
|
121
157
|
]);
|
|
122
158
|
prCreated = true;
|
|
123
159
|
}
|
|
@@ -125,31 +161,35 @@ function handleGatePrReview(ctx, stage, stageIndex) {
|
|
|
125
161
|
catch (err) {
|
|
126
162
|
console.error(`[dispatch] PR creation failed:`, err);
|
|
127
163
|
}
|
|
128
|
-
// Find the "ready" label for this stage (convention: stage's own ready label)
|
|
129
164
|
const readyLabel = findReadyLabel(workflowConfig.pipeline, stage.name);
|
|
130
165
|
const nextLabel = readyLabel ?? findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
131
|
-
// Post comment about PR
|
|
132
166
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
133
|
-
|
|
134
|
-
postComment(repo, issueNumber, `## Stage: ${stage.name} — PR Ready\n\n${prMsg}\n\n<details>\n<summary>Artifact: ${stage.produces}</summary>\n\n${artifactContent}\n</details>\n\nLabel: \`${nextLabel ?? "done"}\``);
|
|
167
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — PR ready for review on \`${branchName}\`.\n\n<details>\n<summary>${stage.produces}</summary>\n\n${artifactContent}\n</details>`);
|
|
135
168
|
if (nextLabel) {
|
|
136
169
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
137
170
|
}
|
|
138
|
-
return {
|
|
139
|
-
stage: stage.name,
|
|
140
|
-
action: prCreated ? "opened-pr" : "advanced",
|
|
141
|
-
nextLabel,
|
|
142
|
-
};
|
|
171
|
+
return { stage: stage.name, action: prCreated ? "opened-pr" : "advanced", nextLabel };
|
|
143
172
|
}
|
|
144
173
|
function handleGateRetry(ctx, stage, stageIndex) {
|
|
145
174
|
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
146
|
-
// Read verdict from artifact frontmatter
|
|
147
175
|
const verdict = readVerdictFromArtifact(artifactsDir, stage.produces ?? "");
|
|
148
176
|
const maxRetries = stage.max_retries ?? 3;
|
|
149
177
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
178
|
+
// Find the impl PR to comment on
|
|
179
|
+
const implBranch = `impl/issue-${issueNumber}`;
|
|
180
|
+
const prNumber = findPrByBranch(repo, implBranch);
|
|
150
181
|
if (verdict === "pass") {
|
|
182
|
+
// Post QA report on PR
|
|
183
|
+
if (prNumber) {
|
|
184
|
+
postPrComment(repo, prNumber, `## QA Report — PASS\n\n${artifactContent}`);
|
|
185
|
+
// Mark PR as ready for review (remove draft)
|
|
186
|
+
try {
|
|
187
|
+
execFileSync("gh", ["pr", "ready", String(prNumber), "--repo", repo], { stdio: "pipe" });
|
|
188
|
+
}
|
|
189
|
+
catch { /* may already be ready */ }
|
|
190
|
+
}
|
|
151
191
|
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
152
|
-
|
|
192
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — PASS. PR ready for human review.`);
|
|
153
193
|
if (nextLabel) {
|
|
154
194
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
155
195
|
}
|
|
@@ -158,13 +198,19 @@ function handleGateRetry(ctx, stage, stageIndex) {
|
|
|
158
198
|
// verdict is "fail" or unknown — check retry count
|
|
159
199
|
const attemptCount = getAttemptCount(artifactsDir, stage.name);
|
|
160
200
|
if (attemptCount >= maxRetries) {
|
|
161
|
-
|
|
201
|
+
if (prNumber) {
|
|
202
|
+
postPrComment(repo, prNumber, `## QA Report — ESCALATED (attempt ${attemptCount}/${maxRetries})\n\nMax retries exceeded. Human intervention required.\n\n${artifactContent}`);
|
|
203
|
+
}
|
|
204
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — ESCALATED after ${attemptCount} attempts. Human intervention required.`);
|
|
162
205
|
applyLabel(repo, issueNumber, "escalated", label);
|
|
163
206
|
return { stage: stage.name, action: "escalated", nextLabel: "escalated" };
|
|
164
207
|
}
|
|
165
|
-
//
|
|
208
|
+
// Retry — post failure on PR and issue
|
|
209
|
+
if (prNumber) {
|
|
210
|
+
postPrComment(repo, prNumber, `## QA Report — FAIL (attempt ${attemptCount}/${maxRetries})\n\nRetrying. Builder will fix the issues below.\n\n${artifactContent}`);
|
|
211
|
+
}
|
|
212
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — FAIL (attempt ${attemptCount}/${maxRetries}). Retrying.`);
|
|
166
213
|
const retryLabel = findRetryLabel(workflowConfig.pipeline, stage.name);
|
|
167
|
-
postComment(repo, issueNumber, `## Stage: ${stage.name} — FAIL (attempt ${attemptCount}/${maxRetries})\n\nRetrying. The builder will read the QA report and fix the issues.\n\n<details>\n<summary>QA Report</summary>\n\n${artifactContent}\n</details>\n\nLabel: \`${retryLabel ?? "needs-fix"}\``);
|
|
168
214
|
if (retryLabel) {
|
|
169
215
|
applyLabel(repo, issueNumber, retryLabel, label);
|
|
170
216
|
}
|
|
@@ -181,22 +227,70 @@ function applyLabel(repo, issueNumber, addLabel, removeLabel) {
|
|
|
181
227
|
"--repo", repo,
|
|
182
228
|
"--add-label", addLabel,
|
|
183
229
|
"--remove-label", removeLabel,
|
|
184
|
-
]);
|
|
230
|
+
], { stdio: "pipe" });
|
|
185
231
|
}
|
|
186
232
|
catch (err) {
|
|
187
233
|
console.error(`[dispatch] Label transition failed (add=${addLabel}, remove=${removeLabel}):`, err);
|
|
188
234
|
}
|
|
189
235
|
}
|
|
190
|
-
function
|
|
236
|
+
function postIssueComment(repo, issueNumber, body) {
|
|
191
237
|
try {
|
|
192
238
|
execFileSync("gh", [
|
|
193
239
|
"issue", "comment", String(issueNumber),
|
|
194
240
|
"--repo", repo,
|
|
195
241
|
"--body", body,
|
|
196
|
-
]);
|
|
242
|
+
], { stdio: "pipe" });
|
|
243
|
+
}
|
|
244
|
+
catch (err) {
|
|
245
|
+
console.error(`[dispatch] Failed to post issue comment:`, err);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
function postPrComment(repo, prNumber, body) {
|
|
249
|
+
try {
|
|
250
|
+
execFileSync("gh", [
|
|
251
|
+
"pr", "comment", String(prNumber),
|
|
252
|
+
"--repo", repo,
|
|
253
|
+
"--body", body,
|
|
254
|
+
], { stdio: "pipe" });
|
|
197
255
|
}
|
|
198
256
|
catch (err) {
|
|
199
|
-
console.error(`[dispatch] Failed to post comment:`, err);
|
|
257
|
+
console.error(`[dispatch] Failed to post PR comment:`, err);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function ensureDraftPr(repo, issueNumber, branchName, stageName) {
|
|
261
|
+
try {
|
|
262
|
+
const existing = execFileSync("gh", [
|
|
263
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
264
|
+
], { stdio: "pipe" }).toString().trim();
|
|
265
|
+
const prs = JSON.parse(existing || "[]");
|
|
266
|
+
if (prs.length > 0) {
|
|
267
|
+
return prs[0].number;
|
|
268
|
+
}
|
|
269
|
+
// Create draft PR
|
|
270
|
+
const output = execFileSync("gh", [
|
|
271
|
+
"pr", "create", "--repo", repo, "--head", branchName, "--draft",
|
|
272
|
+
"--title", `[#${issueNumber}] Implementation`,
|
|
273
|
+
"--body", `Automated implementation for issue #${issueNumber}.\n\nThis PR is a draft while the build/QA loop runs. It will be marked ready for review when QA passes.\n\nCloses #${issueNumber}`,
|
|
274
|
+
], { stdio: "pipe" }).toString().trim();
|
|
275
|
+
// Extract PR number from output URL
|
|
276
|
+
const match = output.match(/\/pull\/(\d+)/);
|
|
277
|
+
return match ? parseInt(match[1], 10) : null;
|
|
278
|
+
}
|
|
279
|
+
catch (err) {
|
|
280
|
+
console.error(`[dispatch] Draft PR creation failed:`, err);
|
|
281
|
+
return null;
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
function findPrByBranch(repo, branchName) {
|
|
285
|
+
try {
|
|
286
|
+
const output = execFileSync("gh", [
|
|
287
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
288
|
+
], { stdio: "pipe" }).toString().trim();
|
|
289
|
+
const prs = JSON.parse(output || "[]");
|
|
290
|
+
return prs.length > 0 ? prs[0].number : null;
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return null;
|
|
200
294
|
}
|
|
201
295
|
}
|
|
202
296
|
function readArtifactContent(artifactsDir, artifactName) {
|
|
@@ -204,7 +298,7 @@ function readArtifactContent(artifactsDir, artifactName) {
|
|
|
204
298
|
return "";
|
|
205
299
|
try {
|
|
206
300
|
const content = readFileSync(join(artifactsDir, artifactName), "utf-8");
|
|
207
|
-
const maxLen =
|
|
301
|
+
const maxLen = 3000;
|
|
208
302
|
return content.length > maxLen ? content.slice(0, maxLen) + "\n\n_(truncated)_" : content;
|
|
209
303
|
}
|
|
210
304
|
catch {
|
|
@@ -215,7 +309,6 @@ function findNextStageLabel(pipeline, currentStageIndex) {
|
|
|
215
309
|
const nextStage = pipeline.stages[currentStageIndex + 1];
|
|
216
310
|
if (!nextStage)
|
|
217
311
|
return undefined;
|
|
218
|
-
// Find the label that maps to the next stage's name
|
|
219
312
|
for (const [lbl, stageName] of Object.entries(pipeline.labels)) {
|
|
220
313
|
if (stageName === nextStage.name) {
|
|
221
314
|
return lbl;
|
|
@@ -224,7 +317,6 @@ function findNextStageLabel(pipeline, currentStageIndex) {
|
|
|
224
317
|
return undefined;
|
|
225
318
|
}
|
|
226
319
|
function findReadyLabel(pipeline, stageName) {
|
|
227
|
-
// Convention: look for a label like "{stage}-ready" that maps to this stage
|
|
228
320
|
for (const [lbl, mapped] of Object.entries(pipeline.labels)) {
|
|
229
321
|
if (mapped === stageName && lbl.endsWith("-ready")) {
|
|
230
322
|
return lbl;
|
|
@@ -232,10 +324,8 @@ function findReadyLabel(pipeline, stageName) {
|
|
|
232
324
|
}
|
|
233
325
|
return undefined;
|
|
234
326
|
}
|
|
235
|
-
function findRetryLabel(pipeline,
|
|
236
|
-
|
|
237
|
-
// Convention: "needs-fix" maps to the build stage for retries
|
|
238
|
-
for (const [lbl, mapped] of Object.entries(pipeline.labels)) {
|
|
327
|
+
function findRetryLabel(pipeline, _stageName) {
|
|
328
|
+
for (const [lbl] of Object.entries(pipeline.labels)) {
|
|
239
329
|
if (lbl === "needs-fix" || lbl.includes("retry") || lbl.includes("fix")) {
|
|
240
330
|
return lbl;
|
|
241
331
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"orchestrator.js","sourceRoot":"","sources":["../../src/orchestrator.ts"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AC;YACtE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;QAClC,CAAC;QACD,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
package/src/orchestrator.ts
CHANGED
|
@@ -37,7 +37,7 @@ export function orchestrateStage(ctx: OrchestrationContext): OrchestrationResult
|
|
|
37
37
|
const artifactPath = join(artifactsDir, stage.produces);
|
|
38
38
|
if (!existsSync(artifactPath)) {
|
|
39
39
|
console.error(`[dispatch] Artifact not found: ${artifactPath}`);
|
|
40
|
-
|
|
40
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Agent did not produce \`${stage.produces}\`. Escalating.`);
|
|
41
41
|
applyLabel(repo, issueNumber, "escalated", label);
|
|
42
42
|
return { stage: stage.name, action: "no-artifact", nextLabel: "escalated" };
|
|
43
43
|
}
|
|
@@ -63,8 +63,14 @@ function handleGateNone(
|
|
|
63
63
|
stageIndex: number
|
|
64
64
|
): OrchestrationResult {
|
|
65
65
|
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
66
|
+
const branchPattern = stage.branch_pattern;
|
|
66
67
|
|
|
67
|
-
|
|
68
|
+
if (branchPattern) {
|
|
69
|
+
// Stage with a branch pattern: push to branch and open/update draft PR
|
|
70
|
+
return handleBranchStage(ctx, stage, stageIndex);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Simple stage (triage, plan): commit to main and advance
|
|
68
74
|
try {
|
|
69
75
|
execFileSync("git", ["add", artifactsDir]);
|
|
70
76
|
execFileSync("git", ["commit", "-m", `chore: add ${stage.produces} for issue #${issueNumber}`]);
|
|
@@ -73,12 +79,61 @@ function handleGateNone(
|
|
|
73
79
|
console.error(`[dispatch] Git commit/push failed for gate=none:`, err);
|
|
74
80
|
}
|
|
75
81
|
|
|
76
|
-
|
|
82
|
+
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
77
83
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
84
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Complete. Advancing to \`${nextLabel ?? "done"}\`.\n\n<details>\n<summary>${stage.produces}</summary>\n\n${artifactContent}\n</details>`);
|
|
85
|
+
|
|
86
|
+
if (nextLabel) {
|
|
87
|
+
applyLabel(repo, issueNumber, nextLabel, label);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return { stage: stage.name, action: "advanced", nextLabel };
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
function handleBranchStage(
|
|
94
|
+
ctx: OrchestrationContext,
|
|
95
|
+
stage: StageConfig,
|
|
96
|
+
stageIndex: number
|
|
97
|
+
): OrchestrationResult {
|
|
98
|
+
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
99
|
+
const branchName = renderTemplate(stage.branch_pattern!, issueNumber);
|
|
100
|
+
|
|
101
|
+
// Create or checkout branch
|
|
102
|
+
try {
|
|
103
|
+
execFileSync("git", ["checkout", "-b", branchName], { stdio: "pipe" });
|
|
104
|
+
} catch {
|
|
105
|
+
try {
|
|
106
|
+
execFileSync("git", ["checkout", branchName], { stdio: "pipe" });
|
|
107
|
+
} catch (err) {
|
|
108
|
+
console.error(`[dispatch] Failed to checkout branch ${branchName}:`, err);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Commit and push
|
|
113
|
+
try {
|
|
114
|
+
execFileSync("git", ["add", artifactsDir]);
|
|
115
|
+
execFileSync("git", ["commit", "-m", `feat: ${stage.name} for issue #${issueNumber}`], { stdio: "pipe" });
|
|
116
|
+
} catch { /* may be nothing to commit */ }
|
|
117
|
+
|
|
118
|
+
try {
|
|
119
|
+
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName], { stdio: "pipe" });
|
|
120
|
+
} catch (err) {
|
|
121
|
+
console.error(`[dispatch] Git push failed:`, err);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
// Open draft PR if none exists, or find existing
|
|
125
|
+
const prNumber = ensureDraftPr(repo, issueNumber, branchName, stage.name);
|
|
126
|
+
|
|
127
|
+
// Post build log as PR comment
|
|
128
|
+
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
129
|
+
if (prNumber && artifactContent) {
|
|
130
|
+
postPrComment(repo, prNumber, `## Build Log\n\n${artifactContent}`);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Advance to next stage
|
|
78
134
|
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
79
|
-
|
|
135
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — Complete. Draft PR opened. Advancing to \`${nextLabel ?? "done"}\`.`);
|
|
80
136
|
|
|
81
|
-
// Advance to next stage label
|
|
82
137
|
if (nextLabel) {
|
|
83
138
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
84
139
|
}
|
|
@@ -92,54 +147,44 @@ function handleGatePrReview(
|
|
|
92
147
|
stageIndex: number
|
|
93
148
|
): OrchestrationResult {
|
|
94
149
|
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
95
|
-
|
|
96
150
|
const branchName = renderTemplate(stage.branch_pattern ?? `${stage.name}/issue-{{ issue.number }}`, issueNumber);
|
|
97
151
|
|
|
98
152
|
// Create or checkout branch
|
|
99
153
|
try {
|
|
100
|
-
execFileSync("git", ["checkout", "-b", branchName]);
|
|
154
|
+
execFileSync("git", ["checkout", "-b", branchName], { stdio: "pipe" });
|
|
101
155
|
} catch {
|
|
102
|
-
// Branch may already exist — try checking it out
|
|
103
156
|
try {
|
|
104
|
-
execFileSync("git", ["checkout", branchName]);
|
|
157
|
+
execFileSync("git", ["checkout", branchName], { stdio: "pipe" });
|
|
105
158
|
} catch (err) {
|
|
106
159
|
console.error(`[dispatch] Failed to checkout branch ${branchName}:`, err);
|
|
107
160
|
}
|
|
108
161
|
}
|
|
109
162
|
|
|
110
|
-
// Commit
|
|
163
|
+
// Commit and push
|
|
111
164
|
try {
|
|
112
165
|
execFileSync("git", ["add", artifactsDir]);
|
|
113
|
-
execFileSync("git", ["commit", "-m", `feat: add ${stage.produces} for issue #${issueNumber}`]);
|
|
114
|
-
} catch
|
|
115
|
-
console.error(`[dispatch] Git commit failed for pr-review gate:`, err);
|
|
116
|
-
}
|
|
166
|
+
execFileSync("git", ["commit", "-m", `feat: add ${stage.produces} for issue #${issueNumber}`], { stdio: "pipe" });
|
|
167
|
+
} catch { /* may be nothing to commit */ }
|
|
117
168
|
|
|
118
|
-
// Push branch (force to handle re-runs where branch already exists)
|
|
119
169
|
try {
|
|
120
|
-
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName]);
|
|
170
|
+
execFileSync("git", ["push", "-u", "--force-with-lease", "origin", branchName], { stdio: "pipe" });
|
|
121
171
|
} catch (err) {
|
|
122
172
|
console.error(`[dispatch] Git push failed:`, err);
|
|
123
173
|
}
|
|
124
174
|
|
|
125
|
-
// Open PR
|
|
175
|
+
// Open PR (not draft — this is for human review)
|
|
126
176
|
let prCreated = false;
|
|
127
177
|
try {
|
|
128
178
|
const existing = execFileSync("gh", [
|
|
129
|
-
"pr", "list",
|
|
130
|
-
|
|
131
|
-
"--head", branchName,
|
|
132
|
-
"--json", "number",
|
|
133
|
-
]).toString().trim();
|
|
179
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
180
|
+
], { stdio: "pipe" }).toString().trim();
|
|
134
181
|
|
|
135
182
|
const prs = JSON.parse(existing || "[]");
|
|
136
183
|
if (prs.length === 0) {
|
|
137
184
|
execFileSync("gh", [
|
|
138
|
-
"pr", "create",
|
|
139
|
-
"--repo", repo,
|
|
140
|
-
"--head", branchName,
|
|
185
|
+
"pr", "create", "--repo", repo, "--head", branchName,
|
|
141
186
|
"--title", `[#${issueNumber}] ${stage.name}: ${stage.produces}`,
|
|
142
|
-
"--body", `Automated PR for issue #${issueNumber}
|
|
187
|
+
"--body", `Automated PR for issue #${issueNumber}.\n\nReview and merge to advance the pipeline.\n\nCloses #${issueNumber}`,
|
|
143
188
|
]);
|
|
144
189
|
prCreated = true;
|
|
145
190
|
}
|
|
@@ -147,24 +192,17 @@ function handleGatePrReview(
|
|
|
147
192
|
console.error(`[dispatch] PR creation failed:`, err);
|
|
148
193
|
}
|
|
149
194
|
|
|
150
|
-
// Find the "ready" label for this stage (convention: stage's own ready label)
|
|
151
195
|
const readyLabel = findReadyLabel(workflowConfig.pipeline, stage.name);
|
|
152
196
|
const nextLabel = readyLabel ?? findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
153
197
|
|
|
154
|
-
// Post comment about PR
|
|
155
198
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
156
|
-
|
|
157
|
-
postComment(repo, issueNumber, `## Stage: ${stage.name} — PR Ready\n\n${prMsg}\n\n<details>\n<summary>Artifact: ${stage.produces}</summary>\n\n${artifactContent}\n</details>\n\nLabel: \`${nextLabel ?? "done"}\``);
|
|
199
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — PR ready for review on \`${branchName}\`.\n\n<details>\n<summary>${stage.produces}</summary>\n\n${artifactContent}\n</details>`);
|
|
158
200
|
|
|
159
201
|
if (nextLabel) {
|
|
160
202
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
161
203
|
}
|
|
162
204
|
|
|
163
|
-
return {
|
|
164
|
-
stage: stage.name,
|
|
165
|
-
action: prCreated ? "opened-pr" : "advanced",
|
|
166
|
-
nextLabel,
|
|
167
|
-
};
|
|
205
|
+
return { stage: stage.name, action: prCreated ? "opened-pr" : "advanced", nextLabel };
|
|
168
206
|
}
|
|
169
207
|
|
|
170
208
|
function handleGateRetry(
|
|
@@ -174,15 +212,27 @@ function handleGateRetry(
|
|
|
174
212
|
): OrchestrationResult {
|
|
175
213
|
const { issueNumber, repo, label, workflowConfig, artifactsDir } = ctx;
|
|
176
214
|
|
|
177
|
-
// Read verdict from artifact frontmatter
|
|
178
215
|
const verdict = readVerdictFromArtifact(artifactsDir, stage.produces ?? "");
|
|
179
216
|
const maxRetries = stage.max_retries ?? 3;
|
|
180
|
-
|
|
181
217
|
const artifactContent = readArtifactContent(artifactsDir, stage.produces);
|
|
182
218
|
|
|
219
|
+
// Find the impl PR to comment on
|
|
220
|
+
const implBranch = `impl/issue-${issueNumber}`;
|
|
221
|
+
const prNumber = findPrByBranch(repo, implBranch);
|
|
222
|
+
|
|
183
223
|
if (verdict === "pass") {
|
|
224
|
+
// Post QA report on PR
|
|
225
|
+
if (prNumber) {
|
|
226
|
+
postPrComment(repo, prNumber, `## QA Report — PASS\n\n${artifactContent}`);
|
|
227
|
+
// Mark PR as ready for review (remove draft)
|
|
228
|
+
try {
|
|
229
|
+
execFileSync("gh", ["pr", "ready", String(prNumber), "--repo", repo], { stdio: "pipe" });
|
|
230
|
+
} catch { /* may already be ready */ }
|
|
231
|
+
}
|
|
232
|
+
|
|
184
233
|
const nextLabel = findNextStageLabel(workflowConfig.pipeline, stageIndex);
|
|
185
|
-
|
|
234
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — PASS. PR ready for human review.`);
|
|
235
|
+
|
|
186
236
|
if (nextLabel) {
|
|
187
237
|
applyLabel(repo, issueNumber, nextLabel, label);
|
|
188
238
|
}
|
|
@@ -193,14 +243,21 @@ function handleGateRetry(
|
|
|
193
243
|
const attemptCount = getAttemptCount(artifactsDir, stage.name);
|
|
194
244
|
|
|
195
245
|
if (attemptCount >= maxRetries) {
|
|
196
|
-
|
|
246
|
+
if (prNumber) {
|
|
247
|
+
postPrComment(repo, prNumber, `## QA Report — ESCALATED (attempt ${attemptCount}/${maxRetries})\n\nMax retries exceeded. Human intervention required.\n\n${artifactContent}`);
|
|
248
|
+
}
|
|
249
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — ESCALATED after ${attemptCount} attempts. Human intervention required.`);
|
|
197
250
|
applyLabel(repo, issueNumber, "escalated", label);
|
|
198
251
|
return { stage: stage.name, action: "escalated", nextLabel: "escalated" };
|
|
199
252
|
}
|
|
200
253
|
|
|
201
|
-
//
|
|
254
|
+
// Retry — post failure on PR and issue
|
|
255
|
+
if (prNumber) {
|
|
256
|
+
postPrComment(repo, prNumber, `## QA Report — FAIL (attempt ${attemptCount}/${maxRetries})\n\nRetrying. Builder will fix the issues below.\n\n${artifactContent}`);
|
|
257
|
+
}
|
|
258
|
+
postIssueComment(repo, issueNumber, `**${stage.name}** — FAIL (attempt ${attemptCount}/${maxRetries}). Retrying.`);
|
|
259
|
+
|
|
202
260
|
const retryLabel = findRetryLabel(workflowConfig.pipeline, stage.name);
|
|
203
|
-
postComment(repo, issueNumber, `## Stage: ${stage.name} — FAIL (attempt ${attemptCount}/${maxRetries})\n\nRetrying. The builder will read the QA report and fix the issues.\n\n<details>\n<summary>QA Report</summary>\n\n${artifactContent}\n</details>\n\nLabel: \`${retryLabel ?? "needs-fix"}\``);
|
|
204
261
|
if (retryLabel) {
|
|
205
262
|
applyLabel(repo, issueNumber, retryLabel, label);
|
|
206
263
|
}
|
|
@@ -221,21 +278,73 @@ function applyLabel(repo: string, issueNumber: number, addLabel: string, removeL
|
|
|
221
278
|
"--repo", repo,
|
|
222
279
|
"--add-label", addLabel,
|
|
223
280
|
"--remove-label", removeLabel,
|
|
224
|
-
]);
|
|
281
|
+
], { stdio: "pipe" });
|
|
225
282
|
} catch (err) {
|
|
226
283
|
console.error(`[dispatch] Label transition failed (add=${addLabel}, remove=${removeLabel}):`, err);
|
|
227
284
|
}
|
|
228
285
|
}
|
|
229
286
|
|
|
230
|
-
function
|
|
287
|
+
function postIssueComment(repo: string, issueNumber: number, body: string): void {
|
|
231
288
|
try {
|
|
232
289
|
execFileSync("gh", [
|
|
233
290
|
"issue", "comment", String(issueNumber),
|
|
234
291
|
"--repo", repo,
|
|
235
292
|
"--body", body,
|
|
236
|
-
]);
|
|
293
|
+
], { stdio: "pipe" });
|
|
294
|
+
} catch (err) {
|
|
295
|
+
console.error(`[dispatch] Failed to post issue comment:`, err);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function postPrComment(repo: string, prNumber: number, body: string): void {
|
|
300
|
+
try {
|
|
301
|
+
execFileSync("gh", [
|
|
302
|
+
"pr", "comment", String(prNumber),
|
|
303
|
+
"--repo", repo,
|
|
304
|
+
"--body", body,
|
|
305
|
+
], { stdio: "pipe" });
|
|
237
306
|
} catch (err) {
|
|
238
|
-
console.error(`[dispatch] Failed to post comment:`, err);
|
|
307
|
+
console.error(`[dispatch] Failed to post PR comment:`, err);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
function ensureDraftPr(repo: string, issueNumber: number, branchName: string, stageName: string): number | null {
|
|
312
|
+
try {
|
|
313
|
+
const existing = execFileSync("gh", [
|
|
314
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
315
|
+
], { stdio: "pipe" }).toString().trim();
|
|
316
|
+
|
|
317
|
+
const prs = JSON.parse(existing || "[]");
|
|
318
|
+
if (prs.length > 0) {
|
|
319
|
+
return prs[0].number;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
// Create draft PR
|
|
323
|
+
const output = execFileSync("gh", [
|
|
324
|
+
"pr", "create", "--repo", repo, "--head", branchName, "--draft",
|
|
325
|
+
"--title", `[#${issueNumber}] Implementation`,
|
|
326
|
+
"--body", `Automated implementation for issue #${issueNumber}.\n\nThis PR is a draft while the build/QA loop runs. It will be marked ready for review when QA passes.\n\nCloses #${issueNumber}`,
|
|
327
|
+
], { stdio: "pipe" }).toString().trim();
|
|
328
|
+
|
|
329
|
+
// Extract PR number from output URL
|
|
330
|
+
const match = output.match(/\/pull\/(\d+)/);
|
|
331
|
+
return match ? parseInt(match[1], 10) : null;
|
|
332
|
+
} catch (err) {
|
|
333
|
+
console.error(`[dispatch] Draft PR creation failed:`, err);
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
function findPrByBranch(repo: string, branchName: string): number | null {
|
|
339
|
+
try {
|
|
340
|
+
const output = execFileSync("gh", [
|
|
341
|
+
"pr", "list", "--repo", repo, "--head", branchName, "--json", "number",
|
|
342
|
+
], { stdio: "pipe" }).toString().trim();
|
|
343
|
+
|
|
344
|
+
const prs = JSON.parse(output || "[]");
|
|
345
|
+
return prs.length > 0 ? prs[0].number : null;
|
|
346
|
+
} catch {
|
|
347
|
+
return null;
|
|
239
348
|
}
|
|
240
349
|
}
|
|
241
350
|
|
|
@@ -243,7 +352,7 @@ function readArtifactContent(artifactsDir: string, artifactName: string | undefi
|
|
|
243
352
|
if (!artifactName) return "";
|
|
244
353
|
try {
|
|
245
354
|
const content = readFileSync(join(artifactsDir, artifactName), "utf-8");
|
|
246
|
-
const maxLen =
|
|
355
|
+
const maxLen = 3000;
|
|
247
356
|
return content.length > maxLen ? content.slice(0, maxLen) + "\n\n_(truncated)_" : content;
|
|
248
357
|
} catch {
|
|
249
358
|
return "";
|
|
@@ -257,7 +366,6 @@ function findNextStageLabel(
|
|
|
257
366
|
const nextStage = pipeline.stages[currentStageIndex + 1];
|
|
258
367
|
if (!nextStage) return undefined;
|
|
259
368
|
|
|
260
|
-
// Find the label that maps to the next stage's name
|
|
261
369
|
for (const [lbl, stageName] of Object.entries(pipeline.labels)) {
|
|
262
370
|
if (stageName === nextStage.name) {
|
|
263
371
|
return lbl;
|
|
@@ -270,7 +378,6 @@ function findReadyLabel(
|
|
|
270
378
|
pipeline: OrchestrationContext["workflowConfig"]["pipeline"],
|
|
271
379
|
stageName: string
|
|
272
380
|
): string | undefined {
|
|
273
|
-
// Convention: look for a label like "{stage}-ready" that maps to this stage
|
|
274
381
|
for (const [lbl, mapped] of Object.entries(pipeline.labels)) {
|
|
275
382
|
if (mapped === stageName && lbl.endsWith("-ready")) {
|
|
276
383
|
return lbl;
|
|
@@ -281,11 +388,9 @@ function findReadyLabel(
|
|
|
281
388
|
|
|
282
389
|
function findRetryLabel(
|
|
283
390
|
pipeline: OrchestrationContext["workflowConfig"]["pipeline"],
|
|
284
|
-
|
|
391
|
+
_stageName: string
|
|
285
392
|
): string | undefined {
|
|
286
|
-
|
|
287
|
-
// Convention: "needs-fix" maps to the build stage for retries
|
|
288
|
-
for (const [lbl, mapped] of Object.entries(pipeline.labels)) {
|
|
393
|
+
for (const [lbl] of Object.entries(pipeline.labels)) {
|
|
289
394
|
if (lbl === "needs-fix" || lbl.includes("retry") || lbl.includes("fix")) {
|
|
290
395
|
return lbl;
|
|
291
396
|
}
|