|
| 1 | +# Repository Guidelines |
| 2 | + |
| 3 | +## Project Structure & Module Organization |
| 4 | +- `setup/`: Mac bootstrap scripts (`setup.sh`, `mac_settings.sh`, `packages.sh`, `duti.sh`, `mas.sh`). |
| 5 | +- `bashrc/`: Modular shell config loaded via `bashrc/main.sh` (aliases, prompt, path, language toolchains). |
| 6 | +- `bin/`: Small utilities and helpers used interactively (e.g., `git-clean-branches`, `dropbox_backup`). |
| 7 | +- `docs/`: Install script served at `dotfiles.ndbroadbent.com` (curl-to-install). |
| 8 | +- Other: `starship.toml` (prompt), `.shellcheckrc`, `.cspell.json`, `applescript/`, `karabiner-elements/`, `rails_shell/`. |
| 9 | + |
| 10 | +## Build, Test, and Development Commands |
| 11 | +- Bootstrap locally: `./setup.sh` — installs tools, applies macOS defaults, sets Bash as shell, and opens key apps. Do not run with sudo. |
| 12 | +- Run a single module: `bash setup/mac_settings.sh` or `bash setup/packages.sh`. |
| 13 | +- Lint shell scripts: `shellcheck setup/*.sh bashrc/*.sh bin/*` (respects `.shellcheckrc`). |
| 14 | +- Spell-check identifiers/docs: `cspell "**/*"` (uses `.cspell.json`). |
| 15 | +- Quick syntax check: `bash -n path/to/script.sh`. |
| 16 | + |
| 17 | +## Coding Style & Naming Conventions |
| 18 | +- Shell: target Bash, enable strictness (`set -eo pipefail`), prefer POSIX where easy. |
| 19 | +- Indentation: 2 spaces; no tabs. |
| 20 | +- Filenames: lowercase, hyphenated; executable scripts with `.sh` when run via `bash`. |
| 21 | +- Env/paths: reference `"$DOTFILES_PATH"` and quote all variable expansions. |
| 22 | +- Output: concise, actionable messages; avoid noisy `set -x` in committed code. |
| 23 | + |
| 24 | +## Testing Guidelines |
| 25 | +- Local verification: run target script in isolation first (e.g., `bash setup/duti.sh`). |
| 26 | +- Linting is required for changes in `setup/`, `bashrc/`, or `bin/`. |
| 27 | +- Manual smoke tests: open a new shell to ensure `bashrc/main.sh` loads without errors; verify expected tools on PATH and prompt shows correctly. |
| 28 | +- Risky/macOS-defaults changes: test on a non-primary machine or VM snapshot. |
| 29 | + |
| 30 | +## Commit & Pull Request Guidelines |
| 31 | +- Commits: imperative, scoped messages (e.g., `setup: refine Homebrew casks`, `bashrc: fix prompt init`). |
| 32 | +- PRs: include summary, rationale, affected scripts, manual test notes (commands run + observed results), and screenshots when UI settings change. |
| 33 | +- Keep changes small and reversible; avoid committing machine-specific artifacts. |
| 34 | + |
| 35 | +## Security & Configuration Tips |
| 36 | +- Never run `setup.sh` as root; script enforces non-sudo. |
| 37 | +- Prefer local clone for development over `curl | bash` from `docs/`. |
| 38 | +- Avoid secrets in repo; use `direnv` and private env files instead. |
0 commit comments