@astryxdesign/cli 0.6.5-canary.24fe2cd → 0.6.5-canary.2ad3b83

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 (156) hide show
  1. package/README.md +13 -14
  2. package/api/build/_adapter.d.mts +2 -36
  3. package/api/build/_adapter.mjs +10 -41
  4. package/api/build/build.doc.mjs +2 -2
  5. package/api/build/build.test.mjs +2 -38
  6. package/api/build/kit/kit.mjs +21 -65
  7. package/api/build/kit/rank.d.mts +8 -24
  8. package/api/build/kit/rank.mjs +97 -277
  9. package/api/build/kit/rank.test.mjs +48 -231
  10. package/api/error.d.mts +0 -22
  11. package/api/error.mjs +0 -42
  12. package/api/integration/add-contribution.d.mts +1 -2
  13. package/api/integration/add-contribution.mjs +3 -7
  14. package/api/integration/add-contribution.test.mjs +3 -3
  15. package/api/integration/add-theme.mjs +22 -243
  16. package/api/integration/add-theme.test.mjs +0 -213
  17. package/api/integration/authoring-checks.mjs +7 -10
  18. package/api/integration/authoring-checks.type.d.mts +0 -8
  19. package/api/integration/authoring-checks.type.mjs +3 -7
  20. package/api/integration/integration-authoring.type.d.mts +1 -4
  21. package/api/integration/integration-authoring.type.mjs +1 -6
  22. package/api/integration/integrationAdd.doc.mjs +0 -6
  23. package/api/integration/integrationAddTheme.doc.mjs +0 -10
  24. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  25. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  26. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  27. package/api/integration/pack-check.mjs +2 -11
  28. package/api/integration/pack-check.test.mjs +1 -38
  29. package/api/integration/validate-integration.d.mts +2 -4
  30. package/api/integration/validate-integration.mjs +2 -7
  31. package/api/integration/validate-integration.test.mjs +0 -55
  32. package/api/integration/validate-integration.type.d.mts +0 -5
  33. package/api/integration/validate-integration.type.mjs +1 -5
  34. package/api/integration/validateIntegration.doc.mjs +1 -1
  35. package/api/layout/expand/expand.mjs +7 -12
  36. package/api/layout/layout.type.d.mts +0 -1
  37. package/api/layout/layout.type.mjs +0 -1
  38. package/api/layout/layoutExpand.doc.mjs +1 -1
  39. package/api/search/search.d.mts +0 -24
  40. package/api/search/search.mjs +1 -71
  41. package/api/swizzle/copy/copy.mjs +3 -66
  42. package/api/swizzle/swizzle.doc.mjs +0 -4
  43. package/api/template/copy/copy.mjs +8 -14
  44. package/api/template/show/show.mjs +4 -15
  45. package/api/template/template-integration.test.mjs +0 -14
  46. package/api/template/template.d.mts +1 -1
  47. package/api/template/template.doc.mjs +2 -6
  48. package/api/template/template.mjs +0 -1
  49. package/api/template/template.type.d.mts +0 -2
  50. package/api/template/template.type.mjs +0 -2
  51. package/api/theme/build/build.d.mts +0 -24
  52. package/api/theme/build/build.mjs +8 -235
  53. package/api/upgrade/run/run.mjs +3 -20
  54. package/api/upgrade/run/run.test.mjs +1 -45
  55. package/api/upgrade/upgrade.doc.mjs +1 -1
  56. package/api/upgrade/upgrade.type.d.mts +0 -1
  57. package/api/upgrade/upgrade.type.mjs +0 -1
  58. package/assets/docs/tree/check-your-docs.doc.mjs +2 -2
  59. package/assets/docs/tree/checks.doc.mjs +1 -1
  60. package/assets/docs/tree/sections-and-placement.doc.mjs +1 -1
  61. package/assets/docs/tree/template-doc-overview.doc.mjs +1 -13
  62. package/assets/docs/tree/troubleshooting.doc.mjs +3 -7
  63. package/assets/docs/tree/versioning.doc.mjs +6 -6
  64. package/assets/templates/pages/ai-chat/template.doc.mjs +1 -16
  65. package/assets/templates/pages/ai-chat-landing/template.doc.mjs +1 -9
  66. package/assets/templates/pages/blank/template.doc.mjs +1 -3
  67. package/assets/templates/pages/canvas-editor/template.doc.mjs +1 -9
  68. package/assets/templates/pages/centered-hero/template.doc.mjs +1 -3
  69. package/assets/templates/pages/checkout-wizard/template.doc.mjs +0 -1
  70. package/assets/templates/pages/classic-gallery/template.doc.mjs +1 -3
  71. package/assets/templates/pages/contact-form/template.doc.mjs +1 -16
  72. package/assets/templates/pages/dashboard/template.doc.mjs +1 -15
  73. package/assets/templates/pages/dashboard-alert-rail/template.doc.mjs +1 -23
  74. package/assets/templates/pages/dashboard-cohort-funnel/template.doc.mjs +1 -10
  75. package/assets/templates/pages/dashboard-comparison/template.doc.mjs +1 -9
  76. package/assets/templates/pages/dashboard-composition/template.doc.mjs +1 -10
  77. package/assets/templates/pages/dashboard-progress/template.doc.mjs +1 -17
  78. package/assets/templates/pages/dashboard-scorecard/template.doc.mjs +1 -2
  79. package/assets/templates/pages/detail-page/template.doc.mjs +0 -8
  80. package/assets/templates/pages/documentation/template.doc.mjs +1 -10
  81. package/assets/templates/pages/documentation-design/template.doc.mjs +1 -10
  82. package/assets/templates/pages/documentation-technical/template.doc.mjs +1 -10
  83. package/assets/templates/pages/editor/template.doc.mjs +1 -9
  84. package/assets/templates/pages/file-explorer/template.doc.mjs +1 -3
  85. package/assets/templates/pages/form-two-column/template.doc.mjs +1 -17
  86. package/assets/templates/pages/form-wizard/template.doc.mjs +1 -14
  87. package/assets/templates/pages/form-wizard-dialog/template.doc.mjs +0 -1
  88. package/assets/templates/pages/gallery-hero/template.doc.mjs +1 -10
  89. package/assets/templates/pages/ide/template.doc.mjs +1 -9
  90. package/assets/templates/pages/incident-console/template.doc.mjs +1 -10
  91. package/assets/templates/pages/kanban-board/template.doc.mjs +1 -11
  92. package/assets/templates/pages/library/template.doc.mjs +1 -15
  93. package/assets/templates/pages/login/template.doc.mjs +1 -10
  94. package/assets/templates/pages/login-card/template.doc.mjs +1 -11
  95. package/assets/templates/pages/login-split/template.doc.mjs +1 -10
  96. package/assets/templates/pages/login-sso/template.doc.mjs +1 -10
  97. package/assets/templates/pages/messaging-shell/template.doc.mjs +1 -11
  98. package/assets/templates/pages/mixed-gallery/template.doc.mjs +1 -10
  99. package/assets/templates/pages/payment-form/template.doc.mjs +1 -3
  100. package/assets/templates/pages/product-detail/template.doc.mjs +1 -9
  101. package/assets/templates/pages/product-gallery/template.doc.mjs +1 -10
  102. package/assets/templates/pages/settings/template.doc.mjs +1 -3
  103. package/assets/templates/pages/settings-dialog/template.doc.mjs +1 -9
  104. package/assets/templates/pages/settings-sidebar/template.doc.mjs +1 -9
  105. package/assets/templates/pages/shell-nav/template.doc.mjs +1 -10
  106. package/assets/templates/pages/shell-side-nav/template.doc.mjs +1 -14
  107. package/assets/templates/pages/shell-top-nav/template.doc.mjs +1 -11
  108. package/assets/templates/pages/side-gallery/template.doc.mjs +1 -3
  109. package/assets/templates/pages/table/template.doc.mjs +1 -11
  110. package/assets/templates/pages/table-filter/template.doc.mjs +1 -21
  111. package/assets/templates/pages/table-grouped/template.doc.mjs +1 -15
  112. package/assets/templates/pages/table-inbox/template.doc.mjs +6 -18
  113. package/assets/templates/pages/table-page/template.doc.mjs +1 -20
  114. package/assets/templates/pages/table-tree/template.doc.mjs +1 -14
  115. package/assets/templates/pages/theme-showcase/template.doc.mjs +1 -10
  116. package/assets/templates/pages/work-item-detail/template.doc.mjs +0 -10
  117. package/authoring/doctypes/template/parse.d.mts +0 -2
  118. package/authoring/doctypes/template/parse.mjs +0 -1
  119. package/authoring/doctypes/template/parse.test.mjs +0 -21
  120. package/authoring/doctypes/template/template.doc.mjs +0 -6
  121. package/authoring/doctypes/template/type.ts +0 -10
  122. package/clients/cli/commands/doctor.mjs +4 -4
  123. package/clients/cli/commands/integration-add.doc.mjs +0 -10
  124. package/clients/cli/commands/integration-authoring.test.mjs +2 -12
  125. package/clients/cli/commands/integration.mjs +1 -3
  126. package/clients/cli/commands/layout-expand.doc.mjs +1 -3
  127. package/clients/cli/commands/layout.mjs +0 -16
  128. package/clients/cli/commands/template.mjs +5 -19
  129. package/clients/cli/commands/upgrade.ascii-output.test.mjs +0 -14
  130. package/clients/cli/lib/manifest.mjs +165 -44
  131. package/clients/cli/lib/manifest.test.mjs +7 -98
  132. package/foundation/discovery/template-adapter.d.mts +0 -14
  133. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +1 -37
  134. package/foundation/discovery/template-adapter.mjs +1 -21
  135. package/foundation/doc-compiler/doc-loads.test.mjs +2 -2
  136. package/foundation/integrations/cli-requirement.d.mts +11 -23
  137. package/foundation/integrations/cli-requirement.mjs +18 -40
  138. package/foundation/integrations/cli-requirement.test.mjs +15 -66
  139. package/foundation/response/response-types.doc.d.mts +5 -5
  140. package/foundation/response/response-types.doc.mjs +13 -13
  141. package/package.json +9 -9
  142. package/api/docs/docs.test.mjs +0 -279
  143. package/api/docs/integration-tree.test.mjs +0 -572
  144. package/api/docs/integrationDocs.test.mjs +0 -336
  145. package/api/layout/expand/expand.receipt.test.mjs +0 -74
  146. package/api/search/search.test.mjs +0 -710
  147. package/api/template/copy/copy.receipt.test.mjs +0 -77
  148. package/api/template/show/show.test.mjs +0 -76
  149. package/api/theme/build/build.project-core.test.mjs +0 -165
  150. package/clients/cli/commands/docs.test.mjs +0 -383
  151. package/clients/cli/commands/layout.expand-receipt.test.mjs +0 -94
  152. package/clients/cli/commands/template.copy-receipt.test.mjs +0 -60
  153. package/clients/cli/commands/template.show-media.test.mjs +0 -62
  154. package/clients/cli/commands/write-failure.test.mjs +0 -175
  155. package/foundation/agent-docs/agent-docs.test.mjs +0 -1160
  156. package/foundation/doc-compiler/tree.test.mjs +0 -649
@@ -4,9 +4,6 @@
4
4
  * @file `astryx integration add theme` — scaffold one strongly typed,
5
5
  * same-stem source/descriptor pair into an integration package and declare the
6
6
  * themes root on first use.
7
- *
8
- * `--from <base>` forks an existing theme's source files as the starting point
9
- * instead of writing a blank `defineTheme` skeleton.
10
7
  */
11
8
 
12
9
  import * as fs from 'node:fs';
@@ -18,10 +15,7 @@ import {
18
15
  PathSafetyError,
19
16
  sanitizeName,
20
17
  } from '../../foundation/fs/path-safety.mjs';
21
- import {
22
- discoverBundledThemes,
23
- discoverThemeDirectory,
24
- } from '../../foundation/discovery/theme-discovery.mjs';
18
+ import {discoverThemeDirectory} from '../../foundation/discovery/theme-discovery.mjs';
25
19
  import {
26
20
  findLocalIntegrationManifestOrNull,
27
21
  IntegrationRootConflictError,
@@ -35,7 +29,6 @@ import {
35
29
  themesCliProblem,
36
30
  withCliPeer,
37
31
  } from '../../foundation/integrations/cli-requirement.mjs';
38
- import {stripCopyrightHeader} from '../../foundation/text/copyright-header.mjs';
39
32
  import {
40
33
  applyWrites,
41
34
  findPackageDir,
@@ -77,7 +70,6 @@ function themeIdentity(slug) {
77
70
  .join(' ');
78
71
  return {
79
72
  slug,
80
- identifier,
81
73
  displayName,
82
74
  exportName: `${identifier}Theme`,
83
75
  entry: `${identifier}Theme.ts`,
@@ -101,182 +93,6 @@ function themeDescriptor(identity) {
101
93
  });
102
94
  }
103
95
 
104
- // ── --from: resolve and fork a base theme ───────────────────────────
105
-
106
- /**
107
- * Resolve a theme slug to its discovered record, searching the bundled themes
108
- * and the package's own themes root (when it has one).
109
- * @param {string} slug
110
- * @param {string} packageDir
111
- * @param {string} owner
112
- * @param {string | undefined} themesRoot resolved absolute themes root, if any
113
- * @returns {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme}
114
- */
115
- function resolveBaseTheme(slug, packageDir, owner, themesRoot) {
116
- const normalized = slug.toLowerCase();
117
-
118
- /** @type {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme[]} */
119
- let candidates = [];
120
- try {
121
- candidates = discoverBundledThemes();
122
- } catch {
123
- // Bundled themes unavailable — not fatal, package themes may suffice.
124
- }
125
-
126
- // Also check the package's own themes root.
127
- if (themesRoot && fs.existsSync(themesRoot)) {
128
- try {
129
- candidates = [...candidates, ...discoverThemeDirectory(themesRoot, owner)];
130
- } catch {
131
- // A broken local root is not the caller's problem here.
132
- }
133
- }
134
-
135
- const match = candidates.find(t => t.slug.toLowerCase() === normalized);
136
- if (!match) {
137
- throw new AstryxError(
138
- `Unknown base theme "${slug}". Available themes: ${candidates.map(t => t.slug).join(', ') || '(none)'}.`,
139
- candidates.map(t => ({
140
- name: t.slug,
141
- reason: t.bundled ? 'bundled theme' : `provided by ${t.package}`,
142
- })),
143
- ERROR_CODES.ERR_UNKNOWN_THEME,
144
- );
145
- }
146
- return match;
147
- }
148
-
149
- /**
150
- * Rename a file from the base theme's namespace to the new theme's namespace.
151
- * Files whose name starts with the base identifier get the new identifier;
152
- * others keep their name as-is.
153
- * @param {string} file POSIX relative path inside the theme directory
154
- * @param {string} baseIdentifier
155
- * @param {string} newIdentifier
156
- * @returns {string}
157
- */
158
- function renameThemeFile(file, baseIdentifier, newIdentifier) {
159
- const basename = path.posix.basename(file);
160
- const dir = path.posix.dirname(file);
161
- if (!basename.startsWith(baseIdentifier)) return file;
162
- const renamed = newIdentifier + basename.slice(baseIdentifier.length);
163
- return dir === '.' ? renamed : `${dir}/${renamed}`;
164
- }
165
-
166
- /**
167
- * Rewrite a source file's contents from the base theme's names to the new
168
- * theme's names. This replaces:
169
- * 1. Identifier prefixes (camelCase variables, import paths): baseIdentifier
170
- * followed by an uppercase letter.
171
- * 2. The theme slug in string literals: 'baseSlug' → 'newSlug' and
172
- * 'astryx-baseSlug' → 'astryx-newSlug'.
173
- * 3. CSS custom properties scoped to the theme: --astryx-theme-baseSlug-.
174
- * @param {string} source
175
- * @param {string} baseSlug
176
- * @param {string} baseIdentifier
177
- * @param {string} newSlug
178
- * @param {string} newIdentifier
179
- * @returns {string}
180
- */
181
- function rewriteThemeSource(
182
- source,
183
- baseSlug,
184
- baseIdentifier,
185
- newSlug,
186
- newIdentifier,
187
- ) {
188
- let result = source;
189
- // 1. Identifier prefixes: neutralPalettes → oceanPalettes, neutralTheme → oceanTheme
190
- const identRe = new RegExp(`${escapeRegExp(baseIdentifier)}(?=[A-Z])`, 'gu');
191
- result = result.replace(identRe, newIdentifier);
192
- // 2. String-literal theme names
193
- result = result.replace(
194
- new RegExp(`'astryx-${escapeRegExp(baseSlug)}'`, 'gu'),
195
- `'astryx-${newSlug}'`,
196
- );
197
- result = result.replace(
198
- new RegExp(`'${escapeRegExp(baseSlug)}'`, 'gu'),
199
- `'${newSlug}'`,
200
- );
201
- // 3. CSS custom properties scoped to the base theme
202
- result = result.replace(
203
- new RegExp(
204
- `--astryx-theme-${escapeRegExp(baseSlug)}-`,
205
- 'gu',
206
- ),
207
- `--astryx-theme-${newSlug}-`,
208
- );
209
- return result;
210
- }
211
-
212
- /** @param {string} s */
213
- function escapeRegExp(s) {
214
- return s.replace(/[.*+?^${}()|[\]\\]/gu, '\\$&');
215
- }
216
-
217
- /**
218
- * Build the write plans for a forked theme.
219
- * @param {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme} base
220
- * @param {ReturnType<typeof themeIdentity>} identity new theme identity
221
- * @param {string} themeDir absolute target directory
222
- * @returns {import('./add-helpers.mjs').WritePlan[]}
223
- */
224
- function forkThemePlans(base, identity, themeDir) {
225
- const baseIdentity = themeIdentity(base.slug);
226
- /** @type {import('./add-helpers.mjs').WritePlan[]} */
227
- const plans = [];
228
-
229
- // Copy every file the base theme ships (entry first, then the rest), except
230
- // the descriptor — we write a fresh one.
231
- const filesToCopy = base.files.filter(
232
- file => path.posix.basename(file) !== `${baseIdentity.exportName}.doc.mjs`,
233
- );
234
-
235
- for (const file of filesToCopy) {
236
- const srcPath = path.join(base.sourceDir, file);
237
- const newFileName = renameThemeFile(
238
- file,
239
- baseIdentity.identifier,
240
- identity.identifier,
241
- );
242
- const destPath = assertWithin(newFileName, themeDir, {
243
- label: `forked theme file "${newFileName}"`,
244
- });
245
-
246
- // Read source bytes; for text, strip copyright and rewrite identifiers.
247
- const bytes = fs.readFileSync(srcPath);
248
- const text = bytes.toString('utf-8');
249
- const isText = Buffer.from(text, 'utf-8').equals(bytes);
250
-
251
- /** @type {string | Buffer} */
252
- let contents;
253
- if (isText) {
254
- contents = rewriteThemeSource(
255
- stripCopyrightHeader(text),
256
- base.slug,
257
- baseIdentity.identifier,
258
- identity.slug,
259
- identity.identifier,
260
- );
261
- } else {
262
- contents = bytes;
263
- }
264
- plans.push({path: destPath, contents, createOnly: true});
265
- }
266
-
267
- // Write a fresh descriptor — the fork is a new theme, not a derivative.
268
- const descriptorPath = assertWithin(identity.descriptor, themeDir, {
269
- label: 'theme descriptor file',
270
- });
271
- plans.push({
272
- path: descriptorPath,
273
- contents: themeDescriptor(identity),
274
- createOnly: true,
275
- });
276
-
277
- return plans;
278
- }
279
-
280
96
  /**
281
97
  * Read bytes back through the same discovery seam Project uses. A write is not
282
98
  * successful until the requested slug resolves.
@@ -314,7 +130,7 @@ async function verifyThemeContribution(packageDir, manifestFile, owner, slug) {
314
130
  * @returns {Promise<import('./integration-authoring.type.mjs').IntegrationAddResponse>}
315
131
  */
316
132
  export async function integrationAddTheme(name, options = {}) {
317
- const {cwd = process.cwd(), dryRun = false, from} = options;
133
+ const {cwd = process.cwd(), dryRun = false} = options;
318
134
  const packageDir = findPackageDir(cwd);
319
135
  const packageFile = path.join(packageDir, 'package.json');
320
136
  let pkg;
@@ -396,64 +212,32 @@ export async function integrationAddTheme(name, options = {}) {
396
212
  const themeDir = assertWithin(identity.slug, root, {
397
213
  label: 'theme directory',
398
214
  });
399
-
400
- // Resolve the base theme when --from is given, before writing anything.
401
- /** @type {import('../../foundation/discovery/theme-discovery.mjs').DiscoveredTheme | undefined} */
402
- let baseTheme;
403
- if (from != null) {
404
- if (from === name) {
215
+ const sourceFile = assertWithin(identity.entry, themeDir, {
216
+ label: 'theme source file',
217
+ });
218
+ const descriptorFile = assertWithin(identity.descriptor, themeDir, {
219
+ label: 'theme descriptor file',
220
+ });
221
+ // An existing folder is filled; only a file this would write is refused.
222
+ for (const file of [sourceFile, descriptorFile]) {
223
+ if (fs.existsSync(file)) {
405
224
  throw new AstryxError(
406
- `Cannot fork theme "${from}" into itself.`,
225
+ `Refusing to overwrite existing file ${projectPath(path.relative(packageDir, file))}.`,
407
226
  undefined,
408
- ERROR_CODES.ERR_INVALID_ARGUMENT,
227
+ ERROR_CODES.ERR_FILE_EXISTS,
409
228
  );
410
229
  }
411
- baseTheme = resolveBaseTheme(from, packageDir, owner, root);
412
230
  }
413
231
 
414
232
  /** @type {import('./add-helpers.mjs').WritePlan[]} */
415
- let plans;
416
-
417
- if (baseTheme) {
418
- // Fork: copy the base theme's files, renamed and rewritten.
419
- plans = forkThemePlans(baseTheme, identity, themeDir);
420
- // Check that no target file already exists.
421
- for (const plan of plans) {
422
- if (fs.existsSync(plan.path)) {
423
- throw new AstryxError(
424
- `Refusing to overwrite existing file ${projectPath(path.relative(packageDir, plan.path))}.`,
425
- undefined,
426
- ERROR_CODES.ERR_FILE_EXISTS,
427
- );
428
- }
429
- }
430
- } else {
431
- // Blank scaffold.
432
- const sourceFile = assertWithin(identity.entry, themeDir, {
433
- label: 'theme source file',
434
- });
435
- const descriptorFile = assertWithin(identity.descriptor, themeDir, {
436
- label: 'theme descriptor file',
437
- });
438
- for (const file of [sourceFile, descriptorFile]) {
439
- if (fs.existsSync(file)) {
440
- throw new AstryxError(
441
- `Refusing to overwrite existing file ${projectPath(path.relative(packageDir, file))}.`,
442
- undefined,
443
- ERROR_CODES.ERR_FILE_EXISTS,
444
- );
445
- }
446
- }
447
- plans = [
448
- {path: sourceFile, contents: themeSource(identity), createOnly: true},
449
- {
450
- path: descriptorFile,
451
- contents: themeDescriptor(identity),
452
- createOnly: true,
453
- },
454
- ];
455
- }
456
-
233
+ const plans = [
234
+ {path: sourceFile, contents: themeSource(identity), createOnly: true},
235
+ {
236
+ path: descriptorFile,
237
+ contents: themeDescriptor(identity),
238
+ createOnly: true,
239
+ },
240
+ ];
457
241
  let packageUpdate = packageJsonUpdate(
458
242
  packageFile,
459
243
  rootPath,
@@ -525,8 +309,7 @@ export async function integrationAddTheme(name, options = {}) {
525
309
  writtenFiles.push(manifestPath);
526
310
  }
527
311
 
528
- /** @type {import('./integration-authoring.type.mjs').IntegrationAddResponse} */
529
- const response = {
312
+ return {
530
313
  type: 'integration.add',
531
314
  data: {
532
315
  kind: 'theme',
@@ -538,8 +321,4 @@ export async function integrationAddTheme(name, options = {}) {
538
321
  dryRun,
539
322
  },
540
323
  };
541
- if (from != null) {
542
- response.data.from = from;
543
- }
544
- return response;
545
324
  }
@@ -310,216 +310,3 @@ describe('integrationAddTheme', () => {
310
310
  );
311
311
  });
312
312
  });
313
-
314
- describe('integrationAddTheme --from', () => {
315
- it('forks a bundled theme into the integration package', async () => {
316
- setup();
317
- const result = await integrationAddTheme('ocean', {
318
- cwd: tmpDir,
319
- from: 'neutral',
320
- });
321
-
322
- expect(result.type).toBe('integration.add');
323
- expect(result.data.kind).toBe('theme');
324
- expect(result.data.name).toBe('ocean');
325
- expect(result.data.from).toBe('neutral');
326
- expect(result.data.written).toBe(true);
327
- expect(result.data.dryRun).toBe(false);
328
- expect(result.data.root).toEqual({path: './themes', created: true});
329
-
330
- // The entry file must exist with the new export name.
331
- const entry = fs.readFileSync(
332
- path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
333
- 'utf-8',
334
- );
335
- expect(entry).toContain('oceanTheme');
336
- expect(entry).toContain("name: 'ocean'");
337
- // It must NOT contain the original theme identifier as a prefix.
338
- expect(entry).not.toMatch(/\bneutralTheme\b/);
339
- expect(entry).not.toMatch(/\bneutralPalettes\b/);
340
- expect(entry).not.toMatch(/\bneutralSyntax\b/);
341
- expect(entry).toContain('defineTheme');
342
-
343
- // A fresh descriptor, not copied from the base.
344
- const descriptor = fs.readFileSync(
345
- path.join(tmpDir, 'themes/ocean/oceanTheme.doc.mjs'),
346
- 'utf-8',
347
- );
348
- expect(descriptor).toContain("name: 'ocean'");
349
- expect(descriptor).toContain("@astryxdesign/cli/authoring').ThemeDoc");
350
- expect(descriptor).toContain('maintained: true');
351
-
352
- // The theme must validate.
353
- expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
354
- });
355
-
356
- it('renames palette and support files from the base theme', async () => {
357
- setup();
358
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
359
-
360
- const themeDir = path.join(tmpDir, 'themes/ocean');
361
- const files = fs.readdirSync(themeDir).sort();
362
- // neutralPalettes.ts → oceanPalettes.ts, etc.
363
- expect(files).toContain('oceanTheme.ts');
364
- expect(files).toContain('oceanTheme.doc.mjs');
365
- expect(files).toContain('oceanPalettes.ts');
366
- expect(files).toContain('oceanPaletteRefs.generated.ts');
367
- expect(files).toContain('icons.tsx');
368
- // Must not contain any file starting with 'neutral'.
369
- expect(files.filter(f => f.startsWith('neutral'))).toEqual([]);
370
- });
371
-
372
- it('rewrites import paths inside forked files', async () => {
373
- setup();
374
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
375
-
376
- const entry = fs.readFileSync(
377
- path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
378
- 'utf-8',
379
- );
380
- // Import references must use the new identifier.
381
- expect(entry).toContain('./oceanPaletteRefs.generated');
382
- expect(entry).not.toContain('./neutralPaletteRefs.generated');
383
- // The icon registry import must also be renamed.
384
- expect(entry).toContain('oceanIconRegistry');
385
- expect(entry).not.toContain('neutralIconRegistry');
386
- });
387
-
388
- it('rewrites CSS custom properties scoped to the base theme', async () => {
389
- setup();
390
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
391
-
392
- const entry = fs.readFileSync(
393
- path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
394
- 'utf-8',
395
- );
396
- expect(entry).toContain('--astryx-theme-ocean-');
397
- expect(entry).not.toContain('--astryx-theme-neutral-');
398
- });
399
-
400
- it('rewrites the syntax theme name', async () => {
401
- setup();
402
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
403
-
404
- const entry = fs.readFileSync(
405
- path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
406
- 'utf-8',
407
- );
408
- expect(entry).toContain("'astryx-ocean'");
409
- expect(entry).not.toContain("'astryx-neutral'");
410
- });
411
-
412
- it('strips the copyright header from forked files', async () => {
413
- setup();
414
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
415
-
416
- const entry = fs.readFileSync(
417
- path.join(tmpDir, 'themes/ocean/oceanTheme.ts'),
418
- 'utf-8',
419
- );
420
- expect(entry).not.toContain('Copyright (c) Meta Platforms');
421
- });
422
-
423
- it('includes data.from in the receipt only when --from is used', async () => {
424
- setup();
425
- const blank = await integrationAddTheme('plain', {cwd: tmpDir});
426
- expect(blank.data).not.toHaveProperty('from');
427
-
428
- const forked = await integrationAddTheme('ocean', {
429
- cwd: tmpDir,
430
- from: 'neutral',
431
- });
432
- expect(forked.data.from).toBe('neutral');
433
- });
434
-
435
- it('refuses to fork a theme into itself', async () => {
436
- setup();
437
- await expect(
438
- integrationAddTheme('neutral', {cwd: tmpDir, from: 'neutral'}),
439
- ).rejects.toMatchObject({code: 'ERR_INVALID_ARGUMENT'});
440
- });
441
-
442
- it('refuses an unknown base theme with a helpful suggestion list', async () => {
443
- setup();
444
- await expect(
445
- integrationAddTheme('ocean', {cwd: tmpDir, from: 'nonexistent'}),
446
- ).rejects.toMatchObject({
447
- code: 'ERR_UNKNOWN_THEME',
448
- message: expect.stringContaining('nonexistent'),
449
- });
450
- });
451
-
452
- it('dry-runs with --from without writing anything', async () => {
453
- setup();
454
- const result = await integrationAddTheme('ocean', {
455
- cwd: tmpDir,
456
- from: 'neutral',
457
- dryRun: true,
458
- });
459
-
460
- expect(result.data.written).toBe(false);
461
- expect(result.data.dryRun).toBe(true);
462
- expect(result.data.from).toBe('neutral');
463
- expect(result.data.files).toContain('themes/ocean/oceanTheme.ts');
464
- expect(result.data.files).toContain('themes/ocean/oceanTheme.doc.mjs');
465
- expect(fs.existsSync(path.join(tmpDir, 'themes'))).toBe(false);
466
- });
467
-
468
- it('refuses to overwrite when the target already exists', async () => {
469
- setup();
470
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
471
- await expect(
472
- integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'}),
473
- ).rejects.toMatchObject({code: 'ERR_FILE_EXISTS'});
474
- });
475
-
476
- it('works with different bundled themes', async () => {
477
- setup();
478
- const result = await integrationAddTheme('dusk', {
479
- cwd: tmpDir,
480
- from: 'gothic',
481
- });
482
-
483
- expect(result.data.from).toBe('gothic');
484
- const entry = fs.readFileSync(
485
- path.join(tmpDir, 'themes/dusk/duskTheme.ts'),
486
- 'utf-8',
487
- );
488
- expect(entry).toContain('duskTheme');
489
- expect(entry).toContain("name: 'dusk'");
490
- expect(entry).not.toMatch(/\bgothicTheme\b/);
491
- expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
492
- });
493
-
494
- it('forks from a theme the package already owns', async () => {
495
- setup();
496
- // First, add a blank theme.
497
- await integrationAddTheme('base', {cwd: tmpDir});
498
- // Then fork it.
499
- const result = await integrationAddTheme('variant', {
500
- cwd: tmpDir,
501
- from: 'base',
502
- });
503
-
504
- expect(result.data.from).toBe('base');
505
- const entry = fs.readFileSync(
506
- path.join(tmpDir, 'themes/variant/variantTheme.ts'),
507
- 'utf-8',
508
- );
509
- expect(entry).toContain('variantTheme');
510
- expect(entry).toContain("name: 'variant'");
511
- expect((await validateLocalIntegration(tmpDir)).issues).toEqual([]);
512
- });
513
-
514
- it('declares the optional CLI peer that reads typed theme descriptors', async () => {
515
- setup({includeFiles: false});
516
- await integrationAddTheme('ocean', {cwd: tmpDir, from: 'neutral'});
517
- const pkg = JSON.parse(
518
- fs.readFileSync(path.join(tmpDir, 'package.json'), 'utf-8'),
519
- );
520
- expect(pkg.peerDependencies).toEqual({'@astryxdesign/cli': '>=0.6.4'});
521
- expect(pkg.peerDependenciesMeta).toEqual({
522
- '@astryxdesign/cli': {optional: true},
523
- });
524
- });
525
- });
@@ -92,7 +92,6 @@ function addErrors(issues, errors, code) {
92
92
  export async function integrationTemplateConflicts(pkg, options = {}) {
93
93
  const {cwd = process.cwd()} = options;
94
94
  const resolved = await resolveIntegration(pkg, cwd);
95
- const validated = resolved.found;
96
95
  const name = resolved.found ? (resolved.name ?? null) : null;
97
96
  const version = resolved.found ? (resolved.version ?? null) : null;
98
97
  const issues = [...resolved.issues];
@@ -100,7 +99,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
100
99
  if (!resolved.integration || name == null) {
101
100
  return {
102
101
  type: 'integration.template-conflicts',
103
- data: {validated, name, version, conflicts: [], issues},
102
+ data: {name, version, conflicts: [], issues},
104
103
  };
105
104
  }
106
105
 
@@ -216,7 +215,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
216
215
 
217
216
  return {
218
217
  type: 'integration.template-conflicts',
219
- data: {validated, name, version, conflicts, issues},
218
+ data: {name, version, conflicts, issues},
220
219
  };
221
220
  }
222
221
 
@@ -229,7 +228,6 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
229
228
  export async function integrationComponentConflicts(pkg, options = {}) {
230
229
  const {cwd = process.cwd()} = options;
231
230
  const resolved = await resolveIntegration(pkg, cwd);
232
- const validated = resolved.found;
233
231
  const name = resolved.found ? (resolved.name ?? null) : null;
234
232
  const version = resolved.found ? (resolved.version ?? null) : null;
235
233
  const issues = [...resolved.issues];
@@ -237,7 +235,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
237
235
  if (!resolved.integration?.components || name == null) {
238
236
  return {
239
237
  type: 'integration.component-conflicts',
240
- data: {validated, name, version, conflicts: [], issues},
238
+ data: {name, version, conflicts: [], issues},
241
239
  };
242
240
  }
243
241
 
@@ -251,7 +249,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
251
249
  });
252
250
  return {
253
251
  type: 'integration.component-conflicts',
254
- data: {validated, name, version, conflicts: [], issues},
252
+ data: {name, version, conflicts: [], issues},
255
253
  };
256
254
  }
257
255
 
@@ -276,7 +274,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
276
274
 
277
275
  return {
278
276
  type: 'integration.component-conflicts',
279
- data: {validated, name, version, conflicts, issues},
277
+ data: {name, version, conflicts, issues},
280
278
  };
281
279
  }
282
280
 
@@ -289,7 +287,6 @@ export async function integrationComponentConflicts(pkg, options = {}) {
289
287
  export async function integrationDocConflicts(pkg, options = {}) {
290
288
  const {cwd = process.cwd()} = options;
291
289
  const resolved = await resolveIntegration(pkg, cwd);
292
- const validated = resolved.found;
293
290
  const name = resolved.found ? (resolved.name ?? null) : null;
294
291
  const version = resolved.found ? (resolved.version ?? null) : null;
295
292
  const issues = [...resolved.issues];
@@ -297,7 +294,7 @@ export async function integrationDocConflicts(pkg, options = {}) {
297
294
  if (!resolved.integration?.docs || name == null) {
298
295
  return {
299
296
  type: 'integration.doc-conflicts',
300
- data: {validated, name, version, findings: [], issues},
297
+ data: {name, version, findings: [], issues},
301
298
  };
302
299
  }
303
300
 
@@ -391,6 +388,6 @@ export async function integrationDocConflicts(pkg, options = {}) {
391
388
 
392
389
  return {
393
390
  type: 'integration.doc-conflicts',
394
- data: {validated, name, version, findings, issues},
391
+ data: {name, version, findings, issues},
395
392
  };
396
393
  }
@@ -32,15 +32,9 @@ export type IntegrationDocFinding = {
32
32
  coreTopic: string;
33
33
  message: string;
34
34
  };
35
- /**
36
- * Each of the three authoring checks reports `validated`: false means no
37
- * integration manifest was found, so nothing was inspected and the empty
38
- * conflicts/findings list carries no information about the package.
39
- */
40
35
  export type IntegrationTemplateConflictResponse = {
41
36
  type: "integration.template-conflicts";
42
37
  data: {
43
- validated: boolean;
44
38
  name: string | null;
45
39
  version: string | null;
46
40
  conflicts: IntegrationTemplateConflict[];
@@ -50,7 +44,6 @@ export type IntegrationTemplateConflictResponse = {
50
44
  export type IntegrationComponentConflictResponse = {
51
45
  type: "integration.component-conflicts";
52
46
  data: {
53
- validated: boolean;
54
47
  name: string | null;
55
48
  version: string | null;
56
49
  conflicts: IntegrationComponentConflict[];
@@ -60,7 +53,6 @@ export type IntegrationComponentConflictResponse = {
60
53
  export type IntegrationDocConflictResponse = {
61
54
  type: "integration.doc-conflicts";
62
55
  data: {
63
- validated: boolean;
64
56
  name: string | null;
65
57
  version: string | null;
66
58
  findings: IntegrationDocFinding[];
@@ -49,25 +49,21 @@
49
49
  */
50
50
 
51
51
  /**
52
- * Each of the three authoring checks reports `validated`: false means no
53
- * integration manifest was found, so nothing was inspected and the empty
54
- * conflicts/findings list carries no information about the package.
55
- *
56
52
  * @typedef {object} IntegrationTemplateConflictResponse
57
53
  * @property {'integration.template-conflicts'} type
58
- * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
54
+ * @property {{name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
59
55
  */
60
56
 
61
57
  /**
62
58
  * @typedef {object} IntegrationComponentConflictResponse
63
59
  * @property {'integration.component-conflicts'} type
64
- * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
60
+ * @property {{name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
65
61
  */
66
62
 
67
63
  /**
68
64
  * @typedef {object} IntegrationDocConflictResponse
69
65
  * @property {'integration.doc-conflicts'} type
70
- * @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
66
+ * @property {{name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
71
67
  */
72
68
 
73
69
  export {};