Hero Dev Tools - Developer Session Manager
A Rust CLI tool for managing developer sessions with btrfs snapshots, enabling isolated Claude coding environments.
Overview
Hero Dev Tools manages developer sessions where each session gets a btrfs snapshot of /code, allowing developers to make changes in isolation. Sessions are tied to system users named dev_${name}.
System Requirements
- Ubuntu Linux
- sudo privileges
- The following packages (auto-installed by
herodev init):- git
- buildah
- podman
- btrfs-progs
Installation
# Binary will be at target/release/hero-dev-tools
Quick Start
Run init to check and install all dependencies:
# Interactive mode - will prompt before installing
# Force mode - automatically install everything without prompts
# Specify btrfs image size (default: 50GB)
Usage
Global Options
Commands
# System setup and checks
# Session management
# Repository management
# Changes management
Interactive Mode
Launch the interactive TUI menu:
Init Process
The hero-dev-tools init command performs the following:
-
System Checks
- Verifies Ubuntu Linux
- Verifies sudo access
- Checks for required packages (git, buildah, podman, btrfs-progs)
- Checks if /code is a btrfs subvolume
-
Package Installation (if missing)
- Runs
apt-get update - Installs missing packages
- Runs
-
Btrfs Setup (if /code not configured)
- Creates a loopback btrfs image at
/var/lib/btrfs-code.img - Formats as btrfs filesystem
- Creates root subvolume
- Mounts at
/code - Adds entry to
/etc/fstabfor persistence
- Creates a loopback btrfs image at
Directory Conventions
/code/ # Root btrfs subvolume
├── .sessions/ # Session snapshots
│ └── dev_<name>/ # Individual session snapshot
├── ${serverhostname}/ # Server hostname (regular directory)
│ ├── ${orgname}/ # Organization (regular directory)
│ │ └── ${reponame}/ # Git repository (regular directory)
How It Works
-
Session Creation: Creates a new Linux user
dev_<name>and a btrfs snapshot of/codeat/code/.sessions/dev_<name> -
Isolation: Each session has its own copy of the codebase via copy-on-write btrfs snapshots
-
Mount Namespace: When entering a session, HeroDev uses Linux mount namespaces to bind-mount the session's snapshot to
/code. This means inside the session,/codeshows the session's isolated copy while the rest of the system sees the original/code -
Changes Tracking: HeroDev can scan for git repositories with uncommitted changes within a session
-
Push Changes: Commit and push changes from session repos back to their remotes
-
Repository Reorganization: Move repositories to follow the
/code/{server}/{org}/{repo}convention based on their git remote URLs
Features
- Automatic Setup:
hero-dev-tools initinstalls all dependencies and configures btrfs - Force Mode: Use
-fflag to skip all prompts for scripted deployments - System Checks: Verify Ubuntu, btrfs, sudo, git, buildah, podman availability
- Session CRUD: Create, list, enter, and delete developer sessions
- Git Integration: Scan repos, detect changes, commit and push
- Repository Reorganization: Auto-organize repos by remote URL structure
- Interactive TUI: Menu-driven interface with colored output
- CLI Interface: Scriptable commands for automation
License
Apache-2.0