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
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-00-user-instructions"
|
|
3
|
+
description: "Collect user instructions before the party review begins"
|
|
4
|
+
nextStepFile: "./step-01-load-reviewers.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 0: User Instructions
|
|
8
|
+
|
|
9
|
+
## Goal
|
|
10
|
+
Always ask the user for scope, focus, requirements, or context before reviewers are loaded.
|
|
11
|
+
This step runs even if a `pr-context.yaml` already exists — fresh instructions override any prior `user_instructions` in the file.
|
|
12
|
+
|
|
13
|
+
## Sequence of Instructions
|
|
14
|
+
|
|
15
|
+
### 1. Show PR Summary
|
|
16
|
+
|
|
17
|
+
Display:
|
|
18
|
+
```
|
|
19
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
|
+
🎉 Party Mode — Review Setup
|
|
21
|
+
|
|
22
|
+
Branch: {target_branch} → {base_branch}
|
|
23
|
+
Files: {file_count} changed
|
|
24
|
+
PR: {pr_number if set, else "local branch"}
|
|
25
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### 2. Prompt User
|
|
29
|
+
|
|
30
|
+
Display EXACTLY:
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
💬 Any instructions for this review?
|
|
34
|
+
Press Enter to run a full standard review, or type your instructions below.
|
|
35
|
+
|
|
36
|
+
You can specify:
|
|
37
|
+
• Scope "only security" / "security and architecture" / "skip performance"
|
|
38
|
+
• Focus "focus on SQL injection and rate limiting"
|
|
39
|
+
• Requirements "all API endpoints must have auth middleware"
|
|
40
|
+
• Context "hotfix — ignore refactoring suggestions"
|
|
41
|
+
• Mix freely "security only, focus on JWT handling, context: auth rewrite in progress"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
**HALT — wait for user response before continuing.**
|
|
45
|
+
|
|
46
|
+
### 3. Parse Response
|
|
47
|
+
|
|
48
|
+
**If user pressed Enter / left empty:**
|
|
49
|
+
- Set `user_instructions.provided` = `false`
|
|
50
|
+
- Set `user_instructions.review_scope` = `"all"`
|
|
51
|
+
- Set all other fields to `null`
|
|
52
|
+
|
|
53
|
+
**If user typed something**, parse the free-form text and extract:
|
|
54
|
+
|
|
55
|
+
**`review_scope`** — which reviews to run:
|
|
56
|
+
- Parse for scope signals: "only X", "just X", "X only", "skip X", "no X review", "X and Y"
|
|
57
|
+
- Map to codes: `GR` (general), `SR` (security), `PR` (performance), `AR` (architecture), `BR` (business)
|
|
58
|
+
- Examples:
|
|
59
|
+
- "only security" → `[SR]`
|
|
60
|
+
- "security and architecture" → `[SR, AR]`
|
|
61
|
+
- "skip performance" → `[GR, SR, AR, BR]`
|
|
62
|
+
- "focus on SQL injection" (no scope signal) → `"all"` (focus only, all reviewers still active)
|
|
63
|
+
- If no scope restriction found → `"all"`
|
|
64
|
+
|
|
65
|
+
**`focus_areas`** — specific things reviewers must prioritize (list of strings), or `null` if none.
|
|
66
|
+
|
|
67
|
+
**`custom_requirements`** — mandatory checks user specified (list of strings), or `null`.
|
|
68
|
+
|
|
69
|
+
**`context_notes`** — background info, trade-offs, constraints (list of strings), or `null`.
|
|
70
|
+
|
|
71
|
+
**`raw`** — full original text from user.
|
|
72
|
+
|
|
73
|
+
Set `user_instructions.provided` = `true`.
|
|
74
|
+
|
|
75
|
+
### 4. Acknowledge
|
|
76
|
+
|
|
77
|
+
**If user provided instructions:**
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
✅ Instructions captured.
|
|
81
|
+
|
|
82
|
+
📋 Scope: {scope_list joined with ", " OR "all reviewers"}
|
|
83
|
+
🎯 Focus: {focus_areas joined with ", " OR "standard coverage"}
|
|
84
|
+
✅ Requirements: {custom_requirements joined with ", " OR "none"}
|
|
85
|
+
📝 Context: {context_notes joined with "; " OR "none"}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
**If user left empty:**
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
▶️ Full standard review — all reviewers, standard focus.
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 5. Write to pr-context.yaml
|
|
95
|
+
|
|
96
|
+
Write `user_instructions` to `{session_output}/pr-context.yaml`:
|
|
97
|
+
|
|
98
|
+
- **If `pr-context.yaml` exists**: update only the `user_instructions:` section, leave all other sections intact.
|
|
99
|
+
- **If `pr-context.yaml` does not exist** (Party Mode was run without prior DP/context collection):
|
|
100
|
+
Create a minimal file with just `pr_metadata` and `user_instructions`:
|
|
101
|
+
|
|
102
|
+
```yaml
|
|
103
|
+
# PR-Specific Context (minimal — created by Party Mode)
|
|
104
|
+
# Generated: {timestamp}
|
|
105
|
+
|
|
106
|
+
pr_metadata:
|
|
107
|
+
pr_number: {pr_number or null}
|
|
108
|
+
branch: {target_branch}
|
|
109
|
+
base_branch: {base_branch}
|
|
110
|
+
collected_at: {ISO timestamp}
|
|
111
|
+
|
|
112
|
+
user_instructions:
|
|
113
|
+
provided: {true|false}
|
|
114
|
+
review_scope: {value}
|
|
115
|
+
focus_areas: {value}
|
|
116
|
+
custom_requirements: {value}
|
|
117
|
+
context_notes: {value}
|
|
118
|
+
raw: {value}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Store `pr_knowledge_base` = `{session_output}/pr-context.yaml` in working context.
|
|
122
|
+
|
|
123
|
+
### 6. Load Next Step
|
|
124
|
+
|
|
125
|
+
Add `step-00-user-instructions` to `stepsCompleted`. Load: `{nextStepFile}`
|
|
@@ -8,35 +8,50 @@ nextStepFile: "./step-02-discussion.md"
|
|
|
8
8
|
|
|
9
9
|
## Sequence of Instructions
|
|
10
10
|
|
|
11
|
-
### 1.
|
|
11
|
+
### 1. Load PR Knowledge Base
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
Load the PR knowledge base from working context (`pr_knowledge_base`), or read directly at `{session_output}/pr-context.yaml`.
|
|
14
|
+
It contains stack-specific rules, ESLint/linting rules, project guidelines (CLAUDE.md, CONTRIBUTING.md, ARCHITECTURE.md sections), inline code annotations, and external context.
|
|
15
|
+
|
|
16
|
+
If no knowledge base exists (DP was not run), proceed with local context only — do not block.
|
|
17
|
+
|
|
18
|
+
**Read `user_instructions`** from the knowledge base:
|
|
19
|
+
|
|
20
|
+
- **`review_scope`**: determines active reviewers
|
|
21
|
+
- If `"all"` (or knowledge base missing) → all 5 reviewers are active.
|
|
22
|
+
- If a list (e.g. `[SR, AR]`) → only activate reviewers matching those codes:
|
|
23
|
+
`GR` = Alex · `SR` = Sam · `PR` = Petra · `AR` = Arch · `BR` = Biz
|
|
24
|
+
|
|
25
|
+
- **`focus_areas`** / **`custom_requirements`** / **`context_notes`**: if `user_instructions.provided` is true, store these in working context — all active reviewers will apply them in step 2:
|
|
26
|
+
- `focus_areas` → each reviewer must prioritize these areas above their default checklist
|
|
27
|
+
- `custom_requirements` → treat as mandatory checks (prefix each with "MANDATORY:")
|
|
28
|
+
- `context_notes` → background info explaining trade-offs or constraints; do not flag issues the user has explicitly accepted
|
|
29
|
+
|
|
30
|
+
### 2. Introduce Party Mode
|
|
31
|
+
|
|
32
|
+
Display, listing only the **active** reviewers:
|
|
14
33
|
```
|
|
15
34
|
🎉 Party Mode activated!
|
|
16
35
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
17
36
|
Reviewers joining this session:
|
|
18
37
|
|
|
19
|
-
|
|
38
|
+
{active reviewers only, e.g.:}
|
|
20
39
|
🔒 Sam — Security
|
|
21
|
-
⚡ Petra — Performance
|
|
22
40
|
🏗️ Arch — Architecture
|
|
23
|
-
💼 Biz — Business Impact
|
|
24
41
|
|
|
25
42
|
PR: {target_branch} → {base_branch}
|
|
26
43
|
Files changed: {file_count} | Lines: +{additions} -{deletions}
|
|
27
44
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
28
45
|
```
|
|
29
46
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
If no knowledge base exists (DP was not run), proceed with local context only — do not block.
|
|
47
|
+
If reviewers were filtered, also print:
|
|
48
|
+
```
|
|
49
|
+
⏭️ Skipped: {inactive reviewer names} (not in review scope)
|
|
50
|
+
```
|
|
36
51
|
|
|
37
52
|
### 3. Load Reviewer Personas
|
|
38
53
|
|
|
39
|
-
Internally adopt
|
|
54
|
+
Internally adopt only the **active** reviewer personas (determined by scope in step 1). All active reviewers apply rules from the PR knowledge base in their respective areas.
|
|
40
55
|
|
|
41
56
|
**👁️ Alex (General Reviewer)**
|
|
42
57
|
- Focus: code logic, naming, readability, DRY, best practices, test coverage, side effects, and stack-specific best practices from knowledge base
|
|
@@ -64,7 +79,7 @@ Internally adopt all reviewer personas simultaneously. All reviewers apply rules
|
|
|
64
79
|
- Runs last, references findings from Alex/Sam/Petra/Arch and translates them to business consequences
|
|
65
80
|
- Output format: risk level (CRITICAL/HIGH/MEDIUM/LOW) + user impact + deployment recommendation
|
|
66
81
|
|
|
67
|
-
### 4. Scan the Diff and Assign Focus Areas
|
|
82
|
+
### 4. Scan the Diff and Assign Focus Areas (active reviewers only)
|
|
68
83
|
|
|
69
84
|
Read the diff and file list from the knowledge base. Assign focus areas:
|
|
70
85
|
- SQL/DB files → Petra leads (N+1, missing index), Sam checks (injection)
|
|
@@ -74,6 +89,6 @@ Read the diff and file list from the knowledge base. Assign focus areas:
|
|
|
74
89
|
- Any file touching auth, payments, PII → Sam mandatory
|
|
75
90
|
- Schema/migration files → Biz flags (data safety, rollback plan)
|
|
76
91
|
|
|
77
|
-
###
|
|
92
|
+
### 5. Load Next Step
|
|
78
93
|
|
|
79
94
|
Add `step-01-load-reviewers` to `stepsCompleted`. Load: `{nextStepFile}`
|
|
@@ -7,13 +7,20 @@ description: "Run the multi-reviewer discussion and compile unified findings"
|
|
|
7
7
|
|
|
8
8
|
## Sequence of Instructions
|
|
9
9
|
|
|
10
|
+
> **Active reviewers only.** Read the active reviewer list from step 1 (determined by `user_instructions.review_scope`). Skip any reviewer section below whose code is not in the active list. Only active reviewers speak and produce findings.
|
|
11
|
+
|
|
12
|
+
> **User instructions (if `user_instructions.provided` is true):** Before each reviewer begins, they must:
|
|
13
|
+
> 1. Prioritize any `focus_areas` above their default checklist
|
|
14
|
+
> 2. Include all `custom_requirements` as mandatory checks (prefix each finding with "MANDATORY:")
|
|
15
|
+
> 3. Use `context_notes` as background — do not flag issues the user explicitly accepted as trade-offs
|
|
16
|
+
|
|
10
17
|
### 1. Round 1 — Each Reviewer's Initial Take
|
|
11
18
|
|
|
12
|
-
Go through the diff once per reviewer. Each reviewer applies rules from the PR knowledge base loaded in step 1
|
|
19
|
+
Go through the diff once per reviewer. Each reviewer applies rules from the PR knowledge base loaded in step 1, applies `user_instructions` (focus areas, mandatory requirements, context notes), and uses their domain expertise.
|
|
13
20
|
|
|
14
21
|
---
|
|
15
22
|
|
|
16
|
-
**👁️ Alex says:**
|
|
23
|
+
**👁️ Alex says:** *(skip if GR not in scope)*
|
|
17
24
|
|
|
18
25
|
[Alex reviews for: logic correctness, naming, readability, DRY violations, missing error handling, test coverage, side effects, resource cleanup, and stack-specific code quality issues from knowledge base]
|
|
19
26
|
|
|
@@ -25,7 +32,7 @@ Format each finding as:
|
|
|
25
32
|
|
|
26
33
|
---
|
|
27
34
|
|
|
28
|
-
**🔒 Sam says:**
|
|
35
|
+
**🔒 Sam says:** *(skip if SR not in scope)*
|
|
29
36
|
|
|
30
37
|
[Sam reviews for: secrets/credentials, SQL injection, XSS, authentication checks, authorization, rate limiting, error message exposure, OWASP Top 10, and stack-specific security threats from knowledge base]
|
|
31
38
|
|
|
@@ -38,7 +45,7 @@ Format each finding as:
|
|
|
38
45
|
|
|
39
46
|
---
|
|
40
47
|
|
|
41
|
-
**⚡ Petra says:**
|
|
48
|
+
**⚡ Petra says:** *(skip if PR not in scope)*
|
|
42
49
|
|
|
43
50
|
[Petra reviews for: N+1 queries, missing indexes, sync I/O on hot paths, unbound queries, missing caching, large payloads, memory leaks, inefficient loops, and stack-specific performance issues from knowledge base]
|
|
44
51
|
|
|
@@ -51,7 +58,7 @@ Format each finding as:
|
|
|
51
58
|
|
|
52
59
|
---
|
|
53
60
|
|
|
54
|
-
**🏗️ Arch says:**
|
|
61
|
+
**🏗️ Arch says:** *(skip if AR not in scope)*
|
|
55
62
|
|
|
56
63
|
[Arch reviews for: layer violations, circular dependencies, tight coupling, inconsistent patterns, shared module blast radius, backward compatibility breaks, and stack-specific architecture concerns from knowledge base]
|
|
57
64
|
|
|
@@ -66,7 +73,7 @@ Format each finding as:
|
|
|
66
73
|
|
|
67
74
|
### 2. Round 2 — Biz Translates + Cross-Review Discussion
|
|
68
75
|
|
|
69
|
-
**💼 Biz speaks last** — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
|
|
76
|
+
**💼 Biz speaks last** *(skip if BR not in scope)* — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
|
|
70
77
|
|
|
71
78
|
[Biz reviews for: user-facing regressions, feature completeness, data safety, deployment risk, observability gaps, compliance issues, and project-specific business concerns from knowledge base]
|
|
72
79
|
|
|
@@ -103,7 +110,7 @@ After discussion, produce a unified finding list, deduplicated and prioritized:
|
|
|
103
110
|
## 🎉 Party Mode — Unified Findings
|
|
104
111
|
|
|
105
112
|
**PR:** {target_branch} → {base_branch}
|
|
106
|
-
**Session participants:**
|
|
113
|
+
**Session participants:** {active reviewers from step 1}
|
|
107
114
|
|
|
108
115
|
### 🔴 Blockers ({count})
|
|
109
116
|
[all blockers from all reviewers, attributed to reviewer]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: party-mode
|
|
3
3
|
description: "Multi-reviewer discussion: all specialized agents review and debate the PR together"
|
|
4
4
|
main_config: "{project-root}/_prr/prr/config.yaml"
|
|
5
|
-
nextStep: "./steps/step-
|
|
5
|
+
nextStep: "./steps/step-00-user-instructions.md"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Party Mode Workflow 🎉
|
|
@@ -11,9 +11,10 @@ nextStep: "./steps/step-01-load-reviewers.md"
|
|
|
11
11
|
|
|
12
12
|
## WORKFLOW ARCHITECTURE
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
1.
|
|
16
|
-
2.
|
|
14
|
+
3-step process:
|
|
15
|
+
1. Collect user instructions (scope, focus, requirements, context) — always runs, user must respond
|
|
16
|
+
2. Load reviewer personas filtered by scope
|
|
17
|
+
3. Run structured discussion with each active reviewer contributing findings
|
|
17
18
|
|
|
18
19
|
## WHEN TO USE
|
|
19
20
|
|
|
@@ -26,9 +27,8 @@ Use Party Mode when you want:
|
|
|
26
27
|
## INITIALIZATION
|
|
27
28
|
|
|
28
29
|
Load config from `{main_config}`.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
If no PR context exists, prompt user to run [SP] Select PR first.
|
|
30
|
+
Use `session_output`, `target_branch`, `base_branch`, `pr_number` from working context.
|
|
31
|
+
If not set: prompt user to run [SS] Select Session or [SP] Select PR first.
|
|
32
32
|
|
|
33
33
|
## EXECUTION
|
|
34
34
|
|
|
@@ -21,9 +21,6 @@ auto_post_comment: false # Set to true to auto-post findings to GitH
|
|
|
21
21
|
# ─── Context Collection ────────────────────────────────────────────────────
|
|
22
22
|
context_collection:
|
|
23
23
|
enabled: true
|
|
24
|
-
skip_manual_input_context: false # Set to true to skip the manual context input prompt
|
|
25
|
-
# (default: false — agent will ask the user for additional context
|
|
26
|
-
# before building the knowledge base. User input is marked ⚠️ IMPORTANT)
|
|
27
24
|
mode: pr-specific # Always fresh, never cached
|
|
28
25
|
|
|
29
26
|
# Local primary sources (read if file exists)
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "step-05-confirm"
|
|
3
3
|
description: "Show PR scope summary and confirm before proceeding to review"
|
|
4
|
-
contextOutputFile: "{review_output}/current-pr-context.yaml"
|
|
5
4
|
---
|
|
6
5
|
|
|
7
6
|
# Step 5: Confirm Scope
|
|
@@ -10,10 +9,107 @@ contextOutputFile: "{review_output}/current-pr-context.yaml"
|
|
|
10
9
|
|
|
11
10
|
## STEP GOAL
|
|
12
11
|
|
|
13
|
-
Show a clear summary of what will be reviewed,
|
|
12
|
+
Show a clear summary of what will be reviewed, create the session output folder, store PR metadata in working context, and confirm the user wants to proceed.
|
|
14
13
|
|
|
15
14
|
## Sequence of Instructions
|
|
16
15
|
|
|
16
|
+
### 0. Compute Session Output Folder
|
|
17
|
+
|
|
18
|
+
Generate a unique, human-readable folder for this PR review session:
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
sanitized_branch = selected_branch
|
|
22
|
+
.toLowerCase()
|
|
23
|
+
.replace(/[^a-z0-9]+/g, '-')
|
|
24
|
+
.replace(/^-+|-+$/g, '')
|
|
25
|
+
.substring(0, 40)
|
|
26
|
+
|
|
27
|
+
if pr_number is set:
|
|
28
|
+
session_slug = "pr{pr_number}-{sanitized_branch}"
|
|
29
|
+
else:
|
|
30
|
+
session_slug = "{sanitized_branch}"
|
|
31
|
+
|
|
32
|
+
datetime_prefix = current datetime as "YYYY-MM-DD-HHmm" (e.g. 2026-03-02-1430)
|
|
33
|
+
|
|
34
|
+
session_output = "{review_output}/{datetime_prefix}-{session_slug}"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Examples:
|
|
38
|
+
- `_prr-output/reviews/2026-03-02-1430-pr44-feature-auth-login`
|
|
39
|
+
- `_prr-output/reviews/2026-03-02-1430-feature-auth-login`
|
|
40
|
+
|
|
41
|
+
Create the folder:
|
|
42
|
+
```bash
|
|
43
|
+
mkdir -p "{session_output}"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Store in working context** — all subsequent workflows in this session will use these values:
|
|
47
|
+
- `session_output` = computed above
|
|
48
|
+
- `target_branch` = `selected_branch` ← canonical name used by all downstream workflows
|
|
49
|
+
- `base_branch`, `diff_range`, `pr_number`, `pr_title`, `pr_author`, `pr_body`, `pr_head_sha`, `active_platform`, `platform_repo` = from step 3
|
|
50
|
+
|
|
51
|
+
### 0b. Generate Diffs Folder
|
|
52
|
+
|
|
53
|
+
Parse the diff already loaded in memory and write per-file markdown files under `{session_output}/diffs/`, mirroring the repo folder tree.
|
|
54
|
+
|
|
55
|
+
**For each changed file in the diff:**
|
|
56
|
+
|
|
57
|
+
1. Determine file path, status, and line counts from the diff header.
|
|
58
|
+
2. Construct output path: `{session_output}/diffs/{file_path}.md`
|
|
59
|
+
3. Create parent directories:
|
|
60
|
+
```bash
|
|
61
|
+
mkdir -p "{session_output}/diffs/{file_dir}"
|
|
62
|
+
```
|
|
63
|
+
4. Write the markdown file:
|
|
64
|
+
|
|
65
|
+
```markdown
|
|
66
|
+
# {file_path}
|
|
67
|
+
**Status:** {modified|added|deleted|renamed} | **+{lines_added} / -{lines_removed} lines**
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
**Line {start_line}** *(or **Lines {start}–{end}** for multi-line hunks)*
|
|
71
|
+
```diff
|
|
72
|
+
- old line content
|
|
73
|
+
+ new line content
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
*(repeat for each hunk in this file)*
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Rules:**
|
|
80
|
+
- **New file:** show all lines as `+` additions under a single hunk block.
|
|
81
|
+
- **Deleted file:** show all lines as `-` deletions under a single hunk block.
|
|
82
|
+
- **Renamed file with no content change:** write status line only, no diff blocks.
|
|
83
|
+
- **Renamed file with changes:** write status `renamed` and include change hunks as normal.
|
|
84
|
+
- One `.md` file per changed file. Folder structure mirrors the repo exactly.
|
|
85
|
+
|
|
86
|
+
**Example output for a modified file:**
|
|
87
|
+
|
|
88
|
+
```markdown
|
|
89
|
+
# src/auth/login.ts
|
|
90
|
+
**Status:** modified | **+45 / -12 lines**
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
**Line 23**
|
|
94
|
+
```diff
|
|
95
|
+
- const token = localStorage.getItem('token')
|
|
96
|
+
+ const token = cookieStorage.get('auth_token')
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Lines 67–70**
|
|
100
|
+
```diff
|
|
101
|
+
- async function login(user, pass) {
|
|
102
|
+
- const result = await db.users.findOne(user)
|
|
103
|
+
+ async function login(user: string, pass: string): Promise<User> {
|
|
104
|
+
+ const result = await db.users.findOne({ email: user })
|
|
105
|
+
```
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
After writing all files, print:
|
|
109
|
+
```
|
|
110
|
+
✓ Diffs saved: {file_count} files → {session_output}/diffs/
|
|
111
|
+
```
|
|
112
|
+
|
|
17
113
|
### 1. Display Scope Summary
|
|
18
114
|
|
|
19
115
|
Present a clear summary:
|
|
@@ -45,29 +141,7 @@ Recommended reviews for this PR:
|
|
|
45
141
|
[BR] Business Review — for feature PRs, data migrations, or any high-risk change
|
|
46
142
|
```
|
|
47
143
|
|
|
48
|
-
### 2.
|
|
49
|
-
|
|
50
|
-
Write `{contextOutputFile}` with:
|
|
51
|
-
|
|
52
|
-
```yaml
|
|
53
|
-
pr:
|
|
54
|
-
target_branch: "{selected_branch}"
|
|
55
|
-
base_branch: "{base_branch}"
|
|
56
|
-
pr_number: "{pr_number}"
|
|
57
|
-
pr_title: "{pr_title}"
|
|
58
|
-
diff_stats: |
|
|
59
|
-
{diff_stats}
|
|
60
|
-
commit_count: {commit_count}
|
|
61
|
-
files_changed:
|
|
62
|
-
{files_changed_list}
|
|
63
|
-
diff_strategy: "{diff_strategy}"
|
|
64
|
-
date: "{date}"
|
|
65
|
-
review:
|
|
66
|
-
completed: []
|
|
67
|
-
findings: []
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### 3. Ask for Confirmation
|
|
144
|
+
### 2. Ask for Confirmation
|
|
71
145
|
|
|
72
146
|
```
|
|
73
147
|
✅ Ready to review. Which review would you like to run first?
|
|
@@ -23,7 +23,7 @@ This uses **step-file architecture** with sequential orchestration:
|
|
|
23
23
|
- 🛑 NEVER start reviewing without completing this workflow first
|
|
24
24
|
- 📖 Read entire step file before executing
|
|
25
25
|
- ⏸️ ALWAYS halt at user selection points — never auto-select
|
|
26
|
-
- 💾
|
|
26
|
+
- 💾 Create session folder `{session_output}` and store PR metadata in working context after confirmation (step 5)
|
|
27
27
|
|
|
28
28
|
## INITIALIZATION
|
|
29
29
|
|
package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-manual-context-input.md
CHANGED
|
@@ -1,88 +1,102 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: "step-03-manual-context-input"
|
|
3
|
-
description: "Collect
|
|
3
|
+
description: "Collect user instructions, requirements, and context for this review session"
|
|
4
4
|
nextStepFile: "./step-04-build-knowledge-base.md"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
# Step 3:
|
|
7
|
+
# Step 3: User Instructions & Context
|
|
8
8
|
|
|
9
9
|
## Goal
|
|
10
|
-
|
|
10
|
+
Let the user guide the review — they can restrict scope, set focus areas, add mandatory requirements, or provide background context. Their input directly controls which reviews run and what each reviewer prioritizes.
|
|
11
11
|
|
|
12
12
|
## Sequence of Instructions
|
|
13
13
|
|
|
14
|
-
### 1.
|
|
14
|
+
### 1. Show Collection Summary
|
|
15
15
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
If `skip_manual_input_context: true`:
|
|
16
|
+
Print a brief summary of what was automatically collected so far:
|
|
19
17
|
|
|
20
18
|
```
|
|
21
|
-
|
|
19
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
20
|
+
✅ Auto-collection complete.
|
|
21
|
+
|
|
22
|
+
📊 Collected:
|
|
23
|
+
🗂️ Files changed: {files_count}
|
|
24
|
+
🎯 Domains: {domains_list}
|
|
25
|
+
🧩 Stacks: {stacks_list or "none"}
|
|
26
|
+
📘 Primary docs: {primary_docs_found}
|
|
27
|
+
⚙️ Config files: {config_files_found}
|
|
28
|
+
💬 Annotations: {annotations_count}
|
|
29
|
+
🔌 External: {mcp_and_rag_summary or "none"}
|
|
30
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
22
31
|
```
|
|
23
32
|
|
|
24
|
-
|
|
33
|
+
### 2. Prompt User
|
|
25
34
|
|
|
26
|
-
|
|
35
|
+
Display EXACTLY:
|
|
27
36
|
|
|
28
|
-
|
|
37
|
+
```
|
|
38
|
+
💬 Any instructions for this review?
|
|
39
|
+
Press Enter to run a full standard review, or type your instructions below.
|
|
40
|
+
|
|
41
|
+
You can specify:
|
|
42
|
+
• Scope "only security" / "security and architecture" / "skip performance"
|
|
43
|
+
• Focus "focus on SQL injection and rate limiting"
|
|
44
|
+
• Requirements "all API endpoints must have auth middleware"
|
|
45
|
+
• Context "hotfix — ignore refactoring suggestions"
|
|
46
|
+
• Mix freely "security only, focus on JWT handling, context: auth rewrite in progress"
|
|
47
|
+
```
|
|
29
48
|
|
|
30
|
-
|
|
49
|
+
**HALT — wait for user response before continuing.**
|
|
31
50
|
|
|
32
|
-
|
|
51
|
+
### 3. Parse Response
|
|
33
52
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
📊 Collected so far:
|
|
39
|
-
🗂️ Files changed: {files_count}
|
|
40
|
-
🎯 Domains: {domains_list}
|
|
41
|
-
🧩 Stacks detected: {stacks_list or "none"}
|
|
42
|
-
📘 Primary docs: {primary_docs_found}
|
|
43
|
-
⚙️ Config files: {config_files_found}
|
|
44
|
-
📚 Standards docs: {standards_docs_found}
|
|
45
|
-
💬 Inline annotations: {annotations_count}
|
|
46
|
-
🔌 External tools: {mcp_and_rag_summary or "none"}
|
|
47
|
-
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
48
|
-
```
|
|
53
|
+
**If user pressed Enter / left empty:**
|
|
54
|
+
- Set `user_instructions.provided` = `false`
|
|
55
|
+
- Set `user_instructions.review_scope` = `"all"`
|
|
56
|
+
- Set all other fields to `null`
|
|
49
57
|
|
|
50
|
-
|
|
58
|
+
**If user typed something**, parse the free-form text and extract:
|
|
51
59
|
|
|
52
|
-
|
|
60
|
+
**`review_scope`** — which reviews to run:
|
|
61
|
+
- Parse for scope signals: "only X", "just X", "X only", "skip X", "no X review", "X and Y"
|
|
62
|
+
- Map to codes: `GR` (general), `SR` (security), `PR` (performance), `AR` (architecture), `BR` (business), `IC` (improve code)
|
|
63
|
+
- Examples:
|
|
64
|
+
- "only security" → `[SR]`
|
|
65
|
+
- "security and architecture" → `[SR, AR]`
|
|
66
|
+
- "skip performance" → `[GR, SR, AR, BR]`
|
|
67
|
+
- "security, focus on JWT" → `[SR]` (scope signal found)
|
|
68
|
+
- "focus on SQL injection" (no scope signal) → `"all"` (focus only, all reviews still run)
|
|
69
|
+
- If no scope restriction found → `"all"`
|
|
53
70
|
|
|
54
|
-
|
|
55
|
-
💬 Do you have any additional context for the reviewers?
|
|
71
|
+
**`focus_areas`** — specific things reviewers must prioritize (list of strings), or `null` if none mentioned.
|
|
56
72
|
|
|
57
|
-
|
|
58
|
-
• Business context or requirements behind this PR
|
|
59
|
-
• Known trade-offs or constraints you accepted
|
|
60
|
-
• Specific areas you'd like reviewers to focus on
|
|
61
|
-
• Known issues or technical debt to be aware of
|
|
62
|
-
• Links to related tickets, designs, or decisions
|
|
73
|
+
**`custom_requirements`** — mandatory checks user specified (list of strings), or `null`.
|
|
63
74
|
|
|
64
|
-
|
|
65
|
-
```
|
|
75
|
+
**`context_notes`** — background info, trade-offs, constraints (list of strings), or `null`.
|
|
66
76
|
|
|
67
|
-
|
|
77
|
+
**`raw`** — full original text from user.
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
Set `user_instructions.provided` = `true`.
|
|
70
80
|
|
|
71
|
-
|
|
72
|
-
- Otherwise → store the full text as `manual_context`
|
|
81
|
+
### 4. Acknowledge
|
|
73
82
|
|
|
74
|
-
|
|
83
|
+
**If user provided instructions**, print a confirmation of what was parsed:
|
|
75
84
|
|
|
76
|
-
**If user provided context:**
|
|
77
85
|
```
|
|
78
|
-
✅
|
|
86
|
+
✅ Instructions captured — driving all downstream review steps.
|
|
87
|
+
|
|
88
|
+
📋 Scope: {scope_list joined with ", " OR "all reviews (standard)"}
|
|
89
|
+
🎯 Focus: {focus_areas joined with ", " OR "standard coverage"}
|
|
90
|
+
✅ Requirements: {custom_requirements joined with ", " OR "none"}
|
|
91
|
+
📝 Context: {context_notes joined with "; " OR "none"}
|
|
79
92
|
```
|
|
80
93
|
|
|
81
|
-
**If user
|
|
94
|
+
**If user left empty:**
|
|
95
|
+
|
|
82
96
|
```
|
|
83
|
-
|
|
97
|
+
▶️ Full standard review — all reviewers, standard focus.
|
|
84
98
|
```
|
|
85
99
|
|
|
86
|
-
###
|
|
100
|
+
### 5. Load Next Step
|
|
87
101
|
|
|
88
102
|
Add `step-03-manual-context-input` to `stepsCompleted`. Load: `{nextStepFile}`
|