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