31 lines
1.1 KiB
Bash
Executable File
31 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# run-phase.sh — execute exactly one phase in a fresh pi context.
|
|
#
|
|
# Usage:
|
|
# run-phase.sh # first pending phase (alphanumerical order)
|
|
# run-phase.sh 03_api.md # a specific pending phase (warns if out of order)
|
|
#
|
|
# Env: see SKILL.md (MAX_FIX_ATTEMPTS, PHASE_MODEL, PHASE_THINKING,
|
|
# PHASE_COMMIT, PI_TRUST, FRESH_FIX).
|
|
set -uo pipefail
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
source "$SCRIPT_DIR/lib.sh"
|
|
|
|
cd "$(find_root)" || die "no .agent/phases/todo found in this or parent directories (run /to-phase or /audit-create first)"
|
|
|
|
phase="${1:-}"
|
|
if [[ -n "$phase" ]]; then
|
|
[[ "$phase" == *.md ]] || phase="$phase.md"
|
|
[[ -f "$PHASE_TODO/$phase" ]] || die "$phase not found in $PHASE_TODO/"
|
|
first="$(next_phase)"
|
|
if [[ -n "$first" && "$first" != "$phase" ]]; then
|
|
warn "dependency order: $first is pending before $phase — running out of order"
|
|
fi
|
|
else
|
|
phase="$(next_phase)"
|
|
[[ -n "$phase" ]] || { echo "✓ no pending phases in $PHASE_TODO/ — project complete."; exit 0; }
|
|
fi
|
|
|
|
build_pi_args
|
|
execute_phase "$phase"
|