Skip to content

prs create --json is advertised but always fails: gh pr create has no --json flag (v0.4.0) #15

Description

@0xLeif

Bug

fledge github prs create --json cannot succeed in v0.4.0.

Evidence:

  1. The built-in help advertises the flag combination — fledge github prs create --help lists --json Output JSON (number, url, title) under CREATE OPTIONS, and the README shows fledge github prs create --title "My feature" --draft --json.

  2. bin/fledge-github-prs (v0.4.0) implements the create path as:

    if [ "$JSON" = "true" ]; then
      gh pr create "${ARGS[@]}" --json number,url,title
  3. gh pr create does not support --json (only gh pr list / gh pr view do). Repro with gh 2.83.1:

    $ gh pr create --json number,url,title
    unknown flag: --json

So any consumer following the documented interface gets a non-zero exit at PR creation time. Note the failure can bite after the branch is already pushed, which makes it especially confusing in automation: the push succeeds, the PR step fails.

Suggested fix

Drop --json from the gh pr create invocation. gh pr create prints the new PR URL on stdout on success, so the JSON mode can be synthesized from that single line, e.g. parse the URL, extract the PR number from the path, and optionally call gh pr view <num> --json number,url,title for an authoritative response. Alternatively document that create ignores --json and always prints the URL.

Environment

  • fledge-plugin-github v0.4.0 (pinned)
  • gh 2.83.1 (2025-11-13)
  • macOS (Apple Silicon, Homebrew install)

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