@astryxdesign/cli 0.6.5 → 0.6.6-canary.13d926e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +58 -55
- package/api/build/_adapter.d.mts +55 -2
- package/api/build/_adapter.mjs +100 -10
- package/api/build/build.doc.mjs +2 -2
- package/api/build/build.test.mjs +111 -2
- package/api/build/build.type.d.mts +8 -0
- package/api/build/build.type.mjs +2 -0
- package/api/build/kit/kit.mjs +99 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +603 -0
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +25 -0
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.mjs +7 -1
- package/api/docs/docOverlays.test.mjs +10 -6
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +134 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +46 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +81 -4
- package/api/docs/docs.type.mjs +41 -4
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +337 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +149 -23
- package/api/doctor/_adapter.d.mts +43 -0
- package/api/doctor/_adapter.mjs +142 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +6 -123
- package/api/doctor/theme-checks.d.mts +12 -0
- package/api/doctor/theme-checks.mjs +1117 -0
- package/api/doctor/theme-checks.test.mjs +526 -0
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +27 -3
- package/api/gap-report/gap-report.test.mjs +106 -0
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +10 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +354 -28
- package/api/integration/add-theme.test.mjs +380 -16
- package/api/integration/authoring-checks.mjs +31 -8
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +495 -4
- package/api/integration/pack-check.test.mjs +619 -10
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +39 -8
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +248 -66
- package/api/search/search.test.mjs +829 -0
- package/api/search/search.type.d.mts +6 -6
- package/api/search/search.type.mjs +5 -5
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +95 -13
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +4 -0
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +15 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +17 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +2 -0
- package/api/template/template.type.d.mts +14 -0
- package/api/template/template.type.mjs +5 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +50 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +463 -155
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +15 -4
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +5 -0
- package/api/upgrade/upgrade.type.mjs +2 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/next/index.mjs +14 -1
- package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +161 -0
- package/assets/docs/getting-started.doc.mjs +59 -15
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/principles.doc.dense.mjs +2 -2
- package/assets/docs/principles.doc.mjs +2 -2
- package/assets/docs/principles.doc.zh.mjs +2 -2
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/styling.doc.mjs +2 -2
- package/assets/docs/theme.doc.dense.mjs +10 -198
- package/assets/docs/theme.doc.mjs +13 -770
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tokens.doc.mjs +4 -4
- package/assets/docs/tree/add-a-theme.doc.mjs +6 -2
- package/assets/docs/tree/add-a-topic.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +1 -1
- package/assets/docs/tree/define-the-theme.doc.mjs +2 -2
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +68 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +32 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/responsive.doc.mjs +102 -0
- package/assets/docs/tree/scaffold.doc.mjs +145 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
- package/assets/docs/tree/side-panels.doc.mjs +82 -0
- package/assets/docs/tree/structure.doc.mjs +144 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +13 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +13 -5
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +11 -7
- package/assets/docs/use-a-theme.doc.mjs +209 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +279 -30
- package/clients/cli/commands/build.mjs +7 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +88 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +273 -16
- package/clients/cli/commands/docs.test.mjs +382 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +4 -4
- package/clients/cli/commands/doctor.test.mjs +9 -51
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -0
- package/clients/cli/commands/layout-expand.doc.mjs +4 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
- package/clients/cli/commands/layout.doc.mjs +1 -0
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +61 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +63 -17
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +70 -6
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +44 -0
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +4 -1
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +31 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1163 -0
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/discovery/theme-discovery.d.mts +78 -5
- package/foundation/discovery/theme-discovery.mjs +143 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +18 -8
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +79 -13
- package/foundation/integrations/cli-requirement.mjs +115 -22
- package/foundation/integrations/cli-requirement.test.mjs +205 -8
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +50 -35
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
} from '../../lib/hook-format.mjs';
|
|
15
15
|
import {getCliInvocation} from '../../../../foundation/env/package-manager.mjs';
|
|
16
16
|
import {jsonOut} from '../../../../foundation/response/json.mjs';
|
|
17
|
-
import {emit, section, text, list, records, code} from '../../formatters/index.mjs';
|
|
17
|
+
import {emit, section, text, list, records, code, record} from '../../formatters/index.mjs';
|
|
18
18
|
import {cliError} from '../../lib/cli-error.mjs';
|
|
19
19
|
import {defineCommand} from '../../lib/define-command.mjs';
|
|
20
20
|
import {resultSet} from '../../../../foundation/debug/index.mjs';
|
|
@@ -103,6 +103,7 @@ export function registerHook(program) {
|
|
|
103
103
|
// ── Text output ────────────────────────────────────────────
|
|
104
104
|
switch (result.type) {
|
|
105
105
|
case 'hook.list': {
|
|
106
|
+
emit(record({package: result.package}));
|
|
106
107
|
// One list type across all three detail levels; the depth is carried
|
|
107
108
|
// in result.data.detail and the grouped map in result.data.components.
|
|
108
109
|
if (result.data.detail === 'full') {
|
|
@@ -172,6 +173,7 @@ export function registerHook(program) {
|
|
|
172
173
|
// under `component <name> --blocks`.
|
|
173
174
|
const related = result.data.relatedComponents ?? [];
|
|
174
175
|
emit(
|
|
176
|
+
record({package: result.package}),
|
|
175
177
|
code(doc),
|
|
176
178
|
related.length > 0 &&
|
|
177
179
|
text(
|
|
@@ -182,7 +184,10 @@ export function registerHook(program) {
|
|
|
182
184
|
}
|
|
183
185
|
|
|
184
186
|
case 'hook.detail.params': {
|
|
185
|
-
emit(
|
|
187
|
+
emit(
|
|
188
|
+
record({package: result.package}),
|
|
189
|
+
code(formatHookParams({params: result.data, name})),
|
|
190
|
+
);
|
|
186
191
|
break;
|
|
187
192
|
}
|
|
188
193
|
}
|
|
@@ -85,7 +85,7 @@ describe('import hint correctness', () => {
|
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
describe('CLI --detail
|
|
88
|
+
describe('CLI --detail compact shows correct import path', () => {
|
|
89
89
|
// Test a representative set across different patterns
|
|
90
90
|
const representative = [
|
|
91
91
|
{name: 'Button', expected: '@astryxdesign/core/Button'},
|
|
@@ -101,8 +101,8 @@ describe('import hint correctness', () => {
|
|
|
101
101
|
];
|
|
102
102
|
|
|
103
103
|
for (const {name, expected} of representative) {
|
|
104
|
-
it(`npx astryx component ${name} --detail
|
|
105
|
-
const result = await runCli(['component', name, '--detail', '
|
|
104
|
+
it(`npx astryx component ${name} --detail compact shows ${expected}`, async () => {
|
|
105
|
+
const result = await runCli(['component', name, '--detail', 'compact'], REPO_ROOT);
|
|
106
106
|
expect(result.code).toBe(0);
|
|
107
107
|
expect(result.stdout).toContain(expected);
|
|
108
108
|
});
|
|
@@ -179,11 +179,11 @@ describe('import hint correctness', () => {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
it('component <Name> --detail
|
|
182
|
+
it('component <Name> --detail compact also shows the integration package', async () => {
|
|
183
183
|
const fixtureDir = createIntegrationFixture();
|
|
184
184
|
try {
|
|
185
185
|
const result = await runCli(
|
|
186
|
-
['component', 'Widget', '--detail', '
|
|
186
|
+
['component', 'Widget', '--detail', 'compact'],
|
|
187
187
|
fixtureDir,
|
|
188
188
|
);
|
|
189
189
|
expect(result.code).toBe(0);
|
|
@@ -1,22 +1,11 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Regression
|
|
4
|
+
* @file Regression tests for `astryx init` app-theme next steps.
|
|
5
5
|
*
|
|
6
|
-
* The
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* import { neutralTheme } from '@astryxdesign/theme-neutral'
|
|
10
|
-
* <Theme theme={neutralTheme}>...</Theme>
|
|
11
|
-
*
|
|
12
|
-
* ...which contradicted the runtime console warning emitted by core's
|
|
13
|
-
* <Theme> component (packages/core/src/theme/Theme.tsx) recommending the
|
|
14
|
-
* pre-built path, and left users with an unstyled app because the base CSS
|
|
15
|
-
* imports were never mentioned (facebook/astryx#3080).
|
|
16
|
-
*
|
|
17
|
-
* These assertions lock in the corrected guidance: base CSS imports, the
|
|
18
|
-
* pre-built (`/built` + `theme.css`) theme path, and the custom-theme build
|
|
19
|
-
* command.
|
|
6
|
+
* The guidance follows the generated-module workflow: base CSS once, add an
|
|
7
|
+
* installed theme, import the generated record once, extend to customize, and
|
|
8
|
+
* eject only to make an independent source fork.
|
|
20
9
|
*/
|
|
21
10
|
|
|
22
11
|
import {describe, it, expect} from 'vitest';
|
|
@@ -30,17 +19,23 @@ describe('init Next steps theme guidance', () => {
|
|
|
30
19
|
expect(text).toContain("'@astryxdesign/core/astryx.css'");
|
|
31
20
|
});
|
|
32
21
|
|
|
33
|
-
it('
|
|
34
|
-
expect(text).toContain(
|
|
35
|
-
expect(text).toContain(
|
|
22
|
+
it('adds an installed theme through the CLI', () => {
|
|
23
|
+
expect(text).toContain('npm install @astryxdesign/theme-neutral');
|
|
24
|
+
expect(text).toContain('npx astryx theme add neutral --import');
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('wires the generated theme record once', () => {
|
|
28
|
+
expect(text).toContain("{ themes, defaultThemeSlug } from './astryx-themes'");
|
|
29
|
+
expect(text).toContain('themes[defaultThemeSlug]');
|
|
36
30
|
});
|
|
37
31
|
|
|
38
|
-
it('
|
|
39
|
-
expect(text).toContain('
|
|
32
|
+
it('names extension for customization and eject only for a source fork', () => {
|
|
33
|
+
expect(text).toContain('Extend an imported theme');
|
|
34
|
+
expect(text).toContain('npx astryx theme eject <slug>');
|
|
35
|
+
expect(text).toContain('only to fork source');
|
|
40
36
|
});
|
|
41
37
|
|
|
42
|
-
it('does not
|
|
43
|
-
|
|
44
|
-
expect(text).not.toContain("from '@astryxdesign/theme-neutral'");
|
|
38
|
+
it('does not teach a direct package theme import', () => {
|
|
39
|
+
expect(text).not.toContain("from '@astryxdesign/theme-neutral");
|
|
45
40
|
});
|
|
46
41
|
});
|
|
@@ -56,6 +56,12 @@ export const doc = {
|
|
|
56
56
|
description:
|
|
57
57
|
"Namespace of this package to place the doc in, as a guide in its `guides` slot; writes the namespace doc when it is missing, and declares the CLI that reads it as an optional `@astryxdesign/cli` peer. Only valid for doc, and not with --replaces or --extends",
|
|
58
58
|
},
|
|
59
|
+
{
|
|
60
|
+
flag: '--from <theme>',
|
|
61
|
+
param: 'options.from',
|
|
62
|
+
description:
|
|
63
|
+
'Existing theme slug to fork as a starting point instead of a blank scaffold; the new theme copies the base and has no link back, and package.json `dependencies` gains the npm packages the copied files import (other than Core and React). Only valid for theme',
|
|
64
|
+
},
|
|
59
65
|
{
|
|
60
66
|
flag: '--to <version>',
|
|
61
67
|
param: 'options.to',
|
|
@@ -102,6 +108,10 @@ export const doc = {
|
|
|
102
108
|
cli: "astryx integration add agent-doc 'Run acme verify before finishing.'",
|
|
103
109
|
},
|
|
104
110
|
{label: 'Add a source theme', cli: 'astryx integration add theme ocean'},
|
|
111
|
+
{
|
|
112
|
+
label: 'Fork an existing theme',
|
|
113
|
+
cli: 'astryx integration add theme ocean --from neutral',
|
|
114
|
+
},
|
|
105
115
|
],
|
|
106
116
|
exitCodes: [
|
|
107
117
|
{code: 0, when: 'the contribution is written or the dry run succeeds'},
|
|
@@ -174,11 +174,21 @@ describe('integration authoring CLI', () => {
|
|
|
174
174
|
expect(text.stdout).toBe(verifyText.stdout);
|
|
175
175
|
expect(text.stderr).toContain('`integration pack --check` is deprecated');
|
|
176
176
|
expect(text.stderr).toContain('astryx integration verify');
|
|
177
|
-
// Without --check it fails, as it did, and
|
|
177
|
+
// Without --check it fails, as it did, and points only at the new name:
|
|
178
|
+
// suggesting `--check` would send people to the deprecated spelling.
|
|
178
179
|
const bare = await runCli(['integration', 'pack'], tmpDir);
|
|
179
180
|
expect(bare.status).not.toBe(0);
|
|
180
|
-
expect(bare.stderr).toContain(
|
|
181
|
+
expect(bare.stderr).toContain(
|
|
182
|
+
'`integration pack` is now `integration verify`',
|
|
183
|
+
);
|
|
181
184
|
expect(bare.stderr).toContain('astryx integration verify');
|
|
185
|
+
expect(bare.stderr).toContain('npm pack');
|
|
186
|
+
expect(bare.stderr).not.toContain('--check');
|
|
187
|
+
const bareJson = await runCli(['--json', 'integration', 'pack'], tmpDir);
|
|
188
|
+
expect(parseEnvelope(bareJson.stdout)).toMatchObject({
|
|
189
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
190
|
+
error: expect.stringContaining('astryx integration verify'),
|
|
191
|
+
});
|
|
182
192
|
// Help lists it, marked deprecated: nothing is hidden.
|
|
183
193
|
const help = await runCli(['integration', '--help'], tmpDir);
|
|
184
194
|
expect(help.stdout).toMatch(
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Real package-boundary coverage for integration authoring. Authors a
|
|
5
5
|
* provider through the CLI, packs it, installs the tarball into a separate
|
|
6
|
-
* no-config consumer, then exercises packed docs, codemods,
|
|
6
|
+
* no-config consumer, then exercises packed docs, codemods, built themes, and
|
|
7
|
+
* explicit source ejection.
|
|
7
8
|
*/
|
|
8
9
|
|
|
9
10
|
import {afterEach, describe, expect, it} from 'vitest';
|
|
@@ -201,6 +202,15 @@ export const oceanTheme = defineTheme({
|
|
|
201
202
|
});
|
|
202
203
|
`,
|
|
203
204
|
);
|
|
205
|
+
const providerBuild = await runCli(
|
|
206
|
+
['theme', 'build', 'themes/ocean/oceanTheme.ts', '--json'],
|
|
207
|
+
providerDir,
|
|
208
|
+
);
|
|
209
|
+
expect(providerBuild.status, providerBuild.stderr).toBe(0);
|
|
210
|
+
expect(parseEnvelope(providerBuild.stdout)).toMatchObject({
|
|
211
|
+
type: 'theme.build',
|
|
212
|
+
data: {name: 'ocean'},
|
|
213
|
+
});
|
|
204
214
|
|
|
205
215
|
const providerPackage = JSON.parse(
|
|
206
216
|
fs.readFileSync(path.join(providerDir, 'package.json'), 'utf-8'),
|
|
@@ -313,8 +323,8 @@ export const oceanTheme = defineTheme({
|
|
|
313
323
|
expect(fs.lstatSync(alternateInstalledDir).isSymbolicLink()).toBe(false);
|
|
314
324
|
|
|
315
325
|
// The consumer installs both providers from tarballs. Link this checkout's
|
|
316
|
-
// Core package as the consumer's normal app dependency so
|
|
317
|
-
// can
|
|
326
|
+
// Core package as the consumer's normal app dependency so an ejected source
|
|
327
|
+
// can build against the same peer it would get from `npm install @astryxdesign/core`.
|
|
318
328
|
const coreScope = path.join(consumerDir, 'node_modules', '@astryxdesign');
|
|
319
329
|
const coreLink = path.join(coreScope, 'core');
|
|
320
330
|
fs.mkdirSync(coreScope, {recursive: true});
|
|
@@ -427,7 +437,7 @@ export const oceanTheme = defineTheme({
|
|
|
427
437
|
}
|
|
428
438
|
|
|
429
439
|
const ambiguous = await runCli(
|
|
430
|
-
['theme', 'add', 'ocean', '
|
|
440
|
+
['theme', 'add', 'ocean', '--json'],
|
|
431
441
|
consumerDir,
|
|
432
442
|
);
|
|
433
443
|
expect(ambiguous.status).not.toBe(0);
|
|
@@ -435,11 +445,50 @@ export const oceanTheme = defineTheme({
|
|
|
435
445
|
code: 'ERR_AMBIGUOUS_THEME',
|
|
436
446
|
});
|
|
437
447
|
|
|
448
|
+
const addedTheme = await runCli(
|
|
449
|
+
[
|
|
450
|
+
'theme',
|
|
451
|
+
'add',
|
|
452
|
+
'ocean',
|
|
453
|
+
'--import',
|
|
454
|
+
'--package',
|
|
455
|
+
'@acme/brand-integration',
|
|
456
|
+
'--json',
|
|
457
|
+
],
|
|
458
|
+
consumerDir,
|
|
459
|
+
);
|
|
460
|
+
expect(addedTheme.status, addedTheme.stderr).toBe(0);
|
|
461
|
+
expect(parseEnvelope(addedTheme.stdout)).toMatchObject({
|
|
462
|
+
type: 'theme.app',
|
|
463
|
+
data: {
|
|
464
|
+
default: 'ocean',
|
|
465
|
+
change: {action: 'add', slug: 'ocean', changed: true},
|
|
466
|
+
themes: [
|
|
467
|
+
{
|
|
468
|
+
slug: 'ocean',
|
|
469
|
+
owner: '@acme/brand-integration',
|
|
470
|
+
module: '@acme/brand-integration/themes/ocean',
|
|
471
|
+
stylesheet: '@acme/brand-integration/themes/ocean.css',
|
|
472
|
+
},
|
|
473
|
+
],
|
|
474
|
+
},
|
|
475
|
+
});
|
|
476
|
+
const generatedModule = fs.readFileSync(
|
|
477
|
+
path.join(consumerDir, 'src', 'astryx-themes.js'),
|
|
478
|
+
'utf-8',
|
|
479
|
+
);
|
|
480
|
+
expect(generatedModule).toContain(
|
|
481
|
+
'from "@acme/brand-integration/themes/ocean"',
|
|
482
|
+
);
|
|
483
|
+
expect(generatedModule).toContain(
|
|
484
|
+
'import "@acme/brand-integration/themes/ocean.css"',
|
|
485
|
+
);
|
|
486
|
+
|
|
438
487
|
const target = path.join('src', 'themes', 'acme-ocean');
|
|
439
488
|
const copied = await runCli(
|
|
440
489
|
[
|
|
441
490
|
'theme',
|
|
442
|
-
'
|
|
491
|
+
'eject',
|
|
443
492
|
'ocean',
|
|
444
493
|
target,
|
|
445
494
|
'--package',
|
|
@@ -450,17 +499,17 @@ export const oceanTheme = defineTheme({
|
|
|
450
499
|
);
|
|
451
500
|
expect(copied.status, copied.stderr).toBe(0);
|
|
452
501
|
expect(parseEnvelope(copied.stdout)).toMatchObject({
|
|
453
|
-
type: 'theme.
|
|
502
|
+
type: 'theme.eject',
|
|
454
503
|
data: {
|
|
455
504
|
slug: 'ocean',
|
|
456
505
|
package: '@acme/brand-integration',
|
|
457
506
|
outputDir: target,
|
|
458
|
-
files: [
|
|
507
|
+
files: expect.arrayContaining([
|
|
459
508
|
'oceanTheme.ts',
|
|
460
509
|
'oceanTheme.doc.mjs',
|
|
461
510
|
'tokens/ocean.palette.receipt.json',
|
|
462
511
|
'tokens/ocean.palette.ts',
|
|
463
|
-
],
|
|
512
|
+
]),
|
|
464
513
|
},
|
|
465
514
|
});
|
|
466
515
|
expect(
|
|
@@ -501,7 +550,7 @@ export const oceanTheme = defineTheme({
|
|
|
501
550
|
const duplicate = await runCli(
|
|
502
551
|
[
|
|
503
552
|
'theme',
|
|
504
|
-
'
|
|
553
|
+
'eject',
|
|
505
554
|
'ocean',
|
|
506
555
|
target,
|
|
507
556
|
'--package',
|
|
@@ -517,7 +566,7 @@ export const oceanTheme = defineTheme({
|
|
|
517
566
|
const overwritten = await runCli(
|
|
518
567
|
[
|
|
519
568
|
'theme',
|
|
520
|
-
'
|
|
569
|
+
'eject',
|
|
521
570
|
'ocean',
|
|
522
571
|
target,
|
|
523
572
|
'--package',
|
|
@@ -528,7 +577,7 @@ export const oceanTheme = defineTheme({
|
|
|
528
577
|
consumerDir,
|
|
529
578
|
);
|
|
530
579
|
expect(overwritten.status, overwritten.stderr).toBe(0);
|
|
531
|
-
expect(parseEnvelope(overwritten.stdout).type).toBe('theme.
|
|
580
|
+
expect(parseEnvelope(overwritten.stdout).type).toBe('theme.eject');
|
|
532
581
|
|
|
533
582
|
const installedCodemod = path.join(
|
|
534
583
|
installedDir,
|
|
@@ -594,7 +643,7 @@ export const oceanTheme = defineTheme({
|
|
|
594
643
|
const corruptedInstall = await runCli(
|
|
595
644
|
[
|
|
596
645
|
'theme',
|
|
597
|
-
'
|
|
646
|
+
'eject',
|
|
598
647
|
'ocean',
|
|
599
648
|
'src/themes/corrupted',
|
|
600
649
|
'--package',
|
|
@@ -115,6 +115,7 @@ export function registerIntegration(program) {
|
|
|
115
115
|
extends: options.extends,
|
|
116
116
|
parent: options.parent,
|
|
117
117
|
to: options.to,
|
|
118
|
+
from: options.from,
|
|
118
119
|
});
|
|
119
120
|
} catch (error) {
|
|
120
121
|
const err =
|
|
@@ -168,8 +169,9 @@ export function registerIntegration(program) {
|
|
|
168
169
|
fn: integrationPackCheckFn,
|
|
169
170
|
action: async options => {
|
|
170
171
|
if (!options.check) {
|
|
172
|
+
// One way forward: the new name. `npm pack` is what builds a tarball.
|
|
171
173
|
return cliError(
|
|
172
|
-
'
|
|
174
|
+
'`integration pack` is now `integration verify`: run `astryx integration verify` to check the package the way npm will publish it. To build the tarball, run `npm pack`.',
|
|
173
175
|
{code: ERROR_CODES.ERR_INVALID_ARGUMENT},
|
|
174
176
|
);
|
|
175
177
|
}
|
|
@@ -61,5 +61,6 @@ export const doc = {
|
|
|
61
61
|
when: 'the expression is invalid, empty or over 5 MB (from stdin or --file), has a syntax error, or a bad --form',
|
|
62
62
|
},
|
|
63
63
|
],
|
|
64
|
+
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
64
65
|
related: ['layout expand', 'layout grammar'],
|
|
65
66
|
};
|
|
@@ -18,7 +18,9 @@ export const doc = {
|
|
|
18
18
|
description:
|
|
19
19
|
'Parses and validates a compressed XLE/XLO expression, then expands it into ' +
|
|
20
20
|
'ready-to-use XDS TSX, routing children into slots, scaffolding typed useState for ' +
|
|
21
|
-
'interactive controls, and splicing referenced blocks. Writes to a path, or returns the code.'
|
|
21
|
+
'interactive controls, and splicing referenced blocks. Writes to a path, or returns the code. ' +
|
|
22
|
+
'Astryx demo media in a spliced block becomes a placeholder, and the output says how many ' +
|
|
23
|
+
'references were replaced (as a closing line comment when it prints the code).',
|
|
22
24
|
fn: 'layoutExpand',
|
|
23
25
|
args: [
|
|
24
26
|
{
|
|
@@ -79,5 +81,6 @@ export const doc = {
|
|
|
79
81
|
when: 'a missing, empty or over-5 MB expression (from stdin or --file), a bad --name or --form, a parse/validation error, or a path escape',
|
|
80
82
|
},
|
|
81
83
|
],
|
|
84
|
+
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
82
85
|
related: ['layout check', 'layout grammar'],
|
|
83
86
|
};
|
|
@@ -26,5 +26,6 @@ export const doc = {
|
|
|
26
26
|
{code: 0, when: 'success'},
|
|
27
27
|
{code: 1, when: 'the component registry cannot be read'},
|
|
28
28
|
],
|
|
29
|
+
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
29
30
|
related: ['layout expand', 'layout check'],
|
|
30
31
|
};
|
|
@@ -30,5 +30,6 @@ export const doc = {
|
|
|
30
30
|
{code: 0, when: 'a subcommand succeeded, or --help'},
|
|
31
31
|
{code: 1, when: 'no subcommand (help is printed) or an unknown subcommand'},
|
|
32
32
|
],
|
|
33
|
+
deprecated: 'DEP-0006: Use `astryx build` to start from a template, `astryx template` to scaffold, and `astryx docs layout` for guidance.',
|
|
33
34
|
related: ['template', 'build'],
|
|
34
35
|
};
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx layout expand` tells the caller, in JSON and in text, when demo
|
|
5
|
+
* media in a spliced template block was replaced with placeholders. Printed
|
|
6
|
+
* code stays verbatim and valid TSX: the disclosure follows it as a comment.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
14
|
+
import {discoverTemplates} from '../../../api/template/template.mjs';
|
|
15
|
+
|
|
16
|
+
const SLOW = 60_000;
|
|
17
|
+
const DISCLOSURE = /demo media/i;
|
|
18
|
+
|
|
19
|
+
/** @param {string} name */
|
|
20
|
+
const hintKey = name => name.toLowerCase().replace(/[^a-z0-9]/g, '');
|
|
21
|
+
|
|
22
|
+
/** @param {string} source */
|
|
23
|
+
const tsxErrors = source =>
|
|
24
|
+
/** @type {any} */ (
|
|
25
|
+
ts.createSourceFile('out.tsx', source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX)
|
|
26
|
+
).parseDiagnostics.map((/** @type {ts.Diagnostic} */ d) =>
|
|
27
|
+
ts.flattenDiagnosticMessageText(d.messageText, ' '),
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
/** A `{hint}` for a template block whose source carries demo media. */
|
|
31
|
+
async function mediaBlockHint() {
|
|
32
|
+
const blocks = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
|
|
33
|
+
await discoverTemplates()
|
|
34
|
+
).filter(t => t.type === 'block' && t.filePath && fs.existsSync(t.filePath));
|
|
35
|
+
const seen = new Map();
|
|
36
|
+
for (const t of blocks) seen.set(hintKey(t.dirName), (seen.get(hintKey(t.dirName)) ?? 0) + 1);
|
|
37
|
+
const found = blocks.find(
|
|
38
|
+
t =>
|
|
39
|
+
seen.get(hintKey(t.dirName)) === 1 &&
|
|
40
|
+
/\/template-assets\/[\w.-]+\.\w+/.test(fs.readFileSync(t.filePath, 'utf-8')),
|
|
41
|
+
);
|
|
42
|
+
if (!found) throw new Error('no template block carries demo media');
|
|
43
|
+
return hintKey(found.dirName);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describe('layout expand discloses replaced demo media', () => {
|
|
47
|
+
let cwd;
|
|
48
|
+
beforeEach(() => {
|
|
49
|
+
// Inside the workspace so @astryxdesign/core resolves.
|
|
50
|
+
cwd = fs.mkdtempSync(path.join(process.cwd(), '.xle-media-receipt-'));
|
|
51
|
+
});
|
|
52
|
+
afterEach(() => fs.rmSync(cwd, {recursive: true, force: true}));
|
|
53
|
+
|
|
54
|
+
it('--json carries demoMediaReplaced; the text receipt states it for the written file', async () => {
|
|
55
|
+
const expr = `V > {${await mediaBlockHint()}}`;
|
|
56
|
+
const json = await runCli(['layout', 'expand', expr, './a', '--json'], cwd);
|
|
57
|
+
expect(json.status).toBe(0);
|
|
58
|
+
const {data} = JSON.parse(json.stdout);
|
|
59
|
+
expect(data.demoMediaReplaced).toBeGreaterThan(0);
|
|
60
|
+
|
|
61
|
+
const human = await runCli(['layout', 'expand', expr, './b'], cwd);
|
|
62
|
+
expect(human.status).toBe(0);
|
|
63
|
+
expect(human.stdout).toContain(
|
|
64
|
+
`Replaced ${data.demoMediaReplaced} Astryx demo media reference`,
|
|
65
|
+
);
|
|
66
|
+
expect(human.stdout).toContain(path.join('b', 'GeneratedLayout.tsx'));
|
|
67
|
+
}, SLOW);
|
|
68
|
+
|
|
69
|
+
it('prints the code verbatim, then states the count in a comment that keeps it valid TSX', async () => {
|
|
70
|
+
const expr = `V > {${await mediaBlockHint()}}`;
|
|
71
|
+
const {data} = JSON.parse((await runCli(['layout', 'expand', expr, '--json'], cwd)).stdout);
|
|
72
|
+
|
|
73
|
+
const human = await runCli(['layout', 'expand', expr], cwd);
|
|
74
|
+
expect(human.status).toBe(0);
|
|
75
|
+
expect(human.stdout.startsWith(data.code)).toBe(true);
|
|
76
|
+
expect(human.stdout.slice(data.code.length).trim()).toMatch(
|
|
77
|
+
new RegExp(`^// Replaced ${data.demoMediaReplaced} Astryx demo media references? in the code above: [^\\n]+$`),
|
|
78
|
+
);
|
|
79
|
+
expect(tsxErrors(human.stdout)).toEqual([]);
|
|
80
|
+
}, SLOW);
|
|
81
|
+
|
|
82
|
+
it('says nothing about demo media when none was replaced', async () => {
|
|
83
|
+
const json = await runCli(['layout', 'expand', 'V > B"Save"', '--json'], cwd);
|
|
84
|
+
const {data} = JSON.parse(json.stdout);
|
|
85
|
+
expect(data.demoMediaReplaced).toBe(0);
|
|
86
|
+
|
|
87
|
+
const written = await runCli(['layout', 'expand', 'V > B"Save"', './a'], cwd);
|
|
88
|
+
expect(written.status).toBe(0);
|
|
89
|
+
expect(written.stdout).not.toMatch(DISCLOSURE);
|
|
90
|
+
const printed = await runCli(['layout', 'expand', 'V > B"Save"'], cwd);
|
|
91
|
+
expect(printed.status).toBe(0);
|
|
92
|
+
expect(printed.stdout).toBe(`${data.code}\n`);
|
|
93
|
+
}, SLOW);
|
|
94
|
+
});
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
import * as fs from 'node:fs';
|
|
20
20
|
import * as path from 'node:path';
|
|
21
|
-
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
21
|
+
import {jsonOut, isJsonMode} from '../../../foundation/response/json.mjs';
|
|
22
22
|
import {emit, section, text, list, record, code, WARN} from '../formatters/index.mjs';
|
|
23
23
|
import {cliError} from '../lib/cli-error.mjs';
|
|
24
24
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
@@ -59,6 +59,44 @@ import {NO_RESULT_SET, resultSet} from '../../../foundation/debug/index.mjs';
|
|
|
59
59
|
* @property {boolean} [loose]
|
|
60
60
|
*/
|
|
61
61
|
|
|
62
|
+
/**
|
|
63
|
+
* DEP-0006: the `astryx layout` command group is deprecated.
|
|
64
|
+
*
|
|
65
|
+
* Human mode: one stderr warning per invocation.
|
|
66
|
+
* JSON mode: `meta.deprecation` in the response envelope.
|
|
67
|
+
*/
|
|
68
|
+
const DEPRECATION = {
|
|
69
|
+
id: 'DEP-0006',
|
|
70
|
+
cleanup: 'CLN-0006',
|
|
71
|
+
replacement: [
|
|
72
|
+
'astryx build "<idea>" — choose the template to start from',
|
|
73
|
+
'astryx template <name> <path> — scaffold it',
|
|
74
|
+
'astryx docs layout — layout guidance',
|
|
75
|
+
],
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
function warnDeprecated() {
|
|
79
|
+
if (!isJsonMode()) {
|
|
80
|
+
console.error(
|
|
81
|
+
'[DEP-0006] astryx layout is deprecated and will be removed in a future minor release.\n' +
|
|
82
|
+
' Use instead:\n' +
|
|
83
|
+
' astryx build "<idea>" choose the template to start from\n' +
|
|
84
|
+
' astryx template <name> scaffold it\n' +
|
|
85
|
+
' astryx docs layout layout guidance\n',
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Add deprecation metadata to a JSON response before output.
|
|
92
|
+
* Canonical stdout (type, data) is unchanged; the metadata sits in `meta`.
|
|
93
|
+
* @param {{type: string, data: unknown}} result
|
|
94
|
+
* @returns {{type: string, data: unknown, meta: {deprecation: typeof DEPRECATION}}}
|
|
95
|
+
*/
|
|
96
|
+
function withDeprecation(result) {
|
|
97
|
+
return {...result, meta: {deprecation: DEPRECATION}};
|
|
98
|
+
}
|
|
99
|
+
|
|
62
100
|
/** The largest layout expression read from --file or stdin. */
|
|
63
101
|
const MAX_EXPRESSION_BYTES = 5 * 1024 * 1024; // 5 MB
|
|
64
102
|
|
|
@@ -120,6 +158,20 @@ async function readExpression(expr, options = {}) {
|
|
|
120
158
|
return expr ?? '';
|
|
121
159
|
}
|
|
122
160
|
|
|
161
|
+
/**
|
|
162
|
+
* The disclosure for demo media replaced in spliced template blocks, or '' when
|
|
163
|
+
* none was. After printed code it is a line comment, so piped output stays TSX.
|
|
164
|
+
* @param {LayoutExpandResponse['data']} data
|
|
165
|
+
* @returns {string}
|
|
166
|
+
*/
|
|
167
|
+
function demoMediaNotice({demoMediaReplaced, written}) {
|
|
168
|
+
if (demoMediaReplaced === 0) return '';
|
|
169
|
+
const notice =
|
|
170
|
+
`Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${written ?? 'the code above'}: ` +
|
|
171
|
+
'images now show a neutral placeholder and videos have an empty source. Supply your own media there.';
|
|
172
|
+
return written ? notice : `// ${notice}`;
|
|
173
|
+
}
|
|
174
|
+
|
|
123
175
|
/**
|
|
124
176
|
* @param {import('commander').Command} program
|
|
125
177
|
*/
|
|
@@ -129,6 +181,7 @@ export function registerLayout(program) {
|
|
|
129
181
|
defineCommand(layoutCmd, layoutExpandCommand, {
|
|
130
182
|
fn: layoutExpandFn,
|
|
131
183
|
action: async (/** @type {string} */ expression, /** @type {string} */ targetPath, /** @type {LayoutExpandOptions} */ options) => {
|
|
184
|
+
warnDeprecated();
|
|
132
185
|
const json = program.opts().json || false;
|
|
133
186
|
const source = await readExpression(expression, options);
|
|
134
187
|
if (!source || source.trim() === '') {
|
|
@@ -154,7 +207,7 @@ export function registerLayout(program) {
|
|
|
154
207
|
// Expanding turns an expression into TSX — a transformation, not a
|
|
155
208
|
// lookup. What it produced is in the output; there is no set to count.
|
|
156
209
|
if (json) {
|
|
157
|
-
jsonOut(result);
|
|
210
|
+
jsonOut(withDeprecation(result));
|
|
158
211
|
return NO_RESULT_SET;
|
|
159
212
|
}
|
|
160
213
|
|
|
@@ -181,6 +234,8 @@ export function registerLayout(program) {
|
|
|
181
234
|
// Raw expanded TSX (no target path) — preformatted, emitted verbatim.
|
|
182
235
|
out.push(code(result.data.code));
|
|
183
236
|
}
|
|
237
|
+
const mediaNotice = demoMediaNotice(result.data);
|
|
238
|
+
if (mediaNotice) out.push(text(mediaNotice));
|
|
184
239
|
emit(...out);
|
|
185
240
|
return NO_RESULT_SET;
|
|
186
241
|
},
|
|
@@ -189,6 +244,7 @@ export function registerLayout(program) {
|
|
|
189
244
|
defineCommand(layoutCmd, layoutCheckCommand, {
|
|
190
245
|
fn: layoutCheckFn,
|
|
191
246
|
action: async (/** @type {string} */ expression, /** @type {LayoutCheckOptions} */ options) => {
|
|
247
|
+
warnDeprecated();
|
|
192
248
|
const json = program.opts().json || false;
|
|
193
249
|
const source = await readExpression(expression, options);
|
|
194
250
|
if (!source || source.trim() === '') {
|
|
@@ -218,7 +274,7 @@ export function registerLayout(program) {
|
|
|
218
274
|
// A verdict on one expression: valid or not, with the errors that made
|
|
219
275
|
// it so. Nothing was looked up.
|
|
220
276
|
if (json) {
|
|
221
|
-
jsonOut(result);
|
|
277
|
+
jsonOut(withDeprecation(result));
|
|
222
278
|
return NO_RESULT_SET;
|
|
223
279
|
}
|
|
224
280
|
|
|
@@ -252,6 +308,7 @@ export function registerLayout(program) {
|
|
|
252
308
|
defineCommand(layoutCmd, layoutGrammarCommand, {
|
|
253
309
|
fn: layoutGrammarFn,
|
|
254
310
|
action: async () => {
|
|
311
|
+
warnDeprecated();
|
|
255
312
|
const json = program.opts().json || false;
|
|
256
313
|
/** @type {LayoutGrammarResponse} */
|
|
257
314
|
let result;
|
|
@@ -264,7 +321,7 @@ export function registerLayout(program) {
|
|
|
264
321
|
// One document, the same one every time: the grammar cheatsheet.
|
|
265
322
|
const answered = resultSet({count: 1, resultKind: 'doc'});
|
|
266
323
|
if (json) {
|
|
267
|
-
jsonOut(result);
|
|
324
|
+
jsonOut(withDeprecation(result));
|
|
268
325
|
return answered;
|
|
269
326
|
}
|
|
270
327
|
// The cheatsheet is a preformatted document — emit verbatim.
|
|
@@ -50,13 +50,13 @@ async function optionText(command, flag) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
describe('no help text describes a prompt', () => {
|
|
53
|
-
it('theme
|
|
54
|
-
const help = await optionText('theme
|
|
53
|
+
it('theme eject --overwrite states the refusal, and a refused run writes nothing', async () => {
|
|
54
|
+
const help = await optionText('theme eject', '--overwrite');
|
|
55
55
|
expect(help).not.toMatch(/prompt/i);
|
|
56
56
|
expect(help).toContain('ERR_FILE_EXISTS');
|
|
57
57
|
expect(help).toMatch(/nothing is written/);
|
|
58
58
|
|
|
59
|
-
const first = await runCli(['--json', 'theme', '
|
|
59
|
+
const first = await runCli(['--json', 'theme', 'eject', 'matcha'], tmpDir);
|
|
60
60
|
expect(first.status).toBe(0);
|
|
61
61
|
const {outputDir, files} = JSON.parse(first.stdout).data;
|
|
62
62
|
expect(files.length).toBeGreaterThan(1);
|
|
@@ -64,7 +64,7 @@ describe('no help text describes a prompt', () => {
|
|
|
64
64
|
fs.writeFileSync(path.join(dir, files[0]), '// edited\n');
|
|
65
65
|
fs.rmSync(path.join(dir, files[1]));
|
|
66
66
|
|
|
67
|
-
const refused = await runCli(['--json', 'theme', '
|
|
67
|
+
const refused = await runCli(['--json', 'theme', 'eject', 'matcha'], tmpDir);
|
|
68
68
|
expect(refused.status).toBe(1);
|
|
69
69
|
expect(JSON.parse(refused.stdout).code).toBe('ERR_FILE_EXISTS');
|
|
70
70
|
expect(fs.readFileSync(path.join(dir, files[0]), 'utf8')).toBe('// edited\n');
|