Skip to content
CAI
Software that uses CAICheck a score

j178/prek

73.9

Strong · 29 September 2026

49.2k

lines of production code

Rust

primary language

2

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Prek is a high-performance, Rust-based implementation of the pre-commit framework designed to manage and execute git hooks across a wide variety of programming languages and environments. It features a parallel execution engine with a live progress UI, comprehensive file identification, and built-in support for numerous language backends including Python, Node.js, Go, and Rust. The system handles complex configuration management, cache maintenance, and automatic toolchain provisioning to ensure reliable and isolated hook execution.

How it got here

2024–2025 — workspace restructuring and feature expansion

20 changes.

The project was renamed to prek and restructured into a Rust workspace, removing legacy stubs while introducing a comprehensive suite of language backends and built-in hooks. This period focused on rewriting the core execution engine for parallel performance, adding robust cache management, and establishing a solid foundation of integration tests to support the expanded functionality.

2026 — language support and infrastructure expansion

13 changes.

The project significantly expanded its runtime capabilities by adding native support for Bun, Deno, .NET, and mise, alongside new built-in hooks for JSON5, JSONC, and regex pattern matching. Concurrently, the team overhauled the underlying infrastructure by introducing a dedicated file identification engine, refactoring the configuration system, and automating CI and packaging processes for broader platform compatibility.

Features

Add Deno language support for pre-commit hooks

Users can now configure hooks with \language: deno\. The system automatically manages the Deno toolchain by downloading and caching specific versions (supporting exact, major/minor, and semver-range requests) from the official Deno versions endpoint. It installs additional dependencies as global executables within the hook's isolated environment, allowing hook authors to specify entry points and dependencies using standard Deno install syntax.

crates/prek/src/languages/deno · high confidence

Add Go language backend support

Users can now run pre-commit hooks written in Go. The tool automatically extracts the required Go version from the \go\ or \toolchain\ directives in \go.mod\, installs the matching Go toolchain if needed, and manages dependencies via \go install\. It also sets \GOTOOLCHAIN=local\ to ensure consistent behavior during installation and execution.

crates/prek/src/languages/golang · high confidence

Add Ruby language backend with automatic toolchain installation

Introduces a new Ruby language backend that automatically downloads and manages Ruby interpreters using the \rv\ toolchain manager. The backend installs gems into an isolated environment, builds local gemspecs, and ensures the resolved Ruby binary is correctly placed on the PATH for hook execution. It supports flexible version requests (exact, major.minor, major, or semver ranges) and includes health checks to verify the installed Ruby version matches the hook configuration.

crates/prek/src/languages/ruby · high confidence

Add built-in hooks for JSON5, JSONC, and regex pattern matching

Users can now use built-in hooks for validating JSON5 and JSONC files, which support comments and trailing commas respectively, and for enforcing content or filename patterns using regular expressions. The new \check-json5\ and \check-jsonc\ hooks validate file syntax and detect duplicate keys, while the \deny-pattern\, \require-pattern\, \deny-filename-pattern\, and \require-filename-pattern\ hooks allow users to block or require files based on regex matches against file contents or names.

_crates/prek/src/hooks/builtin\hooks · high confidence

Add support for .NET hooks

Users can now define hooks with \language: dotnet\ in their configuration. The system automatically manages the .NET SDK installation (supporting managed downloads, system discovery, and specific version/channel requests like \8.0\ or \lts\), and installs additional dotnet tools specified as dependencies into an isolated environment for each hook.

crates/prek/src/languages/dotnet · high confidence

Add support for the Bun JavaScript runtime

Users can now configure pre-commit hooks to use the Bun runtime by specifying \language: bun\ in their configuration. The system automatically manages the Bun toolchain by resolving versions via Git tags, downloading the appropriate binary if necessary, and installing hook dependencies into an isolated environment. This enables hooks written for or compatible with Bun to run seamlessly alongside existing Node.js and Python support.

crates/prek/src/languages/bun · high confidence

Add support for the mise toolchain manager

Users can now use hooks that require the mise toolchain manager. The system installs and manages the mise binary, isolates its configuration and cache directories to prevent interference with user state, and activates additional tools specified in hook dependencies via the mise CLI.

crates/prek/src/languages/mise · high confidence

Initial implementation of the file identification engine

This change introduces the \prek-identify\ crate, which provides the core logic for detecting file types and applying tags to files. It includes a bitset-based \TagSet\ structure for efficient tag storage and operations, along with an auto-generated list of 324 supported file tags (such as \javascript\, \python\, \dockerfile\, etc.) used to classify files during the pre-commit hook execution process.

crates/prek-identify/src · high confidence

Introduce Rust language backend with configurable toolchain management

Adds a new Rust language backend that manages Rust toolchains via rustup. Users can now define Rust hooks with version constraints (e.g., \stable\, \1.70\, or semver ranges) and the system will automatically install or locate the required toolchain. The backend supports configurable installation profiles (minimal, default, complete) via the \PREK\_RUST\_PROFILE\ environment variable, prefers stable toolchains by default, and can use \cargo-binstall\ for faster CLI dependency installation when enabled. It also supports installing Rust CLI dependencies from git repositories with optional tag and package disambiguation.

crates/prek/src/languages/rust · high confidence

Introduce \`prek cache clean\`, \`prek cache gc\`, and \`prek cache size\` commands

Users can now manage the prek cache with three new subcommands. \prek cache clean\ removes the entire cache directory and reports the number of files and directories removed along with the total byte count. \prek cache gc\ performs a targeted garbage collection by analyzing tracked configuration files to identify and remove unused repositories, hook environments, tools, cache entries, and stale patch files, providing a detailed summary of what was cleaned. \prek cache size\ displays the total size of the cache, with output that is human-readable by default when connected to a terminal but can be forced to machine-readable format.

crates/prek/src/cli · high confidence

Introduce prek-pty crate for asynchronous PTY management

The new \crates/prek-pty\ crate provides asynchronous PTY (pseudo-terminal) handling for Unix systems, vendored from the \pty-process\ library. It exposes types like \Pty\, \Pts\, \OwnedReadPty\, and \OwnedWritePty\ to allow concurrent reading and writing, supports terminal resizing, and integrates with the Tokio async runtime. The implementation uses \rustix\ for low-level system calls and \fs\_err\ for file operations, ensuring robust error handling and non-blocking I/O.

crates/prek-pty · high confidence

Introduce pygrep language backend for regex-based hooks

Users can now define hooks that use the \pygrep\ language, allowing regex pattern matching against file contents via a dedicated Python-based backend. This new backend handles its own Python environment management (finding or installing a Python interpreter) and executes a custom script to support flags like case-insensitivity, multiline matching, and negation, providing more accurate regex behavior than a generic shell grep.

crates/prek/src/languages/pygrep · high confidence

New \`prek run\` execution engine with parallel hook management and progress UI

The \prek run\ command now uses a completely rewritten execution engine that introduces parallel hook installation and execution, a live terminal progress UI with output previews, and robust worktree management. Users benefit from faster runs via concurrent processing, better visibility into hook output through a streaming progress interface, and improved reliability with automatic stashing and restoration of unstaged changes and intent-to-add files. The new engine also supports advanced filtering by file tags, glob patterns, and hook groups, along with configurable status hiding and priority-based execution.

crates/prek/src/cli/run · high confidence

New automation and CI scripts for npm packaging, benchmarking, and language test balancing

The project introduces several new scripts in the \scripts/\ directory to streamline release and CI processes. \build-npm-packages.py\ automates the creation of platform-specific npm packages for prek, including dedicated support for Android (via a static musl binary) alongside standard macOS, Linux, and Windows targets. \generate-ci-matrix.py\ replaces manual CI configuration by dynamically balancing language integration tests across platforms using a bin-packing algorithm to optimize execution time. Additionally, \hyperfine-run-benchmarks.sh\ and \hyperfine-setup-test-env.sh\ provide a standardized framework for running and reporting performance benchmarks, while \update-macports-portfile.py\ and \update-schemastore-schema.py\ automate updates to the MacPorts port and JSON Schema Store respectively. Supporting scripts \install-mold.sh\, \setup-dev-drive.ps1\, and \setup-msvc.ps1\ enhance build reliability and environment setup for CI runners.

scripts · high confidence

New built-in hooks for file validation and repository hygiene

This update introduces a suite of new built-in hooks to \prek\, allowing users to enforce code quality and repository rules directly without external dependencies. The new hooks include \check-added-large-files\ to prevent committing oversized files, \check-case-conflict\ to detect case-insensitive filename collisions, \check-executables-have-shebangs\ and \check-shebang-scripts-are-executable\ to ensure script consistency, \check-illegal-windows-names\ to block invalid Windows filenames, and \check-symlinks\ to identify broken links. Additionally, syntax validation is expanded with \check-json\ (including duplicate key detection), \check-toml\, \check-xml\, and \check-merge-conflict\ to flag unresolved merge markers. The suite also adds \check-vcs-permalinks\ to discourage non-permanent version control links in code.

_crates/prek/src/hooks/pre\_commit\hooks · high confidence

New language backends for Conda, Coursier, Dart, Docker, Haskell, Julia, Lua, Perl, and PHP

The \prek\ hook runner now supports a suite of new language backends, allowing hooks written in or requiring environments for Conda (with Pixi, Micromamba, Mamba, or Conda installers), Coursier, Dart, Docker, Docker Image, Haskell, Julia, Lua, Perl, and PHP to be installed and executed. Each backend provisions the necessary dependencies and execution environment specific to its language ecosystem, such as using \pub get\ for Dart, \cabal install\ for Haskell, \Pkg.instantiate()\ for Julia, \luarocks\ for Lua, \cpan\ for Perl, and \composer\ for PHP, while Docker-based hooks run directly in containers.

crates/prek/src/languages · high confidence

Python hook support via uv and PEP 723

The Python language backend now uses \uv\ to manage hook environments, automatically installing it from the Astral CDN with platform-specific wheel selection and checksum verification. It supports PEP 723 inline metadata in Python scripts for dependencies and version requirements, and reads \requires-python\ from a hook repository's \pyproject.toml\ when no explicit version is configured. The backend includes a cached Python interpreter query system and validates the \uv\ binary version after installation.

crates/prek/src/languages/python · high confidence

Support running prek via \`python -m prek\`

Users can now execute the prek tool directly as a Python module using \python -m prek\. This change adds the \prek/\_\main\\_.py\ entry point, which locates the underlying prek binary (handling various installation paths like site-packages or user schemes) and executes it, ensuring consistent behavior across Windows and Unix platforms.

python · high confidence

Removals

Removal of stub pre-commit compatibility CLI

The \src/main.rs\ file, which contained a stub implementation of a \pre-commit\ compatibility namespace (including commands like \install\, \run\, \uninstall\, and \validate-config\), has been deleted. This removes the placeholder CLI interface that previously only printed debug information or returned 'not implemented' errors, indicating that the project is moving away from this specific compatibility layer or restructuring its entry points.

src · high confidence

Behavioural changes

Auto-generated file identification tags from Python identify package

The \prek-identify\ crate now generates its Rust source code (\src/tags.rs\) from the Python \identify\ library via a new \gen.py\ script. This ensures that file extension, name, and interpreter mappings used for hook filtering are kept in sync with upstream \identify\ (currently locked to version 2.6.20). The generation process also applies local overrides for specific extensions like \.cts\, \.mts\, and \.jsonc\ to ensure they are correctly identified as TypeScript or JSONC files, addressing cases where upstream mappings were rejected or missing.

crates/prek-identify · high confidence

Build script now embeds git commit metadata into the binary

The \prek\ crate now includes a build script that captures git commit hash, short hash, date, and last tag information at compile time. This data is exposed to the application via environment variables (e.g., \PREK\_COMMIT\_HASH\), allowing the tool to display accurate version and commit details in its output. The script also handles worktree scenarios and ensures the build reruns when git HEAD changes.

crates/prek · high confidence

Configuration system refactored into focused modules

The configuration parsing logic in \crates/prek/src/config\ has been split into focused modules (\hook\, \pattern\, \priority\, \repo\, \update\) to improve code organization. This change introduces new types for hook stages and languages, adds support for hiding hook status reports via the \hide\_status\ configuration option, and implements validation to warn users about unused keys in their settings.

crates/prek/src/config · high confidence

Introduce \`prek update\` with frozen revisions, tag filters, and freeze mode

The \auto-update\ command has been renamed to \update\ and significantly expanded. Users can now pin specific revisions using \\# frozen:\ comments in their configuration files, which are preserved and updated during the update process. A new \freeze\ option allows forcing revisions to be stored as frozen commit hashes. Tag filtering is now supported via \tag\_filters\ in the configuration and CLI, enabling users to restrict which tags are considered for updates. The update process also includes improved handling of Git repository state isolation, warnings for missing update repositories, and strict UTF-8 decoding for command output to ensure reliability.

crates/prek/src/cli/update · high confidence

Introduce \`shell\` hook option and \`{hook\_repo}\` placeholder

Hooks can now explicitly opt into shell-source execution via a new \shell\ configuration option, allowing entries to be interpreted as shell scripts rather than command paths. Additionally, the \{hook\_repo}\ placeholder is now supported in hook \entry\ fields, automatically expanding to the repository path during execution.

crates/prek/src · high confidence

Introduce centralized environment variable and configuration constant definitions

The \prek-consts\ crate now provides a unified source for all environment variable names and configuration file constants used by the tool. This includes a comprehensive list of \PREK\\\ variables (such as \PREK\_HOME\, \PREK\_SKIP\, \PREK\_CONCURRENT\_HOOKS\, and \PREK\_CONTAINER\_RUNTIME\), language-specific variables for Python, Node, Rust, Go, and others, as well as standard Git and CI environment variables. It also defines the supported configuration file names (\.pre-commit-config.yaml\, \.pre-commit-config.yml\, and \prek.toml\) and provides a helper function to prepend paths to the system \PATH\. This centralization ensures consistent environment variable handling across the codebase.

crates/prek-consts · high confidence

Introduces native Rust implementations for meta and fast-path hooks

The hook execution engine now includes built-in Rust implementations for meta hooks (check-hooks-apply, check-useless-excludes, identity) and specific pre-commit hooks via a 'fast path'. This change allows these hooks to run directly within the tool without spawning external processes, improving performance and reliability. The meta hooks operate at the workspace root to validate configuration files, while the fast-path mechanism bypasses the standard hook dispatch for supported remote hooks, reducing overhead and simplifying the execution flow.

crates/prek/src/hooks · high confidence

Node.js hook environment isolation and version management

The Node.js language backend now manages its own Node and npm toolchains, installing them into a dedicated store directory and ensuring they are available on the PATH during hook execution. To prevent interference from the user's global npm configuration, the execution environment explicitly clears npm prefix and cache environment variables (such as NPM\_CONFIG\_PREFIX and npm\_config\_cache) and sets isolated paths for the hook's local dependencies. Additionally, Node version queries are cached to improve performance, and the system supports flexible version requests including LTS codenames and semver ranges.

crates/prek/src/languages/node · high confidence

Support for Android and musl-based Linux platforms via dedicated platform packages

The npm launcher now supports Android and Linux distributions using the musl libc (such as Alpine) by dynamically selecting and executing platform-specific binaries. The tool detects the operating system, architecture, and libc variant at runtime, then resolves and runs the corresponding binary from a dedicated platform package, ensuring compatibility across a wider range of environments.

npm · high confidence

Test coverage

Added integration tests for language hook support; Added integration tests for the \prek run\ command; Comprehensive integration tests for prek core commands and hooks; New integration test infrastructure for Prek.

Dependencies

Project renamed to prek and restructured as a Rust workspace

The project has been renamed from pre-commit-rs to prek and reorganized into a multi-crate workspace (crates/prek, prek-consts, prek-identify, prek-pty). The package version is now 0.5.4, and the project has upgraded to the Rust 2024 edition with a Minimum Supported Rust Version (MSRV) of 1.96. This change also introduces a comprehensive set of dependency updates, including major version bumps for libraries such as anstream (0.6→1.0), serde-saphyr (0.0→1.2), and tokio-tar (0.6→0.7), alongside the adoption of astral-tokio-tar and astral\_async\_zip.

(dependencies) · high confidence

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 73 → 74 (+1.2)
  • Rubric changed (rubric-2026.09.9 → rubric-2026.09.17) — scores are not directly comparable.

Lenses

  • Code Health 90 → 89 (-0.1)
  • Architecture 98 → 90 (-8.4)
  • Maturity 75 → 75 (-0.0)
  • Readiness 63 → 64 (+0.9)
  • Security 79 → 85 (+5.6)
  • Domain Modelling 100 → 100 (+0.0)
  • Performance 100 (new)

Resolved (21)

  • Change coupling: run.rs ↔ system.rs (crates/prek/src/cli/run/run.rs)
  • Documentation: no installation or build instructions
  • Documentation: no installation or build instructions (README.md)
  • Documentation: no usage examples (README.md)
  • Duplicated block (10 lines × 2) (crates/prek/src/hooks/pre_commit_hooks/fix_byte_order_marker.rs)
  • Duplicated block (11 lines × 5) (crates/prek/src/languages/bun/installer.rs)
  • Duplicated block (7 lines × 2) (crates/prek/src/languages/bun/installer.rs)
  • Duplicated block (9 lines × 5) (crates/prek/src/hooks/pre_commit_hooks/check_json.rs)
  • Hotspot: crates/prek/src/archive.rs (crates/prek/src/archive.rs)
  • Hotspot: crates/prek/src/cli/cache_gc.rs (crates/prek/src/cli/cache_gc.rs)
  • Hotspot: crates/prek/src/config/repo.rs (crates/prek/src/config/repo.rs)
  • Hotspot: crates/prek/src/languages/python/uv.rs (crates/prek/src/languages/python/uv.rs)
  • Hotspot: crates/prek/src/schema.rs (crates/prek/src/schema.rs)
  • Members sharing a duplicated core (4 members, 50+ identical tokens) (crates/prek/src/languages/bun/installer.rs)
  • Members sharing a duplicated core (4 members, 50+ identical tokens) (crates/prek/src/languages/docker.rs)
  • Members sharing a duplicated core (6 members, 50+ identical tokens) (crates/prek/src/languages/bun/installer.rs)
  • TodoComment (crates/prek/src/languages/golang/installer.rs)
  • TodoComment (crates/prek/src/languages/node/installer.rs)
  • TodoComment (crates/prek/src/languages/node/installer.rs)
  • TodoComment (crates/prek/src/languages/python/uv.rs)
  • …and 1 more

New (22)

  • Dependency hygiene PARTLY measured — Python dependencies read, no exact pin to grade for currency
  • Documentation: no licence statement (docs/security.md)
  • Documentation: no project overview (README.md)
  • Duplicated block (10 lines × 3) (crates/prek/src/hooks/pre_commit_hooks/fix_byte_order_marker.rs)
  • Duplicated block (10 lines × 4) (crates/prek/src/hooks/pre_commit_hooks/check_json.rs)
  • Duplicated block (18 lines × 2) (scripts/update-macports-portfile.py)
  • Duplicated block (6 lines × 2) (crates/prek/src/languages/bun/installer.rs)
  • Duplicated block (8 lines × 4) (crates/prek/src/languages/bun/installer.rs)
  • Duplicated block (9 lines × 2) (scripts/update-macports-portfile.py)
  • Duplicated block (9–10 lines × 2) (crates/prek/src/hooks/pre_commit_hooks/check_json.rs)
  • Hotspot: crates/prek/src/hooks/pre_commit_hooks/check_merge_conflict.rs (crates/prek/src/hooks/pre_commit_hooks/check_merge_conflict.rs)
  • Medium vulnerability: RUSTSEC-2026-0285 (Cargo.lock)
  • Members sharing a duplicated core (4 members, 50+ identical tokens) (crates/prek/src/languages/docker.rs)
  • Members sharing a duplicated core (6 members, 50+ identical tokens) (crates/prek/src/languages/bun/installer.rs)
  • Off the main sequence: prek-identify
  • Off the main sequence: prek-pty
  • Projects may be oversized for their cohesion
  • Redundant method exposure across split types. Pty splits into ReadPty and WritePty. Since resizing a PTY is a property of the underlying file descriptor (shared by both ends), exposing resize on WritePty and OwnedWritePty is redundant if Pty already exposes it. Furthermore, OwnedWritePty duplicates the functionality of WritePty (which is likely a reference-counted or borrowed view), creating API surface bloat where WritePty.resize should suffice for both owned and borrowed contexts, or Pty.resize should be the canonical entry point.
  • TodoComment (crates/prek/src/cli/run/filter.rs)
  • TodoComment (crates/prek/src/languages/node/installer.rs)
  • …and 2 more

Changes since last survey

  • 67 commits — 65 feature/other, 2 fixes

By area

  • crates/prek — 29 commits
  • (root) — 25 commits
  • .github/workflows — 8 commits
  • (repo) — 1 commit
  • .config/mise.toml — 1 commit
  • crates/prek-identify — 1 commit
  • docs/debugging.md — 1 commit
  • docs/reference — 1 commit

Notable commits

  • fix: Rebalance CI language tests and fix Windows tool selection (#2758)
  • fix: Scan check-merge-conflict files in fixed-size blocks (#2781)
  • change: Add Nushell completion generation (#2785)
  • change: Add --check and simplify end-of-file-fixer (#2764)
  • change: Add --check to file-contents-sorter (#2765)
  • change: Add --check to requirements-txt-fixer (#2766)
  • change: Add --check to trailing-whitespace (#2763)
  • change: Add include_deleted to allow hooks to include deleted files (#2733)
  • change: Avoid JSON imports when querying Python interpreters
  • change: Batch file reads in shebang checks (#2793)
  • change: Bump version to 0.5.3 (#2708)
  • change: Bump version to 0.5.4
  • change: Cache the resolved Git executable on macOS (#2726)
  • change: Check cached hook environments concurrently
  • change: Clarify display path parameters in builtin hooks (#2783)
  • change: Clarify documentation setup and maintenance steps (#2721)
  • change: Clarify the flow and scope of usage guides (#2710)
  • change: Combine and cache Git repository path queries (#2724)
  • change: Expose and document the shell completion command (#2727)
  • change: Move mise.toml to .config subdirectory (#2741)
  • …and 47 more

Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

j178/prek was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 29 September 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit 1ae297783bc31a9ccc439d75d22e147f6862b271 — the exact code this score is about.
  • Scored under rubric-2026.09.17 — the same rubric and the same method as every other entry in this index.
  • Measured by watchdog.canine.dev using codehealth-analyzer preprod-705631bb727e.