@astryxdesign/cli 0.6.3 → 0.6.4-canary.0e1fbdb
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 +194 -0
- package/README.md +152 -107
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/_adapter.d.mts +50 -0
- package/api/build/_adapter.mjs +60 -0
- package/api/build/build.doc.mjs +22 -10
- package/api/build/build.test.mjs +219 -8
- package/api/build/build.type.d.mts +91 -2
- package/api/build/build.type.mjs +52 -8
- package/api/build/help/help.d.mts +12 -5
- package/api/build/help/help.mjs +69 -6
- package/api/build/kit/kit.d.mts +4 -1
- package/api/build/kit/kit.mjs +208 -53
- package/api/build/kit/rank.d.mts +44 -0
- package/api/build/kit/rank.mjs +432 -0
- package/api/build/kit/rank.test.mjs +196 -0
- package/api/component/_adapter.d.mts +31 -12
- package/api/component/_adapter.mjs +79 -15
- package/api/component/component.d.mts +6 -3
- package/api/component/component.doc.mjs +49 -19
- package/api/component/component.mjs +339 -22
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +47 -11
- package/api/component/component.type.mjs +76 -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 +40 -11
- 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 +62 -18
- package/api/discover/discover.mjs +220 -36
- package/api/discover/discover.test.mjs +11 -2
- package/api/discover/discover.type.d.mts +150 -11
- package/api/discover/discover.type.mjs +107 -17
- 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 +277 -41
- package/api/docs/_adapter.mjs +993 -108
- package/api/docs/compiled-topics.test.mjs +78 -0
- package/api/docs/detail/detail.mjs +22 -63
- package/api/docs/detail/section/section.d.mts +1 -1
- package/api/docs/detail/section/section.mjs +54 -19
- package/api/docs/detail/section/section.test.mjs +50 -0
- package/api/docs/docOverlays.test.mjs +27 -1
- package/api/docs/docs.d.mts +10 -3
- package/api/docs/docs.doc.mjs +55 -16
- package/api/docs/docs.mjs +53 -10
- package/api/docs/docs.type.d.mts +221 -5
- package/api/docs/docs.type.mjs +153 -11
- package/api/docs/index/index.d.mts +18 -0
- package/api/docs/index/index.mjs +40 -0
- package/api/docs/index/index.test.mjs +62 -0
- package/api/docs/list/list.mjs +28 -12
- package/api/docs/node/node.d.mts +43 -0
- package/api/docs/node/node.mjs +192 -0
- package/api/docs/reference-blocks.test.mjs +406 -0
- package/api/doctor/doctor.d.mts +104 -1
- package/api/doctor/doctor.doc.mjs +18 -8
- package/api/doctor/doctor.mjs +635 -7
- package/api/doctor/doctor.test.mjs +732 -11
- package/api/doctor/doctor.type.d.mts +1 -1
- package/api/doctor/doctor.type.mjs +1 -1
- package/api/gap-report/gap-report.doc.mjs +27 -14
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +7 -3
- package/api/hook/hook.type.d.mts +3 -3
- package/api/hook/hook.type.mjs +11 -11
- package/api/hook/list/list.d.mts +2 -2
- package/api/hook/list/list.mjs +69 -17
- package/api/index.d.mts +2 -1
- package/api/index.mjs +6 -3
- package/api/init/init.doc.mjs +22 -12
- 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.d.mts +2 -1
- package/api/integration/add-contribution.mjs +130 -15
- package/api/integration/add-contribution.test.mjs +258 -7
- package/api/integration/add-helpers.d.mts +5 -2
- package/api/integration/add-helpers.mjs +36 -9
- package/api/integration/add-theme.mjs +56 -65
- package/api/integration/add-theme.test.mjs +139 -21
- package/api/integration/authoring-checks.mjs +138 -28
- package/api/integration/authoring-checks.test.mjs +179 -7
- package/api/integration/authoring-checks.type.mjs +6 -1
- package/api/integration/integration-authoring.type.d.mts +3 -1
- package/api/integration/integration-authoring.type.mjs +2 -0
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +14 -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 +8 -1
- 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 +2 -1
- package/api/integration/integrationPackCheck.doc.mjs +5 -4
- package/api/integration/integrationTemplateConflicts.doc.d.mts +3 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +4 -0
- package/api/integration/pack-check.lifecycle-output.test.mjs +107 -0
- package/api/integration/pack-check.mjs +160 -11
- package/api/integration/pack-check.test.mjs +477 -47
- package/api/integration/pack-check.type.d.mts +26 -2
- package/api/integration/pack-check.type.mjs +15 -2
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/template-conflict-compatibility.test.mjs +73 -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 +179 -26
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +3 -2
- package/api/json/assertResponse.doc.mjs +2 -1
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/index.ts +2 -0
- package/api/json/isError.doc.mjs +2 -1
- package/api/json/parseResponse.doc.mjs +3 -2
- package/api/layout/_adapter.mjs +20 -5
- 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 +89 -12
- package/api/search/search.doc.mjs +8 -2
- package/api/search/search.mjs +697 -97
- package/api/search/search.type.d.mts +15 -3
- package/api/search/search.type.mjs +5 -2
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +8 -5
- package/api/swizzle/swizzle.type.d.mts +2 -2
- package/api/swizzle/swizzle.type.mjs +2 -2
- package/api/template/copy/copy.mjs +18 -24
- package/api/template/copy/copy.test.mjs +26 -0
- package/api/template/list/list.mjs +1 -0
- package/api/template/table-floating-bulk-actions.test.mjs +66 -0
- package/api/template/template-integration.test.mjs +1072 -3
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.d.mts +1 -1
- package/api/template/template.doc.mjs +32 -9
- package/api/template/template.mjs +45 -8
- package/api/template/template.type.d.mts +12 -14
- package/api/template/template.type.mjs +15 -14
- 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 +31 -22
- package/api/theme/add/add.rollback.test.mjs +158 -0
- package/api/theme/add/add.staging.test.mjs +83 -0
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/build/build.family.test.mjs +7 -12
- package/api/theme/build/build.mjs +140 -59
- 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.rollback.test.mjs +148 -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 +2 -2
- 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 +20 -0
- package/api/theme/theme.type.d.mts +170 -11
- package/api/theme/theme.type.mjs +94 -27
- package/api/theme/themeAdd.doc.mjs +12 -12
- package/api/theme/themeBuild.doc.mjs +21 -17
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +6 -3
- package/api/theme/themePaletteGenerate.doc.mjs +16 -8
- package/api/theme/themeTargets.doc.mjs +4 -2
- package/api/theme/themeTemplate.doc.mjs +8 -3
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +139 -22
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/project-context.test.mjs +272 -0
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/files-changed.test.mjs +111 -0
- package/api/upgrade/run/run.mjs +358 -59
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +32 -23
- package/api/upgrade/upgrade.type.d.mts +43 -5
- package/api/upgrade/upgrade.type.mjs +29 -13
- package/assets/codemods/__tests__/registry.test.mjs +1 -0
- package/assets/codemods/__tests__/runner.test.mjs +332 -8
- package/assets/codemods/file-count.test.mjs +163 -0
- package/assets/codemods/integration-discovery.mjs +48 -4
- package/assets/codemods/integration-discovery.test.mjs +73 -0
- package/assets/codemods/integration-runner.mjs +59 -7
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/registry.mjs +1 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +353 -104
- 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/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/codemods/transforms/v0.6.4/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/v0.6.4/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/v0.6.4/index.mjs +31 -0
- package/assets/codemods/transforms/v0.6.4/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/v0.6.4/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/docs/README.md +12 -1
- package/assets/docs/authoring.doc.mjs +14 -0
- 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 +6 -17
- package/assets/docs/icons.doc.mjs +2 -21
- package/assets/docs/illustrations.doc.mjs +7 -15
- package/assets/docs/internationalization.doc.mjs +7 -5
- package/assets/docs/layout.doc.dense.mjs +132 -84
- package/assets/docs/layout.doc.mjs +134 -78
- 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 +14 -6
- 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 +10 -6
- package/assets/docs/styling.doc.mjs +22 -26
- package/assets/docs/theme.doc.dense.mjs +58 -18
- package/assets/docs/theme.doc.mjs +60 -50
- package/assets/docs/theme.doc.zh.mjs +9 -8
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +390 -9
- 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/api.doc.mjs +30 -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/cli.doc.mjs +23 -0
- package/assets/docs/tree/codemods.doc.mjs +147 -0
- package/assets/docs/tree/commands.doc.mjs +25 -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 +40 -0
- 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 +109 -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 +149 -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 +161 -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 +34 -26
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.doc.mjs +1 -1
- package/assets/templates/blocks/components/CheckboxList/CheckboxListSelectAllPattern.tsx +1 -3
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
- package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
- 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/blocks/components/Table/TableBulkActionsTable.doc.mjs +14 -0
- package/assets/templates/blocks/components/Table/TableBulkActionsTable.tsx +71 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.doc.mjs +19 -0
- package/assets/templates/blocks/components/Table/TableFloatingBulkActionsTable.tsx +139 -0
- package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
- package/assets/templates/blocks/components/Timer/TimerFormats.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerFormats.tsx +34 -0
- package/assets/templates/blocks/components/Timer/TimerInline.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerInline.tsx +14 -0
- package/assets/templates/blocks/components/Timer/TimerShowcase.doc.mjs +13 -0
- package/assets/templates/blocks/components/Timer/TimerShowcase.tsx +47 -0
- package/assets/templates/blocks/components/Timer/TimerTypography.doc.mjs +14 -0
- package/assets/templates/blocks/components/Timer/TimerTypography.tsx +31 -0
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.doc.mjs +19 -3
- package/assets/templates/blocks/components/Toolbar/ToolbarTableFilter.tsx +383 -65
- 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/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +11 -3
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/parse.d.mts +15 -13
- package/authoring/config/parse.mjs +27 -8
- package/authoring/config/parse.test.mjs +8 -0
- package/authoring/config/type.ts +29 -6
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/debug/parse.d.mts +8 -8
- package/authoring/debug/parse.mjs +3 -3
- 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 +792 -24
- package/authoring/doctypes/_schema.mjs +549 -39
- package/authoring/doctypes/base/graph-fields.doc.d.mts +9 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +64 -0
- package/authoring/doctypes/base/type.ts +43 -0
- package/authoring/doctypes/command/command.doc.mjs +4 -3
- package/authoring/doctypes/command/parse.d.mts +2 -2
- package/authoring/doctypes/command/parse.mjs +1 -1
- package/authoring/doctypes/command/type.ts +5 -4
- package/authoring/doctypes/component/component.doc.mjs +12 -3
- package/authoring/doctypes/component/parse.d.mts +2 -2
- package/authoring/doctypes/component/parse.mjs +1 -1
- package/authoring/doctypes/component/type.ts +14 -5
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/parse.d.mts +2 -2
- package/authoring/doctypes/enum/parse.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +4 -2
- package/authoring/doctypes/function/function.doc.mjs +7 -2
- package/authoring/doctypes/function/parse.d.mts +2 -2
- package/authoring/doctypes/function/parse.mjs +1 -1
- package/authoring/doctypes/function/type.ts +9 -4
- package/authoring/doctypes/hook/hook.doc.mjs +4 -0
- package/authoring/doctypes/hook/parse.d.mts +2 -2
- package/authoring/doctypes/hook/parse.mjs +1 -1
- package/authoring/doctypes/hook/type.ts +5 -4
- package/authoring/doctypes/legacy.d.mts +8 -6
- package/authoring/doctypes/legacy.mjs +5 -4
- package/authoring/doctypes/load-contract.test.mjs +233 -0
- package/authoring/doctypes/namespace/namespace.doc.d.mts +9 -0
- package/authoring/doctypes/namespace/namespace.doc.mjs +128 -0
- package/authoring/doctypes/namespace/parse.d.mts +12 -0
- package/authoring/doctypes/namespace/parse.mjs +25 -0
- package/authoring/doctypes/namespace/parse.test.mjs +163 -0
- package/authoring/doctypes/namespace/type.ts +74 -0
- package/authoring/doctypes/parse.d.mts +22 -18
- package/authoring/doctypes/parse.mjs +22 -11
- package/authoring/doctypes/parse.test.mjs +77 -3
- package/authoring/doctypes/reference/parse.d.mts +2 -2
- package/authoring/doctypes/reference/parse.mjs +8 -5
- package/authoring/doctypes/reference/reference.doc.mjs +55 -6
- package/authoring/doctypes/reference/type.ts +75 -7
- package/authoring/doctypes/schema/parse.d.mts +2 -2
- package/authoring/doctypes/schema/parse.mjs +1 -1
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/schema/type.ts +4 -4
- package/authoring/doctypes/template/parse.d.mts +94 -1
- package/authoring/doctypes/template/parse.mjs +40 -2
- package/authoring/doctypes/template/parse.test.mjs +26 -2
- package/authoring/doctypes/template/template.doc.mjs +13 -3
- package/authoring/doctypes/template/type.ts +13 -2
- package/authoring/doctypes/theme/parse.d.mts +35 -0
- package/authoring/doctypes/theme/parse.mjs +76 -0
- package/authoring/doctypes/theme/theme.doc.d.mts +9 -0
- package/authoring/doctypes/theme/theme.doc.mjs +79 -0
- package/authoring/doctypes/theme/type.ts +42 -0
- package/authoring/doctypes/types.ts +12 -10
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/gap-report/parse.d.mts +10 -10
- package/authoring/gap-report/parse.mjs +6 -6
- package/authoring/gap-report/type.ts +1 -1
- package/authoring/identity/identity.doc.d.mts +9 -0
- package/authoring/identity/identity.doc.mjs +61 -0
- package/authoring/identity/type.ts +132 -0
- package/authoring/index.d.mts +3 -0
- package/authoring/index.d.ts +62 -17
- package/authoring/index.mjs +4 -1
- package/authoring/integration/integration.doc.mjs +22 -13
- package/authoring/integration/parse.d.mts +2 -2
- package/authoring/integration/parse.mjs +1 -1
- package/authoring/integration/parse.test.mjs +10 -1
- package/authoring/integration/schema.d.mts +6 -4
- package/authoring/integration/schema.mjs +9 -3
- package/authoring/integration/type.ts +19 -8
- package/authoring/shadcn/receipt.d.mts +6 -6
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.adaptations.test.mjs +100 -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 +16 -50
- 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 +16 -8
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +137 -114
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +81 -0
- package/clients/cli/commands/component/index.mjs +153 -61
- package/clients/cli/commands/component-batch.test.mjs +341 -0
- package/clients/cli/commands/component-ownership.test.mjs +92 -3
- 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 +28 -10
- 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 +52 -5
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +55 -9
- package/clients/cli/commands/discover.mjs +393 -118
- package/clients/cli/commands/discover.sources.test.mjs +267 -0
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/docs.doc.mjs +28 -6
- package/clients/cli/commands/docs.mjs +295 -38
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +6 -5
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +15 -8
- 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 +143 -8
- package/clients/cli/commands/doctor.doc.mjs +4 -2
- package/clients/cli/commands/doctor.mjs +108 -37
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +27 -15
- 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 +24 -10
- 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 +39 -13
- package/clients/cli/commands/integration-authoring.test.mjs +74 -19
- package/clients/cli/commands/integration-pack.doc.mjs +6 -10
- package/clients/cli/commands/integration-real-world.test.mjs +4 -10
- package/clients/cli/commands/integration-verify.doc.mjs +22 -0
- package/clients/cli/commands/integration.doc.mjs +5 -5
- package/clients/cli/commands/integration.mjs +75 -43
- 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 +2 -2
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +16 -6
- package/clients/cli/commands/search.mjs +49 -11
- package/clients/cli/commands/search.test.mjs +92 -0
- package/clients/cli/commands/setup-nudge.test.mjs +6 -0
- package/clients/cli/commands/swizzle.doc.mjs +4 -3
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +53 -14
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.mjs +4 -91
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/text-json-parity.test.mjs +725 -0
- package/clients/cli/commands/theme-add.doc.mjs +5 -4
- 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 +12 -7
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-palette.doc.mjs +2 -3
- package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
- package/clients/cli/commands/theme-targets.doc.mjs +3 -3
- 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 +3 -2
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +83 -12
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- 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/commands/upgrade.mjs +29 -7
- package/clients/cli/formatters/index.mjs +164 -1
- package/clients/cli/formatters/index.test.mjs +97 -0
- package/clients/cli/index.mjs +47 -34
- 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 +56 -6
- package/clients/cli/lib/define-command.test.mjs +54 -0
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +113 -0
- package/clients/cli/lib/hook-format.mjs +19 -10
- package/clients/cli/lib/json-shim.mjs +62 -16
- 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 +53 -6
- package/clients/cli/lib/manifest.test.mjs +22 -2
- package/clients/cli/lib/parse-error-format.test.mjs +81 -0
- package/foundation/agent-docs/agent-docs.d.mts +7 -2
- package/foundation/agent-docs/agent-docs.mjs +83 -13
- 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 +20 -11
- package/foundation/config/project.mjs +263 -91
- package/foundation/config/project.test.mjs +270 -21
- package/foundation/discovery/authoring-self-docs.d.mts +87 -0
- package/foundation/discovery/authoring-self-docs.mjs +237 -0
- package/foundation/discovery/authoring-self-docs.test.mjs +174 -0
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +119 -0
- package/foundation/discovery/cli-self-docs.mjs +504 -0
- package/foundation/discovery/cli-self-docs.test.mjs +395 -0
- package/foundation/discovery/component-discovery.d.mts +39 -1
- package/foundation/discovery/component-discovery.mjs +50 -1
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +119 -11
- package/foundation/discovery/docs-discovery.mjs +427 -108
- package/foundation/discovery/docs-discovery.test.mjs +386 -20
- package/foundation/discovery/docs-output-budget.d.mts +28 -0
- package/foundation/discovery/docs-output-budget.mjs +50 -0
- package/foundation/discovery/docs-section-key.d.mts +116 -0
- package/foundation/discovery/docs-section-key.mjs +322 -0
- package/foundation/discovery/docs-section-key.test.mjs +246 -0
- package/foundation/discovery/template-adapter.d.mts +113 -11
- 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 +774 -83
- package/foundation/discovery/template-adapter.test.mjs +57 -0
- package/foundation/discovery/template-conflict-release.d.mts +13 -0
- package/foundation/discovery/template-conflict-release.mjs +40 -0
- package/foundation/discovery/template-conflict-release.test.mjs +40 -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 +278 -0
- package/foundation/doc-compiler/bundle.test.mjs +266 -0
- package/foundation/doc-compiler/compile.d.mts +343 -0
- package/foundation/doc-compiler/compile.mjs +558 -0
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +305 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +714 -0
- package/foundation/doc-compiler/doc-loads.test.mjs +1643 -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 +291 -0
- package/foundation/doc-compiler/inputs.test.mjs +298 -0
- package/foundation/doc-compiler/ir.d.mts +22 -0
- package/foundation/doc-compiler/ir.mjs +471 -0
- package/foundation/doc-compiler/lenses.d.mts +36 -0
- package/foundation/doc-compiler/lenses.mjs +173 -0
- package/foundation/doc-compiler/links.d.mts +162 -0
- package/foundation/doc-compiler/links.mjs +294 -0
- package/foundation/doc-compiler/links.test.mjs +192 -0
- package/foundation/doc-compiler/lower-doc.test.mjs +495 -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 +127 -0
- package/foundation/doc-compiler/read.mjs +325 -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/doc-compiler/tree.d.mts +292 -0
- package/foundation/doc-compiler/tree.mjs +881 -0
- package/foundation/fs/file-protection.d.mts +33 -0
- package/foundation/fs/file-protection.mjs +825 -0
- package/foundation/fs/file-protection.test.mjs +250 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/identity/provider-identity.d.mts +90 -0
- package/foundation/identity/provider-identity.mjs +320 -0
- package/foundation/identity/provider-identity.test.mjs +254 -0
- package/foundation/identity/providers.d.mts +7 -0
- package/foundation/identity/providers.mjs +16 -0
- package/foundation/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -45
- package/foundation/integrations/autolink.test.mjs +1 -1
- package/foundation/integrations/cli-requirement.d.mts +65 -0
- package/foundation/integrations/cli-requirement.mjs +189 -0
- package/foundation/integrations/cli-requirement.test.mjs +89 -0
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +3 -2
- package/foundation/integrations/contribution-inventory.mjs +28 -25
- package/foundation/integrations/contribution-inventory.test.mjs +86 -27
- package/foundation/integrations/integration-warnings.d.mts +9 -2
- package/foundation/integrations/integration-warnings.mjs +52 -21
- package/foundation/integrations/integration-warnings.test.mjs +74 -1
- package/foundation/integrations/integrations.d.mts +63 -3
- package/foundation/integrations/integrations.mjs +122 -9
- package/foundation/integrations/integrations.test.mjs +415 -1
- package/foundation/integrations/provider-conflicts.test.mjs +125 -0
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.d.mts +2 -0
- package/foundation/integrations/validate-contributions.mjs +131 -29
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/batch.type.d.mts +33 -0
- package/foundation/response/batch.type.mjs +34 -0
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +19 -12
- package/foundation/response/error-codes.mjs +8 -2
- package/foundation/response/error-codes.test.mjs +166 -14
- package/foundation/response/json-contract.test.mjs +57 -17
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.d.mts +7 -2
- package/foundation/response/response-types.doc.mjs +69 -25
- package/foundation/response/response-types.doc.test.mjs +181 -0
- package/foundation/response/response.doc.mjs +12 -11
- package/foundation/text/string-utils.d.mts +8 -0
- package/foundation/text/string-utils.mjs +40 -10
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +4 -3
- package/foundation/xle/expand.test.mjs +54 -0
- package/foundation/xle/xle.test.mjs +13 -0
- package/package.json +10 -11
- package/api/docs/docs.test.mjs +0 -83
- package/api/docs/integrationDocs.test.mjs +0 -208
- package/api/search/search.test.mjs +0 -389
- package/assets/docs/cli-integrations.doc.mjs +0 -367
- package/assets/templates/themes/manifest.json +0 -95
- package/clients/cli/commands/docs.test.mjs +0 -102
- 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
- package/foundation/agent-docs/agent-docs.test.mjs +0 -1141
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file The build subject's environment access: the page templates a project
|
|
5
|
+
* can scaffold.
|
|
6
|
+
*
|
|
7
|
+
* @input Template discovery for `cwd` — the CLI's own templates plus any that
|
|
8
|
+
* the project's configured integrations contribute.
|
|
9
|
+
* @output Ready page templates as `{name, displayName, description, category,
|
|
10
|
+
* command}`, where `command` is the `astryx template` command that selects
|
|
11
|
+
* exactly that template.
|
|
12
|
+
* @position Beside build.mjs (api/build/). The kit leaf reads templates only
|
|
13
|
+
* through here, because a subject's `_adapter.mjs` is its only environment
|
|
14
|
+
* access. Search keeps its own discovery; this adds none of its own, it
|
|
15
|
+
* reuses the template subject's.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import {discoverTemplates} from '../template/template.mjs';
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* A page template the kit can recommend starting from.
|
|
22
|
+
* @typedef {object} PageTemplate
|
|
23
|
+
* @property {string} name The template's own id, as search reports it.
|
|
24
|
+
* @property {string} command `astryx template <id> --type page`, the command that selects exactly this template: an integration replacement is selected by the Core id it replaces, and `--type page` keeps a block with the same id from making it ambiguous. Search prints template commands the same way.
|
|
25
|
+
* @property {string} displayName Human-facing name.
|
|
26
|
+
* @property {string} description What the page is: its layout and the ideas it serves.
|
|
27
|
+
* @property {string} category The template's own `Family - Variant` label; empty when it declares none.
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Every ready page template the project can scaffold, in discovery order. This
|
|
32
|
+
* is the default discovery view: an active integration replacement stands in
|
|
33
|
+
* for the Core template it replaces, as it does for `astryx template <id>`.
|
|
34
|
+
*
|
|
35
|
+
* Discovery failures leave the kit without a start rather than failing the
|
|
36
|
+
* command: the kit still carries its search matches, and `template --list`
|
|
37
|
+
* reports what went wrong.
|
|
38
|
+
*
|
|
39
|
+
* @param {string} cwd
|
|
40
|
+
* @returns {Promise<PageTemplate[]>}
|
|
41
|
+
*/
|
|
42
|
+
export async function loadPageTemplates(cwd) {
|
|
43
|
+
let templates;
|
|
44
|
+
try {
|
|
45
|
+
templates = await discoverTemplates(cwd);
|
|
46
|
+
} catch {
|
|
47
|
+
return [];
|
|
48
|
+
}
|
|
49
|
+
return templates
|
|
50
|
+
.filter(t => t.type === 'page' && t.isReady !== false)
|
|
51
|
+
.map(t => ({
|
|
52
|
+
name: t.dirName,
|
|
53
|
+
displayName: t.displayName || t.name,
|
|
54
|
+
description: t.description || '',
|
|
55
|
+
category: t.category || '',
|
|
56
|
+
// The id `template()` resolves back to this entry: an active replacement
|
|
57
|
+
// owns the Core id it names, so that id selects it, not its own.
|
|
58
|
+
command: `astryx template ${t.replaces ?? t.dirName} --type page`,
|
|
59
|
+
}));
|
|
60
|
+
}
|
package/api/build/build.doc.mjs
CHANGED
|
@@ -11,15 +11,19 @@ export const doc = {
|
|
|
11
11
|
type: 'function',
|
|
12
12
|
kind: 'api',
|
|
13
13
|
name: 'build',
|
|
14
|
+
namespace: 'cli/api',
|
|
14
15
|
displayName: 'build()',
|
|
15
16
|
summary:
|
|
16
|
-
'Page-building assistant: the how-to-build playbook, or
|
|
17
|
+
'Page-building assistant: the how-to-build playbook, or the page template to start from for an idea.',
|
|
17
18
|
description:
|
|
18
|
-
'The "
|
|
19
|
-
'playbook
|
|
20
|
-
'
|
|
21
|
-
'
|
|
22
|
-
'and
|
|
19
|
+
'The "build a page" entry point. Called with no query it returns the ' +
|
|
20
|
+
'how-to-build-a-page playbook as data: the workflow steps with their ' +
|
|
21
|
+
'commands, the on-system rules, and related lookups. Called with a query it names the page template to ' +
|
|
22
|
+
'START from (always one: the page template a ranker built for long descriptions puts first, else the app ' +
|
|
23
|
+
'shell) and the next two templates, ' +
|
|
24
|
+
'and the unified search grouped around it: the other close page templates, drop-in blocks, and ' +
|
|
25
|
+
'idea-specific components/hooks, plus the always-on frame + foundation. A template carries the page ' +
|
|
26
|
+
'frame and spacing, so the kit never recommends composing a page from components.',
|
|
23
27
|
importPath: '@astryxdesign/cli/api',
|
|
24
28
|
signature:
|
|
25
29
|
'build(query?: string, options?: BuildOptions): Promise<BuildHelpResponse | BuildKitResponse>',
|
|
@@ -36,6 +40,7 @@ export const doc = {
|
|
|
36
40
|
type: 'string',
|
|
37
41
|
description:
|
|
38
42
|
'Directory to resolve @astryxdesign/core and templates from.',
|
|
43
|
+
default: 'process.cwd()',
|
|
39
44
|
},
|
|
40
45
|
{
|
|
41
46
|
name: 'options.type',
|
|
@@ -54,23 +59,30 @@ export const doc = {
|
|
|
54
59
|
{
|
|
55
60
|
type: 'build.help',
|
|
56
61
|
description:
|
|
57
|
-
'Emitted when the query is omitted:
|
|
62
|
+
'Emitted when the query is omitted: the page-building playbook — `playbook: true`, a `title`, the ordered `steps` (each a `title`, its `commands`, and optionally what the step `returns`), the on-system `rules`, and `related` lookups. Each command is a bare subcommand ({command, purpose?}) for the caller to render with its own CLI invocation.',
|
|
58
63
|
},
|
|
59
64
|
{
|
|
60
65
|
type: 'build.kit',
|
|
61
66
|
description:
|
|
62
|
-
|
|
67
|
+
"The page template to start from and the kit around it: the echoed query, hasResults/matchCount/directMatch fields, `start` (the template to scaffold, the `template <id> --type page <path>` command that selects it, whether the page ranker's pick is also search's direct match, the closest page, or the fallback app shell, and the ranker's next two `alternatives`), search's closest page templates (≤3), drop-in block patterns (≤5), idea-specific components/hooks (≤6), and the always-on frame + foundation component-name arrays. Carries `hint` only when the kit came back thin — what to try instead, so a caller does not read a near-empty kit as \"the package has nothing\".",
|
|
63
68
|
},
|
|
64
69
|
],
|
|
65
70
|
throws: [
|
|
66
71
|
{
|
|
67
72
|
code: 'ERR_INVALID_ARGUMENT',
|
|
68
|
-
when: 'options.type is not a known domain, or options.limit is not a positive integer',
|
|
73
|
+
when: 'a query is given and options.type is not a known domain, or options.limit is not a positive integer',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
code: 'ERR_CORE_NOT_FOUND',
|
|
77
|
+
when: 'a query is given and @astryxdesign/core cannot be found from cwd',
|
|
69
78
|
},
|
|
70
79
|
],
|
|
71
80
|
examples: [
|
|
72
81
|
{label: 'Get the playbook', code: 'const r = await build();'},
|
|
73
|
-
{
|
|
82
|
+
{
|
|
83
|
+
label: 'Find the template to start from',
|
|
84
|
+
code: "const {data} = await build('analytics dashboard');\n// data.start.command: 'astryx template dashboard --type page <path>'",
|
|
85
|
+
},
|
|
74
86
|
{
|
|
75
87
|
label: 'Restrict + limit',
|
|
76
88
|
code: "await build('pricing', {type: 'template', limit: 10});",
|
package/api/build/build.test.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Tests for the build API (playbook
|
|
4
|
+
* @file Tests for the build API (playbook + the template-first kit).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {describe, it, expect, vi} from 'vitest';
|
|
@@ -20,10 +20,30 @@ const REPO = path.resolve(
|
|
|
20
20
|
vi.setConfig({testTimeout: 30000});
|
|
21
21
|
|
|
22
22
|
describe('build API', () => {
|
|
23
|
-
it('no query → build.help playbook
|
|
23
|
+
it('no query → build.help carries the playbook as data', async () => {
|
|
24
24
|
const r = await build();
|
|
25
25
|
expect(r.type).toBe('build.help');
|
|
26
|
-
|
|
26
|
+
if (r.type !== 'build.help') return;
|
|
27
|
+
expect(r.data.playbook).toBe(true);
|
|
28
|
+
expect(r.data.title).toMatch(/build a page/i);
|
|
29
|
+
expect(r.data.steps.length).toBeGreaterThan(0);
|
|
30
|
+
for (const step of r.data.steps) {
|
|
31
|
+
expect(step.title).toBeTruthy();
|
|
32
|
+
expect(step.commands.length).toBeGreaterThan(0);
|
|
33
|
+
}
|
|
34
|
+
expect(r.data.rules.length).toBeGreaterThan(0);
|
|
35
|
+
// Bare subcommands: the caller adds its own invocation.
|
|
36
|
+
const commands = [...r.data.steps.flatMap(s => s.commands), ...r.data.related];
|
|
37
|
+
for (const {command} of commands) expect(command).not.toMatch(/^(astryx|npx|pnpm|yarn|bunx?)\b/);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('the playbook scaffolds the named template before composing', async () => {
|
|
41
|
+
const r = await build();
|
|
42
|
+
if (r.type !== 'build.help') throw new Error(r.type);
|
|
43
|
+
const commands = r.data.steps.map(s => s.commands.map(c => c.command));
|
|
44
|
+
expect(commands[0][0]).toMatch(/^build /);
|
|
45
|
+
expect(commands[1]).toContain('template <name> <path>');
|
|
46
|
+
expect(JSON.stringify(r.data)).not.toMatch(/--skeleton|reference code/);
|
|
27
47
|
});
|
|
28
48
|
|
|
29
49
|
it('query → build.kit with raw entries + static frame/foundation', async () => {
|
|
@@ -65,10 +85,10 @@ describe('build API', () => {
|
|
|
65
85
|
expect(blocks.length).toBeLessThanOrEqual(5);
|
|
66
86
|
expect(domain.length).toBeLessThanOrEqual(6);
|
|
67
87
|
|
|
68
|
-
// Score floors: pages ≥ PAGE_FLOOR(50); blocks/domain ≥ DOMAIN_FLOOR(
|
|
88
|
+
// Score floors: pages ≥ PAGE_FLOOR(50); blocks/domain ≥ DOMAIN_FLOOR(60).
|
|
69
89
|
for (const p of pages) expect(p.score).toBeGreaterThanOrEqual(50);
|
|
70
|
-
for (const b of blocks) expect(b.score).toBeGreaterThanOrEqual(
|
|
71
|
-
for (const d of domain) expect(d.score).toBeGreaterThanOrEqual(
|
|
90
|
+
for (const b of blocks) expect(b.score).toBeGreaterThanOrEqual(60);
|
|
91
|
+
for (const d of domain) expect(d.score).toBeGreaterThanOrEqual(60);
|
|
72
92
|
|
|
73
93
|
// directMatch iff the top page is a confident match (PAGE_DIRECT = 95).
|
|
74
94
|
expect(directMatch).toBe(pages.length > 0 && pages[0].score >= 95);
|
|
@@ -159,6 +179,28 @@ describe('build kit — coverage gates the pages group', () => {
|
|
|
159
179
|
}
|
|
160
180
|
});
|
|
161
181
|
|
|
182
|
+
it('does not call a page that only mentions every word a direct match', async () => {
|
|
183
|
+
// `empty state` and `command palette` name components. A page whose text
|
|
184
|
+
// mentions both words, or that renders the component, is a layout
|
|
185
|
+
// reference, not the page the reader asked for.
|
|
186
|
+
for (const query of ['empty state', 'command palette']) {
|
|
187
|
+
const r = await build(query, {cwd: REPO});
|
|
188
|
+
if (r.type !== 'build.kit') throw new Error('expected build.kit');
|
|
189
|
+
expect(r.data.directMatch, query).toBe(false);
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
it('keeps the page and component a query names first', async () => {
|
|
194
|
+
const pageOf = async (/** @type {string} */ query) => {
|
|
195
|
+
const r = await build(query, {cwd: REPO});
|
|
196
|
+
if (r.type !== 'build.kit') throw new Error('expected build.kit');
|
|
197
|
+
return r.data;
|
|
198
|
+
};
|
|
199
|
+
expect((await pageOf('checkout flow')).pages[0]).toMatchObject({name: 'checkout-wizard'});
|
|
200
|
+
expect((await pageOf('sign in with sso')).pages[0]).toMatchObject({name: 'login-sso'});
|
|
201
|
+
expect((await pageOf('search results')).domain.map(e => e.name)).toContain('PowerSearch');
|
|
202
|
+
});
|
|
203
|
+
|
|
162
204
|
it('leaves single-concept queries alone (nothing to cover)', async () => {
|
|
163
205
|
const r = await build('dashboard', {cwd: REPO});
|
|
164
206
|
expect(r.type).toBe('build.kit');
|
|
@@ -190,7 +232,7 @@ describe('build kit — a thin kit says what to try next', () => {
|
|
|
190
232
|
it('hints for a matched-then-filtered query: hasResults true, nothing offerable', async () => {
|
|
191
233
|
// The case most likely to be misread, and the reason the threshold counts
|
|
192
234
|
// what SURVIVED the floors rather than what search returned.
|
|
193
|
-
const r = await build('
|
|
235
|
+
const r = await build('hydration', {cwd: REPO});
|
|
194
236
|
expect(r.type).toBe('build.kit');
|
|
195
237
|
if (r.type !== 'build.kit') return;
|
|
196
238
|
expect(r.data.hasResults).toBe(true);
|
|
@@ -213,12 +255,28 @@ describe('build kit — a thin kit says what to try next', () => {
|
|
|
213
255
|
}
|
|
214
256
|
});
|
|
215
257
|
|
|
258
|
+
it('still starts from the closest page on a loose match, and scaffolds it', async () => {
|
|
259
|
+
// A skeleton is a 35-line excerpt: a reader who studies it and composes
|
|
260
|
+
// the rest loses the spacing the template exists to carry. A loose match
|
|
261
|
+
// is still the best start there is, so `start` scaffolds it.
|
|
262
|
+
const r = await build('executive summary', {cwd: REPO});
|
|
263
|
+
expect(r.type).toBe('build.kit');
|
|
264
|
+
if (r.type !== 'build.kit') return;
|
|
265
|
+
expect(r.data.directMatch).toBe(false);
|
|
266
|
+
expect(r.data.start).toMatchObject({
|
|
267
|
+
name: 'dashboard-scorecard',
|
|
268
|
+
basis: 'closest',
|
|
269
|
+
command: 'astryx template dashboard-scorecard --type page <path>',
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
216
273
|
it('recommends scaffolding on a direct match', async () => {
|
|
217
274
|
const r = await build('contact form', {cwd: REPO});
|
|
218
275
|
expect(r.type).toBe('build.kit');
|
|
219
276
|
if (r.type !== 'build.kit') return;
|
|
220
277
|
expect(r.data.directMatch).toBe(true);
|
|
221
278
|
expect(r.data.pages.length).toBeGreaterThan(0);
|
|
279
|
+
expect(r.data.start).toMatchObject({name: r.data.pages[0].name, basis: 'direct'});
|
|
222
280
|
for (const page of r.data.pages) {
|
|
223
281
|
expect(page.command).not.toMatch(/--skeleton/);
|
|
224
282
|
}
|
|
@@ -227,12 +285,13 @@ describe('build kit — a thin kit says what to try next', () => {
|
|
|
227
285
|
it('keeps the recommendation package-manager-agnostic', async () => {
|
|
228
286
|
// Appending a flag must not turn into prefixing an invocation; that stays
|
|
229
287
|
// the renderer's job.
|
|
230
|
-
const r = await build('
|
|
288
|
+
const r = await build('executive summary', {cwd: REPO});
|
|
231
289
|
expect(r.type).toBe('build.kit');
|
|
232
290
|
if (r.type !== 'build.kit') return;
|
|
233
291
|
for (const page of r.data.pages) {
|
|
234
292
|
expect(page.command).not.toMatch(/^(pnpm|npm|yarn|bun|npx)\b/);
|
|
235
293
|
}
|
|
294
|
+
expect(r.data.start?.command).not.toMatch(/^(pnpm|npm|yarn|bun|npx)\b/);
|
|
236
295
|
});
|
|
237
296
|
|
|
238
297
|
it('keeps recovery commands bare, for the caller to render', async () => {
|
|
@@ -247,3 +306,155 @@ describe('build kit — a thin kit says what to try next', () => {
|
|
|
247
306
|
}
|
|
248
307
|
});
|
|
249
308
|
});
|
|
309
|
+
|
|
310
|
+
describe('build kit — every page starts from a template', () => {
|
|
311
|
+
it('falls back to the app shell when no page template matches', async () => {
|
|
312
|
+
// Before, an unmatched idea got "compose from AppShell": the one path
|
|
313
|
+
// with no frame, no spacing, and no section rhythm.
|
|
314
|
+
const r = await build('zzznomatch99', {cwd: REPO});
|
|
315
|
+
expect(r.type).toBe('build.kit');
|
|
316
|
+
if (r.type !== 'build.kit') return;
|
|
317
|
+
expect(r.data.hasResults).toBe(false);
|
|
318
|
+
expect(r.data.start).toMatchObject({
|
|
319
|
+
name: 'shell-top-nav',
|
|
320
|
+
basis: 'fallback',
|
|
321
|
+
command: 'astryx template shell-top-nav --type page <path>',
|
|
322
|
+
});
|
|
323
|
+
expect(r.data.start?.description).toBeTruthy();
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('starts a long idea from the family its words name', async () => {
|
|
327
|
+
// The coverage gate cannot tell layout words from subject matter: every
|
|
328
|
+
// dashboard covers one term of three, so search offers no page at all.
|
|
329
|
+
// The ranker still starts the page from the dashboard.
|
|
330
|
+
const r = await build('quarterly revenue dashboard', {cwd: REPO});
|
|
331
|
+
expect(r.type).toBe('build.kit');
|
|
332
|
+
if (r.type !== 'build.kit') return;
|
|
333
|
+
expect(r.data.start).toMatchObject({name: 'dashboard', basis: 'closest'});
|
|
334
|
+
expect(r.data.directMatch).toBe(false);
|
|
335
|
+
});
|
|
336
|
+
|
|
337
|
+
it('does not start from a direct match that is not ready yet, and says so', async () => {
|
|
338
|
+
const r = await build('incident console', {cwd: REPO});
|
|
339
|
+
expect(r.type).toBe('build.kit');
|
|
340
|
+
if (r.type !== 'build.kit') return;
|
|
341
|
+
expect(r.data.directMatch).toBe(true);
|
|
342
|
+
expect(r.data.pages[0].name).toBe('incident-console');
|
|
343
|
+
expect(r.data.start?.name).not.toBe('incident-console');
|
|
344
|
+
expect(r.data.start?.reason).toMatch(/`incident-console` matches but is not ready yet/);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
it('does not start from a page that matched one incidental word', async () => {
|
|
348
|
+
// A work-item detail page mentions a feed in its description. That is a
|
|
349
|
+
// worse start for a news feed than the app shell.
|
|
350
|
+
const r = await build('news feed', {cwd: REPO});
|
|
351
|
+
expect(r.type).toBe('build.kit');
|
|
352
|
+
if (r.type !== 'build.kit') return;
|
|
353
|
+
expect(r.data.start?.basis).toBe('fallback');
|
|
354
|
+
});
|
|
355
|
+
|
|
356
|
+
it('starts a part from the page it is placed in, else from the app shell', async () => {
|
|
357
|
+
const placed = await build('an empty state for a settings page', {cwd: REPO});
|
|
358
|
+
if (placed.type !== 'build.kit') throw new Error(placed.type);
|
|
359
|
+
expect(placed.data.start).toMatchObject({name: 'settings', basis: 'closest'});
|
|
360
|
+
const loose = await build('a date range picker', {cwd: REPO});
|
|
361
|
+
if (loose.type !== 'build.kit') throw new Error(loose.type);
|
|
362
|
+
expect(loose.data.start).toMatchObject({name: 'shell-top-nav', basis: 'fallback'});
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
it('names a direct match the ranker outweighed in the reason', async () => {
|
|
366
|
+
const r = await build('dashboard with a login form', {cwd: REPO});
|
|
367
|
+
if (r.type !== 'build.kit') throw new Error(r.type);
|
|
368
|
+
expect(r.data.directMatch).toBe(true);
|
|
369
|
+
expect(r.data.pages[0].name).toBe('login');
|
|
370
|
+
expect(r.data.start).toMatchObject({name: 'dashboard', basis: 'closest'});
|
|
371
|
+
expect(r.data.start?.reason).toContain('`login`');
|
|
372
|
+
});
|
|
373
|
+
|
|
374
|
+
it('names the loose page matches when it falls back to the shell', async () => {
|
|
375
|
+
const r = await build('news feed', {cwd: REPO});
|
|
376
|
+
if (r.type !== 'build.kit') throw new Error(r.type);
|
|
377
|
+
expect(r.data.pages.length).toBeGreaterThan(0);
|
|
378
|
+
expect(r.data.start?.basis).toBe('fallback');
|
|
379
|
+
for (const page of r.data.pages) expect(r.data.start?.reason).toContain(`\`${page.name}\``);
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
it('never gives a reason that denies a match the response reports', async () => {
|
|
383
|
+
for (const q of ['news feed', 'dashboard with a login form', 'user profile', 'incident console']) {
|
|
384
|
+
const r = await build(q, {cwd: REPO});
|
|
385
|
+
if (r.type !== 'build.kit') throw new Error(r.type);
|
|
386
|
+
if (r.data.pages.length) expect(r.data.start?.reason).not.toMatch(/No template matched/);
|
|
387
|
+
if (r.data.directMatch) expect(r.data.start?.reason).not.toMatch(/none is exactly this page/);
|
|
388
|
+
}
|
|
389
|
+
});
|
|
390
|
+
|
|
391
|
+
it('names no start when the kit is narrowed to components', async () => {
|
|
392
|
+
const r = await build('dashboard', {cwd: REPO, type: 'component'});
|
|
393
|
+
expect(r.type).toBe('build.kit');
|
|
394
|
+
if (r.type !== 'build.kit') return;
|
|
395
|
+
expect(r.data.start).toBeNull();
|
|
396
|
+
});
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
it('keeps incidental description matches out of blocks and components', async () => {
|
|
401
|
+
// Toast, Popover and TextInput all say "brief" somewhere in their
|
|
402
|
+
// descriptions; none of them is part of a brief.
|
|
403
|
+
const r = await build('weekly brief', {cwd: REPO});
|
|
404
|
+
expect(r.type).toBe('build.kit');
|
|
405
|
+
if (r.type !== 'build.kit') return;
|
|
406
|
+
const names = [...r.data.blocks, ...r.data.domain].map(e => e.name);
|
|
407
|
+
for (const noise of ['Toast', 'Popover', 'TextInput']) expect(names).not.toContain(noise);
|
|
408
|
+
});
|
|
409
|
+
|
|
410
|
+
it('names the ranker\'s next two templates beside every start', async () => {
|
|
411
|
+
for (const idea of ['quarterly revenue dashboard', 'contact form']) {
|
|
412
|
+
const r = await build(idea, {cwd: REPO});
|
|
413
|
+
expect(r.type).toBe('build.kit');
|
|
414
|
+
if (r.type !== 'build.kit') return;
|
|
415
|
+
const alternatives = r.data.start?.alternatives ?? [];
|
|
416
|
+
expect(alternatives.length).toBeGreaterThan(0);
|
|
417
|
+
expect(alternatives.length).toBeLessThanOrEqual(2);
|
|
418
|
+
for (const alt of alternatives) {
|
|
419
|
+
expect(alt.name).not.toBe(r.data.start?.name);
|
|
420
|
+
expect(alt.description).toBeTruthy();
|
|
421
|
+
expect(alt.command).toBe(`astryx template ${alt.name} --type page <path>`);
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
});
|
|
425
|
+
|
|
426
|
+
it('calls a start direct only when search and the ranker agree', async () => {
|
|
427
|
+
const r = await build('contact form', {cwd: REPO});
|
|
428
|
+
expect(r.type).toBe('build.kit');
|
|
429
|
+
if (r.type !== 'build.kit') return;
|
|
430
|
+
expect(r.data.directMatch).toBe(true);
|
|
431
|
+
expect(r.data.start).toMatchObject({name: r.data.pages[0].name, basis: 'direct'});
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
it('never lets a noisy search match pick the start', async () => {
|
|
435
|
+
// Search once matched "site" to the gallery's "side" and started a
|
|
436
|
+
// navigation bar from a gallery. The ranker alone picks the start now.
|
|
437
|
+
const r = await build('horizontal site navigation with a current section indicator', {cwd: REPO});
|
|
438
|
+
expect(r.type).toBe('build.kit');
|
|
439
|
+
if (r.type !== 'build.kit') return;
|
|
440
|
+
expect(r.data.start?.name).toBe('shell-top-nav');
|
|
441
|
+
expect(r.data.pages.map(p => p.name)).not.toContain('side-gallery');
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
it('starts a component in a container from a template with that frame', async () => {
|
|
445
|
+
// "in a modal": the modal is the frame, so the dialog template leads
|
|
446
|
+
// instead of the app shell.
|
|
447
|
+
const r = await build('saved drafts in a modal with resume and delete row actions', {cwd: REPO});
|
|
448
|
+
expect(r.type).toBe('build.kit');
|
|
449
|
+
if (r.type !== 'build.kit') return;
|
|
450
|
+
expect(r.data.start?.name).toBe('settings-dialog');
|
|
451
|
+
});
|
|
452
|
+
|
|
453
|
+
it('does not start from a template named only by a word that modifies another', async () => {
|
|
454
|
+
// "product" describes the response; it is not a product page.
|
|
455
|
+
const r = await build('an interactive command catalog with side-by-side product response and trace', {cwd: REPO});
|
|
456
|
+
expect(r.type).toBe('build.kit');
|
|
457
|
+
if (r.type !== 'build.kit') return;
|
|
458
|
+
expect(r.data.start?.name).not.toMatch(/^product-/);
|
|
459
|
+
});
|
|
460
|
+
});
|
|
@@ -2,16 +2,104 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A command the playbook tells the caller to run.
|
|
6
|
+
*/
|
|
7
|
+
export type BuildPlaybookCommand = {
|
|
8
|
+
/**
|
|
9
|
+
* Bare subcommand with `<placeholder>` arguments (e.g. `template <name> <path>`) and no package-manager prefix — render it with your own CLI invocation.
|
|
10
|
+
*/
|
|
11
|
+
command: string;
|
|
12
|
+
/**
|
|
13
|
+
* What running it is for.
|
|
14
|
+
*/
|
|
15
|
+
purpose?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One step of the page-building workflow.
|
|
19
|
+
*/
|
|
20
|
+
export type BuildPlaybookStep = {
|
|
21
|
+
/**
|
|
22
|
+
* What to do.
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
/**
|
|
26
|
+
* The commands for this step, in the order to run them.
|
|
27
|
+
*/
|
|
28
|
+
commands: BuildPlaybookCommand[];
|
|
29
|
+
/**
|
|
30
|
+
* What the step's command gives back, when that decides the next step.
|
|
31
|
+
*/
|
|
32
|
+
returns?: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* astryx --json build (no query) — the "how to build a page" playbook.
|
|
6
36
|
*/
|
|
7
37
|
export type BuildHelpResponse = {
|
|
8
38
|
type: "build.help";
|
|
9
39
|
data: {
|
|
10
40
|
playbook: true;
|
|
41
|
+
title: string;
|
|
42
|
+
steps: BuildPlaybookStep[];
|
|
43
|
+
rules: string[];
|
|
44
|
+
related: BuildPlaybookCommand[];
|
|
11
45
|
};
|
|
12
46
|
};
|
|
13
47
|
/**
|
|
14
|
-
*
|
|
48
|
+
* The page template a kit recommends starting from.
|
|
49
|
+
*/
|
|
50
|
+
export type BuildStart = {
|
|
51
|
+
/**
|
|
52
|
+
* Template id, as `astryx template <name>` takes it.
|
|
53
|
+
*/
|
|
54
|
+
name: string;
|
|
55
|
+
/**
|
|
56
|
+
* Human-facing template name.
|
|
57
|
+
*/
|
|
58
|
+
displayName: string;
|
|
59
|
+
/**
|
|
60
|
+
* What the page is: its layout and the ideas it serves.
|
|
61
|
+
*/
|
|
62
|
+
description: string;
|
|
63
|
+
/**
|
|
64
|
+
* The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is a placeholder for the file or folder to write the template to, and the `astryx` prefix is for the caller to replace with its own invocation.
|
|
65
|
+
*/
|
|
66
|
+
command: string;
|
|
67
|
+
/**
|
|
68
|
+
* Why this template. The page ranker picks every start: it weighs each matched word by how rare it is among page templates, favors the family the idea's head names and the container it names ("in a modal"), and discounts words that only modify another. `direct` when its pick is also search's direct match (`directMatch`); `closest` when it is not; `fallback` when no template has the evidence to lead and the page starts from the app shell.
|
|
69
|
+
*/
|
|
70
|
+
basis: "direct" | "closest" | "fallback";
|
|
71
|
+
/**
|
|
72
|
+
* One sentence saying the same as `basis`, for a reader.
|
|
73
|
+
*/
|
|
74
|
+
reason: string;
|
|
75
|
+
/**
|
|
76
|
+
* The ranker's next closest page templates (≤2), for when the start's layout is wrong.
|
|
77
|
+
*/
|
|
78
|
+
alternatives: BuildAlternative[];
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* A page template to consider instead of the start.
|
|
82
|
+
*/
|
|
83
|
+
export type BuildAlternative = {
|
|
84
|
+
/**
|
|
85
|
+
* Template id, as `astryx template <name>` takes it.
|
|
86
|
+
*/
|
|
87
|
+
name: string;
|
|
88
|
+
/**
|
|
89
|
+
* Human-facing template name.
|
|
90
|
+
*/
|
|
91
|
+
displayName: string;
|
|
92
|
+
/**
|
|
93
|
+
* What the page is: its layout and the ideas it serves.
|
|
94
|
+
*/
|
|
95
|
+
description: string;
|
|
96
|
+
/**
|
|
97
|
+
* The scaffold command, in the same form as the start's.
|
|
98
|
+
*/
|
|
99
|
+
command: string;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* astryx --json build "<idea>" — the page template to start from, and the kit around it.
|
|
15
103
|
*
|
|
16
104
|
* Entries are raw `SearchResultEntry` objects (no package-manager-prefixed
|
|
17
105
|
* command strings — the CLI adds those); `frame`/`foundation` are static
|
|
@@ -24,6 +112,7 @@ export type BuildKitResponse = {
|
|
|
24
112
|
hasResults: boolean;
|
|
25
113
|
matchCount: number;
|
|
26
114
|
directMatch: boolean;
|
|
115
|
+
start: BuildStart | null;
|
|
27
116
|
pages: import("../search/search.type.mjs").SearchResultEntry[];
|
|
28
117
|
blocks: import("../search/search.type.mjs").SearchResultEntry[];
|
|
29
118
|
domain: import("../search/search.type.mjs").SearchResultEntry[];
|
package/api/build/build.type.mjs
CHANGED
|
@@ -2,21 +2,64 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Colocated types for the `build` command — source of truth for the
|
|
5
|
-
* `build.help` (playbook
|
|
6
|
-
* responses. Re-exported by types/build.d.ts.
|
|
5
|
+
* `build.help` (playbook) and `build.kit` (composition kit) JSON responses.
|
|
7
6
|
*/
|
|
8
7
|
|
|
9
8
|
/**
|
|
10
|
-
*
|
|
9
|
+
* A command the playbook tells the caller to run.
|
|
10
|
+
*
|
|
11
|
+
* @typedef {object} BuildPlaybookCommand
|
|
12
|
+
* @property {string} command Bare subcommand with `<placeholder>` arguments (e.g. `template <name> <path>`) and no package-manager prefix — render it with your own CLI invocation.
|
|
13
|
+
* @property {string} [purpose] What running it is for.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* One step of the page-building workflow.
|
|
18
|
+
*
|
|
19
|
+
* @typedef {object} BuildPlaybookStep
|
|
20
|
+
* @property {string} title What to do.
|
|
21
|
+
* @property {BuildPlaybookCommand[]} commands The commands for this step, in the order to run them.
|
|
22
|
+
* @property {string} [returns] What the step's command gives back, when that decides the next step.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* astryx --json build (no query) — the "how to build a page" playbook.
|
|
11
27
|
*
|
|
12
28
|
* @typedef {object} BuildHelpResponse
|
|
13
29
|
* @property {'build.help'} type
|
|
14
30
|
* @property {object} data
|
|
15
31
|
* @property {true} data.playbook Always true; marks this envelope as the playbook rather than a result set.
|
|
32
|
+
* @property {string} data.title The playbook's heading.
|
|
33
|
+
* @property {BuildPlaybookStep[]} data.steps The workflow, in order.
|
|
34
|
+
* @property {string[]} data.rules The rules that keep a page on-system.
|
|
35
|
+
* @property {BuildPlaybookCommand[]} data.related Lookups to reach for alongside the workflow.
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The page template a kit recommends starting from.
|
|
40
|
+
*
|
|
41
|
+
* @typedef {object} BuildStart
|
|
42
|
+
* @property {string} name Template id, as `astryx template <name>` takes it.
|
|
43
|
+
* @property {string} displayName Human-facing template name.
|
|
44
|
+
* @property {string} description What the page is: its layout and the ideas it serves.
|
|
45
|
+
* @property {string} command The scaffold command that selects exactly this template, `astryx template <id> --type page <path>`: `<id>` is the Core id an integration replacement stands in for, else the template's own id, `<path>` is a placeholder for the file or folder to write the template to, and the `astryx` prefix is for the caller to replace with its own invocation.
|
|
46
|
+
* @property {'direct' | 'closest' | 'fallback'} basis Why this template. The page ranker picks every start: it weighs each matched word by how rare it is among page templates, favors the family the idea's head names and the container it names ("in a modal"), and discounts words that only modify another. `direct` when its pick is also search's direct match (`directMatch`); `closest` when it is not; `fallback` when no template has the evidence to lead and the page starts from the app shell.
|
|
47
|
+
* @property {string} reason One sentence saying the same as `basis`, for a reader.
|
|
48
|
+
* @property {BuildAlternative[]} alternatives The ranker's next closest page templates (≤2), for when the start's layout is wrong.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* A page template to consider instead of the start.
|
|
53
|
+
*
|
|
54
|
+
* @typedef {object} BuildAlternative
|
|
55
|
+
* @property {string} name Template id, as `astryx template <name>` takes it.
|
|
56
|
+
* @property {string} displayName Human-facing template name.
|
|
57
|
+
* @property {string} description What the page is: its layout and the ideas it serves.
|
|
58
|
+
* @property {string} command The scaffold command, in the same form as the start's.
|
|
16
59
|
*/
|
|
17
60
|
|
|
18
61
|
/**
|
|
19
|
-
*
|
|
62
|
+
* astryx --json build "<idea>" — the page template to start from, and the kit around it.
|
|
20
63
|
*
|
|
21
64
|
* Entries are raw `SearchResultEntry` objects (no package-manager-prefixed
|
|
22
65
|
* command strings — the CLI adds those); `frame`/`foundation` are static
|
|
@@ -26,14 +69,15 @@
|
|
|
26
69
|
* @property {'build.kit'} type
|
|
27
70
|
* @property {object} data
|
|
28
71
|
* @property {string} data.query
|
|
29
|
-
* @property {boolean} data.hasResults False when search returned nothing
|
|
72
|
+
* @property {boolean} data.hasResults False when search returned nothing. The kit still names a template in `start`.
|
|
30
73
|
* @property {number} data.matchCount Total ranked search matches for the query — counted before the search `limit`, the kit's score floors, and its per-group caps, so it is never a cap read back.
|
|
31
74
|
* @property {boolean} data.directMatch True when the top page template is a confident direct match.
|
|
32
|
-
* @property {
|
|
75
|
+
* @property {BuildStart | null} data.start The page template to start from: the ranker's pick, else the app shell. Null only when the kit is narrowed to components or hooks (`type`), or when the project has no page template to offer.
|
|
76
|
+
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.pages Closest page templates by search (≤3). Each entry's `command` carries `--skeleton` when `directMatch` is false, so it previews the layout; `start.command` is the scaffold.
|
|
33
77
|
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.blocks Drop-in block patterns covering parts of the idea (≤5).
|
|
34
78
|
* @property {import('../search/search.type.mjs').SearchResultEntry[]} data.domain Idea-specific components/hooks (≤6), excluding frame/foundation.
|
|
35
|
-
* @property {string[]} data.frame Always-on page-shell component names.
|
|
36
|
-
* @property {string[]} data.foundation Always-on layout/typography/action component names.
|
|
79
|
+
* @property {string[]} data.frame Always-on page-shell component names. Every page template already uses them.
|
|
80
|
+
* @property {string[]} data.foundation Always-on layout/typography/action component names. Every page template already uses them.
|
|
37
81
|
* @property {{reason: string, commands: string[]}} [data.hint] Present only when the kit is thin. `reason` says why, `commands` are bare subcommands (e.g. `component --list`) for the caller to render with its own invocation — so a reader is never handed a command that does not resolve in their project.
|
|
38
82
|
*/
|
|
39
83
|
|
|
@@ -2,14 +2,21 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @file build.help leaf — the "how to build a page" playbook
|
|
5
|
+
* @file build.help leaf — the "how to build a page" playbook.
|
|
6
6
|
*
|
|
7
|
-
* `build` with no query returns this envelope
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `build` with no query returns this envelope. The playbook is data — steps,
|
|
8
|
+
* rules, and related lookups — so a `--json` or programmatic caller gets the
|
|
9
|
+
* same guidance the terminal shows. Commands are bare subcommands with no
|
|
10
|
+
* package-manager prefix, which keeps the JSON environment-agnostic; the CLI
|
|
11
|
+
* renders each one with the caller's invocation, as it does build.kit's
|
|
12
|
+
* `hint.commands`.
|
|
13
|
+
*
|
|
14
|
+
* The workflow starts every page from a template, because a template already
|
|
15
|
+
* has the frame, spacing, and section rhythm that a page composed from
|
|
16
|
+
* components has to rediscover.
|
|
10
17
|
*/
|
|
11
18
|
/**
|
|
12
|
-
* The page-building playbook
|
|
19
|
+
* The page-building playbook (emitted when `build` runs with no query).
|
|
13
20
|
*
|
|
14
21
|
* @returns {import('../build.type.mjs').BuildHelpResponse}
|
|
15
22
|
*/
|