difit 1.0.7 ā 1.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/README.md +75 -39
- package/dist/cli/index.js +31 -4
- package/dist/cli/utils.js +2 -2
- package/dist/client/assets/{index-CpfKzjSE.js ā index-B67TY4_1.js} +39 -39
- package/dist/client/assets/index-BHrhjAlZ.css +1 -0
- package/dist/client/assets/prism-bash-DTkDXsAh.js +1 -0
- package/dist/client/assets/prism-java-Bz0cy7o8.js +1 -0
- package/dist/client/assets/prism-markup-templating-Ct1xsyfA.js +1 -0
- package/dist/client/assets/prism-php-Y_bwvUTe.js +1 -0
- package/dist/client/assets/prism-ruby-pgU1Zfy6.js +1 -0
- package/dist/client/assets/prism-sql-AgAyy5H_.js +1 -0
- package/dist/client/index.html +2 -2
- package/dist/client/logo.png +0 -0
- package/dist/server/git-diff-tui.d.ts +1 -1
- package/dist/server/git-diff-tui.js +23 -38
- package/dist/server/git-diff.js +14 -4
- package/dist/tui/App.d.ts +1 -3
- package/dist/tui/App.js +10 -10
- package/dist/tui/components/StatusBar.d.ts +1 -1
- package/dist/tui/components/StatusBar.js +1 -1
- package/dist/types/diff.d.ts +11 -1
- package/package.json +3 -2
- package/dist/client/assets/index-CpclbaYk.css +0 -1
package/README.md
CHANGED
|
@@ -11,51 +11,104 @@ A lightweight command-line tool that spins up a local web server to display Git
|
|
|
11
11
|
- š **GitHub-like UI**: Familiar dark theme file list and diff interface
|
|
12
12
|
- š¬ **Inline Comments**: Add comments to specific lines and generate Claude Code prompts
|
|
13
13
|
- š **Side-by-Side & Inline Views**: Choose your preferred diff viewing mode
|
|
14
|
+
- š„ļø **Terminal UI Mode**: View diffs directly in your terminal with `--tui` flag
|
|
14
15
|
- ā” **Zero Config**: Just run `npx reviewit <commit>` and it works
|
|
15
16
|
- š **Local Only**: Never exposes data over network - runs on localhost only
|
|
16
17
|
- š ļø **Modern Stack**: React 18 + TypeScript + Tailwind CSS
|
|
18
|
+
- šØ **Syntax Highlighting**: Dynamic language loading for Bash, PHP, SQL, Ruby, Java, and more
|
|
17
19
|
- ⨠**100% vibe coding**: Built with pure coding energy and good vibes
|
|
18
20
|
|
|
19
21
|
## š¦ Installation
|
|
20
22
|
|
|
21
23
|
```bash
|
|
22
|
-
#
|
|
23
|
-
npm install -g reviewit
|
|
24
|
-
|
|
25
|
-
# Or use npx (no installation needed)
|
|
24
|
+
# use npx (no installation needed)
|
|
26
25
|
npx reviewit <commit-ish>
|
|
26
|
+
|
|
27
|
+
# or Global install
|
|
28
|
+
npm install -g reviewit
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
## š Usage
|
|
30
32
|
|
|
31
33
|
```bash
|
|
32
|
-
#
|
|
33
|
-
reviewit
|
|
34
|
+
# default: HEAD commit changes
|
|
35
|
+
npx reviewit
|
|
34
36
|
|
|
35
|
-
# Review
|
|
36
|
-
reviewit
|
|
37
|
+
# Review a specific commit changes
|
|
38
|
+
npx reviewit 6f4a9b7
|
|
39
|
+
npx reviewit HEAD^
|
|
40
|
+
npx reviewit HEAD~3
|
|
37
41
|
|
|
38
|
-
#
|
|
39
|
-
reviewit
|
|
42
|
+
# Special Arguments
|
|
43
|
+
npx reviewit staging # staging area changes
|
|
44
|
+
npx reviewit working # working directory changes
|
|
45
|
+
npx reviewit . # uncommited all changes
|
|
40
46
|
|
|
41
47
|
# Custom port, don't auto-open browser
|
|
42
|
-
reviewit 6f4a9b7 --port 4300 --no-open
|
|
48
|
+
npx reviewit 6f4a9b7 --port 4300 --no-open
|
|
43
49
|
|
|
44
|
-
#
|
|
45
|
-
npx reviewit
|
|
46
|
-
npx reviewit
|
|
50
|
+
# Terminal UI mode (no browser)
|
|
51
|
+
npx reviewit --tui
|
|
52
|
+
npx reviewit working --tui
|
|
47
53
|
```
|
|
48
54
|
|
|
49
55
|
### āļø CLI Options
|
|
50
56
|
|
|
51
|
-
| Flag | Default
|
|
52
|
-
| -------------- |
|
|
53
|
-
| `<commit-ish>` | (required)
|
|
54
|
-
| `--port` | auto
|
|
55
|
-
| `--no-open` | false
|
|
56
|
-
| `--mode` |
|
|
57
|
+
| Flag | Default | Description |
|
|
58
|
+
| -------------- | ------------ | ------------------------------------------------------------------ |
|
|
59
|
+
| `<commit-ish>` | (required) | Any Git reference: hash, tag, HEAD~n, branch, or Special Arguments |
|
|
60
|
+
| `--port` | auto | Preferred port; falls back if occupied |
|
|
61
|
+
| `--no-open` | false | Don't automatically open browser |
|
|
62
|
+
| `--mode` | side-by-side | Diff mode: `inline` or `side-by-side` |
|
|
63
|
+
| `--tui` | false | Use terminal UI mode instead of web interface |
|
|
64
|
+
|
|
65
|
+
### š Special Arguments
|
|
66
|
+
|
|
67
|
+
ReviewIt supports special arguments for common diff scenarios:
|
|
68
|
+
|
|
69
|
+
| Keyword | Description |
|
|
70
|
+
| --------- | ------------------------------------------------------ |
|
|
71
|
+
| `working` | Shows unstaged changes in your working directory |
|
|
72
|
+
| `staged` | Shows staged changes ready to be committed |
|
|
73
|
+
| `.` | Shows all uncommitted changes (both staged & unstaged) |
|
|
74
|
+
|
|
75
|
+
## š¬ Comment System
|
|
76
|
+
|
|
77
|
+
ReviewIt includes an inline commenting system that integrates with Claude Code:
|
|
78
|
+
|
|
79
|
+
1. **Add Comments**: Click on any diff line to add a comment
|
|
80
|
+
2. **Edit Comments**: Edit existing comments with the edit button
|
|
81
|
+
3. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for Claude Code
|
|
82
|
+
4. **Copy All**: Use "Copy All Prompt" to copy all comments in a structured format
|
|
83
|
+
5. **Persistent Storage**: Comments are saved in browser localStorage per commit
|
|
84
|
+
|
|
85
|
+
### Comment Prompt Format
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
File: src/components/Button.tsx
|
|
89
|
+
Line: 42
|
|
90
|
+
Comment: This function name should probably be more specific
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## šØ Syntax Highlighting
|
|
94
|
+
|
|
95
|
+
ReviewIt supports syntax highlighting for multiple programming languages with dynamic loading:
|
|
96
|
+
|
|
97
|
+
### Supported Languages
|
|
98
|
+
|
|
99
|
+
- **JavaScript/TypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`
|
|
100
|
+
- **Web Technologies**: HTML, CSS, JSON, XML, Markdown
|
|
101
|
+
- **Shell Scripts**: `.sh`, `.bash`, `.zsh`, `.fish` files
|
|
102
|
+
- **Backend Languages**: PHP, SQL, Ruby, Java
|
|
103
|
+
- **Systems Languages**: C, C++, Rust, Go
|
|
104
|
+
- **Others**: Python, Swift, Kotlin, YAML
|
|
105
|
+
|
|
106
|
+
### Dynamic Language Loading
|
|
57
107
|
|
|
58
|
-
|
|
108
|
+
- Languages are loaded on-demand for better performance
|
|
109
|
+
- Automatic language detection from file extensions
|
|
110
|
+
- Fallback to plain text for unsupported languages
|
|
111
|
+
- Safe dependency resolution (e.g., PHP requires markup-templating)
|
|
59
112
|
|
|
60
113
|
## š ļø Development
|
|
61
114
|
|
|
@@ -94,30 +147,13 @@ pnpm run typecheck
|
|
|
94
147
|
- **Development mode**: Uses Vite's dev server for hot reload and fast development
|
|
95
148
|
- **Production mode**: Serves built static files (used by npx and production builds)
|
|
96
149
|
|
|
97
|
-
## š¬ Comment System
|
|
98
|
-
|
|
99
|
-
ReviewIt includes an inline commenting system that integrates with Claude Code:
|
|
100
|
-
|
|
101
|
-
1. **Add Comments**: Click on any diff line to add a comment
|
|
102
|
-
2. **Edit Comments**: Edit existing comments with the edit button
|
|
103
|
-
3. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for Claude Code
|
|
104
|
-
4. **Copy All**: Use "Copy All Prompt" to copy all comments in a structured format
|
|
105
|
-
5. **Persistent Storage**: Comments are saved in browser localStorage per commit
|
|
106
|
-
|
|
107
|
-
### Comment Prompt Format
|
|
108
|
-
|
|
109
|
-
```
|
|
110
|
-
File: src/components/Button.tsx
|
|
111
|
-
Line: 42
|
|
112
|
-
Comment: This function name should probably be more specific
|
|
113
|
-
```
|
|
114
|
-
|
|
115
150
|
## šļø Architecture
|
|
116
151
|
|
|
117
152
|
- **CLI**: Commander.js for argument parsing
|
|
118
153
|
- **Backend**: Express server with simple-git for diff processing
|
|
119
154
|
- **Frontend**: React 18 + TypeScript + Vite
|
|
120
155
|
- **Styling**: Tailwind CSS v4 with GitHub-like dark theme
|
|
156
|
+
- **Syntax Highlighting**: Prism.js with dynamic language loading
|
|
121
157
|
- **Testing**: Vitest for unit tests
|
|
122
158
|
- **Quality**: ESLint, Prettier, lefthook pre-commit hooks
|
|
123
159
|
|
package/dist/cli/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import React from 'react';
|
|
3
4
|
import pkg from '../../package.json' with { type: 'json' };
|
|
4
5
|
import { startServer } from '../server/server.js';
|
|
5
6
|
import { validateCommitish } from './utils.js';
|
|
@@ -8,24 +9,50 @@ program
|
|
|
8
9
|
.name('reviewit')
|
|
9
10
|
.description('A lightweight Git diff viewer with GitHub-like interface')
|
|
10
11
|
.version(pkg.version)
|
|
11
|
-
.argument('[commit-ish]', 'Git commit, tag, branch,
|
|
12
|
+
.argument('[commit-ish]', 'Git commit, tag, branch, HEAD~n reference, or "working"/"staged"/"." (default: HEAD)', 'HEAD')
|
|
12
13
|
.option('--port <port>', 'preferred port (auto-assigned if occupied)', parseInt)
|
|
13
14
|
.option('--no-open', 'do not automatically open browser')
|
|
14
15
|
.option('--mode <mode>', 'diff mode (inline only for now)', 'inline')
|
|
16
|
+
.option('--tui', 'use terminal UI instead of web interface')
|
|
15
17
|
.action(async (commitish, options) => {
|
|
16
18
|
try {
|
|
17
|
-
|
|
19
|
+
// Determine what to show
|
|
20
|
+
let targetCommitish = commitish;
|
|
21
|
+
// Handle special arguments
|
|
22
|
+
if (commitish === 'working') {
|
|
23
|
+
targetCommitish = 'working';
|
|
24
|
+
}
|
|
25
|
+
else if (commitish === 'staged') {
|
|
26
|
+
targetCommitish = 'staged';
|
|
27
|
+
}
|
|
28
|
+
else if (commitish === '.') {
|
|
29
|
+
targetCommitish = '.';
|
|
30
|
+
}
|
|
31
|
+
if (options.tui) {
|
|
32
|
+
// Check if we're in a TTY environment
|
|
33
|
+
if (!process.stdin.isTTY) {
|
|
34
|
+
console.error('Error: TUI mode requires an interactive terminal (TTY).');
|
|
35
|
+
console.error('Try running the command directly in your terminal without piping.');
|
|
36
|
+
process.exit(1);
|
|
37
|
+
}
|
|
38
|
+
// Dynamic import for TUI mode
|
|
39
|
+
const { render } = await import('ink');
|
|
40
|
+
const { default: TuiApp } = await import('../tui/App.js');
|
|
41
|
+
render(React.createElement(TuiApp, { commitish: targetCommitish }));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
if (!validateCommitish(targetCommitish)) {
|
|
18
45
|
console.error('Error: Invalid commit-ish format');
|
|
19
46
|
process.exit(1);
|
|
20
47
|
}
|
|
21
48
|
const { url } = await startServer({
|
|
22
|
-
commitish,
|
|
49
|
+
commitish: targetCommitish,
|
|
23
50
|
preferredPort: options.port,
|
|
24
51
|
openBrowser: options.open,
|
|
25
52
|
mode: options.mode,
|
|
26
53
|
});
|
|
27
54
|
console.log(`\nš ReviewIt server started on ${url}`);
|
|
28
|
-
console.log(`š Reviewing: ${
|
|
55
|
+
console.log(`š Reviewing: ${targetCommitish}`);
|
|
29
56
|
if (options.open) {
|
|
30
57
|
console.log('š Opening browser...\n');
|
|
31
58
|
}
|
package/dist/cli/utils.js
CHANGED
|
@@ -10,8 +10,8 @@ export function validateCommitish(commitish) {
|
|
|
10
10
|
if (trimmed === 'HEAD~') {
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
-
if (trimmed === '.') {
|
|
14
|
-
return true; // Allow
|
|
13
|
+
if (trimmed === '.' || trimmed === 'working' || trimmed === 'staged') {
|
|
14
|
+
return true; // Allow special keywords for working directory and staging area diff
|
|
15
15
|
}
|
|
16
16
|
const validPatterns = [
|
|
17
17
|
/^[a-f0-9]{4,40}$/i, // SHA hashes
|