pr-shepherd 0.44.0 → 0.45.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 (100) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/README.md +4 -4
  3. package/bin/checks/conclusions.d.mts +24 -1
  4. package/bin/checks/conclusions.mjs +39 -0
  5. package/bin/checks/triage.d.mts +3 -2
  6. package/bin/checks/triage.mjs +44 -15
  7. package/bin/cli/api-usage-formatter.d.mts +3 -0
  8. package/bin/cli/api-usage-formatter.mjs +36 -0
  9. package/bin/cli/error-format.d.mts +13 -0
  10. package/bin/cli/error-format.mjs +41 -0
  11. package/bin/cli/fix-formatter.mjs +12 -1
  12. package/bin/cli/iterate-activity-formatter.d.mts +2 -0
  13. package/bin/cli/iterate-activity-formatter.mjs +26 -0
  14. package/bin/cli/iterate-formatter.mjs +11 -28
  15. package/bin/cli/iterate-instructions.mjs +14 -1
  16. package/bin/cli/iterate-lean.mjs +1 -0
  17. package/bin/cli/mutate-formatter.mjs +2 -0
  18. package/bin/commands/check-annotations.d.mts +2 -1
  19. package/bin/commands/check-annotations.mjs +7 -7
  20. package/bin/commands/check.mjs +6 -4
  21. package/bin/commands/iterate/api-usage.d.mts +2 -0
  22. package/bin/commands/iterate/api-usage.mjs +42 -0
  23. package/bin/commands/iterate/check-instructions.d.mts +2 -2
  24. package/bin/commands/iterate/check-instructions.mjs +27 -8
  25. package/bin/commands/iterate/fix-code.mjs +42 -8
  26. package/bin/commands/iterate/index.mjs +6 -3
  27. package/bin/commands/iterate/merge-state.mjs +5 -2
  28. package/bin/commands/iterate/render.d.mts +1 -1
  29. package/bin/commands/iterate/render.mjs +9 -5
  30. package/bin/commands/iterate/run.d.mts +2 -0
  31. package/bin/commands/iterate/run.mjs +8 -0
  32. package/bin/commands/mark-files-as-viewed.mjs +8 -0
  33. package/bin/commands/poll-run.d.mts +2 -0
  34. package/bin/commands/poll-run.mjs +8 -0
  35. package/bin/commands/poll.d.mts +1 -2
  36. package/bin/commands/poll.mjs +29 -10
  37. package/bin/comments/rate-limit.d.mts +4 -0
  38. package/bin/comments/rate-limit.mjs +6 -0
  39. package/bin/config/load.d.mts +6 -1
  40. package/bin/config/load.mjs +33 -1
  41. package/bin/config.json +6 -1
  42. package/bin/exit-codes.d.mts +1 -1
  43. package/bin/exit-codes.mjs +1 -1
  44. package/bin/github/api-telemetry-aggregate.d.mts +32 -0
  45. package/bin/github/api-telemetry-aggregate.mjs +84 -0
  46. package/bin/github/api-telemetry.d.mts +13 -0
  47. package/bin/github/api-telemetry.mjs +128 -0
  48. package/bin/github/check-annotations.d.mts +14 -1
  49. package/bin/github/check-annotations.mjs +29 -2
  50. package/bin/github/errors.d.mts +8 -0
  51. package/bin/github/errors.mjs +29 -1
  52. package/bin/github/gql/batch-pr-page.gql +8 -0
  53. package/bin/github/gql/batch-pr.gql +8 -0
  54. package/bin/github/gql/check-run-annotations.gql +8 -0
  55. package/bin/github/gql/commit-check-contexts.gql +8 -0
  56. package/bin/github/gql/get-pr-body.gql +8 -0
  57. package/bin/github/gql/get-pr-head-sha.gql +8 -0
  58. package/bin/github/gql/pr-number-by-branch.gql +8 -0
  59. package/bin/github/gql/review-thread-comments.gql +8 -0
  60. package/bin/github/gql/suggestion-threads.gql +8 -0
  61. package/bin/github/graphql-http.mjs +66 -10
  62. package/bin/github/graphql-internal-retry.d.mts +2 -0
  63. package/bin/github/graphql-internal-retry.mjs +50 -0
  64. package/bin/github/graphql-response.mjs +11 -1
  65. package/bin/github/http-auth.d.mts +9 -1
  66. package/bin/github/http-auth.mjs +35 -14
  67. package/bin/github/http-intermediate.d.mts +9 -0
  68. package/bin/github/http-intermediate.mjs +20 -0
  69. package/bin/github/http-request.d.mts +1 -1
  70. package/bin/github/http-request.mjs +1 -1
  71. package/bin/github/http-utils.d.mts +6 -0
  72. package/bin/github/http-utils.mjs +10 -1
  73. package/bin/github/rest-http.d.mts +16 -1
  74. package/bin/github/rest-http.mjs +71 -8
  75. package/bin/github/rest-text.mjs +41 -5
  76. package/bin/index.mjs +2 -1
  77. package/bin/log/session.d.mts +11 -0
  78. package/bin/log/session.mjs +22 -0
  79. package/bin/mcp/server.mjs +16 -2
  80. package/bin/quota-warning.d.mts +2 -0
  81. package/bin/quota-warning.mjs +6 -0
  82. package/bin/state/graphql-quota-claims.d.mts +2 -0
  83. package/bin/state/graphql-quota-claims.mjs +61 -0
  84. package/bin/state/graphql-quota-policy.d.mts +17 -0
  85. package/bin/state/graphql-quota-policy.mjs +43 -0
  86. package/bin/state/graphql-quota-warnings.d.mts +6 -0
  87. package/bin/state/graphql-quota-warnings.mjs +105 -0
  88. package/bin/state/rest-cache.d.mts +48 -0
  89. package/bin/state/rest-cache.mjs +91 -0
  90. package/bin/types/api-usage.d.mts +31 -0
  91. package/bin/types/api-usage.mjs +1 -0
  92. package/bin/types/iterate.d.mts +4 -1
  93. package/bin/types/report.d.mts +2 -0
  94. package/bin/types.d.mts +1 -0
  95. package/bin/types.mjs +1 -0
  96. package/package.json +1 -1
  97. package/plugins/pr-shepherd/.codex-plugin/plugin.json +1 -1
  98. package/plugins/pr-shepherd/.codex.mcp.json +1 -1
  99. package/plugins/pr-shepherd/.mcp.json +1 -1
  100. package/plugins/pr-shepherd/skills/pr-shepherd/SKILL.md +14 -9
@@ -28,7 +28,7 @@ mechanics every tick. Apply the referenced playbook in full whenever a step poin
28
28
  ### Suggestion patches
29
29
 
30
30
  - Run one plural `build-suggestion-patches` command with a repeated `--thread-id … --message … [--description …]` group for every marked thread in displayed order.
31
- - The CLI only builds patches. Apply, stage, and commit the returned patches in order. Push only when authorization has been established outside Shepherd; GitHub viewer fields cannot verify the local Git credential.
31
+ - The CLI only builds patches. Apply, stage, and commit the returned patches in order. This command does not itself check push authorization follow the `iterate`/`fix_code` output's own commit/push instruction for whether to push now or hand off: it reflects whether GitHub confirms the viewer can push to the PR head branch.
32
32
  - The command builds from the fetched PR head and accepts a clean local descendant only when the complete ordered patch stream passes `git apply --check`.
33
33
  - If the command refuses because a suggestion is unsafe or no longer applies, inspect the current source, the displayed replacement block, and reviewer intent before editing manually. Do not apply a stale numeric range blindly or retry unchanged input.
34
34
  - A returned patch was checked against the then-current worktree. If it later fails, re-inspect the worktree because it changed after validation.
@@ -40,14 +40,19 @@ Match each failure's `[conclusion: …]` tag under `## Failing checks` to a rule
40
40
 
41
41
  More specific rows win over the general "GitHub Actions failure" row — check conclusion first.
42
42
 
43
- | Tag / kind | Do |
44
- | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
45
- | GitHub Actions failure (has a run ID, not `CANCELLED`/`STARTUP_FAILURE`) | Read the included log excerpt if one is rendered. If it is missing or insufficient, hand off the displayed run ID/URL; Shepherd cannot verify authorization for another Actions read or mutation. |
46
- | Transient infrastructure failure | Record the diagnosis. Shepherd does not recommend a rerun because GitHub exposes no exact viewer capability for that workflow-run action. |
47
- | Real test or build failure | Apply a code fix — do not rerun. |
48
- | `[conclusion: CANCELLED]` | No log excerpt is rendered. Hand off the displayed metadata; Shepherd cannot verify authorization for another Actions read or mutation. |
49
- | `[conclusion: STARTUP_FAILURE]` | No log excerpt is rendered. Hand off the displayed metadata; Shepherd cannot verify authorization for another Actions read or mutation. |
50
- | `external` (no run ID, has a URL) | Preserve the URL in the handoff. Shepherd does not recommend opening it because it cannot verify the current viewer's access to the external system. |
43
+ A `[rerun authorized]` tag with a `rerun:` command means the viewer's repository role grants GitHub's Actions rerun capability (WRITE+) — Shepherd verified this from `repositoryPermission`. This confirms the account's role, not the granular scope of whatever credential actually runs `gh`; if the printed `rerun:` command still fails when run, do not retry it — hand off the displayed metadata instead, the same as an unauthorized check. No tag/command means Shepherd could not verify the account-level capability at all; hand off instead of guessing. A run still in progress, an `ACTION_REQUIRED` run (paused pending manual workflow approval — a rerun cannot grant that approval), or a check whose runId does not resolve to a GitHub Actions workflow never gets `[rerun authorized]`, regardless of role.
44
+
45
+ When several bullets share one runId (matrix jobs from the same run), the `rerun:` command is printed once, on the first bullet; every bullet for that runId still carries `[rerun authorized]` and is covered by that single command do not run it more than once.
46
+
47
+ | Tag / kind | Do |
48
+ | ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
49
+ | GitHub Actions failure (has a run ID, not `CANCELLED`/`STARTUP_FAILURE`) | Read the included log excerpt if one is rendered. If it is missing or insufficient: run the `rerun:` command if `[rerun authorized]`, then iterate again once it completes; otherwise hand off the displayed run ID/URL. |
50
+ | Transient infrastructure failure | Run the `rerun:` command if `[rerun authorized]`, then iterate again once it completes. Otherwise record the diagnosis and hand off Shepherd cannot verify rerun authorization. |
51
+ | Real test or build failure | Apply a code fix — do not rerun, even if `[rerun authorized]` is shown. |
52
+ | `[conclusion: CANCELLED]` | No log excerpt is rendered. Run the `rerun:` command if `[rerun authorized]`, then iterate again once it completes; otherwise hand off the displayed metadata. |
53
+ | `[conclusion: STARTUP_FAILURE]` | No log excerpt is rendered. Run the `rerun:` command if `[rerun authorized]`, then iterate again once it completes; otherwise hand off the displayed metadata. |
54
+ | `[conclusion: ACTION_REQUIRED]` | Never carries `[rerun authorized]`. Hand off — the run needs a maintainer's manual workflow approval on GitHub, which a rerun cannot grant. |
55
+ | `external` (no run ID, has a URL) | Preserve the URL in the handoff. Shepherd does not recommend opening it because it cannot verify the current viewer's access to the external system. |
51
56
 
52
57
  ### Review-mutation mechanics
53
58