How vairan37/snatch works
Snatch is a Git snapshot manager for AI-assisted development: users capture lightweight snapshots, inspect diffs, restore or delete them, and squash a session into a regular commit. The desktop UI fronts a Rust CLI sidecar, which operates on Git repositories and stores snapshots under hidden refs. The README also describes project selection, AI-assisted pre-prompt saves, Git history, settings, and an integrated terminal. UI-to-CLI and sampled command relationships are supported by excerpts; some unsampled command internals and Tauri wiring are not shown.
Main entry points: App.tsx App Shell · main.rs CLI Dispatcher · refs.rs Snapshot Refs · SnapshotsModule.tsx Snapshots Panel
Components 28
Desktop UI
- App Shell
snatch-ui/src/App.tsx - Project Picker
snatch-ui/src/components/WelcomeScreen.tsx - Snapshots Panel
snatch-ui/src/components/SnapshotsModule.tsx - Diff Viewer
snatch-ui/src/components/DiffViewer.tsx - Save Bar
snatch-ui/src/components/SaveBar.tsx - Squash Dialog
snatch-ui/src/components/SquashModal.tsx - Git Graph
snatch-ui/src/components/GitGraph.tsx - Settings UI
snatch-ui/src/components/SettingsModule.tsx - AI Chat
snatch-ui/src/components/ChatModule.tsx - Integrated Terminal
snatch-ui/src/components/Terminal.tsx
CLI Bridge
- Sidecar Client
snatch-ui/src/lib/snatch.ts - CLI Dispatcher
src/main.rs
Snapshot Engine
- Repository Init
src/commands/init.rs - Snapshot Capture
src/commands/save.rs - Snapshot Listing
src/commands/list.rs - Snapshot Diff
src/commands/diff.rs - Snapshot Restore
src/commands/restore.rs - Snapshot Deletion
src/commands/drop.rs - Session Squash
src/commands/squash.rs - Snapshot Refs
src/git/refs.rs - Snapshot Metadata
src/git/snapshot.rs - CLI Config
src/config.rs
Project Services
- App Settings
snatch-ui/src/lib/settings.ts - Git Commands
snatch-ui/src/lib/git.ts - AI Providers
snatch-ui/src/lib/ai.ts
Other components
- Developer
- Git Repository
- AI Services
Connections 39
- Developer → App Shell: uses
README.md - App Shell → Project Picker: shows
snatch-ui/src/App.tsx - App Shell → Snapshots Panel: shows
snatch-ui/src/App.tsx - App Shell → Git Graph: shows
snatch-ui/src/App.tsx - App Shell → Settings UI: shows
snatch-ui/src/App.tsx - App Shell → AI Chat: shows
snatch-ui/src/App.tsx - App Shell → Integrated Terminal: shows
snatch-ui/src/App.tsx - App Shell → App Settings: loads
snatch-ui/src/App.tsx - App Shell → Sidecar Client: calls
snatch-ui/src/App.tsx - App Shell → Git Commands: calls
snatch-ui/src/App.tsx - Snapshots Panel → Sidecar Client: calls
snatch-ui/src/components/SnapshotsModule.tsx - Snapshots Panel → Diff Viewer: renders
snatch-ui/src/components/SnapshotsModule.tsx - Snapshots Panel → Save Bar: renders
snatch-ui/src/components/SnapshotsModule.tsx - Snapshots Panel → Squash Dialog: renders
snatch-ui/src/components/SnapshotsModule.tsx - Sidecar Client → CLI Dispatcher: executes sidecar
snatch-ui/src/lib/snatch.ts - CLI Dispatcher → Repository Init: dispatches
src/main.rs - CLI Dispatcher → Snapshot Capture: dispatches
src/main.rs - CLI Dispatcher → Snapshot Listing: dispatches
src/main.rs - CLI Dispatcher → Snapshot Diff: dispatches
src/main.rs - CLI Dispatcher → Snapshot Deletion: dispatches
src/main.rs - CLI Dispatcher → Snapshot Restore: dispatches
src/main.rs - CLI Dispatcher → Session Squash: dispatches
src/main.rs - Snapshot Capture → Snapshot Refs: updates refs
src/commands/save.rs - Snapshot Capture → Snapshot Metadata: creates metadata
src/commands/save.rs - Snapshot Listing → Snapshot Refs: lists refs
src/commands/list.rs - Snapshot Listing → Snapshot Metadata: reads metadata
src/commands/list.rs - Snapshot Diff → Snapshot Refs: resolves snapshot
src/commands/diff.rs - Snapshot Restore → Snapshot Refs: resolves snapshot
src/commands/restore.rs - Snapshot Deletion → Snapshot Refs: deletes ref
src/commands/drop.rs - Session Squash → Snapshot Refs: lists and deletes
src/commands/squash.rs - Session Squash → Snapshot Metadata: reads metadata
src/commands/squash.rs - CLI Dispatcher → CLI Config: loads
src/main.rs - Snapshot Listing → CLI Config: formats output
src/commands/list.rs - Snapshot Refs → Git Repository: manages hidden refs
README.md - Git Commands → Git Repository: runs commands
snatch-ui/src/lib/git.ts - Settings UI → App Settings: reads settings
snatch-ui/src/components/SettingsModule.tsx - AI Chat → Sidecar Client: saves snapshots
snatch-ui/src/components/ChatModule.tsx - AI Chat → AI Providers: requests AI
snatch-ui/src/components/ChatModule.tsx - AI Providers → AI Services: calls providers