@astryxdesign/cli 0.6.3 → 0.6.4-canary.10dd683
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 +194 -0
- package/README.md +117 -78
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +16 -9
- package/api/build/build.test.mjs +197 -8
- package/api/build/build.type.d.mts +91 -2
- package/api/build/build.type.mjs +52 -8
- package/api/build/help/help.d.mts +12 -5
- package/api/build/help/help.mjs +69 -6
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +165 -49
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- 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/_adapter.d.mts +114 -6
- package/api/discover/_adapter.mjs +372 -17
- package/api/discover/_adapter.test.mjs +215 -0
- package/api/discover/_catalog-view.d.mts +115 -0
- package/api/discover/_catalog-view.mjs +203 -0
- package/api/discover/_catalog-view.test.mjs +128 -0
- package/api/discover/detail/detail.d.mts +18 -6
- package/api/discover/detail/detail.mjs +67 -13
- package/api/discover/detail/detail.test.mjs +85 -0
- package/api/discover/detail/item/item.d.mts +26 -0
- package/api/discover/detail/item/item.mjs +78 -0
- package/api/discover/detail/item/item.test.mjs +73 -0
- package/api/discover/discover.d.mts +3 -9
- package/api/discover/discover.doc.mjs +62 -18
- package/api/discover/discover.mjs +220 -36
- package/api/discover/discover.test.mjs +11 -2
- package/api/discover/discover.type.d.mts +150 -11
- package/api/discover/discover.type.mjs +107 -17
- package/api/discover/list/list.d.mts +20 -6
- package/api/discover/list/list.mjs +45 -12
- package/api/discover/list/list.test.mjs +46 -0
- package/api/discover/search/search.d.mts +18 -16
- package/api/discover/search/search.mjs +102 -56
- package/api/discover/search/search.test.mjs +144 -10
- package/api/docs/_adapter.d.mts +272 -41
- package/api/docs/_adapter.mjs +985 -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 +55 -16
- package/api/docs/docs.mjs +53 -10
- package/api/docs/docs.test.mjs +164 -4
- package/api/docs/docs.type.d.mts +221 -5
- package/api/docs/docs.type.mjs +153 -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 +555 -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/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +99 -1
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +548 -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-helpers.d.mts +5 -2
- package/api/integration/add-helpers.mjs +36 -9
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +138 -28
- package/api/integration/authoring-checks.test.mjs +179 -7
- package/api/integration/authoring-checks.type.mjs +6 -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.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +4 -0
- 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/template-conflict-compatibility.test.mjs +73 -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 +62 -11
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +471 -83
- 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/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -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 +31 -22
- package/api/theme/add/add.rollback.test.mjs +158 -0
- package/api/theme/add/add.staging.test.mjs +83 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.family.test.mjs +7 -12
- package/api/theme/build/build.mjs +140 -59
- 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.rollback.test.mjs +148 -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__/registry.test.mjs +1 -0
- 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/registry.mjs +1 -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/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/codemods/transforms/v0.6.4/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/v0.6.4/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/v0.6.4/index.mjs +31 -0
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/v0.6.4/migrate-theme-catalog-to-descriptors.mjs +141 -0
- 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/internationalization.doc.mjs +7 -5
- package/assets/docs/layout.doc.dense.mjs +2 -2
- package/assets/docs/layout.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +4 -4
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +5 -5
- 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} +144 -26
- 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 +4 -4
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.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/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerFormats.tsx +34 -0
- package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerInline.tsx +14 -0
- package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +13 -0
- package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +47 -0
- package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerTypography.tsx +31 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +19 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +383 -65
- 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 +10 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +15 -13
- package/authoring/config/parse.mjs +27 -8
- package/authoring/config/parse.test.mjs +8 -0
- package/authoring/config/type.ts +29 -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/discover/discover.doc.d.mts +13 -0
- package/authoring/discover/discover.doc.mjs +138 -0
- package/authoring/discover/parse.d.mts +24 -0
- package/authoring/discover/parse.mjs +128 -0
- package/authoring/discover/parse.test.mjs +124 -0
- package/authoring/discover/type.ts +87 -0
- package/authoring/doctypes/_schema.d.mts +790 -23
- package/authoring/doctypes/_schema.mjs +543 -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 +233 -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 +48 -6
- package/authoring/doctypes/reference/type.ts +70 -7
- 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 +3 -0
- package/authoring/index.d.ts +62 -17
- package/authoring/index.mjs +4 -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 +16 -8
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +137 -114
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +81 -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 +55 -9
- package/clients/cli/commands/discover.mjs +393 -118
- package/clients/cli/commands/discover.sources.test.mjs +267 -0
- 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 +240 -26
- 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 +90 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +59 -32
- 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 +37 -2
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +7 -2
- package/foundation/agent-docs/agent-docs.mjs +82 -12
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/agent-docs/agent-docs.test.mjs +19 -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 +87 -0
- package/foundation/discovery/authoring-self-docs.mjs +237 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +170 -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 +119 -11
- package/foundation/discovery/docs-discovery.mjs +423 -108
- package/foundation/discovery/docs-discovery.test.mjs +365 -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/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -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 +36 -0
- package/foundation/doc-compiler/lenses.mjs +173 -0
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -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 +84 -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 +63 -3
- package/foundation/integrations/integrations.mjs +122 -9
- package/foundation/integrations/integrations.test.mjs +415 -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.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +41 -21
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +40 -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
|
@@ -5,7 +5,8 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Hosts the atomic staged-write transaction, package.json files-array
|
|
7
7
|
* maintenance, package-dir resolution, and project-path normalization that
|
|
8
|
-
* every `integration add <kind>` command needs.
|
|
8
|
+
* every `integration add <kind>` command needs. `theme add` and `theme build`
|
|
9
|
+
* write through the same transaction. Stateless and side-effect-free
|
|
9
10
|
* outside of {@link applyWrites}.
|
|
10
11
|
*/
|
|
11
12
|
|
|
@@ -40,7 +41,7 @@ export function findPackageDir(startDir) {
|
|
|
40
41
|
/**
|
|
41
42
|
* @typedef {object} WritePlan
|
|
42
43
|
* @property {string} path
|
|
43
|
-
* @property {string} contents
|
|
44
|
+
* @property {string | Buffer} contents a Buffer is written byte for byte
|
|
44
45
|
* @property {boolean} createOnly
|
|
45
46
|
* @property {Buffer} [expectedOriginal] bytes captured before validation;
|
|
46
47
|
* a different current file is a concurrent edit and must never be overwritten
|
|
@@ -192,21 +193,29 @@ export function packageJsonUpdate(
|
|
|
192
193
|
|
|
193
194
|
// ── Atomic staged-write transaction ─────────────────────────────────
|
|
194
195
|
|
|
195
|
-
/**
|
|
196
|
+
/**
|
|
197
|
+
* @param {string} file
|
|
198
|
+
* @returns {boolean} false when the file is still there
|
|
199
|
+
*/
|
|
196
200
|
function removeTemporary(file) {
|
|
197
201
|
try {
|
|
198
202
|
fs.rmSync(file, {force: true});
|
|
203
|
+
return true;
|
|
199
204
|
} catch {
|
|
200
205
|
// Best effort. The transaction error remains the actionable failure.
|
|
206
|
+
return false;
|
|
201
207
|
}
|
|
202
208
|
}
|
|
203
209
|
|
|
204
210
|
/**
|
|
205
211
|
* Restore writes that already published. Best-effort so callers preserve
|
|
206
|
-
* the original actionable error.
|
|
212
|
+
* the original actionable error; returns every path it could not put back.
|
|
207
213
|
* @param {Array<WritePlan & {temporary: string, original: Buffer|null, mode: number}>} published
|
|
214
|
+
* @returns {string[]}
|
|
208
215
|
*/
|
|
209
216
|
function rollbackWrites(published) {
|
|
217
|
+
/** @type {string[]} */
|
|
218
|
+
const unrestored = [];
|
|
210
219
|
for (const plan of [...published].reverse()) {
|
|
211
220
|
let restore = null;
|
|
212
221
|
try {
|
|
@@ -225,12 +234,18 @@ function rollbackWrites(published) {
|
|
|
225
234
|
fs.renameSync(restore, plan.path);
|
|
226
235
|
restore = null;
|
|
227
236
|
}
|
|
228
|
-
} catch {
|
|
229
|
-
//
|
|
237
|
+
} catch (error) {
|
|
238
|
+
// A created file that is already gone needs nothing. Any other failure
|
|
239
|
+
// leaves this call's bytes, or no bytes, where the original was.
|
|
240
|
+
const gone =
|
|
241
|
+
error instanceof Error &&
|
|
242
|
+
/** @type {NodeJS.ErrnoException} */ (error).code === 'ENOENT';
|
|
243
|
+
if (!(gone && plan.original == null)) unrestored.push(plan.path);
|
|
230
244
|
} finally {
|
|
231
245
|
if (restore != null) removeTemporary(restore);
|
|
232
246
|
}
|
|
233
247
|
}
|
|
248
|
+
return unrestored;
|
|
234
249
|
}
|
|
235
250
|
|
|
236
251
|
/** @param {string} file */
|
|
@@ -325,10 +340,22 @@ export function applyWrites(plans) {
|
|
|
325
340
|
}
|
|
326
341
|
published.push(plan);
|
|
327
342
|
}
|
|
328
|
-
return () =>
|
|
343
|
+
return () => {
|
|
344
|
+
rollbackWrites(published);
|
|
345
|
+
};
|
|
329
346
|
} catch (error) {
|
|
330
|
-
|
|
331
|
-
|
|
347
|
+
const leftovers = staged
|
|
348
|
+
.filter(plan => !removeTemporary(plan.temporary))
|
|
349
|
+
.map(plan => plan.temporary);
|
|
350
|
+
const unrestored = rollbackWrites(published);
|
|
351
|
+
if (error instanceof Error) {
|
|
352
|
+
if (unrestored.length > 0) {
|
|
353
|
+
error.message += ` Could not restore: ${unrestored.join(', ')}.`;
|
|
354
|
+
}
|
|
355
|
+
if (leftovers.length > 0) {
|
|
356
|
+
error.message += ` Could not remove temporary files: ${leftovers.join(', ')}.`;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
332
359
|
throw error;
|
|
333
360
|
}
|
|
334
361
|
}
|
|
@@ -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,22 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Integration authoring diagnostics against the built-in Core catalog.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* Templates may intentionally replace Core identities; undeclared same-id
|
|
7
|
+
* overlaps stay fail-closed and require package selection. The CLI package
|
|
8
|
+
* version gates replacement-specific fields so 0.6.x keeps its released shape.
|
|
9
|
+
* Docs have explicit `replaces` / `extends` relationships with parallel
|
|
10
|
+
* validation semantics.
|
|
11
|
+
*
|
|
12
|
+
* @input Integration packages, built-in catalogs, and the CLI release boundary.
|
|
13
|
+
* @output Typed template, component, and documentation authoring diagnostics.
|
|
14
|
+
* @position Public integration-authoring API over private discovery adapters.
|
|
10
15
|
*/
|
|
11
16
|
|
|
12
17
|
import {getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
18
|
+
import {
|
|
19
|
+
packageDocsProblems,
|
|
20
|
+
packageReferenceProblems,
|
|
21
|
+
} from '../docs/_adapter.mjs';
|
|
13
22
|
import {findCoreDir} from '../../foundation/fs/paths.mjs';
|
|
14
23
|
import {
|
|
15
24
|
discoverIntegrationComponents,
|
|
@@ -20,9 +29,11 @@ import {
|
|
|
20
29
|
discoverIntegrationDocs,
|
|
21
30
|
} from '../../foundation/discovery/docs-discovery.mjs';
|
|
22
31
|
import {
|
|
32
|
+
applyTemplateReplacements,
|
|
23
33
|
discoverCoreTemplates,
|
|
24
34
|
discoverIntegrationTemplatesForOne,
|
|
25
35
|
} from '../../foundation/discovery/template-adapter.mjs';
|
|
36
|
+
import {expandedTemplateConflictSchemaActive} from '../../foundation/discovery/template-conflict-release.mjs';
|
|
26
37
|
import {
|
|
27
38
|
validateInstalledIntegration,
|
|
28
39
|
validateLocalIntegration,
|
|
@@ -48,16 +59,27 @@ async function resolveIntegration(pkg, cwd) {
|
|
|
48
59
|
/**
|
|
49
60
|
* Add discovery errors once to an issue list.
|
|
50
61
|
* @param {Array<{code: string, severity: 'warning' | 'error', message: string}>} issues
|
|
51
|
-
* @param {Array<{message: string} | Error>} errors
|
|
62
|
+
* @param {Array<{message: string, code?: string, severity?: 'warning' | 'error'} | Error>} errors
|
|
52
63
|
* @param {string} code
|
|
53
64
|
*/
|
|
54
65
|
function addErrors(issues, errors, code) {
|
|
55
66
|
for (const error of errors) {
|
|
56
67
|
const message = error.message;
|
|
57
|
-
|
|
68
|
+
const issueCode =
|
|
69
|
+
'code' in error && typeof error.code === 'string' ? error.code : code;
|
|
70
|
+
const severity =
|
|
71
|
+
'severity' in error &&
|
|
72
|
+
(error.severity === 'warning' || error.severity === 'error')
|
|
73
|
+
? error.severity
|
|
74
|
+
: 'error';
|
|
75
|
+
if (
|
|
76
|
+
issues.some(
|
|
77
|
+
issue => issue.code === issueCode && issue.message === message,
|
|
78
|
+
)
|
|
79
|
+
) {
|
|
58
80
|
continue;
|
|
59
81
|
}
|
|
60
|
-
issues.push({code, severity
|
|
82
|
+
issues.push({code: issueCode, severity, message});
|
|
61
83
|
}
|
|
62
84
|
}
|
|
63
85
|
|
|
@@ -74,7 +96,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
74
96
|
const version = resolved.found ? (resolved.version ?? null) : null;
|
|
75
97
|
const issues = [...resolved.issues];
|
|
76
98
|
|
|
77
|
-
if (!resolved.integration
|
|
99
|
+
if (!resolved.integration || name == null) {
|
|
78
100
|
return {
|
|
79
101
|
type: 'integration.template-conflicts',
|
|
80
102
|
data: {name, version, conflicts: [], issues},
|
|
@@ -87,6 +109,32 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
87
109
|
]);
|
|
88
110
|
addErrors(issues, errors, 'invalid_template');
|
|
89
111
|
|
|
112
|
+
const expandedConflictSchema = expandedTemplateConflictSchemaActive();
|
|
113
|
+
const replacementResolution = applyTemplateReplacements(
|
|
114
|
+
[...coreTemplates, ...templates],
|
|
115
|
+
errors.filter(error => error.replacementTarget != null),
|
|
116
|
+
);
|
|
117
|
+
for (const error of replacementResolution.errors) {
|
|
118
|
+
if (
|
|
119
|
+
!issues.some(
|
|
120
|
+
issue => issue.code === error.code && issue.message === error.message,
|
|
121
|
+
)
|
|
122
|
+
) {
|
|
123
|
+
issues.push({
|
|
124
|
+
code: error.code,
|
|
125
|
+
severity: error.severity,
|
|
126
|
+
message: error.message,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
const activeReplacementIds = new Set(
|
|
131
|
+
replacementResolution.templates
|
|
132
|
+
.filter(
|
|
133
|
+
template => template.package === name && template.replaces != null,
|
|
134
|
+
)
|
|
135
|
+
.map(template => template.dirName),
|
|
136
|
+
);
|
|
137
|
+
|
|
90
138
|
/** @type {Map<string, Array<{type: 'page' | 'block', name: string}>>} */
|
|
91
139
|
const coreById = new Map();
|
|
92
140
|
for (const template of coreTemplates) {
|
|
@@ -101,30 +149,69 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
|
|
|
101
149
|
}
|
|
102
150
|
|
|
103
151
|
const run = getCliInvocation(cwd);
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
152
|
+
/** @type {import('./authoring-checks.type.mjs').IntegrationTemplateConflict[]} */
|
|
153
|
+
const conflicts = [];
|
|
154
|
+
for (const template of templates) {
|
|
155
|
+
const sameIdCore = coreById.get(template.dirName);
|
|
156
|
+
const replacementIsActive = activeReplacementIds.has(template.dirName);
|
|
157
|
+
|
|
158
|
+
if (
|
|
159
|
+
expandedConflictSchema &&
|
|
160
|
+
replacementIsActive &&
|
|
161
|
+
template.replaces != null
|
|
162
|
+
) {
|
|
163
|
+
// This branch is unreachable before the package reaches 0.7.0. Keep the
|
|
164
|
+
// published 0.6.x conflict typedef narrow until the activation change.
|
|
165
|
+
conflicts.push(
|
|
166
|
+
/** @type {any} */ ({
|
|
114
167
|
id: template.dirName,
|
|
115
|
-
severity:
|
|
168
|
+
severity: 'info',
|
|
169
|
+
relationship: 'replaces',
|
|
170
|
+
replaces: template.replaces,
|
|
116
171
|
integrationPackage: name,
|
|
117
172
|
integrationType: template.type,
|
|
118
173
|
integrationName: template.name,
|
|
119
|
-
coreMatches,
|
|
174
|
+
coreMatches: coreById.get(template.replaces) ?? [],
|
|
120
175
|
message:
|
|
121
|
-
`
|
|
122
|
-
|
|
123
|
-
command
|
|
124
|
-
},
|
|
125
|
-
|
|
126
|
-
}
|
|
127
|
-
|
|
176
|
+
`Intentional replacement: "${template.dirName}" replaces the Core template ` +
|
|
177
|
+
`"${template.replaces}" for unqualified lookup.`,
|
|
178
|
+
command: `${run} template ${shellArg(template.replaces)} --package ${shellArg('@astryxdesign/core')}`,
|
|
179
|
+
}),
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (
|
|
184
|
+
sameIdCore &&
|
|
185
|
+
!(replacementIsActive && template.replaces === template.dirName)
|
|
186
|
+
) {
|
|
187
|
+
const coreKinds = sameIdCore
|
|
188
|
+
.map(match => `${match.type} "${match.name}"`)
|
|
189
|
+
.join(', ');
|
|
190
|
+
const compatibleKind = sameIdCore.some(
|
|
191
|
+
match => match.type === template.type,
|
|
192
|
+
);
|
|
193
|
+
conflicts.push({
|
|
194
|
+
id: template.dirName,
|
|
195
|
+
severity: 'warning',
|
|
196
|
+
...(expandedConflictSchema ? {relationship: 'accidental'} : {}),
|
|
197
|
+
integrationPackage: name,
|
|
198
|
+
integrationType: template.type,
|
|
199
|
+
integrationName: template.name,
|
|
200
|
+
coreMatches: sameIdCore,
|
|
201
|
+
message: expandedConflictSchema
|
|
202
|
+
? compatibleKind
|
|
203
|
+
? `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.`
|
|
204
|
+
: `Template id "${template.dirName}" conflicts with Core (${coreKinds}), but a ${template.type} template cannot replace a different template kind. Rename the integration template.`
|
|
205
|
+
: `Template id "${template.dirName}" conflicts with Core (${coreKinds}). Consider renaming the integration template. If you keep it, always select it with --package.`,
|
|
206
|
+
command: `${run} template ${shellArg(template.dirName)} --package ${shellArg(name)}`,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
conflicts.sort((a, b) =>
|
|
211
|
+
`${a.id}:${'relationship' in a ? a.relationship : ''}`.localeCompare(
|
|
212
|
+
`${b.id}:${'relationship' in b ? b.relationship : ''}`,
|
|
213
|
+
),
|
|
214
|
+
);
|
|
128
215
|
|
|
129
216
|
return {
|
|
130
217
|
type: 'integration.template-conflicts',
|
|
@@ -211,10 +298,11 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
211
298
|
};
|
|
212
299
|
}
|
|
213
300
|
|
|
214
|
-
const [
|
|
301
|
+
const [discovered, builtinTopics] = await Promise.all([
|
|
215
302
|
discoverIntegrationDocs(resolved.integration),
|
|
216
303
|
Promise.resolve(discoverBuiltinTopics()),
|
|
217
304
|
]);
|
|
305
|
+
const {records, errors} = discovered;
|
|
218
306
|
addErrors(issues, errors, 'invalid_doc');
|
|
219
307
|
const coreTopicsByKey = new Map(
|
|
220
308
|
Object.keys(builtinTopics).map(topic => [topic.toLowerCase(), topic]),
|
|
@@ -276,6 +364,28 @@ export async function integrationDocConflicts(pkg, options = {}) {
|
|
|
276
364
|
),
|
|
277
365
|
);
|
|
278
366
|
|
|
367
|
+
// The same graph checks `astryx doctor` runs in a project: the namespaces
|
|
368
|
+
// and placed guides this package adds to the docs tree, and every link in
|
|
369
|
+
// its docs (spec:AST-046, spec:AST-047).
|
|
370
|
+
if (errors.length === 0) {
|
|
371
|
+
for (const message of await packageDocsProblems(
|
|
372
|
+
/** @type {{name: string}} */ (resolved.integration),
|
|
373
|
+
discovered,
|
|
374
|
+
)) {
|
|
375
|
+
issues.push({code: 'invalid_doc_graph', severity: 'warning', message});
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
// A reference block includes content rather than linking to it, so one
|
|
379
|
+
// that cannot include what it names loses that content for every reader:
|
|
380
|
+
// an error, where a link that names no doc still prints as written.
|
|
381
|
+
for (const message of await packageReferenceProblems(
|
|
382
|
+
/** @type {{name: string}} */ (resolved.integration),
|
|
383
|
+
discovered,
|
|
384
|
+
)) {
|
|
385
|
+
issues.push({code: 'invalid_doc_reference', severity: 'error', message});
|
|
386
|
+
}
|
|
387
|
+
}
|
|
388
|
+
|
|
279
389
|
return {
|
|
280
390
|
type: 'integration.doc-conflicts',
|
|
281
391
|
data: {name, version, findings, issues},
|