@astryxdesign/cli 0.6.5 → 0.6.6-canary.408ad59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +87 -0
- package/README.md +58 -55
- package/api/build/_adapter.d.mts +55 -2
- package/api/build/_adapter.mjs +100 -10
- package/api/build/build.doc.mjs +2 -2
- package/api/build/build.test.mjs +111 -2
- package/api/build/build.type.d.mts +8 -0
- package/api/build/build.type.mjs +2 -0
- package/api/build/kit/kit.mjs +99 -22
- package/api/build/kit/rank.d.mts +32 -8
- package/api/build/kit/rank.mjs +291 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/build/kit/weights.d.mts +82 -0
- package/api/build/kit/weights.json +1 -0
- package/api/build/kit/weights.mjs +305 -0
- package/api/build/kit/weights.test.mjs +190 -0
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +603 -0
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +25 -0
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.mjs +7 -1
- package/api/docs/docOverlays.test.mjs +10 -6
- package/api/docs/docs.d.mts +6 -0
- package/api/docs/docs.depth.test.mjs +134 -0
- package/api/docs/docs.doc.mjs +31 -2
- package/api/docs/docs.mjs +46 -1
- package/api/docs/docs.test.mjs +279 -0
- package/api/docs/docs.type.d.mts +81 -4
- package/api/docs/docs.type.mjs +41 -4
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +572 -0
- package/api/docs/integrationDocs.test.mjs +337 -0
- package/api/docs/node/node.d.mts +28 -3
- package/api/docs/node/node.mjs +149 -23
- package/api/doctor/_adapter.d.mts +43 -0
- package/api/doctor/_adapter.mjs +142 -0
- package/api/doctor/doctor.d.mts +0 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +6 -123
- package/api/doctor/theme-checks.d.mts +12 -0
- package/api/doctor/theme-checks.mjs +1117 -0
- package/api/doctor/theme-checks.test.mjs +526 -0
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.d.mts +3 -1
- package/api/gap-report/gap-report.mjs +27 -3
- package/api/gap-report/gap-report.test.mjs +106 -0
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +10 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +354 -28
- package/api/integration/add-theme.test.mjs +380 -16
- package/api/integration/authoring-checks.mjs +31 -8
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +495 -4
- package/api/integration/pack-check.test.mjs +619 -10
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +39 -8
- package/api/search/search.doc.mjs +4 -4
- package/api/search/search.mjs +248 -66
- package/api/search/search.test.mjs +829 -0
- package/api/search/search.type.d.mts +6 -6
- package/api/search/search.type.mjs +5 -5
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +95 -13
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +4 -0
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +15 -8
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/show/show.mjs +17 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +6 -2
- package/api/template/template.mjs +2 -0
- package/api/template/template.type.d.mts +14 -0
- package/api/template/template.type.mjs +5 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +50 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.icon-lineage.test.mjs +117 -0
- package/api/theme/build/build.icon-preservation.test.mjs +639 -0
- package/api/theme/build/build.mjs +463 -155
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.test.mjs +220 -1
- package/api/theme/build/icon-imports.d.mts +47 -0
- package/api/theme/build/icon-imports.mjs +691 -0
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.d.mts +4 -1
- package/api/theme/themeBuild.doc.mjs +15 -4
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/run/run.mjs +20 -3
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +1 -1
- package/api/upgrade/upgrade.type.d.mts +5 -0
- package/api/upgrade/upgrade.type.mjs +2 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/transforms/next/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/next/index.mjs +14 -1
- package/assets/codemods/transforms/next/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +161 -0
- package/assets/docs/getting-started.doc.mjs +59 -15
- package/assets/docs/icons.doc.mjs +1 -0
- package/assets/docs/principles.doc.dense.mjs +2 -2
- package/assets/docs/principles.doc.mjs +2 -2
- package/assets/docs/principles.doc.zh.mjs +2 -2
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/styling.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 +97 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +38 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.doc.mjs +20 -0
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupWithSelectable.tsx +48 -0
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +6 -0
- package/authoring/doctypes/template/type.ts +10 -0
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.mjs +279 -30
- package/clients/cli/commands/build.mjs +7 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +88 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +271 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/discover.mjs +29 -1
- package/clients/cli/commands/discover.no-source.test.mjs +75 -0
- package/clients/cli/commands/docs.depth.test.mjs +219 -0
- package/clients/cli/commands/docs.doc.mjs +15 -2
- package/clients/cli/commands/docs.mjs +273 -16
- package/clients/cli/commands/docs.test.mjs +382 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +4 -4
- package/clients/cli/commands/doctor.test.mjs +9 -51
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/gap-report.mjs +12 -0
- package/clients/cli/commands/gap-report.test.mjs +63 -0
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +5 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-add.doc.mjs +10 -0
- package/clients/cli/commands/integration-authoring.test.mjs +12 -2
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/integration.mjs +3 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -0
- package/clients/cli/commands/layout-expand.doc.mjs +4 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -0
- package/clients/cli/commands/layout.doc.mjs +1 -0
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +61 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.doc.mjs +5 -4
- package/clients/cli/commands/search.mjs +30 -6
- package/clients/cli/commands/search.test.mjs +63 -17
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.mjs +70 -6
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +132 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +44 -0
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +4 -1
- package/clients/cli/lib/component-format.mjs +19 -2
- package/clients/cli/lib/manifest.mjs +44 -165
- package/clients/cli/lib/manifest.test.mjs +98 -7
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +31 -28
- package/foundation/agent-docs/agent-docs.test.mjs +1163 -0
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/discovery/theme-discovery.d.mts +78 -5
- package/foundation/discovery/theme-discovery.mjs +143 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +18 -8
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/tree.test.mjs +649 -0
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +79 -13
- package/foundation/integrations/cli-requirement.mjs +115 -22
- package/foundation/integrations/cli-requirement.test.mjs +205 -8
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.d.mts +5 -5
- package/foundation/response/response-types.doc.mjs +50 -35
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
4
|
+
import {execFileSync} from 'node:child_process';
|
|
4
5
|
import * as fs from 'node:fs';
|
|
5
6
|
import * as path from 'node:path';
|
|
7
|
+
import {CLI_ROOT, findInstalledPackage} from '../../foundation/fs/paths.mjs';
|
|
6
8
|
import {integrationAddTheme} from './add-theme.mjs';
|
|
7
9
|
import {validateLocalIntegration} from './validate-integration.mjs';
|
|
8
10
|
|
|
@@ -70,10 +72,14 @@ describe('integrationAddTheme', () => {
|
|
|
70
72
|
expect(
|
|
71
73
|
fs.readFileSync(path.join(tmpDir, 'astryx.integration.mjs'), 'utf-8'),
|
|
72
74
|
).toContain("themes: './themes'");
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
).toEqual(['dist', 'themes', 'astryx.integration.mjs']);
|
|
75
|
+
const pkg = JSON.parse(
|
|
76
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
77
|
+
);
|
|
78
|
+
expect(pkg.files).toEqual(['dist', 'themes', 'astryx.integration.mjs']);
|
|
79
|
+
expect(pkg.exports).toMatchObject({
|
|
80
|
+
'./themes/ocean': './themes/ocean/ocean.js',
|
|
81
|
+
'./themes/ocean.css': './themes/ocean/ocean.css',
|
|
82
|
+
});
|
|
77
83
|
expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
|
|
78
84
|
});
|
|
79
85
|
|
|
@@ -84,7 +90,7 @@ describe('integrationAddTheme', () => {
|
|
|
84
90
|
const pkg = JSON.parse(
|
|
85
91
|
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
86
92
|
);
|
|
87
|
-
expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.
|
|
93
|
+
expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.6.4'});
|
|
88
94
|
expect(pkg.peerDependenciesMeta).toEqual({
|
|
89
95
|
'@astryxdesign/cli': {optional: true},
|
|
90
96
|
});
|
|
@@ -105,10 +111,16 @@ describe('integrationAddTheme', () => {
|
|
|
105
111
|
'export default {};\n',
|
|
106
112
|
);
|
|
107
113
|
const result = await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
108
|
-
expect(result.data.files).
|
|
114
|
+
expect(result.data.files).toContain('package.json');
|
|
109
115
|
expect(
|
|
110
116
|
JSON.parse(fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8')),
|
|
111
|
-
).
|
|
117
|
+
).toMatchObject({
|
|
118
|
+
...pkg,
|
|
119
|
+
exports: {
|
|
120
|
+
'./themes/ocean': './themes/ocean/ocean.js',
|
|
121
|
+
'./themes/ocean.css': './themes/ocean/ocean.css',
|
|
122
|
+
},
|
|
123
|
+
});
|
|
112
124
|
});
|
|
113
125
|
|
|
114
126
|
it('dry-runs the identical receipt without writing anything', async () => {
|
|
@@ -133,14 +145,17 @@ describe('integrationAddTheme', () => {
|
|
|
133
145
|
).toBe(beforeManifest);
|
|
134
146
|
});
|
|
135
147
|
|
|
136
|
-
it('
|
|
148
|
+
it('creates theme exports even when the package has no files allowlist', async () => {
|
|
137
149
|
setup({includeFiles: false});
|
|
138
150
|
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
139
151
|
const pkg = JSON.parse(
|
|
140
152
|
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
141
153
|
);
|
|
142
154
|
expect(pkg).not.toHaveProperty('files');
|
|
143
|
-
expect(pkg).
|
|
155
|
+
expect(pkg.exports).toEqual({
|
|
156
|
+
'./themes/ocean': './themes/ocean/ocean.js',
|
|
157
|
+
'./themes/ocean.css': './themes/ocean/ocean.css',
|
|
158
|
+
});
|
|
144
159
|
});
|
|
145
160
|
|
|
146
161
|
it('uses an author-declared custom root without rewriting it', async () => {
|
|
@@ -159,13 +174,35 @@ describe('integrationAddTheme', () => {
|
|
|
159
174
|
expect(
|
|
160
175
|
fs.existsSync(path.join(tmpDir, 'src/themes/ocean/oceanTheme.doc.mjs')),
|
|
161
176
|
).toBe(true);
|
|
177
|
+
expect(
|
|
178
|
+
JSON.parse(fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'))
|
|
179
|
+
.exports,
|
|
180
|
+
).toEqual({
|
|
181
|
+
'./themes/ocean': './src/themes/ocean/ocean.js',
|
|
182
|
+
'./themes/ocean.css': './src/themes/ocean/ocean.css',
|
|
183
|
+
});
|
|
162
184
|
});
|
|
163
185
|
|
|
164
|
-
it('keeps
|
|
186
|
+
it('keeps generated theme CSS side-effectful', async () => {
|
|
187
|
+
setup();
|
|
188
|
+
const packageFile = path.join(tmpDir, 'package.json');
|
|
189
|
+
const pkg = JSON.parse(fs.readFileSync(packageFile, 'utf-8'));
|
|
190
|
+
pkg.sideEffects = false;
|
|
191
|
+
fs.writeFileSync(packageFile, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
192
|
+
|
|
193
|
+
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
194
|
+
|
|
195
|
+
expect(
|
|
196
|
+
JSON.parse(fs.readFileSync(packageFile, 'utf-8')).sideEffects,
|
|
197
|
+
).toEqual(['**/*.css']);
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
it('adds one export pair per theme without touching the manifest again', async () => {
|
|
165
201
|
setup({manifest: "export default {themes: './themes'};\n"});
|
|
166
202
|
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
167
|
-
const
|
|
168
|
-
|
|
203
|
+
const manifestBefore = fs.readFileSync(
|
|
204
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
205
|
+
'utf-8',
|
|
169
206
|
);
|
|
170
207
|
|
|
171
208
|
const result = await integrationAddTheme('reef', {cwd: tmpDir});
|
|
@@ -173,16 +210,24 @@ describe('integrationAddTheme', () => {
|
|
|
173
210
|
expect(result.data.files).toEqual([
|
|
174
211
|
'themes/reef/reefTheme.ts',
|
|
175
212
|
'themes/reef/reefTheme.doc.mjs',
|
|
213
|
+
'package.json',
|
|
176
214
|
]);
|
|
177
215
|
expect(fs.readdirSync(path.join(tmpDir, 'themes')).sort()).toEqual([
|
|
178
216
|
'ocean',
|
|
179
217
|
'reef',
|
|
180
218
|
]);
|
|
181
219
|
expect(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
220
|
+
fs.readFileSync(path.join(tmpDir, 'astryx.integration.mjs'), 'utf-8'),
|
|
221
|
+
).toBe(manifestBefore);
|
|
222
|
+
expect(
|
|
223
|
+
JSON.parse(fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'))
|
|
224
|
+
.exports,
|
|
225
|
+
).toEqual({
|
|
226
|
+
'./themes/ocean': './themes/ocean/ocean.js',
|
|
227
|
+
'./themes/ocean.css': './themes/ocean/ocean.css',
|
|
228
|
+
'./themes/reef': './themes/reef/reef.js',
|
|
229
|
+
'./themes/reef.css': './themes/reef/reef.css',
|
|
230
|
+
});
|
|
186
231
|
});
|
|
187
232
|
|
|
188
233
|
it('refuses an obsolete central catalog without changing its bytes', async () => {
|
|
@@ -310,3 +355,322 @@ describe('integrationAddTheme', () => {
|
|
|
310
355
|
);
|
|
311
356
|
});
|
|
312
357
|
});
|
|
358
|
+
|
|
359
|
+
describe('integrationAddTheme --from', () => {
|
|
360
|
+
it('forks a bundled theme into the integration package', async () => {
|
|
361
|
+
setup();
|
|
362
|
+
const result = await integrationAddTheme('ocean', {
|
|
363
|
+
cwd: tmpDir,
|
|
364
|
+
from: 'neutral',
|
|
365
|
+
});
|
|
366
|
+
|
|
367
|
+
expect(result.type).toBe('integration.add');
|
|
368
|
+
expect(result.data.kind).toBe('theme');
|
|
369
|
+
expect(result.data.name).toBe('ocean');
|
|
370
|
+
expect(result.data.from).toBe('neutral');
|
|
371
|
+
expect(result.data.written).toBe(true);
|
|
372
|
+
expect(result.data.dryRun).toBe(false);
|
|
373
|
+
expect(result.data.root).toEqual({path: './themes', created: true});
|
|
374
|
+
|
|
375
|
+
// The entry file must exist with the new export name.
|
|
376
|
+
const entry = fs.readFileSync(
|
|
377
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
|
|
378
|
+
'utf-8',
|
|
379
|
+
);
|
|
380
|
+
expect(entry).toContain('oceanTheme');
|
|
381
|
+
expect(entry).toContain("name: 'ocean'");
|
|
382
|
+
// It must NOT contain the original theme identifier as a prefix.
|
|
383
|
+
expect(entry).not.toMatch(/\bneutralTheme\b/);
|
|
384
|
+
expect(entry).not.toMatch(/\bneutralPalettes\b/);
|
|
385
|
+
expect(entry).not.toMatch(/\bneutralSyntax\b/);
|
|
386
|
+
expect(entry).toContain('defineTheme');
|
|
387
|
+
|
|
388
|
+
// A fresh descriptor, not copied from the base.
|
|
389
|
+
const descriptor = fs.readFileSync(
|
|
390
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.doc.mjs'),
|
|
391
|
+
'utf-8',
|
|
392
|
+
);
|
|
393
|
+
expect(descriptor).toContain("name: 'ocean'");
|
|
394
|
+
expect(descriptor).toContain("@astryxdesign/cli/authoring').ThemeDoc");
|
|
395
|
+
expect(descriptor).toContain('maintained: true');
|
|
396
|
+
expect(result.data.files).toContain('package.json');
|
|
397
|
+
const pkg = JSON.parse(
|
|
398
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
399
|
+
);
|
|
400
|
+
expect(pkg.exports).toMatchObject({
|
|
401
|
+
'./themes/ocean': './themes/ocean/ocean.js',
|
|
402
|
+
'./themes/ocean.css': './themes/ocean/ocean.css',
|
|
403
|
+
});
|
|
404
|
+
|
|
405
|
+
// The theme must validate.
|
|
406
|
+
expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
|
|
407
|
+
});
|
|
408
|
+
|
|
409
|
+
it('renames palette and support files from the base theme', async () => {
|
|
410
|
+
setup();
|
|
411
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
412
|
+
|
|
413
|
+
const themeDir = path.join(tmpDir, 'themes/ocean');
|
|
414
|
+
const files = fs.readdirSync(themeDir).sort();
|
|
415
|
+
// neutralPalettes.ts → oceanPalettes.ts, etc.
|
|
416
|
+
expect(files).toContain('oceanTheme.ts');
|
|
417
|
+
expect(files).toContain('oceanTheme.doc.mjs');
|
|
418
|
+
expect(files).toContain('oceanPalettes.ts');
|
|
419
|
+
expect(files).toContain('oceanPaletteRefs.generated.ts');
|
|
420
|
+
expect(files).toContain('icons.tsx');
|
|
421
|
+
// Must not contain any file starting with 'neutral'.
|
|
422
|
+
expect(files.filter(f => f.startsWith('neutral'))).toEqual([]);
|
|
423
|
+
});
|
|
424
|
+
|
|
425
|
+
it('rewrites import paths inside forked files', async () => {
|
|
426
|
+
setup();
|
|
427
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
428
|
+
|
|
429
|
+
const entry = fs.readFileSync(
|
|
430
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
|
|
431
|
+
'utf-8',
|
|
432
|
+
);
|
|
433
|
+
// Import references must use the new identifier.
|
|
434
|
+
expect(entry).toContain('./oceanPaletteRefs.generated');
|
|
435
|
+
expect(entry).not.toContain('./neutralPaletteRefs.generated');
|
|
436
|
+
// The icon registry import must also be renamed.
|
|
437
|
+
expect(entry).toContain('oceanIconRegistry');
|
|
438
|
+
expect(entry).not.toContain('neutralIconRegistry');
|
|
439
|
+
});
|
|
440
|
+
|
|
441
|
+
it('rewrites CSS custom properties scoped to the base theme', async () => {
|
|
442
|
+
setup();
|
|
443
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
444
|
+
|
|
445
|
+
const entry = fs.readFileSync(
|
|
446
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
|
|
447
|
+
'utf-8',
|
|
448
|
+
);
|
|
449
|
+
expect(entry).toContain('--astryx-theme-ocean-');
|
|
450
|
+
expect(entry).not.toContain('--astryx-theme-neutral-');
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it('rewrites the syntax theme name', async () => {
|
|
454
|
+
setup();
|
|
455
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
456
|
+
|
|
457
|
+
const entry = fs.readFileSync(
|
|
458
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
|
|
459
|
+
'utf-8',
|
|
460
|
+
);
|
|
461
|
+
expect(entry).toContain("'astryx-ocean'");
|
|
462
|
+
expect(entry).not.toContain("'astryx-neutral'");
|
|
463
|
+
});
|
|
464
|
+
|
|
465
|
+
it('strips the copyright header from forked files', async () => {
|
|
466
|
+
setup();
|
|
467
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
468
|
+
|
|
469
|
+
const entry = fs.readFileSync(
|
|
470
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
|
|
471
|
+
'utf-8',
|
|
472
|
+
);
|
|
473
|
+
expect(entry).not.toContain('Copyright (c) Meta Platforms');
|
|
474
|
+
});
|
|
475
|
+
|
|
476
|
+
it('includes data.from in the receipt only when --from is used', async () => {
|
|
477
|
+
setup();
|
|
478
|
+
const blank = await integrationAddTheme('plain', {cwd: tmpDir});
|
|
479
|
+
expect(blank.data).not.toHaveProperty('from');
|
|
480
|
+
|
|
481
|
+
const forked = await integrationAddTheme('ocean', {
|
|
482
|
+
cwd: tmpDir,
|
|
483
|
+
from: 'neutral',
|
|
484
|
+
});
|
|
485
|
+
expect(forked.data.from).toBe('neutral');
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
it('refuses to fork a theme into itself', async () => {
|
|
489
|
+
setup();
|
|
490
|
+
await expect(
|
|
491
|
+
integrationAddTheme('neutral', {cwd: tmpDir, from: 'neutral'}),
|
|
492
|
+
).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
it('refuses an unknown base theme with a helpful suggestion list', async () => {
|
|
496
|
+
setup();
|
|
497
|
+
await expect(
|
|
498
|
+
integrationAddTheme('ocean', {cwd: tmpDir, from: 'nonexistent'}),
|
|
499
|
+
).rejects.toMatchObject({
|
|
500
|
+
code: 'ERR_UNKNOWN_THEME',
|
|
501
|
+
message: expect.stringContaining('nonexistent'),
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
|
|
505
|
+
it('dry-runs with --from without writing anything', async () => {
|
|
506
|
+
setup();
|
|
507
|
+
const result = await integrationAddTheme('ocean', {
|
|
508
|
+
cwd: tmpDir,
|
|
509
|
+
from: 'neutral',
|
|
510
|
+
dryRun: true,
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
expect(result.data.written).toBe(false);
|
|
514
|
+
expect(result.data.dryRun).toBe(true);
|
|
515
|
+
expect(result.data.from).toBe('neutral');
|
|
516
|
+
expect(result.data.files).toContain('themes/ocean/oceanTheme.ts');
|
|
517
|
+
expect(result.data.files).toContain('themes/ocean/oceanTheme.doc.mjs');
|
|
518
|
+
expect(fs.existsSync(path.join(tmpDir, 'themes'))).toBe(false);
|
|
519
|
+
});
|
|
520
|
+
|
|
521
|
+
it('refuses to overwrite when the target already exists', async () => {
|
|
522
|
+
setup();
|
|
523
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
524
|
+
await expect(
|
|
525
|
+
integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'}),
|
|
526
|
+
).rejects.toMatchObject({code: 'ERR_FILE_EXISTS'});
|
|
527
|
+
});
|
|
528
|
+
|
|
529
|
+
it('declares the npm packages the forked files import, at the range the bundled themes use', async () => {
|
|
530
|
+
setup({includeFiles: false});
|
|
531
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
532
|
+
const pkg = JSON.parse(
|
|
533
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
534
|
+
);
|
|
535
|
+
const cli = JSON.parse(
|
|
536
|
+
fs.readFileSync(path.join(CLI_ROOT, 'package.json'), 'utf-8'),
|
|
537
|
+
);
|
|
538
|
+
// The copied icons.tsx imports lucide-react; Core and React are every
|
|
539
|
+
// app's own, so the fork does not declare them.
|
|
540
|
+
expect(pkg.dependencies).toEqual({
|
|
541
|
+
'lucide-react': cli.devDependencies['lucide-react'],
|
|
542
|
+
});
|
|
543
|
+
expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.6.4'});
|
|
544
|
+
});
|
|
545
|
+
|
|
546
|
+
it('keeps a dependency the package already declares', async () => {
|
|
547
|
+
setup({includeFiles: false});
|
|
548
|
+
const file = path.join(tmpDir, 'package.json');
|
|
549
|
+
const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
|
|
550
|
+
fs.writeFileSync(
|
|
551
|
+
file,
|
|
552
|
+
`${JSON.stringify({...pkg, dependencies: {'lucide-react': '^1.0.0'}}, null, 2)}\n`,
|
|
553
|
+
);
|
|
554
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
555
|
+
expect(JSON.parse(fs.readFileSync(file, 'utf-8')).dependencies).toEqual({
|
|
556
|
+
'lucide-react': '^1.0.0',
|
|
557
|
+
});
|
|
558
|
+
});
|
|
559
|
+
|
|
560
|
+
it('declares nothing for a fork of a theme the package owns', async () => {
|
|
561
|
+
setup({includeFiles: false});
|
|
562
|
+
await integrationAddTheme('base', {cwd: tmpDir});
|
|
563
|
+
await integrationAddTheme('variant', {cwd: tmpDir, from: 'base'});
|
|
564
|
+
const pkg = JSON.parse(
|
|
565
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
566
|
+
);
|
|
567
|
+
expect(pkg.dependencies).toBeUndefined();
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
it('builds a forked neutral theme once the package installs what --from declared', async () => {
|
|
571
|
+
setup({includeFiles: false});
|
|
572
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
573
|
+
const pkg = JSON.parse(
|
|
574
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
575
|
+
);
|
|
576
|
+
// Install exactly what the package declares, plus what every Astryx
|
|
577
|
+
// project has: Core and React.
|
|
578
|
+
for (const name of [
|
|
579
|
+
...Object.keys(pkg.dependencies ?? {}),
|
|
580
|
+
'@astryxdesign/core',
|
|
581
|
+
'react',
|
|
582
|
+
]) {
|
|
583
|
+
const installed = findInstalledPackage(CLI_ROOT, name);
|
|
584
|
+
expect(installed, name).not.toBeNull();
|
|
585
|
+
const link = path.join(tmpDir, 'node_modules', ...name.split('/'));
|
|
586
|
+
fs.mkdirSync(path.dirname(link), {recursive: true});
|
|
587
|
+
fs.symlinkSync(
|
|
588
|
+
fs.realpathSync(/** @type {string} */ (installed)),
|
|
589
|
+
link,
|
|
590
|
+
'dir',
|
|
591
|
+
);
|
|
592
|
+
}
|
|
593
|
+
// A separate process without NODE_PATH, so only what the package
|
|
594
|
+
// installed can resolve.
|
|
595
|
+
let status = 0;
|
|
596
|
+
let output = '';
|
|
597
|
+
try {
|
|
598
|
+
execFileSync(
|
|
599
|
+
process.execPath,
|
|
600
|
+
[
|
|
601
|
+
path.join(CLI_ROOT, 'clients/cli/bin/astryx.mjs'),
|
|
602
|
+
'theme',
|
|
603
|
+
'build',
|
|
604
|
+
'themes/ocean/oceanTheme.ts',
|
|
605
|
+
],
|
|
606
|
+
{
|
|
607
|
+
cwd: tmpDir,
|
|
608
|
+
env: {...process.env, NODE_PATH: ''},
|
|
609
|
+
encoding: 'utf-8',
|
|
610
|
+
stdio: 'pipe',
|
|
611
|
+
},
|
|
612
|
+
);
|
|
613
|
+
} catch (error) {
|
|
614
|
+
const failure = /** @type {any} */ (error);
|
|
615
|
+
status = failure.status ?? 1;
|
|
616
|
+
output = `${failure.stdout ?? ''}${failure.stderr ?? ''}`;
|
|
617
|
+
}
|
|
618
|
+
expect({status, output: status === 0 ? '' : output}).toEqual({
|
|
619
|
+
status: 0,
|
|
620
|
+
output: '',
|
|
621
|
+
});
|
|
622
|
+
expect(fs.existsSync(path.join(tmpDir, 'themes/ocean/ocean.css'))).toBe(
|
|
623
|
+
true,
|
|
624
|
+
);
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
it('works with different bundled themes', async () => {
|
|
628
|
+
setup();
|
|
629
|
+
const result = await integrationAddTheme('dusk', {
|
|
630
|
+
cwd: tmpDir,
|
|
631
|
+
from: 'gothic',
|
|
632
|
+
});
|
|
633
|
+
|
|
634
|
+
expect(result.data.from).toBe('gothic');
|
|
635
|
+
const entry = fs.readFileSync(
|
|
636
|
+
path.join(tmpDir, 'themes/dusk/duskTheme.ts'),
|
|
637
|
+
'utf-8',
|
|
638
|
+
);
|
|
639
|
+
expect(entry).toContain('duskTheme');
|
|
640
|
+
expect(entry).toContain("name: 'dusk'");
|
|
641
|
+
expect(entry).not.toMatch(/\bgothicTheme\b/);
|
|
642
|
+
expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
|
|
643
|
+
});
|
|
644
|
+
|
|
645
|
+
it('forks from a theme the package already owns', async () => {
|
|
646
|
+
setup();
|
|
647
|
+
// First, add a blank theme.
|
|
648
|
+
await integrationAddTheme('base', {cwd: tmpDir});
|
|
649
|
+
// Then fork it.
|
|
650
|
+
const result = await integrationAddTheme('variant', {
|
|
651
|
+
cwd: tmpDir,
|
|
652
|
+
from: 'base',
|
|
653
|
+
});
|
|
654
|
+
|
|
655
|
+
expect(result.data.from).toBe('base');
|
|
656
|
+
const entry = fs.readFileSync(
|
|
657
|
+
path.join(tmpDir, 'themes/variant/variantTheme.ts'),
|
|
658
|
+
'utf-8',
|
|
659
|
+
);
|
|
660
|
+
expect(entry).toContain('variantTheme');
|
|
661
|
+
expect(entry).toContain("name: 'variant'");
|
|
662
|
+
expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
it('declares the optional CLI peer that reads typed theme descriptors', async () => {
|
|
666
|
+
setup({includeFiles: false});
|
|
667
|
+
await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
|
|
668
|
+
const pkg = JSON.parse(
|
|
669
|
+
fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
|
|
670
|
+
);
|
|
671
|
+
expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.6.4'});
|
|
672
|
+
expect(pkg.peerDependenciesMeta).toEqual({
|
|
673
|
+
'@astryxdesign/cli': {optional: true},
|
|
674
|
+
});
|
|
675
|
+
});
|
|
676
|
+
});
|
|
@@ -24,6 +24,7 @@ import {
|
|
|
24
24
|
discoverIntegrationComponents,
|
|
25
25
|
discoverOwnedComponents,
|
|
26
26
|
} from '../../foundation/discovery/component-discovery.mjs';
|
|
27
|
+
import {loadComponentReplacements} from '../component/_adapter.mjs';
|
|
27
28
|
import {
|
|
28
29
|
discoverBuiltinTopics,
|
|
29
30
|
discoverIntegrationDocs,
|
|
@@ -92,6 +93,7 @@ function addErrors(issues, errors, code) {
|
|
|
92
93
|
export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
93
94
|
const {cwd = process.cwd()} = options;
|
|
94
95
|
const resolved = await resolveIntegration(pkg, cwd);
|
|
96
|
+
const validated = resolved.found;
|
|
95
97
|
const name = resolved.found ? (resolved.name ?? null) : null;
|
|
96
98
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
97
99
|
const issues = [...resolved.issues];
|
|
@@ -99,7 +101,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
99
101
|
if (!resolved.integration || name == null) {
|
|
100
102
|
return {
|
|
101
103
|
type: 'integration.template-conflicts',
|
|
102
|
-
data: {name, version, conflicts: [], issues},
|
|
104
|
+
data: {validated, name, version, conflicts: [], issues},
|
|
103
105
|
};
|
|
104
106
|
}
|
|
105
107
|
|
|
@@ -215,7 +217,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
215
217
|
|
|
216
218
|
return {
|
|
217
219
|
type: 'integration.template-conflicts',
|
|
218
|
-
data: {name, version, conflicts, issues},
|
|
220
|
+
data: {validated, name, version, conflicts, issues},
|
|
219
221
|
};
|
|
220
222
|
}
|
|
221
223
|
|
|
@@ -228,6 +230,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
228
230
|
export async function integrationComponentConflicts(pkg, options = {}) {
|
|
229
231
|
const {cwd = process.cwd()} = options;
|
|
230
232
|
const resolved = await resolveIntegration(pkg, cwd);
|
|
233
|
+
const validated = resolved.found;
|
|
231
234
|
const name = resolved.found ? (resolved.name ?? null) : null;
|
|
232
235
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
233
236
|
const issues = [...resolved.issues];
|
|
@@ -235,7 +238,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
235
238
|
if (!resolved.integration?.components || name == null) {
|
|
236
239
|
return {
|
|
237
240
|
type: 'integration.component-conflicts',
|
|
238
|
-
data: {name, version, conflicts: [], issues},
|
|
241
|
+
data: {validated, name, version, conflicts: [], issues},
|
|
239
242
|
};
|
|
240
243
|
}
|
|
241
244
|
|
|
@@ -249,7 +252,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
249
252
|
});
|
|
250
253
|
return {
|
|
251
254
|
type: 'integration.component-conflicts',
|
|
252
|
-
data: {name, version, conflicts: [], issues},
|
|
255
|
+
data: {validated, name, version, conflicts: [], issues},
|
|
253
256
|
};
|
|
254
257
|
}
|
|
255
258
|
|
|
@@ -258,9 +261,28 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
258
261
|
.filter(record => record.package === '@astryxdesign/core')
|
|
259
262
|
.map(record => record.name),
|
|
260
263
|
);
|
|
264
|
+
// Component replacements (spec:AST-035 FR10-FR15). A package without the
|
|
265
|
+
// CLI floor gets only warnings, so its exit code is what it was before the
|
|
266
|
+
// floor existed. An active replacement named after its own target is
|
|
267
|
+
// intentional, not a conflict.
|
|
268
|
+
const replacements = await loadComponentReplacements(coreDir, [
|
|
269
|
+
resolved.integration,
|
|
270
|
+
]);
|
|
271
|
+
addErrors(issues, replacements.findings, 'invalid_component_replacement');
|
|
272
|
+
const intentional = new Set(
|
|
273
|
+
replacements.active
|
|
274
|
+
.filter(
|
|
275
|
+
active => active.package === name && active.name === active.target,
|
|
276
|
+
)
|
|
277
|
+
.map(active => active.name),
|
|
278
|
+
);
|
|
279
|
+
|
|
261
280
|
const run = getCliInvocation(cwd);
|
|
262
281
|
const conflicts = discoverIntegrationComponents(resolved.integration)
|
|
263
|
-
.filter(
|
|
282
|
+
.filter(
|
|
283
|
+
component =>
|
|
284
|
+
coreNames.has(component.name) && !intentional.has(component.name),
|
|
285
|
+
)
|
|
264
286
|
.map(component => ({
|
|
265
287
|
name: component.name,
|
|
266
288
|
severity: /** @type {const} */ ('warning'),
|
|
@@ -274,7 +296,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
274
296
|
|
|
275
297
|
return {
|
|
276
298
|
type: 'integration.component-conflicts',
|
|
277
|
-
data: {name, version, conflicts, issues},
|
|
299
|
+
data: {validated, name, version, conflicts, issues},
|
|
278
300
|
};
|
|
279
301
|
}
|
|
280
302
|
|
|
@@ -287,6 +309,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
|
|
|
287
309
|
export async function integrationDocConflicts(pkg, options = {}) {
|
|
288
310
|
const {cwd = process.cwd()} = options;
|
|
289
311
|
const resolved = await resolveIntegration(pkg, cwd);
|
|
312
|
+
const validated = resolved.found;
|
|
290
313
|
const name = resolved.found ? (resolved.name ?? null) : null;
|
|
291
314
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
292
315
|
const issues = [...resolved.issues];
|
|
@@ -294,7 +317,7 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
294
317
|
if (!resolved.integration?.docs || name == null) {
|
|
295
318
|
return {
|
|
296
319
|
type: 'integration.doc-conflicts',
|
|
297
|
-
data: {name, version, findings: [], issues},
|
|
320
|
+
data: {validated, name, version, findings: [], issues},
|
|
298
321
|
};
|
|
299
322
|
}
|
|
300
323
|
|
|
@@ -388,6 +411,6 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
388
411
|
|
|
389
412
|
return {
|
|
390
413
|
type: 'integration.doc-conflicts',
|
|
391
|
-
data: {name, version, findings, issues},
|
|
414
|
+
data: {validated, name, version, findings, issues},
|
|
392
415
|
};
|
|
393
416
|
}
|
|
@@ -32,9 +32,15 @@ export type IntegrationDocFinding = {
|
|
|
32
32
|
coreTopic: string;
|
|
33
33
|
message: string;
|
|
34
34
|
};
|
|
35
|
+
/**
|
|
36
|
+
* Each of the three authoring checks reports `validated`: false means no
|
|
37
|
+
* integration manifest was found, so nothing was inspected and the empty
|
|
38
|
+
* conflicts/findings list carries no information about the package.
|
|
39
|
+
*/
|
|
35
40
|
export type IntegrationTemplateConflictResponse = {
|
|
36
41
|
type: "integration.template-conflicts";
|
|
37
42
|
data: {
|
|
43
|
+
validated: boolean;
|
|
38
44
|
name: string | null;
|
|
39
45
|
version: string | null;
|
|
40
46
|
conflicts: IntegrationTemplateConflict[];
|
|
@@ -44,6 +50,7 @@ export type IntegrationTemplateConflictResponse = {
|
|
|
44
50
|
export type IntegrationComponentConflictResponse = {
|
|
45
51
|
type: "integration.component-conflicts";
|
|
46
52
|
data: {
|
|
53
|
+
validated: boolean;
|
|
47
54
|
name: string | null;
|
|
48
55
|
version: string | null;
|
|
49
56
|
conflicts: IntegrationComponentConflict[];
|
|
@@ -53,6 +60,7 @@ export type IntegrationComponentConflictResponse = {
|
|
|
53
60
|
export type IntegrationDocConflictResponse = {
|
|
54
61
|
type: "integration.doc-conflicts";
|
|
55
62
|
data: {
|
|
63
|
+
validated: boolean;
|
|
56
64
|
name: string | null;
|
|
57
65
|
version: string | null;
|
|
58
66
|
findings: IntegrationDocFinding[];
|
|
@@ -49,21 +49,25 @@
|
|
|
49
49
|
*/
|
|
50
50
|
|
|
51
51
|
/**
|
|
52
|
+
* Each of the three authoring checks reports `validated`: false means no
|
|
53
|
+
* integration manifest was found, so nothing was inspected and the empty
|
|
54
|
+
* conflicts/findings list carries no information about the package.
|
|
55
|
+
*
|
|
52
56
|
* @typedef {object} IntegrationTemplateConflictResponse
|
|
53
57
|
* @property {'integration.template-conflicts'} type
|
|
54
|
-
* @property {{name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
58
|
+
* @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
55
59
|
*/
|
|
56
60
|
|
|
57
61
|
/**
|
|
58
62
|
* @typedef {object} IntegrationComponentConflictResponse
|
|
59
63
|
* @property {'integration.component-conflicts'} type
|
|
60
|
-
* @property {{name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
64
|
+
* @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
61
65
|
*/
|
|
62
66
|
|
|
63
67
|
/**
|
|
64
68
|
* @typedef {object} IntegrationDocConflictResponse
|
|
65
69
|
* @property {'integration.doc-conflicts'} type
|
|
66
|
-
* @property {{name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
70
|
+
* @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
|
|
67
71
|
*/
|
|
68
72
|
|
|
69
73
|
export {};
|
|
@@ -19,7 +19,9 @@ export type IntegrationAddCodemodOptions = IntegrationAddBaseOptions & {
|
|
|
19
19
|
to: string;
|
|
20
20
|
};
|
|
21
21
|
export type IntegrationAddAgentDocOptions = IntegrationAddBaseOptions;
|
|
22
|
-
export type IntegrationAddThemeOptions = IntegrationAddBaseOptions
|
|
22
|
+
export type IntegrationAddThemeOptions = IntegrationAddBaseOptions & {
|
|
23
|
+
from?: string;
|
|
24
|
+
};
|
|
23
25
|
/**
|
|
24
26
|
* Options for the generic `integrationAdd` dispatcher. Prefer a per-kind API
|
|
25
27
|
* when the contribution kind is known so the accepted options stay narrow.
|
|
@@ -54,4 +56,5 @@ export type IntegrationAddData = {
|
|
|
54
56
|
files: string[];
|
|
55
57
|
written: boolean;
|
|
56
58
|
dryRun: boolean;
|
|
59
|
+
from?: string | undefined;
|
|
57
60
|
};
|
|
@@ -37,7 +37,11 @@
|
|
|
37
37
|
*/
|
|
38
38
|
|
|
39
39
|
/** @typedef {IntegrationAddBaseOptions} IntegrationAddAgentDocOptions */
|
|
40
|
-
/**
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {IntegrationAddBaseOptions & {
|
|
42
|
+
* from?: string,
|
|
43
|
+
* }} IntegrationAddThemeOptions
|
|
44
|
+
*/
|
|
41
45
|
|
|
42
46
|
/**
|
|
43
47
|
* Options for the generic `integrationAdd` dispatcher. Prefer a per-kind API
|
|
@@ -73,6 +77,7 @@
|
|
|
73
77
|
* @property {string[]} files
|
|
74
78
|
* @property {boolean} written
|
|
75
79
|
* @property {boolean} dryRun
|
|
80
|
+
* @property {string} [from]
|
|
76
81
|
*/
|
|
77
82
|
|
|
78
83
|
export {};
|