Files
hyperframes/lefthook.yml
T
James RussoandClaude Opus 4.8 e845793ce1 chore: shrink repo — untrack failure frames, recompress backgrounds, harden LFS (#1326)
No-coordination repo-size cleanup (no history rewrite — SHAs unchanged):

- Untrack 158 producer regression-test failure artifacts (~27 MB); already
  gitignored, on-disk copies kept.
- Recompress 13 byte-identical code-snippet block backgrounds (5120x2880/3.3MB
  -> 2560x1440 q78/~428KB): 42 MB -> 5.4 MB. Per-block files kept for portability.
- Recursive LFS patterns (packages/producer/tests/**/*.{mp4,mov,webm,png}) +
  globalized *.onnx — closes the nested-path leak.
- Recursive .gitignore for tests/**/failures/ at any depth.
- scripts/check-large-files.sh + lefthook `largefiles` gate (>500KB non-LFS
  fails commit; excludes registry/). Review fixes: ceiling division, skip
  symlinks, space-safe staged-file read.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-10 16:05:45 -07:00

54 lines
2.6 KiB
YAML

pre-commit:
parallel: true
commands:
lint:
glob: "*.{js,jsx,ts,tsx}"
run: bunx oxlint {staged_files}
format:
glob: "*.{js,jsx,ts,tsx,json,md,yaml,yml}"
# --no-error-on-unmatched-pattern: don't fail when staged files all
# fall under .prettierignore (e.g. docs-only changes to docs/docs.json).
run: bunx oxfmt --check --no-error-on-unmatched-pattern {staged_files}
typecheck:
glob: "*.{ts,tsx}"
run: cd packages/core && bunx tsc --noEmit && cd ../studio && bunx tsc --noEmit
# Mirrors the CI gate (same `--base origin/main` so the local hook can't
# pass on a branch CI would fail). Audits the working tree, which means
# unstaged WIP in `packages/**` is part of the diff — stash before
# committing if that surprises you. `--gate new-only` (the default) only
# fails on issues introduced by the branch, not inherited findings.
fallow:
glob: "packages/**/*.{ts,tsx,mts,cts,js,jsx,mjs,cjs}"
# Unset git worktree env vars: fallow creates a temp worktree internally and
# GIT_DIR/GIT_INDEX_FILE (set by git in worktree hook context) break that.
# env -u is safe in non-worktree contexts (no-op when var is unset).
run: env -u GIT_DIR -u GIT_INDEX_FILE -u GIT_WORK_TREE bunx fallow audit --base origin/main --fail-on-issues
largefiles:
# Reject large binaries committed straight into the git pack instead of
# LFS. The script reads the staged set itself (via `git diff --cached`)
# rather than taking lefthook's `{staged_files}` expansion, which would
# split paths containing spaces. It skips files under the limit, anything
# routed through LFS, and registry/ assets. Tune via HF_MAX_NONLFS_KB.
run: ./scripts/check-large-files.sh
filesize:
# Scoped to packages/studio — the 600 LOC limit is a studio architecture
# standard enforced as part of the App.tsx decomposition work. Player and
# other packages enforce size discipline via code review and convention.
glob: "packages/studio/**/*.{ts,tsx}"
exclude: "(\\.test\\.(ts|tsx)$|\\.generated\\.)"
run: |
for f in {staged_files}; do
# Skip test and generated files (exclude pattern backup in case lefthook doesn't filter)
case "$f" in *.test.ts|*.test.tsx|*.generated.*) continue ;; esac
lines=$(wc -l < "$f")
if [ "$lines" -gt 600 ]; then
echo "ERROR: $f has $lines lines (max 600)"
exit 1
fi
done
commit-msg:
commands:
commitlint:
run: bunx commitlint --edit "{1}"