Commit 748a90386db3

Vincent Demeester <vincent@sbr.pm>
2026-01-30 11:27:50
feat(gh-news-review): add yolo mode and improve nixpkgs review prompt
- Add -y/--yolo flag to skip permission prompts (--dangerously-skip-permissions) - Detect nixpkgs PRs and provide more specific review instructions - Include nixpkgs-review guidance and merge-bot comment hints - Use proper argument parsing loop for multiple flags Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 93763f8
Changed files (1)
pkgs
my
scripts
pkgs/my/scripts/bin/gh-news-review
@@ -1,19 +1,38 @@
 #!/usr/bin/env bash
 # Review a GitHub PR/issue with Claude on a remote machine via shpool
-# Usage: gh-news-review [-d|--detach] <url>
+# Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>
 #   -d, --detach  Start session in background and return immediately
+#   -y, --yolo    Skip permission prompts (auto-accept all tool calls)
 
 set -euo pipefail
 
 DETACH=false
-if [[ "${1:-}" == "-d" || "${1:-}" == "--detach" ]]; then
-    DETACH=true
-    shift
-fi
+YOLO=false
+
+while [[ $# -gt 0 ]]; do
+    case "$1" in
+        -d|--detach)
+            DETACH=true
+            shift
+            ;;
+        -y|--yolo)
+            YOLO=true
+            shift
+            ;;
+        -*)
+            echo "Unknown option: $1" >&2
+            echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>" >&2
+            exit 1
+            ;;
+        *)
+            break
+            ;;
+    esac
+done
 
 URL="${1:-}"
 if [[ -z "$URL" ]]; then
-    echo "Usage: gh-news-review [-d|--detach] <url>" >&2
+    echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>" >&2
     exit 1
 fi
 
@@ -25,13 +44,36 @@ if [[ -z "$SESSION_NAME" || "$SESSION_NAME" == "review-" ]]; then
     exit 1
 fi
 
-PROMPT="Review $URL, and load the proper skill as needed (e.g. nixpkgs skills and workflows if it is a pr from NixOS/nixpkgs)"
+# Detect if this is a nixpkgs PR for more specific instructions
+IS_NIXPKGS=false
+if [[ "$URL" == *"NixOS/nixpkgs"* ]]; then
+    IS_NIXPKGS=true
+fi
+
+# Build the prompt based on the type of review
+if [[ "$IS_NIXPKGS" == "true" ]]; then
+    PROMPT="Review $URL using the Nixpkgs skill.
+
+For nixpkgs PRs:
+1. Load and follow the Nixpkgs skill workflow
+2. Use nixpkgs-review to build and test the changes when appropriate
+3. When approving, use a concise message (e.g., 'LGTM, tested with nixpkgs-review')
+4. If the PR needs @ofborg or merge-bot attention, add the appropriate comment"
+else
+    PROMPT="Review $URL, and load the proper skill as needed (e.g. nixpkgs skills and workflows if it is a pr from NixOS/nixpkgs)"
+fi
+
+# Build cr command with optional yolo mode
+CR_CMD="cr"
+if [[ "$YOLO" == "true" ]]; then
+    CR_CMD="cr --dangerously-skip-permissions"
+fi
 
 # Command to run in shpool session
 # Use absolute path to bash since shpool's default PATH doesn't include NixOS paths
 # bash -lc sources login profile to get Nix paths where cr is located
 # cd to src/nixpkgs so Claude has access to the codebase for reviews
-SHPOOL_CMD="shpool attach -f -c '/run/current-system/sw/bin/bash -lc \"cd ~/src/nixpkgs && cr \\\"$PROMPT\\\"\"' $SESSION_NAME"
+SHPOOL_CMD="shpool attach -f -c '/run/current-system/sw/bin/bash -lc \"cd ~/src/nixpkgs && $CR_CMD \\\"$PROMPT\\\"\"' $SESSION_NAME"
 
 if [[ "$DETACH" == "true" ]]; then
     # Start in background and return immediately