issue-flow 0.17.0 → 0.18.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 (110) hide show
  1. package/dist/{agent-TB6W7PT7.js → agent-HMZTXCRT.js} +5 -5
  2. package/dist/{analyze-6M3KEOX7.js → analyze-Q4ONIWRZ.js} +10 -10
  3. package/dist/{apply-ADB3ZK7W.js → apply-EEFPY2W4.js} +5 -5
  4. package/dist/{bench-FM7I7EIV.js → bench-WWWXLTFH.js} +9 -9
  5. package/dist/{chunk-KZ5EY5XX.js → chunk-34OCSKOB.js} +7 -7
  6. package/dist/{chunk-UWDCIFTP.js → chunk-45WZ6GMI.js} +27 -43
  7. package/dist/chunk-45WZ6GMI.js.map +1 -0
  8. package/dist/{chunk-QMIQR7EE.js → chunk-62GVVZQO.js} +3 -3
  9. package/dist/{chunk-YII4U7ZD.js → chunk-6K2LCFG6.js} +2 -2
  10. package/dist/{chunk-A4H7P7T7.js → chunk-7UMMFOL2.js} +3 -3
  11. package/dist/chunk-7UMMFOL2.js.map +1 -0
  12. package/dist/{chunk-HJBF4WD2.js → chunk-CWSQVHVV.js} +59 -25
  13. package/dist/chunk-CWSQVHVV.js.map +1 -0
  14. package/dist/{chunk-SGTTR4XW.js → chunk-E4I6MMHD.js} +4 -4
  15. package/dist/{chunk-6YQT3SSM.js → chunk-ECU7YO7S.js} +2 -2
  16. package/dist/{chunk-MI5TREN3.js → chunk-EG2MGDP5.js} +6 -6
  17. package/dist/{chunk-RCZJQUTC.js → chunk-HOAHMERN.js} +43 -10
  18. package/dist/chunk-HOAHMERN.js.map +1 -0
  19. package/dist/{chunk-HLAPOUEM.js → chunk-KMCS76ZW.js} +3 -3
  20. package/dist/{chunk-KZXQWC7U.js → chunk-KRAGAUKD.js} +8 -8
  21. package/dist/{chunk-E6KXCV3T.js → chunk-LGHND47K.js} +2 -2
  22. package/dist/{chunk-DV7HUC4Z.js → chunk-LI35PIIS.js} +2 -2
  23. package/dist/{chunk-Z5O2XBWA.js → chunk-LTH6XYZ3.js} +5 -5
  24. package/dist/{chunk-2SUFAE6X.js → chunk-NEWNXZ65.js} +21 -12
  25. package/dist/{chunk-2SUFAE6X.js.map → chunk-NEWNXZ65.js.map} +1 -1
  26. package/dist/{chunk-LPWPFIIB.js → chunk-OODXFCQV.js} +7 -7
  27. package/dist/{chunk-ISZ54SVE.js → chunk-PMLE7KAQ.js} +17 -9
  28. package/dist/chunk-PMLE7KAQ.js.map +1 -0
  29. package/dist/{chunk-HY5HLFDU.js → chunk-QF7VEL3M.js} +115 -14
  30. package/dist/chunk-QF7VEL3M.js.map +1 -0
  31. package/dist/{chunk-B3TSS7BT.js → chunk-QJ44VG5G.js} +2 -2
  32. package/dist/{chunk-VE3IYNDN.js → chunk-SA6HXL4Y.js} +2 -2
  33. package/dist/{chunk-UK4E2FUA.js → chunk-TZYINKCC.js} +75 -53
  34. package/dist/chunk-TZYINKCC.js.map +1 -0
  35. package/dist/{chunk-32JSYXEK.js → chunk-V7QOIQYC.js} +2 -2
  36. package/dist/{chunk-ANI2NTR4.js → chunk-XUEMATVY.js} +6 -6
  37. package/dist/{chunk-D6ZBGJ3L.js → chunk-ZVZMWNCG.js} +129 -35
  38. package/dist/chunk-ZVZMWNCG.js.map +1 -0
  39. package/dist/cli.js +35 -35
  40. package/dist/cli.js.map +1 -1
  41. package/dist/{config-KGZUPAUP.js → config-LEBZZCJP.js} +4 -4
  42. package/dist/{conventions-RYN7OXJN.js → conventions-XOT6YW5L.js} +6 -6
  43. package/dist/{execute-QL3ZQIAP.js → execute-LELOSR5T.js} +14 -14
  44. package/dist/{generate-CX6KNHZS.js → generate-JGW5JSKB.js} +10 -10
  45. package/dist/{init-PDVQDRS6.js → init-TO6MUXO4.js} +7 -5
  46. package/dist/{operations-CAKIT2BO.js → operations-O4FORFIH.js} +4 -4
  47. package/dist/{plan-PRORGS3L.js → plan-OXAT344Q.js} +12 -12
  48. package/dist/{policy-WX6O2JID.js → policy-U5NBFAO5.js} +5 -5
  49. package/dist/{pr-27RMQI5F.js → pr-UZHNKKZC.js} +12 -12
  50. package/dist/{pr-review-VNESMAMT.js → pr-review-Q4ACAWDM.js} +9 -9
  51. package/dist/{prd-ZNC4T5BS.js → prd-6CYEMLDY.js} +12 -12
  52. package/dist/{recorder-N7U66HCO.js → recorder-2BAKPBRA.js} +2 -2
  53. package/dist/{resume-VLWIE264.js → resume-URCU6CIJ.js} +26 -26
  54. package/dist/{review-7CREJDKB.js → review-LVZT2TMW.js} +13 -13
  55. package/dist/{routing-VCDYHSXA.js → routing-EK6RBZM4.js} +6 -6
  56. package/dist/run-2RXJCJKT.js +56 -0
  57. package/dist/{usage-U7QNGCPK.js → usage-KTMYXAPF.js} +3 -3
  58. package/dist/{web-HUNDHCJ4.js → web-B5UPHHR5.js} +8 -8
  59. package/package.json +1 -1
  60. package/web/AGENTS.md +115 -7
  61. package/web/public/app.css +393 -245
  62. package/web/public/app.js +108 -38
  63. package/web/public/index.html +106 -78
  64. package/dist/chunk-A4H7P7T7.js.map +0 -1
  65. package/dist/chunk-D6ZBGJ3L.js.map +0 -1
  66. package/dist/chunk-HJBF4WD2.js.map +0 -1
  67. package/dist/chunk-HY5HLFDU.js.map +0 -1
  68. package/dist/chunk-ISZ54SVE.js.map +0 -1
  69. package/dist/chunk-RCZJQUTC.js.map +0 -1
  70. package/dist/chunk-UK4E2FUA.js.map +0 -1
  71. package/dist/chunk-UWDCIFTP.js.map +0 -1
  72. package/dist/run-3MPORLF5.js +0 -56
  73. /package/dist/{agent-TB6W7PT7.js.map → agent-HMZTXCRT.js.map} +0 -0
  74. /package/dist/{analyze-6M3KEOX7.js.map → analyze-Q4ONIWRZ.js.map} +0 -0
  75. /package/dist/{apply-ADB3ZK7W.js.map → apply-EEFPY2W4.js.map} +0 -0
  76. /package/dist/{bench-FM7I7EIV.js.map → bench-WWWXLTFH.js.map} +0 -0
  77. /package/dist/{chunk-KZ5EY5XX.js.map → chunk-34OCSKOB.js.map} +0 -0
  78. /package/dist/{chunk-QMIQR7EE.js.map → chunk-62GVVZQO.js.map} +0 -0
  79. /package/dist/{chunk-YII4U7ZD.js.map → chunk-6K2LCFG6.js.map} +0 -0
  80. /package/dist/{chunk-SGTTR4XW.js.map → chunk-E4I6MMHD.js.map} +0 -0
  81. /package/dist/{chunk-6YQT3SSM.js.map → chunk-ECU7YO7S.js.map} +0 -0
  82. /package/dist/{chunk-MI5TREN3.js.map → chunk-EG2MGDP5.js.map} +0 -0
  83. /package/dist/{chunk-HLAPOUEM.js.map → chunk-KMCS76ZW.js.map} +0 -0
  84. /package/dist/{chunk-KZXQWC7U.js.map → chunk-KRAGAUKD.js.map} +0 -0
  85. /package/dist/{chunk-E6KXCV3T.js.map → chunk-LGHND47K.js.map} +0 -0
  86. /package/dist/{chunk-DV7HUC4Z.js.map → chunk-LI35PIIS.js.map} +0 -0
  87. /package/dist/{chunk-Z5O2XBWA.js.map → chunk-LTH6XYZ3.js.map} +0 -0
  88. /package/dist/{chunk-LPWPFIIB.js.map → chunk-OODXFCQV.js.map} +0 -0
  89. /package/dist/{chunk-B3TSS7BT.js.map → chunk-QJ44VG5G.js.map} +0 -0
  90. /package/dist/{chunk-VE3IYNDN.js.map → chunk-SA6HXL4Y.js.map} +0 -0
  91. /package/dist/{chunk-32JSYXEK.js.map → chunk-V7QOIQYC.js.map} +0 -0
  92. /package/dist/{chunk-ANI2NTR4.js.map → chunk-XUEMATVY.js.map} +0 -0
  93. /package/dist/{config-KGZUPAUP.js.map → config-LEBZZCJP.js.map} +0 -0
  94. /package/dist/{conventions-RYN7OXJN.js.map → conventions-XOT6YW5L.js.map} +0 -0
  95. /package/dist/{execute-QL3ZQIAP.js.map → execute-LELOSR5T.js.map} +0 -0
  96. /package/dist/{generate-CX6KNHZS.js.map → generate-JGW5JSKB.js.map} +0 -0
  97. /package/dist/{init-PDVQDRS6.js.map → init-TO6MUXO4.js.map} +0 -0
  98. /package/dist/{operations-CAKIT2BO.js.map → operations-O4FORFIH.js.map} +0 -0
  99. /package/dist/{plan-PRORGS3L.js.map → plan-OXAT344Q.js.map} +0 -0
  100. /package/dist/{policy-WX6O2JID.js.map → policy-U5NBFAO5.js.map} +0 -0
  101. /package/dist/{pr-27RMQI5F.js.map → pr-UZHNKKZC.js.map} +0 -0
  102. /package/dist/{pr-review-VNESMAMT.js.map → pr-review-Q4ACAWDM.js.map} +0 -0
  103. /package/dist/{prd-ZNC4T5BS.js.map → prd-6CYEMLDY.js.map} +0 -0
  104. /package/dist/{recorder-N7U66HCO.js.map → recorder-2BAKPBRA.js.map} +0 -0
  105. /package/dist/{resume-VLWIE264.js.map → resume-URCU6CIJ.js.map} +0 -0
  106. /package/dist/{review-7CREJDKB.js.map → review-LVZT2TMW.js.map} +0 -0
  107. /package/dist/{routing-VCDYHSXA.js.map → routing-EK6RBZM4.js.map} +0 -0
  108. /package/dist/{run-3MPORLF5.js.map → run-2RXJCJKT.js.map} +0 -0
  109. /package/dist/{usage-U7QNGCPK.js.map → usage-KTMYXAPF.js.map} +0 -0
  110. /package/dist/{web-HUNDHCJ4.js.map → web-B5UPHHR5.js.map} +0 -0
@@ -5,15 +5,15 @@ import {
5
5
  runAgent,
6
6
  runAgentUse,
7
7
  writeAgentPreference
8
- } from "./chunk-UWDCIFTP.js";
9
- import "./chunk-HY5HLFDU.js";
10
- import "./chunk-DV7HUC4Z.js";
8
+ } from "./chunk-45WZ6GMI.js";
9
+ import "./chunk-QF7VEL3M.js";
10
+ import "./chunk-LI35PIIS.js";
11
11
  import "./chunk-XZUEFTUP.js";
12
12
  import "./chunk-QPGEFLMY.js";
13
13
  import "./chunk-HAKDLR6N.js";
14
14
  import "./chunk-YVPZUN6X.js";
15
15
  import "./chunk-DUS5ZNKL.js";
16
- import "./chunk-YII4U7ZD.js";
16
+ import "./chunk-6K2LCFG6.js";
17
17
  import "./chunk-PPZ3K4YM.js";
18
18
  import "./chunk-SOM4QA6C.js";
19
19
  import "./chunk-ICM463EO.js";
@@ -27,4 +27,4 @@ export {
27
27
  runAgentUse,
28
28
  writeAgentPreference
29
29
  };
30
- //# sourceMappingURL=agent-TB6W7PT7.js.map
30
+ //# sourceMappingURL=agent-HMZTXCRT.js.map
@@ -2,13 +2,13 @@
2
2
  import {
3
3
  issuePlaceholders,
4
4
  resolveCommandIssue
5
- } from "./chunk-VE3IYNDN.js";
6
- import "./chunk-QMIQR7EE.js";
5
+ } from "./chunk-SA6HXL4Y.js";
6
+ import "./chunk-62GVVZQO.js";
7
7
  import "./chunk-KMMASOA6.js";
8
8
  import {
9
9
  publishPhaseMetrics,
10
10
  resolvePolicyPlaceholders
11
- } from "./chunk-HLAPOUEM.js";
11
+ } from "./chunk-KMCS76ZW.js";
12
12
  import {
13
13
  applyPlaceholders,
14
14
  loadPrompt
@@ -16,15 +16,15 @@ import {
16
16
  import {
17
17
  DEFAULT_HEADLESS_TIMEOUT_MS,
18
18
  runHeadless
19
- } from "./chunk-UK4E2FUA.js";
19
+ } from "./chunk-TZYINKCC.js";
20
20
  import "./chunk-WCCZJL7W.js";
21
21
  import "./chunk-DGRTJD5R.js";
22
- import "./chunk-D6ZBGJ3L.js";
23
- import "./chunk-E6KXCV3T.js";
24
- import "./chunk-HY5HLFDU.js";
22
+ import "./chunk-ZVZMWNCG.js";
23
+ import "./chunk-LGHND47K.js";
24
+ import "./chunk-QF7VEL3M.js";
25
25
  import {
26
26
  resolveIssuePaths
27
- } from "./chunk-DV7HUC4Z.js";
27
+ } from "./chunk-LI35PIIS.js";
28
28
  import {
29
29
  getGlobalTimeout,
30
30
  printError,
@@ -35,7 +35,7 @@ import "./chunk-QPGEFLMY.js";
35
35
  import "./chunk-HAKDLR6N.js";
36
36
  import "./chunk-YVPZUN6X.js";
37
37
  import "./chunk-DUS5ZNKL.js";
38
- import "./chunk-YII4U7ZD.js";
38
+ import "./chunk-6K2LCFG6.js";
39
39
  import "./chunk-PPZ3K4YM.js";
40
40
  import {
41
41
  loadTaskPlan,
@@ -110,4 +110,4 @@ async function runAnalyze(issue, resolvedIssue) {
110
110
  export {
111
111
  runAnalyze
112
112
  };
113
- //# sourceMappingURL=analyze-6M3KEOX7.js.map
113
+ //# sourceMappingURL=analyze-Q4ONIWRZ.js.map
@@ -3,9 +3,9 @@ import "./chunk-3D4A4B46.js";
3
3
  import {
4
4
  DEFAULT_BRANCH_CONVENTION,
5
5
  loadRepositoryPolicy
6
- } from "./chunk-E6KXCV3T.js";
7
- import "./chunk-HY5HLFDU.js";
8
- import "./chunk-DV7HUC4Z.js";
6
+ } from "./chunk-LGHND47K.js";
7
+ import "./chunk-QF7VEL3M.js";
8
+ import "./chunk-LI35PIIS.js";
9
9
  import "./chunk-XZUEFTUP.js";
10
10
  import "./chunk-QPGEFLMY.js";
11
11
  import "./chunk-HAKDLR6N.js";
@@ -13,7 +13,7 @@ import {
13
13
  getProjectRoot
14
14
  } from "./chunk-YVPZUN6X.js";
15
15
  import "./chunk-DUS5ZNKL.js";
16
- import "./chunk-YII4U7ZD.js";
16
+ import "./chunk-6K2LCFG6.js";
17
17
  import "./chunk-PPZ3K4YM.js";
18
18
  import "./chunk-SOM4QA6C.js";
19
19
  import "./chunk-ICM463EO.js";
@@ -798,4 +798,4 @@ export {
798
798
  planRepositoryScaffold,
799
799
  resolveRepositoryState
800
800
  };
801
- //# sourceMappingURL=apply-ADB3ZK7W.js.map
801
+ //# sourceMappingURL=apply-EEFPY2W4.js.map
@@ -1,26 +1,26 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  summarizePhaseTiming
4
- } from "./chunk-B3TSS7BT.js";
4
+ } from "./chunk-QJ44VG5G.js";
5
5
  import {
6
6
  runAcceptance
7
- } from "./chunk-SGTTR4XW.js";
7
+ } from "./chunk-E4I6MMHD.js";
8
8
  import "./chunk-L6HSKTQE.js";
9
9
  import {
10
10
  evaluateCeilings,
11
11
  spendFromCost
12
- } from "./chunk-UK4E2FUA.js";
12
+ } from "./chunk-TZYINKCC.js";
13
13
  import "./chunk-WCCZJL7W.js";
14
14
  import "./chunk-DGRTJD5R.js";
15
- import "./chunk-D6ZBGJ3L.js";
15
+ import "./chunk-ZVZMWNCG.js";
16
16
  import {
17
17
  ensureHarnessVersion,
18
18
  setIssuesCliOverrides
19
- } from "./chunk-HY5HLFDU.js";
19
+ } from "./chunk-QF7VEL3M.js";
20
20
  import {
21
21
  resetStorageResolutionCache,
22
22
  resolveIssuePaths
23
- } from "./chunk-DV7HUC4Z.js";
23
+ } from "./chunk-LI35PIIS.js";
24
24
  import {
25
25
  printError,
26
26
  printInfo,
@@ -39,7 +39,7 @@ import {
39
39
  createInitialSnapshot,
40
40
  reduceSessionEvent
41
41
  } from "./chunk-DUS5ZNKL.js";
42
- import "./chunk-YII4U7ZD.js";
42
+ import "./chunk-6K2LCFG6.js";
43
43
  import {
44
44
  redactSecrets
45
45
  } from "./chunk-PPZ3K4YM.js";
@@ -858,7 +858,7 @@ async function runBench(options = {}) {
858
858
  const harnessVersion = options.harnessVersion ?? await collectHarnessVersion("claude");
859
859
  const runner = options.runner ?? createLiveRepeatRunner({
860
860
  runPipeline: options.runPipeline ?? (async (issue) => {
861
- const { runPipeline } = await import("./run-3MPORLF5.js");
861
+ const { runPipeline } = await import("./run-2RXJCJKT.js");
862
862
  return runPipeline(issue, "auto", void 0, true, false, { yes: true, only: true });
863
863
  })
864
864
  });
@@ -907,4 +907,4 @@ export {
907
907
  estimateCampaignUsd,
908
908
  runBench
909
909
  };
910
- //# sourceMappingURL=bench-FM7I7EIV.js.map
910
+ //# sourceMappingURL=bench-WWWXLTFH.js.map
@@ -3,15 +3,15 @@ import {
3
3
  isTransientFailure,
4
4
  readFileWithGrace,
5
5
  runPhaseWithRetry
6
- } from "./chunk-32JSYXEK.js";
6
+ } from "./chunk-V7QOIQYC.js";
7
7
  import {
8
8
  issuePlaceholders,
9
9
  resolveCommandIssue
10
- } from "./chunk-VE3IYNDN.js";
10
+ } from "./chunk-SA6HXL4Y.js";
11
11
  import {
12
12
  publishPhaseMetrics,
13
13
  resolvePolicyPlaceholders
14
- } from "./chunk-HLAPOUEM.js";
14
+ } from "./chunk-KMCS76ZW.js";
15
15
  import {
16
16
  applyPlaceholders,
17
17
  loadPrompt
@@ -19,18 +19,18 @@ import {
19
19
  import {
20
20
  DEFAULT_HEADLESS_TIMEOUT_MS,
21
21
  runHeadless
22
- } from "./chunk-UK4E2FUA.js";
22
+ } from "./chunk-TZYINKCC.js";
23
23
  import {
24
24
  DEFAULT_BRANCH_CONVENTION,
25
25
  branchName,
26
26
  loadRepositoryPolicy,
27
27
  resolveChangeType
28
- } from "./chunk-E6KXCV3T.js";
28
+ } from "./chunk-LGHND47K.js";
29
29
  import {
30
30
  recordUserStoryNumbering,
31
31
  resolveIssuePaths,
32
32
  resolveProjectPaths
33
- } from "./chunk-DV7HUC4Z.js";
33
+ } from "./chunk-LI35PIIS.js";
34
34
  import {
35
35
  getGlobalTimeout,
36
36
  printError,
@@ -311,4 +311,4 @@ ${issues}`
311
311
  export {
312
312
  runPlan
313
313
  };
314
- //# sourceMappingURL=chunk-KZ5EY5XX.js.map
314
+ //# sourceMappingURL=chunk-34OCSKOB.js.map
@@ -4,8 +4,8 @@ import {
4
4
  PROJECT_CONFIG_FILENAME,
5
5
  describeRunAgents,
6
6
  loadAgentConfig,
7
- probeAgent
8
- } from "./chunk-HY5HLFDU.js";
7
+ probeReadinessInventory
8
+ } from "./chunk-QF7VEL3M.js";
9
9
  import {
10
10
  printError,
11
11
  printSuccess
@@ -54,12 +54,8 @@ function formatPhaseLine(phase, provider, model, origin, inherited) {
54
54
  async function runAgent(options = {}) {
55
55
  const config = await loadAgentConfig();
56
56
  const summary = await describeRunAgents();
57
- const [claude, codex, cursor, antigravity] = await Promise.all([
58
- probeAgent("claude"),
59
- probeAgent("codex"),
60
- probeAgent("cursor"),
61
- probeAgent("antigravity")
62
- ]);
57
+ const inventory = await probeReadinessInventory();
58
+ const providers = Object.values(inventory.providers);
63
59
  if (options.json === true) {
64
60
  const phases = {};
65
61
  for (const phase of AGENT_PHASES) {
@@ -82,33 +78,21 @@ async function runAgent(options = {}) {
82
78
  origin: summary.defaultOrigin
83
79
  },
84
80
  phases,
85
- availability: [
86
- {
87
- id: "claude",
88
- installed: claude.installed,
89
- version: claude.version,
90
- authenticated: claude.authenticated
91
- },
92
- {
93
- id: "codex",
94
- installed: codex.installed,
95
- version: codex.version,
96
- authenticated: codex.authenticated
97
- },
98
- {
99
- id: "cursor",
100
- installed: cursor.installed,
101
- version: cursor.version,
102
- authenticated: cursor.authenticated
103
- },
104
- {
105
- id: "antigravity",
106
- installed: antigravity.installed,
107
- version: antigravity.version,
108
- authenticated: antigravity.authenticated,
109
- authProbe: "none"
110
- }
111
- ]
81
+ inventory,
82
+ availability: providers.map((entry) => ({
83
+ id: entry.provider,
84
+ harness: entry.harness,
85
+ installed: entry.installed,
86
+ version: entry.version,
87
+ authenticated: entry.authentication !== "failed" && entry.installed,
88
+ authentication: entry.authentication,
89
+ state: entry.state,
90
+ source: entry.source,
91
+ observedAt: entry.observedAt,
92
+ expiresAt: entry.expiresAt,
93
+ detail: entry.detail,
94
+ ...entry.provider === "antigravity" || entry.provider === "claude" ? { authProbe: "none" } : {}
95
+ }))
112
96
  },
113
97
  null,
114
98
  2
@@ -138,13 +122,13 @@ async function runAgent(options = {}) {
138
122
  }
139
123
  console.log("");
140
124
  console.log("Disponibilidade");
141
- console.log(` claude ${(claude.version ?? "\u2014").padEnd(16)} ${claude.detail}`);
142
- console.log(` codex ${(codex.version ?? "\u2014").padEnd(16)} ${codex.detail}`);
143
- console.log(` cursor ${(cursor.version ?? "\u2014").padEnd(16)} ${cursor.detail}`);
144
- console.log(
145
- ` antigravity ${(antigravity.version ?? "\u2014").padEnd(16)} ${antigravity.detail} (no auth probe)`
146
- );
147
- if (antigravity.installed) {
125
+ for (const entry of providers) {
126
+ const authNote = entry.authentication === "unverified" ? " (auth unverified)" : "";
127
+ console.log(
128
+ ` ${entry.provider.padEnd(12)} ${(entry.version ?? "\u2014").padEnd(16)} ${entry.state.padEnd(12)} ${entry.detail}${authNote}`
129
+ );
130
+ }
131
+ if (inventory.providers.antigravity?.installed) {
148
132
  console.log(
149
133
  " Warning: every Antigravity invocation passes --dangerously-skip-permissions. --mode plan is the write containment."
150
134
  );
@@ -235,4 +219,4 @@ export {
235
219
  writeAgentPreference,
236
220
  persistFirstAgentChoice
237
221
  };
238
- //# sourceMappingURL=chunk-UWDCIFTP.js.map
222
+ //# sourceMappingURL=chunk-45WZ6GMI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/agent.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { dirname, join } from 'node:path';\nimport { probeReadinessInventory } from '../agents/availability.js';\nimport { describeRunAgents } from '../agents/resolve.js';\nimport {\n AGENT_PHASES,\n AGENT_SCHEMA_VERSION,\n type AgentPhase,\n type AgentProviderId,\n isAgentPhase,\n isAgentProviderId,\n} from '../agents/types.js';\nimport { GLOBAL_CONFIG_FILENAME, loadAgentConfig, PROJECT_CONFIG_FILENAME } from '../config.js';\nimport { getGlobalRoot } from '../storage/paths.js';\nimport { printError, printSuccess } from '../ui/logger.js';\nimport { writeFileAtomic } from '../utils/fs.js';\nimport { getProjectRoot } from '../utils/git.js';\n\nexport const AGENT_COMMAND_SCHEMA_VERSION = AGENT_SCHEMA_VERSION;\n\nexport interface AgentCommandOptions {\n json?: boolean;\n}\n\nexport interface AgentUseOptions {\n model?: string;\n global?: boolean;\n project?: boolean;\n phase?: string;\n}\n\nfunction originLabel(origin: string): string {\n switch (origin) {\n case 'default':\n return 'default';\n case 'global':\n return '~/.issue-flow/config.json';\n case 'project':\n return '.issue-flow.json';\n case 'env':\n return 'ISSUE_FLOW_*';\n case 'cli':\n return 'CLI';\n default:\n return origin;\n }\n}\n\nfunction formatPhaseLine(\n phase: AgentPhase,\n provider: string,\n model: string | null,\n origin: string,\n inherited: boolean,\n): string {\n const modelBit = model ? ` · ${model}` : '';\n const source = inherited ? 'herdado do padrão' : originLabel(origin);\n return `${` ${phase.padEnd(12)} ${provider}${modelBit}`.padEnd(40)}(${source})`;\n}\n\nexport async function runAgent(options: AgentCommandOptions = {}): Promise<number> {\n const config = await loadAgentConfig();\n const summary = await describeRunAgents();\n const inventory = await probeReadinessInventory();\n const providers = Object.values(inventory.providers);\n\n if (options.json === true) {\n const phases: Record<string, unknown> = {};\n for (const phase of AGENT_PHASES) {\n const resolved = summary.byPhase[phase];\n const inherited = config.phases[phase] === undefined;\n phases[phase] = {\n provider: resolved.provider,\n model: resolved.model,\n origin: resolved.origin,\n inherited,\n };\n }\n console.log(\n JSON.stringify(\n {\n schemaVersion: AGENT_COMMAND_SCHEMA_VERSION,\n default: {\n provider: summary.defaultProvider,\n model: summary.defaultModel,\n origin: summary.defaultOrigin,\n },\n phases,\n inventory,\n availability: providers.map((entry) => ({\n id: entry.provider,\n harness: entry.harness,\n installed: entry.installed,\n version: entry.version,\n authenticated: entry.authentication !== 'failed' && entry.installed,\n authentication: entry.authentication,\n state: entry.state,\n source: entry.source,\n observedAt: entry.observedAt,\n expiresAt: entry.expiresAt,\n detail: entry.detail,\n ...(entry.provider === 'antigravity' || entry.provider === 'claude'\n ? { authProbe: 'none' as const }\n : {}),\n })),\n },\n null,\n 2,\n ),\n );\n return 0;\n }\n\n const modelLabel = summary.defaultModel ?? '(default do provider)';\n console.log(\n `Agente padrão ${summary.defaultProvider.padEnd(22)} (${originLabel(summary.defaultOrigin.provider)})`,\n );\n console.log(`Modelo ${modelLabel} (${originLabel(summary.defaultOrigin.model)})`);\n console.log('');\n console.log('Por fase');\n for (const phase of AGENT_PHASES) {\n const resolved = summary.byPhase[phase];\n const inherited = config.phases[phase] === undefined;\n console.log(\n formatPhaseLine(\n phase,\n resolved.provider,\n resolved.model,\n resolved.origin.provider,\n inherited,\n ),\n );\n }\n console.log('');\n console.log('Disponibilidade');\n for (const entry of providers) {\n const authNote = entry.authentication === 'unverified' ? ' (auth unverified)' : '';\n console.log(\n ` ${entry.provider.padEnd(12)} ${(entry.version ?? '—').padEnd(16)} ${entry.state.padEnd(12)} ${entry.detail}${authNote}`,\n );\n }\n if (inventory.providers.antigravity?.installed) {\n console.log(\n ' Warning: every Antigravity invocation passes --dangerously-skip-permissions. --mode plan is the write containment.',\n );\n }\n return 0;\n}\n\nexport async function runAgentUse(\n providerRaw: string,\n options: AgentUseOptions = {},\n): Promise<number> {\n if (!isAgentProviderId(providerRaw)) {\n printError(\n `Unknown agent provider '${providerRaw}'. Valid providers: claude, codex, cursor, antigravity.`,\n );\n return 1;\n }\n const provider = providerRaw as AgentProviderId;\n\n let phase: AgentPhase | undefined;\n if (options.phase !== undefined) {\n if (!isAgentPhase(options.phase)) {\n printError(\n `Unknown agent phase '${options.phase}'. Valid phases: ${AGENT_PHASES.join(', ')}.`,\n );\n return 1;\n }\n phase = options.phase;\n }\n\n const target: 'global' | 'project' = options.project === true ? 'project' : 'global';\n try {\n const path = await writeAgentPreference({\n target,\n provider,\n model: options.model,\n phase,\n });\n printSuccess(`Wrote agent preference to ${path}`);\n return 0;\n } catch (err) {\n printError(err instanceof Error ? err.message : String(err));\n return 1;\n }\n}\n\nexport async function writeAgentPreference(input: {\n target: 'global' | 'project';\n provider: AgentProviderId;\n model?: string;\n phase?: AgentPhase;\n projectRoot?: string;\n}): Promise<string> {\n const path =\n input.target === 'global'\n ? join(getGlobalRoot(), GLOBAL_CONFIG_FILENAME)\n : join(input.projectRoot ?? (await getProjectRoot()), PROJECT_CONFIG_FILENAME);\n\n let existing: Record<string, unknown> = {};\n try {\n const raw = await readFile(path, 'utf-8');\n const parsed: unknown = JSON.parse(raw);\n if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {\n existing = parsed as Record<string, unknown>;\n }\n } catch (err: unknown) {\n if ((err as NodeJS.ErrnoException).code !== 'ENOENT') {\n throw new Error(`Could not read ${path}: ${(err as Error).message}`);\n }\n }\n\n const currentAgent =\n existing.agent !== null && typeof existing.agent === 'object' && !Array.isArray(existing.agent)\n ? { ...(existing.agent as Record<string, unknown>) }\n : {};\n\n if (input.phase) {\n const phases =\n currentAgent.phases !== null &&\n typeof currentAgent.phases === 'object' &&\n !Array.isArray(currentAgent.phases)\n ? { ...(currentAgent.phases as Record<string, unknown>) }\n : {};\n phases[input.phase] = {\n provider: input.provider,\n ...(input.model ? { model: input.model } : {}),\n };\n currentAgent.phases = phases;\n } else {\n currentAgent.provider = input.provider;\n if (input.model) currentAgent.model = input.model;\n else delete currentAgent.model;\n }\n\n existing.agent = currentAgent;\n await mkdir(dirname(path), { recursive: true });\n await writeFileAtomic(path, `${JSON.stringify(existing, null, 2)}\\n`);\n if (input.provider === 'cursor') {\n const { ensureCursorStorageGrant } = await import('../agents/permissions.js');\n await ensureCursorStorageGrant({\n mode: input.target === 'project' ? 'project' : 'global',\n ...(input.projectRoot === undefined ? {} : { projectRoot: input.projectRoot }),\n });\n }\n return path;\n}\n\n/** Used by init to persist a first-run choice without touching other keys. */\nexport async function persistFirstAgentChoice(provider: AgentProviderId): Promise<string> {\n return writeAgentPreference({ target: 'global', provider });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,SAAS,YAAY;AAiBvB,IAAM,+BAA+B;AAa5C,SAAS,YAAY,QAAwB;AAC3C,UAAQ,QAAQ;AAAA,IACd,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO;AAAA,EACX;AACF;AAEA,SAAS,gBACP,OACA,UACA,OACA,QACA,WACQ;AACR,QAAM,WAAW,QAAQ,SAAM,KAAK,KAAK;AACzC,QAAM,SAAS,YAAY,yBAAsB,YAAY,MAAM;AACnE,SAAO,GAAG,KAAK,MAAM,OAAO,EAAE,CAAC,IAAI,QAAQ,GAAG,QAAQ,GAAG,OAAO,EAAE,CAAC,IAAI,MAAM;AAC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AAM,MAAM,IAAI,CAAC;AAAA,IAC9C;AACA,iBAAa,SAAS;AAAA,EACxB,OAAO;AACL,iBAAa,WAAW,MAAM;AAC9B,QAAI,MAAM,MAAO,cAAa,QAAQ,MAAM;AAAA,QACvC,QAAO,aAAa;AAAA,EAC3B;AAEA,WAAS,QAAQ;AACjB,QAAM,MAAM,QAAQ,IAAI,GAAG,EAAE,WAAW,KAAK,CAAC;AAC9C,QAAM,gBAAgB,MAAM,GAAG,KAAK,UAAU,UAAU,MAAM,CAAC,CAAC;AAAA,CAAI;AACpE,MAAI,MAAM,aAAa,UAAU;AAC/B,UAAM,EAAE,yBAAyB,IAAI,MAAM,OAAO,2BAA0B;AAC5E,UAAM,yBAAyB;AAAA,MAC7B,MAAM,MAAM,WAAW,YAAY,YAAY;AAAA,MAC/C,GAAI,MAAM,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,MAAM,YAAY;AAAA,IAC9E,CAAC;AAAA,EACH;AACA,SAAO;AACT;AAGA,eAAsB,wBAAwB,UAA4C;AACxF,SAAO,qBAAqB,EAAE,QAAQ,UAAU,SAAS,CAAC;AAC5D;","names":[]}
@@ -8,11 +8,11 @@ import {
8
8
  import {
9
9
  getActiveResilienceConfig,
10
10
  loadIssuesConfig
11
- } from "./chunk-HY5HLFDU.js";
11
+ } from "./chunk-QF7VEL3M.js";
12
12
  import {
13
13
  resolveIssuePaths,
14
14
  resolveProjectPaths
15
- } from "./chunk-DV7HUC4Z.js";
15
+ } from "./chunk-LI35PIIS.js";
16
16
  import {
17
17
  printInfo,
18
18
  printWarning
@@ -943,4 +943,4 @@ export {
943
943
  IssueResolutionError,
944
944
  resolveIssue
945
945
  };
946
- //# sourceMappingURL=chunk-QMIQR7EE.js.map
946
+ //# sourceMappingURL=chunk-62GVVZQO.js.map
@@ -137,7 +137,7 @@ function resetTelemetryState() {
137
137
  async function resolveConfig(ctx) {
138
138
  if (ctx.config !== void 0) return ctx.config;
139
139
  try {
140
- const { loadTelemetryConfig } = await import("./config-KGZUPAUP.js");
140
+ const { loadTelemetryConfig } = await import("./config-LEBZZCJP.js");
141
141
  ctx.config = await loadTelemetryConfig();
142
142
  return ctx.config;
143
143
  } catch {
@@ -359,4 +359,4 @@ export {
359
359
  endExecution,
360
360
  recordInvocation
361
361
  };
362
- //# sourceMappingURL=chunk-YII4U7ZD.js.map
362
+ //# sourceMappingURL=chunk-6K2LCFG6.js.map
@@ -369,7 +369,7 @@ function buildExecutionPlan(input) {
369
369
  origin: requested.has(id) ? "requested" : "discovered",
370
370
  role,
371
371
  externalDependencies: (relations?.blockedBy ?? []).filter(
372
- (blocker) => !scheduled.has(blocker)
372
+ (blocker) => !scheduled.has(blocker) && input.graph.nodes.get(blocker)?.issue?.state !== "closed"
373
373
  ),
374
374
  // Only the constraints that survive inside the queue: a blocker left out
375
375
  // of it is reported in `excluded`, not enforced as a dependency.
@@ -394,7 +394,7 @@ function buildExecutionPlan(input) {
394
394
  number: described.number,
395
395
  title: described.title,
396
396
  url: described.url,
397
- reason: "Discovered in the hierarchy but not selected for this run"
397
+ reason: node.issue?.state === "closed" ? "Already closed before this run" : "Discovered in the hierarchy but not selected for this run"
398
398
  });
399
399
  }
400
400
  return {
@@ -655,4 +655,4 @@ export {
655
655
  PIPELINE_PHASES_NO_BRANCH,
656
656
  PipelineManager
657
657
  };
658
- //# sourceMappingURL=chunk-A4H7P7T7.js.map
658
+ //# sourceMappingURL=chunk-7UMMFOL2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/execution/plan.ts","../src/execution/containers.ts","../src/issues/graph.ts","../src/execution/order.ts","../src/core/pipeline.ts"],"sourcesContent":["import { mkdir, readFile } from 'node:fs/promises';\nimport { dirname } from 'node:path';\nimport { ZodError } from 'zod';\nimport { isoNow } from '../core/state-manager.js';\nimport type { DependencyGraph } from '../issues/graph.js';\nimport type { Issue } from '../issues/types.js';\nimport { executionPlanSchema } from '../storage/schemas.js';\nimport type { LastError, PullRequestRef } from '../types.js';\nimport { writeFileAtomic } from '../utils/fs.js';\nimport { isContainer } from './containers.js';\nimport { priorityOf } from './order.js';\nimport type {\n ExecutionPlan,\n ExecutionPlanExcluded,\n ExecutionPlanIssue,\n QueueIssueRole,\n QueueIssueStatus,\n QueueStatus,\n} from './types.js';\n\n/**\n * Building, reading, writing and advancing the execution plan of a queue.\n *\n * The plan is the only state a multi-issue run adds to the storage tree, and it\n * is written **only** for a queue with more than one Issue — a single-issue run\n * leaves the layout exactly as it was.\n */\n\nexport interface BuildExecutionPlanInput {\n /** Project id of the global storage tree. */\n projectId: string;\n /** Identifiers the user asked for, in order; the first one names the queue. */\n requested: readonly string[];\n graph: DependencyGraph;\n /** Ids to run, already ordered by `computeExecutionOrder`. */\n order: readonly string[];\n noBranch?: boolean;\n prReview?: boolean;\n /** Injectable clock, so tests can assert `createdAt` vs `updatedAt`. */\n now?: () => string;\n}\n\nfunction parentOf(graph: DependencyGraph, id: string): string | null {\n for (const node of graph.nodes.values()) {\n if (node.relations.children.includes(id)) return node.id;\n }\n return null;\n}\n\n/** Title/url/number of a node, falling back to what the id alone tells us. */\nfunction describeIssue(\n issue: Issue | null,\n id: string,\n): {\n number: number | null;\n title: string;\n url: string | null;\n source: string;\n} {\n const parsed = Number.parseInt(id, 10);\n return {\n number: issue?.number ?? (Number.isNaN(parsed) ? null : parsed),\n title: issue?.title ?? '',\n url: issue?.remoteRef ?? null,\n source: issue?.source ?? 'github',\n };\n}\n\n/**\n * Turn a graph plus an order into the persisted plan.\n *\n * Every Issue of the graph that is *not* in the order becomes an `excluded`\n * entry: the consolidated Pull Request reports them as known pending work, so a\n * hierarchy the user chose to trim never disappears silently.\n */\nexport function buildExecutionPlan(input: BuildExecutionPlanInput): ExecutionPlan {\n const now = input.now ?? isoNow;\n const at = now();\n const scheduled = new Set(input.order);\n const requested = new Set(input.requested);\n\n const issues: ExecutionPlanIssue[] = input.order.map((id, index) => {\n const node = input.graph.nodes.get(id);\n const relations = node?.relations;\n const described = describeIssue(node?.issue ?? null, id);\n const children = relations?.children ?? [];\n const role: QueueIssueRole = isContainer({\n issue: node?.issue ?? null,\n children,\n })\n ? 'container'\n : 'executable';\n\n return {\n id,\n number: described.number,\n title: described.title,\n url: described.url,\n source: described.source,\n position: index + 1,\n status: 'pending',\n origin: requested.has(id) ? 'requested' : 'discovered',\n role,\n externalDependencies: (relations?.blockedBy ?? []).filter(\n (blocker) =>\n !scheduled.has(blocker) && input.graph.nodes.get(blocker)?.issue?.state !== 'closed',\n ),\n // Only the constraints that survive inside the queue: a blocker left out\n // of it is reported in `excluded`, not enforced as a dependency.\n dependsOn: (relations?.blockedBy ?? []).filter((blocker) => scheduled.has(blocker)),\n parent: relations?.parent ?? parentOf(input.graph, id),\n priority: priorityOf(node?.issue?.labels ?? []),\n heuristic: (relations?.heuristic.length ?? 0) > 0,\n failedPhase: null,\n lastError: null,\n attempts: 0,\n blockedReason: null,\n startedAt: null,\n completedAt: null,\n };\n });\n\n const excluded: ExecutionPlanExcluded[] = [];\n for (const node of input.graph.nodes.values()) {\n if (scheduled.has(node.id)) continue;\n const described = describeIssue(node.issue, node.id);\n excluded.push({\n id: node.id,\n number: described.number,\n title: described.title,\n url: described.url,\n reason:\n node.issue?.state === 'closed'\n ? 'Already closed before this run'\n : 'Discovered in the hierarchy but not selected for this run',\n });\n }\n\n return {\n schemaVersion: 1,\n id: input.requested[0] ?? (input.order[0] as string),\n project: input.projectId,\n requested: [...input.requested],\n branchName: null,\n noBranch: input.noBranch ?? false,\n prReview: input.prReview ?? false,\n status: 'pending',\n createdAt: at,\n updatedAt: at,\n truncated: input.graph.truncated,\n issues,\n excluded,\n };\n}\n\n/** Read a persisted plan. Throws with the offending fields on invalid content. */\nexport async function loadExecutionPlan(path: string): Promise<ExecutionPlan> {\n const raw: unknown = JSON.parse(await readFile(path, 'utf-8'));\n\n try {\n return executionPlanSchema.parse(raw) as ExecutionPlan;\n } catch (err) {\n if (err instanceof ZodError) {\n const issues = err.issues.map((i) => ` - ${i.path.join('.')}: ${i.message}`).join('\\n');\n throw new Error(`Invalid execution-plan.json at ${path}:\\n${issues}`);\n }\n throw err;\n }\n}\n\n/**\n * Persist a plan atomically, creating the queue directory on first write.\n *\n * `updatedAt` is stamped here so no call site can forget it — the file is the\n * only record of how far a queue got, and a stale timestamp on it is worse than\n * none.\n */\nexport async function saveExecutionPlan(\n path: string,\n plan: ExecutionPlan,\n now: () => string = isoNow,\n): Promise<void> {\n await mkdir(dirname(path), { recursive: true });\n const stamped: ExecutionPlan = { ...plan, updatedAt: now() };\n await writeFileAtomic(path, `${JSON.stringify(stamped, null, 2)}\\n`);\n}\n\n/**\n * The Issue the queue should work on next, or `null` when every one of them is\n * completed.\n *\n * The order of the lookups *is* the resume policy: an interrupted issue\n * (`in_progress`) and a failed one are retried before the queue moves on, and\n * each of them picks up from its own `tasks.json` (phase-level resume) rather\n * than from the start. A `completed` issue is never revisited — that is the\n * whole point of persisting the queue.\n */\nexport interface NextQueueIssueOptions {\n /**\n * Ids this invocation is done with, however they ended. A queue that skips a\n * failing Issue and comes back to it needs a way to say \"not this one again\",\n * or \"come back later\" becomes \"come back forever\".\n */\n exclude?: ReadonlySet<string>;\n}\n\n/**\n * Whether every dependency this Issue declares *inside the queue* is finished.\n *\n * The execution order already places dependencies first, so this only bites\n * once an entry stops being `completed` — skipped, blocked or failed. Handing\n * out an Issue whose blocker was skipped is how a queue produces work that\n * cannot compile.\n */\nfunction dependenciesSatisfied(plan: ExecutionPlan, entry: ExecutionPlanIssue): boolean {\n return entry.dependsOn.every((id) => {\n const dependency = plan.issues.find((candidate) => candidate.id === id);\n if (dependency === undefined) return true;\n // A container is not work: waiting on it would deadlock the children\n // that complete it.\n if (dependency.role === 'container') return true;\n return dependency.status === 'completed';\n });\n}\n\n/**\n * The Issue to work on next.\n *\n * The order of the four lookups is the resumption policy:\n * an interrupted Issue first (it was mid-flight), then one that failed on a\n * previous invocation, then the untouched ones, and only at the end the ones\n * this queue deliberately set aside — which is what \"go on with the\n * independent work and come back to it\" means in one line.\n *\n * `blocked` is absent on purpose: it needs a human, and no ordering of the\n * queue changes that.\n */\nexport function nextQueueIssue(\n plan: ExecutionPlan,\n options: NextQueueIssueOptions = {},\n): ExecutionPlanIssue | null {\n const exclude = options.exclude ?? new Set<string>();\n const eligible = (status: QueueIssueStatus) => (entry: ExecutionPlanIssue) =>\n entry.role !== 'container' &&\n entry.status === status &&\n !exclude.has(entry.id) &&\n dependenciesSatisfied(plan, entry);\n\n return (\n plan.issues.find(eligible('in_progress')) ??\n plan.issues.find(eligible('failed')) ??\n plan.issues.find(eligible('pending')) ??\n plan.issues.find(eligible('skipped')) ??\n null\n );\n}\n\n/**\n * Status of the queue derived from its entries.\n *\n * `skipped` is *not* terminal — the queue means to come back to it — so a queue\n * holding one is still `in_progress`. `blocked` is: nothing the queue can do\n * moves it, so a queue that ends with one ends `failed`, which is what a person\n * needs to see.\n */\nexport function queueStatus(plan: ExecutionPlan): QueueStatus {\n if (plan.issues.some((entry) => entry.status === 'failed' || entry.status === 'blocked')) {\n return 'failed';\n }\n if (plan.issues.every((entry) => entry.status === 'completed')) return 'completed';\n if (plan.issues.some((entry) => entry.status !== 'pending')) return 'in_progress';\n return 'pending';\n}\n\n/** Whether every Issue of the queue has been resolved. */\nexport function isQueueComplete(plan: ExecutionPlan): boolean {\n return plan.issues.every((entry) => entry.status === 'completed');\n}\n\n/** Apply `patch` to one entry and recompute the queue status. Pure. */\nfunction updateIssue(\n plan: ExecutionPlan,\n id: string,\n patch: Partial<ExecutionPlanIssue>,\n): ExecutionPlan {\n const issues = plan.issues.map((entry) => (entry.id === id ? { ...entry, ...patch } : entry));\n const next: ExecutionPlan = { ...plan, issues };\n return { ...next, status: queueStatus(next) };\n}\n\nexport function markQueueIssueInProgress(\n plan: ExecutionPlan,\n id: string,\n now: () => string = isoNow,\n): ExecutionPlan {\n const current = plan.issues.find((entry) => entry.id === id);\n return updateIssue(plan, id, {\n status: 'in_progress',\n // Preserved across a resume: the queue reports when the work on this Issue\n // really began, not when it was last picked up.\n startedAt: current?.startedAt ?? now(),\n failedPhase: null,\n lastError: null,\n });\n}\n\nfunction completeResolvedContainers(plan: ExecutionPlan, now: () => string): ExecutionPlan {\n let next = plan;\n let changed = true;\n while (changed) {\n changed = false;\n for (const entry of next.issues) {\n if (entry.role !== 'container' || entry.status === 'completed') continue;\n const children = next.issues.filter((candidate) => candidate.parent === entry.id);\n if (children.length === 0) continue;\n if (children.every((child) => child.status === 'completed')) {\n next = updateIssue(next, entry.id, {\n status: 'completed',\n completedAt: now(),\n failedPhase: null,\n lastError: null,\n });\n changed = true;\n }\n }\n }\n return next;\n}\n\nexport function markQueueIssueCompleted(\n plan: ExecutionPlan,\n id: string,\n now: () => string = isoNow,\n): ExecutionPlan {\n return completeResolvedContainers(\n updateIssue(plan, id, {\n status: 'completed',\n completedAt: now(),\n failedPhase: null,\n lastError: null,\n }),\n now,\n );\n}\n\nexport function markQueueIssueFailed(\n plan: ExecutionPlan,\n id: string,\n failure: { phase: string | null; error: LastError | null },\n): ExecutionPlan {\n const current = plan.issues.find((entry) => entry.id === id);\n return updateIssue(plan, id, {\n status: 'failed',\n failedPhase: failure.phase,\n lastError: failure.error,\n attempts: (current?.attempts ?? 0) + 1,\n });\n}\n\n/**\n * Set an Issue aside and come back to it later.\n *\n * The difference from `failed` is the whole point of `--on-issue-failure skip`:\n * a failure that stopped this attempt is not a verdict on the eleven other\n * Issues in the queue, and `skipped` is the status that says \"not now\" rather\n * than \"not at all\". `attempts` is incremented here because the counter is what\n * keeps \"come back later\" from becoming \"come back forever\".\n */\nexport function markQueueIssueSkipped(\n plan: ExecutionPlan,\n id: string,\n failure: { phase: string | null; error: LastError | null },\n): ExecutionPlan {\n const current = plan.issues.find((entry) => entry.id === id);\n return updateIssue(plan, id, {\n status: 'skipped',\n failedPhase: failure.phase,\n lastError: failure.error,\n attempts: (current?.attempts ?? 0) + 1,\n });\n}\n\n/**\n * Stop working on an Issue until a person looks at it.\n *\n * `blocked` is never handed back out by `nextQueueIssue`: waiting cannot fix\n * a missing credential or a repository mid-rebase, and a queue that could\n * unblock itself would spin on the same cause forever.\n */\nexport function markQueueIssueBlocked(\n plan: ExecutionPlan,\n id: string,\n reason: string,\n failure: { phase: string | null; error: LastError | null },\n): ExecutionPlan {\n const current = plan.issues.find((entry) => entry.id === id);\n return updateIssue(plan, id, {\n status: 'blocked',\n blockedReason: reason,\n failedPhase: failure.phase,\n lastError: failure.error,\n attempts: (current?.attempts ?? 0) + 1,\n });\n}\n\n/** Record the branch every Issue of the queue shares. */\nexport function setQueueBranch(plan: ExecutionPlan, branchName: string): ExecutionPlan {\n return { ...plan, branchName };\n}\n\n/** Record the single Pull Request that consolidated the queue. */\nexport function setQueuePullRequest(\n plan: ExecutionPlan,\n pullRequest: PullRequestRef,\n): ExecutionPlan {\n return { ...plan, pullRequest };\n}\n","import type { DependencyGraph } from '../issues/graph.js';\nimport type { Issue } from '../issues/types.js';\n\nexport const CONTAINER_SIGNALS = ['children', 'issue-type', 'label', 'title-prefix'] as const;\n\nexport type ContainerSignal = (typeof CONTAINER_SIGNALS)[number];\n\nexport interface ContainerConfig {\n detect: readonly ContainerSignal[];\n issueTypes: readonly string[];\n labels: readonly string[];\n titlePrefixes: readonly string[];\n}\n\n/** Unconfigured repos: only the universal signal. */\nexport const DEFAULT_CONTAINER_CONFIG: ContainerConfig = {\n detect: ['children'],\n issueTypes: ['Epic'],\n labels: ['epic'],\n titlePrefixes: ['[Epic]'],\n};\n\nexport interface ContainerProbe {\n issue: Pick<Issue, 'title' | 'labels' | 'type'> | null;\n children: readonly string[];\n}\n\nfunction enabled(config: ContainerConfig, signal: ContainerSignal): boolean {\n return config.detect.includes(signal);\n}\n\nfunction hasTitlePrefix(title: string, prefixes: readonly string[]): boolean {\n const trimmed = title.trim();\n return prefixes.some((prefix) => trimmed.toLowerCase().startsWith(prefix.toLowerCase()));\n}\n\n/**\n * Precedence: children > issue type > label > title prefix.\n * Having children always wins when that signal is enabled.\n */\nexport function isContainer(\n probe: ContainerProbe,\n config: ContainerConfig = DEFAULT_CONTAINER_CONFIG,\n): boolean {\n if (enabled(config, 'children') && probe.children.length > 0) return true;\n\n const issue = probe.issue;\n if (issue === null) return false;\n\n if (enabled(config, 'issue-type')) {\n const type = issue.type?.trim();\n if (\n type !== undefined &&\n type !== '' &&\n config.issueTypes.some((name) => name.toLowerCase() === type.toLowerCase())\n ) {\n return true;\n }\n }\n\n if (enabled(config, 'label')) {\n const labels = new Set(issue.labels.map((label) => label.toLowerCase()));\n if (config.labels.some((label) => labels.has(label.toLowerCase()))) return true;\n }\n\n if (enabled(config, 'title-prefix') && hasTitlePrefix(issue.title, config.titlePrefixes)) {\n return true;\n }\n\n return false;\n}\n\n/** Root plus every descendant reached through `children`. */\nexport function collectCascadeIds(graph: DependencyGraph, roots: readonly string[]): string[] {\n const ids = new Set<string>();\n const walk = (id: string): void => {\n if (ids.has(id)) return;\n ids.add(id);\n for (const child of graph.nodes.get(id)?.relations.children ?? []) {\n walk(child);\n }\n };\n for (const root of roots) walk(root);\n return [...ids];\n}\n","import { emptyRelations, uniqueIds } from './relations.js';\nimport type { Issue, IssueRelations } from './types.js';\n\n/**\n * Dependency graph of a set of Issues, built by walking the relations every\n * provider exposes through `fetchRelations`.\n *\n * The traversal is deliberately *structural*: it follows hierarchy\n * (parent/children) and dependencies (blockedBy/blocking) and stops there. Plain\n * mentions are recorded on each node but never expanded — a body citing \"see\n * also #12\" would otherwise drag an unrelated Issue into an execution plan the\n * user is about to confirm.\n */\n\nexport interface DependencyGraphNode {\n id: string;\n relations: IssueRelations;\n /** Distance from the closest root, in traversal hops. */\n depth: number;\n /** The Issue itself, when the caller supplied a way to read it. */\n issue: Issue | null;\n /** True when the node was requested by the user rather than discovered. */\n root: boolean;\n}\n\nexport interface DependencyGraph {\n /** Ids the traversal started from, in the order they were requested. */\n roots: string[];\n /** Every discovered node, keyed by id, in discovery order. */\n nodes: Map<string, DependencyGraphNode>;\n /**\n * Dependency cycles found among the discovered nodes, each listed once,\n * starting at its smallest member. Reported rather than thrown: discovery\n * must still answer, and it is the ordering layer that refuses to run.\n */\n cycles: string[][];\n /** True when a limit stopped the traversal before it was exhausted. */\n truncated: boolean;\n limits: { maxNodes: number; maxDepth: number };\n}\n\n/**\n * Conservative defaults: a real hierarchy is a handful of Issues, and each node\n * costs several API calls. A malformed (or simply huge) graph must not turn a\n * `run` into a rate-limit incident.\n */\nexport const DEFAULT_MAX_NODES = 25;\nexport const DEFAULT_MAX_DEPTH = 3;\n\nexport interface BuildDependencyGraphOptions {\n maxNodes?: number;\n maxDepth?: number;\n /** Issues the caller already resolved, so the traversal does not re-read them. */\n known?: Iterable<Issue>;\n /** Reader for the Issues the traversal discovers. Optional. */\n fetchIssue?: (id: string) => Promise<Issue | null>;\n /** Warning sink for a source that failed. Silent by default. */\n warn?: (message: string) => void;\n}\n\n/** Edge `from` → `to`, meaning \"`from` must be resolved before `to`\". */\nexport interface DependencyEdge {\n from: string;\n to: string;\n}\n\n/**\n * Ordering constraints of a graph: only hierarchy-free, explicit dependencies.\n *\n * `blockedBy`/`blocking` are the two spellings of the same fact, so both are\n * normalized into a single direction here. Parent/child is **not** a constraint\n * — it is a presentation and tie-breaking concern (see `computeExecutionOrder`),\n * because a parent is usually an umbrella that neither blocks nor is blocked by\n * its children.\n *\n * Edges pointing outside the graph are dropped: an Issue the traversal never\n * reached cannot be scheduled, so a constraint against it is unenforceable.\n */\nexport function dependencyEdges(graph: DependencyGraph): DependencyEdge[] {\n const edges: DependencyEdge[] = [];\n const seen = new Set<string>();\n\n const add = (from: string, to: string): void => {\n if (from === to || !graph.nodes.has(from) || !graph.nodes.has(to)) return;\n const key = `${from}->${to}`;\n if (seen.has(key)) return;\n seen.add(key);\n edges.push({ from, to });\n };\n\n for (const node of graph.nodes.values()) {\n for (const blocker of node.relations.blockedBy) {\n add(blocker, node.id);\n }\n for (const blocked of node.relations.blocking) {\n add(node.id, blocked);\n }\n }\n\n return edges;\n}\n\n/** Every cycle of the dependency edges, each reported once. */\nexport function findCycles(graph: DependencyGraph): string[][] {\n const adjacency = new Map<string, string[]>();\n for (const { from, to } of dependencyEdges(graph)) {\n const list = adjacency.get(from);\n if (list === undefined) {\n adjacency.set(from, [to]);\n } else {\n list.push(to);\n }\n }\n\n const cycles: string[][] = [];\n const reported = new Set<string>();\n const state = new Map<string, 'visiting' | 'done'>();\n const stack: string[] = [];\n\n const record = (cycle: string[]): void => {\n // Rotate to the smallest member so the same cycle found from two entry\n // points is reported once.\n let pivot = 0;\n for (let i = 1; i < cycle.length; i++) {\n if (compareIds(cycle[i] as string, cycle[pivot] as string) < 0) pivot = i;\n }\n const normalized = [...cycle.slice(pivot), ...cycle.slice(0, pivot)];\n const key = normalized.join('->');\n if (reported.has(key)) return;\n reported.add(key);\n cycles.push(normalized);\n };\n\n const visit = (id: string): void => {\n state.set(id, 'visiting');\n stack.push(id);\n\n for (const next of adjacency.get(id) ?? []) {\n const status = state.get(next);\n if (status === 'visiting') {\n record(stack.slice(stack.indexOf(next)));\n continue;\n }\n if (status === undefined) {\n visit(next);\n }\n }\n\n stack.pop();\n state.set(id, 'done');\n };\n\n for (const id of graph.nodes.keys()) {\n if (!state.has(id)) visit(id);\n }\n\n return cycles;\n}\n\n/** Numeric when both ids are numbers, lexicographic otherwise. */\nexport function compareIds(a: string, b: string): number {\n const na = Number(a);\n const nb = Number(b);\n if (Number.isInteger(na) && Number.isInteger(nb)) {\n return na - nb;\n }\n return a < b ? -1 : a > b ? 1 : 0;\n}\n\n/** Ids a node links to structurally, in traversal order. */\nfunction neighbours(relations: IssueRelations): string[] {\n return uniqueIds(\n [\n ...(relations.parent === null ? [] : [relations.parent]),\n ...relations.children,\n ...relations.blockedBy,\n ...relations.blocking,\n ],\n relations.id,\n );\n}\n\n/**\n * Walk the relations of `roots` breadth-first and return the whole structure.\n *\n * Failures never abort the walk: a node whose relations cannot be read enters\n * the graph with empty relations (and a warning), exactly like an Issue that\n * genuinely relates to nothing. That keeps a partially unavailable API from\n * costing the user the Issues that *were* discovered.\n *\n * Breadth-first is what makes `depth` meaningful under a limit: when the walk is\n * truncated, what is missing is the far edge of the graph, not a random subset.\n */\nexport async function buildDependencyGraph(\n roots: readonly string[],\n fetchRelations: (id: string) => Promise<IssueRelations | null>,\n options: BuildDependencyGraphOptions = {},\n): Promise<DependencyGraph> {\n const maxNodes = options.maxNodes ?? DEFAULT_MAX_NODES;\n const maxDepth = options.maxDepth ?? DEFAULT_MAX_DEPTH;\n const warn = options.warn ?? ((): void => {});\n\n const known = new Map<string, Issue>();\n for (const issue of options.known ?? []) {\n known.set(issue.id, issue);\n }\n\n const rootIds = uniqueIds(roots);\n const nodes = new Map<string, DependencyGraphNode>();\n const queued = new Set<string>(rootIds);\n let truncated = false;\n\n let frontier: { id: string; depth: number }[] = rootIds.map((id) => ({ id, depth: 0 }));\n\n while (frontier.length > 0) {\n const next: { id: string; depth: number }[] = [];\n\n for (const { id, depth } of frontier) {\n if (nodes.size >= maxNodes) {\n truncated = true;\n break;\n }\n\n let relations: IssueRelations | null = null;\n try {\n relations = await fetchRelations(id);\n } catch (err) {\n warn(\n `Could not read the relations of issue '${id}': ${err instanceof Error ? err.message : String(err)}`,\n );\n }\n\n let issue = known.get(id) ?? null;\n if (issue === null && options.fetchIssue !== undefined) {\n try {\n issue = await options.fetchIssue(id);\n } catch (err) {\n warn(`Could not read issue '${id}': ${err instanceof Error ? err.message : String(err)}`);\n }\n }\n\n const resolved = relations ?? emptyRelations(id);\n nodes.set(id, { id, relations: resolved, depth, issue, root: rootIds.includes(id) });\n\n if (depth >= maxDepth) {\n // Only a node that actually has unexplored neighbours truncates the\n // graph; a leaf at max depth explored everything there was.\n if (neighbours(resolved).some((neighbour) => !queued.has(neighbour))) {\n truncated = true;\n }\n continue;\n }\n\n for (const neighbour of neighbours(resolved)) {\n if (queued.has(neighbour)) continue;\n queued.add(neighbour);\n next.push({ id: neighbour, depth: depth + 1 });\n }\n }\n\n if (nodes.size >= maxNodes && next.length > 0) {\n truncated = true;\n break;\n }\n frontier = next;\n }\n\n const graph: DependencyGraph = {\n roots: rootIds,\n nodes,\n cycles: [],\n truncated,\n limits: { maxNodes, maxDepth },\n };\n\n linkReferencedBy(graph);\n graph.cycles = findCycles(graph);\n\n return graph;\n}\n\n/**\n * Complete `referencedBy` with the inverse of `references` among the discovered\n * nodes.\n *\n * The origin only reports the citations it can see (GitHub's timeline covers\n * cross-references but not, for instance, a mention added by the textual\n * heuristic); inverting what the graph already holds costs no API call and\n * keeps the two directions consistent inside it.\n */\nfunction linkReferencedBy(graph: DependencyGraph): void {\n for (const node of graph.nodes.values()) {\n for (const cited of node.relations.references) {\n const target = graph.nodes.get(cited);\n if (target === undefined || target.id === node.id) continue;\n target.relations.referencedBy = uniqueIds(\n [...target.relations.referencedBy, node.id],\n target.id,\n );\n }\n }\n}\n","import { compareIds, type DependencyGraph, dependencyEdges, findCycles } from '../issues/graph.js';\nimport type { IssuePriority } from './types.js';\n\n/**\n * Turning a dependency graph into the order the queue runs in.\n *\n * The criteria are applied in the exact precedence the initiative specifies:\n *\n * 1. **dependencies and blocks** — hard constraints; an Issue never starts\n * before something it depends on has finished. This is the topological part\n * and the only one that can make the computation fail (a cycle);\n * 2. **hierarchy** — with two Issues both ready to run, the ancestor goes\n * first, so an umbrella Issue frames the work of its sub-issues;\n * 3. **priority** — the GitHub labels `high`, `medium` and `low`;\n * 4. **logical order** — the identifier, numerically when it is a number.\n *\n * Everything below the first item is a *tie-break among Issues that are already\n * free to run*, never a constraint: a `high` Issue that depends on a `low` one\n * still runs second, which is the whole point of the feature.\n */\n\nconst PRIORITY_LABELS: Record<string, IssuePriority> = {\n high: 'high',\n medium: 'medium',\n low: 'low',\n};\n\n/** Ranking of a priority; an Issue with no label sorts after every labelled one. */\nconst PRIORITY_RANK: Record<IssuePriority, number> = { high: 0, medium: 1, low: 2 };\nconst NO_PRIORITY_RANK = 3;\n\n/**\n * Priority carried by a label set, or `null` when there is none.\n *\n * Both the bare labels used by this repository (`high`) and the qualified\n * spellings other projects use (`priority: high`, `priority/high`, `P-high`)\n * are accepted; anything else is simply not a priority. The absence of a label\n * is never an error — most Issues have none.\n */\nexport function priorityOf(labels: readonly string[]): IssuePriority | null {\n for (const label of labels) {\n const normalized = label.trim().toLowerCase();\n const direct = PRIORITY_LABELS[normalized];\n if (direct !== undefined) return direct;\n\n const qualified = /^(?:priority|prio|p)\\s*[:/-]\\s*(high|medium|low)$/.exec(normalized);\n const matched = qualified?.[1];\n if (matched !== undefined) return PRIORITY_LABELS[matched] as IssuePriority;\n }\n return null;\n}\n\nexport interface ExecutionOrderOptions {\n /**\n * Subset of the graph to schedule. Defaults to every node — the \"run the\n * whole hierarchy\" answer; the \"only the ones I asked for\" answer passes the\n * requested ids.\n */\n include?: readonly string[];\n}\n\nexport type ExecutionOrderResult =\n | { ok: true; order: string[] }\n | { ok: false; cycles: string[][] };\n\n/** Number of ancestors of `id` inside the selection: 0 for a top-level Issue. */\nfunction hierarchyDepth(\n id: string,\n parentOf: Map<string, string | null>,\n selected: Set<string>,\n): number {\n let depth = 0;\n let current = parentOf.get(id) ?? null;\n const seen = new Set<string>([id]);\n\n while (current !== null && selected.has(current) && !seen.has(current)) {\n depth++;\n seen.add(current);\n current = parentOf.get(current) ?? null;\n }\n\n return depth;\n}\n\n/**\n * Order the selected Issues of a graph.\n *\n * Kahn's algorithm with a deterministic tie-break, so the same graph always\n * produces the same order — a plan the user confirmed must not reshuffle itself\n * on the next run.\n *\n * A cycle is reported, never worked around: an arbitrary order would silently\n * implement an Issue before its dependency, which is exactly the failure this\n * whole feature exists to prevent. Constraints pointing outside the selection\n * are dropped — an Issue that is not going to run cannot block anything.\n */\nexport function computeExecutionOrder(\n graph: DependencyGraph,\n options: ExecutionOrderOptions = {},\n): ExecutionOrderResult {\n const selected = new Set(\n (options.include ?? [...graph.nodes.keys()]).filter((id) => graph.nodes.has(id)),\n );\n\n const parentOf = new Map<string, string | null>();\n const priority = new Map<string, IssuePriority | null>();\n for (const id of selected) {\n const node = graph.nodes.get(id);\n parentOf.set(id, node?.relations.parent ?? null);\n priority.set(id, priorityOf(node?.issue?.labels ?? []));\n }\n\n const incoming = new Map<string, Set<string>>();\n const outgoing = new Map<string, string[]>();\n for (const id of selected) {\n incoming.set(id, new Set());\n outgoing.set(id, []);\n }\n for (const { from, to } of dependencyEdges(graph)) {\n if (!selected.has(from) || !selected.has(to) || from === to) continue;\n incoming.get(to)?.add(from);\n outgoing.get(from)?.push(to);\n }\n\n const depth = new Map<string, number>();\n for (const id of selected) {\n depth.set(id, hierarchyDepth(id, parentOf, selected));\n }\n\n const rank = (id: string): number => {\n const value = priority.get(id) ?? null;\n return value === null ? NO_PRIORITY_RANK : PRIORITY_RANK[value];\n };\n\n const better = (a: string, b: string): number => {\n const byHierarchy = (depth.get(a) ?? 0) - (depth.get(b) ?? 0);\n if (byHierarchy !== 0) return byHierarchy;\n const byPriority = rank(a) - rank(b);\n if (byPriority !== 0) return byPriority;\n return compareIds(a, b);\n };\n\n const ready = [...selected].filter((id) => (incoming.get(id)?.size ?? 0) === 0);\n const order: string[] = [];\n\n while (ready.length > 0) {\n ready.sort(better);\n const next = ready.shift() as string;\n order.push(next);\n\n for (const dependent of outgoing.get(next) ?? []) {\n const pending = incoming.get(dependent);\n if (pending === undefined) continue;\n pending.delete(next);\n if (pending.size === 0) {\n ready.push(dependent);\n }\n }\n }\n\n if (order.length !== selected.size) {\n // Prefer the cycles the graph already recorded; recompute only if the\n // selection is what closed the loop.\n const cycles = graph.cycles.length > 0 ? graph.cycles : findCycles(graph);\n const relevant = cycles.filter((cycle) => cycle.every((id) => selected.has(id)));\n return { ok: false, cycles: relevant.length > 0 ? relevant : cycles };\n }\n\n return { ok: true, order };\n}\n\n/** One-line description of the cycles, for an error message. */\nexport function describeCycles(cycles: readonly string[][]): string {\n return cycles.map((cycle) => [...cycle, cycle[0]].map((id) => `#${id}`).join(' → ')).join('; ');\n}\n","import type { PipelineState, TaskPlan } from '../types.js';\nimport { loadTaskPlan, saveTaskPlan } from './state-manager.js';\n\n/**\n * Ordered pipeline phases. Each phase must complete before the next can start.\n *\n * `pr-review` is deliberately NOT here: it is opt-in via `--pr-review`. Adding\n * it to the default set would make every existing `tasks.json` (which has no\n * `prReviewCompleted`) look unfinished, so `getNextPhase()` would resume into a\n * phase the user never asked for.\n */\nexport const PIPELINE_PHASES = ['init', 'prd', 'plan', 'execute', 'review', 'pr'] as const;\n\n/**\n * The default set plus the opt-in `pr-review` phase, used when the user passes\n * `--pr-review` (or the flag was persisted in `plan.prReview.enabled`).\n */\nexport const PIPELINE_PHASES_WITH_PR_REVIEW = [...PIPELINE_PHASES, 'pr-review'] as const;\n\nexport type PipelinePhase = (typeof PIPELINE_PHASES_WITH_PR_REVIEW)[number];\n\n/**\n * Pipeline phases excluding the 'pr' phase, for --no-branch mode.\n * `pr-review` is excluded too: without a branch there is no PR to review.\n */\nexport const PIPELINE_PHASES_NO_BRANCH = PIPELINE_PHASES.filter(\n (p): p is Exclude<PipelinePhase, 'pr' | 'pr-review'> => p !== 'pr',\n);\n\n/**\n * Map pipeline phases to their corresponding PipelineState field.\n * 'init' has no persisted state — it's a runtime-only check.\n */\nconst PHASE_TO_FIELD: Record<PipelinePhase, keyof PipelineState | null> = {\n init: null,\n prd: 'prdCompleted',\n plan: 'jsonCompleted',\n execute: 'executionCompleted',\n review: 'reviewCompleted',\n pr: 'prCreated',\n 'pr-review': 'prReviewCompleted',\n};\n\nexport class PipelineManager {\n private tasksJsonPath: string;\n private plan: TaskPlan;\n private activePhases: readonly PipelinePhase[];\n\n constructor(plan: TaskPlan, tasksJsonPath: string, activePhases?: readonly PipelinePhase[]) {\n this.plan = plan;\n this.tasksJsonPath = tasksJsonPath;\n this.activePhases = activePhases ?? PIPELINE_PHASES;\n }\n\n /**\n * Reload state from disk.\n */\n async reload(): Promise<void> {\n this.plan = await loadTaskPlan(this.tasksJsonPath);\n }\n\n /**\n * Check if a phase is complete.\n */\n isPhaseComplete(phase: PipelinePhase): boolean {\n const field = PHASE_TO_FIELD[phase];\n if (field === null) return true; // init is always \"complete\" after running\n return this.plan.pipeline?.[field] ?? false;\n }\n\n /**\n * Get the first incomplete phase in the pipeline.\n * Returns null if all phases are complete.\n */\n getNextPhase(): PipelinePhase | null {\n for (const phase of this.activePhases) {\n if (!this.isPhaseComplete(phase)) {\n return phase;\n }\n }\n return null;\n }\n\n /**\n * Get the current phase (alias for getNextPhase).\n */\n getCurrentPhase(): PipelinePhase | null {\n return this.getNextPhase();\n }\n\n /**\n * Check whether we can resume from a specific phase.\n * All prerequisite phases must be complete.\n */\n canResume(fromPhase: PipelinePhase): boolean {\n const idx = this.activePhases.indexOf(fromPhase);\n if (idx < 0) return false;\n\n // All active phases before fromPhase must be complete\n for (let i = 0; i < idx; i++) {\n if (!this.isPhaseComplete(this.activePhases[i])) {\n return false;\n }\n }\n return true;\n }\n\n /**\n * Mark a phase as complete and persist to disk.\n */\n async markPhaseComplete(phase: PipelinePhase): Promise<void> {\n const field = PHASE_TO_FIELD[phase];\n if (field === null) return; // init has no persisted state\n\n this.plan = {\n ...this.plan,\n pipeline: {\n ...(this.plan.pipeline ?? {\n prdCompleted: false,\n jsonCompleted: false,\n executionCompleted: false,\n reviewCompleted: false,\n prCreated: false,\n }),\n [field]: true,\n },\n };\n\n await saveTaskPlan(this.tasksJsonPath, this.plan);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA,SAAS,OAAO,gBAAgB;AAChC,SAAS,eAAe;AACxB,SAAS,gBAAgB;;;ACalB,IAAM,2BAA4C;AAAA,EACvD,QAAQ,CAAC,UAAU;AAAA,EACnB,YAAY,CAAC,MAAM;AAAA,EACnB,QAAQ,CAAC,MAAM;AAAA,EACf,eAAe,CAAC,QAAQ;AAC1B;AAOA,SAAS,QAAQ,QAAyB,QAAkC;AAC1E,SAAO,OAAO,OAAO,SAAS,MAAM;AACtC;AAEA,SAAS,eAAe,OAAe,UAAsC;AAC3E,QAAM,UAAU,MAAM,KAAK;AAC3B,SAAO,SAA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