|
| 1 | +# Improvement Plan |
| 2 | + |
| 3 | +## 1) Make Lint Actionable |
| 4 | +Goal: Turn `./scripts/lint.sh` into a reliable quality gate. |
| 5 | +- Audit current `shellcheck` findings and categorize as fixable vs. intentional. |
| 6 | +- Fix high-signal warnings (quoting, redirections, `cd` safety, missing shell directive). |
| 7 | +- For intentional patterns, add `# shellcheck disable=SCxxxx` with brief justification. |
| 8 | +- Decide whether to lint `dotfiles/sh_config.d` as `bash` or `zsh` and pass `-s` to shellcheck. |
| 9 | +- Update `scripts/lint.sh` to reflect the chosen scope and add `--severity` if needed. |
| 10 | + |
| 11 | +## 2) Add Compatibility Notes |
| 12 | +Goal: Clarify OS/tooling assumptions to reduce breakage. |
| 13 | +- Document supported OS targets (macOS, Linux) and known differences (GNU/BSD utils). |
| 14 | +- Note required tools (e.g., `shellcheck`, `git`, `systemd` for `systemd/` usage). |
| 15 | +- Add bash version expectations if any scripts rely on `bash` 4+ behavior. |
| 16 | + |
| 17 | +## 3) Minimal Test/Verification Strategy |
| 18 | +Goal: Provide low-effort checks for critical scripts. |
| 19 | +- Add a "Smoke Tests" section to `README.md` with sample commands. |
| 20 | +- Add dry-run flags or safe read-only modes for critical scripts when feasible. |
| 21 | +- Identify 2–3 critical scripts (e.g., `install.sh`, `cloudflare-ddns.sh`) and define expected outputs. |
| 22 | + |
| 23 | +## 4) Standardize Shell Directives |
| 24 | +Goal: Remove ambiguity about which shell each file targets. |
| 25 | +- Add shebangs or shellcheck directives to `dotfiles/sh_config.d/*.sh`. |
| 26 | +- Ensure `bash`-specific features aren’t used in `sh`-intended files. |
| 27 | +- Align file names or headers to indicate `bash` vs `zsh` intent. |
| 28 | + |
| 29 | +## 5) Document Installer Behavior |
| 30 | +Goal: Make install/uninstall operations safe and predictable. |
| 31 | +- Describe symlink behavior, backup naming, and restore behavior. |
| 32 | +- Clarify `INSTALL_PREFIX`, `DOTFILES_ROOT`, `CONFIG_ROOT` precedence. |
| 33 | +- Provide a short "Rollback" note if installation is interrupted. |
| 34 | + |
| 35 | +## 6) Script Index |
| 36 | +Goal: Improve discoverability. |
| 37 | +- Add `scripts/README.md` listing script names, purposes, and example usage. |
| 38 | +- Keep each entry to 1–2 lines with a minimal example. |
| 39 | + |
| 40 | +## 7) Consistent Error Handling |
| 41 | +Goal: Reduce runtime surprises in scripts. |
| 42 | +- Adopt `set -euo pipefail` where safe; document exceptions. |
| 43 | +- Replace unsafe `cd` with `cd ... || exit` or `return`. |
| 44 | +- Quote variable expansions and use `printf` safely. |
| 45 | + |
| 46 | +## 8) Centralize Security Notes |
| 47 | +Goal: Prevent accidental exposure of secrets. |
| 48 | +- Add a "Security & Credentials" section in `README.md`. |
| 49 | +- Note permission requirements (e.g., `chmod 600` on credentials). |
| 50 | +- Add `.gitignore` entries for known local secret files if needed. |
| 51 | + |
| 52 | +## 9) Add CI for Linting |
| 53 | +Goal: Prevent regressions without manual checks. |
| 54 | +- Add a GitHub Actions workflow that runs `./scripts/lint.sh`. |
| 55 | +- Optionally add a quick `bash -n` syntax check for all scripts. |
| 56 | +- Keep CI lightweight; no external deps beyond `shellcheck`. |
| 57 | + |
| 58 | +## 10) Commit/PR Checklist |
| 59 | +Goal: Encourage consistent contributions. |
| 60 | +- Add a short checklist to `README.md` or `AGENTS.md`: |
| 61 | + - Run `./scripts/lint.sh` |
| 62 | + - Verify install/uninstall |
| 63 | + - Add/update usage notes for new scripts |
| 64 | + - Mention any OS-specific constraints |
| 65 | + |
| 66 | +## Suggested Order of Execution |
| 67 | +1. Make lint actionable (unblocks other work). |
| 68 | +2. Standardize shell directives. |
| 69 | +3. Fix error handling/quoting issues. |
| 70 | +4. Add compatibility notes and installer documentation. |
| 71 | +5. Add script index. |
| 72 | +6. Add security notes. |
| 73 | +7. Add CI workflow. |
| 74 | +8. Add commit/PR checklist. |
0 commit comments