Migrate project artifacts to spec-kit format
- Move cross-cutting docs (personas, design system, implementation phases, Ideen.md) to .specify/memory/ - Move cross-cutting research and plans to .specify/memory/research/ and .specify/memory/plans/ - Extract 5 setup tasks from spec/setup-tasks.md into individual specs/001-005/spec.md files with spec-kit template format - Extract 20 user stories from spec/userstories.md into individual specs/006-026/spec.md files with spec-kit template format - Relocate feature-specific research and plan docs into specs/[feature]/ - Add spec-kit constitution, templates, scripts, and slash commands - Slim down CLAUDE.md to Claude-Code-specific config, delegate principles to .specify/memory/constitution.md - Update ralph.sh with stream-json output and per-iteration logging - Delete old spec/ and docs/agents/ directories - Gitignore Ralph iteration JSONL logs Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
42
ralph.sh
42
ralph.sh
@@ -140,21 +140,51 @@ echo "Tools: $TOOLS"
|
||||
echo ""
|
||||
|
||||
for ((i = 1; i <= MAX_ITERATIONS; i++)); do
|
||||
echo "--- Iteration $i/$MAX_ITERATIONS ---"
|
||||
echo ""
|
||||
echo "━━━ Iteration $i/$MAX_ITERATIONS ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
|
||||
ITER_START=$(date +%H:%M:%S)
|
||||
echo "Started: $ITER_START"
|
||||
echo ""
|
||||
|
||||
OUTPUT=$(echo "$PROMPT" | claude --print --model "$MODEL" --allowedTools "$TOOLS" 2>&1)
|
||||
ITER_LOG="$RUN_DIR/iteration-${i}.jsonl"
|
||||
|
||||
echo "$PROMPT" | claude --print --model "$MODEL" --allowedTools "$TOOLS" --verbose --output-format stream-json > "$ITER_LOG" 2>&1
|
||||
|
||||
ITER_TIME=$(date +%H:%M:%S)
|
||||
|
||||
if [[ "$OUTPUT" == *"$COMPLETION_SIGNAL"* ]]; then
|
||||
# Extract tool uses for a compact summary
|
||||
TOOL_SUMMARY=$(jq -r 'select(.type == "assistant") | .message.content[]? | select(.type == "tool_use") | " -> \(.name): \(.input.file_path // .input.pattern // .input.command // .input.content[0:80] // "" | tostring | .[0:100])"' "$ITER_LOG" 2>/dev/null) || true
|
||||
|
||||
if [[ -n "$TOOL_SUMMARY" ]]; then
|
||||
echo "Tools used:"
|
||||
echo "$TOOL_SUMMARY"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Extract assistant text messages
|
||||
ASSISTANT_TEXT=$(jq -r 'select(.type == "assistant") | .message.content[]? | select(.type == "text") | .text' "$ITER_LOG" 2>/dev/null) || true
|
||||
|
||||
if [[ -n "$ASSISTANT_TEXT" ]]; then
|
||||
echo "Ralph says:"
|
||||
echo "$ASSISTANT_TEXT" | sed 's/^/ /'
|
||||
echo ""
|
||||
fi
|
||||
|
||||
# Check for errors
|
||||
ERROR_TEXT=$(jq -r 'select(.type == "result") | select(.subtype == "error") | .result' "$ITER_LOG" 2>/dev/null) || true
|
||||
if [[ -n "$ERROR_TEXT" ]]; then
|
||||
echo "[ERROR] $ERROR_TEXT"
|
||||
fi
|
||||
|
||||
# Check for completion signal
|
||||
if grep -q "$COMPLETION_SIGNAL" "$ITER_LOG" 2>/dev/null; then
|
||||
echo "[$ITER_TIME] COMPLETE after $i iteration(s)" >> "$RUN_DIR/run.log"
|
||||
echo "Loop complete after $i iteration(s)."
|
||||
echo "━━━ Loop complete after $i iteration(s). ━━━"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "[$ITER_TIME] Iteration $i done" >> "$RUN_DIR/run.log"
|
||||
echo "Iteration $i done. Continuing..."
|
||||
echo ""
|
||||
echo "--- Done at $ITER_TIME ---"
|
||||
sleep 2
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user