How zetaloop/desktop works
GitHub Desktop 中文版 is an Electron Git client for managing local repositories and working with GitHub. Users add or clone repositories, inspect branches, changes and history, then perform Git operations and interact with GitHub features such as pull requests and CI checks. The renderer presents repository workflows; the main process handles desktop integration, and shared state/models represent repository data. The README documents additional Copilot, Difftastic and localization enhancements. Several subsystems are represented from the tree and README rather than sampled implementation, so their connections are marked unverified.
Main entry points: app.tsx Desktop renderer · main.ts Electron main · clone-repository.tsx Add and clone repositories · git Git operations
Components 23
Desktop application
- Electron main
app/src/main-process/main.ts - Desktop renderer
app/src/ui/app.tsx - Action dispatcher
app/src/ui/dispatcher/dispatcher.ts - Application state
app/src/lib/app-state.ts - Dialogs and popups
app/src/models/popup.ts
Repository workflows
- Add and clone repositories
app/src/ui/clone-repository/clone-repository.tsx - Working changes
app/src/ui/changes/changes.tsx - Diff inspection
app/src/ui/diff/index.tsx - Commit history
app/src/ui/history/index.ts - Branches and PRs
app/src/ui/branches/branches-container.tsx - Repository model
app/src/models/repository.ts - Branch model
app/src/models/branch.ts
GitHub collaboration
- CI checks
app/src/lib/ci-checks/ci-checks.ts
Git and platform services
- Git operations
app/src/lib/git - GitHub API
app/src/lib/api.ts - GitHub accounts
app/src/models/account.ts - Desktop notifications
app/src/main-process/notifications.ts
Localized enhancements
- Copilot assistance
app/src/lib/stores/copilot-store.ts - Difftastic integration
app/src/lib/difft/invoke-difft.ts - Git output localization
app/src/lib/actions-log-parser/action-log-parser.ts - Automatic updates
app/src/main-process/squirrel-updater.ts
Other components
- Desktop user
- GitHub services
Connections 22
- Desktop user → Desktop renderer: uses
- Desktop renderer → Action dispatcher: dispatches actions
app/src/ui/app.tsx - Desktop renderer → Application state: uses state
app/src/ui/app.tsx - Desktop renderer → Dialogs and popups: renders dialogs
app/src/ui/app.tsx - Desktop renderer → Git operations: checks repository
app/src/ui/app.tsx - Desktop renderer → Add and clone repositories: offers cloning
- Desktop renderer → Working changes: presents changes
- Desktop renderer → Diff inspection: presents diffs
- Desktop renderer → Commit history: presents history
- Desktop renderer → Branches and PRs: presents branches
- Action dispatcher → Application state: updates
- Repository model → Branch model: uses branch data
app/src/models/repository.ts - GitHub accounts → GitHub API: uses API endpoints
app/src/models/account.ts - Electron main → Desktop notifications: initializes
app/src/main-process/main.ts - Electron main → GitHub services: notifies
app/src/main-process/main.ts - Branches and PRs → CI checks: shows check status
- Copilot assistance → GitHub services: uses Copilot
- Difftastic integration → Diff inspection: integrates diff tool
- Git output localization → Git operations: localizes output
- Electron main → Automatic updates: supports updates
app/src/main-process/main.ts - Add and clone repositories → Git operations: creates repositories
- Add and clone repositories → GitHub API: loads GitHub repositories
app/src/ui/clone-repository/clone-repository.tsx