@trashcodermaker/pr-review-handler 1.1.1 → 1.1.3

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,10 +2,22 @@
2
2
 
3
3
  > Systematically process GitHub PR review comments: triage for validity, fix code, and post replies.
4
4
 
5
+ [![npm version](https://img.shields.io/npm/v/@trashcodermaker/pr-review-handler?style=flat-square)](https://www.npmjs.com/package/@trashcodermaker/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
+
5
9
  This is the **generic npm package** — an agent skill usable from any agent harness: Pi, Claude Code, Cursor, Gemini CLI, OpenCode, and others.
6
10
 
7
11
  Looking for the **Pi-specific package**? See [`@trashcodermaker/pi-pr-review-handler`](https://www.npmjs.com/package/@trashcodermaker/pi-pr-review-handler).
8
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
+ The skill is agent-agnostic: it ships agent specs in `agents/` and works with any agent harness that can run subtasks (Pi, Claude Code, Cursor, Gemini CLI, OpenCode, …) or inline as a fallback.
20
+
9
21
  ## Install
10
22
 
11
23
  ```bash
@@ -28,16 +40,90 @@ Point your agent at `node_modules/@trashcodermaker/pr-review-handler/skills/pr-r
28
40
 
29
41
  ## How it works
30
42
 
31
- The skill runs a multi-phase pipeline with two human checkpoints:
43
+ The handler runs a multi-phase pipeline. Each phase has a clear responsibility, and the flow stops at checkpoints where human confirmation is requested.
44
+
45
+ ```
46
+ Phase 0: Setup
47
+ Phase 1: Triage ← parallel, read-only
48
+ Phase 2: Fix ← serial, minimal changes
49
+ Phase 3: Reply ← orchestrator drafts inline
50
+ Phase 4: Post & Push
51
+ Phase 5: Report
52
+ ```
53
+
54
+ ### Phase 0: Setup
55
+
56
+ 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.
57
+
58
+ ### Phase 1: Triage
59
+
60
+ Reads the referenced code and each review thread, then classifies every comment as:
61
+
62
+ - `valid-fix` — a real issue that requires code changes
63
+ - `valid-nofix` — the concern is valid, but no code change is needed
64
+ - `invalid` — the premise doesn't apply to current code, or the suggested fix would be harmful
65
+
66
+ If there are many threads and the platform supports parallel agents, triage runs in parallel for speed.
67
+
68
+ > [!TIP]
69
+ > Triage is intentionally conservative. If a comment is unclear, mark it `invalid` with the reason `unclear — needs human review`.
70
+
71
+ ### Phase 2: Fix
72
+
73
+ 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.
74
+
75
+ All fixes are committed locally, but **never pushed** during this phase.
76
+
77
+ After all fixes:
78
+
79
+ ```bash
80
+ npx tsc --noEmit
81
+ ```
82
+
83
+ If type checking fails, the pipeline identifies the offending commit, reverts it, fixes the issue, and recommits before continuing.
84
+
85
+ ### Phase 3: Reply
86
+
87
+ The orchestrator drafts one reply per thread based on:
88
+
89
+ - Original thread data
90
+ - Triage verdicts
91
+ - Actual diff: `git diff origin/{branch}...HEAD`
92
+ - Failure records from Phase 2
93
+
94
+ Replies are matched to the reviewer's language and tone, kept concise, and never defensive.
95
+
96
+ ### Phase 4: Post & Push
97
+
98
+ Approved replies are posted to GitHub, and all local review-fix commits are pushed in one step.
99
+
100
+ Optionally, the handler can also:
101
+
102
+ - Request re-review from the original reviewers
103
+ - Dismiss resolved review threads with an "Addressed" message
104
+
105
+ ### Phase 5: Report
106
+
107
+ A concise summary is printed at the end:
32
108
 
33
109
  ```
34
- Phase 0: Setup Phase 1: Triage (parallel, read-only) → Phase 2: Fix (serial)
35
- Phase 3: Reply Phase 4: Post & Push → Phase 5: Report
110
+ Triage: N/N threads processed
111
+ Fixes: M/K valid-fix threads applied (committed locally, pushed)
112
+ ❌ Failed: {thread} — {reason}
113
+ ✅ Replies: P/P threads drafted and posted
36
114
  ```
37
115
 
38
- Each phase has a clear responsibility. Triage classifies every review comment as `valid-fix`, `valid-nofix`, or `invalid`. Implementation applies minimal surgical fixes. The orchestrator drafts replies that match the reviewer's language and tone.
116
+ ## Usage
117
+
118
+ When installed as a skill, invoke it from your agent with natural language. Examples:
39
119
 
40
- Full documentation: <https://github.com/JI4JUN/pr-review-handler#readme>
120
+ - "帮我处理这个 PR 的 review:<https://github.com/owner/repo/pull/123>"
121
+ - "回复 reviewer 的评论"
122
+ - "看看 PR 里那些 unresolved threads"
123
+ - "review 提的问题要修一下"
124
+ - "CI 过了,但 review 还没回"
125
+ - "someone left comments on my PR"
126
+ - "帮我看看那些人提的意见"
41
127
 
42
128
  ## Requirements
43
129
 
@@ -45,6 +131,16 @@ Full documentation: <https://github.com/JI4JUN/pr-review-handler#readme>
45
131
  - A Git working tree clean enough to create review-fix commits
46
132
  - Node.js / TypeScript project if you want the final `tsc --noEmit` check
47
133
 
134
+ ## Supported platforms
135
+
136
+ | Platform | Support |
137
+ | --- | --- |
138
+ | npm / Node.js | ✅ Install `@trashcodermaker/pr-review-handler` as a published package |
139
+ | Pi | ✅ Install [`@trashcodermaker/pi-pr-review-handler`](https://www.npmjs.com/package/@trashcodermaker/pi-pr-review-handler) via `pi install`. For subtask-based dispatch (fresh context per thread), install the [`pi-subagents`](https://github.com/nicobailon/pi-subagents) extension (`pi install npm:pi-subagents`); otherwise the skill runs inline. |
140
+ | Claude Code | ✅ Task-based agent dispatch, or `npx skills add JI4JUN/pr-review-handler --skill pr-review-handler` |
141
+ | Cursor | ✅ Background agent dispatch |
142
+ | Gemini CLI / OpenCode / others | ✅ Native subtask mechanism, or inline fallback |
143
+
48
144
  ## License
49
145
 
50
146
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trashcodermaker/pr-review-handler",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "description": "Systematically process GitHub PR review comments: triage for validity, fix code, and post replies. Agent skill usable from any agent harness (Pi, Claude Code, Cursor, Gemini CLI, OpenCode, etc.).",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -41,7 +41,7 @@ Agent specs live in `agents/` relative to this skill (`agents/triage-agent.md`,
41
41
 
42
42
  | Platform | Dispatch mechanism |
43
43
  |----------|-------------------|
44
- | Pi | inline fallback (Pi has no native subagent mechanism). Recommend installing the [`pi-subagents`](https://github.com/nicobailon/pi-subagents) extension (`pi install npm:pi-subagents`) to gain a `subagent` tool with fresh-context dispatch per thread. |
44
+ | Pi | inline fallback (no native subtask mechanism) |
45
45
  | Claude Code | Task tool |
46
46
  | Cursor | background agent |
47
47
  | Gemini CLI / OpenCode / others | native subtask mechanism if available |