Commit d0cee65546cf

Vincent Demeester <vincent@sbr.pm>
2026-01-29 12:49:24
fix(gh-news): add gh-news-review script for Claude review action
The previous inline command had complex escaping issues that caused shpool to fail with "No such file or directory" because: 1. shpool's -c option execs commands directly without a shell 2. The cr binary is in Nix profile paths not in shpool's default PATH 3. gh-news shell-escapes URLs breaking the nested quoting structure Solution: Create a dedicated gh-news-review script that: - Takes URL as a simple argument (no escaping issues) - Extracts session name from PR/issue URL - Uses bash -lc to ensure Nix profile PATH is available - SSHs to aomi with properly quoted shpool command Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent a852551
Changed files (2)
home
common
pkgs
my
scripts
home/common/dev/gh-news.nix
@@ -40,7 +40,7 @@
         }
         {
           name = "Review with Claude";
-          command = "ssh aomi.sbr.pm \"shpool attach -f -c 'cr \\\"Review {url}, and load the proper skill as needed (e.g. nixpkgs skills and workflows if it is a pr from NixOS/nixpkgs)\\\"' review-$(echo '{url}' | grep -oE '(pull|issues)/[0-9]+' | tr '/' '-')\"";
+          command = "gh-news-review {url}";
           interactive = true;
         }
       ];
pkgs/my/scripts/bin/gh-news-review
@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# Review a GitHub PR/issue with Claude on a remote machine via shpool
+# Usage: gh-news-review <url>
+
+set -euo pipefail
+
+URL="$1"
+
+# Extract session name from URL (e.g., pull-123 or issues-456)
+SESSION_NAME="review-$(echo "$URL" | grep -oE '(pull|issues)/[0-9]+' | tr '/' '-')"
+
+if [[ -z "$SESSION_NAME" || "$SESSION_NAME" == "review-" ]]; then
+    echo "Error: Could not extract PR/issue number from URL: $URL" >&2
+    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)"
+
+# SSH to aomi and run cr in a shpool session
+# Use bash -lc to ensure PATH includes Nix profile paths where cr is located
+exec ssh -t aomi.sbr.pm "shpool attach -f -c 'bash -lc \"cr \\\"$PROMPT\\\"\"' $SESSION_NAME"