2026-03-02 14:59:16 +01:00
|
|
|
output:
|
|
|
|
|
- meta
|
|
|
|
|
- summary
|
|
|
|
|
- success
|
|
|
|
|
- failure
|
|
|
|
|
- execution
|
|
|
|
|
- execution_out
|
|
|
|
|
- execution_info
|
|
|
|
|
- skips
|
|
|
|
|
|
2026-02-24 15:17:21 +01:00
|
|
|
pre-commit:
|
2026-03-02 16:41:23 +01:00
|
|
|
parallel: true
|
2026-02-24 15:17:21 +01:00
|
|
|
commands:
|
2026-03-06 09:14:21 -08:00
|
|
|
check-binaries:
|
|
|
|
|
tags: binaries
|
2026-04-17 12:55:00 +02:00
|
|
|
run: bash scripts/hooks/check-binaries.sh
|
2026-03-02 16:24:48 +01:00
|
|
|
sync-lockfile:
|
|
|
|
|
tags: lockfile
|
2026-04-24 21:24:26 -07:00
|
|
|
glob: "{packages,examples,showcase/scripts}/**/package.json"
|
2026-03-02 16:24:48 +01:00
|
|
|
run: pnpm i --lockfile-only
|
|
|
|
|
stage_fixed: true
|
2026-02-24 15:17:21 +01:00
|
|
|
lint-fix:
|
2026-03-02 15:56:37 +01:00
|
|
|
tags: lint
|
2026-04-22 10:09:51 -07:00
|
|
|
# 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.
|
2026-05-27 13:49:31 -07:00
|
|
|
# Intentionally excludes json/jsonc/json5: oxfmt --write rewrites JSON
|
|
|
|
|
# files into JSON5 syntax (4-space indent, trailing commas, compact
|
|
|
|
|
# objects) when invoked via lefthook with staged file paths. The result
|
|
|
|
|
# is invalid strict JSON that pnpm rejects with ERR_PNPM_JSON_PARSE,
|
|
|
|
|
# blocking every commit that touches a package.json (see PRs #5054,
|
|
|
|
|
# #5055). JSON formatting is owned by pnpm/manual editing; oxfmt has
|
|
|
|
|
# no per-file knobs to keep package.json valid, so the only safe fix
|
|
|
|
|
# is to keep .json* out of this hook entirely.
|
|
|
|
|
glob: "*.{js,jsx,ts,tsx,mjs,cjs,md,css,yml,yaml,html,vue,py}"
|
2026-04-22 17:31:03 -07:00
|
|
|
# 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/**"
|
2026-05-26 11:26:45 -07:00
|
|
|
- "showcase/aimock/shared/**"
|
|
|
|
|
- "showcase/aimock/d4/**"
|
|
|
|
|
- "showcase/aimock/d6/**"
|
2026-05-19 15:28:07 +00:00
|
|
|
# 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.
|
2026-04-22 10:09:51 -07:00
|
|
|
run: |
|
2026-05-19 15:28:07 +00:00
|
|
|
set -- {staged_files}
|
|
|
|
|
if [ "$#" -gt 0 ]; then
|
2026-05-29 16:31:12 -07:00
|
|
|
pnpm exec oxlint --fix "$@"
|
|
|
|
|
# Defense-in-depth: filter package.json from explicit oxfmt args even though
|
|
|
|
|
# .oxfmtrc.json ignorePatterns covers it. Explicit-path invocations bypass the
|
|
|
|
|
# pattern in some tool versions; the shell filter makes the exclusion unconditional.
|
|
|
|
|
fmt_files=""; for f in "$@"; do case "$f" in */package.json|package.json) ;; *) fmt_files="$fmt_files $f" ;; esac; done
|
|
|
|
|
[ -n "$fmt_files" ] && pnpm exec oxfmt --write $fmt_files
|
|
|
|
|
# ruff v0.9+ formats JSON with trailing commas (JSONC), which breaks
|
|
|
|
|
# pnpm's JSON parser in the sync-lockfile hook. Scope it to .py only.
|
|
|
|
|
py_files=""; for f in "$@"; do case "$f" in *.py) py_files="$py_files $f";; esac; done
|
|
|
|
|
[ -n "$py_files" ] && ruff format $py_files 2>/dev/null || true
|
2026-04-22 10:09:51 -07:00
|
|
|
fi
|
2026-02-24 15:17:21 +01:00
|
|
|
stage_fixed: true
|
2026-03-02 16:09:55 +01:00
|
|
|
test-and-check-packages:
|
|
|
|
|
tags: test-packages
|
2026-02-24 15:17:21 +01:00
|
|
|
env:
|
|
|
|
|
NX_TUI: "false"
|
2026-03-02 16:09:55 +01:00
|
|
|
run: pnpm run test && pnpm run check:packages
|
2026-02-24 15:17:21 +01:00
|
|
|
|
2026-04-22 14:50:58 +02:00
|
|
|
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.
|
|
|
|
|
|
2026-02-24 15:17:21 +01:00
|
|
|
commit-msg:
|
|
|
|
|
commands:
|
|
|
|
|
commitlint:
|
2026-03-02 15:56:37 +01:00
|
|
|
tags: commitlint
|
2026-02-24 15:17:21 +01:00
|
|
|
run: pnpm commitlint --edit {1}
|