Standardize on the .agents/ directory (shared with project skills): phases/, user_stories/, reports/, screenshots/, validate.sh, and phase-sessions/ + pipeline.log all move to .agents/ (git mv preserves history; runtime artifacts move alongside). Updates every reference in AGENTS.md, README.md, .gitignore, app docstrings, and test story headers. Historical KB content in data/ and the runtime pipeline.log transcript are left untouched.
49 lines
1.4 KiB
Bash
Executable File
49 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# .agents/validate.sh — validation gate for the phased-execution pipeline.
|
|
#
|
|
# A phase is only moved to .agents/phases/complete/ if this script exits 0.
|
|
# Project adaptation (brain_of_reese — AGENTS.md rule 9, PLAN §10):
|
|
# 1. unit + integration tests with coverage on app/ (floor: >90%)
|
|
# 2. ruff (lint)
|
|
# 3. pyright (types)
|
|
# The per-story Playwright E2E gate (one file per story, run in isolation)
|
|
# is driven by each task file and is NOT part of this gate.
|
|
set -uo pipefail
|
|
cd "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
rc=0
|
|
|
|
# ---- 1. unit + integration tests; coverage floor app/ > 90% ----
|
|
pytest_out="$(mktemp)"
|
|
trap 'rm -f "$pytest_out"' EXIT
|
|
if uv run pytest --cov=app --cov-report=term -q >"$pytest_out" 2>&1; then
|
|
cat "$pytest_out"
|
|
total_pct="$(awk '/^TOTAL/ {p = $NF} END {print p}' "$pytest_out" | tr -d '%')"
|
|
if [[ -n "$total_pct" ]] && awk -v p="$total_pct" 'BEGIN { exit !(p > 90) }'; then
|
|
echo "coverage gate: app/ ${total_pct}% (>90%) OK"
|
|
else
|
|
echo "coverage gate FAILED: app/ coverage ${total_pct:-unknown}% (floor >90%)"
|
|
rc=1
|
|
fi
|
|
else
|
|
cat "$pytest_out"
|
|
echo "tests FAILED: unit + integration suite did not pass"
|
|
rc=1
|
|
fi
|
|
|
|
# ---- 2. lint ----
|
|
if ! uv run ruff check .; then
|
|
rc=1
|
|
fi
|
|
|
|
# ---- 3. types ----
|
|
if ! uv run pyright; then
|
|
rc=1
|
|
fi
|
|
|
|
if [[ $rc -ne 0 ]]; then
|
|
echo "validation FAILED (see output above)"
|
|
else
|
|
echo "validation OK"
|
|
fi
|
|
exit "$rc"
|