feat: add pr view and checks (task 0009) #9
Reference in New Issue
Block a user
Delete Branch "task-0009-pr-view-and-checks"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Task:
.claude/tasks/0009-pr-view-and-checks.mdSummary
Adds
pr view <n>andpr checks <n>.pr viewuses the three-call fetch pattern (ADR 0006): the PR and its reviews are fetched in parallel, then the head commit's combined status once the head SHA is known — sochecks,comment_count, andreview_countare always in the default output.--comments,--reviews, and--fullbehave as onissue view: 800-char comment truncation withcleanBody,--fullsuppressing all truncation, and--reviewsexposing Gitea'sofficial/stalefields plus each review's inline comments.pr checksrenders the checks summary line above a{ name, conclusion }list, or a scalar no-CI message when no statuses exist.Notable decisions / deviations
src/checks.ts(summarizeCheckspure core +fetchChecksshell); unknown/future commit-status states fall through topendingrather than being reported as a pass/fail they aren't.renderScalar(noun, value, help)insrc/render.tsemits the no-CIchecks:line unquoted (TOON reads a string scalar to end of line), matching the summary line's treatment.commentRowswas extracted fromissue.tsintosrc/comment.tsand is now shared byissue view --commentsandpr view --comments.mergedrenders asnowhen open, or the merge time (relative) once merged, matching gh-axi.Review
Risk
Overall: Medium
pr view/pr checkssubcommands plus small shared helpers (commentRows,renderScalar,fetchReviewsrefactor); no existing behavior altered beyond a clean extraction.Standards (unaddressed)
buildReviewRowsinline comment mapping vs the freshly-extractedcommentRows. Kept separate deliberately: review inline comments are a different entity (PullReviewComment, withpathand no displayed timestamp) than issue/PR comments ({ author, created, body }); forcing reuse would mean parameterizing the middle field, obscuring more than it saves.checksSummary: string, Data Clumps on the{ host, full, now }option trio) were judged acceptable — the string is the only field the detail row needs, and the option-object trio mirrors the existingissue.tsidiom.Spec (unaddressed)
pr checksno-CI label wrinkle — the summary string is labeledsummary:when checks exist butchecks:in the empty case. Intentional: it matches the spec's literal empty-state form (checks: "0 passed, 0 failed — …", spec line 292) and gh-axi's shape.pr viewtest driving a >500-char body through the truncation hint) was addressed — a truncation test was added.Add `pr view <n>` and `pr checks <n>`, built on the truncation machinery and review fetches from earlier slices. `pr view` uses the three-call fetch pattern (PR + reviews in parallel, then the head commit's combined status) so `checks`, `comment_count`, and `review_count` are in the default output; `--comments`, `--reviews`, and `--full` behave as on `issue view`, with `--reviews` exposing Gitea's `official`/`stale` fields plus per-review inline comments. `pr checks <n>` renders the checks summary line and the `{ name, conclusion }` rows, or the scalar no-CI message when no statuses exist. The state→conclusion mapping and summary live in a new `src/checks.ts`; `commentRows` is extracted into `src/comment.ts` and shared with `issue view`.