@astryxdesign/cli 0.6.5 → 0.6.6-canary.0d27f83
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 +91 -88
- package/api/build/_adapter.d.mts +70 -2
- package/api/build/_adapter.mjs +122 -10
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.test.mjs +111 -2
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +110 -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 +27 -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 +17 -0
- package/api/template/template.type.mjs +8 -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 +120 -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 +667 -195
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- 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 +166 -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 +52 -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 +212 -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/page.tsx +1 -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/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +346 -47
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -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 +383 -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 +26 -52
- 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 +28 -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 +69 -19
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +71 -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 +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- 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.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- 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 +34 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1181 -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/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- 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/env/package-manager.d.mts +28 -8
- package/foundation/env/package-manager.mjs +49 -10
- package/foundation/env/package-manager.test.mjs +93 -1
- 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
|
@@ -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,39 @@ 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.deprecations` array in the response envelope.
|
|
67
|
+
*/
|
|
68
|
+
const LAYOUT_DEPRECATION = Object.freeze({
|
|
69
|
+
id: 'DEP-0006',
|
|
70
|
+
replacements: ['build', 'template', 'docs layout'],
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
function warnDeprecated() {
|
|
74
|
+
if (!isJsonMode()) {
|
|
75
|
+
console.error(
|
|
76
|
+
'[DEP-0006] astryx layout is deprecated and will be removed in a future minor release.\n' +
|
|
77
|
+
' Use instead:\n' +
|
|
78
|
+
' astryx build "<idea>" choose the template to start from\n' +
|
|
79
|
+
' astryx template <name> scaffold it\n' +
|
|
80
|
+
' astryx docs layout layout guidance\n',
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Add deprecation metadata to a JSON response before output.
|
|
87
|
+
* Canonical stdout (type, data) is unchanged; the metadata sits in `meta`.
|
|
88
|
+
* @param {{type: string, data: unknown}} result
|
|
89
|
+
* @returns {{type: string, data: unknown, meta: {deprecations: [typeof LAYOUT_DEPRECATION]}}}
|
|
90
|
+
*/
|
|
91
|
+
function withDeprecation(result) {
|
|
92
|
+
return {...result, meta: {deprecations: [LAYOUT_DEPRECATION]}};
|
|
93
|
+
}
|
|
94
|
+
|
|
62
95
|
/** The largest layout expression read from --file or stdin. */
|
|
63
96
|
const MAX_EXPRESSION_BYTES = 5 * 1024 * 1024; // 5 MB
|
|
64
97
|
|
|
@@ -120,6 +153,20 @@ async function readExpression(expr, options = {}) {
|
|
|
120
153
|
return expr ?? '';
|
|
121
154
|
}
|
|
122
155
|
|
|
156
|
+
/**
|
|
157
|
+
* The disclosure for demo media replaced in spliced template blocks, or '' when
|
|
158
|
+
* none was. After printed code it is a line comment, so piped output stays TSX.
|
|
159
|
+
* @param {LayoutExpandResponse['data']} data
|
|
160
|
+
* @returns {string}
|
|
161
|
+
*/
|
|
162
|
+
function demoMediaNotice({demoMediaReplaced, written}) {
|
|
163
|
+
if (demoMediaReplaced === 0) return '';
|
|
164
|
+
const notice =
|
|
165
|
+
`Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${written ?? 'the code above'}: ` +
|
|
166
|
+
'images now show a neutral placeholder and videos have an empty source. Supply your own media there.';
|
|
167
|
+
return written ? notice : `// ${notice}`;
|
|
168
|
+
}
|
|
169
|
+
|
|
123
170
|
/**
|
|
124
171
|
* @param {import('commander').Command} program
|
|
125
172
|
*/
|
|
@@ -129,6 +176,7 @@ export function registerLayout(program) {
|
|
|
129
176
|
defineCommand(layoutCmd, layoutExpandCommand, {
|
|
130
177
|
fn: layoutExpandFn,
|
|
131
178
|
action: async (/** @type {string} */ expression, /** @type {string} */ targetPath, /** @type {LayoutExpandOptions} */ options) => {
|
|
179
|
+
warnDeprecated();
|
|
132
180
|
const json = program.opts().json || false;
|
|
133
181
|
const source = await readExpression(expression, options);
|
|
134
182
|
if (!source || source.trim() === '') {
|
|
@@ -154,7 +202,7 @@ export function registerLayout(program) {
|
|
|
154
202
|
// Expanding turns an expression into TSX — a transformation, not a
|
|
155
203
|
// lookup. What it produced is in the output; there is no set to count.
|
|
156
204
|
if (json) {
|
|
157
|
-
jsonOut(result);
|
|
205
|
+
jsonOut(withDeprecation(result));
|
|
158
206
|
return NO_RESULT_SET;
|
|
159
207
|
}
|
|
160
208
|
|
|
@@ -181,6 +229,8 @@ export function registerLayout(program) {
|
|
|
181
229
|
// Raw expanded TSX (no target path) — preformatted, emitted verbatim.
|
|
182
230
|
out.push(code(result.data.code));
|
|
183
231
|
}
|
|
232
|
+
const mediaNotice = demoMediaNotice(result.data);
|
|
233
|
+
if (mediaNotice) out.push(text(mediaNotice));
|
|
184
234
|
emit(...out);
|
|
185
235
|
return NO_RESULT_SET;
|
|
186
236
|
},
|
|
@@ -189,6 +239,7 @@ export function registerLayout(program) {
|
|
|
189
239
|
defineCommand(layoutCmd, layoutCheckCommand, {
|
|
190
240
|
fn: layoutCheckFn,
|
|
191
241
|
action: async (/** @type {string} */ expression, /** @type {LayoutCheckOptions} */ options) => {
|
|
242
|
+
warnDeprecated();
|
|
192
243
|
const json = program.opts().json || false;
|
|
193
244
|
const source = await readExpression(expression, options);
|
|
194
245
|
if (!source || source.trim() === '') {
|
|
@@ -218,7 +269,7 @@ export function registerLayout(program) {
|
|
|
218
269
|
// A verdict on one expression: valid or not, with the errors that made
|
|
219
270
|
// it so. Nothing was looked up.
|
|
220
271
|
if (json) {
|
|
221
|
-
jsonOut(result);
|
|
272
|
+
jsonOut(withDeprecation(result));
|
|
222
273
|
return NO_RESULT_SET;
|
|
223
274
|
}
|
|
224
275
|
|
|
@@ -252,6 +303,7 @@ export function registerLayout(program) {
|
|
|
252
303
|
defineCommand(layoutCmd, layoutGrammarCommand, {
|
|
253
304
|
fn: layoutGrammarFn,
|
|
254
305
|
action: async () => {
|
|
306
|
+
warnDeprecated();
|
|
255
307
|
const json = program.opts().json || false;
|
|
256
308
|
/** @type {LayoutGrammarResponse} */
|
|
257
309
|
let result;
|
|
@@ -264,7 +316,7 @@ export function registerLayout(program) {
|
|
|
264
316
|
// One document, the same one every time: the grammar cheatsheet.
|
|
265
317
|
const answered = resultSet({count: 1, resultKind: 'doc'});
|
|
266
318
|
if (json) {
|
|
267
|
-
jsonOut(result);
|
|
319
|
+
jsonOut(withDeprecation(result));
|
|
268
320
|
return answered;
|
|
269
321
|
}
|
|
270
322
|
// 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');
|
|
@@ -13,11 +13,11 @@ export const doc = {
|
|
|
13
13
|
name: 'search',
|
|
14
14
|
displayName: 'astryx search',
|
|
15
15
|
namespace: 'cli/commands',
|
|
16
|
-
summary: 'Search components, hooks, docs, and
|
|
16
|
+
summary: 'Search components, hooks, docs, templates, and themes in one ranked list',
|
|
17
17
|
description:
|
|
18
18
|
'Terminal front-end to search(): prints one ranked, greppable list across ' +
|
|
19
19
|
'every content domain, each row carrying a follow-up command to act on it. ' +
|
|
20
|
-
'Outside an app, where @astryxdesign/core is not installed, it searches the docs.',
|
|
20
|
+
'Outside an app, where @astryxdesign/core is not installed, it searches the docs and themes.',
|
|
21
21
|
fn: 'search',
|
|
22
22
|
// Every word after `search` is the query: `astryx search dark mode` searches
|
|
23
23
|
// for "dark mode", with no quotes needed.
|
|
@@ -26,8 +26,8 @@ export const doc = {
|
|
|
26
26
|
{
|
|
27
27
|
flag: '--type <domain>',
|
|
28
28
|
param: 'options.type',
|
|
29
|
-
choices: ['component', 'hook', 'doc', 'template'],
|
|
30
|
-
description: 'Filter to one domain (component|hook|doc|template)',
|
|
29
|
+
choices: ['component', 'hook', 'doc', 'template', 'theme'],
|
|
30
|
+
description: 'Filter to one domain (component|hook|doc|template|theme)',
|
|
31
31
|
},
|
|
32
32
|
{
|
|
33
33
|
flag: '--limit <n>',
|
|
@@ -49,6 +49,7 @@ export const doc = {
|
|
|
49
49
|
label: 'Filter + JSON',
|
|
50
50
|
cli: 'astryx search "data table" --type template --json',
|
|
51
51
|
},
|
|
52
|
+
{label: 'Themes you can add', cli: 'astryx search warm --type theme'},
|
|
52
53
|
],
|
|
53
54
|
exitCodes: [
|
|
54
55
|
{code: 0, when: 'success (including zero matches)'},
|
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* @file search command — unified ranked search with a stable result summary.
|
|
5
5
|
*
|
|
6
6
|
* One "I'm looking for X" entry point spanning components, hooks, docs topics,
|
|
7
|
-
*
|
|
8
|
-
* with their domain, with a follow-up command so the user knows what to
|
|
9
|
-
* next.
|
|
7
|
+
* templates (page + block), and themes. Results are ranked by relevance and
|
|
8
|
+
* tagged with their domain, with a follow-up command so the user knows what to
|
|
9
|
+
* run next.
|
|
10
10
|
*
|
|
11
11
|
* The command surface (description, args, flags) is sourced from the colocated
|
|
12
12
|
* `search.doc.mjs` CommandDoc via `defineCommand`; this file supplies only the
|
|
@@ -104,13 +104,13 @@ export function registerSearch(program) {
|
|
|
104
104
|
// ── Text output ──────────────────────────────────────────────
|
|
105
105
|
const run = getCliInvocation();
|
|
106
106
|
const {query: q, matchCount, results} = result.data;
|
|
107
|
-
// Outside an app an open search covers the docs alone. Say
|
|
108
|
-
//
|
|
107
|
+
// Outside an app an open search covers the docs and themes alone. Say
|
|
108
|
+
// so, so that list does not read as "Astryx has no such component".
|
|
109
109
|
const note =
|
|
110
110
|
!options.type && !findCoreDir(process.cwd())
|
|
111
111
|
? [
|
|
112
112
|
text(
|
|
113
|
-
'@astryxdesign/core is not installed here, so only the docs were searched.',
|
|
113
|
+
'@astryxdesign/core is not installed here, so only the docs and themes were searched.',
|
|
114
114
|
),
|
|
115
115
|
]
|
|
116
116
|
: [];
|
|
@@ -123,6 +123,7 @@ export function registerSearch(program) {
|
|
|
123
123
|
text(
|
|
124
124
|
`Try a broader term, or browse: ${run} ${note.length > 0 ? 'docs' : 'component --list'}`,
|
|
125
125
|
),
|
|
126
|
+
...discoverHint(run, q, options.type),
|
|
126
127
|
);
|
|
127
128
|
return answered;
|
|
128
129
|
}
|
|
@@ -174,11 +175,34 @@ export function registerSearch(program) {
|
|
|
174
175
|
format: {command: formatCliCommand, parent: formatCliCommand},
|
|
175
176
|
}),
|
|
176
177
|
...note,
|
|
178
|
+
...discoverHint(run, q, options.type),
|
|
177
179
|
);
|
|
178
180
|
return answered;
|
|
179
181
|
},
|
|
180
182
|
});
|
|
181
183
|
}
|
|
182
184
|
|
|
185
|
+
/**
|
|
186
|
+
* Search reads only what is installed. Point at `discover` for the packages
|
|
187
|
+
* that could add more, except for hooks, which no integration adds.
|
|
188
|
+
* @param {string} run - The caller's CLI invocation prefix.
|
|
189
|
+
* @param {string} query
|
|
190
|
+
* @param {string | undefined} type
|
|
191
|
+
*/
|
|
192
|
+
function discoverHint(run, query, type) {
|
|
193
|
+
if (type === 'hook') return [];
|
|
194
|
+
return [
|
|
195
|
+
text(`More in packages you could add: ${run} discover ${shellWord(query)}`),
|
|
196
|
+
];
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* One shell word: the value itself when it is plain, else single-quoted.
|
|
201
|
+
* @param {string} value
|
|
202
|
+
*/
|
|
203
|
+
function shellWord(value) {
|
|
204
|
+
return /^[\w@./:-]+$/.test(value) ? value : `'${value.replace(/'/g, `'\\''`)}'`;
|
|
205
|
+
}
|
|
206
|
+
|
|
183
207
|
// Re-export the API for external consumers.
|
|
184
208
|
export {search, SEARCH_DOMAINS} from '../../../api/search/search.mjs';
|
|
@@ -53,7 +53,11 @@ function asText(value) {
|
|
|
53
53
|
* @param {unknown} value
|
|
54
54
|
*/
|
|
55
55
|
function printsField(lines, key, value) {
|
|
56
|
-
|
|
56
|
+
// The text prefixes a command (`command`, `parent`) with the project's
|
|
57
|
+
// invocation (`pnpm exec astryx`, or `pnpm dlx @astryxdesign/cli` where no
|
|
58
|
+
// `astryx` bin is installed), so compare the part after `astryx`.
|
|
59
|
+
const text = asText(value).split('\n')[0].trimEnd();
|
|
60
|
+
const shown = text.replace(/^astryx /, '');
|
|
57
61
|
return lines.some(line => line.startsWith(`${key}:`) && line.trimEnd().endsWith(shown));
|
|
58
62
|
}
|
|
59
63
|
|
|
@@ -118,6 +122,15 @@ describe('search() API — filters', () => {
|
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
124
|
|
|
125
|
+
it('--type theme returns only themes, each with the command that adds it', async () => {
|
|
126
|
+
const {data} = await search('warm', {...OPTS, type: 'theme'});
|
|
127
|
+
expect(data.results.map(r => r.name)).toContain('neutral');
|
|
128
|
+
for (const r of data.results) {
|
|
129
|
+
expect(r.domain).toBe('theme');
|
|
130
|
+
expect(r.command).toBe(`astryx theme add --import ${r.name}`);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
|
|
121
134
|
it('respects --limit', async () => {
|
|
122
135
|
const {data} = await search('button', {...OPTS, limit: 3});
|
|
123
136
|
expect(data.results.length).toBeLessThanOrEqual(3);
|
|
@@ -198,7 +211,9 @@ describe('search CLI — exit codes + JSON contract', () => {
|
|
|
198
211
|
expect(json.status).toBe(0);
|
|
199
212
|
const env = JSON.parse(json.stdout);
|
|
200
213
|
expect(env.data.query).toBe('dark mode');
|
|
201
|
-
|
|
214
|
+
// theme topic-level and section tie; either is correct
|
|
215
|
+
const top = env.data.results[0];
|
|
216
|
+
expect(top.name === 'theme' || top.name === 'use-a-theme' || top.section === 'light-dark-mode').toBe(true);
|
|
202
217
|
const text = await runCli(['search', 'dark', 'mode', '--type', 'doc'], REPO_ROOT);
|
|
203
218
|
expect(text.stdout).toContain('Results for "dark mode"');
|
|
204
219
|
}, SCAN_TIMEOUT);
|
|
@@ -271,7 +286,7 @@ describe('search CLI — exit codes + JSON contract', () => {
|
|
|
271
286
|
|
|
272
287
|
it('renders each result as a greppable key: value record', async () => {
|
|
273
288
|
const r = await runCli(['search', 'button'], REPO_ROOT);
|
|
274
|
-
expect(r.stdout).
|
|
289
|
+
expect(r.stdout).toMatch(/^command:\s+\S.*(?:astryx|@astryxdesign\/cli) component Button$/m);
|
|
275
290
|
// Fields mirror the JSON object and are line-greppable.
|
|
276
291
|
expect(r.stdout).toMatch(/^name:\s+Button$/m);
|
|
277
292
|
expect(r.stdout).toMatch(/^domain:\s+component$/m);
|
|
@@ -279,22 +294,31 @@ describe('search CLI — exit codes + JSON contract', () => {
|
|
|
279
294
|
});
|
|
280
295
|
|
|
281
296
|
it('prints every result field under its JSON key (score and reason with --verbose)', async () => {
|
|
282
|
-
//
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
const
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
297
|
+
// Between them these reach every domain, so every per-domain field shows.
|
|
298
|
+
// A theme matches `theme` only through its description, a prose mention
|
|
299
|
+
// ranked below every name and keyword hit, so the theme domain comes from
|
|
300
|
+
// a theme's own name.
|
|
301
|
+
const domains = new Set();
|
|
302
|
+
for (const args of [
|
|
303
|
+
['search', 'theme', '--limit', '60'],
|
|
304
|
+
['search', 'neutral', '--type', 'theme'],
|
|
305
|
+
]) {
|
|
306
|
+
const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
|
|
307
|
+
const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
|
|
308
|
+
const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
|
|
309
|
+
for (const result of env.data.results) {
|
|
310
|
+
domains.add(result.domain);
|
|
311
|
+
for (const [key, value] of Object.entries(result)) {
|
|
312
|
+
if (value == null || value === '') continue;
|
|
313
|
+
const label = `${result.domain} ${result.name}: ${key}`;
|
|
314
|
+
expect(printsField(verbose, key, value), label).toBe(true);
|
|
315
|
+
if (key !== 'score' && key !== 'reason') {
|
|
316
|
+
expect(printsField(plain, key, value), label).toBe(true);
|
|
317
|
+
}
|
|
295
318
|
}
|
|
296
319
|
}
|
|
297
320
|
}
|
|
321
|
+
expect(domains).toEqual(new Set(SEARCH_DOMAINS));
|
|
298
322
|
}, 90_000);
|
|
299
323
|
|
|
300
324
|
it('--verbose exits 0 and prints import/match detail', async () => {
|
|
@@ -311,16 +335,42 @@ describe('search CLI — exit codes + JSON contract', () => {
|
|
|
311
335
|
expect(r.stdout).toContain('reason:');
|
|
312
336
|
});
|
|
313
337
|
|
|
314
|
-
it('
|
|
338
|
+
it('points at discover for packages that could add more, except for hooks', async () => {
|
|
339
|
+
const open = await runCli(['search', 'data', 'table'], REPO_ROOT);
|
|
340
|
+
expect(open.status).toBe(0);
|
|
341
|
+
expect(open.stdout).toMatch(/^More in packages you could add: .*discover 'data table'$/m);
|
|
342
|
+
const none = await runCli(['search', 'zzqqxxnomatch'], REPO_ROOT);
|
|
343
|
+
expect(none.stdout).toMatch(/^More in packages you could add: .*discover zzqqxxnomatch$/m);
|
|
344
|
+
const hooks = await runCli(['search', 'click', '--type', 'hook'], REPO_ROOT);
|
|
345
|
+
expect(hooks.status).toBe(0);
|
|
346
|
+
expect(hooks.stdout).not.toContain('More in packages you could add');
|
|
347
|
+
const json = await runCli(['--json', 'search', 'button'], REPO_ROOT);
|
|
348
|
+
expect(json.stdout).not.toContain('More in packages you could add');
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
it('searches the docs and themes when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
|
|
315
352
|
const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-cli-no-core-'));
|
|
316
353
|
try {
|
|
317
354
|
const open = await runCli(['--json', 'search', 'make', 'an', 'integration'], empty);
|
|
318
355
|
expect(open.status).toBe(0);
|
|
319
356
|
expect(JSON.parse(open.stdout).data.results[0]).toMatchObject({domain: 'doc'});
|
|
320
|
-
//
|
|
357
|
+
// Bundled themes need no project, so an open search finds them too.
|
|
358
|
+
const theme = await runCli(['--json', 'search', 'neutral'], empty);
|
|
359
|
+
expect(theme.status).toBe(0);
|
|
360
|
+
expect(JSON.parse(theme.stdout).data.results[0]).toMatchObject({
|
|
361
|
+
domain: 'theme',
|
|
362
|
+
name: 'neutral',
|
|
363
|
+
});
|
|
364
|
+
// The text says the search covered the docs and themes alone.
|
|
321
365
|
const text = await runCli(['search', 'button'], empty);
|
|
322
366
|
expect(text.status).toBe(0);
|
|
323
|
-
expect(text.stdout).toContain('only the docs were searched');
|
|
367
|
+
expect(text.stdout).toContain('only the docs and themes were searched');
|
|
368
|
+
// A themes-only search needs no core, like a docs-only one.
|
|
369
|
+
const themes = await runCli(['--json', 'search', 'warm', '--type', 'theme'], empty);
|
|
370
|
+
expect(themes.status).toBe(0);
|
|
371
|
+
const found = JSON.parse(themes.stdout).data.results;
|
|
372
|
+
expect(found.map(r => r.name)).toContain('neutral');
|
|
373
|
+
expect(found.every(r => r.domain === 'theme')).toBe(true);
|
|
324
374
|
const json = await runCli(['--json', 'search', 'button', '--type', 'component'], empty);
|
|
325
375
|
expect(json.status).toBe(1);
|
|
326
376
|
expect(JSON.parse(json.stdout)).toMatchObject({code: 'ERR_CORE_NOT_FOUND'});
|
|
@@ -17,7 +17,10 @@ export const doc = {
|
|
|
17
17
|
description:
|
|
18
18
|
"Ejects a component's source from the resolved @astryxdesign/core (or its owning " +
|
|
19
19
|
'integration) into your project for deep customization, rewriting imports that ' +
|
|
20
|
-
'escape the component directory. With no name it lists the swizzlable components.'
|
|
20
|
+
'escape the component directory. With no name it lists the swizzlable components. ' +
|
|
21
|
+
'An integration component that replaces a Core component is what that Core name ' +
|
|
22
|
+
'copies; --package @astryxdesign/core copies the original. --list lists Core ' +
|
|
23
|
+
'components, including one an integration replaces.',
|
|
21
24
|
fn: 'swizzle',
|
|
22
25
|
args: [{name: 'component', param: 'component', required: false}],
|
|
23
26
|
options: [
|
|
@@ -30,12 +33,14 @@ export const doc = {
|
|
|
30
33
|
{
|
|
31
34
|
flag: '--package <pkg>',
|
|
32
35
|
param: 'options.package',
|
|
33
|
-
description:
|
|
36
|
+
description:
|
|
37
|
+
'Scope to a specific owning package. Use @astryxdesign/core to copy an original replaced by an integration component',
|
|
34
38
|
},
|
|
35
39
|
{
|
|
36
40
|
flag: '--list',
|
|
37
41
|
param: 'options.list',
|
|
38
|
-
description:
|
|
42
|
+
description:
|
|
43
|
+
'List the swizzlable Core components, including any that an integration component replaces',
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
46
|
flag: '-f, --overwrite',
|
|
@@ -47,6 +52,10 @@ export const doc = {
|
|
|
47
52
|
examples: [
|
|
48
53
|
{label: 'List swizzlable components', cli: 'astryx swizzle --list'},
|
|
49
54
|
{label: 'Eject a component', cli: 'astryx swizzle Button'},
|
|
55
|
+
{
|
|
56
|
+
label: 'Copy a replaced Core original',
|
|
57
|
+
cli: 'astryx swizzle SideNav --package @astryxdesign/core',
|
|
58
|
+
},
|
|
50
59
|
],
|
|
51
60
|
exitCodes: [
|
|
52
61
|
{code: 0, when: 'success'},
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
14
|
-
import {emit, section, list, text, WARN} from '../formatters/index.mjs';
|
|
14
|
+
import {emit, section, list, text, WARN, record} from '../formatters/index.mjs';
|
|
15
15
|
import {cliError} from '../lib/cli-error.mjs';
|
|
16
16
|
import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
|
|
17
17
|
import {swizzle as swizzleApi} from '../../../api/swizzle/swizzle.mjs';
|
|
@@ -60,6 +60,7 @@ export function registerSwizzle(program) {
|
|
|
60
60
|
if (result.type === 'swizzle.list') {
|
|
61
61
|
const components = result.data;
|
|
62
62
|
emit(
|
|
63
|
+
record({package: result.package}),
|
|
63
64
|
section('Available components'),
|
|
64
65
|
list(components),
|
|
65
66
|
text(`Usage: ${run} swizzle <component>`),
|
|
@@ -305,7 +305,8 @@ describe('swizzle — StyleX build setup note (#3373)', () => {
|
|
|
305
305
|
expect(humanResult.stdout).toMatch(/StyleX compiler/i);
|
|
306
306
|
expect(humanResult.stdout).toMatch(/unstyled/i);
|
|
307
307
|
expect(humanResult.stdout).toMatch(/next\/font/i);
|
|
308
|
-
|
|
308
|
+
// The fixture has no `astryx` bin installed, so the note names the scoped package.
|
|
309
|
+
expect(humanResult.stdout).toMatch(/@astryxdesign\/cli docs styling/);
|
|
309
310
|
});
|
|
310
311
|
|
|
311
312
|
it('does not print the StyleX note for components without StyleX', async () => {
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file `astryx template <name> <path>` tells the caller, in JSON and in text,
|
|
5
|
+
* when demo media in the copied file was replaced with placeholders.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as os from 'node:os';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
13
|
+
import {discoverTemplates} from '../../../api/template/template.mjs';
|
|
14
|
+
|
|
15
|
+
const SLOW = 60_000;
|
|
16
|
+
|
|
17
|
+
/** A page template whose source carries demo media, and one that carries none. */
|
|
18
|
+
async function pickPages() {
|
|
19
|
+
const pages = /** @type {Array<{dirName: string, type: string, filePath: string}>} */ (
|
|
20
|
+
await discoverTemplates()
|
|
21
|
+
).filter(t => t.type === 'page' && fs.existsSync(t.filePath));
|
|
22
|
+
const hasMedia = (/** @type {{filePath: string}} */ t) =>
|
|
23
|
+
/\/template-assets\/[\w.-]+\.\w+/.test(fs.readFileSync(t.filePath, 'utf-8'));
|
|
24
|
+
const withMedia = pages.find(hasMedia);
|
|
25
|
+
const without = pages.find(t => !hasMedia(t));
|
|
26
|
+
if (!withMedia || !without) throw new Error('catalog lacks a page with and without demo media');
|
|
27
|
+
return {withMedia: withMedia.dirName, without: without.dirName};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
describe('template copy receipt discloses replaced demo media', () => {
|
|
31
|
+
let dir;
|
|
32
|
+
beforeEach(() => {
|
|
33
|
+
dir = fs.mkdtempSync(path.join(os.tmpdir(), 'tmpl-receipt-cli-'));
|
|
34
|
+
});
|
|
35
|
+
afterEach(() => fs.rmSync(dir, {recursive: true, force: true}));
|
|
36
|
+
|
|
37
|
+
it('--json carries demoMediaReplaced and the text states the same count', async () => {
|
|
38
|
+
const {withMedia} = await pickPages();
|
|
39
|
+
const json = await runCli(['template', withMedia, './a', '--json'], dir);
|
|
40
|
+
expect(json.status).toBe(0);
|
|
41
|
+
const {data} = JSON.parse(json.stdout);
|
|
42
|
+
expect(data.demoMediaReplaced).toBeGreaterThan(0);
|
|
43
|
+
|
|
44
|
+
const human = await runCli(['template', withMedia, './b'], dir);
|
|
45
|
+
expect(human.status).toBe(0);
|
|
46
|
+
expect(human.stdout).toContain(
|
|
47
|
+
`Replaced ${data.demoMediaReplaced} Astryx demo media reference`,
|
|
48
|
+
);
|
|
49
|
+
expect(human.stdout).toContain('b/page.tsx');
|
|
50
|
+
}, SLOW);
|
|
51
|
+
|
|
52
|
+
it('says nothing about media when none was replaced', async () => {
|
|
53
|
+
const {without} = await pickPages();
|
|
54
|
+
const json = await runCli(['template', without, './a', '--json'], dir);
|
|
55
|
+
expect(JSON.parse(json.stdout).data.demoMediaReplaced).toBe(0);
|
|
56
|
+
const human = await runCli(['template', without, './b'], dir);
|
|
57
|
+
expect(human.status).toBe(0);
|
|
58
|
+
expect(human.stdout).not.toMatch(/demo media/i);
|
|
59
|
+
}, SLOW);
|
|
60
|
+
});
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {jsonOut} from '../../../foundation/response/json.mjs';
|
|
8
|
-
import {emit, section, text, records, code} from '../formatters/index.mjs';
|
|
8
|
+
import {emit, section, text, records, code, record} from '../formatters/index.mjs';
|
|
9
9
|
import {cliError} from '../lib/cli-error.mjs';
|
|
10
10
|
import {template as templateApi} from '../../../api/template/template.mjs';
|
|
11
11
|
import {Project} from '../../../foundation/config/project.mjs';
|
|
@@ -111,6 +111,52 @@ export function registerTemplate(program) {
|
|
|
111
111
|
case 'template.list': {
|
|
112
112
|
const pages = result.data.filter(t => t.type === 'page');
|
|
113
113
|
const blocks = result.data.filter(t => t.type === 'block');
|
|
114
|
+
|
|
115
|
+
// Bare `template` (no --list, no name) shows a grouped summary so a
|
|
116
|
+
// no-context agent or terminal doesn't receive 150 KB of catalog. The
|
|
117
|
+
// full catalog stays reachable via `template --list`.
|
|
118
|
+
if (!options.list && !name) {
|
|
119
|
+
/** @param {import('../../../api/template/template.type.mjs').TemplateListEntry[]} items */
|
|
120
|
+
const grouped = items => {
|
|
121
|
+
/** @type {Map<string, string[]>} */
|
|
122
|
+
const groups = new Map();
|
|
123
|
+
for (const t of items) {
|
|
124
|
+
const cat = t.category || 'Other';
|
|
125
|
+
const list = groups.get(cat);
|
|
126
|
+
if (list) {
|
|
127
|
+
list.push(t.id);
|
|
128
|
+
} else {
|
|
129
|
+
groups.set(cat, [t.id]);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/** @type {string[]} */
|
|
133
|
+
const lines = [];
|
|
134
|
+
for (const [cat, ids] of groups) {
|
|
135
|
+
lines.push(`${cat}: ${ids.join(', ')}`);
|
|
136
|
+
}
|
|
137
|
+
return lines.join('\n');
|
|
138
|
+
};
|
|
139
|
+
emit(
|
|
140
|
+
pages.length > 0 && section(`Page Templates (${pages.length})`),
|
|
141
|
+
pages.length > 0 && text(grouped(pages)),
|
|
142
|
+
blocks.length > 0 && section(`Block Templates (${blocks.length})`),
|
|
143
|
+
blocks.length > 0 && text(grouped(blocks)),
|
|
144
|
+
section('Usage'),
|
|
145
|
+
text(
|
|
146
|
+
[
|
|
147
|
+
`${run} template <id> Show full source`,
|
|
148
|
+
`${run} template <id> [target-path] Scaffold page or block`,
|
|
149
|
+
`${run} template <id> --skeleton Layout reference`,
|
|
150
|
+
`${run} template --list Full catalog with descriptions`,
|
|
151
|
+
`${run} template --list --type block List only blocks`,
|
|
152
|
+
`${run} template --list --package <pkg> List from one package`,
|
|
153
|
+
`${run} template --cdn CDN starter page, no build step`,
|
|
154
|
+
].join('\n'),
|
|
155
|
+
),
|
|
156
|
+
);
|
|
157
|
+
break;
|
|
158
|
+
}
|
|
159
|
+
|
|
114
160
|
// Project each entry to its JSON-mirroring fields; the WIP marker is
|
|
115
161
|
// folded into `name` (as before) and the package is shown only when it
|
|
116
162
|
// isn't the built-in core package.
|
|
@@ -146,6 +192,7 @@ export function registerTemplate(program) {
|
|
|
146
192
|
case 'template.skeleton': {
|
|
147
193
|
const {template: tName, description, components, skeleton} = result.data;
|
|
148
194
|
emit(
|
|
195
|
+
record({package: result.package}),
|
|
149
196
|
text(
|
|
150
197
|
`# ${tName}${description ? ' — ' + description : ''}\n` +
|
|
151
198
|
`# Components: ${components.join(', ')}`,
|
|
@@ -156,16 +203,34 @@ export function registerTemplate(program) {
|
|
|
156
203
|
}
|
|
157
204
|
|
|
158
205
|
case 'template.show': {
|
|
159
|
-
// Source must survive piping byte-for-byte
|
|
160
|
-
|
|
206
|
+
// Source must survive piping byte-for-byte, so the package it comes
|
|
207
|
+
// from (cli-surface INV28) and the note about replaced demo media go
|
|
208
|
+
// to stderr, the note in the copy receipt's words. (Text mode only:
|
|
209
|
+
// --json returned above with both in the envelope.)
|
|
210
|
+
const {source, demoMediaReplaced} = result.data;
|
|
211
|
+
console.error(`package: ${result.package}`);
|
|
212
|
+
emit(code(source));
|
|
213
|
+
if (demoMediaReplaced > 0) {
|
|
214
|
+
console.error(
|
|
215
|
+
`Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'}: ` +
|
|
216
|
+
'images now show a neutral placeholder and videos have an empty source. Supply your own media there.',
|
|
217
|
+
);
|
|
218
|
+
}
|
|
161
219
|
break;
|
|
162
220
|
}
|
|
163
221
|
|
|
164
222
|
case 'template.copy': {
|
|
223
|
+
const {outputDir, fileName, demoMediaReplaced, notes} = result.data;
|
|
224
|
+
const file = `${outputDir}/${fileName}`;
|
|
165
225
|
emit(
|
|
166
|
-
text(
|
|
167
|
-
|
|
168
|
-
|
|
226
|
+
text(`Copied template to ${file}`),
|
|
227
|
+
record({package: result.package}),
|
|
228
|
+
demoMediaReplaced > 0 &&
|
|
229
|
+
text(
|
|
230
|
+
`Replaced ${demoMediaReplaced} Astryx demo media reference${demoMediaReplaced === 1 ? '' : 's'} in ${file}: ` +
|
|
231
|
+
'images now show a neutral placeholder and videos have an empty source. Supply your own media there.',
|
|
232
|
+
),
|
|
233
|
+
...notes.map(/** @param {string} note */ note => text(note)),
|
|
169
234
|
);
|
|
170
235
|
break;
|
|
171
236
|
}
|