feat: add issue view with body cleaning and truncation (task 0003) #2
Reference in New Issue
Block a user
Delete Branch "task-0003-issue-view-and-truncation"
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?
Implements task 0003 —
issue view <n>as the first detail command, introducing the content-cleaning and truncation machinery that later issue and PR slices reuse.What's in it
src/body.ts(new) —cleanBody/truncateBodyplus theBODY_TRUNCATE_LIMIT(500) andCOMMENT_TRUNCATE_LIMIT(800) constants. Cleaning runs only when a body exceeds its limit, so short bodies pass through byte-for-byte.src/commands/issue.ts—issue view <n>: default fields (number,title,state,author,created,body) pluscomment_count;--commentsexpands every comment with no cap;--fullsuppresses all truncation.src/render.ts—renderDetail, joining the detail entity, optional sub-blocks (comments), and the help block. Shares a privateencodeRowshelper withrenderList.src/cli.ts— top-level help listsissue view.Behaviour notes
cleanBodynormalizes Gitea issue/PR URLs on the detected host toIssue#N/PR#N, strips markdown image embeds, removes long URLs, and collapses email-style quoted blocks.VALIDATION_ERRORand apr view <n>hint, detected via the fetched object'spull_requestfield.comment_countis emitted only in the default view — with--commentsthe full block replaces it rather than sitting alongside a redundant scalar (matches gh-axi).--fullsuggestion fires whenever the rendered body differs from the raw one (cleaned or truncated), read off the rendered output so it can't drift fromtruncateBody's own limit decision.Verification
test/body.test.ts, 16 intest/issue-view.test.ts).--comments,--full, the type guard, and error paths.3446ce33a5to5e66b4d746