prr-kit 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (86) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +226 -0
  3. package/docs/assets/banner.svg +179 -0
  4. package/package.json +60 -0
  5. package/src/core/agents/prr-master.agent.yaml +80 -0
  6. package/src/core/module.yaml +19 -0
  7. package/src/core/tasks/help.md +37 -0
  8. package/src/core/tasks/workflow.xml +22 -0
  9. package/src/core/workflows/party-mode/steps/step-01-load-reviewers.md +68 -0
  10. package/src/core/workflows/party-mode/steps/step-02-discussion.md +125 -0
  11. package/src/core/workflows/party-mode/workflow.md +35 -0
  12. package/src/prr/agents/architecture-reviewer.agent.yaml +45 -0
  13. package/src/prr/agents/general-reviewer.agent.yaml +48 -0
  14. package/src/prr/agents/performance-reviewer.agent.yaml +45 -0
  15. package/src/prr/agents/security-reviewer.agent.yaml +43 -0
  16. package/src/prr/data/review-types.csv +39 -0
  17. package/src/prr/module.yaml +38 -0
  18. package/src/prr/workflows/0-setup/collect-project-context/steps/step-01-scan-configs.md +106 -0
  19. package/src/prr/workflows/0-setup/collect-project-context/steps/step-02-extract-rules.md +131 -0
  20. package/src/prr/workflows/0-setup/collect-project-context/steps/step-03-ask-context.md +194 -0
  21. package/src/prr/workflows/0-setup/collect-project-context/steps/step-04-save-context.md +161 -0
  22. package/src/prr/workflows/0-setup/collect-project-context/workflow.md +58 -0
  23. package/src/prr/workflows/1-discover/select-pr/steps/step-01-fetch.md +68 -0
  24. package/src/prr/workflows/1-discover/select-pr/steps/step-02-list-branches.md +95 -0
  25. package/src/prr/workflows/1-discover/select-pr/steps/step-03-select.md +127 -0
  26. package/src/prr/workflows/1-discover/select-pr/steps/step-04-load-diff.md +79 -0
  27. package/src/prr/workflows/1-discover/select-pr/steps/step-05-confirm.md +76 -0
  28. package/src/prr/workflows/1-discover/select-pr/workflow.md +36 -0
  29. package/src/prr/workflows/2-analyze/describe-pr/steps/step-01-load-context.md +37 -0
  30. package/src/prr/workflows/2-analyze/describe-pr/steps/step-02-classify.md +50 -0
  31. package/src/prr/workflows/2-analyze/describe-pr/steps/step-03-walkthrough.md +41 -0
  32. package/src/prr/workflows/2-analyze/describe-pr/steps/step-04-output.md +50 -0
  33. package/src/prr/workflows/2-analyze/describe-pr/templates/pr-description.template.md +51 -0
  34. package/src/prr/workflows/2-analyze/describe-pr/workflow.md +28 -0
  35. package/src/prr/workflows/3-review/architecture-review/checklist.md +22 -0
  36. package/src/prr/workflows/3-review/architecture-review/instructions.xml +68 -0
  37. package/src/prr/workflows/3-review/architecture-review/workflow.yaml +18 -0
  38. package/src/prr/workflows/3-review/general-review/checklist.md +23 -0
  39. package/src/prr/workflows/3-review/general-review/instructions.xml +68 -0
  40. package/src/prr/workflows/3-review/general-review/workflow.yaml +18 -0
  41. package/src/prr/workflows/3-review/performance-review/checklist.md +22 -0
  42. package/src/prr/workflows/3-review/performance-review/instructions.xml +68 -0
  43. package/src/prr/workflows/3-review/performance-review/workflow.yaml +18 -0
  44. package/src/prr/workflows/3-review/security-review/checklist.md +25 -0
  45. package/src/prr/workflows/3-review/security-review/data/owasp-checklist.csv +19 -0
  46. package/src/prr/workflows/3-review/security-review/instructions.xml +70 -0
  47. package/src/prr/workflows/3-review/security-review/workflow.yaml +19 -0
  48. package/src/prr/workflows/4-improve/improve-code/checklist.md +18 -0
  49. package/src/prr/workflows/4-improve/improve-code/instructions.xml +59 -0
  50. package/src/prr/workflows/4-improve/improve-code/workflow.yaml +18 -0
  51. package/src/prr/workflows/5-ask/ask-code/steps/step-01-load-context.md +37 -0
  52. package/src/prr/workflows/5-ask/ask-code/steps/step-02-answer.md +36 -0
  53. package/src/prr/workflows/5-ask/ask-code/workflow.md +31 -0
  54. package/src/prr/workflows/6-report/generate-report/steps/step-01-collect.md +42 -0
  55. package/src/prr/workflows/6-report/generate-report/steps/step-02-organize.md +38 -0
  56. package/src/prr/workflows/6-report/generate-report/steps/step-03-write.md +44 -0
  57. package/src/prr/workflows/6-report/generate-report/templates/review-report.template.md +78 -0
  58. package/src/prr/workflows/6-report/generate-report/workflow.md +26 -0
  59. package/src/prr/workflows/6-report/post-comments/steps/step-01-format.md +166 -0
  60. package/src/prr/workflows/6-report/post-comments/steps/step-02-post.md +97 -0
  61. package/src/prr/workflows/6-report/post-comments/workflow.md +45 -0
  62. package/src/prr/workflows/quick/workflow.md +244 -0
  63. package/tools/cli/commands/install.js +66 -0
  64. package/tools/cli/commands/status.js +36 -0
  65. package/tools/cli/commands/uninstall.js +38 -0
  66. package/tools/cli/installers/lib/core/config-collector.js +47 -0
  67. package/tools/cli/installers/lib/core/detector.js +46 -0
  68. package/tools/cli/installers/lib/core/installer.js +162 -0
  69. package/tools/cli/installers/lib/core/manifest-generator.js +172 -0
  70. package/tools/cli/installers/lib/core/manifest.js +62 -0
  71. package/tools/cli/installers/lib/ide/_base-ide.js +36 -0
  72. package/tools/cli/installers/lib/ide/_config-driven.js +167 -0
  73. package/tools/cli/installers/lib/ide/manager.js +97 -0
  74. package/tools/cli/installers/lib/ide/platform-codes.yaml +76 -0
  75. package/tools/cli/installers/lib/ide/shared/path-utils.js +11 -0
  76. package/tools/cli/installers/lib/ide/templates/combined/default-agent.md +16 -0
  77. package/tools/cli/installers/lib/ide/templates/combined/default-workflow.md +7 -0
  78. package/tools/cli/installers/lib/ide/templates/combined/windsurf-workflow.md +5 -0
  79. package/tools/cli/lib/agent/compiler.js +123 -0
  80. package/tools/cli/lib/agent/template-engine.js +73 -0
  81. package/tools/cli/lib/cli-utils.js +32 -0
  82. package/tools/cli/lib/prompts.js +15 -0
  83. package/tools/cli/lib/ui.js +132 -0
  84. package/tools/cli/lib/xml-utils.js +24 -0
  85. package/tools/cli/prr-cli.js +36 -0
  86. package/tools/prr-npx-wrapper.js +6 -0
@@ -0,0 +1,18 @@
1
+ name: architecture-review
2
+ description: "Architecture-focused review: SOLID principles, layering, coupling, codebase consistency"
3
+ author: "PR Review Framework"
4
+
5
+ config_source: "{project-root}/_prr/prr/config.yaml"
6
+ user_name: "{config_source}:user_name"
7
+ communication_language: "{config_source}:communication_language"
8
+ target_repo: "{config_source}:target_repo"
9
+ review_output: "{config_source}:review_output"
10
+ date: system-generated
11
+
12
+ installed_path: "{project-root}/_prr/prr/workflows/3-review/architecture-review"
13
+ instructions: "{installed_path}/instructions.xml"
14
+ validation: "{installed_path}/checklist.md"
15
+
16
+ pr_context: "{review_output}/current-pr-context.yaml"
17
+ project_context: "{review_output}/project-context.yaml"
18
+ output_file: "{review_output}/architecture-review-{date}.md"
@@ -0,0 +1,23 @@
1
+ ---
2
+ title: "General Review Completion Checklist"
3
+ validation-target: "General review output file"
4
+ ---
5
+
6
+ # General Review Checklist
7
+
8
+ ## Coverage
9
+ - [ ] All changed files reviewed (or all chunks if large diff)
10
+ - [ ] Logic and correctness checked for each changed function
11
+ - [ ] Error handling reviewed
12
+ - [ ] Test coverage assessed
13
+
14
+ ## Finding Quality
15
+ - [ ] Every finding has: file path + line/function reference
16
+ - [ ] Every finding has: severity level (🔴/🟡/🟢)
17
+ - [ ] Every finding has: suggested fix or improvement
18
+ - [ ] No vague findings ("this code is bad" — must specify why and what to do)
19
+
20
+ ## Output
21
+ - [ ] Findings written to `{review_output}/general-review-{date}.md`
22
+ - [ ] PR context updated with `general-review` in completed list
23
+ - [ ] At least one positive observation included (balanced review)
@@ -0,0 +1,68 @@
1
+ <workflow>
2
+ <critical>Workflow engine rules: {project-root}/_prr/core/tasks/workflow.xml</critical>
3
+ <critical>Communicate all responses in {communication_language}</critical>
4
+ <critical>Load PR context from {pr_context} before starting review</critical>
5
+ <critical>Every finding MUST include: file path + line/function reference + severity + suggested fix</critical>
6
+
7
+ <step n="1" goal="Load PR context and diff">
8
+ <check if="{pr_context} does not exist">
9
+ <output>❌ No PR selected. Please run [SP] Select PR first.</output>
10
+ <stop/>
11
+ </check>
12
+
13
+ <action>Read {pr_context} to get: target_branch, base_branch, diff_strategy, files_changed</action>
14
+ <action>Run: git diff {base_branch}...{target_branch} in {target_repo}</action>
15
+ <action>Note diff_strategy: if 'chunked', process file by file</action>
16
+
17
+ <output>🔍 Starting General Code Review
18
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
19
+ PR: {target_branch} → {base_branch}
20
+ Strategy: {diff_strategy}
21
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
22
+ </step>
23
+
24
+ <step n="2" goal="Review code logic and correctness">
25
+ <action>For each changed file (or chunk if diff_strategy=chunked):</action>
26
+ <check-list id="logic">
27
+ <item>Logical errors: conditions, edge cases, off-by-one errors</item>
28
+ <item>Null/undefined handling: are all possible null states handled?</item>
29
+ <item>Error handling: are errors caught and handled appropriately?</item>
30
+ <item>Return values: are return paths complete and correct?</item>
31
+ <item>Data validation: is user input properly validated?</item>
32
+ </check-list>
33
+ <output-format>
34
+ For each finding:
35
+ 🔴/🟡/🟢 [SEVERITY] `file.js:lineN` — **Description**
36
+ → Suggested fix: `code example`
37
+ </output-format>
38
+ </step>
39
+
40
+ <step n="3" goal="Review code quality and maintainability">
41
+ <check-list id="quality">
42
+ <item>Naming: are variable/function/class names clear and meaningful?</item>
43
+ <item>Function size: are functions doing one thing? (>30 lines is a yellow flag)</item>
44
+ <item>DRY violations: is logic duplicated that should be extracted?</item>
45
+ <item>Magic numbers/strings: should be named constants</item>
46
+ <item>Comments: missing where logic is complex; unnecessary where code is clear</item>
47
+ <item>Dead code: unreachable code, unused variables, TODO comments left</item>
48
+ </check-list>
49
+ </step>
50
+
51
+ <step n="4" goal="Review test coverage">
52
+ <check-list id="tests">
53
+ <item>New logic: is it covered by unit tests?</item>
54
+ <item>Edge cases: are boundary conditions tested?</item>
55
+ <item>Error paths: are error/exception paths tested?</item>
56
+ <item>Test quality: do tests actually test behavior, not just coverage?</item>
57
+ </check-list>
58
+ </step>
59
+
60
+ <step n="5" goal="Compile and write findings">
61
+ <action>Group all findings by severity: 🔴 Blockers first, then 🟡 Warnings, then 🟢 Suggestions</action>
62
+ <action>Add positive observations: acknowledge good practices found</action>
63
+ <action>Write findings to {output_file} using the standard review report format</action>
64
+ <action>Update {pr_context}: add 'general-review' to completed reviews list</action>
65
+ <output>✅ General review complete. {blocker_count} blockers, {warning_count} warnings, {suggestion_count} suggestions.
66
+ Run [RR] Generate Report to compile all findings, or continue with another review type.</output>
67
+ </step>
68
+ </workflow>
@@ -0,0 +1,18 @@
1
+ name: general-review
2
+ description: "General code quality review: logic, naming, readability, error handling, DRY, test coverage"
3
+ author: "PR Review Framework"
4
+
5
+ config_source: "{project-root}/_prr/prr/config.yaml"
6
+ user_name: "{config_source}:user_name"
7
+ communication_language: "{config_source}:communication_language"
8
+ target_repo: "{config_source}:target_repo"
9
+ review_output: "{config_source}:review_output"
10
+ date: system-generated
11
+
12
+ installed_path: "{project-root}/_prr/prr/workflows/3-review/general-review"
13
+ instructions: "{installed_path}/instructions.xml"
14
+ validation: "{installed_path}/checklist.md"
15
+
16
+ pr_context: "{review_output}/current-pr-context.yaml"
17
+ project_context: "{review_output}/project-context.yaml"
18
+ output_file: "{review_output}/general-review-{date}.md"
@@ -0,0 +1,22 @@
1
+ ---
2
+ title: "Performance Review Completion Checklist"
3
+ validation-target: "Performance review output file"
4
+ ---
5
+
6
+ # Performance Review Checklist
7
+
8
+ ## Coverage
9
+ - [ ] Database/query patterns checked (N+1, missing pagination, SELECT *)
10
+ - [ ] Async/await patterns reviewed
11
+ - [ ] Memory management reviewed
12
+ - [ ] Frontend performance checked (if frontend code changed)
13
+
14
+ ## Finding Quality
15
+ - [ ] Every finding has: file path + line/function reference
16
+ - [ ] Every finding has: estimated impact (high/medium/low) with brief rationale
17
+ - [ ] Micro-optimizations are NOT flagged (only impactful issues)
18
+ - [ ] Each finding includes suggested fix
19
+
20
+ ## Output
21
+ - [ ] Findings written to `{review_output}/performance-review-{date}.md`
22
+ - [ ] PR context updated with `performance-review` in completed list
@@ -0,0 +1,68 @@
1
+ <workflow>
2
+ <critical>Workflow engine rules: {project-root}/_prr/core/tasks/workflow.xml</critical>
3
+ <critical>Communicate all responses in {communication_language}</critical>
4
+ <critical>Focus on IMPACTFUL performance issues — skip micro-optimizations that add complexity without measurable benefit</critical>
5
+ <critical>Quantify impact when possible: "this adds ~Xms per request" or "X MB memory per session"</critical>
6
+
7
+ <step n="1" goal="Load PR context and diff">
8
+ <check if="{pr_context} does not exist">
9
+ <output>❌ No PR selected. Please run [SP] Select PR first.</output>
10
+ <stop/>
11
+ </check>
12
+ <action>Read {pr_context} and load git diff</action>
13
+ <output>⚡ Starting Performance Review
14
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
15
+ Focus: N+1 queries | Memory | Async | Bundle size | Caching
16
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
17
+ </step>
18
+
19
+ <step n="2" goal="Database and query performance">
20
+ <check-list id="database">
21
+ <item>N+1 queries: DB call inside a loop? Should use batch/join instead</item>
22
+ <item>Missing pagination: queries that could return unbounded result sets</item>
23
+ <item>SELECT *: fetching all columns when only a few are needed</item>
24
+ <item>Missing index: filtering/sorting on non-indexed columns</item>
25
+ <item>Unnecessary queries: data already available in context/cache but re-fetched</item>
26
+ <item>Transaction missing: multiple DB writes without transaction (data integrity risk)</item>
27
+ </check-list>
28
+ </step>
29
+
30
+ <step n="3" goal="Async and concurrency patterns">
31
+ <check-list id="async">
32
+ <item>Sequential awaits in loop: `for (x of arr) { await fn(x) }` should be Promise.all</item>
33
+ <item>Unnecessary await: async function that doesn't need to be async</item>
34
+ <item>Missing error handling on async operations</item>
35
+ <item>Blocking operations on main thread/event loop</item>
36
+ <item>Race conditions: shared state mutated from multiple async paths</item>
37
+ </check-list>
38
+ </step>
39
+
40
+ <step n="4" goal="Memory management">
41
+ <check-list id="memory">
42
+ <item>Event listener cleanup: listeners added but not removed (memory leak pattern)</item>
43
+ <item>Large objects held in closure/module scope unnecessarily</item>
44
+ <item>Accumulating arrays/objects without cleanup</item>
45
+ <item>setInterval/setTimeout without clearInterval/clearTimeout</item>
46
+ <item>Frontend: components not cleaning up on unmount</item>
47
+ </check-list>
48
+ </step>
49
+
50
+ <step n="5" goal="Frontend performance (if applicable)">
51
+ <check-list id="frontend">
52
+ <item>Bundle size: large new dependencies imported? Is tree-shaking possible?</item>
53
+ <item>Unnecessary re-renders: state changes causing full component re-renders</item>
54
+ <item>Images/assets: unoptimized media, missing lazy loading</item>
55
+ <item>Blocking scripts or render-blocking resources</item>
56
+ <item>Expensive computations in render path (should be memoized)</item>
57
+ </check-list>
58
+ </step>
59
+
60
+ <step n="6" goal="Compile and write findings">
61
+ <action>For each finding: estimate impact (high/medium/low) with brief rationale</action>
62
+ <action>Distinguish: impactful issues vs micro-optimizations (flag only impactful)</action>
63
+ <action>Write findings to {output_file}</action>
64
+ <action>Update {pr_context}: add 'performance-review' to completed list</action>
65
+ <output>⚡ Performance review complete.
66
+ Run [RR] Generate Report to compile all findings.</output>
67
+ </step>
68
+ </workflow>
@@ -0,0 +1,18 @@
1
+ name: performance-review
2
+ description: "Performance-focused code review: N+1 queries, memory leaks, async patterns, bundle size, caching"
3
+ author: "PR Review Framework"
4
+
5
+ config_source: "{project-root}/_prr/prr/config.yaml"
6
+ user_name: "{config_source}:user_name"
7
+ communication_language: "{config_source}:communication_language"
8
+ target_repo: "{config_source}:target_repo"
9
+ review_output: "{config_source}:review_output"
10
+ date: system-generated
11
+
12
+ installed_path: "{project-root}/_prr/prr/workflows/3-review/performance-review"
13
+ instructions: "{installed_path}/instructions.xml"
14
+ validation: "{installed_path}/checklist.md"
15
+
16
+ pr_context: "{review_output}/current-pr-context.yaml"
17
+ project_context: "{review_output}/project-context.yaml"
18
+ output_file: "{review_output}/performance-review-{date}.md"
@@ -0,0 +1,25 @@
1
+ ---
2
+ title: "Security Review Completion Checklist"
3
+ validation-target: "Security review output file"
4
+ ---
5
+
6
+ # Security Review Checklist
7
+
8
+ ## Coverage
9
+ - [ ] Secrets scan completed (hardcoded API keys, passwords, tokens)
10
+ - [ ] OWASP A01-A05 checked
11
+ - [ ] OWASP A06-A10 checked
12
+ - [ ] Auth/authorization logic reviewed (if applicable)
13
+ - [ ] Input validation reviewed (if applicable)
14
+ - [ ] New dependencies checked for known vulnerabilities
15
+
16
+ ## Finding Quality
17
+ - [ ] Every finding states: WHAT the vulnerability is
18
+ - [ ] Every finding states: WHERE (file + line number)
19
+ - [ ] Every finding states: IMPACT (what could an attacker do)
20
+ - [ ] Every finding states: HOW TO FIX
21
+ - [ ] Severity: Critical/High/Medium/Low/Info (not just emojis)
22
+
23
+ ## Output
24
+ - [ ] Findings written to `{review_output}/security-review-{date}.md`
25
+ - [ ] PR context updated with `security-review` in completed list
@@ -0,0 +1,19 @@
1
+ id,category,check,severity,description
2
+ A01-1,Broken Access Control,Missing authorization check,Critical,"Function/endpoint accessible without role check"
3
+ A01-2,Broken Access Control,Privilege escalation,Critical,"User can access resources belonging to other users"
4
+ A01-3,Broken Access Control,Insecure direct object reference,High,"ID exposed in URL/body without ownership check"
5
+ A02-1,Cryptographic Failures,Hardcoded secret,Critical,"API key password or token in source code"
6
+ A02-2,Cryptographic Failures,Weak hashing algorithm,High,"MD5 or SHA1 used for passwords"
7
+ A02-3,Cryptographic Failures,Sensitive data over HTTP,High,"PII or auth tokens sent without TLS"
8
+ A03-1,Injection,SQL injection,Critical,"User input concatenated into SQL query"
9
+ A03-2,Injection,XSS vulnerability,High,"User input rendered without sanitization"
10
+ A03-3,Injection,Command injection,Critical,"User input passed to shell/exec function"
11
+ A03-4,Injection,Path traversal,High,"User-controlled file path without normalization"
12
+ A05-1,Security Misconfiguration,Debug mode in production,High,"Debug endpoints or verbose errors exposed"
13
+ A05-2,Security Misconfiguration,CORS wildcard,Medium,"Access-Control-Allow-Origin: * on sensitive endpoint"
14
+ A07-1,Auth Failures,No rate limiting on auth,High,"Login/register endpoint without rate limiting"
15
+ A07-2,Auth Failures,Weak session management,High,"Session token predictable or not rotated on login"
16
+ A07-3,Auth Failures,JWT not validated,Critical,"JWT signature not verified or expiry not checked"
17
+ A09-1,Logging Failures,Sensitive data in logs,Medium,"Password API key or PII logged to console"
18
+ A09-2,Logging Failures,Stack trace to user,Medium,"Full error stack trace returned in API response"
19
+ A10-1,SSRF,User-controlled URL fetch,High,"User input used in HTTP request without allowlist"
@@ -0,0 +1,70 @@
1
+ <workflow>
2
+ <critical>Workflow engine rules: {project-root}/_prr/core/tasks/workflow.xml</critical>
3
+ <critical>Communicate all responses in {communication_language}</critical>
4
+ <critical>For EVERY security finding: state WHAT, WHERE (file+line), HOW it could be exploited, and HOW to fix it</critical>
5
+ <critical>Think like an attacker — what could an adversary do with this vulnerability?</critical>
6
+
7
+ <step n="1" goal="Load PR context and prepare security analysis">
8
+ <check if="{pr_context} does not exist">
9
+ <output>❌ No PR selected. Please run [SP] Select PR first.</output>
10
+ <stop/>
11
+ </check>
12
+ <action>Read {pr_context}</action>
13
+ <action>Run: git diff {base_branch}...{target_branch} in {target_repo}</action>
14
+ <output>🔒 Starting Security Review — Thinking like an attacker
15
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
+ OWASP Top 10 scan + secrets detection + auth review
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
18
+ </step>
19
+
20
+ <step n="2" goal="Scan for hardcoded secrets and sensitive data exposure">
21
+ <critical>This is the MOST CRITICAL check — do this FIRST</critical>
22
+ <check-list id="secrets">
23
+ <item>API keys, tokens, passwords hardcoded in source code</item>
24
+ <item>Private keys, certificates embedded in code</item>
25
+ <item>Database connection strings with credentials</item>
26
+ <item>Secrets in config files that should be in environment variables</item>
27
+ <item>Sensitive data logged to console (passwords, tokens, PII)</item>
28
+ <item>Stack traces exposed to end users (reveals internal structure)</item>
29
+ </check-list>
30
+ </step>
31
+
32
+ <step n="3" goal="OWASP A01-A05: Broken Access Control, Crypto, Injection, Insecure Design, Misconfiguration">
33
+ <check-list id="owasp-1-5">
34
+ <item>A01 Broken Access Control: authorization checks present? role-based? privilege escalation possible?</item>
35
+ <item>A02 Cryptographic Failures: weak hashing (MD5/SHA1)? HTTP instead of HTTPS? key management?</item>
36
+ <item>A03 Injection: SQL injection? XSS? command injection? template injection? all inputs sanitized?</item>
37
+ <item>A04 Insecure Design: security by obscurity? missing security controls at design level?</item>
38
+ <item>A05 Security Misconfiguration: debug mode enabled? default credentials? unnecessary features exposed?</item>
39
+ </check-list>
40
+ </step>
41
+
42
+ <step n="4" goal="OWASP A06-A10: Vulnerable Components, Auth, Integrity, Logging, SSRF">
43
+ <check-list id="owasp-6-10">
44
+ <item>A06 Vulnerable Components: new dependencies added? check for known CVEs</item>
45
+ <item>A07 Auth Failures: session management? password policies? brute force protection? JWT validation?</item>
46
+ <item>A08 Integrity Failures: deserialization of untrusted data? unsigned data accepted?</item>
47
+ <item>A09 Logging/Monitoring: security events logged? sensitive data excluded from logs?</item>
48
+ <item>A10 SSRF: user-controlled URLs fetched? internal services accessible?</item>
49
+ </check-list>
50
+ </step>
51
+
52
+ <step n="5" goal="Rate limiting and input validation">
53
+ <check-list id="input-rate">
54
+ <item>Rate limiting on auth endpoints (login, register, password reset)</item>
55
+ <item>Input length limits enforced server-side</item>
56
+ <item>File upload: type validation, size limits, storage location security</item>
57
+ <item>CORS configuration: not wildcard (*) on sensitive endpoints</item>
58
+ </check-list>
59
+ </step>
60
+
61
+ <step n="6" goal="Compile and write security findings">
62
+ <action>Group findings by severity: Critical → High → Medium → Low → Info</action>
63
+ <action>For each finding include: WHAT, WHERE (file+line), IMPACT (how exploitable), HOW TO FIX</action>
64
+ <action>Write to {output_file}</action>
65
+ <action>Update {pr_context}: add 'security-review' to completed list</action>
66
+ <output>🔒 Security review complete.
67
+ {critical_count} critical, {high_count} high, {medium_count} medium findings.
68
+ Run [RR] Generate Report to compile all findings.</output>
69
+ </step>
70
+ </workflow>
@@ -0,0 +1,19 @@
1
+ name: security-review
2
+ description: "Security-focused code review: OWASP top 10, injection, auth, secrets, dependencies"
3
+ author: "PR Review Framework"
4
+
5
+ config_source: "{project-root}/_prr/prr/config.yaml"
6
+ user_name: "{config_source}:user_name"
7
+ communication_language: "{config_source}:communication_language"
8
+ target_repo: "{config_source}:target_repo"
9
+ review_output: "{config_source}:review_output"
10
+ date: system-generated
11
+
12
+ installed_path: "{project-root}/_prr/prr/workflows/3-review/security-review"
13
+ instructions: "{installed_path}/instructions.xml"
14
+ validation: "{installed_path}/checklist.md"
15
+ owasp_data: "{installed_path}/data/owasp-checklist.csv"
16
+
17
+ pr_context: "{review_output}/current-pr-context.yaml"
18
+ project_context: "{review_output}/project-context.yaml"
19
+ output_file: "{review_output}/security-review-{date}.md"
@@ -0,0 +1,18 @@
1
+ ---
2
+ title: "Improve Code Completion Checklist"
3
+ validation-target: "Improve code output file"
4
+ ---
5
+
6
+ # Improve Code Checklist
7
+
8
+ ## Suggestion Quality
9
+ - [ ] Every suggestion has: BEFORE code block
10
+ - [ ] Every suggestion has: AFTER code block
11
+ - [ ] Every suggestion has: explanation of WHY it's better
12
+ - [ ] Suggestions are impactful — not style nitpicks
13
+ - [ ] Suggestions are correct — the AFTER code actually works
14
+
15
+ ## Output
16
+ - [ ] All suggestions written to `{review_output}/improve-code-{date}.md`
17
+ - [ ] Suggestions grouped by category (Bugs | Quality | Performance | Best Practices)
18
+ - [ ] PR context updated with `improve-code` in completed list
@@ -0,0 +1,59 @@
1
+ <workflow>
2
+ <critical>Workflow engine rules: {project-root}/_prr/core/tasks/workflow.xml</critical>
3
+ <critical>Communicate all responses in {communication_language}</critical>
4
+ <critical>Every suggestion MUST include: BEFORE code and AFTER code — not just description</critical>
5
+ <critical>Focus on impactful improvements — not style nitpicks. Each suggestion must save real time or prevent real bugs</critical>
6
+
7
+ <step n="1" goal="Load PR context and diff">
8
+ <check if="{pr_context} does not exist">
9
+ <output>❌ No PR selected. Please run [SP] Select PR first.</output>
10
+ <stop/>
11
+ </check>
12
+ <action>Read {pr_context} and load full git diff</action>
13
+ <action>If diff_strategy is 'chunked': process one file at a time</action>
14
+ <output>💡 Generating Code Improvement Suggestions
15
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
16
+ Each suggestion includes BEFORE and AFTER code
17
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━</output>
18
+ </step>
19
+
20
+ <step n="2" goal="Generate concrete improvement suggestions">
21
+ <action>For each changed file or chunk, identify improvements in these categories:</action>
22
+ <categories>
23
+ <category name="bugs">Logic errors that could cause incorrect behavior or exceptions</category>
24
+ <category name="quality">Simplifications that make code more readable or maintainable</category>
25
+ <category name="performance">Changes that reduce time/space complexity</category>
26
+ <category name="best-practices">Patterns that align with language/framework best practices</category>
27
+ </categories>
28
+
29
+ <output-format>
30
+ Each suggestion must follow this format:
31
+
32
+ **[CATEGORY] `file.js:lineN`** — One-line description
33
+
34
+ ```
35
+ // BEFORE
36
+ {current_code}
37
+ ```
38
+
39
+ ```
40
+ // AFTER
41
+ {improved_code}
42
+ ```
43
+
44
+ > Why: {brief explanation of the improvement and its benefit}
45
+ </output-format>
46
+
47
+ <note>For large diffs: process file by file, generate 3-5 highest-impact suggestions per file</note>
48
+ </step>
49
+
50
+ <step n="3" goal="Compile and write suggestions">
51
+ <action>Group suggestions by category: Bugs | Quality | Performance | Best Practices</action>
52
+ <action>Sort within each category by impact (most impactful first)</action>
53
+ <action>Write all suggestions to {output_file}</action>
54
+ <action>Update {pr_context}: add 'improve-code' to completed list</action>
55
+ <output>💡 Code improvement suggestions generated.
56
+ {total_count} suggestions: {bug_count} bugs, {quality_count} quality, {perf_count} performance, {bp_count} best practices.
57
+ Run [RR] Generate Report or [PC] Post Comments to share these with the PR author.</output>
58
+ </step>
59
+ </workflow>
@@ -0,0 +1,18 @@
1
+ name: improve-code
2
+ description: "Generate concrete inline code suggestions with before/after diffs — focused on actionable improvements"
3
+ author: "PR Review Framework"
4
+
5
+ config_source: "{project-root}/_prr/prr/config.yaml"
6
+ user_name: "{config_source}:user_name"
7
+ communication_language: "{config_source}:communication_language"
8
+ target_repo: "{config_source}:target_repo"
9
+ review_output: "{config_source}:review_output"
10
+ date: system-generated
11
+
12
+ installed_path: "{project-root}/_prr/prr/workflows/4-improve/improve-code"
13
+ instructions: "{installed_path}/instructions.xml"
14
+ validation: "{installed_path}/checklist.md"
15
+
16
+ pr_context: "{review_output}/current-pr-context.yaml"
17
+ project_context: "{review_output}/project-context.yaml"
18
+ output_file: "{review_output}/improve-code-{date}.md"
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: "step-01-load-context"
3
+ description: "Load PR context and ask for the user's question"
4
+ nextStepFile: "./step-02-answer.md"
5
+ ---
6
+
7
+ # Step 1: Load Context and Get Question
8
+
9
+ ## Sequence of Instructions
10
+
11
+ ### 1. Load PR Context
12
+
13
+ Read `{review_output}/current-pr-context.yaml`.
14
+
15
+ If not found, prompt user to run [SP] Select PR first.
16
+
17
+ ### 2. Load the Diff
18
+
19
+ Run `git diff {base_branch}...{target_branch}` in `{target_repo}`.
20
+
21
+ ### 3. Ask the User's Question
22
+
23
+ ```
24
+ 🤔 What would you like to ask about the code changes in this PR?
25
+
26
+ You can ask about:
27
+ • Specific files or functions (e.g., "explain authController.js:handleLogin")
28
+ • Design decisions (e.g., "why was X approach used?")
29
+ • Potential issues (e.g., "what could go wrong with this change?")
30
+ • Interactions (e.g., "how does this affect the existing session handling?")
31
+ ```
32
+
33
+ **HALT — wait for user's question before proceeding.**
34
+
35
+ ### 4. Load Next Step
36
+
37
+ Add `step-01-load-context` to `stepsCompleted`. Load: `{nextStepFile}`
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: "step-02-answer"
3
+ description: "Answer the user's question about the code changes"
4
+ ---
5
+
6
+ # Step 2: Answer the Question
7
+
8
+ ## Sequence of Instructions
9
+
10
+ ### 1. Analyze the Question in Context
11
+
12
+ Using the full diff and PR context:
13
+ - Locate the relevant code sections
14
+ - Understand the full context around the specific area being asked about
15
+ - Consider how it interacts with the rest of the codebase
16
+
17
+ ### 2. Provide a Focused Answer
18
+
19
+ Structure the answer as:
20
+ 1. **Direct answer** to the question (1-3 sentences)
21
+ 2. **Supporting evidence** from the code (cite specific lines)
22
+ 3. **Additional context** if relevant (related code, implications)
23
+ 4. **Follow-up considerations** if the answer reveals potential issues
24
+
25
+ ### 3. Offer to Continue
26
+
27
+ After answering:
28
+
29
+ ```
30
+ 💬 Does this answer your question?
31
+ Feel free to ask another question about the code, or return to the menu for review commands.
32
+ ```
33
+
34
+ **HALT — this workflow supports multiple questions in the same session.**
35
+ If the user asks another question, loop back to answering it without reloading context.
36
+ If the user returns to the menu, workflow is complete.
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: ask-code
3
+ description: "Interactive Q&A about specific code changes in the selected PR"
4
+ main_config: "{project-root}/_prr/prr/config.yaml"
5
+ nextStep: "./steps/step-01-load-context.md"
6
+ ---
7
+
8
+ # Ask Code Workflow
9
+
10
+ **Goal:** Allow the reviewer to ask specific questions about the code changes in the PR. Unlike other review workflows that scan the entire diff, this focuses on a specific question or code area.
11
+
12
+ Use cases:
13
+ - "What does this function do?"
14
+ - "Why was this pattern used instead of X?"
15
+ - "What are the potential issues with this approach?"
16
+ - "How does this change interact with the existing auth system?"
17
+ - "Is this the right way to handle this edge case?"
18
+
19
+ ## WORKFLOW ARCHITECTURE
20
+
21
+ Interactive 2-step flow:
22
+ 1. Load PR context and diff
23
+ 2. Answer the user's specific question with full context
24
+
25
+ ## INITIALIZATION
26
+
27
+ Load config from `{main_config}`.
28
+
29
+ ## EXECUTION
30
+
31
+ Read fully and follow: `{nextStep}`
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: "step-01-collect"
3
+ description: "Collect findings from all completed review files"
4
+ nextStepFile: "./step-02-organize.md"
5
+ ---
6
+
7
+ # Step 1: Collect All Findings
8
+
9
+ ## Sequence of Instructions
10
+
11
+ ### 1. Load PR Context
12
+
13
+ Read `{review_output}/current-pr-context.yaml` to get list of completed reviews.
14
+
15
+ ### 2. Collect Review Output Files
16
+
17
+ For each completed review in `review.completed` list, read the corresponding output file:
18
+ - `general-review` → `{review_output}/general-review-*.md` (latest)
19
+ - `security-review` → `{review_output}/security-review-*.md` (latest)
20
+ - `performance-review` → `{review_output}/performance-review-*.md` (latest)
21
+ - `architecture-review` → `{review_output}/architecture-review-*.md` (latest)
22
+ - `improve-code` → `{review_output}/improve-code-*.md` (latest)
23
+
24
+ ### 3. Parse All Findings
25
+
26
+ From each file, extract all findings with their:
27
+ - Severity (🔴 Blocker / 🟡 Warning / 🟢 Suggestion / Critical/High/Medium/Low)
28
+ - Category (general/security/performance/architecture/improvement)
29
+ - File + line reference
30
+ - Description
31
+ - Suggested fix
32
+
33
+ ### 4. Count Statistics
34
+
35
+ Count:
36
+ - Total findings by severity
37
+ - Findings by category
38
+ - Files with issues
39
+
40
+ ### 5. Load Next Step
41
+
42
+ Add `step-01-collect` to `stepsCompleted`. Load: `{nextStepFile}`