Repository navigation
feat(cli): astryx discover browses the integrations you have and could add - #6802
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
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 Regression11 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 |
There was a problem hiding this comment.
Thanks for building this out with docs, tests, and a changeset. I am holding approval for one maintainer decision, plus two smaller fixes worth doing in the meantime.
Maintainer decision needed first. This adds a new capability — browsing integrations a project could add through discover sources, with the versioned catalog, the saved per-user copy, the new filter options, and the discover config field and named export — and proposes it in a new draft spec for owner approval. No current spec governs that capability yet, so approval needs a maintainer to provide or identify the governing spec for this addition (for example, approving the proposed record as current, settling the source trust, catalog, cache, and option behavior it describes). I have asked that question on the PR; nothing needs to be removed or split for this reason alone.
Scope. The change is 3,347 verified changed lines. Before approval, please either split it into reviewable parts or show why it has to land as one inseparable capability. This stays required after the spec question is settled.
One behavior fix. When a search term exactly names an installed component but also matches something else (another kind or an available item), discover should return the match list, keeping the direct document only when nothing else matches. Right now the exact name returns the document immediately, so the other matches are never shown. A test with an overlapping name would lock this in.
Worth checking too: version lists are shown as newest first in the order the source returns them, with no sort or check — a misordered catalog would display the wrong order and default.
[Automated review]
| if (!target.version && !target.item && only !== 'available') { | ||
| const exact = findComponent(packages, query); | ||
| if (exact && (type == null || type === 'component')) { | ||
| return await docFromResult(exact, {lang, zh}); |
There was a problem hiding this comment.
This exact-name shortcut returns the component document before any source or other-kind match is considered. When the same term also matches a template, doc, package, or available item, those matches are never shown. Please keep the direct document only when nothing else matches, and add a test with an overlapping name.
2db03b8 to
102aca3
Compare
|
Pushed 102aca3 with the two fixes from the automated review.
The spec question and the size question are still open. |
There was a problem hiding this comment.
Thanks for the follow-up push — both behavior fixes land well. Approval is still held for one maintainer decision, plus two corrections.
Maintainer decision needed first. This adds a new capability — browsing integrations a project could add through discover sources, with the versioned catalog, the saved per-user copy, the new filter options, and the discover config field and named export — and proposes it in a new draft spec for owner approval. No current spec governs that capability yet, so approval needs a maintainer to provide or identify the governing spec for this addition (for example, approving the proposed record as current, settling the source trust, catalog, cache, and option behavior it describes). That question is already open on this PR; nothing needs to be removed or split for this reason alone.
Scope. The change is 3,518 verified changed lines. Before approval, please either split it into reviewable parts or show why it has to land as one inseparable capability. This stays required after the spec question is settled.
One test fix. The saved-copy test fails on macOS: it expects the saved answer under the redirected Linux cache directory, but on macOS the cache lives under ~/Library/Caches, so the expected directory never appears and the focused suite is red there (1 failed, 134 passed in this review's run). Please make the test compute the expected location per platform, or make the code honor the redirected location in tests.
Fixed in this revision. Versions are now sorted newest first by publish time whatever order a source sends, with a misordered-catalog test. The exact installed component name keeps opening its doc as it does today, and the proposal and function docs now match the code on that, so existing calls keep their response type.
[Automated review]
102aca3 to
86e0c4c
Compare
|
/approve-spec 86e0c4c |
|
Pushed 86e0c4c.
On the size. This is one capability, the read-only browser AST-051 describes, and every file in the diff serves it.
None of the parts does anything on its own. Every view reads the same source contract, and the contract only makes sense next to the views that read it. A split would leave main with half a manager for at least a release, like sources you can list but not search or open. There's no cleanup or unrelated change in here. |
There was a problem hiding this comment.
Thanks for the follow-up push — this is ready from my side.
The spec question is settled for this revision: the governing record is now approved through the repository's owner-approval gate, so the discover manager, its source contract, the saved per-user copy and the new filter options all have an established home. Nothing needs to be removed or split for that reason.
On scope, the breakdown you posted lines up with what I could verify — tests are the largest part, and the rest is the source contract, the adapter and views, the leaves and handler, and docs, all serving the one capability — so I am comfortable with it landing as a single inseparable change rather than asking for a split.
The remaining fixes also land well: a free-text query now consistently lists its matches, even for an exact component name, with the package path opening a single item; versions are sorted newest first whatever order a source sends; discover.item is in the manifest; and the saved-copy test works out the cache folder per platform. I reran the focused discover tests on macOS and the full CLI suite from the repo root, and both pass.
One heads-up for callers in the release notes: because free-text search now always returns the list, scripts that opened a component with a bare name should use the package path form instead.
[Automated review]
Asking for an item that a source's package doesn't list said the whole package wasn't found. Now it says the item isn't in that package and suggests close names.
|
Round 3. Running every command against a real catalog turned up one bug. Asking for an item that a source's package doesn't list said the whole package wasn't found. Now |
|
/approve-spec 63c95bc |
User need
astryx discoveronly shows the integrations an app already has, and only the ones with components. There's no way to see what else exists, what a package adds, or which versions are out. So people and agents hand-roll things an integration already ships.Problem and solution fit
Discover becomes a read-only manager for integrations.
astryx discoverlists what you have, then what you could add.astryx discover <package>shows what it adds, every release, and the install command to copy.<package>@<version>shows any version.astryx discover <words>searches every kind of item (components, templates, docs, themes, codemods, agent docs) in what you have and in what sources list.--type,--installed,--availableand--limitfilter it.discoverinastryx.config, or an integration exports as adiscovernamed export. A team with a private registry plugs it in and the CLI never has to know where it lives.It never installs anything. The package manager does that, and autolink already loads a new integration.
Current specification
spec:AST-051, added here and approved as current. The new options followspec:AST-042FR4 and FR5. The named export followsspec:AST-031without the consent gate, since sources only read.Public delta and caller burden
astryx discover <package>@<version>andastryx discover <package>/<item>for every item kind, with a new JSON typediscover.item.--type <kind>,--installed,--available,--limit <n>.--installedwith--availableis refused withERR_INVALID_OPTION.discoverinastryx.configand thediscovernamed export, typed asDiscoverSourcefrom@astryxdesign/cli/authoring, plusparseDiscoverCatalog. Documented inastryx docs authoring discover-sourceandastryx docs cli/integrations.Existing JSON fields keep their meaning and new data is additive (
meta.available,meta.sources, per-kind lists,installed,latest,versions, andkindandinstalledon search matches). Three things behave differently.discover.listdatanow lists every loaded integration, not only the ones with a components root. One with no components showscomponents: [].discover Buttonused to open Button's doc. Now it lists every Button match across all packages, anddiscover @acme/ui/Buttonopens it (DEC-4).A source's last good answer is saved in the per-user cache (
XDG_CACHE_HOMEor~/.cache,~/Library/Caches,LOCALAPPDATA), never in the project. No new env vars. Without a source nothing new shows up and callers decide nothing new.Design and alternatives
Sources are functions, not URLs. A URL can't sign in to a private registry unless the CLI handles credentials, and a URL built into the CLI ties the public CLI to one host (DEC-2). No
discover addeither. Installing is the package manager's job (DEC-1). A free-text query always lists, so the same query never flips between a doc and a list depending on what's installed (DEC-4). Whether the CLI ships a built-in public source is left open (OQ1).Evidence
A demo app with one installed integration and a source that lists three packages.
Scope
Testing
pnpm exec vitest run packages/cli5522 passed, pluspnpm -F @astryxdesign/docsite generate && pnpm -F @astryxdesign/docsite testpnpm -F @astryxdesign/cli typecheck:strictnode .github/scripts/cli-api-types-verify.mjspnpm check:repo