@astryxdesign/cli 0.6.4 → 0.6.5-canary.01972bc
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/CHANGELOG.md +56 -0
- package/README.md +103 -95
- package/api/build/_adapter.d.mts +36 -2
- package/api/build/_adapter.mjs +41 -10
- package/api/build/build.doc.mjs +8 -3
- package/api/build/build.test.mjs +60 -2
- package/api/build/kit/kit.mjs +109 -26
- package/api/build/kit/rank.d.mts +24 -8
- package/api/build/kit/rank.mjs +277 -97
- package/api/build/kit/rank.test.mjs +231 -48
- package/api/component/_adapter.d.mts +25 -0
- package/api/component/_adapter.mjs +59 -5
- package/api/component/component.d.mts +6 -3
- package/api/component/component.doc.mjs +37 -17
- package/api/component/component.mjs +249 -9
- package/api/component/component.type.d.mts +25 -0
- package/api/component/component.type.mjs +44 -0
- package/api/discover/_adapter.d.mts +114 -6
- package/api/discover/_adapter.mjs +372 -17
- package/api/discover/_adapter.test.mjs +215 -0
- package/api/discover/_catalog-view.d.mts +115 -0
- package/api/discover/_catalog-view.mjs +203 -0
- package/api/discover/_catalog-view.test.mjs +128 -0
- package/api/discover/detail/detail.d.mts +18 -6
- package/api/discover/detail/detail.mjs +67 -13
- package/api/discover/detail/detail.test.mjs +85 -0
- package/api/discover/detail/item/item.d.mts +26 -0
- package/api/discover/detail/item/item.mjs +78 -0
- package/api/discover/detail/item/item.test.mjs +73 -0
- package/api/discover/discover.d.mts +3 -9
- package/api/discover/discover.doc.mjs +61 -18
- package/api/discover/discover.mjs +220 -36
- package/api/discover/discover.test.mjs +11 -2
- package/api/discover/discover.type.d.mts +147 -8
- package/api/discover/discover.type.mjs +102 -12
- package/api/discover/list/list.d.mts +20 -6
- package/api/discover/list/list.mjs +45 -12
- package/api/discover/list/list.test.mjs +46 -0
- package/api/discover/search/search.d.mts +18 -16
- package/api/discover/search/search.mjs +102 -56
- package/api/discover/search/search.test.mjs +144 -10
- package/api/docs/_adapter.d.mts +8 -3
- package/api/docs/_adapter.mjs +14 -6
- package/api/docs/docOverlays.test.mjs +27 -1
- package/api/docs/docs.doc.mjs +2 -2
- package/api/docs/docs.test.mjs +54 -18
- package/api/docs/integration-tree.test.mjs +17 -0
- package/api/docs/integrationDocs.test.mjs +27 -5
- package/api/doctor/doctor.d.mts +8 -3
- package/api/doctor/doctor.doc.mjs +17 -8
- package/api/doctor/doctor.mjs +90 -9
- package/api/doctor/doctor.test.mjs +122 -10
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/error.d.mts +22 -0
- package/api/error.mjs +42 -0
- package/api/gap-report/gap-report.doc.mjs +19 -10
- package/api/hook/hook.doc.mjs +6 -3
- package/api/index.d.mts +1 -0
- package/api/index.mjs +5 -3
- package/api/init/init.doc.mjs +17 -12
- package/api/integration/add-contribution.d.mts +2 -1
- package/api/integration/add-contribution.mjs +7 -3
- package/api/integration/add-contribution.test.mjs +3 -3
- package/api/integration/add-helpers.d.mts +5 -2
- package/api/integration/add-helpers.mjs +36 -9
- package/api/integration/add-theme.mjs +266 -23
- package/api/integration/add-theme.test.mjs +247 -0
- package/api/integration/authoring-checks.mjs +12 -9
- package/api/integration/authoring-checks.type.d.mts +8 -0
- package/api/integration/authoring-checks.type.mjs +7 -3
- package/api/integration/integration-authoring.type.d.mts +4 -1
- package/api/integration/integration-authoring.type.mjs +6 -1
- package/api/integration/integrationAdd.doc.mjs +6 -0
- package/api/integration/integrationAddTheme.doc.mjs +10 -0
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
- package/api/integration/integrationDocConflicts.doc.mjs +1 -1
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
- package/api/integration/pack-check.lifecycle-output.test.mjs +107 -0
- package/api/integration/pack-check.mjs +92 -10
- package/api/integration/pack-check.test.mjs +140 -1
- package/api/integration/pack-check.type.mjs +1 -1
- package/api/integration/validate-integration.d.mts +4 -2
- package/api/integration/validate-integration.mjs +7 -2
- package/api/integration/validate-integration.test.mjs +55 -0
- package/api/integration/validate-integration.type.d.mts +5 -0
- package/api/integration/validate-integration.type.mjs +5 -1
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +1 -1
- package/api/json/isError.doc.mjs +1 -1
- package/api/layout/expand/expand.mjs +12 -7
- package/api/layout/expand/expand.receipt.test.mjs +74 -0
- package/api/layout/layout.type.d.mts +1 -0
- package/api/layout/layout.type.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search.d.mts +51 -1
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +299 -17
- package/api/search/search.test.mjs +216 -18
- package/api/swizzle/copy/copy.mjs +66 -3
- package/api/swizzle/swizzle.doc.mjs +11 -5
- package/api/template/copy/copy.mjs +15 -9
- package/api/template/copy/copy.receipt.test.mjs +77 -0
- package/api/template/copy/copy.test.mjs +9 -0
- package/api/template/show/show.mjs +15 -4
- package/api/template/show/show.test.mjs +76 -0
- package/api/template/template-integration.test.mjs +14 -0
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +8 -3
- package/api/template/template.mjs +1 -0
- package/api/template/template.type.d.mts +2 -0
- package/api/template/template.type.mjs +2 -0
- package/api/theme/add/add.mjs +17 -25
- package/api/theme/add/add.rollback.test.mjs +158 -0
- package/api/theme/add/add.staging.test.mjs +40 -23
- package/api/theme/build/build.d.mts +24 -0
- package/api/theme/build/build.family.test.mjs +7 -12
- package/api/theme/build/build.mjs +243 -26
- package/api/theme/build/build.project-core.test.mjs +165 -0
- package/api/theme/build/build.rollback.test.mjs +148 -0
- package/api/theme/generateTonalPalette.doc.mjs +1 -2
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +9 -10
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +2 -1
- package/api/theme/themePaletteGenerate.doc.mjs +15 -8
- package/api/theme/themeTargets.doc.mjs +3 -2
- package/api/theme/themeTemplate.doc.mjs +2 -1
- package/api/upgrade/run/files-changed.test.mjs +111 -0
- package/api/upgrade/run/run.mjs +25 -6
- package/api/upgrade/run/run.test.mjs +45 -1
- package/api/upgrade/upgrade.doc.mjs +24 -22
- package/api/upgrade/upgrade.type.d.mts +1 -0
- package/api/upgrade/upgrade.type.mjs +3 -2
- package/assets/codemods/__tests__/runner.test.mjs +3 -1
- package/assets/codemods/file-count.test.mjs +163 -0
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +5 -4
- package/assets/docs/README.md +4 -2
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +8 -2
- package/assets/docs/elevation.doc.mjs +6 -4
- package/assets/docs/getting-started.doc.mjs +5 -16
- package/assets/docs/icons.doc.mjs +3 -21
- package/assets/docs/illustrations.doc.mjs +7 -15
- package/assets/docs/internationalization.doc.mjs +7 -5
- package/assets/docs/layout.doc.dense.mjs +130 -82
- package/assets/docs/layout.doc.mjs +133 -77
- package/assets/docs/migration.doc.mjs +19 -21
- package/assets/docs/motion.doc.mjs +16 -3
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +8 -0
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +8 -3
- package/assets/docs/spacing.doc.mjs +7 -2
- package/assets/docs/styling-libraries.doc.mjs +6 -2
- package/assets/docs/styling.doc.mjs +19 -23
- package/assets/docs/theme.doc.dense.mjs +58 -18
- package/assets/docs/theme.doc.mjs +57 -47
- package/assets/docs/theme.doc.zh.mjs +9 -8
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +389 -8
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/add-a-component.doc.mjs +75 -0
- package/assets/docs/tree/add-a-theme.doc.mjs +85 -0
- package/assets/docs/tree/add-a-topic.doc.mjs +144 -0
- package/assets/docs/tree/agent-guidance.doc.mjs +138 -0
- package/assets/docs/tree/block-template.doc.mjs +130 -0
- package/assets/docs/tree/build-the-template.doc.mjs +28 -0
- package/assets/docs/tree/building-blocks.doc.mjs +46 -0
- package/assets/docs/tree/check-your-docs.doc.mjs +137 -0
- package/assets/docs/tree/checks.doc.mjs +119 -0
- package/assets/docs/tree/codemods.doc.mjs +147 -0
- package/assets/docs/tree/component-family.doc.mjs +113 -0
- package/assets/docs/tree/component-imports.doc.mjs +69 -0
- package/assets/docs/tree/component-lookups.doc.mjs +149 -0
- package/assets/docs/tree/components.doc.mjs +23 -0
- package/assets/docs/tree/configuration.doc.mjs +23 -0
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +182 -0
- package/assets/docs/tree/define-the-theme.doc.mjs +118 -0
- package/assets/docs/tree/describe-the-component.doc.mjs +57 -0
- package/assets/docs/tree/docs.doc.mjs +21 -0
- package/assets/docs/tree/document-the-template.doc.mjs +28 -0
- package/assets/docs/tree/document-the-theme.doc.mjs +68 -0
- package/assets/docs/tree/export-template-assets.doc.mjs +147 -0
- package/assets/docs/tree/extend-or-replace.doc.mjs +103 -0
- package/assets/docs/tree/fonts-and-assets.doc.mjs +106 -0
- package/assets/docs/tree/generate-a-palette.doc.mjs +66 -0
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +105 -0
- package/assets/docs/tree/help.doc.mjs +16 -0
- package/assets/docs/tree/integrations.doc.mjs +25 -451
- package/assets/docs/tree/links.doc.mjs +98 -0
- package/assets/docs/tree/package-and-test.doc.mjs +32 -0
- package/assets/docs/tree/page-template.doc.mjs +71 -0
- package/assets/docs/tree/publishing.doc.mjs +111 -0
- package/assets/docs/tree/quick-start.doc.mjs +272 -0
- package/assets/docs/tree/replace-a-core-component.doc.mjs +104 -0
- package/assets/docs/tree/replace-a-core-template.doc.mjs +172 -0
- package/assets/docs/tree/sections-and-placement.doc.mjs +108 -0
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +59 -0
- package/assets/docs/tree/ship.doc.mjs +16 -0
- package/assets/docs/tree/short-and-findable.doc.mjs +108 -0
- package/assets/docs/tree/single-component.doc.mjs +165 -0
- package/assets/docs/tree/start-a-template.doc.mjs +143 -0
- package/assets/docs/tree/subcomponent.doc.mjs +115 -0
- package/assets/docs/tree/template-assets.doc.mjs +64 -0
- package/assets/docs/tree/template-doc-overview.doc.mjs +121 -0
- package/assets/docs/tree/template-fonts.doc.mjs +102 -0
- package/assets/docs/tree/template-grading-rubric.doc.mjs +452 -0
- package/assets/docs/tree/template-icons.doc.mjs +97 -0
- package/assets/docs/tree/template-images-media.doc.mjs +127 -0
- package/assets/docs/tree/template-styles.doc.mjs +93 -0
- package/assets/docs/tree/templates.doc.mjs +34 -0
- package/assets/docs/tree/test-in-an-app.doc.mjs +115 -0
- package/assets/docs/tree/test-template-in-app.doc.mjs +128 -0
- package/assets/docs/tree/themes.doc.mjs +39 -0
- package/assets/docs/tree/troubleshooting.doc.mjs +153 -0
- package/assets/docs/tree/upgrading.doc.mjs +103 -0
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +51 -0
- package/assets/docs/tree/verify-packed-template.doc.mjs +77 -0
- package/assets/docs/tree/versioning.doc.mjs +162 -0
- package/assets/docs/tree/write-good-templates.doc.mjs +64 -0
- package/assets/docs/tree/write-the-template-file.doc.mjs +154 -0
- package/assets/docs/typography.doc.mjs +24 -4
- package/assets/docs/working-with-ai.doc.mjs +30 -22
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/assets/templates/pages/ai-chat/template.doc.mjs +16 -1
- package/assets/templates/pages/ai-chat-landing/template.doc.mjs +9 -1
- package/assets/templates/pages/blank/template.doc.mjs +3 -1
- package/assets/templates/pages/canvas-editor/template.doc.mjs +9 -1
- package/assets/templates/pages/centered-hero/template.doc.mjs +3 -1
- package/assets/templates/pages/checkout-wizard/template.doc.mjs +1 -0
- package/assets/templates/pages/classic-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/contact-form/template.doc.mjs +16 -1
- package/assets/templates/pages/dashboard/template.doc.mjs +15 -1
- package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +23 -1
- package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-comparison/template.doc.mjs +9 -1
- package/assets/templates/pages/dashboard-composition/template.doc.mjs +10 -1
- package/assets/templates/pages/dashboard-progress/template.doc.mjs +17 -1
- package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +2 -1
- package/assets/templates/pages/detail-page/template.doc.mjs +8 -0
- package/assets/templates/pages/documentation/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-design/template.doc.mjs +10 -1
- package/assets/templates/pages/documentation-technical/template.doc.mjs +10 -1
- package/assets/templates/pages/editor/template.doc.mjs +9 -1
- package/assets/templates/pages/file-explorer/template.doc.mjs +3 -1
- package/assets/templates/pages/form-two-column/template.doc.mjs +17 -1
- package/assets/templates/pages/form-wizard/template.doc.mjs +14 -1
- package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +1 -0
- package/assets/templates/pages/gallery-hero/template.doc.mjs +10 -1
- package/assets/templates/pages/ide/template.doc.mjs +9 -1
- package/assets/templates/pages/incident-console/template.doc.mjs +10 -1
- package/assets/templates/pages/kanban-board/template.doc.mjs +11 -1
- package/assets/templates/pages/library/template.doc.mjs +15 -1
- package/assets/templates/pages/login/template.doc.mjs +10 -1
- package/assets/templates/pages/login-card/template.doc.mjs +11 -1
- package/assets/templates/pages/login-split/template.doc.mjs +10 -1
- package/assets/templates/pages/login-sso/template.doc.mjs +10 -1
- package/assets/templates/pages/messaging-shell/template.doc.mjs +11 -1
- package/assets/templates/pages/mixed-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/payment-form/template.doc.mjs +3 -1
- package/assets/templates/pages/product-detail/template.doc.mjs +9 -1
- package/assets/templates/pages/product-gallery/template.doc.mjs +10 -1
- package/assets/templates/pages/settings/template.doc.mjs +3 -1
- package/assets/templates/pages/settings-dialog/template.doc.mjs +9 -1
- package/assets/templates/pages/settings-sidebar/template.doc.mjs +9 -1
- package/assets/templates/pages/shell-nav/template.doc.mjs +10 -1
- package/assets/templates/pages/shell-side-nav/template.doc.mjs +14 -1
- package/assets/templates/pages/shell-top-nav/template.doc.mjs +11 -1
- package/assets/templates/pages/side-gallery/template.doc.mjs +3 -1
- package/assets/templates/pages/table/template.doc.mjs +11 -1
- package/assets/templates/pages/table-filter/template.doc.mjs +21 -1
- package/assets/templates/pages/table-grouped/template.doc.mjs +15 -1
- package/assets/templates/pages/table-inbox/template.doc.mjs +18 -6
- package/assets/templates/pages/table-page/template.doc.mjs +20 -1
- package/assets/templates/pages/table-tree/template.doc.mjs +14 -1
- package/assets/templates/pages/theme-showcase/template.doc.mjs +10 -1
- package/assets/templates/pages/work-item-detail/template.doc.mjs +10 -0
- package/assets/templates/themes/butter/icons.tsx +2 -0
- package/assets/templates/themes/chocolate/icons.tsx +2 -0
- package/assets/templates/themes/gothic/icons.tsx +2 -0
- package/assets/templates/themes/matcha/icons.tsx +2 -0
- package/assets/templates/themes/neutral/icons.tsx +2 -0
- package/assets/templates/themes/stone/icons.tsx +2 -0
- package/assets/templates/themes/y2k/icons.tsx +2 -0
- package/authoring/config/config.doc.mjs +9 -1
- package/authoring/config/parse.d.mts +2 -0
- package/authoring/config/parse.mjs +19 -0
- package/authoring/config/parse.test.mjs +8 -0
- package/authoring/config/type.ts +11 -0
- package/authoring/discover/discover.doc.d.mts +13 -0
- package/authoring/discover/discover.doc.mjs +138 -0
- package/authoring/discover/parse.d.mts +24 -0
- package/authoring/discover/parse.mjs +128 -0
- package/authoring/discover/parse.test.mjs +124 -0
- package/authoring/discover/type.ts +87 -0
- package/authoring/doctypes/_schema.d.mts +3 -2
- package/authoring/doctypes/_schema.mjs +6 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +4 -2
- package/authoring/doctypes/component/component.doc.mjs +6 -0
- package/authoring/doctypes/component/type.ts +8 -0
- package/authoring/doctypes/reference/reference.doc.mjs +7 -0
- package/authoring/doctypes/reference/type.ts +5 -0
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/template/parse.d.mts +2 -0
- package/authoring/doctypes/template/parse.mjs +1 -0
- package/authoring/doctypes/template/parse.test.mjs +21 -0
- package/authoring/doctypes/template/template.doc.mjs +7 -1
- package/authoring/doctypes/template/type.ts +12 -2
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +10 -0
- package/authoring/index.mjs +1 -0
- package/authoring/integration/integration.doc.mjs +12 -10
- package/clients/cli/commands/component/index.mjs +152 -55
- package/clients/cli/commands/component-batch.test.mjs +341 -0
- package/clients/cli/commands/component-ownership.test.mjs +89 -0
- package/clients/cli/commands/component.doc.mjs +27 -9
- package/clients/cli/commands/discover.doc.mjs +53 -9
- package/clients/cli/commands/discover.mjs +393 -118
- package/clients/cli/commands/discover.sources.test.mjs +267 -0
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +60 -17
- package/clients/cli/commands/docs.test.mjs +113 -24
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +3 -2
- package/clients/cli/commands/doctor-integration.test.mjs +53 -0
- package/clients/cli/commands/doctor.doc.mjs +3 -1
- package/clients/cli/commands/doctor.mjs +53 -9
- package/clients/cli/commands/gap-report.doc.mjs +10 -9
- package/clients/cli/commands/init.doc.mjs +9 -6
- package/clients/cli/commands/integration-add.doc.mjs +17 -7
- package/clients/cli/commands/integration-authoring.test.mjs +70 -9
- package/clients/cli/commands/integration-pack.doc.mjs +5 -9
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration-verify.doc.mjs +22 -0
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +76 -43
- package/clients/cli/commands/layout-expand.doc.mjs +3 -1
- package/clients/cli/commands/layout.expand-receipt.test.mjs +94 -0
- package/clients/cli/commands/layout.mjs +16 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +10 -3
- package/clients/cli/commands/search.mjs +21 -2
- package/clients/cli/commands/search.test.mjs +21 -4
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.copy-receipt.test.mjs +60 -0
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/template.mjs +19 -5
- package/clients/cli/commands/template.show-media.test.mjs +62 -0
- package/clients/cli/commands/text-json-parity.test.mjs +7 -1
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -2
- package/clients/cli/commands/theme-palette.doc.mjs +1 -2
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +2 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +14 -0
- package/clients/cli/commands/upgrade.doc.mjs +62 -3
- package/clients/cli/commands/write-failure.test.mjs +175 -0
- package/clients/cli/index.mjs +28 -6
- package/clients/cli/lib/define-command.mjs +28 -4
- package/clients/cli/lib/define-command.test.mjs +54 -0
- package/clients/cli/lib/exit-codes.test.mjs +17 -1
- package/clients/cli/lib/json-shim.mjs +24 -14
- package/clients/cli/lib/manifest.mjs +48 -156
- package/clients/cli/lib/manifest.test.mjs +103 -9
- package/clients/cli/lib/parse-error-format.test.mjs +81 -0
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/agent-docs/agent-docs.test.mjs +3 -2
- package/foundation/discovery/authoring-self-docs.mjs +1 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +6 -2
- package/foundation/discovery/cli-self-docs.mjs +16 -2
- package/foundation/discovery/cli-self-docs.test.mjs +20 -0
- package/foundation/discovery/docs-discovery.mjs +5 -1
- package/foundation/discovery/docs-discovery.test.mjs +21 -0
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/template-adapter.d.mts +14 -0
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +37 -1
- package/foundation/discovery/template-adapter.mjs +21 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +5 -4
- package/foundation/doc-compiler/inputs.test.mjs +0 -1
- package/foundation/doc-compiler/tree.d.mts +4 -0
- package/foundation/doc-compiler/tree.mjs +6 -1
- package/foundation/doc-compiler/tree.test.mjs +65 -14
- package/foundation/integrations/cli-requirement.d.mts +75 -11
- package/foundation/integrations/cli-requirement.mjs +120 -23
- package/foundation/integrations/cli-requirement.test.mjs +141 -9
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +14 -1
- package/foundation/integrations/integrations.mjs +41 -1
- package/foundation/integrations/integrations.test.mjs +31 -0
- package/foundation/response/batch.type.d.mts +33 -0
- package/foundation/response/batch.type.mjs +34 -0
- package/foundation/response/error-codes.doc.mjs +6 -8
- package/foundation/response/error-codes.test.mjs +30 -5
- package/foundation/response/response-types.doc.d.mts +5 -4
- package/foundation/response/response-types.doc.mjs +49 -19
- package/foundation/response/response-types.doc.test.mjs +23 -0
- package/foundation/response/response.doc.mjs +11 -10
- package/package.json +9 -9
- package/assets/docs/tree/integrations.test.mjs +0 -62
- package/assets/docs/tree/writing-docs.doc.mjs +0 -286
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file The CLI an integration's
|
|
4
|
+
* @file The CLI release an integration's newer contributions need
|
|
5
|
+
* (spec:AST-046 FR11).
|
|
5
6
|
*
|
|
6
7
|
* @input A package.json object.
|
|
7
8
|
* @output Whether its `peerDependencies` range for `@astryxdesign/cli` admits
|
|
8
|
-
* only CLIs that read
|
|
9
|
-
*
|
|
10
|
-
*
|
|
9
|
+
* only CLIs that read what the package ships, and the package.json that
|
|
10
|
+
* declares that range.
|
|
11
|
+
* @position foundation/integrations; read by `integration add doc --parent`
|
|
12
|
+
* and `integration add theme`, which declare the peer, and
|
|
13
|
+
* `integration verify`, which requires it.
|
|
11
14
|
*/
|
|
12
15
|
|
|
13
16
|
import {semverCompare} from '../env/semver.mjs';
|
|
@@ -15,13 +18,34 @@ import {semverCompare} from '../env/semver.mjs';
|
|
|
15
18
|
export const CLI_PACKAGE = '@astryxdesign/cli';
|
|
16
19
|
|
|
17
20
|
/**
|
|
18
|
-
* The first CLI release that reads an integration's docs tree
|
|
19
|
-
* and placed guides
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* package's templates and doc topics.
|
|
21
|
+
* The first stable CLI release that reads an integration's docs tree:
|
|
22
|
+
* namespace docs and placed guides. Published 0.6.3 rejects a namespace doc
|
|
23
|
+
* and hides every doc topic the package ships, with no warning; published
|
|
24
|
+
* 0.6.4 lists the namespace and reads its guides.
|
|
23
25
|
*/
|
|
24
|
-
export const
|
|
26
|
+
export const NAMESPACE_DOCS_CLI = '0.6.4';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The first CLI release that reads a template's `replaces` and `keywords`. A
|
|
30
|
+
* release before it rejects either field, drops that template, and hides the
|
|
31
|
+
* package's doc topics.
|
|
32
|
+
*/
|
|
33
|
+
export const REPLACES_CLI = '0.7.0';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The first stable CLI release that reads typed theme descriptors, the theme
|
|
37
|
+
* folder `integration add theme` writes. Published 0.6.3 rejects a themes root
|
|
38
|
+
* with no `manifest.json` catalog and withholds the package's themes and doc
|
|
39
|
+
* topics; published 0.6.4 lists the themes.
|
|
40
|
+
*/
|
|
41
|
+
export const THEMES_CLI = '0.6.4';
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* The first stable CLI release that reads a doc section's `id`. Published
|
|
45
|
+
* 0.6.3 rejects the field and hides every doc topic the package ships;
|
|
46
|
+
* published 0.6.4 reads the section by its id.
|
|
47
|
+
*/
|
|
48
|
+
export const SECTION_IDS_CLI = '0.6.4';
|
|
25
49
|
|
|
26
50
|
const VERSION_RE = /^v?(\d+|[xX*])(?:\.(\d+|[xX*]))?(?:\.(\d+|[xX*]))?(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
|
|
27
51
|
|
|
@@ -86,17 +110,25 @@ export function lowestAdmitted(range) {
|
|
|
86
110
|
* @param {any} pkg package.json
|
|
87
111
|
* @param {string} feature what the package does, e.g. "ships a namespace doc"
|
|
88
112
|
* @param {string} loss what an older CLI does with it
|
|
113
|
+
* @param {string} floor the first stable CLI release that reads it
|
|
89
114
|
* @returns {string | null}
|
|
90
115
|
*/
|
|
91
|
-
function cliRangeProblem(pkg, feature, loss) {
|
|
116
|
+
export function cliRangeProblem(pkg, feature, loss, floor) {
|
|
117
|
+
// A floor that is missing or not a version means a caller passed the
|
|
118
|
+
// arguments in another order, as after a merge with a caller written for
|
|
119
|
+
// another signature. Fail loudly rather than compare a range against
|
|
120
|
+
// feature text, or against nothing.
|
|
121
|
+
if (typeof floor !== 'string' || lowerVersion(floor) == null) {
|
|
122
|
+
throw new TypeError(`cliRangeProblem: floor "${floor}" is not a version`);
|
|
123
|
+
}
|
|
92
124
|
const range = pkg?.peerDependencies?.[CLI_PACKAGE];
|
|
93
|
-
const fix = `"${CLI_PACKAGE}": ">=${
|
|
125
|
+
const fix = `"${CLI_PACKAGE}": ">=${floor}" in peerDependencies (optional in peerDependenciesMeta, if the CLI is not required)`;
|
|
94
126
|
if (typeof range !== 'string') {
|
|
95
|
-
return `The package ${feature} but declares no ${CLI_PACKAGE} peer. A CLI
|
|
127
|
+
return `The package ${feature} but declares no ${CLI_PACKAGE} peer. A stable CLI before ${floor} ${loss}. Declare ${fix}.`;
|
|
96
128
|
}
|
|
97
129
|
const lowest = lowestAdmitted(range);
|
|
98
|
-
if (lowest == null || semverCompare(lowest,
|
|
99
|
-
return `The package ${feature}, but its ${CLI_PACKAGE} peer range "${range}" admits a CLI
|
|
130
|
+
if (lowest == null || semverCompare(lowest, floor) < 0) {
|
|
131
|
+
return `The package ${feature}, but its ${CLI_PACKAGE} peer range "${range}" admits a stable CLI before ${floor}, which ${loss}. Declare ${fix}.`;
|
|
100
132
|
}
|
|
101
133
|
return null;
|
|
102
134
|
}
|
|
@@ -106,7 +138,7 @@ function cliRangeProblem(pkg, feature, loss) {
|
|
|
106
138
|
* docs on an older CLI, or null when its declared CLI range admits only CLIs
|
|
107
139
|
* that read the docs tree. Published 0.6.3 hides every topic of a package
|
|
108
140
|
* with a namespace doc; builds of main before the docs tree also do so for a
|
|
109
|
-
* placed guide.
|
|
141
|
+
* placed guide. Published 0.6.4 reads both.
|
|
110
142
|
* @param {any} pkg package.json
|
|
111
143
|
* @returns {string | null}
|
|
112
144
|
*/
|
|
@@ -115,12 +147,13 @@ export function docsTreeCliProblem(pkg) {
|
|
|
115
147
|
pkg,
|
|
116
148
|
'ships a namespace doc or a placed guide',
|
|
117
149
|
'does not read the docs tree, and can hide every doc topic the package ships',
|
|
150
|
+
NAMESPACE_DOCS_CLI,
|
|
118
151
|
);
|
|
119
152
|
}
|
|
120
153
|
|
|
121
154
|
/**
|
|
122
|
-
* Why a package with a template that sets `replaces` would lose
|
|
123
|
-
*
|
|
155
|
+
* Why a package with a template that sets `replaces` would lose templates and
|
|
156
|
+
* doc topics on an older CLI (spec:AST-035), or null when its declared CLI
|
|
124
157
|
* range admits only CLIs that read the field.
|
|
125
158
|
* @param {any} pkg package.json
|
|
126
159
|
* @returns {string | null}
|
|
@@ -129,26 +162,90 @@ export function replacesCliProblem(pkg) {
|
|
|
129
162
|
return cliRangeProblem(
|
|
130
163
|
pkg,
|
|
131
164
|
'has a template that sets `replaces`',
|
|
132
|
-
"rejects the field, and
|
|
165
|
+
"rejects the field, drops that template, and hides the package's doc topics",
|
|
166
|
+
REPLACES_CLI,
|
|
133
167
|
);
|
|
134
168
|
}
|
|
135
169
|
|
|
136
170
|
/**
|
|
137
|
-
*
|
|
138
|
-
*
|
|
171
|
+
* Why a package with a doc section that sets `id` would lose its doc topics on
|
|
172
|
+
* an older CLI, or null when its declared CLI range admits only CLIs that read
|
|
173
|
+
* the field. Published 0.6.3 rejects a section `id` and hides every doc topic
|
|
174
|
+
* the package ships; published 0.6.4 reads it.
|
|
139
175
|
* @param {any} pkg package.json
|
|
176
|
+
* @returns {string | null}
|
|
177
|
+
*/
|
|
178
|
+
export function sectionIdsCliProblem(pkg) {
|
|
179
|
+
return cliRangeProblem(
|
|
180
|
+
pkg,
|
|
181
|
+
'has a doc section that sets `id`',
|
|
182
|
+
'rejects the field, and can hide every doc topic the package ships',
|
|
183
|
+
SECTION_IDS_CLI,
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Why a package that ships a theme would lose its themes and doc topics on an
|
|
189
|
+
* older CLI, or null when its declared CLI range admits only CLIs that read
|
|
190
|
+
* typed theme descriptors. Published 0.6.3 rejects a themes root with no
|
|
191
|
+
* `manifest.json` catalog, which `integration add theme` no longer writes;
|
|
192
|
+
* published 0.6.4 reads the descriptors.
|
|
193
|
+
* @param {any} pkg package.json
|
|
194
|
+
* @returns {string | null}
|
|
195
|
+
*/
|
|
196
|
+
export function themesCliProblem(pkg) {
|
|
197
|
+
return cliRangeProblem(
|
|
198
|
+
pkg,
|
|
199
|
+
'ships a theme',
|
|
200
|
+
"cannot read typed theme descriptors, and can drop the package's themes and hide its doc topics",
|
|
201
|
+
THEMES_CLI,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Why a package with a template that sets `keywords` would lose that template
|
|
207
|
+
* and its doc topics on an older CLI, or null when its declared CLI range
|
|
208
|
+
* admits only CLIs that read the field. Published 0.6.3 rejects the field,
|
|
209
|
+
* drops that template, and hides the package's doc topics.
|
|
210
|
+
* @param {any} pkg package.json
|
|
211
|
+
* @returns {string | null}
|
|
212
|
+
*/
|
|
213
|
+
export function keywordsCliProblem(pkg) {
|
|
214
|
+
return cliRangeProblem(
|
|
215
|
+
pkg,
|
|
216
|
+
'has a template that sets `keywords`',
|
|
217
|
+
"rejects the field, drops that template, and hides the package's doc topics",
|
|
218
|
+
REPLACES_CLI,
|
|
219
|
+
);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* The package.json with a CLI peer of `>=floor`: optional, unless the package
|
|
224
|
+
* already says otherwise. Call it only when the package's range admits a CLI
|
|
225
|
+
* before `floor`, so a stricter range is never lowered.
|
|
226
|
+
* @param {any} pkg package.json
|
|
227
|
+
* @param {string} floor the first stable CLI release the package needs
|
|
140
228
|
* @returns {any}
|
|
141
229
|
*/
|
|
142
|
-
export function
|
|
230
|
+
export function withCliPeer(pkg, floor) {
|
|
143
231
|
const meta = pkg.peerDependenciesMeta ?? {};
|
|
144
232
|
return {
|
|
145
233
|
...pkg,
|
|
146
234
|
peerDependencies: {
|
|
147
235
|
...(pkg.peerDependencies ?? {}),
|
|
148
|
-
[CLI_PACKAGE]: `>=${
|
|
236
|
+
[CLI_PACKAGE]: `>=${floor}`,
|
|
149
237
|
},
|
|
150
238
|
peerDependenciesMeta: meta[CLI_PACKAGE]
|
|
151
239
|
? meta
|
|
152
240
|
: {...meta, [CLI_PACKAGE]: {optional: true}},
|
|
153
241
|
};
|
|
154
242
|
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The package.json with a CLI peer that reads namespace docs.
|
|
246
|
+
* @param {any} pkg package.json
|
|
247
|
+
* @returns {any}
|
|
248
|
+
*/
|
|
249
|
+
export function withDocsTreeCli(pkg) {
|
|
250
|
+
return withCliPeer(pkg, NAMESPACE_DOCS_CLI);
|
|
251
|
+
}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
|
+
import fs from 'node:fs';
|
|
3
4
|
import {describe, expect, it} from 'vitest';
|
|
5
|
+
import {semverCompare} from '../env/semver.mjs';
|
|
6
|
+
import * as requirement from './cli-requirement.mjs';
|
|
4
7
|
import {
|
|
5
|
-
|
|
8
|
+
NAMESPACE_DOCS_CLI,
|
|
9
|
+
REPLACES_CLI,
|
|
10
|
+
SECTION_IDS_CLI,
|
|
11
|
+
cliRangeProblem,
|
|
12
|
+
THEMES_CLI,
|
|
6
13
|
lowestAdmitted,
|
|
7
14
|
docsTreeCliProblem,
|
|
15
|
+
keywordsCliProblem,
|
|
8
16
|
replacesCliProblem,
|
|
17
|
+
sectionIdsCliProblem,
|
|
18
|
+
themesCliProblem,
|
|
19
|
+
withCliPeer,
|
|
9
20
|
withDocsTreeCli,
|
|
10
21
|
} from './cli-requirement.mjs';
|
|
11
22
|
|
|
@@ -32,6 +43,11 @@ describe('docsTreeCliProblem', () => {
|
|
|
32
43
|
expect(docsTreeCliProblem({name: '@acme/kit'})).toContain(
|
|
33
44
|
'declares no @astryxdesign/cli peer',
|
|
34
45
|
);
|
|
46
|
+
// Stable releases: a canary built from main before its release reports
|
|
47
|
+
// the older version and reads every feature.
|
|
48
|
+
expect(docsTreeCliProblem({name: '@acme/kit'})).toContain(
|
|
49
|
+
'A stable CLI before 0.6.4 does not read the docs tree',
|
|
50
|
+
);
|
|
35
51
|
});
|
|
36
52
|
|
|
37
53
|
it.each(['^0.6.0', '^0.6.0 || >=0.7.0', '*', '>=0.6.3'])(
|
|
@@ -39,20 +55,23 @@ describe('docsTreeCliProblem', () => {
|
|
|
39
55
|
range => {
|
|
40
56
|
expect(
|
|
41
57
|
docsTreeCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
42
|
-
).toContain('admits a CLI
|
|
58
|
+
).toContain('admits a stable CLI before');
|
|
43
59
|
},
|
|
44
60
|
);
|
|
45
61
|
|
|
46
|
-
it.each(['>=0.7.0', '^0.7.2', '>=0.7.0 <2'])(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
it.each(['>=0.6.4', '^0.6.4', '>=0.7.0', '^0.7.2', '>=0.7.0 <2'])(
|
|
63
|
+
'accepts %s',
|
|
64
|
+
range => {
|
|
65
|
+
expect(
|
|
66
|
+
docsTreeCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
67
|
+
).toBeNull();
|
|
68
|
+
},
|
|
69
|
+
);
|
|
51
70
|
|
|
52
71
|
it('declares the peer as optional, and keeps what the package says of it', () => {
|
|
53
72
|
const declared = withDocsTreeCli({name: '@acme/kit'});
|
|
54
73
|
expect(declared.peerDependencies).toEqual({
|
|
55
|
-
'@astryxdesign/cli':
|
|
74
|
+
'@astryxdesign/cli': '>=0.6.4',
|
|
56
75
|
});
|
|
57
76
|
expect(declared.peerDependenciesMeta).toEqual({
|
|
58
77
|
'@astryxdesign/cli': {optional: true},
|
|
@@ -76,9 +95,122 @@ describe('replacesCliProblem', () => {
|
|
|
76
95
|
);
|
|
77
96
|
expect(
|
|
78
97
|
replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '^0.6.0'}}),
|
|
79
|
-
).toContain('admits a CLI
|
|
98
|
+
).toContain('admits a stable CLI before');
|
|
80
99
|
expect(
|
|
81
100
|
replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
|
|
82
101
|
).toBeNull();
|
|
102
|
+
// Unlike the docs tree, `replaces` still needs 0.7.0.
|
|
103
|
+
expect(
|
|
104
|
+
replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}}),
|
|
105
|
+
).toContain('admits a stable CLI before 0.7.0');
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
describe('themesCliProblem and sectionIdsCliProblem', () => {
|
|
110
|
+
// Published 0.6.4 reads typed theme descriptors and section ids. Published
|
|
111
|
+
// 0.6.3 rejects both and hides the package's doc topics.
|
|
112
|
+
it.each([
|
|
113
|
+
['a theme', themesCliProblem, 'ships a theme'],
|
|
114
|
+
['a section id', sectionIdsCliProblem, 'sets `id`'],
|
|
115
|
+
])('asks for a CLI from 0.6.4 for %s', (_name, problem, feature) => {
|
|
116
|
+
expect(problem({name: '@acme/kit'})).toContain(feature);
|
|
117
|
+
expect(problem({name: '@acme/kit'})).toContain('A stable CLI before 0.6.4');
|
|
118
|
+
for (const range of ['>=0.6.4', '^0.6.4', '>=0.6.5', '>=0.7.0']) {
|
|
119
|
+
expect(
|
|
120
|
+
problem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
121
|
+
).toBeNull();
|
|
122
|
+
}
|
|
123
|
+
for (const range of ['^0.6.0', '>=0.6.3', '*']) {
|
|
124
|
+
expect(
|
|
125
|
+
problem({peerDependencies: {'@astryxdesign/cli': range}}),
|
|
126
|
+
).toContain('admits a stable CLI before 0.6.4');
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
it('keeps 0.7.0 for replaces and keywords', () => {
|
|
131
|
+
const pkg = {peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}};
|
|
132
|
+
expect(docsTreeCliProblem(pkg)).toBeNull();
|
|
133
|
+
expect(replacesCliProblem(pkg)).toContain(
|
|
134
|
+
'admits a stable CLI before 0.7.0',
|
|
135
|
+
);
|
|
136
|
+
expect(keywordsCliProblem(pkg)).toContain(
|
|
137
|
+
'admits a stable CLI before 0.7.0',
|
|
138
|
+
);
|
|
139
|
+
expect(
|
|
140
|
+
keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
|
|
141
|
+
).toBeNull();
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
it('names a released CLI for a feature that already shipped', () => {
|
|
145
|
+
const {version} = JSON.parse(
|
|
146
|
+
fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'),
|
|
147
|
+
);
|
|
148
|
+
for (const floor of [NAMESPACE_DOCS_CLI, THEMES_CLI, SECTION_IDS_CLI]) {
|
|
149
|
+
expect(semverCompare(floor, version.split('-')[0])).toBeLessThanOrEqual(
|
|
150
|
+
0,
|
|
151
|
+
);
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it('declares the floor a theme needs as an optional peer', () => {
|
|
156
|
+
const declared = withCliPeer({name: '@acme/kit'}, THEMES_CLI);
|
|
157
|
+
expect(declared.peerDependencies).toEqual({
|
|
158
|
+
'@astryxdesign/cli': '>=0.6.4',
|
|
159
|
+
});
|
|
160
|
+
expect(declared.peerDependenciesMeta).toEqual({
|
|
161
|
+
'@astryxdesign/cli': {optional: true},
|
|
162
|
+
});
|
|
163
|
+
expect(themesCliProblem(declared)).toBeNull();
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
describe('cliRangeProblem', () => {
|
|
168
|
+
it('fails loudly when a caller names no floor', () => {
|
|
169
|
+
expect(() =>
|
|
170
|
+
// @ts-expect-error: the floor is required
|
|
171
|
+
cliRangeProblem({name: '@acme/kit'}, 'ships x', 'drops x'),
|
|
172
|
+
).toThrow(TypeError);
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it('fails loudly when the floor is not a version', () => {
|
|
176
|
+
expect(() =>
|
|
177
|
+
cliRangeProblem({name: '@acme/kit'}, '0.6.4', 'ships x', 'drops x'),
|
|
178
|
+
).toThrow(TypeError);
|
|
179
|
+
});
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
describe('every feature check names its CLI floor', () => {
|
|
183
|
+
// The first stable CLI release that reads each feature. A new check, or a
|
|
184
|
+
// check whose floor changes, fails here until this table says so on
|
|
185
|
+
// purpose, so a floor never moves as a side effect of another change.
|
|
186
|
+
const FLOORS = {
|
|
187
|
+
docsTreeCliProblem: '0.6.4',
|
|
188
|
+
replacesCliProblem: REPLACES_CLI,
|
|
189
|
+
keywordsCliProblem: REPLACES_CLI,
|
|
190
|
+
sectionIdsCliProblem: '0.6.4',
|
|
191
|
+
themesCliProblem: '0.6.4',
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
it('asks each feature for the CLI release this table names', () => {
|
|
195
|
+
const named = Object.fromEntries(
|
|
196
|
+
Object.entries(requirement)
|
|
197
|
+
.filter(
|
|
198
|
+
([name, value]) =>
|
|
199
|
+
typeof value === 'function' &&
|
|
200
|
+
/CliProblem$/.test(name) &&
|
|
201
|
+
name !== 'cliRangeProblem',
|
|
202
|
+
)
|
|
203
|
+
.map(([name, check]) => [
|
|
204
|
+
name,
|
|
205
|
+
/A stable CLI before (\d+\.\d+\.\d+)/.exec(
|
|
206
|
+
check({name: '@acme/kit'}) ?? '',
|
|
207
|
+
)?.[1] ?? null,
|
|
208
|
+
]),
|
|
209
|
+
);
|
|
210
|
+
expect(named).toEqual({
|
|
211
|
+
...FLOORS,
|
|
212
|
+
replacesCliProblem: '0.7.0',
|
|
213
|
+
keywordsCliProblem: '0.7.0',
|
|
214
|
+
});
|
|
83
215
|
});
|
|
84
216
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Contribution inventory for integration
|
|
4
|
+
* @file Contribution inventory for `astryx integration verify`.
|
|
5
5
|
*
|
|
6
6
|
* Enumerates the files and contribution identities an integration package
|
|
7
7
|
* declares, for cross-referencing against the npm tarball. The file inventory
|
|
@@ -45,7 +45,7 @@ export function findManifestPaths(dir: string): string[];
|
|
|
45
45
|
* @param {string} file absolute manifest path
|
|
46
46
|
* @param {string} [label] used in error messages
|
|
47
47
|
* @param {{fresh?: boolean}} [options]
|
|
48
|
-
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, agentDocsError?: string}>}
|
|
48
|
+
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
|
|
49
49
|
*/
|
|
50
50
|
export function loadManifest(file: string, label?: string, { fresh }?: {
|
|
51
51
|
fresh?: boolean;
|
|
@@ -55,6 +55,8 @@ export function loadManifest(file: string, label?: string, { fresh }?: {
|
|
|
55
55
|
debug?: import("../../authoring/debug/type").DebugEventHandler;
|
|
56
56
|
gapReport?: import("../../authoring/gap-report/type").GapReportHandler;
|
|
57
57
|
gapReportError?: string;
|
|
58
|
+
discover?: import("../../authoring/discover/type").DiscoverSource;
|
|
59
|
+
discoverError?: string;
|
|
58
60
|
agentDocsError?: string;
|
|
59
61
|
}>;
|
|
60
62
|
/**
|
|
@@ -154,6 +156,9 @@ export function loadIntegrations(specs?: string[], { cwd, fresh, resolveProvider
|
|
|
154
156
|
* validated package-owned handler from the `gapReport` NAMED export.
|
|
155
157
|
* @property {string} [__gapReportError] isolated named-handler validation error.
|
|
156
158
|
* Named exports are not manifest keys — see {@link loadManifest}.
|
|
159
|
+
* @property {import('../../authoring/discover/type').DiscoverSource} [__discover]
|
|
160
|
+
* validated catalog source from the `discover` NAMED export.
|
|
161
|
+
* @property {string} [__discoverError] isolated discover-source validation error.
|
|
157
162
|
*/
|
|
158
163
|
/** Conventional manifest basenames, in load-precedence order. */
|
|
159
164
|
export const MANIFEST_BASENAMES: string[];
|
|
@@ -245,4 +250,12 @@ export type LoadedIntegration = {
|
|
|
245
250
|
* Named exports are not manifest keys — see {@link loadManifest}.
|
|
246
251
|
*/
|
|
247
252
|
__gapReportError?: string | undefined;
|
|
253
|
+
/**
|
|
254
|
+
* validated catalog source from the `discover` NAMED export.
|
|
255
|
+
*/
|
|
256
|
+
__discover?: import("../../authoring/discover/type").DiscoverSource | undefined;
|
|
257
|
+
/**
|
|
258
|
+
* isolated discover-source validation error.
|
|
259
|
+
*/
|
|
260
|
+
__discoverError?: string | undefined;
|
|
248
261
|
};
|
|
@@ -29,6 +29,7 @@ import {
|
|
|
29
29
|
} from '../../authoring/integration/schema.mjs';
|
|
30
30
|
import {importUserModule, findPresentFiles} from '../fs/module-loader.mjs';
|
|
31
31
|
import {parseGapReportHandler} from '../../authoring/gap-report/parse.mjs';
|
|
32
|
+
import {parseDiscoverSource} from '../../authoring/discover/parse.mjs';
|
|
32
33
|
import {resolveProviders} from './provider-resolution.mjs';
|
|
33
34
|
|
|
34
35
|
/**
|
|
@@ -80,6 +81,9 @@ import {resolveProviders} from './provider-resolution.mjs';
|
|
|
80
81
|
* validated package-owned handler from the `gapReport` NAMED export.
|
|
81
82
|
* @property {string} [__gapReportError] isolated named-handler validation error.
|
|
82
83
|
* Named exports are not manifest keys — see {@link loadManifest}.
|
|
84
|
+
* @property {import('../../authoring/discover/type').DiscoverSource} [__discover]
|
|
85
|
+
* validated catalog source from the `discover` NAMED export.
|
|
86
|
+
* @property {string} [__discoverError] isolated discover-source validation error.
|
|
83
87
|
*/
|
|
84
88
|
|
|
85
89
|
/** Conventional manifest basenames, in load-precedence order. */
|
|
@@ -167,6 +171,23 @@ function parseGapReportHandlerExport(value, label) {
|
|
|
167
171
|
}
|
|
168
172
|
}
|
|
169
173
|
|
|
174
|
+
/**
|
|
175
|
+
* Parse the optional named discover source the same way: a malformed one is
|
|
176
|
+
* isolated from every other contribution and reported by `astryx discover`.
|
|
177
|
+
*
|
|
178
|
+
* @param {unknown} value
|
|
179
|
+
* @param {string} label
|
|
180
|
+
* @returns {{source?: import('../../authoring/discover/type').DiscoverSource, error?: string}}
|
|
181
|
+
*/
|
|
182
|
+
function parseDiscoverSourceExport(value, label) {
|
|
183
|
+
if (value === undefined) return {};
|
|
184
|
+
try {
|
|
185
|
+
return {source: parseDiscoverSource(value, `${label} named export "discover"`)};
|
|
186
|
+
} catch (error) {
|
|
187
|
+
return {error: error instanceof Error ? error.message : String(error)};
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
|
|
170
191
|
/**
|
|
171
192
|
* Load and validate a manifest module's default export, while isolating the
|
|
172
193
|
* optional `agentDocs` contribution from the manifest's other fields.
|
|
@@ -183,7 +204,7 @@ function parseGapReportHandlerExport(value, label) {
|
|
|
183
204
|
* @param {string} file absolute manifest path
|
|
184
205
|
* @param {string} [label] used in error messages
|
|
185
206
|
* @param {{fresh?: boolean}} [options]
|
|
186
|
-
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, agentDocsError?: string}>}
|
|
207
|
+
* @returns {Promise<{manifest: import('../../authoring/integration/type').AstryxIntegration, unknownKeys: string[], debug?: import('../../authoring/debug/type').DebugEventHandler, gapReport?: import('../../authoring/gap-report/type').GapReportHandler, gapReportError?: string, discover?: import('../../authoring/discover/type').DiscoverSource, discoverError?: string, agentDocsError?: string}>}
|
|
187
208
|
*/
|
|
188
209
|
export async function loadManifest(
|
|
189
210
|
file,
|
|
@@ -194,6 +215,7 @@ export async function loadManifest(
|
|
|
194
215
|
const raw = mod?.default;
|
|
195
216
|
const baseManifest = parseIntegrationBase(raw, label);
|
|
196
217
|
const gapReport = parseGapReportHandlerExport(mod?.gapReport, label);
|
|
218
|
+
const discover = parseDiscoverSourceExport(mod?.discover, label);
|
|
197
219
|
const hasAgentDocs =
|
|
198
220
|
raw != null &&
|
|
199
221
|
typeof raw === 'object' &&
|
|
@@ -228,6 +250,8 @@ export async function loadManifest(
|
|
|
228
250
|
: undefined,
|
|
229
251
|
gapReport: gapReport.handler,
|
|
230
252
|
gapReportError: gapReport.error,
|
|
253
|
+
discover: discover.source,
|
|
254
|
+
discoverError: discover.error,
|
|
231
255
|
agentDocsError,
|
|
232
256
|
};
|
|
233
257
|
}
|
|
@@ -345,6 +369,10 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
345
369
|
let gapReportHandler;
|
|
346
370
|
/** @type {string | undefined} */
|
|
347
371
|
let gapReportError;
|
|
372
|
+
/** @type {import('../../authoring/discover/type').DiscoverSource | undefined} */
|
|
373
|
+
let discoverSource;
|
|
374
|
+
/** @type {string | undefined} */
|
|
375
|
+
let discoverError;
|
|
348
376
|
/** @type {string | undefined} */
|
|
349
377
|
let agentDocsError;
|
|
350
378
|
try {
|
|
@@ -354,6 +382,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
354
382
|
debug: debugHandler,
|
|
355
383
|
gapReport: gapReportHandler,
|
|
356
384
|
gapReportError,
|
|
385
|
+
discover: discoverSource,
|
|
386
|
+
discoverError,
|
|
357
387
|
agentDocsError,
|
|
358
388
|
} = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
|
|
359
389
|
} catch (err) {
|
|
@@ -397,6 +427,8 @@ export async function loadLocalIntegration(packageDir, {fresh = false} = {}) {
|
|
|
397
427
|
__debug: debugHandler,
|
|
398
428
|
__gapReport: gapReportHandler,
|
|
399
429
|
__gapReportError: gapReportError,
|
|
430
|
+
__discover: discoverSource,
|
|
431
|
+
__discoverError: discoverError,
|
|
400
432
|
__spec: spec,
|
|
401
433
|
__packageDir: packageDir,
|
|
402
434
|
__packageExports: pkg.exports ?? null,
|
|
@@ -448,6 +480,10 @@ export async function loadIntegrations(
|
|
|
448
480
|
let gapReportHandler;
|
|
449
481
|
/** @type {string | undefined} */
|
|
450
482
|
let gapReportError;
|
|
483
|
+
/** @type {import('../../authoring/discover/type').DiscoverSource | undefined} */
|
|
484
|
+
let discoverSource;
|
|
485
|
+
/** @type {string | undefined} */
|
|
486
|
+
let discoverError;
|
|
451
487
|
/** @type {string | undefined} */
|
|
452
488
|
let agentDocsError;
|
|
453
489
|
try {
|
|
@@ -457,6 +493,8 @@ export async function loadIntegrations(
|
|
|
457
493
|
debug: debugHandler,
|
|
458
494
|
gapReport: gapReportHandler,
|
|
459
495
|
gapReportError,
|
|
496
|
+
discover: discoverSource,
|
|
497
|
+
discoverError,
|
|
460
498
|
agentDocsError,
|
|
461
499
|
} = await loadManifest(manifestFile, `Integration ${spec}`, {fresh}));
|
|
462
500
|
} catch (err) {
|
|
@@ -507,6 +545,8 @@ export async function loadIntegrations(
|
|
|
507
545
|
__debug: debugHandler,
|
|
508
546
|
__gapReport: gapReportHandler,
|
|
509
547
|
__gapReportError: gapReportError,
|
|
548
|
+
__discover: discoverSource,
|
|
549
|
+
__discoverError: discoverError,
|
|
510
550
|
__spec: spec,
|
|
511
551
|
__packageDir: packageDir,
|
|
512
552
|
__packageExports: pkg.exports ?? null,
|
|
@@ -785,3 +785,34 @@ describe('the `gapReport` named export', () => {
|
|
|
785
785
|
expect(loaded.__unknownKeys).toEqual(['gapReport']);
|
|
786
786
|
});
|
|
787
787
|
});
|
|
788
|
+
|
|
789
|
+
describe('the `discover` named export', () => {
|
|
790
|
+
it('is carried out of the manifest module as __discover', async () => {
|
|
791
|
+
writeManifestPackage(tmpDir, {
|
|
792
|
+
body:
|
|
793
|
+
`export async function discover() { return {schemaVersion: 1}; }\n` +
|
|
794
|
+
`export default {issuesUrl: 'https://example.com/i'};\n`,
|
|
795
|
+
});
|
|
796
|
+
|
|
797
|
+
const [loaded] = await loadIntegrations(['@acme/widgets'], {cwd: tmpDir});
|
|
798
|
+
|
|
799
|
+
expect(typeof loaded.__discover).toBe('function');
|
|
800
|
+
expect(loaded.__discoverError).toBeUndefined();
|
|
801
|
+
expect(loaded.__unknownKeys).toEqual([]);
|
|
802
|
+
expect(loaded.issuesUrl).toBe('https://example.com/i');
|
|
803
|
+
});
|
|
804
|
+
|
|
805
|
+
it('keeps the manifest and records why when the export is not a function', async () => {
|
|
806
|
+
writeManifestPackage(tmpDir, {
|
|
807
|
+
body:
|
|
808
|
+
`export const discover = {url: 'https://example.com/catalog.json'};\n` +
|
|
809
|
+
`export default {issuesUrl: 'https://example.com/i'};\n`,
|
|
810
|
+
});
|
|
811
|
+
|
|
812
|
+
const [loaded] = await loadIntegrations(['@acme/widgets'], {cwd: tmpDir});
|
|
813
|
+
|
|
814
|
+
expect(loaded.__discover).toBeUndefined();
|
|
815
|
+
expect(loaded.__discoverError).toContain('must be a function');
|
|
816
|
+
expect(loaded.issuesUrl).toBe('https://example.com/i');
|
|
817
|
+
});
|
|
818
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* One complete row for an accepted selector.
|
|
6
|
+
*/
|
|
7
|
+
export type BatchRow<TResult, TCandidate> = ({
|
|
8
|
+
selector: string;
|
|
9
|
+
status: "found";
|
|
10
|
+
result: TResult;
|
|
11
|
+
} | {
|
|
12
|
+
selector: string;
|
|
13
|
+
status: "ambiguous";
|
|
14
|
+
code: string;
|
|
15
|
+
error: string;
|
|
16
|
+
candidates: TCandidate[];
|
|
17
|
+
} | {
|
|
18
|
+
selector: string;
|
|
19
|
+
status: "not_found" | "error";
|
|
20
|
+
code: string;
|
|
21
|
+
error: string;
|
|
22
|
+
suggestions?: import("./base").Suggestion[];
|
|
23
|
+
});
|
|
24
|
+
/**
|
|
25
|
+
* One ordered batch receipt inside the shared `{type, data}` success envelope.
|
|
26
|
+
*/
|
|
27
|
+
export type BatchResponse<TType extends string, TResult, TCandidate> = {
|
|
28
|
+
type: TType;
|
|
29
|
+
data: {
|
|
30
|
+
count: number;
|
|
31
|
+
results: BatchRow<TResult, TCandidate>[];
|
|
32
|
+
};
|
|
33
|
+
};
|