mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-21 01:55:43 +00:00
1.2 KiB
1.2 KiB
name, description, user-invocable, allowed-tools
| name | description | user-invocable | allowed-tools |
|---|---|---|---|
| shell-validate | Validate shell scripts after editing. Apply when writing or modifying any shell script in local/bin/ or scripts/. | false | Bash, Read, Grep |
After editing any shell script in local/bin/, scripts/, or config/ (files with a #! shebang or # shellcheck shell= directive), validate it:
1. Determine the shell
/bin/shor#!/usr/bin/env shshebang -> POSIX, usesh -n/bin/bashor#!/usr/bin/env bashshebang -> Bash, usebash -n# shellcheck shell=bashdirective (no shebang) -> usebash -n# shellcheck shell=shdirective (no shebang) -> usesh -n- No shebang and no directive -> default to
bash -n
2. Syntax check
Run the appropriate syntax checker:
bash -n <file> # for bash scripts
sh -n <file> # for POSIX sh scripts
If syntax check fails, fix the issue before proceeding.
3. ShellCheck
Run shellcheck <file>. The project .shellcheckrc already disables SC2039, SC2166, SC2154, SC1091, SC2174, SC2016. Only report and fix warnings that are NOT in that exclude list.
Key files to never validate (not shell scripts)
local/bin/fzf-tmux(vendor file)*.mdfiles*.batstest files (Bats, not plain shell)