A lightweight, fast CLI tool written in Rust to snapshot and restore Linux dev workspaces.
Crates I used:
| Crate | Purpose |
|---|---|
clap |
Subcommand parsing (init, save, restore, rewrite, delete) using derive macros |
serde / serde_json |
Serializes structured workspace snapshot files to disk |
inquire |
Provides interactive terminal prompts and selection menus |
sysinfo |
Queries the system process table to inspect running application instances |
rust-ini |
Parses INI configuration files (e.g., Firefox profile paths) |
lz4_flex |
High-performance LZ4 compression support for compact snapshot data |
dirs |
Cross-platform resolution of user directories (~/.local/share/devsnap/) |
anyhow |
Idiomatic, flexible Rust error handling |
DevSnap reads the current VS Code workspace state and Firefox session files from their local application directories. It saves the collected data as named JSON snapshots in ~/.local/share/devsnap/snapshots/, then reads those snapshots to restore the workspace.
Install Rust and Cargo, then build DevSnap from source:
git clone https://github.com/your-username/DevSnap.git
cd DevSnap
cargo build --releaseThe compiled executable will be generated at target/release/devsnap.
To run devsnap from anywhere in your shell, copy the binary to your local PATH (ensure ~/.local/bin is included in your $PATH):
cp target/release/devsnap ~/.local/bin/DevSnap combines direct subcommands with interactive terminal menus (inquire).
Initializes the local snapshot storage directory (~/.local/share/devsnap/snapshots/).
devsnap initCaptures your active VS Code workspaces and Firefox sessions into a named snapshot.
devsnap save <workspace-name>Example:
devsnap save backend-refactorOpens an interactive terminal menu listing saved snapshots. Selecting a workspace launches its applications and restores your environment.
devsnap restoreInteractively select and overwrite an existing snapshot with your current workspace state.
devsnap rewriteOpens an interactive terminal menu to delete a saved workspace snapshot.
devsnap delete