@astryxdesign/cli 0.6.6-canary.ffa4f72 → 0.6.7-canary.037dfb6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,134 @@
1
1
  # @xds/cli
2
2
 
3
+ # 0.6.7
4
+
5
+ #### New Features
6
+
7
+ - Apps can opt into package-managed themes with `astryx theme add <slug> --import`. The command records the theme in one generated app module with its production CSS, optional font CSS, and default slug. Use `theme remove` and `theme use` to manage that record, and pass `themes[defaultThemeSlug]` to `<Theme>`.
8
+ Plain `astryx theme add` keeps its released source-copy behavior, options, stdout, exit status, and every `theme.add` data field. It now warns that `theme eject` is the explicit source-fork command and `theme add --import` is the way to use the package-managed theme. Its machine result adds the `DEP-0005` deprecation entry; the cleanup is `CLN-0005` in a later scheduled minor.
9
+
10
+ Use `defineTheme({extends: importedTheme, ...})` for ordinary customization. `theme eject` creates an independent local fork with its descriptor. JSON callers receive `theme.app` from import, remove, and use, or `theme.eject` from eject.
11
+
12
+ Existing bundled source copies stay where they are and keep their bytes. Run `astryx upgrade --from 0.6.4 --path . --apply` to add the missing unmaintained descriptor beside each bundled copy in `src/themes`. Until then, theme commands skip those copies and `theme list` and doctor name them as unmigrated. Package integration themes keep their released complete-directory copy, including the authoring descriptor.
13
+
14
+ `ASTRYX_THEME` is no longer read. In a project with a generated app theme module, component metadata reads that record's default built theme. Without the module, the released `package.json#astryx.theme` lookup keeps its meaning. Doctor loads every recorded built module through the same theme adapter, so a broken runtime import fails `theme-owners` instead of passing.
15
+
16
+ `theme build` also writes `<out>.css.d.ts` so TypeScript accepts generated CSS imports. Check mode stays compatible with released output sets that do not have this new stub yet.
17
+
18
+ Integration themes can export built modules and stylesheets. `astryx integration add theme` creates those exports, and `integration verify` checks the exported paths against the packed package and source. Missing partner exports alone do not block packing. Every declared export must resolve; staleness is a warning for an incomplete set and an error for the complete importable module and stylesheet pair.
19
+
20
+ - Every result now names the package it comes from. A `--json` result about one artifact (a component and each of its projections, a doc topic, index, section, or docs-tree node, a template, a hook, and `swizzle`) carries `package` in its envelope, directly after `type`. A result that lists artifacts gives each item its own `package`: every `search` hit, `build`'s start, alternatives, blocks, and components, a doc's sections, a docs-tree node's children, `--blocks` entries, and the `component --list` and `upgrade --list` entries. Text names the same package; `--source`, `--showcase`, and a template's source still print only the source on stdout and name the package on stderr. Existing fields are unchanged.
21
+ - Deprecate the `astryx layout` command group
22
+ The `astryx layout` command group (`expand`, `check`, `grammar`) is deprecated. Use `astryx build` to choose the template to start from, `astryx template` to scaffold it, and `astryx docs layout` for layout guidance.
23
+
24
+ In human mode each invocation prints a stderr warning naming the replacement. In JSON mode the response envelope carries machine-readable deprecation metadata in its `meta` field. Canonical stdout, exit codes, and the `layout.expand` / `layout.check` / `layout.grammar` response schemas are unchanged.
25
+
26
+ Deprecation lifecycle (`spec:AST-017` FR28, FR31) — removal only in a later minor whose frozen manifest carries both ids of a pair:
27
+
28
+ - An integration component can replace a Core component, once its package opts in
29
+ An `@acme/nav` component whose doc sets `replaces: 'SideNav'` takes over `SideNav` for unqualified component detail, batch selectors, every `component --list` detail level, `search`, `swizzle`, and gap-report routing, when `@acme/nav` declares `"@astryxdesign/cli": ">=0.6.7"` in `peerDependencies` (optional in `peerDependenciesMeta`). Every result names its package, `--package @astryxdesign/core` still selects the original Core component, and the replacement keeps answering to its own name. `component SideNav --package @acme/nav` also selects it.
30
+
31
+ Any `@astryxdesign/cli` range that starts at 0.6.7 or later is the opt-in, including the `>=0.7.0` that `integration add doc --parent` wrote in 0.6.4 and 0.6.5, and `integration add theme` in 0.6.5. A package whose range admits an earlier CLI keeps its component under its own name and Core stays selected, and an app that loads it sees no new output; its author gets warnings naming the range to add, from `astryx doctor integration components` and `integration verify`. For a package that declares the range, `astryx doctor integration components` reports a missing Core target, an invalid value, a component named after a different Core component, or two replacements for one target in the package as errors and exits 1. When several packages replace one target, an explicitly configured package beats an autolinked one, the later configured package wins, and Doctor warns.
32
+
33
+ - Add the model comparison page template with responsive sticky context and accessible interactions. (#6251)
34
+ - New `table-collapsible` page template: several tables on one page, each in a collapsible card with its own columns, for groups that do not share a schema. Every table sorts on its own, one time range in the page header drives all of them, and rows expand in place into a full-width history chart. Below 720px each table folds to its name and headline figure. (#6065)
35
+
36
+ #### Fixes
37
+
38
+ - Printed commands name the scoped `@astryxdesign/cli` package whenever the `astryx` bin is not installed for the project
39
+ - Compact the generated agent-docs block: fewer lines, same behavioral coverage
40
+ - `astryx doctor` keeps its `themes` check, with the same id, label and fields, beside the new theme checks, so scripts that read it by id keep working. Without a generated theme module it reports what it did before: whether an `@astryxdesign/theme-*` package is installed, and whether the app's package.json names a theme in `astryx.theme`. Its fix now names `theme add --import`. With a generated module it reports the overall result of the theme checks.
41
+ In a workspace, `themes` reads the app's own package.json, the file the CLI reads when it resolves the theme, rather than the package.json beside the root `node_modules`. It no longer counts the `ASTRYX_THEME` variable, which the CLI does not read, as a wired theme.
42
+ - Doctor says why it skipped a check and what it checked, and `doctor integration validate` no longer crashes on a folder it cannot read
43
+ - upgrade: exclude node_modules from integration codemod discovery
44
+ When an integration declared its codemods root as the package root (`codemods: "./"`), the version-folder scan treated `node_modules`, `.git`, `__tests__`, and `__fixtures__` as version folders and loaded their files as codemods. The same `SKIP_DIRS` filter that the recursive file walk already used is now also applied to the top-level version-folder enumeration.
45
+ - Align the layout deprecation (DEP-0006) with the documented envelope and precedent
46
+ The layout command's JSON envelope now emits `meta.deprecations: [{id, replacements}]`, matching the response schema doc and the DEP-0005 theme add precedent. The `deprecated` CommandDoc field renders in `--help` and the manifest. The programmatic API exports (`layoutExpand`, `layoutCheck`, `layoutGrammar`) carry `@deprecated` in their declarations and generated types. Command and function reference pages name DEP-0006 and the replacement. The DEP-0006 record names its direct authority. All released data fields are unchanged.
47
+ - swizzle: rewrite every .stylex import to a deep path
48
+ `astryx swizzle Button` (and any component that imports a `.stylex` module from outside its own directory) emitted an import that collapsed to the directory barrel — e.g. `@astryxdesign/core/utils` instead of `@astryxdesign/core/utils/interactionOverlay.stylex`. The barrel does not re-export those StyleX symbols, so the swizzled file could not compile.
49
+
50
+ `rewriteImports` now gives every `*.stylex` module the deep subpath. The exports generator (`scripts/sync-exports.js`) adds 16 specific subpath exports for the `.stylex` modules swizzled components actually reference across directories:
51
+
52
+ `DateInput/tokens.stylex`, `Icon/IconSize.stylex`, `Indicator/indicator.markers.stylex`, `Layer/layerAnimations.stylex`, `Layer/layerTextReset.stylex`, `Layer/layerViewportInset.stylex`, `Layout/container.stylex`, `Layout/edgeCompensation.stylex`, `Layout/padding.stylex`, `NavItem/navItemStyles.stylex`, `Selector/selectorPresentation.stylex`, `Stack/stack.stylex`, `Stack/stackItem.stylex`, `Text/text.stylex`, `utils/focusOutline.stylex`, `utils/interactionOverlay.stylex`
53
+
54
+ These are public API additions. Each module already ships in the npm tarball (in `dist/`); only the exports map entry is new. No wildcard — a future cross-directory `.stylex` import needs a deliberate entry in `STATIC_EXPORTS`. Precedent: `./theme/dataTokens.stylex` (AST-066 FR2).
55
+
56
+ - template: show a grouped summary by default instead of the full catalog
57
+ Bare `astryx template` (no name, no `--list`) now shows templates grouped by category with counts — about 21 KB instead of the full 149 KB catalog. The full catalog with descriptions is still reachable via `astryx template --list`.
58
+
59
+ JSON output is unchanged — `--json template` still returns the complete `template.list` response. This is a text-only rendering change under AST-017 FR11: the machine-readable response schema is the contract; text formatting is not.
60
+
61
+ Trade-off: the grouped output still includes every template id (so `template <id>` works from a copy-paste), at the cost of ~21 KB. An even shorter summary (type + count only, no ids) would be ~500 bytes but would require a second step to discover any id. The current shape serves both human scanning and agent copy-paste without a round-trip.
62
+
63
+ - template: bare `template --type` no longer prints an empty group header
64
+ - A section read on a docs-tree namespace answers from the guide that has the section again, so `astryx docs layout side-panels` and the other layout section reads released in 0.6.6 work after the layout split. `docs(route, section)` returns the same `docs.detail.section` the guide's own section read returns, found by key, then by title, in `--dense` and `--zh` too. When no guide or more than one has the section, the read fails with `ERR_UNKNOWN_SECTION` and names the guides to read it from.
65
+ - `astryx search` ranks a component, hook, or template that a query word names above a doc that matched only by keyword, heading, or text. `font size` finds Text first again instead of a typography guide. A doc the query names, such as `font setup` or `migration`, or one whose title the query holds, such as `resizable side panels`, keeps its place. Result scores do not change; only the order between domains moves.
66
+ - `astryx search` finds a guide when the query is its route or title in the other number: `side panel` finds the side panels guide first again, and `header and footer` finds headers and footers. A section's heading still doesn't count as its topic's name, so `font size` keeps finding Text first.
67
+ - Fix comparison table category from "Table - Frozen Column" to "Table - Comparison"
68
+ The category described an implementation detail (the frozen label column) instead of what the template is for. Builders searching by layout type now find it under Comparison.
69
+ - Template and build tell you what a scaffolded template needs that your project lacks.
70
+ When `astryx template <name> <path>` scaffolds a file that imports packages your project does not have (e.g. `@heroicons/react`, `recharts`, `lucide-react`), the receipt now includes a ready-to-run install command with the project's package manager and version ranges from the CLI workspace. `astryx build` shows the same note on its start template.
71
+
72
+ When a scaffolded template uses StyleX and the project has no compiler plugin configured, the receipt warns and points to `astryx docs styling-overview`. The agent-docs block no longer says "don't use xstyle" flat-out — it acknowledges that some templates need it and links the setup doc.
73
+
74
+ `detectStylingSystem` now recognizes the official `@stylexjs/rollup-plugin`, `@stylexjs/webpack-plugin`, and `@stylexjs/nextjs-plugin` alongside the existing entries.
75
+
76
+ - `astryx theme build` prints one line per built theme, plus one line naming fonts the themes do not load. Before, every theme printed the same install example and font recipe, so a build of many themes printed the same blocks again and again. `--detail full` prints the install example and font recipe, once for a batch instead of once per theme; for one theme it prints what the default printed before. Only the text report changes: `--json` output, `--check`, exit codes and written files are unchanged.
77
+ - Wherever the CLI shows the `<Theme>` wrapper, it now also shows where `Theme` comes from: `import {Theme} from '@astryxdesign/core'`. This covers the `astryx init` next steps, `theme add` and `theme build` output, the doctor fix for an unimported theme module, `build` help, and the theme guides.
78
+ - `astryx theme add <slug> --import` names the npm package that owns the added theme, in its JSON envelope (`package`, directly after `type`) and in its text output, the same way other results about one artifact do. A local theme has no package, so its result has no `package`, and `theme remove` and `theme use` are unchanged.
79
+ `astryx theme add --list` keeps its JSON. Its text now names `theme add <slug> --import` to use a theme and `theme eject <slug>` to fork one, instead of the deprecated copy form.
80
+
81
+ `astryx doctor` adds a `theme-management` check, and focused `theme-*` checks once a project has a generated theme module.
82
+
83
+ - One-off commands in a classic Yarn (1.x) project use `npx @astryxdesign/cli …` instead of `yarn dlx`, which classic Yarn does not have
84
+
85
+ #### Documentation
86
+
87
+ - `astryx docs migration`, `internationalization`, `styling`, `styling-libraries`, `typography` and `tokens` still work and now list focused guides. Each section is also readable under its guide, for example `astryx docs tokens/tokens-spacing` or `astryx docs styling/tokens-and-setup stylex-setup`, and `astryx docs <topic> <section>` keeps working: every section key these topics had still opens the same section. `astryx docs tokens --depth all --detail full` prints every token table, and a `token-ref` to `tokens` keeps resolving through the guide that holds the table.
88
+ Integrations: these six names are now docs-tree sections, not topics, so an integration doc that declares `extends` or `replaces` with one of them is reported as naming no topic, and its content no longer shows. To keep that content, ship it as your own topic under a new name, or as a guide in your package's own section (`astryx integration add doc <name> --parent <your-section>`). Topics that are still flat, such as `theme` or `color`, can still be extended or replaced.
89
+
90
+ (#7184)
91
+
92
+ - `astryx docs layout` still works and now lists the focused guides. Each section is also readable under its guide, for example `astryx docs layout/side-panels` or `astryx docs layout/scaffold shell`, and `astryx docs layout <section>` keeps working.
93
+ (#7125)
94
+ - `astryx docs layout` opens with its overview again, and `astryx docs author-a-theme` and `use-a-theme` restore guidance the theme split dropped: what a bad `extends` base does, how adaptation rules are validated, what `__built` means, the icon-registry specifier traps, `registerTheme`, and wiring built themes in development too.
95
+ (#7204)
96
+ - Add a choose-a-path styling overview and restore the import-based workflow across the theme guides.
97
+ (#7134)
98
+ - Split the theme documentation into focused guides for using and authoring themes, with a concise overview that points to both workflows.
99
+ (#7141)
100
+
101
+ #### Other Changes
102
+
103
+ - A hint uses `npx astryx …` (or `pnpm exec`, `yarn`, `bunx`) only when the `astryx` bin is in `node_modules/.bin`, in the project or a folder above it. Otherwise it prints `npx @astryxdesign/cli …` (`pnpm dlx`, `yarn dlx`, `bunx`), as it already did when the CLI ran from an npx or dlx cache.
104
+ - A global install, or a workspace install used in a fresh package, used to print `npx astryx …`. The npm package named `astryx` is not this CLI, so following that hint fetched an unrelated package.
105
+ - `astryx blog` follows the same rule, and the incident console template names the scoped package.
106
+
107
+ Classification: contract-restoring. JSON shapes are unchanged; only hint text changes, and projects with the CLI installed keep `npx astryx …`.
108
+
109
+ - deprecation `DEP-0006` / cleanup `CLN-0006` — `astryx layout` command group (`expand`, `check`, `grammar`)
110
+ - A check that needs the loaded project quotes the reason the CLI could not load it, instead of only "Skipped".
111
+ - The config check warns when astryx.config imports but the CLI cannot load the project from it. Before, it said the config loaded cleanly.
112
+ - Integration contributions name the integrations they checked; with none loaded, the check reports info and says there is nothing to check.
113
+ - The agent-docs check reads every file init can write (Hermes included) and looks in the project root as well as the working directory, so running doctor from a subfolder no longer reports that there are no agent docs.
114
+ - `astryx doctor integration validate` names a folder it cannot read and keeps checking. A declared root that is a file or that cannot be read is reported as `invalid_root` or `unreadable_root` instead of a raw error or a crash.
115
+
116
+ Classification: contract-restoring. No check becomes stricter: every new finding is a warning or info, and the only exit-code change is that an unreadable folder outside every root no longer crashes validation.
117
+
118
+ - Whenever the CLI prints its scoped one-off form (it ran from an npx or dlx cache, or the `astryx` bin is not installed for the project), a Yarn project got `yarn dlx @astryxdesign/cli …`. On classic Yarn that command fails.
119
+ - Classic Yarn is read from the declared `packageManager` version, the `yarn.lock` header (`# yarn lockfile v1`), a committed `.yarnrc` (without `.yarnrc.yml`), or the runner. Yarn 2 and later keep `yarn dlx`.
120
+
121
+ Classification: contract-restoring. JSON shapes are unchanged; only hint text changes.
122
+
123
+ #### Contributors
124
+
125
+ Thanks to everyone who contributed to this release:
126
+
127
+ - @ernestt
128
+ - @josephfarina
129
+
130
+ ---
131
+
3
132
  # 0.6.6
4
133
 
5
134
  #### New Features
@@ -171,4 +171,18 @@ describe('the reported defect: docs tokens --dense (#2182)', () => {
171
171
  expect(titles).not.toContain('Dark mode');
172
172
  expect(titles).toContain('深色模式');
173
173
  });
174
+
175
+ it('teaches committed palette references in every theme-doc variant', async () => {
176
+ for (const options of [{}, {dense: true}, {zh: true}]) {
177
+ const result = await docs('theme', null, options);
178
+ const rendered = JSON.stringify(result.data.sections);
179
+ expect(rendered).toContain(
180
+ 'astryx theme palette generate palette.config.json --out palette.generated.ts',
181
+ );
182
+ expect(rendered).toContain(
183
+ "import {palette} from './palette.generated';",
184
+ );
185
+ expect(rendered).toContain('palette.neutral.light[100]');
186
+ }
187
+ });
174
188
  });
@@ -1131,8 +1131,8 @@ export async function integrationPackCheck(options = {}) {
1131
1131
  }
1132
1132
  }
1133
1133
  // A template that sets `replaces` (spec:AST-035) or `keywords` needs a CLI
1134
- // that reads the field: an older CLI drops that template and hides the
1135
- // package's docs.
1134
+ // that reads the field: an older CLI drops that template and can hide the
1135
+ // package's docs. Each field has its own floor.
1136
1136
  if (loaded.templates) {
1137
1137
  const found = await discoverIntegrationTemplatesForOne(loaded).catch(
1138
1138
  () => ({templates: [], errors: []}),
@@ -1025,9 +1025,11 @@ describe('integrationPackCheck', () => {
1025
1025
  expect(await codes()).toContain('replaces_needs_cli');
1026
1026
  peer('^0.6.0');
1027
1027
  expect(await codes()).toContain('replaces_needs_cli');
1028
- // `replaces` still needs 0.7.0.
1029
- peer('>=0.6.4');
1028
+ // Published 0.6.3 rejects `replaces`; published 0.6.4 applies it.
1029
+ peer('>=0.6.3');
1030
1030
  expect(await codes()).toContain('replaces_needs_cli');
1031
+ peer('>=0.6.4');
1032
+ expect(await codes()).not.toContain('replaces_needs_cli');
1031
1033
  peer('>=0.7.0');
1032
1034
  expect(await codes()).not.toContain('replaces_needs_cli');
1033
1035
  }, 120_000);
@@ -1062,6 +1064,12 @@ describe('integrationPackCheck', () => {
1062
1064
  expect(await codes()).toContain('keywords_needs_cli');
1063
1065
  peer('^0.6.0');
1064
1066
  expect(await codes()).toContain('keywords_needs_cli');
1067
+ // Published 0.6.4 and 0.6.5 drop a template that sets `keywords`;
1068
+ // published 0.6.6 reads it.
1069
+ peer('>=0.6.5');
1070
+ expect(await codes()).toContain('keywords_needs_cli');
1071
+ peer('>=0.6.6');
1072
+ expect(await codes()).not.toContain('keywords_needs_cli');
1065
1073
  peer('>=0.7.0');
1066
1074
  expect(await codes()).not.toContain('keywords_needs_cli');
1067
1075
  }, 120_000);
@@ -29,6 +29,7 @@ describe('registry', () => {
29
29
  '0.5.0',
30
30
  '0.6.0',
31
31
  '0.6.4',
32
+ '0.6.7',
32
33
  ]);
33
34
  });
34
35
  });
@@ -30,6 +30,7 @@ const registry = new Map([
30
30
  ['0.5.0', () => import('./transforms/v0.5.0/index.mjs')],
31
31
  ['0.6.0', () => import('./transforms/v0.6.0/index.mjs')],
32
32
  ['0.6.4', () => import('./transforms/v0.6.4/index.mjs')],
33
+ ['0.6.7', () => import('./transforms/v0.6.7/index.mjs')],
33
34
  ]);
34
35
 
35
36
  // Re-export from the shared utility so registry callers and other consumers
@@ -7,17 +7,4 @@
7
7
  * this file into the resolved version folder.
8
8
  */
9
9
 
10
- import migrateCopiedThemesToDescriptors, {
11
- meta as migrateCopiedThemesToDescriptorsMeta,
12
- } from './migrate-copied-themes-to-descriptors.mjs';
13
-
14
- export default [
15
- {
16
- name: 'migrate-copied-themes-to-descriptors',
17
- transform:
18
- /** @type {import('../../../../authoring/codemod/type').CodemodTransform} */ (
19
- /** @type {unknown} */ (migrateCopiedThemesToDescriptors)
20
- ),
21
- meta: migrateCopiedThemesToDescriptorsMeta,
22
- },
23
- ];
10
+ export default [];
@@ -0,0 +1,23 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ /**
4
+ * @file next transform manifest
5
+ *
6
+ * Staged codemods for the next release. The Version Packages PR promotes
7
+ * this file into the resolved version folder.
8
+ */
9
+
10
+ import migrateCopiedThemesToDescriptors, {
11
+ meta as migrateCopiedThemesToDescriptorsMeta,
12
+ } from './migrate-copied-themes-to-descriptors.mjs';
13
+
14
+ export default [
15
+ {
16
+ name: 'migrate-copied-themes-to-descriptors',
17
+ transform:
18
+ /** @type {import('../../../../authoring/codemod/type').CodemodTransform} */ (
19
+ /** @type {unknown} */ (migrateCopiedThemesToDescriptors)
20
+ ),
21
+ meta: migrateCopiedThemesToDescriptorsMeta,
22
+ },
23
+ ];
@@ -17,6 +17,8 @@ export const docsDense = {
17
17
  title: 'Custom themes',
18
18
  content: [
19
19
  {type: 'prose', text: '`defineTheme` + token overrides + component overrides. {@link generic:author-a-theme} for full guide.'},
20
+ null,
21
+ {type: 'prose', text: "new palette: `astryx theme palette generate palette.config.json --out palette.generated.ts` → review + commit module and receipt → `import {palette} from './palette.generated';` → map semantic tokens to stable stops such as `palette.neutral.light[100]` / `palette.neutral.dark[15]`. regeneration updates mapped roles; generation does not rewrite the theme."},
20
22
  ],
21
23
  },
22
24
  {
@@ -41,6 +41,16 @@ export const docs = {
41
41
  label: 'Quick start',
42
42
  code: 'astryx theme add stone --import # use an existing theme\nastryx theme eject stone # fork its source to customize\nastryx theme build src/themes/stone/stoneTheme.ts',
43
43
  },
44
+ {
45
+ type: 'prose',
46
+ text: 'For a new coordinated color system, run `astryx theme palette generate palette.config.json --out palette.generated.ts`. Review and commit the generated palette module and receipt, import its `palette` export, then reference stable stops from semantic tokens. Regenerating an accepted palette updates every mapped token that keeps those references; generation does not rewrite the theme.',
47
+ },
48
+ {
49
+ type: 'code',
50
+ lang: 'tsx',
51
+ label: 'Map semantic tokens to generated palette stops',
52
+ code: "import {defineTheme} from '@astryxdesign/core/theme';\nimport {palette} from './palette.generated';\n\nconst myTheme = defineTheme({\n name: 'my-theme',\n tokens: {\n '--color-background-surface': [\n palette.neutral.light[100],\n palette.neutral.dark[15],\n ],\n },\n});",
53
+ },
44
54
  ],
45
55
  },
46
56
  {
@@ -21,7 +21,7 @@ export const docsZh = {
21
21
  content: [
22
22
  {
23
23
  type: 'prose',
24
- text: '使用 `defineTheme` 进行令牌覆盖、比例配置和组件样式覆盖。完整指南——调色板生成、主题扩展、自适应、自定义变体和生产构建——请参阅 {@link generic:author-a-theme}。',
24
+ text: '使用 `defineTheme` 进行令牌覆盖、比例配置和组件样式覆盖。新建完整调色板时,请运行 `astryx theme palette generate palette.config.json --out palette.generated.ts`,审核并提交生成的模块和收据,再使用 `import {palette} from \'./palette.generated\';` 导入调色板,让语义令牌引用稳定的色阶,例如 `palette.neutral.light[100]` 和 `palette.neutral.dark[15]`。重新生成已接受的调色板时,所有保留这些引用的映射令牌会一并更新;生成操作不会自动修改主题。完整指南请参阅 {@link generic:author-a-theme}。',
25
25
  },
26
26
  ],
27
27
  },
@@ -107,7 +107,7 @@ export const docs = {
107
107
  'It lists the components, templates, themes, docs, and codemods the temporary app sees, and compares them with your source.',
108
108
  "It resolves each component's `import`, and each template's public import, the way Node does, and checks that the module exports the component, or a default export for a template.",
109
109
  'For each theme, it rebuilds the source, compares the built module and production CSS with the authored outputs, and proves the module, CSS, and optional font CSS exports resolve from the packed package.',
110
- 'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.7.0` for a template that sets `replaces` or `keywords`, and `>=0.6.4` for a docs section, a placed guide, a doc section with an `id`, or a theme.',
110
+ 'It fails a package that needs an `@astryxdesign/cli` peer and lacks it: `>=0.6.6` for a template that sets `keywords`, and `>=0.6.4` for a template that sets `replaces`, a docs section, a placed guide, a doc section with an `id`, or a theme.',
111
111
  ],
112
112
  },
113
113
  {
@@ -92,7 +92,7 @@ export default {
92
92
  label: 'package.json',
93
93
  code: `{
94
94
  "peerDependencies": {
95
- "@astryxdesign/cli": ">=0.7.0"
95
+ "@astryxdesign/cli": ">=0.6.4"
96
96
  },
97
97
  "peerDependenciesMeta": {
98
98
  "@astryxdesign/cli": {
@@ -84,7 +84,7 @@ export const docs = {
84
84
  },
85
85
  {
86
86
  type: 'prose',
87
- text: 'Note: `keywords` needs `@astryxdesign/cli` 0.7.0 or later. A stable CLI before 0.7.0 rejects the field, drops that template, and hides your doc topics: `template --list` and `search` print one warning, and `docs` and `build` say nothing. Declare the CLI floor as an optional peer ({@link generic:versioning}); `integration verify` fails until you do.',
87
+ text: 'Note: `keywords` needs `@astryxdesign/cli` 0.6.6 or later. A stable CLI before 0.6.6 rejects the field and drops that template, and one before 0.6.4 also hides your doc topics: `template --list` and `search` print one warning, and `docs` and `build` say nothing. Declare the CLI floor as an optional peer ({@link generic:versioning}); `integration verify` fails until you do.',
88
88
  },
89
89
  ],
90
90
  },
@@ -91,7 +91,7 @@ export const docs = {
91
91
  ],
92
92
  [
93
93
  '`replaces_needs_cli`: The package has a template that sets `replaces` but declares no @astryxdesign/cli peer.',
94
- "Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.7.0'` and `npm pkg set 'peerDependenciesMeta.@astryxdesign/cli.optional=true' --json`. A stable CLI before 0.7.0 rejects `replaces`, drops that template, and hides your doc topics.",
94
+ "Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.6.4'` and `npm pkg set 'peerDependenciesMeta.@astryxdesign/cli.optional=true' --json`. A stable CLI before 0.6.4 rejects `replaces`, drops that template, and hides your doc topics.",
95
95
  ],
96
96
  [
97
97
  '`component_replaces_needs_cli` (a warning): The package has a component that sets `replaces` but declares no @astryxdesign/cli peer, or a peer range that admits an earlier CLI.',
@@ -99,7 +99,7 @@ export const docs = {
99
99
  ],
100
100
  [
101
101
  '`keywords_needs_cli`: The package has a template that sets `keywords` but declares no @astryxdesign/cli peer.',
102
- 'The same fix as `replaces_needs_cli`: a stable CLI before 0.7.0 rejects `keywords`, drops that template, and hides your doc topics.',
102
+ "Run `npm pkg set 'peerDependencies.@astryxdesign/cli=>=0.6.6'` and `npm pkg set 'peerDependenciesMeta.@astryxdesign/cli.optional=true' --json`. A stable CLI before 0.6.6 rejects `keywords` and drops that template, and one before 0.6.4 also hides your doc topics.",
103
103
  ],
104
104
  [
105
105
  '`themes_need_cli`: The package ships a theme but declares no @astryxdesign/cli peer.',
@@ -143,7 +143,7 @@ export const docs = {
143
143
  ],
144
144
  [
145
145
  'Your docs section, templates, or themes are missing only in some apps',
146
- 'Those apps run a CLI too old to read them: a stable CLI before 0.7.0 for a template that sets `replaces` or `keywords`, or before 0.6.4 for a docs section or a theme. Update `@astryxdesign/cli` there, and keep your optional `@astryxdesign/cli` peer so npm warns about an old CLI.',
146
+ 'Those apps run a CLI too old to read them: a stable CLI before 0.6.6 for a template that sets `keywords`, or before 0.6.4 for a template that sets `replaces`, a docs section, or a theme. Update `@astryxdesign/cli` there, and keep your optional `@astryxdesign/cli` peer so npm warns about an old CLI.',
147
147
  ],
148
148
  ],
149
149
  },
@@ -110,7 +110,7 @@ export const docs = {
110
110
  [
111
111
  '`@astryxdesign/cli`',
112
112
  'You ship a docs section, a placed guide, a template that sets `replaces` or `keywords`, a doc section with an `id`, or a theme',
113
- '`>=0.7.0` when you ship a template that sets `replaces` or `keywords`, otherwise `>=0.6.4`. Optional in `peerDependenciesMeta`',
113
+ '`>=0.6.6` when you ship a template that sets `keywords`, otherwise `>=0.6.4`. Optional in `peerDependenciesMeta`',
114
114
  ],
115
115
  ],
116
116
  },
@@ -140,7 +140,7 @@ export const docs = {
140
140
  'An unknown field in `astryx.integration.mjs` is ignored with an `unknown_manifest_key` warning, and the rest of the manifest still loads.',
141
141
  'A named export that the CLI does not know is ignored with no warning, so `debug` and `gapReport` are safe to add.',
142
142
  'A stable CLI before 0.7.0 prints each `{@link ...}` as written.',
143
- 'A stable CLI before 0.7.0 rejects a template that sets `replaces` or `keywords`, drops that template, and can hide every doc topic your package ships.',
143
+ 'Published 0.6.3 and earlier reject a template that sets `replaces` or `keywords`, drop that template, and hide every doc topic your package ships. Published 0.6.4 and 0.6.5 still drop a template that sets `keywords`.',
144
144
  'A stable CLI before 0.6.4 cannot read a docs section, a section `id`, or a theme folder that `integration add theme` writes. It can then hide every doc topic your package ships.',
145
145
  'Stable 0.6.3 still loads your components, but 0.6.0 cannot read the component docs that `integration add component` writes: `component AcmeCarousel` fails there.',
146
146
  ],
@@ -81,6 +81,7 @@
81
81
  */
82
82
 
83
83
  import {defineTheme} from '@astryxdesign/core/theme';
84
+ // import {palette} from './palette.generated';
84
85
  // import {dracula} from '@astryxdesign/core/theme/syntax';
85
86
  // import {neutralTheme} from '@astryxdesign/theme-neutral';
86
87
 
@@ -99,15 +100,25 @@ export const myTheme = defineTheme({
99
100
  // extends: neutralTheme,
100
101
 
101
102
  // ───────────────────────────────────────────────────────────────────────
102
- // Scale configs — a few parameters generate a whole family of tokens.
103
- // Reach for these first. They keep a theme internally consistent and cover
104
- // far more ground than you would hand-write.
103
+ // Scale configs — concise inputs for typography, radius, and motion.
104
+ // The color scale remains supported for existing themes, but it is not the
105
+ // recommended starting point for a new palette; see its note below.
105
106
  // ───────────────────────────────────────────────────────────────────────
106
107
 
107
108
  /**
108
- * Generates the neutral ramp and the accent tokens from a seed colour
109
- * using the HCT perceptual model: surfaces, text, icons, borders, muted
110
- * fills, hover and pressed overlays — light and dark both.
109
+ * Supported compatibility path for existing themes. This expands one accent
110
+ * seed into the neutral ramp, surfaces, text, icons, borders, muted fills,
111
+ * hover and pressed overlays — light and dark both. It is not an accent-only
112
+ * edit.
113
+ *
114
+ * For a new complete palette, run:
115
+ *
116
+ * astryx theme palette generate palette.config.json --out palette.generated.ts
117
+ *
118
+ * Review the generated candidate, then commit the palette module and receipt.
119
+ * Uncomment the `palette` import above and reference its stops from semantic
120
+ * tokens below. Regenerating an accepted palette then updates every mapped
121
+ * token that keeps those references. Generation does not rewrite the theme.
111
122
  *
112
123
  * accent seed hex, or a [light, dark] pair to seed each scheme's
113
124
  * palette from its own colour; omit to keep the default
@@ -134,7 +145,7 @@ export const myTheme = defineTheme({
134
145
  * `astryx docs tokens/tokens-color` for every colour token and its light/dark
135
146
  * default.
136
147
  */
137
- color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
148
+ // color: {accent: '#0064E0', neutralStyle: 'cool', contrast: 'standard'},
138
149
 
139
150
  /**
140
151
  * Type scale and the three font roles.
@@ -213,12 +224,17 @@ export const myTheme = defineTheme({
213
224
  // --color-syntax-* code highlighting · --color-data-* charts
214
225
  // ───────────────────────────────────────────────────────────────────────
215
226
  tokens: {
227
+ // Keep generated roles connected to the accepted palette. Uncomment the
228
+ // import above, then map each reviewed semantic role this way.
229
+ // '--color-background-surface': [
230
+ // palette.neutral.light[100],
231
+ // palette.neutral.dark[15],
232
+ // ],
216
233
  '--color-accent': ['#0064E0', '#2694FE'],
217
234
  // Changing an accent means owning its on-colour: this is the label that
218
235
  // sits on top of the fill above, in each mode.
219
236
  '--color-on-accent': ['#FFFFFF', '#FFFFFF'],
220
237
  '--color-background-body': ['#F1F4F7', '#111112'],
221
- '--color-background-surface': ['#FFFFFF', '#1F1F22'],
222
238
  '--focus-outline-color': 'var(--color-accent)',
223
239
  '--shadow-low': '0 1px 2px light-dark(#0000001A, #00000066)',
224
240
  },
@@ -56,13 +56,13 @@ export const doc = {
56
56
  name: 'keywords',
57
57
  type: 'string[]',
58
58
  description:
59
- "Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
59
+ "Search keywords for CLI discovery: the ideas, domains, and other names a builder might use for what the template serves (e.g. ['monitoring', 'uptime', 'on-call'] for a service-health dashboard). Lowercase. `astryx search` matches them as it matches the description and `astryx build` ranks page templates on them, so keep them out of `description`. Integration templates need @astryxdesign/cli 0.6.6 or later: earlier CLIs reject the field and drop that template, and CLIs before 0.6.4 also hide the package's doc topics.",
60
60
  },
61
61
  {
62
62
  name: 'replaces',
63
63
  type: 'string',
64
64
  description:
65
- "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.7.0 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
65
+ "Integration templates only: the exact id of the Core template this one replaces for unqualified lookup. Find it with `astryx --json template --list --package @astryxdesign/core`; the Core original stays selectable with `--package @astryxdesign/core`. A page replaces only a Core page and a block only a Core block. Needs @astryxdesign/cli 0.6.4 or later: earlier CLIs reject the field, drop that template, and hide the package's doc topics.",
66
66
  },
67
67
  {
68
68
  name: 'isReady',
@@ -32,8 +32,9 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
32
32
  * `astryx search` matches them as it matches the description, and
33
33
  * `astryx build` ranks page templates on them, so the `description` can
34
34
  * stay a description of the layout. Integration templates need
35
- * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field, drop
36
- * that template, and hide the package's doc topics. */
35
+ * `@astryxdesign/cli` 0.6.6 or later: earlier CLIs reject the field and
36
+ * drop that template, and CLIs before 0.6.4 also hide the package's doc
37
+ * topics. */
37
38
  keywords?: string[];
38
39
 
39
40
  /** Optional stable slug override and prior aliases for registry output. */
@@ -43,7 +44,7 @@ export interface BaseTemplateDoc extends AuthoredDocGraphFields {
43
44
  * replaces for unqualified lookup (find it with
44
45
  * `astryx --json template --list --package @astryxdesign/core`). The Core
45
46
  * original stays selectable with `--package @astryxdesign/core`. Needs
46
- * `@astryxdesign/cli` 0.7.0 or later: earlier CLIs reject the field,
47
+ * `@astryxdesign/cli` 0.6.4 or later: earlier CLIs reject the field,
47
48
  * drop that template, and hide the package's doc topics. */
48
49
  replaces?: string;
49
50
  /** Whether this template is ready for use. Templates with
@@ -30,9 +30,10 @@ export function cliRangeProblem(pkg: any, feature: string, loss: string, floor:
30
30
  */
31
31
  export function docsTreeCliProblem(pkg: any): string | null;
32
32
  /**
33
- * Why a package with a template that sets `replaces` would lose templates and
34
- * doc topics on an older CLI (spec:AST-035), or null when its declared CLI
35
- * range admits only CLIs that read the field.
33
+ * Why a package with a template that sets `replaces` would lose that template
34
+ * and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
35
+ * declared CLI range admits only CLIs that apply the field. Published 0.6.3
36
+ * rejects the field; published 0.6.4 applies it.
36
37
  * @param {any} pkg package.json
37
38
  * @returns {string | null}
38
39
  */
@@ -67,9 +68,10 @@ export function sectionIdsCliProblem(pkg: any): string | null;
67
68
  export function themesCliProblem(pkg: any): string | null;
68
69
  /**
69
70
  * Why a package with a template that sets `keywords` would lose that template
70
- * and its doc topics on an older CLI, or null when its declared CLI range
71
- * admits only CLIs that read the field. Published 0.6.3 rejects the field,
72
- * drops that template, and hides the package's doc topics.
71
+ * on an older CLI, or null when its declared CLI range admits only CLIs that
72
+ * read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
73
+ * template; 0.6.3 and earlier also hide the package's doc topics. Published
74
+ * 0.6.6 reads it.
73
75
  * @param {any} pkg package.json
74
76
  * @returns {string | null}
75
77
  */
@@ -98,11 +100,20 @@ export const CLI_PACKAGE: "@astryxdesign/cli";
98
100
  */
99
101
  export const NAMESPACE_DOCS_CLI: "0.6.4";
100
102
  /**
101
- * The first CLI release that reads a template's `replaces` and `keywords`. A
102
- * release before it rejects either field, drops that template, and hides the
103
- * package's doc topics.
103
+ * The first stable CLI release that applies a template's `replaces`
104
+ * (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
105
+ * template, and hide every doc topic the package ships. Published 0.6.4 lists
106
+ * the template, keeps the topics, answers the Core id with the replacement,
107
+ * and still selects the Core original with `--package @astryxdesign/core`.
104
108
  */
105
- export const REPLACES_CLI: "0.7.0";
109
+ export const TEMPLATE_REPLACES_CLI: "0.6.4";
110
+ /**
111
+ * The first stable CLI release that reads a template's `keywords`. Published
112
+ * 0.6.4 and 0.6.5 reject the field and drop that template but keep the
113
+ * package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
114
+ * lists the template, and search matches its keywords.
115
+ */
116
+ export const KEYWORDS_CLI: "0.6.6";
106
117
  /**
107
118
  * The first stable CLI release that applies a component's `replaces`
108
119
  * (spec:AST-035 FR10). It is also the opt-in: a CLI applies a package's
@@ -26,11 +26,21 @@ export const CLI_PACKAGE = '@astryxdesign/cli';
26
26
  export const NAMESPACE_DOCS_CLI = '0.6.4';
27
27
 
28
28
  /**
29
- * The first CLI release that reads a template's `replaces` and `keywords`. A
30
- * release before it rejects either field, drops that template, and hides the
31
- * package's doc topics.
29
+ * The first stable CLI release that applies a template's `replaces`
30
+ * (spec:AST-035 FR1). Published 0.6.3 and earlier reject the field, drop that
31
+ * template, and hide every doc topic the package ships. Published 0.6.4 lists
32
+ * the template, keeps the topics, answers the Core id with the replacement,
33
+ * and still selects the Core original with `--package @astryxdesign/core`.
32
34
  */
33
- export const REPLACES_CLI = '0.7.0';
35
+ export const TEMPLATE_REPLACES_CLI = '0.6.4';
36
+
37
+ /**
38
+ * The first stable CLI release that reads a template's `keywords`. Published
39
+ * 0.6.4 and 0.6.5 reject the field and drop that template but keep the
40
+ * package's doc topics; 0.6.3 and earlier also hide them. Published 0.6.6
41
+ * lists the template, and search matches its keywords.
42
+ */
43
+ export const KEYWORDS_CLI = '0.6.6';
34
44
 
35
45
  /**
36
46
  * The first stable CLI release that applies a component's `replaces`
@@ -166,9 +176,10 @@ export function docsTreeCliProblem(pkg) {
166
176
  }
167
177
 
168
178
  /**
169
- * Why a package with a template that sets `replaces` would lose templates and
170
- * doc topics on an older CLI (spec:AST-035), or null when its declared CLI
171
- * range admits only CLIs that read the field.
179
+ * Why a package with a template that sets `replaces` would lose that template
180
+ * and its doc topics on an older CLI (spec:AST-035 FR1), or null when its
181
+ * declared CLI range admits only CLIs that apply the field. Published 0.6.3
182
+ * rejects the field; published 0.6.4 applies it.
172
183
  * @param {any} pkg package.json
173
184
  * @returns {string | null}
174
185
  */
@@ -177,7 +188,7 @@ export function replacesCliProblem(pkg) {
177
188
  pkg,
178
189
  'has a template that sets `replaces`',
179
190
  "rejects the field, drops that template, and hides the package's doc topics",
180
- REPLACES_CLI,
191
+ TEMPLATE_REPLACES_CLI,
181
192
  );
182
193
  }
183
194
 
@@ -235,9 +246,10 @@ export function themesCliProblem(pkg) {
235
246
 
236
247
  /**
237
248
  * Why a package with a template that sets `keywords` would lose that template
238
- * and its doc topics on an older CLI, or null when its declared CLI range
239
- * admits only CLIs that read the field. Published 0.6.3 rejects the field,
240
- * drops that template, and hides the package's doc topics.
249
+ * on an older CLI, or null when its declared CLI range admits only CLIs that
250
+ * read the field. Published 0.6.4 and 0.6.5 reject the field and drop that
251
+ * template; 0.6.3 and earlier also hide the package's doc topics. Published
252
+ * 0.6.6 reads it.
241
253
  * @param {any} pkg package.json
242
254
  * @returns {string | null}
243
255
  */
@@ -245,8 +257,8 @@ export function keywordsCliProblem(pkg) {
245
257
  return cliRangeProblem(
246
258
  pkg,
247
259
  'has a template that sets `keywords`',
248
- "rejects the field, drops that template, and hides the package's doc topics",
249
- REPLACES_CLI,
260
+ "rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics",
261
+ KEYWORDS_CLI,
250
262
  );
251
263
  }
252
264
 
@@ -6,9 +6,10 @@ import {semverCompare} from '../env/semver.mjs';
6
6
  import * as requirement from './cli-requirement.mjs';
7
7
  import {
8
8
  COMPONENT_REPLACES_CLI,
9
+ KEYWORDS_CLI,
9
10
  NAMESPACE_DOCS_CLI,
10
- REPLACES_CLI,
11
11
  SECTION_IDS_CLI,
12
+ TEMPLATE_REPLACES_CLI,
12
13
  cliRangeProblem,
13
14
  componentReplacesCliProblem,
14
15
  THEMES_CLI,
@@ -91,20 +92,78 @@ describe('docsTreeCliProblem', () => {
91
92
  });
92
93
 
93
94
  describe('replacesCliProblem', () => {
94
- it('asks a package that sets replaces for a CLI that reads the field', () => {
95
+ // Published 0.6.4 applies a template's `replaces`. Published 0.6.3 and
96
+ // earlier reject the field, drop the template, and hide the package's doc
97
+ // topics.
98
+ it('asks a package that sets replaces for a CLI from 0.6.4', () => {
95
99
  expect(replacesCliProblem({name: '@acme/kit'})).toContain(
96
100
  'sets `replaces`',
97
101
  );
98
- expect(
99
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '^0.6.0'}}),
100
- ).toContain('admits a stable CLI before');
101
- expect(
102
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
103
- ).toBeNull();
104
- // Unlike the docs tree, `replaces` still needs 0.7.0.
105
- expect(
106
- replacesCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}}),
107
- ).toContain('admits a stable CLI before 0.7.0');
102
+ expect(replacesCliProblem({name: '@acme/kit'})).toContain(
103
+ "A stable CLI before 0.6.4 rejects the field, drops that template, and hides the package's doc topics.",
104
+ );
105
+ for (const range of ['>=0.6.4', '^0.6.4', '>=0.6.5', '>=0.7.0']) {
106
+ expect(
107
+ replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
108
+ ).toBeNull();
109
+ }
110
+ for (const range of ['>=0.6.3', '^0.6.0', '*']) {
111
+ expect(
112
+ replacesCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
113
+ ).toContain('admits a stable CLI before 0.6.4');
114
+ }
115
+ });
116
+ });
117
+
118
+ describe('keywordsCliProblem', () => {
119
+ // Published 0.6.6 reads a template's `keywords`. Published 0.6.4 and 0.6.5
120
+ // reject the field and drop the template; 0.6.3 and earlier also hide the
121
+ // package's doc topics.
122
+ it('asks a package that sets keywords for a CLI from 0.6.6', () => {
123
+ expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
124
+ 'sets `keywords`',
125
+ );
126
+ expect(keywordsCliProblem({name: '@acme/kit'})).toContain(
127
+ "A stable CLI before 0.6.6 rejects the field and drops that template, and one before 0.6.4 also hides the package's doc topics.",
128
+ );
129
+ for (const range of ['>=0.6.6', '^0.6.6', '>=0.6.7', '>=0.7.0']) {
130
+ expect(
131
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
132
+ ).toBeNull();
133
+ }
134
+ for (const range of ['>=0.6.5', '>=0.6.4', '^0.6.4', '^0.6.0']) {
135
+ expect(
136
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': range}}),
137
+ ).toContain('admits a stable CLI before 0.6.6');
138
+ }
139
+ });
140
+ });
141
+
142
+ describe('template replaces and keywords floors in the shipped docs', () => {
143
+ // The range an author is told to declare is the range `integration verify`
144
+ // accepts, so following the docs never fails the check or asks for a CLI
145
+ // no release satisfies.
146
+ const read = (/** @type {string} */ file) =>
147
+ fs.readFileSync(new URL(file, import.meta.url), 'utf-8');
148
+
149
+ it('shows the replaces floor in the replace-a-core-template guide', () => {
150
+ const named = [
151
+ ...read(
152
+ '../../assets/docs/tree/replace-a-core-template.doc.mjs',
153
+ ).matchAll(/"@astryxdesign\/cli":\s*">=(\d+\.\d+\.\d+)"/g),
154
+ ].map(match => match[1]);
155
+ expect(named.length).toBeGreaterThan(0);
156
+ expect(new Set(named)).toEqual(new Set([TEMPLATE_REPLACES_CLI]));
157
+ });
158
+
159
+ it.each([
160
+ ['`replaces_needs_cli`', TEMPLATE_REPLACES_CLI],
161
+ ['`keywords_needs_cli`', KEYWORDS_CLI],
162
+ ])('gives the %s fix the floor the check asks for', (code, floor) => {
163
+ const row = read('../../assets/docs/tree/troubleshooting.doc.mjs')
164
+ .split('],')
165
+ .find(part => part.includes(`${code}:`));
166
+ expect(row).toContain(`@astryxdesign/cli=>=${floor}'`);
108
167
  });
109
168
  });
110
169
 
@@ -193,17 +252,17 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
193
252
  }
194
253
  });
195
254
 
196
- it('keeps 0.7.0 for replaces and keywords', () => {
255
+ it('gives replaces and keywords their own floors', () => {
256
+ // `>=0.6.4` admits published 0.6.4 and 0.6.5, which drop a template that
257
+ // sets `keywords` but apply one that sets `replaces`.
197
258
  const pkg = {peerDependencies: {'@astryxdesign/cli': '>=0.6.4'}};
198
259
  expect(docsTreeCliProblem(pkg)).toBeNull();
199
- expect(replacesCliProblem(pkg)).toContain(
200
- 'admits a stable CLI before 0.7.0',
201
- );
260
+ expect(replacesCliProblem(pkg)).toBeNull();
202
261
  expect(keywordsCliProblem(pkg)).toContain(
203
- 'admits a stable CLI before 0.7.0',
262
+ 'admits a stable CLI before 0.6.6',
204
263
  );
205
264
  expect(
206
- keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.7.0'}}),
265
+ keywordsCliProblem({peerDependencies: {'@astryxdesign/cli': '>=0.6.6'}}),
207
266
  ).toBeNull();
208
267
  });
209
268
 
@@ -211,7 +270,13 @@ describe('themesCliProblem and sectionIdsCliProblem', () => {
211
270
  const {version} = JSON.parse(
212
271
  fs.readFileSync(new URL('../../package.json', import.meta.url), 'utf-8'),
213
272
  );
214
- for (const floor of [NAMESPACE_DOCS_CLI, THEMES_CLI, SECTION_IDS_CLI]) {
273
+ for (const floor of [
274
+ NAMESPACE_DOCS_CLI,
275
+ THEMES_CLI,
276
+ SECTION_IDS_CLI,
277
+ TEMPLATE_REPLACES_CLI,
278
+ KEYWORDS_CLI,
279
+ ]) {
215
280
  expect(semverCompare(floor, version.split('-')[0])).toBeLessThanOrEqual(
216
281
  0,
217
282
  );
@@ -252,8 +317,8 @@ describe('every feature check names its CLI floor', () => {
252
317
  const FLOORS = {
253
318
  componentReplacesCliProblem: COMPONENT_REPLACES_CLI,
254
319
  docsTreeCliProblem: '0.6.4',
255
- replacesCliProblem: REPLACES_CLI,
256
- keywordsCliProblem: REPLACES_CLI,
320
+ replacesCliProblem: TEMPLATE_REPLACES_CLI,
321
+ keywordsCliProblem: KEYWORDS_CLI,
257
322
  sectionIdsCliProblem: '0.6.4',
258
323
  themesCliProblem: '0.6.4',
259
324
  };
@@ -279,8 +344,10 @@ describe('every feature check names its CLI floor', () => {
279
344
  // Tied to the next patch slot: the first stable release that ships
280
345
  // component replacement.
281
346
  componentReplacesCliProblem: '0.6.7',
282
- replacesCliProblem: '0.7.0',
283
- keywordsCliProblem: '0.7.0',
347
+ // Measured on published releases: 0.6.4 applies a template's
348
+ // `replaces`, and 0.6.6 reads its `keywords`.
349
+ replacesCliProblem: '0.6.4',
350
+ keywordsCliProblem: '0.6.6',
284
351
  });
285
352
  });
286
353
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.6-canary.ffa4f72",
3
+ "version": "0.6.7-canary.037dfb6",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -101,10 +101,10 @@
101
101
  "zod": "^4.4.3"
102
102
  },
103
103
  "peerDependencies": {
104
- "@astryxdesign/charts": "0.6.6-canary.ffa4f72",
105
- "@astryxdesign/core": "0.6.6-canary.ffa4f72",
106
- "@astryxdesign/lab": "0.6.6-canary.ffa4f72",
107
- "@astryxdesign/theme-neutral": "0.6.6-canary.ffa4f72"
104
+ "@astryxdesign/charts": "0.6.7-canary.037dfb6",
105
+ "@astryxdesign/core": "0.6.7-canary.037dfb6",
106
+ "@astryxdesign/lab": "0.6.7-canary.037dfb6",
107
+ "@astryxdesign/theme-neutral": "0.6.7-canary.037dfb6"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -121,10 +121,10 @@
121
121
  }
122
122
  },
123
123
  "devDependencies": {
124
- "@astryxdesign/charts": "0.6.6-canary.ffa4f72",
125
- "@astryxdesign/core": "0.6.6-canary.ffa4f72",
126
- "@astryxdesign/lab": "0.6.6-canary.ffa4f72",
127
- "@astryxdesign/theme-neutral": "0.6.6-canary.ffa4f72",
124
+ "@astryxdesign/charts": "0.6.7-canary.037dfb6",
125
+ "@astryxdesign/core": "0.6.7-canary.037dfb6",
126
+ "@astryxdesign/lab": "0.6.7-canary.037dfb6",
127
+ "@astryxdesign/theme-neutral": "0.6.7-canary.037dfb6",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",