68 lines
2.0 KiB
Bash
Executable File
68 lines
2.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# run-plan.sh — dispatch one plan-queue plan file to a cheap executor.
|
|
#
|
|
# Usage:
|
|
# run-plan.sh [-d REPO_DIR] [-m TIER] [-t SECS] [-a "addendum"] [-p] plans/active/NNN-slug-hash.md
|
|
#
|
|
# -d DIR repo root the executor works in (default: cwd)
|
|
# -m TIER model tier alias for delegate.sh (default: haiku)
|
|
# -t SECS timeout (default: 1800)
|
|
# -a TEXT corrective addendum appended to the prompt (fix rounds)
|
|
# -p print the built prompt to stdout and exit (for Agent-tool mode)
|
|
set -euo pipefail
|
|
|
|
DIR="$(pwd)"
|
|
MODEL="haiku"
|
|
TIMEOUT=1800
|
|
ADDENDUM=""
|
|
PRINT_ONLY=0
|
|
|
|
while getopts "d:m:t:a:p" opt; do
|
|
case "$opt" in
|
|
d) DIR="$OPTARG" ;;
|
|
m) MODEL="$OPTARG" ;;
|
|
t) TIMEOUT="$OPTARG" ;;
|
|
a) ADDENDUM="$OPTARG" ;;
|
|
p) PRINT_ONLY=1 ;;
|
|
*) exit 2 ;;
|
|
esac
|
|
done
|
|
shift $((OPTIND - 1))
|
|
PLAN="${1:?usage: run-plan.sh [opts] <plan-file>}"
|
|
[ -f "$PLAN" ] || { echo "plan file not found: $PLAN" >&2; exit 1; }
|
|
|
|
PROMPT_FILE="$(mktemp)"
|
|
trap 'rm -f "$PROMPT_FILE"' EXIT
|
|
|
|
{
|
|
cat <<'PREAMBLE'
|
|
You are a plan EXECUTOR. Apply the plan below exactly.
|
|
|
|
Rules:
|
|
- Follow the Steps in order. Do not explore beyond the files the plan names.
|
|
- Do not refactor, rename, or "improve" anything outside the Steps.
|
|
- Respect the "Out of scope / do NOT touch" section absolutely.
|
|
- Run the Verification commands after making the changes.
|
|
- Do NOT commit, do NOT push, do NOT create branches.
|
|
- Your final output must be ONLY, in this order:
|
|
1. The full `git diff` (unified) of your changes.
|
|
2. The raw output of the Verification commands.
|
|
3. `Findings:` followed by at most 10 lines (surprises, deviations, skips).
|
|
No other prose, no explanations, no step-by-step narration.
|
|
|
|
=== PLAN ===
|
|
PREAMBLE
|
|
cat "$PLAN"
|
|
if [ -n "$ADDENDUM" ]; then
|
|
printf '\n=== CORRECTION (a previous attempt failed — apply this too) ===\n%s\n' "$ADDENDUM"
|
|
fi
|
|
} > "$PROMPT_FILE"
|
|
|
|
if [ "$PRINT_ONLY" -eq 1 ]; then
|
|
cat "$PROMPT_FILE"
|
|
exit 0
|
|
fi
|
|
|
|
exec "$HOME/.claude/skills/delegate-task/delegate.sh" \
|
|
-m "$MODEL" -d "$DIR" -t "$TIMEOUT" -f "$PROMPT_FILE"
|