Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

rtk gh pr view --json ... fails #313

@guyboltonking

Description

@guyboltonking

This confuses Claude, because its default behaviour is to use gh pr view --json to get at PR data. I've worked around this by patching the hook script (see below) but rtk should probably handle this correctly.

❯ gh pr view --json number,url
{
  "number": 363024,
  "url": "https://github.com/owner/repo/pull/363024"
}
❯ rtk gh pr view --json number,url
Unknown JSON field: "--json"

Patch to hook script

diff --git i/agents/claude/hooks/rtk-rewrite.sh w/agents/claude/hooks/rtk-rewrite.sh
index 59e02ca..7fafca4 100755
--- i/agents/claude/hooks/rtk-rewrite.sh
+++ w/agents/claude/hooks/rtk-rewrite.sh
@@ -60,7 +60,7 @@ if echo "$MATCH_CMD" | grep -qE '^git[[:space:]]'; then
   esac
 
 # --- GitHub CLI (added: api, release) ---
-elif echo "$MATCH_CMD" | grep -qE '^gh[[:space:]]+(pr|issue|run|api|release)([[:space:]]|$)'; then
+elif echo "$MATCH_CMD" | grep -qE '^gh[[:space:]]+(pr|issue|run|api|release)([[:space:]]|$)' && [[ "$MATCH_CMD" != *--json* ]]; then
   REWRITTEN="${ENV_PREFIX}$(echo "$CMD_BODY" | sed 's/^gh /rtk gh /')"
 
 # --- Cargo ---

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions