| Crates.io | forge-rs |
| lib.rs | forge-rs |
| version | 0.5.0 |
| created_at | 2025-07-29 00:51:22.618988+00 |
| updated_at | 2025-08-04 02:46:33.084485+00 |
| description | A powerful symlink management tool designed as a modern alternative to GNU Stow |
| homepage | |
| repository | https://github.com/jwliles/rust-forge |
| max_upload_size | |
| id | 1771767 |
| size | 332,277 |
A powerful symlink management tool designed as a modern alternative to GNU Stow.
Forge provides comprehensive symlink management with clear, intuitive commands.
-v, --verbose: Enable verbose output for debugging and troubleshooting. When set, Forge will print additional details about operations, errors, and internal state to help diagnose issues.
-I, --interactive: Use interactive mode (TUI, under development).
Stage: Temporarily track files for symlinking
Link: Create permanent symlinks for tracked files
Unlink: Remove symlinks but keep files in the forge folder
Remove: Delete files from the forge folder but keep originals
Delete: Completely remove files from the system
The codebase is organized into modules following Rust conventions:
src/
├── main.rs # Entry point and CLI definition
├── cli/ # CLI handling
│ ├── mod.rs # CLI module exports
│ └── commands.rs # Command implementations
├── config/ # Configuration handling
│ └── mod.rs # Config struct and DB connection
├── dotfile/ # Core dotfile operations
│ ├── mod.rs # DotFile struct definition
│ ├── backup.rs # Backup functionality
│ ├── link.rs # Linking functionality
│ ├── list.rs # Listing dotfiles
│ └── unlink.rs # Unlinking functionality
├── scanner/ # Directory scanning
│ └── mod.rs # Scanning functionality
├── symlink/ # Symlink operations
│ └── mod.rs # Cross-platform symlink creation
└── utils/ # Utility functions
├── mod.rs # Utils module exports
└── path_utils.rs # Path manipulation utilities
Forge excels at managing various symlink scenarios:
# Install from crates.io (binary name will be 'forge')
cargo install forge-rs
# Initialize current directory as a forge managed folder (uses directory name if no name provided)
forge init [--name dotfiles]
# Stage a file for symlinking (creates a temporary link)
forge stage nvim/init.lua
# Stage an entire directory with all its contents recursively
forge stage --recursive ~/.config/nvim
# Stage a directory with contents up to a specific depth
forge stage --depth=2 ~/.config/i3
# Create permanent symlinks for all staged files
forge link
# Remove symlinks but keep files in the forge folder
forge unlink init.lua
# Remove files from forge folder but keep originals
forge remove init.lua
# Completely delete files from the system
forge delete init.lua
# List all tracked files
forge list
# List all available profiles
forge list --profiles
# Switch to a different profile
forge switch coding
Forge includes a powerful pack-and-go system for creating portable configuration bundles that can be easily deployed on new systems or used for backup and recovery.
# 1. Initialize a new pack
forge start packing my_dotfiles
# 2. Add individual files
forge pack ~/.vimrc ~/.bashrc ~/.gitconfig
# 3. Add entire directories recursively
forge pack --recursive ~/.config/nvim/ ~/.ssh/
# 4. Add directories with limited depth
forge pack --depth 2 ~/.config/i3/
# 5. Preview what would be packed (without actually packing)
forge pack --recursive --dry-run ~/.local/bin/
# 6. Seal the pack into a portable archive
forge seal
# The result is a timestamped ZIP file: my_dotfiles-2025-06-23.zip
The pack system supports sophisticated directory handling:
# Pack entire directory trees while preserving structure
forge pack --recursive ~/.dotfiles/
# Limit recursion depth to avoid packing too much
forge pack --depth 3 ~/.config/
# Preview complex packing operations before execution
forge pack --recursive --dry-run ~/.home-configs/ ~/.work-configs/
# Combine different approaches in one pack
forge start packing mixed_environment
forge pack ~/.vimrc ~/.bashrc # Individual files
forge pack --recursive ~/.config/nvim/ # Full directory
forge pack --depth 1 ~/.local/bin/ # Limited depth
forge pack --dry-run --recursive ~/.scripts/ # Preview first
forge pack --recursive ~/.scripts/ # Then actually pack
forge seal
# Preview pack contents and installation plan
forge explain my_dotfiles-2025-06-23.zip
# Preview installation to specific directory
forge explain my_dotfiles-2025-06-23.zip --install --target /home/newuser
# Install to current directory (safe default)
forge install my_dotfiles-2025-06-23.zip
# Install to specific target directory
forge install my_dotfiles-2025-06-23.zip --target /home/user/configs
# Install with automatic home directory mapping
forge install my_dotfiles-2025-06-23.zip --map-home
# Preview installation without making changes
forge install my_dotfiles-2025-06-23.zip --dry-run --target /tmp/test
# Force installation (overwrite existing files)
forge install my_dotfiles-2025-06-23.zip --force
# Skip existing files during installation
forge install my_dotfiles-2025-06-23.zip --skip-existing
# Restore pack to original absolute paths (for backup recovery)
forge restore my_dotfiles-2025-06-23.zip
# Test restore to current directory (safe testing)
forge restore my_dotfiles-2025-06-23.zip --test
# Preview restore operation
forge restore my_dotfiles-2025-06-23.zip --dry-run
# Force restore (overwrite existing files)
forge restore my_dotfiles-2025-06-23.zip --force
# Update files in an existing pack
forge repack --scope my_dotfiles ~/.vimrc ~/.bashrc
# Update all files in a pack with current versions
forge repack --scope my_dotfiles
# Remove files from a pack
forge unpack --scope my_dotfiles ~/.old_config
# Remove and reseal
forge unpack ~/.deprecated_files
forge seal
Profiles allow you to maintain multiple configurations that target the same location:
# Create a new profile in a specific location
forge new --profile coding ~/dotfiles/coding
# List available profiles
forge list --profiles
# Switch to a profile
forge switch coding
# Initialize current directory as a new profile
forge init --name coding
Interactive TUI mode is under development. Launch with:
forge -I
Note: Interactive mode is currently a placeholder and will display a message indicating it's not fully implemented.
Note: Forge is developed exclusively for free operating systems. It is not officially tested or supported on proprietary platforms.
MIT License
Forge is under active development with the following milestones:
v0.1.x - Core CLI structure and basic functionality
v0.2.x - Basic profile system
v0.3.x - Enhanced state management
v0.4.x - Pack-and-Go System
v1.0.0 - Production release
This project follows semantic versioning (SemVer) for crates.io releases:
docs branch is used for documentation developmentfeature/* branchesmain branch before publication to crates.ioForge is designed to handle errors gracefully and report issues to the user via standard error (stderr) and exit codes.
0 on success, and a nonzero code (>0) if an error occurs.-v or --verbose flags for more detailed output. This will print additional information about what Forge is doing, including file operations, error context, and internal state.If you encounter a bug or unexpected behavior:
Contributions are welcome! Please feel free to submit a Pull Request.