@astryxdesign/cli 0.6.3-canary.d0d49a4 → 0.6.3-canary.dea6813
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 +32 -18
- package/api/build/build.doc.mjs +3 -3
- package/api/build/build.test.mjs +14 -3
- package/api/build/build.type.d.mts +35 -1
- package/api/build/build.type.mjs +24 -3
- package/api/build/help/help.d.mts +8 -5
- package/api/build/help/help.mjs +56 -6
- package/api/component/component.doc.mjs +11 -2
- package/api/component/component.mjs +29 -0
- package/api/component/component.test.mjs +38 -0
- package/api/component/component.type.d.mts +11 -1
- package/api/component/component.type.mjs +8 -1
- package/api/discover/discover.doc.mjs +1 -1
- package/api/gap-report/gap-report.doc.mjs +7 -4
- package/api/init/init.doc.mjs +4 -0
- package/api/init/init.test.mjs +41 -1
- package/api/init/remove/remove.mjs +1 -1
- package/api/init/run/run.mjs +20 -10
- package/api/integration/add-contribution.component-names.test.mjs +120 -0
- package/api/integration/add-contribution.mjs +11 -0
- package/api/integration/add-contribution.test.mjs +80 -0
- package/api/integration/integrationAdd.doc.mjs +7 -4
- package/api/integration/integrationAddComponent.doc.mjs +1 -1
- package/api/integration/validate-integration.mjs +2 -0
- package/api/integration/validate-integration.test.mjs +91 -0
- package/api/integration/validateIntegration.doc.mjs +1 -1
- package/api/json/envelope-types.test.mjs +76 -0
- package/api/json/parseResponse.doc.mjs +2 -2
- package/api/layout/expand/expand.mjs +7 -5
- package/api/layout/expand/expand.path-safety.test.mjs +53 -0
- package/api/layout/grammar/grammar.mjs +2 -1
- package/api/layout/layoutExpand.doc.mjs +1 -1
- package/api/search/search-return-type.test.mjs +54 -0
- package/api/search/search.d.mts +2 -9
- package/api/search/search.doc.mjs +5 -1
- package/api/search/search.mjs +10 -3
- package/api/search/search.test.mjs +34 -0
- package/api/swizzle/copy/copy.mjs +28 -11
- package/api/swizzle/swizzle.doc.mjs +1 -1
- package/api/template/copy/copy.mjs +17 -23
- package/api/template/copy/copy.test.mjs +17 -0
- package/api/template/template.doc.mjs +2 -1
- package/api/theme/add/add.binary.test.mjs +91 -0
- package/api/theme/add/add.mjs +20 -3
- package/api/theme/add/add.staging.test.mjs +66 -0
- package/api/theme/build/build.mjs +114 -37
- package/api/theme/build/build.public-component-vars.test.mjs +1 -1
- package/api/theme/build/build.receipt-doc.test.mjs +111 -0
- package/api/theme/build/font-warning.mjs +3 -3
- package/api/theme/build/font-warning.test.mjs +5 -2
- package/api/theme/palette/generate/generate.mjs +7 -2
- package/api/theme/palette/generate/generate.test.mjs +96 -0
- package/api/theme/palette/generate/generator.mjs +8 -1
- package/api/theme/palette/generate/generator.test.mjs +10 -0
- package/api/theme/template/template.mjs +11 -2
- package/api/theme/template/template.test.mjs +15 -0
- package/api/theme/themeBuild.doc.mjs +7 -4
- package/api/theme/themeTemplate.doc.mjs +4 -1
- package/api/upgrade/_adapter.mjs +27 -4
- package/api/upgrade/list/list.mjs +2 -1
- package/api/upgrade/list/list.test.mjs +73 -0
- package/api/upgrade/status/status.mjs +2 -2
- package/api/upgrade/upgrade.doc.mjs +2 -1
- package/api/upgrade/upgrade.type.d.mts +4 -0
- package/api/upgrade/upgrade.type.mjs +1 -0
- package/assets/codemods/term-log.mjs +32 -8
- package/assets/codemods/term-log.test.mjs +19 -1
- package/assets/codemods/transforms/v0.6.0/__tests__/next-codemods.test.mjs +47 -0
- package/assets/codemods/transforms/v0.6.0/rename-resizable-pixel-bounds.mjs +57 -10
- package/assets/templates/pages/table-tree/page.tsx +1704 -0
- package/assets/templates/pages/table-tree/template.doc.mjs +12 -0
- package/authoring/config/config.doc.mjs +1 -1
- package/authoring/config/debug-composition.test.mjs +92 -0
- package/authoring/config/type.ts +15 -3
- package/clients/cli/command-load-failure.test.mjs +83 -0
- package/clients/cli/commands/blog.mjs +23 -8
- package/clients/cli/commands/blog.test.mjs +42 -1
- package/clients/cli/commands/build-theme.ascii-output.test.mjs +161 -0
- package/clients/cli/commands/build-theme.flag-docs.test.mjs +110 -0
- package/clients/cli/commands/build-theme.mjs +5 -5
- package/clients/cli/commands/build-theme.path-safety.test.mjs +86 -1
- package/clients/cli/commands/build-theme.variants.test.mjs +76 -0
- package/clients/cli/commands/build.doc.mjs +4 -1
- package/clients/cli/commands/build.exit-codes-doc.test.mjs +50 -0
- package/clients/cli/commands/build.mjs +32 -47
- package/clients/cli/commands/build.playbook.test.mjs +75 -0
- package/clients/cli/commands/build.text-fields.test.mjs +40 -0
- package/clients/cli/commands/component/index.mjs +2 -7
- package/clients/cli/commands/component-package.test.mjs +18 -0
- package/clients/cli/commands/component-resolution.test.mjs +21 -0
- package/clients/cli/commands/component.test.mjs +19 -0
- package/clients/cli/commands/detail-levels.test.mjs +2 -2
- package/clients/cli/commands/discover.broken-integration.test.mjs +48 -0
- package/clients/cli/commands/discover.components-flag.test.mjs +97 -0
- package/clients/cli/commands/discover.doc.mjs +4 -2
- package/clients/cli/commands/discover.mjs +3 -3
- package/clients/cli/commands/discover.text-projection.test.mjs +103 -0
- package/clients/cli/commands/doctor-integration.package-json.test.mjs +53 -0
- package/clients/cli/commands/doctor.mjs +6 -16
- package/clients/cli/commands/doctor.test.mjs +42 -0
- package/clients/cli/commands/gap-report.doc.mjs +16 -5
- package/clients/cli/commands/gap-report.test.mjs +72 -0
- package/clients/cli/commands/hook/index.mjs +7 -17
- package/clients/cli/commands/hook.text-projection.test.mjs +45 -0
- package/clients/cli/commands/init.doc.mjs +19 -8
- package/clients/cli/commands/init.flag-help.test.mjs +153 -0
- package/clients/cli/commands/integration-add.controls.test.mjs +132 -0
- package/clients/cli/commands/integration-add.doc.mjs +21 -5
- package/clients/cli/commands/interactive-guard.test.mjs +101 -24
- package/clients/cli/commands/json-contract.test.mjs +33 -0
- package/clients/cli/commands/layout-check.doc.mjs +14 -3
- package/clients/cli/commands/layout-expand.doc.mjs +21 -4
- package/clients/cli/commands/layout.doc.mjs +2 -2
- package/clients/cli/commands/layout.mjs +21 -9
- package/clients/cli/commands/layout.path-help.test.mjs +33 -0
- package/clients/cli/commands/layout.stdin-cap.test.mjs +47 -0
- package/clients/cli/commands/layout.text-fields.test.mjs +39 -0
- package/clients/cli/commands/no-prompt-wording.test.mjs +94 -0
- package/clients/cli/commands/search.doc.mjs +6 -3
- package/clients/cli/commands/search.mjs +17 -7
- package/clients/cli/commands/search.test.mjs +75 -0
- package/clients/cli/commands/swizzle.doc.mjs +2 -1
- package/clients/cli/commands/swizzle.path-safety.test.mjs +42 -0
- package/clients/cli/commands/template.doc.mjs +28 -6
- package/clients/cli/commands/template.flag-help.test.mjs +117 -0
- package/clients/cli/commands/template.path-help.test.mjs +40 -0
- package/clients/cli/commands/theme-add.doc.mjs +2 -1
- package/clients/cli/commands/theme-build.doc.mjs +7 -6
- package/clients/cli/commands/theme-palette-generate.test.mjs +19 -0
- package/clients/cli/commands/theme-template.behavior.test.mjs +12 -0
- package/clients/cli/commands/theme-template.doc.mjs +1 -1
- package/clients/cli/commands/upgrade.ascii-output.test.mjs +87 -0
- package/clients/cli/commands/upgrade.doc.mjs +17 -6
- package/clients/cli/commands/upgrade.flag-help.test.mjs +188 -0
- package/clients/cli/commands/upgrade.hook-output.test.mjs +88 -0
- package/clients/cli/index.mjs +13 -30
- package/clients/cli/latest-version-env.test.mjs +50 -0
- package/clients/cli/lib/cli-error.test.mjs +7 -0
- package/clients/cli/lib/component-format.mjs +9 -9
- package/clients/cli/lib/component-format.test.mjs +1 -1
- package/clients/cli/lib/define-command.mjs +32 -6
- package/clients/cli/lib/doc-text-ascii.test.mjs +82 -0
- package/clients/cli/lib/exit-codes.test.mjs +97 -0
- package/clients/cli/lib/hook-format.mjs +5 -5
- package/clients/cli/lib/json-shim.mjs +38 -2
- package/clients/cli/lib/json-shim.test.mjs +83 -0
- package/clients/cli/lib/manifest.d.ts +2 -0
- package/clients/cli/lib/manifest.mjs +22 -0
- package/clients/cli/lib/manifest.test.mjs +17 -0
- package/foundation/agent-docs/agent-docs.d.mts +4 -0
- package/foundation/agent-docs/agent-docs.mjs +69 -3
- package/foundation/agent-docs/agent-docs.path-safety.test.mjs +266 -4
- package/foundation/config/integration-debug.test.mjs +28 -3
- package/foundation/config/project.mjs +123 -9
- package/foundation/config/project.test.mjs +126 -0
- package/foundation/discovery/template-adapter.d.mts +14 -5
- package/foundation/discovery/template-adapter.fixture-refs.test.mjs +248 -0
- package/foundation/discovery/template-adapter.integration-isolation.test.mjs +94 -0
- package/foundation/discovery/template-adapter.mjs +292 -25
- package/foundation/discovery/theming-targets.test.mjs +4 -0
- package/foundation/fs/module-loader.d.mts +1 -0
- package/foundation/fs/module-loader.mjs +50 -1
- package/foundation/fs/module-loader.stdout.test.mjs +332 -0
- package/foundation/fs/path-safety.d.mts +3 -2
- package/foundation/fs/path-safety.mjs +49 -19
- package/foundation/fs/path-safety.test.mjs +50 -0
- package/foundation/fs/publish-file-hardlink-unavailable.test.mjs +129 -94
- package/foundation/integrations/autolink.mjs +6 -1
- package/foundation/response/base.d.ts +8 -4
- package/foundation/response/error-codes.doc.mjs +1 -2
- package/foundation/response/error-codes.mjs +1 -1
- package/foundation/response/error-codes.test.mjs +83 -0
- package/foundation/response/json-contract.test.mjs +11 -0
- package/foundation/response/json.d.mts +4 -2
- package/foundation/response/json.mjs +8 -10
- package/foundation/response/response-types.doc.mjs +3 -3
- package/foundation/xle/expand.d.mts +2 -0
- package/foundation/xle/expand.mjs +3 -2
- package/foundation/xle/expand.test.mjs +54 -0
- package/package.json +9 -9
- package/clients/cli/lib/update-check.mjs +0 -83
- package/clients/cli/lib/update-check.test.mjs +0 -137
- package/clients/cli/update-hint-commands.test.mjs +0 -54
package/README.md
CHANGED
|
@@ -51,8 +51,8 @@ Options:
|
|
|
51
51
|
|
|
52
52
|
- `--type <component|hook|doc|template>`: restrict to a single domain
|
|
53
53
|
- `--limit <n>`: cap the number of results (default 20)
|
|
54
|
-
- `--
|
|
55
|
-
- `--json`: typed `{ type: 'search', data: { query, matchCount, results } }` envelope — `matchCount` is how many candidates matched in total, `results` the slice `--limit` allowed
|
|
54
|
+
- `--verbose`: also print each result's match score and reason
|
|
55
|
+
- `--json`: typed `{ apiVersion, type: 'search', data: { query, matchCount, results } }` envelope — `matchCount` is how many candidates matched in total, `results` the slice `--limit` allowed
|
|
56
56
|
|
|
57
57
|
## Commands
|
|
58
58
|
|
|
@@ -84,7 +84,7 @@ Options:
|
|
|
84
84
|
|
|
85
85
|
These flags work with any command:
|
|
86
86
|
|
|
87
|
-
- `--json`: Output as typed JSON envelope: `{ type, data }` (errors: `{ error, code, suggestions? }`)
|
|
87
|
+
- `--json`: Output as typed JSON envelope: `{ apiVersion, type, data, meta? }` (errors: `{ apiVersion, error, code, suggestions? }`)
|
|
88
88
|
- `--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`.
|
|
89
89
|
- `--zh`: Output docs in Chinese Simplified
|
|
90
90
|
- `--dense`: Compressed format (token-efficient, useful for AI agents)
|
|
@@ -95,13 +95,14 @@ These flags work with any command:
|
|
|
95
95
|
Every command supports `--json` for machine-readable output. Responses are typed envelopes:
|
|
96
96
|
|
|
97
97
|
```json
|
|
98
|
-
{"type": "component.detail", "data": {"name": "Button", ...}}
|
|
98
|
+
{"apiVersion": 1, "type": "component.detail", "data": {"name": "Button", ...}}
|
|
99
99
|
```
|
|
100
100
|
|
|
101
101
|
Errors:
|
|
102
102
|
|
|
103
103
|
```json
|
|
104
104
|
{
|
|
105
|
+
"apiVersion": 1,
|
|
105
106
|
"error": "No component named \"Buttn\"",
|
|
106
107
|
"code": "ERR_UNKNOWN_COMPONENT",
|
|
107
108
|
"suggestions": [{"name": "Button", "reason": "similar name"}]
|
|
@@ -175,7 +176,7 @@ if (isError(result)) {
|
|
|
175
176
|
| `ERR_NO_SOURCE` | No source file could be located for the requested component/template. |
|
|
176
177
|
| `ERR_INVALID_DOC` | A component's docs failed validation (malformed `.doc.mjs`). |
|
|
177
178
|
| `ERR_FILE_NOT_FOUND` | A required input file did not exist. |
|
|
178
|
-
| `ERR_FILE_EXISTS` | Refused to overwrite an existing file
|
|
179
|
+
| `ERR_FILE_EXISTS` | Refused to overwrite an existing file. |
|
|
179
180
|
| `ERR_PATH_TRAVERSAL` | A path escaped its allowed root, or a name contained traversal markers. |
|
|
180
181
|
| `ERR_WRITE_FAILED` | Writing output files failed (and was rolled back). |
|
|
181
182
|
| `ERR_THEME_INVALID` | A theme definition or contributed theme catalog is invalid. |
|
|
@@ -199,8 +200,9 @@ if (isError(result)) {
|
|
|
199
200
|
|
|
200
201
|
Agents don't have to scrape `--help` to learn the CLI. A single call returns a
|
|
201
202
|
**self-describing manifest**: every command, its arguments, flags (with types,
|
|
202
|
-
choices, and defaults), whether it supports `--json`,
|
|
203
|
-
discriminators each command can emit
|
|
203
|
+
choices, and defaults), whether it supports `--json`, the response `type`
|
|
204
|
+
discriminators each command can emit, and its documented exit codes. Think of it
|
|
205
|
+
as an OpenAPI spec for the CLI.
|
|
204
206
|
|
|
205
207
|
```bash
|
|
206
208
|
astryx manifest --json # dedicated surface — type: "manifest"
|
|
@@ -262,6 +264,10 @@ Shape:
|
|
|
262
264
|
"…",
|
|
263
265
|
],
|
|
264
266
|
"examples": ["astryx component Button --props --json"],
|
|
267
|
+
"exitCodes": [
|
|
268
|
+
{"code": 0, "when": "success"},
|
|
269
|
+
{"code": 1, "when": "…"},
|
|
270
|
+
],
|
|
265
271
|
},
|
|
266
272
|
// …one entry per command; subcommands (e.g. `theme build`) nest under `subcommands`
|
|
267
273
|
],
|
|
@@ -343,9 +349,9 @@ import type {
|
|
|
343
349
|
// ...import the response types for the commands you consume
|
|
344
350
|
} from '@astryxdesign/cli/json';
|
|
345
351
|
|
|
346
|
-
// parseResponse returns the structural { type, data, meta? }
|
|
347
|
-
// is `unknown` until you narrow it. Reconstruct the union you
|
|
348
|
-
// the per-command response types, then narrow on `type`:
|
|
352
|
+
// parseResponse returns the structural { apiVersion, type, data, meta? }
|
|
353
|
+
// envelope; `data` is `unknown` until you narrow it. Reconstruct the union you
|
|
354
|
+
// care about from the per-command response types, then narrow on `type`:
|
|
349
355
|
type MyResponse =
|
|
350
356
|
ComponentDetailResponse | ComponentListResponse | DocsListResponse;
|
|
351
357
|
|
|
@@ -412,7 +418,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
412
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. |
|
|
413
419
|
| `discover.search` | The echoed query plus the matching {package, component} pairs, when a free-text term matches several components. |
|
|
414
420
|
| `search` | The echoed query, `matchCount` (how many candidates matched in total, before `limit`), plus a ranked SearchResultEntry[] bounded by `limit` (domain, name, score, reason, description, follow-up command, and import path where relevant). |
|
|
415
|
-
| `build.help` |
|
|
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. |
|
|
416
422
|
| `build.kit` | The grouped composition kit: echoed query, hasResults/matchCount/directMatch fields (matchCount is the total matched, never a cap read back), the closest page templates, drop-in block patterns, idea-specific components/hooks, and the always-on frame + foundation component-name arrays. |
|
|
417
423
|
| `swizzle.list` | The names of swizzlable components discoverable from cwd's @astryxdesign/core. |
|
|
418
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. |
|
|
@@ -426,7 +432,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
426
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. |
|
|
427
433
|
| `hook.detail` | One hook's full authored HookDoc. |
|
|
428
434
|
| `hook.detail.params` | Just one hook's parameters table (HookParamDoc[]). |
|
|
429
|
-
| `theme.build` | A theme build receipt: name,
|
|
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). |
|
|
430
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. |
|
|
431
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. |
|
|
432
438
|
| `theme.list` | Every bundled or installed integration theme as a ThemeListEntry[]: each with slug, displayName, description, maintained flag, and owner package. |
|
|
@@ -437,7 +443,7 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
437
443
|
| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
|
|
438
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. |
|
|
439
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. |
|
|
440
|
-
| `manifest` | The
|
|
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. |
|
|
441
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. |
|
|
442
448
|
| `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
|
|
443
449
|
| `integration.pack-check` | The packed-package check: package identity, tarball facts, local and packed contribution inventories, and issues. |
|
|
@@ -456,25 +462,33 @@ Every response has a `type` discriminant. The full set is below (generated from
|
|
|
456
462
|
|
|
457
463
|
`astryx doctor` runs read-only health checks against your project and
|
|
458
464
|
environment. Each record uses `[ok]`, `[warn]`, `[fail]`, or `[info]`, and
|
|
459
|
-
includes an actionable `fix` when one is available.
|
|
460
|
-
depend on the project; the output
|
|
465
|
+
includes an actionable `fix` when one is available. Field names match the
|
|
466
|
+
`--json` keys. The exact checks and values depend on the project; the output
|
|
467
|
+
shape is stable:
|
|
461
468
|
|
|
462
469
|
```
|
|
463
470
|
$ astryx doctor
|
|
464
471
|
astryx doctor - diagnosing your setup
|
|
465
472
|
|
|
473
|
+
id: node-version
|
|
466
474
|
status: [ok]
|
|
467
|
-
|
|
475
|
+
label: Node.js version
|
|
468
476
|
message: Node v24.18.1 meets the minimum (>=22.13.0).
|
|
469
477
|
|
|
478
|
+
id: themes
|
|
470
479
|
status: [warn]
|
|
471
|
-
|
|
480
|
+
label: Theme packages
|
|
472
481
|
message: No @astryxdesign/theme-* packages are installed.
|
|
473
482
|
fix: Install a theme, e.g. `npm install @astryxdesign/theme-neutral`, then import its CSS or set astryx.theme.
|
|
474
483
|
|
|
475
484
|
...
|
|
476
485
|
|
|
477
|
-
|
|
486
|
+
summary
|
|
487
|
+
|
|
488
|
+
pass: 4
|
|
489
|
+
warn: 2
|
|
490
|
+
fail: 0
|
|
491
|
+
info: 2
|
|
478
492
|
|
|
479
493
|
No failures - but review the [warn] warnings above when you can.
|
|
480
494
|
```
|
package/api/build/build.doc.mjs
CHANGED
|
@@ -16,8 +16,8 @@ export const doc = {
|
|
|
16
16
|
'Page-building assistant: the how-to-build playbook, or a composition kit for an idea.',
|
|
17
17
|
description:
|
|
18
18
|
'The "assemble a page" entry point. Called with no query it returns the ' +
|
|
19
|
-
'playbook
|
|
20
|
-
'
|
|
19
|
+
'how-to-build-a-page playbook as data: the workflow steps with their ' +
|
|
20
|
+
'commands, the on-system rules, and related lookups. Called with a query it runs the unified search and groups the ' +
|
|
21
21
|
'hits into a composition KIT: the closest page templates, drop-in blocks, ' +
|
|
22
22
|
'and idea-specific components/hooks, plus the always-on frame + foundation.',
|
|
23
23
|
importPath: '@astryxdesign/cli/api',
|
|
@@ -54,7 +54,7 @@ export const doc = {
|
|
|
54
54
|
{
|
|
55
55
|
type: 'build.help',
|
|
56
56
|
description:
|
|
57
|
-
'Emitted when the query is omitted:
|
|
57
|
+
'Emitted when the query is omitted: the page-building playbook — `playbook: true`, a `title`, the ordered `steps` (each a `title`, its `commands`, and optionally what the step `returns`), the on-system `rules`, and `related` lookups. Each command is a bare subcommand ({command, purpose?}) for the caller to render with its own CLI invocation.',
|
|
58
58
|
},
|
|
59
59
|
{
|
|
60
60
|
type: 'build.kit',
|
package/api/build/build.test.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file Tests for the build API (playbook
|
|
4
|
+
* @file Tests for the build API (playbook + composition kit).
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
import {describe, it, expect, vi} from 'vitest';
|
|
@@ -20,10 +20,21 @@ const REPO = path.resolve(
|
|
|
20
20
|
vi.setConfig({testTimeout: 30000});
|
|
21
21
|
|
|
22
22
|
describe('build API', () => {
|
|
23
|
-
it('no query → build.help playbook
|
|
23
|
+
it('no query → build.help carries the playbook as data', async () => {
|
|
24
24
|
const r = await build();
|
|
25
25
|
expect(r.type).toBe('build.help');
|
|
26
|
-
|
|
26
|
+
if (r.type !== 'build.help') return;
|
|
27
|
+
expect(r.data.playbook).toBe(true);
|
|
28
|
+
expect(r.data.title).toMatch(/build a page/i);
|
|
29
|
+
expect(r.data.steps.length).toBeGreaterThan(0);
|
|
30
|
+
for (const step of r.data.steps) {
|
|
31
|
+
expect(step.title).toBeTruthy();
|
|
32
|
+
expect(step.commands.length).toBeGreaterThan(0);
|
|
33
|
+
}
|
|
34
|
+
expect(r.data.rules.length).toBeGreaterThan(0);
|
|
35
|
+
// Bare subcommands: the caller adds its own invocation.
|
|
36
|
+
const commands = [...r.data.steps.flatMap(s => s.commands), ...r.data.related];
|
|
37
|
+
for (const {command} of commands) expect(command).not.toMatch(/^(astryx|npx|pnpm|yarn|bunx?)\b/);
|
|
27
38
|
});
|
|
28
39
|
|
|
29
40
|
it('query → build.kit with raw entries + static frame/foundation', async () => {
|
|
@@ -2,12 +2,46 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* A command the playbook tells the caller to run.
|
|
6
|
+
*/
|
|
7
|
+
export type BuildPlaybookCommand = {
|
|
8
|
+
/**
|
|
9
|
+
* Bare subcommand with `<placeholder>` arguments (e.g. `template <name> --skeleton`) and no package-manager prefix — render it with your own CLI invocation.
|
|
10
|
+
*/
|
|
11
|
+
command: string;
|
|
12
|
+
/**
|
|
13
|
+
* What running it is for.
|
|
14
|
+
*/
|
|
15
|
+
purpose?: string | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* One step of the page-building workflow.
|
|
19
|
+
*/
|
|
20
|
+
export type BuildPlaybookStep = {
|
|
21
|
+
/**
|
|
22
|
+
* What to do.
|
|
23
|
+
*/
|
|
24
|
+
title: string;
|
|
25
|
+
/**
|
|
26
|
+
* The commands for this step, in the order to run them.
|
|
27
|
+
*/
|
|
28
|
+
commands: BuildPlaybookCommand[];
|
|
29
|
+
/**
|
|
30
|
+
* What the step's command gives back, when that decides the next step.
|
|
31
|
+
*/
|
|
32
|
+
returns?: string | undefined;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* astryx --json build (no query) — the "how to build a page" playbook.
|
|
6
36
|
*/
|
|
7
37
|
export type BuildHelpResponse = {
|
|
8
38
|
type: "build.help";
|
|
9
39
|
data: {
|
|
10
40
|
playbook: true;
|
|
41
|
+
title: string;
|
|
42
|
+
steps: BuildPlaybookStep[];
|
|
43
|
+
rules: string[];
|
|
44
|
+
related: BuildPlaybookCommand[];
|
|
11
45
|
};
|
|
12
46
|
};
|
|
13
47
|
/**
|
package/api/build/build.type.mjs
CHANGED
|
@@ -2,17 +2,38 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @file Colocated types for the `build` command — source of truth for the
|
|
5
|
-
* `build.help` (playbook
|
|
6
|
-
*
|
|
5
|
+
* `build.help` (playbook) and `build.kit` (composition kit) JSON responses.
|
|
6
|
+
* Re-exported by types/build.d.ts.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* A command the playbook tells the caller to run.
|
|
11
|
+
*
|
|
12
|
+
* @typedef {object} BuildPlaybookCommand
|
|
13
|
+
* @property {string} command Bare subcommand with `<placeholder>` arguments (e.g. `template <name> --skeleton`) and no package-manager prefix — render it with your own CLI invocation.
|
|
14
|
+
* @property {string} [purpose] What running it is for.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* One step of the page-building workflow.
|
|
19
|
+
*
|
|
20
|
+
* @typedef {object} BuildPlaybookStep
|
|
21
|
+
* @property {string} title What to do.
|
|
22
|
+
* @property {BuildPlaybookCommand[]} commands The commands for this step, in the order to run them.
|
|
23
|
+
* @property {string} [returns] What the step's command gives back, when that decides the next step.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* astryx --json build (no query) — the "how to build a page" playbook.
|
|
11
28
|
*
|
|
12
29
|
* @typedef {object} BuildHelpResponse
|
|
13
30
|
* @property {'build.help'} type
|
|
14
31
|
* @property {object} data
|
|
15
32
|
* @property {true} data.playbook Always true; marks this envelope as the playbook rather than a result set.
|
|
33
|
+
* @property {string} data.title The playbook's heading.
|
|
34
|
+
* @property {BuildPlaybookStep[]} data.steps The workflow, in order.
|
|
35
|
+
* @property {string[]} data.rules The rules that keep a page on-system.
|
|
36
|
+
* @property {BuildPlaybookCommand[]} data.related Lookups to reach for alongside the workflow.
|
|
16
37
|
*/
|
|
17
38
|
|
|
18
39
|
/**
|
|
@@ -2,14 +2,17 @@
|
|
|
2
2
|
// DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* @file build.help leaf — the "how to build a page" playbook
|
|
5
|
+
* @file build.help leaf — the "how to build a page" playbook.
|
|
6
6
|
*
|
|
7
|
-
* `build` with no query returns this envelope
|
|
8
|
-
*
|
|
9
|
-
*
|
|
7
|
+
* `build` with no query returns this envelope. The playbook is data — steps,
|
|
8
|
+
* rules, and related lookups — so a `--json` or programmatic caller gets the
|
|
9
|
+
* same guidance the terminal shows. Commands are bare subcommands with no
|
|
10
|
+
* package-manager prefix, which keeps the JSON environment-agnostic; the CLI
|
|
11
|
+
* renders each one with the caller's invocation, as it does build.kit's
|
|
12
|
+
* `hint.commands`.
|
|
10
13
|
*/
|
|
11
14
|
/**
|
|
12
|
-
* The page-building playbook
|
|
15
|
+
* The page-building playbook (emitted when `build` runs with no query).
|
|
13
16
|
*
|
|
14
17
|
* @returns {import('../build.type.mjs').BuildHelpResponse}
|
|
15
18
|
*/
|
package/api/build/help/help.mjs
CHANGED
|
@@ -1,18 +1,68 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @file build.help leaf — the "how to build a page" playbook
|
|
4
|
+
* @file build.help leaf — the "how to build a page" playbook.
|
|
5
5
|
*
|
|
6
|
-
* `build` with no query returns this envelope
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* `build` with no query returns this envelope. The playbook is data — steps,
|
|
7
|
+
* rules, and related lookups — so a `--json` or programmatic caller gets the
|
|
8
|
+
* same guidance the terminal shows. Commands are bare subcommands with no
|
|
9
|
+
* package-manager prefix, which keeps the JSON environment-agnostic; the CLI
|
|
10
|
+
* renders each one with the caller's invocation, as it does build.kit's
|
|
11
|
+
* `hint.commands`.
|
|
9
12
|
*/
|
|
10
13
|
|
|
11
14
|
/**
|
|
12
|
-
* The page-building playbook
|
|
15
|
+
* The page-building playbook (emitted when `build` runs with no query).
|
|
13
16
|
*
|
|
14
17
|
* @returns {import('../build.type.mjs').BuildHelpResponse}
|
|
15
18
|
*/
|
|
16
19
|
export function buildHelp() {
|
|
17
|
-
return {
|
|
20
|
+
return {
|
|
21
|
+
type: 'build.help',
|
|
22
|
+
data: {
|
|
23
|
+
playbook: true,
|
|
24
|
+
title: 'How to build a page with Astryx',
|
|
25
|
+
steps: [
|
|
26
|
+
{
|
|
27
|
+
title: "Find a starting point for what you're building",
|
|
28
|
+
commands: [{command: 'build "<what you\'re building>"'}],
|
|
29
|
+
returns:
|
|
30
|
+
'the closest [page] template, the [block]s that cover parts, and the [component]s to fill the gaps, with a recommended start',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: 'If a [page] template matches, scaffold it and adapt',
|
|
34
|
+
commands: [{command: 'template <name> [path]'}],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
title: 'If nothing matches exactly, compose',
|
|
38
|
+
commands: [
|
|
39
|
+
{
|
|
40
|
+
command: 'template <name> --skeleton',
|
|
41
|
+
purpose: "study a close page's layout",
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
command: 'template <BlockName>',
|
|
45
|
+
purpose: 'drop in each block from the kit',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
command: 'component <Name>',
|
|
49
|
+
purpose: 'fill remaining gaps (read props)',
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
rules: [
|
|
55
|
+
'No <div>/raw HTML for layout — use VStack/HStack/Grid/Stack/Card etc.',
|
|
56
|
+
'No style={{}} — use component props, and design tokens for values.',
|
|
57
|
+
'Wrap the app in <Theme theme={...}> and import core reset.css + astryx.css.',
|
|
58
|
+
],
|
|
59
|
+
related: [
|
|
60
|
+
{command: 'docs tokens', purpose: 'the design tokens'},
|
|
61
|
+
{
|
|
62
|
+
command: 'search <query>',
|
|
63
|
+
purpose: 'a neutral lookup of any component, doc, or template',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
};
|
|
18
68
|
}
|
|
@@ -91,7 +91,8 @@ export const doc = {
|
|
|
91
91
|
{
|
|
92
92
|
name: 'options.lang',
|
|
93
93
|
type: 'string',
|
|
94
|
-
description:
|
|
94
|
+
description:
|
|
95
|
+
"Language code for localized doc content: 'en', 'zh', or 'dense'.",
|
|
95
96
|
},
|
|
96
97
|
{
|
|
97
98
|
name: 'options.zh',
|
|
@@ -113,7 +114,7 @@ export const doc = {
|
|
|
113
114
|
{
|
|
114
115
|
type: 'component.detail',
|
|
115
116
|
description:
|
|
116
|
-
"One component's authored ComponentDoc plus ownership metadata (owner package, import specifier, whether source is available).",
|
|
117
|
+
"One component's authored ComponentDoc plus ownership metadata (owner package, import specifier, whether source is available). When the name is a sub-component documented in a parent's doc, the payload is scoped to it and parentDoc names that parent.",
|
|
117
118
|
},
|
|
118
119
|
{
|
|
119
120
|
type: 'component.detail.props',
|
|
@@ -135,6 +136,14 @@ export const doc = {
|
|
|
135
136
|
},
|
|
136
137
|
],
|
|
137
138
|
throws: [
|
|
139
|
+
{
|
|
140
|
+
code: 'ERR_INVALID_DETAIL',
|
|
141
|
+
when: "options.detail is not 'full', 'compact', or 'brief'",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
code: 'ERR_INVALID_LANG',
|
|
145
|
+
when: "options.lang is set to anything other than 'en', 'zh', or 'dense'",
|
|
146
|
+
},
|
|
138
147
|
{
|
|
139
148
|
code: 'ERR_CORE_NOT_FOUND',
|
|
140
149
|
when: '@astryxdesign/core cannot be resolved from cwd',
|
|
@@ -34,6 +34,11 @@ import {componentDetailSource} from './detail/source/source.mjs';
|
|
|
34
34
|
import {componentDetailShowcase} from './detail/showcase/showcase.mjs';
|
|
35
35
|
import {componentDetailBlocks} from './detail/blocks/blocks.mjs';
|
|
36
36
|
|
|
37
|
+
/** @type {ReadonlyArray<string>} */
|
|
38
|
+
const DETAIL_LEVELS = ['full', 'compact', 'brief'];
|
|
39
|
+
/** @type {ReadonlyArray<string>} */
|
|
40
|
+
const LANGS = ['en', 'zh', 'dense'];
|
|
41
|
+
|
|
37
42
|
/**
|
|
38
43
|
* @param {string} [name]
|
|
39
44
|
* @param {object} [options]
|
|
@@ -81,6 +86,23 @@ export async function component(name, options = {}) {
|
|
|
81
86
|
const isListView = list || category != null || !name;
|
|
82
87
|
const detail = detailOption ?? (isListView ? 'brief' : 'full');
|
|
83
88
|
|
|
89
|
+
// Same accepted values and codes as the CLI's --detail and --lang, checked
|
|
90
|
+
// first as the CLI parser does.
|
|
91
|
+
if (!DETAIL_LEVELS.includes(detail)) {
|
|
92
|
+
throw new AstryxError(
|
|
93
|
+
`Invalid detail "${String(detail)}". Valid levels: ${DETAIL_LEVELS.join(', ')}`,
|
|
94
|
+
undefined,
|
|
95
|
+
ERROR_CODES.ERR_INVALID_DETAIL,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
if (lang != null && !LANGS.includes(lang)) {
|
|
99
|
+
throw new AstryxError(
|
|
100
|
+
`Invalid lang "${String(lang)}". Valid values: ${LANGS.join(', ')}`,
|
|
101
|
+
undefined,
|
|
102
|
+
ERROR_CODES.ERR_INVALID_LANG,
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
|
|
84
106
|
const coreDir = requireCoreDir(cwd);
|
|
85
107
|
|
|
86
108
|
// A public API caller could pass a non-string category; the list leaf does
|
|
@@ -156,6 +178,13 @@ export async function component(name, options = {}) {
|
|
|
156
178
|
}
|
|
157
179
|
const extDocPath = resolveLegacyExternalDoc(scoped.ext, dirName);
|
|
158
180
|
if (extDocPath) {
|
|
181
|
+
// Legacy packages ship docs, never source.
|
|
182
|
+
if (source) {
|
|
183
|
+
return componentDetailSource(dirName, null, {name, notFoundInPackage: packageScope});
|
|
184
|
+
}
|
|
185
|
+
if (blocks) {
|
|
186
|
+
return componentDetailBlocks(dirName);
|
|
187
|
+
}
|
|
159
188
|
const docs = await loadComponentDoc(extDocPath, docOpts);
|
|
160
189
|
if (props) return componentDetailProps(docs);
|
|
161
190
|
return componentDetail(docs, {package: scoped.ext.name, sourcePath: null}, dirName, coreDir);
|
|
@@ -14,6 +14,7 @@ import * as path from 'node:path';
|
|
|
14
14
|
import {fileURLToPath} from 'node:url';
|
|
15
15
|
import {component} from './component.mjs';
|
|
16
16
|
import {AstryxError} from '../error.mjs';
|
|
17
|
+
import {runCli} from '../../test-utils/run-cli.mjs';
|
|
17
18
|
|
|
18
19
|
// api/component/ -> up 4 = repo root (has packages/core, which findCoreDir walks to).
|
|
19
20
|
const REPO = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../../..');
|
|
@@ -161,3 +162,40 @@ describe('component dispatcher — category guard', () => {
|
|
|
161
162
|
}
|
|
162
163
|
}, SLOW);
|
|
163
164
|
});
|
|
165
|
+
|
|
166
|
+
describe('component dispatcher — detail and lang guards', () => {
|
|
167
|
+
// `detail` and `lang` are the same controls as the CLI's --detail and --lang:
|
|
168
|
+
// same accepted values, same error codes.
|
|
169
|
+
it('rejects a detail level the CLI rejects, with the same code', async () => {
|
|
170
|
+
const cliRun = await runCli(['--json', 'component', '--list', '--detail', 'bogus'], cwd);
|
|
171
|
+
expect(cliRun.code).toBe(1);
|
|
172
|
+
expect(JSON.parse(cliRun.stdout).code).toBe('ERR_INVALID_DETAIL');
|
|
173
|
+
|
|
174
|
+
const bogus = /** @type {any} */ ('bogus');
|
|
175
|
+
for (const call of [
|
|
176
|
+
() => component(undefined, {cwd, list: true, detail: bogus}),
|
|
177
|
+
() => component('Button', {cwd, detail: bogus}),
|
|
178
|
+
]) {
|
|
179
|
+
const err = await call().catch(e => e);
|
|
180
|
+
expect(err).toBeInstanceOf(AstryxError);
|
|
181
|
+
expect(err.code).toBe('ERR_INVALID_DETAIL');
|
|
182
|
+
}
|
|
183
|
+
}, SLOW);
|
|
184
|
+
|
|
185
|
+
it('rejects a lang the CLI rejects, with the same code', async () => {
|
|
186
|
+
const cliRun = await runCli(['--json', 'component', 'Button', '--lang', 'fr'], cwd);
|
|
187
|
+
expect(cliRun.code).toBe(1);
|
|
188
|
+
expect(JSON.parse(cliRun.stdout).code).toBe('ERR_INVALID_LANG');
|
|
189
|
+
|
|
190
|
+
for (const call of [
|
|
191
|
+
() => component('Button', {cwd, lang: 'fr'}),
|
|
192
|
+
() => component(undefined, {cwd, list: true, detail: 'compact', lang: 'fr'}),
|
|
193
|
+
]) {
|
|
194
|
+
const err = await call().catch(e => e);
|
|
195
|
+
expect(err).toBeInstanceOf(AstryxError);
|
|
196
|
+
expect(err.code).toBe('ERR_INVALID_LANG');
|
|
197
|
+
}
|
|
198
|
+
const zh = await component('Button', {cwd, lang: 'zh'});
|
|
199
|
+
expect(zh.type).toBe('component.detail');
|
|
200
|
+
}, SLOW);
|
|
201
|
+
});
|
|
@@ -59,7 +59,17 @@ export type ComponentBriefEntry = {
|
|
|
59
59
|
*/
|
|
60
60
|
export type ComponentDetailResponse = {
|
|
61
61
|
type: "component.detail";
|
|
62
|
-
data: import("@astryxdesign/cli/authoring").ComponentDoc & ComponentOwnership;
|
|
62
|
+
data: import("@astryxdesign/cli/authoring").ComponentDoc & ComponentOwnership & ComponentDetailScope;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* Present only when the requested name is a sub-component documented inside a
|
|
66
|
+
* parent's doc (e.g. `HStack` in the `Stack` doc); the payload is scoped to it.
|
|
67
|
+
*/
|
|
68
|
+
export type ComponentDetailScope = {
|
|
69
|
+
/**
|
|
70
|
+
* - Name of the parent doc the payload was scoped from, e.g. 'Stack'.
|
|
71
|
+
*/
|
|
72
|
+
parentDoc?: string | undefined;
|
|
63
73
|
};
|
|
64
74
|
/**
|
|
65
75
|
* Ownership metadata attached to every `component.detail` payload. Exposes the
|
|
@@ -73,7 +73,14 @@
|
|
|
73
73
|
* astryx --json component <name>
|
|
74
74
|
* @typedef {object} ComponentDetailResponse
|
|
75
75
|
* @property {'component.detail'} type
|
|
76
|
-
* @property {import('@astryxdesign/cli/authoring').ComponentDoc & ComponentOwnership} data
|
|
76
|
+
* @property {import('@astryxdesign/cli/authoring').ComponentDoc & ComponentOwnership & ComponentDetailScope} data
|
|
77
|
+
*/
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Present only when the requested name is a sub-component documented inside a
|
|
81
|
+
* parent's doc (e.g. `HStack` in the `Stack` doc); the payload is scoped to it.
|
|
82
|
+
* @typedef {object} ComponentDetailScope
|
|
83
|
+
* @property {string} [parentDoc] - Name of the parent doc the payload was scoped from, e.g. 'Stack'.
|
|
77
84
|
*/
|
|
78
85
|
|
|
79
86
|
/**
|
|
@@ -41,7 +41,7 @@ export const doc = {
|
|
|
41
41
|
name: 'options.components',
|
|
42
42
|
type: 'boolean',
|
|
43
43
|
description:
|
|
44
|
-
'
|
|
44
|
+
'In the CLI package list, print every component of each package instead of the first 10. A display flag for the CLI renderer; the programmatic response is unchanged.',
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
name: 'options.lang',
|
|
@@ -32,17 +32,19 @@ export const doc = {
|
|
|
32
32
|
name: 'component',
|
|
33
33
|
type: 'string',
|
|
34
34
|
description:
|
|
35
|
-
'Component or general design-system area. Required unless listCategories is true.',
|
|
35
|
+
'Component or general design-system area, up to 120 characters. Required unless listCategories is true.',
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
38
|
name: 'options.category',
|
|
39
39
|
type: 'GapReportCategory',
|
|
40
|
-
description:
|
|
40
|
+
description:
|
|
41
|
+
'Fixed category from the reported category vocabulary. Required unless listCategories is true.',
|
|
41
42
|
},
|
|
42
43
|
{
|
|
43
44
|
name: 'options.reason',
|
|
44
45
|
type: 'string',
|
|
45
|
-
description:
|
|
46
|
+
description:
|
|
47
|
+
'What capability was missing or difficult, up to 2000 characters. Required unless listCategories is true.',
|
|
46
48
|
},
|
|
47
49
|
{
|
|
48
50
|
name: 'options.detail',
|
|
@@ -65,7 +67,8 @@ export const doc = {
|
|
|
65
67
|
{
|
|
66
68
|
name: 'options.listCategories',
|
|
67
69
|
type: 'boolean',
|
|
68
|
-
description:
|
|
70
|
+
description:
|
|
71
|
+
'Return categories without resolving a route or writing; the component and every other option are ignored.',
|
|
69
72
|
default: 'false',
|
|
70
73
|
},
|
|
71
74
|
{
|
package/api/init/init.doc.mjs
CHANGED
|
@@ -90,6 +90,10 @@ export const doc = {
|
|
|
90
90
|
code: 'ERR_FILE_EXISTS',
|
|
91
91
|
when: 'scaffolding a template would overwrite an existing page.tsx',
|
|
92
92
|
},
|
|
93
|
+
{
|
|
94
|
+
code: 'ERR_PATH_TRAVERSAL',
|
|
95
|
+
when: 'the template output path resolves outside cwd, for example through a symlinked src directory',
|
|
96
|
+
},
|
|
93
97
|
],
|
|
94
98
|
examples: [
|
|
95
99
|
{label: 'Default setup', code: 'const r = await init();'},
|