prr-kit 1.2.3 → 1.4.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 (45) hide show
  1. package/README.md +200 -24
  2. package/package.json +1 -1
  3. package/src/core/agents/prr-master.agent.yaml +10 -6
  4. package/src/core/tasks/clear.md +36 -71
  5. package/src/core/tasks/help.md +7 -6
  6. package/src/core/tasks/select-session.md +94 -0
  7. package/src/core/workflows/party-mode/steps/step-00-user-instructions.md +125 -0
  8. package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +27 -19
  9. package/src/core/workflows/party-mode/steps/step-02-discussion.md +13 -11
  10. package/src/core/workflows/party-mode/workflow.md +7 -7
  11. package/src/prr/agents/architecture-reviewer.agent.yaml +2 -2
  12. package/src/prr/agents/business-reviewer.agent.yaml +2 -2
  13. package/src/prr/agents/general-reviewer.agent.yaml +2 -2
  14. package/src/prr/agents/performance-reviewer.agent.yaml +2 -2
  15. package/src/prr/agents/security-reviewer.agent.yaml +2 -2
  16. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +96 -25
  17. package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
  18. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-02-collect-sources.md +2 -1
  19. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md +102 -0
  20. package/src/prr/workflows/2-analyze/collect-pr-context/steps/{step-03-build-knowledge-base.md → step-04-build-knowledge-base.md} +32 -22
  21. package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +5 -6
  22. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +3 -3
  23. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +6 -7
  24. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +2 -2
  25. package/src/prr/workflows/3-review/architecture-review/checklist.md +1 -2
  26. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +4 -3
  27. package/src/prr/workflows/3-review/business-review/checklist.md +1 -2
  28. package/src/prr/workflows/3-review/business-review/instructions.xml +2 -0
  29. package/src/prr/workflows/3-review/business-review/workflow.yaml +4 -3
  30. package/src/prr/workflows/3-review/general-review/checklist.md +1 -2
  31. package/src/prr/workflows/3-review/general-review/instructions.xml +7 -0
  32. package/src/prr/workflows/3-review/general-review/workflow.yaml +4 -3
  33. package/src/prr/workflows/3-review/performance-review/checklist.md +1 -2
  34. package/src/prr/workflows/3-review/performance-review/workflow.yaml +4 -3
  35. package/src/prr/workflows/3-review/security-review/checklist.md +1 -2
  36. package/src/prr/workflows/3-review/security-review/workflow.yaml +4 -3
  37. package/src/prr/workflows/4-improve/improve-code/checklist.md +1 -2
  38. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +3 -2
  39. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +2 -2
  40. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +13 -9
  41. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +2 -2
  42. package/src/prr/workflows/6-report/generate-report/workflow.md +2 -1
  43. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +4 -5
  44. package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
  45. package/src/prr/workflows/quick/workflow.md +86 -28
@@ -152,26 +152,78 @@ git -C {target_repo} diff {base_branch}...{target_branch}
152
152
  ```
153
153
  Store diff in memory. Count files changed, lines added/removed.
154
154
 
155
- ### 1e. Save PR context
156
- Write `{review_output}/current-pr-context.yaml`:
157
- ```yaml
158
- pr:
159
- target_branch: "{target_branch}"
160
- base_branch: "{base_branch}"
161
- pr_number: "{pr_number}"
162
- pr_title: "{pr_title}"
163
- platform: "{active_platform}"
164
- platform_repo: "{platform_repo}"
165
- date: "{date}"
166
- review:
167
- completed: []
168
- findings: []
155
+ ### 1e. Create Session Folder
156
+
157
+ Compute the session output folder:
158
+
169
159
  ```
160
+ sanitized_branch = target_branch
161
+ .toLowerCase()
162
+ .replace(/[^a-z0-9]+/g, '-')
163
+ .replace(/^-+|-+$/g, '')
164
+ .substring(0, 40)
165
+
166
+ if pr_number is set:
167
+ session_slug = "pr{pr_number}-{sanitized_branch}"
168
+ else:
169
+ session_slug = "{sanitized_branch}"
170
+
171
+ datetime_prefix = current datetime as "YYYY-MM-DD-HHmm" (e.g. 2026-03-02-1430)
172
+
173
+ session_output = "{review_output}/{datetime_prefix}-{session_slug}"
174
+ ```
175
+
176
+ Examples:
177
+ - `_prr-output/reviews/2026-03-02-1430-pr44-feature-auth-login`
178
+ - `_prr-output/reviews/2026-03-02-1430-feature-auth-login`
170
179
 
171
- Show summary:
180
+ Create folder:
181
+ ```bash
182
+ mkdir -p "{session_output}"
183
+ ```
184
+
185
+ **Store in working context:** `session_output`, `target_branch`, `base_branch`, `pr_number`, `pr_title`, `active_platform`, `platform_repo`.
186
+
187
+ ### 1f. Generate Diffs Folder
188
+
189
+ Parse the diff loaded in 1d and write per-file markdown files under `{session_output}/diffs/`, mirroring the repo folder tree.
190
+
191
+ **For each changed file in the diff:**
192
+
193
+ 1. Determine file path, status, and line counts from the diff header.
194
+ 2. Construct output path: `{session_output}/diffs/{file_path}.md`
195
+ 3. Create parent directories:
196
+ ```bash
197
+ mkdir -p "{session_output}/diffs/{file_dir}"
198
+ ```
199
+ 4. Write the markdown file:
200
+
201
+ ```markdown
202
+ # {file_path}
203
+ **Status:** {modified|added|deleted|renamed} | **+{lines_added} / -{lines_removed} lines**
204
+ ---
205
+
206
+ **Line {start_line}** *(or **Lines {start}–{end}** for multi-line hunks)*
207
+ ```diff
208
+ - old line content
209
+ + new line content
210
+ ```
211
+
212
+ *(repeat for each hunk in this file)*
213
+ ```
214
+
215
+ **Rules:**
216
+ - **New file:** show all lines as `+` additions under a single hunk block.
217
+ - **Deleted file:** show all lines as `-` deletions under a single hunk block.
218
+ - **Renamed file with no content change:** write status line only, no diff blocks.
219
+ - **Renamed file with changes:** write status `renamed` and include change hunks as normal.
220
+ - One `.md` file per changed file. Folder structure mirrors the repo exactly.
221
+
222
+ After writing all files, show summary:
172
223
  ```
173
224
  ✓ PR selected: {target_branch}
174
225
  Files changed: X | +Y / -Z lines
226
+ ✓ Diffs saved: {file_count} files → {session_output}/diffs/
175
227
  ```
176
228
 
177
229
  ---
@@ -202,12 +254,12 @@ Print to screen:
202
254
  ---
203
255
 
204
256
  ## PHASE 2.5 — COLLECT PR-SPECIFIC CONTEXT
205
- *Execute automatically, no user input.*
257
+ *Execute automatically. Pauses once to ask the user for additional context — user must respond before continuing.*
206
258
 
207
259
  Execute the collect-pr-context workflow in full:
208
260
  `{project-root}/_prr/prr/workflows/2-analyze/collect-pr-context/workflow.md`
209
261
 
210
- This workflow analyzes changed files, detects technology stacks, collects relevant context from all sources (primary docs, config files, standards docs, inline annotations, stack-specific rules, external MCP/RAG tools), and builds a structured PR-specific knowledge base at `{review_output}/pr-{pr_number}-context.yaml`.
262
+ This workflow analyzes changed files, detects technology stacks, collects relevant context from all sources (primary docs, config files, standards docs, inline annotations, stack-specific rules, external MCP/RAG tools), asks the user for any additional context (marked ⚠️ IMPORTANT if provided), and builds a structured PR-specific knowledge base at `{session_output}/pr-context.yaml`.
211
263
 
212
264
  On completion, store `pr_knowledge_base` = path to the generated context file.
213
265
 
@@ -217,7 +269,7 @@ On completion, store `pr_knowledge_base` = path to the generated context file.
217
269
  *Execute all review types automatically, one by one.*
218
270
 
219
271
  **Before each review, set these variables so the review instructions resolve correctly:**
220
- - `pr_context` = `{review_output}/current-pr-context.yaml`
272
+ - `pr_context` = working context (`target_branch`, `base_branch`, `pr_number`, `pr_knowledge_base`)
221
273
  - `target_branch` = `pr_context.pr.target_branch`
222
274
  - `base_branch` = `pr_context.pr.base_branch`
223
275
  - `pr_number` = `pr_context.pr.pr_number`
@@ -225,36 +277,44 @@ On completion, store `pr_knowledge_base` = path to the generated context file.
225
277
  - `target_repo`, `communication_language` = from config
226
278
  - `output_file` = per-review path defined below *(ensures findings are saved to disk for [RR] and [PC] later)*
227
279
 
280
+ **Scope gate:** Read `user_instructions.review_scope` from `{pr_knowledge_base}`.
281
+ - If `"all"` (or knowledge base missing) → run all reviews 3a–3e normally.
282
+ - If a list (e.g. `[SR, AR]`) → only run reviews whose code is in the list. For each skipped review, print:
283
+ `⏭️ {Review Name} skipped (not in scope)`
284
+ and do NOT write its output file.
285
+
286
+ Review codes: `GR` = General · `SR` = Security · `PR` = Performance · `AR` = Architecture · `BR` = Business
287
+
228
288
  ### 3a. General Review
229
- Set `output_file` = `{review_output}/general-review-{date}.md`
289
+ Set `output_file` = `{session_output}/general-review.md`
230
290
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/general-review/instructions.xml`
231
291
 
232
292
  Collect findings as `{general_findings}`.
233
293
  Print section header: `## 👁️ General Review`
234
294
 
235
295
  ### 3b. Security Review
236
- Set `output_file` = `{review_output}/security-review-{date}.md`
296
+ Set `output_file` = `{session_output}/security-review.md`
237
297
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/security-review/instructions.xml`
238
298
 
239
299
  Collect findings as `{security_findings}`.
240
300
  Print section header: `## 🔒 Security Review`
241
301
 
242
302
  ### 3c. Performance Review
243
- Set `output_file` = `{review_output}/performance-review-{date}.md`
303
+ Set `output_file` = `{session_output}/performance-review.md`
244
304
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/performance-review/instructions.xml`
245
305
 
246
306
  Collect findings as `{performance_findings}`.
247
307
  Print section header: `## ⚡ Performance Review`
248
308
 
249
309
  ### 3d. Architecture Review
250
- Set `output_file` = `{review_output}/architecture-review-{date}.md`
310
+ Set `output_file` = `{session_output}/architecture-review.md`
251
311
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/architecture-review/instructions.xml`
252
312
 
253
313
  Collect findings as `{architecture_findings}`.
254
314
  Print section header: `## 🏗️ Architecture Review`
255
315
 
256
316
  ### 3e. Business Review
257
- Set `output_file` = `{review_output}/business-review-{date}.md`
317
+ Set `output_file` = `{session_output}/business-review.md`
258
318
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/business-review/instructions.xml`
259
319
 
260
320
  Collect findings as `{business_findings}`.
@@ -276,10 +336,7 @@ Count totals:
276
336
  - `{warning_count}` = number of 🟡 findings
277
337
  - `{suggestion_count}` = number of 🟢 findings
278
338
 
279
- Generate report filename: `review-{target_branch_slug}-{date}.md`
280
- where `{target_branch_slug}` = branch name with `/` replaced by `-`.
281
-
282
- Write report to: `{review_output}/review-{target_branch_slug}-{date}.md`
339
+ Write report to: `{session_output}/final-review.md`
283
340
 
284
341
  Report format:
285
342
  ```markdown
@@ -328,7 +385,8 @@ Print completion summary:
328
385
  ✅ Quick Review Complete
329
386
 
330
387
  Branch: {target_branch}
331
- Report: {review_output}/review-{target_branch_slug}-{date}.md
388
+ Session: {session_output}/
389
+ Report: {session_output}/final-review.md
332
390
 
333
391
  🔴 Blockers: {blocker_count}
334
392
  🟡 Warnings: {warning_count}