- vault_index.sh: grep fallback for frontmatter tag extraction when rg is unavailable (had this for vault_search.sh/vault_backlinks.sh, not vault_index.sh). - git_cmd.bats: registered repo path that's a file, not a directory (had the obsidian equivalent, not git-manager's). - git_cmd.bats: missing python3 in resolve_repo_path (previously only tested via setup.sh/vault_index.sh, not git_cmd.sh's own _lib.sh). 76 tests now (was 73). kcov: 87.84% (260/296 lines), up from 86.15% -- both target files (vault_index.sh, git-manager _lib.sh) now at 100%. Remaining gap is entirely kcov's inability to trace multi-line python3/awk/jq blocks and bash 'case pattern) ;;' no-op branches, confirmed by checking hit counts on the surrounding lines -- not further closeable by adding tests.
Tests
A bats-core suite covering both
plugins' wrapper scripts, their setup.sh, and git-manager's two
PreToolUse hooks. Plain bats assertions only (run + [ ]/[[ ]]) — no
extra helper libraries.
Install
sudo apt install bats
Run
bats -r tests/ # everything (-r: recurse into subdirs)
bats -r tests/git-manager/ # one plugin
bats tests/obsidian-vault-kb/vault_search.bats # one file
How it's isolated
Every test points $HOME at a fresh, bats-managed $BATS_TEST_TMPDIR/home
(see tests/helpers/common.bash, sandbox_home) before running any script
under test. Since every script here resolves its config from
~/.agent-skills/<name>/config.json and setup.sh writes to
~/.claude/settings.json, this means:
- Tests never read or write your real
~/.agent-skills/or~/.claude/settings.json. - Nothing needs manual cleanup — bats deletes
$BATS_TEST_TMPDIRafter each test automatically. - Tests that exercise a
setup.shrun the real script end to end (it's what deploys the stable script copies + writes permissions/config), not a mocked version.
There's no CI wiring for this suite yet — run it manually before/after
touching anything under skills/ or vendor/claude-code/plugins/.
Coverage
sudo apt install kcov # or a user-local install, as done for bats
kcov --include-pattern=/repo/skills/,/repo/vendor/claude-code/plugins/,force-ask-on-chaining.sh,force-ask-on-raw-git.sh \
tests/coverage bats -r tests/
Opens as tests/coverage/bats.<hash>/index.html (not committed — see
.gitignore). kcov follows every bash subprocess bats forks, so this
covers the actual wrapper/setup/hook scripts, not just bats itself.
The --include-pattern needs three things, not just the two source
directories: git_cmd.sh/vault_*.sh/setup.sh run straight from this
checkout, so /repo/skills/ and /repo/vendor/claude-code/plugins/ catch
them (the leading /repo/ matters — a plain skills/ would also match this
repo's own outer directory name and pull in unrelated files). The two
PreToolUse hooks are different: tests/git-manager/hooks.bats exercises
the deployed copies under ~/.agent-skills/git-manager/bin/ (matching how
Claude Code actually invokes them), which live outside both of those
directories — hence matching them by filename instead.