@astryxdesign/cli 0.6.2 → 0.6.3-canary.039a67e
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 +118 -1
- package/README.md +108 -72
- 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/component.doc.mjs +13 -3
- package/api/component/component.mjs +31 -2
- 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 +37 -9
- 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 +32 -24
- package/api/docs/_adapter.mjs +81 -87
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +14 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +37 -19
- package/api/docs/detail/section/section.test.mjs +50 -0
- package/api/docs/docs.d.mts +7 -2
- package/api/docs/docs.doc.mjs +28 -10
- package/api/docs/docs.mjs +16 -9
- package/api/docs/docs.test.mjs +6 -0
- package/api/docs/docs.type.d.mts +40 -3
- package/api/docs/docs.type.mjs +36 -8
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +32 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integrationDocs.test.mjs +106 -0
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +70 -0
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +404 -0
- package/api/doctor/doctor.test.mjs +522 -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/init/init.doc.mjs +5 -0
- 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.mjs +23 -10
- package/api/integration/add-contribution.test.mjs +121 -7
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +8 -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 +1 -0
- 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 +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +266 -47
- 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 +176 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +2 -1
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- 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 +3 -10
- package/api/search/search.doc.mjs +6 -1
- package/api/search/search.mjs +31 -14
- package/api/search/search.test.mjs +34 -0
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- 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/template-suffix.test.mjs +41 -21
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +3 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- 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 +15 -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 +5 -1
- 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/cli-integrations.doc.mjs +91 -20
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- 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/Kbd/KbdModifierCombos.tsx +3 -1
- 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/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/canvas-editor/page.tsx +2875 -0
- package/assets/templates/pages/canvas-editor/template.doc.mjs +12 -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 +5 -5
- 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 +62 -0
- package/authoring/doctypes/base/type.ts +40 -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 +4 -3
- 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 +5 -1
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +7 -3
- 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 +132 -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 +50 -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 +92 -1
- package/authoring/doctypes/template/parse.mjs +36 -2
- package/authoring/doctypes/template/parse.test.mjs +8 -2
- package/authoring/doctypes/template/template.doc.mjs +7 -3
- package/authoring/doctypes/template/type.ts +6 -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 +18 -7
- 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 +15 -49
- 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 +32 -47
- 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 +2 -7
- 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 +48 -0
- 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 +3 -3
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +14 -4
- package/clients/cli/commands/docs.mjs +73 -16
- package/clients/cli/commands/docs.test.mjs +85 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- 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 +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +6 -16
- 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 +22 -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/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 +17 -7
- package/clients/cli/commands/search.test.mjs +75 -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 +29 -7
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +718 -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 +13 -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 +29 -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 +69 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +190 -32
- package/foundation/config/project.test.mjs +129 -16
- 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 +155 -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 +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +2 -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 +12 -4
- package/foundation/discovery/docs-discovery.mjs +215 -98
- package/foundation/discovery/docs-discovery.test.mjs +281 -15
- 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 +109 -0
- package/foundation/discovery/docs-section-key.mjs +308 -0
- package/foundation/discovery/docs-section-key.test.mjs +246 -0
- package/foundation/discovery/template-adapter.d.mts +21 -5
- 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 +321 -66
- package/foundation/discovery/template-adapter.test.mjs +15 -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 +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +362 -0
- package/foundation/doc-compiler/compile.mjs +512 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -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 +286 -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 +464 -0
- package/foundation/doc-compiler/lenses.d.mts +33 -0
- package/foundation/doc-compiler/lenses.mjs +127 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -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 +126 -0
- package/foundation/doc-compiler/read.mjs +320 -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/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/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integration-warnings.mjs +6 -0
- 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 +114 -10
- 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 +16 -11
- 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 +3 -2
- package/foundation/xle/expand.test.mjs +54 -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
|
@@ -32,8 +32,17 @@
|
|
|
32
32
|
import * as fs from 'node:fs';
|
|
33
33
|
import * as path from 'node:path';
|
|
34
34
|
import {CLI_ROOT} from '../fs/paths.mjs';
|
|
35
|
-
import {
|
|
36
|
-
import {
|
|
35
|
+
import {importDocModule} from '../doc-compiler/import.mjs';
|
|
36
|
+
import {CLI_PROVIDER_ID} from '../identity/providers.mjs';
|
|
37
|
+
import {parseReadableDoc} from '../doc-compiler/parse-readable.mjs';
|
|
38
|
+
import {
|
|
39
|
+
sectionKey,
|
|
40
|
+
sectionKeyErrors,
|
|
41
|
+
sourceTitle,
|
|
42
|
+
withSourceTitle,
|
|
43
|
+
} from './docs-section-key.mjs';
|
|
44
|
+
|
|
45
|
+
export {withSourceTitle};
|
|
37
46
|
|
|
38
47
|
/** Where the CLI's own topics live. */
|
|
39
48
|
const BUILTIN_DOCS_DIR = path.join(CLI_ROOT, 'assets', 'docs');
|
|
@@ -43,7 +52,7 @@ const BUILTIN_DOCS_DIR = path.join(CLI_ROOT, 'assets', 'docs');
|
|
|
43
52
|
* (assets/docs), not in @astryxdesign/core, so this is the CLI's own name —
|
|
44
53
|
* unlike component discovery, whose built-ins belong to core.
|
|
45
54
|
*/
|
|
46
|
-
export const BUILTIN_DOCS_PACKAGE =
|
|
55
|
+
export const BUILTIN_DOCS_PACKAGE = CLI_PROVIDER_ID;
|
|
47
56
|
|
|
48
57
|
/**
|
|
49
58
|
* A built-in topic file: `{topic}.doc.mjs`. Anchored at both ends so a
|
|
@@ -108,7 +117,7 @@ export function discoverBuiltinTopics() {
|
|
|
108
117
|
* @returns {Promise<unknown>} the authored doc value
|
|
109
118
|
*/
|
|
110
119
|
export async function loadTopicModule(file) {
|
|
111
|
-
const mod = await
|
|
120
|
+
const mod = await importDocModule(file);
|
|
112
121
|
const doc = mod?.docs ?? mod?.default;
|
|
113
122
|
if (doc == null) {
|
|
114
123
|
throw new Error(
|
|
@@ -128,12 +137,25 @@ const BLOCK_FIELDS = {
|
|
|
128
137
|
'token-ref': ['topic', 'section'],
|
|
129
138
|
};
|
|
130
139
|
|
|
140
|
+
/** Blocks that are valid authoring but require the compiled graph renderer. */
|
|
141
|
+
export const GRAPH_BLOCK_TYPES = new Set([
|
|
142
|
+
'workflow',
|
|
143
|
+
'collection',
|
|
144
|
+
'reference',
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
/** Doc fields only the docs graph reads; a topic that sets one fails to load. */
|
|
148
|
+
export const GRAPH_ONLY_FIELDS = ['placement', 'aliases', 'audience'];
|
|
149
|
+
|
|
131
150
|
/**
|
|
132
151
|
* Fields a block kind may carry but does not need. Kept per kind rather than
|
|
133
152
|
* globally: only a code block renders a `label`, so allowing it everywhere
|
|
134
153
|
* would wave through the misspellings this check exists to catch.
|
|
135
154
|
*/
|
|
136
|
-
|
|
155
|
+
/** @type {Record<string, string[]>} */
|
|
156
|
+
const OPTIONAL_BLOCK_FIELDS = {
|
|
157
|
+
code: ['label'],
|
|
158
|
+
};
|
|
137
159
|
|
|
138
160
|
/**
|
|
139
161
|
* Fields whose value has to be one of a set, because the renderer indexes on
|
|
@@ -147,7 +169,7 @@ const BLOCK_FIELD_VALUES = {
|
|
|
147
169
|
};
|
|
148
170
|
|
|
149
171
|
/** Keys a section may carry. */
|
|
150
|
-
const SECTION_FIELDS = ['title', 'category', 'content', 'previewType'];
|
|
172
|
+
const SECTION_FIELDS = ['id', 'title', 'category', 'content', 'previewType'];
|
|
151
173
|
|
|
152
174
|
/**
|
|
153
175
|
* Check the fields the docs surfaces actually read. `parseDoc` is the outer
|
|
@@ -161,6 +183,13 @@ const SECTION_FIELDS = ['title', 'category', 'content', 'previewType'];
|
|
|
161
183
|
* @returns {string[]} problems, each already pointed at a place in the doc
|
|
162
184
|
*/
|
|
163
185
|
export function problemsInTopic(doc) {
|
|
186
|
+
// A namespace doc is valid authoring that only the docs graph reads. Said
|
|
187
|
+
// plainly, instead of as the topic fields it does not have.
|
|
188
|
+
if (doc?.type === 'namespace') {
|
|
189
|
+
return [
|
|
190
|
+
`"${doc.name}" is a namespace doc. Only the docs graph reads namespace docs, and it is not built yet; remove this file from the docs directory.`,
|
|
191
|
+
];
|
|
192
|
+
}
|
|
164
193
|
/** @type {string[]} */
|
|
165
194
|
const problems = [];
|
|
166
195
|
for (const field of ['name', 'title', 'description']) {
|
|
@@ -173,83 +202,120 @@ export function problemsInTopic(doc) {
|
|
|
173
202
|
`name: "${doc.name}" is not URL-safe. A topic name is its CLI argument and its docsite path, so it may hold only letters, digits, "_" and "-".`,
|
|
174
203
|
);
|
|
175
204
|
}
|
|
205
|
+
for (const field of GRAPH_ONLY_FIELDS) {
|
|
206
|
+
if (doc?.[field] != null) {
|
|
207
|
+
problems.push(
|
|
208
|
+
`${field}: requires the compiled graph reader and is not supported by legacy topic readers`,
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
176
212
|
if (!Array.isArray(doc?.sections) || doc.sections.length === 0) {
|
|
177
213
|
problems.push('sections: expected at least one section');
|
|
178
214
|
return problems;
|
|
179
215
|
}
|
|
180
216
|
|
|
181
|
-
doc.sections.forEach(
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
for (const key of Object.keys(section ?? {})) {
|
|
187
|
-
if (!SECTION_FIELDS.includes(key)) {
|
|
188
|
-
problems.push(`${at}.${key}: not a field of a section`);
|
|
217
|
+
doc.sections.forEach(
|
|
218
|
+
(/** @type {any} */ section, /** @type {number} */ s) => {
|
|
219
|
+
const at = `sections[${s}]`;
|
|
220
|
+
if (typeof section?.title !== 'string' || section.title === '') {
|
|
221
|
+
problems.push(`${at}.title: expected a non-empty string`);
|
|
189
222
|
}
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
return;
|
|
194
|
-
}
|
|
195
|
-
section.content.forEach((/** @type {any} */ block, /** @type {number} */ b) => {
|
|
196
|
-
const blockAt = `${at}.content[${b}]`;
|
|
197
|
-
const fields = /** @type {Record<string, string[]>} */ (BLOCK_FIELDS)[block?.type];
|
|
198
|
-
if (fields == null) {
|
|
199
|
-
problems.push(
|
|
200
|
-
`${blockAt}.type: ${JSON.stringify(block?.type)} is not one of ${Object.keys(BLOCK_FIELDS).join(', ')}`,
|
|
201
|
-
);
|
|
202
|
-
return;
|
|
203
|
-
}
|
|
204
|
-
for (const field of fields) {
|
|
205
|
-
const value = block[field];
|
|
206
|
-
// Empty counts as missing, the way it does for the doc's own title: a
|
|
207
|
-
// block whose text is '' passes every other check and renders as a gap.
|
|
208
|
-
if (value == null) {
|
|
209
|
-
problems.push(`${blockAt}.${field}: required for a ${block.type} block`);
|
|
210
|
-
} else if (typeof value === 'string' && value.trim() === '') {
|
|
211
|
-
problems.push(`${blockAt}.${field}: expected a non-empty string`);
|
|
212
|
-
} else if (Array.isArray(value) && value.length === 0) {
|
|
213
|
-
problems.push(`${blockAt}.${field}: expected a non-empty array`);
|
|
223
|
+
for (const key of Object.keys(section ?? {})) {
|
|
224
|
+
if (!SECTION_FIELDS.includes(key)) {
|
|
225
|
+
problems.push(`${at}.${key}: not a field of a section`);
|
|
214
226
|
}
|
|
215
227
|
}
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const value = block[field];
|
|
220
|
-
if (value != null && !values.includes(value)) {
|
|
221
|
-
problems.push(
|
|
222
|
-
`${blockAt}.${field}: ${JSON.stringify(value)} is not one of ${values.join(', ')}`,
|
|
223
|
-
);
|
|
224
|
-
}
|
|
228
|
+
if (!Array.isArray(section?.content)) {
|
|
229
|
+
problems.push(`${at}.content: expected an array of blocks`);
|
|
230
|
+
return;
|
|
225
231
|
}
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
232
|
+
section.content.forEach(
|
|
233
|
+
(/** @type {any} */ block, /** @type {number} */ b) => {
|
|
234
|
+
const blockAt = `${at}.content[${b}]`;
|
|
235
|
+
const fields = /** @type {Record<string, string[]>} */ (BLOCK_FIELDS)[
|
|
236
|
+
block?.type
|
|
237
|
+
];
|
|
238
|
+
if (fields == null) {
|
|
239
|
+
if (GRAPH_BLOCK_TYPES.has(block?.type)) {
|
|
240
|
+
problems.push(
|
|
241
|
+
`${blockAt}.type: ${JSON.stringify(block.type)} requires the compiled graph renderer and is not supported by legacy topic readers`,
|
|
242
|
+
);
|
|
243
|
+
} else {
|
|
244
|
+
problems.push(
|
|
245
|
+
`${blockAt}.type: ${JSON.stringify(block?.type)} is not one of ${Object.keys(BLOCK_FIELDS).join(', ')}`,
|
|
246
|
+
);
|
|
247
|
+
}
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
for (const field of fields) {
|
|
251
|
+
const value = block[field];
|
|
252
|
+
// Empty counts as missing, the way it does for the doc's own title: a
|
|
253
|
+
// block whose text is '' passes every other check and renders as a gap.
|
|
254
|
+
if (value == null) {
|
|
255
|
+
problems.push(
|
|
256
|
+
`${blockAt}.${field}: required for a ${block.type} block`,
|
|
257
|
+
);
|
|
258
|
+
} else if (typeof value === 'string' && value.trim() === '') {
|
|
259
|
+
problems.push(`${blockAt}.${field}: expected a non-empty string`);
|
|
260
|
+
} else if (Array.isArray(value) && value.length === 0) {
|
|
261
|
+
problems.push(`${blockAt}.${field}: expected a non-empty array`);
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
const allowedValues =
|
|
265
|
+
/** @type {Record<string, Record<string, unknown[]>>} */ (
|
|
266
|
+
BLOCK_FIELD_VALUES
|
|
267
|
+
)[block.type] ?? {};
|
|
268
|
+
for (const [field, values] of Object.entries(allowedValues)) {
|
|
269
|
+
const value = block[field];
|
|
270
|
+
if (value != null && !values.includes(value)) {
|
|
271
|
+
problems.push(
|
|
272
|
+
`${blockAt}.${field}: ${JSON.stringify(value)} is not one of ${values.join(', ')}`,
|
|
273
|
+
);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// A table's cells are read by column index, so a short row renders blank
|
|
277
|
+
// cells and a long one drops its tail — both silently.
|
|
278
|
+
if (
|
|
279
|
+
block.type === 'table' &&
|
|
280
|
+
Array.isArray(block.headers) &&
|
|
281
|
+
Array.isArray(block.rows)
|
|
282
|
+
) {
|
|
283
|
+
block.rows.forEach(
|
|
284
|
+
(/** @type {any} */ row, /** @type {number} */ r) => {
|
|
285
|
+
if (!Array.isArray(row)) {
|
|
286
|
+
problems.push(
|
|
287
|
+
`${blockAt}.rows[${r}]: expected an array of cells`,
|
|
288
|
+
);
|
|
289
|
+
} else if (row.length !== block.headers.length) {
|
|
290
|
+
problems.push(
|
|
291
|
+
`${blockAt}.rows[${r}]: has ${row.length} cells but the table has ${block.headers.length} headers`,
|
|
292
|
+
);
|
|
293
|
+
}
|
|
294
|
+
},
|
|
235
295
|
);
|
|
236
296
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
297
|
+
// An unknown key is almost always a misspelled required one, and it
|
|
298
|
+
// would otherwise reach a reader as a block that renders nothing.
|
|
299
|
+
const allowed = [
|
|
300
|
+
'type',
|
|
301
|
+
...fields,
|
|
302
|
+
...(OPTIONAL_BLOCK_FIELDS[block.type] ?? []),
|
|
303
|
+
];
|
|
304
|
+
for (const key of Object.keys(block)) {
|
|
305
|
+
if (!allowed.includes(key)) {
|
|
306
|
+
problems.push(
|
|
307
|
+
`${blockAt}.${key}: not a field of a ${block.type} block`,
|
|
308
|
+
);
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
},
|
|
312
|
+
);
|
|
313
|
+
},
|
|
314
|
+
);
|
|
315
|
+
// Explicit authored IDs are a new opt-in contract and remain strict. Topics
|
|
316
|
+
// that relied on 0.6.x title-only sections keep loading; the compiler assigns
|
|
317
|
+
// deterministic fallback/suffixed keys for the additive index API.
|
|
318
|
+
problems.push(...sectionKeyErrors(doc.sections));
|
|
253
319
|
return problems;
|
|
254
320
|
}
|
|
255
321
|
|
|
@@ -283,7 +349,9 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
283
349
|
const full = path.join(dirPath, entry.name);
|
|
284
350
|
if (entry.isDirectory()) {
|
|
285
351
|
scanDir(full);
|
|
286
|
-
} else if (
|
|
352
|
+
} else if (
|
|
353
|
+
INTEGRATION_DOC_SUFFIXES.some(suffix => entry.name.endsWith(suffix))
|
|
354
|
+
) {
|
|
287
355
|
files.push(full);
|
|
288
356
|
}
|
|
289
357
|
}
|
|
@@ -296,9 +364,13 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
296
364
|
for (const file of files) {
|
|
297
365
|
let doc;
|
|
298
366
|
try {
|
|
299
|
-
doc =
|
|
367
|
+
doc = parseReadableDoc(await loadTopicModule(file), path.basename(file));
|
|
300
368
|
} catch (err) {
|
|
301
|
-
errors.push(
|
|
369
|
+
errors.push(
|
|
370
|
+
new Error(
|
|
371
|
+
`${path.relative(docsDir, file)}: ${/** @type {any} */ (err).message}`,
|
|
372
|
+
),
|
|
373
|
+
);
|
|
302
374
|
continue;
|
|
303
375
|
}
|
|
304
376
|
const problems = problemsInTopic(doc);
|
|
@@ -315,7 +387,8 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
315
387
|
const parsed = /** @type {any} */ (doc);
|
|
316
388
|
// Two files claiming one name would collapse into a single entry, and the
|
|
317
389
|
// one that lost would never be reachable. Named here, where both files are.
|
|
318
|
-
const
|
|
390
|
+
const topicKey = parsed.name.toLowerCase();
|
|
391
|
+
const previous = seen.get(topicKey);
|
|
319
392
|
if (previous) {
|
|
320
393
|
errors.push(
|
|
321
394
|
new Error(
|
|
@@ -324,7 +397,7 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
324
397
|
);
|
|
325
398
|
continue;
|
|
326
399
|
}
|
|
327
|
-
seen.set(
|
|
400
|
+
seen.set(topicKey, path.relative(docsDir, file));
|
|
328
401
|
if (parsed.replaces != null && parsed.extends != null) {
|
|
329
402
|
errors.push(
|
|
330
403
|
new Error(
|
|
@@ -349,9 +422,11 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
349
422
|
}
|
|
350
423
|
|
|
351
424
|
/**
|
|
352
|
-
* Merge an extension onto a base topic: a section
|
|
353
|
-
* the base
|
|
354
|
-
* title
|
|
425
|
+
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
426
|
+
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
427
|
+
* title matching. A section with no match is appended. The title and
|
|
428
|
+
* description stay the base topic's: an extension adds to a topic, it never
|
|
429
|
+
* renames it. A topic that `replaces` another is the one that renames.
|
|
355
430
|
*
|
|
356
431
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
357
432
|
* overlays are — position keying grafts an overlay onto whichever section
|
|
@@ -365,16 +440,55 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
365
440
|
export function mergeTopic(base, overlay) {
|
|
366
441
|
const sections = [...(base.sections ?? [])];
|
|
367
442
|
for (const section of overlay.sections ?? []) {
|
|
368
|
-
const at = sections
|
|
369
|
-
if (at === -1)
|
|
370
|
-
|
|
443
|
+
const at = findMergeTarget(sections, section);
|
|
444
|
+
if (at === -1) {
|
|
445
|
+
sections.push(section);
|
|
446
|
+
} else {
|
|
447
|
+
// A legacy extension that replaces a section which has since gained a
|
|
448
|
+
// stable ID keeps that ID, so readers addressing it keep working.
|
|
449
|
+
const replaced = sections[at];
|
|
450
|
+
sections[at] =
|
|
451
|
+
section.id == null && replaced.id != null
|
|
452
|
+
? withSourceTitle({...section, id: replaced.id}, sourceTitle(section))
|
|
453
|
+
: section;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
return {...base, sections};
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
/**
|
|
460
|
+
* The base section an extension section replaces. A stable ID matches first.
|
|
461
|
+
* Otherwise the exact title matches when at least one side has no ID: the
|
|
462
|
+
* migration window in which the base or the extension adopts stable IDs
|
|
463
|
+
* before the other does. Two different authored IDs stay distinct even under
|
|
464
|
+
* one title.
|
|
465
|
+
*
|
|
466
|
+
* @param {any[]} sections
|
|
467
|
+
* @param {any} section
|
|
468
|
+
* @returns {number}
|
|
469
|
+
*/
|
|
470
|
+
function findMergeTarget(sections, section) {
|
|
471
|
+
const title = sourceTitle(section);
|
|
472
|
+
const key = sectionKey(section);
|
|
473
|
+
// A section is addressed by its key: an authored id, or the key its title
|
|
474
|
+
// derives, which is the key the topic's index shows. Matching on it means an
|
|
475
|
+
// extension never appends a second section under a key already in use.
|
|
476
|
+
const byKey = () =>
|
|
477
|
+
sections.findIndex(candidate => sectionKey(candidate) === key);
|
|
478
|
+
const legacyTitleMatch = () =>
|
|
479
|
+
sections.findIndex(
|
|
480
|
+
candidate => candidate.id == null && sourceTitle(candidate) === title,
|
|
481
|
+
);
|
|
482
|
+
if (section.id != null) {
|
|
483
|
+
const byId = byKey();
|
|
484
|
+
return byId === -1 ? legacyTitleMatch() : byId;
|
|
371
485
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
486
|
+
const legacy = legacyTitleMatch();
|
|
487
|
+
if (legacy !== -1) return legacy;
|
|
488
|
+
const sameTitle = sections.findIndex(
|
|
489
|
+
candidate => sourceTitle(candidate) === title,
|
|
490
|
+
);
|
|
491
|
+
return sameTitle;
|
|
378
492
|
}
|
|
379
493
|
|
|
380
494
|
/**
|
|
@@ -399,7 +513,7 @@ export class DocsCatalog {
|
|
|
399
513
|
static fromBuiltins(builtins = discoverBuiltinTopics()) {
|
|
400
514
|
const catalog = new DocsCatalog();
|
|
401
515
|
for (const [name, file] of Object.entries(builtins)) {
|
|
402
|
-
catalog.#topics.set(name, {
|
|
516
|
+
catalog.#topics.set(name.toLowerCase(), {
|
|
403
517
|
name,
|
|
404
518
|
package: BUILTIN_DOCS_PACKAGE,
|
|
405
519
|
path: file,
|
|
@@ -455,7 +569,9 @@ export class DocsCatalog {
|
|
|
455
569
|
// The replacement takes the base topic's slot, so a reader that opens
|
|
456
570
|
// the first topic (or the nth) sees the same one it did before.
|
|
457
571
|
const replaced = target.name;
|
|
458
|
-
|
|
572
|
+
const replacedKey = replaced.toLowerCase();
|
|
573
|
+
const replacementKey = record.name.toLowerCase();
|
|
574
|
+
this.#replaceAt(replacedKey, {
|
|
459
575
|
name: record.name,
|
|
460
576
|
package: record.package,
|
|
461
577
|
path: record.path,
|
|
@@ -466,17 +582,18 @@ export class DocsCatalog {
|
|
|
466
582
|
// Extensions were authored against the content that just went away.
|
|
467
583
|
extensions: [],
|
|
468
584
|
});
|
|
469
|
-
if (
|
|
470
|
-
this.#aliases.set(
|
|
585
|
+
if (replacementKey !== replacedKey) {
|
|
586
|
+
this.#aliases.set(replacedKey, replacementKey);
|
|
471
587
|
// A topic renamed twice keeps every name it has ever answered to.
|
|
472
588
|
for (const [from, to] of this.#aliases) {
|
|
473
|
-
if (to ===
|
|
589
|
+
if (to === replacedKey) this.#aliases.set(from, replacementKey);
|
|
474
590
|
}
|
|
475
591
|
}
|
|
476
592
|
return warning;
|
|
477
593
|
}
|
|
478
594
|
|
|
479
|
-
const
|
|
595
|
+
const topicKey = record.name.toLowerCase();
|
|
596
|
+
const existing = this.#topics.get(topicKey);
|
|
480
597
|
if (existing) {
|
|
481
598
|
return {
|
|
482
599
|
code: 'invalid_doc',
|
|
@@ -484,7 +601,7 @@ export class DocsCatalog {
|
|
|
484
601
|
message: `Topic "${record.name}" is already provided by ${existing.package}. Give it another name, or declare \`replaces: '${record.name}'\` to take its place.`,
|
|
485
602
|
};
|
|
486
603
|
}
|
|
487
|
-
this.#topics.set(
|
|
604
|
+
this.#topics.set(topicKey, {
|
|
488
605
|
name: record.name,
|
|
489
606
|
package: record.package,
|
|
490
607
|
path: record.path,
|
|
@@ -519,7 +636,7 @@ export class DocsCatalog {
|
|
|
519
636
|
|
|
520
637
|
/** @returns {string[]} every topic name, in read order */
|
|
521
638
|
names() {
|
|
522
|
-
return [...this.#topics.
|
|
639
|
+
return [...this.#topics.values()].map(entry => entry.name);
|
|
523
640
|
}
|
|
524
641
|
|
|
525
642
|
/** @returns {DocsTopicEntry[]} every topic, in read order */
|
|
@@ -536,7 +653,7 @@ export class DocsCatalog {
|
|
|
536
653
|
/** @type {Map<string, DocsTopicEntry>} */
|
|
537
654
|
const next = new Map();
|
|
538
655
|
for (const [key, value] of this.#topics) {
|
|
539
|
-
if (key === name) next.set(entry.name, entry);
|
|
656
|
+
if (key === name.toLowerCase()) next.set(entry.name.toLowerCase(), entry);
|
|
540
657
|
else next.set(key, value);
|
|
541
658
|
}
|
|
542
659
|
this.#topics = next;
|