Files
hermes-agent/lefthook.yml
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

51 lines
1.7 KiB
YAML

# The command the generated git hooks run instead of searching PATH, node_modules and
# finally `uv run lefthook`, which syncs `.venv` and editable-installs the checkout into it
# (scripts/run-lefthook). No double quotes in the value: lefthook pastes it into
# `test -n "..."`. A commit that predates the script skips the hooks instead of failing.
lefthook: "sh -c 'if test -f scripts/run-lefthook; then exec sh scripts/run-lefthook $0 $*; fi; echo git hooks skipped: this checkout has no scripts/run-lefthook >&2'"
# `just` for the jobs, resolved only for a job whose glob matched (scripts/hook-just), so a
# commit no job matches never sets up an environment. Absolute: `root:` jobs run in a subdir.
templates:
just: sh "$(git rev-parse --show-toplevel)/scripts/hook-just"
pre-commit:
jobs:
- name: lint python
glob: "*.py" # glob filter
run: "{just} ruff {staged_files}"
- name: move shims
glob: "*.py"
run: "{just} check --only shims"
- name: lint web
root: web/
glob: "web/**/*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"
- name: lint bootstrap installer
root: apps/bootstrap-installer/
glob: "*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"
- name: lint desktop app
root: apps/desktop/
glob: "*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"
- name: lint tui
root: ui-tui/
glob: "*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"
- name: lint shared
root: apps/shared/
glob: "*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"
- name: lint tests
root: tests-js/
glob: "*.{js,ts,tsx}"
run: "{just} eslint {staged_files}"