@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.f04b501
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +106 -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 +44 -20
- package/api/docs/detail/section/section.test.mjs +41 -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 +12 -3
- package/api/upgrade/_adapter.mjs +123 -19
- 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 +1 -0
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +7 -4
- package/api/upgrade/upgrade.type.d.mts +9 -5
- package/api/upgrade/upgrade.type.mjs +12 -11
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/runner.mjs +115 -5
- 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-theme-catalog-to-descriptors.test.mjs +216 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- 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 +78 -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/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/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/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 +788 -23
- package/authoring/doctypes/_schema.mjs +492 -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 +165 -0
- package/authoring/doctypes/namespace/type.ts +71 -0
- package/authoring/doctypes/parse.d.mts +22 -18
- package/authoring/doctypes/parse.mjs +22 -12
- 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 +18 -5
- package/authoring/doctypes/reference/type.ts +53 -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 +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 +5 -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 +51 -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.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 +5 -5
- 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 +121 -21
- package/clients/cli/commands/docs.test.mjs +88 -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/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.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 +20 -9
- 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/formatters/index.mjs +162 -1
- package/clients/cli/formatters/index.test.mjs +91 -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 +154 -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 +214 -98
- package/foundation/discovery/docs-discovery.test.mjs +284 -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 +98 -0
- package/foundation/discovery/docs-section-key.mjs +221 -0
- package/foundation/discovery/docs-section-key.test.mjs +224 -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 +511 -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/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.doc.mjs +3 -4
- package/foundation/response/error-codes.mjs +2 -2
- package/foundation/response/error-codes.test.mjs +83 -0
- 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 +9 -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
|
+
sectionKeyProblems,
|
|
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,119 @@ 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
|
+
// Readers address a section by its key, so two sections sharing one would
|
|
316
|
+
// make one of them unreachable.
|
|
317
|
+
problems.push(...sectionKeyProblems(doc.sections));
|
|
253
318
|
return problems;
|
|
254
319
|
}
|
|
255
320
|
|
|
@@ -283,7 +348,9 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
283
348
|
const full = path.join(dirPath, entry.name);
|
|
284
349
|
if (entry.isDirectory()) {
|
|
285
350
|
scanDir(full);
|
|
286
|
-
} else if (
|
|
351
|
+
} else if (
|
|
352
|
+
INTEGRATION_DOC_SUFFIXES.some(suffix => entry.name.endsWith(suffix))
|
|
353
|
+
) {
|
|
287
354
|
files.push(full);
|
|
288
355
|
}
|
|
289
356
|
}
|
|
@@ -296,9 +363,13 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
296
363
|
for (const file of files) {
|
|
297
364
|
let doc;
|
|
298
365
|
try {
|
|
299
|
-
doc =
|
|
366
|
+
doc = parseReadableDoc(await loadTopicModule(file), path.basename(file));
|
|
300
367
|
} catch (err) {
|
|
301
|
-
errors.push(
|
|
368
|
+
errors.push(
|
|
369
|
+
new Error(
|
|
370
|
+
`${path.relative(docsDir, file)}: ${/** @type {any} */ (err).message}`,
|
|
371
|
+
),
|
|
372
|
+
);
|
|
302
373
|
continue;
|
|
303
374
|
}
|
|
304
375
|
const problems = problemsInTopic(doc);
|
|
@@ -315,7 +386,8 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
315
386
|
const parsed = /** @type {any} */ (doc);
|
|
316
387
|
// Two files claiming one name would collapse into a single entry, and the
|
|
317
388
|
// one that lost would never be reachable. Named here, where both files are.
|
|
318
|
-
const
|
|
389
|
+
const topicKey = parsed.name.toLowerCase();
|
|
390
|
+
const previous = seen.get(topicKey);
|
|
319
391
|
if (previous) {
|
|
320
392
|
errors.push(
|
|
321
393
|
new Error(
|
|
@@ -324,7 +396,7 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
324
396
|
);
|
|
325
397
|
continue;
|
|
326
398
|
}
|
|
327
|
-
seen.set(
|
|
399
|
+
seen.set(topicKey, path.relative(docsDir, file));
|
|
328
400
|
if (parsed.replaces != null && parsed.extends != null) {
|
|
329
401
|
errors.push(
|
|
330
402
|
new Error(
|
|
@@ -349,9 +421,11 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
349
421
|
}
|
|
350
422
|
|
|
351
423
|
/**
|
|
352
|
-
* Merge an extension onto a base topic: a section
|
|
353
|
-
* the base
|
|
354
|
-
* title
|
|
424
|
+
* Merge an extension onto a base topic: a section with a stable `id` replaces
|
|
425
|
+
* the base section with the same `id`; legacy sections without IDs fall back to
|
|
426
|
+
* title matching. A section with no match is appended. The title and
|
|
427
|
+
* description stay the base topic's: an extension adds to a topic, it never
|
|
428
|
+
* renames it. A topic that `replaces` another is the one that renames.
|
|
355
429
|
*
|
|
356
430
|
* Keyed by section TITLE rather than by position, the way the localization
|
|
357
431
|
* overlays are — position keying grafts an overlay onto whichever section
|
|
@@ -365,16 +439,55 @@ export async function discoverIntegrationDocs(integration) {
|
|
|
365
439
|
export function mergeTopic(base, overlay) {
|
|
366
440
|
const sections = [...(base.sections ?? [])];
|
|
367
441
|
for (const section of overlay.sections ?? []) {
|
|
368
|
-
const at = sections
|
|
369
|
-
if (at === -1)
|
|
370
|
-
|
|
442
|
+
const at = findMergeTarget(sections, section);
|
|
443
|
+
if (at === -1) {
|
|
444
|
+
sections.push(section);
|
|
445
|
+
} else {
|
|
446
|
+
// A legacy extension that replaces a section which has since gained a
|
|
447
|
+
// stable ID keeps that ID, so readers addressing it keep working.
|
|
448
|
+
const replaced = sections[at];
|
|
449
|
+
sections[at] =
|
|
450
|
+
section.id == null && replaced.id != null
|
|
451
|
+
? withSourceTitle({...section, id: replaced.id}, sourceTitle(section))
|
|
452
|
+
: section;
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
return {...base, sections};
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* The base section an extension section replaces. A stable ID matches first.
|
|
460
|
+
* Otherwise the exact title matches when at least one side has no ID: the
|
|
461
|
+
* migration window in which the base or the extension adopts stable IDs
|
|
462
|
+
* before the other does. Two different authored IDs stay distinct even under
|
|
463
|
+
* one title.
|
|
464
|
+
*
|
|
465
|
+
* @param {any[]} sections
|
|
466
|
+
* @param {any} section
|
|
467
|
+
* @returns {number}
|
|
468
|
+
*/
|
|
469
|
+
function findMergeTarget(sections, section) {
|
|
470
|
+
const title = sourceTitle(section);
|
|
471
|
+
const key = sectionKey(section);
|
|
472
|
+
// A section is addressed by its key: an authored id, or the key its title
|
|
473
|
+
// derives, which is the key the topic's index shows. Matching on it means an
|
|
474
|
+
// extension never appends a second section under a key already in use.
|
|
475
|
+
const byKey = () =>
|
|
476
|
+
sections.findIndex(candidate => sectionKey(candidate) === key);
|
|
477
|
+
const legacyTitleMatch = () =>
|
|
478
|
+
sections.findIndex(
|
|
479
|
+
candidate => candidate.id == null && sourceTitle(candidate) === title,
|
|
480
|
+
);
|
|
481
|
+
if (section.id != null) {
|
|
482
|
+
const byId = byKey();
|
|
483
|
+
return byId === -1 ? legacyTitleMatch() : byId;
|
|
371
484
|
}
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
485
|
+
const legacy = legacyTitleMatch();
|
|
486
|
+
if (legacy !== -1) return legacy;
|
|
487
|
+
const sameTitle = sections.findIndex(
|
|
488
|
+
candidate => sourceTitle(candidate) === title,
|
|
489
|
+
);
|
|
490
|
+
return sameTitle === -1 ? byKey() : sameTitle;
|
|
378
491
|
}
|
|
379
492
|
|
|
380
493
|
/**
|
|
@@ -399,7 +512,7 @@ export class DocsCatalog {
|
|
|
399
512
|
static fromBuiltins(builtins = discoverBuiltinTopics()) {
|
|
400
513
|
const catalog = new DocsCatalog();
|
|
401
514
|
for (const [name, file] of Object.entries(builtins)) {
|
|
402
|
-
catalog.#topics.set(name, {
|
|
515
|
+
catalog.#topics.set(name.toLowerCase(), {
|
|
403
516
|
name,
|
|
404
517
|
package: BUILTIN_DOCS_PACKAGE,
|
|
405
518
|
path: file,
|
|
@@ -455,7 +568,9 @@ export class DocsCatalog {
|
|
|
455
568
|
// The replacement takes the base topic's slot, so a reader that opens
|
|
456
569
|
// the first topic (or the nth) sees the same one it did before.
|
|
457
570
|
const replaced = target.name;
|
|
458
|
-
|
|
571
|
+
const replacedKey = replaced.toLowerCase();
|
|
572
|
+
const replacementKey = record.name.toLowerCase();
|
|
573
|
+
this.#replaceAt(replacedKey, {
|
|
459
574
|
name: record.name,
|
|
460
575
|
package: record.package,
|
|
461
576
|
path: record.path,
|
|
@@ -466,17 +581,18 @@ export class DocsCatalog {
|
|
|
466
581
|
// Extensions were authored against the content that just went away.
|
|
467
582
|
extensions: [],
|
|
468
583
|
});
|
|
469
|
-
if (
|
|
470
|
-
this.#aliases.set(
|
|
584
|
+
if (replacementKey !== replacedKey) {
|
|
585
|
+
this.#aliases.set(replacedKey, replacementKey);
|
|
471
586
|
// A topic renamed twice keeps every name it has ever answered to.
|
|
472
587
|
for (const [from, to] of this.#aliases) {
|
|
473
|
-
if (to ===
|
|
588
|
+
if (to === replacedKey) this.#aliases.set(from, replacementKey);
|
|
474
589
|
}
|
|
475
590
|
}
|
|
476
591
|
return warning;
|
|
477
592
|
}
|
|
478
593
|
|
|
479
|
-
const
|
|
594
|
+
const topicKey = record.name.toLowerCase();
|
|
595
|
+
const existing = this.#topics.get(topicKey);
|
|
480
596
|
if (existing) {
|
|
481
597
|
return {
|
|
482
598
|
code: 'invalid_doc',
|
|
@@ -484,7 +600,7 @@ export class DocsCatalog {
|
|
|
484
600
|
message: `Topic "${record.name}" is already provided by ${existing.package}. Give it another name, or declare \`replaces: '${record.name}'\` to take its place.`,
|
|
485
601
|
};
|
|
486
602
|
}
|
|
487
|
-
this.#topics.set(
|
|
603
|
+
this.#topics.set(topicKey, {
|
|
488
604
|
name: record.name,
|
|
489
605
|
package: record.package,
|
|
490
606
|
path: record.path,
|
|
@@ -519,7 +635,7 @@ export class DocsCatalog {
|
|
|
519
635
|
|
|
520
636
|
/** @returns {string[]} every topic name, in read order */
|
|
521
637
|
names() {
|
|
522
|
-
return [...this.#topics.
|
|
638
|
+
return [...this.#topics.values()].map(entry => entry.name);
|
|
523
639
|
}
|
|
524
640
|
|
|
525
641
|
/** @returns {DocsTopicEntry[]} every topic, in read order */
|
|
@@ -536,7 +652,7 @@ export class DocsCatalog {
|
|
|
536
652
|
/** @type {Map<string, DocsTopicEntry>} */
|
|
537
653
|
const next = new Map();
|
|
538
654
|
for (const [key, value] of this.#topics) {
|
|
539
|
-
if (key === name) next.set(entry.name, entry);
|
|
655
|
+
if (key === name.toLowerCase()) next.set(entry.name.toLowerCase(), entry);
|
|
540
656
|
else next.set(key, value);
|
|
541
657
|
}
|
|
542
658
|
this.#topics = next;
|