@in-the-loop-labs/pair-review 3.0.6 → 3.1.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 (79) hide show
  1. package/package.json +2 -1
  2. package/plugin/.claude-plugin/plugin.json +1 -1
  3. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  4. package/plugin-code-critic/skills/analyze/references/level1-balanced.md +8 -0
  5. package/plugin-code-critic/skills/analyze/references/level1-fast.md +7 -0
  6. package/plugin-code-critic/skills/analyze/references/level1-thorough.md +8 -0
  7. package/plugin-code-critic/skills/analyze/references/level2-balanced.md +9 -0
  8. package/plugin-code-critic/skills/analyze/references/level2-fast.md +8 -0
  9. package/plugin-code-critic/skills/analyze/references/level2-thorough.md +9 -0
  10. package/plugin-code-critic/skills/analyze/references/level3-balanced.md +9 -0
  11. package/plugin-code-critic/skills/analyze/references/level3-fast.md +8 -0
  12. package/plugin-code-critic/skills/analyze/references/level3-thorough.md +9 -0
  13. package/plugin-code-critic/skills/analyze/references/orchestration-balanced.md +9 -0
  14. package/plugin-code-critic/skills/analyze/references/orchestration-fast.md +5 -0
  15. package/plugin-code-critic/skills/analyze/references/orchestration-thorough.md +9 -0
  16. package/public/css/analysis-config.css +83 -0
  17. package/public/css/pr.css +191 -4
  18. package/public/index.html +20 -0
  19. package/public/js/components/AIPanel.js +1 -1
  20. package/public/js/components/AdvancedConfigTab.js +83 -8
  21. package/public/js/components/AnalysisConfigModal.js +155 -5
  22. package/public/js/components/ChatPanel.js +22 -5
  23. package/public/js/components/CouncilProgressModal.js +239 -22
  24. package/public/js/components/TimeoutSelect.js +2 -0
  25. package/public/js/components/VoiceCentricConfigTab.js +179 -12
  26. package/public/js/index.js +119 -1
  27. package/public/js/local.js +141 -47
  28. package/public/js/modules/suggestion-manager.js +2 -1
  29. package/public/js/pr.js +71 -12
  30. package/public/js/repo-settings.js +2 -2
  31. package/public/local.html +32 -11
  32. package/public/pr.html +2 -0
  33. package/src/ai/analyzer.js +371 -111
  34. package/src/ai/claude-provider.js +2 -0
  35. package/src/ai/codex-provider.js +1 -1
  36. package/src/ai/copilot-provider.js +2 -0
  37. package/src/ai/executable-provider.js +534 -0
  38. package/src/ai/gemini-provider.js +2 -0
  39. package/src/ai/index.js +9 -1
  40. package/src/ai/pi-provider.js +10 -8
  41. package/src/ai/prompts/baseline/consolidation/balanced.js +54 -2
  42. package/src/ai/prompts/baseline/consolidation/fast.js +31 -1
  43. package/src/ai/prompts/baseline/consolidation/thorough.js +46 -3
  44. package/src/ai/prompts/baseline/level1/balanced.js +12 -0
  45. package/src/ai/prompts/baseline/level1/fast.js +11 -0
  46. package/src/ai/prompts/baseline/level1/thorough.js +12 -0
  47. package/src/ai/prompts/baseline/level2/balanced.js +13 -0
  48. package/src/ai/prompts/baseline/level2/fast.js +12 -0
  49. package/src/ai/prompts/baseline/level2/thorough.js +13 -0
  50. package/src/ai/prompts/baseline/level3/balanced.js +13 -0
  51. package/src/ai/prompts/baseline/level3/fast.js +12 -0
  52. package/src/ai/prompts/baseline/level3/thorough.js +13 -0
  53. package/src/ai/prompts/baseline/orchestration/balanced.js +15 -0
  54. package/src/ai/prompts/baseline/orchestration/fast.js +11 -0
  55. package/src/ai/prompts/baseline/orchestration/thorough.js +15 -0
  56. package/src/ai/prompts/render-for-skill.js +3 -0
  57. package/src/ai/prompts/shared/output-schema.js +8 -0
  58. package/src/ai/provider.js +89 -4
  59. package/src/chat/prompt-builder.js +17 -1
  60. package/src/chat/session-manager.js +32 -28
  61. package/src/config.js +15 -2
  62. package/src/database.js +59 -15
  63. package/src/git/base-branch.js +113 -29
  64. package/src/local-review.js +15 -9
  65. package/src/main.js +3 -2
  66. package/src/routes/analyses.js +34 -8
  67. package/src/routes/chat.js +15 -8
  68. package/src/routes/config.js +3 -120
  69. package/src/routes/councils.js +15 -6
  70. package/src/routes/executable-analysis.js +494 -0
  71. package/src/routes/local.js +152 -15
  72. package/src/routes/mcp.js +9 -4
  73. package/src/routes/pr.js +166 -29
  74. package/src/routes/reviews.js +31 -5
  75. package/src/routes/shared.js +72 -5
  76. package/src/routes/worktrees.js +4 -2
  77. package/src/utils/comment-formatter.js +28 -11
  78. package/src/utils/instructions.js +22 -8
  79. package/src/utils/logger.js +20 -10
@@ -6,24 +6,38 @@
6
6
  */
7
7
 
8
8
  /**
9
- * Merge repository and request instructions with XML-like tags for AI clarity
9
+ * Merge global, repository, and request instructions with XML-like tags for AI clarity.
10
10
  * Server is the single source of truth for how instructions are merged.
11
11
  *
12
- * @param {string|null} repoInstructions - Default instructions from repository settings
13
- * @param {string|null} requestInstructions - Custom instructions from the analysis request
14
- * @returns {string|null} Merged instructions with XML tags, or null if both inputs are empty
12
+ * Precedence (lowest highest): global repo custom/request
13
+ *
14
+ * @param {Object} instructions - Instructions to merge
15
+ * @param {string|null} [instructions.globalInstructions] - Global instructions from ~/.pair-review/global-instructions.md
16
+ * @param {string|null} [instructions.repoInstructions] - Default instructions from repository settings
17
+ * @param {string|null} [instructions.requestInstructions] - Custom instructions from the analysis request
18
+ * @returns {string|null} Merged instructions with XML tags, or null if all inputs are empty
15
19
  */
16
- function mergeInstructions(repoInstructions, requestInstructions) {
17
- if (!repoInstructions && !requestInstructions) {
20
+ function mergeInstructions({ globalInstructions, repoInstructions, requestInstructions } = {}) {
21
+ if (!globalInstructions && !repoInstructions && !requestInstructions) {
18
22
  return null;
19
23
  }
20
24
 
21
25
  const parts = [];
26
+ if (globalInstructions) {
27
+ parts.push(`These are global instructions that apply to all reviews:\n<global_instructions>\n${globalInstructions}\n</global_instructions>`);
28
+ }
22
29
  if (repoInstructions) {
23
- parts.push(`These are default instructions for this repository:\n<repo_instructions>\n${repoInstructions}\n</repo_instructions>`);
30
+ const repoPrecedence = globalInstructions
31
+ ? ' They take precedence over global_instructions in areas where they overlap or conflict:'
32
+ : '';
33
+ parts.push(`These are default instructions for this repository.${repoPrecedence}\n<repo_instructions>\n${repoInstructions}\n</repo_instructions>`);
24
34
  }
25
35
  if (requestInstructions) {
26
- parts.push(`These are custom instructions for this analysis run. The following instructions take precedence over the repo_instructions in areas where they overlap or conflict:\n<custom_instructions>\n${requestInstructions}\n</custom_instructions>`);
36
+ const overrides = [repoInstructions && 'repo_instructions', globalInstructions && 'global_instructions'].filter(Boolean);
37
+ const customPrecedence = overrides.length
38
+ ? ` They take precedence over ${overrides.join(' and ')} in areas where they overlap or conflict:`
39
+ : '';
40
+ parts.push(`These are custom instructions for this analysis run.${customPrecedence}\n<custom_instructions>\n${requestInstructions}\n</custom_instructions>`);
27
41
  }
28
42
  return parts.join('\n\n');
29
43
  }
@@ -129,28 +129,38 @@ class AILogger {
129
129
 
130
130
  /**
131
131
  * Log AI analysis error
132
+ * @param {string} message - Error message
133
+ * @param {Error} [error] - Optional error object to include
132
134
  */
133
- error(message) {
135
+ error(message, error) {
134
136
  if (!this.enabled) return;
135
137
  const timestamp = new Date().toISOString().split('T')[1].split('.')[0];
136
- process.stderr.write(
137
- `${COLORS.cyan}[${timestamp}]${COLORS.reset} ` +
138
+ let output = `${COLORS.cyan}[${timestamp}]${COLORS.reset} ` +
138
139
  `${COLORS.bright}${COLORS.red}[AI ✗]${COLORS.reset} ` +
139
- `${COLORS.red}${message}${COLORS.reset}\n`
140
- );
140
+ `${COLORS.red}${message}${COLORS.reset}`;
141
+ if (error) {
142
+ const errorMsg = error.message || String(error);
143
+ output += ` ${COLORS.red}${errorMsg}${COLORS.reset}`;
144
+ }
145
+ process.stderr.write(output + '\n');
141
146
  }
142
147
 
143
148
  /**
144
149
  * Log AI analysis warning
150
+ * @param {string} message - Warning message
151
+ * @param {Error} [error] - Optional error object to include
145
152
  */
146
- warn(message) {
153
+ warn(message, error) {
147
154
  if (!this.enabled) return;
148
155
  const timestamp = new Date().toISOString().split('T')[1].split('.')[0];
149
- this._stdout.write(
150
- `${COLORS.cyan}[${timestamp}]${COLORS.reset} ` +
156
+ let output = `${COLORS.cyan}[${timestamp}]${COLORS.reset} ` +
151
157
  `${COLORS.bright}${COLORS.yellow}[AI ⚠]${COLORS.reset} ` +
152
- `${COLORS.yellow}${message}${COLORS.reset}\n`
153
- );
158
+ `${COLORS.yellow}${message}${COLORS.reset}`;
159
+ if (error) {
160
+ const errorMsg = error.message || String(error);
161
+ output += ` ${COLORS.yellow}${errorMsg}${COLORS.reset}`;
162
+ }
163
+ this._stdout.write(output + '\n');
154
164
  }
155
165
 
156
166
  /**