pr-shepherd 0.56.6 → 0.57.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 (420) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +44 -27
  3. package/bin/api.d.mts +25 -3
  4. package/bin/api.mjs +51 -13
  5. package/bin/checks/classify.d.mts +1 -0
  6. package/bin/checks/classify.mjs +1 -1
  7. package/bin/checks/conclusions.d.mts +5 -1
  8. package/bin/checks/conclusions.mjs +8 -2
  9. package/bin/checks/superseded.d.mts +8 -2
  10. package/bin/checks/superseded.mjs +24 -7
  11. package/bin/classify/loader.d.mts +2 -0
  12. package/bin/classify/loader.mjs +15 -0
  13. package/bin/classify/standard/author.d.mts +3 -0
  14. package/bin/classify/standard/author.mjs +10 -0
  15. package/bin/classify/standard/codecov-report.d.mts +4 -0
  16. package/bin/classify/standard/codecov-report.mjs +10 -0
  17. package/bin/classify/standard/coderabbit-notices.d.mts +8 -0
  18. package/bin/classify/standard/coderabbit-notices.mjs +38 -0
  19. package/bin/classify/standard/coderabbit-review-summary.d.mts +8 -0
  20. package/bin/classify/standard/coderabbit-review-summary.mjs +37 -0
  21. package/bin/classify/standard/codex-notices.d.mts +7 -0
  22. package/bin/classify/standard/codex-notices.mjs +36 -0
  23. package/bin/classify/standard/codex-review-summary.d.mts +7 -0
  24. package/bin/classify/standard/codex-review-summary.mjs +20 -0
  25. package/bin/classify/standard/dependabot-notices.d.mts +4 -0
  26. package/bin/classify/standard/dependabot-notices.mjs +15 -0
  27. package/bin/classify/standard/gemini-notices.d.mts +4 -0
  28. package/bin/classify/standard/gemini-notices.mjs +13 -0
  29. package/bin/classify/standard/index.d.mts +4 -0
  30. package/bin/classify/standard/index.mjs +22 -0
  31. package/bin/classify/standard/kilo-no-issues.d.mts +4 -0
  32. package/bin/classify/standard/kilo-no-issues.mjs +17 -0
  33. package/bin/classify/standard/sourcery-notices.d.mts +8 -0
  34. package/bin/classify/standard/sourcery-notices.mjs +20 -0
  35. package/bin/cli/api-usage-formatter.mjs +6 -1
  36. package/bin/cli/apply-merge-handler.d.mts +3 -0
  37. package/bin/cli/apply-merge-handler.mjs +73 -0
  38. package/bin/cli/arg-flags.d.mts +2 -0
  39. package/bin/cli/arg-flags.mjs +47 -0
  40. package/bin/cli/args.mjs +10 -41
  41. package/bin/cli/clean-handler.d.mts +1 -0
  42. package/bin/cli/clean-handler.mjs +71 -0
  43. package/bin/cli/default-poll.mjs +3 -0
  44. package/bin/cli/event-state-scope.d.mts +19 -0
  45. package/bin/cli/event-state-scope.mjs +60 -0
  46. package/bin/cli/fix-formatter.mjs +5 -11
  47. package/bin/cli/handlers.d.mts +0 -1
  48. package/bin/cli/handlers.mjs +8 -64
  49. package/bin/cli/help-command-pages.d.mts +62 -18
  50. package/bin/cli/help-command-pages.mjs +59 -15
  51. package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
  52. package/bin/cli/help-iterate-poll-pages.mjs +6 -0
  53. package/bin/cli/help-log-file-page.d.mts +1 -1
  54. package/bin/cli/help-log-file-page.mjs +4 -1
  55. package/bin/cli/help-top-page.d.mts +1 -1
  56. package/bin/cli/help-top-page.mjs +5 -0
  57. package/bin/cli/help.d.mts +63 -19
  58. package/bin/cli/help.mjs +2 -0
  59. package/bin/cli/iterate-branch-segment.d.mts +2 -0
  60. package/bin/cli/iterate-branch-segment.mjs +12 -7
  61. package/bin/cli/iterate-flags.d.mts +7 -1
  62. package/bin/cli/iterate-flags.mjs +38 -0
  63. package/bin/cli/iterate-formatter.d.mts +6 -6
  64. package/bin/cli/iterate-formatter.mjs +56 -22
  65. package/bin/cli/iterate-instructions.mjs +45 -15
  66. package/bin/cli/iterate-lean.mjs +39 -14
  67. package/bin/cli/iterate-merge-formatter.d.mts +6 -0
  68. package/bin/cli/iterate-merge-formatter.mjs +24 -14
  69. package/bin/cli/iterate-verbose.mjs +3 -6
  70. package/bin/cli/list-formatters.mjs +3 -1
  71. package/bin/cli/mutate-formatter.mjs +10 -5
  72. package/bin/cli/next-check-format.d.mts +7 -0
  73. package/bin/cli/next-check-format.mjs +10 -0
  74. package/bin/cli/playbook-handler.d.mts +5 -0
  75. package/bin/cli/playbook-handler.mjs +40 -0
  76. package/bin/cli/poll-handler.mjs +7 -6
  77. package/bin/cli/poll-summary-formatter.mjs +11 -2
  78. package/bin/cli/poll-targets.mjs +2 -0
  79. package/bin/cli/resolve-validators.mjs +2 -2
  80. package/bin/cli/runner.mjs +6 -1
  81. package/bin/cli/stack-layer-view.d.mts +33 -0
  82. package/bin/cli/stack-layer-view.mjs +1 -0
  83. package/bin/cli/stack-overview.d.mts +10 -28
  84. package/bin/cli/stack-overview.mjs +39 -14
  85. package/bin/cli/transport-args.d.mts +5 -0
  86. package/bin/cli/transport-args.mjs +23 -0
  87. package/bin/cli/transport-formatter.d.mts +9 -0
  88. package/bin/cli/transport-formatter.mjs +13 -0
  89. package/bin/cli-parser.mjs +62 -7
  90. package/bin/commands/apply-merge-options.d.mts +4 -0
  91. package/bin/commands/apply-merge-options.mjs +34 -0
  92. package/bin/commands/apply-merge-output.d.mts +7 -0
  93. package/bin/commands/apply-merge-output.mjs +20 -0
  94. package/bin/commands/apply-merge-pull.d.mts +20 -0
  95. package/bin/commands/apply-merge-pull.mjs +15 -0
  96. package/bin/commands/apply-merge.d.mts +18 -0
  97. package/bin/commands/apply-merge.mjs +126 -0
  98. package/bin/commands/apply-queue-removal.mjs +7 -0
  99. package/bin/commands/check-annotations.mjs +28 -18
  100. package/bin/commands/check-execution-context.d.mts +5 -0
  101. package/bin/commands/check-execution-context.mjs +16 -1
  102. package/bin/commands/check-fingerprint.d.mts +26 -2
  103. package/bin/commands/check-fingerprint.mjs +64 -28
  104. package/bin/commands/check-terminal-report.mjs +11 -1
  105. package/bin/commands/check-unreported.d.mts +6 -2
  106. package/bin/commands/check-unreported.mjs +32 -12
  107. package/bin/commands/check-wait-detectors.d.mts +35 -0
  108. package/bin/commands/check-wait-detectors.mjs +107 -0
  109. package/bin/commands/check.d.mts +4 -2
  110. package/bin/commands/check.mjs +130 -40
  111. package/bin/commands/event-instructions.d.mts +11 -0
  112. package/bin/commands/event-instructions.mjs +27 -0
  113. package/bin/commands/event-mode.d.mts +14 -0
  114. package/bin/commands/event-mode.mjs +138 -0
  115. package/bin/commands/iterate/api-usage.mjs +4 -2
  116. package/bin/commands/iterate/base.mjs +4 -0
  117. package/bin/commands/iterate/check-blocker-gate.mjs +14 -2
  118. package/bin/commands/iterate/check-instructions.d.mts +9 -10
  119. package/bin/commands/iterate/check-instructions.mjs +23 -22
  120. package/bin/commands/iterate/classify.mjs +19 -5
  121. package/bin/commands/iterate/escalate.mjs +13 -3
  122. package/bin/commands/iterate/fix-code.mjs +26 -9
  123. package/bin/commands/iterate/fix-instruction-threads.d.mts +0 -8
  124. package/bin/commands/iterate/fix-instruction-threads.mjs +0 -16
  125. package/bin/commands/iterate/fix-loop-instruction.d.mts +9 -0
  126. package/bin/commands/iterate/fix-loop-instruction.mjs +35 -0
  127. package/bin/commands/iterate/helpers.mjs +15 -2
  128. package/bin/commands/iterate/index.mjs +26 -4
  129. package/bin/commands/iterate/mark-ready.mjs +50 -10
  130. package/bin/commands/iterate/merge-plan.d.mts +19 -0
  131. package/bin/commands/iterate/merge-plan.mjs +88 -0
  132. package/bin/commands/iterate/merge-state.mjs +3 -0
  133. package/bin/commands/iterate/merge.d.mts +4 -15
  134. package/bin/commands/iterate/merge.mjs +18 -51
  135. package/bin/commands/iterate/merged-base-pull-requests.d.mts +2 -6
  136. package/bin/commands/iterate/merged-base-pull-requests.mjs +15 -11
  137. package/bin/commands/iterate/native-stack-rebase.mjs +11 -0
  138. package/bin/commands/iterate/render.d.mts +8 -2
  139. package/bin/commands/iterate/render.mjs +28 -42
  140. package/bin/commands/iterate/stack-trunk-conflict.mjs +17 -1
  141. package/bin/commands/iterate/stale-ancestry.mjs +4 -1
  142. package/bin/commands/iterate/stall.d.mts +5 -1
  143. package/bin/commands/iterate/stall.mjs +19 -7
  144. package/bin/commands/iterate/thread-mutation-routing.d.mts +1 -0
  145. package/bin/commands/iterate/thread-mutation-routing.mjs +4 -2
  146. package/bin/commands/iterate/unreported-required.mjs +5 -2
  147. package/bin/commands/mark-files-as-viewed.mjs +7 -0
  148. package/bin/commands/next-check.d.mts +31 -0
  149. package/bin/commands/next-check.mjs +46 -0
  150. package/bin/commands/playbook.d.mts +13 -0
  151. package/bin/commands/playbook.mjs +48 -0
  152. package/bin/commands/poll-mode.d.mts +8 -0
  153. package/bin/commands/poll-mode.mjs +14 -0
  154. package/bin/commands/poll-progress.d.mts +1 -0
  155. package/bin/commands/poll-progress.mjs +6 -3
  156. package/bin/commands/poll-quota.d.mts +3 -2
  157. package/bin/commands/poll-quota.mjs +7 -3
  158. package/bin/commands/poll-summary-explicit-instructions.d.mts +2 -0
  159. package/bin/commands/poll-summary-explicit-instructions.mjs +10 -1
  160. package/bin/commands/poll-summary-instructions.mjs +16 -17
  161. package/bin/commands/poll-summary.mjs +42 -17
  162. package/bin/commands/poll.d.mts +0 -1
  163. package/bin/commands/poll.mjs +11 -19
  164. package/bin/commands/quota-selection.d.mts +2 -1
  165. package/bin/commands/quota-selection.mjs +12 -7
  166. package/bin/commands/resolve-mutate.mjs +33 -5
  167. package/bin/commands/rest-stack-merge-readiness.d.mts +4 -0
  168. package/bin/commands/rest-stack-merge-readiness.mjs +74 -0
  169. package/bin/commands/rule-auto-resolve.mjs +9 -3
  170. package/bin/commands/shepherd-journal.d.mts +5 -4
  171. package/bin/commands/shepherd-journal.mjs +9 -8
  172. package/bin/commands/stack-drain.d.mts +1 -9
  173. package/bin/commands/stack-drain.mjs +50 -37
  174. package/bin/commands/stack-handoffs.d.mts +10 -0
  175. package/bin/commands/stack-handoffs.mjs +25 -0
  176. package/bin/commands/stack-stall.d.mts +5 -0
  177. package/bin/commands/stack-stall.mjs +11 -0
  178. package/bin/commands/stack-work.d.mts +5 -0
  179. package/bin/commands/stack-work.mjs +32 -0
  180. package/bin/comments/existing-reply-scan.d.mts +17 -0
  181. package/bin/comments/existing-reply-scan.mjs +41 -0
  182. package/bin/comments/rate-limit.mjs +2 -2
  183. package/bin/comments/resolve.d.mts +7 -1
  184. package/bin/comments/resolve.mjs +108 -18
  185. package/bin/comments/rest-reply.d.mts +9 -0
  186. package/bin/comments/rest-reply.mjs +95 -0
  187. package/bin/comments/rest-review-mutations.d.mts +22 -0
  188. package/bin/comments/rest-review-mutations.mjs +125 -0
  189. package/bin/comments/review-visibility.d.mts +1 -1
  190. package/bin/comments/review-visibility.mjs +3 -2
  191. package/bin/comments/sha-poll.mjs +7 -3
  192. package/bin/comments/thread-visibility.mjs +10 -5
  193. package/bin/comments/uncertain-replies.d.mts +11 -0
  194. package/bin/comments/uncertain-replies.mjs +121 -0
  195. package/bin/comments/uncertain-reply-guards.d.mts +10 -0
  196. package/bin/comments/uncertain-reply-guards.mjs +94 -0
  197. package/bin/comments/visible-comments.d.mts +1 -1
  198. package/bin/comments/visible-comments.mjs +4 -2
  199. package/bin/config/load.d.mts +37 -1
  200. package/bin/config/load.mjs +73 -1
  201. package/bin/config.json +6 -2
  202. package/bin/exit-codes.d.mts +3 -0
  203. package/bin/exit-codes.mjs +8 -0
  204. package/bin/github/api-telemetry-aggregate.d.mts +15 -4
  205. package/bin/github/api-telemetry-aggregate.mjs +57 -18
  206. package/bin/github/api-telemetry.d.mts +4 -0
  207. package/bin/github/api-telemetry.mjs +22 -8
  208. package/bin/github/apply-review-preflight.d.mts +20 -0
  209. package/bin/github/apply-review-preflight.mjs +61 -0
  210. package/bin/github/base-behind-cache.d.mts +15 -0
  211. package/bin/github/base-behind-cache.mjs +18 -0
  212. package/bin/github/batch-parse-suites.d.mts +4 -2
  213. package/bin/github/batch-parse-suites.mjs +6 -1
  214. package/bin/github/batch-parser-helpers.mjs +40 -2
  215. package/bin/github/batch-parsers.mjs +1 -0
  216. package/bin/github/batch-raw-rules.d.mts +26 -0
  217. package/bin/github/batch-raw-types.d.mts +8 -6
  218. package/bin/github/batch-stack-evidence.d.mts +28 -0
  219. package/bin/github/batch-stack-evidence.mjs +62 -0
  220. package/bin/github/batch.d.mts +15 -2
  221. package/bin/github/batch.mjs +34 -17
  222. package/bin/github/check-annotations-batch.d.mts +0 -5
  223. package/bin/github/check-annotations-batch.mjs +25 -4
  224. package/bin/github/check-annotations.mjs +3 -1
  225. package/bin/github/client.d.mts +8 -19
  226. package/bin/github/client.mjs +45 -13
  227. package/bin/github/fingerprint-fields.d.mts +8 -0
  228. package/bin/github/fingerprint-fields.mjs +6 -1
  229. package/bin/github/fingerprint.d.mts +4 -2
  230. package/bin/github/fingerprint.mjs +6 -38
  231. package/bin/github/github-fetch.d.mts +2 -0
  232. package/bin/github/github-fetch.mjs +19 -0
  233. package/bin/github/gql/base-behind.gql +3 -0
  234. package/bin/github/gql/batch-pr-page.gql +16 -0
  235. package/bin/github/gql/batch-pr.gql +57 -0
  236. package/bin/github/gql/commit-check-contexts.gql +17 -0
  237. package/bin/github/gql/get-pr-body.gql +1 -0
  238. package/bin/github/gql/poll-stack-summary.gql +1 -0
  239. package/bin/github/gql/poll-summary-check-contexts.gql +5 -0
  240. package/bin/github/gql/poll-summary-fragment.gql +65 -15
  241. package/bin/github/gql/stack-handoff-check-runs.gql +42 -0
  242. package/bin/github/graphql-http.mjs +9 -4
  243. package/bin/github/graphql-internal-retry.d.mts +2 -0
  244. package/bin/github/graphql-internal-retry.mjs +1 -1
  245. package/bin/github/graphql-quota-probe.d.mts +6 -0
  246. package/bin/github/graphql-quota-probe.mjs +56 -0
  247. package/bin/github/graphql-session-refusal.d.mts +8 -0
  248. package/bin/github/graphql-session-refusal.mjs +14 -0
  249. package/bin/github/http-request.d.mts +1 -1
  250. package/bin/github/http-request.mjs +22 -6
  251. package/bin/github/http-utils.mjs +6 -0
  252. package/bin/github/merge-target-rules.d.mts +12 -3
  253. package/bin/github/merge-target-rules.mjs +71 -34
  254. package/bin/github/mutation-policy.d.mts +6 -0
  255. package/bin/github/mutation-policy.mjs +21 -0
  256. package/bin/github/poll-summary-annotation-probe.mjs +17 -10
  257. package/bin/github/poll-summary-check-blockers.d.mts +1 -1
  258. package/bin/github/poll-summary-check-blockers.mjs +2 -2
  259. package/bin/github/poll-summary-check-hydration.mjs +25 -10
  260. package/bin/github/poll-summary-checks.d.mts +2 -2
  261. package/bin/github/poll-summary-checks.mjs +9 -6
  262. package/bin/github/poll-summary-command.d.mts +2 -0
  263. package/bin/github/poll-summary-command.mjs +24 -0
  264. package/bin/github/poll-summary-fingerprint.d.mts +1 -1
  265. package/bin/github/poll-summary-fingerprint.mjs +4 -2
  266. package/bin/github/poll-summary-handoff-fields.d.mts +3 -0
  267. package/bin/github/poll-summary-handoff-fields.mjs +73 -0
  268. package/bin/github/poll-summary-projector.d.mts +1 -1
  269. package/bin/github/poll-summary-projector.mjs +17 -24
  270. package/bin/github/poll-summary-raw.d.mts +70 -10
  271. package/bin/github/poll-summary-readiness.mjs +4 -1
  272. package/bin/github/poll-summary-rest-queue.d.mts +3 -0
  273. package/bin/github/poll-summary-rest-queue.mjs +12 -0
  274. package/bin/github/poll-summary-review.d.mts +1 -1
  275. package/bin/github/poll-summary-review.mjs +23 -11
  276. package/bin/github/poll-summary-route.mjs +19 -3
  277. package/bin/github/poll-summary-stack-page.d.mts +11 -0
  278. package/bin/github/poll-summary-stack-page.mjs +27 -0
  279. package/bin/github/poll-summary-unreported.d.mts +3 -1
  280. package/bin/github/poll-summary-unreported.mjs +6 -3
  281. package/bin/github/poll-summary.d.mts +4 -1
  282. package/bin/github/poll-summary.mjs +47 -33
  283. package/bin/github/queries.d.mts +7 -3
  284. package/bin/github/queries.mjs +8 -4
  285. package/bin/github/rate-limit-sample.d.mts +7 -0
  286. package/bin/github/rate-limit-sample.mjs +12 -0
  287. package/bin/github/reply-recovery-read.d.mts +50 -0
  288. package/bin/github/reply-recovery-read.mjs +118 -0
  289. package/bin/github/reply-thread-transcripts.d.mts +0 -1
  290. package/bin/github/reply-thread-transcripts.mjs +24 -1
  291. package/bin/github/rest-annotation-read.d.mts +5 -0
  292. package/bin/github/rest-annotation-read.mjs +44 -0
  293. package/bin/github/rest-batch-read.d.mts +12 -0
  294. package/bin/github/rest-batch-read.mjs +57 -0
  295. package/bin/github/rest-batch-snapshot.d.mts +30 -0
  296. package/bin/github/rest-batch-snapshot.mjs +115 -0
  297. package/bin/github/rest-batch-unavailable.d.mts +5 -0
  298. package/bin/github/rest-batch-unavailable.mjs +16 -0
  299. package/bin/github/rest-check-read.d.mts +34 -0
  300. package/bin/github/rest-check-read.mjs +124 -0
  301. package/bin/github/rest-comment-authorship.d.mts +7 -0
  302. package/bin/github/rest-comment-authorship.mjs +11 -0
  303. package/bin/github/rest-conditional-scope.d.mts +20 -0
  304. package/bin/github/rest-conditional-scope.mjs +44 -0
  305. package/bin/github/rest-explicit-summary-read.d.mts +3 -0
  306. package/bin/github/rest-explicit-summary-read.mjs +8 -0
  307. package/bin/github/rest-feedback-read.d.mts +36 -0
  308. package/bin/github/rest-feedback-read.mjs +147 -0
  309. package/bin/github/rest-feedback-validation.d.mts +5 -0
  310. package/bin/github/rest-feedback-validation.mjs +28 -0
  311. package/bin/github/rest-http.d.mts +12 -0
  312. package/bin/github/rest-http.mjs +108 -23
  313. package/bin/github/rest-identities.d.mts +22 -0
  314. package/bin/github/rest-identities.mjs +134 -0
  315. package/bin/github/rest-merge-stack-guard.d.mts +14 -0
  316. package/bin/github/rest-merge-stack-guard.mjs +41 -0
  317. package/bin/github/rest-merge.d.mts +29 -0
  318. package/bin/github/rest-merge.mjs +56 -0
  319. package/bin/github/rest-merged-base-read.d.mts +9 -0
  320. package/bin/github/rest-merged-base-read.mjs +48 -0
  321. package/bin/github/rest-pr-core.d.mts +52 -0
  322. package/bin/github/rest-pr-core.mjs +60 -0
  323. package/bin/github/rest-reader-core.d.mts +16 -0
  324. package/bin/github/rest-reader-core.mjs +154 -0
  325. package/bin/github/rest-review-read.d.mts +11 -0
  326. package/bin/github/rest-review-read.mjs +47 -0
  327. package/bin/github/rest-rules-read.d.mts +9 -0
  328. package/bin/github/rest-rules-read.mjs +154 -0
  329. package/bin/github/rest-session-refusal.d.mts +5 -0
  330. package/bin/github/rest-session-refusal.mjs +21 -0
  331. package/bin/github/rest-snapshot-context.d.mts +10 -0
  332. package/bin/github/rest-snapshot-context.mjs +1 -0
  333. package/bin/github/rest-stack-read.d.mts +21 -0
  334. package/bin/github/rest-stack-read.mjs +47 -0
  335. package/bin/github/rest-stack-summary.d.mts +8 -0
  336. package/bin/github/rest-stack-summary.mjs +62 -0
  337. package/bin/github/rest-summary-read.d.mts +7 -0
  338. package/bin/github/rest-summary-read.mjs +112 -0
  339. package/bin/github/rest-terminal-batch.d.mts +14 -0
  340. package/bin/github/rest-terminal-batch.mjs +45 -0
  341. package/bin/github/rest-text.mjs +7 -3
  342. package/bin/github/rest-thread-read.d.mts +4 -0
  343. package/bin/github/rest-thread-read.mjs +35 -0
  344. package/bin/github/rest-viewer-read.d.mts +2 -0
  345. package/bin/github/rest-viewer-read.mjs +41 -0
  346. package/bin/github/stack-bottom.d.mts +3 -0
  347. package/bin/github/stack-bottom.mjs +14 -0
  348. package/bin/github/stack-handoff-context.d.mts +25 -0
  349. package/bin/github/stack-handoff-context.mjs +12 -0
  350. package/bin/github/stack-handoff-page.d.mts +17 -0
  351. package/bin/github/stack-handoff-page.mjs +306 -0
  352. package/bin/github/stack-handoff.d.mts +16 -0
  353. package/bin/github/stack-handoff.mjs +115 -0
  354. package/bin/github/stack-order.d.mts +6 -0
  355. package/bin/github/stack-order.mjs +13 -0
  356. package/bin/github/stack-read.d.mts +7 -5
  357. package/bin/github/stack-read.mjs +22 -24
  358. package/bin/github/stack-size-hint.d.mts +3 -0
  359. package/bin/github/stack-size-hint.mjs +14 -0
  360. package/bin/github/suggestion-thread.mjs +27 -1
  361. package/bin/github/thread-comments.mjs +9 -1
  362. package/bin/github/transport-evidence.d.mts +20 -0
  363. package/bin/github/transport-evidence.mjs +26 -0
  364. package/bin/github/transport-mode.d.mts +2 -0
  365. package/bin/github/transport-mode.mjs +5 -0
  366. package/bin/github/transport.d.mts +19 -0
  367. package/bin/github/transport.mjs +126 -0
  368. package/bin/github/unsupported-rest.d.mts +4 -0
  369. package/bin/github/unsupported-rest.mjs +7 -0
  370. package/bin/mcp/server.mjs +52 -3
  371. package/bin/merge-status/derive.d.mts +2 -0
  372. package/bin/merge-status/derive.mjs +17 -13
  373. package/bin/merge-status/required-check-requirements.d.mts +7 -0
  374. package/bin/merge-status/required-check-requirements.mjs +15 -0
  375. package/bin/merge-status/requirements-format.d.mts +5 -0
  376. package/bin/merge-status/requirements-format.mjs +41 -12
  377. package/bin/merge-status/requirements.mjs +18 -7
  378. package/bin/state/base.mjs +41 -0
  379. package/bin/state/durable-state.d.mts +6 -0
  380. package/bin/state/durable-state.mjs +41 -0
  381. package/bin/state/graphql-quota-policy.mjs +23 -16
  382. package/bin/state/merge-request.d.mts +25 -0
  383. package/bin/state/merge-request.mjs +145 -0
  384. package/bin/state/pr-fingerprint.d.mts +15 -0
  385. package/bin/state/pr-fingerprint.mjs +22 -7
  386. package/bin/state/rest-cache.d.mts +3 -0
  387. package/bin/state/rest-cache.mjs +1 -0
  388. package/bin/state/rest-snapshot-report.d.mts +21 -0
  389. package/bin/state/rest-snapshot-report.mjs +52 -0
  390. package/bin/state/seen-comments.d.mts +3 -0
  391. package/bin/state/seen-comments.mjs +18 -0
  392. package/bin/types/api-usage.d.mts +9 -1
  393. package/bin/types/escalate.d.mts +1 -1
  394. package/bin/types/github.d.mts +23 -9
  395. package/bin/types/iterate.d.mts +24 -2
  396. package/bin/types/merge-action.d.mts +1 -1
  397. package/bin/types/merge-requirements.d.mts +7 -7
  398. package/bin/types/next-check.d.mts +12 -0
  399. package/bin/types/next-check.mjs +1 -0
  400. package/bin/types/poll-summary.d.mts +21 -0
  401. package/bin/types/report.d.mts +13 -1
  402. package/bin/types/review-thread.d.mts +1 -1
  403. package/bin/types.d.mts +1 -0
  404. package/bin/types.mjs +1 -0
  405. package/package.json +3 -2
  406. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  407. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  408. package/plugins/pr-shepherd/.mcp.json +1 -1
  409. package/plugins/pr-shepherd/skills/mark-files-as-viewed/SKILL.md +1 -1
  410. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +14 -51
  411. package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-failure-triage.md +12 -16
  412. package/plugins/pr-shepherd/skills/pr-shepherd/references/cloud-event-loop.md +14 -0
  413. package/plugins/pr-shepherd/skills/pr-shepherd/references/create-pr.md +10 -0
  414. package/plugins/pr-shepherd/skills/pr-shepherd/references/fix-code-loop.md +10 -0
  415. package/plugins/pr-shepherd/skills/pr-shepherd/references/mcp-fallback.md +9 -0
  416. package/plugins/pr-shepherd/skills/reduce-pr-noise/references/classifiers.md +2 -0
  417. package/bin/github/gql/pr-fingerprint.gql +0 -75
  418. package/plugins/pr-shepherd/skills/pr-shepherd/references/journal.md +0 -7
  419. package/plugins/pr-shepherd/skills/pr-shepherd/references/review-mutations.md +0 -9
  420. package/plugins/pr-shepherd/skills/pr-shepherd/references/stack-merge.md +0 -7
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Run a dispatched command, entering the durable state scope first when it resolves to event
3
+ * mode. Entering before log setup keeps the per-worktree log a peer of the seen markers and
4
+ * stall state an event session writes. Invalid flags or config fall through unscoped so the
5
+ * command handler reports them.
6
+ */
7
+ export declare function runInEventStateScope<T>(args: string[], work: () => Promise<T>): Promise<T>;
8
+ /**
9
+ * Report an invalid `--poll-mode` value as a usage error. Commands that only use the flag to
10
+ * pick a state scope (`log-file`, `clean`) call this before `runInPollModeScope`, because no
11
+ * later handler would reject a typo there. Returns true after printing the error.
12
+ */
13
+ export declare function rejectInvalidPollModeFlag(args: string[], command: string): boolean;
14
+ /**
15
+ * Run `work` in the durable state scope when `--poll-mode` in `args`, or else `poll.mode`,
16
+ * resolves to event mode. `log-file` and `clean` use this to reach the state an event tick
17
+ * writes.
18
+ */
19
+ export declare function runInPollModeScope<T>(args: string[], work: () => Promise<T>): Promise<T>;
@@ -0,0 +1,60 @@
1
+ import { loadConfig } from "../config/load.mjs";
2
+ import { EXIT } from "../exit-codes.mjs";
3
+ import { resolvePollMode } from "../commands/poll-mode.mjs";
4
+ import { runWithDurableState } from "../state/durable-state.mjs";
5
+ import { getFlag } from "./args.mjs";
6
+ import { isDefaultPollInvocation } from "./default-poll.mjs";
7
+ /** Subcommands that honor `--poll-mode`; the default poll invocation honors it too. */
8
+ const POLL_MODE_SUBCOMMANDS = new Set(["iterate", "poll"]);
9
+ const REQUESTABLE = ["auto", "poll", "event"];
10
+ function requestedPollMode(value) {
11
+ return REQUESTABLE.find((mode) => mode === value);
12
+ }
13
+ /**
14
+ * Run a dispatched command, entering the durable state scope first when it resolves to event
15
+ * mode. Entering before log setup keeps the per-worktree log a peer of the seen markers and
16
+ * stall state an event session writes. Invalid flags or config fall through unscoped so the
17
+ * command handler reports them.
18
+ */
19
+ export function runInEventStateScope(args, work) {
20
+ const subcommand = args[0];
21
+ const honorsPollMode = isDefaultPollInvocation(subcommand) || POLL_MODE_SUBCOMMANDS.has(subcommand ?? "");
22
+ return honorsPollMode ? runInPollModeScope(args, work) : work();
23
+ }
24
+ /**
25
+ * Report an invalid `--poll-mode` value as a usage error. Commands that only use the flag to
26
+ * pick a state scope (`log-file`, `clean`) call this before `runInPollModeScope`, because no
27
+ * later handler would reject a typo there. Returns true after printing the error.
28
+ */
29
+ export function rejectInvalidPollModeFlag(args, command) {
30
+ if (!args.some((arg) => arg === "--poll-mode" || arg.startsWith("--poll-mode=")))
31
+ return false;
32
+ const value = getFlag(args, "--poll-mode");
33
+ if (requestedPollMode(value))
34
+ return false;
35
+ process.stderr.write(`pr-shepherd: ${command}: --poll-mode must be one of ${REQUESTABLE.join(", ")}, got ${JSON.stringify(value ?? "")}\n`);
36
+ process.exitCode = EXIT.USAGE;
37
+ return true;
38
+ }
39
+ /**
40
+ * Run `work` in the durable state scope when `--poll-mode` in `args`, or else `poll.mode`,
41
+ * resolves to event mode. `log-file` and `clean` use this to reach the state an event tick
42
+ * writes.
43
+ */
44
+ export function runInPollModeScope(args, work) {
45
+ return resolvesToEvent(args) ? runWithDurableState(work) : work();
46
+ }
47
+ function resolvesToEvent(args) {
48
+ const flag = getFlag(args, "--poll-mode");
49
+ const requested = requestedPollMode(flag);
50
+ // An explicit poll or event request wins without reading config, so a malformed config
51
+ // cannot drop an explicit `--poll-mode event` out of the durable scope.
52
+ if (requested === "event" || requested === "poll")
53
+ return requested === "event";
54
+ try {
55
+ return resolvePollMode(requested, loadConfig().poll.mode) === "event";
56
+ }
57
+ catch {
58
+ return false;
59
+ }
60
+ }
@@ -1,5 +1,4 @@
1
1
  /* eslint-disable max-lines */
2
- import { renderResolveCommand } from "../commands/iterate/render.mjs";
3
2
  import { inlineCode, joinSections } from "../util/markdown.mjs";
4
3
  import { renderSuggestionBlock, renderLineRange } from "./suggestion-renderer.mjs";
5
4
  import { renderThreadBullet, renderReviewBullet, renderThreadResolutionStatusTag, renderAuthor, buildFirstLookBullets, renderThreadConversation, blockquote, } from "./list-formatters.mjs";
@@ -77,9 +76,8 @@ export function formatFixCodeResult(header, result, opts = {}) {
77
76
  const scopeTag = ch.scope
78
77
  ? ` [scope: ${ch.scope}${ch.commitOid ? `, commit: ${ch.commitOid}` : ""}]`
79
78
  : "";
80
- const rerunTag = ch.rerunCommand ? " [rerun authorized]" : "";
81
79
  const lines = [
82
- `- ${locator} — \`${workflowPrefix}${jobLabel}\`${conclusionTag}${attemptTag}${scopeTag}${rerunTag}`,
80
+ `- ${locator} — \`${workflowPrefix}${jobLabel}\`${conclusionTag}${attemptTag}${scopeTag}`,
83
81
  ];
84
82
  if (ch.conclusion !== "CANCELLED") {
85
83
  if (ch.failedStep)
@@ -184,13 +182,8 @@ export function formatFixCodeResult(header, result, opts = {}) {
184
182
  sections.push("## Cancelled runs");
185
183
  sections.push(result.cancelled.map((id) => `- \`${id}\``).join("\n"));
186
184
  }
187
- sections.push("## Post-fix actions");
188
- const postFixLines = [`- base: \`${result.baseBranch}\``];
189
- if (result.fix.resolveOnlyCommand?.hasMutations)
190
- postFixLines.push(`- resolve-only: \`${renderResolveCommand(result.fix.resolveOnlyCommand)}\``);
191
- if (result.fix.resolveCommand.hasMutations) {
192
- postFixLines.push(`- apply review: \`${renderResolveCommand(result.fix.resolveCommand)}\``);
193
- }
185
+ // The review mutation commands render inline in their `## Instructions` steps.
186
+ const postFixLines = verbose ? [`- base: \`${result.baseBranch}\``] : [];
194
187
  if (result.fix.requeue) {
195
188
  postFixLines.push(`- requeue: ${inlineCode(renderMergeCommand(result.fix.requeue.command))}`);
196
189
  if (result.fix.requeue.queueApiFallbackCommand) {
@@ -200,7 +193,8 @@ export function formatFixCodeResult(header, result, opts = {}) {
200
193
  if (result.fix.queueRemovalAcknowledgment) {
201
194
  postFixLines.push(`- acknowledge queue removal: ${inlineCode(renderMergeCommand(result.fix.queueRemovalAcknowledgment))}`);
202
195
  }
203
- sections.push(postFixLines.join("\n"));
196
+ if (postFixLines.length > 0)
197
+ sections.push("## Post-fix actions", postFixLines.join("\n"));
204
198
  sections.push("## Instructions");
205
199
  sections.push(numberInstructions(result.fix.instructions));
206
200
  return joinSections(sections);
@@ -1,4 +1,3 @@
1
- export declare function handleClean(args: string[], command?: "admin clean" | "clean"): Promise<void>;
2
1
  export declare function handleCommitSuggestion(args: string[], command?: "build-suggestion-patch" | "commit-suggestion"): Promise<void>;
3
2
  export declare function handleSuggestionPatches(args: string[]): Promise<void>;
4
3
  export declare function handleIterate(args: string[]): Promise<void>;
@@ -1,73 +1,16 @@
1
1
  import { runCommitSuggestion } from "../commands/commit-suggestion.mjs";
2
2
  import { runSuggestionPatches } from "../commands/suggestion-patches.mjs";
3
3
  import { runMarkFilesAsViewed } from "../commands/mark-files-as-viewed.mjs";
4
- import { runIterate } from "../commands/iterate/index.mjs";
5
- import { runClean } from "../commands/clean.mjs";
4
+ import { runIterateForMode } from "../commands/event-mode.mjs";
6
5
  import { loadConfig } from "../config/load.mjs";
7
6
  import { EXIT } from "../exit-codes.mjs";
8
7
  import { parseCommonArgs, getFlag } from "./args.mjs";
9
8
  import { USAGE } from "./help.mjs";
10
- import { formatCommitSuggestionResult, formatSuggestionPatchesResult, formatCleanResult, formatMarkFilesAsViewedResult, } from "./formatters.mjs";
9
+ import { formatCommitSuggestionResult, formatSuggestionPatchesResult, formatMarkFilesAsViewedResult, } from "./formatters.mjs";
11
10
  import { parseSuggestionPatchGroups } from "./suggestion-patch-flags.mjs";
12
- import { parseIterateFlags } from "./iterate-flags.mjs";
11
+ import { hasInvalidIterateFlags, parseIterateFlags } from "./iterate-flags.mjs";
13
12
  import { emitIterateResult } from "./iterate-emitter.mjs";
14
13
  import { parseMarkFilesAsViewedArgs } from "./mark-files-as-viewed-flags.mjs";
15
- const CLEAN_VARIANTS = new Set(["pr", "branch", "current", "repo", "all"]);
16
- export async function handleClean(args, command = "admin clean") {
17
- const usage = command === "admin clean" ? USAGE["admin clean"] : USAGE.clean;
18
- const variant = args[0];
19
- if (!variant || !CLEAN_VARIANTS.has(variant)) {
20
- process.stderr.write(`${usage}\n`);
21
- process.exitCode = EXIT.USAGE;
22
- return;
23
- }
24
- const rest = args.slice(1);
25
- for (const a of rest) {
26
- if (!a.startsWith("--"))
27
- continue;
28
- if (a === "--dry-run" || a === "--format" || a.startsWith("--format="))
29
- continue;
30
- process.stderr.write(`pr-shepherd: ${command}: unknown flag: "${a}"\n`);
31
- process.exitCode = EXIT.USAGE;
32
- return;
33
- }
34
- const fmtIdx = rest.indexOf("--format");
35
- const fmtEqEntry = rest.find((a) => a.startsWith("--format="));
36
- let formatValue;
37
- if (fmtEqEntry !== undefined) {
38
- formatValue = fmtEqEntry.slice("--format=".length);
39
- }
40
- else if (fmtIdx !== -1 && fmtIdx + 1 < rest.length && !rest[fmtIdx + 1].startsWith("--")) {
41
- formatValue = rest[fmtIdx + 1];
42
- }
43
- if (formatValue !== undefined && formatValue !== "text" && formatValue !== "json") {
44
- process.stderr.write(`pr-shepherd: ${command}: invalid --format value: "${formatValue}". Expected "text" or "json".\n`);
45
- process.exitCode = EXIT.USAGE;
46
- return;
47
- }
48
- const jsonOut = formatValue === "json";
49
- const dryRun = rest.includes("--dry-run");
50
- // Skip the value consumed by --format <value> so it isn't mistaken for the positional.
51
- const flagConsumedIndices = new Set();
52
- if (fmtIdx !== -1 && fmtIdx + 1 < rest.length && !rest[fmtIdx + 1].startsWith("--")) {
53
- flagConsumedIndices.add(fmtIdx);
54
- flagConsumedIndices.add(fmtIdx + 1);
55
- }
56
- const positionals = rest.filter((a, i) => !flagConsumedIndices.has(i) && !a.startsWith("--"));
57
- if (positionals.length > 1) {
58
- process.stderr.write(`pr-shepherd: ${command}: too many positional arguments (expected at most 1, got ${positionals.length})\n`);
59
- process.exitCode = EXIT.USAGE;
60
- return;
61
- }
62
- const value = positionals[0];
63
- const result = await runClean({ variant: variant, value, dryRun });
64
- if (!result.ok) {
65
- process.stderr.write(`pr-shepherd: ${command}: ${result.error}\n`);
66
- process.exitCode = EXIT.SOFTWARE;
67
- return;
68
- }
69
- process.stdout.write(jsonOut ? `${JSON.stringify(result, null, 2)}\n` : `${formatCleanResult(result)}\n`);
70
- }
71
14
  export async function handleCommitSuggestion(args, command = "build-suggestion-patch") {
72
15
  const { prNumber, global: globalOpts, extra } = parseCommonArgs(args);
73
16
  const threadId = getFlag(extra, "--thread-id");
@@ -113,11 +56,10 @@ export async function handleSuggestionPatches(args) {
113
56
  }
114
57
  export async function handleIterate(args) {
115
58
  const { prNumber, global: globalOpts, extra } = parseCommonArgs(args);
116
- const cfg = loadConfig();
117
- const flags = parseIterateFlags(extra, cfg);
118
- if (flags.readyDelaySuffix === null || flags.stallTimeoutSuffix === null)
59
+ const flags = parseIterateFlags(extra, loadConfig());
60
+ if (hasInvalidIterateFlags(flags))
119
61
  return;
120
- const result = await runIterate({
62
+ const result = await runIterateForMode({
121
63
  ...globalOpts,
122
64
  prNumber,
123
65
  readyDelaySeconds: flags.readyDelaySeconds,
@@ -125,6 +67,8 @@ export async function handleIterate(args) {
125
67
  noAutoMarkReady: flags.noAutoMarkReady,
126
68
  noAutoCancelActionable: flags.noAutoCancelActionable,
127
69
  merge: flags.merge,
70
+ instructions: flags.instructions ?? undefined,
71
+ pollMode: flags.pollMode ?? undefined,
128
72
  });
129
73
  emitIterateResult(result, {
130
74
  format: globalOpts.format,
@@ -1,10 +1,29 @@
1
1
  export declare const COMMAND_USAGE: {
2
2
  readonly default: string;
3
+ readonly "apply merge": `pr-shepherd apply merge
4
+
5
+ Submit one SHA-guarded asynchronous merge or enqueue request with REST.
6
+ Rerun the same command to resume its persisted UUID. Pending and enqueued requests are not merged.
7
+ An enqueued result records that request's outcome; it does not confirm current queue membership.
8
+ An uncertain submission is never repeated automatically.
9
+
10
+ Usage:
11
+ pr-shepherd apply merge [PR] --require-sha SHA --merge-action direct_merge|merge_queue|default
12
+ [--method merge|squash|rebase] [--expected-stack JSON] --transport rest [--format text|json]
13
+
14
+ --require-sha <sha> Full 40-character lowercase PR head SHA.
15
+ --merge-action <action> direct_merge, merge_queue, or default.
16
+ --method <method> Optional merge method, only for direct_merge.
17
+ --expected-stack <json> Bind native stack number, baseRefName, and ordered prefix PRs/refs/head SHAs.
18
+ --transport rest Required REST transport; repository rules are never bypassed.
19
+ --format text|json Output format. Default: text.
20
+ --help, -h Print this help before validation or I/O.`;
3
21
  readonly apply: `pr-shepherd apply
4
22
 
5
23
  Apply review mutations, mark selected changed files as viewed, append a PR journal item, or record an external check blocker.
6
24
 
7
25
  Usage:
26
+ pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest
8
27
  pr-shepherd apply review [PR] [review-flags]
9
28
  pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
10
29
  pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
@@ -13,7 +32,7 @@ Usage:
13
32
  pr-shepherd apply check-blocker [PR] --check <name> --clear
14
33
  pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
15
34
 
16
- Run 'pr-shepherd apply <review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
35
+ Run 'pr-shepherd apply <merge|review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
17
36
  --help, -h Print this help and exit before GitHub I/O.`;
18
37
  readonly "apply review": `pr-shepherd apply review
19
38
 
@@ -32,7 +51,11 @@ Flags:
32
51
  --minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
33
52
  --dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
34
53
  --message <text> Reply/dismiss message. Required with reply or dismiss IDs.
35
- --require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
54
+ --require-sha <sha> Wait for this full 40-character lowercase PR head SHA, or HEAD
55
+ for this checkout's commit.
56
+ --adopt-existing-replies Generated durable-state commands only: count a thread whose last
57
+ comment is already this exact Shepherd reply from you as replied
58
+ instead of posting it again. Omit it to forward every reply ID.
36
59
  --format text|json Output format. Default: text.
37
60
 
38
61
  At least one action flag is required.
@@ -143,14 +166,16 @@ Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
143
166
  Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
144
167
 
145
168
  Usage:
146
- pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
147
- pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
148
- pr-shepherd admin clean current [--dry-run] [--format text|json]
149
- pr-shepherd admin clean repo [--dry-run] [--format text|json]
150
- pr-shepherd admin clean all [--dry-run] [--format text|json]
169
+ pr-shepherd admin clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
170
+ pr-shepherd admin clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
171
+ pr-shepherd admin clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
172
+ pr-shepherd admin clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
173
+ pr-shepherd admin clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
151
174
 
152
175
  Variants remove state for one PR, branch, current branch, repository, or all repositories.
153
176
  Use --dry-run to preview paths without removing them.
177
+ --poll-mode auto|poll|event Clean the state for that poll mode; event mode keeps it in durable
178
+ state under the git common directory. Default: poll.mode (auto).
154
179
  --help, -h Print this help and exit before any cleanup.`;
155
180
  readonly "admin log-file": string;
156
181
  readonly resolve: `pr-shepherd resolve
@@ -172,9 +197,10 @@ Flags:
172
197
  --dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
173
198
  --message <text> Reply/dismiss message. Required with --reply-thread-ids
174
199
  or --dismiss-review-ids.
175
- --require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
176
- Must be a full 40-character lowercase hex SHA. Local HEAD is valid
177
- only when it equals the current remote PR head.
200
+ --require-sha <sha> Wait until GitHub reports this PR head SHA (or HEAD) before mutating.
201
+ Must be a full 40-character lowercase hex SHA, or HEAD for this
202
+ checkout's commit. Local HEAD is valid only when it equals the
203
+ current remote PR head.
178
204
  --format text|json Output format. Default: text.
179
205
  --help, -h Print this help and exit before GitHub I/O.
180
206
 
@@ -227,18 +253,18 @@ Flags:
227
253
 
228
254
  PR may be a number or GitHub pull request URL. When omitted, the current branch PR is inferred.
229
255
  Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
230
- readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed or ready-delay elapsed. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
231
- readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
256
+ readonly iterate: "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed or ready-delay elapsed. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
257
+ readonly poll: "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
232
258
  readonly clean: `pr-shepherd clean
233
259
 
234
260
  Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
235
261
 
236
262
  Usage:
237
- pr-shepherd clean pr [number] [--dry-run] [--format text|json]
238
- pr-shepherd clean branch [name] [--dry-run] [--format text|json]
239
- pr-shepherd clean current [--dry-run] [--format text|json]
240
- pr-shepherd clean repo [--dry-run] [--format text|json]
241
- pr-shepherd clean all [--dry-run] [--format text|json]
263
+ pr-shepherd clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
264
+ pr-shepherd clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
265
+ pr-shepherd clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
266
+ pr-shepherd clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
267
+ pr-shepherd clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
242
268
 
243
269
  Variants:
244
270
  pr [number] Remove state for one PR. Defaults to current branch PR.
@@ -251,6 +277,9 @@ Variants:
251
277
  Flags:
252
278
  --dry-run Preview paths without removing them.
253
279
  --format text|json Output format. Default: text.
280
+ --poll-mode auto|poll|event
281
+ Clean the state for that poll mode; event mode keeps it in durable
282
+ state under the git common directory. Default: poll.mode (auto).
254
283
  --help, -h Print this help and exit before any cleanup.
255
284
 
256
285
  Exit code: 0 on success (including a no-op --dry-run on a nonexistent target); nonzero on failure (sysexits.h — see docs/exit-codes.md).`;
@@ -291,5 +320,20 @@ Malformed or unrecognized journal content is returned as {"ok":false,...} with e
291
320
  On POSIX, the final body-file path entry must be a readable regular file in a trusted parent directory;
292
321
  symlinks, FIFOs, devices, and unreadable paths exit 66. Unsupported platforms fail closed with exit 66.
293
322
  --help, -h Print this help and exit before any I/O.`;
294
- readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
323
+ readonly playbook: `pr-shepherd playbook
324
+
325
+ Print a playbook named by a playbook pointer in the output's ## Instructions. Playbooks ship with the
326
+ package, so this works without the pr-shepherd skill installed. With no name, lists every playbook.
327
+ This command performs no GitHub, git, or log I/O.
328
+
329
+ Usage:
330
+ pr-shepherd playbook [name] [--format text|json]
331
+
332
+ Flags:
333
+ --format text|json Markdown text (default) or one JSON line: {"name","content"} or {"playbooks":[...]}.
334
+
335
+ The name is case-insensitive; spaces and hyphens are equivalent ("Fix-code loop" and fix-code-loop match).
336
+ Unknown names exit 64 and list the available playbooks.
337
+ --help, -h Print this help and exit before any I/O.`;
338
+ readonly "log-file": "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --poll-mode auto|poll|event\n Report the log for that poll mode; event mode keeps it in durable\n state under the git common directory. Default: poll.mode (auto).\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
295
339
  };
@@ -3,11 +3,30 @@ import { LOG_FILE_USAGE } from "./help-log-file-page.mjs";
3
3
  import { DEFAULT_USAGE, ITERATE_USAGE, POLL_USAGE } from "./help-iterate-poll-pages.mjs";
4
4
  export const COMMAND_USAGE = {
5
5
  default: DEFAULT_USAGE,
6
+ "apply merge": `pr-shepherd apply merge
7
+
8
+ Submit one SHA-guarded asynchronous merge or enqueue request with REST.
9
+ Rerun the same command to resume its persisted UUID. Pending and enqueued requests are not merged.
10
+ An enqueued result records that request's outcome; it does not confirm current queue membership.
11
+ An uncertain submission is never repeated automatically.
12
+
13
+ Usage:
14
+ pr-shepherd apply merge [PR] --require-sha SHA --merge-action direct_merge|merge_queue|default
15
+ [--method merge|squash|rebase] [--expected-stack JSON] --transport rest [--format text|json]
16
+
17
+ --require-sha <sha> Full 40-character lowercase PR head SHA.
18
+ --merge-action <action> direct_merge, merge_queue, or default.
19
+ --method <method> Optional merge method, only for direct_merge.
20
+ --expected-stack <json> Bind native stack number, baseRefName, and ordered prefix PRs/refs/head SHAs.
21
+ --transport rest Required REST transport; repository rules are never bypassed.
22
+ --format text|json Output format. Default: text.
23
+ --help, -h Print this help before validation or I/O.`,
6
24
  apply: `pr-shepherd apply
7
25
 
8
26
  Apply review mutations, mark selected changed files as viewed, append a PR journal item, or record an external check blocker.
9
27
 
10
28
  Usage:
29
+ pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest
11
30
  pr-shepherd apply review [PR] [review-flags]
12
31
  pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
13
32
  pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
@@ -16,7 +35,7 @@ Usage:
16
35
  pr-shepherd apply check-blocker [PR] --check <name> --clear
17
36
  pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>
18
37
 
19
- Run 'pr-shepherd apply <review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
38
+ Run 'pr-shepherd apply <merge|review|files|journal|check-blocker|queue-removal> --help' for command-specific details.
20
39
  --help, -h Print this help and exit before GitHub I/O.`,
21
40
  "apply review": `pr-shepherd apply review
22
41
 
@@ -35,7 +54,11 @@ Flags:
35
54
  --minimize-comment-ids <ids> Comma-separated issue/review comment IDs to minimize.
36
55
  --dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
37
56
  --message <text> Reply/dismiss message. Required with reply or dismiss IDs.
38
- --require-sha <sha> Wait for this full 40-character lowercase PR head SHA.
57
+ --require-sha <sha> Wait for this full 40-character lowercase PR head SHA, or HEAD
58
+ for this checkout's commit.
59
+ --adopt-existing-replies Generated durable-state commands only: count a thread whose last
60
+ comment is already this exact Shepherd reply from you as replied
61
+ instead of posting it again. Omit it to forward every reply ID.
39
62
  --format text|json Output format. Default: text.
40
63
 
41
64
  At least one action flag is required.
@@ -146,14 +169,16 @@ Run 'pr-shepherd admin <clean|log-file> --help' for command-specific details.
146
169
  Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
147
170
 
148
171
  Usage:
149
- pr-shepherd admin clean pr [number] [--dry-run] [--format text|json]
150
- pr-shepherd admin clean branch [name] [--dry-run] [--format text|json]
151
- pr-shepherd admin clean current [--dry-run] [--format text|json]
152
- pr-shepherd admin clean repo [--dry-run] [--format text|json]
153
- pr-shepherd admin clean all [--dry-run] [--format text|json]
172
+ pr-shepherd admin clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
173
+ pr-shepherd admin clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
174
+ pr-shepherd admin clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
175
+ pr-shepherd admin clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
176
+ pr-shepherd admin clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
154
177
 
155
178
  Variants remove state for one PR, branch, current branch, repository, or all repositories.
156
179
  Use --dry-run to preview paths without removing them.
180
+ --poll-mode auto|poll|event Clean the state for that poll mode; event mode keeps it in durable
181
+ state under the git common directory. Default: poll.mode (auto).
157
182
  --help, -h Print this help and exit before any cleanup.`,
158
183
  "admin log-file": LOG_FILE_USAGE.replaceAll("pr-shepherd log-file", "pr-shepherd admin log-file"),
159
184
  resolve: `pr-shepherd resolve
@@ -175,9 +200,10 @@ Flags:
175
200
  --dismiss-review-ids <ids> Comma-separated review IDs to dismiss.
176
201
  --message <text> Reply/dismiss message. Required with --reply-thread-ids
177
202
  or --dismiss-review-ids.
178
- --require-sha <sha> Wait until GitHub reports this PR head SHA before mutating.
179
- Must be a full 40-character lowercase hex SHA. Local HEAD is valid
180
- only when it equals the current remote PR head.
203
+ --require-sha <sha> Wait until GitHub reports this PR head SHA (or HEAD) before mutating.
204
+ Must be a full 40-character lowercase hex SHA, or HEAD for this
205
+ checkout's commit. Local HEAD is valid only when it equals the
206
+ current remote PR head.
181
207
  --format text|json Output format. Default: text.
182
208
  --help, -h Print this help and exit before GitHub I/O.
183
209
 
@@ -237,11 +263,11 @@ Exit code: 0 on success; nonzero on failure (sysexits.h — see docs/exit-codes.
237
263
  Remove pr-shepherd state files from PR_SHEPHERD_STATE_DIR.
238
264
 
239
265
  Usage:
240
- pr-shepherd clean pr [number] [--dry-run] [--format text|json]
241
- pr-shepherd clean branch [name] [--dry-run] [--format text|json]
242
- pr-shepherd clean current [--dry-run] [--format text|json]
243
- pr-shepherd clean repo [--dry-run] [--format text|json]
244
- pr-shepherd clean all [--dry-run] [--format text|json]
266
+ pr-shepherd clean pr [number] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
267
+ pr-shepherd clean branch [name] [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
268
+ pr-shepherd clean current [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
269
+ pr-shepherd clean repo [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
270
+ pr-shepherd clean all [--dry-run] [--format text|json] [--poll-mode auto|poll|event]
245
271
 
246
272
  Variants:
247
273
  pr [number] Remove state for one PR. Defaults to current branch PR.
@@ -254,6 +280,9 @@ Variants:
254
280
  Flags:
255
281
  --dry-run Preview paths without removing them.
256
282
  --format text|json Output format. Default: text.
283
+ --poll-mode auto|poll|event
284
+ Clean the state for that poll mode; event mode keeps it in durable
285
+ state under the git common directory. Default: poll.mode (auto).
257
286
  --help, -h Print this help and exit before any cleanup.
258
287
 
259
288
  Exit code: 0 on success (including a no-op --dry-run on a nonexistent target); nonzero on failure (sysexits.h — see docs/exit-codes.md).`,
@@ -293,6 +322,21 @@ The output is exactly one JSON line: the typed result from extractShepherdJourna
293
322
  Malformed or unrecognized journal content is returned as {"ok":false,...} with exit code 0.
294
323
  On POSIX, the final body-file path entry must be a readable regular file in a trusted parent directory;
295
324
  symlinks, FIFOs, devices, and unreadable paths exit 66. Unsupported platforms fail closed with exit 66.
325
+ --help, -h Print this help and exit before any I/O.`,
326
+ playbook: `pr-shepherd playbook
327
+
328
+ Print a playbook named by a playbook pointer in the output's ## Instructions. Playbooks ship with the
329
+ package, so this works without the pr-shepherd skill installed. With no name, lists every playbook.
330
+ This command performs no GitHub, git, or log I/O.
331
+
332
+ Usage:
333
+ pr-shepherd playbook [name] [--format text|json]
334
+
335
+ Flags:
336
+ --format text|json Markdown text (default) or one JSON line: {"name","content"} or {"playbooks":[...]}.
337
+
338
+ The name is case-insensitive; spaces and hyphens are equivalent ("Fix-code loop" and fix-code-loop match).
339
+ Unknown names exit 64 and list the available playbooks.
296
340
  --help, -h Print this help and exit before any I/O.`,
297
341
  "log-file": LOG_FILE_USAGE,
298
342
  };
@@ -1,4 +1,4 @@
1
- export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed or ready-delay elapsed. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
- export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
1
+ export declare const ITERATE_USAGE = "pr-shepherd iterate\n\nRun one iterate tick for a pull request. The no-subcommand form polls; use this subcommand for a single tick.\nThe output contains one action and an action-specific ## Instructions section.\n\nUsage:\n pr-shepherd iterate [PR] [iterate-flags]\n\nIterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number is minutes; decimals are allowed only with an explicit unit (4.5m).\n\nActions:\n WAIT No immediate action; continue with the next poll.\n MARK_READY Draft PR was marked ready; continue with the next poll.\n READY Clean PR is inside the ready-delay. Schedule the rerun for when remainingSeconds elapses. Do not invent unrelated work. Already-owned later work may continue.\n FIX_CODE Agent action is required; follow the instructions, then continue polling.\n CANCEL Stop polling this pull request: merged/closed or ready-delay elapsed. Continue remaining work from the original request.\n ESCALATE Stop polling until a human provides direction.\n MERGE Run the emitted merge/queue command, then continue monitoring.\n\nExit codes:\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
2
+ export declare const POLL_USAGE = "pr-shepherd poll\n\nRun iterate repeatedly for one PR, or read compact summaries for an explicit PR set or native\nGitHub stack. Aggregate mode returns when any row needs work, every row is terminal, or timeout.\nPoll exits as soon as iterate returns READY, MARK_READY, CANCEL, or ESCALATE, or when timeout\nreturns the last WAIT result. FIX_CODE starts a --debounce settle window (default:\npoll.debounceSeconds; built-in 1m): poll keeps\niterating at --interval, then runs one more tick after the window and returns that result.\nWith --until-terminal or --merge, poll also continues through MARK_READY.\n\nUsage:\n pr-shepherd poll [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd poll --stack PR [poll-flags] [iterate-flags]\n\nPoll flags:\n --stack PR Select all entries in PR's native GitHub stack, bottom to top.\n --interval <duration> Sleep between WAIT ticks. Bare number = seconds. Default: poll.intervalSeconds (built-in 60s). Stack and multi-PR polls multiply that by poll.stackIntervalFactor (built-in 2) unless this flag is set.\n --timeout <duration> Maximum wall-clock wait for WAIT ticks. Bare number = seconds. Default: poll.timeoutSeconds (built-in 4.5m).\n --debounce <duration> Settle window after first FIX_CODE or stack SHEPHERD before returning. Bare number = seconds. Default: poll.debounceSeconds (built-in 60s). 0 disables.\n --quiet-status Print only changed WAIT snapshots. Overrides poll.quietStatus.\n --no-quiet-status Print every WAIT snapshot. Overrides poll.quietStatus.\n --until-terminal Continue through WAIT/MARK_READY until READY/FIX_CODE/MERGE/CANCEL/ESCALATE or stack SHEPHERD.\n\nForwarded iterate flags:\n --ready-delay <duration> Settle window before a clean PR cancels. Bare number = minutes. Example: 15m.\n --stall-timeout <duration> Escalate repeated unchanged failures after this duration. Bare number = minutes. 0 disables.\n --no-auto-mark-ready Do not convert draft PRs to ready for review.\n --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.\n --merge Shepherd through readiness, then emit a merge or merge-queue command.\n --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).\n --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).\n --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed per-tick lines.\n --help, -h Print this help and exit before GitHub, git, config, or log I/O.\n\nDurations accept s/m/h suffixes: 30s, 4.5m, 1h. A bare number uses each flag's default unit (seconds\nfor --interval/--timeout/--debounce, minutes for --ready-delay/--stall-timeout); decimals are allowed only with\nan explicit unit (4.5m).\nEach WAIT tick writes a stderr line naming what it is waiting on by default; poll.quietStatus can change that default, --quiet-status/--no-quiet-status override it, and --verbose emits detailed per-tick lines.\nFIX_CODE debounce writes a remaining-seconds line to stderr. --timeout does not cut an in-flight debounce short.\nWith --until-terminal, --timeout is ignored for WAIT ticks and polling continues until READY, FIX_CODE, MERGE, CANCEL, or ESCALATE. With --merge, --timeout still bounds WAIT ticks; it only continues through MARK_READY while polling remains within that timeout.\n\nExit codes: same as iterate (the final tick's action/reason decides the code).\n 0 CANCEL (merged or ready-delay elapsed)\n 10 WAIT or READY (including a WAIT returned by --timeout)\n 11 MARK_READY\n 12 FIX_CODE\n 13 ESCALATE\n 14 CANCEL (closed without merging)\n 15 MERGE\n 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\n A command/validation/GitHub failure exits with a sysexits.h code instead (see docs/exit-codes.md).";
3
3
  /** Public help page for the default PR polling invocation. */
4
4
  export declare const DEFAULT_USAGE: string;
@@ -12,6 +12,9 @@ Iterate flags:
12
12
  --no-auto-mark-ready Do not convert draft PRs to ready for review.
13
13
  --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
14
14
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
15
+ --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
16
+ --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).
17
+ --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
15
18
  --format text|json Output Markdown text or JSON. Default: text.
16
19
  --verbose Include verbose iterate fields.
17
20
  --help, -h Print this help and exit before GitHub, git, config, or log I/O.
@@ -65,6 +68,9 @@ Forwarded iterate flags:
65
68
  --no-auto-mark-ready Do not convert draft PRs to ready for review.
66
69
  --no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
67
70
  --merge Shepherd through readiness, then emit a merge or merge-queue command.
71
+ --instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
72
+ --poll-mode auto|poll|event event runs one tick, never sleeps, and prints nextCheck; auto picks event when CLAUDE_CODE_REMOTE=true. Default: poll.mode (auto).
73
+ --transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
68
74
  --format text|json Output Markdown text or JSON. Default: text.
69
75
  --verbose Include verbose iterate fields and detailed per-tick lines.
70
76
  --help, -h Print this help and exit before GitHub, git, config, or log I/O.
@@ -1 +1 @@
1
- export declare const LOG_FILE_USAGE = "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
1
+ export declare const LOG_FILE_USAGE = "pr-shepherd log-file\n\nPrint the per-worktree append-only debug log path for the current repository.\nThe log is created by the first non-help pr-shepherd command that initializes logging.\n\nUsage:\n pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]\n\nFlags:\n --format text|json Print a raw path or {\"path\": \"...\"} JSON. Default: text.\n --poll-mode auto|poll|event\n Report the log for that poll mode; event mode keeps it in durable\n state under the git common directory. Default: poll.mode (auto).\n --help, -h Print this help and exit before logging setup.\n\nEnvironment:\n PR_SHEPHERD_LOG_DISABLED=1 disables logging.\n PR_SHEPHERD_STATE_DIR overrides the base state directory.\n\nExit code: 0 on success; 1 if repository identity cannot be resolved.";
@@ -4,10 +4,13 @@ Print the per-worktree append-only debug log path for the current repository.
4
4
  The log is created by the first non-help pr-shepherd command that initializes logging.
5
5
 
6
6
  Usage:
7
- pr-shepherd log-file [--format text|json]
7
+ pr-shepherd log-file [--format text|json] [--poll-mode auto|poll|event]
8
8
 
9
9
  Flags:
10
10
  --format text|json Print a raw path or {"path": "..."} JSON. Default: text.
11
+ --poll-mode auto|poll|event
12
+ Report the log for that poll mode; event mode keeps it in durable
13
+ state under the git common directory. Default: poll.mode (auto).
11
14
  --help, -h Print this help and exit before logging setup.
12
15
 
13
16
  Environment: