@astryxdesign/cli 0.6.5 → 0.6.6-canary.0e97faa
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 +60 -57
- 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/help/help.mjs +1 -1
- 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 +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +8 -123
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -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 +11 -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/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +13 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +2 -2
- package/api/layout/layoutGrammar.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 +465 -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 +11 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +282 -31
- 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 +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +5 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +56 -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/define-command.mjs +4 -0
- 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 +52 -37
- 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
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx template <name>` says how many demo media references it
|
|
5
|
+
* replaced: in `--json` as `demoMediaReplaced`, and in text on stderr, so that
|
|
6
|
+
* stdout stays exactly the source a copy writes and can be piped into a file.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect, beforeAll, afterAll} from 'vitest';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as os from 'node:os';
|
|
12
|
+
import * as path from 'node:path';
|
|
13
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
14
|
+
import {discoverTemplates} from '../../../api/template/template.mjs';
|
|
15
|
+
|
|
16
|
+
const SLOW = 60_000;
|
|
17
|
+
|
|
18
|
+
/** A page template whose source carries demo media, and one that carries none. */
|
|
19
|
+
async function pickPages() {
|
|
20
|
+
const pages = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
|
|
21
|
+
await discoverTemplates()
|
|
22
|
+
).filter(t => t.type === 'page' && fs.existsSync(t.filePath));
|
|
23
|
+
const hasMedia = (/** @type {{filePath: string}} */ t) =>
|
|
24
|
+
/\/template-assets\/[\w.-]+\.\w+/.test(fs.readFileSync(t.filePath, 'utf-8'));
|
|
25
|
+
const withMedia = pages.find(hasMedia);
|
|
26
|
+
const without = pages.find(t => !hasMedia(t));
|
|
27
|
+
if (!withMedia || !without) throw new Error('catalog lacks a page with and without demo media');
|
|
28
|
+
return {withMedia: withMedia.dirName, without: without.dirName};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
describe('template show discloses replaced demo media', () => {
|
|
32
|
+
/** @type {string} */
|
|
33
|
+
let dir;
|
|
34
|
+
beforeAll(() => {
|
|
35
|
+
dir = fs.mkdtempSync(path.join(os.tmpdir(), 'tmpl-show-cli-'));
|
|
36
|
+
});
|
|
37
|
+
afterAll(() => fs.rmSync(dir, {recursive: true, force: true}));
|
|
38
|
+
|
|
39
|
+
it('--json carries demoMediaReplaced, and text states it on stderr with stdout left as the source', async () => {
|
|
40
|
+
const {withMedia} = await pickPages();
|
|
41
|
+
const json = await runCli(['template', withMedia, '--type', 'page', '--json'], dir);
|
|
42
|
+
expect(json.status).toBe(0);
|
|
43
|
+
const {data} = JSON.parse(json.stdout);
|
|
44
|
+
expect(data.demoMediaReplaced).toBeGreaterThan(0);
|
|
45
|
+
|
|
46
|
+
const human = await runCli(['template', withMedia, '--type', 'page'], dir);
|
|
47
|
+
expect(human.status).toBe(0);
|
|
48
|
+
expect(human.stdout.trimEnd()).toBe(data.source.trimEnd());
|
|
49
|
+
expect(human.stderr).toContain(
|
|
50
|
+
`Replaced ${data.demoMediaReplaced} Astryx demo media reference`,
|
|
51
|
+
);
|
|
52
|
+
}, SLOW);
|
|
53
|
+
|
|
54
|
+
it('says nothing about media when none was replaced', async () => {
|
|
55
|
+
const {without} = await pickPages();
|
|
56
|
+
const json = await runCli(['template', without, '--type', 'page', '--json'], dir);
|
|
57
|
+
expect(JSON.parse(json.stdout).data.demoMediaReplaced).toBe(0);
|
|
58
|
+
const human = await runCli(['template', without, '--type', 'page'], dir);
|
|
59
|
+
expect(human.status).toBe(0);
|
|
60
|
+
expect(human.stderr).not.toMatch(/demo media/i);
|
|
61
|
+
}, SLOW);
|
|
62
|
+
});
|
|
@@ -35,6 +35,17 @@ import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
|
35
35
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
36
36
|
const REPO_ROOT = path.resolve(__dirname, '../../../../..');
|
|
37
37
|
|
|
38
|
+
/**
|
|
39
|
+
* Response types whose text output is the artifact's source, printed byte for
|
|
40
|
+
* byte so it can be piped (spec cli-surface INV28). Their JSON still names the
|
|
41
|
+
* package; their text does not.
|
|
42
|
+
*/
|
|
43
|
+
const VERBATIM_TYPES = new Set([
|
|
44
|
+
'component.detail.source',
|
|
45
|
+
'component.detail.showcase',
|
|
46
|
+
'template.show',
|
|
47
|
+
]);
|
|
48
|
+
|
|
38
49
|
// ─── Helpers ────────────────────────────────────────────────────────────────
|
|
39
50
|
|
|
40
51
|
/**
|
|
@@ -438,6 +449,24 @@ const CASES = [
|
|
|
438
449
|
// Themes are rendered as list items, not records.
|
|
439
450
|
skipFieldChecks: true,
|
|
440
451
|
},
|
|
452
|
+
{
|
|
453
|
+
name: 'theme remove',
|
|
454
|
+
args: ['theme', 'remove', 'does-not-exist'],
|
|
455
|
+
errorExpected: true,
|
|
456
|
+
skipFieldChecks: true,
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: 'theme use',
|
|
460
|
+
args: ['theme', 'use', 'does-not-exist'],
|
|
461
|
+
errorExpected: true,
|
|
462
|
+
skipFieldChecks: true,
|
|
463
|
+
},
|
|
464
|
+
{
|
|
465
|
+
name: 'theme eject',
|
|
466
|
+
args: ['theme', 'eject', 'does-not-exist'],
|
|
467
|
+
errorExpected: true,
|
|
468
|
+
skipFieldChecks: true,
|
|
469
|
+
},
|
|
441
470
|
{
|
|
442
471
|
name: 'theme build',
|
|
443
472
|
args: ['theme', 'build', 'nonexistent.ts'],
|
|
@@ -561,6 +590,15 @@ describe('text-json-parity', () => {
|
|
|
561
590
|
expect(run.textStatus).toBe(run.jsonStatus);
|
|
562
591
|
});
|
|
563
592
|
|
|
593
|
+
// spec cli-surface INV28: text names the package the envelope names.
|
|
594
|
+
// Verbatim source output prints only the source, so a pipe gets the
|
|
595
|
+
// file byte for byte.
|
|
596
|
+
it('text names the package the JSON envelope names', () => {
|
|
597
|
+
if (run.json?.package === undefined) return;
|
|
598
|
+
if (VERBATIM_TYPES.has(run.json.type)) return;
|
|
599
|
+
expect(run.text).toContain(run.json.package);
|
|
600
|
+
});
|
|
601
|
+
|
|
564
602
|
if (!tc.skipFieldChecks && !tc.errorExpected) {
|
|
565
603
|
it('every text record key exists in the JSON data', () => {
|
|
566
604
|
if (!run.json?.data) return;
|
|
@@ -569,6 +607,8 @@ describe('text-json-parity', () => {
|
|
|
569
607
|
if (run.json.meta) {
|
|
570
608
|
for (const k of jsonLeafKeys(run.json.meta)) jsonKeys.add(k);
|
|
571
609
|
}
|
|
610
|
+
// The envelope's own `package` (spec cli-surface INV28) is JSON too.
|
|
611
|
+
if (run.json.package !== undefined) jsonKeys.add('package');
|
|
572
612
|
const violations = [];
|
|
573
613
|
for (const key of textKeys.keys()) {
|
|
574
614
|
if (!jsonKeys.has(key)) {
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file Compatibility and deprecation coverage for the two-step theme-add lifecycle. */
|
|
4
|
+
|
|
5
|
+
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
6
|
+
import * as fs from 'node:fs';
|
|
7
|
+
import * as os from 'node:os';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
10
|
+
|
|
11
|
+
let tmpDir;
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-theme-add-cli-'));
|
|
15
|
+
fs.mkdirSync(path.join(tmpDir, 'src'));
|
|
16
|
+
fs.writeFileSync(
|
|
17
|
+
path.join(tmpDir, 'package.json'),
|
|
18
|
+
JSON.stringify({name: 'app', private: true}),
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
describe('theme add compatibility lifecycle', () => {
|
|
27
|
+
it('keeps copy stdout and emits one text-only deprecation warning', async () => {
|
|
28
|
+
const result = await runCli(['theme', 'add', 'neutral'], tmpDir);
|
|
29
|
+
|
|
30
|
+
expect(result.status, result.stderr).toBe(0);
|
|
31
|
+
expect(result.stdout).toContain(
|
|
32
|
+
'[ok] Added Neutral theme from @astryxdesign/cli to src/themes/neutral/',
|
|
33
|
+
);
|
|
34
|
+
expect(result.stdout).toContain('This is your copy of the Neutral theme');
|
|
35
|
+
expect(result.stderr.match(/source copying is deprecated/g)).toHaveLength(
|
|
36
|
+
1,
|
|
37
|
+
);
|
|
38
|
+
expect(result.stderr).toContain('pnpm exec astryx theme eject neutral');
|
|
39
|
+
expect(result.stderr).toContain(
|
|
40
|
+
'pnpm exec astryx theme add neutral --import',
|
|
41
|
+
);
|
|
42
|
+
expect(fs.existsSync(path.join(tmpDir, 'src/themes/neutral'))).toBe(true);
|
|
43
|
+
expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
|
|
44
|
+
false,
|
|
45
|
+
);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it('keeps theme.add data and adds machine-readable deprecation metadata', async () => {
|
|
49
|
+
const result = await runCli(['theme', 'add', 'neutral', '--json'], tmpDir);
|
|
50
|
+
|
|
51
|
+
expect(result.status, result.stderr).toBe(0);
|
|
52
|
+
expect(result.stderr).not.toContain('source copying is deprecated');
|
|
53
|
+
expect(JSON.parse(result.stdout)).toMatchObject({
|
|
54
|
+
type: 'theme.add',
|
|
55
|
+
data: {
|
|
56
|
+
slug: 'neutral',
|
|
57
|
+
package: '@astryxdesign/cli',
|
|
58
|
+
outputDir: 'src/themes/neutral',
|
|
59
|
+
},
|
|
60
|
+
meta: {
|
|
61
|
+
deprecations: [
|
|
62
|
+
{
|
|
63
|
+
id: 'DEP-0005',
|
|
64
|
+
replacements: ['theme eject', 'theme add --import'],
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
it('keeps the list JSON unchanged and names the stage commands in text', async () => {
|
|
72
|
+
fs.mkdirSync(path.join(tmpDir, 'src/themes/broken'), {recursive: true});
|
|
73
|
+
fs.writeFileSync(
|
|
74
|
+
path.join(tmpDir, 'src/themes/broken/brokenTheme.ts'),
|
|
75
|
+
'export const brokenTheme = {};\n',
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const textResult = await runCli(['theme', 'add', '--list'], tmpDir);
|
|
79
|
+
expect(textResult.status, textResult.stderr).toBe(0);
|
|
80
|
+
expect(textResult.stdout).toContain(
|
|
81
|
+
'Import one: pnpm exec astryx theme add <slug> --import [--package <package>]',
|
|
82
|
+
);
|
|
83
|
+
expect(textResult.stdout).toContain(
|
|
84
|
+
'Fork source: pnpm exec astryx theme eject <slug> [target-path]',
|
|
85
|
+
);
|
|
86
|
+
expect(textResult.stdout).not.toContain('theme add <slug> [target-path]');
|
|
87
|
+
expect(textResult.stderr).not.toContain('deprecated');
|
|
88
|
+
|
|
89
|
+
const result = await runCli(['theme', 'add', '--list', '--json'], tmpDir);
|
|
90
|
+
|
|
91
|
+
expect(result.status, result.stderr).toBe(0);
|
|
92
|
+
const payload = JSON.parse(result.stdout);
|
|
93
|
+
expect(payload).toMatchObject({type: 'theme.list'});
|
|
94
|
+
expect(payload.meta).toBeUndefined();
|
|
95
|
+
expect(payload.data.some(theme => theme.slug === 'broken')).toBe(false);
|
|
96
|
+
expect(Object.keys(payload.data[0]).sort()).toEqual([
|
|
97
|
+
'description',
|
|
98
|
+
'displayName',
|
|
99
|
+
'maintained',
|
|
100
|
+
'package',
|
|
101
|
+
'slug',
|
|
102
|
+
]);
|
|
103
|
+
expect(result.stderr).not.toContain('deprecated');
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it.each([
|
|
107
|
+
['target path', ['src/brand']],
|
|
108
|
+
['overwrite', ['--overwrite']],
|
|
109
|
+
])('rejects --import with a %s before writing', async (_label, extra) => {
|
|
110
|
+
const result = await runCli(
|
|
111
|
+
['theme', 'add', 'neutral', '--import', ...extra, '--json'],
|
|
112
|
+
tmpDir,
|
|
113
|
+
);
|
|
114
|
+
|
|
115
|
+
expect(result.status).not.toBe(0);
|
|
116
|
+
expect(JSON.parse(result.stdout)).toMatchObject({
|
|
117
|
+
code: 'ERR_THEME_INVALID',
|
|
118
|
+
error: expect.stringContaining('cannot be combined'),
|
|
119
|
+
});
|
|
120
|
+
expect(fs.existsSync(path.join(tmpDir, 'src/astryx-themes.ts'))).toBe(
|
|
121
|
+
false,
|
|
122
|
+
);
|
|
123
|
+
expect(fs.existsSync(path.join(tmpDir, 'src/brand'))).toBe(false);
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
it('lists --import in help', async () => {
|
|
127
|
+
const result = await runCli(['theme', 'add', '--help'], tmpDir);
|
|
128
|
+
|
|
129
|
+
expect(result.status, result.stderr).toBe(0);
|
|
130
|
+
expect(result.stdout).toContain('--import');
|
|
131
|
+
});
|
|
132
|
+
});
|
|
@@ -1,12 +1,6 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @file CommandDoc for `astryx theme add`. The terminal binding of the
|
|
5
|
-
* `themeAdd()` function (referenced via `fn`); its args/flags map to that
|
|
6
|
-
* function's params so a converter can build Commander config + --help from one
|
|
7
|
-
* source of truth.
|
|
8
|
-
* @position packages/cli/clients/cli/commands — command documentation
|
|
9
|
-
*/
|
|
3
|
+
/** @file CommandDoc for `astryx theme add`. */
|
|
10
4
|
|
|
11
5
|
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
12
6
|
export const doc = {
|
|
@@ -14,11 +8,9 @@ export const doc = {
|
|
|
14
8
|
name: 'theme add',
|
|
15
9
|
displayName: 'astryx theme add',
|
|
16
10
|
namespace: 'cli/commands',
|
|
17
|
-
summary: '
|
|
11
|
+
summary: 'Copy a theme, or import its built output into the app',
|
|
18
12
|
description:
|
|
19
|
-
|
|
20
|
-
'Writes are staged then renamed, rolling back on failure. Running it with no slug, or with ' +
|
|
21
|
-
'--list, lists available themes; use --package when more than one owner provides the slug.',
|
|
13
|
+
'With --import, records the theme in the generated app module and imports its built module and stylesheets. Without --import, keeps the released source-copy behavior, emits one text warning, and adds meta.deprecations with DEP-0005 and the theme eject/theme add --import replacements to JSON. A bare command or --list delegates to themeListCopySources() so the released list fields stay unchanged; use --package when owners share a slug.',
|
|
22
14
|
fn: 'themeAdd',
|
|
23
15
|
args: [
|
|
24
16
|
{name: 'slug', param: 'slug', required: false},
|
|
@@ -28,10 +20,15 @@ export const doc = {
|
|
|
28
20
|
{
|
|
29
21
|
flag: '-f, --overwrite',
|
|
30
22
|
param: 'options.overwrite',
|
|
31
|
-
description:
|
|
32
|
-
'Replace existing files. Without it, existing files fail the command with ERR_FILE_EXISTS and nothing is written',
|
|
23
|
+
description: 'Replace copied files. Cannot be combined with --import',
|
|
33
24
|
},
|
|
34
25
|
{flag: '--list', description: 'List available themes'},
|
|
26
|
+
{
|
|
27
|
+
flag: '--import',
|
|
28
|
+
param: 'options.import',
|
|
29
|
+
description:
|
|
30
|
+
'Use the built theme through the generated app module instead of copying source',
|
|
31
|
+
},
|
|
35
32
|
{
|
|
36
33
|
flag: '--package <package>',
|
|
37
34
|
param: 'options.package',
|
|
@@ -39,18 +36,21 @@ export const doc = {
|
|
|
39
36
|
},
|
|
40
37
|
],
|
|
41
38
|
examples: [
|
|
42
|
-
{label: 'Scaffold a theme', cli: 'astryx theme add matcha'},
|
|
43
39
|
{
|
|
44
|
-
label: '
|
|
45
|
-
cli: 'astryx theme add ocean --
|
|
40
|
+
label: 'Import a built theme into the app',
|
|
41
|
+
cli: 'astryx theme add ocean --import',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
label: 'Select a package theme over a local theme',
|
|
45
|
+
cli: 'astryx theme add ocean --import --package @acme/themes',
|
|
46
46
|
},
|
|
47
47
|
],
|
|
48
48
|
exitCodes: [
|
|
49
|
-
{code: 0, when: '
|
|
49
|
+
{code: 0, when: 'the theme is listed, copied, or imported'},
|
|
50
50
|
{
|
|
51
51
|
code: 1,
|
|
52
|
-
when: '
|
|
52
|
+
when: 'the theme, its source or built imports, its record, the target path, or the option combination is invalid',
|
|
53
53
|
},
|
|
54
54
|
],
|
|
55
|
-
related: ['theme list', 'theme
|
|
55
|
+
related: ['theme list', 'theme remove', 'theme use', 'theme eject'],
|
|
56
56
|
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file CommandDoc for `astryx theme eject`. */
|
|
4
|
+
|
|
5
|
+
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
6
|
+
export const doc = {
|
|
7
|
+
type: 'command',
|
|
8
|
+
name: 'theme eject',
|
|
9
|
+
displayName: 'astryx theme eject',
|
|
10
|
+
namespace: 'cli/commands',
|
|
11
|
+
summary: 'Fork a theme as editable local source',
|
|
12
|
+
description:
|
|
13
|
+
"Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Use --package when package themes share a slug.",
|
|
14
|
+
fn: 'themeEject',
|
|
15
|
+
args: [
|
|
16
|
+
{name: 'slug', param: 'slug', required: true},
|
|
17
|
+
{name: 'path', param: 'options.targetPath', required: false},
|
|
18
|
+
],
|
|
19
|
+
options: [
|
|
20
|
+
{
|
|
21
|
+
flag: '-f, --overwrite',
|
|
22
|
+
param: 'options.overwrite',
|
|
23
|
+
description:
|
|
24
|
+
'Replace existing files. Without it, an existing file fails with ERR_FILE_EXISTS and nothing is written',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
flag: '--package <package>',
|
|
28
|
+
param: 'options.package',
|
|
29
|
+
description: 'Select the package that owns the theme',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
examples: [
|
|
33
|
+
{label: 'Fork a theme into the local root', cli: 'astryx theme eject ocean'},
|
|
34
|
+
{
|
|
35
|
+
label: 'Fork one package theme elsewhere',
|
|
36
|
+
cli: 'astryx theme eject ocean src/themes/my-ocean --package @acme/themes',
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
exitCodes: [
|
|
40
|
+
{code: 0, when: 'all source and descriptor files are written'},
|
|
41
|
+
{
|
|
42
|
+
code: 1,
|
|
43
|
+
when: 'the theme is unknown or ambiguous, a path escapes, a source file is missing, or a destination exists',
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
related: ['theme add', 'theme build', 'theme list'],
|
|
47
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file CLI behavior for `astryx theme list`.
|
|
5
|
+
*
|
|
6
|
+
* `theme list` shows the themes this project can add now. Themes in packages
|
|
7
|
+
* it has not installed are `discover`'s, so the list ends by pointing there:
|
|
8
|
+
* an agent that never learns `discover` exists searches the registry instead.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
12
|
+
import * as fs from 'node:fs';
|
|
13
|
+
import * as path from 'node:path';
|
|
14
|
+
import * as os from 'node:os';
|
|
15
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
16
|
+
|
|
17
|
+
let tmpDir;
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-cli-theme-list-'));
|
|
20
|
+
});
|
|
21
|
+
afterEach(() => {
|
|
22
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
describe('astryx theme list', () => {
|
|
26
|
+
it('lists bundled themes and points at import, eject, and discover', async () => {
|
|
27
|
+
const {status, stdout} = await runCli(['theme', 'list'], {cwd: tmpDir});
|
|
28
|
+
|
|
29
|
+
expect(status).toBe(0);
|
|
30
|
+
expect(stdout).toMatch(/^slug:\s+neutral$/m);
|
|
31
|
+
expect(stdout).toMatch(/^package:\s+@astryxdesign\/cli$/m);
|
|
32
|
+
expect(stdout).toMatch(/Import one: .*theme add <slug> --import/m);
|
|
33
|
+
expect(stdout).toMatch(/Fork source: .*theme eject <slug>/m);
|
|
34
|
+
expect(stdout).toMatch(/More themes in packages you could add: .*discover theme$/m);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('keeps the JSON envelope free of the hint', async () => {
|
|
38
|
+
const {status, stdout} = await runCli(['--json', 'theme', 'list'], {cwd: tmpDir});
|
|
39
|
+
|
|
40
|
+
expect(status).toBe(0);
|
|
41
|
+
expect(stdout).not.toContain('discover');
|
|
42
|
+
expect(JSON.parse(stdout).type).toBe('theme.list');
|
|
43
|
+
});
|
|
44
|
+
});
|
|
@@ -16,8 +16,8 @@ export const doc = {
|
|
|
16
16
|
namespace: 'cli/commands',
|
|
17
17
|
summary: 'List themes available to add',
|
|
18
18
|
description:
|
|
19
|
-
'Lists
|
|
20
|
-
'
|
|
19
|
+
'Lists bundled, package, and local themes with their owner, source, added state, and default state. ' +
|
|
20
|
+
'Earlier descriptor-less copies are not listed as themes; the receipt names them with the upgrade command.',
|
|
21
21
|
fn: 'themeListAvailable',
|
|
22
22
|
options: [
|
|
23
23
|
{
|
|
@@ -21,8 +21,7 @@ export const doc = {
|
|
|
21
21
|
'JSON is also supported. Existing author-owned files are left untouched unless --overwrite is explicit. ' +
|
|
22
22
|
'When used in a theme integration, keep the palette request under the theme slug, ' +
|
|
23
23
|
'write the candidate and receipt under that same slug, import the candidate from the theme source, ' +
|
|
24
|
-
'and keep all three inside the theme directory
|
|
25
|
-
'directory into the consumer project, so nothing else has to list them.',
|
|
24
|
+
'and keep all three inside the theme directory. The package ships that directory as one source unit for discovery and explicit eject, while apps use its built exports.',
|
|
26
25
|
fn: 'themePaletteGenerate',
|
|
27
26
|
args: [{name: 'config', param: 'configPath', required: true}],
|
|
28
27
|
options: [
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file CommandDoc for `astryx theme remove`. */
|
|
4
|
+
|
|
5
|
+
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
6
|
+
export const doc = {
|
|
7
|
+
type: 'command',
|
|
8
|
+
name: 'theme remove',
|
|
9
|
+
displayName: 'astryx theme remove',
|
|
10
|
+
namespace: 'cli/commands',
|
|
11
|
+
summary: 'Remove a non-default theme from the app',
|
|
12
|
+
description:
|
|
13
|
+
'Removes one added theme from the generated module and regenerates the whole module. Choose another default with theme use before removing the current default.',
|
|
14
|
+
fn: 'themeRemove',
|
|
15
|
+
args: [{name: 'slug', param: 'slug', required: true}],
|
|
16
|
+
examples: [{label: 'Remove an added theme', cli: 'astryx theme remove ocean'}],
|
|
17
|
+
exitCodes: [
|
|
18
|
+
{code: 0, when: 'the module is regenerated without the theme'},
|
|
19
|
+
{code: 1, when: 'the theme is not added, is the default, or state is invalid'},
|
|
20
|
+
],
|
|
21
|
+
related: ['theme add', 'theme use', 'theme list'],
|
|
22
|
+
};
|
|
@@ -19,8 +19,9 @@ export const doc = {
|
|
|
19
19
|
'Writes theme.template.ts: the annotated reference for the whole theme surface, covering every ' +
|
|
20
20
|
'defineTheme field, the token families, the component override syntax, and how a theme is ' +
|
|
21
21
|
'consumed, naming the CLI command that prints the authoritative reference for each. Read ' +
|
|
22
|
-
'it, copy what you need into your own theme file, delete it. Use `theme add <slug
|
|
23
|
-
'
|
|
22
|
+
'it, copy what you need into your own theme file, delete it. Use `theme add <slug> --import` to ' +
|
|
23
|
+
'use an installed built theme, extend that theme for ordinary customization, or use ' +
|
|
24
|
+
'`theme eject <slug>` for a complete source fork. Leaves an existing file untouched unless --overwrite.',
|
|
24
25
|
fn: 'themeTemplate',
|
|
25
26
|
args: [{name: 'path', param: 'options.targetPath', required: false}],
|
|
26
27
|
options: [
|
|
@@ -38,5 +39,5 @@ export const doc = {
|
|
|
38
39
|
{code: 0, when: 'success, including when an existing file was left untouched'},
|
|
39
40
|
{code: 1, when: 'the target path escapes the project, or the file cannot be written'},
|
|
40
41
|
],
|
|
41
|
-
related: ['theme add', 'theme list', 'theme build'],
|
|
42
|
+
related: ['theme add', 'theme eject', 'theme list', 'theme build'],
|
|
42
43
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/** @file CommandDoc for `astryx theme use`. */
|
|
4
|
+
|
|
5
|
+
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
6
|
+
export const doc = {
|
|
7
|
+
type: 'command',
|
|
8
|
+
name: 'theme use',
|
|
9
|
+
displayName: 'astryx theme use',
|
|
10
|
+
namespace: 'cli/commands',
|
|
11
|
+
summary: 'Choose the app default from its added themes',
|
|
12
|
+
description:
|
|
13
|
+
'Sets one added slug as the default and regenerates the generated theme module. Add the theme first if it is not already in the app.',
|
|
14
|
+
fn: 'themeUse',
|
|
15
|
+
args: [{name: 'slug', param: 'slug', required: true}],
|
|
16
|
+
examples: [{label: 'Choose the default theme', cli: 'astryx theme use ocean'}],
|
|
17
|
+
exitCodes: [
|
|
18
|
+
{code: 0, when: 'the module is regenerated with the selected default'},
|
|
19
|
+
{code: 1, when: 'the theme is not added or state is invalid'},
|
|
20
|
+
],
|
|
21
|
+
related: ['theme add', 'theme remove', 'theme list'],
|
|
22
|
+
};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file CommandDoc for the `astryx theme` command group.
|
|
5
|
-
*
|
|
6
|
-
* carry the actual args, flags, and wrapped functions.
|
|
7
|
-
* @position packages/cli/clients/cli/commands — command documentation
|
|
4
|
+
* @file CommandDoc for the `astryx theme` command group. It is a real group,
|
|
5
|
+
* not a compatibility alias. Its subcommands own the work.
|
|
8
6
|
*/
|
|
9
7
|
|
|
10
8
|
/** @type {import('@astryxdesign/cli/authoring').CommandDoc} */
|
|
@@ -13,18 +11,25 @@ export const doc = {
|
|
|
13
11
|
name: 'theme',
|
|
14
12
|
displayName: 'astryx theme',
|
|
15
13
|
namespace: 'cli/commands',
|
|
16
|
-
summary:
|
|
17
|
-
'Create and build themes: add a shipped one, compile to CSS, or list what a theme can override',
|
|
14
|
+
summary: 'Add, switch, build, and author themes',
|
|
18
15
|
description:
|
|
19
|
-
'The theme command group.
|
|
20
|
-
|
|
21
|
-
'
|
|
22
|
-
'list
|
|
23
|
-
'
|
|
24
|
-
|
|
16
|
+
'The theme command group. Import built themes into an app, choose its default, remove them, list available and added themes, or eject source to make a local fork. Plain theme add still copies source while that default is deprecated. The authoring commands build themes, generate palettes, write the annotated template, and list component theme targets.',
|
|
17
|
+
subcommands: [
|
|
18
|
+
'build',
|
|
19
|
+
'list',
|
|
20
|
+
'add',
|
|
21
|
+
'remove',
|
|
22
|
+
'use',
|
|
23
|
+
'eject',
|
|
24
|
+
'template',
|
|
25
|
+
'palette',
|
|
26
|
+
'targets',
|
|
27
|
+
],
|
|
25
28
|
examples: [
|
|
26
|
-
{label: 'List available themes', cli: 'astryx theme list'},
|
|
27
|
-
{label: '
|
|
29
|
+
{label: 'List available and added themes', cli: 'astryx theme list'},
|
|
30
|
+
{label: 'Import a theme into the app', cli: 'astryx theme add ocean --import'},
|
|
31
|
+
{label: 'Choose the default', cli: 'astryx theme use ocean'},
|
|
32
|
+
{label: 'Fork source to customize', cli: 'astryx theme eject ocean'},
|
|
28
33
|
{
|
|
29
34
|
label: 'Generate a palette candidate',
|
|
30
35
|
cli: 'astryx theme palette generate palette.config.json',
|
|
@@ -32,8 +37,8 @@ export const doc = {
|
|
|
32
37
|
{label: 'See what a theme can override', cli: 'astryx theme targets'},
|
|
33
38
|
],
|
|
34
39
|
exitCodes: [
|
|
35
|
-
{code: 0, when: '
|
|
36
|
-
{code: 1, when: 'an unknown subcommand'},
|
|
40
|
+
{code: 0, when: 'help is shown or a subcommand succeeds'},
|
|
41
|
+
{code: 1, when: 'an unknown subcommand or a subcommand failure'},
|
|
37
42
|
],
|
|
38
43
|
related: ['init'],
|
|
39
44
|
};
|
|
@@ -84,4 +84,18 @@ describe('upgrade human output is ASCII', () => {
|
|
|
84
84
|
'minSize: 200',
|
|
85
85
|
);
|
|
86
86
|
});
|
|
87
|
+
|
|
88
|
+
// Every fixture above has a real src/, so the completion line for a project
|
|
89
|
+
// whose source is somewhere else was never reached — this suite was green on
|
|
90
|
+
// that path by luck, not by coverage.
|
|
91
|
+
it('reports a source directory that does not exist', async () => {
|
|
92
|
+
fs.rmSync(path.join(tmpDir, 'src'), {recursive: true, force: true});
|
|
93
|
+
fs.mkdirSync(path.join(tmpDir, 'app'), {recursive: true});
|
|
94
|
+
write('app/panel.tsx', 'export const x = 1;\n');
|
|
95
|
+
|
|
96
|
+
expect(await nonAsciiLines(['upgrade', '--from', '0.5.0'])).toEqual([]);
|
|
97
|
+
expect(
|
|
98
|
+
await nonAsciiLines(['upgrade', '--from', '0.5.0', '--apply']),
|
|
99
|
+
).toEqual([]);
|
|
100
|
+
});
|
|
87
101
|
});
|