@astryxdesign/cli 0.7.2-canary.a3f5dbf → 0.7.2-canary.a44ebd5
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 +169 -148
- package/api/build/_adapter.d.mts +8 -0
- package/api/build/_adapter.mjs +12 -1
- package/api/build/build.doc.mjs +4 -0
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/kit.mjs +3 -11
- package/api/component/_adapter.d.mts +31 -0
- package/api/component/_adapter.mjs +119 -11
- package/api/component/component.doc.mjs +6 -1
- package/api/component/component.mjs +60 -10
- package/api/component/doc-links.test.mjs +386 -0
- package/api/discover/_adapter.d.mts +132 -12
- package/api/discover/_adapter.mjs +488 -27
- package/api/discover/_adapter.test.mjs +599 -17
- package/api/discover/_catalog-view.d.mts +16 -5
- package/api/discover/_catalog-view.mjs +32 -8
- package/api/discover/detail/doc/doc.mjs +9 -1
- package/api/discover/discover.d.mts +11 -0
- package/api/discover/discover.doc.mjs +9 -7
- package/api/discover/discover.mjs +121 -19
- package/api/discover/discover.type.d.mts +20 -7
- package/api/discover/discover.type.mjs +17 -7
- package/api/discover/list/list.d.mts +4 -3
- package/api/discover/list/list.mjs +17 -10
- package/api/docs/_adapter.d.mts +74 -0
- package/api/docs/_adapter.mjs +348 -17
- package/api/docs/docs.doc.mjs +2 -1
- package/api/docs/docs.mjs +2 -1
- package/api/docs/docs.test.mjs +5 -2
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/list/list.mjs +12 -2
- package/api/docs/reference-blocks.test.mjs +1 -3
- package/api/doctor/_adapter.d.mts +108 -0
- package/api/doctor/_adapter.mjs +223 -4
- package/api/doctor/doctor.d.mts +199 -0
- package/api/doctor/doctor.doc.mjs +3 -2
- package/api/doctor/doctor.mjs +530 -34
- package/api/doctor/doctor.test.mjs +180 -14
- package/api/doctor/release-checks.test.mjs +156 -0
- package/api/doctor/theme-checks.mjs +17 -4
- package/api/doctor/theme-checks.test.mjs +223 -7
- package/api/error.d.mts +10 -0
- package/api/error.mjs +25 -0
- package/api/gap-report/gap-report.d.mts +3 -0
- package/api/gap-report/gap-report.doc.mjs +11 -3
- package/api/gap-report/gap-report.mjs +152 -48
- package/api/gap-report/gap-report.test.mjs +233 -0
- package/api/gap-report/gap-report.type.d.mts +41 -0
- package/api/gap-report/gap-report.type.mjs +18 -0
- package/api/hook/_adapter.mjs +3 -11
- package/api/hook/hook.doc.mjs +4 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/init/_adapter.d.mts +22 -0
- package/api/init/_adapter.mjs +59 -0
- package/api/init/init.d.mts +7 -5
- package/api/init/init.doc.mjs +28 -7
- package/api/init/init.mjs +28 -4
- package/api/init/init.type.d.mts +48 -3
- package/api/init/init.type.mjs +37 -3
- package/api/init/run/run.d.mts +1 -1
- package/api/init/run/run.mjs +17 -6
- package/api/init/user/user.d.mts +14 -0
- package/api/init/user/user.mjs +87 -0
- package/api/init/user/user.test.mjs +232 -0
- package/api/integration/_adapter.d.mts +33 -0
- package/api/integration/_adapter.mjs +58 -0
- package/api/integration/add-contribution.mjs +1 -1
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/authoring-checks.mjs +100 -5
- package/api/integration/authoring-checks.test.mjs +769 -0
- package/api/integration/authoring-checks.type.d.mts +134 -0
- package/api/integration/authoring-checks.type.mjs +60 -1
- package/api/integration/check/check.d.mts +96 -0
- package/api/integration/check/check.mjs +357 -0
- package/api/integration/check/check.test.mjs +489 -0
- package/api/integration/integration-check.type.d.mts +118 -0
- package/api/integration/integration-check.type.mjs +84 -0
- package/api/integration/integrationCheck.doc.d.mts +10 -0
- package/api/integration/integrationCheck.doc.mjs +73 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +29 -6
- package/api/integration/integrationDocConflicts.doc.mjs +22 -5
- package/api/integration/pack-check.mjs +303 -13
- package/api/integration/pack-check.test.mjs +371 -10
- package/api/integration/validate-integration-fixes.test.mjs +67 -0
- package/api/integration/validate-integration.d.mts +8 -0
- package/api/integration/validate-integration.mjs +63 -9
- package/api/integration/validate-integration.test.mjs +77 -8
- package/api/integration/validate-integration.type.d.mts +16 -0
- package/api/integration/validate-integration.type.mjs +14 -1
- package/api/integration/validate-unread-theme-folders.test.mjs +3 -2
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/_adapter.d.mts +11 -0
- package/api/search/_adapter.mjs +25 -0
- package/api/search/search.d.mts +73 -13
- package/api/search/search.doc.mjs +8 -3
- package/api/search/search.domain-priority.test.mjs +108 -18
- package/api/search/search.integration-check.test.mjs +24 -0
- package/api/search/search.mjs +541 -52
- package/api/search/search.test.mjs +143 -1
- package/api/search/search.type.d.mts +14 -1
- package/api/search/search.type.mjs +6 -1
- package/api/swizzle/_adapter.mjs +2 -2
- package/api/swizzle/copy/copy.mjs +1 -1
- package/api/template/template-integration.test.mjs +1 -1
- package/api/theme/_adapter.d.mts +16 -0
- package/api/theme/_adapter.mjs +32 -5
- package/api/theme/build/build.d.mts +2 -1
- package/api/theme/build/build.family.test.mjs +54 -6
- package/api/theme/build/build.mjs +184 -31
- package/api/theme/build/build.packed-old-core.test.mjs +20 -3
- package/api/theme/build/font-warning.mjs +5 -3
- package/api/theme/build/font-warning.test.mjs +2 -1
- package/api/theme/remove/remove.test.mjs +2 -2
- package/api/theme/targets/targets.mjs +3 -10
- package/api/theme/themeBuild.doc.mjs +4 -4
- package/api/theme/themeTargets.doc.mjs +4 -0
- package/api/theme/use/use.test.mjs +1 -1
- package/api/upgrade/_adapter.d.mts +40 -2
- package/api/upgrade/_adapter.mjs +118 -5
- package/api/upgrade/run/cli-behind-core.test.mjs +438 -0
- package/api/upgrade/run/run.mjs +35 -2
- package/api/upgrade/status/status.d.mts +21 -5
- package/api/upgrade/status/status.mjs +45 -8
- package/api/upgrade/upgrade.doc.mjs +6 -3
- package/api/upgrade/upgrade.mjs +5 -1
- package/api/upgrade/upgrade.type.d.mts +23 -0
- package/api/upgrade/upgrade.type.mjs +16 -1
- package/assets/codemods/runner.mjs +7 -1
- package/assets/discover/official-packages.json +367 -0
- package/assets/docs/README.md +10 -0
- package/assets/docs/author-a-theme.doc.mjs +3 -3
- package/assets/docs/browser-support.doc.mjs +1 -1
- package/assets/docs/getting-started.doc.mjs +26 -6
- package/assets/docs/styling-overview.doc.mjs +1 -1
- package/assets/docs/theme.doc.dense.mjs +1 -1
- package/assets/docs/theme.doc.mjs +2 -2
- package/assets/docs/theme.doc.zh.mjs +1 -1
- package/assets/docs/tree/add-a-component.doc.mjs +12 -2
- package/assets/docs/tree/add-a-theme.doc.mjs +13 -3
- package/assets/docs/tree/add-a-topic.doc.mjs +54 -9
- package/assets/docs/tree/agent-guidance.doc.mjs +19 -5
- package/assets/docs/tree/block-template.doc.mjs +8 -20
- package/assets/docs/tree/build-the-template.doc.mjs +1 -1
- package/assets/docs/tree/building-blocks.doc.mjs +4 -0
- package/assets/docs/tree/check-the-props.doc.mjs +59 -3
- package/assets/docs/tree/check-your-docs.doc.mjs +69 -11
- package/assets/docs/tree/checks.doc.mjs +30 -22
- package/assets/docs/tree/ci-and-containers.doc.mjs +88 -0
- package/assets/docs/tree/cli-command.doc.mjs +142 -0
- package/assets/docs/tree/cli.doc.mjs +6 -0
- package/assets/docs/tree/codemods.doc.mjs +17 -7
- package/assets/docs/tree/commands.doc.mjs +7 -1
- package/assets/docs/tree/component-family.doc.mjs +3 -5
- package/assets/docs/tree/component-imports.doc.mjs +13 -3
- package/assets/docs/tree/components.doc.mjs +7 -1
- package/assets/docs/tree/computer-agent-guide.doc.mjs +160 -0
- package/assets/docs/tree/computer-integrations.doc.mjs +93 -0
- package/assets/docs/tree/configuration.doc.mjs +7 -3
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +41 -22
- package/assets/docs/tree/define-the-theme.doc.mjs +6 -5
- package/assets/docs/tree/describe-the-component.doc.mjs +2 -2
- package/assets/docs/tree/docs.doc.mjs +9 -3
- package/assets/docs/tree/document-the-template.doc.mjs +1 -1
- package/assets/docs/tree/document-the-theme.doc.mjs +3 -3
- package/assets/docs/tree/export-template-assets.doc.mjs +1 -1
- package/assets/docs/tree/extend-or-replace.doc.mjs +19 -9
- package/assets/docs/tree/fonts-and-assets.doc.mjs +2 -2
- package/assets/docs/tree/generate-a-palette.doc.mjs +7 -5
- package/assets/docs/tree/global-integrations.doc.mjs +124 -0
- package/assets/docs/tree/global.doc.mjs +131 -0
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +5 -5
- package/assets/docs/tree/install-once.doc.mjs +105 -0
- package/assets/docs/tree/integrations.doc.mjs +13 -1
- package/assets/docs/tree/layout-spacing.doc.mjs +2 -3
- package/assets/docs/tree/layout.doc.mjs +6 -6
- package/assets/docs/tree/links.doc.mjs +6 -5
- package/assets/docs/tree/migration-setup.doc.mjs +3 -2
- package/assets/docs/tree/migration-verification.doc.mjs +0 -1
- package/assets/docs/tree/migration.doc.mjs +0 -1
- package/assets/docs/tree/monorepos.doc.mjs +84 -0
- package/assets/docs/tree/package-and-test.doc.mjs +1 -1
- package/assets/docs/tree/page-template.doc.mjs +4 -8
- package/assets/docs/tree/problems.doc.mjs +205 -0
- package/assets/docs/tree/project-global-or-both.doc.mjs +131 -0
- package/assets/docs/tree/publishing.doc.mjs +6 -6
- package/assets/docs/tree/quick-start.doc.mjs +53 -27
- package/assets/docs/tree/reference.doc.mjs +192 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +15 -7
- package/assets/docs/tree/replace-a-core-template.doc.mjs +10 -12
- package/assets/docs/tree/scaffold.doc.mjs +1 -1
- package/assets/docs/tree/sections-and-placement.doc.mjs +9 -11
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +17 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +9 -8
- package/assets/docs/tree/single-component.doc.mjs +14 -6
- package/assets/docs/tree/start-a-template.doc.mjs +18 -8
- package/assets/docs/tree/subcomponent.doc.mjs +6 -6
- package/assets/docs/tree/template-assets.doc.mjs +2 -2
- package/assets/docs/tree/template-doc-overview.doc.mjs +6 -17
- package/assets/docs/tree/template-fonts.doc.mjs +1 -1
- package/assets/docs/tree/template-icons.doc.mjs +1 -1
- package/assets/docs/tree/template-images-media.doc.mjs +1 -1
- package/assets/docs/tree/template-styles.doc.mjs +2 -2
- package/assets/docs/tree/templates.doc.mjs +7 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +7 -7
- package/assets/docs/tree/test-template-in-app.doc.mjs +5 -5
- package/assets/docs/tree/themes.doc.mjs +4 -0
- package/assets/docs/tree/tokens-and-setup.doc.mjs +19 -15
- package/assets/docs/tree/troubleshooting.doc.mjs +22 -14
- package/assets/docs/tree/type-scale.doc.mjs +3 -3
- package/assets/docs/tree/uninstall.doc.mjs +109 -0
- package/assets/docs/tree/updates.doc.mjs +92 -0
- package/assets/docs/tree/upgrading.doc.mjs +6 -6
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +14 -2
- package/assets/docs/tree/verify-packed-template.doc.mjs +3 -3
- package/assets/docs/tree/versioning.doc.mjs +9 -9
- package/assets/docs/tree/who-answers.doc.mjs +119 -0
- package/assets/docs/tree/write-the-template-file.doc.mjs +7 -6
- package/assets/docs/use-a-theme.doc.mjs +2 -2
- package/assets/docs/working-with-ai.doc.mjs +23 -9
- package/assets/theme.template.ts +1 -1
- package/authoring/codemod/codemod.doc.mjs +7 -3
- package/authoring/config/config.doc.mjs +9 -6
- package/authoring/config/type.ts +4 -2
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/discover/discover.doc.mjs +7 -1
- package/authoring/doctypes/_schema.d.mts +8 -3
- package/authoring/doctypes/_schema.mjs +1 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +6 -4
- package/authoring/doctypes/command/command.doc.mjs +20 -12
- package/authoring/doctypes/command/type.ts +14 -0
- package/authoring/doctypes/component/component.doc.mjs +29 -26
- package/authoring/doctypes/component/type.ts +15 -5
- package/authoring/doctypes/enum/enum.doc.mjs +7 -4
- package/authoring/doctypes/function/function.doc.mjs +9 -8
- package/authoring/doctypes/hook/hook.doc.mjs +5 -4
- package/authoring/doctypes/hook/type.ts +4 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -6
- package/authoring/doctypes/reference/reference.doc.mjs +12 -11
- package/authoring/doctypes/schema/schema.doc.mjs +9 -9
- package/authoring/doctypes/template/integration-template.doc.d.mts +11 -0
- package/authoring/doctypes/template/integration-template.doc.mjs +49 -0
- package/authoring/doctypes/template/parse.d.mts +6 -2
- package/authoring/doctypes/template/parse.mjs +3 -1
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- package/authoring/doctypes/template/type.ts +22 -0
- package/authoring/doctypes/theme/theme.doc.mjs +2 -2
- package/authoring/gap-report/gap-report.doc.mjs +2 -2
- package/authoring/identity/identity.doc.mjs +3 -3
- package/authoring/index.d.ts +2 -0
- package/authoring/integration/integration.doc.mjs +22 -5
- package/authoring/integration/parse.test.mjs +11 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +33 -2
- package/authoring/integration/type.ts +8 -0
- package/clients/cli/bin/astryx.mjs +20 -3
- package/clients/cli/cli-command.test.mjs +166 -0
- package/clients/cli/commands/blog.doc.mjs +1 -0
- package/clients/cli/commands/build-theme.batch-report.test.mjs +17 -3
- package/clients/cli/commands/build-theme.font-warning.test.mjs +3 -3
- package/clients/cli/commands/build-theme.mjs +26 -13
- package/clients/cli/commands/build-theme.path-safety.test.mjs +155 -21
- package/clients/cli/commands/build.doc.mjs +1 -0
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +4 -0
- package/clients/cli/commands/cli-postinstall.test.mjs +49 -1
- package/clients/cli/commands/component.doc.mjs +1 -0
- package/clients/cli/commands/discover.broken-integration.test.mjs +11 -7
- package/clients/cli/commands/discover.doc.mjs +9 -1
- package/clients/cli/commands/discover.mjs +144 -93
- package/clients/cli/commands/discover.no-source.test.mjs +448 -33
- package/clients/cli/commands/discover.sources.test.mjs +20 -1
- package/clients/cli/commands/docs.doc.mjs +1 -0
- package/clients/cli/commands/docs.mjs +49 -19
- package/clients/cli/commands/docs.test.mjs +2 -2
- package/clients/cli/commands/doctor-integration-components.doc.mjs +15 -6
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +20 -5
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -0
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +22 -2
- package/clients/cli/commands/doctor-integration.test.mjs +498 -5
- package/clients/cli/commands/doctor.doc.mjs +12 -2
- package/clients/cli/commands/doctor.mjs +218 -7
- package/clients/cli/commands/doctor.test.mjs +10 -4
- package/clients/cli/commands/gap-report.doc.mjs +15 -2
- package/clients/cli/commands/gap-report.mjs +24 -2
- package/clients/cli/commands/gap-report.test.mjs +79 -0
- package/clients/cli/commands/hook.doc.mjs +1 -0
- package/clients/cli/commands/init.behavior.test.mjs +5 -0
- package/clients/cli/commands/init.doc.mjs +29 -3
- package/clients/cli/commands/integration-add.doc.mjs +7 -0
- package/clients/cli/commands/integration-authoring.test.mjs +49 -3
- package/clients/cli/commands/integration-check.doc.mjs +93 -0
- package/clients/cli/commands/integration-check.test.mjs +441 -0
- package/clients/cli/commands/integration-pack.doc.mjs +8 -1
- package/clients/cli/commands/integration-verify.doc.mjs +8 -1
- package/clients/cli/commands/integration.doc.mjs +6 -2
- package/clients/cli/commands/integration.mjs +119 -7
- package/clients/cli/commands/json-contract.test.mjs +11 -2
- package/clients/cli/commands/manifest.doc.mjs +1 -0
- package/clients/cli/commands/outside-project.test.mjs +774 -0
- package/clients/cli/commands/search.doc.mjs +1 -0
- package/clients/cli/commands/search.mjs +16 -11
- package/clients/cli/commands/search.test.mjs +429 -296
- package/clients/cli/commands/setup-nudge.test.mjs +102 -2
- package/clients/cli/commands/swizzle.doc.mjs +7 -0
- package/clients/cli/commands/swizzle.mjs +5 -3
- package/clients/cli/commands/swizzle.routing.test.mjs +19 -2
- package/clients/cli/commands/template.doc.mjs +1 -0
- package/clients/cli/commands/text-json-parity.test.mjs +5 -0
- package/clients/cli/commands/theme-add-lifecycle.test.mjs +3 -3
- package/clients/cli/commands/theme-add.doc.mjs +8 -1
- package/clients/cli/commands/theme-build.doc.mjs +3 -2
- package/clients/cli/commands/theme-eject.doc.mjs +1 -0
- package/clients/cli/commands/theme-list.behavior.test.mjs +6 -0
- package/clients/cli/commands/theme-list.doc.mjs +1 -0
- package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -0
- package/clients/cli/commands/theme-remove.doc.mjs +7 -0
- package/clients/cli/commands/theme-targets.doc.mjs +1 -0
- package/clients/cli/commands/theme-template.doc.mjs +1 -0
- package/clients/cli/commands/theme-use.doc.mjs +7 -0
- package/clients/cli/commands/upgrade.config-ordering.test.mjs +2 -1
- package/clients/cli/commands/upgrade.doc.mjs +22 -1
- package/clients/cli/commands/upgrade.file-protection.test.mjs +3 -2
- package/clients/cli/commands/upgrade.hook-output.test.mjs +2 -1
- package/clients/cli/commands/upgrade.older-cli.test.mjs +160 -0
- package/clients/cli/index.mjs +112 -16
- package/clients/cli/lib/cli-error.mjs +4 -1
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +2 -2
- package/clients/cli/lib/json-shim.mjs +3 -1
- package/clients/cli/lib/manifest.d.ts +9 -0
- package/clients/cli/lib/manifest.mjs +17 -1
- package/clients/cli/lib/manifest.test.mjs +25 -0
- package/foundation/agent-docs/agent-doc-state.d.mts +35 -6
- package/foundation/agent-docs/agent-doc-state.mjs +66 -6
- package/foundation/agent-docs/agent-docs.d.mts +4 -3
- package/foundation/agent-docs/agent-docs.mjs +11 -9
- package/foundation/agent-docs/computer-agent-text.d.mts +133 -0
- package/foundation/agent-docs/computer-agent-text.mjs +623 -0
- package/foundation/agent-docs/computer-agent-text.test.mjs +602 -0
- package/foundation/config/project.d.mts +35 -3
- package/foundation/config/project.mjs +145 -8
- package/foundation/config/project.test.mjs +66 -0
- package/foundation/config/theme-state.mjs +5 -4
- package/foundation/discovery/authoring-self-docs.mjs +2 -1
- package/foundation/discovery/cli-self-docs.mjs +20 -3
- package/foundation/discovery/cli-self-docs.test.mjs +3 -2
- package/foundation/discovery/component-replacement.mjs +2 -1
- package/foundation/discovery/copied-passages.d.mts +216 -0
- package/foundation/discovery/copied-passages.mjs +720 -0
- package/foundation/discovery/copied-passages.test.mjs +124 -0
- package/foundation/discovery/doc-consistency.d.mts +34 -0
- package/foundation/discovery/doc-consistency.mjs +513 -0
- package/foundation/discovery/doc-consistency.test.mjs +347 -0
- package/foundation/discovery/doc-fluff.d.mts +112 -0
- package/foundation/discovery/doc-fluff.mjs +328 -0
- package/foundation/discovery/doc-fluff.test.mjs +142 -0
- package/foundation/discovery/doc-types.d.mts +157 -0
- package/foundation/discovery/doc-types.mjs +1231 -0
- package/foundation/discovery/doc-types.test.mjs +744 -0
- package/foundation/discovery/docs-discovery.d.mts +7 -0
- package/foundation/discovery/docs-discovery.mjs +26 -2
- package/foundation/discovery/integration-doc-files.d.mts +22 -0
- package/foundation/discovery/integration-doc-files.mjs +231 -0
- package/foundation/discovery/integration-doc-files.test.mjs +246 -0
- package/foundation/discovery/project-typescript.d.mts +11 -2
- package/foundation/discovery/project-typescript.mjs +32 -4
- package/foundation/discovery/prop-drift.d.mts +81 -4
- package/foundation/discovery/prop-drift.mjs +727 -64
- package/foundation/discovery/prop-drift.test.mjs +1150 -10
- package/foundation/discovery/runner-allowlist.d.mts +40 -0
- package/foundation/discovery/runner-allowlist.mjs +53 -0
- package/foundation/discovery/stray-pointers.d.mts +52 -0
- package/foundation/discovery/stray-pointers.mjs +293 -0
- package/foundation/discovery/stray-pointers.test.mjs +86 -0
- package/foundation/discovery/template-needs.mjs +5 -2
- package/foundation/discovery/theme-imports.mjs +8 -4
- package/foundation/discovery/theme-imports.test.mjs +1 -1
- package/foundation/discovery/type-text.mjs +1 -1
- package/foundation/discovery/type-text.test.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +44 -2
- package/foundation/doc-compiler/inputs.mjs +4 -1
- package/foundation/doc-compiler/links.d.mts +32 -0
- package/foundation/doc-compiler/links.mjs +163 -26
- package/foundation/doc-compiler/links.test.mjs +97 -4
- package/foundation/doc-compiler/read.d.mts +1 -1
- package/foundation/doc-compiler/tree.mjs +30 -1
- package/foundation/doc-compiler/tree.test.mjs +8 -1
- package/foundation/env/cli-command.d.mts +83 -0
- package/foundation/env/cli-command.mjs +152 -0
- package/foundation/env/cli-command.test.mjs +129 -0
- package/foundation/env/node-version.test.mjs +15 -3
- package/foundation/env/package-manager.d.mts +93 -9
- package/foundation/env/package-manager.global.test.mjs +66 -0
- package/foundation/env/package-manager.mjs +184 -13
- package/foundation/env/package-manager.test.mjs +341 -15
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +33 -0
- package/foundation/env/search-path.d.mts +42 -0
- package/foundation/env/search-path.mjs +205 -0
- package/foundation/env/search-path.test.mjs +122 -0
- package/foundation/env/user-dirs.d.mts +39 -0
- package/foundation/env/user-dirs.mjs +93 -0
- package/foundation/env/user-dirs.test.mjs +72 -0
- package/foundation/env/user-settings.d.mts +46 -0
- package/foundation/env/user-settings.mjs +106 -0
- package/foundation/env/user-settings.test.mjs +64 -0
- package/foundation/fs/file-protection.mjs +15 -1
- package/foundation/fs/module-loader.d.mts +2 -1
- package/foundation/fs/module-loader.mjs +60 -4
- package/foundation/fs/module-loader.stdout.test.mjs +3 -2
- package/foundation/fs/module-loader.test.mjs +194 -0
- package/foundation/fs/path-compare.d.mts +33 -0
- package/foundation/fs/path-compare.mjs +73 -0
- package/foundation/fs/paths.d.mts +57 -1
- package/foundation/fs/paths.mjs +131 -3
- package/foundation/fs/paths.test.mjs +10 -1
- package/foundation/integrations/computer-integrations.d.mts +78 -0
- package/foundation/integrations/computer-integrations.mjs +316 -0
- package/foundation/integrations/computer-integrations.test.mjs +292 -0
- package/foundation/integrations/contribution-inventory.d.mts +11 -0
- package/foundation/integrations/contribution-inventory.mjs +50 -2
- package/foundation/integrations/integration-warnings.mjs +3 -2
- package/foundation/integrations/integration-warnings.test.mjs +8 -9
- package/foundation/integrations/integrations.d.mts +25 -1
- package/foundation/integrations/integrations.mjs +46 -3
- package/foundation/integrations/issue.ts +6 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +41 -1
- package/foundation/release/agent-text-worker.d.mts +4 -0
- package/foundation/release/agent-text-worker.mjs +52 -0
- package/foundation/release/cache.d.mts +310 -0
- package/foundation/release/cache.mjs +1216 -0
- package/foundation/release/cache.test.mjs +920 -0
- package/foundation/release/choose.d.mts +207 -0
- package/foundation/release/choose.mjs +677 -0
- package/foundation/release/choose.test.mjs +427 -0
- package/foundation/release/core-worker.d.mts +4 -0
- package/foundation/release/core-worker.mjs +38 -0
- package/foundation/release/global-state.d.mts +259 -0
- package/foundation/release/global-state.mjs +472 -0
- package/foundation/release/global-state.test.mjs +381 -0
- package/foundation/release/handoff.d.mts +60 -0
- package/foundation/release/handoff.e2e.test.mjs +278 -0
- package/foundation/release/handoff.mjs +357 -0
- package/foundation/release/lock-lease.d.mts +23 -0
- package/foundation/release/lock-lease.mjs +80 -0
- package/foundation/release/notices.d.mts +253 -0
- package/foundation/release/notices.mjs +596 -0
- package/foundation/release/notices.test.mjs +565 -0
- package/foundation/release/npm-guard.d.mts +4 -0
- package/foundation/release/npm-guard.mjs +126 -0
- package/foundation/release/project.d.mts +141 -0
- package/foundation/release/project.mjs +466 -0
- package/foundation/release/project.test.mjs +288 -0
- package/foundation/release/refresh-worker.d.mts +4 -0
- package/foundation/release/refresh-worker.mjs +27 -0
- package/foundation/release/run-context.d.mts +47 -0
- package/foundation/release/run-context.mjs +149 -0
- package/foundation/release/update-notice-env.d.mts +28 -0
- package/foundation/release/update-notice-env.mjs +39 -0
- package/foundation/response/base.d.ts +26 -3
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.doc.mjs +12 -0
- package/foundation/response/error-codes.mjs +17 -0
- package/foundation/response/error-codes.test.mjs +2 -0
- package/foundation/response/json-contract.test.mjs +7 -2
- package/foundation/response/json.mjs +4 -1
- package/foundation/response/response-types.doc.mjs +22 -11
- package/foundation/response/response-types.doc.test.mjs +46 -0
- package/foundation/response/response.doc.mjs +3 -3
- package/foundation/xle/browser-imports.test.mjs +74 -0
- package/package.json +11 -11
- package/scripts/postinstall.mjs +24 -5
|
@@ -19,7 +19,7 @@ import {Command} from 'commander';
|
|
|
19
19
|
import {discoverCoreTemplates} from '../../../foundation/discovery/template-adapter.mjs';
|
|
20
20
|
import {discoverOwnedComponents} from '../../../foundation/discovery/component-discovery.mjs';
|
|
21
21
|
import {discoverBuiltinTopics} from '../../../foundation/discovery/docs-discovery.mjs';
|
|
22
|
-
import {findCoreDir} from '../../../foundation/fs/paths.mjs';
|
|
22
|
+
import {findCoreDir, findProjectCoreDir} from '../../../foundation/fs/paths.mjs';
|
|
23
23
|
import {registerDoctor} from './doctor.mjs';
|
|
24
24
|
import {expectRecordsCarry} from '../../../test-utils/text-projection.mjs';
|
|
25
25
|
|
|
@@ -185,7 +185,7 @@ describe('doctor integration — command', () => {
|
|
|
185
185
|
]);
|
|
186
186
|
|
|
187
187
|
expect(logCalls.join('\n')).toContain(
|
|
188
|
-
'
|
|
188
|
+
' doctor integration templates <package>',
|
|
189
189
|
);
|
|
190
190
|
expect(process.exitCode).toBeUndefined();
|
|
191
191
|
});
|
|
@@ -210,6 +210,470 @@ describe('doctor integration — command', () => {
|
|
|
210
210
|
expect(process.exitCode).toBeUndefined();
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
+
it('validate prints the fix and the file an issue carries, and JSON carries the same issue', async () => {
|
|
214
|
+
writeDocIntegration({name: 'deploying'});
|
|
215
|
+
fs.writeFileSync(
|
|
216
|
+
path.join(tmpDir, 'docs', 'ghost.doc.zh.mjs'),
|
|
217
|
+
"export default {title: 'ghost'};\n",
|
|
218
|
+
);
|
|
219
|
+
process.chdir(tmpDir);
|
|
220
|
+
|
|
221
|
+
await createProgram().parseAsync([
|
|
222
|
+
'node',
|
|
223
|
+
'astryx',
|
|
224
|
+
'doctor',
|
|
225
|
+
'integration',
|
|
226
|
+
'validate',
|
|
227
|
+
]);
|
|
228
|
+
const output = logCalls.join('\n');
|
|
229
|
+
expect(output).toContain('orphan_doc_overlay');
|
|
230
|
+
expect(output).toMatch(
|
|
231
|
+
/fix:\s+Delete docs\/ghost\.doc\.zh\.mjs, or add the topic it translates/,
|
|
232
|
+
);
|
|
233
|
+
expect(output).toMatch(/file:\s+docs\/ghost\.doc\.zh\.mjs/);
|
|
234
|
+
expect(output).toMatch(/line:\s+1\b/);
|
|
235
|
+
|
|
236
|
+
logCalls = [];
|
|
237
|
+
await createProgram().parseAsync([
|
|
238
|
+
'node',
|
|
239
|
+
'astryx',
|
|
240
|
+
'--json',
|
|
241
|
+
'doctor',
|
|
242
|
+
'integration',
|
|
243
|
+
'validate',
|
|
244
|
+
]);
|
|
245
|
+
const parsed = JSON.parse(logCalls.join('\n'));
|
|
246
|
+
expect(parsed.data.issues).toEqual([
|
|
247
|
+
{
|
|
248
|
+
code: 'orphan_doc_overlay',
|
|
249
|
+
severity: 'warning',
|
|
250
|
+
message: expect.stringContaining('docs/ghost.doc.zh.mjs'),
|
|
251
|
+
fix: expect.stringContaining('Delete docs/ghost.doc.zh.mjs'),
|
|
252
|
+
file: 'docs/ghost.doc.zh.mjs',
|
|
253
|
+
line: 1,
|
|
254
|
+
},
|
|
255
|
+
]);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
it('validate warns about each doc field that does not match its authoring type, and still exits 0', async () => {
|
|
259
|
+
writeIntegration({id: 'hero', name: 'Hero', type: 'block'});
|
|
260
|
+
process.chdir(tmpDir);
|
|
261
|
+
|
|
262
|
+
await createProgram().parseAsync([
|
|
263
|
+
'node',
|
|
264
|
+
'astryx',
|
|
265
|
+
'doctor',
|
|
266
|
+
'integration',
|
|
267
|
+
'validate',
|
|
268
|
+
]);
|
|
269
|
+
|
|
270
|
+
const output = logCalls.join('\n');
|
|
271
|
+
expect(output).toContain('[ok] No integration issues found.');
|
|
272
|
+
expect(output).toMatch(
|
|
273
|
+
/Checking 1 doc\(s\) against the authoring types \(TypeScript \d+\.\d+/,
|
|
274
|
+
);
|
|
275
|
+
expect(output).toContain('templates/hero.doc.mjs');
|
|
276
|
+
expect(output).toMatch(/export:\s+default/);
|
|
277
|
+
expect(output).toMatch(/type:\s+IntegrationTemplateDoc/);
|
|
278
|
+
expect(output).toContain(
|
|
279
|
+
'Add `aspectRatio`: IntegrationBlockTemplateDoc requires it.',
|
|
280
|
+
);
|
|
281
|
+
expect(output).toContain(
|
|
282
|
+
'Add `displayName`: IntegrationBlockTemplateDoc requires it.',
|
|
283
|
+
);
|
|
284
|
+
expect(output).toContain(
|
|
285
|
+
'2 doc field(s) in 1 file(s) do not match the authoring types.',
|
|
286
|
+
);
|
|
287
|
+
expect(process.exitCode).toBeUndefined();
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
it('validate says there is no doc to type-check, rather than asking for TypeScript', async () => {
|
|
291
|
+
const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-no-docs-'));
|
|
292
|
+
try {
|
|
293
|
+
fs.writeFileSync(
|
|
294
|
+
path.join(outside, 'package.json'),
|
|
295
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
296
|
+
);
|
|
297
|
+
fs.writeFileSync(
|
|
298
|
+
path.join(outside, 'astryx.integration.mjs'),
|
|
299
|
+
"export default {components: './components'};\n",
|
|
300
|
+
);
|
|
301
|
+
fs.mkdirSync(path.join(outside, 'components'));
|
|
302
|
+
fs.writeFileSync(
|
|
303
|
+
path.join(outside, 'components', 'Widget.tsx'),
|
|
304
|
+
'export function Widget() { return null; }\n',
|
|
305
|
+
);
|
|
306
|
+
process.chdir(outside);
|
|
307
|
+
|
|
308
|
+
await createProgram().parseAsync([
|
|
309
|
+
'node',
|
|
310
|
+
'astryx',
|
|
311
|
+
'doctor',
|
|
312
|
+
'integration',
|
|
313
|
+
'validate',
|
|
314
|
+
]);
|
|
315
|
+
|
|
316
|
+
const output = logCalls.join('\n');
|
|
317
|
+
expect(output).toContain('[info] No doc files to type-check.');
|
|
318
|
+
expect(output).not.toContain('Docs not type-checked');
|
|
319
|
+
expect(output).not.toContain('against the authoring types');
|
|
320
|
+
} finally {
|
|
321
|
+
process.chdir(previousCwd);
|
|
322
|
+
fs.rmSync(outside, {recursive: true, force: true});
|
|
323
|
+
}
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('validate says the docs matched even when another check failed', async () => {
|
|
327
|
+
writeIntegration({id: 'hero', missingRoot: true});
|
|
328
|
+
fs.writeFileSync(
|
|
329
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
330
|
+
"export default {templates: './missing', components: './components'};\n",
|
|
331
|
+
);
|
|
332
|
+
fs.mkdirSync(path.join(tmpDir, 'components'), {recursive: true});
|
|
333
|
+
fs.writeFileSync(
|
|
334
|
+
path.join(tmpDir, 'components', 'AcmeBadge.doc.mjs'),
|
|
335
|
+
"export default {type: 'component', name: 'AcmeBadge', displayName: 'Badge', usage: {description: 'A badge.'}, props: []};\n",
|
|
336
|
+
);
|
|
337
|
+
fs.writeFileSync(
|
|
338
|
+
path.join(tmpDir, 'components', 'AcmeBadge.tsx'),
|
|
339
|
+
'export function AcmeBadge() { return null; }\n',
|
|
340
|
+
);
|
|
341
|
+
process.chdir(tmpDir);
|
|
342
|
+
|
|
343
|
+
await createProgram().parseAsync([
|
|
344
|
+
'node',
|
|
345
|
+
'astryx',
|
|
346
|
+
'doctor',
|
|
347
|
+
'integration',
|
|
348
|
+
'validate',
|
|
349
|
+
]);
|
|
350
|
+
|
|
351
|
+
const output = logCalls.join('\n');
|
|
352
|
+
expect(process.exitCode).toBe(1);
|
|
353
|
+
expect(output).toContain(
|
|
354
|
+
'[info] No doc field differs from its authoring type (1 checked).',
|
|
355
|
+
);
|
|
356
|
+
expect(output).not.toContain('[ok] Every doc');
|
|
357
|
+
});
|
|
358
|
+
|
|
359
|
+
it('validate prints every field of the doc type check that JSON carries', async () => {
|
|
360
|
+
writeIntegration({id: 'hero', name: 'Hero', type: 'block'});
|
|
361
|
+
fs.writeFileSync(
|
|
362
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
363
|
+
"export default {templates: './templates', components: './components'};\n",
|
|
364
|
+
);
|
|
365
|
+
fs.mkdirSync(path.join(tmpDir, 'components'), {recursive: true});
|
|
366
|
+
fs.writeFileSync(
|
|
367
|
+
path.join(tmpDir, 'components', 'AcmeBadge.doc.mjs'),
|
|
368
|
+
"export default {type: 'component', name: 'AcmeBadge', displayName: 5, usage: {description: 'A badge.'}, props: [], keyword: ['x']};\n",
|
|
369
|
+
);
|
|
370
|
+
fs.writeFileSync(
|
|
371
|
+
path.join(tmpDir, 'components', 'AcmeBadge.tsx'),
|
|
372
|
+
'export function AcmeBadge() { return null; }\n',
|
|
373
|
+
);
|
|
374
|
+
fs.writeFileSync(
|
|
375
|
+
path.join(tmpDir, 'components', 'shared.mjs'),
|
|
376
|
+
`export default {type: 'component', name: 'AcmeAgain', displayName: 'Again', usage: {description: 'x'}, props: []};\n`,
|
|
377
|
+
);
|
|
378
|
+
fs.writeFileSync(
|
|
379
|
+
path.join(tmpDir, 'components', 'AcmeAgain.doc.mjs'),
|
|
380
|
+
"export {default} from './shared.mjs';\n",
|
|
381
|
+
);
|
|
382
|
+
fs.writeFileSync(
|
|
383
|
+
path.join(tmpDir, 'components', 'AcmeAgain.tsx'),
|
|
384
|
+
'export function AcmeAgain() { return null; }\n',
|
|
385
|
+
);
|
|
386
|
+
process.chdir(tmpDir);
|
|
387
|
+
const run = async (/** @type {string[]} */ flags) => {
|
|
388
|
+
logCalls.length = 0;
|
|
389
|
+
await createProgram().parseAsync([
|
|
390
|
+
'node',
|
|
391
|
+
'astryx',
|
|
392
|
+
...flags,
|
|
393
|
+
'doctor',
|
|
394
|
+
'integration',
|
|
395
|
+
'validate',
|
|
396
|
+
]);
|
|
397
|
+
return logCalls.join('\n');
|
|
398
|
+
};
|
|
399
|
+
|
|
400
|
+
const report = JSON.parse(await run(['--json'])).data.docTypes;
|
|
401
|
+
const output = await run([]);
|
|
402
|
+
|
|
403
|
+
expect([...new Set(report.findings.map(f => f.problem))].sort()).toEqual([
|
|
404
|
+
'missing_field',
|
|
405
|
+
'unknown_field',
|
|
406
|
+
'wrong_type',
|
|
407
|
+
]);
|
|
408
|
+
expect(report.unchecked).toHaveLength(1);
|
|
409
|
+
expectRecordsCarry(output, report.findings, ['doc', 'field', 'problem']);
|
|
410
|
+
expectRecordsCarry(output, report.unchecked, ['doc', 'reason']);
|
|
411
|
+
expect(output).toContain(
|
|
412
|
+
`Checking ${report.docs} doc(s) against the authoring types (TypeScript ${report.typescript})`,
|
|
413
|
+
);
|
|
414
|
+
});
|
|
415
|
+
|
|
416
|
+
it('validate type-checks each doc component discovery serves, in __fixtures__, in a dot-folder or behind a symlink', async () => {
|
|
417
|
+
fs.writeFileSync(
|
|
418
|
+
path.join(tmpDir, 'package.json'),
|
|
419
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
420
|
+
);
|
|
421
|
+
fs.writeFileSync(
|
|
422
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
423
|
+
`export default {components: './components'};\n`,
|
|
424
|
+
);
|
|
425
|
+
for (const [rel, name] of [
|
|
426
|
+
['components/__fixtures__/AcmeFixture.doc.mjs', 'AcmeFixture'],
|
|
427
|
+
['components/.drafts/AcmeDraft.doc.mjs', 'AcmeDraft'],
|
|
428
|
+
['shared/AcmeLinked.doc.mjs', 'AcmeLinked'],
|
|
429
|
+
]) {
|
|
430
|
+
fs.mkdirSync(path.dirname(path.join(tmpDir, rel)), {recursive: true});
|
|
431
|
+
fs.writeFileSync(
|
|
432
|
+
path.join(tmpDir, rel),
|
|
433
|
+
`export default {type: 'component', name: '${name}', displayName: '${name}', usage: {description: 'Fixture.'}, props: [], keyword: []};\n`,
|
|
434
|
+
);
|
|
435
|
+
}
|
|
436
|
+
fs.symlinkSync(
|
|
437
|
+
path.join(tmpDir, 'shared', 'AcmeLinked.doc.mjs'),
|
|
438
|
+
path.join(tmpDir, 'components', 'AcmeLinked.doc.mjs'),
|
|
439
|
+
);
|
|
440
|
+
process.chdir(tmpDir);
|
|
441
|
+
|
|
442
|
+
await createProgram().parseAsync([
|
|
443
|
+
'node',
|
|
444
|
+
'astryx',
|
|
445
|
+
'--json',
|
|
446
|
+
'doctor',
|
|
447
|
+
'integration',
|
|
448
|
+
'validate',
|
|
449
|
+
]);
|
|
450
|
+
|
|
451
|
+
const {docTypes} = JSON.parse(logCalls.join('\n')).data;
|
|
452
|
+
expect(docTypes).toMatchObject({status: 'checked', docs: 3, unchecked: []});
|
|
453
|
+
expect(
|
|
454
|
+
docTypes.findings.map(
|
|
455
|
+
(/** @type {any} */ f) => `${f.doc} ${f.field} ${f.problem}`,
|
|
456
|
+
),
|
|
457
|
+
).toEqual([
|
|
458
|
+
'components/__fixtures__/AcmeFixture.doc.mjs keyword unknown_field',
|
|
459
|
+
'components/.drafts/AcmeDraft.doc.mjs keyword unknown_field',
|
|
460
|
+
'components/AcmeLinked.doc.mjs keyword unknown_field',
|
|
461
|
+
]);
|
|
462
|
+
});
|
|
463
|
+
|
|
464
|
+
it('validate type-checks a hidden doc and a second doc for one name, and counts a test fixture', async () => {
|
|
465
|
+
fs.writeFileSync(
|
|
466
|
+
path.join(tmpDir, 'package.json'),
|
|
467
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
468
|
+
);
|
|
469
|
+
fs.writeFileSync(
|
|
470
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
471
|
+
`export default {components: './components'};\n`,
|
|
472
|
+
);
|
|
473
|
+
for (const [rel, name, extra] of [
|
|
474
|
+
['components/AcmeBadge.doc.mjs', 'AcmeBadge', ''],
|
|
475
|
+
['components/again/AcmeBadge.doc.mjs', 'AcmeBadge', ', keyword: []'],
|
|
476
|
+
[
|
|
477
|
+
'components/AcmeHidden.doc.mjs',
|
|
478
|
+
'AcmeHidden',
|
|
479
|
+
', hidden: true, keyword: []',
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
'components/__tests__/AcmeTested.doc.mjs',
|
|
483
|
+
'AcmeTested',
|
|
484
|
+
', keyword: []',
|
|
485
|
+
],
|
|
486
|
+
]) {
|
|
487
|
+
fs.mkdirSync(path.dirname(path.join(tmpDir, rel)), {recursive: true});
|
|
488
|
+
fs.writeFileSync(
|
|
489
|
+
path.join(tmpDir, rel),
|
|
490
|
+
`export default {type: 'component', name: '${name}', displayName: '${name}', usage: {description: 'Fixture.'}, props: []${extra}};\n`,
|
|
491
|
+
);
|
|
492
|
+
fs.writeFileSync(
|
|
493
|
+
path.join(tmpDir, rel.replace('.doc.mjs', '.tsx')),
|
|
494
|
+
'export default function Fixture() { return null; }\n',
|
|
495
|
+
);
|
|
496
|
+
}
|
|
497
|
+
process.chdir(tmpDir);
|
|
498
|
+
const run = async (/** @type {string[]} */ flags) => {
|
|
499
|
+
logCalls.length = 0;
|
|
500
|
+
await createProgram().parseAsync([
|
|
501
|
+
'node',
|
|
502
|
+
'astryx',
|
|
503
|
+
...flags,
|
|
504
|
+
'doctor',
|
|
505
|
+
'integration',
|
|
506
|
+
'validate',
|
|
507
|
+
]);
|
|
508
|
+
return logCalls.join('\n');
|
|
509
|
+
};
|
|
510
|
+
|
|
511
|
+
const {docTypes} = JSON.parse(await run(['--json'])).data;
|
|
512
|
+
const output = await run([]);
|
|
513
|
+
|
|
514
|
+
expect(docTypes).toMatchObject({docs: 3, fixtures: 1, unchecked: []});
|
|
515
|
+
expect(
|
|
516
|
+
docTypes.findings.map(
|
|
517
|
+
(/** @type {any} */ f) => `${f.doc} ${f.field} ${f.problem}`,
|
|
518
|
+
),
|
|
519
|
+
).toEqual([
|
|
520
|
+
'components/AcmeHidden.doc.mjs keyword unknown_field',
|
|
521
|
+
'components/again/AcmeBadge.doc.mjs keyword unknown_field',
|
|
522
|
+
]);
|
|
523
|
+
expect(output).toContain('[info] 1 test fixture doc(s) not checked.');
|
|
524
|
+
expect(output).not.toContain('[ok] Every doc matches');
|
|
525
|
+
});
|
|
526
|
+
|
|
527
|
+
it('validate keeps the fixture count when test fixtures are the only docs', async () => {
|
|
528
|
+
fs.writeFileSync(
|
|
529
|
+
path.join(tmpDir, 'package.json'),
|
|
530
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
531
|
+
);
|
|
532
|
+
fs.writeFileSync(
|
|
533
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
534
|
+
`export default {components: './components'};\n`,
|
|
535
|
+
);
|
|
536
|
+
const rel = 'components/__tests__/AcmeTested.doc.mjs';
|
|
537
|
+
fs.mkdirSync(path.dirname(path.join(tmpDir, rel)), {recursive: true});
|
|
538
|
+
fs.writeFileSync(
|
|
539
|
+
path.join(tmpDir, rel),
|
|
540
|
+
`export default {type: 'component', name: 'AcmeTested', displayName: 'AcmeTested', usage: {description: 'Fixture.'}, props: []};\n`,
|
|
541
|
+
);
|
|
542
|
+
process.chdir(tmpDir);
|
|
543
|
+
const run = async (/** @type {string[]} */ flags) => {
|
|
544
|
+
logCalls.length = 0;
|
|
545
|
+
await createProgram().parseAsync([
|
|
546
|
+
'node',
|
|
547
|
+
'astryx',
|
|
548
|
+
...flags,
|
|
549
|
+
'doctor',
|
|
550
|
+
'integration',
|
|
551
|
+
'validate',
|
|
552
|
+
]);
|
|
553
|
+
return logCalls.join('\n');
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
const {docTypes} = JSON.parse(await run(['--json'])).data;
|
|
557
|
+
const output = await run([]);
|
|
558
|
+
|
|
559
|
+
expect(docTypes).toMatchObject({docs: 0, fixtures: 1, findings: []});
|
|
560
|
+
expect(output).toContain('[info] No doc files to type-check.');
|
|
561
|
+
expect(output).toContain('[info] 1 test fixture doc(s) not checked.');
|
|
562
|
+
});
|
|
563
|
+
|
|
564
|
+
it("validate keeps main's issue for a root it cannot read, and lists a root with a folder it cannot read", async () => {
|
|
565
|
+
fs.writeFileSync(
|
|
566
|
+
path.join(tmpDir, 'package.json'),
|
|
567
|
+
JSON.stringify({name: '@acme/widgets', version: '1.2.3'}),
|
|
568
|
+
);
|
|
569
|
+
fs.writeFileSync(
|
|
570
|
+
path.join(tmpDir, 'astryx.integration.mjs'),
|
|
571
|
+
`export default {components: './components', docs: './docs'};\n`,
|
|
572
|
+
);
|
|
573
|
+
fs.mkdirSync(path.join(tmpDir, 'components', 'locked'), {recursive: true});
|
|
574
|
+
fs.mkdirSync(path.join(tmpDir, 'docs'));
|
|
575
|
+
const locked = [
|
|
576
|
+
path.join(tmpDir, 'components', 'locked'),
|
|
577
|
+
path.join(tmpDir, 'docs'),
|
|
578
|
+
];
|
|
579
|
+
for (const dir of locked) fs.chmodSync(dir, 0o000);
|
|
580
|
+
process.chdir(tmpDir);
|
|
581
|
+
try {
|
|
582
|
+
await createProgram().parseAsync([
|
|
583
|
+
'node',
|
|
584
|
+
'astryx',
|
|
585
|
+
'--json',
|
|
586
|
+
'doctor',
|
|
587
|
+
'integration',
|
|
588
|
+
'validate',
|
|
589
|
+
]);
|
|
590
|
+
} finally {
|
|
591
|
+
for (const dir of locked) fs.chmodSync(dir, 0o755);
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
const {data} = JSON.parse(logCalls.join('\n'));
|
|
595
|
+
expect(data.issues.map((/** @type {any} */ i) => i.code).sort()).toEqual([
|
|
596
|
+
'invalid_component',
|
|
597
|
+
'unreadable_root',
|
|
598
|
+
]);
|
|
599
|
+
expect(data.docTypes.unchecked).toEqual([
|
|
600
|
+
{
|
|
601
|
+
doc: 'components',
|
|
602
|
+
reason: expect.stringMatching(
|
|
603
|
+
/^the components root does not load, so no doc in it was checked: .*EACCES/,
|
|
604
|
+
),
|
|
605
|
+
},
|
|
606
|
+
]);
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
it('validate reports the doc type check as additive JSON', async () => {
|
|
610
|
+
writeIntegration({id: 'hero', name: 'Hero', type: 'block'});
|
|
611
|
+
process.chdir(tmpDir);
|
|
612
|
+
|
|
613
|
+
await createProgram().parseAsync([
|
|
614
|
+
'node',
|
|
615
|
+
'astryx',
|
|
616
|
+
'--json',
|
|
617
|
+
'doctor',
|
|
618
|
+
'integration',
|
|
619
|
+
'validate',
|
|
620
|
+
]);
|
|
621
|
+
|
|
622
|
+
const parsed = JSON.parse(logCalls.join('\n'));
|
|
623
|
+
expect(parsed.data.issues).toEqual([]);
|
|
624
|
+
expect(parsed.data.docTypes).toMatchObject({
|
|
625
|
+
status: 'checked',
|
|
626
|
+
docs: 1,
|
|
627
|
+
unchecked: [],
|
|
628
|
+
});
|
|
629
|
+
expect(parsed.data.docTypes.typescript).toMatch(/^\d+\.\d+/);
|
|
630
|
+
expect(parsed.data.docTypes.findings).toEqual([
|
|
631
|
+
expect.objectContaining({
|
|
632
|
+
doc: 'templates/hero.doc.mjs',
|
|
633
|
+
export: 'default',
|
|
634
|
+
type: 'IntegrationTemplateDoc',
|
|
635
|
+
field: 'aspectRatio',
|
|
636
|
+
problem: 'missing_field',
|
|
637
|
+
severity: 'warning',
|
|
638
|
+
}),
|
|
639
|
+
expect.objectContaining({field: 'displayName', problem: 'missing_field'}),
|
|
640
|
+
]);
|
|
641
|
+
expect(process.exitCode).toBeUndefined();
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
it('validate says, in one visible line, that docs were not type-checked when the project has no TypeScript', async () => {
|
|
645
|
+
const outside = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-no-ts-'));
|
|
646
|
+
const inside = tmpDir;
|
|
647
|
+
try {
|
|
648
|
+
// The fixture helpers write to tmpDir; point it outside the repository,
|
|
649
|
+
// where no TypeScript resolves, and restore it for afterEach.
|
|
650
|
+
tmpDir = outside;
|
|
651
|
+
writeIntegration({id: 'hero', name: 'Hero', type: 'block'});
|
|
652
|
+
tmpDir = inside;
|
|
653
|
+
process.chdir(outside);
|
|
654
|
+
|
|
655
|
+
await createProgram().parseAsync([
|
|
656
|
+
'node',
|
|
657
|
+
'astryx',
|
|
658
|
+
'doctor',
|
|
659
|
+
'integration',
|
|
660
|
+
'validate',
|
|
661
|
+
]);
|
|
662
|
+
|
|
663
|
+
const output = logCalls.join('\n');
|
|
664
|
+
expect(output).toContain(
|
|
665
|
+
'[skip] Docs not type-checked: TypeScript is not installed in this project',
|
|
666
|
+
);
|
|
667
|
+
expect(output).not.toMatch(
|
|
668
|
+
/Checking \d+ doc\(s\) against the authoring types/,
|
|
669
|
+
);
|
|
670
|
+
expect(process.exitCode).toBeUndefined();
|
|
671
|
+
} finally {
|
|
672
|
+
process.chdir(previousCwd);
|
|
673
|
+
fs.rmSync(outside, {recursive: true, force: true});
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
|
|
213
677
|
it('templates warns on a Core id and writes the exact --package command', async () => {
|
|
214
678
|
const [core] = await discoverCoreTemplates();
|
|
215
679
|
expect(core).toBeDefined();
|
|
@@ -353,7 +817,8 @@ describe('doctor integration — command', () => {
|
|
|
353
817
|
tmpDir = outside;
|
|
354
818
|
try {
|
|
355
819
|
writeComponentIntegration('AcmeCarousel');
|
|
356
|
-
|
|
820
|
+
// Doctor judges the project's own Core, never the one a copy carries.
|
|
821
|
+
expect(findProjectCoreDir(outside)).toBeNull();
|
|
357
822
|
process.chdir(outside);
|
|
358
823
|
|
|
359
824
|
await createProgram().parseAsync([
|
|
@@ -639,12 +1104,15 @@ describe('doctor integration — command', () => {
|
|
|
639
1104
|
`export default {type: 'component', name: 'AcmeBadge', displayName: 'AcmeBadge', description: 'Fixture component.', props: [${[
|
|
640
1105
|
"{name: 'label', type: 'string', description: 'Text.'}",
|
|
641
1106
|
"{name: 'elevation', type: 'number', description: 'Shadow.'}",
|
|
1107
|
+
"{name: 'size', type: 'string', description: 'Size.'}",
|
|
1108
|
+
"{name: 'meta', type: '{id: string; extra?: number}', description: 'Data.'}",
|
|
1109
|
+
"{name: 'gap', type: 'number', description: 'Gap.', default: '8'}",
|
|
642
1110
|
].join(', ')}]};\n`,
|
|
643
1111
|
);
|
|
644
1112
|
// `key` is a prop a doc never needs, though the component declares it.
|
|
645
1113
|
fs.writeFileSync(
|
|
646
1114
|
path.join(tmpDir, 'components', 'AcmeBadge.tsx'),
|
|
647
|
-
"export function AcmeBadge(
|
|
1115
|
+
"export function AcmeBadge({gap = 4}: {label: string; tone?: 'neutral' | 'info'; size?: number; meta?: {id: string}; gap?: number; key?: string}) { return null; }\n",
|
|
648
1116
|
);
|
|
649
1117
|
fs.writeFileSync(
|
|
650
1118
|
path.join(tmpDir, 'components', 'AcmeLonely.doc.mjs'),
|
|
@@ -673,11 +1141,32 @@ describe('doctor integration — command', () => {
|
|
|
673
1141
|
|
|
674
1142
|
expect(report.findings.map(f => `${f.prop} ${f.kind}`)).toEqual([
|
|
675
1143
|
'elevation not_in_code',
|
|
1144
|
+
'gap default_mismatch',
|
|
676
1145
|
'label required_mismatch',
|
|
1146
|
+
'size type_mismatch',
|
|
677
1147
|
'tone not_in_doc',
|
|
678
1148
|
]);
|
|
679
1149
|
expectRecordsCarry(output, report.findings, ['component', 'prop', 'kind']);
|
|
680
1150
|
expectRecordsCarry(output, report.unchecked, ['component', 'reason']);
|
|
1151
|
+
expectRecordsCarry(output, report.typesNotCompared, [
|
|
1152
|
+
'component',
|
|
1153
|
+
'reason',
|
|
1154
|
+
'props',
|
|
1155
|
+
]);
|
|
1156
|
+
expect(report.typesNotCompared).toHaveLength(1);
|
|
1157
|
+
expect(output).toContain(
|
|
1158
|
+
`Documented prop types judged: ${report.typesCompared}; not compared: 1.`,
|
|
1159
|
+
);
|
|
1160
|
+
// The response-type reference, which the README's JSON table comes from,
|
|
1161
|
+
// names every field too.
|
|
1162
|
+
const {doc: responseTypes} =
|
|
1163
|
+
await import('../../../foundation/response/response-types.doc.mjs');
|
|
1164
|
+
const member = responseTypes.members.find(
|
|
1165
|
+
m => m.value === 'integration.component-conflicts',
|
|
1166
|
+
);
|
|
1167
|
+
for (const field of Object.keys(report)) {
|
|
1168
|
+
expect(member?.description).toMatch(new RegExp(`\\b${field}\\b`));
|
|
1169
|
+
}
|
|
681
1170
|
expect(output).toContain(
|
|
682
1171
|
`in 1 of ${report.components} component(s) compared (TypeScript ${report.typescript}).`,
|
|
683
1172
|
);
|
|
@@ -695,9 +1184,13 @@ describe('doctor integration — command', () => {
|
|
|
695
1184
|
'components',
|
|
696
1185
|
]);
|
|
697
1186
|
|
|
698
|
-
|
|
1187
|
+
const output = logCalls.join('\n');
|
|
1188
|
+
expect(output).toMatch(
|
|
699
1189
|
/\[ok\] Documented prop names and required flags match the code in 1 component\(s\) \(TypeScript \d/,
|
|
700
1190
|
);
|
|
1191
|
+
expect(output).toMatch(
|
|
1192
|
+
/\[info\] Documented prop types judged: \d+; not compared: 0\./,
|
|
1193
|
+
);
|
|
701
1194
|
});
|
|
702
1195
|
|
|
703
1196
|
it('components prints no [ok] for props it could not compare', async () => {
|
|
@@ -18,8 +18,11 @@ export const doc = {
|
|
|
18
18
|
'Runs read-only project health diagnostics by default: Node version, @astryxdesign/core ' +
|
|
19
19
|
'install and version alignment, theme packages, generated app themes when present, earlier copied-theme migration, config, integrations (every one astryx.config names must load, linked without a config entry, ' +
|
|
20
20
|
'provider identity, contribution issues), agent docs, core peer dependencies, package manager, ' +
|
|
21
|
-
"and the
|
|
22
|
-
'The `integration` subcommands provide authoring checks for one integration package.'
|
|
21
|
+
"the docs the CLI reads, the newest release the computer knows of, with the install and upgrade commands when the project's release is older, and every `astryx` command on the search path, warning when the first one is not the Astryx CLI or predates the hand-off. It writes nothing, but loading astryx.config runs that file's code. " +
|
|
22
|
+
'The `integration` subcommands provide authoring checks for one integration package. ' +
|
|
23
|
+
'Outside a project it checks the computer instead: the Node version, the release that answered, ' +
|
|
24
|
+
'the newest release this computer knows of, with the command that upgrades the CLI installed for the computer when it is older, the astryx commands on the search path, the integrations installed for the computer (warning about one it skips), and whether the computer-level agent text (`astryx init --user`) is present, matches this release, was edited, or is turned off (info only). ' +
|
|
25
|
+
'It never fails a check because the folder has no project.',
|
|
23
26
|
fn: 'doctor',
|
|
24
27
|
subcommands: ['integration'],
|
|
25
28
|
examples: [
|
|
@@ -42,9 +45,16 @@ export const doc = {
|
|
|
42
45
|
cli: 'astryx doctor integration docs @acme/widgets',
|
|
43
46
|
},
|
|
44
47
|
],
|
|
48
|
+
outsideProject: 'own',
|
|
45
49
|
exitCodes: [
|
|
46
50
|
{code: 0, when: 'no checks failed (warnings are allowed)'},
|
|
47
51
|
{code: 1, when: 'one or more checks failed'},
|
|
48
52
|
],
|
|
49
53
|
related: ['init', 'upgrade'],
|
|
54
|
+
notes: [
|
|
55
|
+
{
|
|
56
|
+
type: 'prose',
|
|
57
|
+
text: "In global mode: outside a project, doctor checks your computer instead of a folder: `node-version`, `answering-release` (the version that answered), `newest-release`, `cli-on-path` (every astryx command on your PATH), `computer-integrations` (integrations installed globally), and `computer-agent-text` (the agent guide). It never fails a check because the folder has no project. In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:who-answers}.",
|
|
58
|
+
},
|
|
59
|
+
],
|
|
50
60
|
};
|