Files
hermes-agent/scripts/hook-just
Teknium 27896fd2cd fix(dev): hooks find hoisted lefthook installs and set up the environment only for a matched job
scripts/run-lefthook now searches the hoisted node_modules layouts the generated hook
searches (npm, pnpm --node-linker=hoisted), in this tree and the clone's main checkout,
and only execs lefthook. The jobs call `{just}` (scripts/hook-just), which falls back to
scripts/run-in-hermes-env only once lefthook has matched staged files to the job, so a
commit no job matches never runs, or fails on, environment setup.

Tests: hoisted lookup, main-checkout lookup from a linked worktree, the no-`just` job
path, and a real docs-only commit without `just` that never reaches setup.
2026-11-18 20:35:04 -08:00

10 lines
466 B
Bash
Executable File

#!/bin/sh
# `just` for a git-hook job (`{just}` in lefthook.yml), resolved only once lefthook has
# matched staged files to the job: a commit no job matches never sets up an environment.
# An unactivated shell has no `just`, a PM tool: it comes from this checkout's own
# environment (scripts/run-in-hermes-env), never from a venv on PATH or `uv run`.
if command -v just >/dev/null 2>&1; then
exec just "$@"
fi
exec "$(dirname "$0")/run-in-hermes-env" just "$@"