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.
- package/README.md +137 -11
- package/package.json +1 -1
- package/src/core/agents/prr-master.agent.yaml +5 -1
- package/src/core/tasks/clear.md +36 -71
- package/src/core/tasks/help.md +2 -1
- 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 +22 -14
- package/src/core/workflows/party-mode/steps/step-02-discussion.md +8 -6
- 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 +96 -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 +24 -30
- package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +3 -5
- 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 +6 -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/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 +13 -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 +4 -5
- package/src/prr/workflows/6-report/post-comments/workflow.md +3 -2
- package/src/prr/workflows/quick/workflow.md +86 -28
|
@@ -7,13 +7,15 @@ 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
|
+
|
|
10
12
|
### 1. Round 1 — Each Reviewer's Initial Take
|
|
11
13
|
|
|
12
14
|
Go through the diff once per reviewer. Each reviewer applies rules from the PR knowledge base loaded in step 1 in addition to their domain expertise.
|
|
13
15
|
|
|
14
16
|
---
|
|
15
17
|
|
|
16
|
-
**👁️ Alex says:**
|
|
18
|
+
**👁️ Alex says:** *(skip if GR not in scope)*
|
|
17
19
|
|
|
18
20
|
[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
21
|
|
|
@@ -25,7 +27,7 @@ Format each finding as:
|
|
|
25
27
|
|
|
26
28
|
---
|
|
27
29
|
|
|
28
|
-
**🔒 Sam says:**
|
|
30
|
+
**🔒 Sam says:** *(skip if SR not in scope)*
|
|
29
31
|
|
|
30
32
|
[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
33
|
|
|
@@ -38,7 +40,7 @@ Format each finding as:
|
|
|
38
40
|
|
|
39
41
|
---
|
|
40
42
|
|
|
41
|
-
**⚡ Petra says:**
|
|
43
|
+
**⚡ Petra says:** *(skip if PR not in scope)*
|
|
42
44
|
|
|
43
45
|
[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
46
|
|
|
@@ -51,7 +53,7 @@ Format each finding as:
|
|
|
51
53
|
|
|
52
54
|
---
|
|
53
55
|
|
|
54
|
-
**🏗️ Arch says:**
|
|
56
|
+
**🏗️ Arch says:** *(skip if AR not in scope)*
|
|
55
57
|
|
|
56
58
|
[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
59
|
|
|
@@ -66,7 +68,7 @@ Format each finding as:
|
|
|
66
68
|
|
|
67
69
|
### 2. Round 2 — Biz Translates + Cross-Review Discussion
|
|
68
70
|
|
|
69
|
-
**💼 Biz speaks last** — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
|
|
71
|
+
**💼 Biz speaks last** *(skip if BR not in scope)* — synthesizes findings from Alex/Sam/Petra/Arch into business impact:
|
|
70
72
|
|
|
71
73
|
[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
74
|
|
|
@@ -103,7 +105,7 @@ After discussion, produce a unified finding list, deduplicated and prioritized:
|
|
|
103
105
|
## 🎉 Party Mode — Unified Findings
|
|
104
106
|
|
|
105
107
|
**PR:** {target_branch} → {base_branch}
|
|
106
|
-
**Session participants:**
|
|
108
|
+
**Session participants:** {active reviewers from step 1}
|
|
107
109
|
|
|
108
110
|
### 🔴 Blockers ({count})
|
|
109
111
|
[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,104 @@ 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 `session_output` in working context** — all subsequent workflows in this session will use it.
|
|
47
|
+
|
|
48
|
+
### 0b. Generate Diffs Folder
|
|
49
|
+
|
|
50
|
+
Parse the diff already loaded in memory and write per-file markdown files under `{session_output}/diffs/`, mirroring the repo folder tree.
|
|
51
|
+
|
|
52
|
+
**For each changed file in the diff:**
|
|
53
|
+
|
|
54
|
+
1. Determine file path, status, and line counts from the diff header.
|
|
55
|
+
2. Construct output path: `{session_output}/diffs/{file_path}.md`
|
|
56
|
+
3. Create parent directories:
|
|
57
|
+
```bash
|
|
58
|
+
mkdir -p "{session_output}/diffs/{file_dir}"
|
|
59
|
+
```
|
|
60
|
+
4. Write the markdown file:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
# {file_path}
|
|
64
|
+
**Status:** {modified|added|deleted|renamed} | **+{lines_added} / -{lines_removed} lines**
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
**Line {start_line}** *(or **Lines {start}–{end}** for multi-line hunks)*
|
|
68
|
+
```diff
|
|
69
|
+
- old line content
|
|
70
|
+
+ new line content
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
*(repeat for each hunk in this file)*
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Rules:**
|
|
77
|
+
- **New file:** show all lines as `+` additions under a single hunk block.
|
|
78
|
+
- **Deleted file:** show all lines as `-` deletions under a single hunk block.
|
|
79
|
+
- **Renamed file with no content change:** write status line only, no diff blocks.
|
|
80
|
+
- **Renamed file with changes:** write status `renamed` and include change hunks as normal.
|
|
81
|
+
- One `.md` file per changed file. Folder structure mirrors the repo exactly.
|
|
82
|
+
|
|
83
|
+
**Example output for a modified file:**
|
|
84
|
+
|
|
85
|
+
```markdown
|
|
86
|
+
# src/auth/login.ts
|
|
87
|
+
**Status:** modified | **+45 / -12 lines**
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
**Line 23**
|
|
91
|
+
```diff
|
|
92
|
+
- const token = localStorage.getItem('token')
|
|
93
|
+
+ const token = cookieStorage.get('auth_token')
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Lines 67–70**
|
|
97
|
+
```diff
|
|
98
|
+
- async function login(user, pass) {
|
|
99
|
+
- const result = await db.users.findOne(user)
|
|
100
|
+
+ async function login(user: string, pass: string): Promise<User> {
|
|
101
|
+
+ const result = await db.users.findOne({ email: user })
|
|
102
|
+
```
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
After writing all files, print:
|
|
106
|
+
```
|
|
107
|
+
✓ Diffs saved: {file_count} files → {session_output}/diffs/
|
|
108
|
+
```
|
|
109
|
+
|
|
17
110
|
### 1. Display Scope Summary
|
|
18
111
|
|
|
19
112
|
Present a clear summary:
|
|
@@ -45,29 +138,7 @@ Recommended reviews for this PR:
|
|
|
45
138
|
[BR] Business Review — for feature PRs, data migrations, or any high-risk change
|
|
46
139
|
```
|
|
47
140
|
|
|
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
|
|
141
|
+
### 2. Ask for Confirmation
|
|
71
142
|
|
|
72
143
|
```
|
|
73
144
|
✅ 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}`
|
package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-04-build-knowledge-base.md
CHANGED
|
@@ -32,15 +32,19 @@ pr_metadata:
|
|
|
32
32
|
files_changed: {n}
|
|
33
33
|
collected_at: {ISO timestamp}
|
|
34
34
|
|
|
35
|
-
# ⚠️ IMPORTANT — Human-provided
|
|
35
|
+
# ⚠️ IMPORTANT — Human-provided instructions from the user.
|
|
36
36
|
# All reviewers MUST read this section before starting any review.
|
|
37
|
-
#
|
|
38
|
-
|
|
37
|
+
# review_scope controls which reviews run. focus_areas, custom_requirements, and context_notes
|
|
38
|
+
# are highest-priority guidance — align all findings against them.
|
|
39
|
+
user_instructions:
|
|
39
40
|
# Populated only when the user provided input in step-03-manual-context-input.
|
|
40
41
|
# If provided: true — treat this content as the highest-priority context in this file.
|
|
41
42
|
provided: {true|false}
|
|
42
|
-
|
|
43
|
-
|
|
43
|
+
review_scope: {"all" | [SR] | [SR, AR] | ...} # "all" = run all reviews; list = only those codes
|
|
44
|
+
focus_areas: {list of strings, or null} # specific things every reviewer must prioritize
|
|
45
|
+
custom_requirements: {list of strings, or null} # mandatory checks the user specified
|
|
46
|
+
context_notes: {list of strings, or null} # background info, trade-offs, constraints
|
|
47
|
+
raw: {original text from user, or null} # verbatim input
|
|
44
48
|
|
|
45
49
|
files_analysis:
|
|
46
50
|
changed_files:
|
|
@@ -245,7 +249,7 @@ external_context:
|
|
|
245
249
|
|
|
246
250
|
review_priorities:
|
|
247
251
|
# Guide reviewers on what to focus on
|
|
248
|
-
# ⚠️ If
|
|
252
|
+
# ⚠️ If user_instructions.provided is true — reviewers MUST check findings against user_instructions first.
|
|
249
253
|
critical:
|
|
250
254
|
- "Verify no v-html with user input (security requirement)"
|
|
251
255
|
- "Check ESLint error-level rules compliance"
|
|
@@ -261,7 +265,10 @@ review_priorities:
|
|
|
261
265
|
- "Optional optimizations"
|
|
262
266
|
|
|
263
267
|
reviewer_guidance:
|
|
264
|
-
# ⚠️ If
|
|
268
|
+
# ⚠️ If user_instructions.provided is true:
|
|
269
|
+
# PREPEND each reviewer's list with user_instructions.focus_areas (if any)
|
|
270
|
+
# APPEND each reviewer's list with user_instructions.custom_requirements prefixed "MANDATORY: "
|
|
271
|
+
# Example: if focus_areas = ["JWT handling"], add "FOCUS: JWT handling" as first item
|
|
265
272
|
general_review:
|
|
266
273
|
- "Check for ESLint rule violations (no-var, prefer-const)"
|
|
267
274
|
- "Verify component naming follows standards"
|
|
@@ -287,29 +294,21 @@ context_sources:
|
|
|
287
294
|
config_files: [.eslintrc.js, .prettierrc]
|
|
288
295
|
standards_docs: [CONTRIBUTING.md, ARCHITECTURE.md]
|
|
289
296
|
inline_annotations: yes
|
|
290
|
-
|
|
297
|
+
user_instructions: {true|false} # true if user provided input in step-03
|
|
291
298
|
mcp_tools: [] # list of MCP tools actually used
|
|
292
299
|
rag_systems: [] # list of RAG systems queried
|
|
293
300
|
url_sources: [] # list of plain URLs fetched
|
|
294
301
|
```
|
|
295
302
|
|
|
296
|
-
### 3.
|
|
303
|
+
### 3. Output Filename
|
|
297
304
|
|
|
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
|
-
```
|
|
305
|
+
Always: `pr-context.yaml` — the session folder already identifies the PR uniquely.
|
|
307
306
|
|
|
308
307
|
### 4. Write Knowledge Base to File
|
|
309
308
|
|
|
310
|
-
Write to: `{
|
|
309
|
+
Write to: `{session_output}/pr-context.yaml`
|
|
311
310
|
|
|
312
|
-
Example: `_prr-output/pr-
|
|
311
|
+
Example: `_prr-output/reviews/2026-03-02-1430-pr123-feature-auth/pr-context.yaml`
|
|
313
312
|
|
|
314
313
|
### 5. Report Completion
|
|
315
314
|
|
|
@@ -322,9 +321,9 @@ Example: `_prr-output/pr-123-context.yaml`
|
|
|
322
321
|
• ESLint rules: {n}
|
|
323
322
|
• Guidelines: {m}
|
|
324
323
|
• Inline annotations: {k}
|
|
325
|
-
•
|
|
324
|
+
• User instructions: ⚠️ YES — scope: {scope}, focus: {focus_count} areas, requirements: {req_count}
|
|
326
325
|
OR
|
|
327
|
-
•
|
|
326
|
+
• User instructions: none — full standard review
|
|
328
327
|
• MCP tools used: {mcp_list or "none"}
|
|
329
328
|
• RAG patterns: {rag_count}
|
|
330
329
|
• Issue context: {issue_key or "none"}
|
|
@@ -337,16 +336,11 @@ Example: `_prr-output/pr-123-context.yaml`
|
|
|
337
336
|
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
338
337
|
```
|
|
339
338
|
|
|
340
|
-
### 6. Store
|
|
341
|
-
|
|
342
|
-
Update PR context file to include knowledge base path:
|
|
339
|
+
### 6. Store Knowledge Base Path in Working Context
|
|
343
340
|
|
|
344
|
-
|
|
345
|
-
# {review_output}/current-pr-context.yaml
|
|
346
|
-
pr_knowledge_base: "{review_output}/{filename}"
|
|
347
|
-
```
|
|
341
|
+
Store `pr_knowledge_base` = `{session_output}/pr-context.yaml` in working context.
|
|
348
342
|
|
|
349
|
-
|
|
343
|
+
Review workflows (GR, SR, PR, AR, BR) find the knowledge base via working context or directly at `{session_output}/pr-context.yaml`.
|
|
350
344
|
|
|
351
345
|
### 7. Workflow Complete
|
|
352
346
|
|
|
@@ -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
|
|
@@ -108,16 +108,14 @@ If a stack has no matching data file, skip it silently and proceed with general
|
|
|
108
108
|
4-step process:
|
|
109
109
|
1. **Analyze files** changed in PR — extract metadata, domains, and **detect technology stacks**
|
|
110
110
|
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).
|
|
111
|
+
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
112
|
4. **Build PR-specific knowledge base** — structured YAML with all context, stack rules, manual context, and reviewer guidance
|
|
113
113
|
|
|
114
114
|
## INITIALIZATION
|
|
115
115
|
|
|
116
116
|
Load config from `{main_config}`.
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
- If available: use `pr-{pr_number}-context.yaml`
|
|
120
|
-
- If not: use `pr-{branch_name}-context.yaml`
|
|
118
|
+
Output filename is always `pr-context.yaml` — the session folder already identifies the PR uniquely.
|
|
121
119
|
|
|
122
120
|
## EXECUTION
|
|
123
121
|
|
|
@@ -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
|
|
|
@@ -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`
|
|
@@ -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`
|