feat: add search commands (task 0016) #17
Reference in New Issue
Block a user
Delete Branch "task-0016-search-commands"
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/0016-search-commands.mdSummary
Adds
search issues <query>andsearch prs <query>— the full-text escape hatch the forbidden--searchflag onissue list/pr listredirects to.Both call Gitea's cross-repo issue-search endpoint (
GET /repos/issues/search) with the query, atypeofissuesorpulls, and theownerparam, then filter results to the current repository client-side via each result'srepositoryfield (the endpoint has no repo-name filter). The count line reportscount: N of T totalwithTfrom the filtered set (ADR 0005) — the endpoint's cross-repoX-Total-Countis never used.The positional query is required (
VALIDATION_ERRORif missing). Flags:--state(default open),--label(comma-separated names passed straight through as the APIlabelsparam — no name→id lookup, since the search endpoint takes names),--limit(default 30),--fields. Default output is the locator schema (number,title,state,author,created) underissues:/pull_requests:blocks matching the list commands — search finds the number,issue view/pr viewload the detail.Both variants live in one
src/commands/search.ts, parameterised by aSearchKindconfig (the same config-object dispatch used bypr.ts'sDependencyGroup).Deviations from the plan
None material. Beyond the bare acceptance criteria, added ordinary CLI hygiene consistent with the sibling commands: a
searchgroup help, per-variant--helptext, an unknown-subcommandVALIDATION_ERROR, a too-many-positionals rejection, and top-level-help entries incli.ts.Tests
Fixture-server tests cover both types, cross-repo filtering, the count-line rule, each flag (
--state/--label/--limit/--fields), the empty state, and missing-query validation. End-to-end tests runsearch issuesandsearch prsagainst a live Gitea instance and assert real matches under the locator schema. Full suite: 363 passing; typecheck and build clean.Review
Risk
Overall: LOW
search.ts; only touchescli.tsto register it, no existing callers changed.Unaddressed findings
Standards — 0 violations; Spec — 0 findings. The Standards axis noted two judgement-call nits it deemed correct-by-intent, kept as-is:
helpSuggestionis built inline per-call rather than hoisted to a module-level*_HELP_SUGGESTIONconstant — intentional, because the string is per-kind.formatCountLine's third (atLimit) arg is passedfalseunconditionally — correct, since search always reports the filtered set's own size as the total (ADR 0005), so the at-limit branch never applies.