|
| 1 | +# Git hooks via https://github.com/j178/prek (installed by `mise run install` in a Git checkout; re-run `mise run hooks:install` after edits). |
| 2 | +# Config format matches pre-commit; run hooks with `prek` from mise (`mise.toml` [tools]). |
| 3 | + |
| 4 | +default_install_hook_types: [pre-commit, pre-push] |
| 5 | +fail_fast: false |
| 6 | +exclude: ^\.threat-composer/ |
| 7 | + |
| 8 | +repos: |
| 9 | + - repo: https://github.com/pre-commit/pre-commit-hooks |
| 10 | + rev: v6.0.0 |
| 11 | + hooks: |
| 12 | + - id: trailing-whitespace |
| 13 | + # Skip generated trees and paths often checked in read-only (0444); mutating hooks must not touch them. |
| 14 | + exclude: (cdk/cdk\.out/|node_modules/|(^|/)LICENSE$|(^|/)\.gitattributes$|(^|/)\.npmignore$|(^|/)\.gitignore$|^cli/header\.js$|^docs/astro\.config\.mjs$|^docs/tsconfig\.json$|^docs/src/content\.config\.ts$|\.(snap|lock)$) |
| 15 | + - id: end-of-file-fixer |
| 16 | + exclude: (cdk/cdk\.out/|node_modules/|(^|/)LICENSE$|(^|/)\.gitattributes$|(^|/)\.npmignore$|(^|/)\.gitignore$|^cli/header\.js$|^docs/astro\.config\.mjs$|^docs/tsconfig\.json$|^docs/src/content\.config\.ts$) |
| 17 | + - id: check-merge-conflict |
| 18 | + - id: check-yaml |
| 19 | + exclude: ^(cdk/cdk\.out/|cdk\.out/|node_modules/|agent/\.venv/) |
| 20 | + - id: check-json |
| 21 | + exclude: ^(cdk/cdk\.out/|node_modules/) |
| 22 | + |
| 23 | + - repo: local |
| 24 | + hooks: |
| 25 | + - id: gitleaks-staged |
| 26 | + name: gitleaks (staged) |
| 27 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)" && mise run security:secrets:staged' |
| 28 | + language: system |
| 29 | + pass_filenames: false |
| 30 | + stages: [pre-commit] |
| 31 | + |
| 32 | + - id: cdk-eslint |
| 33 | + name: eslint (cdk) |
| 34 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)" && export MISE_EXPERIMENTAL=1 && mise //cdk:eslint' |
| 35 | + language: system |
| 36 | + pass_filenames: false |
| 37 | + files: ^cdk/.*\.(ts|tsx|cjs|mjs|js)$ |
| 38 | + exclude: ^cdk/cdk\.out/ |
| 39 | + stages: [pre-commit] |
| 40 | + |
| 41 | + - id: cli-eslint |
| 42 | + name: eslint (cli) |
| 43 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)" && export MISE_EXPERIMENTAL=1 && mise //cli:eslint' |
| 44 | + language: system |
| 45 | + pass_filenames: false |
| 46 | + files: ^cli/.*\.(ts|tsx|cjs|mjs|js)$ |
| 47 | + stages: [pre-commit] |
| 48 | + |
| 49 | + - id: agent-quality |
| 50 | + name: quality (agent) |
| 51 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)/agent" && mise run quality' |
| 52 | + language: system |
| 53 | + pass_filenames: false |
| 54 | + files: ^agent/.*\.py$ |
| 55 | + stages: [pre-commit] |
| 56 | + |
| 57 | + - id: docs-astro-check |
| 58 | + name: astro check (docs) |
| 59 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)/docs" && ./node_modules/.bin/astro check' |
| 60 | + language: system |
| 61 | + pass_filenames: false |
| 62 | + files: ^docs/ |
| 63 | + exclude: ^docs/node_modules/ |
| 64 | + stages: [pre-commit] |
| 65 | + |
| 66 | + - id: monorepo-security-pre-push |
| 67 | + name: security scans (pre-push) |
| 68 | + entry: bash -lc 'cd "$(git rev-parse --show-toplevel)" && mise run security' |
| 69 | + language: system |
| 70 | + pass_filenames: false |
| 71 | + stages: [pre-push] |
0 commit comments