--- name: pre-commit-check description: >- Validates MooshieUI uncommitted changes before commit or PR — build gates, Rust fmt/clippy, conventions, i18n. Use before committing, or when push/release skills invoke pre-commit validation. --- # Pre-Commit Check (MooshieUI) Run **before** any commit in the push or release workflows. Execute steps in order; **stop on blocking failures**. Only audit **changed** files (unstaged + staged). ## Setup ```powershell cd "$(git rev-parse --show-toplevel)" git diff --name-only HEAD git diff --staged --name-only ``` Combine lists. Classify: `rust` (`src-tauri/**/*.rs`), `config`, `rust-deps`, `svelte`, `store`, `typescript`, `locale`, `python-nodes`, `frontend-deps`. If empty → report "Nothing to check" and stop. ## Build gates [BLOCKING] | Step | When | Command | |------|------|---------| | Frontend | svelte / store / ts / package.json changed | `npm run build` — PASS if output ends with `✓ built in` | | Rust compile | rust / rust-deps / config changed | `cargo check --manifest-path src-tauri/Cargo.toml` | | Rust server build | rust / rust-deps / config changed | `cargo check --manifest-path src-tauri/Cargo.toml --no-default-features --features server` — the server binary does not link `tauri`, so the desktop check above cannot catch a `tauri` reference that escaped a `#[cfg(feature = "desktop")]` gate | | Rust fmt | any `.rs` changed | `cd src-tauri; cargo fmt --check` — only **blocking** if diffs overlap **your** changed lines | If a build gate fails → report full error and **STOP** (skip convention audit). ## Lint [NON-BLOCKING] If `.rs` changed: `cd src-tauri; cargo clippy` — warn only on **new** issues in changed files. ## Convention audit [NON-BLOCKING unless noted] Inspect only `+` lines in `git diff HEAD`. Full rule tables: [reference.md](reference.md). **Blocking convention errors:** - Svelte: `