@astryxdesign/cli 0.7.16 → 0.7.17-canary.g16fe6a8
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 +76 -86
- package/api/build/_adapter.d.mts +12 -0
- package/api/build/_adapter.mjs +51 -34
- package/api/build/blocks/blocks.d.mts +7 -5
- package/api/build/blocks/blocks.mjs +113 -26
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.type.d.mts +2 -2
- package/api/build/build.type.mjs +3 -3
- package/api/build/kit/kind.d.mts +2 -1
- package/api/build/kit/kind.mjs +199 -10
- package/api/build/kit/kit.mjs +6 -4
- package/api/build/kit/rank.d.mts +4 -2
- package/api/build/kit/rank.mjs +125 -24
- package/api/build/kit/start.d.mts +5 -4
- package/api/build/kit/start.mjs +12 -8
- package/api/build/kit/weights.d.mts +39 -3
- package/api/build/kit/weights.json +1 -1
- package/api/build/kit/weights.mjs +340 -43
- package/api/build/kit/word-model.d.mts +23 -0
- package/api/build/kit/word-model.mjs +46 -0
- package/api/build/kit/words.d.mts +48 -0
- package/api/build/kit/words.mjs +90 -1
- package/api/component/__fixtures__/resolutions/modules.txt +4 -5
- package/api/component/list/list.d.mts +1 -1
- package/api/component/list/list.mjs +48 -6
- package/api/discover/_adapter.d.mts +1 -1
- package/api/discover/search/search.mjs +3 -2
- package/api/docs/_adapter.d.mts +28 -2
- package/api/docs/_adapter.mjs +249 -10
- package/api/docs/docs.d.mts +3 -0
- package/api/docs/docs.doc.mjs +7 -1
- package/api/docs/docs.mjs +12 -0
- package/api/docs/docs.type.d.mts +5 -0
- package/api/docs/docs.type.mjs +2 -0
- package/api/docs/node/node.mjs +1 -1
- package/api/doctor/_adapter.d.mts +27 -5
- package/api/doctor/_adapter.mjs +83 -10
- package/api/doctor/built-checks.mjs +40 -14
- package/api/doctor/doctor.d.mts +4 -3
- package/api/doctor/doctor.mjs +14 -7
- package/api/doctor/theme-checks.mjs +121 -17
- package/api/icon/_records.mjs +2 -1
- package/api/index.d.mts +2 -0
- package/api/index.mjs +2 -0
- package/api/integration/_adapter.d.mts +44 -0
- package/api/integration/_adapter.mjs +77 -1
- package/api/integration/authoring-checks.mjs +6 -6
- package/api/integration/example-scope.d.mts +14 -0
- package/api/integration/example-scope.mjs +44 -0
- package/api/integration/example-scope.type.d.mts +29 -0
- package/api/integration/example-scope.type.mjs +25 -0
- package/api/integration/integrationExampleScope.doc.d.mts +11 -0
- package/api/integration/integrationExampleScope.doc.mjs +59 -0
- package/api/integration/validate-integration.mjs +19 -1
- package/api/integration/validate-integration.type.d.mts +9 -0
- package/api/integration/validate-integration.type.mjs +1 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/render/_adapter.mjs +591 -195
- package/api/render/render.doc.mjs +11 -3
- package/api/render/render.type.d.mts +52 -0
- package/api/render/render.type.mjs +31 -1
- package/api/search/ORDERING.md +1 -1
- package/api/search/_adapter.d.mts +9 -0
- package/api/search/_adapter.mjs +85 -0
- package/api/search/_candidate-score.mjs +51 -32
- package/api/search/_fit-order.mjs +3 -3
- package/api/search/_gather-components.d.mts +3 -2
- package/api/search/_gather-components.mjs +12 -3
- package/api/search/_lexical.d.mts +5 -0
- package/api/search/_lexical.mjs +8 -2
- package/api/search/_result.d.mts +11 -9
- package/api/search/_result.mjs +4 -4
- package/api/search/_score.d.mts +6 -1
- package/api/search/_score.mjs +15 -3
- package/api/search/search-index.mjs +7 -1
- package/api/search/search.d.mts +1 -1
- package/api/theme/_adapter.mjs +12 -1
- package/api/theme/build/build.d.mts +132 -1
- package/api/theme/build/build.mjs +482 -157
- package/api/theme/build/core-interception.d.mts +10 -0
- package/api/theme/build/core-interception.mjs +10 -0
- package/api/theme/build/font-warning.d.mts +44 -5
- package/api/theme/build/font-warning.mjs +118 -10
- package/api/theme/build/icon-imports.mjs +51 -9
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +115 -4
- package/api/theme-edit/_adapter.mjs +997 -83
- package/api/theme-edit/_catalog.d.mts +20 -2
- package/api/theme-edit/_catalog.mjs +50 -10
- package/api/theme-edit/_check.d.mts +75 -24
- package/api/theme-edit/_check.mjs +2672 -422
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +54 -1
- package/api/theme-edit/_compiler.d.mts +1 -0
- package/api/theme-edit/_compiler.mjs +133 -15
- package/api/theme-edit/_context.d.mts +14 -3
- package/api/theme-edit/_context.mjs +225 -65
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +54 -4
- package/api/theme-edit/_edit.mjs +2966 -286
- package/api/theme-edit/_how-commands.d.mts +72 -1
- package/api/theme-edit/_how-commands.mjs +770 -9
- package/api/theme-edit/_how-question.d.mts +82 -5
- package/api/theme-edit/_how-question.mjs +6983 -701
- package/api/theme-edit/_how.d.mts +2 -1
- package/api/theme-edit/_how.mjs +237 -41
- package/api/theme-edit/_importers.d.mts +38 -0
- package/api/theme-edit/_importers.mjs +188 -0
- package/api/theme-edit/_marks.d.mts +31 -5
- package/api/theme-edit/_marks.mjs +57 -5
- package/api/theme-edit/_name-rule.d.mts +11 -0
- package/api/theme-edit/_name-rule.mjs +12 -0
- package/api/theme-edit/_normal.d.mts +303 -0
- package/api/theme-edit/_normal.mjs +1517 -0
- package/api/theme-edit/_palette.d.mts +12 -0
- package/api/theme-edit/_palette.mjs +37 -4
- package/api/theme-edit/_part-words.d.mts +31 -0
- package/api/theme-edit/_part-words.mjs +126 -0
- package/api/theme-edit/_parts.d.mts +28 -2
- package/api/theme-edit/_parts.mjs +267 -31
- package/api/theme-edit/_preview-app.d.mts +7 -13
- package/api/theme-edit/_preview-app.mjs +814 -406
- package/api/theme-edit/_preview.d.mts +116 -16
- package/api/theme-edit/_preview.mjs +649 -152
- package/api/theme-edit/_project.d.mts +22 -1
- package/api/theme-edit/_project.mjs +83 -3
- package/api/theme-edit/_settings.d.mts +467 -42
- package/api/theme-edit/_settings.mjs +3527 -468
- package/api/theme-edit/_tables.d.mts +21 -0
- package/api/theme-edit/_tables.mjs +97 -3
- package/api/theme-edit/_vet.d.mts +31 -0
- package/api/theme-edit/_vet.mjs +114 -8
- package/api/theme-edit/theme-edit.type.d.mts +16 -2
- package/api/theme-edit/theme-edit.type.mjs +6 -3
- package/api/theme-edit/themeEditHow.doc.mjs +1 -1
- package/api/theme-edit/themeEditNew.doc.d.mts +0 -1
- package/api/theme-edit/themeEditNew.doc.mjs +7 -4
- package/api/theme-edit/themeEditPreviewApp.doc.mjs +3 -3
- package/api/theme-edit/themeEditPreviewRemove.doc.mjs +2 -2
- package/api/upgrade/run/run.mjs +4 -3
- package/assets/codemods/integration-discovery.mjs +2 -1
- package/assets/codemods/run-codemod.mjs +87 -7
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-item-swipe-actions-to-swipe.mjs +394 -0
- package/assets/component-list.generated.json +1 -0
- package/assets/docs/author-a-theme.doc.mjs +1 -0
- package/assets/docs/theme.doc.dense.mjs +2 -2
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/tree/check-your-docs.doc.mjs +1 -1
- package/assets/docs/tree/checks.doc.mjs +1 -1
- package/assets/docs/tree/cli-command.doc.mjs +2 -3
- package/assets/docs/tree/render-pages.doc.mjs +44 -3
- package/assets/docs/tree/share-a-page.doc.mjs +157 -0
- package/assets/docs/tree/single-component.doc.mjs +4 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +1 -1
- package/assets/docs/tree/test-in-an-app.doc.mjs +1 -1
- package/assets/docs/use-a-theme.doc.mjs +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -0
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/ChatComposerInput/useChatDictationHookUsage.tsx +38 -0
- package/assets/templates/blocks/components/Hooks/useContainerRevealHookUsage.tsx +2 -2
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.doc.mjs +14 -0
- package/assets/templates/blocks/components/SyntaxTheme/useSyntaxThemeHookUsage.tsx +36 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +5 -4
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +5 -1
- package/assets/templates/pages/blank/template.doc.mjs +1 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +4 -2
- package/assets/templates/pages/centered-hero/template.doc.mjs +9 -1
- package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +3 -2
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +2 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +6 -3
- package/assets/templates/pages/detail-page/template.doc.mjs +10 -3
- package/assets/templates/pages/documentation/template.doc.mjs +4 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +7 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +7 -1
- package/assets/templates/pages/editor/template.doc.mjs +2 -8
- package/assets/templates/pages/file-explorer/template.doc.mjs +1 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +4 -3
- package/assets/templates/pages/form-wizard/template.doc.mjs +5 -3
- package/assets/templates/pages/gallery-hero/template.doc.mjs +4 -2
- package/assets/templates/pages/ide/page.tsx +24 -2
- package/assets/templates/pages/kanban-board/template.doc.mjs +1 -9
- package/assets/templates/pages/library/template.doc.mjs +4 -1
- package/assets/templates/pages/login/template.doc.mjs +2 -1
- package/assets/templates/pages/login-card/template.doc.mjs +2 -1
- package/assets/templates/pages/login-split/template.doc.mjs +2 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +4 -2
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +4 -2
- package/assets/templates/pages/product-gallery/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +2 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +2 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +4 -2
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +5 -3
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +2 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +9 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +9 -8
- package/assets/templates/pages/table-grouped/template.doc.mjs +4 -2
- package/assets/templates/pages/table-page/template.doc.mjs +5 -4
- package/assets/templates/pages/table-tree/template.doc.mjs +6 -3
- package/assets/templates/pages/theme-showcase/template.doc.mjs +2 -9
- package/assets/templates/pages/work-item-detail/template.doc.mjs +1 -0
- package/assets/theme.template.ts +6 -0
- package/authoring/debug/parse.d.mts +3 -3
- package/authoring/doctypes/_schema.d.mts +3 -3
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/component/categories.d.mts +37 -0
- package/authoring/doctypes/component/categories.mjs +54 -0
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +9 -0
- package/authoring/example/example.doc.d.mts +12 -0
- package/authoring/example/example.doc.mjs +69 -0
- package/authoring/example/preview.d.mts +92 -0
- package/authoring/example/preview.mjs +994 -0
- package/authoring/example/type.ts +102 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +12 -0
- package/authoring/index.mjs +3 -1
- package/clients/cli/bin/astryx.mjs +6 -9
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.mjs +22 -3
- package/clients/cli/commands/docs.doc.mjs +7 -1
- package/clients/cli/commands/docs.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +32 -14
- package/clients/cli/commands/experimental/render.mjs +42 -1
- package/clients/cli/commands/experimental/theme.mjs +573 -119
- package/clients/cli/commands/experimental-render.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +3 -3
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +87 -1
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +10 -3
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-editor.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
- package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
- package/clients/cli/commands/experimental-theme-preview.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme.doc.mjs +5 -1
- package/clients/cli/commands/search.doc.mjs +2 -1
- package/clients/cli/commands/search.mjs +6 -1
- package/clients/cli/commands/template.mjs +4 -2
- package/clients/cli/commands/theme-build.doc.mjs +5 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/theme.mjs +718 -438
- package/clients/cli/commands/upgrade.mjs +42 -7
- package/clients/cli/index.mjs +1 -1
- package/clients/cli/lib/cli-error.mjs +2 -1
- package/clients/cli/lib/component-format.mjs +205 -98
- package/clients/cli/lib/hook-format.mjs +9 -19
- package/clients/cli/lib/json-shim.mjs +132 -24
- package/clients/cli/lib/manifest.mjs +3 -2
- package/clients/cli/manifest.generated.json +1 -1
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/config/theme-state.d.mts +13 -1
- package/foundation/config/theme-state.mjs +47 -7
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/component-discovery.d.mts +11 -0
- package/foundation/discovery/component-discovery.mjs +56 -8
- package/foundation/discovery/component-replacement.mjs +130 -1
- package/foundation/discovery/copied-passages.mjs +2 -1
- package/foundation/discovery/core-component-docs.d.mts +29 -0
- package/foundation/discovery/core-component-docs.mjs +83 -0
- package/foundation/discovery/doc-types.mjs +4 -3
- package/foundation/discovery/entry-name-files.d.mts +43 -0
- package/foundation/discovery/entry-name-files.mjs +264 -0
- package/foundation/discovery/hook-discovery.d.mts +8 -2
- package/foundation/discovery/hook-discovery.mjs +22 -8
- package/foundation/discovery/icon-definition-discovery.mjs +2 -1
- package/foundation/discovery/icon-set-checks.mjs +2 -1
- package/foundation/discovery/icon-set-discovery.mjs +2 -1
- package/foundation/discovery/integration-doc-files.mjs +2 -1
- package/foundation/discovery/package-exports.d.mts +10 -0
- package/foundation/discovery/package-exports.mjs +56 -3
- package/foundation/discovery/prop-drift.mjs +9 -9
- package/foundation/discovery/runner-allowlist.d.mts +1 -0
- package/foundation/discovery/runner-allowlist.mjs +2 -0
- package/foundation/discovery/stored-component-list.d.mts +43 -0
- package/foundation/discovery/stored-component-list.mjs +90 -0
- package/foundation/discovery/stored-search-catalog.d.mts +115 -0
- package/foundation/discovery/stored-search-catalog.mjs +297 -0
- package/foundation/discovery/stored-self-audit.d.mts +26 -10
- package/foundation/discovery/stored-self-audit.mjs +38 -18
- package/foundation/discovery/template-adapter.d.mts +53 -1
- package/foundation/discovery/template-adapter.mjs +176 -12
- package/foundation/discovery/template-icons.mjs +2 -1
- package/foundation/discovery/theme-discovery.mjs +31 -4
- package/foundation/discovery/theme-imports.d.mts +14 -0
- package/foundation/discovery/theme-imports.mjs +43 -1
- package/foundation/discovery/theming-targets.d.mts +6 -5
- package/foundation/discovery/theming-targets.mjs +31 -47
- package/foundation/doc-compiler/import.mjs +7 -1
- package/foundation/doc-compiler/inputs.mjs +3 -2
- package/foundation/doc-compiler/parse-readable.mjs +4 -1
- package/foundation/doc-compiler/stored-docs.d.mts +22 -0
- package/foundation/doc-compiler/stored-docs.mjs +49 -0
- package/foundation/env/semver.mjs +3 -1
- package/foundation/fonts/font-stylesheet.d.mts +38 -0
- package/foundation/fonts/font-stylesheet.mjs +141 -0
- package/foundation/fs/cache-eviction.d.mts +21 -0
- package/foundation/fs/cache-eviction.mjs +73 -0
- package/foundation/fs/exact-codec.d.mts +12 -2
- package/foundation/fs/exact-codec.mjs +23 -6
- package/foundation/fs/file-protection.mjs +4 -3
- package/foundation/fs/gather-cache.d.mts +62 -4
- package/foundation/fs/gather-cache.mjs +517 -91
- package/foundation/fs/jiti-cache.d.mts +19 -1
- package/foundation/fs/jiti-cache.mjs +130 -6
- package/foundation/fs/kept-tree.d.mts +60 -0
- package/foundation/fs/kept-tree.mjs +154 -0
- package/foundation/fs/listing-cache.d.mts +7 -0
- package/foundation/fs/listing-cache.mjs +10 -0
- package/foundation/fs/module-loader.d.mts +24 -2
- package/foundation/fs/module-loader.mjs +94 -21
- package/foundation/fs/paths.d.mts +18 -0
- package/foundation/fs/paths.mjs +15 -2
- package/foundation/fs/read-record.d.mts +9 -0
- package/foundation/fs/read-record.mjs +19 -11
- package/foundation/fs/stop-cleanup.d.mts +12 -0
- package/foundation/fs/stop-cleanup.mjs +66 -0
- package/foundation/identity/provider-identity.d.mts +6 -0
- package/foundation/identity/provider-identity.mjs +10 -1
- package/foundation/integrations/contribution-inventory.mjs +4 -3
- package/foundation/integrations/example-code.d.mts +63 -0
- package/foundation/integrations/example-code.mjs +416 -0
- package/foundation/integrations/public-imports.d.mts +9 -0
- package/foundation/integrations/public-imports.mjs +3 -2
- package/foundation/integrations/validate-contributions.mjs +17 -45
- package/foundation/render/embedded-files.d.mts +6 -0
- package/foundation/render/embedded-files.mjs +25 -5
- package/foundation/render/embedded-imports.d.mts +39 -7
- package/foundation/render/embedded-imports.mjs +66 -27
- package/foundation/render/file-header.d.mts +66 -0
- package/foundation/render/file-header.mjs +118 -0
- package/foundation/render/host-answer.d.mts +18 -0
- package/foundation/render/host-answer.mjs +46 -0
- package/foundation/render/host-exit.d.mts +1 -0
- package/foundation/render/host-exit.mjs +6 -1
- package/foundation/render/html-reader.d.mts +55 -2
- package/foundation/render/html-reader.mjs +145 -26
- package/foundation/render/markup-edits.d.mts +57 -0
- package/foundation/render/markup-edits.mjs +182 -0
- package/foundation/render/page-host.mjs +29 -12
- package/foundation/render/page-worker.mjs +121 -13
- package/foundation/render/picture-chrome.d.mts +4 -0
- package/foundation/render/picture-chrome.mjs +185 -0
- package/foundation/render/picture-playwright.d.mts +4 -0
- package/foundation/render/picture-playwright.mjs +34 -0
- package/foundation/render/rebuild.mjs +2 -1
- package/foundation/render/render-page.d.mts +35 -3
- package/foundation/render/render-page.mjs +641 -96
- package/foundation/render/source-block.d.mts +85 -6
- package/foundation/render/source-block.mjs +211 -20
- package/foundation/render/ts-paths.d.mts +69 -6
- package/foundation/render/ts-paths.mjs +326 -40
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +1 -0
- package/foundation/response/error-codes.doc.mjs +12 -1
- package/foundation/response/error-codes.mjs +11 -1
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/text/compare-text.d.mts +14 -0
- package/foundation/text/compare-text.mjs +68 -0
- package/foundation/text/css-escape.d.mts +18 -0
- package/foundation/text/css-escape.mjs +35 -0
- package/foundation/text/string-utils.d.mts +3 -2
- package/foundation/text/string-utils.mjs +18 -4
- package/foundation/text/suggest-order.d.mts +9 -0
- package/foundation/text/suggest-order.mjs +15 -1
- package/foundation/xle/expand.mjs +2 -1
- package/host/index.mjs +8 -6
- package/package.json +7 -6
|
@@ -41,10 +41,18 @@
|
|
|
41
41
|
* such as help printed as the failure report, still passes through.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
|
-
import {
|
|
44
|
+
import {
|
|
45
|
+
API_VERSION,
|
|
46
|
+
isJsonMode,
|
|
47
|
+
toErrorEnvelope,
|
|
48
|
+
} from '../../../foundation/response/json.mjs';
|
|
45
49
|
import {answeredBy} from '../../../foundation/release/run-context.mjs';
|
|
46
50
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
47
|
-
import {
|
|
51
|
+
import {
|
|
52
|
+
setCommand,
|
|
53
|
+
setOutcome,
|
|
54
|
+
recordHelp,
|
|
55
|
+
} from '../../../foundation/debug/index.mjs';
|
|
48
56
|
import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
|
|
49
57
|
|
|
50
58
|
/**
|
|
@@ -99,17 +107,18 @@ export function buildHelpEnvelope(cmd) {
|
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
/** @type {Array<{flags: string, description: string, defaultValue?: unknown, choices?: string[]}>} */
|
|
102
|
-
const options = cmd.options.map(
|
|
110
|
+
const options = cmd.options.map(o => {
|
|
103
111
|
/** @type {any} */
|
|
104
112
|
const opt = {flags: o.flags, description: o.description || ''};
|
|
105
113
|
if (o.defaultValue !== undefined) opt.defaultValue = o.defaultValue;
|
|
106
|
-
if (Array.isArray(o.argChoices) && o.argChoices.length)
|
|
114
|
+
if (Array.isArray(o.argChoices) && o.argChoices.length)
|
|
115
|
+
opt.choices = o.argChoices;
|
|
107
116
|
return opt;
|
|
108
117
|
});
|
|
109
118
|
|
|
110
119
|
const subcommands = cmd.commands
|
|
111
|
-
.filter(
|
|
112
|
-
.map(
|
|
120
|
+
.filter(s => !(/** @type {any} */ (s)._hidden))
|
|
121
|
+
.map(s => ({name: s.name(), description: s.description() || ''}));
|
|
113
122
|
|
|
114
123
|
return {
|
|
115
124
|
apiVersion: API_VERSION,
|
|
@@ -135,7 +144,7 @@ export function buildHelpEnvelope(cmd) {
|
|
|
135
144
|
*/
|
|
136
145
|
export function buildHelpErrorEnvelope(cmd) {
|
|
137
146
|
const available = cmd.commands
|
|
138
|
-
.filter(s => !(/** @type {any} */ (s)
|
|
147
|
+
.filter(s => !(/** @type {any} */ (s)._hidden) && s.name() !== 'help')
|
|
139
148
|
.map(s => s.name());
|
|
140
149
|
if (!cmd.parent) {
|
|
141
150
|
// Commander dispatches `help <name>` with ['help', <name>, ...] in args.
|
|
@@ -149,7 +158,10 @@ export function buildHelpErrorEnvelope(cmd) {
|
|
|
149
158
|
const group = fullNameOf(cmd);
|
|
150
159
|
return toErrorEnvelope(
|
|
151
160
|
`'${group}' needs a subcommand`,
|
|
152
|
-
available.map(name => ({
|
|
161
|
+
available.map(name => ({
|
|
162
|
+
name: `${group} ${name}`,
|
|
163
|
+
reason: 'available subcommand',
|
|
164
|
+
})),
|
|
153
165
|
ERROR_CODES.ERR_MISSING_ARGUMENT,
|
|
154
166
|
);
|
|
155
167
|
}
|
|
@@ -256,7 +268,7 @@ function applyShimRecursively(cmd) {
|
|
|
256
268
|
throw err;
|
|
257
269
|
});
|
|
258
270
|
cmd.configureOutput({
|
|
259
|
-
writeOut:
|
|
271
|
+
writeOut: str => process.stdout.write(str),
|
|
260
272
|
// Commander's own "error: ..." line never reaches the user. Under --json a
|
|
261
273
|
// consumer parsing both streams must not see it alongside the envelope;
|
|
262
274
|
// in text mode it is Commander's format, not Astryx's, so an invalid
|
|
@@ -268,7 +280,7 @@ function applyShimRecursively(cmd) {
|
|
|
268
280
|
// ONLY that line. Commander also writes HELP through this channel when it
|
|
269
281
|
// shows help because the invocation failed (a command group with no
|
|
270
282
|
// subcommand), and that output is still wanted in text mode.
|
|
271
|
-
writeErr:
|
|
283
|
+
writeErr: str => {
|
|
272
284
|
if (jsonActive()) return;
|
|
273
285
|
if (/^error:\s/i.test(str)) return;
|
|
274
286
|
process.stderr.write(str);
|
|
@@ -317,11 +329,56 @@ function editorMissingMessage(err, message) {
|
|
|
317
329
|
const wants = (cmd?.registeredArguments ?? [])
|
|
318
330
|
.filter((/** @type {any} */ a) => a.required)
|
|
319
331
|
.map((/** @type {any} */ a) => a.name());
|
|
320
|
-
return editorMissingArgument(
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
332
|
+
return editorMissingArgument(cmd, wants, /'([^']+)'/.exec(message)?.[1])
|
|
333
|
+
.message;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
/**
|
|
337
|
+
* The editor themes of the app a command runs in, as the theme editor
|
|
338
|
+
* lists them; the editor registers it, so this module reads no theme files.
|
|
339
|
+
* @type {(cwd: string) => string[]}
|
|
340
|
+
*/
|
|
341
|
+
let editorThemesHere = () => [];
|
|
342
|
+
|
|
343
|
+
/**
|
|
344
|
+
* How the theme commands read an option commander does not know, which the
|
|
345
|
+
* editor registers: the message and the commands that work, or undefined
|
|
346
|
+
* for a command it does not read.
|
|
347
|
+
* @type {(cmd: any) => {message: string, suggestions: Array<{name: string, reason: string}>} | undefined}
|
|
348
|
+
*/
|
|
349
|
+
let unknownOptionReader = () => undefined;
|
|
350
|
+
|
|
351
|
+
/**
|
|
352
|
+
* Register how the theme commands read an option they do not take.
|
|
353
|
+
* @param {(cmd: any) => {message: string, suggestions: Array<{name: string, reason: string}>} | undefined} read
|
|
354
|
+
*/
|
|
355
|
+
export function setUnknownOptionReader(read) {
|
|
356
|
+
unknownOptionReader = read;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* The theme name the editor offers `new` here, the one its own refusals
|
|
361
|
+
* offer: the name asked for when its folder is free, else name-2, name-3…
|
|
362
|
+
* The editor registers it, so this module reads no theme files.
|
|
363
|
+
* @type {(cwd: string, name: string) => string}
|
|
364
|
+
*/
|
|
365
|
+
let editorFreeName = (_cwd, name) => name;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Register the theme name the editor offers `new` here.
|
|
369
|
+
* @param {(cwd: string, name: string) => string} free
|
|
370
|
+
*/
|
|
371
|
+
export function setEditorFreeName(free) {
|
|
372
|
+
editorFreeName = free;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Register how the theme editor lists the themes of the app a command runs
|
|
377
|
+
* in, for the missing-theme suggestions.
|
|
378
|
+
* @param {(cwd: string) => string[]} list
|
|
379
|
+
*/
|
|
380
|
+
export function setEditorThemeList(list) {
|
|
381
|
+
editorThemesHere = list;
|
|
325
382
|
}
|
|
326
383
|
|
|
327
384
|
/**
|
|
@@ -335,6 +392,42 @@ function editorMissingSuggestions(cmd) {
|
|
|
335
392
|
for (let node = cmd; node; node = node.parent) parts.unshift(node.name());
|
|
336
393
|
const words = parts.slice(1).join(' ');
|
|
337
394
|
const invocation = getCliInvocation(process.cwd());
|
|
395
|
+
// No theme named, and the app has exactly one editor theme: the command
|
|
396
|
+
// on that theme, when the theme is all it takes.
|
|
397
|
+
const wants = (cmd?.registeredArguments ?? []).filter(
|
|
398
|
+
(/** @type {any} */ a) => a.required,
|
|
399
|
+
);
|
|
400
|
+
// (`new` names a theme that does not exist yet: never the one here.)
|
|
401
|
+
if (
|
|
402
|
+
!(cmd?.args ?? []).length &&
|
|
403
|
+
wants.length === 1 &&
|
|
404
|
+
wants[0].name() === 'theme' &&
|
|
405
|
+
cmd.name() !== 'new'
|
|
406
|
+
) {
|
|
407
|
+
const themes = editorThemesHere(process.cwd());
|
|
408
|
+
if (themes.length === 1)
|
|
409
|
+
return [
|
|
410
|
+
{
|
|
411
|
+
name: `${invocation} ${words} ${themes[0]}`,
|
|
412
|
+
reason: `do this instead: ${themes[0]} is the theme here`,
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
name: `${invocation} ${words} --help`,
|
|
416
|
+
reason: 'what each argument is',
|
|
417
|
+
},
|
|
418
|
+
];
|
|
419
|
+
}
|
|
420
|
+
// `new` with no name: a name no theme here has.
|
|
421
|
+
if (!(cmd?.args ?? []).length && cmd.name() === 'new') {
|
|
422
|
+
const free = editorFreeName(process.cwd(), 'my-theme');
|
|
423
|
+
return [
|
|
424
|
+
{
|
|
425
|
+
name: `${invocation} ${words} ${free}`,
|
|
426
|
+
reason: 'do this instead: a name for the new theme',
|
|
427
|
+
},
|
|
428
|
+
{name: `${invocation} ${words} --help`, reason: 'what each argument is'},
|
|
429
|
+
];
|
|
430
|
+
}
|
|
338
431
|
return [
|
|
339
432
|
{name: `${invocation} ${words} ${cmd.usage()}`.trim(), reason: 'usage'},
|
|
340
433
|
{name: `${invocation} ${words} --help`, reason: 'what each argument is'},
|
|
@@ -435,7 +528,9 @@ function patchOutputHelp(cmd) {
|
|
|
435
528
|
if (anyCmd.__xdsHelpPatched) return;
|
|
436
529
|
anyCmd.__xdsHelpPatched = true;
|
|
437
530
|
const original = cmd.outputHelp.bind(cmd);
|
|
438
|
-
anyCmd.outputHelp = function patchedOutputHelp(
|
|
531
|
+
anyCmd.outputHelp = function patchedOutputHelp(
|
|
532
|
+
/** @type {any} */ contextOptions,
|
|
533
|
+
) {
|
|
439
534
|
if (jsonActive()) {
|
|
440
535
|
if (!process.__xdsJsonHandled) {
|
|
441
536
|
process.__xdsJsonHandled = true;
|
|
@@ -461,7 +556,9 @@ function patchPrototype(CommandCtor) {
|
|
|
461
556
|
if (proto.__xdsHelpPatched) return;
|
|
462
557
|
proto.__xdsHelpPatched = true;
|
|
463
558
|
const original = proto.outputHelp;
|
|
464
|
-
proto.outputHelp = function patchedProtoOutputHelp(
|
|
559
|
+
proto.outputHelp = function patchedProtoOutputHelp(
|
|
560
|
+
/** @type {any} */ contextOptions,
|
|
561
|
+
) {
|
|
465
562
|
if (jsonActive()) {
|
|
466
563
|
if (!process.__xdsJsonHandled) {
|
|
467
564
|
process.__xdsJsonHandled = true;
|
|
@@ -497,7 +594,9 @@ function patchPrototype(CommandCtor) {
|
|
|
497
594
|
*/
|
|
498
595
|
export function handleCommanderError(err) {
|
|
499
596
|
if (!err || typeof err !== 'object' || !('code' in err)) return false;
|
|
500
|
-
const code =
|
|
597
|
+
const code =
|
|
598
|
+
/** @type {{code?: string, exitCode?: number, message?: string}} */ (err)
|
|
599
|
+
.code;
|
|
501
600
|
if (typeof code !== 'string' || !code.startsWith('commander.')) return false;
|
|
502
601
|
|
|
503
602
|
const exitCode = /** @type {{exitCode?: number}} */ (err).exitCode ?? 1;
|
|
@@ -531,12 +630,19 @@ export function handleCommanderError(err) {
|
|
|
531
630
|
|
|
532
631
|
// Real error paths. Strip Commander's "error: " prefix once: in the envelope
|
|
533
632
|
// the key is already `error`, and in text mode the Astryx prefix replaces it.
|
|
534
|
-
|
|
633
|
+
// An option a theme command does not take is read by the editor's one
|
|
634
|
+
// option reader: the option meant, with the command that works.
|
|
635
|
+
const read =
|
|
636
|
+
code === 'commander.unknownOption'
|
|
637
|
+
? unknownOptionReader(/** @type {any} */ (err)?.[REJECTED_COMMAND])
|
|
638
|
+
: undefined;
|
|
639
|
+
const suggestions = read?.suggestions ?? usageSuggestion(err, code);
|
|
535
640
|
// In the theme editor a missing argument names what was given: in
|
|
536
641
|
// `set corners small` the first word is read as the theme, so "value" alone
|
|
537
642
|
// would name the wrong thing.
|
|
538
|
-
const cleaned =
|
|
539
|
-
|
|
643
|
+
const cleaned = read
|
|
644
|
+
? read.message
|
|
645
|
+
: code === 'commander.missingArgument' && suggestions?.length === 2
|
|
540
646
|
? editorMissingMessage(err, message)
|
|
541
647
|
: message.replace(/^error:\s*/i, '');
|
|
542
648
|
if (jsonActive()) {
|
|
@@ -549,9 +655,11 @@ export function handleCommanderError(err) {
|
|
|
549
655
|
// Commander's own line was suppressed above, so a parse failure reads the
|
|
550
656
|
// same as every other CLI error — the `Error: …` line cliError prints.
|
|
551
657
|
process.stderr.write(`Error: ${cleaned}\n`);
|
|
552
|
-
if (suggestions)
|
|
553
|
-
|
|
554
|
-
|
|
658
|
+
if (suggestions)
|
|
659
|
+
process.stderr.write(
|
|
660
|
+
`${suggestions[0].reason === 'usage' ? 'Usage' : 'Run'}: ${suggestions[0].name}\n`,
|
|
661
|
+
);
|
|
662
|
+
if (suggestions?.[1]) process.stderr.write(`Run: ${suggestions[1].name}\n`);
|
|
555
663
|
}
|
|
556
664
|
process.exit(exitCode || 1);
|
|
557
665
|
}
|
|
@@ -42,6 +42,7 @@ import {fileURLToPath} from 'node:url';
|
|
|
42
42
|
import {API_VERSION} from '../../../foundation/response/json.mjs';
|
|
43
43
|
import {commandDocsOf} from './define-command.mjs';
|
|
44
44
|
import {doc as manifestDoc} from '../commands/manifest.doc.mjs';
|
|
45
|
+
import {compareText} from '../../../foundation/text/compare-text.mjs';
|
|
45
46
|
|
|
46
47
|
/**
|
|
47
48
|
* What a run may do beyond the command it was asked for (spec AST-081;
|
|
@@ -222,7 +223,7 @@ function describeCommand(cmd, root, jsonSupported) {
|
|
|
222
223
|
// `.command()` calls silently changes the output.
|
|
223
224
|
if (subcommands.length > 0) {
|
|
224
225
|
entry.subcommands = subcommands.sort((a, b) =>
|
|
225
|
-
/** @type {any} */ (a).name
|
|
226
|
+
compareText(/** @type {any} */ (a).name, /** @type {any} */ (b).name),
|
|
226
227
|
);
|
|
227
228
|
}
|
|
228
229
|
|
|
@@ -307,7 +308,7 @@ export function buildManifest(program, opts = {}) {
|
|
|
307
308
|
(program.commands || [])
|
|
308
309
|
.map(cmd => describeCommand(cmd, program, jsonSupported))
|
|
309
310
|
.filter(Boolean)
|
|
310
|
-
).sort((a, b) => a.name
|
|
311
|
+
).sort((a, b) => compareText(a.name, b.name));
|
|
311
312
|
|
|
312
313
|
return {
|
|
313
314
|
name: 'astryx',
|