@astryxdesign/cli 0.7.14-canary.gfdb9213 → 0.7.14

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.
Files changed (95) hide show
  1. package/CHANGELOG.md +197 -0
  2. package/api/theme/_adapter.d.mts +33 -0
  3. package/api/theme/_adapter.mjs +352 -16
  4. package/api/theme/build/build.mjs +261 -10
  5. package/api/theme/eject/eject.mjs +13 -1
  6. package/api/theme/list/list.mjs +11 -2
  7. package/api/theme/template/template.mjs +139 -6
  8. package/api/theme/theme.type.d.mts +15 -1
  9. package/api/theme/theme.type.mjs +9 -3
  10. package/api/theme/themeAdd.doc.mjs +1 -1
  11. package/api/theme/themeBuild.doc.mjs +10 -2
  12. package/api/theme/themeEject.doc.mjs +2 -2
  13. package/api/theme/themeListAvailable.doc.mjs +1 -1
  14. package/api/theme/themeRemove.doc.mjs +1 -1
  15. package/api/theme/themeTemplate.doc.mjs +8 -0
  16. package/api/theme/themeUse.doc.mjs +1 -1
  17. package/api/theme-edit/_adapter.d.mts +10 -2
  18. package/api/theme-edit/_adapter.mjs +52 -31
  19. package/api/theme-edit/_check.d.mts +28 -25
  20. package/api/theme-edit/_check.mjs +586 -548
  21. package/api/theme-edit/_color.d.mts +28 -2
  22. package/api/theme-edit/_color.mjs +306 -68
  23. package/api/theme-edit/_compiler.d.mts +8 -4
  24. package/api/theme-edit/_compiler.mjs +30 -27
  25. package/api/theme-edit/_context.d.mts +10 -4
  26. package/api/theme-edit/_context.mjs +21 -4
  27. package/api/theme-edit/_edit.mjs +300 -43
  28. package/api/theme-edit/_how-commands.d.mts +91 -0
  29. package/api/theme-edit/_how-commands.mjs +269 -0
  30. package/api/theme-edit/_how-question.d.mts +57 -0
  31. package/api/theme-edit/_how-question.mjs +2574 -0
  32. package/api/theme-edit/_how.d.mts +25 -17
  33. package/api/theme-edit/_how.mjs +727 -305
  34. package/api/theme-edit/_palette.d.mts +127 -19
  35. package/api/theme-edit/_palette.mjs +1313 -399
  36. package/api/theme-edit/_parts.mjs +36 -3
  37. package/api/theme-edit/_png.d.mts +18 -6
  38. package/api/theme-edit/_png.mjs +135 -25
  39. package/api/theme-edit/_preview-app.d.mts +26 -7
  40. package/api/theme-edit/_preview-app.mjs +1611 -280
  41. package/api/theme-edit/_preview.d.mts +4 -2
  42. package/api/theme-edit/_preview.mjs +18 -7
  43. package/api/theme-edit/_settings.d.mts +56 -5
  44. package/api/theme-edit/_settings.mjs +197 -49
  45. package/api/theme-edit/_tables.d.mts +0 -12
  46. package/api/theme-edit/_tables.mjs +24 -97
  47. package/api/theme-edit/theme-edit.type.d.mts +22 -5
  48. package/api/theme-edit/theme-edit.type.mjs +17 -6
  49. package/api/theme-edit/themeEditHow.doc.mjs +13 -3
  50. package/api/theme-edit/themeEditNew.doc.mjs +2 -1
  51. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +16 -4
  52. package/api/theme-edit/themeEditPreviewApp.doc.mjs +12 -4
  53. package/api/theme-edit/themeEditPreviewList.doc.mjs +9 -1
  54. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +27 -2
  55. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  56. package/assets/docs.generated.json +1 -0
  57. package/assets/preview-app/gitignore +3 -0
  58. package/assets/templates/components.generated.json +1 -0
  59. package/clients/cli/bin/astryx.mjs +37 -5
  60. package/clients/cli/commands/experimental/theme.mjs +231 -31
  61. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +14 -5
  62. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -1
  63. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +1 -1
  64. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +3 -2
  65. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +2 -2
  66. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +2 -2
  67. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +2 -2
  68. package/clients/cli/commands/experimental-theme-targets.doc.mjs +1 -1
  69. package/clients/cli/commands/experimental-theme.doc.mjs +2 -2
  70. package/clients/cli/commands/theme-build.doc.mjs +1 -1
  71. package/clients/cli/commands/theme-eject.doc.mjs +3 -3
  72. package/clients/cli/commands/theme-remove.doc.mjs +2 -2
  73. package/clients/cli/commands/theme-template.doc.mjs +11 -4
  74. package/clients/cli/commands/theme.mjs +104 -40
  75. package/clients/cli/commands.generated.json +1 -0
  76. package/clients/cli/index.mjs +96 -4
  77. package/clients/cli/lib/json-shim.mjs +29 -1
  78. package/foundation/config/project.d.mts +16 -2
  79. package/foundation/config/project.mjs +40 -6
  80. package/foundation/config/theme-state.d.mts +9 -0
  81. package/foundation/config/theme-state.mjs +20 -1
  82. package/foundation/discovery/template-adapter.d.mts +12 -1
  83. package/foundation/discovery/template-adapter.mjs +24 -1
  84. package/foundation/discovery/template-needs.d.mts +7 -0
  85. package/foundation/discovery/template-needs.mjs +117 -8
  86. package/foundation/discovery/template-source-tree.d.mts +5 -1
  87. package/foundation/discovery/template-source-tree.mjs +6 -4
  88. package/foundation/discovery/theme-discovery.d.mts +14 -3
  89. package/foundation/discovery/theme-discovery.mjs +45 -12
  90. package/foundation/doc-compiler/import.mjs +68 -3
  91. package/foundation/doc-compiler/stored-docs.d.mts +27 -0
  92. package/foundation/doc-compiler/stored-docs.mjs +65 -0
  93. package/foundation/fs/fs-error.d.mts +17 -0
  94. package/foundation/fs/fs-error.mjs +34 -0
  95. package/package.json +6 -6
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  "Look up a part, group, setting or aspect; answer a question in plain words; read a picture's colors; or list what you can set",
14
14
  description:
15
- 'One command for every question. With nothing named, it prints its usage and examples. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size) and under which variant or state, its variants (--when) and states (--state), the parts inside it (a token set --on the part reaches them), and its group. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it, or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch; a color (accent, neutral, success, warning, danger, info) also lists the shade each token starts from. Color questions in plain words ("brand color", "make it more colorful", "dark mode colors", "error red", "see all shades", "exact color for one token") get one line of what happens and the commands. A question in plain words ("bold white text in the header", "glossy gradient header"): it finds the parts (header, nav links, banner, cards, inputs, buttons and their variants...) and aspects (text color, background, gradient, corners, border, shadow or bevel, spacing, font, bold, letter spacing) and answers with exact commands from what each part really reads: the direct property (always works) and the token route; a part with variants says a change without --when reaches every variant. A PNG picture: its main colors, biggest share first, with where each sits (a number after the file sets how many, default 14), or with --at the exact color at pixel points (no browser needed). --list <what> lists what a change can name (dials, tokens, parts, groups or properties; --list alone lists those kinds), and any words after <what> filter the list. Experimental: it may change or be removed in a patch release.',
15
+ 'One command for every question. With nothing named, it prints its usage and examples. A part (button, card; --list parts): what it reads for each aspect (text, background, border, corners, shadow, spacing, font, size), each condition written as the --when and --state flags `set` takes or marked not settable with the reason, its variants, every state `set` accepts, the parts inside it (a token set --on the part reaches them), and its group; a part the part data does not have says so, with commands that still apply. A group (inputs, containers, checks, menus): its members and whether styling one styles all. A setting: a dial\'s rungs and examples, a token\'s type, default and the parts that read it (and, when none does, whether Core\'s stylesheet still uses it), or a CSS property and the parts that set it. An aspect (text, background, border, corners, shadow, spacing, font, size): the dial and the whole-theme tokens most parts read for it. `colors` (or `palette`): how the theme\'s colors are made: one seed per color, light and dark shades generated with the same generator as `theme palette generate`, the shade each token starts from, vibrancy, the Colors preview page and the exact-token escape hatch. A lookup takes any case, a plural, and a token name without its dashes. A question in plain words ("bold white text in the header", "remove shadows from cards", "cards: 8px radius; buttons: 4px"): it reads each clause for the parts (and their variant, size, state or mode), what to change, the values typed (hex, rgb(), lengths, dashed), and whether it asks for more, less or none ("shouldn\'t", "turn off", "never", "too sharp", "everything except X" included), and answers with exact commands; a typed value always wins over a color word, and a hex color with the wrong number of digits is refused by name, never replaced with a sample. "In dark mode" carries --mode dark to every color command; a change that cannot differ by mode, or a dark-mode ask on a light-only theme, says so instead. A question about what something is ("what does --color-accent do") gets the lookup. Several changes in one question come first as one sequence (`sequence: true`: run every command in order, at most 12), with repeated and overwritten steps left out; two asks that contradict each other are offered as choices. Changes come before lookups. Every suggested command names the theme (`theme`: the one named with `theme`, the only one, or the one an editor command changed last, said in `themeNote`; `themeChosenBy` says which: named, only, last-changed or none; with none, my-theme, made first), holds a real value, never a placeholder or a comment, and is checked as `set` checks it: a command `set` would refuse, or that changes nothing, is left out and listed in `refused` with the reason. A question with no answer says why in `hint`, with the next commands in `run`. A PNG picture (by any file name; other formats are refused by their bytes): its main colors from every pixel (on an even grid past 4 million), biggest share first, with where each sits, see-through pixels skipped, tRNS included (a number after the file sets how many, default 14), or with --at the exact color and alpha at pixel points; a picture over 40 million pixels (20 million at 16 bits), or with pixel data that is damaged or shorter than its header says, is refused before it is decoded. --list <what> lists what a change can name (dials, tokens, parts, groups or properties, in any case, singular or plural; kinds or no word lists those kinds), and the other words filter the list. Experimental: it may change or be removed in a patch release.',
16
16
  fn: 'themeEditHow',
17
17
  args: [
18
18
  {
@@ -27,13 +27,19 @@ export const doc = {
27
27
  flag: '--list',
28
28
  param: 'options.list',
29
29
  description:
30
- 'List what a change can name; the first word says what: dials, tokens (with type, default and how many parts read each), parts (with component, group, variants and states), groups, or properties (the common CSS properties; a filter searches every standard one). Any words after it filter the list. With no word, the kinds it lists',
30
+ 'List what a change can name; the word that names a kind says what, wherever it is (any case, singular or plural): dials, tokens (with type, default and how many parts read each), parts (one item per name, with its components, group, variants and states), groups, or properties (the common CSS properties; a filter searches every standard one). The other words filter the list, and may start with --. --list=tokens works too. With no word, or kinds, the kinds it lists',
31
+ },
32
+ {
33
+ flag: '--theme <name>',
34
+ param: 'options.theme',
35
+ description:
36
+ 'The theme the suggested commands are for, checked against its settings (default: the only theme the editor made in the app; with several, the one an editor command changed last; with none, a theme named my-theme that the answer makes first). An empty name or --theme given twice is refused, for every subject',
31
37
  },
32
38
  {
33
39
  flag: '--at <points...>',
34
40
  param: 'options.at',
35
41
  description:
36
- 'With a PNG picture: the exact color at pixel points x,y, given as "40,20;300,180", "40,20 300,180", a repeated --at, or a flat "40,20,300,180"',
42
+ 'With a PNG picture: the exact color and alpha at pixel points x,y (whole numbers inside the picture), given as "40,20;300,180", "40,20 300,180", a repeated --at, or a flat "40,20,300,180"',
37
43
  },
38
44
  ],
39
45
  examples: [
@@ -45,6 +51,10 @@ export const doc = {
45
51
  label: 'A question',
46
52
  cli: 'astryx experimental theme editor how "bold white text in the header"',
47
53
  },
54
+ {
55
+ label: 'A question, with commands for one theme',
56
+ cli: 'astryx experimental theme editor how "remove shadows from cards" --theme brand',
57
+ },
48
58
  {
49
59
  label: 'A setting',
50
60
  cli: 'astryx experimental theme editor how --color-accent',
@@ -84,9 +94,8 @@ export const doc = {
84
94
  },
85
95
  {
86
96
  code: 1,
87
- when: 'an unknown option, an unknown --list kind, --at without a picture, a missing or unreadable PNG file, or an odd count of numbers in --at',
97
+ when: 'an unknown option, an unknown or empty theme, --theme given twice, an unknown --list kind, --list given twice, --at without a picture, a picture that is not a PNG or is damaged or too big, an --at point that is not whole pixel numbers or falls outside the picture, a count beside --at, or a count that is not a positive whole number, or a missing picture',
88
98
  },
89
99
  ],
90
100
  related: ['experimental theme editor', 'experimental theme targets'],
91
- replaces: ['theme targets'],
92
101
  };
@@ -162,5 +162,4 @@ export const doc = {
162
162
  },
163
163
  ],
164
164
  related: ['experimental theme editor', 'experimental theme compile'],
165
- replaces: ['theme template', 'theme eject'],
166
165
  };
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  'Step back one change, or remove one setting; the result says what applies instead',
14
14
  description:
15
- "With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, and the result says what applies now (`now`): the whole-theme setting for a part setting removed, or the base theme's value; the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking (default weight). Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files are deleted. Removing vibrancy makes the colors again at the default, 50. A setting the theme does not have is refused and the error lists the settings it has for that thing. Experimental: it may change or be removed in a patch release.",
15
+ "With only the theme, it steps back one change: the settings file, the theme source and the build go back to how they were before the last change, and the preview is rewritten; the result names what was undone and how many earlier steps are left. When the settings file is damaged (not valid JSON), the step back restores the settings from before the last change without reading it. With a thing, it removes that one setting wherever it is in the settings, and the result says what applies now (`now`): the whole-theme setting for a part setting removed, or the base theme's value; the theme is rebuilt and previewed. Name the setting the way it was set: the same thing and the same --on, --when, --state, --mode and --only (`show` lists every setting that way). For the headings dial, name which half: weight or tracking (default weight). Removing a color (accent, neutral, success, warning, danger, info) stops generating it, and the tokens it fed go back to the base theme; with no color left, the generated color files the editor wrote are deleted; a palette.config.json you made, or one that holds a color of your own, stays. Removing vibrancy makes the colors again at the default, 50; removing the last color removes vibrancy too, as it needs a color. A setting the theme does not have is refused and the error lists the settings it has for that thing. The history keeps the last 80 steps (in <theme>.history.json); older steps are dropped. Experimental: it may change or be removed in a patch release.",
16
16
  fn: 'themeEditUndo',
17
17
  args: [
18
18
  {
@@ -12,13 +12,14 @@ export const doc = {
12
12
  summary:
13
13
  'Add pages to the theme preview in the app: the default pages, the best template pages for a description, or one template',
14
14
  description:
15
- "Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (--top of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with --template, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; --template names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in --path; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no --path, it refuses and names both ways on: --path, or `experimental theme preview app <dir>`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result names it and the command that installs what it needs. A file the preview did not write is never replaced. The pages wear --theme (default: the only theme under themes/; with none or several, the app's own theme). Experimental: it may change or be removed in a patch release.",
15
+ "Writes the theme preview into the app: one route, a normal page of the app that keeps its layout, global CSS and providers, in an app shell with a side nav item per preview page and a top bar with the theme name and, when it wears a theme made by `editor`, a light, dark and system switch. A description (\"a sales dashboard\") asks the same page ranking `build` uses for the template pages that fit it best (--top of them, default 1), and adds each as a page, saying in `matched` what it picked and why (the words of the description it covers). App frames (the Shell templates) are left out, since the preview is an app shell already. When no page is exactly the one described, the closest is added and `matched` says the rest of the description is not on it; only a description no page relates to is refused, writing nothing and naming the closest pages to add with --template, with the other options repeated. A page the app cannot show (a missing package, or StyleX without a compiler) is skipped and the next match is taken (from the ranking, then the template search), and the result says so. A page's nav label is its template's display name, however it was added; --template names one page template instead; with neither, it adds the default pages: Overview (the theme at a glance, built to show what themes most often break: long and short text, every text level on every surface, every button variant and size with disabled and loading, inputs in their states, selected navigation, status colors, a table, open layers), Components (every component grouped, each with the command that changes it most) and, when the theme sets a color, Colors (each color's shades in light and dark, with the shade number, the hex and the tokens that use each; it reads the theme's generated colors, so it changes with every `editor set`). The route goes in theme-preview/ in the app's routes folder (app/ or src/app/), or in --path; the first add records the pages and the files it wrote in theme-preview.json beside the route, so later calls find it. With no routes folder and no --path, it refuses and names both ways on: --path, or `experimental theme preview app <dir>`, which makes a new starter app with the preview in it. The route fills the whole window with the theme, shell and edges included. Every check (the theme, the template, the ranking and every file it writes) runs before the first write, so a refusal changes nothing. A template page that imports a package the app lacks, or that uses StyleX in an app with no StyleX compiler, is not added: the result names it and the command that installs what it needs. A file the preview did not write is never replaced. The pages wear --theme (default: the only theme under themes/; with none or several, the app's own theme). The pages go in _pages/ beside the route, a folder Next never serves as a route; a preview an older release wrote into pages/ is moved there. theme-preview.json records a hash of each file the preview writes: a file changed by hand since is never replaced (the refusal names it), and a page file that already holds exactly the planned text is taken over. The files are staged and renamed into place together; when a write fails, every file is put back as it was. A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. The folder is refused when it is a file, in themes/ or node_modules/, in a Pages Router folder (pages/ or src/pages/), in a folder Next does not route (_private, @slot, [param]), or written with Windows separators, a leading ~ or white space at either end. With no --path and no preview in the default place, a preview recorded for a theme is used; with several, the refusal names each. A theme the preview wore that is gone is replaced by the app's own theme, with a note; a changed theme writes the default pages again. A template page whose package the app's package.json names but nobody installed is skipped like a missing one. Only the first 40 different words of a long description go to the ranking, with a note. The description may be several words without quotes. The project root, src/ and the routes folder itself are refused too: they hold the app. An older preview found there is named, with the remove that clears it. A recorded page whose file is gone is written again (a default page, or the template its id names), or else left out of the nav, with a note. A formatter run (white space, quotes, semicolons, commas) does not count as a change by hand. Refusals never suggest deleting files: they say what to move or rename. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.",
16
16
  fn: 'themeEditPreviewAdd',
17
17
  args: [
18
18
  {
19
19
  name: 'description',
20
20
  param: 'description',
21
21
  required: false,
22
+ variadic: true,
22
23
  },
23
24
  ],
24
25
  options: [
@@ -75,7 +76,7 @@ export const doc = {
75
76
  },
76
77
  {
77
78
  code: 1,
78
- when: 'outside a project, no routes folder and no --path, a file there that the preview did not write, a path outside the project, an unknown theme or template, no template page whose packages the app has, or a bad --top',
79
+ when: 'outside a project, no routes folder and no --path, a --path that is no place for the preview, a file there that the preview did not write or that was changed by hand, a path outside the project, a damaged theme-preview.json, an unknown theme or template, an empty --template, no template page whose packages the app has, a bad --top, a failed write, or another preview command that did not finish within 30 seconds (ERR_THEME_BUSY)',
79
80
  },
80
81
  ],
81
82
  related: [
@@ -12,7 +12,7 @@ export const doc = {
12
12
  summary:
13
13
  'Make a new starter app with the theme preview inside, ready to install and run',
14
14
  description:
15
- "Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Experimental: it may change or be removed in a patch release.",
15
+ "Writes a new starter app into <dir> (Next.js app router, Core and the neutral theme, with the Astryx packages pinned to this CLI's release), with the theme preview route and its default pages (the sample app page and every component grouped) in src/app/theme-preview/. With --theme, the theme folder is copied into the app's themes/ and the pages wear it; a base theme or font package it needs is added to package.json. No install runs: it prints the install and dev commands and the page to open. <dir> must be new or empty, inside the current folder; a folder that is not empty is refused, with a free folder name to use instead. Every check runs before the first write, so a refusal changes nothing. Later pages go in with `experimental theme preview add`, run in the new app. Every open font the theme names is added to package.json, at the version this project has or a pinned range, and the route imports it; a theme with generated colors gets the Colors page too, and a one-mode theme starts the route in its mode. The app is written into a temp folder beside the folder and moved into place, so a failure leaves nothing behind. A folder holding only .git, .DS_Store or Thumbs.db counts as empty. The folder is refused when it is a file, a dangling link, inside this app's routes folder, themes/ or node_modules/, or written with Windows separators, white space at either end or a name too long. A theme whose build is missing or older than its settings is built first, with a note. The app's home page links to the preview, and its .gitignore leaves out node_modules, next-env.d.ts and *.tsbuildinfo. Inside a project with a tsconfig.json, a note says to exclude the new folder. It takes one folder; more arguments are refused. With a theme, it holds that theme's lock while it builds and copies it, so an `editor set` on the same theme waits for it. A folder given from a subfolder of the project is taken from where it was given. Experimental: it may change or be removed in a patch release.",
16
16
  fn: 'themeEditPreviewApp',
17
17
  args: [
18
18
  {
@@ -53,7 +53,7 @@ export const doc = {
53
53
  },
54
54
  {
55
55
  code: 1,
56
- when: 'no <dir>, a folder that is not empty, a folder outside the current one, or an unknown theme',
56
+ when: 'no <dir>, a folder that is not empty or is no place for an app, a folder outside the current one, an unknown theme, more than one folder, a failed write, or another command changing the theme that did not finish within 30 seconds (ERR_THEME_BUSY)',
57
57
  },
58
58
  ],
59
59
  related: ['experimental theme preview', 'experimental theme preview add'],
@@ -11,7 +11,7 @@ export const doc = {
11
11
  stability: 'experimental',
12
12
  summary: 'The pages of the theme preview in the app',
13
13
  description:
14
- 'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder for one, it says so and how to add one (the JSON list is empty). Experimental: it may change or be removed in a patch release.',
14
+ 'Lists the pages of the theme preview, in nav order, with the theme they wear and the route folder. With no preview, and with no routes folder for one, it says so and how to add one (the JSON list is empty). A damaged theme-preview.json is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is listed; with several, the refusal names each. The tip repeats --path. Experimental: it may change or be removed in a patch release.',
15
15
  fn: 'themeEditPreviewList',
16
16
  options: [
17
17
  {
@@ -41,7 +41,7 @@ export const doc = {
41
41
  },
42
42
  {
43
43
  code: 1,
44
- when: 'outside a project',
44
+ when: 'outside a project, a damaged theme-preview.json, several recorded previews and no --path, or an argument',
45
45
  },
46
46
  ],
47
47
  related: ['experimental theme preview'],
@@ -11,7 +11,7 @@ export const doc = {
11
11
  stability: 'experimental',
12
12
  summary: 'Remove one page from the theme preview, or the whole preview',
13
13
  description:
14
- 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Experimental: it may change or be removed in a patch release.',
14
+ 'Removes one page and its nav item, and rewrites the route. With no page, or for the last page, it removes the whole preview: only the files the preview wrote (theme-preview.json lists them) are deleted, and the folder only when nothing else is in it. A path in theme-preview.json that leads outside the route folder is refused before anything is deleted. Only files the preview wrote are deleted: a page file it did not write, or one changed by hand since it wrote it (by the hash theme-preview.json records), is kept and named in `kept`, with a note; files already gone are named in `missing`, and the route and Colors page written again in `rewritten`. Every check runs before the first delete: the theme the route wears is loaded first, so a theme that does not load is refused with nothing deleted, and the refusal names the whole-preview remove, which needs no theme. A theme that is gone is replaced by the theme of the app itself, with a note. A page id matches in any case. A damaged theme-preview.json (not JSON, the wrong shape, a duplicate page, a folder or an absolute path in its files) is refused with `ERR_THEME_INVALID`, naming the file. With no folder given and no preview in the default place, a preview recorded for a theme is used. It takes one page; more arguments are refused. A whole remove stops, deleting nothing, when page.tsx was changed by hand: it imports the pages. A page whose file is gone leaves the nav, with a note. Refusals never suggest deleting files. Preview commands in one project run one after another. Experimental: it may change or be removed in a patch release.',
15
15
  fn: 'themeEditPreviewRemove',
16
16
  args: [
17
17
  {
@@ -52,7 +52,7 @@ export const doc = {
52
52
  },
53
53
  {
54
54
  code: 1,
55
- when: 'there is no preview, it has no such page, theme-preview.json names a file outside the route folder, or outside a project',
55
+ when: 'there is no preview, it has no such page, theme-preview.json is damaged or names a file outside the route folder, the theme the route wears does not load (ERR_THEME_INVALID, ERR_UNKNOWN_THEME, ERR_THEME_LOAD), another preview command did not finish within 30 seconds (ERR_THEME_BUSY), the route file was changed by hand, a write failed, more than one page, or outside a project',
56
56
  },
57
57
  ],
58
58
  related: ['experimental theme preview'],
@@ -38,7 +38,7 @@ export const doc = {
38
38
  },
39
39
  {
40
40
  label: 'For a lint or an audit script',
41
- cli: 'astryx --json theme targets',
41
+ cli: 'astryx --json experimental theme targets',
42
42
  },
43
43
  ],
44
44
  outsideProject: 'same',
@@ -38,8 +38,8 @@ export const doc = {
38
38
  cli: 'astryx experimental theme editor set brand corners pill',
39
39
  },
40
40
  {
41
- label: 'Build it',
42
- cli: 'astryx experimental theme compile',
41
+ label: 'See the theme and its settings',
42
+ cli: 'astryx experimental theme editor show brand',
43
43
  },
44
44
  ],
45
45
  exitCodes: [
@@ -41,7 +41,7 @@ export const doc = {
41
41
  flag: '-o, --out <path>',
42
42
  param: 'options.out',
43
43
  description:
44
- 'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
44
+ 'Output CSS file path, relative or absolute; the .js and .d.ts are written beside it (default: <theme name>.css next to the source). A folder, or a path ending in /, writes <theme name>.css into it. A build never replaces the theme source (ERR_THEME_INVALID). At a path --out names, it replaces only its own earlier outputs: any other existing file fails with ERR_FILE_EXISTS and nothing is written. A build writes only inside the working directory, the defaults beside the source too (ERR_PATH_TRAVERSAL); --check writes nothing, so it compares outputs anywhere and refuses only a relative path that escapes the working directory. Single theme only: refused with more than one file or with --family (ERR_THEME_INVALID)',
45
45
  },
46
46
  {
47
47
  flag: '--icons-specifier <specifier>',
@@ -10,7 +10,7 @@ export const doc = {
10
10
  namespace: 'cli/commands',
11
11
  summary: 'Fork a theme as editable local source',
12
12
  description:
13
- "Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Use --package when package themes share a slug.",
13
+ "Copies a bundled or installed package theme's complete source into the local themes root, including a local descriptor. Writes are atomic. Existing files require --overwrite. Eject never writes into a folder that holds another theme or a theme the theme editor made, even with --overwrite. When the fork imports packages the app lacks, the result names them with an install command. Use --package when package themes share a slug.",
14
14
  fn: 'themeEject',
15
15
  args: [
16
16
  {name: 'slug', param: 'slug', required: true},
@@ -21,7 +21,7 @@ export const doc = {
21
21
  flag: '-f, --overwrite',
22
22
  param: 'options.overwrite',
23
23
  description:
24
- 'Replace existing files. Without it, an existing file fails with ERR_FILE_EXISTS and nothing is written',
24
+ 'Replace the existing files of an earlier fork of the same theme. Without it, an existing file fails with ERR_FILE_EXISTS and nothing is written',
25
25
  },
26
26
  {
27
27
  flag: '--package <package>',
@@ -41,7 +41,7 @@ export const doc = {
41
41
  {code: 0, when: 'all source and descriptor files are written'},
42
42
  {
43
43
  code: 1,
44
- when: 'the theme is unknown or ambiguous, a path escapes, a source file is missing, or a destination exists',
44
+ when: 'the theme is unknown or ambiguous, a path escapes, a source file is missing, a destination exists, or the folder holds another theme',
45
45
  },
46
46
  ],
47
47
  related: ['theme add', 'theme build', 'theme list'],
@@ -10,7 +10,7 @@ export const doc = {
10
10
  namespace: 'cli/commands',
11
11
  summary: 'Remove a non-default theme from the app',
12
12
  description:
13
- 'Removes one added theme from the generated module and regenerates the whole module. Choose another default with theme use before removing the current default.',
13
+ 'Removes one added theme from the generated module and regenerates the whole module. Choose another default with theme use before removing the current default. A theme whose local folder or package is gone can be removed, and theme use still works when the default is the one that is gone.',
14
14
  fn: 'themeRemove',
15
15
  args: [{name: 'slug', param: 'slug', required: true}],
16
16
  examples: [{label: 'Remove an added theme', cli: 'astryx theme remove ocean'}],
@@ -23,7 +23,7 @@ export const doc = {
23
23
  notes: [
24
24
  {
25
25
  type: 'prose',
26
- text: "In global mode: outside a project, theme remove writes nothing and stops with `ERR_THEME_INVALID`: \"No package.json found. Run this command inside an app project.\" In a project, the project's version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.",
26
+ text: 'In global mode: outside a project, theme remove writes nothing and stops with `ERR_THEME_INVALID`: "No package.json found. Run this command inside an app project." In a project, the project\'s version of Astryx runs it, whichever astryx command you start. See {@link namespace:global} and {@link generic:problems}.',
27
27
  },
28
28
  ],
29
29
  };
@@ -21,14 +21,15 @@ export const doc = {
21
21
  'consumed, naming the CLI command that prints the authoritative reference for each. Read ' +
22
22
  'it, copy what you need into your own theme file, delete it. Use `theme add <slug>` to ' +
23
23
  'use an installed built theme, extend that theme for ordinary customization, or use ' +
24
- '`theme eject <slug>` for a complete source fork. Leaves an existing file untouched unless --overwrite.',
24
+ '`theme eject <slug>` for a complete source fork. The path is a .ts file, never a folder. Leaves an existing file untouched unless --overwrite, which replaces only an earlier copy of the template or a file named like a theme source (`*.theme.ts`, `*Theme.ts`, `*.template.ts`).',
25
25
  fn: 'themeTemplate',
26
26
  args: [{name: 'path', param: 'options.targetPath', required: false}],
27
27
  options: [
28
28
  {
29
29
  flag: '-f, --overwrite',
30
30
  param: 'options.overwrite',
31
- description: 'Replace an existing file',
31
+ description:
32
+ 'Replace an existing copy of the template or theme source file. Any other file, such as package.json, or a file in a folder the theme editor made, fails with ERR_FILE_EXISTS and is left as it was',
32
33
  },
33
34
  ],
34
35
  examples: [
@@ -37,8 +38,14 @@ export const doc = {
37
38
  ],
38
39
  outsideProject: 'same',
39
40
  exitCodes: [
40
- {code: 0, when: 'success, including when an existing file was left untouched'},
41
- {code: 1, when: 'the target path escapes the project, or the file cannot be written'},
41
+ {
42
+ code: 0,
43
+ when: 'success, including when an existing file was left untouched',
44
+ },
45
+ {
46
+ code: 1,
47
+ when: 'the target path escapes the project, is blank, a folder or not a .ts file, --overwrite names a file that is not a theme template or source, or the file cannot be written',
48
+ },
42
49
  ],
43
50
  related: ['theme add', 'theme eject', 'theme list', 'theme build'],
44
51
  };
@@ -106,6 +106,32 @@ import {doc as themePaletteGenerateFn} from '../../../api/theme/themePaletteGene
106
106
  /** @type {ThemeCommandWords} */
107
107
  const THEME_WORDS = {group: 'theme', build: 'build'};
108
108
 
109
+ /**
110
+ * A theme API refusal as the group that ran it words it: under
111
+ * `experimental theme`, the commands it names are that group's own (`build`
112
+ * is `compile` there). Under `theme`, the text is unchanged.
113
+ * @param {import('../../../api/error.mjs').AstryxError} err
114
+ * @param {ThemeCommandWords} [words]
115
+ */
116
+ function themeError(err, words = THEME_WORDS) {
117
+ /** @param {string} text */
118
+ const local = text =>
119
+ words.group === THEME_WORDS.group
120
+ ? text
121
+ : text.replace(
122
+ /(?<!experimental )\btheme (add|use|remove|list|build|eject|template|targets)\b/g,
123
+ (_, sub) => `${words.group} ${sub === 'build' ? words.build : sub}`,
124
+ );
125
+ return cliError(local(err.message), {
126
+ suggestions: (err.suggestions || []).map(x => ({
127
+ ...x,
128
+ name: local(x.name),
129
+ ...(x.reason ? {reason: local(x.reason)} : {}),
130
+ })),
131
+ code: err.code,
132
+ });
133
+ }
134
+
109
135
  /**
110
136
  * Path to this CLI's real entry (clients/cli/bin/astryx.mjs), resolved from
111
137
  * this module's location (clients/cli/commands/theme.mjs → ../bin/
@@ -335,8 +361,14 @@ function themeNextSteps(run, words = THEME_WORDS) {
335
361
  * @param {import('../../../api/theme/theme.type.mjs').ThemeListEntry[]} themes
336
362
  * @param {import('../../../api/theme/theme.type.mjs').ThemeUnmigratedCopy[]} [unmigratedCopies]
337
363
  * @param {ThemeCommandWords} [words]
364
+ * @param {Array<{slug: string, path: string, reason: string}>} [skippedThemes]
338
365
  */
339
- function printThemeList(themes, unmigratedCopies = [], words = THEME_WORDS) {
366
+ function printThemeList(
367
+ themes,
368
+ unmigratedCopies = [],
369
+ words = THEME_WORDS,
370
+ skippedThemes = [],
371
+ ) {
340
372
  const run = getCliInvocation();
341
373
  const more = text(
342
374
  `More themes in packages you could add: ${run} discover theme`,
@@ -381,6 +413,18 @@ function printThemeList(themes, unmigratedCopies = [], words = THEME_WORDS) {
381
413
  text(`Migrate them: ${unmigratedCopies[0].upgradeCommand}`),
382
414
  );
383
415
  }
416
+ if (skippedThemes.length > 0) {
417
+ emit(
418
+ section(
419
+ 'Skipped local themes',
420
+ `${skippedThemes.length} broken, not listed`,
421
+ ),
422
+ records(skippedThemes, {
423
+ fields: ['slug', 'path', 'reason'],
424
+ layout: 'stacked',
425
+ }),
426
+ );
427
+ }
384
428
  }
385
429
 
386
430
  /**
@@ -428,6 +472,7 @@ function printThemeApp(result) {
428
472
  },
429
473
  ),
430
474
  );
475
+ for (const note of result.data.notes ?? []) emit(text(`[note] ${note}`));
431
476
  if (!change.firstAdd) return;
432
477
  const stem = path.basename(modulePath, path.extname(modulePath));
433
478
  emit(
@@ -459,9 +504,19 @@ function printThemeEject(result, words = THEME_WORDS) {
459
504
  'entry',
460
505
  'exportName',
461
506
  'files',
507
+ 'missingPackages',
462
508
  ],
463
509
  layout: 'stacked',
464
510
  }),
511
+ ...(data.missingPackages.length > 0
512
+ ? [
513
+ text(
514
+ data.installCommand
515
+ ? `The fork imports packages this app lacks. Install them first: ${data.installCommand}`
516
+ : `The fork imports packages this app lacks: ${data.missingPackages.join(', ')}. Install them first.`,
517
+ ),
518
+ ]
519
+ : []),
465
520
  text(
466
521
  `This is a local fork. Build it with ${getCliInvocation()} ${words.group} ${words.build} ${path.join(data.outputDir, data.entry)}.`,
467
522
  ),
@@ -620,10 +675,7 @@ function registerPaletteCommands(
620
675
  } catch (error) {
621
676
  const err =
622
677
  /** @type {import('../../../api/error.mjs').AstryxError} */ (error);
623
- return cliError(err.message, {
624
- suggestions: err.suggestions || [],
625
- code: err.code,
626
- });
678
+ return themeError(err, words);
627
679
  }
628
680
 
629
681
  // Generating a palette computes and writes candidate files; the numbers
@@ -716,6 +768,19 @@ function registerThemeCommands(theme, program, docs, words) {
716
768
  });
717
769
  }
718
770
 
771
+ // One file passed twice would build twice and report two themes.
772
+ const seenFiles = new Set();
773
+ for (const entry of entries) {
774
+ const key = fs.realpathSync(entry.filePath);
775
+ if (seenFiles.has(key)) {
776
+ return cliError(
777
+ `${entry.file} is given more than once. Select each theme file once.`,
778
+ {code: ERROR_CODES.ERR_THEME_INVALID},
779
+ );
780
+ }
781
+ seenFiles.add(key);
782
+ }
783
+
719
784
  // Family mode is a thin orchestration branch over the existing build API.
720
785
  // Its key is required exactly with --family, and options that describe one
721
786
  // standalone output or a long-running loop remain intentionally separate.
@@ -820,6 +885,8 @@ function registerThemeCommands(theme, program, docs, words) {
820
885
  /** @type {Array<{file: string, receipt: import('../../../api/theme/theme.type.mjs').ThemeBuildResponse | import('../../../api/theme/theme.type.mjs').ThemeBuildCheckResponse | null}>} */
821
886
  const results = [];
822
887
  let stale = false;
888
+ /** @type {Map<string, string>} */
889
+ const claimedOutputs = new Map();
823
890
  for (const entry of entries) {
824
891
  try {
825
892
  const buildOptions = {
@@ -827,6 +894,7 @@ function registerThemeCommands(theme, program, docs, words) {
827
894
  check: options.check,
828
895
  iconsSpecifier: options.iconsSpecifier,
829
896
  __onPrivateVarError: onPrivateVarError,
897
+ __claimedOutputs: claimedOutputs,
830
898
  };
831
899
  let result;
832
900
  if (report) {
@@ -919,7 +987,7 @@ function registerThemeCommands(theme, program, docs, words) {
919
987
  },
920
988
  });
921
989
 
922
- defineCommand(theme, docs.list, {
990
+ const listCli = defineCommand(theme, docs.list, {
923
991
  fn: themeListFn,
924
992
  action: async (/** @type {{package?: string}} */ options) => {
925
993
  const json = program.opts().json || false;
@@ -933,10 +1001,7 @@ function registerThemeCommands(theme, program, docs, words) {
933
1001
  } catch (e) {
934
1002
  const err =
935
1003
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
936
- return cliError(err.message, {
937
- suggestions: err.suggestions || [],
938
- code: err.code,
939
- });
1004
+ return themeError(err, words);
940
1005
  }
941
1006
 
942
1007
  await warnOnThemeIntegrationIssues(json);
@@ -949,7 +1014,12 @@ function registerThemeCommands(theme, program, docs, words) {
949
1014
  return answered;
950
1015
  }
951
1016
 
952
- printThemeList(result.data, result.meta?.unmigratedCopies, words);
1017
+ printThemeList(
1018
+ result.data,
1019
+ result.meta?.unmigratedCopies,
1020
+ words,
1021
+ result.meta?.skippedThemes,
1022
+ );
953
1023
  return answered;
954
1024
  },
955
1025
  });
@@ -978,10 +1048,7 @@ function registerThemeCommands(theme, program, docs, words) {
978
1048
  } catch (e) {
979
1049
  const err =
980
1050
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
981
- return cliError(err.message, {
982
- suggestions: err.suggestions || [],
983
- code: err.code,
984
- });
1051
+ return themeError(err, words);
985
1052
  }
986
1053
 
987
1054
  await warnOnThemeIntegrationIssues(json);
@@ -1005,7 +1072,7 @@ function registerThemeCommands(theme, program, docs, words) {
1005
1072
  // Reject the removed target-path argument in Commander's standard parse path.
1006
1073
  themeAddCli.allowExcessArguments(false);
1007
1074
 
1008
- defineCommand(theme, docs.remove, {
1075
+ const removeCli = defineCommand(theme, docs.remove, {
1009
1076
  fn: themeRemoveFn,
1010
1077
  action: async (/** @type {string} */ slug) => {
1011
1078
  const json = program.opts().json || false;
@@ -1016,10 +1083,7 @@ function registerThemeCommands(theme, program, docs, words) {
1016
1083
  } catch (e) {
1017
1084
  const err =
1018
1085
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1019
- return cliError(err.message, {
1020
- suggestions: err.suggestions || [],
1021
- code: err.code,
1022
- });
1086
+ return themeError(err, words);
1023
1087
  }
1024
1088
  await warnOnThemeIntegrationIssues(json);
1025
1089
  if (json) jsonOut(result);
@@ -1028,7 +1092,7 @@ function registerThemeCommands(theme, program, docs, words) {
1028
1092
  },
1029
1093
  });
1030
1094
 
1031
- defineCommand(theme, docs.use, {
1095
+ const useCli = defineCommand(theme, docs.use, {
1032
1096
  fn: themeUseFn,
1033
1097
  action: async (/** @type {string} */ slug) => {
1034
1098
  const json = program.opts().json || false;
@@ -1039,10 +1103,7 @@ function registerThemeCommands(theme, program, docs, words) {
1039
1103
  } catch (e) {
1040
1104
  const err =
1041
1105
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1042
- return cliError(err.message, {
1043
- suggestions: err.suggestions || [],
1044
- code: err.code,
1045
- });
1106
+ return themeError(err, words);
1046
1107
  }
1047
1108
  await warnOnThemeIntegrationIssues(json);
1048
1109
  if (json) jsonOut(result);
@@ -1051,7 +1112,7 @@ function registerThemeCommands(theme, program, docs, words) {
1051
1112
  },
1052
1113
  });
1053
1114
 
1054
- defineCommand(theme, docs.eject, {
1115
+ const ejectCli = defineCommand(theme, docs.eject, {
1055
1116
  fn: themeEjectFn,
1056
1117
  action: async (
1057
1118
  /** @type {string} */ slug,
@@ -1071,10 +1132,7 @@ function registerThemeCommands(theme, program, docs, words) {
1071
1132
  } catch (e) {
1072
1133
  const err =
1073
1134
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1074
- return cliError(err.message, {
1075
- suggestions: err.suggestions || [],
1076
- code: err.code,
1077
- });
1135
+ return themeError(err, words);
1078
1136
  }
1079
1137
  await warnOnThemeIntegrationIssues(json);
1080
1138
  if (json) jsonOut(result);
@@ -1083,7 +1141,7 @@ function registerThemeCommands(theme, program, docs, words) {
1083
1141
  },
1084
1142
  });
1085
1143
 
1086
- defineCommand(theme, docs.template, {
1144
+ const templateCli = defineCommand(theme, docs.template, {
1087
1145
  fn: themeTemplateFn,
1088
1146
  action: (
1089
1147
  /** @type {string | undefined} */ targetPath,
@@ -1102,10 +1160,7 @@ function registerThemeCommands(theme, program, docs, words) {
1102
1160
  } catch (e) {
1103
1161
  const err =
1104
1162
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1105
- return cliError(err.message, {
1106
- suggestions: err.suggestions || [],
1107
- code: err.code,
1108
- });
1163
+ return themeError(err, words);
1109
1164
  }
1110
1165
 
1111
1166
  // Writes a starter theme file, or declines to overwrite one.
@@ -1134,7 +1189,7 @@ function registerThemeCommands(theme, program, docs, words) {
1134
1189
  },
1135
1190
  });
1136
1191
 
1137
- defineCommand(theme, docs.targets, {
1192
+ const targetsCli = defineCommand(theme, docs.targets, {
1138
1193
  fn: themeTargetsFn,
1139
1194
  action: async (/** @type {string | undefined} */ filter) => {
1140
1195
  const json = program.opts().json || false;
@@ -1146,10 +1201,7 @@ function registerThemeCommands(theme, program, docs, words) {
1146
1201
  } catch (e) {
1147
1202
  const err =
1148
1203
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1149
- return cliError(err.message, {
1150
- suggestions: err.suggestions || [],
1151
- code: err.code,
1152
- });
1204
+ return themeError(err, words);
1153
1205
  }
1154
1206
 
1155
1207
  // A filter is a substring search with an exact-name fast path (see
@@ -1197,4 +1249,16 @@ function registerThemeCommands(theme, program, docs, words) {
1197
1249
  return answered;
1198
1250
  },
1199
1251
  });
1252
+ // A stray word is refused rather than dropped: `theme use neutral dark`
1253
+ // must not report a success that ignored "dark".
1254
+ for (const cli of [
1255
+ listCli,
1256
+ removeCli,
1257
+ useCli,
1258
+ ejectCli,
1259
+ templateCli,
1260
+ targetsCli,
1261
+ ]) {
1262
+ cli.allowExcessArguments(false);
1263
+ }
1200
1264
  }
@@ -0,0 +1 @@
1
+ [{"name":"init","term":"init [options]","description":"Initialize the design system in your project"},{"name":"component","term":"component [options] [names...]","description":"List components or print component docs"},{"name":"docs","term":"docs [options] [topic] [section]","description":"Print reference docs"},{"name":"blog","term":"blog [slug]","description":"Read the Astryx blog from the published feed"},{"name":"swizzle","term":"swizzle [options] [component]","description":"Copy component source for customization"},{"name":"gap-report","term":"gap-report [options] [component]","description":"Report a missing component or feature to the package that owns it"},{"name":"template","term":"template [options] [name] [path]","description":"List, show, or scaffold page and block templates"},{"name":"upgrade","term":"upgrade [options]","description":"Update your code after upgrading Astryx, and refresh ShadCN-copied components"},{"name":"theme","term":"theme","description":"Add, switch, build, and author themes"},{"name":"integration","term":"integration","description":"Author and verify an Astryx integration package"},{"name":"hook","term":"hook [options] [name]","description":"List hooks or print hook docs"},{"name":"discover","term":"discover [options] [query]","description":"Browse and search integrations: the ones you have and the ones you could add"},{"name":"search","term":"search [options] <query...>","description":"Search components, hooks, docs, templates, and themes in one ranked list"},{"name":"build","term":"build [options] [query]","description":"Build a page: the template to start from, or the workflow playbook (no query)"},{"name":"doctor","term":"doctor [options]","description":"Diagnose Astryx projects and integration packages"},{"name":"experimental","term":"experimental","description":"[experimental] Try features that may change in a patch release: icon sets, page rendering, checked theme editing"},{"name":"manifest","term":"manifest","description":"Print the full CLI capability manifest (use with --json)"},{"name":"help","term":"help","description":"Show all commands"}]