| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #!/usr/bin/env bash
- # Thin entrypoint for intermediate review-debug packages (process evidence included).
- # Does not rewrite package_for_agent_analysis.py — only selects --profile review-debug.
- # Fail-closed: exact-commit snapshot only; refuse dirty/untracked worktrees.
- set -euo pipefail
- unset LD_LIBRARY_PATH LD_PRELOAD QT_PLUGIN_PATH || true
- ROOT="$(cd "$(dirname "$0")/.." && pwd)"
- VENV="${PRODU2_VERIFY_VENV:-${XDG_CACHE_HOME:-$HOME/.cache}/prod2u/venvs/verify}"
- PY="${VENV}/bin/python"
- [[ -x "$PY" ]] || PY=python3
- OUT="${PRODU2_HANDOFF_DIR:-${TMPDIR:-/tmp}/prod2u-handoff}"
- SHORT="$(git -C "$ROOT" rev-parse --short=8 HEAD 2>/dev/null || date -u +%Y%m%dT%H%M%SZ)"
- STAGE="intermediate-review"
- ARGS=()
- while [[ $# -gt 0 ]]; do
- case "$1" in
- --package-stage)
- STAGE="${2:-}"
- shift 2
- ;;
- --package-stage=*)
- STAGE="${1#*=}"
- shift
- ;;
- *)
- ARGS+=("$1")
- shift
- ;;
- esac
- done
- # Exact-commit provenance: refuse dirty tracked/staged/untracked trees.
- # Review package snapshots exact HEAD only; commit or clean the intended changes first.
- if [[ -n "$(git -C "$ROOT" status --porcelain --untracked-files=all 2>/dev/null || echo DIRTY)" ]]; then
- echo "ERROR: review package snapshots exact HEAD only; commit or clean the intended changes first" >&2
- echo "dirty worktree (tracked/staged/untracked) blocks package-review-debug.sh" >&2
- git -C "$ROOT" status --short --branch --untracked-files=all >&2 || true
- exit 2
- fi
- # Allow PRODU2_PACKAGE_NAME / PRODU2_PACKAGE_TOPIC to name the current MSE round.
- TOPIC="${PRODU2_PACKAGE_TOPIC:-${PRODU2_RELEASE_TASK_SLUG:-mse-a1}}"
- export PRODU2_PACKAGE_TOPIC="${TOPIC}"
- export PRODU2_RELEASE_TASK_SLUG="${TOPIC}"
- NAME="${PRODU2_PACKAGE_NAME:-prod2u-${TOPIC}-intermediate-review-debug-${SHORT}}"
- mkdir -p "$OUT"
- exec "$PY" -B "$ROOT/package_for_agent_analysis.py" \
- --profile review-debug \
- --include-process-evidence \
- --source-root "$ROOT" \
- --output-dir "$OUT" \
- --package-name "$NAME" \
- --package-stage "$STAGE" \
- "${ARGS[@]}"
|