prr-kit 2.0.8 → 2.0.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prr-kit",
3
- "version": "2.0.8",
3
+ "version": "2.0.9",
4
4
  "description": "AI-driven Pull Request Review Kit — structured agent workflows for thorough, consistent code review",
5
5
  "main": "tools/cli/prr-cli.js",
6
6
  "bin": {
@@ -6,6 +6,7 @@
6
6
  <rule>ALWAYS update frontmatter state when writing output</rule>
7
7
  <rule>ALWAYS halt at decision points and wait for user input</rule>
8
8
  <rule>ALWAYS load config variables before starting any workflow</rule>
9
+ <rule>Use native file-reading tools for file content — avoid shell commands for reading files</rule>
9
10
  </rules>
10
11
 
11
12
  <variable-resolution>
@@ -41,6 +41,8 @@ Display EXACTLY:
41
41
  • Mix freely "security only, focus on JWT handling, context: auth rewrite in progress"
42
42
  ```
43
43
 
44
+ **IMPORTANT: Output this prompt as plain text only — do NOT use interactive question UI or structured choice tools. Wait for free-form text input.**
45
+
44
46
  **HALT — wait for user response before continuing.**
45
47
 
46
48
  ### 3. Parse Response
@@ -28,18 +28,14 @@ For each file in the PR diff, extract:
28
28
  - Directory path segments (e.g., `src`, `stores`)
29
29
 
30
30
  **File categories:**
31
- ```javascript
32
- const fileCategories = {
33
- 'src/components/*.vue': 'vue-component',
34
- 'src/views/*.vue': 'vue-view',
35
- 'src/stores/*.js': 'pinia-store',
36
- 'src/router/*.js': 'vue-router',
37
- 'src/composables/*.js': 'composable',
38
- '*.test.js|*.spec.js': 'test',
39
- 'src/utils/*.js': 'utility',
40
- '*.css|*.scss': 'stylesheet'
41
- }
42
- ```
31
+
32
+ Infer category from the file's path, extension, and directory name. Use project-specific structure — there are no fixed categories. Examples of common patterns:
33
+ - `src/components/**` or `ui/**` → component
34
+ - `src/stores/**` or `state/**` → state management
35
+ - `*.test.*` or `*.spec.*` or `tests/**` → test
36
+ - `*.css` / `*.scss` / `*.sass` → stylesheet
37
+ - `src/utils/**` or `helpers/**` → utility
38
+ - Adapt freely based on what the actual project structure reveals
43
39
 
44
40
  ### 3. Detect Domains
45
41
 
@@ -77,29 +73,11 @@ Extract these annotations with:
77
73
 
78
74
  ### 5. Identify Config Files Needed
79
75
 
80
- Based on file types changed:
81
-
82
- ```javascript
83
- const configMapping = {
84
- '.vue': ['.eslintrc*', '.prettierrc*', 'vite.config.*'],
85
- '.js|.ts': ['.eslintrc*', '.prettierrc*', 'tsconfig.json'],
86
- '.py': ['pyproject.toml', '.flake8', 'mypy.ini'],
87
- '.css|.scss': ['.stylelintrc*']
88
- }
89
- ```
76
+ Based on detected file types and stacks, identify relevant config files that likely contain lint rules, formatting, or build constraints. Look for common config patterns for the detected languages/frameworks — linter configs, formatter configs, compiler configs, build tool configs. Don't assume specific filenames; check what actually exists in the repo root.
90
77
 
91
78
  ### 6. Identify Docs Needed
92
79
 
93
- Based on domains and categories:
94
-
95
- ```javascript
96
- const docsMapping = {
97
- 'vue-component': ['CONTRIBUTING.md → Component section', 'docs/components.md'],
98
- 'pinia-store': ['ARCHITECTURE.md → State management', 'docs/state-management.md'],
99
- 'security': ['CONTRIBUTING.md → Security section', 'docs/security.md'],
100
- 'api': ['docs/api-guidelines.md', 'ARCHITECTURE.md → API section']
101
- }
102
- ```
80
+ Based on detected domains and categories, identify relevant documentation files that reviewers should consult. Look for CONTRIBUTING.md, ARCHITECTURE.md, CLAUDE.md, AGENTS.md, and any domain-specific docs (e.g., `docs/api.md`, `docs/security.md`). Match docs to the actual domains found in this PR — don't load docs unrelated to the changed files.
103
81
 
104
82
  ### 7. Detect Technology Stacks
105
83
 
@@ -284,37 +262,23 @@ If no stack is confidently detected → `detected_stacks: []` — steps downstre
284
262
 
285
263
  ### 8. Build Analysis Summary
286
264
 
287
- ```javascript
288
- {
289
- "files_changed": [
290
- {
291
- "path": "src/stores/todoStore.js",
292
- "extension": ".js",
293
- "category": "pinia-store",
294
- "domains": ["state-management"],
295
- "annotations": [
296
- {
297
- "line": 10,
298
- "type": "@pattern",
299
- "content": "Use composition API only"
300
- }
301
- ]
302
- },
303
- {
304
- "path": "src/views/TodoListView.vue",
305
- "extension": ".vue",
306
- "category": "vue-view",
307
- "domains": ["ui-components", "state-management"]
308
- }
309
- ],
310
- "context_needs": {
311
- "configs": [".eslintrc.js", ".prettierrc", "vite.config.js"],
312
- "docs": ["CONTRIBUTING.md", "ARCHITECTURE.md"],
313
- "primary": ["CLAUDE.md", "AGENTS.md"],
314
- "domains": ["state-management", "ui-components"]
315
- },
316
- "detected_stacks": ["vue3", "typescript"]
317
- }
265
+ Build a summary object for all changed files using the structure below. Replace the example values with actual data from this PR:
266
+
267
+ ```
268
+ files_changed:
269
+ - path: {actual file path}
270
+ extension: {actual extension}
271
+ category: {inferred category for this project}
272
+ domains: [{relevant domains}]
273
+ annotations: [{any @context/@security/@pattern/@rule comments found}]
274
+
275
+ context_needs:
276
+ configs: [{config files found that are relevant to changed file types}]
277
+ docs: [{doc files relevant to domains changed}]
278
+ primary: [{CLAUDE.md, AGENTS.md, or equivalent if present}]
279
+ domains: [{all unique domains across changed files}]
280
+
281
+ detected_stacks: [{stack keys from step 7}]
318
282
  ```
319
283
 
320
284
  ### 9. Report Analysis
@@ -46,28 +46,18 @@ Display EXACTLY:
46
46
  • Mix freely "security only, focus on JWT handling, context: auth rewrite in progress"
47
47
  ```
48
48
 
49
+ **IMPORTANT: Output this prompt as plain text only — do NOT use interactive question UI or structured choice tools. Wait for free-form text input.**
50
+
49
51
  **HALT — wait for user response before continuing.**
50
52
 
51
53
  ### 3. Parse Response
52
54
 
53
55
  **If user pressed Enter / left empty:**
54
56
  - Set `user_instructions.provided` = `false`
55
- - Set `user_instructions.review_scope` = `"all"`
56
- - Set all other fields to `null`
57
+ - Set all fields to `null`
57
58
 
58
59
  **If user typed something**, parse the free-form text and extract:
59
60
 
60
- **`review_scope`** — which reviews to run:
61
- - Parse for scope signals: "only X", "just X", "X only", "skip X", "no X review", "X and Y"
62
- - Map to codes: `GR` (general), `SR` (security), `PR` (performance), `AR` (architecture), `BR` (business), `IC` (improve code)
63
- - Examples:
64
- - "only security" → `[SR]`
65
- - "security and architecture" → `[SR, AR]`
66
- - "skip performance" → `[GR, SR, AR, BR]`
67
- - "security, focus on JWT" → `[SR]` (scope signal found)
68
- - "focus on SQL injection" (no scope signal) → `"all"` (focus only, all reviews still run)
69
- - If no scope restriction found → `"all"`
70
-
71
61
  **`focus_areas`** — specific things reviewers must prioritize (list of strings), or `null` if none mentioned.
72
62
 
73
63
  **`custom_requirements`** — mandatory checks user specified (list of strings), or `null`.
@@ -85,7 +75,6 @@ Set `user_instructions.provided` = `true`.
85
75
  ```
86
76
  ✅ Instructions captured — driving all downstream review steps.
87
77
 
88
- 📋 Scope: {scope_list joined with ", " OR "all reviews (standard)"}
89
78
  🎯 Focus: {focus_areas joined with ", " OR "standard coverage"}
90
79
  ✅ Requirements: {custom_requirements joined with ", " OR "none"}
91
80
  📝 Context: {context_notes joined with "; " OR "none"}
@@ -22,7 +22,6 @@ Using the `manual_context` variable set in step-03:
22
22
 
23
23
  - **If `manual_context` is null** (user skipped): set `user_instructions.provided = false`, all other fields `null`.
24
24
  - **If `manual_context` is not null** (user provided text): set `user_instructions.provided = true`, `raw = manual_context`, then parse the free-form text:
25
- - `review_scope` — look for scope signals ("only SR", "skip performance", "security and architecture"). Default `"all"` if none found.
26
25
  - `focus_areas` — extract specific things to prioritize (e.g. "focus on JWT handling" → `["JWT handling"]`). `null` if none.
27
26
  - `custom_requirements` — extract mandatory checks the user stated (e.g. "all endpoints must have auth middleware"). `null` if none.
28
27
  - `context_notes` — extract background info, trade-offs, constraints. `null` if none.
@@ -45,13 +44,12 @@ pr_metadata:
45
44
 
46
45
  # ⚠️ IMPORTANT — Human-provided instructions from the user.
47
46
  # All reviewers MUST read this section before starting any review.
48
- # review_scope controls which reviews run. focus_areas, custom_requirements, and context_notes
47
+ # focus_areas, custom_requirements, and context_notes
49
48
  # are highest-priority guidance — align all findings against them.
50
49
  user_instructions:
51
50
  # Populated only when the user provided input in step-03-manual-context-input.
52
51
  # If provided: true — treat this content as the highest-priority context in this file.
53
52
  provided: {true|false}
54
- review_scope: {"all" | [SR] | [SR, AR] | ...} # "all" = run all reviews; list = only those codes
55
53
  focus_areas: {list of strings, or null} # specific things every reviewer must prioritize
56
54
  custom_requirements: {list of strings, or null} # mandatory checks the user specified
57
55
  context_notes: {list of strings, or null} # background info, trade-offs, constraints
@@ -337,7 +335,7 @@ Example: `_prr-output/reviews/2026-03-02-1430-pr123-feature-auth/pr-context.yaml
337
335
  • ESLint rules: {n}
338
336
  • Guidelines: {m}
339
337
  • Inline annotations: {k}
340
- • User instructions: ⚠️ YES — scope: {scope}, focus: {focus_count} areas, requirements: {req_count}
338
+ • User instructions: ⚠️ YES — focus: {focus_count} areas, requirements: {req_count}
341
339
  OR
342
340
  • User instructions: none — full standard review
343
341
  • MCP tools used: {mcp_list or "none"}
@@ -36,20 +36,19 @@ Based on PR type and what was changed:
36
36
  - **🟡 Medium Risk**: Core business logic, API changes, database schema
37
37
  - **🟢 Low Risk**: UI tweaks, docs, test additions, minor refactors
38
38
 
39
- ### 3. Generate Review Recommendations
40
-
41
- Based on classification, recommend specific reviews:
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)
46
- - refactor → AR + GR
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
39
+ ### 3. Suggest Review Focus
40
+
41
+ Based on classification and risk level, suggest which reviews are most relevant — the orchestrator will use these as input alongside user instructions:
42
+ - bugfix → GR is core; SR if the fix touches security paths; BR if user-facing behavior changes
43
+ - feature → GR + AR to check design; PR if performance-sensitive changes; BR for user impact
44
+ - security → SR is highest priority; GR and BR for full picture
45
+ - performance → PR is core; GR for code quality; BR if user-facing impact
46
+ - refactor → AR to check structural consistency; GR for quality
47
+ - hotfix → fast GR + SR + BR to assess risk before shipping
48
+ - test/docs/config/chorelight GR or skip heavy reviews if changes are low-risk
49
+ - High-risk PRs expand scope, don't skip SR or BR
50
+
51
+ These are starting suggestions — adapt based on what was actually changed and any user instructions.
53
52
 
54
53
  ### 4. Load Next Step
55
54
 
@@ -10,7 +10,7 @@
10
10
  <output>❌ No PR selected. Please run [SP] Select PR first.</output>
11
11
  <stop/>
12
12
  </check>
13
- <action>Read {pr_context} and load git diff</action>
13
+ <action>Read {pr_context}</action>
14
14
  <action>Load PR-specific knowledge base from {pr_knowledge_base}</action>
15
15
  <action>Extract architectural patterns from knowledge_base.relevant_guidelines (ARCHITECTURE.md sections, ADRs)</action>
16
16
  <action>Check pattern annotations from knowledge_base.inline_context (@pattern:)</action>
@@ -16,7 +16,6 @@
16
16
  <action>Load PR-specific knowledge base from {pr_knowledge_base} — extract issue_context (acceptance criteria) if available from MCP tools</action>
17
17
  <action>Adapt review scope: use knowledge_base.stack_context, knowledge_base.files_analysis, and knowledge_base.reviewer_guidance.business_review to adjust business focus based on detected project type and domain.</action>
18
18
  <action>Load findings already collected from completed reviews (GR, SR, PR, AR) to translate them into business impact</action>
19
- <action>Run: git diff {base_branch}...{target_branch} --stat in {target_repo} for file scope</action>
20
19
 
21
20
  <output>💼 Starting Business Review
22
21
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
@@ -15,14 +15,11 @@
15
15
  <action>Load PR-specific knowledge base from {pr_knowledge_base} (e.g., pr-123-context.yaml)</action>
16
16
  <note>Knowledge base contains: relevant ESLint rules, guidelines from CLAUDE.md/CONTRIBUTING.md/ARCHITECTURE.md, inline annotations, external rules</note>
17
17
  <action>Adapt review scope: use knowledge_base.stack_context, knowledge_base.files_analysis, and knowledge_base.reviewer_guidance.general_review to adjust focus based on detected technology and project patterns.</action>
18
- <action>Run: git diff {base_branch}...{target_branch} in {target_repo}</action>
19
- <action>Note diff_strategy: if 'chunked', process file by file</action>
20
18
 
21
19
  <output>🔍 Starting General Code Review
22
20
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
23
21
  PR: {target_branch} → {base_branch}
24
22
  Context: Loaded fresh PR-specific knowledge base
25
- Strategy: {diff_strategy}
26
23
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
27
24
  </step>
28
25
 
@@ -10,7 +10,7 @@
10
10
  <output>❌ No PR selected. Please run [SP] Select PR first.</output>
11
11
  <stop/>
12
12
  </check>
13
- <action>Read {pr_context} and load git diff</action>
13
+ <action>Read {pr_context}</action>
14
14
  <action>Load PR-specific knowledge base from {pr_knowledge_base}</action>
15
15
  <action>Extract performance guidelines from knowledge_base.relevant_guidelines</action>
16
16
  <action>Adapt review scope: use knowledge_base.stack_context, knowledge_base.files_analysis, and knowledge_base.reviewer_guidance.performance_review to evaluate which of the default check categories below are relevant to this project and this PR. Categories that have no applicability to the detected project type should be skipped entirely.</action>
@@ -16,7 +16,6 @@
16
16
  <action>Check for security annotations from knowledge_base.inline_context (@security:)</action>
17
17
  <action>Adapt review scope: use knowledge_base.stack_context, knowledge_base.files_analysis, and knowledge_base.reviewer_guidance.security_review to evaluate which of the default check categories below are relevant to this project and this PR. Step 2 (hardcoded secrets) always runs. Other categories should be evaluated for relevance before running.</action>
18
18
  <action>Identify stack-specific security rules from knowledge_base.stack_context.rules — these will be applied as additional checks in the dedicated step below.</action>
19
- <action>Run: git diff {base_branch}...{target_branch} in {target_repo}</action>
20
19
  <output>🔒 Starting Security Review — Thinking like an attacker
21
20
  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
22
21
  Scope: Secrets scan (always) + adapted checks for detected stack
@@ -19,6 +19,8 @@ Set `date` = today's date (YYYY-MM-DD).
19
19
  **Note:** Context will be collected dynamically in Phase 2.5 after describing the PR.
20
20
  No pre-collected context file needed. Context is always fresh and PR-specific.
21
21
 
22
+ **File access:** Pre-saved diff files are available at `{session_output}/diffs/` after Phase 1f. Use native file-reading tools throughout this session — avoid shell commands for reading file content. When full file context is needed beyond the diff, read files directly from the working directory. For most accurate review results, ensure the current branch is the PR's target branch.
23
+
22
24
  ---
23
25
 
24
26
  ## PHASE 1 — SELECT PR
@@ -324,22 +326,13 @@ On completion, store `pr_knowledge_base` = path to the generated context file.
324
326
  ---
325
327
 
326
328
  ## PHASE 3 — REVIEW
327
- *Execute all review types automatically, one by one.*
328
-
329
- **Before each review, confirm these variables are set in working context (all set by earlier phases):**
330
- - `target_branch`, `base_branch`, `pr_number` — set by Phase 1 (Select PR)
331
- - `pr_knowledge_base` — set by Phase 2.5 (`{session_output}/pr-context.yaml`)
332
- - `session_output` — set by Phase 1 when session folder was created
333
- - `target_repo`, `communication_language` — from config
334
- - `output_file` — per-review path defined below *(ensures findings are saved to disk for [RR] and [PC] later)*
335
329
 
336
- **Scope gate:** Read `user_instructions.review_scope` from `{pr_knowledge_base}`.
337
- - If `"all"` (or knowledge base missing) → run all reviews 3a–3e normally.
338
- - If a list (e.g. `[SR, AR]`) → only run reviews whose code is in the list. For each skipped review, print:
339
- `⏭️ {Review Name} skipped (not in scope)`
340
- and do NOT write its output file.
330
+ **Context:** Confirm `target_branch`, `base_branch`, `session_output`, `pr_knowledge_base`, `communication_language` are in working context from earlier phases. Set `output_file` per review as defined below.
341
331
 
342
- Review codes: `GR` = General · `SR` = Security · `PR` = Performance · `AR` = Architecture · `BR` = Business
332
+ **Review orchestration:** Read `user_instructions` from `{pr_knowledge_base}`. Use judgment to decide which review skills (3a–3e) to run, in what order, and with what focus — based on the user's actual intent, the PR type, and the project context.
333
+ - No user instructions provided → run all reviews in default order.
334
+ - User specified scope, focus, or constraints → adapt accordingly: skip irrelevant reviews, reorder, or narrow focus to serve the user's actual need. Reviews are optional skills — invoke only what genuinely serves the request.
335
+ - For each skipped review: print `⏭️ {Review Name} skipped` and do not write its output file.
343
336
 
344
337
  ### 3a. General Review
345
338
  Set `output_file` = `{session_output}/general-review.md`
@@ -383,7 +376,7 @@ Print section header: `## 💼 Business Review`
383
376
  ## PHASE 4 — GENERATE REPORT
384
377
  *Execute automatically.*
385
378
 
386
- Compile all findings from phases 3a–3e.
379
+ Compile all findings from completed reviews.
387
380
 
388
381
  Sort by severity: 🔴 Blockers first → 🟡 Warnings → 🟢 Suggestions → 📌 Questions.
389
382