@astryxdesign/cli 0.6.4-canary.f0355e3 → 0.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -99
- package/api/build/build.doc.mjs +1 -6
- package/api/build/build.test.mjs +0 -22
- package/api/build/kit/kit.mjs +5 -44
- package/api/component/_adapter.d.mts +0 -25
- package/api/component/_adapter.mjs +5 -59
- package/api/component/component.d.mts +3 -6
- package/api/component/component.doc.mjs +17 -37
- package/api/component/component.mjs +9 -249
- package/api/component/component.type.d.mts +0 -25
- package/api/component/component.type.mjs +0 -44
- package/api/discover/_adapter.d.mts +6 -114
- package/api/discover/_adapter.mjs +17 -372
- package/api/discover/detail/detail.d.mts +6 -18
- package/api/discover/detail/detail.mjs +13 -67
- package/api/discover/detail/detail.test.mjs +0 -85
- package/api/discover/discover.d.mts +9 -3
- package/api/discover/discover.doc.mjs +18 -61
- package/api/discover/discover.mjs +36 -220
- package/api/discover/discover.test.mjs +2 -11
- package/api/discover/discover.type.d.mts +8 -147
- package/api/discover/discover.type.mjs +12 -102
- package/api/discover/list/list.d.mts +6 -20
- package/api/discover/list/list.mjs +12 -45
- package/api/discover/list/list.test.mjs +0 -46
- package/api/discover/search/search.d.mts +16 -18
- package/api/discover/search/search.mjs +56 -102
- package/api/discover/search/search.test.mjs +10 -144
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +6 -14
- package/api/docs/docOverlays.test.mjs +1 -27
- package/api/docs/docs.doc.mjs +2 -2
- package/api/docs/docs.test.mjs +243 -0
- package/api/docs/integration-tree.test.mjs +555 -0
- package/api/docs/integrationDocs.test.mjs +314 -0
- package/api/doctor/doctor.d.mts +3 -8
- package/api/doctor/doctor.doc.mjs +8 -17
- package/api/doctor/doctor.mjs +9 -90
- package/api/doctor/doctor.test.mjs +10 -122
- 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 +10 -19
- package/api/hook/hook.doc.mjs +3 -6
- package/api/index.d.mts +2 -1
- package/api/index.mjs +5 -5
- package/api/init/init.doc.mjs +12 -17
- package/api/integration/add-helpers.d.mts +2 -5
- package/api/integration/add-helpers.mjs +9 -36
- package/api/integration/add-theme.mjs +1 -22
- package/api/integration/add-theme.test.mjs +0 -34
- package/api/integration/authoring-checks.mjs +2 -2
- package/api/integration/integrationPackCheck.doc.mjs +3 -3
- package/api/integration/pack-check.mjs +9 -82
- package/api/integration/pack-check.test.mjs +0 -90
- package/api/integration/pack-check.type.mjs +1 -1
- package/api/json/assertResponse.doc.mjs +1 -1
- package/api/json/index.ts +1 -0
- package/api/json/isError.doc.mjs +1 -1
- package/api/layout/_adapter.d.mts +34 -0
- package/api/layout/_adapter.mjs +148 -0
- package/api/layout/check/check.d.mts +16 -0
- package/api/layout/check/check.mjs +40 -0
- package/api/layout/expand/expand.d.mts +22 -0
- package/api/layout/expand/expand.mjs +155 -0
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.d.mts +13 -0
- package/api/layout/grammar/grammar.mjs +87 -0
- package/api/layout/layout.d.mts +6 -0
- package/api/layout/layout.mjs +17 -0
- package/api/layout/layout.test.mjs +297 -0
- package/api/layout/layout.type.d.mts +89 -0
- package/api/layout/layout.type.mjs +103 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +85 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +107 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +57 -0
- package/api/search/search.d.mts +1 -27
- package/api/search/search.doc.mjs +2 -2
- package/api/search/search.mjs +16 -228
- package/api/search/search.test.mjs +512 -0
- package/api/swizzle/swizzle.doc.mjs +5 -7
- package/api/template/copy/copy.mjs +1 -1
- package/api/template/copy/copy.test.mjs +0 -9
- package/api/template/template-integration.test.mjs +65 -1
- package/api/template/template.doc.mjs +1 -2
- package/api/template/template.mjs +1 -1
- package/api/theme/add/add.mjs +25 -17
- package/api/theme/add/add.staging.test.mjs +23 -40
- package/api/theme/build/build.family.test.mjs +12 -7
- package/api/theme/build/build.mjs +18 -8
- package/api/theme/generateTonalPalette.doc.mjs +2 -1
- package/api/theme/listThemes.doc.mjs +1 -1
- package/api/theme/themeAdd.doc.mjs +10 -9
- package/api/theme/themeBuild.doc.mjs +13 -13
- package/api/theme/themeList.doc.mjs +1 -1
- package/api/theme/themeListAvailable.doc.mjs +1 -2
- package/api/theme/themePaletteGenerate.doc.mjs +8 -15
- package/api/theme/themeTargets.doc.mjs +2 -3
- package/api/theme/themeTemplate.doc.mjs +1 -2
- package/api/upgrade/run/run.mjs +4 -6
- package/api/upgrade/upgrade.doc.mjs +22 -24
- package/api/upgrade/upgrade.type.mjs +2 -2
- package/assets/codemods/__tests__/runner.test.mjs +1 -3
- package/assets/codemods/integration-runner.mjs +3 -3
- package/assets/codemods/runner.mjs +4 -5
- package/assets/docs/README.md +2 -4
- package/assets/docs/browser-support.doc.mjs +11 -11
- package/assets/docs/color.doc.mjs +2 -8
- package/assets/docs/elevation.doc.mjs +4 -6
- package/assets/docs/getting-started.doc.mjs +16 -5
- package/assets/docs/icons.doc.mjs +21 -2
- package/assets/docs/illustrations.doc.mjs +15 -7
- package/assets/docs/internationalization.doc.mjs +5 -7
- package/assets/docs/layout.doc.dense.mjs +82 -130
- package/assets/docs/layout.doc.mjs +77 -133
- package/assets/docs/migration.doc.mjs +21 -19
- package/assets/docs/motion.doc.mjs +3 -16
- package/assets/docs/principles.doc.dense.mjs +5 -5
- package/assets/docs/principles.doc.mjs +0 -8
- package/assets/docs/principles.doc.zh.mjs +6 -6
- package/assets/docs/shape.doc.mjs +3 -8
- package/assets/docs/spacing.doc.mjs +2 -7
- package/assets/docs/styling-libraries.doc.mjs +2 -6
- package/assets/docs/styling.doc.mjs +23 -19
- package/assets/docs/theme.doc.dense.mjs +18 -58
- package/assets/docs/theme.doc.mjs +46 -56
- package/assets/docs/theme.doc.zh.mjs +8 -9
- package/assets/docs/tokens.doc.dense.mjs +2 -2
- package/assets/docs/tokens.doc.mjs +8 -389
- package/assets/docs/tokens.doc.zh.mjs +2 -2
- package/assets/docs/tree/integrations.doc.mjs +451 -25
- package/assets/docs/tree/integrations.test.mjs +62 -0
- package/assets/docs/tree/writing-docs.doc.mjs +286 -0
- package/assets/docs/typography.doc.mjs +4 -24
- package/assets/docs/working-with-ai.doc.mjs +22 -30
- package/assets/templates/blocks/components/InternationalizationProvider/InternationalizationProvider01ShippedLocale.tsx +1 -1
- package/authoring/config/config.doc.mjs +2 -10
- package/authoring/config/parse.d.mts +0 -2
- package/authoring/config/parse.mjs +0 -19
- package/authoring/config/parse.test.mjs +0 -8
- package/authoring/config/type.ts +2 -13
- package/authoring/doctypes/_schema.d.mts +2 -3
- package/authoring/doctypes/_schema.mjs +0 -6
- package/authoring/doctypes/base/graph-fields.doc.mjs +3 -3
- package/authoring/doctypes/base/type.ts +2 -4
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/component.doc.mjs +0 -6
- package/authoring/doctypes/component/type.ts +0 -8
- package/authoring/doctypes/reference/reference.doc.mjs +0 -7
- package/authoring/doctypes/reference/type.ts +0 -5
- package/authoring/doctypes/schema/schema.doc.mjs +2 -2
- package/authoring/doctypes/template/template.doc.mjs +1 -1
- package/authoring/doctypes/template/type.ts +2 -2
- package/authoring/index.d.mts +0 -1
- package/authoring/index.d.ts +0 -10
- package/authoring/index.mjs +0 -1
- package/authoring/integration/integration.doc.mjs +10 -12
- package/clients/cli/command-result-coverage.test.mjs +7 -7
- package/clients/cli/commands/component/index.mjs +55 -152
- package/clients/cli/commands/component-ownership.test.mjs +0 -89
- package/clients/cli/commands/component.doc.mjs +9 -27
- package/clients/cli/commands/debug-result-summary.test.mjs +2 -2
- package/clients/cli/commands/discover.doc.mjs +9 -53
- package/clients/cli/commands/discover.mjs +118 -393
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/docs.mjs +17 -60
- package/clients/cli/commands/docs.test.mjs +294 -0
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +2 -3
- package/clients/cli/commands/doctor-integration.test.mjs +0 -53
- package/clients/cli/commands/doctor.doc.mjs +1 -3
- package/clients/cli/commands/doctor.mjs +5 -49
- package/clients/cli/commands/gap-report.doc.mjs +9 -10
- package/clients/cli/commands/init.doc.mjs +6 -9
- package/clients/cli/commands/integration-add.doc.mjs +9 -9
- package/clients/cli/commands/integration-authoring.test.mjs +10 -61
- package/clients/cli/commands/integration-pack.doc.mjs +9 -5
- package/clients/cli/commands/integration-real-world.test.mjs +1 -1
- package/clients/cli/commands/integration.doc.mjs +4 -4
- package/clients/cli/commands/integration.mjs +43 -74
- package/clients/cli/commands/layout-check.doc.mjs +65 -0
- package/clients/cli/commands/layout-expand.doc.mjs +83 -0
- package/clients/cli/commands/layout-grammar.doc.mjs +30 -0
- package/clients/cli/commands/layout.doc.mjs +34 -0
- package/clients/cli/commands/layout.error-codes.test.mjs +66 -0
- package/clients/cli/commands/layout.exit-parity.test.mjs +41 -0
- package/clients/cli/commands/layout.mjs +275 -0
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +3 -10
- package/clients/cli/commands/search.mjs +2 -21
- package/clients/cli/commands/search.test.mjs +4 -21
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/text-json-parity.test.mjs +16 -5
- package/clients/cli/commands/theme-add.doc.mjs +1 -1
- package/clients/cli/commands/theme-palette-generate.doc.mjs +2 -3
- package/clients/cli/commands/theme-palette.doc.mjs +2 -1
- package/clients/cli/commands/theme-targets.doc.mjs +2 -2
- package/clients/cli/commands/theme.doc.mjs +1 -2
- package/clients/cli/commands/upgrade.doc.mjs +3 -62
- package/clients/cli/index.mjs +10 -28
- package/clients/cli/lib/define-command.mjs +4 -28
- package/clients/cli/lib/define-command.test.mjs +0 -54
- package/clients/cli/lib/exit-codes.test.mjs +9 -18
- package/clients/cli/lib/json-shim.mjs +14 -24
- package/clients/cli/lib/json-shim.test.mjs +20 -6
- package/clients/cli/lib/manifest.mjs +13 -18
- package/clients/cli/lib/manifest.test.mjs +2 -5
- package/foundation/agent-docs/agent-docs.mjs +1 -1
- package/foundation/agent-docs/agent-docs.test.mjs +1159 -0
- package/foundation/discovery/authoring-self-docs.mjs +0 -1
- package/foundation/discovery/authoring-self-docs.test.mjs +2 -6
- package/foundation/discovery/cli-self-docs.mjs +2 -16
- package/foundation/discovery/cli-self-docs.test.mjs +0 -20
- package/foundation/discovery/docs-discovery.mjs +1 -5
- package/foundation/discovery/docs-discovery.test.mjs +0 -21
- package/foundation/discovery/docs-section-key.d.mts +1 -1
- package/foundation/discovery/docs-section-key.mjs +1 -1
- package/foundation/discovery/template-adapter.mjs +1 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +14 -3
- package/foundation/doc-compiler/tree.d.mts +0 -4
- package/foundation/doc-compiler/tree.mjs +1 -6
- package/foundation/doc-compiler/tree.test.mjs +598 -0
- package/foundation/integrations/cli-requirement.d.mts +6 -26
- package/foundation/integrations/cli-requirement.mjs +11 -46
- package/foundation/integrations/cli-requirement.test.mjs +2 -7
- package/foundation/integrations/contribution-inventory.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +1 -14
- package/foundation/integrations/integrations.mjs +1 -41
- package/foundation/integrations/integrations.test.mjs +0 -31
- package/foundation/response/error-codes.doc.mjs +8 -6
- package/foundation/response/error-codes.test.mjs +5 -30
- package/foundation/response/response-types.doc.d.mts +3 -4
- package/foundation/response/response-types.doc.mjs +27 -40
- package/foundation/response/response-types.doc.test.mjs +0 -23
- package/foundation/response/response.doc.mjs +10 -11
- package/foundation/xle/browser.d.mts +3 -3
- package/foundation/xle/browser.mjs +3 -3
- package/foundation/xle/expand.mjs +2 -2
- package/foundation/xle/parse.mjs +1 -1
- package/foundation/xle/print.mjs +2 -2
- package/foundation/xle/splice.mjs +1 -1
- package/package.json +9 -9
- package/api/discover/_adapter.test.mjs +0 -215
- package/api/discover/_catalog-view.d.mts +0 -115
- package/api/discover/_catalog-view.mjs +0 -203
- package/api/discover/_catalog-view.test.mjs +0 -128
- package/api/discover/detail/item/item.d.mts +0 -26
- package/api/discover/detail/item/item.mjs +0 -78
- package/api/discover/detail/item/item.test.mjs +0 -73
- package/api/integration/pack-check.lifecycle-output.test.mjs +0 -107
- package/api/theme/add/add.rollback.test.mjs +0 -158
- package/api/theme/build/build.rollback.test.mjs +0 -148
- package/api/upgrade/run/files-changed.test.mjs +0 -111
- package/assets/codemods/file-count.test.mjs +0 -163
- package/assets/docs/tree/add-a-component.doc.mjs +0 -75
- package/assets/docs/tree/add-a-theme.doc.mjs +0 -85
- package/assets/docs/tree/add-a-topic.doc.mjs +0 -144
- package/assets/docs/tree/agent-guidance.doc.mjs +0 -138
- package/assets/docs/tree/block-template.doc.mjs +0 -130
- package/assets/docs/tree/build-the-template.doc.mjs +0 -28
- package/assets/docs/tree/building-blocks.doc.mjs +0 -46
- package/assets/docs/tree/check-your-docs.doc.mjs +0 -137
- package/assets/docs/tree/checks.doc.mjs +0 -119
- package/assets/docs/tree/codemods.doc.mjs +0 -147
- package/assets/docs/tree/component-family.doc.mjs +0 -113
- package/assets/docs/tree/component-imports.doc.mjs +0 -69
- package/assets/docs/tree/component-lookups.doc.mjs +0 -149
- package/assets/docs/tree/components.doc.mjs +0 -23
- package/assets/docs/tree/configuration.doc.mjs +0 -23
- package/assets/docs/tree/debug-and-gap-reports.doc.mjs +0 -182
- package/assets/docs/tree/define-the-theme.doc.mjs +0 -118
- package/assets/docs/tree/describe-the-component.doc.mjs +0 -57
- package/assets/docs/tree/docs.doc.mjs +0 -21
- package/assets/docs/tree/document-the-template.doc.mjs +0 -28
- package/assets/docs/tree/document-the-theme.doc.mjs +0 -68
- package/assets/docs/tree/export-template-assets.doc.mjs +0 -147
- package/assets/docs/tree/extend-or-replace.doc.mjs +0 -103
- package/assets/docs/tree/fonts-and-assets.doc.mjs +0 -106
- package/assets/docs/tree/generate-a-palette.doc.mjs +0 -66
- package/assets/docs/tree/grade-template-with-agent.doc.mjs +0 -105
- package/assets/docs/tree/help.doc.mjs +0 -16
- package/assets/docs/tree/links.doc.mjs +0 -98
- package/assets/docs/tree/package-and-test.doc.mjs +0 -32
- package/assets/docs/tree/page-template.doc.mjs +0 -71
- package/assets/docs/tree/publishing.doc.mjs +0 -111
- package/assets/docs/tree/quick-start.doc.mjs +0 -272
- package/assets/docs/tree/replace-a-core-component.doc.mjs +0 -104
- package/assets/docs/tree/replace-a-core-template.doc.mjs +0 -172
- package/assets/docs/tree/sections-and-placement.doc.mjs +0 -108
- package/assets/docs/tree/see-it-in-an-app.doc.mjs +0 -59
- package/assets/docs/tree/ship.doc.mjs +0 -16
- package/assets/docs/tree/short-and-findable.doc.mjs +0 -108
- package/assets/docs/tree/single-component.doc.mjs +0 -165
- package/assets/docs/tree/start-a-template.doc.mjs +0 -143
- package/assets/docs/tree/subcomponent.doc.mjs +0 -115
- package/assets/docs/tree/template-assets.doc.mjs +0 -64
- package/assets/docs/tree/template-doc-overview.doc.mjs +0 -109
- package/assets/docs/tree/template-fonts.doc.mjs +0 -102
- package/assets/docs/tree/template-grading-rubric.doc.mjs +0 -452
- package/assets/docs/tree/template-icons.doc.mjs +0 -97
- package/assets/docs/tree/template-images-media.doc.mjs +0 -127
- package/assets/docs/tree/template-styles.doc.mjs +0 -93
- package/assets/docs/tree/templates.doc.mjs +0 -34
- package/assets/docs/tree/test-in-an-app.doc.mjs +0 -115
- package/assets/docs/tree/test-template-in-app.doc.mjs +0 -128
- package/assets/docs/tree/themes.doc.mjs +0 -39
- package/assets/docs/tree/troubleshooting.doc.mjs +0 -149
- package/assets/docs/tree/upgrading.doc.mjs +0 -103
- package/assets/docs/tree/use-a-theme-in-an-app.doc.mjs +0 -51
- package/assets/docs/tree/verify-packed-template.doc.mjs +0 -77
- package/assets/docs/tree/versioning.doc.mjs +0 -161
- package/assets/docs/tree/write-good-templates.doc.mjs +0 -64
- package/assets/docs/tree/write-the-template-file.doc.mjs +0 -154
- package/authoring/discover/discover.doc.d.mts +0 -13
- package/authoring/discover/discover.doc.mjs +0 -138
- package/authoring/discover/parse.d.mts +0 -24
- package/authoring/discover/parse.mjs +0 -128
- package/authoring/discover/parse.test.mjs +0 -124
- package/authoring/discover/type.ts +0 -87
- package/clients/cli/commands/component-batch.test.mjs +0 -341
- package/clients/cli/commands/discover.sources.test.mjs +0 -267
- package/clients/cli/commands/integration-verify.doc.mjs +0 -22
- package/clients/cli/lib/parse-error-format.test.mjs +0 -81
- package/foundation/response/batch.type.d.mts +0 -33
- package/foundation/response/batch.type.mjs +0 -34
package/README.md
CHANGED
|
@@ -30,8 +30,7 @@ The CLI documents itself, so these commands print what the installed version doe
|
|
|
30
30
|
`astryx.integration.*` manifest, codemods, and every doc type (`ComponentDoc`,
|
|
31
31
|
`TemplateDoc`, `ThemeDoc`, and the rest). Read one section with
|
|
32
32
|
`astryx docs authoring <section>`, for example `astryx docs authoring config`.
|
|
33
|
-
- `astryx docs cli/integrations`: the
|
|
34
|
-
from a quick start to publishing.
|
|
33
|
+
- `astryx docs cli/integrations`: the guide to building an integration package.
|
|
35
34
|
- `astryx docs`: every docs topic, including the design-system guides (for
|
|
36
35
|
example `tokens`, `theme`, and `layout`).
|
|
37
36
|
|
|
@@ -78,36 +77,37 @@ Options:
|
|
|
78
77
|
|
|
79
78
|
<!-- BEGIN GENERATED: commands -->
|
|
80
79
|
|
|
81
|
-
| Command | Description
|
|
82
|
-
| ------------- |
|
|
83
|
-
| `blog` | Read the Astryx blog from the published feed
|
|
84
|
-
| `build` | Build a page: the template to start from, or the workflow playbook (no query)
|
|
85
|
-
| `component` | List components or print component docs
|
|
86
|
-
| `discover` |
|
|
87
|
-
| `docs` | Print reference docs
|
|
88
|
-
| `doctor` | Diagnose Astryx projects and integration packages
|
|
89
|
-
| `gap-report` |
|
|
90
|
-
| `hook` | List hooks or print hook docs
|
|
91
|
-
| `init` | Initialize the design system in your project
|
|
92
|
-
| `integration` | Author and verify an Astryx integration package
|
|
93
|
-
| `
|
|
94
|
-
| `
|
|
95
|
-
| `
|
|
96
|
-
| `
|
|
97
|
-
| `
|
|
80
|
+
| Command | Description |
|
|
81
|
+
| ------------- | ----------------------------------------------------------------------------- |
|
|
82
|
+
| `blog` | Read the Astryx blog from the published feed |
|
|
83
|
+
| `build` | Build a page: the template to start from, or the workflow playbook (no query) |
|
|
84
|
+
| `component` | List components or print component docs |
|
|
85
|
+
| `discover` | Discover external packages and components |
|
|
86
|
+
| `docs` | Print reference docs |
|
|
87
|
+
| `doctor` | Diagnose Astryx projects and integration packages |
|
|
88
|
+
| `gap-report` | Route a design-system gap to its owning package |
|
|
89
|
+
| `hook` | List hooks or print hook docs |
|
|
90
|
+
| `init` | Initialize the design system in your project |
|
|
91
|
+
| `integration` | Author and verify an Astryx integration package |
|
|
92
|
+
| `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) |
|
|
93
|
+
| `search` | Search components, hooks, docs, and templates in one ranked list |
|
|
94
|
+
| `swizzle` | Copy component source for customization |
|
|
95
|
+
| `template` | Inject a page or block template |
|
|
96
|
+
| `theme` | Theme tools: build, export, and manage themes |
|
|
97
|
+
| `upgrade` | Migrate versions and update ShadCN-copied compositions |
|
|
98
98
|
|
|
99
99
|
<!-- END GENERATED: commands -->
|
|
100
100
|
<!-- Generated by scripts/generate-cli-readme.mjs from `astryx manifest`. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
101
101
|
|
|
102
102
|
### Global options
|
|
103
103
|
|
|
104
|
-
|
|
104
|
+
These flags work with any command:
|
|
105
105
|
|
|
106
106
|
- `--json`: Output as typed JSON envelope: `{ apiVersion, type, data, meta? }` (errors: `{ apiVersion, error, code, suggestions? }`)
|
|
107
|
-
- `--detail <level>`: Detail level for
|
|
108
|
-
- `--zh`:
|
|
109
|
-
- `--dense`:
|
|
110
|
-
- `--lang <locale>`: Language
|
|
107
|
+
- `--detail <level>`: Detail level for list views, increasing in size: `brief` (names only, default for `--list`) < `compact` (names + 1-line descriptions) < `full` (full docs per entry). Single-item views default to `full`.
|
|
108
|
+
- `--zh`: Output docs in Chinese Simplified
|
|
109
|
+
- `--dense`: Compressed format (token-efficient, useful for AI agents)
|
|
110
|
+
- `--lang <locale>`: Language/format shorthand (`en`, `zh`, `dense`)
|
|
111
111
|
|
|
112
112
|
## JSON API
|
|
113
113
|
|
|
@@ -164,9 +164,9 @@ if (isError(result)) {
|
|
|
164
164
|
| `ERR_UNKNOWN` | Fallback for any error without a more specific code. |
|
|
165
165
|
| `ERR_UNKNOWN_COMMAND` | A top-level command name was not recognized (e.g. `astryx bogus`). |
|
|
166
166
|
| `ERR_UNKNOWN_SUBCOMMAND` | A subcommand under a command group was not recognized (e.g. `astryx theme bogus`). |
|
|
167
|
-
| `ERR_INVALID_OPTION` | An unknown option was passed
|
|
168
|
-
| `ERR_INVALID_ARGUMENT` | An argument
|
|
169
|
-
| `ERR_MISSING_ARGUMENT` | A required argument
|
|
167
|
+
| `ERR_INVALID_OPTION` | An unknown flag/option was passed (Commander `unknownOption`). |
|
|
168
|
+
| `ERR_INVALID_ARGUMENT` | An option/argument had a value Commander's parser rejected. |
|
|
169
|
+
| `ERR_MISSING_ARGUMENT` | A required positional argument was omitted (Commander `missingArgument`). |
|
|
170
170
|
| `ERR_INVALID_LANG` | `--lang` was given a value outside its choices (en, zh, dense). |
|
|
171
171
|
| `ERR_INVALID_DETAIL` | `--detail` was given a value outside its choices (full, compact, brief). |
|
|
172
172
|
| `ERR_NODE_VERSION` | The running Node.js version is below the supported minimum. |
|
|
@@ -184,8 +184,8 @@ if (isError(result)) {
|
|
|
184
184
|
| `ERR_UNKNOWN_THEME` | No theme matched the requested slug (theme add). |
|
|
185
185
|
| `ERR_INTEGRATION_ROOT_CONFLICT` | An integration manifest already declares a different path for the requested contribution root. |
|
|
186
186
|
| `ERR_INTEGRATION_EXPORT_CONFLICT` | A package export already maps a generated contribution subpath to a different target. |
|
|
187
|
-
| `ERR_UNKNOWN_PACKAGE` | No package matched the requested name.
|
|
188
|
-
| `ERR_UNKNOWN_AGENT` | An unrecognized `--agent` value was passed to init.
|
|
187
|
+
| `ERR_UNKNOWN_PACKAGE` | No package matched the requested name (discover). |
|
|
188
|
+
| `ERR_UNKNOWN_AGENT` | An unrecognized `--agent` value was passed to agent-docs/init. |
|
|
189
189
|
| `ERR_UNKNOWN_FEATURE` | An unrecognized `--features` value was passed to init. |
|
|
190
190
|
| `ERR_UNKNOWN_CODEMOD` | A `--codemod` value did not match any registered codemod (upgrade). |
|
|
191
191
|
| `ERR_CODEMOD_FAILED` | One or more codemods failed during an upgrade run. |
|
|
@@ -211,7 +211,7 @@ if (isError(result)) {
|
|
|
211
211
|
| `ERR_FETCH_FAILED` | A network fetch (RSS feed or post text) failed. |
|
|
212
212
|
| `ERR_LAYOUT_PARSE` | A layout expression failed to parse (syntax error, with line/col). |
|
|
213
213
|
| `ERR_LAYOUT_INVALID` | A layout expression parsed but failed validation (unknown component/prop/enum/block). |
|
|
214
|
-
| `ERR_UNCLASSIFIED_EXIT` | Recorded in the debug log, never printed: a command exited non-zero without
|
|
214
|
+
| `ERR_UNCLASSIFIED_EXIT` | Recorded in the debug log, never printed: a command exited non-zero without going through cliError/jsonError, so no stable code was available. |
|
|
215
215
|
| `ERR_SIGNAL_TERMINATED` | Recorded in the debug log, never printed: the process was ended by a signal (Ctrl-C, SIGTERM) before the command reached a terminal path. |
|
|
216
216
|
|
|
217
217
|
<!-- END GENERATED: error-codes -->
|
|
@@ -418,66 +418,64 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
418
418
|
|
|
419
419
|
<!-- BEGIN GENERATED: response-types -->
|
|
420
420
|
|
|
421
|
-
| Type | What `data` carries
|
|
422
|
-
| --------------------------------- |
|
|
423
|
-
| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted.
|
|
424
|
-
| `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set.
|
|
425
|
-
| `component.list` | The component catalog grouped by
|
|
426
|
-
| `component.
|
|
427
|
-
| `component.detail`
|
|
428
|
-
| `component.detail.
|
|
429
|
-
| `component.detail.
|
|
430
|
-
| `component.detail.
|
|
431
|
-
| `
|
|
432
|
-
| `docs.
|
|
433
|
-
| `docs.
|
|
434
|
-
| `docs.
|
|
435
|
-
| `docs.
|
|
436
|
-
| `
|
|
437
|
-
| `blog.
|
|
438
|
-
| `
|
|
439
|
-
| `discover.
|
|
440
|
-
| `discover.detail`
|
|
441
|
-
| `discover.
|
|
442
|
-
| `
|
|
443
|
-
| `
|
|
444
|
-
| `
|
|
445
|
-
| `
|
|
446
|
-
| `
|
|
447
|
-
| `
|
|
448
|
-
| `
|
|
449
|
-
| `
|
|
450
|
-
| `
|
|
451
|
-
| `template.
|
|
452
|
-
| `template.
|
|
453
|
-
| `template.
|
|
454
|
-
| `
|
|
455
|
-
| `
|
|
456
|
-
| `hook.
|
|
457
|
-
| `
|
|
458
|
-
| `
|
|
459
|
-
| `theme.build`
|
|
460
|
-
| `theme.
|
|
461
|
-
| `theme.
|
|
462
|
-
| `theme.
|
|
463
|
-
| `theme.
|
|
464
|
-
| `theme.
|
|
465
|
-
| `
|
|
466
|
-
| `
|
|
467
|
-
| `upgrade.
|
|
468
|
-
| `
|
|
469
|
-
| `
|
|
470
|
-
| `
|
|
471
|
-
| `
|
|
472
|
-
| `
|
|
473
|
-
| `
|
|
474
|
-
| `
|
|
475
|
-
| `integration.
|
|
476
|
-
| `
|
|
477
|
-
| `
|
|
478
|
-
| `
|
|
479
|
-
| `integration.component-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
|
|
480
|
-
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
|
|
421
|
+
| Type | What `data` carries |
|
|
422
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
423
|
+
| `init.run` | The install receipt: the `mode` (`default` \| `features`), the features run, agent-doc files written, any soft `docsError`, whether theme guidance was emitted, the template outcome (`workflow` \| `created` \| `skipped`) plus its path, and whether the next-steps were emitted. |
|
|
424
|
+
| `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set. |
|
|
425
|
+
| `component.list` | The component catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of names entries ({name, package, and optional canonical import for integrations}), brief entries, or a full ComponentDoc per entry. |
|
|
426
|
+
| `component.detail` | One component's authored ComponentDoc plus ownership fields (package, the owner; import, the specifier; sourceAvailable, whether source exists) and parentDoc (present when the component is documented inside another component's doc, naming that doc). |
|
|
427
|
+
| `component.detail.props` | Just one component's props table (ComponentPropDoc[]). |
|
|
428
|
+
| `component.detail.source` | One component's source file, as {component, source}. |
|
|
429
|
+
| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. |
|
|
430
|
+
| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry. |
|
|
431
|
+
| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description, package, replaces?}), in read order; meta.namespaces lists the docs tree's top-level namespaces, and meta.notLoaded each package whose docs did not load. |
|
|
432
|
+
| `docs.detail` | One topic's full ReferenceDoc (the JSON read of a topic, --full, --dense, or a topic with one section), with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
|
|
433
|
+
| `docs.index` | One topic's section index, the text read of a topic with more than one section (and --index): the topic's name, title, and description, plus sections, each {id, title, summary} (pass the id as the section argument; summary is the section's one-line summary), and links ({up, previous, next}: the commands that open the level it sits in and its neighbors there). |
|
|
434
|
+
| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined, plus links ({up, previous, next}: the commands that open its topic index and the sections before and after it). |
|
|
435
|
+
| `docs.node` | One node of the docs tree, read by its route: its id, kind, package, title, summary, and breadcrumb, plus a namespace's slots with their children (one level down) or a typed doc's content, and links ({up, previous, next, related}: the commands that open its parent, its neighbors, and the docs it names). |
|
|
436
|
+
| `blog.list` | The feed URL plus every post parsed from the RSS feed, each with slug, title, description, date, type, authors, link, and plaintext URL. |
|
|
437
|
+
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
|
|
438
|
+
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
|
|
439
|
+
| `discover.detail` | A single external package entry, for an @scope/name query. |
|
|
440
|
+
| `discover.detail.doc` | The validated ComponentDoc for one external component: an @scope/name/Component query, or a free-text term resolving to exactly one component. |
|
|
441
|
+
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components. |
|
|
442
|
+
| `search` | The echoed query, `matchCount` (total matches, before `limit`), and results, a ranked SearchResultEntry[] bounded by `limit`: each {domain, name, score, reason, description, command}, plus import (components, hooks), title, parent (the command that opens the level above), package (for a docs-tree hit), and, for a hit on one section, section (docs), or displayName and kind (templates). |
|
|
443
|
+
| `build.help` | The how-to-build-a-page playbook, emitted when no query is given: `playbook: true`, a title, the ordered steps (title, commands, optional returns), the on-system rules, and related lookups. Commands are bare subcommands for the caller to render with its own invocation. |
|
|
444
|
+
| `build.kit` | The template to start from and its kit: query, hasResults, matchCount (never a cap), directMatch, start {name, command, basis, reason, alternatives, ...}, pages (search's closest templates), blocks and domain as SearchResultEntry[], frame, foundation, and hint {reason, commands} when thin. |
|
|
445
|
+
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
|
|
446
|
+
| `swizzle.copy` | An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and an optional maintainer note. |
|
|
447
|
+
| `gap-report.categories` | The fixed gap category values and human-readable labels. |
|
|
448
|
+
| `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
|
|
449
|
+
| `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
|
|
450
|
+
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes. |
|
|
451
|
+
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
|
|
452
|
+
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count. |
|
|
453
|
+
| `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
|
|
454
|
+
| `hook.list` | The hook catalog grouped by category: `detail` (the level: names \| compact \| full) and `components`, the grouped map of hook names, brief entries, or a full HookDoc per entry. |
|
|
455
|
+
| `hook.detail` | One hook's full authored HookDoc. |
|
|
456
|
+
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
|
|
457
|
+
| `theme.build` | A theme build receipt: name, tokenCount and componentCount (override counts), sizeKB, the written outputs {css, js, dts, and variantsDts when applicable}, warnings (defects to fix), and notices (advisories about a correct theme, such as a named font it does not load). |
|
|
458
|
+
| `theme.build.check` | The --check receipt: theme name, an upToDate flag, the stale outputs (each {path, reason: missing \| outdated}), and the full list of checked paths. Writes nothing. |
|
|
459
|
+
| `theme.build.batch` | Several themes built in one invocation: `count` plus one {file, receipt} per theme in argument order, where receipt is that theme's theme.build (or theme.build.check) envelope, or null when it produced no CSS. |
|
|
460
|
+
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package. |
|
|
461
|
+
| `theme.add` | A scaffold receipt: resolved slug, displayName, maintained flag, owner package, outputDir (relative to cwd), the theme entry file, its exportName, and the files written. |
|
|
462
|
+
| `theme.template` | A write receipt for the annotated theme template: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
|
|
463
|
+
| `theme.targets` | The whole themeable surface: the echoed filter, componentCount, and targets, one per theming target — {key, className, component, props, states, deprecatedFor?}, where props and states are its legal override keys and deprecatedFor names the canonical replacement key. |
|
|
464
|
+
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
|
|
465
|
+
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
|
|
466
|
+
| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
|
|
467
|
+
| `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
|
|
468
|
+
| `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
|
|
469
|
+
| `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and a fix when not passing) plus a `summary` of counts per status. |
|
|
470
|
+
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
|
|
471
|
+
| `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
|
|
472
|
+
| `integration.validate` | The validation result: the package name and version (both null when no local manifest is found) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
|
|
473
|
+
| `integration.template-conflicts` | The integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
|
|
474
|
+
| `integration.component-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
|
|
475
|
+
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
|
|
476
|
+
| `layout.expand` | The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written). |
|
|
477
|
+
| `layout.check` | The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). |
|
|
478
|
+
| `layout.grammar` | The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. |
|
|
481
479
|
|
|
482
480
|
<!-- END GENERATED: response-types -->
|
|
483
481
|
<!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
@@ -578,12 +576,12 @@ There is no factory: write a plain object. For editor autocomplete and
|
|
|
578
576
|
type-checking, annotate it with the `AstryxConfig` type exported from
|
|
579
577
|
`@astryxdesign/cli/authoring`.
|
|
580
578
|
|
|
581
|
-
| Field | Type | Purpose
|
|
582
|
-
| ----------------------------- | ------------------------------ |
|
|
583
|
-
| `integrations` | `string[]` | Integration package names to load (see [Integrations](#integrations)).
|
|
584
|
-
| `issuesUrl` | `string` | Where "report an issue" links point for your project. Defaults to the core issue tracker.
|
|
585
|
-
| `hooks.postCodemod` | `PostCodemodHook[]` | Commands to run after `astryx upgrade` applies codemods (e.g. reinstall, rebuild, reformat).
|
|
586
|
-
| `experimental.xle.components` | `Record<string, XleComponent>` |
|
|
579
|
+
| Field | Type | Purpose |
|
|
580
|
+
| ----------------------------- | ------------------------------ | ----------------------------------------------------------------------------------------------- |
|
|
581
|
+
| `integrations` | `string[]` | Integration package names to load (see [Integrations](#integrations)). |
|
|
582
|
+
| `issuesUrl` | `string` | Where "report an issue" links point for your project. Defaults to the core issue tracker. |
|
|
583
|
+
| `hooks.postCodemod` | `PostCodemodHook[]` | Commands to run after `astryx upgrade` applies codemods (e.g. reinstall, rebuild, reformat). |
|
|
584
|
+
| `experimental.xle.components` | `Record<string, XleComponent>` | Register app-local components so layout (XLE) expressions can reference them by name. Unstable. |
|
|
587
585
|
|
|
588
586
|
The config is validated against a strict schema when the CLI loads it, so an
|
|
589
587
|
unknown field is a hard error rather than a silent no-op. `astryx doctor`
|
|
@@ -679,10 +677,9 @@ Warnings go to stderr and never corrupt a `--json` envelope. To inspect problems
|
|
|
679
677
|
Core identity overlaps before publishing. Bare `astryx doctor` checks overall
|
|
680
678
|
project health.
|
|
681
679
|
|
|
682
|
-
For the full walkthrough
|
|
683
|
-
|
|
680
|
+
For the full authoring walkthrough (component doc format, template packaging
|
|
681
|
+
and `exports` requirements, and codemod authoring), see the guide:
|
|
684
682
|
|
|
685
683
|
```bash
|
|
686
684
|
astryx docs cli/integrations
|
|
687
|
-
astryx docs cli/integrations/quick-start
|
|
688
685
|
```
|
package/api/build/build.doc.mjs
CHANGED
|
@@ -40,7 +40,6 @@ export const doc = {
|
|
|
40
40
|
type: 'string',
|
|
41
41
|
description:
|
|
42
42
|
'Directory to resolve @astryxdesign/core and templates from.',
|
|
43
|
-
default: 'process.cwd()',
|
|
44
43
|
},
|
|
45
44
|
{
|
|
46
45
|
name: 'options.type',
|
|
@@ -70,11 +69,7 @@ export const doc = {
|
|
|
70
69
|
throws: [
|
|
71
70
|
{
|
|
72
71
|
code: 'ERR_INVALID_ARGUMENT',
|
|
73
|
-
when: '
|
|
74
|
-
},
|
|
75
|
-
{
|
|
76
|
-
code: 'ERR_CORE_NOT_FOUND',
|
|
77
|
-
when: 'a query is given and @astryxdesign/core cannot be found from cwd',
|
|
72
|
+
when: 'options.type is not a known domain, or options.limit is not a positive integer',
|
|
78
73
|
},
|
|
79
74
|
],
|
|
80
75
|
examples: [
|
package/api/build/build.test.mjs
CHANGED
|
@@ -179,28 +179,6 @@ describe('build kit — coverage gates the pages group', () => {
|
|
|
179
179
|
}
|
|
180
180
|
});
|
|
181
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
|
-
|
|
204
182
|
it('leaves single-concept queries alone (nothing to cover)', async () => {
|
|
205
183
|
const r = await build('dashboard', {cwd: REPO});
|
|
206
184
|
expect(r.type).toBe('build.kit');
|
package/api/build/kit/kit.mjs
CHANGED
|
@@ -28,9 +28,6 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
import {search} from '../../search/search.mjs';
|
|
31
|
-
import {findCoreDir} from '../../../foundation/fs/paths.mjs';
|
|
32
|
-
import {AstryxError} from '../../error.mjs';
|
|
33
|
-
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
34
31
|
import {getResultCoverage} from '../../search/coverage.mjs';
|
|
35
32
|
import {loadPageTemplates} from '../_adapter.mjs';
|
|
36
33
|
import {pickAlternatives, pickStart, rankPages} from './rank.mjs';
|
|
@@ -191,30 +188,12 @@ function chooseStart(ranked, pages, directMatch, catalog) {
|
|
|
191
188
|
*/
|
|
192
189
|
export async function buildKit(query, options = {}) {
|
|
193
190
|
const {cwd = process.cwd(), type, limit = 60} = options;
|
|
194
|
-
// A kit is built from Core's components, hooks, and templates. An open
|
|
195
|
-
// search without core covers the docs alone, so the kit asks for core here.
|
|
196
|
-
if (type !== 'doc' && !findCoreDir(cwd)) {
|
|
197
|
-
throw new AstryxError(
|
|
198
|
-
'Could not find @astryxdesign/core package',
|
|
199
|
-
undefined,
|
|
200
|
-
ERROR_CODES.ERR_CORE_NOT_FOUND,
|
|
201
|
-
);
|
|
202
|
-
}
|
|
203
191
|
// search()'s JSDoc @returns widens results to object[]; the SearchResponse
|
|
204
192
|
// shape is the contract (api/search/search.type.mjs). Cast locally rather than
|
|
205
193
|
// tightening the search @returns (a separate follow-up).
|
|
206
194
|
const result =
|
|
207
195
|
/** @type {import('../../search/search.type.mjs').SearchResponse} */ (
|
|
208
|
-
await search(query, {
|
|
209
|
-
cwd,
|
|
210
|
-
type,
|
|
211
|
-
// Search wider than the surfaced kit so a flood of doc matches cannot
|
|
212
|
-
// bury the page templates past the cutoff; the caller's `limit` still
|
|
213
|
-
// caps the kit below. A non-positive or non-integer limit is passed
|
|
214
|
-
// through unchanged so search rejects it (ERR_INVALID_ARGUMENT).
|
|
215
|
-
limit:
|
|
216
|
-
Number.isInteger(limit) && limit > 0 ? Math.max(limit, 200) : limit,
|
|
217
|
-
})
|
|
196
|
+
await search(query, {cwd, type, limit})
|
|
218
197
|
);
|
|
219
198
|
const results = result.data.results;
|
|
220
199
|
// The TOTAL number of matches, not the number that survived `limit`. The kit
|
|
@@ -278,24 +257,6 @@ export async function buildKit(query, options = {}) {
|
|
|
278
257
|
command: `${page.command} --skeleton`,
|
|
279
258
|
}));
|
|
280
259
|
|
|
281
|
-
// The caller's `limit` caps the surfaced kit, even though the search above
|
|
282
|
-
// ran wider to find templates that a flood of doc matches would otherwise
|
|
283
|
-
// bury past the cutoff. Keep pages first, then blocks, then components.
|
|
284
|
-
let budget = limit;
|
|
285
|
-
/**
|
|
286
|
-
* @template T
|
|
287
|
-
* @param {T[]} arr
|
|
288
|
-
* @returns {T[]}
|
|
289
|
-
*/
|
|
290
|
-
const toLimit = arr => {
|
|
291
|
-
const out = arr.slice(0, Math.max(0, budget));
|
|
292
|
-
budget -= out.length;
|
|
293
|
-
return out;
|
|
294
|
-
};
|
|
295
|
-
const pagesKept = toLimit(pages);
|
|
296
|
-
const blocksKept = toLimit(blocks);
|
|
297
|
-
const domainKept = toLimit(domain);
|
|
298
|
-
|
|
299
260
|
// A kit narrowed to components or hooks has no page to start from; every
|
|
300
261
|
// other kit does, so the reader is never left to compose a page from scratch.
|
|
301
262
|
const wantsPages = !type || type === 'template';
|
|
@@ -327,7 +288,7 @@ export async function buildKit(query, options = {}) {
|
|
|
327
288
|
// not resolve — the same defect `getCliInvocation` exists to prevent, and
|
|
328
289
|
// the renderer applies it. A JSON caller gets the parts, not a sentence.
|
|
329
290
|
const hint =
|
|
330
|
-
|
|
291
|
+
pages.length + blocks.length + domain.length < THIN_KIT
|
|
331
292
|
? {
|
|
332
293
|
reason:
|
|
333
294
|
'Few matches. This is keyword search, not semantic — try other wordings.',
|
|
@@ -345,9 +306,9 @@ export async function buildKit(query, options = {}) {
|
|
|
345
306
|
matchCount,
|
|
346
307
|
directMatch,
|
|
347
308
|
start,
|
|
348
|
-
pages
|
|
349
|
-
blocks
|
|
350
|
-
domain
|
|
309
|
+
pages,
|
|
310
|
+
blocks,
|
|
311
|
+
domain,
|
|
351
312
|
frame: FRAME,
|
|
352
313
|
foundation: FOUNDATION,
|
|
353
314
|
hint,
|