glassbox 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +224 -0
  3. package/dist/cli.js +3689 -0
  4. package/package.json +53 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 westphal
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,224 @@
1
+ <div align="center">
2
+
3
+ # Glassbox
4
+
5
+ ### Stop hoping your AI got it right. Review the diff, leave precise feedback, and let AI fix it — in one loop.
6
+
7
+ <br>
8
+
9
+ **Glassbox** is a local, browser-based code review tool built for the AI coding workflow. You review the changes your AI made, annotate what's wrong (or right), and export structured feedback that AI tools can read and act on instantly.
10
+
11
+ No accounts. No pull requests. No waiting. Just you, the diff, and a tight feedback loop.
12
+
13
+ <br>
14
+
15
+ ```bash
16
+ npm install -g glassbox
17
+ ```
18
+
19
+ ```bash
20
+ glassbox
21
+ ```
22
+
23
+ That's it. Opens in your browser. Works in any git repo.
24
+
25
+ <br>
26
+
27
+ <img src="assets/screenshot.png" alt="Glassbox reviewing a diff" width="720">
28
+
29
+ </div>
30
+
31
+ ---
32
+
33
+ ## Why Glassbox?
34
+
35
+ AI coding tools generate a lot of code fast. But "fast" doesn't mean "correct." The bottleneck isn't generation — it's **review**.
36
+
37
+ Most developers review AI output by skimming files in their editor, mentally diffing what changed, and then either accepting it or rewriting it by hand. That's slow, error-prone, and throws away the most valuable signal: your expert judgment about *what specifically* was wrong and why.
38
+
39
+ Glassbox gives you a proper diff viewer with annotation categories designed for AI feedback:
40
+
41
+ | Category | What it tells the AI |
42
+ |----------|---------------------|
43
+ | **Bug** | "This is broken. Fix it." |
44
+ | **Fix needed** | "This needs a specific change." |
45
+ | **Style** | "I prefer it done this way." |
46
+ | **Pattern to follow** | "This is good. Keep doing this." |
47
+ | **Pattern to avoid** | "This is an anti-pattern. Stop." |
48
+ | **Note** | Context for the AI to consider. |
49
+ | **Remember** | A rule to persist to the AI's long-term config. |
50
+
51
+ When you're done, click **Complete Review** and tell your AI tool:
52
+
53
+ ```
54
+ Read .glassbox/latest-review.md and apply the feedback.
55
+ ```
56
+
57
+ The AI gets a structured file with every annotation, organized by file and line number, with clear instructions on how to interpret each category. It fixes the bugs, applies your style preferences, avoids the anti-patterns, and updates its own config with your "remember" items.
58
+
59
+ Then you run `glassbox` again. Your previous annotations carry forward — matched to the updated diff. Stale comments that no longer apply are flagged so you can keep or discard them. The loop continues until you're satisfied.
60
+
61
+ ---
62
+
63
+ ## How it works
64
+
65
+ ```
66
+ You AI
67
+ | |
68
+ | generate code |
69
+ |<----------------------|
70
+ | |
71
+ | glassbox |
72
+ | review + annotate |
73
+ | |
74
+ | "Read .glassbox/ |
75
+ | latest-review.md" |
76
+ |---------------------->|
77
+ | |
78
+ | updated code |
79
+ |<----------------------|
80
+ | |
81
+ | glassbox |
82
+ | (annotations carry |
83
+ | forward) |
84
+ | |
85
+ : repeat until done :
86
+ ```
87
+
88
+ ---
89
+
90
+ ## Features
91
+
92
+ - **Split and unified diffs** with syntax-colored add/remove/context lines
93
+ - **Line-level annotations** — click any line to add feedback with a category
94
+ - **Drag and drop** annotations to different lines
95
+ - **Double-click** to edit, click the category badge to reclassify
96
+ - **Collapsible folder tree** in the sidebar with file filter
97
+ - **Resizable sidebar** and word wrap toggle
98
+ - **Keyboard navigation** — `j`/`k` to move between files, `Cmd+Enter` to save
99
+ - **Session persistence** — reviews survive restarts, pick up where you left off
100
+ - **Smart review reuse** — re-running `glassbox` on the same commit updates diffs in place and migrates annotations to their new line positions
101
+ - **Stale annotation detection** — comments that can't be matched to the updated diff are flagged with a visual indicator
102
+ - **Review history** — browse, reopen, or delete past reviews
103
+ - **Structured export** — markdown output with file paths, line numbers, categories, and instructions for AI consumption
104
+ - **Automatic .gitignore prompt** — reminds you to exclude `.glassbox/` from version control
105
+ - **Auto port selection** — if the default port is busy, it finds an open one
106
+ - **Fully local** — no network calls, no accounts, no telemetry. Your code stays on your machine.
107
+
108
+ ---
109
+
110
+ ## Install
111
+
112
+ ```bash
113
+ npm install -g glassbox
114
+ ```
115
+
116
+ Requires **Node.js 20+** and **git**.
117
+
118
+ ---
119
+
120
+ ## Usage
121
+
122
+ Run from inside any git repository:
123
+
124
+ ```bash
125
+ # Review uncommitted changes (default, same as no arguments)
126
+ glassbox
127
+
128
+ # Review only staged changes
129
+ glassbox --staged
130
+
131
+ # Review a specific commit
132
+ glassbox --commit abc123
133
+
134
+ # Review current branch vs main
135
+ glassbox --branch main
136
+
137
+ # Review a range of commits
138
+ glassbox --range main..feature-branch
139
+
140
+ # Review specific files
141
+ glassbox --files "src/**/*.ts,lib/*.js"
142
+
143
+ # Review entire codebase
144
+ glassbox --all
145
+
146
+ # Resume a previous review
147
+ glassbox --resume
148
+ ```
149
+
150
+ ### All options
151
+
152
+ | Flag | Description |
153
+ |------|-------------|
154
+ | *(no flag)* | Same as `--uncommitted` |
155
+ | `--uncommitted` | Staged + unstaged + untracked changes |
156
+ | `--staged` | Only staged changes |
157
+ | `--unstaged` | Only unstaged changes |
158
+ | `--commit <sha>` | Changes from a specific commit |
159
+ | `--range <from>..<to>` | Changes between two refs |
160
+ | `--branch <name>` | Current branch vs the named branch |
161
+ | `--files <patterns>` | Specific files (comma-separated globs) |
162
+ | `--all` | Entire codebase (all tracked files) |
163
+ | `--port <number>` | Port to run on (default: 4173) |
164
+ | `--resume` | Resume the latest in-progress review for this mode |
165
+ | `--check-for-updates` | Check for a newer version on npm |
166
+ | `--debug` | Show build timestamp and debug info |
167
+ | `--help` | Show help |
168
+
169
+ ---
170
+
171
+ ## AI integration
172
+
173
+ The exported review file is plain markdown. Any AI tool that can read files can use it.
174
+
175
+ ### Claude Code
176
+
177
+ ```
178
+ Read .glassbox/latest-review.md and apply the review feedback.
179
+ ```
180
+
181
+ ### Cursor / Copilot / other
182
+
183
+ Point the tool at the file. The export includes an "Instructions for AI Tools" section that explains how to interpret each annotation category.
184
+
185
+ ### What the AI does with it
186
+
187
+ - Fixes lines marked **bug** or **fix needed**
188
+ - Applies **style** preferences to the indicated lines and similar patterns
189
+ - Continues using **pattern-to-follow** patterns
190
+ - Refactors **pattern-to-avoid** anti-patterns
191
+ - Persists **remember** items to its configuration (CLAUDE.md, .cursorrules, etc.)
192
+ - Reads **notes** as context
193
+
194
+ ---
195
+
196
+ ## Architecture
197
+
198
+ | Layer | Technology |
199
+ |-------|-----------|
200
+ | CLI | TypeScript, Node.js |
201
+ | Server | Hono |
202
+ | Database | PGLite (embedded PostgreSQL) |
203
+ | UI | Custom server-side JSX (no React), vanilla client JS |
204
+ | Build | tsup (single-file bundle) |
205
+ | Storage | `~/.glassbox/data/` |
206
+
207
+ Data stays local. The only network call is an optional once-per-day npm update check.
208
+
209
+ ## Development
210
+
211
+ ```bash
212
+ git clone <repo-url>
213
+ cd glassbox
214
+ npm install
215
+
216
+ npm run dev -- --uncommitted # Run with tsx (no build step)
217
+ npm run build # Build to dist/cli.js
218
+ npm run clean # Remove dist and caches
219
+ npm link # Symlink for global 'glassbox' command
220
+ ```
221
+
222
+ ## License
223
+
224
+ MIT