@henryqw/pi-pr 3.1.9 → 4.0.2
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/README.md +28 -11
- package/docs/pr-routing.svg +1 -1
- package/extensions/pr-ci.ts +908 -0
- package/extensions/pr-command.ts +107 -21
- package/extensions/pr-comment-sweep.ts +1102 -0
- package/extensions/pr-create.ts +684 -0
- package/extensions/pr-execution.ts +558 -0
- package/extensions/pr-feedback.ts +519 -0
- package/extensions/pr-github.ts +363 -145
- package/extensions/pr-merge.ts +4 -44
- package/extensions/pr-routing.ts +2 -1
- package/extensions/pr-ui.ts +1 -1
- package/extensions/pr-update-branch.ts +327 -0
- package/extensions/pr.ts +480 -16
- package/package.json +4 -2
- package/skills/pi-pr-comment-sweep/SKILL.md +45 -89
- package/skills/pi-pr-comment-sweep/references/recovery.md +24 -46
- package/skills/pi-pr-comment-sweep/references/thread-triage.md +2 -2
- package/skills/pi-pr-comment-sweep/scripts/pr-feedback.mjs +223 -1799
- package/skills/pi-pr-create/SKILL.md +6 -77
- package/skills/pi-pr-fix-ci/SKILL.md +39 -39
- package/skills/pi-pr-update-branch/SKILL.md +5 -108
package/README.md
CHANGED
|
@@ -16,6 +16,9 @@ Requires an authenticated GitHub CLI session (`gh auth login`) and a checkout on
|
|
|
16
16
|
includes IDs, kinds, states, authors, locations, and parent IDs as needed. It
|
|
17
17
|
does not print comment or review bodies.
|
|
18
18
|
|
|
19
|
+
With `--out`, it atomically replaces `FILE` as a mode-0600 file. It does not
|
|
20
|
+
change the parent directory's permissions.
|
|
21
|
+
|
|
19
22
|
The saved snapshot still contains the complete feedback. `fetch --json` also
|
|
20
23
|
keeps the complete JSON output. Read one item with
|
|
21
24
|
`pr-feedback.mjs show --snapshot FILE --id ID`.
|
|
@@ -37,18 +40,20 @@ GitHub, use the network, or write files.
|
|
|
37
40
|
|
|
38
41
|
## Use
|
|
39
42
|
|
|
40
|
-
Run `/pr` in a GitHub checkout. It reads
|
|
43
|
+
Run `/pr` in a GitHub checkout. It reads fresh pull request and local state, then runs one route. The PR hostname selects its GitHub API host, and the extension works outside Herdr.
|
|
41
44
|
|
|
42
|
-
|
|
45
|
+
Creation accepts one optional base anchor. Use `/pr --base=<host>/<owner>/<repository>:<ref>`. All other route instructions fail instead of being ignored.
|
|
43
46
|
|
|
44
47
|
| Surface | Type | Purpose |
|
|
45
48
|
| --- | --- | --- |
|
|
46
|
-
| `/pr [
|
|
49
|
+
| `/pr [--base=<host>/<owner>/<repository>:<ref>]` | command | Run the current pull request's next safe route. |
|
|
47
50
|
| Footer | ui | Show a linked `PR #number` and one plain-language status. |
|
|
48
|
-
| Widget | ui | Show one
|
|
51
|
+
| Widget | ui | Show one action hint or transient routing status. |
|
|
49
52
|
|
|
50
53
|
The footer already shows the pull request and status. Actionable widgets omit duplicate identity and status. Each uses one semantic status icon, a space, and a plain `Run /pr to …` route. `✗` marks errors, `!` warnings, `✓` success, and `●` accent or neutral routes. In TUI, only the icon uses a theme color. RPC and non-TUI output use the same plain text without ANSI.
|
|
51
54
|
|
|
55
|
+
The widget switches to `⠋ Checking pull request…` as soon as `/pr` starts discovery. The braille spinner animates in TUI mode. RPC receives one plain static line. The footer stays unchanged. The routing widget clears after route selection and before any prompt, notification, mutation, or workflow dispatch.
|
|
56
|
+
|
|
52
57
|
## Flow
|
|
53
58
|
|
|
54
59
|
Each footer entry is one linked `PR #number` plus one plain-language status: `N unresolved`, `draft`, `open`, `approved`, `CI running`, `CI failed`, `changes requested`, `base update required`, `merge conflict`, `merge-ready`, `merged`, or `closed`. Colors support the text; they do not carry meaning alone.
|
|
@@ -63,12 +68,13 @@ Each footer entry is one linked `PR #number` plus one plain-language status: `N
|
|
|
63
68
|
| One open pull request inferred from a published matching ref | Confirm the exact `remote/ref`, then link the local branch. |
|
|
64
69
|
| Ambiguous or unsafe discovery | Show the blocked reason and do not mutate Git or GitHub. |
|
|
65
70
|
| Base update required or merge conflict | Update from the base branch's current target when the tree is clean and local HEAD equals the PR head. |
|
|
66
|
-
|
|
|
71
|
+
| GitHub Actions job failed | Run the CI fix workflow when the same local prerequisite holds. |
|
|
72
|
+
| External check or commit status failed | Show `CI failed` as a no-action blocker. |
|
|
67
73
|
| Changes requested or unresolved review threads | Run the package comment sweep when the same local prerequisite holds. |
|
|
68
74
|
| No-action state | Report the state without taking action. |
|
|
69
75
|
| Merge-ready pull request | Ask for final confirmation, recheck fresh state, and merge directly if confirmed. |
|
|
70
76
|
|
|
71
|
-
`pi-pr-create`
|
|
77
|
+
`pi-pr-create` accepts an anchored base from `/pr --base=...`. Otherwise, it finds one unique parent from validated `origin` refs and commit history. The parent can be a feature branch.
|
|
72
78
|
|
|
73
79
|
It merges the parent's captured commit before validation and push. It resolves clear conflicts and stops when the base or conflict intent is ambiguous.
|
|
74
80
|
|
|
@@ -80,6 +86,10 @@ Multiple candidate remotes, multiple matching PRs, OID mismatches, and unsafe Gi
|
|
|
80
86
|
|
|
81
87
|
The creation workflow repeats destination, remote OID, PR, and configuration checks immediately before pushing. It pushes to the saved validated URL, not a mutable remote name. Every push uses the saved remote OID as an exact lease. Existing refs must also be ancestors of the captured local OID. A missing ref uses an empty lease as a create-only compare-and-swap.
|
|
82
88
|
|
|
89
|
+
Each helper workflow receives a random run ID and its first action. The run stays bound to one session, canonical worktree, route, and fresh authority. Helper calls from another run, session, worktree, or route fail.
|
|
90
|
+
|
|
91
|
+
Only one helper run can exist at a time. Most runs expire when the agent settles. A create or branch-update conflict stays available for one user-guided continuation, then expires after that continuation settles. Session replacement and shutdown forget the run without aborting or cleaning a pending merge.
|
|
92
|
+
|
|
83
93
|
After a `/pr` create workflow settles, the extension waits for a refresh that finds a configured current PR. It then prefixes the Herdr workspace label with `#<number> • `.
|
|
84
94
|
|
|
85
95
|
Failed or empty discovery leaves one rename pending for a later refresh. A restored configured PR completes the rename even when GitHub reports it as merged or closed.
|
|
@@ -92,7 +102,7 @@ If Herdr lookup, JSON validation, or rename fails, the PR and normal UI refresh
|
|
|
92
102
|
|
|
93
103
|
Current-branch discovery reads pull requests associated with the exact push repository ref. It does not run a global branch search. It finds a fork-head PR whose base is an upstream repository. A unique historical match uses the exact remote push-ref OID, not local HEAD.
|
|
94
104
|
|
|
95
|
-
A no-action state includes
|
|
105
|
+
A no-action state includes drafts, merged or closed pull requests, running or unsupported failed CI, pending review, and blocked merge policy. A dirty tree or mismatched local HEAD also blocks a mutating workflow.
|
|
96
106
|
|
|
97
107
|
### Route priority
|
|
98
108
|
|
|
@@ -100,7 +110,7 @@ A missing pull request uses creation. For an existing pull request, the first ma
|
|
|
100
110
|
|
|
101
111
|
1. Merged, closed, or draft: no action.
|
|
102
112
|
2. Base update required or merge conflict. Run only with a clean tree and equal local and PR heads.
|
|
103
|
-
3.
|
|
113
|
+
3. A failed GitHub Actions job. Apply the same local prerequisite. Other failed checks remain blockers.
|
|
104
114
|
4. Changes requested or unresolved review threads. Apply the same local prerequisite.
|
|
105
115
|
5. Waiting or local safety block: no action.
|
|
106
116
|
6. Merge-ready: allow clean local HEAD equal to or behind the PR head. Confirm, then merge directly.
|
|
@@ -109,13 +119,19 @@ Ordinary conversation comments do not trigger a route or block a merge. Changes
|
|
|
109
119
|
|
|
110
120
|
The comment sweep resolves its bundled helper and references from the installed package skill path. It does not require an external `jq` executable.
|
|
111
121
|
|
|
122
|
+
After publishing, `refresh` freezes the complete latest feedback and returns only IDs and kinds. Use `show` to inspect every fresh item.
|
|
123
|
+
|
|
124
|
+
A second guarded `record` must cover that exact snapshot before resolution or finalization. It keeps the paths from the initial record.
|
|
125
|
+
|
|
126
|
+
The sweep runs existing non-destructive checks on the clean committed `HEAD` before publishing. Finalization reruns them as a later state guard.
|
|
127
|
+
|
|
112
128
|
### Refresh
|
|
113
129
|
|
|
114
130
|
The footer and widget load at session start. A directory outside a Git worktree stays silent and does not start polling. The UI shows `PR · status unavailable` for other discovery failures and reports only a generic error.
|
|
115
131
|
|
|
116
132
|
They refresh after local commits, PR creation, pushes, and each dispatched workflow settles. During creation, intermediate refreshes wait until the workflow settles. They also refresh after any successful delegated task settles. Active Git worktrees poll every 30 seconds. Polling updates presentation only and may be stale.
|
|
117
133
|
|
|
118
|
-
The create widget stays hidden until the local branch has a commit beyond its creation point.
|
|
134
|
+
The create widget stays hidden until the local branch has a commit beyond its creation point. `/pr` replaces any hint with routing feedback while it selects a route. The feedback clears before route interaction. A dispatched workflow keeps the widget hidden until the agent settles. Direct and no-action routes refresh it after completion. A failed command restores the prior hint and schedules a refresh.
|
|
119
135
|
|
|
120
136
|
Presentation uses route priority, so draft appears before running CI. `/pr` reads fresh state before routing or merging. The command is authoritative for actions.
|
|
121
137
|
|
|
@@ -129,7 +145,7 @@ The GitHub response must match the observed URL, host, repository, head ref, hea
|
|
|
129
145
|
|
|
130
146
|
## Limits and recovery
|
|
131
147
|
|
|
132
|
-
- `/pr`
|
|
148
|
+
- `/pr` accepts only the optional anchored creation base described above. It does not open a browser.
|
|
133
149
|
- It does not run `/done` or `/sweep`.
|
|
134
150
|
- Polling does not auto-triage comments or start a workflow. The package comment sweep runs only when an explicit `/pr` selects it.
|
|
135
151
|
- It does not enable auto-merge or add a merge queue.
|
|
@@ -142,7 +158,8 @@ The GitHub response must match the observed URL, host, repository, head ref, hea
|
|
|
142
158
|
- A merge, rebase, cherry-pick, revert, or sequencer state blocks direct merge, even when `git status` is empty.
|
|
143
159
|
- A branch update resolves the base repository ref directly. It stops if that ref moves before merge or push.
|
|
144
160
|
- Before a comment-sweep push, it revalidates the configured destination, full PR identity, and local HEAD. It pushes the captured OID.
|
|
145
|
-
- CI repair
|
|
161
|
+
- CI repair streams a bounded failed-step log tail and runs one narrow local reproducer before editing.
|
|
162
|
+
- Before push, CI repair revalidates the saved destination, open PR, failure evidence, and repair HEAD.
|
|
146
163
|
- An already-published local HEAD needs no second push.
|
|
147
164
|
- Direct merge requires final confirmation and a fresh readiness check.
|
|
148
165
|
- After a successful merge, the create widget stays hidden until a new local commit.
|
package/docs/pr-routing.svg
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720" role="img" aria-labelledby="pr-routing-title pr-routing-desc">
|
|
2
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="1280" height="720" viewBox="0 0 1280 720" role="img" aria-labelledby="pr-routing-title pr-routing-desc">
|
|
3
3
|
<title id="pr-routing-title">How /pr picks one route</title>
|
|
4
4
|
<desc id="pr-routing-desc">The /pr command creates a pull request when needed, gates branch update, feedback sweep, and CI repair on a clean worktree with local HEAD equal to the PR head, and permits direct merge when clean local HEAD is equal to or behind the PR head.</desc>
|
|
5
5
|
<defs>
|