From 216152d946e95502cd7dafcc99d6ae182a9c8b97 Mon Sep 17 00:00:00 2001 From: Prad Nukala Date: Tue, 22 Sep 2026 12:59:13 -0400 Subject: [PATCH] init: hooks --- .githooks/pre-push | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 .githooks/pre-push diff --git a/.githooks/pre-push b/.githooks/pre-push new file mode 100755 index 0000000..80f5159 --- /dev/null +++ b/.githooks/pre-push @@ -0,0 +1,18 @@ +#!/bin/sh +# Pre-push: the docs pages under apps/docs/content are generated from work/1 +# by `bun run sync`, and deploy.yml publishes whatever main holds. Regenerate +# them now and refuse the push if the result differs from the tree, so a +# solution never lands without its page (or with a stale `## Solution`). +# +# Bypass for a deliberate partial push: git push --no-verify +set -eu + +cd "$(git rev-parse --show-toplevel)" +report=$(bun run --silent sync) + +changed=$(git status --porcelain -- apps/docs/content) +if [ -n "$changed" ]; then + printf '%s\n' "$report" | grep -v 'skipped (in sync)' >&2 + printf '\npre-push: apps/docs/content is out of sync with work/1 — commit the regenerated pages:\n%s\n' "$changed" >&2 + exit 1 +fi