diff --git a/CHANGELOG.md b/CHANGELOG.md index d690208..b7afecd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,22 @@ All notable changes are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/); versions follow [Semantic Versioning](https://semver.org/) once we tag 1.0. +## [v0.6.6] — 2026-08-15 + +### Fixes + +- `prs create --json` and `issues create --json` no longer always fail. Both + appended `--json number,url,title` directly to `gh pr create` / `gh issue + create`, but neither `gh` subcommand accepts `--json` (only `list`/`view` + do) — every JSON-mode create exited with `unknown flag: --json` before + creating anything. Worse, retrying the identical command without `--json` + looked like the obvious fix and silently succeeded, publishing a real + PR/issue with whatever title/body was passed — a footgun for anything + scripting a retry. Fixed the same way `prs comment`/`issues comment` + already handle this: create without `--json`, parse the number out of the + URL `gh` prints on stdout, then fetch `{number, url, title}` from `gh pr + view` / `gh issue view`. (#15) + ## [v0.6.5] — 2026-05-21 ### Fixes diff --git a/bin/fledge-github-issues b/bin/fledge-github-issues index c187d95..b80eae7 100755 --- a/bin/fledge-github-issues +++ b/bin/fledge-github-issues @@ -167,7 +167,12 @@ if [ "$ACTION" = "create" ]; then [ -n "$LABEL" ] && ARGS+=(--label "$LABEL") [ -n "$ASSIGNEE" ] && ARGS+=(--assignee "$ASSIGNEE") if [ "$JSON" = "true" ]; then - gh issue create "${ARGS[@]}" --json number,url,title + # gh issue create has no --json flag (only list/view do); it prints + # the new issue's URL on stdout on success. Parse the number out of + # that URL and fetch the authoritative shape from gh issue view instead. + ISSUE_URL="$(gh issue create "${ARGS[@]}" | tail -n1)" + ISSUE_NUMBER="${ISSUE_URL##*/}" + gh issue view "$ISSUE_NUMBER" "${REPO_FLAGS[@]+"${REPO_FLAGS[@]}"}" --json number,url,title else gh issue create "${ARGS[@]}" fi diff --git a/bin/fledge-github-prs b/bin/fledge-github-prs index c1fd54a..7804fa0 100755 --- a/bin/fledge-github-prs +++ b/bin/fledge-github-prs @@ -399,7 +399,12 @@ Output only the title and body. No preamble, no meta-commentary." [ "$DRAFT" = "true" ] && ARGS+=(--draft) [ "$FILL" = "true" ] && ARGS+=(--fill) if [ "$JSON" = "true" ]; then - gh pr create "${ARGS[@]}" --json number,url,title + # gh pr create has no --json flag (only list/view do); it prints the + # new PR's URL on stdout on success. Parse the number out of that URL + # and fetch the authoritative shape from gh pr view instead. + PR_URL="$(gh pr create "${ARGS[@]}" | tail -n1)" + PR_NUMBER="${PR_URL##*/}" + gh pr view "$PR_NUMBER" "${REPO_FLAGS[@]+"${REPO_FLAGS[@]}"}" --json number,url,title else gh pr create "${ARGS[@]}" fi diff --git a/plugin.toml b/plugin.toml index e8fa18e..fcd5db2 100644 --- a/plugin.toml +++ b/plugin.toml @@ -1,6 +1,6 @@ [plugin] name = "fledge-plugin-github" -version = "0.6.5" +version = "0.6.6" description = "GitHub commands for fledge — list/view/create/comment/review/merge PRs, list/view/create/comment/close issues, read repo files, view CI checks, and poll for daemon events via the gh CLI" author = "0xLeif" license = "MIT"