diff --git a/.gemini/skills/async-pr-review/SKILL.md b/.gemini/skills/async-pr-review/SKILL.md index 656a19260f..6db732879e 100644 --- a/.gemini/skills/async-pr-review/SKILL.md +++ b/.gemini/skills/async-pr-review/SKILL.md @@ -7,6 +7,10 @@ description: Trigger this skill when the user wants to start an asynchronous PR This skill provides a set of tools to asynchronously review a Pull Request. It will create a background job to run the project's preflight checks, execute Gemini-powered test plans, and perform a comprehensive code review using custom prompts. +This is a prime example of composing Gemini CLI features: +1. **Headless Automation (`async-review.sh`)**: The script invokes `gemini` with `--approval-mode=yolo` and the `/review-frontend` custom command in the background. +2. **Agentic Evaluation (`check-async-review.sh`)**: The check script outputs clean JSON/text statuses for the agent to parse. The agent itself synthesizes the final assessment dynamically from the generated log files. + ## Workflow 1. **Determine Action**: Establish whether the user wants to start a new async review or check the status of an existing one. @@ -33,4 +37,7 @@ If the user wants to check the status or view the final assessment of a previous ```bash .gemini/skills/async-pr-review/scripts/check-async-review.sh ``` -3. This script will launch a live status dashboard. Once all tasks are complete, it will automatically query a new instance of Gemini for a final assessment and provide a recommendation on whether to approve the PR. Let the script run in the user's terminal. \ No newline at end of file +3. **Evaluate Output**: Read the output from the script. + * If the output contains `STATUS: IN_PROGRESS`, tell the user which tasks are still running. + * If the output contains `STATUS: COMPLETE`, use your file reading tools (`read_file`) to retrieve the contents of the `review.md` and `test-execution.log` files from the `LOG_DIR` specified in the output. + * **Final Assessment**: Read those files, synthesize their results, and give the user a concise recommendation on whether the PR builds successfully, passes tests, and if you recommend they approve it based on the review. \ No newline at end of file diff --git a/.gemini/skills/async-pr-review/scripts/check-async-review.sh b/.gemini/skills/async-pr-review/scripts/check-async-review.sh index b9ea7eede8..36ca12aea4 100755 --- a/.gemini/skills/async-pr-review/scripts/check-async-review.sh +++ b/.gemini/skills/async-pr-review/scripts/check-async-review.sh @@ -7,87 +7,49 @@ if [[ -z "$pr_number" ]]; then fi log_dir="$HOME/dev/pr-$pr_number/logs" -GEMINI_CMD="$HOME/.gcli/nightly/node_modules/.bin/gemini" if [[ ! -d "$log_dir" ]]; then + echo "STATUS: NOT_FOUND" echo "❌ No logs found for PR #$pr_number in $log_dir" - exit 1 + exit 0 fi -# Define the tasks: name|log_file tasks=( "preflight|preflight.log" "review|review.md" "test-execution|test-execution.log" ) -while true; do - clear - echo "📊 Status for PR #$pr_number in $log_dir" - echo "=================================================" +all_done=true +echo "STATUS: CHECKING" - all_done=true - - for task_info in "${tasks[@]}"; do - IFS="|" read -r task_name log_file <<< "$task_info" - - file_path="$log_dir/$log_file" - exit_file="$log_dir/$task_name.exit" - - if [[ -f "$exit_file" ]]; then - # Task is done - exit_code=$(cat "$exit_file") - if [[ "$exit_code" == "0" ]]; then - status="✅ SUCCESS" - else - status="❌ FAILED (exit code $exit_code)" - fi - elif [[ -f "$file_path" ]]; then - status="⏳ RUNNING" - all_done=false - else - status="➖ NOT STARTED" - all_done=false - fi - - echo "$status - $task_name" - - if [[ -f "$file_path" ]]; then - if [[ "$status" == "⏳ RUNNING" ]]; then - # Show what it's currently doing - echo " Last output:" - tail -n 3 "$file_path" | sed 's/^/ | /' - elif [[ "$status" == *"FAILED"* ]]; then - # Show the last lines of the error to help debug - echo " Error snippet:" - tail -n 5 "$file_path" | sed 's/^/ | /' - fi - fi - echo "" - done - - if $all_done; then - break - fi +for task_info in "${tasks[@]}"; do + IFS="|" read -r task_name log_file <<< "$task_info" - echo "⏳ Waiting 5 seconds before checking again..." - sleep 5 + file_path="$log_dir/$log_file" + exit_file="$log_dir/$task_name.exit" + + if [[ -f "$exit_file" ]]; then + exit_code=$(cat "$exit_file") + if [[ "$exit_code" == "0" ]]; then + echo "✅ $task_name: SUCCESS" + else + echo "❌ $task_name: FAILED (exit code $exit_code)" + echo " Last lines of $file_path:" + tail -n 3 "$file_path" | sed 's/^/ /' + fi + elif [[ -f "$file_path" ]]; then + echo "⏳ $task_name: RUNNING" + all_done=false + else + echo "➖ $task_name: NOT STARTED" + all_done=false + fi done -echo "🎉 All tasks are complete!" -echo "🤖 Asking Gemini for final PR assessment..." -echo "=================================================" - -"$GEMINI_CMD" "I have just completed async tasks for PR $pr_number. - -Here is the code review output: -\`\`\`markdown -$(cat "$log_dir/review.md" 2>/dev/null) -\`\`\` - -Here is the test execution log: -\`\`\` -$(cat "$log_dir/test-execution.log" 2>/dev/null) -\`\`\` - -Please evaluate the results. Tell me if the PR builds successfully, if it passes tests, and if you recommend I approve it based on the review. Keep your answer concise and actionable." +if $all_done; then + echo "STATUS: COMPLETE" + echo "LOG_DIR: $log_dir" +else + echo "STATUS: IN_PROGRESS" +fi \ No newline at end of file