From 4dd6cb1ce503a3444960918019741b3010e873d3 Mon Sep 17 00:00:00 2001 From: Corvid Agent <95454608+corvid-agent@users.noreply.github.com> Date: Wed, 13 May 2026 08:20:28 -0700 Subject: [PATCH] feat: add github-poll command for daemon event polling Adds a `poll` subcommand that queries GitHub for new issues and PRs and outputs them as a JSON array of Event objects matching the merlin daemon schema. Supports --since filtering, --types, --label, and --repo options. Closes CorvidLabs/merlin#245. Co-Authored-By: Corvid Agent --- bin/fledge-github | 3 +- bin/fledge-github-poll | 160 +++++++++++++++++++++++++++++++++++++++++ plugin.toml | 6 +- 3 files changed, 165 insertions(+), 4 deletions(-) create mode 100755 bin/fledge-github-poll diff --git a/bin/fledge-github b/bin/fledge-github index fe81ee8..45178ef 100755 --- a/bin/fledge-github +++ b/bin/fledge-github @@ -26,6 +26,7 @@ SUBCOMMANDS: checks View CI/CD check status for a branch issues List and view GitHub issues prs List and view GitHub pull requests + poll Poll for new issues/PRs as daemon events (JSON) Run `fledge github --help` for subcommand-specific options. EOF @@ -40,7 +41,7 @@ SUB="$1" shift case "$SUB" in - checks|issues|prs) + checks|issues|prs|poll) exec "${DIR}/fledge-github-${SUB}" "$@" ;; -h|--help|help) diff --git a/bin/fledge-github-poll b/bin/fledge-github-poll new file mode 100755 index 0000000..7b9cb95 --- /dev/null +++ b/bin/fledge-github-poll @@ -0,0 +1,160 @@ +#!/usr/bin/env bash +# fledge-github-poll — poll GitHub for new issues and PRs since a timestamp. +# Outputs JSON array of Event objects matching the merlin daemon Event schema. +# Invoked via: fledge github poll [OPTIONS] +set -euo pipefail + +REPO="" +SINCE="" +LIMIT="30" +TYPES="issues,prs" +LABEL="" +STATE="open" + +while [ $# -gt 0 ]; do + case "$1" in + --repo) REPO="${2:-}"; shift 2;; + --since) SINCE="${2:-}"; shift 2;; + --limit) LIMIT="${2:-}"; shift 2;; + --types) TYPES="${2:-}"; shift 2;; + --label) LABEL="${2:-}"; shift 2;; + --state) STATE="${2:-}"; shift 2;; + -h|--help) + cat <<'EOF' +fledge github poll — poll for new issues and PRs as daemon events + +USAGE: + fledge github poll [OPTIONS] + +OPTIONS: + --repo Repository to poll (default: current repo) + --since Only return events after this ID (e.g. "issues/42") + --limit Maximum events per type (default: 30) + --types Comma-separated: issues,prs (default: both) + --label