Skip to content

feat(cli): let integrations replace Core templates - #6265

Closed
josephfarina wants to merge 2 commits into
mainfrom
agentcloud/integration-template-replacements
Closed

josephfarina wants to merge 2 commits into
mainfrom
agentcloud/integration-template-replacements

Conversation

@josephfarina

@josephfarina josephfarina commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

User need

Integration packages can provide a product-specific version of a Core template, but a same-id collision currently makes unqualified lookup ambiguous. Consumers need the installed integration to become the default without losing access to the Core original.

Current specification

spec:AST-017 owns published compatibility and complete CLI response projection. spec:AST-035 records the replacement, default, and precedence policy. Its FR1 says a template declares its own replacement (DEC-3, which supersedes DEC-1), because spec:AST-039 FR11, merged with #6498, forbids per-item maps in the integration manifest. The spec needs the owner's approval on the final head.

Public delta

An integration template declares the Core template it replaces in its own metadata:

// templates/acme-app-shell.doc.mjs
/** @type {import('@astryxdesign/cli/authoring').TemplateDoc} */
export default {
  type: 'page',
  name: 'acme-app-shell',
  displayName: 'Acme App Shell',
  description: 'An app shell with Acme navigation.',
  replaces: 'shell-side-nav',
};
  • astryx template shell-side-nav and default discovery surfaces use acme-app-shell.
  • astryx template shell-side-nav --package @astryxdesign/core still selects Core.
  • astryx template acme-app-shell --package @acme/nav selects the integration template by its own id.
  • Missing targets, wrong template kinds, a declaration on a template that cannot be used, and two declarations for one target in one package fail closed and are errors.
  • Later explicitly configured packages win valid cross-package replacements with a warning. Explicit configuration wins over autolinking.
  • replaces needs @astryxdesign/cli >=0.7.0. Earlier CLIs parse template metadata strictly: on 0.6.3 the package's templates and doc topics are withheld with one warning, while its components still load.

Design and alternatives

The first version kept a templateReplacements map on the integration manifest, so that older CLIs would ignore it instead of rejecting the template. That is a central catalog of per-item data, which AST-039 FR11 now forbids for every kind; the 0.6 theme catalog was removed for the same reason in #6498. The declaration now lives on the template, the same way doc topics declare replaces. The cost is the older-CLI behavior above. Integration themes in 0.7.0 already need a 0.7.0 CLI, so this adds no new kind of break.

Replacement resolution is unchanged. It lives in the shared template catalog, and template lookup, list, search, build suggestions, Project discovery, and block-layout lookup use the same priority rules. Package-scoped views keep shadowed or rejected integration templates for explicit access.

Evidence

Measured on the head before the rebase (a2aaafd), with a kit whose acme-app-shell template sets replaces: 'shell-side-nav', installed in a separate consumer:

  • integration pack --check: packable, zero issues. The local and packed inventories match, and the template entry carries replaces.
  • template --list lists acme-app-shell with replaces: 'shell-side-nav' and omits Core shell-side-nav.
  • template shell-side-nav <dir> copied the Acme source. With --package @astryxdesign/core it copied the Core original (Core AppShell import, no Acme marker).
  • doctor integration templates @acme/nav: one info replacement, zero issues.
  • Released 0.6.3 against the same consumer: one warning and no templates from the package; doctor integration validate reports Unrecognized key: "replaces".

Mutation checks: reading replaces from anywhere but the template fails 23 tests; ignoring a declaration on an unusable template fails 2; a parser without the field fails 20.

The earlier review rounds on this PR covered the resolution rules: precedence, fail-closed states, call order, projections, isolation, and packing. Those rules and their tests are unchanged here, apart from where a declaration is read.

Rebase onto main after #6498

#6498 has merged. This head is rebased on main (ca469c7) as the feature commit plus one commit that adapts it to main:

  • Template metadata is a same-stem .doc.mjs on main now, so the guide's example and the test fixtures use that name.
  • astryx template --skeleton with no name fails as an unknown template again (the replacement lookup needed a name).
  • A withdrawn integration component is reported once, by validation, with its fix. A component doc that fails to load or fails its parser is withdrawn by discovery and reported as a project issue, so the compiler no longer sees it.

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

cd packages/cli && node scripts/sync-api-types.mjs
tsc --noEmit --project tsconfig.api-dts.json   # also tsconfig.strict.json, tsconfig.authoring-contract.json
node scripts/generate-cli-readme.mjs --check
pnpm check:repo
eslint --max-warnings=0 <changed files>
vitest run packages/cli

Results: all passed on this head, rebased on main 34b4692. The CLI suite passed 327 files and 5,166 tests, and the docsite data generation and its tests passed.

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

vercel Bot commented Sep 12, 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 25, 2026 4:17pm UTC

Request Review

@astracat-bot

astracat-bot Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

AI review status for this pull request.

Review status Updated
📝 Draft — not reviewed automatically (for maintainers only) Sep 25, 2026, 4:08 PM UTC

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

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

PR Analysis Report

Preview availability: Storybook and Sandbox are not both ready on the exact-head Vercel preview.

No new or modified components detected.

Bundle Size Summary

No component packages changed.

Accessibility Audit

Status: No accessibility violations detected.

Visual Regression

25 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
Chat Full AI Chat probe light 42,708
Chat Empty State probe light 42,708
Chat Full AI Chat probe dark 41,786
Chat Empty State probe dark 41,786
Slider Default probe light 15,617
Slider Default probe dark 15,615
Chat With Attachments probe light 12,964
Chat With Attachments probe dark 12,114
InputGroup With Typeahead probe light 11,012
InputGroup With Typeahead probe dark 9,189
ComplexSelector Tree list with search probe light 6,245
TextArea Vertical Form Alignment probe light 5,634
ComplexSelector Tree list with search probe dark 5,602
TextArea Vertical Form Alignment probe dark 5,047
ComplexSelector Fruit ripeness selector neutral light 4,007
ComplexSelector Fruit ripeness selector neutral dark 3,825
ToggleButton Group Single probe dark 1,538
ToggleButton Group Single probe light 1,538
MediaTheme On Dark neutral dark 838
Banner Collapsible Content (Expanded) probe dark 92

and 5 more.

Chat — Full AI Chat — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — Empty State — probe light
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame
Chat — Full AI Chat — probe dark
BeforeAfterDiff
Before visual regression frame After visual regression frame Pixel difference frame

Generated by PR Enrichment workflow | View full report

@josephfarina
josephfarina force-pushed the agentcloud/integration-template-replacements branch from 461c948 to a5cdfb3 Compare September 12, 2026 01:52
github-actions Bot added a commit that referenced this pull request Sep 12, 2026
@josephfarina
josephfarina force-pushed the agentcloud/integration-template-replacements branch from a5cdfb3 to 0a2a5c0 Compare September 12, 2026 03:58
@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed the current CodeBunny review and the documentation follow-up:

  • Corrected the stale integration.template-conflicts response inventory and regenerated the CLI README.
  • Added draft spec:AST-035 for the exact replacement, fallback, failure, and precedence policy. I did not self-promote it. The repository only accepts current authority from an authorized CLI/system owner, so owner acceptance or revision is the exact remaining review gate.
  • Expanded astryx docs cli-integrations with exact target-id discovery, declaration syntax, precedence, explicit Core access, fail-closed errors, absent metadata, older-CLI behavior, and a full AppShell example with integration-owned side and top navigation.
  • Aligned the SchemaDoc, public AstryxIntegration type, template command/API docs, generated README, and a new focused docs-contract test.
  • GitHub has no inline review threads on this PR.

Validation on the current rebased files: API DTS, authoring typecheck, knowledge checks, generated README checks, check:repo, changed-file strict lint, full build, and 251 files / 3,880 CLI tests all pass. No implementation finding was rejected.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Latest-main follow-up: rebased onto 16ae26d39c and resolved the generated README plus integration-type overlaps with the newly landed gap-report work. During the rebase audit I found and fixed one missing projection: local integration self-resolution now carries templateReplacements, matching installed integrations. A focused regression test covers it.

Exact-head validation on e63ccd728e24463ced17de790629ae38e5f5f5b8: API DTS, authoring typecheck, knowledge and generated README checks, check:repo, changed-file strict lint, full build, and 254 files / 3,963 CLI tests pass. A local integration CLI proof selected its replacement by the Core alias and own id, while explicit @astryxdesign/core selection still produced the Core original. The authority decision for draft spec:AST-035 remains the only known review gate.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Verified and fixed the package-scoped exact-id repro from the stale review on head c9418eb89d84813e00d6dd4b443bbf67412a1c26.

When one integration both declares acme-app-shell -> shell-side-nav and owns an ordinary shell-side-nav template, unqualified shell-side-nav still selects the active replacement. --package @acme/widgets now uses exact ids only, so package-scoped shell-side-nav selects the ordinary exact-id template and package-scoped acme-app-shell selects the replacement by its own id. It no longer returns ERR_AMBIGUOUS_TEMPLATE.

The regression test exercises all three lookups. Exact-head validation passes: API DTS, authoring typecheck, generated README, check:repo, changed-file strict lint, full build, and 254 files / 3,964 CLI tests. The current-head CodeBunny review is still required; the draft spec:AST-035 authority decision remains explicit.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed the current-head overlapping-replacement finding on 2127432b193d21527ab0bf9a026560dc0d2ea224.

For the accepted graph shell-top-nav -> shell-side-nav plus acme-second-shell -> shell-top-nav, default discovery now keeps both active replacements. shell-side-nav resolves to the first replacement, while shell-top-nav resolves to the second; the first replacement remains available through the Core id it replaced even though its own id is another active target. A regression test verifies both lookups and both effective-list entries.

Exact-head validation passes: API DTS, authoring typecheck, generated README, check:repo, changed-file strict lint, full build, and 254 files / 3,965 CLI tests. Waiting for a CodeBunny review whose head is exactly 2127432b; draft spec:AST-035 authority remains the explicit non-code gate.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed the current-head search/build projection finding on 759413bc3c53dd689166e42cf95af7a615222095.

Search now scores each replacement by its canonical unqualified id, keeps the integration-owned id as a keyword and result label, and emits the canonical command that resolves back to that exact result. In the accepted chain, searching shell-side-nav returns shell-top-nav with astryx template shell-side-nav; searching shell-top-nav returns acme-second-shell with astryx template shell-top-nav. Build consumes the same search results, so its commands stay actionable too.

The cross-projection regression test covers both search results plus both template lookups. Exact-head validation passes: API DTS, authoring typecheck, generated README, check:repo, changed-file strict lint, full build, and 254 files / 3,965 CLI tests. Waiting for CodeBunny at exactly 759413bc; draft spec:AST-035 owner authority remains explicit.

@josephfarina

Copy link
Copy Markdown
Contributor Author

Addressed the current-head build-renderer and stale-base findings on f3f42ec1c062a329c5da62e6f4373e3e66e5c0e2.

Exact-head validation passes: API DTS, authoring typecheck, generated README, check:repo, changed-file strict lint, full build, and 254 files / 3,968 CLI tests. Waiting for CodeBunny at exactly f3f42ec1; draft spec:AST-035 owner authority remains the explicit non-code gate.

github-actions Bot added a commit that referenced this pull request Sep 12, 2026
@josephfarina
josephfarina force-pushed the agentcloud/integration-template-replacements branch from f3f42ec to 6720d5b Compare September 12, 2026 07:53

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

This change is ready to approve.

It lets an integration manifest use templateReplacements to make its template the default for a Core template id, addressing the stated need: "Consumers need the installed integration to become the default without losing access to the Core original." The Core original stays available with --package @astryxdesign/core, invalid declarations fail closed, configured and autolink precedence is deterministic, public JSON responses project the replacement completely, and valid contributions survive unrelated failures.

The governing policy is now in place: the replacement contract, including failure isolation, is committed as a current spec and was approved for this exact revision through the repository's spec-owner gate, and the breaking classification and migration guidance (0.5.3 degradation floor, 0.7.0 selection floor) match the current compatibility spec. Focused tests, type checks, generated-documentation checks, and knowledge checks pass, and no concrete code defect was found.

[Automated review]

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

Changes are requested for one landing blocker; the feature itself and its governing spec are in place.

This change lets an integration manifest use templateReplacements to make its template the default for a Core template id, while keeping the Core original available with --package @astryxdesign/core. Invalid declarations fail closed, configured and autolink precedence is deterministic, public JSON responses project the replacement completely, valid contributions survive unrelated failures, and the replacement contract is now committed as a current spec with the breaking classification and migration guidance (0.5.3 degradation floor, 0.7.0 selection floor) matching the compatibility spec. Focused tests, the JSON type check, and the knowledge check pass, and no concrete code defect was found.

The blocker: the branch currently conflicts with main in docs/architecture/cli-surface.md, where main has since promoted that record to current and strengthened the extensionless-import invariants (INV16/INV17). Please rebase onto current main and resolve that file by keeping main's current frontmatter and INV16/INV17 text while re-applying this change's INV18 wording and the replaces paragraph. Because the spec-owner approval is bound to the exact revision, please also re-run that exact-head approval and the focused checks on the rebased revision — after that, this should be ready to approve without redesign.

[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
Brings the three #6265 commits (the feature, the provider-conflict warning fix,
and the AST-035 acceptance) onto main 3b75f17 as one commit. The only conflict
was cli-surface INV18, now beside main's new INV17 text.
@josephfarina
josephfarina force-pushed the agentcloud/integration-template-replacements branch from 8ea3747 to a2aaafd Compare September 24, 2026 17:53
@github-actions github-actions Bot added the needs:spec-owner-review Current knowledge records await owner approval label Sep 24, 2026
github-actions Bot added a commit that referenced this pull request Sep 24, 2026
github-actions Bot added a commit that referenced this pull request Sep 24, 2026
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
Fixes:
- build-theme targets: replace character-drawn formatTargetsTable with
  records() inline layout (INV23); show className field
- docs list: add package field to text projection
- upgrade --list: render from JSON result via records() instead of API
  logger (was printing undefined, showing PR numbers, missing version)

Deferred (open PRs would conflict):
- template: id, isReady fields (#6265)
- component: themeData, findRelatedBlocks, --blocks fields (#6507)
- component --props: type union in formatProps code block

Guard test (text-json-parity.test.mjs):
- manifest-driven: fails on a new JSON-capable command with no case
- checks text->JSON (record keys, text blocks, list items)
- checks JSON->text (leaf fields by label or per-key value presence)
- per-command allowlist with stale-entry check
An integration template replaces a Core template by naming the Core id in
`replaces`, in the template's own typed `.doc.mjs`; the integration manifest
only points at the templates root. The replacement becomes the default for
that id in template listing, lookup, search, build suggestions, and
block-layout lookup, and `--package @astryxdesign/core` still selects the
original. A missing target, a page replacing a block (or the reverse), a
declaration on a template that cannot be used, and more than one replacement
from one package fail closed: Core stays the default and
`astryx doctor integration templates <package>` reports the error. When
several packages replace one id, the explicitly configured one wins over an
autolinked one, and the later-configured one wins with a warning.

Integration components are validated through the same load-and-parse
boundary as component detail, so invalid metadata removes only that
component and a missing source keeps its fix hint.

Brought onto main after the typed-doc work as one commit: template metadata
is a same-stem `.doc.mjs` now, so the guide's example and the test fixtures
use that name.
- `astryx template --skeleton` with no name fails as an unknown template
  again; the replacement lookup needs a name.
- A withdrawn integration component is reported once, by validation, with
  its fix; discovery no longer reports it a second time without one.
- The compiler tests expect a component doc that fails to load, or fails its
  parser, to be withdrawn by discovery and reported as a project issue.
- The guide's test reads the replacement example at its `.doc.mjs` path, the
  healthy fixture in the discover test is a valid legacy doc (it now needs
  `props`), the discover nudge points at `astryx doctor`, which lists every
  project issue, and the golden search read shows the `--type block` a
  shared template id needs.
@josephfarina

Copy link
Copy Markdown
Contributor Author

Folded into #6626, so there is one PR to review, approve, and merge. Both commits are there unchanged, rebased onto current main. Closing this one.

This branch was successfully deployed

1 active deployment
Preview — 5375b03b Deployed Sep 25, 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:spec-owner-review Current knowledge records await owner approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant