difit 0.0.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 +106 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +44 -0
- package/dist/cli/index.test.d.ts +1 -0
- package/dist/cli/index.test.js +676 -0
- package/dist/cli/utils.d.ts +1 -0
- package/dist/cli/utils.js +11 -0
- package/dist/cli/utils.test.d.ts +1 -0
- package/dist/cli/utils.test.js +214 -0
- package/dist/client/assets/index-BUtmfbD2.js +53 -0
- package/dist/client/assets/index-mZRIDsXW.css +1 -0
- package/dist/client/assets/prism-css-Bpx-unsJ.js +1 -0
- package/dist/client/assets/prism-json-xwnKirkR.js +1 -0
- package/dist/client/assets/prism-typescript-B2PMeEx1.js +1 -0
- package/dist/client/index.html +14 -0
- package/dist/server/comment-store.d.ts +13 -0
- package/dist/server/comment-store.js +63 -0
- package/dist/server/git-diff-tui.d.ts +2 -0
- package/dist/server/git-diff-tui.js +95 -0
- package/dist/server/git-diff.d.ts +10 -0
- package/dist/server/git-diff.js +124 -0
- package/dist/server/git-diff.test.d.ts +1 -0
- package/dist/server/git-diff.test.js +292 -0
- package/dist/server/server.d.ts +11 -0
- package/dist/server/server.js +128 -0
- package/dist/server/server.test.d.ts +1 -0
- package/dist/server/server.test.js +382 -0
- package/dist/tui/App.d.ts +8 -0
- package/dist/tui/App.js +92 -0
- package/dist/tui/App.test.d.ts +1 -0
- package/dist/tui/App.test.js +31 -0
- package/dist/tui/components/DiffViewer.d.ts +9 -0
- package/dist/tui/components/DiffViewer.js +88 -0
- package/dist/tui/components/FileList.d.ts +8 -0
- package/dist/tui/components/FileList.js +48 -0
- package/dist/tui/components/SideBySideDiffViewer.d.ts +9 -0
- package/dist/tui/components/SideBySideDiffViewer.js +237 -0
- package/dist/tui/components/StatusBar.d.ts +8 -0
- package/dist/tui/components/StatusBar.js +23 -0
- package/dist/tui/utils/parseDiff.d.ts +2 -0
- package/dist/tui/utils/parseDiff.js +68 -0
- package/dist/types/diff.d.ts +33 -0
- package/dist/types/diff.js +1 -0
- package/dist/utils/fileUtils.d.ts +12 -0
- package/dist/utils/fileUtils.js +21 -0
- package/package.json +91 -0
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# ReviewIt š
|
|
2
|
+
|
|
3
|
+
A lightweight command-line tool that spins up a local web server to display Git commit diffs in a GitHub-like Files changed view. Perfect for code review workflows without leaving the terminal! š
|
|
4
|
+
|
|
5
|
+
## ⨠Features
|
|
6
|
+
|
|
7
|
+
- š **GitHub-like UI**: Familiar dark theme file list and diff interface
|
|
8
|
+
- š¬ **Inline Comments**: Add comments to specific lines and generate Claude Code prompts
|
|
9
|
+
- š **Side-by-Side & Inline Views**: Choose your preferred diff viewing mode
|
|
10
|
+
- ā” **Zero Config**: Just run `npx reviewit <commit>` and it works
|
|
11
|
+
- š **Local Only**: Never exposes data over network - runs on localhost only
|
|
12
|
+
- š ļø **Modern Stack**: React 18 + TypeScript + Tailwind CSS
|
|
13
|
+
|
|
14
|
+
## š¦ Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Global install
|
|
18
|
+
npm install -g reviewit
|
|
19
|
+
|
|
20
|
+
# Or use npx (no installation needed)
|
|
21
|
+
npx reviewit <commit-ish>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## š Usage
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
# Review a specific commit
|
|
28
|
+
reviewit 6f4a9b7
|
|
29
|
+
|
|
30
|
+
# Review HEAD~3
|
|
31
|
+
reviewit HEAD~3
|
|
32
|
+
|
|
33
|
+
# Custom port, don't auto-open browser
|
|
34
|
+
reviewit 6f4a9b7 --port 4300 --no-open
|
|
35
|
+
|
|
36
|
+
# Via npx
|
|
37
|
+
npx reviewit main~1
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### āļø CLI Options
|
|
41
|
+
|
|
42
|
+
| Flag | Default | Description |
|
|
43
|
+
|------|---------|-------------|
|
|
44
|
+
| `<commit-ish>` | (required) | Any Git reference: hash, tag, HEAD~n, branch |
|
|
45
|
+
| `--port` | auto | Preferred port; falls back if occupied |
|
|
46
|
+
| `--no-open` | false | Don't automatically open browser |
|
|
47
|
+
| `--mode` | side-by-side | Diff mode: `inline` or `side-by-side` |
|
|
48
|
+
|
|
49
|
+
## š ļø Development
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
# Install dependencies
|
|
53
|
+
pnpm install
|
|
54
|
+
|
|
55
|
+
# Start development server
|
|
56
|
+
pnpm run dev
|
|
57
|
+
|
|
58
|
+
# Build for production
|
|
59
|
+
pnpm run build
|
|
60
|
+
|
|
61
|
+
# Run tests
|
|
62
|
+
pnpm test
|
|
63
|
+
|
|
64
|
+
# Lint and format
|
|
65
|
+
pnpm run lint
|
|
66
|
+
pnpm run format
|
|
67
|
+
pnpm run typecheck
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## š¬ Comment System
|
|
71
|
+
|
|
72
|
+
ReviewIt includes an inline commenting system that integrates with Claude Code:
|
|
73
|
+
|
|
74
|
+
1.ļø **Add Comments**: Click the š¬ icon on any diff line to add a comment
|
|
75
|
+
2. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for Claude Code
|
|
76
|
+
3. **Persistent Storage**: Comments are saved in `.reviewit/tmp-comments-*.json` for the session
|
|
77
|
+
|
|
78
|
+
### Comment Prompt Format
|
|
79
|
+
|
|
80
|
+
```
|
|
81
|
+
š src/components/Button.tsx L42
|
|
82
|
+
----
|
|
83
|
+
+ const handleClick = () => {
|
|
84
|
+
+ onClick();
|
|
85
|
+
+ };
|
|
86
|
+
----
|
|
87
|
+
Comment: "This function name could be more specific"
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## šļø Architecture
|
|
91
|
+
|
|
92
|
+
- **CLI**: Commander.js for argument parsing
|
|
93
|
+
- **Backend**: Express server with simple-git for diff processing
|
|
94
|
+
- **Frontend**: React 18 + TypeScript + Vite
|
|
95
|
+
- **Styling**: Tailwind CSS v4 with GitHub-like dark theme
|
|
96
|
+
- **Testing**: Vitest for unit tests
|
|
97
|
+
- **Quality**: ESLint, Prettier, lefthook pre-commit hooks
|
|
98
|
+
|
|
99
|
+
## š Requirements
|
|
100
|
+
|
|
101
|
+
- Node.js ā„ 18.0.0
|
|
102
|
+
- Git repository with commits to review
|
|
103
|
+
|
|
104
|
+
## š License
|
|
105
|
+
|
|
106
|
+
MIT š
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from 'commander';
|
|
3
|
+
import { startServer } from '../server/server.js';
|
|
4
|
+
import { validateCommitish } from './utils.js';
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program
|
|
7
|
+
.name('reviewit')
|
|
8
|
+
.description('A lightweight Git diff viewer with GitHub-like interface')
|
|
9
|
+
.version('0.1.0')
|
|
10
|
+
.argument('<commit-ish>', 'Git commit, tag, branch, or HEAD~n reference')
|
|
11
|
+
.option('--port <port>', 'preferred port (auto-assigned if occupied)', parseInt)
|
|
12
|
+
.option('--no-open', 'do not automatically open browser')
|
|
13
|
+
.option('--mode <mode>', 'diff mode (inline only for now)', 'inline')
|
|
14
|
+
.action(async (commitish, options) => {
|
|
15
|
+
try {
|
|
16
|
+
if (!validateCommitish(commitish)) {
|
|
17
|
+
console.error('Error: Invalid commit-ish format');
|
|
18
|
+
process.exit(1);
|
|
19
|
+
}
|
|
20
|
+
const { url } = await startServer({
|
|
21
|
+
commitish,
|
|
22
|
+
preferredPort: options.port,
|
|
23
|
+
openBrowser: options.open,
|
|
24
|
+
mode: options.mode,
|
|
25
|
+
});
|
|
26
|
+
console.log(`\nš ReviewIt server started on ${url}`);
|
|
27
|
+
console.log(`š Reviewing: ${commitish}`);
|
|
28
|
+
if (options.open) {
|
|
29
|
+
console.log('š Opening browser...\n');
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
console.log('š” Use --open to automatically open browser\n');
|
|
33
|
+
}
|
|
34
|
+
process.on('SIGINT', () => {
|
|
35
|
+
console.log('\nš Shutting down ReviewIt server...');
|
|
36
|
+
process.exit(0);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
console.error('Error:', error instanceof Error ? error.message : 'Unknown error');
|
|
41
|
+
process.exit(1);
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
program.parse();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|