Camp provides shell integration through the cgo function, which allows instant navigation to campaign directories without needing to type cd or wait for a subprocess to complete.
Add one of the following to your shell configuration:
Zsh (~/.zshrc):
eval "$(camp shell-init zsh)"Bash (~/.bashrc):
eval "$(camp shell-init bash)"Fish (~/.config/fish/config.fish):
camp shell-init fish | sourceThe cgo (camp-go) function is the primary interface for navigation. It's a shell function (not an alias or script) because it needs to change the current working directory.
# Jump to campaign root
cgo
# Jump to a category
cgo p # projects/
cgo f # festivals/
cgo i # .campaign/intents/
cgo d # docs/
cgo ai # ai_docs/
cgo w # workflow/
cgo wt # projects/worktrees/
cgo cr # workflow/code_reviews/
cgo pi # workflow/pipelines/
cgo de # workflow/design/
cgo ex # workflow/explore/
# Fuzzy search within category
cgo p api # projects/api-* (fuzzy match)
cgo f fest # festivals/*fest* (fuzzy match)| Shortcut | Directory | Description |
|---|---|---|
| p | projects/ | Project directories |
| f | festivals/ | Festival planning |
| i | .campaign/intents/ | Intents via camp intent |
| d | docs/ | Documentation |
| ai | ai_docs/ | AI documentation |
| w | workflow/ | Workflow resources |
| wt | projects/worktrees/ | Git worktrees |
| cr | workflow/code_reviews/ | Code review materials |
| pi | workflow/pipelines/ | CI/CD pipelines |
| de | workflow/design/ | Design documents |
| ex | workflow/explore/ | Exploratory notes |
cgo i is intentionally still available for operators who need the underlying
files, but day-to-day intent capture and editing should go through
camp intent.
Use -c to run a command from a category directory without changing to it:
# List projects
cgo -c p ls
# Run fest status from festivals
cgo -c f fest status
# Run tests from a project
cgo -c p api make testThe command inherits your current environment and its output goes to your terminal.
Shell integration includes intelligent tab completion:
cgo <TAB> # Shows category shortcuts
cgo p <TAB> # Shows projects in projects/
cgo p ap<TAB> # Completes to matching project namesThe completion system queries camp for real-time suggestions based on your campaign structure.
Shell integration also provides shorthand functions for common operations:
cint "my idea for a new feature"Equivalent to camp intent add "...". Quickly capture thoughts and ideas.
cieEquivalent to camp intent explore. Opens the interactive TUI for browsing, filtering, and managing intents.
cr make testEquivalent to camp run make test. Runs a command from the campaign root directory.
The cgo command must be a shell function because:
- Only shell functions can change the current directory
- Scripts and binaries run in subprocesses and cannot affect the parent shell
- Aliases don't support the complex logic needed for argument handling
cgocallscamp go --printto get the target path- If successful, it runs
cdto change to that directory - If there's an error, it shows the error message
# What happens internally:
cgo p api
# → dest=$(camp go p api --print)
# → cd "$dest"# Not in a campaign
$ cgo
Error: not in a campaign
Hint: Initialize with 'camp init' or navigate to a campaign
# Target not found
$ cgo p nonexistent
camp: not found: p nonexistent
# Multiple matches show selection
$ cgo p api
Multiple matches found:
api-service
api-gateway
Using best match: api-service- Uses
[[ ]]for conditionals - Uses
_describefor completion compdefregisters completion functions
- Compatible with bash 3.2+ (macOS default)
- Uses
[ ]for POSIX compatibility - Avoids bash 4+ features (associative arrays,
${var,,}) - Uses
complete -Ffor completion
- Uses
testinstead of[ ]or[[ ]] - Uses
set -lfor local variables - Uses
$statusinstead of$? - Array syntax:
$argv[1],$argv[2..-1] - Excellent built-in completion support
Make sure you added the shell-init line to your config and restarted your shell:
# Check if camp is available
which camp
# Re-source your config
source ~/.zshrc # or ~/.bashrc, config.fish# Zsh: Make sure compinit is loaded
autoload -Uz compinit && compinit
# Bash: Check if bash-completion is installed
type _init_completionThe target directory might not have read/execute permissions:
# Check permissions
ls -la $(camp go p --print)
# Fix if needed
chmod +x path/to/directory# Open project in editor
code $(camp go p api --print)
# Fuzzy search with fzf
camp go p --print | fzf | xargs cd
# Copy path to clipboard
camp go p api --print | pbcopyThe shell integration supports custom shortcut mappings (future feature). For now, you can add aliases:
alias cdp='cgo p'
alias cdf='cgo f'