issue-flow 0.12.0 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/README.md +79 -274
  2. package/dist/agent-BXRIEKVM.js +238 -0
  3. package/dist/agent-BXRIEKVM.js.map +1 -0
  4. package/dist/{analyze-OEET7KGE.js → analyze-WS47UYGN.js} +28 -16
  5. package/dist/analyze-WS47UYGN.js.map +1 -0
  6. package/dist/{apply-ZIA3C52S.js → apply-OS62UWRN.js} +15 -7
  7. package/dist/{apply-ZIA3C52S.js.map → apply-OS62UWRN.js.map} +1 -1
  8. package/dist/bench-SA3BOME5.js +906 -0
  9. package/dist/bench-SA3BOME5.js.map +1 -0
  10. package/dist/chunk-37N2RJW2.js +120 -0
  11. package/dist/chunk-37N2RJW2.js.map +1 -0
  12. package/dist/chunk-3XLCNVMD.js +180 -0
  13. package/dist/chunk-3XLCNVMD.js.map +1 -0
  14. package/dist/chunk-5TB6KLC2.js +72 -0
  15. package/dist/chunk-5TB6KLC2.js.map +1 -0
  16. package/dist/{chunk-MJULIKQU.js → chunk-664Y3NDX.js} +23 -47
  17. package/dist/chunk-664Y3NDX.js.map +1 -0
  18. package/dist/chunk-6FDFRNXZ.js +357 -0
  19. package/dist/chunk-6FDFRNXZ.js.map +1 -0
  20. package/dist/{chunk-56KS3TFQ.js → chunk-7KD66LIM.js} +115 -160
  21. package/dist/chunk-7KD66LIM.js.map +1 -0
  22. package/dist/chunk-7Z4Y3VKM.js +26 -0
  23. package/dist/chunk-7Z4Y3VKM.js.map +1 -0
  24. package/dist/chunk-ARFVHC2F.js +1111 -0
  25. package/dist/chunk-ARFVHC2F.js.map +1 -0
  26. package/dist/{chunk-NS6R37II.js → chunk-BHJCGWQX.js} +141 -12
  27. package/dist/chunk-BHJCGWQX.js.map +1 -0
  28. package/dist/chunk-BQDQTIM7.js +74 -0
  29. package/dist/chunk-BQDQTIM7.js.map +1 -0
  30. package/dist/chunk-CNBYCMSU.js +2709 -0
  31. package/dist/chunk-CNBYCMSU.js.map +1 -0
  32. package/dist/chunk-CRGIQFUQ.js +83 -0
  33. package/dist/chunk-CRGIQFUQ.js.map +1 -0
  34. package/dist/chunk-DIG5XKQQ.js +298 -0
  35. package/dist/chunk-DIG5XKQQ.js.map +1 -0
  36. package/dist/chunk-FZDR7CGH.js +71 -0
  37. package/dist/chunk-FZDR7CGH.js.map +1 -0
  38. package/dist/chunk-HEF2RMKN.js +413 -0
  39. package/dist/chunk-HEF2RMKN.js.map +1 -0
  40. package/dist/{chunk-M5UCXTIT.js → chunk-HJGGNLWI.js} +22 -18
  41. package/dist/chunk-HJGGNLWI.js.map +1 -0
  42. package/dist/chunk-HQAHNIAR.js +283 -0
  43. package/dist/chunk-HQAHNIAR.js.map +1 -0
  44. package/dist/{chunk-FJP3UQGD.js → chunk-IHIEXUTC.js} +39 -19
  45. package/dist/chunk-IHIEXUTC.js.map +1 -0
  46. package/dist/{chunk-Y5ZDJ4PJ.js → chunk-IV5SS4JN.js} +18 -10
  47. package/dist/chunk-IV5SS4JN.js.map +1 -0
  48. package/dist/{chunk-BYZDPR7N.js → chunk-IYV6KNVF.js} +146 -13
  49. package/dist/chunk-IYV6KNVF.js.map +1 -0
  50. package/dist/{chunk-TSOLWK7Y.js → chunk-J62QSVP6.js} +8 -8
  51. package/dist/chunk-KQHB7ZT3.js +559 -0
  52. package/dist/chunk-KQHB7ZT3.js.map +1 -0
  53. package/dist/chunk-L6HSKTQE.js +77 -0
  54. package/dist/chunk-L6HSKTQE.js.map +1 -0
  55. package/dist/{chunk-3QHK4YQA.js → chunk-LZ6GFQAG.js} +334 -117
  56. package/dist/chunk-LZ6GFQAG.js.map +1 -0
  57. package/dist/{chunk-LAFNLLQP.js → chunk-MIVHK5YI.js} +5 -5
  58. package/dist/chunk-NEZZ6KDR.js +1217 -0
  59. package/dist/chunk-NEZZ6KDR.js.map +1 -0
  60. package/dist/{chunk-NTMMF5UD.js → chunk-OPNGPUKJ.js} +436 -254
  61. package/dist/chunk-OPNGPUKJ.js.map +1 -0
  62. package/dist/chunk-P3LRUNC6.js +16 -0
  63. package/dist/chunk-P3LRUNC6.js.map +1 -0
  64. package/dist/{chunk-FADTCQGM.js → chunk-PIVGJM6K.js} +94 -32
  65. package/dist/chunk-PIVGJM6K.js.map +1 -0
  66. package/dist/{chunk-73ATPIYX.js → chunk-PV4OX5TC.js} +36 -71
  67. package/dist/chunk-PV4OX5TC.js.map +1 -0
  68. package/dist/chunk-QCXPNSEL.js +141 -0
  69. package/dist/chunk-QCXPNSEL.js.map +1 -0
  70. package/dist/{chunk-XQUSIEKA.js → chunk-QXDNBYQF.js} +52 -14
  71. package/dist/chunk-QXDNBYQF.js.map +1 -0
  72. package/dist/chunk-SNTTOQAD.js +30 -0
  73. package/dist/chunk-SNTTOQAD.js.map +1 -0
  74. package/dist/{chunk-QCPGHBSZ.js → chunk-TM67EHSV.js} +63 -21
  75. package/dist/chunk-TM67EHSV.js.map +1 -0
  76. package/dist/chunk-TVN2JVOF.js +77 -0
  77. package/dist/chunk-TVN2JVOF.js.map +1 -0
  78. package/dist/chunk-TX5WIVYP.js +129 -0
  79. package/dist/chunk-TX5WIVYP.js.map +1 -0
  80. package/dist/{chunk-A4SLHOW7.js → chunk-UJ7XWK7J.js} +24 -18
  81. package/dist/chunk-UJ7XWK7J.js.map +1 -0
  82. package/dist/{chunk-EZATO3DW.js → chunk-UOCPC2Y2.js} +594 -17
  83. package/dist/chunk-UOCPC2Y2.js.map +1 -0
  84. package/dist/chunk-XEYH6ZZI.js +289 -0
  85. package/dist/chunk-XEYH6ZZI.js.map +1 -0
  86. package/dist/cli.js +264 -44
  87. package/dist/cli.js.map +1 -1
  88. package/dist/{config-PRJGWW7J.js → config-MEM2IWWN.js} +28 -5
  89. package/dist/contract-JH2WBIO6.js +8 -0
  90. package/dist/conventions-WV4NDXGH.js +143 -0
  91. package/dist/conventions-WV4NDXGH.js.map +1 -0
  92. package/dist/execute-NITIHHCK.js +31 -0
  93. package/dist/{generate-EGB4KV2B.js → generate-MVQI7A45.js} +34 -20
  94. package/dist/{generate-EGB4KV2B.js.map → generate-MVQI7A45.js.map} +1 -1
  95. package/dist/git-YRVRUN3C.js +31 -0
  96. package/dist/init-OKWEC3EV.js +21 -0
  97. package/dist/{operations-BYT626KQ.js → operations-LU6JA3BX.js} +24 -15
  98. package/dist/{operations-BYT626KQ.js.map → operations-LU6JA3BX.js.map} +1 -1
  99. package/dist/permissions-7NMDFU27.js +18 -0
  100. package/dist/plan-LEJJF3DE.js +31 -0
  101. package/dist/{policy-6S4GFC76.js → policy-JSYEK5B2.js} +17 -6
  102. package/dist/policy-JSYEK5B2.js.map +1 -0
  103. package/dist/pr-HPVUZ7S3.js +36 -0
  104. package/dist/pr-review-R2QZBT3F.js +29 -0
  105. package/dist/prd-5O6GYCC6.js +30 -0
  106. package/dist/ps-TNE44R5V.js +90 -0
  107. package/dist/ps-TNE44R5V.js.map +1 -0
  108. package/dist/recorder-XGF55WXI.js +31 -0
  109. package/dist/recorder-XGF55WXI.js.map +1 -0
  110. package/dist/registry-LGPE53QD.js +15 -0
  111. package/dist/registry-LGPE53QD.js.map +1 -0
  112. package/dist/{resume-PPCNQVVV.js → resume-QMEPMSZW.js} +51 -34
  113. package/dist/{resume-PPCNQVVV.js.map → resume-QMEPMSZW.js.map} +1 -1
  114. package/dist/review-YKWD6SNN.js +32 -0
  115. package/dist/review-YKWD6SNN.js.map +1 -0
  116. package/dist/routing-2ZUMZPJB.js +91 -0
  117. package/dist/routing-2ZUMZPJB.js.map +1 -0
  118. package/dist/run-YU4TR62R.js +50 -0
  119. package/dist/run-YU4TR62R.js.map +1 -0
  120. package/dist/{state-manager-2EDVDBAR.js → state-manager-X3PT3FGT.js} +4 -2
  121. package/dist/state-manager-X3PT3FGT.js.map +1 -0
  122. package/dist/usage-VCFLDA5Y.js +174 -0
  123. package/dist/usage-VCFLDA5Y.js.map +1 -0
  124. package/dist/{web-EF5WIIGG.js → web-XVHLX62B.js} +41 -30
  125. package/dist/web-XVHLX62B.js.map +1 -0
  126. package/package.json +6 -2
  127. package/prompts/execute.md +7 -8
  128. package/prompts/plan.md +4 -5
  129. package/prompts/pr.md +2 -2
  130. package/web/AGENTS.md +3 -3
  131. package/web/public/app.css +38 -0
  132. package/web/public/app.js +121 -11
  133. package/web/public/index.html +24 -0
  134. package/dist/analyze-OEET7KGE.js.map +0 -1
  135. package/dist/chunk-3QHK4YQA.js.map +0 -1
  136. package/dist/chunk-42PJFMAR.js +0 -605
  137. package/dist/chunk-42PJFMAR.js.map +0 -1
  138. package/dist/chunk-4JSOYE4G.js +0 -368
  139. package/dist/chunk-4JSOYE4G.js.map +0 -1
  140. package/dist/chunk-56KS3TFQ.js.map +0 -1
  141. package/dist/chunk-73ATPIYX.js.map +0 -1
  142. package/dist/chunk-A4SLHOW7.js.map +0 -1
  143. package/dist/chunk-BAUPQXPE.js +0 -173
  144. package/dist/chunk-BAUPQXPE.js.map +0 -1
  145. package/dist/chunk-BYZDPR7N.js.map +0 -1
  146. package/dist/chunk-CD5ULRVC.js +0 -615
  147. package/dist/chunk-CD5ULRVC.js.map +0 -1
  148. package/dist/chunk-DIDUVL6O.js +0 -1365
  149. package/dist/chunk-DIDUVL6O.js.map +0 -1
  150. package/dist/chunk-EZATO3DW.js.map +0 -1
  151. package/dist/chunk-FADTCQGM.js.map +0 -1
  152. package/dist/chunk-FJP3UQGD.js.map +0 -1
  153. package/dist/chunk-LWRSMTTZ.js +0 -18
  154. package/dist/chunk-LWRSMTTZ.js.map +0 -1
  155. package/dist/chunk-M5UCXTIT.js.map +0 -1
  156. package/dist/chunk-M66SJHQQ.js +0 -206
  157. package/dist/chunk-M66SJHQQ.js.map +0 -1
  158. package/dist/chunk-MJULIKQU.js.map +0 -1
  159. package/dist/chunk-NS6R37II.js.map +0 -1
  160. package/dist/chunk-NTMMF5UD.js.map +0 -1
  161. package/dist/chunk-QCPGHBSZ.js.map +0 -1
  162. package/dist/chunk-XQUSIEKA.js.map +0 -1
  163. package/dist/chunk-Y5ZDJ4PJ.js.map +0 -1
  164. package/dist/execute-XBNVL753.js +0 -18
  165. package/dist/init-AJHCXJBP.js +0 -10
  166. package/dist/plan-QOZ3RIO6.js +0 -21
  167. package/dist/policy-6S4GFC76.js.map +0 -1
  168. package/dist/pr-EBBHD2ZX.js +0 -26
  169. package/dist/pr-review-VVMW5PO4.js +0 -20
  170. package/dist/prd-JQSZF7PR.js +0 -21
  171. package/dist/review-3F6MARWH.js +0 -19
  172. package/dist/run-RXE5GDQO.js +0 -36
  173. package/dist/web-EF5WIIGG.js.map +0 -1
  174. /package/dist/{chunk-TSOLWK7Y.js.map → chunk-J62QSVP6.js.map} +0 -0
  175. /package/dist/{chunk-LAFNLLQP.js.map → chunk-MIVHK5YI.js.map} +0 -0
  176. /package/dist/{config-PRJGWW7J.js.map → config-MEM2IWWN.js.map} +0 -0
  177. /package/dist/{execute-XBNVL753.js.map → contract-JH2WBIO6.js.map} +0 -0
  178. /package/dist/{init-AJHCXJBP.js.map → execute-NITIHHCK.js.map} +0 -0
  179. /package/dist/{plan-QOZ3RIO6.js.map → git-YRVRUN3C.js.map} +0 -0
  180. /package/dist/{pr-EBBHD2ZX.js.map → init-OKWEC3EV.js.map} +0 -0
  181. /package/dist/{pr-review-VVMW5PO4.js.map → permissions-7NMDFU27.js.map} +0 -0
  182. /package/dist/{prd-JQSZF7PR.js.map → plan-LEJJF3DE.js.map} +0 -0
  183. /package/dist/{review-3F6MARWH.js.map → pr-HPVUZ7S3.js.map} +0 -0
  184. /package/dist/{run-RXE5GDQO.js.map → pr-review-R2QZBT3F.js.map} +0 -0
  185. /package/dist/{state-manager-2EDVDBAR.js.map → prd-5O6GYCC6.js.map} +0 -0
@@ -0,0 +1,30 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runPrd
4
+ } from "./chunk-HJGGNLWI.js";
5
+ import "./chunk-IV5SS4JN.js";
6
+ import "./chunk-FZDR7CGH.js";
7
+ import "./chunk-PV4OX5TC.js";
8
+ import "./chunk-KMMASOA6.js";
9
+ import "./chunk-664Y3NDX.js";
10
+ import "./chunk-MIVHK5YI.js";
11
+ import "./chunk-ARFVHC2F.js";
12
+ import "./chunk-3XLCNVMD.js";
13
+ import "./chunk-QCXPNSEL.js";
14
+ import "./chunk-UOCPC2Y2.js";
15
+ import "./chunk-CNBYCMSU.js";
16
+ import "./chunk-HQAHNIAR.js";
17
+ import "./chunk-IYV6KNVF.js";
18
+ import "./chunk-6FDFRNXZ.js";
19
+ import "./chunk-P3LRUNC6.js";
20
+ import "./chunk-DIG5XKQQ.js";
21
+ import "./chunk-NEZZ6KDR.js";
22
+ import "./chunk-TVN2JVOF.js";
23
+ import "./chunk-TX5WIVYP.js";
24
+ import "./chunk-KQHB7ZT3.js";
25
+ import "./chunk-7Z4Y3VKM.js";
26
+ import "./chunk-XEYH6ZZI.js";
27
+ export {
28
+ runPrd
29
+ };
30
+ //# sourceMappingURL=prd-5O6GYCC6.js.map
@@ -0,0 +1,90 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ listLiveRuns
4
+ } from "./chunk-5TB6KLC2.js";
5
+ import "./chunk-SNTTOQAD.js";
6
+ import {
7
+ formatDuration,
8
+ printInfo
9
+ } from "./chunk-IYV6KNVF.js";
10
+ import "./chunk-P3LRUNC6.js";
11
+ import "./chunk-DIG5XKQQ.js";
12
+ import "./chunk-NEZZ6KDR.js";
13
+ import "./chunk-TX5WIVYP.js";
14
+ import "./chunk-KQHB7ZT3.js";
15
+ import "./chunk-7Z4Y3VKM.js";
16
+ import "./chunk-XEYH6ZZI.js";
17
+
18
+ // src/commands/ps.ts
19
+ import { z } from "zod";
20
+ var liveRunJsonSchema = z.object({
21
+ schemaVersion: z.literal(1),
22
+ runs: z.array(
23
+ z.object({
24
+ projectId: z.string(),
25
+ target: z.string(),
26
+ pid: z.number(),
27
+ host: z.string(),
28
+ detached: z.boolean(),
29
+ status: z.enum(["running", "unsignaled", "orphan"]),
30
+ startedAt: z.string(),
31
+ lastHeartbeatAt: z.string(),
32
+ issue: z.number().nullable(),
33
+ phase: z.string().nullable(),
34
+ storiesCompleted: z.number().nullable(),
35
+ storiesTotal: z.number().nullable(),
36
+ elapsedSeconds: z.number().nullable()
37
+ })
38
+ )
39
+ });
40
+ function formatPsTable(runs) {
41
+ if (runs.length === 0) return ["No issue-flow run is active on this machine."];
42
+ const header = pad(["STATUS", "ISSUE", "PHASE", "PROGRESS", "ELAPSED", "PID", "PROJECT"]);
43
+ const rows = runs.map(
44
+ (run) => pad([
45
+ run.status,
46
+ run.issue !== null ? `#${run.issue}` : run.target,
47
+ run.phase ?? "\u2014",
48
+ run.storiesTotal !== null ? `${run.storiesCompleted ?? 0}/${run.storiesTotal}` : "\u2014",
49
+ run.elapsedSeconds !== null ? formatDuration(run.elapsedSeconds) : "\u2014",
50
+ String(run.pid),
51
+ `${run.projectId}${run.detached ? " (bg)" : ""}`
52
+ ])
53
+ );
54
+ return [header, ...rows];
55
+ }
56
+ function pad(cells) {
57
+ const widths = [12, 10, 12, 10, 10, 8, 24];
58
+ return cells.map((cell, i) => cell.padEnd(widths[i] ?? 12)).join(" ");
59
+ }
60
+ async function runPs(options = {}) {
61
+ const render = async () => {
62
+ const runs = await listLiveRuns();
63
+ if (options.json === true) {
64
+ const payload = liveRunJsonSchema.parse({
65
+ schemaVersion: 1,
66
+ runs: runs.map(({ lockFile: _lockFile, ...rest }) => rest)
67
+ });
68
+ printInfo(JSON.stringify(payload, null, 2));
69
+ return runs.length;
70
+ }
71
+ for (const line of formatPsTable(runs)) {
72
+ printInfo(line);
73
+ }
74
+ return runs.length;
75
+ };
76
+ if (options.watch === true) {
77
+ for (; ; ) {
78
+ await render();
79
+ await new Promise((resolve) => setTimeout(resolve, 2e3));
80
+ }
81
+ }
82
+ await render();
83
+ return 0;
84
+ }
85
+ export {
86
+ formatPsTable,
87
+ liveRunJsonSchema,
88
+ runPs
89
+ };
90
+ //# sourceMappingURL=ps-TNE44R5V.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/ps.ts"],"sourcesContent":["import { z } from 'zod';\nimport { type LiveRun, listLiveRuns } from '../execution/registry.js';\nimport { formatDuration, printInfo } from '../ui/logger.js';\n\nexport const liveRunJsonSchema = z.object({\n schemaVersion: z.literal(1),\n runs: z.array(\n z.object({\n projectId: z.string(),\n target: z.string(),\n pid: z.number(),\n host: z.string(),\n detached: z.boolean(),\n status: z.enum(['running', 'unsignaled', 'orphan']),\n startedAt: z.string(),\n lastHeartbeatAt: z.string(),\n issue: z.number().nullable(),\n phase: z.string().nullable(),\n storiesCompleted: z.number().nullable(),\n storiesTotal: z.number().nullable(),\n elapsedSeconds: z.number().nullable(),\n }),\n ),\n});\n\nexport interface PsOptions {\n json?: boolean;\n watch?: boolean;\n}\n\nexport function formatPsTable(runs: readonly LiveRun[]): string[] {\n if (runs.length === 0) return ['No issue-flow run is active on this machine.'];\n\n const header = pad(['STATUS', 'ISSUE', 'PHASE', 'PROGRESS', 'ELAPSED', 'PID', 'PROJECT']);\n const rows = runs.map((run) =>\n pad([\n run.status,\n run.issue !== null ? `#${run.issue}` : run.target,\n run.phase ?? '—',\n run.storiesTotal !== null ? `${run.storiesCompleted ?? 0}/${run.storiesTotal}` : '—',\n run.elapsedSeconds !== null ? formatDuration(run.elapsedSeconds) : '—',\n String(run.pid),\n `${run.projectId}${run.detached ? ' (bg)' : ''}`,\n ]),\n );\n return [header, ...rows];\n}\n\nfunction pad(cells: string[]): string {\n const widths = [12, 10, 12, 10, 10, 8, 24];\n return cells.map((cell, i) => cell.padEnd(widths[i] ?? 12)).join(' ');\n}\n\nexport async function runPs(options: PsOptions = {}): Promise<number> {\n const render = async () => {\n const runs = await listLiveRuns();\n if (options.json === true) {\n const payload = liveRunJsonSchema.parse({\n schemaVersion: 1,\n runs: runs.map(({ lockFile: _lockFile, ...rest }) => rest),\n });\n printInfo(JSON.stringify(payload, null, 2));\n return runs.length;\n }\n for (const line of formatPsTable(runs)) {\n printInfo(line);\n }\n return runs.length;\n };\n\n if (options.watch === true) {\n for (;;) {\n await render();\n await new Promise((resolve) => setTimeout(resolve, 2000));\n }\n }\n\n await render();\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS;AAIX,IAAM,oBAAoB,EAAE,OAAO;AAAA,EACxC,eAAe,EAAE,QAAQ,CAAC;AAAA,EAC1B,MAAM,EAAE;AAAA,IACN,EAAE,OAAO;AAAA,MACP,WAAW,EAAE,OAAO;AAAA,MACpB,QAAQ,EAAE,OAAO;AAAA,MACjB,KAAK,EAAE,OAAO;AAAA,MACd,MAAM,EAAE,OAAO;AAAA,MACf,UAAU,EAAE,QAAQ;AAAA,MACpB,QAAQ,EAAE,KAAK,CAAC,WAAW,cAAc,QAAQ,CAAC;AAAA,MAClD,WAAW,EAAE,OAAO;AAAA,MACpB,iBAAiB,EAAE,OAAO;AAAA,MAC1B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,MAC3B,OAAO,EAAE,OAAO,EAAE,SAAS;AAAA,MAC3B,kBAAkB,EAAE,OAAO,EAAE,SAAS;AAAA,MACtC,cAAc,EAAE,OAAO,EAAE,SAAS;AAAA,MAClC,gBAAgB,EAAE,OAAO,EAAE,SAAS;AAAA,IACtC,CAAC;AAAA,EACH;AACF,CAAC;AAOM,SAAS,cAAc,MAAoC;AAChE,MAAI,KAAK,WAAW,EAAG,QAAO,CAAC,8CAA8C;AAE7E,QAAM,SAAS,IAAI,CAAC,UAAU,SAAS,SAAS,YAAY,WAAW,OAAO,SAAS,CAAC;AACxF,QAAM,OAAO,KAAK;AAAA,IAAI,CAAC,QACrB,IAAI;AAAA,MACF,IAAI;AAAA,MACJ,IAAI,UAAU,OAAO,IAAI,IAAI,KAAK,KAAK,IAAI;AAAA,MAC3C,IAAI,SAAS;AAAA,MACb,IAAI,iBAAiB,OAAO,GAAG,IAAI,oBAAoB,CAAC,IAAI,IAAI,YAAY,KAAK;AAAA,MACjF,IAAI,mBAAmB,OAAO,eAAe,IAAI,cAAc,IAAI;AAAA,MACnE,OAAO,IAAI,GAAG;AAAA,MACd,GAAG,IAAI,SAAS,GAAG,IAAI,WAAW,UAAU,EAAE;AAAA,IAChD,CAAC;AAAA,EACH;AACA,SAAO,CAAC,QAAQ,GAAG,IAAI;AACzB;AAEA,SAAS,IAAI,OAAyB;AACpC,QAAM,SAAS,CAAC,IAAI,IAAI,IAAI,IAAI,IAAI,GAAG,EAAE;AACzC,SAAO,MAAM,IAAI,CAAC,MAAM,MAAM,KAAK,OAAO,OAAO,CAAC,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG;AACtE;AAEA,eAAsB,MAAM,UAAqB,CAAC,GAAoB;AACpE,QAAM,SAAS,YAAY;AACzB,UAAM,OAAO,MAAM,aAAa;AAChC,QAAI,QAAQ,SAAS,MAAM;AACzB,YAAM,UAAU,kBAAkB,MAAM;AAAA,QACtC,eAAe;AAAA,QACf,MAAM,KAAK,IAAI,CAAC,EAAE,UAAU,WAAW,GAAG,KAAK,MAAM,IAAI;AAAA,MAC3D,CAAC;AACD,gBAAU,KAAK,UAAU,SAAS,MAAM,CAAC,CAAC;AAC1C,aAAO,KAAK;AAAA,IACd;AACA,eAAW,QAAQ,cAAc,IAAI,GAAG;AACtC,gBAAU,IAAI;AAAA,IAChB;AACA,WAAO,KAAK;AAAA,EACd;AAEA,MAAI,QAAQ,UAAU,MAAM;AAC1B,eAAS;AACP,YAAM,OAAO;AACb,YAAM,IAAI,QAAQ,CAAC,YAAY,WAAW,SAAS,GAAI,CAAC;AAAA,IAC1D;AAAA,EACF;AAEA,QAAM,OAAO;AACb,SAAO;AACT;","names":[]}
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ attachVerdict,
4
+ beginExecution,
5
+ bindTelemetry,
6
+ discardedExecutionCount,
7
+ endExecution,
8
+ getTelemetryContext,
9
+ recordInvocation,
10
+ resetTelemetryState,
11
+ timingFromUsage,
12
+ usageFromClaude
13
+ } from "./chunk-6FDFRNXZ.js";
14
+ import "./chunk-P3LRUNC6.js";
15
+ import "./chunk-DIG5XKQQ.js";
16
+ import "./chunk-NEZZ6KDR.js";
17
+ import "./chunk-7Z4Y3VKM.js";
18
+ import "./chunk-XEYH6ZZI.js";
19
+ export {
20
+ attachVerdict,
21
+ beginExecution,
22
+ bindTelemetry,
23
+ discardedExecutionCount,
24
+ endExecution,
25
+ getTelemetryContext,
26
+ recordInvocation,
27
+ resetTelemetryState,
28
+ timingFromUsage,
29
+ usageFromClaude
30
+ };
31
+ //# sourceMappingURL=recorder-XGF55WXI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ classifyRunLock,
4
+ listLiveRuns
5
+ } from "./chunk-5TB6KLC2.js";
6
+ import "./chunk-SNTTOQAD.js";
7
+ import "./chunk-NEZZ6KDR.js";
8
+ import "./chunk-TX5WIVYP.js";
9
+ import "./chunk-KQHB7ZT3.js";
10
+ import "./chunk-XEYH6ZZI.js";
11
+ export {
12
+ classifyRunLock,
13
+ listLiveRuns
14
+ };
15
+ //# sourceMappingURL=registry-LGPE53QD.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -1,52 +1,69 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runPipeline
4
- } from "./chunk-NTMMF5UD.js";
5
- import "./chunk-FJP3UQGD.js";
6
- import "./chunk-FADTCQGM.js";
7
- import "./chunk-A4SLHOW7.js";
8
- import "./chunk-M5UCXTIT.js";
9
- import "./chunk-XQUSIEKA.js";
4
+ } from "./chunk-OPNGPUKJ.js";
5
+ import "./chunk-37N2RJW2.js";
6
+ import "./chunk-QXDNBYQF.js";
10
7
  import {
11
8
  PIPELINE_PHASES,
12
9
  PipelineManager,
13
10
  loadExecutionPlan,
14
- nextQueueIssue,
15
- parseJournal
16
- } from "./chunk-56KS3TFQ.js";
17
- import {
18
- acquireRunLock,
19
- describeRunLockOwner
20
- } from "./chunk-BAUPQXPE.js";
21
- import "./chunk-NS6R37II.js";
22
- import "./chunk-3QHK4YQA.js";
23
- import "./chunk-TSOLWK7Y.js";
24
- import "./chunk-QCPGHBSZ.js";
25
- import "./chunk-Y5ZDJ4PJ.js";
26
- import "./chunk-73ATPIYX.js";
27
- import "./chunk-4JSOYE4G.js";
11
+ nextQueueIssue
12
+ } from "./chunk-7KD66LIM.js";
13
+ import "./chunk-BHJCGWQX.js";
14
+ import "./chunk-LZ6GFQAG.js";
15
+ import "./chunk-IHIEXUTC.js";
16
+ import "./chunk-BQDQTIM7.js";
17
+ import "./chunk-HEF2RMKN.js";
18
+ import "./chunk-CRGIQFUQ.js";
19
+ import "./chunk-TM67EHSV.js";
20
+ import "./chunk-PIVGJM6K.js";
21
+ import "./chunk-UJ7XWK7J.js";
22
+ import "./chunk-J62QSVP6.js";
23
+ import "./chunk-HJGGNLWI.js";
24
+ import "./chunk-IV5SS4JN.js";
25
+ import "./chunk-FZDR7CGH.js";
26
+ import "./chunk-PV4OX5TC.js";
28
27
  import "./chunk-KMMASOA6.js";
29
- import "./chunk-LWRSMTTZ.js";
30
- import "./chunk-MJULIKQU.js";
31
- import "./chunk-LAFNLLQP.js";
32
- import "./chunk-M66SJHQQ.js";
33
- import "./chunk-EZATO3DW.js";
34
- import "./chunk-42PJFMAR.js";
28
+ import "./chunk-664Y3NDX.js";
29
+ import "./chunk-MIVHK5YI.js";
30
+ import "./chunk-ARFVHC2F.js";
31
+ import "./chunk-3XLCNVMD.js";
32
+ import {
33
+ parseJournal
34
+ } from "./chunk-QCXPNSEL.js";
35
+ import "./chunk-3D4A4B46.js";
36
+ import "./chunk-UOCPC2Y2.js";
37
+ import "./chunk-CNBYCMSU.js";
35
38
  import {
36
- QUEUES_DIR_NAME,
37
- describePreflight,
38
- getIssuePaths,
39
- preflightRepository,
40
39
  resolveProjectPaths
41
- } from "./chunk-DIDUVL6O.js";
40
+ } from "./chunk-HQAHNIAR.js";
42
41
  import {
43
42
  printError,
44
43
  printInfo,
45
44
  printWarning
46
- } from "./chunk-BYZDPR7N.js";
45
+ } from "./chunk-IYV6KNVF.js";
46
+ import "./chunk-6FDFRNXZ.js";
47
+ import "./chunk-P3LRUNC6.js";
47
48
  import {
48
49
  loadTaskPlan
49
- } from "./chunk-CD5ULRVC.js";
50
+ } from "./chunk-DIG5XKQQ.js";
51
+ import {
52
+ acquireRunLock,
53
+ describeRunLockOwner
54
+ } from "./chunk-NEZZ6KDR.js";
55
+ import "./chunk-L6HSKTQE.js";
56
+ import "./chunk-TVN2JVOF.js";
57
+ import {
58
+ QUEUES_DIR_NAME,
59
+ getIssuePaths
60
+ } from "./chunk-TX5WIVYP.js";
61
+ import {
62
+ describePreflight,
63
+ preflightRepository
64
+ } from "./chunk-KQHB7ZT3.js";
65
+ import "./chunk-7Z4Y3VKM.js";
66
+ import "./chunk-XEYH6ZZI.js";
50
67
 
51
68
  // src/commands/resume.ts
52
69
  import { readdir, readFile } from "fs/promises";
@@ -218,4 +235,4 @@ async function loadTarget(projectId, issue) {
218
235
  export {
219
236
  runResume
220
237
  };
221
- //# sourceMappingURL=resume-PPCNQVVV.js.map
238
+ //# sourceMappingURL=resume-QMEPMSZW.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/commands/resume.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { parseJournal } from '../core/journal.js';\nimport { PIPELINE_PHASES, PipelineManager, type PipelinePhase } from '../core/pipeline.js';\nimport { loadTaskPlan } from '../core/state-manager.js';\nimport { loadExecutionPlan, nextQueueIssue } from '../execution/plan.js';\nimport { acquireRunLock, describeRunLockOwner, type RunLockHandle } from '../storage/lock.js';\nimport { getIssuePaths, QUEUES_DIR_NAME } from '../storage/paths.js';\nimport { resolveProjectPaths } from '../storage/resolve.js';\nimport type { TaskPlan } from '../types.js';\nimport { printError, printInfo, printWarning } from '../ui/logger.js';\nimport { describePreflight, preflightRepository } from '../utils/git.js';\nimport { runPipeline } from './run.js';\n\n/**\n * `issue-flow resume` — explicit recovery.\n *\n * Resumption already worked before this command existed, but only *implicitly*:\n * the user re-ran the same `run` and the pipeline happened to pick up where it\n * left off, because `PipelineManager` skips the phases already marked complete\n * and `nextQueueIssue()` treats a stale `in_progress` as \"do this one first\".\n * That is a coincidence of two mechanisms, not a contract — nothing said what\n * had been interrupted, nothing checked whether the repository was still in a\n * state to continue, and nothing distinguished \"carry on\" from \"start over\".\n *\n * This command makes each of those steps explicit, in this order:\n *\n * 1. **ownership** — a live owner refuses, a dead one is taken over;\n * 2. **plans** — `execution-plan.json` for a queue, `tasks.json` for an issue;\n * 3. **the journal** — the last `phase:start` with no `phase:end` is what was\n * running when the process died, which is the one fact no snapshot keeps;\n * 4. **the preflight** — the repository is described, and a state a human has to\n * settle stops the resume instead of being repaired;\n * 5. **the phase** — `PipelineManager.getNextPhase()`, the same answer `run`\n * has always used, now stated out loud before anything runs.\n *\n * `run` is untouched: its auto-resume still works exactly as it did.\n */\n\nexport interface ResumeOptions {\n /** Resume every unfinished issue of the project, not just one. */\n all?: boolean;\n /** Execution mode handed to the pipeline. Same values as `run`. */\n mode?: string;\n}\n\ninterface ResumeTarget {\n issue: string;\n plan: TaskPlan;\n tasksFile: string;\n eventsFile: string;\n rotatedEventsFile: string;\n}\n\nexport async function runResume(issue?: string, options: ResumeOptions = {}): Promise<number> {\n const mode = options.mode ?? 'auto';\n\n let project: Awaited<ReturnType<typeof resolveProjectPaths>>;\n try {\n project = await resolveProjectPaths();\n } catch (err) {\n printError(`Cannot resume: ${err instanceof Error ? err.message : String(err)}`);\n return 1;\n }\n\n // 1. Ownership, before reading anything else: a resume that runs beside a\n // live owner is the collision this whole layer exists to prevent.\n const acquisition = await acquireRunLock(project.runLockFile, { target: issue ?? 'resume' });\n if (!acquisition.ok) {\n printError(\n `Another issue-flow run owns this project: ${describeRunLockOwner(acquisition.owner)}.`,\n );\n printInfo('Wait for it to finish, or stop that process before resuming.');\n return 1;\n }\n const handle: RunLockHandle = acquisition.handle;\n if (handle.reclaimedFrom !== null) {\n printWarning(\n `Taking over an interrupted run: ${describeRunLockOwner(handle.reclaimedFrom)}. Its lock was stale.`,\n );\n }\n\n try {\n // 2. What is there to resume.\n const targets = await findTargets(project, issue, options.all === true);\n if (targets.length === 0) {\n printInfo(\n issue === undefined\n ? 'Nothing to resume: no issue in this project has an unfinished pipeline.'\n : `Nothing to resume: issue #${issue} has no task plan in this project.`,\n );\n return 0;\n }\n\n for (const target of targets) {\n const code = await resumeOne(target, mode);\n if (code !== 0) return code;\n }\n return 0;\n } finally {\n await handle.release();\n }\n}\n\nasync function resumeOne(target: ResumeTarget, mode: string): Promise<number> {\n const phases = activePhases(target.plan);\n const manager = new PipelineManager(target.plan, target.tasksFile, phases);\n const next = manager.getNextPhase();\n\n if (next === null) {\n printInfo(`Issue #${target.issue} has every phase complete; nothing to resume.`);\n return 0;\n }\n\n // 3. What was running when the process died. The snapshot cannot answer this\n // — it only knows the phase failed or never ended — so the journal does.\n const interrupted = await lastUnfinishedPhase(target);\n if (interrupted !== null) {\n printInfo(`Issue #${target.issue} was interrupted during the '${interrupted}' phase.`);\n }\n\n // 4. The repository, described and never repaired. Continuing the very phase\n // that was interrupted is the one case where uncommitted work is expected;\n // anything else would be carrying changes into work they do not belong to.\n const sameWork = interrupted === next;\n const preflight = await preflightRepository({\n expectedBranch: target.plan.noBranch === true ? null : target.plan.branchName,\n intent: sameWork ? 'resume-same-phase' : 'new-phase',\n });\n if (!preflight.ok) {\n printError(`Cannot resume issue #${target.issue}: the repository needs attention first.`);\n for (const line of describePreflight(preflight)) {\n printError(line);\n }\n return 1;\n }\n\n // 5. The phase, stated before anything runs.\n printInfo(`Resuming issue #${target.issue} from the '${next}' phase.`);\n return runPipeline(target.issue, mode, next, undefined, undefined, { only: true });\n}\n\n/** The phase set this plan's pipeline actually has, so `pr-review` is honoured. */\nfunction activePhases(plan: TaskPlan): readonly PipelinePhase[] {\n const base =\n plan.noBranch === true\n ? PIPELINE_PHASES.filter((phase) => phase !== 'pr')\n : [...PIPELINE_PHASES];\n return plan.prReview?.enabled === true ? [...base, 'pr-review'] : base;\n}\n\n/**\n * The phase the journal shows as started and never ended.\n *\n * Both generations are read, oldest first, because a run long enough to rotate\n * its journal is exactly the kind that gets interrupted. A missing or\n * unreadable journal answers `null`: the resume continues from the plan, which\n * is what it did before a journal existed.\n */\nasync function lastUnfinishedPhase(target: ResumeTarget): Promise<string | null> {\n const content = `${await readIfPresent(target.rotatedEventsFile)}${await readIfPresent(target.eventsFile)}`;\n if (content === '') return null;\n\n const open: string[] = [];\n for (const entry of parseJournal(content)) {\n const event = entry.event;\n if (event.type === 'phase:start') {\n open.push(event.phase);\n } else if (event.type === 'phase:end') {\n const index = open.lastIndexOf(event.phase);\n if (index >= 0) open.splice(index, 1);\n }\n }\n return open.at(-1) ?? null;\n}\n\nasync function readIfPresent(path: string): Promise<string> {\n try {\n return await readFile(path, 'utf-8');\n } catch {\n return '';\n }\n}\n\n/**\n * Which issues to resume.\n *\n * A named issue is taken at its word. Without one, the queue decides when there\n * is a queue — `nextQueueIssue()` is already the project's answer to \"which one\n * first\" — and otherwise the unfinished issues are ordered by when they were\n * last attempted, so `resume` alone picks up the most recent work.\n */\nasync function findTargets(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n issue: string | undefined,\n all: boolean,\n): Promise<ResumeTarget[]> {\n if (issue !== undefined) {\n const target = await loadTarget(project.projectId, issue);\n return target === null ? [] : [target];\n }\n\n const queued = await queueTarget(project);\n if (queued !== null && !all) return [queued];\n\n const unfinished = await unfinishedTargets(project);\n if (all) return unfinished;\n return unfinished.slice(0, 1);\n}\n\n/** The issue a queue would hand out next, when this project has a queue. */\nasync function queueTarget(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n): Promise<ResumeTarget | null> {\n const queuesDir = join(project.projectDir, QUEUES_DIR_NAME);\n let entries: string[];\n try {\n entries = await readdir(queuesDir);\n } catch {\n return null;\n }\n\n for (const entry of entries) {\n const plan = await loadExecutionPlan(join(queuesDir, entry, 'execution-plan.json'));\n if (plan === null) continue;\n const next = nextQueueIssue(plan);\n if (next === null) continue;\n const target = await loadTarget(project.projectId, next.id);\n if (target !== null) return target;\n }\n return null;\n}\n\n/** Every issue whose plan is not finished, most recently attempted first. */\nasync function unfinishedTargets(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n): Promise<ResumeTarget[]> {\n let ids: string[];\n try {\n ids = await readdir(project.issuesDir);\n } catch {\n return [];\n }\n\n const targets: ResumeTarget[] = [];\n for (const id of ids) {\n const target = await loadTarget(project.projectId, id);\n if (target === null) continue;\n if (target.plan.issueStatus === 'completed') continue;\n const manager = new PipelineManager(target.plan, target.tasksFile, activePhases(target.plan));\n if (manager.getNextPhase() === null) continue;\n targets.push(target);\n }\n\n return targets.sort((a, b) => attemptedAt(b.plan) - attemptedAt(a.plan));\n}\n\nfunction attemptedAt(plan: TaskPlan): number {\n const at = Date.parse(plan.lastAttemptAt ?? '');\n return Number.isNaN(at) ? 0 : at;\n}\n\nasync function loadTarget(projectId: string, issue: string): Promise<ResumeTarget | null> {\n let paths: ReturnType<typeof getIssuePaths>;\n try {\n paths = getIssuePaths(projectId, issue);\n } catch {\n // Not a usable issue identifier — a stray file in `issues/`, for instance.\n return null;\n }\n\n try {\n const plan = await loadTaskPlan(paths.tasksFile);\n return {\n issue,\n plan,\n tasksFile: paths.tasksFile,\n eventsFile: paths.eventsFile,\n rotatedEventsFile: paths.rotatedEventsFile,\n };\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY;AAqDrB,eAAsB,UAAU,OAAgB,UAAyB,CAAC,GAAoB;AAC5F,QAAM,OAAO,QAAQ,QAAQ;AAE7B,MAAI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a,OAAO,IAAI,CAAC;AAC5F,QAAI,QAAQ,aAAa,MAAM,KAAM;AACrC,YAAQ,KAAK,MAAM;AAAA,EACrB;AAEA,SAAO,QAAQ,KAAK,CAAC,GAAG,MAAM,YAAY,EAAE,IAAI,IAAI,YAAY,EAAE,IAAI,CAAC;AACzE;AAEA,SAAS,YAAY,MAAwB;AAC3C,QAAM,KAAK,KAAK,MAAM,KAAK,iBAAiB,EAAE;AAC9C,SAAO,OAAO,MAAM,EAAE,IAAI,IAAI;AAChC;AAEA,eAAe,WAAW,WAAmB,OAA6C;AACxF,MAAI;AACJ,MAAI;AACF,YAAQ,cAAc,WAAW,KAAK;AAAA,EACxC,QAAQ;AAEN,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,OAAO,MAAM,aAAa,MAAM,SAAS;AAC/C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,WAAW,MAAM;AAAA,MACjB,YAAY,MAAM;AAAA,MAClB,mBAAmB,MAAM;AAAA,IAC3B;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/commands/resume.ts"],"sourcesContent":["import { readdir, readFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { parseJournal } from '../core/journal.js';\nimport { PIPELINE_PHASES, PipelineManager, type PipelinePhase } from '../core/pipeline.js';\nimport { loadTaskPlan } from '../core/state-manager.js';\nimport { loadExecutionPlan, nextQueueIssue } from '../execution/plan.js';\nimport { acquireRunLock, describeRunLockOwner, type RunLockHandle } from '../storage/lock.js';\nimport { getIssuePaths, QUEUES_DIR_NAME } from '../storage/paths.js';\nimport { resolveProjectPaths } from '../storage/resolve.js';\nimport type { TaskPlan } from '../types.js';\nimport { printError, printInfo, printWarning } from '../ui/logger.js';\nimport { describePreflight, preflightRepository } from '../utils/git.js';\nimport { runPipeline } from './run.js';\n\n/**\n * `issue-flow resume` — explicit recovery.\n *\n * Resumption already worked before this command existed, but only *implicitly*:\n * the user re-ran the same `run` and the pipeline happened to pick up where it\n * left off, because `PipelineManager` skips the phases already marked complete\n * and `nextQueueIssue()` treats a stale `in_progress` as \"do this one first\".\n * That is a coincidence of two mechanisms, not a contract — nothing said what\n * had been interrupted, nothing checked whether the repository was still in a\n * state to continue, and nothing distinguished \"carry on\" from \"start over\".\n *\n * This command makes each of those steps explicit, in this order:\n *\n * 1. **ownership** — a live owner refuses, a dead one is taken over;\n * 2. **plans** — `execution-plan.json` for a queue, `tasks.json` for an issue;\n * 3. **the journal** — the last `phase:start` with no `phase:end` is what was\n * running when the process died, which is the one fact no snapshot keeps;\n * 4. **the preflight** — the repository is described, and a state a human has to\n * settle stops the resume instead of being repaired;\n * 5. **the phase** — `PipelineManager.getNextPhase()`, the same answer `run`\n * has always used, now stated out loud before anything runs.\n *\n * `run` is untouched: its auto-resume still works exactly as it did.\n */\n\nexport interface ResumeOptions {\n /** Resume every unfinished issue of the project, not just one. */\n all?: boolean;\n /** Execution mode handed to the pipeline. Same values as `run`. */\n mode?: string;\n}\n\ninterface ResumeTarget {\n issue: string;\n plan: TaskPlan;\n tasksFile: string;\n eventsFile: string;\n rotatedEventsFile: string;\n}\n\nexport async function runResume(issue?: string, options: ResumeOptions = {}): Promise<number> {\n const mode = options.mode ?? 'auto';\n\n let project: Awaited<ReturnType<typeof resolveProjectPaths>>;\n try {\n project = await resolveProjectPaths();\n } catch (err) {\n printError(`Cannot resume: ${err instanceof Error ? err.message : String(err)}`);\n return 1;\n }\n\n // 1. Ownership, before reading anything else: a resume that runs beside a\n // live owner is the collision this whole layer exists to prevent.\n const acquisition = await acquireRunLock(project.runLockFile, { target: issue ?? 'resume' });\n if (!acquisition.ok) {\n printError(\n `Another issue-flow run owns this project: ${describeRunLockOwner(acquisition.owner)}.`,\n );\n printInfo('Wait for it to finish, or stop that process before resuming.');\n return 1;\n }\n const handle: RunLockHandle = acquisition.handle;\n if (handle.reclaimedFrom !== null) {\n printWarning(\n `Taking over an interrupted run: ${describeRunLockOwner(handle.reclaimedFrom)}. Its lock was stale.`,\n );\n }\n\n try {\n // 2. What is there to resume.\n const targets = await findTargets(project, issue, options.all === true);\n if (targets.length === 0) {\n printInfo(\n issue === undefined\n ? 'Nothing to resume: no issue in this project has an unfinished pipeline.'\n : `Nothing to resume: issue #${issue} has no task plan in this project.`,\n );\n return 0;\n }\n\n for (const target of targets) {\n const code = await resumeOne(target, mode);\n if (code !== 0) return code;\n }\n return 0;\n } finally {\n await handle.release();\n }\n}\n\nasync function resumeOne(target: ResumeTarget, mode: string): Promise<number> {\n const phases = activePhases(target.plan);\n const manager = new PipelineManager(target.plan, target.tasksFile, phases);\n const next = manager.getNextPhase();\n\n if (next === null) {\n printInfo(`Issue #${target.issue} has every phase complete; nothing to resume.`);\n return 0;\n }\n\n // 3. What was running when the process died. The snapshot cannot answer this\n // — it only knows the phase failed or never ended — so the journal does.\n const interrupted = await lastUnfinishedPhase(target);\n if (interrupted !== null) {\n printInfo(`Issue #${target.issue} was interrupted during the '${interrupted}' phase.`);\n }\n\n // 4. The repository, described and never repaired. Continuing the very phase\n // that was interrupted is the one case where uncommitted work is expected;\n // anything else would be carrying changes into work they do not belong to.\n const sameWork = interrupted === next;\n const preflight = await preflightRepository({\n expectedBranch: target.plan.noBranch === true ? null : target.plan.branchName,\n intent: sameWork ? 'resume-same-phase' : 'new-phase',\n });\n if (!preflight.ok) {\n printError(`Cannot resume issue #${target.issue}: the repository needs attention first.`);\n for (const line of describePreflight(preflight)) {\n printError(line);\n }\n return 1;\n }\n\n // 5. The phase, stated before anything runs.\n printInfo(`Resuming issue #${target.issue} from the '${next}' phase.`);\n return runPipeline(target.issue, mode, next, undefined, undefined, { only: true });\n}\n\n/** The phase set this plan's pipeline actually has, so `pr-review` is honoured. */\nfunction activePhases(plan: TaskPlan): readonly PipelinePhase[] {\n const base =\n plan.noBranch === true\n ? PIPELINE_PHASES.filter((phase) => phase !== 'pr')\n : [...PIPELINE_PHASES];\n return plan.prReview?.enabled === true ? [...base, 'pr-review'] : base;\n}\n\n/**\n * The phase the journal shows as started and never ended.\n *\n * Both generations are read, oldest first, because a run long enough to rotate\n * its journal is exactly the kind that gets interrupted. A missing or\n * unreadable journal answers `null`: the resume continues from the plan, which\n * is what it did before a journal existed.\n */\nasync function lastUnfinishedPhase(target: ResumeTarget): Promise<string | null> {\n const content = `${await readIfPresent(target.rotatedEventsFile)}${await readIfPresent(target.eventsFile)}`;\n if (content === '') return null;\n\n const open: string[] = [];\n for (const entry of parseJournal(content)) {\n const event = entry.event;\n if (event.type === 'phase:start') {\n open.push(event.phase);\n } else if (event.type === 'phase:end') {\n const index = open.lastIndexOf(event.phase);\n if (index >= 0) open.splice(index, 1);\n }\n }\n return open.at(-1) ?? null;\n}\n\nasync function readIfPresent(path: string): Promise<string> {\n try {\n return await readFile(path, 'utf-8');\n } catch {\n return '';\n }\n}\n\n/**\n * Which issues to resume.\n *\n * A named issue is taken at its word. Without one, the queue decides when there\n * is a queue — `nextQueueIssue()` is already the project's answer to \"which one\n * first\" — and otherwise the unfinished issues are ordered by when they were\n * last attempted, so `resume` alone picks up the most recent work.\n */\nasync function findTargets(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n issue: string | undefined,\n all: boolean,\n): Promise<ResumeTarget[]> {\n if (issue !== undefined) {\n const target = await loadTarget(project.projectId, issue);\n return target === null ? [] : [target];\n }\n\n const queued = await queueTarget(project);\n if (queued !== null && !all) return [queued];\n\n const unfinished = await unfinishedTargets(project);\n if (all) return unfinished;\n return unfinished.slice(0, 1);\n}\n\n/** The issue a queue would hand out next, when this project has a queue. */\nasync function queueTarget(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n): Promise<ResumeTarget | null> {\n const queuesDir = join(project.projectDir, QUEUES_DIR_NAME);\n let entries: string[];\n try {\n entries = await readdir(queuesDir);\n } catch {\n return null;\n }\n\n for (const entry of entries) {\n const plan = await loadExecutionPlan(join(queuesDir, entry, 'execution-plan.json'));\n if (plan === null) continue;\n const next = nextQueueIssue(plan);\n if (next === null) continue;\n const target = await loadTarget(project.projectId, next.id);\n if (target !== null) return target;\n }\n return null;\n}\n\n/** Every issue whose plan is not finished, most recently attempted first. */\nasync function unfinishedTargets(\n project: Awaited<ReturnType<typeof resolveProjectPaths>>,\n): Promise<ResumeTarget[]> {\n let ids: string[];\n try {\n ids = await readdir(project.issuesDir);\n } catch {\n return [];\n }\n\n const targets: ResumeTarget[] = [];\n for (const id of ids) {\n const target = await loadTarget(project.projectId, id);\n if (target === null) continue;\n if (target.plan.issueStatus === 'completed') continue;\n const manager = new PipelineManager(target.plan, target.tasksFile, activePhases(target.plan));\n if (manager.getNextPhase() === null) continue;\n targets.push(target);\n }\n\n return targets.sort((a, b) => attemptedAt(b.plan) - attemptedAt(a.plan));\n}\n\nfunction attemptedAt(plan: TaskPlan): number {\n const at = Date.parse(plan.lastAttemptAt ?? '');\n return Number.isNaN(at) ? 0 : at;\n}\n\nasync function loadTarget(projectId: string, issue: string): Promise<ResumeTarget | null> {\n let paths: ReturnType<typeof getIssuePaths>;\n try {\n paths = getIssuePaths(projectId, issue);\n } catch {\n // Not a usable issue identifier — a stray file in `issues/`, for instance.\n return null;\n }\n\n try {\n const plan = await loadTaskPlan(paths.tasksFile);\n return {\n issue,\n plan,\n tasksFile: paths.tasksFile,\n eventsFile: paths.eventsFile,\n rotatedEventsFile: paths.rotatedEventsFile,\n };\n } catch {\n return null;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,SAAS,gBAAgB;AAClC,SAAS,YAAY;AAqDrB,eAAsB,UAAU,OAAgB,UAAyB,CAAC,GAAoB;AAC5F,QAAM,OAAO,QAAQ,QAAQ;AAE7B,MAAI;AACJ,MAAI;AACF,cAAU,MAAM,oBAAoB;AAAA,EACtC,SAAS,KAAK;AACZ,eAAW,kBAAkB,eAAe,QAAQ,IAAI,UAAU,OAAO,GAAG,CAAC,EAAE;A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MAAM,YAAY,EAAE,IAAI,IAAI,YAAY,EAAE,IAAI,CAAC;AACzE;AAEA,SAAS,YAAY,MAAwB;AAC3C,QAAM,KAAK,KAAK,MAAM,KAAK,iBAAiB,EAAE;AAC9C,SAAO,OAAO,MAAM,EAAE,IAAI,IAAI;AAChC;AAEA,eAAe,WAAW,WAAmB,OAA6C;AACxF,MAAI;AACJ,MAAI;AACF,YAAQ,cAAc,WAAW,KAAK;AAAA,EACxC,QAAQ;AAEN,WAAO;AAAA,EACT;AAEA,MAAI;AACF,UAAM,OAAO,MAAM,aAAa,MAAM,SAAS;AAC/C,WAAO;AAAA,MACL;AAAA,MACA;AAAA,MACA,WAAW,MAAM;AAAA,MACjB,YAAY,MAAM;AAAA,MAClB,mBAAmB,MAAM;AAAA,IAC3B;AAAA,EACF,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ runReview
4
+ } from "./chunk-QXDNBYQF.js";
5
+ import "./chunk-BQDQTIM7.js";
6
+ import "./chunk-HEF2RMKN.js";
7
+ import "./chunk-FZDR7CGH.js";
8
+ import "./chunk-PV4OX5TC.js";
9
+ import "./chunk-KMMASOA6.js";
10
+ import "./chunk-664Y3NDX.js";
11
+ import "./chunk-MIVHK5YI.js";
12
+ import "./chunk-ARFVHC2F.js";
13
+ import "./chunk-3XLCNVMD.js";
14
+ import "./chunk-QCXPNSEL.js";
15
+ import "./chunk-UOCPC2Y2.js";
16
+ import "./chunk-CNBYCMSU.js";
17
+ import "./chunk-HQAHNIAR.js";
18
+ import "./chunk-IYV6KNVF.js";
19
+ import "./chunk-6FDFRNXZ.js";
20
+ import "./chunk-P3LRUNC6.js";
21
+ import "./chunk-DIG5XKQQ.js";
22
+ import "./chunk-NEZZ6KDR.js";
23
+ import "./chunk-L6HSKTQE.js";
24
+ import "./chunk-TVN2JVOF.js";
25
+ import "./chunk-TX5WIVYP.js";
26
+ import "./chunk-KQHB7ZT3.js";
27
+ import "./chunk-7Z4Y3VKM.js";
28
+ import "./chunk-XEYH6ZZI.js";
29
+ export {
30
+ runReview
31
+ };
32
+ //# sourceMappingURL=review-YKWD6SNN.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,91 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ PRIORS_VERSION,
4
+ decideRouting
5
+ } from "./chunk-3XLCNVMD.js";
6
+ import {
7
+ loadRoutingConfig
8
+ } from "./chunk-CNBYCMSU.js";
9
+ import {
10
+ resolveIssuePaths
11
+ } from "./chunk-HQAHNIAR.js";
12
+ import {
13
+ printInfo
14
+ } from "./chunk-IYV6KNVF.js";
15
+ import "./chunk-6FDFRNXZ.js";
16
+ import "./chunk-P3LRUNC6.js";
17
+ import {
18
+ loadTaskPlan
19
+ } from "./chunk-DIG5XKQQ.js";
20
+ import "./chunk-NEZZ6KDR.js";
21
+ import "./chunk-TX5WIVYP.js";
22
+ import "./chunk-KQHB7ZT3.js";
23
+ import "./chunk-7Z4Y3VKM.js";
24
+ import "./chunk-XEYH6ZZI.js";
25
+
26
+ // src/commands/routing.ts
27
+ var ROUTING_COMMAND_SCHEMA_VERSION = 1;
28
+ async function runRoutingInspect(options) {
29
+ const config = await loadRoutingConfig();
30
+ const sample = decideRouting({
31
+ phase: "execute",
32
+ actualHarness: "claude-code",
33
+ mode: config.mode,
34
+ profile: config.profile
35
+ });
36
+ if (options.json === true) {
37
+ console.log(
38
+ JSON.stringify(
39
+ {
40
+ schemaVersion: ROUTING_COMMAND_SCHEMA_VERSION,
41
+ priorsVersion: PRIORS_VERSION,
42
+ config,
43
+ sample
44
+ },
45
+ null,
46
+ 2
47
+ )
48
+ );
49
+ return 0;
50
+ }
51
+ printInfo(`routing.mode: ${config.mode} (default shadow \u2014 records, does not act)`);
52
+ printInfo(`routing.profile: ${config.profile}`);
53
+ if (sample) {
54
+ printInfo(
55
+ `sample selected=${sample.selected} actual=${sample.actual} class=${sample.taskClass}`
56
+ );
57
+ }
58
+ return 0;
59
+ }
60
+ async function runRoutingReport(options) {
61
+ if (options.issue === void 0) {
62
+ printInfo("Pass --issue N to compare selected vs actual on that plan.");
63
+ return 0;
64
+ }
65
+ const paths = await resolveIssuePaths(options.issue);
66
+ const plan = await loadTaskPlan(paths.tasksFile);
67
+ const records = plan.executions ?? [];
68
+ let agree = 0;
69
+ let total = 0;
70
+ for (const record of records) {
71
+ const decision = record.routingDecision;
72
+ if (decision === void 0 || decision === null) continue;
73
+ total += 1;
74
+ if (decision.selected === decision.actual) agree += 1;
75
+ }
76
+ const rate = total === 0 ? 0 : agree / total;
77
+ if (options.json === true) {
78
+ console.log(
79
+ JSON.stringify({ schemaVersion: ROUTING_COMMAND_SCHEMA_VERSION, total, agree, rate })
80
+ );
81
+ return 0;
82
+ }
83
+ printInfo(`shadow agreement: ${agree}/${total} (${(rate * 100).toFixed(0)}%)`);
84
+ return 0;
85
+ }
86
+ export {
87
+ ROUTING_COMMAND_SCHEMA_VERSION,
88
+ runRoutingInspect,
89
+ runRoutingReport
90
+ };
91
+ //# sourceMappingURL=routing-2ZUMZPJB.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/routing.ts"],"sourcesContent":["import { loadRoutingConfig } from '../config.js';\nimport { loadTaskPlan } from '../core/state-manager.js';\nimport { decideRouting } from '../routing/decide.js';\nimport { PRIORS_VERSION } from '../routing/priors.js';\nimport { resolveIssuePaths } from '../storage/resolve.js';\nimport { printInfo } from '../ui/logger.js';\n\nexport const ROUTING_COMMAND_SCHEMA_VERSION = 1;\n\nexport async function runRoutingInspect(options: { json?: boolean }): Promise<number> {\n const config = await loadRoutingConfig();\n const sample = decideRouting({\n phase: 'execute',\n actualHarness: 'claude-code',\n mode: config.mode,\n profile: config.profile,\n });\n if (options.json === true) {\n console.log(\n JSON.stringify(\n {\n schemaVersion: ROUTING_COMMAND_SCHEMA_VERSION,\n priorsVersion: PRIORS_VERSION,\n config,\n sample,\n },\n null,\n 2,\n ),\n );\n return 0;\n }\n printInfo(`routing.mode: ${config.mode} (default shadow — records, does not act)`);\n printInfo(`routing.profile: ${config.profile}`);\n if (sample) {\n printInfo(\n `sample selected=${sample.selected} actual=${sample.actual} class=${sample.taskClass}`,\n );\n }\n return 0;\n}\n\nexport async function runRoutingReport(options: {\n issue?: string;\n json?: boolean;\n}): Promise<number> {\n if (options.issue === undefined) {\n printInfo('Pass --issue N to compare selected vs actual on that plan.');\n return 0;\n }\n const paths = await resolveIssuePaths(options.issue);\n const plan = await loadTaskPlan(paths.tasksFile);\n const records = plan.executions ?? [];\n let agree = 0;\n let total = 0;\n for (const record of records) {\n const decision = record.routingDecision;\n if (decision === undefined || decision === null) continue;\n total += 1;\n if (decision.selected === decision.actual) agree += 1;\n }\n const rate = total === 0 ? 0 : agree / total;\n if (options.json === true) {\n console.log(\n JSON.stringify({ schemaVersion: ROUTING_COMMAND_SCHEMA_VERSION, total, agree, rate }),\n );\n return 0;\n }\n printInfo(`shadow agreement: ${agree}/${total} (${(rate * 100).toFixed(0)}%)`);\n return 0;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,IAAM,iCAAiC;AAE9C,eAAsB,kBAAkB,SAA8C;AACpF,QAAM,SAAS,MAAM,kBAAkB;AACvC,QAAM,SAAS,cAAc;AAAA,IAC3B,OAAO;AAAA,IACP,eAAe;AAAA,IACf,MAAM,OAAO;AAAA,IACb,SAAS,OAAO;AAAA,EAClB,CAAC;AACD,MAAI,QAAQ,SAAS,MAAM;AACzB,YAAQ;AAAA,MACN,KAAK;AAAA,QACH;AAAA,UACE,eAAe;AAAA,UACf,eAAe;AAAA,UACf;AAAA,UACA;AAAA,QACF;AAAA,QACA;AAAA,QACA;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,YAAU,iBAAiB,OAAO,IAAI,gDAA2C;AACjF,YAAU,oBAAoB,OAAO,OAAO,EAAE;AAC9C,MAAI,QAAQ;AACV;AAAA,MACE,mBAAmB,OAAO,QAAQ,WAAW,OAAO,MAAM,UAAU,OAAO,SAAS;AAAA,IACtF;AAAA,EACF;AACA,SAAO;AACT;AAEA,eAAsB,iBAAiB,SAGnB;AAClB,MAAI,QAAQ,UAAU,QAAW;AAC/B,cAAU,4DAA4D;AACtE,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,MAAM,kBAAkB,QAAQ,KAAK;AACnD,QAAM,OAAO,MAAM,aAAa,MAAM,SAAS;AAC/C,QAAM,UAAU,KAAK,cAAc,CAAC;AACpC,MAAI,QAAQ;AACZ,MAAI,QAAQ;AACZ,aAAW,UAAU,SAAS;AAC5B,UAAM,WAAW,OAAO;AACxB,QAAI,aAAa,UAAa,aAAa,KAAM;AACjD,aAAS;AACT,QAAI,SAAS,aAAa,SAAS,OAAQ,UAAS;AAAA,EACtD;AACA,QAAM,OAAO,UAAU,IAAI,IAAI,QAAQ;AACvC,MAAI,QAAQ,SAAS,MAAM;AACzB,YAAQ;AAAA,MACN,KAAK,UAAU,EAAE,eAAe,gCAAgC,OAAO,OAAO,KAAK,CAAC;AAAA,IACtF;AACA,WAAO;AAAA,EACT;AACA,YAAU,qBAAqB,KAAK,IAAI,KAAK,MAAM,OAAO,KAAK,QAAQ,CAAC,CAAC,IAAI;AAC7E,SAAO;AACT;","names":[]}
@@ -0,0 +1,50 @@
1
+ #!/usr/bin/env node
2
+ import {
3
+ publishIssueDetails,
4
+ publishStorySeed,
5
+ runPipeline
6
+ } from "./chunk-OPNGPUKJ.js";
7
+ import "./chunk-37N2RJW2.js";
8
+ import "./chunk-QXDNBYQF.js";
9
+ import "./chunk-7KD66LIM.js";
10
+ import "./chunk-BHJCGWQX.js";
11
+ import "./chunk-LZ6GFQAG.js";
12
+ import "./chunk-IHIEXUTC.js";
13
+ import "./chunk-BQDQTIM7.js";
14
+ import "./chunk-HEF2RMKN.js";
15
+ import "./chunk-CRGIQFUQ.js";
16
+ import "./chunk-TM67EHSV.js";
17
+ import "./chunk-PIVGJM6K.js";
18
+ import "./chunk-UJ7XWK7J.js";
19
+ import "./chunk-J62QSVP6.js";
20
+ import "./chunk-HJGGNLWI.js";
21
+ import "./chunk-IV5SS4JN.js";
22
+ import "./chunk-FZDR7CGH.js";
23
+ import "./chunk-PV4OX5TC.js";
24
+ import "./chunk-KMMASOA6.js";
25
+ import "./chunk-664Y3NDX.js";
26
+ import "./chunk-MIVHK5YI.js";
27
+ import "./chunk-ARFVHC2F.js";
28
+ import "./chunk-3XLCNVMD.js";
29
+ import "./chunk-QCXPNSEL.js";
30
+ import "./chunk-3D4A4B46.js";
31
+ import "./chunk-UOCPC2Y2.js";
32
+ import "./chunk-CNBYCMSU.js";
33
+ import "./chunk-HQAHNIAR.js";
34
+ import "./chunk-IYV6KNVF.js";
35
+ import "./chunk-6FDFRNXZ.js";
36
+ import "./chunk-P3LRUNC6.js";
37
+ import "./chunk-DIG5XKQQ.js";
38
+ import "./chunk-NEZZ6KDR.js";
39
+ import "./chunk-L6HSKTQE.js";
40
+ import "./chunk-TVN2JVOF.js";
41
+ import "./chunk-TX5WIVYP.js";
42
+ import "./chunk-KQHB7ZT3.js";
43
+ import "./chunk-7Z4Y3VKM.js";
44
+ import "./chunk-XEYH6ZZI.js";
45
+ export {
46
+ publishIssueDetails,
47
+ publishStorySeed,
48
+ runPipeline
49
+ };
50
+ //# sourceMappingURL=run-YU4TR62R.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -14,7 +14,9 @@ import {
14
14
  selectActiveStory,
15
15
  setLastError,
16
16
  trimErrorMessage
17
- } from "./chunk-CD5ULRVC.js";
17
+ } from "./chunk-DIG5XKQQ.js";
18
+ import "./chunk-NEZZ6KDR.js";
19
+ import "./chunk-7Z4Y3VKM.js";
18
20
  export {
19
21
  allStoriesPass,
20
22
  applyStoryMetrics,
@@ -31,4 +33,4 @@ export {
31
33
  setLastError,
32
34
  trimErrorMessage
33
35
  };
34
- //# sourceMappingURL=state-manager-2EDVDBAR.js.map
36
+ //# sourceMappingURL=state-manager-X3PT3FGT.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}