glassbox 0.11.0 → 0.12.0-beta.1
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 +53 -0
- package/dist/cli-difftool.js +50 -0
- package/dist/cli.js +454 -135
- package/dist/client/app.global.js +41 -41
- package/dist/client/styles.css +1 -1
- package/dist/svg-rasterize-worker.js +2 -1
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -87,11 +87,15 @@ Then you run `glassbox` again. Your previous annotations carry forward — match
|
|
|
87
87
|
|
|
88
88
|
- **Split and unified diffs** with syntax-colored add/remove/context lines
|
|
89
89
|
- **Line-level annotations** — click any line to add feedback with a category
|
|
90
|
+
- **Image and SVG diffs** — binary images and SVGs render side-by-side with a **difference overlay**, a **swipeable slice tool**, and pixel-precision zoom/pan. SVGs offer a *Code* / *Rendered* toggle so you can review either the source or the rasterized output.
|
|
91
|
+
- **Compare any two paths** — `glassbox --diff <A> <B>` reviews two arbitrary files or two arbitrary folders by path — no git repository required.
|
|
90
92
|
- **Drag and drop** annotations to different lines
|
|
91
93
|
- **Double-click** to edit, click the category badge to reclassify
|
|
92
94
|
- **Collapsible folder tree** in the sidebar with file filter
|
|
93
95
|
- **Resizable sidebar** and word wrap toggle
|
|
94
96
|
- **Keyboard navigation** — `j`/`k` to move between files, `Cmd+Enter` to save
|
|
97
|
+
- **Go-to-definition and a nav stack** — click any symbol to jump to its definition, with back/forward through your trail
|
|
98
|
+
- **Themes** — built-in Dark, Light, High Contrast, Dracula, and Tokyo Night, plus a custom theme editor with live preview
|
|
95
99
|
- **Session persistence** — reviews survive restarts, pick up where you left off
|
|
96
100
|
- **Smart review reuse** — re-running `glassbox` on the same commit updates diffs in place and migrates annotations to their new line positions
|
|
97
101
|
- **Stale annotation detection** — comments that can't be matched to the updated diff are flagged with a visual indicator
|
|
@@ -130,6 +134,8 @@ If you're learning a new language, onboarding to an unfamiliar codebase, or new
|
|
|
130
134
|
|
|
131
135
|
Guided Review works in all three sidebar modes (folder, risk, and narrative) and runs independently of risk or narrative analysis. When enabled, risk and narrative analysis also adjust their output to be more detailed and educational.
|
|
132
136
|
|
|
137
|
+
<img src="assets/demo-guided-review.png" alt="Guided review notes inline with the diff" width="720">
|
|
138
|
+
|
|
133
139
|
### How to use it
|
|
134
140
|
|
|
135
141
|
Click the shield or book icon in the sidebar to switch from the default folder view to risk or narrative mode. If you haven't configured an API key yet, a settings dialog will prompt you. Analysis runs once and results are cached for the session. To enable Guided Review, open the Settings dialog (gear icon) and check "Enable guided review."
|
|
@@ -216,6 +222,9 @@ glassbox --files "src/**/*.ts,lib/*.js"
|
|
|
216
222
|
# Review entire codebase
|
|
217
223
|
glassbox --all
|
|
218
224
|
|
|
225
|
+
# Compare two arbitrary files or folders by path (no git repo required)
|
|
226
|
+
glassbox --diff ./dist-old ./dist-new
|
|
227
|
+
|
|
219
228
|
# Resume a previous review
|
|
220
229
|
glassbox --resume
|
|
221
230
|
```
|
|
@@ -233,6 +242,7 @@ glassbox --resume
|
|
|
233
242
|
| `--branch <name>` | Current branch vs the named branch |
|
|
234
243
|
| `--files <patterns>` | Specific files (comma-separated globs) |
|
|
235
244
|
| `--all` | Entire codebase (all tracked files) |
|
|
245
|
+
| `--diff <a> <b>` | Compare two arbitrary files or folders by path — no git repo required |
|
|
236
246
|
| `--port <number>` | Port to run on (default: 4183) |
|
|
237
247
|
| `--resume` | Resume the latest in-progress review for this mode |
|
|
238
248
|
| `--browser` | Open in browser instead of desktop window |
|
|
@@ -254,6 +264,49 @@ Create `.glassbox/settings.json` in your project directory to configure per-proj
|
|
|
254
264
|
|-----|-------------|
|
|
255
265
|
| `appName` | Custom window title and Dock name (defaults to "Glassbox — _folder name_") |
|
|
256
266
|
|
|
267
|
+
### Use as `git difftool`
|
|
268
|
+
|
|
269
|
+
Glassbox installs a companion binary, `glassbox-difftool`, that lets you register it as your `git difftool` so `git difftool --dir-diff <refA> <refB>` opens the diff in Glassbox automatically.
|
|
270
|
+
|
|
271
|
+
The easiest way to register it is to let the CLI do it for you:
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
glassbox --register-difftool # writes the three keys at --global scope
|
|
275
|
+
glassbox --register-difftool --local # only inside the current repo
|
|
276
|
+
glassbox --unregister-difftool # remove (only touches keys we set)
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
If you already have a different `diff.tool` configured, `--register-difftool` refuses to clobber it; pass `--force` to overwrite. The same controls live under **Settings → General** in the app (Register / Re-register / Unregister buttons).
|
|
280
|
+
|
|
281
|
+
If you'd rather wire it up by hand, the equivalent config is:
|
|
282
|
+
|
|
283
|
+
```bash
|
|
284
|
+
git config --global diff.tool glassbox
|
|
285
|
+
git config --global difftool.glassbox.cmd 'glassbox-difftool "$LOCAL" "$REMOTE"'
|
|
286
|
+
git config --global difftool.prompt false
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Then:
|
|
290
|
+
|
|
291
|
+
```bash
|
|
292
|
+
git difftool --dir-diff HEAD~1 HEAD
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
**Use `--dir-diff`, not the per-file mode.** Glassbox is a session-based reviewer; the per-file mode would launch a separate Glassbox instance for each changed file (and collide on the instance lock). `--dir-diff` invokes Glassbox once with both snapshots.
|
|
296
|
+
|
|
297
|
+
**Under the hood:** `git difftool --dir-diff` materializes its two snapshot directories asymmetrically — the right side is symlinks pointing into your working tree, which trips up plain `git diff --no-index`. `glassbox-difftool` dereferences those symlinks into a temp tree before handing the dirs to `glassbox --diff`, then cleans up on exit. Without the wrapper you'd see every modified file show up as a "deleted + added" pair instead of a modified entry.
|
|
298
|
+
|
|
299
|
+
**Alternative: skip git difftool entirely.** Glassbox's native ref-aware modes already cover the workflows `git difftool` is for and produce cleaner diffs (real `git diff`, not `--no-index`):
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
glassbox --commit <sha> # review one commit
|
|
303
|
+
glassbox --range <from>..<to> # review a range
|
|
304
|
+
glassbox --branch main # current branch vs main
|
|
305
|
+
glassbox # uncommitted changes
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
Most users will find the native modes preferable. The `git difftool` integration exists for muscle memory.
|
|
309
|
+
|
|
257
310
|
---
|
|
258
311
|
|
|
259
312
|
## AI integration
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/cli-difftool.ts
|
|
4
|
+
import { spawnSync } from "child_process";
|
|
5
|
+
import { cpSync, mkdtempSync, rmSync } from "fs";
|
|
6
|
+
import { tmpdir } from "os";
|
|
7
|
+
import { dirname, join } from "path";
|
|
8
|
+
import { fileURLToPath } from "url";
|
|
9
|
+
var args = process.argv.slice(2);
|
|
10
|
+
if (args.length < 2 || args[0].startsWith("-") || args[1].startsWith("-")) {
|
|
11
|
+
console.error("usage: glassbox-difftool <local-dir> <remote-dir> [extra glassbox args...]");
|
|
12
|
+
console.error("");
|
|
13
|
+
console.error("Configure as a git difftool:");
|
|
14
|
+
console.error(" git config --global diff.tool glassbox");
|
|
15
|
+
console.error(` git config --global difftool.glassbox.cmd 'glassbox-difftool "$LOCAL" "$REMOTE"'`);
|
|
16
|
+
console.error(" git config --global difftool.prompt false");
|
|
17
|
+
console.error("");
|
|
18
|
+
console.error("Then use `--dir-diff` (per-file mode collides with Glassbox's instance lock):");
|
|
19
|
+
console.error(" git difftool --dir-diff HEAD~1 HEAD");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
var [local, remote, ...extra] = args;
|
|
23
|
+
var work = mkdtempSync(join(tmpdir(), "glassbox-difftool-"));
|
|
24
|
+
var resolvedLocal = join(work, "left");
|
|
25
|
+
var resolvedRemote = join(work, "right");
|
|
26
|
+
function cleanup() {
|
|
27
|
+
try {
|
|
28
|
+
rmSync(work, { recursive: true, force: true });
|
|
29
|
+
} catch {
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
var signalExit = (code) => () => {
|
|
33
|
+
cleanup();
|
|
34
|
+
process.exit(code);
|
|
35
|
+
};
|
|
36
|
+
process.on("SIGINT", signalExit(130));
|
|
37
|
+
process.on("SIGTERM", signalExit(143));
|
|
38
|
+
try {
|
|
39
|
+
cpSync(local, resolvedLocal, { recursive: true, dereference: true });
|
|
40
|
+
cpSync(remote, resolvedRemote, { recursive: true, dereference: true });
|
|
41
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
const cli = join(here, "cli.js");
|
|
43
|
+
const res = spawnSync(process.execPath, [cli, "--diff", resolvedLocal, resolvedRemote, ...extra], {
|
|
44
|
+
stdio: "inherit"
|
|
45
|
+
});
|
|
46
|
+
process.exit(res.status ?? 0);
|
|
47
|
+
} finally {
|
|
48
|
+
cleanup();
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=cli-difftool.js.map
|