#!/bin/sh
# Warn (non-blocking) about DNA drift. Enable with:
#   git config core.hooksPath tools/git-hooks
# Platform repo: shared assets drifted from the release manifest without a version bump.
# Workspace: project DNA differs from the installed tuner-testkit payload.
DIR=$(dirname "$0")
ROOT=$(cd "$DIR/../.." && pwd)
# Prefer the repo venv (global `python` may be a Windows Store stub / missing).
if [ -x "$ROOT/.venv/Scripts/python.exe" ]; then
  PY="$ROOT/.venv/Scripts/python.exe"
elif [ -x "$ROOT/.venv/bin/python" ]; then
  PY="$ROOT/.venv/bin/python"
elif command -v python3 >/dev/null 2>&1; then
  PY=python3
elif command -v python >/dev/null 2>&1; then
  PY=python
else
  exit 0
fi
# Both checks exit 1 on drift; we only warn, never block the push.
if [ -f "$ROOT/tuner_testkit/project.py" ]; then
  ( cd "$ROOT" && "$PY" -m tuner_testkit.apps.init_repo manifest --check ) || \
    echo "[warn] pre-push: platform assets drifted; consider the release-template skill to bump version." >&2
else
  ( cd "$ROOT" && "$PY" -m tuner_testkit.apps.dna check >/dev/null 2>&1 ) || \
    echo "[warn] pre-push: project DNA differs from the installed kit; see the upgrade-framework skill." >&2
fi
exit 0
