Repository navigation
Docs graph for the CLI and integrations, template replacement, and themeTemplate export (AST-046, AST-047, AST-035) - #6626
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report📚 Storybook Preview🧪 Sandbox PreviewNo new or modified components detected. Bundle Size SummaryNo component packages changed. Accessibility AuditStatus: No accessibility violations detected. Visual Regression1 of 420 shot(s) changed. View the report A change here is a question, not a failure: check whether the after is the
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
d4e8641 to
7b0bbc7
Compare
7b0bbc7 to
73dce9c
Compare
73dce9c to
9d19848
Compare
9d19848 to
dae281f
Compare
dae281f to
8efe2b3
Compare
There was a problem hiding this comment.
Review
This is ready to merge. The docs graph gives every doc one derived home and one route, every docs and search read now ends with runnable moves, and links between docs are typed by identity instead of hand-written — while the 0.6 JSON contracts (docs(topic) returning the whole topic, --index, and the ReferenceContentBlock union) are preserved and guarded by tests, including the graph walk that opens every doc, move, and link the CLI ships.
Worth knowing for consumers:
- The two breaking changes are labelled as such, with minor changesets and migration guidance:
astryx docs cli-integrationsis nowastryx docs cli/integrationswith no alias (the old name fails with a suggestion of the new route), and a winning integration template replacement removes the Core entry from the default template list, with explicit--package @astryxdesign/coreselection still reaching the original. - Integration authors gain namespace docs and placed guides beside
cli, template replacement with deterministic precedence and fail-closed invalid claims, and a pack check that refuses a namespace-doc package whose declared CLI peer range admits a CLI too old to read it — closing the silent doc loss seen on 0.6.3. themeTemplate()is now exported from@astryxdesign/cli/api, closing the documented parity gap forastryx theme template.- Doctor's new graph findings warn rather than fail, so projects that passed before keep passing.
The still-open items noted in the PR (text-mode errors not printing the error code, resolved JSON links reading as plain command text, and pack check not itself running the docs checks) are reasonable follow-ups and do not block this change.
[Automated review]
- The CLI keeps its routes: an integration namespace or topic that claims cli, unorganized, or a CLI topic's name is withdrawn with a duplicate_route diagnostic filed against the integration, so both doctors show it, and a read, list entry, or search hit of that name resolves to the CLI's doc. - integration add doc --parent finds the namespace by its name, uses its guides slot or its only slot that takes a guide, and refuses a file of that name that is not the namespace. - astryx docs --json keeps data as the topic list; the docs tree's top-level namespaces move to meta.namespaces. - Root astryx doctor warns, rather than fails, on integration contribution problems, so a project that passed before keeps passing. - A template whose metadata does not load, or that has no type, still counts its replaces, so the target stays Core (AST-035 FR4). - integration pack --check requires a CLI that reads the docs tree for a namespace doc or a placed guide, and one that reads replaces for a template that sets it. - Top-level namespace search hits carry parent; --lang dense reads whole like --dense; a section read of a typed doc suggests the doc itself; the writing guide drops two maintainer-only lines.
There was a problem hiding this comment.
Review
Approval is waiting on one maintainer decision, not on code changes.
This PR's main deltas — the docs tree and navigable docs/search output, and integration templates replacing Core templates — are governed by amendments to current spec records carried in this PR itself (the cli-surface docs-tree invariants and the new current template-replacement record). Under the repository's spec process, a PR that creates or changes a current record needs spec-owner approval for its exact current revision, and any new commit invalidates an earlier approval. The approval on record covers the previous revision; the latest fix commit superseded it, and the spec-owner approval status for the current revision is still pending, waiting for an engineering owner.
What must be settled: an eligible spec owner — the author is one, via the /approve-spec comment for the current revision, or another owner by review — approves those current-record amendments for this revision. Once that is recorded, this review's other conclusions stand as they are:
- The newest revision fixes the earlier findings well:
astryx docs --jsonkeepsdataas the topic list (namespaces now inmeta.namespaces), an integration can no longer take the CLI's own routes, a template whose metadata does not load still keeps its replacement target on Core, and pack check now also gates placed guides andreplaceson a CLI range that can read them. - The 0.6 JSON contracts are preserved and guarded, the two breaking changes (the
cli-integrationsroute rename and template-replacement selection) carry minor changesets with migration guidance, andthemeTemplate()is now exported, closing a documented parity gap. - The graph-walk, template, pack-check, and compatibility test suites and the repository checks pass locally on this revision, and no concrete defect was found.
[Automated review]
…hrough the guarded importer - Topic names already compare without case in the catalog, so the tree now does too: an integration topic named CLI or Unorganized claims the CLI's routes and is withdrawn with a duplicate_route diagnostic, and reads, the topic list, and search resolve it to the CLI's doc. tree.getFolded looks a route up without case. - declaredReplacement reads a template doc that does not validate through importDocModule, so anything the doc prints while it loads goes to stderr and --json stdout stays clean, and a .doc.ts under node_modules is read through jiti. - Tests: case and spelling variants of the CLI's routes, in the tree and end to end with both doctors; a printing .doc.ts outside node_modules; a .doc.ts under node_modules that computes its replacement; and --parent with more than one slot that takes a guide.
There was a problem hiding this comment.
Review
Approval is waiting on one maintainer decision, not on code changes.
This PR's main deltas — the docs tree and navigable docs/search output, and integration templates replacing Core templates — are governed by amendments to current spec records carried in this PR itself (the cli-surface docs-tree invariants and the new current template-replacement record). Under the repository's spec process, a PR that creates or changes a current record needs spec-owner approval for its exact current revision, and any new commit invalidates an earlier approval. The approval on record covers an earlier revision; newer commits superseded it, and the spec-owner approval status for the current revision is still pending, waiting for an engineering owner.
What must be settled: an eligible spec owner — the author is one, via the /approve-spec comment for the current revision, or another owner by review — approves those current-record amendments for this revision. Once that is recorded, this review's other conclusions stand as they are:
- The newest revision strengthens the earlier fixes: an integration can no longer take the CLI's own routes even with a differently-cased name, and an unusable template doc is read through the guarded importer, so its declared replacement still keeps its target on Core and anything it prints while loading cannot pollute
--jsonoutput. - The 0.6 JSON contracts are preserved and guarded, the two breaking changes (the
cli-integrationsroute rename and template-replacement selection) carry minor changesets with migration guidance, andthemeTemplate()is now exported, closing a documented parity gap. - The graph-walk, template, pack-check, and compatibility test suites and the repository checks pass locally on this revision, and no concrete defect was found.
[Automated review]
…ame for its replacement - Namespaces go into the tree parents first, so a namespace placed in a withdrawn namespace is withdrawn too, with an invalid_placement diagnostic, before any doc is placed in it. - A name a topic answers to through replaces is that topic's route: another doc that claims it is withdrawn with a duplicate_route diagnostic, so the topic list, reads, and search agree with the tree. - AST-046 FR11 states the order between integrations and the replaces rule. - Tests: a namespace chain under a withdrawn namespace; a replaced name claimed by another integration's namespace, in the tree and end to end; a route read in another case.
There was a problem hiding this comment.
Review
Approval is waiting on one maintainer decision, not on code changes.
This PR's main deltas — the docs tree and navigable docs/search output, and integration templates replacing Core templates — are governed by amendments to current spec records carried in this PR itself (the cli-surface docs-tree invariants and the new current template-replacement record). Under the repository's spec process, a PR that creates or changes a current record needs spec-owner approval for its exact current revision, and any new commit invalidates an earlier approval. The approval on record covers an earlier revision; newer commits superseded it, and the spec-owner approval status for the current revision is still pending, waiting for an engineering owner.
What must be settled: an eligible spec owner — the author is one, via the /approve-spec comment for the current revision, or another owner by review — approves those current-record amendments for this revision. Once that is recorded, this review's other conclusions stand as they are:
- The newest revision strengthens the earlier fixes: a namespace placed in a withdrawn namespace is now withdrawn too (transitively, so nothing can sit under a route that no longer exists), and a name a topic answers to through
replacesis kept for that topic, so the topic list, reads, and search agree with the tree. - The 0.6 JSON contracts are preserved and guarded, the two breaking changes (the
cli-integrationsroute rename and template-replacement selection) carry minor changesets with migration guidance, andthemeTemplate()is now exported, closing a documented parity gap. - The graph-walk, template, pack-check, and compatibility test suites and the repository checks pass locally on this revision, and no concrete defect was found.
[Automated review]
…ough the same names - DocsCatalog.aliasesOf returns every name the catalog answers to for a topic: the topics it replaced, directly or through a chain. After two replacements of one topic, or a chain of them, the replacement's entry only records the last name it replaced. - The docs tree reserves all of those names for the topic, so another integration's namespace of such a name is withdrawn with a duplicate_route diagnostic, and a typed link to any of them resolves to the topic, so the CLI's own links keep opening it. - Tests: every alias reserved in the tree; end to end, a topic replaced twice and through a chain, with a walk over every topic read that finds no raw link; search skips a topic whose route another doc owns.
There was a problem hiding this comment.
Review
Approval is waiting on one maintainer decision, not on code changes.
This PR's main deltas — the docs tree and navigable docs/search output, and integration templates replacing Core templates — are governed by amendments to current spec records carried in this PR itself (the cli-surface docs-tree invariants and the new current template-replacement record). Under the repository's spec process, a PR that creates or changes a current record needs spec-owner approval for its exact current revision, and any new commit invalidates an earlier approval. The approval on record covers an earlier revision; newer commits superseded it, and the spec-owner approval status for the current revision is still pending, waiting for an engineering owner.
What must be settled: an eligible spec owner — the author is one, via the /approve-spec comment for the current revision, or another owner by review — approves those current-record amendments for this revision. Once that is recorded, this review's other conclusions stand as they are:
- The newest revision strengthens the earlier fixes: every name a replaced topic answers to, directly or through a chain of replacements, is now reserved for that topic, links to any of those names resolve to it, and search no longer offers a topic whose route another doc owns, so the topic list, reads, links, and search agree with the tree.
- The 0.6 JSON contracts are preserved and guarded, the two breaking changes (the
cli-integrationsroute rename and template-replacement selection) carry minor changesets with migration guidance, andthemeTemplate()is now exported, closing a documented parity gap. - The graph-walk, template, pack-check, and compatibility test suites and the repository checks pass locally on this revision, and no concrete defect was found.
[Automated review]
…at answers to a CLI route - nameOwner decides who answers to a name a reader types: the tree node at that route, compared without case, else the topic the name is an alias of, unless the tree gave that topic's own route to another doc. Reads use it, and the topic list and search offer a topic only when its own name opens it, so all three agree on every name. - A topic that answers to a route the CLI's own docs keep through replaces (directly or through a chain) gets a duplicate_route diagnostic against the topic, which both doctors show; the name opens the CLI's doc. - Tests: one package whose topic replaces its own cli and Unorganized topics, a second package continuing the chain, reads in both cases, every listed topic reading back as itself, and both doctors.
There was a problem hiding this comment.
Review
Approval is waiting on one maintainer decision, not on code changes.
This PR's main deltas — the docs tree and navigable docs/search output, and integration templates replacing Core templates — are governed by amendments to current spec records carried in this PR itself (the cli-surface docs-tree invariants and the new current template-replacement record). Under the repository's spec process, a PR that creates or changes a current record needs spec-owner approval for its exact current revision, and any new commit invalidates an earlier approval. The approval on record covers an earlier revision; newer commits superseded it, and the spec-owner approval status for the current revision is still pending, waiting for an engineering owner.
What must be settled: an eligible spec owner — the author is one, via the /approve-spec comment for the current revision, or another owner by review — approves those current-record amendments for this revision. Once that is recorded, this review's other conclusions stand as they are:
- The newest revision strengthens the earlier fixes: one function now decides who holds a docs name, so reads, the topic list, and search agree on every name, and a topic that answers through
replacesto a route the CLI's own docs keep gets a doctor diagnostic naming it, in one package or across a chain of replacements. - The 0.6 JSON contracts are preserved and guarded, the two breaking changes (the
cli-integrationsroute rename and template-replacement selection) carry minor changesets with migration guidance, andthemeTemplate()is now exported, closing a documented parity gap. - The graph-walk, template, pack-check, and compatibility test suites and the repository checks pass locally on this revision, and no concrete defect was found.
[Automated review]
|
/approve-spec f52303d |
There was a problem hiding this comment.
Review
This is ready to merge. The docs graph gives every doc one derived home and one route, every docs and search read now ends with runnable moves, and links between docs are typed by identity instead of hand-written — while the 0.6 JSON contracts (docs(topic) returning the whole topic, --index, and the ReferenceContentBlock union) are preserved and guarded by tests, including the graph walk that opens every doc, move, and link the CLI ships. The spec-owner approval for the current-record amendments in this PR has now been recorded for this revision, so the hold from the previous review is resolved.
Worth knowing for consumers:
- The two breaking changes are labelled as such, with minor changesets and migration guidance:
astryx docs cli-integrationsis nowastryx docs cli/integrationswith no alias (the old name fails with a suggestion of the new route), and a winning integration template replacement removes the Core entry from the default template list, with explicit--package @astryxdesign/coreselection still reaching the original. - Integration authors gain namespace docs and placed guides beside
cli, template replacement with deterministic precedence and fail-closed invalid claims, and a pack check that refuses a package shipping those features whose declared CLI peer range admits a CLI too old to read them — closing the silent doc loss seen on 0.6.3. - Reads, the topic list, and search now agree on who holds a docs name, and a topic that answers through
replacesto a route the CLI's own docs keep gets a doctor diagnostic naming it, in one package or across a chain of replacements. themeTemplate()is now exported from@astryxdesign/cli/api, closing the documented parity gap forastryx theme template.- Doctor's new graph findings warn rather than fail, so projects that passed before keep passing.
The still-open items noted in the PR (text-mode errors not printing the error code, resolved JSON links reading as plain command text, and pack check not itself running the docs checks) are reasonable follow-ups and do not block this change.
[Automated review]
Main's #6626 added the integration-issues check, which runs the validators this PR first added as a new integrations check (as a warning, per AST-046 FR8). This merge drops the duplicate check and keeps the three cases main still reports silently: an installed dependency whose manifest cannot be loaded, roots that are missing on disk, and integrations provider-identity could not read.



One PR for the CLI docs graph, on top of #6695 (merged). It also folds in #6265 (integrations replace Core templates) and #6702 (export
themeTemplate), so there's one review, one spec approval, and one merge.The docs graph
Every doc is a node with a stable identity (its provider, kind, and name) and one home in a tree. Every read is one level and ends with its moves. Links between docs are typed, so the CLI derives every command it shows.
astryx docs cli: Guides (integrations,writing-docs) and Reference (commands,api)astryx docs cli/api/functions/search: one functionastryx docs theme: in text, a topic's sections;astryx docs theme quick-startreads one, and--fullreads it allastryx docs acme: an integration's own namespace, besidecliastryx docs unorganized: every topic that no section places yet, each under its own nameEvery read ends with
Up,Previous,Next, andRelated, and--jsoncarries them aslinks.astryx searchlands on the smallest part that answers (one section or one tree page), with the command that reads it, the command that opens the level above it, and thepackagethat wrote it.Nobody lists children or links by hand. A namespace doc declares its slots and adoption rules; commands and API docs are adopted by the
namespacethey already declare; a guide names its parent withplacement; every other topic sits in Unorganized.JSON keeps its 0.6 shapes
#6695 restored the published 0.6 docs contracts, and this PR keeps every one of them.
docs(topic)andastryx docs <topic> --jsonstill return the whole topic (docs.detail), and--indexreturns its section list.ReferenceContentBlockkeeps its six members, graph-only blocks stay inGraphContentBlockfor namespace docs, and section lookup keeps #6695's legacy order.linksis a new field on each read, andastryx docs --jsonkeepsdataas the topic list, every entry of which reads as a topic; the docs tree's top-level namespaces are in a newmeta.namespaces. The CLI's text changes: a bare text read lists a topic's sections, and the topic list is tree-first.What's in it
foundation/doc-compiler/tree.mjs). A doc's home is its explicitplacement, else exactly one adoption rule, else, for a topic, the generated Unorganized level. A bad placement, two adopters, or two docs at one route is a compiler diagnostic. Each node'sidis its DocId, built from its provider's ProviderId; a generated level such ascli/api/functionsorunorganizedhasid: null.{@link [<provider>:]<kind>:<name>}, in prose, list items, and table cells. Every read prints theastryx docscommand that opens the target. A link without a provider resolves against the provider that wrote its section, so an extension's links open the extension's own docs. A link that names no doc prints as written, and an older CLI prints any link as plain text. The 29 hand-writtenastryx docslinks in the CLI's own docs are now typed links, and so are the command ↔ function links. A typed field's bare name (fn,command,related) resolves among the kinds its field allows;FunctionDoc.relatednames functions only.astryx docsbesidecli, with the same moves, links, and search, named by the integration's provider id. The CLI keeps its own routes (cli,unorganized, and its topics' names, compared without case, as topic names are): an integration namespace or topic that claims one is withdrawn with a diagnostic both doctors show, and the name opens the CLI's doc.astryx integration add doc <name> --parent <namespace>writes a placed guide, and the namespace doc when the package has none; it finds an existing namespace by its name, uses itsguidesslot (or its only slot that takes a guide), and refuses a file of that name that isn't the namespace.astryx docsnames any package whose docs failed to load.astryx doctorwarns on any tree error, a CLI doc with no route, or a link that names no doc;astryx doctor integration docsruns the same checks inside an integration package. These findings are new, so they warn (as fix(cli): preserve 0.6 docs compatibility #6695 requires): a project that passed before keeps passing. For the same reason, rootastryx doctorwarns, rather than fails, on an integration contribution problem;astryx doctor integration validate,docs, andtemplatesfail on it.test/docs-graph.test.mjswalks the graph from the top and opens every topic, section, namespace, and typed doc, following every child, move, and link. It fails on:astryxcommand in the docs, the CLI's hint lines, or AGENTS.md that names a command or option the CLI doesn't have;.doc.mjsthe CLI ships that the walk can't reach.astryx doctor.astryx integration add doc --parentdeclares"@astryxdesign/cli": ">=0.7.0"as an optional peer, andastryx integration pack --checkfails a package that ships a namespace doc or a placed guide when its peer range admits an older CLI. The same gate covers a template that setsreplaces, which AST-035 requires. The peer is optional on purpose: an integration doesn't need the CLI at runtime, and a required peer would install the CLI into every app that uses the package, and fail those installs outright on an older CLI. So this is an author-time gate plus an install-time warning (npm prints an ERESOLVE warning beside 0.6.3; pnpm and yarn warn about the unmet peer). No peer constraint can protect a one-offnpx @astryxdesign/[email protected]run, because that CLI is outside the app's dependency tree. An author who wants installs to fail can mark the peer required; the gate accepts either. A test keeps the 0.7.0 floor honest: it fails if the pending changesets would release the CLI below it.test/authoring-types/reference-content-block.exhaustive.tsis an exhaustive switch overReferenceContentBlockwith aneverdefault. Widening the union (type and schema together) failstypecheck:authoringon that file; restoring it passes.astryx docs cli/writing-docs. It covers how the graph works, how to add, place, and link a doc, how to keep reads short and findable, and how to check your docs.cli/commands/*,cli/api/*) and the Unorganized level have no docsite page yet; that is the docsite phase.Also in this PR
replacesto a Core template id. Unqualified lookup and discovery use a valid replacement;--package @astryxdesign/corestill selects the original. The replacing template keeps its own id and package, andtemplate listshowsreplaces. Missing targets, type mismatches, duplicate claims, and a claim from a template that can't be used (its metadata doesn't load, or it has no type) fail closed and show inastryx doctor integration templates.themeTemplate()is exported from@astryxdesign/cli/api(from feat(cli): export themeTemplate from public API #6702), with runtime and packed-type guards. Its entry leaves the CLI structure check's known-gap list.Agent test
I gave the CLI to AI agents with no context, in an empty project, with the same goals each round: things like the signature of the function behind
astryx search, the error code for an unknown docs section, what a codemod does with a protected file, and how to link docs. From round 5 on, one goal was to write a guide for an integration package so it shows up under the package's own section and links to theastryx doctordocs, then prove it before shipping. A wrapper logged every call. Each round had 3 fresh agents.Round 6 found these, and all are fixed here:
integration addrun in a folder with nopackage.jsonwrote into the app above it. It now refuses and names the package it found.doctor integration docs --helpsaid a broken link exits 1; it warns.packageorparent, guides had no Previous or Next, and some function rows lacked theirname():label.astryx docs doctorgave no suggestion; it now namescli/commands/doctor.astryx initreminder printed inside integration packages.Each fix has a test.
Still open: text-mode errors don't show the error code; JSON prints a resolved link as command text, so a program can't tell it was a link; a typed doc's read doesn't print the
{@link}target that names it; search ranking misses some paraphrases ("protected file");integration pack --checkdoesn't run the docs checks.Spec review
Five reviewers checked the first ready version against AST-046, AST-047, AST-035, the 0.6 compatibility promises, and the CLI rules. They found these, and all are fixed here, each with a test that fails when the fix is taken out:
cli,unorganized, or a CLI topic's name), andastryx doctor integration docsmissed it.integration add doc --parentfound the namespace by its file name, so it could write a broken placement and still print[ok].astryx docs --jsonlisted namespaces indata, where every entry must read as a topic.astryx doctorfailed a project that passed before when an integration had a contribution problem.replaces, so a sibling could take the target.integration pack --checkpassed a package with a placed guide and no CLI peer.parent,--lang denselisted sections where--densereads whole, and a section read of a typed doc suggested nothing.CLI) still took a CLI route; that reading a template doc that doesn't validate could let it print into--jsonoutput; that a namespace placed in a withdrawn namespace stayed in the tree; that a name a topic answers to throughreplacescould be listed as another integration's namespace that it then couldn't open; that after two replacements of one topic, or a chain of them, only the last replaced name was reserved and the CLI's own links to the topic printed as written; and that a topic replacing another could answer to a CLI route, soastryx docs cliopened it. All are fixed too, and reads, the topic list, and search now ask one function who holds a name.Breaking
astryx docs cli-integrationsis nowastryx docs cli/integrations, with no alias. Every reference moved with it, and the graph walk fails on any left behind.Both are in
minorchangesets; the rest arepatch.Merge order
#6616, #6617, and #6695 are merged, and this PR is rebased on main after them. Nothing else is waiting on it.
Not in this PR
A top-level browse, moving the docsite onto the tree, rendering namespace
blocksandcollectionblocks, and the other commands adopting AST-047's moves.Test plan
vitestfor packages/cli: 336 files and 5,403 tests green, including the graph walk, the link tests, and the integration tree tests (a package whose provider id differs from its name, an extension link, a broken link, claims oncli,unorganized, and a CLI topic's name in any case, a namespace placed in a withdrawn one, and every name another topic answers to throughreplaces, including a topic replaced twice and through a chain, with a walk that checks the CLI's own links still open, and a replacement that answers to a CLI route).ReferenceContentBlockfailstypecheck:authoring; restoring it passes.@astryxdesign/[email protected]warns with the optional peer and refuses with a required one.