#!/usr/bin/env bash
# graph-hint.sh  -  PreToolUse hook (Grep|Glob) for the pipeline.
#
# Before a whole-repo search for a bare identifier, and only when a current
# code graph exists for the repo, adds one line of context pointing at the
# graph query. Once per session. The logic is in graph-hint.mjs; this wrapper
# exists because every hook the pipeline registers is a
# `bash "$HOME/.<host>/scripts/<name>"` command.
#
# Exits 0 on every path and never blocks the search.

set -u

HERE="$(cd "$(dirname "$0")" 2>/dev/null && pwd || true)"
CORE="$HERE/graph-hint.mjs"
[ -f "$CORE" ] || exit 0
command -v node >/dev/null 2>&1 || exit 0

node "$CORE" 2>/dev/null || true
exit 0
