This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
npm run electron-devStarts both React development server (localhost:3000) and Electron app with hot reload.
npm run distBuilds React app and creates distributable Electron packages.
npm testRuns React test suite with Jest.
npm start- React dev server onlynpm run build- Build React app for productionnpm run electron- Start Electron with pre-built React app
This is an Electron-based desktop application for viewing Git diffs with a React frontend and Node.js backend.
Electron Main Process (electron/main.js)
- Manages SQLite database for repository history
- Handles Git operations via simple-git library
- Provides IPC APIs for frontend communication
- Database location:
app.getPath('userData')/diff-viewer.db
React Frontend (src/)
App.tsx- Main application state and repository selection logicRepositorySelector- Repository selection with history displayBranchSelector- Branch comparison interfaceDiffViewer- Syntax-highlighted diff displayFileTree- Hierarchical file navigation
Data Flow
- User selects repository via
RepositorySelector - Main process validates Git repository and saves to SQLite history
- Frontend loads branches via
simple-git - User selects branches for comparison
- Main process generates diff data per file
- Frontend displays diffs with syntax highlighting
Frontend communicates with Electron main process through these APIs:
selectDirectory()- File dialog for repository selectiongetBranches()- Get all Git branchesgetDiff(from, to)- Get diff summary between branchesgetFileDiff(from, to, file)- Get individual file diffgetRepoInfo()- Get current branch and remote infogetRepoHistory()- Get SQLite repository historysaveRepoHistory(path)- Save repository to history
SQLite table repo_history:
id(PRIMARY KEY)path(TEXT UNIQUE) - Repository pathname(TEXT) - Repository namelast_opened(DATETIME) - Last access timestamp
- Frontend: React 18, TypeScript, Tailwind CSS
- Desktop: Electron 27
- Git: simple-git library
- Database: SQLite3
- Syntax Highlighting: react-syntax-highlighter
- Icons: Lucide React
- Build: electron-builder