lefthook.yml

pre-commit:
  parallel: true
  jobs:
    - name: ci budget
      run: python3 .github/scripts/check_ci_budget.py --static
    - name: blocking gate
      run: python3 .github/scripts/check_blocking_gate.py
    - name: comments
      run: uv run tools/comments.py lint
    - name: cargo fmt
      glob: "*.rs"
      run: cargo fmt
      stage_fixed: true
    - name: ruff format
      glob: &python_sources ["py/*.py", "python/**/*.py"]
      run: ruff format {staged_files}
      stage_fixed: true
    - name: ruff check
      glob: *python_sources
      run: ruff check --fix {staged_files}
      stage_fixed: true
    - name: jactionlint
      glob: ".github/**/*.yml"
      run: jactionlint {staged_files}
    - name: rust checks
      glob: &build_inputs
        - "*.rs"
        - "src/**/*"
        - "rules/**/*"
        - "skills/**/*"
        - "py/**/*"
        - "python/**/*.py"
        - "indexes/**/*"
        - "licenses/**/*"
        - "LICENSE-*"
        - README.md
        - pyproject.toml
        - .cargo/config.toml
        - .claude-plugin/plugin.json
        - mcp.json
        - Cargo.toml
        - Cargo.lock
        - "samples/**/*"
        - ".github/scripts/check_sample_marks.py"
        - ".github/scripts/check_present_accuracy.py"
        - ".github/scripts/check_surface_parity.py"
        - ".github/scripts/check_adapter_gate.py"
        - ".github/scripts/check_untangle_external.py"
        - ".github/scripts/check_optimize_fixtures.py"
      group:
        piped: true
        jobs:
          - name: build
            run: cargo build --quiet --bin xpd --example xtask
          - name: verify binary
            group:
              parallel: true
              jobs:
                - name: rules load
                  run: ./target/debug/xpd check samples/good.py --format text && ./target/debug/xpd charts --questions --format json > /dev/null && ./target/debug/xpd tables --questions --format json > /dev/null && ./target/debug/xpd views --questions --format json > /dev/null
                - name: discovery ranking
                  run: ./target/debug/xpd find --check indexes/questions.json
                - name: preprocessing coverage
                  run: ./target/debug/examples/xtask check-preprocessing
                - name: workflow roles coverage
                  run: ./target/debug/examples/xtask check-workflow-roles
                - name: coordinator invariants
                  run: ./target/debug/examples/xtask check-coordinators
                - name: surface parity
                  run: python3 .github/scripts/check_surface_parity.py ./target/debug/xpd
                - name: sample marks
                  run: python3 .github/scripts/check_sample_marks.py ./target/debug/xpd
                - name: adapter gate
                  run: python3 .github/scripts/check_adapter_gate.py ./target/debug/xpd
                - name: untangle external
                  run: python3 .github/scripts/check_untangle_external.py ./target/debug/xpd
                - name: optimize fixtures
                  run: python3 .github/scripts/check_optimize_fixtures.py ./target/debug/xpd
                - name: present accuracy
                  run: python3 .github/scripts/check_present_accuracy.py ./target/debug/xpd --max-errors 0 --max-create-errors 0
                - name: clippy
                  glob: "*.rs"
                  run: cargo clippy --all-targets --all-features -- -D warnings

pre-push:
  parallel: true
  jobs:
    - name: deny
      run: cargo deny check
    - name: rule conflicts
      run: cargo build --quiet && python3 .github/scripts/check_rule_conflicts.py --xpd target/debug/xpd && python3 .github/scripts/check_ty_conflicts.py --xpd target/debug/xpd