Skip to content

An open source design system that's fully customizable and agent ready

TypeScript

docs(spec): discover lists the official packages first, from a list built into each release (AST-051) (#7494)

Joey7c0f85086539
diff --git a/docs/specs/AST-051-discover-integration-manager/spec.md b/docs/specs/AST-051-discover-integration-manager/spec.md
index 7839a1ada7..101286c1bf 100644
--- a/docs/specs/AST-051-discover-integration-manager/spec.md
+++ b/docs/specs/AST-051-discover-integration-manager/spec.md
@@ -7,7 +7,7 @@ authority: current
archive_reason: null
superseded_by: null
approved_by: josephfarina
-approved_at: 2026-10-19
+approved_at: 2026-10-20
phase: accepted
owners: [josephfarina]
affects_architecture: [architecture:cli-surface]
@@ -23,21 +23,22 @@ affects_consumer_docs: [cli/integrations]
A person or agent building an Astryx app wants to know which integrations
exist, what each one adds, which ones the app already has, and which versions
are published, without leaving the terminal. `astryx discover` answers that. It
-is the read-only manager for integrations: it lists what the project has and
-what its sources offer, shows each package's versions and what they add, and
-searches and filters all of it. The project's package manager installs,
-updates, and removes packages.
+is the read-only manager for integrations: it lists what the project has, the
+official Astryx packages, and what its sources offer, shows each package's
+versions and what they add, and searches and filters all of it. The project's
+package manager installs, updates, and removes packages.
This record owns what discover shows, where the list of available integrations
-comes from, and what happens when a source cannot be reached. `spec:AST-031`
-owns how named-export features compose; discover sources follow it except where
-this record says otherwise.
+comes from, the official list the CLI carries, and what happens when a source
+cannot be reached. `spec:AST-031` owns how named-export features compose;
+discover sources follow it except where this record says otherwise.
## Non-goals
- Installing, updating, or removing packages. The package manager does that,
and autolink loads a newly installed integration with no discover step.
-- Hosting a catalog, or choosing a built-in public source (OQ1).
+- Hosting a catalog. The official list ships inside each CLI release and is
+ never fetched (FR11).
- How a source signs in. A source runs as the person running the CLI and uses
whatever credentials its host already has. The CLI never prompts
(`architecture:cli-surface` INV1) and reads no Astryx-owned environment
@@ -49,13 +50,19 @@ this record says otherwise.
## Requirements
- **FR1 — The list shows what the project has and what it could add.** With no
- query, discover MUST list every integration the project loads, configured or
- autolinked, with its version, what it adds as one list per kind, and the
- latest release a source knows. It MUST then list, once per integration, every
- package its sources offer that the project neither loads nor declares as a
- dependency, and MUST NOT offer a package whose integration the project has
- under another name. An integration that failed to load is left out; the
- integration-issues warning and Doctor report it.
+ query, and with any query in a project that loads no integration and has no
+ discover source of its own, discover MUST list every integration the project
+ loads, configured or autolinked, and every official package the official list
+ supplies (FR11) that the project's own `package.json`, the nearest one above
+ the folder discover runs in, declares in `dependencies`, `devDependencies` or
+ `optionalDependencies`, under its name or an npm alias, each with its
+ version, what it adds as one list per kind, and the latest release a source
+ knows. It MUST then list, once per integration, every package its sources
+ offer that the project neither loads nor declares as a dependency, each with
+ the package-manager command that adds it (FR2), and MUST NOT offer a package
+ whose integration the project has under another name. Official packages come
+ first in both lists. An integration that failed to load is left out, even an
+ official one; the integration-issues warning and Doctor report it.
- **FR2 — A package page shows its versions and what they add.** `discover
<package>` MUST show what the shown version adds, grouped by kind, whether
the project has the package, its latest release, and its releases newest
@@ -65,7 +72,9 @@ this record says otherwise.
version no source lists MUST fail with `ERR_NOT_FOUND` and suggest releases.
For a package the project does not have, discover MUST print the
package-manager command that adds it, as text, and MUST NOT run it; for an
- alias of a package the project has, it names that package instead.
+ alias of a package the project has, it names that package instead. For a
+ package the official list supplies, that command pins what FR11 names and
+ quotes a range for the shell.
- **FR3 — An item page shows one item.** `discover <package>/<Component>` for an
installed component keeps printing its doc. Any other item a package adds,
installed or listed by a source, MUST resolve to its kind, name, package,
@@ -94,10 +103,11 @@ this record says otherwise.
`discover` field of `astryx.config`, and each loaded integration MAY export
one as its `discover` named export. Every source is called, the project's
first and then each integration's in load order, and the same function runs
- once. A source that throws, exceeds 30 seconds (signalled on `signal`), or
- returns an invalid catalog fails alone: the others still count, and discover
- reports which source failed and why. Sources only read, so `spec:AST-031`'s
- consent gate does not apply to them.
+ once; discover then reads the official list (FR11). A source that
+ throws, exceeds 30 seconds (signalled on `signal`), or returns an invalid
+ catalog fails alone: the others still count, and discover reports which
+ source failed and why. Sources only read, so `spec:AST-031`'s consent gate
+ does not apply to them.
- **FR7 — The catalog shape is versioned.** A catalog is `{schemaVersion: 1,
source, packages}`. `source` has `name`, `generatedAt`, and `complete`. Each
package has `package`, `integration` (shared by every package name that
@@ -116,21 +126,43 @@ source, packages}`. `source` has `name`, `generatedAt`, and `complete`. Each
it was saved. With no saved answer, the source adds nothing and discover says
so. Installed integrations always appear, with or without a source.
- **FR9 — JSON stays compatible.** Existing response types and fields keep their
- meaning; new information is additive. `discover.list` `data` lists installed
- integrations, now every loaded one, with optional per-kind lists and
- `latest`; `meta.available` lists what the project could add and
- `meta.sources` reports each source. `discover.detail` gains `installed` and,
- with a source, `latest`, `aliases`, `source`, `versions`, and `install` or
- `installedAs`. Items other than installed components use the new
- `discover.item` type. `discover.search` matches gain `kind` and `installed`,
+ meaning; new information is additive. `discover.list` `data` lists what the
+ project has (FR1), with optional per-kind lists and `latest`;
+ `meta.available` lists what the project could add and `meta.sources` reports
+ each source, the official list last. `discover.detail` carries
+ `installed` and, with a source, `latest`, `aliases`, `source`, `versions`,
+ and `install` or `installedAs`. Items other than installed components use the
+ `discover.item` type. `discover.search` matches carry `kind` and `installed`,
`component` holds the item name for every kind, and `data.total` appears when
- `--limit` cut the list. A free-text query that used to return
- `discover.detail.doc` now returns `discover.search` (FR4).
-
+ `--limit` cut the list. A free-text query returns `discover.search`, never
+ `discover.detail.doc` (FR4).
- **FR10 — A package can link its docs site.** An integration manifest MAY
set `docsiteUrl`, a URL of the package's docs site, so catalogs that list
the package can link to it. The CLI MUST accept it as a known key, without
an unknown-key warning, and does nothing else with it.
+- **FR11 — The CLI carries the official list.** Each CLI release carries the
+ list of official packages: every package that release publishes that adds at
+ least one item discover lists. The list is generated from the repository when
+ the CLI is built and never edited by hand, and a check fails when it no longer
+ matches the repository. It holds no versions. An entry's latest release is the
+ newest release the CLI knows: its own version on a release CLI, or the
+ project's Core version when that is a newer release. An entry for a package
+ that always releases at Core's version lists a release CLI's own version and
+ the project's Core version, installed or declared exactly, so either can be
+ looked up; its add command pins the project's Core version, else the Core
+ range the project declares, else the latest release, and on a canary CLI in a
+ project with no Core it pins none. Only a canary CLI lists the canary-only
+ packages, as prereleases: at the project's Core version when that is a
+ prerelease, at the CLI's own version when the project has no Core, and not
+ beside a released Core or a Core declared without an exact version, which they
+ cannot be installed with. For a package only the list supplies, a version or
+ item the entry does not list fails with `ERR_UNKNOWN_PACKAGE`. Discover reads
+ the list after every other source, so a source's entry is used (FR7) for an
+ official package it lists and for any official package whose integration it
+ publishes under another name; the list adds the official packages no source
+ covers. Official packages come first in both lists. An official entry reads
+ like any other package, with no section of its own, and names its source
+ `Astryx`.
### Platform support
@@ -154,21 +186,35 @@ source, packages}`. `source` has `name`, `generatedAt`, and `complete`. Each
consent gate (FR6).
- Consumer docs: `cli/integrations` gains the `discover` named export and config
field, and `astryx docs authoring` gains the `discover-source` section.
+- `astryx discover` with no source configured listed only the project's
+ integrations. It also lists the official packages, first, each with the
+ command that adds it, and a declared official package the official list
+ supplies counts as installed from any folder of the project (FR1, FR11). A
+ version or item of a package only the official list supplies that its entry
+ does not list fails with `ERR_UNKNOWN_PACKAGE`, the answer for a package no
+ source lists (FR11).
+ A query in a project that loads no integration and has no source of its own
+ answers with the list, as it does without the official list (FR1).
+- Release: the CLI build generates the official list from the packages the
+ release publishes, and a drift check fails when the committed list is stale
+ (FR11). `astryx docs authoring` `discover-source` says the official list comes
+ before every source.
## Verification
-| Contract | Verification | Representative states | Mutation or failure expectation |
-| -------- | -------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
-| FR1 | list leaf, catalog view, command tests | installed only; available only; both; latest known; alias of an installed package; declared dependency | an available package is missing, an alias or declared package is offered, or latest is absent |
-| FR2 | detail leaf and command tests | installed; not installed; `@version`; prerelease; unpublished version; alias | a version is dropped, the default is wrong, the add command runs, or an alias is offered |
-| FR3 | item leaf and dispatcher tests | installed component; installed template; listed item; unknown item | an installed component loses its doc, or a listed item is not found |
-| FR4 | search leaf and command tests | components, templates, docs, packages; installed and available; title and summary matches; an exact installed name; a single match | a kind is not searched, installed state is wrong, a weak match ranks first, or a free-text query returns a doc instead of the list |
-| FR5 | dispatcher, leaf, and command tests | each kind; `--installed`; `--available`; both; `--limit`; bad values | a filter is ignored, the pair is accepted, or a bad value passes |
-| FR6 | adapter source tests | project and two integrations; a shared function; a throw; a timeout; invalid data | a failure hides other sources, a function runs twice, order changes, or the signal never aborts |
-| FR7 | catalog schema tests | unknown field; unknown kind; `schemaVersion: 2`; duplicate package across sources; misordered versions | an unknown field fails, another version is accepted, the later source wins, or versions keep the source order |
-| FR8 | adapter saved-copy and command tests | fresh answer; failure with a saved copy; failure with none; another request | a stale copy hides a fresh answer, the saved date is missing, or a project file is written |
-| FR9 | existing discover JSON tests | each response type with and without a source | an existing field changes type or meaning |
-| FR10 | manifest parser and validate tests | no field; a URL; a value that is not a URL | the key raises an unknown-key warning, or a valid URL is refused |
+| Contract | Verification | Representative states | Mutation or failure expectation |
+| -------- | -------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| FR1 | list leaf, catalog view, adapter, command tests | installed only; available only; both; latest known; alias of an installed package; declared dependency; declared official package; official and other packages together; a query in a project with no integration and no source of its own | an available package is missing, an alias or declared package is offered, latest is absent, a declared official package is not installed, an official package does not come first, or that query does not answer with the list |
+| FR2 | detail leaf, adapter, and command tests | installed; not installed; `@version`; prerelease; unpublished version; alias; official entry with and without Core | a version is dropped, the default is wrong, the add command runs, an alias is offered, or an official entry's add command is not pinned |
+| FR3 | item leaf and dispatcher tests | installed component; installed template; listed item; unknown item | an installed component loses its doc, or a listed item is not found |
+| FR4 | search leaf and command tests | components, templates, docs, packages; installed and available; title and summary matches; an exact installed name; a single match | a kind is not searched, installed state is wrong, a weak match ranks first, or a free-text query returns a doc instead of the list |
+| FR5 | dispatcher, leaf, and command tests | each kind; `--installed`; `--available`; both; `--limit`; bad values | a filter is ignored, the pair is accepted, or a bad value passes |
+| FR6 | adapter source tests | project and two integrations, then the official list; a shared function; a throw; a timeout; invalid data | a failure hides other sources, a function runs twice, order changes, or the signal never aborts |
+| FR7 | catalog schema tests | unknown field; unknown kind; `schemaVersion: 2`; duplicate package across sources; misordered versions | an unknown field fails, another version is accepted, the later source wins, or versions keep the source order |
+| FR8 | adapter saved-copy and command tests | fresh answer; failure with a saved copy; failure with none; another request | a stale copy hides a fresh answer, the saved date is missing, or a project file is written |
+| FR9 | existing discover JSON tests | each response type with and without a source | an existing field changes type or meaning |
+| FR10 | manifest parser and validate tests | no field; a URL; a value that is not a URL | the key raises an unknown-key warning, or a valid URL is refused |
+| FR11 | official list generator, drift test, adapter and command tests | stable and canary CLI; Core older and newer than the CLI; Core declared exactly, as a range, and as a path; canary Core; no Core; private package; package that adds nothing; theme folder that does not match its file; empty folder; subfolder; another source lists an official package or its integration | a private or empty package is listed, an unreadable theme package is skipped, the committed list drifts from the repository, latest is older than a release the CLI knows, the project's Core version cannot be looked up, a declared range is not pinned or not quoted, a canary-only package shows on a stable CLI or beside a released Core, an official entry replaces a source's entry for the same integration, or a version it does not list fails with another code |
## Decision log
@@ -184,15 +230,16 @@ not have, it prints the command that adds it.
Rejected: `discover add`, `update`, and `remove` subcommands; running the
package manager from discover.
-### DEC-2 — Available integrations come from sources, not from the CLI
+### DEC-2 — Other integrations come from sources
**Reference:** `spec:AST-051/DEC-2`
**Decider:** `josephfarina`, `2026-09-30`
-A project or an integration provides a source as a function, and discover
-merges every source. A catalog host that needs sign-in works through the
-function, which runs with the credentials its host already has, and a project
-can add or replace what it reads without a CLI release.
+Beyond the official list (DEC-5), a project or an integration provides a source
+as a function, and discover merges every source. A catalog host that needs
+sign-in works through the function, which runs with the credentials its host
+already has, and a project can change what its sources list without a CLI
+release.
Rejected: a catalog URL built into the CLI, which ties the public CLI to one
host; a source given as a URL for the CLI to fetch, which cannot sign in to a
@@ -225,8 +272,26 @@ Rejected: keeping the earlier shortcut, where an exact or only
installed-component match opened that component's doc. The same query then
returned a doc or a list depending on what the project and its sources held.
+### DEC-5 — The official list is built into each release and read last
+
+**Reference:** `spec:AST-051/DEC-5`
+**Decider:** `josephfarina`, `2026-10-13`
+
+Official packages change only when Astryx releases, so a list built into each
+release is as current as the packages that CLI works with. It works offline and
+in an empty folder, and it asks for no more trust than the CLI itself. Discover
+reads it after every other source, so a project or an integration keeps the
+entry its own source gives an official package, and the list fills in the
+rest. Official packages still come first in the lists and read as part of them.
+An entry keeps the newest release the CLI knows as its latest, so an update
+check still sees it, and also lists the version that fits the project, which its
+add command pins; both can be looked up.
+
+Rejected: reading the list before the other sources, which replaces the entry
+a project's or an integration's source gives; searching the package registry at
+run time, which needs the network and cannot tell what a package adds without
+running its code.
+
## Open questions
-- **OQ1 — A built-in public source** (`human-design`). Whether discover ships a
- built-in source for a public catalog, and whether a project source adds to it
- or replaces it. Until this is decided, discover has no built-in source.
+None.