-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_loop_refactor.sh
More file actions
executable file
·23 lines (18 loc) · 1.13 KB
/
run_loop_refactor.sh
File metadata and controls
executable file
·23 lines (18 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cd "$SCRIPT_DIR"
SPEC="docs/build/flat-attempt-path-token-optimization-plan.md"
LOOP_COUNT="${1:-${LOOP_COUNT:-10}}"
if ! command -v codex >/dev/null 2>&1; then
echo "Error: 'codex' CLI is not installed or not in PATH." >&2
exit 1
fi
if ! [[ "$LOOP_COUNT" =~ ^[0-9]+$ ]] || [[ "$LOOP_COUNT" -lt 1 ]]; then
echo "Error: loop count must be a positive integer. Got: '$LOOP_COUNT'" >&2
exit 1
fi
for ((i = 1; i <= LOOP_COUNT; i++)); do
echo "=== Continuing refactor ($i/$LOOP_COUNT) ==="
codex exec --yolo "We are iteratively refactoring with the end goal documented in '$SPEC'. This is a living, working document. At the bottom of the document there is a running log of iterative changes that have been made so far. Continue this work. Analyse the document, the current file structure, and the running log and identify the next logical change to move us one step closer to the desired outcome. Ensure all tests pass once your change is made. Update the running log and add an entry for your work once done. Commit your work as the last step."
done