critique 0.0.24 → 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.
- package/CHANGELOG.md +28 -0
- package/README.md +155 -2
- package/bun.lock +78 -82
- package/package.json +7 -7
- package/src/ansi-html.ts +4 -0
- package/src/cli.tsx +503 -129
- package/src/diff.tsx +52 -1
- package/src/dropdown.tsx +64 -27
- package/src/themes/aura.json +69 -0
- package/src/themes/ayu.json +80 -0
- package/src/themes/catppuccin-frappe.json +233 -0
- package/src/themes/catppuccin-macchiato.json +233 -0
- package/src/themes/catppuccin.json +112 -0
- package/src/themes/cobalt2.json +228 -0
- package/src/themes/cursor.json +249 -0
- package/src/themes/dracula.json +219 -0
- package/src/themes/everforest.json +241 -0
- package/src/themes/flexoki.json +237 -0
- package/src/themes/github.json +241 -0
- package/src/themes/gruvbox.json +95 -0
- package/src/themes/kanagawa.json +77 -0
- package/src/themes/lucent-orng.json +227 -0
- package/src/themes/material.json +235 -0
- package/src/themes/matrix.json +77 -0
- package/src/themes/mercury.json +252 -0
- package/src/themes/monokai.json +221 -0
- package/src/themes/nightowl.json +221 -0
- package/src/themes/nord.json +223 -0
- package/src/themes/one-dark.json +84 -0
- package/src/themes/opencode.json +245 -0
- package/src/themes/orng.json +245 -0
- package/src/themes/palenight.json +222 -0
- package/src/themes/rosepine.json +234 -0
- package/src/themes/solarized.json +223 -0
- package/src/themes/synthwave84.json +226 -0
- package/src/themes/tokyonight.json +243 -0
- package/src/themes/vercel.json +255 -0
- package/src/themes/vesper.json +218 -0
- package/src/themes/zenburn.json +223 -0
- package/src/themes.ts +248 -0
- package/src/worker.ts +2 -2
- package/src/diff.test.tsx +0 -22
- package/src/example.tsx +0 -974
- package/src/theme.tsx +0 -29
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
# 0.1.0
|
|
2
|
+
|
|
3
|
+
- Diff view:
|
|
4
|
+
- Use unified view for fully added or fully deleted files (split view would have one empty side)
|
|
5
|
+
- Theme preview:
|
|
6
|
+
- Fix black background in scrollbox areas by using theme background color instead of transparent
|
|
7
|
+
|
|
8
|
+
# 0.0.29
|
|
9
|
+
|
|
10
|
+
- Persist theme preference to `~/.critique/state.json`
|
|
11
|
+
- Theme selection is restored on next launch
|
|
12
|
+
- Directory is created automatically if missing
|
|
13
|
+
|
|
14
|
+
# 0.0.28
|
|
15
|
+
|
|
16
|
+
- Default command:
|
|
17
|
+
- Add support for comparing two git refs: `critique <base> <head>`
|
|
18
|
+
- Uses three-dot notation (`base...head`) to show changes since branches diverged (GitHub PR-style diff)
|
|
19
|
+
|
|
20
|
+
# 0.0.26
|
|
21
|
+
|
|
22
|
+
- Web preview:
|
|
23
|
+
- Add `text-size-adjust: 100%` CSS to prevent mobile browsers from auto-scaling text
|
|
24
|
+
|
|
25
|
+
# 0.0.25
|
|
26
|
+
|
|
27
|
+
- Change default worker URL to https://critique.work/
|
|
28
|
+
|
|
1
29
|
# 0.0.24
|
|
2
30
|
|
|
3
31
|
- Worker:
|
package/README.md
CHANGED
|
@@ -1,10 +1,163 @@
|
|
|
1
1
|
# critique
|
|
2
2
|
|
|
3
|
-
A terminal UI for reviewing git diff
|
|
3
|
+
A beautiful terminal UI for reviewing git diffs with syntax highlighting, split view, and word-level diff.
|
|
4
4
|
|
|
5
|
+

|
|
5
6
|
|
|
6
|
-
##
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
> **Note:** critique requires [Bun](https://bun.sh) - it does not work with Node.js.
|
|
7
10
|
|
|
8
11
|
```bash
|
|
12
|
+
# Run directly with bunx (no install needed)
|
|
9
13
|
bunx critique
|
|
14
|
+
|
|
15
|
+
# Or install globally
|
|
16
|
+
bun install -g critique
|
|
10
17
|
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
### View Git Diff
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# View unstaged changes (includes untracked files)
|
|
25
|
+
critique
|
|
26
|
+
|
|
27
|
+
# View staged changes
|
|
28
|
+
critique --staged
|
|
29
|
+
|
|
30
|
+
# View a specific commit
|
|
31
|
+
critique --commit HEAD~1
|
|
32
|
+
critique abc1234
|
|
33
|
+
|
|
34
|
+
# Watch mode - auto-refresh on file changes
|
|
35
|
+
critique --watch
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Navigation
|
|
39
|
+
|
|
40
|
+
| Key | Action |
|
|
41
|
+
|-----|--------|
|
|
42
|
+
| `←` / `→` | Navigate between files |
|
|
43
|
+
| `↑` / `↓` | Scroll up/down |
|
|
44
|
+
| `Ctrl+P` | Open file selector dropdown |
|
|
45
|
+
| `Option` (hold) | Fast scroll (10x) |
|
|
46
|
+
| `Esc` | Close dropdown |
|
|
47
|
+
|
|
48
|
+
### Git Difftool Integration
|
|
49
|
+
|
|
50
|
+
Configure critique as your git difftool:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git config --global diff.tool critique
|
|
54
|
+
git config --global difftool.critique.cmd 'critique difftool "$LOCAL" "$REMOTE"'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Then use:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
git difftool HEAD~1
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Pick Files from Another Branch
|
|
64
|
+
|
|
65
|
+
Selectively apply changes from another branch to your current HEAD:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
critique pick feature-branch
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Use the interactive UI to select files. Selected files are immediately applied as patches, deselected files are restored.
|
|
72
|
+
|
|
73
|
+
### Web Preview
|
|
74
|
+
|
|
75
|
+
Generate a shareable web preview of your diff that you can send to anyone - no installation required:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Upload to critique.work and get a shareable URL
|
|
79
|
+
critique web
|
|
80
|
+
|
|
81
|
+
# View staged changes
|
|
82
|
+
critique web --staged
|
|
83
|
+
|
|
84
|
+
# View a specific commit
|
|
85
|
+
critique web --commit HEAD~1
|
|
86
|
+
|
|
87
|
+
# Generate local HTML file instead of uploading
|
|
88
|
+
critique web --local
|
|
89
|
+
|
|
90
|
+
# Adjust rendering size (use ~100 cols for mobile-friendly output)
|
|
91
|
+
critique web --cols 100 --rows 2000
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**How it works:**
|
|
95
|
+
|
|
96
|
+
1. Captures the terminal UI output using a PTY (pseudo-terminal)
|
|
97
|
+
2. Converts ANSI escape codes to styled HTML with syntax highlighting
|
|
98
|
+
3. Uploads the HTML to [critique.work](https://critique.work) (Cloudflare Worker + KV storage)
|
|
99
|
+
4. Returns a shareable URL that expires after 7 days
|
|
100
|
+
5. Automatically opens the preview in your browser
|
|
101
|
+
|
|
102
|
+
**Options:**
|
|
103
|
+
|
|
104
|
+
| Flag | Description | Default |
|
|
105
|
+
|------|-------------|---------|
|
|
106
|
+
| `--staged` | Show staged changes | - |
|
|
107
|
+
| `--commit <ref>` | Show changes from a specific commit | - |
|
|
108
|
+
| `--cols <n>` | Terminal width for rendering | `240` |
|
|
109
|
+
| `--rows <n>` | Terminal height for rendering | `2000` |
|
|
110
|
+
| `--local` | Save HTML locally instead of uploading | - |
|
|
111
|
+
|
|
112
|
+
**Tips:**
|
|
113
|
+
|
|
114
|
+
- Use `--cols 100` for mobile-friendly output (switches to unified diff view instead of split view)
|
|
115
|
+
- The URL is based on a SHA-256 hash of the content, so identical diffs produce the same URL (deduplication)
|
|
116
|
+
- If upload fails, critique automatically saves the HTML locally as a fallback
|
|
117
|
+
|
|
118
|
+
## Features
|
|
119
|
+
|
|
120
|
+
- **Syntax Highlighting** - Powered by [Shiki](https://shiki.style/) with support for 18+ languages
|
|
121
|
+
- **Split View** - Side-by-side comparison for wide terminals (auto-switches to unified view on narrow terminals)
|
|
122
|
+
- **Word-Level Diff** - Highlights specific word changes within modified lines
|
|
123
|
+
- **File Navigation** - Quick file switcher with fuzzy search
|
|
124
|
+
- **Click to Open** - Click line numbers to open in your editor (set `REACT_EDITOR` env var)
|
|
125
|
+
- **Watch Mode** - Live updates as you edit files
|
|
126
|
+
- **Web Preview** - Generate shareable HTML previews hosted on [critique.work](https://critique.work)
|
|
127
|
+
- **Cherry Pick** - Interactive file picker to apply changes from other branches
|
|
128
|
+
|
|
129
|
+
## Supported Languages
|
|
130
|
+
|
|
131
|
+
TypeScript, JavaScript, TSX, JSX, JSON, Markdown, HTML, CSS, Python, Rust, Go, Java, C, C++, YAML, TOML, Bash, SQL
|
|
132
|
+
|
|
133
|
+
## Configuration
|
|
134
|
+
|
|
135
|
+
| Environment Variable | Description | Default |
|
|
136
|
+
|---------------------|-------------|---------|
|
|
137
|
+
| `REACT_EDITOR` | Editor command for click-to-open | `zed` |
|
|
138
|
+
| `CRITIQUE_WORKER_URL` | Custom worker URL for web preview | `https://critique.work` |
|
|
139
|
+
|
|
140
|
+
## Ignored Files
|
|
141
|
+
|
|
142
|
+
Lock files are automatically hidden from diffs:
|
|
143
|
+
- `pnpm-lock.yaml`
|
|
144
|
+
- `package-lock.json`
|
|
145
|
+
- `yarn.lock`
|
|
146
|
+
- `bun.lockb`
|
|
147
|
+
- `Cargo.lock`
|
|
148
|
+
- `poetry.lock`
|
|
149
|
+
- `Gemfile.lock`
|
|
150
|
+
- `composer.lock`
|
|
151
|
+
|
|
152
|
+
Files with more than 6000 lines of diff are also hidden for performance.
|
|
153
|
+
|
|
154
|
+
## Built With
|
|
155
|
+
|
|
156
|
+
- [opentui](https://github.com/sst/opentui) - React-based terminal UI framework
|
|
157
|
+
- [Shiki](https://shiki.style/) - Syntax highlighting
|
|
158
|
+
- [diff](https://github.com/kpdecker/jsdiff) - Diff algorithm
|
|
159
|
+
- [Hono](https://hono.dev/) - Web framework for the preview worker
|
|
160
|
+
|
|
161
|
+
## License
|
|
162
|
+
|
|
163
|
+
MIT
|