Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: j178/prek-action
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0-beta.4
Choose a base ref
...
head repository: j178/prek-action
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.0.0-beta.5
Choose a head ref
  • 3 commits
  • 19 files changed
  • 2 contributors

Commits on Mar 16, 2026

  1. Add version manifest file (#101)

    ## Summary
    - add the generated root-level version-manifest.json file
    - land this bootstrap file before the runtime/code changes that consume
    it
    j178 authored Mar 16, 2026
    Configuration menu
    Copy the full SHA
    623e124 View commit details
    Browse the repository at this point in the history
  2. Move version manifest out of bundle (#100)

    ## Summary
    - move the version manifest to the repo root and fetch it from
    raw.githubusercontent.com at runtime
    - generate a separate known-checksums map keyed by version and asset
    name
    - update workflows, tests, and bundled output for the new
    manifest/checksum flow
    j178 authored Mar 16, 2026
    Configuration menu
    Copy the full SHA
    02ce158 View commit details
    Browse the repository at this point in the history

Commits on Mar 17, 2026

  1. Fix cache path resolution to match prek's own behavior (#102)

    ## Summary
    
    `restorePrekCache` used hardcoded platform paths (`~/.cache/prek` or
    `LOCALAPPDATA/prek`) to save and restore the prek hook cache. A `prek
    cache dir` CLI probe already existed in `prek.ts`, but it was only used
    by `showVerboseLogs()` to locate `prek.log`. This change makes the CLI
    probe the source of truth for cache save/restore as well, and fixes the
    fallback to match prek's actual resolution order.
    
    ## Problems
    
    - Cache path diverged from prek's actual cache location.
    `getCachePaths()` in `cache.ts` hardcoded `~/.cache/prek` (Linux/macOS)
    and `LOCALAPPDATA/prek` (Windows). prek itself resolves its cache via
    `PREK_HOME`, then `XDG_CACHE_HOME`, then platform defaults. Any user
    with `PREK_HOME` or a non-default `XDG_CACHE_HOME` would save/restore
    against the wrong directory.
    - CLI probe result was ignored for caching. `getPrekCacheDir()` already
    queried `prek cache dir --no-log-file` (the `--no-log-file` flag
    prevents the probe itself from writing to prek's trace log). But
    `restorePrekCache` never called it, using the hardcoded paths instead.
    - Duplicated, circular logic. `getCachePaths` lived in `cache.ts`,
    `getPrekCacheDir` lived in `prek.ts`, and they imported each other for
    their respective fallbacks.
    - `os.arch()` vs `process.arch` inconsistency. The cache key used
    `os.arch()` while the rest of the codebase uses `process.arch`. They
    return the same value, but `process.arch` is the standard convention in
    Node and avoids the `os` import.
    
    ## Fixes
    
    - `restorePrekCache` now calls `getPrekCacheDir()`, which probes `prek
    cache dir --no-log-file` first.
    - Removes `getCachePaths()` entirely. The fallback logic is consolidated
    into `getDefaultPrekCacheDir()` in `prek.ts`, mirroring prek's own
    resolution: `PREK_HOME` (used as-is with tilde expansion, no `/prek`
    suffix), then `LOCALAPPDATA/prek` on Windows, then
    `XDG_CACHE_HOME/prek`, then `~/.cache/prek`.
    - Replaces `os.arch()` with `process.arch` in the cache key.
    
    ## Future
    
    The fallback exists because `prek cache dir` was added in v0.2.2 and
    `--no-log-file` in v0.2.3, so the CLI probe fails on older versions
    still in the version manifest (back to v0.0.23). Once pre-v0.2.2
    versions are dropped from the manifest, `getDefaultPrekCacheDir` can be
    removed entirely.
    
    ## Test plan
    
    - [x] Unit tests for `getPrekCacheDir`: CLI probe happy path,
    `PREK_HOME` fallback, `XDG_CACHE_HOME`/`LOCALAPPDATA` fallback
    shaanmajid authored Mar 17, 2026
    Configuration menu
    Copy the full SHA
    afbb103 View commit details
    Browse the repository at this point in the history
Loading