prr-kit 1.3.0 → 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 (38) hide show
  1. package/README.md +137 -11
  2. package/package.json +1 -1
  3. package/src/core/agents/prr-master.agent.yaml +5 -1
  4. package/src/core/tasks/clear.md +36 -71
  5. package/src/core/tasks/help.md +2 -1
  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 +22 -14
  9. package/src/core/workflows/party-mode/steps/step-02-discussion.md +8 -6
  10. package/src/core/workflows/party-mode/workflow.md +7 -7
  11. package/src/prr/config-template.yaml +0 -3
  12. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +96 -25
  13. package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
  14. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md +64 -50
  15. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-04-build-knowledge-base.md +24 -30
  16. package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +3 -5
  17. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +3 -3
  18. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +6 -7
  19. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +2 -2
  20. package/src/prr/workflows/3-review/architecture-review/checklist.md +1 -2
  21. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +3 -2
  22. package/src/prr/workflows/3-review/business-review/checklist.md +1 -2
  23. package/src/prr/workflows/3-review/business-review/workflow.yaml +3 -2
  24. package/src/prr/workflows/3-review/general-review/checklist.md +1 -2
  25. package/src/prr/workflows/3-review/general-review/workflow.yaml +3 -2
  26. package/src/prr/workflows/3-review/performance-review/checklist.md +1 -2
  27. package/src/prr/workflows/3-review/performance-review/workflow.yaml +3 -2
  28. package/src/prr/workflows/3-review/security-review/checklist.md +1 -2
  29. package/src/prr/workflows/3-review/security-review/workflow.yaml +3 -2
  30. package/src/prr/workflows/4-improve/improve-code/checklist.md +1 -2
  31. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +3 -2
  32. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +2 -2
  33. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +13 -9
  34. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +2 -2
  35. package/src/prr/workflows/6-report/generate-report/workflow.md +2 -1
  36. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +4 -5
  37. package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
  38. package/src/prr/workflows/quick/workflow.md +86 -28
@@ -7,11 +7,12 @@ user_name: "{config_source}:user_name"
7
7
  communication_language: "{config_source}:communication_language"
8
8
  target_repo: "{config_source}:target_repo"
9
9
  review_output: "{config_source}:review_output"
10
+ session_output: "working-context:session_output || latest-session-folder-in:{review_output}"
10
11
  date: system-generated
11
12
 
12
13
  installed_path: "{project-root}/_prr/prr/workflows/3-review/business-review"
13
14
  instructions: "{installed_path}/instructions.xml"
14
15
  validation: "{installed_path}/checklist.md"
15
16
 
16
- pr_context: "{review_output}/current-pr-context.yaml"
17
- output_file: "{review_output}/business-review-{date}.md"
17
+ pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
18
+ output_file: "{session_output}/business-review.md"
@@ -22,6 +22,5 @@ validation-target: "General review output file"
22
22
  - [ ] Side effect findings include: the affected location OUTSIDE the diff (not just the changed file)
23
23
 
24
24
  ## Output
25
- - [ ] Findings written to `{review_output}/general-review-{date}.md`
26
- - [ ] PR context updated with `general-review` in completed list
25
+ - [ ] Findings written to `{session_output}/general-review.md`
27
26
  - [ ] At least one positive observation included (balanced review)
@@ -7,11 +7,12 @@ user_name: "{config_source}:user_name"
7
7
  communication_language: "{config_source}:communication_language"
8
8
  target_repo: "{config_source}:target_repo"
9
9
  review_output: "{config_source}:review_output"
10
+ session_output: "working-context:session_output || latest-session-folder-in:{review_output}"
10
11
  date: system-generated
11
12
 
12
13
  installed_path: "{project-root}/_prr/prr/workflows/3-review/general-review"
13
14
  instructions: "{installed_path}/instructions.xml"
14
15
  validation: "{installed_path}/checklist.md"
15
16
 
16
- pr_context: "{review_output}/current-pr-context.yaml"
17
- output_file: "{review_output}/general-review-{date}.md"
17
+ pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
18
+ output_file: "{session_output}/general-review.md"
@@ -20,5 +20,4 @@ validation-target: "Performance review output file"
20
20
  - [ ] ❓ QUESTION findings include: specific concern + context needed to assess severity (e.g., "Is this in a hot path?", "What is the expected data volume?")
21
21
 
22
22
  ## Output
23
- - [ ] Findings written to `{review_output}/performance-review-{date}.md`
24
- - [ ] PR context updated with `performance-review` in completed list
23
+ - [ ] Findings written to `{session_output}/performance-review.md`
@@ -7,11 +7,12 @@ user_name: "{config_source}:user_name"
7
7
  communication_language: "{config_source}:communication_language"
8
8
  target_repo: "{config_source}:target_repo"
9
9
  review_output: "{config_source}:review_output"
10
+ session_output: "working-context:session_output || latest-session-folder-in:{review_output}"
10
11
  date: system-generated
11
12
 
12
13
  installed_path: "{project-root}/_prr/prr/workflows/3-review/performance-review"
13
14
  instructions: "{installed_path}/instructions.xml"
14
15
  validation: "{installed_path}/checklist.md"
15
16
 
16
- pr_context: "{review_output}/current-pr-context.yaml"
17
- output_file: "{review_output}/performance-review-{date}.md"
17
+ pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
18
+ output_file: "{session_output}/performance-review.md"
@@ -22,5 +22,4 @@ validation-target: "Security review output file"
22
22
  - [ ] ❓ QUESTION findings include: specific concern + exact question to ask author (e.g., "Was this auth check intentionally removed?")
23
23
 
24
24
  ## Output
25
- - [ ] Findings written to `{review_output}/security-review-{date}.md`
26
- - [ ] PR context updated with `security-review` in completed list
25
+ - [ ] Findings written to `{session_output}/security-review.md`
@@ -7,6 +7,7 @@ user_name: "{config_source}:user_name"
7
7
  communication_language: "{config_source}:communication_language"
8
8
  target_repo: "{config_source}:target_repo"
9
9
  review_output: "{config_source}:review_output"
10
+ session_output: "working-context:session_output || latest-session-folder-in:{review_output}"
10
11
  date: system-generated
11
12
 
12
13
  installed_path: "{project-root}/_prr/prr/workflows/3-review/security-review"
@@ -14,5 +15,5 @@ instructions: "{installed_path}/instructions.xml"
14
15
  validation: "{installed_path}/checklist.md"
15
16
  owasp_data: "{installed_path}/data/owasp-checklist.csv"
16
17
 
17
- pr_context: "{review_output}/current-pr-context.yaml"
18
- output_file: "{review_output}/security-review-{date}.md"
18
+ pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
19
+ output_file: "{session_output}/security-review.md"
@@ -13,6 +13,5 @@ validation-target: "Improve code output file"
13
13
  - [ ] Suggestions are correct — the AFTER code actually works
14
14
 
15
15
  ## Output
16
- - [ ] All suggestions written to `{review_output}/improve-code-{date}.md`
16
+ - [ ] All suggestions written to `{session_output}/improve-code.md`
17
17
  - [ ] Suggestions grouped by category (Bugs | Quality | Performance | Best Practices)
18
- - [ ] PR context updated with `improve-code` in completed list
@@ -7,11 +7,12 @@ user_name: "{config_source}:user_name"
7
7
  communication_language: "{config_source}:communication_language"
8
8
  target_repo: "{config_source}:target_repo"
9
9
  review_output: "{config_source}:review_output"
10
+ session_output: "working-context:session_output || latest-session-folder-in:{review_output}"
10
11
  date: system-generated
11
12
 
12
13
  installed_path: "{project-root}/_prr/prr/workflows/4-improve/improve-code"
13
14
  instructions: "{installed_path}/instructions.xml"
14
15
  validation: "{installed_path}/checklist.md"
15
16
 
16
- pr_context: "{review_output}/current-pr-context.yaml"
17
- output_file: "{review_output}/improve-code-{date}.md"
17
+ pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
18
+ output_file: "{session_output}/improve-code.md"
@@ -10,9 +10,9 @@ nextStepFile: "./step-02-answer.md"
10
10
 
11
11
  ### 1. Load PR Context
12
12
 
13
- Read `{review_output}/current-pr-context.yaml`.
13
+ Use `session_output`, `target_branch`, `base_branch` from working context.
14
14
 
15
- If not found, prompt user to run [SP] Select PR first.
15
+ If not set, prompt user to run [SS] Select Session or [SP] Select PR first.
16
16
 
17
17
  ### 2. Load the Diff
18
18
 
@@ -8,19 +8,23 @@ nextStepFile: "./step-02-organize.md"
8
8
 
9
9
  ## Sequence of Instructions
10
10
 
11
- ### 1. Load PR Context
11
+ ### 1. Detect Completed Reviews
12
12
 
13
- Read `{review_output}/current-pr-context.yaml` to get list of completed reviews.
13
+ Check which review files exist in `{session_output}/`:
14
+
15
+ ```bash
16
+ ls "{session_output}/"
17
+ ```
14
18
 
15
19
  ### 2. Collect Review Output Files
16
20
 
17
- For each completed review in `review.completed` list, read the corresponding output file:
18
- - `general-review` → `{review_output}/general-review-*.md` (latest)
19
- - `security-review` → `{review_output}/security-review-*.md` (latest)
20
- - `performance-review` → `{review_output}/performance-review-*.md` (latest)
21
- - `architecture-review` → `{review_output}/architecture-review-*.md` (latest)
22
- - `business-review` → `{review_output}/business-review-*.md` (latest)
23
- - `improve-code` → `{review_output}/improve-code-*.md` (latest)
21
+ For each review file that exists, read it:
22
+ - `general-review` → `{session_output}/general-review.md`
23
+ - `security-review` → `{session_output}/security-review.md`
24
+ - `performance-review` → `{session_output}/performance-review.md`
25
+ - `architecture-review` → `{session_output}/architecture-review.md`
26
+ - `business-review` → `{session_output}/business-review.md`
27
+ - `improve-code` → `{session_output}/improve-code.md`
24
28
 
25
29
  ### 3. Parse All Findings
26
30
 
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "step-03-write"
3
3
  description: "Write the final review report to file"
4
- outputFile: "{review_output}/review-{target_branch_slug}-{date}.md"
4
+ outputFile: "{session_output}/final-review.md"
5
5
  templateFile: "../templates/review-report.template.md"
6
6
  ---
7
7
 
@@ -27,7 +27,7 @@ The report includes:
27
27
  ```
28
28
  ✅ Review Report Generated!
29
29
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
30
- 📄 File: {review_output}/review-{target_branch_slug}-{date}.md
30
+ 📄 File: {session_output}/final-review.md
31
31
 
32
32
  Summary:
33
33
  🔴 Blockers: {blocker_count}
@@ -19,7 +19,8 @@ nextStep: "./steps/step-01-collect.md"
19
19
  ## INITIALIZATION
20
20
 
21
21
  Load config from `{main_config}`.
22
- Load PR context from `{review_output}/current-pr-context.yaml`.
22
+ Use `session_output` from working context.
23
+ If not set: prompt user to run [SS] Select Session or [SP] Select PR first.
23
24
 
24
25
  ## EXECUTION
25
26
 
@@ -10,9 +10,9 @@ nextStepFile: "./step-02-post.md"
10
10
 
11
11
  ### 1. Check Prerequisites
12
12
 
13
- Verify `{review_output}/current-pr-context.yaml` exists and contains:
14
- - `pr_number` — if missing, show: `❌ No PR number found. Run [SP] Select PR first.`
15
- - `target_branch`, `base_branch`
13
+ Verify working context contains:
14
+ - `pr_number` — if missing, show: `❌ No PR number found. Run [SS] Select Session or [SP] Select PR first.`
15
+ - `target_branch`, `base_branch`, `session_output`
16
16
 
17
17
  Verify platform CLI is available:
18
18
 
@@ -54,8 +54,7 @@ Store as `{commit_sha}`.
54
54
 
55
55
  ### 3. Load Review Report
56
56
 
57
- Find the latest report in `{review_output}/review-*.md`.
58
- Sort by modification time, take the most recent.
57
+ Read the report at `{session_output}/final-review.md`.
59
58
 
60
59
  ### 4. Parse All Findings
61
60
 
@@ -37,10 +37,11 @@ Depends on `{active_platform}`:
37
37
  ## INITIALIZATION
38
38
 
39
39
  Load config from `{main_config}`.
40
- Load PR context from `{review_output}/current-pr-context.yaml`.
40
+ Use `session_output`, `target_branch`, `base_branch`, `pr_number`, `active_platform` from working context.
41
+ If `session_output` not set: prompt user to run [SS] Select Session or [SP] Select PR first.
41
42
  Use `{active_platform}` (or detect from `{platform}` config).
42
43
 
43
- Set `{temp_dir}` = `{review_output}/temp`.
44
+ Set `{temp_dir}` = `{session_output}/temp`.
44
45
  Create it if it doesn't exist:
45
46
  ```bash
46
47
  mkdir -p "{temp_dir}"
@@ -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
+
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`
179
+
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
169
210
  ```
170
211
 
171
- Show summary:
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. May pause once to ask the user for additional context (unless `skip_manual_input_context: true` in config).*
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), asks the user for any additional context (marked ⚠️ IMPORTANT if provided), 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}