prr-kit 1.3.0 → 2.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.
- package/README.md +157 -20
- package/package.json +1 -1
- package/src/core/agents/prr-master.agent.yaml +16 -3
- package/src/core/tasks/clear.md +36 -71
- package/src/core/tasks/help.md +10 -7
- package/src/core/tasks/select-session.md +94 -0
- package/src/core/workflows/party-mode/steps/step-00-user-instructions.md +125 -0
- package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +29 -14
- package/src/core/workflows/party-mode/steps/step-02-discussion.md +14 -7
- package/src/core/workflows/party-mode/workflow.md +7 -7
- package/src/prr/config-template.yaml +0 -3
- package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +99 -25
- package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
- package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md +64 -50
- package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-04-build-knowledge-base.md +42 -32
- package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +7 -7
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +3 -3
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +11 -7
- package/src/prr/workflows/2-analyze/describe-pr/workflow.md +2 -2
- package/src/prr/workflows/3-review/architecture-review/checklist.md +1 -2
- package/src/prr/workflows/3-review/architecture-review/instructions.xml +1 -1
- package/src/prr/workflows/3-review/architecture-review/workflow.yaml +3 -2
- package/src/prr/workflows/3-review/business-review/checklist.md +1 -2
- package/src/prr/workflows/3-review/business-review/workflow.yaml +3 -2
- package/src/prr/workflows/3-review/general-review/checklist.md +1 -2
- package/src/prr/workflows/3-review/general-review/workflow.yaml +3 -2
- package/src/prr/workflows/3-review/performance-review/checklist.md +1 -2
- package/src/prr/workflows/3-review/performance-review/workflow.yaml +3 -2
- package/src/prr/workflows/3-review/security-review/checklist.md +1 -2
- package/src/prr/workflows/3-review/security-review/workflow.yaml +3 -2
- package/src/prr/workflows/4-improve/improve-code/checklist.md +1 -2
- package/src/prr/workflows/4-improve/improve-code/workflow.yaml +3 -2
- package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +2 -2
- package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +19 -9
- package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +2 -2
- package/src/prr/workflows/6-report/generate-report/workflow.md +2 -1
- package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +17 -5
- package/src/prr/workflows/6-report/post-comments/steps/step-02-post.md +27 -4
- package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
- package/src/prr/workflows/quick/workflow.md +104 -35
- package/tools/cli/installers/lib/ide/platform-codes.yaml +4 -4
package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-04-build-knowledge-base.md
CHANGED
|
@@ -16,7 +16,18 @@ Transform collected data into structured knowledge base optimized for reviewers.
|
|
|
16
16
|
🧠 Building PR-specific knowledge base...
|
|
17
17
|
```
|
|
18
18
|
|
|
19
|
-
### 2.
|
|
19
|
+
### 2. Map `manual_context` → `user_instructions`
|
|
20
|
+
|
|
21
|
+
Using the `manual_context` variable set in step-03:
|
|
22
|
+
|
|
23
|
+
- **If `manual_context` is null** (user skipped): set `user_instructions.provided = false`, all other fields `null`.
|
|
24
|
+
- **If `manual_context` is not null** (user provided text): set `user_instructions.provided = true`, `raw = manual_context`, then parse the free-form text:
|
|
25
|
+
- `review_scope` — look for scope signals ("only SR", "skip performance", "security and architecture"). Default `"all"` if none found.
|
|
26
|
+
- `focus_areas` — extract specific things to prioritize (e.g. "focus on JWT handling" → `["JWT handling"]`). `null` if none.
|
|
27
|
+
- `custom_requirements` — extract mandatory checks the user stated (e.g. "all endpoints must have auth middleware"). `null` if none.
|
|
28
|
+
- `context_notes` — extract background info, trade-offs, constraints. `null` if none.
|
|
29
|
+
|
|
30
|
+
### 3. Create Knowledge Base Structure
|
|
20
31
|
|
|
21
32
|
Build YAML structure with all collected context:
|
|
22
33
|
|
|
@@ -32,15 +43,19 @@ pr_metadata:
|
|
|
32
43
|
files_changed: {n}
|
|
33
44
|
collected_at: {ISO timestamp}
|
|
34
45
|
|
|
35
|
-
# ⚠️ IMPORTANT — Human-provided
|
|
46
|
+
# ⚠️ IMPORTANT — Human-provided instructions from the user.
|
|
36
47
|
# All reviewers MUST read this section before starting any review.
|
|
37
|
-
#
|
|
38
|
-
|
|
48
|
+
# review_scope controls which reviews run. focus_areas, custom_requirements, and context_notes
|
|
49
|
+
# are highest-priority guidance — align all findings against them.
|
|
50
|
+
user_instructions:
|
|
39
51
|
# Populated only when the user provided input in step-03-manual-context-input.
|
|
40
52
|
# If provided: true — treat this content as the highest-priority context in this file.
|
|
41
53
|
provided: {true|false}
|
|
42
|
-
|
|
43
|
-
|
|
54
|
+
review_scope: {"all" | [SR] | [SR, AR] | ...} # "all" = run all reviews; list = only those codes
|
|
55
|
+
focus_areas: {list of strings, or null} # specific things every reviewer must prioritize
|
|
56
|
+
custom_requirements: {list of strings, or null} # mandatory checks the user specified
|
|
57
|
+
context_notes: {list of strings, or null} # background info, trade-offs, constraints
|
|
58
|
+
raw: {original text from user, or null} # verbatim input
|
|
44
59
|
|
|
45
60
|
files_analysis:
|
|
46
61
|
changed_files:
|
|
@@ -245,7 +260,7 @@ external_context:
|
|
|
245
260
|
|
|
246
261
|
review_priorities:
|
|
247
262
|
# Guide reviewers on what to focus on
|
|
248
|
-
# ⚠️ If
|
|
263
|
+
# ⚠️ If user_instructions.provided is true — reviewers MUST check findings against user_instructions first.
|
|
249
264
|
critical:
|
|
250
265
|
- "Verify no v-html with user input (security requirement)"
|
|
251
266
|
- "Check ESLint error-level rules compliance"
|
|
@@ -261,7 +276,10 @@ review_priorities:
|
|
|
261
276
|
- "Optional optimizations"
|
|
262
277
|
|
|
263
278
|
reviewer_guidance:
|
|
264
|
-
# ⚠️ If
|
|
279
|
+
# ⚠️ If user_instructions.provided is true:
|
|
280
|
+
# PREPEND each reviewer's list with user_instructions.focus_areas (if any)
|
|
281
|
+
# APPEND each reviewer's list with user_instructions.custom_requirements prefixed "MANDATORY: "
|
|
282
|
+
# Example: if focus_areas = ["JWT handling"], add "FOCUS: JWT handling" as first item
|
|
265
283
|
general_review:
|
|
266
284
|
- "Check for ESLint rule violations (no-var, prefer-const)"
|
|
267
285
|
- "Verify component naming follows standards"
|
|
@@ -281,35 +299,32 @@ reviewer_guidance:
|
|
|
281
299
|
- "Check Pinia setup function style (not Options API)"
|
|
282
300
|
- "Verify SRP adherence"
|
|
283
301
|
|
|
302
|
+
business_review:
|
|
303
|
+
- "Verify feature matches acceptance criteria"
|
|
304
|
+
- "Check for user-facing regressions"
|
|
305
|
+
- "Flag missing observability (logging, metrics) for new flows"
|
|
306
|
+
|
|
284
307
|
context_sources:
|
|
285
308
|
# Track what sources were used
|
|
286
309
|
primary_docs: [CLAUDE.md, AGENTS.md]
|
|
287
310
|
config_files: [.eslintrc.js, .prettierrc]
|
|
288
311
|
standards_docs: [CONTRIBUTING.md, ARCHITECTURE.md]
|
|
289
312
|
inline_annotations: yes
|
|
290
|
-
|
|
313
|
+
user_instructions: {true|false} # true if user provided input in step-03
|
|
291
314
|
mcp_tools: [] # list of MCP tools actually used
|
|
292
315
|
rag_systems: [] # list of RAG systems queried
|
|
293
316
|
url_sources: [] # list of plain URLs fetched
|
|
294
317
|
```
|
|
295
318
|
|
|
296
|
-
### 3.
|
|
319
|
+
### 3. Output Filename
|
|
297
320
|
|
|
298
|
-
|
|
299
|
-
if (pr_number_available) {
|
|
300
|
-
filename = `pr-${pr_number}-context.yaml`
|
|
301
|
-
} else {
|
|
302
|
-
// Use sanitized branch name
|
|
303
|
-
const safeBranchName = branch_name.replace(/[^a-zA-Z0-9-]/g, '-')
|
|
304
|
-
filename = `pr-${safeBranchName}-context.yaml`
|
|
305
|
-
}
|
|
306
|
-
```
|
|
321
|
+
Always: `pr-context.yaml` — the session folder already identifies the PR uniquely.
|
|
307
322
|
|
|
308
323
|
### 4. Write Knowledge Base to File
|
|
309
324
|
|
|
310
|
-
Write to: `{
|
|
325
|
+
Write to: `{session_output}/pr-context.yaml`
|
|
311
326
|
|
|
312
|
-
Example: `_prr-output/pr-
|
|
327
|
+
Example: `_prr-output/reviews/2026-03-02-1430-pr123-feature-auth/pr-context.yaml`
|
|
313
328
|
|
|
314
329
|
### 5. Report Completion
|
|
315
330
|
|
|
@@ -322,9 +337,9 @@ Example: `_prr-output/pr-123-context.yaml`
|
|
|
322
337
|
• ESLint rules: {n}
|
|
323
338
|
• Guidelines: {m}
|
|
324
339
|
• Inline annotations: {k}
|
|
325
|
-
•
|
|
340
|
+
• User instructions: ⚠️ YES — scope: {scope}, focus: {focus_count} areas, requirements: {req_count}
|
|
326
341
|
OR
|
|
327
|
-
•
|
|
342
|
+
• User instructions: none — full standard review
|
|
328
343
|
• MCP tools used: {mcp_list or "none"}
|
|
329
344
|
• RAG patterns: {rag_count}
|
|
330
345
|
• Issue context: {issue_key or "none"}
|
|
@@ -337,17 +352,12 @@ Example: `_prr-output/pr-123-context.yaml`
|
|
|
337
352
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
338
353
|
```
|
|
339
354
|
|
|
340
|
-
### 6. Store
|
|
341
|
-
|
|
342
|
-
Update PR context file to include knowledge base path:
|
|
355
|
+
### 6. Store Knowledge Base Path in Working Context
|
|
343
356
|
|
|
344
|
-
|
|
345
|
-
# {review_output}/current-pr-context.yaml
|
|
346
|
-
pr_knowledge_base: "{review_output}/{filename}"
|
|
347
|
-
```
|
|
357
|
+
Store `pr_knowledge_base` = `{session_output}/pr-context.yaml` in working context.
|
|
348
358
|
|
|
349
|
-
|
|
359
|
+
Review workflows (GR, SR, PR, AR, BR) find the knowledge base via working context or directly at `{session_output}/pr-context.yaml`.
|
|
350
360
|
|
|
351
361
|
### 7. Workflow Complete
|
|
352
362
|
|
|
353
|
-
Mark workflow as complete. Context is ready for use by review workflows (GR, SR, PR, AR).
|
|
363
|
+
Mark workflow as complete. Context is ready for use by review workflows (GR, SR, PR, AR, BR, IC).
|
|
@@ -3,7 +3,7 @@ name: collect-pr-context
|
|
|
3
3
|
description: "Collect fresh, PR-specific context from multiple sources after describing the PR"
|
|
4
4
|
main_config: "{project-root}/_prr/prr/config.yaml"
|
|
5
5
|
nextStep: "./steps/step-01-analyze-files.md"
|
|
6
|
-
output_file: "{
|
|
6
|
+
output_file: "{session_output}/pr-context.yaml"
|
|
7
7
|
---
|
|
8
8
|
|
|
9
9
|
# Collect PR-Specific Context Workflow
|
|
@@ -26,8 +26,10 @@ output_file: "{review_output}/pr-{pr_number}-context.yaml"
|
|
|
26
26
|
|
|
27
27
|
## WHEN TO RUN
|
|
28
28
|
|
|
29
|
-
**
|
|
30
|
-
|
|
29
|
+
**In [QR] Quick Review:** runs automatically as Phase 2.5 — no manual step needed.
|
|
30
|
+
|
|
31
|
+
**In standalone mode:** run manually after [DP] Describe PR and before starting any review workflow (GR/SR/PR/AR/BR).
|
|
32
|
+
The master agent will remind you to run context collection if you attempt to start a review without it.
|
|
31
33
|
|
|
32
34
|
## CONTEXT SOURCES
|
|
33
35
|
|
|
@@ -108,16 +110,14 @@ If a stack has no matching data file, skip it silently and proceed with general
|
|
|
108
110
|
4-step process:
|
|
109
111
|
1. **Analyze files** changed in PR — extract metadata, domains, and **detect technology stacks**
|
|
110
112
|
2. **Collect context** from all sources: primary docs, config files, standards docs, inline annotations, **stack-specific rules**, MCP tools, RAG systems
|
|
111
|
-
3. **Manual context input** — prompt the user for any additional context (business rationale, focus areas, known trade-offs).
|
|
113
|
+
3. **Manual context input** — prompt the user for any additional context (business rationale, focus areas, known trade-offs). **Always runs — user must respond before continuing.** If the user provides input, it is marked **⚠️ IMPORTANT** and reviewers treat it as highest-priority context
|
|
112
114
|
4. **Build PR-specific knowledge base** — structured YAML with all context, stack rules, manual context, and reviewer guidance
|
|
113
115
|
|
|
114
116
|
## INITIALIZATION
|
|
115
117
|
|
|
116
118
|
Load config from `{main_config}`.
|
|
117
119
|
|
|
118
|
-
|
|
119
|
-
- If available: use `pr-{pr_number}-context.yaml`
|
|
120
|
-
- If not: use `pr-{branch_name}-context.yaml`
|
|
120
|
+
Output filename is always `pr-context.yaml` — the session folder already identifies the PR uniquely.
|
|
121
121
|
|
|
122
122
|
## EXECUTION
|
|
123
123
|
|
|
@@ -14,11 +14,11 @@ Load the PR context file and the actual code diff for analysis.
|
|
|
14
14
|
|
|
15
15
|
### 1. Load PR Context
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Use `session_output`, `target_branch`, `base_branch`, `pr_number` from working context.
|
|
18
18
|
|
|
19
|
-
If
|
|
19
|
+
If not set:
|
|
20
20
|
```
|
|
21
|
-
❌ No
|
|
21
|
+
❌ No active session. Run [SS] Select Session to resume a past session, or [SP] Select PR to start a new one.
|
|
22
22
|
```
|
|
23
23
|
Stop workflow.
|
|
24
24
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "step-04-output"
|
|
3
3
|
description: "Write PR description to file and display summary"
|
|
4
|
-
outputFile: "{
|
|
4
|
+
outputFile: "{session_output}/pr-description.md"
|
|
5
5
|
templateFile: "../templates/pr-description.template.md"
|
|
6
6
|
---
|
|
7
7
|
|
|
@@ -24,14 +24,13 @@ Using the template at `{templateFile}`, generate the PR description with:
|
|
|
24
24
|
|
|
25
25
|
### 2. Write to File
|
|
26
26
|
|
|
27
|
-
Write to `{outputFile}
|
|
27
|
+
Write to `{outputFile}`.
|
|
28
28
|
|
|
29
|
-
### 3. Update
|
|
29
|
+
### 3. Update Working Context
|
|
30
30
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
- Add `risk_level: "{risk_level}"`
|
|
31
|
+
Store in working context:
|
|
32
|
+
- `pr_type` = `{classified_type}`
|
|
33
|
+
- `risk_level` = `{risk_level}`
|
|
35
34
|
|
|
36
35
|
### 4. Display Summary
|
|
37
36
|
|
|
@@ -45,6 +44,11 @@ Summary:
|
|
|
45
44
|
|
|
46
45
|
Recommended next steps:
|
|
47
46
|
{recommended_reviews}
|
|
47
|
+
|
|
48
|
+
💡 Before reviewing: run [CC] Collect Context to build a fresh PR-specific knowledge base.
|
|
49
|
+
Reviews use this context to apply your project's rules, stack-specific guidelines, and any
|
|
50
|
+
external sources (Jira, Confluence, Figma) — skipping it means reviewers work with
|
|
51
|
+
general rules only.
|
|
48
52
|
```
|
|
49
53
|
|
|
50
54
|
Workflow complete. Return to agent menu.
|
|
@@ -20,8 +20,8 @@ nextStep: "./steps/step-01-load-context.md"
|
|
|
20
20
|
## INITIALIZATION
|
|
21
21
|
|
|
22
22
|
Load config from `{main_config}`.
|
|
23
|
-
|
|
24
|
-
If
|
|
23
|
+
Use `session_output`, `target_branch`, `base_branch`, `pr_number` from working context.
|
|
24
|
+
If not set: prompt user to run [SS] Select Session (to resume a past session) or [SP] Select PR (to start a new one).
|
|
25
25
|
|
|
26
26
|
## EXECUTION
|
|
27
27
|
|
|
@@ -22,5 +22,4 @@ validation-target: "Architecture review output file"
|
|
|
22
22
|
- [ ] ❓ QUESTION findings include: specific question + list of potentially affected files outside the diff
|
|
23
23
|
|
|
24
24
|
## Output
|
|
25
|
-
- [ ] Findings written to `{
|
|
26
|
-
- [ ] PR context updated with `architecture-review` in completed list
|
|
25
|
+
- [ ] Findings written to `{session_output}/architecture-review.md`
|
|
@@ -98,7 +98,7 @@ Context: Loaded architectural patterns & ADRs from project docs
|
|
|
98
98
|
</step>
|
|
99
99
|
|
|
100
100
|
<step n="7" goal="Compile and write findings">
|
|
101
|
-
<action>Group findings: Layer Violations | Coupling Issues | Consistency Problems | SOLID Violations | ❓ Questions for Author</action>
|
|
101
|
+
<action>Group findings: Layer Violations | Coupling Issues | Consistency Problems | Blast Radius & Breaking Changes | SOLID Violations | ❓ Questions for Author</action>
|
|
102
102
|
<action>For each finding: reference the EXISTING pattern that should be followed instead</action>
|
|
103
103
|
<action>Write findings to {output_file}</action>
|
|
104
104
|
<action>Update {pr_context}: add 'architecture-review' to completed list</action>
|
|
@@ -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/architecture-review"
|
|
13
14
|
instructions: "{installed_path}/instructions.xml"
|
|
14
15
|
validation: "{installed_path}/checklist.md"
|
|
15
16
|
|
|
16
|
-
pr_context: "
|
|
17
|
-
output_file: "{
|
|
17
|
+
pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base"
|
|
18
|
+
output_file: "{session_output}/architecture-review.md"
|
|
@@ -23,5 +23,4 @@ validation-target: "Business review output file"
|
|
|
23
23
|
- [ ] Post-ship monitoring noted: what to watch after deploy
|
|
24
24
|
|
|
25
25
|
## Output
|
|
26
|
-
- [ ] Findings written to `{
|
|
27
|
-
- [ ] PR context updated with `business-review` in completed list
|
|
26
|
+
- [ ] Findings written to `{session_output}/business-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/business-review"
|
|
13
14
|
instructions: "{installed_path}/instructions.xml"
|
|
14
15
|
validation: "{installed_path}/checklist.md"
|
|
15
16
|
|
|
16
|
-
pr_context: "
|
|
17
|
-
output_file: "{
|
|
17
|
+
pr_context: "working-context:target_branch,base_branch,pr_number,pr_knowledge_base,pr_type,completed_reviews"
|
|
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 `{
|
|
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: "
|
|
17
|
-
output_file: "{
|
|
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 `{
|
|
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: "
|
|
17
|
-
output_file: "{
|
|
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 `{
|
|
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: "
|
|
18
|
-
output_file: "{
|
|
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 `{
|
|
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: "
|
|
17
|
-
output_file: "{
|
|
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
|
-
|
|
13
|
+
Use `session_output`, `target_branch`, `base_branch` from working context.
|
|
14
14
|
|
|
15
|
-
If not
|
|
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.
|
|
11
|
+
### 1. Detect Completed Reviews
|
|
12
12
|
|
|
13
|
-
|
|
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
|
|
18
|
-
- `general-review` → `{
|
|
19
|
-
- `security-review` → `{
|
|
20
|
-
- `performance-review` → `{
|
|
21
|
-
- `architecture-review` → `{
|
|
22
|
-
- `business-review` → `{
|
|
23
|
-
- `improve-code` → `{
|
|
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
|
|
|
@@ -37,6 +41,12 @@ From each file, extract all findings with their:
|
|
|
37
41
|
- `🟢` or `Low` → Suggestion
|
|
38
42
|
- `❓` → Question (collect separately — do not count as blocker/warning/suggestion)
|
|
39
43
|
|
|
44
|
+
**Special handling — `improve-code.md`:**
|
|
45
|
+
The improve-code output uses `[CATEGORY]` format (`[BUGS]`, `[QUALITY]`, `[PERFORMANCE]`, `[BEST-PRACTICES]`), not severity emojis. Treat improve-code findings as a separate collection:
|
|
46
|
+
- Do NOT mix them into the Blockers/Warnings/Suggestions counts
|
|
47
|
+
- Include them in the report's **💡 Code Improvement Suggestions** section (see template)
|
|
48
|
+
- Map `[BUGS]` → 🔴 only if the improve-code entry describes an actual bug that could cause incorrect behavior; otherwise keep as 💡 Improvement
|
|
49
|
+
|
|
40
50
|
### 4. Count Statistics
|
|
41
51
|
|
|
42
52
|
Count:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "step-03-write"
|
|
3
3
|
description: "Write the final review report to file"
|
|
4
|
-
outputFile: "{
|
|
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: {
|
|
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
|
-
|
|
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
|
|
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,20 @@ Store as `{commit_sha}`.
|
|
|
54
54
|
|
|
55
55
|
### 3. Load Review Report
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
Check that `{session_output}/final-review.md` exists:
|
|
58
|
+
```bash
|
|
59
|
+
ls "{session_output}/final-review.md"
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
If it does NOT exist:
|
|
63
|
+
```
|
|
64
|
+
❌ No report found at {session_output}/final-review.md
|
|
65
|
+
Run [RR] Generate Report first to compile all findings into a report,
|
|
66
|
+
then run [PC] Post Comments to post them.
|
|
67
|
+
```
|
|
68
|
+
Stop workflow.
|
|
69
|
+
|
|
70
|
+
Read the report at `{session_output}/final-review.md`.
|
|
59
71
|
|
|
60
72
|
### 4. Parse All Findings
|
|
61
73
|
|
|
@@ -74,21 +74,40 @@ done
|
|
|
74
74
|
---
|
|
75
75
|
|
|
76
76
|
**Bitbucket:**
|
|
77
|
+
|
|
78
|
+
**⚠️ Do NOT embed `$(cat ...)` in curl `-d` — the summary body contains emojis and backticks that will break shell expansion.**
|
|
79
|
+
|
|
80
|
+
Use the runtime script approach to build the summary payload first:
|
|
81
|
+
|
|
82
|
+
Write `{temp_dir}/build-bb-summary.mjs` (or `.py`) using the Write tool:
|
|
83
|
+
|
|
84
|
+
```js
|
|
85
|
+
// Node.js
|
|
86
|
+
import { readFileSync, writeFileSync } from 'fs'
|
|
87
|
+
const body = readFileSync("{temp_dir}/prr-summary.md", "utf-8")
|
|
88
|
+
const payload = { content: { raw: body } }
|
|
89
|
+
writeFileSync("{temp_dir}/prr-bb-summary.json", JSON.stringify(payload, null, 2), "utf-8")
|
|
90
|
+
console.log("OK: summary payload written")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Execute: `node "{temp_dir}/build-bb-summary.mjs"`
|
|
94
|
+
|
|
95
|
+
Then post using `--data @`:
|
|
77
96
|
```bash
|
|
78
97
|
# Post summary
|
|
79
98
|
curl -s -X POST \
|
|
80
99
|
"https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{pr_number}/comments" \
|
|
81
100
|
-H "Authorization: Bearer {BB_TOKEN}" \
|
|
82
101
|
-H "Content-Type: application/json" \
|
|
83
|
-
|
|
102
|
+
--data "@{temp_dir}/prr-bb-summary.json"
|
|
84
103
|
|
|
85
104
|
# Post each inline comment
|
|
86
|
-
for payload in "{temp_dir}/prr-bb-"*.json; do
|
|
105
|
+
for payload in "{temp_dir}/prr-bb-"[0-9]*.json; do
|
|
87
106
|
curl -s -X POST \
|
|
88
107
|
"https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{pr_number}/comments" \
|
|
89
108
|
-H "Authorization: Bearer {BB_TOKEN}" \
|
|
90
109
|
-H "Content-Type: application/json" \
|
|
91
|
-
|
|
110
|
+
--data "@$payload"
|
|
92
111
|
done
|
|
93
112
|
```
|
|
94
113
|
|
|
@@ -146,8 +165,12 @@ rm -f "{temp_dir}/prr-payload.json" \
|
|
|
146
165
|
"{temp_dir}/prr-summary.md" \
|
|
147
166
|
"{temp_dir}/prr-thread-"*.json \
|
|
148
167
|
"{temp_dir}/prr-bb-"*.json \
|
|
168
|
+
"{temp_dir}/prr-bb-summary.json" \
|
|
149
169
|
"{temp_dir}/build-payload.mjs" \
|
|
150
|
-
"{temp_dir}/build-payload.py"
|
|
170
|
+
"{temp_dir}/build-payload.py" \
|
|
171
|
+
"{temp_dir}/build-bb-summary.mjs" \
|
|
172
|
+
"{temp_dir}/build-bb-summary.py"
|
|
173
|
+
rmdir "{temp_dir}" 2>/dev/null || true
|
|
151
174
|
```
|
|
152
175
|
|
|
153
176
|
---
|
|
@@ -37,10 +37,11 @@ Depends on `{active_platform}`:
|
|
|
37
37
|
## INITIALIZATION
|
|
38
38
|
|
|
39
39
|
Load config from `{main_config}`.
|
|
40
|
-
|
|
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}` = `{
|
|
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}"
|