Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## [v0.6.0] - 2026-05-21

### Features

- `prs view`: add `--diff` and `--comments` flags to append the unified diff and conversation comments + reviews to the view output.
- `prs comment <NUMBER> -b BODY`: post a comment on a pull request.
- `prs review <NUMBER>`: submit a review — one of `--approve`, `--request-changes`, or `--comment-review`, plus `--body`.
- `prs merge <NUMBER>`: merge a PR with `--squash` (default), `--merge`, or `--rebase`.
- `prs close <NUMBER>` / `prs reopen <NUMBER>`: close without merging or reopen.
- `issues view`: add `--comments` flag to append the issue conversation.
- `issues comment <NUMBER> -b BODY`: post a comment on an issue.
- `issues close <NUMBER>` / `issues reopen <NUMBER>`.
- New `repo` subcommand:
- `repo view [-R OWNER/NAME] [--json]` — repo metadata.
- `repo file <PATH> [-R OWNER/NAME] [-r REF] [--json]` — read a file's contents at any ref via `gh api repos/.../contents/...`. Closes the gap where agents fell back to authenticated-failing `web-fetch` against `raw.githubusercontent.com`.

## [v0.5.0] - 2026-05-13

### Features
Expand Down
51 changes: 37 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,61 @@ $ fledge github checks

JSON output is the raw GitHub API response from `repos/{owner}/{repo}/commits/{branch}/check-runs`.

### `fledge github issues [list | view <num> | create] [OPTIONS]`
### `fledge github issues [list | view <num> | create | comment <num> | close <num> | reopen <num>] [OPTIONS]`

Browse and create issues. Lists by default; `view <number>` shows a specific one; `create` opens a new issue.
Browse, create, and write to issues. Lists by default.

```
$ fledge github issues --state all --limit 5
$ fledge github issues view 42 --json
$ fledge github issues view 42 --comments
$ fledge github issues create --title "Bug: something broke"
$ fledge github issues create --title "Feature request" --label enhancement --assignee octocat --json
$ fledge github issues comment 42 -b "Reproduced on 0.3.1."
$ fledge github issues close 42
$ fledge github issues reopen 42
```

List/view options: `--state {open,closed,all}`, `--limit <N>`, `--label <label>`, `--json`.
Create options: `--title <title>`, `--body <body>`, `--label <label>`, `--assignee <login>`, `--json`.
List/view options: `--state {open,closed,all}`, `--limit <N>`, `--label <label>`, `--json`, `--comments` (view).
Create options: `--title <title>`, `--body <body>`, `--label <label>`, `--assignee <login>`, `--json`.
Comment options: `--body <body>` (required), `--json`.

### `fledge github prs [list | view <num> | create] [OPTIONS]`
### `fledge github prs [list | view <num> | create | comment <num> | review <num> | merge <num> | close <num> | reopen <num>] [OPTIONS]`

Browse and create pull requests. Lists by default; `view <number>` shows a specific one; `create` opens a new PR.
The full PR surface. Lists by default; everything else takes a PR number.

```
$ fledge github prs --state merged --limit 5
$ fledge github prs view 256 --json
$ fledge github prs view 256 --diff --comments
$ fledge github prs create --fill
$ fledge github prs create --ai
$ fledge github prs create --ai --draft
$ fledge github prs create --title "My feature" --draft --json
$ fledge github prs comment 256 -b "Looks good — one nit inline."
$ fledge github prs review 256 --approve
$ fledge github prs review 256 --request-changes -b "See comments."
$ fledge github prs merge 256 --squash
$ fledge github prs close 256
```

List/view options: `--state {open,closed,merged,all}`, `--limit <N>`, `--json`.
Create options: `--title <title>`, `--body <body>`, `--base <branch>`, `--draft`, `--fill`, `--ai`, `--json`.
List/view options: `--state {open,closed,merged,all}`, `--limit <N>`, `--json`, `--diff` (view, append unified diff), `--comments` (view, append conversation).
Create options: `--title <title>`, `--body <body>`, `--base <branch>`, `--draft`, `--fill`, `--ai`, `--json`.
Comment options: `--body <body>` (required), `--json`.
Review options: one of `--approve` / `--request-changes` / `--comment-review`, plus `--body <body>` (required for the latter two).
Merge options: `--squash` (default) | `--merge` | `--rebase`.

`--ai` generates a PR title and body by sending your commits and diff to `fledge ask`. It shows a preview and lets you confirm, edit, or abort before creating the PR.

### `fledge github repo [view | file <path>] [OPTIONS]`

Read repo metadata or fetch a file's contents at a ref. `file` wraps `gh api repos/.../contents/...` and decodes the base64, so it works for any branch/tag/SHA without needing a clone or a raw-URL token.

```
$ fledge github repo view
$ fledge github repo view -R CorvidLabs/merlin --json
$ fledge github repo file CHANGELOG.md
$ fledge github repo file Cargo.toml -r v0.3.0
$ fledge github repo file README.md -R CorvidLabs/fledge-plugin-github
```

Options: `-R, --repo <owner/name>` (default: current repo), `-r, --ref <ref>` (file only), `--json`.

### `fledge github poll [OPTIONS]`

Poll for new issues and PRs as structured event objects. Designed for [Merlin](https://github.com/CorvidLabs/merlin) daemon mode — the output matches the daemon `Event` schema.
Expand All @@ -89,7 +112,7 @@ A flat `checks`/`issues`/`prs` surface bakes "all dev happens on GitHub" into fl

## Hacking

`bin/fledge-github` is a thin dispatcher; each subcommand is a self-contained POSIX-ish shell script (`bin/fledge-github-checks`, `…-issues`, `…-prs`, `…-poll`). The scripts use `gh api` (or `gh issue`/`gh pr`) to talk to GitHub, then format the response — no extra runtime dependencies beyond `gh`, `git`, `python3`, and `awk`.
`bin/fledge-github` is a thin dispatcher; each subcommand is a self-contained POSIX-ish shell script (`bin/fledge-github-checks`, `…-issues`, `…-prs`, `…-poll`, `…-repo`). The scripts use `gh api` (or `gh issue`/`gh pr`/`gh repo`) to talk to GitHub, then format the response — no extra runtime dependencies beyond `gh`, `git`, `python3`, `awk`, and `base64`.

## License

Expand Down
7 changes: 4 additions & 3 deletions bin/fledge-github
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ USAGE:

SUBCOMMANDS:
checks View CI/CD check status for a branch
issues List and view GitHub issues
prs List and view GitHub pull requests
issues List, view, create, comment on, close, and reopen GitHub issues
prs List, view, create, comment on, review, merge, close, and reopen pull requests
repo View repo metadata and read file contents at a ref
poll Poll for new issues/PRs as daemon events (JSON)

Run `fledge github <SUBCOMMAND> --help` for subcommand-specific options.
Expand All @@ -41,7 +42,7 @@ SUB="$1"
shift

case "$SUB" in
checks|issues|prs|poll)
checks|issues|prs|poll|repo)
exec "${DIR}/fledge-github-${SUB}" "$@"
;;
-h|--help|help)
Expand Down
78 changes: 62 additions & 16 deletions bin/fledge-github-issues
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#!/usr/bin/env bash
# fledge-github-issues — list, view, and create GitHub issues via the gh CLI.
# Invoked via: fledge github issues [create | view <num> | list] [OPTIONS]
# fledge-github-issues — list, view, create, comment on, close, and reopen
# GitHub issues via the gh CLI.
# Invoked via: fledge github issues [list | view <num> | create | comment <num> |
# close <num> | reopen <num>] [OPTIONS]
set -euo pipefail

ACTION="list"
Expand All @@ -12,12 +14,13 @@ TITLE=""
BODY=""
ASSIGNEE=""
JSON=false
INCLUDE_COMMENTS=false

# First positional arg can be a subcommand: create, view, or list
# First positional arg can be a subcommand.
if [ $# -gt 0 ] && [ "${1:0:1}" != "-" ]; then
case "$1" in
view)
ACTION="view"
view|comment|close|reopen)
ACTION="$1"
shift
if [ $# -gt 0 ] && [ "${1:0:1}" != "-" ]; then
NUMBER="$1"
Expand All @@ -44,34 +47,44 @@ while [ $# -gt 0 ]; do
-b|--body) BODY="${2:-}"; shift 2;;
-a|--assignee) ASSIGNEE="${2:-}"; shift 2;;
--json) JSON=true; shift;;
--comments) INCLUDE_COMMENTS=true; shift;;
-h|--help)
cat <<'EOF'
fledge github issues — list, view, and create GitHub issues
fledge github issues — manage GitHub issues via the gh CLI

USAGE:
fledge github issues [list] List open issues (default)
fledge github issues view <NUMBER> View a specific issue
fledge github issues create Create a new issue
fledge github issues [list] List open issues (default)
fledge github issues view <NUMBER> View a specific issue
fledge github issues create Create a new issue
fledge github issues comment <NUMBER> -b BODY Post a comment
fledge github issues close <NUMBER> Close an issue
fledge github issues reopen <NUMBER> Reopen a closed issue

LIST / VIEW OPTIONS:
-s, --state <STATE> open | closed | all (default: open)
-l, --limit <N> Maximum results (default: 20)
--label <LABEL> Filter by label
--json Output JSON
--comments (view) Append the issue's conversation comments

CREATE OPTIONS:
-t, --title <TITLE> Issue title
-b, --body <BODY> Issue body
--label <LABEL> Attach label (repeatable)
--label <LABEL> Attach label (repeatable on the gh side)
-a, --assignee <LOGIN> Assign to user
--json Output JSON (number, url, title)

COMMENT OPTIONS:
-b, --body <BODY> Comment body (required)
--json Output JSON (url)

EXAMPLES:
fledge github issues
fledge github issues --state all --limit 50
fledge github issues view 42 --json
fledge github issues view 42 --comments
fledge github issues create --title "Bug: something broke"
fledge github issues create --title "Feature request" --label enhancement --assignee octocat
fledge github issues comment 42 -b "Reproduced on 0.3.1 too."
fledge github issues close 42
EOF
exit 0
;;
Expand All @@ -87,16 +100,49 @@ if ! command -v gh >/dev/null 2>&1; then
exit 127
fi

case "$ACTION" in
view|comment|close|reopen)
if [ -z "$NUMBER" ]; then
echo "fledge github issues: '$ACTION' requires an issue number. Try: fledge github issues $ACTION 42" >&2
exit 64
fi
;;
esac

if [ "$ACTION" = "view" ]; then
if [ -z "$NUMBER" ]; then
echo "fledge github issues: 'view' requires an issue number. Try: fledge github issues view 42" >&2
exit 64
fi
if [ "$JSON" = "true" ]; then
gh issue view "$NUMBER" --json number,title,state,author,body,labels,createdAt,updatedAt,url,assignees
else
gh issue view "$NUMBER"
fi
if [ "$JSON" != "true" ] && [ "$INCLUDE_COMMENTS" = "true" ]; then
printf '\n--- Comments ---\n'
gh issue view "$NUMBER" --comments
fi
exit 0
fi

if [ "$ACTION" = "comment" ]; then
if [ -z "$BODY" ]; then
echo "fledge github issues: 'comment' requires --body" >&2
exit 64
fi
if [ "$JSON" = "true" ]; then
URL="$(gh issue comment "$NUMBER" -b "$BODY")"
printf '{"url":"%s"}\n' "$URL"
else
gh issue comment "$NUMBER" -b "$BODY"
fi
exit 0
fi

if [ "$ACTION" = "close" ]; then
gh issue close "$NUMBER"
exit 0
fi

if [ "$ACTION" = "reopen" ]; then
gh issue reopen "$NUMBER"
exit 0
fi

Expand Down
Loading
Loading