@astryxdesign/cli 0.7.15-canary.gf890983 → 0.7.15

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 (115) hide show
  1. package/CHANGELOG.md +353 -3
  2. package/api/doctor/_adapter.d.mts +2 -1
  3. package/api/doctor/_adapter.mjs +6 -1
  4. package/api/doctor/doctor.mjs +2 -2
  5. package/api/doctor/theme-checks.mjs +56 -21
  6. package/api/integration/add-helpers.mjs +5 -0
  7. package/api/integration/add-theme.mjs +15 -110
  8. package/api/theme/_adapter.d.mts +37 -5
  9. package/api/theme/_adapter.mjs +363 -50
  10. package/api/theme/_fork.d.mts +90 -0
  11. package/api/theme/_fork.mjs +246 -0
  12. package/api/theme/build/build.d.mts +25 -1
  13. package/api/theme/build/build.mjs +352 -41
  14. package/api/theme/eject/eject.mjs +36 -15
  15. package/api/theme/list/list.mjs +3 -6
  16. package/api/theme/palette/generate/generator.d.mts +13 -0
  17. package/api/theme/palette/generate/generator.mjs +32 -2
  18. package/api/theme/targets/targets.mjs +10 -3
  19. package/api/theme/template/template.mjs +48 -2
  20. package/api/theme/theme.type.d.mts +8 -0
  21. package/api/theme/theme.type.mjs +5 -1
  22. package/api/theme/themeBuild.doc.mjs +2 -2
  23. package/api/theme/themeRemove.doc.mjs +5 -2
  24. package/api/theme/themeTemplate.doc.mjs +2 -2
  25. package/api/theme/themeUse.doc.mjs +8 -2
  26. package/api/theme-edit/_adapter.mjs +157 -36
  27. package/api/theme-edit/_catalog.d.mts +1 -6
  28. package/api/theme-edit/_catalog.mjs +5 -268
  29. package/api/theme-edit/_check.d.mts +3 -1
  30. package/api/theme-edit/_check.mjs +733 -308
  31. package/api/theme-edit/_color.d.mts +19 -0
  32. package/api/theme-edit/_color.mjs +277 -33
  33. package/api/theme-edit/_compiler.d.mts +1 -0
  34. package/api/theme-edit/_compiler.mjs +25 -0
  35. package/api/theme-edit/_context.d.mts +2 -0
  36. package/api/theme-edit/_context.mjs +83 -9
  37. package/api/theme-edit/_css.d.mts +84 -0
  38. package/api/theme-edit/_css.mjs +700 -0
  39. package/api/theme-edit/_edit.mjs +370 -85
  40. package/api/theme-edit/_how-commands.d.mts +5 -0
  41. package/api/theme-edit/_how-commands.mjs +20 -13
  42. package/api/theme-edit/_how-question.d.mts +29 -0
  43. package/api/theme-edit/_how-question.mjs +1573 -182
  44. package/api/theme-edit/_how.mjs +306 -22
  45. package/api/theme-edit/_overview.mjs +2 -7
  46. package/api/theme-edit/_palette.d.mts +27 -5
  47. package/api/theme-edit/_palette.mjs +231 -97
  48. package/api/theme-edit/_parts.d.mts +42 -10
  49. package/api/theme-edit/_parts.mjs +224 -69
  50. package/api/theme-edit/_preview-app.d.mts +8 -0
  51. package/api/theme-edit/_preview-app.mjs +549 -96
  52. package/api/theme-edit/_preview.d.mts +7 -16
  53. package/api/theme-edit/_preview.mjs +77 -84
  54. package/api/theme-edit/_project.d.mts +20 -1
  55. package/api/theme-edit/_project.mjs +43 -13
  56. package/api/theme-edit/_settings.d.mts +96 -20
  57. package/api/theme-edit/_settings.mjs +646 -141
  58. package/api/theme-edit/_tables.d.mts +18 -12
  59. package/api/theme-edit/_tables.mjs +144 -147
  60. package/api/theme-edit/theme-edit.type.d.mts +10 -1
  61. package/api/theme-edit/theme-edit.type.mjs +3 -1
  62. package/api/theme-edit/themeEditNew.doc.mjs +1 -1
  63. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +1 -1
  64. package/api/theme-edit/themeEditPreviewApp.doc.mjs +1 -1
  65. package/api/theme-edit/themeEditPreviewList.doc.mjs +2 -2
  66. package/api/theme-edit/themeEditSet.doc.mjs +1 -1
  67. package/api/theme-edit/themeEditUndo.doc.mjs +1 -1
  68. package/assets/docs/tree/publishing.doc.mjs +1 -0
  69. package/assets/docs.generated.json +2 -2
  70. package/assets/self-audit.generated.json +1 -1
  71. package/clients/cli/build-id.generated.json +1 -1
  72. package/clients/cli/commands/experimental/index.mjs +10 -10
  73. package/clients/cli/commands/experimental/theme.mjs +22 -3
  74. package/clients/cli/commands/experimental-theme-compile.doc.mjs +2 -2
  75. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +3 -3
  76. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +1 -1
  77. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +1 -1
  78. package/clients/cli/commands/integration.mjs +8 -0
  79. package/clients/cli/commands/theme-build.doc.mjs +2 -2
  80. package/clients/cli/commands/theme-list.doc.mjs +1 -1
  81. package/clients/cli/commands/theme-template.doc.mjs +1 -1
  82. package/clients/cli/commands/theme.mjs +325 -48
  83. package/clients/cli/index.mjs +18 -3
  84. package/clients/cli/lib/cli-error.mjs +118 -3
  85. package/clients/cli/manifest.generated.json +1 -1
  86. package/foundation/config/project.mjs +34 -8
  87. package/foundation/config/theme-state.d.mts +16 -0
  88. package/foundation/config/theme-state.mjs +84 -13
  89. package/foundation/discovery/template-needs.d.mts +13 -0
  90. package/foundation/discovery/template-needs.mjs +30 -15
  91. package/foundation/discovery/theme-discovery.mjs +14 -2
  92. package/foundation/discovery/theme-imports.d.mts +16 -0
  93. package/foundation/discovery/theme-imports.mjs +30 -2
  94. package/foundation/doc-compiler/import.mjs +10 -4
  95. package/foundation/fs/gather-cache.mjs +82 -23
  96. package/foundation/fs/jiti-cache.d.mts +21 -0
  97. package/foundation/fs/jiti-cache.mjs +66 -0
  98. package/foundation/fs/module-loader.mjs +7 -2
  99. package/foundation/integrations/autolink.d.mts +1 -24
  100. package/foundation/integrations/autolink.mjs +7 -60
  101. package/foundation/integrations/declared-dependencies.d.mts +27 -0
  102. package/foundation/integrations/declared-dependencies.mjs +73 -0
  103. package/foundation/integrations/may-have-integrations.d.mts +8 -0
  104. package/foundation/integrations/may-have-integrations.mjs +47 -0
  105. package/foundation/release/cache.d.mts +21 -2
  106. package/foundation/release/cache.mjs +48 -8
  107. package/foundation/release/folder-lock.d.mts +7 -0
  108. package/foundation/release/folder-lock.mjs +60 -26
  109. package/foundation/release/lock-lease.d.mts +2 -1
  110. package/foundation/release/lock-lease.mjs +7 -2
  111. package/foundation/response/error-codes.doc.mjs +1 -1
  112. package/foundation/response/response-types.doc.mjs +4 -4
  113. package/package.json +6 -6
  114. package/api/theme-edit/_css-properties.d.mts +0 -10
  115. package/api/theme-edit/_css-properties.mjs +0 -556
@@ -5,6 +5,7 @@
5
5
  * its atomic source-copy transaction to the app-theme adapter.
6
6
  */
7
7
 
8
+ import * as path from 'node:path';
8
9
  import {AstryxError} from '../../error.mjs';
9
10
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
10
11
  import {
@@ -12,6 +13,7 @@ import {
12
13
  findTheme,
13
14
  forkNeeds,
14
15
  listAvailableThemes,
16
+ themeCommandsFor,
15
17
  } from '../_adapter.mjs';
16
18
 
17
19
  /**
@@ -34,31 +36,31 @@ export async function themeEject(slug, options = {}) {
34
36
  cwd,
35
37
  package: packageName,
36
38
  includeLocal: false,
39
+ command: 'theme eject',
37
40
  });
38
41
  if (!match) {
39
42
  const available = await listAvailableThemes(cwd, {includeLocal: false});
40
43
  throw new AstryxError(
41
44
  `Unknown theme "${slug}"${packageName ? ` in package "${packageName}"` : ''}`,
42
- available.map(theme => ({
43
- name: `${theme.slug} --package ${theme.package}`,
44
- reason: theme.bundled
45
- ? 'bundled theme'
46
- : `provided by ${theme.package}`,
47
- })),
45
+ themeCommandsFor('theme eject', slug, available, cwd).map(
46
+ ({theme, name}) => ({
47
+ name,
48
+ reason: theme.bundled
49
+ ? 'bundled theme'
50
+ : `provided by ${theme.package}`,
51
+ }),
52
+ ),
48
53
  ERROR_CODES.ERR_UNKNOWN_THEME,
49
54
  );
50
55
  }
51
56
 
52
- const outputDir = ejectThemeFiles(match, {
57
+ const {outputDir, files} = ejectThemeFiles(match, {
53
58
  cwd,
54
59
  targetPath,
55
60
  overwrite,
61
+ takenSlugs: await availableSlugs(cwd),
56
62
  });
57
- const {missingPackages, installCommand} = forkNeeds(
58
- outputDir,
59
- match.files,
60
- cwd,
61
- );
63
+ const {missingPackages, installCommand} = forkNeeds(outputDir, files, cwd);
62
64
  return {
63
65
  type: 'theme.eject',
64
66
  data: {
@@ -67,11 +69,30 @@ export async function themeEject(slug, options = {}) {
67
69
  maintained: match.maintained,
68
70
  package: match.package,
69
71
  outputDir,
70
- entry: match.entry,
71
- exportName: match.exportName,
72
- files: match.files,
72
+ // A fork named after a new folder names its entry and export after it.
73
+ ...(files[0] === match.files[0]
74
+ ? {entry: match.entry, exportName: match.exportName}
75
+ : {
76
+ entry: files[0],
77
+ exportName: path.basename(files[0]).replace(/\.[^.]+$/, ''),
78
+ }),
79
+ files,
73
80
  missingPackages,
74
81
  installCommand,
75
82
  },
76
83
  };
77
84
  }
85
+
86
+ /**
87
+ * The slugs of the themes the project can use, which a fork's new folder name
88
+ * may not take. A project whose themes cannot be listed names none.
89
+ * @param {string} cwd
90
+ * @returns {Promise<Set<string>>}
91
+ */
92
+ async function availableSlugs(cwd) {
93
+ try {
94
+ return new Set((await listAvailableThemes(cwd)).map(theme => theme.slug));
95
+ } catch {
96
+ return new Set();
97
+ }
98
+ }
@@ -16,6 +16,7 @@ import {
16
16
  listThemes,
17
17
  listUnmigratedThemeCopies,
18
18
  readThemeListState,
19
+ themeInPackage,
19
20
  themeRecordOwner,
20
21
  } from '../_adapter.mjs';
21
22
 
@@ -52,9 +53,7 @@ export async function themeListCopySources(options = {}) {
52
53
  return {
53
54
  type: 'theme.list',
54
55
  data: themes
55
- .filter(
56
- theme => options.package == null || theme.package === options.package,
57
- )
56
+ .filter(theme => themeInPackage(theme, options.package))
58
57
  .map(theme => ({
59
58
  slug: theme.slug,
60
59
  displayName: theme.displayName,
@@ -75,9 +74,7 @@ export async function themeListAvailable(options = {}) {
75
74
  const state = readThemeListState(cwd);
76
75
  const {themes, skipped} = await listAvailableThemeState(cwd);
77
76
  const data = themes
78
- .filter(
79
- theme => options.package == null || theme.package === options.package,
80
- )
77
+ .filter(theme => themeInPackage(theme, options.package))
81
78
  .map(theme => {
82
79
  const added = state.themes[theme.slug] === themeRecordOwner(theme);
83
80
  return {
@@ -5,6 +5,12 @@
5
5
  export function validateStops(stops: readonly number[]): number[];
6
6
  /** @param {unknown} input @returns {number[]} */
7
7
  export function parseStopList(input: unknown): number[];
8
+ /**
9
+ * The modes a mode strategy generates.
10
+ * @param {string} strategy
11
+ * @returns {PaletteMode[]}
12
+ */
13
+ export function modesForStrategy(strategy: string): PaletteMode[];
8
14
  /** @param {string} colorA @param {string} colorB */
9
15
  export function perceptualDelta(colorA: string, colorB: string): number;
10
16
  /** @param {TonalPaletteGenerationInput} input @returns {NormalizedRequest} */
@@ -44,6 +50,13 @@ export const PALETTE_BLACK: "#000000";
44
50
  export const PALETTE_WHITE: "#ffffff";
45
51
  export const DEFAULT_21_STOPS: readonly number[];
46
52
  export const COMPACT_11_STOPS: readonly number[];
53
+ /**
54
+ * The fields the generator reads from a request, a family and an anchor
55
+ * (see TonalPaletteGenerationInput); any other field changes nothing.
56
+ */
57
+ export const GENERATION_INPUT_KEYS: readonly string[];
58
+ export const FAMILY_INPUT_KEYS: readonly string[];
59
+ export const ANCHOR_INPUT_KEYS: readonly string[];
47
60
  export type TonalPaletteAnchor = import("../../theme.type.mjs").TonalPaletteAnchor;
48
61
  export type TonalPaletteGenerationInput = import("../../theme.type.mjs").TonalPaletteGenerationInput;
49
62
  export type TonalPaletteRampDiagnostics = import("../../theme.type.mjs").TonalPaletteRampDiagnostics;
@@ -103,8 +103,38 @@ export function parseStopList(input) {
103
103
  return validateStops(values.map(Number));
104
104
  }
105
105
 
106
- /** @param {string} strategy @returns {PaletteMode[]} */
107
- function modesForStrategy(strategy) {
106
+ /**
107
+ * The fields the generator reads from a request, a family and an anchor
108
+ * (see TonalPaletteGenerationInput); any other field changes nothing.
109
+ */
110
+ export const GENERATION_INPUT_KEYS = Object.freeze([
111
+ 'vibrancy',
112
+ 'neutralProfile',
113
+ 'modeStrategy',
114
+ 'stops',
115
+ 'families',
116
+ ]);
117
+ export const FAMILY_INPUT_KEYS = Object.freeze([
118
+ 'id',
119
+ 'name',
120
+ 'seed',
121
+ 'kind',
122
+ 'anchors',
123
+ ]);
124
+ export const ANCHOR_INPUT_KEYS = Object.freeze([
125
+ 'mode',
126
+ 'stop',
127
+ 'color',
128
+ 'policy',
129
+ 'maxDeltaE',
130
+ ]);
131
+
132
+ /**
133
+ * The modes a mode strategy generates.
134
+ * @param {string} strategy
135
+ * @returns {PaletteMode[]}
136
+ */
137
+ export function modesForStrategy(strategy) {
108
138
  if (strategy === 'light-only') return ['light'];
109
139
  if (strategy === 'dark-only') return ['dark'];
110
140
  if (strategy === 'light-and-dark') return ['light', 'dark'];
@@ -15,6 +15,7 @@ import * as path from 'node:path';
15
15
  import {requireThemeCoreDir} from '../_adapter.mjs';
16
16
  import {collectThemingTargets} from '../../../foundation/discovery/theming-targets.mjs';
17
17
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
18
+ import {formatCliCommand} from '../../../foundation/env/package-manager.mjs';
18
19
  import {AstryxError, coreDirOrThrow} from '../../error.mjs';
19
20
 
20
21
  /**
@@ -74,10 +75,16 @@ export async function themeTargets(filter, {cwd = process.cwd()} = {}) {
74
75
  .filter(name => name.toLowerCase().startsWith(needle.slice(0, 3)))
75
76
  .sort()
76
77
  .slice(0, 5)
77
- .map(name => ({name, reason: 'has theming targets'}));
78
+ .map(name => ({
79
+ name: formatCliCommand(`theme targets ${name}`, cwd),
80
+ reason: 'has theming targets',
81
+ }));
82
+ const listAll = formatCliCommand('theme targets', cwd);
78
83
  throw new AstryxError(
79
- `No theming target matches "${filter}". Run \`theme targets\` with no filter for the whole list.`,
80
- near.length > 0 ? near : undefined,
84
+ `No theming target matches "${filter}". Run \`${listAll}\` with no filter for the whole list.`,
85
+ near.length > 0
86
+ ? near
87
+ : [{name: listAll, reason: 'every theming target'}],
81
88
  ERROR_CODES.ERR_UNKNOWN_COMPONENT,
82
89
  );
83
90
  }
@@ -105,7 +105,19 @@ export function themeTemplate(options = {}) {
105
105
  resolved = assertWithin(targetPath, cwd, {label: 'theme template path'});
106
106
  } catch (err) {
107
107
  if (err instanceof PathSafetyError) {
108
- throw new AstryxError(err.message, undefined, ERROR_CODES.ERR_PATH_TRAVERSAL);
108
+ throw new AstryxError(
109
+ err.message,
110
+ [
111
+ {
112
+ name: formatCliCommand(
113
+ `theme template ${THEME_TEMPLATE_DEFAULT_PATH}`,
114
+ cwd,
115
+ ),
116
+ reason: 'write the template in this project',
117
+ },
118
+ ],
119
+ ERROR_CODES.ERR_PATH_TRAVERSAL,
120
+ );
109
121
  }
110
122
  throw err;
111
123
  }
@@ -182,7 +194,21 @@ export function themeTemplate(options = {}) {
182
194
  }
183
195
 
184
196
  if (fs.existsSync(resolved) && !overwrite) {
185
- return {type: 'theme.template', data: {path: relative, written: false, reason: 'exists'}};
197
+ // Whether --overwrite would replace this file, and if not, a path that
198
+ // takes the template, so the hint never names a command that refuses.
199
+ const overwritable =
200
+ !editorThemeRecord(path.dirname(resolved)) &&
201
+ isReplaceableThemeFile(resolved);
202
+ return {
203
+ type: 'theme.template',
204
+ data: {
205
+ path: relative,
206
+ written: false,
207
+ reason: 'exists',
208
+ overwritable,
209
+ alternative: overwritable ? null : freeTemplatePath(resolved, cwd),
210
+ },
211
+ };
186
212
  }
187
213
 
188
214
  // Our repo header has no business in someone else's source tree.
@@ -208,3 +234,23 @@ function isDirectory(file) {
208
234
  return false;
209
235
  }
210
236
  }
237
+
238
+ /**
239
+ * A path near `file` that holds no file yet, for the template: the default
240
+ * name in its folder, then numbered names.
241
+ * @param {string} file
242
+ * @param {string} cwd
243
+ * @returns {string} relative to cwd, with `/`
244
+ */
245
+ function freeTemplatePath(file, cwd) {
246
+ const dir = path.dirname(file);
247
+ for (let n = 1; n < 100; n += 1) {
248
+ const name =
249
+ n === 1 ? THEME_TEMPLATE_DEFAULT_PATH : `theme.template-${n}.ts`;
250
+ const candidate = path.join(dir, name);
251
+ if (!fs.existsSync(candidate)) {
252
+ return path.relative(cwd, candidate).split(path.sep).join('/');
253
+ }
254
+ }
255
+ return THEME_TEMPLATE_DEFAULT_PATH;
256
+ }
@@ -193,10 +193,18 @@ export type ThemeEjectResponse = {
193
193
  */
194
194
  export type ThemeTemplateResponse = {
195
195
  type: "theme.template";
196
+ /**
197
+ * When the file was left as is, `overwritable` says whether `--overwrite`
198
+ * would replace it (a copy of the template or a theme source, outside a
199
+ * theme the editor made), and `alternative` is a free path for the template
200
+ * when it would not.
201
+ */
196
202
  data: {
197
203
  path: string;
198
204
  written: boolean;
199
205
  reason: "exists" | null;
206
+ overwritable?: boolean;
207
+ alternative?: string | null;
200
208
  };
201
209
  };
202
210
  /**
@@ -124,7 +124,11 @@
124
124
  * re-run, and an edited template is the consumer's file to keep.
125
125
  * @typedef {object} ThemeTemplateResponse
126
126
  * @property {'theme.template'} type
127
- * @property {{path: string, written: boolean, reason: 'exists' | null}} data
127
+ * @property {{path: string, written: boolean, reason: 'exists' | null, overwritable?: boolean, alternative?: string | null}} data
128
+ * When the file was left as is, `overwritable` says whether `--overwrite`
129
+ * would replace it (a copy of the template or a theme source, outside a
130
+ * theme the editor made), and `alternative` is a free path for the template
131
+ * when it would not.
128
132
  */
129
133
 
130
134
  /**
@@ -58,7 +58,7 @@ export const doc = {
58
58
  name: 'options.out',
59
59
  type: 'string',
60
60
  description:
61
- 'Override the output CSS path, relative or absolute; a build refuses a path outside cwd, and check mode refuses only a relative path that escapes cwd. The .js, .d.ts and any .variants.d.ts are written in the same directory, named after the theme (<name>.js), not after the CSS file. An existing folder, or a path that ends in a separator, names the folder: the CSS is written there as <name>.css.',
61
+ 'Override the output CSS path, relative or absolute; a build refuses a path outside cwd, and check mode refuses only a relative path that escapes cwd. The .js, .d.ts and any .variants.d.ts are written in the same directory, named after the theme (<name>.js), not after the CSS file. An existing folder, or a path that ends in a separator, names the folder: the CSS is written there as <name>.css. A file path should end in .css; another name still builds, with a warning, and the import line it prints names the file as written.',
62
62
  },
63
63
  {
64
64
  name: 'options.check',
@@ -104,7 +104,7 @@ export const doc = {
104
104
  },
105
105
  {
106
106
  code: 'ERR_THEME_INVALID',
107
- when: 'the resolved theme is invalid, for example it has no name, a custom Heading type has no standalone rule with a declaration the compiler can emit, or its icon registry cannot be preserved through an import (also rejected in check mode); or an output would replace the theme source, two outputs share one path, or the file is itself an output of a build, whatever its extension (refused before loading, naming the source it was built from)',
107
+ when: 'the resolved theme is invalid, for example it has no name, a custom Heading type has no standalone rule with a declaration the compiler can emit, or its icon registry cannot be preserved through an import (also rejected in check mode); or an output would replace the theme source, two outputs share one path, or the file is itself an output of a build, whatever its extension (refused before loading, naming the source it was built from); in a batch, two themes that build the same outputs are refused before either writes',
108
108
  },
109
109
  {
110
110
  code: 'ERR_FILE_EXISTS',
@@ -37,10 +37,13 @@ export const doc = {
37
37
  },
38
38
  ],
39
39
  throws: [
40
- {code: 'ERR_UNKNOWN_THEME', when: 'the theme is not added'},
40
+ {
41
+ code: 'ERR_UNKNOWN_THEME',
42
+ when: 'the theme is not added; the suggestion is `theme add <slug>` when a theme with that slug is available, else `theme list`',
43
+ },
41
44
  {
42
45
  code: 'ERR_THEME_INVALID',
43
- when: 'the theme is the default or generated state is invalid',
46
+ when: 'the theme is the default (the suggestions name `theme use` with up to three other added themes, or `theme list` when it is the only one), generated state is invalid, or the slug is not added and names a local theme folder that is broken',
44
47
  },
45
48
  {code: 'ERR_WRITE_FAILED', when: 'the generated module cannot be written'},
46
49
  ],
@@ -51,14 +51,14 @@ export const doc = {
51
51
  {
52
52
  type: 'theme.template',
53
53
  description:
54
- 'Receipt: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success, not a failure.',
54
+ 'Receipt: the path (relative to cwd), whether it was written, and the reason it was not. `exists` when a file was already there, which is a success, not a failure; then `overwritable` says whether overwrite would replace that file, and `alternative` is a free path for the template when it would not.',
55
55
  },
56
56
  ],
57
57
  throws: [
58
58
  {code: 'ERR_PATH_TRAVERSAL', when: 'the target path escapes cwd'},
59
59
  {
60
60
  code: 'ERR_INVALID_ARGUMENT',
61
- when: 'the target path is blank, names a folder, or is not a .ts file',
61
+ when: 'the target path is blank, names a folder, or is not a .ts file (with or without overwrite)',
62
62
  },
63
63
  {
64
64
  code: 'ERR_FILE_EXISTS',
@@ -37,8 +37,14 @@ export const doc = {
37
37
  },
38
38
  ],
39
39
  throws: [
40
- {code: 'ERR_UNKNOWN_THEME', when: 'the theme is not added'},
41
- {code: 'ERR_THEME_INVALID', when: 'generated state is invalid'},
40
+ {
41
+ code: 'ERR_UNKNOWN_THEME',
42
+ when: 'the theme is not added; the suggestion is `theme add <slug>` when a theme with that slug is available, else `theme list`',
43
+ },
44
+ {
45
+ code: 'ERR_THEME_INVALID',
46
+ when: 'generated state is invalid, or the slug is not added and names a local theme folder that is broken',
47
+ },
42
48
  {code: 'ERR_WRITE_FAILED', when: 'the generated module cannot be written'},
43
49
  ],
44
50
  examples: [{label: 'Choose the default', code: "await themeUse('ocean');"}],