Files
copilotkit__copilotkit/lefthook.yml
Jordan Ritter 1e70dae975 chore: widen lefthook format glob and add ruff for Python
Pre-commit lint-fix now covers json, md, css, yml, yaml, html, vue, py
in addition to js/ts. Adds ruff format for Python files. Local
formatting coverage now matches CI.
2026-05-13 22:55:11 -07:00

58 lines
1.9 KiB
YAML

output:
- meta
- summary
- success
- failure
- execution
- execution_out
- execution_info
- skips
pre-commit:
parallel: true
commands:
check-binaries:
tags: binaries
run: bash scripts/hooks/check-binaries.sh
sync-lockfile:
tags: lockfile
glob: "{packages,examples,showcase/scripts}/**/package.json"
run: pnpm i --lockfile-only
stage_fixed: true
lint-fix:
tags: lint
# Scope oxlint and oxfmt to just the files staged for commit — running
# `--fix .` / `--write .` across the whole monorepo on every commit is
# both slow and blurs the hook's purpose (touch files that aren't part
# of this change). Guard against empty `{staged_files}` expansion: when
# a commit touches only non-matching files (markdown, YAML), lefthook
# still invokes this hook with an empty expansion, and oxlint/oxfmt
# would default to operating on the current directory, defeating the
# scoping entirely. stage_fixed re-stages whatever the hooks modify.
glob: "*.{js,jsx,ts,tsx,mjs,cjs,json,jsonc,json5,md,css,yml,yaml,html,vue,py}"
# Mirror the ignorePatterns in .oxlintrc.json / .oxfmtrc.json at the
# hook layer. Without this, a docs-only commit expands {staged_files}
# to a single docs/** path; oxlint silently processes 0 files, then
# oxfmt exits 2 with "Expected at least one target file" and blocks
# the commit.
exclude:
- "docs/**"
run: |
if [ -n "{staged_files}" ]; then
pnpm exec oxlint --fix {staged_files} &&
pnpm exec oxfmt --write {staged_files} ;
ruff format {staged_files} 2>/dev/null || true
fi
stage_fixed: true
test-and-check-packages:
tags: test-packages
env:
NX_TUI: "false"
run: pnpm run test && pnpm run check:packages
commit-msg:
commands:
commitlint:
tags: commitlint
run: pnpm commitlint --edit {1}