frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

fp.

Open in hackernews

Prek: A better, faster, drop-in pre-commit replacement, engineered in Rust

https://github.com/j178/prek
63•fortuitous-frog•1h ago

Comments

rurban•1h ago
Not just faster than pre-commit, and totally compatible. Also with more features.
verdverm•58m ago
Voting and comment rings are against HN guidelines
BewareTheYiga•1h ago
This has been such a breath of fresh air. It was seamless to drop into my projects.
candiddevmike•1h ago
I struggle to see value with git hooks. They're an opt-in, easily opt-out way of calling shell scripts from my understanding--you can't force folks to run them, and they don't integrate/display nicely with CI/CD.

Why not just call a shell script directly? How would you use these with a CI/CD platform?

esafak•59m ago
The value is in finding out something is going to fail locally before pushing it. Useful for agents and humans alike.
szenrom•58m ago
I tend to work the other way around - what is defined in CI steps gets added to pre-commit. Several tools have already existing configurations or you can use local mode. Sure, I can't force people to use it but it saves them time as CI would fail anyway.
thoughtpalette•58m ago
You can obviously bypass them, but having precommit hooks to run scripts locally, to make sure certain checks pass, can save them from failing in your pipeline, which can save time and money.

From an org standpoint you can have them (mandate?) as part of the developer experience.

(Our team doesn't use them, but I can see the potential value)

throw20251220•57m ago
I like my pre-receive hooks.
forgotpwd16•55m ago
Besides during commit, pre-commit/prek can run all hooks with `run`. So in CI/CD you can replace all discrete lint/format tool calls with one to pre-commit/prek. E.g. https://github.com/python/cpython/blob/main/.github/workflow....
candiddevmike•44m ago
This just seems like calling a shell script with extra steps.

I have a shell utility similar to make that CI/CD calls for each step (like for step build, run make build) that abstracts stuff. I'd have Prek call this tool, I guess, but then I don't get what benefit there is here.

fortuitous-frog•54m ago
They're very commonly used in CI. There are dedicated GitHub actions for pre-commit and prek, but most commonly people just invoke something like `prek run --all-files` or `pre-commit run --all-files` in their typical lint CI jobs.

The prek documentation has a list of many large projects (such as CPython and FastAPI, to name a few) who use it; each link is a PR of how they integrated it into CI if you want to see more: https://prek.j178.dev/#who-is-using-prek

BeeOnRope•43m ago
They integrate well with CI.

You run the same hooks in CI as locally so it's DRY and pushes people to use the hooks locally to get the early feedback instead of failing in CI.

Hooks without CI are less useful since they will be constantly broken.

candiddevmike•41m ago
Why wouldn't I just call the same shell script in CI and locally though? What's the benefit here? All I'm seeing is circular logic.
aniforprez•5m ago
The point is enforcement. If there's a newcomer to developing your repo, you can ask them to install the hooks and from thereon everything they commit will be compatible with the processes in your CI. You don't need to manually run the scripts they'll run automatically as part of the commit or push or whatever process
JoshTriplett•41m ago
I think there's value in git hooks, but pre-commit is the wrong hook. This belongs in a hook that runs on attempted push, not on commit.
esafak•36m ago
Run the light ones on commit, the heavy ones on push.
fortuitous-frog•35m ago
There's a config option for that :) https://prek.j178.dev/configuration/#default_install_hook_ty...
schindlabua•39m ago
This might be a me problem but I extensively manipulate the git history all the time which makes me loathe git hooks. A commit should take milliseconds, not a minute.
fishgoesblub•1h ago
Am I alone in that I never have had an issue with performance with pre-commit? granted I don't work on projects the size of the Linux kernel, but I haven't had any complaints.
esafak•57m ago
I use http://hk.jdx.dev/, which is based on https://pkl-lang.org/ and Rust, as it integrates with http://mise.jdx.dev/.

Is prek much better?

aniforprez•9m ago
prek is compatible with pre-commit so any hooks that can be used for pre-commit can be used with prek including the repo config file. Depending on if you're interested in buying into the existing pre-commit ecosystem, which is pretty extensive, then prek is a really good alternative
sangeeth96•3m ago
Love mise, didn't know about hk. Will check this out but don't think $WORK (or me) needs more than lefthook at the moment, which we're quite happy with. Wonder if there are comparisons/example projects that showcases the unique value propositions.
jdxcode•45m ago
I think it was a massive mistake to build on the pre-commit plugin base. pre-commit is probably the most popular tool for pre-commit hooks but the platform is bad. My main critique is that it mixes tool installation with linting—when you will undoubtedly want to use linters _outside_ of hooks. The interface isn't built with parallelism in mind, it's sort of bolted on but not really something I think could work well in practice. It also uses a bunch of rando open source repos which is a supply chain nightmare even with pinning.

pre-commit considered harmful if you ask me. prek seems to largely be an improvement but I think it's improving on an already awful platform so you should not use it.

I know I am working on a competing tool, but I don't share the same criticism for lefthook or husky. I think those are fine and in some ways (like simplicity) better than hk.

jayd16•33m ago
I think really they just need to implement some kind of plug-in or extension framework. Extensions are just not first class citizens but they really should be.

There should be a .gitextensions in the repo that the repo owners maintain just like .gitignores and . gitattributes etc etc. Everything can still be opt in by every user but at least all git clients would be able to know about, pull down, and install per user discretion.

It seems pretty basic in this day and age but it's still a gaping hole. You still need to manually call LFS install for goodness sake.

aaronblohowiak•40m ago
So if you are using multiple languages to have scripts that run off your pre-commit hook, this is like a package and language runtime management system for your pre-commit hook build system? Rather, I think this is a reimplementation of such a system in rust so it can be self contained and fast.

This is the kind of thing I see and I think to myself: is this solving a problem or is this solving a problem that the real problem created?

Why is your pre-commit so complicated that it needs all this? I wish I could say it could all be much simpler, but I’ve worked in big tech and the dynamics of large engineering workforces over time can make this sort of thing do more good than harm, but again I wonder if the real problem is very large engineering teams…

timhh•39m ago
I have also been working on an alternative written in Rust, but in my version the hooks are WASI programs. They run on a virtual filesystem backed by the Git repo. That means a) there are no security issues (they have no network access, and no file access outside the repo), b) you can run them in parallel, c) you can choose whether to apply fixes or not without needing explicit support from the plugin, and most importantly d) they work reliably.

I'm sure this is more reliably than pre-commit, but you still have hooks building Python wheels and whatnot, which fails annoyingly often.

https://github.com/timmmm/nit

The VFS stuff is not quite finished yet though (it's really complicated). If anyone wants to help me with that it would be welcome!

jdxcode•23m ago
the second the hooks modify the code they've broken your sandbox

I think wasi is a cool way to handle this problem. I don't think security is a reason though.

anentropic•32m ago
I am a big fan of prek and have converted a couple of projects over from pre-commit

The main advantage for me is that prek has support for monorepo/workspaces, while staying compatible with existing pre-commit hooks.

So you can have additional .pre-commit-config.yaml files in each workspace under the root, and prek will find and run them all when you commit. The results are collated nicely. Just works.

Having the default hooks reimplemented in Rust is minor bonus (3rd party hooks won't be any faster) and also using uv as the package manager speeds up hook updates for python hooks.

__mharrison__•18m ago
Really enjoying using prek.

Dedicated a whole chapter to it in my latest book, Effective Testing.

The trend of fast core (with rust) and convenient wrapper is great while we are still writing code.

xyzzy_plugh•9m ago
Another commenter is currently down voted for something similar, but I'll share my controversial take anyways: I hate pre-commit hooks.

I loathe UX flows where you get turned around. If I try to make a commit, it's because that I what I intend to do. I don't want to receive surprise errors. It's just more magic, more implicit behavior. Give me explicit tooling.

If you want to use pre-commit hooks, great! You do you. But don't force them on me, as so many projects do these days.

iFire•9m ago
I don't understand. The whole point of pre-commit is it's a gateway to the operating system and also creating a ecosystem of pre integration continuous integration scripts. Scripts that are not rust.
semiinfinitely•7m ago
I always just disable pre-commit
esafak•2m ago
I don't always test my code, but when I do, I do it in CI.

The Fallen Apple

https://mattgemmell.scot/the-fallen-apple/
1•cdrnsf•1m ago•0 comments

My six-year-old loves heavy metal

https://dogdogfish.com/blog/2026/02/03/heavy-metal-boy/
1•matthewsharpe3•1m ago•0 comments

Show HN: ContextPin – local-first context manager for AI coding workflows

https://contextpin.com/blog/introducing-contextpin/
1•strandnerd•1m ago•0 comments

AI powered by what you've seen said or heard

https://screenpi.pe
1•arafatk•2m ago•0 comments

Baby Sauropods Were the Potato Chips of the Jurassic Era

https://nautil.us/baby-sauropods-were-the-potato-chips-of-the-jurassic-era-1265298/
1•speckx•3m ago•0 comments

Genesis

https://zenodo.org/records/18472020
3•Anonymus12233•4m ago•0 comments

My Teletext Website

https://pakastin.fi
2•pkstn•5m ago•1 comments

Draft quantum order tasks agencies with reinvigorating the tech's development

https://www.nextgov.com/emerging-tech/2026/02/draft-quantum-order-tasks-many-agencies-reinvigorat...
2•petethomas•5m ago•0 comments

Show HN: A Directory for European Tech Stack Alternatives

https://www.stackeuropa.com/
1•Collusus96•5m ago•0 comments

Mary, Mother of Mercy

https://lifeofanunorsister.blogspot.com/2016/08/mary-mother-of-mercy.html
1•marysminefnuf•6m ago•0 comments

Qwen3-Coder-Next: How to Run Locally

https://unsloth.ai/docs/models/qwen3-coder-next
2•simonpure•6m ago•0 comments

Show HN: ClawdHost – Managed OpenClaw Hosting

https://clawdhost.net
1•shraey96•7m ago•0 comments

Game of Thrones Didn't Fall Off in Later Seasons

1•JohnSnowDoesDie•7m ago•2 comments

From 'nerdy' Gemini to 'edgy' Grok: how developers are shaping AI behaviours

https://www.theguardian.com/technology/2026/feb/03/gemini-grok-chatgpt-claude-qwen-ai-chatbots-id...
3•devonnull•7m ago•0 comments

Changes to .SWOOSH

https://blog.swoosh.nike/changes-to-swoosh-9444414a420f
1•ChrisArchitect•7m ago•0 comments

Likes, Loops, and Limbic Systems: The Neurological Impact of Social Media

https://medium.com/neurotechx/likes-loops-and-limbic-systems-unveiling-the-neurological-impact-of...
2•rzk•7m ago•0 comments

Show HN: Add This to Calendar – Built with Claude as a non-technical maker

https://chromewebstore.google.com/detail/add-this-to-calendar/jbceogdnbbhhhjeglpllfbdpcccfhkkd
1•michikoj•7m ago•0 comments

Why Social Media Is So Addictive – The Science Behind Dopamine and Reward

https://medium.com/cognitive-neuroeconomics/why-social-media-is-so-addictive-the-science-behind-d...
3•rzk•8m ago•0 comments

Xcode 26.3 unlocks the power of agentic coding

https://www.apple.com/newsroom/2026/02/xcode-26-point-3-unlocks-the-power-of-agentic-coding/
15•davidbarker•9m ago•5 comments

Show HN: MCP server for generating Mermaid diagrams with live browser preview

https://github.com/iishyfishyy/mermaid-live-mcp
1•ishyfishyy•10m ago•0 comments

British Museum's A.I.-generated post sparks online backlash

https://news.artnet.com/art-world/british-museum-ai-backlash-2742244
1•FeteCommuniste•10m ago•0 comments

Is your social life missing something? This is for you [audio]

https://podcasts.apple.com/us/podcast/is-your-social-life-missing-something-this-is-for-you/id154...
1•nkzednan•11m ago•1 comments

My Eighth Year as a Bootstrapped Founder

https://mtlynch.io/bootstrapped-founder-year-8/
1•mtlynch•11m ago•0 comments

Security startup Cyera hits $9B valuation six months after being valued at $6B

https://techcrunch.com/2026/01/08/data-security-startup-cyera-hits-9b-valuation-six-months-after-...
1•PaulHoule•11m ago•0 comments

Deno Deploy Is Generally Available

https://deno.com/blog/deno-deploy-is-ga
2•frou_dh•12m ago•0 comments

Show HN: I gave 11 LLMs my trading strategy to see which one profits

https://daytradingbench.com
1•porttipasi•13m ago•2 comments

Tech-Free January

https://fivetwelvethirteen.substack.com/p/tech-free-january
1•yorwba•13m ago•0 comments

How The Browser Company's CTO is rebuilding teams for the AI era ($610M exit) [video]

https://www.youtube.com/watch?v=OZmP466Rt34
3•dstik•13m ago•0 comments

Accomplish launching the first Windows-native AI Coworker

https://twitter.com/_orcaman/status/2018738160159613225
1•AmitAvner•13m ago•0 comments

X's Paris Office Raided by Prosecutors, Musk Summoned for Interview

https://www.wsj.com/tech/xs-paris-office-raided-by-prosecutors-eb5a820a
1•JumpCrisscross•14m ago•0 comments