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
80•fortuitous-frog•2h ago

Comments

rurban•2h ago
Not just faster than pre-commit, and totally compatible. Also with more features.
verdverm•1h 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•1h ago
The value is in finding out something is going to fail locally before pushing it. Useful for agents and humans alike.
szenrom•1h 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•1h 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•1h ago
I like my pre-receive hooks.
forgotpwd16•1h 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•1h 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•1h 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•1h 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•1h 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•53m 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
esafak•9m ago
Yes, you can run the CI script locally so you detect errors faster.
JoshTriplett•1h 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•1h ago
Run the light ones on commit, the heavy ones on push.
fortuitous-frog•1h ago
There's a config option for that :) https://prek.j178.dev/configuration/#default_install_hook_ty...
anttihaapala•48m ago
formatting should definitely be in pre-commit though, otherwise you'll destroy diffs.
schindlabua•1h 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.
esafak•47m ago
You do seem to be doing it wrong. Extensive manipulation of the record and slow hooks are both undesirable.
schindlabua•31m ago
I would reckon cleaning up your branch before opening a pull request is good practice. I also rebase a lot, aswell as git reset, and I use wip commits.

Slow hooks are also not a problem in projects I manage as I don't use them.

esafak•28m ago
No, I would not and don't do that. It is better to leave the PR commits separate and atomic so reviewers can digest them more easily. You just squash on merge.

> Slow hooks are also not a problem in projects I manage as I don't use them.

You bypass the slow hooks you mentioned? Why even have hooks then?

schindlabua•22m ago
I do leave PR commits separate. In my teams I don't set up pre-commit hooks altogether, unless others feel strongly otherwise. In projects where they are forced upon me I frequently --no-verify hooks if they are slow, as the linter runs on save and I run tests during development. CI failing unintentionally is usually not a problem for me.
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.
worldsayshi•31m ago
I've used pre-commit very sparingly but it has happened and I also have no idea why this project need to exist? Why would pre-commit ever lead to performance problems? I get that the processes that are hooked in can be long running but the pre-commit itself? Why would it take any time at all?
esafak•1h 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•57m 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•51m 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•1h 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•1h 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•1h 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•1h 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•1h 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•1h 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__•1h 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•57m 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.

nitnelave•47m ago
Client-side pre-commit hooks are there to help you in the same way that type checking (or a powerful compiler) is there to help you avoid bugs. In particular with git, you can skip the hooks when committing.

Now, if the server enforces checks on push, that's a project policy that should be respected.

iFire•57m 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•55m ago
I always just disable pre-commit
esafak•50m ago
I don't always test my code, but when I do, I do it in CI.
dpc_01234•18m ago
BTW. Pre-commit hooks are the wrong way to go about this stuff.

I'm advocating for JJ to build a proper daemon that runs "checks" per change in the background. So you don't run pre-commit checks when committing. They just happen in the background, and when by the time you get to sharing your changes, you get all the things verified for you for each change/commit, effortlessly without you wasting time or needing to do anything special.

I have something a bit like that implemented in SelfCI (a minimalistic local-first Unix-philosophy-abiding CI) https://app.radicle.xyz/nodes/radicle.dpc.pw/rad%3Az2tDzYbAX... and it replaced my use of pre-commit hooks entirely. And users already told me that it does feel like commit hooks done right.

digdugdirk•6m ago
That looks really cool! I've been looking for a more thought-out approach to hooks on JJ, I'll dig into this. Do you have any other higher level architecture/overview documentation other than what is in that repo? It has a sense of "you should already know what this does" from the documentation as is.

Also, how do you like Radicle?

egorfine•8m ago
What difference does it make that it's written in Rust? Why is that so much a selling that it made it into the title?
fuddle•7m ago
It would be great to see some charts on https://prek.j178.dev/benchmark/

Qwen3-Coder-Next

https://qwen.ai/blog?id=qwen3-coder-next
312•danielhanchen•2h ago•179 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/
72•davidbarker•57m ago•39 comments

Deno Sandbox

https://deno.com/blog/introducing-deno-sandbox
90•johnspurlock•1h ago•23 comments

Agent Skills

https://agentskills.io/home
249•mooreds•4h ago•157 comments

AliSQL: Alibaba's open-source MySQL with vector and DuckDB engines

https://github.com/alibaba/AliSQL
12•baotiao•20m ago•1 comments

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

https://github.com/j178/prek
81•fortuitous-frog•2h ago•45 comments

221 Cannon Road Is Not for Sale

https://fredbenenson.com/blog/2026/02/03/221-cannon-is-not-for-sale/
36•mecredis•2h ago•21 comments

France dumps Zoom and Teams as Europe seeks digital autonomy from the US

https://apnews.com/article/europe-digital-sovereignty-big-tech-9f5388b68a0648514cebc8d92f682060
260•AareyBaba•2h ago•122 comments

What's up with all those equals signs anyway?

https://lars.ingebrigtsen.no/2026/02/02/whats-up-with-all-those-equals-signs-anyway/
487•todsacerdoti•9h ago•150 comments

Kilobyte is precisely 1000 bytes

https://waspdev.com/articles/2026-01-11/kilobyte-is-1000-bytes
31•surprisetalk•2h ago•75 comments

Launch HN: Modelence (YC S25) – App Builder with TypeScript / MongoDB Framework

25•eduardpi•2h ago•15 comments

Defining Safe Hardware Design [pdf]

https://people.csail.mit.edu/rachit/files/pubs/safe-hdls.pdf
19•rachitnigam•1h ago•2 comments

Bunny Database

https://bunny.net/blog/meet-bunny-database-the-sql-service-that-just-works/
160•dabinat•6h ago•75 comments

Heritability of intrinsic human life span is about 50%

https://www.science.org/doi/10.1126/science.adz1187
95•XzetaU8•2d ago•55 comments

Show HN: Octosphere, a tool to decentralise scientific publishing

https://octosphere.social/
15•crimsoneer•1h ago•7 comments

Puget Systems Most Reliable Hardware of 2025

https://www.pugetsystems.com/labs/articles/puget-systems-most-reliable-hardware-of-2025/
7•zdw•3d ago•0 comments

The Everdeck: A Universal Card System (2019)

https://thewrongtools.wordpress.com/2019/10/10/the-everdeck/
53•surprisetalk•6d ago•16 comments

Tadpole – A modular and extensible DSL built for web scraping

https://tadpolehq.com/
14•zachperkitny•2h ago•5 comments

Floppinux – An Embedded Linux on a Single Floppy, 2025 Edition

https://krzysztofjankowski.com/floppinux/floppinux-2025.html
219•GalaxySnail•14h ago•151 comments

Emerge Career (YC S22) is hiring a product designer

https://www.ycombinator.com/companies/emerge-career/jobs/omqT34S-founding-product-designer
1•gabesaruhashi•7h ago

Show HN: C discrete event SIM w stackful coroutines runs 45x faster than SimPy

https://github.com/ambonvik/cimba
13•ambonvik•2h ago•5 comments

Show HN: I built "AI Wattpad" to eval LLMs on fiction

https://narrator.sh/llm-leaderboard
5•jauws•1h ago•4 comments

Show HN: Sandboxing untrusted code using WebAssembly

https://github.com/mavdol/capsule
40•mavdol04•4h ago•17 comments

The next steps for Airbus' big bet on open rotor engines

https://aerospaceamerica.aiaa.org/the-next-steps-for-airbus-big-bet-on-open-rotor-engines/
25•CGMthrowaway•3h ago•24 comments

Show HN: PII-Shield – Log Sanitization Sidecar with JSON Integrity (Go, Entropy)

https://github.com/aragossa/pii-shield
5•aragoss•2h ago•0 comments

Migrate Wizard – IMAP Based Email Migration Tool

https://migratewizard.com/#features
7•techstuff123•1h ago•7 comments

Y Combinator will let founders receive funds in stablecoins

https://fortune.com/2026/02/03/famed-startup-incubator-y-combinator-to-let-founders-receive-funds...
10•shscs911•32m ago•1 comments

Visual Family Cosmos

https://rosano.ca/blog/visual-family-cosmos
7•akkartik•5d ago•1 comments

Banning lead in gas worked. The proof is in our hair

https://attheu.utah.edu/health-medicine/banning-lead-in-gas-worked-the-proof-is-in-our-hair/
280•geox•17h ago•208 comments

Data Brokers Can Fuel Violence Against Public Servants

https://www.wired.com/story/how-data-brokers-can-fuel-violence-against-public-servants/
73•achristmascarl•3h ago•34 comments