difit 2.0.10 → 2.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 (32) hide show
  1. package/README.ja.md +192 -0
  2. package/README.ko.md +192 -0
  3. package/README.md +61 -44
  4. package/README.zh.md +192 -0
  5. package/dist/cli/index.js +50 -0
  6. package/dist/cli/index.test.js +141 -12
  7. package/dist/cli/utils.js +18 -3
  8. package/dist/cli/utils.test.js +10 -1
  9. package/dist/client/assets/index-BtavrLIu.css +1 -0
  10. package/dist/client/assets/index-Bx2n4Aep.js +210 -0
  11. package/dist/client/assets/{prism-csharp-68c6WkNx.js → prism-csharp-BTkEzOdP.js} +1 -1
  12. package/dist/client/assets/{prism-java-C8EIlB8E.js → prism-java-B6gV82l4.js} +1 -1
  13. package/dist/client/assets/{prism-php-DHZyM8JV.js → prism-php-gnpy0VQF.js} +1 -1
  14. package/dist/client/assets/prism-protobuf-DiQ_z8B5.js +1 -0
  15. package/dist/client/assets/{prism-ruby-MnFNFfyf.js → prism-ruby-CMkpRodx.js} +1 -1
  16. package/dist/client/assets/{prism-solidity-CIeB0O-m.js → prism-solidity-BDXCWkss.js} +1 -1
  17. package/dist/client/index.html +2 -2
  18. package/dist/server/file-watcher.d.ts +23 -0
  19. package/dist/server/file-watcher.js +236 -0
  20. package/dist/server/file-watcher.test.d.ts +1 -0
  21. package/dist/server/file-watcher.test.js +225 -0
  22. package/dist/server/git-diff.d.ts +2 -0
  23. package/dist/server/git-diff.js +47 -4
  24. package/dist/server/git-diff.test.js +209 -0
  25. package/dist/server/server.d.ts +5 -2
  26. package/dist/server/server.js +66 -16
  27. package/dist/server/server.test.js +3 -3
  28. package/dist/types/watch.d.ts +30 -0
  29. package/dist/types/watch.js +8 -0
  30. package/package.json +3 -2
  31. package/dist/client/assets/index-DMBW6MaM.css +0 -1
  32. package/dist/client/assets/index-EuLpHPLj.js +0 -200
package/README.ja.md ADDED
@@ -0,0 +1,192 @@
1
+ <h1 align="center">
2
+ <img src="public/logo.png" alt="difit" width="260">
3
+ </h1>
4
+
5
+ <p align="center">
6
+ <a href="./README.md">English</a> | 日本語 | <a href="./README.zh.md">简体中文</a> | <a href="./README.ko.md">한국어</a>
7
+ </p>
8
+
9
+ **difit**は、ローカルのgit上にある差分をGitHub風のビューアで閲覧・レビューできるCLIツールです。見やすい表示に加え、コメントはAIへのプロンプトとしてコピーできます。AI時代のローカルコードレビューツール!
10
+
11
+ ## ✨ 機能
12
+
13
+ - ⚡ **Zero Config**: `npx difit` を実行するだけ
14
+ - 💬 **ローカルレビュー**: 差分にコメントをつけて、AI向けにファイルパス・行番号つきでコピー
15
+ - 🖥️ **WebUI/TerminalUI**: ブラウザで見るWeb UIの他、ターミナルのまま閲覧できる `--tui` も
16
+
17
+ ## ⚡ クイックスタート
18
+
19
+ ```bash
20
+ npx difit # 最新コミットのdiffをWebUIで表示
21
+ ```
22
+
23
+ ## 🚀 使い方
24
+
25
+ ### 基本的な使い方
26
+
27
+ ```bash
28
+ npx difit <target> # 単一コミットのdiffを表示
29
+ npx difit <target> [compare-with] # 2つのコミット/ブランチを比較
30
+ npx difit --pr <github-pr-url> # GitHubプルリクエストをレビュー
31
+ ```
32
+
33
+ ### 単一コミットのレビュー
34
+
35
+ ```bash
36
+ npx difit # HEAD(最新)のコミット
37
+ npx difit 6f4a9b7 # 特定のコミット
38
+ npx difit feature # featureブランチの最新コミット
39
+ ```
40
+
41
+ ### 2つのコミットを比較
42
+
43
+ ```bash
44
+ npx difit @ main # mainブランチと比較(@はHEADのエイリアス)
45
+ npx difit feature main # ブランチ間を比較
46
+ npx difit . origin/main # 作業ディレクトリとリモートmainを比較
47
+ ```
48
+
49
+ ### 特別な引数
50
+
51
+ difitは一般的なdiffシナリオ用の特別なキーワードをサポートしています:
52
+
53
+ ```bash
54
+ npx difit . # すべての未コミット差分(ステージングエリア + 未ステージ)
55
+ npx difit staged # ステージングエリアの差分
56
+ npx difit working # 未ステージ差分のみ
57
+ ```
58
+
59
+ ### GitHub PR
60
+
61
+ ```bash
62
+ npx difit --pr https://github.com/owner/repo/pull/123
63
+ ```
64
+
65
+ difitは以下の方法でGitHub認証を自動的に処理します:
66
+
67
+ 1. **GitHub CLI**(推奨):`gh auth login`でログイン済みの場合、既存の認証情報を使用
68
+ 2. **環境変数**:`GITHUB_TOKEN`環境変数を設定
69
+ 3. **認証なし**:パブリックリポジトリは認証なしで動作(レート制限あり)
70
+
71
+ #### GitHub Enterprise Server
72
+
73
+ Enterprise ServerのPRを表示する場合、あなたのEnterprise Serverインスタンスで生成されたトークンを設定する必要があります:
74
+
75
+ 1. `https://YOUR-ENTERPRISE-SERVER/settings/tokens`にアクセス
76
+ 2. 適切なスコープでパーソナルアクセストークンを生成
77
+ 3. `GITHUB_TOKEN`環境変数として設定
78
+
79
+ ### 標準入力
80
+
81
+ パイプを使用して標準入力経由で統一diff形式を渡すことで、任意のツールからのdiffをdifitで表示できます。
82
+
83
+ ```bash
84
+ # 他のツールからのdiffを表示
85
+ diff -u file1.txt file2.txt | npx difit
86
+
87
+ # 保存されたパッチをレビュー
88
+ cat changes.patch | npx difit
89
+
90
+ # マージベースとの比較
91
+ git diff --merge-base main feature | npx difit
92
+ ```
93
+
94
+ ## ⚙️ CLIオプション
95
+
96
+ | フラグ | デフォルト | 説明 |
97
+ | ---------------- | ------------ | --------------------------------------------------------------------------------- |
98
+ | `<target>` | HEAD | コミットハッシュ、タグ、HEAD~n、ブランチ、または特別な引数 |
99
+ | `[compare-with]` | - | 比較対象の2番目のコミット(2つの間のdiffを表示) |
100
+ | `--pr <url>` | - | レビューするGitHub PRのURL(例:https://github.com/owner/repo/pull/123) |
101
+ | `--port` | 4966 | 優先ポート。使用中の場合は+1にフォールバック |
102
+ | `--host` | 127.0.0.1 | サーバーをバインドするホストアドレス(外部からアクセスしたい場合は0.0.0.0を指定) |
103
+ | `--no-open` | false | ブラウザを自動的に開かない |
104
+ | `--mode` | side-by-side | 表示モード。inline`または`side-by-side` |
105
+ | `--tui` | false | WebUIの代わりにターミナルUIを使用 |
106
+ | `--clean` | false | 起動時にすべての既存コメントをクリア |
107
+
108
+ ## 💬 コメントシステム
109
+
110
+ difitにはAIコーディングエージェントへフィードバックしやすいレビューコメントシステムが含まれています:
111
+
112
+ 1. **コメント追加**:diffの任意の行のコメントボタンをクリック or 範囲ドラッグしてコメントを追加
113
+ 2. **コメント編集**:編集ボタンで既存のコメントを編集
114
+ 3. **プロンプト生成**:コメントには、AIコーディングエージェント用にコンテキストをフォーマットする「Copy Prompt」ボタンが含まれます
115
+ 4. **すべてコピー**:「Copy All Prompt」を使用して、すべてのコメントを構造化された形式でコピー
116
+ 5. **永続的な保存**:コメントはコミットごとにブラウザのlocalStorageに保存されます
117
+
118
+ ### コメントプロンプトフォーマット
119
+
120
+ ```sh
121
+ src/components/Button.tsx:L42 # この行が自動的に追加されます
122
+ ここの変数名をもっとわかりやすくして
123
+ ```
124
+
125
+ 範囲指定した場合
126
+
127
+ ```sh
128
+ src/components/Button.tsx:L42-L48 # この行が自動的に追加されます
129
+ この部分は不要です
130
+ ```
131
+
132
+ ## 🎨 シンタックスハイライト対応言語
133
+
134
+ - **JavaScript/TypeScript**:`.js`、`.jsx`、`.ts`、`.tsx`
135
+ - **Web技術**:HTML、CSS、JSON、XML、Markdown
136
+ - **シェルスクリプト**:`.sh`、`.bash`、`.zsh`、`.fish`
137
+ - **バックエンド言語**:PHP、SQL、Ruby、Java、Scala
138
+ - **システム言語**:C、C++、C#、Rust、Go
139
+ - **モバイル言語**:Swift、Kotlin、Dart
140
+ - **その他**:Python、YAML、Solidity、Vimスクリプト
141
+
142
+ ## 🛠️ 開発
143
+
144
+ ```bash
145
+ # 依存関係のインストール
146
+ pnpm install
147
+
148
+ # 開発サーバーの起動(ホットリロード付き)
149
+ # これはViteの開発サーバーとCLIの両方をNODE_ENV=developmentで実行します
150
+ pnpm run dev
151
+
152
+ # プロダクションビルドとサーバーの起動
153
+ pnpm run start <target>
154
+
155
+ # プロダクション用ビルド
156
+ pnpm run build
157
+
158
+ # テストの実行
159
+ pnpm test
160
+
161
+ # リントとフォーマット
162
+ pnpm run lint
163
+ pnpm run format
164
+ pnpm run typecheck
165
+ ```
166
+
167
+ ### 開発ワークフロー
168
+
169
+ - **`pnpm run dev`**:Vite開発サーバー(ホットリロード付き)とCLIサーバーを同時に起動
170
+ - **`pnpm run start <target>`**:すべてをビルドしてプロダクションサーバーを起動(最終ビルドのテスト用)
171
+ - **開発モード**:ホットリロードと高速開発のためにViteの開発サーバーを使用
172
+ - **プロダクションモード**:ビルド済みの静的ファイルを提供(npxとプロダクションビルドで使用)
173
+
174
+ ## 🏗️ アーキテクチャ
175
+
176
+ - **CLI**:包括的なバリデーションを備えたCommander.jsでの引数解析
177
+ - **バックエンド**:diff処理用のsimple-gitを備えたExpressサーバー
178
+ - **GitHub統合**:自動認証(GitHub CLI + 環境変数)を備えたOctokitでのGitHub API
179
+ - **フロントエンド**:React 18 + TypeScript + Vite
180
+ - **スタイリング**:GitHubライクなダークテーマを備えたTailwind CSS v4
181
+ - **シンタックスハイライト**:動的言語ロードを備えたPrism.js
182
+ - **テスト**:同じ場所に配置されたテストファイルを使用したVitestユニットテスト
183
+ - **品質**:ESLint、Prettier、lefthookプリコミットフック
184
+
185
+ ## 📋 要件
186
+
187
+ - Node.js ≥ 21.0.0
188
+ - レビューするコミットを含むGitリポジトリ
189
+
190
+ ## 📄 ライセンス
191
+
192
+ MIT
package/README.ko.md ADDED
@@ -0,0 +1,192 @@
1
+ <h1 align="center">
2
+ <img src="public/logo.png" alt="difit" width="260">
3
+ </h1>
4
+
5
+ <p align="center">
6
+ <a href="./README.md">English</a> | <a href="./README.ja.md">日本語</a> | <a href="./README.zh.md">简体中文</a> | 한국어
7
+ </p>
8
+
9
+ **difit**은 GitHub 스타일 뷰어로 로컬 git diff를 보고 검토할 수 있는 CLI 도구입니다. 깔끔한 시각적 효과와 함께 코멘트를 AI용 프롬프트로 복사할 수 있습니다. AI 시대의 로컬 코드 리뷰 도구!
10
+
11
+ ## ✨ 기능
12
+
13
+ - ⚡ **제로 설정**: `npx difit`만 실행하면 작동
14
+ - 💬 **로컬 리뷰**: diff에 코멘트를 추가하고 파일 경로와 줄 번호와 함께 AI용으로 복사
15
+ - 🖥️ **WebUI/터미널UI**: 브라우저의 Web UI 또는 `--tui`로 터미널에서 사용
16
+
17
+ ## ⚡ 빠른 시작
18
+
19
+ ```bash
20
+ npx difit # WebUI에서 최신 커밋 diff 보기
21
+ ```
22
+
23
+ ## 🚀 사용법
24
+
25
+ ### 기본 사용법
26
+
27
+ ```bash
28
+ npx difit <target> # 단일 커밋 diff 보기
29
+ npx difit <target> [compare-with] # 두 커밋/브랜치 비교
30
+ npx difit --pr <github-pr-url> # GitHub 풀 리퀘스트 검토
31
+ ```
32
+
33
+ ### 단일 커밋 검토
34
+
35
+ ```bash
36
+ npx difit # HEAD (최신) 커밋
37
+ npx difit 6f4a9b7 # 특정 커밋
38
+ npx difit feature # feature 브랜치의 최신 커밋
39
+ ```
40
+
41
+ ### 두 커밋 비교
42
+
43
+ ```bash
44
+ npx difit @ main # main 브랜치와 비교 (@는 HEAD의 별칭)
45
+ npx difit feature main # 브랜치 간 비교
46
+ npx difit . origin/main # 작업 디렉토리와 원격 main 비교
47
+ ```
48
+
49
+ ### 특수 인수
50
+
51
+ difit은 일반적인 diff 시나리오를 위한 특수 키워드를 지원합니다:
52
+
53
+ ```bash
54
+ npx difit . # 모든 커밋되지 않은 변경 사항 (스테이징 영역 + 미스테이징)
55
+ npx difit staged # 스테이징 영역 변경 사항
56
+ npx difit working # 미스테이징 변경 사항만
57
+ ```
58
+
59
+ ### GitHub PR
60
+
61
+ ```bash
62
+ npx difit --pr https://github.com/owner/repo/pull/123
63
+ ```
64
+
65
+ difit은 다음 방법으로 GitHub 인증을 자동으로 처리합니다:
66
+
67
+ 1. **GitHub CLI** (권장): `gh auth login`으로 로그인한 경우 기존 자격 증명 사용
68
+ 2. **환경 변수**: `GITHUB_TOKEN` 환경 변수 설정
69
+ 3. **인증 없음**: 공개 저장소는 인증 없이 작동 (속도 제한 있음)
70
+
71
+ #### GitHub Enterprise Server
72
+
73
+ Enterprise Server PR의 경우 귀하의 Enterprise Server 인스턴스에서 생성된 토큰을 설정해야 합니다:
74
+
75
+ 1. `https://YOUR-ENTERPRISE-SERVER/settings/tokens`로 이동
76
+ 2. 적절한 범위로 개인 액세스 토큰 생성
77
+ 3. `GITHUB_TOKEN` 환경 변수로 설정
78
+
79
+ ### 표준 입력
80
+
81
+ 파이프를 사용하여 표준 입력을 통해 통합 diff를 전달하면 모든 도구의 diff를 difit으로 볼 수 있습니다.
82
+
83
+ ```bash
84
+ # 다른 도구의 diff 보기
85
+ diff -u file1.txt file2.txt | npx difit
86
+
87
+ # 저장된 패치 검토
88
+ cat changes.patch | npx difit
89
+
90
+ # 머지 베이스와 비교
91
+ git diff --merge-base main feature | npx difit
92
+ ```
93
+
94
+ ## ⚙️ CLI 옵션
95
+
96
+ | 플래그 | 기본값 | 설명 |
97
+ | ---------------- | ------------ | ----------------------------------------------------------------- |
98
+ | `<target>` | HEAD | 커밋 해시, 태그, HEAD~n, 브랜치 또는 특수 인수 |
99
+ | `[compare-with]` | - | 비교할 선택적 두 번째 커밋 (둘 사이의 diff 표시) |
100
+ | `--pr <url>` | - | 검토할 GitHub PR URL (예: https://github.com/owner/repo/pull/123) |
101
+ | `--port` | 4966 | 선호 포트; 사용 중인 경우 +1로 대체 |
102
+ | `--host` | 127.0.0.1 | 서버를 바인딩할 호스트 주소 (외부 액세스는 0.0.0.0 사용) |
103
+ | `--no-open` | false | 브라우저를 자동으로 열지 않음 |
104
+ | `--mode` | side-by-side | 표시 모드: `inline` 또는 `side-by-side` |
105
+ | `--tui` | false | WebUI 대신 터미널 UI 모드 사용 |
106
+ | `--clean` | false | 시작 시 모든 기존 코멘트 지우기 |
107
+
108
+ ## 💬 코멘트 시스템
109
+
110
+ difit은 AI 코딩 에이전트에 피드백을 쉽게 제공할 수 있는 리뷰 코멘트 시스템을 포함합니다:
111
+
112
+ 1. **코멘트 추가**: diff 줄의 코멘트 버튼을 클릭하거나 드래그하여 범위 선택
113
+ 2. **코멘트 편집**: 편집 버튼으로 기존 코멘트 편집
114
+ 3. **프롬프트 생성**: 코멘트에는 AI 코딩 에이전트용 컨텍스트를 포맷하는 "프롬프트 복사" 버튼 포함
115
+ 4. **모두 복사**: "모든 프롬프트 복사"를 사용하여 구조화된 형식으로 모든 코멘트 복사
116
+ 5. **영구 저장**: 코멘트는 커밋별로 브라우저 localStorage에 저장
117
+
118
+ ### 코멘트 프롬프트 형식
119
+
120
+ ```sh
121
+ src/components/Button.tsx:L42 # 이 줄은 자동으로 추가됩니다
122
+ 이 변수 이름을 더 설명적으로 만드세요
123
+ ```
124
+
125
+ 범위 선택의 경우:
126
+
127
+ ```sh
128
+ src/components/Button.tsx:L42-L48 # 이 줄은 자동으로 추가됩니다
129
+ 이 부분은 불필요합니다
130
+ ```
131
+
132
+ ## 🎨 구문 강조 언어
133
+
134
+ - **JavaScript/TypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`
135
+ - **웹 기술**: HTML, CSS, JSON, XML, Markdown
136
+ - **셸 스크립트**: `.sh`, `.bash`, `.zsh`, `.fish`
137
+ - **백엔드 언어**: PHP, SQL, Ruby, Java, Scala
138
+ - **시스템 언어**: C, C++, C#, Rust, Go
139
+ - **모바일 언어**: Swift, Kotlin, Dart
140
+ - **기타**: Python, YAML, Solidity, Vim 스크립트
141
+
142
+ ## 🛠️ 개발
143
+
144
+ ```bash
145
+ # 의존성 설치
146
+ pnpm install
147
+
148
+ # 개발 서버 시작 (핫 리로드 포함)
149
+ # Vite 개발 서버와 CLI를 NODE_ENV=development로 동시에 실행
150
+ pnpm run dev
151
+
152
+ # 프로덕션 서버 빌드 및 시작
153
+ pnpm run start <target>
154
+
155
+ # 프로덕션용 빌드
156
+ pnpm run build
157
+
158
+ # 테스트 실행
159
+ pnpm test
160
+
161
+ # 린트 및 포맷
162
+ pnpm run lint
163
+ pnpm run format
164
+ pnpm run typecheck
165
+ ```
166
+
167
+ ### 개발 워크플로우
168
+
169
+ - **`pnpm run dev`**: Vite 개발 서버 (핫 리로드 포함)와 CLI 서버를 동시에 시작
170
+ - **`pnpm run start <target>`**: 모든 것을 빌드하고 프로덕션 서버 시작 (최종 빌드 테스트용)
171
+ - **개발 모드**: 핫 리로드와 빠른 개발을 위해 Vite의 개발 서버 사용
172
+ - **프로덕션 모드**: 빌드된 정적 파일 제공 (npx 및 프로덕션 빌드에서 사용)
173
+
174
+ ## 🏗️ 아키텍처
175
+
176
+ - **CLI**: 포괄적인 검증을 갖춘 Commander.js로 인수 구문 분석
177
+ - **백엔드**: diff 처리를 위한 simple-git이 포함된 Express 서버
178
+ - **GitHub 통합**: 자동 인증 (GitHub CLI + 환경 변수)을 갖춘 GitHub API용 Octokit
179
+ - **프론트엔드**: React 18 + TypeScript + Vite
180
+ - **스타일링**: GitHub과 유사한 다크 테마를 갖춘 Tailwind CSS v4
181
+ - **구문 강조**: 동적 언어 로딩을 갖춘 Prism.js
182
+ - **테스트**: 동일 위치에 배치된 테스트 파일을 사용하는 Vitest 단위 테스트
183
+ - **품질**: ESLint, Prettier, lefthook 사전 커밋 훅
184
+
185
+ ## 📋 요구 사항
186
+
187
+ - Node.js ≥ 21.0.0
188
+ - 검토할 커밋이 포함된 Git 저장소
189
+
190
+ ## 📄 라이선스
191
+
192
+ MIT
package/README.md CHANGED
@@ -2,18 +2,22 @@
2
2
  <img src="public/logo.png" alt="difit" width="260">
3
3
  </h1>
4
4
 
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! 🚀
5
+ <p align="center">
6
+ English | <a href="./README.ja.md">日本語</a> | <a href="./README.zh.md">简体中文</a> | <a href="./README.ko.md">한국어</a>
7
+ </p>
8
+
9
+ **difit** is a CLI tool that lets you view and review local git diffs with a GitHub-style viewer. In addition to clean visuals, comments can be copied as prompts for AI. The local code review tool for the AI era!
6
10
 
7
11
  ## ✨ Features
8
12
 
9
- - ⚡ **Zero Config**: Just run `npx difit <commit>` and it works
10
- - 🌙 **Review for AI**: Add comments and copy prompts for AI coding agent
11
- - 🖥️ **Terminal UI**: View diffs directly in terminal with `--tui`
13
+ - ⚡ **Zero Config**: Just run `npx difit` and it works
14
+ - 💬 **Local Review**: Add comments to diffs and copy them with file paths and line numbers for AI
15
+ - 🖥️ **WebUI/TerminalUI**: Web UI in browser, or stay in terminal with `--tui`
12
16
 
13
17
  ## ⚡ Quick Start
14
18
 
15
19
  ```bash
16
- npx difit # View HEAD commit changes in a beautiful diff viewer
20
+ npx difit # View the latest commit diff in WebUI
17
21
  ```
18
22
 
19
23
  ## 🚀 Usage
@@ -21,23 +25,23 @@ npx difit # View HEAD commit changes in a beautiful diff viewer
21
25
  ### Basic Usage
22
26
 
23
27
  ```bash
24
- npx difit <commit-ish> # View single commit diff
25
- npx difit <commit-ish> [compare-with] # Compare two commits/branches
28
+ npx difit <target> # View single commit diff
29
+ npx difit <target> [compare-with] # Compare two commits/branches
26
30
  npx difit --pr <github-pr-url> # Review GitHub pull request
27
31
  ```
28
32
 
29
33
  ### Single commit review
30
34
 
31
35
  ```bash
36
+ npx difit # HEAD (latest) commit
32
37
  npx difit 6f4a9b7 # Specific commit
33
- npx difit HEAD^ # Previous commit
34
- npx difit feature # Latest commit on branch
38
+ npx difit feature # Latest commit on feature branch
35
39
  ```
36
40
 
37
41
  ### Compare two commits
38
42
 
39
43
  ```bash
40
- npx difit HEAD main # Compare HEAD with main branch
44
+ npx difit @ main # Compare with main branch (@ is alias for HEAD)
41
45
  npx difit feature main # Compare branches
42
46
  npx difit . origin/main # Compare working directory with remote main
43
47
  ```
@@ -47,18 +51,11 @@ npx difit . origin/main # Compare working directory with remote main
47
51
  difit supports special keywords for common diff scenarios:
48
52
 
49
53
  ```bash
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)
54
+ npx difit . # All uncommitted changes (staging area + unstaged)
55
+ npx difit staged # Staging area changes
56
+ npx difit working # Unstaged changes only
54
57
  ```
55
58
 
56
- | Keyword | Description | Compare-with Support |
57
- | --------- | ------------------------------------------------------ | -------------------- |
58
- | `.` | Shows all uncommitted changes (both staged & unstaged) | ✅ Yes |
59
- | `staged` | Shows staged changes ready to be committed | ✅ Yes |
60
- | `working` | Shows unstaged changes in your working directory | ❌ No |
61
-
62
59
  ### GitHub PR
63
60
 
64
61
  ```bash
@@ -71,57 +68,77 @@ difit automatically handles GitHub authentication using:
71
68
  2. **Environment Variable**: Set `GITHUB_TOKEN` environment variable
72
69
  3. **No Authentication**: Public repositories work without authentication (rate-limited)
73
70
 
71
+ #### GitHub Enterprise Server
72
+
73
+ For Enterprise Server PRs, you must set a token generated on YOUR Enterprise Server instance:
74
+
75
+ 1. Go to `https://YOUR-ENTERPRISE-SERVER/settings/tokens`
76
+ 2. Generate a personal access token with appropriate scopes
77
+ 3. Set it as `GITHUB_TOKEN` environment variable
78
+
79
+ ### Stdin
80
+
81
+ By using a pipe to pass unified diffs via stdin, you can view diffs from any tool with difit.
82
+
83
+ ```bash
84
+ # View diffs from other tools
85
+ diff -u file1.txt file2.txt | npx difit
86
+
87
+ # Review saved patches
88
+ cat changes.patch | npx difit
89
+
90
+ # Compare against merge base
91
+ git diff --merge-base main feature | npx difit
92
+ ```
93
+
74
94
  ## ⚙️ CLI Options
75
95
 
76
96
  | Flag | Default | Description |
77
97
  | ---------------- | ------------ | ---------------------------------------------------------------------- |
78
- | `<commit-ish>` | HEAD | Any Git reference: hash, tag, HEAD~n, branch, or Special Arguments |
79
- | `[compare-with]` | (optional) | Optional second commit to compare with (shows diff between the two) |
98
+ | `<target>` | HEAD | Commit hash, tag, HEAD~n, branch, or special arguments |
99
+ | `[compare-with]` | - | Optional second commit to compare with (shows diff between the two) |
80
100
  | `--pr <url>` | - | GitHub PR URL to review (e.g., https://github.com/owner/repo/pull/123) |
81
- | `--port` | auto | Preferred port; falls back if occupied |
101
+ | `--port` | 4966 | Preferred port; falls back to +1 if occupied |
82
102
  | `--host` | 127.0.0.1 | Host address to bind server to (use 0.0.0.0 for external access) |
83
103
  | `--no-open` | false | Don't automatically open browser |
84
- | `--mode` | side-by-side | Diff mode: `inline` or `side-by-side` |
85
- | `--tui` | false | Use terminal UI mode instead of web interface |
104
+ | `--mode` | side-by-side | Display mode: `inline` or `side-by-side` |
105
+ | `--tui` | false | Use terminal UI mode instead of WebUI |
106
+ | `--clean` | false | Clear all existing comments on startup |
86
107
 
87
108
  ## 💬 Comment System
88
109
 
89
- difit includes an inline commenting system that integrates with AI coding agent:
110
+ difit includes a review comment system that makes it easy to provide feedback to AI coding agents:
90
111
 
91
- 1. **Add Comments**: Click on any diff line to add a comment
112
+ 1. **Add Comments**: Click the comment button on any diff line or drag to select a range
92
113
  2. **Edit Comments**: Edit existing comments with the edit button
93
- 3. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for AI coding agent
114
+ 3. **Generate Prompts**: Comments include a "Copy Prompt" button that formats the context for AI coding agents
94
115
  4. **Copy All**: Use "Copy All Prompt" to copy all comments in a structured format
95
116
  5. **Persistent Storage**: Comments are saved in browser localStorage per commit
96
117
 
97
118
  ### Comment Prompt Format
98
119
 
99
120
  ```sh
100
- src/components/Button.tsx:42 # Automatically added this line
101
- This name should probably be more specific.
121
+ src/components/Button.tsx:L42 # This line is automatically added
122
+ Make this variable name more descriptive
102
123
  ```
103
124
 
104
- ## 🎨 Syntax Highlighting
125
+ For range selections:
105
126
 
106
- difit supports syntax highlighting for multiple programming languages with dynamic loading:
127
+ ```sh
128
+ src/components/Button.tsx:L42-L48 # This line is automatically added
129
+ This section is unnecessary
130
+ ```
107
131
 
108
- ### Supported Languages
132
+ ## 🎨 Syntax Highlighting Languages
109
133
 
110
134
  - **JavaScript/TypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`
111
135
  - **Web Technologies**: HTML, CSS, JSON, XML, Markdown
112
- - **Shell Scripts**: `.sh`, `.bash`, `.zsh`, `.fish` files
136
+ - **Shell Scripts**: `.sh`, `.bash`, `.zsh`, `.fish`
113
137
  - **Backend Languages**: PHP, SQL, Ruby, Java, Scala
114
138
  - **Systems Languages**: C, C++, C#, Rust, Go
115
139
  - **Mobile Languages**: Swift, Kotlin, Dart
116
140
  - **Others**: Python, YAML, Solidity, Vim script
117
141
 
118
- ### Dynamic Language Loading
119
-
120
- - Languages are loaded on-demand for better performance
121
- - Automatic language detection from file extensions
122
- - Fallback to plain text for unsupported languages
123
- - Safe dependency resolution (e.g., PHP requires markup-templating)
124
-
125
142
  ## 🛠️ Development
126
143
 
127
144
  ```bash
@@ -133,7 +150,7 @@ pnpm install
133
150
  pnpm run dev
134
151
 
135
152
  # Build and start production server
136
- pnpm run start <commit-ish>
153
+ pnpm run start <target>
137
154
 
138
155
  # Build for production
139
156
  pnpm run build
@@ -150,7 +167,7 @@ pnpm run typecheck
150
167
  ### Development Workflow
151
168
 
152
169
  - **`pnpm run dev`**: Starts both Vite dev server (with hot reload) and CLI server simultaneously
153
- - **`pnpm run start <commit-ish>`**: Builds everything and starts production server (for testing final build)
170
+ - **`pnpm run start <target>`**: Builds everything and starts production server (for testing final build)
154
171
  - **Development mode**: Uses Vite's dev server for hot reload and fast development
155
172
  - **Production mode**: Serves built static files (used by npx and production builds)
156
173
 
@@ -172,4 +189,4 @@ pnpm run typecheck
172
189
 
173
190
  ## 📄 License
174
191
 
175
- MIT 📝
192
+ MIT