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
@@ -0,0 +1,337 @@
1
+ ---
2
+ name: "step-03-build-knowledge-base"
3
+ description: "Build structured PR-specific knowledge base for reviewers"
4
+ ---
5
+
6
+ # Step 3: Build PR-Specific Knowledge Base
7
+
8
+ ## Goal
9
+ Transform collected data into structured knowledge base optimized for reviewers.
10
+
11
+ ## Sequence of Instructions
12
+
13
+ ### 1. Announce Knowledge Base Building
14
+
15
+ ```
16
+ 🧠 Building PR-specific knowledge base...
17
+ ```
18
+
19
+ ### 2. Create Knowledge Base Structure
20
+
21
+ Build YAML structure with all collected context:
22
+
23
+ ```yaml
24
+ # PR-Specific Context
25
+ # Generated: {timestamp}
26
+ # For PR: {pr_number} / Branch: {branch_name}
27
+
28
+ pr_metadata:
29
+ pr_number: {pr_number}
30
+ branch: {branch_name}
31
+ base_branch: {base_branch}
32
+ files_changed: {n}
33
+ collected_at: {ISO timestamp}
34
+
35
+ files_analysis:
36
+ changed_files:
37
+ - path: src/stores/todoStore.js
38
+ extension: .js
39
+ category: pinia-store
40
+ domains: [state-management]
41
+
42
+ - path: src/views/TodoListView.vue
43
+ extension: .vue
44
+ category: vue-view
45
+ domains: [ui-components, state-management]
46
+
47
+ domains_involved:
48
+ - state-management
49
+ - ui-components
50
+
51
+ file_types:
52
+ - .js (1 file)
53
+ - .vue (1 file)
54
+
55
+ relevant_rules:
56
+ # ESLint rules that apply to this PR
57
+ eslint:
58
+ vue/multi-word-component-names:
59
+ severity: error
60
+ applies_to: [TodoListView.vue]
61
+ description: Component names must be multi-word
62
+
63
+ vue/require-prop-types:
64
+ severity: error
65
+ applies_to: [*.vue]
66
+ description: Props must have type definitions
67
+
68
+ prefer-const:
69
+ severity: error
70
+ applies_to: [*.js, *.vue]
71
+ description: Use const instead of let when variable is not reassigned
72
+
73
+ no-var:
74
+ severity: error
75
+ applies_to: [*.js, *.vue]
76
+ description: No var keyword allowed
77
+
78
+ prettier:
79
+ semi: false
80
+ singleQuote: true
81
+ tabWidth: 2
82
+ printWidth: 100
83
+ applies_to: all_files
84
+
85
+ relevant_guidelines:
86
+ # From CLAUDE.md
87
+ state_management:
88
+ source: CLAUDE.md
89
+ section: State Management
90
+ content: |
91
+ Use Pinia stores with setup function style.
92
+ - State: use ref() and reactive()
93
+ - Getters: use computed()
94
+ - Actions: regular functions
95
+ - No Options API allowed
96
+
97
+ applies_to: [src/stores/todoStore.js]
98
+
99
+ security:
100
+ source: CLAUDE.md
101
+ section: Security
102
+ content: |
103
+ Never use v-html with user input.
104
+ All inputs must be validated and sanitized.
105
+
106
+ applies_to: [src/views/TodoListView.vue]
107
+
108
+ # From CONTRIBUTING.md
109
+ component_standards:
110
+ source: CONTRIBUTING.md
111
+ section: Component Standards
112
+ content: |
113
+ - Use PascalCase for component names
114
+ - Multi-word names required (enforced by ESLint)
115
+ - Props must have types and defaults
116
+ - Use Composition API with <script setup>
117
+
118
+ applies_to: [src/views/TodoListView.vue]
119
+
120
+ # From ARCHITECTURE.md
121
+ container_presentational_pattern:
122
+ source: ARCHITECTURE.md
123
+ section: Component Architecture
124
+ content: |
125
+ Follow Container/Presentational pattern:
126
+ - Container (views/): Connect to stores, handle logic
127
+ - Presentational (components/): Receive props, emit events
128
+
129
+ applies_to: [src/views/TodoListView.vue]
130
+
131
+ pinia_patterns:
132
+ source: ARCHITECTURE.md
133
+ section: State Management
134
+ adr: ADR-002
135
+ content: |
136
+ Use Pinia with setup function style.
137
+ Rationale: Simpler API, better TypeScript support.
138
+ Actions modify state directly (no mutations).
139
+
140
+ applies_to: [src/stores/todoStore.js]
141
+
142
+ inline_context:
143
+ annotations:
144
+ - file: src/stores/todoStore.js
145
+ line: 10
146
+ type: "@pattern"
147
+ content: "Use composition API only"
148
+ priority: high
149
+
150
+ - file: src/stores/todoStore.js
151
+ line: 15
152
+ type: "@security"
153
+ content: "Validate all inputs before storage"
154
+ priority: critical
155
+
156
+ stack_context:
157
+ # Populated from data/stacks/{stack}.md files for each detected stack.
158
+ # All reviewers (GR, SR, PR, AR, BR) MUST read and apply these rules
159
+ # in addition to project-specific guidelines.
160
+ detected_stacks: [vue3, typescript]
161
+
162
+ rules:
163
+ vue3:
164
+ security:
165
+ - severity: critical
166
+ rule: "v-html with user-controlled data → XSS. Use {{ }} or DOMPurify."
167
+ - severity: high
168
+ rule: "Dynamic :is binding with user string → arbitrary component injection."
169
+ performance:
170
+ - severity: high
171
+ rule: "watchEffect/watch with async ops without onCleanup → memory leak on unmount."
172
+ - severity: medium
173
+ rule: "v-for without :key or using index key → broken reconciliation on reorder."
174
+ architecture:
175
+ - severity: high
176
+ rule: "Direct store state mutation outside action → bypasses Pinia devtools."
177
+ - severity: high
178
+ rule: "Props mutation instead of emit → violates one-way data flow."
179
+ code_quality:
180
+ - severity: high
181
+ rule: "defineProps without TypeScript types → silent prop misuse."
182
+ - severity: medium
183
+ rule: "Options API mixed with Composition API in same component."
184
+ common_bugs:
185
+ - severity: high
186
+ rule: "reactive() destructuring loses reactivity — use toRefs() to preserve it."
187
+ - severity: medium
188
+ rule: "watch missing immediate:true when logic should run on initial value."
189
+ typescript:
190
+ architecture:
191
+ - severity: high
192
+ rule: "'any' type defeats TypeScript purpose — use unknown + type narrowing."
193
+ - severity: high
194
+ rule: "strict:false or missing strict in tsconfig → implicit any, loose null checks."
195
+ code_quality:
196
+ - severity: high
197
+ rule: "@ts-ignore without explanation hides real bugs."
198
+ - severity: medium
199
+ rule: "Missing return type annotation on exported functions."
200
+ # ... additional detected stacks follow same pattern
201
+
202
+ external_context:
203
+ # Populated only when external_sources.enabled: true and tools were available
204
+ mcp_tools_used: [] # e.g. ["confluence", "jira"]
205
+
206
+ knowledge_base: # From Confluence / Notion / etc.
207
+ - source: Confluence
208
+ page: "Engineering Standards"
209
+ content: |
210
+ All state mutations must be logged for audit purposes.
211
+ JWT tokens must be validated server-side.
212
+
213
+ issue_context: # From Jira / Linear / GitHub Issues
214
+ key: ENG-123
215
+ title: "Add user authentication"
216
+ type: story
217
+ acceptance_criteria:
218
+ - "User can log in with email and password"
219
+ - "Session expires after 24 hours"
220
+ - "Failed login shows error message without leaking details"
221
+
222
+ design_context: # From Figma / Zeplin (UI changes only)
223
+ matched_components: []
224
+ specs: []
225
+
226
+ rag_patterns: # From AWS Bedrock / GitHub Graph RAG / etc.
227
+ - pattern: "Auth store pattern"
228
+ source: "Previous PR #88"
229
+ content: "Use httpOnly cookies for token storage, not localStorage"
230
+
231
+ url_sources: # From plain URL fetches
232
+ - name: "Shared ESLint config"
233
+ url: "https://raw.githubusercontent.com/org/standards/main/eslint.md"
234
+ content: "..."
235
+
236
+ review_priorities:
237
+ # Guide reviewers on what to focus on
238
+ critical:
239
+ - "Verify no v-html with user input (security requirement)"
240
+ - "Check ESLint error-level rules compliance"
241
+ - "Verify Pinia setup function style (ADR-002)"
242
+
243
+ important:
244
+ - "Check component naming (multi-word required)"
245
+ - "Verify props have types and defaults"
246
+ - "Check Container/Presentational pattern adherence"
247
+
248
+ low_priority:
249
+ - "Minor style preferences"
250
+ - "Optional optimizations"
251
+
252
+ reviewer_guidance:
253
+ general_review:
254
+ - "Check for ESLint rule violations (no-var, prefer-const)"
255
+ - "Verify component naming follows standards"
256
+ - "Check inline annotations are followed"
257
+
258
+ security_review:
259
+ - "Flag ANY v-html usage (critical)"
260
+ - "Check input validation per inline annotations"
261
+ - "Verify no hardcoded secrets"
262
+
263
+ performance_review:
264
+ - "Check computed vs methods usage"
265
+ - "Verify efficient filtering/searching"
266
+
267
+ architecture_review:
268
+ - "Verify Container/Presentational pattern"
269
+ - "Check Pinia setup function style (not Options API)"
270
+ - "Verify SRP adherence"
271
+
272
+ context_sources:
273
+ # Track what sources were used
274
+ primary_docs: [CLAUDE.md, AGENTS.md]
275
+ config_files: [.eslintrc.js, .prettierrc]
276
+ standards_docs: [CONTRIBUTING.md, ARCHITECTURE.md]
277
+ inline_annotations: yes
278
+ mcp_tools: [] # list of MCP tools actually used
279
+ rag_systems: [] # list of RAG systems queried
280
+ url_sources: [] # list of plain URLs fetched
281
+ ```
282
+
283
+ ### 3. Determine Output Filename
284
+
285
+ ```javascript
286
+ if (pr_number_available) {
287
+ filename = `pr-${pr_number}-context.yaml`
288
+ } else {
289
+ // Use sanitized branch name
290
+ const safeBranchName = branch_name.replace(/[^a-zA-Z0-9-]/g, '-')
291
+ filename = `pr-${safeBranchName}-context.yaml`
292
+ }
293
+ ```
294
+
295
+ ### 4. Write Knowledge Base to File
296
+
297
+ Write to: `{review_output}/{filename}`
298
+
299
+ Example: `_prr-output/pr-123-context.yaml`
300
+
301
+ ### 5. Report Completion
302
+
303
+ ```
304
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
305
+ ✅ PR-Specific Context Ready
306
+
307
+ 📄 File: {filename}
308
+ 📊 Stats:
309
+ • ESLint rules: {n}
310
+ • Guidelines: {m}
311
+ • Inline annotations: {k}
312
+ • MCP tools used: {mcp_list or "none"}
313
+ • RAG patterns: {rag_count}
314
+ • Issue context: {issue_key or "none"}
315
+
316
+ 🎯 Domains: {domains}
317
+ 📚 Sources: {source_count} ({list})
318
+
319
+ ✓ Context is fresh and PR-specific
320
+ ✓ Ready for review workflows
321
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
322
+ ```
323
+
324
+ ### 6. Store Context Path
325
+
326
+ Update PR context file to include knowledge base path:
327
+
328
+ ```yaml
329
+ # {review_output}/current-pr-context.yaml
330
+ pr_knowledge_base: "{review_output}/{filename}"
331
+ ```
332
+
333
+ This allows review workflows to find the knowledge base.
334
+
335
+ ### 7. Workflow Complete
336
+
337
+ Mark workflow as complete. Context is ready for use by review workflows (GR, SR, PR, AR).
@@ -0,0 +1,123 @@
1
+ ---
2
+ name: collect-pr-context
3
+ description: "Collect fresh, PR-specific context from multiple sources after describing the PR"
4
+ main_config: "{project-root}/_prr/prr/config.yaml"
5
+ nextStep: "./steps/step-01-analyze-files.md"
6
+ output_file: "{review_output}/pr-{pr_number}-context.yaml"
7
+ ---
8
+
9
+ # Collect PR-Specific Context Workflow
10
+
11
+ **Goal:** Dynamically collect context relevant to THIS specific PR from multiple sources. Context is always fresh and PR-specific, never cached.
12
+
13
+ ## WHY THIS APPROACH
14
+
15
+ **Problems with static cached context:**
16
+ - ❌ Goes stale when rules change
17
+ - ❌ User must remember to refresh manually
18
+ - ❌ Includes irrelevant context for small PRs
19
+
20
+ **Benefits of dynamic PR-specific context:**
21
+ - ✅ Always latest (collected fresh each time)
22
+ - ✅ PR-specific (only rules/docs relevant to files changed)
23
+ - ✅ No manual refresh needed
24
+ - ✅ Can extract inline code annotations
25
+ - ✅ Supports multiple sources (docs, configs, code, external APIs)
26
+
27
+ ## WHEN TO RUN
28
+
29
+ **Automatically** after [DP] Describe PR in the quick workflow.
30
+ Runs before any review workflows to provide fresh context.
31
+
32
+ ## CONTEXT SOURCES
33
+
34
+ ### 1. Primary Documentation
35
+ - `CLAUDE.md` - Project-wide instructions
36
+ - `AGENTS.md` - Agent-specific guidelines
37
+ - `.github/CLAUDE_CODE_RULES.md`
38
+
39
+ ### 2. Config Files (based on file types changed)
40
+ - `.eslintrc*` - Linting rules
41
+ - `.prettierrc*` - Formatting rules
42
+ - `tsconfig.json` - TypeScript config
43
+ - `vite.config.*` / `webpack.config.*` - Build config
44
+
45
+ ### 3. Standards Documents
46
+ - `CONTRIBUTING.md` - Coding standards
47
+ - `ARCHITECTURE.md` - Architecture patterns
48
+ - `docs/**/*.md` - Domain-specific docs
49
+
50
+ ### 4. Inline Code Annotations
51
+ Extract from changed files:
52
+ - `@context:` - Contextual information
53
+ - `@security:` - Security requirements
54
+ - `@pattern:` - Required patterns
55
+ - `@rule:` - Specific rules
56
+
57
+ ### 5. Stack-Specific Rules (automatic)
58
+ Loaded from `_prr/prr/data/stacks/{stack}.md` based on detected technology. Detection is automatic from file extensions, imports, and config files — see `step-01-analyze-files.md` for full detection logic.
59
+
60
+ **Frontend Frameworks:** vue3, react, angular, svelte, nextjs, nuxtjs, astro, solidjs, htmx, qwik
61
+ **Styling:** typescript, tailwindcss, css, sass, styled-components
62
+ **State Management:** redux, mobx, zustand
63
+ **Backend — Node.js:** nestjs, expressjs, fastify, hono
64
+ **Backend — Python:** fastapi, django, flask, python
65
+ **Backend — Java:** spring-boot, java
66
+ **Backend — JVM:** kotlin, scala
67
+ **Backend — .NET:** csharp
68
+ **Backend — Systems:** cpp, rust, zig
69
+ **Backend — Functional:** elixir, phoenix, haskell
70
+ **Backend — Scripting:** go, gin, fiber, actix, axum, lua, bash, php, laravel, rails
71
+ **Database / ORM:** sql, postgresql, mysql, sqlite, mongodb, redis, dynamodb, prisma, typeorm, sequelize, drizzle
72
+ **BaaS / Cloud:** firebase, supabase, aws-cdk
73
+ **Testing — Unit/Integration:** jest-vitest, pytest, junit, playwright, cypress
74
+ **Infrastructure:** docker, kubernetes, helm, terraform, github-actions, ansible, nginx
75
+ **API Layer:** graphql, grpc, trpc, apollo, socket-io
76
+ **Mobile:** react-native, flutter, expo, android, swift
77
+ **Desktop:** electron, tauri
78
+ **Runtime:** deno, bun, node
79
+ **Game Dev:** unity, unreal, godot, phaser, bevy, babylonjs, opengl, vulkan, libgdx, love2d, monogame, pygame
80
+ **AI/ML:** langchain, openai-api, pytorch, scikit-learn
81
+ **Web Components:** lit, htmx
82
+ **Blockchain:** solidity
83
+ **Systems/WASM:** wasm
84
+
85
+ Each stack file contains Security / Performance / Architecture / Code Quality / Common Bugs rules organized by severity (CRITICAL / HIGH / MEDIUM / LOW). Rules are injected into the knowledge base and applied by all reviewers (GR, SR, PR, AR, BR).
86
+
87
+ If a stack has no matching data file, skip it silently and proceed with general rules only.
88
+
89
+ ### 6. External Sources (optional)
90
+ - Company standards APIs
91
+ - Confluence/Wiki pages
92
+ - Remote documentation
93
+
94
+ ### 7. MCP Tools (if available in session)
95
+ - **Knowledge base MCPs** (Confluence, Notion, Obsidian) → team standards, ADRs not in local docs
96
+ - **Project management MCPs** (Jira, Linear, GitHub Issues) → linked issue, acceptance criteria
97
+ - **Design MCPs** (Figma, Zeplin) → design specs for UI changes
98
+ - **Code intelligence MCPs** (Sourcegraph, GitHub) → similar patterns in codebase
99
+
100
+ ### 8. RAG Systems (if configured)
101
+ - AWS Bedrock knowledge base
102
+ - GitHub Graph RAG
103
+ - Custom vector databases
104
+ - Query for: similar patterns, past decisions, architecture examples
105
+
106
+ ## WORKFLOW ARCHITECTURE
107
+
108
+ 3-step process:
109
+ 1. **Analyze files** changed in PR — extract metadata, domains, and **detect technology stacks**
110
+ 2. **Collect context** from all sources: primary docs, config files, standards docs, inline annotations, **stack-specific rules**, MCP tools, RAG systems
111
+ 3. **Build PR-specific knowledge base** — structured YAML with all context, stack rules, and reviewer guidance
112
+
113
+ ## INITIALIZATION
114
+
115
+ Load config from `{main_config}`.
116
+
117
+ Check if PR number is available:
118
+ - If available: use `pr-{pr_number}-context.yaml`
119
+ - If not: use `pr-{branch_name}-context.yaml`
120
+
121
+ ## EXECUTION
122
+
123
+ Read fully and follow: `{nextStep}`
@@ -22,7 +22,8 @@ Analyze the diff to determine the PRIMARY type (pick the best match):
22
22
  | `feature` | New files, new functions, new UI components |
23
23
  | `refactor` | Same behavior, restructured code, renamed variables |
24
24
  | `performance` | Caching, query optimization, async improvements |
25
- | `security` | Auth changes, input validation, dependency updates |
25
+ | `security` | Auth changes, input validation, dependency security updates |
26
+ | `hotfix` | Urgent production fix, usually a targeted single change |
26
27
  | `test` | Only test file changes |
27
28
  | `docs` | Only documentation/comment changes |
28
29
  | `config` | Config files, env, CI/CD changes |
@@ -38,12 +39,17 @@ Based on PR type and what was changed:
38
39
  ### 3. Generate Review Recommendations
39
40
 
40
41
  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
42
+ - bugfix → GR + SR (if security-related) + BR (if user-facing)
43
+ - feature → GR + AR + PR (if DB/async) + BR (user impact + feature completeness)
44
+ - security → SR (mandatory) + GR + BR (business/compliance risk)
45
+ - performance → PR + GR + BR (if user-facing slowness)
45
46
  - refactor → AR + GR
46
- - All high-risk PRs SR mandatory
47
+ - hotfix → GR + SR + BR (high deployment risk assess before shipping)
48
+ - test → GR (light)
49
+ - docs → (skip or GR light)
50
+ - config → GR
51
+ - chore → GR (light)
52
+ - All high-risk PRs → SR mandatory + BR mandatory
47
53
 
48
54
  ### 4. Load Next Step
49
55
 
@@ -36,6 +36,64 @@ Format:
36
36
  Focus: Check token validation logic and blacklist cleanup mechanism
37
37
  ```
38
38
 
39
- ### 3. Load Next Step
39
+ ### 3. Generate Impact Map
40
+
41
+ After summarizing each file, proactively scan for cross-cutting side effects. This map will be attached to the PR description output and used by all review phases.
42
+
43
+ #### 3a. Shared / Generic Module Changes
44
+
45
+ For each changed file that is a **shared, generic, or common** resource (utility modules, shared libraries, base classes, common interfaces/headers, core services, shared data models, global state, or any module imported by many others):
46
+
47
+ - Search the codebase (via grep/search tools on import/include/require/use statements) for all files that depend on it
48
+ - Count consumers and list up to 5 of the most significant ones (most widely depended-upon, or in the most critical workflows based on naming/context)
49
+ - Flag if the change is **breaking** (signature change, removed export, behavior change) or **additive**
50
+ - If codebase search is unavailable (diff-only context), note: "⚠️ Consumer scan not possible — flag for manual inspection by reviewer"
51
+
52
+ Format:
53
+ ```
54
+ ⚠️ IMPACT: src/common/HttpClient.ts — used by 34 files
55
+ Change type: Public interface modified (added required param `timeout`)
56
+ Key consumers: OrderService.ts, UserService.ts, NotificationService.ts
57
+ Risk: BREAKING — all consumers must pass `timeout` or get a compile/runtime error
58
+ ```
59
+
60
+ #### 3b. Side Effect Scan
61
+
62
+ For each changed file, identify any **observer/reactive dependencies** that may cause downstream effects in files NOT in the diff:
63
+
64
+ - **Observer / reactive patterns**: watchers, listeners, Rx streams, signals, delegates, callbacks, subscriptions that observe state changed in this PR — are their side effects scoped or global?
65
+ - **Lifecycle-bound resources**: listeners, timers, handles, connections, threads, or subscriptions created in setup/init — check that teardown/cleanup is still correct after this change
66
+ - **Shared / global state**: singletons, global variables, shared memory, context, state managers — who reads or writes this state outside the diff?
67
+ - **Event / signal dispatch**: new events, signals, notifications, or messages emitted/published — are all consumers/listeners accounted for? Is the payload backward compatible?
68
+ - **Cross-boundary contracts**: API response shape, function signatures, binary interfaces (ABI), serialization schemas (protobuf, JSON schema, GraphQL), DB schema — which consumers depend on the old shape?
69
+
70
+ Format:
71
+ ```
72
+ ⚡ SIDE EFFECT: src/core/SessionManager.cpp — `activeUser` state modified
73
+ Observed by (outside diff): ProfileRenderer.cpp (callback), PermissionGuard.ts (derived)
74
+ Risk: Logic change in activeUser may silently break profile display and permission checks
75
+ ```
76
+
77
+ #### 3c. Impact Map Summary
78
+
79
+ Produce a concise block at the end of the walkthrough:
80
+
81
+ ```
82
+ 📊 IMPACT MAP
83
+ ─────────────────────────────────────────────
84
+ Shared modules modified : X file(s) — [list]
85
+ Blast radius (consumers) : ~N files affected
86
+ Side effects / observers : X location(s) — [list]
87
+ Cross-service dependencies : X (if applicable)
88
+ ─────────────────────────────────────────────
89
+ ⚠️ High-risk items for reviewers: [bullet list of top concerns]
90
+ ```
91
+
92
+ If no cross-cutting impact is found, state explicitly:
93
+ ```
94
+ 📊 IMPACT MAP — No shared module or side effect impacts detected.
95
+ ```
96
+
97
+ ### 4. Load Next Step
40
98
 
41
99
  Add `step-03-walkthrough` to `stepsCompleted`. Load: `{nextStepFile}`
@@ -10,12 +10,16 @@ validation-target: "Architecture review output file"
10
10
  - [ ] Coupling and module dependencies reviewed
11
11
  - [ ] Consistency with existing codebase patterns assessed
12
12
  - [ ] SOLID violations checked (only real ones, not theoretical)
13
+ - [ ] Shared/generic module changes identified and blast radius assessed
14
+ - [ ] Backward compatibility of all changed public interfaces verified
13
15
 
14
16
  ## Finding Quality
15
17
  - [ ] Every finding references the EXISTING pattern that should be followed
16
18
  - [ ] Over-engineering suggestions are avoided (consistency > theoretical purity)
17
19
  - [ ] Every finding has: file path + what pattern was violated
18
20
  - [ ] Justification provided for why the finding matters (not just "violates SOLID")
21
+ - [ ] Blast radius findings include: consumer count + list of unupdated consumers
22
+ - [ ] ❓ QUESTION findings include: specific question + list of potentially affected files outside the diff
19
23
 
20
24
  ## Output
21
25
  - [ ] Findings written to `{review_output}/architecture-review-{date}.md`
@@ -3,17 +3,22 @@
3
3
  <critical>Communicate all responses in {communication_language}</critical>
4
4
  <critical>Consistency with EXISTING codebase patterns is paramount — avoid over-engineering or introducing new patterns without strong justification</critical>
5
5
  <critical>Always consider: would a new team member understand where this code belongs and why?</critical>
6
+ <critical>Finding severities: 🔴 BLOCKER | 🟡 WARNING | 🟢 SUGGESTION | ❓ QUESTION. Use ❓ when you cannot determine intent or impact from the diff alone and need author confirmation before judging. A QUESTION that gets a bad answer becomes a BLOCKER or WARNING.</critical>
6
7
 
7
- <step n="1" goal="Load PR context and understand the codebase structure">
8
+ <step n="1" goal="Load PR context, knowledge base, and understand the codebase structure">
8
9
  <check if="{pr_context} does not exist">
9
10
  <output>❌ No PR selected. Please run [SP] Select PR first.</output>
10
11
  <stop/>
11
12
  </check>
12
13
  <action>Read {pr_context} and load git diff</action>
14
+ <action>Load PR-specific knowledge base from {pr_knowledge_base}</action>
15
+ <action>Extract architectural patterns from knowledge_base.relevant_guidelines (ARCHITECTURE.md sections, ADRs)</action>
16
+ <action>Check pattern annotations from knowledge_base.inline_context (@pattern:)</action>
13
17
  <action>Also examine surrounding non-changed files to understand existing patterns</action>
14
18
  <output>🏗️ Starting Architecture Review
15
19
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
20
  Focus: Layer violations | Coupling | SOLID | Codebase consistency
21
+ Context: Loaded architectural patterns & ADRs from ARCHITECTURE.md
17
22
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
18
23
  </step>
19
24
 
@@ -46,7 +51,29 @@ Focus: Layer violations | Coupling | SOLID | Codebase consistency
46
51
  </check-list>
47
52
  </step>
48
53
 
49
- <step n="5" goal="SOLID principles (only flag real violations, not theoretical ones)">
54
+ <step n="5" goal="Shared module blast radius and backward compatibility">
55
+ <note>A change to any shared/common/generic module is high-risk because it affects all consumers — not just the code in this PR. This step must always run when any such file is changed.</note>
56
+ <check-list id="blast-radius">
57
+ <item>Identify: is the changed file a shared/common/generic resource? (utility modules, shared libraries, base classes, common interfaces/headers, core services, shared data models, global state)</item>
58
+ <item>Consumer count: search for all files importing or using this module and list them. Any breaking change is a 🔴 BLOCKER regardless of consumer count — high consumer count amplifies urgency but is not the deciding factor.</item>
59
+ <item>Backward compatibility: is the public interface (function signatures, return shapes, exported types, event/message payloads, binary interfaces) backward compatible? If breaking: are ALL affected consumers updated in this same PR, or is there an explicit migration/deprecation plan?</item>
60
+ <item>New required parameters without defaults are breaking changes — even if the author only updated their own call sites.</item>
61
+ <item>Behavior change: does a behavioral change to a shared module produce unintended effects in contexts the author did not test (e.g., different runtime configurations, platforms, permission levels, or edge-case inputs)?</item>
62
+ <item>Versioning / deprecation: if the change is intentionally breaking, is there a deprecation path? Is the old interface preserved with a deprecation notice?</item>
63
+ </check-list>
64
+ <output-format>
65
+ 🔴 BLOCKER `src/common/HttpClient.ts` — `sendRequest()` param `timeout` removed. Breaking change.
66
+ Consumer blast radius: ~23 files import this module (see Impact Map).
67
+ Not all consumers updated in this PR: OrderService.ts, NotificationService.ts still pass `timeout`.
68
+ → Either restore `timeout` as optional/deprecated, or update all consumers in this PR.
69
+
70
+ ❓ QUESTION `src/auth/AuthService.ts` — Return shape changed (added `permissions`, removed `roles`).
71
+ Consumers outside diff: RouteGuard.ts, AdminMiddleware.ts, PermissionHelper.ts
72
+ → Ask author: "Were all consumers of AuthService tested with the new return shape? Was `roles` removal intentional?"
73
+ </output-format>
74
+ </step>
75
+
76
+ <step n="6" goal="SOLID principles (only flag real violations, not theoretical ones)">
50
77
  <check-list id="solid">
51
78
  <item>SRP: class/module doing more than one thing AND causing maintenance problems?</item>
52
79
  <item>OCP: existing code modified instead of extended (when extension was clearly better)?</item>
@@ -57,12 +84,13 @@ Focus: Layer violations | Coupling | SOLID | Codebase consistency
57
84
  <note>Only flag SOLID violations when they cause REAL maintainability or extensibility problems — not theoretical purity</note>
58
85
  </step>
59
86
 
60
- <step n="6" goal="Compile and write findings">
61
- <action>Group findings: Layer Violations | Coupling Issues | Consistency Problems | SOLID Violations</action>
87
+ <step n="7" goal="Compile and write findings">
88
+ <action>Group findings: Layer Violations | Coupling Issues | Consistency Problems | SOLID Violations | ❓ Questions for Author</action>
62
89
  <action>For each finding: reference the EXISTING pattern that should be followed instead</action>
63
90
  <action>Write findings to {output_file}</action>
64
91
  <action>Update {pr_context}: add 'architecture-review' to completed list</action>
65
92
  <output>🏗️ Architecture review complete.
93
+ {blocker_count} blockers (🔴), {warning_count} warnings (🟡), {suggestion_count} suggestions (🟢), {question_count} questions (❓) for author.
66
94
  Run [RR] Generate Report to compile all findings.</output>
67
95
  </step>
68
96
  </workflow>