prr-kit 1.1.3 โ†’ 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (173) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +260 -235
  3. package/docs/assets/banner.svg +30 -248
  4. package/docs/assets/how-it-works.svg +87 -0
  5. package/package.json +60 -60
  6. package/src/core/agents/prr-master.agent.yaml +18 -7
  7. package/src/core/tasks/clear.md +140 -0
  8. package/src/core/tasks/help.md +15 -13
  9. package/src/core/workflows/clear/workflow.md +6 -0
  10. package/src/core/workflows/help/workflow.md +6 -0
  11. package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +35 -24
  12. package/src/core/workflows/party-mode/steps/step-02-discussion.md +45 -25
  13. package/src/core/workflows/party-mode/workflow.md +2 -2
  14. package/src/prr/agents/architecture-reviewer.agent.yaml +65 -45
  15. package/src/prr/agents/business-reviewer.agent.yaml +66 -0
  16. package/src/prr/agents/general-reviewer.agent.yaml +64 -48
  17. package/src/prr/agents/performance-reviewer.agent.yaml +65 -45
  18. package/src/prr/agents/security-reviewer.agent.yaml +67 -43
  19. package/src/prr/config-template.yaml +97 -0
  20. package/src/prr/data/stacks/actix.md +55 -0
  21. package/src/prr/data/stacks/alpine.md +47 -0
  22. package/src/prr/data/stacks/android.md +53 -0
  23. package/src/prr/data/stacks/angular.md +96 -0
  24. package/src/prr/data/stacks/ansible.md +55 -0
  25. package/src/prr/data/stacks/apollo.md +54 -0
  26. package/src/prr/data/stacks/astro.md +48 -0
  27. package/src/prr/data/stacks/aws-cdk.md +55 -0
  28. package/src/prr/data/stacks/axum.md +56 -0
  29. package/src/prr/data/stacks/babylonjs.md +55 -0
  30. package/src/prr/data/stacks/bash.md +53 -0
  31. package/src/prr/data/stacks/bevy.md +53 -0
  32. package/src/prr/data/stacks/bootstrap.md +52 -0
  33. package/src/prr/data/stacks/bun.md +55 -0
  34. package/src/prr/data/stacks/cpp.md +57 -0
  35. package/src/prr/data/stacks/csharp.md +95 -0
  36. package/src/prr/data/stacks/css.md +55 -0
  37. package/src/prr/data/stacks/cypress.md +53 -0
  38. package/src/prr/data/stacks/d3.md +53 -0
  39. package/src/prr/data/stacks/deno.md +49 -0
  40. package/src/prr/data/stacks/django.md +92 -0
  41. package/src/prr/data/stacks/docker.md +79 -0
  42. package/src/prr/data/stacks/drizzle.md +54 -0
  43. package/src/prr/data/stacks/dynamodb.md +55 -0
  44. package/src/prr/data/stacks/electron.md +44 -0
  45. package/src/prr/data/stacks/elixir.md +53 -0
  46. package/src/prr/data/stacks/expo.md +53 -0
  47. package/src/prr/data/stacks/expressjs.md +82 -0
  48. package/src/prr/data/stacks/fastapi.md +88 -0
  49. package/src/prr/data/stacks/fastify.md +60 -0
  50. package/src/prr/data/stacks/fiber.md +55 -0
  51. package/src/prr/data/stacks/firebase.md +43 -0
  52. package/src/prr/data/stacks/flask.md +46 -0
  53. package/src/prr/data/stacks/flutter.md +75 -0
  54. package/src/prr/data/stacks/gin.md +57 -0
  55. package/src/prr/data/stacks/github-actions.md +71 -0
  56. package/src/prr/data/stacks/go.md +88 -0
  57. package/src/prr/data/stacks/godot.md +56 -0
  58. package/src/prr/data/stacks/graphql.md +76 -0
  59. package/src/prr/data/stacks/grpc.md +56 -0
  60. package/src/prr/data/stacks/haskell.md +48 -0
  61. package/src/prr/data/stacks/helm.md +54 -0
  62. package/src/prr/data/stacks/hono.md +54 -0
  63. package/src/prr/data/stacks/htmx.md +38 -0
  64. package/src/prr/data/stacks/java.md +87 -0
  65. package/src/prr/data/stacks/jest-vitest.md +87 -0
  66. package/src/prr/data/stacks/jquery.md +50 -0
  67. package/src/prr/data/stacks/junit.md +53 -0
  68. package/src/prr/data/stacks/kotlin.md +89 -0
  69. package/src/prr/data/stacks/kubernetes.md +148 -0
  70. package/src/prr/data/stacks/langchain.md +56 -0
  71. package/src/prr/data/stacks/laravel.md +56 -0
  72. package/src/prr/data/stacks/libgdx.md +46 -0
  73. package/src/prr/data/stacks/lit.md +49 -0
  74. package/src/prr/data/stacks/love2d.md +51 -0
  75. package/src/prr/data/stacks/lua.md +51 -0
  76. package/src/prr/data/stacks/mobx.md +54 -0
  77. package/src/prr/data/stacks/mongodb.md +85 -0
  78. package/src/prr/data/stacks/monogame.md +51 -0
  79. package/src/prr/data/stacks/mysql.md +57 -0
  80. package/src/prr/data/stacks/nestjs.md +95 -0
  81. package/src/prr/data/stacks/nextjs.md +88 -0
  82. package/src/prr/data/stacks/nginx.md +55 -0
  83. package/src/prr/data/stacks/node.md +56 -0
  84. package/src/prr/data/stacks/nuxtjs.md +91 -0
  85. package/src/prr/data/stacks/openai-api.md +54 -0
  86. package/src/prr/data/stacks/opengl.md +54 -0
  87. package/src/prr/data/stacks/phaser.md +54 -0
  88. package/src/prr/data/stacks/phoenix.md +55 -0
  89. package/src/prr/data/stacks/php.md +56 -0
  90. package/src/prr/data/stacks/playwright.md +86 -0
  91. package/src/prr/data/stacks/postgresql.md +60 -0
  92. package/src/prr/data/stacks/prisma.md +81 -0
  93. package/src/prr/data/stacks/pygame.md +52 -0
  94. package/src/prr/data/stacks/pytest.md +53 -0
  95. package/src/prr/data/stacks/python.md +94 -0
  96. package/src/prr/data/stacks/pytorch.md +54 -0
  97. package/src/prr/data/stacks/qwik.md +50 -0
  98. package/src/prr/data/stacks/rails.md +48 -0
  99. package/src/prr/data/stacks/react-native.md +77 -0
  100. package/src/prr/data/stacks/react.md +104 -0
  101. package/src/prr/data/stacks/redis.md +76 -0
  102. package/src/prr/data/stacks/redux.md +107 -0
  103. package/src/prr/data/stacks/remix.md +51 -0
  104. package/src/prr/data/stacks/rust.md +88 -0
  105. package/src/prr/data/stacks/sass.md +51 -0
  106. package/src/prr/data/stacks/scala.md +50 -0
  107. package/src/prr/data/stacks/scikit-learn.md +53 -0
  108. package/src/prr/data/stacks/sequelize.md +54 -0
  109. package/src/prr/data/stacks/socket-io.md +54 -0
  110. package/src/prr/data/stacks/solidity.md +53 -0
  111. package/src/prr/data/stacks/solidjs.md +45 -0
  112. package/src/prr/data/stacks/spring-boot.md +92 -0
  113. package/src/prr/data/stacks/sql.md +85 -0
  114. package/src/prr/data/stacks/sqlite.md +55 -0
  115. package/src/prr/data/stacks/styled-components.md +51 -0
  116. package/src/prr/data/stacks/supabase.md +57 -0
  117. package/src/prr/data/stacks/svelte.md +77 -0
  118. package/src/prr/data/stacks/sveltekit.md +54 -0
  119. package/src/prr/data/stacks/swift.md +61 -0
  120. package/src/prr/data/stacks/tailwindcss.md +10 -0
  121. package/src/prr/data/stacks/tanstack-query.md +48 -0
  122. package/src/prr/data/stacks/tauri.md +52 -0
  123. package/src/prr/data/stacks/terraform.md +53 -0
  124. package/src/prr/data/stacks/three.md +53 -0
  125. package/src/prr/data/stacks/trpc.md +49 -0
  126. package/src/prr/data/stacks/typeorm.md +40 -0
  127. package/src/prr/data/stacks/typescript.md +83 -0
  128. package/src/prr/data/stacks/unity.md +61 -0
  129. package/src/prr/data/stacks/unreal.md +58 -0
  130. package/src/prr/data/stacks/vite.md +48 -0
  131. package/src/prr/data/stacks/vue3.md +95 -0
  132. package/src/prr/data/stacks/vulkan.md +53 -0
  133. package/src/prr/data/stacks/wasm.md +49 -0
  134. package/src/prr/data/stacks/webpack.md +48 -0
  135. package/src/prr/data/stacks/zig.md +51 -0
  136. package/src/prr/data/stacks/zustand.md +56 -0
  137. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +1 -0
  138. package/src/prr/workflows/1-discover/select-pr/workflow.md +1 -1
  139. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-01-analyze-files.md +334 -0
  140. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-02-collect-sources.md +451 -0
  141. package/src/prr/workflows/2-analyze/collect-pr-context/steps/step-03-build-knowledge-base.md +337 -0
  142. package/src/prr/workflows/2-analyze/collect-pr-context/workflow.md +123 -0
  143. package/src/prr/workflows/2-analyze/describe-pr/steps/step-02-classify.md +12 -6
  144. package/src/prr/workflows/2-analyze/describe-pr/steps/step-03-walkthrough.md +59 -1
  145. package/src/prr/workflows/3-review/architecture-review/checklist.md +4 -0
  146. package/src/prr/workflows/3-review/architecture-review/instructions.xml +32 -4
  147. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +17 -18
  148. package/src/prr/workflows/3-review/business-review/checklist.md +27 -0
  149. package/src/prr/workflows/3-review/business-review/instructions.xml +153 -0
  150. package/src/prr/workflows/3-review/business-review/workflow.yaml +17 -0
  151. package/src/prr/workflows/3-review/general-review/checklist.md +5 -1
  152. package/src/prr/workflows/3-review/general-review/instructions.xml +39 -8
  153. package/src/prr/workflows/3-review/general-review/workflow.yaml +17 -18
  154. package/src/prr/workflows/3-review/performance-review/checklist.md +3 -1
  155. package/src/prr/workflows/3-review/performance-review/instructions.xml +10 -3
  156. package/src/prr/workflows/3-review/performance-review/workflow.yaml +17 -18
  157. package/src/prr/workflows/3-review/security-review/checklist.md +2 -1
  158. package/src/prr/workflows/3-review/security-review/instructions.xml +8 -3
  159. package/src/prr/workflows/3-review/security-review/workflow.yaml +18 -19
  160. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +17 -18
  161. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +9 -2
  162. package/src/prr/workflows/6-report/generate-report/steps/step-02-organize.md +28 -7
  163. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +6 -4
  164. package/src/prr/workflows/6-report/generate-report/templates/review-report.template.md +124 -78
  165. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +104 -13
  166. package/src/prr/workflows/6-report/post-comments/steps/step-02-post.md +92 -21
  167. package/src/prr/workflows/6-report/post-comments/workflow.md +6 -0
  168. package/src/prr/workflows/quick/workflow.md +138 -32
  169. package/src/prr/workflows/0-setup/collect-project-context/steps/step-01-scan-configs.md +0 -106
  170. package/src/prr/workflows/0-setup/collect-project-context/steps/step-02-extract-rules.md +0 -131
  171. package/src/prr/workflows/0-setup/collect-project-context/steps/step-03-ask-context.md +0 -194
  172. package/src/prr/workflows/0-setup/collect-project-context/steps/step-04-save-context.md +0 -161
  173. package/src/prr/workflows/0-setup/collect-project-context/workflow.md +0 -58
@@ -9,41 +9,70 @@ description: "Post comments via platform CLI/API, verify, clean up"
9
9
 
10
10
  ### 1. Post Based on Platform
11
11
 
12
+ **โš ๏ธ Always use `{gh_path}` (the resolved full path from step-01), not bare `gh`.**
13
+ **โš ๏ธ Always quote paths containing spaces.**
14
+
15
+ ---
16
+
12
17
  **GitHub:**
13
18
  ```bash
14
- gh api repos/{platform_repo}/pulls/{pr_number}/reviews \
19
+ "{gh_path}" api repos/{platform_repo}/pulls/{pr_number}/reviews \
15
20
  --method POST \
16
21
  --header "Accept: application/vnd.github+json" \
17
- --input {review_output}/.prr-payload.json
22
+ --input "{temp_dir}/prr-payload.json"
23
+ ```
24
+
25
+ **Handle 422 errors โ€” two known cases:**
26
+
27
+ **Case A โ€” Self-review** (`"Review Can not request changes on your own pull request"`):
28
+ - The authenticated user is the PR author. GitHub disallows `REQUEST_CHANGES` on own PRs.
29
+ - Fix: Update `event` in the payload from `"REQUEST_CHANGES"` to `"COMMENT"` and retry once.
30
+ - Use whichever runtime is available (`{detected_runtime}` from step A earlier):
31
+
32
+ ```bash
33
+ # Node.js
34
+ node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('{temp_dir}/prr-payload.json','utf-8')); p.event='COMMENT'; fs.writeFileSync('{temp_dir}/prr-payload.json',JSON.stringify(p,null,2)); console.log('event โ†’ COMMENT')"
35
+
36
+ # Python3
37
+ python3 -c "import json; f=open('{temp_dir}/prr-payload.json','r+'); p=json.load(f); p['event']='COMMENT'; f.seek(0); json.dump(p,f,ensure_ascii=False,indent=2); f.truncate(); print('event โ†’ COMMENT')"
18
38
  ```
39
+ Then retry the POST above.
40
+
41
+ **Case B โ€” Line not in diff** (`"Pull Request Review thread not found"` / line outside diff hunk):
42
+ - Remove the offending comment from the payload (the one with the invalid `path`/`line`), append its body to the summary `body` field as a fallback, then retry.
43
+ - Repeat until all comments are either posted inline or moved to summary.
19
44
 
20
- Handle 422 (line not in diff): remove the offending inline comment from payload, add to summary body, retry.
45
+ ---
21
46
 
22
47
  **GitLab:**
23
48
  ```bash
24
49
  # Post summary as MR note
25
- glab mr note {pr_number} --repo {platform_repo} --message "$(cat {review_output}/.prr-summary.md)"
50
+ glab mr note {pr_number} --repo {platform_repo} --message "$(cat '{temp_dir}/prr-summary.md')"
26
51
 
27
52
  # Post each inline comment
28
- for payload in {review_output}/.prr-payload-*.json; do
53
+ for payload in "{temp_dir}/prr-payload-"*.json; do
29
54
  glab api projects/{encoded_repo}/merge_requests/{pr_number}/discussions \
30
55
  --method POST --input "$payload"
31
56
  done
32
57
  ```
33
58
  Where `{encoded_repo}` = `{platform_repo}` with `/` replaced by `%2F`.
34
59
 
60
+ ---
61
+
35
62
  **Azure DevOps:**
36
63
  ```bash
37
64
  # Post summary as PR comment
38
- az repos pr comment add --id {pr_number} --comment "$(cat {review_output}/.prr-summary.md)"
65
+ az repos pr comment add --id {pr_number} --comment "$(cat '{temp_dir}/prr-summary.md')"
39
66
 
40
67
  # Post each inline thread
41
- for payload in {review_output}/.prr-thread-*.json; do
68
+ for payload in "{temp_dir}/prr-thread-"*.json; do
42
69
  az repos pr thread create --id {pr_number} \
43
70
  --template-file "$payload"
44
71
  done
45
72
  ```
46
73
 
74
+ ---
75
+
47
76
  **Bitbucket:**
48
77
  ```bash
49
78
  # Post summary
@@ -51,10 +80,10 @@ curl -s -X POST \
51
80
  "https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{pr_number}/comments" \
52
81
  -H "Authorization: Bearer {BB_TOKEN}" \
53
82
  -H "Content-Type: application/json" \
54
- -d "{\"content\": {\"raw\": \"$(cat {review_output}/.prr-summary.md)\"}}"
83
+ -d "{\"content\": {\"raw\": \"$(cat '{temp_dir}/prr-summary.md')\"}}"
55
84
 
56
85
  # Post each inline comment
57
- for payload in {review_output}/.prr-bb-*.json; do
86
+ for payload in "{temp_dir}/prr-bb-"*.json; do
58
87
  curl -s -X POST \
59
88
  "https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{pr_number}/comments" \
60
89
  -H "Authorization: Bearer {BB_TOKEN}" \
@@ -63,25 +92,67 @@ for payload in {review_output}/.prr-bb-*.json; do
63
92
  done
64
93
  ```
65
94
 
66
- ### 2. Verify
95
+ ---
96
+
97
+ ### 2. Construct PR/MR URL
98
+
99
+ Build `{pr_url}` from available variables based on `{active_platform}`:
100
+
101
+ | Platform | URL pattern |
102
+ |----------|------------|
103
+ | `github` | `https://github.com/{platform_repo}/pull/{pr_number}` |
104
+ | `gitlab` | `https://gitlab.com/{platform_repo}/-/merge_requests/{pr_number}` |
105
+ | `azure` | `https://dev.azure.com/{org}/{project}/_git/{repo}/pullrequest/{pr_number}` |
106
+ | `bitbucket` | `https://bitbucket.org/{platform_repo}/pull-requests/{pr_number}` |
107
+ | `none` | *(not applicable)* |
108
+
109
+ For Azure, extract `{org}`, `{project}`, `{repo}` from `{platform_repo}` (format: `org/project/repo`).
110
+
111
+ If `{pr_number}` is empty (branch-only flow), set `{pr_url}` = *(not available)*.
112
+
113
+ ---
114
+
115
+ ### 3. Verify
116
+
117
+ Confirm the post was successful.
118
+
119
+ **โš ๏ธ Do NOT pipe CLI output to `node -e` or `python -e` via stdin on Windows** โ€” `/dev/stdin` does not exist. Use `--jq` (gh CLI built-in) or write output to a temp file first.
120
+
121
+ **GitHub:**
122
+ ```bash
123
+ "{gh_path}" pr view {pr_number} --repo {platform_repo} --json reviews --jq '.reviews[-1].state'
124
+ ```
125
+ Expected: `"COMMENTED"` or `"APPROVED"` or `"CHANGES_REQUESTED"`.
126
+
127
+ **GitLab:**
128
+ ```bash
129
+ glab mr view {pr_number} --repo {platform_repo} --output json | jq '.user_notes_count'
130
+ ```
131
+
132
+ **Azure:**
133
+ ```bash
134
+ az repos pr thread list --id {pr_number} --query "length(@)"
135
+ ```
67
136
 
68
- Confirm the post was successful by checking for a `200` or `201` response.
137
+ **Bitbucket:** check response `id` field from the POST above.
69
138
 
70
- **GitHub:** `gh pr view {pr_number} --repo {platform_repo} --json reviews --jq '.reviews[-1].state'`
71
- **GitLab:** `glab mr view {pr_number} --repo {platform_repo} --output json | jq '.user_notes_count'`
72
- **Azure:** `az repos pr thread list --id {pr_number} --query "length(@)"`
73
- **Bitbucket:** check response `id` field from the post
139
+ ---
74
140
 
75
- ### 3. Clean Up Temp Files
141
+ ### 4. Clean Up Temp Files
76
142
 
77
143
  ```bash
78
- rm -f {review_output}/.prr-payload*.json \
79
- {review_output}/.prr-summary.md \
80
- {review_output}/.prr-thread-*.json \
81
- {review_output}/.prr-bb-*.json
144
+ rm -f "{temp_dir}/prr-payload.json" \
145
+ "{temp_dir}/prr-payload-"*.json \
146
+ "{temp_dir}/prr-summary.md" \
147
+ "{temp_dir}/prr-thread-"*.json \
148
+ "{temp_dir}/prr-bb-"*.json \
149
+ "{temp_dir}/build-payload.mjs" \
150
+ "{temp_dir}/build-payload.py"
82
151
  ```
83
152
 
84
- ### 4. Display Completion
153
+ ---
154
+
155
+ ### 5. Display Completion
85
156
 
86
157
  ```
87
158
  โœ… Review Posted!
@@ -40,6 +40,12 @@ Load config from `{main_config}`.
40
40
  Load PR context from `{review_output}/current-pr-context.yaml`.
41
41
  Use `{active_platform}` (or detect from `{platform}` config).
42
42
 
43
+ Set `{temp_dir}` = `{review_output}/temp`.
44
+ Create it if it doesn't exist:
45
+ ```bash
46
+ mkdir -p "{temp_dir}"
47
+ ```
48
+
43
49
  ## EXECUTION
44
50
 
45
51
  Read fully and follow: `{nextStep}`
@@ -11,12 +11,12 @@ Only pause for user input when selecting the branch. Everything else runs automa
11
11
 
12
12
  ## INITIALIZATION
13
13
 
14
- Load config from {main_config}: `user_name`, `communication_language`, `target_repo`, `review_output`, `project_context`.
14
+ Load config from {main_config}: `user_name`, `communication_language`, `target_repo`, `review_output`, `auto_post_comment`.
15
15
 
16
16
  Set `date` = today's date (YYYY-MM-DD).
17
17
 
18
- If `project_context` file exists at `{review_output}/project-context.yaml`, load it silently.
19
- If it does not exist, notify: "โš ๏ธ No project context found โ€” run [CP] Collect Project Context first for better reviews. Continuing without it."
18
+ **Note:** Context will be collected dynamically in Phase 2.5 after describing the PR.
19
+ No pre-collected context file needed. Context is always fresh and PR-specific.
20
20
 
21
21
  ---
22
22
 
@@ -29,13 +29,33 @@ git -C {target_repo} fetch origin --prune
29
29
  ```
30
30
  Show: `โœ“ Fetched latest from remote`
31
31
 
32
- ### 1b. List open PRs (primary) + recent branches (secondary)
32
+ ### 1b. List open PRs/MRs (primary) + recent branches (secondary)
33
33
 
34
- **Primary โ€” GitHub PRs** (if `{github_repo}` is configured):
34
+ **Primary โ€” Platform PRs/MRs** (if `{platform_repo}` is configured):
35
+
36
+ Use the appropriate command based on `{platform}` (or `{detected_platform}`):
37
+
38
+ **GitHub:**
35
39
  ```bash
36
- gh pr list --repo {github_repo} --state open \
40
+ gh pr list --repo {platform_repo} --state open \
37
41
  --json number,title,headRefName,baseRefName,author,createdAt,isDraft --limit 20
38
42
  ```
43
+
44
+ **GitLab:**
45
+ ```bash
46
+ glab mr list --repo {platform_repo} --state opened --output json
47
+ ```
48
+
49
+ **Azure DevOps:**
50
+ ```bash
51
+ az repos pr list --repository {repo} --project {project} --org {org_url} --status active --output json
52
+ ```
53
+
54
+ **Bitbucket:**
55
+ ```bash
56
+ curl https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests?state=OPEN
57
+ ```
58
+
39
59
  Display as a table: `#N | title | head โ†’ base | author | age`
40
60
 
41
61
  **Secondary โ€” recent branches** (always):
@@ -45,29 +65,49 @@ git -C {target_repo} branch -r --sort=-committerdate \
45
65
  | head -15
46
66
  ```
47
67
 
48
- ### 1c. Select PR โ† **ONLY USER INPUT IN THIS WORKFLOW**
68
+ ### 1c. Select PR/MR โ† **ONLY USER INPUT IN THIS WORKFLOW**
49
69
 
50
- **If `{github_repo}` is configured** โ€” ask:
51
- > Select a PR to review:
52
- > Enter PR number (e.g. `44`) or branch name (e.g. `feature/my-feature`):
70
+ **If `{platform_repo}` is configured** โ€” ask:
71
+ > Select a PR/MR to review:
72
+ > Enter PR/MR number (e.g. `44`) or branch name (e.g. `feature/my-feature`):
53
73
 
54
74
  Wait for response.
55
75
 
56
- **If PR number entered:**
76
+ **If PR/MR number entered**, fetch metadata using the active platform:
77
+
78
+ **GitHub:**
57
79
  ```bash
58
- gh pr view {pr_number} --repo {github_repo} \
80
+ gh pr view {pr_number} --repo {platform_repo} \
59
81
  --json number,title,headRefName,baseRefName,author,headRefOid
60
82
  ```
61
- Set `target_branch` = `headRefName`, `base_branch` = `baseRefName` โ† **exact from GitHub, not assumed**.
83
+ Set `target_branch` = `headRefName`, `base_branch` = `baseRefName` โ† **exact from platform, not assumed**.
62
84
  Set `pr_head_sha` = `headRefOid`.
63
85
 
86
+ **GitLab:**
87
+ ```bash
88
+ glab mr view {pr_number} --repo {platform_repo} --output json
89
+ ```
90
+ Set `target_branch` = `source_branch`, `base_branch` = `target_branch`.
91
+ Get head SHA: `git -C {target_repo} rev-parse origin/{target_branch}` โ†’ `pr_head_sha`.
92
+
93
+ **Azure DevOps:**
94
+ ```bash
95
+ az repos pr show --id {pr_number} --output json
96
+ ```
97
+ Set `target_branch` = `sourceRefName` (strip `refs/heads/`), `base_branch` = `targetRefName` (strip `refs/heads/`).
98
+
99
+ **Bitbucket:**
100
+ ```bash
101
+ curl https://api.bitbucket.org/2.0/repositories/{platform_repo}/pullrequests/{pr_number}
102
+ ```
103
+ Set `target_branch` = `source.branch.name`, `base_branch` = `destination.branch.name`.
104
+
64
105
  **If branch name entered:**
65
- Check if a PR exists for it via `gh pr list --head {branch}`.
66
- If yes: use PR's `baseRefName`. If no: detect `origin/main` or `origin/master`.
106
+ Check if a PR/MR exists for it on the platform. If yes: use its base branch. If no: detect `origin/main` or `origin/master`.
67
107
 
68
108
  ---
69
109
 
70
- **If `{github_repo}` is NOT configured** โ€” ask two separate questions:
110
+ **If `{platform_repo}` is NOT configured** โ€” ask two separate questions:
71
111
 
72
112
  First, display EXACTLY:
73
113
  ```
@@ -92,11 +132,21 @@ Set `base_branch` = input or detected default.
92
132
  Set `diff_range` = `{base_branch}...{target_branch}`.
93
133
 
94
134
  ### 1d. Load diff
135
+
136
+ Use the first available method based on platform:
137
+
138
+ **GitHub** (if `active_platform = github` and `pr_number` is set):
95
139
  ```bash
96
- # If PR number available (preferred):
97
- gh pr diff {pr_number} --repo {github_repo}
140
+ gh pr diff {pr_number} --repo {platform_repo}
141
+ ```
98
142
 
99
- # Otherwise:
143
+ **GitLab** (if `active_platform = gitlab` and `pr_number` is set):
144
+ ```bash
145
+ glab mr diff {pr_number} --repo {platform_repo}
146
+ ```
147
+
148
+ **Azure DevOps / Bitbucket / fallback:**
149
+ ```bash
100
150
  git -C {target_repo} diff {base_branch}...{target_branch} --stat
101
151
  git -C {target_repo} diff {base_branch}...{target_branch}
102
152
  ```
@@ -105,9 +155,17 @@ Store diff in memory. Count files changed, lines added/removed.
105
155
  ### 1e. Save PR context
106
156
  Write `{review_output}/current-pr-context.yaml`:
107
157
  ```yaml
108
- target_branch: "{target_branch}"
109
- base_branch: "{base_branch}"
110
- date: "{date}"
158
+ pr:
159
+ target_branch: "{target_branch}"
160
+ base_branch: "{base_branch}"
161
+ pr_number: "{pr_number}"
162
+ pr_title: "{pr_title}"
163
+ platform: "{active_platform}"
164
+ platform_repo: "{platform_repo}"
165
+ date: "{date}"
166
+ review:
167
+ completed: []
168
+ findings: []
111
169
  ```
112
170
 
113
171
  Show summary:
@@ -122,7 +180,7 @@ Show summary:
122
180
  *Execute automatically, no user input.*
123
181
 
124
182
  ### 2a. Classify PR type
125
- Analyze the diff and classify as one of: `bugfix` | `feature` | `refactor` | `docs` | `test` | `chore` | `hotfix`
183
+ Analyze the diff and classify as one of: `bugfix` | `feature` | `refactor` | `performance` | `security` | `docs` | `test` | `config` | `chore` | `hotfix`
126
184
 
127
185
  ### 2b. Generate walkthrough
128
186
  For each changed file, write a 1-2 sentence summary of what changed and why.
@@ -143,41 +201,73 @@ Print to screen:
143
201
 
144
202
  ---
145
203
 
204
+ ## PHASE 2.5 โ€” COLLECT PR-SPECIFIC CONTEXT
205
+ *Execute automatically, no user input.*
206
+
207
+ Execute the collect-pr-context workflow in full:
208
+ `{project-root}/_prr/prr/workflows/2-analyze/collect-pr-context/workflow.md`
209
+
210
+ This workflow analyzes changed files, detects technology stacks, collects relevant context from all sources (primary docs, config files, standards docs, inline annotations, stack-specific rules, external MCP/RAG tools), and builds a structured PR-specific knowledge base at `{review_output}/pr-{pr_number}-context.yaml`.
211
+
212
+ On completion, store `pr_knowledge_base` = path to the generated context file.
213
+
214
+ ---
215
+
146
216
  ## PHASE 3 โ€” REVIEW
147
217
  *Execute all review types automatically, one by one.*
148
218
 
149
- For each review, read the corresponding instructions file and apply it to `{pr_diff}`.
219
+ **Before each review, set these variables so the review instructions resolve correctly:**
220
+ - `pr_context` = `{review_output}/current-pr-context.yaml`
221
+ - `target_branch` = `pr_context.pr.target_branch`
222
+ - `base_branch` = `pr_context.pr.base_branch`
223
+ - `pr_number` = `pr_context.pr.pr_number`
224
+ - `pr_knowledge_base` = path stored in `pr_context` (set by Phase 2.5)
225
+ - `target_repo`, `communication_language` = from config
226
+ - `output_file` = per-review path defined below *(ensures findings are saved to disk for [RR] and [PC] later)*
150
227
 
151
228
  ### 3a. General Review
229
+ Set `output_file` = `{review_output}/general-review-{date}.md`
152
230
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/general-review/instructions.xml`
153
231
 
154
232
  Collect findings as `{general_findings}`.
155
233
  Print section header: `## ๐Ÿ‘๏ธ General Review`
156
234
 
157
235
  ### 3b. Security Review
236
+ Set `output_file` = `{review_output}/security-review-{date}.md`
158
237
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/security-review/instructions.xml`
159
238
 
160
239
  Collect findings as `{security_findings}`.
161
240
  Print section header: `## ๐Ÿ”’ Security Review`
162
241
 
163
242
  ### 3c. Performance Review
243
+ Set `output_file` = `{review_output}/performance-review-{date}.md`
164
244
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/performance-review/instructions.xml`
165
245
 
166
246
  Collect findings as `{performance_findings}`.
167
247
  Print section header: `## โšก Performance Review`
168
248
 
169
249
  ### 3d. Architecture Review
250
+ Set `output_file` = `{review_output}/architecture-review-{date}.md`
170
251
  Load and follow: `{project-root}/_prr/prr/workflows/3-review/architecture-review/instructions.xml`
171
252
 
172
253
  Collect findings as `{architecture_findings}`.
173
254
  Print section header: `## ๐Ÿ—๏ธ Architecture Review`
174
255
 
256
+ ### 3e. Business Review
257
+ Set `output_file` = `{review_output}/business-review-{date}.md`
258
+ Load and follow: `{project-root}/_prr/prr/workflows/3-review/business-review/instructions.xml`
259
+
260
+ Collect findings as `{business_findings}`.
261
+ Print section header: `## ๐Ÿ’ผ Business Review`
262
+
263
+ **Note:** Business Review runs last โ€” it references and translates findings from GR/SR/PR/AR into business language and user impact.
264
+
175
265
  ---
176
266
 
177
267
  ## PHASE 4 โ€” GENERATE REPORT
178
268
  *Execute automatically.*
179
269
 
180
- Compile all findings from phases 3aโ€“3d.
270
+ Compile all findings from phases 3aโ€“3e.
181
271
 
182
272
  Sort by severity: ๐Ÿ”ด Blockers first โ†’ ๐ŸŸก Warnings โ†’ ๐ŸŸข Suggestions โ†’ ๐Ÿ“Œ Questions.
183
273
 
@@ -198,12 +288,22 @@ Report format:
198
288
  **Type:** {pr_type} | **Files:** X | **Lines:** +Y/-Z
199
289
 
200
290
  ## Executive Summary
201
- {2-3 sentence overall quality assessment}
291
+ {2-3 sentence overall technical quality assessment}
292
+
293
+ **Verdict:** โœ… APPROVE / โš ๏ธ APPROVE WITH NOTES / ๐Ÿšซ REQUEST CHANGES
294
+ **Business Risk:** CRITICAL / HIGH / MEDIUM / LOW / MINIMAL *(if Business Review ran)*
202
295
 
203
- **Totals:** ๐Ÿ”ด {blocker_count} blockers | ๐ŸŸก {warning_count} warnings | ๐ŸŸข {suggestion_count} suggestions
296
+ **Totals:** ๐Ÿ”ด {blocker_count} blockers | ๐ŸŸก {warning_count} warnings | ๐ŸŸข {suggestion_count} suggestions | โ“ {question_count} questions
297
+
298
+ ## Business Impact ๐Ÿ’ผ
299
+ *(Include this section only if Business Review [3e] was completed)*
300
+ **Risk Level:** {risk_level}
301
+ **Top concerns:** {top_3_business_concerns}
302
+ **Deployment recommendation:** {ship_now | ship_with_fixes | do_not_ship}
303
+ **Post-ship monitoring:** {what_to_watch}
204
304
 
205
305
  ## Blockers ๐Ÿ”ด
206
- {all blocker findings}
306
+ {all blocker findings โ€” sorted by category: ๐Ÿ”’ Security ยท โšก Performance ยท ๐Ÿ—๏ธ Architecture ยท ๐Ÿ‘๏ธ General ยท ๐Ÿ’ผ Business}
207
307
 
208
308
  ## Warnings ๐ŸŸก
209
309
  {all warning findings}
@@ -212,10 +312,10 @@ Report format:
212
312
  {all suggestion findings}
213
313
 
214
314
  ## Questions ๐Ÿ“Œ
215
- {all questions}
315
+ {all questions for author}
216
316
 
217
317
  ## Files Reviewed
218
- {file list}
318
+ {file list with issue counts per file; highlight files with 3+ findings}
219
319
  ```
220
320
 
221
321
  ---
@@ -236,8 +336,14 @@ Report: {review_output}/review-{target_branch_slug}-{date}.md
236
336
  โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”
237
337
  ```
238
338
 
239
- Then ask:
240
- > Post these findings as inline comments to GitHub? (requires `gh` CLI and `github_repo` configured)
339
+ **If `auto_post_comment: true`** (from config):
340
+ โ†’ Skip prompt. Automatically proceed to post comments.
341
+ โ†’ Load and follow: `{project-root}/_prr/prr/workflows/6-report/post-comments/workflow.md`
342
+
343
+ **If `auto_post_comment: false`** (default):
344
+ โ†’ Ask:
345
+ > Post these findings as inline comments to the PR/MR? (requires platform CLI and `platform_repo` configured)
346
+ > Supports: GitHub (`gh`), GitLab (`glab`), Azure DevOps (`az`), Bitbucket (API)
241
347
  > Type **PC** to post, or **Enter** to finish.
242
348
 
243
349
  If user types `PC`, load and follow: `{project-root}/_prr/prr/workflows/6-report/post-comments/workflow.md`
@@ -1,106 +0,0 @@
1
- ---
2
- name: "step-01-scan-configs"
3
- description: "Scan the target repo for config files, linting rules, and standards documents"
4
- nextStepFile: "./step-02-extract-rules.md"
5
- ---
6
-
7
- # Step 1: Scan Repository Config Files
8
-
9
- ## Sequence of Instructions
10
-
11
- ### 1. Announce Scan
12
-
13
- ```
14
- ๐Ÿ” Scanning project: {project_name}
15
- Repo: {target_repo}
16
- Looking for: config files, standards docs, architecture references...
17
- ```
18
-
19
- ### 2. Scan for Linting & Formatting Configs
20
-
21
- Check for these files in `{target_repo}` (root and common subdirs):
22
-
23
- **JavaScript/TypeScript:**
24
- - `.eslintrc`, `.eslintrc.js`, `.eslintrc.json`, `.eslintrc.yaml`, `eslint.config.mjs`, `eslint.config.js`
25
- - `.prettierrc`, `.prettierrc.json`, `prettier.config.mjs`, `prettier.config.js`
26
- - `tsconfig.json`, `tsconfig.*.json`
27
- - `.editorconfig`
28
-
29
- **Python:**
30
- - `pyproject.toml` (look for `[tool.ruff]`, `[tool.black]`, `[tool.isort]`, `[tool.flake8]`)
31
- - `setup.cfg` (look for `[flake8]`, `[mypy]`)
32
- - `.flake8`, `mypy.ini`
33
-
34
- **CSS/Vue/React:**
35
- - `.stylelintrc`, `stylelint.config.js`
36
- - `vite.config.js`, `vite.config.ts`, `vue.config.js`
37
-
38
- **General:**
39
- - `.editorconfig`
40
- - `sonar-project.properties`
41
- - `.pre-commit-config.yaml`
42
-
43
- For each found file: read it and note the key rules.
44
-
45
- ### 3. Scan for Standards Documents
46
-
47
- Look for these files anywhere in `{target_repo}`:
48
-
49
- ```
50
- CONTRIBUTING.md
51
- CONTRIBUTING.rst
52
- DEVELOPMENT.md
53
- CODING_STANDARDS.md
54
- CODING_STYLE.md
55
- CODE_STYLE.md
56
- ARCHITECTURE.md
57
- ARCHITECTURE_DECISION*.md
58
- docs/architecture/
59
- docs/adr/ โ† Architecture Decision Records
60
- docs/standards/
61
- docs/conventions/
62
- .github/CONTRIBUTING.md
63
- ```
64
-
65
- For each found file: read the relevant sections (skip boilerplate like "how to submit a PR").
66
-
67
- Extract from these docs:
68
- - Named conventions (e.g. "we use PascalCase for components")
69
- - Prohibited patterns (e.g. "never use `var`", "no direct DOM manipulation")
70
- - Required patterns (e.g. "all API calls go through the service layer")
71
- - Domain terminology that has specific meaning
72
-
73
- ### 4. Scan for Package/Dependency Info
74
-
75
- Read `package.json` (or `requirements.txt` / `pyproject.toml` / `Cargo.toml` / `go.mod`):
76
-
77
- Extract:
78
- - Main framework and version (Vue 3 / React 18 / Express 4 / etc.)
79
- - Key libraries that imply patterns (e.g. `pinia` โ†’ state management pattern, `prisma` โ†’ ORM layer)
80
- - Test framework (jest / vitest / pytest / etc.)
81
- - Build toolchain (vite / webpack / esbuild / etc.)
82
-
83
- ### 5. Detect Project Type
84
-
85
- Based on files found and dependencies, classify:
86
-
87
- **Frontend framework:** Vue 3 / React / Angular / Svelte / vanilla / none
88
- **Backend framework:** Express / Fastify / NestJS / Django / FastAPI / Spring / none
89
- **Language:** TypeScript / JavaScript / Python / Java / Go / Rust / mixed
90
- **DB/ORM:** Prisma / TypeORM / Sequelize / SQLAlchemy / none
91
- **Test runner:** Vitest / Jest / Pytest / JUnit / none
92
- **State management:** Pinia / Vuex / Redux / Zustand / none
93
-
94
- ### 6. Report What Was Found
95
-
96
- ```
97
- โœ… Scan complete:
98
- ๐Ÿ“„ Config files found: {n} ({list of filenames})
99
- ๐Ÿ“š Standards docs found: {n} ({list of filenames})
100
- ๐Ÿ—๏ธ Detected stack: {frontend} + {backend} ({language})
101
- โš ๏ธ Not found: {list of expected but missing files}
102
- ```
103
-
104
- ### 7. Load Next Step
105
-
106
- Add `step-01-scan-configs` to `stepsCompleted`. Load: `{nextStepFile}`