difit 3.1.10 → 3.1.12

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
@@ -25,6 +25,12 @@ npm install -g difit
25
25
  difit # 最新コミットのdiffをWebUIで表示
26
26
  ```
27
27
 
28
+ AIエージェントから使えるようにする
29
+
30
+ ```bash
31
+ npx skills add yoshiko-pg/difit # エージェントにスキルを追加
32
+ ```
33
+
28
34
  ## 🚀 使い方
29
35
 
30
36
  ### 基本的な使い方
@@ -121,7 +127,7 @@ git diff --cached | difit -
121
127
  | `--tui` | false | WebUIの代わりにターミナルUIを使用 |
122
128
  | `--clean` | false | 起動時に既存コメントと閲覧済みファイルをすべてクリア |
123
129
  | `--include-untracked` | false | diffにuntrackedファイルを自動的に含める(`.`または`working`のみ有効) |
124
- | `--keep-alive` | false | ブラウザ切断後もサーバーを終了せず起動したままにする(Ctrl+Cで手動停止) |
130
+ | `--keep-alive` | false | ブラウザ切断後もサーバーを終了せず起動したままにする(Ctrl+Cで手動停止) |
125
131
 
126
132
  ## 💬 コメントシステム
127
133
 
@@ -149,12 +155,14 @@ src/components/Button.tsx:L42-L48 # この行が自動的に追加されます
149
155
 
150
156
  ## 🤖 エージェントからの呼び出し
151
157
 
152
- difitを利用してユーザーにレビューを依頼するSkillを以下でインストールできます
158
+ difitを利用してユーザーにレビューを依頼するSkillを以下でインストールできます。
153
159
 
154
160
  ```sh
155
161
  npx skills add yoshiko-pg/difit
156
162
  ```
157
163
 
164
+ エージェントがコードを編集したあと、difitサーバーを立ち上げるようになります。
165
+
158
166
  ## 🎨 シンタックスハイライト対応言語
159
167
 
160
168
  - **JavaScript/TypeScript**:`.js`, `.jsx`, `.ts`, `.tsx`
@@ -231,7 +239,7 @@ pnpm run format
231
239
  - **スタイリング**:GitHubライクなダークテーマを備えたTailwind CSS v4
232
240
  - **シンタックスハイライト**:動的言語ロードを備えたPrism.js
233
241
  - **テスト**:同じ場所に配置されたテストファイルを使用したVitestユニットテスト
234
- - **品質**:OxlintBiome、lefthookプリコミットフック
242
+ - **品質**:oxlintoxfmt、lefthookプリコミットフック
235
243
 
236
244
  ## 📋 要件
237
245
 
package/README.ko.md CHANGED
@@ -25,6 +25,12 @@ npm install -g difit
25
25
  difit # WebUI에서 최신 커밋 diff 보기
26
26
  ```
27
27
 
28
+ AI 에이전트에서 사용할 수 있도록 설정
29
+
30
+ ```bash
31
+ npx skills add yoshiko-pg/difit # 에이전트에 Skill 추가
32
+ ```
33
+
28
34
  ## 🚀 사용법
29
35
 
30
36
  ### 기본 사용법
@@ -155,6 +161,8 @@ difit을 사용해 사용자에게 리뷰를 요청하는 Skill은 아래 명령
155
161
  npx skills add yoshiko-pg/difit
156
162
  ```
157
163
 
164
+ 에이전트가 코드를 수정한 뒤에는 difit 서버를 실행합니다.
165
+
158
166
  ## 🎨 구문 강조 언어
159
167
 
160
168
  - **JavaScript/TypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`
@@ -231,7 +239,7 @@ pnpm run format
231
239
  - **스타일링**: GitHub과 유사한 다크 테마를 갖춘 Tailwind CSS v4
232
240
  - **구문 강조**: 동적 언어 로딩을 갖춘 Prism.js
233
241
  - **테스트**: 동일 위치에 배치된 테스트 파일을 사용하는 Vitest 단위 테스트
234
- - **품질**: Oxlint, Biome, lefthook 사전 커밋 훅
242
+ - **품질**: oxlint, oxfmt, lefthook 사전 커밋 훅
235
243
 
236
244
  ## 📋 요구 사항
237
245
 
package/README.md CHANGED
@@ -25,6 +25,12 @@ npm install -g difit
25
25
  difit # View the latest commit diff in WebUI
26
26
  ```
27
27
 
28
+ Enable use from AI agents
29
+
30
+ ```bash
31
+ npx skills add yoshiko-pg/difit # Add the Skill to your agent
32
+ ```
33
+
28
34
  ## 🚀 Usage
29
35
 
30
36
  ### Basic Usage
@@ -149,12 +155,14 @@ This section is unnecessary
149
155
 
150
156
  ## 🤖 Calling from Agents
151
157
 
152
- You can install the following Skill to request reviews from users with difit:
158
+ You can install the following Skill to request reviews from users with difit.
153
159
 
154
160
  ```sh
155
161
  npx skills add yoshiko-pg/difit
156
162
  ```
157
163
 
164
+ After an agent edits code, it will start the difit server.
165
+
158
166
  ## 🎨 Syntax Highlighting Languages
159
167
 
160
168
  - **JavaScript/TypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`
@@ -231,7 +239,7 @@ pnpm run format
231
239
  - **Styling**: Tailwind CSS v4 with GitHub-like dark theme
232
240
  - **Syntax Highlighting**: Prism.js with dynamic language loading
233
241
  - **Testing**: Vitest for unit tests with co-located test files
234
- - **Quality**: Oxlint, Biome, lefthook pre-commit hooks
242
+ - **Quality**: oxlint, oxfmt, lefthook pre-commit hooks
235
243
 
236
244
  ## 📋 Requirements
237
245
 
package/README.zh.md CHANGED
@@ -25,6 +25,12 @@ npm install -g difit
25
25
  difit # 在 WebUI 中查看最新提交的差异
26
26
  ```
27
27
 
28
+ 使其可供 AI 代理使用
29
+
30
+ ```bash
31
+ npx skills add yoshiko-pg/difit # 为代理添加 Skill
32
+ ```
33
+
28
34
  ## 🚀 使用方法
29
35
 
30
36
  ### 基本用法
@@ -155,6 +161,8 @@ src/components/Button.tsx:L42-L48 # 此行自动添加
155
161
  npx skills add yoshiko-pg/difit
156
162
  ```
157
163
 
164
+ 代理编辑代码后,将会启动 difit 服务器。
165
+
158
166
  ## 🎨 语法高亮语言
159
167
 
160
168
  - **JavaScript/TypeScript**:`.js`, `.jsx`, `.ts`, `.tsx`
@@ -231,7 +239,7 @@ pnpm run format
231
239
  - **样式**:Tailwind CSS v4,带有类似 GitHub 的深色主题
232
240
  - **语法高亮**:Prism.js 带动态语言加载
233
241
  - **测试**:Vitest 用于单元测试,测试文件与源代码放在一起
234
- - **质量**:OxlintBiome、lefthook 预提交钩子
242
+ - **质量**:oxlintoxfmt、lefthook 预提交钩子
235
243
 
236
244
  ## 📋 要求
237
245
 
package/dist/cli/index.js CHANGED
@@ -32,7 +32,7 @@ const program = new Command();
32
32
  program
33
33
  .name('difit')
34
34
  .description('A lightweight Git diff viewer with GitHub-like interface')
35
- .version(pkg.version)
35
+ .version(pkg.version, '-v, --version', 'output the version number')
36
36
  .argument('[commit-ish]', 'Git commit, tag, branch, HEAD~n reference, or "working"/"staged"/"."', 'HEAD')
37
37
  .argument('[compare-with]', 'Optional: Compare with this commit/branch (shows diff between commit-ish and compare-with)')
38
38
  .option('--port <port>', 'preferred port (auto-assigned if occupied)', parseInt)
@@ -3,6 +3,7 @@ import React from 'react';
3
3
  import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
4
4
  import { DiffMode } from '../types/watch.js';
5
5
  import { DEFAULT_DIFF_VIEW_MODE, normalizeDiffViewMode } from '../utils/diffMode.js';
6
+ import pkg from '../../package.json' with { type: 'json' };
6
7
  // Mock all external dependencies
7
8
  vi.mock('simple-git');
8
9
  vi.mock('../server/server.js');
@@ -241,6 +242,34 @@ describe('CLI index.ts', () => {
241
242
  expect(mockStartServer).toHaveBeenCalledWith(expectedCall);
242
243
  });
243
244
  });
245
+ describe('Version option', () => {
246
+ it('supports --version flag', async () => {
247
+ const program = new Command();
248
+ const stdoutWrite = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
249
+ program.version(pkg.version, '-v, --version', 'output the version number').exitOverride();
250
+ try {
251
+ await program.parseAsync(['--version'], { from: 'user' });
252
+ }
253
+ catch {
254
+ // commander exits after printing version
255
+ }
256
+ expect(stdoutWrite).toHaveBeenCalledWith(`${pkg.version}\n`);
257
+ stdoutWrite.mockRestore();
258
+ });
259
+ it('supports -v flag', async () => {
260
+ const program = new Command();
261
+ const stdoutWrite = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
262
+ program.version(pkg.version, '-v, --version', 'output the version number').exitOverride();
263
+ try {
264
+ await program.parseAsync(['-v'], { from: 'user' });
265
+ }
266
+ catch {
267
+ // commander exits after printing version
268
+ }
269
+ expect(stdoutWrite).toHaveBeenCalledWith(`${pkg.version}\n`);
270
+ stdoutWrite.mockRestore();
271
+ });
272
+ });
244
273
  describe('Git operations', () => {
245
274
  it('handles untracked files for working directory', async () => {
246
275
  const untrackedFiles = ['file1.js', 'file2.js'];
@@ -1,9 +1,9 @@
1
1
  import { type Stats } from 'node:fs';
2
2
  import type { SimpleGit } from 'simple-git';
3
3
  type StdinStat = Pick<Stats, 'isFIFO' | 'isFile' | 'isSocket'>;
4
- export type StdinSource = 'pipe' | 'file' | 'socket' | 'tty';
4
+ type StdinSource = 'pipe' | 'file' | 'socket' | 'tty';
5
5
  export declare function detectStdinSource(stdinStat?: StdinStat): StdinSource;
6
- export interface ShouldReadStdinOptions {
6
+ interface ShouldReadStdinOptions {
7
7
  commitish: string;
8
8
  hasPositionalArgs: boolean;
9
9
  hasPrOption: boolean;
@@ -15,7 +15,7 @@ export declare function getGitRoot(): string;
15
15
  export declare function validateCommitish(commitish: string): boolean;
16
16
  export declare function shortHash(hash: string): string;
17
17
  export declare function createCommitRangeString(baseHash: string, targetHash: string): string;
18
- export interface PullRequestInfo {
18
+ interface PullRequestInfo {
19
19
  owner: string;
20
20
  repo: string;
21
21
  pullNumber: number;
package/dist/cli/utils.js CHANGED
@@ -25,7 +25,10 @@ export function shouldReadStdin(options) {
25
25
  }
26
26
  export function getGitRoot() {
27
27
  try {
28
- const result = execSync('git rev-parse --show-toplevel', { encoding: 'utf8', stdio: 'pipe' });
28
+ const result = execSync('git rev-parse --show-toplevel', {
29
+ encoding: 'utf8',
30
+ stdio: 'pipe',
31
+ });
29
32
  return result.trim();
30
33
  }
31
34
  catch {
@@ -123,12 +126,12 @@ export function parseGitHubPrUrl(url) {
123
126
  }
124
127
  export function getPrPatch(prArg) {
125
128
  try {
126
- const patch = execFileSync('gh', ['pr', 'diff', prArg, '--patch'], {
129
+ const patch = execFileSync('gh', ['pr', 'diff', prArg], {
127
130
  encoding: 'utf8',
128
131
  stdio: ['ignore', 'pipe', 'pipe'],
129
132
  });
130
133
  if (!patch.trim()) {
131
- throw new Error('No patch content returned from gh pr diff --patch');
134
+ throw new Error('No diff content returned from gh pr diff');
132
135
  }
133
136
  return patch;
134
137
  }
@@ -168,7 +171,10 @@ export function validateDiffArguments(targetCommitish, baseCommitish) {
168
171
  }
169
172
  // Cannot compare same values
170
173
  if (targetCommitish === baseCommitish) {
171
- return { valid: false, error: `Cannot compare ${targetCommitish} with itself` };
174
+ return {
175
+ valid: false,
176
+ error: `Cannot compare ${targetCommitish} with itself`,
177
+ };
172
178
  }
173
179
  // "working" shows unstaged changes and can only be compared with staging area
174
180
  if (targetCommitish === 'working' && baseCommitish && baseCommitish !== 'staged') {