Repository navigation
feat(cli): let integrations replace Core templates - #6265
josephfarina wants to merge 2 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
AI review status for this pull request.
|
PR Analysis Report
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 | View full report |
461c948 to
a5cdfb3
Compare
a5cdfb3 to
0a2a5c0
Compare
|
Addressed the current CodeBunny review and the documentation follow-up:
Validation on the current rebased files: API DTS, authoring typecheck, knowledge checks, generated README checks, |
0a2a5c0 to
e63ccd7
Compare
|
Latest-main follow-up: rebased onto Exact-head validation on |
e63ccd7 to
c9418eb
Compare
|
Verified and fixed the package-scoped exact-id repro from the stale review on head When one integration both declares The regression test exercises all three lookups. Exact-head validation passes: API DTS, authoring typecheck, generated README, |
c9418eb to
2127432
Compare
|
Addressed the current-head overlapping-replacement finding on For the accepted graph Exact-head validation passes: API DTS, authoring typecheck, generated README, |
2127432 to
759413b
Compare
|
Addressed the current-head search/build projection finding on 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 The cross-projection regression test covers both search results plus both template lookups. Exact-head validation passes: API DTS, authoring typecheck, generated README, |
759413b to
f3f42ec
Compare
|
Addressed the current-head build-renderer and stale-base findings on
Exact-head validation passes: API DTS, authoring typecheck, generated README, |
f3f42ec to
6720d5b
Compare
There was a problem hiding this comment.
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]
There was a problem hiding this comment.
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]
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.
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.
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.
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.
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.
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.
8ea3747 to
a2aaafd
Compare
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.
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.
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.
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.
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.
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.
|
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. |









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-017owns published compatibility and complete CLI response projection.spec:AST-035records the replacement, default, and precedence policy. Its FR1 says a template declares its own replacement (DEC-3, which supersedes DEC-1), becausespec:AST-039FR11, 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:
astryx template shell-side-navand default discovery surfaces useacme-app-shell.astryx template shell-side-nav --package @astryxdesign/corestill selects Core.astryx template acme-app-shell --package @acme/navselects the integration template by its own id.replacesneeds@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
templateReplacementsmap 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 declarereplaces. 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-shelltemplate setsreplaces: 'shell-side-nav', installed in a separate consumer:integration pack --check: packable, zero issues. The local and packed inventories match, and the template entry carriesreplaces.template --listlistsacme-app-shellwithreplaces: 'shell-side-nav'and omits Coreshell-side-nav.template shell-side-nav <dir>copied the Acme source. With--package @astryxdesign/coreit copied the Core original (CoreAppShellimport, no Acme marker).doctor integration templates @acme/nav: oneinforeplacement, zero issues.doctor integration validatereportsUnrecognized key: "replaces".Mutation checks: reading
replacesfrom 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:
.doc.mjson main now, so the guide's example and the test fixtures use that name.astryx template --skeletonwith no name fails as an unknown template again (the replacement lookup needed a name).Scope
Testing
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.