Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .githooks/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions .githooks/post-commit

This file was deleted.

4 changes: 0 additions & 4 deletions .githooks/post-rewrite

This file was deleted.

6 changes: 0 additions & 6 deletions .githooks/pre-push.local

This file was deleted.

10 changes: 0 additions & 10 deletions .githooks/pre-push.pre-entire

This file was deleted.

3 changes: 0 additions & 3 deletions .githooks/prepare-commit-msg

This file was deleted.

10 changes: 8 additions & 2 deletions docs/decisions/CLI-0009 Entire Git-Hook Coexistence.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ tags:
- cli
- hooks
- entire
status: accepted
status: superseded
created: 2026-06-23
updated: 2026-06-23
updated: 2026-11-23
author: "@N4M3Z"
project: rune-cli
related:
Expand All @@ -24,6 +24,12 @@ upstream:

# Entire Git-Hook Coexistence

> **Superseded on 2026-11-23.** We retired Entire on every machine and project. Agent sessions, not git commits, are
> the artifact worth keeping, and the agentsview session archive keeps them. Commit-anchored checkpoints did not
> survive jj rewrites and squash merges. The `rune init` template and this repository no longer include Entire hooks,
> and `pre-push` runs the pre-push validation check directly again. The rest of this record describes the arrangement
> as it was.

## Context and Problem Statement

rune sets `core.hooksPath = .githooks` and tracks its git hooks as source. Entire (a per-developer AI-session recorder) installs hooks into that same directory and wraps the tracked `pre-push`: it backs the rune pre-push validation check up to `pre-push.pre-entire`, then replaces `pre-push` with a marked shim that calls `entire hooks git pre-push` and chains to the backup. Because `pre-push` is tracked, that modification surfaces as working-tree drift on every machine running Entire and has been accidentally committed. A `.gitignore` entry cannot suppress a modification to an already-tracked file.
Expand Down
69 changes: 29 additions & 40 deletions src/cli/init/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,31 +180,6 @@ fn init_creates_all_files() {
assert!(temp_directory.path().join(".githooks/pre-commit").is_file());
assert!(temp_directory.path().join(".githooks/pre-push").is_file());
assert!(temp_directory.path().join(".githooks/jj-push").is_file());
assert!(
temp_directory
.path()
.join(".githooks/pre-push.pre-entire")
.is_file()
);
assert!(temp_directory.path().join(".githooks/commit-msg").is_file());
assert!(
temp_directory
.path()
.join(".githooks/post-commit")
.is_file()
);
assert!(
temp_directory
.path()
.join(".githooks/post-rewrite")
.is_file()
);
assert!(
temp_directory
.path()
.join(".githooks/prepare-commit-msg")
.is_file()
);
assert!(temp_directory.path().join("agents/.mdschema").is_file());
assert!(temp_directory.path().join("rules/.mdschema").is_file());
assert!(temp_directory.path().join("skills/.mdschema").is_file());
Expand Down Expand Up @@ -362,34 +337,48 @@ fn init_uses_already_exists_skip_reason() {
}

#[test]
fn init_pre_push_is_entire_wrapper_chaining_to_gate() {
fn init_pre_push_is_validation_check() {
let temp_directory = TempDir::new().unwrap();
execute(&temp_directory.path().to_string_lossy()).unwrap();

let wrapper =
std::fs::read_to_string(temp_directory.path().join(".githooks/pre-push")).unwrap();
assert!(
wrapper.contains("Entire CLI hooks"),
"scaffolded pre-push should be the Entire wrapper"
);
assert!(
wrapper.contains("pre-push.pre-entire"),
"wrapper should chain to the pre-push validation check"
);

let pre_push_check =
std::fs::read_to_string(temp_directory.path().join(".githooks/pre-push.pre-entire"))
.unwrap();
std::fs::read_to_string(temp_directory.path().join(".githooks/pre-push")).unwrap();
assert!(
pre_push_check.contains("validate.sh"),
"pre-push.pre-entire should run the Rune pre-push validation check"
"scaffolded pre-push should run the Rune pre-push validation check"
);
assert!(
!pre_push_check.contains("${VALIDATE_SH_SHA}"),
"pre-push validation check SHA placeholder must be substituted at init time"
);
}

#[test]
fn init_ships_no_entire_hooks() {
let temp_directory = TempDir::new().unwrap();
execute(&temp_directory.path().to_string_lossy()).unwrap();

for removed in [
"pre-push.pre-entire",
"commit-msg",
"post-commit",
"post-rewrite",
"prepare-commit-msg",
] {
let path = temp_directory.path().join(".githooks").join(removed);
assert!(!path.exists(), "init must not scaffold .githooks/{removed}");
}

for hook in ["pre-commit", "pre-push", "jj-push"] {
let content =
std::fs::read_to_string(temp_directory.path().join(".githooks").join(hook)).unwrap();
assert!(
!content.contains("Entire CLI hooks"),
".githooks/{hook} must not be an Entire wrapper"
);
}
}

#[test]
fn the_executable_bit_follows_the_shebang_not_the_path() {
// ruff enforces the same pair in the generated project: EXE001 for a
Expand Down
4 changes: 0 additions & 4 deletions templates/init/.githooks/commit-msg

This file was deleted.

4 changes: 0 additions & 4 deletions templates/init/.githooks/post-commit

This file was deleted.

4 changes: 0 additions & 4 deletions templates/init/.githooks/post-rewrite

This file was deleted.

44 changes: 35 additions & 9 deletions templates/init/.githooks/pre-push
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; }
Comment on lines +4 to +24

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ [runeseer] reported by reviewdog 🐶
Medium — The scaffolded pre-push fallback fetches validate.sh from N4M3Z/forge-cli and checks it against this repository's embedded SHA, so the hash comparison can never pass and every push from a scaffolded module without prek aborts with a misleading "update SCRIPT_SHA" message.

  • templates/init/.githooks/pre-push:8 SCRIPT_SHA resolves to rune::VALIDATE_SH_SHA, the sha256 of this repository's scripts/validate.sh.
  • templates/init/.githooks/pre-commit:7 the sibling template fetches the same script from runedeck/rune and probes rune, not forge.
Suggested change
# 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; }
# rune module pre-push hook — runs the pre-push-staged gates (gitleaks, semgrep).
# Canonical source: https://github.com/runedeck/rune/blob/main/templates/init/.githooks/pre-push
SCRIPT_URL="https://raw.githubusercontent.com/runedeck/rune/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 rune >/dev/null 2>&1; then
rune validate
else
echo ""
echo " ⚠ Neither prek nor rune found — using validate.sh fallback"
echo " Install: cargo install --locked rune-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 rune-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
36 changes: 0 additions & 36 deletions templates/init/.githooks/pre-push.pre-entire

This file was deleted.

3 changes: 0 additions & 3 deletions templates/init/.githooks/prepare-commit-msg

This file was deleted.

Loading