issue-flow 0.13.0 → 0.15.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 (163) hide show
  1. package/dist/agent-AT64RXTA.js +30 -0
  2. package/dist/{analyze-WS47UYGN.js → analyze-O2PYDIFK.js} +21 -18
  3. package/dist/{analyze-WS47UYGN.js.map → analyze-O2PYDIFK.js.map} +1 -1
  4. package/dist/{apply-OS62UWRN.js → apply-SSU6QCD4.js} +14 -11
  5. package/dist/{apply-OS62UWRN.js.map → apply-SSU6QCD4.js.map} +1 -1
  6. package/dist/{bench-SA3BOME5.js → bench-ODFPAGW6.js} +30 -26
  7. package/dist/{bench-SA3BOME5.js.map → bench-ODFPAGW6.js.map} +1 -1
  8. package/dist/{chunk-HJGGNLWI.js → chunk-2ZAM45PZ.js} +9 -9
  9. package/dist/{chunk-QCXPNSEL.js → chunk-3BWZO4YI.js} +2 -2
  10. package/dist/{chunk-J62QSVP6.js → chunk-4RXYFWP7.js} +8 -7
  11. package/dist/{chunk-J62QSVP6.js.map → chunk-4RXYFWP7.js.map} +1 -1
  12. package/dist/{chunk-ARFVHC2F.js → chunk-5ZKBIXET.js} +115 -23
  13. package/dist/chunk-5ZKBIXET.js.map +1 -0
  14. package/dist/{chunk-HEF2RMKN.js → chunk-6E2PEBFT.js} +18 -16
  15. package/dist/{chunk-HEF2RMKN.js.map → chunk-6E2PEBFT.js.map} +1 -1
  16. package/dist/{agent-BXRIEKVM.js → chunk-6FXOU2KR.js} +22 -22
  17. package/dist/chunk-6FXOU2KR.js.map +1 -0
  18. package/dist/{chunk-IYV6KNVF.js → chunk-6QYMSNVA.js} +66 -240
  19. package/dist/chunk-6QYMSNVA.js.map +1 -0
  20. package/dist/{chunk-UOCPC2Y2.js → chunk-6SRE4KD7.js} +4 -4
  21. package/dist/{chunk-MIVHK5YI.js → chunk-A35HE4V7.js} +3 -3
  22. package/dist/{chunk-TM67EHSV.js → chunk-ARWNYXFL.js} +19 -19
  23. package/dist/chunk-ARWNYXFL.js.map +1 -0
  24. package/dist/chunk-AYYMW33T.js +163 -0
  25. package/dist/chunk-AYYMW33T.js.map +1 -0
  26. package/dist/chunk-BMHGRYL6.js +890 -0
  27. package/dist/chunk-BMHGRYL6.js.map +1 -0
  28. package/dist/{chunk-PV4OX5TC.js → chunk-F4OK7KEP.js} +11 -11
  29. package/dist/{chunk-QXDNBYQF.js → chunk-FK4IDY6P.js} +21 -10
  30. package/dist/chunk-FK4IDY6P.js.map +1 -0
  31. package/dist/{chunk-KQHB7ZT3.js → chunk-GSZCQUCY.js} +82 -16
  32. package/dist/chunk-GSZCQUCY.js.map +1 -0
  33. package/dist/{chunk-TX5WIVYP.js → chunk-HAKDLR6N.js} +6 -1
  34. package/dist/chunk-HAKDLR6N.js.map +1 -0
  35. package/dist/{chunk-OPNGPUKJ.js → chunk-HGSYD57B.js} +143 -48
  36. package/dist/chunk-HGSYD57B.js.map +1 -0
  37. package/dist/{chunk-PIVGJM6K.js → chunk-KAHQ6F5C.js} +11 -11
  38. package/dist/{chunk-BHJCGWQX.js → chunk-MEFY4B7T.js} +9 -9
  39. package/dist/{chunk-BQDQTIM7.js → chunk-MGCOQU6N.js} +4 -4
  40. package/dist/{chunk-5TB6KLC2.js → chunk-MROS3SKL.js} +8 -8
  41. package/dist/chunk-NVZMBXTE.js +243 -0
  42. package/dist/chunk-NVZMBXTE.js.map +1 -0
  43. package/dist/{chunk-664Y3NDX.js → chunk-PCN7ZQND.js} +8 -8
  44. package/dist/{chunk-IV5SS4JN.js → chunk-QRCGW2ZO.js} +9 -7
  45. package/dist/{chunk-IV5SS4JN.js.map → chunk-QRCGW2ZO.js.map} +1 -1
  46. package/dist/{chunk-7KD66LIM.js → chunk-RPXDBX6R.js} +3 -3
  47. package/dist/{chunk-SNTTOQAD.js → chunk-RWEXK55D.js} +2 -2
  48. package/dist/{chunk-6FDFRNXZ.js → chunk-TBDP6QPJ.js} +25 -20
  49. package/dist/chunk-TBDP6QPJ.js.map +1 -0
  50. package/dist/chunk-UNQYMR3H.js +25 -0
  51. package/dist/chunk-UNQYMR3H.js.map +1 -0
  52. package/dist/{chunk-HQAHNIAR.js → chunk-VR34TXHF.js} +14 -14
  53. package/dist/{chunk-CNBYCMSU.js → chunk-WM3Y7Q4A.js} +27 -18
  54. package/dist/{chunk-CNBYCMSU.js.map → chunk-WM3Y7Q4A.js.map} +1 -1
  55. package/dist/{chunk-NEZZ6KDR.js → chunk-XDKGA6UX.js} +52 -3
  56. package/dist/chunk-XDKGA6UX.js.map +1 -0
  57. package/dist/{chunk-FZDR7CGH.js → chunk-XG2NYDRA.js} +3 -3
  58. package/dist/{chunk-3XLCNVMD.js → chunk-XLVGPXNL.js} +2 -2
  59. package/dist/{chunk-DIG5XKQQ.js → chunk-XQHFC62U.js} +2 -2
  60. package/dist/{chunk-UJ7XWK7J.js → chunk-XRLRKTQA.js} +16 -14
  61. package/dist/{chunk-UJ7XWK7J.js.map → chunk-XRLRKTQA.js.map} +1 -1
  62. package/dist/{chunk-LZ6GFQAG.js → chunk-ZFIXEYUJ.js} +44 -31
  63. package/dist/chunk-ZFIXEYUJ.js.map +1 -0
  64. package/dist/{chunk-37N2RJW2.js → chunk-ZPIVCM7Q.js} +3 -3
  65. package/dist/{chunk-TVN2JVOF.js → chunk-ZXPASFHG.js} +3 -3
  66. package/dist/cli.js +58 -64
  67. package/dist/cli.js.map +1 -1
  68. package/dist/{config-MEM2IWWN.js → config-UMP6DBJB.js} +12 -9
  69. package/dist/{conventions-WV4NDXGH.js → conventions-DKH7AE4T.js} +14 -11
  70. package/dist/{conventions-WV4NDXGH.js.map → conventions-DKH7AE4T.js.map} +1 -1
  71. package/dist/diagnostics-GOGCLTRS.js +23 -0
  72. package/dist/execute-E3BRMDAQ.js +35 -0
  73. package/dist/{generate-MVQI7A45.js → generate-AGBT7EHX.js} +23 -20
  74. package/dist/{generate-MVQI7A45.js.map → generate-AGBT7EHX.js.map} +1 -1
  75. package/dist/{git-YRVRUN3C.js → git-AC542GU2.js} +4 -2
  76. package/dist/init-LLBVJNPE.js +24 -0
  77. package/dist/{operations-LU6JA3BX.js → operations-JQYK2EMT.js} +17 -14
  78. package/dist/{operations-LU6JA3BX.js.map → operations-JQYK2EMT.js.map} +1 -1
  79. package/dist/{permissions-7NMDFU27.js → permissions-6HL52K54.js} +4 -4
  80. package/dist/plan-HSLWDJEZ.js +34 -0
  81. package/dist/{policy-JSYEK5B2.js → policy-IMRXGG7X.js} +13 -10
  82. package/dist/{policy-JSYEK5B2.js.map → policy-IMRXGG7X.js.map} +1 -1
  83. package/dist/pr-6TCZXG6K.js +39 -0
  84. package/dist/pr-review-6MWJO2NP.js +32 -0
  85. package/dist/prd-D6YDYAFX.js +33 -0
  86. package/dist/{ps-TNE44R5V.js → ps-KUUZ6TUL.js} +11 -8
  87. package/dist/{ps-TNE44R5V.js.map → ps-KUUZ6TUL.js.map} +1 -1
  88. package/dist/{recorder-XGF55WXI.js → recorder-BJ2KIAWT.js} +5 -4
  89. package/dist/registry-SB7XTMGE.js +15 -0
  90. package/dist/{resume-QMEPMSZW.js → resume-QNLQSCR5.js} +44 -40
  91. package/dist/{resume-QMEPMSZW.js.map → resume-QNLQSCR5.js.map} +1 -1
  92. package/dist/review-3KJ4BH2V.js +35 -0
  93. package/dist/{routing-2ZUMZPJB.js → routing-TN7GLMGU.js} +13 -10
  94. package/dist/{routing-2ZUMZPJB.js.map → routing-TN7GLMGU.js.map} +1 -1
  95. package/dist/run-5EHIFF2V.js +54 -0
  96. package/dist/run-5EHIFF2V.js.map +1 -0
  97. package/dist/session-publisher-T7EI3CIP.js +11 -0
  98. package/dist/session-publisher-T7EI3CIP.js.map +1 -0
  99. package/dist/{state-manager-X3PT3FGT.js → state-manager-ZEPWTCA6.js} +3 -3
  100. package/dist/state-manager-ZEPWTCA6.js.map +1 -0
  101. package/dist/{usage-VCFLDA5Y.js → usage-QL563I7F.js} +13 -10
  102. package/dist/{usage-VCFLDA5Y.js.map → usage-QL563I7F.js.map} +1 -1
  103. package/dist/{web-XVHLX62B.js → web-PPSMNTQ6.js} +22 -57
  104. package/dist/{web-XVHLX62B.js.map → web-PPSMNTQ6.js.map} +1 -1
  105. package/package.json +1 -1
  106. package/web/AGENTS.md +154 -11
  107. package/web/public/app.css +343 -110
  108. package/web/public/app.js +436 -27
  109. package/web/public/index.html +44 -1
  110. package/dist/agent-BXRIEKVM.js.map +0 -1
  111. package/dist/chunk-6FDFRNXZ.js.map +0 -1
  112. package/dist/chunk-ARFVHC2F.js.map +0 -1
  113. package/dist/chunk-IHIEXUTC.js +0 -483
  114. package/dist/chunk-IHIEXUTC.js.map +0 -1
  115. package/dist/chunk-IYV6KNVF.js.map +0 -1
  116. package/dist/chunk-KQHB7ZT3.js.map +0 -1
  117. package/dist/chunk-LZ6GFQAG.js.map +0 -1
  118. package/dist/chunk-NEZZ6KDR.js.map +0 -1
  119. package/dist/chunk-OPNGPUKJ.js.map +0 -1
  120. package/dist/chunk-QXDNBYQF.js.map +0 -1
  121. package/dist/chunk-TM67EHSV.js.map +0 -1
  122. package/dist/chunk-TX5WIVYP.js.map +0 -1
  123. package/dist/execute-NITIHHCK.js +0 -31
  124. package/dist/init-OKWEC3EV.js +0 -21
  125. package/dist/plan-LEJJF3DE.js +0 -31
  126. package/dist/pr-HPVUZ7S3.js +0 -36
  127. package/dist/pr-review-R2QZBT3F.js +0 -29
  128. package/dist/prd-5O6GYCC6.js +0 -30
  129. package/dist/registry-LGPE53QD.js +0 -15
  130. package/dist/review-YKWD6SNN.js +0 -32
  131. package/dist/run-YU4TR62R.js +0 -50
  132. /package/dist/{config-MEM2IWWN.js.map → agent-AT64RXTA.js.map} +0 -0
  133. /package/dist/{chunk-HJGGNLWI.js.map → chunk-2ZAM45PZ.js.map} +0 -0
  134. /package/dist/{chunk-QCXPNSEL.js.map → chunk-3BWZO4YI.js.map} +0 -0
  135. /package/dist/{chunk-UOCPC2Y2.js.map → chunk-6SRE4KD7.js.map} +0 -0
  136. /package/dist/{chunk-MIVHK5YI.js.map → chunk-A35HE4V7.js.map} +0 -0
  137. /package/dist/{chunk-PV4OX5TC.js.map → chunk-F4OK7KEP.js.map} +0 -0
  138. /package/dist/{chunk-PIVGJM6K.js.map → chunk-KAHQ6F5C.js.map} +0 -0
  139. /package/dist/{chunk-BHJCGWQX.js.map → chunk-MEFY4B7T.js.map} +0 -0
  140. /package/dist/{chunk-BQDQTIM7.js.map → chunk-MGCOQU6N.js.map} +0 -0
  141. /package/dist/{chunk-5TB6KLC2.js.map → chunk-MROS3SKL.js.map} +0 -0
  142. /package/dist/{chunk-664Y3NDX.js.map → chunk-PCN7ZQND.js.map} +0 -0
  143. /package/dist/{chunk-7KD66LIM.js.map → chunk-RPXDBX6R.js.map} +0 -0
  144. /package/dist/{chunk-SNTTOQAD.js.map → chunk-RWEXK55D.js.map} +0 -0
  145. /package/dist/{chunk-HQAHNIAR.js.map → chunk-VR34TXHF.js.map} +0 -0
  146. /package/dist/{chunk-FZDR7CGH.js.map → chunk-XG2NYDRA.js.map} +0 -0
  147. /package/dist/{chunk-3XLCNVMD.js.map → chunk-XLVGPXNL.js.map} +0 -0
  148. /package/dist/{chunk-DIG5XKQQ.js.map → chunk-XQHFC62U.js.map} +0 -0
  149. /package/dist/{chunk-37N2RJW2.js.map → chunk-ZPIVCM7Q.js.map} +0 -0
  150. /package/dist/{chunk-TVN2JVOF.js.map → chunk-ZXPASFHG.js.map} +0 -0
  151. /package/dist/{execute-NITIHHCK.js.map → config-UMP6DBJB.js.map} +0 -0
  152. /package/dist/{git-YRVRUN3C.js.map → diagnostics-GOGCLTRS.js.map} +0 -0
  153. /package/dist/{init-OKWEC3EV.js.map → execute-E3BRMDAQ.js.map} +0 -0
  154. /package/dist/{permissions-7NMDFU27.js.map → git-AC542GU2.js.map} +0 -0
  155. /package/dist/{plan-LEJJF3DE.js.map → init-LLBVJNPE.js.map} +0 -0
  156. /package/dist/{pr-HPVUZ7S3.js.map → permissions-6HL52K54.js.map} +0 -0
  157. /package/dist/{pr-review-R2QZBT3F.js.map → plan-HSLWDJEZ.js.map} +0 -0
  158. /package/dist/{prd-5O6GYCC6.js.map → pr-6TCZXG6K.js.map} +0 -0
  159. /package/dist/{recorder-XGF55WXI.js.map → pr-review-6MWJO2NP.js.map} +0 -0
  160. /package/dist/{registry-LGPE53QD.js.map → prd-D6YDYAFX.js.map} +0 -0
  161. /package/dist/{review-YKWD6SNN.js.map → recorder-BJ2KIAWT.js.map} +0 -0
  162. /package/dist/{run-YU4TR62R.js.map → registry-SB7XTMGE.js.map} +0 -0
  163. /package/dist/{state-manager-X3PT3FGT.js.map → review-3KJ4BH2V.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/commands/execute.ts","../src/core/engine.ts","../src/ui/progress.ts","../src/ui/summary.ts","../src/ui/text.ts","../src/core/executor.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { createConfig, loadWebConfig, resolvePaths, validateDependencies } from '../config.js';\nimport { runEngine } from '../core/engine.js';\nimport { getSessionPublisher, setSessionPublisher } from '../core/session-publisher.js';\nimport { FilePublisher, NullPublisher } from '../core/session-state.js';\nimport { allStoriesPass, isoNow, loadTaskPlan, saveTaskPlan } from '../core/state-manager.js';\nimport { resolveIssuePaths } from '../storage/resolve.js';\nimport { printError } from '../ui/logger.js';\nimport { ensureWebMonitor } from '../web/lock.js';\n\nexport interface ExecuteOptions {\n issue?: string;\n maxIterations?: number;\n retryLimit?: number;\n retryForever?: boolean;\n /** `--restart-web`: replace the detached monitor before direct execution. */\n restartWeb?: boolean;\n /**\n * Conventional-commit scope for the stories of this issue (`issue-71`).\n * Only the multi-issue queue sets it — see `EngineConfig.commitScope`.\n */\n commitScope?: string;\n}\n\nexport async function runExecute(\n positionalMaxIter: number | undefined,\n options: ExecuteOptions,\n): Promise<number> {\n const errors = await validateDependencies();\n if (errors.length > 0) {\n printError('The following required tools are not installed:');\n for (const err of errors) {\n console.log(err);\n }\n return 1;\n }\n\n const maxIterations = options.maxIterations ?? positionalMaxIter;\n\n const config = createConfig({\n issueNumber: options.issue,\n maxIterations,\n retryLimit: options.retryLimit,\n retryForever: options.retryForever,\n commitScope: options.commitScope,\n });\n\n const paths = await resolvePaths(config);\n const webConfig = await loadWebConfig();\n const inheritedPublisher = getSessionPublisher();\n let standalonePublisher: FilePublisher | null = null;\n\n // `run` owns the publisher when it delegates to this command. A direct\n // `execute --issue N --web` has no owner, so install the same file-backed\n // surface here and tear down only what this invocation created.\n if (\n webConfig.enabled &&\n config.issueNumber !== undefined &&\n inheritedPublisher instanceof NullPublisher\n ) {\n const issuePaths = await resolveIssuePaths(config.issueNumber, {\n projectRoot: paths.projectRoot,\n });\n standalonePublisher = new FilePublisher(issuePaths.sessionFile, {\n logLimit: webConfig.logLimit,\n includeLogs: webConfig.includeLogs,\n });\n setSessionPublisher(standalonePublisher);\n const numericIssue = /^\\d+$/.test(config.issueNumber) ? Number(config.issueNumber) : null;\n standalonePublisher.publish({\n type: 'session:start',\n at: isoNow(),\n sessionId: randomUUID(),\n issueNumber: numericIssue,\n phases: ['execute'],\n });\n standalonePublisher.publish({ type: 'phase:start', at: isoNow(), phase: 'execute' });\n await ensureWebMonitor(\n {\n publisher: standalonePublisher,\n port: webConfig.port,\n host: webConfig.host,\n refreshSeconds: webConfig.refreshSeconds,\n },\n { restart: options.restartWeb === true },\n );\n }\n\n let exitCode: number | null = null;\n try {\n exitCode = await runEngine(config, paths);\n\n // Update pipeline state if all stories pass\n if (exitCode === 0 && config.issueNumber) {\n try {\n const plan = await loadTaskPlan(paths.prdFile);\n if (allStoriesPass(plan)) {\n plan.pipeline.executionCompleted = true;\n await saveTaskPlan(paths.prdFile, plan);\n }\n } catch {\n // Non-critical — engine already handled state\n }\n }\n\n return exitCode;\n } finally {\n if (standalonePublisher !== null) {\n const success = exitCode === 0;\n standalonePublisher.publish({\n type: 'phase:end',\n at: isoNow(),\n phase: 'execute',\n success,\n ...(success ? {} : { error: 'Execute phase failed' }),\n });\n standalonePublisher.publish({\n type: 'session:end',\n at: isoNow(),\n status: success ? 'completed' : 'failed',\n });\n await standalonePublisher.close();\n setSessionPublisher(undefined);\n }\n }\n}\n","import { existsSync } from 'node:fs';\nimport { cp, mkdir, readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\nimport { resolveAgentFor } from '../agents/resolve.js';\nimport { getActiveResilienceConfig, loadGlobalConfig } from '../config.js';\nimport { archiveFolderName, type ChangeType, commitMessage } from '../conventions/git/index.js';\nimport { resolvePolicyPlaceholders } from '../policy/placeholders.js';\nimport { classify } from '../resilience/errors.js';\nimport type { RetryPolicy } from '../resilience/policy.js';\nimport { resolvePolicy } from '../resilience/policy.js';\nimport { fixedBackoffPolicy, withRetry } from '../resilience/retry.js';\nimport type { ClaudeResult, EngineConfig, ResolvedPaths, TaskPlan, UserStory } from '../types.js';\nimport { printError, printInfo, printRetry, printSuccess, printWarning } from '../ui/logger.js';\nimport { printIterationHeader } from '../ui/progress.js';\nimport { printStartupHeader, printSummaryBox } from '../ui/summary.js';\nimport { committedStoryIds, getBaseBranch, isWorkingTreeClean } from '../utils/git.js';\nimport { applyAcceptanceToPlan, resolveIssueDir, runAcceptanceGate } from '../verify/gate.js';\nimport { executeClaude } from './executor.js';\nimport { divideUsage } from './metrics.js';\nimport { applyPlaceholders, loadPrompt } from './prompt-resolver.js';\nimport {\n EXECUTE_PHASE,\n elapsedSecondsSince,\n getPhaseUsageTotals,\n publishIterationMetrics,\n publishStoryMetrics,\n} from './session-metrics.js';\nimport { getSessionPublisher } from './session-publisher.js';\nimport { getShutdownSignal } from './shutdown.js';\nimport {\n allStoriesPass,\n applyStoryMetrics,\n clearLastError,\n hasPendingCorrection,\n initializeState,\n isoNow,\n loadTaskPlan,\n markIssueCompleted,\n markIssueInProgress,\n saveTaskPlan,\n selectActiveStory,\n setLastError,\n trimErrorMessage,\n} from './state-manager.js';\nimport {\n getInactivityTimeout,\n getOutputCallback,\n getStoryStageCallback,\n getStoryUpdateCallback,\n isVerbose,\n} from './verbose.js';\n\n/**\n * Emit a message through the output callback if available, otherwise console.log.\n * Used for bare console.log calls in engine functions so they route through listr2.\n */\nfunction emitLog(message: string): void {\n const cb = getOutputCallback();\n if (cb) {\n // Skip empty lines in listr2 context — they don't render meaningfully\n if (message) {\n cb(message);\n }\n } else {\n console.log(message);\n }\n}\n\n/** What one pass of the execute loop produces, retry or not. */\ninterface ExecuteAttempt {\n result: ClaudeResult;\n /** When the attempt started, for `clearLastError`. */\n startedAt: string;\n /** How long the attempt took, for the metrics split across stories. */\n seconds: number;\n /** The stories as they were before the agent ran, for attribution. */\n storiesBefore: UserStory[];\n}\n\n/**\n * The execute loop's retry budget, unchanged in effect from the hand-rolled\n * loop it replaces: `retryLimit` counts *retries*, so the attempt budget is one\n * more than it, and `retryForever` lifts the count while `backoffMaxSeconds`\n * still caps the wait.\n */\nfunction executeRetryPolicy(config: EngineConfig): RetryPolicy {\n return fixedBackoffPolicy(\n config.retryLimit + 1,\n config.backoffBaseSeconds,\n config.backoffMaxSeconds,\n { retryForever: config.retryForever },\n );\n}\n\n/**\n * Ids of the stories that flipped from `passes: false` to `passes: true`\n * between the two readings of the plan taken around one execute iteration.\n *\n * Stories already passing before the iteration, and stories that only exist in\n * the newer plan, are never attributed: nothing says this iteration paid for\n * them.\n */\nfunction newlyCompletedStoryIds(before: UserStory[], after: UserStory[]): string[] {\n const wasPassing = new Map(before.map((story) => [story.id, story.passes]));\n return after\n .filter((story) => story.passes && wasPassing.get(story.id) === false)\n .map((story) => story.id);\n}\n\nexport interface CommitPlaceholderOptions {\n issueNumber?: string | number | null;\n signoff?: boolean;\n type?: ChangeType;\n}\n\nfunction numericIssue(value: string | number | null | undefined): number | undefined {\n if (value === undefined || value === null || value === '') return undefined;\n const parsed = typeof value === 'number' ? value : Number(value);\n return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined;\n}\n\n/**\n * Commit message formats handed to the execute prompt.\n *\n * Built by `commitMessage()` so Conventional Commits is the default even when\n * the repository declared nothing. A scope is the issue id of a queue, which\n * is what makes `git log` on the shared branch readable per issue.\n */\nexport function commitPlaceholders(\n scope?: string,\n convention?: string | null,\n options?: CommitPlaceholderOptions,\n): Record<string, string> {\n const declared = convention !== undefined && convention !== null && convention !== '';\n const type = options?.type ?? 'feat';\n const issueNumber = numericIssue(options?.issueNumber);\n const resolvedScope = scope === undefined || scope === '' ? undefined : scope;\n\n if (declared && options?.type === undefined) {\n const suffix = resolvedScope === undefined ? '' : `(${resolvedScope})`;\n return {\n __COMMIT_MESSAGE__: commitMessage({\n type,\n scope: resolvedScope,\n subject: '[Story ID] - [Story Title]',\n issueNumber,\n signoff: options?.signoff,\n }).replace(`${type}${suffix}:`, `<type>${suffix}:`),\n __FIX_COMMIT_MESSAGE__: commitMessage({\n type: 'fix',\n scope: resolvedScope,\n subject: 'address review findings',\n issueNumber,\n signoff: options?.signoff,\n }),\n };\n }\n\n return {\n __COMMIT_MESSAGE__: commitMessage({\n type,\n scope: resolvedScope,\n subject: '[Story ID] - [Story Title]',\n issueNumber,\n signoff: options?.signoff,\n }),\n __FIX_COMMIT_MESSAGE__: commitMessage({\n type: 'fix',\n scope: resolvedScope,\n subject: 'address review findings',\n issueNumber,\n signoff: options?.signoff,\n }),\n };\n}\n\n/**\n * The watchdog budget of one iteration, from the process-wide setting.\n *\n * Absent means the default; `0` turns the watchdog off. Reading it here rather\n * than threading it through the engine's config keeps it a single value per\n * process, which is what it is.\n */\nfunction inactivityOptions(): { inactivityTimeoutMs?: number } {\n const configured = getInactivityTimeout();\n return configured === undefined ? {} : { inactivityTimeoutMs: configured };\n}\n\n/**\n * Mark as passing every pending story whose commit is already on the branch.\n *\n * Two conditions, and both are required:\n *\n * - the story's id appears in a commit subject of this branch, which is what\n * the execute prompt writes (`<type>(scope): US-001 - Title`);\n * - the working tree is **clean**, so nothing is half-applied. A dirty tree\n * means work in flight, and adopting a story on that basis would call\n * finished something that is not.\n *\n * Returns the ids it adopted. Never throws: a git that cannot answer, or a plan\n * that cannot be written, leaves the loop doing exactly what it did before.\n */\nasync function adoptCommittedStories(tasksPath: string): Promise<string[]> {\n try {\n const plan = await loadTaskPlan(tasksPath);\n const pending = plan.userStories.filter((story) => !story.passes);\n if (pending.length === 0) return [];\n\n if (!(await isWorkingTreeClean())) return [];\n\n const committed = await committedStoryIds(await getBaseBranch());\n const adopted = pending.filter((story) => committed.has(story.id)).map((story) => story.id);\n if (adopted.length === 0) return [];\n\n await saveTaskPlan(tasksPath, {\n ...plan,\n userStories: plan.userStories.map((story) =>\n adopted.includes(story.id) ? { ...story, passes: true } : story,\n ),\n });\n return adopted;\n } catch {\n return [];\n }\n}\n\n/**\n * Initialize the progress file if it doesn't exist.\n */\nasync function ensureProgressFile(progressFile: string): Promise<void> {\n if (!existsSync(progressFile)) {\n const content = `# Issue Flow Progress Log\\nStarted: ${new Date().toString()}\\n---\\n`;\n await writeFile(progressFile, content, 'utf-8');\n }\n}\n\n/**\n * Archive previous run artifacts if the branch has changed.\n */\nasync function archiveIfBranchChanged(plan: TaskPlan, paths: ResolvedPaths): Promise<void> {\n const { lastBranchFile, archiveDir, prdFile, progressFile } = paths;\n\n if (!existsSync(lastBranchFile)) {\n return;\n }\n\n const currentBranch = plan.branchName ?? '';\n let lastBranch = '';\n\n try {\n lastBranch = (await readFile(lastBranchFile, 'utf-8')).trim();\n } catch {\n return;\n }\n\n if (currentBranch && lastBranch && currentBranch !== lastBranch) {\n const dateStr = new Date().toISOString().split('T')[0];\n const folderName = archiveFolderName(lastBranch);\n const archiveFolder = join(archiveDir, `${dateStr}-${folderName}`);\n\n printInfo(`Archiving previous run: ${lastBranch}`);\n await mkdir(archiveFolder, { recursive: true });\n\n if (existsSync(prdFile)) {\n await cp(prdFile, join(archiveFolder, 'tasks.json'));\n }\n if (existsSync(progressFile)) {\n await cp(progressFile, join(archiveFolder, 'progress.txt'));\n }\n\n printInfo(` Archived to: ${archiveFolder}`);\n\n // Reset progress file for new run\n await writeFile(\n progressFile,\n `# Issue Flow Progress Log\\nStarted: ${new Date().toString()}\\n---\\n`,\n 'utf-8',\n );\n }\n}\n\n/**\n * Write the current branch to the last-branch tracking file.\n */\nasync function trackBranch(plan: TaskPlan, lastBranchFile: string): Promise<void> {\n const branch = plan.branchName ?? '';\n if (branch) {\n await writeFile(lastBranchFile, `${branch}\\n`, 'utf-8');\n }\n}\n\n/**\n * Run the issue-flow engine loop.\n *\n * This replicates the full execution flow:\n * 1. Load and initialize task plan state\n * 2. Check for early exit (already complete)\n * 3. Archive previous run if branch changed\n * 4. Resolve prompt\n * 5. Main loop: iterate, execute Claude, handle results\n * 6. Print summary\n */\nexport async function runEngine(config: EngineConfig, paths: ResolvedPaths): Promise<number> {\n // Load task plan\n if (!existsSync(paths.prdFile)) {\n printError(`PRD file not found at ${paths.prdFile}`);\n if (config.issueNumber) {\n emitLog(`Have you run the resolve-issue skill for issue #${config.issueNumber} first?`);\n }\n return 1;\n }\n\n let plan = await loadTaskPlan(paths.prdFile);\n plan = initializeState(plan);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Check if already completed. A pending correction (a failed review whose\n // findings haven't been addressed yet) always overrides this, even though\n // every userStories[].passes is already true — otherwise a correction\n // cycle's re-run of execute would exit here without ever looking at what\n // the review found.\n if (plan.issueStatus === 'completed' && allStoriesPass(plan) && !hasPendingCorrection(plan)) {\n emitLog(`Issue already marked complete in ${paths.prdFile}`);\n return 0;\n }\n\n // Warn if marked complete but stories still pending\n if (plan.issueStatus === 'completed' && !allStoriesPass(plan)) {\n printWarning(\n 'Issue marked completed but some stories are still pending. Resetting to in_progress.',\n );\n plan = markIssueInProgress(plan);\n plan = setLastError(\n plan,\n 'invalid_completion_state',\n 'tasks.json claimed the issue was completed before every story had passes=true.',\n );\n await saveTaskPlan(paths.prdFile, plan);\n }\n\n // Check if all stories already pass\n if (allStoriesPass(plan) && !hasPendingCorrection(plan)) {\n emitLog('All user stories already pass. Marking issue as completed.');\n plan = markIssueCompleted(plan);\n await saveTaskPlan(paths.prdFile, plan);\n return finishWithAcceptance(config, paths, plan);\n }\n\n // Archive previous run if branch changed\n await archiveIfBranchChanged(plan, paths);\n\n // Track current branch\n await trackBranch(plan, paths.lastBranchFile);\n\n // Initialize progress file\n await ensureProgressFile(paths.progressFile);\n\n // Load prompt template. The root is handed over rather than rediscovered:\n // it was resolved once by `resolvePaths()`, and a second `git rev-parse` here\n // would be a subprocess per run for an answer already in hand.\n const promptTemplate = await loadPrompt('execute', { projectRoot: paths.projectRoot });\n\n // The repository's own conventions, resolved once for the whole loop: they\n // cannot change mid-run, and every iteration renders the same projection.\n const policy = await resolvePolicyPlaceholders({ root: paths.projectRoot });\n const signoff = (await loadGlobalConfig()).commit?.signoff === true;\n\n const executeAgent = await resolveAgentFor('execute');\n printStartupHeader(config, plan, {\n provider: executeAgent.provider,\n model: executeAgent.model,\n ...(executeAgent.codex.reasoningEffort ? { detail: executeAgent.codex.reasoningEffort } : {}),\n });\n\n const startTime = Date.now();\n let i = 0;\n let totalRetryCount = 0;\n\n // Main loop\n while (true) {\n // Check iteration limit\n if (config.maxIterations !== undefined && i >= config.maxIterations) {\n break;\n }\n\n i++;\n\n // Safety net for the crash between a story's commit and the agent writing\n // `passes: true` (scenario I). The commit is the durable fact; the plan is\n // written after it, so a process that died in between leaves work that is\n // done and a plan that says it is not — and the next iteration redoes it on\n // top of a commit that already exists.\n //\n // This never *replaces* the agent's `passes`, which stays the primary\n // source: it only closes the window the agent cannot close itself.\n const adopted = await adoptCommittedStories(paths.prdFile);\n if (adopted.length > 0) {\n printInfo(\n `Adopting ${adopted.join(', ')}: already committed on this branch with a clean tree.`,\n );\n plan = await loadTaskPlan(paths.prdFile);\n if (plan.userStories.every((story) => story.passes) && plan.lastReviewFindings === null) {\n // Everything the loop was going to do is already done.\n break;\n }\n }\n\n // One iteration is one attempt of the Claude CLI, retried in place by the\n // project's single retry executor (`resilience/retry.ts`). A retry costs no\n // iteration budget, exactly as the `i--` it replaces cost none. Everything a\n // retried attempt has to redo — re-reading the plan, republishing\n // `iteration:start`, re-rendering the prompt — lives inside `attempt`,\n // because the loop this used to be written as re-ran all of it too.\n const attempted = await withRetry<ExecuteAttempt>(\n async () => {\n // Re-read plan to get latest state\n plan = await loadTaskPlan(paths.prdFile);\n // Publish the plan before naming its active story. This covers direct\n // `issue-flow execute` runs and resumes that never pass through the\n // plan runner, while retaining the empty-plan no-op contract.\n if (plan.userStories.length > 0) {\n getSessionPublisher().publish({\n type: 'stories:update',\n at: isoNow(),\n stories: plan.userStories,\n });\n }\n // Baseline for story attribution: whatever was still pending before the\n // agent ran is what this iteration can claim credit for.\n const storiesBefore = plan.userStories;\n\n // Highest-priority story with passes: false — the same rule\n // prompts/execute.md gives the agent. Computed once, here, and shared by\n // the published event and the verbose terminal header, so every surface\n // agrees on who is active instead of each deriving its own heuristic.\n const activeStoryId = selectActiveStory(plan.userStories)?.id;\n getSessionPublisher().publish({\n type: 'iteration:start',\n at: isoNow(),\n iteration: i,\n storyId: activeStoryId,\n });\n getStoryStageCallback()?.(activeStoryId);\n\n if (isVerbose()) {\n printIterationHeader(i, config.maxIterations, plan.userStories, activeStoryId);\n }\n\n // Apply placeholders to prompt\n const prompt = applyPlaceholders(promptTemplate, {\n __PRD_FILE__: paths.prdFile,\n __PROGRESS_FILE__: paths.progressFile,\n ...policy,\n // The convention comes off the projection above rather than from a second\n // discovery: one resolution per run is the whole point of the cache.\n ...commitPlaceholders(config.commitScope, policy.__COMMIT_CONVENTION__, {\n issueNumber: plan.issueNumber,\n signoff,\n }),\n __STORIES_PER_ITERATION__: String(config.storiesPerIteration ?? 1),\n });\n\n const startedAt = isoNow();\n plan = markIssueInProgress(plan, startedAt);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Execute Claude\n const startedAtMs = Date.now();\n const result = await executeClaude(prompt, {\n ...inactivityOptions(),\n iteration: i,\n correctionCycle: plan.correctionCycle,\n ...(activeStoryId === undefined ? {} : { storyIds: [activeStoryId] }),\n });\n const seconds = elapsedSecondsSince(startedAtMs);\n\n if (result.exitCode !== 0) {\n // A failed iteration still burned tokens: report them on the execute\n // phase, with no attribution to any story.\n publishIterationMetrics(i, result.cost, seconds);\n }\n\n return { result, startedAt, seconds, storiesBefore };\n },\n {\n policy: executeRetryPolicy(config),\n // A `Ctrl+C` during a fifteen-minute backoff must stop in that instant,\n // not fifteen minutes later. `abortableDelay` resolves `false` on the\n // abort, which `withRetry` reports as `aborted` rather than a failure.\n signal: getShutdownSignal(),\n // The exit code and the output are all the evidence the CLI leaves\n // behind, which is exactly what `isTransientFailure()` used to be given\n // here — `classify()` is the same verdict plus the kind.\n evaluate: ({ result }) =>\n result.exitCode === 0\n ? null\n : classify({ source: 'agent', exitCode: result.exitCode, stdout: result.output }),\n onAttempt: async ({ value, attempt, failure, willRetry, delayMs }) => {\n if (failure === null) return;\n\n const errorMessage = trimErrorMessage(value.result.output);\n\n if (!failure.retryable) {\n plan = await loadTaskPlan(paths.prdFile);\n plan = setLastError(plan, 'fatal_claude_failure', errorMessage);\n if (resolvePolicy(failure.kind, getActiveResilienceConfig()).onExhausted === 'block') {\n plan = {\n ...plan,\n runState: {\n currentPhase: 'execute',\n attempt,\n owner: plan.runState?.owner ?? null,\n status: 'blocked',\n blockedReason: errorMessage,\n lastHeartbeatAt: isoNow(),\n },\n };\n }\n await saveTaskPlan(paths.prdFile, plan);\n return;\n }\n\n // Recorded even on the attempt that spends the last of the budget:\n // the run ends on a transient failure, and the plan has to say so.\n totalRetryCount++;\n plan = await loadTaskPlan(paths.prdFile);\n plan = setLastError(plan, 'transient_claude_failure', errorMessage);\n await saveTaskPlan(paths.prdFile, plan);\n if (!willRetry) return;\n\n const delaySeconds = delayMs / 1000;\n getSessionPublisher().publish({\n type: 'retry',\n at: isoNow(),\n attempt,\n delaySeconds,\n reason: 'transient_claude_failure',\n kind: failure.kind,\n });\n\n if (isVerbose()) {\n emitLog('');\n }\n printRetry(\n `Transient Claude failure on iteration ${i} (attempt ${attempt}). Retrying in ${delaySeconds}s.`,\n );\n },\n },\n );\n\n const {\n result,\n seconds: iterationSeconds,\n storiesBefore: storiesBeforeIteration,\n } = attempted.value;\n const iterationStartedAt = attempted.value.startedAt;\n\n if (result.exitCode !== 0) {\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n plan = await loadTaskPlan(paths.prdFile);\n printSummaryBox(\n 'failed',\n i,\n totalRetryCount,\n elapsed,\n plan,\n attempted.exhausted\n ? `Exceeded retry limit (${config.retryLimit}) on transient errors`\n : `Claude CLI failed with exit code ${result.exitCode}`,\n getPhaseUsageTotals(EXECUTE_PHASE),\n );\n return result.exitCode;\n }\n\n plan = await loadTaskPlan(paths.prdFile);\n plan = clearLastError(plan, iterationStartedAt);\n await saveTaskPlan(paths.prdFile, plan);\n\n // Notify story progress listeners (e.g., listr2 subtasks)\n const storyUpdateCb = getStoryUpdateCallback();\n if (storyUpdateCb) {\n storyUpdateCb(plan.userStories);\n }\n getSessionPublisher().publish({\n type: 'stories:update',\n at: isoNow(),\n stories: plan.userStories,\n });\n\n // Story attribution — an approximation by construction: the CLI reports a\n // single usage for the whole iteration, so the stories that flipped to\n // passing in it split tokens, cost and duration evenly. With none, nothing\n // is attributed and the whole cost stays on the execute phase. Published\n // after stories:update, which rebuilds the stories array.\n const completedStoryIds = newlyCompletedStoryIds(storiesBeforeIteration, plan.userStories);\n if (completedStoryIds.length > 0) {\n const storyShare = divideUsage(result.cost, completedStoryIds.length);\n const storySeconds = Math.round(iterationSeconds / completedStoryIds.length);\n for (const storyId of completedStoryIds) {\n publishStoryMetrics(storyId, storyShare, storySeconds);\n }\n\n // The same shares also land on tasks.json, so the numbers outlive the\n // session and are readable with web monitoring off. Persisting them is\n // observational: a write failure must never change the iteration's\n // outcome, so the plan in memory only advances when the write succeeded.\n const planWithMetrics = applyStoryMetrics(plan, completedStoryIds, storyShare, storySeconds);\n try {\n await saveTaskPlan(paths.prdFile, planWithMetrics);\n plan = planWithMetrics;\n } catch {\n // Metrics are a nice-to-have; the iteration succeeded regardless.\n }\n }\n\n getSessionPublisher().publish({ type: 'iteration:end', at: isoNow(), iteration: i });\n publishIterationMetrics(i, result.cost, iterationSeconds);\n\n // Check for completion signal\n if (result.output.includes('<promise>COMPLETE</promise>')) {\n plan = await loadTaskPlan(paths.prdFile);\n if (allStoriesPass(plan) && !hasPendingCorrection(plan)) {\n plan = markIssueCompleted(plan);\n await saveTaskPlan(paths.prdFile, plan);\n\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n printSummaryBox(\n 'success',\n i,\n totalRetryCount,\n elapsed,\n plan,\n undefined,\n getPhaseUsageTotals(EXECUTE_PHASE),\n );\n return finishWithAcceptance(config, paths, plan);\n }\n\n plan = setLastError(\n plan,\n 'invalid_completion_signal',\n hasPendingCorrection(plan)\n ? 'Claude returned <promise>COMPLETE</promise> while lastReviewFindings was still set.'\n : 'Claude returned <promise>COMPLETE</promise> before every story had passes=true.',\n );\n await saveTaskPlan(paths.prdFile, plan);\n\n emitLog('');\n printWarning(\n hasPendingCorrection(plan)\n ? 'Claude returned a completion signal, but lastReviewFindings is still set. Ignoring completion and continuing.'\n : 'Claude returned a completion signal, but tasks.json still has pending stories. Ignoring completion and continuing.',\n );\n }\n\n if (isVerbose()) {\n printSuccess(`Iteration ${i} complete. Continuing...`);\n }\n }\n\n // Reached max iterations\n const elapsed = Math.floor((Date.now() - startTime) / 1000);\n plan = await loadTaskPlan(paths.prdFile);\n printSummaryBox(\n 'incomplete',\n config.maxIterations ?? i,\n totalRetryCount,\n elapsed,\n plan,\n 'Reached max iterations without completing all tasks.',\n getPhaseUsageTotals(EXECUTE_PHASE),\n );\n return 1;\n}\n\nasync function finishWithAcceptance(\n config: EngineConfig,\n paths: ResolvedPaths,\n plan: TaskPlan,\n): Promise<number> {\n const issueDir = resolveIssueDir(config, paths);\n const outcome = await runAcceptanceGate({\n issueDir,\n cwd: paths.projectRoot,\n addDirs: config.issueNumber === undefined ? undefined : [issueDir],\n skipReviewer: true,\n });\n const applied = applyAcceptanceToPlan(plan, outcome);\n if (applied.failed) {\n await saveTaskPlan(paths.prdFile, applied.plan);\n return 1;\n }\n return 0;\n}\n","import chalk from 'chalk';\nimport { getOutputCallback } from '../core/verbose.js';\nimport type { UserStory } from '../types.js';\nimport { getIcons, useColor, useUnicode } from './logger.js';\n\n/**\n * Print a visual progress bar showing passed/total stories.\n */\nexport function printProgressBar(passed: number, total: number): string {\n const barWidth = 20;\n let pct = 0;\n let filled = 0;\n\n if (total > 0) {\n pct = Math.floor((passed * 100) / total);\n filled = Math.floor((passed * barWidth) / total);\n }\n\n const empty = barWidth - filled;\n const fillChar = useUnicode() ? '\\u2588' : '#';\n const emptyChar = useUnicode() ? '\\u2591' : '-';\n\n const bar = fillChar.repeat(filled) + emptyChar.repeat(empty);\n const text = `${passed}/${total} (${pct}%)`;\n\n if (useColor()) {\n return `${chalk.green(bar)} ${text}`;\n }\n return `${bar} ${text}`;\n}\n\n/**\n * Print the iteration header showing story statuses and progress bar.\n *\n * When a global output callback is set (e.g., inside a listr2 task),\n * output is routed through it instead of console.log.\n *\n * `activeStoryId`, when provided, identifies the story the engine is\n * actually about to work on this iteration (the same id published on\n * `iteration:start` \\u2014 see `core/state-manager.ts`'s `selectActiveStory`),\n * so the header agrees with the session snapshot instead of guessing.\n * Omitted, it falls back to the previous heuristic (\"first non-passing story\n * in array order\"), which existing callers that cannot supply the real id\n * keep relying on.\n */\nexport function printIterationHeader(\n iteration: number,\n maxIter: number | undefined,\n stories: UserStory[],\n activeStoryId?: string,\n): void {\n const icons = getIcons();\n const colored = useColor();\n const cb = getOutputCallback();\n\n const iterLabel = maxIter ? `Iteration ${iteration} of ${maxIter}` : `Iteration ${iteration}`;\n\n const total = stories.length;\n const passed = stories.filter((s) => s.passes).length;\n\n const lines: string[] = [];\n\n if (colored) {\n lines.push(chalk.blue(`\\u2501\\u2501\\u2501 ${icons.start} ${iterLabel} \\u2501\\u2501\\u2501`));\n } else {\n lines.push(`--- ${icons.start} ${iterLabel} ---`);\n }\n\n // Display each story status\n let foundFirstPending = false;\n for (const story of stories) {\n let icon: string;\n let colorFn: (s: string) => string;\n const isActive =\n activeStoryId !== undefined\n ? story.id === activeStoryId\n : !story.passes && !foundFirstPending;\n\n if (story.passes) {\n icon = icons.success;\n colorFn = colored ? chalk.green : (s: string) => s;\n } else if (isActive) {\n icon = icons.pending;\n colorFn = colored ? chalk.yellow : (s: string) => s;\n foundFirstPending = true;\n } else {\n // Not yet reached\n icon = icons.notReached;\n colorFn = colored ? chalk.gray : (s: string) => s;\n }\n\n lines.push(colorFn(` ${icon} ${story.id}: ${story.title}`));\n }\n\n lines.push(` ${printProgressBar(passed, total)}`);\n\n if (cb) {\n // Send as single output to listr2 task context\n cb(lines.join('\\n'));\n } else {\n console.log('');\n for (const line of lines) {\n console.log(line);\n }\n console.log('');\n }\n}\n","import chalk from 'chalk';\nimport { type ClaudeUsage, formatTokens } from '../core/metrics.js';\nimport { groupBy, summarize } from '../telemetry/aggregate.js';\nimport type { EngineConfig, PrReviewRecommendation, TaskPlan } from '../types.js';\nimport {\n formatDuration,\n getIcons,\n getTermWidth,\n printSuccess,\n printWarning,\n useColor,\n useUnicode,\n} from './logger.js';\n\n/**\n * Truncate or pad a string to fit within a given width.\n */\nfunction fitLine(text: string, width: number): string {\n if (text.length > width) {\n return text.substring(0, width);\n }\n return text.padEnd(width);\n}\n\n/**\n * Print a box with border characters around content lines.\n * Lines equal to \"---\" render as separator rows.\n */\nexport function printBox(lines: string[]): void {\n const colored = useColor();\n const unicode = useUnicode();\n const termWidth = getTermWidth();\n\n // Find max content width\n let maxContentWidth = 0;\n for (const line of lines) {\n if (line !== '---' && line.length > maxContentWidth) {\n maxContentWidth = line.length;\n }\n }\n\n // Cap to terminal width (border + padding = 4 chars)\n const available = termWidth - 4;\n if (maxContentWidth > available) {\n maxContentWidth = available;\n }\n if (maxContentWidth < 20) {\n maxContentWidth = 20;\n }\n\n // Box drawing characters\n const tl = unicode ? '\\u256D' : '+';\n const tr = unicode ? '\\u256E' : '+';\n const bl = unicode ? '\\u2570' : '+';\n const br = unicode ? '\\u256F' : '+';\n const h = unicode ? '\\u2500' : '-';\n const v = unicode ? '\\u2502' : '|';\n const sepL = unicode ? '\\u251C' : '+';\n const sepR = unicode ? '\\u2524' : '+';\n\n const hrule = h.repeat(maxContentWidth + 2);\n\n const blue = colored ? chalk.blue : (s: string) => s;\n const _reset = (s: string) => s;\n\n // Top border\n console.log(blue(`${tl}${hrule}${tr}`));\n\n // Content lines\n for (const line of lines) {\n if (line === '---') {\n console.log(blue(`${sepL}${hrule}${sepR}`));\n } else {\n const fitted = fitLine(line, maxContentWidth);\n console.log(`${blue(v)} ${fitted} ${blue(v)}`);\n }\n }\n\n // Bottom border\n console.log(blue(`${bl}${hrule}${br}`));\n}\n\n/**\n * Print the startup header box showing engine configuration.\n */\nexport interface StartupAgentInfo {\n provider: string;\n model?: string | null;\n detail?: string;\n}\n\nexport function printStartupHeader(\n config: EngineConfig,\n plan: TaskPlan,\n agent?: StartupAgentInfo,\n): void {\n const icons = getIcons();\n\n const storiesTotal = plan.userStories.length;\n const storiesPassing = plan.userStories.filter((s) => s.passes).length;\n const branchName = plan.branchName ?? 'N/A';\n\n const issueLabel = config.issueNumber ? `Issue #${config.issueNumber}` : 'Standalone mode';\n\n const maxIterLabel =\n config.maxIterations !== undefined ? String(config.maxIterations) : 'unlimited';\n\n const retryLabel = config.retryForever\n ? 'unlimited retries'\n : `${config.retryLimit} consecutive retries`;\n\n const lines = [\n `${icons.start} Issue Flow`,\n '---',\n `Issue: ${issueLabel}`,\n `Branch: ${branchName}`,\n `Stories: ${storiesPassing}/${storiesTotal} passing`,\n `Iterations: ${maxIterLabel}`,\n `Retries: ${retryLabel}`,\n ];\n const remaining = storiesTotal - storiesPassing;\n if (remaining > 0) {\n // p50 of execute on the #79 baseline (US-009/US-010 mean, single observation).\n const p50ExecuteSeconds = 518;\n lines.push(\n `Estimate: ~${formatDuration(remaining * p50ExecuteSeconds)} (${remaining} × p50 execute)`,\n );\n }\n if (agent) {\n const model = agent.model ? ` · ${agent.model}` : '';\n const detail = agent.detail ? ` (${agent.detail})` : '';\n lines.push(`Agent: ${agent.provider}${model}${detail}`);\n }\n printBox(lines);\n}\n\n/**\n * Print the final summary box.\n */\nexport function printSummaryBox(\n status: 'success' | 'incomplete' | 'failed',\n iterations: number,\n totalRetries: number,\n elapsedSeconds: number,\n plan: TaskPlan,\n extraInfo?: string,\n /**\n * Tokens and cost spent by this run, already resolved by the caller (the\n * process-owned counters in `core/session-metrics.ts`, never the session\n * snapshot — that one is empty whenever web monitoring is off). Omitted or\n * empty means \"the CLI reported nothing\", and the line is skipped entirely.\n */\n usage?: ClaudeUsage | null,\n usageByAgent?: Record<string, ClaudeUsage>,\n): void {\n const icons = getIcons();\n\n const storiesTotal = plan.userStories.length;\n const storiesPassing = plan.userStories.filter((s) => s.passes).length;\n const duration = formatDuration(elapsedSeconds);\n\n let statusIcon: string;\n let statusLabel: string;\n\n switch (status) {\n case 'success':\n statusIcon = icons.success;\n statusLabel = 'Completed';\n break;\n case 'incomplete':\n statusIcon = icons.warn;\n statusLabel = 'Incomplete';\n break;\n case 'failed':\n statusIcon = icons.fail;\n statusLabel = 'Failed';\n break;\n }\n\n const boxLines = [\n `${icons.end} Issue Flow Summary`,\n '---',\n `Status: ${statusIcon} ${statusLabel}`,\n `Stories: ${storiesPassing}/${storiesTotal} passing`,\n `Iterations: ${iterations}`,\n `Duration: ${duration}`,\n ];\n\n boxLines.push(...tokenBoxLines(usage, usageByAgent));\n boxLines.push(...executionCostLines(plan));\n\n boxLines.push(`Retries: ${totalRetries}`);\n\n if (extraInfo) {\n boxLines.push('---');\n boxLines.push(extraInfo);\n }\n\n console.log('');\n printBox(boxLines);\n}\n\n/**\n * What the optional `pr-review` phase produced, as far as the summary cares.\n * `null` in `recommendation` means the verdict could not be recovered from\n * disk — the exit code still told us whether changes were requested.\n */\nexport interface RunSummaryPrReview {\n requestedChanges: boolean;\n recommendation: PrReviewRecommendation | null;\n reportPath: string | null;\n}\n\n/**\n * Everything the final `run` summary prints, already resolved by the caller.\n */\nexport interface RunSummaryInfo {\n issueNumber: string;\n /** 'unknown' when the branch could not be detected. */\n branchName: string;\n /** Pipelines run with --no-branch open no Pull Request. */\n noBranch: boolean;\n storyCount: number;\n elapsedSeconds: number;\n /** 'unknown' when no Pull Request could be resolved. */\n prUrl: string;\n /** Only set when the pr-review phase actually ran. */\n prReview?: RunSummaryPrReview | null;\n /**\n * Tokens and cost of the whole pipeline, from the process-owned counters in\n * `core/session-metrics.ts`. Absent or empty omits the line.\n */\n usage?: ClaudeUsage | null;\n /** When more than one agent ran, the summary prints one Tokens line each. */\n usageByAgent?: Record<string, ClaudeUsage>;\n /** Acceptance-contract verdict. Absent when the contract never ran. */\n verification?: { verdict: 'passed' | 'failed' | 'unverified'; level?: string | null } | null;\n}\n\nfunction executionCostLines(plan: TaskPlan, prefix = 'Cost: '): string[] {\n const records = plan.executions ?? [];\n if (records.length === 0) return [];\n const lines: string[] = [];\n const groups = groupBy(records, 'harness');\n let index = 0;\n const pad = ' '.repeat(prefix.length);\n for (const [harness, summary] of groups) {\n const parts: string[] = [];\n if (summary.totalCost.reported > 0) {\n parts.push(`$${summary.totalCost.reported.toFixed(4)} reported`);\n }\n if (summary.totalCost.estimated > 0) {\n parts.push(`$${summary.totalCost.estimated.toFixed(4)} estimated`);\n }\n if (summary.totalCost.unknownExecutions > 0) {\n parts.push(`${summary.totalCost.unknownExecutions} unknown`);\n }\n if (parts.length === 0) {\n const totals = summarize(records).totalCost;\n if (totals.reported === 0 && totals.estimated === 0) {\n parts.push('not reported');\n }\n }\n if (parts.length === 0) continue;\n lines.push(`${index === 0 ? prefix : pad}${harness} · ${parts.join(' · ')}`);\n index += 1;\n }\n return lines;\n}\n\nfunction tokenBoxLines(\n usage?: ClaudeUsage | null,\n usageByAgent?: Record<string, ClaudeUsage>,\n): string[] {\n const agents = usageByAgent ? Object.keys(usageByAgent) : [];\n if (agents.length > 1) {\n const lines: string[] = [];\n for (const [index, id] of agents.entries()) {\n const tokens = formatTokens(usageByAgent?.[id]);\n if (tokens === '') continue;\n lines.push(index === 0 ? `Tokens: ${id} · ${tokens}` : ` ${id} · ${tokens}`);\n }\n return lines;\n }\n const tokens = formatTokens(usage);\n return tokens === '' ? [] : [`Tokens: ${tokens}`];\n}\n\nfunction tokenSummaryLines(\n usage?: ClaudeUsage | null,\n usageByAgent?: Record<string, ClaudeUsage>,\n prefix = ' Tokens: ',\n): string[] {\n const agents = usageByAgent ? Object.keys(usageByAgent) : [];\n if (agents.length > 1) {\n const pad = ' '.repeat(prefix.length);\n const lines: string[] = [];\n for (const [index, id] of agents.entries()) {\n const tokens = formatTokens(usageByAgent?.[id]);\n if (tokens === '') continue;\n lines.push(`${index === 0 ? prefix : pad}${id} · ${tokens}`);\n }\n return lines;\n }\n const tokens = formatTokens(usage);\n return tokens === '' ? [] : [`${prefix}${tokens}`];\n}\n\n/**\n * Detail lines of the final `run` summary (everything below the headline).\n *\n * Kept separate from the printing so the shape is testable without capturing\n * stdout. Without `prReview` the lines are exactly the ones the pipeline has\n * always printed.\n */\nexport function buildRunSummaryLines(info: RunSummaryInfo): string[] {\n const lines = [\n ` Branch: ${info.branchName}${info.noBranch ? ' (current)' : ''}`,\n ` Stories: ${info.storyCount}`,\n ` Duration: ${formatDuration(info.elapsedSeconds)}`,\n ];\n\n lines.push(...tokenSummaryLines(info.usage, info.usageByAgent));\n\n if (!info.noBranch) {\n lines.push(` PR: ${info.prUrl}`);\n }\n\n if (info.verification != null) {\n const label =\n info.verification.verdict === 'passed'\n ? 'passed'\n : info.verification.verdict === 'failed'\n ? 'failed'\n : 'unverified';\n lines.push(` Contract: ${label}`);\n }\n\n const review = info.prReview;\n if (review) {\n // The exit code is the source of truth for the verdict, so a report whose\n // recommendation could not be read still reports REQUEST_CHANGES.\n const verdict =\n review.recommendation ?? (review.requestedChanges ? 'REQUEST_CHANGES' : 'unknown');\n lines.push(` Review: ${verdict}`);\n if (review.reportPath !== null) {\n lines.push(` Report: ${review.reportPath}`);\n }\n }\n\n return lines;\n}\n\n/** One issue of a multi-issue queue, as the consolidated summary reports it. */\nexport interface QueueIssueSummary {\n id: string;\n title: string;\n storyCount: number;\n elapsedSeconds: number;\n /** Tokens and cost of this issue alone — never of the whole queue. */\n usage?: ClaudeUsage | null;\n}\n\n/** Everything the consolidated summary of a queue prints. */\nexport interface QueueSummaryInfo {\n /** Identifier of the queue, i.e. of its primary issue. */\n queueId: string;\n /** Branch every issue shared, `null` when the queue ran with --no-branch. */\n branchName: string | null;\n issues: QueueIssueSummary[];\n /** Issues discovered but left out of the run. */\n excluded: { id: string; title: string }[];\n elapsedSeconds: number;\n /** The single consolidated Pull Request, `null` when none was opened. */\n prUrl: string | null;\n /** Tokens and cost of the whole queue. */\n usage?: ClaudeUsage | null;\n /** Verdict of the pr-review phase, when the queue ran it. */\n prReview?: RunSummaryPrReview | null;\n}\n\n/**\n * Detail lines of a queue's final summary.\n *\n * Per-issue lines carry their own duration and cost, which is the visible half\n * of the per-issue metric scoping: what one issue spent is never folded into\n * another's line.\n */\nexport function buildQueueSummaryLines(info: QueueSummaryInfo): string[] {\n const lines: string[] = [];\n\n lines.push(` Branch: ${info.branchName ?? 'current'}`);\n lines.push(` Issues: ${info.issues.length}`);\n\n for (const issue of info.issues) {\n const tokens = formatTokens(issue.usage);\n const title = issue.title === '' ? '' : ` ${issue.title}`;\n lines.push(\n ` #${issue.id}${title} — ${issue.storyCount} stories, ${formatDuration(issue.elapsedSeconds)}` +\n (tokens === '' ? '' : `, ${tokens}`),\n );\n }\n\n lines.push(` Duration: ${formatDuration(info.elapsedSeconds)}`);\n\n const tokens = formatTokens(info.usage);\n if (tokens !== '') {\n lines.push(` Tokens: ${tokens}`);\n }\n if (info.prUrl !== null) {\n lines.push(` PR: ${info.prUrl}`);\n }\n if (info.excluded.length > 0) {\n lines.push(` Skipped: ${info.excluded.map((entry) => `#${entry.id}`).join(', ')}`);\n }\n\n const review = info.prReview;\n if (review) {\n lines.push(\n ` Review: ${review.recommendation ?? (review.requestedChanges ? 'REQUEST_CHANGES' : 'unknown')}`,\n );\n if (review.reportPath !== null) {\n lines.push(` Report: ${review.reportPath}`);\n }\n }\n\n return lines;\n}\n\n/** Print the consolidated summary of a multi-issue queue. */\nexport function printQueueSummary(info: QueueSummaryInfo): void {\n console.log('');\n if (info.prReview?.requestedChanges === true) {\n printWarning(`Queue finished for issue #${info.queueId}, but the PR review requested changes.`);\n } else {\n printSuccess(`Queue complete for issue #${info.queueId} (${info.issues.length} issues)!`);\n }\n for (const line of buildQueueSummaryLines(info)) {\n console.log(line);\n }\n}\n\n/**\n * Print the final summary of a `run` (the flat listing, not the box used by\n * the execute engine).\n */\nexport function printRunSummary(info: RunSummaryInfo): void {\n console.log('');\n if (info.prReview?.requestedChanges) {\n printWarning(\n `Pipeline finished for issue #${info.issueNumber}, but the PR review requested changes.`,\n );\n } else if (info.verification?.verdict === 'unverified') {\n printWarning(\n `Pipeline finished for issue #${info.issueNumber}, but the acceptance contract is unverified.`,\n );\n } else if (info.verification?.verdict === 'failed') {\n printWarning(\n `Pipeline finished for issue #${info.issueNumber}, but the acceptance contract failed.`,\n );\n } else {\n printSuccess(`Pipeline complete for issue #${info.issueNumber}!`);\n }\n for (const line of buildRunSummaryLines(info)) {\n console.log(line);\n }\n}\n","/**\n * Strip the markdown markers that leak into a terminal that cannot render them.\n *\n * Used by the clean view and by failure excerpts. Verbose mode keeps the\n * original text — this is only for the default surface.\n */\nexport function stripMarkdown(text: string): string {\n return text\n .replace(/```[\\s\\S]*?```/g, ' ')\n .replace(/`([^`]+)`/g, '$1')\n .replace(/\\*\\*([^*]+)\\*\\*/g, '$1')\n .replace(/__([^_]+)__/g, '$1')\n .replace(/(?<!\\*)\\*([^*]+)\\*(?!\\*)/g, '$1')\n .replace(/^#{1,6}\\s+/gm, '')\n .replace(/^\\s*[-*+]\\s+/gm, '')\n .replace(/\\[([^\\]]+)\\]\\([^)]+\\)/g, '$1')\n .replace(/[ \\t]{2,}/g, ' ')\n .trim();\n}\n\n/** Last non-empty lines of a failure report, already stripped of markdown. */\nexport function failureExcerpt(output: string, limit = 8): string[] {\n return output\n .split('\\n')\n .map((line) => stripMarkdown(line))\n .filter((line) => line.length > 0)\n .slice(-limit);\n}\n","import { invokeSelectedAgent } from '../agents/invoke.js';\nimport type { ClaudeResult } from '../types.js';\nimport { failureExcerpt } from '../ui/text.js';\nimport { getOutputCallback, isVerbose } from './verbose.js';\n\nexport interface ExecuteClaudeOptions {\n /**\n * Silence tolerated before the agent is considered stuck. `0` disables the\n * watchdog, which is the behaviour every release before it had.\n */\n inactivityTimeoutMs?: number;\n iteration?: number;\n correctionCycle?: number;\n storyIds?: string[];\n}\n\n/**\n * Execute the resolved agent with a prompt piped to stdin.\n *\n * The default (Claude, unconfigured) is still\n * `claude --dangerously-skip-permissions --print --output-format stream-json --verbose`\n * with the prompt on stdin and `timeout: 0`. Callers see `exitCode`, the\n * assistant text as `output`, and usage. On failure the raw diagnostics stay\n * unwrapped so `isTransientFailure()` can read them.\n */\nexport async function executeClaude(\n prompt: string,\n options: ExecuteClaudeOptions = {},\n): Promise<ClaudeResult> {\n let selected: Awaited<ReturnType<typeof invokeSelectedAgent>>;\n try {\n selected = await invokeSelectedAgent({\n prompt,\n phase: 'execute',\n timeout: 0,\n permission: 'autonomous',\n inactivityTimeoutMs: options.inactivityTimeoutMs,\n iteration: options.iteration,\n correctionCycle: options.correctionCycle,\n storyIds: options.storyIds,\n });\n } catch (err) {\n return {\n exitCode: 1,\n output: err instanceof Error ? err.message : String(err),\n cost: null,\n };\n }\n const { run } = selected;\n\n let output: string;\n let cost = run.usage;\n\n if (!run.success || run.exitCode !== 0) {\n output = run.rawOutput || run.error || '';\n cost = null;\n } else {\n output = run.result || run.rawOutput;\n }\n\n emitAgentOutput(output, !(run.success && run.exitCode === 0));\n\n return {\n exitCode: run.exitCode === 0 && run.success ? 0 : run.exitCode === 0 ? 1 : run.exitCode,\n output,\n cost,\n };\n}\n\n/**\n * Clean mode never dumps the agent report. Verbose breaks it line by line.\n * A failure always prints a short excerpt — the user should not need\n * `--verbose` to see why a story stopped.\n */\nfunction emitAgentOutput(output: string, failed: boolean): void {\n const onOutput = getOutputCallback();\n if (!onOutput) return;\n const trimmed = output.trim();\n if (!trimmed) return;\n\n if (isVerbose()) {\n for (const line of trimmed.split('\\n')) {\n if (line.trim()) onOutput(line);\n }\n return;\n }\n\n if (failed) {\n for (const line of failureExcerpt(trimmed)) {\n onOutput(line);\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAAS,kBAAkB;;;ACA3B,SAAS,kBAAkB;AAC3B,SAAS,IAAI,OAAO,UAAU,iBAAiB;AAC/C,SAAS,YAAY;;;ACFrB,OAAO,WAAW;AAQX,SAAS,iBAAiB,QAAgB,OAAuB;AACtE,QAAM,WAAW;AACjB,MAAI,MAAM;AACV,MAAI,SAAS;AAEb,MAAI,QAAQ,GAAG;AACb,UAAM,KAAK,MAAO,SAAS,MAAO,KAAK;AACvC,aAAS,KAAK,MAAO,SAAS,WAAY,KAAK;AAAA,EACjD;AAEA,QAAM,QAAQ,WAAW;AACzB,QAAM,WAAW,WAAW,IAAI,WAAW;AAC3C,QAAM,YAAY,WAAW,IAAI,WAAW;AAE5C,QAAM,MAAM,SAAS,OAAO,MAAM,IAAI,UAAU,OAAO,KAAK;AAC5D,QAAM,OAAO,GAAG,MAAM,IAAI,KAAK,KAAK,GAAG;AAEvC,MAAI,SAAS,GAAG;AACd,WAAO,GAAG,MAAM,MAAM,GAAG,CAAC,IAAI,IAAI;AAAA,EACpC;AACA,SAAO,GAAG,GAAG,IAAI,IAAI;AACvB;AAgBO,SAAS,qBACd,WACA,SACA,SACA,eACM;AACN,QAAM,QAAQ,SAAS;AACvB,QAAM,UAAU,SAAS;AACzB,QAAM,KAAK,kBAAkB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AAAA,MACrD,CAAC;AACD,0BAAoB,QAAQ;AAAA,QAC1B,MAAM;AAAA,QACN,IAAI,OAAO;AAAA,QACX,QAAQ,UAAU,cAAc;AAAA,MAClC,CAAC;AACD,YAAM,oBAAoB,MAAM;AAChC,0BAAoB,MAAS;AAAA,IAC/B;AAAA,EACF;AACF;","names":["chalk","chalk","tokens","result","elapsed","numericIssue"]}
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  EXECUTION_PURPOSES,
4
4
  getTelemetryContext
5
- } from "./chunk-6FDFRNXZ.js";
5
+ } from "./chunk-TBDP6QPJ.js";
6
6
  import {
7
7
  loadTaskPlan
8
- } from "./chunk-DIG5XKQQ.js";
8
+ } from "./chunk-XQHFC62U.js";
9
9
 
10
10
  // src/telemetry/timing.ts
11
11
  var EMPTY_TIMING = {
@@ -117,4 +117,4 @@ export {
117
117
  formatPhaseLine,
118
118
  snapshotTimingFields
119
119
  };
120
- //# sourceMappingURL=chunk-37N2RJW2.js.map
120
+ //# sourceMappingURL=chunk-ZPIVCM7Q.js.map
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  getGlobalRoot
4
- } from "./chunk-TX5WIVYP.js";
4
+ } from "./chunk-HAKDLR6N.js";
5
5
  import {
6
6
  getProjectRoot
7
- } from "./chunk-KQHB7ZT3.js";
7
+ } from "./chunk-GSZCQUCY.js";
8
8
  import {
9
9
  writeFileAtomic
10
10
  } from "./chunk-7Z4Y3VKM.js";
@@ -74,4 +74,4 @@ export {
74
74
  ensureCursorStorageGrant,
75
75
  cursorStorageGranted
76
76
  };
77
- //# sourceMappingURL=chunk-TVN2JVOF.js.map
77
+ //# sourceMappingURL=chunk-ZXPASFHG.js.map
package/dist/cli.js CHANGED
@@ -9,22 +9,25 @@ import {
9
9
  setRoutingCliOverrides,
10
10
  setVerifyCliOverrides,
11
11
  setWebCliOverrides
12
- } from "./chunk-CNBYCMSU.js";
13
- import "./chunk-HQAHNIAR.js";
12
+ } from "./chunk-WM3Y7Q4A.js";
13
+ import "./chunk-VR34TXHF.js";
14
14
  import {
15
15
  printError,
16
16
  setGlobalTimeout,
17
17
  setInactivityTimeout,
18
18
  setVerbose
19
- } from "./chunk-IYV6KNVF.js";
20
- import "./chunk-6FDFRNXZ.js";
19
+ } from "./chunk-NVZMBXTE.js";
20
+ import "./chunk-6QYMSNVA.js";
21
+ import "./chunk-AYYMW33T.js";
22
+ import "./chunk-HAKDLR6N.js";
23
+ import "./chunk-GSZCQUCY.js";
24
+ import "./chunk-TBDP6QPJ.js";
21
25
  import "./chunk-P3LRUNC6.js";
22
- import "./chunk-DIG5XKQQ.js";
26
+ import "./chunk-UNQYMR3H.js";
27
+ import "./chunk-XQHFC62U.js";
23
28
  import {
24
29
  isAgentProviderId
25
- } from "./chunk-NEZZ6KDR.js";
26
- import "./chunk-TX5WIVYP.js";
27
- import "./chunk-KQHB7ZT3.js";
30
+ } from "./chunk-XDKGA6UX.js";
28
31
  import "./chunk-7Z4Y3VKM.js";
29
32
  import "./chunk-XEYH6ZZI.js";
30
33
 
@@ -33,6 +36,18 @@ import { createRequire } from "module";
33
36
  import { Command, InvalidArgumentError, Option } from "commander";
34
37
 
35
38
  // src/cli-options.ts
39
+ function resolveWebOverrides(opts) {
40
+ const overrides = {};
41
+ if (opts.web === true || opts.serve === true || opts.restartWeb === true) {
42
+ overrides.enabled = true;
43
+ }
44
+ if (opts.port !== void 0) overrides.port = opts.port;
45
+ if (opts.host !== void 0) overrides.host = opts.host;
46
+ if (opts.refresh !== void 0) overrides.refreshSeconds = opts.refresh;
47
+ if (opts.webLogLimit !== void 0) overrides.logLimit = opts.webLogLimit;
48
+ if (opts.webNoLogs === true) overrides.includeLogs = false;
49
+ return overrides;
50
+ }
36
51
  function resolveNoBranch(options) {
37
52
  return options.branch === false ? true : void 0;
38
53
  }
@@ -276,33 +291,11 @@ function withResilienceOptions(cmd) {
276
291
  return cmd.option("--continuous", "Long-running profile: keep going without supervision").option("--resilient", "Alias of --continuous").option("--no-failover", "Never migrate a phase to another agent provider").option("--auto-decompose", "Act on a decomposition report instead of only writing it");
277
292
  }
278
293
  function withWebOptions(cmd) {
279
- return cmd.option("--web", "Enable the web monitoring server").option("--serve", "Alias for --web").option("--port <n>", "Web server port (default: 3737)", parseInteger).option("--host <h>", "Web server host (default: 0.0.0.0)").option("--refresh <s>", "Suggested UI polling interval in seconds", parseInteger).option("--web-log-limit <n>", "Max log entries kept in the snapshot", parseInteger).option("--web-no-logs", "Exclude logs from the published snapshot");
294
+ return cmd.option("--web", "Enable the web monitoring server").option("--serve", "Alias for --web").option("--restart-web", "Restart the web monitor before serving it (implies --web)").option("--port <n>", "Web server port (default: 3737)", parseInteger).option("--host <h>", "Web server host (default: 0.0.0.0)").option("--refresh <s>", "Suggested UI polling interval in seconds", parseInteger).option("--web-log-limit <n>", "Max log entries kept in the snapshot", parseInteger).option("--web-no-logs", "Exclude logs from the published snapshot");
280
295
  }
281
296
  function withIssueOptions(cmd) {
282
297
  return cmd.option("--local", "Prefer the local file Issue provider").option("--github", "Prefer the GitHub Issue provider").option("--prefer-local", "On divergence, use the local version without asking").option("--prefer-github", "On divergence, use the GitHub version without asking").option("--ask", "On divergence, ask which version to use (interactive only)");
283
298
  }
284
- function resolveWebOverrides(opts) {
285
- const overrides = {};
286
- if (opts.web === true || opts.serve === true) {
287
- overrides.enabled = true;
288
- }
289
- if (opts.port !== void 0) {
290
- overrides.port = opts.port;
291
- }
292
- if (opts.host !== void 0) {
293
- overrides.host = opts.host;
294
- }
295
- if (opts.refresh !== void 0) {
296
- overrides.refreshSeconds = opts.refresh;
297
- }
298
- if (opts.webLogLimit !== void 0) {
299
- overrides.logLimit = opts.webLogLimit;
300
- }
301
- if (opts.webNoLogs === true) {
302
- overrides.includeLogs = false;
303
- }
304
- return overrides;
305
- }
306
299
  var program = new Command();
307
300
  program.name("issue-flow").description(
308
301
  "Unified CLI for orchestrating the full issue-flow pipeline via Claude Code, Codex CLI, Cursor CLI or Antigravity CLI."
@@ -359,8 +352,8 @@ withIssueOptions(
359
352
  )
360
353
  ).action(
361
354
  async (options) => {
362
- const { loadIssuesConfig } = await import("./config-MEM2IWWN.js");
363
- const { runInit } = await import("./init-OKWEC3EV.js");
355
+ const { loadIssuesConfig } = await import("./config-UMP6DBJB.js");
356
+ const { runInit } = await import("./init-LLBVJNPE.js");
364
357
  const { preferredProvider } = await loadIssuesConfig();
365
358
  const code = await runInit(preferredProvider, {
366
359
  ...options,
@@ -382,7 +375,7 @@ withGlobalOptions(
382
375
  }
383
376
  throw error;
384
377
  }
385
- const { runGenerate } = await import("./generate-MVQI7A45.js");
378
+ const { runGenerate } = await import("./generate-AGBT7EHX.js");
386
379
  const code = await runGenerate(options.prompt, target);
387
380
  process.exit(code);
388
381
  });
@@ -425,7 +418,7 @@ withUserStoryNumberingOptions(
425
418
  }
426
419
  throw error;
427
420
  }
428
- const { runPipeline } = await import("./run-YU4TR62R.js");
421
+ const { runPipeline } = await import("./run-5EHIFF2V.js");
429
422
  const code = await runPipeline(
430
423
  issues,
431
424
  options.mode,
@@ -442,7 +435,8 @@ withUserStoryNumberingOptions(
442
435
  retryForever: options.retryForever,
443
436
  onIssueFailure: options.onIssueFailure,
444
437
  background: options.background,
445
- detachedChild: options.detachedChild
438
+ detachedChild: options.detachedChild,
439
+ restartWeb: options.restartWeb
446
440
  }
447
441
  );
448
442
  process.exit(code);
@@ -453,7 +447,7 @@ withIssueOptions(
453
447
  program.command("resume").description("Resume an interrupted pipeline from the phase it stopped at").argument("[issue]", "Issue to resume. Omitted: the most recently attempted one").option("--all", "Resume every unfinished issue of this project, in order").option("--mode <mode>", "Execution mode: auto | manual", "auto")
454
448
  )
455
449
  ).action(async (issue, options) => {
456
- const { runResume } = await import("./resume-QMEPMSZW.js");
450
+ const { runResume } = await import("./resume-QNLQSCR5.js");
457
451
  const code = await runResume(issue, {
458
452
  ...options.all === void 0 ? {} : { all: options.all },
459
453
  ...options.mode === void 0 ? {} : { mode: options.mode }
@@ -463,7 +457,7 @@ withIssueOptions(
463
457
  withGlobalOptions(
464
458
  program.command("status").description("What is running right now, in which phase, and since when").argument("[issue]", "Restrict the report to one issue").option("--json", "Emit the assembled state as JSON")
465
459
  ).action(async (issue, options) => {
466
- const { runStatus } = await import("./operations-LU6JA3BX.js");
460
+ const { runStatus } = await import("./operations-JQYK2EMT.js");
467
461
  process.exit(
468
462
  await runStatus(issue, { ...options.json === void 0 ? {} : { json: options.json } })
469
463
  );
@@ -472,7 +466,7 @@ withGlobalOptions(
472
466
  program.command("usage").description("Aggregate execution telemetry from tasks.json").argument("[issue]", "Restrict the report to one issue").option("--issue <issue>", "Same as the positional argument").option("--since <date>", "Only executions started on or after this ISO date").option("--by <key>", "Group by harness, provider, model, purpose or status").option("--json", "Emit the assembled totals as JSON")
473
467
  ).action(
474
468
  async (issue, options) => {
475
- const { runUsage, USAGE_GROUP_KEYS } = await import("./usage-VCFLDA5Y.js");
469
+ const { runUsage, USAGE_GROUP_KEYS } = await import("./usage-QL563I7F.js");
476
470
  const by = options.by;
477
471
  if (by !== void 0 && !USAGE_GROUP_KEYS.includes(by)) {
478
472
  printError("Must be one of: harness, provider, model, purpose, status.");
@@ -490,20 +484,20 @@ withGlobalOptions(
490
484
  withGlobalOptions(
491
485
  program.command("ps").description("Every issue-flow run active on this machine").option("--json", "Emit the listing as JSON").option("--watch", "Refresh the listing until interrupted")
492
486
  ).action(async (options) => {
493
- const { runPs } = await import("./ps-TNE44R5V.js");
487
+ const { runPs } = await import("./ps-KUUZ6TUL.js");
494
488
  process.exit(await runPs(options));
495
489
  });
496
490
  withGlobalOptions(
497
491
  program.command("runs").description("History of the runs of this project, with how each ended")
498
492
  ).action(async () => {
499
- const { runRuns } = await import("./operations-LU6JA3BX.js");
493
+ const { runRuns } = await import("./operations-JQYK2EMT.js");
500
494
  process.exit(await runRuns());
501
495
  });
502
496
  withGlobalOptions(
503
497
  program.command("logs").description("Read the execution journal (events.jsonl), filtered and readable").argument("[issue]", "Issue to read. Omitted: the most recently attempted one").option("--issue <issue>", "Same as the positional argument").option("--follow", "Keep reading as the journal grows").option("--tail <n>", "How many entries to show first (default 50)", parseInteger).option("--kind <kinds>", "Only these event types, comma separated (retry, phase:end, \u2026)")
504
498
  ).action(
505
499
  async (issue, options) => {
506
- const { runLogs } = await import("./operations-LU6JA3BX.js");
500
+ const { runLogs } = await import("./operations-JQYK2EMT.js");
507
501
  const kinds = options.kind === void 0 ? void 0 : options.kind.split(",").map((kind) => kind.trim()).filter((kind) => kind !== "");
508
502
  process.exit(
509
503
  await runLogs(issue ?? options.issue, {
@@ -517,13 +511,13 @@ withGlobalOptions(
517
511
  withGlobalOptions(
518
512
  program.command("pause").description("Ask the running pipeline to stop after writing a checkpoint")
519
513
  ).action(async () => {
520
- const { runPause } = await import("./operations-LU6JA3BX.js");
514
+ const { runPause } = await import("./operations-JQYK2EMT.js");
521
515
  process.exit(await runPause());
522
516
  });
523
517
  withGlobalOptions(
524
518
  program.command("cancel").description("Stop the run and mark the issue so a resume does not pick it up").argument("[issue]", "Issue to cancel. Omitted: the most recently attempted one")
525
519
  ).action(async (issue) => {
526
- const { runCancel } = await import("./operations-LU6JA3BX.js");
520
+ const { runCancel } = await import("./operations-JQYK2EMT.js");
527
521
  process.exit(await runCancel(issue));
528
522
  });
529
523
  withIssueOptions(
@@ -531,7 +525,7 @@ withIssueOptions(
531
525
  program.command("analyze").description("Analyze an issue with the configured agent").argument("<issue>", "Issue number")
532
526
  )
533
527
  ).action(async (issue) => {
534
- const { runAnalyze } = await import("./analyze-WS47UYGN.js");
528
+ const { runAnalyze } = await import("./analyze-O2PYDIFK.js");
535
529
  const code = await runAnalyze(issue);
536
530
  process.exit(code);
537
531
  });
@@ -540,7 +534,7 @@ withIssueOptions(
540
534
  program.command("prd").description("Generate a PRD from an analyzed issue with the configured agent").argument("<issue>", "Issue number")
541
535
  )
542
536
  ).action(async (issue) => {
543
- const { runPrd } = await import("./prd-5O6GYCC6.js");
537
+ const { runPrd } = await import("./prd-D6YDYAFX.js");
544
538
  const code = await runPrd(issue);
545
539
  process.exit(code);
546
540
  });
@@ -561,7 +555,7 @@ withUserStoryNumberingOptions(
561
555
  }
562
556
  throw error;
563
557
  }
564
- const { runPlan } = await import("./plan-LEJJF3DE.js");
558
+ const { runPlan } = await import("./plan-HSLWDJEZ.js");
565
559
  const code = await runPlan(issue, void 0, numbering);
566
560
  process.exit(code);
567
561
  });
@@ -580,7 +574,7 @@ withWebOptions(
580
574
  ).action(
581
575
  async (positionalMaxIter, options) => {
582
576
  try {
583
- const { runExecute } = await import("./execute-NITIHHCK.js");
577
+ const { runExecute } = await import("./execute-E3BRMDAQ.js");
584
578
  const code = await runExecute(positionalMaxIter, options);
585
579
  process.exit(code);
586
580
  } catch (error) {
@@ -594,7 +588,7 @@ withIssueOptions(
594
588
  program.command("review").description("Validate an issue resolution with the configured agent").argument("<issue>", "Issue number")
595
589
  )
596
590
  ).action(async (issue) => {
597
- const { runReview } = await import("./review-YKWD6SNN.js");
591
+ const { runReview } = await import("./review-3KJ4BH2V.js");
598
592
  const code = await runReview(issue);
599
593
  process.exit(code);
600
594
  });
@@ -603,7 +597,7 @@ withIssueOptions(
603
597
  program.command("pr").description("Create a pull request with the configured agent").argument("<issue>", "Issue number")
604
598
  )
605
599
  ).action(async (issue) => {
606
- const { runPr } = await import("./pr-HPVUZ7S3.js");
600
+ const { runPr } = await import("./pr-6TCZXG6K.js");
607
601
  const code = await runPr(issue);
608
602
  process.exit(code);
609
603
  });
@@ -611,21 +605,21 @@ var webCommand = program.command("web").description("Manage the web monitoring s
611
605
  webCommand.command("serve").description(
612
606
  "Run the web monitor server in the foreground (internal \u2014 spawned detached by --web)"
613
607
  ).option("--port <n>", "Web server port (default: 3737)", parseInteger).option("--host <h>", "Web server host (default: 0.0.0.0)").option("--refresh <s>", "Suggested UI polling interval in seconds", parseInteger).action(async (options) => {
614
- const { runWebServe } = await import("./web-XVHLX62B.js");
608
+ const { runWebServe } = await import("./web-PPSMNTQ6.js");
615
609
  const code = await runWebServe(options);
616
610
  if (code !== 0) {
617
611
  process.exit(code);
618
612
  }
619
613
  });
620
614
  webCommand.command("stop").description("Stop the running web monitor server").action(async () => {
621
- const { runWebStop } = await import("./web-XVHLX62B.js");
615
+ const { runWebStop } = await import("./web-PPSMNTQ6.js");
622
616
  const code = await runWebStop();
623
617
  process.exit(code);
624
618
  });
625
619
  withGlobalOptions(
626
620
  program.command("policy").description("Inspect the policies discovered in this repository and their provenance").option("--scope <dir>", "Resolve the policy for a subdirectory (monorepo)").option("--json", "Emit the resolved policy as JSON")
627
621
  ).action(async (options) => {
628
- const { runPolicy } = await import("./policy-JSYEK5B2.js");
622
+ const { runPolicy } = await import("./policy-IMRXGG7X.js");
629
623
  const code = await runPolicy(options);
630
624
  process.exit(code);
631
625
  });
@@ -633,41 +627,41 @@ var routingCommand = withGlobalOptions(
633
627
  program.command("routing").description("Inspect the shadow router (records a recommendation, does not act)")
634
628
  );
635
629
  routingCommand.option("--json", "Emit the resolved routing config as JSON").action(async (options) => {
636
- const { runRoutingInspect } = await import("./routing-2ZUMZPJB.js");
630
+ const { runRoutingInspect } = await import("./routing-TN7GLMGU.js");
637
631
  process.exit(await runRoutingInspect(options));
638
632
  });
639
633
  routingCommand.command("report").description("Shadow agreement between selected and actual harness").option("--issue <n>", "Issue number").option("--json", "Emit JSON").action(async (options) => {
640
- const { runRoutingReport } = await import("./routing-2ZUMZPJB.js");
634
+ const { runRoutingReport } = await import("./routing-TN7GLMGU.js");
641
635
  process.exit(await runRoutingReport(options));
642
636
  });
643
637
  var conventionsCommand = withGlobalOptions(
644
638
  program.command("conventions").description("Compute the repository Git convention (branch, commit, PR title)")
645
639
  );
646
640
  conventionsCommand.command("branch").description("Print the deterministic branch name for an issue").option("--issue <n>", "Issue number").option("--title <text>", "Issue title, when the issue cannot be resolved").option("--json", "Emit JSON").action(async (options) => {
647
- const { runConventionsBranch } = await import("./conventions-WV4NDXGH.js");
641
+ const { runConventionsBranch } = await import("./conventions-DKH7AE4T.js");
648
642
  process.exit(await runConventionsBranch(options));
649
643
  });
650
644
  conventionsCommand.command("commit").description("Print a Conventional Commit message").requiredOption("--type <type>", "Change type (feat, fix, docs, \u2026)").option("--scope <scope>", "Optional scope").requiredOption("--subject <text>", "Commit subject").option("--issue <n>", "Issue number for the Refs trailer").option("--story <id>", "Story id (US-010)").option("--breaking <text>", "Breaking change description").option("--json", "Emit JSON").action(
651
645
  async (options) => {
652
- const { runConventionsCommit } = await import("./conventions-WV4NDXGH.js");
646
+ const { runConventionsCommit } = await import("./conventions-DKH7AE4T.js");
653
647
  process.exit(await runConventionsCommit(options));
654
648
  }
655
649
  );
656
650
  conventionsCommand.command("pr-title").description("Print the Conventional Commit Pull Request title").option("--issue <n>", "Issue number").option("--title <text>", "Issue title, when the issue cannot be resolved").option("--json", "Emit JSON").action(async (options) => {
657
- const { runConventionsPrTitle } = await import("./conventions-WV4NDXGH.js");
651
+ const { runConventionsPrTitle } = await import("./conventions-DKH7AE4T.js");
658
652
  process.exit(await runConventionsPrTitle(options));
659
653
  });
660
654
  var agentCommand = withGlobalOptions(
661
655
  program.command("agent").description("Inspect the resolved agent and model for each phase").option("--json", "Emit the resolved agent configuration as JSON")
662
656
  );
663
657
  agentCommand.action(async (options) => {
664
- const { runAgent } = await import("./agent-BXRIEKVM.js");
658
+ const { runAgent } = await import("./agent-AT64RXTA.js");
665
659
  const code = await runAgent(options);
666
660
  process.exit(code);
667
661
  });
668
662
  agentCommand.command("use").description("Write an agent preference to config.json or .issue-flow.json").argument("<provider>", "claude, codex, cursor or antigravity").option("--model <model>", "Model identifier for this preference").option("--global", "Write to ~/.issue-flow/config.json (default)").option("--project", "Write to .issue-flow.json in the repository").option("--phase <phase>", "Write only the override for this phase").action(
669
663
  async (provider, options) => {
670
- const { runAgentUse } = await import("./agent-BXRIEKVM.js");
664
+ const { runAgentUse } = await import("./agent-AT64RXTA.js");
671
665
  const code = await runAgentUse(provider, options);
672
666
  process.exit(code);
673
667
  }
@@ -679,7 +673,7 @@ withGlobalOptions(
679
673
  )
680
674
  ).action(
681
675
  async (pr, options) => {
682
- const { runPrReview } = await import("./pr-review-R2QZBT3F.js");
676
+ const { runPrReview } = await import("./pr-review-6MWJO2NP.js");
683
677
  const code = await runPrReview(pr, options);
684
678
  process.exit(code);
685
679
  }
@@ -705,7 +699,7 @@ withGlobalOptions(
705
699
  printError("Unknown bench mode. Use 'synthetic' or 'real'.");
706
700
  process.exit(1);
707
701
  }
708
- const { runBench } = await import("./bench-SA3BOME5.js");
702
+ const { runBench } = await import("./bench-ODFPAGW6.js");
709
703
  process.exit(
710
704
  await runBench({
711
705
  ...options.mode === void 0 ? {} : { mode: options.mode },
@@ -723,13 +717,13 @@ withGlobalOptions(
723
717
  }
724
718
  );
725
719
  program.action(async () => {
726
- const { listLiveRuns } = await import("./registry-LGPE53QD.js");
720
+ const { listLiveRuns } = await import("./registry-SB7XTMGE.js");
727
721
  const runs = await listLiveRuns();
728
722
  if (runs.length === 0) {
729
723
  program.help();
730
724
  return;
731
725
  }
732
- const { runPs } = await import("./ps-TNE44R5V.js");
726
+ const { runPs } = await import("./ps-KUUZ6TUL.js");
733
727
  process.exit(await runPs());
734
728
  });
735
729
  program.parse();