@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.ee13359
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/README.md +114 -76
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +36 -2
- package/api/build/build.type.mjs +25 -4
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +91 -14
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +22 -11
- package/api/component/component.type.mjs +32 -24
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +40 -11
- package/api/discover/discover.doc.mjs +2 -1
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +230 -41
- package/api/docs/_adapter.mjs +734 -108
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +22 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +54 -19
- package/api/docs/detail/section/section.test.mjs +50 -0
- package/api/docs/docs.d.mts +10 -3
- package/api/docs/docs.doc.mjs +54 -16
- package/api/docs/docs.mjs +53 -10
- package/api/docs/docs.test.mjs +164 -4
- package/api/docs/docs.type.d.mts +205 -5
- package/api/docs/docs.type.mjs +137 -11
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +40 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integration-tree.test.mjs +547 -0
- package/api/docs/integrationDocs.test.mjs +114 -8
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/doctor/doctor.d.mts +99 -1
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +544 -1
- package/api/doctor/doctor.test.mjs +610 -1
- package/api/gap-report/gap-report.doc.mjs +8 -4
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +2 -2
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +6 -1
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +130 -15
- package/api/integration/add-contribution.test.mjs +258 -7
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +108 -31
- package/api/integration/authoring-checks.test.mjs +171 -6
- package/api/integration/authoring-checks.type.d.mts +3 -1
- package/api/integration/authoring-checks.type.mjs +3 -1
- package/api/integration/integration-authoring.type.d.mts +3 -1
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +14 -4
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +2 -1
- package/api/integration/integrationAddDoc.doc.mjs +8 -1
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +2 -1
- package/api/integration/integrationTemplateConflicts.doc.mjs +7 -5
- package/api/integration/pack-check.mjs +83 -7
- package/api/integration/pack-check.test.mjs +387 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +52 -102
- package/api/integration/validate-integration.test.mjs +179 -26
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +3 -2
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/index.ts +2 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/_adapter.mjs +20 -5
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +2 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +29 -11
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +337 -41
- package/api/search/search.test.mjs +124 -1
- package/api/search/search.type.d.mts +15 -3
- package/api/search/search.type.mjs +5 -2
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/template-integration.test.mjs +1022 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +30 -8
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +12 -14
- package/api/template/template.type.mjs +15 -14
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +84 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.mjs +133 -42
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/palette/generate/generate.mjs +8 -3
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +15 -4
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +20 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +8 -4
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +6 -2
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +139 -22
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +12 -5
- package/api/upgrade/upgrade.type.d.mts +43 -5
- package/api/upgrade/upgrade.type.mjs +27 -11
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/README.md +9 -0
- package/assets/docs/authoring.doc.mjs +14 -0
- package/assets/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +4 -4
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +124 -25
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +7 -2
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +18 -6
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +8 -8
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +718 -23
- package/authoring/doctypes/_schema.mjs +519 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +64 -0
- package/authoring/doctypes/base/type.ts +41 -0
- package/authoring/doctypes/command/command.doc.mjs +4 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +5 -4
- package/authoring/doctypes/component/component.doc.mjs +6 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +6 -5
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +4 -2
- package/authoring/doctypes/function/function.doc.mjs +7 -2
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +9 -4
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +5 -4
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +208 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +128 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +163 -0
- package/authoring/doctypes/namespace/type.ts +74 -0
- package/authoring/doctypes/parse.d.mts +22 -18
- package/authoring/doctypes/parse.mjs +22 -11
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +20 -5
- package/authoring/doctypes/reference/type.ts +53 -5
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +4 -4
- package/authoring/doctypes/template/parse.d.mts +94 -1
- package/authoring/doctypes/template/parse.mjs +40 -2
- package/authoring/doctypes/template/parse.test.mjs +26 -2
- package/authoring/doctypes/template/template.doc.mjs +13 -3
- package/authoring/doctypes/template/type.ts +13 -2
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +12 -10
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +2 -0
- package/authoring/index.d.ts +52 -17
- package/authoring/index.mjs +3 -1
- package/authoring/integration/integration.doc.mjs +15 -8
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +19 -8
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +16 -50
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +5 -2
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +37 -49
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +3 -8
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/component-package.test.mjs +46 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +52 -5
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +5 -3
- package/clients/cli/commands/discover.mjs +4 -4
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +28 -6
- package/clients/cli/commands/docs.mjs +238 -24
- package/clients/cli/commands/docs.test.mjs +193 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor-integration.test.mjs +83 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +30 -25
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +17 -6
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +20 -9
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +32 -6
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +15 -4
- package/clients/cli/commands/layout-expand.doc.mjs +22 -5
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +3 -3
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +7 -4
- package/clients/cli/commands/search.mjs +28 -9
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/swizzle.doc.mjs +3 -2
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +52 -13
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +719 -0
- package/clients/cli/commands/theme-add.doc.mjs +4 -3
- package/clients/cli/commands/theme-build.doc.mjs +8 -7
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +9 -5
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +22 -10
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +164 -1
- package/clients/cli/formatters/index.test.mjs +97 -0
- package/clients/cli/index.mjs +21 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +36 -2
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +70 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/agent-docs/agent-docs.test.mjs +10 -1
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +20 -11
- package/foundation/config/project.mjs +263 -91
- package/foundation/config/project.test.mjs +270 -21
- package/foundation/discovery/authoring-self-docs.d.mts +75 -0
- package/foundation/discovery/authoring-self-docs.mjs +224 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +165 -0
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +119 -0
- package/foundation/discovery/cli-self-docs.mjs +490 -0
- package/foundation/discovery/cli-self-docs.test.mjs +375 -0
- package/foundation/discovery/component-discovery.d.mts +39 -1
- package/foundation/discovery/component-discovery.mjs +50 -1
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +116 -11
- package/foundation/discovery/docs-discovery.mjs +389 -108
- package/foundation/discovery/docs-discovery.test.mjs +325 -20
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +116 -0
- package/foundation/discovery/docs-section-key.mjs +322 -0
- package/foundation/discovery/docs-section-key.test.mjs +246 -0
- package/foundation/discovery/template-adapter.d.mts +113 -11
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +774 -83
- package/foundation/discovery/template-adapter.test.mjs +57 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +343 -0
- package/foundation/doc-compiler/compile.mjs +558 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +22 -0
- package/foundation/doc-compiler/ir.mjs +471 -0
- package/foundation/doc-compiler/lenses.d.mts +34 -0
- package/foundation/doc-compiler/lenses.mjs +128 -0
- package/foundation/doc-compiler/links.d.mts +135 -0
- package/foundation/doc-compiler/links.mjs +253 -0
- package/foundation/doc-compiler/links.test.mjs +139 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +127 -0
- package/foundation/doc-compiler/read.mjs +325 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -45
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +109 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +27 -24
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +52 -21
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/integrations.d.mts +49 -2
- package/foundation/integrations/integrations.mjs +81 -8
- package/foundation/integrations/integrations.test.mjs +384 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +131 -29
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +13 -4
- package/foundation/response/error-codes.mjs +8 -2
- package/foundation/response/error-codes.test.mjs +137 -10
- package/foundation/response/json-contract.test.mjs +57 -17
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +26 -16
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +4 -3
- package/foundation/xle/expand.test.mjs +54 -0
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -11
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file `astryx integration add theme` — scaffold one
|
|
5
|
-
*
|
|
6
|
-
* first use.
|
|
4
|
+
* @file `astryx integration add theme` — scaffold one strongly typed,
|
|
5
|
+
* same-stem source/descriptor pair into an integration package and declare the
|
|
6
|
+
* themes root on first use.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import * as fs from 'node:fs';
|
|
@@ -15,16 +15,14 @@ import {
|
|
|
15
15
|
PathSafetyError,
|
|
16
16
|
sanitizeName,
|
|
17
17
|
} from '../../foundation/fs/path-safety.mjs';
|
|
18
|
-
import {
|
|
19
|
-
discoverThemeCatalog,
|
|
20
|
-
THEME_MANIFEST_BASENAME,
|
|
21
|
-
} from '../../foundation/discovery/theme-discovery.mjs';
|
|
18
|
+
import {discoverThemeDirectory} from '../../foundation/discovery/theme-discovery.mjs';
|
|
22
19
|
import {
|
|
23
20
|
findLocalIntegrationManifestOrNull,
|
|
24
21
|
IntegrationRootConflictError,
|
|
25
22
|
patchIntegrationRoot,
|
|
26
23
|
} from '../../foundation/integrations/manifest-writer.mjs';
|
|
27
24
|
import {loadManifestObject} from '../../foundation/integrations/integrations.mjs';
|
|
25
|
+
import {themeDescriptorSource} from '../../foundation/integrations/theme-descriptor.mjs';
|
|
28
26
|
import {assertContributionVisible} from '../../foundation/integrations/contribution-inventory.mjs';
|
|
29
27
|
import {
|
|
30
28
|
applyWrites,
|
|
@@ -70,6 +68,7 @@ function themeIdentity(slug) {
|
|
|
70
68
|
displayName,
|
|
71
69
|
exportName: `${identifier}Theme`,
|
|
72
70
|
entry: `${identifier}Theme.ts`,
|
|
71
|
+
descriptor: `${identifier}Theme.doc.mjs`,
|
|
73
72
|
};
|
|
74
73
|
}
|
|
75
74
|
|
|
@@ -78,9 +77,20 @@ function themeSource(identity) {
|
|
|
78
77
|
return `import {defineTheme} from '@astryxdesign/core/theme';\n\nexport const ${identity.exportName} = defineTheme({\n name: '${identity.slug}',\n});\n`;
|
|
79
78
|
}
|
|
80
79
|
|
|
80
|
+
/** @param {{slug: string, displayName: string}} identity */
|
|
81
|
+
function themeDescriptor(identity) {
|
|
82
|
+
return themeDescriptorSource({
|
|
83
|
+
type: 'theme',
|
|
84
|
+
name: identity.slug,
|
|
85
|
+
displayName: identity.displayName,
|
|
86
|
+
description: `${identity.displayName} theme.`,
|
|
87
|
+
maintained: true,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
|
|
81
91
|
/**
|
|
82
|
-
* Read
|
|
83
|
-
*
|
|
92
|
+
* Read bytes back through the same discovery seam Project uses. A write is not
|
|
93
|
+
* successful until the requested slug resolves.
|
|
84
94
|
* @param {string} packageDir
|
|
85
95
|
* @param {string} manifestFile
|
|
86
96
|
* @param {string} owner
|
|
@@ -176,6 +186,9 @@ export async function integrationAddTheme(name, options = {}) {
|
|
|
176
186
|
dryRun: true,
|
|
177
187
|
createIfMissing: true,
|
|
178
188
|
});
|
|
189
|
+
if (fs.existsSync(root)) {
|
|
190
|
+
discoverThemeDirectory(root, owner);
|
|
191
|
+
}
|
|
179
192
|
} catch (error) {
|
|
180
193
|
if (error instanceof IntegrationRootConflictError) {
|
|
181
194
|
throw new AstryxError(
|
|
@@ -197,72 +210,29 @@ export async function integrationAddTheme(name, options = {}) {
|
|
|
197
210
|
const sourceFile = assertWithin(identity.entry, themeDir, {
|
|
198
211
|
label: 'theme source file',
|
|
199
212
|
});
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
`Refusing to overwrite existing file ${projectPath(path.relative(packageDir, sourceFile))}.`,
|
|
203
|
-
undefined,
|
|
204
|
-
ERROR_CODES.ERR_FILE_EXISTS,
|
|
205
|
-
);
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
const catalogFile = assertWithin(THEME_MANIFEST_BASENAME, root, {
|
|
209
|
-
label: 'theme catalog manifest',
|
|
213
|
+
const descriptorFile = assertWithin(identity.descriptor, themeDir, {
|
|
214
|
+
label: 'theme descriptor file',
|
|
210
215
|
});
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
let catalogOriginal = null;
|
|
215
|
-
if (fs.existsSync(catalogFile)) {
|
|
216
|
-
try {
|
|
217
|
-
catalogOriginal = fs.readFileSync(catalogFile);
|
|
218
|
-
catalog = JSON.parse(catalogOriginal.toString('utf-8'));
|
|
219
|
-
// The discovery seam is the schema/source-of-truth validator. The write
|
|
220
|
-
// plan carries catalogOriginal, so any concurrent change between this read
|
|
221
|
-
// and publish is refused rather than overwritten with this snapshot.
|
|
222
|
-
discoverThemeCatalog(root, owner);
|
|
223
|
-
} catch (error) {
|
|
216
|
+
// An existing folder is filled; only a file this would write is refused.
|
|
217
|
+
for (const file of [sourceFile, descriptorFile]) {
|
|
218
|
+
if (fs.existsSync(file)) {
|
|
224
219
|
throw new AstryxError(
|
|
225
|
-
|
|
220
|
+
`Refusing to overwrite existing file ${projectPath(path.relative(packageDir, file))}.`,
|
|
226
221
|
undefined,
|
|
227
|
-
ERROR_CODES.
|
|
222
|
+
ERROR_CODES.ERR_FILE_EXISTS,
|
|
228
223
|
);
|
|
229
224
|
}
|
|
230
225
|
}
|
|
231
|
-
if (
|
|
232
|
-
catalog.themes.some(
|
|
233
|
-
theme =>
|
|
234
|
-
typeof theme.slug === 'string' &&
|
|
235
|
-
theme.slug.toLowerCase() === identity.slug.toLowerCase(),
|
|
236
|
-
)
|
|
237
|
-
) {
|
|
238
|
-
throw new AstryxError(
|
|
239
|
-
`Theme "${identity.slug}" already exists in ${projectPath(path.relative(packageDir, catalogFile))}.`,
|
|
240
|
-
undefined,
|
|
241
|
-
ERROR_CODES.ERR_FILE_EXISTS,
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
catalog.themes.push({
|
|
246
|
-
slug: identity.slug,
|
|
247
|
-
displayName: identity.displayName,
|
|
248
|
-
description: `${identity.displayName} theme.`,
|
|
249
|
-
maintained: true,
|
|
250
|
-
entry: identity.entry,
|
|
251
|
-
exportName: identity.exportName,
|
|
252
|
-
files: [identity.entry],
|
|
253
|
-
});
|
|
254
226
|
|
|
255
227
|
/** @type {import('./add-helpers.mjs').WritePlan[]} */
|
|
256
|
-
const plans = [
|
|
257
|
-
plans.push(
|
|
228
|
+
const plans = [
|
|
258
229
|
{path: sourceFile, contents: themeSource(identity), createOnly: true},
|
|
259
230
|
{
|
|
260
|
-
path:
|
|
261
|
-
contents:
|
|
262
|
-
createOnly:
|
|
263
|
-
expectedOriginal: catalogOriginal ?? undefined,
|
|
231
|
+
path: descriptorFile,
|
|
232
|
+
contents: themeDescriptor(identity),
|
|
233
|
+
createOnly: true,
|
|
264
234
|
},
|
|
265
|
-
|
|
235
|
+
];
|
|
266
236
|
const packageUpdate = packageJsonUpdate(
|
|
267
237
|
packageFile,
|
|
268
238
|
rootPath,
|
|
@@ -32,7 +32,7 @@ afterEach(() => {
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
describe('integrationAddTheme', () => {
|
|
35
|
-
it('writes a
|
|
35
|
+
it('writes a typed same-stem descriptor and source with no central catalog', async () => {
|
|
36
36
|
setup();
|
|
37
37
|
const result = await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
38
38
|
|
|
@@ -45,7 +45,7 @@ describe('integrationAddTheme', () => {
|
|
|
45
45
|
manifest: 'astryx.integration.mjs',
|
|
46
46
|
files: [
|
|
47
47
|
'themes/ocean/oceanTheme.ts',
|
|
48
|
-
'themes/
|
|
48
|
+
'themes/ocean/oceanTheme.doc.mjs',
|
|
49
49
|
'package.json',
|
|
50
50
|
'astryx.integration.mjs',
|
|
51
51
|
],
|
|
@@ -56,21 +56,17 @@ describe('integrationAddTheme', () => {
|
|
|
56
56
|
expect(
|
|
57
57
|
fs.readFileSync(path.join(tmpDir, 'themes/ocean/oceanTheme.ts'), 'utf-8'),
|
|
58
58
|
).toContain('export const oceanTheme = defineTheme');
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
files: ['oceanTheme.ts'],
|
|
71
|
-
},
|
|
72
|
-
],
|
|
73
|
-
});
|
|
59
|
+
|
|
60
|
+
const descriptor = fs.readFileSync(
|
|
61
|
+
path.join(tmpDir, 'themes/ocean/oceanTheme.doc.mjs'),
|
|
62
|
+
'utf-8',
|
|
63
|
+
);
|
|
64
|
+
expect(descriptor).toContain("@astryxdesign/cli/authoring').ThemeDoc");
|
|
65
|
+
expect(descriptor).toContain("type: 'theme'");
|
|
66
|
+
expect(descriptor).toContain("name: 'ocean'");
|
|
67
|
+
expect(fs.existsSync(path.join(tmpDir, 'themes/manifest.json'))).toBe(
|
|
68
|
+
false,
|
|
69
|
+
);
|
|
74
70
|
expect(
|
|
75
71
|
fs.readFileSync(path.join(tmpDir, 'astryx.integration.mjs'), 'utf-8'),
|
|
76
72
|
).toContain("themes: './themes'");
|
|
@@ -96,6 +92,7 @@ describe('integrationAddTheme', () => {
|
|
|
96
92
|
expect(result.data.dryRun).toBe(true);
|
|
97
93
|
expect(result.data.root).toEqual({path: './themes', created: true});
|
|
98
94
|
expect(result.data.files).toContain('themes/ocean/oceanTheme.ts');
|
|
95
|
+
expect(result.data.files).toContain('themes/ocean/oceanTheme.doc.mjs');
|
|
99
96
|
expect(fs.existsSync(path.join(tmpDir, 'themes'))).toBe(false);
|
|
100
97
|
expect(
|
|
101
98
|
fs.readFileSync(path.join(tmpDir, 'astryx.integration.mjs'), 'utf-8'),
|
|
@@ -125,22 +122,69 @@ describe('integrationAddTheme', () => {
|
|
|
125
122
|
expect(
|
|
126
123
|
fs.existsSync(path.join(tmpDir, 'src/themes/ocean/oceanTheme.ts')),
|
|
127
124
|
).toBe(true);
|
|
125
|
+
expect(
|
|
126
|
+
fs.existsSync(path.join(tmpDir, 'src/themes/ocean/oceanTheme.doc.mjs')),
|
|
127
|
+
).toBe(true);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
it('
|
|
130
|
+
it('keeps each theme to its own folder: a second theme touches no shared file', async () => {
|
|
131
|
+
setup({manifest: "export default {themes: './themes'};\n"});
|
|
132
|
+
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
133
|
+
const shared = ['package.json', 'astryx.integration.mjs'].map(file =>
|
|
134
|
+
fs.readFileSync(path.join(tmpDir, file), 'utf-8'),
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
const result = await integrationAddTheme('reef', {cwd: tmpDir});
|
|
138
|
+
|
|
139
|
+
expect(result.data.files).toEqual([
|
|
140
|
+
'themes/reef/reefTheme.ts',
|
|
141
|
+
'themes/reef/reefTheme.doc.mjs',
|
|
142
|
+
]);
|
|
143
|
+
expect(fs.readdirSync(path.join(tmpDir, 'themes')).sort()).toEqual([
|
|
144
|
+
'ocean',
|
|
145
|
+
'reef',
|
|
146
|
+
]);
|
|
147
|
+
expect(
|
|
148
|
+
['package.json', 'astryx.integration.mjs'].map(file =>
|
|
149
|
+
fs.readFileSync(path.join(tmpDir, file), 'utf-8'),
|
|
150
|
+
),
|
|
151
|
+
).toEqual(shared);
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
it('refuses an obsolete central catalog without changing its bytes', async () => {
|
|
131
155
|
setup();
|
|
132
156
|
fs.mkdirSync(path.join(tmpDir, 'themes'));
|
|
133
157
|
const catalog = path.join(tmpDir, 'themes', 'manifest.json');
|
|
134
|
-
fs.writeFileSync(catalog, '{
|
|
158
|
+
fs.writeFileSync(catalog, '{"version":1}\n');
|
|
135
159
|
|
|
136
160
|
await expect(
|
|
137
161
|
integrationAddTheme('ocean', {cwd: tmpDir}),
|
|
138
162
|
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
139
|
-
expect(fs.readFileSync(catalog, 'utf-8')).toBe('{
|
|
163
|
+
expect(fs.readFileSync(catalog, 'utf-8')).toBe('{"version":1}\n');
|
|
140
164
|
expect(fs.existsSync(path.join(tmpDir, 'themes', 'ocean'))).toBe(false);
|
|
141
165
|
});
|
|
142
166
|
|
|
143
|
-
it('refuses
|
|
167
|
+
it('refuses an invalid existing descriptor without changing it', async () => {
|
|
168
|
+
setup();
|
|
169
|
+
const existing = path.join(tmpDir, 'themes', 'forest');
|
|
170
|
+
fs.mkdirSync(existing, {recursive: true});
|
|
171
|
+
const descriptor = path.join(existing, 'forestTheme.doc.mjs');
|
|
172
|
+
fs.writeFileSync(descriptor, 'export default {type: "theme"};\n');
|
|
173
|
+
fs.writeFileSync(
|
|
174
|
+
path.join(existing, 'forestTheme.ts'),
|
|
175
|
+
'export const forestTheme = {};\n',
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
await expect(
|
|
179
|
+
integrationAddTheme('ocean', {cwd: tmpDir}),
|
|
180
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
181
|
+
expect(fs.readFileSync(descriptor, 'utf-8')).toBe(
|
|
182
|
+
'export default {type: "theme"};\n',
|
|
183
|
+
);
|
|
184
|
+
expect(fs.existsSync(path.join(tmpDir, 'themes', 'ocean'))).toBe(false);
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
it('refuses a duplicate valid theme directory', async () => {
|
|
144
188
|
setup();
|
|
145
189
|
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
146
190
|
await expect(
|
|
@@ -148,6 +192,46 @@ describe('integrationAddTheme', () => {
|
|
|
148
192
|
).rejects.toMatchObject({code: 'ERR_FILE_EXISTS'});
|
|
149
193
|
});
|
|
150
194
|
|
|
195
|
+
it('refuses an existing invalid theme directory', async () => {
|
|
196
|
+
setup();
|
|
197
|
+
fs.mkdirSync(path.join(tmpDir, 'themes', 'ocean'), {recursive: true});
|
|
198
|
+
fs.writeFileSync(
|
|
199
|
+
path.join(tmpDir, 'themes', 'ocean', 'oceanTheme.ts'),
|
|
200
|
+
'export const oceanTheme = {};\n',
|
|
201
|
+
);
|
|
202
|
+
await expect(
|
|
203
|
+
integrationAddTheme('ocean', {cwd: tmpDir}),
|
|
204
|
+
).rejects.toMatchObject({code: 'ERR_THEME_INVALID'});
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it.each([
|
|
208
|
+
['an empty folder', []],
|
|
209
|
+
['a folder holding .gitkeep', ['.gitkeep']],
|
|
210
|
+
['a folder holding NOTES.md', ['NOTES.md']],
|
|
211
|
+
])('fills %s', async (_, files) => {
|
|
212
|
+
setup();
|
|
213
|
+
const dir = path.join(tmpDir, 'themes', 'ocean');
|
|
214
|
+
fs.mkdirSync(dir, {recursive: true});
|
|
215
|
+
for (const file of files) fs.writeFileSync(path.join(dir, file), 'x\n');
|
|
216
|
+
const result = await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
217
|
+
expect(result.data.written).toBe(true);
|
|
218
|
+
expect(fs.readdirSync(dir).sort()).toEqual(
|
|
219
|
+
[...files, 'oceanTheme.doc.mjs', 'oceanTheme.ts'].sort(),
|
|
220
|
+
);
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
it('refuses to overwrite a file it would write', async () => {
|
|
224
|
+
setup();
|
|
225
|
+
await integrationAddTheme('ocean', {cwd: tmpDir});
|
|
226
|
+
await expect(
|
|
227
|
+
integrationAddTheme('ocean', {cwd: tmpDir}),
|
|
228
|
+
).rejects.toMatchObject({
|
|
229
|
+
code: 'ERR_FILE_EXISTS',
|
|
230
|
+
message:
|
|
231
|
+
'Refusing to overwrite existing file themes/ocean/oceanTheme.ts.',
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
151
235
|
it.each(['../ocean', 'Ocean', 'ocean theme', '.ocean'])(
|
|
152
236
|
'refuses unsafe or noncanonical name %s',
|
|
153
237
|
async name => {
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Integration authoring diagnostics against the built-in Core catalog.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* distinguish intentional ownership from an accidental same-name shadow.
|
|
6
|
+
* Templates may intentionally replace Core identities; undeclared same-id
|
|
7
|
+
* overlaps stay fail-closed and require package selection. Docs have explicit
|
|
8
|
+
* `replaces` / `extends` relationships with parallel validation semantics.
|
|
10
9
|
*/
|
|
11
10
|
|
|
12
11
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
12
|
+
import {packageDocsProblems} from '../docs/_adapter.mjs';
|
|
13
13
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
14
14
|
import {
|
|
15
15
|
discoverIntegrationComponents,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
discoverIntegrationDocs,
|
|
21
21
|
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
22
22
|
import {
|
|
23
|
+
applyTemplateReplacements,
|
|
23
24
|
discoverCoreTemplates,
|
|
24
25
|
discoverIntegrationTemplatesForOne,
|
|
25
26
|
} from '../../foundation/discovery/template-adapter.mjs';
|
|
@@ -48,16 +49,27 @@ async function resolveIntegration(pkg, cwd) {
|
|
|
48
49
|
/**
|
|
49
50
|
* Add discovery errors once to an issue list.
|
|
50
51
|
* @param {Array<{code: string, severity: 'warning' | 'error', message: string}>} issues
|
|
51
|
-
* @param {Array<{message: string} | Error>} errors
|
|
52
|
+
* @param {Array<{message: string, code?: string, severity?: 'warning' | 'error'} | Error>} errors
|
|
52
53
|
* @param {string} code
|
|
53
54
|
*/
|
|
54
55
|
function addErrors(issues, errors, code) {
|
|
55
56
|
for (const error of errors) {
|
|
56
57
|
const message = error.message;
|
|
57
|
-
|
|
58
|
+
const issueCode =
|
|
59
|
+
'code' in error && typeof error.code === 'string' ? error.code : code;
|
|
60
|
+
const severity =
|
|
61
|
+
'severity' in error &&
|
|
62
|
+
(error.severity === 'warning' || error.severity === 'error')
|
|
63
|
+
? error.severity
|
|
64
|
+
: 'error';
|
|
65
|
+
if (
|
|
66
|
+
issues.some(
|
|
67
|
+
issue => issue.code === issueCode && issue.message === message,
|
|
68
|
+
)
|
|
69
|
+
) {
|
|
58
70
|
continue;
|
|
59
71
|
}
|
|
60
|
-
issues.push({code, severity
|
|
72
|
+
issues.push({code: issueCode, severity, message});
|
|
61
73
|
}
|
|
62
74
|
}
|
|
63
75
|
|
|
@@ -74,7 +86,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
74
86
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
75
87
|
const issues = [...resolved.issues];
|
|
76
88
|
|
|
77
|
-
if (!resolved.integration
|
|
89
|
+
if (!resolved.integration || name == null) {
|
|
78
90
|
return {
|
|
79
91
|
type: 'integration.template-conflicts',
|
|
80
92
|
data: {name, version, conflicts: [], issues},
|
|
@@ -87,6 +99,31 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
87
99
|
]);
|
|
88
100
|
addErrors(issues, errors, 'invalid_template');
|
|
89
101
|
|
|
102
|
+
const replacementResolution = applyTemplateReplacements(
|
|
103
|
+
[...coreTemplates, ...templates],
|
|
104
|
+
errors.filter(error => error.replacementTarget != null),
|
|
105
|
+
);
|
|
106
|
+
for (const error of replacementResolution.errors) {
|
|
107
|
+
if (
|
|
108
|
+
!issues.some(
|
|
109
|
+
issue => issue.code === error.code && issue.message === error.message,
|
|
110
|
+
)
|
|
111
|
+
) {
|
|
112
|
+
issues.push({
|
|
113
|
+
code: error.code,
|
|
114
|
+
severity: error.severity,
|
|
115
|
+
message: error.message,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const activeReplacementIds = new Set(
|
|
120
|
+
replacementResolution.templates
|
|
121
|
+
.filter(
|
|
122
|
+
template => template.package === name && template.replaces != null,
|
|
123
|
+
)
|
|
124
|
+
.map(template => template.dirName),
|
|
125
|
+
);
|
|
126
|
+
|
|
90
127
|
/** @type {Map<string, Array<{type: 'page' | 'block', name: string}>>} */
|
|
91
128
|
const coreById = new Map();
|
|
92
129
|
for (const template of coreTemplates) {
|
|
@@ -101,30 +138,57 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
101
138
|
}
|
|
102
139
|
|
|
103
140
|
const run = getCliInvocation(cwd);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
141
|
+
/** @type {import('./authoring-checks.type.mjs').IntegrationTemplateConflict[]} */
|
|
142
|
+
const conflicts = [];
|
|
143
|
+
for (const template of templates) {
|
|
144
|
+
const sameIdCore = coreById.get(template.dirName);
|
|
145
|
+
const replacementIsActive = activeReplacementIds.has(template.dirName);
|
|
146
|
+
|
|
147
|
+
if (replacementIsActive && template.replaces != null) {
|
|
148
|
+
conflicts.push({
|
|
149
|
+
id: template.dirName,
|
|
150
|
+
severity: 'info',
|
|
151
|
+
relationship: 'replaces',
|
|
152
|
+
replaces: template.replaces,
|
|
153
|
+
integrationPackage: name,
|
|
154
|
+
integrationType: template.type,
|
|
155
|
+
integrationName: template.name,
|
|
156
|
+
coreMatches: coreById.get(template.replaces) ?? [],
|
|
157
|
+
message:
|
|
158
|
+
`Intentional replacement: "${template.dirName}" replaces the Core template ` +
|
|
159
|
+
`"${template.replaces}" for unqualified lookup.`,
|
|
160
|
+
command: `${run} template ${shellArg(template.replaces)} --package ${shellArg('@astryxdesign/core')}`,
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (
|
|
165
|
+
sameIdCore &&
|
|
166
|
+
!(replacementIsActive && template.replaces === template.dirName)
|
|
167
|
+
) {
|
|
168
|
+
const coreKinds = sameIdCore
|
|
110
169
|
.map(match => `${match.type} "${match.name}"`)
|
|
111
170
|
.join(', ');
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
171
|
+
const compatibleKind = sameIdCore.some(
|
|
172
|
+
match => match.type === template.type,
|
|
173
|
+
);
|
|
174
|
+
conflicts.push({
|
|
175
|
+
id: template.dirName,
|
|
176
|
+
severity: 'warning',
|
|
177
|
+
relationship: 'accidental',
|
|
178
|
+
integrationPackage: name,
|
|
179
|
+
integrationType: template.type,
|
|
180
|
+
integrationName: template.name,
|
|
181
|
+
coreMatches: sameIdCore,
|
|
182
|
+
message: compatibleKind
|
|
183
|
+
? `Template id "${template.dirName}" conflicts with Core (${coreKinds}). Consider renaming it, or set replaces: ${JSON.stringify(template.dirName)} in its metadata to replace the Core template.`
|
|
184
|
+
: `Template id "${template.dirName}" conflicts with Core (${coreKinds}), but a ${template.type} template cannot replace a different template kind. Rename the integration template.`,
|
|
185
|
+
command: `${run} template ${shellArg(template.dirName)} --package ${shellArg(name)}`,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
conflicts.sort((a, b) =>
|
|
190
|
+
`${a.id}:${a.relationship}`.localeCompare(`${b.id}:${b.relationship}`),
|
|
191
|
+
);
|
|
128
192
|
|
|
129
193
|
return {
|
|
130
194
|
type: 'integration.template-conflicts',
|
|
@@ -211,10 +275,11 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
211
275
|
};
|
|
212
276
|
}
|
|
213
277
|
|
|
214
|
-
const [
|
|
278
|
+
const [discovered, builtinTopics] = await Promise.all([
|
|
215
279
|
discoverIntegrationDocs(resolved.integration),
|
|
216
280
|
Promise.resolve(discoverBuiltinTopics()),
|
|
217
281
|
]);
|
|
282
|
+
const {records, errors} = discovered;
|
|
218
283
|
addErrors(issues, errors, 'invalid_doc');
|
|
219
284
|
const coreTopicsByKey = new Map(
|
|
220
285
|
Object.keys(builtinTopics).map(topic => [topic.toLowerCase(), topic]),
|
|
@@ -276,6 +341,18 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
276
341
|
),
|
|
277
342
|
);
|
|
278
343
|
|
|
344
|
+
// The same graph checks `astryx doctor` runs in a project: the namespaces
|
|
345
|
+
// and placed guides this package adds to the docs tree, and every link in
|
|
346
|
+
// its docs (spec:AST-046, spec:AST-047).
|
|
347
|
+
if (errors.length === 0) {
|
|
348
|
+
for (const message of await packageDocsProblems(
|
|
349
|
+
/** @type {{name: string}} */ (resolved.integration),
|
|
350
|
+
discovered,
|
|
351
|
+
)) {
|
|
352
|
+
issues.push({code: 'invalid_doc_graph', severity: 'warning', message});
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
|
|
279
356
|
return {
|
|
280
357
|
type: 'integration.doc-conflicts',
|
|
281
358
|
data: {name, version, findings, issues},
|