[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-73826":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":26,"readmeContent":27,"aiSummary":28,"trendingCount":15,"starSnapshotCount":15,"syncStatus":29,"lastSyncTime":30,"discoverSource":31},73826,"difit","yoshiko-pg\u002Fdifit","yoshiko-pg","A lightweight command-line tool that spins up a local web server to display Git commit diffs in a GitHub-like Files changed view","https:\u002F\u002Fyoshiko-pg.github.io\u002Fdifit\u002F",null,"TypeScript",2744,129,3,0,11,35,106,33,28.34,"MIT License",false,"main",true,[],"2026-06-12 02:03:18","\u003Ch1 align=\"center\">\n  \u003Cimg src=\"public\u002Flogo.png\" alt=\"difit\" width=\"260\">\n\u003C\u002Fh1>\n\n\u003Cp align=\"center\">\n  \u003Ca href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Fdifit\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Fdifit.svg\" alt=\"npm version\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fyoshiko-pg\u002Fdifit\u002Factions\u002Fworkflows\u002Fpr.yml\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fyoshiko-pg\u002Fdifit\u002Factions\u002Fworkflows\u002Fpr.yml\u002Fbadge.svg\" alt=\"CI\">\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003Cp align=\"center\">\n  English | \u003Ca href=\".\u002FREADME.ja.md\">日本語\u003C\u002Fa> | \u003Ca href=\".\u002FREADME.zh.md\">简体中文\u003C\u002Fa> | \u003Ca href=\".\u002FREADME.ko.md\">한국어\u003C\u002Fa>\n\u003C\u002Fp>\n\n![difit screenshot](docs\u002Fimages\u002Fscreenshot.png)\n\n**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!\n\n## ⚡ Quick Start\n\nTry it first\n\n```bash\nnpx difit  # View the latest commit diff in WebUI\n```\n\nInstall and use\n\n```bash\nnpm install -g difit\ndifit  # View the latest commit diff in WebUI\n```\n\nEnable use from AI agents\n\n```bash\nnpx skills add yoshiko-pg\u002Fdifit # Add the Skills to your agent\n```\n\nInstalled skills include:\n\n- `difit`: ask the user for a review through difit after code changes\n- `difit-review`: review a specific diff or PR and launch difit with findings or explanations preloaded as comments\n\n## 🚀 Usage\n\n### Basic Usage\n\n```bash\ndifit \u003Ctarget>                    # View single commit diff\ndifit \u003Ctarget> [compare-with]     # Compare two commits\u002Fbranches\n```\n\n### Single commit review\n\n```bash\ndifit          # HEAD (latest) commit\ndifit 6f4a9b7  # Specific commit\ndifit feature  # Latest commit on feature branch\n```\n\n### Compare two commits\n\n```bash\ndifit @ main         # Compare with main branch (@ is alias for HEAD)\ndifit feature main   # Compare branches\ndifit . origin\u002Fmain  # Compare working directory with remote main\n```\n\n### Special Arguments\n\ndifit supports special keywords for common diff scenarios:\n\n```bash\ndifit .        # All uncommitted changes (staging area + unstaged)\ndifit staged   # Staging area changes\ndifit working  # Unstaged changes only\n```\n\n### GitHub PR\n\n```bash\ndifit --pr https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo\u002Fpull\u002F123\n```\n\n`--pr` mode fetches patches by running `gh pr diff --patch` under the hood.\nIt also imports unresolved inline review threads from the PR so they appear as startup comments in difit.\n\nAuthentication is handled by GitHub CLI:\n\n1. **Login once** (recommended): `gh auth login`\n2. **Token-based auth** (CI\u002Fnon-interactive): set `GH_TOKEN` or `GITHUB_TOKEN`\n\n#### GitHub Enterprise Server\n\nFor Enterprise Server PRs, authenticate GitHub CLI against your Enterprise host:\n\n1. `gh auth login --hostname YOUR-ENTERPRISE-SERVER`\n2. Or set `GH_HOST=YOUR-ENTERPRISE-SERVER` with `GH_TOKEN`\u002F`GITHUB_TOKEN`\n\n### Initial Comments\n\nYou can inject initial review comments when launching difit:\n\n```bash\ndifit --comment '{\"type\":\"thread\",\"filePath\":\"src\u002Fexample.ts\",\"position\":{\"side\":\"new\",\"line\":10},\"body\":\"The background for this change is...\"}'\n```\n\n`--comment` is repeatable and accepts either a single JSON object or a JSON array. Supported types:\n\n- `thread`: create a new thread at the specified diff position\n- `reply`: add a reply to the latest existing thread at the same diff position\n\nIf the same comment already exists, difit skips importing it.\n\n### Stdin\n\nBy using a pipe to pass unified diffs via stdin, you can view diffs from any tool with difit.\n\n```bash\n# View diffs from other tools\ndiff -u file1.txt file2.txt | difit\n\n# Review saved patches\ncat changes.patch | difit\n\n# Compare against merge base\ngit diff --merge-base main feature | difit\n\n# Review an entire existing file as newly added\ngit diff -- \u002Fdev\u002Fnull path\u002Fto\u002Ffile | difit\n\n# Explicit stdin mode\ngit diff --cached | difit -\n```\n\nStdin mode is selected with intent-first rules:\n\n- `-` explicitly enables stdin mode\n- If positional arguments (`\u003Ctarget>` \u002F `[compare-with]`) or `--pr` are provided, difit treats the command as Git\u002FPR mode and does not auto-read stdin\n- Auto stdin detection applies only when no explicit mode is selected and stdin is a pipe\u002Ffile\u002Fsocket\n\n## ⚙️ CLI Options\n\n| Flag                  | Default         | Description                                                                                             |\n| --------------------- | --------------- | ------------------------------------------------------------------------------------------------------- |\n| `\u003Ctarget>`            | HEAD            | Commit hash, tag, HEAD~n, branch, or special arguments                                                  |\n| `[compare-with]`      | -               | Optional second commit to compare with (shows diff between the two)                                     |\n| `--merge-base`        | false           | Resolve the base revision with `git merge-base` before diffing (Git revision mode only)                 |\n| `--pr \u003Curl>`          | -               | GitHub PR URL to review (e.g., https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo\u002Fpull\u002F123)                                  |\n| `--comment \u003Cjson>`    | -               | Inject initial comments (repeatable; accepts a JSON object or array)                                    |\n| `--port`              | 4966            | Preferred port; falls back to +1 if occupied                                                            |\n| `--host`              | 127.0.0.1       | Host address to bind server to (use 0.0.0.0 for external access)                                        |\n| `--no-open`           | false           | Don't automatically open browser                                                                        |\n| `--clean`             | false           | Clear all existing comments and viewed files on startup                                                 |\n| `--include-untracked` | false           | Automatically include untracked files in diff (only with `.` or `working`)                              |\n| `--keep-alive`        | false           | Keep server running after browser disconnects (stop manually with Ctrl+C)                               |\n| `--background`        | false           | Keep the server running in the background and output JSON connection info                               |\n| `--context \u003Clines>`   | git default (3) | Limit surrounding context lines per change (`0` shows changes only; not available with `--pr` or stdin) |\n\n## 💬 Comment System\n\ndifit includes a review comment system that makes it easy to provide feedback to AI coding agents:\n\n1. **Add Comments**: Click the comment button on any diff line or drag to select a range\n2. **Edit Comments**: Edit existing comments with the edit button\n3. **Generate Prompts**: Comments include a \"Copy Prompt\" button that formats the context for AI coding agents\n4. **Copy All**: Use \"Copy All Prompt\" to copy all comments in a structured format\n5. **Persistent Storage**: Comments are saved in browser localStorage per commit\n\n### Comment Prompt Format\n\n```sh\nsrc\u002Fcomponents\u002FButton.tsx:L42   # This line is automatically added\nMake this variable name more descriptive\n```\n\nFor range selections:\n\n```sh\nsrc\u002Fcomponents\u002FButton.tsx:L42-L48   # This line is automatically added\nThis section is unnecessary\n```\n\n## 🤖 Calling from Agents\n\nYou can install the following Skills to work with difit from AI agents.\n\n```sh\nnpx skills add yoshiko-pg\u002Fdifit\n```\n\nInstalled skills include:\n\n- `difit`: ask the user for a review through difit after code changes\n- `difit-review`: review a specific diff or PR and launch difit with findings or explanations preloaded as comments\n\nAfter code edits or automated review, the agent can start the difit server with the appropriate skill.\n\n## 🎨 Syntax Highlighting Languages\n\n- **JavaScript\u002FTypeScript**: `.js`, `.jsx`, `.ts`, `.tsx`\n- **Web Technologies**: HTML, CSS, JSON, XML, Markdown\n- **Shell Scripts**: `.sh`, `.bash`, `.zsh`, `.fish`\n- **Backend Languages**: PHP, SQL, Ruby, Java, Scala, Perl, Elixir, Haskell, Clojure\n- **Systems Languages**: C, C++, C#, Rust, Go\n- **Mobile Languages**: Swift, Kotlin, Dart\n- **Infrastructure as Code**: Terraform (HCL), Nix\n- **Others**: Python, Protobuf, YAML, Solidity, Vim script\n\n## 🔍 Auto-collapsed Files\n\ndifit automatically identifies and collapses certain files to keep your view clean:\n\n- **Deleted files**: Removed files are auto-collapsed since they don't require close review\n- **Generated files**: Auto-generated code is collapsed by default. This includes:\n  - Lock files (`package-lock.json`, `go.mod`, `Cargo.lock`, `Gemfile.lock`, etc.)\n  - Minified files (`*.min.js`, `*.min.css`)\n  - Source maps (`*.map`)\n  - Generated code:\n    - Orval (`*.msw.ts`, `*.zod.ts`, `*.api.ts`)\n    - Dart (`*.g.dart`, `*.freezed.dart`)\n    - C# (`*.g.cs`, `*.designer.cs`)\n    - Protobuf (`*.pb.go`, `*.pb.cc`, `*.pb.h`)\n  - Frameworks:\n    - Ruby on Rails (`db\u002Fschema.rb`)\n    - Laravel (`_ide_helper.php`)\n    - Gradle (`gradle.lockfile`)\n    - Python (`uv.lock`, `pdm.lock`)\n  - Generic generated files (`*.generated.cs`, `*.generated.ts`, `*.generated.js`)\n  - Content-based detection:\n    - Files containing `@generated` marker\n    - Files containing `DO NOT EDIT` header\n    - Language-specific generated headers (Go, Python, etc.)\n\n## 🛠️ Development\n\n```bash\n# Install dependencies\npnpm install\n\n# Start development server (with hot reload)\n# This runs both Vite dev server and CLI with NODE_ENV=development\npnpm run dev\n\n# Build and start production server\npnpm run start \u003Ctarget>\n\n# Build for production\npnpm run build\n\n# Run tests\npnpm test\n\n# Run typecheck, lint, and format\npnpm run check\npnpm run format\n```\n\n### Development Workflow\n\n- **`pnpm run dev`**: Starts both Vite dev server (with hot reload) and CLI server simultaneously\n- **`pnpm run start \u003Ctarget>`**: Builds everything and starts production server (for testing final build)\n- **Development mode**: Uses Vite's dev server for hot reload and fast development\n- **Production mode**: Serves built static files (used by npx and production builds)\n\n## 🏗️ Architecture\n\n- **CLI**: Commander.js for argument parsing with comprehensive validation\n- **Backend**: Express server with simple-git for diff processing\n- **GitHub Integration**: GitHub CLI (`gh pr diff --patch`) for PR patch retrieval\n- **Frontend**: React 18 + TypeScript + Vite\n- **Styling**: Tailwind CSS v4 with GitHub-like dark theme\n- **Syntax Highlighting**: Prism.js with dynamic language loading\n- **Testing**: Vitest for unit tests with co-located test files\n- **Quality**: oxlint, oxfmt, lefthook pre-commit hooks\n\n## 📋 Requirements\n\n- Node.js ≥ 21.0.0\n- Git repository with commits to review\n- GitHub CLI (`gh`) for `--pr` mode\n\n## 📄 License\n\nMIT\n","difit 是一个轻量级的命令行工具，用于在本地启动一个Web服务器来以类似GitHub的“文件更改”视图显示Git提交差异。其核心功能包括支持单个或多个提交之间的差异比较、未提交更改预览以及直接从GitHub Pull Request获取并展示差异。difit 采用TypeScript编写，具有简洁直观的用户界面，并允许将评论作为AI提示复制，适用于代码审查场景，特别是在利用AI辅助进行本地代码审查时。此外，通过与GitHub CLI集成，difit 还能处理来自GitHub Pull Request的未解决内联审阅线程，进一步增强了其在团队协作中的实用性。",2,"2026-06-11 03:47:33","high_star"]