@astryxdesign/cli 0.6.6 → 0.6.7-canary.13feb39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +129 -0
- package/README.md +84 -82
- package/api/build/_adapter.d.mts +20 -0
- package/api/build/_adapter.mjs +24 -0
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.test.mjs +1 -1
- package/api/build/build.type.d.mts +12 -0
- package/api/build/build.type.mjs +3 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +13 -1
- package/api/component/_adapter.d.mts +19 -0
- package/api/component/_adapter.mjs +33 -0
- package/api/component/component-replacement.test.mjs +615 -0
- package/api/component/component.doc.mjs +5 -2
- package/api/component/component.mjs +49 -15
- package/api/component/component.test.mjs +32 -0
- package/api/component/component.type.d.mts +33 -3
- package/api/component/component.type.mjs +10 -3
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +5 -2
- package/api/component/detail/detail.mjs +5 -1
- package/api/component/detail/props/props.d.mts +2 -1
- package/api/component/detail/props/props.mjs +3 -2
- package/api/component/detail/showcase/showcase.d.mts +3 -1
- package/api/component/detail/showcase/showcase.mjs +3 -1
- package/api/component/detail/source/source.d.mts +3 -2
- package/api/component/detail/source/source.mjs +7 -3
- package/api/component/list/list.mjs +128 -10
- package/api/docs/_adapter.d.mts +11 -0
- package/api/docs/_adapter.mjs +73 -1
- package/api/docs/compiled-topics.test.mjs +1 -1
- package/api/docs/detail/detail.mjs +19 -3
- package/api/docs/detail/section/section.d.mts +44 -0
- package/api/docs/detail/section/section.mjs +171 -14
- package/api/docs/detail/section/section.test.mjs +4 -4
- package/api/docs/docOverlays.test.mjs +52 -23
- package/api/docs/docs.depth.test.mjs +2 -0
- package/api/docs/docs.doc.mjs +3 -3
- package/api/docs/docs.mjs +13 -16
- package/api/docs/docs.test.mjs +9 -10
- package/api/docs/docs.type.d.mts +43 -3
- package/api/docs/docs.type.mjs +23 -3
- package/api/docs/index/index.mjs +11 -2
- package/api/docs/index/index.test.mjs +7 -2
- package/api/docs/integration-tree.test.mjs +26 -26
- package/api/docs/integrationDocs.test.mjs +8 -7
- package/api/docs/namespace-section.test.mjs +260 -0
- package/api/docs/node/node.mjs +3 -0
- package/api/docs/token-tables.test.mjs +93 -0
- package/api/doctor/_adapter.d.mts +50 -0
- package/api/doctor/_adapter.mjs +190 -0
- package/api/doctor/doctor.d.mts +6 -10
- package/api/doctor/doctor.doc.mjs +1 -3
- package/api/doctor/doctor.mjs +144 -150
- package/api/doctor/doctor.test.mjs +104 -0
- package/api/doctor/theme-checks.d.mts +24 -0
- package/api/doctor/theme-checks.mjs +1231 -0
- package/api/doctor/theme-checks.test.mjs +667 -0
- package/api/gap-report/gap-report.doc.mjs +2 -1
- package/api/gap-report/gap-report.mjs +15 -1
- package/api/hook/_adapter.d.mts +1 -0
- package/api/hook/_adapter.mjs +3 -0
- package/api/hook/detail/detail.mjs +2 -2
- package/api/hook/detail/params/params.mjs +2 -2
- package/api/hook/hook.type.d.mts +12 -0
- package/api/hook/hook.type.mjs +3 -0
- package/api/hook/list/list.mjs +8 -8
- package/api/index.d.mts +1 -1
- package/api/index.mjs +4 -0
- package/api/init/run/run.d.mts +3 -5
- package/api/init/run/run.mjs +11 -11
- package/api/integration/__fixtures__/released-0.6.5-ocean.d.mts +14 -0
- package/api/integration/__fixtures__/released-0.6.5-ocean.mjs +15 -0
- package/api/integration/add-helpers.d.mts +26 -5
- package/api/integration/add-helpers.mjs +50 -5
- package/api/integration/add-theme.mjs +16 -2
- package/api/integration/add-theme.test.mjs +66 -15
- package/api/integration/authoring-checks.mjs +21 -1
- package/api/integration/integrationComponentConflicts.doc.mjs +6 -3
- package/api/integration/pack-check.component-replaces.test.mjs +126 -0
- package/api/integration/pack-check.d.mts +10 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +21 -2
- package/api/integration/pack-check.mjs +485 -3
- package/api/integration/pack-check.test.mjs +578 -10
- package/api/integration/validate-integration.mjs +20 -4
- package/api/integration/validate-integration.test.mjs +73 -0
- package/api/layout/check/check.d.mts +1 -0
- package/api/layout/check/check.mjs +1 -0
- package/api/layout/expand/expand.d.mts +1 -0
- package/api/layout/expand/expand.mjs +1 -0
- package/api/layout/grammar/grammar.d.mts +1 -0
- package/api/layout/grammar/grammar.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -1
- package/api/search/search.d.mts +47 -3
- package/api/search/search.doc.mjs +1 -1
- package/api/search/search.domain-priority.test.mjs +261 -0
- package/api/search/search.mjs +247 -43
- package/api/search/search.test.mjs +5 -1
- package/api/search/search.type.d.mts +3 -3
- package/api/search/search.type.mjs +2 -2
- package/api/swizzle/_adapter.d.mts +10 -0
- package/api/swizzle/_adapter.mjs +23 -0
- package/api/swizzle/copy/copy.d.mts +5 -6
- package/api/swizzle/copy/copy.mjs +29 -10
- package/api/swizzle/list/list.mjs +2 -2
- package/api/swizzle/swizzle.doc.mjs +5 -2
- package/api/swizzle/swizzle.test.mjs +55 -5
- package/api/swizzle/swizzle.type.d.mts +8 -0
- package/api/swizzle/swizzle.type.mjs +2 -0
- package/api/template/copy/copy.mjs +14 -1
- package/api/template/show/show.mjs +2 -0
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +15 -0
- package/api/template/template.type.mjs +6 -0
- package/api/theme/_adapter.d.mts +106 -6
- package/api/theme/_adapter.mjs +687 -18
- package/api/theme/add/add.binary.test.mjs +76 -3
- package/api/theme/add/add.d.mts +5 -9
- package/api/theme/add/add.mjs +87 -64
- package/api/theme/add/add.rollback.test.mjs +9 -9
- package/api/theme/add/add.staging.test.mjs +9 -9
- package/api/theme/add/add.test.mjs +461 -55
- package/api/theme/add/add.types.test.mjs +151 -0
- package/api/theme/build/build.d.mts +96 -2
- package/api/theme/build/build.family.test.mjs +13 -4
- package/api/theme/build/build.mjs +286 -118
- package/api/theme/build/build.test.mjs +30 -0
- package/api/theme/build/font-warning.d.mts +11 -0
- package/api/theme/build/font-warning.mjs +28 -3
- package/api/theme/eject/eject.binary.test.mjs +90 -0
- package/api/theme/eject/eject.d.mts +17 -0
- package/api/theme/eject/eject.mjs +65 -0
- package/api/theme/eject/eject.rollback.test.mjs +158 -0
- package/api/theme/eject/eject.staging.test.mjs +83 -0
- package/api/theme/eject/eject.test.mjs +160 -0
- package/api/theme/integration-themes.test.mjs +30 -6
- package/api/theme/list/list.d.mts +10 -0
- package/api/theme/list/list.mjs +75 -7
- package/api/theme/list/list.test.mjs +155 -4
- package/api/theme/remove/remove.d.mts +12 -0
- package/api/theme/remove/remove.mjs +15 -0
- package/api/theme/remove/remove.test.mjs +94 -0
- package/api/theme/template/template.mjs +3 -4
- package/api/theme/theme.d.mts +5 -2
- package/api/theme/theme.mjs +13 -8
- package/api/theme/theme.type.d.mts +106 -2
- package/api/theme/theme.type.mjs +54 -5
- package/api/theme/themeAdd.doc.d.mts +1 -3
- package/api/theme/themeAdd.doc.mjs +35 -22
- package/api/theme/themeBuild.doc.mjs +1 -1
- package/api/theme/themeEject.doc.d.mts +8 -0
- package/api/theme/themeEject.doc.mjs +89 -0
- package/api/theme/themeListAvailable.doc.mjs +4 -4
- package/api/theme/themeListCopySources.doc.d.mts +8 -0
- package/api/theme/themeListCopySources.doc.mjs +60 -0
- package/api/theme/themeRemove.doc.d.mts +6 -0
- package/api/theme/themeRemove.doc.mjs +50 -0
- package/api/theme/themeTemplate.doc.mjs +4 -3
- package/api/theme/themeUse.doc.d.mts +6 -0
- package/api/theme/themeUse.doc.mjs +47 -0
- package/api/theme/use/use.d.mts +12 -0
- package/api/theme/use/use.mjs +15 -0
- package/api/theme/use/use.test.mjs +98 -0
- package/api/upgrade/_adapter.d.mts +1 -0
- package/api/upgrade/_adapter.mjs +3 -0
- package/api/upgrade/list/list.mjs +9 -3
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/integration-discovery.mjs +1 -1
- package/assets/codemods/integration-discovery.test.mjs +64 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/transforms/v0.6.7/__tests__/migrate-copied-themes-to-descriptors.test.mjs +129 -0
- package/assets/codemods/transforms/v0.6.7/index.mjs +23 -0
- package/assets/codemods/transforms/v0.6.7/migrate-copied-themes-to-descriptors.mjs +54 -0
- package/assets/docs/author-a-theme.doc.mjs +166 -0
- package/assets/docs/getting-started.doc.mjs +61 -17
- package/assets/docs/principles.doc.dense.mjs +4 -4
- package/assets/docs/principles.doc.mjs +6 -6
- package/assets/docs/principles.doc.zh.mjs +4 -4
- package/assets/docs/styling-overview.doc.mjs +211 -0
- package/assets/docs/theme.doc.dense.mjs +11 -197
- package/assets/docs/theme.doc.mjs +16 -764
- package/assets/docs/theme.doc.zh.mjs +31 -12
- package/assets/docs/tree/add-a-theme.doc.mjs +2 -2
- package/assets/docs/tree/checks.doc.mjs +6 -5
- package/assets/docs/tree/component-migration.doc.mjs +107 -0
- package/assets/docs/tree/css-and-stylex.doc.mjs +150 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +4 -4
- package/assets/docs/tree/font-setup.doc.mjs +122 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +25 -20
- package/assets/docs/tree/headers-and-footers.doc.mjs +67 -0
- package/assets/docs/tree/i18n-library-integration.doc.mjs +167 -0
- package/assets/docs/tree/i18n-quick-start.doc.mjs +101 -0
- package/assets/docs/{internationalization.doc.mjs → tree/i18n-rtl-and-testing.doc.mjs} +17 -223
- package/assets/docs/tree/internationalization.doc.mjs +29 -0
- package/assets/docs/tree/layout-spacing.doc.mjs +168 -0
- package/assets/docs/tree/layout.doc.mjs +55 -0
- package/assets/docs/{migration.doc.mjs → tree/migration-setup.doc.mjs} +24 -129
- package/assets/docs/tree/migration-verification.doc.mjs +67 -0
- package/assets/docs/tree/migration.doc.mjs +28 -0
- package/assets/docs/tree/non-css-processing.doc.mjs +112 -0
- package/assets/docs/tree/other-libraries.doc.mjs +218 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +21 -4
- package/assets/docs/tree/replace-a-core-template.doc.mjs +1 -1
- package/assets/docs/tree/responsive.doc.mjs +98 -0
- package/assets/docs/tree/scaffold.doc.mjs +140 -0
- package/assets/docs/tree/side-panels.doc.mjs +81 -0
- package/assets/docs/tree/structure.doc.mjs +140 -0
- package/assets/docs/tree/styling-advanced.doc.mjs +159 -0
- package/assets/docs/tree/styling-basics.doc.mjs +181 -0
- package/assets/docs/tree/styling-libraries.doc.mjs +30 -0
- package/assets/docs/tree/styling.doc.mjs +29 -0
- package/assets/docs/tree/tailwind.doc.mjs +65 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/themes.doc.mjs +2 -2
- package/assets/docs/tree/tokens-and-setup.doc.mjs +128 -0
- package/assets/docs/tree/tokens-border.doc.mjs +46 -0
- package/assets/docs/tree/tokens-color.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-color.doc.mjs +438 -0
- package/assets/docs/tree/tokens-color.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-data.doc.mjs +323 -0
- package/assets/docs/tree/tokens-duration.doc.mjs +78 -0
- package/assets/docs/tree/tokens-ease.doc.mjs +46 -0
- package/assets/docs/tree/tokens-focus.doc.mjs +57 -0
- package/assets/docs/tree/tokens-font-weight.doc.mjs +58 -0
- package/assets/docs/tree/tokens-radius.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-radius.doc.mjs +70 -0
- package/assets/docs/tree/tokens-radius.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-shadow.doc.mjs +74 -0
- package/assets/docs/tree/tokens-shadow.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-size.doc.mjs +54 -0
- package/assets/docs/tree/tokens-size.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-spacing.doc.mjs +102 -0
- package/assets/docs/tree/tokens-spacing.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens-syntax.doc.mjs +98 -0
- package/assets/docs/tree/tokens-text-size.doc.mjs +90 -0
- package/assets/docs/tree/tokens-type-scale.doc.mjs +210 -0
- package/assets/docs/tree/tokens-typography.doc.mjs +54 -0
- package/assets/docs/tree/tokens-usage.doc.dense.mjs +10 -0
- package/assets/docs/tree/tokens-usage.doc.mjs +36 -0
- package/assets/docs/tree/tokens-usage.doc.zh.mjs +10 -0
- package/assets/docs/tree/tokens.doc.mjs +28 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +7 -3
- package/assets/docs/tree/type-scale.doc.mjs +147 -0
- package/assets/docs/tree/typography-best-practices.doc.mjs +55 -0
- package/assets/docs/tree/typography.doc.mjs +29 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +22 -5
- package/assets/docs/tree/versioning.doc.mjs +6 -3
- package/assets/docs/use-a-theme.doc.mjs +212 -0
- package/assets/templates/pages/incident-console/page.tsx +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1474 -0
- package/assets/templates/pages/table-collapsible/template.doc.mjs +12 -0
- package/assets/templates/pages/table-comparison/page.tsx +1449 -0
- package/assets/templates/pages/table-comparison/template.doc.mjs +12 -0
- package/assets/theme.template.ts +28 -11
- package/authoring/doctypes/command/command.doc.mjs +5 -0
- package/authoring/doctypes/command/type.ts +2 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -4
- package/authoring/doctypes/template/template.doc.mjs +2 -2
- package/authoring/doctypes/template/type.ts +5 -3
- package/authoring/integration/integration.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +3 -3
- package/clients/cli/commands/build-theme.adaptations.test.mjs +1 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +11 -1
- package/clients/cli/commands/build-theme.batch-report.test.mjs +335 -0
- package/clients/cli/commands/build-theme.font-warning.test.mjs +36 -7
- package/clients/cli/commands/build-theme.import-path.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +338 -45
- package/clients/cli/commands/build-theme.watch.test.mjs +33 -0
- package/clients/cli/commands/build.mjs +8 -6
- package/clients/cli/commands/build.text-fields.test.mjs +1 -1
- package/clients/cli/commands/component/index.mjs +91 -12
- package/clients/cli/commands/component-replacement.text.test.mjs +316 -0
- package/clients/cli/commands/component.doc.mjs +9 -2
- package/clients/cli/commands/docs.doc.mjs +2 -1
- package/clients/cli/commands/docs.mjs +63 -23
- package/clients/cli/commands/docs.test.mjs +17 -15
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -4
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.test.mjs +59 -52
- package/clients/cli/commands/gap-report.doc.mjs +2 -2
- package/clients/cli/commands/hook/index.mjs +7 -2
- package/clients/cli/commands/import-hint-correctness.test.mjs +28 -5
- package/clients/cli/commands/init.next-steps.test.mjs +18 -23
- package/clients/cli/commands/integration-real-world.test.mjs +61 -12
- package/clients/cli/commands/layout-check.doc.mjs +2 -0
- package/clients/cli/commands/layout-expand.doc.mjs +2 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +2 -0
- package/clients/cli/commands/layout.deprecation-lifecycle.test.mjs +140 -0
- package/clients/cli/commands/layout.doc.mjs +2 -0
- package/clients/cli/commands/layout.mjs +40 -4
- package/clients/cli/commands/no-prompt-wording.test.mjs +4 -4
- package/clients/cli/commands/search.test.mjs +10 -4
- package/clients/cli/commands/swizzle.doc.mjs +12 -3
- package/clients/cli/commands/swizzle.mjs +2 -1
- package/clients/cli/commands/swizzle.routing.test.mjs +2 -1
- package/clients/cli/commands/template.mjs +56 -5
- package/clients/cli/commands/text-json-parity.test.mjs +40 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +135 -0
- package/clients/cli/commands/theme-add.doc.mjs +19 -19
- package/clients/cli/commands/theme-build.doc.mjs +3 -1
- package/clients/cli/commands/theme-eject.doc.mjs +47 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +5 -2
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -2
- package/clients/cli/commands/theme-remove.doc.mjs +22 -0
- package/clients/cli/commands/theme-template.doc.mjs +4 -3
- package/clients/cli/commands/theme-use.doc.mjs +22 -0
- package/clients/cli/commands/theme.doc.mjs +21 -16
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.mjs +1 -1
- package/clients/cli/index.mjs +5 -2
- package/clients/cli/lib/component-format.mjs +29 -2
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +4 -0
- package/clients/cli/lib/resolve-theme.mjs +80 -78
- package/clients/cli/lib/resolve-theme.test.mjs +523 -27
- package/foundation/agent-docs/agent-docs.mjs +48 -30
- package/foundation/agent-docs/agent-docs.test.mjs +47 -34
- package/foundation/agent-docs/app-theme-workflow.test.mjs +13 -0
- package/foundation/config/project.d.mts +20 -5
- package/foundation/config/project.mjs +43 -6
- package/foundation/config/project.test.mjs +1 -1
- package/foundation/config/theme-private-vars.d.mts +12 -0
- package/foundation/config/theme-private-vars.mjs +107 -0
- package/foundation/config/theme-private-vars.test.mjs +55 -0
- package/foundation/config/theme-state.d.mts +145 -0
- package/foundation/config/theme-state.mjs +417 -0
- package/foundation/config/theme-state.test.mjs +182 -0
- package/foundation/discovery/component-discovery.d.mts +5 -2
- package/foundation/discovery/component-discovery.mjs +12 -6
- package/foundation/discovery/component-replacement.d.mts +91 -0
- package/foundation/discovery/component-replacement.mjs +417 -0
- package/foundation/discovery/component-replacement.test.mjs +480 -0
- package/foundation/discovery/docs-discovery.test.mjs +1 -1
- package/foundation/discovery/docs-output-budget.d.mts +6 -2
- package/foundation/discovery/docs-output-budget.mjs +2 -1
- package/foundation/discovery/docs-section-key.d.mts +4 -2
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/module-exports.d.mts +10 -0
- package/foundation/discovery/module-exports.mjs +146 -0
- package/foundation/discovery/package-exports.d.mts +29 -0
- package/foundation/discovery/package-exports.mjs +200 -0
- package/foundation/discovery/template-needs.d.mts +31 -0
- package/foundation/discovery/template-needs.mjs +156 -0
- package/foundation/discovery/template-needs.test.mjs +203 -0
- package/foundation/discovery/theme-discovery.d.mts +72 -5
- package/foundation/discovery/theme-discovery.mjs +134 -18
- package/foundation/discovery/theme-discovery.test.mjs +9 -3
- package/foundation/discovery/theme-imports.d.mts +15 -0
- package/foundation/discovery/theme-imports.mjs +217 -0
- package/foundation/discovery/theme-imports.test.mjs +173 -0
- package/foundation/doc-compiler/bundle.mjs +52 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +15 -5
- package/foundation/doc-compiler/inputs.mjs +2 -1
- package/foundation/doc-compiler/lenses.d.mts +4 -2
- package/foundation/doc-compiler/lenses.mjs +1 -1
- package/foundation/doc-compiler/split-topic-keywords.test.mjs +73 -0
- package/foundation/doc-compiler/tree.d.mts +10 -0
- package/foundation/doc-compiler/tree.mjs +22 -0
- package/foundation/doc-compiler/tree.test.mjs +3 -2
- package/foundation/env/package-manager.d.mts +31 -8
- package/foundation/env/package-manager.mjs +120 -13
- package/foundation/env/package-manager.test.mjs +174 -1
- package/foundation/fs/module-loader.d.mts +9 -0
- package/foundation/fs/module-loader.mjs +71 -2
- package/foundation/integrations/cli-requirement.d.mts +43 -10
- package/foundation/integrations/cli-requirement.mjs +56 -13
- package/foundation/integrations/cli-requirement.test.mjs +160 -23
- package/foundation/integrations/contribution-inventory.mjs +3 -3
- package/foundation/integrations/validate-contributions.d.mts +16 -0
- package/foundation/integrations/validate-contributions.mjs +56 -8
- package/foundation/response/base.d.ts +9 -3
- package/foundation/response/json.d.mts +7 -4
- package/foundation/response/json.mjs +10 -6
- package/foundation/response/response-types.doc.mjs +41 -26
- package/foundation/response/response.doc.mjs +18 -4
- package/foundation/text/copyright-header.mjs +1 -1
- package/foundation/text/copyright-header.test.mjs +1 -1
- package/package.json +9 -9
- package/assets/docs/layout.doc.dense.mjs +0 -388
- package/assets/docs/layout.doc.mjs +0 -550
- package/assets/docs/styling-libraries.doc.mjs +0 -469
- package/assets/docs/styling.doc.mjs +0 -412
- package/assets/docs/tokens.doc.dense.mjs +0 -15
- package/assets/docs/tokens.doc.mjs +0 -1491
- package/assets/docs/tokens.doc.zh.mjs +0 -15
- package/assets/docs/typography.doc.mjs +0 -286
package/api/doctor/doctor.mjs
CHANGED
|
@@ -24,6 +24,7 @@ import * as fs from 'node:fs';
|
|
|
24
24
|
import * as path from 'node:path';
|
|
25
25
|
|
|
26
26
|
import {MIN_NODE_VERSION, isNodeVersionSupported} from '../../foundation/env/node-version.mjs';
|
|
27
|
+
import {AGENT_DOC_PATHS} from '../../foundation/agent-docs/agent-doc-state.mjs';
|
|
27
28
|
import {CLI_ROOT, findCoreDir, findInstalledPackage} from '../../foundation/fs/paths.mjs';
|
|
28
29
|
import {explainPackageManager, getCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
29
30
|
import {
|
|
@@ -50,6 +51,7 @@ import {
|
|
|
50
51
|
import {typedEdges} from '../docs/node/node.mjs';
|
|
51
52
|
import {detailView, indexView} from '../../foundation/doc-compiler/lenses.mjs';
|
|
52
53
|
import {semverCompare, isValidSemver, satisfiesRange} from '../../foundation/env/semver.mjs';
|
|
54
|
+
import {checkAppThemes, checkThemes} from './theme-checks.mjs';
|
|
53
55
|
|
|
54
56
|
/**
|
|
55
57
|
* @typedef {'pass'|'warn'|'fail'|'info'} DoctorStatus
|
|
@@ -70,7 +72,6 @@ import {semverCompare, isValidSemver, satisfiesRange} from '../../foundation/env
|
|
|
70
72
|
* @property {string} nodeVersion - Running Node version.
|
|
71
73
|
* @property {string|null} coreDir - Resolved core package directory, or null.
|
|
72
74
|
* @property {string|null} configPath - Resolved astryx.config.mjs path, or null.
|
|
73
|
-
* @property {string|null} configTheme - theme value read from config, or null.
|
|
74
75
|
* @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]|null} [integrations]
|
|
75
76
|
* Every integration the project loaded, or null when the project could not be
|
|
76
77
|
* read at all.
|
|
@@ -85,6 +86,9 @@ import {semverCompare, isValidSemver, satisfiesRange} from '../../foundation/env
|
|
|
85
86
|
* Combined project-level integration issues, including cross-package template replacement warnings.
|
|
86
87
|
* @property {Error|null} [configError] - Error thrown while resolving the config
|
|
87
88
|
* path (e.g. multiple config files present), surfaced by checkConfig as a FAIL.
|
|
89
|
+
* @property {string|null} [projectError] - Why the CLI could not load the
|
|
90
|
+
* project from its config, when it could not. Checks that need the loaded
|
|
91
|
+
* project quote it when they skip, so a skip says what was found.
|
|
88
92
|
*/
|
|
89
93
|
|
|
90
94
|
/* ── helpers ──────────────────────────────────────────────────────────── */
|
|
@@ -114,74 +118,61 @@ function pkgVersion(dir) {
|
|
|
114
118
|
}
|
|
115
119
|
|
|
116
120
|
/**
|
|
117
|
-
*
|
|
118
|
-
* @param {string}
|
|
119
|
-
* @returns {string
|
|
121
|
+
* The first line of an error message, bounded for a one-line check message.
|
|
122
|
+
* @param {string} message
|
|
123
|
+
* @returns {string}
|
|
120
124
|
*/
|
|
121
|
-
function
|
|
122
|
-
|
|
123
|
-
for (let i = 0; i < 6; i++) {
|
|
124
|
-
const candidate = path.join(dir, 'node_modules');
|
|
125
|
-
if (fs.existsSync(candidate)) return candidate;
|
|
126
|
-
const parent = path.dirname(dir);
|
|
127
|
-
if (parent === dir) break;
|
|
128
|
-
dir = parent;
|
|
129
|
-
}
|
|
130
|
-
return null;
|
|
125
|
+
function firstLine(message) {
|
|
126
|
+
return String(message).split('\n')[0].slice(0, 300);
|
|
131
127
|
}
|
|
132
128
|
|
|
133
129
|
/**
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
130
|
+
* The message of a check that needs the loaded project and could not have it.
|
|
131
|
+
* It carries the reason the CLI gave, so the line says what Doctor found
|
|
132
|
+
* instead of only that it did not look.
|
|
133
|
+
* @param {DoctorContext} ctx
|
|
134
|
+
* @param {string} what
|
|
135
|
+
* @returns {string}
|
|
137
136
|
*/
|
|
138
|
-
function
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
if (!nm) return found;
|
|
143
|
-
const scopeDir = path.join(nm, '@astryxdesign');
|
|
144
|
-
if (!fs.existsSync(scopeDir)) return found;
|
|
145
|
-
let entries;
|
|
146
|
-
try {
|
|
147
|
-
entries = fs.readdirSync(scopeDir, {withFileTypes: true});
|
|
148
|
-
} catch {
|
|
149
|
-
return found;
|
|
150
|
-
}
|
|
151
|
-
for (const entry of entries) {
|
|
152
|
-
if (!entry.name.startsWith('theme-')) continue;
|
|
153
|
-
const dir = path.join(scopeDir, entry.name);
|
|
154
|
-
// pnpm installs packages as symlinks into node_modules/.pnpm, and a
|
|
155
|
-
// symlink dirent reports isDirectory() as false — stat the target instead.
|
|
156
|
-
let isDir = entry.isDirectory();
|
|
157
|
-
if (!isDir && entry.isSymbolicLink()) {
|
|
158
|
-
try {
|
|
159
|
-
isDir = fs.statSync(dir).isDirectory();
|
|
160
|
-
} catch {
|
|
161
|
-
isDir = false;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
if (!isDir) continue;
|
|
165
|
-
const name = `@astryxdesign/${entry.name}`;
|
|
166
|
-
found.push({name, version: pkgVersion(dir)});
|
|
167
|
-
}
|
|
168
|
-
return found;
|
|
137
|
+
function skippedBecause(ctx, what) {
|
|
138
|
+
return ctx.projectError
|
|
139
|
+
? `Skipped — ${what}: ${firstLine(ctx.projectError)}`
|
|
140
|
+
: `Skipped — ${what}.`;
|
|
169
141
|
}
|
|
170
142
|
|
|
143
|
+
/** Integrations one message names before it counts the rest. */
|
|
144
|
+
const NAMED_INTEGRATIONS = 10;
|
|
145
|
+
|
|
171
146
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* handled by the caller (ctx.configTheme). This only inspects static signals.
|
|
175
|
-
* @param {string} cwd
|
|
176
|
-
* @returns {{wired: boolean, source: string|null}}
|
|
147
|
+
* @param {Array<{name?: string, __spec?: string}>} integrations
|
|
148
|
+
* @returns {string}
|
|
177
149
|
*/
|
|
178
|
-
function
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
150
|
+
function nameIntegrations(integrations) {
|
|
151
|
+
const names = integrations.map(
|
|
152
|
+
integration => integration.name ?? integration.__spec ?? '(integration)',
|
|
153
|
+
);
|
|
154
|
+
return names.length <= NAMED_INTEGRATIONS
|
|
155
|
+
? names.join(', ')
|
|
156
|
+
: `${names.slice(0, NAMED_INTEGRATIONS).join(', ')} and ${names.length - NAMED_INTEGRATIONS} more`;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* The project's root: the folder of its config, else of the nearest
|
|
161
|
+
* package.json above the working directory (where the config is looked for),
|
|
162
|
+
* else the working directory.
|
|
163
|
+
* @param {DoctorContext} ctx
|
|
164
|
+
* @returns {string}
|
|
165
|
+
*/
|
|
166
|
+
function projectRootOf(ctx) {
|
|
167
|
+
if (ctx.configPath) return path.dirname(ctx.configPath);
|
|
168
|
+
let dir = ctx.cwd;
|
|
169
|
+
for (let i = 0; i < 50; i++) {
|
|
170
|
+
if (fs.existsSync(path.join(dir, 'package.json'))) return dir;
|
|
171
|
+
const parent = path.dirname(dir);
|
|
172
|
+
if (parent === dir) break;
|
|
173
|
+
dir = parent;
|
|
174
|
+
}
|
|
175
|
+
return ctx.cwd;
|
|
185
176
|
}
|
|
186
177
|
|
|
187
178
|
/* ── individual checks ────────────────────────────────────────────────── */
|
|
@@ -284,47 +275,6 @@ export function checkVersionAlignment(ctx) {
|
|
|
284
275
|
};
|
|
285
276
|
}
|
|
286
277
|
|
|
287
|
-
/**
|
|
288
|
-
* Check 4 — at least one @astryxdesign/theme-* is installed and a theme is wired.
|
|
289
|
-
* @param {DoctorContext} ctx
|
|
290
|
-
* @returns {DoctorCheck}
|
|
291
|
-
*/
|
|
292
|
-
export function checkThemes(ctx) {
|
|
293
|
-
const themes = findThemePackages(ctx.cwd);
|
|
294
|
-
const wiring = detectThemeWiring(ctx.cwd);
|
|
295
|
-
const hasConfigTheme = Boolean(ctx.configTheme);
|
|
296
|
-
const wired = wiring.wired || hasConfigTheme;
|
|
297
|
-
|
|
298
|
-
if (themes.length === 0) {
|
|
299
|
-
return {
|
|
300
|
-
id: 'themes',
|
|
301
|
-
label: 'Theme packages',
|
|
302
|
-
status: 'warn',
|
|
303
|
-
message: 'No @astryxdesign/theme-* packages are installed.',
|
|
304
|
-
fix: 'Install a theme, e.g. `npm install @astryxdesign/theme-neutral`, then import its CSS or set astryx.theme.',
|
|
305
|
-
};
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
const names = themes.map(t => t.name).join(', ');
|
|
309
|
-
if (!wired) {
|
|
310
|
-
return {
|
|
311
|
-
id: 'themes',
|
|
312
|
-
label: 'Theme packages',
|
|
313
|
-
status: 'warn',
|
|
314
|
-
message: `Theme package(s) installed (${names}) but no theme appears wired.`,
|
|
315
|
-
fix: 'Wire a theme via the `astryx.theme` field in package.json, the ASTRYX_THEME env var, or your astryx.config.mjs.',
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
|
|
319
|
-
const source = hasConfigTheme ? 'astryx.config.mjs theme' : wiring.source;
|
|
320
|
-
return {
|
|
321
|
-
id: 'themes',
|
|
322
|
-
label: 'Theme packages',
|
|
323
|
-
status: 'pass',
|
|
324
|
-
message: `Theme package(s) installed (${names}); wired via ${source}.`,
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
|
|
328
278
|
/**
|
|
329
279
|
* Check 5 — astryx.config.mjs (if present) loads and has a valid shape.
|
|
330
280
|
* @param {DoctorContext} ctx
|
|
@@ -367,6 +317,18 @@ export async function checkConfig(ctx) {
|
|
|
367
317
|
fix: 'Export a default object from astryx.config.mjs, e.g. `export default { integrations: [] };`.',
|
|
368
318
|
};
|
|
369
319
|
}
|
|
320
|
+
// Importing is not the whole test: the CLI also validates the config, and
|
|
321
|
+
// a config it rejects leaves every project-aware command without the
|
|
322
|
+
// project. That config is not clean, so this warns (exit code unchanged).
|
|
323
|
+
if (ctx.projectError) {
|
|
324
|
+
return {
|
|
325
|
+
id: 'config',
|
|
326
|
+
label: 'astryx.config.mjs',
|
|
327
|
+
status: 'warn',
|
|
328
|
+
message: `astryx.config.mjs loads, but the CLI could not load the project from it: ${firstLine(ctx.projectError)}`,
|
|
329
|
+
fix: 'Fix what the message names. `astryx docs authoring config` lists every field astryx.config accepts.',
|
|
330
|
+
};
|
|
331
|
+
}
|
|
370
332
|
return {
|
|
371
333
|
id: 'config',
|
|
372
334
|
label: 'astryx.config.mjs',
|
|
@@ -416,7 +378,7 @@ export function checkImplicitIntegrations(ctx) {
|
|
|
416
378
|
id,
|
|
417
379
|
label,
|
|
418
380
|
status: 'info',
|
|
419
|
-
message: '
|
|
381
|
+
message: skippedBecause(ctx, 'the project configuration could not be read'),
|
|
420
382
|
};
|
|
421
383
|
}
|
|
422
384
|
|
|
@@ -519,27 +481,30 @@ function describeUnreadableManifests(failures) {
|
|
|
519
481
|
* @returns {DoctorCheck}
|
|
520
482
|
*/
|
|
521
483
|
export function checkAgentDocs(ctx) {
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
484
|
+
// Every file init can write (one shared list), looked for in the working
|
|
485
|
+
// directory and in the project root: run from src/, the docs sit at the root.
|
|
486
|
+
const dirs = [...new Set([ctx.cwd, projectRootOf(ctx)])];
|
|
487
|
+
const present = dirs.flatMap(dir =>
|
|
488
|
+
AGENT_DOC_PATHS.map(rel => path.join(dir, rel)).filter(abs =>
|
|
489
|
+
fs.existsSync(abs),
|
|
490
|
+
),
|
|
491
|
+
);
|
|
492
|
+
/** @param {string} abs */
|
|
493
|
+
const shown = abs => path.relative(ctx.cwd, abs) || path.basename(abs);
|
|
529
494
|
|
|
530
495
|
if (present.length === 0) {
|
|
531
496
|
return {
|
|
532
497
|
id: 'agent-docs',
|
|
533
498
|
label: 'AI agent docs',
|
|
534
499
|
status: 'info',
|
|
535
|
-
message:
|
|
500
|
+
message: `No agent docs found: looked for ${AGENT_DOC_PATHS.join(', ')} in ${dirs.map(dir => path.relative(ctx.cwd, dir) || '.').join(' and ')}.`,
|
|
536
501
|
fix: `Generate agent docs with \`${getCliInvocation(ctx.cwd)} init --features agents\`.`,
|
|
537
502
|
};
|
|
538
503
|
}
|
|
539
504
|
|
|
540
|
-
const withMarkers = present.filter(
|
|
505
|
+
const withMarkers = present.filter(abs => {
|
|
541
506
|
try {
|
|
542
|
-
const content = fs.readFileSync(
|
|
507
|
+
const content = fs.readFileSync(abs, 'utf-8');
|
|
543
508
|
return (
|
|
544
509
|
(content.includes('<!-- ASTRYX:START -->') || content.includes('<!-- XDS:START -->')) &&
|
|
545
510
|
(content.includes('<!-- ASTRYX:END -->') || content.includes('<!-- XDS:END -->'))
|
|
@@ -554,7 +519,7 @@ export function checkAgentDocs(ctx) {
|
|
|
554
519
|
id: 'agent-docs',
|
|
555
520
|
label: 'AI agent docs',
|
|
556
521
|
status: 'warn',
|
|
557
|
-
message: `Agent docs present (${present.join(', ')}) but no Astryx section markers found.`,
|
|
522
|
+
message: `Agent docs present (${present.map(shown).join(', ')}) but no Astryx section markers found.`,
|
|
558
523
|
fix: `Add the Astryx section to your agent docs with \`${getCliInvocation(ctx.cwd)} init --features agents\`.`,
|
|
559
524
|
};
|
|
560
525
|
}
|
|
@@ -563,7 +528,7 @@ export function checkAgentDocs(ctx) {
|
|
|
563
528
|
id: 'agent-docs',
|
|
564
529
|
label: 'AI agent docs',
|
|
565
530
|
status: 'pass',
|
|
566
|
-
message: `Astryx agent docs section present in ${withMarkers.join(', ')}.`,
|
|
531
|
+
message: `Astryx agent docs section present in ${withMarkers.map(shown).join(', ')}.`,
|
|
567
532
|
};
|
|
568
533
|
}
|
|
569
534
|
|
|
@@ -658,15 +623,31 @@ export function checkIntegrationIssues(ctx) {
|
|
|
658
623
|
id: 'integration-issues',
|
|
659
624
|
label: 'Integration contributions',
|
|
660
625
|
status: 'info',
|
|
661
|
-
message:
|
|
626
|
+
message: skippedBecause(
|
|
627
|
+
ctx,
|
|
628
|
+
'the project integration graph could not be loaded',
|
|
629
|
+
),
|
|
662
630
|
};
|
|
663
631
|
}
|
|
664
632
|
if (issues.length === 0) {
|
|
633
|
+
// "No problems" is a finding only when something was looked at.
|
|
634
|
+
const checked = (ctx.integrations ?? []).filter(
|
|
635
|
+
integration => integration.__loadError == null,
|
|
636
|
+
);
|
|
637
|
+
if (checked.length === 0) {
|
|
638
|
+
return {
|
|
639
|
+
id: 'integration-issues',
|
|
640
|
+
label: 'Integration contributions',
|
|
641
|
+
status: 'info',
|
|
642
|
+
message:
|
|
643
|
+
'No integration is loaded, so there are no integration contributions to check.',
|
|
644
|
+
};
|
|
645
|
+
}
|
|
665
646
|
return {
|
|
666
647
|
id: 'integration-issues',
|
|
667
648
|
label: 'Integration contributions',
|
|
668
649
|
status: 'pass',
|
|
669
|
-
message: '
|
|
650
|
+
message: `${checked.length} loaded integration${checked.length === 1 ? '' : 's'} checked (${nameIntegrations(checked)}): contributions and cross-package relationships are valid.`,
|
|
670
651
|
};
|
|
671
652
|
}
|
|
672
653
|
const errors = issues.filter(issue => issue.severity === 'error').length;
|
|
@@ -763,7 +744,7 @@ export function checkProviderIdentity(ctx) {
|
|
|
763
744
|
id,
|
|
764
745
|
label,
|
|
765
746
|
status: 'info',
|
|
766
|
-
message: '
|
|
747
|
+
message: skippedBecause(ctx, 'the project configuration could not be read'),
|
|
767
748
|
};
|
|
768
749
|
}
|
|
769
750
|
|
|
@@ -1219,7 +1200,6 @@ export const SYNC_CHECKS = [
|
|
|
1219
1200
|
checkNodeVersion,
|
|
1220
1201
|
checkCoreInstalled,
|
|
1221
1202
|
checkVersionAlignment,
|
|
1222
|
-
checkThemes,
|
|
1223
1203
|
checkImplicitIntegrations,
|
|
1224
1204
|
checkProviderIdentity,
|
|
1225
1205
|
checkIntegrationIssues,
|
|
@@ -1249,9 +1229,7 @@ export async function runChecks(options = {}) {
|
|
|
1249
1229
|
configError = /** @type {Error} */ (err);
|
|
1250
1230
|
}
|
|
1251
1231
|
|
|
1252
|
-
// Resolve
|
|
1253
|
-
// actually loaded (best-effort; never throws).
|
|
1254
|
-
let configTheme = null;
|
|
1232
|
+
// Resolve integrations the project actually loaded (best-effort; never throws).
|
|
1255
1233
|
/** @type {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]|null} */
|
|
1256
1234
|
let integrations = null;
|
|
1257
1235
|
// A docs read falls back to the built-in topics when the project cannot be
|
|
@@ -1266,35 +1244,48 @@ export async function runChecks(options = {}) {
|
|
|
1266
1244
|
let integrationIssues = null;
|
|
1267
1245
|
/** @type {Array<{spec: string, error: string}>|null} */
|
|
1268
1246
|
let autolinkFailures = null;
|
|
1247
|
+
/** @type {string|null} */
|
|
1248
|
+
let projectError = null;
|
|
1249
|
+
/** @type {import('../../foundation/config/project.mjs').Project | null} */
|
|
1250
|
+
let project = null;
|
|
1269
1251
|
try {
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
//
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
entry =>
|
|
1279
|
-
entry.outcome === 'load-failed' &&
|
|
1280
|
-
entry.candidate.source === 'autolinked',
|
|
1281
|
-
)
|
|
1282
|
-
.map(entry => ({
|
|
1283
|
-
spec: entry.candidate.spec ?? entry.label,
|
|
1284
|
-
error: entry.error ?? 'its manifest could not be loaded',
|
|
1285
|
-
}));
|
|
1252
|
+
project = await Project.load(cwd);
|
|
1253
|
+
} catch (err) {
|
|
1254
|
+
// A project the CLI cannot load leaves the checks that need it
|
|
1255
|
+
// skipped. The reason is kept: those checks and the config
|
|
1256
|
+
// check quote it, so a skip is never silent.
|
|
1257
|
+
projectError = err instanceof Error ? err.message : String(err);
|
|
1258
|
+
}
|
|
1259
|
+
if (project) {
|
|
1286
1260
|
try {
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
)
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1261
|
+
integrations = project.loadedIntegrations;
|
|
1262
|
+
// An installed dependency whose manifest cannot be loaded is kept out of
|
|
1263
|
+
// loadedIntegrations on purpose. The provider ledger still records it.
|
|
1264
|
+
autolinkFailures = [...providerLedgerOf(project).values()]
|
|
1265
|
+
.filter(
|
|
1266
|
+
entry =>
|
|
1267
|
+
entry.outcome === 'load-failed' &&
|
|
1268
|
+
entry.candidate.source === 'autolinked',
|
|
1269
|
+
)
|
|
1270
|
+
.map(entry => ({
|
|
1271
|
+
spec: entry.candidate.spec ?? entry.label,
|
|
1272
|
+
error: entry.error ?? 'its manifest could not be loaded',
|
|
1273
|
+
}));
|
|
1274
|
+
try {
|
|
1275
|
+
docsCatalog = await project.docs();
|
|
1276
|
+
docsCatalogIssues = (await project.issues()).filter(
|
|
1277
|
+
issue => issue.code === 'invalid_doc',
|
|
1278
|
+
);
|
|
1279
|
+
} catch (err) {
|
|
1280
|
+
docsCatalog = null;
|
|
1281
|
+
docsCatalogError = err instanceof Error ? err.message : String(err);
|
|
1282
|
+
}
|
|
1283
|
+
integrationIssues = await project.issues();
|
|
1284
|
+
} catch {
|
|
1285
|
+
// Best-effort: once the project has loaded, a later read that throws
|
|
1286
|
+
// leaves the remaining fields at their defaults. It is no reason to
|
|
1287
|
+
// blame the config, so it never becomes projectError.
|
|
1294
1288
|
}
|
|
1295
|
-
integrationIssues = await project.issues();
|
|
1296
|
-
} catch {
|
|
1297
|
-
// Best-effort: a missing/invalid config leaves configTheme null.
|
|
1298
1289
|
}
|
|
1299
1290
|
|
|
1300
1291
|
/** @type {DoctorContext} */
|
|
@@ -1303,7 +1294,6 @@ export async function runChecks(options = {}) {
|
|
|
1303
1294
|
nodeVersion: process.versions.node,
|
|
1304
1295
|
coreDir,
|
|
1305
1296
|
configPath,
|
|
1306
|
-
configTheme,
|
|
1307
1297
|
integrations,
|
|
1308
1298
|
docsCatalog,
|
|
1309
1299
|
docsCatalogIssues,
|
|
@@ -1311,14 +1301,18 @@ export async function runChecks(options = {}) {
|
|
|
1311
1301
|
integrationIssues,
|
|
1312
1302
|
autolinkFailures,
|
|
1313
1303
|
configError,
|
|
1304
|
+
projectError,
|
|
1314
1305
|
};
|
|
1315
1306
|
|
|
1316
1307
|
/** @type {DoctorCheck[]} */
|
|
1317
1308
|
const checks = [];
|
|
1318
|
-
//
|
|
1309
|
+
// Run the theme checks and config check after the environment checks. The
|
|
1310
|
+
// released `themes` check keeps its place, ahead of the app-theme checks.
|
|
1319
1311
|
for (const fn of SYNC_CHECKS) {
|
|
1320
1312
|
checks.push(fn(ctx));
|
|
1321
|
-
if (fn ===
|
|
1313
|
+
if (fn === checkVersionAlignment) {
|
|
1314
|
+
const appThemeChecks = await checkAppThemes(cwd);
|
|
1315
|
+
checks.push(checkThemes(cwd, appThemeChecks), ...appThemeChecks);
|
|
1322
1316
|
checks.push(await checkConfig(ctx));
|
|
1323
1317
|
}
|
|
1324
1318
|
}
|
|
@@ -1018,3 +1018,107 @@ describe('doctor says what it could not check', () => {
|
|
|
1018
1018
|
expect(check.message).toContain('could not be read');
|
|
1019
1019
|
});
|
|
1020
1020
|
});
|
|
1021
|
+
|
|
1022
|
+
describe('doctor says why it skipped and what it checked', () => {
|
|
1023
|
+
const CORE_STUB = {
|
|
1024
|
+
'node_modules/@astryxdesign/core/package.json': JSON.stringify({
|
|
1025
|
+
name: '@astryxdesign/core',
|
|
1026
|
+
version: '0.6.3',
|
|
1027
|
+
}),
|
|
1028
|
+
};
|
|
1029
|
+
|
|
1030
|
+
/** A project under the working directory, so its config can be imported. */
|
|
1031
|
+
function cwdProject(files) {
|
|
1032
|
+
const dir = fs.mkdtempSync(
|
|
1033
|
+
path.join(process.cwd(), '.astryx-doctor-shape-'),
|
|
1034
|
+
);
|
|
1035
|
+
tmpDirs.push(dir);
|
|
1036
|
+
for (const [rel, content] of Object.entries(files)) {
|
|
1037
|
+
const abs = path.join(dir, rel);
|
|
1038
|
+
fs.mkdirSync(path.dirname(abs), {recursive: true});
|
|
1039
|
+
fs.writeFileSync(abs, content);
|
|
1040
|
+
}
|
|
1041
|
+
return dir;
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
it(
|
|
1045
|
+
'warns, and quotes the reason, when the CLI cannot load the project from a config that imports',
|
|
1046
|
+
async () => {
|
|
1047
|
+
const dir = cwdProject({
|
|
1048
|
+
'package.json': '{"name":"app"}',
|
|
1049
|
+
...CORE_STUB,
|
|
1050
|
+
'astryx.config.mjs': "export default { integrations: 'oops' };\n",
|
|
1051
|
+
});
|
|
1052
|
+
const {checks, summary} = (await doctor({cwd: dir})).data;
|
|
1053
|
+
const by = Object.fromEntries(checks.map(c => [c.id, c]));
|
|
1054
|
+
expect(by.config.status).toBe('warn');
|
|
1055
|
+
expect(by.config.message).toMatch(
|
|
1056
|
+
/^astryx\.config\.mjs loads, but the CLI could not load the project from it: .*integrations/,
|
|
1057
|
+
);
|
|
1058
|
+
expect(by.config.fix).toContain('astryx docs authoring config');
|
|
1059
|
+
for (const id of ['implicit-integrations', 'provider-identity']) {
|
|
1060
|
+
expect(by[id].message).toMatch(
|
|
1061
|
+
/^Skipped — the project configuration could not be read: .*integrations/,
|
|
1062
|
+
);
|
|
1063
|
+
}
|
|
1064
|
+
expect(by['integration-issues'].message).toMatch(
|
|
1065
|
+
/^Skipped — the project integration graph could not be loaded: .*integrations/,
|
|
1066
|
+
);
|
|
1067
|
+
// A warning: the exit code a released CLI gave this project is unchanged.
|
|
1068
|
+
expect(summary.fail).toBe(0);
|
|
1069
|
+
},
|
|
1070
|
+
SLOW,
|
|
1071
|
+
);
|
|
1072
|
+
|
|
1073
|
+
it(
|
|
1074
|
+
'passes the config check when the CLI loads the project from it',
|
|
1075
|
+
async () => {
|
|
1076
|
+
const dir = cwdProject({
|
|
1077
|
+
'package.json': '{"name":"app"}',
|
|
1078
|
+
...CORE_STUB,
|
|
1079
|
+
'astryx.config.mjs': 'export default { integrations: [] };\n',
|
|
1080
|
+
});
|
|
1081
|
+
const by = Object.fromEntries(
|
|
1082
|
+
(await doctor({cwd: dir})).data.checks.map(c => [c.id, c]),
|
|
1083
|
+
);
|
|
1084
|
+
expect(by.config.status).toBe('pass');
|
|
1085
|
+
expect(by['implicit-integrations'].message).not.toContain('Skipped');
|
|
1086
|
+
},
|
|
1087
|
+
SLOW,
|
|
1088
|
+
);
|
|
1089
|
+
|
|
1090
|
+
it('says there is nothing to check when no integration is loaded', () => {
|
|
1091
|
+
expect(
|
|
1092
|
+
checkIntegrationIssues({integrationIssues: [], integrations: []}),
|
|
1093
|
+
).toEqual({
|
|
1094
|
+
id: 'integration-issues',
|
|
1095
|
+
label: 'Integration contributions',
|
|
1096
|
+
status: 'info',
|
|
1097
|
+
message:
|
|
1098
|
+
'No integration is loaded, so there are no integration contributions to check.',
|
|
1099
|
+
});
|
|
1100
|
+
});
|
|
1101
|
+
|
|
1102
|
+
it('names what it checked when every loaded integration is clean', () => {
|
|
1103
|
+
expect(
|
|
1104
|
+
checkIntegrationIssues({
|
|
1105
|
+
integrationIssues: [],
|
|
1106
|
+
integrations: [{name: '@acme/widgets'}],
|
|
1107
|
+
}),
|
|
1108
|
+
).toMatchObject({
|
|
1109
|
+
status: 'pass',
|
|
1110
|
+
message:
|
|
1111
|
+
'1 loaded integration checked (@acme/widgets): contributions and cross-package relationships are valid.',
|
|
1112
|
+
});
|
|
1113
|
+
});
|
|
1114
|
+
|
|
1115
|
+
it('bounds the names it lists', () => {
|
|
1116
|
+
const integrations = Array.from({length: 12}, (_, i) => ({
|
|
1117
|
+
name: `@acme/kit-${i}`,
|
|
1118
|
+
}));
|
|
1119
|
+
const c = checkIntegrationIssues({integrationIssues: [], integrations});
|
|
1120
|
+
expect(c.message).toMatch(
|
|
1121
|
+
/^12 loaded integrations checked \(.* and 2 more\): /,
|
|
1122
|
+
);
|
|
1123
|
+
});
|
|
1124
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The `themes` check that every released doctor report carries. Its id is
|
|
6
|
+
* stable, so it stays beside the app-theme checks. Without a generated theme
|
|
7
|
+
* module it reports what it always has: whether an `@astryxdesign/theme-*`
|
|
8
|
+
* package is installed, and whether the app's package.json names a theme in
|
|
9
|
+
* `astryx.theme`. With a generated module it reports the overall result of the
|
|
10
|
+
* app-theme checks.
|
|
11
|
+
* @param {string} cwd
|
|
12
|
+
* @param {DoctorCheck[]} appChecks - the checks {@link checkAppThemes} returned
|
|
13
|
+
* @returns {DoctorCheck}
|
|
14
|
+
*/
|
|
15
|
+
export function checkThemes(cwd: string, appChecks: DoctorCheck[]): DoctorCheck;
|
|
16
|
+
/**
|
|
17
|
+
* Run all ten app-theme checks.
|
|
18
|
+
* @param {string} cwd
|
|
19
|
+
* @returns {Promise<DoctorCheck[]>}
|
|
20
|
+
*/
|
|
21
|
+
export function checkAppThemes(cwd: string): Promise<DoctorCheck[]>;
|
|
22
|
+
export type DoctorCheck = import("./doctor.mjs").DoctorCheck;
|
|
23
|
+
export type DiscoveredTheme = import("../../foundation/discovery/theme-discovery.mjs").DiscoveredTheme;
|
|
24
|
+
export type ResolvedAppTheme = import("../../foundation/config/theme-state.mjs").ResolvedAppTheme;
|