Skip to content

Conversation

@lichanghao
Copy link

I tweaked ralph.sh a little bit to add a parallel logic flow to support Gemini CLI. The prompt file GEMINI.md is also added (a renamed version of CLAUDE.md).

Usage:

./scripts/ralph/ralph.sh --tool gemini

@greptile-apps
Copy link

greptile-apps bot commented Jan 26, 2026

Greptile Overview

Greptile Summary

Added Gemini CLI as a third supported AI tool option alongside Amp and Claude Code, following the existing pattern for tool integration.

Key Changes:

  • Updated ralph.sh to accept --tool gemini flag with corresponding validation and execution logic
  • Created GEMINI.md prompt file by adapting CLAUDE.md with tool-specific references updated
  • Gemini execution uses gemini --yolo < GEMINI.md command pattern

Note: This PR does not update README.md or AGENTS.md to document the new Gemini CLI support, which should be added for completeness.

Confidence Score: 4/5

  • This PR is safe to merge with minor documentation gaps
  • The implementation cleanly follows the existing pattern for adding new AI tool support (amp/claude), with proper validation and consistent structure. The --yolo flag should be verified for the gemini CLI, and documentation files should be updated to mention Gemini support.
  • Verify that the --yolo flag is correct for gemini CLI in ralph.sh:94

Important Files Changed

Filename Overview
ralph.sh Added gemini CLI support with new conditional branch and validation logic; implementation follows existing pattern but lacks documentation updates
GEMINI.md New prompt file for Gemini CLI; direct adaptation of CLAUDE.md with consistent structure and instructions

Sequence Diagram

sequenceDiagram
    participant User
    participant ralph.sh
    participant Gemini CLI
    participant FileSystem
    
    User->>ralph.sh: ./ralph.sh --tool gemini [max_iterations]
    ralph.sh->>ralph.sh: Parse arguments (TOOL=gemini)
    ralph.sh->>ralph.sh: Validate tool choice (amp/claude/gemini)
    ralph.sh->>FileSystem: Check for prd.json
    ralph.sh->>FileSystem: Initialize/check progress.txt
    
    loop For each iteration (1 to MAX_ITERATIONS)
        ralph.sh->>ralph.sh: Start iteration i
        alt tool == "amp"
            ralph.sh->>FileSystem: Read prompt.md
            ralph.sh->>Gemini CLI: amp --dangerously-allow-all
        else tool == "gemini"
            ralph.sh->>FileSystem: Read GEMINI.md
            ralph.sh->>Gemini CLI: gemini --yolo < GEMINI.md
            Gemini CLI->>FileSystem: Read prd.json
            Gemini CLI->>FileSystem: Read progress.txt
            Gemini CLI->>Gemini CLI: Implement user story
            Gemini CLI->>Gemini CLI: Run quality checks
            Gemini CLI->>FileSystem: Commit changes
            Gemini CLI->>FileSystem: Update prd.json (passes=true)
            Gemini CLI->>FileSystem: Append to progress.txt
            Gemini CLI-->>ralph.sh: OUTPUT (with potential COMPLETE signal)
        else tool == "claude"
            ralph.sh->>FileSystem: Read CLAUDE.md
            ralph.sh->>Gemini CLI: claude --dangerously-skip-permissions --print
        end
        
        ralph.sh->>ralph.sh: Check OUTPUT for "<promise>COMPLETE</promise>"
        alt All stories complete
            ralph.sh->>User: Exit with success (iteration i)
        else More stories remaining
            ralph.sh->>ralph.sh: Continue to next iteration
        end
    end
    
    ralph.sh->>User: Exit: Max iterations reached
Loading

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

if [[ "$TOOL" == "amp" ]]; then
OUTPUT=$(cat "$SCRIPT_DIR/prompt.md" | amp --dangerously-allow-all 2>&1 | tee /dev/stderr) || true
elif [[ "$TOOL" == "gemini" ]]; then
OUTPUT=$(gemini --yolo < "$SCRIPT_DIR/GEMINI.md" 2>&1 | tee /dev/stderr) || true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

verify that --yolo is the correct flag for gemini CLI - flag is undocumented and should be confirmed

Prompt To Fix With AI
This is a comment left during a code review.
Path: ralph.sh
Line: 94:94

Comment:
verify that `--yolo` is the correct flag for gemini CLI - flag is undocumented and should be confirmed

How can I resolve this? If you propose a fix, please make it concise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant