prr-kit 1.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/LICENSE +21 -0
- package/README.md +226 -0
- package/docs/assets/banner.svg +179 -0
- package/package.json +60 -0
- package/src/core/agents/prr-master.agent.yaml +80 -0
- package/src/core/module.yaml +19 -0
- package/src/core/tasks/help.md +37 -0
- package/src/core/tasks/workflow.xml +22 -0
- package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +68 -0
- package/src/core/workflows/party-mode/steps/step-02-discussion.md +125 -0
- package/src/core/workflows/party-mode/workflow.md +35 -0
- package/src/prr/agents/architecture-reviewer.agent.yaml +45 -0
- package/src/prr/agents/general-reviewer.agent.yaml +48 -0
- package/src/prr/agents/performance-reviewer.agent.yaml +45 -0
- package/src/prr/agents/security-reviewer.agent.yaml +43 -0
- package/src/prr/data/review-types.csv +39 -0
- package/src/prr/module.yaml +38 -0
- package/src/prr/workflows/0-setup/collect-project-context/steps/step-01-scan-configs.md +106 -0
- package/src/prr/workflows/0-setup/collect-project-context/steps/step-02-extract-rules.md +131 -0
- package/src/prr/workflows/0-setup/collect-project-context/steps/step-03-ask-context.md +194 -0
- package/src/prr/workflows/0-setup/collect-project-context/steps/step-04-save-context.md +161 -0
- package/src/prr/workflows/0-setup/collect-project-context/workflow.md +58 -0
- package/src/prr/workflows/1-discover/select-pr/steps/step-01-fetch.md +68 -0
- package/src/prr/workflows/1-discover/select-pr/steps/step-02-list-branches.md +95 -0
- package/src/prr/workflows/1-discover/select-pr/steps/step-03-select.md +127 -0
- package/src/prr/workflows/1-discover/select-pr/steps/step-04-load-diff.md +79 -0
- package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +76 -0
- package/src/prr/workflows/1-discover/select-pr/workflow.md +36 -0
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +37 -0
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-02-classify.md +50 -0
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-03-walkthrough.md +41 -0
- package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +50 -0
- package/src/prr/workflows/2-analyze/describe-pr/templates/pr-description.template.md +51 -0
- package/src/prr/workflows/2-analyze/describe-pr/workflow.md +28 -0
- package/src/prr/workflows/3-review/architecture-review/checklist.md +22 -0
- package/src/prr/workflows/3-review/architecture-review/instructions.xml +68 -0
- package/src/prr/workflows/3-review/architecture-review/workflow.yaml +18 -0
- package/src/prr/workflows/3-review/general-review/checklist.md +23 -0
- package/src/prr/workflows/3-review/general-review/instructions.xml +68 -0
- package/src/prr/workflows/3-review/general-review/workflow.yaml +18 -0
- package/src/prr/workflows/3-review/performance-review/checklist.md +22 -0
- package/src/prr/workflows/3-review/performance-review/instructions.xml +68 -0
- package/src/prr/workflows/3-review/performance-review/workflow.yaml +18 -0
- package/src/prr/workflows/3-review/security-review/checklist.md +25 -0
- package/src/prr/workflows/3-review/security-review/data/owasp-checklist.csv +19 -0
- package/src/prr/workflows/3-review/security-review/instructions.xml +70 -0
- package/src/prr/workflows/3-review/security-review/workflow.yaml +19 -0
- package/src/prr/workflows/4-improve/improve-code/checklist.md +18 -0
- package/src/prr/workflows/4-improve/improve-code/instructions.xml +59 -0
- package/src/prr/workflows/4-improve/improve-code/workflow.yaml +18 -0
- package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +37 -0
- package/src/prr/workflows/5-ask/ask-code/steps/step-02-answer.md +36 -0
- package/src/prr/workflows/5-ask/ask-code/workflow.md +31 -0
- package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +42 -0
- package/src/prr/workflows/6-report/generate-report/steps/step-02-organize.md +38 -0
- package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +44 -0
- package/src/prr/workflows/6-report/generate-report/templates/review-report.template.md +78 -0
- package/src/prr/workflows/6-report/generate-report/workflow.md +26 -0
- package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +166 -0
- package/src/prr/workflows/6-report/post-comments/steps/step-02-post.md +97 -0
- package/src/prr/workflows/6-report/post-comments/workflow.md +45 -0
- package/src/prr/workflows/quick/workflow.md +244 -0
- package/tools/cli/commands/install.js +66 -0
- package/tools/cli/commands/status.js +36 -0
- package/tools/cli/commands/uninstall.js +38 -0
- package/tools/cli/installers/lib/core/config-collector.js +47 -0
- package/tools/cli/installers/lib/core/detector.js +46 -0
- package/tools/cli/installers/lib/core/installer.js +162 -0
- package/tools/cli/installers/lib/core/manifest-generator.js +172 -0
- package/tools/cli/installers/lib/core/manifest.js +62 -0
- package/tools/cli/installers/lib/ide/_base-ide.js +36 -0
- package/tools/cli/installers/lib/ide/_config-driven.js +167 -0
- package/tools/cli/installers/lib/ide/manager.js +97 -0
- package/tools/cli/installers/lib/ide/platform-codes.yaml +76 -0
- package/tools/cli/installers/lib/ide/shared/path-utils.js +11 -0
- package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +16 -0
- package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +7 -0
- package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +5 -0
- package/tools/cli/lib/agent/compiler.js +123 -0
- package/tools/cli/lib/agent/template-engine.js +73 -0
- package/tools/cli/lib/cli-utils.js +32 -0
- package/tools/cli/lib/prompts.js +15 -0
- package/tools/cli/lib/ui.js +132 -0
- package/tools/cli/lib/xml-utils.js +24 -0
- package/tools/cli/prr-cli.js +36 -0
- package/tools/prr-npx-wrapper.js +6 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-03-select"
|
|
3
|
+
description: "User selects PR/MR by number (primary) or branch names (fallback)"
|
|
4
|
+
nextStepFile: "./step-04-load-diff.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 3: Select PR / MR
|
|
8
|
+
|
|
9
|
+
**Progress: Step 3 of 5** — Selecting review target
|
|
10
|
+
|
|
11
|
+
## STEP GOAL
|
|
12
|
+
|
|
13
|
+
User picks a PR/MR by number — base and head are resolved automatically from the platform.
|
|
14
|
+
Fall back to explicit head + base branch selection if no platform is configured.
|
|
15
|
+
|
|
16
|
+
## Sequence of Instructions
|
|
17
|
+
|
|
18
|
+
### 1. Present Selection Prompt
|
|
19
|
+
|
|
20
|
+
**If `pr_list_available = true`** (platform PR/MR list was shown):
|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
🎯 Select a PR/MR to review:
|
|
24
|
+
|
|
25
|
+
Enter PR/MR number (e.g., 44)
|
|
26
|
+
Or type a branch name directly (e.g., feature/my-feature)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**HALT — wait for user to respond.**
|
|
30
|
+
|
|
31
|
+
**If `pr_list_available = false`** (no platform / branch list only):
|
|
32
|
+
|
|
33
|
+
Display EXACTLY:
|
|
34
|
+
```
|
|
35
|
+
🎯 Head branch (the branch to review)?
|
|
36
|
+
|
|
37
|
+
You can:
|
|
38
|
+
• Enter a number from the list (e.g., 1)
|
|
39
|
+
• Type the branch name directly (e.g., feature/my-feature)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
**HALT — wait for head branch response.**
|
|
43
|
+
|
|
44
|
+
Then display EXACTLY:
|
|
45
|
+
```
|
|
46
|
+
🎯 Base branch (what to diff against)?
|
|
47
|
+
|
|
48
|
+
You can:
|
|
49
|
+
• Press Enter to use the default [main]
|
|
50
|
+
• Type the branch name directly (e.g., develop)
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**HALT — wait for base branch response.**
|
|
54
|
+
If user presses Enter without typing, detect `origin/main` or `origin/master`.
|
|
55
|
+
|
|
56
|
+
Set `selected_branch` = head input, `base_branch` = base input, `pr_number` = empty.
|
|
57
|
+
Set `diff_range` = `{base_branch}...{selected_branch}`.
|
|
58
|
+
Skip directly to step 4.
|
|
59
|
+
|
|
60
|
+
### 2. Parse Input and Resolve Base/Head (Platform flow only)
|
|
61
|
+
|
|
62
|
+
*Applies only when `pr_list_available = true`.*
|
|
63
|
+
|
|
64
|
+
#### Case A: User enters a PR/MR number (e.g., `44` or `#44`)
|
|
65
|
+
|
|
66
|
+
Run the appropriate command to fetch metadata:
|
|
67
|
+
|
|
68
|
+
**GitHub:**
|
|
69
|
+
```bash
|
|
70
|
+
gh pr view {number} --repo {platform_repo} \
|
|
71
|
+
--json number,title,headRefName,baseRefName,author,body,headRefOid
|
|
72
|
+
```
|
|
73
|
+
Extract: `headRefName` → `selected_branch`, `baseRefName` → `base_branch`, `headRefOid` → `pr_head_sha`.
|
|
74
|
+
|
|
75
|
+
**GitLab:**
|
|
76
|
+
```bash
|
|
77
|
+
glab mr view {number} --repo {platform_repo} --output json
|
|
78
|
+
```
|
|
79
|
+
Extract: `source_branch` → `selected_branch`, `target_branch` → `base_branch`.
|
|
80
|
+
Get head SHA: `git -C {target_repo} rev-parse origin/{selected_branch}` → `pr_head_sha`.
|
|
81
|
+
|
|
82
|
+
**Azure DevOps:**
|
|
83
|
+
```bash
|
|
84
|
+
az repos pr show --id {number} --output json
|
|
85
|
+
```
|
|
86
|
+
Extract: `sourceRefName` (strip `refs/heads/`) → `selected_branch`, `targetRefName` → `base_branch`.
|
|
87
|
+
|
|
88
|
+
**Bitbucket:**
|
|
89
|
+
```bash
|
|
90
|
+
curl https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{number}
|
|
91
|
+
```
|
|
92
|
+
Extract: `source.branch.name` → `selected_branch`, `destination.branch.name` → `base_branch`.
|
|
93
|
+
|
|
94
|
+
Set: `pr_number` = number, `pr_title` = title, `pr_author` = author.
|
|
95
|
+
|
|
96
|
+
Display confirmation:
|
|
97
|
+
```
|
|
98
|
+
✓ PR #{pr_number} selected
|
|
99
|
+
Title: {pr_title}
|
|
100
|
+
Head: {selected_branch}
|
|
101
|
+
Base: {base_branch} ← from platform definition
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
#### Case B: User enters a number from the branch list (e.g., `2`)
|
|
105
|
+
|
|
106
|
+
Map to branch at that position from step 2.
|
|
107
|
+
Set `selected_branch` = that branch. Set `pr_number` = empty.
|
|
108
|
+
Detect `base_branch`: check `origin/main` → `origin/master` → ask user.
|
|
109
|
+
|
|
110
|
+
#### Case C: User enters a branch name directly (e.g., `feature/my-feature`)
|
|
111
|
+
|
|
112
|
+
Set `selected_branch` = provided name (add `origin/` if missing). Set `pr_number` = empty.
|
|
113
|
+
Try to find a matching PR/MR on the platform and use its base branch. If not found, detect base same as Case B.
|
|
114
|
+
|
|
115
|
+
### 3. Store Selection
|
|
116
|
+
|
|
117
|
+
Store for subsequent steps:
|
|
118
|
+
- `selected_branch`, `base_branch`, `diff_range` = `{base_branch}...{selected_branch}`
|
|
119
|
+
- `pr_number`, `pr_title`, `pr_author`, `pr_body`
|
|
120
|
+
- `pr_head_sha` (or `git -C {target_repo} rev-parse origin/{selected_branch}` if not set)
|
|
121
|
+
- `active_platform` = `{platform}` or `{detected_platform}`
|
|
122
|
+
|
|
123
|
+
### 4. Update Frontmatter and Load Next Step
|
|
124
|
+
|
|
125
|
+
Add `step-03-select` to `stepsCompleted`.
|
|
126
|
+
|
|
127
|
+
Read fully and follow: `{nextStepFile}`
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-04-load-diff"
|
|
3
|
+
description: "Load the full diff using platform CLI or git"
|
|
4
|
+
nextStepFile: "./step-05-confirm.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 4: Load PR Diff
|
|
8
|
+
|
|
9
|
+
**Progress: Step 4 of 5** — Loading diff and commit history
|
|
10
|
+
|
|
11
|
+
## STEP GOAL
|
|
12
|
+
|
|
13
|
+
Load the complete diff. Use the platform's native diff command when available
|
|
14
|
+
(matches exactly what reviewers see on the platform). Fall back to `git diff` otherwise.
|
|
15
|
+
|
|
16
|
+
## Sequence of Instructions
|
|
17
|
+
|
|
18
|
+
### 1. Load Commit Log
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git -C {target_repo} log --oneline {diff_range}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Store as `commit_log`. Count → `commit_count`.
|
|
25
|
+
|
|
26
|
+
### 2. Load Diff
|
|
27
|
+
|
|
28
|
+
Use the first available method:
|
|
29
|
+
|
|
30
|
+
**GitHub** (if `active_platform = github` and `pr_number` is set):
|
|
31
|
+
```bash
|
|
32
|
+
gh pr diff {pr_number} --repo {platform_repo}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
**GitLab** (if `active_platform = gitlab` and `pr_number` is set):
|
|
36
|
+
```bash
|
|
37
|
+
glab mr diff {pr_number} --repo {platform_repo}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
**Azure DevOps** (if `active_platform = azure` and `pr_number` is set):
|
|
41
|
+
```bash
|
|
42
|
+
az repos pr show --id {pr_number} --output json
|
|
43
|
+
# then use git diff with the extracted base/head SHAs
|
|
44
|
+
git -C {target_repo} diff {base_branch}...{selected_branch}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Bitbucket / None / fallback** (any other case):
|
|
48
|
+
```bash
|
|
49
|
+
git -C {target_repo} diff {diff_range}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### 3. Load File Change Summary
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git -C {target_repo} diff --stat {diff_range}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Store as `diff_stats`. Extract `files_changed_count`, `files_changed` list, `lines_added`, `lines_removed`.
|
|
59
|
+
|
|
60
|
+
### 4. Assess Size and Set Strategy
|
|
61
|
+
|
|
62
|
+
- **< 300 lines**: `diff_strategy = 'full'` ✅
|
|
63
|
+
- **300–1000 lines**: `diff_strategy = 'chunked'` 📋
|
|
64
|
+
- **> 1000 lines**: `diff_strategy = 'chunked'` ⚠️ warn user
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
📊 Diff loaded:
|
|
68
|
+
Platform: {active_platform}
|
|
69
|
+
Commits: {commit_count}
|
|
70
|
+
Files: {files_changed_count}
|
|
71
|
+
Lines: +{lines_added} / -{lines_removed}
|
|
72
|
+
Strategy: {diff_strategy}
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### 5. Update Frontmatter and Load Next Step
|
|
76
|
+
|
|
77
|
+
Add `step-04-load-diff` to `stepsCompleted`.
|
|
78
|
+
|
|
79
|
+
Read fully and follow: `{nextStepFile}`
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-05-confirm"
|
|
3
|
+
description: "Show PR scope summary and confirm before proceeding to review"
|
|
4
|
+
contextOutputFile: "{review_output}/current-pr-context.yaml"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 5: Confirm Scope
|
|
8
|
+
|
|
9
|
+
**Progress: Step 5 of 5** — Confirming review scope
|
|
10
|
+
|
|
11
|
+
## STEP GOAL
|
|
12
|
+
|
|
13
|
+
Show a clear summary of what will be reviewed, write PR context to file, and confirm the user wants to proceed.
|
|
14
|
+
|
|
15
|
+
## Sequence of Instructions
|
|
16
|
+
|
|
17
|
+
### 1. Display Scope Summary
|
|
18
|
+
|
|
19
|
+
Present a clear summary:
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
23
|
+
📋 PR Review Scope
|
|
24
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
25
|
+
Target: {selected_branch}
|
|
26
|
+
Base: {base_branch}
|
|
27
|
+
PR #: {pr_number} (if applicable)
|
|
28
|
+
Title: {pr_title} (if available)
|
|
29
|
+
|
|
30
|
+
📊 Diff Statistics:
|
|
31
|
+
Commits: {commit_count}
|
|
32
|
+
Files: {files_changed_count}
|
|
33
|
+
{diff_stats}
|
|
34
|
+
|
|
35
|
+
⚠️ Review Strategy: {diff_strategy}
|
|
36
|
+
(chunked = reviews will process file by file for accuracy)
|
|
37
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
38
|
+
|
|
39
|
+
Recommended reviews for this PR:
|
|
40
|
+
[DP] Describe PR — understand changes before reviewing
|
|
41
|
+
[GR] General Review — always recommended
|
|
42
|
+
[SR] Security Review — if auth/API/user data touched
|
|
43
|
+
[PR] Performance Review — if DB/async/frontend affected
|
|
44
|
+
[AR] Architecture Review — if new patterns/structure added
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### 2. Write PR Context File
|
|
48
|
+
|
|
49
|
+
Write `{contextOutputFile}` with:
|
|
50
|
+
|
|
51
|
+
```yaml
|
|
52
|
+
pr:
|
|
53
|
+
target_branch: "{selected_branch}"
|
|
54
|
+
base_branch: "{base_branch}"
|
|
55
|
+
pr_number: "{pr_number}"
|
|
56
|
+
pr_title: "{pr_title}"
|
|
57
|
+
diff_stats: |
|
|
58
|
+
{diff_stats}
|
|
59
|
+
commit_count: {commit_count}
|
|
60
|
+
files_changed:
|
|
61
|
+
{files_changed_list}
|
|
62
|
+
diff_strategy: "{diff_strategy}"
|
|
63
|
+
date: "{date}"
|
|
64
|
+
review:
|
|
65
|
+
completed: []
|
|
66
|
+
findings: []
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### 3. Ask for Confirmation
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
✅ Ready to review. Which review would you like to run first?
|
|
73
|
+
(Enter a command from the menu, or type 'DP' to start with Describe PR)
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**HALT — wait for user response.** The workflow is complete. User returns to the agent menu.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: select-pr
|
|
3
|
+
description: "Fetch latest from remote, list branches/PRs, select target for review, load diff and confirm scope"
|
|
4
|
+
main_config: "{project-root}/_prr/prr/config.yaml"
|
|
5
|
+
nextStep: "./steps/step-01-fetch.md"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Select PR Workflow
|
|
9
|
+
|
|
10
|
+
**Goal:** Clarify exactly which PR/branch to review by fetching latest from remote, listing available branches, letting the user select, loading the diff, and confirming scope before any review begins.
|
|
11
|
+
|
|
12
|
+
## WORKFLOW ARCHITECTURE
|
|
13
|
+
|
|
14
|
+
This uses **step-file architecture** with sequential orchestration:
|
|
15
|
+
|
|
16
|
+
- Step 01: `git fetch` to ensure latest state from remote
|
|
17
|
+
- Step 02: List branches sorted by recency, show commit summary
|
|
18
|
+
- Step 03: User selects branch, PR number, or enters commit range
|
|
19
|
+
- Step 04: Load full diff and commit log for selected PR
|
|
20
|
+
- Step 05: Show scope summary (files changed, lines +/-), confirm before proceeding
|
|
21
|
+
|
|
22
|
+
**Rules (NO EXCEPTIONS):**
|
|
23
|
+
- 🛑 NEVER start reviewing without completing this workflow first
|
|
24
|
+
- 📖 Read entire step file before executing
|
|
25
|
+
- ⏸️ ALWAYS halt at user selection points — never auto-select
|
|
26
|
+
- 💾 Write PR context to `{review_output}/current-pr-context.yaml` after confirmation
|
|
27
|
+
|
|
28
|
+
## INITIALIZATION
|
|
29
|
+
|
|
30
|
+
Load config from `{main_config}` and resolve:
|
|
31
|
+
- `project_name`, `target_repo`, `user_name`, `communication_language`
|
|
32
|
+
- `review_output`, `github_repo`, `date` (system-generated)
|
|
33
|
+
|
|
34
|
+
## EXECUTION
|
|
35
|
+
|
|
36
|
+
Read fully and follow: `{nextStep}`
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-01-load-context"
|
|
3
|
+
description: "Load PR context and diff for analysis"
|
|
4
|
+
nextStepFile: "./step-02-classify.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 1: Load PR Context
|
|
8
|
+
|
|
9
|
+
## STEP GOAL
|
|
10
|
+
|
|
11
|
+
Load the PR context file and the actual code diff for analysis.
|
|
12
|
+
|
|
13
|
+
## Sequence of Instructions
|
|
14
|
+
|
|
15
|
+
### 1. Load PR Context
|
|
16
|
+
|
|
17
|
+
Read `{review_output}/current-pr-context.yaml`.
|
|
18
|
+
|
|
19
|
+
If file not found:
|
|
20
|
+
```
|
|
21
|
+
❌ No PR selected yet. Please run [SP] Select PR first.
|
|
22
|
+
```
|
|
23
|
+
Stop workflow.
|
|
24
|
+
|
|
25
|
+
### 2. Load the Diff
|
|
26
|
+
|
|
27
|
+
Run `git diff {base_branch}...{target_branch}` in `{target_repo}`.
|
|
28
|
+
|
|
29
|
+
Also run `git log --oneline {base_branch}...{target_branch}` for commit messages.
|
|
30
|
+
|
|
31
|
+
### 3. Load Commit Messages
|
|
32
|
+
|
|
33
|
+
Commit messages often reveal the intent of the PR — critical for understanding why changes were made.
|
|
34
|
+
|
|
35
|
+
### 4. Update and Load Next Step
|
|
36
|
+
|
|
37
|
+
Add `step-01-load-context` to `stepsCompleted`. Load: `{nextStepFile}`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-02-classify"
|
|
3
|
+
description: "Classify PR type and determine review recommendations"
|
|
4
|
+
nextStepFile: "./step-03-walkthrough.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 2: Classify PR
|
|
8
|
+
|
|
9
|
+
## STEP GOAL
|
|
10
|
+
|
|
11
|
+
Analyze the diff and commit messages to classify the PR type and generate review recommendations.
|
|
12
|
+
|
|
13
|
+
## Sequence of Instructions
|
|
14
|
+
|
|
15
|
+
### 1. Classify PR Type
|
|
16
|
+
|
|
17
|
+
Analyze the diff to determine the PRIMARY type (pick the best match):
|
|
18
|
+
|
|
19
|
+
| Type | Indicators |
|
|
20
|
+
|------|-----------|
|
|
21
|
+
| `bugfix` | Fix in logic, error handling, condition fix |
|
|
22
|
+
| `feature` | New files, new functions, new UI components |
|
|
23
|
+
| `refactor` | Same behavior, restructured code, renamed variables |
|
|
24
|
+
| `performance` | Caching, query optimization, async improvements |
|
|
25
|
+
| `security` | Auth changes, input validation, dependency updates |
|
|
26
|
+
| `test` | Only test file changes |
|
|
27
|
+
| `docs` | Only documentation/comment changes |
|
|
28
|
+
| `config` | Config files, env, CI/CD changes |
|
|
29
|
+
| `chore` | Dependency updates, tooling, build changes |
|
|
30
|
+
|
|
31
|
+
### 2. Assess Risk Level
|
|
32
|
+
|
|
33
|
+
Based on PR type and what was changed:
|
|
34
|
+
- **🔴 High Risk**: Auth changes, payment logic, user data handling, security-critical paths
|
|
35
|
+
- **🟡 Medium Risk**: Core business logic, API changes, database schema
|
|
36
|
+
- **🟢 Low Risk**: UI tweaks, docs, test additions, minor refactors
|
|
37
|
+
|
|
38
|
+
### 3. Generate Review Recommendations
|
|
39
|
+
|
|
40
|
+
Based on classification, recommend specific reviews:
|
|
41
|
+
- bugfix → GR (general) + SR (if security-related)
|
|
42
|
+
- feature → GR + AR (architecture) + PR (if DB/async)
|
|
43
|
+
- security → SR (mandatory) + GR
|
|
44
|
+
- performance → PR + GR
|
|
45
|
+
- refactor → AR + GR
|
|
46
|
+
- All high-risk PRs → SR mandatory
|
|
47
|
+
|
|
48
|
+
### 4. Load Next Step
|
|
49
|
+
|
|
50
|
+
Add `step-02-classify` to `stepsCompleted`. Load: `{nextStepFile}`
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-03-walkthrough"
|
|
3
|
+
description: "Generate file-by-file walkthrough explaining what changed and why"
|
|
4
|
+
nextStepFile: "./step-04-output.md"
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 3: File-by-File Walkthrough
|
|
8
|
+
|
|
9
|
+
## STEP GOAL
|
|
10
|
+
|
|
11
|
+
Generate a concise walkthrough of each changed file — what changed, why it changed (based on diff + commit context), and what reviewers should pay attention to.
|
|
12
|
+
|
|
13
|
+
## Sequence of Instructions
|
|
14
|
+
|
|
15
|
+
### 1. Group Files by Purpose
|
|
16
|
+
|
|
17
|
+
Group changed files logically:
|
|
18
|
+
- **Backend** (controllers, services, models, routes, middleware)
|
|
19
|
+
- **Frontend** (components, views, stores, utils)
|
|
20
|
+
- **Config/Infrastructure** (docker, env, CI, package.json)
|
|
21
|
+
- **Tests**
|
|
22
|
+
- **Docs**
|
|
23
|
+
|
|
24
|
+
### 2. For Each Changed File, Generate Summary
|
|
25
|
+
|
|
26
|
+
For each file (or group of related files), describe:
|
|
27
|
+
- **What changed**: 1-2 sentences on the actual change
|
|
28
|
+
- **Why** (inferred from commit messages and context): 1 sentence
|
|
29
|
+
- **Review focus**: what should reviewers specifically look at
|
|
30
|
+
|
|
31
|
+
Format:
|
|
32
|
+
```
|
|
33
|
+
📄 backend/controllers/authController.js (+45 -12)
|
|
34
|
+
What: Added JWT refresh token endpoint and token blacklisting logic
|
|
35
|
+
Why: Fixes security issue where expired tokens could still be used
|
|
36
|
+
Focus: Check token validation logic and blacklist cleanup mechanism
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 3. Load Next Step
|
|
40
|
+
|
|
41
|
+
Add `step-03-walkthrough` to `stepsCompleted`. Load: `{nextStepFile}`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "step-04-output"
|
|
3
|
+
description: "Write PR description to file and display summary"
|
|
4
|
+
outputFile: "{review_output}/pr-description-{date}.md"
|
|
5
|
+
templateFile: "../templates/pr-description.template.md"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Step 4: Output PR Description
|
|
9
|
+
|
|
10
|
+
## STEP GOAL
|
|
11
|
+
|
|
12
|
+
Compile all analysis into a structured PR description file and display summary to the reviewer.
|
|
13
|
+
|
|
14
|
+
## Sequence of Instructions
|
|
15
|
+
|
|
16
|
+
### 1. Generate PR Description
|
|
17
|
+
|
|
18
|
+
Using the template at `{templateFile}`, generate the PR description with:
|
|
19
|
+
- PR metadata (branch, base, PR number if applicable)
|
|
20
|
+
- PR type and risk level
|
|
21
|
+
- Executive summary (3-5 bullet points of key changes)
|
|
22
|
+
- File-by-file walkthrough
|
|
23
|
+
- Recommended reviews with rationale
|
|
24
|
+
|
|
25
|
+
### 2. Write to File
|
|
26
|
+
|
|
27
|
+
Write to `{outputFile}` (replace {date} with actual date: YYYY-MM-DD).
|
|
28
|
+
|
|
29
|
+
### 3. Update PR Context
|
|
30
|
+
|
|
31
|
+
Update `{review_output}/current-pr-context.yaml`:
|
|
32
|
+
- Add `description_generated: true`
|
|
33
|
+
- Add `pr_type: "{classified_type}"`
|
|
34
|
+
- Add `risk_level: "{risk_level}"`
|
|
35
|
+
|
|
36
|
+
### 4. Display Summary
|
|
37
|
+
|
|
38
|
+
Show the user:
|
|
39
|
+
```
|
|
40
|
+
✅ PR Description generated: {outputFile}
|
|
41
|
+
|
|
42
|
+
PR Type: {type} | Risk: {risk_level}
|
|
43
|
+
Summary:
|
|
44
|
+
{executive_summary_bullets}
|
|
45
|
+
|
|
46
|
+
Recommended next steps:
|
|
47
|
+
{recommended_reviews}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Workflow complete. Return to agent menu.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
pr_branch: "{{target_branch}}"
|
|
3
|
+
base_branch: "{{base_branch}}"
|
|
4
|
+
pr_number: "{{pr_number}}"
|
|
5
|
+
pr_type: "{{pr_type}}"
|
|
6
|
+
risk_level: "{{risk_level}}"
|
|
7
|
+
date: "{{date}}"
|
|
8
|
+
generated_by: "prr-describe-pr"
|
|
9
|
+
stepsCompleted: []
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# PR Review: {{pr_title}}
|
|
13
|
+
|
|
14
|
+
**Branch:** `{{target_branch}}` → `{{base_branch}}`
|
|
15
|
+
{{#if pr_number}}**PR #{{pr_number}}** | {{/if}}**Type:** {{pr_type}} | **Risk:** {{risk_level}} | **Date:** {{date}}
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Executive Summary
|
|
20
|
+
|
|
21
|
+
{{executive_summary}}
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## PR Statistics
|
|
26
|
+
|
|
27
|
+
- **Commits:** {{commit_count}}
|
|
28
|
+
- **Files Changed:** {{files_changed_count}}
|
|
29
|
+
- **Lines:** +{{lines_added}} / -{{lines_removed}}
|
|
30
|
+
|
|
31
|
+
### Changed Files Overview
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
{{diff_stats}}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## File-by-File Walkthrough
|
|
40
|
+
|
|
41
|
+
{{walkthrough}}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Recommended Reviews
|
|
46
|
+
|
|
47
|
+
{{recommended_reviews}}
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
*Generated by PR Review Framework*
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: describe-pr
|
|
3
|
+
description: "Auto-generate PR type classification, executive summary, and file-by-file walkthrough"
|
|
4
|
+
main_config: "{project-root}/_prr/prr/config.yaml"
|
|
5
|
+
nextStep: "./steps/step-01-load-context.md"
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Describe PR Workflow
|
|
9
|
+
|
|
10
|
+
**Goal:** Generate a structured PR description — type classification, executive summary, and file-by-file walkthrough — to give reviewers full context before diving into detailed review.
|
|
11
|
+
|
|
12
|
+
## WORKFLOW ARCHITECTURE
|
|
13
|
+
|
|
14
|
+
4-step sequential process:
|
|
15
|
+
1. Load PR context (from select-pr output)
|
|
16
|
+
2. Classify PR type (bugfix/feature/refactor/docs/test/chore)
|
|
17
|
+
3. Generate file-by-file walkthrough (what changed and why)
|
|
18
|
+
4. Output structured PR description to file
|
|
19
|
+
|
|
20
|
+
## INITIALIZATION
|
|
21
|
+
|
|
22
|
+
Load config from `{main_config}`.
|
|
23
|
+
Load PR context from `{review_output}/current-pr-context.yaml`.
|
|
24
|
+
If context file does not exist, instruct user to run [SP] Select PR first.
|
|
25
|
+
|
|
26
|
+
## EXECUTION
|
|
27
|
+
|
|
28
|
+
Read fully and follow: `{nextStep}`
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "Architecture Review Completion Checklist"
|
|
3
|
+
validation-target: "Architecture review output file"
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Architecture Review Checklist
|
|
7
|
+
|
|
8
|
+
## Coverage
|
|
9
|
+
- [ ] Layer/separation of concerns checked
|
|
10
|
+
- [ ] Coupling and module dependencies reviewed
|
|
11
|
+
- [ ] Consistency with existing codebase patterns assessed
|
|
12
|
+
- [ ] SOLID violations checked (only real ones, not theoretical)
|
|
13
|
+
|
|
14
|
+
## Finding Quality
|
|
15
|
+
- [ ] Every finding references the EXISTING pattern that should be followed
|
|
16
|
+
- [ ] Over-engineering suggestions are avoided (consistency > theoretical purity)
|
|
17
|
+
- [ ] Every finding has: file path + what pattern was violated
|
|
18
|
+
- [ ] Justification provided for why the finding matters (not just "violates SOLID")
|
|
19
|
+
|
|
20
|
+
## Output
|
|
21
|
+
- [ ] Findings written to `{review_output}/architecture-review-{date}.md`
|
|
22
|
+
- [ ] PR context updated with `architecture-review` in completed list
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<workflow>
|
|
2
|
+
<critical>Workflow engine rules: {project-root}/_prr/core/tasks/workflow.xml</critical>
|
|
3
|
+
<critical>Communicate all responses in {communication_language}</critical>
|
|
4
|
+
<critical>Consistency with EXISTING codebase patterns is paramount — avoid over-engineering or introducing new patterns without strong justification</critical>
|
|
5
|
+
<critical>Always consider: would a new team member understand where this code belongs and why?</critical>
|
|
6
|
+
|
|
7
|
+
<step n="1" goal="Load PR context and understand the codebase structure">
|
|
8
|
+
<check if="{pr_context} does not exist">
|
|
9
|
+
<output>❌ No PR selected. Please run [SP] Select PR first.</output>
|
|
10
|
+
<stop/>
|
|
11
|
+
</check>
|
|
12
|
+
<action>Read {pr_context} and load git diff</action>
|
|
13
|
+
<action>Also examine surrounding non-changed files to understand existing patterns</action>
|
|
14
|
+
<output>🏗️ Starting Architecture Review
|
|
15
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
16
|
+
Focus: Layer violations | Coupling | SOLID | Codebase consistency
|
|
17
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
|
|
18
|
+
</step>
|
|
19
|
+
|
|
20
|
+
<step n="2" goal="Check layer/separation of concerns violations">
|
|
21
|
+
<check-list id="layers">
|
|
22
|
+
<item>Business logic in controllers/routes (should be in services)</item>
|
|
23
|
+
<item>Database queries in wrong layer (direct DB access from controller bypassing service)</item>
|
|
24
|
+
<item>Presentation logic in backend (HTML generation in services)</item>
|
|
25
|
+
<item>Infrastructure concerns mixed with domain logic</item>
|
|
26
|
+
<item>Each function/class: does it have a single clear responsibility?</item>
|
|
27
|
+
</check-list>
|
|
28
|
+
</step>
|
|
29
|
+
|
|
30
|
+
<step n="3" goal="Check coupling and cohesion">
|
|
31
|
+
<check-list id="coupling">
|
|
32
|
+
<item>Tight coupling: does this change force changes in many unrelated files?</item>
|
|
33
|
+
<item>New module dependencies: are new imports appropriate? circular dependencies introduced?</item>
|
|
34
|
+
<item>Interface design: are public APIs (function signatures, REST endpoints) clean and stable?</item>
|
|
35
|
+
<item>Shared mutable state: global state introduced or modified across modules?</item>
|
|
36
|
+
</check-list>
|
|
37
|
+
</step>
|
|
38
|
+
|
|
39
|
+
<step n="4" goal="Check consistency with existing codebase patterns">
|
|
40
|
+
<check-list id="consistency">
|
|
41
|
+
<item>Naming conventions: matches existing naming style (camelCase vs snake_case, etc.)?</item>
|
|
42
|
+
<item>File/folder structure: new files placed where convention dictates?</item>
|
|
43
|
+
<item>Error handling pattern: matches how errors are handled elsewhere in the codebase?</item>
|
|
44
|
+
<item>API response format: matches existing response structure?</item>
|
|
45
|
+
<item>New patterns: is a new pattern introduced? Is it justified and documented?</item>
|
|
46
|
+
</check-list>
|
|
47
|
+
</step>
|
|
48
|
+
|
|
49
|
+
<step n="5" goal="SOLID principles (only flag real violations, not theoretical ones)">
|
|
50
|
+
<check-list id="solid">
|
|
51
|
+
<item>SRP: class/module doing more than one thing AND causing maintenance problems?</item>
|
|
52
|
+
<item>OCP: existing code modified instead of extended (when extension was clearly better)?</item>
|
|
53
|
+
<item>LSP: subclass behavior violates parent contract?</item>
|
|
54
|
+
<item>ISP: interface forces implementors to depend on methods they don't use?</item>
|
|
55
|
+
<item>DIP: high-level module depends directly on low-level implementation (not abstraction)?</item>
|
|
56
|
+
</check-list>
|
|
57
|
+
<note>Only flag SOLID violations when they cause REAL maintainability or extensibility problems — not theoretical purity</note>
|
|
58
|
+
</step>
|
|
59
|
+
|
|
60
|
+
<step n="6" goal="Compile and write findings">
|
|
61
|
+
<action>Group findings: Layer Violations | Coupling Issues | Consistency Problems | SOLID Violations</action>
|
|
62
|
+
<action>For each finding: reference the EXISTING pattern that should be followed instead</action>
|
|
63
|
+
<action>Write findings to {output_file}</action>
|
|
64
|
+
<action>Update {pr_context}: add 'architecture-review' to completed list</action>
|
|
65
|
+
<output>🏗️ Architecture review complete.
|
|
66
|
+
Run [RR] Generate Report to compile all findings.</output>
|
|
67
|
+
</step>
|
|
68
|
+
</workflow>
|