sprout is a CLI tool that automates and simplifies the setup of independent development environments for each branch in development workflows using git worktree and docker compose.
- Create git worktrees
- Automatically generate
.envfiles from.env.exampletemplates (when templates exist) - Automatic port number assignment (collision avoidance)
- Interactive environment variable configuration
- Works in any git repository, with or without
.env.examplefiles
- Centralize all worktrees in
.sprout/directory - Management features like list display, deletion, and path retrieval
- Visual display of current worktree
- Focus on minimum necessary features
- Intuitive command structure
- No configuration files required
- Confirmation prompts for delete operations
- Proper rollback on errors
- Automatic port collision avoidance
- Environment setup with single command
- Reuse of environment variables (automatic retrieval from shell environment variables)
- Maintain compatibility with Docker Compose variable syntax
/your-project
├── .git/
├── .sprout/ # sprout management directory
│ └── <branch-name>/ # each worktree
│ ├── .env # auto-generated environment config (if .env.example exists)
│ └── ... # source code
├── .env.example # template (optional)
└── compose.yaml # Docker Compose config
{{ VARIABLE }}: User input or environment variable{{ auto_port() }}: Automatic port assignment${...}: Docker Compose variables (preserved as-is)
- Language: Python 3.11+
- CLI Framework: Typer
- UI: Rich (colorful output)
- Package Management: Hatch, uv
- Git repository check
- File existence verification
- Port availability validation
- User cancellation support
- Unit tests (pytest)
- Integration tests
- External command testing with mocks
- Coverage target: 80% or higher