Commit 4bcd3cd2bf67

Vincent Demeester <vincent@sbr.pm>
2026-02-02 21:17:03
feat: add multi-tool support to gh-news-review
- Add -t/--tool flag to gh-news-review to support claude, pi, copilot, opencode - Update gh-news and lazypr configs with review actions for all 4 AI tools - Each tool gets normal and yolo modes where applicable - Pi uses ~/.pi/skills instead of ~/.config/claude/skills - Copilot and OpenCode get simplified prompts (no skill references)
1 parent 1e0690b
Changed files (3)
dots
.config
pkgs
my
scripts
dots/.config/gh-news/config.toml
@@ -36,10 +36,30 @@ interactive = true
 
 [[actions]]
 name = "Review with Claude"
-command = "gh-news-review -d {url}"
+command = "gh-news-review -d -t claude {url}"
 interactive = false
 
 [[actions]]
 name = "Review with Claude (yolo)"
-command = "gh-news-review -d -y {url}"
+command = "gh-news-review -d -y -t claude {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Pi"
+command = "gh-news-review -d -t pi {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Pi (yolo)"
+command = "gh-news-review -d -y -t pi {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Copilot"
+command = "gh-news-review -d -t copilot {url}"
+interactive = false
+
+[[actions]]
+name = "Review with OpenCode"
+command = "gh-news-review -d -t opencode {url}"
 interactive = false
dots/.config/lazypr/config.toml
@@ -19,10 +19,30 @@ interactive = true
 
 [[actions]]
 name = "Review with Claude"
-command = "gh-news-review -d {url}"
+command = "gh-news-review -d -t claude {url}"
 interactive = false
 
 [[actions]]
 name = "Review with Claude (yolo)"
-command = "gh-news-review -d -y {url}"
+command = "gh-news-review -d -y -t claude {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Pi"
+command = "gh-news-review -d -t pi {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Pi (yolo)"
+command = "gh-news-review -d -y -t pi {url}"
+interactive = false
+
+[[actions]]
+name = "Review with Copilot"
+command = "gh-news-review -d -t copilot {url}"
+interactive = false
+
+[[actions]]
+name = "Review with OpenCode"
+command = "gh-news-review -d -t opencode {url}"
 interactive = false
pkgs/my/scripts/bin/gh-news-review
@@ -1,13 +1,15 @@
 #!/usr/bin/env bash
-# Review a GitHub PR/issue with Claude on a remote machine via shpool
-# 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)
+# Review a GitHub PR/issue with an AI tool on a remote machine via shpool
+# Usage: gh-news-review [-d|--detach] [-y|--yolo] [-t|--tool TOOL] <url>
+#   -d, --detach     Start session in background and return immediately
+#   -y, --yolo       Skip permission prompts (auto-accept all tool calls)
+#   -t, --tool TOOL  AI tool to use: claude, copilot, pi, opencode (default: claude)
 
 set -euo pipefail
 
 DETACH=false
 YOLO=false
+TOOL="claude"
 
 while [[ $# -gt 0 ]]; do
 	case "$1" in
@@ -19,9 +21,13 @@ while [[ $# -gt 0 ]]; do
 		YOLO=true
 		shift
 		;;
+	-t | --tool)
+		TOOL="$2"
+		shift 2
+		;;
 	-*)
 		echo "Unknown option: $1" >&2
-		echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>" >&2
+		echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] [-t|--tool TOOL] <url>" >&2
 		exit 1
 		;;
 	*)
@@ -32,10 +38,20 @@ done
 
 URL="${1:-}"
 if [[ -z "$URL" ]]; then
-	echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>" >&2
+	echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] [-t|--tool TOOL] <url>" >&2
 	exit 1
 fi
 
+# Validate tool
+case "$TOOL" in
+	claude|copilot|pi|opencode)
+		;;
+	*)
+		echo "Error: Invalid tool '$TOOL'. Must be one of: claude, copilot, pi, opencode" >&2
+		exit 1
+		;;
+esac
+
 # Extract session name from URL (e.g., pull-123 or issues-456)
 SESSION_NAME="review-$(echo "$URL" | grep -oE '(pull|issues)/[0-9]+' | tr '/' '-')"
 
@@ -52,7 +68,9 @@ fi
 
 # Build the prompt based on the type of review
 if [[ "$IS_NIXPKGS" == "true" ]]; then
-	PROMPT="Review $URL using the Nixpkgs skill (~/.config/claude/skills), and the Review workflow. Use GPT-5.2-Codex or Opus 4.5 model if available.
+	case "$TOOL" in
+		claude)
+			PROMPT="Review $URL using the Nixpkgs skill (~/.config/claude/skills), and the Review workflow. Use GPT-5.2-Codex or Opus 4.5 model if available.
 
 For nixpkgs PRs:
 1. Load and follow the Nixpkgs skill workflow
@@ -61,15 +79,64 @@ For nixpkgs PRs:
 4. If I'm a maintainer of the touched packages, use the auto-merge-pr script to build, approve, and trigger merge-bot
 
 At the end, save the session (in ~/.config/claude/history/sessions/)"
+			;;
+		pi)
+			PROMPT="Review $URL using the Nixpkgs skill (~/.pi/skills), and the Review workflow. Use GPT-5.2-Codex or Opus 4.5 model if available.
+
+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 I'm a maintainer of the touched packages, use the auto-merge-pr script to build, approve, and trigger merge-bot
+
+At the end, save the session"
+			;;
+		copilot|opencode)
+			PROMPT="Review $URL
+
+For nixpkgs PRs:
+1. Use nixpkgs-review to build and test the changes when appropriate
+2. When approving, use a concise message (e.g., 'LGTM, tested with nixpkgs-review')
+3. If I'm a maintainer of the touched packages, use the auto-merge-pr script to build, approve, and trigger merge-bot"
+			;;
+	esac
 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)"
+	case "$TOOL" in
+		claude)
+			PROMPT="Review $URL, and load the proper skill as needed (e.g. nixpkgs skills and workflows if it is a pr from NixOS/nixpkgs)"
+			;;
+		pi)
+			PROMPT="Review $URL, and load the proper skill as needed (e.g. nixpkgs skills and workflows if it is a pr from NixOS/nixpkgs)"
+			;;
+		copilot|opencode)
+			PROMPT="Review $URL"
+			;;
+	esac
 fi
 
-# Build cr command with optional yolo mode
-CR_CMD="cr"
-if [[ "$YOLO" == "true" ]]; then
-	CR_CMD="cr --dangerously-skip-permissions"
-fi
+# Build command based on tool and optional yolo mode
+case "$TOOL" in
+	claude)
+		AI_CMD="cr"
+		if [[ "$YOLO" == "true" ]]; then
+			AI_CMD="cr --dangerously-skip-permissions"
+		fi
+		;;
+	copilot)
+		AI_CMD="copilot"
+		# Note: copilot doesn't have a yolo/skip-permissions mode
+		;;
+	pi)
+		AI_CMD="pi"
+		if [[ "$YOLO" == "true" ]]; then
+			AI_CMD="pi --dangerously-skip-permissions"
+		fi
+		;;
+	opencode)
+		AI_CMD="opencode"
+		# Note: opencode doesn't have a yolo/skip-permissions mode
+		;;
+esac
 
 # Encode prompt in base64 to avoid all quoting issues
 PROMPT_B64=$(printf '%s' "$PROMPT" | base64 -w0)
@@ -80,16 +147,16 @@ if [[ "$DETACH" == "true" ]]; then
 	# shellcheck disable=SC2029,SC2087  # Intentional client-side expansion
 	ssh aomi.sbr.pm "cat > /tmp/review-cmd-$SESSION_NAME.sh && chmod +x /tmp/review-cmd-$SESSION_NAME.sh && nohup shpool attach -f -c '/run/current-system/sw/bin/bash -l /tmp/review-cmd-$SESSION_NAME.sh' $SESSION_NAME > /dev/null 2>&1 &" <<EOF
 cd ~/src/nixpkgs
-$CR_CMD "\$(echo '$PROMPT_B64' | base64 -d)"
+$AI_CMD "\$(echo '$PROMPT_B64' | base64 -d)"
 EOF
-	echo "Started review session: $SESSION_NAME"
+	echo "Started review session: $SESSION_NAME (using $TOOL)"
 	echo "Attach with: ssh -t aomi.sbr.pm 'shpool attach $SESSION_NAME'"
 else
 	# Interactive: write temp script and run
 	# shellcheck disable=SC2029,SC2087  # Intentional client-side expansion
 	ssh aomi.sbr.pm "cat > /tmp/review-cmd-$SESSION_NAME.sh && chmod +x /tmp/review-cmd-$SESSION_NAME.sh" <<EOF
 cd ~/src/nixpkgs
-$CR_CMD "\$(echo '$PROMPT_B64' | base64 -d)"
+$AI_CMD "\$(echo '$PROMPT_B64' | base64 -d)"
 EOF
 	exec ssh -t aomi.sbr.pm "shpool attach -f -c '/run/current-system/sw/bin/bash -l /tmp/review-cmd-$SESSION_NAME.sh' $SESSION_NAME"
 fi