difit 1.1.11 → 2.0.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/LICENSE +1 -1
- package/README.md +26 -28
- package/dist/cli/index.js +3 -3
- package/dist/cli/index.test.js +3 -3
- package/dist/client/assets/{index-yWWrztdB.js → index-C2KvF1_C.js} +37 -37
- package/dist/client/assets/{prism-java-DAOTZqUe.js → prism-java-fRxbL3-m.js} +1 -1
- package/dist/client/assets/{prism-php-C8aTiDAp.js → prism-php-CcaSYv4J.js} +1 -1
- package/dist/client/assets/{prism-ruby-BdY0H-La.js → prism-ruby-vYjZ5d92.js} +1 -1
- package/dist/client/assets/prism-solidity-DEbM6fQo.js +1 -0
- package/dist/client/favicon-white.svg +3 -0
- package/dist/client/favicon.svg +3 -0
- package/dist/client/index.html +5 -8
- package/dist/client/logo.png +0 -0
- package/dist/server/git-diff.js +1 -1
- package/dist/server/server.js +2 -2
- package/dist/server/server.test.js +2 -2
- package/dist/tui/components/StatusBar.js +1 -1
- package/package.json +1 -1
- package/dist/client/apple-touch-icon.png +0 -0
- package/dist/client/favicon-16x16.png +0 -0
- package/dist/client/favicon-32x32.png +0 -0
- package/dist/client/favicon.png +0 -0
- package/dist/client/icon-192x192.png +0 -0
- package/dist/client/icon-512x512.png +0 -0
- package/dist/client/reviewit.png +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
<
|
|
2
|
-
<img src="public/logo.png" alt="
|
|
3
|
-
</
|
|
1
|
+
<h1 align="center">
|
|
2
|
+
<img src="public/logo.png" alt="difit" width="260">
|
|
3
|
+
</h1>
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
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! 🚀
|
|
5
|
+
**difit** is a zero-config CLI that launches a GitHub-style diff viewer right on your machine. Review commits in a clean “Files changed” layout, add inline comments, and copy those comments as ready-to-paste AI prompts. Perfect for code review workflows without leaving the terminal! 🚀
|
|
8
6
|
|
|
9
7
|
## ✨ Features
|
|
10
8
|
|
|
11
|
-
- ⚡ **Zero Config**: Just run `npx
|
|
9
|
+
- ⚡ **Zero Config**: Just run `npx difit <commit>` and it works
|
|
12
10
|
- 🌙 **Review for AI**: Add comments and generate Claude Code prompts
|
|
13
11
|
- 🖥️ **Terminal UI**: View diffs directly in terminal with `--tui`
|
|
14
12
|
|
|
15
13
|
## ⚡ Quick Start
|
|
16
14
|
|
|
17
15
|
```bash
|
|
18
|
-
npx
|
|
16
|
+
npx difit # View HEAD commit changes in a beautiful diff viewer
|
|
19
17
|
```
|
|
20
18
|
|
|
21
19
|
## 🚀 Usage
|
|
@@ -23,36 +21,36 @@ npx reviewit # View HEAD commit changes in a beautiful diff viewer
|
|
|
23
21
|
### Basic Usage
|
|
24
22
|
|
|
25
23
|
```bash
|
|
26
|
-
npx
|
|
27
|
-
npx
|
|
28
|
-
npx
|
|
24
|
+
npx difit <commit-ish> # View single commit diff
|
|
25
|
+
npx difit <commit-ish> [compare-with] # Compare two commits/branches
|
|
26
|
+
npx difit --pr <github-pr-url> # Review GitHub pull request
|
|
29
27
|
```
|
|
30
28
|
|
|
31
29
|
### Single commit review
|
|
32
30
|
|
|
33
31
|
```bash
|
|
34
|
-
npx
|
|
35
|
-
npx
|
|
36
|
-
npx
|
|
32
|
+
npx difit 6f4a9b7 # Specific commit
|
|
33
|
+
npx difit HEAD^ # Previous commit
|
|
34
|
+
npx difit feature # Latest commit on branch
|
|
37
35
|
```
|
|
38
36
|
|
|
39
37
|
### Compare two commits
|
|
40
38
|
|
|
41
39
|
```bash
|
|
42
|
-
npx
|
|
43
|
-
npx
|
|
44
|
-
npx
|
|
40
|
+
npx difit HEAD main # Compare HEAD with main branch
|
|
41
|
+
npx difit feature main # Compare branches
|
|
42
|
+
npx difit . origin/main # Compare working directory with remote main
|
|
45
43
|
```
|
|
46
44
|
|
|
47
45
|
### Special Arguments
|
|
48
46
|
|
|
49
|
-
|
|
47
|
+
difit supports special keywords for common diff scenarios:
|
|
50
48
|
|
|
51
49
|
```bash
|
|
52
|
-
npx
|
|
53
|
-
npx
|
|
54
|
-
npx
|
|
55
|
-
npx
|
|
50
|
+
npx difit # HEAD commit changes
|
|
51
|
+
npx difit . # All uncommitted changes (staged + unstaged)
|
|
52
|
+
npx difit staged # Staged changes ready for commit
|
|
53
|
+
npx difit working # Unstaged changes only (cannot use compare-with)
|
|
56
54
|
```
|
|
57
55
|
|
|
58
56
|
| Keyword | Description | Compare-with Support |
|
|
@@ -64,12 +62,12 @@ npx reviewit working # Unstaged changes only (cannot use compare-with)
|
|
|
64
62
|
### GitHub PR
|
|
65
63
|
|
|
66
64
|
```bash
|
|
67
|
-
npx
|
|
65
|
+
npx difit --pr https://github.com/owner/repo/pull/123
|
|
68
66
|
```
|
|
69
67
|
|
|
70
|
-
|
|
68
|
+
difit automatically handles GitHub authentication using:
|
|
71
69
|
|
|
72
|
-
1. **GitHub CLI** (recommended): If you're logged in with `gh auth login`,
|
|
70
|
+
1. **GitHub CLI** (recommended): If you're logged in with `gh auth login`, difit uses your existing credentials
|
|
73
71
|
2. **Environment Variable**: Set `GITHUB_TOKEN` environment variable
|
|
74
72
|
3. **No Authentication**: Public repositories work without authentication (rate-limited)
|
|
75
73
|
|
|
@@ -88,7 +86,7 @@ ReviewIt automatically handles GitHub authentication using:
|
|
|
88
86
|
|
|
89
87
|
## 💬 Comment System
|
|
90
88
|
|
|
91
|
-
|
|
89
|
+
difit includes an inline commenting system that integrates with Claude Code:
|
|
92
90
|
|
|
93
91
|
1. **Add Comments**: Click on any diff line to add a comment
|
|
94
92
|
2. **Edit Comments**: Edit existing comments with the edit button
|
|
@@ -105,7 +103,7 @@ This name should probably be more specific.
|
|
|
105
103
|
|
|
106
104
|
## 🎨 Syntax Highlighting
|
|
107
105
|
|
|
108
|
-
|
|
106
|
+
difit supports syntax highlighting for multiple programming languages with dynamic loading:
|
|
109
107
|
|
|
110
108
|
### Supported Languages
|
|
111
109
|
|
|
@@ -114,7 +112,7 @@ ReviewIt supports syntax highlighting for multiple programming languages with dy
|
|
|
114
112
|
- **Shell Scripts**: `.sh`, `.bash`, `.zsh`, `.fish` files
|
|
115
113
|
- **Backend Languages**: PHP, SQL, Ruby, Java, Scala
|
|
116
114
|
- **Systems Languages**: C, C++, Rust, Go
|
|
117
|
-
- **Others**: Python, Swift, Kotlin, YAML
|
|
115
|
+
- **Others**: Python, Swift, Kotlin, YAML, Solidity
|
|
118
116
|
|
|
119
117
|
### Dynamic Language Loading
|
|
120
118
|
|
package/dist/cli/index.js
CHANGED
|
@@ -10,7 +10,7 @@ function isSpecialArg(arg) {
|
|
|
10
10
|
}
|
|
11
11
|
const program = new Command();
|
|
12
12
|
program
|
|
13
|
-
.name('
|
|
13
|
+
.name('difit')
|
|
14
14
|
.description('A lightweight Git diff viewer with GitHub-like interface')
|
|
15
15
|
.version(pkg.version)
|
|
16
16
|
.argument('[commit-ish]', 'Git commit, tag, branch, HEAD~n reference, or "working"/"staged"/"."', 'HEAD')
|
|
@@ -95,7 +95,7 @@ program
|
|
|
95
95
|
openBrowser: options.open,
|
|
96
96
|
mode: options.mode,
|
|
97
97
|
});
|
|
98
|
-
console.log(`\n🚀
|
|
98
|
+
console.log(`\n🚀 difit server started on ${url}`);
|
|
99
99
|
console.log(`📋 Reviewing: ${targetCommitish}`);
|
|
100
100
|
if (isEmpty) {
|
|
101
101
|
console.log('\n! \x1b[33mNo differences found. Browser will not open automatically.\x1b[0m');
|
|
@@ -108,7 +108,7 @@ program
|
|
|
108
108
|
console.log('💡 Use --open to automatically open browser\n');
|
|
109
109
|
}
|
|
110
110
|
process.on('SIGINT', async () => {
|
|
111
|
-
console.log('\n👋 Shutting down
|
|
111
|
+
console.log('\n👋 Shutting down difit server...');
|
|
112
112
|
// Try to fetch comments before shutting down
|
|
113
113
|
try {
|
|
114
114
|
const response = await fetch(`http://localhost:${port}/api/comments-output`);
|
package/dist/cli/index.test.js
CHANGED
|
@@ -384,7 +384,7 @@ describe('CLI index.ts', () => {
|
|
|
384
384
|
openBrowser: options.open,
|
|
385
385
|
mode: options.mode,
|
|
386
386
|
});
|
|
387
|
-
console.log(`\n🚀
|
|
387
|
+
console.log(`\n🚀 difit server started on ${url}`);
|
|
388
388
|
console.log(`📋 Reviewing: ${commitish}`);
|
|
389
389
|
if (isEmpty) {
|
|
390
390
|
console.log('\n! No differences found. Browser will not open automatically.');
|
|
@@ -398,7 +398,7 @@ describe('CLI index.ts', () => {
|
|
|
398
398
|
}
|
|
399
399
|
});
|
|
400
400
|
await program.parseAsync([], { from: 'user' });
|
|
401
|
-
expect(console.log).toHaveBeenCalledWith('\n🚀
|
|
401
|
+
expect(console.log).toHaveBeenCalledWith('\n🚀 difit server started on http://localhost:3000');
|
|
402
402
|
expect(console.log).toHaveBeenCalledWith('📋 Reviewing: HEAD');
|
|
403
403
|
});
|
|
404
404
|
it('displays correct message when no differences found', async () => {
|
|
@@ -427,7 +427,7 @@ describe('CLI index.ts', () => {
|
|
|
427
427
|
openBrowser: options.open,
|
|
428
428
|
mode: options.mode,
|
|
429
429
|
});
|
|
430
|
-
console.log(`\n🚀
|
|
430
|
+
console.log(`\n🚀 difit server started on ${url}`);
|
|
431
431
|
console.log(`📋 Reviewing: ${commitish}`);
|
|
432
432
|
if (isEmpty) {
|
|
433
433
|
console.log('\n! No differences found. Browser will not open automatically.');
|