#
#   Refer for explanation to following link:
#   https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
#

assert_lefthook_installed: true
colors: true
no_tty: false
min_version: 1.5.0

pre-install:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-pre-install"

prepare:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-prepare"

pre-commit:
  piped: true
  commands:
    install:
      files: "git diff --name-only HEAD @{push}"
      glob: "./{pnpm-lock.yaml,lefthook.yml}"
      run: "pnpm install --no-frozen-lockfile && git update-index"
    prepare:
      files: "git diff --name-only HEAD @{push}"
      glob: "**/{lefthook.yml,biome.json}"
      run: "pnpm exec storm-prepare"
    prebuild:
      glob: "**/*.*"
      run: "pnpm build"
      stage_fixed: true
    validate:
      files: "git diff --name-only HEAD @{push}"
      glob: "**/*.*"
      run: "pnpm exec storm-pre-commit {staged_files}"
      stage_fixed: true
    lint:
      glob: "**/*.*"
      run: "pnpm lint"
      stage_fixed: true
    lint-toml:
      glob: "**/*.toml"
      run: 'pnpm exec taplo format --check
        --config="./node_modules/@storm-software/linting-tools/taplo/config.toml"'
    lint-filename:
      glob: "**/*.*"
      run: 'pnpm exec ls-lint
        --config="@storm-software/linting-tools/ls-lint/config.yml"'
    lint-github-actions:
      glob: ".github/workflows/*.*"
      run: 'zizmor --offline
        --config="./node_modules/@storm-software/linting-tools/zizmor/config.yml"
        .github/workflows/'
    readme-gen:
      glob: "**/{README.md,package.json,executors.json,generators.json}"
      run: 'pnpm exec storm-git readme --templates="./tools/readme-templates"'
      stage_fixed: true
    format:
      glob: "**/*.*"
      run: "pnpm format"
      stage_fixed: true
    format-toml:
      glob: "**/*.toml"
      run: 'pnpm exec taplo format
        --config="@storm-software/linting-tools/taplo/config.toml" && git
        update-index'
    postbuild:
      glob: "**/*.*"
      run: "pnpm build"
      stage_fixed: true

commit-msg:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-git commitlint --message {1}"

pre-push:
  piped: true
  commands:
    validate:
      files: "git diff --name-only HEAD @{push}"
      glob: "**/*.*"
      run: "pnpm exec storm-pre-push {files}"
      stage_fixed: true
    lint:
      files: "git diff --name-only HEAD @{push}"
      glob: "**/*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}"
      run: "pnpm lint"
      stage_fixed: true

post-merge:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-post-merge {staged_files}"
      stage_fixed: true

post-checkout:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-post-checkout {staged_files}"

post-commit:
  commands:
    validate:
      glob: "**/*.*"
      run: "pnpm exec storm-post-commit {staged_files}"
