chore(bootstrap): verify lefthook hooks active end-to-end#10
Conversation
Add the missing `lefthook` 2.1.6 devDependency so `pnpm exec lefthook
install` actually works, then verify the four pre-commit scenarios
(`.env`, manual Cargo.toml edit, cargo add, format violation) and the
pre-push pipeline behave as documented.
Two follow-up fixes surfaced during verification:
- Pre-commit globs `src/**/*.{ts,tsx,...}` and `src-tauri/**/*.rs` were
silently skipping direct children because `gobwas/glob` requires `**`
to match >=1 path component. Switched to `**/*.{...}` so `src/App.tsx`
and `src-tauri/build.rs` reach `oxfmt --check` / `cargo fmt --check`.
Staged-file filter still scopes execution to actually-staged files.
- Pre-push `ts-test` exited 1 on the empty scaffold because vitest 4.x
changed the default to fail on no test files. Switched to
`pnpm exec vitest run --passWithNoTests` (mirrors the CI workflow
flag); will revert when Sprint 1 lands the first domain test suite.
Pre-push budget verified: 3.3 s warm / 42 s cold, both under the 60 s
target documented in the task acceptance criteria.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR introduces git hook automation via ChangesLefthook Git Hooks Setup
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Review rate limit: 3/5 reviews remaining, refill in 16 minutes and 1 second. Comment |
Summary
Task 11 (Sprint 0) — verify Git pre-commit and pre-push hooks fire correctly on the empty Tauri scaffold. Adds missing
lefthookdevDependency and fixes two glob-pattern bugs that silently skipped TypeScript/Rust files during hook execution.Why
Lefthook is referenced in
lefthook.ymlbut was never added topackage.json, causingpnpm exec lefthook installto fail with "Command not found". Additionally, gobwas/glob patternssrc/**/*.{ts,tsx,...}only match files at depth ≥2, silently skipping direct children likesrc/App.tsx. This breaks pre-commit format validation. Finally, vitest 4.x exits code 1 on empty test scaffold, blocking pre-push on Sprint 0 which has zero tests.Changes
lefthook^2.1.6 as devDependency inpackage.json— enables hook installation and executionsrc/**/*.{...}→**/*.{...}andsrc-tauri/**/*.rs→**/*.rs— gobwas/glob requires**to match ≥1 path component; staged-file filter still scopes execution--passWithNoTestsflag to vitest — vitest 4.x default fails on empty scaffold; flag will be removed when Sprint 1 lands first test suiteTesting
All 4 pre-commit acceptance scenarios verified:
.envfile → hook blocks with "Secret file detected"Cargo.tomlwithoutCargo.lock→ hook blocks with "Manual dependency editing forbidden"cargo add logthen commitCargo.toml+Cargo.lock→ commit acceptedApp.tsx→ hook blocks with "Format violation" (after glob fix)Pre-push validated: runs full pipeline (cargo test, vitest, tsc, cargo-deny, knip) in 3.3 s warm / 42 s cold, both under 60 s budget.
Related Issues
Checklist
Summary by CodeRabbit