1
0
mirror of https://github.com/j178/prek.git synced 2026-04-25 02:11:36 +02:00

34 Commits

Author SHA1 Message Date
Shaan Majid 2b811fb6a2 Add language: deno support (#1516)
---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
Co-authored-by: Janosh Riebesell <janosh.riebesell@gmail.com>
2026-03-20 09:24:24 +08:00
Daisuke Sato 47c017a6e8 Add --all flag to prek uninstall (#1817)
## Summary

  Closes #1779

- Add `--all` flag to `prek uninstall` that scans the hooks directory
and removes every prek-managed hook (detected via `is_our_script()`),
regardless of hook type
- Without `--all`, behavior is unchanged: uses `-t` or
`default_install_hook_types`, falls back to `pre-commit`
  - `--all` and `-t` are mutually exclusive (`conflicts_with`)
- Suppress "not managed" / "does not exist" skip messages when `--all`
is used, since iterating all hook types will naturally hit many
non-existent ones

  ## Tests

- `uninstall_all_managed_hooks`: `--all` removes all prek-managed hooks
- `uninstall_all_no_hooks`: `--all` exits cleanly when no hooks are
installed
  - Ran `mise run lint` and confirmed no errors

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-03-18 13:09:46 +08:00
Jo 4ed4e8660a Disambiguate “hook” terminology by renaming "Git hooks" to "Git shims" (#1776)
Closes #1775
2026-03-11 11:46:52 +08:00
Jo 9009dc0fd8 Rename prek install-hooks to prek prepare-hooks, prek install --install-hooks to prek install --prepare-hooks (#1766)
This renames the hook environment setup surface from `install-hooks` to
`prepare-hooks` to make the distinction between two different actions
clearer:

- `prek install` installs Git hook shims under .git/hooks
- `prek prepare-hooks` prepares the managed hook environments and caches

The old naming used "install" for both concepts, which was easy to
misread, especially in forms like `prek install --install-hooks`. The
new names make the behavior more explicit:

- prek install --prepare-hooks
- prek prepare-hooks

Compatibility is preserved, so existing workflows continue to work.

Closes #1762
2026-03-10 13:06:01 +08:00
Dev-iL 2df575becf Update documentation for --stage option (#1727)
Replaced a duplicated "pre-commit" in instructions by "pre-push"

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-03-02 15:37:23 +08:00
Jo 7df258770a Expose --git-dir to force hook installation target (#1723) 2026-03-01 22:27:05 +08:00
Ismar 74a35b6e70 Add prek util list-builtins command (#1600) 2026-02-08 14:02:44 +08:00
Jo b4ed3ee940 Clarify prek list description (#1604)
Closes #1599
Extracted from #1600
2026-02-08 13:45:01 +08:00
Shaan Majid c99a61efd2 Make yaml-to-toml CONFIG argument optional (#1593)
Now attempts to default to `.pre-commit-config.yaml` and
`.pre-commit-config.yml` in PWD before erroring.

Feel free to close if you disagree, just ran into this when spinning up
#1592, and figured it's worth fixing :)

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-02-07 23:19:04 +08:00
Jo 3fa9187f64 Add prek util yaml-to-toml to convert .pre-commit-config.yaml to prek.toml (#1584) 2026-02-06 16:11:01 +08:00
Jo 16f514bafd Move identify and init-template-dir under the prek util top-level command (#1574)
The old `prek init-template-dir` is hide but still works.
2026-02-05 19:39:52 +08:00
Jo d784a470f1 Add documentation about prek.toml (#1560)
update schema url
2026-02-05 17:10:30 +08:00
Jo e0b8bb1305 Support prek sample-config --format toml (#1546)
Support `prek sample-config --format toml`
2026-02-05 17:10:30 +08:00
wangxiaolei df0adba920 Add prek identify subcommand (#1554)
fix #1550

cargo run -- identify .gitignore Cargo.lock README.md .github/

output

```
.gitignore                                                                        
   Tags: file, non-executable, text, gitignore

Cargo.lock
   Tags: file, non-executable, text, toml, cargo-lock

README.md
  Tags: file, non-executable, text, plain-text, markdown

.github/
  Tags: directory
```

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-02-04 13:53:31 +08:00
Les Freire 0a4be22599 Support Julia language (#1519)
resolve #1446

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-02-01 16:13:55 +08:00
Aleksey f10ae08be6 Add PREK_QUIET environment variable support (#1513)
This PR addresses issue #1512 by adding `PREK_QUIET` environment
variable support for controlling quiet output mode (analogous to
`-q`/`-qq` flags).

Key changes include:
- `PREK_QUIET=1` -> quiet mode (like `-q`)
- `PREK_QUIET=2` -> silent mode (like `-qq`)
- Added integration tests and documentation
2026-02-01 09:40:21 +08:00
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