sequant 2.8.0 → 2.10.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 (211) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/.claude-plugin/plugin.json +1 -1
  3. package/README.md +23 -4
  4. package/dist/bin/cli.js +99 -18
  5. package/dist/marketplace/external_plugins/sequant/.claude-plugin/plugin.json +1 -1
  6. package/dist/marketplace/external_plugins/sequant/.mcp.json +1 -1
  7. package/dist/marketplace/external_plugins/sequant/README.md +58 -2
  8. package/dist/marketplace/external_plugins/sequant/hooks/parallel-marker.sh +50 -0
  9. package/dist/marketplace/external_plugins/sequant/hooks/post-tool.sh +38 -10
  10. package/dist/marketplace/external_plugins/sequant/hooks/pre-tool.sh +405 -67
  11. package/dist/marketplace/external_plugins/sequant/skills/_shared/references/trust-model.md +18 -0
  12. package/dist/marketplace/external_plugins/sequant/skills/assess/SKILL.md +250 -344
  13. package/dist/marketplace/external_plugins/sequant/skills/assess/references/predicted-collision-detection.md +10 -7
  14. package/dist/marketplace/external_plugins/sequant/skills/docs/SKILL.md +4 -4
  15. package/dist/marketplace/external_plugins/sequant/skills/exec/SKILL.md +26 -6
  16. package/dist/marketplace/external_plugins/sequant/skills/fullsolve/SKILL.md +4 -2
  17. package/dist/marketplace/external_plugins/sequant/skills/loop/SKILL.md +38 -2
  18. package/dist/marketplace/external_plugins/sequant/skills/merger/SKILL.md +2 -2
  19. package/dist/marketplace/external_plugins/sequant/skills/qa/SKILL.md +337 -57
  20. package/dist/marketplace/external_plugins/sequant/skills/qa/references/anti-pattern-detection.md +6 -6
  21. package/dist/marketplace/external_plugins/sequant/skills/qa/references/call-site-review.md +2 -2
  22. package/dist/marketplace/external_plugins/sequant/skills/qa/references/code-review-checklist.md +2 -2
  23. package/dist/marketplace/external_plugins/sequant/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  24. package/dist/marketplace/external_plugins/sequant/skills/qa/references/quality-gates.md +21 -7
  25. package/dist/marketplace/external_plugins/sequant/skills/qa/references/testing-requirements.md +1 -1
  26. package/dist/marketplace/external_plugins/sequant/skills/qa/scripts/quality-checks.sh +11 -11
  27. package/dist/marketplace/external_plugins/sequant/skills/reflect/SKILL.md +27 -13
  28. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/documentation-tiers.md +80 -68
  29. package/dist/marketplace/external_plugins/sequant/skills/reflect/references/phase-reflection.md +31 -15
  30. package/dist/marketplace/external_plugins/sequant/skills/release/SKILL.md +11 -3
  31. package/dist/marketplace/external_plugins/sequant/skills/setup/SKILL.md +5 -5
  32. package/dist/marketplace/external_plugins/sequant/skills/spec/SKILL.md +2 -0
  33. package/dist/marketplace/external_plugins/sequant/skills/spec/references/verification-criteria.md +1 -1
  34. package/dist/marketplace/external_plugins/sequant/skills/test/SKILL.md +1 -1
  35. package/dist/src/commands/assess-render.d.ts +23 -0
  36. package/dist/src/commands/assess-render.js +60 -0
  37. package/dist/src/commands/doctor.js +8 -13
  38. package/dist/src/commands/init.js +13 -1
  39. package/dist/src/commands/locks.js +2 -0
  40. package/dist/src/commands/logs.js +20 -6
  41. package/dist/src/commands/merge.js +154 -2
  42. package/dist/src/commands/ready-tui-adapter.js +6 -1
  43. package/dist/src/commands/ready.d.ts +25 -3
  44. package/dist/src/commands/ready.js +39 -13
  45. package/dist/src/commands/resume.d.ts +113 -0
  46. package/dist/src/commands/resume.js +193 -0
  47. package/dist/src/commands/run-display.d.ts +20 -0
  48. package/dist/src/commands/run-display.js +117 -5
  49. package/dist/src/commands/run-flags.d.ts +42 -1
  50. package/dist/src/commands/run-flags.js +53 -1
  51. package/dist/src/commands/run-progress.js +26 -1
  52. package/dist/src/commands/run.js +11 -10
  53. package/dist/src/commands/state.js +7 -0
  54. package/dist/src/commands/stats.js +47 -0
  55. package/dist/src/commands/status.d.ts +9 -0
  56. package/dist/src/commands/status.js +24 -1
  57. package/dist/src/commands/sync.js +90 -19
  58. package/dist/src/commands/update.js +28 -5
  59. package/dist/src/lib/ac-parser.d.ts +14 -0
  60. package/dist/src/lib/ac-parser.js +99 -5
  61. package/dist/src/lib/assess/index.d.ts +10 -0
  62. package/dist/src/lib/assess/index.js +9 -0
  63. package/dist/src/lib/assess/renderer.d.ts +64 -0
  64. package/dist/src/lib/assess/renderer.js +481 -0
  65. package/dist/src/lib/assess/types.d.ts +224 -0
  66. package/dist/src/lib/assess/types.js +241 -0
  67. package/dist/src/lib/assess-collision-detect.d.ts +19 -2
  68. package/dist/src/lib/assess-collision-detect.js +68 -4
  69. package/dist/src/lib/ci/outputs.d.ts +15 -2
  70. package/dist/src/lib/ci/outputs.js +17 -5
  71. package/dist/src/lib/cli-flags.d.ts +33 -0
  72. package/dist/src/lib/cli-flags.js +46 -0
  73. package/dist/src/lib/cli-ui/run-renderer-types.d.ts +21 -7
  74. package/dist/src/lib/cli-ui/run-renderer.d.ts +10 -0
  75. package/dist/src/lib/cli-ui/run-renderer.js +79 -9
  76. package/dist/src/lib/errors.d.ts +84 -6
  77. package/dist/src/lib/errors.js +142 -17
  78. package/dist/src/lib/locks/index.d.ts +3 -3
  79. package/dist/src/lib/locks/index.js +2 -2
  80. package/dist/src/lib/locks/lock-manager.d.ts +20 -2
  81. package/dist/src/lib/locks/lock-manager.js +47 -3
  82. package/dist/src/lib/locks/types.d.ts +34 -3
  83. package/dist/src/lib/locks/types.js +16 -0
  84. package/dist/src/lib/manifest.js +1 -17
  85. package/dist/src/lib/mcp-config.d.ts +45 -0
  86. package/dist/src/lib/mcp-config.js +77 -1
  87. package/dist/src/lib/merge-check/combined-branch-test.d.ts +21 -2
  88. package/dist/src/lib/merge-check/combined-branch-test.js +233 -110
  89. package/dist/src/lib/merge-check/command-result.d.ts +36 -0
  90. package/dist/src/lib/merge-check/command-result.js +56 -0
  91. package/dist/src/lib/merge-check/index.d.ts +4 -0
  92. package/dist/src/lib/merge-check/index.js +1 -1
  93. package/dist/src/lib/merge-check/report.js +5 -1
  94. package/dist/src/lib/merge-check/types.d.ts +9 -0
  95. package/dist/src/lib/merge-check/watch.d.ts +121 -0
  96. package/dist/src/lib/merge-check/watch.js +215 -0
  97. package/dist/src/lib/qa/infra-blocked-ci.d.ts +90 -0
  98. package/dist/src/lib/qa/infra-blocked-ci.js +80 -0
  99. package/dist/src/lib/settings.d.ts +14 -0
  100. package/dist/src/lib/settings.js +61 -8
  101. package/dist/src/lib/shutdown.d.ts +42 -2
  102. package/dist/src/lib/shutdown.js +75 -5
  103. package/dist/src/lib/skills-check.d.ts +26 -0
  104. package/dist/src/lib/skills-check.js +31 -0
  105. package/dist/src/lib/stacks.d.ts +110 -1
  106. package/dist/src/lib/stacks.js +244 -5
  107. package/dist/src/lib/templates.d.ts +74 -0
  108. package/dist/src/lib/templates.js +171 -16
  109. package/dist/src/lib/test-tautology-detector.d.ts +9 -2
  110. package/dist/src/lib/test-tautology-detector.js +153 -12
  111. package/dist/src/lib/version-check.d.ts +31 -0
  112. package/dist/src/lib/version-check.js +46 -7
  113. package/dist/src/lib/workflow/batch-executor.d.ts +138 -6
  114. package/dist/src/lib/workflow/batch-executor.js +550 -54
  115. package/dist/src/lib/workflow/chain-preflight.d.ts +89 -0
  116. package/dist/src/lib/workflow/chain-preflight.js +199 -0
  117. package/dist/src/lib/workflow/chain-resume.d.ts +118 -0
  118. package/dist/src/lib/workflow/chain-resume.js +170 -0
  119. package/dist/src/lib/workflow/completed-status.d.ts +52 -0
  120. package/dist/src/lib/workflow/completed-status.js +57 -0
  121. package/dist/src/lib/workflow/config-resolver.d.ts +26 -0
  122. package/dist/src/lib/workflow/config-resolver.js +54 -2
  123. package/dist/src/lib/workflow/dependency-markers.d.ts +29 -0
  124. package/dist/src/lib/workflow/dependency-markers.js +79 -0
  125. package/dist/src/lib/workflow/drivers/agent-driver.d.ts +7 -0
  126. package/dist/src/lib/workflow/drivers/aider.d.ts +2 -0
  127. package/dist/src/lib/workflow/drivers/aider.js +2 -0
  128. package/dist/src/lib/workflow/drivers/claude-code.d.ts +21 -0
  129. package/dist/src/lib/workflow/drivers/claude-code.js +50 -8
  130. package/dist/src/lib/workflow/error-classifier.d.ts +9 -2
  131. package/dist/src/lib/workflow/error-classifier.js +14 -1
  132. package/dist/src/lib/workflow/git-diff-utils.d.ts +35 -3
  133. package/dist/src/lib/workflow/git-diff-utils.js +77 -4
  134. package/dist/src/lib/workflow/heartbeat.d.ts +38 -0
  135. package/dist/src/lib/workflow/heartbeat.js +90 -0
  136. package/dist/src/lib/workflow/log-writer.d.ts +44 -1
  137. package/dist/src/lib/workflow/log-writer.js +81 -14
  138. package/dist/src/lib/workflow/metrics-schema.d.ts +42 -3
  139. package/dist/src/lib/workflow/metrics-schema.js +16 -0
  140. package/dist/src/lib/workflow/metrics-writer.d.ts +2 -1
  141. package/dist/src/lib/workflow/phase-executor.d.ts +234 -13
  142. package/dist/src/lib/workflow/phase-executor.js +533 -56
  143. package/dist/src/lib/workflow/phase-registry.js +2 -1
  144. package/dist/src/lib/workflow/platforms/github.d.ts +64 -0
  145. package/dist/src/lib/workflow/platforms/github.js +152 -0
  146. package/dist/src/lib/workflow/qa-cache.d.ts +6 -1
  147. package/dist/src/lib/workflow/qa-cache.js +22 -9
  148. package/dist/src/lib/workflow/ready-gate.d.ts +17 -4
  149. package/dist/src/lib/workflow/ready-gate.js +25 -9
  150. package/dist/src/lib/workflow/run-log-schema.d.ts +37 -0
  151. package/dist/src/lib/workflow/run-log-schema.js +92 -2
  152. package/dist/src/lib/workflow/run-orchestrator.d.ts +33 -0
  153. package/dist/src/lib/workflow/run-orchestrator.js +429 -47
  154. package/dist/src/lib/workflow/skills-preflight.d.ts +89 -0
  155. package/dist/src/lib/workflow/skills-preflight.js +112 -0
  156. package/dist/src/lib/workflow/state-cleanup.js +9 -2
  157. package/dist/src/lib/workflow/state-manager.d.ts +33 -0
  158. package/dist/src/lib/workflow/state-manager.js +83 -0
  159. package/dist/src/lib/workflow/state-schema.d.ts +26 -0
  160. package/dist/src/lib/workflow/state-schema.js +47 -0
  161. package/dist/src/lib/workflow/status-derivation.d.ts +30 -0
  162. package/dist/src/lib/workflow/status-derivation.js +27 -0
  163. package/dist/src/lib/workflow/types.d.ts +149 -4
  164. package/dist/src/lib/workflow/types.js +1 -0
  165. package/dist/src/lib/workflow/worktree-manager.d.ts +70 -2
  166. package/dist/src/lib/workflow/worktree-manager.js +201 -52
  167. package/dist/src/mcp/tools/run.d.ts +11 -1
  168. package/dist/src/mcp/tools/run.js +22 -1
  169. package/dist/src/mcp/tools/status.js +6 -0
  170. package/dist/src/ui/tui/ElapsedTimer.d.ts +12 -3
  171. package/dist/src/ui/tui/ElapsedTimer.js +12 -10
  172. package/dist/src/ui/tui/IssueBox.js +10 -2
  173. package/dist/src/ui/tui/row-cap.js +2 -1
  174. package/dist/src/ui/tui/theme.d.ts +7 -0
  175. package/dist/src/ui/tui/theme.js +9 -0
  176. package/package.json +9 -10
  177. package/templates/hooks/parallel-marker.sh +50 -0
  178. package/templates/hooks/post-tool.sh +38 -10
  179. package/templates/hooks/pre-tool.sh +405 -67
  180. package/templates/scripts/cleanup-worktree.sh +282 -30
  181. package/templates/scripts/new-feature.sh +264 -16
  182. package/templates/skills/_shared/references/trust-model.md +18 -0
  183. package/templates/skills/assess/SKILL.md +250 -344
  184. package/templates/skills/assess/references/predicted-collision-detection.md +10 -7
  185. package/templates/skills/docs/SKILL.md +4 -4
  186. package/templates/skills/exec/SKILL.md +26 -6
  187. package/templates/skills/fullsolve/SKILL.md +4 -2
  188. package/templates/skills/loop/SKILL.md +38 -2
  189. package/templates/skills/merger/SKILL.md +2 -2
  190. package/templates/skills/qa/SKILL.md +337 -57
  191. package/templates/skills/qa/references/anti-pattern-detection.md +6 -6
  192. package/templates/skills/qa/references/call-site-review.md +2 -2
  193. package/templates/skills/qa/references/code-review-checklist.md +2 -2
  194. package/templates/skills/qa/references/fixtures/injection-issue-body.md +36 -0
  195. package/templates/skills/qa/references/quality-gates.md +21 -7
  196. package/templates/skills/qa/references/testing-requirements.md +1 -1
  197. package/templates/skills/qa/scripts/quality-checks.sh +11 -11
  198. package/templates/skills/reflect/SKILL.md +27 -13
  199. package/templates/skills/reflect/references/documentation-tiers.md +80 -68
  200. package/templates/skills/reflect/references/phase-reflection.md +31 -15
  201. package/templates/skills/release/SKILL.md +11 -3
  202. package/templates/skills/setup/SKILL.md +5 -5
  203. package/templates/skills/spec/SKILL.md +2 -0
  204. package/templates/skills/spec/references/verification-criteria.md +1 -1
  205. package/templates/skills/test/SKILL.md +1 -1
  206. package/dist/src/lib/phase-spinner.d.ts +0 -146
  207. package/dist/src/lib/phase-spinner.js +0 -255
  208. package/dist/src/lib/workflow/pr-operations.d.ts +0 -86
  209. package/dist/src/lib/workflow/pr-operations.js +0 -326
  210. package/dist/src/lib/workflow/run-summary.d.ts +0 -36
  211. package/dist/src/lib/workflow/run-summary.js +0 -142
@@ -8,6 +8,8 @@ import type { StateManager } from "./state-manager.js";
8
8
  import type { ShutdownManager } from "../shutdown.js";
9
9
  import type { WorktreeInfo } from "./worktree-manager.js";
10
10
  import type { SequantError } from "../errors.js";
11
+ import type { ErrorCategory } from "./error-classifier.js";
12
+ import type { ReadyResult } from "./ready-gate.js";
11
13
  export type { WorkflowEventEmitter, WorkflowEvents, WorkflowEventListener, IssueEventStatus, BaseEventPayload, RunEventPayload, PhaseStartedPayload, PhaseCompletedPayload, PhaseFailedPayload, IssueStatusChangedPayload, QaVerdictPayload, ProgressPayload, } from "./event-emitter.js";
12
14
  /**
13
15
  * Canonical Zod schema for all workflow phases.
@@ -130,6 +132,14 @@ export interface ExecutionConfig {
130
132
  * poll budget is preserved.
131
133
  */
132
134
  onActivity?: (text: string) => void;
135
+ /**
136
+ * Runtime callback invoked while an auto-wait (#804) is in progress, once
137
+ * per tick plus once when it ends. Used to keep the renderer and the `-q`
138
+ * heartbeat showing the wait and its wake time, so a multi-hour pause reads
139
+ * as deliberate rather than as the silent stall of #574. Not serialized —
140
+ * set per-call by the orchestrator, like {@link onActivity}.
141
+ */
142
+ onAutoWait?: (notice: AutoWaitNotice) => void;
133
143
  /**
134
144
  * Enable interactive relay (#383). When true, phase-executor sets
135
145
  * `SEQUANT_RELAY=true` in the agent environment so the PostToolUse hook
@@ -146,6 +156,53 @@ export interface ExecutionConfig {
146
156
  * QA pass does NOT skip the checks that catch the #318/#529/#570 class.
147
157
  */
148
158
  fullQa?: boolean;
159
+ /**
160
+ * Run the post-QA ready gate after the standard phases succeed (#817).
161
+ *
162
+ * When true, `runIssueWithLogging` invokes the existing `sequant ready`
163
+ * engine (`runReadyGate`) at the PR seam — before rebase/PR so the gate's
164
+ * auto-fix commits land in the PR — driving the issue to the configured
165
+ * `settings.ready.policy` threshold. It NEVER merges: the run terminates with
166
+ * the issue in `waiting_for_human_merge` (ready) or `blocked` (guard halt).
167
+ * Default off; when unset the run path is byte-identical to pre-#817.
168
+ */
169
+ readyGate?: boolean;
170
+ /**
171
+ * Total wait budget, in minutes, for auto-waiting out an exhausted
172
+ * rate-limit window (#804). `0` (the default) disables auto-wait entirely,
173
+ * preserving the #761/#799 halt behavior byte-for-byte.
174
+ *
175
+ * When a phase fails with a window-exhausted `RateLimitError` whose reset
176
+ * lies within the remaining budget, the executor sleeps until the reset and
177
+ * retries the phase instead of returning the failure. Named for the
178
+ * *behavior* (waiting), not the mechanism, so it survives a future move from
179
+ * in-process sleep to out-of-process rescheduling.
180
+ *
181
+ * This is a TOTAL budget across the issue, not a per-occurrence allowance —
182
+ * see {@link AutoWaitLedger}.
183
+ */
184
+ autoWaitMinutes?: number;
185
+ }
186
+ /**
187
+ * A single liveness notice emitted during an auto-wait (#804 AC-7).
188
+ */
189
+ export interface AutoWaitNotice {
190
+ /** Issue the wait belongs to. */
191
+ issueNumber: number;
192
+ /** Phase whose retry is being waited for. */
193
+ phase: string;
194
+ /** Epoch ms at which the wait ends (reset + buffer). */
195
+ wakeAtMs: number;
196
+ /** Ms remaining at the time of this notice. `0` on the final notice. */
197
+ remainingMs: number;
198
+ /**
199
+ * Display string, already formatted. Built from `formatRateLimitMessage`
200
+ * plus the wake time — never by re-appending `resetsAt` to an
201
+ * already-formatted driver message (the #799 doubled-string trap).
202
+ */
203
+ message: string;
204
+ /** True on the terminal notice, once the wait has ended or been aborted. */
205
+ done: boolean;
149
206
  }
150
207
  /**
151
208
  * Default execution configuration
@@ -204,6 +261,14 @@ export interface IssueResult {
204
261
  prNumber?: number;
205
262
  /** PR URL if created after successful QA */
206
263
  prUrl?: string;
264
+ /**
265
+ * Set when PR creation was attempted after passing QA but failed (#879).
266
+ * A failed `createPR` used to be a non-fatal yellow warning while the issue
267
+ * still reported success — so a run could "pass" while producing no PR. When
268
+ * present, `success` is false and the run summary counts the issue as failed
269
+ * with this string as the reason.
270
+ */
271
+ prCreationError?: string;
207
272
  /**
208
273
  * Set when the issue was skipped because another sequant session holds
209
274
  * the per-issue lock (#625). Surfaced in the summary as
@@ -216,6 +281,40 @@ export interface IssueResult {
216
281
  startedAt: string;
217
282
  command: string;
218
283
  };
284
+ /**
285
+ * Set true when the chain-mode checkpoint commit could not be written after
286
+ * this link passed QA (#760). The link's own work is done, but the recovery
287
+ * point resume depends on is missing — surfaced prominently so a later resume
288
+ * failing fast (AC-3) is expected, not surprising.
289
+ */
290
+ checkpointFailed?: boolean;
291
+ /**
292
+ * Bounded-enum classification of the failure that halted this issue (#761
293
+ * AC-7), derived from the last non-loop failing phase's `structuredError`
294
+ * (preferred) or stderr-regex classification. Carried into
295
+ * `.sequant/metrics.json` — enum only, never a message string (metrics
296
+ * privacy contract). Absent on success.
297
+ */
298
+ failureCategory?: ErrorCategory;
299
+ /**
300
+ * Outcome of the post-QA ready gate (#817), present only when the run was
301
+ * invoked with `--ready-gate` and the gate actually ran (i.e. the standard
302
+ * phases succeeded). Carries the terminal reason, the persisted issue status
303
+ * (`waiting_for_human_merge` / `blocked` — never merged), and the rendered
304
+ * report the summary and PR body surface. Absent on runs without the flag.
305
+ */
306
+ readyGate?: ReadyResult;
307
+ /**
308
+ * Why the ready gate did NOT run, when `--ready-gate` was requested but the
309
+ * gate threw (#817). Mutually exclusive with {@link IssueResult.readyGate}.
310
+ *
311
+ * A gate crash is deliberately non-fatal — the phase work is already
312
+ * committed and the PR still opens — but it must not be silent. Without this
313
+ * field a run whose gate died is byte-identical in the summary to one that
314
+ * never asked for a gate, so the user believes a second look happened when it
315
+ * did not. The summary renders this as an explicit "gate did not run" line.
316
+ */
317
+ readyGateError?: string;
219
318
  }
220
319
  /**
221
320
  * CLI options for the run command, merged with settings and env config.
@@ -247,8 +346,6 @@ export interface RunOptions {
247
346
  autoDetectPhases?: boolean;
248
347
  /** Enable automatic worktree creation for issue isolation */
249
348
  worktreeIsolation?: boolean;
250
- /** Reuse existing worktrees instead of creating new ones */
251
- reuseWorktrees?: boolean;
252
349
  /** Suppress version warnings and non-essential output */
253
350
  quiet?: boolean;
254
351
  /** Chain issues: each branches from previous (requires --sequential) */
@@ -265,6 +362,13 @@ export interface RunOptions {
265
362
  * from building on potentially broken code.
266
363
  */
267
364
  qaGate?: boolean;
365
+ /**
366
+ * Make `--chain` content pre-flight warnings fatal (#762).
367
+ * By default the pre-flight (missing AC section, dependency-order and
368
+ * file-overlap-order contradictions, closed issues) only warns. When true,
369
+ * any warning aborts the run BEFORE the first worktree is provisioned.
370
+ */
371
+ strictPreflight?: boolean;
268
372
  /**
269
373
  * Base branch for worktree creation.
270
374
  * Resolution priority: this CLI flag → settings.run.defaultBase → 'main'
@@ -276,6 +380,13 @@ export interface RunOptions {
276
380
  * Resolution priority: this CLI flag → settings.run.mcp → default (true)
277
381
  */
278
382
  noMcp?: boolean;
383
+ /**
384
+ * Total minutes willing to wait for an exhausted rate-limit window to reopen
385
+ * before halting (#804). `0` (default) keeps today's immediate halt.
386
+ * Resolution priority: this CLI flag → SEQUANT_AUTO_WAIT_MINUTES →
387
+ * settings.run.autoWaitMinutes → default (0).
388
+ */
389
+ autoWaitMinutes?: number;
279
390
  /**
280
391
  * Resume from last completed phase.
281
392
  * Reads phase markers from GitHub issue comments and skips completed phases.
@@ -301,7 +412,9 @@ export interface RunOptions {
301
412
  noPr?: boolean;
302
413
  /**
303
414
  * Force re-execution of issues even if they have completed status.
304
- * Bypasses the pre-flight state guard that skips ready_for_merge/merged issues.
415
+ * Bypasses the pre-flight state guard that skips completed issues — see
416
+ * `isCompletedIssueStatus` (completed-status.ts) for exactly which statuses
417
+ * that covers, and why `blocked` is not one of them.
305
418
  */
306
419
  force?: boolean;
307
420
  /**
@@ -338,6 +451,17 @@ export interface RunOptions {
338
451
  * #705: now a hidden no-op alias — the boxed Ink TUI is the default, so
339
452
  * `--experimental-tui` only parses for backward compatibility and no longer
340
453
  * gates rendering. Kept so existing scripts/muscle-memory don't break.
454
+ *
455
+ * INTENTIONALLY INERT — do not delete (#810). A dead-surface sweep of
456
+ * `RunOptions` will correctly observe that nothing branches on this field.
457
+ * That is the design, not a defect: the flag's whole job is to parse and do
458
+ * nothing, so scripts written against #705 keep working. Its inertness is
459
+ * asserted, not incidental — `run-flags.test.ts` ("--experimental-tui is a
460
+ * no-op"), `cli.integration.test.ts` (hidden from `--help`, still parses),
461
+ * and `run-tui.integration.test.ts` all pin it. Contrast `reuseWorktrees`,
462
+ * removed in #810: that field had no flag, no consumer, and no test, so it
463
+ * promised behavior nothing delivered. The distinction is a flag deliberately
464
+ * kept parseable versus a type field nobody could ever reach.
341
465
  */
342
466
  experimentalTui?: boolean;
343
467
  /**
@@ -352,6 +476,16 @@ export interface RunOptions {
352
476
  * Resolution priority: this CLI flag → settings.run.relay → default (true).
353
477
  */
354
478
  relay?: boolean;
479
+ /**
480
+ * Run the post-QA ready gate after the standard phases succeed (#817). Set via
481
+ * `--ready-gate`. When true, the run drives the issue to the configured
482
+ * `settings.ready.policy` threshold through the existing `sequant ready`
483
+ * engine before creating the PR, then STOPS at the human merge gate — it never
484
+ * merges. Off by default; opt-in only, so an unset flag leaves the run path
485
+ * (including the #749 break-to-PR behavior) unchanged. Reuses `ready`'s policy
486
+ * and bounds wholesale — no new settings accompany this flag.
487
+ */
488
+ readyGate?: boolean;
355
489
  }
356
490
  /**
357
491
  * CLI arguments for run command
@@ -392,12 +526,23 @@ export interface BatchResult {
392
526
  * `"activity"` (#543): sub-phase activity ping. `extra.text` carries a short
393
527
  * one-line snippet (e.g. last line of agent output) for the dashboard's
394
528
  * `nowLine`. Fires at most ~10 Hz from the phase executor.
529
+ *
530
+ * `"waiting"` (#804): an auto-wait for a rate-limit window is in progress.
531
+ * `extra.text` is the display message and `extra.wakeAtMs` the wake time;
532
+ * a `"waiting"` event WITHOUT `wakeAtMs` is the terminal notice that clears
533
+ * the waiting state. Unlike `"activity"`, this must reach both display paths
534
+ * — a multi-hour pause with no signal is the #574 complaint at 60x scale.
395
535
  */
396
- export type ProgressCallback = (issue: number, phase: string, event: "start" | "complete" | "failed" | "activity", extra?: {
536
+ export type ProgressCallback = (issue: number, phase: string, event: "start" | "complete" | "failed" | "activity" | "waiting", extra?: {
397
537
  durationSeconds?: number;
398
538
  error?: string;
399
539
  iteration?: number;
400
540
  text?: string;
541
+ /**
542
+ * `"waiting"` (#804): epoch ms at which an auto-wait ends. Absent on the
543
+ * terminal notice, which clears the waiting state.
544
+ */
545
+ wakeAtMs?: number;
401
546
  }) => void;
402
547
  /**
403
548
  * #672 AC-2: fired once per issue after the executor has resolved the final
@@ -45,4 +45,5 @@ export const DEFAULT_CONFIG = {
45
45
  dryRun: false,
46
46
  mcp: true,
47
47
  retry: true,
48
+ autoWaitMinutes: 0,
48
49
  };
@@ -43,6 +43,19 @@ export interface RebaseResult {
43
43
  /** Error message if rebase failed */
44
44
  error?: string;
45
45
  }
46
+ /**
47
+ * Result of rebasing a worktree onto a local branch (chain successor → predecessor).
48
+ */
49
+ export interface LocalRebaseResult {
50
+ /** Whether the rebase was attempted */
51
+ performed: boolean;
52
+ /** Whether the rebase succeeded (branch now contains `ontoBranch`'s commits) */
53
+ success: boolean;
54
+ /** Whether a merge conflict caused the rebase to be aborted */
55
+ conflict: boolean;
56
+ /** Error message if the rebase failed */
57
+ error?: string;
58
+ }
46
59
  /**
47
60
  * Result of PR creation
48
61
  */
@@ -132,6 +145,21 @@ export declare function filterResumedPhases(issueNumber: number, phases: Phase[]
132
145
  phases: Phase[];
133
146
  skipped: Phase[];
134
147
  };
148
+ /**
149
+ * Run the frozen dependency install for a freshly provisioned worktree and
150
+ * surface (rather than swallow) a failed install.
151
+ *
152
+ * Mirrors the status check in `reinstallIfLockfileChanged` (#846): a plain
153
+ * `npm install` self-heals a stale/absent lockfile, but the frozen `npm ci`
154
+ * hard-fails (exit 1, no node_modules). Without this check a failing install
155
+ * left a silently dependency-less worktree whose breakage only surfaced later
156
+ * as a confusing phase error. The warning names the resolved command so the
157
+ * user can rerun it by hand.
158
+ *
159
+ * @returns true if the install succeeded, false if it failed (warn-and-continue)
160
+ * @internal Exported for testing
161
+ */
162
+ export declare function installWorktreeDeps(worktreePath: string, packageManager: string | undefined, verbose: boolean): boolean;
135
163
  /**
136
164
  * Create or reuse a worktree for an issue
137
165
  * @param baseBranch - Optional branch to use as base instead of origin/main (for chain mode)
@@ -176,6 +204,17 @@ export declare function createCheckpointCommit(worktreePath: string, issueNumber
176
204
  * @internal Exported for testing
177
205
  */
178
206
  export declare function reinstallIfLockfileChanged(worktreePath: string, packageManager: string | undefined, verbose: boolean, preRebaseRef?: string): boolean;
207
+ /**
208
+ * Rebase a worktree's branch onto a *local* branch ref (e.g. a chain
209
+ * predecessor's feature branch), NOT origin/main. Used to chain a successor
210
+ * onto its predecessor's committed work at execution time (#748), and to
211
+ * re-chain a pre-existing worktree onto its chain base.
212
+ *
213
+ * On conflict, aborts the rebase to restore the original branch state and
214
+ * returns `{ success: false, conflict: true }` so callers can warn rather than
215
+ * silently treat a broken link as healthy.
216
+ */
217
+ export declare function rebaseOntoLocalBranch(worktreePath: string, ontoBranch: string, verbose?: boolean): LocalRebaseResult;
179
218
  /**
180
219
  * Rebase the worktree branch onto the base branch before PR creation.
181
220
  * This ensures the branch is up-to-date and prevents lockfile drift.
@@ -189,11 +228,37 @@ export declare function reinstallIfLockfileChanged(worktreePath: string, package
189
228
  * @internal Exported for testing
190
229
  */
191
230
  export declare function rebaseBeforePR(worktreePath: string, issueNumber: number, packageManager: string | undefined, verbose: boolean, baseBranch?: string): RebaseResult;
231
+ /**
232
+ * Build the automated PR body for `sequant run`.
233
+ *
234
+ * Pure and I/O-free, kept separate from {@link createPR} (which shells out to
235
+ * `gh`) so the body — including the non-A+ QA note (#749) — is unit-testable
236
+ * directly.
237
+ *
238
+ * @param issueNumber Issue the PR closes
239
+ * @param opts.stackManifest Appended before the trailer under --stacked (#605)
240
+ * @param opts.qaVerdict QA verdict for the run; a non-A+ stopping state
241
+ * (anything other than `READY_FOR_MERGE`) surfaces a note so a human reviewer
242
+ * sees why the run broke to PR without reaching A+ (#749).
243
+ * @param opts.readyGateReport Rendered `sequant ready` gap report (#817). Set
244
+ * only when the run used `--ready-gate`; surfaces the gate outcome (threshold
245
+ * reached vs guard halt) in the PR body the same way `sequant ready` does.
246
+ * @internal Exported for testing
247
+ */
248
+ export declare function buildAutomatedPRBody(issueNumber: number, opts?: {
249
+ stackManifest?: string;
250
+ qaVerdict?: string;
251
+ readyGateReport?: string;
252
+ }): string;
192
253
  /**
193
254
  * Push branch and create a PR after successful QA.
194
255
  *
195
256
  * Handles both fresh PR creation and detection of existing PRs.
196
- * Failures are warnings — they don't fail the run.
257
+ *
258
+ * Returns `{ success: false, error }` on failure. As of #879 the caller
259
+ * (`runIssueWithLogging`) treats an attempted-but-failed PR as a run failure:
260
+ * a passing run that produced no PR is not a success. This function itself
261
+ * still only reports — it never throws — so relay teardown runs regardless.
197
262
  *
198
263
  * @param worktreePath Path to the worktree
199
264
  * @param issueNumber Issue number
@@ -204,10 +269,13 @@ export declare function rebaseBeforePR(worktreePath: string, issueNumber: number
204
269
  * @param stackOptions When set under --stacked, `prBase` overrides the default
205
270
  * PR target (otherwise gh defaults to the repo's default branch) and
206
271
  * `stackManifest` is appended to the PR body. (#605)
272
+ * @param qaVerdict QA verdict surfaced in the PR body when non-A+ (#749).
273
+ * @param readyGateReport Rendered `sequant ready` gap report, set only when the
274
+ * run used `--ready-gate` (#817).
207
275
  * @returns PRCreationResult with PR info or error
208
276
  * @internal Exported for testing
209
277
  */
210
278
  export declare function createPR(worktreePath: string, issueNumber: number, issueTitle: string, branch: string, verbose: boolean, labels?: string[], stackOptions?: {
211
279
  prBase?: string;
212
280
  stackManifest?: string;
213
- }): PRCreationResult;
281
+ }, qaVerdict?: string, readyGateReport?: string): PRCreationResult;