issue-flow 0.5.2 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{analyze-QVQ4CTCU.js → analyze-WRFFG2R5.js} +20 -6
- package/dist/analyze-WRFFG2R5.js.map +1 -0
- package/dist/{chunk-O5XI2CFF.js → chunk-2Y3UO7H2.js} +81 -21
- package/dist/chunk-2Y3UO7H2.js.map +1 -0
- package/dist/{chunk-KMX3DUJN.js → chunk-75K5IKAC.js} +19 -7
- package/dist/chunk-75K5IKAC.js.map +1 -0
- package/dist/{chunk-JMSRJ43G.js → chunk-BTBSVBE3.js} +19 -7
- package/dist/chunk-BTBSVBE3.js.map +1 -0
- package/dist/chunk-CW6UE3NW.js +72 -0
- package/dist/chunk-CW6UE3NW.js.map +1 -0
- package/dist/chunk-EWMSQQL2.js +725 -0
- package/dist/chunk-EWMSQQL2.js.map +1 -0
- package/dist/chunk-HS4QWZAO.js +707 -0
- package/dist/chunk-HS4QWZAO.js.map +1 -0
- package/dist/{chunk-3ULIAC2J.js → chunk-JV7P6UGG.js} +2 -2
- package/dist/{chunk-KLBAHTXX.js → chunk-KUDAY57D.js} +2 -2
- package/dist/{chunk-PA3GI7LR.js → chunk-OVFYJLOH.js} +130 -41
- package/dist/chunk-OVFYJLOH.js.map +1 -0
- package/dist/{chunk-LJI45O5B.js → chunk-UX6YAVLT.js} +40 -7
- package/dist/chunk-UX6YAVLT.js.map +1 -0
- package/dist/{chunk-VM7C7L3A.js → chunk-VLSZFMLZ.js} +21 -9
- package/dist/chunk-VLSZFMLZ.js.map +1 -0
- package/dist/{chunk-DLWRUTRL.js → chunk-YXJPKBPV.js} +43 -68
- package/dist/chunk-YXJPKBPV.js.map +1 -0
- package/dist/{chunk-OEJSMZMO.js → chunk-Z3UIGLZG.js} +18 -6
- package/dist/chunk-Z3UIGLZG.js.map +1 -0
- package/dist/cli.js +177 -31
- package/dist/cli.js.map +1 -1
- package/dist/config-UHQ6XXX2.js +31 -0
- package/dist/execute-K5B4UMUT.js +13 -0
- package/dist/generate-DUKQCADD.js +145 -0
- package/dist/generate-DUKQCADD.js.map +1 -0
- package/dist/init-W4HBLW7R.js +9 -0
- package/dist/plan-NKPU45NP.js +15 -0
- package/dist/pr-JYGLLIEF.js +15 -0
- package/dist/pr-review-6H6F4XUY.js +15 -0
- package/dist/prd-FC2ZCEOX.js +15 -0
- package/dist/prd-FC2ZCEOX.js.map +1 -0
- package/dist/review-X4NGDZZI.js +13 -0
- package/dist/review-X4NGDZZI.js.map +1 -0
- package/dist/{run-3GJC54DB.js → run-VC647DQI.js} +177 -63
- package/dist/run-VC647DQI.js.map +1 -0
- package/package.json +2 -1
- package/prompts/analyze.md +18 -5
- package/prompts/generate.md +27 -6
- package/prompts/plan.md +19 -2
- package/prompts/pr-review.md +144 -0
- package/prompts/pr.md +23 -6
- package/prompts/prd.md +18 -5
- package/prompts/review.md +18 -6
- package/dist/analyze-QVQ4CTCU.js.map +0 -1
- package/dist/chunk-DLWRUTRL.js.map +0 -1
- package/dist/chunk-JMSRJ43G.js.map +0 -1
- package/dist/chunk-KMX3DUJN.js.map +0 -1
- package/dist/chunk-LJI45O5B.js.map +0 -1
- package/dist/chunk-O5XI2CFF.js.map +0 -1
- package/dist/chunk-OEJSMZMO.js.map +0 -1
- package/dist/chunk-PA3GI7LR.js.map +0 -1
- package/dist/chunk-VM7C7L3A.js.map +0 -1
- package/dist/execute-TEJ26L4O.js +0 -12
- package/dist/generate-KBQ4KW4T.js +0 -48
- package/dist/generate-KBQ4KW4T.js.map +0 -1
- package/dist/init-4VMPBRMA.js +0 -9
- package/dist/plan-PWYZP5AN.js +0 -13
- package/dist/pr-CJQWZUDR.js +0 -13
- package/dist/prd-4KLQY7BC.js +0 -13
- package/dist/review-YFCWBBKY.js +0 -11
- package/dist/run-3GJC54DB.js.map +0 -1
- /package/dist/{chunk-3ULIAC2J.js.map → chunk-JV7P6UGG.js.map} +0 -0
- /package/dist/{chunk-KLBAHTXX.js.map → chunk-KUDAY57D.js.map} +0 -0
- /package/dist/{execute-TEJ26L4O.js.map → config-UHQ6XXX2.js.map} +0 -0
- /package/dist/{init-4VMPBRMA.js.map → execute-K5B4UMUT.js.map} +0 -0
- /package/dist/{plan-PWYZP5AN.js.map → init-W4HBLW7R.js.map} +0 -0
- /package/dist/{pr-CJQWZUDR.js.map → plan-NKPU45NP.js.map} +0 -0
- /package/dist/{prd-4KLQY7BC.js.map → pr-JYGLLIEF.js.map} +0 -0
- /package/dist/{review-YFCWBBKY.js.map → pr-review-6H6F4XUY.js.map} +0 -0
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
import {
|
|
3
3
|
printError,
|
|
4
4
|
printInfo,
|
|
5
|
-
printSuccess
|
|
6
|
-
|
|
5
|
+
printSuccess,
|
|
6
|
+
printWarning
|
|
7
|
+
} from "./chunk-2Y3UO7H2.js";
|
|
7
8
|
|
|
8
9
|
// src/commands/init.ts
|
|
9
10
|
import { execa } from "execa";
|
|
@@ -12,9 +13,10 @@ async function checkClaude() {
|
|
|
12
13
|
const proc = await execa("claude", ["--version"], { reject: false, timeout: 1e4 });
|
|
13
14
|
if (proc.exitCode === 0) {
|
|
14
15
|
const version = proc.stdout?.toString().trim() ?? "unknown";
|
|
15
|
-
return { name: "claude CLI", passed: true, detail: version };
|
|
16
|
+
return { key: "claude", name: "claude CLI", passed: true, detail: version };
|
|
16
17
|
}
|
|
17
18
|
return {
|
|
19
|
+
key: "claude",
|
|
18
20
|
name: "claude CLI",
|
|
19
21
|
passed: false,
|
|
20
22
|
detail: "claude command failed",
|
|
@@ -22,6 +24,7 @@ async function checkClaude() {
|
|
|
22
24
|
};
|
|
23
25
|
} catch {
|
|
24
26
|
return {
|
|
27
|
+
key: "claude",
|
|
25
28
|
name: "claude CLI",
|
|
26
29
|
passed: false,
|
|
27
30
|
detail: "claude not found",
|
|
@@ -34,6 +37,7 @@ async function checkGh() {
|
|
|
34
37
|
const proc = await execa("gh", ["--version"], { reject: false, timeout: 1e4 });
|
|
35
38
|
if (proc.exitCode !== 0) {
|
|
36
39
|
return {
|
|
40
|
+
key: "gh",
|
|
37
41
|
name: "gh CLI",
|
|
38
42
|
passed: false,
|
|
39
43
|
detail: "gh command failed",
|
|
@@ -44,15 +48,17 @@ async function checkGh() {
|
|
|
44
48
|
const auth = await execa("gh", ["auth", "status"], { reject: false, timeout: 1e4 });
|
|
45
49
|
if (auth.exitCode !== 0) {
|
|
46
50
|
return {
|
|
51
|
+
key: "gh",
|
|
47
52
|
name: "gh CLI",
|
|
48
53
|
passed: false,
|
|
49
54
|
detail: `${version} (not authenticated)`,
|
|
50
55
|
hint: "Run: gh auth login"
|
|
51
56
|
};
|
|
52
57
|
}
|
|
53
|
-
return { name: "gh CLI", passed: true, detail: `${version} (authenticated)` };
|
|
58
|
+
return { key: "gh", name: "gh CLI", passed: true, detail: `${version} (authenticated)` };
|
|
54
59
|
} catch {
|
|
55
60
|
return {
|
|
61
|
+
key: "gh",
|
|
56
62
|
name: "gh CLI",
|
|
57
63
|
passed: false,
|
|
58
64
|
detail: "gh not found",
|
|
@@ -65,6 +71,7 @@ async function checkGit() {
|
|
|
65
71
|
const proc = await execa("git", ["--version"], { reject: false, timeout: 1e4 });
|
|
66
72
|
if (proc.exitCode !== 0) {
|
|
67
73
|
return {
|
|
74
|
+
key: "git",
|
|
68
75
|
name: "git",
|
|
69
76
|
passed: false,
|
|
70
77
|
detail: "git command failed",
|
|
@@ -78,15 +85,17 @@ async function checkGit() {
|
|
|
78
85
|
});
|
|
79
86
|
if (repo.exitCode !== 0) {
|
|
80
87
|
return {
|
|
88
|
+
key: "git",
|
|
81
89
|
name: "git",
|
|
82
90
|
passed: false,
|
|
83
91
|
detail: `${version} (not a git repository)`,
|
|
84
92
|
hint: "Run this command inside a git repository"
|
|
85
93
|
};
|
|
86
94
|
}
|
|
87
|
-
return { name: "git", passed: true, detail: `${version} (inside repo)` };
|
|
95
|
+
return { key: "git", name: "git", passed: true, detail: `${version} (inside repo)` };
|
|
88
96
|
} catch {
|
|
89
97
|
return {
|
|
98
|
+
key: "git",
|
|
90
99
|
name: "git",
|
|
91
100
|
passed: false,
|
|
92
101
|
detail: "git not found",
|
|
@@ -94,20 +103,23 @@ async function checkGit() {
|
|
|
94
103
|
};
|
|
95
104
|
}
|
|
96
105
|
}
|
|
97
|
-
async function runInit() {
|
|
106
|
+
async function runInit(source = "github") {
|
|
98
107
|
printInfo("Checking prerequisites...\n");
|
|
99
108
|
const results = await Promise.all([checkClaude(), checkGh(), checkGit()]);
|
|
109
|
+
const isBlocking = (r) => r.key !== "gh" || source === "github";
|
|
100
110
|
for (const r of results) {
|
|
101
111
|
if (r.passed) {
|
|
102
112
|
printSuccess(`${r.name}: ${r.detail}`);
|
|
103
|
-
} else {
|
|
113
|
+
} else if (isBlocking(r)) {
|
|
104
114
|
printError(`${r.name}: ${r.detail}`);
|
|
105
115
|
if (r.hint) {
|
|
106
116
|
console.log(` ${r.hint}`);
|
|
107
117
|
}
|
|
118
|
+
} else {
|
|
119
|
+
printWarning(`${r.name}: ${r.detail} (not required for ${source} issues)`);
|
|
108
120
|
}
|
|
109
121
|
}
|
|
110
|
-
const allPassed = results.every((r) => r.passed);
|
|
122
|
+
const allPassed = results.filter(isBlocking).every((r) => r.passed);
|
|
111
123
|
console.log("");
|
|
112
124
|
if (allPassed) {
|
|
113
125
|
printSuccess("All prerequisites met. Ready to run the pipeline.");
|
|
@@ -120,4 +132,4 @@ async function runInit() {
|
|
|
120
132
|
export {
|
|
121
133
|
runInit
|
|
122
134
|
};
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
135
|
+
//# sourceMappingURL=chunk-VLSZFMLZ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/init.ts"],"sourcesContent":["import { execa } from 'execa';\nimport type { IssueSource } from '../issues/types.js';\nimport { printError, printInfo, printSuccess, printWarning } from '../ui/logger.js';\n\n/** Stable identifier of a check, used to decide whether it blocks. */\ntype CheckKey = 'claude' | 'gh' | 'git';\n\ninterface CheckResult {\n key: CheckKey;\n name: string;\n passed: boolean;\n detail: string;\n hint?: string;\n}\n\nasync function checkClaude(): Promise<CheckResult> {\n try {\n const proc = await execa('claude', ['--version'], { reject: false, timeout: 10_000 });\n if (proc.exitCode === 0) {\n const version = proc.stdout?.toString().trim() ?? 'unknown';\n return { key: 'claude', name: 'claude CLI', passed: true, detail: version };\n }\n return {\n key: 'claude',\n name: 'claude CLI',\n passed: false,\n detail: 'claude command failed',\n hint: 'Install Claude Code: https://docs.anthropic.com/en/docs/claude-code',\n };\n } catch {\n return {\n key: 'claude',\n name: 'claude CLI',\n passed: false,\n detail: 'claude not found',\n hint: 'Install Claude Code: https://docs.anthropic.com/en/docs/claude-code',\n };\n }\n}\n\nasync function checkGh(): Promise<CheckResult> {\n try {\n const proc = await execa('gh', ['--version'], { reject: false, timeout: 10_000 });\n if (proc.exitCode !== 0) {\n return {\n key: 'gh',\n name: 'gh CLI',\n passed: false,\n detail: 'gh command failed',\n hint: 'Install GitHub CLI: https://cli.github.com/',\n };\n }\n const version = proc.stdout?.toString().split('\\n')[0]?.trim() ?? 'unknown';\n\n // Check auth status\n const auth = await execa('gh', ['auth', 'status'], { reject: false, timeout: 10_000 });\n if (auth.exitCode !== 0) {\n return {\n key: 'gh',\n name: 'gh CLI',\n passed: false,\n detail: `${version} (not authenticated)`,\n hint: 'Run: gh auth login',\n };\n }\n return { key: 'gh', name: 'gh CLI', passed: true, detail: `${version} (authenticated)` };\n } catch {\n return {\n key: 'gh',\n name: 'gh CLI',\n passed: false,\n detail: 'gh not found',\n hint: 'Install GitHub CLI: https://cli.github.com/',\n };\n }\n}\n\nasync function checkGit(): Promise<CheckResult> {\n try {\n const proc = await execa('git', ['--version'], { reject: false, timeout: 10_000 });\n if (proc.exitCode !== 0) {\n return {\n key: 'git',\n name: 'git',\n passed: false,\n detail: 'git command failed',\n hint: 'Install git: https://git-scm.com/',\n };\n }\n const version = proc.stdout?.toString().trim() ?? 'unknown';\n\n // Check if current directory is a git repo\n const repo = await execa('git', ['rev-parse', '--is-inside-work-tree'], {\n reject: false,\n timeout: 5_000,\n });\n if (repo.exitCode !== 0) {\n return {\n key: 'git',\n name: 'git',\n passed: false,\n detail: `${version} (not a git repository)`,\n hint: 'Run this command inside a git repository',\n };\n }\n return { key: 'git', name: 'git', passed: true, detail: `${version} (inside repo)` };\n } catch {\n return {\n key: 'git',\n name: 'git',\n passed: false,\n detail: 'git not found',\n hint: 'Install git: https://git-scm.com/',\n };\n }\n}\n\n/**\n * Verify the prerequisites of the pipeline.\n *\n * `source` is the Issue origin the run is headed for. `gh` only blocks when\n * that origin is GitHub: no other origin shells out to it, so a missing or\n * unauthenticated gh is reported as a warning instead of failing the\n * environment. `claude` and `git` stay blocking for every origin, and the\n * default ('github') keeps the previous behaviour byte for byte.\n */\nexport async function runInit(source: IssueSource = 'github'): Promise<number> {\n printInfo('Checking prerequisites...\\n');\n\n const results = await Promise.all([checkClaude(), checkGh(), checkGit()]);\n const isBlocking = (r: CheckResult): boolean => r.key !== 'gh' || source === 'github';\n\n for (const r of results) {\n if (r.passed) {\n printSuccess(`${r.name}: ${r.detail}`);\n } else if (isBlocking(r)) {\n printError(`${r.name}: ${r.detail}`);\n if (r.hint) {\n console.log(` ${r.hint}`);\n }\n } else {\n printWarning(`${r.name}: ${r.detail} (not required for ${source} issues)`);\n }\n }\n\n const allPassed = results.filter(isBlocking).every((r) => r.passed);\n console.log('');\n if (allPassed) {\n printSuccess('All prerequisites met. Ready to run the pipeline.');\n } else {\n printError('Some prerequisites are missing. Please fix the issues above.');\n }\n\n return allPassed ? 0 : 1;\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,aAAa;AAetB,eAAe,cAAoC;AACjD,MAAI;AACF,UAAM,OAAO,MAAM,MAAM,UAAU,CAAC,WAAW,GAAG,EAAE,QAAQ,OAAO,SAAS,IAAO,CAAC;AACpF,QAAI,KAAK,aAAa,GAAG;AACvB,YA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UAAI,EAAE,MAAM;AACV,gBAAQ,IAAI,OAAO,EAAE,IAAI,EAAE;AAAA,MAC7B;AAAA,IACF,OAAO;AACL,mBAAa,GAAG,EAAE,IAAI,KAAK,EAAE,MAAM,sBAAsB,MAAM,UAAU;AAAA,IAC3E;AAAA,EACF;AAEA,QAAM,YAAY,QAAQ,OAAO,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM;AAClE,UAAQ,IAAI,EAAE;AACd,MAAI,WAAW;AACb,iBAAa,mDAAmD;AAAA,EAClE,OAAO;AACL,eAAW,8DAA8D;AAAA,EAC3E;AAEA,SAAO,YAAY,IAAI;AACzB;","names":[]}
|
|
@@ -1,24 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
createConfig,
|
|
4
|
-
getBaseBranch,
|
|
5
|
-
getCommitsSince,
|
|
6
|
-
getCurrentBranch,
|
|
7
|
-
resolvePaths,
|
|
8
|
-
run,
|
|
9
|
-
validateDependencies
|
|
10
|
-
} from "./chunk-PA3GI7LR.js";
|
|
11
2
|
import {
|
|
12
3
|
isTransientFailure,
|
|
13
4
|
retryDelaySeconds,
|
|
14
5
|
sleep
|
|
15
6
|
} from "./chunk-HDV3YDTG.js";
|
|
7
|
+
import {
|
|
8
|
+
publishGitState
|
|
9
|
+
} from "./chunk-CW6UE3NW.js";
|
|
16
10
|
import {
|
|
17
11
|
applyPlaceholders,
|
|
18
12
|
loadPrompt
|
|
19
13
|
} from "./chunk-SLHZPB3C.js";
|
|
20
14
|
import {
|
|
21
|
-
|
|
15
|
+
createConfig,
|
|
16
|
+
resolvePaths,
|
|
17
|
+
validateDependencies
|
|
18
|
+
} from "./chunk-OVFYJLOH.js";
|
|
19
|
+
import {
|
|
22
20
|
allStoriesPass,
|
|
23
21
|
clearLastError,
|
|
24
22
|
formatDuration,
|
|
@@ -43,7 +41,7 @@ import {
|
|
|
43
41
|
trimErrorMessage,
|
|
44
42
|
useColor,
|
|
45
43
|
useUnicode
|
|
46
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-2Y3UO7H2.js";
|
|
47
45
|
|
|
48
46
|
// src/core/engine.ts
|
|
49
47
|
import { existsSync } from "fs";
|
|
@@ -214,6 +212,38 @@ function printSummaryBox(status, iterations, totalRetries, elapsedSeconds, plan,
|
|
|
214
212
|
console.log("");
|
|
215
213
|
printBox(boxLines);
|
|
216
214
|
}
|
|
215
|
+
function buildRunSummaryLines(info) {
|
|
216
|
+
const lines = [
|
|
217
|
+
` Branch: ${info.branchName}${info.noBranch ? " (current)" : ""}`,
|
|
218
|
+
` Stories: ${info.storyCount}`,
|
|
219
|
+
` Duration: ${formatDuration(info.elapsedSeconds)}`
|
|
220
|
+
];
|
|
221
|
+
if (!info.noBranch) {
|
|
222
|
+
lines.push(` PR: ${info.prUrl}`);
|
|
223
|
+
}
|
|
224
|
+
const review = info.prReview;
|
|
225
|
+
if (review) {
|
|
226
|
+
const verdict = review.recommendation ?? (review.requestedChanges ? "REQUEST_CHANGES" : "unknown");
|
|
227
|
+
lines.push(` Review: ${verdict}`);
|
|
228
|
+
if (review.reportPath !== null) {
|
|
229
|
+
lines.push(` Report: ${review.reportPath}`);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
return lines;
|
|
233
|
+
}
|
|
234
|
+
function printRunSummary(info) {
|
|
235
|
+
console.log("");
|
|
236
|
+
if (info.prReview?.requestedChanges) {
|
|
237
|
+
printWarning(
|
|
238
|
+
`Pipeline finished for issue #${info.issueNumber}, but the PR review requested changes.`
|
|
239
|
+
);
|
|
240
|
+
} else {
|
|
241
|
+
printSuccess(`Pipeline complete for issue #${info.issueNumber}!`);
|
|
242
|
+
}
|
|
243
|
+
for (const line of buildRunSummaryLines(info)) {
|
|
244
|
+
console.log(line);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
217
247
|
|
|
218
248
|
// src/core/executor.ts
|
|
219
249
|
import { execa } from "execa";
|
|
@@ -242,61 +272,6 @@ ${stderr}` : "");
|
|
|
242
272
|
};
|
|
243
273
|
}
|
|
244
274
|
|
|
245
|
-
// src/core/session-git.ts
|
|
246
|
-
async function listPullRequests(branch) {
|
|
247
|
-
if (!branch) return [];
|
|
248
|
-
const result = await run("gh", [
|
|
249
|
-
"pr",
|
|
250
|
-
"list",
|
|
251
|
-
"--head",
|
|
252
|
-
branch,
|
|
253
|
-
"--state",
|
|
254
|
-
"all",
|
|
255
|
-
"--json",
|
|
256
|
-
"number,url,title",
|
|
257
|
-
"--limit",
|
|
258
|
-
"10"
|
|
259
|
-
]);
|
|
260
|
-
if (result.exitCode !== 0) return [];
|
|
261
|
-
try {
|
|
262
|
-
const parsed = JSON.parse(result.stdout || "[]");
|
|
263
|
-
if (!Array.isArray(parsed)) return [];
|
|
264
|
-
return parsed.filter(
|
|
265
|
-
(pr) => typeof pr === "object" && pr !== null && typeof pr.number === "number" && typeof pr.url === "string" && typeof pr.title === "string"
|
|
266
|
-
).map((pr) => ({ number: pr.number, url: pr.url, title: pr.title }));
|
|
267
|
-
} catch {
|
|
268
|
-
return [];
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
var defaultSources = {
|
|
272
|
-
currentBranch: getCurrentBranch,
|
|
273
|
-
baseBranch: getBaseBranch,
|
|
274
|
-
commitsSince: getCommitsSince,
|
|
275
|
-
pullRequests: listPullRequests,
|
|
276
|
-
now: isoNow
|
|
277
|
-
};
|
|
278
|
-
async function publishGitState(publisher, sources = {}) {
|
|
279
|
-
if (publisher instanceof NullPublisher) return;
|
|
280
|
-
const src = { ...defaultSources, ...sources };
|
|
281
|
-
try {
|
|
282
|
-
const branch = await src.currentBranch();
|
|
283
|
-
const baseBranch = await src.baseBranch();
|
|
284
|
-
const [commits, pullRequests] = await Promise.all([
|
|
285
|
-
src.commitsSince(baseBranch),
|
|
286
|
-
src.pullRequests(branch)
|
|
287
|
-
]);
|
|
288
|
-
publisher.publish({
|
|
289
|
-
type: "git:update",
|
|
290
|
-
at: src.now(),
|
|
291
|
-
branch,
|
|
292
|
-
baseBranch,
|
|
293
|
-
commits,
|
|
294
|
-
pullRequests
|
|
295
|
-
});
|
|
296
|
-
} catch {
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
|
|
300
275
|
// src/core/engine.ts
|
|
301
276
|
function emitLog(message) {
|
|
302
277
|
const cb = getOutputCallback();
|
|
@@ -562,7 +537,7 @@ async function runExecute(positionalMaxIter, options) {
|
|
|
562
537
|
}
|
|
563
538
|
|
|
564
539
|
export {
|
|
565
|
-
|
|
540
|
+
printRunSummary,
|
|
566
541
|
runExecute
|
|
567
542
|
};
|
|
568
|
-
//# sourceMappingURL=chunk-
|
|
543
|
+
//# sourceMappingURL=chunk-YXJPKBPV.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/core/engine.ts","../src/ui/progress.ts","../src/ui/summary.ts","../src/core/executor.ts","../src/commands/execute.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { cp, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport type { EngineConfig, ResolvedPaths, TaskPlan } from '../types.js';\nimport { printError, printInfo, printRetry, printSuccess, printWarning } from '../ui/logger.js';\nimport { printIterationHeader } from '../ui/progress.js';\nimport { printStartupHeader, printSummaryBox } from '../ui/summary.js';\nimport { isTransientFailure, retryDelaySeconds, sleep } from '../utils/retry.js';\nimport { executeClaude } from './executor.js';\nimport { applyPlaceholders, loadPrompt } from './prompt-resolver.js';\nimport { publishGitState } from './session-git.js';\nimport { getSessionPublisher } from './session-publisher.js';\nimport {\n allStoriesPass,\n clearLastError,\n initializeState,\n isoNow,\n loadTaskPlan,\n markIssueCompleted,\n markIssueInProgress,\n saveTaskPlan,\n setLastError,\n trimErrorMessage,\n} from './state-manager.js';\nimport { getOutputCallback, getStoryUpdateCallback, isVerbose } from './verbose.js';\n\n/**\n * Emit a message through the output callback if available, otherwise console.log.\n * Used for bare console.log calls in engine functions so they route through listr2.\n */\nfunction emitLog(message: string): void {\n const cb = getOutputCallback();\n if (cb) {\n // Skip empty lines in listr2 context — they don't render meaningfully\n if (message) {\n cb(message);\n }\n } else {\n console.log(message);\n }\n}\n\n/**\n * Initialize the progress file if it doesn't exist.\n */\nasync function ensureProgressFile(progressFile: string): Promise<void> {\n if (!existsSync(progressFile)) {\n const content = `# Issue Flow Progress Log\\nStarted: ${new Date().toString()}\\n---\\n`;\n await writeFile(progressFile, content, 'utf-8');\n }\n}\n\n/**\n * Archive previous run artifacts if the branch has changed.\n */\nasync function archiveIfBranchChanged(plan: TaskPlan, paths: ResolvedPaths): Promise<void> {\n const { lastBranchFile, archiveDir, prdFile, progressFile } = paths;\n\n if (!existsSync(lastBranchFile)) {\n return;\n }\n\n const currentBranch = plan.branchName ?? '';\n let lastBranch = '';\n\n try {\n lastBranch = (await readFile(lastBranchFile, 'utf-8')).trim();\n } catch {\n return;\n }\n\n if (currentBranch && lastBranch && currentBranch !== lastBranch) {\n const dateStr = new Date().toISOString().split('T')[0];\n const folderName = lastBranch.replace(/^issue\\//, '').replace(/[<>:\"|?*\\\\]/g, '_');\n const archiveFolder = join(archiveDir, `${dateStr}-${folderName}`);\n\n printInfo(`Archiving previous run: ${lastBranch}`);\n await mkdir(archiveFolder, { recursive: true });\n\n if (existsSync(prdFile)) {\n await cp(prdFile, join(archiveFolder, 'tasks.json'));\n }\n if (existsSync(progressFile)) {\n await cp(progressFile, join(archiveFolder, 'progress.txt'));\n }\n\n printInfo(` Archived to: ${archiveFolder}`);\n\n // Reset progress file for new run\n await writeFile(\n progressFile,\n `# Issue Flow Progress Log\\nStarted: ${new Date().toString()}\\n---\\n`,\n 'utf-8',\n );\n }\n}\n\n/**\n * Write the current branch to the last-branch tracking file.\n */\nasync function trackBranch(plan: TaskPlan, lastBranchFile: string): Promise<void> {\n const branch = plan.branchName ?? '';\n if (branch) {\n await writeFile(lastBranchFile, `${branch}\\n`, 'utf-8');\n }\n}\n\n/**\n * Run the issue-flow engine loop.\n *\n * This replicates the full execution flow:\n * 1. Load and initialize task plan state\n * 2. Check for early exit (already complete)\n * 3. Archive previous run if branch changed\n * 4. Resolve prompt\n * 5. Main loop: iterate, execute Claude, handle results\n * 6. Print summary\n */\nexport async function runEngine(config: EngineConfig, paths: ResolvedPaths): Promise<number> {\n // Load task plan\n if (!existsSync(paths.prdFile)) {\n printError(`PRD file not found at ${paths.prdFile}`);\n if (config.issueNumber) {\n emitLog(`Have you run the resolve-issue skill for issue #${config.issueNumber} first?`);\n }\n return 1;\n }\n\n let plan = await loadTaskPlan(paths.prdFile);\n plan = initializeState(plan);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Check if already completed\n if (plan.issueStatus === 'completed' && allStoriesPass(plan)) {\n emitLog(`Issue already marked complete in ${paths.prdFile}`);\n return 0;\n }\n\n // Warn if marked complete but stories still pending\n if (plan.issueStatus === 'completed' && !allStoriesPass(plan)) {\n printWarning(\n 'Issue marked completed but some stories are still pending. Resetting to in_progress.',\n );\n plan = markIssueInProgress(plan);\n plan = setLastError(\n plan,\n 'invalid_completion_state',\n 'tasks.json claimed the issue was completed before every story had passes=true.',\n );\n await saveTaskPlan(paths.prdFile, plan);\n }\n\n // Check if all stories already pass\n if (allStoriesPass(plan)) {\n emitLog('All user stories already pass. Marking issue as completed.');\n plan = markIssueCompleted(plan);\n await saveTaskPlan(paths.prdFile, plan);\n return 0;\n }\n\n // Archive previous run if branch changed\n await archiveIfBranchChanged(plan, paths);\n\n // Track current branch\n await trackBranch(plan, paths.lastBranchFile);\n\n // Initialize progress file\n await ensureProgressFile(paths.progressFile);\n\n // Load prompt template\n const promptTemplate = await loadPrompt('execute');\n\n // Print startup header\n printStartupHeader(config, plan);\n\n const startTime = Date.now();\n let i = 0;\n let retryCount = 0;\n let totalRetryCount = 0;\n\n // Main loop\n while (true) {\n // Check iteration limit\n if (config.maxIterations !== undefined && i >= config.maxIterations) {\n break;\n }\n\n i++;\n getSessionPublisher().publish({ type: 'iteration:start', at: isoNow(), iteration: i });\n\n // Re-read plan to get latest state\n plan = await loadTaskPlan(paths.prdFile);\n\n if (isVerbose()) {\n printIterationHeader(i, config.maxIterations, plan.userStories);\n }\n\n // Apply placeholders to prompt\n const prompt = applyPlaceholders(promptTemplate, {\n __PRD_FILE__: paths.prdFile,\n __PROGRESS_FILE__: paths.progressFile,\n });\n\n const iterationStartedAt = isoNow();\n plan = markIssueInProgress(plan, iterationStartedAt);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Execute Claude\n const result = await executeClaude(prompt);\n\n if (result.exitCode !== 0) {\n const errorMessage = trimErrorMessage(result.output);\n\n if (isTransientFailure(result.exitCode, result.output)) {\n retryCount++;\n totalRetryCount++;\n plan = await loadTaskPlan(paths.prdFile);\n plan = setLastError(plan, 'transient_claude_failure', errorMessage);\n await saveTaskPlan(paths.prdFile, plan);\n\n if (!config.retryForever && retryCount > config.retryLimit) {\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n plan = await loadTaskPlan(paths.prdFile);\n printSummaryBox(\n 'failed',\n i,\n totalRetryCount,\n elapsed,\n plan,\n `Exceeded retry limit (${config.retryLimit}) on transient errors`,\n );\n return result.exitCode;\n }\n\n const delaySeconds = retryDelaySeconds(\n retryCount,\n config.backoffBaseSeconds,\n config.backoffMaxSeconds,\n );\n getSessionPublisher().publish({\n type: 'retry',\n at: isoNow(),\n attempt: retryCount,\n delaySeconds,\n reason: 'transient_claude_failure',\n });\n\n if (isVerbose()) {\n emitLog('');\n }\n printRetry(\n `Transient Claude failure on iteration ${i} (attempt ${retryCount}). Retrying in ${delaySeconds}s.`,\n );\n\n // Stay within current iteration budget\n i--;\n await sleep(delaySeconds);\n continue;\n }\n\n // Fatal failure\n plan = await loadTaskPlan(paths.prdFile);\n plan = setLastError(plan, 'fatal_claude_failure', errorMessage);\n await saveTaskPlan(paths.prdFile, plan);\n\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n printSummaryBox(\n 'failed',\n i,\n totalRetryCount,\n elapsed,\n plan,\n `Claude CLI failed with exit code ${result.exitCode}`,\n );\n return result.exitCode;\n }\n\n // Success — reset retry counter\n retryCount = 0;\n plan = await loadTaskPlan(paths.prdFile);\n plan = clearLastError(plan, iterationStartedAt);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Notify story progress listeners (e.g., listr2 subtasks)\n const storyUpdateCb = getStoryUpdateCallback();\n if (storyUpdateCb) {\n storyUpdateCb(plan.userStories);\n }\n getSessionPublisher().publish({\n type: 'stories:update',\n at: isoNow(),\n stories: plan.userStories,\n });\n getSessionPublisher().publish({ type: 'iteration:end', at: isoNow(), iteration: i });\n // Low-frequency commit/PR enrichment: iteration end is one of the only\n // two sanctioned points (the other is phase boundaries in run.ts).\n await publishGitState(getSessionPublisher());\n\n // Check for completion signal\n if (result.output.includes('<promise>COMPLETE</promise>')) {\n plan = await loadTaskPlan(paths.prdFile);\n if (allStoriesPass(plan)) {\n plan = markIssueCompleted(plan);\n await saveTaskPlan(paths.prdFile, plan);\n\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n printSummaryBox('success', i, totalRetryCount, elapsed, plan);\n return 0;\n }\n\n plan = setLastError(\n plan,\n 'invalid_completion_signal',\n 'Claude returned <promise>COMPLETE</promise> before every story had passes=true.',\n );\n await saveTaskPlan(paths.prdFile, plan);\n\n emitLog('');\n printWarning(\n 'Claude returned a completion signal, but tasks.json still has pending stories. Ignoring completion and continuing.',\n );\n }\n\n if (isVerbose()) {\n printSuccess(`Iteration ${i} complete. Continuing...`);\n }\n await sleep(2);\n }\n\n // Reached max iterations\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n plan = await loadTaskPlan(paths.prdFile);\n printSummaryBox(\n 'incomplete',\n config.maxIterations ?? i,\n totalRetryCount,\n elapsed,\n plan,\n 'Reached max iterations without completing all tasks.',\n );\n return 1;\n}\n","import chalk from 'chalk';\nimport { getOutputCallback } from '../core/verbose.js';\nimport type { UserStory } from '../types.js';\nimport { getIcons, useColor, useUnicode } from './logger.js';\n\n/**\n * Print a visual progress bar showing passed/total stories.\n */\nexport function printProgressBar(passed: number, total: number): string {\n const barWidth = 20;\n let pct = 0;\n let filled = 0;\n\n if (total > 0) {\n pct = Math.floor((passed * 100) / total);\n filled = Math.floor((passed * barWidth) / total);\n }\n\n const empty = barWidth - filled;\n const fillChar = useUnicode() ? '\\u2588' : '#';\n const emptyChar = useUnicode() ? '\\u2591' : '-';\n\n const bar = fillChar.repeat(filled) + emptyChar.repeat(empty);\n const text = `${passed}/${total} (${pct}%)`;\n\n if (useColor()) {\n return `${chalk.green(bar)} ${text}`;\n }\n return `${bar} ${text}`;\n}\n\n/**\n * Print the iteration header showing story statuses and progress bar.\n *\n * When a global output callback is set (e.g., inside a listr2 task),\n * output is routed through it instead of console.log.\n */\nexport function printIterationHeader(\n iteration: number,\n maxIter: number | undefined,\n stories: UserStory[],\n): void {\n const icons = getIcons();\n const colored = useColor();\n const cb = getOutputCallback();\n\n const iterLabel = maxIter ? `Iteration ${iteration} of ${maxIter}` : `Iteration ${iteration}`;\n\n const total = stories.length;\n const passed = stories.filter((s) => s.passes).length;\n\n const lines: string[] = [];\n\n if (colored) {\n lines.push(chalk.blue(`\\u2501\\u2501\\u2501 ${icons.start} ${iterLabel} \\u2501\\u2501\\u2501`));\n } else {\n lines.push(`--- ${icons.start} ${iterLabel} ---`);\n }\n\n // Display each story status\n let foundFirstPending = false;\n for (const story of stories) {\n let icon: string;\n let colorFn: (s: string) => string;\n\n if (story.passes) {\n icon = icons.success;\n colorFn = colored ? chalk.green : (s: string) => s;\n } else if (!foundFirstPending) {\n // First non-passing story = current in-progress\n icon = icons.pending;\n colorFn = colored ? chalk.yellow : (s: string) => s;\n foundFirstPending = true;\n } else {\n // Not yet reached\n icon = icons.notReached;\n colorFn = colored ? chalk.gray : (s: string) => s;\n }\n\n lines.push(colorFn(` ${icon} ${story.id}: ${story.title}`));\n }\n\n lines.push(` ${printProgressBar(passed, total)}`);\n\n if (cb) {\n // Send as single output to listr2 task context\n cb(lines.join('\\n'));\n } else {\n console.log('');\n for (const line of lines) {\n console.log(line);\n }\n console.log('');\n }\n}\n","import chalk from 'chalk';\nimport type { EngineConfig, PrReviewRecommendation, TaskPlan } from '../types.js';\nimport {\n formatDuration,\n getIcons,\n getTermWidth,\n printSuccess,\n printWarning,\n useColor,\n useUnicode,\n} from './logger.js';\n\n/**\n * Truncate or pad a string to fit within a given width.\n */\nfunction fitLine(text: string, width: number): string {\n if (text.length > width) {\n return text.substring(0, width);\n }\n return text.padEnd(width);\n}\n\n/**\n * Print a box with border characters around content lines.\n * Lines equal to \"---\" render as separator rows.\n */\nexport function printBox(lines: string[]): void {\n const colored = useColor();\n const unicode = useUnicode();\n const termWidth = getTermWidth();\n\n // Find max content width\n let maxContentWidth = 0;\n for (const line of lines) {\n if (line !== '---' && line.length > maxContentWidth) {\n maxContentWidth = line.length;\n }\n }\n\n // Cap to terminal width (border + padding = 4 chars)\n const available = termWidth - 4;\n if (maxContentWidth > available) {\n maxContentWidth = available;\n }\n if (maxContentWidth < 20) {\n maxContentWidth = 20;\n }\n\n // Box drawing characters\n const tl = unicode ? '\\u256D' : '+';\n const tr = unicode ? '\\u256E' : '+';\n const bl = unicode ? '\\u2570' : '+';\n const br = unicode ? '\\u256F' : '+';\n const h = unicode ? '\\u2500' : '-';\n const v = unicode ? '\\u2502' : '|';\n const sepL = unicode ? '\\u251C' : '+';\n const sepR = unicode ? '\\u2524' : '+';\n\n const hrule = h.repeat(maxContentWidth + 2);\n\n const blue = colored ? chalk.blue : (s: string) => s;\n const _reset = (s: string) => s;\n\n // Top border\n console.log(blue(`${tl}${hrule}${tr}`));\n\n // Content lines\n for (const line of lines) {\n if (line === '---') {\n console.log(blue(`${sepL}${hrule}${sepR}`));\n } else {\n const fitted = fitLine(line, maxContentWidth);\n console.log(`${blue(v)} ${fitted} ${blue(v)}`);\n }\n }\n\n // Bottom border\n console.log(blue(`${bl}${hrule}${br}`));\n}\n\n/**\n * Print the startup header box showing engine configuration.\n */\nexport function printStartupHeader(config: EngineConfig, plan: TaskPlan): void {\n const icons = getIcons();\n\n const storiesTotal = plan.userStories.length;\n const storiesPassing = plan.userStories.filter((s) => s.passes).length;\n const branchName = plan.branchName ?? 'N/A';\n\n const issueLabel = config.issueNumber ? `Issue #${config.issueNumber}` : 'Standalone mode';\n\n const maxIterLabel =\n config.maxIterations !== undefined ? String(config.maxIterations) : 'unlimited';\n\n const retryLabel = config.retryForever\n ? 'unlimited retries'\n : `${config.retryLimit} consecutive retries`;\n\n printBox([\n `${icons.start} Issue Flow`,\n '---',\n `Issue: ${issueLabel}`,\n `Branch: ${branchName}`,\n `Stories: ${storiesPassing}/${storiesTotal} passing`,\n `Iterations: ${maxIterLabel}`,\n `Retries: ${retryLabel}`,\n ]);\n}\n\n// Re-export formatDuration from logger to maintain backwards compatibility\nexport { formatDuration } from './logger.js';\n\n/**\n * Print the final summary box.\n */\nexport function printSummaryBox(\n status: 'success' | 'incomplete' | 'failed',\n iterations: number,\n totalRetries: number,\n elapsedSeconds: number,\n plan: TaskPlan,\n extraInfo?: string,\n): void {\n const icons = getIcons();\n\n const storiesTotal = plan.userStories.length;\n const storiesPassing = plan.userStories.filter((s) => s.passes).length;\n const duration = formatDuration(elapsedSeconds);\n\n let statusIcon: string;\n let statusLabel: string;\n\n switch (status) {\n case 'success':\n statusIcon = icons.success;\n statusLabel = 'Completed';\n break;\n case 'incomplete':\n statusIcon = icons.warn;\n statusLabel = 'Incomplete';\n break;\n case 'failed':\n statusIcon = icons.fail;\n statusLabel = 'Failed';\n break;\n }\n\n const boxLines = [\n `${icons.end} Issue Flow Summary`,\n '---',\n `Status: ${statusIcon} ${statusLabel}`,\n `Stories: ${storiesPassing}/${storiesTotal} passing`,\n `Iterations: ${iterations}`,\n `Duration: ${duration}`,\n `Retries: ${totalRetries}`,\n ];\n\n if (extraInfo) {\n boxLines.push('---');\n boxLines.push(extraInfo);\n }\n\n console.log('');\n printBox(boxLines);\n}\n\n/**\n * What the optional `pr-review` phase produced, as far as the summary cares.\n * `null` in `recommendation` means the verdict could not be recovered from\n * disk — the exit code still told us whether changes were requested.\n */\nexport interface RunSummaryPrReview {\n requestedChanges: boolean;\n recommendation: PrReviewRecommendation | null;\n reportPath: string | null;\n}\n\n/**\n * Everything the final `run` summary prints, already resolved by the caller.\n */\nexport interface RunSummaryInfo {\n issueNumber: string;\n /** 'unknown' when the branch could not be detected. */\n branchName: string;\n /** Pipelines run with --no-branch open no Pull Request. */\n noBranch: boolean;\n storyCount: number;\n elapsedSeconds: number;\n /** 'unknown' when no Pull Request could be resolved. */\n prUrl: string;\n /** Only set when the pr-review phase actually ran. */\n prReview?: RunSummaryPrReview | null;\n}\n\n/**\n * Detail lines of the final `run` summary (everything below the headline).\n *\n * Kept separate from the printing so the shape is testable without capturing\n * stdout. Without `prReview` the lines are exactly the ones the pipeline has\n * always printed.\n */\nexport function buildRunSummaryLines(info: RunSummaryInfo): string[] {\n const lines = [\n ` Branch: ${info.branchName}${info.noBranch ? ' (current)' : ''}`,\n ` Stories: ${info.storyCount}`,\n ` Duration: ${formatDuration(info.elapsedSeconds)}`,\n ];\n\n if (!info.noBranch) {\n lines.push(` PR: ${info.prUrl}`);\n }\n\n const review = info.prReview;\n if (review) {\n // The exit code is the source of truth for the verdict, so a report whose\n // recommendation could not be read still reports REQUEST_CHANGES.\n const verdict =\n review.recommendation ?? (review.requestedChanges ? 'REQUEST_CHANGES' : 'unknown');\n lines.push(` Review: ${verdict}`);\n if (review.reportPath !== null) {\n lines.push(` Report: ${review.reportPath}`);\n }\n }\n\n return lines;\n}\n\n/**\n * Print the final summary of a `run` (the flat listing, not the box used by\n * the execute engine).\n */\nexport function printRunSummary(info: RunSummaryInfo): void {\n console.log('');\n if (info.prReview?.requestedChanges) {\n printWarning(\n `Pipeline finished for issue #${info.issueNumber}, but the PR review requested changes.`,\n );\n } else {\n printSuccess(`Pipeline complete for issue #${info.issueNumber}!`);\n }\n for (const line of buildRunSummaryLines(info)) {\n console.log(line);\n }\n}\n","import { execa } from 'execa';\nimport type { ClaudeResult } from '../types.js';\nimport { getOutputCallback } from './verbose.js';\n\n/**\n * Execute Claude CLI with a prompt piped to stdin.\n *\n * Runs: echo $PROMPT | claude --dangerously-skip-permissions --print\n *\n * Captures combined stdout+stderr output. Does not throw on non-zero exit codes.\n * Output is returned via ClaudeResult and routed through the output callback infrastructure.\n */\nexport async function executeClaude(prompt: string): Promise<ClaudeResult> {\n const result = await execa('claude', ['--dangerously-skip-permissions', '--print'], {\n input: prompt,\n reject: false,\n timeout: 0, // No timeout — let the engine handle iteration limits\n stripFinalNewline: false,\n });\n\n // Combine stdout and stderr to match Bash's 2>&1 behavior\n const stdout = result.stdout?.toString() ?? '';\n const stderr = result.stderr?.toString() ?? '';\n const output = stdout + (stderr ? `\\n${stderr}` : '');\n\n // Forward output through the global callback (listr2 renderer) when active\n const onOutput = getOutputCallback();\n if (onOutput) {\n const trimmed = output.trim();\n if (trimmed) {\n onOutput(trimmed);\n }\n }\n\n return {\n exitCode: result.exitCode ?? 1,\n output,\n };\n}\n","import { createConfig, resolvePaths, validateDependencies } from '../config.js';\nimport { runEngine } from '../core/engine.js';\nimport { allStoriesPass, loadTaskPlan, saveTaskPlan } from '../core/state-manager.js';\nimport { printError } from '../ui/logger.js';\n\nexport interface ExecuteOptions {\n issue?: string;\n maxIterations?: number;\n retryLimit?: number;\n retryForever?: boolean;\n}\n\nexport async function runExecute(\n positionalMaxIter: number | undefined,\n options: ExecuteOptions,\n): Promise<number> {\n const errors = await validateDependencies();\n if (errors.length > 0) {\n printError('The following required tools are not installed:');\n for (const err of errors) {\n console.log(err);\n }\n return 1;\n }\n\n const maxIterations = options.maxIterations ?? positionalMaxIter;\n\n const config = createConfig({\n issueNumber: options.issue,\n maxIterations,\n retryLimit: options.retryLimit,\n retryForever: options.retryForever,\n });\n\n const paths = await resolvePaths(config);\n const exitCode = await runEngine(config, paths);\n\n // Update pipeline state if all stories pass\n if (exitCode === 0 && config.issueNumber) {\n try {\n const plan = await loadTaskPlan(paths.prdFile);\n if (allStoriesPass(plan)) {\n plan.pipeline.executionCompleted = true;\n await saveTaskPlan(paths.prdFile, plan);\n }\n } catch {\n // Non-critical — engine already handled state\n }\n }\n\n return exitCode;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;AAC3B,SAAS,IAAI,OAAO,UAAU,iBAAiB;AAC/C,SAAS,YAAY;;;ACFrB,OAAO,WAAW;AAQX,SAAS,iBAAiB,QAAgB,OAAuB;AACtE,QAAM,WAAW;AACjB,MAAI,MAAM;AACV,MAAI,SAAS;AAEb,MAAI,QAAQ,GAAG;AACb,UAAM,KAAK,MAAO,SAAS,MAAO,KAAK;AACvC,aAAS,KAAK,MAAO,SAAS,WAAY,KAAK;AAAA,EACjD;AAEA,QAAM,QAAQ,WAAW;AACzB,QAAM,WAAW,WAAW,IAAI,WAAW;AAC3C,QAAM,YAAY,WAAW,IAAI,WAAW;AAE5C,QAAM,MAAM,SAAS,OAAO,MAAM,IAAI,UAAU,OAAO,KAAK;AAC5D,QAAM,OAAO,GAAG,MAAM,IAAI,KAAK,KAAK,GAAG;AAEvC,MAAI,SAAS,GAAG;AACd,WAAO,GAAG,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI;AAAA,EACpC;AACA,SAAO,GAAG,GAAG,IAAI,IAAI;AACvB;AAQO,SAAS,qBACd,WACA,SACA,SACM;AACN,QAAM,QAAQ,SAAS;AACvB,QAAM,UAAU,SAAS;AACzB,QAAM,KAAK,kBAAkB;AAE7B,QAAM,YAAY,UAAU,aAAa,SAAS,OAAO,OAAO,KAAK,aAAa,SAAS;AAE3F,QAAM,QAAQ,QAAQ;AACtB,QAAM,SAAS,QAAQ,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE;AAE/C,QAAM,QAAkB,CAAC;AAEzB,MAAI,SAAS;AACX,UAAM,KAAK,MAAM,KAAK,sBAAsB,MAAM,KAAK,IAAI,SAAS,qBAAqB,CAAC;AA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["chalk","chalk","elapsed"]}
|
|
@@ -1,18 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
issuePlaceholders,
|
|
4
|
+
resolveCommandIssue
|
|
5
|
+
} from "./chunk-HS4QWZAO.js";
|
|
2
6
|
import {
|
|
3
7
|
runHeadless
|
|
4
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KUDAY57D.js";
|
|
5
9
|
import {
|
|
6
10
|
applyPlaceholders,
|
|
7
11
|
loadPrompt
|
|
8
12
|
} from "./chunk-SLHZPB3C.js";
|
|
13
|
+
import {
|
|
14
|
+
getIssueDir
|
|
15
|
+
} from "./chunk-OVFYJLOH.js";
|
|
9
16
|
import {
|
|
10
17
|
getGlobalTimeout,
|
|
11
18
|
loadTaskPlan,
|
|
12
19
|
printError,
|
|
13
20
|
printSuccess,
|
|
14
21
|
saveTaskPlan
|
|
15
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-2Y3UO7H2.js";
|
|
16
23
|
|
|
17
24
|
// src/commands/review.ts
|
|
18
25
|
import { join } from "path";
|
|
@@ -38,14 +45,19 @@ function parseReviewResult(output) {
|
|
|
38
45
|
findings: findingsMatch?.[1]?.trim() ?? "Unknown findings"
|
|
39
46
|
};
|
|
40
47
|
}
|
|
41
|
-
async function runReview(issue) {
|
|
48
|
+
async function runReview(issue, resolvedIssue) {
|
|
42
49
|
const issueNumber = issue.replace(/^#/, "");
|
|
43
|
-
const issueDir =
|
|
50
|
+
const issueDir = await getIssueDir(issueNumber);
|
|
44
51
|
const tasksPath = join(issueDir, "tasks.json");
|
|
52
|
+
const resolution = await resolveCommandIssue(issueNumber, resolvedIssue);
|
|
53
|
+
if (!resolution.ok) {
|
|
54
|
+
return resolution.code;
|
|
55
|
+
}
|
|
45
56
|
const template = await loadPrompt("review");
|
|
46
57
|
const prompt = applyPlaceholders(template, {
|
|
47
58
|
__ISSUE_NUMBER__: issueNumber,
|
|
48
|
-
__TASKS_PATH__: tasksPath
|
|
59
|
+
__TASKS_PATH__: tasksPath,
|
|
60
|
+
...issuePlaceholders(resolution.resolved)
|
|
49
61
|
});
|
|
50
62
|
const result = await runHeadless({
|
|
51
63
|
prompt,
|
|
@@ -80,4 +92,4 @@ async function runReview(issue) {
|
|
|
80
92
|
export {
|
|
81
93
|
runReview
|
|
82
94
|
};
|
|
83
|
-
//# sourceMappingURL=chunk-
|
|
95
|
+
//# sourceMappingURL=chunk-Z3UIGLZG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/review.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { runHeadless } from '../core/headless.js';\nimport { applyPlaceholders, loadPrompt } from '../core/prompt-resolver.js';\nimport { loadTaskPlan, saveTaskPlan } from '../core/state-manager.js';\nimport { getGlobalTimeout } from '../core/verbose.js';\nimport { issuePlaceholders, resolveCommandIssue } from '../issues/context.js';\nimport type { ResolvedIssue } from '../issues/types.js';\nimport { printError, printSuccess } from '../ui/logger.js';\nimport { getIssueDir } from '../utils/git.js';\n\nexport interface ReviewResult {\n status: 'PASS' | 'FAIL';\n findings?: string;\n}\n\n/**\n * Parse the <review-result> block from headless output.\n */\nfunction parseReviewResult(output: string): ReviewResult {\n const match = output.match(/<review-result>([\\s\\S]*?)<\\/review-result>/);\n if (!match) {\n // Try to detect PASS/FAIL from the raw output\n if (/STATUS:\\s*PASS/i.test(output)) {\n return { status: 'PASS' };\n }\n if (/STATUS:\\s*FAIL/i.test(output)) {\n const findingsMatch = output.match(/FINDINGS:([\\s\\S]*?)(?:$|<\\/)/);\n return { status: 'FAIL', findings: findingsMatch?.[1]?.trim() ?? 'Unknown findings' };\n }\n // Default to PASS if no explicit status found and no errors\n return { status: 'PASS' };\n }\n\n const block = match[1];\n if (/STATUS:\\s*PASS/i.test(block)) {\n return { status: 'PASS' };\n }\n\n const findingsMatch = block.match(/FINDINGS:([\\s\\S]*)/);\n return {\n status: 'FAIL',\n findings: findingsMatch?.[1]?.trim() ?? 'Unknown findings',\n };\n}\n\nexport async function runReview(issue: string, resolvedIssue?: ResolvedIssue): Promise<number> {\n const issueNumber = issue.replace(/^#/, '');\n const issueDir = await getIssueDir(issueNumber);\n const tasksPath = join(issueDir, 'tasks.json');\n\n const resolution = await resolveCommandIssue(issueNumber, resolvedIssue);\n if (!resolution.ok) {\n return resolution.code;\n }\n\n const template = await loadPrompt('review');\n const prompt = applyPlaceholders(template, {\n __ISSUE_NUMBER__: issueNumber,\n __TASKS_PATH__: tasksPath,\n ...issuePlaceholders(resolution.resolved),\n });\n\n const result = await runHeadless({\n prompt,\n maxTurns: 25,\n timeout: getGlobalTimeout() ?? 300_000,\n outputFormat: 'text',\n allowedTools: ['Bash', 'Read', 'Glob', 'Grep'],\n statusMessage: `Reviewing issue #${issueNumber} resolution...`,\n });\n\n if (!result.success) {\n printError(`Review failed: ${result.error}`);\n return 1;\n }\n\n const review = parseReviewResult(result.result);\n\n if (review.status === 'PASS') {\n // Update pipeline state\n try {\n const plan = await loadTaskPlan(tasksPath);\n plan.pipeline.reviewCompleted = true;\n await saveTaskPlan(tasksPath, plan);\n } catch {\n // tasks.json may not exist\n }\n\n printSuccess('Review PASSED — implementation meets acceptance criteria');\n return 0;\n }\n\n printError('Review FAILED — issues found:');\n if (review.findings) {\n console.log(review.findings);\n }\n return 1;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,YAAY;AAkBrB,SAAS,kBAAkB,QAA8B;AACvD,QAAM,QAAQ,OAAO,MAAM,4CAA4C;AACvE,MAAI,CAAC,OAAO;AAEV,QAAI,kBAAkB,KAAK,MAAM,GAAG;AAClC,aAAO,EAAE,QAAQ,OAAO;AAAA,IAC1B;AACA,QAAI,kBAAkB,KAAK,MAAM,GAAG;AAClC,YAAMA,iBAAgB,OAAO,MAAM,8BAA8B;AACjE,aAAO,EAAE,QAAQ,QAAQ,UAAUA,iBAAgB,CAAC,GAAG,KAAK,KAAK,mBAAmB;AAAA,IACt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