refactor(skills): use .agents/ instead of .agent/ for phased execution
Standardize on the .agents/ directory across all phased-execution skills (phase state, reports, sessions, validate.sh, PLAN.md, and per-story/feature/workflow trees). Legacy dot-less agent/ fallbacks in migration scripts are untouched.
This commit is contained in:
@@ -3,16 +3,16 @@
|
||||
# Sourced by run-task.sh, run-phase.sh, and auto-phase.sh. Not meant to be run directly.
|
||||
#
|
||||
# Phase state lives in files, not chat context:
|
||||
# .agent/PLAN.md master plan, LOCKED DECISIONS (binding)
|
||||
# .agent/phases/todo/NN_name/ pending phase: 00_phase.md (overview) + NN_task.md task files
|
||||
# .agent/phases/todo/NN_name.md legacy single-file phase (still executable)
|
||||
# .agent/phases/complete/ finished phases — mirrors the todo/ layout
|
||||
# .agent/reports/ per-task executor reports, stderr, validation logs
|
||||
# .agent/phase-sessions/ child pi session files (resumable fixers)
|
||||
# .agents/PLAN.md master plan, LOCKED DECISIONS (binding)
|
||||
# .agents/phases/todo/NN_name/ pending phase: 00_phase.md (overview) + NN_task.md task files
|
||||
# .agents/phases/todo/NN_name.md legacy single-file phase (still executable)
|
||||
# .agents/phases/complete/ finished phases — mirrors the todo/ layout
|
||||
# .agents/reports/ per-task executor reports, stderr, validation logs
|
||||
# .agents/phase-sessions/ child pi session files (resumable fixers)
|
||||
#
|
||||
# The unit of execution is the TASK: each task file runs in its own pi
|
||||
# subprocess (fresh context) with bounded fixer retries, and
|
||||
# .agent/validate.sh runs after EVERY task. A unit only moves to complete/
|
||||
# .agents/validate.sh runs after EVERY task. A unit only moves to complete/
|
||||
# after the child exits 0, the child's stream ends with a clean final
|
||||
# report, and validation passes. When all of a phase's tasks are done,
|
||||
# 00_phase.md runs as the phase's final pass (any remaining inline work +
|
||||
@@ -24,22 +24,22 @@ EXECUTOR_PROMPT_FILE="$SKILL_DIR/assets/executor-prompt.md"
|
||||
TASK_EXECUTOR_PROMPT_FILE="$SKILL_DIR/assets/task-executor-prompt.md"
|
||||
PHASE_FINAL_PROMPT_FILE="$SKILL_DIR/assets/phase-final-prompt.md"
|
||||
|
||||
PHASE_TODO=".agent/phases/todo"
|
||||
PHASE_DONE=".agent/phases/complete"
|
||||
PHASE_REPORTS=".agent/reports"
|
||||
PHASE_SESSIONS=".agent/phase-sessions"
|
||||
PHASE_TODO=".agents/phases/todo"
|
||||
PHASE_DONE=".agents/phases/complete"
|
||||
PHASE_REPORTS=".agents/reports"
|
||||
PHASE_SESSIONS=".agents/phase-sessions"
|
||||
MAX_FIX_ATTEMPTS="${MAX_FIX_ATTEMPTS:-3}"
|
||||
|
||||
warn() { echo "⚠ $*" >&2; }
|
||||
die() { echo "✗ ERROR: $*" >&2; exit 1; }
|
||||
|
||||
# --- project root -------------------------------------------------------------
|
||||
# Walk up from $PWD to the nearest directory containing .agent/phases/todo.
|
||||
# Walk up from $PWD to the nearest directory containing .agents/phases/todo.
|
||||
find_root() {
|
||||
local d
|
||||
d="$(pwd)"
|
||||
while :; do
|
||||
if [[ -d "$d/.agent/phases/todo" ]]; then printf '%s\n' "$d"; return 0; fi
|
||||
if [[ -d "$d/.agents/phases/todo" ]]; then printf '%s\n' "$d"; return 0; fi
|
||||
[[ "$d" == "/" ]] && return 1
|
||||
d="$(dirname "$d")"
|
||||
done
|
||||
@@ -47,7 +47,7 @@ find_root() {
|
||||
|
||||
# --- unit selection -------------------------------------------------------------
|
||||
# A unit is the smallest schedulable piece of work, referenced relative to
|
||||
# .agent/phases/todo/:
|
||||
# .agents/phases/todo/:
|
||||
# directory phase → each task file "NN_name/NN_task.md" (sort order), then
|
||||
# the phase overview "NN_name/00_phase.md" as the final pass
|
||||
# legacy flat → the phase file itself, "NN_name.md"
|
||||
@@ -225,7 +225,7 @@ fix_prompt() {
|
||||
|
||||
# --- child executor -----------------------------------------------------------
|
||||
# run_child <unit> <attempt> <prompt> [resume-session]
|
||||
# Attempt 1: fresh session in .agent/phase-sessions/.
|
||||
# Attempt 1: fresh session in .agents/phase-sessions/.
|
||||
# Attempt N>1: resumes the given session file — the failed executor's own
|
||||
# session, tracked by execute_unit (so retries keep its work). When no
|
||||
# session was captured (or FRESH_FIX=1) a fresh ephemeral session runs with
|
||||
@@ -287,17 +287,17 @@ run_child() {
|
||||
|
||||
# --- validation gate ----------------------------------------------------------
|
||||
ensure_validate() {
|
||||
if [[ ! -f .agent/validate.sh ]]; then
|
||||
cp "$SKILL_DIR/assets/validate.sh" .agent/validate.sh
|
||||
chmod +x .agent/validate.sh
|
||||
warn "no .agent/validate.sh found — created it from the skill template."
|
||||
if [[ ! -f .agents/validate.sh ]]; then
|
||||
cp "$SKILL_DIR/assets/validate.sh" .agents/validate.sh
|
||||
chmod +x .agents/validate.sh
|
||||
warn "no .agents/validate.sh found — created it from the skill template."
|
||||
warn "adapt it to this project's real test/lint/coverage commands; it is the pass/fail gate after every task."
|
||||
fi
|
||||
}
|
||||
|
||||
# run_validation <logfile>; returns 0 iff .agent/validate.sh exits 0.
|
||||
# run_validation <logfile>; returns 0 iff .agents/validate.sh exits 0.
|
||||
run_validation() {
|
||||
bash .agent/validate.sh >"$1" 2>&1
|
||||
bash .agents/validate.sh >"$1" 2>&1
|
||||
}
|
||||
|
||||
# --- notifications ------------------------------------------------------------
|
||||
@@ -382,8 +382,8 @@ execute_unit() {
|
||||
errors+="[child run ended without a clean final report]"$'\n'"$(tail -c 4000 "$(unit_report "$unit" "$attempt" err)" 2>/dev/null)"
|
||||
fi
|
||||
if ! run_validation "$(unit_report "$unit" "$attempt" validate)"; then
|
||||
warn ".agent/validate.sh FAILED — see $(unit_report "$unit" "$attempt" validate)"
|
||||
errors+="[.agent/validate.sh FAILED]"$'\n'"$(tail -n 120 "$(unit_report "$unit" "$attempt" validate)" 2>/dev/null)"
|
||||
warn ".agents/validate.sh FAILED — see $(unit_report "$unit" "$attempt" validate)"
|
||||
errors+="[.agents/validate.sh FAILED]"$'\n'"$(tail -n 120 "$(unit_report "$unit" "$attempt" validate)" 2>/dev/null)"
|
||||
fi
|
||||
|
||||
if [[ -z "$errors" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user