1
0
mirror of https://github.com/j178/prek.git synced 2026-04-03 17:34:03 +02:00
Commit Graph

18 Commits

Author SHA1 Message Date
Shaan Majid
8d464397e6 Add language: bun support (#1411)
* feat(bun): add Bun language support

* test(bun): add integration tests for Bun language support

Add three integration tests covering the key functionality:
- basic_bun: simple hook execution using bun -e
- additional_dependencies: verify deps installed via bunx cowsay
- language_version: test version specification with language_version: "1"

The additional_dependencies test runs twice to verify health_check and
cache reuse works correctly.

* docs: add Bun to supported languages documentation

- Add Bun to toolchain list in README features section
- Add Bun to managed toolchain downloads list in languages.md
- Add full Bun language section with version format documentation

* ci: add Bun setup to test jobs

* feat(bun): use GITHUB_TOKEN to avoid API rate limits

When listing Bun versions from GitHub releases, use the GITHUB_TOKEN
environment variable if available to authenticate requests. This
increases the rate limit from 60 to 5,000 requests/hour.

GITHUB_TOKEN is automatically set in GitHub Actions workflows.

* fix(bun): use consistent bin_dir path on all platforms

Bun installs global packages to $BUN_INSTALL/bin/ on all platforms,
so bin_dir should always return prefix/bin. The Windows special case
was incorrectly copied from Node (which uses npm's different install
structure).

* Add toolchain download test

* Add tests

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-01-22 11:05:41 +08:00
Jo
e67fb2bf3f Implement prek cache gc (#1410)
* Implement `prek cache gc`

* Refactor

* Improve

* Add `--dry-run`

* Add color

* Add `--verbose`

* Improve styling

* Update docs

* Fix

* Improve

* Refactor

* Add test

* Minor
# Conflicts:
#	crates/prek/src/store.rs
2026-01-22 11:05:41 +08:00
Shaan Majid
f5262b6b2c docs: fix HTML anchors, grammar, capitalization, and add missing tracking issues (#1448) 2026-01-22 02:06:13 +08:00
Jo
dfbea266fd Remove #[cfg(unix)] gate on generating cli reference (#1402)
* Remove `#[cfg(unix)]` gate on generating cli reference

* Tweak

* Debug

* Debug

* Normalized eol

* Debug

* Add gitattributes

* Final
2026-01-19 13:37:34 +08:00
Jo
ac1b1d4202 Add --stage as an alias for --hook-stage (#1398) 2026-01-18 22:37:42 +08:00
Copilot
a46ae58c29 Document hook_types flag and default_install_hook_types behavior (#1225) 2025-12-14 17:35:17 +08:00
Jo
72f4c5a59a Prefer tag creation timestamp in --cooldown-days (#1221)
Use `git for-each-ref --sort=-creatordate --format='%(refname:lstrip=2) %(creatordate:unix)' refs/tags` to get a list of tags along with their timestamps.
`creatordate` uses the tag’s creation time if it’s an annotated tag, and if it’s a lightweight tag, it falls back to the commit’s timestamp.
2025-12-13 19:19:55 +08:00
Louis Maddox
2ad3a70f07 Support--cooldown-days in prek auto-update (#1172)
* feat: implement cooldown (default: 1 day)

* refactor: make update_repo a coordinator function

* fix: fallback to search all tags when candidate fails

* perf: batch the tag commit date iteration into one call

* Simplify logic

* Add tests

* Change `--cooldown-days` default to 0, keep backward compability

* Remove `cooldown_days` from config

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-12-12 13:30:30 +08:00
drainpixie
adf78165d8 Fallback to manual stage for hooks specified directly in command line (#1185)
* feat(run): assume stage based on selected hooks

* fix(run): don't clone eagerly

* Remove fallback to `--all-files`, add tests

* Generate cli docs

* Improve wording

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-12-05 14:58:24 +08:00
Matthew Mckee
bd4da34a51 Add cache size command (#1183) 2025-12-03 12:42:45 +08:00
Aditya Yadav
67d956e8a0 Add --fail-fast CLI flag to stop after first hook failure (#908)
* Add --fail-fast CLI flag to stop after first hook failure

- Add fail_fast field to RunArgs struct with CLI flag support
- Fix in hook_impl.rs where fail_fast was hardcoded to false
- Update run() and run_hooks() to accept and propagate fail_fast parameter
- CLI flag overrides config file setting (enables fail-fast mode)
- Ensure try-repo and main entry point pass fail_fast correctly

* Update test snapshots for --fail-fast flag

* Add CLI flag test for --fail-fast

* Fix trailing whitespace in test comment
2025-10-17 11:07:27 +08:00
Luiz Otavio Vilas Boas Oliveira
74cb495dea Implement prek try-repo (#797)
* Add try_repo logic and tests (WIP)

* Remove unnecessary mut

* Fix clippy issues

* Add unit test

* Update snapshots

* Update docs

* Update unit test

* WIP

* Update snapshots

* Lint

* Add extra filters to try_repo tests

* Lint

* Update unit tests

* Apply Josh's suggestions

* Fix arg name

* .

* Fix

* Fix

* Generate

* Fix snapshot

* Improve coverage

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-10-10 21:11:31 +08:00
Jo
6c0cd3b7c8 Make prek auto-update --jobs default to 0 (which uses max available parallelism) (#833) 2025-10-01 23:03:56 +08:00
Jo
0adb26401d Add a global --log-file flag to specify the log file path (#817) 2025-09-29 16:30:48 +08:00
Jo
d7c39b5733 Show error message in quiet mode (#807)
* Show error message in quiet mode

In quiet mode (`-q`), error messages will still be printed.
In silent mode (`-qq`), nothing gets printed.

* Generate cli doc

* Add test
2025-09-28 13:50:16 +08:00
Jo
d0f7c4d6b0 Add --dry-run to prek auto-update (#806) 2025-09-28 12:06:44 +08:00
Jo
04bb76fcb4 Add prek cache dir, move prek gc and prek clean under prek cache (#795)
`prek gc` and `prek clean` are still available but hidden.
2025-09-25 13:36:41 +08:00
Jo
6f0a7da41b Generate cli reference (#707)
* Generate cli reference

* Fix lint
2025-09-10 22:05:05 +08:00