feat: add pr list (task 0008)
All checks were successful
CI / test (pull_request) Successful in 30s
CI / test (push) Successful in 31s

Implements `pr list` with the two policies later PR slices reuse:
client-side filtering with the filtered-set count line (ADR 0005) and
the official-first reviewDecision via parallel per-PR review fetches
(ADR 0006), extracted into src/review.ts.

API-supported flags map to their params (--state, --author→poster,
--label name→ID, --label-id, --sort, --limit, --fields); --assignee,
--base, --head, and --draft filter in-process after full pagination,
with the count line's total taken from the filtered set. --search is
refused with a redirect to `search prs`.

Adds a boolText field extractor and a shared parsePositiveInt helper,
the latter also adopted by issue list's --limit parsing.
This commit was merged in pull request #8.
This commit is contained in:
2026-07-12 19:23:29 -04:00
parent 7a41807a8a
commit 6333058b72
7 changed files with 964 additions and 20 deletions

View File

@@ -32,6 +32,20 @@ export function lowercased<T>(name: string, path: string = name): FieldDef<T> {
};
}
/**
* Render a boolean field as one of two words (default `yes`/`no`). A missing or
* falsy value reads as the `no` text, so an absent `draft` flag is reported as
* the ordinary non-draft it represents rather than blank.
*/
export function boolText<T>(
name: string,
path: string = name,
yes = "yes",
no = "no",
): FieldDef<T> {
return { name, extract: (raw) => (pluckPath(raw, path) ? yes : no) };
}
/**
* Join a field holding an array of objects (labels, assignees) into a single
* string of each element's `key` property.