skybox hook
Output shell hook code for auto-starting containers when entering project directories.
Usage
bash
skybox hook [shell]Arguments
| Argument | Required | Description |
|---|---|---|
shell | No | Shell type: bash or zsh |
Description
The hook command outputs shell code that integrates SkyBox with your shell. When installed, this hook automatically starts containers when you cd into a SkyBox project directory.
The hook:
- Runs on every prompt (via
PROMPT_COMMANDfor bash,precmdfor zsh) - Only triggers when the directory actually changes
- Runs container startup in the background (doesn't block your prompt)
- Respects the
auto_upconfiguration setting per project
Installation
Add the appropriate line to your shell configuration file:
Bash
bash
echo 'eval "$(skybox hook bash)"' >> ~/.bashrc
source ~/.bashrcZsh
bash
echo 'eval "$(skybox hook zsh)"' >> ~/.zshrc
source ~/.zshrcConfiguration
The hook only auto-starts containers for projects with auto_up enabled.
Enable it globally in ~/.skybox/config.yaml:
yaml
defaults:
auto_up: trueOr per-project by editing ~/.skybox/config.yaml directly:
yaml
projects:
my-project:
remote: my-server
auto_up: trueSee Shell Integration for detailed configuration options.
Examples
bash
# Output bash hook code
skybox hook bash
# Output zsh hook code
skybox hook zsh
# Install for bash (one-time setup)
echo 'eval "$(skybox hook bash)"' >> ~/.bashrc
# Verify hook is active (bash)
echo "$PROMPT_COMMAND"
# Should contain: _skybox_hookLogging
Auto-up activity is logged to:
~/.skybox/logs/auto-up.logView recent activity:
bash
cat ~/.skybox/logs/auto-up.logExit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Invalid or missing shell argument |
See Also
- Shell Integration Guide - Detailed setup and troubleshooting
- Configuration Reference -
auto_upsetting documentation - skybox up - Manual container startup