Repository navigation
feat(cli): support multi-component lookups - #6867
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
edc7e21 to
bc52f8c
Compare
There was a problem hiding this comment.
Thanks for putting this together — the batch lookup itself reads cleanly: one ordered receipt, duplicates kept, failures shown per selector before the nonzero exit, and the existing zero/one-selector responses untouched. The focused tests for ordering, projections, ambiguity, exact versions, the all-fail case, and text/JSON exit behavior look solid.
Approval needs one maintainer decision first. The new batch contract — the component.batch receipt, its found / not_found / ambiguous / error rows, exact package-version selectors, and exit-after-receipt behavior — is currently recorded only in the new draft spec AST-053, which is marked as a draft with no approver yet and is not part of the current spec on main. The current CLI spec covers programmatic parity, documentation, and the shared text vocabulary, but it doesn't yet authorize this batch contract.
Could a maintainer please provide or identify the governing spec for this addition — for example by approving AST-053 (or pointing to an equivalent current record) — so the contract has a settled home? Once that is in place, this should be straightforward to re-review. No code changes are being asked for on this point alone.
[Automated review]
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression14 of 420 shot(s) changed. A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
bc52f8c to
ef5d355
Compare
There was a problem hiding this comment.
Thanks for putting this together — the batch lookup itself reads cleanly: one ordered receipt, duplicates kept, failures shown per selector before the nonzero exit, and the existing zero/one-selector responses untouched. The focused tests for ordering, projections, ambiguity, exact versions, the all-fail case, and text/JSON exit behavior look solid, and the governing spec question from earlier is now settled.
A few corrections are needed before this can merge:
- Please add the documented aggregate work bound the current batch spec requires: define a finite limit that safely accepts at least two selectors in every mode, reject requests beyond it before any lookup runs (top-level invalid-argument error, exit 1, no partial batch), and cover that oversized case in the API and CLI tests. Right now a batch of any size is accepted.
- Please move the batch shape onto the shared response types the spec names: the shared CLI response foundation should own and publish
BatchResponseandBatchRow, with the component types specializing them, instead of only defining a component-local batch typedef. The wire format itself does not need to change. - Please rebase onto current main and regenerate the overlapping generated surfaces (README, manifest, response types, and doc routes) rather than hand-merging them, then rerun the focused component, manifest, docs, and search tests.
Once those are in, this should be straightforward to re-review.
[Automated review]
ef5d355 to
08c6367
Compare
There was a problem hiding this comment.
Thanks for putting this together — the batch lookup reads cleanly: one ordered receipt, duplicates kept, failures shown per selector before the nonzero exit, and the existing zero/one-selector responses untouched.
The multi-selector contract now has a settled home in the current spec, and this revision covers the pieces that were still open before: a documented limit of 100 selectors that is refused before any lookup runs (with no partial receipt), the shared batch response and row types owned by the response foundation with the component types specializing them, and generated help, manifest, response-type, and guide surfaces that all agree. The focused coverage for ordering, duplicates, projections, ambiguity candidates, exact package versions, empty and one-item arrays, all-fail receipts, oversized rejection, and matching JSON/text exit behavior looks solid.
I did not find a concrete defect that needs a code change. Approving from my side — a final human read of the new response type, selector grammar, and exit behavior is still worthwhile, since that surface becomes permanent public API once it ships.
[Automated review]
Main's #6867 changed the generated README tables, so this takes main's README; the tables are regenerated in the next commit. The CLI blog post told readers that `astryx layout` sketches a page from an expression, and `astryx blog` serves that post to agents from the published feed, so the sentence goes with the command.
Take main's component command docs for the new batch-lookup behavior (#6867); keep the integration-docs test suite deleted (bcc68ed) — batch coverage arrives via main's new component-batch.test.mjs; regenerate README. Co-authored-by: Cursor <[email protected]>
User need
Agents often know several components they need to inspect. Running one CLI process per component repeats setup work and makes partial failures easy to miss. They should be able to ask once and get one complete result.
Problem and solution fit
astryx component Button Badge Textnow accepts ordered exact selectors. It keeps duplicates, resolves every selector, and returns every success or failure before it exits. Existing detail controls like--props,--source,--showcase,--blocks,--detail,--lang,--zh,--dense, and--packageapply to each selector.astryx discoveris unchanged. It still treats its arguments as one free-text query.Current specification
spec:AST-053is current. The component contract landed in #6868, and the eligible-lookup contract was generalized in #6871. It owns complete ordered receipts, duplicate preservation, the sharedBatchResponseandBatchRowvocabulary, aggregate work bounds, ambiguity, and exit 1 when any row is unresolved.spec:AST-042requires every admitted exact selector to be classified against AST-053.Public delta and caller burden
Before:
After:
component.list.component.batchwith{count, results}.found,not_found,ambiguous, orerror.package/Component,@scope/package/Component, and exact package versions such as@scope/[email protected]/Component.ERR_INVALID_ARGUMENTbefore any component resolves, with no partial receipt.The API uses input shape, not array length.
component()browses,component('Button')returns one result, and every array returnscomponent.batch, includingcomponent([])andcomponent(['Button']). A found row contains the same typed result that one selector would return. The public API exports sharedBatchResponseandBatchRowtypes, andComponentBatchResponsespecializes them.Real output
These are exact stdout receipts from this head.
Two found components, exit 0
Exit 0.
One found and one missing, exit 1 after the full receipt
Exit 1.
All missing as JSON, exit 1 after both rows
{ "apiVersion": 1, "type": "component.batch", "data": { "count": 2, "results": [ { "selector": "MissingWidget", "status": "not_found", "code": "ERR_UNKNOWN_COMPONENT", "error": "No component named \"MissingWidget\"" }, { "selector": "MissingPanel", "status": "not_found", "code": "ERR_UNKNOWN_COMPONENT", "error": "No component named \"MissingPanel\"" } ] } }Exit 1.
Duplicate selectors stay duplicate rows, exit 0
Exit 0.
Empty programmatic batch
{ "type": "component.batch", "data": { "count": 0, "results": [] } }The searchable guide is available through
astryx docs cli/component-lookups.astryx search 'look up several components' --type docreturns that guide first.Design and alternatives
I kept the old zero and one selector CLI contracts instead of always returning an array. I also kept lookup separate from discovery, preserved input order and duplicates, and made ambiguity explicit instead of guessing a package. Arrays always mean batch in the API so filtering a list can't silently change its response type.
Evidence
--props,--source,--showcase, and--blocksacross every found row.full,compact,brief,en,dense,--zh, and--dense.--packageconflicts.BatchResponseandBatchRowexports are verified through the packed public API.cli/component-lookupsdocument the surface.Scope
Testing
typecheck:strict,typecheck:json-api,typecheck:authoring, andtypecheck:template-docspassed.pnpm check:repo,pnpm check:changesets, generated README checks, formatting, and the public-boundary scan passed.