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

134 Commits

Author SHA1 Message Date
Jo
e9962a656a Improve 2026-01-27 15:50:16 +08:00
Jo
2957d6d747 Support inline script for language: script 2026-01-27 15:50:16 +08:00
Shaan Majid
e4d3dfd10a Add language: swift support (#1463)
* feat(swift): add Swift language support

Implement Swift language support for prek:
- Query swift executable and parse version from `swift --version`
- Handle both macOS (Apple Swift) and Linux version formats
- Normalize versions without patch component (e.g., "6.1" -> "6.1.0")
- Handle pre-release versions (e.g., "6.2-dev")
- Build Package.swift repos with `swift build -c release`
- Use `swift build --show-bin-path` to resolve target-specific bin directory
- Add built binaries to PATH when running hooks
- Health check verifies swift executable still exists

Include unit tests for version parsing covering:
- macOS format with swift-driver prefix
- Linux format
- Multiline output handling
- Versions without patch component
- Development/nightly versions
- Invalid input handling

* test(swift): add Swift language tests

* docs(swift): mark Swift as supported in language documentation

* ci: stabilize swift toolchain setup across platforms

- pin Swift version in env to keep CI deterministic\n- use SwiftyLab/setup-swift on Windows where swift-actions fails\n- install Swift on macOS and reset TOOLCHAINS back to Xcode\n- force CC/CXX/SDKROOT from Xcode so Ruby native gems compile\n\nThis keeps Swift hooks available while restoring Xcode's clang/SDK,\nwhich avoids msgpack native extension failures on macOS.
2026-01-23 11:28:18 +08:00
Jo
da5ddd8304 Bump version to 0.3.0 2026-01-22 11:49:30 +08:00
Jo
720c7cb732 Use git ls-remote --tags to list bun versions (#1439) 2026-01-22 11:05:41 +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
jmm
5400299a4d Add pronounciation entry to FAQ. (#1442) 2026-01-22 00:00:44 +08:00
Jo
23b4456a80 Expand ~ tilde in PREK_HOME (#1431) 2026-01-21 11:35:52 +08:00
Jo
ccc8f92ca7 Remove mkdocs hooks (#1424) 2026-01-20 19:50:07 +08:00
Kevin Gimbel
88c3c87954 Move docs to zensical (#1421)
* chore: slight formatting adjustments

* feat: use zensical

* chore: add uv to mise.toml

* docs: update snippets and snippet markers for includes

* chore: add prek to mise.toml; run prek

* fix: use snippet for changelog instead of symlink

Seems Zensical doesn't like symlinks, a snippet gets the same result

* chore: remove commented-out code

* chore: remove commented-out code; run prek
2026-01-20 19:44:15 +08:00
Matthias Schoettle
0784ddfaea Add mdformat pre-commit hook (#1416) 2026-01-20 11:26:37 +08:00
Matthias Schoettle
a01951d129 Fix nested list indent rendering issue (#1414) 2026-01-20 05:09:57 +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
Jo
de647489ea Bump version to 0.2.30 (#1392) 2026-01-18 20:49:58 +08:00
Jo
b7b453d500 Document that check-json5 now rejects duplicate keys (#1391) 2026-01-18 17:01:09 +08:00
Jo
52c20ab065 Document language support details (#1380) 2026-01-17 17:48:11 +08:00
Jo
8c2580a12b Fix callout indentation (#1375) 2026-01-16 21:07:48 +08:00
Jo
b7a7becead Bump version to 0.2.29 (#1374) 2026-01-16 19:28:25 +08:00
Jo
f6731ad435 Explain project configuration scope (#1373) 2026-01-16 19:09:44 +08:00
Na'aman Hirschfeld
392eb2d60c Add glob list support for file patterns (files and exclude) (#1197)
* feat: add glob list support for file patterns

# Conflicts:
#	docs/configuration.md

* Fix clippy warnings in config tests

* Add tests for glob file patterns

* chore: run cargo fmt

* test: make glob pattern test windows-friendly

* Fix CI: add globset dep and disable GPG signing in tests

* Update json schema

* Tweaks

* Update doc

* Update doc

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-01-16 16:59:26 +08:00
Jo
be8f49e6f3 Document builtin hooks (#1370) 2026-01-16 15:23:39 +08:00
Jo
352685fdbd Add check-json5 as builtin hooks (#1367)
* Add `check-json5` as builtin hooks

* Refactor

* Add tests

* Tweak

* Document JSON5 duplicate key behavior in test (#1368)

* Initial plan

* Add documentation explaining duplicate key behavior in JSON5

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
2026-01-16 14:51:51 +08:00
Jo
4b7521bc96 Bump version to 0.2.28 (#1349) 2026-01-13 22:57:14 +08:00
Copilot
c48699a526 Document UV environment variable inheritance in prek (#1339)
* Initial plan

* Document UV environment variable impact in diff.md

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

* Use mkdocs-material warning callout for UV environment variables

Co-authored-by: j178 <10510431+j178@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2026-01-12 20:47:58 +08:00
Jo
b99d05c440 Complete configuration document (#1338) 2026-01-12 20:34:11 +08:00
dependabot[bot]
11b9171b83 Bump urllib3 from 2.6.0 to 2.6.3 in /docs (#1324)
Bumps [urllib3](https://github.com/urllib3/urllib3) from 2.6.0 to 2.6.3.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/2.6.0...2.6.3)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-version: 2.6.3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-01-08 15:37:07 +08:00
Jo
549f3ae299 Remove background from logo (#1322) 2026-01-07 22:45:33 +08:00
Jo
a72a3cc3df Bump version to 0.2.27 (#1321) 2026-01-07 22:14:04 +08:00
Jo
e255e88d37 Bump version to 0.2.26 (#1318) 2026-01-07 20:49:55 +08:00
Branch Vincent
d0c33b1833 Support apple's container for docker lang (#1306)
* Support apple's `container` for docker lang

* Tweak

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-01-07 16:09:05 +08:00
Jo
d07b1916ae Skip cookiecutter template directories like {{cookiecutter.project_slug}} during project discovery (#1316)
Fixes #1315
Updates #1044
2026-01-07 15:53:02 +08:00
Daniel Parks
0efd6370d7 Add env to set environment variables for hooks (#1279) (#1285)
* Add `env` to set environment variables for hooks (#1279)

This key is not supported by `pre-commit`.

* DO NOT MERGE: use my fork of prek-test-repos/script-hooks

* Update test

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-12-30 17:08:44 +08:00
Jo
1856285aba Bump version to 0.2.25 (#1282)
* Bump version to 0.2.25

* Update JSON schema
2025-12-27 00:36:49 +08:00
Jo
28df874c3f Use grouped code blocks in index.md (#1276) 2025-12-24 20:02:00 +08:00
Jo
0278b59b76 Bump version to 0.2.24 (#1265) 2025-12-23 11:01:07 +08:00
Jo
02414edb56 Render changelog in document site (#1248)
# Conflicts:
#	.github/workflows/release.yml
2025-12-22 00:49:01 +08:00
Jo
c8b46885be Add docker integration docs (#1254) 2025-12-22 00:34:51 +08:00
Jo
ae056aff2d Clarify priority scope across repos (#1251) 2025-12-21 14:17:14 +08:00
Jo
17a2f64eba Improve documentation for configurations (#1247) 2025-12-20 14:10:44 +08:00
Jo
c7545d8edb Improve documentation for priority (#1245) 2025-12-20 12:46:10 +08:00
Jo
1c9d1f5618 Implement priority based parallel execution (#1232)
* Support priority-based parallel hook execution

* .

* .

* .

* .

* .

* Implement `priority` based parallel exeuction

* Reduce repeated code

* Add progress for processing files

* Improve sytling

* Tweak UI

* Fix UI

* Update snaps

* Update docs

* Add a test

* Update proposal

* Update crates/prek/src/config.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* Apply review feedbacks

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-20 12:09:42 +08:00
Louis Maddox
5785a1aa42 Implement check-case-conflict as builtin hook (#888)
* feat(check-case-conflict): implement builtin hook

# Conflicts:
#	crates/prek/src/hooks/pre_commit_hooks/check_case_conflict.rs
#	crates/prek/tests/builtin_hooks.rs
#	src/builtin/pre_commit_hooks/mod.rs

* fix: exit test gracefully on case insensitive file system

* Add docs

* Fix tests

* Add to builtin hooks

* Reduce allocs

* Further reduce

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2025-12-18 13:42:10 +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
Jo
292063956f Refactor Rust toolchain management (#1198)
* Refactor Rust toolchain management

- Reuse system installed rustup
- Reuse installed rustup across hooks
- Reuse installed Rust toolchains across hooks

* Fix tests

* Avoid using bare cargo

* Update crates/prek-consts/src/env_vars.rs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-08 16:41:06 +08:00
Jo
6a2f212fea Upgrade dependencies for docs (#1195) 2025-12-06 14:24:08 +08:00