EMBED-AND-CI-06: Pre-commit gate on staged docs
What it demonstrates
Section titled “What it demonstrates”Scoping a validate run to staged markdown in a git hook so commits with errors are blocked.
Builds on: EMBED-AND-CI-05: Fail CI on the exit code
How it’s done
Section titled “How it’s done”A terminal session: the command as you’d run it, followed by the output it prints; trailing comments note the exit status.
#!/bin/shchanged=$(git diff --cached --name-only --diff-filter=ACM -- '*.md')[ -z "$changed" ] && exit 0npx markdown-contract validate docs --include $(echo "$changed" | sed 's|^docs/||')# nonzero exit aborts the commitSurfaces exercised
Section titled “Surfaces exercised”CLI validate --includeexit code as the hook gate