#!/bin/bash # Keeping here for reference, but using the new task-master loop command instead set -e if [ -z "$1" ]; then echo "Usage: $0 " exit 1 fi # Cold start check - test if sandbox auth is ready echo "Checking sandbox auth..." test_result=$(docker sandbox run claude -p "Say OK" 2>&1) || true if [[ "$test_result" == *"OK"* ]]; then echo "✓ Sandbox ready" else echo "Sandbox needs authentication. Starting interactive session..." echo "Please complete auth, then ctrl+c to continue." echo "" docker sandbox run claude "cool you're in! you can now exit (ctrl + c) so we can continue the loop" echo "" echo "✓ Auth complete" fi echo "" for ((i=1; i<=$1; i++)); do echo "" echo "━━━ Iteration $i of $1 ━━━" result=$(docker sandbox run claude -p "@.taskmaster/tasks/tasks.json @.taskmaster/loop-progress.txt @CLAUDE.md \ SETUP: If task-master command not found, run: npm i -g task-master-ai \ \ TASK: Implement ONE task/subtask for the tm loop feature. \ \ PROCESS: \ 1. Run task-master next (or use MCP) to get the next available task/subtask. \ 2. Read task details with task-master show . \ 3. Implement following codebase patterns (CLI in apps/cli/src/commands/, core in packages/tm-core/src/modules/). \ 4. Write tests alongside implementation. \ 5. Run npm run turbo:typecheck to verify types. \ 6. Run npm test -w to verify tests pass. \ 7. Mark complete: task-master set-status --id= --status=done \ 8. Commit with message: feat(loop): (do NOT include loop-progress.txt in commit) \ 9. Append super-concise notes to .taskmaster/loop-progress.txt: task ID, what was done, any learnings. \ \ IMPORTANT: \ - Complete ONLY ONE task per iteration. \ - Keep changes small and focused. \ - Do NOT start another task after completing one. \ - If all tasks are done, output ALL_DONE. \ - If blocked, output REASON. \ ") echo "$result" # Strict match - require exact format with content if [[ "$result" =~ \ALL_DONE\ ]]; then echo "" echo "All tasks complete after $i iterations." exit 0 fi if [[ "$result" =~ \.+\ ]]; then echo "" echo "Blocked at iteration $i." exit 1 fi done echo "Max iterations ($1) reached."