prr-kit 1.0.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 (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -0
  3. package/docs/assets/banner.svg +179 -0
  4. package/package.json +60 -0
  5. package/src/core/agents/prr-master.agent.yaml +80 -0
  6. package/src/core/module.yaml +19 -0
  7. package/src/core/tasks/help.md +37 -0
  8. package/src/core/tasks/workflow.xml +22 -0
  9. package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +68 -0
  10. package/src/core/workflows/party-mode/steps/step-02-discussion.md +125 -0
  11. package/src/core/workflows/party-mode/workflow.md +35 -0
  12. package/src/prr/agents/architecture-reviewer.agent.yaml +45 -0
  13. package/src/prr/agents/general-reviewer.agent.yaml +48 -0
  14. package/src/prr/agents/performance-reviewer.agent.yaml +45 -0
  15. package/src/prr/agents/security-reviewer.agent.yaml +43 -0
  16. package/src/prr/data/review-types.csv +39 -0
  17. package/src/prr/module.yaml +38 -0
  18. package/src/prr/workflows/0-setup/collect-project-context/steps/step-01-scan-configs.md +106 -0
  19. package/src/prr/workflows/0-setup/collect-project-context/steps/step-02-extract-rules.md +131 -0
  20. package/src/prr/workflows/0-setup/collect-project-context/steps/step-03-ask-context.md +194 -0
  21. package/src/prr/workflows/0-setup/collect-project-context/steps/step-04-save-context.md +161 -0
  22. package/src/prr/workflows/0-setup/collect-project-context/workflow.md +58 -0
  23. package/src/prr/workflows/1-discover/select-pr/steps/step-01-fetch.md +68 -0
  24. package/src/prr/workflows/1-discover/select-pr/steps/step-02-list-branches.md +95 -0
  25. package/src/prr/workflows/1-discover/select-pr/steps/step-03-select.md +127 -0
  26. package/src/prr/workflows/1-discover/select-pr/steps/step-04-load-diff.md +79 -0
  27. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +76 -0
  28. package/src/prr/workflows/1-discover/select-pr/workflow.md +36 -0
  29. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +37 -0
  30. package/src/prr/workflows/2-analyze/describe-pr/steps/step-02-classify.md +50 -0
  31. package/src/prr/workflows/2-analyze/describe-pr/steps/step-03-walkthrough.md +41 -0
  32. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +50 -0
  33. package/src/prr/workflows/2-analyze/describe-pr/templates/pr-description.template.md +51 -0
  34. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +28 -0
  35. package/src/prr/workflows/3-review/architecture-review/checklist.md +22 -0
  36. package/src/prr/workflows/3-review/architecture-review/instructions.xml +68 -0
  37. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +18 -0
  38. package/src/prr/workflows/3-review/general-review/checklist.md +23 -0
  39. package/src/prr/workflows/3-review/general-review/instructions.xml +68 -0
  40. package/src/prr/workflows/3-review/general-review/workflow.yaml +18 -0
  41. package/src/prr/workflows/3-review/performance-review/checklist.md +22 -0
  42. package/src/prr/workflows/3-review/performance-review/instructions.xml +68 -0
  43. package/src/prr/workflows/3-review/performance-review/workflow.yaml +18 -0
  44. package/src/prr/workflows/3-review/security-review/checklist.md +25 -0
  45. package/src/prr/workflows/3-review/security-review/data/owasp-checklist.csv +19 -0
  46. package/src/prr/workflows/3-review/security-review/instructions.xml +70 -0
  47. package/src/prr/workflows/3-review/security-review/workflow.yaml +19 -0
  48. package/src/prr/workflows/4-improve/improve-code/checklist.md +18 -0
  49. package/src/prr/workflows/4-improve/improve-code/instructions.xml +59 -0
  50. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +18 -0
  51. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +37 -0
  52. package/src/prr/workflows/5-ask/ask-code/steps/step-02-answer.md +36 -0
  53. package/src/prr/workflows/5-ask/ask-code/workflow.md +31 -0
  54. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +42 -0
  55. package/src/prr/workflows/6-report/generate-report/steps/step-02-organize.md +38 -0
  56. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +44 -0
  57. package/src/prr/workflows/6-report/generate-report/templates/review-report.template.md +78 -0
  58. package/src/prr/workflows/6-report/generate-report/workflow.md +26 -0
  59. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +166 -0
  60. package/src/prr/workflows/6-report/post-comments/steps/step-02-post.md +97 -0
  61. package/src/prr/workflows/6-report/post-comments/workflow.md +45 -0
  62. package/src/prr/workflows/quick/workflow.md +244 -0
  63. package/tools/cli/commands/install.js +66 -0
  64. package/tools/cli/commands/status.js +36 -0
  65. package/tools/cli/commands/uninstall.js +38 -0
  66. package/tools/cli/installers/lib/core/config-collector.js +47 -0
  67. package/tools/cli/installers/lib/core/detector.js +46 -0
  68. package/tools/cli/installers/lib/core/installer.js +162 -0
  69. package/tools/cli/installers/lib/core/manifest-generator.js +172 -0
  70. package/tools/cli/installers/lib/core/manifest.js +62 -0
  71. package/tools/cli/installers/lib/ide/_base-ide.js +36 -0
  72. package/tools/cli/installers/lib/ide/_config-driven.js +167 -0
  73. package/tools/cli/installers/lib/ide/manager.js +97 -0
  74. package/tools/cli/installers/lib/ide/platform-codes.yaml +76 -0
  75. package/tools/cli/installers/lib/ide/shared/path-utils.js +11 -0
  76. package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +16 -0
  77. package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +7 -0
  78. package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +5 -0
  79. package/tools/cli/lib/agent/compiler.js +123 -0
  80. package/tools/cli/lib/agent/template-engine.js +73 -0
  81. package/tools/cli/lib/cli-utils.js +32 -0
  82. package/tools/cli/lib/prompts.js +15 -0
  83. package/tools/cli/lib/ui.js +132 -0
  84. package/tools/cli/lib/xml-utils.js +24 -0
  85. package/tools/cli/prr-cli.js +36 -0
  86. package/tools/prr-npx-wrapper.js +6 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 mrquangthai278
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,226 @@
1
+ # PR Review Framework
2
+
3
+ <p align="center">
4
+ <img src="docs/assets/banner.svg" alt="PR Review Framework" width="100%"/>
5
+ </p>
6
+
7
+ > AI-driven Pull Request code review — structured, multi-perspective, actionable.
8
+
9
+ Module system, agent YAML, step-file workflows, CLI installer with full IDE integration.
10
+
11
+ ## Quick Start
12
+
13
+ ```bash
14
+ # Install into your repo (interactive — recommended)
15
+ npx pr-review install
16
+
17
+ # Or run directly
18
+ node tools/cli/prr-cli.js install --directory /path/to/repo
19
+
20
+ # Silent install with defaults (edit config.yaml afterward)
21
+ node tools/cli/prr-cli.js install --directory /path/to/repo --modules prr --tools claude-code --yes
22
+ ```
23
+
24
+ Then open your IDE in the installed project and use `/prr-master` to start.
25
+
26
+ ## How It Works
27
+
28
+ ```
29
+ Your IDE (Claude Code / Cursor / Windsurf / ...)
30
+
31
+ │ /prr-master or /prr-quick
32
+
33
+ ┌─────────────────────────────────────────────────┐
34
+ │ PRR Master Agent │
35
+ │ reads _prr/ · routes to workflows │
36
+ └────────────┬────────────────────────────────────┘
37
+
38
+ ┌───────▼────────┐
39
+ │ select-pr │ git fetch · list PRs via platform CLI
40
+ │ (Step-file) │ user selects PR/MR by number or branch
41
+ └───────┬────────┘
42
+ │ diff loaded into AI context
43
+ ┌───────▼────────┐
44
+ │ describe-pr │ classify type · file-by-file walkthrough
45
+ └───────┬────────┘
46
+
47
+ ┌───────▼────────────────────────────────┐
48
+ │ Review agents (parallel or sequential) │
49
+ │ GR · SR · PR · AR │
50
+ │ each reads instructions.xml │
51
+ │ outputs structured findings │
52
+ └───────┬────────────────────────────────┘
53
+
54
+ ┌───────▼────────┐
55
+ │ generate-report│ compile findings · sort by severity
56
+ │ │ write .md to _prr-output/reviews/
57
+ └───────┬────────┘
58
+
59
+ ┌───────▼────────┐
60
+ │ post-comments │ post inline comments via platform CLI
61
+ │ (optional) │ GitHub · GitLab · Azure · Bitbucket
62
+ └────────────────┘
63
+ ```
64
+
65
+ The framework installs into your project as a `_prr/` folder. Agents and workflows are Markdown/YAML files that your AI IDE reads and executes — no server, no background process, no API keys required beyond your IDE's AI.
66
+
67
+ ## Configuration
68
+
69
+ After install, edit `_prr/prr/config.yaml` in your project:
70
+
71
+ ```yaml
72
+ user_name: YourName
73
+ communication_language: English
74
+ target_repo: . # path to the git repo to review (. = current dir)
75
+ github_repo: "owner/repo" # GitHub repo for gh pr list / inline comments
76
+ output_folder: _prr-output
77
+ review_output: /abs/path/_prr-output/reviews
78
+ ```
79
+
80
+ > `github_repo` is required for `gh pr list`, `gh pr diff`, and posting inline GitHub comments.
81
+ > Leave empty to use local branch selection only.
82
+
83
+ ## Platform Support
84
+
85
+ | Feature | None / Local | GitHub | GitLab | Azure DevOps | Bitbucket |
86
+ |---------|:---:|:---:|:---:|:---:|:---:|
87
+ | Core review (diff analysis) | ✅ | ✅ | ✅ | ✅ | ✅ |
88
+ | Auto-detect platform from remote URL | — | ✅ | ✅ | ✅ | ✅ |
89
+ | List open PRs/MRs | ❌ | ✅ `gh` | ✅ `glab` | ✅ `az` | ✅ `bb` |
90
+ | Select PR by number (auto base/head) | ❌ | ✅ | ✅ | ✅ | ✅ |
91
+ | Load diff via platform CLI | ❌ | ✅ `gh pr diff` | ✅ `glab mr diff` | ⚠️ git fallback | ⚠️ git fallback |
92
+ | Post inline code comments | ❌ | ✅ Reviews API | ✅ MR discussions | ✅ PR threads | ✅ REST API |
93
+ | Post summary review | ❌ | ✅ | ✅ | ✅ | ✅ |
94
+ | Review verdict (approve / request changes) | ❌ | ✅ | ✅ | ✅ | ❌ |
95
+ | Required CLI | — | `gh` | `glab` | `az` + extension | `bb` / curl |
96
+
97
+ > **None / Local mode**: all review analysis runs locally via `git diff` — no platform CLI required. Findings are saved to `_prr-output/reviews/` only.
98
+
99
+ ## Review Workflow
100
+
101
+ ### Quick mode — one command, full pipeline
102
+
103
+ ```
104
+ /prr-quick or /prr-master → QR
105
+ ```
106
+
107
+ Runs automatically: **select PR → describe → all 4 reviews → generate report**
108
+ Only pauses once to ask which PR/branch to review.
109
+
110
+ ### Manual mode — step by step
111
+
112
+ | Code | Command | Description |
113
+ |------|---------|-------------|
114
+ | `CP` | Collect Project Context | Scan ESLint/tsconfig/docs, extract coding rules, capture domain knowledge — **run once per project** |
115
+ | `SP` | Select PR | Fetch latest → list open PRs (via `gh`) or branches → select head + base → load diff |
116
+ | `DP` | Describe PR | Classify PR type, generate summary, file-by-file walkthrough |
117
+ | `GR` | General Review | Logic, naming, readability, DRY, best practices |
118
+ | `SR` | Security Review | OWASP Top 10, secrets, auth, rate limits, injection |
119
+ | `PR` | Performance Review | N+1 queries, memory leaks, async patterns, caching |
120
+ | `AR` | Architecture Review | SOLID, layers, coupling, consistency with codebase |
121
+ | `IC` | Improve Code | Concrete BEFORE/AFTER code suggestions |
122
+ | `AK` | Ask Code | Q&A about specific changes in this PR |
123
+ | `RR` | Generate Report | Compile all findings → Markdown report in `_prr-output/reviews/` |
124
+ | `PC` | Post Comments | Post inline code comments to GitHub PR via `gh` Reviews API |
125
+ | `PM` | Party Mode 🎉 | All 4 reviewers in one collaborative session |
126
+ | `HH` | Help | Show this guide |
127
+
128
+ ### Selecting a PR (SP step)
129
+
130
+ **With `github_repo` configured** — lists open GitHub PRs:
131
+ ```
132
+ #45 "Add OAuth2 login" feature/oauth → main @alice 3h ago
133
+ #44 "Fix memory leak" fix/memory → main @bob 1d ago
134
+ ```
135
+ Enter PR number → base and head resolved automatically from GitHub.
136
+
137
+ **Without `github_repo`** — asks explicitly for both branches:
138
+ ```
139
+ 🎯 Head branch (the branch to review)?
140
+ • Enter a number from the list (e.g., 1)
141
+ • Type the branch name directly (e.g., feature/my-feature)
142
+
143
+ 🎯 Base branch (what to diff against)?
144
+ • Press Enter for default [main]
145
+ • Type the branch name directly (e.g., develop)
146
+ ```
147
+
148
+ ## Review Agents
149
+
150
+ | Agent | Slash Command | Speciality |
151
+ |-------|--------------|------------|
152
+ | PRR Master | `/prr-master` | Orchestrator — routes all workflows |
153
+ | Alex | `/general-reviewer` | Code quality, logic, naming, DRY |
154
+ | Sam | `/security-reviewer` | OWASP Top 10, secrets, auth |
155
+ | Petra | `/performance-reviewer` | N+1 queries, memory leaks, async |
156
+ | Arch | `/architecture-reviewer` | SOLID, layers, coupling, consistency |
157
+
158
+ Each reviewer agent can also be invoked directly and has its own menu.
159
+
160
+ ## Severity Levels
161
+
162
+ All findings use a standard format:
163
+
164
+ - 🔴 **[BLOCKER]** — Must fix before merge
165
+ - 🟡 **[WARNING]** — Should fix (with explanation)
166
+ - 🟢 **[SUGGESTION]** — Nice-to-have improvement
167
+ - 📌 **[QUESTION]** — Needs clarification from author
168
+
169
+ ## Inline GitHub Comments
170
+
171
+ When `[PC] Post Comments` is run with `github_repo` configured, it uses the GitHub Reviews API to post findings as **inline code comments** on the exact file and line — the same experience as a human reviewer on GitHub.
172
+
173
+ Requires `gh` CLI authenticated: `gh auth login`
174
+
175
+ ## Supported IDEs
176
+
177
+ - **Claude Code** (preferred)
178
+ - **Cursor** (preferred)
179
+ - **Windsurf** (preferred)
180
+ - Cline, Roo, Gemini CLI, Kiro
181
+
182
+ ## Requirements
183
+
184
+ - Node.js 18+
185
+ - Git
186
+ - `gh` CLI — required for `gh pr list`, `gh pr diff`, and posting inline GitHub comments
187
+
188
+ ## Development
189
+
190
+ ```bash
191
+ npm install
192
+ npm test
193
+ ```
194
+
195
+ ## Project Structure
196
+
197
+ ```
198
+ main-project/
199
+ ├── src/
200
+ │ ├── core/ # Master agent, tasks, party-mode workflow
201
+ │ └── prr/
202
+ │ ├── agents/ # 4 specialist reviewer agents
203
+ │ └── workflows/
204
+ │ ├── 0-setup/ # [CP] Collect Project Context
205
+ │ ├── 1-discover/ # [SP] Select PR
206
+ │ ├── 2-analyze/ # [DP] Describe PR
207
+ │ ├── 3-review/ # [GR] [SR] [PR] [AR] Reviews
208
+ │ ├── 4-improve/ # [IC] Improve Code
209
+ │ ├── 5-ask/ # [AK] Ask Code
210
+ │ ├── 6-report/ # [RR] Generate Report, [PC] Post Comments
211
+ │ └── quick/ # [QR] Full pipeline in one command
212
+ ├── tools/
213
+ │ └── cli/ # CLI installer + IDE handlers
214
+ ├── test/ # Schema + component tests
215
+ └── docs/ # Documentation
216
+ ```
217
+
218
+ ---
219
+
220
+ ## Contributing
221
+
222
+ Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on adding workflows, reviewer agents, IDE integrations, and more.
223
+
224
+ ## License
225
+
226
+ [MIT](LICENSE) © mrquangthai278
@@ -0,0 +1,179 @@
1
+ <svg width="1200" height="300" viewBox="0 0 1200 300" xmlns="http://www.w3.org/2000/svg">
2
+ <defs>
3
+ <!-- Background gradient -->
4
+ <linearGradient id="bg" x1="0%" y1="0%" x2="100%" y2="100%">
5
+ <stop offset="0%" style="stop-color:#0d1117"/>
6
+ <stop offset="100%" style="stop-color:#161b22"/>
7
+ </linearGradient>
8
+
9
+ <!-- Accent gradient (purple → blue) -->
10
+ <linearGradient id="accent" x1="0%" y1="0%" x2="100%" y2="0%">
11
+ <stop offset="0%" style="stop-color:#a855f7"/>
12
+ <stop offset="100%" style="stop-color:#3b82f6"/>
13
+ </linearGradient>
14
+
15
+ <!-- Glow filter for accent line -->
16
+ <filter id="glow" x="-20%" y="-200%" width="140%" height="500%">
17
+ <feGaussianBlur stdDeviation="4" result="blur"/>
18
+ <feMerge>
19
+ <feMergeNode in="blur"/>
20
+ <feMergeNode in="SourceGraphic"/>
21
+ </feMerge>
22
+ </filter>
23
+
24
+ <!-- Subtle grid pattern -->
25
+ <pattern id="grid" width="40" height="40" patternUnits="userSpaceOnUse">
26
+ <path d="M 40 0 L 0 0 0 40" fill="none" stroke="#ffffff" stroke-width="0.3" opacity="0.04"/>
27
+ </pattern>
28
+
29
+ <!-- Corner dot pattern -->
30
+ <pattern id="dots" width="20" height="20" patternUnits="userSpaceOnUse">
31
+ <circle cx="1" cy="1" r="1" fill="#ffffff" opacity="0.06"/>
32
+ </pattern>
33
+ </defs>
34
+
35
+ <!-- Background -->
36
+ <rect width="1200" height="300" fill="url(#bg)"/>
37
+
38
+ <!-- Grid overlay -->
39
+ <rect width="1200" height="300" fill="url(#grid)"/>
40
+
41
+ <!-- Dot pattern on right side -->
42
+ <rect x="800" y="0" width="400" height="300" fill="url(#dots)"/>
43
+
44
+ <!-- Decorative circles (blurred, background) -->
45
+ <circle cx="980" cy="80" r="120" fill="#a855f7" opacity="0.06"/>
46
+ <circle cx="1100" cy="220" r="80" fill="#3b82f6" opacity="0.06"/>
47
+ <circle cx="150" cy="240" r="100" fill="#a855f7" opacity="0.04"/>
48
+
49
+ <!-- Top accent line -->
50
+ <rect x="0" y="0" width="1200" height="3" fill="url(#accent)" filter="url(#glow)"/>
51
+
52
+ <!-- Left vertical accent bar -->
53
+ <rect x="64" y="60" width="3" height="180" fill="url(#accent)" opacity="0.8" filter="url(#glow)"/>
54
+
55
+ <!-- Icon area: magnifying glass SVG path -->
56
+ <g transform="translate(100, 110)">
57
+ <circle cx="28" cy="28" r="26" fill="none" stroke="url(#accent)" stroke-width="3" opacity="0.9"/>
58
+ <circle cx="28" cy="28" r="18" fill="none" stroke="url(#accent)" stroke-width="1.5" opacity="0.3"/>
59
+ <line x1="47" y1="47" x2="62" y2="62" stroke="url(#accent)" stroke-width="4" stroke-linecap="round" opacity="0.9"/>
60
+ <!-- Code lines inside glass -->
61
+ <line x1="18" y1="23" x2="38" y2="23" stroke="#a855f7" stroke-width="2" stroke-linecap="round" opacity="0.6"/>
62
+ <line x1="18" y1="30" x2="32" y2="30" stroke="#3b82f6" stroke-width="2" stroke-linecap="round" opacity="0.6"/>
63
+ <line x1="18" y1="37" x2="36" y2="37" stroke="#a855f7" stroke-width="2" stroke-linecap="round" opacity="0.4"/>
64
+ </g>
65
+
66
+ <!-- Main title -->
67
+ <text x="190" y="145" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
68
+ font-size="52" font-weight="700" letter-spacing="-1" fill="#ffffff">
69
+ PR Review Framework
70
+ </text>
71
+
72
+ <!-- Accent underline under title -->
73
+ <rect x="190" y="157" width="420" height="2" fill="url(#accent)" opacity="0.5" rx="1"/>
74
+
75
+ <!-- Subtitle -->
76
+ <text x="192" y="192" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif"
77
+ font-size="20" font-weight="400" fill="#8b949e" letter-spacing="0.3">
78
+ AI-driven Pull Request review — structured, multi-perspective, actionable
79
+ </text>
80
+
81
+ <!-- Badges row -->
82
+ <!-- Badge 1: Claude Code -->
83
+ <g transform="translate(192, 218)">
84
+ <rect width="112" height="26" rx="13" fill="#21262d" stroke="#30363d" stroke-width="1"/>
85
+ <circle cx="18" cy="13" r="5" fill="#a855f7" opacity="0.9"/>
86
+ <text x="30" y="17.5" font-family="monospace" font-size="11" fill="#8b949e">Claude Code</text>
87
+ </g>
88
+
89
+ <!-- Badge 2: Cursor -->
90
+ <g transform="translate(314, 218)">
91
+ <rect width="74" height="26" rx="13" fill="#21262d" stroke="#30363d" stroke-width="1"/>
92
+ <circle cx="18" cy="13" r="5" fill="#3b82f6" opacity="0.9"/>
93
+ <text x="30" y="17.5" font-family="monospace" font-size="11" fill="#8b949e">Cursor</text>
94
+ </g>
95
+
96
+ <!-- Badge 3: Windsurf -->
97
+ <g transform="translate(398, 218)">
98
+ <rect width="86" height="26" rx="13" fill="#21262d" stroke="#30363d" stroke-width="1"/>
99
+ <circle cx="18" cy="13" r="5" fill="#06b6d4" opacity="0.9"/>
100
+ <text x="30" y="17.5" font-family="monospace" font-size="11" fill="#8b949e">Windsurf</text>
101
+ </g>
102
+
103
+ <!-- Badge 4: Node.js -->
104
+ <g transform="translate(494, 218)">
105
+ <rect width="90" height="26" rx="13" fill="#21262d" stroke="#30363d" stroke-width="1"/>
106
+ <circle cx="18" cy="13" r="5" fill="#22c55e" opacity="0.9"/>
107
+ <text x="30" y="17.5" font-family="monospace" font-size="11" fill="#8b949e">Node 18+</text>
108
+ </g>
109
+
110
+ <!-- Right side: review flow diagram -->
111
+ <g transform="translate(820, 55)" opacity="0.85">
112
+ <!-- Flow boxes -->
113
+ <!-- SP -->
114
+ <rect x="0" y="0" width="80" height="30" rx="6" fill="#21262d" stroke="#30363d" stroke-width="1"/>
115
+ <text x="40" y="20" text-anchor="middle" font-family="monospace" font-size="12" fill="#a855f7" font-weight="600">SP</text>
116
+
117
+ <!-- Arrow -->
118
+ <line x1="80" y1="15" x2="110" y2="15" stroke="#30363d" stroke-width="1.5" marker-end="url(#arr)"/>
119
+
120
+ <!-- DP -->
121
+ <rect x="110" y="0" width="80" height="30" rx="6" fill="#21262d" stroke="#30363d" stroke-width="1"/>
122
+ <text x="150" y="20" text-anchor="middle" font-family="monospace" font-size="12" fill="#3b82f6" font-weight="600">DP</text>
123
+
124
+ <!-- Row 2: review types -->
125
+ <!-- Vertical line down from DP -->
126
+ <line x1="150" y1="30" x2="150" y2="55" stroke="#30363d" stroke-width="1.5"/>
127
+ <!-- Horizontal line -->
128
+ <line x1="30" y1="55" x2="270" y2="55" stroke="#30363d" stroke-width="1.5"/>
129
+
130
+ <!-- GR -->
131
+ <line x1="30" y1="55" x2="30" y2="75" stroke="#30363d" stroke-width="1.5"/>
132
+ <rect x="-10" y="75" width="80" height="28" rx="6" fill="#21262d" stroke="#a855f7" stroke-width="1" opacity="0.8"/>
133
+ <text x="30" y="93" text-anchor="middle" font-family="monospace" font-size="11" fill="#a855f7">GR</text>
134
+
135
+ <!-- SR -->
136
+ <line x1="110" y1="55" x2="110" y2="75" stroke="#30363d" stroke-width="1.5"/>
137
+ <rect x="70" y="75" width="80" height="28" rx="6" fill="#21262d" stroke="#ef4444" stroke-width="1" opacity="0.8"/>
138
+ <text x="110" y="93" text-anchor="middle" font-family="monospace" font-size="11" fill="#ef4444">SR</text>
139
+
140
+ <!-- PR -->
141
+ <line x1="190" y1="55" x2="190" y2="75" stroke="#30363d" stroke-width="1.5"/>
142
+ <rect x="150" y="75" width="80" height="28" rx="6" fill="#21262d" stroke="#f59e0b" stroke-width="1" opacity="0.8"/>
143
+ <text x="190" y="93" text-anchor="middle" font-family="monospace" font-size="11" fill="#f59e0b">PR</text>
144
+
145
+ <!-- AR -->
146
+ <line x1="270" y1="55" x2="270" y2="75" stroke="#30363d" stroke-width="1.5"/>
147
+ <rect x="230" y="75" width="80" height="28" rx="6" fill="#21262d" stroke="#06b6d4" stroke-width="1" opacity="0.8"/>
148
+ <text x="270" y="93" text-anchor="middle" font-family="monospace" font-size="11" fill="#06b6d4">AR</text>
149
+
150
+ <!-- Converge line -->
151
+ <line x1="30" y1="103" x2="30" y2="130" stroke="#30363d" stroke-width="1.5"/>
152
+ <line x1="110" y1="103" x2="110" y2="130" stroke="#30363d" stroke-width="1.5"/>
153
+ <line x1="190" y1="103" x2="190" y2="130" stroke="#30363d" stroke-width="1.5"/>
154
+ <line x1="270" y1="103" x2="270" y2="130" stroke="#30363d" stroke-width="1.5"/>
155
+ <line x1="30" y1="130" x2="270" y2="130" stroke="#30363d" stroke-width="1.5"/>
156
+ <line x1="150" y1="130" x2="150" y2="150" stroke="#30363d" stroke-width="1.5"/>
157
+
158
+ <!-- RR -->
159
+ <rect x="110" y="150" width="80" height="30" rx="6" fill="#21262d" stroke="#22c55e" stroke-width="1"/>
160
+ <text x="150" y="170" text-anchor="middle" font-family="monospace" font-size="12" fill="#22c55e" font-weight="600">RR</text>
161
+
162
+ <!-- Arrow to PC -->
163
+ <line x1="190" y1="165" x2="220" y2="165" stroke="#30363d" stroke-width="1.5"/>
164
+
165
+ <!-- PC -->
166
+ <rect x="220" y="150" width="80" height="30" rx="6" fill="#21262d" stroke="#8b949e" stroke-width="1"/>
167
+ <text x="260" y="170" text-anchor="middle" font-family="monospace" font-size="12" fill="#8b949e" font-weight="600">PC</text>
168
+
169
+ <!-- Labels -->
170
+ <text x="40" y="-10" font-family="monospace" font-size="10" fill="#484f58">Select PR</text>
171
+ <text x="115" y="-10" font-family="monospace" font-size="10" fill="#484f58">Describe</text>
172
+ <text x="0" y="118" font-family="monospace" font-size="9" fill="#484f58">Reviews</text>
173
+ <text x="110" y="200" font-family="monospace" font-size="10" fill="#484f58">Report</text>
174
+ <text x="225" y="200" font-family="monospace" font-size="10" fill="#484f58">GitHub</text>
175
+ </g>
176
+
177
+ <!-- Bottom accent line -->
178
+ <rect x="0" y="297" width="1200" height="3" fill="url(#accent)" opacity="0.4"/>
179
+ </svg>
package/package.json ADDED
@@ -0,0 +1,60 @@
1
+ {
2
+ "name": "prr-kit",
3
+ "version": "1.0.0",
4
+ "description": "AI-driven Pull Request Review Framework — structured agent workflows for thorough, consistent code review",
5
+ "main": "tools/cli/prr-cli.js",
6
+ "bin": {
7
+ "prr-kit": "tools/prr-npx-wrapper.js",
8
+ "pr-review": "tools/prr-npx-wrapper.js"
9
+ },
10
+ "scripts": {
11
+ "prr:install": "node tools/cli/prr-cli.js install",
12
+ "prr:uninstall": "node tools/cli/prr-cli.js uninstall",
13
+ "prr:status": "node tools/cli/prr-cli.js status",
14
+ "test": "node test/test-agent-schema.js && node test/test-installation-components.js",
15
+ "test:schemas": "node test/test-agent-schema.js",
16
+ "test:install": "node test/test-installation-components.js",
17
+ "lint": "eslint . --ext .js,.cjs,.mjs --max-warnings=0"
18
+ },
19
+ "engines": {
20
+ "node": ">=20.0.0"
21
+ },
22
+ "files": [
23
+ "src/",
24
+ "tools/",
25
+ "docs/assets/"
26
+ ],
27
+ "keywords": [
28
+ "code-review",
29
+ "pull-request",
30
+ "ai",
31
+ "agent",
32
+ "workflow",
33
+ "claude",
34
+ "cursor",
35
+ "windsurf",
36
+ "github",
37
+ "gitlab"
38
+ ],
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/mrquangthai278/prr-kit.git"
42
+ },
43
+ "homepage": "https://github.com/mrquangthai278/prr-kit#readme",
44
+ "bugs": {
45
+ "url": "https://github.com/mrquangthai278/prr-kit/issues"
46
+ },
47
+ "license": "MIT",
48
+ "dependencies": {
49
+ "@clack/prompts": "^0.10.0",
50
+ "chalk": "^4.1.2",
51
+ "commander": "^14.0.0",
52
+ "csv-parse": "^6.1.0",
53
+ "fs-extra": "^11.3.0",
54
+ "glob": "^11.0.3",
55
+ "yaml": "^2.7.0"
56
+ },
57
+ "devDependencies": {
58
+ "eslint": "^9.0.0"
59
+ }
60
+ }
@@ -0,0 +1,80 @@
1
+ agent:
2
+ metadata:
3
+ id: "_prr/core/agents/prr-master.md"
4
+ name: "PRR Master"
5
+ title: "PR Review Master Orchestrator"
6
+ icon: "🔍"
7
+ capabilities: "PR discovery, review orchestration, report generation, workflow routing, git operations"
8
+ hasSidecar: false
9
+
10
+ persona:
11
+ role: "Master PR Review Orchestrator and Workflow Router"
12
+ identity: "Experienced technical lead with 15+ years in code review. Expert in routing review requests to the right specialist, ensuring no important aspects are missed. Knows when a quick look suffices vs when a deep review is needed."
13
+ communication_style: "Direct and systematic. Always starts by confirming which PR/branch is being reviewed. Guides the team through a structured process. Summarizes what has been reviewed and what remains."
14
+ principles: |
15
+ - ALWAYS fetch latest from remote before any review operation to ensure up-to-date state
16
+ - ALWAYS clarify which PR/branch to review before starting any analysis
17
+ - Suggest the right combination of reviews based on PR type and size
18
+ - For security-sensitive changes: always recommend security review
19
+ - For performance-critical code: always recommend performance review
20
+ - Keep track of which reviews have been completed in the session
21
+
22
+ critical_actions:
23
+ - "Run [CP] Collect Project Context ONCE before the first review of a new project"
24
+ - "Run [SP] Select PR FIRST before any review — never review without knowing the exact branch/diff"
25
+ - "After Select PR, suggest running [DP] Describe PR to understand scope before diving into review"
26
+ - "Track completed reviews and remind user of remaining uncompleted review types"
27
+ - "For PRs touching auth, API keys, or user data: always suggest [SR] Security Review"
28
+
29
+ menu:
30
+ - trigger: "QR or fuzzy match on quick"
31
+ exec: "{project-root}/_prr/prr/workflows/quick/workflow.md"
32
+ description: "[QR] Quick Review: Full pipeline in one command — select branch → describe → all reviews → report"
33
+
34
+ - trigger: "CP or fuzzy match on collect-project-context"
35
+ exec: "{project-root}/_prr/prr/workflows/0-setup/collect-project-context/workflow.md"
36
+ description: "[CP] Collect Project Context: Scan configs, extract rules, ask domain — run once per project"
37
+
38
+ - trigger: "SP or fuzzy match on select-pr"
39
+ exec: "{project-root}/_prr/prr/workflows/1-discover/select-pr/workflow.md"
40
+ description: "[SP] Select PR: git fetch + list branches + select PR to review"
41
+
42
+ - trigger: "DP or fuzzy match on describe-pr"
43
+ exec: "{project-root}/_prr/prr/workflows/2-analyze/describe-pr/workflow.md"
44
+ description: "[DP] Describe PR: Auto-generate PR type, summary, file-by-file walkthrough"
45
+
46
+ - trigger: "GR or fuzzy match on general-review"
47
+ workflow: "{project-root}/_prr/prr/workflows/3-review/general-review/workflow.yaml"
48
+ description: "[GR] General Review: Logic, naming, readability, best practices"
49
+
50
+ - trigger: "SR or fuzzy match on security-review"
51
+ workflow: "{project-root}/_prr/prr/workflows/3-review/security-review/workflow.yaml"
52
+ description: "[SR] Security Review: OWASP top 10, injection, auth, API key exposure"
53
+
54
+ - trigger: "PR or fuzzy match on performance-review"
55
+ workflow: "{project-root}/_prr/prr/workflows/3-review/performance-review/workflow.yaml"
56
+ description: "[PR] Performance Review: N+1 queries, memory leaks, async patterns, bundle size"
57
+
58
+ - trigger: "AR or fuzzy match on architecture-review"
59
+ workflow: "{project-root}/_prr/prr/workflows/3-review/architecture-review/workflow.yaml"
60
+ description: "[AR] Architecture Review: SOLID, layering, coupling, consistency with codebase"
61
+
62
+ - trigger: "IC or fuzzy match on improve-code"
63
+ workflow: "{project-root}/_prr/prr/workflows/4-improve/improve-code/workflow.yaml"
64
+ description: "[IC] Improve Code: Concrete inline code suggestions with before/after fixes"
65
+
66
+ - trigger: "AK or fuzzy match on ask-code"
67
+ exec: "{project-root}/_prr/prr/workflows/5-ask/ask-code/workflow.md"
68
+ description: "[AK] Ask: Interactive Q&A about specific code changes in this PR"
69
+
70
+ - trigger: "RR or fuzzy match on generate-report"
71
+ exec: "{project-root}/_prr/prr/workflows/6-report/generate-report/workflow.md"
72
+ description: "[RR] Generate Report: Compile all findings into a Markdown review report"
73
+
74
+ - trigger: "PC or fuzzy match on post-comments"
75
+ exec: "{project-root}/_prr/prr/workflows/6-report/post-comments/workflow.md"
76
+ description: "[PC] Post Comments: Post inline review comments to GitHub/GitLab/Azure/Bitbucket PR"
77
+
78
+ - trigger: "HH or fuzzy match on help"
79
+ exec: "{project-root}/_prr/core/tasks/help.md"
80
+ description: "[HH] Help: Show review workflow guide and available commands"
@@ -0,0 +1,19 @@
1
+ code: core
2
+ name: "PR Review Core Module"
3
+ header: "PR Review Core Configuration"
4
+ subheader: "Configure the core settings for your PR Review installation.\nThese settings will be used across all modules and agents."
5
+
6
+ user_name:
7
+ prompt: "What should reviewers call you? (Use your name or a team name)"
8
+ default: "Reviewer"
9
+ result: "{value}"
10
+
11
+ communication_language:
12
+ prompt: "What language should agents use when chatting with you?"
13
+ default: "English"
14
+ result: "{value}"
15
+
16
+ output_folder:
17
+ prompt: "Where should output files be saved?"
18
+ default: "_prr-output"
19
+ result: "{project-root}/{value}"
@@ -0,0 +1,37 @@
1
+ # PR Review Help
2
+
3
+ ## What to do next
4
+
5
+ Use `/prr-help` anytime for guidance on what to do.
6
+
7
+ ### Typical Review Flow
8
+
9
+ **First time on a new project (run once):**
10
+ 0. **[CP] Collect Project Context** — Scan configs, extract coding rules, capture domain knowledge
11
+
12
+ **Per PR — Quick mode (1 command):**
13
+ - **[QR] Quick Review** — Full pipeline: select branch → describe → all 4 reviews → report → optional GitHub post
14
+
15
+ **Per PR — Manual mode (step by step):**
16
+ 1. **[SP] Select PR** — Fetch latest, list branches, choose what to review
17
+ 2. **[DP] Describe PR** — Auto-generate PR type, summary, file-by-file walkthrough
18
+ 3. **[GR/SR/PR/AR] Review** — Run one or more specialized reviews
19
+ 4. **[IC] Improve Code** — Get concrete code suggestions with inline fixes
20
+ 5. **[AK] Ask** — Ask specific questions about the code changes
21
+ 6. **[RR] Generate Report** — Compile all findings into a Markdown report
22
+ 7. **[PC] Post Comments** — Post inline review comments to GitHub / GitLab / Azure DevOps / Bitbucket
23
+
24
+ ### Available Reviewer Agents
25
+
26
+ - **PRR Master** 🔍 — Orchestrator, routes to all workflows
27
+ - **General Reviewer** 👁️ — Logic, naming, readability, best practices
28
+ - **Security Reviewer** 🔒 — OWASP, injection, auth, API key exposure
29
+ - **Performance Reviewer** ⚡ — N+1 queries, memory leaks, async patterns
30
+ - **Architecture Reviewer** 🏗️ — SOLID, layering, coupling, consistency
31
+
32
+ ### Finding Severity Levels
33
+
34
+ - 🔴 **[BLOCKER]** — Must fix before merge
35
+ - 🟡 **[WARNING]** — Should fix, with explanation
36
+ - 🟢 **[SUGGESTION]** — Nice-to-have improvement
37
+ - 📌 **[QUESTION]** — Needs clarification from author
@@ -0,0 +1,22 @@
1
+ <workflow-engine>
2
+ <rules>
3
+ <rule>NEVER load multiple step files simultaneously — one at a time only</rule>
4
+ <rule>ALWAYS read entire step/workflow file before taking any action</rule>
5
+ <rule>NEVER skip steps or optimize the sequence</rule>
6
+ <rule>ALWAYS update frontmatter state when writing output</rule>
7
+ <rule>ALWAYS halt at decision points and wait for user input</rule>
8
+ <rule>ALWAYS load config variables before starting any workflow</rule>
9
+ </rules>
10
+
11
+ <variable-resolution>
12
+ <pattern>{config_source}:variable_name</pattern>
13
+ <action>Read the YAML file at config_source path, extract the named key value</action>
14
+ </variable-resolution>
15
+
16
+ <step-file-protocol>
17
+ <load>Read the complete step file</load>
18
+ <execute>Follow ALL numbered sections in order</execute>
19
+ <state>Update frontmatter stepsCompleted array</state>
20
+ <next>Load next step file only when explicitly directed</next>
21
+ </step-file-protocol>
22
+ </workflow-engine>