How whiteheap/residue-cli works
residue is a Git-worktree cleanup tool. Users scan or explain worktrees, then remove only candidates that pass safety checks; removal can instead move a worktree to trash. Restore recovers deleted or trashed worktrees, while watch and the service automate cleanup and stats reports reclaimed space. The graph preserves these distinct stages and the internal inspection layer. Edges follow the README or source-index references; unsampled implementation details are not inferred.
Main entry points: remove.rs Safe removal · commands.rs Scan and explain · inspect.rs Worktree checks · watch.rs Automated watch
Components 18
Commands
- CLI parsing
src/cli.rs - Scan and explain
src/commands.rs - Reports
src/output.rs
Safety checks
- Repository discovery
src/discover.rs - Worktree checks
src/inspect.rs - Git operations
src/git.rs - Process activity
src/activity.rs - Filesystem usage
src/fsinfo.rs - Cleanup policy
src/policy.rs
Worktree lifecycle
- Safe removal
src/remove.rs - Worktree trash
src/trash.rs - Restore
src/restore.rs - Removal records
src/removed.rs
Automation and records
- Automated watch
src/watch.rs - Background service
src/service.rs - Cleanup statistics
src/stats.rs
Other components
- User
- Host operating system
Connections 24
- User → CLI parsing: runs commands
README.md - CLI parsing → Scan and explain: dispatches scan
src/main.rs - Scan and explain → Repository discovery: finds repositories
src/commands.rs - Scan and explain → Worktree checks: requests checks
src/commands.rs - Worktree checks → Git operations: checks Git state
src/inspect.rs - Worktree checks → Process activity: checks use
src/inspect.rs - Worktree checks → Filesystem usage: measures contents
src/inspect.rs - Worktree checks → Cleanup policy: applies rules
src/inspect.rs - Scan and explain → Reports: renders reports
src/commands.rs - Scan and explain → Safe removal: starts removal
src/commands.rs - Safe removal → Worktree checks: rechecks candidates
src/remove.rs - Safe removal → Git operations: moves worktree
src/remove.rs - Safe removal → Worktree trash: moves to trash
src/remove.rs - Safe removal → Removal records: writes records
src/removed.rs - Safe removal → Cleanup statistics: records outcome
src/remove.rs - User → Restore: requests recovery
README.md - Restore → Removal records: reads records
src/restore.rs - Restore → Worktree trash: restores entries
src/restore.rs - Automated watch → Scan and explain: runs scan
src/watch.rs - Automated watch → Safe removal: removes candidates
README.md - Automated watch → Cleanup statistics: records outcomes
src/watch.rs - Background service → Automated watch: starts watcher
src/service.rs - User → Background service: manages service
README.md - Process activity → Host operating system: probes processes
src/activity.rs