Skip to content

Author integration themes with typed descriptors - #6315

Closed
josephfarina wants to merge 1 commit into
mainfrom
josephfarina/theme-doc-descriptors
Closed

josephfarina wants to merge 1 commit into
mainfrom
josephfarina/theme-doc-descriptors

Conversation

@josephfarina

Copy link
Copy Markdown
Contributor

User need

Integration authors need themes to follow the same local, typed authoring model as components, docs, and templates. The canary-only theme integration used a central JSON catalog, which split metadata from the source and made the root manifest own item details.

Current specification

AST-035 is included as a draft system record. It defines one strongly typed, same-stem .doc.mjs per discoverable integration item and keeps root manifests limited to locating contribution roots. An authorized owner must promote the record before merge.

Public delta

  • Export ThemeDoc and parseTheme from @astryxdesign/cli/authoring.
  • Discover each integration theme from <stem>.doc.mjs beside <stem>.{ts,mjs,...}.
  • Infer the source entry and required named runtime export from the shared stem.
  • Copy and pack the complete theme directory, including its descriptor and unreferenced authoring artifacts.
  • Reject the obsolete central themes/manifest.json, misplaced or duplicate descriptors, ambiguous sources, escaped imports, symlinks, and type-only or missing runtime exports.
  • Keep listThemes() synchronous by statically parsing bundled descriptors and caching cloned results.
  • Emit typed .doc.mjs from component, topic, template, and theme authoring commands. Released .template.* files remain readable, with .doc.mjs taking precedence for the same stem.
/** @type {import('@astryxdesign/cli/authoring').ThemeDoc} */
export default {
  type: 'theme',
  name: 'ocean',
  displayName: 'Ocean',
  description: 'Ocean theme.',
  maintained: true,
};

Design and alternatives

Theme integrations and their JSON catalog never shipped in a stable release, so this replaces that format instead of creating two sources of truth. Discovery parses descriptor and source syntax without executing either file. Runtime exports are still proven statically across local imports and re-exports.

Released template, codemod, and agent-doc inputs keep explicit compatibility readers. Their migrations are separate from this theme correction.

Evidence

  • The complete CLI suite passes 253 files and 3,950 tests.
  • Focused discovery, authoring, pack, bundle, and real-package tests pass 244 cases.
  • A real two-theme package passes typecheck, unit tests, local-versus-packed identity, clean-consumer list/add, descriptor byte comparison, build, and freshness checks.
  • Three independent reviews found no blocker or high-severity issue. Review follow-ups added canonical template precedence proof and a precise descriptor-import error.
  • Bundled payload comparison proves each prior theme keeps the same files and bytes, with only its descriptor added.

Scope

  • One capability is added.
  • Unrelated fixes, cleanup, and policy changes were removed or split.
  • Consumer docs, focused tests, and migration evidence ship with the feature.
  • Public text and artifacts contain no internal Meta context.

Testing

  • pnpm -F @astryxdesign/cli exec tsc --project tsconfig.api-dts.json
  • pnpm -F @astryxdesign/cli typecheck:authoring
  • pnpm -F @astryxdesign/cli typecheck:template-docs
  • pnpm -F @astryxdesign/cli typecheck:json-api
  • pnpm -F @astryxdesign/cli typecheck:strict
  • pnpm check:repo
  • pnpm build
  • pnpm exec vitest run packages/cli
  • ESLint with zero warnings across every changed JavaScript and TypeScript file

@vercel

vercel Bot commented Sep 13, 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 23, 2026 11:52pm UTC

Request Review

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

astracat-bot Bot commented Sep 13, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Sep 24, 2026, 3:07 AM UTC

@josephfarina
josephfarina force-pushed the josephfarina/theme-doc-descriptors branch from 796fe15 to e7e1cdf Compare September 13, 2026 18:58
github-actions Bot added a commit that referenced this pull request Sep 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox were not published for this CI run.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: 36 accessibility violation(s) found — 2 critical, 34 serious.

Button pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatComposerInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatReasoning - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ChatToolCalls - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 10/11 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Checkbox pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/33 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CheckboxList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 4/17 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ClickableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditor - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/7 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorPerf - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/2 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeEditorTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 13/14 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
CodeTheme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 14/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
DateRangeInput - 1 issue(s)
  • 🔴 critical: Ensure an element's role supports its ARIA attributes
    • Rule: aria-allowed-attr · Affects 1/20 stories · Learn more
    • WCAG: 4.1.2 (Level A)
FileInput - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/15 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
GridMasonry - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Heading - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/16 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Icon - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
LogStream - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/3 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
MediaTheme Auto - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PowerSearch - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
ProgressBar - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/18 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Radio group pattern - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/26 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RadioList - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/13 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
RichTextEditor - 2 issue(s)
  • 🟠 serious: Ensure every ARIA input field has an accessible name
    • Rule: aria-input-field-name · Affects 2/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
  • 🔴 critical: Ensure every form element has a label
    • Rule: label · Affects 1/18 stories · Learn more
    • WCAG: 4.1.2 (Level A)
SelectableCard - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/4 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Stepper - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/30 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
TableGroupedRows - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 3/3 stories · Learn more
    • WCAG: 4.1.2 (Level A)
TableTree - 1 issue(s)
  • 🟠 serious: Ensure ARIA attributes are used as described in the specification of the element's role
    • Rule: aria-conditional-attr · Affects 8/9 stories · Learn more
    • WCAG: 4.1.2 (Level A)
Text - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/23 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Theme - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/5 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
PopArt - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 3/6 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Thumbnail - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/12 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Timestamp - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 1/20 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Token - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/10 stories · Learn more
    • WCAG: 1.4.3 (Level AA)
Tokenizer - 1 issue(s)
  • 🟠 serious: Ensure the contrast between foreground and background colors meets WCAG 2 AA minimum contrast ratio thresholds
    • Rule: color-contrast · Affects 2/24 stories · Learn more
    • WCAG: 1.4.3 (Level AA)

Visual Regression

5 of 2464 shot(s) changed. View the report

A repository maintainer can accept these exact frames: /accept-visual 34776233630/1 <why every changed frame is correct>

A change here is a question, not a failure: check whether the after is the
picture you intended. If it is, say so in the PR — the release gate's baseline
is updated deliberately, and this check never rewrites it.

component story theme mode pixels
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
MediaTheme On Dark neutral dark 838
AlertDialog Delete neutral light 71
TableRowStatus Default neutral light 23
ComplexSelector — Fruit ripeness selector — neutral light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
ComplexSelector — Fruit ripeness selector — neutral dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
MediaTheme — On Dark — neutral dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | View full report

@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.

Approval is waiting on a maintainer spec decision.

This change replaces the canary central theme catalog with typed, same-stem .doc.mjs descriptors (ThemeDoc/parseTheme, inferred source and export, whole-directory pack/copy, synchronous listing), migrates the bundled themes, and makes .doc.mjs canonical for other authoring kinds including template precedence over released .template.* files.

The governing record for those deltas, docs/specs/AST-035/spec.md, is currently a draft with no approval recorded, and the PR notes an authorized owner must promote it before merge. A maintainer therefore needs to promote AST-035 to current — settling the descriptor as the sole per-item authority, the rejection of themes/manifest.json, the directory pack boundary, and canonical .doc.mjs precedence — or identify an existing current spec that already authorizes them.

No independent concrete defect was proven in this review, and no removal or split is requested for the missing spec alone. The extensive test evidence reported in the PR was not independently rerun in this review, so it should be rechecked once the spec question is settled.

[Automated review]

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
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]>
@josephfarina

Copy link
Copy Markdown
Contributor Author

Closing as superseded by #6498 (merged as 34b4692), which rebuilt this draft on the newer doc types.

Checked on main at d88274b:

  • packages/cli/authoring/doctypes/theme/ has type.ts, parse.mjs and theme.doc.mjs, and @astryxdesign/cli/authoring exports ThemeDoc.
  • foundation/discovery/theme-discovery.mjs reads each theme's typed descriptor without executing it (readThemeDoc).
  • architecture:cli-surface INV24 makes the typed descriptor the one home for an integration item's metadata.
  • .changeset/typed-theme-descriptors.md on main came from Compile every doc kind from one resolver, and give themes typed descriptors #6498.
  • 51 of this PR's 73 changed files have all of their added lines on main. The remaining lines sit where main moved on after this draft: AST-035 now covers template replacement, the integration guide moved into the docs tree (packages/cli/assets/docs/tree/integrations.doc.mjs), and Compile every doc kind from one resolver, and give themes typed descriptors #6498 rewrote theme discovery.

@github-actions
github-actions Bot deleted the josephfarina/theme-doc-descriptors branch October 2, 2026 06:24

This branch was successfully deployed

1 active deployment
Preview — 64bf7b21 Deployed Sep 23, 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