Commit 3afcd958960a
Changed files (1)
pkgs
my
scripts
bin
pkgs/my/scripts/bin/gh-news-review
@@ -10,84 +10,86 @@ DETACH=false
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
+ 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] [-y|--yolo] <url>" >&2
- exit 1
+ echo "Usage: gh-news-review [-d|--detach] [-y|--yolo] <url>" >&2
+ exit 1
fi
# 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
+ echo "Error: Could not extract PR/issue number from URL: $URL" >&2
+ exit 1
fi
# Detect if this is a nixpkgs PR for more specific instructions
IS_NIXPKGS=false
if [[ "$URL" == *"NixOS/nixpkgs"* ]]; then
- IS_NIXPKGS=true
+ 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.
+ 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
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"
+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/)"
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)"
+ 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"
+ CR_CMD="cr --dangerously-skip-permissions"
fi
# Encode prompt in base64 to avoid all quoting issues
PROMPT_B64=$(printf '%s' "$PROMPT" | base64 -w0)
if [[ "$DETACH" == "true" ]]; then
- # Write a temp script on remote and execute it in shpool
- # Using heredoc avoids all nested quoting issues
- # 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
+ # Write a temp script on remote and execute it in shpool
+ # Using heredoc avoids all nested quoting issues
+ # 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)"
EOF
- echo "Started review session: $SESSION_NAME"
- echo "Attach with: ssh -t aomi.sbr.pm 'shpool attach $SESSION_NAME'"
+ echo "Started review session: $SESSION_NAME"
+ 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
+ # 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)"
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"
+ 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