Skip to content

Make every doc type's published type, load check, and authoring docs agree - #6492

Merged
josephfarina merged 7 commits into
mainfrom
docs/seal-doc-types
Sep 24, 2026
Merged

josephfarina merged 7 commits into
mainfrom
docs/seal-doc-types

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Primary intent

The doc contract contradicts itself. For the nine authored doc kinds, the published TypeScript type, the load check (parseDoc), and the authoring reference (astryx docs authoring) each describe a different valid doc. This PR makes the three agree, kind by kind, without making any doc that loads today fail. No narrower template fits: the fix spans types, load checks, tests, and the docs that describe them, all for that one reason.

User or maintainer impact

  • An author who follows the published type could write a doc that fails to load. A stamped component doc that documents several components (type: 'component' with components) is a valid ComponentDoc, but it failed with "props: expected array".
  • An author who follows astryx docs authoring could use fields and blocks that fail to load. placement, aliases, audience, the workflow, collection and reference blocks, and namespace docs were documented as working, but the docs graph that reads them is not built yet.
  • Where loading is looser than the type (older docs without a displayName, templates with their own category), nothing said so, and nothing stopped the type and the load check from drifting further apart. Only the namespace doc and the content blocks were locked.
  • The typed examples that existed were typechecked only by a script CI does not run.

Problem and solution fit

  • astryx docs authoring says which docs-graph features are not built yet: placement, aliases and audience; the workflow, collection and reference blocks; namespace docs; and the artifact, doc and instance identities. A namespace doc in a docs directory now fails with a message that names it. A test ties the documented not-yet-read fields to the loader's rejected list.

  • Typed example docs for all nine kinds, in JSDoc and satisfies form, under packages/cli/test/authoring-types. A test proves each one loads, and the strict typecheck that CI runs now covers them.

  • A stamped component doc may use components instead of props, as ComponentDoc allows.

  • Every kind's load check is locked to its published type at compile time (_*DriftLock in authoring/doctypes/_schema.mjs and template/parse.mjs), along with the list of kinds and HookDoc being a FunctionDoc. Drift in either direction fails the strict typecheck and the API-types build. Where the loader is deliberately looser than the type, the lock names it instead of hiding it:

    • a stamped component doc loads like an unstamped one (no displayName needed; usage, theming, playground and examples unchecked), so stamping an existing doc never breaks it;
    • a stamped function doc may leave out displayName, and its usage is unchecked;
    • a stamped generic doc may leave out title, description and sections, as v0.3.0 codemod output does; the parser fills them;
    • a template may leave out displayName and aspectRatio and use its own category, as published integration templates do.
  • The unknown-field policy is published in astryx docs authoring: component, function, generic, schema, command and enum docs accept a field they do not know; page, block and namespace docs refuse one, as do sections and content blocks everywhere. A test checks the published text against the loader.

  • The published authoring types resolve for a project that uses "moduleResolution": "nodenext" or has no Node types: relative imports in the shipped type files name their files, and PostCodemodCommand's env no longer needs NodeJS.ProcessEnv. cli-api-types-verify.mjs now type-checks the packed authoring surface both ways, and undoing either fix fails it. It also gives its scratch consumer a package.json: the scratch area sits inside packages/cli, so the consumer had been resolving @astryxdesign/cli to the workspace sources through package self-reference and never read the tarball it extracted.

  • astryx docs authoring matches the published types field for field. A new test type-checks each authoring self-doc against the TypeScript type it describes: every field is listed, every listed field exists, each documented type is the field's real type, and each required flag matches. Nested fields and a function's parameters are checked too. It found three wrong entries, now fixed: a component doc's usage is optional on sub-component docs, a command option's default may also be a boolean or a list, and a codemod's type is 'code' or 'config'.

  • Review fix: each entry in a stamped group doc's components must be an object with a non-empty name. null, a number, or a nameless object now fails at load instead of later in a reader; name-only references and full entries still load.

Rebased onto main after #6484 merged; no conflicts.

No published type changes shape, and no doc loads differently, except the grouped component doc above, which now loads. Tightening a looser load check (for example checking a stamped component's usage) would reverse the existing decision that stamping a doc never breaks it, so it is left out of this PR.

Authority

The types exported from @astryxdesign/cli/authoring and @astryxdesign/cli/doc are the authoring contract, and parseDoc is its load boundary. authoring/_shared/contract.ts already pinned the namespace doc and the content-block union to their schemas; this PR extends that to every kind. authoring/doctypes/parse.test.mjs records the decision that stamped component docs stay as permissive as unstamped ones.

Change and evidence

  • Before: the grouped component example fails to load; astryx docs authoring documents placement while a topic that sets it fails with "requires the compiled graph reader"; only 2 of 9 kinds were locked; breaking a typed example changed no CI result.
  • After: every typed example loads; every kind is locked; the docs name what is not built yet and where loading is looser than the type.
  • Mutation-sensitive proof: 14 mutations, each applied alone, all fail the typecheck. They include a required schema field made optional, a type gaining a required field, field type changes in a schema and in a type, the kind list losing or gaining a member, a command option's default union losing a member, and HookDoc no longer being a FunctionDoc.
  • The field test fails when a type gains a field its self-doc does not list, when a documented type or required flag is wrong, or when a documented field does not exist (7 mutations, all caught). Reverting the group-entry check fails both its load test and the compile-time lock.
  • Unchanged: every existing doc in this repository still parses (the docs drift check covers all of them).

Scope

  • This PR has one primary intent.
  • Independently removable deltas were removed or split. The packaged-types fix (the last two commits) could stand alone; it is here because it is the same contract failing for consumers.
  • Public text and artifacts contain no internal Meta context.

Testing

  • Full CLI suite on main with this PR: 270 files, all passing.
  • node .github/scripts/cli-api-types-verify.mjs: the packed package type-checks for the existing strict consumer and for the authoring surface with nodenext and with no Node types.
  • tsc --project with tsconfig.strict.json, tsconfig.api-dts.json, tsconfig.authoring-contract.json, tsconfig.template-docs.json and tsconfig.json-api.json.
  • node scripts/check-changesets.mjs, check-cli-structure.mjs, check-knowledge.mjs, the CLI README check, and eslint and prettier on every changed file.

@vercel

vercel Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
astryx Ready Ready Preview Sep 24, 2026 12:54am UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 23, 2026
@astracat-bot

astracat-bot Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
⏳ Waiting for review (for maintainers only) Sep 24, 2026, 1:17 AM UTC

@astracat-bot astracat-bot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tightening the doc contract — stamped multi-component docs loading, the honest “not built yet” authoring guidance, typed examples covered by the strict typecheck, and the packaged types resolving under nodenext all move this in the right direction.

One correction is needed before approval:

  • The stamped component schema accepts any components entry (z.array(z.unknown())), so entries such as null, a number, or an object without a name pass parseDoc even though the published ComponentDoc type requires each entry to be a ComponentEntry or ComponentRef with a string name. Downstream rendering dereferences those entries, so a malformed entry fails later instead of at load. Please validate at least that shared entry shape (passthrough object with a non-empty string name) and add a load test for malformed entries, while keeping name-only refs and full entries working.

Everything else in the shipped scope checked out, including the loader-tied authoring-docs tests and the typed-example load coverage.

[Automated review]

`astryx docs authoring` described placement, aliases and audience, the
workflow, collection and reference blocks, namespace docs, and the artifact,
doc and instance identities as working. A topic that uses any of them fails to
load today. The docs now say so, a test ties that text to the loader's
rejected fields and blocks, and a namespace doc in a docs directory fails with
a message that names it.
Every authored doc kind now has a JSDoc example and a `satisfies` example
under test/authoring-types. A test proves the CLI loads each one, and the
strict typecheck (which CI runs) now covers them, so an example that stops
matching its published type fails the build. Only NamespaceDoc had examples
before, and they were typechecked only by a script CI does not run.

The examples take part in the docs drift check's parse step but not its
cross-references: they document no real command or function.

Writing them found one mismatch: a stamped component doc that documents
several components (`type: 'component'` with `components`) matches the
published ComponentDoc type but failed to load, because the load check
required `props`. It now takes `props` or `components`.
Every authored doc kind now has a compile-time check that its load check and
its published type agree: component, function, generic, page, block, schema,
command and enum join namespace and the content blocks, along with the list of
kinds itself and HookDoc being a FunctionDoc. Drift in either direction fails
the strict typecheck and the API-types build.

Where the loader is deliberately looser than the type, the check names it
instead of hiding it:
- a stamped component doc loads like an unstamped one (no displayName needed;
  usage, theming, playground and examples unchecked), so stamping an existing
  doc never breaks it;
- a stamped function doc may leave out displayName, and its usage is unchecked;
- a stamped generic doc may leave out title, description and sections, as
  v0.3.0 codemod output does; the parser fills them;
- a template may leave out displayName and aspectRatio and use its own
  category, as published integration templates do.

No load behavior changes. `astryx docs authoring` now says all of this and
states which kinds accept fields they do not know; tests pin the looser
behavior and check the published policy against it. Fourteen mutations to the
types, the schemas and the kind list each fail the typecheck.
… Node types

Relative imports in the shipped authoring type files, and in the declarations
generated from them, had no file extension. nodenext resolution refuses those,
so a project using it could not type-check against @astryxdesign/cli/authoring,
/doc, /config, /integration, /codemod, /debug or /template. They now name the
file.

PostCodemodCommand's env was typed as NodeJS.ProcessEnv, which fails in a
project without @types/node. It is now the equivalent
Record<string, string | undefined>.
…them

cli-api-types-verify.mjs now also type-checks the authoring surface of the
packed package with nodenext resolution and with no Node types installed.
Undoing either fix in the previous commit makes it fail.

It also gives its scratch consumer a package.json. The scratch area sits
inside packages/cli, so without one the consumer resolved @astryxdesign/cli
to the workspace sources through package self-reference, and the check never
read the tarball it had just extracted.
A new test type-checks each authoring self-doc against the TypeScript type it
describes: every field of the type is listed, every listed field exists, each
documented type is the field's real type, and each required flag matches the
type. Nested fields and a function's parameters are checked the same way.
Graph fields may be left to the graph-fields self-doc.

It found three wrong entries, now fixed: a component doc's `usage` is optional
on sub-component docs, a command option's `default` may be a boolean or a list
too, and a codemod's `type` is 'code' or 'config' (its transform's file and
api fields are all required). Adding a field to a type without documenting it,
or documenting the wrong type or required flag, fails the test.
A stamped group doc's `components` accepted anything, so an entry that was
null, a number, or an object without a name loaded and then broke the reader
that looks entries up by name. Each entry must now be an object with a
non-empty `name`; the rest of the entry passes through, as on an unstamped
doc. Name-only references and full entries still load. The load contract's
exception list and the component docs say so, and a test covers the malformed
shapes.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
@josephfarina
josephfarina merged commit 89c4819 into main Sep 24, 2026
34 checks passed
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
@github-actions
github-actions Bot deleted the docs/seal-doc-types branch September 24, 2026 06:23
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.
josephfarina added a commit that referenced this pull request Sep 24, 2026
…iptors (#6498)

* Keep a topic's title when an integration extends it

`mergeTopic` took the extension's title and description whenever it stated
them, and every extension has to state both, so extending a topic renamed it:
with an integration extending `theme` installed, `astryx docs theme` printed
the extension's title instead of "Theme System". An extension now adds or
replaces sections and leaves the title and description alone. A topic that
`replaces` another still renames it. The authoring reference and the
integration guide say so, and tests cover both relationships.

* Author integration themes with typed descriptors

Rebuilds draft PR #6315 on the doc types from #6471 and #6492. Every theme
now ships a strongly typed same-stem `ThemeDoc` beside its source instead of
an entry in a central `themes/manifest.json` catalog, which was only ever in
canary. Theme discovery reads the descriptor, derives the source entry and
runtime export from the shared stem, parses the source without running it,
and keeps each theme directory together when it copies and packs it. New
component, topic, and template scaffolds emit typed `.doc.mjs` files;
released `.doc.ts`, `.doc.js` and `.template.*` inputs still load.

On top of #6315 as it stood:
- `ThemeDoc` joins the typed examples, the authoring self-docs and their
  field test, and the lock list; its relative imports name their files so
  the packed types still resolve under nodenext.
- The integration guide keeps #6290's palette detail (the request, the
  candidate and its receipt) and drops the catalog steps. Its drift test now
  checks the ThemeDoc fields and that the documented theme directory is
  exactly what discovery ships; `theme palette generate` no longer tells
  authors to list files in a catalog.
- The spec draft moves from AST-035 to AST-039, because #6265 already uses
  AST-035. That is bookkeeping, not a resolution: the two drafts describe
  overlapping rules, and which one governs is still undecided.

* Give every doctor integration warning its fix

`astryx doctor integration validate` already finds a contribution no root
reads, a codemod outside a version folder, a mis-named codemod folder, a
component source with no doc, and a doc with no source. It said what was
wrong and left the author to work out the fix. Each message now ends with it:
the root that reads the file (or the exact manifest line to declare its folder
as one), the version folder a codemod belongs in, or the file to add. A theme
descriptor's fix names the folder above its theme directory, since that is
the themes root. Codemod paths are shown relative to the package, not as
absolute paths.

* List every authored descriptor once, as compiler input

The doc compiler only saw reference topics. `collectDocInputs` lists every
descriptor a project reads, whatever root it comes from: components, hooks,
templates, themes, doc topics and their extensions, and the CLI's own
self-docs. Each input records the root that reads it, the name a reader asks
for, the package that contributes it, and where the file ships
(`<package>/<path>`), so nothing machine-specific reaches a compiled node.
Nothing reads the list yet; the next slices compile it.

A new test is the completeness check for what this repo ships. Every
`.doc.mjs` under Core's source and every directory the CLI's package.json
ships must be read exactly once, and nothing else may be. Mutating the list
(dropping hooks, unlisted docs, extensions, or a self-doc tree; keying
templates by title; skipping the duplicate check) fails it.

Writing it turned up two things. Ten core docs are read by
`component <Name>` but left out of `component --list`, because the list needs
a same-stem source. The test pins them, since listing them would change the
CLI's output. And templates are looked up by type and directory name, not by
title; three showcase blocks share a title with the block they show, which is
fine, but it means the title can never be an id.

* Compile every doc kind, and read every doc through the compiler

Until now only doc topics went through the doc compiler. Components, hooks,
templates, themes, and the CLI's own self-docs were each loaded by whichever
reader wanted them, with its own export order, its own translation merge, and
no check. Now every kind lowers through `lowerDoc` into one sealed node shape:
checked against its kind's parser, translated, carried as JSON, with package
provenance and no machine paths.

- `foundation/doc-compiler/read.mjs` is the one place that loads a doc file
  for reading, and `import.mjs` the one place that executes one. The
  component and hook loaders, search, template and theme discovery, the docs
  list, and the authoring self-docs now read compiled nodes. A new test fails
  if any other module starts executing modules.
- `compileDocs` compiles everything a project reads at once: 1,055 nodes for
  this repo, nine kinds, zero diagnostics, in every language. A bundle reads
  back through a sealed parser that rejects schema skew, unknown fields,
  machine paths, and non-JSON values.
- One diagnostic shape for every phase: a stable code that fixes its phase,
  severity, scope, and remediation, sorted into one order. A token reference
  that finds nothing is now a warning in the bundle.

Nothing a reader sees changes. Each reader keeps its own strictness: the
checked loaders still throw what they threw, and the unchecked ones still read
a doc that fails its parser. The overlay logic moved as is. Evidence: 2,939
CLI reads (every component, hook, template, topic, and section, text and
`--json`, in every language, plus search, build, and theme list) are
byte-identical to the base, and new golden snapshots of integration-doc reads
were recorded at the base and match.

* Move the typed-descriptor policy text to its own spec PR

The descriptor rule (every integration item owns one typed doc, and the
manifest never catalogs items) is a public-model decision, so it gets its own
draft spec PR and its own review instead of riding along with the code. This
removes the spec draft, the INV20 invariant, the contributing guidance, and
the AGENTS.md pointer from this PR. The theme code and the INV19 text that
describes it stay: they state what the code does. Test titles no longer name
the spec.

* cli: resolve provider precedence once, with a ledger

Project, upgrade, and markProviderConflicts each re-derived which package
wins a provider ID, and every drop path returned a shorter list with no
record. They now share one resolver,
foundation/integrations/provider-resolution.mjs. It returns the same
resolved list as before, plus a ledger keyed by real package directory with
one outcome per package: contributes, set-aside (winner and reason),
load-failed, or alias-of.

- Project.load resolves configured, autolinked, and local candidates in one
  pass and keeps the ledger (providerLedgerOf, internal).
- The autolink copy dedupe, an autolinked load failure, and a dependency
  key that repeats a loaded directory are ledger entries now, not silent
  skips.
- upgrade's loadProjectContext hands Project's list, the installed copy,
  and its extras to the same resolver under the codemod policy, on top of
  Project's ledger.
- markProviderConflicts and autolinkIntegrations keep their signatures and
  results.

No output changes. A seeded property test runs the real Project.load and
upgrade context over 200 generated projects. It checks that the ledger
accounts for every candidate exactly once, and that both agree on the
winner of every provider ID, except where the installed copy stands in for
the package being authored.

Two it.fails repros pin a disagreement that exists today: upgrade lets an
--integration extra with an autolinked package's name@version stand in for
it, from any directory, at the extras' position, so another extra can win
the ID in upgrade only.

* test(cli): inventory every doc route with a proposed placement

Add doc-routes.json: one row per built-in topic and section key, and one
row per provider and kind of typed descriptor (ids in
doc-routes.ids.json). Each row records the current CLI route, the
docsite URL, a proposed docs-graph placement, whether an alias is
needed, and a rationale.

doc-routes.test.mjs derives today's routes from the CLI and fails when
a route has no row, a row names a route that no longer exists, or a row
lacks a rationale or uses a placement form the proposal does not define.

* Document DebugEvent and GapReportHandler in astryx docs authoring

Both types are exported from @astryxdesign/cli/authoring, but no self-doc
sat beside debug/type.ts or gap-report/type.ts, so astryx docs authoring
had no section for either. Add one for each, list them after the config
section, and hold them to the published types in the self-doc type test.

* Fail doctor when a public authoring type has no doc

checkAuthoringDocs now also traces every type @astryxdesign/cli/authoring
exports to the module that declares it, parsing index.d.ts and the modules
it re-exports with jscodeshift. The self-doc beside that module must be
listed in AUTHORING_SELF_DOCS, load, and render a section that
astryx docs authoring --index lists, and a listed self-doc must document a
type the package exports. Parsers are left out: they read these types and
are not a shape anyone writes.

A failure names each type, the module that declares it, and the self-doc
that is missing, unlisted, or not in the topic. A passing run prints
exactly what it printed before.

* Route the two new authoring sections, and give whole-repo tests room

The route inventory now has rows for `debug-event` and `gap-report-handler`,
the two authoring sections the doctor check added. The tests that compile or
import every doc in the repo get explicit timeouts, because on a busy machine
they ran past the 30 s default.

* Generate the CLI README from the CLI's self-docs

The README copied reference data by hand, and the copies had drifted: the
search options named a --detail flag that is really --verbose, and the config
and integration tables left out five fields.

- Every command gets a generated usage line, options and examples from its
  CommandDoc, and the API section lists every function in
  @astryxdesign/cli/api and @astryxdesign/cli/json from its FunctionDoc.
- The search options and the doctor integration table come from their
  CommandDocs. The config and integration tables and the copied "How it
  works" text become pointers to the `astryx docs` sections that serve them,
  checked against `astryx docs <topic> --index`.
- The generator writes only between markers, formatting each block on its
  own, so every other byte is kept. It checks each section's source comment,
  fails when a live command or an exported function has no doc, and warns
  about a doc for something that does not exist.
- --check names the drifted sections and the command that fixes them. The
  generator stays one script, the module the doc-load guard allows to import
  self-docs, and runs only when node runs it, not when a test imports it.

* Readers print the authored doc; only the whole-project compile is JSON

Adversarial testing found that routing reads through the compiler had changed
what readers print. Every reader got the doc after a JSON round trip, so a
BigInt, a cycle, a function, a date, `Infinity`, or a key set to `undefined`
changed or broke text output: `component Link --zh` lost its Props heading
for nine core components, and an integration doc with `10n` in it crashed
`component`. Checked loaders also threw a JSON error instead of the parser's
message, and accepted a theme descriptor as a component.

- `lowerDoc` now returns the view readers have always read: the authored
  export with its translation laid over it, uncopied and unconverted. Only
  the sealed node, which a whole-project compile collects, goes through JSON,
  and a value JSON cannot hold withdraws the node, never the view.
- Each reader keeps its old loader (a plain import for the unchecked readers,
  jiti for the checked ones), export order (`a ?? b ?? c`, empty value
  included), and strictness: the parser's error first, then a failed
  translation. Outside the themes root a theme descriptor is still an
  unsupported type, with the same message.
- Unchecked readers no longer run the parser at all, and reads no longer stat
  and resolve every file: a process lowers each file once, as Node's module
  cache holds it, and tries a file that failed to load again.
- `component` and `hook` detail reads hand out their own copy (containers
  copied with their descriptors, everything else shared), so a caller that
  edits a result no longer changes the next read.
- The bundle withdraws a node with a problem of its own, so every bundle
  reads back through its sealed parser; diagnostics never carry a machine
  path; a package with no name is named by its folder; two extension files
  from one package get their own inputs; a topic value JSON cannot hold is
  `not_json` like any other doc; and prototype names are not diagnostic codes.

* Make the doc-loads guard see every way a module runs code

The guard matched callee names, so 18 of the 23 ways a reviewer found to run a doc file got past it: a static doc import, a renamed or namespaced loader, a loader passed as a value, createRequire, a Worker, eval, and more. It now matches by what a module imports and how it uses it, scans every source file in the package, and lists each of the 42 modules that run code outside their static imports with exactly the sites it has, so a new site, a removed one, or a stale entry fails. The doc reader's headers now say what the guard enforces instead of claiming to be the only way a doc file runs.

* Read theme descriptors by their JSDoc, and keep bundled themes as cheap as main

Fixes for the round-1 findings in the typed theme descriptor and template
suffix work.

- Two template specs for one stem list twice and read as ambiguous again,
  as on main, and a core page keeps the released precedence (.template.*,
  then .doc.ts, before .doc.mjs). Nothing is dropped silently.
- The ThemeDoc check reads the JSDoc TypeScript reads for the default
  export: the last JSDoc before it, or a parenthesized cast. A @typedef or
  @import alias counts. A line comment, a string, or a comment after the
  export no longer does.
- A blank name, displayName, or description fails with its field named.
  __proto__ fails like any unknown key. A BigInt no longer reads as a string.
- Theme messages name the package and the file: a symlinked descriptor, a
  nested second descriptor, a name that does not match its folder.
- A dot-folder, or a folder with neither a descriptor nor a <name>Theme
  source, is not a theme. Discovery skips it and pack-check does not require
  it. A folder with a theme source and no descriptor still fails.
- theme add copies a bundled theme exactly as main did: its source files in
  main's order, without the CLI's descriptor. An integration theme still
  copies its whole directory, entry first.
- Bundled theme sources are checked by the bundle test, not on every run.
  The descriptor parser loads on the first read, and each read is kept for
  the process while the file's size and mtime hold. theme list goes from
  36% to 1% slower than main; the doc-loads guard lists the two lazy
  parser loads.
- The theme bundle generator and its check fail on a public theme package
  that has no descriptor, and name it.
- The integration guide says which released suffixes still load: a .doc.ts
  topic in an installed package is listed but cannot be read.

* Make every doctor integration Fix hold when followed

Each `Fix:` that `astryx doctor integration validate` prints now works when
followed as written, and a test follows it on a fixture and validates again.
Before, several led to a new error or pointed somewhere wrong:

- A theme descriptor at the package root was told to set `themes: './..'`,
  outside the package, and one in a top-level folder was told
  `themes: './'`, which reads every folder as a theme. Both now move the
  theme into themes/<slug>/.
- A component, topic or template fix never makes the package root a root.
  It never declares a folder that also holds another kind of doc, another
  root or an incomplete doc, and never swaps out a declared root that still
  holds contributions.
- A move takes the same-stem source along, asks for a missing one, and says
  how to separate the target root from any other root that also reads it.
- A component doc without its source names the real doc file (Foo.doc.ts)
  and never says to delete it. A doc of another type in the components root
  is told which root to change or where to move it.
- When the codemods root is the package root or holds another root, the
  manifest is never listed as a stray codemod and no folder is told to be
  renamed to a version; codemods get a folder of their own instead.
  Contribution metadata at the top of the codemods root is told where it
  belongs instead of being moved into a version folder.
- A hidden component doc no longer draws "add <Name>.doc.mjs" for a file
  that exists.
- An invalid codemod is named by its path inside the package.

The fix logic lives in foundation/integrations/contribution-fixes.mjs so the
component and codemod checks in foundation can use it; the static metadata
reader moved there with it. Messages that were already right are unchanged.

* Ask to rename a theme descriptor that is not a .doc.mjs file

Theme discovery reads only `.doc.mjs` descriptors, so a `sandTheme.doc.ts`
moved into themes/sand/ as its fix said still failed with "found 0". The fix
now also says to rename it. A theme source at the top of the codemods root is
recognized beside a descriptor of any doc suffix, not only `.doc.mjs`.

* Read a themes root the way theme discovery now does

Theme discovery skips dot-folders and folders with neither a descriptor nor a
<name>Theme source. The fix check for a would-be themes root now skips them
too, so a helper folder beside the themes no longer turns "set themes" into a
longer move. A folder that discovery reads as a theme but that is broken still
blocks it.

* Keep readers on the module's own doc, and never let a message break a read

Round-two testing found the edges where the reader copy still differed from
main: a doc nested thousands of levels deep overflowed the copy, and a Proxy
doc printed its target's text instead of the Proxy's. Component and hook reads
now return the module's own doc, exactly as main did.

A load error whose text held a malformed `file://` URL turned into "URI
malformed" when the diagnostic scrubbed its paths; scrubbing now leaves text it
cannot decode as it is. An error with an empty message no longer produces a
diagnostic its own bundle parser rejects. The bundle's header no longer claims
callers it does not have.

* Say the theme catalog shipped in 0.6.3, and hide README markers on the docsite

The changeset called the integration theme catalog canary-only, but 0.6.3
writes `themes/manifest.json`. It now says so, and what an integration that
still ships the catalog must do. The docsite's package page drops HTML
comments before rendering a README, as GitHub and npm do, so the generated
README's section markers no longer show as text. `integrationAddTheme` names
its own command, `integration add theme`.

* Lower every read afresh, as the readers always loaded

Readers shared one lowered view per file for the life of a process. A caller
that edited a `template()` result changed later reads, a doc's getters ran
once instead of on every read, and a failed translation rethrew one shared
error. Main loaded, parsed, and translated on every call, so each read now
does too; only the whole-project compile keeps its per-file memo. Node's
module cache still holds each file, so a read costs what it did on main.

* Keep the compiler's own error code out of the public error envelope

A topic value JSON cannot hold made `docs <topic> --json` report the compiler's internal `not_json` code instead of main's `ERR_UNKNOWN`, because the error carried it as `code`, which the envelope reads. The compiler now keeps its code under its own key. The component loader's header says what readers get now.

* Catch the obfuscation shapes worth catching, and say where the line is

A second pass at the guard found runners it could not see: a doc module
fetched from a `data:` URL, process.dlopen and process.execve, WebAssembly,
Function reached as a called `.constructor`, and eval or Function taken off
the global object by destructuring, through an alias, or with Reflect.get.
Each is one shape with one name, so each is now a site.

What is left out is now stated rather than implied: the scan claims every
ordinary way of running code, whatever the local names, and does not claim
that the rule cannot be evaded on purpose. A method name assembled at run
time still passes, and that is the documented boundary.

The self-test grows to 89 ways around the rule and 28 innocent snippets,
among them the shapes real code uses that these rules must not touch: a
constructor passed on or read for its name, process.cwd, {env} = process,
and WebAssembly.validate.

* Fill an existing theme folder, and keep junk and stray folders out of themes

Round-2 fixes for the typed theme descriptor work.

- `integration add theme` fills an existing folder again, as main did, and
  refuses only a file it would write.
- A theme's files leave out dot entries and files npm never publishes, at
  any depth (.DS_Store, ._*, .gitignore, .npmrc, *.orig, npm-debug.log,
  node_modules, CVS). pack-check no longer fails a correct package over them,
  theme add no longer copies them, and files beside the theme folders are no
  longer required.
- A blank description is accepted, as the released catalog accepted it.
- The ThemeDoc check finds tags the way TypeScript's JSDoc scanner does: a
  cast inside outer parentheses counts, and a code span no longer hides the
  real @type. {!T}, {?T}, {T=}, {(T)}, T | null, T | undefined, T & {},
  @Satisfies on a cast, @import {type ThemeDoc}, and typedef chains are
  accepted. @Satisfies on the export statement and `@import type {...}` are
  not, because TypeScript does not apply them.
- doctor integration validate warns about a folder under the themes root
  that looks like a theme but is not read as one, with a fix that holds: make
  it a theme, or rename it to a dot-folder. A folder another module imports
  is not flagged.
- The theme bundle generator runs when its path goes through a symlinked
  directory, and refuses a descriptor the CLI cannot read, naming the
  package.
- The integration guide says an installed package's component or topic
  .doc.ts cannot be read; it loads only when the package is linked from
  outside node_modules.

* Keep the doc-loads guard off the folders tests create and delete

The guard scans the whole package, so it could list a temporary __import_hint_integration_* folder that another test was deleting and fail at random. Every __* folder is test scaffolding, so the guard now skips it, and an import from one still counts as a site.

* Never let a doctor Fix move a contribution onto a taken name

Some `Fix:` lines from `astryx doctor integration validate` still broke
something when followed:

- A move into a root never checked the target. A theme slug the themes root
  already has, a topic name the docs root already has, or a component or
  template name its root already has led to a second descriptor, "both define
  the topic", or an overwritten file. The same holds when a fix first moves
  a root out of the components root and then moves a file into it. The fix now names what already holds
  the name and asks for a new slug or name.
- Moving a theme whose source imports a file outside its folder left that
  import pointing outside, which discovery rejects. The fix now names each
  such file to copy in and the import to change.
- A folder was offered as the components root while it held a `.tsx` no doc
  covers, which then drew a new warning. Such a folder, one that holds a name
  twice, or a theme that imports from outside it, is no longer offered as a
  root.
- "Add <Name>.doc.mjs" now also says how to stop another root that reads the
  components root from reading the new doc too.
- A file at the top of the codemods root that a theme there imports is told
  to move with that theme, not into a version folder as a codemod.

Messages that were already right are unchanged.

* Treat any thrown value as a failure, undefined included

The compiler recorded a failure by its value, so a doc whose check threw
`undefined` read as a pass: `integration pack --check` called a package ready
that main failed, and a translation that threw `undefined` printed English.
A failure is now a flag beside the value, for loads, checks, and
translations alike. Describing a thrown value never throws in its place, so a
reader rethrows what the doc threw, as main did.

* Scan every folder that can ship; skip only test scaffolding

Skipping every __* folder kept the guard off the temporary folders a test
deletes mid-scan, but it also stopped it reading code in a folder like
__generated__, which ships. The guard now skips __tests__, __fixtures__, and
folders tests create with mkdtemp, and scans the rest.

* Keep the compiler-boundary test off folders other tests delete

The test that keeps compiler functions out of api/ and clients/ walked every folder, so it could open a file in a temporary folder the import-hint test was deleting and fail with ENOENT. It now skips folders created with mkdtemp, as the doc-loads guard does.

* Convert the 0.6 theme catalog with a codemod, and call its removal breaking

0.6.3 shipped `integration add theme` writing a central themes/manifest.json
catalog, so dropping it breaks every integration package made with it. The
changeset is now [breaking], so the next release is a minor, and a codemod
staged for that release converts a package: `astryx upgrade --from 0.6.3
--path . --apply` writes each theme's typed descriptor from its catalog entry
and removes the catalog. It plans the whole package first and changes nothing
when an entry cannot convert. A themes root that still holds the catalog now
names that command.

It is the first core project codemod: it plans whole-file writes and deletions
under the package instead of rewriting the files it is handed, and the runner
applies or previews the plan as one unit. Integration codemods keep the file
contract. `integration add theme` and the codemod render descriptors through
one function, and a test holds a second theme to touching no shared file.

* List the Tree Table template main added in the doc route inventory

Main gained the table-tree page template (#6195), and the inventory test holds every current route to a row, so the core page count goes from 54 to 55.

* Record the per-item descriptor rule this change follows (AST-039)

The catalog question is decided (no central item catalog in any form), so the
spec comes back from its separate PR and ships with the code it describes. Adds
the AST-039 draft record, INV24 in the CLI architecture, the typed-doc and
no-catalog rules in the CLI conventions, and a pointer in AGENTS.md. FR11
forbids a catalog file under a root, a per-item map or list in the integration
manifest, and a hand-synced registry, for every kind; DEC-4 records why and
supersedes AST-035 DEC-1.

* Keep the CLI README as main has it, plus a pointer to the CLI's own docs

The README is the entry point for agents, so it stays short. This drops the
generated command reference and API function list this branch had added, with
their generator code and tests, and goes back to main's generator and its three
tables. A new hand-written section names the command that prints each kind of
CLI doc: --help, manifest --json, docs authoring, docs cli-integrations, and
docs. The only other change from main is the generated ERR_THEME_INVALID row,
which follows the theme descriptor change.

* Fail doctor when a CLI doc has no namespace, or one no topic reads

Every command, API function, schema, and enum doc the CLI ships has a
`namespace` field, and nothing read it. A new doctor check, CLI docs, loads
them through the compiler and fails when one has no namespace, names one no
`astryx docs` topic reads (cli/commands and cli/api go to `astryx docs cli`,
authoring to `astryx docs authoring`), or disagrees with the authoring topic's
list. INV25 in the CLI architecture records the rule.

On this commit the check fails on this repo on purpose, with 83 findings: the
41 API function docs have no namespace, and 42 docs name "cli", which no topic
reads (34 commands, 5 authoring schemas, 2 enums, the output schema). The
tests record them; the next commit fixes them and adds the reader.

* Give every CLI doc a namespace, and read the cli ones with astryx docs cli

Each command doc now declares cli/commands and each API function doc, enum,
and the output schema cli/api; the five schemas `astryx docs authoring` reads
declare authoring. The new `astryx docs cli` topic is built from the cli/...
docs like the authoring topic is from its self-docs: one section per doc,
keyed commands-<name> and api-<name>, with usage, options, parameters,
returns, throws, examples, and links between a command and the function it
runs. The doctor check now passes: all 95 CLI docs are readable, 78 in
`astryx docs cli` and 17 in `astryx docs authoring`.

The route inventory lists the topic and its 78 sections under the cli
namespace. The docsite does not publish the topic yet, because /docs/cli is
the @astryxdesign/cli package page. The README points to the topic, and the
namespace field's docs say what it now does.

* Keep main's latest README and tests working on this branch

Main moved 70 commits while this PR was open. The CLI README keeps main's
new text (apiVersion, --verbose) under the pointer section. Main's new
theme-add binary test now installs a typed descriptor instead of the 0.6
catalog, and its integration-add controls test reads the template's own doc.
The load guard lists the three places main now runs code outside its static
imports (the manifest command doc, twice, and @babel/parser), and the golden
component read shows main's plain "-" for an empty default.

---------

Co-authored-by: Joey Farina <[email protected]>

This branch was successfully deployed

1 active deployment
Preview — f2d13c24 Deployed Sep 24, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant