@astryxdesign/cli 0.3.0-canary.82d4dab → 0.3.0-canary.d1b7d82
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 +121 -85
- package/api/api-docs-parse.test.mjs +47 -0
- package/api/blog/blog.doc.d.mts +10 -0
- package/api/blog/blog.doc.mjs +66 -0
- package/api/build/build.doc.d.mts +10 -0
- package/api/build/build.doc.mjs +81 -0
- package/api/component/_adapter.mjs +3 -0
- package/api/component/component.doc.d.mts +11 -0
- package/api/component/component.doc.mjs +180 -0
- package/api/discover/discover.doc.d.mts +10 -0
- package/api/discover/discover.doc.mjs +109 -0
- package/api/docs/docs.doc.d.mts +10 -0
- package/api/docs/docs.doc.mjs +98 -0
- package/api/doctor/doctor.doc.d.mts +10 -0
- package/api/doctor/doctor.doc.mjs +49 -0
- package/api/hook/hook.doc.d.mts +10 -0
- package/api/hook/hook.doc.mjs +111 -0
- package/api/init/init.doc.d.mts +10 -0
- package/api/init/init.doc.mjs +100 -0
- package/api/integration/summarizeIssues.doc.d.mts +11 -0
- package/api/integration/summarizeIssues.doc.mjs +59 -0
- package/api/integration/validate-integration.d.mts +2 -18
- package/api/integration/validate-integration.mjs +16 -141
- package/api/integration/validateIntegration.doc.d.mts +11 -0
- package/api/integration/validateIntegration.doc.mjs +63 -0
- package/api/json/assertResponse.doc.d.mts +10 -0
- package/api/json/assertResponse.doc.mjs +62 -0
- package/api/json/isError.doc.d.mts +10 -0
- package/api/json/isError.doc.mjs +47 -0
- package/api/json/parseResponse.doc.d.mts +10 -0
- package/api/json/parseResponse.doc.mjs +54 -0
- package/api/layout/layoutCheck.doc.d.mts +11 -0
- package/api/layout/layoutCheck.doc.mjs +84 -0
- package/api/layout/layoutExpand.doc.d.mts +11 -0
- package/api/layout/layoutExpand.doc.mjs +106 -0
- package/api/layout/layoutGrammar.doc.d.mts +11 -0
- package/api/layout/layoutGrammar.doc.mjs +56 -0
- package/api/search/search.d.mts +1 -1
- package/api/search/search.doc.d.mts +10 -0
- package/api/search/search.doc.mjs +71 -0
- package/api/swizzle/swizzle.doc.d.mts +10 -0
- package/api/swizzle/swizzle.doc.mjs +119 -0
- package/api/template/copy/copy.d.mts +2 -2
- package/api/template/copy/copy.mjs +2 -2
- package/api/template/list/list.d.mts +2 -2
- package/api/template/list/list.mjs +2 -2
- package/api/template/show/show.d.mts +2 -2
- package/api/template/show/show.mjs +2 -2
- package/api/template/skeleton/skeleton.d.mts +3 -3
- package/api/template/skeleton/skeleton.mjs +3 -3
- package/api/template/template.d.mts +7 -7
- package/api/template/template.doc.d.mts +10 -0
- package/api/template/template.doc.mjs +142 -0
- package/api/template/template.mjs +7 -7
- package/api/theme/listThemes.doc.d.mts +12 -0
- package/api/theme/listThemes.doc.mjs +44 -0
- package/api/theme/themeAdd.doc.d.mts +11 -0
- package/api/theme/themeAdd.doc.mjs +92 -0
- package/api/theme/themeBuild.doc.d.mts +11 -0
- package/api/theme/themeBuild.doc.mjs +108 -0
- package/api/theme/themeList.doc.d.mts +11 -0
- package/api/theme/themeList.doc.mjs +43 -0
- package/api/upgrade/upgrade.doc.d.mts +10 -0
- package/api/upgrade/upgrade.doc.mjs +139 -0
- package/authoring/_shared/errors.d.mts +21 -0
- package/authoring/codemod/codemod.doc.d.mts +11 -0
- package/authoring/codemod/codemod.doc.mjs +155 -0
- package/authoring/codemod/parse.d.mts +48 -2
- package/authoring/config/config.doc.d.mts +10 -0
- package/authoring/config/config.doc.mjs +72 -0
- package/authoring/config/parse.d.mts +54 -2
- package/authoring/doctypes/_schema.d.mts +248 -0
- package/authoring/doctypes/_schema.mjs +140 -2
- package/authoring/doctypes/command/command.doc.d.mts +12 -0
- package/authoring/doctypes/command/command.doc.mjs +241 -0
- package/authoring/doctypes/command/parse.d.mts +13 -0
- package/authoring/doctypes/command/parse.mjs +26 -0
- package/authoring/doctypes/command/type.ts +87 -0
- package/authoring/doctypes/component/component.doc.d.mts +11 -0
- package/authoring/doctypes/component/component.doc.mjs +254 -0
- package/authoring/doctypes/component/parse.d.mts +11 -2
- package/authoring/doctypes/doctypes-new.test.mjs +120 -0
- package/authoring/doctypes/enum/enum.doc.d.mts +11 -0
- package/authoring/doctypes/enum/enum.doc.mjs +114 -0
- package/authoring/doctypes/enum/parse.d.mts +13 -0
- package/authoring/doctypes/enum/parse.mjs +26 -0
- package/authoring/doctypes/enum/type.ts +39 -0
- package/authoring/doctypes/function/function.doc.d.mts +11 -0
- package/authoring/doctypes/function/function.doc.mjs +266 -0
- package/authoring/doctypes/function/parse.d.mts +13 -0
- package/authoring/doctypes/function/parse.mjs +30 -0
- package/authoring/doctypes/function/type.ts +91 -0
- package/authoring/doctypes/hook/hook.doc.d.mts +10 -0
- package/authoring/doctypes/hook/hook.doc.mjs +200 -0
- package/authoring/doctypes/hook/parse.d.mts +11 -2
- package/authoring/doctypes/legacy.d.mts +13 -2
- package/authoring/doctypes/parse.d.mts +29 -3
- package/authoring/doctypes/parse.mjs +16 -2
- package/authoring/doctypes/reference/parse.d.mts +11 -2
- package/authoring/doctypes/reference/reference.doc.d.mts +11 -0
- package/authoring/doctypes/reference/reference.doc.mjs +146 -0
- package/authoring/doctypes/schema/parse.d.mts +13 -0
- package/authoring/doctypes/schema/parse.mjs +26 -0
- package/authoring/doctypes/schema/schema.doc.d.mts +11 -0
- package/authoring/doctypes/schema/schema.doc.mjs +197 -0
- package/authoring/doctypes/schema/type.ts +62 -0
- package/authoring/doctypes/template/parse.d.mts +12 -2
- package/authoring/doctypes/template/template.doc.d.mts +11 -0
- package/authoring/doctypes/template/template.doc.mjs +162 -0
- package/authoring/doctypes/types.ts +4 -0
- package/authoring/index.d.mts +16 -0
- package/authoring/index.d.ts +20 -0
- package/authoring/index.mjs +4 -0
- package/authoring/integration/integration.doc.d.mts +10 -0
- package/authoring/integration/integration.doc.mjs +75 -0
- package/authoring/integration/parse.d.mts +30 -2
- package/clients/cli/commands/blog.doc.mjs +32 -0
- package/clients/cli/commands/blog.mjs +8 -5
- package/clients/cli/commands/build-theme.mjs +163 -169
- package/clients/cli/commands/build.doc.mjs +50 -0
- package/clients/cli/commands/build.mjs +8 -8
- package/clients/cli/commands/component/index.mjs +8 -12
- package/clients/cli/commands/component.doc.mjs +76 -0
- package/clients/cli/commands/discover.doc.mjs +43 -0
- package/clients/cli/commands/discover.mjs +8 -6
- package/clients/cli/commands/docs.doc.mjs +38 -0
- package/clients/cli/commands/docs.mjs +8 -5
- package/clients/cli/commands/doctor.doc.mjs +31 -0
- package/clients/cli/commands/doctor.mjs +13 -11
- package/clients/cli/commands/hook/index.mjs +8 -8
- package/clients/cli/commands/hook.doc.mjs +51 -0
- package/clients/cli/commands/init.doc.mjs +65 -0
- package/clients/cli/commands/init.mjs +8 -10
- package/clients/cli/commands/layout-check.doc.mjs +54 -0
- package/clients/cli/commands/layout-expand.doc.mjs +66 -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.mjs +28 -25
- package/clients/cli/commands/manifest.doc.mjs +30 -0
- package/clients/cli/commands/search.doc.mjs +51 -0
- package/clients/cli/commands/search.mjs +17 -11
- package/clients/cli/commands/swizzle.doc.mjs +58 -0
- package/clients/cli/commands/swizzle.mjs +8 -9
- package/clients/cli/commands/template.doc.mjs +67 -0
- package/clients/cli/commands/template.mjs +8 -10
- package/clients/cli/commands/theme-add.doc.mjs +50 -0
- package/clients/cli/commands/theme-build.doc.mjs +58 -0
- package/clients/cli/commands/theme-list.doc.mjs +28 -0
- package/clients/cli/commands/theme.doc.mjs +31 -0
- package/clients/cli/commands/upgrade.doc.mjs +90 -0
- package/clients/cli/commands/upgrade.mjs +19 -15
- package/clients/cli/commands/validate-integration.doc.mjs +36 -0
- package/clients/cli/commands/validate-integration.mjs +16 -16
- package/clients/cli/lib/define-command.mjs +72 -0
- package/clients/cli/lib/define-command.test.mjs +49 -0
- package/clients/cli/lib/manifest.mjs +1 -1
- package/foundation/agent-docs/agent-docs.d.mts +197 -0
- package/foundation/config/config-cache.d.mts +53 -0
- package/foundation/config/project.d.mts +154 -0
- package/foundation/config/project.mjs +3 -3
- package/foundation/discovery/component-discovery.d.mts +140 -0
- package/foundation/discovery/component-loader.d.mts +50 -0
- package/foundation/discovery/hook-discovery.d.mts +28 -0
- package/{api/template/_adapter.d.mts → foundation/discovery/template-adapter.d.mts} +1 -1
- package/{api/template/_adapter.mjs → foundation/discovery/template-adapter.mjs} +20 -15
- package/foundation/env/node-version.d.mts +52 -0
- package/foundation/env/package-manager.d.mts +84 -0
- package/foundation/env/semver.d.mts +56 -0
- package/foundation/fs/module-loader.d.mts +36 -0
- package/foundation/fs/path-safety.d.mts +74 -0
- package/foundation/fs/paths.d.mts +35 -0
- package/foundation/integrations/integration-warnings.d.mts +17 -0
- package/foundation/integrations/integration-warnings.mjs +1 -1
- package/foundation/integrations/integrations.d.mts +80 -0
- package/foundation/integrations/validate-contributions.d.mts +22 -0
- package/foundation/integrations/validate-contributions.mjs +162 -0
- package/foundation/response/error-codes.d.mts +103 -0
- package/foundation/response/error-codes.doc.d.mts +11 -0
- package/foundation/response/error-codes.doc.mjs +239 -0
- package/foundation/response/json.d.mts +75 -0
- package/foundation/response/response-types.doc.d.mts +12 -0
- package/foundation/response/response-types.doc.mjs +242 -0
- package/foundation/response/response.doc.d.mts +11 -0
- package/foundation/response/response.doc.mjs +161 -0
- package/foundation/text/levenshtein.d.mts +21 -0
- package/foundation/text/string-utils.d.mts +43 -0
- package/foundation/xle/browser.d.mts +89 -0
- package/foundation/xle/expand.d.mts +23 -0
- package/foundation/xle/parse.d.mts +72 -0
- package/foundation/xle/print.d.mts +7 -0
- package/foundation/xle/registry-core.d.mts +168 -0
- package/foundation/xle/registry.d.mts +19 -0
- package/foundation/xle/splice.d.mts +42 -0
- package/foundation/xle/validate.d.mts +94 -0
- package/package.json +14 -10
package/README.md
CHANGED
|
@@ -56,19 +56,28 @@ Options:
|
|
|
56
56
|
|
|
57
57
|
## Commands
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
|
62
|
-
|
|
|
63
|
-
| `
|
|
64
|
-
| `
|
|
65
|
-
| `
|
|
66
|
-
| `
|
|
67
|
-
| `
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
59
|
+
<!-- BEGIN GENERATED: commands -->
|
|
60
|
+
|
|
61
|
+
| Command | Description |
|
|
62
|
+
| ---------------------- | ----------------------------------------------------------------------------- |
|
|
63
|
+
| `blog` | Read the Astryx blog from the published feed |
|
|
64
|
+
| `build` | Build a page: composition kit for an idea, or the workflow playbook (no args) |
|
|
65
|
+
| `component` | List components or print component docs |
|
|
66
|
+
| `discover` | Discover external packages and components |
|
|
67
|
+
| `docs` | Print reference docs |
|
|
68
|
+
| `doctor` | Diagnose your XDS setup and report problems with fixes |
|
|
69
|
+
| `hook` | List hooks or print hook docs |
|
|
70
|
+
| `init` | Initialize the design system in your project |
|
|
71
|
+
| `layout` | Generate XDS layouts from compressed expressions (XLE/XLO) |
|
|
72
|
+
| `search` | Search components, hooks, docs, and templates in one ranked list |
|
|
73
|
+
| `swizzle` | Copy component source for customization |
|
|
74
|
+
| `template` | Inject a page or block template |
|
|
75
|
+
| `theme` | Theme tools — build, export, and manage themes |
|
|
76
|
+
| `upgrade` | Run codemods to migrate between versions |
|
|
77
|
+
| `validate-integration` | Validate an Astryx integration package (manifest + contributions) |
|
|
78
|
+
|
|
79
|
+
<!-- END GENERATED: commands -->
|
|
80
|
+
<!-- Generated by scripts/generate-cli-readme.mjs from `astryx manifest`. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
72
81
|
|
|
73
82
|
### Global options
|
|
74
83
|
|
|
@@ -127,45 +136,56 @@ if (isError(result)) {
|
|
|
127
136
|
|
|
128
137
|
### Error codes
|
|
129
138
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
|
133
|
-
|
|
|
134
|
-
| `
|
|
135
|
-
| `
|
|
136
|
-
| `
|
|
137
|
-
| `
|
|
138
|
-
| `
|
|
139
|
-
| `
|
|
140
|
-
| `
|
|
141
|
-
| `
|
|
142
|
-
| `
|
|
143
|
-
| `
|
|
144
|
-
| `
|
|
145
|
-
| `
|
|
146
|
-
| `
|
|
147
|
-
| `
|
|
148
|
-
| `
|
|
149
|
-
| `
|
|
150
|
-
| `
|
|
151
|
-
| `
|
|
152
|
-
| `
|
|
153
|
-
| `
|
|
154
|
-
| `
|
|
155
|
-
| `
|
|
156
|
-
| `
|
|
157
|
-
| `
|
|
158
|
-
| `
|
|
159
|
-
| `
|
|
160
|
-
| `
|
|
161
|
-
| `
|
|
162
|
-
| `
|
|
163
|
-
| `
|
|
164
|
-
| `
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
167
|
-
| `
|
|
168
|
-
| `
|
|
139
|
+
<!-- BEGIN GENERATED: error-codes -->
|
|
140
|
+
|
|
141
|
+
| Code | Meaning |
|
|
142
|
+
| ------------------------- | ------------------------------------------------------------------------------------- |
|
|
143
|
+
| `ERR_UNKNOWN` | Fallback for any error without a more specific code. |
|
|
144
|
+
| `ERR_UNKNOWN_COMMAND` | A top-level command name was not recognized (e.g. `astryx bogus`). |
|
|
145
|
+
| `ERR_UNKNOWN_SUBCOMMAND` | A subcommand under a command group was not recognized (e.g. `astryx theme bogus`). |
|
|
146
|
+
| `ERR_INVALID_OPTION` | An unknown flag/option was passed (Commander `unknownOption`). |
|
|
147
|
+
| `ERR_INVALID_ARGUMENT` | An option/argument had a value Commander's parser rejected. |
|
|
148
|
+
| `ERR_MISSING_ARGUMENT` | A required positional argument was omitted (Commander `missingArgument`). |
|
|
149
|
+
| `ERR_INVALID_LANG` | `--lang` was given a value outside its choices (en, zh, dense). |
|
|
150
|
+
| `ERR_INVALID_DETAIL` | `--detail` was given a value outside its choices (full, compact, brief). |
|
|
151
|
+
| `ERR_NODE_VERSION` | The running Node.js version is below the supported minimum. |
|
|
152
|
+
| `ERR_CORE_NOT_FOUND` | `@astryxdesign/core` could not be located (not installed / not in a monorepo). |
|
|
153
|
+
| `ERR_UNKNOWN_COMPONENT` | No component matched the requested name. |
|
|
154
|
+
| `ERR_UNKNOWN_HOOK` | No hook matched the requested name. |
|
|
155
|
+
| `ERR_UNKNOWN_TOPIC` | No docs topic matched the requested name. |
|
|
156
|
+
| `ERR_UNKNOWN_SECTION` | A docs topic exists but the requested section within it does not. |
|
|
157
|
+
| `ERR_UNKNOWN_CATEGORY` | A `--category` filter value did not match any known category. |
|
|
158
|
+
| `ERR_UNKNOWN_TEMPLATE` | No template matched the requested name. |
|
|
159
|
+
| `ERR_AMBIGUOUS_TEMPLATE` | A template id matched more than one template (narrow with --type/--package). |
|
|
160
|
+
| `ERR_AMBIGUOUS_COMPONENT` | A component name is owned by more than one package (narrow with --package). |
|
|
161
|
+
| `ERR_UNKNOWN_THEME` | No theme matched the requested slug (theme add). |
|
|
162
|
+
| `ERR_UNKNOWN_PACKAGE` | No package matched the requested name (discover). |
|
|
163
|
+
| `ERR_UNKNOWN_AGENT` | An unrecognized `--agent` value was passed to agent-docs/init. |
|
|
164
|
+
| `ERR_UNKNOWN_FEATURE` | An unrecognized `--features` value was passed to init. |
|
|
165
|
+
| `ERR_UNKNOWN_CODEMOD` | A `--codemod` value did not match any registered codemod (upgrade). |
|
|
166
|
+
| `ERR_CODEMOD_FAILED` | One or more codemods failed during an upgrade run. |
|
|
167
|
+
| `ERR_NOT_FOUND` | A generic discover/lookup query matched nothing in any package. |
|
|
168
|
+
| `ERR_NO_DOC` | A component exists but has no typed `.doc.mjs` file. |
|
|
169
|
+
| `ERR_NO_SHOWCASE` | No showcase exists for the requested component. |
|
|
170
|
+
| `ERR_NO_SOURCE` | No source file could be located for the requested component/template. |
|
|
171
|
+
| `ERR_INVALID_DOC` | A component's docs failed validation (malformed `.doc.mjs`). |
|
|
172
|
+
| `ERR_FILE_NOT_FOUND` | A required input file did not exist. |
|
|
173
|
+
| `ERR_FILE_EXISTS` | Refused to overwrite an existing file in non-interactive mode. |
|
|
174
|
+
| `ERR_PATH_TRAVERSAL` | A path escaped its allowed root, or a name contained traversal markers. |
|
|
175
|
+
| `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
|
|
176
|
+
| `ERR_THEME_INVALID` | A theme definition was missing a required property (e.g. `name`). |
|
|
177
|
+
| `ERR_THEME_LOAD` | A theme file could not be loaded / parsed into a defineTheme result. |
|
|
178
|
+
| `ERR_VERSION_DETECT` | The current `@astryxdesign/core` version could not be detected. |
|
|
179
|
+
| `ERR_INVALID_VERSION` | A `--from`/`--to` value was not a valid semver string. |
|
|
180
|
+
| `ERR_DEP_MISSING` | A required external dependency (e.g. jscodeshift) is missing. |
|
|
181
|
+
| `ERR_GH_CLI` | GitHub CLI (`gh`) is not installed or not authenticated. |
|
|
182
|
+
| `ERR_UNKNOWN_POST` | No blog post matched the requested slug in the feed. |
|
|
183
|
+
| `ERR_FETCH_FAILED` | A network fetch (RSS feed or post text) failed. |
|
|
184
|
+
| `ERR_LAYOUT_PARSE` | A layout expression failed to parse (syntax error, with line/col). |
|
|
185
|
+
| `ERR_LAYOUT_INVALID` | A layout expression parsed but failed validation (unknown component/prop/enum/block). |
|
|
186
|
+
|
|
187
|
+
<!-- END GENERATED: error-codes -->
|
|
188
|
+
<!-- Generated by scripts/generate-cli-readme.mjs from the error-codes EnumDoc (== ERROR_CODES). Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
169
189
|
|
|
170
190
|
## Capability manifest (agent discovery)
|
|
171
191
|
|
|
@@ -359,39 +379,55 @@ detail.data.name; // narrowed
|
|
|
359
379
|
|
|
360
380
|
### Type discriminators
|
|
361
381
|
|
|
362
|
-
Every response has a `type`
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
|
367
|
-
|
|
|
368
|
-
| `
|
|
369
|
-
| `
|
|
370
|
-
| `
|
|
371
|
-
| `
|
|
372
|
-
| `
|
|
373
|
-
| `
|
|
374
|
-
| `
|
|
375
|
-
| `
|
|
376
|
-
| `
|
|
377
|
-
| `
|
|
378
|
-
| `
|
|
379
|
-
| `
|
|
380
|
-
| `
|
|
381
|
-
| `
|
|
382
|
-
| `
|
|
383
|
-
| `
|
|
384
|
-
| `
|
|
385
|
-
| `
|
|
386
|
-
| `
|
|
387
|
-
| `
|
|
388
|
-
| `
|
|
389
|
-
| `
|
|
390
|
-
| `
|
|
391
|
-
| `
|
|
392
|
-
| `
|
|
393
|
-
|
|
|
394
|
-
|
|
|
382
|
+
Every response has a `type` discriminant. The full set is below (generated from the manifest). Each command's `type`s are also listed in `astryx manifest --json`, and the matching `*Response` TypeScript types (e.g. `ComponentDetailResponse`) are exported from `@astryxdesign/cli/json`. Errors use `CLIError`, and unsupported commands use `CLIUnsupportedError`.
|
|
383
|
+
|
|
384
|
+
<!-- BEGIN GENERATED: response-types -->
|
|
385
|
+
|
|
386
|
+
| Type | What `data` carries |
|
|
387
|
+
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
388
|
+
| `component.list` | The component catalog grouped by category: `detail` (the level — names \| compact \| full) and `components`, the grouped map of names+package, brief entries, or a full ComponentDoc per entry. |
|
|
389
|
+
| `component.detail` | One component's authored ComponentDoc plus ownership metadata (owner package, import specifier, and whether source is available). |
|
|
390
|
+
| `component.detail.props` | Just one component's props table (ComponentPropDoc[]). |
|
|
391
|
+
| `component.detail.source` | One component's source file, as {component, source}. |
|
|
392
|
+
| `component.detail.showcase` | One component's showcase example, as {component, aspectRatio, source}. |
|
|
393
|
+
| `component.detail.blocks` | One component's example blocks, as {component, showcase, examples, related} of BlockEntry. |
|
|
394
|
+
| `docs.list` | All reference-doc topics as DocsListEntry[] ({topic, description}), in discovery order. |
|
|
395
|
+
| `docs.detail` | One topic's full ReferenceDoc, with token-ref blocks inlined. |
|
|
396
|
+
| `docs.detail.section` | A single ReferenceSection of a topic — the first whose title contains the section query. |
|
|
397
|
+
| `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. |
|
|
398
|
+
| `blog.detail` | One post's metadata plus the feed URL and the post's full plaintext body. |
|
|
399
|
+
| `discover.list` | The configured external packages (name, category, components, version, description); when empty it carries meta.configured to tell "nothing configured" from "nothing discovered". |
|
|
400
|
+
| `discover.detail` | A single external package entry, for an @scope/name query. |
|
|
401
|
+
| `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. |
|
|
402
|
+
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components. |
|
|
403
|
+
| `search` | The echoed query plus a ranked SearchResultEntry[] (domain, name, score, reason, description, follow-up command, and import path where relevant). |
|
|
404
|
+
| `build.help` | A marker (`playbook: true`) that the renderer expands into the how-to-build-a-page workflow; emitted when no query is given. |
|
|
405
|
+
| `build.kit` | The grouped composition kit: echoed query, hasResults/directMatch flags, the closest page templates, drop-in block patterns, idea-specific components/hooks, and the always-on frame + foundation component-name arrays. |
|
|
406
|
+
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
|
|
407
|
+
| `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. |
|
|
408
|
+
| `template.list` | Every discovered template (page + block); each entry carries id, name, description, kind, owning package, optional category and componentsUsed, and readiness flags. |
|
|
409
|
+
| `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes. |
|
|
410
|
+
| `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
|
|
411
|
+
| `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count. |
|
|
412
|
+
| `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. |
|
|
413
|
+
| `hook.detail` | One hook's full authored HookDoc. |
|
|
414
|
+
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
|
|
415
|
+
| `theme.build` | A theme build receipt: name, token- and component-override counts, output size, the written outputs {css, js, dts, and variantsDts when applicable}, and any validation warnings. |
|
|
416
|
+
| `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. |
|
|
417
|
+
| `theme.list` | Every bundled theme as a ThemeListEntry[] — each with slug, displayName, description, and a maintained flag. |
|
|
418
|
+
| `theme.add` | A scaffold receipt: resolved slug, displayName, maintained flag, outputDir (relative to cwd), the theme entry file, its exportName, and the files written. |
|
|
419
|
+
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
|
|
420
|
+
| `upgrade.status` | A short-circuit outcome with no codemods run — up_to_date, no_codemods, or config_fixable — each carrying the agent-docs summary. |
|
|
421
|
+
| `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. |
|
|
422
|
+
| `manifest` | The self-describing CLI capability manifest: name, version, apiVersion, global options, the command tree (args, options, json flag, response types, examples), the jsonSupported allowlist, and the flat responseTypes index. |
|
|
423
|
+
| `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. |
|
|
424
|
+
| `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}. |
|
|
425
|
+
| `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). |
|
|
426
|
+
| `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). |
|
|
427
|
+
| `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. |
|
|
428
|
+
|
|
429
|
+
<!-- END GENERATED: response-types -->
|
|
430
|
+
<!-- Generated by scripts/generate-cli-readme.mjs from the response-types EnumDoc. Run `pnpm -F @astryxdesign/cli readme`. -->
|
|
395
431
|
|
|
396
432
|
## Doctor
|
|
397
433
|
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file Validates every colocated FunctionDoc under `api/**` — each `*.doc.mjs`
|
|
5
|
+
* must export a `doc` that passes `parseDoc` (stamped `type: 'function'`). This
|
|
6
|
+
* is the safety net for the hand-authored API function docs.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from 'node:fs';
|
|
10
|
+
import * as path from 'node:path';
|
|
11
|
+
import {fileURLToPath, pathToFileURL} from 'node:url';
|
|
12
|
+
import {describe, it, expect} from 'vitest';
|
|
13
|
+
import {parseDoc} from '../authoring/index.mjs';
|
|
14
|
+
|
|
15
|
+
const API_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
|
|
17
|
+
/** @param {string} dir @returns {string[]} */
|
|
18
|
+
function findDocs(dir) {
|
|
19
|
+
/** @type {string[]} */
|
|
20
|
+
const out = [];
|
|
21
|
+
for (const entry of fs.readdirSync(dir, {withFileTypes: true})) {
|
|
22
|
+
const p = path.join(dir, entry.name);
|
|
23
|
+
if (entry.isDirectory()) out.push(...findDocs(p));
|
|
24
|
+
else if (entry.name.endsWith('.doc.mjs')) out.push(p);
|
|
25
|
+
}
|
|
26
|
+
return out;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
describe('api FunctionDocs', () => {
|
|
30
|
+
const files = findDocs(API_DIR);
|
|
31
|
+
|
|
32
|
+
it('discovers colocated function docs', () => {
|
|
33
|
+
expect(files.length).toBeGreaterThan(0);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
for (const file of files) {
|
|
37
|
+
const rel = path.relative(API_DIR, file);
|
|
38
|
+
it(`parses ${rel}`, async () => {
|
|
39
|
+
const mod = await import(pathToFileURL(file).href);
|
|
40
|
+
const doc = mod.doc ?? mod.docs;
|
|
41
|
+
expect(doc, `${rel} must export \`doc\``).toBeTruthy();
|
|
42
|
+
expect(doc.type, `${rel} should be a function doc`).toBe('function');
|
|
43
|
+
const parsed = parseDoc(doc);
|
|
44
|
+
expect(parsed.name, `${rel} needs a name`).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file FunctionDoc for `blog()` / `astryx blog`. Colocated with the API
|
|
6
|
+
* function it documents; the shape source of truth stays in `blog.type.mjs`.
|
|
7
|
+
* @position packages/cli/api/blog — function documentation
|
|
8
|
+
*/
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
10
|
+
export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file FunctionDoc for `blog()` / `astryx blog`. Colocated with the API
|
|
5
|
+
* function it documents; the shape source of truth stays in `blog.type.mjs`.
|
|
6
|
+
* @position packages/cli/api/blog — function documentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
10
|
+
export const doc = {
|
|
11
|
+
type: 'function',
|
|
12
|
+
kind: 'api',
|
|
13
|
+
name: 'blog',
|
|
14
|
+
displayName: 'blog()',
|
|
15
|
+
summary: 'List blog posts, or read one, from the published RSS feed.',
|
|
16
|
+
description:
|
|
17
|
+
'Reads the design system blog the same way any feed reader does — over the ' +
|
|
18
|
+
"published RSS feed, never the blog's source files. With no slug it lists every " +
|
|
19
|
+
"post parsed from the feed; with a slug it reads that post's full plaintext body " +
|
|
20
|
+
'via the .txt alternate the feed advertises. Both envelopes carry feedUrl so a ' +
|
|
21
|
+
'caller can hit the RSS feed directly.',
|
|
22
|
+
importPath: '@astryxdesign/cli/api',
|
|
23
|
+
signature:
|
|
24
|
+
'blog(slug?: string): Promise<BlogListResponse | BlogDetailResponse>',
|
|
25
|
+
keywords: ['blog', 'posts', 'rss', 'feed', 'news', 'article'],
|
|
26
|
+
params: [
|
|
27
|
+
{
|
|
28
|
+
name: 'slug',
|
|
29
|
+
type: 'string',
|
|
30
|
+
description:
|
|
31
|
+
'Post slug (matched case-insensitively) to read in full. Omit to list every post.',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
returns: [
|
|
35
|
+
{
|
|
36
|
+
type: 'blog.list',
|
|
37
|
+
description:
|
|
38
|
+
'The feed URL plus every post parsed from the feed — each with slug, title, description, date, type, authors, link, and its plaintext URL.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
type: 'blog.detail',
|
|
42
|
+
description:
|
|
43
|
+
"One post's metadata plus the feed URL and the post's full plaintext body.",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
throws: [
|
|
47
|
+
{
|
|
48
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
49
|
+
when: 'the slug is provided but is not a string',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
code: 'ERR_UNKNOWN_POST',
|
|
53
|
+
when: 'no post in the feed matches the requested slug',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
code: 'ERR_FETCH_FAILED',
|
|
57
|
+
when: 'the RSS feed or post text cannot be fetched (network error, timeout, non-2xx, or oversized), or the post has no plaintext alternate in the feed',
|
|
58
|
+
},
|
|
59
|
+
],
|
|
60
|
+
examples: [
|
|
61
|
+
{label: 'List posts', code: 'const {data} = await blog();'},
|
|
62
|
+
{label: 'Read one post', code: "await blog('introducing-astryx');"},
|
|
63
|
+
],
|
|
64
|
+
command: 'blog',
|
|
65
|
+
related: ['docs', 'search'],
|
|
66
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file FunctionDoc for `build()` / `astryx build`. Colocated with the API
|
|
6
|
+
* function it documents; the shape source of truth stays in `build.type.mjs`.
|
|
7
|
+
* @position packages/cli/api/build — function documentation
|
|
8
|
+
*/
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
10
|
+
export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @file FunctionDoc for `build()` / `astryx build`. Colocated with the API
|
|
5
|
+
* function it documents; the shape source of truth stays in `build.type.mjs`.
|
|
6
|
+
* @position packages/cli/api/build — function documentation
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
10
|
+
export const doc = {
|
|
11
|
+
type: 'function',
|
|
12
|
+
kind: 'api',
|
|
13
|
+
name: 'build',
|
|
14
|
+
displayName: 'build()',
|
|
15
|
+
summary:
|
|
16
|
+
'Page-building assistant: the how-to-build playbook, or a composition kit for an idea.',
|
|
17
|
+
description:
|
|
18
|
+
'The "assemble a page" entry point. Called with no query it returns the ' +
|
|
19
|
+
'playbook signal that the renderer expands into the how-to-build-a-page ' +
|
|
20
|
+
'workflow. Called with a query it runs the unified search and groups the ' +
|
|
21
|
+
'hits into a composition KIT: the closest page templates, drop-in blocks, ' +
|
|
22
|
+
'and idea-specific components/hooks, plus the always-on frame + foundation.',
|
|
23
|
+
importPath: '@astryxdesign/cli/api',
|
|
24
|
+
signature:
|
|
25
|
+
'build(query?: string, options?: BuildOptions): Promise<BuildHelpResponse | BuildKitResponse>',
|
|
26
|
+
keywords: ['build', 'compose', 'assemble', 'page', 'kit', 'scaffold'],
|
|
27
|
+
params: [
|
|
28
|
+
{
|
|
29
|
+
name: 'query',
|
|
30
|
+
type: 'string',
|
|
31
|
+
description:
|
|
32
|
+
'What you\'re building (e.g. "analytics dashboard"). Omit for the how-to-build playbook.',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'options.cwd',
|
|
36
|
+
type: 'string',
|
|
37
|
+
description:
|
|
38
|
+
'Directory to resolve @astryxdesign/core and templates from.',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'options.type',
|
|
42
|
+
type: "'component' | 'hook' | 'doc' | 'template'",
|
|
43
|
+
description: 'Restrict the underlying search to a single domain.',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'options.limit',
|
|
47
|
+
type: 'number',
|
|
48
|
+
description:
|
|
49
|
+
'Max results pulled from search before grouping into the kit.',
|
|
50
|
+
default: '60',
|
|
51
|
+
},
|
|
52
|
+
],
|
|
53
|
+
returns: [
|
|
54
|
+
{
|
|
55
|
+
type: 'build.help',
|
|
56
|
+
description:
|
|
57
|
+
'Emitted when the query is omitted — a pure marker (`data.playbook: true`) that the command renderer expands into the page-building workflow prose.',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'build.kit',
|
|
61
|
+
description:
|
|
62
|
+
'The grouped composition kit: the echoed query, hasResults/directMatch flags, the closest page templates (≤3), drop-in block patterns (≤5), idea-specific components/hooks (≤6), and the always-on frame + foundation component-name arrays.',
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
throws: [
|
|
66
|
+
{
|
|
67
|
+
code: 'ERR_INVALID_ARGUMENT',
|
|
68
|
+
when: 'options.type is not a known domain, or options.limit is not a positive integer',
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
examples: [
|
|
72
|
+
{label: 'Get the playbook', code: 'const r = await build();'},
|
|
73
|
+
{label: 'Compose a page', code: "await build('analytics dashboard');"},
|
|
74
|
+
{
|
|
75
|
+
label: 'Restrict + limit',
|
|
76
|
+
code: "await build('pricing', {type: 'template', limit: 10});",
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
command: 'build',
|
|
80
|
+
related: ['search', 'template', 'component', 'hook', 'init'],
|
|
81
|
+
};
|
|
@@ -270,6 +270,9 @@ export async function resolveUnscopedDoc(dirName, {coreDir, cwd, name}) {
|
|
|
270
270
|
let resolvedName = dirName;
|
|
271
271
|
// Track the resolving owner so the detail payload can carry ownership info.
|
|
272
272
|
// Defaults to core; the legacy-external fallback below may reassign it.
|
|
273
|
+
// Annotated because CORE_PACKAGE's generated declaration carries the literal
|
|
274
|
+
// type, which (unlike a fresh literal) does not widen on assignment.
|
|
275
|
+
/** @type {string} */
|
|
273
276
|
let resolvedOwnerPackage = CORE_PACKAGE;
|
|
274
277
|
let resolvedSourcePath = readmePath ? findComponentSource(coreDir, dirName) : null;
|
|
275
278
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
|
|
2
|
+
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file FunctionDoc for `component()` / `astryx component`. Colocated with the
|
|
6
|
+
* API function it documents; the shape source of truth stays in
|
|
7
|
+
* `component.type.mjs`.
|
|
8
|
+
* @position packages/cli/api/component — function documentation
|
|
9
|
+
*/
|
|
10
|
+
/** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
|
|
11
|
+
export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
|