spequi 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -89,8 +89,7 @@ Spequi sends usage and failure analytics, including project folder names, Git us
89
89
 
90
90
  ## Status
91
91
 
92
- Spequi is early. It is tested with Claude Code and Codex flows; continuous polling in a real GigaCode session and
93
- native Windows execution are not yet verified. Static impact analysis can miss dynamic references and aliases.
92
+ Spequi is early. It has been tested with Claude Code and Codex, and with GigaCode CLI on Windows. Static impact analysis can miss dynamic references and aliases.
94
93
  See [Security and limits](docs/security.md) for the full list.
95
94
 
96
95
  Feedback and bug reports are welcome in [Issues](https://github.com/rahulnjs/spequi/issues).
@@ -60,7 +60,7 @@ The installer registers GigaCode alongside the existing agents. Project initiali
60
60
 
61
61
  `skill install --global` creates the same paths under the user's home directory. The command wrappers reference the skill in the matching scope and use GigaCode's `{{args}}` parameter syntax. After discovery, invoke `/skills spequi` or `/spequi`. These paths and formats follow GigaCode's [skills](https://gitverse.ru/docs/ai/ai-assistant-gigacode/gigacode-cli/skills) and [commands](https://gitverse.ru/docs/ai/ai-assistant-gigacode/gigacode-cli/commands) documentation.
62
62
 
63
- The installer registers the viewer skill; it does not install other OpenSpec workflows. Those must be discoverable separately. Registration and refresh behavior are tested locally; indefinite polling in a real GigaCode session still requires an integration test.
63
+ The installer registers the viewer skill; it does not install other OpenSpec workflows. Those must be discoverable separately. Registration and refresh behavior are tested locally. GigaCode CLI has also been tested on Windows.
64
64
 
65
65
  ### Register a session
66
66
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "spequi",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Local web UI for OpenSpec: plan specs with your coding agent, review spec-linked diffs, apply only what you approve.",
5
5
  "keywords": [
6
6
  "openspec",
package/public/app.css CHANGED
@@ -63,6 +63,7 @@
63
63
  .split-diff-table .diff-gap{background:var(--panel)}
64
64
  @media(max-width:760px){.changed-files-nav{max-height:45dvh}.file-review-intro{padding:20px 16px}.diff-version-form select{max-width:210px}.diff-empty-state{padding:24px 12px}.diff-empty-state .empty-state{padding:20px 8px}.diff-empty-actions .button{min-height:44px}.file-review-intro .preview-actions{gap:8px}.file-review-intro .preview-actions>span{flex-basis:100%;margin-bottom:2px}.file-review-intro .button{min-height:36px}}
65
65
  /* Markdown task checkboxes stay legible even though they are read-only. */
66
+ .prose li:has(>input[type=checkbox]),.prose li:has(>p>input[type=checkbox]),.prose li.task-list-item{list-style:none}
66
67
  .prose input[type=checkbox]{appearance:none;-webkit-appearance:none;display:inline-grid;place-content:center;inline-size:15px;block-size:15px;padding:0;border:1px solid var(--muted);border-radius:3px;background:var(--surface);opacity:1;vertical-align:-2px}
67
68
  .prose input[type=checkbox]:checked{border-color:var(--green);background:var(--green)}
68
69
  .prose input[type=checkbox]:checked::after{content:"";display:block;inline-size:12px;block-size:12px;background:var(--surface);-webkit-mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3.5 3.5L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat;mask:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m3 8.5 3.5 3.5L13 4.5' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/contain no-repeat}
@@ -92,7 +93,7 @@
92
93
  .request-state{display:inline-flex;align-items:center;gap:5px;padding:2px 6px;border-radius:4px;background:var(--panel);color:var(--muted);font-size:10px;font-weight:500;line-height:16px;white-space:nowrap;flex-shrink:0}
93
94
  .request-state::before{content:"";width:4px;height:4px;border-radius:50%;background:currentColor;flex-shrink:0}
94
95
  .request-state[data-state=completed]{background:var(--green-bg);color:var(--green)}
95
- .request-state[data-state=failed],.request-state[data-state=stalled]{background:var(--red-bg);color:var(--red)}
96
+ .request-state[data-state=failed]{background:var(--red-bg);color:var(--red)}.request-state[data-state=stalled]{background:var(--rail);color:var(--muted)}
96
97
  .request-state[data-state=running],.request-state[data-state=awaiting-input]{background:var(--accent-soft);color:var(--accent-text)}
97
98
  .request-row details{min-width:0;font-size:12px;line-height:1.65;overflow-wrap:anywhere}
98
99
  .request-row summary{display:flex;align-items:flex-start;gap:8px;min-height:24px;margin:6px 0 4px;padding:2px 0;list-style:none;cursor:pointer;color:var(--muted);border-radius:3px}
package/public/app.js CHANGED
@@ -119,8 +119,55 @@
119
119
  if (message && feedback) { feedback.textContent = message.text; feedback.className = message.error ? 'error-message' : 'success-message'; }
120
120
  }
121
121
  function readingViewport() { return document.querySelector('.diff-code-scroll') || document.querySelector('.reader'); }
122
+ let filesLoading = null;
123
+ 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
+ }
141
+ }
142
+ function showFilesLoading(link, xhr) {
143
+ 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;
167
+ }
168
+ let applyingRequest = null;
122
169
  function refresh() {
123
- if (sourcePending.size || navigationRequests) { pendingRefresh = true; return; }
170
+ if (sourcePending.size || navigationRequests || applyingRequest) { pendingRefresh = true; return; }
124
171
  if (refreshing) { pendingRefresh = true; followUpRefresh = true; return; }
125
172
  if (!window.htmx) { pendingRefresh = true; return; }
126
173
  if (document.activeElement?.matches('input,textarea,select') || document.getElementById('apply-dialog')?.open || document.querySelector('dialog[open]')) { pendingRefresh = true; return; }
@@ -150,17 +197,50 @@
150
197
  document.addEventListener('htmx:configRequest', event => { event.detail.headers['X-CSRF-Token'] = document.querySelector('meta[name="csrf-token"]').content; });
151
198
  document.addEventListener('htmx:beforeRequest', event => {
152
199
  const xhr = event.detail?.xhr;
200
+ const applyForm = event.detail?.elt?.closest?.('[data-apply-form]');
201
+ if (applyForm) {
202
+ if (applyingRequest) { event.preventDefault(); return; }
203
+ const button = applyForm.querySelector('button'), feedback = document.getElementById('apply-feedback');
204
+ applyingRequest = { xhr, form: applyForm, button, html: button.innerHTML, disabled: button.disabled, feedback };
205
+ navigationGeneration++; backgroundXHR?.abort(); backgroundXHR = null;
206
+ applyForm.setAttribute('aria-busy', 'true'); button.disabled = true;
207
+ button.innerHTML = '<span class="apply-spinner" aria-hidden="true"></span>Applying changes…';
208
+ if (feedback) feedback.innerHTML = '<div class="applying-notice" role="status"><span class="apply-spinner" aria-hidden="true"></span><div><strong>Applying reviewed changes</strong><p>Saving the approved files to your project. This review will update when the operation finishes.</p></div></div>';
209
+ }
153
210
  if (event.detail?.requestConfig?.headers?.['X-Spequi-Refresh'] === '1' && xhr) {
154
211
  xhr.spequiGeneration = navigationGeneration; backgroundXHR = xhr;
155
212
  } else if (event.detail?.target?.id === 'workspace' && event.detail?.elt?.matches('a,form,input')) {
156
213
  navigationGeneration++; navigationRequests++;
157
- if (xhr) xhr.spequiNavigation = true;
214
+ if (xhr) { xhr.spequiNavigation = true; xhr.spequiGeneration = navigationGeneration; }
158
215
  backgroundXHR?.abort(); backgroundXHR = null;
159
216
  }
160
217
  remember();
218
+ const filesTab = event.detail?.elt?.closest?.('a[data-files-tab]');
219
+ if (filesTab) showFilesLoading(filesTab, xhr);
220
+ else if (xhr?.spequiNavigation) restoreFilesLoading();
161
221
  if (event.detail.elt?.closest('[data-preserve-reader]')) { const reader = readingViewport(); preserveReader = reader ? { top: reader.scrollTop, left: reader.scrollLeft } : null; }
162
222
  });
163
223
  document.addEventListener('htmx:afterRequest', event => {
224
+ if (applyingRequest?.xhr === event.detail?.xhr) {
225
+ const { form, button, html, disabled, feedback } = applyingRequest;
226
+ applyingRequest = null; form.removeAttribute('aria-busy');
227
+ const success = event.detail.xhr.status >= 200 && event.detail.xhr.status < 300 && !event.detail.failed;
228
+ button.innerHTML = success ? 'Changes applied' : html; button.disabled = success || disabled;
229
+ if (success) { pendingRefresh = true; setTimeout(refresh, 100); }
230
+ else {
231
+ pendingRefresh = false;
232
+ if (feedback?.querySelector('.applying-notice')) {
233
+ feedback.replaceChildren();
234
+ const error = document.createElement('p'); error.className = 'error-message'; error.setAttribute('role', 'alert');
235
+ error.textContent = 'Could not confirm whether the files were applied. Refresh this review before trying again.';
236
+ feedback.append(error);
237
+ }
238
+ }
239
+ }
240
+ if (filesLoading?.xhr === event.detail?.xhr) {
241
+ if (event.detail.failed || event.detail.xhr.status === 0 || event.detail.xhr.status >= 400) restoreFilesLoading(true);
242
+ else filesLoading = null;
243
+ }
164
244
  if (!event.detail?.xhr?.spequiNavigation) return;
165
245
  navigationRequests = Math.max(0, navigationRequests - 1);
166
246
  if (!navigationRequests && pendingRefresh) setTimeout(refresh, 100);
@@ -168,6 +248,7 @@
168
248
  document.addEventListener('htmx:beforeSwap', event => {
169
249
  const generation = event.detail?.xhr?.spequiGeneration;
170
250
  if (generation !== undefined && generation !== navigationGeneration) event.detail.shouldSwap = false;
251
+ if (filesLoading?.xhr === event.detail.xhr && event.detail.xhr.status >= 400) event.detail.shouldSwap = false;
171
252
  });
172
253
  document.addEventListener('htmx:afterSwap', () => {
173
254
  restore(); initializeDiff();
@@ -175,7 +256,7 @@
175
256
  });
176
257
  // HTMX restores incoming class attributes during settling, after afterSwap.
177
258
  document.addEventListener('htmx:afterSettle', initializeDiff);
178
- document.addEventListener('htmx:beforeSwap', event => { if (event.detail.xhr.status >= 400 && event.detail.xhr.status < 500) { event.detail.shouldSwap = true; event.detail.isError = false; } });
259
+ document.addEventListener('htmx:beforeSwap', event => { if (event.detail.xhr.status >= 400 && event.detail.xhr.status < 500 && event.detail.xhr.spequiGeneration === undefined) { event.detail.shouldSwap = true; event.detail.isError = false; } });
179
260
  document.addEventListener('htmx:sendError', () => toast('Could not reach the viewer. Check that the local server is running.'));
180
261
  document.addEventListener('workspace-updated', () => { pendingRefresh = true; refresh(); });
181
262
  document.addEventListener('focusout', () => { if (pendingRefresh) setTimeout(refresh, 100); });
@@ -278,11 +359,17 @@
278
359
  }, true);
279
360
  document.addEventListener('submit', event => {
280
361
  const form = event.target.closest('[data-apply-form]');
362
+ if (form && applyingRequest) { event.preventDefault(); event.stopImmediatePropagation(); return; }
281
363
  if (!form || form.dataset.confirmed) { if (form) delete form.dataset.confirmed; return; }
282
364
  event.preventDefault(); event.stopImmediatePropagation();
283
365
  const dialog = document.getElementById('apply-dialog');
284
366
  dialog.returnValue = ''; dialog.showModal();
285
- dialog.addEventListener('close', () => { if (dialog.returnValue === 'confirm') { form.dataset.confirmed = 'true'; form.requestSubmit(); } }, { once: true });
367
+ const action = form.getAttribute('hx-post');
368
+ dialog.addEventListener('close', () => {
369
+ if (dialog.returnValue !== 'confirm') return;
370
+ const current = [...document.querySelectorAll('[data-apply-form]')].find(item => item.getAttribute('hx-post') === action);
371
+ if (current && !current.querySelector('button').disabled) { current.dataset.confirmed = 'true'; current.requestSubmit(); }
372
+ }, { once: true });
286
373
  }, true);
287
374
  let retry = 1000, hasConnected = false;
288
375
  let agentRequest;
package/public/diff.css CHANGED
@@ -215,3 +215,42 @@
215
215
  .completed-diff-option>summary{cursor:pointer;min-height:32px;padding:7px;color:var(--accent-text)}
216
216
  .completed-diff-option>p{margin:6px 0 12px;font-size:11px;line-height:1.7}
217
217
  .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
+ .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
+ .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
+ .applying-notice>.apply-spinner{margin-top:2px}
249
+ .applying-notice strong{font-size:12px;font-weight:600;line-height:1.6}
250
+ .applying-notice p{margin:4px 0 0;font-size:11px;line-height:1.8;max-width:70ch}
251
+ .files-load-error{padding:16px 24px;color:var(--red);border-bottom:1px solid var(--line)}
252
+ .files-load-error p{margin:0 0 8px}
253
+ .inspector[hidden]{display:none}
254
+ @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}}