@astryxdesign/cli 0.7.2-canary.fe2c655 → 0.7.3-canary.1379cb7
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 +119 -0
- package/README.md +211 -157
- package/api/build/_adapter.d.mts +66 -0
- package/api/build/_adapter.mjs +127 -4
- package/api/build/blocks/blocks.d.mts +42 -0
- package/api/build/blocks/blocks.mjs +169 -0
- package/api/build/blocks/blocks.test.mjs +108 -0
- package/api/build/blocks/blocks.weights.json +1 -0
- package/api/build/build.doc.mjs +4 -0
- package/api/build/build.mjs +25 -6
- package/api/build/help/help.mjs +1 -1
- package/api/build/kit/answer.d.mts +14 -0
- package/api/build/kit/answer.mjs +85 -0
- package/api/build/kit/answer.test.mjs +38 -0
- package/api/build/kit/kind.d.mts +25 -0
- package/api/build/kit/kind.mjs +170 -0
- package/api/build/kit/kit.d.mts +2 -4
- package/api/build/kit/kit.mjs +8 -406
- package/api/build/kit/rank.d.mts +3 -32
- package/api/build/kit/rank.mjs +25 -342
- package/api/build/kit/rank.test.mjs +2 -1
- package/api/build/kit/signals.d.mts +60 -0
- package/api/build/kit/signals.mjs +284 -0
- package/api/build/kit/start.d.mts +32 -0
- package/api/build/kit/start.mjs +163 -0
- package/api/build/kit/words.d.mts +72 -0
- package/api/build/kit/words.mjs +202 -0
- package/api/build/tree.d.mts +20 -0
- package/api/build/tree.mjs +52 -0
- package/api/build/tree.test.mjs +177 -0
- package/api/build/tree.weights.json +1 -0
- package/api/component/_adapter.d.mts +72 -1
- package/api/component/_adapter.mjs +212 -18
- package/api/component/component.doc.mjs +6 -1
- package/api/component/component.mjs +82 -15
- package/api/component/component.test.mjs +80 -0
- package/api/component/doc-links.test.mjs +386 -0
- package/api/component/integration-export-name.test.mjs +644 -0
- package/api/component/list/list.mjs +42 -4
- package/api/discover/_adapter.d.mts +132 -12
- package/api/discover/_adapter.mjs +522 -34
- package/api/discover/_adapter.test.mjs +641 -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 +565 -16
- package/api/docs/docs.doc.mjs +2 -1
- package/api/docs/docs.mjs +2 -1
- package/api/docs/docs.test.mjs +12 -3
- package/api/docs/integration-tree.test.mjs +22 -0
- package/api/docs/integrationDocs.test.mjs +124 -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 +616 -46
- 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 +219 -52
- 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 +45 -10
- package/api/init/init.mjs +28 -4
- package/api/init/init.test.mjs +18 -2
- package/api/init/init.type.d.mts +50 -5
- package/api/init/init.type.mjs +39 -5
- package/api/init/remove/remove.mjs +17 -4
- package/api/init/remove/remove.test.mjs +114 -2
- package/api/init/run/run.d.mts +1 -1
- package/api/init/run/run.mjs +86 -12
- 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 +45 -0
- package/api/integration/_adapter.mjs +112 -0
- package/api/integration/add-contribution.component-names.test.mjs +66 -0
- package/api/integration/add-contribution.mjs +8 -4
- package/api/integration/add-contribution.test.mjs +4 -2
- package/api/integration/authoring-checks.mjs +192 -14
- package/api/integration/authoring-checks.test.mjs +808 -0
- package/api/integration/authoring-checks.type.d.mts +143 -0
- package/api/integration/authoring-checks.type.mjs +74 -2
- 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 +45 -6
- package/api/integration/integrationDocConflicts.doc.mjs +22 -5
- package/api/integration/pack-check.mjs +378 -121
- package/api/integration/pack-check.test.mjs +748 -10
- package/api/integration/validate-integration-case-disk.test.mjs +111 -0
- package/api/integration/validate-integration-fixes.test.mjs +67 -0
- package/api/integration/validate-integration-gaps.test.mjs +1672 -0
- package/api/integration/validate-integration.d.mts +17 -1
- package/api/integration/validate-integration.mjs +277 -33
- package/api/integration/validate-integration.test.mjs +88 -8
- package/api/integration/validate-integration.type.d.mts +72 -0
- package/api/integration/validate-integration.type.mjs +56 -1
- package/api/integration/validate-unread-theme-folders.test.mjs +3 -2
- package/api/integration/validateIntegration.doc.mjs +19 -3
- package/api/search/ORDERING.md +28 -0
- package/api/search/_adapter.d.mts +75 -0
- package/api/search/_adapter.mjs +133 -0
- package/api/search/_candidate-score.d.mts +40 -0
- package/api/search/_candidate-score.mjs +238 -0
- package/api/search/_cards.json +6098 -0
- package/api/search/_compound.d.mts +50 -0
- package/api/search/_compound.mjs +170 -0
- package/api/search/_doc-searcher.d.mts +4 -0
- package/api/search/_doc-searcher.mjs +23 -0
- package/api/search/_doc-searcher.test.mjs +36 -0
- package/api/search/_doc-searcher.weights.json +1 -0
- package/api/search/_doc-text.d.mts +30 -0
- package/api/search/_doc-text.mjs +87 -0
- package/api/search/_entries.d.mts +52 -0
- package/api/search/_entries.mjs +158 -0
- package/api/search/_features.d.mts +35 -0
- package/api/search/_features.mjs +155 -0
- package/api/search/_gather-components.d.mts +26 -0
- package/api/search/_gather-components.mjs +284 -0
- package/api/search/_gather-docs.d.mts +20 -0
- package/api/search/_gather-docs.mjs +254 -0
- package/api/search/_gather-hooks.d.mts +12 -0
- package/api/search/_gather-hooks.mjs +52 -0
- package/api/search/_gather-templates.d.mts +25 -0
- package/api/search/_gather-templates.mjs +107 -0
- package/api/search/_lexical.d.mts +135 -0
- package/api/search/_lexical.mjs +351 -0
- package/api/search/_main-searcher.d.mts +19 -0
- package/api/search/_main-searcher.mjs +115 -0
- package/api/search/_main-searcher.test.mjs +106 -0
- package/api/search/_main-searcher.weights.json +1 -0
- package/api/search/_module-doc.d.mts +32 -0
- package/api/search/_module-doc.mjs +78 -0
- package/api/search/_order.d.mts +32 -0
- package/api/search/_order.mjs +162 -0
- package/api/search/_order.test.mjs +72 -0
- package/api/search/_priority.d.mts +50 -0
- package/api/search/_priority.mjs +139 -0
- package/api/search/_query-words.d.mts +25 -0
- package/api/search/_query-words.mjs +92 -0
- package/api/search/_query.d.mts +65 -0
- package/api/search/_query.mjs +176 -0
- package/api/search/_result.d.mts +97 -0
- package/api/search/_result.mjs +150 -0
- package/api/search/_score.d.mts +60 -0
- package/api/search/_score.mjs +283 -0
- package/api/search/_synonyms.d.mts +21 -0
- package/api/search/_synonyms.mjs +67 -0
- package/api/search/_template-searcher.d.mts +4 -0
- package/api/search/_template-searcher.mjs +23 -0
- package/api/search/_template-searcher.test.mjs +40 -0
- package/api/search/_template-searcher.weights.json +1 -0
- package/api/search/_titles.d.mts +33 -0
- package/api/search/_titles.mjs +65 -0
- package/api/search/_words.d.mts +64 -0
- package/api/search/_words.mjs +157 -0
- package/api/search/search.d.mts +22 -236
- package/api/search/search.doc.mjs +14 -7
- 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 +56 -1905
- package/api/search/search.test.mjs +179 -1
- package/api/search/search.type.d.mts +20 -2
- package/api/search/search.type.mjs +12 -2
- package/api/search/tree.d.mts +15 -0
- package/api/search/tree.mjs +40 -0
- package/api/search/tree.test.mjs +66 -0
- package/api/search/tree.weights.json +1 -0
- package/api/swizzle/_adapter.mjs +2 -2
- package/api/swizzle/copy/copy.mjs +29 -15
- package/api/template/template-integration.test.mjs +1 -1
- package/api/template/template.test.mjs +120 -3
- 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 +64 -0
- package/api/theme/build/build.mjs +250 -38
- package/api/theme/build/build.packed-old-core.test.mjs +21 -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 -8
- package/api/upgrade/_adapter.mjs +170 -9
- 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.test.mjs +194 -0
- package/api/upgrade/upgrade.type.d.mts +23 -0
- package/api/upgrade/upgrade.type.mjs +16 -1
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/runner.mjs +7 -1
- package/assets/codemods/transforms/v0.7.0/__tests__/validate-data-token-ownership.test.mjs +11 -0
- package/assets/codemods/transforms/v0.7.0/validate-data-token-ownership.mjs +3 -3
- package/assets/codemods/transforms/v0.7.2/__tests__/migrate-list-edge-compensation-to-edge.test.mjs +120 -0
- package/assets/codemods/transforms/v0.7.2/index.mjs +20 -0
- package/assets/codemods/transforms/v0.7.2/migrate-list-edge-compensation-to-edge.mjs +198 -0
- 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 +22 -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/api.doc.mjs +6 -0
- 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 +201 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +69 -11
- package/assets/docs/tree/checks.doc.mjs +32 -24
- 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 +8 -6
- package/assets/docs/tree/component-imports.doc.mjs +21 -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 +3 -3
- 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/host-entry.doc.mjs +128 -0
- 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 +7 -6
- 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 +15 -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/tokens-data.doc.mjs +2 -2
- package/assets/docs/tree/troubleshooting.doc.mjs +29 -13
- 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 +10 -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 +70 -13
- 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 +30 -27
- package/authoring/doctypes/component/type.ts +21 -8
- 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 +30 -6
- package/authoring/integration/parse.test.mjs +21 -0
- package/authoring/integration/schema.d.mts +16 -3
- package/authoring/integration/schema.mjs +34 -2
- package/authoring/integration/type.ts +12 -0
- package/clients/cli/bin/astryx.mjs +11 -65
- 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 +224 -6
- package/clients/cli/commands/build-theme.registry.test.mjs +5 -2
- 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 +19 -4
- 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 +888 -3
- package/clients/cli/commands/doctor.doc.mjs +12 -2
- package/clients/cli/commands/doctor.mjs +322 -7
- package/clients/cli/commands/doctor.test.mjs +75 -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 +235 -1
- package/clients/cli/commands/init.doc.mjs +55 -10
- package/clients/cli/commands/init.flag-help.test.mjs +1 -0
- package/clients/cli/commands/init.mjs +2 -2
- 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 +775 -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 +163 -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 +130 -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/clients/cli/run.mjs +108 -0
- package/foundation/agent-docs/agent-doc-state.d.mts +55 -13
- package/foundation/agent-docs/agent-doc-state.mjs +101 -14
- package/foundation/agent-docs/agent-docs.d.mts +104 -15
- package/foundation/agent-docs/agent-docs.mjs +1021 -108
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +1239 -17
- package/foundation/agent-docs/agent-docs.test.mjs +678 -35
- 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 +239 -7
- 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-discovery.d.mts +227 -10
- package/foundation/discovery/component-discovery.export-names.test.mjs +760 -0
- package/foundation/discovery/component-discovery.mjs +940 -57
- package/foundation/discovery/component-discovery.test.mjs +96 -0
- package/foundation/discovery/component-loader.d.mts +1 -1
- package/foundation/discovery/component-replacement.mjs +20 -1
- package/foundation/discovery/component-replacement.test.mjs +40 -0
- 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 +88 -0
- package/foundation/discovery/docs-discovery.mjs +97 -3
- 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/module-exports.d.mts +68 -0
- package/foundation/discovery/module-exports.mjs +609 -31
- package/foundation/discovery/module-exports.test.mjs +172 -0
- package/foundation/discovery/package-tsconfig.d.mts +14 -0
- package/foundation/discovery/package-tsconfig.mjs +228 -0
- package/foundation/discovery/package-tsconfig.test.mjs +210 -0
- package/foundation/discovery/project-typescript.d.mts +32 -0
- package/foundation/discovery/project-typescript.mjs +89 -0
- package/foundation/discovery/prop-drift.d.mts +297 -0
- package/foundation/discovery/prop-drift.mjs +2428 -0
- package/foundation/discovery/prop-drift.test.mjs +2337 -0
- 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-adapter.mjs +74 -5
- 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-match.d.mts +53 -0
- package/foundation/discovery/type-match.mjs +660 -0
- package/foundation/discovery/type-match.test.mjs +169 -0
- package/foundation/discovery/type-text.d.mts +68 -0
- package/foundation/discovery/type-text.mjs +658 -0
- package/foundation/discovery/type-text.test.mjs +196 -0
- package/foundation/discovery/unresolved-references.d.mts +62 -0
- package/foundation/discovery/unresolved-references.mjs +790 -0
- package/foundation/discovery/unresolved-references.test.mjs +567 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +59 -1
- package/foundation/doc-compiler/inputs.mjs +27 -1
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/links.d.mts +41 -5
- package/foundation/doc-compiler/links.mjs +167 -28
- 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 +158 -3
- package/foundation/fs/paths.test.mjs +10 -1
- package/foundation/integrations/computer-integrations.d.mts +81 -0
- package/foundation/integrations/computer-integrations.mjs +345 -0
- package/foundation/integrations/computer-integrations.test.mjs +292 -0
- package/foundation/integrations/contribution-inventory.d.mts +26 -20
- package/foundation/integrations/contribution-inventory.mjs +97 -8
- package/foundation/integrations/integration-warnings.mjs +3 -2
- package/foundation/integrations/integration-warnings.test.mjs +8 -9
- package/foundation/integrations/integrations.d.mts +32 -1
- package/foundation/integrations/integrations.mjs +48 -3
- package/foundation/integrations/issue.ts +6 -0
- package/foundation/integrations/validate-contributions.d.mts +98 -0
- package/foundation/integrations/validate-contributions.mjs +1037 -11
- 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 +79 -0
- package/foundation/release/handoff.e2e.test.mjs +278 -0
- package/foundation/release/handoff.mjs +524 -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 +163 -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/route/route.d.mts +285 -0
- package/foundation/route/route.mjs +324 -0
- package/foundation/route/route.test.mjs +153 -0
- package/foundation/runtime/hosted-runtime.test.mjs +403 -0
- package/foundation/runtime/locked-versions.d.mts +32 -0
- package/foundation/runtime/locked-versions.mjs +65 -0
- package/foundation/runtime/package-root.d.mts +91 -0
- package/foundation/runtime/package-root.mjs +174 -0
- package/foundation/runtime/package-set.d.mts +62 -0
- package/foundation/runtime/package-set.mjs +130 -0
- package/foundation/runtime/package-set.test.mjs +432 -0
- package/foundation/xle/browser-imports.test.mjs +74 -0
- package/foundation/xle/registry.mjs +4 -0
- package/foundation/xle/registry.test.mjs +28 -0
- package/host/door-conformance.test.mjs +274 -0
- package/host/index.d.ts +116 -0
- package/host/index.mjs +295 -0
- package/host/index.test.mjs +302 -0
- package/package.json +16 -11
- package/scripts/postinstall.mjs +24 -5
package/api/doctor/doctor.mjs
CHANGED
|
@@ -4,7 +4,11 @@
|
|
|
4
4
|
* @file Health-check engine for `astryx doctor`.
|
|
5
5
|
*
|
|
6
6
|
* Runs a series of diagnostic checks against the user's project and
|
|
7
|
-
* environment, returning a structured report.
|
|
7
|
+
* environment, returning a structured report. Outside a project it checks the
|
|
8
|
+
* computer instead (spec AST-081 FR4): the Node version, the release that
|
|
9
|
+
* answered, the newest release the computer knows of, and whether the
|
|
10
|
+
* computer-level agent text is present and current; no check fails because
|
|
11
|
+
* the folder has no project. Each check is a small,
|
|
8
12
|
* self-contained function that returns a {@link DoctorCheck} record, so
|
|
9
13
|
* adding a new diagnostic is just appending a function to {@link SYNC_CHECKS}.
|
|
10
14
|
*
|
|
@@ -24,9 +28,18 @@ import * as fs from 'node:fs';
|
|
|
24
28
|
import * as path from 'node:path';
|
|
25
29
|
|
|
26
30
|
import {MIN_NODE_VERSION, isNodeVersionSupported} from '../../foundation/env/node-version.mjs';
|
|
27
|
-
import {
|
|
28
|
-
|
|
29
|
-
|
|
31
|
+
import {
|
|
32
|
+
AGENT_DOC_PATHS,
|
|
33
|
+
holdsAstryxBlock,
|
|
34
|
+
} from '../../foundation/agent-docs/agent-doc-state.mjs';
|
|
35
|
+
import {
|
|
36
|
+
agentDocsTargetDir,
|
|
37
|
+
assertAgentDocsTarget,
|
|
38
|
+
resolveAgentDocsRoot,
|
|
39
|
+
} from '../../foundation/agent-docs/agent-docs.mjs';
|
|
40
|
+
import {CLI_ROOT, findProjectCoreDir, findInstalledPackage} from '../../foundation/fs/paths.mjs';
|
|
41
|
+
import {explainPackageManager, formatCliCommand, getCliInvocation, guessCliInvocation} from '../../foundation/env/package-manager.mjs';
|
|
42
|
+
import {chooseDeclaredCliCommand, declaredCliCommandsOf} from '../../foundation/env/cli-command.mjs';
|
|
30
43
|
import {
|
|
31
44
|
findConfigPath,
|
|
32
45
|
Project,
|
|
@@ -52,6 +65,8 @@ import {typedEdges} from '../docs/node/node.mjs';
|
|
|
52
65
|
import {detailView, indexView} from '../../foundation/doc-compiler/lenses.mjs';
|
|
53
66
|
import {semverCompare, isValidSemver, satisfiesRange} from '../../foundation/env/semver.mjs';
|
|
54
67
|
import {checkAppThemes, checkThemes} from './theme-checks.mjs';
|
|
68
|
+
import {availableLine, upgradeLine} from '../../foundation/release/notices.mjs';
|
|
69
|
+
import {alignCommand, addCliCommandFor, computerAgentTextState, installCommandFor, projectCoreVersion, projectHasOwnCli, computerIntegrationsOutside, computerIntegrationsToAdd, displayHomePath, outsideProject, releaseFacts} from './_adapter.mjs';
|
|
55
70
|
|
|
56
71
|
/**
|
|
57
72
|
* @typedef {'pass'|'warn'|'fail'|'info'} DoctorStatus
|
|
@@ -71,6 +86,10 @@ import {checkAppThemes, checkThemes} from './theme-checks.mjs';
|
|
|
71
86
|
* @property {string} cwd - Directory to diagnose.
|
|
72
87
|
* @property {string} nodeVersion - Running Node version.
|
|
73
88
|
* @property {string|null} coreDir - Resolved core package directory, or null.
|
|
89
|
+
* @property {boolean} [ownCli] - Whether the project installs its own CLI;
|
|
90
|
+
* false means the copy that started the run answered it (spec AST-081 FR2).
|
|
91
|
+
* @property {string|null} [projectCore] - The Core release the project names
|
|
92
|
+
* (installed, else locked, else declared), as the daily hint reads it.
|
|
74
93
|
* @property {string|null} configPath - Resolved astryx.config.mjs path, or null.
|
|
75
94
|
* @property {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]|null} [integrations]
|
|
76
95
|
* Every integration the project loaded, or null when the project could not be
|
|
@@ -229,7 +248,12 @@ export function checkCoreInstalled(ctx) {
|
|
|
229
248
|
* @returns {DoctorCheck}
|
|
230
249
|
*/
|
|
231
250
|
export function checkVersionAlignment(ctx) {
|
|
232
|
-
|
|
251
|
+
// A project with no CLI of its own and no Core installed yet (a fresh
|
|
252
|
+
// clone) is compared by the Core it locks or declares, as the daily hint
|
|
253
|
+
// compares it (spec AST-081 FR2).
|
|
254
|
+
const coreVersion =
|
|
255
|
+
pkgVersion(ctx.coreDir) ??
|
|
256
|
+
(ctx.ownCli === false ? (ctx.projectCore ?? null) : null);
|
|
233
257
|
const cliPkg = readPkg(path.join(CLI_ROOT, 'package.json'));
|
|
234
258
|
const cliVersion = cliPkg?.version ?? null;
|
|
235
259
|
|
|
@@ -258,25 +282,33 @@ export function checkVersionAlignment(ctx) {
|
|
|
258
282
|
};
|
|
259
283
|
}
|
|
260
284
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
285
|
+
// A project with no CLI of its own is answered by the copy that started
|
|
286
|
+
// the run (spec AST-081 FR2): say so, and how to add the CLI at Core's
|
|
287
|
+
// version.
|
|
288
|
+
if (ctx.ownCli === false) {
|
|
289
|
+
return {
|
|
290
|
+
id: 'version-alignment',
|
|
291
|
+
label: '@astryxdesign/core <-> @astryxdesign/cli alignment',
|
|
292
|
+
status: coreVersion === cliVersion ? 'info' : 'warn',
|
|
293
|
+
message:
|
|
294
|
+
coreVersion === cliVersion
|
|
295
|
+
? `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered and matches its Core.`
|
|
296
|
+
: `This project has no Astryx CLI installed; CLI ${cliVersion}, the one you started, answered while its Core is ${coreVersion}.`,
|
|
297
|
+
fix: `${coreVersion === cliVersion ? 'To pin it for the team and CI' : 'To match'}, run: ${addCliCommandFor(ctx.cwd, coreVersion)}.`,
|
|
298
|
+
};
|
|
299
|
+
}
|
|
300
|
+
// The project's own CLI answers this project whatever its version
|
|
301
|
+
// (spec AST-081 FR2), so any difference means templates, docs, and agent
|
|
302
|
+
// text come from one release and components from another.
|
|
303
|
+
const drift = coreVersion !== cliVersion;
|
|
265
304
|
return {
|
|
266
305
|
id: 'version-alignment',
|
|
267
306
|
label: '@astryxdesign/core <-> @astryxdesign/cli alignment',
|
|
268
307
|
status: drift ? 'warn' : 'pass',
|
|
269
308
|
message: drift
|
|
270
|
-
?
|
|
309
|
+
? `This project's CLI ${cliVersion} answers it, but its Core is ${coreVersion}: templates, docs, and agent text come from CLI ${cliVersion}, components from Core ${coreVersion}.`
|
|
271
310
|
: `@astryxdesign/core v${coreVersion} is in step with @astryxdesign/cli v${cliVersion}.`,
|
|
272
|
-
...(drift
|
|
273
|
-
? {
|
|
274
|
-
fix:
|
|
275
|
-
semverCompare(cliVersion, coreVersion) > 0
|
|
276
|
-
? `Update @astryxdesign/core to ${cliMajor}.${cliMinor}.x to match the CLI.`
|
|
277
|
-
: `Update @astryxdesign/cli to ${coreMajor}.${coreMinor}.x to match @astryxdesign/core.`,
|
|
278
|
-
}
|
|
279
|
-
: {}),
|
|
311
|
+
...(drift ? {fix: `To align them, run: ${alignCommand(ctx.cwd, cliVersion, coreVersion)}.`} : {}),
|
|
280
312
|
};
|
|
281
313
|
}
|
|
282
314
|
|
|
@@ -331,7 +363,7 @@ export async function checkConfig(ctx) {
|
|
|
331
363
|
label: 'astryx.config.mjs',
|
|
332
364
|
status: 'fail',
|
|
333
365
|
message: `astryx.config.mjs loads, but the CLI could not load the project from it: ${firstLine(ctx.projectError)}`,
|
|
334
|
-
fix:
|
|
366
|
+
fix: `Fix what the message names. \`${formatCliCommand('docs authoring config', ctx.cwd)}\` lists every field astryx.config accepts.`,
|
|
335
367
|
};
|
|
336
368
|
}
|
|
337
369
|
return {
|
|
@@ -351,6 +383,26 @@ export async function checkConfig(ctx) {
|
|
|
351
383
|
}
|
|
352
384
|
}
|
|
353
385
|
|
|
386
|
+
/**
|
|
387
|
+
* Why no integration is implicitly linked, from what actually loaded. A
|
|
388
|
+
* configured integration is named in astryx.config; the package's own manifest
|
|
389
|
+
* loads as itself (`__local`). Only the first may be described as named in
|
|
390
|
+
* astryx.config: a package with no config that loads its own manifest has no
|
|
391
|
+
* config file to name it.
|
|
392
|
+
*
|
|
393
|
+
* @param {Array<{name?: string, __local?: boolean}>} integrations loaded, none
|
|
394
|
+
* autolinked and none that failed to load
|
|
395
|
+
* @returns {string}
|
|
396
|
+
*/
|
|
397
|
+
function describeNoImplicit(integrations) {
|
|
398
|
+
const own = integrations.filter(integration => integration.__local);
|
|
399
|
+
const configured = integrations.length - own.length;
|
|
400
|
+
const ownNames = own.map(integration => integration.name ?? 'this package').join(', ');
|
|
401
|
+
if (own.length === 0) return 'None — every loaded integration is named in astryx.config.';
|
|
402
|
+
if (configured === 0) return `None — the only loaded integration is this package's own manifest (${ownNames}).`;
|
|
403
|
+
return `None — every loaded integration is named in astryx.config or is this package's own manifest (${ownNames}).`;
|
|
404
|
+
}
|
|
405
|
+
|
|
354
406
|
/**
|
|
355
407
|
* Check 6 — integrations that are loaded without an astryx.config entry.
|
|
356
408
|
*
|
|
@@ -395,14 +447,18 @@ export function checkImplicitIntegrations(ctx) {
|
|
|
395
447
|
const unreadable = describeUnreadableManifests(ctx.autolinkFailures ?? []);
|
|
396
448
|
|
|
397
449
|
if (implicit.length === 0) {
|
|
450
|
+
// A record that carries `__loadError` (the package's own manifest, or a
|
|
451
|
+
// configured one, that failed to load) loaded nothing, so it is not named
|
|
452
|
+
// as loaded beside the line reporting that it could not be loaded.
|
|
453
|
+
const loaded = ctx.integrations.filter(integration => !integration.__loadError);
|
|
398
454
|
return {
|
|
399
455
|
id,
|
|
400
456
|
label,
|
|
401
457
|
status: 'info',
|
|
402
458
|
message:
|
|
403
|
-
(
|
|
404
|
-
?
|
|
405
|
-
: unreadable
|
|
459
|
+
(loaded.length > 0
|
|
460
|
+
? describeNoImplicit(loaded)
|
|
461
|
+
: ctx.integrations.length > 0 || unreadable
|
|
406
462
|
? 'None loaded.'
|
|
407
463
|
: 'None — no installed dependency ships an astryx.integration.* manifest.') +
|
|
408
464
|
unreadable,
|
|
@@ -476,7 +532,7 @@ function describeUnreadableManifests(failures) {
|
|
|
476
532
|
return (
|
|
477
533
|
` ${failures.length} installed ${one ? 'dependency ships' : 'dependencies ship'} ` +
|
|
478
534
|
`an astryx.integration.* manifest that could not be loaded, so ${one ? 'it contributes' : 'they contribute'} ` +
|
|
479
|
-
`nothing: ${listed}. Run
|
|
535
|
+
`nothing: ${listed}. Run \`${formatCliCommand('doctor integration validate <package>')}\` for details.`
|
|
480
536
|
);
|
|
481
537
|
}
|
|
482
538
|
|
|
@@ -550,7 +606,7 @@ export function checkConfiguredIntegrations(ctx) {
|
|
|
550
606
|
`${withdrawn.length} of ${configured.length} integration${plural} named in astryx.config could not be loaded, ` +
|
|
551
607
|
`so ${withdrawn.length === 1 ? 'it contributes' : 'they contribute'} nothing: ${listed}.`,
|
|
552
608
|
fix:
|
|
553
|
-
|
|
609
|
+
`Install each one, fix its astryx.integration.* manifest (\`${formatCliCommand('doctor integration validate <package>', ctx.cwd)}\` says what is wrong), ` +
|
|
554
610
|
'or remove it from `integrations` in astryx.config.',
|
|
555
611
|
};
|
|
556
612
|
}
|
|
@@ -562,6 +618,21 @@ export function checkConfiguredIntegrations(ctx) {
|
|
|
562
618
|
};
|
|
563
619
|
}
|
|
564
620
|
|
|
621
|
+
/**
|
|
622
|
+
* Why init writes no agent docs for `cwd`, or null when it does: the folder
|
|
623
|
+
* it would write to is the home folder or the top of a settings folder in it.
|
|
624
|
+
* @param {string} cwd
|
|
625
|
+
* @returns {string | null}
|
|
626
|
+
*/
|
|
627
|
+
function agentDocsRefusal(cwd) {
|
|
628
|
+
try {
|
|
629
|
+
assertAgentDocsTarget(agentDocsTargetDir(cwd));
|
|
630
|
+
return null;
|
|
631
|
+
} catch (err) {
|
|
632
|
+
return err instanceof Error && err.name === 'AgentDocsHomeError' ? err.message : null;
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
565
636
|
/**
|
|
566
637
|
* Check 7 — agent docs exist and contain the Astryx section markers.
|
|
567
638
|
* @param {DoctorContext} ctx
|
|
@@ -569,8 +640,15 @@ export function checkConfiguredIntegrations(ctx) {
|
|
|
569
640
|
*/
|
|
570
641
|
export function checkAgentDocs(ctx) {
|
|
571
642
|
// Every file init can write (one shared list), looked for in the working
|
|
572
|
-
// directory
|
|
573
|
-
|
|
643
|
+
// directory, the project root, and the folder init writes them to: run from
|
|
644
|
+
// src/ or a nested package, the docs sit at the root.
|
|
645
|
+
const dirs = [
|
|
646
|
+
...new Set(
|
|
647
|
+
[ctx.cwd, projectRootOf(ctx), resolveAgentDocsRoot(ctx.cwd) ?? ctx.cwd].map(dir =>
|
|
648
|
+
path.resolve(dir),
|
|
649
|
+
),
|
|
650
|
+
),
|
|
651
|
+
];
|
|
574
652
|
const present = dirs.flatMap(dir =>
|
|
575
653
|
AGENT_DOC_PATHS.map(rel => path.join(dir, rel)).filter(abs =>
|
|
576
654
|
fs.existsSync(abs),
|
|
@@ -578,6 +656,15 @@ export function checkAgentDocs(ctx) {
|
|
|
578
656
|
);
|
|
579
657
|
/** @param {string} abs */
|
|
580
658
|
const shown = abs => path.relative(ctx.cwd, abs) || path.basename(abs);
|
|
659
|
+
// In the home folder, or at the top of a settings folder in it, init
|
|
660
|
+
// writes no agent docs (INV31), so the fix is moving the project or a hand
|
|
661
|
+
// edit, never init.
|
|
662
|
+
const refusal = agentDocsRefusal(ctx.cwd);
|
|
663
|
+
/** @param {string} initFix */
|
|
664
|
+
const fixFor = initFix =>
|
|
665
|
+
refusal
|
|
666
|
+
? `${refusal} Move the project into a folder of its own, or edit the Astryx block in its agent file by hand.`
|
|
667
|
+
: initFix;
|
|
581
668
|
|
|
582
669
|
if (present.length === 0) {
|
|
583
670
|
return {
|
|
@@ -585,29 +672,64 @@ export function checkAgentDocs(ctx) {
|
|
|
585
672
|
label: 'AI agent docs',
|
|
586
673
|
status: 'info',
|
|
587
674
|
message: `No agent docs found: looked for ${AGENT_DOC_PATHS.join(', ')} in ${dirs.map(dir => path.relative(ctx.cwd, dir) || '.').join(' and ')}.`,
|
|
588
|
-
fix:
|
|
675
|
+
fix: fixFor(
|
|
676
|
+
`Generate agent docs with \`${getCliInvocation(ctx.cwd)} init --features agents\`.`,
|
|
677
|
+
),
|
|
589
678
|
};
|
|
590
679
|
}
|
|
591
680
|
|
|
592
|
-
|
|
681
|
+
/** @param {string} abs */
|
|
682
|
+
const read = abs => {
|
|
593
683
|
try {
|
|
594
|
-
|
|
595
|
-
return (
|
|
596
|
-
(content.includes('<!-- ASTRYX:START -->') || content.includes('<!-- XDS:START -->')) &&
|
|
597
|
-
(content.includes('<!-- ASTRYX:END -->') || content.includes('<!-- XDS:END -->'))
|
|
598
|
-
);
|
|
684
|
+
return fs.readFileSync(abs, 'utf-8');
|
|
599
685
|
} catch {
|
|
600
|
-
return
|
|
686
|
+
return '';
|
|
601
687
|
}
|
|
688
|
+
};
|
|
689
|
+
const withMarkers = present.filter(abs => {
|
|
690
|
+
const content = read(abs);
|
|
691
|
+
return (
|
|
692
|
+
(content.includes('<!-- ASTRYX:START -->') || content.includes('<!-- XDS:START -->')) &&
|
|
693
|
+
(content.includes('<!-- ASTRYX:END -->') || content.includes('<!-- XDS:END -->')) &&
|
|
694
|
+
holdsAstryxBlock(content)
|
|
695
|
+
);
|
|
602
696
|
});
|
|
603
697
|
|
|
698
|
+
// A managed block that only imports another file (init's GEMINI.md import
|
|
699
|
+
// of AGENTS.md) is broken when that file holds no block: the agents that
|
|
700
|
+
// read either file get no Astryx docs.
|
|
701
|
+
const dangling = present.flatMap(abs => {
|
|
702
|
+
const match = /<!-- ASTRYX:START -->\s*@(\S+)\s*<!-- ASTRYX:END -->/.exec(read(abs));
|
|
703
|
+
if (match == null) return [];
|
|
704
|
+
const target = path.resolve(path.dirname(abs), match[1]);
|
|
705
|
+
return holdsAstryxBlock(read(target)) ? [] : [{abs, target}];
|
|
706
|
+
});
|
|
707
|
+
if (dangling.length > 0) {
|
|
708
|
+
return {
|
|
709
|
+
id: 'agent-docs',
|
|
710
|
+
label: 'AI agent docs',
|
|
711
|
+
status: 'fail',
|
|
712
|
+
message: dangling
|
|
713
|
+
.map(
|
|
714
|
+
({abs, target}) =>
|
|
715
|
+
`${shown(abs)} imports ${shown(target)}, which holds no Astryx block, so agents that read them get no Astryx docs.`,
|
|
716
|
+
)
|
|
717
|
+
.join(' '),
|
|
718
|
+
fix: fixFor(
|
|
719
|
+
`Write the block again with \`${getCliInvocation(ctx.cwd)} init --features agents\`.`,
|
|
720
|
+
),
|
|
721
|
+
};
|
|
722
|
+
}
|
|
723
|
+
|
|
604
724
|
if (withMarkers.length === 0) {
|
|
605
725
|
return {
|
|
606
726
|
id: 'agent-docs',
|
|
607
727
|
label: 'AI agent docs',
|
|
608
728
|
status: 'warn',
|
|
609
729
|
message: `Agent docs present (${present.map(shown).join(', ')}) but no Astryx section markers found.`,
|
|
610
|
-
fix:
|
|
730
|
+
fix: fixFor(
|
|
731
|
+
`Add the Astryx section to your agent docs with \`${getCliInvocation(ctx.cwd)} init --features agents\`.`,
|
|
732
|
+
),
|
|
611
733
|
};
|
|
612
734
|
}
|
|
613
735
|
|
|
@@ -748,7 +870,7 @@ export function checkIntegrationIssues(ctx) {
|
|
|
748
870
|
label: 'Integration contributions',
|
|
749
871
|
status: 'warn',
|
|
750
872
|
message: `${issues.length} integration issue(s)${errors > 0 ? `, ${errors} of them errors` : ''}: ${details}`,
|
|
751
|
-
fix:
|
|
873
|
+
fix: `Run \`${formatCliCommand('doctor integration', ctx.cwd)}\` for package-specific diagnostics and resolve cross-package precedence in astryx.config.`,
|
|
752
874
|
};
|
|
753
875
|
}
|
|
754
876
|
|
|
@@ -954,7 +1076,7 @@ function surfaceProblems(surface) {
|
|
|
954
1076
|
const problems = [];
|
|
955
1077
|
if (surface.types === 0 && surface.untraced.length === 0) {
|
|
956
1078
|
problems.push(
|
|
957
|
-
|
|
1079
|
+
`@astryxdesign/cli/authoring exports no types, so nothing was compared with \`${formatCliCommand('docs authoring')}\``,
|
|
958
1080
|
);
|
|
959
1081
|
}
|
|
960
1082
|
for (const {module, names, reason, source, key} of surface.unreadable) {
|
|
@@ -967,7 +1089,7 @@ function surfaceProblems(surface) {
|
|
|
967
1089
|
? `${source} does not load`
|
|
968
1090
|
: `${source} renders section "${key}", which the topic's index does not list`;
|
|
969
1091
|
problems.push(
|
|
970
|
-
`${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in
|
|
1092
|
+
`${nameTypes(names)} from ${module} ${names.length === 1 ? 'has' : 'have'} no doc in \`${formatCliCommand('docs authoring')}\`: ${why}`,
|
|
971
1093
|
);
|
|
972
1094
|
}
|
|
973
1095
|
for (const {name, reason} of surface.untraced) {
|
|
@@ -1008,7 +1130,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
|
|
|
1008
1130
|
const audit = await auditAuthoringSelfDocs({root, sources});
|
|
1009
1131
|
const problems = [
|
|
1010
1132
|
...audit.unreachable.map(
|
|
1011
|
-
source => `${source} is not in
|
|
1133
|
+
source => `${source} is not in \`${formatCliCommand('docs authoring')}\``,
|
|
1012
1134
|
),
|
|
1013
1135
|
...audit.failed.map(
|
|
1014
1136
|
({source, error}) => `${source} failed to load: ${error}`,
|
|
@@ -1024,7 +1146,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
|
|
|
1024
1146
|
: {keys: options.topicKeys};
|
|
1025
1147
|
const surface = [
|
|
1026
1148
|
...('error' in topic
|
|
1027
|
-
? [
|
|
1149
|
+
? [`\`${formatCliCommand('docs authoring')}\` could not be read: ${topic.error}`]
|
|
1028
1150
|
: []),
|
|
1029
1151
|
...surfaceProblems(
|
|
1030
1152
|
await auditAuthoringSurface({root, sources, topicKeys: topic.keys}),
|
|
@@ -1048,7 +1170,7 @@ export async function checkAuthoringDocs(_ctx, options = {}) {
|
|
|
1048
1170
|
id,
|
|
1049
1171
|
label,
|
|
1050
1172
|
status: 'pass',
|
|
1051
|
-
message: `All ${audit.sections} authoring schemas are readable in
|
|
1173
|
+
message: `All ${audit.sections} authoring schemas are readable in \`${formatCliCommand('docs authoring')}\`.`,
|
|
1052
1174
|
};
|
|
1053
1175
|
} catch (err) {
|
|
1054
1176
|
return {
|
|
@@ -1088,11 +1210,11 @@ export async function checkCliDocs(_ctx, options = {}) {
|
|
|
1088
1210
|
const problems = [
|
|
1089
1211
|
...audit.missing.map(
|
|
1090
1212
|
source =>
|
|
1091
|
-
`${source} has no namespace, so no
|
|
1213
|
+
`${source} has no namespace, so no \`${formatCliCommand('docs')}\` topic reads it`,
|
|
1092
1214
|
),
|
|
1093
1215
|
...audit.unknown.map(
|
|
1094
1216
|
({source, namespace}) =>
|
|
1095
|
-
`${source} has namespace "${namespace}", which no
|
|
1217
|
+
`${source} has namespace "${namespace}", which no \`${formatCliCommand('docs')}\` topic reads`,
|
|
1096
1218
|
),
|
|
1097
1219
|
...audit.misfiled.map(({message}) => message),
|
|
1098
1220
|
...audit.failed.map(
|
|
@@ -1116,7 +1238,7 @@ export async function checkCliDocs(_ctx, options = {}) {
|
|
|
1116
1238
|
id,
|
|
1117
1239
|
label,
|
|
1118
1240
|
status: 'pass',
|
|
1119
|
-
message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the
|
|
1241
|
+
message: `All ${audit.docs} CLI docs are readable: ${audit.tree} in the \`${formatCliCommand('docs cli')}\` tree and ${audit.authoring} in \`${formatCliCommand('docs authoring')}\`.`,
|
|
1120
1242
|
};
|
|
1121
1243
|
} catch (err) {
|
|
1122
1244
|
return {
|
|
@@ -1278,6 +1400,423 @@ export async function checkDocsProgressiveDisclosure(ctx) {
|
|
|
1278
1400
|
};
|
|
1279
1401
|
}
|
|
1280
1402
|
|
|
1403
|
+
/**
|
|
1404
|
+
* Check 11 — the command every printed command starts with, and a warning when
|
|
1405
|
+
* loaded integrations declare different ones (their `cliCommand`). Then the
|
|
1406
|
+
* picker uses neither, so commands fall back to the package-manager guess.
|
|
1407
|
+
*
|
|
1408
|
+
* @param {DoctorContext} ctx
|
|
1409
|
+
* @returns {DoctorCheck}
|
|
1410
|
+
*/
|
|
1411
|
+
export function checkCliCommand(ctx) {
|
|
1412
|
+
const id = 'cli-command';
|
|
1413
|
+
const label = 'CLI command';
|
|
1414
|
+
const {command, conflict, declared} = chooseDeclaredCliCommand(
|
|
1415
|
+
declaredCliCommandsOf(ctx.integrations ?? []),
|
|
1416
|
+
);
|
|
1417
|
+
if (conflict) {
|
|
1418
|
+
const claims = declared
|
|
1419
|
+
.map(entry => `${entry.package} (\`${entry.command}\`)`)
|
|
1420
|
+
.join(', ');
|
|
1421
|
+
return {
|
|
1422
|
+
id,
|
|
1423
|
+
label,
|
|
1424
|
+
status: 'warn',
|
|
1425
|
+
message: `Loaded integrations declare different CLI commands: ${claims}. Neither is used, so printed commands start with \`${guessCliInvocation(ctx.cwd)}\`.`,
|
|
1426
|
+
fix: 'Remove the integration that does not belong here, or have every package declare the same `cliCommand` in its astryx.integration manifest.',
|
|
1427
|
+
};
|
|
1428
|
+
}
|
|
1429
|
+
if (command) {
|
|
1430
|
+
const packages = declared.map(entry => entry.package).join(', ');
|
|
1431
|
+
return {
|
|
1432
|
+
id,
|
|
1433
|
+
label,
|
|
1434
|
+
status: 'pass',
|
|
1435
|
+
message: `Printed commands start with \`${command}\`, the cliCommand of ${packages}.`,
|
|
1436
|
+
};
|
|
1437
|
+
}
|
|
1438
|
+
return {
|
|
1439
|
+
id,
|
|
1440
|
+
label,
|
|
1441
|
+
status: 'info',
|
|
1442
|
+
message: `No loaded integration declares a cliCommand, so printed commands start with \`${getCliInvocation(ctx.cwd)}\`.`,
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1445
|
+
|
|
1446
|
+
/* ── outside a project: the computer ─────────────────────────────────── */
|
|
1447
|
+
|
|
1448
|
+
/**
|
|
1449
|
+
* What a computer check reads: the running Node, the release that answered
|
|
1450
|
+
* (`meta.answeredBy`), and the newest release the computer knows of.
|
|
1451
|
+
* @typedef {object} ComputerContext
|
|
1452
|
+
* @property {string} nodeVersion
|
|
1453
|
+
* @property {{cli: string, core: string | null, copy: string}} answeredBy
|
|
1454
|
+
* @property {string | null} latest the newest release known, or null
|
|
1455
|
+
* @property {Array<{path: string, state: import('../../foundation/agent-docs/computer-agent-text.mjs').ComputerAgentTextState}>} [agentText]
|
|
1456
|
+
* each file of the computer-level agent text against this release's rendering
|
|
1457
|
+
* @property {import('../../foundation/env/user-settings.mjs').ComputerAgentTextSettings} [agentTextSettings]
|
|
1458
|
+
* the person's choices about the computer-level agent text
|
|
1459
|
+
* @property {string} [cwd] the folder doctor runs in, for the printed fix
|
|
1460
|
+
* @property {import('../../foundation/release/notices.mjs').GlobalBehind | null} [globalBehind]
|
|
1461
|
+
* the CLI installed for the computer, when it is older than the newest
|
|
1462
|
+
* release (outside a project)
|
|
1463
|
+
* @property {import('../../foundation/release/notices.mjs').ProjectLag | null} [projectLag]
|
|
1464
|
+
* the project's release, when it is behind the newest (inside a project)
|
|
1465
|
+
* @property {{key: string, reason: string, at: number} | null} [lastNoticeSkip]
|
|
1466
|
+
* @property {{at: number, reason: string} | null} [lastCheckFailure] why the
|
|
1467
|
+
* last update check did not reach the registry, after the last that did
|
|
1468
|
+
* the newest update notice that did not print, and why (diagnostic only)
|
|
1469
|
+
* @property {{pid: number | null, host: string | null, since: number} | null} [stateLock]
|
|
1470
|
+
* who holds the state file's lock now (diagnostic only)
|
|
1471
|
+
* @property {Array<import('../../foundation/env/search-path.mjs').SearchPathCommand & {upgrade?: string | null}>} [searchPathCommands]
|
|
1472
|
+
* every `astryx` on the search path, with the command that upgrades it
|
|
1473
|
+
* the `astryx` commands on the search path, in order
|
|
1474
|
+
* @property {import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[]} [computerIntegrations]
|
|
1475
|
+
* the integrations installed beside the running CLI
|
|
1476
|
+
* @property {string[]} [loadedComputerIntegrations] the names of those that
|
|
1477
|
+
* loaded outside a project
|
|
1478
|
+
* @property {string[]} [folderIntegrations] the names of the integrations the
|
|
1479
|
+
* folder loads itself, whose copies win over the computer's
|
|
1480
|
+
*/
|
|
1481
|
+
|
|
1482
|
+
/**
|
|
1483
|
+
* The release that answered this run outside a project, and the Core it
|
|
1484
|
+
* reads from.
|
|
1485
|
+
* @param {ComputerContext} ctx
|
|
1486
|
+
* @returns {DoctorCheck}
|
|
1487
|
+
*/
|
|
1488
|
+
export function checkAnsweringRelease(ctx) {
|
|
1489
|
+
const {cli, core} = ctx.answeredBy;
|
|
1490
|
+
return {
|
|
1491
|
+
id: 'answering-release',
|
|
1492
|
+
label: 'Release that answered',
|
|
1493
|
+
status: core ? 'pass' : 'info',
|
|
1494
|
+
message: `${
|
|
1495
|
+
core
|
|
1496
|
+
? `CLI ${cli} with Core ${core} answered, outside a project.`
|
|
1497
|
+
: `CLI ${cli} answered, outside a project. It installs Core ${cli} into the per-user cache the first time a command needs it.`
|
|
1498
|
+
} How each folder is answered: \`${formatCliCommand('astryx docs global', ctx.cwd)}\`.`,
|
|
1499
|
+
};
|
|
1500
|
+
}
|
|
1501
|
+
|
|
1502
|
+
/**
|
|
1503
|
+
* The newest release this computer knows of, beside the one that answered
|
|
1504
|
+
* (spec AST-081 FR10). Runs inside and outside a project, and is always
|
|
1505
|
+
* info. Inside one, a release behind the newest names the install and
|
|
1506
|
+
* upgrade commands; outside one, a CLI installed for the computer that is
|
|
1507
|
+
* behind names the command of the package manager that installed it, after
|
|
1508
|
+
* the Node it needs when the computer runs an older one. Doctor installs
|
|
1509
|
+
* nothing.
|
|
1510
|
+
* @param {ComputerContext} ctx
|
|
1511
|
+
* @returns {DoctorCheck}
|
|
1512
|
+
*/
|
|
1513
|
+
export function checkNewestRelease(ctx) {
|
|
1514
|
+
const check = newestReleaseCheck(ctx);
|
|
1515
|
+
const notes = [
|
|
1516
|
+
checkFailureNote(ctx.lastCheckFailure),
|
|
1517
|
+
skipNote(ctx.lastNoticeSkip),
|
|
1518
|
+
lockNote(ctx.stateLock),
|
|
1519
|
+
].filter(Boolean);
|
|
1520
|
+
return notes.length > 0 ? {...check, message: [check.message, ...notes].join(' ')} : check;
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
/**
|
|
1524
|
+
* The note on a state-file lock held right now, which keeps notices from
|
|
1525
|
+
* being recorded (diagnostic only).
|
|
1526
|
+
* @param {{pid: number | null, host: string | null, since: number} | null | undefined} lock
|
|
1527
|
+
* @returns {string | null}
|
|
1528
|
+
*/
|
|
1529
|
+
function lockNote(lock) {
|
|
1530
|
+
if (!lock) return null;
|
|
1531
|
+
const by = lock.pid == null ? '' : ` by process ${lock.pid}${lock.host ? ` on ${lock.host}` : ''}`;
|
|
1532
|
+
return `The state file's lock is held${by} since ${new Date(lock.since).toISOString()}.`;
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
/**
|
|
1536
|
+
* The note on an update check that did not reach the registry (diagnostic
|
|
1537
|
+
* only): no check, no notices.
|
|
1538
|
+
* @param {{at: number, reason: string} | null | undefined} failed
|
|
1539
|
+
* @returns {string | null}
|
|
1540
|
+
*/
|
|
1541
|
+
function checkFailureNote(failed) {
|
|
1542
|
+
if (!failed) return null;
|
|
1543
|
+
const why =
|
|
1544
|
+
failed.reason === 'npm-missing'
|
|
1545
|
+
? 'npm could not be started'
|
|
1546
|
+
: failed.reason === 'bad-reply'
|
|
1547
|
+
? "npm's answer named no release"
|
|
1548
|
+
: failed.reason.startsWith('npm-failed: ')
|
|
1549
|
+
? `npm failed (${failed.reason.slice('npm-failed: '.length)}); its registry and proxy settings decide where it asks`
|
|
1550
|
+
: failed.reason;
|
|
1551
|
+
return `The last update check, ${new Date(failed.at).toISOString()}, did not reach the registry: ${why}.`;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
/** What a recorded notice skip's reason means, for doctor's update line. */
|
|
1555
|
+
const SKIP_REASONS = {
|
|
1556
|
+
'already-shown': 'it had already printed that day',
|
|
1557
|
+
'no-newer': 'no newer release was known',
|
|
1558
|
+
};
|
|
1559
|
+
|
|
1560
|
+
/**
|
|
1561
|
+
* The note on the last update notice that did not print, for diagnosis
|
|
1562
|
+
* (diagnostic state, not a contract).
|
|
1563
|
+
* @param {{key: string, reason: string, at: number} | null | undefined} skip
|
|
1564
|
+
* @returns {string | null}
|
|
1565
|
+
*/
|
|
1566
|
+
function skipNote(skip) {
|
|
1567
|
+
if (!skip) return null;
|
|
1568
|
+
const why = /** @type {Record<string, string>} */ (SKIP_REASONS)[skip.reason] ?? skip.reason;
|
|
1569
|
+
return `Last update notice skipped ${new Date(skip.at).toISOString()} (${skip.key}): ${why}.`;
|
|
1570
|
+
}
|
|
1571
|
+
|
|
1572
|
+
/**
|
|
1573
|
+
* {@link checkNewestRelease} without the skip note.
|
|
1574
|
+
* @param {ComputerContext} ctx
|
|
1575
|
+
* @returns {DoctorCheck}
|
|
1576
|
+
*/
|
|
1577
|
+
function newestReleaseCheck(ctx) {
|
|
1578
|
+
const {latest, globalBehind: behind, projectLag: lag} = ctx;
|
|
1579
|
+
const {cli} = ctx.answeredBy;
|
|
1580
|
+
const base = {id: 'newest-release', label: 'Newest release', status: /** @type {const} */ ('info')};
|
|
1581
|
+
if (behind) {
|
|
1582
|
+
return {
|
|
1583
|
+
...base,
|
|
1584
|
+
message: `${availableLine(behind.current, behind.newest)}. The CLI installed for the computer stays on its release until you upgrade it.`,
|
|
1585
|
+
fix: `${upgradeLine(behind.command, behind.node)}.`,
|
|
1586
|
+
};
|
|
1587
|
+
}
|
|
1588
|
+
if (lag) {
|
|
1589
|
+
return {
|
|
1590
|
+
...base,
|
|
1591
|
+
message: `This project uses Astryx ${lag.current}; ${lag.newest} is the newest.`,
|
|
1592
|
+
fix: `${upgradeLine(`${lag.install}, then ${lag.upgrade}`, lag.node)}.`,
|
|
1593
|
+
};
|
|
1594
|
+
}
|
|
1595
|
+
if (!latest) {
|
|
1596
|
+
return {
|
|
1597
|
+
...base,
|
|
1598
|
+
message: 'Update check: not run yet, so the newest release is not known here; it runs in the background once a day, after a command.',
|
|
1599
|
+
};
|
|
1600
|
+
}
|
|
1601
|
+
if (isValidSemver(latest) && isValidSemver(cli) && semverCompare(latest, cli) > 0) {
|
|
1602
|
+
return {
|
|
1603
|
+
...base,
|
|
1604
|
+
message: `Release ${latest} is newer than ${cli}, the release that answered.`,
|
|
1605
|
+
};
|
|
1606
|
+
}
|
|
1607
|
+
return {...base, message: `No newer release is known: the newest is ${latest}.`};
|
|
1608
|
+
}
|
|
1609
|
+
|
|
1610
|
+
/**
|
|
1611
|
+
* The `astryx` commands on the search path (spec AST-081 FR11): the first is
|
|
1612
|
+
* the one a shell runs. Warns when it is not the Astryx CLI, or is a release
|
|
1613
|
+
* that predates the hand-off and so answers every folder itself.
|
|
1614
|
+
* @param {ComputerContext} ctx
|
|
1615
|
+
* @returns {DoctorCheck}
|
|
1616
|
+
*/
|
|
1617
|
+
export function checkCliOnPath(ctx) {
|
|
1618
|
+
const rows = ctx.searchPathCommands ?? [];
|
|
1619
|
+
const base = {id: 'cli-on-path', label: '`astryx` on the search path'};
|
|
1620
|
+
const describe = (/** @type {import('../../foundation/env/search-path.mjs').SearchPathCommand} */ row) =>
|
|
1621
|
+
row.astryx ? `${row.file} (CLI ${row.version ?? 'of unknown version'})` : `${row.file} (not the Astryx CLI)`;
|
|
1622
|
+
const others = rows.slice(1);
|
|
1623
|
+
const othersNote = others.length > 0 ? ` Later on the search path: ${others.map(describe).join(', ')}.` : '';
|
|
1624
|
+
const [first] = rows;
|
|
1625
|
+
if (!first) {
|
|
1626
|
+
return {
|
|
1627
|
+
...base,
|
|
1628
|
+
status: 'info',
|
|
1629
|
+
message: 'No `astryx` command on the search path, so `astryx` runs only through a package manager.',
|
|
1630
|
+
fix: 'To run the CLI in any folder, install it for the computer: `npm i -g @astryxdesign/cli`.',
|
|
1631
|
+
};
|
|
1632
|
+
}
|
|
1633
|
+
if (!first.astryx) {
|
|
1634
|
+
return {
|
|
1635
|
+
...base,
|
|
1636
|
+
status: 'warn',
|
|
1637
|
+
message: `The first \`astryx\` on the search path, ${first.file}, is not the Astryx CLI, so \`astryx\` runs another program.${othersNote}`,
|
|
1638
|
+
fix: 'Remove that program from the search path, or put the folder of the CLI installed for the computer before it.',
|
|
1639
|
+
};
|
|
1640
|
+
}
|
|
1641
|
+
if (first.handsOff === false) {
|
|
1642
|
+
return {
|
|
1643
|
+
...base,
|
|
1644
|
+
status: 'warn',
|
|
1645
|
+
message: `The first \`astryx\` on the search path, ${first.file}, runs CLI ${first.version ?? 'of unknown version'}, which predates the hand-off and answers every folder itself.${othersNote}`,
|
|
1646
|
+
fix: `To upgrade, run: \`${first.upgrade ?? 'npm i -g @astryxdesign/cli@latest'}\`.`,
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
return {
|
|
1650
|
+
...base,
|
|
1651
|
+
status: 'pass',
|
|
1652
|
+
message: `\`astryx\` runs ${describe(first)}.${othersNote}`,
|
|
1653
|
+
};
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
/**
|
|
1657
|
+
* The computer-level agent text (spec AST-081 FR4, FR8): turned off, present
|
|
1658
|
+
* and equal to this release's rendering, present but different, or absent,
|
|
1659
|
+
* for the files the chosen agents read. Always `info`: the text is optional,
|
|
1660
|
+
* so it never warns or fails. A file Astryx did not write counts as absent,
|
|
1661
|
+
* and a file a person edited is named; both are kept as they are.
|
|
1662
|
+
* @param {ComputerContext} ctx
|
|
1663
|
+
* @returns {DoctorCheck}
|
|
1664
|
+
*/
|
|
1665
|
+
export function checkComputerAgentText(ctx) {
|
|
1666
|
+
const state = ctx.agentTextSettings && ctx.agentText ? null : computerAgentTextState();
|
|
1667
|
+
const settings = ctx.agentTextSettings ?? /** @type {NonNullable<typeof state>} */ (state).settings;
|
|
1668
|
+
const base = {
|
|
1669
|
+
id: 'computer-agent-text',
|
|
1670
|
+
label: 'Computer-level agent text',
|
|
1671
|
+
status: /** @type {const} */ ('info'),
|
|
1672
|
+
};
|
|
1673
|
+
if (!settings.install) {
|
|
1674
|
+
return {
|
|
1675
|
+
...base,
|
|
1676
|
+
message: 'The computer-level agent text is turned off (`astryx init --user --remove-agents`), so the CLI installed for the computer does not write it.',
|
|
1677
|
+
fix: `To turn it back on, run \`${formatCliCommand('astryx init --user', ctx.cwd)}\`.`,
|
|
1678
|
+
};
|
|
1679
|
+
}
|
|
1680
|
+
const entries = ctx.agentText ?? /** @type {NonNullable<typeof state>} */ (state).entries;
|
|
1681
|
+
const fix = `Run \`${formatCliCommand('astryx init --user', ctx.cwd)}\`.`;
|
|
1682
|
+
const [file, ...links] = entries;
|
|
1683
|
+
const home = (/** @type {{path: string}} */ e) => displayHomePath(e.path);
|
|
1684
|
+
const linked = links.filter(l => l.state === 'linked').map(home);
|
|
1685
|
+
const copied = links.filter(l => l.state === 'current').map(home);
|
|
1686
|
+
const skipped = links.filter(l => l.state === 'foreign' || l.state === 'edited').map(home);
|
|
1687
|
+
const dangling = links.filter(l => l.state === 'dangling').map(home);
|
|
1688
|
+
const missing = links.filter(l => l.state === 'absent' || l.state === 'differs').map(home);
|
|
1689
|
+
const linkNote =
|
|
1690
|
+
(linked.length > 0 ? ` Linked into: ${linked.join(', ')}.` : '') +
|
|
1691
|
+
(copied.length > 0 ? ` Copied into: ${copied.join(', ')}.` : '') +
|
|
1692
|
+
(skipped.length > 0 ? ` Not linked, because something Astryx did not create is there: ${skipped.join(', ')}.` : '') +
|
|
1693
|
+
(dangling.length > 0 ? ` Linked, but the skill folder the link points to is not there, so agents reading it see nothing (as in a container that mounts only that folder): ${dangling.join(', ')}.` : '') +
|
|
1694
|
+
(missing.length > 0 ? ` Not linked yet: ${missing.join(', ')}.` : '');
|
|
1695
|
+
if (file.state === 'foreign' || file.state === 'edited') {
|
|
1696
|
+
return {
|
|
1697
|
+
...base,
|
|
1698
|
+
message: `${home(file)} ${file.state === 'edited' ? 'was edited since Astryx wrote it' : 'was not written by Astryx'}, so it is left as it is (delete it to get the current text).${linkNote}`,
|
|
1699
|
+
};
|
|
1700
|
+
}
|
|
1701
|
+
if (file.state === 'absent') {
|
|
1702
|
+
return {
|
|
1703
|
+
...base,
|
|
1704
|
+
message: `No computer-level agent text: agents outside a project with Astryx agent docs do not know Astryx is here.${linkNote}`,
|
|
1705
|
+
fix,
|
|
1706
|
+
};
|
|
1707
|
+
}
|
|
1708
|
+
const current = file.state === 'current';
|
|
1709
|
+
return {
|
|
1710
|
+
...base,
|
|
1711
|
+
message: `${current ? 'The computer-level agent text matches this release' : "The computer-level agent text differs from this release's"}: ${home(file)}.${linkNote}`,
|
|
1712
|
+
...(!current || missing.length > 0 || dangling.length > 0 ? {fix} : {}),
|
|
1713
|
+
};
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* The integrations installed for the computer (spec AST-081 FR12). Outside a
|
|
1718
|
+
* project: each one that loads, and a warning for each that is skipped
|
|
1719
|
+
* because its peer ranges exclude the answering release, or fails to load.
|
|
1720
|
+
* @param {ComputerContext} ctx
|
|
1721
|
+
* @returns {DoctorCheck}
|
|
1722
|
+
*/
|
|
1723
|
+
export function checkComputerIntegrations(ctx) {
|
|
1724
|
+
const found = ctx.computerIntegrations ?? [];
|
|
1725
|
+
const loaded = new Set(ctx.loadedComputerIntegrations ?? []);
|
|
1726
|
+
const base = {id: 'computer-integrations', label: 'Integrations installed for this computer'};
|
|
1727
|
+
if (found.length === 0) {
|
|
1728
|
+
return {
|
|
1729
|
+
...base,
|
|
1730
|
+
status: 'info',
|
|
1731
|
+
message: 'No integration is installed beside the CLI installed for this computer.',
|
|
1732
|
+
};
|
|
1733
|
+
}
|
|
1734
|
+
const label = (/** @type {{name: string, version?: string}} */ c) => (c.version ? `${c.name}@${c.version}` : c.name);
|
|
1735
|
+
const own = new Set(ctx.folderIntegrations ?? []);
|
|
1736
|
+
const shadowed = found.filter(c => own.has(c.name));
|
|
1737
|
+
const rest = found.filter(c => !own.has(c.name));
|
|
1738
|
+
const used = rest.filter(c => !c.incompatible && loaded.has(c.name));
|
|
1739
|
+
const skipped = rest.filter(c => c.incompatible);
|
|
1740
|
+
const failed = rest.filter(c => !c.incompatible && !loaded.has(c.name));
|
|
1741
|
+
const notes = [
|
|
1742
|
+
used.length > 0 ? `Used outside a project: ${used.map(label).join(', ')}.` : '',
|
|
1743
|
+
...shadowed.map(c => `${label(c)} is not used here: this folder loads its own copy of ${c.name}.`),
|
|
1744
|
+
...skipped.map(c => `Skipped ${label(c)}: ${c.incompatible}.`),
|
|
1745
|
+
...failed.map(c => `${label(c)} could not be loaded.`),
|
|
1746
|
+
].filter(Boolean);
|
|
1747
|
+
const fixes = [
|
|
1748
|
+
...skipped.map(c => `install a release of ${c.name} that supports this CLI`),
|
|
1749
|
+
...failed.map(c => `run \`${formatCliCommand(`astryx doctor integration validate ${c.name}`, ctx.cwd)}\``),
|
|
1750
|
+
];
|
|
1751
|
+
return {
|
|
1752
|
+
...base,
|
|
1753
|
+
status: skipped.length + failed.length > 0 ? 'warn' : 'pass',
|
|
1754
|
+
message: notes.join(' '),
|
|
1755
|
+
...(fixes.length > 0 ? {fix: `To fix: ${fixes.join('; ')}.`} : {}),
|
|
1756
|
+
};
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
/**
|
|
1760
|
+
* Inside a project, the integrations installed for the computer that the
|
|
1761
|
+
* project does not install: available, never used (spec AST-081 FR12).
|
|
1762
|
+
* Always info.
|
|
1763
|
+
* @param {{installed: Set<string>, candidates: import('../../foundation/integrations/computer-integrations.mjs').ComputerIntegrationCandidate[], install: (name: string) => string}} input
|
|
1764
|
+
* `install`: the command that adds a package with the project's package
|
|
1765
|
+
* manager (read by the adapter)
|
|
1766
|
+
* @returns {DoctorCheck}
|
|
1767
|
+
*/
|
|
1768
|
+
export function checkComputerIntegrationsAvailable({installed, candidates, install}) {
|
|
1769
|
+
const available = candidates.filter(c => !installed.has(c.name));
|
|
1770
|
+
const base = {id: 'computer-integrations', label: 'Integrations installed for this computer', status: /** @type {const} */ ('info')};
|
|
1771
|
+
if (available.length === 0) {
|
|
1772
|
+
return {...base, message: 'No integration installed for this computer is missing from this project.'};
|
|
1773
|
+
}
|
|
1774
|
+
const add = install;
|
|
1775
|
+
return {
|
|
1776
|
+
...base,
|
|
1777
|
+
message: `Installed for this computer but not in this project, so not used here: ${available.map(c => c.name).join(', ')}.`,
|
|
1778
|
+
fix: `To use one in this project, run ${available.map(c => `\`${add(c.name)}\``).join(' or ')}.`,
|
|
1779
|
+
};
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
/**
|
|
1783
|
+
* The checks doctor runs outside a project, in order.
|
|
1784
|
+
* @type {Array<(ctx: ComputerContext) => DoctorCheck>}
|
|
1785
|
+
*/
|
|
1786
|
+
export const COMPUTER_CHECKS = [
|
|
1787
|
+
ctx =>
|
|
1788
|
+
checkNodeVersion({
|
|
1789
|
+
cwd: '',
|
|
1790
|
+
nodeVersion: ctx.nodeVersion,
|
|
1791
|
+
coreDir: null,
|
|
1792
|
+
configPath: null,
|
|
1793
|
+
}),
|
|
1794
|
+
checkAnsweringRelease,
|
|
1795
|
+
checkNewestRelease,
|
|
1796
|
+
checkCliOnPath,
|
|
1797
|
+
checkComputerIntegrations,
|
|
1798
|
+
checkComputerAgentText,
|
|
1799
|
+
];
|
|
1800
|
+
|
|
1801
|
+
/**
|
|
1802
|
+
* Doctor outside a project: the computer, never the folder.
|
|
1803
|
+
* @param {string} cwd
|
|
1804
|
+
* @returns {Promise<DoctorReport>}
|
|
1805
|
+
*/
|
|
1806
|
+
async function runComputerChecks(cwd) {
|
|
1807
|
+
/** @type {ComputerContext} */
|
|
1808
|
+
const ctx = {
|
|
1809
|
+
nodeVersion: process.versions.node,
|
|
1810
|
+
cwd,
|
|
1811
|
+
...releaseFacts(cwd, {project: false}),
|
|
1812
|
+
};
|
|
1813
|
+
Object.assign(ctx, await computerIntegrationsOutside(cwd));
|
|
1814
|
+
const checks = COMPUTER_CHECKS.map(fn => fn(ctx));
|
|
1815
|
+
const summary = {pass: 0, warn: 0, fail: 0, info: 0};
|
|
1816
|
+
for (const c of checks) summary[c.status] += 1;
|
|
1817
|
+
return {checks, summary};
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1281
1820
|
/**
|
|
1282
1821
|
* Ordered list of synchronous check functions. Append here to add a check.
|
|
1283
1822
|
* (checkConfig is async and is awaited separately by {@link runChecks}.)
|
|
@@ -1294,6 +1833,7 @@ export const SYNC_CHECKS = [
|
|
|
1294
1833
|
checkAgentDocs,
|
|
1295
1834
|
checkPeerDeps,
|
|
1296
1835
|
checkPackageManager,
|
|
1836
|
+
checkCliCommand,
|
|
1297
1837
|
];
|
|
1298
1838
|
|
|
1299
1839
|
/**
|
|
@@ -1305,7 +1845,8 @@ export const SYNC_CHECKS = [
|
|
|
1305
1845
|
*/
|
|
1306
1846
|
export async function runChecks(options = {}) {
|
|
1307
1847
|
const cwd = options.cwd ?? process.cwd();
|
|
1308
|
-
|
|
1848
|
+
if (outsideProject(cwd)) return runComputerChecks(cwd);
|
|
1849
|
+
const coreDir = findProjectCoreDir(cwd);
|
|
1309
1850
|
// findConfigPath throws when multiple config files coexist. That's a
|
|
1310
1851
|
// misconfiguration doctor exists to report — catch it and surface it through
|
|
1311
1852
|
// checkConfig as a FAIL rather than crashing the whole diagnostic engine.
|
|
@@ -1339,7 +1880,9 @@ export async function runChecks(options = {}) {
|
|
|
1339
1880
|
/** @type {import('../../foundation/config/project.mjs').Project | null} */
|
|
1340
1881
|
let project = null;
|
|
1341
1882
|
try {
|
|
1342
|
-
project
|
|
1883
|
+
// Doctor judges the project, so it reads only the Core the project
|
|
1884
|
+
// installed, never a carried one (spec AST-081 FR3).
|
|
1885
|
+
project = await Project.load(cwd, {core: 'project'});
|
|
1343
1886
|
} catch (err) {
|
|
1344
1887
|
// A project the CLI cannot load leaves the checks that need it
|
|
1345
1888
|
// skipped. The reason is kept: those checks and the config
|
|
@@ -1442,6 +1985,8 @@ export async function runChecks(options = {}) {
|
|
|
1442
1985
|
cwd,
|
|
1443
1986
|
nodeVersion: process.versions.node,
|
|
1444
1987
|
coreDir,
|
|
1988
|
+
ownCli: projectHasOwnCli(cwd),
|
|
1989
|
+
projectCore: projectCoreVersion(cwd),
|
|
1445
1990
|
configPath,
|
|
1446
1991
|
integrations,
|
|
1447
1992
|
docsCatalog,
|
|
@@ -1466,6 +2011,31 @@ export async function runChecks(options = {}) {
|
|
|
1466
2011
|
checks.push(await checkConfig(ctx));
|
|
1467
2012
|
}
|
|
1468
2013
|
}
|
|
2014
|
+
const facts = releaseFacts(cwd, {project: true});
|
|
2015
|
+
checks.push(
|
|
2016
|
+
checkNewestRelease({
|
|
2017
|
+
nodeVersion: ctx.nodeVersion,
|
|
2018
|
+
answeredBy: facts.answeredBy,
|
|
2019
|
+
latest: facts.latest,
|
|
2020
|
+
projectLag: facts.projectLag,
|
|
2021
|
+
lastNoticeSkip: facts.lastNoticeSkip,
|
|
2022
|
+
lastCheckFailure: facts.lastCheckFailure,
|
|
2023
|
+
stateLock: facts.stateLock,
|
|
2024
|
+
}),
|
|
2025
|
+
);
|
|
2026
|
+
checks.push(
|
|
2027
|
+
checkCliOnPath({
|
|
2028
|
+
nodeVersion: ctx.nodeVersion,
|
|
2029
|
+
answeredBy: facts.answeredBy,
|
|
2030
|
+
latest: null,
|
|
2031
|
+
searchPathCommands: facts.searchPathCommands,
|
|
2032
|
+
}),
|
|
2033
|
+
);
|
|
2034
|
+
{
|
|
2035
|
+
const loadedNames = (project?.loadedIntegrations ?? []).map((/** @type {{name: string}} */ i) => i.name);
|
|
2036
|
+
const candidates = await computerIntegrationsToAdd(cwd, loadedNames);
|
|
2037
|
+
checks.push(checkComputerIntegrationsAvailable({installed: new Set(loadedNames), candidates, install: installCommandFor(cwd)}));
|
|
2038
|
+
}
|
|
1469
2039
|
checks.push(await checkAuthoringDocs(ctx));
|
|
1470
2040
|
checks.push(await checkCliDocs(ctx));
|
|
1471
2041
|
checks.push(await checkDocsTree(ctx));
|