Skip to content

Add prek as a pre-commit hook runner for shellcheck #107

Open

Description

@ooloth

Idea

Add prek as a managed tool in this dotfiles repo to run shellcheck as a pre-commit hook locally (currently shellcheck only runs in CI).

prek is a Rust-based drop-in replacement for the pre-commit Python tool. It uses the same hook ecosystem but is faster and ships as a single binary. It supports a native prek.toml config format (preferred over .pre-commit-config.yaml).

Decisions needed

1. Installation method

See: https://prek.j178.dev/installation/#package-managers

  • brew install prek — consistent with how most tools in this repo are installed
  • uv tool install prek — prek is a Python package; this is the recommended modern approach and avoids a brew formula

2. shellcheck hook source

  • External repo (e.g. shellcheck-py/shellcheck-py) — standard pre-commit ecosystem hook, maintained upstream
  • Local environment hook — define the hook inline in prek.toml using the system shellcheck binary (already installed as a brew formula)

A local hook pointing at the system shellcheck may be simpler given shellcheck is already managed separately in this repo.

Config format

Use prek.toml (preferred, see: https://prek.j178.dev/configuration/#file-format):

[[repos]]
repo = "https://github.com/shellcheck-py/shellcheck-py"
hooks = [{ id = "shellcheck" }]

or with a local environment hook:

[[repos]]
repo = "local"

[[repos.hooks]]
id = "shellcheck"
name = "shellcheck"
entry = "shellcheck"
language = "system"
types = ["shell"]

Implementation

  1. Decide installation method and hook source (see above)
  2. Add prek via the /add-tool workflow (tools/prek/)
  3. Add prek.toml at repo root
  4. Run prek install to wire up the git pre-commit hook

Activity

  1. added
    maintenanceUpkeep that changes how the repo is built, not what it does
    on Oct 6, 2026
  2. ooloth commented on Nov 17, 2026

    @ooloth
    OwnerAuthor

    A second check worth running as a pre-commit hook: CLAUDE_CODE_USE_VERTEX in tools/claude/config/settings.json must never be committed as "1". On the work laptop that value moves every Claude Code session to Vertex AI while the subscription's usage limit is reached, so the working copy legitimately holds "1" for hours at a time. A commit made then would start personal Macs, which have no Vertex AI project, on Vertex AI.

    tools/claude/tests/test_settings.py checks this today by reading HEAD, so it catches the commit only after it is made, at the next check run or in CI. As a pre-commit hook it would read the staged version instead and stop the commit itself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    maintenanceUpkeep that changes how the repo is built, not what it does

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions