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

151 Commits

Author SHA1 Message Date
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 44ea4c9cab Update schema store url for prek 2026-02-05 17:43:55 +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
Jo 1539b5a210 Add document about authoring remote hooks (#1571) 2026-02-05 17:09:42 +08:00
Copilot 752959ea20 Fix PowerShell completion instruction syntax (#1568)
The PowerShell completion instruction used bash-style environment
variable syntax (`COMPLETE=powershell prek`), which fails in PowerShell
with `CommandNotFoundException`.

## Changes

- Updated `docs/installation.md` to use PowerShell-native syntax for
setting environment variables

**Before:**
```powershell
Add-Content -Path $PROFILE -Value '(COMPLETE=powershell prek) | Out-String | Invoke-Expression'
```

**After:**
```powershell
Add-Content -Path $PROFILE -Value '$env:COMPLETE = "powershell"; prek | Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE'
```

The fix sets `$env:COMPLETE` using PowerShell syntax, invokes `prek` to
generate the completion script, and cleans up the temporary environment
variable.

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> 
> ----
> 
> *This section details on the original issue you should resolve*
> 
> <issue_title>Powershell completion script results in
CommandNotFoundException</issue_title>
> <issue_description>### Summary
> 
> Following the instructions for enabling Powershell shell completions,
I ran `Add-Content -Path $PROFILE -Value '(COMPLETE=powershell prek) |
Out-String | Invoke-Expression'`. This did what I expected it to: it
added a line to my $PROFILE, `(COMPLETE=powershell prek) | Out-String |
Invoke-Expression`.
> 
> However, also as expected, that line results in this error when the
profile loads (and, indeed, if one types that string at the prompt:
> ```
> COMPLETE=powershell : The term 'COMPLETE=powershell' is not recognized
as the name of a cmdlet, function, script file, or operable
> program. Check the spelling of the name, or if a path was included,
verify that the path is correct and try again.
> At
C:\Users\Patrick\OneDrive\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1:357
char:2
> + (COMPLETE=powershell prek) | Out-String | Invoke-Expression
> +  ~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : ObjectNotFound: (COMPLETE=powershell:String) [],
CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException
> ```
> 
> If the problem isn't apparent, perhaps someone can tell me what it's
designed to do so I can help? As a user of both Powershell & unix
shells, I wasn't able to figure out what the command is that we want
Powershell to run after glancing at some of the other completion
scripts.
> 
> ### Platform
> 
> Windows 10 x86_64
> 
> ### Version
> 
> prek 0.3.1 (bc142a25f 2026-01-31)
> 
> ### .pre-commit-config.yaml
> 
> not relevant
> 
> ### Log file
> 
> 2026-02-05T03:33:51.720707Z DEBUG prek: 0.3.1 (bc142a25f 2026-01-31)
> 2026-02-05T03:33:51.720806Z DEBUG Args: ["c:\\users\\username
\\.local\\bin\\prek.exe"]
> 2026-02-05T03:33:51.803464Z TRACE get_root: close time.busy=82.6ms
time.idle=5.10µs</issue_description>
> 
> <agent_instructions>Fix the powershell completion instruction in
installation.md: the style of running command with specified env var
`COMPLETE=powershell prek` is bash-style, it does not work in
powershell. Use something like `$env:COMPLETE = "powershell"; prek |
Out-String | Invoke-Expression; Remove-Item Env:\COMPLETE`
> </agent_instructions>
> 
> ## Comments on the Issue (you are @copilot in this section)
> 
> <comments>
> <comment_new><author>@j178</author><body>
> Thanks for the report! That instruction isn’t correct. Could you try
adding this to your $PROFILE?
> 
> ```pwsh
> $env:COMPLETE = "powershell"
> prek | Out-String | Invoke-Expression
> Remove-Item Env:COMPLETE'
> ```</body></comment_new>
> </comments>
> 


</details>



<!-- START COPILOT CODING AGENT SUFFIX -->

- Fixes j178/prek#1566

<!-- START COPILOT CODING AGENT TIPS -->
---

💬 We'd love your input! Share your thoughts on Copilot coding agent in
our [2 minute survey](https://gh.io/copilot-coding-agent-survey).

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: j178 <10510431+j178@users.noreply.github.com>
2026-02-05 12:11:38 +08:00
Shaan Majid d548c08361 Add llms.txt generation for LLM-friendly documentation (#1553)
Closes #1498 

Generates `llms.txt` and `llms-full.txt` for the documentation site.
Also generates markdown files at each path (e.g.,
`/configuration/index.md`), enabling LLMs to fetch raw markdown instead
of HTML.

As mentioned in the issue, this wasn't natively possible, since Zensical
doesn't yet support MkDocs's plugin ecosystem. I built
[llmstxt-standalone](https://github.com/shaanmajid/llmstxt-standalone)
to work as a standalone `llms.txt` generator, respecting the config for
[mkdocs-llmstxt](https://github.com/pawamoy/mkdocs-llmstxt).

- Configure llmstxt plugin in mkdocs.yml with section structure
- Add `docs-build` and `docs-compile` mise tasks
- Update CI to run llmstxt-standalone after zensical build

Note: the generated files are not served or visible when using `zensical
serve`, but will be generated and published to docs site as part of the
`publish-docs` workflow.

Preview: 
-
[llms.txt](https://gist.github.com/shaanmajid/767af572028a23ec4d0bfac2015011a5#file-llms-txt)
-
[llms-full.txt](https://gist.github.com/shaanmajid/767af572028a23ec4d0bfac2015011a5#file-llms-full-txt)

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-02-04 13:58:36 +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
Shaan Majid 73e14e65d3 Revert "Allow optional upgrade hints after semicolon in minimum_prek_version" (#1538) 2026-02-03 08:34:38 +08:00
Jo 1c1af94121 Allow optional upgrade hints after semicolon in minimum_prek_version (#1536)
Closes #1490
2026-02-02 22:35:12 +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 4525825ea8 docs: remove todo.md (#1501)
- Remove `todo.md` as remaining items have been addressed or documented
elsewhere.
- Move note to `diff.md` that `pre-commit hazmat` subcommand (v4.5.0) is
not implemented.
2026-01-31 22:34:14 +08:00
Jo 41a26c1c0f Bump version to 0.3.1 (#1510) 2026-01-31 20:56:29 +08:00
Les Freire d12e0be035 Support haskell language (#1484)
resolve #1445

---------

Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-01-31 20:28:42 +08:00
Jo 1000d9bfb5 Add a note about the .pre-commit-config.yaml file name for new users (#1505)
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-01-31 15:24:31 +08:00
Shaan Majid 09f1a99947 docs(installation): miscellaneous cleanup (#1502)
Co-authored-by: Jo <10510431+j178@users.noreply.github.com>
2026-01-31 15:20:04 +08:00
Shaan Majid 7e1a49701c docs: add commands for artifact verification using GitHub Attestations (#1500)
Document how to verify release artifacts and Docker images using `gh
attestation verify`.

Refs: #1494, #1497
2026-01-31 13:34:54 +08:00
Shaan Majid f0d96ec853 Allow GIT_CONFIG_PARAMETERS for private repository authentication (#1472) 2026-01-28 08:35:52 +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