$ show nkzw-tech/codiff
Codiff is a desktop code review tool (Electron + React) that visualizes Git diffs, supports AI-generated narrative walkthroughs, and integrates with GitHub/GitLab pull requests. It also provides a web sharing service for walkthroughs and plans, allowing users to share review snapshots publicly. The architecture is a monorepo with three packages: `core` (React UI library), `service` (Cloudflare Workers sharing API), and `web` (Cloudflare Workers frontend for shared content). The Electron main process handles Git state reading, AI agent orchestration, configuration, and window management, while the renderer uses React with custom hooks for review state, comments, walkthrough navigation, and diff search. Key entry points include `bin/codiff.js` (CLI), `electron/main.cjs` (Electron main), `core/index.tsx` (renderer), and `web/src/App.tsx` (web app). Data flows: Git diff data is parsed in `electron/git-state/` and sent to the renderer via IPC for display. AI walkthroughs are generated by calling external agent CLIs (Codex, Claude, OpenCode, Pi) from the main process, with output parsed and cached locally. Sharing involves uploading walkthrough/plan manifests to a Cloudflare Workers API backed by D1 and R2. External dependencies include Git, `gh`/`glab` CLIs, multiple AI agent CLIs, and Cloudflare infrastructure. The codebase is well-tested with extensive unit and integration tests, and includes an evaluation framework for walkthrough quality.
The LLM identified 4 files worth highlighting for reuse:
Provides a unified interface for multiple AI agent CLIs (Codex, Claude, OpenCode, Pi) with common methods for running agents, normalizing model names, and handling errors. Demonstrates a reusable pattern for abstracting CLI-based AI backends with timeout, schema validation, and structured output parsing. Could be extracted for any project needing to integrate multiple AI providers via CLI.
Implements a central registry for application commands with keybindings, descriptions, and action handlers. Enables declarative binding between keyboard shortcuts and app actions, with support for platform-specific modifiers and layout-aware matching. Reusable in any application requiring a command palette or keyboard shortcut system.
Provides low-level Git operations (chunked `git ls-tree`, `cat-file`, `diff`) with size limits, binary detection, and lazy loading. Handles edge cases like generated files, symlinks, and deferred content. This pattern is reusable for any tool that needs efficient, safe Git data access without relying on a full Git library.
A React hook that manages a resizable sidebar with drag-to-resize, minimum/maximum width constraints, and persistence via localStorage. Handles mouse events, touch events, and edge cases like double-click reset. Reusable in any React application needing a resizable panel.