@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
|
@@ -171,14 +171,20 @@ export function literalThemeName(file: string, exportName: string): string | nul
|
|
|
171
171
|
export function validateLoadedIntegration(loaded: LoadedIntegration): Promise<Issue[]>;
|
|
172
172
|
/**
|
|
173
173
|
* Every contribution check, split: `issues` as validateLoadedIntegration
|
|
174
|
-
* returns them
|
|
175
|
-
*
|
|
174
|
+
* returns them; `listed`, the layout findings validate lists in its `layout`
|
|
175
|
+
* report without counting them; and `notes`, information validate prints
|
|
176
|
+
* as notes, never counted.
|
|
176
177
|
* @param {LoadedIntegration} loaded
|
|
177
|
-
* @returns {Promise<{issues: Issue[], listed: Issue[]}>}
|
|
178
|
+
* @returns {Promise<{issues: Issue[], listed: Issue[], notes: Array<{code: string, message: string, next?: boolean}>}>}
|
|
178
179
|
*/
|
|
179
180
|
export function validateLoadedIntegrationListed(loaded: LoadedIntegration): Promise<{
|
|
180
181
|
issues: Issue[];
|
|
181
182
|
listed: Issue[];
|
|
183
|
+
notes: Array<{
|
|
184
|
+
code: string;
|
|
185
|
+
message: string;
|
|
186
|
+
next?: boolean;
|
|
187
|
+
}>;
|
|
182
188
|
}>;
|
|
183
189
|
/**
|
|
184
190
|
* Whether these bytes are an image a catalog can show as a logo, in the
|
|
@@ -231,6 +237,8 @@ export function packageListingCheck(integration: LoadedIntegration, examples?: E
|
|
|
231
237
|
export const INVALID_AGENT_DOCS: "invalid_agent_docs";
|
|
232
238
|
/** Stable issue code for a `cliCommand` that was ignored as invalid. */
|
|
233
239
|
export const INVALID_CLI_COMMAND: "invalid_cli_command";
|
|
240
|
+
/** Stable issue code for an `installGuidance` that was ignored as invalid. */
|
|
241
|
+
export const INVALID_INSTALL_GUIDANCE: "invalid_install_guidance";
|
|
234
242
|
/** Stable issue code for a package whose provider ID is already claimed. */
|
|
235
243
|
export const DUPLICATE_PROVIDER: "duplicate_provider";
|
|
236
244
|
/**
|
|
@@ -119,6 +119,9 @@ export const INVALID_AGENT_DOCS = 'invalid_agent_docs';
|
|
|
119
119
|
/** Stable issue code for a `cliCommand` that was ignored as invalid. */
|
|
120
120
|
export const INVALID_CLI_COMMAND = 'invalid_cli_command';
|
|
121
121
|
|
|
122
|
+
/** Stable issue code for an `installGuidance` that was ignored as invalid. */
|
|
123
|
+
export const INVALID_INSTALL_GUIDANCE = 'invalid_install_guidance';
|
|
124
|
+
|
|
122
125
|
/** Stable issue code for a package whose provider ID is already claimed. */
|
|
123
126
|
export const DUPLICATE_PROVIDER = 'duplicate_provider';
|
|
124
127
|
|
|
@@ -158,16 +161,34 @@ export function isListedIssue(issue) {
|
|
|
158
161
|
return LISTED.has(issue);
|
|
159
162
|
}
|
|
160
163
|
|
|
164
|
+
/** Issues `issueNote` made: information, never counted as an issue. */
|
|
165
|
+
const NOTED = new WeakMap();
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Information about a package that is not a problem with it: validate prints
|
|
169
|
+
* it as a note, and nothing counts it, so the everyday-command nudge and
|
|
170
|
+
* project doctor never report it. A manifest key the running CLI does not
|
|
171
|
+
* know is one: it is usually a key from a newer CLI, which version skew makes
|
|
172
|
+
* normal. `next` marks a note `integration check --strict --next` fails on.
|
|
173
|
+
* @param {string} code
|
|
174
|
+
* @param {string} message
|
|
175
|
+
* @param {{next?: boolean}} [options]
|
|
176
|
+
* @returns {Issue}
|
|
177
|
+
*/
|
|
178
|
+
function issueNote(code, message, {next = false} = {}) {
|
|
179
|
+
const issue = issueWarning(code, message);
|
|
180
|
+
NOTED.set(issue, {next});
|
|
181
|
+
return issue;
|
|
182
|
+
}
|
|
183
|
+
|
|
161
184
|
/**
|
|
162
185
|
* Report the manifest keys this CLI does not know.
|
|
163
186
|
*
|
|
164
|
-
* A
|
|
165
|
-
* against many CLI versions, so a key
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
*
|
|
169
|
-
* components, templates and codemods down with it on every older consumer
|
|
170
|
-
* (#5119). The fix is upgrading the CLI, which is what the message says.
|
|
187
|
+
* A note, never an issue: an integration is published once and installed
|
|
188
|
+
* against many CLI versions, so a key from a later CLI arrives here routinely
|
|
189
|
+
* and means only that this CLI cannot act on it. The rest of the manifest
|
|
190
|
+
* still loads. A key one edit from a known key is almost always a typo, so
|
|
191
|
+
* that note is `next`.
|
|
171
192
|
*
|
|
172
193
|
* @param {LoadedIntegration} integration
|
|
173
194
|
* @param {Issue[]} issues
|
|
@@ -192,16 +213,17 @@ function checkUnknownKeys(integration, issues) {
|
|
|
192
213
|
? `Fix: remove "${key}" from ${manifestName(integration)}; it already sets "${known}".`
|
|
193
214
|
: `Fix: rename "${key}" to "${known}" in ${manifestName(integration)}.`;
|
|
194
215
|
issues.push(
|
|
195
|
-
|
|
216
|
+
issueNote(
|
|
196
217
|
'unknown_manifest_key',
|
|
197
218
|
`This CLI does not know the manifest key "${key}", so it is ignored. Did you mean \`${known}\`? ${fix} If it is a key from a newer Astryx CLI instead, upgrading @astryxdesign/cli picks it up.`,
|
|
219
|
+
{next: editDistance(key, /** @type {string} */ (known)) <= 1},
|
|
198
220
|
),
|
|
199
221
|
);
|
|
200
222
|
}
|
|
201
223
|
const rest = keys.filter(key => !typos.some(each => each.key === key));
|
|
202
224
|
if (rest.length === 0) return;
|
|
203
225
|
issues.push(
|
|
204
|
-
|
|
226
|
+
issueNote(
|
|
205
227
|
'unknown_manifest_key',
|
|
206
228
|
`This CLI does not know the manifest ${rest.length === 1 ? 'key' : 'keys'} ` +
|
|
207
229
|
`${rest.map(key => `"${key}"`).join(', ')}, so ${rest.length === 1 ? 'it is' : 'they are'} ` +
|
|
@@ -2176,16 +2198,24 @@ export async function validateLoadedIntegration(loaded) {
|
|
|
2176
2198
|
|
|
2177
2199
|
/**
|
|
2178
2200
|
* Every contribution check, split: `issues` as validateLoadedIntegration
|
|
2179
|
-
* returns them
|
|
2180
|
-
*
|
|
2201
|
+
* returns them; `listed`, the layout findings validate lists in its `layout`
|
|
2202
|
+
* report without counting them; and `notes`, information validate prints
|
|
2203
|
+
* as notes, never counted.
|
|
2181
2204
|
* @param {LoadedIntegration} loaded
|
|
2182
|
-
* @returns {Promise<{issues: Issue[], listed: Issue[]}>}
|
|
2205
|
+
* @returns {Promise<{issues: Issue[], listed: Issue[], notes: Array<{code: string, message: string, next?: boolean}>}>}
|
|
2183
2206
|
*/
|
|
2184
2207
|
export async function validateLoadedIntegrationListed(loaded) {
|
|
2185
2208
|
const all = await allLoadedIntegrationIssues(loaded);
|
|
2186
2209
|
return {
|
|
2187
|
-
issues: all.filter(issue => !LISTED.has(issue)),
|
|
2210
|
+
issues: all.filter(issue => !LISTED.has(issue) && !NOTED.has(issue)),
|
|
2188
2211
|
listed: all.filter(issue => LISTED.has(issue)),
|
|
2212
|
+
notes: all
|
|
2213
|
+
.filter(issue => NOTED.has(issue))
|
|
2214
|
+
.map(issue => ({
|
|
2215
|
+
code: issue.code,
|
|
2216
|
+
message: issue.message,
|
|
2217
|
+
...(NOTED.get(issue).next ? {next: true} : {}),
|
|
2218
|
+
})),
|
|
2189
2219
|
};
|
|
2190
2220
|
}
|
|
2191
2221
|
|
|
@@ -2230,6 +2260,14 @@ async function allLoadedIntegrationIssues(loaded) {
|
|
|
2230
2260
|
),
|
|
2231
2261
|
);
|
|
2232
2262
|
}
|
|
2263
|
+
if (loaded.__installGuidanceError) {
|
|
2264
|
+
issues.push(
|
|
2265
|
+
issueWarning(
|
|
2266
|
+
INVALID_INSTALL_GUIDANCE,
|
|
2267
|
+
`${loaded.__installGuidanceError}. The guidance is ignored; printed install steps use the package manager's command.`,
|
|
2268
|
+
),
|
|
2269
|
+
);
|
|
2270
|
+
}
|
|
2233
2271
|
checkRoots(
|
|
2234
2272
|
{
|
|
2235
2273
|
components: loaded.components,
|
|
@@ -177,12 +177,16 @@ export function failedInstallWaitMs(failures: number): number;
|
|
|
177
177
|
* @param {string} version
|
|
178
178
|
* @param {string} cacheDir
|
|
179
179
|
* @param {number} [now]
|
|
180
|
-
* @returns {{at: number, reason: string, failures: number, waitMs: number} | null}
|
|
180
|
+
* @returns {{at: number, reason: string, failures: number, registries: {scoped: string | null, registry: string | null} | null, waitMs: number} | null}
|
|
181
181
|
*/
|
|
182
182
|
export function recentFailedInstall(version: string, cacheDir: string, now?: number): {
|
|
183
183
|
at: number;
|
|
184
184
|
reason: string;
|
|
185
185
|
failures: number;
|
|
186
|
+
registries: {
|
|
187
|
+
scoped: string | null;
|
|
188
|
+
registry: string | null;
|
|
189
|
+
} | null;
|
|
186
190
|
waitMs: number;
|
|
187
191
|
} | null;
|
|
188
192
|
/**
|
|
@@ -270,6 +274,7 @@ export function endRecordedInstall(lockDir: string, { now, procRoot, factsOf, ve
|
|
|
270
274
|
* @property {string} version
|
|
271
275
|
* @property {string} reason one plain sentence
|
|
272
276
|
* @property {NodeJS.Signals} [signal] the install was stopped by this signal
|
|
277
|
+
* @property {{scoped: string | null, registry: string | null}} [registries] npm's registries when the install failed
|
|
273
278
|
*/
|
|
274
279
|
/**
|
|
275
280
|
* Install release `version` into the cache, verify it, and return it. A
|
|
@@ -342,4 +347,11 @@ export type ReleaseUnavailable = {
|
|
|
342
347
|
* the install was stopped by this signal
|
|
343
348
|
*/
|
|
344
349
|
signal?: NodeJS.Signals | undefined;
|
|
350
|
+
/**
|
|
351
|
+
* npm's registries when the install failed
|
|
352
|
+
*/
|
|
353
|
+
registries?: {
|
|
354
|
+
scoped: string | null;
|
|
355
|
+
registry: string | null;
|
|
356
|
+
} | undefined;
|
|
345
357
|
};
|
|
@@ -543,6 +543,54 @@ export function failedInstallWaitMs(failures) {
|
|
|
543
543
|
return (failures >= 2 ? 10 : 2) * 60_000;
|
|
544
544
|
}
|
|
545
545
|
|
|
546
|
+
/**
|
|
547
|
+
* The registries npm installs releases from, as npm reads its user and
|
|
548
|
+
* global settings: the `@astryxdesign` scope's registry (the CLI and Core)
|
|
549
|
+
* and npm's registry (their other dependencies); each null when not set or
|
|
550
|
+
* when npm cannot say. A failed install is remembered for these registries
|
|
551
|
+
* only, so a run after either changes installs at once.
|
|
552
|
+
* @param {typeof runNpm} run
|
|
553
|
+
* @returns {{scoped: string | null, registry: string | null}}
|
|
554
|
+
*/
|
|
555
|
+
function npmRegistries(run) {
|
|
556
|
+
/** @type {Record<string, string>} */
|
|
557
|
+
const values = {};
|
|
558
|
+
try {
|
|
559
|
+
const result = run(['config', 'get', '@astryxdesign:registry', 'registry'], {timeoutMs: 15_000});
|
|
560
|
+
if (result.status === 0) {
|
|
561
|
+
for (const line of String(result.stdout ?? '').split('\n')) {
|
|
562
|
+
const at = line.indexOf('=');
|
|
563
|
+
if (at > 0) values[line.slice(0, at).trim()] = line.slice(at + 1).trim();
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
} catch {
|
|
567
|
+
// npm that cannot say leaves both unknown.
|
|
568
|
+
}
|
|
569
|
+
/** @param {string | undefined} v */
|
|
570
|
+
const url = v => (v && /^https?:\/\/\S+$/.test(v) ? v : null);
|
|
571
|
+
return {scoped: url(values['@astryxdesign:registry']), registry: url(values.registry)};
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
|
+
* Whether two readings of npm's registries differ; an unknown reading
|
|
576
|
+
* differs from none.
|
|
577
|
+
* @param {{scoped: string | null, registry: string | null} | null} a
|
|
578
|
+
* @param {{scoped: string | null, registry: string | null} | null} b
|
|
579
|
+
*/
|
|
580
|
+
function registriesChanged(a, b) {
|
|
581
|
+
if (!readsRegistry(a) || !readsRegistry(b)) return false;
|
|
582
|
+
return a.scoped !== b.scoped || a.registry !== b.registry;
|
|
583
|
+
}
|
|
584
|
+
|
|
585
|
+
/**
|
|
586
|
+
* Whether a reading of npm's registries names one.
|
|
587
|
+
* @param {{scoped: string | null, registry: string | null} | null} r
|
|
588
|
+
* @returns {r is {scoped: string | null, registry: string | null}}
|
|
589
|
+
*/
|
|
590
|
+
function readsRegistry(r) {
|
|
591
|
+
return Boolean(r && (r.scoped || r.registry));
|
|
592
|
+
}
|
|
593
|
+
|
|
546
594
|
/**
|
|
547
595
|
* The record of a failed install of `version`: a file in the release cache,
|
|
548
596
|
* shared by every copy of the CLI that uses this cache.
|
|
@@ -560,7 +608,7 @@ function failedRecordPath(version, cacheDir) {
|
|
|
560
608
|
* @param {string} version
|
|
561
609
|
* @param {string} cacheDir
|
|
562
610
|
* @param {number} [now]
|
|
563
|
-
* @returns {{at: number, reason: string, failures: number, waitMs: number} | null}
|
|
611
|
+
* @returns {{at: number, reason: string, failures: number, registries: {scoped: string | null, registry: string | null} | null, waitMs: number} | null}
|
|
564
612
|
*/
|
|
565
613
|
export function recentFailedInstall(version, cacheDir, now = Date.now()) {
|
|
566
614
|
const record = readFailedInstall(version, cacheDir);
|
|
@@ -574,7 +622,7 @@ export function recentFailedInstall(version, cacheDir, now = Date.now()) {
|
|
|
574
622
|
* The record of failed installs of `version`, whatever its age, or null.
|
|
575
623
|
* @param {string} version
|
|
576
624
|
* @param {string} cacheDir
|
|
577
|
-
* @returns {{at: number, reason: string, failures: number} | null}
|
|
625
|
+
* @returns {{at: number, reason: string, failures: number, registries: {scoped: string | null, registry: string | null} | null} | null}
|
|
578
626
|
*/
|
|
579
627
|
function readFailedInstall(version, cacheDir) {
|
|
580
628
|
const record = readJson(failedRecordPath(version, cacheDir));
|
|
@@ -589,7 +637,12 @@ function readFailedInstall(version, cacheDir) {
|
|
|
589
637
|
Number.isInteger(record.failures) && record.failures > 0
|
|
590
638
|
? record.failures
|
|
591
639
|
: 1;
|
|
592
|
-
|
|
640
|
+
const r = record.registries;
|
|
641
|
+
const registries =
|
|
642
|
+
r && typeof r === 'object'
|
|
643
|
+
? {scoped: typeof r.scoped === 'string' ? r.scoped : null, registry: typeof r.registry === 'string' ? r.registry : null}
|
|
644
|
+
: null;
|
|
645
|
+
return {at: record.at, reason: record.reason, failures, registries};
|
|
593
646
|
}
|
|
594
647
|
|
|
595
648
|
/**
|
|
@@ -597,8 +650,10 @@ function readFailedInstall(version, cacheDir) {
|
|
|
597
650
|
* @param {string} version
|
|
598
651
|
* @param {string} cacheDir
|
|
599
652
|
* @param {string | null} reason null forgets it
|
|
653
|
+
* @param {{scoped: string | null, registry: string | null} | null} [registries]
|
|
654
|
+
* npm's registries when the install failed
|
|
600
655
|
*/
|
|
601
|
-
function recordFailedInstall(version, cacheDir, reason) {
|
|
656
|
+
function recordFailedInstall(version, cacheDir, reason, registries = null) {
|
|
602
657
|
const file = failedRecordPath(version, cacheDir);
|
|
603
658
|
try {
|
|
604
659
|
if (reason === null) {
|
|
@@ -606,11 +661,12 @@ function recordFailedInstall(version, cacheDir, reason) {
|
|
|
606
661
|
return;
|
|
607
662
|
}
|
|
608
663
|
fs.mkdirSync(path.dirname(file), {recursive: true});
|
|
609
|
-
const
|
|
664
|
+
const last = readFailedInstall(version, cacheDir);
|
|
665
|
+
const failures = (last && !registriesChanged(last.registries, registries) ? last.failures : 0) + 1;
|
|
610
666
|
const tmp = `${file}.${process.pid}.tmp`;
|
|
611
667
|
fs.writeFileSync(
|
|
612
668
|
tmp,
|
|
613
|
-
`${JSON.stringify({at: Date.now(), reason, failures})}\n`,
|
|
669
|
+
`${JSON.stringify({at: Date.now(), reason, failures, ...(registries ? {registries} : {})})}\n`,
|
|
614
670
|
);
|
|
615
671
|
fs.renameSync(tmp, file);
|
|
616
672
|
} catch {
|
|
@@ -1013,6 +1069,7 @@ function removeAside(dir) {
|
|
|
1013
1069
|
* @property {string} version
|
|
1014
1070
|
* @property {string} reason one plain sentence
|
|
1015
1071
|
* @property {NodeJS.Signals} [signal] the install was stopped by this signal
|
|
1072
|
+
* @property {{scoped: string | null, registry: string | null}} [registries] npm's registries when the install failed
|
|
1016
1073
|
*/
|
|
1017
1074
|
|
|
1018
1075
|
/**
|
|
@@ -1047,12 +1104,15 @@ export function ensureRelease(version, options = {}) {
|
|
|
1047
1104
|
}
|
|
1048
1105
|
// A recent failed install is not retried: offline, every run would start
|
|
1049
1106
|
// npm again and wait for it (FR2).
|
|
1107
|
+
// It is retried at once when npm's registry changed since: the caller
|
|
1108
|
+
// fixed what failed.
|
|
1050
1109
|
const failed = recentFailedInstall(version, cacheDir);
|
|
1051
|
-
|
|
1110
|
+
const registries = failed ? npmRegistries(run) : null;
|
|
1111
|
+
if (failed && !registriesChanged(failed.registries, registries)) {
|
|
1052
1112
|
const minutes = Math.max(1, Math.round((Date.now() - failed.at) / 60_000));
|
|
1053
1113
|
return {
|
|
1054
1114
|
version,
|
|
1055
|
-
reason: `${failed.reason}; last tried ${minutes} minute${minutes === 1 ? '' : 's'} ago, tried again after ${failed.waitMs / 60_000} minutes`,
|
|
1115
|
+
reason: `${failed.reason}; last tried ${minutes} minute${minutes === 1 ? '' : 's'} ago, tried again after ${failed.waitMs / 60_000} minutes${readsRegistry(failed.registries) ? " or at once when npm's registry changes" : ''}`,
|
|
1056
1116
|
};
|
|
1057
1117
|
}
|
|
1058
1118
|
try {
|
|
@@ -1073,7 +1133,14 @@ export function ensureRelease(version, options = {}) {
|
|
|
1073
1133
|
!('signal' in result && result.signal) &&
|
|
1074
1134
|
result.reason !== 'another run is still installing it'
|
|
1075
1135
|
) {
|
|
1076
|
-
|
|
1136
|
+
// Every recorded failure carries a reading of npm's registries, so a
|
|
1137
|
+
// change to them retries it whatever the failure was.
|
|
1138
|
+
recordFailedInstall(
|
|
1139
|
+
version,
|
|
1140
|
+
cacheDir,
|
|
1141
|
+
result.reason,
|
|
1142
|
+
('registries' in result ? result.registries : null) ?? registries ?? npmRegistries(run),
|
|
1143
|
+
);
|
|
1077
1144
|
}
|
|
1078
1145
|
return result;
|
|
1079
1146
|
} catch (error) {
|
|
@@ -1223,7 +1290,8 @@ function installLocked(version, {cacheDir, run, nodeVersion}) {
|
|
|
1223
1290
|
return {version, reason: 'the install was stopped', signal: stoppedBy};
|
|
1224
1291
|
}
|
|
1225
1292
|
if (install.status !== 0) {
|
|
1226
|
-
|
|
1293
|
+
const registries = npmRegistries(run);
|
|
1294
|
+
return {version, reason: npmFailure(install, registries), registries};
|
|
1227
1295
|
}
|
|
1228
1296
|
const cliDir = path.join(tmp, 'node_modules', '@astryxdesign', 'cli');
|
|
1229
1297
|
const cliPkg = readJson(path.join(cliDir, 'package.json'));
|
|
@@ -1290,24 +1358,36 @@ function installLocked(version, {cacheDir, run, nodeVersion}) {
|
|
|
1290
1358
|
}
|
|
1291
1359
|
|
|
1292
1360
|
/**
|
|
1293
|
-
* One sentence on why npm failed
|
|
1361
|
+
* One sentence on why npm failed, naming the registry: the one in npm's
|
|
1362
|
+
* own error when it names a URL, else the one registry setting when only
|
|
1363
|
+
* one is set or both agree; with two different settings and no URL, the
|
|
1364
|
+
* sentence names none.
|
|
1294
1365
|
* @param {NpmResult} result
|
|
1366
|
+
* @param {{scoped: string | null, registry: string | null}} [registries]
|
|
1295
1367
|
* @returns {string}
|
|
1296
1368
|
*/
|
|
1297
|
-
function npmFailure(result) {
|
|
1369
|
+
function npmFailure(result, registries = {scoped: null, registry: null}) {
|
|
1298
1370
|
if (result.error && /** @type {any} */ (result.error).code === 'ENOENT') {
|
|
1299
1371
|
return 'npm, which installs releases, was not found';
|
|
1300
1372
|
}
|
|
1301
1373
|
const text = `${result.stderr}\n${result.stdout}`;
|
|
1374
|
+
// npm names the address it failed at in one of these forms; without one,
|
|
1375
|
+
// the registry is named only when the two settings agree on it.
|
|
1376
|
+
const named = text.match(/(?:request to|network timeout at:|GET)\s+(https?:\/\/[^\s/]+)/i);
|
|
1377
|
+
const registry = named
|
|
1378
|
+
? `${named[1]}/`
|
|
1379
|
+
: registries.scoped && registries.registry && registries.scoped !== registries.registry
|
|
1380
|
+
? null
|
|
1381
|
+
: (registries.scoped ?? registries.registry);
|
|
1302
1382
|
if (/E404|404 Not Found|No matching version|ETARGET/i.test(text)) {
|
|
1303
|
-
return 'the registry does not have it';
|
|
1383
|
+
return registry ? `the registry ${registry} does not have it` : 'the registry does not have it';
|
|
1304
1384
|
}
|
|
1305
1385
|
if (
|
|
1306
1386
|
/ENOTFOUND|ECONNREFUSED|ETIMEDOUT|EAI_AGAIN|ENETUNREACH|offline|network/i.test(
|
|
1307
1387
|
text,
|
|
1308
1388
|
)
|
|
1309
1389
|
) {
|
|
1310
|
-
return 'the registry could not be reached';
|
|
1390
|
+
return registry ? `the registry ${registry} could not be reached` : 'the registry could not be reached';
|
|
1311
1391
|
}
|
|
1312
1392
|
return 'the package manager could not install it';
|
|
1313
1393
|
}
|
|
@@ -103,6 +103,21 @@ export function globalBehind({ self, stateDir }: {
|
|
|
103
103
|
* @returns {string}
|
|
104
104
|
*/
|
|
105
105
|
export function addVerbFor(root: string, version?: string | null): string;
|
|
106
|
+
/**
|
|
107
|
+
* The command that adds the package `name` to the project a run in `cwd`
|
|
108
|
+
* belongs to, with its package manager. A package Astryx releases with Core
|
|
109
|
+
* ({@link releasedWithCorePackages}) names Core's exact release as its peer,
|
|
110
|
+
* so it is added at the project's Core release: the Core it installed or
|
|
111
|
+
* locked, else the one its package.json pins, else the Core range it
|
|
112
|
+
* declares, else, with no Core at all, the release of the CLI that answers,
|
|
113
|
+
* whose Core the package then brings; it is saved exactly in a project that
|
|
114
|
+
* pins Core (see {@link addVerbFor}). Any other package is added at the
|
|
115
|
+
* version the package manager picks.
|
|
116
|
+
* @param {string} cwd
|
|
117
|
+
* @param {string} name
|
|
118
|
+
* @returns {string}
|
|
119
|
+
*/
|
|
120
|
+
export function addMatchingCore(cwd: string, name: string): string;
|
|
106
121
|
/**
|
|
107
122
|
* The command that adds a package to the project of a run in `cwd`, with the
|
|
108
123
|
* project's package manager (spec AST-081 FR12). Null when `cwd` belongs to
|
|
@@ -48,10 +48,11 @@ import {
|
|
|
48
48
|
getCliInvocation,
|
|
49
49
|
installDependenciesCommand,
|
|
50
50
|
} from '../env/package-manager.mjs';
|
|
51
|
-
import {findAstryxProject, findPackageRoot} from '../fs/paths.mjs';
|
|
51
|
+
import {CLI_ROOT, findAstryxProject, findPackageRoot} from '../fs/paths.mjs';
|
|
52
|
+
import {readDeclaredDependencies} from '../integrations/declared-dependencies.mjs';
|
|
52
53
|
import {satisfiesRange, semverCompare} from '../env/semver.mjs';
|
|
53
54
|
import {isInReleaseCache, isReleaseVersion} from './cache.mjs';
|
|
54
|
-
import {pinnedVersion} from './choose.mjs';
|
|
55
|
+
import {pinnedVersion, runningCopy} from './choose.mjs';
|
|
55
56
|
import {
|
|
56
57
|
knownLatest,
|
|
57
58
|
readGlobalState,
|
|
@@ -68,6 +69,7 @@ import {
|
|
|
68
69
|
import {installsPackage, readReleaseFacts} from './project.mjs';
|
|
69
70
|
import {samePath} from '../fs/path-compare.mjs';
|
|
70
71
|
import {updateNoticesOff} from './update-notice-env.mjs';
|
|
72
|
+
import {installGuidanceFor} from '../env/cli-command.mjs';
|
|
71
73
|
|
|
72
74
|
/** A notice prints at most once in this long. */
|
|
73
75
|
export const NOTICE_INTERVAL_MS = 24 * 60 * 60_000;
|
|
@@ -415,6 +417,106 @@ export function addVerbFor(root, version = null) {
|
|
|
415
417
|
return `${add} ${pm === 'bun' ? '--exact' : '-E'}`;
|
|
416
418
|
}
|
|
417
419
|
|
|
420
|
+
/**
|
|
421
|
+
* The packages Astryx releases with Core, such as its themes, as the official
|
|
422
|
+
* package list this CLI carries marks them. Each names Core's exact release
|
|
423
|
+
* as its peer. Empty when the CLI carries no readable list.
|
|
424
|
+
* @returns {Set<string>}
|
|
425
|
+
*/
|
|
426
|
+
function releasedWithCorePackages() {
|
|
427
|
+
/** @type {any} */
|
|
428
|
+
let list;
|
|
429
|
+
try {
|
|
430
|
+
// The official package list this CLI carries, which `discover` reads.
|
|
431
|
+
// Built here, not at load: paths.mjs and this module load each other.
|
|
432
|
+
const file = path.join(
|
|
433
|
+
CLI_ROOT,
|
|
434
|
+
'assets',
|
|
435
|
+
'discover',
|
|
436
|
+
'official-packages.json',
|
|
437
|
+
);
|
|
438
|
+
list = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
439
|
+
} catch {
|
|
440
|
+
return new Set();
|
|
441
|
+
}
|
|
442
|
+
return new Set(
|
|
443
|
+
(Array.isArray(list?.packages) ? list.packages : [])
|
|
444
|
+
.filter((/** @type {any} */ pkg) => pkg?.releasedWithCore === true)
|
|
445
|
+
.map((/** @type {any} */ pkg) => pkg.package),
|
|
446
|
+
);
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/**
|
|
450
|
+
* The packages beside Core and the CLI that the project at `root` lists for
|
|
451
|
+
* its install and that Astryx releases with Core, such as its themes, in the
|
|
452
|
+
* order the project lists them, so they move to a new release with Core
|
|
453
|
+
* ({@link releasedWithCorePackages}).
|
|
454
|
+
* @param {string} root
|
|
455
|
+
* @returns {string[]}
|
|
456
|
+
*/
|
|
457
|
+
function releasedWithCoreIn(root) {
|
|
458
|
+
const withCore = releasedWithCorePackages();
|
|
459
|
+
return readDeclaredDependencies(root)
|
|
460
|
+
.map(entry => entry.name)
|
|
461
|
+
.filter(name => withCore.has(name));
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
/**
|
|
465
|
+
* The command that adds the package `name` to the project a run in `cwd`
|
|
466
|
+
* belongs to, with its package manager. A package Astryx releases with Core
|
|
467
|
+
* ({@link releasedWithCorePackages}) names Core's exact release as its peer,
|
|
468
|
+
* so it is added at the project's Core release: the Core it installed or
|
|
469
|
+
* locked, else the one its package.json pins, else the Core range it
|
|
470
|
+
* declares, else, with no Core at all, the release of the CLI that answers,
|
|
471
|
+
* whose Core the package then brings; it is saved exactly in a project that
|
|
472
|
+
* pins Core (see {@link addVerbFor}). Any other package is added at the
|
|
473
|
+
* version the package manager picks.
|
|
474
|
+
* @param {string} cwd
|
|
475
|
+
* @param {string} name
|
|
476
|
+
* @returns {string}
|
|
477
|
+
*/
|
|
478
|
+
export function addMatchingCore(cwd, name) {
|
|
479
|
+
const root = projectRootOf(readReleaseFacts(cwd)) ?? cwd;
|
|
480
|
+
const facts = readReleaseFacts(root);
|
|
481
|
+
const release = releasedWithCorePackages().has(name)
|
|
482
|
+
? (coreVersionOf(facts) ??
|
|
483
|
+
facts.declaredCoreRange ??
|
|
484
|
+
runningCopy(CLI_ROOT).version)
|
|
485
|
+
: null;
|
|
486
|
+
// The guidance names the same version the command would add.
|
|
487
|
+
const guidance = installGuidanceFor(
|
|
488
|
+
[release ? `${name}@${release}` : name],
|
|
489
|
+
cwd,
|
|
490
|
+
);
|
|
491
|
+
if (guidance != null) return guidance;
|
|
492
|
+
const verb = addVerbFor(root, release);
|
|
493
|
+
if (!release) return `${verb} ${name}`;
|
|
494
|
+
// A range is quoted: `^`, `<`, `>`, `|` and spaces mean something to a
|
|
495
|
+
// shell.
|
|
496
|
+
return pinnedVersion(release)
|
|
497
|
+
? `${verb} ${name}@${release}`
|
|
498
|
+
: `${verb} "${name}@${release}"`;
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* The packages that move to `version` with Core in the project at `root`:
|
|
503
|
+
* Core, the CLI unless `cli` is false, then every other package
|
|
504
|
+
* {@link releasedWithCoreIn} names, each at `version`.
|
|
505
|
+
* @param {string} root
|
|
506
|
+
* @param {string} version
|
|
507
|
+
* @param {{cli?: boolean}} [options]
|
|
508
|
+
* @returns {string}
|
|
509
|
+
*/
|
|
510
|
+
function withCoreAt(root, version, {cli = true} = {}) {
|
|
511
|
+
return [
|
|
512
|
+
'@astryxdesign/core',
|
|
513
|
+
...(cli ? [CLI_PACKAGE] : []),
|
|
514
|
+
...releasedWithCoreIn(root),
|
|
515
|
+
]
|
|
516
|
+
.map(name => `${name}@${version}`)
|
|
517
|
+
.join(' ');
|
|
518
|
+
}
|
|
519
|
+
|
|
418
520
|
/**
|
|
419
521
|
* The command that adds a package to the project of a run in `cwd`, with the
|
|
420
522
|
* project's package manager (spec AST-081 FR12). Null when `cwd` belongs to
|
|
@@ -430,7 +532,7 @@ export function projectAddCommand(cwd) {
|
|
|
430
532
|
const target = installFolder(cwd);
|
|
431
533
|
if (target == null || target.moved) return null;
|
|
432
534
|
const add = ADD[detectPackageManager(cwd)] ?? ADD.npm;
|
|
433
|
-
return name => `${add} ${name}`;
|
|
535
|
+
return name => installGuidanceFor([name], cwd) ?? `${add} ${name}`;
|
|
434
536
|
}
|
|
435
537
|
|
|
436
538
|
/**
|
|
@@ -460,7 +562,7 @@ export function alignCliAndCore({cwd, cli, core}) {
|
|
|
460
562
|
function alignIn(root, cli, core) {
|
|
461
563
|
const add = addVerbFor(root, semverCompare(cli, core) > 0 ? cli : core);
|
|
462
564
|
if (semverCompare(cli, core) > 0) {
|
|
463
|
-
return `${add}
|
|
565
|
+
return `${add} ${withCoreAt(root, cli, {cli: false})}, then ${getCliInvocation(root, {installed: true})} upgrade --from ${core} --apply`;
|
|
464
566
|
}
|
|
465
567
|
return `${add} ${CLI_PACKAGE}@${core}`;
|
|
466
568
|
}
|
|
@@ -624,9 +726,11 @@ export function projectLag({cwd, current: given, stateDir = userConfigDir()}) {
|
|
|
624
726
|
const newest = latest.version;
|
|
625
727
|
// The CLI is always installed beside Core: a project that installed only
|
|
626
728
|
// Core gets it too, as recommended, so its version is pinned with Core's.
|
|
627
|
-
//
|
|
628
|
-
//
|
|
629
|
-
|
|
729
|
+
// Its themes move too: each names Core's exact release (see
|
|
730
|
+
// releasedWithCoreIn). From a folder inside the project whose package.json
|
|
731
|
+
// is not the project's, the install runs in the project's folder (see
|
|
732
|
+
// installFolder).
|
|
733
|
+
const add = `${addVerbFor(root, newest)} ${withCoreAt(root, newest)}`;
|
|
630
734
|
const install = target.moved ? commandInFolder(root, add) : add;
|
|
631
735
|
// The command runs after the install above, so the picker's guess is the
|
|
632
736
|
// project's own CLI (spec AST-081 FR5).
|
|
@@ -92,10 +92,6 @@ export function findLockfile(memberDir: string): string | null;
|
|
|
92
92
|
* @returns {ReleaseFacts}
|
|
93
93
|
*/
|
|
94
94
|
export function readReleaseFacts(startDir: string): ReleaseFacts;
|
|
95
|
-
/** The CLI package. */
|
|
96
|
-
export const CLI_PACKAGE_NAME: "@astryxdesign/cli";
|
|
97
|
-
/** The Core package. */
|
|
98
|
-
export const CORE_PACKAGE_NAME: "@astryxdesign/core";
|
|
99
95
|
/** Version-control metadata that marks a repository's root. */
|
|
100
96
|
export const REPOSITORY_MARKERS: string[];
|
|
101
97
|
/**
|
|
@@ -150,3 +146,6 @@ export type ReleaseFacts = {
|
|
|
150
146
|
*/
|
|
151
147
|
lockedCliVersion: string | null;
|
|
152
148
|
};
|
|
149
|
+
import { CLI_PACKAGE_NAME } from '../identity/package-names.mjs';
|
|
150
|
+
import { CORE_PACKAGE_NAME } from '../identity/package-names.mjs';
|
|
151
|
+
export { CLI_PACKAGE_NAME, CORE_PACKAGE_NAME };
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
* answers always pairs with the Core its reads load. A folder inside another
|
|
15
15
|
* project therefore belongs to that project, as it does for reads.
|
|
16
16
|
*
|
|
17
|
-
* Plain files only: no imports beyond Node built-ins
|
|
18
|
-
* the bin can read these facts before it loads
|
|
17
|
+
* Plain files only: no imports beyond Node built-ins, the path helpers and
|
|
18
|
+
* the built-in package names, so the bin can read these facts before it loads
|
|
19
|
+
* anything else.
|
|
19
20
|
*
|
|
20
21
|
* @input a folder
|
|
21
22
|
* @output {@link ReleaseFacts}
|
|
@@ -27,11 +28,9 @@ import * as fs from 'node:fs';
|
|
|
27
28
|
import * as os from 'node:os';
|
|
28
29
|
import * as path from 'node:path';
|
|
29
30
|
import {findInstalledPackage} from '../fs/paths.mjs';
|
|
31
|
+
import {CLI_PACKAGE_NAME, CORE_PACKAGE_NAME} from '../identity/package-names.mjs';
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
export const CLI_PACKAGE_NAME = '@astryxdesign/cli';
|
|
33
|
-
/** The Core package. */
|
|
34
|
-
export const CORE_PACKAGE_NAME = '@astryxdesign/core';
|
|
33
|
+
export {CLI_PACKAGE_NAME, CORE_PACKAGE_NAME};
|
|
35
34
|
|
|
36
35
|
/**
|
|
37
36
|
* An installed package and its version.
|