A tool to snapshot and reproduce development environments across machines.
go-dev-snapshot is a CLI tool that inspects your system and captures information about installed development tools, versions, environment variables, and configuration files. It supports exporting snapshots in both YAML and JSON formats and includes adapters for common development ecosystems (Go, Node.js, Python, Docker).
- System Inspection: Automatically detects installed development tools and their versions
- Environment Capture: Records relevant environment variables (PATH, GOPATH, etc.)
- Ecosystem Adapters: Deep inspection of Go, Node.js, Python, and Docker environments
- Multiple Formats: Export snapshots as YAML or JSON
- Compare Mode: Compare two snapshots to see what changed
- Restore Mode: Generate restoration instructions from a snapshot
- Configuration Tracking: Track presence and metadata of common config files
git clone https://github.com/BaseMax/go-dev-snapshot.git
cd go-dev-snapshot
go build -o go-dev-snapshotgo install github.com/BaseMax/go-dev-snapshot@latest
Capture the current development environment:
# Create a YAML snapshot (default) ./go-dev-snapshot snapshot --output my-env.yaml # Create a JSON snapshot ./go-dev-snapshot snapshot --output my-env.json --format json
Compare two snapshots to see what changed:
# Compare and print to stdout ./go-dev-snapshot compare --old old-env.yaml --new new-env.yaml # Save comparison to file ./go-dev-snapshot compare --old old-env.yaml --new new-env.yaml --output diff.yaml
Get instructions for restoring a development environment:
# Show restoration guide ./go-dev-snapshot restore --input my-env.yaml # Attempt automatic restoration (experimental) ./go-dev-snapshot restore --input my-env.yaml --auto --dry-run=false
A snapshot includes:
- System Info: Hostname, OS, architecture, timestamp
- Tools: Detected development tools with versions and paths
- Go, Node.js, Python, Docker, Git, Make, GCC, Rust, Java, Ruby, etc.
- Environment Variables: Important environment variables like PATH, GOPATH, etc.
- Configuration Files: Presence and metadata of common config files
- Ecosystem Details: Deep inspection of installed ecosystems:
- Go: Version, GOPATH, GOROOT, module settings
- Node.js: Version, npm version, global packages
- Python: Version, pip version, installed packages
- Docker: Version, Compose version, available images
timestamp: 2025年12月19日T17:30:05Z hostname: dev-machine os: linux arch: amd64 tools: - name: go version: go version go1.21.0 linux/amd64 path: /usr/bin/go - name: node version: v20.0.0 path: /usr/local/bin/node environment: PATH: /usr/local/bin:/usr/bin:/bin GOPATH: /home/user/go HOME: /home/user ecosystems: go: version: go version go1.21.0 linux/amd64 metadata: GOPATH: /home/user/go GOROOT: /usr/lib/go nodejs: version: v20.0.0 metadata: npm_version: 10.0.0
Create a snapshot of the current development environment.
Options:
--output- Output file path (default:snapshot.yaml)--format- Output format:yamlorjson(default:yaml)
Compare two snapshots and show differences.
Options:
--old- Old snapshot file (required)--new- New snapshot file (required)--format- Snapshot format:yamlorjson(auto-detected from file extension)--output- Output file for diff (optional, prints to stdout if not specified)
Show instructions to restore a snapshot or attempt automatic restoration.
Options:
--input- Snapshot file to restore from (required)--format- Snapshot format:yamlorjson(auto-detected from file extension)--dry-run- Dry run mode (default:true)--auto- Attempt automatic restoration (experimental)
Show version information.
Show help message.
-
Create a snapshot on your current machine:
./go-dev-snapshot snapshot --output dev-env.yaml
-
Transfer the snapshot to the new machine
-
Generate restoration instructions:
./go-dev-snapshot restore --input dev-env.yaml
-
Create a baseline snapshot:
./go-dev-snapshot snapshot --output baseline.yaml
-
Make changes to your environment (install tools, update versions, etc.)
-
Create a new snapshot:
./go-dev-snapshot snapshot --output current.yaml
-
Compare to see what changed:
./go-dev-snapshot compare --old baseline.yaml --new current.yaml
-
Share a team snapshot file via version control
-
Team members can compare their local environment:
./go-dev-snapshot snapshot --output my-env.yaml ./go-dev-snapshot compare --old team-standard.yaml --new my-env.yaml
-
Use restore to align environment:
./go-dev-snapshot restore --input team-standard.yaml
The tool is built with a modular architecture:
- Inspector: Core system inspection engine
- Adapters: Pluggable ecosystem-specific inspectors
- GoAdapter: Go ecosystem inspection
- NodeAdapter: Node.js/npm ecosystem inspection
- PythonAdapter: Python/pip ecosystem inspection
- DockerAdapter: Docker container ecosystem inspection
- Serialization: YAML and JSON export/import via
gopkg.in/yaml.v3 - Comparison: Diff engine for snapshot comparison
- Restoration: Guide generation for environment recreation
Contributions are welcome! To add support for a new ecosystem:
- Implement the
Adapterinterface - Add your adapter to the
NewInspector()function - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Created by BaseMax