Files
iris_x_hermes/scripts/guard_hermes_agent.sh
T
ARIA 59acf66c89 M0: toolchain, monorepo scaffold, gateway plugin skeleton, CMP app
- gateway-plugin/: android platform plugin (plugin.yaml + adapter.py
  register(ctx) + no-op AndroidAdapter) + stub modules for M1-M5
- app/: Compose Multiplatform project (shared KMP + androidApp +
  desktopApp) with Gradle wrapper; builds :androidApp:assembleDebug
  and :desktopApp:compileKotlin
- scripts/guard_hermes_agent.sh + pre-commit hook: fail if hermes-agent/
  is staged (read-only reference, never committed)
- .gitignore excludes hermes-agent/; docs/ reference library
2026-08-19 11:27:02 +02:00

37 lines
1.4 KiB
Bash
Executable File

#!/usr/bin/env bash
# Guard: hermes-agent/ is a read-only research reference and must NEVER be
# committed, pushed, or shipped. This fails the commit/CI if any path under
# hermes-agent/ is staged.
#
# Usage:
# - pre-commit hook: scripts/guard_hermes_agent.sh --staged
# - CI / manual: scripts/guard_hermes_agent.sh --staged
#
# Exit 0 = clean, exit 1 = hermes-agent/ paths detected.
set -euo pipefail
MODE="${1:---staged}"
if [[ "$MODE" == "--staged" ]]; then
# Every path currently in the index. Using `git ls-files --cached` (rather
# than `git diff --cached`) makes this robust on the very first commit,
# where no HEAD exists yet and `git diff --cached` is unreliable. We never
# want hermes-agent/ in the index at all, so blocking on its presence is
# both correct and safe.
mapfile -t BAD < <(git ls-files --cached | grep -E '^hermes-agent/' || true)
else
# Fallback: any tracked file under hermes-agent/.
mapfile -t BAD < <(git ls-files | grep -E '^hermes-agent/' || true)
fi
if [[ ${#BAD[@]} -gt 0 ]]; then
echo "ERROR: the following hermes-agent/ paths are staged. This directory is a" >&2
echo "read-only research reference and must NEVER be committed (see .gitignore" >&2
echo "and docs/00-overview.md 'Disclaimers'). Unstage them with:" >&2
echo " git restore --staged <path>" >&2
printf ' %s\n' "${BAD[@]}" >&2
exit 1
fi
exit 0