Skip to content

feat(cli): let doc sections include canonical docs - #6768

Merged
josephfarina merged 2 commits into
mainfrom
docs-reference-in-guides
Sep 30, 2026
Merged

josephfarina merged 2 commits into
mainfrom
docs-reference-in-guides

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

User need

Integration guides keep copying canonical CLI docs. A guide that says "set these fields in astryx.integration.mjs" pastes the field table from the manifest schema, and the copy goes stale the next time the schema changes. Same with command options and API functions.

This lets a normal guide section pull in the canonical doc instead of copying it.

Problem and solution fit

A topic section can now hold the existing reference block shape. No new block kind.

{
  title: 'Point the manifest at your folders',
  content: [
    {type: 'prose', text: 'Add these fields to astryx.integration.mjs.'},
    {
      type: 'reference',
      target: '@astryxdesign/cli:schema:integration',
      projection: {fields: ['components', 'docs']},
    },
  ],
}

astryx docs <topic> <section> then prints the two field rows straight from the schema's own doc, then where they came from:

## Point the manifest at your folders

Add these fields to astryx.integration.mjs.

Field      | Type   | Required | Description
---------- | ------ | -------- | -----------
components | string | no       | Relative path to the components/docs root (resolved to absolute). Example: './src/components'.
docs       | string | no       | Relative path to the reference-docs (topics) root (resolved to absolute). ...

From Astryx Integration: `astryx docs authoring integration`
  • A schema, command, function, or enum doc is included as astryx docs prints it. projection.fields keeps only the named fields of a schema, in the order you list them.
  • presentation is full by default. compact drops code blocks. summary is one line with the doc's title, summary, and the command that opens it.
  • Any other doc, like a topic or a guide, shows as that summary line.
  • schema:integration resolves now. The authoring schemas are sections of astryx docs authoring, not tree nodes, so before this they didn't resolve at all.

Current specification

No current record covers doc block types. Draft spec:AST-047 FR9 said a topic's sections hold only the stable blocks, and that reference blocks belong to namespace docs "which a later phase renders". This PR is that later phase, for reference only. I amended that one FR9 sentence to match. workflow and collection stay namespace-only.

Public delta and caller burden

  • Authoring types. ReferenceSection.content is now (ReferenceContentBlock | ReferenceDocBlock)[]. ReferenceContentBlock keeps its six members, so exhaustive renderers written against it don't break.
  • JSON doesn't change shape. A read inlines the reference block the same way it inlines a token-ref, so docs.detail and docs.detail.section still return only the stable block kinds. The docs JSON types pin a read section's content to ReferenceContentBlock[].
  • Checks. A reference block is content, not a link. astryx doctor integration docs fails (invalid_doc_reference) when the target names no doc, a named field doesn't exist, or the doc can't take the projection or presentation. A read marks the gap instead of silently dropping it. A project's astryx doctor only warns, since an app can't fix an integration's docs.
  • An integration names the CLI's docs with the CLI's provider, like @astryxdesign/cli:schema:integration. That's the existing link rule.

Compatibility

A stable CLI before 0.7.0 rejects a topic that holds a reference block, the same way it rejects other docs-tree fields. I didn't add a gate for this one feature. One optional @astryxdesign/cli peer floor for every integration comes as a separate follow-up. Until it lands, integrations shouldn't publish reference blocks. The CLI's own docs can use them now, since they ship with the CLI.

Design and alternatives

  • I kept the reference block in the JSON with a link and content. Rejected. It adds a block kind every JSON consumer and the docsite would have to handle. Inlining it the way token-refs are inlined keeps the contract, and the CLI and docsite render it with no changes.
  • A new "include" block kind. Rejected. The reference block already describes a projection of one doc.
  • Including topic sections with projection.sections. Not in this PR. It needs nested references and token-refs resolved inside the included content. For now it fails the authoring check with a clear message.

Evidence

  • JSON: every read of a topic with reference blocks returns only prose, heading, code, table, and list, in English and zh.
  • The included rows equal the rows astryx docs authoring integration prints for the same fields.
  • Docsite: the generated output matches main except the authoring self-doc text this PR changes. Docsite tests and typecheck pass.

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

  • New api/docs/reference-blocks.test.mjs: the fields projection, reading from the canonical doc, stable kinds in every read, compact and summary, text output, identity resolution for authoring schemas, a clean authoring check, a failing authoring check with one error per gap, visible gaps in a read, and a project doctor warning.
  • Unit tests in links.test.mjs, docs-discovery.test.mjs, and load-contract.test.mjs. A new typecheck:authoring fixture fails if a section takes any other block kind.
  • Full packages/cli suite, typecheck strict/json-api/authoring/template-docs, check:repo, the copyright/exports/README/api-types checks, and docsite generate, test, and typecheck all pass.

Merging with #6737

Both PRs touch some of the same files, like the docs adapter, the authoring checks, and the reference doc type. I merged this commit with #6737's current head. Git merged it with no conflicts, and the full packages/cli suite passes on the merged tree, #6737's rename and version-wording checks included.

@josephfarina

@vercel

vercel Bot commented Sep 29, 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 30, 2026 6:12pm UTC

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Sep 29, 2026
@github-actions github-actions Bot added the needs:design-review Affects visuals — Design should review label Sep 29, 2026
@astracat-bot

astracat-bot Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
❓ Needs maintainer input (for maintainers only) Sep 30, 2026, 6:40 PM UTC

@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR

🧪 Sandbox Preview

View Sandbox for this PR

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

11 of 420 shot(s) changed. View the report

A change here is a question, not a failure: check whether the after is the
picture you intended. Record that review on the PR. Baseline maintenance is an
explicit dispatch of CI; this report never rewrites the baseline or adds a release gate.

component story theme mode pixels
DropdownMenu Default neutral light 640,760
DropdownMenu Default neutral dark 43,588
Chat Default neutral dark 34,710
Chat Default neutral light 34,172
SideNav Resizable in AppShell probe dark 3,208
Chat Full AI Chat probe dark 2,653
Chat Full AI Chat probe light 2,653
Markdown Default probe dark 980
Markdown Default probe light 980
Markdown Default neutral dark 839
Markdown Default neutral light 839
DropdownMenu — Default — neutral light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
DropdownMenu — Default — neutral dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — Default — neutral dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | Storybook | Sandbox | 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 on hold pending a maintainer decision on the governing spec.

This change lets a guide section include a canonical doc (for example, two fields of the integration manifest schema) instead of copying it, and the implementation evidence for that behaviour is solid. However, the only record describing which blocks a topic section may hold is currently a draft, and it says topic sections hold only the stable blocks, with reference blocks belonging to namespace docs for a later phase. No current, approved record was found that authorises reference blocks in topic sections, and the change description notes the same. A maintainer therefore needs to first provide or identify the governing spec for this addition — for example, by promoting the draft record with its amended wording to approved/current status on the main branch, or by identifying a different current record that covers topic-section reference blocks, their projections and presentations, authoring-schema targets, and the new authoring-check failure behaviour. The spec edit inside this PR is a proposal and cannot authorise itself, so approval waits on that maintainer decision rather than on removing or splitting the feature.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 29, 2026
@josephfarina

Copy link
Copy Markdown
Contributor Author

/approve-spec 3151e09

@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 on hold pending a maintainer decision on the governing spec.

This change lets a guide section include a canonical doc (for example, two fields of the integration manifest schema) instead of copying it, and the implementation evidence for that behaviour is solid. However, the only record describing which blocks a topic section may hold is currently a draft, and it says topic sections hold only the stable blocks, with reference blocks belonging to namespace docs for a later phase. No current, approved record was found that authorises reference blocks in topic sections, and the change description notes the same. A maintainer therefore needs to first provide or identify the governing spec for this addition — for example, by promoting the draft record with its amended wording to approved/current status on the main branch, or by identifying a different current record that covers topic-section reference blocks, their projections and presentations, authoring-schema targets, and the new authoring-check failure behaviour. The spec edit inside this PR is a proposal and cannot authorise itself, so approval waits on that maintainer decision rather than on removing or splitting the feature.

[Automated review]

github-actions Bot added a commit that referenced this pull request Sep 30, 2026
@josephfarina
josephfarina merged commit eedc844 into main Sep 30, 2026
45 checks passed
josephfarina added a commit that referenced this pull request Sep 30, 2026
…mponents, and Templates

Reconstructed on 2026-09-30 by replaying the recorded edits from the lost work tree onto this branch. The rendered Templates routes match review draft V16 byte for byte. Also merges current main, which now includes #6768.
@github-actions
github-actions Bot deleted the docs-reference-in-guides branch October 1, 2026 06:25
josephfarina added a commit that referenced this pull request Oct 2, 2026
…ion verify` (#6737)

* cli docs: integration guides, a last pass on every doc, and integration verify

* Audit fixes: old command spelling, search without Core, retitled sections, guide corrections

* Second audit round: build and search ranking, codemod guides, task titles, older-CLI facts

* Round 3: stable-CLI wording, doctor unknown subcommands, rename and version drift tests

* feat(cli): let doc sections include canonical docs

* Restore the integration guide work lost on Sep 29: Make a package, Components, and Templates

Reconstructed on 2026-09-30 by replaying the recorded edits from the lost work tree onto this branch. The rendered Templates routes match review draft V16 byte for byte. Also merges current main, which now includes #6768.

* fix(cli): dedupe sameWord in search, drop duplicated single-component section, regenerate README tables

Co-authored-by: Cursor <[email protected]>

* wip(cli-docs): restructure cli/integrations into phases; add namespace intros; make-a-package -> Quick Start

Co-authored-by: Cursor <[email protected]>

* refactor(cli-docs): rename contribute namespace -> Building Blocks

Co-authored-by: Cursor <[email protected]>

* docs(cli): add Building Blocks intro (what you can add, mix freely)

Co-authored-by: Cursor <[email protected]>

* docs(cli): group Building Blocks into Types and Configuration

Co-authored-by: Cursor <[email protected]>

* docs(cli): make Configuration its own namespace under Building Blocks (types stay top-level)

Co-authored-by: Cursor <[email protected]>

* fix(cli-docs): re-point grade-template-with-agent example routes under building-blocks/templates

Co-authored-by: Cursor <[email protected]>

* docs(cli): replace banned word 'tarball' with '.tgz file' / packed package (keep quoted CLI error)

Co-authored-by: Cursor <[email protected]>

* docs(cli): flatten components (drop single-item Advanced group)

Co-authored-by: Cursor <[email protected]>

* docs(cli): inline overview into describe-the-component, retire overview page, drop 'consumers'

Co-authored-by: Cursor <[email protected]>

* test(cli): migrate doc test expectations to the restructured tree (tree, docs); move devDependency note to quick-start

Co-authored-by: Cursor <[email protected]>

* docs(cli): single-component — one ComponentDoc orientation link up front; drop per-section field embeds (lighter usage/props/examples)

Co-authored-by: Cursor <[email protected]>

* docs(cli): document ComponentDoc `replaces` as a first-class field

- Declare `replaces` on ComponentBaseDoc (type), ComponentBaseSchema
  (validation), and component.doc.mjs (schema doc) so it is a documented
  contract, not a passthrough-only field.
- Fixes the broken `reference` embed in replace-a-core-component (the guide
  embedded fields:['replaces'] but the schema never declared it) — also clears
  a real-tree reference-gap failure in reference-blocks.test.
- replace-a-core-component: drop banned word 'autolink' -> 'the automatic pick'.

Co-authored-by: Cursor <[email protected]>

* docs(cli): start-a-template — lead with the component-vs-template distinction, drop re-definition that echoed the templates landing summary

Co-authored-by: Cursor <[email protected]>

* docs(cli): replace-a-core-template — drop banned words (autolink -> picked automatically / configured explicitly; 'fails closed' -> 'is safe by default')

templates.test asserted 'fails closed' (enforcing a banned word); updated to 'is safe by default' to match.

Co-authored-by: Cursor <[email protected]>

* test(cli): drop brittle templates.test content-assertion (exact-string doc coupling fights editing; re-add non-brittle coverage at the end)

Co-authored-by: Cursor <[email protected]>

* test(cli): remove the integration-docs test suite (content/route-coupled)

These assert exact doc prose, routes, and tree structure, so they break on every
wording tweak or restructure during this authoring pass. Removing them per the
'explore now, add non-brittle tests at the end' plan. Kept reference-blocks.test
(fixture-based embed mechanism, not coupled to our content).

Co-authored-by: Cursor <[email protected]>

* docs(cli): inline template-assets-overview into the Assets namespace intro; retire the separate page (owner-table orientation now opens the namespace, 4 asset guides remain as children)

Co-authored-by: Cursor <[email protected]>

* docs(cli): restructure templates Quality into a 'How to write good templates' namespace

- New write-good-templates namespace: the dissolved template-quality overview
  (what good means + the review loop) is now its intro; children are the rubric
  and grade-with-agent.
- Moved the TEMPLATE_RUBRIC source-of-truth into template-grading-rubric (its
  owner) and gave the rubric the score overview (grade bands + version).
- Reparented template-grading-rubric and grade-template-with-agent under
  write-good-templates; repointed grade-with-agent's import + prompt routes and
  test-template-in-app's link. Retired template-quality.

Co-authored-by: Cursor <[email protected]>

* docs(cli): expand themes into a namespace

Convert the single themes guide into a Themes namespace with an intro and 7
guides: add-a-theme, generate-a-palette, define-the-theme, ship-fonts-and-assets,
use-a-theme-in-an-app, document-the-theme, themes-on-older-clis.

New content from real theme-integration reviews: fonts/keyframes do not travel
with 'theme add' (export ./fonts.css, ship the files, import once, not the root);
light-dark() is colors-only; never set Core --_* private vars; document a theme
by extending the core 'theme' topic (not agentDocs).

Co-authored-by: Cursor <[email protected]>

* docs(cli): rewrite themes to install-and-apply + extends (not copy)

An integration theme is the same shape as a standalone theme package: apps
install the package, apply it with <Theme>, and customize with extends. No copy.

- add-a-theme: scaffold blank, or --from to fork an existing theme as a start
- define-the-theme: add 'build on another theme' with extends
- use-a-theme-in-an-app: install + apply + extend, point to the core theme docs
- document-the-theme: extend the core theme topic (no copy/fonts step)
- remove ship-fonts-and-assets (a copy-only problem)

Matches delegated task T291109887 (agentcloud implementing the CLI to match).

Co-authored-by: Cursor <[email protected]>

* docs(cli): drop themes-on-older-clis guide

Transitional edge case — themes are new in 0.7, so there is no installed base of
theme-consuming apps on older CLIs. The durable action (declare the optional
@astryxdesign/cli peer) already lives in add-a-theme/define-the-theme, and
versioning owns compatibility.

Co-authored-by: Cursor <[email protected]>

* docs(cli): themes — add fonts-and-assets guide (designer learnings)

Ship a theme's fonts and keyframes so they load when an app installs + applies it:
every weight/style, unicode-range, font-display: swap, license, ship the files;
keyframes + sideEffects; and verify in the browser (italic face resolves, no
system fallback, animations run, contrast holds). Linked from the intro and
use-a-theme-in-an-app.

Co-authored-by: Cursor <[email protected]>

* docs(cli): palette preview — 'ship in your package' not 'copy' (install model)

Co-authored-by: Cursor <[email protected]>

* docs(cli): rewrite generate-a-palette for first-time authors

Explain what a palette is, why you generate it from seeds, and how; drop
the confusing 'palette request' term for 'palette config' (matches the
palette.config.json file).

Co-authored-by: Cursor <[email protected]>

* docs(cli): define-the-theme — explain what a token is and why you map palette to tokens

Co-authored-by: Cursor <[email protected]>

* docs(cli): correct themes font model — theme names fonts, app loads them

fonts-and-assets claimed the package ships font files and 'nothing extra in
the app', the opposite of theme.template.ts: Astryx never loads a font file.
Rewrite to name fonts in typography tokens and have the app load them (hosted
link or self-host @font-face). Fix the same error that leaked into
use-a-theme-in-an-app.

Co-authored-by: Cursor <[email protected]>

* docs(cli): document-the-theme — tell users which fonts to load (closes fonts loop)

Co-authored-by: Cursor <[email protected]>

* fix(cli): dedupe reference-problem loop in integration doc checks

A merge left the packageReferenceProblems loop pasted twice in
authoring-checks, so each un-includable reference block was reported
twice (reference-blocks.test: expected 5, got 10). Remove the duplicate.

Co-authored-by: Cursor <[email protected]>

* fix(cli): restore build-kit page matches + fix themes doc link

- buildKit searched limit=60 across all domains; the search titles-tier
  floods multi-word queries with doc matches, burying page templates past
  the cutoff (build.test 'news feed' -> 0 pages). Search wider for
  candidates, cap the surfaced kit to the caller's limit.
- add-a-topic linked {@link generic:themes}, but themes is a namespace now
  (doctor one-route-per-doc failure). Use namespace:themes.
- Remove leftover api/layout generated declarations after main's #6615.

Co-authored-by: Cursor <[email protected]>

* fix(cli): repoint score-ledger to grading-rubric; declare CLI peer in theme fixture

- template-score-ledger imported the deleted template-quality.doc.mjs; the
  TEMPLATE_RUBRIC owner is template-grading-rubric.doc.mjs after the Quality
  restructure.
- pack-check.lifecycle fixture ships a theme with no @astryxdesign/cli peer,
  which themes_need_cli (this PR) flags; declare the peer so the fixture is a
  valid theme package.

Co-authored-by: Cursor <[email protected]>

---------

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

This branch was successfully deployed

1 active deployment
Preview — 3151e09e Deployed Sep 30, 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. needs:design-review Affects visuals — Design should review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant