Separate progress updates from logs with --verbose option
Key improvements: - Added --verbose flag to control 10-second progress updates in logs - Real-time progress now shows in monitor display only (not logs) - Created progress.json file for monitor communication - Monitor shows live Claude Code progress with spinner and elapsed time - Clean logs by default, detailed progress available with --verbose Usage: - ralph --monitor # Clean logs, progress in monitor only - ralph --monitor --verbose # Progress in both monitor and logs - ralph --verbose # Just verbose logs without monitor Monitor now displays: ┌─ Claude Code Progress ──────────────────────────────┐ │ Status: ⠋ Working (120s elapsed) │ Output: Analyzing authentication system... └─────────────────────────────────────────────────────┘ This keeps logs clean while providing rich real-time feedback in the monitor.
This commit is contained in:
parent
6b967bfff3
commit
d480c1eb66
2 changed files with 59 additions and 5 deletions
|
|
@ -10,8 +10,10 @@ PROMPT_FILE="PROMPT.md"
|
|||
LOG_DIR="logs"
|
||||
DOCS_DIR="docs/generated"
|
||||
STATUS_FILE="status.json"
|
||||
PROGRESS_FILE="progress.json"
|
||||
CLAUDE_CODE_CMD="claude"
|
||||
MAX_CALLS_PER_HOUR=100 # Adjust based on your plan
|
||||
VERBOSE_PROGRESS=false # Default: no verbose progress updates
|
||||
SLEEP_DURATION=3600 # 1 hour in seconds
|
||||
CALL_COUNT_FILE=".call_count"
|
||||
TIMESTAMP_FILE=".last_reset"
|
||||
|
|
@ -314,13 +316,32 @@ execute_claude_code() {
|
|||
0) progress_indicator="⠸" ;;
|
||||
esac
|
||||
|
||||
# Show last line from output if available
|
||||
# Get last line from output if available
|
||||
local last_line=""
|
||||
if [[ -f "$output_file" && -s "$output_file" ]]; then
|
||||
local last_line=$(tail -1 "$output_file" 2>/dev/null | head -c 80)
|
||||
log_status "INFO" "$progress_indicator Claude Code: $last_line... (${progress_counter}0s)"
|
||||
else
|
||||
log_status "INFO" "$progress_indicator Claude Code working... (${progress_counter}0s elapsed)"
|
||||
last_line=$(tail -1 "$output_file" 2>/dev/null | head -c 80)
|
||||
fi
|
||||
|
||||
# Update progress file for monitor
|
||||
cat > "$PROGRESS_FILE" << EOF
|
||||
{
|
||||
"status": "executing",
|
||||
"indicator": "$progress_indicator",
|
||||
"elapsed_seconds": $((progress_counter * 10)),
|
||||
"last_output": "$last_line",
|
||||
"timestamp": "$(date '+%Y-%m-%d %H:%M:%S')"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Only log if verbose mode is enabled
|
||||
if [[ "$VERBOSE_PROGRESS" == "true" ]]; then
|
||||
if [[ -n "$last_line" ]]; then
|
||||
log_status "INFO" "$progress_indicator Claude Code: $last_line... (${progress_counter}0s)"
|
||||
else
|
||||
log_status "INFO" "$progress_indicator Claude Code working... (${progress_counter}0s elapsed)"
|
||||
fi
|
||||
fi
|
||||
|
||||
sleep 10
|
||||
done
|
||||
|
||||
|
|
@ -331,6 +352,10 @@ execute_claude_code() {
|
|||
if [ $exit_code -eq 0 ]; then
|
||||
# Only increment counter on successful execution
|
||||
echo "$calls_made" > "$CALL_COUNT_FILE"
|
||||
|
||||
# Clear progress file
|
||||
echo '{"status": "completed", "timestamp": "'$(date '+%Y-%m-%d %H:%M:%S')'"}' > "$PROGRESS_FILE"
|
||||
|
||||
log_status "SUCCESS" "✅ Claude Code execution completed successfully"
|
||||
|
||||
# Extract key information from output if possible
|
||||
|
|
@ -340,6 +365,8 @@ execute_claude_code() {
|
|||
|
||||
return 0
|
||||
else
|
||||
# Clear progress file on failure
|
||||
echo '{"status": "failed", "timestamp": "'$(date '+%Y-%m-%d %H:%M:%S')'"}' > "$PROGRESS_FILE"
|
||||
log_status "ERROR" "❌ Claude Code execution failed, check: $output_file"
|
||||
return 1
|
||||
fi
|
||||
|
|
@ -460,6 +487,7 @@ Options:
|
|||
-p, --prompt FILE Set prompt file (default: $PROMPT_FILE)
|
||||
-s, --status Show current status and exit
|
||||
-m, --monitor Start with tmux session and live monitor (requires tmux)
|
||||
-v, --verbose Show detailed progress updates during execution
|
||||
|
||||
Files created:
|
||||
- $LOG_DIR/: All execution logs
|
||||
|
|
@ -506,6 +534,10 @@ while [[ $# -gt 0 ]]; do
|
|||
USE_TMUX=true
|
||||
shift
|
||||
;;
|
||||
-v|--verbose)
|
||||
VERBOSE_PROGRESS=true
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unknown option: $1"
|
||||
show_help
|
||||
|
|
|
|||
|
|
@ -73,6 +73,28 @@ display_status() {
|
|||
echo
|
||||
fi
|
||||
|
||||
# Claude Code Progress section
|
||||
if [[ -f "progress.json" ]]; then
|
||||
local progress_data=$(cat "progress.json" 2>/dev/null)
|
||||
local progress_status=$(echo "$progress_data" | jq -r '.status // "idle"' 2>/dev/null || echo "idle")
|
||||
|
||||
if [[ "$progress_status" == "executing" ]]; then
|
||||
local indicator=$(echo "$progress_data" | jq -r '.indicator // "⠋"' 2>/dev/null || echo "⠋")
|
||||
local elapsed=$(echo "$progress_data" | jq -r '.elapsed_seconds // "0"' 2>/dev/null || echo "0")
|
||||
local last_output=$(echo "$progress_data" | jq -r '.last_output // ""' 2>/dev/null || echo "")
|
||||
|
||||
echo -e "${YELLOW}┌─ Claude Code Progress ──────────────────────────────────────────────────┐${NC}"
|
||||
echo -e "${YELLOW}│${NC} Status: ${indicator} Working (${elapsed}s elapsed)"
|
||||
if [[ -n "$last_output" && "$last_output" != "" ]]; then
|
||||
# Truncate long output for display
|
||||
local display_output=$(echo "$last_output" | head -c 60)
|
||||
echo -e "${YELLOW}│${NC} Output: ${display_output}..."
|
||||
fi
|
||||
echo -e "${YELLOW}└─────────────────────────────────────────────────────────────────────────┘${NC}"
|
||||
echo
|
||||
fi
|
||||
fi
|
||||
|
||||
# Recent logs
|
||||
echo -e "${BLUE}┌─ Recent Activity ───────────────────────────────────────────────────────┐${NC}"
|
||||
if [[ -f "$LOG_FILE" ]]; then
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue