#!/usr/bin/env bash
# file-context.sh  -  PostToolUse hook (Read) for the pipeline.
#
# Hands the model what the repository's memory says about the file it just
# read: ledger facts, past review findings and open known limits. The logic is
# in file-context.mjs; this wrapper exists because every hook the pipeline
# registers is a `bash "$HOME/.<host>/scripts/<name>"` command.
#
# Exits 0 on every path: a missing node, a slow scan or any internal error
# means no context, never a blocked tool call.

set -u

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

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