Overview
Repo Manager provides hooks that execute after specific commands. You can override these hooks to customize behavior, such as opening editors, switching tmux sessions, or running custom scripts.Available Hooks
All hooks receive the repository or worktree path as their first argument ($1).
post_repo_clone
Executes after successfully cloning a repository.$1- Path to the cloned repository
post_repo_goto
Executes after navigating to a repository withrepo goto.
$1- Path to the repository or worktree
post_repo_new
Executes after creating a new repository withrepo new.
$1- Path to the newly created repository
post_wt_add
Executes after adding a new worktree withrepo wt add or repo wt pr.
$1- Path to the new worktree
post_wt_go
Executes after navigating to a worktree withrepo wt go.
$1- Path to the worktree
post_wt_rm
Executes after removing a worktree withrepo wt rm.
$1- Path to the removed worktree
: is a no-op in shell).
Overriding Hooks
Define hook functions in your.zshrc after loading the plugin:
Real-World Examples
Open in VS Code
Automatically open repositories in VS Code after cloning:Switch tmux Session
Create or switch to a tmux session named after the repository:Run Setup Scripts
Automatically run setup scripts for new repositories:Notify on Completion
Send desktop notifications when operations complete:Open in Split Pane
Open worktrees in a new tmux pane:Conditional Behavior
Different actions based on repository characteristics:Best Practices
- Always include
cd "$1"if you want to change directory - Test hooks with simple commands before adding complex logic
- Use
[[ -f file ]]checks before running file-dependent commands - Handle cases where external tools (VS Code, tmux) aren’t installed
- Keep hooks fast to avoid slowing down operations
Tips
- Hooks run in the current shell context, so
cdchanges persist - Use
return 1to indicate an error, but it won’t prevent the operation from succeeding - Access environment variables and other shell functions normally
- Hooks don’t receive stderr/stdout from the original command