Skip to content

fix(v0.6.6): prs create --json and issues create --json always failed - #16

Merged
0xLeif merged 1 commit into
mainfrom
fix/prs-issues-create-json-flag
Aug 15, 2026
Merged

fix(v0.6.6): prs create --json and issues create --json always failed#16
0xLeif merged 1 commit into
mainfrom
fix/prs-issues-create-json-flag

Conversation

@0xLeif

@0xLeif 0xLeif commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #15. gh pr create and gh issue create don't accept --json (only list/view do), but both prs create and issues create appended --json number,url,title directly to the create call — every JSON-mode create exited unknown flag: --json before creating anything.

The dangerous part: the natural recovery — drop --json and retry the identical command — looks like a no-op but actually succeeds, silently publishing a real PR/issue with whatever placeholder title/body was in the retry. Hit this live: an agent invocation failed on --json, retried without it, and published a PR titled "test title" on a real repo before anyone caught it.

Fix

Same pattern this file already uses for prs comment/issues comment: create without --json, parse the number out of the URL gh prints on stdout (tail -n1 for safety), then fetch the documented {number, url, title} shape from gh pr view / gh issue view.

Test Plan

  • shellcheck --severity=warning on both changed scripts (matches CI)
  • bash -n syntax check on both
  • --help smoke test on both
  • This very PR was opened with the fixed bin/fledge-github-prs create --json — if the fix were broken, this PR wouldn't exist with correct title/body
  • plugin.toml bumped to 0.6.6, CHANGELOG.md updated

🤖 Generated with Claude Code

gh pr create and gh issue create don't accept --json (only list/view do),
but both scripts appended --json number,url,title directly to the create
call. Every JSON-mode create exited "unknown flag: --json" before creating
anything.

The dangerous part: the natural recovery -- drop --json and retry the
identical command -- looks like a no-op fix but actually succeeds, silently
publishing a real PR/issue with whatever placeholder title/body was in the
retry. Hit this live: an agent invocation failed on --json, retried without
it to "just see the error again", and instead published a PR titled "test
title" on a real repo before anyone caught it.

Fixed the same way prs comment / issues comment already handle this in this
same file: create without --json, parse the number out of the URL gh prints
on stdout, then fetch the documented {number, url, title} shape from
gh pr view / gh issue view.

Refs #15

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01M1Ts8qwUqfvZK8GtE21bhm
@0xLeif
0xLeif merged commit 093b120 into main Aug 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant