Files
copilotkit__copilotkit/lefthook.yml
2026-05-20 10:54:04 +02:00

74 lines
2.8 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/**"
# Use `set --` so the staged files become positional args; this is the
# only shell-portable way to test "are there any" without breaking on
# multi-file expansion. The old `[ -n "{staged_files}" ]` form failed
# with `sh: 1: [: <path>: unexpected operator` because lefthook
# interpolates the file list as space-separated words, not a single
# quoted string, so [ saw 3+ args and tried to parse a binary op.
run: |
set -- {staged_files}
if [ "$#" -gt 0 ]; then
pnpm exec oxlint --fix "$@" &&
pnpm exec oxfmt --write "$@" ;
ruff format "$@" 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
check-plugin-skills:
tags: plugin-skills
glob: "{packages/*/skills/**,skills/runtime/**,skills/react-core/**,skills/a2ui-renderer/**,scripts/sync-plugin-skills.ts,.claude-plugin/**}"
run: pnpm check:plugin-skills
fail_text: |
Plugin skill mirror is out of sync with the Intent source.
Run: pnpm sync:plugin-skills
Then stage the changes and re-commit.
commit-msg:
commands:
commitlint:
tags: commitlint
run: pnpm commitlint --edit {1}