Compare commits

...
2 changed files with 20 additions and 7 deletions

View file

@ -37,6 +37,7 @@ hive-forge pr-reviews 42 --comment -m "msg" # submit COMMENT review
hive-forge diff 42 # unified diff (lockfile hunks collapsed by default)
hive-forge diff 42 --full # include unfiltered lockfile hunks
hive-forge list # open issues/PRs
hive-forge list --kind pr --state all --page 2 # page 2 of all PRs (walk --page 1,2,… with --limit as page size for a repo-wide sweep)
hive-forge milestone # list milestones
hive-forge branches deployed/ # filter branches by pattern
hive-forge tree-sha main # git tree SHA for a ref

View file

@ -1,7 +1,9 @@
//! `list [--kind issue|pr|both] [--state open|closed|all] [--assignee
//! <user>] [--author <user>] [--label <name>] [--limit N]` — list
//! issues / PRs with filters. Pretty `#NNN [author] title` output by
//! default; `--json` for piping.
//! <user>] [--author <user>] [--label <name>] [--limit N] [--page N]` —
//! list issues / PRs with filters. Pretty `#NNN [author] title` output by
//! default; `--json` for piping. `--limit` is the page size and `--page`
//! the 1-based page number — walk pages incrementally for a large result
//! set rather than pulling the whole population into one response.
//!
//! Mirrors Forgejo's `GET /repos/{owner}/{repo}/issues` query-string
//! filters one-for-one so the mental model carries over. Closes the
@ -83,18 +85,28 @@ pub struct Args {
/// Filter to items carrying any of these label names. Repeatable.
#[arg(long = "label")]
labels: Vec<String>,
/// Max items to return (default: 30; forge's per-page cap applies).
#[arg(long, default_value_t = 30)]
/// Page size — items per page (default: 30; forge's per-page cap,
/// ~50, applies). Must be >= 1.
#[arg(long, default_value_t = 30, value_parser = clap::value_parser!(u64).range(1..))]
limit: u64,
/// Page number to fetch (1-based; default 1). Combine with `--limit`
/// to walk a large result set incrementally — fetch page 1, process,
/// fetch page 2, … until a short/empty page. This keeps each call
/// token-bounded (one page at a time) instead of pulling a whole
/// repo's population into a single response. Must be >= 1 (the forge
/// pages are 1-based; page 0 is rejected).
#[arg(long, default_value_t = 1, value_parser = clap::value_parser!(u64).range(1..))]
page: u64,
}
pub fn run(client: &Client, args: Args) -> Result<()> {
let repo = client.repo();
let mut path = format!(
"/repos/{repo}/issues?type={}&state={}&limit={}",
"/repos/{repo}/issues?type={}&state={}&limit={}&page={}",
args.kind.api_value(),
args.state.api_value(),
args.limit
args.limit,
args.page
);
if let Some(u) = args.assignee.as_deref()
&& !u.is_empty()