@astryxdesign/cli 0.6.3-canary.db4e378 → 0.6.3-canary.db52d98
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 +38 -15
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +14 -7
- package/api/build/build.test.mjs +184 -6
- package/api/build/build.type.d.mts +57 -2
- package/api/build/build.type.mjs +30 -7
- package/api/build/help/help.d.mts +4 -0
- package/api/build/help/help.mjs +24 -11
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +165 -49
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- package/api/component/_adapter.d.mts +6 -12
- package/api/component/_adapter.mjs +20 -10
- package/api/component/component.doc.mjs +1 -0
- package/api/component/component.mjs +60 -12
- package/api/component/list/list.mjs +3 -2
- package/api/discover/discover.doc.mjs +1 -0
- package/api/docs/_adapter.d.mts +252 -34
- package/api/docs/_adapter.mjs +923 -132
- package/api/docs/detail/detail.mjs +11 -3
- package/api/docs/detail/section/section.mjs +24 -13
- package/api/docs/detail/section/section.test.mjs +15 -6
- package/api/docs/docs.d.mts +5 -3
- package/api/docs/docs.doc.mjs +39 -17
- package/api/docs/docs.mjs +44 -8
- package/api/docs/docs.test.mjs +158 -4
- package/api/docs/docs.type.d.mts +181 -2
- package/api/docs/docs.type.mjs +117 -3
- package/api/docs/index/index.mjs +11 -3
- package/api/docs/index/index.test.mjs +1 -1
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +14 -14
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +54 -4
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +331 -16
- package/api/doctor/doctor.test.mjs +420 -7
- package/api/gap-report/gap-report.doc.mjs +1 -0
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +1 -1
- package/api/index.mjs +1 -0
- package/api/init/init.doc.mjs +2 -1
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +114 -12
- package/api/integration/add-contribution.test.mjs +174 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.mjs +138 -28
- package/api/integration/authoring-checks.test.mjs +179 -7
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +2 -0
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +7 -0
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +1 -0
- package/api/integration/integrationAddDoc.doc.mjs +8 -1
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +2 -1
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +4 -0
- package/api/integration/pack-check.mjs +34 -0
- package/api/integration/pack-check.test.mjs +138 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +14 -1
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/template-conflict-compatibility.test.mjs +73 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +50 -102
- package/api/integration/validate-integration.test.mjs +88 -26
- 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/index.ts +2 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +1 -0
- package/api/layout/_adapter.mjs +20 -5
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -0
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search.d.mts +59 -1
- package/api/search/search.doc.mjs +5 -3
- package/api/search/search.mjs +458 -77
- package/api/search/search.test.mjs +91 -2
- package/api/search/search.type.d.mts +13 -1
- package/api/search/search.type.mjs +4 -1
- package/api/swizzle/swizzle.doc.mjs +1 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +28 -7
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +6 -8
- package/api/template/template.type.mjs +3 -2
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +10 -17
- package/api/theme/add/add.test.mjs +14 -1
- 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/template/template.test.mjs +5 -0
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +1 -0
- 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 +2 -1
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +97 -69
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/upgrade.doc.mjs +6 -1
- package/api/upgrade/upgrade.type.d.mts +34 -0
- package/api/upgrade/upgrade.type.mjs +15 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -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/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/docs/getting-started.doc.mjs +2 -2
- package/assets/docs/layout.doc.dense.mjs +2 -2
- package/assets/docs/layout.doc.mjs +1 -1
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/styling-libraries.doc.mjs +3 -3
- package/assets/docs/styling.doc.mjs +4 -4
- package/assets/docs/theme.doc.mjs +5 -5
- package/assets/docs/tokens.doc.mjs +1 -1
- package/assets/docs/tree/api.doc.mjs +30 -0
- package/assets/docs/tree/cli.doc.mjs +23 -0
- package/assets/docs/tree/commands.doc.mjs +25 -0
- package/assets/docs/{cli-integrations.doc.mjs → tree/integrations.doc.mjs} +66 -38
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/working-with-ai.doc.mjs +3 -3
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/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/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +119 -117
- package/authoring/doctypes/_schema.mjs +54 -3
- package/authoring/doctypes/base/graph-fields.doc.mjs +8 -6
- package/authoring/doctypes/base/type.ts +6 -5
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +2 -2
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +3 -2
- package/authoring/doctypes/function/type.ts +3 -2
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +28 -2
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -10
- package/authoring/doctypes/namespace/parse.test.mjs +23 -25
- package/authoring/doctypes/namespace/type.ts +5 -2
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +10 -5
- package/authoring/doctypes/reference/reference.doc.mjs +35 -6
- package/authoring/doctypes/reference/type.ts +30 -13
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +4 -0
- package/authoring/doctypes/template/parse.test.mjs +18 -0
- package/authoring/doctypes/template/template.doc.mjs +9 -3
- package/authoring/doctypes/template/type.ts +8 -0
- 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 +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/identity/identity.doc.mjs +2 -2
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +7 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/type.ts +4 -10
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -1
- package/clients/cli/commands/build-theme.mjs +11 -45
- package/clients/cli/commands/build.doc.mjs +12 -7
- package/clients/cli/commands/build.mjs +105 -67
- package/clients/cli/commands/build.text-fields.test.mjs +41 -0
- package/clients/cli/commands/component/index.mjs +1 -1
- package/clients/cli/commands/component-ownership.test.mjs +3 -3
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/discover.broken-integration.test.mjs +7 -8
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/discover.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +21 -9
- package/clients/cli/commands/docs.mjs +184 -70
- package/clients/cli/commands/docs.test.mjs +120 -16
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -3
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.test.mjs +90 -8
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +53 -16
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.controls.test.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +11 -1
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/integration.mjs +1 -0
- package/clients/cli/commands/layout-check.doc.mjs +1 -1
- package/clients/cli/commands/layout-expand.doc.mjs +1 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +1 -1
- package/clients/cli/commands/search.mjs +11 -2
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +24 -7
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/text-json-parity.test.mjs +719 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- 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.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +2 -0
- package/clients/cli/formatters/index.test.mjs +6 -0
- package/clients/cli/index.mjs +8 -0
- package/clients/cli/lib/hook-format.mjs +14 -5
- package/clients/cli/lib/manifest.mjs +9 -2
- package/foundation/agent-docs/agent-docs.d.mts +3 -2
- package/foundation/agent-docs/agent-docs.mjs +13 -9
- package/foundation/agent-docs/agent-docs.test.mjs +19 -1
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +20 -11
- package/foundation/config/project.mjs +123 -80
- package/foundation/config/project.test.mjs +144 -21
- package/foundation/discovery/authoring-self-docs.d.mts +18 -0
- package/foundation/discovery/authoring-self-docs.mjs +37 -15
- package/foundation/discovery/authoring-self-docs.test.mjs +25 -9
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +119 -0
- package/foundation/discovery/cli-self-docs.mjs +490 -0
- package/foundation/discovery/cli-self-docs.test.mjs +375 -0
- package/foundation/discovery/component-discovery.d.mts +38 -0
- package/foundation/discovery/component-discovery.mjs +48 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +112 -11
- package/foundation/discovery/docs-discovery.mjs +231 -36
- package/foundation/discovery/docs-discovery.test.mjs +111 -32
- package/foundation/discovery/docs-output-budget.d.mts +2 -2
- package/foundation/discovery/docs-output-budget.mjs +1 -1
- package/foundation/discovery/docs-section-key.d.mts +28 -10
- package/foundation/discovery/docs-section-key.mjs +134 -33
- package/foundation/discovery/docs-section-key.test.mjs +41 -19
- package/foundation/discovery/template-adapter.d.mts +99 -6
- package/foundation/discovery/template-adapter.mjs +480 -57
- package/foundation/discovery/template-adapter.test.mjs +57 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +220 -39
- package/foundation/doc-compiler/compile.mjs +311 -15
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +196 -12
- package/foundation/doc-compiler/lenses.d.mts +8 -5
- package/foundation/doc-compiler/lenses.mjs +50 -4
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +127 -0
- package/foundation/doc-compiler/read.mjs +325 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/doc-compiler/tree.d.mts +288 -0
- package/foundation/doc-compiler/tree.mjs +876 -0
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -57
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +45 -0
- package/foundation/integrations/cli-requirement.mjs +154 -0
- package/foundation/integrations/cli-requirement.test.mjs +84 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +27 -24
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +51 -26
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- 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.mjs +121 -29
- 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 +12 -2
- package/foundation/response/error-codes.mjs +7 -1
- package/foundation/response/error-codes.test.mjs +55 -11
- package/foundation/response/response-types.doc.d.mts +5 -1
- package/foundation/response/response-types.doc.mjs +20 -11
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +40 -10
- package/foundation/xle/expand.mjs +1 -1
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -9
- package/assets/templates/themes/manifest.json +0 -95
|
@@ -0,0 +1,392 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Colocated tests for authoring-surface.mjs: every type this repo's
|
|
5
|
+
* `@astryxdesign/cli/authoring` exports traces to a readable self-doc, and
|
|
6
|
+
* each way a type loses its doc, or a self-doc loses its type, is named.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {afterEach, describe, expect, it} from 'vitest';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import {
|
|
13
|
+
auditAuthoringSurface,
|
|
14
|
+
tracePublicAuthoringTypes,
|
|
15
|
+
} from './authoring-surface.mjs';
|
|
16
|
+
import {docs} from '../../api/docs/docs.mjs';
|
|
17
|
+
|
|
18
|
+
const SLOW = 60_000;
|
|
19
|
+
|
|
20
|
+
/** @type {string[]} */
|
|
21
|
+
const roots = [];
|
|
22
|
+
afterEach(() => {
|
|
23
|
+
while (roots.length) {
|
|
24
|
+
fs.rmSync(/** @type {string} */ (roots.pop()), {
|
|
25
|
+
recursive: true,
|
|
26
|
+
force: true,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A throwaway authoring tree. Kept under the working directory so its
|
|
33
|
+
* self-docs import the way the real ones do.
|
|
34
|
+
* @param {Record<string, string>} files
|
|
35
|
+
* @returns {string}
|
|
36
|
+
*/
|
|
37
|
+
function tree(files) {
|
|
38
|
+
const root = fs.mkdtempSync(path.join(process.cwd(), '.astryx-surface-'));
|
|
39
|
+
roots.push(root);
|
|
40
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
41
|
+
const abs = path.join(root, rel);
|
|
42
|
+
fs.mkdirSync(path.dirname(abs), {recursive: true});
|
|
43
|
+
fs.writeFileSync(abs, content);
|
|
44
|
+
}
|
|
45
|
+
return root;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @param {string} name
|
|
50
|
+
* @param {string} [displayName]
|
|
51
|
+
*/
|
|
52
|
+
const selfDoc = (name, displayName = name) =>
|
|
53
|
+
`export const doc = {type: 'schema', name: '${name}', displayName: '${displayName}', description: 'About ${name}.', fields: []};\n`;
|
|
54
|
+
|
|
55
|
+
/** One public type with its self-doc beside it. */
|
|
56
|
+
const FOO = {
|
|
57
|
+
'index.d.ts': "export type {FooDoc} from './foo/type.js';\n",
|
|
58
|
+
'foo/type.ts': 'export interface FooDoc {\n name: string;\n}\n',
|
|
59
|
+
'foo/foo.doc.mjs': selfDoc('foo-doc', 'FooDoc'),
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
describe('the public authoring surface of this repo', () => {
|
|
63
|
+
it('traces every exported type to the module that declares it, and leaves the parsers out', () => {
|
|
64
|
+
const {types, untraced} = tracePublicAuthoringTypes();
|
|
65
|
+
expect(untraced).toEqual([]);
|
|
66
|
+
const moduleOf = Object.fromEntries(types.map(t => [t.name, t.module]));
|
|
67
|
+
expect(moduleOf).toMatchObject({
|
|
68
|
+
NamespaceDoc: 'doctypes/namespace/type.ts',
|
|
69
|
+
ComponentDoc: 'doctypes/component/type.ts',
|
|
70
|
+
WorkflowDocBlock: 'doctypes/reference/type.ts',
|
|
71
|
+
CollectionDocBlock: 'doctypes/reference/type.ts',
|
|
72
|
+
ReferenceDocBlock: 'doctypes/reference/type.ts',
|
|
73
|
+
AuthoredDocGraphFields: 'doctypes/base/type.ts',
|
|
74
|
+
DocPlacement: 'doctypes/base/type.ts',
|
|
75
|
+
ProviderId: 'identity/type.ts',
|
|
76
|
+
AstryxConfig: 'config/type.ts',
|
|
77
|
+
DebugConfig: 'config/type.ts',
|
|
78
|
+
AstryxIntegration: 'integration/type.ts',
|
|
79
|
+
DebugEvent: 'debug/type.ts',
|
|
80
|
+
GapReportHandler: 'gap-report/type.ts',
|
|
81
|
+
});
|
|
82
|
+
expect(types.filter(t => t.name.startsWith('parse'))).toEqual([]);
|
|
83
|
+
expect(new Set(types.map(t => t.name)).size).toBe(types.length);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
it(
|
|
87
|
+
'audits clean: every exported type has a readable doc and every self-doc documents one',
|
|
88
|
+
async () => {
|
|
89
|
+
const index = await docs('authoring', undefined, {index: true});
|
|
90
|
+
const topicKeys = new Set(
|
|
91
|
+
index.data.sections.map((/** @type {any} */ s) => s.id),
|
|
92
|
+
);
|
|
93
|
+
expect(await auditAuthoringSurface({topicKeys})).toEqual({
|
|
94
|
+
types: tracePublicAuthoringTypes().types.length,
|
|
95
|
+
unreadable: [],
|
|
96
|
+
untraced: [],
|
|
97
|
+
unmatched: [],
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
SLOW,
|
|
101
|
+
);
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
describe('auditAuthoringSurface', () => {
|
|
105
|
+
it('passes a type whose registered self-doc sits beside its module', async () => {
|
|
106
|
+
const root = tree(FOO);
|
|
107
|
+
expect(
|
|
108
|
+
await auditAuthoringSurface({
|
|
109
|
+
root,
|
|
110
|
+
sources: ['foo/foo.doc.mjs'],
|
|
111
|
+
topicKeys: new Set(['foo-doc']),
|
|
112
|
+
}),
|
|
113
|
+
).toEqual({types: 1, unreadable: [], untraced: [], unmatched: []});
|
|
114
|
+
});
|
|
115
|
+
|
|
116
|
+
it('names an exported type with no self-doc beside its module', async () => {
|
|
117
|
+
const root = tree({
|
|
118
|
+
...FOO,
|
|
119
|
+
'index.d.ts': `${FOO['index.d.ts']}export type {BarDoc, BarField} from './bar/type.js';\n`,
|
|
120
|
+
'bar/type.ts':
|
|
121
|
+
'export interface BarDoc {}\nexport type BarField = string;\n',
|
|
122
|
+
});
|
|
123
|
+
const audit = await auditAuthoringSurface({
|
|
124
|
+
root,
|
|
125
|
+
sources: ['foo/foo.doc.mjs'],
|
|
126
|
+
});
|
|
127
|
+
expect(audit.unreadable).toEqual([
|
|
128
|
+
{
|
|
129
|
+
module: 'bar/type.ts',
|
|
130
|
+
names: ['BarDoc', 'BarField'],
|
|
131
|
+
reason: 'no-self-doc',
|
|
132
|
+
},
|
|
133
|
+
]);
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
it('does not let a self-doc in a parent folder stand in for one beside the module', async () => {
|
|
137
|
+
const root = tree({
|
|
138
|
+
...FOO,
|
|
139
|
+
'index.d.ts': `${FOO['index.d.ts']}export type {FooPart} from './foo/part/type.js';\n`,
|
|
140
|
+
'foo/part/type.ts': 'export interface FooPart {}\n',
|
|
141
|
+
});
|
|
142
|
+
const audit = await auditAuthoringSurface({
|
|
143
|
+
root,
|
|
144
|
+
sources: ['foo/foo.doc.mjs'],
|
|
145
|
+
});
|
|
146
|
+
expect(audit.unreadable).toEqual([
|
|
147
|
+
{module: 'foo/part/type.ts', names: ['FooPart'], reason: 'no-self-doc'},
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
it('names a self-doc that exists but is not registered', async () => {
|
|
152
|
+
const audit = await auditAuthoringSurface({root: tree(FOO), sources: []});
|
|
153
|
+
expect(audit.unreadable).toEqual([
|
|
154
|
+
{
|
|
155
|
+
module: 'foo/type.ts',
|
|
156
|
+
names: ['FooDoc'],
|
|
157
|
+
reason: 'unregistered',
|
|
158
|
+
source: 'foo/foo.doc.mjs',
|
|
159
|
+
},
|
|
160
|
+
]);
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
it('names a registered self-doc that does not load', async () => {
|
|
164
|
+
const root = tree({...FOO, 'foo/foo.doc.mjs': 'export const doc = {;\n'});
|
|
165
|
+
const audit = await auditAuthoringSurface({
|
|
166
|
+
root,
|
|
167
|
+
sources: ['foo/foo.doc.mjs'],
|
|
168
|
+
});
|
|
169
|
+
expect(audit.unreadable).toEqual([
|
|
170
|
+
{
|
|
171
|
+
module: 'foo/type.ts',
|
|
172
|
+
names: ['FooDoc'],
|
|
173
|
+
reason: 'failed',
|
|
174
|
+
source: 'foo/foo.doc.mjs',
|
|
175
|
+
},
|
|
176
|
+
]);
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("names a registered self-doc whose section the topic's index does not list", async () => {
|
|
180
|
+
const audit = await auditAuthoringSurface({
|
|
181
|
+
root: tree(FOO),
|
|
182
|
+
sources: ['foo/foo.doc.mjs'],
|
|
183
|
+
topicKeys: new Set(['something-else']),
|
|
184
|
+
});
|
|
185
|
+
expect(audit.unreadable).toEqual([
|
|
186
|
+
{
|
|
187
|
+
module: 'foo/type.ts',
|
|
188
|
+
names: ['FooDoc'],
|
|
189
|
+
reason: 'missing-section',
|
|
190
|
+
source: 'foo/foo.doc.mjs',
|
|
191
|
+
key: 'foo-doc',
|
|
192
|
+
},
|
|
193
|
+
]);
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
it('names a registered self-doc that documents no exported type', async () => {
|
|
197
|
+
const root = tree({
|
|
198
|
+
...FOO,
|
|
199
|
+
'bar/type.ts': 'export interface BarDoc {}\n',
|
|
200
|
+
'bar/bar.doc.mjs': selfDoc('bar-doc', 'BarDoc'),
|
|
201
|
+
'notes/notes.doc.mjs': selfDoc('notes', 'Notes'),
|
|
202
|
+
});
|
|
203
|
+
const audit = await auditAuthoringSurface({
|
|
204
|
+
root,
|
|
205
|
+
sources: ['foo/foo.doc.mjs', 'bar/bar.doc.mjs', 'notes/notes.doc.mjs'],
|
|
206
|
+
});
|
|
207
|
+
expect(audit.unmatched).toEqual([
|
|
208
|
+
{source: 'bar/bar.doc.mjs', key: 'bar-doc'},
|
|
209
|
+
{source: 'notes/notes.doc.mjs', key: 'notes'},
|
|
210
|
+
]);
|
|
211
|
+
expect(audit.unreadable).toEqual([]);
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it('names a self-doc titled after a type beside it that the surface does not export', async () => {
|
|
215
|
+
const root = tree({
|
|
216
|
+
...FOO,
|
|
217
|
+
'index.d.ts': "export type {FooField} from './foo/type.js';\n",
|
|
218
|
+
'foo/type.ts':
|
|
219
|
+
'export interface FooDoc {}\nexport type FooField = string;\n',
|
|
220
|
+
// What the declaration build writes beside a JavaScript module.
|
|
221
|
+
'foo/foo.doc.d.mts': 'export const doc: {\n name: string;\n};\n',
|
|
222
|
+
});
|
|
223
|
+
const audit = await auditAuthoringSurface({
|
|
224
|
+
root,
|
|
225
|
+
sources: ['foo/foo.doc.mjs'],
|
|
226
|
+
});
|
|
227
|
+
expect(audit.unmatched).toEqual([
|
|
228
|
+
{source: 'foo/foo.doc.mjs', key: 'foo-doc', subject: 'FooDoc'},
|
|
229
|
+
]);
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
it('does not treat a title that is no declared name as a subject', async () => {
|
|
233
|
+
const root = tree({
|
|
234
|
+
...FOO,
|
|
235
|
+
'foo/foo.doc.mjs': selfDoc('foo', 'Foo Doc'),
|
|
236
|
+
});
|
|
237
|
+
const audit = await auditAuthoringSurface({
|
|
238
|
+
root,
|
|
239
|
+
sources: ['foo/foo.doc.mjs'],
|
|
240
|
+
});
|
|
241
|
+
expect(audit.unmatched).toEqual([]);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
it('follows named, renamed, star, and imported re-exports to the declaring module', () => {
|
|
245
|
+
const root = tree({
|
|
246
|
+
'index.d.ts': [
|
|
247
|
+
"export type {A, B as Bee} from './barrel.js';",
|
|
248
|
+
"import type {C} from './c/type.js';",
|
|
249
|
+
'export type {C};',
|
|
250
|
+
"export type * from './d/type.js';",
|
|
251
|
+
"export type * as E from './e/type.js';",
|
|
252
|
+
'',
|
|
253
|
+
].join('\n'),
|
|
254
|
+
'barrel.ts':
|
|
255
|
+
"export type * from './a/type.js';\nexport type {B} from './b/type.js';\n",
|
|
256
|
+
'a/type.ts': 'export interface A {}\n',
|
|
257
|
+
'b/type.ts': 'export type B = number;\n',
|
|
258
|
+
'c/type.ts': 'export interface C {}\n',
|
|
259
|
+
'd/type.ts': 'export interface D1 {}\nexport type D2 = D1[];\n',
|
|
260
|
+
'e/type.ts': 'export interface E1 {}\n',
|
|
261
|
+
});
|
|
262
|
+
expect(tracePublicAuthoringTypes(root)).toEqual({
|
|
263
|
+
types: [
|
|
264
|
+
{name: 'A', module: 'a/type.ts'},
|
|
265
|
+
{name: 'Bee', module: 'b/type.ts'},
|
|
266
|
+
{name: 'C', module: 'c/type.ts'},
|
|
267
|
+
{name: 'D1', module: 'd/type.ts'},
|
|
268
|
+
{name: 'D2', module: 'd/type.ts'},
|
|
269
|
+
{name: 'E', module: 'e/type.ts'},
|
|
270
|
+
],
|
|
271
|
+
untraced: [],
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it('leaves out a value exported from a JavaScript module, and keeps a value-style export of a type', () => {
|
|
276
|
+
const root = tree({
|
|
277
|
+
'index.d.ts':
|
|
278
|
+
"export {parseFoo} from './foo/parse.mjs';\nexport {FooDoc} from './foo/type.js';\nexport type {FooShape} from './foo/parse.mjs';\n",
|
|
279
|
+
'foo/type.ts': 'export interface FooDoc {}\n',
|
|
280
|
+
'foo/parse.mjs': 'export function parseFoo(x) {\n return x;\n}\n',
|
|
281
|
+
});
|
|
282
|
+
expect(tracePublicAuthoringTypes(root)).toEqual({
|
|
283
|
+
types: [
|
|
284
|
+
{name: 'FooDoc', module: 'foo/type.ts'},
|
|
285
|
+
{name: 'FooShape', module: 'foo/parse.mjs'},
|
|
286
|
+
],
|
|
287
|
+
untraced: [],
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('reports an export it cannot trace instead of dropping it', () => {
|
|
292
|
+
const root = path.join(
|
|
293
|
+
tree({
|
|
294
|
+
'authoring/index.d.ts': [
|
|
295
|
+
"export type {Ghost} from './foo/type.js';",
|
|
296
|
+
"export type {Lost} from './nowhere/type.js';",
|
|
297
|
+
"export type {Outside} from '../elsewhere/type.js';",
|
|
298
|
+
"export * from './foo/parse.mjs';",
|
|
299
|
+
"export type * from './barrel.js';",
|
|
300
|
+
"export type {Loop} from './loop-a.js';",
|
|
301
|
+
'',
|
|
302
|
+
].join('\n'),
|
|
303
|
+
'authoring/foo/type.ts': 'export interface FooDoc {}\n',
|
|
304
|
+
'authoring/foo/parse.mjs': 'export const parseFoo = x => x;\n',
|
|
305
|
+
'authoring/barrel.ts': "export * from './foo/parse.mjs';\n",
|
|
306
|
+
'authoring/loop-a.ts': "export type {Loop} from './loop-b.js';\n",
|
|
307
|
+
'authoring/loop-b.ts': "export type {Loop} from './loop-a.js';\n",
|
|
308
|
+
'elsewhere/type.ts': 'export interface Outside {}\n',
|
|
309
|
+
}),
|
|
310
|
+
'authoring',
|
|
311
|
+
);
|
|
312
|
+
const {types, untraced} = tracePublicAuthoringTypes(root);
|
|
313
|
+
expect(types).toEqual([]);
|
|
314
|
+
expect(untraced).toEqual([
|
|
315
|
+
{
|
|
316
|
+
name: 'Ghost',
|
|
317
|
+
reason:
|
|
318
|
+
'index.d.ts exports Ghost from "./foo/type.js", which does not declare it',
|
|
319
|
+
},
|
|
320
|
+
{
|
|
321
|
+
name: 'Lost',
|
|
322
|
+
reason:
|
|
323
|
+
'index.d.ts names "./nowhere/type.js", which is not a file in authoring/',
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
name: 'Outside',
|
|
327
|
+
reason:
|
|
328
|
+
'index.d.ts names "../elsewhere/type.js", which is not a file in authoring/',
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
name: '* from "./foo/parse.mjs"',
|
|
332
|
+
reason:
|
|
333
|
+
'index.d.ts re-exports everything "./foo/parse.mjs" exports, and what a JavaScript module exports cannot be listed',
|
|
334
|
+
},
|
|
335
|
+
{
|
|
336
|
+
name: '* from "./barrel.js"',
|
|
337
|
+
reason:
|
|
338
|
+
'barrel.ts re-exports every type of "./foo/parse.mjs", a JavaScript module whose types cannot be listed',
|
|
339
|
+
},
|
|
340
|
+
{
|
|
341
|
+
name: 'Loop',
|
|
342
|
+
reason:
|
|
343
|
+
'loop-b.ts exports Loop from "./loop-a.js", which does not declare it',
|
|
344
|
+
},
|
|
345
|
+
]);
|
|
346
|
+
});
|
|
347
|
+
|
|
348
|
+
it('gives a type declared in index.d.ts itself no doc, since nothing sits beside the barrel', async () => {
|
|
349
|
+
const root = tree({'index.d.ts': 'export interface Loose {}\n'});
|
|
350
|
+
const audit = await auditAuthoringSurface({root, sources: []});
|
|
351
|
+
expect(audit.unreadable).toEqual([
|
|
352
|
+
{module: 'index.d.ts', names: ['Loose'], reason: 'no-self-doc'},
|
|
353
|
+
]);
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it('never executes a module it traces through', async () => {
|
|
357
|
+
const marker = path.join(
|
|
358
|
+
process.cwd(),
|
|
359
|
+
`.astryx-surface-ran-${process.pid}`,
|
|
360
|
+
);
|
|
361
|
+
const root = tree({
|
|
362
|
+
...FOO,
|
|
363
|
+
'index.d.ts': `${FOO['index.d.ts']}export {parseFoo} from './foo/parse.mjs';\nexport type {Shape} from './foo/shape.mjs';\n`,
|
|
364
|
+
'foo/parse.mjs': `import * as fs from 'node:fs';\nfs.writeFileSync(${JSON.stringify(marker)}, 'ran');\nexport const parseFoo = x => x;\n`,
|
|
365
|
+
'foo/shape.mjs': `import * as fs from 'node:fs';\nfs.writeFileSync(${JSON.stringify(marker)}, 'ran');\n`,
|
|
366
|
+
});
|
|
367
|
+
const before = listTree(root);
|
|
368
|
+
await auditAuthoringSurface({root, sources: ['foo/foo.doc.mjs']});
|
|
369
|
+
expect(fs.existsSync(marker)).toBe(false);
|
|
370
|
+
expect(listTree(root)).toEqual(before);
|
|
371
|
+
});
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Every file under `root` with its contents, to prove a read left it alone.
|
|
376
|
+
* @param {string} root
|
|
377
|
+
* @returns {Record<string, string>}
|
|
378
|
+
*/
|
|
379
|
+
function listTree(root) {
|
|
380
|
+
/** @type {Record<string, string>} */
|
|
381
|
+
const out = {};
|
|
382
|
+
/** @param {string} dir */
|
|
383
|
+
const walk = dir => {
|
|
384
|
+
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
|
|
385
|
+
const full = path.join(dir, entry.name);
|
|
386
|
+
if (entry.isDirectory()) walk(full);
|
|
387
|
+
else out[path.relative(root, full)] = fs.readFileSync(full, 'utf8');
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
walk(root);
|
|
391
|
+
return out;
|
|
392
|
+
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every `*.doc.mjs` under the CLI's doc directories, relative to `root` and
|
|
6
|
+
* sorted. Fixture, test, and dependency directories are skipped.
|
|
7
|
+
* @param {string} [root]
|
|
8
|
+
* @returns {string[]}
|
|
9
|
+
*/
|
|
10
|
+
export function discoverCliSelfDocSources(root?: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Read each doc through the compiler and keep the kinds that declare a
|
|
13
|
+
* namespace. One that fails is reported, never thrown, so one bad file cannot
|
|
14
|
+
* take the rest of the topic down with it.
|
|
15
|
+
* @param {string[]} [sources]
|
|
16
|
+
* @param {string} [root]
|
|
17
|
+
* @returns {Promise<{loaded: {source: string, doc: any}[], failed: {source: string, error: string}[]}>}
|
|
18
|
+
*/
|
|
19
|
+
export function loadCliSelfDocs(sources?: string[], root?: string): Promise<{
|
|
20
|
+
loaded: {
|
|
21
|
+
source: string;
|
|
22
|
+
doc: any;
|
|
23
|
+
}[];
|
|
24
|
+
failed: {
|
|
25
|
+
source: string;
|
|
26
|
+
error: string;
|
|
27
|
+
}[];
|
|
28
|
+
}>;
|
|
29
|
+
/**
|
|
30
|
+
* What cross-links need: the loaded function docs by name, the command names,
|
|
31
|
+
* and the route the docs tree gave a doc, if it gave one.
|
|
32
|
+
* @typedef {object} CliDocIndex
|
|
33
|
+
* @property {Map<string, any>} functions
|
|
34
|
+
* @property {Set<string>} commands
|
|
35
|
+
* @property {(kind: string, name: string) => string | null} route
|
|
36
|
+
*/
|
|
37
|
+
/**
|
|
38
|
+
* @param {any[]} docs every loaded CLI typed doc
|
|
39
|
+
* @param {(kind: string, name: string) => string | null} [route]
|
|
40
|
+
* @returns {CliDocIndex}
|
|
41
|
+
*/
|
|
42
|
+
export function cliDocIndex(docs: any[], route?: (kind: string, name: string) => string | null): CliDocIndex;
|
|
43
|
+
/**
|
|
44
|
+
* What `astryx docs <route>` prints for one CLI typed doc: its title and the
|
|
45
|
+
* blocks of its content, with cross-links to the routes the tree gave.
|
|
46
|
+
* @param {any} doc
|
|
47
|
+
* @param {CliDocIndex} index
|
|
48
|
+
* @returns {{id: string, title: string, content: any[]}}
|
|
49
|
+
*/
|
|
50
|
+
export function cliDocSection(doc: any, index: CliDocIndex): {
|
|
51
|
+
id: string;
|
|
52
|
+
title: string;
|
|
53
|
+
content: any[];
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* What stands between a CLI doc and a reader: a missing namespace, one nothing
|
|
57
|
+
* reads, one that disagrees with the authoring topic's list, a doc that fails
|
|
58
|
+
* to load, and a tree leaf too large for one read. Whether the tree gives
|
|
59
|
+
* every `cli/...` doc a route is the docs-tree check's job.
|
|
60
|
+
* @param {{root?: string, sources?: string[], budget?: number, authoringSources?: string[]}} [options]
|
|
61
|
+
* @returns {Promise<{
|
|
62
|
+
* docs: number,
|
|
63
|
+
* tree: number,
|
|
64
|
+
* authoring: number,
|
|
65
|
+
* missing: string[],
|
|
66
|
+
* unknown: {source: string, namespace: string}[],
|
|
67
|
+
* misfiled: {source: string, message: string}[],
|
|
68
|
+
* failed: {source: string, error: string}[],
|
|
69
|
+
* oversized: {key: string, title: string, bytes: number}[],
|
|
70
|
+
* }>}
|
|
71
|
+
*/
|
|
72
|
+
export function auditCliSelfDocs({ root, sources, budget, authoringSources, }?: {
|
|
73
|
+
root?: string;
|
|
74
|
+
sources?: string[];
|
|
75
|
+
budget?: number;
|
|
76
|
+
authoringSources?: string[];
|
|
77
|
+
}): Promise<{
|
|
78
|
+
docs: number;
|
|
79
|
+
tree: number;
|
|
80
|
+
authoring: number;
|
|
81
|
+
missing: string[];
|
|
82
|
+
unknown: {
|
|
83
|
+
source: string;
|
|
84
|
+
namespace: string;
|
|
85
|
+
}[];
|
|
86
|
+
misfiled: {
|
|
87
|
+
source: string;
|
|
88
|
+
message: string;
|
|
89
|
+
}[];
|
|
90
|
+
failed: {
|
|
91
|
+
source: string;
|
|
92
|
+
error: string;
|
|
93
|
+
}[];
|
|
94
|
+
oversized: {
|
|
95
|
+
key: string;
|
|
96
|
+
title: string;
|
|
97
|
+
bytes: number;
|
|
98
|
+
}[];
|
|
99
|
+
}>;
|
|
100
|
+
/** The directories, relative to the CLI root, that hold the CLI's own docs. */
|
|
101
|
+
export const CLI_SELF_DOC_DIRS: string[];
|
|
102
|
+
/**
|
|
103
|
+
* Every namespace a CLI doc may declare, and what reads it. The docs tree
|
|
104
|
+
* adopts `cli/commands` (under `cli/commands`) and `cli/api` (under
|
|
105
|
+
* `cli/api/<kind>s`); `astryx docs authoring` reads `authoring` from its list.
|
|
106
|
+
* @type {Record<string, {reader: 'tree' | 'authoring'}>}
|
|
107
|
+
*/
|
|
108
|
+
export const CLI_DOC_NAMESPACES: Record<string, {
|
|
109
|
+
reader: "tree" | "authoring";
|
|
110
|
+
}>;
|
|
111
|
+
/**
|
|
112
|
+
* What cross-links need: the loaded function docs by name, the command names,
|
|
113
|
+
* and the route the docs tree gave a doc, if it gave one.
|
|
114
|
+
*/
|
|
115
|
+
export type CliDocIndex = {
|
|
116
|
+
functions: Map<string, any>;
|
|
117
|
+
commands: Set<string>;
|
|
118
|
+
route: (kind: string, name: string) => string | null;
|
|
119
|
+
};
|