prr-kit 2.0.9 → 2.0.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prr-kit",
3
- "version": "2.0.9",
3
+ "version": "2.0.11",
4
4
  "description": "AI-driven Pull Request Review Kit — structured agent workflows for thorough, consistent code review",
5
5
  "main": "tools/cli/prr-cli.js",
6
6
  "bin": {
@@ -7,6 +7,7 @@
7
7
  <rule>ALWAYS halt at decision points and wait for user input</rule>
8
8
  <rule>ALWAYS load config variables before starting any workflow</rule>
9
9
  <rule>Use native file-reading tools for file content — avoid shell commands for reading files</rule>
10
+ <rule>For runtime code execution (file parsing, JSON building, temp file operations), use Node.js — do not assume Python is available</rule>
10
11
  </rules>
11
12
 
12
13
  <variable-resolution>
@@ -149,22 +149,14 @@ Bash heredoc breaks with Unicode characters, emojis, backticks, and nested quote
149
149
  2. **Execute** it with `node`
150
150
  3. Script writes the final JSON to `{temp_dir}/prr-payload.json`
151
151
 
152
- **Step A — Detect available runtime:**
153
- ```bash
154
- node --version 2>/dev/null && echo "use-node" || (python3 --version 2>/dev/null && echo "use-python3") || echo "no-runtime"
155
- ```
156
- Prefer `node`. Fallback: `python3`, then `python`.
152
+ **Step A — Write the build script using the Write tool** (NOT echo/heredoc/Bash):
157
153
 
158
- **Step B — Write the build script using the Write tool** (NOT echo/heredoc/Bash):
159
-
160
- Use the Write tool to create `{temp_dir}/build-payload.mjs` (Node.js) or `{temp_dir}/build-payload.py` (Python).
154
+ Use the Write tool to create `{temp_dir}/build-payload.mjs`.
161
155
 
162
156
  The script must:
163
- - Define all string values (comment bodies, summary) as native string variables — no manual JSON escaping needed, the runtime handles it
157
+ - Define all string values (comment bodies, summary) as native string variables — no manual JSON escaping needed, Node.js handles it
164
158
  - Build the payload object in memory
165
- - Write to `{temp_dir}/prr-payload.json` using native JSON serialization:
166
- - Node.js: `JSON.stringify(payload, null, 2)`
167
- - Python: `json.dumps(payload, ensure_ascii=False, indent=2)`
159
+ - Write to `{temp_dir}/prr-payload.json` using `JSON.stringify(payload, null, 2)`
168
160
 
169
161
  **Node.js template** (`build-payload.mjs`):
170
162
  ```js
@@ -184,36 +176,14 @@ writeFileSync("{temp_dir}/prr-payload.json", JSON.stringify(payload, null, 2), "
184
176
  console.log(`OK: ${payload.comments.length} comments`)
185
177
  ```
186
178
 
187
- **Python template** (`build-payload.py`):
188
- ```python
189
- import json
190
-
191
- payload = {
192
- "commit_id": "COMMIT_SHA",
193
- "body": "SUMMARY BODY",
194
- "event": "REQUEST_CHANGES",
195
- "comments": [
196
- {"path": "src/file.js", "line": 42, "side": "RIGHT", "body": "🔴 **[BLOCKER]** ..."},
197
- ]
198
- }
199
-
200
- with open("{temp_dir}/prr-payload.json", "w", encoding="utf-8") as f:
201
- json.dump(payload, f, ensure_ascii=False, indent=2)
202
- print(f"OK: {len(payload['comments'])} comments")
203
- ```
204
-
205
- **Step C — Execute:**
179
+ **Step B — Execute:**
206
180
  ```bash
207
181
  node "{temp_dir}/build-payload.mjs"
208
- # or: python3 "{temp_dir}/build-payload.py"
209
182
  ```
210
183
 
211
- **Step D — Verify output (optional sanity check):**
184
+ **Step C — Verify output (optional sanity check):**
212
185
  ```bash
213
- # Node.js
214
186
  node -e "const p=require('{temp_dir}/prr-payload.json'); console.log('OK:', p.comments.length, 'comments')"
215
- # Python
216
- python3 -c "import json; p=json.load(open('{temp_dir}/prr-payload.json')); print('OK:', len(p['comments']), 'comments')"
217
187
  ```
218
188
 
219
189
  ---
@@ -27,14 +27,9 @@ description: "Post comments via platform CLI/API, verify, clean up"
27
27
  **Case A — Self-review** (`"Review Can not request changes on your own pull request"`):
28
28
  - The authenticated user is the PR author. GitHub disallows `REQUEST_CHANGES` on own PRs.
29
29
  - Fix: Update `event` in the payload from `"REQUEST_CHANGES"` to `"COMMENT"` and retry once.
30
- - Use whichever runtime is available (`{detected_runtime}` from step A earlier):
31
30
 
32
31
  ```bash
33
- # Node.js
34
32
  node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('{temp_dir}/prr-payload.json','utf-8')); p.event='COMMENT'; fs.writeFileSync('{temp_dir}/prr-payload.json',JSON.stringify(p,null,2)); console.log('event → COMMENT')"
35
-
36
- # Python3
37
- python3 -c "import json; f=open('{temp_dir}/prr-payload.json','r+'); p=json.load(f); p['event']='COMMENT'; f.seek(0); json.dump(p,f,ensure_ascii=False,indent=2); f.truncate(); print('event → COMMENT')"
38
33
  ```
39
34
  Then retry the POST above.
40
35
 
@@ -79,7 +74,7 @@ done
79
74
 
80
75
  Use the runtime script approach to build the summary payload first:
81
76
 
82
- Write `{temp_dir}/build-bb-summary.mjs` (or `.py`) using the Write tool:
77
+ Write `{temp_dir}/build-bb-summary.mjs` using the Write tool:
83
78
 
84
79
  ```js
85
80
  // Node.js
@@ -167,9 +162,7 @@ rm -f "{temp_dir}/prr-payload.json" \
167
162
  "{temp_dir}/prr-bb-"*.json \
168
163
  "{temp_dir}/prr-bb-summary.json" \
169
164
  "{temp_dir}/build-payload.mjs" \
170
- "{temp_dir}/build-payload.py" \
171
- "{temp_dir}/build-bb-summary.mjs" \
172
- "{temp_dir}/build-bb-summary.py"
165
+ "{temp_dir}/build-bb-summary.mjs"
173
166
  rmdir "{temp_dir}" 2>/dev/null || true
174
167
  ```
175
168
 
@@ -327,14 +327,15 @@ On completion, store `pr_knowledge_base` = path to the generated context file.
327
327
 
328
328
  ## PHASE 3 — REVIEW
329
329
 
330
- **Context:** Confirm `target_branch`, `base_branch`, `session_output`, `pr_knowledge_base`, `communication_language` are in working context from earlier phases. Set `output_file` per review as defined below.
330
+ **Context:** Confirm `target_branch`, `base_branch`, `session_output`, `pr_knowledge_base`, `communication_language` are in working context from earlier phases.
331
331
 
332
332
  **Review orchestration:** Read `user_instructions` from `{pr_knowledge_base}`. Use judgment to decide which review skills (3a–3e) to run, in what order, and with what focus — based on the user's actual intent, the PR type, and the project context.
333
333
  - No user instructions provided → run all reviews in default order.
334
334
  - User specified scope, focus, or constraints → adapt accordingly: skip irrelevant reviews, reorder, or narrow focus to serve the user's actual need. Reviews are optional skills — invoke only what genuinely serves the request.
335
- - For each skipped review: print `⏭️ {Review Name} skipped` and do not write its output file.
335
+ - **For each skipped review: print `⏭️ {Review Name} skipped` then move on. Do NOT set `output_file`. Do NOT load the instructions file. Do NOT create any file. Execute nothing else for that review.**
336
336
 
337
337
  ### 3a. General Review
338
+ *Skip entirely if not in scope — print `⏭️ General Review skipped` and stop here for this review.*
338
339
  Set `output_file` = `{session_output}/general-review.md`
339
340
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/general-review/instructions.xml`
340
341
 
@@ -342,6 +343,7 @@ Collect findings as `{general_findings}`.
342
343
  Print section header: `## 👁️ General Review`
343
344
 
344
345
  ### 3b. Security Review
346
+ *Skip entirely if not in scope — print `⏭️ Security Review skipped` and stop here for this review.*
345
347
  Set `output_file` = `{session_output}/security-review.md`
346
348
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/security-review/instructions.xml`
347
349
 
@@ -349,6 +351,7 @@ Collect findings as `{security_findings}`.
349
351
  Print section header: `## 🔒 Security Review`
350
352
 
351
353
  ### 3c. Performance Review
354
+ *Skip entirely if not in scope — print `⏭️ Performance Review skipped` and stop here for this review.*
352
355
  Set `output_file` = `{session_output}/performance-review.md`
353
356
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/performance-review/instructions.xml`
354
357
 
@@ -356,6 +359,7 @@ Collect findings as `{performance_findings}`.
356
359
  Print section header: `## ⚡ Performance Review`
357
360
 
358
361
  ### 3d. Architecture Review
362
+ *Skip entirely if not in scope — print `⏭️ Architecture Review skipped` and stop here for this review.*
359
363
  Set `output_file` = `{session_output}/architecture-review.md`
360
364
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/architecture-review/instructions.xml`
361
365
 
@@ -363,6 +367,7 @@ Collect findings as `{architecture_findings}`.
363
367
  Print section header: `## 🏗️ Architecture Review`
364
368
 
365
369
  ### 3e. Business Review
370
+ *Skip entirely if not in scope — print `⏭️ Business Review skipped` and stop here for this review.*
366
371
  Set `output_file` = `{session_output}/business-review.md`
367
372
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/business-review/instructions.xml`
368
373