Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ env:
NODE_VERSION: "20"
BUN_VERSION: "1.3"
GO_VERSION: "1.24"
# The mise tests install 2026.7.18 separately to cover managed downloads.
MISE_VERSION: "2026.8.3"
PYTHON_VERSION: "3.12"
PHP_VERSION: "8.4"
RUBY_VERSION: "3.4"
Expand Down Expand Up @@ -557,6 +559,17 @@ jobs:
# Dummy dependency path to satisfy required input while enabling caching
cache-dependency-path: LICENSE

- name: "Install mise"
if: ${{ contains(format(' {0} ', matrix.languages), ' mise ') }}
uses: jdx/mise-action@7e36c90d9ab29c415a2384db3006f3ec8a8cc654 # v4.2.4
with:
version: ${{ env.MISE_VERSION }}
install: false
cache: false
env: false
add_shims_to_path: false
working_directory: ${{ runner.temp }}

- name: "Install Lua"
if: ${{ contains(format(' {0} ', matrix.languages), ' lua ') }}
uses: leafo/gh-actions-lua@6919171ccf181b826f44b9bca76307b577217377 # v13.0.0
Expand Down
3 changes: 2 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
- Prefer the smallest coherent change. Reuse existing mechanisms and avoid wrappers
or abstractions for speculative or unmeasured gains.
- Prefer direct `if` or `match` control flow and explicit state types over clever
combinators, wrappers, or invalid boolean/`Option` combinations.
combinators, wrappers, or invalid boolean/`Option` combinations. Prefer plain
`if`/`else` to `.then()` or `.then_some()`.
- Try hard to avoid `panic!`, `unreachable!`, `.unwrap()`, and `.expect()`. Encode
those constraints in the type system instead. More explicit code or a larger
refactor is acceptable when it avoids these calls.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ prek self update
### prek is easier to work with

- No need to install Python or any other runtime just to use `prek`; it is a single binary.
- Its [language support](https://prek.j178.dev/languages/) covers every language available in `pre-commit`, plus Bun, Deno, and PHP, and it automatically installs managed toolchains when needed for Python, Node.js, Bun, Deno, Go, Rust, and Ruby.
- Its [language support](https://prek.j178.dev/languages/) covers every language available in `pre-commit`, plus Bun, Deno, mise, and PHP, and it automatically installs managed toolchains when needed for Python, Node.js, Bun, Deno, Go, mise, Rust, and Ruby.
- It supports native [`prek.toml`](https://prek.j178.dev/configuration/) in addition to pre-commit YAML, and [`prek util yaml-to-toml`](https://prek.j178.dev/reference/cli/#prek-util-yaml-to-toml) helps migrate existing configs.
- Built-in support for [workspaces](https://prek.j178.dev/workspace/) means monorepos can keep separate configs per project and still run everything from one command, while independent same-depth projects run concurrently without mixing file scopes.
- [`prek install`](https://prek.j178.dev/reference/cli/#prek-install) and [`prek uninstall`](https://prek.j178.dev/reference/cli/#prek-uninstall) honor repo-local and worktree-local `core.hooksPath`.
Expand Down
13 changes: 13 additions & 0 deletions crates/prek-consts/src/env_vars.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ impl EnvVars {
pub const PREK_INTERNAL__DENO_BINARY_NAME: &'static str = "PREK_INTERNAL__DENO_BINARY_NAME";
pub const PREK_INTERNAL__DOTNET_BINARY_NAME: &'static str = "PREK_INTERNAL_DOTNET_BINARY_NAME";
pub const PREK_INTERNAL__GO_BINARY_NAME: &'static str = "PREK_INTERNAL__GO_BINARY_NAME";
pub const PREK_INTERNAL__MISE_BINARY_NAME: &'static str = "PREK_INTERNAL__MISE_BINARY_NAME";
pub const PREK_INTERNAL__NODE_BINARY_NAME: &'static str = "PREK_INTERNAL__NODE_BINARY_NAME";
pub const PREK_INTERNAL__RUSTUP_BINARY_NAME: &'static str = "PREK_INTERNAL__RUSTUP_BINARY_NAME";
pub const PREK_INTERNAL__SKIP_CABAL_UPDATE: &'static str = "PREK_INTERNAL__SKIP_CABAL_UPDATE";
Expand Down Expand Up @@ -138,6 +139,18 @@ impl EnvVars {
pub const DENO_DIR: &'static str = "DENO_DIR";
pub const DENO_NO_UPDATE_CHECK: &'static str = "DENO_NO_UPDATE_CHECK";

// mise related
pub const MISE_DATA_DIR: &'static str = "MISE_DATA_DIR";
pub const MISE_CACHE_DIR: &'static str = "MISE_CACHE_DIR";
pub const MISE_CONFIG_DIR: &'static str = "MISE_CONFIG_DIR";
pub const MISE_STATE_DIR: &'static str = "MISE_STATE_DIR";
pub const MISE_SYSTEM_CONFIG_DIR: &'static str = "MISE_SYSTEM_CONFIG_DIR";
pub const MISE_SYSTEM_DATA_DIR: &'static str = "MISE_SYSTEM_DATA_DIR";
pub const MISE_TMP_DIR: &'static str = "MISE_TMP_DIR";
pub const MISE_CEILING_PATHS: &'static str = "MISE_CEILING_PATHS";
pub const MISE_NO_CONFIG: &'static str = "MISE_NO_CONFIG";
pub const MISE_SYSTEM_DEPS: &'static str = "MISE_SYSTEM_DEPS";

// GitHub API authentication (to avoid rate limits)
pub const GITHUB_TOKEN: &'static str = "GITHUB_TOKEN";

Expand Down
13 changes: 12 additions & 1 deletion crates/prek/src/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ pub(crate) fn digest_from_sha256sums(
continue;
};
let name = name.trim();
// GNU-style checksum files may prefix binary-mode filenames with `*`.
// GNU entries use `*` for binary mode and may retain a leading `./` from the input path.
let name = name.strip_prefix('*').unwrap_or(name);
let name = name.strip_prefix("./").unwrap_or(name);
if name == filename {
return digest.parse().map(Some);
}
Expand Down Expand Up @@ -169,6 +170,16 @@ mod tests {
Ok(())
}

#[test]
fn parses_sha256sums_relative_filename() -> Result<()> {
let digest =
digest_from_sha256sums(&format!("{EMPTY_SHA256} ./target.tar.gz"), "target.tar.gz")?
.context("expected target digest")?;

assert_eq!(digest.to_string(), EMPTY_SHA256);
Ok(())
}

#[test]
fn returns_none_for_missing_sha256sums_entry() -> Result<()> {
let digest = digest_from_sha256sums(
Expand Down
1 change: 1 addition & 0 deletions crates/prek/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ pub enum Language {
Haskell,
Julia,
Lua,
Mise,
Node,
Perl,
Php,
Expand Down
Loading
Loading