@in-the-loop-labs/pair-review 5.3.3 → 5.3.5

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 (50) hide show
  1. package/README.md +8 -2
  2. package/bin/git-diff-lines +2 -1
  3. package/package.json +1 -1
  4. package/plugin/.claude-plugin/plugin.json +1 -1
  5. package/plugin-code-critic/.claude-plugin/plugin.json +1 -1
  6. package/plugin-code-critic/skills/analyze/scripts/git-diff-lines +104 -25
  7. package/plugin-pair-loop/.claude-plugin/plugin.json +1 -1
  8. package/public/css/pr.css +162 -46
  9. package/public/css/styles.css +0 -12
  10. package/public/js/components/AIPanel.js +3 -2
  11. package/public/js/components/AnalysisConfigModal.js +4 -1
  12. package/public/js/components/ChatPanel.js +15 -8
  13. package/public/js/components/PanelGroup.js +115 -21
  14. package/public/js/components/SuggestionNavigator.js +16 -3
  15. package/public/js/local.js +7 -12
  16. package/public/js/modules/diff-renderer.js +13 -0
  17. package/public/js/modules/file-comment-manager.js +19 -10
  18. package/public/js/modules/hunk-parser.js +39 -2
  19. package/public/js/modules/panel-resizer.js +41 -3
  20. package/public/js/modules/pierre-bridge.js +11 -2
  21. package/public/js/modules/suggestion-manager.js +128 -33
  22. package/public/js/pr.js +132 -29
  23. package/public/js/repo-settings.js +35 -19
  24. package/public/js/utils/git-paths.js +140 -0
  25. package/public/js/utils/smart-truncate.js +88 -0
  26. package/public/local.html +6 -0
  27. package/public/pr.html +6 -0
  28. package/src/ai/analyzer.js +15 -13
  29. package/src/ai/antigravity-provider.js +44 -24
  30. package/src/ai/codex-provider.js +67 -64
  31. package/src/ai/cursor-agent-provider.js +4 -4
  32. package/src/ai/muse-provider.js +68 -3
  33. package/src/ai/summary-generator.js +8 -5
  34. package/src/git/diff-flags.js +26 -12
  35. package/src/git/worktree.js +21 -43
  36. package/src/github/client.js +0 -88
  37. package/src/github/impl/graphql/pending-review-comments.js +5 -1
  38. package/src/github/submit-pr-context.js +56 -0
  39. package/src/local-review.js +34 -17
  40. package/src/main.js +80 -106
  41. package/src/routes/executable-analysis.js +14 -15
  42. package/src/routes/local.js +3 -5
  43. package/src/routes/pr.js +18 -105
  44. package/src/setup/pr-setup.js +1 -1
  45. package/src/setup/stack-setup.js +1 -1
  46. package/src/utils/diff-annotator.js +175 -25
  47. package/src/utils/diff-file-content.js +4 -26
  48. package/src/utils/diff-file-list.js +178 -42
  49. package/src/utils/git-paths.js +77 -0
  50. package/src/utils/paths.js +1 -25
@@ -21,40 +21,24 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
21
21
  /**
22
22
  * Codex model definitions with tier mappings
23
23
  *
24
- * Based on OpenAI's GPT-6 launches (Astra in September 2026; Sol and Luna on
25
- * 2026-09-22) and the Models guide (developers.openai.com/api/docs/models).
26
- * Verified against the Codex CLI 0.155.1 model catalog with a ChatGPT sign-in.
27
- * - gpt-5.6-sol: the default (gpt-5.6-sol-high; $4/$20 per MTok). GPT-5.6 Sol
28
- * stays the default, and GPT-5.6 Luna Low the first fast entry, while GPT-6
29
- * access rolls out: GPT-6 Sol/Luna access depends on workspace settings and
30
- * Enterprise admins must enable it, testAvailability() only checks
31
- * `codex --version`, and nothing falls back to GPT-5.6 at runtime. A GPT-6
32
- * default would fail every default analysis for users without access.
33
- * - gpt-6-astra: GPT-6 flagship, the most capable model for complex, demanding
34
- * work ($10/$50 per MTok, same context as Sol). About five times GPT-6 Sol's
35
- * price, so it stays an opt-in thorough choice rather than the default.
36
- * - gpt-6-sol: Frontier model built for complex coding and agentic workflows
37
- * ($2/$10 per MTok; 1.05M API context, capped at 272K in the Codex catalog;
38
- * 128K output; API input above 272K bills at 2x, output at 1.5x). Newer than
39
- * GPT-5.6 Sol at half its price, but opt-in until GPT-6 access is universal.
40
- * - gpt-6-luna: GPT-6's most efficient model for focused, high-volume work
41
- * ($0.10/$0.50 per MTok, same context as Sol). Per OpenAI, GPT-6 Luna (max)
42
- * exceeds GPT-5.6 Sol (medium) at a tenth of its cost. No `ultra` effort.
43
- * Opt-in, like GPT-6 Sol.
44
- * - gpt-5.6-sol / gpt-5.6-terra / gpt-5.6-luna: "legacy" in Codex but still
45
- * available (no retirement date announced)
46
- * - gpt-5.5: older frontier model. OpenAI retires it from Codex on ALL plans
47
- * on 2026-10-14 (the API is unaffected); remove the gpt-5.5-* entries then.
48
- * - Every model is exposed only through explicit reasoning-effort variants.
24
+ * Descriptions follow the Codex CLI model catalog. GPT-5.6 Sol High stays the
25
+ * recommended default during the GPT-6 rollout. GPT-6 Sol/Luna require admin
26
+ * enablement in Enterprise; GPT-6.1 Sol requires it in Enterprise and Edu.
27
+ * Selecting a model locally does not grant access. testAvailability() checks
28
+ * only `codex --version`, and model rejection does not trigger a fallback,
29
+ * so GPT-6 and GPT-6.1 remain explicit choices.
30
+ * Each picker entry specifies a reasoning effort explicitly.
49
31
  *
50
- * Tiers: thorough (Astra, GPT-6 Sol, GPT-5.6 Sol, GPT-5.5), balanced (Terra,
51
- * GPT-5.6 Luna, GPT-6 Luna Max), fast (GPT-5.6 Luna Low, GPT-6 Luna Low). In
52
- * the balanced and fast tiers GPT-6 goes last: the first entry of a tier is an
53
- * automatic pick (provider switch in the UI, extraction, default fallback).
54
- * Entries are ordered thorough → balanced → fast; the first `fast` entry
55
- * serves JSON extraction and hunk summaries (see AIProvider.getFastTierModel).
32
+ * Entries are ordered thorough → balanced → fast. The first balanced entry
33
+ * controls provider-switch selection and resolveDefaultModel's fallback. The
34
+ * first fast entry serves JSON extraction and hunk summaries. Both stay on
35
+ * GPT-5.6 during rollout for access compatibility.
56
36
  * Guided tours use the provider default, not the fast tier.
57
37
  *
38
+ * GPT-5.5 retires from Codex on all plans on 2026-10-14 (API unaffected);
39
+ * remove the gpt-5.5-* entries then.
40
+ * Workspace access: learn.chatgpt.com/docs/enterprise/workspace-model-availability
41
+ *
58
42
  * Reasoning-effort variants (-low / -high / -xhigh / -max) use `cli_model` to pass
59
43
  * the base model ID to `codex exec -m` and add `-c model_reasoning_effort="..."`
60
44
  * via extra_args so Codex picks up the effort level through its config override.
@@ -74,6 +58,28 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
74
58
  */
75
59
  const CODEX_MODELS = [
76
60
  // ── Thorough tier ───────────────────────────────────────────────────────
61
+ {
62
+ id: 'gpt-6.1-sol-high',
63
+ cli_model: 'gpt-6.1-sol',
64
+ extra_args: ['-c', 'model_reasoning_effort="high"'],
65
+ name: 'GPT-6.1 Sol High',
66
+ tier: 'thorough',
67
+ tagline: 'Latest Workhorse',
68
+ description: 'Latest workhorse model for coding and everyday work, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
69
+ badge: 'Newest',
70
+ badgeClass: 'badge-power'
71
+ },
72
+ {
73
+ id: 'gpt-6.1-sol-xhigh',
74
+ cli_model: 'gpt-6.1-sol',
75
+ extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
76
+ name: 'GPT-6.1 Sol XHigh',
77
+ tier: 'thorough',
78
+ tagline: 'Latest Workhorse Depth',
79
+ description: 'Latest workhorse model for coding and everyday work, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6.1 Sol access; Enterprise and Edu administrators must enable it during rollout.',
80
+ badge: 'Extra High',
81
+ badgeClass: 'badge-power'
82
+ },
77
83
  {
78
84
  id: 'gpt-6-astra-high',
79
85
  cli_model: 'gpt-6-astra',
@@ -81,7 +87,7 @@ const CODEX_MODELS = [
81
87
  name: 'GPT-6 Astra High',
82
88
  tier: 'thorough',
83
89
  tagline: 'Most Capable',
84
- description: 'OpenAI\'s GPT-6 flagship with high reasoning effort for the hardest reviews: deep cross-file analysis, subtle regressions, and demanding architectural work. Costs about five times more than GPT-6 Sol.',
90
+ description: 'Frontier intelligence for the most demanding work, with high reasoning effort for deep cross-file analysis and demanding architectural reviews.',
85
91
  badge: 'Most Capable',
86
92
  badgeClass: 'badge-power'
87
93
  },
@@ -92,7 +98,7 @@ const CODEX_MODELS = [
92
98
  name: 'GPT-6 Astra XHigh',
93
99
  tier: 'thorough',
94
100
  tagline: 'Maximum Depth',
95
- description: 'GPT-6 Astra with extra-high reasoning effort for the most difficult reviews: concurrency, security-sensitive changes, and large codebase context. Premium pricing, about five times GPT-6 Sol.',
101
+ description: 'Frontier intelligence for the most demanding work, with extra-high reasoning effort for concurrency, security-sensitive changes, and large codebase context.',
96
102
  badge: 'Extra High',
97
103
  badgeClass: 'badge-power'
98
104
  },
@@ -102,9 +108,9 @@ const CODEX_MODELS = [
102
108
  extra_args: ['-c', 'model_reasoning_effort="high"'],
103
109
  name: 'GPT-6 Sol High',
104
110
  tier: 'thorough',
105
- tagline: 'Newest Frontier',
106
- description: 'GPT-6 frontier model built for complex coding and agentic work, with high reasoning effort for demanding PR reviews and cross-file analysis, at about a fifth of Astra\'s price. Needs GPT-6 access, which is still rolling out (Enterprise admins must enable it).',
107
- badge: 'Newest',
111
+ tagline: 'Previous Gen',
112
+ description: 'Previous generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
113
+ badge: 'Previous Gen',
108
114
  badgeClass: 'badge-power'
109
115
  },
110
116
  {
@@ -113,8 +119,8 @@ const CODEX_MODELS = [
113
119
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
114
120
  name: 'GPT-6 Sol XHigh',
115
121
  tier: 'thorough',
116
- tagline: 'Frontier Depth',
117
- description: 'GPT-6 Sol with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Needs GPT-6 access, which is still rolling out (Enterprise admins must enable it).',
122
+ tagline: 'Previous Gen Depth',
123
+ description: 'Previous generation workhorse model, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
118
124
  badge: 'Extra High',
119
125
  badgeClass: 'badge-power'
120
126
  },
@@ -124,8 +130,8 @@ const CODEX_MODELS = [
124
130
  extra_args: ['-c', 'model_reasoning_effort="high"'],
125
131
  name: 'GPT-5.6 Sol High',
126
132
  tier: 'thorough',
127
- tagline: 'Frontier Review',
128
- description: 'Strong frontier reviewer with high reasoning effort for demanding PR reviews, complex professional work, and cross-file analysis. The default while GPT-6 access rolls out.',
133
+ tagline: 'Older Workhorse',
134
+ description: 'Older generation workhorse model, with high reasoning effort for demanding reviews and cross-file analysis. The default while GPT-6 and GPT-6.1 access rolls out.',
129
135
  badge: 'Recommended',
130
136
  badgeClass: 'badge-recommended',
131
137
  default: true
@@ -136,8 +142,8 @@ const CODEX_MODELS = [
136
142
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
137
143
  name: 'GPT-5.6 Sol XHigh',
138
144
  tier: 'thorough',
139
- tagline: 'Frontier Depth',
140
- description: 'GPT-5.6 Sol with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes.',
145
+ tagline: 'Older Workhorse Depth',
146
+ description: 'Older generation workhorse model, with extra-high reasoning effort for difficult architectural reviews, subtle regressions, and security-sensitive changes.',
141
147
  badge: 'Extra High',
142
148
  badgeClass: 'badge-power'
143
149
  },
@@ -147,9 +153,9 @@ const CODEX_MODELS = [
147
153
  extra_args: ['-c', 'model_reasoning_effort="high"'],
148
154
  name: 'GPT-5.5 High',
149
155
  tier: 'thorough',
150
- tagline: 'Previous Flagship',
151
- description: 'Previous-generation GPT model with high reasoning effort for demanding PR reviews, strong code understanding, and careful cross-file analysis. OpenAI retires GPT-5.5 from Codex on 2026-10-14.',
152
- badge: 'Previous Gen',
156
+ tagline: 'Legacy Coding',
157
+ description: 'Legacy coding model, with high reasoning effort for demanding reviews and careful cross-file analysis. OpenAI retires GPT-5.5 from Codex on 2026-10-14.',
158
+ badge: 'Legacy',
153
159
  badgeClass: 'badge-power'
154
160
  },
155
161
  {
@@ -158,24 +164,22 @@ const CODEX_MODELS = [
158
164
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
159
165
  name: 'GPT-5.5 XHigh',
160
166
  tier: 'thorough',
161
- tagline: 'Frontier Depth',
162
- description: 'GPT-5.5 with extra-high reasoning effort for the hardest reviews: architecture, concurrency, security-sensitive changes, and large codebase context. OpenAI retires GPT-5.5 from Codex on 2026-10-14.',
167
+ tagline: 'Legacy Coding Depth',
168
+ description: 'Legacy coding model, with extra-high reasoning effort for architecture, concurrency, and security-sensitive reviews. OpenAI retires GPT-5.5 from Codex on 2026-10-14.',
163
169
  badge: 'Max Reasoning',
164
170
  badgeClass: 'badge-power'
165
171
  },
166
172
  // ── Balanced tier ───────────────────────────────────────────────────────
167
- // The first balanced entry is what the UI picks when a user switches to Codex
168
- // from a balanced model, and resolveDefaultModel's fallback when the flagged
169
- // default is disabled, so it must run for every account: GPT-6 goes last.
173
+ // Provider switching and default fallback must work without GPT-6 access.
170
174
  {
171
175
  id: 'gpt-5.6-terra-xhigh',
172
176
  cli_model: 'gpt-5.6-terra',
173
177
  extra_args: ['-c', 'model_reasoning_effort="xhigh"'],
174
178
  name: 'GPT-5.6 Terra XHigh',
175
179
  tier: 'balanced',
176
- tagline: 'Intelligence & Value',
177
- description: 'GPT-5.6 balanced model with extra-high reasoning effort, combining strong intelligence and lower cost for careful everyday PR reviews.',
178
- badge: 'Best Balance',
180
+ tagline: 'Older Balanced',
181
+ description: 'Older balanced model for straightforward work, with extra-high reasoning effort for careful everyday reviews.',
182
+ badge: 'Previous Gen',
179
183
  badgeClass: 'badge-balanced'
180
184
  },
181
185
  {
@@ -185,7 +189,7 @@ const CODEX_MODELS = [
185
189
  name: 'GPT-5.6 Luna Max',
186
190
  tier: 'balanced',
187
191
  tagline: 'Previous Gen',
188
- description: 'Previous-generation Luna, GPT-5.6\'s most cost-efficient model, with max reasoning effort for high-volume reviews and broad codebase scans.',
192
+ description: 'Older fast and efficient model, with max reasoning effort for high-volume reviews and broad codebase scans.',
189
193
  badge: 'Previous Gen',
190
194
  badgeClass: 'badge-balanced'
191
195
  },
@@ -195,14 +199,13 @@ const CODEX_MODELS = [
195
199
  extra_args: ['-c', 'model_reasoning_effort="max"'],
196
200
  name: 'GPT-6 Luna Max',
197
201
  tier: 'balanced',
198
- tagline: 'High-Volume Value',
199
- description: 'GPT-6\'s most efficient model at max reasoning effort. Per OpenAI it beats GPT-5.6 Sol (medium) at a tenth of the cost, for high-volume reviews and broad codebase scans. Needs GPT-6 access, which is still rolling out (Enterprise admins must enable it).',
200
- badge: 'Lowest Cost',
202
+ tagline: 'Affordable Depth',
203
+ description: 'Fast and affordable model for easier tasks, with max reasoning effort for high-volume reviews and broad codebase scans. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
204
+ badge: 'Affordable',
201
205
  badgeClass: 'badge-speed'
202
206
  },
203
207
  // ── Fast tier ───────────────────────────────────────────────────────────
204
- // The first fast entry serves JSON extraction and hunk summaries, so it must
205
- // run for every account: keep it on GPT-5.6 until GPT-6 access is universal.
208
+ // JSON extraction and hunk summaries must work without GPT-6 access.
206
209
  {
207
210
  id: 'gpt-5.6-luna-low',
208
211
  cli_model: 'gpt-5.6-luna',
@@ -210,8 +213,8 @@ const CODEX_MODELS = [
210
213
  name: 'GPT-5.6 Luna Low',
211
214
  tier: 'fast',
212
215
  tagline: 'Quick Scan',
213
- description: 'GPT-5.6\'s most cost-efficient model at low reasoning effort for surface scans: obvious bugs, style issues, and lint-level feedback.',
214
- badge: 'Fastest',
216
+ description: 'Older fast and efficient model, with low reasoning effort for surface scans: obvious bugs, style issues, and lint-level feedback.',
217
+ badge: 'Previous Gen',
215
218
  badgeClass: 'badge-speed'
216
219
  },
217
220
  {
@@ -220,9 +223,9 @@ const CODEX_MODELS = [
220
223
  extra_args: ['-c', 'model_reasoning_effort="low"'],
221
224
  name: 'GPT-6 Luna Low',
222
225
  tier: 'fast',
223
- tagline: 'Newest Quick Scan',
224
- description: 'GPT-6\'s most efficient model at low reasoning effort for surface scans: obvious bugs, style issues, and lint-level feedback. Needs GPT-6 access, which is still rolling out (Enterprise admins must enable it).',
225
- badge: 'Newest',
226
+ tagline: 'Quick Scan',
227
+ description: 'Fast and affordable model for easier tasks, with low reasoning effort for surface scans: obvious bugs, style issues, and lint-level feedback. Requires GPT-6 access; Enterprise administrators must enable it during rollout.',
228
+ badge: 'Fast',
226
229
  badgeClass: 'badge-speed'
227
230
  }
228
231
  ];
@@ -32,7 +32,7 @@ const BIN_DIR = path.join(__dirname, '..', '..', 'bin');
32
32
  * Tier structure:
33
33
  * - free (auto): Cursor's default auto-routing model
34
34
  * - fast (composer-2-fast, gpt-5.3-codex-fast, gemini-3-flash): Quick analysis
35
- * - balanced (composer-1.5, sonnet-4.6-thinking, sonnet-4.5-thinking, gemini-3.1-pro): Recommended for most reviews
35
+ * - balanced (composer-1.5 (default), sonnet-4.6-thinking, sonnet-4.5-thinking, gemini-3.1-pro): Recommended for most reviews
36
36
  * - thorough (composer-2, gpt-5.3-codex-high, gpt-5.3-codex-xhigh, opus-4.5-thinking, opus-4.6-thinking): Deep analysis for complex code
37
37
  */
38
38
  const CURSOR_AGENT_MODELS = [
@@ -70,7 +70,8 @@ const CURSOR_AGENT_MODELS = [
70
70
  tagline: 'Previous Composer',
71
71
  description: 'Previous generation Cursor Composer model—positioned between Sonnet and Opus for multi-file edits',
72
72
  badge: 'Previous Gen',
73
- badgeClass: 'badge-balanced'
73
+ badgeClass: 'badge-balanced',
74
+ default: true
74
75
  },
75
76
  {
76
77
  id: 'gpt-5.3-codex-fast',
@@ -97,8 +98,7 @@ const CURSOR_AGENT_MODELS = [
97
98
  tagline: 'Best Balance',
98
99
  description: 'Latest Sonnet with extended thinking—excellent quality-to-cost ratio for thorough reviews',
99
100
  badge: 'Recommended',
100
- badgeClass: 'badge-recommended',
101
- default: true
101
+ badgeClass: 'badge-recommended'
102
102
  },
103
103
  {
104
104
  id: 'sonnet-4.5-thinking',
@@ -152,9 +152,9 @@ function attemptIdOf(record) {
152
152
  /**
153
153
  * Muse model definitions with tier mappings.
154
154
  *
155
- * Muse exposes two real CLI model IDs per generation; everything below is a
156
- * reasoning-effort variant over the current pair, using the same `cli_model` +
157
- * `extra_args` pattern as the Codex provider:
155
+ * Every entry below is a reasoning-effort variant over a real CLI model ID,
156
+ * using the same `cli_model` + `extra_args` pattern as the Codex provider.
157
+ * Muse Spark exposes two real CLI model IDs per generation:
158
158
  * - muse-spark-1.3 — $1.25/$4.25 per MTok ($0.15 cached), ~1M context
159
159
  * - muse-spark-1.3-contributor — $0.10/$0.20 per MTok ($0.002 cached), discounted
160
160
  * because submitted content may be used by Meta for product improvement
@@ -167,6 +167,19 @@ function attemptIdOf(record) {
167
167
  * alias of its 1.3 twin at the same reasoning effort. Saved councils and configs
168
168
  * upgrade in place instead of falling through to muse's own default.
169
169
  *
170
+ * Muse Wonder (released 2026-10-12) is Meta's frontier line, thorough tier only:
171
+ * - muse-wonder-1.0 — $4/$20 per MTok ($0.20 cached), ~1M context; served
172
+ * through the Meta Model API as well as Muse Code
173
+ * - muse-wonder-full-1.0 — the larger variant, sold ONLY inside Muse Code Power
174
+ * Usage ($50/mo) and Maximum Usage ($200/mo) subscriptions, never through the
175
+ * API. Accounts without that plan get "does not exist or you lack access".
176
+ * Meta's model card (max effort): DeepSWE 1.1 79.0 (Full) / 78.8 (Wonder),
177
+ * SWE-Marathon 57.5 / 53.1. Neither becomes the default: Wonder costs ~3x
178
+ * Spark per input token and ~5x per output token, and Full is gated by plan.
179
+ * Muse Code subscriptions default to contributor mode (Meta may train on the
180
+ * content), so every Wonder entry pins `--contributor-mode off` for that run.
181
+ * There is no Wonder contributor model id, so Wonder has no contributor twins.
182
+ *
170
183
  * Do NOT treat the locally cached catalog (~/.local/share/muse/model-catalog/)
171
184
  * as authoritative: it lags the CLI and still listed only 1.2 after 1.3 worked.
172
185
  *
@@ -182,8 +195,60 @@ function attemptIdOf(record) {
182
195
  * followed by its contributor twin, so that getFastTierModel() — which picks the
183
196
  * FIRST `fast` model — selects the non-data-sharing model for auxiliary work
184
197
  * like JSON extraction. Never put a contributor entry ahead of its twin.
198
+ *
199
+ * The first `thorough` entry matters too: switching provider in the analysis
200
+ * config modal or repo settings picks the FIRST model of the current tier
201
+ * (repo settings then saves it as the repo's default_model). It must run on
202
+ * every account, so `muse-wonder-1.0-high` stays first and a plan-gated
203
+ * `-full-` entry must never lead.
185
204
  */
186
205
  const MUSE_MODELS = [
206
+ {
207
+ id: 'muse-wonder-1.0-high',
208
+ aliases: ['muse-wonder-1.0', 'muse-wonder'],
209
+ cli_model: 'muse-wonder-1.0',
210
+ extra_args: ['--reasoning-effort', 'high', '--contributor-mode', 'off'],
211
+ name: 'Muse Wonder High',
212
+ tier: 'thorough',
213
+ tagline: 'Frontier Review',
214
+ description: 'Meta\'s frontier model at high reasoning effort with roughly 1M tokens of context—a big step up from Muse Spark on multi-file and long-horizon changes. Several times the cost of Muse Spark ($4/$20 per MTok).',
215
+ badge: 'Frontier',
216
+ badgeClass: 'badge-power'
217
+ },
218
+ {
219
+ id: 'muse-wonder-1.0-max',
220
+ cli_model: 'muse-wonder-1.0',
221
+ extra_args: ['--reasoning-effort', 'max', '--contributor-mode', 'off'],
222
+ name: 'Muse Wonder Max',
223
+ tier: 'thorough',
224
+ tagline: 'Frontier Reasoning',
225
+ description: 'Meta\'s frontier model at maximum reasoning effort for architecture, concurrency, and security-sensitive reviews. Several times the cost of Muse Spark ($4/$20 per MTok).',
226
+ badge: 'Frontier',
227
+ badgeClass: 'badge-power'
228
+ },
229
+ {
230
+ id: 'muse-wonder-full-1.0-high',
231
+ aliases: ['muse-wonder-full-1.0', 'muse-wonder-full'],
232
+ cli_model: 'muse-wonder-full-1.0',
233
+ extra_args: ['--reasoning-effort', 'high', '--contributor-mode', 'off'],
234
+ name: 'Muse Wonder Full High',
235
+ tier: 'thorough',
236
+ tagline: 'Flagship Review',
237
+ description: 'Meta\'s largest frontier model at high reasoning effort—flagship-quality review with less latency than Max. Requires a Muse Code Power Usage or Maximum Usage subscription; not served through the pay-as-you-go API.',
238
+ badge: 'Subscription',
239
+ badgeClass: 'badge-power'
240
+ },
241
+ {
242
+ id: 'muse-wonder-full-1.0-max',
243
+ cli_model: 'muse-wonder-full-1.0',
244
+ extra_args: ['--reasoning-effort', 'max', '--contributor-mode', 'off'],
245
+ name: 'Muse Wonder Full Max',
246
+ tier: 'thorough',
247
+ tagline: 'Largest Model',
248
+ description: 'Meta\'s largest frontier model at maximum reasoning effort, built for long-running agentic work—the deepest Muse review of large, cross-cutting changes. Requires a Muse Code Power Usage or Maximum Usage subscription; not served through the pay-as-you-go API.',
249
+ badge: 'Most Capable',
250
+ badgeClass: 'badge-power'
251
+ },
187
252
  {
188
253
  id: 'muse-spark-1.3-max',
189
254
  // `-ultra` ids resolve here because ultra is gate-closed and degrades to
@@ -3,6 +3,7 @@
3
3
  const crypto = require('crypto');
4
4
  const path = require('path');
5
5
  const logger = require('../utils/logger');
6
+ const { countPatchStats } = require('../utils/diff-file-list');
6
7
 
7
8
  const defaults = {
8
9
  parseUnifiedDiffHunks: require('../utils/diff-hunks').parseUnifiedDiffHunks,
@@ -24,8 +25,12 @@ const defaults = {
24
25
  };
25
26
 
26
27
  /**
27
- * Count '+' lines in parsed hunks to gate summary generation by added-line volume.
28
- * Hunk-header lines are not '+'-prefixed by `parseUnifiedDiffHunks`, so this is safe.
28
+ * Count added lines in parsed hunks to gate summary generation by added-line volume.
29
+ *
30
+ * Every '+' line in a hunk body is an addition — including an added `++ x`
31
+ * line, which the diff spells `+++ x` — so no `+++` exclusion applies here.
32
+ * Counting goes through `countPatchStats`, which also bounds each hunk by the
33
+ * line counts its `@@` header declares.
29
34
  * @param {Map<string, Array<{header: string, lines: string[]}>>} hunksByFile
30
35
  * @returns {number}
31
36
  */
@@ -33,9 +38,7 @@ function countAddedLines(hunksByFile) {
33
38
  let total = 0;
34
39
  for (const hunks of hunksByFile.values()) {
35
40
  for (const hunk of hunks) {
36
- for (const line of hunk.lines) {
37
- if (line.startsWith('+') && !line.startsWith('+++')) total++;
38
- }
41
+ total += countPatchStats([hunk.header, ...hunk.lines].join('\n')).insertions;
39
42
  }
40
43
  }
41
44
  return total;
@@ -29,21 +29,35 @@ const GIT_DIFF_FLAGS_ARRAY = [
29
29
  ];
30
30
 
31
31
  /**
32
- * Array form for simple-git .diffSummary() calls.
33
- * Use --numstat so simple-git parses machine-readable output with exact file paths.
34
- * The default --stat output is display-oriented and may abbreviate long paths,
35
- * which breaks downstream matching for generated route files and similar cases.
36
- * Omits --src-prefix/--dst-prefix since diffSummary doesn't output file content with prefixes.
32
+ * Git config that makes path-producing commands print names verbatim.
33
+ *
34
+ * With git's default core.quotePath=true, any path with a byte >= 0x80 is
35
+ * C-quoted with octal escapes (`"caf\303\251.js"`) in diff headers,
36
+ * --name-only, --numstat and ls-files output. Pinning it off keeps non-ASCII
37
+ * names readable everywhere. `-c` must precede the subcommand, so exec calls
38
+ * spell commands as `git ${GIT_PATH_CONFIG} diff ...`.
39
+ *
40
+ * Git still quotes paths containing control characters, `"` or `\` in diff
41
+ * headers; src/utils/git-paths.js decodes those. Path LISTS are read with -z,
42
+ * which is never quoted.
37
43
  */
38
- const GIT_DIFF_SUMMARY_FLAGS_ARRAY = [
39
- '--no-color',
40
- '--no-ext-diff',
41
- '--no-relative',
42
- '--numstat'
43
- ];
44
+ const GIT_PATH_CONFIG = '-c core.quotePath=false';
45
+
46
+ /**
47
+ * Array form of GIT_PATH_CONFIG for execFile / spawn argument lists.
48
+ */
49
+ const GIT_PATH_CONFIG_ARRAY = ['-c', 'core.quotePath=false'];
50
+
51
+ /**
52
+ * simple-git constructor options carrying the same config, for every
53
+ * simple-git instance that runs diff: `simpleGit(dir, SIMPLE_GIT_PATH_OPTIONS)`.
54
+ */
55
+ const SIMPLE_GIT_PATH_OPTIONS = Object.freeze({ config: ['core.quotePath=false'] });
44
56
 
45
57
  module.exports = {
46
58
  GIT_DIFF_FLAGS,
47
59
  GIT_DIFF_FLAGS_ARRAY,
48
- GIT_DIFF_SUMMARY_FLAGS_ARRAY
60
+ GIT_PATH_CONFIG,
61
+ GIT_PATH_CONFIG_ARRAY,
62
+ SIMPLE_GIT_PATH_OPTIONS
49
63
  };
@@ -6,8 +6,10 @@ const os = require('os');
6
6
  const { getConfigDir, DEFAULT_CHECKOUT_TIMEOUT_MS } = require('../config');
7
7
  const { WorktreeRepository, generateWorktreeId } = require('../database');
8
8
  const { getGeneratedFilePatterns } = require('./gitattributes');
9
- const { normalizeRepository, resolveRenamedFile, resolveRenamedFileOld } = require('../utils/paths');
10
- const { GIT_DIFF_FLAGS_ARRAY, GIT_DIFF_SUMMARY_FLAGS_ARRAY } = require('./diff-flags');
9
+ const { normalizeRepository } = require('../utils/paths');
10
+ const { buildChangedFileEntries } = require('../utils/diff-file-list');
11
+ const { decodeGitPath } = require('../utils/git-paths');
12
+ const { GIT_DIFF_FLAGS_ARRAY, SIMPLE_GIT_PATH_OPTIONS } = require('./diff-flags');
11
13
  const { rawFetchNoTags, fetchWithPruneRecovery } = require('./fetch-helpers');
12
14
  const { spawn, execSync } = require('child_process');
13
15
 
@@ -39,7 +41,7 @@ class GitWorktreeManager {
39
41
  * @returns {import('simple-git').SimpleGit}
40
42
  */
41
43
  _gitFor(dirPath) {
42
- return simpleGit(dirPath);
44
+ return simpleGit(dirPath, SIMPLE_GIT_PATH_OPTIONS);
43
45
  }
44
46
 
45
47
  /**
@@ -873,48 +875,21 @@ class GitWorktreeManager {
873
875
  }
874
876
 
875
877
  /**
876
- * Get list of changed files in the PR
877
- * @param {string} worktreePath - Path to worktree
878
- * @param {Object} prData - PR data from GitHub API
878
+ * Get list of changed files in the PR, built from its unified diff.
879
+ *
880
+ * The diff is the one source of PR paths: renames come from its explicit
881
+ * `rename from` / `rename to` lines and counts from its hunks, so
882
+ * changed_files spells every file exactly like the diff headers the
883
+ * browser keys on (see buildChangedFileEntries).
884
+ *
885
+ * @param {string} worktreePath - Path to worktree (for .gitattributes)
886
+ * @param {string} diff - Unified diff from generateUnifiedDiff
879
887
  * @returns {Promise<Array>} Array of changed file information
880
888
  */
881
- async getChangedFiles(worktreePath, prData) {
889
+ async getChangedFiles(worktreePath, diff) {
882
890
  try {
883
- const git = this._gitFor(worktreePath);
884
- const baseSha = this.getPRBaseSha(prData);
885
- const headSha = this.getPRHeadSha(prData);
886
-
887
- await this.assertCommitAvailableLocally(git, baseSha, 'Base SHA');
888
- await this.assertCommitAvailableLocally(git, headSha, 'Head SHA');
889
-
890
- // Get file changes with stats using base SHA and head SHA
891
- // This ensures we get the exact files changed in the PR, even if the base branch has moved
892
- const diffSummary = await git.diffSummary([
893
- `${baseSha}...${headSha}`,
894
- ...GIT_DIFF_SUMMARY_FLAGS_ARRAY
895
- ]);
896
-
897
- // Parse .gitattributes to identify generated files
898
891
  const gitattributes = await getGeneratedFilePatterns(worktreePath);
899
-
900
- return diffSummary.files.map(file => {
901
- const resolvedFile = resolveRenamedFile(file.file);
902
- const isRenamed = resolvedFile !== file.file;
903
- const result = {
904
- file: resolvedFile,
905
- insertions: file.insertions,
906
- deletions: file.deletions,
907
- changes: file.changes,
908
- binary: file.binary || false,
909
- generated: gitattributes.isGenerated(resolvedFile)
910
- };
911
- if (isRenamed) {
912
- result.renamed = true;
913
- result.renamedFrom = resolveRenamedFileOld(file.file);
914
- }
915
- return result;
916
- });
917
-
892
+ return buildChangedFileEntries(diff, gitattributes);
918
893
  } catch (error) {
919
894
  console.error('Error getting changed files:', error);
920
895
  throw this.wrapError('Failed to get changed files', error);
@@ -1449,9 +1424,12 @@ class GitWorktreeManager {
1449
1424
  */
1450
1425
  async getSparseCheckoutPatterns(repoPath) {
1451
1426
  try {
1452
- const git = simpleGit(repoPath);
1427
+ // `sparse-checkout list` C-quotes names like a diff header does:
1428
+ // core.quotePath=false keeps non-ASCII verbatim, and decodeGitPath
1429
+ // undoes the quoting git still applies to `"`, `\` and control chars.
1430
+ const git = this._gitFor(repoPath);
1453
1431
  const output = await git.raw(['sparse-checkout', 'list']);
1454
- return output.trim().split('\n').filter(Boolean);
1432
+ return output.split('\n').filter(Boolean).map(decodeGitPath);
1455
1433
  } catch {
1456
1434
  return [];
1457
1435
  }
@@ -986,94 +986,6 @@ class GitHubClient {
986
986
  }
987
987
  }
988
988
 
989
- /**
990
- * Calculate diff position for a given file path and line number
991
- * Position is counted from the first @@ hunk header, where position 1 = first line after @@
992
- * @param {string} diffContent - The unified diff content
993
- * @param {string} filePath - File path to find in diff
994
- * @param {number} lineNumber - Line number in the new file
995
- * @returns {number} Diff position or -1 if not found
996
- */
997
- calculateDiffPosition(diffContent, filePath, lineNumber) {
998
- if (!diffContent || !filePath || lineNumber === undefined) {
999
- console.warn('calculateDiffPosition: Missing required parameters', {
1000
- filePath,
1001
- lineNumber,
1002
- hasDiffContent: !!diffContent
1003
- });
1004
- return -1;
1005
- }
1006
-
1007
- const lines = diffContent.split('\n');
1008
- let inFile = false;
1009
- let currentFile = '';
1010
- let position = 0;
1011
- let newLineNumber = 0;
1012
- let foundHunk = false;
1013
-
1014
- for (let i = 0; i < lines.length; i++) {
1015
- const line = lines[i];
1016
-
1017
- if (line.startsWith('diff --git')) {
1018
- const match = line.match(/diff --git a\/(.+) b\/(.+)/);
1019
- if (match) {
1020
- currentFile = match[2];
1021
- inFile = currentFile === filePath;
1022
- position = 0;
1023
- newLineNumber = 0;
1024
- foundHunk = false;
1025
- }
1026
- continue;
1027
- }
1028
-
1029
- if (!inFile) continue;
1030
-
1031
- if (line.startsWith('@@')) {
1032
- const match = line.match(/@@ -\d+,?\d* \+(\d+),?\d* @@/);
1033
- if (match) {
1034
- newLineNumber = parseInt(match[1]) - 1;
1035
-
1036
- if (!foundHunk) {
1037
- position = 0;
1038
- foundHunk = true;
1039
- } else {
1040
- position++;
1041
- }
1042
- }
1043
- continue;
1044
- }
1045
-
1046
- if (!foundHunk) continue;
1047
-
1048
- const isDiffContentLine = line.startsWith('+') || line.startsWith('-') || line.startsWith(' ') || (line === '' && foundHunk);
1049
-
1050
- if (!isDiffContentLine) continue;
1051
-
1052
- position++;
1053
-
1054
- if (line.startsWith('+')) {
1055
- newLineNumber++;
1056
- if (newLineNumber === lineNumber) {
1057
- return position;
1058
- }
1059
- } else if (line.startsWith(' ') || (line === '' && foundHunk)) {
1060
- newLineNumber++;
1061
- if (newLineNumber === lineNumber) {
1062
- return position;
1063
- }
1064
- }
1065
- }
1066
-
1067
- console.warn('calculateDiffPosition: Position not found', {
1068
- filePath,
1069
- lineNumber,
1070
- inFile,
1071
- foundHunk,
1072
- finalNewLineNumber: newLineNumber
1073
- });
1074
- return -1;
1075
- }
1076
-
1077
989
  /**
1078
990
  * Handle errors specific to review submission
1079
991
  * @param {Error} error - The API error