@astryxdesign/cli 0.6.5 → 0.6.6-canary.11a80dd
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
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import {describe, it, expect, beforeEach, afterEach, vi} from 'vitest';
|
|
4
|
+
import * as fs from 'node:fs';
|
|
5
|
+
import * as path from 'node:path';
|
|
6
|
+
import * as os from 'node:os';
|
|
7
|
+
import {Command} from 'commander';
|
|
8
|
+
import {formatBlock, registerDocs} from './docs.mjs';
|
|
9
|
+
import {runCli} from '../../../test-utils/run-cli.mjs';
|
|
10
|
+
import {displayWidth} from '../formatters/index.mjs';
|
|
11
|
+
|
|
12
|
+
let tmpDir;
|
|
13
|
+
|
|
14
|
+
beforeEach(() => {
|
|
15
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-docs-test-'));
|
|
16
|
+
vi.spyOn(console, 'log').mockImplementation(() => {});
|
|
17
|
+
vi.spyOn(console, 'error').mockImplementation(() => {});
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
afterEach(() => {
|
|
21
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
22
|
+
vi.restoreAllMocks();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
function createProgram() {
|
|
26
|
+
const program = new Command();
|
|
27
|
+
program.exitOverride(); // Throw instead of calling process.exit
|
|
28
|
+
registerDocs(program);
|
|
29
|
+
return program;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
describe('registerDocs', () => {
|
|
33
|
+
it('lists available topics when no topic given', async () => {
|
|
34
|
+
const program = createProgram();
|
|
35
|
+
await program.parseAsync(['node', 'astryx', 'docs']);
|
|
36
|
+
|
|
37
|
+
const output = console.log.mock.calls.map(c => c[0]).join('\n');
|
|
38
|
+
expect(output).toContain('principles');
|
|
39
|
+
expect(output).toContain('tokens');
|
|
40
|
+
expect(output).not.toContain('shadcn-compatibility');
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
it('errors for unknown topic', async () => {
|
|
44
|
+
const program = createProgram();
|
|
45
|
+
vi.spyOn(process, 'exit').mockImplementation(code => {
|
|
46
|
+
throw new Error(`exit ${code}`);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
await expect(
|
|
50
|
+
program.parseAsync(['node', 'astryx', 'docs', 'nonexistent']),
|
|
51
|
+
).rejects.toThrow('exit 1');
|
|
52
|
+
|
|
53
|
+
const errorOutput = console.error.mock.calls.map(c => c[0]).join('\n');
|
|
54
|
+
expect(errorOutput).toContain('Unknown topic');
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
describe('hyphenated doc filenames', () => {
|
|
59
|
+
it('lists hyphenated topics like getting-started', async () => {
|
|
60
|
+
const program = createProgram();
|
|
61
|
+
await program.parseAsync(['node', 'astryx', 'docs']);
|
|
62
|
+
|
|
63
|
+
const output = console.log.mock.calls.map(c => c[0]).join('\n');
|
|
64
|
+
expect(output).toContain('getting-started');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('loads a hyphenated topic by name', async () => {
|
|
68
|
+
const program = createProgram();
|
|
69
|
+
await program.parseAsync(['node', 'astryx', 'docs', 'getting-started']);
|
|
70
|
+
|
|
71
|
+
const output = console.log.mock.calls.map(c => c[0]).join('\n');
|
|
72
|
+
expect(output.length).toBeGreaterThan(0);
|
|
73
|
+
expect(console.error).not.toHaveBeenCalled();
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('returns docs.detail via API for hyphenated topic', async () => {
|
|
77
|
+
const {docs: docsApi} = await import('../../../api/docs/docs.mjs');
|
|
78
|
+
const result = await docsApi('getting-started', undefined, {full: true});
|
|
79
|
+
expect(result.type).toBe('docs.detail');
|
|
80
|
+
expect(result.data).toBeDefined();
|
|
81
|
+
expect(result.data.description).toBeDefined();
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
describe('migration docs', () => {
|
|
86
|
+
it('lists the migration topic', async () => {
|
|
87
|
+
const program = createProgram();
|
|
88
|
+
await program.parseAsync(['node', 'astryx', 'docs']);
|
|
89
|
+
|
|
90
|
+
const output = console.log.mock.calls.map(c => c[0]).join('\n');
|
|
91
|
+
expect(output).toContain('migration');
|
|
92
|
+
expect(output).toContain('Tailwind');
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it('loads migration docs by topic name', async () => {
|
|
96
|
+
const program = createProgram();
|
|
97
|
+
await program.parseAsync(['node', 'astryx', 'docs', 'migration']);
|
|
98
|
+
|
|
99
|
+
const output = console.log.mock.calls.map(c => c[0]).join('\n');
|
|
100
|
+
expect(output).toContain('Migration Guide');
|
|
101
|
+
expect(output).toContain('Recommended Order');
|
|
102
|
+
expect(output).toContain('Map shadcn and Radix Primitives');
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
describe('progressive reads', () => {
|
|
107
|
+
const SLOW = 60_000;
|
|
108
|
+
/** @param {string} out */
|
|
109
|
+
const widest = out => Math.max(...out.split('\n').map(line => line.length));
|
|
110
|
+
|
|
111
|
+
it('lists every topic on one line each', async () => {
|
|
112
|
+
const {status, stdout} = await runCli(['docs']);
|
|
113
|
+
expect(status).toBe(0);
|
|
114
|
+
expect(stdout).toMatch(/^principles +\S/m);
|
|
115
|
+
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
116
|
+
// The repo root has no `astryx` bin, so the CLI names the scoped package.
|
|
117
|
+
expect(stdout).toMatch(/Usage: \S+(?: dlx)? (?:astryx|@astryxdesign\/cli) docs <topic>/);
|
|
118
|
+
}, SLOW);
|
|
119
|
+
|
|
120
|
+
it("prints a topic's section index with the keys to read by", async () => {
|
|
121
|
+
const {status, stdout} = await runCli(['docs', 'theme', '--index']);
|
|
122
|
+
expect(status).toBe(0);
|
|
123
|
+
expect(stdout).toMatch(/^quick-start +Wrap your app in a theme/m);
|
|
124
|
+
expect(stdout).toContain('docs theme <section>');
|
|
125
|
+
expect(stdout).toMatch(/Read everything: +\S.* docs theme --full$/m);
|
|
126
|
+
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
127
|
+
}, SLOW);
|
|
128
|
+
|
|
129
|
+
it('prints one section by its key', async () => {
|
|
130
|
+
const {status, stdout} = await runCli(['docs', 'theme', 'quick-start']);
|
|
131
|
+
expect(status).toBe(0);
|
|
132
|
+
expect(stdout).toMatch(/^## Wrap your app in a theme/m);
|
|
133
|
+
}, SLOW);
|
|
134
|
+
|
|
135
|
+
it("lists a topic's sections by default; --full prints the whole topic", async () => {
|
|
136
|
+
const index = await runCli(['docs', 'theme', '--index']);
|
|
137
|
+
expect((await runCli(['docs', 'theme'])).stdout).toBe(index.stdout);
|
|
138
|
+
const full = await runCli(['docs', 'theme', '--full']);
|
|
139
|
+
expect(full.status).toBe(0);
|
|
140
|
+
expect(full.stdout).toMatch(/^## Wrap your app in a theme/m);
|
|
141
|
+
expect(full.stdout.length).toBeGreaterThan(index.stdout.length);
|
|
142
|
+
expect((await runCli(['--detail', 'full', 'docs', 'theme', '--full'])).stdout).toBe(
|
|
143
|
+
full.stdout,
|
|
144
|
+
);
|
|
145
|
+
}, SLOW);
|
|
146
|
+
|
|
147
|
+
it('returns the matching envelopes as JSON', async () => {
|
|
148
|
+
const envelope = async args => JSON.parse((await runCli([...args, '--json'])).stdout);
|
|
149
|
+
// JSON keeps docs(): a bare read is the whole topic.
|
|
150
|
+
expect((await envelope(['docs', 'theme'])).type).toBe('docs.detail');
|
|
151
|
+
expect((await envelope(['docs', 'theme', '--full'])).type).toBe('docs.detail');
|
|
152
|
+
expect((await envelope(['docs', 'theme', '--index'])).type).toBe(
|
|
153
|
+
'docs.index',
|
|
154
|
+
);
|
|
155
|
+
expect((await envelope(['docs', 'theme', 'quick-start'])).type).toBe(
|
|
156
|
+
'docs.detail.section',
|
|
157
|
+
);
|
|
158
|
+
}, SLOW);
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
describe('blocks as text', () => {
|
|
162
|
+
const SLOW = 60_000;
|
|
163
|
+
|
|
164
|
+
it('prints a code label above the fence, never inside it', () => {
|
|
165
|
+
for (const lang of ['bash', 'css', 'json', 'html', 'text', 'tsx']) {
|
|
166
|
+
expect(
|
|
167
|
+
formatBlock({type: 'code', lang, label: 'Terminal', code: 'x'}, 'full'),
|
|
168
|
+
).toBe(`Terminal:\n\`\`\`${lang}\nx\n\`\`\``);
|
|
169
|
+
}
|
|
170
|
+
expect(formatBlock({type: 'code', lang: 'bash', code: 'x'}, 'full')).toBe(
|
|
171
|
+
'```bash\nx\n```',
|
|
172
|
+
);
|
|
173
|
+
// A label that already ends in a colon does not get a second one.
|
|
174
|
+
expect(
|
|
175
|
+
formatBlock({type: 'code', lang: 'css', label: 'globals.css:', code: 'x'}, 'full'),
|
|
176
|
+
).toBe('globals.css:\n```css\nx\n```');
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it('escapes pipes in table cells, so a union type stays one column', () => {
|
|
180
|
+
const table = {
|
|
181
|
+
type: /** @type {const} */ ('table'),
|
|
182
|
+
headers: ['Prop', 'Type', 'Default'],
|
|
183
|
+
rows: [
|
|
184
|
+
['mode', "'system' | 'light' | 'dark'", "'system'"],
|
|
185
|
+
['theme', 'DefinedTheme', '-'],
|
|
186
|
+
],
|
|
187
|
+
};
|
|
188
|
+
const lines = /** @type {string} */ (formatBlock(table, 'full')).split('\n');
|
|
189
|
+
expect(lines).toHaveLength(4);
|
|
190
|
+
// Every line has exactly two column separators, all at the same place.
|
|
191
|
+
for (const line of lines) expect(line.split(' | ')).toHaveLength(3);
|
|
192
|
+
expect(new Set(lines.map(line => line.indexOf(' | '))).size).toBe(1);
|
|
193
|
+
expect(lines[2]).toContain("'system' \\| 'light' \\| 'dark'");
|
|
194
|
+
expect(formatBlock(table, 'brief')).toBe(
|
|
195
|
+
"mode='system' \\| 'light' \\| 'dark' | theme=DefinedTheme",
|
|
196
|
+
);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
it('prints the labels of a real section above their fences', async () => {
|
|
200
|
+
const {status, stdout} = await runCli(['docs', 'theme', 'quick-start']);
|
|
201
|
+
expect(status).toBe(0);
|
|
202
|
+
expect(stdout).toContain('Wire the generated module once:\n```tsx\nimport {Theme}');
|
|
203
|
+
}, SLOW);
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
describe('the docs tree, one level at a time', () => {
|
|
207
|
+
const SLOW = 60_000;
|
|
208
|
+
/** @param {string} out */
|
|
209
|
+
const widest = out => Math.max(...out.split('\n').map(line => line.length));
|
|
210
|
+
|
|
211
|
+
it('lists the docs tree first, under its own heading, then the topics', async () => {
|
|
212
|
+
const {status, stdout} = await runCli(['docs']);
|
|
213
|
+
expect(status).toBe(0);
|
|
214
|
+
expect(stdout).toMatch(/^Docs tree$/m);
|
|
215
|
+
expect(stdout).toMatch(/^Topics$/m);
|
|
216
|
+
expect(stdout).toMatch(/^cli +Commands, programmatic APIs/m);
|
|
217
|
+
expect(stdout.indexOf('\ncli ')).toBeLessThan(stdout.indexOf('\nprinciples '));
|
|
218
|
+
expect(stdout).not.toMatch(/^cli-integrations /m);
|
|
219
|
+
}, SLOW);
|
|
220
|
+
|
|
221
|
+
it("shows a child's own name when its route name does not spell it", async () => {
|
|
222
|
+
const {status, stdout} = await runCli(['docs', 'cli/api/functions']);
|
|
223
|
+
expect(status).toBe(0);
|
|
224
|
+
expect(stdout).toMatch(/^assert-response +assertResponse\(\): \S/m);
|
|
225
|
+
expect(stdout).toMatch(/^search +search\(\): Unified ranked search/m);
|
|
226
|
+
}, SLOW);
|
|
227
|
+
|
|
228
|
+
it('wraps namespace summaries without discarding searchable words', async () => {
|
|
229
|
+
const {status, stdout} = await runCli([
|
|
230
|
+
'docs',
|
|
231
|
+
'cli/integrations/building-blocks/templates',
|
|
232
|
+
]);
|
|
233
|
+
expect(status).toBe(0);
|
|
234
|
+
expect(stdout).toMatch(/^start-a-template +Help others build apps faster/m);
|
|
235
|
+
expect(stdout).not.toMatch(/^start-a-template +Start a template:/m);
|
|
236
|
+
expect(stdout).toMatch(/full page or page\s+section\./);
|
|
237
|
+
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
238
|
+
}, SLOW);
|
|
239
|
+
|
|
240
|
+
it('prints a namespace: each slot, its children, and how to go down and up', async () => {
|
|
241
|
+
const {status, stdout} = await runCli(['docs', 'cli/api']);
|
|
242
|
+
expect(status).toBe(0);
|
|
243
|
+
expect(stdout).toMatch(/^API$/m);
|
|
244
|
+
expect(stdout).toMatch(/^Reference$/m);
|
|
245
|
+
expect(stdout).toMatch(/^functions +Every function/m);
|
|
246
|
+
expect(stdout).toMatch(/^schemas +/m);
|
|
247
|
+
expect(stdout).toMatch(/^enums +/m);
|
|
248
|
+
// One level only: no function is listed on the api page.
|
|
249
|
+
expect(stdout).not.toMatch(/^search +/m);
|
|
250
|
+
expect(stdout).toMatch(/Open one: .*docs cli\/api\/<name>$/m);
|
|
251
|
+
expect(stdout).toMatch(/Up: .*docs cli$/m);
|
|
252
|
+
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
253
|
+
}, SLOW);
|
|
254
|
+
|
|
255
|
+
it('prints a typed doc and the way back up', async () => {
|
|
256
|
+
const {status, stdout} = await runCli(['docs', 'cli/api/functions/search']);
|
|
257
|
+
expect(status).toBe(0);
|
|
258
|
+
expect(stdout).toMatch(/^## search\(\)/m);
|
|
259
|
+
expect(stdout).toContain('Read it with `astryx docs cli/commands/search`.');
|
|
260
|
+
expect(stdout).toMatch(/Up: .*docs cli\/api\/functions$/m);
|
|
261
|
+
}, SLOW);
|
|
262
|
+
|
|
263
|
+
it('reads the dense variant whole, asked with --dense or with --lang dense', async () => {
|
|
264
|
+
for (const args of [['--dense', 'docs', 'theme'], ['--lang', 'dense', 'docs', 'theme']]) {
|
|
265
|
+
const {status, stdout} = await runCli(args);
|
|
266
|
+
expect(status).toBe(0);
|
|
267
|
+
expect(stdout).not.toContain('Read one section:');
|
|
268
|
+
}
|
|
269
|
+
}, SLOW);
|
|
270
|
+
|
|
271
|
+
it('refuses --index with --full', async () => {
|
|
272
|
+
const both = await runCli(['docs', 'theme', '--index', '--full', '--json']);
|
|
273
|
+
expect(both.status).toBe(1);
|
|
274
|
+
expect(JSON.parse(both.stdout).code).toBe('ERR_INVALID_ARGUMENT');
|
|
275
|
+
}, SLOW);
|
|
276
|
+
|
|
277
|
+
it('reads the integration guides by their routes, and not by the old name', async () => {
|
|
278
|
+
// cli/integrations is a namespace: one level, its guides by slot.
|
|
279
|
+
const level = await runCli(['docs', 'cli/integrations']);
|
|
280
|
+
expect(level.status).toBe(0);
|
|
281
|
+
expect(level.stdout).toMatch(
|
|
282
|
+
/^quick-start +Create a new integration package/m,
|
|
283
|
+
);
|
|
284
|
+
expect(level.stdout).toMatch(/^building-blocks +/m);
|
|
285
|
+
const guide = await runCli([
|
|
286
|
+
'docs',
|
|
287
|
+
'cli/integrations/building-blocks/codemods',
|
|
288
|
+
'--index',
|
|
289
|
+
]);
|
|
290
|
+
expect(guide.status).toBe(0);
|
|
291
|
+
expect(guide.stdout).toMatch(
|
|
292
|
+
/Read one section: .*docs cli\/integrations\/building-blocks\/codemods <section>/,
|
|
293
|
+
);
|
|
294
|
+
// A bare read is one level too: the sections, and how to read it all.
|
|
295
|
+
const bare = await runCli([
|
|
296
|
+
'docs',
|
|
297
|
+
'cli/integrations/building-blocks/codemods',
|
|
298
|
+
]);
|
|
299
|
+
expect(bare.status).toBe(0);
|
|
300
|
+
expect(bare.stdout).toBe(guide.stdout);
|
|
301
|
+
expect(bare.stdout).toMatch(
|
|
302
|
+
/Read everything: +.*docs cli\/integrations\/building-blocks\/codemods --full$/m,
|
|
303
|
+
);
|
|
304
|
+
const one = await runCli([
|
|
305
|
+
'docs',
|
|
306
|
+
'cli/integrations/building-blocks/codemods',
|
|
307
|
+
'which-codemods-run',
|
|
308
|
+
]);
|
|
309
|
+
expect(one.status).toBe(0);
|
|
310
|
+
expect(one.stdout).toMatch(/^## Choose when a codemod runs$/m);
|
|
311
|
+
expect(one.stdout).toMatch(
|
|
312
|
+
/^Up: .*docs cli\/integrations\/building-blocks\/codemods --index$/m,
|
|
313
|
+
);
|
|
314
|
+
expect(one.stdout).toMatch(
|
|
315
|
+
/^Previous: .*docs cli\/integrations\/building-blocks\/codemods write-the-transform$/m,
|
|
316
|
+
);
|
|
317
|
+
expect(one.stdout).toMatch(
|
|
318
|
+
/^Next: .*docs cli\/integrations\/building-blocks\/codemods run-codemods-in-an-app$/m,
|
|
319
|
+
);
|
|
320
|
+
const full = await runCli([
|
|
321
|
+
'docs',
|
|
322
|
+
'cli/integrations/building-blocks/codemods',
|
|
323
|
+
'--full',
|
|
324
|
+
]);
|
|
325
|
+
expect(full.status).toBe(0);
|
|
326
|
+
expect(full.stdout).toMatch(/^## Add a codemod$/m);
|
|
327
|
+
expect(full.stdout.length).toBeGreaterThan(bare.stdout.length * 2);
|
|
328
|
+
const old = await runCli(['docs', 'cli-integrations']);
|
|
329
|
+
expect(old.status).toBe(1);
|
|
330
|
+
expect(old.stderr).toContain('Unknown topic "cli-integrations"');
|
|
331
|
+
}, SLOW);
|
|
332
|
+
|
|
333
|
+
it('returns docs.node as JSON, and fails a section of a namespace', async () => {
|
|
334
|
+
const node = JSON.parse((await runCli(['docs', 'cli', '--json'])).stdout);
|
|
335
|
+
expect(node).toMatchObject({
|
|
336
|
+
type: 'docs.node',
|
|
337
|
+
data: {route: 'cli', kind: 'namespace', breadcrumb: []},
|
|
338
|
+
});
|
|
339
|
+
expect(node.data.slots.map(slot => slot.name)).toEqual(['guides', 'reference']);
|
|
340
|
+
const section = await runCli(['docs', 'cli', 'commands', '--json']);
|
|
341
|
+
expect(section.status).toBe(1);
|
|
342
|
+
const error = JSON.parse(section.stdout);
|
|
343
|
+
expect(error).toMatchObject({code: 'ERR_UNKNOWN_SECTION'});
|
|
344
|
+
// It names the namespace's children, in the order its slots list them.
|
|
345
|
+
expect(error.suggestions.map(s => s.name)).toEqual(
|
|
346
|
+
node.data.slots.flatMap(slot => slot.children.map(child => child.route)),
|
|
347
|
+
);
|
|
348
|
+
expect(error.suggestions.map(s => s.name)).toContain('cli/commands');
|
|
349
|
+
}, SLOW);
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
describe('text width in every language', () => {
|
|
353
|
+
const SLOW = 60_000;
|
|
354
|
+
/** Widest line outside code blocks, in terminal columns. */
|
|
355
|
+
const widest = out => {
|
|
356
|
+
let inCode = false;
|
|
357
|
+
let max = 0;
|
|
358
|
+
for (const line of out.split('\n')) {
|
|
359
|
+
if (/^\s*```/.test(line)) {
|
|
360
|
+
inCode = !inCode;
|
|
361
|
+
continue;
|
|
362
|
+
}
|
|
363
|
+
// A single unbreakable token (a long URL) cannot wrap without breaking it.
|
|
364
|
+
const oneToken = !/\s/.test(line.trim());
|
|
365
|
+
if (!inCode && !line.startsWith('#') && !oneToken) {
|
|
366
|
+
max = Math.max(max, displayWidth(line));
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
return max;
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
it('keeps the additive section index within 120 columns', async () => {
|
|
373
|
+
const {status, stdout} = await runCli([
|
|
374
|
+
'docs',
|
|
375
|
+
'theme',
|
|
376
|
+
'--index',
|
|
377
|
+
'--lang',
|
|
378
|
+
'zh',
|
|
379
|
+
]);
|
|
380
|
+
expect(status).toBe(0);
|
|
381
|
+
expect(widest(stdout)).toBeLessThanOrEqual(120);
|
|
382
|
+
}, SLOW);
|
|
383
|
+
});
|
|
@@ -8,11 +8,16 @@ export const doc = {
|
|
|
8
8
|
name: 'doctor integration components',
|
|
9
9
|
displayName: 'astryx doctor integration components',
|
|
10
10
|
namespace: 'cli/commands',
|
|
11
|
-
summary: '
|
|
11
|
+
summary: 'Check integration component names and replacements against Core',
|
|
12
12
|
description:
|
|
13
13
|
'Compares one local or installed integration with Core component names. A ' +
|
|
14
14
|
'conflict is allowed and exits successfully, but the report recommends ' +
|
|
15
|
-
'renaming and gives the exact --package command for an intentional overlap.'
|
|
15
|
+
'renaming and gives the exact --package command for an intentional overlap. ' +
|
|
16
|
+
"It also checks each component's replaces: in a package that declares the CLI " +
|
|
17
|
+
'range that turns replacement on, a missing Core target, an invalid value, a ' +
|
|
18
|
+
'component named after a different Core component, or two replacements for one ' +
|
|
19
|
+
'Core component is an error. In a package without that range they are warnings, ' +
|
|
20
|
+
'with one more warning naming the range to declare.',
|
|
16
21
|
fn: 'integrationComponentConflicts',
|
|
17
22
|
args: [
|
|
18
23
|
{
|
|
@@ -31,8 +36,14 @@ export const doc = {
|
|
|
31
36
|
},
|
|
32
37
|
],
|
|
33
38
|
exitCodes: [
|
|
34
|
-
{
|
|
35
|
-
|
|
39
|
+
{
|
|
40
|
+
code: 0,
|
|
41
|
+
when: 'the check completed; component name conflicts, and replaces findings for a package without the CLI range, are warnings',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
code: 1,
|
|
45
|
+
when: 'the integration is invalid, Core cannot be resolved, or a package that declares the CLI range has an invalid replaces',
|
|
46
|
+
},
|
|
36
47
|
],
|
|
37
48
|
related: ['doctor integration templates', 'component'],
|
|
38
49
|
};
|
|
@@ -16,7 +16,7 @@ export const doc = {
|
|
|
16
16
|
summary: 'Diagnose Astryx projects and integration packages',
|
|
17
17
|
description:
|
|
18
18
|
'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
|
|
19
|
-
'install and version alignment, themes, config, integrations (linked without a config entry, ' +
|
|
19
|
+
'install and version alignment, theme packages, generated app themes when present, earlier copied-theme migration, config, integrations (linked without a config entry, ' +
|
|
20
20
|
'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
|
|
21
21
|
"and the docs the CLI reads. It writes nothing, but loading astryx.config runs that file's code. " +
|
|
22
22
|
'The `integration` subcommands provide authoring checks for one integration package.',
|
|
@@ -258,10 +258,10 @@ async function runProjectDoctor(program) {
|
|
|
258
258
|
async function runIntegrationValidation(program, pkg) {
|
|
259
259
|
const result = await validateIntegration(pkg);
|
|
260
260
|
if (program.opts().json) jsonOut(result);
|
|
261
|
-
else if (result.data.
|
|
261
|
+
else if (!result.data.validated) {
|
|
262
262
|
emit(
|
|
263
263
|
text(
|
|
264
|
-
'
|
|
264
|
+
'Nothing was validated: no astryx.integration.* found next to package.json. ' +
|
|
265
265
|
'To validate an installed integration: astryx doctor integration validate <package>',
|
|
266
266
|
),
|
|
267
267
|
);
|
|
@@ -284,10 +284,10 @@ async function runAuthoringCheck(program, pkg, kind) {
|
|
|
284
284
|
: await integrationDocConflicts(pkg);
|
|
285
285
|
|
|
286
286
|
if (program.opts().json) jsonOut(result);
|
|
287
|
-
else if (result.data.
|
|
287
|
+
else if (!result.data.validated) {
|
|
288
288
|
emit(
|
|
289
289
|
text(
|
|
290
|
-
'
|
|
290
|
+
'Nothing was checked: no astryx.integration.* found next to package.json. ' +
|
|
291
291
|
`To check an installed integration: astryx doctor integration ${kind} <package>`,
|
|
292
292
|
),
|
|
293
293
|
);
|
|
@@ -14,7 +14,6 @@ import {
|
|
|
14
14
|
checkNodeVersion,
|
|
15
15
|
checkCoreInstalled,
|
|
16
16
|
checkVersionAlignment,
|
|
17
|
-
checkThemes,
|
|
18
17
|
checkConfig,
|
|
19
18
|
checkAgentDocs,
|
|
20
19
|
checkPeerDeps,
|
|
@@ -63,33 +62,6 @@ function installPkg(name, version = '1.0.0') {
|
|
|
63
62
|
return dir;
|
|
64
63
|
}
|
|
65
64
|
|
|
66
|
-
/**
|
|
67
|
-
* Mirror pnpm's layout: the real package lives under node_modules/.pnpm and
|
|
68
|
-
* the entry in the scope directory is a symlink to it.
|
|
69
|
-
*/
|
|
70
|
-
function installPkgPnpmStyle(name, version = '1.0.0') {
|
|
71
|
-
const realDir = path.join(
|
|
72
|
-
tmpDir,
|
|
73
|
-
'node_modules',
|
|
74
|
-
'.pnpm',
|
|
75
|
-
`${name.replace('/', '+')}@${version}`,
|
|
76
|
-
'node_modules',
|
|
77
|
-
...name.split('/'),
|
|
78
|
-
);
|
|
79
|
-
fs.mkdirSync(realDir, {recursive: true});
|
|
80
|
-
fs.writeFileSync(
|
|
81
|
-
path.join(realDir, 'package.json'),
|
|
82
|
-
JSON.stringify({name, version, main: 'index.js'}),
|
|
83
|
-
);
|
|
84
|
-
fs.writeFileSync(path.join(realDir, 'index.js'), 'module.exports = {};');
|
|
85
|
-
const linkPath = path.join(tmpDir, 'node_modules', ...name.split('/'));
|
|
86
|
-
fs.mkdirSync(path.dirname(linkPath), {recursive: true});
|
|
87
|
-
// 'junction' keeps this working on Windows without elevated permissions;
|
|
88
|
-
// it is ignored on posix.
|
|
89
|
-
fs.symlinkSync(realDir, linkPath, 'junction');
|
|
90
|
-
return linkPath;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
65
|
function find(checks, id) {
|
|
94
66
|
return checks.find(c => c.id === id);
|
|
95
67
|
}
|
|
@@ -128,29 +100,15 @@ describe('doctor — individual checks', () => {
|
|
|
128
100
|
expect(res.status).toBe('info');
|
|
129
101
|
});
|
|
130
102
|
|
|
131
|
-
it('themes:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
expect(res.message).toContain('@astryxdesign/theme-neutral');
|
|
141
|
-
});
|
|
142
|
-
|
|
143
|
-
it('themes: PASS when theme installed and wired via config', () => {
|
|
144
|
-
installPkg('@astryxdesign/theme-neutral', '0.0.14');
|
|
145
|
-
const res = checkThemes({cwd: tmpDir, configTheme: 'default'});
|
|
146
|
-
expect(res.status).toBe('pass');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
it('themes: detects pnpm-style symlinked theme packages (#3530)', () => {
|
|
150
|
-
installPkgPnpmStyle('@astryxdesign/theme-neutral', '0.1.2');
|
|
151
|
-
const res = checkThemes({cwd: tmpDir, configTheme: 'default'});
|
|
152
|
-
expect(res.status).toBe('pass');
|
|
153
|
-
expect(res.message).toContain('@astryxdesign/theme-neutral');
|
|
103
|
+
it('app themes: reports unmanaged state as one INFO check', async () => {
|
|
104
|
+
fs.writeFileSync(path.join(tmpDir, 'package.json'), '{"name":"app"}\n');
|
|
105
|
+
const result = await runChecks({cwd: tmpDir});
|
|
106
|
+
const themeChecks = result.checks.filter(check =>
|
|
107
|
+
check.id.startsWith('theme-'),
|
|
108
|
+
);
|
|
109
|
+
expect(themeChecks).toEqual([
|
|
110
|
+
expect.objectContaining({id: 'theme-management', status: 'info'}),
|
|
111
|
+
]);
|
|
154
112
|
});
|
|
155
113
|
|
|
156
114
|
it('config: INFO when no astryx.config.mjs', async () => {
|
|
@@ -210,7 +168,23 @@ describe('doctor — individual checks', () => {
|
|
|
210
168
|
it('agent-docs: INFO when no docs present', () => {
|
|
211
169
|
const res = checkAgentDocs({cwd: tmpDir});
|
|
212
170
|
expect(res.status).toBe('info');
|
|
213
|
-
expect(res.fix).toContain('
|
|
171
|
+
expect(res.fix).toContain('init --features agents');
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// The npm package named `astryx` is not this CLI: a project without the
|
|
175
|
+
// `astryx` bin gets the scoped package in the fix, one with it keeps the bin.
|
|
176
|
+
it('agent-docs: the fix names the scoped package when the project has no local CLI', () => {
|
|
177
|
+
fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
|
|
178
|
+
const res = checkAgentDocs({cwd: tmpDir});
|
|
179
|
+
expect(res.fix).toContain('`npx @astryxdesign/cli init --features agents`');
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it('agent-docs: the fix keeps `npx astryx` when the project has a local CLI', () => {
|
|
183
|
+
fs.writeFileSync(path.join(tmpDir, 'package-lock.json'), '{}');
|
|
184
|
+
fs.mkdirSync(path.join(tmpDir, 'node_modules', '.bin'), {recursive: true});
|
|
185
|
+
fs.writeFileSync(path.join(tmpDir, 'node_modules', '.bin', 'astryx'), '');
|
|
186
|
+
const res = checkAgentDocs({cwd: tmpDir});
|
|
187
|
+
expect(res.fix).toContain('`npx astryx init --features agents`');
|
|
214
188
|
});
|
|
215
189
|
|
|
216
190
|
it('agent-docs: WARN when docs exist without XDS markers', () => {
|
|
@@ -13,7 +13,7 @@ export const doc = {
|
|
|
13
13
|
namespace: 'cli/commands',
|
|
14
14
|
summary: 'Report a missing component or feature to the package that owns it',
|
|
15
15
|
description:
|
|
16
|
-
'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability to the package that owns it: the --package you name, else the one package that provides the component, else Core. ' +
|
|
16
|
+
'Reports a missing component, variant, layout, styling, accessibility, API, or documentation capability to the package that owns it: the --package you name, else the integration whose component replaces it, else the one package that provides the component, else Core. ' +
|
|
17
17
|
'Every configured handler receives the report: the project config handler first, then each integration handler in config order. Public handlers run only with --confirm-public; internal handlers always run. A failing handler does not stop the others. ' +
|
|
18
18
|
"With no handler it files a GitHub issue for the owning package, only with --confirm-public (without it nothing is sent), or returns the package's issues URL when that is not on GitHub. " +
|
|
19
19
|
'The report records whether an agent or a person ran it.',
|
|
@@ -49,7 +49,7 @@ export const doc = {
|
|
|
49
49
|
flag: '--package <pkg>',
|
|
50
50
|
param: 'options.package',
|
|
51
51
|
description:
|
|
52
|
-
'Package that owns the gap: @astryxdesign/core or a loaded integration. Overrides automatic routing; needed when more than one package provides the component',
|
|
52
|
+
'Package that owns the gap: @astryxdesign/core or a loaded integration. Overrides automatic routing, which picks the integration whose component replaces the named Core component, else the one package that provides it, else Core; needed when more than one package provides the component',
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
flag: '--confirm-public',
|
|
@@ -55,6 +55,18 @@ export function registerGapReport(program) {
|
|
|
55
55
|
result.type === 'gap-report.file' &&
|
|
56
56
|
(result.data.status === 'failed' || result.data.status === 'partial');
|
|
57
57
|
|
|
58
|
+
// stderr in both modes, so a caller that reads only the exit code or the
|
|
59
|
+
// JSON envelope still sees which delivery failed and why.
|
|
60
|
+
if (isFailure && result.type === 'gap-report.file') {
|
|
61
|
+
for (const delivery of result.data.deliveries) {
|
|
62
|
+
if (delivery.status === 'failed') {
|
|
63
|
+
console.error(
|
|
64
|
+
`gap-report: delivery to ${delivery.handler} failed: ${delivery.message ?? 'no message'}`,
|
|
65
|
+
);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
if (program.opts().json) {
|
|
59
71
|
jsonOut(result);
|
|
60
72
|
if (isFailure) process.exitCode = 1;
|
|
@@ -172,6 +172,69 @@ export default {};\n`,
|
|
|
172
172
|
}
|
|
173
173
|
});
|
|
174
174
|
|
|
175
|
+
it('exits nonzero and names the integration on stderr when one fails to load', async () => {
|
|
176
|
+
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-gap-broken-'));
|
|
177
|
+
try {
|
|
178
|
+
fs.writeFileSync(
|
|
179
|
+
path.join(cwd, 'package.json'),
|
|
180
|
+
JSON.stringify({name: 'fixture-app'}),
|
|
181
|
+
);
|
|
182
|
+
fs.writeFileSync(
|
|
183
|
+
path.join(cwd, 'astryx.config.mjs'),
|
|
184
|
+
"export default {integrations: ['@test/broken']};\n",
|
|
185
|
+
);
|
|
186
|
+
const integrationDir = path.join(cwd, 'node_modules', '@test', 'broken');
|
|
187
|
+
fs.mkdirSync(integrationDir, {recursive: true});
|
|
188
|
+
fs.writeFileSync(
|
|
189
|
+
path.join(integrationDir, 'package.json'),
|
|
190
|
+
JSON.stringify({
|
|
191
|
+
name: '@test/broken',
|
|
192
|
+
version: '1.0.0',
|
|
193
|
+
type: 'module',
|
|
194
|
+
}),
|
|
195
|
+
);
|
|
196
|
+
fs.writeFileSync(
|
|
197
|
+
path.join(integrationDir, 'astryx.integration.mjs'),
|
|
198
|
+
"throw new Error('intentional integration load failure');\n",
|
|
199
|
+
);
|
|
200
|
+
|
|
201
|
+
const cli = await runCli(
|
|
202
|
+
[
|
|
203
|
+
'gap-report',
|
|
204
|
+
'General',
|
|
205
|
+
'--category',
|
|
206
|
+
'docs_gap',
|
|
207
|
+
'--reason',
|
|
208
|
+
'Need a keyboard example',
|
|
209
|
+
'--json',
|
|
210
|
+
],
|
|
211
|
+
{cwd},
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
expect(cli.status).toBe(1);
|
|
215
|
+
expect(JSON.parse(cli.stdout)).toMatchObject({
|
|
216
|
+
type: 'gap-report.file',
|
|
217
|
+
data: {
|
|
218
|
+
status: 'failed',
|
|
219
|
+
filedCount: 0,
|
|
220
|
+
deliveries: [
|
|
221
|
+
{
|
|
222
|
+
handlerType: 'integration',
|
|
223
|
+
handler: '@test/broken',
|
|
224
|
+
status: 'failed',
|
|
225
|
+
},
|
|
226
|
+
],
|
|
227
|
+
},
|
|
228
|
+
});
|
|
229
|
+
expect(cli.stderr).toContain(
|
|
230
|
+
'gap-report: delivery to @test/broken failed:',
|
|
231
|
+
);
|
|
232
|
+
expect(cli.stderr).toContain('intentional integration load failure');
|
|
233
|
+
} finally {
|
|
234
|
+
fs.rmSync(cwd, {recursive: true, force: true});
|
|
235
|
+
}
|
|
236
|
+
});
|
|
237
|
+
|
|
175
238
|
it('reports missing required fields through the JSON error contract', async () => {
|
|
176
239
|
const cli = await runCli(['gap-report', 'Button', '--json']);
|
|
177
240
|
expect(cli.status).toBe(1);
|