@astryxdesign/cli 0.6.3-canary.ea2f048 → 0.6.3-canary.f04b501
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 +106 -72
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +4 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +36 -2
- package/api/build/build.type.mjs +25 -4
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/component.doc.mjs +13 -3
- package/api/component/component.mjs +31 -2
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +22 -11
- package/api/component/component.type.mjs +32 -24
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +37 -9
- package/api/discover/discover.doc.mjs +2 -1
- package/api/discover/discover.type.d.mts +4 -4
- package/api/discover/discover.type.mjs +10 -10
- package/api/docs/_adapter.d.mts +32 -24
- package/api/docs/_adapter.mjs +81 -87
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +14 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +44 -20
- package/api/docs/detail/section/section.test.mjs +41 -0
- package/api/docs/docs.d.mts +7 -2
- package/api/docs/docs.doc.mjs +28 -10
- package/api/docs/docs.mjs +16 -9
- package/api/docs/docs.test.mjs +6 -0
- package/api/docs/docs.type.d.mts +40 -3
- package/api/docs/docs.type.mjs +36 -8
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +32 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/integrationDocs.test.mjs +106 -0
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +70 -0
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +404 -0
- package/api/doctor/doctor.test.mjs +522 -1
- package/api/gap-report/gap-report.doc.mjs +8 -4
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +2 -2
- package/api/hook/list/list.mjs +69 -17
- package/api/init/init.doc.mjs +5 -0
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.mjs +23 -10
- package/api/integration/add-contribution.test.mjs +121 -7
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-authoring.type.d.mts +1 -1
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +8 -4
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +2 -1
- package/api/integration/integrationAddDoc.doc.mjs +1 -0
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.mjs +49 -7
- package/api/integration/pack-check.test.mjs +266 -47
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +52 -102
- package/api/integration/validate-integration.test.mjs +176 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +2 -1
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +2 -1
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +3 -10
- package/api/search/search.doc.mjs +6 -1
- package/api/search/search.mjs +31 -14
- package/api/search/search.test.mjs +34 -0
- package/api/search/search.type.d.mts +2 -2
- package/api/search/search.type.mjs +1 -1
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +2 -1
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +3 -1
- package/api/template/template.type.d.mts +6 -6
- package/api/template/template.type.mjs +12 -12
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +84 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.mjs +133 -42
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/build.test.mjs +127 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/palette/generate/generate.mjs +8 -3
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.d.mts +10 -13
- package/api/theme/palette/generate/generator.mjs +15 -4
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +15 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +8 -4
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +5 -1
- package/api/upgrade/_adapter.d.mts +12 -3
- package/api/upgrade/_adapter.mjs +123 -19
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +1 -0
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +7 -4
- package/api/upgrade/upgrade.type.d.mts +9 -5
- package/api/upgrade/upgrade.type.mjs +12 -11
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/runner.mjs +115 -5
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +216 -0
- package/assets/codemods/transforms/next/index.mjs +11 -1
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/codemods/transforms/v0.3.0/__tests__/unwrap-authoring-factories.test.mjs +27 -5
- package/assets/codemods/transforms/v0.3.0/unwrap-authoring-factories.mjs +20 -5
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/docs/README.md +9 -0
- package/assets/docs/authoring.doc.mjs +14 -0
- package/assets/docs/cli-integrations.doc.mjs +78 -20
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/styling-libraries.doc.mjs +1 -1
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/docs/working-with-ai.doc.mjs +1 -1
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaInlineRail.tsx +61 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaOverscrollChaining.tsx +126 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.doc.mjs +15 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaShowcase.tsx +86 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyGroupHeaders.tsx +99 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaStickyPassthrough.tsx +122 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.doc.mjs +14 -0
- package/assets/templates/blocks/components/ScrollableArea/ScrollableAreaTwoAxisBoard.tsx +95 -0
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/assets/templates/themes/butter/butterTheme.doc.mjs +11 -0
- package/assets/templates/themes/chocolate/chocolateTheme.doc.mjs +11 -0
- package/assets/templates/themes/gothic/gothicTheme.doc.mjs +11 -0
- package/assets/templates/themes/matcha/matchaTheme.doc.mjs +11 -0
- package/assets/templates/themes/neutral/neutralTheme.doc.mjs +11 -0
- package/assets/templates/themes/stone/stoneTheme.doc.mjs +11 -0
- package/assets/templates/themes/y2k/y2kTheme.doc.mjs +11 -0
- package/authoring/_shared/contract.ts +22 -0
- package/authoring/codemod/codemod.doc.mjs +7 -2
- package/authoring/codemod/parse.d.mts +8 -8
- package/authoring/codemod/parse.mjs +8 -6
- package/authoring/config/config.doc.mjs +2 -2
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +13 -13
- package/authoring/config/parse.mjs +8 -8
- package/authoring/config/type.ts +18 -6
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +5 -5
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +788 -23
- package/authoring/doctypes/_schema.mjs +492 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +62 -0
- package/authoring/doctypes/base/type.ts +40 -0
- package/authoring/doctypes/command/command.doc.mjs +4 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +4 -3
- package/authoring/doctypes/component/component.doc.mjs +6 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +6 -5
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +4 -2
- package/authoring/doctypes/function/function.doc.mjs +5 -1
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +7 -3
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +5 -4
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +208 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +132 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +165 -0
- package/authoring/doctypes/namespace/type.ts +71 -0
- package/authoring/doctypes/parse.d.mts +22 -18
- package/authoring/doctypes/parse.mjs +22 -12
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +18 -5
- package/authoring/doctypes/reference/type.ts +53 -7
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +4 -4
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +36 -2
- package/authoring/doctypes/template/parse.test.mjs +8 -2
- package/authoring/doctypes/template/template.doc.mjs +7 -3
- package/authoring/doctypes/template/type.ts +5 -2
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +12 -10
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +2 -0
- package/authoring/index.d.ts +51 -17
- package/authoring/index.mjs +3 -1
- package/authoring/integration/integration.doc.mjs +15 -8
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +18 -7
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +5 -5
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +5 -2
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +32 -47
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +2 -7
- package/clients/cli/commands/component-package.test.mjs +46 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +5 -3
- package/clients/cli/commands/discover.mjs +3 -3
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +14 -4
- package/clients/cli/commands/docs.mjs +121 -21
- package/clients/cli/commands/docs.test.mjs +88 -0
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor-integration.test.mjs +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/doctor.mjs +6 -16
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +17 -6
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +20 -9
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +22 -6
- package/clients/cli/commands/integration-authoring.test.mjs +13 -9
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +15 -4
- package/clients/cli/commands/layout-expand.doc.mjs +22 -5
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +3 -3
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +7 -4
- package/clients/cli/commands/search.mjs +17 -7
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/swizzle.doc.mjs +3 -2
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +29 -7
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/theme-add.doc.mjs +4 -3
- package/clients/cli/commands/theme-build.doc.mjs +8 -7
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +9 -5
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +20 -9
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/formatters/index.mjs +162 -1
- package/clients/cli/formatters/index.test.mjs +91 -0
- package/clients/cli/index.mjs +13 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +29 -2
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +69 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +190 -32
- package/foundation/config/project.test.mjs +129 -16
- package/foundation/discovery/authoring-self-docs.d.mts +75 -0
- package/foundation/discovery/authoring-self-docs.mjs +224 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +154 -0
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-discovery.d.mts +1 -1
- package/foundation/discovery/component-discovery.mjs +2 -1
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +12 -4
- package/foundation/discovery/docs-discovery.mjs +214 -98
- package/foundation/discovery/docs-discovery.test.mjs +284 -15
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +98 -0
- package/foundation/discovery/docs-section-key.mjs +221 -0
- package/foundation/discovery/docs-section-key.test.mjs +224 -0
- package/foundation/discovery/template-adapter.d.mts +21 -5
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +321 -66
- package/foundation/discovery/template-adapter.test.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +362 -0
- package/foundation/doc-compiler/compile.mjs +511 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +286 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +22 -0
- package/foundation/doc-compiler/ir.mjs +464 -0
- package/foundation/doc-compiler/lenses.d.mts +33 -0
- package/foundation/doc-compiler/lenses.mjs +127 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +126 -0
- package/foundation/doc-compiler/read.mjs +320 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -45
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integration-warnings.mjs +6 -0
- package/foundation/integrations/integrations.d.mts +49 -2
- package/foundation/integrations/integrations.mjs +81 -8
- package/foundation/integrations/integrations.test.mjs +384 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +114 -10
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.doc.mjs +3 -4
- package/foundation/response/error-codes.mjs +2 -2
- package/foundation/response/error-codes.test.mjs +83 -0
- package/foundation/response/json-contract.test.mjs +57 -17
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +16 -11
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +3 -2
- package/foundation/xle/expand.test.mjs +54 -0
- package/package.json +9 -11
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
|
@@ -56,7 +56,7 @@ export function findClosestComponents(name, components, maxDistance = 3) {
|
|
|
56
56
|
* @returns {Promise<{name: string, score: number, reason: string}[]>}
|
|
57
57
|
*/
|
|
58
58
|
export async function searchComponents(needle, coreDir, components) {
|
|
59
|
-
const {
|
|
59
|
+
const {readDocView} = await import('../doc-compiler/read.mjs');
|
|
60
60
|
const fs = await import('node:fs');
|
|
61
61
|
const path = await import('node:path');
|
|
62
62
|
|
|
@@ -100,8 +100,10 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
100
100
|
// Levenshtein on name
|
|
101
101
|
const dist = levenshteinDistance(term, compLower);
|
|
102
102
|
if (dist === 1) addMatch(comp, 80, 'similar name (distance ' + dist + ')');
|
|
103
|
-
else if (dist === 2)
|
|
104
|
-
|
|
103
|
+
else if (dist === 2)
|
|
104
|
+
addMatch(comp, 40, 'similar name (distance ' + dist + ')');
|
|
105
|
+
else if (dist === 3)
|
|
106
|
+
addMatch(comp, 20, 'similar name (distance ' + dist + ')');
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
// --- Pass 2: Keyword + description matching (async, reads doc files) ---
|
|
@@ -124,15 +126,22 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
124
126
|
for (const entry of entries) {
|
|
125
127
|
if (!entry.isDirectory()) continue;
|
|
126
128
|
const nested = path.join(srcDir, entry.name, comp, comp + '.doc.mjs');
|
|
127
|
-
if (fs.existsSync(nested)) {
|
|
129
|
+
if (fs.existsSync(nested)) {
|
|
130
|
+
docPath = nested;
|
|
131
|
+
break;
|
|
132
|
+
}
|
|
128
133
|
}
|
|
129
134
|
}
|
|
130
135
|
|
|
131
136
|
if (!docPath) continue;
|
|
132
137
|
|
|
133
138
|
try {
|
|
134
|
-
|
|
135
|
-
const docs =
|
|
139
|
+
// Only the legacy `docs` export has ever been indexed here.
|
|
140
|
+
const docs = await readDocView(docPath, {
|
|
141
|
+
root: 'components',
|
|
142
|
+
loader: 'native',
|
|
143
|
+
exports: ['docs'],
|
|
144
|
+
});
|
|
136
145
|
if (!docs) continue;
|
|
137
146
|
|
|
138
147
|
// Keyword matching
|
|
@@ -157,8 +166,10 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
157
166
|
}
|
|
158
167
|
|
|
159
168
|
const dist = levenshteinDistance(term, kwLower);
|
|
160
|
-
if (dist === 1)
|
|
161
|
-
|
|
169
|
+
if (dist === 1)
|
|
170
|
+
addMatch(comp, 70, 'keyword "' + kw + '" (distance ' + dist + ')');
|
|
171
|
+
else if (dist === 2)
|
|
172
|
+
addMatch(comp, 30, 'keyword "' + kw + '" (distance ' + dist + ')');
|
|
162
173
|
}
|
|
163
174
|
}
|
|
164
175
|
|
|
@@ -191,8 +202,9 @@ export async function searchComponents(needle, coreDir, components) {
|
|
|
191
202
|
}
|
|
192
203
|
}
|
|
193
204
|
|
|
194
|
-
const results = Array.from(scored.values())
|
|
195
|
-
|
|
205
|
+
const results = Array.from(scored.values()).sort(
|
|
206
|
+
(a, b) => b.score - a.score || a.name.localeCompare(b.name),
|
|
207
|
+
);
|
|
196
208
|
|
|
197
209
|
return results;
|
|
198
210
|
}
|
|
@@ -20,7 +20,8 @@ import {PAYLOAD_PROPS} from './validate.mjs';
|
|
|
20
20
|
import {mergeImports, renderImport, prepareSpliceModule} from './splice.mjs';
|
|
21
21
|
|
|
22
22
|
const INDENT = ' ';
|
|
23
|
-
|
|
23
|
+
/** The most copies one `*N` repeat expands to. */
|
|
24
|
+
export const MAX_REPEAT = 10000;
|
|
24
25
|
|
|
25
26
|
/** @param {string | null | undefined} text */
|
|
26
27
|
function slugify(text) {
|
|
@@ -642,7 +643,7 @@ class Emitter {
|
|
|
642
643
|
/** @type {import('./xle-ast').XLENode[]} */
|
|
643
644
|
const out = [];
|
|
644
645
|
for (const item of items) {
|
|
645
|
-
const count = item.repeat || 1;
|
|
646
|
+
const count = Math.min(item.repeat || 1, MAX_REPEAT);
|
|
646
647
|
for (let i = 1; i <= count; i++) {
|
|
647
648
|
const clone = count > 1 ? cloneItem(item) : item;
|
|
648
649
|
if (count > 1) {
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Expander tests for the repeat cap. Every path that expands a `*N`
|
|
5
|
+
* repeat — emitted children, table rows, the root count — honours MAX_REPEAT.
|
|
6
|
+
* Uses the real @astryxdesign/core registry.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect, beforeAll} from 'vitest';
|
|
10
|
+
import {parse} from './parse.mjs';
|
|
11
|
+
import {validate} from './validate.mjs';
|
|
12
|
+
import {buildRegistry} from './registry.mjs';
|
|
13
|
+
import {expand, MAX_REPEAT} from './expand.mjs';
|
|
14
|
+
|
|
15
|
+
/** @type {import('./xle-ast').Registry} */
|
|
16
|
+
let registry;
|
|
17
|
+
|
|
18
|
+
// The registry imports every component doc on first use; warm it once.
|
|
19
|
+
beforeAll(async () => {
|
|
20
|
+
registry = /** @type {import('./xle-ast').Registry} */ (
|
|
21
|
+
/** @type {unknown} */ (await buildRegistry())
|
|
22
|
+
);
|
|
23
|
+
}, 120_000);
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @param {string} expression
|
|
27
|
+
* @returns {string}
|
|
28
|
+
*/
|
|
29
|
+
function expandCode(expression) {
|
|
30
|
+
const doc = parse(expression);
|
|
31
|
+
const {errors} = validate(doc, registry, []);
|
|
32
|
+
expect(errors).toEqual([]);
|
|
33
|
+
return expand(doc, registry).code;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* @param {string} code
|
|
38
|
+
* @param {string} component
|
|
39
|
+
*/
|
|
40
|
+
function countOpening(code, component) {
|
|
41
|
+
return (code.match(new RegExp(`<(?:XDS)?${component}\\b`, 'g')) || []).length;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
describe('expand — repeat cap', () => {
|
|
45
|
+
it('caps a repeated child at MAX_REPEAT copies', () => {
|
|
46
|
+
expect(countOpening(expandCode(`V > B*${MAX_REPEAT + 5}`), 'Button')).toBe(MAX_REPEAT);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
it('caps repeated table rows at MAX_REPEAT copies too', () => {
|
|
50
|
+
expect(countOpening(expandCode(`T > TR*${MAX_REPEAT + 5} > TC`), 'TableRow')).toBe(
|
|
51
|
+
MAX_REPEAT,
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astryxdesign/cli",
|
|
3
|
-
"version": "0.6.3-canary.
|
|
3
|
+
"version": "0.6.3-canary.f04b501",
|
|
4
4
|
"displayName": "CLI",
|
|
5
5
|
"description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
|
|
6
6
|
"author": "Meta Open Source",
|
|
@@ -100,11 +100,10 @@
|
|
|
100
100
|
"zod": "^4.4.3"
|
|
101
101
|
},
|
|
102
102
|
"peerDependencies": {
|
|
103
|
-
"@astryxdesign/charts": "0.6.3-canary.
|
|
104
|
-
"@astryxdesign/core": "0.6.3-canary.
|
|
105
|
-
"@astryxdesign/lab": "0.6.3-canary.
|
|
106
|
-
"@astryxdesign/theme-neutral": "0.6.3-canary.
|
|
107
|
-
"gpt-tokenizer": "^3.4.0"
|
|
103
|
+
"@astryxdesign/charts": "0.6.3-canary.f04b501",
|
|
104
|
+
"@astryxdesign/core": "0.6.3-canary.f04b501",
|
|
105
|
+
"@astryxdesign/lab": "0.6.3-canary.f04b501",
|
|
106
|
+
"@astryxdesign/theme-neutral": "0.6.3-canary.f04b501"
|
|
108
107
|
},
|
|
109
108
|
"peerDependenciesMeta": {
|
|
110
109
|
"@astryxdesign/charts": {
|
|
@@ -121,14 +120,13 @@
|
|
|
121
120
|
}
|
|
122
121
|
},
|
|
123
122
|
"devDependencies": {
|
|
124
|
-
"@astryxdesign/charts": "0.6.3-canary.
|
|
125
|
-
"@astryxdesign/core": "0.6.3-canary.
|
|
126
|
-
"@astryxdesign/lab": "0.6.3-canary.
|
|
127
|
-
"@astryxdesign/theme-neutral": "0.6.3-canary.
|
|
123
|
+
"@astryxdesign/charts": "0.6.3-canary.f04b501",
|
|
124
|
+
"@astryxdesign/core": "0.6.3-canary.f04b501",
|
|
125
|
+
"@astryxdesign/lab": "0.6.3-canary.f04b501",
|
|
126
|
+
"@astryxdesign/theme-neutral": "0.6.3-canary.f04b501",
|
|
128
127
|
"@heroicons/react": "^2.2.0",
|
|
129
128
|
"@stylexjs/stylex": "^0.19.0",
|
|
130
129
|
"@types/babel__core": "^7.20.5",
|
|
131
|
-
"gpt-tokenizer": "^3.4.0",
|
|
132
130
|
"lucide-react": "^1.18.0",
|
|
133
131
|
"recharts": "^3.9.2"
|
|
134
132
|
},
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 1,
|
|
3
|
-
"generatedBy": "scripts/generate-cli-themes.mjs",
|
|
4
|
-
"themes": [
|
|
5
|
-
{
|
|
6
|
-
"slug": "butter",
|
|
7
|
-
"displayName": "Butter",
|
|
8
|
-
"description": "Warm, creamy yellows with a friendly blue accent. Playful enough for consumer surfaces, soft enough to stay readable.",
|
|
9
|
-
"maintained": false,
|
|
10
|
-
"entry": "butterTheme.ts",
|
|
11
|
-
"exportName": "butterTheme",
|
|
12
|
-
"files": [
|
|
13
|
-
"butterTheme.ts",
|
|
14
|
-
"icons.tsx"
|
|
15
|
-
]
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
"slug": "chocolate",
|
|
19
|
-
"displayName": "Chocolate",
|
|
20
|
-
"description": "Warm chocolate theme for Astryx — rich brown palette with Fraunces headings, Albert Sans body, and Lucide icons",
|
|
21
|
-
"maintained": false,
|
|
22
|
-
"entry": "chocolateTheme.ts",
|
|
23
|
-
"exportName": "chocolateTheme",
|
|
24
|
-
"files": [
|
|
25
|
-
"chocolateTheme.ts",
|
|
26
|
-
"icons.tsx"
|
|
27
|
-
]
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
"slug": "gothic",
|
|
31
|
-
"displayName": "Gothic",
|
|
32
|
-
"description": "Deep blue-grays and a signature display serif. Dramatic and editorial, for surfaces that want to be remembered.",
|
|
33
|
-
"maintained": false,
|
|
34
|
-
"entry": "gothicTheme.ts",
|
|
35
|
-
"exportName": "gothicTheme",
|
|
36
|
-
"files": [
|
|
37
|
-
"gothicTheme.ts",
|
|
38
|
-
"icons.tsx"
|
|
39
|
-
]
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
"slug": "matcha",
|
|
43
|
-
"displayName": "Matcha",
|
|
44
|
-
"description": "Earthy greens with a calm, organic feel. Naturalistic and grounded, great for wellness or content-first apps.",
|
|
45
|
-
"maintained": false,
|
|
46
|
-
"entry": "matchaTheme.ts",
|
|
47
|
-
"exportName": "matchaTheme",
|
|
48
|
-
"files": [
|
|
49
|
-
"matchaTheme.ts",
|
|
50
|
-
"icons.tsx"
|
|
51
|
-
]
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
"slug": "neutral",
|
|
55
|
-
"displayName": "Neutral",
|
|
56
|
-
"description": "Restrained warm grays. Minimal and quiet, so the content stays the focus.",
|
|
57
|
-
"maintained": true,
|
|
58
|
-
"entry": "neutralTheme.ts",
|
|
59
|
-
"exportName": "neutralTheme",
|
|
60
|
-
"files": [
|
|
61
|
-
"neutralTheme.ts",
|
|
62
|
-
"icons.tsx",
|
|
63
|
-
"neutralPalettes.ts",
|
|
64
|
-
"neutralPalettes.generated.ts",
|
|
65
|
-
"neutralPaletteRefs.generated.ts",
|
|
66
|
-
"neutralPalettes.generated.receipt.json",
|
|
67
|
-
"palette.config.json"
|
|
68
|
-
]
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"slug": "stone",
|
|
72
|
-
"displayName": "Stone",
|
|
73
|
-
"description": "Warm stone and slate, earthy and understated, with just enough character to feel handcrafted.",
|
|
74
|
-
"maintained": false,
|
|
75
|
-
"entry": "stoneTheme.ts",
|
|
76
|
-
"exportName": "stoneTheme",
|
|
77
|
-
"files": [
|
|
78
|
-
"stoneTheme.ts",
|
|
79
|
-
"icons.tsx"
|
|
80
|
-
]
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"slug": "y2k",
|
|
84
|
-
"displayName": "Y2K",
|
|
85
|
-
"description": "Hot pinks, lime greens, and Poppins. Bubbly, playful, and unmistakably retro.",
|
|
86
|
-
"maintained": false,
|
|
87
|
-
"entry": "y2kTheme.ts",
|
|
88
|
-
"exportName": "y2kTheme",
|
|
89
|
-
"files": [
|
|
90
|
-
"y2kTheme.ts",
|
|
91
|
-
"icons.tsx"
|
|
92
|
-
]
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Check for newer @astryxdesign/core versions via local signals.
|
|
5
|
-
*
|
|
6
|
-
* Resolution order:
|
|
7
|
-
* 1. $ASTRYX_LATEST_VERSION env var
|
|
8
|
-
* 2. If unset: no hint (no network calls from this module)
|
|
9
|
-
*
|
|
10
|
-
* When a newer version is detected, returns a hint string for CLI output.
|
|
11
|
-
* Also sets $ASTRYX_LATEST_VERSION for subsequent commands in the same shell.
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
import * as fs from 'node:fs';
|
|
15
|
-
import * as path from 'node:path';
|
|
16
|
-
import {semverGt} from '../../../foundation/env/semver.mjs';
|
|
17
|
-
import {getCliInvocation} from '../../../foundation/env/package-manager.mjs';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Read the latest available version from local signals.
|
|
21
|
-
* No network calls — purely an env-var check ($ASTRYX_LATEST_VERSION),
|
|
22
|
-
* so it takes no arguments.
|
|
23
|
-
*
|
|
24
|
-
* @returns {string|null} Latest version string, or null if unknown
|
|
25
|
-
*/
|
|
26
|
-
export function getLatestVersion() {
|
|
27
|
-
// 1. Check env var (fastest — set by previous CLI run)
|
|
28
|
-
const envVersion = process.env.ASTRYX_LATEST_VERSION;
|
|
29
|
-
if (envVersion && /^\d+\.\d+\.\d+/.test(envVersion)) {
|
|
30
|
-
return envVersion;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return null;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Get the currently installed @astryxdesign/core version from the consumer's package.json.
|
|
38
|
-
*
|
|
39
|
-
* @param {string} [cwd] - Project directory
|
|
40
|
-
* @returns {string|null} Installed version, or null
|
|
41
|
-
*/
|
|
42
|
-
export function getInstalledVersion(cwd = process.cwd()) {
|
|
43
|
-
try {
|
|
44
|
-
const pkgPath = path.resolve(cwd, 'package.json');
|
|
45
|
-
if (!fs.existsSync(pkgPath)) return null;
|
|
46
|
-
|
|
47
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
48
|
-
const deps = {...pkg.dependencies, ...pkg.devDependencies};
|
|
49
|
-
const version = deps['@astryxdesign/core'];
|
|
50
|
-
if (!version) return null;
|
|
51
|
-
|
|
52
|
-
// Strip semver range prefix
|
|
53
|
-
return version.replace(/^[^\d]*/, '');
|
|
54
|
-
} catch {
|
|
55
|
-
return null;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Check for available updates and return a hint string if one exists.
|
|
61
|
-
* Also sets $ASTRYX_LATEST_VERSION env var for subsequent commands.
|
|
62
|
-
*
|
|
63
|
-
* @param {string} [cwd] - Project directory
|
|
64
|
-
* @returns {string|null} FYI hint string, or null if up to date / unknown
|
|
65
|
-
*/
|
|
66
|
-
export function checkForUpdate(cwd = process.cwd()) {
|
|
67
|
-
const latest = getLatestVersion();
|
|
68
|
-
if (!latest) return null;
|
|
69
|
-
|
|
70
|
-
// Persist for subsequent commands in this shell session
|
|
71
|
-
process.env.ASTRYX_LATEST_VERSION = latest;
|
|
72
|
-
|
|
73
|
-
const installed = getInstalledVersion(cwd);
|
|
74
|
-
if (!installed) return null;
|
|
75
|
-
|
|
76
|
-
// Use semver-aware comparison so '0.0.20' is correctly treated as greater
|
|
77
|
-
// than '0.0.5' (lexicographic compare gets that backwards).
|
|
78
|
-
if (semverGt(latest, installed)) {
|
|
79
|
-
return `FYI: A newer version of @astryxdesign/core (${latest}) is available. Install the new package version, then run: ${getCliInvocation()} upgrade --from <old-version> --apply`;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
return null;
|
|
83
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
import {describe, it, expect, beforeEach, afterEach} from 'vitest';
|
|
4
|
-
import * as fs from 'node:fs';
|
|
5
|
-
import * as path from 'node:path';
|
|
6
|
-
import * as os from 'node:os';
|
|
7
|
-
import {
|
|
8
|
-
getLatestVersion,
|
|
9
|
-
getInstalledVersion,
|
|
10
|
-
checkForUpdate,
|
|
11
|
-
} from './update-check.mjs';
|
|
12
|
-
|
|
13
|
-
let tmpDir;
|
|
14
|
-
const originalEnv = {};
|
|
15
|
-
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-update-check-'));
|
|
18
|
-
// Save and clear env
|
|
19
|
-
originalEnv.ASTRYX_LATEST_VERSION = process.env.ASTRYX_LATEST_VERSION;
|
|
20
|
-
delete process.env.ASTRYX_LATEST_VERSION;
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
afterEach(() => {
|
|
24
|
-
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
25
|
-
// Restore env
|
|
26
|
-
if (originalEnv.ASTRYX_LATEST_VERSION !== undefined) {
|
|
27
|
-
process.env.ASTRYX_LATEST_VERSION = originalEnv.ASTRYX_LATEST_VERSION;
|
|
28
|
-
} else {
|
|
29
|
-
delete process.env.ASTRYX_LATEST_VERSION;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
describe('getLatestVersion', () => {
|
|
34
|
-
it('reads from ASTRYX_LATEST_VERSION env var', () => {
|
|
35
|
-
process.env.ASTRYX_LATEST_VERSION = '0.0.8';
|
|
36
|
-
expect(getLatestVersion()).toBe('0.0.8');
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('ignores invalid env var values', () => {
|
|
40
|
-
process.env.ASTRYX_LATEST_VERSION = 'not-a-version';
|
|
41
|
-
expect(getLatestVersion()).toBeNull();
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
it('returns null when no signals exist', () => {
|
|
45
|
-
fs.writeFileSync(
|
|
46
|
-
path.join(tmpDir, 'package.json'),
|
|
47
|
-
JSON.stringify({name: 'test'}),
|
|
48
|
-
);
|
|
49
|
-
expect(getLatestVersion()).toBeNull();
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
describe('getInstalledVersion', () => {
|
|
54
|
-
it('reads @astryxdesign/core version from dependencies', () => {
|
|
55
|
-
fs.writeFileSync(
|
|
56
|
-
path.join(tmpDir, 'package.json'),
|
|
57
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.7'}}),
|
|
58
|
-
);
|
|
59
|
-
expect(getInstalledVersion(tmpDir)).toBe('0.0.7');
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
it('strips semver range prefix', () => {
|
|
63
|
-
fs.writeFileSync(
|
|
64
|
-
path.join(tmpDir, 'package.json'),
|
|
65
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '~0.0.5'}}),
|
|
66
|
-
);
|
|
67
|
-
expect(getInstalledVersion(tmpDir)).toBe('0.0.5');
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
it('returns null when @astryxdesign/core is not a dependency', () => {
|
|
71
|
-
fs.writeFileSync(
|
|
72
|
-
path.join(tmpDir, 'package.json'),
|
|
73
|
-
JSON.stringify({dependencies: {react: '^19.0.0'}}),
|
|
74
|
-
);
|
|
75
|
-
expect(getInstalledVersion(tmpDir)).toBeNull();
|
|
76
|
-
});
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
describe('checkForUpdate', () => {
|
|
80
|
-
it('returns hint when newer version is available', () => {
|
|
81
|
-
process.env.ASTRYX_LATEST_VERSION = '0.0.8';
|
|
82
|
-
fs.writeFileSync(
|
|
83
|
-
path.join(tmpDir, 'package.json'),
|
|
84
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.7'}}),
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
const hint = checkForUpdate(tmpDir);
|
|
88
|
-
expect(hint).toContain('0.0.8');
|
|
89
|
-
expect(hint).toContain('astryx upgrade --from <old-version> --apply');
|
|
90
|
-
expect(hint).toContain('FYI');
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
it('returns null when up to date', () => {
|
|
94
|
-
process.env.ASTRYX_LATEST_VERSION = '0.0.7';
|
|
95
|
-
fs.writeFileSync(
|
|
96
|
-
path.join(tmpDir, 'package.json'),
|
|
97
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.7'}}),
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
expect(checkForUpdate(tmpDir)).toBeNull();
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
it('returns null when no latest version is known', () => {
|
|
104
|
-
fs.writeFileSync(
|
|
105
|
-
path.join(tmpDir, 'package.json'),
|
|
106
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.7'}}),
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
expect(checkForUpdate(tmpDir)).toBeNull();
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('uses semver (not lexicographic) comparison for double-digit patches', () => {
|
|
113
|
-
// Regression: with string compare, '0.0.20' > '0.0.5' is false because
|
|
114
|
-
// '2' < '5' lexicographically. Users on 0.0.5 would never be told that
|
|
115
|
-
// 0.0.20 is available.
|
|
116
|
-
process.env.ASTRYX_LATEST_VERSION = '0.0.20';
|
|
117
|
-
fs.writeFileSync(
|
|
118
|
-
path.join(tmpDir, 'package.json'),
|
|
119
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.5'}}),
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
const hint = checkForUpdate(tmpDir);
|
|
123
|
-
expect(hint).toContain('0.0.20');
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
it('does not suggest an upgrade when latest < installed (semver)', () => {
|
|
127
|
-
// The mirror-image bug: '0.0.9' > '0.0.10' is true under string compare,
|
|
128
|
-
// so a stale env hint of 0.0.9 would falsely claim it's "newer" than 0.0.10.
|
|
129
|
-
process.env.ASTRYX_LATEST_VERSION = '0.0.9';
|
|
130
|
-
fs.writeFileSync(
|
|
131
|
-
path.join(tmpDir, 'package.json'),
|
|
132
|
-
JSON.stringify({dependencies: {'@astryxdesign/core': '^0.0.10'}}),
|
|
133
|
-
);
|
|
134
|
-
|
|
135
|
-
expect(checkForUpdate(tmpDir)).toBeNull();
|
|
136
|
-
});
|
|
137
|
-
});
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* @file Guards the update-hint command allowlist.
|
|
5
|
-
*
|
|
6
|
-
* The post-action update hint only fires for a small set of commands
|
|
7
|
-
* (see UPDATE_HINT_COMMANDS in index.mjs). Every name in that set must
|
|
8
|
-
* map to a real, registered command — otherwise the entry is dead and
|
|
9
|
-
* the hint can never fire for it. This test imports the assembled
|
|
10
|
-
* program and verifies the invariant so a stale reference can't creep in.
|
|
11
|
-
*
|
|
12
|
-
* Historically there was a dead 'doctor' entry in UPDATE_HINT_COMMANDS that
|
|
13
|
-
* referenced a command that didn't exist. `doctor` is now a real command
|
|
14
|
-
* (the health check), but it is intentionally NOT in the update-hint set —
|
|
15
|
-
* the hint is for content commands (component/docs) that agents read, not
|
|
16
|
-
* for the diagnostic command. This test pins both invariants.
|
|
17
|
-
*/
|
|
18
|
-
|
|
19
|
-
import {describe, it, expect} from 'vitest';
|
|
20
|
-
import {program} from './index.mjs';
|
|
21
|
-
|
|
22
|
-
/** Commands the update hint is expected to fire for. */
|
|
23
|
-
const HINTED_COMMANDS = ['component', 'docs'];
|
|
24
|
-
|
|
25
|
-
/** Real commands that must NOT trigger the update hint. */
|
|
26
|
-
const NON_HINTED_COMMANDS = ['doctor'];
|
|
27
|
-
|
|
28
|
-
function registeredCommandNames() {
|
|
29
|
-
return program.commands.map((c) => c.name());
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
describe('update hint commands', () => {
|
|
33
|
-
it('fires only for real, registered commands', () => {
|
|
34
|
-
const registered = new Set(registeredCommandNames());
|
|
35
|
-
for (const name of HINTED_COMMANDS) {
|
|
36
|
-
expect(registered.has(name)).toBe(true);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('registers the real "doctor" command', () => {
|
|
41
|
-
const registered = new Set(registeredCommandNames());
|
|
42
|
-
expect(registered.has('doctor')).toBe(true);
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
it('does not fire the update hint for the doctor command', () => {
|
|
46
|
-
// UPDATE_HINT_COMMANDS is intentionally limited to content commands.
|
|
47
|
-
// Doctor is a diagnostic; its output should not carry an update hint.
|
|
48
|
-
expect(NON_HINTED_COMMANDS).not.toContain('component');
|
|
49
|
-
expect(NON_HINTED_COMMANDS).not.toContain('docs');
|
|
50
|
-
for (const name of NON_HINTED_COMMANDS) {
|
|
51
|
-
expect(HINTED_COMMANDS).not.toContain(name);
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
});
|