@astryxdesign/cli 0.6.3-canary.dea6813 → 0.6.3-canary.df1837b
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 +79 -58
- package/api/blog/blog.doc.mjs +1 -0
- package/api/build/build.doc.mjs +1 -0
- package/api/component/component.doc.mjs +2 -1
- package/api/component/component.mjs +3 -3
- package/api/component/component.type.d.mts +5 -4
- package/api/component/component.type.mjs +5 -4
- package/api/component/detail/blocks/blocks.d.mts +2 -1
- package/api/component/detail/blocks/blocks.mjs +4 -3
- package/api/component/list/list.d.mts +0 -5
- package/api/component/list/list.mjs +37 -9
- package/api/discover/discover.doc.mjs +1 -0
- package/api/docs/_adapter.d.mts +3 -8
- package/api/docs/_adapter.mjs +13 -105
- package/api/docs/docs.doc.mjs +1 -0
- package/api/docs/list/list.mjs +3 -7
- package/api/doctor/doctor.d.mts +25 -3
- package/api/doctor/doctor.doc.mjs +1 -0
- package/api/doctor/doctor.mjs +185 -13
- package/api/doctor/doctor.test.mjs +326 -1
- package/api/gap-report/gap-report.doc.mjs +1 -0
- package/api/hook/_adapter.mjs +19 -5
- package/api/hook/hook.doc.mjs +1 -0
- package/api/hook/list/list.d.mts +1 -1
- package/api/hook/list/list.mjs +69 -17
- package/api/init/init.doc.mjs +1 -0
- package/api/integration/add-contribution.mjs +7 -7
- package/api/integration/add-contribution.test.mjs +37 -3
- package/api/integration/add-theme.mjs +34 -64
- package/api/integration/add-theme.test.mjs +105 -21
- package/api/integration/authoring-checks.test.mjs +8 -4
- package/api/integration/integration-block-exports.test.mjs +10 -6
- package/api/integration/integrationAdd.doc.mjs +1 -0
- package/api/integration/integrationAddAgentDoc.doc.mjs +1 -0
- package/api/integration/integrationAddCodemod.doc.mjs +1 -0
- package/api/integration/integrationAddComponent.doc.mjs +1 -0
- package/api/integration/integrationAddDoc.doc.mjs +1 -0
- package/api/integration/integrationAddTemplate.doc.mjs +1 -0
- package/api/integration/integrationAddTheme.doc.mjs +6 -5
- package/api/integration/integrationComponentConflicts.doc.mjs +1 -0
- package/api/integration/integrationDocConflicts.doc.mjs +1 -0
- package/api/integration/integrationPackCheck.doc.mjs +1 -0
- package/api/integration/integrationTemplateConflicts.doc.mjs +1 -0
- package/api/integration/pack-check.test.mjs +17 -47
- package/api/integration/summarizeIssues.doc.mjs +1 -0
- package/api/integration/validate-integration-fixes.test.mjs +1389 -0
- package/api/integration/validate-integration.mjs +50 -102
- package/api/integration/validate-integration.test.mjs +85 -23
- package/api/integration/validate-unread-theme-folders.test.mjs +110 -0
- package/api/integration/validateIntegration.doc.mjs +1 -0
- package/api/json/assertResponse.doc.mjs +1 -0
- package/api/json/isError.doc.mjs +1 -0
- package/api/json/parseResponse.doc.mjs +1 -0
- package/api/layout/layoutCheck.doc.mjs +1 -0
- package/api/layout/layoutExpand.doc.mjs +1 -0
- package/api/layout/layoutGrammar.doc.mjs +1 -0
- package/api/search/search.doc.mjs +1 -0
- package/api/search/search.mjs +16 -6
- package/api/swizzle/swizzle.doc.mjs +1 -0
- package/api/template/template-suffix.test.mjs +41 -21
- package/api/template/template.doc.mjs +1 -0
- package/api/theme/_adapter.d.mts +2 -3
- package/api/theme/_adapter.mjs +4 -5
- package/api/theme/add/add.binary.test.mjs +10 -17
- package/api/theme/add/add.test.mjs +14 -1
- package/api/theme/generateTonalPalette.doc.mjs +1 -0
- package/api/theme/integration-themes.test.mjs +39 -28
- package/api/theme/list/list.test.mjs +19 -20
- package/api/theme/listThemes.doc.mjs +6 -5
- package/api/theme/themeAdd.doc.mjs +4 -3
- package/api/theme/themeBuild.doc.mjs +1 -0
- package/api/theme/themeList.doc.mjs +6 -3
- package/api/theme/themeListAvailable.doc.mjs +5 -3
- package/api/theme/themePaletteGenerate.doc.mjs +1 -0
- package/api/theme/themeTargets.doc.mjs +1 -0
- package/api/theme/themeTemplate.doc.mjs +1 -0
- package/api/upgrade/_adapter.d.mts +32 -5
- package/api/upgrade/_adapter.mjs +97 -69
- package/api/upgrade/provider-agreement.test.mjs +152 -0
- package/api/upgrade/run/run.mjs +356 -59
- package/api/upgrade/upgrade.doc.mjs +6 -1
- package/api/upgrade/upgrade.type.d.mts +34 -0
- package/api/upgrade/upgrade.type.mjs +15 -0
- package/assets/codemods/__tests__/runner.test.mjs +330 -8
- package/assets/codemods/integration-discovery.mjs +8 -2
- package/assets/codemods/integration-discovery.test.mjs +15 -0
- package/assets/codemods/integration-runner.mjs +56 -4
- package/assets/codemods/integration-runner.protection.test.mjs +153 -0
- package/assets/codemods/run-codemod.mjs +177 -34
- package/assets/codemods/runner.mjs +350 -102
- package/assets/codemods/transform-prop.mjs +109 -0
- package/assets/codemods/transform-prop.test.mjs +95 -0
- package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
- package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +220 -0
- package/assets/codemods/transforms/next/index.mjs +19 -1
- package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
- package/assets/codemods/transforms/next/migrate-theme-catalog-to-descriptors.mjs +141 -0
- package/assets/codemods/transforms/v0.0.14/__tests__/rename-status-variants.test.mjs +86 -165
- package/assets/codemods/transforms/v0.0.14/rename-status-variants.mjs +72 -210
- package/assets/codemods/transforms/v0.1.8/__tests__/rename-avatar-size-scale.test.mjs +83 -115
- package/assets/codemods/transforms/v0.1.8/rename-avatar-size-scale.mjs +57 -186
- package/assets/docs/cli-integrations.doc.mjs +30 -30
- package/assets/docs/cli.doc.mjs +15 -0
- package/assets/docs/theme.doc.mjs +1 -1
- package/assets/templates/blocks/components/DateInput/DateInputDateRange.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/TimeInput/TimeInputConstrained.tsx +1 -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/codemod/codemod.doc.mjs +1 -1
- package/authoring/codemod/type.ts +12 -0
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/debug/debug.doc.d.mts +11 -0
- package/authoring/debug/debug.doc.mjs +182 -0
- package/authoring/doctypes/base/graph-fields.doc.mjs +1 -1
- package/authoring/doctypes/command/command.doc.mjs +1 -1
- package/authoring/doctypes/command/type.ts +1 -1
- package/authoring/doctypes/component/type.ts +2 -2
- package/authoring/doctypes/doctypes-new.test.mjs +48 -6
- package/authoring/doctypes/enum/enum.doc.mjs +1 -1
- package/authoring/doctypes/enum/type.ts +1 -1
- package/authoring/doctypes/function/function.doc.mjs +1 -1
- package/authoring/doctypes/function/type.ts +1 -1
- package/authoring/doctypes/hook/type.ts +2 -2
- package/authoring/doctypes/load-contract.test.mjs +2 -1
- package/authoring/doctypes/parse.d.mts +4 -2
- package/authoring/doctypes/parse.mjs +7 -3
- package/authoring/doctypes/reference/reference.doc.mjs +1 -1
- package/authoring/doctypes/reference/type.ts +2 -2
- package/authoring/doctypes/schema/schema.doc.mjs +1 -1
- package/authoring/doctypes/schema/type.ts +1 -2
- package/authoring/doctypes/template/template.doc.mjs +3 -3
- 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 +2 -1
- package/authoring/gap-report/gap-report.doc.d.mts +12 -0
- package/authoring/gap-report/gap-report.doc.mjs +183 -0
- package/authoring/index.d.mts +1 -0
- package/authoring/index.d.ts +6 -4
- package/authoring/index.mjs +2 -1
- package/authoring/integration/integration.doc.mjs +2 -2
- package/authoring/integration/type.ts +3 -9
- package/clients/cli/__tests__/cliManifest.test.ts +27 -29
- package/clients/cli/commands/blog.doc.mjs +1 -1
- package/clients/cli/commands/build.doc.mjs +1 -1
- package/clients/cli/commands/component-package.test.mjs +28 -0
- package/clients/cli/commands/component.doc.mjs +1 -1
- package/clients/cli/commands/discover.doc.mjs +1 -1
- package/clients/cli/commands/docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-components.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-docs.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-templates.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration-validate.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.doc.mjs +1 -1
- package/clients/cli/commands/doctor-integration.test.mjs +15 -7
- package/clients/cli/commands/doctor.doc.mjs +1 -1
- package/clients/cli/commands/gap-report.doc.mjs +1 -1
- package/clients/cli/commands/hook.doc.mjs +1 -1
- package/clients/cli/commands/init.doc.mjs +1 -1
- package/clients/cli/commands/integration-add.controls.test.mjs +1 -1
- package/clients/cli/commands/integration-add.doc.mjs +1 -1
- package/clients/cli/commands/integration-pack.doc.mjs +1 -1
- package/clients/cli/commands/integration-real-world.test.mjs +3 -9
- package/clients/cli/commands/integration.doc.mjs +1 -1
- package/clients/cli/commands/layout-check.doc.mjs +1 -1
- package/clients/cli/commands/layout-expand.doc.mjs +1 -1
- package/clients/cli/commands/layout-grammar.doc.mjs +1 -1
- package/clients/cli/commands/layout.doc.mjs +1 -1
- package/clients/cli/commands/manifest.doc.mjs +1 -1
- package/clients/cli/commands/search.doc.mjs +1 -1
- package/clients/cli/commands/swizzle.doc.mjs +1 -1
- package/clients/cli/commands/template.doc.mjs +1 -1
- package/clients/cli/commands/theme-add.doc.mjs +2 -2
- package/clients/cli/commands/theme-build.doc.mjs +1 -1
- package/clients/cli/commands/theme-list.doc.mjs +2 -2
- package/clients/cli/commands/theme-palette-generate.doc.mjs +3 -3
- package/clients/cli/commands/theme-palette.doc.mjs +1 -1
- package/clients/cli/commands/theme-targets.doc.mjs +1 -1
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/theme.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.doc.mjs +3 -2
- package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
- package/clients/cli/commands/upgrade.mjs +3 -0
- package/clients/cli/lib/hook-format.mjs +14 -5
- package/foundation/config/project-themes.test.mjs +11 -19
- package/foundation/config/project.d.mts +8 -0
- package/foundation/config/project.mjs +50 -21
- package/foundation/config/project.test.mjs +3 -16
- package/foundation/discovery/authoring-self-docs.d.mts +6 -0
- package/foundation/discovery/authoring-self-docs.mjs +17 -7
- package/foundation/discovery/authoring-surface.d.mts +74 -0
- package/foundation/discovery/authoring-surface.mjs +525 -0
- package/foundation/discovery/authoring-surface.test.mjs +392 -0
- package/foundation/discovery/cli-self-docs.d.mts +113 -0
- package/foundation/discovery/cli-self-docs.mjs +514 -0
- package/foundation/discovery/cli-self-docs.test.mjs +437 -0
- package/foundation/discovery/component-loader.d.mts +35 -38
- package/foundation/discovery/component-loader.mjs +53 -222
- package/foundation/discovery/docs-discovery.d.mts +3 -2
- package/foundation/discovery/docs-discovery.mjs +8 -12
- package/foundation/discovery/docs-discovery.test.mjs +8 -5
- package/foundation/discovery/template-adapter.d.mts +7 -0
- package/foundation/discovery/template-adapter.mjs +27 -40
- package/foundation/discovery/template-adapter.test.mjs +15 -0
- package/foundation/discovery/theme-discovery.d.mts +67 -7
- package/foundation/discovery/theme-discovery.mjs +916 -186
- package/foundation/discovery/theme-discovery.test.mjs +613 -219
- package/foundation/doc-compiler/bundle.d.mts +47 -0
- package/foundation/doc-compiler/bundle.mjs +218 -0
- package/foundation/doc-compiler/bundle.test.mjs +255 -0
- package/foundation/doc-compiler/compile.d.mts +200 -0
- package/foundation/doc-compiler/compile.mjs +254 -5
- package/foundation/doc-compiler/diagnostics.d.mts +126 -0
- package/foundation/doc-compiler/diagnostics.mjs +277 -0
- package/foundation/doc-compiler/doc-compiler.test.mjs +28 -1
- package/foundation/doc-compiler/doc-loads.test.mjs +1642 -0
- package/foundation/doc-compiler/import.d.mts +24 -0
- package/foundation/doc-compiler/import.mjs +59 -0
- package/foundation/doc-compiler/inputs.d.mts +102 -0
- package/foundation/doc-compiler/inputs.mjs +286 -0
- package/foundation/doc-compiler/inputs.test.mjs +299 -0
- package/foundation/doc-compiler/ir.d.mts +13 -0
- package/foundation/doc-compiler/ir.mjs +189 -12
- package/foundation/doc-compiler/lower-doc.test.mjs +492 -0
- package/foundation/doc-compiler/overlays.d.mts +37 -0
- package/foundation/doc-compiler/overlays.mjs +206 -0
- package/foundation/doc-compiler/parse-readable.d.mts +9 -0
- package/foundation/doc-compiler/parse-readable.mjs +29 -0
- package/foundation/doc-compiler/read.d.mts +126 -0
- package/foundation/doc-compiler/read.mjs +320 -0
- package/foundation/doc-compiler/read.test.mjs +313 -0
- package/foundation/doc-compiler/source.d.mts +33 -0
- package/foundation/doc-compiler/source.mjs +128 -0
- package/foundation/fs/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/integrations/autolink.d.mts +58 -1
- package/foundation/integrations/autolink.mjs +143 -57
- package/foundation/integrations/contribution-fixes.d.mts +145 -0
- package/foundation/integrations/contribution-fixes.mjs +1284 -0
- package/foundation/integrations/contribution-inventory.d.mts +1 -1
- package/foundation/integrations/contribution-inventory.mjs +17 -20
- package/foundation/integrations/contribution-inventory.test.mjs +67 -27
- package/foundation/integrations/integrations.d.mts +3 -0
- package/foundation/integrations/integrations.mjs +11 -97
- package/foundation/integrations/provider-ledger.test.mjs +275 -0
- package/foundation/integrations/provider-resolution.d.mts +152 -0
- package/foundation/integrations/provider-resolution.mjs +576 -0
- package/foundation/integrations/provider-resolution.test.mjs +369 -0
- package/foundation/integrations/theme-descriptor.d.mts +8 -0
- package/foundation/integrations/theme-descriptor.mjs +44 -0
- package/foundation/integrations/validate-contributions.mjs +104 -10
- package/foundation/response/error-codes.d.mts +3 -1
- package/foundation/response/error-codes.d.ts +2 -0
- package/foundation/response/error-codes.doc.mjs +12 -2
- package/foundation/response/error-codes.mjs +7 -1
- package/foundation/response/error-codes.test.mjs +55 -11
- package/foundation/response/response-types.doc.mjs +8 -8
- package/foundation/response/response-types.doc.test.mjs +158 -0
- package/foundation/response/response.doc.mjs +1 -1
- package/foundation/text/string-utils.mjs +22 -10
- package/package.json +10 -9
- package/assets/templates/themes/manifest.json +0 -95
package/README.md
CHANGED
|
@@ -15,6 +15,25 @@ npx @astryxdesign/cli template --list
|
|
|
15
15
|
|
|
16
16
|
Once it's a project dependency (`npm install -D @astryxdesign/cli`), drop the scope and use the shorter `astryx` — e.g. `npx astryx component Button` or `pnpm exec astryx component Button`. Bare `astryx` resolves to an unrelated npm package until the CLI is installed, so prefer the scoped form above for first-run/one-off use.
|
|
17
17
|
|
|
18
|
+
## Reading the CLI's own docs
|
|
19
|
+
|
|
20
|
+
The CLI documents itself, so these commands print what the installed version does:
|
|
21
|
+
|
|
22
|
+
- `astryx <command> --help`: one command's arguments and options.
|
|
23
|
+
- `astryx manifest --json`: every command, option, and response type, as JSON.
|
|
24
|
+
- `astryx docs cli --index`: one section for each command (`commands-<name>`)
|
|
25
|
+
and each API function, plus the JSON output envelope, error codes, and
|
|
26
|
+
response types (`api-<name>`). Read one with `astryx docs cli <key>`, for
|
|
27
|
+
example `astryx docs cli api-search`.
|
|
28
|
+
- `astryx docs authoring --index`: the authoring reference, with one section for
|
|
29
|
+
each file an author writes: the `astryx.config.*` file, the
|
|
30
|
+
`astryx.integration.*` manifest, codemods, and every doc type (`ComponentDoc`,
|
|
31
|
+
`TemplateDoc`, `ThemeDoc`, and the rest). Read one section with
|
|
32
|
+
`astryx docs authoring <section>`, for example `astryx docs authoring config`.
|
|
33
|
+
- `astryx docs cli-integrations`: the guide to building an integration package.
|
|
34
|
+
- `astryx docs`: every docs topic, including the design-system guides (for
|
|
35
|
+
example `tokens`, `theme`, and `layout`).
|
|
36
|
+
|
|
18
37
|
## Finding things: `astryx search`
|
|
19
38
|
|
|
20
39
|
When you don't know whether what you need is a component, a hook, a docs topic,
|
|
@@ -170,6 +189,8 @@ if (isError(result)) {
|
|
|
170
189
|
| `ERR_UNKNOWN_FEATURE` | An unrecognized `--features` value was passed to init. |
|
|
171
190
|
| `ERR_UNKNOWN_CODEMOD` | A `--codemod` value did not match any registered codemod (upgrade). |
|
|
172
191
|
| `ERR_CODEMOD_FAILED` | One or more codemods failed during an upgrade run. |
|
|
192
|
+
| `ERR_CODEMOD_PROTECTED` | A required codemod change remains blocked by a protected consumer file. |
|
|
193
|
+
| `ERR_CODEMOD_PROTECTION_SOURCE` | A working-tree protection declaration could not be read or parsed. |
|
|
173
194
|
| `ERR_NOT_FOUND` | A generic discover/lookup query matched nothing in any package. |
|
|
174
195
|
| `ERR_NO_DOC` | A component exists but has no typed `.doc.mjs` file. |
|
|
175
196
|
| `ERR_NO_SHOWCASE` | No showcase exists for the requested component. |
|
|
@@ -179,7 +200,7 @@ if (isError(result)) {
|
|
|
179
200
|
| `ERR_FILE_EXISTS` | Refused to overwrite an existing file. |
|
|
180
201
|
| `ERR_PATH_TRAVERSAL` | A path escaped its allowed root, or a name contained traversal markers. |
|
|
181
202
|
| `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
|
|
182
|
-
| `ERR_THEME_INVALID` | A theme definition or contributed theme
|
|
203
|
+
| `ERR_THEME_INVALID` | A theme definition or contributed theme descriptor is invalid. |
|
|
183
204
|
| `ERR_THEME_LOAD` | A theme file could not be loaded / parsed into a defineTheme result. |
|
|
184
205
|
| `ERR_PALETTE_GENERATION` | A palette generation request or one of its constraints was invalid. |
|
|
185
206
|
| `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
|
|
@@ -397,63 +418,63 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
397
418
|
|
|
398
419
|
<!-- BEGIN GENERATED: response-types -->
|
|
399
420
|
|
|
400
|
-
| Type | What `data` carries
|
|
401
|
-
| --------------------------------- |
|
|
402
|
-
| `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.
|
|
403
|
-
| `init.remove` | Confirmation that the managed agent-docs block was removed (`data.removed: true`) — returned when --remove-agents is set.
|
|
404
|
-
| `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.
|
|
405
|
-
| `component.detail` | One component's authored ComponentDoc plus ownership
|
|
406
|
-
| `component.detail.props` | Just one component's props table (ComponentPropDoc[]).
|
|
407
|
-
| `component.detail.source` | One component's source file, as {component, source}.
|
|
408
|
-
| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}.
|
|
409
|
-
| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry.
|
|
410
|
-
| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description}), in discovery order.
|
|
411
|
-
| `docs.detail` | One topic's full ReferenceDoc, with token-ref blocks inlined.
|
|
412
|
-
| `docs.index` | One topic's section index (--index):
|
|
413
|
-
| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined.
|
|
414
|
-
| `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.
|
|
415
|
-
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body.
|
|
416
|
-
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered".
|
|
417
|
-
| `discover.detail` | A single external package entry, for an @scope/name query.
|
|
418
|
-
| `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.
|
|
419
|
-
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components.
|
|
420
|
-
| `search` | The echoed query, `matchCount` (
|
|
421
|
-
| `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.
|
|
422
|
-
| `build.kit` | The
|
|
423
|
-
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core.
|
|
424
|
-
| `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.
|
|
425
|
-
| `gap-report.categories` | The fixed gap category values and human-readable labels.
|
|
426
|
-
| `gap-report.file` | An aggregate receipt
|
|
427
|
-
| `template.list` | Every discovered template (page + block); each entry carries id, name, description, kind, owning package, optional category and componentsUsed, and readiness flags.
|
|
428
|
-
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes.
|
|
429
|
-
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes.
|
|
430
|
-
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count.
|
|
431
|
-
| `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.
|
|
432
|
-
| `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.
|
|
433
|
-
| `hook.detail` | One hook's full authored HookDoc.
|
|
434
|
-
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]).
|
|
435
|
-
| `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).
|
|
436
|
-
| `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.
|
|
437
|
-
| `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.
|
|
438
|
-
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package.
|
|
439
|
-
| `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.
|
|
440
|
-
| `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.
|
|
441
|
-
| `theme.targets` | The whole themeable surface: the echoed filter,
|
|
442
|
-
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result.
|
|
443
|
-
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything.
|
|
444
|
-
| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary.
|
|
445
|
-
| `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.
|
|
446
|
-
| `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.
|
|
447
|
-
| `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.
|
|
448
|
-
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun.
|
|
449
|
-
| `integration.pack-check` | The packed-package check:
|
|
450
|
-
| `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}.
|
|
451
|
-
| `integration.template-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration template id is also owned by Core; each conflict includes the exact package-qualified command.
|
|
452
|
-
| `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.
|
|
453
|
-
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps classified as intentional replacements, intentional extensions, or accidental same-name conflicts.
|
|
454
|
-
| `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).
|
|
455
|
-
| `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).
|
|
456
|
-
| `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.
|
|
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}), in discovery order. |
|
|
432
|
+
| `docs.detail` | One topic's full ReferenceDoc, with token-ref blocks inlined. |
|
|
433
|
+
| `docs.index` | One topic's section index (--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). |
|
|
434
|
+
| `docs.detail.section` | One ReferenceSection of a topic, found by key or title, with token-ref blocks inlined. |
|
|
435
|
+
| `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. |
|
|
436
|
+
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
|
|
437
|
+
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
|
|
438
|
+
| `discover.detail` | A single external package entry, for an @scope/name query. |
|
|
439
|
+
| `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. |
|
|
440
|
+
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components. |
|
|
441
|
+
| `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 (docs), or displayName and kind (templates). |
|
|
442
|
+
| `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. |
|
|
443
|
+
| `build.kit` | The composition kit: echoed query, hasResults, matchCount (total matched, never a cap), directMatch, pages (closest templates), blocks (drop-in patterns) and domain (idea components/hooks) as SearchResultEntry[], frame and foundation name arrays, and hint {reason, commands} when thin. |
|
|
444
|
+
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
|
|
445
|
+
| `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. |
|
|
446
|
+
| `gap-report.categories` | The fixed gap category values and human-readable labels. |
|
|
447
|
+
| `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. |
|
|
448
|
+
| `template.list` | Every discovered template (page + block); each entry carries id, name, description, kind, owning package, optional category and componentsUsed, and readiness flags. |
|
|
449
|
+
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes. |
|
|
450
|
+
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
|
|
451
|
+
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count. |
|
|
452
|
+
| `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. |
|
|
453
|
+
| `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. |
|
|
454
|
+
| `hook.detail` | One hook's full authored HookDoc. |
|
|
455
|
+
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
|
|
456
|
+
| `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). |
|
|
457
|
+
| `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. |
|
|
458
|
+
| `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. |
|
|
459
|
+
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package. |
|
|
460
|
+
| `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. |
|
|
461
|
+
| `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. |
|
|
462
|
+
| `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. |
|
|
463
|
+
| `theme.palette.generate` | An author-reviewable OKLCH palette candidate, its reproducibility receipt, summary counts, and optional candidate/receipt file-write result. |
|
|
464
|
+
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
|
|
465
|
+
| `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
|
|
466
|
+
| `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. |
|
|
467
|
+
| `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. |
|
|
468
|
+
| `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. |
|
|
469
|
+
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
|
|
470
|
+
| `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}]. |
|
|
471
|
+
| `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}. |
|
|
472
|
+
| `integration.template-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration template id is also owned by Core; each conflict includes the exact package-qualified command. |
|
|
473
|
+
| `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. |
|
|
474
|
+
| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps classified as intentional replacements, intentional extensions, or accidental same-name conflicts. |
|
|
475
|
+
| `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). |
|
|
476
|
+
| `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). |
|
|
477
|
+
| `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. |
|
|
457
478
|
|
|
458
479
|
<!-- END GENERATED: response-types -->
|
|
459
480
|
<!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
|
package/api/blog/blog.doc.mjs
CHANGED
package/api/build/build.doc.mjs
CHANGED
|
@@ -12,6 +12,7 @@ export const doc = {
|
|
|
12
12
|
type: 'function',
|
|
13
13
|
kind: 'api',
|
|
14
14
|
name: 'component',
|
|
15
|
+
namespace: 'cli/api',
|
|
15
16
|
displayName: 'component()',
|
|
16
17
|
summary:
|
|
17
18
|
'Resolve a component by name, or list the catalog, with optional focused slices (props, source, showcase, blocks).',
|
|
@@ -109,7 +110,7 @@ export const doc = {
|
|
|
109
110
|
{
|
|
110
111
|
type: 'component.list',
|
|
111
112
|
description:
|
|
112
|
-
"The catalog grouped by category. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for
|
|
113
|
+
"The catalog grouped by category. data.detail is the level ('names' | 'compact' | 'full') and data.components is the grouped map: names entries with name, package, and an optional canonical import for integration and legacy package components; brief entries; or full ComponentDoc entries.",
|
|
113
114
|
},
|
|
114
115
|
{
|
|
115
116
|
type: 'component.detail',
|
|
@@ -165,7 +165,7 @@ export async function component(name, options = {}) {
|
|
|
165
165
|
: componentDetailShowcase(dirName, {cwd, name, resolve: false});
|
|
166
166
|
}
|
|
167
167
|
if (blocks) {
|
|
168
|
-
return componentDetailBlocks(dirName);
|
|
168
|
+
return componentDetailBlocks(dirName, cwd);
|
|
169
169
|
}
|
|
170
170
|
const docs = await loadComponentDoc(owner.docPath, docOpts);
|
|
171
171
|
if (props) return componentDetailProps(docs);
|
|
@@ -183,7 +183,7 @@ export async function component(name, options = {}) {
|
|
|
183
183
|
return componentDetailSource(dirName, null, {name, notFoundInPackage: packageScope});
|
|
184
184
|
}
|
|
185
185
|
if (blocks) {
|
|
186
|
-
return componentDetailBlocks(dirName);
|
|
186
|
+
return componentDetailBlocks(dirName, cwd);
|
|
187
187
|
}
|
|
188
188
|
const docs = await loadComponentDoc(extDocPath, docOpts);
|
|
189
189
|
if (props) return componentDetailProps(docs);
|
|
@@ -224,7 +224,7 @@ export async function component(name, options = {}) {
|
|
|
224
224
|
|
|
225
225
|
// ── Blocks mode ──────────────────────────────────────────────
|
|
226
226
|
if (blocks) {
|
|
227
|
-
return componentDetailBlocks(dirName);
|
|
227
|
+
return componentDetailBlocks(dirName, cwd);
|
|
228
228
|
}
|
|
229
229
|
|
|
230
230
|
// ── Sub-component scoping ────────────────────────────────────
|
|
@@ -31,9 +31,10 @@ export type ComponentListData = ({
|
|
|
31
31
|
/**
|
|
32
32
|
* A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
|
|
33
33
|
* list moved from bare strings to package-qualified objects so consumers can
|
|
34
|
-
* disambiguate ownership (core vs. an integration package). Integration
|
|
35
|
-
* carry `import` — the
|
|
36
|
-
*
|
|
34
|
+
* disambiguate ownership (core vs. an integration package). Integration and
|
|
35
|
+
* legacy `astryx.docs` package entries carry `import` — the same specifier their
|
|
36
|
+
* `component.detail` reports; core entries omit it (the specifier is derived
|
|
37
|
+
* from the component name by the renderer).
|
|
37
38
|
*/
|
|
38
39
|
export type ComponentListEntry = {
|
|
39
40
|
name: string;
|
|
@@ -42,7 +43,7 @@ export type ComponentListEntry = {
|
|
|
42
43
|
*/
|
|
43
44
|
package: string;
|
|
44
45
|
/**
|
|
45
|
-
* - Import specifier; present for integration components, absent for core.
|
|
46
|
+
* - Import specifier; present for integration and legacy package components, absent for core.
|
|
46
47
|
*/
|
|
47
48
|
import?: string | undefined;
|
|
48
49
|
};
|
|
@@ -52,13 +52,14 @@
|
|
|
52
52
|
/**
|
|
53
53
|
* A single entry in a `component.list` group at `detail: 'names'`. Pre-1.0 the
|
|
54
54
|
* list moved from bare strings to package-qualified objects so consumers can
|
|
55
|
-
* disambiguate ownership (core vs. an integration package). Integration
|
|
56
|
-
* carry `import` — the
|
|
57
|
-
*
|
|
55
|
+
* disambiguate ownership (core vs. an integration package). Integration and
|
|
56
|
+
* legacy `astryx.docs` package entries carry `import` — the same specifier their
|
|
57
|
+
* `component.detail` reports; core entries omit it (the specifier is derived
|
|
58
|
+
* from the component name by the renderer).
|
|
58
59
|
* @typedef {object} ComponentListEntry
|
|
59
60
|
* @property {string} name
|
|
60
61
|
* @property {string} package - Owner package, e.g. '@astryxdesign/core' or '@acme/astryx-meta'.
|
|
61
|
-
* @property {string} [import] - Import specifier; present for integration components, absent for core.
|
|
62
|
+
* @property {string} [import] - Import specifier; present for integration and legacy package components, absent for core.
|
|
62
63
|
*/
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* envelope, splitting them into the hero showcase, component-specific examples,
|
|
7
7
|
* and broader related blocks.
|
|
8
8
|
* @param {string} componentName
|
|
9
|
+
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
9
10
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
10
11
|
*/
|
|
11
|
-
export function componentDetailBlocks(componentName: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
|
|
12
|
+
export function componentDetailBlocks(componentName: string, cwd: string): Promise<import("../../component.type.mjs").ComponentDetailBlocksResponse>;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* @file `component.detail.blocks` leaf — a component's example/related blocks.
|
|
5
5
|
*
|
|
6
|
-
* @input a component name
|
|
6
|
+
* @input a component name + the project cwd
|
|
7
7
|
* @output the `component.detail.blocks` envelope (showcase, examples, related)
|
|
8
8
|
* @position api/component/detail/blocks (projection leaf; routed by component.mjs)
|
|
9
9
|
*/
|
|
@@ -16,10 +16,11 @@ import {findRelatedBlocks} from '../../../template/template.mjs';
|
|
|
16
16
|
* envelope, splitting them into the hero showcase, component-specific examples,
|
|
17
17
|
* and broader related blocks.
|
|
18
18
|
* @param {string} componentName
|
|
19
|
+
* @param {string} cwd - project to discover blocks from; never the process cwd
|
|
19
20
|
* @returns {Promise<import('../../component.type.mjs').ComponentDetailBlocksResponse>}
|
|
20
21
|
*/
|
|
21
|
-
export async function componentDetailBlocks(componentName) {
|
|
22
|
-
const allBlocks = await findRelatedBlocks(componentName);
|
|
22
|
+
export async function componentDetailBlocks(componentName, cwd) {
|
|
23
|
+
const allBlocks = await findRelatedBlocks(componentName, cwd);
|
|
23
24
|
const toEntry = (/** @type {any} */ b) => ({
|
|
24
25
|
name: b.dirName,
|
|
25
26
|
displayName: b.name,
|
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* @typedef {import('../component.type.mjs').ComponentListResponse} ComponentListResponse
|
|
6
|
-
* @typedef {import('../component.type.mjs').ComponentListEntry} ComponentListEntry
|
|
7
|
-
* @typedef {import('../component.type.mjs').ComponentBriefEntry} ComponentBriefEntry
|
|
8
|
-
*/
|
|
9
4
|
/**
|
|
10
5
|
* Build the `component.list` envelope. The list taxonomy is collapsed: all
|
|
11
6
|
* three detail levels emit ONE `component.list` type; the depth rides in
|
|
@@ -17,13 +17,14 @@ import {
|
|
|
17
17
|
discoverExternalComponentsGrouped,
|
|
18
18
|
discoverIntegrationComponents,
|
|
19
19
|
findComponentReadme,
|
|
20
|
+
findExternalComponentDoc,
|
|
20
21
|
resolveImportPath,
|
|
21
22
|
resolveIntegrationImportPath,
|
|
22
23
|
} from '../../../foundation/discovery/component-discovery.mjs';
|
|
23
24
|
import {discoverExternalPackages} from '../../../foundation/fs/paths.mjs';
|
|
24
25
|
import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
|
|
25
26
|
import {AstryxError} from '../../error.mjs';
|
|
26
|
-
import {loadComponentDoc, loadIntegrationsSafely} from '../_adapter.mjs';
|
|
27
|
+
import {loadComponentDoc, loadIntegrationsSafely, withOwnership} from '../_adapter.mjs';
|
|
27
28
|
|
|
28
29
|
/**
|
|
29
30
|
* @typedef {import('../component.type.mjs').ComponentListResponse} ComponentListResponse
|
|
@@ -31,6 +32,29 @@ import {loadComponentDoc, loadIntegrationsSafely} from '../_adapter.mjs';
|
|
|
31
32
|
* @typedef {import('../component.type.mjs').ComponentBriefEntry} ComponentBriefEntry
|
|
32
33
|
*/
|
|
33
34
|
|
|
35
|
+
/**
|
|
36
|
+
* The import a legacy `pkg.astryx.docs` component's detail reports, derived the
|
|
37
|
+
* same way (`withOwnership`) so list and detail agree.
|
|
38
|
+
* @param {{name: string, docsDir: string}} ext
|
|
39
|
+
* @param {string} name
|
|
40
|
+
* @param {string} coreDir
|
|
41
|
+
* @param {{zh: boolean, lang: string|null}} docOpts
|
|
42
|
+
* @returns {Promise<string>}
|
|
43
|
+
*/
|
|
44
|
+
async function legacyImport(ext, name, coreDir, docOpts) {
|
|
45
|
+
const docPath = findExternalComponentDoc(ext.docsDir, name);
|
|
46
|
+
/** @type {import('../_adapter.mjs').LoadedComponentDoc} */
|
|
47
|
+
let docs = {};
|
|
48
|
+
if (docPath && docPath.endsWith('.doc.mjs')) {
|
|
49
|
+
try {
|
|
50
|
+
docs = await loadComponentDoc(docPath, docOpts);
|
|
51
|
+
} catch {
|
|
52
|
+
// Keep list resilient; validation owns malformed docs.
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return withOwnership(docs, {package: ext.name, sourcePath: null}, name, coreDir).import;
|
|
56
|
+
}
|
|
57
|
+
|
|
34
58
|
/**
|
|
35
59
|
* Build the `component.list` envelope. The list taxonomy is collapsed: all
|
|
36
60
|
* three detail levels emit ONE `component.list` type; the depth rides in
|
|
@@ -267,20 +291,24 @@ export async function componentList(
|
|
|
267
291
|
k => grouped[k].length > 1 || grouped[k][0] !== k,
|
|
268
292
|
);
|
|
269
293
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
294
|
+
/** @param {string[]} names */
|
|
295
|
+
const entriesFor = names =>
|
|
296
|
+
Promise.all(
|
|
297
|
+
names.map(async n => ({
|
|
273
298
|
name: n,
|
|
274
299
|
package: ext.name,
|
|
275
|
-
|
|
300
|
+
import: await legacyImport(ext, n, coreDir, {zh, lang}),
|
|
301
|
+
})),
|
|
302
|
+
);
|
|
303
|
+
|
|
304
|
+
if (hasGroups) {
|
|
305
|
+
for (const [group, members] of Object.entries(grouped)) {
|
|
306
|
+
listData[`${group} (${ext.name})`] = await entriesFor(members);
|
|
276
307
|
}
|
|
277
308
|
} else {
|
|
278
309
|
const allComps = Object.values(grouped).flat().sort();
|
|
279
310
|
if (allComps.length > 0) {
|
|
280
|
-
listData[`${ext.category} (${ext.name})`] =
|
|
281
|
-
name: n,
|
|
282
|
-
package: ext.name,
|
|
283
|
-
}));
|
|
311
|
+
listData[`${ext.category} (${ext.name})`] = await entriesFor(allComps);
|
|
284
312
|
}
|
|
285
313
|
}
|
|
286
314
|
}
|
package/api/docs/_adapter.d.mts
CHANGED
|
@@ -15,12 +15,6 @@
|
|
|
15
15
|
* @returns {Promise<DocsCatalog>}
|
|
16
16
|
*/
|
|
17
17
|
export function loadDocsCatalog(cwd?: string): Promise<DocsCatalog>;
|
|
18
|
-
/**
|
|
19
|
-
* The overlay languages a topic ships for its own file or any extension.
|
|
20
|
-
* @param {import('../../foundation/discovery/docs-discovery.mjs').DocsTopicEntry} entry
|
|
21
|
-
* @returns {string[]}
|
|
22
|
-
*/
|
|
23
|
-
export function overlayLanguages(entry: import("../../foundation/discovery/docs-discovery.mjs").DocsTopicEntry): string[];
|
|
24
18
|
/**
|
|
25
19
|
* One topic, lowered for `lang`: overlaid, extensions merged, keys stamped.
|
|
26
20
|
* Memoized per catalog, so a read that references a topic twice loads it once.
|
|
@@ -76,6 +70,7 @@ export function resolveTopicDocs(topic: string, options?: {
|
|
|
76
70
|
node: import("../../foundation/doc-compiler/compile.mjs").CompiledReferenceNode;
|
|
77
71
|
lang: string | null;
|
|
78
72
|
}>;
|
|
79
|
-
/** The localized overlays a docs read can apply. */
|
|
80
|
-
export const OVERLAY_LANGUAGES: string[];
|
|
81
73
|
import { DocsCatalog } from '../../foundation/discovery/docs-discovery.mjs';
|
|
74
|
+
import { OVERLAY_LANGUAGES } from '../../foundation/doc-compiler/read.mjs';
|
|
75
|
+
import { overlayLanguages } from '../../foundation/doc-compiler/read.mjs';
|
|
76
|
+
export { OVERLAY_LANGUAGES, overlayLanguages };
|