From 801e4bede6050e81d332b486ed32381ee7801c8c Mon Sep 17 00:00:00 2001 From: Tak Hoffman <781889+Takhoffman@users.noreply.github.com> Date: Thu, 19 Mar 2026 17:25:37 -0500 Subject: [PATCH] Git: run pnpm check in pre-commit hook --- AGENTS.md | 7 +++---- git-hooks/pre-commit | 3 +++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 538670892f4..e6c5b1a5e92 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -70,9 +70,8 @@ - Format check: `pnpm format` (oxfmt --check) - Format fix: `pnpm format:fix` (oxfmt --write) - Tests: `pnpm test` (vitest); coverage: `pnpm test:coverage` -- Default landing bar: before any commit, run `pnpm check` and prefer a passing result for the change being committed. -- For narrowly scoped changes, run narrowly scoped tests that directly validate the touched behavior; this is required proof for the change before commit and push decisions. If no meaningful scoped test exists, say so explicitly and use the next most direct validation available. -- Default landing bar: before any push to `main`, run `pnpm check` and `pnpm test` and prefer a green result. +- For narrowly scoped changes, prefer narrowly scoped tests that directly validate the touched behavior. If no meaningful scoped test exists, say so explicitly and use the next most direct validation available. +- Preferred landing bar for pushes to `main`: `pnpm check` and `pnpm test`, with a green result when feasible. - Scoped tests prove the change itself. `pnpm test` remains the default `main` landing bar; scoped tests do not replace full-suite gates by default. - Hard gate: if the change can affect build output, packaging, lazy-loading/module boundaries, or published surfaces, `pnpm build` MUST be run and MUST pass before pushing `main`. - Default rule: do not commit or push with failing format, lint, type, build, or required test checks when those failures are caused by the change or plausibly related to the touched surface. @@ -82,7 +81,7 @@ ## Coding Style & Naming Conventions - Language: TypeScript (ESM). Prefer strict typing; avoid `any`. -- Formatting/linting via Oxlint and Oxfmt; run `pnpm check` before commits. +- Formatting/linting via Oxlint and Oxfmt. - Never add `@ts-nocheck` and do not disable `no-explicit-any`; fix root causes and update Oxlint/Oxfmt config only when required. - Dynamic import guardrail: do not mix `await import("x")` and static `import ... from "x"` for the same module in production code paths. If you need lazy loading, create a dedicated `*.runtime.ts` boundary (that re-exports from `x`) and dynamically import that boundary from lazy callers only. - Dynamic import verification: after refactors that touch lazy-loading/module boundaries, run `pnpm build` and check for `[INEFFECTIVE_DYNAMIC_IMPORT]` warnings before submitting. diff --git a/git-hooks/pre-commit b/git-hooks/pre-commit index 469ccd28b88..34831d6cf3d 100755 --- a/git-hooks/pre-commit +++ b/git-hooks/pre-commit @@ -47,3 +47,6 @@ if [ "${#format_files[@]}" -gt 0 ]; then fi git add -- "${files[@]}" + +cd "$ROOT_DIR" +pnpm check