This repository is a modular Zsh environment. This document describes the development conventions and verification workflow for the first-party code in this repo.
This repo contains:
- First-party Zsh config and tooling:
.zshrc,.zprofile,bootstrap/,scripts/,tools/ - Vendored third-party plugins:
plugins/(follow upstream conventions; do not restyle) - Non-Zsh scripts (
bash/sh/awk/etc.): follow the best practices of their target language/shell
Unless stated otherwise, the rules below apply only to first-party Zsh code.
scripts/**: seescripts/README.mdscripts/_completion/_*: seescripts/_completion/README.md
- Target shell: first-party shell code supports Zsh only.
- Shebang (executable Zsh scripts): use
#!/usr/bin/env -S zsh -f.- Library files that are only
sourced typically do not need a shebang.
- Library files that are only
- Function isolation: start functions with
emulate -L zshand explicitly manage options viasetopt/unsetopt. - I/O:
- Do not use
echo. - Use
print -r --for stdout andprint -u2 -r --for stderr. - Use
printffor snippets that may run undersh/bash(e.g., subshells,xargs,sh -c).
- Do not use
- Option parsing: prefer
zparseopts(Zsh) over GNUgetopt.
- Single file syntax check:
zsh -n -- path/to/file.zsh - Repo-wide check (recommended):
./tools/check.zsh(includes fzf-def docblock audit) - Test suite:
./tests/run.zsh
- Docblock audit (fzf-def; missing docblocks are failures):
./tools/audit-fzf-def-docblocks.zsh --check - Smoke load (isolated ZDOTDIR/cache; any stderr is a failure):
./tools/check.zsh --smoke - Bash scripts (only when touching
#!/bin/bashfiles; runs ShellCheck if installed):./tools/check.zsh --bash - Semgrep scan (bash/zsh; JSON output under
out/semgrep/):./tools/check.zsh --semgrep - Everything:
./tools/check.zsh --all
- After any code change: run
./tools/check.zsh. ./tools/check.zshincludes the fzf-def docblock audit; run./tools/audit-fzf-def-docblocks.zsh --checkdirectly only when you want the standalone report.- If you changed bootstrap/startup/plugin loading: also run
./tools/check.zsh --smoke. - If you added a new feature: add/update a smoke test under
tests/(fast, deterministic) and run./tests/run.zsh. - If you changed any
#!/bin/bashscripts: also run./tools/check.zsh --bash. - For PRs and change reviews: record each relevant check as
pass,failed, ornot run(with a short reason).