From 3765669780039479c5c21b72a52ec84c759e2810 Mon Sep 17 00:00:00 2001 From: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 Date: Mon, 20 Jul 2026 22:54:08 -0700 Subject: [PATCH] chore(lefthook): add CI-style path filtering to hooks MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every lefthook command ran unconditionally on every commit/push, regardless of which surface (rust/desktop/desktop-tauri/web/mobile) the change actually touched — e.g. flutter analyze on a rust-only push. Scope each command with glob (and exclude for desktop vs desktop-tauri) so lefthook skips commands whose surface the diff doesn't touch, using the same push-range/staged-file mechanism CI's dorny/paths-filter changes job uses for PR diffs. Globs mirror ci.yml's changes job filters; the header comment states that parity explicitly. branch-skew keeps no glob and always runs. Co-authored-by: Will Pfleger Signed-off-by: Will Pfleger --- lefthook.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/lefthook.yml b/lefthook.yml index b8a14cdb49..2d3e921278 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -1,19 +1,36 @@ +# Glob patterns below mirror the `changes` job's dorny/paths-filter groups in +# .github/workflows/ci.yml — keep the two in sync. Deliberate deviations: +# - The `.github/workflows/ci.yml` path CI adds to its `rust`/`mobile` filters +# is omitted; a CI-workflow-only edit doesn't need a local test run. +# - `desktop-check`/`desktop-test` don't trigger on `rust` changes, though CI's +# Desktop Core job does. Those commands are pure TS (biome + node:test) with +# no Rust dependency, so the extra trigger would be spurious locally. +# - Deletion-only surface changes do not trigger local hooks: lefthook 2.1.x +# drops deleted paths from push-file discovery (`extractFiles` existence +# check, repository.go). CI's dorny/paths-filter catches deletions. +# Deliberate — accepted, not worked around. pre-commit: parallel: true commands: rust-fmt: + glob: ["crates/**", "examples/countdown-bot/**"] run: just fmt stage_fixed: true desktop-tauri-fmt: + glob: ["desktop/src-tauri/**"] run: just desktop-tauri-fmt stage_fixed: true desktop-fix: + glob: ["desktop/**", "pnpm-lock.yaml"] + exclude: ["desktop/src-tauri/**"] run: just desktop-fix stage_fixed: true web-fix: + glob: ["web/**", "pnpm-lock.yaml"] run: just web-fix stage_fixed: true mobile-fix: + glob: ["mobile/**"] run: just mobile-fix stage_fixed: true @@ -23,12 +40,22 @@ pre-push: branch-skew: run: ./scripts/check-branch-skew.sh rust-tests: + glob: ["crates/**", "migrations/**", "schema/**", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "deny.toml", "scripts/run-tests.sh", "justfile"] run: just test-unit desktop-check: + glob: ["desktop/**", "pnpm-lock.yaml"] + exclude: ["desktop/src-tauri/**"] run: just desktop-check desktop-test: + glob: ["desktop/**", "pnpm-lock.yaml"] + exclude: ["desktop/src-tauri/**"] run: just desktop-test desktop-tauri-test: + # ci.yml:113 — Desktop Core triggers on `rust` OR `desktop-rust`; + # desktop/src-tauri path-depends on crates/buzz-core, buzz-persona, + # buzz-sdk, buzz-agent (desktop/src-tauri/Cargo.toml:88-91). + glob: ["desktop/src-tauri/**", "crates/**", "migrations/**", "schema/**", "Cargo.toml", "Cargo.lock", "rust-toolchain.toml", "deny.toml", "scripts/run-tests.sh", "justfile"] run: just desktop-tauri-test mobile-test: + glob: ["mobile/**"] run: just mobile-test