difit 2.1.1 → 2.2.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.ja.md CHANGED
@@ -10,12 +10,6 @@
10
10
 
11
11
  **difit**は、ローカルのgit上にある差分をGitHub風のビューアで閲覧・レビューできるCLIツールです。見やすい表示に加え、コメントはAIへのプロンプトとしてコピーできます。AI時代のローカルコードレビューツール!
12
12
 
13
- ## ✨ 機能
14
-
15
- - ⚡ **Zero Config**: `npx difit` を実行するだけ
16
- - 💬 **ローカルレビュー**: 差分にコメントをつけて、AI向けにファイルパス・行番号つきでコピー
17
- - 🖥️ **WebUI/TerminalUI**: ブラウザで見るWeb UIの他、ターミナルのまま閲覧できる `--tui` も
18
-
19
13
  ## ⚡ クイックスタート
20
14
 
21
15
  ```bash
package/README.ko.md CHANGED
@@ -10,12 +10,6 @@
10
10
 
11
11
  **difit**은 GitHub 스타일 뷰어로 로컬 git diff를 보고 검토할 수 있는 CLI 도구입니다. 깔끔한 시각적 효과와 함께 코멘트를 AI용 프롬프트로 복사할 수 있습니다. AI 시대의 로컬 코드 리뷰 도구!
12
12
 
13
- ## ✨ 기능
14
-
15
- - ⚡ **제로 설정**: `npx difit`만 실행하면 작동
16
- - 💬 **로컬 리뷰**: diff에 코멘트를 추가하고 파일 경로와 줄 번호와 함께 AI용으로 복사
17
- - 🖥️ **WebUI/터미널UI**: 브라우저의 Web UI 또는 `--tui`로 터미널에서 사용
18
-
19
13
  ## ⚡ 빠른 시작
20
14
 
21
15
  ```bash
package/README.md CHANGED
@@ -10,12 +10,6 @@
10
10
 
11
11
  **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!
12
12
 
13
- ## ✨ Features
14
-
15
- - ⚡ **Zero Config**: Just run `npx difit` and it works
16
- - 💬 **Local Review**: Add comments to diffs and copy them with file paths and line numbers for AI
17
- - 🖥️ **WebUI/TerminalUI**: Web UI in browser, or stay in terminal with `--tui`
18
-
19
13
  ## ⚡ Quick Start
20
14
 
21
15
  ```bash
package/README.zh.md CHANGED
@@ -10,12 +10,6 @@
10
10
 
11
11
  **difit** 是一个让你使用 GitHub 风格查看器查看和审查本地 git 差异的 CLI 工具。除了清晰的视觉效果外,评论还可以作为 AI 提示进行复制。AI 时代的本地代码审查工具!
12
12
 
13
- ## ✨ 功能
14
-
15
- - ⚡ **零配置**:只需运行 `npx difit` 即可使用
16
- - 💬 **本地审查**:为差异添加评论,并将其与文件路径和行号一起复制给 AI
17
- - 🖥️ **WebUI/终端UI**:在浏览器中使用 Web UI,或使用 `--tui` 保持在终端中
18
-
19
13
  ## ⚡ 快速开始
20
14
 
21
15
  ```bash
package/dist/cli/index.js CHANGED
@@ -11,7 +11,8 @@ function isSpecialArg(arg) {
11
11
  }
12
12
  function determineDiffMode(targetCommitish, compareWith) {
13
13
  // If comparing specific commits/branches (not involving HEAD), no watching needed
14
- if (compareWith && targetCommitish !== 'HEAD') {
14
+ // Exception: allow watching when targetCommitish is '.' even with compareWith
15
+ if (compareWith && targetCommitish !== 'HEAD' && targetCommitish !== '.') {
15
16
  return DiffMode.SPECIFIC;
16
17
  }
17
18
  if (targetCommitish === 'working') {
@@ -862,7 +862,7 @@ describe('CLI index.ts', () => {
862
862
  .action(async (commitish, compareWith, options) => {
863
863
  // Simulate determineDiffMode function behavior
864
864
  let diffMode;
865
- if (compareWith && commitish !== 'HEAD') {
865
+ if (compareWith && commitish !== 'HEAD' && commitish !== '.') {
866
866
  diffMode = DiffMode.SPECIFIC;
867
867
  }
868
868
  else if (commitish === 'working') {
@@ -908,7 +908,7 @@ describe('CLI index.ts', () => {
908
908
  .action(async (commitish, compareWith, options) => {
909
909
  // Simulate determineDiffMode function behavior
910
910
  let diffMode;
911
- if (compareWith && commitish !== 'HEAD') {
911
+ if (compareWith && commitish !== 'HEAD' && commitish !== '.') {
912
912
  diffMode = DiffMode.SPECIFIC;
913
913
  }
914
914
  else if (commitish === 'working') {
@@ -940,5 +940,52 @@ describe('CLI index.ts', () => {
940
940
  baseCommitish: 'main',
941
941
  }));
942
942
  });
943
+ it('enables watch mode for dot with comparison', async () => {
944
+ mockFindUntrackedFiles.mockResolvedValue([]);
945
+ const program = new Command();
946
+ program
947
+ .argument('[commit-ish]', 'commit-ish', 'HEAD')
948
+ .argument('[compare-with]', 'compare-with')
949
+ .option('--port <port>', 'port', parseInt)
950
+ .option('--host <host>', 'host', '')
951
+ .option('--no-open', 'no-open')
952
+ .option('--mode <mode>', 'mode', 'side-by-side')
953
+ .option('--tui', 'tui')
954
+ .option('--pr <url>', 'pr')
955
+ .action(async (commitish, compareWith, options) => {
956
+ // Simulate determineDiffMode function behavior with the fix
957
+ let diffMode;
958
+ if (compareWith && commitish !== 'HEAD' && commitish !== '.') {
959
+ diffMode = DiffMode.SPECIFIC;
960
+ }
961
+ else if (commitish === 'working') {
962
+ diffMode = DiffMode.WORKING;
963
+ }
964
+ else if (commitish === 'staged') {
965
+ diffMode = DiffMode.STAGED;
966
+ }
967
+ else if (commitish === '.') {
968
+ diffMode = DiffMode.DOT;
969
+ }
970
+ else {
971
+ diffMode = DiffMode.DEFAULT;
972
+ }
973
+ await startServer({
974
+ targetCommitish: commitish,
975
+ baseCommitish: compareWith || commitish + '^',
976
+ preferredPort: options.port,
977
+ host: options.host,
978
+ openBrowser: options.open,
979
+ mode: options.mode,
980
+ diffMode,
981
+ });
982
+ });
983
+ await program.parseAsync(['.', 'origin/main'], { from: 'user' });
984
+ expect(mockStartServer).toHaveBeenCalledWith(expect.objectContaining({
985
+ diffMode: 'dot', // Dot with comparison should still be DOT mode (watch enabled)
986
+ targetCommitish: '.',
987
+ baseCommitish: 'origin/main',
988
+ }));
989
+ });
943
990
  });
944
991
  });