@trashcodermaker/pi-pr-review-handler 1.1.2 → 1.1.4

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 CHANGED
@@ -2,47 +2,149 @@
2
2
 
3
3
  > Pi package — systematically process GitHub PR review comments: triage, fix, reply.
4
4
 
5
- Install with Pi:
5
+ [![npm version](https://img.shields.io/npm/v/@trashcodermaker/pi-pr-review-handler?style=flat-square)](https://www.npmjs.com/package/@trashcodermaker/pi-pr-review-handler)
6
+ [![License](https://img.shields.io/badge/License-MIT-yellow?style=flat-square)](https://github.com/JI4JUN/pr-review-handler/blob/main/LICENSE)
7
+ [![Build](https://img.shields.io/github/actions/workflow/status/JI4JUN/pr-review-handler/publish.yml?style=flat-square&label=Build)](https://github.com/JI4JUN/pr-review-handler/actions)
8
+
9
+ This is the **Pi-specific package**. Pi auto-discovers the skill after install.
10
+
11
+ Looking for the **generic package** for other agent harnesses (Claude Code, Cursor, Gemini CLI, OpenCode, …)? See [`@trashcodermaker/pr-review-handler`](https://www.npmjs.com/package/@trashcodermaker/pr-review-handler).
12
+
13
+ ## Overview
14
+
15
+ Code review is part of every healthy PR workflow, but turning review threads into actual fixes and thoughtful replies can be tedious and error-prone.
16
+
17
+ **PR Review Handler** automates that workflow. It fetches unresolved GitHub PR review threads, evaluates each comment for validity, applies minimal code fixes, drafts replies that match the reviewer's language and tone, and optionally pushes changes and requests re-review.
18
+
19
+ ## Install
6
20
 
7
21
  ```bash
8
22
  pi install npm:@trashcodermaker/pi-pr-review-handler
9
23
  ```
10
24
 
11
- Pi auto-discovers the skill under `skills/pr-review-handler/`. Once installed, invoke it from your Pi session with natural language like "handle the reviews on my PR" or `/skill:pr-review-handler`.
12
-
13
- ## What it does
25
+ Pi auto-discovers the skill under `skills/pr-review-handler/`.
14
26
 
15
- Fetches unresolved GitHub PR review threads, evaluates each comment for validity, applies minimal code fixes, drafts replies that match the reviewer's language and tone, and optionally pushes changes and requests re-review.
27
+ ## What you get
16
28
 
17
- ## Requirements
18
-
19
- - GitHub CLI (`gh`) installed and authenticated
20
- - A Git working tree clean enough to create review-fix commits
21
- - Node.js / TypeScript project if you want the final `tsc --noEmit` check
29
+ ```
30
+ node_modules/@trashcodermaker/pi-pr-review-handler/
31
+ └── skills/
32
+ └── pr-review-handler/
33
+ ├── SKILL.md # the skill instructions
34
+ └── agents/
35
+ ├── triage-agent.md
36
+ └── implementation-agent.md
37
+ ```
22
38
 
23
39
  ## How it works
24
40
 
41
+ The handler runs a multi-phase pipeline. Each phase has a clear responsibility, and the flow stops at checkpoints where human confirmation is requested.
42
+
25
43
  ```
26
- Phase 0: Setup → Phase 1: Triage (parallel) → Phase 2: Fix (serial)
27
- Phase 3: Reply Phase 4: Post & Push → Phase 5: Report
44
+ Phase 0: Setup
45
+ Phase 1: Triage ← parallel, read-only
46
+ Phase 2: Fix ← serial, minimal changes
47
+ Phase 3: Reply ← orchestrator drafts inline
48
+ Phase 4: Post & Push
49
+ Phase 5: Report
28
50
  ```
29
51
 
30
- Checkpoints pause for confirmation after triage verdicts and before posting replies.
52
+ ### Phase 0: Setup
53
+
54
+ Identifies the target PR from the current branch or an explicit PR link, fetches unresolved review threads, and fetches review-level feedback. This phase prepares everything needed for triage without modifying code.
55
+
56
+ ### Phase 1: Triage
57
+
58
+ Reads the referenced code and each review thread, then classifies every comment as:
59
+
60
+ - `valid-fix` — a real issue that requires code changes
61
+ - `valid-nofix` — the concern is valid, but no code change is needed
62
+ - `invalid` — the premise doesn't apply to current code, or the suggested fix would be harmful
63
+
64
+ If there are many threads and the platform supports parallel agents, triage runs in parallel for speed.
31
65
 
32
- ## Other platforms
66
+ > [!TIP]
67
+ > Triage is intentionally conservative. If a comment is unclear, mark it `invalid` with the reason `unclear — needs human review`.
33
68
 
34
- This is the Pi-scoped package. If you use Claude Code, Cursor, Gemini CLI, OpenCode, or another harness, install the generic package instead:
69
+ ### Phase 2: Fix
70
+
71
+ For each `valid-fix` thread, a specialized implementation agent applies the smallest possible change that satisfies the review. The agent traces references first, updates callers and tests when signatures change, and avoids unrelated cleanup or refactors.
72
+
73
+ All fixes are committed locally, but **never pushed** during this phase.
74
+
75
+ After all fixes:
35
76
 
36
77
  ```bash
37
- npm install @trashcodermaker/pr-review-handler
78
+ npx tsc --noEmit
38
79
  ```
39
80
 
40
- Or grab the skill directly:
81
+ If type checking fails, the pipeline identifies the offending commit, reverts it, fixes the issue, and recommits before continuing.
41
82
 
42
- ```bash
43
- npx skills add JI4JUN/pr-review-handler --skill pr-review-handler
83
+ ### Phase 3: Reply
84
+
85
+ The orchestrator drafts one reply per thread based on:
86
+
87
+ - Original thread data
88
+ - Triage verdicts
89
+ - Actual diff: `git diff origin/{branch}...HEAD`
90
+ - Failure records from Phase 2
91
+
92
+ Replies are matched to the reviewer's language and tone, kept concise, and never defensive.
93
+
94
+ ### Phase 4: Post & Push
95
+
96
+ Approved replies are posted to GitHub, and all local review-fix commits are pushed in one step.
97
+
98
+ Optionally, the handler can also:
99
+
100
+ - Request re-review from the original reviewers
101
+ - Dismiss resolved review threads with an "Addressed" message
102
+
103
+ ### Phase 5: Report
104
+
105
+ A concise summary is printed at the end:
106
+
107
+ ```
108
+ ✅ Triage: N/N threads processed
109
+ ✅ Fixes: M/K valid-fix threads applied (committed locally, pushed)
110
+ ❌ Failed: {thread} — {reason}
111
+ ✅ Replies: P/P threads drafted and posted
44
112
  ```
45
113
 
114
+ ## Usage
115
+
116
+ Once installed, invoke it from your Pi session with natural language:
117
+
118
+ - "帮我处理这个 PR 的 review:<https://github.com/owner/repo/pull/123>"
119
+ - "回复 reviewer 的评论"
120
+ - "看看 PR 里那些 unresolved threads"
121
+ - "review 提的问题要修一下"
122
+ - "CI 过了,但 review 还没回"
123
+ - "handle the reviews on my PR"
124
+ - "someone left comments on my PR"
125
+
126
+ Or trigger the skill directly:
127
+
128
+ ```
129
+ /skill:pr-review-handler
130
+ ```
131
+
132
+ > [!TIP]
133
+ > Pi has no native subtask mechanism. By default the skill runs inline (the orchestrator executes the agent specs itself). For subtask-based dispatch with fresh context per thread, install the [`pi-subagents`](https://github.com/nicobailon/pi-subagents) extension (`pi install npm:pi-subagents`).
134
+
135
+ ## Requirements
136
+
137
+ - GitHub CLI (`gh`) installed and authenticated
138
+ - A Git working tree clean enough to create review-fix commits
139
+ - Node.js / TypeScript project if you want the final `tsc --noEmit` check
140
+
141
+ ## Supported platforms
142
+
143
+ | Platform | Support |
144
+ | --- | --- |
145
+ | Pi | ✅ This package. Inline by default; install [`pi-subagents`](https://github.com/nicobailon/pi-subagents) for subtask dispatch. |
146
+ | Other harnesses (Claude Code, Cursor, Gemini CLI, OpenCode, …) | ✅ Use [`@trashcodermaker/pr-review-handler`](https://www.npmjs.com/package/@trashcodermaker/pr-review-handler) instead |
147
+
46
148
  ## License
47
149
 
48
150
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trashcodermaker/pi-pr-review-handler",
3
- "version": "1.1.2",
3
+ "version": "1.1.4",
4
4
  "description": "Systematically process GitHub PR review comments: triage for validity, fix code, and post replies. Pi package — install with `pi install npm:@trashcodermaker/pi-pr-review-handler`.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -22,7 +22,7 @@
22
22
  "LICENSE"
23
23
  ],
24
24
  "scripts": {
25
- "prepublishOnly": "node ../../scripts/sync-skill.mjs ."
25
+ "prepublishOnly": "node ../../scripts/sync-skill.mjs . --name pi-pr-review-handler"
26
26
  },
27
27
  "repository": {
28
28
  "type": "git",
@@ -1,5 +1,5 @@
1
1
  ---
2
- name: pr-review-handler
2
+ name: pi-pr-review-handler
3
3
  description: >
4
4
  Systematically process GitHub PR review comments: triage for validity,
5
5
  fix code, and post replies. Use whenever the user mentions PR reviews,