Sign in
Explore
Add-ons · HookEveryday codingReviewed

gsd-graphify-update.sh

PostToolUse hook that rebuilds the project knowledge graph after HEAD advances on the default branch.

Kind
Hook
Works with
Claude Code, Gemini / Antigravity
Languages
Shell
Source
gsd-build/get-shit-done @ bdcaab2c752d
Path
hooks/gsd-graphify-update.sh
License
MIT
Jobs
Automation
InstallCopy it from the source repository, or sign in and let the assistant adapt it for your project.
#!/usr/bin/env bash
# gsd-hook-version: {{GSD_VERSION}}
# gsd-graphify-update.sh — PostToolUse hook (Bash matcher) that auto-rebuilds
# the project knowledge graph after main HEAD advances on the default branch.
#
# OPT-IN (issue #3347 AC): no-op unless .planning/config.json has BOTH
#   graphify.enabled: true
#   graphify.auto_update: true
# graphify.auto_update defaults to false so existing users see no behavior change.
#
# Gates (in fast-fail order — each shaves work off the common non-dispatch path):
#   1. Stdin payload present and tool_name == "Bash"
#   2. tool_input.command matches a HEAD-advancing git op (shell-direct or
#      the exact `gsd-sdk query commit` command shape; the SDK command invokes
#      git internally, so the literal "git commit" substring never appears —
#      see #3653)
#   3. $CI is unset/empty
#   4. Inside a git repo
#   5. Current branch == default branch (git.base_branch override, else main/master/trunk)
#   6. .planning/config.json sets graphify.enabled=true AND graphify.auto_update=true
#   7. graphify binary on PATH
#   8. No rebuild already in flight (PID lock — kill -0 check, stale-tolerant)
#
# When all gates pass:
…