build: add lefthook pre-commit and pre-push hooks #2

Sammanfogat
supernaut sammanfogade 1 incheckning från build/add-lefthook in i main 2026-07-29 12:34:59 +00:00
Ägare

This repo had no lefthook at all — no config and no installed hooks — while bitborg-web,
bitborg-infra and bitborg-internal all have it. That gap is not theoretical: it is how
bitborg-reconcile-trigger's main ended up with an unformatted README.md that failed
its own format:check and, once branch protection landed, blocked every PR in that repo.

Mirrors the existing setup rather than inventing one:

  • lefthook.json — modelled on bitborg-web's, minus the Astro/stylelint jobs this repo
    has no use for. pre-commit runs prettier on staged files, markdownlint on staged
    *.md, and eslint --fix on staged JS/TS/JSON, all with stage_fixed: true.
    pre-push runs build and test (bitborg-web additionally runs e2e; there is none here).
  • .markdownlint-cli2.jsonc — copied verbatim from bitborg-internal/bitborg-infra, so
    markdown rules stay consistent across the workspace.
  • lefthook@2.1.10 + markdownlint-cli2@0.23.1 devDependencies, pinned to the same
    versions the other repos use.
  • pnpm-workspace.yaml — allowBuilds: { lefthook: true }. This one matters: without
    it pnpm blocks lefthook's postinstall, which is what installs the hooks, so they would
    silently never be installed. pnpm actually stubbed the key in as
    lefthook: set this to true or false during install.

Verified end to end, not just configured: pnpm install reports
sync hooks: ✔️(pre-push, pre-commit), both hook files exist in .git/hooks/, the
pre-commit hook ran on this very commit (format applied; the markdown and eslint jobs
correctly skipped for want of matching staged files), and the pre-push hook ran build and
test when this branch was pushed.

This repo had no lefthook at all — no config and no installed hooks — while bitborg-web, bitborg-infra and bitborg-internal all have it. That gap is not theoretical: it is how `bitborg-reconcile-trigger`'s `main` ended up with an unformatted `README.md` that failed its own `format:check` and, once branch protection landed, blocked every PR in that repo. Mirrors the existing setup rather than inventing one: - `lefthook.json` — modelled on bitborg-web's, minus the Astro/stylelint jobs this repo has no use for. `pre-commit` runs prettier on staged files, markdownlint on staged `*.md`, and eslint `--fix` on staged JS/TS/JSON, all with `stage_fixed: true`. `pre-push` runs build and test (bitborg-web additionally runs e2e; there is none here). - `.markdownlint-cli2.jsonc` — copied verbatim from bitborg-internal/bitborg-infra, so markdown rules stay consistent across the workspace. - `lefthook@2.1.10` + `markdownlint-cli2@0.23.1` devDependencies, pinned to the same versions the other repos use. - `pnpm-workspace.yaml` — `allowBuilds: { lefthook: true }`. **This one matters:** without it pnpm blocks lefthook's postinstall, which is what installs the hooks, so they would silently never be installed. pnpm actually stubbed the key in as `lefthook: set this to true or false` during install. Verified end to end, not just configured: `pnpm install` reports `sync hooks: ✔️(pre-push, pre-commit)`, both hook files exist in `.git/hooks/`, the pre-commit hook ran on this very commit (format applied; the markdown and eslint jobs correctly skipped for want of matching staged files), and the pre-push hook ran build and test when this branch was pushed.
supernaut lade till 1 incheckning 2026-07-29 12:27:09 +00:00
build: add lefthook pre-commit and pre-push hooks
Alla kontroller lyckades
ci / ci (pull_request) Successful in 28s
de5a2ce6e3
supernaut tvångsskickade build/add-lefthook från de5a2ce6e3
Alla kontroller lyckades
ci / ci (pull_request) Successful in 28s
till a98d658baf
Alla kontroller lyckades
ci / ci (pull_request) Successful in 29s
2026-07-29 12:32:03 +00:00
Jämför
supernaut sammanfogade incheckning c352781e68 till main 2026-07-29 12:34:59 +00:00
supernaut tog bort grenen build/add-lefthook 2026-07-29 12:34:59 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-07-29 12:34:59 +00:00
supernaut refererade denna ändringsförfrågan från en incheckning 2026-08-03 09:41:39 +00:00
Logga in för att delta i denna konversation.
Inga granskare
Ingen milstolpe
Inget projekt
Inga tilldelade
1 deltagare
Notiser
Förfallodatum
Förfallodatumet är ogiltigt eller utanför gränserna. Använd formatet "åååå-mm-dd".

Inget förfallodatum satt.

Beroenden

Inga beroenden satta

Referens
bitborg/bitborg-payment!2
Ingen beskrivning angiven.