@astryxdesign/cli 0.7.16 → 0.7.17-canary.g0135e03
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 +26 -2
- package/api/docs/_adapter.mjs +219 -6
- 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 +122 -1
- package/api/theme/build/build.mjs +412 -84
- 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 +23 -3
- package/api/theme/build/font-warning.mjs +54 -5
- package/api/theme/build/icon-imports.mjs +25 -2
- package/api/theme/theme.type.d.mts +10 -0
- package/api/theme/theme.type.mjs +7 -1
- package/api/theme-edit/_adapter.d.mts +103 -3
- package/api/theme-edit/_adapter.mjs +961 -82
- package/api/theme-edit/_catalog.mjs +19 -4
- package/api/theme-edit/_check.d.mts +63 -24
- package/api/theme-edit/_check.mjs +2467 -362
- package/api/theme-edit/_color.d.mts +10 -0
- package/api/theme-edit/_color.mjs +49 -1
- package/api/theme-edit/_compiler.mjs +89 -6
- package/api/theme-edit/_context.d.mts +3 -3
- package/api/theme-edit/_context.mjs +165 -54
- package/api/theme-edit/_css.d.mts +14 -0
- package/api/theme-edit/_css.mjs +46 -1
- package/api/theme-edit/_edit.d.mts +31 -4
- package/api/theme-edit/_edit.mjs +2433 -204
- package/api/theme-edit/_how-commands.d.mts +72 -1
- package/api/theme-edit/_how-commands.mjs +759 -9
- package/api/theme-edit/_how-question.d.mts +82 -5
- package/api/theme-edit/_how-question.mjs +6473 -553
- package/api/theme-edit/_how.d.mts +2 -1
- package/api/theme-edit/_how.mjs +237 -41
- 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 +292 -0
- package/api/theme-edit/_normal.mjs +1454 -0
- package/api/theme-edit/_palette.mjs +10 -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 +18 -1
- package/api/theme-edit/_parts.mjs +246 -23
- package/api/theme-edit/_preview-app.d.mts +7 -1
- package/api/theme-edit/_preview-app.mjs +776 -187
- package/api/theme-edit/_preview.d.mts +100 -14
- package/api/theme-edit/_preview.mjs +582 -139
- package/api/theme-edit/_project.d.mts +4 -0
- package/api/theme-edit/_project.mjs +3 -1
- package/api/theme-edit/_settings.d.mts +417 -42
- package/api/theme-edit/_settings.mjs +3262 -424
- package/api/theme-edit/_tables.d.mts +15 -0
- package/api/theme-edit/_tables.mjs +63 -1
- package/api/theme-edit/_vet.d.mts +20 -0
- package/api/theme-edit/_vet.mjs +47 -2
- package/api/theme-edit/theme-edit.type.d.mts +10 -1
- package/api/theme-edit/theme-edit.type.mjs +4 -1
- 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/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 +358 -63
- 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 +1 -1
- 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 +317 -47
- 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 +92 -21
- 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/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.mjs +3 -2
- 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 +31 -0
- package/foundation/fonts/font-stylesheet.mjs +115 -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 +512 -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/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,24 @@ 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
|
+
* Register how the theme editor lists the themes of the app a command runs
|
|
345
|
+
* in, for the missing-theme suggestions.
|
|
346
|
+
* @param {(cwd: string) => string[]} list
|
|
347
|
+
*/
|
|
348
|
+
export function setEditorThemeList(list) {
|
|
349
|
+
editorThemesHere = list;
|
|
325
350
|
}
|
|
326
351
|
|
|
327
352
|
/**
|
|
@@ -335,6 +360,44 @@ function editorMissingSuggestions(cmd) {
|
|
|
335
360
|
for (let node = cmd; node; node = node.parent) parts.unshift(node.name());
|
|
336
361
|
const words = parts.slice(1).join(' ');
|
|
337
362
|
const invocation = getCliInvocation(process.cwd());
|
|
363
|
+
// No theme named, and the app has exactly one editor theme: the command
|
|
364
|
+
// on that theme, when the theme is all it takes.
|
|
365
|
+
const wants = (cmd?.registeredArguments ?? []).filter(
|
|
366
|
+
(/** @type {any} */ a) => a.required,
|
|
367
|
+
);
|
|
368
|
+
// (`new` names a theme that does not exist yet: never the one here.)
|
|
369
|
+
if (
|
|
370
|
+
!(cmd?.args ?? []).length &&
|
|
371
|
+
wants.length === 1 &&
|
|
372
|
+
wants[0].name() === 'theme' &&
|
|
373
|
+
cmd.name() !== 'new'
|
|
374
|
+
) {
|
|
375
|
+
const themes = editorThemesHere(process.cwd());
|
|
376
|
+
if (themes.length === 1)
|
|
377
|
+
return [
|
|
378
|
+
{
|
|
379
|
+
name: `${invocation} ${words} ${themes[0]}`,
|
|
380
|
+
reason: `do this instead: ${themes[0]} is the theme here`,
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
name: `${invocation} ${words} --help`,
|
|
384
|
+
reason: 'what each argument is',
|
|
385
|
+
},
|
|
386
|
+
];
|
|
387
|
+
}
|
|
388
|
+
// `new` with no name: a name no theme here has.
|
|
389
|
+
if (!(cmd?.args ?? []).length && cmd.name() === 'new') {
|
|
390
|
+
const taken = new Set(editorThemesHere(process.cwd()));
|
|
391
|
+
let free = 'my-theme';
|
|
392
|
+
for (let n = 2; taken.has(free); n += 1) free = `my-theme-${n}`;
|
|
393
|
+
return [
|
|
394
|
+
{
|
|
395
|
+
name: `${invocation} ${words} ${free}`,
|
|
396
|
+
reason: 'do this instead: a name for the new theme',
|
|
397
|
+
},
|
|
398
|
+
{name: `${invocation} ${words} --help`, reason: 'what each argument is'},
|
|
399
|
+
];
|
|
400
|
+
}
|
|
338
401
|
return [
|
|
339
402
|
{name: `${invocation} ${words} ${cmd.usage()}`.trim(), reason: 'usage'},
|
|
340
403
|
{name: `${invocation} ${words} --help`, reason: 'what each argument is'},
|
|
@@ -435,7 +498,9 @@ function patchOutputHelp(cmd) {
|
|
|
435
498
|
if (anyCmd.__xdsHelpPatched) return;
|
|
436
499
|
anyCmd.__xdsHelpPatched = true;
|
|
437
500
|
const original = cmd.outputHelp.bind(cmd);
|
|
438
|
-
anyCmd.outputHelp = function patchedOutputHelp(
|
|
501
|
+
anyCmd.outputHelp = function patchedOutputHelp(
|
|
502
|
+
/** @type {any} */ contextOptions,
|
|
503
|
+
) {
|
|
439
504
|
if (jsonActive()) {
|
|
440
505
|
if (!process.__xdsJsonHandled) {
|
|
441
506
|
process.__xdsJsonHandled = true;
|
|
@@ -461,7 +526,9 @@ function patchPrototype(CommandCtor) {
|
|
|
461
526
|
if (proto.__xdsHelpPatched) return;
|
|
462
527
|
proto.__xdsHelpPatched = true;
|
|
463
528
|
const original = proto.outputHelp;
|
|
464
|
-
proto.outputHelp = function patchedProtoOutputHelp(
|
|
529
|
+
proto.outputHelp = function patchedProtoOutputHelp(
|
|
530
|
+
/** @type {any} */ contextOptions,
|
|
531
|
+
) {
|
|
465
532
|
if (jsonActive()) {
|
|
466
533
|
if (!process.__xdsJsonHandled) {
|
|
467
534
|
process.__xdsJsonHandled = true;
|
|
@@ -497,7 +564,9 @@ function patchPrototype(CommandCtor) {
|
|
|
497
564
|
*/
|
|
498
565
|
export function handleCommanderError(err) {
|
|
499
566
|
if (!err || typeof err !== 'object' || !('code' in err)) return false;
|
|
500
|
-
const code =
|
|
567
|
+
const code =
|
|
568
|
+
/** @type {{code?: string, exitCode?: number, message?: string}} */ (err)
|
|
569
|
+
.code;
|
|
501
570
|
if (typeof code !== 'string' || !code.startsWith('commander.')) return false;
|
|
502
571
|
|
|
503
572
|
const exitCode = /** @type {{exitCode?: number}} */ (err).exitCode ?? 1;
|
|
@@ -549,9 +618,11 @@ export function handleCommanderError(err) {
|
|
|
549
618
|
// Commander's own line was suppressed above, so a parse failure reads the
|
|
550
619
|
// same as every other CLI error — the `Error: …` line cliError prints.
|
|
551
620
|
process.stderr.write(`Error: ${cleaned}\n`);
|
|
552
|
-
if (suggestions)
|
|
553
|
-
|
|
554
|
-
|
|
621
|
+
if (suggestions)
|
|
622
|
+
process.stderr.write(
|
|
623
|
+
`${suggestions[0].reason === 'usage' ? 'Usage' : 'Run'}: ${suggestions[0].name}\n`,
|
|
624
|
+
);
|
|
625
|
+
if (suggestions?.[1]) process.stderr.write(`Run: ${suggestions[1].name}\n`);
|
|
555
626
|
}
|
|
556
627
|
process.exit(exitCode || 1);
|
|
557
628
|
}
|
|
@@ -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',
|