difit 3.0.2 → 3.0.4
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 +12 -11
- package/README.ko.md +12 -11
- package/README.md +12 -11
- package/README.zh.md +12 -11
- package/dist/cli/index.js +5 -4
- package/dist/cli/index.test.js +73 -0
- package/dist/client/assets/{index-D8OwPIt3.js → index-B0f4XJvh.js} +2 -2
- package/dist/client/assets/{prism-csharp-MxIkBOuT.js → prism-csharp-B-1teUnU.js} +1 -1
- package/dist/client/assets/{prism-hcl-a0Z8Hwk2.js → prism-hcl-BclbyXtV.js} +1 -1
- package/dist/client/assets/{prism-java-Blsgme8U.js → prism-java-94PqVB1S.js} +1 -1
- package/dist/client/assets/{prism-php-CU6Zo_1W.js → prism-php-C1i3qVCF.js} +1 -1
- package/dist/client/assets/{prism-ruby-BU9Ro5cR.js → prism-ruby-DLhW5oCS.js} +1 -1
- package/dist/client/assets/{prism-solidity-ChlixQd2.js → prism-solidity-VnQS4C0y.js} +1 -1
- package/dist/client/index.html +1 -1
- package/dist/server/file-watcher.d.ts +5 -0
- package/dist/server/file-watcher.js +21 -2
- package/dist/server/file-watcher.test.js +52 -0
- package/package.json +2 -2
package/README.ja.md
CHANGED
|
@@ -101,17 +101,18 @@ git diff -- /dev/null path/to/file | difit
|
|
|
101
101
|
|
|
102
102
|
## ⚙️ CLIオプション
|
|
103
103
|
|
|
104
|
-
| フラグ
|
|
105
|
-
|
|
|
106
|
-
| `<target>`
|
|
107
|
-
| `[compare-with]`
|
|
108
|
-
| `--pr <url>`
|
|
109
|
-
| `--port`
|
|
110
|
-
| `--host`
|
|
111
|
-
| `--no-open`
|
|
112
|
-
| `--mode`
|
|
113
|
-
| `--tui`
|
|
114
|
-
| `--clean`
|
|
104
|
+
| フラグ | デフォルト | 説明 |
|
|
105
|
+
| --------------------- | ------------ | --------------------------------------------------------------------------------- |
|
|
106
|
+
| `<target>` | HEAD | コミットハッシュ、タグ、HEAD~n、ブランチ、または特別な引数 |
|
|
107
|
+
| `[compare-with]` | - | 比較対象の2番目のコミット(2つの間のdiffを表示) |
|
|
108
|
+
| `--pr <url>` | - | レビューするGitHub PRのURL(例:https://github.com/owner/repo/pull/123) |
|
|
109
|
+
| `--port` | 4966 | 優先ポート。使用中の場合は+1にフォールバック |
|
|
110
|
+
| `--host` | 127.0.0.1 | サーバーをバインドするホストアドレス(外部からアクセスしたい場合は0.0.0.0を指定) |
|
|
111
|
+
| `--no-open` | false | ブラウザを自動的に開かない |
|
|
112
|
+
| `--mode` | side-by-side | 表示モード。inline`または`side-by-side` |
|
|
113
|
+
| `--tui` | false | WebUIの代わりにターミナルUIを使用 |
|
|
114
|
+
| `--clean` | false | 起動時に既存コメントと閲覧済みファイルをすべてクリア |
|
|
115
|
+
| `--include-untracked` | false | diffにuntrackedファイルを自動的に含める(`.`または`working`のみ有効) |
|
|
115
116
|
|
|
116
117
|
## 💬 コメントシステム
|
|
117
118
|
|
package/README.ko.md
CHANGED
|
@@ -101,17 +101,18 @@ git diff -- /dev/null path/to/file | difit
|
|
|
101
101
|
|
|
102
102
|
## ⚙️ CLI 옵션
|
|
103
103
|
|
|
104
|
-
| 플래그
|
|
105
|
-
|
|
|
106
|
-
| `<target>`
|
|
107
|
-
| `[compare-with]`
|
|
108
|
-
| `--pr <url>`
|
|
109
|
-
| `--port`
|
|
110
|
-
| `--host`
|
|
111
|
-
| `--no-open`
|
|
112
|
-
| `--mode`
|
|
113
|
-
| `--tui`
|
|
114
|
-
| `--clean`
|
|
104
|
+
| 플래그 | 기본값 | 설명 |
|
|
105
|
+
| --------------------- | ------------ | ----------------------------------------------------------------- |
|
|
106
|
+
| `<target>` | HEAD | 커밋 해시, 태그, HEAD~n, 브랜치 또는 특수 인수 |
|
|
107
|
+
| `[compare-with]` | - | 비교할 선택적 두 번째 커밋 (둘 사이의 diff 표시) |
|
|
108
|
+
| `--pr <url>` | - | 검토할 GitHub PR URL (예: https://github.com/owner/repo/pull/123) |
|
|
109
|
+
| `--port` | 4966 | 선호 포트; 사용 중인 경우 +1로 대체 |
|
|
110
|
+
| `--host` | 127.0.0.1 | 서버를 바인딩할 호스트 주소 (외부 액세스는 0.0.0.0 사용) |
|
|
111
|
+
| `--no-open` | false | 브라우저를 자동으로 열지 않음 |
|
|
112
|
+
| `--mode` | side-by-side | 표시 모드: `inline` 또는 `side-by-side` |
|
|
113
|
+
| `--tui` | false | WebUI 대신 터미널 UI 모드 사용 |
|
|
114
|
+
| `--clean` | false | 시작 시 모든 기존 코멘트와 열람된 파일 표시 초기화 |
|
|
115
|
+
| `--include-untracked` | false | diff에 untracked 파일 자동 포함 (`.` 또는 `working`에서만 유효) |
|
|
115
116
|
|
|
116
117
|
## 💬 코멘트 시스템
|
|
117
118
|
|
package/README.md
CHANGED
|
@@ -101,17 +101,18 @@ git diff -- /dev/null path/to/file | difit
|
|
|
101
101
|
|
|
102
102
|
## ⚙️ CLI Options
|
|
103
103
|
|
|
104
|
-
| Flag
|
|
105
|
-
|
|
|
106
|
-
| `<target>`
|
|
107
|
-
| `[compare-with]`
|
|
108
|
-
| `--pr <url>`
|
|
109
|
-
| `--port`
|
|
110
|
-
| `--host`
|
|
111
|
-
| `--no-open`
|
|
112
|
-
| `--mode`
|
|
113
|
-
| `--tui`
|
|
114
|
-
| `--clean`
|
|
104
|
+
| Flag | Default | Description |
|
|
105
|
+
| --------------------- | ------------ | -------------------------------------------------------------------------- |
|
|
106
|
+
| `<target>` | HEAD | Commit hash, tag, HEAD~n, branch, or special arguments |
|
|
107
|
+
| `[compare-with]` | - | Optional second commit to compare with (shows diff between the two) |
|
|
108
|
+
| `--pr <url>` | - | GitHub PR URL to review (e.g., https://github.com/owner/repo/pull/123) |
|
|
109
|
+
| `--port` | 4966 | Preferred port; falls back to +1 if occupied |
|
|
110
|
+
| `--host` | 127.0.0.1 | Host address to bind server to (use 0.0.0.0 for external access) |
|
|
111
|
+
| `--no-open` | false | Don't automatically open browser |
|
|
112
|
+
| `--mode` | side-by-side | Display mode: `inline` or `side-by-side` |
|
|
113
|
+
| `--tui` | false | Use terminal UI mode instead of WebUI |
|
|
114
|
+
| `--clean` | false | Clear all existing comments and viewed files on startup |
|
|
115
|
+
| `--include-untracked` | false | Automatically include untracked files in diff (only with `.` or `working`) |
|
|
115
116
|
|
|
116
117
|
## 💬 Comment System
|
|
117
118
|
|
package/README.zh.md
CHANGED
|
@@ -101,17 +101,18 @@ git diff -- /dev/null path/to/file | difit
|
|
|
101
101
|
|
|
102
102
|
## ⚙️ CLI 选项
|
|
103
103
|
|
|
104
|
-
| 标志
|
|
105
|
-
|
|
|
106
|
-
| `<target>`
|
|
107
|
-
| `[compare-with]`
|
|
108
|
-
| `--pr <url>`
|
|
109
|
-
| `--port`
|
|
110
|
-
| `--host`
|
|
111
|
-
| `--no-open`
|
|
112
|
-
| `--mode`
|
|
113
|
-
| `--tui`
|
|
114
|
-
| `--clean`
|
|
104
|
+
| 标志 | 默认值 | 描述 |
|
|
105
|
+
| --------------------- | ------------ | ---------------------------------------------------------------------- |
|
|
106
|
+
| `<target>` | HEAD | 提交哈希、标签、HEAD~n、分支或特殊参数 |
|
|
107
|
+
| `[compare-with]` | - | 要比较的可选第二个提交(显示两者之间的差异) |
|
|
108
|
+
| `--pr <url>` | - | 要审查的 GitHub PR URL(例如:https://github.com/owner/repo/pull/123) |
|
|
109
|
+
| `--port` | 4966 | 首选端口;如果被占用则回退到 +1 |
|
|
110
|
+
| `--host` | 127.0.0.1 | 绑定服务器的主机地址(使用 0.0.0.0 进行外部访问) |
|
|
111
|
+
| `--no-open` | false | 不自动打开浏览器 |
|
|
112
|
+
| `--mode` | side-by-side | 显示模式:`inline` 或 `side-by-side` |
|
|
113
|
+
| `--tui` | false | 使用终端 UI 模式而不是 WebUI |
|
|
114
|
+
| `--clean` | false | 启动时清除所有现有评论和已查看的文件 |
|
|
115
|
+
| `--include-untracked` | false | 自动将 untracked 文件包含在 diff 中(仅在 `.` 或 `working` 时有效) |
|
|
115
116
|
|
|
116
117
|
## 💬 评论系统
|
|
117
118
|
|
package/dist/cli/index.js
CHANGED
|
@@ -41,6 +41,7 @@ program
|
|
|
41
41
|
.option('--tui', 'use terminal UI instead of web interface')
|
|
42
42
|
.option('--pr <url>', 'GitHub PR URL to review (e.g., https://github.com/owner/repo/pull/123)')
|
|
43
43
|
.option('--clean', 'start with a clean slate by clearing all existing comments')
|
|
44
|
+
.option('--include-untracked', 'automatically include untracked files in diff')
|
|
44
45
|
.action(async (commitish, compareWith, options) => {
|
|
45
46
|
try {
|
|
46
47
|
// Check if we should read from stdin
|
|
@@ -116,7 +117,7 @@ program
|
|
|
116
117
|
}
|
|
117
118
|
if (commitish === 'working' || commitish === '.') {
|
|
118
119
|
const git = simpleGit(repoPath);
|
|
119
|
-
await handleUntrackedFiles(git);
|
|
120
|
+
await handleUntrackedFiles(git, options.includeUntracked);
|
|
120
121
|
}
|
|
121
122
|
if (options.tui) {
|
|
122
123
|
// Check if we're in a TTY environment
|
|
@@ -203,13 +204,13 @@ async function readStdin() {
|
|
|
203
204
|
}
|
|
204
205
|
return Buffer.concat(chunks).toString('utf8');
|
|
205
206
|
}
|
|
206
|
-
async function handleUntrackedFiles(git) {
|
|
207
|
+
async function handleUntrackedFiles(git, addAutomatically) {
|
|
207
208
|
const files = await findUntrackedFiles(git);
|
|
208
209
|
if (files.length === 0) {
|
|
209
210
|
return;
|
|
210
211
|
}
|
|
211
|
-
const
|
|
212
|
-
if (
|
|
212
|
+
const shouldAdd = addAutomatically || (await promptUserToIncludeUntracked(files));
|
|
213
|
+
if (shouldAdd) {
|
|
213
214
|
await markFilesIntentToAdd(git, files);
|
|
214
215
|
console.log('✅ Files added with --intent-to-add');
|
|
215
216
|
const filesAsArgs = files.join(' ');
|
package/dist/cli/index.test.js
CHANGED
|
@@ -286,6 +286,79 @@ describe('CLI index.ts', () => {
|
|
|
286
286
|
await program.parseAsync(['HEAD'], { from: 'user' });
|
|
287
287
|
expect(mockFindUntrackedFiles).not.toHaveBeenCalled();
|
|
288
288
|
});
|
|
289
|
+
it('automatically includes untracked files with --include-untracked flag', async () => {
|
|
290
|
+
const untrackedFiles = ['new-file.ts', 'another-file.ts'];
|
|
291
|
+
mockFindUntrackedFiles.mockResolvedValue(untrackedFiles);
|
|
292
|
+
mockMarkFilesIntentToAdd.mockResolvedValue(undefined);
|
|
293
|
+
const program = new Command();
|
|
294
|
+
program
|
|
295
|
+
.argument('[commit-ish]', 'commit-ish', 'HEAD')
|
|
296
|
+
.argument('[compare-with]', 'compare-with')
|
|
297
|
+
.option('--port <port>', 'port', parseInt)
|
|
298
|
+
.option('--host <host>', 'host', '')
|
|
299
|
+
.option('--no-open', 'no-open')
|
|
300
|
+
.option('--mode <mode>', 'mode', 'side-by-side')
|
|
301
|
+
.option('--tui', 'tui')
|
|
302
|
+
.option('--pr <url>', 'pr')
|
|
303
|
+
.option('--include-untracked', 'include untracked')
|
|
304
|
+
.action(async (commitish, _compareWith, options) => {
|
|
305
|
+
if (commitish === 'working' || commitish === '.') {
|
|
306
|
+
const git = simpleGit();
|
|
307
|
+
const files = await findUntrackedFiles(git);
|
|
308
|
+
if (files.length > 0 && options.includeUntracked) {
|
|
309
|
+
await markFilesIntentToAdd(git, files);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
await startServer({
|
|
313
|
+
targetCommitish: commitish,
|
|
314
|
+
baseCommitish: 'staged',
|
|
315
|
+
preferredPort: options.port,
|
|
316
|
+
host: options.host,
|
|
317
|
+
openBrowser: options.open,
|
|
318
|
+
mode: options.mode,
|
|
319
|
+
});
|
|
320
|
+
});
|
|
321
|
+
await program.parseAsync(['.', '--include-untracked'], { from: 'user' });
|
|
322
|
+
expect(mockFindUntrackedFiles).toHaveBeenCalledWith(mockGit);
|
|
323
|
+
expect(mockMarkFilesIntentToAdd).toHaveBeenCalledWith(mockGit, untrackedFiles);
|
|
324
|
+
});
|
|
325
|
+
it('does not auto-include untracked files without --include-untracked flag', async () => {
|
|
326
|
+
const untrackedFiles = ['new-file.ts'];
|
|
327
|
+
mockFindUntrackedFiles.mockResolvedValue(untrackedFiles);
|
|
328
|
+
mockMarkFilesIntentToAdd.mockResolvedValue(undefined);
|
|
329
|
+
const program = new Command();
|
|
330
|
+
program
|
|
331
|
+
.argument('[commit-ish]', 'commit-ish', 'HEAD')
|
|
332
|
+
.argument('[compare-with]', 'compare-with')
|
|
333
|
+
.option('--port <port>', 'port', parseInt)
|
|
334
|
+
.option('--host <host>', 'host', '')
|
|
335
|
+
.option('--no-open', 'no-open')
|
|
336
|
+
.option('--mode <mode>', 'mode', 'side-by-side')
|
|
337
|
+
.option('--tui', 'tui')
|
|
338
|
+
.option('--pr <url>', 'pr')
|
|
339
|
+
.option('--include-untracked', 'include untracked')
|
|
340
|
+
.action(async (commitish, _compareWith, options) => {
|
|
341
|
+
if (commitish === 'working' || commitish === '.') {
|
|
342
|
+
const git = simpleGit();
|
|
343
|
+
const files = await findUntrackedFiles(git);
|
|
344
|
+
// Without --include-untracked, markFilesIntentToAdd should not be called automatically
|
|
345
|
+
if (files.length > 0 && options.includeUntracked) {
|
|
346
|
+
await markFilesIntentToAdd(git, files);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
await startServer({
|
|
350
|
+
targetCommitish: commitish,
|
|
351
|
+
baseCommitish: 'staged',
|
|
352
|
+
preferredPort: options.port,
|
|
353
|
+
host: options.host,
|
|
354
|
+
openBrowser: options.open,
|
|
355
|
+
mode: options.mode,
|
|
356
|
+
});
|
|
357
|
+
});
|
|
358
|
+
await program.parseAsync(['.'], { from: 'user' });
|
|
359
|
+
expect(mockFindUntrackedFiles).toHaveBeenCalledWith(mockGit);
|
|
360
|
+
expect(mockMarkFilesIntentToAdd).not.toHaveBeenCalled();
|
|
361
|
+
});
|
|
289
362
|
});
|
|
290
363
|
describe('GitHub PR integration', () => {
|
|
291
364
|
it('resolves PR commits correctly', async () => {
|