@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
|
@@ -289,6 +289,45 @@ function removeStylesheetHooks() {
|
|
|
289
289
|
}
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
+
/**
|
|
293
|
+
* The file Node could not load, from its refusal of an unknown extension
|
|
294
|
+
* (a native import), or from a syntax error in a file that is no JavaScript
|
|
295
|
+
* (jiti's synchronous require, which reads the file as a script and names it
|
|
296
|
+
* on the first line of the stack). Null for any other error.
|
|
297
|
+
* @param {unknown} error
|
|
298
|
+
* @returns {string | null}
|
|
299
|
+
*/
|
|
300
|
+
function unloadableFile(error) {
|
|
301
|
+
const e = /** @type {any} */ (error);
|
|
302
|
+
if (e?.code === 'ERR_UNKNOWN_FILE_EXTENSION')
|
|
303
|
+
return /\bfor (.+)$/.exec(String(e.message))?.[1] ?? null;
|
|
304
|
+
if (e instanceof SyntaxError)
|
|
305
|
+
return /^(.+):\d+$/.exec(String(e.stack).split('\n')[0])?.[1] ?? null;
|
|
306
|
+
return null;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* On a Node without module hooks, the refusal for a stylesheet or an asset a
|
|
311
|
+
* theme module imports: it names the file and the Node that loads it. Null
|
|
312
|
+
* for any other error.
|
|
313
|
+
* @param {unknown} error
|
|
314
|
+
* @returns {Error | null}
|
|
315
|
+
*/
|
|
316
|
+
function needsModuleHooks(error) {
|
|
317
|
+
const file = unloadableFile(error);
|
|
318
|
+
if (!file || !(STYLESHEET_FILE.test(file) || ASSET_FILE.test(file)))
|
|
319
|
+
return null;
|
|
320
|
+
const relative = path.relative(process.cwd(), file);
|
|
321
|
+
const shown =
|
|
322
|
+
relative && !relative.startsWith('..') && !path.isAbsolute(relative)
|
|
323
|
+
? relative
|
|
324
|
+
: file;
|
|
325
|
+
return new Error(
|
|
326
|
+
`it imports ${shown}, and loading a theme that imports a stylesheet or asset needs Node 22.15 or later, or 23.5 or later (this is Node ${process.versions.node}). Nothing was written.`,
|
|
327
|
+
{cause: error},
|
|
328
|
+
);
|
|
329
|
+
}
|
|
330
|
+
|
|
292
331
|
/**
|
|
293
332
|
* Run a theme module load with every stylesheet that the theme's modules
|
|
294
333
|
* import, at any depth, loaded as an empty module, and every asset they
|
|
@@ -304,7 +343,9 @@ function removeStylesheetHooks() {
|
|
|
304
343
|
* there, so the caller can say what its outputs do not carry. Module loads
|
|
305
344
|
* outside this call's async context do not change. The module hook is
|
|
306
345
|
* installed for the first overlapping load and removed after the last. A
|
|
307
|
-
* Node without module hooks (before 22.15) runs the load
|
|
346
|
+
* Node without module hooks (before 22.15, or 23.0 to 23.4) runs the load
|
|
347
|
+
* unchanged, and a stylesheet or asset it meets refuses the load, naming
|
|
348
|
+
* that Node.
|
|
308
349
|
* @template T
|
|
309
350
|
* @param {() => Promise<T>} load
|
|
310
351
|
* @param {{unbuilt?: Set<string>, imported?: Set<string>}} [options]
|
|
@@ -316,7 +357,13 @@ export async function withEmptyStylesheets(load, options = {}) {
|
|
|
316
357
|
// running never keeps the command from exiting, and an exit it calls
|
|
317
358
|
// while loading is a refused load, never the command's own exit.
|
|
318
359
|
const guarded = () => withStdoutOnStderr(() => withThemeModuleGuards(load));
|
|
319
|
-
if (typeof registerHooks !== 'function')
|
|
360
|
+
if (typeof registerHooks !== 'function') {
|
|
361
|
+
try {
|
|
362
|
+
return await guarded();
|
|
363
|
+
} catch (error) {
|
|
364
|
+
throw needsModuleHooks(error) ?? error;
|
|
365
|
+
}
|
|
366
|
+
}
|
|
320
367
|
stylesheetHooks ??= registerHooks({
|
|
321
368
|
resolve: resolveUnbuiltStylesheet,
|
|
322
369
|
load: loadStylesheetAsEmptyModule,
|
|
@@ -344,6 +391,11 @@ let exitGuards = 0;
|
|
|
344
391
|
/** @type {typeof process.exit | null} */
|
|
345
392
|
let realExit = null;
|
|
346
393
|
let guardsInstalled = false;
|
|
394
|
+
/**
|
|
395
|
+
* The last exception a theme module's microtask threw, with its load.
|
|
396
|
+
* @type {{error: unknown, load: GuardedLoad} | null}
|
|
397
|
+
*/
|
|
398
|
+
let microtaskThrow = null;
|
|
347
399
|
/** Callbacks of a module load running now, each holding the stdout gate. */
|
|
348
400
|
const deferredGates = new Set();
|
|
349
401
|
/**
|
|
@@ -563,12 +615,31 @@ function installThemeModuleGuards() {
|
|
|
563
615
|
// One thrown while the module still loads (from a microtask it queued)
|
|
564
616
|
// refuses that load with it, as a throw from its top level does.
|
|
565
617
|
tellThemeModuleCallbacks(error => {
|
|
566
|
-
const
|
|
618
|
+
const thrown = microtaskThrow?.error === error ? microtaskThrow : null;
|
|
619
|
+
microtaskThrow = null;
|
|
620
|
+
const load = guardedLoad.getStore() ?? thrown?.load;
|
|
567
621
|
if (!load) return null;
|
|
568
622
|
if (load.done) return 'after';
|
|
569
623
|
load.fail(error);
|
|
570
624
|
return 'during';
|
|
571
625
|
});
|
|
626
|
+
// Before Node 24, an exception from a microtask reaches 'uncaughtException'
|
|
627
|
+
// outside the async context that queued it. A microtask a theme module
|
|
628
|
+
// queues keeps its load, so its exception is told as the module's.
|
|
629
|
+
const queue = globalThis.queueMicrotask;
|
|
630
|
+
globalThis.queueMicrotask = function (callback) {
|
|
631
|
+
const load = guardedLoad.getStore();
|
|
632
|
+
if (!load || typeof callback !== 'function')
|
|
633
|
+
return queue.call(globalThis, callback);
|
|
634
|
+
return queue.call(globalThis, () => {
|
|
635
|
+
try {
|
|
636
|
+
callback();
|
|
637
|
+
} catch (error) {
|
|
638
|
+
microtaskThrow = {error, load};
|
|
639
|
+
throw error;
|
|
640
|
+
}
|
|
641
|
+
});
|
|
642
|
+
};
|
|
572
643
|
// A global Node defines as replaceable (an accessor, such as `Buffer`)
|
|
573
644
|
// that a theme module assigns while it loads is put back when the load
|
|
574
645
|
// ends: its value as it was is read only when the module assigns it.
|
|
@@ -667,9 +738,14 @@ async function withThemeModuleGuards(load) {
|
|
|
667
738
|
holdExit();
|
|
668
739
|
/** @type {(error: unknown) => void} */
|
|
669
740
|
let fail = () => {};
|
|
741
|
+
/** The first refusal, held where the race below cannot lose it. */
|
|
742
|
+
const failure = /** @type {{error?: {value: unknown}}} */ ({});
|
|
670
743
|
/** @type {Promise<never>} */
|
|
671
744
|
const failed = new Promise((_resolve, reject) => {
|
|
672
|
-
fail =
|
|
745
|
+
fail = error => {
|
|
746
|
+
failure.error ??= {value: error};
|
|
747
|
+
reject(error);
|
|
748
|
+
};
|
|
673
749
|
});
|
|
674
750
|
// Read only through the race below; a failure after it settled is moot.
|
|
675
751
|
failed.catch(() => {});
|
|
@@ -698,11 +774,15 @@ async function withThemeModuleGuards(load) {
|
|
|
698
774
|
// Node empties its loop with the load still waiting: refused, not exit 13.
|
|
699
775
|
process.once('beforeExit', drained);
|
|
700
776
|
try {
|
|
701
|
-
|
|
777
|
+
const loaded = await Promise.race([
|
|
702
778
|
guardedLoad.run(store, load),
|
|
703
779
|
unsettled,
|
|
704
780
|
failed,
|
|
705
781
|
]);
|
|
782
|
+
// A load that settles in the same microtask checkpoint as a microtask it
|
|
783
|
+
// queued wins the race before that microtask's exception refuses it.
|
|
784
|
+
if (failure.error) throw failure.error.value;
|
|
785
|
+
return loaded;
|
|
706
786
|
} finally {
|
|
707
787
|
process.removeListener('beforeExit', drained);
|
|
708
788
|
process.exitCode = exitCode;
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @input An operation run inside `recordReads(seen, fn)`.
|
|
8
8
|
* @output `seen` gets every file whose content the operation read through fs
|
|
9
|
-
* or imported as a doc module
|
|
9
|
+
* (synchronously or with promises.readFile) or imported as a doc module
|
|
10
|
+
* (`recordContentRead`), and every folder it
|
|
10
11
|
* listed or probed, each with its state when first read; an exact run
|
|
11
12
|
* records each probed path by what the call returned instead.
|
|
12
13
|
* `unchangedSince(seen)` says whether all are still in that state.
|
|
@@ -126,10 +127,11 @@ const RECORDED = [
|
|
|
126
127
|
'realpathSync',
|
|
127
128
|
'accessSync',
|
|
128
129
|
'openSync',
|
|
130
|
+
'readFile',
|
|
129
131
|
];
|
|
130
132
|
|
|
131
133
|
/** The reads that see a file's content, so the file itself is checked. */
|
|
132
|
-
const CONTENT_READS = new Set(['readFileSync', 'openSync']);
|
|
134
|
+
const CONTENT_READS = new Set(['readFileSync', 'openSync', 'readFile']);
|
|
133
135
|
|
|
134
136
|
/**
|
|
135
137
|
* What an existence check of a present path records: only that it is there,
|
|
@@ -247,7 +249,9 @@ function installRecorder() {
|
|
|
247
249
|
if (recording) return;
|
|
248
250
|
recording = true;
|
|
249
251
|
for (const name of RECORDED) {
|
|
250
|
-
|
|
252
|
+
// Older Node releases read native ES modules through the promise API.
|
|
253
|
+
const api = name === 'readFile' ? fs.promises : fs;
|
|
254
|
+
const original = api[name];
|
|
251
255
|
if (typeof original !== 'function') continue;
|
|
252
256
|
const kind = readKind(name);
|
|
253
257
|
/**
|
|
@@ -283,9 +287,9 @@ function installRecorder() {
|
|
|
283
287
|
return answer;
|
|
284
288
|
};
|
|
285
289
|
Object.assign(wrapped, original);
|
|
286
|
-
|
|
290
|
+
api[name] = wrapped;
|
|
287
291
|
}
|
|
288
|
-
// ESM imports of node:fs see the wrapped functions too.
|
|
292
|
+
// ESM imports of node:fs and node:fs/promises see the wrapped functions too.
|
|
289
293
|
syncBuiltinESMExports();
|
|
290
294
|
}
|
|
291
295
|
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file The npm package names of Astryx's built-in providers, as plain
|
|
6
|
+
* strings. It imports nothing, so a module that needs only a name loads no
|
|
7
|
+
* identity code.
|
|
8
|
+
* @input Stable npm package names owned by Astryx.
|
|
9
|
+
* @output CORE_PACKAGE_NAME and CLI_PACKAGE_NAME.
|
|
10
|
+
* @position foundation/identity — the one definition of these names: read by
|
|
11
|
+
* ./providers.mjs, which brands them, by the bases, which name Core by its
|
|
12
|
+
* package, and by the release facts (foundation/release/project.mjs), which
|
|
13
|
+
* pass them on.
|
|
14
|
+
*/
|
|
15
|
+
/** Core's package name. */
|
|
16
|
+
export const CORE_PACKAGE_NAME: "@astryxdesign/core";
|
|
17
|
+
/** The CLI's package name. */
|
|
18
|
+
export const CLI_PACKAGE_NAME: "@astryxdesign/cli";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The npm package names of Astryx's built-in providers, as plain
|
|
5
|
+
* strings. It imports nothing, so a module that needs only a name loads no
|
|
6
|
+
* identity code.
|
|
7
|
+
* @input Stable npm package names owned by Astryx.
|
|
8
|
+
* @output CORE_PACKAGE_NAME and CLI_PACKAGE_NAME.
|
|
9
|
+
* @position foundation/identity — the one definition of these names: read by
|
|
10
|
+
* ./providers.mjs, which brands them, by the bases, which name Core by its
|
|
11
|
+
* package, and by the release facts (foundation/release/project.mjs), which
|
|
12
|
+
* pass them on.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/** Core's package name. */
|
|
16
|
+
export const CORE_PACKAGE_NAME = '@astryxdesign/core';
|
|
17
|
+
|
|
18
|
+
/** The CLI's package name. */
|
|
19
|
+
export const CLI_PACKAGE_NAME = '@astryxdesign/cli';
|
|
@@ -7,10 +7,11 @@
|
|
|
7
7
|
* @position foundation/identity — built-in provider identity boundary.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
+
import {CLI_PACKAGE_NAME, CORE_PACKAGE_NAME} from './package-names.mjs';
|
|
10
11
|
import {normalizeProviderId} from './provider-identity.mjs';
|
|
11
12
|
|
|
12
13
|
/** Core owns built-in components and templates. */
|
|
13
|
-
export const CORE_PROVIDER_ID = normalizeProviderId(
|
|
14
|
+
export const CORE_PROVIDER_ID = normalizeProviderId(CORE_PACKAGE_NAME);
|
|
14
15
|
|
|
15
16
|
/** The CLI owns built-in topic docs and CLI-authored contributions. */
|
|
16
|
-
export const CLI_PROVIDER_ID = normalizeProviderId(
|
|
17
|
+
export const CLI_PROVIDER_ID = normalizeProviderId(CLI_PACKAGE_NAME);
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @typedef {object} IconFeatureGate
|
|
6
|
+
* @property {boolean} on whether every icon surface reads icon sets
|
|
7
|
+
* @property {'released' | 'iconSet' | 'pack' | null} reason why they are on:
|
|
8
|
+
* the release switch, the project's `experimental.iconSet`, or an installed
|
|
9
|
+
* icon-set package; null when off
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Whether icon features are on in a project, and why. They are on when the
|
|
13
|
+
* release switch is on, when astryx.config sets `experimental.iconSet`, or
|
|
14
|
+
* when an installed integration declares an `experimental.iconSets` root.
|
|
15
|
+
* The package being authored in the current folder (`__local`) is not
|
|
16
|
+
* installed: its own sets turn nothing on there.
|
|
17
|
+
* A project that cannot be read has them off, unless they are released.
|
|
18
|
+
* @param {{config?: {experimental?: {iconSet?: unknown}}, loadedIntegrations?: ReadonlyArray<{iconSets?: unknown, __local?: unknown, __loadError?: unknown, __providerConflict?: unknown} | null | undefined>} | null | undefined} project
|
|
19
|
+
* @returns {IconFeatureGate}
|
|
20
|
+
*/
|
|
21
|
+
export function iconFeatureGate(project: {
|
|
22
|
+
config?: {
|
|
23
|
+
experimental?: {
|
|
24
|
+
iconSet?: unknown;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
loadedIntegrations?: ReadonlyArray<{
|
|
28
|
+
iconSets?: unknown;
|
|
29
|
+
__local?: unknown;
|
|
30
|
+
__loadError?: unknown;
|
|
31
|
+
__providerConflict?: unknown;
|
|
32
|
+
} | null | undefined>;
|
|
33
|
+
} | null | undefined): IconFeatureGate;
|
|
34
|
+
/**
|
|
35
|
+
* @file The one gate every icon surface reads: whether icon features are on
|
|
36
|
+
* in a project.
|
|
37
|
+
* @input A loaded project's config and loaded integrations.
|
|
38
|
+
* @output `iconFeatureGate(project)`: on, and why, or off.
|
|
39
|
+
* `ICON_FEATURES_RELEASED`: the release switch.
|
|
40
|
+
* @position Read by foundation/config/project.mjs (`iconSets()`, the
|
|
41
|
+
* integration checks, and the docs catalog), and by discover, doctor,
|
|
42
|
+
* integration validate, and upgrade. While the switch is off, a
|
|
43
|
+
* project with no icon-set package and no `experimental.iconSet` reads no
|
|
44
|
+
* icon feature, so its output stays as it is without them.
|
|
45
|
+
*/
|
|
46
|
+
/**
|
|
47
|
+
* The release switch. While it is false, icon features are on only in a
|
|
48
|
+
* project that installs an icon-set package or sets `experimental.iconSet`.
|
|
49
|
+
* Set it to true to turn them on in every project.
|
|
50
|
+
*/
|
|
51
|
+
export const ICON_FEATURES_RELEASED: false;
|
|
52
|
+
export type IconFeatureGate = {
|
|
53
|
+
/**
|
|
54
|
+
* whether every icon surface reads icon sets
|
|
55
|
+
*/
|
|
56
|
+
on: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* why they are on:
|
|
59
|
+
* the release switch, the project's `experimental.iconSet`, or an installed
|
|
60
|
+
* icon-set package; null when off
|
|
61
|
+
*/
|
|
62
|
+
reason: "released" | "iconSet" | "pack" | null;
|
|
63
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The one gate every icon surface reads: whether icon features are on
|
|
5
|
+
* in a project.
|
|
6
|
+
* @input A loaded project's config and loaded integrations.
|
|
7
|
+
* @output `iconFeatureGate(project)`: on, and why, or off.
|
|
8
|
+
* `ICON_FEATURES_RELEASED`: the release switch.
|
|
9
|
+
* @position Read by foundation/config/project.mjs (`iconSets()`, the
|
|
10
|
+
* integration checks, and the docs catalog), and by discover, doctor,
|
|
11
|
+
* integration validate, and upgrade. While the switch is off, a
|
|
12
|
+
* project with no icon-set package and no `experimental.iconSet` reads no
|
|
13
|
+
* icon feature, so its output stays as it is without them.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* The release switch. While it is false, icon features are on only in a
|
|
18
|
+
* project that installs an icon-set package or sets `experimental.iconSet`.
|
|
19
|
+
* Set it to true to turn them on in every project.
|
|
20
|
+
*/
|
|
21
|
+
export const ICON_FEATURES_RELEASED = false;
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {object} IconFeatureGate
|
|
25
|
+
* @property {boolean} on whether every icon surface reads icon sets
|
|
26
|
+
* @property {'released' | 'iconSet' | 'pack' | null} reason why they are on:
|
|
27
|
+
* the release switch, the project's `experimental.iconSet`, or an installed
|
|
28
|
+
* icon-set package; null when off
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether icon features are on in a project, and why. They are on when the
|
|
33
|
+
* release switch is on, when astryx.config sets `experimental.iconSet`, or
|
|
34
|
+
* when an installed integration declares an `experimental.iconSets` root.
|
|
35
|
+
* The package being authored in the current folder (`__local`) is not
|
|
36
|
+
* installed: its own sets turn nothing on there.
|
|
37
|
+
* A project that cannot be read has them off, unless they are released.
|
|
38
|
+
* @param {{config?: {experimental?: {iconSet?: unknown}}, loadedIntegrations?: ReadonlyArray<{iconSets?: unknown, __local?: unknown, __loadError?: unknown, __providerConflict?: unknown} | null | undefined>} | null | undefined} project
|
|
39
|
+
* @returns {IconFeatureGate}
|
|
40
|
+
*/
|
|
41
|
+
export function iconFeatureGate(project) {
|
|
42
|
+
if (ICON_FEATURES_RELEASED) return {on: true, reason: 'released'};
|
|
43
|
+
if (project?.config?.experimental?.iconSet) {
|
|
44
|
+
return {on: true, reason: 'iconSet'};
|
|
45
|
+
}
|
|
46
|
+
const packInstalled = (project?.loadedIntegrations ?? []).some(
|
|
47
|
+
integration =>
|
|
48
|
+
Boolean(integration?.iconSets) &&
|
|
49
|
+
!integration?.__local &&
|
|
50
|
+
!integration?.__loadError &&
|
|
51
|
+
!integration?.__providerConflict,
|
|
52
|
+
);
|
|
53
|
+
return packInstalled ? {on: true, reason: 'pack'} : {on: false, reason: null};
|
|
54
|
+
}
|
|
@@ -37,7 +37,7 @@ export function markProviderConflicts(integrations: LoadedIntegration[]): Loaded
|
|
|
37
37
|
* @param {string} file absolute manifest path
|
|
38
38
|
* @param {string} [label] used in error messages
|
|
39
39
|
* @param {{fresh?: boolean}} [options]
|
|
40
|
-
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
|
|
40
|
+
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string, installGuidanceError?: string}>}
|
|
41
41
|
*/
|
|
42
42
|
export function loadManifest(file: string, label?: string, { fresh }?: {
|
|
43
43
|
fresh?: boolean;
|
|
@@ -56,6 +56,7 @@ export function loadManifest(file: string, label?: string, { fresh }?: {
|
|
|
56
56
|
discoverError?: string;
|
|
57
57
|
agentDocsError?: string;
|
|
58
58
|
cliCommandError?: string;
|
|
59
|
+
installGuidanceError?: string;
|
|
59
60
|
}>;
|
|
60
61
|
/**
|
|
61
62
|
* Load and validate a manifest module's default export against the integration
|
|
@@ -175,6 +176,17 @@ export type LoadedIntegration = {
|
|
|
175
176
|
* ignored; the rest of the manifest still contributes
|
|
176
177
|
*/
|
|
177
178
|
__cliCommandError?: string | undefined;
|
|
179
|
+
/**
|
|
180
|
+
* how an app that uses this package
|
|
181
|
+
* adds a dependency; read by `installGuidanceFor` in
|
|
182
|
+
* foundation/env/cli-command.mjs
|
|
183
|
+
*/
|
|
184
|
+
installGuidance?: string | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* why a declared
|
|
187
|
+
* `installGuidance` was ignored; the rest of the manifest still contributes
|
|
188
|
+
*/
|
|
189
|
+
__installGuidanceError?: string | undefined;
|
|
178
190
|
/**
|
|
179
191
|
* contribution-specific validation
|
|
180
192
|
* failure; other manifest contributions remain available
|
|
@@ -28,6 +28,7 @@ import {normalizeProviderId} from '../identity/provider-identity.mjs';
|
|
|
28
28
|
import {
|
|
29
29
|
parseAgentDocsField,
|
|
30
30
|
parseCliCommandField,
|
|
31
|
+
parseInstallGuidanceField,
|
|
31
32
|
parseIntegrationBase,
|
|
32
33
|
unknownIntegrationKeys,
|
|
33
34
|
ignoredIntegrationFields,
|
|
@@ -71,6 +72,11 @@ import {unknownCapabilityKeys} from '../bases/steps.mjs';
|
|
|
71
72
|
* CLI with; read by the picker in foundation/env (see cli-command.mjs)
|
|
72
73
|
* @property {string} [__cliCommandError] why a declared `cliCommand` was
|
|
73
74
|
* ignored; the rest of the manifest still contributes
|
|
75
|
+
* @property {string} [installGuidance] how an app that uses this package
|
|
76
|
+
* adds a dependency; read by `installGuidanceFor` in
|
|
77
|
+
* foundation/env/cli-command.mjs
|
|
78
|
+
* @property {string} [__installGuidanceError] why a declared
|
|
79
|
+
* `installGuidance` was ignored; the rest of the manifest still contributes
|
|
74
80
|
* @property {string} [__agentDocsError] contribution-specific validation
|
|
75
81
|
* failure; other manifest contributions remain available
|
|
76
82
|
* @property {string} __spec
|
|
@@ -116,7 +122,6 @@ import {unknownCapabilityKeys} from '../bases/steps.mjs';
|
|
|
116
122
|
* @property {string} [__discoverError] isolated discover-source validation error.
|
|
117
123
|
*/
|
|
118
124
|
|
|
119
|
-
|
|
120
125
|
/**
|
|
121
126
|
* Normalize a package-owned provider ID without rejecting legacy unnamed local
|
|
122
127
|
* packages at this compatibility boundary.
|
|
@@ -161,7 +166,6 @@ export function markProviderConflicts(integrations) {
|
|
|
161
166
|
).integrations;
|
|
162
167
|
}
|
|
163
168
|
|
|
164
|
-
|
|
165
169
|
/**
|
|
166
170
|
* Parse the optional named gap-report handler without making it part of the
|
|
167
171
|
* default manifest schema. A malformed handler is isolated from every other
|
|
@@ -196,7 +200,9 @@ function parseGapReportHandlerExport(value, label) {
|
|
|
196
200
|
function parseDiscoverSourceExport(value, label) {
|
|
197
201
|
if (value === undefined) return {};
|
|
198
202
|
try {
|
|
199
|
-
return {
|
|
203
|
+
return {
|
|
204
|
+
source: parseDiscoverSource(value, `${label} named export "discover"`),
|
|
205
|
+
};
|
|
200
206
|
} catch (error) {
|
|
201
207
|
return {error: error instanceof Error ? error.message : String(error)};
|
|
202
208
|
}
|
|
@@ -218,7 +224,7 @@ function parseDiscoverSourceExport(value, label) {
|
|
|
218
224
|
* @param {string} file absolute manifest path
|
|
219
225
|
* @param {string} [label] used in error messages
|
|
220
226
|
* @param {{fresh?: boolean}} [options]
|
|
221
|
-
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string}>}
|
|
227
|
+
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], ignoredFields: Array<{field: string, why: string}>, declaredKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string, cliCommandError?: string, installGuidanceError?: string}>}
|
|
222
228
|
*/
|
|
223
229
|
export async function loadManifest(
|
|
224
230
|
file,
|
|
@@ -227,7 +233,8 @@ export async function loadManifest(
|
|
|
227
233
|
) {
|
|
228
234
|
const mod = await importUserModule(file, {fresh});
|
|
229
235
|
const raw = mod?.default;
|
|
230
|
-
if (raw === undefined)
|
|
236
|
+
if (raw === undefined)
|
|
237
|
+
throw new Error(noDefaultExportMessage(file, label, mod));
|
|
231
238
|
const baseManifest = parseIntegrationBase(raw, label);
|
|
232
239
|
const gapReport = parseGapReportHandlerExport(mod?.gapReport, label);
|
|
233
240
|
const discover = parseDiscoverSourceExport(mod?.discover, label);
|
|
@@ -273,13 +280,36 @@ export async function loadManifest(
|
|
|
273
280
|
}
|
|
274
281
|
}
|
|
275
282
|
|
|
283
|
+
/** @type {string | undefined} */
|
|
284
|
+
let installGuidance;
|
|
285
|
+
/** @type {string | undefined} */
|
|
286
|
+
let installGuidanceError;
|
|
287
|
+
const rawInstallGuidance =
|
|
288
|
+
raw != null && typeof raw === 'object' && !Array.isArray(raw)
|
|
289
|
+
? /** @type {{installGuidance?: unknown}} */ (raw).installGuidance
|
|
290
|
+
: undefined;
|
|
291
|
+
if (rawInstallGuidance !== undefined) {
|
|
292
|
+
try {
|
|
293
|
+
installGuidance = parseInstallGuidanceField(
|
|
294
|
+
rawInstallGuidance,
|
|
295
|
+
`${label} field "installGuidance"`,
|
|
296
|
+
);
|
|
297
|
+
} catch (err) {
|
|
298
|
+
installGuidanceError = err instanceof Error ? err.message : String(err);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
|
|
276
302
|
return {
|
|
277
303
|
manifest: {
|
|
278
304
|
...baseManifest,
|
|
279
305
|
...(agentDocs == null ? {} : {agentDocs}),
|
|
280
306
|
...(cliCommand == null ? {} : {cliCommand}),
|
|
307
|
+
...(installGuidance == null ? {} : {installGuidance}),
|
|
281
308
|
},
|
|
282
|
-
unknownKeys: [
|
|
309
|
+
unknownKeys: [
|
|
310
|
+
...unknownIntegrationKeys(raw),
|
|
311
|
+
...unknownCapabilityKeys(raw),
|
|
312
|
+
],
|
|
283
313
|
ignoredFields: ignoredIntegrationFields(raw),
|
|
284
314
|
declaredKeys:
|
|
285
315
|
raw != null && typeof raw === 'object' ? Object.keys(raw) : [],
|
|
@@ -295,6 +325,7 @@ export async function loadManifest(
|
|
|
295
325
|
discoverError: discover.error,
|
|
296
326
|
agentDocsError,
|
|
297
327
|
cliCommandError,
|
|
328
|
+
installGuidanceError,
|
|
298
329
|
};
|
|
299
330
|
}
|
|
300
331
|
|
|
@@ -466,6 +497,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
466
497
|
let agentDocsError;
|
|
467
498
|
/** @type {string | undefined} */
|
|
468
499
|
let cliCommandError;
|
|
500
|
+
/** @type {string | undefined} */
|
|
501
|
+
let installGuidanceError;
|
|
469
502
|
try {
|
|
470
503
|
({
|
|
471
504
|
manifest,
|
|
@@ -479,6 +512,7 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
479
512
|
discoverError,
|
|
480
513
|
agentDocsError,
|
|
481
514
|
cliCommandError,
|
|
515
|
+
installGuidanceError,
|
|
482
516
|
} = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
|
|
483
517
|
} catch (err) {
|
|
484
518
|
return {
|
|
@@ -520,8 +554,10 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
520
554
|
logo: manifest.logo,
|
|
521
555
|
agentDocs: manifest.agentDocs,
|
|
522
556
|
cliCommand: manifest.cliCommand,
|
|
557
|
+
installGuidance: manifest.installGuidance,
|
|
523
558
|
base: manifest.base,
|
|
524
559
|
__cliCommandError: cliCommandError,
|
|
560
|
+
__installGuidanceError: installGuidanceError,
|
|
525
561
|
__agentDocsError: agentDocsError,
|
|
526
562
|
__unknownKeys: unknownKeys,
|
|
527
563
|
__ignoredFields: ignoredFields,
|
|
@@ -594,6 +630,8 @@ export async function loadIntegrations(
|
|
|
594
630
|
let agentDocsError;
|
|
595
631
|
/** @type {string | undefined} */
|
|
596
632
|
let cliCommandError;
|
|
633
|
+
/** @type {string | undefined} */
|
|
634
|
+
let installGuidanceError;
|
|
597
635
|
try {
|
|
598
636
|
({
|
|
599
637
|
manifest,
|
|
@@ -607,6 +645,7 @@ export async function loadIntegrations(
|
|
|
607
645
|
discoverError,
|
|
608
646
|
agentDocsError,
|
|
609
647
|
cliCommandError,
|
|
648
|
+
installGuidanceError,
|
|
610
649
|
} = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
|
|
611
650
|
} catch (err) {
|
|
612
651
|
// A manifest that throws on import or fails schema validation must NOT take
|
|
@@ -655,8 +694,10 @@ export async function loadIntegrations(
|
|
|
655
694
|
logo: manifest.logo,
|
|
656
695
|
agentDocs: manifest.agentDocs,
|
|
657
696
|
cliCommand: manifest.cliCommand,
|
|
697
|
+
installGuidance: manifest.installGuidance,
|
|
658
698
|
base: manifest.base,
|
|
659
699
|
__cliCommandError: cliCommandError,
|
|
700
|
+
__installGuidanceError: installGuidanceError,
|
|
660
701
|
__agentDocsError: agentDocsError,
|
|
661
702
|
__unknownKeys: unknownKeys,
|
|
662
703
|
__ignoredFields: ignoredFields,
|
|
@@ -26,6 +26,27 @@ export function npmPackedPaths(base: string): {
|
|
|
26
26
|
} | {
|
|
27
27
|
error: string;
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* Run `npm pack --json` with `args` in `cwd`. npm writes one JSON entry per packed file, so a
|
|
31
|
+
* package of tens of thousands of files prints megabytes: its stdout and
|
|
32
|
+
* stderr go to files, not to an in-memory pipe, so no buffer limit stops it.
|
|
33
|
+
* @param {{command: string, prefix: string[]}} npm how to start npm (npmCommand)
|
|
34
|
+
* @param {string} cwd
|
|
35
|
+
* @param {string[]} args the arguments after `pack --json`
|
|
36
|
+
* @param {{timeout: number}} options
|
|
37
|
+
* @returns {{error?: Error, status: number | null, stdout: string, stderr: string}}
|
|
38
|
+
*/
|
|
39
|
+
export function runNpmPackJson(npm: {
|
|
40
|
+
command: string;
|
|
41
|
+
prefix: string[];
|
|
42
|
+
}, cwd: string, args: string[], { timeout }: {
|
|
43
|
+
timeout: number;
|
|
44
|
+
}): {
|
|
45
|
+
error?: Error;
|
|
46
|
+
status: number | null;
|
|
47
|
+
stdout: string;
|
|
48
|
+
stderr: string;
|
|
49
|
+
};
|
|
29
50
|
/**
|
|
30
51
|
* The ignore files npm reads for one path in a package with no `files`
|
|
31
52
|
* field: in the root and each folder down to the path's own, `.npmignore`,
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
* `files`), or cannot be asked.
|
|
12
12
|
* @position foundation/integrations; read by the template-asset and logo
|
|
13
13
|
* checks (validate-contributions.mjs) and the shipped-import check
|
|
14
|
-
* (shipped-imports.mjs)
|
|
14
|
+
* (shipped-imports.mjs); `integration verify` packs through
|
|
15
|
+
* `runNpmPackJson` too. Inside `withListingCache` (one validation) npm is
|
|
15
16
|
* asked once per package folder, however many checks ask, and its list is
|
|
16
17
|
* kept between runs while nothing it depends on has changed.
|
|
17
18
|
*/
|
|
@@ -236,6 +237,41 @@ function readNpmrcFiles(folder, npm) {
|
|
|
236
237
|
}
|
|
237
238
|
}
|
|
238
239
|
|
|
240
|
+
/**
|
|
241
|
+
* Run `npm pack --json` with `args` in `cwd`. npm writes one JSON entry per packed file, so a
|
|
242
|
+
* package of tens of thousands of files prints megabytes: its stdout and
|
|
243
|
+
* stderr go to files, not to an in-memory pipe, so no buffer limit stops it.
|
|
244
|
+
* @param {{command: string, prefix: string[]}} npm how to start npm (npmCommand)
|
|
245
|
+
* @param {string} cwd
|
|
246
|
+
* @param {string[]} args the arguments after `pack --json`
|
|
247
|
+
* @param {{timeout: number}} options
|
|
248
|
+
* @returns {{error?: Error, status: number | null, stdout: string, stderr: string}}
|
|
249
|
+
*/
|
|
250
|
+
export function runNpmPackJson(npm, cwd, args, {timeout}) {
|
|
251
|
+
const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-npm-pack-'));
|
|
252
|
+
const stdoutFile = path.join(outputDir, 'stdout.json');
|
|
253
|
+
const stderrFile = path.join(outputDir, 'stderr.txt');
|
|
254
|
+
const stdoutFd = fs.openSync(stdoutFile, 'w');
|
|
255
|
+
const stderrFd = fs.openSync(stderrFile, 'w');
|
|
256
|
+
try {
|
|
257
|
+
const result = spawnSync(
|
|
258
|
+
npm.command,
|
|
259
|
+
[...npm.prefix, 'pack', '--json', ...args],
|
|
260
|
+
{cwd, shell: false, timeout, stdio: ['ignore', stdoutFd, stderrFd]},
|
|
261
|
+
);
|
|
262
|
+
return {
|
|
263
|
+
error: result.error,
|
|
264
|
+
status: result.status,
|
|
265
|
+
stdout: fs.readFileSync(stdoutFile, 'utf-8'),
|
|
266
|
+
stderr: fs.readFileSync(stderrFile, 'utf-8'),
|
|
267
|
+
};
|
|
268
|
+
} finally {
|
|
269
|
+
fs.closeSync(stdoutFd);
|
|
270
|
+
fs.closeSync(stderrFd);
|
|
271
|
+
fs.rmSync(outputDir, {recursive: true, force: true});
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
|
|
239
275
|
/**
|
|
240
276
|
* What npm answers for the package in `base` (npmPackedPaths).
|
|
241
277
|
* @param {string} base
|
|
@@ -243,24 +279,11 @@ function readNpmrcFiles(folder, npm) {
|
|
|
243
279
|
* @returns {{paths: Set<string>} | {error: string}}
|
|
244
280
|
*/
|
|
245
281
|
function askNpm(base, npm) {
|
|
246
|
-
const result =
|
|
247
|
-
npm
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
'--dry-run',
|
|
252
|
-
'--json',
|
|
253
|
-
'--ignore-scripts',
|
|
254
|
-
'--silent',
|
|
255
|
-
],
|
|
256
|
-
{
|
|
257
|
-
cwd: base,
|
|
258
|
-
encoding: 'utf-8',
|
|
259
|
-
shell: false,
|
|
260
|
-
timeout: 60_000,
|
|
261
|
-
// One line per packed file: room for a very large package.
|
|
262
|
-
maxBuffer: 256 * 1024 * 1024,
|
|
263
|
-
},
|
|
282
|
+
const result = runNpmPackJson(
|
|
283
|
+
npm,
|
|
284
|
+
base,
|
|
285
|
+
['--dry-run', '--ignore-scripts', '--silent'],
|
|
286
|
+
{timeout: 60_000},
|
|
264
287
|
);
|
|
265
288
|
if (result.error) return {error: `npm did not run (${result.error.message})`};
|
|
266
289
|
if (result.status !== 0) {
|