Topics keep behavior modular while integrating with centralized execution. We call these topic hooks. All the hooks are optional:
tools/mytool/
├── install.sh # Install dependencies/tools
├── configure.sh # Configure runtime or generate artifacts
├── update.sh # Refresh repo state from local state
├── exports.sh # Environment variables and PATH
├── aliases.sh # Aliases
└── functions.sh # Shell functions
Note that the hooks are executed in the following order. This is useful because you might need to do some setup in the install before you can really configure the tool.
Goal: run the initial setup of the topic. If the topic has installation requirements not supported by the package manager, it will be done here.
Note
The package manager itself has its own install script (check brew). This doesn't install the topic itself, but all the dependencies managed by the package manager.
Goal: configure the installed tools. Generate files/state needed for runtime. As it runs after install.sh, it can assume the installation and dependencies are completed.
Tip
Configures are very useful when the tool is installed in the package manager, but we need to run the tool itself to generate completions.
Goal: Sync local state back into repo-managed files when needed. Executed by dotfiles update.
Goal: Define runtime shell behavior.
Use Dotbot for filesystem and link orchestration, not per-topic runtime logic.
- Add directory requirements under
create. - Add symlinks under
link. - Add conditional links with
ifwhen OS-specific. - Keep executable orchestration in scripts (
install.sh/configure.sh).
- Put
~/.*-style home dotfiles inetc/when they conceptually belong to home root. - Put tool/editor specific files in their topic directory (for example
tools/*,editors/*,langs/*) and link them to their target path frominstall.conf.yaml.
For script output consistency, source scripts/tools and use:
info "..."success "..."warning "..."fail "..."user "..."
These helpers preserve indentation (LOG_DEPTH) across nested execution.
Use this pattern at the top of topic scripts:
#!/usr/bin/env sh
DOTFILES_ROOT=$(pwd -P)
# shellcheck source=../../scripts/tools
. "$DOTFILES_ROOT/scripts/tools"
info "Starting topic configuration"
if command -v mytool >/dev/null 2>&1; then
success "mytool found"
else
warning "mytool not found, skipping"
fiNotes:
DOTFILES_ROOT=$(pwd -P)works because hook scripts are executed from repo root byscripts/installandscripts/configure.- If a script cannot continue, call
fail "message"to stop the flow with a clear error. - For nested operations, pass
LOG_DEPTH=$((${LOG_DEPTH:-0} + 1))to child commands to keep indentation consistent.
Use both targeted and end-to-end validation.
- Targeted script test: Run the changed script directly (for example
./tools/mytool/configure.sh). - Stage-level test: Run
dotfiles installordotfiles configure. - Full flow test: Run
dotfiles apply(or./scripts/bootstrapon a fresh machine). - Quality checks: Run
make check.