@astryxdesign/cli 0.6.3-canary.98a2e4e → 0.6.3-canary.9dbb6c1
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 -73
- 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 +28 -30
- package/api/docs/_adapter.mjs +73 -135
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.d.mts +0 -15
- package/api/docs/detail/detail.mjs +14 -78
- package/api/docs/detail/section/section.mjs +22 -18
- package/api/docs/detail/section/section.test.mjs +4 -3
- package/api/docs/docs.doc.mjs +1 -0
- package/api/docs/docs.type.d.mts +4 -4
- package/api/docs/docs.type.mjs +10 -10
- package/api/docs/index/index.mjs +6 -5
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +25 -3
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +186 -18
- package/api/doctor/doctor.test.mjs +326 -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 +1 -1
- 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-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 +2 -9
- 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 +1 -1
- 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.doc.mjs +3 -1
- package/api/template/template.type.d.mts +5 -5
- 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 +108 -70
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -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 +3 -1
- package/api/upgrade/upgrade.type.d.mts +8 -4
- package/api/upgrade/upgrade.type.mjs +11 -10
- 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/cli-integrations.doc.mjs +26 -30
- 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 +4 -4
- package/authoring/debug/parse.mjs +3 -3
- package/authoring/doctypes/_schema.d.mts +121 -11
- package/authoring/doctypes/_schema.mjs +144 -13
- package/authoring/doctypes/base/graph-fields.doc.mjs +11 -4
- package/authoring/doctypes/base/type.ts +8 -4
- 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 +3 -3
- package/authoring/doctypes/component/component.doc.mjs +5 -2
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +3 -3
- 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 +2 -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 +2 -2
- 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 +3 -3
- package/authoring/doctypes/legacy.d.mts +6 -6
- package/authoring/doctypes/legacy.mjs +3 -3
- package/authoring/doctypes/load-contract.test.mjs +208 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +7 -3
- package/authoring/doctypes/namespace/parse.d.mts +2 -2
- package/authoring/doctypes/namespace/parse.mjs +1 -1
- package/authoring/doctypes/namespace/type.ts +2 -2
- package/authoring/doctypes/parse.d.mts +22 -20
- package/authoring/doctypes/parse.mjs +16 -12
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +1 -1
- package/authoring/doctypes/reference/reference.doc.mjs +7 -3
- package/authoring/doctypes/reference/type.ts +3 -3
- 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 +3 -4
- package/authoring/doctypes/template/parse.d.mts +92 -1
- package/authoring/doctypes/template/parse.mjs +33 -1
- package/authoring/doctypes/template/template.doc.mjs +7 -3
- package/authoring/doctypes/template/type.ts +4 -1
- 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 -11
- 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 +9 -9
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.mjs +3 -2
- package/authoring/identity/type.ts +10 -10
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +21 -19
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/schema.d.mts +4 -4
- package/authoring/integration/schema.mjs +3 -3
- package/authoring/integration/type.ts +4 -10
- 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 +1 -1
- 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 +3 -3
- 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 +18 -7
- 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/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 +22 -0
- 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 +173 -30
- package/foundation/config/project.test.mjs +129 -16
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-self-docs.test.mjs +71 -12
- 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-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +7 -2
- package/foundation/discovery/docs-discovery.mjs +24 -14
- package/foundation/discovery/docs-discovery.test.mjs +55 -16
- 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 +319 -65
- 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/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -52
- 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/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- 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.mjs +104 -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 +11 -0
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +11 -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
|
@@ -104,13 +104,14 @@ export function ensureCodemodDeps({ installDeps }?: {
|
|
|
104
104
|
* Run the CORE registry codemods. Runs BEFORE the config is loaded so a core
|
|
105
105
|
* CONFIG codemod can repair a config the strict loader would otherwise reject.
|
|
106
106
|
* @param {CoreVersionManifest[]} versionManifests
|
|
107
|
-
* @param {{apply: boolean, path: string, codemod?: string, skipCodemods: Set<string
|
|
107
|
+
* @param {{apply: boolean, path: string, codemod?: string, skipCodemods: Set<string>, root?: string}} options
|
|
108
108
|
*/
|
|
109
|
-
export function runCoreCodemods(versionManifests: CoreVersionManifest[], { apply, path: srcPath, codemod, skipCodemods }: {
|
|
109
|
+
export function runCoreCodemods(versionManifests: CoreVersionManifest[], { apply, path: srcPath, codemod, skipCodemods, root }: {
|
|
110
110
|
apply: boolean;
|
|
111
111
|
path: string;
|
|
112
112
|
codemod?: string;
|
|
113
113
|
skipCodemods: Set<string>;
|
|
114
|
+
root?: string;
|
|
114
115
|
}): Promise<{
|
|
115
116
|
totalFilesChanged: number;
|
|
116
117
|
totalTransformsApplied: number;
|
|
@@ -139,13 +140,21 @@ export function runCoreCodemods(versionManifests: CoreVersionManifest[], { apply
|
|
|
139
140
|
/**
|
|
140
141
|
* Load the consumer project's config + integrations. Throws on invalid config;
|
|
141
142
|
* the run leaf decides between the config_fixable preview and a hard abort.
|
|
143
|
+
*
|
|
144
|
+
* Provider identity is resolved by the same resolver Project uses, on top of
|
|
145
|
+
* Project's ledger, under the codemod policy: a package that lists itself runs
|
|
146
|
+
* its installed copy's released codemods, never the work in progress being
|
|
147
|
+
* authored, and autolinked and local packages claim provider IDs without
|
|
148
|
+
* running codemods.
|
|
149
|
+
*
|
|
142
150
|
* @param {string} cwd
|
|
143
151
|
* @param {string[]} [extraIntegrationSpecs] explicit `--integration` specs
|
|
144
|
-
* @returns {Promise<{postCodemodHooks: import('../../authoring/config/type').PostCodemodHook[], integrations: import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]}>}
|
|
152
|
+
* @returns {Promise<{postCodemodHooks: import('../../authoring/config/type').PostCodemodHook[], integrations: import('../../foundation/integrations/integrations.mjs').LoadedIntegration[], ledger: import('../../foundation/integrations/provider-resolution.mjs').ProviderLedger}>}
|
|
145
153
|
*/
|
|
146
154
|
export function loadProjectContext(cwd: string, extraIntegrationSpecs?: string[]): Promise<{
|
|
147
155
|
postCodemodHooks: import("../../authoring/config/type").PostCodemodHook[];
|
|
148
156
|
integrations: import("../../foundation/integrations/integrations.mjs").LoadedIntegration[];
|
|
157
|
+
ledger: import("../../foundation/integrations/provider-resolution.mjs").ProviderLedger;
|
|
149
158
|
}>;
|
|
150
159
|
/**
|
|
151
160
|
* Non-blocking nudge for integration validation issues. Never throws (a broken
|
package/api/upgrade/_adapter.mjs
CHANGED
|
@@ -19,7 +19,10 @@ import * as path from 'node:path';
|
|
|
19
19
|
import {execFile} from 'node:child_process';
|
|
20
20
|
import {promisify} from 'node:util';
|
|
21
21
|
import {ensureJscodeshift} from '../../assets/codemods/ensure-jscodeshift.mjs';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
getTransformsBetween,
|
|
24
|
+
latestVersion,
|
|
25
|
+
} from '../../assets/codemods/registry.mjs';
|
|
23
26
|
import {runCodemods} from '../../assets/codemods/runner.mjs';
|
|
24
27
|
import {
|
|
25
28
|
discoverIntegrationCodemods,
|
|
@@ -32,17 +35,15 @@ import {
|
|
|
32
35
|
renderAgentDocsBlock,
|
|
33
36
|
} from '../../foundation/agent-docs/agent-docs.mjs';
|
|
34
37
|
import {formatCliCommand} from '../../foundation/env/package-manager.mjs';
|
|
35
|
-
import {Project} from '../../foundation/config/project.mjs';
|
|
36
|
-
import {
|
|
37
|
-
|
|
38
|
-
markProviderConflicts,
|
|
39
|
-
} from '../../foundation/integrations/integrations.mjs';
|
|
38
|
+
import {Project, providerLedgerOf} from '../../foundation/config/project.mjs';
|
|
39
|
+
import {loadIntegrations} from '../../foundation/integrations/integrations.mjs';
|
|
40
|
+
import {resolveProviders} from '../../foundation/integrations/provider-resolution.mjs';
|
|
40
41
|
import {warnOnIntegrationIssues} from '../../foundation/integrations/integration-warnings.mjs';
|
|
41
42
|
import {logger} from '../logger.mjs';
|
|
42
43
|
|
|
43
44
|
// Re-exported for the run leaf's lightweight agent-docs inspection path
|
|
44
45
|
// (config_fixable short-circuit, where the full render cannot load config).
|
|
45
|
-
export {
|
|
46
|
+
export {inspectAgentDocs};
|
|
46
47
|
|
|
47
48
|
const execFileAsync = promisify(execFile);
|
|
48
49
|
|
|
@@ -104,6 +105,27 @@ export function uniqueFiles(files) {
|
|
|
104
105
|
];
|
|
105
106
|
}
|
|
106
107
|
|
|
108
|
+
/**
|
|
109
|
+
* Run app code with its stdout writes sent to stderr. Stdout carries only the
|
|
110
|
+
* command's own output, so a hook that prints cannot corrupt `--json`.
|
|
111
|
+
* @template T
|
|
112
|
+
* @param {() => T | Promise<T>} fn
|
|
113
|
+
* @returns {Promise<T>}
|
|
114
|
+
*/
|
|
115
|
+
async function withStdoutOnStderr(fn) {
|
|
116
|
+
const realWrite = process.stdout.write;
|
|
117
|
+
process.stdout.write = /** @type {any} */ (
|
|
118
|
+
function (/** @type {any} */ chunk, /** @type {any[]} */ ...rest) {
|
|
119
|
+
return process.stderr.write(chunk, ...rest);
|
|
120
|
+
}
|
|
121
|
+
);
|
|
122
|
+
try {
|
|
123
|
+
return await fn();
|
|
124
|
+
} finally {
|
|
125
|
+
process.stdout.write = realWrite;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
107
129
|
/**
|
|
108
130
|
* Run the app config's post-codemod hooks (config.hooks.postCodemod).
|
|
109
131
|
* Dry-run PREVIEWS (buildCommand still called, so a throw fails); apply executes.
|
|
@@ -123,7 +145,9 @@ export async function runPostCodemodHooks(hooks, context) {
|
|
|
123
145
|
);
|
|
124
146
|
}
|
|
125
147
|
|
|
126
|
-
const cmd = await
|
|
148
|
+
const cmd = await withStdoutOnStderr(() =>
|
|
149
|
+
hook.buildCommand({packageDir, files}),
|
|
150
|
+
);
|
|
127
151
|
if (!cmd) {
|
|
128
152
|
logger.log(`Post-codemod hook ${label} produced no command; skipping.`);
|
|
129
153
|
continue;
|
|
@@ -147,7 +171,7 @@ export async function runPostCodemodHooks(hooks, context) {
|
|
|
147
171
|
env: {...process.env, ...(cmd.options?.env ?? {})},
|
|
148
172
|
}),
|
|
149
173
|
);
|
|
150
|
-
logger.log(
|
|
174
|
+
logger.log(`[ok] Post-codemod hook ${label} completed.`);
|
|
151
175
|
}
|
|
152
176
|
}
|
|
153
177
|
|
|
@@ -186,7 +210,7 @@ export async function prepareAgentDocsRefresh({
|
|
|
186
210
|
if (initial.status === 'missing') {
|
|
187
211
|
summary.action = 'nudge-init';
|
|
188
212
|
logger.warn(
|
|
189
|
-
`No Astryx agent-docs block found
|
|
213
|
+
`No Astryx agent-docs block found - AI agents have no component index. Run \`${formatCliCommand('astryx init --features agents')}\` to install it.`,
|
|
190
214
|
);
|
|
191
215
|
return {cwd, renderedBlock: null, summary};
|
|
192
216
|
}
|
|
@@ -240,7 +264,7 @@ export function applyAgentDocsRefresh(plan) {
|
|
|
240
264
|
summary.files = written;
|
|
241
265
|
summary.action = summary.refreshed ? 'refreshed' : 'error';
|
|
242
266
|
if (summary.refreshed) {
|
|
243
|
-
logger.log(
|
|
267
|
+
logger.log(`[ok] Agent docs refreshed -> ${written.join(', ')}`);
|
|
244
268
|
} else {
|
|
245
269
|
logger.warn(
|
|
246
270
|
`Agent docs look stale but couldn't be refreshed. Run \`${formatCliCommand('astryx init --features agents')}\` to reinstall the block.`,
|
|
@@ -268,7 +292,13 @@ export async function collectAllCodemods() {
|
|
|
268
292
|
);
|
|
269
293
|
for (const {version, transforms} of manifests) {
|
|
270
294
|
for (const {name, meta, optional} of transforms) {
|
|
271
|
-
codemods.push({
|
|
295
|
+
codemods.push({
|
|
296
|
+
name,
|
|
297
|
+
title: meta.title,
|
|
298
|
+
version,
|
|
299
|
+
pr: meta.pr,
|
|
300
|
+
optional: !!optional,
|
|
301
|
+
});
|
|
272
302
|
}
|
|
273
303
|
}
|
|
274
304
|
return codemods;
|
|
@@ -299,33 +329,35 @@ export async function ensureCodemodDeps({installDeps} = {}) {
|
|
|
299
329
|
* Run the CORE registry codemods. Runs BEFORE the config is loaded so a core
|
|
300
330
|
* CONFIG codemod can repair a config the strict loader would otherwise reject.
|
|
301
331
|
* @param {CoreVersionManifest[]} versionManifests
|
|
302
|
-
* @param {{apply: boolean, path: string, codemod?: string, skipCodemods: Set<string
|
|
332
|
+
* @param {{apply: boolean, path: string, codemod?: string, skipCodemods: Set<string>, root?: string}} options
|
|
303
333
|
*/
|
|
304
|
-
export async function runCoreCodemods(
|
|
334
|
+
export async function runCoreCodemods(
|
|
335
|
+
versionManifests,
|
|
336
|
+
{apply, path: srcPath, codemod, skipCodemods, root},
|
|
337
|
+
) {
|
|
305
338
|
return runCodemods(versionManifests, {
|
|
306
339
|
apply,
|
|
307
340
|
path: srcPath,
|
|
308
341
|
codemod,
|
|
309
342
|
skipCodemods,
|
|
310
343
|
silent: logger.silent,
|
|
344
|
+
root,
|
|
311
345
|
});
|
|
312
346
|
}
|
|
313
347
|
|
|
314
|
-
/**
|
|
315
|
-
* One installed package at one version; two specs that reach it share this.
|
|
316
|
-
* @param {{name: string, version?: string}} integration
|
|
317
|
-
* @returns {string}
|
|
318
|
-
*/
|
|
319
|
-
function packageIdentity(integration) {
|
|
320
|
-
return `${integration.name}\u0000${integration.version ?? ''}`;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
348
|
/**
|
|
324
349
|
* Load the consumer project's config + integrations. Throws on invalid config;
|
|
325
350
|
* the run leaf decides between the config_fixable preview and a hard abort.
|
|
351
|
+
*
|
|
352
|
+
* Provider identity is resolved by the same resolver Project uses, on top of
|
|
353
|
+
* Project's ledger, under the codemod policy: a package that lists itself runs
|
|
354
|
+
* its installed copy's released codemods, never the work in progress being
|
|
355
|
+
* authored, and autolinked and local packages claim provider IDs without
|
|
356
|
+
* running codemods.
|
|
357
|
+
*
|
|
326
358
|
* @param {string} cwd
|
|
327
359
|
* @param {string[]} [extraIntegrationSpecs] explicit `--integration` specs
|
|
328
|
-
* @returns {Promise<{postCodemodHooks: import('../../authoring/config/type').PostCodemodHook[], integrations: import('../../foundation/integrations/integrations.mjs').LoadedIntegration[]}>}
|
|
360
|
+
* @returns {Promise<{postCodemodHooks: import('../../authoring/config/type').PostCodemodHook[], integrations: import('../../foundation/integrations/integrations.mjs').LoadedIntegration[], ledger: import('../../foundation/integrations/provider-resolution.mjs').ProviderLedger}>}
|
|
329
361
|
*/
|
|
330
362
|
export async function loadProjectContext(cwd, extraIntegrationSpecs = []) {
|
|
331
363
|
// The CLI debug preflight may already have imported this config before core
|
|
@@ -337,23 +369,38 @@ export async function loadProjectContext(cwd, extraIntegrationSpecs = []) {
|
|
|
337
369
|
// Configured packages come from Project, which has already resolved provider
|
|
338
370
|
// identity over configured, autolinked, and local packages. Loading them
|
|
339
371
|
// again here would let upgrade run codemods from a package Project set aside.
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
372
|
+
// Autolinked packages and the package being authored join only as claimants:
|
|
373
|
+
// every other command uses them for their provider IDs, but upgrade has
|
|
374
|
+
// never run their codemods.
|
|
375
|
+
const candidates = project.loadedIntegrations.flatMap(integration => {
|
|
376
|
+
const source =
|
|
377
|
+
!integration.__autolinked && configuredSpecs.has(integration.__spec)
|
|
378
|
+
? /** @type {const} */ ('configured')
|
|
379
|
+
: integration.__autolinked
|
|
380
|
+
? /** @type {const} */ ('autolinked')
|
|
381
|
+
: integration.__local
|
|
382
|
+
? /** @type {const} */ ('local')
|
|
383
|
+
: null;
|
|
384
|
+
return source == null
|
|
385
|
+
? []
|
|
386
|
+
: [{source, integration, spec: integration.__spec}];
|
|
387
|
+
});
|
|
344
388
|
// A package that lists itself runs its installed copy's released codemods,
|
|
345
|
-
// never the work in progress being authored
|
|
389
|
+
// never the work in progress being authored; the resolver puts that copy in
|
|
390
|
+
// its place. Naming the package being authored with --integration asks for
|
|
391
|
+
// the installed copy too.
|
|
346
392
|
const local = project.loadedIntegrations.find(
|
|
347
393
|
integration => integration.__local,
|
|
348
394
|
);
|
|
349
|
-
const selfListed =
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
395
|
+
const selfListed =
|
|
396
|
+
local != null && !local.__autolinked && configuredSpecs.has(local.__spec);
|
|
397
|
+
const installed =
|
|
398
|
+
local != null && selfListed && project.configPath
|
|
399
|
+
? await loadIntegrations([local.__spec], {
|
|
400
|
+
cwd: path.dirname(project.configPath),
|
|
401
|
+
resolveProviders: false,
|
|
402
|
+
})
|
|
403
|
+
: [];
|
|
357
404
|
const extraSpecs = uniqueFiles(extraIntegrationSpecs ?? []).filter(
|
|
358
405
|
spec => !configuredSpecs.has(spec),
|
|
359
406
|
);
|
|
@@ -361,38 +408,23 @@ export async function loadProjectContext(cwd, extraIntegrationSpecs = []) {
|
|
|
361
408
|
extraSpecs.length === 0
|
|
362
409
|
? []
|
|
363
410
|
: await loadIntegrations(extraSpecs, {resolveProviders: false});
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
const resolved = markProviderConflicts([
|
|
380
|
-
...configured,
|
|
381
|
-
...claimantsOnly,
|
|
382
|
-
...extras,
|
|
383
|
-
]);
|
|
384
|
-
// Claimants leave by package directory, not object identity: the pass can
|
|
385
|
-
// return one as a new conflict entry, and upgrade must not warn that a
|
|
386
|
-
// package every other command uses contributes nothing.
|
|
387
|
-
const claimantDirs = new Set(
|
|
388
|
-
claimantsOnly.map(integration => integration.__packageDir),
|
|
389
|
-
);
|
|
390
|
-
const integrations = resolved.filter(
|
|
391
|
-
integration =>
|
|
392
|
-
integration.__packageDir == null ||
|
|
393
|
-
!claimantDirs.has(integration.__packageDir),
|
|
411
|
+
const {integrations, ledger} = resolveProviders(
|
|
412
|
+
[
|
|
413
|
+
...candidates,
|
|
414
|
+
...installed.map(integration => ({
|
|
415
|
+
source: /** @type {const} */ ('installed'),
|
|
416
|
+
integration,
|
|
417
|
+
spec: integration.__spec,
|
|
418
|
+
})),
|
|
419
|
+
...extras.map(integration => ({
|
|
420
|
+
source: /** @type {const} */ ('extra'),
|
|
421
|
+
integration,
|
|
422
|
+
spec: integration.__spec,
|
|
423
|
+
})),
|
|
424
|
+
],
|
|
425
|
+
{codemods: true, prior: providerLedgerOf(project)},
|
|
394
426
|
);
|
|
395
|
-
return {postCodemodHooks, integrations};
|
|
427
|
+
return {postCodemodHooks, integrations, ledger};
|
|
396
428
|
}
|
|
397
429
|
|
|
398
430
|
/**
|
|
@@ -427,7 +459,10 @@ export async function selectIntegrationCodemodsFor(integrations, from, to) {
|
|
|
427
459
|
try {
|
|
428
460
|
const byVersion = await discoverIntegrationCodemods([integration]);
|
|
429
461
|
for (const [version, rawList] of byVersion) {
|
|
430
|
-
const list =
|
|
462
|
+
const list =
|
|
463
|
+
/** @type {Array<import('../../authoring/codemod/type').CodemodEntry>} */ (
|
|
464
|
+
/** @type {unknown} */ (rawList)
|
|
465
|
+
);
|
|
431
466
|
const existing = integrationCodemodsByVersion.get(version);
|
|
432
467
|
if (existing) existing.push(...list);
|
|
433
468
|
else integrationCodemodsByVersion.set(version, [...list]);
|
|
@@ -446,7 +481,10 @@ export async function selectIntegrationCodemodsFor(integrations, from, to) {
|
|
|
446
481
|
* @param {Array<{version: string, codemods: import('../../authoring/codemod/type').CodemodEntry[]}>} versionGroups
|
|
447
482
|
* @param {{apply: boolean, path: string, codemod?: string, skipCodemods: Set<string>}} options
|
|
448
483
|
*/
|
|
449
|
-
export async function runIntegrationCodemodsStep(
|
|
484
|
+
export async function runIntegrationCodemodsStep(
|
|
485
|
+
versionGroups,
|
|
486
|
+
{apply, path: srcPath, codemod, skipCodemods},
|
|
487
|
+
) {
|
|
450
488
|
const jscodeshift = (await import('jscodeshift')).default;
|
|
451
489
|
return runIntegrationCodemods(versionGroups, {
|
|
452
490
|
apply,
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
|
|
11
11
|
import {collectAllCodemods} from '../_adapter.mjs';
|
|
12
12
|
import {logger} from '../../logger.mjs';
|
|
13
|
+
import {toAscii} from '../../../assets/codemods/term-log.mjs';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* List every available codemod (oldest→newest).
|
|
@@ -19,7 +20,7 @@ export async function list() {
|
|
|
19
20
|
const codemods = await collectAllCodemods();
|
|
20
21
|
logger.log('Available codemods:');
|
|
21
22
|
for (const {name, title, pr, optional} of codemods) {
|
|
22
|
-
logger.log(` ${name}
|
|
23
|
+
logger.log(` ${name} - ${toAscii(title)}${optional ? ' (optional)' : ''} (${pr})`);
|
|
23
24
|
}
|
|
24
25
|
logger.log('Done\n');
|
|
25
26
|
return {
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Colocated tests for the upgrade.list leaf: every field an entry
|
|
5
|
+
* carries is declared on the canonical `UpgradeListEntry` type, and every
|
|
6
|
+
* declared field is present on every entry.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {describe, it, expect} from 'vitest';
|
|
10
|
+
import * as fs from 'node:fs';
|
|
11
|
+
import {fileURLToPath} from 'node:url';
|
|
12
|
+
import ts from 'typescript';
|
|
13
|
+
import {list} from './list.mjs';
|
|
14
|
+
|
|
15
|
+
const TYPE_FILE = fileURLToPath(
|
|
16
|
+
new URL('../upgrade.type.mjs', import.meta.url),
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Property names a JSDoc `@typedef {object}` declares, parsed from the file.
|
|
21
|
+
* @param {string} typedefName
|
|
22
|
+
* @returns {string[]}
|
|
23
|
+
*/
|
|
24
|
+
function declaredProperties(typedefName) {
|
|
25
|
+
const source = ts.createSourceFile(
|
|
26
|
+
TYPE_FILE,
|
|
27
|
+
fs.readFileSync(TYPE_FILE, 'utf8'),
|
|
28
|
+
ts.ScriptTarget.Latest,
|
|
29
|
+
true,
|
|
30
|
+
ts.ScriptKind.JS,
|
|
31
|
+
);
|
|
32
|
+
/** @type {string[]} */
|
|
33
|
+
const names = [];
|
|
34
|
+
for (const statement of source.statements) {
|
|
35
|
+
for (const doc of /** @type {any} */ (statement).jsDoc ?? []) {
|
|
36
|
+
for (const tag of doc.tags ?? []) {
|
|
37
|
+
if (
|
|
38
|
+
!ts.isJSDocTypedefTag(tag) ||
|
|
39
|
+
tag.name?.getText(source) !== typedefName
|
|
40
|
+
) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const literal = tag.typeExpression;
|
|
44
|
+
if (literal && ts.isJSDocTypeLiteral(literal)) {
|
|
45
|
+
for (const property of literal.jsDocPropertyTags ?? []) {
|
|
46
|
+
names.push(property.name.getText(source));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return names.sort();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
describe('upgrade.list entries', () => {
|
|
56
|
+
it('carry exactly the fields UpgradeListEntry declares', async () => {
|
|
57
|
+
const declared = declaredProperties('UpgradeListEntry');
|
|
58
|
+
expect(declared.length).toBeGreaterThan(0);
|
|
59
|
+
|
|
60
|
+
const {type, data} = await list();
|
|
61
|
+
expect(type).toBe('upgrade.list');
|
|
62
|
+
expect(data.length).toBeGreaterThan(0);
|
|
63
|
+
for (const entry of data) {
|
|
64
|
+
expect(Object.keys(entry).sort()).toEqual(declared);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('marks optional codemods with a boolean', async () => {
|
|
69
|
+
const {data} = await list();
|
|
70
|
+
for (const entry of data) expect(typeof entry.optional).toBe('boolean');
|
|
71
|
+
expect(data.some(entry => entry.optional)).toBe(true);
|
|
72
|
+
});
|
|
73
|
+
});
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Where `upgrade` and Project still disagree on a provider ID's winner.
|
|
5
|
+
*
|
|
6
|
+
* Both repros are `it.fails`: each asserts the agreeing result, and fails
|
|
7
|
+
* today. `upgrade` lets an `--integration` extra of the same name@version stand
|
|
8
|
+
* in for an autolinked package, from any directory, and orders that extra with
|
|
9
|
+
* the extras. So another extra can take the provider ID in `upgrade` while
|
|
10
|
+
* every other command gives it to the autolinked package. The provider ledger
|
|
11
|
+
* property test carves out exactly this shape.
|
|
12
|
+
*
|
|
13
|
+
* Fixtures live under a repo-local temp dir, not /tmp, because Vite refuses to
|
|
14
|
+
* dynamically import a module from outside the project root.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import {afterEach, beforeEach, describe, expect, it} from 'vitest';
|
|
18
|
+
import * as fs from 'node:fs';
|
|
19
|
+
import * as path from 'node:path';
|
|
20
|
+
import {loadProjectContext} from './_adapter.mjs';
|
|
21
|
+
import {Project, providerLedgerOf} from '../../foundation/config/project.mjs';
|
|
22
|
+
|
|
23
|
+
let tmpDir;
|
|
24
|
+
let originalCwd;
|
|
25
|
+
|
|
26
|
+
beforeEach(() => {
|
|
27
|
+
originalCwd = process.cwd();
|
|
28
|
+
tmpDir = fs.mkdtempSync(
|
|
29
|
+
path.join(process.cwd(), '.astryx-upgrade-agreement-'),
|
|
30
|
+
);
|
|
31
|
+
process.chdir(tmpDir);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
afterEach(() => {
|
|
35
|
+
process.chdir(originalCwd);
|
|
36
|
+
fs.rmSync(tmpDir, {recursive: true, force: true});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Install a package under node_modules/<dir>.
|
|
41
|
+
* @param {string} dir
|
|
42
|
+
* @param {{name: string, version: string}} pkg
|
|
43
|
+
* @param {string} manifest manifest module source
|
|
44
|
+
*/
|
|
45
|
+
function install(dir, pkg, manifest) {
|
|
46
|
+
const pkgDir = path.join(tmpDir, 'node_modules', ...dir.split('/'));
|
|
47
|
+
fs.mkdirSync(pkgDir, {recursive: true});
|
|
48
|
+
fs.writeFileSync(path.join(pkgDir, 'package.json'), JSON.stringify(pkg));
|
|
49
|
+
fs.writeFileSync(path.join(pkgDir, 'astryx.integration.mjs'), manifest);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/** An autolinked `@acme/a` and an `@acme/other` that claims its provider ID. */
|
|
53
|
+
function autolinkedWithRival() {
|
|
54
|
+
fs.writeFileSync(
|
|
55
|
+
path.join(tmpDir, 'package.json'),
|
|
56
|
+
JSON.stringify({name: 'consumer', dependencies: {'@acme/a': '1.0.0'}}),
|
|
57
|
+
);
|
|
58
|
+
install(
|
|
59
|
+
'@acme/a',
|
|
60
|
+
{name: '@acme/a', version: '1.0.0'},
|
|
61
|
+
'export default {};\n',
|
|
62
|
+
);
|
|
63
|
+
install(
|
|
64
|
+
'@acme/other',
|
|
65
|
+
{name: '@acme/other', version: '1.0.0'},
|
|
66
|
+
"export default {providerId: '@acme/a'};\n",
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* The package each resolution lets contribute under a provider ID.
|
|
72
|
+
* @param {Map<string, any>} ledger
|
|
73
|
+
* @param {string} providerId
|
|
74
|
+
*/
|
|
75
|
+
function winnerOf(ledger, providerId) {
|
|
76
|
+
return [...ledger.values()].find(
|
|
77
|
+
entry => entry.outcome === 'contributes' && entry.providerId === providerId,
|
|
78
|
+
)?.key;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** @param {Array<import('../../foundation/integrations/integrations.mjs').LoadedIntegration>} integrations */
|
|
82
|
+
function claims(integrations) {
|
|
83
|
+
return integrations.map(integration => [
|
|
84
|
+
integration.name,
|
|
85
|
+
integration.__providerConflict?.claimedBy ?? null,
|
|
86
|
+
]);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
describe('upgrade and Project on an autolinked package named with --integration', () => {
|
|
90
|
+
it('agree when the autolinked package is named first', async () => {
|
|
91
|
+
autolinkedWithRival();
|
|
92
|
+
const project = await Project.load(tmpDir, {fresh: true});
|
|
93
|
+
const upgrade = await loadProjectContext(tmpDir, [
|
|
94
|
+
'@acme/a',
|
|
95
|
+
'@acme/other',
|
|
96
|
+
]);
|
|
97
|
+
|
|
98
|
+
expect(claims(upgrade.integrations)).toEqual([
|
|
99
|
+
['@acme/a', null],
|
|
100
|
+
['@acme/other', '@acme/a'],
|
|
101
|
+
]);
|
|
102
|
+
expect(winnerOf(upgrade.ledger, '@acme/a')).toBe(
|
|
103
|
+
winnerOf(providerLedgerOf(project), '@acme/a'),
|
|
104
|
+
);
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
it.fails(
|
|
108
|
+
'agree when an extra that claims its ID is named first',
|
|
109
|
+
async () => {
|
|
110
|
+
autolinkedWithRival();
|
|
111
|
+
const project = await Project.load(tmpDir, {fresh: true});
|
|
112
|
+
// Today upgrade runs @acme/other and reports @acme/a, which every other
|
|
113
|
+
// command uses, as contributing nothing.
|
|
114
|
+
const upgrade = await loadProjectContext(tmpDir, [
|
|
115
|
+
'@acme/other',
|
|
116
|
+
'@acme/a',
|
|
117
|
+
]);
|
|
118
|
+
|
|
119
|
+
expect(winnerOf(upgrade.ledger, '@acme/a')).toBe(
|
|
120
|
+
winnerOf(providerLedgerOf(project), '@acme/a'),
|
|
121
|
+
);
|
|
122
|
+
expect(claims(upgrade.integrations)).toEqual([
|
|
123
|
+
['@acme/other', '@acme/a'],
|
|
124
|
+
['@acme/a', null],
|
|
125
|
+
]);
|
|
126
|
+
},
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
it.fails(
|
|
130
|
+
'agree when a copy of it in another directory is named',
|
|
131
|
+
async () => {
|
|
132
|
+
autolinkedWithRival();
|
|
133
|
+
// The same name@version in another directory, with a manifest that fails.
|
|
134
|
+
install(
|
|
135
|
+
'@acme/a-copy',
|
|
136
|
+
{name: '@acme/a', version: '1.0.0'},
|
|
137
|
+
"throw new Error('broken copy');\n",
|
|
138
|
+
);
|
|
139
|
+
const project = await Project.load(tmpDir, {fresh: true});
|
|
140
|
+
// Today the broken copy stands in for @acme/a by name@version, so upgrade
|
|
141
|
+
// has no claimant left for the ID and @acme/other takes it.
|
|
142
|
+
const upgrade = await loadProjectContext(tmpDir, [
|
|
143
|
+
'@acme/a-copy',
|
|
144
|
+
'@acme/other',
|
|
145
|
+
]);
|
|
146
|
+
|
|
147
|
+
expect(winnerOf(upgrade.ledger, '@acme/a')).toBe(
|
|
148
|
+
winnerOf(providerLedgerOf(project), '@acme/a'),
|
|
149
|
+
);
|
|
150
|
+
},
|
|
151
|
+
);
|
|
152
|
+
});
|
package/api/upgrade/run/run.mjs
CHANGED
|
@@ -171,6 +171,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {
|
|
|
171
171
|
path: path_,
|
|
172
172
|
codemod: options.codemod,
|
|
173
173
|
skipCodemods,
|
|
174
|
+
root: cwd,
|
|
174
175
|
});
|
|
175
176
|
const coreResult = codemodResult && 'totalFilesChanged' in codemodResult ? codemodResult : null;
|
|
176
177
|
|
|
@@ -24,7 +24,7 @@ import {logger} from '../../logger.mjs';
|
|
|
24
24
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
25
25
|
*/
|
|
26
26
|
export function statusUpToDate({from, to, agentDocs, registryCompositions}) {
|
|
27
|
-
logger.log('
|
|
27
|
+
logger.log('[ok] Already up to date - no codemods to run.');
|
|
28
28
|
logger.log('Use --force to run codemods anyway.');
|
|
29
29
|
logger.log(registryCompositions?.ok === false ? 'Finished with unresolved registry items\n' : 'Done\n');
|
|
30
30
|
return {
|
|
@@ -45,7 +45,7 @@ export function statusUpToDate({from, to, agentDocs, registryCompositions}) {
|
|
|
45
45
|
* @returns {import('../upgrade.type.mjs').UpgradeStatusResponse}
|
|
46
46
|
*/
|
|
47
47
|
export function statusNoCodemods({from, to, agentDocs, registryCompositions}) {
|
|
48
|
-
logger.log('
|
|
48
|
+
logger.log('[ok] No codemods available for this version range.');
|
|
49
49
|
logger.log(registryCompositions?.ok === false ? 'Finished with unresolved registry items\n' : 'Done\n');
|
|
50
50
|
return {
|
|
51
51
|
type: 'upgrade.status',
|
|
@@ -11,6 +11,7 @@ export const doc = {
|
|
|
11
11
|
type: 'function',
|
|
12
12
|
kind: 'api',
|
|
13
13
|
name: 'upgrade',
|
|
14
|
+
namespace: 'cli/api',
|
|
14
15
|
displayName: 'upgrade()',
|
|
15
16
|
summary: 'Run version migrations and reconcile copied compositions.',
|
|
16
17
|
description:
|
|
@@ -80,7 +81,8 @@ export const doc = {
|
|
|
80
81
|
{
|
|
81
82
|
name: 'options.installDeps',
|
|
82
83
|
type: 'boolean',
|
|
83
|
-
description:
|
|
84
|
+
description:
|
|
85
|
+
'Install jscodeshift when it is missing; otherwise a missing jscodeshift throws ERR_DEP_MISSING.',
|
|
84
86
|
},
|
|
85
87
|
{
|
|
86
88
|
name: 'options.registry',
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* astryx --json upgrade --list
|
|
6
6
|
*/
|
|
7
7
|
export type UpgradeListResponse = {
|
|
8
8
|
type: "upgrade.list";
|
|
@@ -12,6 +12,10 @@ export type UpgradeListEntry = {
|
|
|
12
12
|
name: string;
|
|
13
13
|
title: string;
|
|
14
14
|
version: string;
|
|
15
|
+
/**
|
|
16
|
+
* True when the codemod runs only if named with `--codemod`.
|
|
17
|
+
*/
|
|
18
|
+
optional: boolean;
|
|
15
19
|
};
|
|
16
20
|
/**
|
|
17
21
|
* State of the managed agent-docs block (`<!-- ASTRYX:START --> … END -->`)
|
|
@@ -121,14 +125,14 @@ export type RegistryCompositionSummary = {
|
|
|
121
125
|
items: RegistryCompositionItemSummary[];
|
|
122
126
|
};
|
|
123
127
|
/**
|
|
124
|
-
*
|
|
128
|
+
* astryx --json upgrade --registry [--apply]
|
|
125
129
|
*/
|
|
126
130
|
export type UpgradeRegistryResponse = {
|
|
127
131
|
type: "upgrade.registry";
|
|
128
132
|
data: RegistryCompositionSummary;
|
|
129
133
|
};
|
|
130
134
|
/**
|
|
131
|
-
*
|
|
135
|
+
* astryx --json upgrade [--apply]
|
|
132
136
|
*/
|
|
133
137
|
export type UpgradeRunResponse = {
|
|
134
138
|
type: "upgrade.run";
|
|
@@ -150,7 +154,7 @@ export type UpgradeRunResponse = {
|
|
|
150
154
|
};
|
|
151
155
|
};
|
|
152
156
|
/**
|
|
153
|
-
*
|
|
157
|
+
* astryx --json upgrade — short-circuit status results.
|
|
154
158
|
*
|
|
155
159
|
* - `up_to_date`: `--from` is >= installed target and `--force` was not passed.
|
|
156
160
|
* - `no_codemods`: no codemods (core or integration) apply to the range.
|