@astryxdesign/cli 0.7.17-canary.g4ea41ce → 0.7.17-canary.g5a3fd39
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 +7 -2
- package/api/build/_adapter.d.mts +7 -6
- package/api/build/_adapter.mjs +18 -11
- package/api/build/build.type.mjs +1 -1
- package/api/build/kit/kind.d.mts +6 -0
- package/api/build/kit/kind.mjs +1 -1
- package/api/build/kit/rank.d.mts +7 -1
- package/api/build/kit/rank.mjs +15 -5
- package/api/build/kit/signals.mjs +58 -57
- package/api/build/kit/start.d.mts +2 -1
- package/api/build/kit/start.mjs +62 -9
- package/api/build/kit/words.d.mts +6 -2
- package/api/build/kit/words.mjs +7 -3
- package/api/component/__fixtures__/resolutions/modules.txt +2 -2
- package/api/component/_adapter.d.mts +30 -24
- package/api/component/_adapter.mjs +72 -31
- package/api/component/component.mjs +4 -4
- package/api/component/detail/detail.d.mts +2 -2
- package/api/component/detail/detail.mjs +1 -1
- package/api/component/list/list.d.mts +2 -2
- package/api/component/list/list.mjs +4 -4
- package/api/discover/_adapter.mjs +15 -15
- package/api/docs/_adapter.d.mts +13 -5
- package/api/docs/_adapter.mjs +37 -10
- package/api/doctor/_adapter.d.mts +32 -0
- package/api/doctor/_adapter.mjs +56 -1
- package/api/doctor/doctor.mjs +28 -5
- package/api/doctor/theme-checks.mjs +165 -83
- package/api/error.d.mts +4 -3
- package/api/error.mjs +3 -2
- package/api/hook/_adapter.d.mts +5 -4
- package/api/hook/_adapter.mjs +6 -5
- package/api/icon/_options.d.mts +17 -0
- package/api/icon/_options.mjs +54 -0
- package/api/icon/exportIconIndex.doc.d.mts +10 -0
- package/api/icon/exportIconIndex.doc.mjs +59 -0
- package/api/icon/icon.mjs +11 -34
- package/api/icon/icon.type.d.mts +49 -0
- package/api/icon/icon.type.mjs +24 -0
- package/api/icon/rankIconIndex.doc.d.mts +10 -0
- package/api/icon/rankIconIndex.doc.mjs +79 -0
- package/api/icon/search/icon-index.d.mts +41 -0
- package/api/icon/search/icon-index.mjs +139 -0
- package/api/icon/search/search.d.mts +18 -0
- package/api/icon/search/search.mjs +13 -0
- package/api/index.d.mts +1 -0
- package/api/index.mjs +1 -0
- package/api/search/_adapter.d.mts +8 -5
- package/api/search/_adapter.mjs +14 -10
- package/api/search/_gather-components.d.mts +4 -4
- package/api/search/_gather-components.mjs +4 -3
- package/api/search/_gather-hooks.d.mts +2 -2
- package/api/search/_gather-hooks.mjs +1 -1
- package/api/search/_lexical.mjs +12 -2
- package/api/search/_priority.d.mts +10 -2
- package/api/search/_priority.mjs +37 -7
- package/api/search/_score.d.mts +12 -3
- package/api/search/_score.mjs +6 -3
- package/api/search/_words.mjs +12 -3
- package/api/search/search.d.mts +7 -1
- package/api/search/search.mjs +37 -4
- package/api/swizzle/_adapter.d.mts +7 -5
- package/api/swizzle/_adapter.mjs +7 -3
- package/api/swizzle/copy/copy.mjs +5 -4
- package/api/theme/build/build.d.mts +5 -0
- package/api/theme/build/build.mjs +400 -21
- package/api/theme/build/family.mjs +18 -7
- package/api/theme/build/font-warning.mjs +5 -4
- package/api/theme/build/input-fields.d.mts +21 -6
- package/api/theme/build/input-fields.mjs +104 -13
- package/api/theme/build/typography-values.d.mts +22 -0
- package/api/theme/build/typography-values.mjs +172 -22
- package/api/theme/build/written-values.d.mts +7 -0
- package/api/theme/build/written-values.mjs +57 -8
- package/api/theme/generateTonalPalette.doc.mjs +1 -1
- package/api/theme/palette/generate/generator.d.mts +14 -2
- package/api/theme/palette/generate/generator.mjs +94 -8
- package/api/theme/theme.type.d.mts +21 -4
- package/api/theme/theme.type.mjs +14 -5
- package/api/theme/themePaletteGenerate.doc.mjs +1 -1
- package/api/theme/themeTemplate.doc.mjs +18 -3
- package/api/theme-edit/_adapter.d.mts +1 -1
- package/api/theme-edit/_adapter.mjs +1 -1
- package/api/theme-edit/_catalog.d.mts +10 -4
- package/api/theme-edit/_catalog.mjs +81 -22
- package/api/theme-edit/_check.mjs +402 -88
- package/api/theme-edit/_color.d.mts +11 -2
- package/api/theme-edit/_color.mjs +23 -7
- package/api/theme-edit/_compiler.mjs +11 -3
- package/api/theme-edit/_context.d.mts +87 -6
- package/api/theme-edit/_context.mjs +224 -17
- package/api/theme-edit/_css.mjs +4 -0
- package/api/theme-edit/_edit.mjs +331 -58
- package/api/theme-edit/_how-question.d.mts +11 -0
- package/api/theme-edit/_how-question.mjs +2514 -234
- package/api/theme-edit/_how.mjs +79 -14
- package/api/theme-edit/_missed.mjs +294 -32
- package/api/theme-edit/_normal.d.mts +3 -1
- package/api/theme-edit/_normal.mjs +4 -1
- package/api/theme-edit/_palette.mjs +36 -5
- package/api/theme-edit/_part-words.mjs +20 -2
- package/api/theme-edit/_parts.d.mts +12 -1
- package/api/theme-edit/_parts.mjs +116 -11
- package/api/theme-edit/_preview-app.mjs +40 -2
- package/api/theme-edit/_preview.d.mts +45 -5
- package/api/theme-edit/_preview.mjs +173 -21
- package/api/theme-edit/_settings.d.mts +20 -0
- package/api/theme-edit/_settings.mjs +1033 -94
- package/api/theme-edit/_tables.mjs +2 -2
- package/api/theme-edit/theme-edit.type.d.mts +6 -5
- package/api/theme-edit/theme-edit.type.mjs +8 -8
- package/api/upgrade/_adapter.mjs +13 -2
- package/assets/component-list.generated.json +1 -1
- package/assets/docs/tree/authoring.doc.mjs +1 -0
- package/assets/docs/tree/cli.doc.mjs +1 -0
- package/assets/docs/tree/computer-agent-guide.doc.mjs +1 -1
- package/assets/docs/tree/generate-a-palette.doc.mjs +2 -2
- package/assets/docs/tree/global.doc.mjs +1 -0
- package/assets/docs/tree/single-component.doc.mjs +40 -2
- package/assets/docs/tree/updates.doc.mjs +1 -1
- package/assets/docs/tree/who-answers.doc.mjs +2 -2
- package/assets/docs-routes.generated.json +1 -1
- package/assets/docs.generated.json +2 -2
- package/assets/search-catalog.generated.json +2 -2
- package/assets/self-audit.generated.json +1 -1
- package/assets/templates/blocks/components/Blockquote/BlockquoteShowcase.tsx +1 -1
- package/assets/templates/blocks/components/BreadcrumbItem/BreadcrumbItemShowcase.tsx +4 -4
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsCustomSeparator.tsx +1 -0
- package/assets/templates/blocks/components/Breadcrumbs/BreadcrumbsSupportingVariant.tsx +2 -2
- package/assets/templates/blocks/components/Card/CardElevations.tsx +1 -1
- package/assets/templates/blocks/components/Card/CardWithInnerLayout.tsx +19 -3
- package/assets/templates/blocks/components/Card/ClickableCardWithNestedButton.tsx +11 -1
- package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +1 -1
- package/assets/templates/blocks/components/Card/SelectableCardMulti.tsx +1 -1
- package/assets/templates/blocks/components/Center/CenterHorizontal.tsx +1 -1
- package/assets/templates/blocks/components/Center/CenterInsideACard.tsx +1 -1
- package/assets/templates/blocks/components/ChatComposer/ChatComposerFullFeatured.tsx +8 -0
- package/assets/templates/blocks/components/ChatComposerDrawer/ChatComposerDrawerWithProgress.tsx +8 -2
- package/assets/templates/blocks/components/ChatLayout/ChatLayoutPanelChat.tsx +1 -0
- package/assets/templates/blocks/components/ChatLayout/ChatLayoutShowcase.tsx +1 -1
- package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleCustomContent.tsx +9 -1
- package/assets/templates/blocks/components/ChatMessageBubble/ChatMessageBubbleMetadata.tsx +12 -2
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataFooter.tsx +28 -7
- package/assets/templates/blocks/components/ChatMessageMetadata/ChatMessageMetadataShowcase.tsx +35 -7
- package/assets/templates/blocks/components/Collapsible/CollapsibleShowcase.tsx +1 -1
- package/assets/templates/blocks/components/CommandPaletteGroup/CommandPaletteGroupBasic.tsx +20 -4
- package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListBasic.tsx +15 -3
- package/assets/templates/blocks/components/CommandPaletteList/CommandPaletteListShowcase.tsx +29 -6
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBasic.tsx +2 -2
- package/assets/templates/blocks/components/ContextMenu/ContextMenuBottomSheet.tsx +1 -1
- package/assets/templates/blocks/components/ContextMenu/ContextMenuShowcase.tsx +2 -2
- package/assets/templates/blocks/components/Divider/DividerFullBleed.tsx +1 -1
- package/assets/templates/blocks/components/Divider/DividerShowcase.tsx +1 -1
- package/assets/templates/blocks/components/Divider/DividerVariants.tsx +1 -1
- package/assets/templates/blocks/components/DropdownMenuGroup/DropdownMenuGroupShowcase.tsx +23 -4
- package/assets/templates/blocks/components/EmptyState/EmptyStateActions.tsx +18 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateCompact.tsx +20 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateContainer.tsx +16 -2
- package/assets/templates/blocks/components/EmptyState/EmptyStateShowcase.tsx +11 -1
- package/assets/templates/blocks/components/Heading/HeadingTruncation.tsx +12 -2
- package/assets/templates/blocks/components/InternationalizationProvider/useDirectionHookUsage.tsx +1 -1
- package/assets/templates/blocks/components/LayoutContent/LayoutContentBasic.tsx +1 -1
- package/assets/templates/blocks/components/LayoutContent/LayoutContentShowcase.tsx +1 -1
- package/assets/templates/blocks/components/LayoutFooter/LayoutFooterActions.tsx +17 -3
- package/assets/templates/blocks/components/LayoutFooter/LayoutFooterShowcase.tsx +17 -3
- package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderShowcase.tsx +15 -3
- package/assets/templates/blocks/components/LayoutHeader/LayoutHeaderWithActions.tsx +9 -2
- package/assets/templates/blocks/components/LayoutPanel/LayoutPanelNavigation.tsx +1 -1
- package/assets/templates/blocks/components/LayoutPanel/LayoutPanelShowcase.tsx +1 -1
- package/assets/templates/blocks/components/MoreMenu/MoreMenuBottomSheet.tsx +1 -1
- package/assets/templates/blocks/components/MultiSelector/MultiSelectorGhostToolbar.tsx +14 -2
- package/assets/templates/blocks/components/Outline/OutlineDensity.tsx +2 -0
- package/assets/templates/blocks/components/OverflowList/OverflowListShowcase.tsx +6 -1
- package/assets/templates/blocks/components/Pagination/PaginationVariants.tsx +4 -0
- package/assets/templates/blocks/components/Popover/PopoverHookUsage.tsx +17 -2
- package/assets/templates/blocks/components/SegmentedControl/SegmentedControlFillLayout.tsx +1 -1
- package/assets/templates/blocks/components/Selector/SelectorGhostToolbar.tsx +14 -2
- package/assets/templates/blocks/components/Selector/SelectorOptionDescriptions.tsx +8 -1
- package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +2 -2
- package/assets/templates/blocks/components/SideNavHeading/SideNavHeadingShowcase.tsx +2 -0
- package/assets/templates/blocks/components/Switch/SwitchWithStatus.tsx +1 -1
- package/assets/templates/blocks/components/TabList/TabListTabsFillLayout.tsx +1 -1
- package/assets/templates/blocks/components/TabList/TabListTabsWithActions.tsx +12 -1
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +11 -1
- package/assets/templates/blocks/components/Table/TableInCard.tsx +2 -2
- package/assets/templates/blocks/components/Text/TextTruncation.tsx +1 -1
- package/assets/templates/blocks/components/Text/TextWordBreak.tsx +12 -2
- package/assets/templates/blocks/components/Text/TextWrap.tsx +19 -4
- package/assets/templates/blocks/components/TextArea/TextAreaCharacterCount.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaShowcase.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaStates.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaValidation.tsx +1 -1
- package/assets/templates/blocks/components/TextArea/TextAreaWithIcon.tsx +1 -1
- package/assets/templates/blocks/components/TextInput/TextInputStatusVariant.tsx +2 -2
- package/assets/templates/blocks/components/Timestamp/TimestampAutoFormat.tsx +15 -1
- package/assets/templates/blocks/components/Timestamp/TimestampRelativeFormat.tsx +15 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarCardHeader.tsx +8 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarSizes.tsx +12 -1
- package/assets/templates/blocks/components/Toolbar/ToolbarThreeSlot.tsx +18 -3
- package/assets/templates/blocks/components/TopNav/TopNavCenteredNavigation.tsx +6 -0
- package/assets/templates/blocks/components/TopNav/TopNavEnterpriseDashboard.tsx +7 -1
- package/assets/templates/blocks/components/TopNav/TopNavMegaMenu.tsx +2 -2
- package/assets/templates/blocks/components/TopNav/TopNavShowcase.tsx +9 -0
- package/assets/templates/components.generated.json +1 -1
- package/assets/templates/pages/ai-chat/page.tsx +102 -6
- package/assets/templates/pages/canvas-editor/page.tsx +73 -2
- package/assets/templates/pages/centered-hero/page.tsx +10 -4
- package/assets/templates/pages/course-detail/page.tsx +46 -2
- package/assets/templates/pages/dashboard/page.tsx +45 -16
- package/assets/templates/pages/dashboard-cohort-funnel/page.tsx +31 -20
- package/assets/templates/pages/dashboard-comparison/page.tsx +9 -0
- package/assets/templates/pages/dashboard-composition/page.tsx +22 -9
- package/assets/templates/pages/dashboard-progress/page.tsx +27 -15
- package/assets/templates/pages/dashboard-scorecard/page.tsx +9 -0
- package/assets/templates/pages/detail-page/page.tsx +105 -77
- package/assets/templates/pages/documentation/page.tsx +15 -2
- package/assets/templates/pages/documentation-design/page.tsx +7 -34
- package/assets/templates/pages/documentation-technical/page.tsx +76 -12
- package/assets/templates/pages/editor/page.tsx +26 -21
- package/assets/templates/pages/file-explorer/page.tsx +35 -1
- package/assets/templates/pages/form-two-column/page.tsx +2 -3
- package/assets/templates/pages/form-wizard/page.tsx +31 -3
- package/assets/templates/pages/form-wizard-vertical/page.tsx +32 -3
- package/assets/templates/pages/gallery-hero/page.tsx +2 -1
- package/assets/templates/pages/ide/page.tsx +15 -1
- package/assets/templates/pages/incident-console/page.tsx +2 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +1 -1
- package/assets/templates/pages/kanban-board/page.tsx +39 -2
- package/assets/templates/pages/payment-form/page.tsx +77 -39
- package/assets/templates/pages/product-gallery/page.tsx +16 -14
- package/assets/templates/pages/settings/page.tsx +35 -3
- package/assets/templates/pages/settings-dialog/page.tsx +34 -5
- package/assets/templates/pages/settings-sidebar/page.tsx +23 -3
- package/assets/templates/pages/shell-nav/page.tsx +28 -12
- package/assets/templates/pages/shell-side-nav/page.tsx +16 -1
- package/assets/templates/pages/shell-top-nav/page.tsx +27 -1
- package/assets/templates/pages/side-gallery/page.tsx +1 -1
- package/assets/templates/pages/table/page.tsx +2 -1
- package/assets/templates/pages/table/template.doc.mjs +1 -1
- package/assets/templates/pages/table-collapsible/page.tsx +1 -1
- package/assets/templates/pages/table-comparison/page.tsx +1 -1
- package/assets/templates/pages/table-filter/page.tsx +9 -2
- package/assets/templates/pages/table-grouped/page.tsx +16 -6
- package/assets/templates/pages/table-inbox/page.tsx +60 -1
- package/assets/templates/pages/table-page/page.tsx +10 -2
- package/assets/templates/pages/table-tree/page.tsx +95 -13
- package/assets/templates/pages/theme-showcase/page.tsx +107 -11
- package/assets/templates/pages/work-item-detail/page.tsx +88 -74
- package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -1
- package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/gothic/gothicTheme.ts +5 -0
- package/assets/templates/themes/neutral/neutralTheme.ts +1 -1
- package/assets/templates/themes/y2k/y2kPaletteRefs.generated.ts +1 -1
- package/assets/templates/themes/y2k/y2kTheme.ts +1 -1
- package/authoring/debug/parse.d.mts +1 -1
- package/authoring/doctypes/_schema.d.mts +22 -8
- package/authoring/doctypes/_schema.mjs +31 -0
- package/authoring/doctypes/command/command.doc.mjs +24 -0
- package/authoring/doctypes/command/type.ts +31 -0
- package/authoring/doctypes/component/component.doc.mjs +1 -1
- package/authoring/doctypes/component/type.ts +8 -5
- package/authoring/doctypes/namespace/namespace.doc.mjs +6 -0
- package/authoring/doctypes/namespace/type.ts +4 -0
- package/authoring/doctypes/template/type.ts +0 -7
- package/authoring/index.d.ts +6 -1
- package/authoring/integration/integration.doc.mjs +7 -0
- package/authoring/integration/schema.d.mts +6 -0
- package/authoring/integration/schema.mjs +3 -0
- package/authoring/integration/type.ts +34 -0
- package/clients/cli/build-id.generated.json +1 -1
- package/clients/cli/commands/component.doc.mjs +1 -0
- package/clients/cli/commands/component.mjs +5 -1
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/experimental/index.mjs +4 -1
- package/clients/cli/commands/experimental/theme.mjs +139 -64
- package/clients/cli/commands/experimental-render.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-add.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-compile.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -1
- package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +2 -1
- package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +3 -2
- package/clients/cli/commands/experimental-theme-eject.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-remove.doc.mjs +2 -0
- package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-template.doc.mjs +1 -0
- package/clients/cli/commands/experimental-theme-use.doc.mjs +2 -0
- package/clients/cli/commands/gap-report.doc.mjs +1 -0
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +1 -0
- package/clients/cli/commands/manifest.mjs +10 -3
- package/clients/cli/commands/swizzle.doc.mjs +8 -1
- package/clients/cli/commands/swizzle.mjs +13 -6
- package/clients/cli/commands/template.doc.mjs +3 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -1
- package/clients/cli/commands/theme-build.doc.mjs +2 -1
- package/clients/cli/commands/theme-eject.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-remove.doc.mjs +2 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -0
- package/clients/cli/commands/theme-template.doc.mjs +1 -0
- package/clients/cli/commands/theme-use.doc.mjs +2 -1
- package/clients/cli/commands/theme.doc.mjs +7 -2
- package/clients/cli/commands/theme.mjs +21 -5
- package/clients/cli/index.mjs +167 -59
- package/clients/cli/lib/base-gate.mjs +522 -0
- package/clients/cli/lib/command-path.mjs +26 -0
- package/clients/cli/lib/define-command.mjs +161 -12
- package/clients/cli/lib/json-shim.mjs +34 -31
- package/clients/cli/lib/manifest.d.ts +14 -0
- package/clients/cli/lib/manifest.mjs +78 -22
- package/clients/cli/lib/root-args.mjs +79 -0
- package/clients/cli/lib/stray-option.mjs +21 -8
- package/clients/cli/lib/unknown-command.mjs +27 -6
- package/clients/cli/manifest.generated.json +1 -1
- package/clients/cli/run.mjs +13 -1
- package/foundation/agent-docs/computer-agent-text.mjs +1 -1
- package/foundation/bases/core-docs.d.mts +10 -0
- package/foundation/bases/core-docs.mjs +42 -0
- package/foundation/bases/core.d.mts +11 -0
- package/foundation/bases/core.mjs +32 -0
- package/foundation/bases/requirements.d.mts +128 -0
- package/foundation/bases/requirements.mjs +193 -0
- package/foundation/bases/resolve.d.mts +134 -0
- package/foundation/bases/resolve.mjs +295 -0
- package/foundation/bases/state.d.mts +24 -0
- package/foundation/bases/state.mjs +46 -0
- package/foundation/bases/steps.d.mts +49 -0
- package/foundation/bases/steps.mjs +88 -0
- package/foundation/config/project.d.mts +14 -0
- package/foundation/config/project.mjs +68 -1
- package/foundation/discovery/cli-self-docs.mjs +9 -1
- package/foundation/discovery/command-pointers.d.mts +28 -0
- package/foundation/discovery/command-pointers.mjs +31 -0
- package/foundation/discovery/component-discovery.d.mts +9 -8
- package/foundation/discovery/component-discovery.mjs +9 -4
- package/foundation/discovery/docs-discovery.d.mts +13 -5
- package/foundation/discovery/docs-discovery.mjs +25 -6
- package/foundation/discovery/hook-discovery.d.mts +6 -6
- package/foundation/discovery/hook-discovery.mjs +6 -4
- package/foundation/discovery/template-adapter.mjs +5 -0
- package/foundation/discovery/template-ids.d.mts +1 -1
- package/foundation/discovery/template-ids.mjs +5 -1
- package/foundation/discovery/theme-discovery.mjs +3 -0
- package/foundation/discovery/theme-imports.mjs +19 -1
- package/foundation/doc-compiler/tree.d.mts +4 -2
- package/foundation/doc-compiler/tree.mjs +46 -1
- package/foundation/env/package-manager.d.mts +7 -0
- package/foundation/env/package-manager.mjs +21 -0
- package/foundation/fonts/font-stylesheet.d.mts +8 -0
- package/foundation/fonts/font-stylesheet.mjs +26 -2
- package/foundation/fs/gather-cache.mjs +44 -13
- package/foundation/fs/own-modules.d.mts +29 -0
- package/foundation/fs/own-modules.mjs +57 -0
- package/foundation/fs/paths.d.mts +30 -2
- package/foundation/fs/paths.mjs +49 -2
- package/foundation/integrations/integrations.d.mts +4 -0
- package/foundation/integrations/integrations.mjs +6 -1
- package/foundation/release/choose.d.mts +7 -0
- package/foundation/release/choose.mjs +16 -2
- package/foundation/release/notices.d.mts +26 -0
- package/foundation/release/notices.mjs +48 -19
- package/foundation/release/project.d.mts +3 -2
- package/foundation/release/project.mjs +4 -5
- package/foundation/release/run-context.d.mts +7 -2
- package/foundation/release/run-context.mjs +6 -2
- package/foundation/render/css-cut.mjs +86 -6
- package/foundation/render/cut-short.d.mts +35 -0
- package/foundation/render/cut-short.mjs +124 -0
- package/foundation/render/font-probe.d.mts +27 -0
- package/foundation/render/font-probe.mjs +77 -0
- package/foundation/render/layers.d.mts +1 -9
- package/foundation/render/layers.mjs +2 -111
- package/foundation/render/page-worker.mjs +83 -6
- package/foundation/render/picture-chrome.mjs +24 -2
- package/foundation/render/picture-playwright.mjs +22 -2
- package/foundation/render/picture-window.d.mts +20 -4
- package/foundation/render/picture-window.mjs +137 -4
- package/foundation/response/base.d.ts +25 -0
- package/foundation/response/error-codes.d.mts +4 -1
- package/foundation/response/error-codes.d.ts +4 -1
- package/foundation/response/error-codes.doc.mjs +17 -0
- package/foundation/response/error-codes.mjs +21 -0
- package/foundation/response/json.d.mts +3 -1
- package/foundation/response/json.mjs +7 -2
- package/foundation/response/response-types.doc.mjs +2 -2
- package/foundation/suggest/name-index.d.mts +2 -1
- package/foundation/suggest/name-index.mjs +1 -1
- package/foundation/suggest/other-command.d.mts +4 -1
- package/foundation/suggest/other-command.mjs +23 -6
- package/foundation/text/string-utils.d.mts +7 -2
- package/foundation/text/string-utils.mjs +24 -10
- package/package.json +6 -6
- package/assets/templates/pages/access-denied/page.tsx +0 -101
- package/assets/templates/pages/access-denied/template.doc.mjs +0 -24
- package/assets/templates/pages/error-page/page.tsx +0 -130
- package/assets/templates/pages/error-page/template.doc.mjs +0 -22
- package/assets/templates/pages/not-found/page.tsx +0 -124
- package/assets/templates/pages/not-found/template.doc.mjs +0 -30
- package/assets/templates/pages/review-workspace/page.tsx +0 -551
- package/assets/templates/pages/review-workspace/template.doc.mjs +0 -31
- package/assets/templates/pages/run-console/page.tsx +0 -945
- package/assets/templates/pages/run-console/template.doc.mjs +0 -27
- package/assets/templates/pages/welcome-portal/page.tsx +0 -538
- package/assets/templates/pages/welcome-portal/template.doc.mjs +0 -38
|
@@ -28,6 +28,7 @@ import {recordCommandResult} from '../../../foundation/debug/index.mjs';
|
|
|
28
28
|
import {routeSegment} from '../../../foundation/discovery/docs-section-key.mjs';
|
|
29
29
|
import {formatCliCommand} from '../../../foundation/env/package-manager.mjs';
|
|
30
30
|
import {renderTokens} from '../../../foundation/doc-compiler/links.mjs';
|
|
31
|
+
import {pointerClause} from '../../../foundation/discovery/command-pointers.mjs';
|
|
31
32
|
import {text} from '../formatters/index.mjs';
|
|
32
33
|
|
|
33
34
|
/**
|
|
@@ -97,6 +98,93 @@ export function commandDocsOf(cmd) {
|
|
|
97
98
|
return /** @type {any} */ (cmd)?.[COMMAND_DOCS];
|
|
98
99
|
}
|
|
99
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Text in a description that names other commands, by their command paths.
|
|
103
|
+
* @typedef {{commands: string[], text: string}} HelpPointer
|
|
104
|
+
*/
|
|
105
|
+
|
|
106
|
+
/** The parts a description was set from, and the text they made. */
|
|
107
|
+
const DESCRIPTION_PARTS = Symbol('astryx.descriptionParts');
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Set a command's description from parts: plain text, and pointers whose
|
|
111
|
+
* text names other commands. The description holds every part, as the
|
|
112
|
+
* manifest publishes it; help reads the parts through
|
|
113
|
+
* {@link servedDescription}.
|
|
114
|
+
* @param {import('commander').Command} cmd
|
|
115
|
+
* @param {Array<string | HelpPointer>} parts
|
|
116
|
+
*/
|
|
117
|
+
export function describeCommand(cmd, parts) {
|
|
118
|
+
const text = parts
|
|
119
|
+
.map(part => (typeof part === 'string' ? part : part.text))
|
|
120
|
+
.join('');
|
|
121
|
+
cmd.description(text);
|
|
122
|
+
Object.defineProperty(cmd, DESCRIPTION_PARTS, {
|
|
123
|
+
value: {parts, text},
|
|
124
|
+
configurable: true,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A command's description with each pointer left out unless `served` holds
|
|
130
|
+
* for every command it names. A description set later, outside
|
|
131
|
+
* {@link describeCommand}, has no parts and is returned whole.
|
|
132
|
+
* @param {import('commander').Command} cmd
|
|
133
|
+
* @param {(command: string) => boolean} served
|
|
134
|
+
* @returns {string}
|
|
135
|
+
*/
|
|
136
|
+
export function servedDescription(cmd, served) {
|
|
137
|
+
return servedParts(cmd, cmd.description(), served);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Set an option's description from parts, as {@link describeCommand} does
|
|
142
|
+
* for a command; help reads them through {@link servedOptionDescription}.
|
|
143
|
+
* @param {import('commander').Option} option
|
|
144
|
+
* @param {Array<string | HelpPointer>} parts
|
|
145
|
+
* @returns {import('commander').Option} the option
|
|
146
|
+
*/
|
|
147
|
+
export function describeOption(option, parts) {
|
|
148
|
+
const text = parts
|
|
149
|
+
.map(part => (typeof part === 'string' ? part : part.text))
|
|
150
|
+
.join('');
|
|
151
|
+
option.description = text;
|
|
152
|
+
Object.defineProperty(option, DESCRIPTION_PARTS, {
|
|
153
|
+
value: {parts, text},
|
|
154
|
+
configurable: true,
|
|
155
|
+
});
|
|
156
|
+
return option;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* An option's description with each pointer left out unless `served` holds
|
|
161
|
+
* for every command it names.
|
|
162
|
+
* @param {import('commander').Option} option
|
|
163
|
+
* @param {(command: string) => boolean} served
|
|
164
|
+
* @returns {string}
|
|
165
|
+
*/
|
|
166
|
+
export function servedOptionDescription(option, served) {
|
|
167
|
+
return servedParts(option, option.description ?? '', served);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The text of `holder`'s recorded parts that `served` keeps. A description
|
|
172
|
+
* set outside the parts is returned whole.
|
|
173
|
+
* @param {object} holder a command or an option
|
|
174
|
+
* @param {string} description its current description
|
|
175
|
+
* @param {(command: string) => boolean} served
|
|
176
|
+
* @returns {string}
|
|
177
|
+
*/
|
|
178
|
+
function servedParts(holder, description, served) {
|
|
179
|
+
/** @type {{parts: Array<string | HelpPointer>, text: string} | undefined} */
|
|
180
|
+
const recorded = /** @type {any} */ (holder)[DESCRIPTION_PARTS];
|
|
181
|
+
if (recorded == null || recorded.text !== description) return description;
|
|
182
|
+
return recorded.parts
|
|
183
|
+
.filter(part => typeof part === 'string' || part.commands.every(served))
|
|
184
|
+
.map(part => (typeof part === 'string' ? part : part.text))
|
|
185
|
+
.join('');
|
|
186
|
+
}
|
|
187
|
+
|
|
100
188
|
/**
|
|
101
189
|
* Build a Commander command from a CommandDoc and attach it to `parent`.
|
|
102
190
|
*
|
|
@@ -126,19 +214,30 @@ export function defineCommand(parent, doc, {fn, action, hidden} = {}) {
|
|
|
126
214
|
argSpec ? `${token} ${argSpec}` : token,
|
|
127
215
|
hidden ? {hidden: true} : {},
|
|
128
216
|
);
|
|
129
|
-
Object.defineProperty(cmd, COMMAND_DOCS, {
|
|
217
|
+
Object.defineProperty(cmd, COMMAND_DOCS, {
|
|
218
|
+
value: {doc, fn},
|
|
219
|
+
configurable: true,
|
|
220
|
+
});
|
|
130
221
|
// Help shows doc tokens as commands, the way `astryx docs` does.
|
|
131
|
-
|
|
222
|
+
/** @type {Array<string | HelpPointer>} */
|
|
223
|
+
const parts = [
|
|
224
|
+
...(doc.summary ? [renderTokens(doc.summary)] : []),
|
|
225
|
+
...(doc.pointers ?? []).map(pointer => ({
|
|
226
|
+
commands: pointer.commands,
|
|
227
|
+
text: pointerClause(renderTokens(pointer.text)),
|
|
228
|
+
})),
|
|
229
|
+
];
|
|
132
230
|
// An experimental command says so wherever its name is listed in help.
|
|
133
231
|
if (doc.stability === 'experimental') {
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
if (doc.deprecated) {
|
|
137
|
-
const base = cmd.description() || '';
|
|
138
|
-
cmd.description(`${base} [DEPRECATED: ${doc.deprecated}]`);
|
|
232
|
+
parts.unshift(parts.length > 0 ? '[experimental] ' : '[experimental]');
|
|
139
233
|
}
|
|
234
|
+
if (doc.deprecated) parts.push(` [DEPRECATED: ${doc.deprecated}]`);
|
|
235
|
+
if (parts.length > 0) describeCommand(cmd, parts);
|
|
140
236
|
if (doc.replaces?.length) {
|
|
141
|
-
cmd.addHelpText(
|
|
237
|
+
cmd.addHelpText(
|
|
238
|
+
'before',
|
|
239
|
+
`Will replace: ${doc.replaces.map(name => `astryx ${name}`).join(', ')}\n`,
|
|
240
|
+
);
|
|
142
241
|
}
|
|
143
242
|
|
|
144
243
|
const paramDesc = (/** @type {string | undefined} */ name) =>
|
|
@@ -151,7 +250,9 @@ export function defineCommand(parent, doc, {fn, action, hidden} = {}) {
|
|
|
151
250
|
// current CLI has none. (Docsite/`astryx docs` read the arg's `param` for
|
|
152
251
|
// its description instead.)
|
|
153
252
|
if (arg.description) {
|
|
154
|
-
const argument = cmd.registeredArguments?.find(
|
|
253
|
+
const argument = cmd.registeredArguments?.find(
|
|
254
|
+
a => a.name() === arg.name,
|
|
255
|
+
);
|
|
155
256
|
if (argument) argument.description = renderTokens(arg.description);
|
|
156
257
|
}
|
|
157
258
|
}
|
|
@@ -186,6 +287,27 @@ export function defineCommand(parent, doc, {fn, action, hidden} = {}) {
|
|
|
186
287
|
return cmd;
|
|
187
288
|
}
|
|
188
289
|
|
|
290
|
+
/** @type {((cmd: import('commander').Command, cli: string) => boolean) | null} */
|
|
291
|
+
let exampleShown_ = null;
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* Set the test that decides which examples help shows: the run's base hides
|
|
295
|
+
* an example that names a command or option it does not serve.
|
|
296
|
+
* @param {(cmd: import('commander').Command, cli: string) => boolean} test
|
|
297
|
+
*/
|
|
298
|
+
export function setHelpExampleFilter(test) {
|
|
299
|
+
exampleShown_ = test;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @param {import('commander').Command} cmd
|
|
304
|
+
* @param {string} cli
|
|
305
|
+
* @returns {boolean}
|
|
306
|
+
*/
|
|
307
|
+
function exampleShown(cmd, cli) {
|
|
308
|
+
return exampleShown_ == null || exampleShown_(cmd, cli);
|
|
309
|
+
}
|
|
310
|
+
|
|
189
311
|
/**
|
|
190
312
|
* End `cmd`'s help with what its CommandDoc says: the exit codes, then the
|
|
191
313
|
* examples, then `More:`, the `astryx docs` route that reads the whole command.
|
|
@@ -193,16 +315,40 @@ export function defineCommand(parent, doc, {fn, action, hidden} = {}) {
|
|
|
193
315
|
* @param {import('@astryxdesign/cli/authoring').CommandDoc} doc
|
|
194
316
|
*/
|
|
195
317
|
export function addDocHelp(cmd, doc) {
|
|
318
|
+
// An experimental theme command's examples lead its help, before its
|
|
319
|
+
// options, so the first step is read without reading every option; the
|
|
320
|
+
// examples stay where every command's help has them, after the options.
|
|
321
|
+
const FIRST = 3;
|
|
322
|
+
if (
|
|
323
|
+
/^experimental theme\b/.test(String(doc.name ?? '')) &&
|
|
324
|
+
(doc.examples ?? []).length > FIRST
|
|
325
|
+
)
|
|
326
|
+
cmd.addHelpText('before', () => {
|
|
327
|
+
const lead = (doc.examples ?? [])
|
|
328
|
+
.filter(({cli}) => exampleShown(cmd, cli))
|
|
329
|
+
.slice(0, FIRST)
|
|
330
|
+
.flatMap(({label, cli}) => [
|
|
331
|
+
...(label ? [` # ${label}`] : []),
|
|
332
|
+
` ${formatCliCommand(cli)}`,
|
|
333
|
+
]);
|
|
334
|
+
if (lead.length === 0) return '';
|
|
335
|
+
return `${text(['Start here:', ...lead].join('\n')).toString()}\n`;
|
|
336
|
+
});
|
|
196
337
|
addExitCodesHelp(cmd, doc.exitCodes);
|
|
197
338
|
// Rendered when help is shown, so the run prefix (pnpm exec astryx, yarn
|
|
198
339
|
// astryx, ...) is looked up then, not on every start.
|
|
199
340
|
cmd.addHelpText('after', () => {
|
|
200
|
-
const examples = (doc.examples ?? [])
|
|
341
|
+
const examples = (doc.examples ?? [])
|
|
342
|
+
.filter(({cli}) => exampleShown(cmd, cli))
|
|
343
|
+
.flatMap(({label, cli}) => [
|
|
201
344
|
...(label ? [` # ${label}`] : []),
|
|
202
345
|
` ${formatCliCommand(cli)}`,
|
|
203
346
|
]);
|
|
204
347
|
const more = `More: ${formatCliCommand(`docs cli/commands/${routeSegment(doc.name)}`)}`;
|
|
205
|
-
const blocks =
|
|
348
|
+
const blocks =
|
|
349
|
+
examples.length > 0
|
|
350
|
+
? [['Examples:', ...examples].join('\n'), more]
|
|
351
|
+
: [more];
|
|
206
352
|
return `\n${text(blocks.join('\n\n')).toString()}`;
|
|
207
353
|
});
|
|
208
354
|
}
|
|
@@ -215,5 +361,8 @@ export function addDocHelp(cmd, doc) {
|
|
|
215
361
|
export function addExitCodesHelp(cmd, exitCodes) {
|
|
216
362
|
if (!exitCodes?.length) return;
|
|
217
363
|
const lines = exitCodes.map(({code, when}) => ` ${code} ${when}`);
|
|
218
|
-
cmd.addHelpText(
|
|
364
|
+
cmd.addHelpText(
|
|
365
|
+
'after',
|
|
366
|
+
`\n${text(['Exit codes:', ...lines].join('\n')).toString()}`,
|
|
367
|
+
);
|
|
219
368
|
}
|
|
@@ -59,24 +59,15 @@ import {
|
|
|
59
59
|
getCliInvocation,
|
|
60
60
|
quoteCommandArgument,
|
|
61
61
|
} from '../../../foundation/env/package-manager.mjs';
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
const parts = [];
|
|
72
|
-
/** @type {any} */
|
|
73
|
-
let node = cmd;
|
|
74
|
-
while (node?.parent) {
|
|
75
|
-
parts.unshift(node.name());
|
|
76
|
-
node = node.parent;
|
|
77
|
-
}
|
|
78
|
-
return parts.join(' ');
|
|
79
|
-
}
|
|
62
|
+
import {
|
|
63
|
+
commandAvailable,
|
|
64
|
+
helpBase,
|
|
65
|
+
optionAvailable,
|
|
66
|
+
servedHelpDescription,
|
|
67
|
+
servedHelpOptionDescription,
|
|
68
|
+
servedSubcommands,
|
|
69
|
+
} from './base-gate.mjs';
|
|
70
|
+
import {commandPath} from './command-path.mjs';
|
|
80
71
|
|
|
81
72
|
/**
|
|
82
73
|
* Cheap argv check used before preAction has had a chance to engage
|
|
@@ -111,10 +102,11 @@ export function buildHelpEnvelope(cmd) {
|
|
|
111
102
|
c = c.parent;
|
|
112
103
|
}
|
|
113
104
|
|
|
105
|
+
const base = helpBase();
|
|
114
106
|
/** @type {Array<{flags: string, description: string, defaultValue?: unknown, choices?: string[]}>} */
|
|
115
|
-
const options = cmd.options.map(o => {
|
|
107
|
+
const options = cmd.options.filter(o => optionAvailable(cmd, o, base)).map(o => {
|
|
116
108
|
/** @type {any} */
|
|
117
|
-
const opt = {flags: o.flags, description: o
|
|
109
|
+
const opt = {flags: o.flags, description: servedHelpOptionDescription(cmd, o) || ''};
|
|
118
110
|
if (o.defaultValue !== undefined) opt.defaultValue = o.defaultValue;
|
|
119
111
|
if (Array.isArray(o.argChoices) && o.argChoices.length)
|
|
120
112
|
opt.choices = o.argChoices;
|
|
@@ -122,15 +114,21 @@ export function buildHelpEnvelope(cmd) {
|
|
|
122
114
|
});
|
|
123
115
|
|
|
124
116
|
const subcommands = cmd.commands
|
|
125
|
-
.filter(s => !(/** @type {any} */ (s)._hidden))
|
|
126
|
-
|
|
117
|
+
.filter(s => !(/** @type {any} */ (s)._hidden) && commandAvailable(s, base))
|
|
118
|
+
// Off Core, a group's listing reads its summary, as text help does: its
|
|
119
|
+
// full description can name commands the base refuses.
|
|
120
|
+
.map(s => ({
|
|
121
|
+
name: s.name(),
|
|
122
|
+
description:
|
|
123
|
+
(base != null && !base.core && s.summary()) || servedHelpDescription(s) || '',
|
|
124
|
+
}));
|
|
127
125
|
|
|
128
126
|
return {
|
|
129
127
|
apiVersion: API_VERSION,
|
|
130
128
|
type: 'help',
|
|
131
129
|
data: {
|
|
132
130
|
command: nameParts.join(' '),
|
|
133
|
-
description: cmd
|
|
131
|
+
description: servedHelpDescription(cmd) || '',
|
|
134
132
|
usage: `${nameParts.join(' ')} ${cmd.usage()}`.trim(),
|
|
135
133
|
options,
|
|
136
134
|
subcommands,
|
|
@@ -149,7 +147,12 @@ export function buildHelpEnvelope(cmd) {
|
|
|
149
147
|
*/
|
|
150
148
|
export function buildHelpErrorEnvelope(cmd) {
|
|
151
149
|
const available = cmd.commands
|
|
152
|
-
.filter(
|
|
150
|
+
.filter(
|
|
151
|
+
s =>
|
|
152
|
+
!(/** @type {any} */ (s))._hidden &&
|
|
153
|
+
s.name() !== 'help' &&
|
|
154
|
+
commandAvailable(s, helpBase()),
|
|
155
|
+
)
|
|
153
156
|
.map(s => s.name());
|
|
154
157
|
if (!cmd.parent) {
|
|
155
158
|
// Commander dispatches `help <name>` with ['help', <name>, ...] in args.
|
|
@@ -160,7 +163,7 @@ export function buildHelpErrorEnvelope(cmd) {
|
|
|
160
163
|
ERROR_CODES.ERR_UNKNOWN_COMMAND,
|
|
161
164
|
);
|
|
162
165
|
}
|
|
163
|
-
const group =
|
|
166
|
+
const group = commandPath(cmd);
|
|
164
167
|
return toErrorEnvelope(
|
|
165
168
|
`'${group}' needs a subcommand`,
|
|
166
169
|
available.map(name => ({
|
|
@@ -275,7 +278,7 @@ function applyShimRecursively(cmd) {
|
|
|
275
278
|
// recorded against the root program instead of `theme build`.
|
|
276
279
|
cmd.exitOverride(err => {
|
|
277
280
|
try {
|
|
278
|
-
setCommand(
|
|
281
|
+
setCommand(commandPath(cmd));
|
|
279
282
|
} catch {
|
|
280
283
|
// Never let recording interfere with the error path.
|
|
281
284
|
}
|
|
@@ -383,7 +386,7 @@ function optionsWithoutSubcommand(group) {
|
|
|
383
386
|
}
|
|
384
387
|
const rest = argv.slice(at);
|
|
385
388
|
if (!rest.length || !rest[0].startsWith('-')) return null;
|
|
386
|
-
const subs =
|
|
389
|
+
const subs = servedSubcommands(group);
|
|
387
390
|
/** @type {string[]} */
|
|
388
391
|
const flags = [];
|
|
389
392
|
/** @type {string[]} */
|
|
@@ -450,7 +453,7 @@ function optionsBeforeSubcommand(group) {
|
|
|
450
453
|
}
|
|
451
454
|
const rest = argv.slice(at);
|
|
452
455
|
if (!rest.length || !String(rest[0]).startsWith('-')) return null;
|
|
453
|
-
const subs =
|
|
456
|
+
const subs = servedSubcommands(group);
|
|
454
457
|
/** The command a list of commands names by a word. @param {any[]} list @param {unknown} w */
|
|
455
458
|
const named = (list, w) =>
|
|
456
459
|
list.find(c => c.name() === w || c.aliases().includes(w));
|
|
@@ -472,8 +475,8 @@ function optionsBeforeSubcommand(group) {
|
|
|
472
475
|
let target = first;
|
|
473
476
|
const words = [first.name()];
|
|
474
477
|
let j = i + 1;
|
|
475
|
-
while (
|
|
476
|
-
target = named(target
|
|
478
|
+
while (named(servedSubcommands(target), rest[j])) {
|
|
479
|
+
target = named(servedSubcommands(target), rest[j]);
|
|
477
480
|
words.push(target.name());
|
|
478
481
|
j++;
|
|
479
482
|
}
|
|
@@ -1105,7 +1108,7 @@ export function handleCommanderError(err) {
|
|
|
1105
1108
|
suggestions: unknownSubcommandSuggestions(
|
|
1106
1109
|
`${getCliInvocation(process.cwd())} ${chain.join(' ')}`,
|
|
1107
1110
|
word,
|
|
1108
|
-
group.
|
|
1111
|
+
servedSubcommands(group).map((/** @type {any} */ c) => c.name()),
|
|
1109
1112
|
),
|
|
1110
1113
|
});
|
|
1111
1114
|
}
|
|
@@ -23,6 +23,11 @@ export interface ManifestOption {
|
|
|
23
23
|
default?: unknown;
|
|
24
24
|
/** True for `--no-foo` style negation flags. */
|
|
25
25
|
negate?: boolean;
|
|
26
|
+
/** Platform steps the option cannot run without. */
|
|
27
|
+
requires?: string[];
|
|
28
|
+
/** Whether the run's base serves the option; on every command option,
|
|
29
|
+
* absent on the global options, which every base serves. */
|
|
30
|
+
available?: boolean;
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
/** A positional argument. */
|
|
@@ -31,6 +36,8 @@ export interface ManifestArgument {
|
|
|
31
36
|
required: boolean;
|
|
32
37
|
variadic: boolean;
|
|
33
38
|
description: string;
|
|
39
|
+
/** Platform steps a value of the argument cannot run without, by value. */
|
|
40
|
+
requires?: Record<string, string[]>;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
/** A single command (possibly with subcommands). */
|
|
@@ -57,6 +64,11 @@ export interface ManifestCommand {
|
|
|
57
64
|
* else, which its docs state. Absent on a group that only holds subcommands.
|
|
58
65
|
*/
|
|
59
66
|
outsideProject?: 'same' | 'refuse' | 'own';
|
|
67
|
+
/** Platform steps the command cannot run without. Absent when it needs none. */
|
|
68
|
+
requires?: string[];
|
|
69
|
+
/** Whether the run's base serves the command. A group is available when any
|
|
70
|
+
* of its subcommands is. */
|
|
71
|
+
available: boolean;
|
|
60
72
|
/** Nested subcommands (e.g. `theme build` under `theme`). */
|
|
61
73
|
subcommands?: ManifestCommand[];
|
|
62
74
|
}
|
|
@@ -75,6 +87,8 @@ export interface CLIManifest {
|
|
|
75
87
|
globalMode: {docs: string; summary: string};
|
|
76
88
|
/** Flat index of response `type` discriminators keyed by command name. */
|
|
77
89
|
responseTypes: Record<string, string[]>;
|
|
90
|
+
/** The base the run reads, and the platform steps it serves. */
|
|
91
|
+
base: {name: string; version: string | null; steps: string[]};
|
|
78
92
|
}
|
|
79
93
|
|
|
80
94
|
/** The `astryx manifest --json` envelope. */
|
|
@@ -43,6 +43,14 @@ 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
45
|
import {compareText} from '../../../foundation/text/compare-text.mjs';
|
|
46
|
+
import {commandAvailable, helpBase} from './base-gate.mjs';
|
|
47
|
+
import {
|
|
48
|
+
isAvailable,
|
|
49
|
+
longFlag,
|
|
50
|
+
} from '../../../foundation/bases/requirements.mjs';
|
|
51
|
+
import {coreBase} from '../../../foundation/bases/core.mjs';
|
|
52
|
+
import {answeredBy} from '../../../foundation/release/run-context.mjs';
|
|
53
|
+
import {commandPath} from './command-path.mjs';
|
|
46
54
|
|
|
47
55
|
/**
|
|
48
56
|
* What a run may do beyond the command it was asked for (spec AST-081;
|
|
@@ -122,24 +130,6 @@ function describeArgument(arg) {
|
|
|
122
130
|
};
|
|
123
131
|
}
|
|
124
132
|
|
|
125
|
-
/**
|
|
126
|
-
* Compute the fully-qualified command name relative to the root program,
|
|
127
|
-
* e.g. `theme build`. The root program itself maps to ''.
|
|
128
|
-
* @param {import('commander').Command} cmd
|
|
129
|
-
* @param {import('commander').Command} root
|
|
130
|
-
* @returns {string}
|
|
131
|
-
*/
|
|
132
|
-
function fullName(cmd, root) {
|
|
133
|
-
const parts = [];
|
|
134
|
-
/** @type {import('commander').Command | null} */
|
|
135
|
-
let c = cmd;
|
|
136
|
-
while (c && c !== root) {
|
|
137
|
-
parts.unshift(c.name());
|
|
138
|
-
c = c.parent;
|
|
139
|
-
}
|
|
140
|
-
return parts.join(' ');
|
|
141
|
-
}
|
|
142
|
-
|
|
143
133
|
/**
|
|
144
134
|
* The docs a command was built from. `manifest` is registered by hand in
|
|
145
135
|
* index.mjs, so its CommandDoc is read here.
|
|
@@ -158,10 +148,11 @@ function docsOf(cmd, name) {
|
|
|
158
148
|
* @param {import('commander').Command} cmd
|
|
159
149
|
* @param {import('commander').Command} root
|
|
160
150
|
* @param {Set<string>} jsonSupported fully-qualified names that support --json
|
|
151
|
+
* @param {import('../../../foundation/bases/resolve.mjs').ActiveBase | null} [base] the run's base
|
|
161
152
|
* @returns {import('./manifest').ManifestCommand | null} null for hidden/internal commands
|
|
162
153
|
*/
|
|
163
|
-
function describeCommand(cmd, root, jsonSupported) {
|
|
164
|
-
const name =
|
|
154
|
+
function describeCommand(cmd, root, jsonSupported, base = null) {
|
|
155
|
+
const name = commandPath(cmd);
|
|
165
156
|
// Skip the auto-generated help command and any hidden/internal commands
|
|
166
157
|
// (e.g. the postinstall shim) — agents never invoke these directly.
|
|
167
158
|
// `_hidden` is a Commander internal not present on its public types.
|
|
@@ -171,7 +162,7 @@ function describeCommand(cmd, root, jsonSupported) {
|
|
|
171
162
|
|
|
172
163
|
const subcommands = /** @type {object[]} */ (
|
|
173
164
|
(cmd.commands || [])
|
|
174
|
-
.map(sub => describeCommand(sub, root, jsonSupported))
|
|
165
|
+
.map(sub => describeCommand(sub, root, jsonSupported, base))
|
|
175
166
|
.filter(Boolean)
|
|
176
167
|
);
|
|
177
168
|
|
|
@@ -192,6 +183,22 @@ function describeCommand(cmd, root, jsonSupported) {
|
|
|
192
183
|
json: jsonSupported.has(name),
|
|
193
184
|
};
|
|
194
185
|
|
|
186
|
+
// The steps the command, its options, and its argument values cannot run
|
|
187
|
+
// without, and whether the run's base serves the command.
|
|
188
|
+
if (docs?.doc.requires?.length) entry.requires = [...docs.doc.requires];
|
|
189
|
+
for (const option of entry.options) {
|
|
190
|
+
const declared = (docs?.doc.options ?? []).find(
|
|
191
|
+
o => longFlag(o.flag) === longFlag(option.flag),
|
|
192
|
+
);
|
|
193
|
+
if (declared?.requires?.length) option.requires = [...declared.requires];
|
|
194
|
+
option.available = isAvailable(base ?? coreBase(), option.requires);
|
|
195
|
+
}
|
|
196
|
+
for (const argument of entry.arguments) {
|
|
197
|
+
const declared = (docs?.doc.args ?? []).find(a => a.name === argument.name);
|
|
198
|
+
if (declared?.requires) argument.requires = {...declared.requires};
|
|
199
|
+
}
|
|
200
|
+
entry.available = commandAvailable(cmd, base);
|
|
201
|
+
|
|
195
202
|
const aliases = cmd.aliases ? cmd.aliases() : [];
|
|
196
203
|
if (aliases && aliases.length > 0) entry.aliases = [...aliases];
|
|
197
204
|
|
|
@@ -291,6 +298,51 @@ export function storedManifest() {
|
|
|
291
298
|
return storedManifestData ?? null;
|
|
292
299
|
}
|
|
293
300
|
|
|
301
|
+
/**
|
|
302
|
+
* A stored manifest as a run on `base` reads it: each command's and option's
|
|
303
|
+
* `available` and the manifest's `base` follow that base, Core included.
|
|
304
|
+
* @param {import('./manifest').CLIManifest} manifest
|
|
305
|
+
* @param {import('../../../foundation/bases/resolve.mjs').ActiveBase | null} base
|
|
306
|
+
* @returns {import('./manifest').CLIManifest}
|
|
307
|
+
*/
|
|
308
|
+
export function rebaseManifest(manifest, base) {
|
|
309
|
+
const shown = base ?? coreBase();
|
|
310
|
+
/** @param {import('./manifest').ManifestCommand[]} cmds @returns {import('./manifest').ManifestCommand[]} */
|
|
311
|
+
const rebase = cmds =>
|
|
312
|
+
cmds.map(cmd => {
|
|
313
|
+
const subcommands = cmd.subcommands ? rebase(cmd.subcommands) : undefined;
|
|
314
|
+
const available = isAvailable(
|
|
315
|
+
shown,
|
|
316
|
+
cmd.requires,
|
|
317
|
+
subcommands?.map(sub => Boolean(sub.available)),
|
|
318
|
+
);
|
|
319
|
+
const options = (cmd.options ?? []).map(option => ({
|
|
320
|
+
...option,
|
|
321
|
+
available: isAvailable(shown, option.requires),
|
|
322
|
+
}));
|
|
323
|
+
return {...cmd, options, ...(subcommands ? {subcommands} : {}), available};
|
|
324
|
+
});
|
|
325
|
+
return {
|
|
326
|
+
...manifest,
|
|
327
|
+
commands: rebase(manifest.commands),
|
|
328
|
+
base: manifestBase(shown),
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* The manifest's `base`: the run's base and the steps it serves. On Core the
|
|
334
|
+
* version is the Core the run pairs with, as `meta.answeredBy` names it.
|
|
335
|
+
* @param {import('../../../foundation/bases/resolve.mjs').ActiveBase} base
|
|
336
|
+
* @returns {import('./manifest').CLIManifest['base']}
|
|
337
|
+
*/
|
|
338
|
+
function manifestBase(base) {
|
|
339
|
+
return {
|
|
340
|
+
name: base.name,
|
|
341
|
+
version: base.core ? answeredBy().core : base.version,
|
|
342
|
+
steps: [...base.steps],
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
|
|
294
346
|
/**
|
|
295
347
|
* Build the full capability manifest from a configured Commander program.
|
|
296
348
|
*
|
|
@@ -303,10 +355,12 @@ export function storedManifest() {
|
|
|
303
355
|
export function buildManifest(program, opts = {}) {
|
|
304
356
|
const jsonSupported = opts.jsonSupported || new Set();
|
|
305
357
|
const version = opts.version || /** @type {any} */ (program)._version || '';
|
|
358
|
+
const base = helpBase();
|
|
359
|
+
const shown = base ?? coreBase();
|
|
306
360
|
|
|
307
361
|
const commands = /** @type {any[]} */ (
|
|
308
362
|
(program.commands || [])
|
|
309
|
-
.map(cmd => describeCommand(cmd, program, jsonSupported))
|
|
363
|
+
.map(cmd => describeCommand(cmd, program, jsonSupported, base))
|
|
310
364
|
.filter(Boolean)
|
|
311
365
|
).sort((a, b) => compareText(a.name, b.name));
|
|
312
366
|
|
|
@@ -319,6 +373,8 @@ export function buildManifest(program, opts = {}) {
|
|
|
319
373
|
commands,
|
|
320
374
|
jsonSupported: [...jsonSupported].sort(),
|
|
321
375
|
globalMode: GLOBAL_MODE,
|
|
376
|
+
// The run's base and the steps it serves.
|
|
377
|
+
base: manifestBase(shown),
|
|
322
378
|
// Flat index of every response `type` discriminator the CLI can emit,
|
|
323
379
|
// keyed by command — lets an agent know what to expect back per call.
|
|
324
380
|
responseTypes: Object.fromEntries(
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Read a run's arguments the way Commander reads the root's options,
|
|
5
|
+
* before it parses: which word names the command, and what value each root
|
|
6
|
+
* option was given.
|
|
7
|
+
* @input the arguments after `astryx`, and the root's options
|
|
8
|
+
* @output scanRootArgs()
|
|
9
|
+
* @position clients/cli/lib — the one walk over the root's options
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* @typedef {object} RootOptionShape
|
|
14
|
+
* @property {string} [long]
|
|
15
|
+
* @property {string} [short]
|
|
16
|
+
* @property {boolean} [required] takes a value
|
|
17
|
+
* @property {boolean} [optional] takes a value when one follows
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @typedef {object} RootArgs
|
|
22
|
+
* @property {string | undefined} operand the first word that is not an
|
|
23
|
+
* option or an option's value
|
|
24
|
+
* @property {Map<string, string | true>} values each given root option by its
|
|
25
|
+
* long flag, with its value, or true for a flag
|
|
26
|
+
* @property {boolean} printsVersion `--version` was given
|
|
27
|
+
* @property {boolean} stopped the walk met a word Commander does not dispatch
|
|
28
|
+
* by name: an unknown flag, `--`, or a value given to a flag that takes none
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Walk the arguments as Commander reads the root's options.
|
|
33
|
+
* @param {string[]} argv the arguments after `astryx`
|
|
34
|
+
* @param {readonly RootOptionShape[]} options the root's options
|
|
35
|
+
* @param {{unknown?: 'stop' | 'skip', pastOperand?: boolean}} [mode]
|
|
36
|
+
* `unknown: 'skip'` reads an unknown flag as one that takes no value and
|
|
37
|
+
* `--` as the end of options; `pastOperand` keeps reading root options
|
|
38
|
+
* after the operand
|
|
39
|
+
* @returns {RootArgs}
|
|
40
|
+
*/
|
|
41
|
+
export function scanRootArgs(argv, options, {unknown = 'stop', pastOperand = false} = {}) {
|
|
42
|
+
/** @type {RootArgs} */
|
|
43
|
+
const result = {operand: undefined, values: new Map(), printsVersion: false, stopped: false};
|
|
44
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
45
|
+
const arg = argv[i];
|
|
46
|
+
// Commander reads a lone `-` as an operand, as it reads any word.
|
|
47
|
+
if (arg.length < 2 || arg[0] !== '-') {
|
|
48
|
+
result.operand ??= arg;
|
|
49
|
+
if (!pastOperand) break;
|
|
50
|
+
continue;
|
|
51
|
+
}
|
|
52
|
+
if (arg === '--' && unknown === 'skip') {
|
|
53
|
+
result.operand ??= argv[i + 1];
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
const equals = arg.startsWith('--') ? arg.indexOf('=') : -1;
|
|
57
|
+
const flag = equals === -1 ? arg : arg.slice(0, equals);
|
|
58
|
+
const option = options.find(o => o.long === flag || o.short === flag);
|
|
59
|
+
const takesValue = Boolean(option?.required || option?.optional);
|
|
60
|
+
if (option == null || (equals !== -1 && !takesValue)) {
|
|
61
|
+
if (unknown === 'stop') {
|
|
62
|
+
result.stopped = true;
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
/** @type {string | true} */
|
|
68
|
+
let value = true;
|
|
69
|
+
const next = argv[i + 1];
|
|
70
|
+
if (equals !== -1) value = arg.slice(equals + 1);
|
|
71
|
+
else if (option.required && next != null) value = argv[++i];
|
|
72
|
+
else if (option.optional && next != null && !(next.length > 1 && next[0] === '-')) {
|
|
73
|
+
value = argv[++i];
|
|
74
|
+
}
|
|
75
|
+
if (option.long) result.values.set(option.long, value);
|
|
76
|
+
if (option.long === '--version') result.printsVersion = true;
|
|
77
|
+
}
|
|
78
|
+
return result;
|
|
79
|
+
}
|