Repository navigation
fix(cli): print every search result field in the text view - #6527
Conversation
The search text view never printed `title` on doc results or `kind` on template results, although both are in every JSON result. Add them to both views, add the missing per-domain contract test, and say what --verbose adds.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression23 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
and 3 more. Generated by PR Enrichment workflow | View full report |
There was a problem hiding this comment.
This change restores the documented astryx search text view: doc results now print their title and template results print their kind (page or block) in both the plain and --verbose views, so text readers no longer need --json to tell a page template from a block or to see a doc topic's title. The --verbose help now correctly says the flag adds each result's score and match reason, and the search API description lists the per-domain fields (import, title, displayName, kind) alongside the shared ones.
The new contract tests compare the text views against the --json envelope across all four search domains and assert the per-domain fields at the API level; the CLI structure, generated README, and JSON-API type checks pass, and the patch changeset correctly treats this contract restoration as nonbreaking. JSON output, ranking, and exit behaviour are unchanged. No blocking findings.
[Automated review]
User impact
astryx searchtext output dropped two fields its--jsonresults carry:titleon doc results andkind(pageorblock) on template results. A reader of the text view could not tell a page template from a block, or see a doc topic's title, without switching to--json, even under--verbose. The--verbosehelp also misdescribed the flag ("include import paths and match reason"), although import paths always print and--verboseadds the score and the match reason.After this change every result field prints under its JSON key, and
--verbosesays what it adds.Problem and solution fit
titleandkindjoined the result entries.The fix adds the two fields to both text views (default and
--verbose) in the entry's own field order, adds contract tests for the per-domain entry fields, and corrects the function and flag docs that describe them.Expected behavior and authority
docs/specs/AST-017/spec.md(authority: current), FR13:DEC-4: "Keep its canonical type, contract tests, applicable text output, and complete consumer documentation aligned in the same change."
docs/architecture/cli-surface.md(authority: current), INV4 and INV5: human output is a projection of the JSON, and text field names mirror JSON keys one to one.Smallest restoration
clients/cli/commands/search.mjs:titleandkindjoin the default and--verbosefield lists;record()still skips fields a result does not carry.api/search/search.doc.mjs: thesearchreturn description listsimport,title,displayNameandkindand the domains that carry them.clients/cli/commands/search.doc.mjs:--verboseis described as "Also print each result's score and match reason", which is what it does.spec:AST-017): text output is not a machine-readable schema; the change restores the documented projection (FR5). Patch.Evidence
astryx search theme --limit 60 --verboseshows notitle:line for any doc result and nokind:line for any template result, whileastryx --json search theme --limit 60carries"title"on every doc result and"kind"on every template result.title: <Title>and each template result printskind: pageorkind: block, in both views.--jsonoutput are unchanged.clients/cli/commands/search.test.mjs("prints every result field under its JSON key") compares the text views with the--jsonenvelope for a query that reaches all four domains. It fails on main attitle; removing onlykindfrom the default view fails it atkind.api/search/search.test.mjs("per-domain result fields") adds the missing contract test forimport,title,displayNameandkind.Scope
Testing
All green: api-dts
tscexit 0,check:cli-structure,readme:check(tables unchanged),typecheck:json-api, strict ESLint (0 errors) andcheck:repopass; the CLI suite is 270 files passed / 1 skipped, 4300 tests passed / 5 skipped (main: 4298 passed; the 2 added tests account for the difference).