Repository navigation
chore: drop Entire hooks from the init template #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,36 @@ | ||
| #!/bin/sh | ||
| # Entire CLI hooks | ||
| # Pre-push hook: push session logs alongside user's push | ||
| # $1 is the remote name (e.g., "origin") | ||
| if command -v entire >/dev/null 2>&1; then entire hooks git pre-push "$1" || true; else :; fi | ||
| # Chain: run pre-existing hook | ||
| _entire_hook_dir="$(dirname "$0")" | ||
| if [ -x "$_entire_hook_dir/pre-push.pre-entire" ]; then | ||
| "$_entire_hook_dir/pre-push.pre-entire" "$@" | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # forge module pre-push hook — runs the pre-push-staged gates (gitleaks, semgrep). | ||
| # Canonical source: https://github.com/N4M3Z/forge-cli/blob/main/templates/init/.githooks/pre-push | ||
|
|
||
| SCRIPT_URL="https://raw.githubusercontent.com/N4M3Z/forge-cli/main/scripts/validate.sh" | ||
| SCRIPT_SHA="${VALIDATE_SH_SHA}" | ||
|
|
||
| if command -v prek >/dev/null 2>&1; then | ||
| prek run --all-files --stage pre-push | ||
| elif command -v forge >/dev/null 2>&1; then | ||
| forge validate | ||
| else | ||
| echo "" | ||
| echo " ⚠ Neither prek nor forge found — using validate.sh fallback" | ||
| echo " Install: cargo install --locked forge-cli or cargo binstall prek" | ||
| echo "" | ||
|
|
||
| tmpdir=$(mktemp -d) | ||
| trap 'rm -rf "$tmpdir"' EXIT | ||
|
|
||
| curl --max-time 30 -sfL "$SCRIPT_URL" -o "$tmpdir/validate.sh" 2>/dev/null \ | ||
| || { echo "validate.sh unreachable — install forge-cli or check connectivity"; exit 1; } | ||
|
|
||
| actual=$(sha256sum "$tmpdir/validate.sh" 2>/dev/null || shasum -a 256 "$tmpdir/validate.sh") | ||
| actual=${actual%% *} | ||
|
|
||
| if [ "$actual" != "$SCRIPT_SHA" ]; then | ||
| echo "validate.sh hash mismatch (expected $SCRIPT_SHA, got $actual)" | ||
| echo " update SCRIPT_SHA after verifying the new script" | ||
| exit 1 | ||
| fi | ||
|
|
||
| bash "$tmpdir/validate.sh" . | ||
| fi | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Medium — The scaffolded
pre-pushfallback fetchesvalidate.shfromN4M3Z/forge-cliand checks it against this repository's embedded SHA, so the hash comparison can never pass and every push from a scaffolded module withoutprekaborts with a misleading "update SCRIPT_SHA" message.templates/init/.githooks/pre-push:8SCRIPT_SHAresolves torune::VALIDATE_SH_SHA, the sha256 of this repository'sscripts/validate.sh.templates/init/.githooks/pre-commit:7the sibling template fetches the same script fromrunedeck/runeand probesrune, notforge.