spequi 0.1.7 → 0.1.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.
Files changed (45) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/README.md +27 -12
  3. package/bin/spequi.mjs +5 -3
  4. package/docs/agent-workflow.md +28 -4
  5. package/package.json +1 -1
  6. package/public/app.css +52 -2
  7. package/public/app.js +133 -64
  8. package/public/diff.css +62 -39
  9. package/public/index.html +230 -189
  10. package/public/requests.js +54 -27
  11. package/public/review.css +21 -4
  12. package/public/review.js +85 -50
  13. package/public/session.js +34 -20
  14. package/public/studio.css +191 -33
  15. package/public/studio.js +1 -1
  16. package/public/workflow.js +92 -6
  17. package/skills/spequi/SKILL.md +29 -10
  18. package/src/analytics.mjs +50 -16
  19. package/src/branches.mjs +52 -0
  20. package/src/commands.mjs +4 -41
  21. package/src/comment-controls.mjs +1 -1
  22. package/src/comment-view.mjs +6 -5
  23. package/src/creation-view.mjs +10 -3
  24. package/src/diff-view.mjs +3 -3
  25. package/src/document-view.mjs +9 -2
  26. package/src/drafts.mjs +19 -4
  27. package/src/feedback.mjs +2 -0
  28. package/src/jobs.mjs +71 -18
  29. package/src/lifecycle.mjs +12 -9
  30. package/src/plan-git.mjs +129 -0
  31. package/src/preview-view.mjs +14 -9
  32. package/src/previews.mjs +4 -1
  33. package/src/project.mjs +3 -2
  34. package/src/requests.mjs +1 -1
  35. package/src/review-images.mjs +51 -0
  36. package/src/review-store.mjs +16 -16
  37. package/src/review-view.mjs +3 -2
  38. package/src/server.mjs +54 -20
  39. package/src/source-preview-view.mjs +4 -4
  40. package/src/spec-context-view.mjs +3 -3
  41. package/src/spec-context.mjs +11 -8
  42. package/src/studio-view.mjs +64 -27
  43. package/src/updates.mjs +82 -0
  44. package/src/verification.mjs +6 -0
  45. package/src/views.mjs +53 -15
package/public/app.js CHANGED
@@ -16,17 +16,18 @@
16
16
  }
17
17
  document.addEventListener('pointerdown', event => closeDropdowns(event.target), true);
18
18
  document.addEventListener('keydown', event => { if (event.key === 'Escape') closeDropdowns(null, true); }, true);
19
- function positionDropdown(panel) {
20
- const trigger = dropdownTriggers(panel)[0];
21
- if (!trigger) return;
22
- const anchor = trigger.getBoundingClientRect(), width = Math.min(Number(panel.dataset.dropdownWidth) || 380, window.innerWidth - 24);
23
- const below = window.innerHeight - anchor.bottom - 20, above = anchor.top - 20;
24
- const opensBelow = below >= Math.min(220, Math.max(below, above));
25
- panel.style.left = `${Math.max(12, Math.min(anchor.right - width, window.innerWidth - width - 12))}px`;
26
- panel.style.top = opensBelow ? `${anchor.bottom + 8}px` : 'auto';
27
- panel.style.bottom = opensBelow ? 'auto' : `${window.innerHeight - anchor.top + 8}px`;
28
- panel.style.maxHeight = `${Math.max(0, Math.min(420, opensBelow ? below : above))}px`;
29
- }
19
+ window.spequiPositionDropdown = (panel, trigger) => {
20
+ if (!panel || !trigger) return;
21
+ const anchor = trigger.getBoundingClientRect(), topbar = trigger.closest('.topbar')?.getBoundingClientRect();
22
+ const gutter = window.innerWidth <= 520 ? 8 : 16;
23
+ const width = Math.min(Number(panel.dataset.dropdownWidth) || panel.getBoundingClientRect().width || 380, window.innerWidth - gutter * 2);
24
+ const top = Math.max(gutter, (topbar?.bottom || anchor.bottom) + 8);
25
+ const right = topbar ? window.innerWidth - gutter : Math.min(anchor.right, window.innerWidth - gutter);
26
+ panel.style.width = `${width}px`; panel.style.left = `${Math.max(gutter, right - width)}px`;
27
+ panel.style.right = 'auto'; panel.style.top = `${top}px`; panel.style.bottom = 'auto';
28
+ panel.style.maxHeight = `${Math.max(0, Math.min(Number(panel.dataset.dropdownMaxHeight) || 640, window.innerHeight - top - gutter))}px`;
29
+ };
30
+ function positionDropdown(panel) { window.spequiPositionDropdown(panel, dropdownTriggers(panel)[0]); }
30
31
  document.addEventListener('beforetoggle', event => {
31
32
  if (!event.target.matches('[data-dropdown-panel]')) return;
32
33
  const open = event.newState === 'open';
@@ -58,6 +59,10 @@
58
59
  }
59
60
  for (const event of ['htmx:afterSettle', 'visibilitychange', 'click', 'keydown']) document.addEventListener(event, () => globalThis.requestAnimationFrame?.(recordUsage));
60
61
  globalThis.requestAnimationFrame?.(recordUsage);
62
+ document.addEventListener('toggle', event => {
63
+ if (!event.target.matches?.('#workspace-settings>details[open]')) return;
64
+ for (const detail of document.querySelectorAll('#workspace-settings>details[open]')) if (detail !== event.target) detail.open = false;
65
+ }, true);
61
66
  const themeToggle = document.getElementById('theme-toggle');
62
67
  function applyTheme(theme) {
63
68
  const dark = theme === 'dark' || theme === 'developer';
@@ -65,34 +70,79 @@
65
70
  const label = dark ? 'Switch to light mode' : 'Switch to dark mode';
66
71
  themeToggle?.setAttribute('aria-label', label);
67
72
  themeToggle?.setAttribute('title', label);
73
+ const visible = themeToggle?.querySelector('[data-theme-label]');
74
+ if (visible) visible.textContent = dark ? 'Light mode' : 'Dark mode';
68
75
  }
69
76
  try { applyTheme(localStorage.getItem('spequi-theme')); } catch { applyTheme('enterprise'); }
70
77
  themeToggle?.addEventListener('click', () => {
71
78
  applyTheme(document.documentElement.dataset.theme === 'dark' ? 'enterprise' : 'dark');
72
79
  try { localStorage.setItem('spequi-theme', document.documentElement.dataset.theme); } catch {}
73
80
  });
81
+ function updateNotificationControls() {
82
+ const supported = 'Notification' in window;
83
+ const permission = supported ? Notification.permission : 'unavailable';
84
+ for (const button of document.querySelectorAll('[data-enable-notifications]')) button.hidden = permission !== 'default';
85
+ for (const toggle of document.querySelectorAll('[data-notification-toggle]')) {
86
+ toggle.dataset.notificationState = permission;
87
+ toggle.setAttribute('aria-label', permission === 'granted' ? 'Desktop notifications enabled' : 'Desktop notification settings');
88
+ toggle.title = permission === 'granted' ? 'Desktop notifications enabled' : 'Get notified when work finishes or your agent needs an answer';
89
+ }
90
+ for (const status of document.querySelectorAll('[data-notification-message]')) {
91
+ status.textContent = { granted: 'Desktop notifications are enabled for this browser.', denied: 'Notifications are blocked. Allow them in your browser’s site settings to enable desktop alerts.', unavailable: 'This browser does not support desktop notifications. In-app updates still work.', default: 'Desktop alerts are optional. In-app updates always stay available.' }[permission];
92
+ }
93
+ }
94
+ document.addEventListener('click', async event => {
95
+ const notificationButton = event.target.closest('[data-enable-notifications]');
96
+ if (notificationButton) {
97
+ notificationButton.disabled = true;
98
+ try {
99
+ const permission = await Notification.requestPermission();
100
+ toast(permission === 'granted' ? 'Desktop notifications enabled for this browser.' : 'Desktop notifications are off. Completion messages will still appear here.');
101
+ } catch { toast('Desktop notifications are unavailable. Completion messages will still appear here.'); }
102
+ finally { notificationButton.disabled = false; updateNotificationControls(); }
103
+ }
104
+ const toggle = event.target.closest('[data-spec-context-toggle]');
105
+ if (toggle) {
106
+ const quotes = [...toggle.closest('.file-diff').querySelectorAll('.spec-context-quote')];
107
+ const open = toggle.getAttribute('aria-expanded') !== 'true';
108
+ for (const quote of quotes) { quote.open = open; specDisclosures.set(quote.id, open); }
109
+ toggle.setAttribute('aria-expanded', String(open)); toggle.textContent = open ? 'Collapse quotes' : 'Expand quotes';
110
+ }
111
+ });
112
+ function syncSpecToggle() {
113
+ for (const toggle of document.querySelectorAll('[data-spec-context-toggle]')) {
114
+ const open = [...toggle.closest('.file-diff').querySelectorAll('.spec-context-quote')].some(quote => quote.open);
115
+ toggle.setAttribute('aria-expanded', String(open)); toggle.textContent = open ? 'Collapse quotes' : 'Expand quotes';
116
+ }
117
+ }
118
+ document.addEventListener('toggle', event => {
119
+ if (!event.target.matches?.('.spec-context-quote')) return;
120
+ specDisclosures.set(event.target.id, event.target.open); syncSpecToggle();
121
+ }, true);
122
+ document.addEventListener('htmx:afterSwap', updateNotificationControls);
123
+ window.addEventListener('focus', updateNotificationControls);
124
+ document.addEventListener('beforetoggle', event => { if (event.target.id === 'workspace-settings' && event.newState === 'open') updateNotificationControls(); }, true);
125
+ updateNotificationControls();
74
126
  let pendingRefresh = false, refreshing = false, followUpRefresh = false, navigationRequests = 0, navigationGeneration = 0, backgroundXHR = null;
75
127
  const drafts = {};
76
128
  const specDisclosures = new Map();
77
129
  const sourceDrafts = new Map(), sourcePending = new Set(), sourceMessages = new Map();
78
130
  const initialDetailsToggle = document.getElementById('toggle-review-details');
79
131
  let reviewDetailsOpen = initialDetailsToggle ? initialDetailsToggle.getAttribute('aria-expanded') === 'true' : undefined, preserveReader = null;
80
- function toast(message, downloadUrl = '') {
132
+ function toast(message, href = '') {
81
133
  const node = document.getElementById('toast'); if (!node) return;
82
134
  node.textContent = message;
83
- if (/^\/api\/reviews\/[a-zA-Z0-9_-]+\/feedback\/[a-zA-Z0-9_-]+$/.test(downloadUrl)) {
84
- const link = document.createElement('a'); link.href = downloadUrl; link.download = 'openspec-review-feedback.md'; link.textContent = 'Download Markdown'; node.append(link);
85
- }
135
+ if (typeof href === 'string' && href.startsWith('/?')) { const link = document.createElement('a'); link.href = href; link.textContent = 'Open result'; node.append(link); }
86
136
  node.classList.add('visible'); clearTimeout(node.hideTimer);
87
- const dismiss = () => { node.hideTimer = setTimeout(() => node.classList.remove('visible'), downloadUrl ? 9000 : 4500); };
137
+ const dismiss = () => { node.hideTimer = setTimeout(() => node.classList.remove('visible'), href ? 9000 : 4500); };
88
138
  node.onpointerenter = node.onfocusin = () => clearTimeout(node.hideTimer);
89
139
  node.onpointerleave = node.onfocusout = dismiss; dismiss();
90
140
  }
91
141
  document.addEventListener('spequi-toast', event => {
92
- const { message, downloadUrl = '', persist = false } = event.detail || {};
142
+ const { message, href = '', persist = false } = event.detail || {};
93
143
  if (typeof message !== 'string' || !message) return;
94
144
  if (persist) try { sessionStorage.setItem('spequi-toast', JSON.stringify({ message, at: Date.now() })); } catch {}
95
- toast(message, downloadUrl);
145
+ toast(message, href);
96
146
  });
97
147
  try {
98
148
  const saved = JSON.parse(sessionStorage.getItem('spequi-toast')); sessionStorage.removeItem('spequi-toast');
@@ -117,56 +167,34 @@
117
167
  if (sourcePending.has(scope)) for (const button of document.querySelectorAll('[data-source-action] button')) button.disabled = true;
118
168
  const message = sourceMessages.get(scope), feedback = document.getElementById('source-preview-feedback');
119
169
  if (message && feedback) { feedback.textContent = message.text; feedback.className = message.error ? 'error-message' : 'success-message'; }
170
+ syncSpecToggle();
120
171
  }
121
172
  function readingViewport() { return document.querySelector('.diff-code-scroll') || document.querySelector('.reader'); }
122
173
  let filesLoading = null;
123
174
  function restoreFilesLoading(error = false) {
124
- const saved = filesLoading;
125
- filesLoading = null;
126
- if (!saved || saved.workspace !== document.getElementById('workspace')) return;
127
- saved.reader.replaceChildren(...saved.content);
128
- saved.reader.removeAttribute('aria-busy');
129
- saved.workspace.classList.toggle('diff-workspace', saved.diff);
130
- saved.workspace.classList.toggle('review-details-open', saved.panelOpen);
131
- for (const [tab, active] of saved.tabs) tab.classList.toggle('active', active);
132
- if (saved.panel) saved.panel.hidden = saved.panelHidden;
133
- if (error) {
134
- const notice = document.createElement('div');
135
- notice.className = 'files-load-error'; notice.setAttribute('role', 'alert');
136
- const message = document.createElement('p'); message.textContent = 'Could not load file changes. Try again.';
137
- const retry = saved.link.cloneNode(true); retry.className = 'button'; retry.textContent = 'Retry';
138
- notice.append(message, retry); saved.reader.prepend(notice);
139
- window.htmx?.process?.(notice);
140
- }
175
+ const saved = filesLoading; filesLoading = null;
176
+ if (!saved) return;
177
+ clearTimeout(saved.timer);
178
+ saved.link.removeAttribute('aria-busy');
179
+ if (saved.label?.isConnected) saved.label.textContent = saved.text;
180
+ if (error) toast('Could not load file changes. Try the Files tab again.');
141
181
  }
142
182
  function showFilesLoading(link, xhr) {
143
183
  restoreFilesLoading();
144
- const workspace = document.getElementById('workspace'), reader = workspace?.querySelector('.reader');
145
- if (!reader) return;
146
- const panel = workspace.querySelector('#review-details');
147
- filesLoading = { workspace, reader, panel, panelHidden: panel?.hidden, link, xhr,
148
- content: [...reader.childNodes], diff: workspace.classList.contains('diff-workspace'), panelOpen: workspace.classList.contains('review-details-open'),
149
- tabs: [...workspace.querySelectorAll('.document-tab')].map(tab => [tab, tab.classList.contains('active')]) };
150
- for (const [tab] of filesLoading.tabs) tab.classList.toggle('active', tab.hasAttribute('data-files-tab'));
151
- const status = document.createElement('div');
152
- status.className = 'files-loading'; status.setAttribute('role', 'status');
153
- status.innerHTML = `<div class="files-loading-heading"><span class="files-loading-spinner" aria-hidden="true"></span><h2>Opening your file review</h2></div>
154
- <p class="files-loading-description"></p>
155
- <div class="files-skeleton" aria-hidden="true"><div class="files-skeleton-toolbar"><span></span><span>Current <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.65"><path d="M5 12h14m-5-5 5 5-5 5"/></svg> Proposed</span></div>
156
- <div class="files-skeleton-code">${['', '', 'removed', 'added', 'added', ''].map(tone => `<div class="files-skeleton-row ${tone}"><span></span><span></span></div>`).join('')}</div></div>
157
- <dl class="files-loading-guide"><div><dt>Compare the code</dt><dd>Browse changed files and review additions and removals.</dd></div><div><dt>Review with context</dt><dd>Read linked spec sections, inspect file impact, and leave comments.</dd></div></dl>
158
- <p class="files-loading-note">You decide when to apply the reviewed changes.</p>`;
159
- const count = Number(workspace.querySelector('.document-tab[data-files-tab] .tab-count')?.textContent);
160
- status.querySelector('.files-loading-description').textContent = count > 0
161
- ? `Loading the saved comparison for ${count} changed ${count === 1 ? 'file' : 'files'}. See how the proposed implementation differs from your current code.`
162
- : 'Compare your current code with a proposed implementation. If no diff is saved yet, you can generate one here.';
163
- reader.replaceChildren(status); reader.setAttribute('aria-busy', 'true');
164
- workspace.classList.add('diff-workspace');
165
- workspace.classList.remove('review-details-open');
166
- if (panel) panel.hidden = true;
184
+ const label = link.querySelector('span'), saved = { link, xhr, label, text: label?.textContent };
185
+ filesLoading = saved;
186
+ saved.timer = setTimeout(() => {
187
+ if (filesLoading !== saved || !link.isConnected) return;
188
+ link.setAttribute('aria-busy', 'true');
189
+ if (label) label.textContent = 'Opening…';
190
+ }, 400);
167
191
  }
168
192
  let applyingRequest = null;
193
+ let refreshTimer;
169
194
  function refresh() {
195
+ clearTimeout(refreshTimer); refreshTimer = setTimeout(refreshWorkspace, 150);
196
+ }
197
+ function refreshWorkspace() {
170
198
  if (sourcePending.size || navigationRequests || applyingRequest) { pendingRefresh = true; return; }
171
199
  if (refreshing) { pendingRefresh = true; followUpRefresh = true; return; }
172
200
  if (!window.htmx) { pendingRefresh = true; return; }
@@ -239,7 +267,7 @@
239
267
  }
240
268
  if (filesLoading?.xhr === event.detail?.xhr) {
241
269
  if (event.detail.failed || event.detail.xhr.status === 0 || event.detail.xhr.status >= 400) restoreFilesLoading(true);
242
- else filesLoading = null;
270
+ else restoreFilesLoading();
243
271
  }
244
272
  if (!event.detail?.xhr?.spequiNavigation) return;
245
273
  navigationRequests = Math.max(0, navigationRequests - 1);
@@ -339,15 +367,17 @@
339
367
  const buttons = [...document.querySelectorAll('[data-source-action] button')].map(button => ({ button, disabled: button.disabled }));
340
368
  for (const { button } of buttons) button.disabled = true;
341
369
  form.setAttribute('aria-busy', 'true');
342
- feedback.className = ''; feedback.textContent = kind === 'analyze' ? 'Analyzing project files locally…' : 'Preparing proposed edits in a temporary copy…';
370
+ feedback.className = ''; feedback.textContent = kind === 'analyze' ? 'Scanning project files…' : 'Preparing proposed edits in a temporary copy…';
343
371
  let navigate = '';
344
372
  try {
345
373
  const payload = { change, ...(kind === 'patch' ? { patch: form.querySelector('[name="patch"]').value } : {}), ...(kind === 'model' ? { analysisId: form.querySelector('[name="analysisId"]').value, files } : {}) };
346
374
  const response = await fetch(form.getAttribute('action'), { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', 'X-CSRF-Token': document.querySelector('meta[name="csrf-token"]').content }, body: JSON.stringify(payload) });
347
- const result = await response.json();
348
- if (!response.ok) throw new Error(result.error || 'The request failed. Retry with the local viewer running.');
375
+ const json = response.headers.get('content-type')?.includes('application/json');
376
+ const result = json ? await response.json() : {};
377
+ if (response.status === 403) throw new Error(result.error || 'Your workspace session expired. Reload the page and retry.');
378
+ if (!response.ok || !json) throw new Error(result.error || 'The viewer returned an unexpected response. Reload the page and retry.');
349
379
  if (result.url) { navigate = result.url; if (kind === 'patch') sourceDrafts.delete(change); }
350
- else { feedback.className = 'success-message'; feedback.textContent = 'Affected-file analysis saved.'; sourceMessages.set(change, { text: feedback.textContent }); pendingRefresh = true; }
380
+ else { feedback.className = 'success-message'; feedback.textContent = `${result.analysis.candidates.length} matching ${result.analysis.candidates.length === 1 ? 'file' : 'files'} found · ${result.analysis.coverage.scanned} scanned.`; sourceMessages.set(change, { text: feedback.textContent }); pendingRefresh = true; }
351
381
  } catch (error) { feedback.className = 'error-message'; feedback.textContent = error.message || 'Could not reach the viewer. Retry when it is running.'; sourceMessages.set(change, { text: feedback.textContent, error: true }); }
352
382
  finally {
353
383
  sourcePending.delete(change); form.removeAttribute('aria-busy');
@@ -404,7 +434,7 @@
404
434
  function loadHTMX() {
405
435
  const script = document.createElement('script');
406
436
  script.src = '/vendor/htmx.js';
407
- script.addEventListener('load', () => { if (pendingRefresh) refresh(); });
437
+ script.addEventListener('load', () => { window.htmx.config.defaultSettleDelay = 0; window.htmx.config.attributesToSettle = []; if (pendingRefresh) refresh(); });
408
438
  script.addEventListener('error', () => toast('HTMX could not load. Reload the viewer to retry.'));
409
439
  document.head.append(script);
410
440
  }
@@ -414,3 +444,42 @@
414
444
  else window.addEventListener('load', loadHTMX, { once: true });
415
445
  connect();
416
446
  })();
447
+
448
+ (() => {
449
+ const panel = document.getElementById('privacy-settings');
450
+ if (!panel) return;
451
+ const form = panel.querySelector('[data-consent-form]');
452
+ const marker = () => {
453
+ const update = panel.dataset.updateAvailable === 'true', pending = panel.dataset.consentPending === 'true';
454
+ const toggle = document.querySelector('[data-privacy-toggle]'), dot = document.querySelector('[data-privacy-dot]');
455
+ if (dot) dot.hidden = !update && !pending;
456
+ const label = update ? 'Settings — Spequi update available' : pending ? 'Settings — choose a usage preference' : 'Settings';
457
+ toggle?.setAttribute('aria-label', label); toggle?.setAttribute('title', label);
458
+ };
459
+ marker();
460
+ if (panel.dataset.consentPending === 'true') { document.getElementById('settings-sharing').open = true; document.getElementById('workspace-settings').showPopover?.(); }
461
+ form.addEventListener('submit', async event => {
462
+ event.preventDefault();
463
+ if (form.hasAttribute('aria-busy')) return;
464
+ const feedback = form.querySelector('[data-consent-feedback]'), button = form.querySelector('[type=submit]');
465
+ form.setAttribute('aria-busy', 'true'); button.disabled = true; feedback.textContent = '';
466
+ try {
467
+ const response = await fetch('/api/privacy', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': document.querySelector('meta[name=csrf-token]').content }, body: JSON.stringify({ choice: new FormData(form).get('choice') }) });
468
+ if (!response.ok) throw new Error('Could not save your preference. Reload the viewer and retry.');
469
+ const saved = await response.json();
470
+ panel.dataset.consentPending = 'false'; marker();
471
+ feedback.textContent = saved.choice === 'off' ? 'Saved. No usage events will be sent.' : 'Saved for this project.';
472
+ document.dispatchEvent(new CustomEvent('spequi-toast', { detail: { message: feedback.textContent } }));
473
+ document.getElementById('workspace-settings').hidePopover?.();
474
+ } catch (error) { feedback.textContent = error.message; }
475
+ finally { form.removeAttribute('aria-busy'); button.disabled = false; }
476
+ });
477
+ void fetch('/api/update-status').then(response => response.ok ? response.json() : null).then(info => {
478
+ if (!info) return;
479
+ panel.dataset.updateAvailable = String(Boolean(info.available));
480
+ const note = document.querySelector('[data-update-note]');
481
+ if (!info.available) { if (note) note.textContent = `Spequi ${info.current}${info.unavailable ? ' · Update check unavailable offline' : ' · Up to date'}`; return; }
482
+ if (note) { note.hidden = false; note.textContent = `Update available: ${info.latest} (running ${info.current}). ${info.development ? 'Update your local checkout; published updates do not replace local source.' : 'Run /spequi update in your coding agent when idle.'}`; }
483
+ marker();
484
+ }).catch(() => {});
485
+ })();
package/public/diff.css CHANGED
@@ -1,6 +1,6 @@
1
1
  /* The review surface uses the enterprise shell and a dedicated code palette. */
2
2
  :root{--diff-added:#e7f5eb;--diff-removed:#fff0ee;--diff-add-gutter:#cef0d7;--diff-remove-gutter:#ffdcd7;--diff-add-word:#a7e5b7;--diff-remove-word:#ffc0b8;--diff-gap:#f4f6fa;--diff-gutter:#f8f9fc;--diff-code:#24292e;--diff-border:#dbe2ec;--diff-code-size:12px}
3
- [data-theme=dark]{--diff-added:#183428;--diff-removed:#382326;--diff-add-gutter:#214b34;--diff-remove-gutter:#542b30;--diff-add-word:#275e3b;--diff-remove-word:#79383d;--diff-gap:#192331;--diff-gutter:#1a2432;--diff-code:#e1e4e8;--diff-border:#344156}
3
+ [data-theme=dark]{--diff-added:#223129;--diff-removed:#35272a;--diff-add-gutter:#2a3c30;--diff-remove-gutter:#493035;--diff-add-word:#345540;--diff-remove-word:#653a40;--diff-gap:#191c20;--diff-gutter:#1a1d21;--diff-code:#e7e5e0;--diff-border:#30343a}
4
4
  .diff-workspace .inspector{display:none}
5
5
  .diff-workspace.review-details-open .inspector{display:flex}
6
6
  @media(min-width:761px){.workspace.diff-workspace{grid-template-columns:var(--rail-width) minmax(0,1fr)}.workspace.diff-workspace.review-details-open{grid-template-columns:var(--rail-width) minmax(0,1fr) var(--panel-width)}}
@@ -32,6 +32,7 @@
32
32
  .file-line-count{font-size:9px;gap:3px}
33
33
  .file-diff{min-width:0;max-width:100%}
34
34
  .review-diff-table .spec-context-row>td{padding:0;background:var(--panel);border-block:1px solid var(--line);white-space:normal}
35
+ .unified-diff-table>tbody>.spec-context-row:first-child>td{border-block-start:0}
35
36
  .spec-context-inline{padding:12px 18px;max-width:90ch;color:var(--text);font:12px/1.6 'DM Sans',sans-serif;overflow-wrap:anywhere}
36
37
  .spec-context-heading{display:flex;align-items:center;gap:10px;margin-bottom:7px}
37
38
  .spec-context-heading>svg{width:14px;height:14px;color:var(--muted)}
@@ -142,7 +143,7 @@
142
143
  .compact-workspace.review-details-open .inspector{display:flex}
143
144
  .inspector[hidden]{display:none!important}
144
145
  .compact-workspace .workspace-footer{display:none}
145
- .compact-change-header{display:grid;grid-template-columns:minmax(0,1fr) auto 32px;align-items:center;gap:16px;padding:0 16px;min-height:46px;background:var(--surface);border-bottom:1px solid var(--line);flex-shrink:0;z-index:3}
146
+ .compact-change-header{display:grid;grid-template-columns:minmax(0,1fr) auto auto;align-items:center;gap:16px;padding:0 16px;min-height:46px;background:var(--surface);border-bottom:1px solid var(--line);flex-shrink:0;z-index:3}
146
147
  .details-icon-toggle{width:32px;min-height:32px;padding:6px;background:transparent;border-color:transparent}
147
148
  .details-icon-toggle[aria-expanded=true]{background:var(--accent-soft);color:var(--accent-text)}
148
149
  .details-icon-toggle:hover{background:var(--rail)}
@@ -150,10 +151,10 @@
150
151
  .compact-change-header .document-tab{flex-shrink:0;font-size:11px;padding:13px 1px;gap:6px}
151
152
  .compact-change-header .document-tab svg{width:13px;height:13px}
152
153
  .compact-change-header .tab-count{font-size:9px;padding:2px 4px}
153
- .compact-workspace .breadcrumbs{min-height:44px;min-width:0;padding:0;gap:10px;flex-wrap:nowrap;border-bottom:0;overflow:hidden}
154
- .compact-workspace .breadcrumbs>strong{min-width:0}
155
- .compact-workspace .breadcrumbs>span{white-space:nowrap;flex-shrink:0}.compact-workspace .breadcrumbs>span:first-of-type{flex:0 1 auto;min-width:0;max-width:35%;overflow:hidden;text-overflow:ellipsis}
156
- .compact-workspace .breadcrumbs>.mobile-menu{flex-shrink:0}
154
+ .compact-change-header .breadcrumbs{min-height:44px;min-width:0;padding:0;gap:10px;flex-wrap:nowrap;border-bottom:0;overflow:hidden}
155
+ .compact-change-header .breadcrumbs>strong{min-width:0}
156
+ .compact-change-header .breadcrumbs>span{white-space:nowrap;flex-shrink:0}.compact-change-header .breadcrumbs>span:first-of-type{flex:0 1 auto;min-width:0;max-width:35%;overflow:hidden;text-overflow:ellipsis}
157
+ .compact-change-header .breadcrumbs>.mobile-menu{flex-shrink:0}
157
158
  .compact-review-feedback{flex-shrink:0}
158
159
  .source-preview-tools{flex-shrink:0;min-width:0;border-bottom:1px solid var(--line);font-size:12px;background:var(--panel)}
159
160
  .source-preview-tools>summary{display:grid;grid-template-columns:18px auto minmax(0,1fr) 16px;align-items:center;gap:9px;cursor:pointer;padding:12px 16px;list-style:none}
@@ -165,8 +166,9 @@
165
166
  .source-preview-body>form:first-child{margin-top:4px}
166
167
  .source-preview-body p{max-width:75ch;color:var(--muted);overflow-wrap:anywhere}
167
168
  .source-analysis-note strong{color:var(--red)}
168
- .source-candidate{display:grid;grid-template-columns:26px minmax(0,1fr);border-top:1px solid var(--line);padding:7px 0;align-items:start}
169
- .source-context-choice{display:flex;align-items:center;justify-content:center;min-height:32px;cursor:pointer}
169
+ .source-candidate{display:flex;gap:10px;border-top:1px solid var(--line);padding:7px 0;align-items:start}
170
+ .source-candidate>details{flex:1;min-width:0}
171
+ .source-context-choice{display:flex;flex:0 0 16px;align-items:center;justify-content:center;min-height:32px;cursor:pointer}
170
172
  .source-context-choice input{accent-color:var(--accent);width:16px;height:16px;margin:0}
171
173
  .source-context-choice>span{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
172
174
  .source-candidate summary{cursor:pointer;min-height:32px;overflow-wrap:anywhere;padding:4px 0}
@@ -193,7 +195,7 @@
193
195
  .compact-workspace .review-diff-table th span{display:none}
194
196
  @media(min-width:761px){.workspace.compact-workspace{grid-template-columns:var(--rail-width) minmax(0,1fr)}.workspace.compact-workspace.review-details-open{grid-template-columns:var(--rail-width) minmax(0,1fr) var(--panel-width)}}
195
197
  @container review-main (max-width:640px){
196
- .compact-change-header{grid-template-columns:minmax(0,1fr) 32px;gap:0 8px}
198
+ .compact-change-header{grid-template-columns:minmax(0,1fr) auto;gap:0 8px}
197
199
  .compact-change-header .breadcrumbs{grid-column:1 / -1}
198
200
  .compact-change-header .document-tabs{justify-self:stretch}
199
201
  }
@@ -215,34 +217,6 @@
215
217
  .completed-diff-option>summary{cursor:pointer;min-height:32px;padding:7px;color:var(--accent-text)}
216
218
  .completed-diff-option>p{margin:6px 0 12px;font-size:11px;line-height:1.7}
217
219
  .completed-diff-option .generate-diff-form{display:flex;justify-content:center}
218
- .files-loading{box-sizing:border-box;width:min(100%,800px);margin:clamp(28px,6vh,64px) auto;padding:0 32px;color:var(--text)}
219
- .files-loading-heading{display:flex;align-items:center;gap:12px}
220
- .files-loading-heading h2{margin:0;font-size:21px;font-weight:650;line-height:1.4;letter-spacing:-.3px}
221
- .files-loading-spinner{flex-shrink:0;inline-size:20px;block-size:20px;box-sizing:border-box;border:2px solid var(--line);border-block-start-color:var(--accent);border-radius:50%;animation:files-loading-spin .8s linear infinite}
222
- .files-loading-description{max-width:65ch;margin:12px 0 26px;color:var(--muted);font-size:13px;line-height:1.8}
223
- .files-skeleton{overflow:hidden;border:1px solid var(--line);border-radius:7px;background:var(--surface)}
224
- .files-skeleton-toolbar{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid var(--line);background:var(--panel)}
225
- .files-skeleton-toolbar>span:first-child{width:30%;height:8px;border-radius:3px;background:var(--line)}
226
- .files-skeleton-toolbar>span:last-child{display:flex;align-items:center;gap:8px;font-size:11px;color:var(--muted)}
227
- .files-skeleton-toolbar svg{width:14px;height:14px}
228
- .files-skeleton-code{padding:18px 0}
229
- .files-skeleton-row{display:flex;align-items:center;gap:18px;height:26px;padding:0 18px}
230
- .files-skeleton-row>span{height:7px;border-radius:3px;background:var(--line)}
231
- .files-skeleton-row>span:first-child{width:18px;flex-shrink:0;opacity:.65}
232
- .files-skeleton-row>span:last-child{width:58%}
233
- .files-skeleton-row:nth-child(2)>span:last-child{width:72%}
234
- .files-skeleton-row:nth-child(3)>span:last-child{width:42%}
235
- .files-skeleton-row:nth-child(5)>span:last-child{width:65%}
236
- .files-skeleton-row:nth-child(6)>span:last-child{width:35%}
237
- .files-skeleton-row.removed{background:var(--diff-removed)}
238
- .files-skeleton-row.added{background:var(--diff-added)}
239
- .files-skeleton-row.removed>span{background:color-mix(in srgb,var(--red) 22%,transparent)}
240
- .files-skeleton-row.added>span{background:color-mix(in srgb,var(--green) 22%,transparent)}
241
- .files-loading-guide{display:grid;grid-template-columns:1fr 1fr;gap:24px;margin:26px 0 0}
242
- .files-loading-guide>div{display:block;margin:0;font-size:13px}
243
- .files-loading-guide dt{color:var(--text);font-weight:600}
244
- .files-loading-guide dd{margin:6px 0 0;color:var(--muted);font-size:12px;line-height:1.8}
245
- .files-loading-note{margin:22px 0 0;color:var(--muted);font-size:11px;line-height:1.8}
246
220
  .apply-spinner{display:inline-block;flex-shrink:0;box-sizing:border-box;width:15px;height:15px;border:2px solid color-mix(in srgb,currentColor 30%,transparent);border-top-color:currentColor;border-radius:50%;animation:files-loading-spin .8s linear infinite}
247
221
  .applying-notice{display:flex;align-items:flex-start;gap:12px;padding:16px;background:var(--accent-soft);color:var(--accent-text);border-bottom:1px solid var(--line)}
248
222
  .applying-notice>.apply-spinner{margin-top:2px}
@@ -252,5 +226,54 @@
252
226
  .files-load-error p{margin:0 0 8px}
253
227
  .inspector[hidden]{display:none}
254
228
  @keyframes files-loading-spin{to{transform:rotate(360deg)}}
255
- @media(max-width:600px){.files-loading{padding:0 20px}.files-loading-heading h2{font-size:18px}.files-loading-guide{grid-template-columns:1fr;gap:16px}.files-skeleton-toolbar{padding-inline:14px}.files-skeleton-row{padding-inline:14px;gap:12px}}
256
- @media(prefers-reduced-motion:reduce){.files-loading-spinner,.apply-spinner{animation:none}}
229
+
230
+ @media(prefers-reduced-motion:reduce){.apply-spinner{animation:none}}
231
+
232
+ .diff-empty-state .empty-state>.diff-cli-note,.diff-empty-state .empty-state>.diff-scope-note{font-size:12px;line-height:1.7;margin-top:18px;color:var(--muted)}
233
+ .diff-generation-status{background:transparent;border-block:1px solid var(--line);border-radius:0;padding:14px 0;margin-top:24px}
234
+ .diff-summary{flex-shrink:0;border-bottom:1px solid var(--line);background:var(--surface);font-size:12px}
235
+ .diff-summary>summary{display:flex;align-items:center;gap:8px;padding:11px 16px;cursor:pointer;list-style:none}
236
+ .diff-summary>summary::-webkit-details-marker{display:none}
237
+ .diff-summary>summary>span{color:var(--muted);margin-left:auto;font-size:11px}
238
+ .diff-summary>summary>svg{width:14px;height:14px;color:var(--accent-text)}
239
+ .diff-summary[open]>summary>svg:last-child{transform:rotate(90deg)}
240
+ .diff-summary>.prose{margin:0;max-width:none;max-height:200px;overflow:auto;padding:0 18px 16px;font-size:13px;line-height:1.7}
241
+ .spec-context-overview{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:9px 16px;border-bottom:1px solid var(--line);background:var(--surface);font:11px/1.6 'DM Sans',sans-serif;flex-shrink:0}
242
+ .spec-context-overview>span{display:flex;align-items:center;gap:8px;flex-wrap:wrap;min-width:0}
243
+ .spec-context-overview svg{width:14px;height:14px;color:var(--accent-text)}
244
+ .spec-context-overview>span>span{color:var(--muted)}
245
+ .spec-context-overview .text-button{font-size:11px}
246
+ @media(max-width:760px){.spec-context-overview{padding-inline:12px}.spec-context-overview .text-button{min-height:36px}.diff-summary>summary{padding-inline:12px}}
247
+
248
+ .diff-agent-question{max-width:70ch;margin:18px auto;text-align:left;font-size:13px;line-height:1.7}
249
+ .diff-agent-question>h3{font-size:14px;margin:0 0 12px}
250
+ .diff-agent-question .studio-question{background:transparent;border-radius:0;padding:12px 0}
251
+ .diff-agent-question textarea{border:1px solid var(--line);border-radius:var(--radius);padding:10px;resize:vertical}
252
+ .compact-review-feedback:has(.diff-agent-question){max-height:45dvh;overflow:auto;flex-shrink:0;padding-inline:16px}
253
+ @media(max-width:760px){.diff-agent-question textarea{font-size:16px}.diff-agent-question .button{min-height:44px}}
254
+
255
+ /* Keep requirement context in one compact disclosure beside the edited block. */
256
+ .spec-context-inline{padding:5px 14px;max-width:none}
257
+ .spec-context-quote>summary{justify-content:flex-start;min-height:30px;gap:8px}
258
+ .spec-context-quote>summary>svg:first-child{width:14px;height:14px;color:var(--accent-text);flex-shrink:0}
259
+ .spec-context-quote>summary>svg:last-child{margin-left:auto;flex-shrink:0}
260
+ .spec-context-quote>summary>strong{font-size:11px;font-weight:500;overflow-wrap:anywhere}
261
+ .spec-context-label{color:var(--muted);font-size:10px;white-space:nowrap}
262
+ .spec-context-quote+.spec-context-quote{margin:0;padding:0;border:0}
263
+ .spec-context-quote[open]{padding-bottom:10px}
264
+ .spec-context-quote[open]>summary{margin-bottom:5px}
265
+ /* Local analysis stays compact beside the file review. */
266
+ .source-preview-tools{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);margin:8px 16px;overflow:hidden}
267
+ .source-preview-tools>summary{grid-template-columns:16px minmax(0,1fr) auto 14px;min-height:40px;padding:9px 12px;font-size:12px;background:var(--panel)}
268
+ .source-preview-tools>summary>svg:first-child{width:16px;height:16px;color:var(--muted)}
269
+ .source-preview-tools>summary>.source-analysis-state{font-size:10px;color:var(--muted);font-weight:400}
270
+ .source-preview-tools>summary:hover{background:var(--rail)}
271
+ .source-preview-tools[open]>summary{border-bottom:1px solid var(--line)}
272
+ .source-preview-body{background:var(--surface);padding:12px}
273
+ .source-analysis-toolbar{display:flex;align-items:center;justify-content:space-between;gap:12px}
274
+ .source-analysis-toolbar>p{margin:0;font-size:11px;color:var(--muted);line-height:1.6;max-width:45ch}
275
+ .source-analysis-toolbar .button{min-height:32px;padding:5px 10px;font-size:11px;white-space:nowrap;background:var(--surface)}
276
+ #source-preview-feedback:empty{display:none}
277
+ #source-preview-feedback:not(:empty){margin:10px 0 0;padding:8px 10px;font-size:11px;line-height:1.6;border-radius:var(--radius)}
278
+ .source-preview-tools>summary:focus-visible,.spec-context-quote>summary:focus-visible{outline:2px solid var(--accent-text);outline-offset:-2px}
279
+ @media(max-width:760px){.spec-context-label{display:none}.source-preview-tools{margin:8px}.spec-context-quote>summary{min-height:44px}.source-preview-tools>summary>.source-analysis-state{grid-column:3;grid-row:1}.source-analysis-toolbar{align-items:flex-start;flex-wrap:wrap}.source-analysis-toolbar .button{min-height:40px}}