@astryxdesign/cli 0.7.17-canary.g5a3fd39 → 0.7.17-canary.g5cf5d69
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 +64 -63
- package/api/build/_adapter.d.mts +51 -0
- package/api/build/_adapter.mjs +122 -6
- package/api/build/build.doc.mjs +1 -1
- package/api/build/build.mjs +23 -14
- package/api/build/build.type.d.mts +1 -1
- package/api/build/build.type.mjs +3 -3
- package/api/build/help/help.d.mts +15 -14
- package/api/build/help/help.mjs +62 -3
- package/api/build/kit/answer.mjs +2 -3
- package/api/build/kit/signals.d.mts +10 -0
- package/api/build/kit/signals.mjs +15 -2
- package/api/component/detail/blocks/blocks.mjs +2 -1
- package/api/discover/_adapter.d.mts +57 -6
- package/api/discover/_adapter.mjs +278 -49
- package/api/discover/_catalog-view.d.mts +7 -0
- package/api/discover/_catalog-view.mjs +10 -1
- package/api/discover/detail/detail.d.mts +3 -2
- package/api/discover/detail/detail.mjs +3 -2
- package/api/discover/detail/doc/doc.mjs +1 -1
- package/api/discover/discover.d.mts +24 -0
- package/api/discover/discover.doc.mjs +1 -1
- package/api/discover/discover.mjs +146 -25
- package/api/discover/discover.type.d.mts +6 -4
- package/api/discover/discover.type.mjs +6 -4
- package/api/discover/search/search.d.mts +22 -0
- package/api/discover/search/search.mjs +290 -70
- package/api/docs/_entry-names.mjs +4 -3
- package/api/doctor/_adapter.d.mts +43 -3
- package/api/doctor/_adapter.mjs +142 -18
- package/api/doctor/built-checks.d.mts +30 -3
- package/api/doctor/built-checks.mjs +132 -5
- package/api/doctor/doctor.d.mts +93 -6
- package/api/doctor/doctor.doc.mjs +2 -2
- package/api/doctor/doctor.mjs +524 -33
- package/api/doctor/doctor.type.d.mts +2 -1
- package/api/doctor/doctor.type.mjs +2 -1
- package/api/doctor/theme-checks.d.mts +19 -0
- package/api/doctor/theme-checks.mjs +74 -6
- package/api/hook/hook.type.d.mts +1 -1
- package/api/hook/hook.type.mjs +1 -1
- package/api/hook/list/list.mjs +11 -7
- package/api/icon/_adapter.d.mts +2 -1
- package/api/icon/_adapter.mjs +10 -15
- package/api/icon/_records.d.mts +3 -1
- package/api/icon/_records.mjs +30 -3
- package/api/icon/exportIconIndex.doc.mjs +1 -1
- package/api/icon/icon.doc.mjs +3 -3
- package/api/icon/icon.type.d.mts +32 -1
- package/api/icon/icon.type.mjs +19 -3
- package/api/icon/list/list.mjs +4 -1
- package/api/icon/rankIconIndex.doc.mjs +1 -1
- package/api/icon/search/icon-index.mjs +18 -8
- package/api/icon/search/search.d.mts +26 -3
- package/api/icon/search/search.mjs +155 -9
- package/api/init/_adapter.d.mts +14 -0
- package/api/init/_adapter.mjs +26 -4
- package/api/init/init.d.mts +1 -1
- package/api/init/init.doc.mjs +2 -2
- package/api/init/init.mjs +1 -1
- package/api/init/init.type.d.mts +29 -1
- package/api/init/init.type.mjs +14 -1
- package/api/init/run/run.d.mts +11 -1
- package/api/init/run/run.mjs +84 -5
- package/api/integration/_adapter.d.mts +5 -4
- package/api/integration/_adapter.mjs +7 -5
- package/api/integration/integrationCheck.doc.mjs +1 -1
- package/api/integration/pack-check.mjs +8 -9
- package/api/integration/validate-integration.d.mts +1 -1
- package/api/integration/validate-integration.mjs +26 -24
- package/api/integration/validate-integration.type.d.mts +5 -2
- package/api/integration/validate-integration.type.mjs +5 -2
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.d.mts +4 -2
- package/api/render/_adapter.mjs +62 -21
- package/api/render/render.doc.mjs +8 -5
- package/api/render/render.mjs +1 -1
- package/api/render/render.type.d.mts +2 -0
- package/api/render/render.type.mjs +2 -0
- package/api/search/ORDERING.md +2 -2
- package/api/search/_candidate-score.d.mts +3 -0
- package/api/search/_candidate-score.mjs +36 -3
- package/api/search/_gather-docs.mjs +29 -2
- package/api/search/_gather-templates.mjs +2 -1
- package/api/search/_main-searcher.mjs +13 -0
- package/api/search/_named-keywords.d.mts +2 -1
- package/api/search/_named-keywords.mjs +48 -6
- package/api/search/_order.d.mts +36 -1
- package/api/search/_order.mjs +141 -3
- package/api/swizzle/list/list.mjs +8 -1
- package/api/swizzle/swizzle.type.d.mts +1 -1
- package/api/swizzle/swizzle.type.mjs +1 -1
- package/api/template/copy/copy.mjs +3 -4
- package/api/template/list/list.mjs +2 -1
- package/api/template/show/show.mjs +2 -1
- package/api/template/skeleton/skeleton.mjs +2 -1
- package/api/template/template.doc.mjs +1 -1
- package/api/template/template.mjs +19 -1
- package/api/template/template.type.d.mts +1 -0
- package/api/template/template.type.mjs +2 -1
- package/api/theme/_adapter.d.mts +1 -0
- package/api/theme/_adapter.mjs +3 -5
- package/api/theme/_app-provider.d.mts +42 -0
- package/api/theme/_app-provider.mjs +61 -27
- package/api/theme/build/build.d.mts +4 -10
- package/api/theme/build/build.mjs +165 -116
- package/api/theme/build/input-fields.d.mts +9 -0
- package/api/theme/build/input-fields.mjs +155 -16
- package/api/theme/build/radius-values.d.mts +18 -0
- package/api/theme/build/radius-values.mjs +76 -0
- package/api/theme/build/typography-values.mjs +7 -23
- package/api/theme/build/written-values.d.mts +18 -0
- package/api/theme/build/written-values.mjs +107 -31
- package/api/theme/eject/eject.mjs +6 -1
- package/api/theme/palette/generate/generator.mjs +24 -0
- package/api/theme/theme.type.d.mts +4 -2
- package/api/theme/theme.type.mjs +3 -2
- package/api/theme/themeBuild.doc.mjs +2 -2
- package/api/theme/themeEject.doc.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +40 -0
- package/api/theme-edit/_catalog.mjs +100 -22
- package/api/theme-edit/_check.mjs +213 -43
- package/api/theme-edit/_color.d.mts +14 -0
- package/api/theme-edit/_color.mjs +22 -0
- package/api/theme-edit/_compiler.mjs +52 -0
- package/api/theme-edit/_context.d.mts +20 -2
- package/api/theme-edit/_context.mjs +157 -29
- package/api/theme-edit/_edit.mjs +426 -58
- package/api/theme-edit/_how-question.d.mts +14 -0
- package/api/theme-edit/_how-question.mjs +1541 -127
- package/api/theme-edit/_how.mjs +43 -0
- package/api/theme-edit/_missed.mjs +107 -27
- package/api/theme-edit/_normal.d.mts +18 -4
- package/api/theme-edit/_normal.mjs +84 -3
- package/api/theme-edit/_palette.d.mts +9 -0
- package/api/theme-edit/_palette.mjs +158 -33
- package/api/theme-edit/_part-words.mjs +16 -3
- package/api/theme-edit/_parts.d.mts +8 -0
- package/api/theme-edit/_parts.mjs +120 -36
- package/api/theme-edit/_png.d.mts +24 -0
- package/api/theme-edit/_png.mjs +99 -0
- package/api/theme-edit/_preview-app.d.mts +16 -0
- package/api/theme-edit/_preview-app.mjs +52 -18
- package/api/theme-edit/_preview.d.mts +44 -26
- package/api/theme-edit/_preview.mjs +255 -67
- package/api/theme-edit/_project.d.mts +12 -1
- package/api/theme-edit/_project.mjs +16 -1
- package/api/theme-edit/_settings.d.mts +116 -0
- package/api/theme-edit/_settings.mjs +1197 -58
- package/api/theme-edit/_tables.d.mts +16 -0
- package/api/theme-edit/_tables.mjs +34 -4
- package/api/theme-edit/theme-edit.type.d.mts +15 -2
- package/api/theme-edit/theme-edit.type.mjs +8 -6
- package/api/upgrade/_adapter.d.mts +46 -7
- package/api/upgrade/_adapter.mjs +110 -15
- package/api/upgrade/registry/registry.d.mts +6 -3
- package/api/upgrade/registry/registry.mjs +21 -6
- package/api/upgrade/run/run.mjs +23 -11
- package/api/upgrade/upgrade.doc.mjs +4 -3
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/agent-guidance.doc.mjs +3 -2
- package/assets/docs/tree/checks.doc.mjs +2 -2
- package/assets/docs/tree/host-entry.doc.mjs +4 -0
- package/assets/docs/tree/icon-definitions.doc.mjs +3 -3
- package/assets/docs/tree/icon-sets.doc.mjs +6 -6
- package/assets/docs/tree/problems.doc.mjs +3 -3
- package/assets/docs/tree/render-pages.doc.mjs +17 -3
- package/assets/docs/tree/share-a-page.doc.mjs +5 -5
- package/assets/docs/tree/short-and-findable.doc.mjs +3 -3
- package/assets/docs/tree/troubleshooting.doc.mjs +8 -0
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/versioning.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +40 -5
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/icons/installed-icon-set.doc.mjs +30 -0
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Avatar/AvatarInteractive.tsx +6 -1
- package/assets/templates/blocks/components/CodeBlock/CodeBlockTerminal.tsx +1 -1
- package/assets/templates/blocks/components/LinkProvider/LinkProviderCustomLink.tsx +3 -1
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +6 -2
- package/assets/templates/pages/ai-chat-landing/page.tsx +1 -1
- package/assets/templates/pages/blank/page.tsx +4 -2
- package/assets/templates/pages/canvas-editor/page.tsx +3 -1
- package/assets/templates/pages/centered-hero/page.tsx +1 -1
- package/assets/templates/pages/checkout-wizard/page.tsx +1 -1
- package/assets/templates/pages/classic-gallery/page.tsx +1 -1
- package/assets/templates/pages/contact-form/page.tsx +2 -2
- package/assets/templates/pages/course-detail/page.tsx +1 -1
- package/assets/templates/pages/dashboard/page.tsx +24 -8
- package/assets/templates/pages/dashboard-alert-rail/page.tsx +4 -2
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +7 -3
- package/assets/templates/pages/dashboard-comparison/page.tsx +5 -2
- package/assets/templates/pages/dashboard-composition/page.tsx +10 -4
- package/assets/templates/pages/dashboard-progress/page.tsx +6 -3
- package/assets/templates/pages/dashboard-scorecard/page.tsx +17 -8
- package/assets/templates/pages/detail-page/page.tsx +22 -5
- package/assets/templates/pages/documentation/page.tsx +4 -2
- package/assets/templates/pages/documentation-design/page.tsx +5 -2
- package/assets/templates/pages/documentation-technical/page.tsx +4 -2
- package/assets/templates/pages/editor/page.tsx +28 -9
- package/assets/templates/pages/file-explorer/page.tsx +3 -1
- package/assets/templates/pages/form-two-column/page.tsx +1 -1
- package/assets/templates/pages/form-wizard/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-dialog/page.tsx +3 -1
- package/assets/templates/pages/form-wizard-inline/page.tsx +1 -1
- package/assets/templates/pages/form-wizard-vertical/page.tsx +1 -1
- package/assets/templates/pages/gallery-hero/page.tsx +1 -1
- package/assets/templates/pages/ide/page.tsx +7 -2
- package/assets/templates/pages/kanban-board/page.tsx +10 -4
- package/assets/templates/pages/library/page.tsx +31 -61
- package/assets/templates/pages/login/page.tsx +4 -2
- package/assets/templates/pages/login-card/page.tsx +4 -2
- package/assets/templates/pages/login-split/page.tsx +3 -2
- package/assets/templates/pages/login-sso/page.tsx +4 -4
- package/assets/templates/pages/mixed-gallery/page.tsx +1 -1
- package/assets/templates/pages/payment-form/page.tsx +1 -1
- package/assets/templates/pages/product-detail/page.tsx +16 -4
- package/assets/templates/pages/product-gallery/page.tsx +1 -1
- package/assets/templates/pages/settings/page.tsx +10 -4
- package/assets/templates/pages/settings-dialog/page.tsx +5 -6
- package/assets/templates/pages/settings-sidebar/page.tsx +39 -13
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -2
- package/assets/templates/pages/table-filter/page.tsx +21 -6
- package/assets/templates/pages/table-grouped/page.tsx +23 -2
- package/assets/templates/pages/table-inbox/page.tsx +82 -32
- package/assets/templates/pages/theme-showcase/page.tsx +3 -2
- package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +12 -12
- package/assets/templates/themes/butter/butterTheme.ts +197 -4
- package/assets/templates/themes/chocolate/chocolateTheme.ts +72 -8
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +3 -3
- package/assets/templates/themes/gothic/gothicTheme.ts +114 -4
- package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +8 -8
- package/assets/templates/themes/matcha/matchaTheme.ts +48 -12
- package/assets/templates/themes/neutral/neutralTheme.ts +29 -0
- package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +2 -2
- package/assets/templates/themes/stone/stoneTheme.ts +69 -0
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +9 -9
- package/assets/templates/themes/y2k/y2kTheme.ts +249 -14
- package/authoring/codemod/parse.d.mts +0 -36
- package/authoring/codemod/parse.mjs +62 -41
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/parse.d.mts +0 -47
- package/authoring/config/parse.mjs +128 -103
- package/authoring/config/type.ts +4 -3
- package/authoring/debug/parse.d.mts +2 -2
- package/authoring/discover/parse.d.mts +2 -2
- package/authoring/discover/parse.mjs +52 -38
- package/authoring/discover/type.ts +2 -1
- package/authoring/doctypes/_schema.d.mts +834 -950
- package/authoring/doctypes/_schema.mjs +863 -825
- package/authoring/doctypes/command/parse.mjs +2 -2
- package/authoring/doctypes/component/parse.mjs +2 -2
- package/authoring/doctypes/enum/parse.mjs +2 -2
- package/authoring/doctypes/hook/parse.mjs +2 -2
- package/authoring/doctypes/icon-definition/icon-definition.doc.mjs +1 -1
- package/authoring/doctypes/icon-definition/parse.d.mts +0 -24
- package/authoring/doctypes/icon-definition/parse.mjs +59 -43
- package/authoring/doctypes/icon-set/parse.d.mts +0 -75
- package/authoring/doctypes/icon-set/parse.mjs +239 -210
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/namespace/parse.mjs +2 -2
- package/authoring/doctypes/reference/parse.mjs +2 -2
- package/authoring/doctypes/schema/parse.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +0 -101
- package/authoring/doctypes/template/parse.mjs +131 -106
- package/authoring/doctypes/theme/parse.d.mts +0 -23
- package/authoring/doctypes/theme/parse.mjs +52 -36
- package/authoring/gap-report/parse.d.mts +1 -1
- package/authoring/integration/integration.doc.mjs +8 -0
- package/authoring/integration/schema.d.mts +14 -3
- package/authoring/integration/schema.mjs +20 -2
- package/authoring/integration/type.ts +14 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/build.mjs +27 -13
- package/clients/cli/commands/component.mjs +14 -3
- package/clients/cli/commands/discover.doc.mjs +2 -2
- package/clients/cli/commands/discover.mjs +20 -3
- package/clients/cli/commands/docs.doc.mjs +11 -9
- package/clients/cli/commands/docs.mjs +50 -21
- package/clients/cli/commands/experimental/icon.mjs +330 -227
- package/clients/cli/commands/experimental/render.mjs +16 -1
- package/clients/cli/commands/experimental/theme.mjs +42 -17
- package/clients/cli/commands/experimental-icon-add.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon-map.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-definition.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-new-set.doc.mjs +4 -1
- package/clients/cli/commands/experimental-icon-use.doc.mjs +1 -1
- package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
- package/clients/cli/commands/experimental-render.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +36 -24
- package/clients/cli/commands/integration-check.doc.mjs +1 -1
- package/clients/cli/commands/mcp.doc.mjs +53 -0
- package/clients/cli/commands/mcp.mjs +51 -0
- package/clients/cli/commands/search.mjs +46 -9
- package/clients/cli/commands/template.mjs +3 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +12 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands.generated.json +1 -1
- package/clients/cli/formatters/index.mjs +52 -6
- package/clients/cli/index.mjs +23 -17
- package/clients/cli/lib/base-gate.mjs +37 -5
- package/clients/cli/lib/define-command.mjs +82 -4
- package/clients/cli/lib/json-shim.mjs +61 -4
- package/clients/cli/lib/manifest.mjs +9 -1
- package/clients/cli/lib/mcp-server.mjs +286 -0
- package/clients/cli/lib/mcp-tools.mjs +405 -0
- package/clients/cli/lib/other-cli-words.mjs +99 -0
- package/clients/cli/lib/stray-option.mjs +27 -1
- package/clients/cli/lib/unknown-command.mjs +326 -11
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +49 -1
- package/foundation/agent-docs/agent-docs.mjs +108 -7
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core.d.mts +1 -1
- package/foundation/bases/core.mjs +3 -3
- package/foundation/bases/resolve.d.mts +4 -8
- package/foundation/bases/resolve.mjs +15 -21
- package/foundation/bases/state.d.mts +15 -9
- package/foundation/bases/state.mjs +33 -6
- package/foundation/config/project.d.mts +5 -4
- package/foundation/config/project.mjs +33 -17
- package/foundation/discovery/component-discovery.mjs +15 -28
- package/foundation/discovery/icon-imports.d.mts +66 -0
- package/foundation/discovery/icon-imports.mjs +225 -0
- package/foundation/discovery/icon-ranking.d.mts +12 -2
- package/foundation/discovery/icon-ranking.mjs +197 -10
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.d.mts +28 -0
- package/foundation/discovery/icon-set-discovery.mjs +42 -0
- package/foundation/discovery/icon-set-writer.d.mts +2 -11
- package/foundation/discovery/icon-set-writer.mjs +3 -29
- package/foundation/discovery/module-exports.d.mts +1 -1
- package/foundation/discovery/module-exports.mjs +136 -33
- package/foundation/discovery/name-roots.d.mts +5 -0
- package/foundation/discovery/name-roots.mjs +11 -0
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/runner-commands.mjs +1 -0
- package/foundation/discovery/template-adapter.d.mts +1 -1
- package/foundation/discovery/template-destination.d.mts +14 -6
- package/foundation/discovery/template-destination.mjs +42 -8
- package/foundation/discovery/template-icons.d.mts +45 -2
- package/foundation/discovery/template-icons.mjs +26 -54
- package/foundation/discovery/template-needs.d.mts +28 -2
- package/foundation/discovery/template-needs.mjs +92 -11
- package/foundation/discovery/theme-discovery.d.mts +8 -0
- package/foundation/discovery/theme-discovery.mjs +23 -6
- package/foundation/discovery/theme-imports.mjs +2 -4
- package/foundation/doc-compiler/parse-readable.mjs +4 -3
- package/foundation/doc-compiler/stored-docs.d.mts +13 -0
- package/foundation/doc-compiler/stored-docs.mjs +74 -3
- package/foundation/env/cli-command.d.mts +68 -10
- package/foundation/env/cli-command.mjs +116 -22
- package/foundation/env/project-scope.d.mts +9 -0
- package/foundation/env/project-scope.mjs +28 -2
- package/foundation/fs/gather-cache.d.mts +23 -0
- package/foundation/fs/gather-cache.mjs +94 -2
- package/foundation/fs/module-loader.d.mts +3 -1
- package/foundation/fs/module-loader.mjs +85 -5
- package/foundation/fs/read-record.mjs +9 -5
- package/foundation/identity/package-names.d.mts +18 -0
- package/foundation/identity/package-names.mjs +19 -0
- package/foundation/identity/providers.mjs +3 -2
- package/foundation/integrations/icon-features.d.mts +63 -0
- package/foundation/integrations/icon-features.mjs +54 -0
- package/foundation/integrations/integrations.d.mts +13 -1
- package/foundation/integrations/integrations.mjs +47 -6
- package/foundation/integrations/pack-state.d.mts +21 -0
- package/foundation/integrations/pack-state.mjs +42 -19
- package/foundation/integrations/validate-contributions.d.mts +11 -3
- package/foundation/integrations/validate-contributions.mjs +51 -13
- package/foundation/release/cache.d.mts +13 -1
- package/foundation/release/cache.mjs +94 -14
- package/foundation/release/notices.d.mts +15 -0
- package/foundation/release/notices.mjs +111 -7
- package/foundation/release/project.d.mts +3 -4
- package/foundation/release/project.mjs +5 -6
- package/foundation/render/client-bundle.d.mts +126 -0
- package/foundation/render/client-bundle.mjs +565 -0
- package/foundation/render/cut-short.d.mts +7 -1
- package/foundation/render/cut-short.mjs +46 -6
- package/foundation/render/embedded-imports.d.mts +4 -3
- package/foundation/render/embedded-imports.mjs +13 -8
- package/foundation/render/esbuild-dependency.d.mts +14 -0
- package/foundation/render/esbuild-dependency.mjs +41 -0
- package/foundation/render/file-header.mjs +5 -4
- package/foundation/render/page-worker.mjs +562 -86
- package/foundation/render/picture-chrome.mjs +54 -29
- package/foundation/render/picture-playwright.mjs +78 -42
- package/foundation/render/picture-window.d.mts +33 -0
- package/foundation/render/picture-window.mjs +78 -0
- package/foundation/render/render-page.d.mts +55 -4
- package/foundation/render/render-page.mjs +199 -28
- package/foundation/render/restore-folder.d.mts +13 -0
- package/foundation/render/restore-folder.mjs +30 -0
- package/foundation/render/served-packages.d.mts +2 -1
- package/foundation/render/served-packages.mjs +5 -3
- package/foundation/render/ts-paths.d.mts +11 -0
- package/foundation/render/ts-paths.mjs +27 -2
- package/foundation/render/value-uses.d.mts +43 -0
- package/foundation/render/value-uses.mjs +110 -0
- package/foundation/response/error-codes.d.mts +2 -1
- package/foundation/response/error-codes.doc.mjs +7 -1
- package/foundation/response/error-codes.mjs +10 -2
- package/foundation/response/response-types.doc.mjs +12 -12
- package/foundation/runtime/package-root.d.mts +8 -0
- package/foundation/runtime/package-root.mjs +20 -0
- package/foundation/suggest/other-command.d.mts +11 -0
- package/foundation/suggest/other-command.mjs +1 -1
- package/foundation/text/icon-id.d.mts +20 -0
- package/foundation/text/icon-id.mjs +40 -0
- package/foundation/text/icon-set-next.d.mts +25 -0
- package/foundation/text/icon-set-next.mjs +29 -0
- package/foundation/xle/browser.d.mts +2 -2
- package/package.json +7 -6
|
@@ -12,9 +12,10 @@
|
|
|
12
12
|
* configured" (`false`) from "configured but nothing discovered" (`true`),
|
|
13
13
|
* which the list leaf surfaces as `meta`.
|
|
14
14
|
*
|
|
15
|
+
* @param {Project} [project] the project, when the caller has loaded it
|
|
15
16
|
* @returns {Promise<{packages: ScannedPackage[], configured: boolean, project: Project}>}
|
|
16
17
|
*/
|
|
17
|
-
export function discoverPackages(): Promise<{
|
|
18
|
+
export function discoverPackages(project?: Project): Promise<{
|
|
18
19
|
packages: ScannedPackage[];
|
|
19
20
|
configured: boolean;
|
|
20
21
|
project: Project;
|
|
@@ -33,6 +34,10 @@ export function packageDescription(packageDir: string | undefined): string | und
|
|
|
33
34
|
* no components root is included with `components: []`; one that failed to
|
|
34
35
|
* load is left out (the integration-issues nudge and Doctor report it).
|
|
35
36
|
*
|
|
37
|
+
* Describing them reads every integration's templates, themes and codemods
|
|
38
|
+
* and the project's whole docs catalog, so the answer is kept between runs
|
|
39
|
+
* while every file it read is unchanged (foundation/fs/gather-cache.mjs).
|
|
40
|
+
*
|
|
36
41
|
* @param {Project | undefined} project
|
|
37
42
|
* @param {ScannedPackage[]} scanned the packages {@link discoverPackages} found
|
|
38
43
|
* @returns {Promise<InstalledPackage[]>}
|
|
@@ -91,6 +96,35 @@ export function addCommand(project: Project | undefined, { official }?: {
|
|
|
91
96
|
* @returns {string}
|
|
92
97
|
*/
|
|
93
98
|
export function defaultCacheDir(): string;
|
|
99
|
+
/**
|
|
100
|
+
* The packages discover lists from the saved copies of the discover sources'
|
|
101
|
+
* full catalogs, read without calling a source, and the official packages no
|
|
102
|
+
* source covers, as discover adds them. Null when no source has a saved copy.
|
|
103
|
+
* A copy is read as saved: it was checked before it was saved, and checking
|
|
104
|
+
* it again costs more than a hint may. A caller treats a copy that does not
|
|
105
|
+
* read as unknown.
|
|
106
|
+
* @param {Project | undefined} project
|
|
107
|
+
* @param {{cacheDir?: string, official?: OfficialList}} [options]
|
|
108
|
+
* `official`: the list {@link officialList} read; read here when absent
|
|
109
|
+
* @returns {CatalogResult['packages'] | null}
|
|
110
|
+
*/
|
|
111
|
+
export function savedCatalog(project: Project | undefined, { cacheDir, official }?: {
|
|
112
|
+
cacheDir?: string;
|
|
113
|
+
official?: OfficialList;
|
|
114
|
+
}): CatalogResult["packages"] | null;
|
|
115
|
+
/**
|
|
116
|
+
* What `discover <query>` searches when its sources answer from their saved
|
|
117
|
+
* copies, worked out by `build` and kept between runs while every file it
|
|
118
|
+
* read is unchanged (foundation/fs/gather-cache.mjs), so search's discover
|
|
119
|
+
* line reads one kept record instead of scanning the project and parsing
|
|
120
|
+
* the copies on every run. Null when no source of the project has a saved
|
|
121
|
+
* copy of its full catalog; the copies are only looked for then, never read.
|
|
122
|
+
* @template T
|
|
123
|
+
* @param {(project: Project) => Promise<T>} build
|
|
124
|
+
* @param {(value: unknown) => boolean} valid the shape a kept value needs
|
|
125
|
+
* @returns {Promise<T | null>}
|
|
126
|
+
*/
|
|
127
|
+
export function keptSavedSearch<T>(build: (project: Project) => Promise<T>, valid: (value: unknown) => boolean): Promise<T | null>;
|
|
94
128
|
/**
|
|
95
129
|
* Call every discover source (see {@link callOwnSources}), then read the
|
|
96
130
|
* official list (spec:AST-051 FR11). The list comes last, so a source keeps
|
|
@@ -121,13 +155,13 @@ export function callSources(project: Project | undefined, request?: {
|
|
|
121
155
|
export function loadReadKinds(): Promise<readonly string[]>;
|
|
122
156
|
/**
|
|
123
157
|
* The item kinds discover reads in this project: every stable kind, and the
|
|
124
|
-
* experimental ones
|
|
158
|
+
* experimental ones where icon features are on.
|
|
125
159
|
* @param {Project | undefined} project
|
|
126
160
|
* @returns {readonly string[]}
|
|
127
161
|
*/
|
|
128
162
|
export function readKinds(project: Project | undefined): readonly string[];
|
|
129
163
|
/**
|
|
130
|
-
* Whether
|
|
164
|
+
* Whether discover reads icon sets in this project: the icon feature gate.
|
|
131
165
|
* @param {Project | undefined} project
|
|
132
166
|
*/
|
|
133
167
|
export function optedIntoIconSets(project: Project | undefined): boolean;
|
|
@@ -199,9 +233,9 @@ export function toEntry(pkg: InstalledPackage & {
|
|
|
199
233
|
* Locate a component's doc file within the given packages (case-insensitive).
|
|
200
234
|
* @param {ScannedPackage[]} packages
|
|
201
235
|
* @param {string} name
|
|
202
|
-
* @returns {ComponentResolution | null}
|
|
236
|
+
* @returns {Promise<ComponentResolution | null>}
|
|
203
237
|
*/
|
|
204
|
-
export function findComponent(packages: ScannedPackage[], name: string): ComponentResolution | null
|
|
238
|
+
export function findComponent(packages: ScannedPackage[], name: string): Promise<ComponentResolution | null>;
|
|
205
239
|
/**
|
|
206
240
|
* Load and validate a resolved component's docs. Throws AstryxError
|
|
207
241
|
* (ERR_INVALID_DOC) when the file fails to load or the docs are malformed.
|
|
@@ -215,13 +249,29 @@ export function loadValidatedDoc(result: ComponentResolution, { lang, zh }: {
|
|
|
215
249
|
lang?: string | null;
|
|
216
250
|
zh?: boolean;
|
|
217
251
|
}): Promise<import("./discover.type.mjs").DiscoverDetailDocResponse["data"]>;
|
|
252
|
+
/**
|
|
253
|
+
* The not-found error with Core's match for the query in its suggestions:
|
|
254
|
+
* the first Core component or hook `astryx search` gives in `cwd`, as the
|
|
255
|
+
* lookups' shared hint (foundation/suggest/other-command.mjs) names it, after
|
|
256
|
+
* discover's own near names, when
|
|
257
|
+
* search answers the whole query with it by a name or keyword: one word at
|
|
258
|
+
* search's keyword strength, or every word of a longer query
|
|
259
|
+
* (api/search/_score.mjs). A Core entry search found only through prose, or
|
|
260
|
+
* through some of the words, is too weak a match to name. The error is
|
|
261
|
+
* unchanged when search gives no such entry, or fails.
|
|
262
|
+
* @param {AstryxError} err
|
|
263
|
+
* @param {string} query
|
|
264
|
+
* @param {string} cwd
|
|
265
|
+
* @returns {Promise<AstryxError>}
|
|
266
|
+
*/
|
|
267
|
+
export function withCoreMatch(err: AstryxError, query: string, cwd: string): Promise<AstryxError>;
|
|
218
268
|
/** The name the official list goes by, as a source and on each of its entries. */
|
|
219
269
|
export const OFFICIAL_SOURCE_NAME: "Astryx";
|
|
220
270
|
/** The official list, generated from the repository when the CLI is built. */
|
|
221
271
|
export const OFFICIAL_LIST_FILE: string;
|
|
222
272
|
/**
|
|
223
273
|
* The experimental item kinds a catalog may list (spec:AST-017 FR27):
|
|
224
|
-
* `icon-set`, read only
|
|
274
|
+
* `icon-set`, read only where the icon feature gate is on.
|
|
225
275
|
*/
|
|
226
276
|
export const EXPERIMENTAL_KINDS: readonly ["icon-set"];
|
|
227
277
|
/** The item kinds every project reads: the catalog kinds, less experimental ones. */
|
|
@@ -341,3 +391,4 @@ export type ComponentResolution = {
|
|
|
341
391
|
componentName: string;
|
|
342
392
|
};
|
|
343
393
|
import { Project } from '../../foundation/config/project.mjs';
|
|
394
|
+
import { AstryxError } from '../error.mjs';
|
|
@@ -30,7 +30,6 @@ import {
|
|
|
30
30
|
projectAddCommand,
|
|
31
31
|
} from '../../foundation/release/notices.mjs';
|
|
32
32
|
import {hostedRun} from '../../foundation/runtime/package-root.mjs';
|
|
33
|
-
import {scanAllPackages, findComponentInPackages} from './_package-scanner.mjs';
|
|
34
33
|
import {loadDocs} from '../../foundation/discovery/component-loader.mjs';
|
|
35
34
|
import {collectIdentities} from '../../foundation/integrations/contribution-inventory.mjs';
|
|
36
35
|
import {
|
|
@@ -39,16 +38,25 @@ import {
|
|
|
39
38
|
projectTree,
|
|
40
39
|
} from '../docs/_adapter.mjs';
|
|
41
40
|
import {discoverIntegrationIconSets} from '../../foundation/discovery/icon-set-discovery.mjs';
|
|
41
|
+
import {iconFeatureGate} from '../../foundation/integrations/icon-features.mjs';
|
|
42
42
|
import {isValidSemver, semverCompare} from '../../foundation/env/semver.mjs';
|
|
43
43
|
import {assertWithin} from '../../foundation/fs/path-safety.mjs';
|
|
44
44
|
import {userCacheDir} from '../../foundation/env/user-dirs.mjs';
|
|
45
|
-
import {
|
|
45
|
+
import {
|
|
46
|
+
CLI_ROOT,
|
|
47
|
+
findInstalledPackage,
|
|
48
|
+
realDir,
|
|
49
|
+
} from '../../foundation/fs/paths.mjs';
|
|
50
|
+
import {EXACT_CODEC} from '../../foundation/fs/exact-codec.mjs';
|
|
51
|
+
import {persistedGather} from '../../foundation/fs/gather-cache.mjs';
|
|
46
52
|
import {
|
|
47
53
|
DISCOVER_KINDS,
|
|
48
54
|
parseDiscoverCatalog,
|
|
49
55
|
} from '../../authoring/discover/parse.mjs';
|
|
50
56
|
import {AstryxError} from '../error.mjs';
|
|
57
|
+
import {CORE_PACKAGE_NAME} from '../../foundation/release/project.mjs';
|
|
51
58
|
import {ERROR_CODES} from '../../foundation/response/error-codes.mjs';
|
|
59
|
+
import {installGuidanceFor} from '../../foundation/env/cli-command.mjs';
|
|
52
60
|
|
|
53
61
|
const SOURCE_TIMEOUT_MS = 30_000;
|
|
54
62
|
|
|
@@ -189,10 +197,11 @@ function validateDocs(docs) {
|
|
|
189
197
|
* configured" (`false`) from "configured but nothing discovered" (`true`),
|
|
190
198
|
* which the list leaf surfaces as `meta`.
|
|
191
199
|
*
|
|
200
|
+
* @param {Project} [project] the project, when the caller has loaded it
|
|
192
201
|
* @returns {Promise<{packages: ScannedPackage[], configured: boolean, project: Project}>}
|
|
193
202
|
*/
|
|
194
|
-
export async function discoverPackages() {
|
|
195
|
-
|
|
203
|
+
export async function discoverPackages(project) {
|
|
204
|
+
project ??= await Project.load();
|
|
196
205
|
const loadedIntegrations =
|
|
197
206
|
/** @type {import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]} */ (
|
|
198
207
|
project.loadedIntegrations
|
|
@@ -210,6 +219,7 @@ export async function discoverPackages() {
|
|
|
210
219
|
return {packages: [], configured: loadedIntegrations.length > 0, project};
|
|
211
220
|
}
|
|
212
221
|
|
|
222
|
+
const {scanAllPackages} = await import('./_package-scanner.mjs');
|
|
213
223
|
const packages = scanAllPackages(
|
|
214
224
|
[],
|
|
215
225
|
/** @type {ScannedPackage[]} */ (/** @type {unknown} */ (explicitPackages)),
|
|
@@ -259,12 +269,32 @@ export function packageDescription(packageDir) {
|
|
|
259
269
|
* no components root is included with `components: []`; one that failed to
|
|
260
270
|
* load is left out (the integration-issues nudge and Doctor report it).
|
|
261
271
|
*
|
|
272
|
+
* Describing them reads every integration's templates, themes and codemods
|
|
273
|
+
* and the project's whole docs catalog, so the answer is kept between runs
|
|
274
|
+
* while every file it read is unchanged (foundation/fs/gather-cache.mjs).
|
|
275
|
+
*
|
|
262
276
|
* @param {Project | undefined} project
|
|
263
277
|
* @param {ScannedPackage[]} scanned the packages {@link discoverPackages} found
|
|
264
278
|
* @returns {Promise<InstalledPackage[]>}
|
|
265
279
|
*/
|
|
266
280
|
export async function describeInstalled(project, scanned) {
|
|
267
281
|
if (project == null) return scanned;
|
|
282
|
+
return /** @type {Promise<InstalledPackage[]>} */ (
|
|
283
|
+
persistedGather(
|
|
284
|
+
['discover-installed', realDir(project.cwd), optedIntoIconSets(project)],
|
|
285
|
+
() => describeInstalledFresh(project, scanned),
|
|
286
|
+
INSTALLED_CODEC,
|
|
287
|
+
)
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* The installed packages describeInstalled names, worked out from the files.
|
|
293
|
+
* @param {Project} project
|
|
294
|
+
* @param {ScannedPackage[]} scanned
|
|
295
|
+
* @returns {Promise<InstalledPackage[]>}
|
|
296
|
+
*/
|
|
297
|
+
async function describeInstalledFresh(project, scanned) {
|
|
268
298
|
const byName = new Map(scanned.map(pkg => [pkg.name, pkg]));
|
|
269
299
|
const docs = await projectDocs(project);
|
|
270
300
|
/** @type {InstalledPackage[]} */
|
|
@@ -283,7 +313,7 @@ export async function describeInstalled(project, scanned) {
|
|
|
283
313
|
);
|
|
284
314
|
// Components come from the scan above; loading every component doc again
|
|
285
315
|
// here would only slow the list down.
|
|
286
|
-
// Icon sets are read below, only
|
|
316
|
+
// Icon sets are read below, only where icon features are on.
|
|
287
317
|
// Docs are named from the project's docs catalog, below.
|
|
288
318
|
const {identities} = await collectIdentities({
|
|
289
319
|
...integration,
|
|
@@ -294,7 +324,7 @@ export async function describeInstalled(project, scanned) {
|
|
|
294
324
|
// Icon sets are listed the way every icon surface sees them: a set that
|
|
295
325
|
// is invalid or whose module does not resolve answers nothing (FR9).
|
|
296
326
|
// They are experimental (spec:AST-017 FR27), so discover lists them only
|
|
297
|
-
//
|
|
327
|
+
// where the icon feature gate is on.
|
|
298
328
|
const {sets, withdrawn} = optedIntoIconSets(project)
|
|
299
329
|
? discoverIntegrationIconSets(integration, {projectDir: project.cwd})
|
|
300
330
|
: {sets: [], withdrawn: []};
|
|
@@ -375,6 +405,19 @@ async function projectDocs(project) {
|
|
|
375
405
|
}
|
|
376
406
|
}
|
|
377
407
|
|
|
408
|
+
/** The installed packages, kept exactly, with the shape they need. */
|
|
409
|
+
const INSTALLED_CODEC = {
|
|
410
|
+
...EXACT_CODEC,
|
|
411
|
+
valid: (/** @type {any} */ value) =>
|
|
412
|
+
Array.isArray(value) &&
|
|
413
|
+
value.every(
|
|
414
|
+
(/** @type {any} */ pkg) =>
|
|
415
|
+
pkg != null &&
|
|
416
|
+
typeof pkg.name === 'string' &&
|
|
417
|
+
Array.isArray(pkg.components),
|
|
418
|
+
),
|
|
419
|
+
};
|
|
420
|
+
|
|
378
421
|
/**
|
|
379
422
|
* Whether the project has any discover source: its own `discover` config field,
|
|
380
423
|
* or an integration's `discover` named export (valid or not).
|
|
@@ -609,8 +652,14 @@ export function addCommand(project, {official = []} = {}) {
|
|
|
609
652
|
const verb = (name, version) =>
|
|
610
653
|
addVerbFor(cwd, name.startsWith('@astryxdesign/') ? version : null);
|
|
611
654
|
return (name, version) => {
|
|
612
|
-
if (version) return `${verb(name, version)} ${name}@${version}`;
|
|
613
655
|
const pin = byName.get(name)?.pin;
|
|
656
|
+
// The guidance names the same version the command would add.
|
|
657
|
+
const guidance = installGuidanceFor(
|
|
658
|
+
[version ? `${name}@${version}` : pin ? `${name}@${pin}` : name],
|
|
659
|
+
cwd,
|
|
660
|
+
);
|
|
661
|
+
if (guidance != null) return guidance;
|
|
662
|
+
if (version) return `${verb(name, version)} ${name}@${version}`;
|
|
614
663
|
if (!pin) return `${verb(name, null)} ${name}`;
|
|
615
664
|
return isValidSemver(pin)
|
|
616
665
|
? `${verb(name, pin)} ${name}@${pin}`
|
|
@@ -645,7 +694,7 @@ function savedCopyPath(cacheDir, from, request) {
|
|
|
645
694
|
/**
|
|
646
695
|
* @param {string} file
|
|
647
696
|
* @param {string} label
|
|
648
|
-
* @param {boolean} iconSets
|
|
697
|
+
* @param {boolean} iconSets icon features are on in the project
|
|
649
698
|
*/
|
|
650
699
|
function readSavedCopy(file, label, iconSets) {
|
|
651
700
|
try {
|
|
@@ -682,7 +731,7 @@ function writeSavedCopy(file, catalog) {
|
|
|
682
731
|
* @param {{package?: string, version?: string}} request
|
|
683
732
|
* @param {string} label
|
|
684
733
|
* @param {number} timeoutMs
|
|
685
|
-
* @param {boolean} iconSets
|
|
734
|
+
* @param {boolean} iconSets icon features are on in the project
|
|
686
735
|
*/
|
|
687
736
|
async function callSource(source, request, label, timeoutMs, iconSets) {
|
|
688
737
|
const controller = new AbortController();
|
|
@@ -710,32 +759,36 @@ async function callSource(source, request, label, timeoutMs, iconSets) {
|
|
|
710
759
|
}
|
|
711
760
|
|
|
712
761
|
/**
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
*
|
|
717
|
-
|
|
718
|
-
|
|
762
|
+
* The project's root: the folder that holds its config, or the folder the
|
|
763
|
+
* project loaded from when it has none.
|
|
764
|
+
* @param {Project} project
|
|
765
|
+
* @returns {string}
|
|
766
|
+
*/
|
|
767
|
+
function projectRoot(project) {
|
|
768
|
+
return project.configPath ? path.dirname(project.configPath) : project.cwd;
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Where each discover source comes from, in call order: the project's
|
|
773
|
+
* `discover` first, then each integration's in load order, then each a host
|
|
774
|
+
* passed. `key` names a source's saved copies when it differs from `from`.
|
|
719
775
|
* @param {Project | undefined} project
|
|
720
|
-
* @
|
|
721
|
-
* and optionally one version's contributions
|
|
722
|
-
* @param {{cacheDir?: string, timeoutMs?: number}} [options]
|
|
723
|
-
* @returns {Promise<CatalogResult>}
|
|
776
|
+
* @returns {Array<{from: string, key?: string, source?: DiscoverSource, error?: string}>}
|
|
724
777
|
*/
|
|
725
|
-
|
|
726
|
-
const {cacheDir = defaultCacheDir(), timeoutMs = SOURCE_TIMEOUT_MS} = options;
|
|
727
|
-
/** @type {CatalogResult} */
|
|
728
|
-
const result = {sources: [], packages: []};
|
|
778
|
+
function sourceOrigins(project) {
|
|
729
779
|
const fromDoor = doorSources();
|
|
730
|
-
if (project == null && fromDoor.length === 0) return result;
|
|
731
|
-
// Without the opt-in, icon-set items and fields are unknown before the
|
|
732
|
-
// catalog is checked, so one cannot fail a source (spec:AST-051 FR7).
|
|
733
|
-
const iconSets = optedIntoIconSets(project);
|
|
734
|
-
|
|
735
780
|
/** @type {Array<{from: string, key?: string, source?: DiscoverSource, error?: string}>} */
|
|
736
781
|
const origins = [];
|
|
737
782
|
if (typeof project?.config?.discover === 'function') {
|
|
738
|
-
|
|
783
|
+
// A project's own source is the project's: its saved copies are kept per
|
|
784
|
+
// project root, the folder that holds the config, so one project's
|
|
785
|
+
// catalog never answers for another's and every folder in a project
|
|
786
|
+
// reads the same copy.
|
|
787
|
+
origins.push({
|
|
788
|
+
from: 'astryx.config',
|
|
789
|
+
key: `astryx.config\n${realDir(projectRoot(project))}`,
|
|
790
|
+
source: project.config.discover,
|
|
791
|
+
});
|
|
739
792
|
}
|
|
740
793
|
for (const integration of project?.loadedIntegrations ?? []) {
|
|
741
794
|
if (integration.__discoverError) {
|
|
@@ -756,6 +809,114 @@ async function callOwnSources(project, request = {}, options = {}) {
|
|
|
756
809
|
fromDoor.length === 1 ? DOOR_SOURCE : `${DOOR_SOURCE} (${index + 1})`;
|
|
757
810
|
origins.push({from, key: `${from}\n${host}`, source});
|
|
758
811
|
});
|
|
812
|
+
return origins;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
/**
|
|
816
|
+
* The packages discover lists from the saved copies of the discover sources'
|
|
817
|
+
* full catalogs, read without calling a source, and the official packages no
|
|
818
|
+
* source covers, as discover adds them. Null when no source has a saved copy.
|
|
819
|
+
* A copy is read as saved: it was checked before it was saved, and checking
|
|
820
|
+
* it again costs more than a hint may. A caller treats a copy that does not
|
|
821
|
+
* read as unknown.
|
|
822
|
+
* @param {Project | undefined} project
|
|
823
|
+
* @param {{cacheDir?: string, official?: OfficialList}} [options]
|
|
824
|
+
* `official`: the list {@link officialList} read; read here when absent
|
|
825
|
+
* @returns {CatalogResult['packages'] | null}
|
|
826
|
+
*/
|
|
827
|
+
export function savedCatalog(
|
|
828
|
+
project,
|
|
829
|
+
{cacheDir = defaultCacheDir(), official = officialList({project})} = {},
|
|
830
|
+
) {
|
|
831
|
+
/** @type {CatalogResult['packages']} */
|
|
832
|
+
const packages = [];
|
|
833
|
+
/** @type {Set<unknown>} */
|
|
834
|
+
const read = new Set();
|
|
835
|
+
/** @type {Set<string>} */
|
|
836
|
+
const seen = new Set();
|
|
837
|
+
let saved = false;
|
|
838
|
+
for (const {from, key = from, source} of sourceOrigins(project)) {
|
|
839
|
+
if (source == null || read.has(source)) continue;
|
|
840
|
+
read.add(source);
|
|
841
|
+
const file = savedCopyPath(cacheDir, key, {});
|
|
842
|
+
if (!fs.existsSync(file)) continue;
|
|
843
|
+
/** @type {import('../../authoring/discover/type').DiscoverCatalog} */
|
|
844
|
+
const catalog = JSON.parse(fs.readFileSync(file, 'utf8')).catalog;
|
|
845
|
+
saved = true;
|
|
846
|
+
for (const pkg of catalog.packages) {
|
|
847
|
+
if (seen.has(pkg.package)) continue;
|
|
848
|
+
seen.add(pkg.package);
|
|
849
|
+
packages.push({...pkg, source: catalog.source.name});
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (!saved) return null;
|
|
853
|
+
return withoutUnreadKinds(project, [
|
|
854
|
+
...packages,
|
|
855
|
+
...officialNotCovered(packages, official),
|
|
856
|
+
]);
|
|
857
|
+
}
|
|
858
|
+
|
|
859
|
+
/**
|
|
860
|
+
* What `discover <query>` searches when its sources answer from their saved
|
|
861
|
+
* copies, worked out by `build` and kept between runs while every file it
|
|
862
|
+
* read is unchanged (foundation/fs/gather-cache.mjs), so search's discover
|
|
863
|
+
* line reads one kept record instead of scanning the project and parsing
|
|
864
|
+
* the copies on every run. Null when no source of the project has a saved
|
|
865
|
+
* copy of its full catalog; the copies are only looked for then, never read.
|
|
866
|
+
* @template T
|
|
867
|
+
* @param {(project: Project) => Promise<T>} build
|
|
868
|
+
* @param {(value: unknown) => boolean} valid the shape a kept value needs
|
|
869
|
+
* @returns {Promise<T | null>}
|
|
870
|
+
*/
|
|
871
|
+
export async function keptSavedSearch(build, valid) {
|
|
872
|
+
// The project the run already loaded, when it did: search loads it first.
|
|
873
|
+
const project = Project.lastLoaded() ?? (await Project.load());
|
|
874
|
+
const cacheDir = defaultCacheDir();
|
|
875
|
+
const copies = sourceOrigins(project)
|
|
876
|
+
.filter(origin => origin.source != null)
|
|
877
|
+
.map(({from, key = from}) => savedCopyPath(cacheDir, key, {}));
|
|
878
|
+
if (!copies.some(file => fs.existsSync(file))) return null;
|
|
879
|
+
return /** @type {Promise<T>} */ (
|
|
880
|
+
persistedGather(
|
|
881
|
+
[
|
|
882
|
+
'discover-saved-search',
|
|
883
|
+
// The run folder, not the project root: what discover counts as
|
|
884
|
+
// declared is read from the folder the command runs in.
|
|
885
|
+
realDir(project.cwd),
|
|
886
|
+
optedIntoIconSets(project),
|
|
887
|
+
],
|
|
888
|
+
() => build(project),
|
|
889
|
+
// Plain strings and arrays: kept and read back as they are, with no
|
|
890
|
+
// walk over the record on every search.
|
|
891
|
+
{encode: value => value, decode: value => value, valid},
|
|
892
|
+
)
|
|
893
|
+
);
|
|
894
|
+
}
|
|
895
|
+
|
|
896
|
+
/**
|
|
897
|
+
* Call the discover sources — the project's `discover` first, then each
|
|
898
|
+
* integration's in load order, then each a host passed, named as the host's
|
|
899
|
+
* (spec AST-081 FR1, AST-051 FR6) — once per distinct function. A source that
|
|
900
|
+
* throws, times out, or returns an invalid catalog falls back to its saved copy;
|
|
901
|
+
* with none, it is reported and adds nothing. The others always count.
|
|
902
|
+
*
|
|
903
|
+
* @param {Project | undefined} project
|
|
904
|
+
* @param {{package?: string, version?: string}} [request] ask for one package,
|
|
905
|
+
* and optionally one version's contributions
|
|
906
|
+
* @param {{cacheDir?: string, timeoutMs?: number}} [options]
|
|
907
|
+
* @returns {Promise<CatalogResult>}
|
|
908
|
+
*/
|
|
909
|
+
async function callOwnSources(project, request = {}, options = {}) {
|
|
910
|
+
const {cacheDir = defaultCacheDir(), timeoutMs = SOURCE_TIMEOUT_MS} = options;
|
|
911
|
+
/** @type {CatalogResult} */
|
|
912
|
+
const result = {sources: [], packages: []};
|
|
913
|
+
const fromDoor = doorSources();
|
|
914
|
+
if (project == null && fromDoor.length === 0) return result;
|
|
915
|
+
// With icon features off, icon-set items and fields are unknown before the
|
|
916
|
+
// catalog is checked, so one cannot fail a source (spec:AST-051 FR7).
|
|
917
|
+
const iconSets = optedIntoIconSets(project);
|
|
918
|
+
|
|
919
|
+
const origins = sourceOrigins(project);
|
|
759
920
|
|
|
760
921
|
/** @type {Set<unknown>} */
|
|
761
922
|
const called = new Set();
|
|
@@ -838,18 +999,7 @@ async function callOwnSources(project, request = {}, options = {}) {
|
|
|
838
999
|
export async function callSources(project, request = {}, options = {}) {
|
|
839
1000
|
const {official = officialList({project}), ...rest} = options;
|
|
840
1001
|
const own = await callOwnSources(project, request, rest);
|
|
841
|
-
|
|
842
|
-
// publishes under any name (FR7), so a fork or mirror keeps its place.
|
|
843
|
-
const seen = new Set(
|
|
844
|
-
own.packages.flatMap(pkg => [pkg.package, pkg.integration, ...pkg.aliases]),
|
|
845
|
-
);
|
|
846
|
-
/** @type {CatalogResult['packages']} */
|
|
847
|
-
const added = [];
|
|
848
|
-
for (const {pin: _pin, ...pkg} of official.packages) {
|
|
849
|
-
if (seen.has(pkg.package)) continue;
|
|
850
|
-
if (request.package && pkg.package !== request.package) continue;
|
|
851
|
-
added.push({...pkg, source: OFFICIAL_SOURCE_NAME, official: true});
|
|
852
|
-
}
|
|
1002
|
+
const added = officialNotCovered(own.packages, official, request);
|
|
853
1003
|
return {
|
|
854
1004
|
sources: [
|
|
855
1005
|
...own.sources,
|
|
@@ -869,15 +1019,40 @@ export async function callSources(project, request = {}, options = {}) {
|
|
|
869
1019
|
],
|
|
870
1020
|
// Source order: the first entry per integration is the one discover
|
|
871
1021
|
// keeps. Official packages are put first only where discover shows them.
|
|
872
|
-
// An experimental kind is a kind this project does not read unless
|
|
873
|
-
//
|
|
1022
|
+
// An experimental kind is a kind this project does not read unless that
|
|
1023
|
+
// kind is on here (for icon sets: an installed icon-set package or
|
|
1024
|
+
// `experimental.iconSet`), so its items are ignored like any unknown kind
|
|
1025
|
+
// (FR7).
|
|
874
1026
|
packages: withoutUnreadKinds(project, [...own.packages, ...added]),
|
|
875
1027
|
};
|
|
876
1028
|
}
|
|
877
1029
|
|
|
1030
|
+
/**
|
|
1031
|
+
* The official packages no source's entry covers, as catalog packages. A
|
|
1032
|
+
* source's entry wins for its package and for the integration it publishes
|
|
1033
|
+
* under any name (FR7), so a fork or mirror keeps its place.
|
|
1034
|
+
* @param {CatalogResult['packages']} packages the sources' packages
|
|
1035
|
+
* @param {OfficialList} official
|
|
1036
|
+
* @param {{package?: string}} [request] keep only this package
|
|
1037
|
+
* @returns {CatalogResult['packages']}
|
|
1038
|
+
*/
|
|
1039
|
+
function officialNotCovered(packages, official, request = {}) {
|
|
1040
|
+
const seen = new Set(
|
|
1041
|
+
packages.flatMap(pkg => [pkg.package, pkg.integration, ...pkg.aliases]),
|
|
1042
|
+
);
|
|
1043
|
+
/** @type {CatalogResult['packages']} */
|
|
1044
|
+
const added = [];
|
|
1045
|
+
for (const {pin: _pin, ...pkg} of official.packages) {
|
|
1046
|
+
if (seen.has(pkg.package)) continue;
|
|
1047
|
+
if (request.package && pkg.package !== request.package) continue;
|
|
1048
|
+
added.push({...pkg, source: OFFICIAL_SOURCE_NAME, official: true});
|
|
1049
|
+
}
|
|
1050
|
+
return added;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
878
1053
|
/**
|
|
879
1054
|
* The experimental item kinds a catalog may list (spec:AST-017 FR27):
|
|
880
|
-
* `icon-set`, read only
|
|
1055
|
+
* `icon-set`, read only where the icon feature gate is on.
|
|
881
1056
|
*/
|
|
882
1057
|
export const EXPERIMENTAL_KINDS = /** @type {const} */ (['icon-set']);
|
|
883
1058
|
|
|
@@ -898,7 +1073,7 @@ export async function loadReadKinds() {
|
|
|
898
1073
|
|
|
899
1074
|
/**
|
|
900
1075
|
* The item kinds discover reads in this project: every stable kind, and the
|
|
901
|
-
* experimental ones
|
|
1076
|
+
* experimental ones where icon features are on.
|
|
902
1077
|
* @param {Project | undefined} project
|
|
903
1078
|
* @returns {readonly string[]}
|
|
904
1079
|
*/
|
|
@@ -907,11 +1082,11 @@ export function readKinds(project) {
|
|
|
907
1082
|
}
|
|
908
1083
|
|
|
909
1084
|
/**
|
|
910
|
-
* Whether
|
|
1085
|
+
* Whether discover reads icon sets in this project: the icon feature gate.
|
|
911
1086
|
* @param {Project | undefined} project
|
|
912
1087
|
*/
|
|
913
1088
|
export function optedIntoIconSets(project) {
|
|
914
|
-
return
|
|
1089
|
+
return iconFeatureGate(project).on;
|
|
915
1090
|
}
|
|
916
1091
|
|
|
917
1092
|
/**
|
|
@@ -1171,9 +1346,10 @@ export function toEntry(pkg) {
|
|
|
1171
1346
|
* Locate a component's doc file within the given packages (case-insensitive).
|
|
1172
1347
|
* @param {ScannedPackage[]} packages
|
|
1173
1348
|
* @param {string} name
|
|
1174
|
-
* @returns {ComponentResolution | null}
|
|
1349
|
+
* @returns {Promise<ComponentResolution | null>}
|
|
1175
1350
|
*/
|
|
1176
|
-
export function findComponent(packages, name) {
|
|
1351
|
+
export async function findComponent(packages, name) {
|
|
1352
|
+
const {findComponentInPackages} = await import('./_package-scanner.mjs');
|
|
1177
1353
|
return findComponentInPackages(packages, name);
|
|
1178
1354
|
}
|
|
1179
1355
|
|
|
@@ -1212,3 +1388,56 @@ export async function loadValidatedDoc(result, {lang, zh}) {
|
|
|
1212
1388
|
);
|
|
1213
1389
|
return docs;
|
|
1214
1390
|
}
|
|
1391
|
+
|
|
1392
|
+
/**
|
|
1393
|
+
* The not-found error with Core's match for the query in its suggestions:
|
|
1394
|
+
* the first Core component or hook `astryx search` gives in `cwd`, as the
|
|
1395
|
+
* lookups' shared hint (foundation/suggest/other-command.mjs) names it, after
|
|
1396
|
+
* discover's own near names, when
|
|
1397
|
+
* search answers the whole query with it by a name or keyword: one word at
|
|
1398
|
+
* search's keyword strength, or every word of a longer query
|
|
1399
|
+
* (api/search/_score.mjs). A Core entry search found only through prose, or
|
|
1400
|
+
* through some of the words, is too weak a match to name. The error is
|
|
1401
|
+
* unchanged when search gives no such entry, or fails.
|
|
1402
|
+
* @param {AstryxError} err
|
|
1403
|
+
* @param {string} query
|
|
1404
|
+
* @param {string} cwd
|
|
1405
|
+
* @returns {Promise<AstryxError>}
|
|
1406
|
+
*/
|
|
1407
|
+
export async function withCoreMatch(err, query, cwd) {
|
|
1408
|
+
try {
|
|
1409
|
+
const [
|
|
1410
|
+
{search, tokenizeQuery, spellIdentifiers},
|
|
1411
|
+
{FULL_COVERAGE_SCORE, STRONG_TOKEN_SCORE},
|
|
1412
|
+
{hintFor, MATCH_TIER},
|
|
1413
|
+
] = await Promise.all([
|
|
1414
|
+
import('../search/search.mjs'),
|
|
1415
|
+
import('../search/_score.mjs'),
|
|
1416
|
+
import('../../foundation/suggest/other-command.mjs'),
|
|
1417
|
+
]);
|
|
1418
|
+
const {results} = (await search(query, {cwd})).data;
|
|
1419
|
+
const core = results.find(
|
|
1420
|
+
r =>
|
|
1421
|
+
(r.domain === 'component' || r.domain === 'hook') &&
|
|
1422
|
+
r.package === CORE_PACKAGE_NAME,
|
|
1423
|
+
);
|
|
1424
|
+
const strong =
|
|
1425
|
+
tokenizeQuery(spellIdentifiers(query)).length > 1
|
|
1426
|
+
? FULL_COVERAGE_SCORE
|
|
1427
|
+
: STRONG_TOKEN_SCORE;
|
|
1428
|
+
if (!core || core.score < strong) return err;
|
|
1429
|
+
const command = /** @type {'component' | 'hook'} */ (core.domain);
|
|
1430
|
+
// The hint names another command, so it follows discover's own near
|
|
1431
|
+
// names rather than taking the place of one.
|
|
1432
|
+
return new AstryxError(
|
|
1433
|
+
err.message,
|
|
1434
|
+
[
|
|
1435
|
+
...(err.suggestions ?? []),
|
|
1436
|
+
hintFor(command, core.name, undefined, MATCH_TIER.words).hint,
|
|
1437
|
+
],
|
|
1438
|
+
err.code,
|
|
1439
|
+
);
|
|
1440
|
+
} catch {
|
|
1441
|
+
return err;
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
* @property {string} [summary]
|
|
19
19
|
* @property {string[]} [keywords]
|
|
20
20
|
* @property {string} [description]
|
|
21
|
+
* @property {string} [packageDescription] an item's package's description:
|
|
22
|
+
* search reads its words with the item's own
|
|
21
23
|
*/
|
|
22
24
|
/**
|
|
23
25
|
* Group a version's contributions into the entry fields, one list per kind.
|
|
@@ -125,4 +127,9 @@ export type SearchItem = {
|
|
|
125
127
|
summary?: string | undefined;
|
|
126
128
|
keywords?: string[] | undefined;
|
|
127
129
|
description?: string | undefined;
|
|
130
|
+
/**
|
|
131
|
+
* an item's package's description:
|
|
132
|
+
* search reads its words with the item's own
|
|
133
|
+
*/
|
|
134
|
+
packageDescription?: string | undefined;
|
|
128
135
|
};
|
|
@@ -28,6 +28,8 @@ import {KIND_FIELDS} from './_adapter.mjs';
|
|
|
28
28
|
* @property {string} [summary]
|
|
29
29
|
* @property {string[]} [keywords]
|
|
30
30
|
* @property {string} [description]
|
|
31
|
+
* @property {string} [packageDescription] an item's package's description:
|
|
32
|
+
* search reads its words with the item's own
|
|
31
33
|
*/
|
|
32
34
|
|
|
33
35
|
/**
|
|
@@ -190,7 +192,13 @@ export function searchItems(installed, catalog, declared, officialDeclared) {
|
|
|
190
192
|
const names = /** @type {Record<string, unknown>} */ (pkg)[field];
|
|
191
193
|
if (!Array.isArray(names)) continue;
|
|
192
194
|
for (const name of names) {
|
|
193
|
-
items.push({
|
|
195
|
+
items.push({
|
|
196
|
+
package: pkg.name,
|
|
197
|
+
kind,
|
|
198
|
+
name,
|
|
199
|
+
installed: true,
|
|
200
|
+
...(pkg.description ? {packageDescription: pkg.description} : {}),
|
|
201
|
+
});
|
|
194
202
|
}
|
|
195
203
|
}
|
|
196
204
|
}
|
|
@@ -221,6 +229,7 @@ export function searchItems(installed, catalog, declared, officialDeclared) {
|
|
|
221
229
|
...(c.title ? {title: c.title} : {}),
|
|
222
230
|
...(c.summary ? {summary: c.summary} : {}),
|
|
223
231
|
...(c.keywords ? {keywords: c.keywords} : {}),
|
|
232
|
+
...(pkg.description ? {packageDescription: pkg.description} : {}),
|
|
224
233
|
});
|
|
225
234
|
}
|
|
226
235
|
}
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
/**
|
|
5
5
|
* Build the discover.detail response for one package. The project's installed
|
|
6
6
|
* copy describes itself; any other version is described by its source. For a
|
|
7
|
-
* package the project does not have, `install`
|
|
8
|
-
*
|
|
7
|
+
* package the project does not have, `install` says how to add it (the
|
|
8
|
+
* project's integration install guidance, else the package-manager command)
|
|
9
|
+
* — printed, never run.
|
|
9
10
|
*
|
|
10
11
|
* @param {import('../_adapter.mjs').InstalledPackage[]} packages
|
|
11
12
|
* @param {string} name package name, e.g. `@scope/name`
|