Sign in
Explore
Add-ons · HookEveryday codingTesting & SecurityGit & pull requestsGuardrails & permissionsReviewed

gsd-validate-commit.sh

PreToolUse hook that blocks git commit commands whose message is not in Conventional Commits format.

The source repository is archived by its owner, so it gets no more updates.

Kind
Hook
Works with
Claude Code, Gemini / Antigravity
Languages
Shell
Source
gsd-build/get-shit-done @ bdcaab2c752d
Path
hooks/gsd-validate-commit.sh
Jobs
Git workflow, Guardrails
Topics
Git & pull requests, Guardrails & permissions

Credit

Made by
gsd-build
Original
github.com/gsd-build/get-shit-done/blob/bdcaab2c752d9a33a1a1c…
License
MIT

Listed by Skill Manifest; not made by us.

InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
Install factsScanned 3 Nov 2026
Adds
  • Entries under `hooks` in .claude/settings.json
Runs scripts
Yes
  • gsd-validate-commit.sh
  • command line in the text
  • the component is a script
Uses the network
None found
Needs secrets
None found
Reads environment variables
  • ENABLED
  • INPUT
  • HOOK_DIR
  • CMD
  • BASH_REMATCH
  • MSG
Reads outside the project
  • /usr/bin/env (gsd-validate-commit.sh)
Source revision
bdcaab2c752d
Licence
MIT
Last activity
Archived by its owner
  • Last push 31 May 2026
Review
Reviewed

Found by a static scan of the stored text; nothing is run. “None found” is not a guarantee, so read what you install before you run it.

#!/usr/bin/env bash
# gsd-hook-version: {{GSD_VERSION}}
# gsd-validate-commit.sh — PreToolUse hook: enforce Conventional Commits format
# Blocks git commit commands with non-conforming messages (exit 2).
# Allows conforming messages and all non-commit commands (exit 0).
# Uses Node.js for JSON parsing (always available in GSD projects, no jq dependency).
#
# OPT-IN: This hook is a no-op unless config.json has hooks.community: true.
# Enable with: "hooks": { "community": true } in .planning/config.json

# Check opt-in config — exit silently if not enabled
if [ -f .planning/config.json ]; then
  ENABLED=$(node -e "try{const c=require('./.planning/config.json');process.stdout.write(c.hooks?.community===true?'1':'0')}catch{process.stdout.write('0')}" 2>/dev/null)
  if [ "$ENABLED" != "1" ]; then exit 0; fi
else
  exit 0
fi

INPUT=$(cat)

# Extract command from JSON using Node (handles escaping correctly, no jq needed)
CMD=$(echo "$INPUT" | node -e "let d='';process.stdin.on('data',c=>d+=c);process.stdin.on('end',()=>{try{process.stdout.write(JSON.parse(d).tool_input?.command||'')}catch{}})" 2>/dev/null)

# Only check git commit commands.
…