@astryxdesign/cli 0.1.8-canary.0c4d8d7 → 0.1.8-canary.0db5dfd
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/{src/api → api/blog}/blog.mjs +42 -6
- package/{src/api → api/blog}/blog.test.mjs +2 -2
- package/api/build/build.mjs +92 -0
- package/api/build/build.test.mjs +92 -0
- package/{src/api → api/component}/component.mjs +49 -26
- package/{src/api → api/discover}/discover.mjs +55 -18
- package/{src/api → api/docs}/docs.mjs +47 -21
- package/{src/api → api/doctor}/doctor.mjs +11 -8
- package/{src/api → api/hook}/hook.mjs +11 -11
- package/{src/api → api}/index.mjs +16 -9
- package/{src/api → api/integration}/validate-integration.mjs +48 -15
- package/{src/api → api/integration}/validate-integration.test.mjs +1 -1
- package/{src/api → api/layout}/layout.mjs +66 -17
- package/{src/api → api/layout}/layout.test.mjs +1 -1
- package/{src/api → api/search}/search.mjs +71 -12
- package/api/swizzle/swizzle.mjs +283 -0
- package/{src/commands → api/swizzle}/swizzle.test.mjs +26 -1
- package/{src/api → api/template}/template-integration.test.mjs +2 -2
- package/{src/api → api/template}/template-suffix.test.mjs +3 -3
- package/{src/api → api/template}/template.mjs +96 -19
- package/{src/api → api/theme}/theme-add.mjs +35 -7
- package/{src → authoring}/codemod.mjs +6 -6
- package/{src → authoring}/config.test.mjs +1 -1
- package/{src → authoring}/doc.mjs +1 -1
- package/{src → authoring}/doc.test.mjs +1 -1
- package/{src → authoring}/template.mjs +1 -1
- package/bin/astryx.mjs +12 -10
- package/{src → cli}/commands/blog.mjs +48 -7
- package/{src → cli}/commands/build-theme.mjs +125 -46
- package/{src → cli}/commands/build.mjs +33 -57
- package/{src → cli}/commands/component/index.mjs +49 -22
- package/{src → cli}/commands/component-ownership.test.mjs +3 -3
- package/{src → cli}/commands/component-package.test.mjs +1 -1
- package/{src → cli}/commands/component-resolution.test.mjs +2 -2
- package/{src → cli}/commands/discover.mjs +17 -8
- package/{src → cli}/commands/docs.mjs +39 -7
- package/{src → cli}/commands/docs.test.mjs +1 -1
- package/{src → cli}/commands/doctor.mjs +3 -3
- package/{src → cli}/commands/doctor.test.mjs +2 -2
- package/{src → cli}/commands/ensure-core-built.mjs +3 -2
- package/{src → cli}/commands/external-showcase.test.mjs +1 -1
- package/{src → cli}/commands/hook/index.mjs +37 -14
- package/{src → cli}/commands/import-hint-correctness.test.mjs +1 -1
- package/{src → cli}/commands/init.mjs +20 -9
- package/{src → cli}/commands/layout.mjs +58 -18
- package/{src → cli}/commands/search.mjs +19 -12
- package/{src → cli}/commands/search.test.mjs +1 -1
- package/{src → cli}/commands/setup-nudge.test.mjs +1 -1
- package/cli/commands/swizzle.mjs +103 -0
- package/{src → cli}/commands/template.mjs +73 -22
- package/{src → cli}/commands/template.path-safety.test.mjs +2 -2
- package/{src → cli}/commands/upgrade.integration-policy.test.mjs +1 -1
- package/{src → cli}/commands/upgrade.mjs +160 -52
- package/{src → cli}/commands/upgrade.test.mjs +1 -1
- package/{src → cli}/commands/validate-integration.mjs +17 -37
- package/{src → cli}/index.mjs +17 -15
- package/{src/codemods → codemods}/ensure-jscodeshift.mjs +1 -1
- package/{src/codemods → codemods}/integration-discovery.mjs +6 -3
- package/{src/codemods → codemods}/integration-discovery.test.mjs +1 -1
- package/{src/codemods → codemods}/integration-runner.mjs +8 -3
- package/{src/codemods → codemods}/registry.mjs +3 -1
- package/{src/codemods → codemods}/run-codemod.mjs +17 -10
- package/{src/codemods → codemods}/runner.mjs +22 -12
- package/{src/codemods → codemods}/transforms/v0.0.10/remove-size-props.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.12/add-is-icon-only.mjs +27 -22
- package/{src/codemods → codemods}/transforms/v0.0.13/icon-name-deprecations.mjs +12 -5
- package/{src/codemods → codemods}/transforms/v0.0.13/rename-attachments-to-drawer.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.13/toolbar-density-to-size.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-action-props.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-section-wash-to-muted.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.14/rename-status-variants.mjs +15 -10
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-item-children-to-endcontent.mjs +13 -8
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-selector-children-to-render-option.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.0.15/migrate-theme-selectors-to-data-attrs.mjs +8 -4
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-date-picker-to-input.mjs +11 -6
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-imperative-ref-to-handleRef.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-isStreaming-to-isStopShown.mjs +6 -1
- package/{src/codemods → codemods}/transforms/v0.0.15/rename-stack-element-to-as.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-badge-dot-to-statusdot.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-gap-to-numeric.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-isFullBleed-to-padding.mjs +9 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/migrate-useXDSIcon-to-getIcon.mjs +12 -7
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-banner-endButton-to-endContent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-form-tooltip-startIcon.mjs +8 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-isShown-to-isOpen.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-selector-items-to-options.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-sidenav-header-to-heading.mjs +11 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/rename-topnav-title-to-heading.mjs +10 -4
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-uncontrolled-to-defaultX.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.2/unify-visibility-to-onOpenChange.mjs +10 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-badge-children-to-label.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-collapse-to-collapsible.mjs +9 -3
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-radius-tokens.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-shadow-tokens.mjs +13 -6
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-skeleton-radius.mjs +7 -1
- package/{src/codemods → codemods}/transforms/v0.0.6/migrate-token-names.mjs +11 -5
- package/{src/codemods → codemods}/transforms/v0.0.7/rename-banner-variant-to-container.mjs +8 -3
- package/{src/codemods → codemods}/transforms/v0.0.8/migrate-token-renames.mjs +15 -8
- package/{src/codemods → codemods}/transforms/v0.0.8/rename-endslot-to-endcontent.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/drop-xds-prefix-imports.mjs +19 -14
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-css-surfaces.mjs +21 -17
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-declare-module.mjs +7 -2
- package/{src/codemods → codemods}/transforms/v0.1.0/migrate-xds-module-specifiers.mjs +16 -11
- package/{src/codemods → codemods}/transforms/v0.1.2/rename-text-color-active-to-accent.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.3/migrate-layout-components-to-experimental.mjs +17 -12
- package/{src/codemods → codemods}/transforms/v0.1.5/rename-switch-label-spacing-default-to-hug.mjs +15 -9
- package/{src/codemods → codemods}/transforms/v0.1.7/migrate-table-tableprops-to-direct-props.mjs +17 -10
- package/{src/codemods → codemods}/transforms/v0.1.7/rename-table-renderprops-styles-to-xstyle.mjs +18 -13
- package/{src/codemods → codemods}/transforms/v0.1.8/rename-avatar-size-scale.mjs +15 -10
- package/docs/internationalization.doc.mjs +92 -46
- package/{src/commands → lib/agent-docs}/agent-docs.mjs +30 -11
- package/{src/commands → lib/agent-docs}/agent-docs.path-safety.test.mjs +1 -1
- package/{src/lib → lib}/component-discovery.mjs +44 -2
- package/{src/lib → lib}/component-format.mjs +65 -24
- package/{src/lib → lib}/component-loader.mjs +27 -13
- package/{src/lib → lib}/componentDocOverlay.test.mjs +0 -1
- package/{src/lib → lib}/error-codes.test.mjs +1 -1
- package/{src/lib → lib}/hook-discovery.mjs +14 -1
- package/{src/lib → lib}/hook-format.mjs +29 -5
- package/{src/lib → lib}/integration-warnings.mjs +2 -2
- package/{src/lib → lib}/integrations.mjs +20 -0
- package/{src/lib → lib}/integrations.test.mjs +1 -1
- package/{src/lib → lib}/json-contract.test.mjs +1 -1
- package/{src/lib → lib}/json-shim.mjs +10 -5
- package/{src/lib → lib}/json-shim.test.mjs +1 -1
- package/{src/lib → lib}/levenshtein.mjs +6 -0
- package/{src/lib → lib}/manifest.mjs +7 -5
- package/{src/lib → lib}/manifest.test.mjs +2 -2
- package/{src/lib → lib}/module-loader.mjs +1 -0
- package/{src/lib → lib}/package-scanner.mjs +47 -0
- package/{src/lib → lib}/project.mjs +48 -18
- package/{src/lib → lib}/project.test.mjs +1 -1
- package/{src/lib → lib}/resolve-theme.mjs +5 -0
- package/{src/lib → lib}/string-utils.mjs +15 -0
- package/{src/lib → lib}/term-log.mjs +12 -3
- package/{src/lib → lib}/xle/browser.mjs +18 -8
- package/{src/lib → lib}/xle/expand.mjs +155 -22
- package/{src/lib → lib}/xle/parse.mjs +119 -13
- package/{src/lib → lib}/xle/print.mjs +54 -14
- package/{src/lib → lib}/xle/registry-core.mjs +28 -3
- package/{src/lib → lib}/xle/registry.mjs +9 -4
- package/{src/lib → lib}/xle/splice.mjs +13 -2
- package/{src/lib → lib}/xle/validate.mjs +95 -14
- package/lib/xle/xle-ast.d.ts +214 -0
- package/package.json +33 -26
- package/scripts/postinstall.mjs +4 -4
- package/templates/blocks/components/Avatar/AvatarShowcase.tsx +1 -1
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.doc.mjs +19 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +46 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.doc.mjs +14 -0
- package/templates/blocks/components/InternationalizationProvider/InternationalizationProvider02Overrides.tsx +33 -0
- package/{src/types → types}/api.contract.assert.ts +17 -8
- package/{src/types → types}/api.d.ts +106 -0
- package/{src/types → types}/base.d.ts +17 -2
- package/types/build.d.ts +53 -0
- package/types/codemod.d.ts +166 -0
- package/{src/types → types}/component.d.ts +1 -1
- package/{src/types → types}/discover.d.ts +1 -1
- package/{src/types → types}/docs.d.ts +1 -4
- package/{src/types → types}/hook.d.ts +1 -1
- package/types/jscodeshift.d.ts +19 -0
- package/types/layout.d.ts +74 -0
- package/types/theme.d.ts +53 -0
- package/{src/types → types}/upgrade.d.ts +8 -1
- package/{src/utils → utils}/paths.mjs +4 -1
- package/src/commands/swizzle.mjs +0 -417
- package/src/types/build.d.ts +0 -23
- package/src/types/codemod.d.ts +0 -81
- package/src/types/theme.d.ts +0 -23
- /package/{src/api → api/docs}/docOverlays.test.mjs +0 -0
- /package/{src/api → api}/error.mjs +0 -0
- /package/{src/api → api/integration}/integration-block-exports.test.mjs +0 -0
- /package/{src/api → api/template}/template.test.mjs +0 -0
- /package/{src → authoring}/codemod.test.mjs +0 -0
- /package/{src → authoring}/config.mjs +0 -0
- /package/{src → authoring}/integration.mjs +0 -0
- /package/{src → authoring}/template.test.mjs +0 -0
- /package/{src → cli}/cli-exit-codes.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.color-scheme.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.import-path.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.prose.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.variants.test.mjs +0 -0
- /package/{src → cli}/commands/build-theme.watch.test.mjs +0 -0
- /package/{src → cli}/commands/cli-postinstall.test.mjs +0 -0
- /package/{src → cli}/commands/component.test.mjs +0 -0
- /package/{src → cli}/commands/detail-levels.test.mjs +0 -0
- /package/{src → cli}/commands/init.next-steps.test.mjs +0 -0
- /package/{src → cli}/commands/interactive-guard.test.mjs +0 -0
- /package/{src → cli}/commands/json-contract.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.path-safety.test.mjs +0 -0
- /package/{src → cli}/commands/swizzle.routing.test.mjs +0 -0
- /package/{src → cli}/commands/template.test.mjs +0 -0
- /package/{src → cli}/commands/upgrade.config-ordering.test.mjs +0 -0
- /package/{src → cli}/commands/validate-integration.test.mjs +0 -0
- /package/{src → cli}/update-hint-commands.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/registry.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-imperative-ref-to-handleRef.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-isStreaming-to-isStopShown.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/rename-section-wash-to-muted.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/runner.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/toolbar-density-to-size.test.mjs +0 -0
- /package/{src/codemods → codemods}/__tests__/validation.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/__tests__/remove-size-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.10/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/__tests__/add-is-icon-only.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.12/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/icon-name-deprecations.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/__tests__/rename-attachments-to-drawer.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.13/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-action-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.14/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-item-children-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-selector-children-to-render-option.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/migrate-theme-selectors-to-data-attrs.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-date-picker-to-input.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/__tests__/rename-stack-element-to-as.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.15/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-badge-dot-to-statusdot.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-gap-to-numeric.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-isFullBleed-to-padding.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/migrate-useXDSIcon-to-getIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-banner-endButton-to-endContent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-form-tooltip-startIcon.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-isShown-to-isOpen.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-selector-items-to-options.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-sidenav-header-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/rename-topnav-title-to-heading.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-uncontrolled-to-defaultX.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/__tests__/unify-visibility-to-onOpenChange.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-collapse-to-collapsible.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-radius-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-shadow-tokens.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-skeleton-radius.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/__tests__/migrate-token-names.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.6/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/__tests__/rename-banner-variant-to-container.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/migrate-token-renames.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/__tests__/rename-endslot-to-endcontent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.0.8/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/drop-xds-prefix-imports.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-css-surfaces.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-declare-module.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/migrate-xds-module-specifiers.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/__tests__/v0.1.0-ordering.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.0/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/__tests__/rename-text-color-active-to-accent.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.2/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/__tests__/migrate-layout-components-to-experimental.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.3/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/__tests__/rename-switch-label-spacing-default-to-hug.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.5/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/migrate-table-tableprops-to-direct-props.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/__tests__/rename-table-renderprops-styles-to-xstyle.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.7/index.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +0 -0
- /package/{src/codemods → codemods}/transforms/v0.1.8/index.mjs +0 -0
- /package/{src/commands → lib/agent-docs}/agent-docs.test.mjs +0 -0
- /package/{src/lib → lib}/cli-error.mjs +0 -0
- /package/{src/lib → lib}/cli-error.test.mjs +0 -0
- /package/{src/lib → lib}/component-discovery.importpath.test.mjs +0 -0
- /package/{src/lib → lib}/component-format.test.mjs +0 -0
- /package/{src/lib → lib}/component-loader.test.mjs +0 -0
- /package/{src/lib → lib}/config-cache.mjs +0 -0
- /package/{src/lib → lib}/config-cache.test.mjs +0 -0
- /package/{src/lib → lib}/config-schema.mjs +0 -0
- /package/{src/lib → lib}/error-codes.mjs +0 -0
- /package/{src/lib → lib}/integration-warnings.test.mjs +0 -0
- /package/{src/lib → lib}/json.mjs +0 -0
- /package/{src/lib → lib}/module-loader.test.mjs +0 -0
- /package/{src/lib → lib}/node-version.mjs +0 -0
- /package/{src/lib → lib}/node-version.test.mjs +0 -0
- /package/{src/lib → lib}/parse.mjs +0 -0
- /package/{src/lib → lib}/site.mjs +0 -0
- /package/{src/lib → lib}/xle/browser.d.ts +0 -0
- /package/{src/lib → lib}/xle/xle.test.mjs +0 -0
- /package/{src/schemas → schemas}/doc-schema.mjs +0 -0
- /package/{src/schemas → schemas}/template-schema.mjs +0 -0
- /package/{src/types → types}/config.d.ts +0 -0
- /package/{src/types → types}/doc.d.ts +0 -0
- /package/{src/types → types}/doctor.d.ts +0 -0
- /package/{src/types → types}/error-codes.d.ts +0 -0
- /package/{src/types → types}/index.d.ts +0 -0
- /package/{src/types → types}/integration.d.ts +0 -0
- /package/{src/types → types}/manifest.d.ts +0 -0
- /package/{src/types → types}/search.d.ts +0 -0
- /package/{src/types → types}/swizzle.d.ts +0 -0
- /package/{src/types → types}/template-api.d.ts +0 -0
- /package/{src/types → types}/template.d.ts +0 -0
- /package/{src/types → types}/validate-integration.d.ts +0 -0
- /package/{src/utils → utils}/github.mjs +0 -0
- /package/{src/utils → utils}/package-manager.mjs +0 -0
- /package/{src/utils → utils}/package-manager.test.mjs +0 -0
- /package/{src/utils → utils}/path-safety.mjs +0 -0
- /package/{src/utils → utils}/path-safety.test.mjs +0 -0
- /package/{src/utils → utils}/paths.test.mjs +0 -0
- /package/{src/utils → utils}/semver.mjs +0 -0
- /package/{src/utils → utils}/semver.test.mjs +0 -0
- /package/{src/utils → utils}/update-check.mjs +0 -0
- /package/{src/utils → utils}/update-check.test.mjs +0 -0
|
@@ -15,6 +15,8 @@ const CATEGORY_RE = /(?:^|\n) {0,4}category:\s*['"]([^'"]+)['"]/;
|
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Read the `category` field from a hook's .doc.mjs file (synchronous).
|
|
18
|
+
* @param {string} docPath
|
|
19
|
+
* @returns {{category: string | null}}
|
|
18
20
|
*/
|
|
19
21
|
function readHookMeta(docPath) {
|
|
20
22
|
try {
|
|
@@ -31,6 +33,8 @@ function readHookMeta(docPath) {
|
|
|
31
33
|
/**
|
|
32
34
|
* Extract the hook name from a doc filename.
|
|
33
35
|
* e.g. 'useFocusTrap.doc.mjs' → 'useFocusTrap'
|
|
36
|
+
* @param {string} fileName
|
|
37
|
+
* @returns {string}
|
|
34
38
|
*/
|
|
35
39
|
function hookNameFromFile(fileName) {
|
|
36
40
|
return fileName.replace('.doc.mjs', '');
|
|
@@ -41,6 +45,8 @@ function hookNameFromFile(fileName) {
|
|
|
41
45
|
* Returns Record<category, hookName[]> similar to discoverComponents.
|
|
42
46
|
* Categories from HookDoc.category: focus, layout, animation, interaction, data, media, streaming
|
|
43
47
|
* Hooks without a category go in 'Other'.
|
|
48
|
+
* @param {string} coreDir
|
|
49
|
+
* @returns {Record<string, string[]>}
|
|
44
50
|
*/
|
|
45
51
|
export function discoverHooks(coreDir) {
|
|
46
52
|
const srcDir = path.join(coreDir, 'src');
|
|
@@ -77,7 +83,7 @@ export function discoverHooks(coreDir) {
|
|
|
77
83
|
const groups = new Map();
|
|
78
84
|
for (const [hookName, category] of hookCategories) {
|
|
79
85
|
if (!groups.has(category)) groups.set(category, []);
|
|
80
|
-
groups.get(category)
|
|
86
|
+
groups.get(category)?.push(hookName);
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
// Sort members within each group
|
|
@@ -103,6 +109,8 @@ export function discoverHooks(coreDir) {
|
|
|
103
109
|
|
|
104
110
|
/**
|
|
105
111
|
* Recursively scan a directory for use*.doc.mjs files.
|
|
112
|
+
* @param {string} dirPath
|
|
113
|
+
* @param {Map<string, string>} hookCategories
|
|
106
114
|
*/
|
|
107
115
|
function scanDirForHookDocs(dirPath, hookCategories) {
|
|
108
116
|
if (!fs.existsSync(dirPath)) return;
|
|
@@ -199,6 +207,9 @@ export function findHookDoc(coreDir, name) {
|
|
|
199
207
|
|
|
200
208
|
/**
|
|
201
209
|
* Recursively search a directory for a hook doc matching any of the candidate names.
|
|
210
|
+
* @param {string} dirPath
|
|
211
|
+
* @param {string[]} candidates
|
|
212
|
+
* @returns {string | null}
|
|
202
213
|
*/
|
|
203
214
|
function searchDirForHookDoc(dirPath, candidates) {
|
|
204
215
|
if (!fs.existsSync(dirPath)) return null;
|
|
@@ -221,6 +232,8 @@ function searchDirForHookDoc(dirPath, candidates) {
|
|
|
221
232
|
|
|
222
233
|
/**
|
|
223
234
|
* Get all discovered hook names as a flat array (for fuzzy matching).
|
|
235
|
+
* @param {string} coreDir
|
|
236
|
+
* @returns {string[]}
|
|
224
237
|
*/
|
|
225
238
|
export function getAllHookNames(coreDir) {
|
|
226
239
|
const hooks = discoverHooks(coreDir);
|
|
@@ -16,14 +16,16 @@ import {mdCell} from './component-format.mjs';
|
|
|
16
16
|
/**
|
|
17
17
|
* Build a signature string from hook docs.
|
|
18
18
|
* e.g. 'useFocusTrap(options: UseFocusTrapOptions): { containerRef, focusFirst }'
|
|
19
|
+
* @param {any} docs
|
|
20
|
+
* @returns {string}
|
|
19
21
|
*/
|
|
20
22
|
function buildSignature(docs) {
|
|
21
23
|
const name = docs.name;
|
|
22
24
|
|
|
23
25
|
// Build params string — only top-level params (skip options.foo nested params)
|
|
24
|
-
const topParams = (docs.params || []).filter(p => !p.name.includes('.'));
|
|
26
|
+
const topParams = (docs.params || []).filter((/** @type {any} */ p) => !p.name.includes('.'));
|
|
25
27
|
const paramStr = topParams
|
|
26
|
-
.map(p => {
|
|
28
|
+
.map((/** @type {any} */ p) => {
|
|
27
29
|
const opt = p.required ? '' : '?';
|
|
28
30
|
return `${p.name}${opt}: ${p.type}`;
|
|
29
31
|
})
|
|
@@ -37,7 +39,7 @@ function buildSignature(docs) {
|
|
|
37
39
|
} else if (returns.length === 1 && returns[0].name === 'value') {
|
|
38
40
|
returnStr = returns[0].type;
|
|
39
41
|
} else {
|
|
40
|
-
returnStr = `{ ${returns.map(r => r.name).join(', ')} }`;
|
|
42
|
+
returnStr = `{ ${returns.map((/** @type {any} */ r) => r.name).join(', ')} }`;
|
|
41
43
|
}
|
|
42
44
|
|
|
43
45
|
return `${name}(${paramStr}): ${returnStr}`;
|
|
@@ -45,9 +47,12 @@ function buildSignature(docs) {
|
|
|
45
47
|
|
|
46
48
|
/**
|
|
47
49
|
* Format a parameters table (matches component props table style).
|
|
50
|
+
* @param {any[]} [params]
|
|
51
|
+
* @returns {string}
|
|
48
52
|
*/
|
|
49
53
|
function formatParamsTable(params) {
|
|
50
54
|
if (!params || params.length === 0) return '';
|
|
55
|
+
/** @type {string[]} */
|
|
51
56
|
const lines = [];
|
|
52
57
|
lines.push('| Param | Type | Default | Description |');
|
|
53
58
|
lines.push('|-------|------|---------|-------------|');
|
|
@@ -63,9 +68,12 @@ function formatParamsTable(params) {
|
|
|
63
68
|
|
|
64
69
|
/**
|
|
65
70
|
* Format a returns table.
|
|
71
|
+
* @param {any[]} [returns]
|
|
72
|
+
* @returns {string}
|
|
66
73
|
*/
|
|
67
74
|
function formatReturnsTable(returns) {
|
|
68
75
|
if (!returns || returns.length === 0) return '';
|
|
76
|
+
/** @type {string[]} */
|
|
69
77
|
const lines = [];
|
|
70
78
|
lines.push('| Field | Type | Description |');
|
|
71
79
|
lines.push('|-------|------|-------------|');
|
|
@@ -81,8 +89,11 @@ function formatReturnsTable(returns) {
|
|
|
81
89
|
* Format full hook docs (default mode).
|
|
82
90
|
* Matches component formatFull structure:
|
|
83
91
|
* # Name, description, anatomy→params, best practices, props→params+returns, theming→related
|
|
92
|
+
* @param {any} docs
|
|
93
|
+
* @returns {string}
|
|
84
94
|
*/
|
|
85
95
|
export function formatHookFull(docs) {
|
|
96
|
+
/** @type {string[]} */
|
|
86
97
|
const sections = [];
|
|
87
98
|
|
|
88
99
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -119,8 +130,12 @@ export function formatHookFull(docs) {
|
|
|
119
130
|
* Format compact hook docs for LLM consumption.
|
|
120
131
|
* Matches component formatCompact structure:
|
|
121
132
|
* # Name, description, ## Import, ## Best Practices, ## Parameters, ## Returns
|
|
133
|
+
* @param {any} docs
|
|
134
|
+
* @param {string} [importPath]
|
|
135
|
+
* @returns {string}
|
|
122
136
|
*/
|
|
123
137
|
export function formatHookCompact(docs, importPath) {
|
|
138
|
+
/** @type {string[]} */
|
|
124
139
|
const sections = [];
|
|
125
140
|
|
|
126
141
|
sections.push(`# ${docs.name}\n`);
|
|
@@ -159,6 +174,7 @@ export function formatHookCompact(docs, importPath) {
|
|
|
159
174
|
}
|
|
160
175
|
|
|
161
176
|
// Related components (compact footer)
|
|
177
|
+
/** @type {string[]} */
|
|
162
178
|
const relatedParts = [];
|
|
163
179
|
if (docs.relatedComponents?.length) {
|
|
164
180
|
relatedParts.push(`Components: ${docs.relatedComponents.join(', ')}`);
|
|
@@ -181,8 +197,11 @@ export function formatHookCompact(docs, importPath) {
|
|
|
181
197
|
* signature ← from 'import/path'
|
|
182
198
|
* description
|
|
183
199
|
* key params
|
|
200
|
+
* @param {any} docs
|
|
201
|
+
* @returns {string}
|
|
184
202
|
*/
|
|
185
203
|
export function formatHookBrief(docs) {
|
|
204
|
+
/** @type {string[]} */
|
|
186
205
|
const output = [];
|
|
187
206
|
|
|
188
207
|
// Signature line with import hint (matches component brief)
|
|
@@ -204,8 +223,8 @@ export function formatHookBrief(docs) {
|
|
|
204
223
|
|
|
205
224
|
// Key params (matches component brief 'prop · prop' line)
|
|
206
225
|
const paramNames = (docs.params || [])
|
|
207
|
-
.filter(p => !p.name.includes('.'))
|
|
208
|
-
.map(p => p.required ? `${p.name}: ${p.type.split('|')[0].trim()}` : p.name);
|
|
226
|
+
.filter((/** @type {any} */ p) => !p.name.includes('.'))
|
|
227
|
+
.map((/** @type {any} */ p) => p.required ? `${p.name}: ${p.type.split('|')[0].trim()}` : p.name);
|
|
209
228
|
if (paramNames.length > 0) {
|
|
210
229
|
output.push(` ${paramNames.join(' \u00b7 ')}`);
|
|
211
230
|
}
|
|
@@ -216,9 +235,12 @@ export function formatHookBrief(docs) {
|
|
|
216
235
|
/**
|
|
217
236
|
* Format brief summaries for ALL hooks in one output.
|
|
218
237
|
* Matches component formatBriefAll: group headers with ##.
|
|
238
|
+
* @param {string} coreDir
|
|
239
|
+
* @returns {Promise<string>}
|
|
219
240
|
*/
|
|
220
241
|
export async function formatHookBriefAll(coreDir) {
|
|
221
242
|
const hooks = discoverHooks(coreDir);
|
|
243
|
+
/** @type {string[]} */
|
|
222
244
|
const output = [];
|
|
223
245
|
|
|
224
246
|
for (const [category, hookNames] of Object.entries(hooks)) {
|
|
@@ -243,6 +265,8 @@ export async function formatHookBriefAll(coreDir) {
|
|
|
243
265
|
|
|
244
266
|
/**
|
|
245
267
|
* Format only the parameters table (matches component formatProps).
|
|
268
|
+
* @param {any} docs
|
|
269
|
+
* @returns {string}
|
|
246
270
|
*/
|
|
247
271
|
export function formatHookParams(docs) {
|
|
248
272
|
if (docs.params?.length) {
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* ADDS a one-line nudge.
|
|
20
20
|
*/
|
|
21
21
|
|
|
22
|
-
import {validateLoadedIntegration} from '../api/validate-integration.mjs';
|
|
22
|
+
import {validateLoadedIntegration} from '../api/integration/validate-integration.mjs';
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* For each configured (already-loaded) integration, compute its issues using
|
|
@@ -28,7 +28,7 @@ import {validateLoadedIntegration} from '../api/validate-integration.mjs';
|
|
|
28
28
|
*
|
|
29
29
|
* Warning: <pkg> has N integration issue(s). Run: astryx validate-integration <pkg>
|
|
30
30
|
*
|
|
31
|
-
* @param {Array<
|
|
31
|
+
* @param {Array<import('./integrations.mjs').LoadedIntegration>} loadedIntegrations the Project's loaded integrations
|
|
32
32
|
* @param {{json?: boolean}} [options]
|
|
33
33
|
* @returns {Promise<void>}
|
|
34
34
|
*/
|
|
@@ -15,6 +15,23 @@ import * as path from 'node:path';
|
|
|
15
15
|
import {AstryxIntegrationSchema} from './config-schema.mjs';
|
|
16
16
|
import {loadModuleWithSchema, findPresentFiles} from './module-loader.mjs';
|
|
17
17
|
|
|
18
|
+
/**
|
|
19
|
+
* A fully-resolved, loaded integration. Identity (`name`, `version`) comes from
|
|
20
|
+
* the package's package.json; the `components`/`templates`/`codemods` roots are
|
|
21
|
+
* absolute paths resolved from the manifest. The `__`-prefixed fields are
|
|
22
|
+
* internal bookkeeping used by validate-integration and Project.
|
|
23
|
+
* @typedef {object} LoadedIntegration
|
|
24
|
+
* @property {string} name
|
|
25
|
+
* @property {string} [version]
|
|
26
|
+
* @property {string} [components]
|
|
27
|
+
* @property {string} [templates]
|
|
28
|
+
* @property {string} [codemods]
|
|
29
|
+
* @property {string} [issuesUrl]
|
|
30
|
+
* @property {string} __spec
|
|
31
|
+
* @property {string} __packageDir
|
|
32
|
+
* @property {string} __manifestFile
|
|
33
|
+
*/
|
|
34
|
+
|
|
18
35
|
/** Conventional manifest basenames, in load-precedence order. */
|
|
19
36
|
export const MANIFEST_BASENAMES = [
|
|
20
37
|
'astryx.integration.ts',
|
|
@@ -85,8 +102,10 @@ function resolveManifestPath(packageDir, spec) {
|
|
|
85
102
|
*
|
|
86
103
|
* @param {string[]} [specs] package names
|
|
87
104
|
* @param {{cwd?: string}} [options]
|
|
105
|
+
* @returns {Promise<LoadedIntegration[]>}
|
|
88
106
|
*/
|
|
89
107
|
export async function loadIntegrations(specs = [], {cwd = process.cwd()} = {}) {
|
|
108
|
+
/** @type {LoadedIntegration[]} */
|
|
90
109
|
const integrations = [];
|
|
91
110
|
const seen = new Set();
|
|
92
111
|
|
|
@@ -112,6 +131,7 @@ export async function loadIntegrations(specs = [], {cwd = process.cwd()} = {}) {
|
|
|
112
131
|
{label: `Integration ${spec}`},
|
|
113
132
|
);
|
|
114
133
|
|
|
134
|
+
/** @param {string | null | undefined} value */
|
|
115
135
|
const resolveRoot = value =>
|
|
116
136
|
value == null ? undefined : path.resolve(packageDir, value);
|
|
117
137
|
|
|
@@ -5,7 +5,7 @@ import * as fs from 'node:fs';
|
|
|
5
5
|
import * as path from 'node:path';
|
|
6
6
|
import {Project} from './project.mjs';
|
|
7
7
|
import {loadIntegrations} from './integrations.mjs';
|
|
8
|
-
import {discover} from '../api/discover.mjs';
|
|
8
|
+
import {discover} from '../api/discover/discover.mjs';
|
|
9
9
|
|
|
10
10
|
let tmpDir;
|
|
11
11
|
let originalCwd;
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
} from './json.mjs';
|
|
28
28
|
|
|
29
29
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
const CLI = path.resolve(__dirname, '..', '
|
|
30
|
+
const CLI = path.resolve(__dirname, '..', 'bin', 'astryx.mjs');
|
|
31
31
|
|
|
32
32
|
function runCli(args) {
|
|
33
33
|
return spawnSync(process.execPath, [CLI, ...args], {
|
|
@@ -65,6 +65,7 @@ function jsonActive() {
|
|
|
65
65
|
export function buildHelpEnvelope(cmd) {
|
|
66
66
|
// Reconstruct the fully-qualified command name (e.g. "astryx theme build").
|
|
67
67
|
const nameParts = [];
|
|
68
|
+
/** @type {import('commander').Command | null} */
|
|
68
69
|
let c = cmd;
|
|
69
70
|
while (c) {
|
|
70
71
|
nameParts.unshift(c.name());
|
|
@@ -81,7 +82,7 @@ export function buildHelpEnvelope(cmd) {
|
|
|
81
82
|
});
|
|
82
83
|
|
|
83
84
|
const subcommands = cmd.commands
|
|
84
|
-
.filter((s) => !s._hidden)
|
|
85
|
+
.filter((s) => !(/** @type {any} */ (s))._hidden)
|
|
85
86
|
.map((s) => ({name: s.name(), description: s.description() || ''}));
|
|
86
87
|
|
|
87
88
|
return {
|
|
@@ -227,10 +228,14 @@ let Command_outputHelp_patched = false;
|
|
|
227
228
|
* @param {import('commander').Command} cmd
|
|
228
229
|
*/
|
|
229
230
|
function patchOutputHelp(cmd) {
|
|
230
|
-
|
|
231
|
-
|
|
231
|
+
// Commander instances are monkeypatched at runtime with an internal
|
|
232
|
+
// `__xdsHelpPatched` marker and a replacement `outputHelp`, neither of which
|
|
233
|
+
// is in commander's public types — treat the instance as untyped here.
|
|
234
|
+
const anyCmd = /** @type {any} */ (cmd);
|
|
235
|
+
if (anyCmd.__xdsHelpPatched) return;
|
|
236
|
+
anyCmd.__xdsHelpPatched = true;
|
|
232
237
|
const original = cmd.outputHelp.bind(cmd);
|
|
233
|
-
|
|
238
|
+
anyCmd.outputHelp = function patchedOutputHelp(/** @type {any} */ contextOptions) {
|
|
234
239
|
if (jsonActive()) {
|
|
235
240
|
if (!process.__xdsJsonHandled) {
|
|
236
241
|
process.__xdsJsonHandled = true;
|
|
@@ -254,7 +259,7 @@ function patchPrototype(CommandCtor) {
|
|
|
254
259
|
if (proto.__xdsHelpPatched) return;
|
|
255
260
|
proto.__xdsHelpPatched = true;
|
|
256
261
|
const original = proto.outputHelp;
|
|
257
|
-
proto.outputHelp = function patchedProtoOutputHelp(contextOptions) {
|
|
262
|
+
proto.outputHelp = function patchedProtoOutputHelp(/** @type {any} */ contextOptions) {
|
|
258
263
|
if (jsonActive()) {
|
|
259
264
|
if (!process.__xdsJsonHandled) {
|
|
260
265
|
process.__xdsJsonHandled = true;
|
|
@@ -25,7 +25,7 @@ import * as path from 'node:path';
|
|
|
25
25
|
import {fileURLToPath} from 'node:url';
|
|
26
26
|
|
|
27
27
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
28
|
-
const CLI_BIN = path.resolve(__dirname, '
|
|
28
|
+
const CLI_BIN = path.resolve(__dirname, '../bin/astryx.mjs');
|
|
29
29
|
|
|
30
30
|
function runCli(args) {
|
|
31
31
|
const res = spawnSync('node', [CLI_BIN, ...args], {
|
|
@@ -13,8 +13,14 @@
|
|
|
13
13
|
* @position lib — shared by string-utils.mjs and lib/xle/validate.mjs
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* @param {string} a
|
|
18
|
+
* @param {string} b
|
|
19
|
+
* @returns {number}
|
|
20
|
+
*/
|
|
16
21
|
export function levenshteinDistance(a, b) {
|
|
17
22
|
const m = a.length, n = b.length;
|
|
23
|
+
/** @type {number[][]} */
|
|
18
24
|
const dp = Array.from({length: m + 1}, () => Array(n + 1).fill(0));
|
|
19
25
|
for (let i = 0; i <= m; i++) dp[i][0] = i;
|
|
20
26
|
for (let j = 0; j <= n; j++) dp[0][j] = j;
|
|
@@ -50,6 +50,7 @@ export const RESPONSE_TYPES = {
|
|
|
50
50
|
docs: ['docs.list', 'docs.detail', 'docs.detail.section'],
|
|
51
51
|
discover: ['discover.list', 'discover.detail', 'discover.detail.doc', 'discover.search'],
|
|
52
52
|
search: ['search'],
|
|
53
|
+
build: ['build.help', 'build.kit'],
|
|
53
54
|
swizzle: ['swizzle.list', 'swizzle.copy'],
|
|
54
55
|
template: [
|
|
55
56
|
'template.list',
|
|
@@ -79,6 +80,7 @@ const EXAMPLES = {
|
|
|
79
80
|
docs: ['astryx docs', 'astryx docs spacing --json'],
|
|
80
81
|
discover: ['astryx discover --json'],
|
|
81
82
|
search: ['astryx search modal --json', 'astryx search button --type component --json'],
|
|
83
|
+
build: ['astryx build', 'astryx build "analytics dashboard" --json'],
|
|
82
84
|
swizzle: ['astryx swizzle XDSButton'],
|
|
83
85
|
template: ['astryx template --json', 'astryx template dashboard ./src/app'],
|
|
84
86
|
hook: ['astryx hook', 'astryx hook useToggle --json'],
|
|
@@ -103,7 +105,7 @@ const EXAMPLES = {
|
|
|
103
105
|
* option takes a value (boolean vs string), surfaces `choices` and `default`.
|
|
104
106
|
*
|
|
105
107
|
* @param {import('commander').Option} opt
|
|
106
|
-
* @returns {
|
|
108
|
+
* @returns {import('../types/manifest').ManifestOption}
|
|
107
109
|
*/
|
|
108
110
|
function describeOption(opt) {
|
|
109
111
|
const o = /** @type {any} */ (opt);
|
|
@@ -127,7 +129,7 @@ function describeOption(opt) {
|
|
|
127
129
|
/**
|
|
128
130
|
* Map a Commander positional argument to an arg descriptor.
|
|
129
131
|
* @param {import('commander').Argument} arg
|
|
130
|
-
* @returns {
|
|
132
|
+
* @returns {import('../types/manifest').ManifestArgument}
|
|
131
133
|
*/
|
|
132
134
|
function describeArgument(arg) {
|
|
133
135
|
const a = /** @type {any} */ (arg);
|
|
@@ -163,7 +165,7 @@ function fullName(cmd, root) {
|
|
|
163
165
|
* @param {import('commander').Command} cmd
|
|
164
166
|
* @param {import('commander').Command} root
|
|
165
167
|
* @param {Set<string>} jsonSupported fully-qualified names that support --json
|
|
166
|
-
* @returns {
|
|
168
|
+
* @returns {import('../types/manifest').ManifestCommand | null} null for hidden/internal commands
|
|
167
169
|
*/
|
|
168
170
|
function describeCommand(cmd, root, jsonSupported) {
|
|
169
171
|
const name = fullName(cmd, root);
|
|
@@ -210,7 +212,7 @@ function describeCommand(cmd, root, jsonSupported) {
|
|
|
210
212
|
* command entry doesn't repeat them.
|
|
211
213
|
*
|
|
212
214
|
* @param {import('commander').Command} program
|
|
213
|
-
* @returns {
|
|
215
|
+
* @returns {import('../types/manifest').ManifestOption[]}
|
|
214
216
|
*/
|
|
215
217
|
function describeGlobalOptions(program) {
|
|
216
218
|
const opts = (program.options || []).map(describeOption);
|
|
@@ -233,7 +235,7 @@ function describeGlobalOptions(program) {
|
|
|
233
235
|
* @param {object} [opts]
|
|
234
236
|
* @param {Set<string>} [opts.jsonSupported] the JSON_SUPPORTED allowlist
|
|
235
237
|
* @param {string} [opts.version] CLI version (defaults to program.version())
|
|
236
|
-
* @returns {
|
|
238
|
+
* @returns {import('../types/manifest').CLIManifest} the manifest `data` payload (sans envelope)
|
|
237
239
|
*/
|
|
238
240
|
export function buildManifest(program, opts = {}) {
|
|
239
241
|
const jsonSupported = opts.jsonSupported || new Set();
|
|
@@ -18,11 +18,11 @@ import {describe, it, expect} from 'vitest';
|
|
|
18
18
|
import {spawnSync} from 'node:child_process';
|
|
19
19
|
import * as path from 'node:path';
|
|
20
20
|
import {fileURLToPath} from 'node:url';
|
|
21
|
-
import {program, JSON_SUPPORTED} from '../index.mjs';
|
|
21
|
+
import {program, JSON_SUPPORTED} from '../cli/index.mjs';
|
|
22
22
|
import {buildManifest, RESPONSE_TYPES} from './manifest.mjs';
|
|
23
23
|
|
|
24
24
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
25
|
-
const CLI_BIN = path.resolve(__dirname, '
|
|
25
|
+
const CLI_BIN = path.resolve(__dirname, '../bin/astryx.mjs');
|
|
26
26
|
|
|
27
27
|
const manifest = buildManifest(program, {jsonSupported: JSON_SUPPORTED, version: '0.0.0-test'});
|
|
28
28
|
|
|
@@ -6,9 +6,28 @@
|
|
|
6
6
|
import * as fs from 'node:fs';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* A discovered documentation package (its package.json declares `astryx.docs`).
|
|
11
|
+
* @typedef {object} ScannedPackage
|
|
12
|
+
* @property {string} name
|
|
13
|
+
* @property {string} [version]
|
|
14
|
+
* @property {string} [description]
|
|
15
|
+
* @property {string} [displayName]
|
|
16
|
+
* @property {string} dir
|
|
17
|
+
* @property {Record<string, any>} astryx
|
|
18
|
+
* @property {string} category
|
|
19
|
+
* @property {string} docsDir
|
|
20
|
+
* @property {string[]} components
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} scanDir
|
|
25
|
+
* @returns {ScannedPackage[]}
|
|
26
|
+
*/
|
|
9
27
|
export function scanDirectory(scanDir) {
|
|
10
28
|
if (!fs.existsSync(scanDir)) return [];
|
|
11
29
|
const entries = fs.readdirSync(scanDir, {withFileTypes: true});
|
|
30
|
+
/** @type {ScannedPackage[]} */
|
|
12
31
|
const packages = [];
|
|
13
32
|
for (const entry of entries) {
|
|
14
33
|
if (!entry.isDirectory()) continue;
|
|
@@ -40,7 +59,13 @@ export function scanDirectory(scanDir) {
|
|
|
40
59
|
return packages;
|
|
41
60
|
}
|
|
42
61
|
|
|
62
|
+
/**
|
|
63
|
+
* @param {string[]} packageDirs
|
|
64
|
+
* @param {ScannedPackage[]} [explicitPackages]
|
|
65
|
+
* @returns {ScannedPackage[]}
|
|
66
|
+
*/
|
|
43
67
|
export function scanAllPackages(packageDirs, explicitPackages = []) {
|
|
68
|
+
/** @type {ScannedPackage[]} */
|
|
44
69
|
const all = [];
|
|
45
70
|
const seen = new Set();
|
|
46
71
|
|
|
@@ -62,10 +87,17 @@ export function scanAllPackages(packageDirs, explicitPackages = []) {
|
|
|
62
87
|
return all;
|
|
63
88
|
}
|
|
64
89
|
|
|
90
|
+
/**
|
|
91
|
+
* @param {string} docsDir
|
|
92
|
+
* @returns {string[]}
|
|
93
|
+
*/
|
|
65
94
|
function discoverDocComponents(docsDir) {
|
|
66
95
|
if (!fs.existsSync(docsDir)) return [];
|
|
96
|
+
/** @type {string[]} */
|
|
67
97
|
const components = [];
|
|
98
|
+
/** @param {string} dir */
|
|
68
99
|
function walk(dir) {
|
|
100
|
+
/** @type {import('node:fs').Dirent[]} */
|
|
69
101
|
let entries;
|
|
70
102
|
try {
|
|
71
103
|
entries = fs.readdirSync(dir, {withFileTypes: true});
|
|
@@ -84,6 +116,11 @@ function discoverDocComponents(docsDir) {
|
|
|
84
116
|
return components.sort();
|
|
85
117
|
}
|
|
86
118
|
|
|
119
|
+
/**
|
|
120
|
+
* @param {ScannedPackage[]} packages
|
|
121
|
+
* @param {string} name
|
|
122
|
+
* @returns {{pkg: ScannedPackage, docPath: string, componentName: string} | null}
|
|
123
|
+
*/
|
|
87
124
|
export function findComponentInPackages(packages, name) {
|
|
88
125
|
const lower = name.toLowerCase();
|
|
89
126
|
for (const pkg of packages) {
|
|
@@ -95,9 +132,19 @@ export function findComponentInPackages(packages, name) {
|
|
|
95
132
|
return null;
|
|
96
133
|
}
|
|
97
134
|
|
|
135
|
+
/**
|
|
136
|
+
* @param {string} docsDir
|
|
137
|
+
* @param {string} name
|
|
138
|
+
* @returns {string | null}
|
|
139
|
+
*/
|
|
98
140
|
function findDocFile(docsDir, name) {
|
|
99
141
|
const target = name + '.doc.mjs';
|
|
142
|
+
/**
|
|
143
|
+
* @param {string} dir
|
|
144
|
+
* @returns {string | null}
|
|
145
|
+
*/
|
|
100
146
|
function walk(dir) {
|
|
147
|
+
/** @type {import('node:fs').Dirent[]} */
|
|
101
148
|
let entries;
|
|
102
149
|
try {
|
|
103
150
|
entries = fs.readdirSync(dir, {withFileTypes: true});
|