4 releases
| 0.2.3 | Apr 6, 2026 |
|---|---|
| 0.2.2 | Apr 6, 2026 |
| 0.2.0 | Apr 6, 2026 |
| 0.1.0 | Apr 6, 2026 |
#850 in Web programming
25KB
579 lines
code-cli
Project session manager — select a repo, pick a worktree, launch tmux.
Usage
code-cli [PROJECT] [--clone <url>] [--create]
With no arguments, fzf opens over your project directories for interactive selection.
# Interactive picker
code-cli
# Open a project by name (exact or fuzzy match)
code-cli myproject
# Create a new project directory (when no match is found)
code-cli myproject --create
# Clone a repo and open it
code-cli --clone https://github.com/user/repo
# Clone with a custom directory name
code-cli myname --clone https://github.com/user/repo
If the selected project has multiple git worktrees, you'll get a second fzf prompt to pick one. The tmux session is then named repo/branch.
How It Works
- Resolve a project directory from
$XDG_SOURCE_HOME(default~/.local/src) - If the project has multiple git worktrees, prompt to pick one
- Create a tmux session (or attach to an existing one)
- Optionally run a project-specific init script to set up windows/panes
Init Scripts
On new session creation, code-cli looks for a bash init script to bootstrap the tmux layout:
$TMUX_SCRIPT_HOME/<session>(or~/.config/tmux/projects/<session>)- Falls back to
$TMUX_SCRIPT_HOME/$TMUX_SCRIPT_DEFAULT(default name:general)
The script receives the session name as $1 and the TMUX_SESSION environment variable.
Environment Variables
| Variable | Default | Description |
|---|---|---|
XDG_SOURCE_HOME |
~/.local/src |
Root directory containing projects |
TMUX_SCRIPT_HOME |
~/.config/tmux/projects |
Directory containing tmux init scripts |
TMUX_SCRIPT_DEFAULT |
general |
Fallback init script name |
Dependencies
Testing
cargo test
Tests cover fuzzy matching, project resolution, worktree detection, and init script lookup. Git is required for the integration tests.
Install
cargo install --path .
Shell Completions
# Bash
code-cli --completions bash > ~/.bash_completion.d/code-cli
# Zsh
code-cli --completions zsh > ~/.zfunc/_code-cli
# Fish
code-cli --completions fish > ~/.config/fish/completions/code-cli.fish
Dependencies
~1.7–2.5MB
~42K SLoC