Skip to content

Pre-commit hook can run stale ambient codebase instead of repo-declared version #77

Description

@c0da-ricon

Problem

A clone-local hook installed by codebase pre-commit delegates with:

exec codebase lint "$REPO_ROOT"

That can ignore the target repository's declared shiv:codebase version because ordinary Git hooks do not activate the repository's mise environment.

Observed in KnickKnackLabs/shitshow on 2026-07-16:

  • repository declares "shiv:codebase" = "0.3" and resolves 0.3.0 through mise exec;
  • ambient PATH resolves an older globally installed codebase 0.2.0;
  • git commit runs the generated hook with 0.2.0 and fails because that version has no aggregate lint task;
  • mise exec -- git commit ... runs the same hook with 0.3.0 and all nine configured lints pass.

The hook was reported current by the 0.3 pre-commit installer/check before the commit attempt.

Expected

The generated hook should execute the codebase version declared by the target repository, independent of an ambient stale shim. For example, it may need to enter the repository and invoke through its mise environment rather than calling bare codebase.

The solution should preserve useful failure when mise or the declared package is unavailable, rather than silently falling back to a different ambient version.

Reproduction

cd <repo-declaring-shiv-codebase-0.3>
codebase pre-commit
command -v codebase                    # ambient 0.2 path
mise exec -- command -v codebase       # repo-declared 0.3 path
git commit ...                         # hook invokes ambient 0.2 and fails
mise exec -- git commit ...            # hook invokes declared 0.3 and passes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions