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.
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +44 -27
- package/bin/api.d.mts +25 -3
- package/bin/api.mjs +51 -13
- package/bin/checks/classify.d.mts +1 -0
- package/bin/checks/classify.mjs +1 -1
- package/bin/checks/conclusions.d.mts +5 -1
- package/bin/checks/conclusions.mjs +8 -2
- package/bin/checks/superseded.d.mts +8 -2
- package/bin/checks/superseded.mjs +24 -7
- package/bin/classify/loader.d.mts +2 -0
- package/bin/classify/loader.mjs +15 -0
- package/bin/classify/standard/author.d.mts +3 -0
- package/bin/classify/standard/author.mjs +10 -0
- package/bin/classify/standard/codecov-report.d.mts +4 -0
- package/bin/classify/standard/codecov-report.mjs +10 -0
- package/bin/classify/standard/coderabbit-notices.d.mts +8 -0
- package/bin/classify/standard/coderabbit-notices.mjs +38 -0
- package/bin/classify/standard/coderabbit-review-summary.d.mts +8 -0
- package/bin/classify/standard/coderabbit-review-summary.mjs +37 -0
- package/bin/classify/standard/codex-notices.d.mts +7 -0
- package/bin/classify/standard/codex-notices.mjs +36 -0
- package/bin/classify/standard/codex-review-summary.d.mts +7 -0
- package/bin/classify/standard/codex-review-summary.mjs +20 -0
- package/bin/classify/standard/dependabot-notices.d.mts +4 -0
- package/bin/classify/standard/dependabot-notices.mjs +15 -0
- package/bin/classify/standard/gemini-notices.d.mts +4 -0
- package/bin/classify/standard/gemini-notices.mjs +13 -0
- package/bin/classify/standard/index.d.mts +4 -0
- package/bin/classify/standard/index.mjs +22 -0
- package/bin/classify/standard/kilo-no-issues.d.mts +4 -0
- package/bin/classify/standard/kilo-no-issues.mjs +17 -0
- package/bin/classify/standard/sourcery-notices.d.mts +8 -0
- package/bin/classify/standard/sourcery-notices.mjs +20 -0
- package/bin/cli/api-usage-formatter.mjs +6 -1
- package/bin/cli/apply-merge-handler.d.mts +3 -0
- package/bin/cli/apply-merge-handler.mjs +73 -0
- package/bin/cli/arg-flags.d.mts +2 -0
- package/bin/cli/arg-flags.mjs +47 -0
- package/bin/cli/args.mjs +10 -41
- package/bin/cli/clean-handler.d.mts +1 -0
- package/bin/cli/clean-handler.mjs +71 -0
- package/bin/cli/default-poll.mjs +3 -0
- package/bin/cli/event-state-scope.d.mts +19 -0
- package/bin/cli/event-state-scope.mjs +60 -0
- package/bin/cli/fix-formatter.mjs +5 -11
- package/bin/cli/handlers.d.mts +0 -1
- package/bin/cli/handlers.mjs +8 -64
- package/bin/cli/help-command-pages.d.mts +62 -18
- package/bin/cli/help-command-pages.mjs +59 -15
- package/bin/cli/help-iterate-poll-pages.d.mts +2 -2
- package/bin/cli/help-iterate-poll-pages.mjs +6 -0
- package/bin/cli/help-log-file-page.d.mts +1 -1
- package/bin/cli/help-log-file-page.mjs +4 -1
- package/bin/cli/help-top-page.d.mts +1 -1
- package/bin/cli/help-top-page.mjs +5 -0
- package/bin/cli/help.d.mts +63 -19
- package/bin/cli/help.mjs +2 -0
- package/bin/cli/iterate-branch-segment.d.mts +2 -0
- package/bin/cli/iterate-branch-segment.mjs +12 -7
- package/bin/cli/iterate-flags.d.mts +7 -1
- package/bin/cli/iterate-flags.mjs +38 -0
- package/bin/cli/iterate-formatter.d.mts +6 -6
- package/bin/cli/iterate-formatter.mjs +56 -22
- package/bin/cli/iterate-instructions.mjs +45 -15
- package/bin/cli/iterate-lean.mjs +39 -14
- package/bin/cli/iterate-merge-formatter.d.mts +6 -0
- package/bin/cli/iterate-merge-formatter.mjs +24 -14
- package/bin/cli/iterate-verbose.mjs +3 -6
- package/bin/cli/list-formatters.mjs +3 -1
- package/bin/cli/mutate-formatter.mjs +10 -5
- package/bin/cli/next-check-format.d.mts +7 -0
- package/bin/cli/next-check-format.mjs +10 -0
- package/bin/cli/playbook-handler.d.mts +5 -0
- package/bin/cli/playbook-handler.mjs +40 -0
- package/bin/cli/poll-handler.mjs +7 -6
- package/bin/cli/poll-summary-formatter.mjs +11 -2
- package/bin/cli/poll-targets.mjs +2 -0
- package/bin/cli/resolve-validators.mjs +2 -2
- package/bin/cli/runner.mjs +6 -1
- package/bin/cli/stack-layer-view.d.mts +33 -0
- package/bin/cli/stack-layer-view.mjs +1 -0
- package/bin/cli/stack-overview.d.mts +10 -28
- package/bin/cli/stack-overview.mjs +39 -14
- package/bin/cli/transport-args.d.mts +5 -0
- package/bin/cli/transport-args.mjs +23 -0
- package/bin/cli/transport-formatter.d.mts +9 -0
- package/bin/cli/transport-formatter.mjs +13 -0
- package/bin/cli-parser.mjs +62 -7
- package/bin/commands/apply-merge-options.d.mts +4 -0
- package/bin/commands/apply-merge-options.mjs +34 -0
- package/bin/commands/apply-merge-output.d.mts +7 -0
- package/bin/commands/apply-merge-output.mjs +20 -0
- package/bin/commands/apply-merge-pull.d.mts +20 -0
- package/bin/commands/apply-merge-pull.mjs +15 -0
- package/bin/commands/apply-merge.d.mts +18 -0
- package/bin/commands/apply-merge.mjs +126 -0
- package/bin/commands/apply-queue-removal.mjs +7 -0
- package/bin/commands/check-annotations.mjs +28 -18
- package/bin/commands/check-execution-context.d.mts +5 -0
- package/bin/commands/check-execution-context.mjs +16 -1
- package/bin/commands/check-fingerprint.d.mts +26 -2
- package/bin/commands/check-fingerprint.mjs +64 -28
- package/bin/commands/check-terminal-report.mjs +11 -1
- package/bin/commands/check-unreported.d.mts +6 -2
- package/bin/commands/check-unreported.mjs +32 -12
- package/bin/commands/check-wait-detectors.d.mts +35 -0
- package/bin/commands/check-wait-detectors.mjs +107 -0
- package/bin/commands/check.d.mts +4 -2
- package/bin/commands/check.mjs +130 -40
- package/bin/commands/event-instructions.d.mts +11 -0
- package/bin/commands/event-instructions.mjs +27 -0
- package/bin/commands/event-mode.d.mts +14 -0
- package/bin/commands/event-mode.mjs +138 -0
- package/bin/commands/iterate/api-usage.mjs +4 -2
- package/bin/commands/iterate/base.mjs +4 -0
- package/bin/commands/iterate/check-blocker-gate.mjs +14 -2
- package/bin/commands/iterate/check-instructions.d.mts +9 -10
- package/bin/commands/iterate/check-instructions.mjs +23 -22
- package/bin/commands/iterate/classify.mjs +19 -5
- package/bin/commands/iterate/escalate.mjs +13 -3
- package/bin/commands/iterate/fix-code.mjs +26 -9
- package/bin/commands/iterate/fix-instruction-threads.d.mts +0 -8
- package/bin/commands/iterate/fix-instruction-threads.mjs +0 -16
- package/bin/commands/iterate/fix-loop-instruction.d.mts +9 -0
- package/bin/commands/iterate/fix-loop-instruction.mjs +35 -0
- package/bin/commands/iterate/helpers.mjs +15 -2
- package/bin/commands/iterate/index.mjs +26 -4
- package/bin/commands/iterate/mark-ready.mjs +50 -10
- package/bin/commands/iterate/merge-plan.d.mts +19 -0
- package/bin/commands/iterate/merge-plan.mjs +88 -0
- package/bin/commands/iterate/merge-state.mjs +3 -0
- package/bin/commands/iterate/merge.d.mts +4 -15
- package/bin/commands/iterate/merge.mjs +18 -51
- package/bin/commands/iterate/merged-base-pull-requests.d.mts +2 -6
- package/bin/commands/iterate/merged-base-pull-requests.mjs +15 -11
- package/bin/commands/iterate/native-stack-rebase.mjs +11 -0
- package/bin/commands/iterate/render.d.mts +8 -2
- package/bin/commands/iterate/render.mjs +28 -42
- package/bin/commands/iterate/stack-trunk-conflict.mjs +17 -1
- package/bin/commands/iterate/stale-ancestry.mjs +4 -1
- package/bin/commands/iterate/stall.d.mts +5 -1
- package/bin/commands/iterate/stall.mjs +19 -7
- package/bin/commands/iterate/thread-mutation-routing.d.mts +1 -0
- package/bin/commands/iterate/thread-mutation-routing.mjs +4 -2
- package/bin/commands/iterate/unreported-required.mjs +5 -2
- package/bin/commands/mark-files-as-viewed.mjs +7 -0
- package/bin/commands/next-check.d.mts +31 -0
- package/bin/commands/next-check.mjs +46 -0
- package/bin/commands/playbook.d.mts +13 -0
- package/bin/commands/playbook.mjs +48 -0
- package/bin/commands/poll-mode.d.mts +8 -0
- package/bin/commands/poll-mode.mjs +14 -0
- package/bin/commands/poll-progress.d.mts +1 -0
- package/bin/commands/poll-progress.mjs +6 -3
- package/bin/commands/poll-quota.d.mts +3 -2
- package/bin/commands/poll-quota.mjs +7 -3
- package/bin/commands/poll-summary-explicit-instructions.d.mts +2 -0
- package/bin/commands/poll-summary-explicit-instructions.mjs +10 -1
- package/bin/commands/poll-summary-instructions.mjs +16 -17
- package/bin/commands/poll-summary.mjs +42 -17
- package/bin/commands/poll.d.mts +0 -1
- package/bin/commands/poll.mjs +11 -19
- package/bin/commands/quota-selection.d.mts +2 -1
- package/bin/commands/quota-selection.mjs +12 -7
- package/bin/commands/resolve-mutate.mjs +33 -5
- package/bin/commands/rest-stack-merge-readiness.d.mts +4 -0
- package/bin/commands/rest-stack-merge-readiness.mjs +74 -0
- package/bin/commands/rule-auto-resolve.mjs +9 -3
- package/bin/commands/shepherd-journal.d.mts +5 -4
- package/bin/commands/shepherd-journal.mjs +9 -8
- package/bin/commands/stack-drain.d.mts +1 -9
- package/bin/commands/stack-drain.mjs +50 -37
- package/bin/commands/stack-handoffs.d.mts +10 -0
- package/bin/commands/stack-handoffs.mjs +25 -0
- package/bin/commands/stack-stall.d.mts +5 -0
- package/bin/commands/stack-stall.mjs +11 -0
- package/bin/commands/stack-work.d.mts +5 -0
- package/bin/commands/stack-work.mjs +32 -0
- package/bin/comments/existing-reply-scan.d.mts +17 -0
- package/bin/comments/existing-reply-scan.mjs +41 -0
- package/bin/comments/rate-limit.mjs +2 -2
- package/bin/comments/resolve.d.mts +7 -1
- package/bin/comments/resolve.mjs +108 -18
- package/bin/comments/rest-reply.d.mts +9 -0
- package/bin/comments/rest-reply.mjs +95 -0
- package/bin/comments/rest-review-mutations.d.mts +22 -0
- package/bin/comments/rest-review-mutations.mjs +125 -0
- package/bin/comments/review-visibility.d.mts +1 -1
- package/bin/comments/review-visibility.mjs +3 -2
- package/bin/comments/sha-poll.mjs +7 -3
- package/bin/comments/thread-visibility.mjs +10 -5
- package/bin/comments/uncertain-replies.d.mts +11 -0
- package/bin/comments/uncertain-replies.mjs +121 -0
- package/bin/comments/uncertain-reply-guards.d.mts +10 -0
- package/bin/comments/uncertain-reply-guards.mjs +94 -0
- package/bin/comments/visible-comments.d.mts +1 -1
- package/bin/comments/visible-comments.mjs +4 -2
- package/bin/config/load.d.mts +37 -1
- package/bin/config/load.mjs +73 -1
- package/bin/config.json +6 -2
- package/bin/exit-codes.d.mts +3 -0
- package/bin/exit-codes.mjs +8 -0
- package/bin/github/api-telemetry-aggregate.d.mts +15 -4
- package/bin/github/api-telemetry-aggregate.mjs +57 -18
- package/bin/github/api-telemetry.d.mts +4 -0
- package/bin/github/api-telemetry.mjs +22 -8
- package/bin/github/apply-review-preflight.d.mts +20 -0
- package/bin/github/apply-review-preflight.mjs +61 -0
- package/bin/github/base-behind-cache.d.mts +15 -0
- package/bin/github/base-behind-cache.mjs +18 -0
- package/bin/github/batch-parse-suites.d.mts +4 -2
- package/bin/github/batch-parse-suites.mjs +6 -1
- package/bin/github/batch-parser-helpers.mjs +40 -2
- package/bin/github/batch-parsers.mjs +1 -0
- package/bin/github/batch-raw-rules.d.mts +26 -0
- package/bin/github/batch-raw-types.d.mts +8 -6
- package/bin/github/batch-stack-evidence.d.mts +28 -0
- package/bin/github/batch-stack-evidence.mjs +62 -0
- package/bin/github/batch.d.mts +15 -2
- package/bin/github/batch.mjs +34 -17
- package/bin/github/check-annotations-batch.d.mts +0 -5
- package/bin/github/check-annotations-batch.mjs +25 -4
- package/bin/github/check-annotations.mjs +3 -1
- package/bin/github/client.d.mts +8 -19
- package/bin/github/client.mjs +45 -13
- package/bin/github/fingerprint-fields.d.mts +8 -0
- package/bin/github/fingerprint-fields.mjs +6 -1
- package/bin/github/fingerprint.d.mts +4 -2
- package/bin/github/fingerprint.mjs +6 -38
- package/bin/github/github-fetch.d.mts +2 -0
- package/bin/github/github-fetch.mjs +19 -0
- package/bin/github/gql/base-behind.gql +3 -0
- package/bin/github/gql/batch-pr-page.gql +16 -0
- package/bin/github/gql/batch-pr.gql +57 -0
- package/bin/github/gql/commit-check-contexts.gql +17 -0
- package/bin/github/gql/get-pr-body.gql +1 -0
- package/bin/github/gql/poll-stack-summary.gql +1 -0
- package/bin/github/gql/poll-summary-check-contexts.gql +5 -0
- package/bin/github/gql/poll-summary-fragment.gql +65 -15
- package/bin/github/gql/stack-handoff-check-runs.gql +42 -0
- package/bin/github/graphql-http.mjs +9 -4
- package/bin/github/graphql-internal-retry.d.mts +2 -0
- package/bin/github/graphql-internal-retry.mjs +1 -1
- package/bin/github/graphql-quota-probe.d.mts +6 -0
- package/bin/github/graphql-quota-probe.mjs +56 -0
- package/bin/github/graphql-session-refusal.d.mts +8 -0
- package/bin/github/graphql-session-refusal.mjs +14 -0
- package/bin/github/http-request.d.mts +1 -1
- package/bin/github/http-request.mjs +22 -6
- package/bin/github/http-utils.mjs +6 -0
- package/bin/github/merge-target-rules.d.mts +12 -3
- package/bin/github/merge-target-rules.mjs +71 -34
- package/bin/github/mutation-policy.d.mts +6 -0
- package/bin/github/mutation-policy.mjs +21 -0
- package/bin/github/poll-summary-annotation-probe.mjs +17 -10
- package/bin/github/poll-summary-check-blockers.d.mts +1 -1
- package/bin/github/poll-summary-check-blockers.mjs +2 -2
- package/bin/github/poll-summary-check-hydration.mjs +25 -10
- package/bin/github/poll-summary-checks.d.mts +2 -2
- package/bin/github/poll-summary-checks.mjs +9 -6
- package/bin/github/poll-summary-command.d.mts +2 -0
- package/bin/github/poll-summary-command.mjs +24 -0
- package/bin/github/poll-summary-fingerprint.d.mts +1 -1
- package/bin/github/poll-summary-fingerprint.mjs +4 -2
- package/bin/github/poll-summary-handoff-fields.d.mts +3 -0
- package/bin/github/poll-summary-handoff-fields.mjs +73 -0
- package/bin/github/poll-summary-projector.d.mts +1 -1
- package/bin/github/poll-summary-projector.mjs +17 -24
- package/bin/github/poll-summary-raw.d.mts +70 -10
- package/bin/github/poll-summary-readiness.mjs +4 -1
- package/bin/github/poll-summary-rest-queue.d.mts +3 -0
- package/bin/github/poll-summary-rest-queue.mjs +12 -0
- package/bin/github/poll-summary-review.d.mts +1 -1
- package/bin/github/poll-summary-review.mjs +23 -11
- package/bin/github/poll-summary-route.mjs +19 -3
- package/bin/github/poll-summary-stack-page.d.mts +11 -0
- package/bin/github/poll-summary-stack-page.mjs +27 -0
- package/bin/github/poll-summary-unreported.d.mts +3 -1
- package/bin/github/poll-summary-unreported.mjs +6 -3
- package/bin/github/poll-summary.d.mts +4 -1
- package/bin/github/poll-summary.mjs +47 -33
- package/bin/github/queries.d.mts +7 -3
- package/bin/github/queries.mjs +8 -4
- package/bin/github/rate-limit-sample.d.mts +7 -0
- package/bin/github/rate-limit-sample.mjs +12 -0
- package/bin/github/reply-recovery-read.d.mts +50 -0
- package/bin/github/reply-recovery-read.mjs +118 -0
- package/bin/github/reply-thread-transcripts.d.mts +0 -1
- package/bin/github/reply-thread-transcripts.mjs +24 -1
- package/bin/github/rest-annotation-read.d.mts +5 -0
- package/bin/github/rest-annotation-read.mjs +44 -0
- package/bin/github/rest-batch-read.d.mts +12 -0
- package/bin/github/rest-batch-read.mjs +57 -0
- package/bin/github/rest-batch-snapshot.d.mts +30 -0
- package/bin/github/rest-batch-snapshot.mjs +115 -0
- package/bin/github/rest-batch-unavailable.d.mts +5 -0
- package/bin/github/rest-batch-unavailable.mjs +16 -0
- package/bin/github/rest-check-read.d.mts +34 -0
- package/bin/github/rest-check-read.mjs +124 -0
- package/bin/github/rest-comment-authorship.d.mts +7 -0
- package/bin/github/rest-comment-authorship.mjs +11 -0
- package/bin/github/rest-conditional-scope.d.mts +20 -0
- package/bin/github/rest-conditional-scope.mjs +44 -0
- package/bin/github/rest-explicit-summary-read.d.mts +3 -0
- package/bin/github/rest-explicit-summary-read.mjs +8 -0
- package/bin/github/rest-feedback-read.d.mts +36 -0
- package/bin/github/rest-feedback-read.mjs +147 -0
- package/bin/github/rest-feedback-validation.d.mts +5 -0
- package/bin/github/rest-feedback-validation.mjs +28 -0
- package/bin/github/rest-http.d.mts +12 -0
- package/bin/github/rest-http.mjs +108 -23
- package/bin/github/rest-identities.d.mts +22 -0
- package/bin/github/rest-identities.mjs +134 -0
- package/bin/github/rest-merge-stack-guard.d.mts +14 -0
- package/bin/github/rest-merge-stack-guard.mjs +41 -0
- package/bin/github/rest-merge.d.mts +29 -0
- package/bin/github/rest-merge.mjs +56 -0
- package/bin/github/rest-merged-base-read.d.mts +9 -0
- package/bin/github/rest-merged-base-read.mjs +48 -0
- package/bin/github/rest-pr-core.d.mts +52 -0
- package/bin/github/rest-pr-core.mjs +60 -0
- package/bin/github/rest-reader-core.d.mts +16 -0
- package/bin/github/rest-reader-core.mjs +154 -0
- package/bin/github/rest-review-read.d.mts +11 -0
- package/bin/github/rest-review-read.mjs +47 -0
- package/bin/github/rest-rules-read.d.mts +9 -0
- package/bin/github/rest-rules-read.mjs +154 -0
- package/bin/github/rest-session-refusal.d.mts +5 -0
- package/bin/github/rest-session-refusal.mjs +21 -0
- package/bin/github/rest-snapshot-context.d.mts +10 -0
- package/bin/github/rest-snapshot-context.mjs +1 -0
- package/bin/github/rest-stack-read.d.mts +21 -0
- package/bin/github/rest-stack-read.mjs +47 -0
- package/bin/github/rest-stack-summary.d.mts +8 -0
- package/bin/github/rest-stack-summary.mjs +62 -0
- package/bin/github/rest-summary-read.d.mts +7 -0
- package/bin/github/rest-summary-read.mjs +112 -0
- package/bin/github/rest-terminal-batch.d.mts +14 -0
- package/bin/github/rest-terminal-batch.mjs +45 -0
- package/bin/github/rest-text.mjs +7 -3
- package/bin/github/rest-thread-read.d.mts +4 -0
- package/bin/github/rest-thread-read.mjs +35 -0
- package/bin/github/rest-viewer-read.d.mts +2 -0
- package/bin/github/rest-viewer-read.mjs +41 -0
- package/bin/github/stack-bottom.d.mts +3 -0
- package/bin/github/stack-bottom.mjs +14 -0
- package/bin/github/stack-handoff-context.d.mts +25 -0
- package/bin/github/stack-handoff-context.mjs +12 -0
- package/bin/github/stack-handoff-page.d.mts +17 -0
- package/bin/github/stack-handoff-page.mjs +306 -0
- package/bin/github/stack-handoff.d.mts +16 -0
- package/bin/github/stack-handoff.mjs +115 -0
- package/bin/github/stack-order.d.mts +6 -0
- package/bin/github/stack-order.mjs +13 -0
- package/bin/github/stack-read.d.mts +7 -5
- package/bin/github/stack-read.mjs +22 -24
- package/bin/github/stack-size-hint.d.mts +3 -0
- package/bin/github/stack-size-hint.mjs +14 -0
- package/bin/github/suggestion-thread.mjs +27 -1
- package/bin/github/thread-comments.mjs +9 -1
- package/bin/github/transport-evidence.d.mts +20 -0
- package/bin/github/transport-evidence.mjs +26 -0
- package/bin/github/transport-mode.d.mts +2 -0
- package/bin/github/transport-mode.mjs +5 -0
- package/bin/github/transport.d.mts +19 -0
- package/bin/github/transport.mjs +126 -0
- package/bin/github/unsupported-rest.d.mts +4 -0
- package/bin/github/unsupported-rest.mjs +7 -0
- package/bin/mcp/server.mjs +52 -3
- package/bin/merge-status/derive.d.mts +2 -0
- package/bin/merge-status/derive.mjs +17 -13
- package/bin/merge-status/required-check-requirements.d.mts +7 -0
- package/bin/merge-status/required-check-requirements.mjs +15 -0
- package/bin/merge-status/requirements-format.d.mts +5 -0
- package/bin/merge-status/requirements-format.mjs +41 -12
- package/bin/merge-status/requirements.mjs +18 -7
- package/bin/state/base.mjs +41 -0
- package/bin/state/durable-state.d.mts +6 -0
- package/bin/state/durable-state.mjs +41 -0
- package/bin/state/graphql-quota-policy.mjs +23 -16
- package/bin/state/merge-request.d.mts +25 -0
- package/bin/state/merge-request.mjs +145 -0
- package/bin/state/pr-fingerprint.d.mts +15 -0
- package/bin/state/pr-fingerprint.mjs +22 -7
- package/bin/state/rest-cache.d.mts +3 -0
- package/bin/state/rest-cache.mjs +1 -0
- package/bin/state/rest-snapshot-report.d.mts +21 -0
- package/bin/state/rest-snapshot-report.mjs +52 -0
- package/bin/state/seen-comments.d.mts +3 -0
- package/bin/state/seen-comments.mjs +18 -0
- package/bin/types/api-usage.d.mts +9 -1
- package/bin/types/escalate.d.mts +1 -1
- package/bin/types/github.d.mts +23 -9
- package/bin/types/iterate.d.mts +24 -2
- package/bin/types/merge-action.d.mts +1 -1
- package/bin/types/merge-requirements.d.mts +7 -7
- package/bin/types/next-check.d.mts +12 -0
- package/bin/types/next-check.mjs +1 -0
- package/bin/types/poll-summary.d.mts +21 -0
- package/bin/types/report.d.mts +13 -1
- package/bin/types/review-thread.d.mts +1 -1
- package/bin/types.d.mts +1 -0
- package/bin/types.mjs +1 -0
- package/package.json +3 -2
- package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
- package/plugins/pr-shepherd/.codex.mcp.json +1 -1
- package/plugins/pr-shepherd/.mcp.json +1 -1
- package/plugins/pr-shepherd/skills/mark-files-as-viewed/SKILL.md +1 -1
- package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +14 -51
- package/plugins/pr-shepherd/skills/pr-shepherd/references/ci-failure-triage.md +12 -16
- package/plugins/pr-shepherd/skills/pr-shepherd/references/cloud-event-loop.md +14 -0
- package/plugins/pr-shepherd/skills/pr-shepherd/references/create-pr.md +10 -0
- package/plugins/pr-shepherd/skills/pr-shepherd/references/fix-code-loop.md +10 -0
- package/plugins/pr-shepherd/skills/pr-shepherd/references/mcp-fallback.md +9 -0
- package/plugins/pr-shepherd/skills/reduce-pr-noise/references/classifiers.md +2 -0
- package/bin/github/gql/pr-fingerprint.gql +0 -75
- package/plugins/pr-shepherd/skills/pr-shepherd/references/journal.md +0 -7
- package/plugins/pr-shepherd/skills/pr-shepherd/references/review-mutations.md +0 -9
- package/plugins/pr-shepherd/skills/pr-shepherd/references/stack-merge.md +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\n --format text|json Output Markdown text or JSON. Default: text.\n --verbose Include verbose iterate fields and detailed poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\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\nPolling flags:\n --interval <duration> Delay 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> Poll wall-clock cap 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\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
1
|
+
export declare const TOP_USAGE = "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\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 poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\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\nPolling flags:\n --interval <duration> Delay 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> Poll wall-clock cap 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\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
@@ -8,6 +8,7 @@ Usage:
|
|
|
8
8
|
pr-shepherd [PR ...] [poll-flags] [iterate-flags]
|
|
9
9
|
pr-shepherd --stack PR [poll-flags] [iterate-flags]
|
|
10
10
|
pr-shepherd iterate [PR] [iterate-flags]
|
|
11
|
+
pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest
|
|
11
12
|
pr-shepherd apply review [PR] [review-flags]
|
|
12
13
|
pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]
|
|
13
14
|
pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]
|
|
@@ -21,6 +22,7 @@ Usage:
|
|
|
21
22
|
Commands:
|
|
22
23
|
[PR ...] Poll one PR, an explicit same-repository set, or a native stack.
|
|
23
24
|
iterate Run one iterate tick (single-tick alias).
|
|
25
|
+
apply merge Submit or resume a guarded asynchronous merge or enqueue request.
|
|
24
26
|
apply review Apply review-state mutations after fixes.
|
|
25
27
|
apply files Mark selected changed files as viewed.
|
|
26
28
|
apply journal Append a list item to the Shepherd Journal details block of a PR body.
|
|
@@ -29,6 +31,7 @@ Commands:
|
|
|
29
31
|
journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.
|
|
30
32
|
build-suggestion-patches
|
|
31
33
|
Convert ordered GitHub suggestion threads into patches and commit instructions.
|
|
34
|
+
playbook Print a playbook named by an instruction pointer.
|
|
32
35
|
admin clean Remove pr-shepherd state files.
|
|
33
36
|
admin log-file Print the per-worktree debug log path.
|
|
34
37
|
|
|
@@ -38,6 +41,7 @@ PR argument:
|
|
|
38
41
|
When omitted, pr-shepherd infers the current branch's pull request.
|
|
39
42
|
|
|
40
43
|
Common flags:
|
|
44
|
+
--transport auto|graphql|rest Select GitHub transport. Default: github.transport (auto).
|
|
41
45
|
--format text|json Output Markdown text or JSON. Default: text.
|
|
42
46
|
--verbose Include verbose iterate fields and detailed poll-tick lines.
|
|
43
47
|
--help, -h Print help and exit before any GitHub, git, config, or log I/O.
|
|
@@ -48,6 +52,7 @@ Iterate flags:
|
|
|
48
52
|
--no-auto-mark-ready Do not convert draft PRs to ready for review.
|
|
49
53
|
--no-auto-cancel-actionable Legacy no-op; workflow runs are never cancelled.
|
|
50
54
|
--merge Shepherd through readiness, then emit a merge or merge-queue command.
|
|
55
|
+
--instructions playbook|inline Render fix_code steps inline every tick (default) or fold the invariant ones into a playbook pointer. Default: iterate.instructions (inline).
|
|
51
56
|
|
|
52
57
|
Polling flags:
|
|
53
58
|
--interval <duration> Delay 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.
|
package/bin/cli/help.d.mts
CHANGED
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
export declare const 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
|
|
177
|
-
only when it equals the
|
|
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,8 +320,23 @@ 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
|
|
295
|
-
|
|
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.";
|
|
339
|
+
readonly top: "pr-shepherd\n\nAutonomous PR CI monitor and review-comment resolver for agentic coding tools.\n\nUsage:\n pr-shepherd --version | -v\n pr-shepherd --help | -h\n pr-shepherd [PR ...] [poll-flags] [iterate-flags]\n pr-shepherd --stack PR [poll-flags] [iterate-flags]\n pr-shepherd iterate [PR] [iterate-flags]\n pr-shepherd apply merge [PR] --require-sha SHA --merge-action ACTION --transport rest\n pr-shepherd apply review [PR] [review-flags]\n pr-shepherd apply files [PR] [files...] [--tests] [--match REGEX]\n pr-shepherd apply journal [PR] <item> [--dry-run] [--format text|json]\n pr-shepherd apply check-blocker [PR] --check <name> (--blocked-by <ref>|--clear)\n pr-shepherd apply queue-removal [PR] --require-sha <head> --queue-commit <commit> --removed-at <unix>\n pr-shepherd journal extract --body-file <path>\n pr-shepherd build-suggestion-patches [PR] --thread-id ID --message MSG [groups...]\n pr-shepherd admin clean <pr|branch|current|repo|all> [value] [flags]\n pr-shepherd admin log-file [--format text|json]\n\nCommands:\n [PR ...] Poll one PR, an explicit same-repository set, or a native stack.\n iterate Run one iterate tick (single-tick alias).\n apply merge Submit or resume a guarded asynchronous merge or enqueue request.\n apply review Apply review-state mutations after fixes.\n apply files Mark selected changed files as viewed.\n apply journal Append a list item to the Shepherd Journal details block of a PR body.\n apply check-blocker Record that a failing check is blocked on an external PR or issue.\n apply queue-removal Acknowledge one current CI-driven native-stack queue removal.\n journal extract Extract a validated Shepherd Journal from a local PR-body file as JSON.\n build-suggestion-patches\n Convert ordered GitHub suggestion threads into patches and commit instructions.\n playbook Print a playbook named by an instruction pointer.\n admin clean Remove pr-shepherd state files.\n admin log-file Print the per-worktree debug log path.\n\nPR argument:\n PR may be a number, owner/repo#number, or a GitHub pull request URL.\n Multiple PRs must name one repository. --stack PR selects every entry in PR's native stack.\n When omitted, pr-shepherd infers the current branch's pull request.\n\nCommon flags:\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 poll-tick lines.\n --help, -h Print help and exit before any GitHub, git, config, or log I/O.\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\nPolling flags:\n --interval <duration> Delay 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> Poll wall-clock cap 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\nClean variants:\n pr [number] Remove state for one PR. Defaults to current branch PR.\n branch [name] Remove state for a branch's PR. Defaults to current branch.\n current Alias for branch against the current branch.\n repo Remove all state for the current repository.\n all Remove all pr-shepherd state.\n\nExit codes: 0 done, 10-19 PR state, 64-78 shepherd failed (sysexits.h).\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 16 SHEPHERD (--stack only: run the listed one-PR sessions, then rerun the selector)\nSee docs/exit-codes.md for the full sysexits.h error-code table.\n\nDuration examples: 30s, 4.5m, 1h. A bare number uses each flag's default unit (see above); decimals are allowed with an explicit unit (4.5m).\n\nRun 'pr-shepherd <command> --help' for command-specific details.";
|
|
296
340
|
};
|
|
297
341
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
298
342
|
export declare function helpKeyForArgs(args: string[]): keyof typeof USAGE;
|
package/bin/cli/help.mjs
CHANGED
|
@@ -7,6 +7,8 @@ export const USAGE = {
|
|
|
7
7
|
};
|
|
8
8
|
/** Resolve help keys for nested public commands before any command I/O. */
|
|
9
9
|
export function helpKeyForArgs(args) {
|
|
10
|
+
if (args[0] === "apply" && args[1] === "merge")
|
|
11
|
+
return "apply merge";
|
|
10
12
|
if (args[0] === "apply" && args[1] === "review")
|
|
11
13
|
return "apply review";
|
|
12
14
|
if (args[0] === "apply" && args[1] === "files")
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { IterateResult } from "../types.mts";
|
|
2
|
+
/** True when the summary-line branch phrase names the PR base branch. */
|
|
3
|
+
export declare function branchSegmentShowsBase(result: IterateResult): boolean;
|
|
2
4
|
/** Summary-line branch phrase. Empty when the PR is not behind or conflicting. */
|
|
3
5
|
export declare function branchStateSegment(result: IterateResult): string;
|
|
@@ -1,13 +1,18 @@
|
|
|
1
|
+
/** True when the summary-line branch phrase names the PR base branch. */
|
|
2
|
+
export function branchSegmentShowsBase(result) {
|
|
3
|
+
if (!result.baseBranch)
|
|
4
|
+
return false;
|
|
5
|
+
if (result.mergeStatus === "BEHIND")
|
|
6
|
+
return true;
|
|
7
|
+
return result.mergeStatus === "CONFLICTS" && !result.stackTrunkConflict;
|
|
8
|
+
}
|
|
1
9
|
/** Summary-line branch phrase. Empty when the PR is not behind or conflicting. */
|
|
2
10
|
export function branchStateSegment(result) {
|
|
3
|
-
if (result.mergeStatus === "BEHIND" && result.baseBranch) {
|
|
4
|
-
return `**branch** behind PR base \`${result.baseBranch}\``;
|
|
5
|
-
}
|
|
6
11
|
if (result.mergeStatus === "CONFLICTS" && result.stackTrunkConflict) {
|
|
7
12
|
return `**branch** conflicts with stack trunk \`${result.stackTrunkConflict}\``;
|
|
8
13
|
}
|
|
9
|
-
if (result
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
return
|
|
14
|
+
if (!branchSegmentShowsBase(result))
|
|
15
|
+
return "";
|
|
16
|
+
const state = result.mergeStatus === "BEHIND" ? "behind" : "conflicts with";
|
|
17
|
+
return `**branch** ${state} PR base \`${result.baseBranch}\``;
|
|
13
18
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type loadConfig, type InstructionStyle, type PollMode } from "../config/load.mts";
|
|
2
2
|
interface IterateFlags {
|
|
3
3
|
readyDelaySuffix: string | undefined | null;
|
|
4
4
|
readyDelaySeconds: number;
|
|
@@ -7,6 +7,12 @@ interface IterateFlags {
|
|
|
7
7
|
noAutoMarkReady: boolean;
|
|
8
8
|
noAutoCancelActionable: boolean;
|
|
9
9
|
merge: boolean;
|
|
10
|
+
/** `null` when `--instructions` was invalid (an error was already printed). */
|
|
11
|
+
instructions: InstructionStyle | null | undefined;
|
|
12
|
+
/** `null` when `--poll-mode` was invalid (an error was already printed). */
|
|
13
|
+
pollMode: PollMode | null | undefined;
|
|
10
14
|
}
|
|
15
|
+
/** True when any flag failed validation; the usage error is already printed. */
|
|
16
|
+
export declare function hasInvalidIterateFlags(flags: IterateFlags): boolean;
|
|
11
17
|
export declare function parseIterateFlags(extra: string[], cfg: ReturnType<typeof loadConfig>): IterateFlags;
|
|
12
18
|
export {};
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { INSTRUCTION_STYLES, POLL_MODES, isInstructionStyle, isPollMode, } from "../config/load.mjs";
|
|
2
|
+
import { EXIT } from "../exit-codes.mjs";
|
|
1
3
|
import { getFlag, hasFlag } from "./args.mjs";
|
|
2
4
|
import { parseDurationToSeconds } from "./duration.mjs";
|
|
3
5
|
import { validateSecondsDurationFlag } from "./duration-flag.mjs";
|
|
4
6
|
// --ready-delay and --stall-timeout are minute-family flags: a bare number means minutes, and 0 is a
|
|
5
7
|
// valid value (it disables the ready-delay settle window / stall-timeout escalation, respectively).
|
|
6
8
|
const MINUTE_FLAG_OPTS = { defaultUnit: "m", allowZero: true };
|
|
9
|
+
/** True when any flag failed validation; the usage error is already printed. */
|
|
10
|
+
export function hasInvalidIterateFlags(flags) {
|
|
11
|
+
return (flags.readyDelaySuffix === null ||
|
|
12
|
+
flags.stallTimeoutSuffix === null ||
|
|
13
|
+
flags.instructions === null ||
|
|
14
|
+
flags.pollMode === null);
|
|
15
|
+
}
|
|
7
16
|
export function parseIterateFlags(extra, cfg) {
|
|
8
17
|
const readyDelayStr = getFlag(extra, "--ready-delay");
|
|
9
18
|
const readyDelaySuffix = validateSecondsDurationFlag("pr-shepherd", "--ready-delay", readyDelayStr, hasFlag(extra, "--ready-delay"), MINUTE_FLAG_OPTS);
|
|
@@ -14,7 +23,10 @@ export function parseIterateFlags(extra, cfg) {
|
|
|
14
23
|
const stallTimeoutStr = getFlag(extra, "--stall-timeout");
|
|
15
24
|
const stallTimeoutSuffix = validateSecondsDurationFlag("pr-shepherd", "--stall-timeout", stallTimeoutStr, hasFlag(extra, "--stall-timeout"), MINUTE_FLAG_OPTS);
|
|
16
25
|
const stallTimeoutSeconds = parseDurationToSeconds(stallTimeoutSuffix ?? "", cfg.iterate.stallTimeoutMinutes * 60, MINUTE_FLAG_OPTS);
|
|
26
|
+
const instructions = parseInstructionsFlag(extra);
|
|
17
27
|
return {
|
|
28
|
+
instructions,
|
|
29
|
+
pollMode: parsePollModeFlag(extra),
|
|
18
30
|
readyDelaySuffix,
|
|
19
31
|
readyDelaySeconds,
|
|
20
32
|
stallTimeoutSuffix,
|
|
@@ -24,3 +36,29 @@ export function parseIterateFlags(extra, cfg) {
|
|
|
24
36
|
merge,
|
|
25
37
|
};
|
|
26
38
|
}
|
|
39
|
+
/** Validate `--instructions`. Returns `undefined` when absent, `null` after printing a usage error. */
|
|
40
|
+
function parseInstructionsFlag(extra) {
|
|
41
|
+
const value = getFlag(extra, "--instructions");
|
|
42
|
+
if (!hasInstructionsFlag(extra))
|
|
43
|
+
return undefined;
|
|
44
|
+
if (isInstructionStyle(value))
|
|
45
|
+
return value;
|
|
46
|
+
process.stderr.write(`pr-shepherd: --instructions must be one of ${INSTRUCTION_STYLES.join(", ")}, got ${JSON.stringify(value ?? "")}\n`);
|
|
47
|
+
process.exitCode = EXIT.USAGE;
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function hasInstructionsFlag(extra) {
|
|
51
|
+
return extra.some((arg) => arg === "--instructions" || arg.startsWith("--instructions="));
|
|
52
|
+
}
|
|
53
|
+
/** Validate `--poll-mode`. Returns `undefined` when absent, `null` after printing a usage error. */
|
|
54
|
+
function parsePollModeFlag(extra) {
|
|
55
|
+
const value = getFlag(extra, "--poll-mode");
|
|
56
|
+
if (!extra.some((arg) => arg === "--poll-mode" || arg.startsWith("--poll-mode="))) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
if (isPollMode(value))
|
|
60
|
+
return value;
|
|
61
|
+
process.stderr.write(`pr-shepherd: --poll-mode must be one of ${POLL_MODES.join(", ")}, got ${JSON.stringify(value ?? "")}\n`);
|
|
62
|
+
process.exitCode = EXIT.USAGE;
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
@@ -6,12 +6,12 @@ import type { IterateResult } from "../types.mts";
|
|
|
6
6
|
* 1. The H1 heading on line 1 contains `[<ACTION>]` — the action tag identifies
|
|
7
7
|
* the output for logging and validation. Behavior is driven by `## Instructions`,
|
|
8
8
|
* not by dispatching on the tag.
|
|
9
|
-
* 2. `[FIX_CODE]`
|
|
10
|
-
*
|
|
11
|
-
* 3. Every action ends with a `## Instructions` section — numbered
|
|
12
|
-
* that tells the agent exactly what to do with this output
|
|
13
|
-
*
|
|
14
|
-
* The skill
|
|
9
|
+
* 2. `[FIX_CODE]` prints the `apply review` command inline, in backticks, in its
|
|
10
|
+
* `## Instructions` step; the agent runs that backticked command as printed.
|
|
11
|
+
* 3. Every action except `cancel` ends with a `## Instructions` section — numbered
|
|
12
|
+
* `1.`, `2.`, … — that tells the agent exactly what to do with this output, with at
|
|
13
|
+
* least one step. `cancel` has no section: the `[CANCEL]` tag already means stop this
|
|
14
|
+
* PR's loop. The skill follows those steps; it does not need its own dispatch table.
|
|
15
15
|
*/
|
|
16
16
|
export declare function formatIterateResult(result: IterateResult, opts?: {
|
|
17
17
|
verbose?: boolean;
|
|
@@ -8,6 +8,9 @@ import { formatApiUsage, formatQuotaWarning } from "./api-usage-formatter.mjs";
|
|
|
8
8
|
import { formatActivityLine } from "./iterate-activity-formatter.mjs";
|
|
9
9
|
import { branchStateSegment } from "./iterate-branch-segment.mjs";
|
|
10
10
|
import { insertRuleAutoResolveSection } from "../commands/rule-auto-resolve-format.mjs";
|
|
11
|
+
import { formatTransportEvidence } from "./transport-formatter.mjs";
|
|
12
|
+
import { formatNextCheckLines, formatPollModeSegment } from "./next-check-format.mjs";
|
|
13
|
+
import { formatPrUrl } from "../pr-reference.mjs";
|
|
11
14
|
/**
|
|
12
15
|
* Format an IterateResult as human-readable Markdown.
|
|
13
16
|
*
|
|
@@ -15,31 +18,51 @@ import { insertRuleAutoResolveSection } from "../commands/rule-auto-resolve-form
|
|
|
15
18
|
* 1. The H1 heading on line 1 contains `[<ACTION>]` — the action tag identifies
|
|
16
19
|
* the output for logging and validation. Behavior is driven by `## Instructions`,
|
|
17
20
|
* not by dispatching on the tag.
|
|
18
|
-
* 2. `[FIX_CODE]`
|
|
19
|
-
*
|
|
20
|
-
* 3. Every action ends with a `## Instructions` section — numbered
|
|
21
|
-
* that tells the agent exactly what to do with this output
|
|
22
|
-
*
|
|
23
|
-
* The skill
|
|
21
|
+
* 2. `[FIX_CODE]` prints the `apply review` command inline, in backticks, in its
|
|
22
|
+
* `## Instructions` step; the agent runs that backticked command as printed.
|
|
23
|
+
* 3. Every action except `cancel` ends with a `## Instructions` section — numbered
|
|
24
|
+
* `1.`, `2.`, … — that tells the agent exactly what to do with this output, with at
|
|
25
|
+
* least one step. `cancel` has no section: the `[CANCEL]` tag already means stop this
|
|
26
|
+
* PR's loop. The skill follows those steps; it does not need its own dispatch table.
|
|
24
27
|
*/
|
|
25
28
|
export function formatIterateResult(result, opts) {
|
|
26
29
|
const verbose = opts?.verbose ?? false;
|
|
27
30
|
const readyDelaySuffix = opts?.readyDelaySuffix;
|
|
28
|
-
const
|
|
31
|
+
const repoSeg = ` · **repo** \`${result.repo}\``;
|
|
32
|
+
// Lean: the repo segment repeats what a generated command's PR URL or `--repo` flag already
|
|
33
|
+
// shows. Only the CLI-generated `## Instructions` section counts: review bodies and logs above
|
|
34
|
+
// it are untrusted and may name any repository.
|
|
35
|
+
const dropRepeatedRepo = (full) => {
|
|
36
|
+
if (verbose)
|
|
37
|
+
return full;
|
|
38
|
+
const instructions = full.slice(full.lastIndexOf("\n## Instructions\n") + 1);
|
|
39
|
+
const generated = instructions.startsWith("## Instructions\n") &&
|
|
40
|
+
(instructions.includes(formatPrUrl(result.repo, result.pr)) ||
|
|
41
|
+
instructions.includes(`--repo ${result.repo} `));
|
|
42
|
+
return generated ? full.replace(repoSeg, "") : full;
|
|
43
|
+
};
|
|
44
|
+
const finish = (text) => dropRepeatedRepo(insertRuleAutoResolveSection(text, result.ruleAutoResolve));
|
|
29
45
|
const heading = `# PR #${result.pr} [${result.action.toUpperCase()}]`;
|
|
30
46
|
const reviewDecisionSeg = result.mergeStatus === "BLOCKED" && result.reviewDecision
|
|
31
47
|
? ` · **reviewDecision** \`${result.reviewDecision}\``
|
|
32
48
|
: "";
|
|
33
49
|
const baseBranchSeg = verbose && result.baseBranch ? ` · **baseBranch** \`${result.baseBranch}\`` : "";
|
|
34
|
-
|
|
50
|
+
// A CLEAN merge state and an OPEN PR are the trivial defaults; verbose output keeps them.
|
|
51
|
+
const mergeSeg = verbose || result.mergeStateStatus !== "CLEAN"
|
|
52
|
+
? ` · **merge** \`${result.mergeStateStatus}\``
|
|
53
|
+
: "";
|
|
54
|
+
const stateSeg = verbose || result.state !== "OPEN" ? ` · **state** \`${result.state}\`` : "";
|
|
55
|
+
const baseLine = `**status** \`${result.status}\`${mergeSeg}${reviewDecisionSeg}${stateSeg}${repoSeg}${baseBranchSeg}${formatPollModeSegment(result)}`;
|
|
35
56
|
const branchSeg = branchStateSegment(result);
|
|
36
57
|
let summaryLine;
|
|
37
58
|
if (verbose) {
|
|
38
59
|
const verboseBranch = branchSeg ? ` · ${branchSeg}` : "";
|
|
39
|
-
summaryLine = `**summary** ${result.summary.passing} passing, ${result.summary.skipped} skipped, ${result.summary.filtered} filtered, ${result.summary.inProgress} inProgress, ${result.summary.superseded} superseded · **remainingSeconds** ${result.remainingSeconds} · **blockingBotReviewInProgress** ${result.blockingBotReviewInProgress} · **isDraft** ${result.isDraft} · **shouldCancel** ${result.shouldCancel}${verboseBranch}`;
|
|
60
|
+
summaryLine = `**summary** ${result.summary.passing} passing, ${result.summary.skipped} skipped, ${result.summary.filtered} filtered, ${result.summary.inProgress} inProgress, ${result.summary.superseded} superseded · **remainingSeconds** ${result.remainingSeconds} · **blockingBotReviewInProgress** ${result.blockingBotReviewInProgress} · **isDraft** ${result.isDraft} · **shouldCancel** ${result.shouldCancel}${verboseBranch}${readyDelaySuffix ? ` · **ready-delay** \`${readyDelaySuffix}\` (override)` : ""}`;
|
|
40
61
|
}
|
|
41
62
|
else {
|
|
42
|
-
const counts = [
|
|
63
|
+
const counts = [];
|
|
64
|
+
if (result.summary.passing > 0)
|
|
65
|
+
counts.push(`${result.summary.passing} passing`);
|
|
43
66
|
if (result.summary.skipped > 0)
|
|
44
67
|
counts.push(`${result.summary.skipped} skipped`);
|
|
45
68
|
if (result.summary.filtered > 0)
|
|
@@ -48,7 +71,7 @@ export function formatIterateResult(result, opts) {
|
|
|
48
71
|
counts.push(`${result.summary.inProgress} inProgress`);
|
|
49
72
|
if (result.summary.superseded > 0)
|
|
50
73
|
counts.push(`${result.summary.superseded} superseded`);
|
|
51
|
-
const segs = [`**summary** ${counts.join(", ")}`];
|
|
74
|
+
const segs = counts.length > 0 ? [`**summary** ${counts.join(", ")}`] : [];
|
|
52
75
|
if (result.status === "READY" && result.remainingSeconds > 0) {
|
|
53
76
|
segs.push(`**remainingSeconds** ${result.remainingSeconds}`);
|
|
54
77
|
}
|
|
@@ -58,13 +81,13 @@ export function formatIterateResult(result, opts) {
|
|
|
58
81
|
segs.push(`**isDraft**`);
|
|
59
82
|
if (branchSeg)
|
|
60
83
|
segs.push(branchSeg);
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
summaryLine += ` · **ready-delay** \`${readyDelaySuffix}\` (override)`;
|
|
84
|
+
// Surface an explicit `--ready-delay` override (set only when the user passed the flag)
|
|
85
|
+
// so the active settle window stays visible on every tick.
|
|
86
|
+
if (readyDelaySuffix)
|
|
87
|
+
segs.push(`**ready-delay** \`${readyDelaySuffix}\` (override)`);
|
|
88
|
+
summaryLine = segs.length > 0 ? segs.join(" · ") : null;
|
|
67
89
|
}
|
|
90
|
+
const summaryLines = summaryLine ? [summaryLine] : [];
|
|
68
91
|
const bp = result.branchProtection;
|
|
69
92
|
const requiredParts = [];
|
|
70
93
|
if (bp) {
|
|
@@ -84,7 +107,7 @@ export function formatIterateResult(result, opts) {
|
|
|
84
107
|
}
|
|
85
108
|
}
|
|
86
109
|
const requiredLine = requiredParts.length > 0 ? `**required** ${requiredParts.join(", ")}` : null;
|
|
87
|
-
const headerLines = [heading, "", baseLine,
|
|
110
|
+
const headerLines = [heading, "", baseLine, ...summaryLines, ...formatTransportEvidence(result)];
|
|
88
111
|
if (result.mergeRequirements) {
|
|
89
112
|
headerLines.push(...formatMergeRequirementLines(result.mergeRequirements));
|
|
90
113
|
}
|
|
@@ -104,6 +127,7 @@ export function formatIterateResult(result, opts) {
|
|
|
104
127
|
const activityLine = formatActivityLine(result);
|
|
105
128
|
if (activityLine)
|
|
106
129
|
headerLines.push(activityLine);
|
|
130
|
+
headerLines.push(...formatNextCheckLines(result.nextCheck));
|
|
107
131
|
const header = headerLines.join("\n");
|
|
108
132
|
const quotaWarning = formatQuotaWarning(result.quotaWarning);
|
|
109
133
|
const apiUsage = verbose ? formatApiUsage(result.apiUsage) : null;
|
|
@@ -111,12 +135,12 @@ export function formatIterateResult(result, opts) {
|
|
|
111
135
|
const telemetrySections = [quotaWarning, apiUsage, verboseChecks];
|
|
112
136
|
switch (result.action) {
|
|
113
137
|
case "ready":
|
|
114
|
-
return joinSections([
|
|
138
|
+
return dropRepeatedRepo(joinSections([
|
|
115
139
|
header,
|
|
116
140
|
...telemetrySections,
|
|
117
141
|
adaptIterateLog(result.log),
|
|
118
142
|
`## Instructions\n\n${numberInstructions(buildSimpleIterateInstructions(result))}`,
|
|
119
|
-
]);
|
|
143
|
+
]));
|
|
120
144
|
case "wait": {
|
|
121
145
|
const waitLines = [header, ...telemetrySections, adaptIterateLog(result.log)];
|
|
122
146
|
if (result.deferredWork)
|
|
@@ -134,7 +158,18 @@ export function formatIterateResult(result, opts) {
|
|
|
134
158
|
case "merge":
|
|
135
159
|
return finish(formatMergeAction(joinSections([header, ...telemetrySections]), result));
|
|
136
160
|
case "cancel": {
|
|
137
|
-
|
|
161
|
+
// A merged or closed PR needs no more data: the `[CANCEL]` heading is enough. Cancel has no
|
|
162
|
+
// instruction steps; the skill's recurrence rule says what to do after it.
|
|
163
|
+
if (!verbose && (result.reason === "merged" || result.reason === "closed")) {
|
|
164
|
+
return finish(`${heading} — ${result.reason}`);
|
|
165
|
+
}
|
|
166
|
+
const cancelHeaderLines = [
|
|
167
|
+
`${heading} — ${result.reason}`,
|
|
168
|
+
"",
|
|
169
|
+
baseLine,
|
|
170
|
+
...summaryLines,
|
|
171
|
+
...formatTransportEvidence(result),
|
|
172
|
+
];
|
|
138
173
|
if (result.mergeRequirements) {
|
|
139
174
|
cancelHeaderLines.push(...formatMergeRequirementLines(result.mergeRequirements));
|
|
140
175
|
}
|
|
@@ -158,7 +193,6 @@ export function formatIterateResult(result, opts) {
|
|
|
158
193
|
...(apiUsage ? [apiUsage] : []),
|
|
159
194
|
...(verboseChecks ? [verboseChecks] : []),
|
|
160
195
|
adaptIterateLog(result.log),
|
|
161
|
-
`## Instructions\n\n${numberInstructions(buildSimpleIterateInstructions(result))}`,
|
|
162
196
|
]));
|
|
163
197
|
}
|
|
164
198
|
case "escalate":
|