Repository navigation
Compile every doc kind from one resolver, and give themes typed descriptors - #6498
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
AI review status for this pull request.
|
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 01:21
b051a23 to
d26ed40
Compare
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 01:32
d26ed40 to
f801423
Compare
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 01:47
f801423 to
87d5e89
Compare
Contributor
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewView Sandbox for this PR No new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression25 of 420 shot(s) changed. View the report A change here is a question, not a failure: check whether the after is the
and 5 more. Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
2 tasks done
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 06:59
c56c43d to
2826094
Compare
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 08:51
2826094 to
c10caa3
Compare
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 10:06
c10caa3 to
c0fda78
Compare
github-actions
Bot
requested review from
cvkxx,
ernestt,
kentonquatman and
rubyycheung
September 24, 2026 10:07
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.
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.
… 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.
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.
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.
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.
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.
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.
…eaking 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.
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.
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.
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.
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.
…s 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.
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.
josephfarina
force-pushed
the
docs/compile-every-doc
branch
from
September 24, 2026 21:57
fa74454 to
5f0bcfb
Compare
Contributor
Author
|
/approve-spec 5f0bcfb |
josephfarina
added a commit
that referenced
this pull request
Sep 24, 2026
#6498 added a `namespace` field to the seven layout .doc.mjs files this branch deletes; delete wins, the command is going. It also added three doc-graph artifacts that enumerate the command: doc-routes.json (7 cli#commands-layout* / cli#api-layout-* rows), doc-routes.ids.json (4 command + 3 function ids) and the doc-loads expectation for clients/cli/commands/layout.mjs. All removed. The `astryx docs layout` guide topic and its five sections stay, as do the Layout component and block ids -- those are the design system, not the command.
4 tasks done
josephfarina
added a commit
that referenced
this pull request
Oct 1, 2026
…riptor Main no longer reads a themes/manifest.json catalog (#6498), so the fixture's theme came back as invalid_theme. It now ships oceanTheme.doc.mjs, the way pack-check.test.mjs does, and the renaming lifecycle script edits that descriptor.
4 tasks done
josephfarina
added a commit
that referenced
this pull request
Oct 2, 2026
…6556) * fix(cli): check the tarball when pack lifecycle scripts print output integration pack --check parsed npm pack's stdout as JSON, but npm prints foreground prepack/prepare/postpack output to the same stream, so any package whose lifecycle printed anything failed before its tarball was examined. Run the lifecycle scripts in background mode and keep a failing script's output in the pack_failed message. * test(cli): build the lifecycle-output fixture with a typed theme descriptor Main no longer reads a themes/manifest.json catalog (#6498), so the fixture's theme came back as invalid_theme. It now ships oceanTheme.doc.mjs, the way pack-check.test.mjs does, and the renaming lifecycle script edits that descriptor. --------- Co-authored-by: Joey Farina <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.









Where this stands
Draft, for review; not merged. Three rounds of adversarial testing ran against this branch. The third ran on the previous head and was not clean: it found 21 issues. The two serious ones are fixed in the final commits, with tests: a checked read that passed a failing doc, and a gap in the guard test. Those fixes also closed two smaller issues. The other 17 are listed under Open, by choice below. The testers rated three of them should-fix (a warning that misses a case, an unusual layout the theme file list mishandles, and false positives in the guard test), and none a blocker. The released theme catalog is now removed as a breaking change, with a codemod (below).
Breaking: the 0.6 theme catalog is gone, and a codemod converts it
In 0.6 (stable since 0.6.3),
astryx integration add themewrote a centralthemes/manifest.jsoncatalog. That broke the rule every other contribution follows: an item's details live in its own typed.doc.mjs. This PR drops the catalog, so the change is marked[breaking]and the next release is a minor. To migrate an integration package, run this in it:A codemod staged for that release writes each theme's typed
<name>Theme.doc.mjsfrom its catalog entry and removes the catalog. It checks the whole package first and changes nothing when an entry cannot convert, naming that entry. A themes root that still holds the catalog is refused, with an error that names the command. Until a package is migrated, apps that install it get none of its themes or doc topics; its components and templates still load. Measured with a kit made by the released 0.6.3 CLI: one warning, and the theme and the doc topic were missing. After the codemod ran on the installed kit, both came back.Primary intent
Every authored doc goes through the one internal docs compiler, with no change to what any read prints. #6484 routed docs topics through the compiler; this PR does the same for every doc kind (components, hooks, templates, themes, and the CLI's own self-docs) and every read (
component,hook,template,search,docs,theme list). The compiler stays internal behind the existing API. The PR also carries the compiler-foundation pieces that do not depend on the undecided docs-graph spec.This is a large PR on purpose. It collects that work so the pieces land together instead of as a chain of small PRs. Each commit states what it proves.
What adversarial testing found, and what it fixed
Each round compared main and this branch over hundreds of hostile integration layouts, the whole flag surface (over 16,000 runs), the programmatic API (over 14,000 calls compared exactly), packed installs in clean consumers, and both docs sites. Round one found 19 defects, all fixed. Round two found 21: 18 are fixed, one is the breaking change above, and two are listed as open. Round three is summarized above. Every fix has a test that fails on the code before it. The rounds are not converging: three adversarial rounds each returned about 20 findings (19, 21, 21), so the supply is not exhausted. Read the fixed count as progress, not as proof that the surface is clean. Four findings tell the story:
undefined, a BigInt, a function, or a date changed or broke text output (astryx component Link --zhlost its Props heading for nine core components). Readers now get the module's own doc, lowered afresh on every read, exactly as main loaded it; only the whole-project compile is JSON.integration pack --checkpassed a package main rejected. Outside the themes root a theme descriptor is an unsupported type again, with main's message.undefinedpassed the checked read (round three):integration pack --checkcalled a package ready that main failed. A failure is now recorded as a flag beside the thrown value, so any thrown value fails the check.Status
Done:
replacesanother still renames it.ThemeDocannotation in the common forms TypeScript accepts. Bundled themes stay as cheap as on main, andtheme add <bundled theme>copies exactly what main copied. Released.template.*inputs still load, and two specs for one template still read as ambiguous, as on main.doctor integration validatewarning names a fix that works when followed literally. Each hint has a test that carries the fix out on a copy and validates again, and over 10,000 generated fixes were followed the same way..doc.mjsCore and the CLI ship is read exactly once.compileDocscompiles a whole project into a sealed bundle that reads back through a sealed parser. Every compiler phase reports through one diagnostic shape with a stable code, and no diagnostic carries a machine path. A guard test lists, site by site, every place the CLI runs code other than its static imports. It catches every ordinary way, whatever the local names, and says plainly that deliberate obfuscation is out of scope.Project.load,upgrade, and the provider-conflict pass share one resolver that records one outcome per package directory. Precedence is unchanged.astryx doctorchecks that every public authoring type is documented. It found two gaps, now documented:DebugEventandGapReportHandler.astryx docs clihas one section per command (commands-<name>) and per API function, plus the JSON output envelope, error codes, and response types (api-<name>). A new doctor check fails when a command, API function, schema, or enum doc has no namespace, or names one no topic reads. Its commit shows it failing on this repo with 83 findings (41 API function docs had no namespace; 42 docs namedcli, which nothing read), and the next commit fixes them. The docsite does not publish the topic yet, because /docs/cli is the CLI package page.--help,manifest --json,docs authoring,docs cli-integrations,docs). The rest stays as main has it, apart from one generated error-code row. The docsite's package page hides the README's generator markers, as GitHub and npm do.What a user sees change
astryx docs <topic>keeps its own title when an integration extends it.themes/manifest.jsoncatalog is no longer read (breaking; the codemod above converts it).theme add --packagecopies the theme directory, descriptor included, andintegration add themefills an existing empty folder.astryx doctor integration validatehints end with a fix that works, and it warns about a folder in the themes root that looks like a theme but is not read as one.astryx doctorchecks the authoring types, andastryx docs authoringgains two sections.astryx docs clireads every command and API function, andastryx doctorchecks that every CLI doc has a namespace a topic reads.astryx searchnow finds an API function by name through that topic.ERR_THEME_INVALID) and the new pointer section, which namesastryx docs cli.Nothing else a reader sees changes.
Evidence
-in component tables. The read comparisons below were measured on f22695a.--json, in every language, plus search, build, and theme list. 35 differ. With every code change kept and only this PR's doc text set back to main (six doc files and three added self-docs), all 2,939 are byte-identical. So the 35 are the intended text, and search rankings follow that text. A second matrix of 1,582 text reads the first skipped differs only in the three intended topics.doctor integration validatewent from the catalog error to 0 issues, andintegration pack --checkreported ready.upgradedisagreement, below).pr-a11yincluded).doctoris the exception: about 130 ms slower in every setup measured, because the authoring-type check parses the CLI's own type files on each run. An earlier version of this description said +7%. Measured against the faster base of a clean installed consumer, it is about +16%, so that figure is revised upward. A build-time index of those types would remove the cost.tsc(api-dts, strict, authoring-contract), eslint, prettier, andpnpm check:repo.Open, by choice
From round three, small enough to leave for review:
<name>Theme.node_modulesfolder inside a theme folder counts as never published, case variants such asNPM-DEBUG.LOGcount as theme files, and a theme folder namednode_modulesorCVSis skipped without a warning. The robust fix is to take the list from npm's own pack list.[].constructor.isArray(x)), with a terse message. Nothing in the tree trips them today.integration add themeinto a folder that already holds only the source, or only the descriptor, gives a theme error instead of main's file-exists error or fill. An incomplete sibling theme also blocks the add.Readonly<ThemeDoc>) disagree with TypeScript. The runtime schema still checks every value.typeread throws breakscomponent; an older rename hint can keep a stem that is not an export name; the "create components/" fix ignores an existing folder; the release generator looks upneo-2asneo-2Theme.tsand prints a bare EISDIR for a descriptor path that is a directory; the docsite also hides HTML comments inside code fences (no README has one);doctor integration validateno longer calls the manifest a stray codemod when the codemods root is the package root.Earlier:
compileDocsand its input collector ship with no command calling them yet; they are the base for the docs graph.Found along the way, not changed here
upgradelets an--integrationpackage with an autolinked package's name and version stand in for it from any directory, so another extra can win the provider ID inupgradeonly. Twoit.failstests pin it; fixing it changesupgradeprecedence.codemods: './', codemod discovery treatsnode_modulesand test folders as version folders and imports files from them. A fix is ready as its own change.group,hidden, andcategoryfrom doc text with regular expressions, because discovery is synchronous.token-refblock fromdocs(), on main and here alike.astryx component NavMenuanswers withNavHeadingMenu; ten more names (HStack,VStack, and others) are readable bycomponentbut in no list.astryx docs migration --denseanddocs styling --denseprint the full text without a notice.Spec note
The spec this change follows ships in this PR. It came back from its separate draft (#6511) once the catalog question was decided. It adds:
docs/specs/AST-039/spec.md(draft record): every discoverable integration item owns one typed same-stem.doc.mjs. FR11 forbids a central catalog of items in any form, for every kind: no catalog file under a root, no per-item map or list inastryx.integration.*, and no hand-synced registry. DEC-4 records why and supersedes AST-035 DEC-1.docs/architecture/cli-surface.md, the typed-doc and no-catalog rules indocs/contributing/cli-conventions.md, and a pointer inAGENTS.md.docs/architecture/cli-surface.md: every command, API function, schema, and enum doc the CLI ships names the topic that reads it (cli/commandsandcli/apiforastryx docs cli,authoringforastryx docs authoring), andastryx doctorfails when one does not.The spec says this explicitly on purpose, so that no one adds a central catalog again by accident. AST-039 is a draft, and INV19 is an approved record, so both wait for the owner's approval.
Scope