@astryxdesign/cli 0.6.5-vanilla-poc.6e25cfc → 0.6.6

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 (197) hide show
  1. package/CHANGELOG.md +84 -0
  2. package/README.md +1 -34
  3. package/api/build/_adapter.d.mts +14 -0
  4. package/api/build/_adapter.mjs +58 -1
  5. package/api/build/build.test.mjs +74 -1
  6. package/api/build/kit/kit.mjs +39 -7
  7. package/api/build/kit/rank.d.mts +8 -0
  8. package/api/build/kit/rank.mjs +14 -0
  9. package/api/build/kit/weights.d.mts +82 -0
  10. package/api/build/kit/weights.json +1 -0
  11. package/api/build/kit/weights.mjs +305 -0
  12. package/api/build/kit/weights.test.mjs +190 -0
  13. package/api/component/_adapter.d.mts +1 -51
  14. package/api/component/_adapter.mjs +3 -110
  15. package/api/component/component.d.mts +1 -9
  16. package/api/component/component.doc.mjs +7 -52
  17. package/api/component/component.mjs +3 -276
  18. package/api/component/component.type.d.mts +1 -28
  19. package/api/component/component.type.mjs +1 -20
  20. package/api/docs/docs.d.mts +6 -0
  21. package/api/docs/docs.depth.test.mjs +132 -0
  22. package/api/docs/docs.doc.mjs +31 -2
  23. package/api/docs/docs.mjs +44 -1
  24. package/api/docs/docs.type.d.mts +38 -1
  25. package/api/docs/docs.type.mjs +18 -1
  26. package/api/docs/node/node.d.mts +28 -3
  27. package/api/docs/node/node.mjs +146 -23
  28. package/api/hook/list/list.d.mts +1 -1
  29. package/api/index.d.mts +0 -8
  30. package/api/index.mjs +0 -8
  31. package/api/integration/add-theme.mjs +93 -3
  32. package/api/integration/add-theme.test.mjs +100 -0
  33. package/api/integration/integrationAddTheme.doc.mjs +1 -1
  34. package/api/search/search.d.mts +8 -1
  35. package/api/search/search.doc.mjs +3 -3
  36. package/api/search/search.mjs +58 -73
  37. package/api/search/search.test.mjs +122 -21
  38. package/api/search/search.type.d.mts +0 -10
  39. package/api/search/search.type.mjs +0 -1
  40. package/api/template/cdn/cdn.test.mjs +2 -50
  41. package/api/template/template.d.mts +0 -6
  42. package/api/template/template.doc.mjs +4 -56
  43. package/api/template/template.mjs +0 -82
  44. package/api/template/template.type.d.mts +0 -12
  45. package/api/template/template.type.mjs +0 -7
  46. package/assets/cdn.template.html +5 -19
  47. package/assets/docs/tokens.doc.mjs +3 -3
  48. package/assets/docs/tree/add-a-theme.doc.mjs +4 -0
  49. package/assets/docs/tree/troubleshooting.doc.mjs +4 -4
  50. package/clients/cli/commands/component/index.mjs +9 -66
  51. package/clients/cli/commands/component.doc.mjs +4 -26
  52. package/clients/cli/commands/docs.depth.test.mjs +219 -0
  53. package/clients/cli/commands/docs.doc.mjs +15 -2
  54. package/clients/cli/commands/docs.mjs +222 -5
  55. package/clients/cli/commands/integration-add.doc.mjs +1 -1
  56. package/clients/cli/commands/search.doc.mjs +2 -3
  57. package/clients/cli/commands/search.mjs +11 -8
  58. package/clients/cli/commands/search.test.mjs +35 -40
  59. package/clients/cli/commands/template.doc.mjs +3 -31
  60. package/clients/cli/commands/template.mjs +2 -37
  61. package/foundation/discovery/theme-discovery.d.mts +6 -0
  62. package/foundation/discovery/theme-discovery.mjs +9 -0
  63. package/foundation/response/response-types.doc.mjs +0 -38
  64. package/package.json +5 -9
  65. package/api/_vanilla-assets.d.mts +0 -10
  66. package/api/_vanilla-assets.mjs +0 -59
  67. package/api/component/html/html.d.mts +0 -12
  68. package/api/component/html/html.doc.d.mts +0 -5
  69. package/api/component/html/html.doc.mjs +0 -66
  70. package/api/component/html/html.mjs +0 -25
  71. package/api/component/html/html.test.mjs +0 -61
  72. package/api/component/html/html.type.d.mts +0 -23
  73. package/api/component/html/html.type.mjs +0 -27
  74. package/api/component/web-components/web-components.d.mts +0 -12
  75. package/api/component/web-components/web-components.doc.d.mts +0 -5
  76. package/api/component/web-components/web-components.doc.mjs +0 -70
  77. package/api/component/web-components/web-components.mjs +0 -32
  78. package/api/component/web-components/web-components.test.mjs +0 -50
  79. package/api/component/web-components/web-components.type.d.mts +0 -23
  80. package/api/component/web-components/web-components.type.mjs +0 -27
  81. package/api/template/_adapter.d.mts +0 -38
  82. package/api/template/_adapter.mjs +0 -90
  83. package/api/template/html/html.d.mts +0 -17
  84. package/api/template/html/html.doc.d.mts +0 -5
  85. package/api/template/html/html.doc.mjs +0 -72
  86. package/api/template/html/html.mjs +0 -61
  87. package/api/template/html/html.test.mjs +0 -71
  88. package/api/template/html/html.type.d.mts +0 -26
  89. package/api/template/html/html.type.mjs +0 -28
  90. package/api/template/web-components/web-components.d.mts +0 -13
  91. package/api/template/web-components/web-components.doc.d.mts +0 -5
  92. package/api/template/web-components/web-components.doc.mjs +0 -69
  93. package/api/template/web-components/web-components.mjs +0 -51
  94. package/api/template/web-components/web-components.test.mjs +0 -73
  95. package/api/template/web-components/web-components.type.d.mts +0 -26
  96. package/api/template/web-components/web-components.type.mjs +0 -28
  97. package/assets/generated/core-component-docs.json +0 -1
  98. package/assets/vanilla/elements-markup/Avatar.html +0 -27
  99. package/assets/vanilla/elements-markup/Badge.html +0 -16
  100. package/assets/vanilla/elements-markup/Banner.html +0 -32
  101. package/assets/vanilla/elements-markup/Breadcrumbs.html +0 -23
  102. package/assets/vanilla/elements-markup/Button.html +0 -37
  103. package/assets/vanilla/elements-markup/Card.html +0 -24
  104. package/assets/vanilla/elements-markup/CheckboxInput.html +0 -28
  105. package/assets/vanilla/elements-markup/Collapsible.html +0 -26
  106. package/assets/vanilla/elements-markup/DateInput.html +0 -28
  107. package/assets/vanilla/elements-markup/Dialog.html +0 -33
  108. package/assets/vanilla/elements-markup/Divider.html +0 -20
  109. package/assets/vanilla/elements-markup/DropdownMenu.html +0 -26
  110. package/assets/vanilla/elements-markup/EmptyState.html +0 -27
  111. package/assets/vanilla/elements-markup/Heading.html +0 -18
  112. package/assets/vanilla/elements-markup/HoverCard.html +0 -39
  113. package/assets/vanilla/elements-markup/Layout.html +0 -28
  114. package/assets/vanilla/elements-markup/Lightbox.html +0 -33
  115. package/assets/vanilla/elements-markup/Link.html +0 -23
  116. package/assets/vanilla/elements-markup/NumberInput.html +0 -34
  117. package/assets/vanilla/elements-markup/ProgressBar.html +0 -47
  118. package/assets/vanilla/elements-markup/RadioList.html +0 -28
  119. package/assets/vanilla/elements-markup/Selector.html +0 -34
  120. package/assets/vanilla/elements-markup/SideNav.html +0 -32
  121. package/assets/vanilla/elements-markup/Skeleton.html +0 -18
  122. package/assets/vanilla/elements-markup/Slider.html +0 -31
  123. package/assets/vanilla/elements-markup/Stack.html +0 -33
  124. package/assets/vanilla/elements-markup/StatusDot.html +0 -19
  125. package/assets/vanilla/elements-markup/Switch.html +0 -28
  126. package/assets/vanilla/elements-markup/Tab.html +0 -18
  127. package/assets/vanilla/elements-markup/TabList.html +0 -31
  128. package/assets/vanilla/elements-markup/Table.html +0 -31
  129. package/assets/vanilla/elements-markup/Text.html +0 -24
  130. package/assets/vanilla/elements-markup/TextArea.html +0 -32
  131. package/assets/vanilla/elements-markup/TextInput.html +0 -92
  132. package/assets/vanilla/elements-markup/Theme.html +0 -16
  133. package/assets/vanilla/elements-markup/TimeInput.html +0 -29
  134. package/assets/vanilla/elements-markup/Toast.html +0 -22
  135. package/assets/vanilla/elements-markup/Tooltip.html +0 -30
  136. package/assets/vanilla/elements-markup/TopNav.html +0 -85
  137. package/assets/vanilla/elements-markup/Typeahead.html +0 -31
  138. package/assets/vanilla/elements-templates/dashboard.html +0 -167
  139. package/assets/vanilla/elements-templates/detail-page.html +0 -145
  140. package/assets/vanilla/elements-templates/form-two-column.html +0 -135
  141. package/assets/vanilla/elements-templates/kanban-board.html +0 -141
  142. package/assets/vanilla/elements-templates/login.html +0 -100
  143. package/assets/vanilla/elements-templates/product-detail.html +0 -128
  144. package/assets/vanilla/elements-templates/settings.html +0 -130
  145. package/assets/vanilla/elements-templates/shell-side-nav.html +0 -160
  146. package/assets/vanilla/elements-templates/table-filter.html +0 -154
  147. package/assets/vanilla/markup/Avatar.html +0 -24
  148. package/assets/vanilla/markup/Badge.html +0 -12
  149. package/assets/vanilla/markup/Banner.html +0 -49
  150. package/assets/vanilla/markup/Breadcrumbs.html +0 -38
  151. package/assets/vanilla/markup/Button.html +0 -37
  152. package/assets/vanilla/markup/Card.html +0 -16
  153. package/assets/vanilla/markup/CheckboxInput.html +0 -45
  154. package/assets/vanilla/markup/Collapsible.html +0 -9
  155. package/assets/vanilla/markup/DateInput.html +0 -42
  156. package/assets/vanilla/markup/Dialog.html +0 -45
  157. package/assets/vanilla/markup/Divider.html +0 -9
  158. package/assets/vanilla/markup/DropdownMenu.html +0 -30
  159. package/assets/vanilla/markup/EmptyState.html +0 -41
  160. package/assets/vanilla/markup/Heading.html +0 -9
  161. package/assets/vanilla/markup/HoverCard.html +0 -85
  162. package/assets/vanilla/markup/Layout.html +0 -35
  163. package/assets/vanilla/markup/Lightbox.html +0 -107
  164. package/assets/vanilla/markup/Link.html +0 -6
  165. package/assets/vanilla/markup/NumberInput.html +0 -55
  166. package/assets/vanilla/markup/ProgressBar.html +0 -101
  167. package/assets/vanilla/markup/RadioList.html +0 -90
  168. package/assets/vanilla/markup/Selector.html +0 -92
  169. package/assets/vanilla/markup/SideNav.html +0 -82
  170. package/assets/vanilla/markup/Skeleton.html +0 -26
  171. package/assets/vanilla/markup/Slider.html +0 -65
  172. package/assets/vanilla/markup/Stack.html +0 -13
  173. package/assets/vanilla/markup/StatusDot.html +0 -22
  174. package/assets/vanilla/markup/Switch.html +0 -47
  175. package/assets/vanilla/markup/TabList.html +0 -56
  176. package/assets/vanilla/markup/Table.html +0 -75
  177. package/assets/vanilla/markup/Text.html +0 -9
  178. package/assets/vanilla/markup/TextArea.html +0 -37
  179. package/assets/vanilla/markup/TextInput.html +0 -80
  180. package/assets/vanilla/markup/Theme.html +0 -48
  181. package/assets/vanilla/markup/TimeInput.html +0 -43
  182. package/assets/vanilla/markup/Toast.html +0 -42
  183. package/assets/vanilla/markup/Tooltip.html +0 -18
  184. package/assets/vanilla/markup/TopNav.html +0 -81
  185. package/assets/vanilla/markup/Typeahead.html +0 -60
  186. package/assets/vanilla/templates/dashboard.html +0 -462
  187. package/assets/vanilla/templates/detail-page.html +0 -536
  188. package/assets/vanilla/templates/form-two-column.html +0 -438
  189. package/assets/vanilla/templates/kanban-board.html +0 -443
  190. package/assets/vanilla/templates/login.html +0 -199
  191. package/assets/vanilla/templates/product-detail.html +0 -335
  192. package/assets/vanilla/templates/settings.html +0 -374
  193. package/assets/vanilla/templates/shell-side-nav.html +0 -440
  194. package/assets/vanilla/templates/table-filter.html +0 -514
  195. package/clients/cli/commands/vanilla-html.test.mjs +0 -245
  196. package/foundation/discovery/bundled-component-docs.d.mts +0 -39
  197. package/foundation/discovery/bundled-component-docs.mjs +0 -92
@@ -288,22 +288,31 @@ describe('search CLI — exit codes + JSON contract', () => {
288
288
  });
289
289
 
290
290
  it('prints every result field under its JSON key (score and reason with --verbose)', async () => {
291
- // One query that reaches every domain, so every per-domain field shows.
292
- const args = ['search', 'theme', '--limit', '60'];
293
- const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
294
- expect(new Set(env.data.results.map(r => r.domain))).toEqual(new Set(SEARCH_DOMAINS));
295
- const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
296
- const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
297
- for (const result of env.data.results) {
298
- for (const [key, value] of Object.entries(result)) {
299
- if (value == null || value === '') continue;
300
- const label = `${result.domain} ${result.name}: ${key}`;
301
- expect(printsField(verbose, key, value), label).toBe(true);
302
- if (key !== 'score' && key !== 'reason') {
303
- expect(printsField(plain, key, value), label).toBe(true);
291
+ // Between them these reach every domain, so every per-domain field shows.
292
+ // A theme matches `theme` only through its description, a prose mention
293
+ // ranked below every name and keyword hit, so the theme domain comes from
294
+ // a theme's own name.
295
+ const domains = new Set();
296
+ for (const args of [
297
+ ['search', 'theme', '--limit', '60'],
298
+ ['search', 'neutral', '--type', 'theme'],
299
+ ]) {
300
+ const env = JSON.parse((await runCli(['--json', ...args], REPO_ROOT)).stdout);
301
+ const plain = (await runCli(args, REPO_ROOT)).stdout.split('\n');
302
+ const verbose = (await runCli([...args, '--verbose'], REPO_ROOT)).stdout.split('\n');
303
+ for (const result of env.data.results) {
304
+ domains.add(result.domain);
305
+ for (const [key, value] of Object.entries(result)) {
306
+ if (value == null || value === '') continue;
307
+ const label = `${result.domain} ${result.name}: ${key}`;
308
+ expect(printsField(verbose, key, value), label).toBe(true);
309
+ if (key !== 'score' && key !== 'reason') {
310
+ expect(printsField(plain, key, value), label).toBe(true);
311
+ }
304
312
  }
305
313
  }
306
314
  }
315
+ expect(domains).toEqual(new Set(SEARCH_DOMAINS));
307
316
  }, 90_000);
308
317
 
309
318
  it('--verbose exits 0 and prints import/match detail', async () => {
@@ -333,46 +342,32 @@ describe('search CLI — exit codes + JSON contract', () => {
333
342
  expect(json.stdout).not.toContain('More in packages you could add');
334
343
  });
335
344
 
336
- it('searches bundled components, docs, and themes when no local Core package is reachable', async () => {
345
+ it('searches the docs and themes when no @astryxdesign/core is reachable, and exits 1 for --type component', async () => {
337
346
  const empty = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-search-cli-no-core-'));
338
347
  try {
339
348
  const open = await runCli(['--json', 'search', 'make', 'an', 'integration'], empty);
340
349
  expect(open.status).toBe(0);
341
350
  expect(JSON.parse(open.stdout).data.results[0]).toMatchObject({domain: 'doc'});
342
-
351
+ // Bundled themes need no project, so an open search finds them too.
343
352
  const theme = await runCli(['--json', 'search', 'neutral'], empty);
344
353
  expect(theme.status).toBe(0);
345
- expect(JSON.parse(theme.stdout).data.results).toContainEqual(
346
- expect.objectContaining({domain: 'theme', name: 'neutral'}),
347
- );
348
-
349
- const text = await runCli(['search', 'button', '--type', 'component'], empty);
350
- expect(text.status).toBe(0);
351
- expect(text.stdout).toContain('Button');
352
- expect(text.stdout).toMatch(
353
- /@astryxdesign\/core@\d+\.\d+\.\d+ docs bundled with the CLI/,
354
- );
355
-
356
- const json = await runCli(
357
- ['--json', 'search', 'button', '--type', 'component'],
358
- empty,
359
- );
360
- expect(json.status).toBe(0);
361
- expect(JSON.parse(json.stdout)).toMatchObject({
362
- type: 'search',
363
- meta: {
364
- componentDocs: {
365
- source: 'bundled',
366
- package: '@astryxdesign/core',
367
- },
368
- },
354
+ expect(JSON.parse(theme.stdout).data.results[0]).toMatchObject({
355
+ domain: 'theme',
356
+ name: 'neutral',
369
357
  });
370
-
358
+ // The text says the search covered the docs and themes alone.
359
+ const text = await runCli(['search', 'button'], empty);
360
+ expect(text.status).toBe(0);
361
+ expect(text.stdout).toContain('only the docs and themes were searched');
362
+ // A themes-only search needs no core, like a docs-only one.
371
363
  const themes = await runCli(['--json', 'search', 'warm', '--type', 'theme'], empty);
372
364
  expect(themes.status).toBe(0);
373
365
  const found = JSON.parse(themes.stdout).data.results;
374
366
  expect(found.map(r => r.name)).toContain('neutral');
375
367
  expect(found.every(r => r.domain === 'theme')).toBe(true);
368
+ const json = await runCli(['--json', 'search', 'button', '--type', 'component'], empty);
369
+ expect(json.status).toBe(1);
370
+ expect(JSON.parse(json.stdout)).toMatchObject({code: 'ERR_CORE_NOT_FOUND'});
376
371
  } finally {
377
372
  fs.rmSync(empty, {recursive: true, force: true});
378
373
  }
@@ -14,7 +14,7 @@ export const doc = {
14
14
  name: 'template',
15
15
  displayName: 'astryx template',
16
16
  namespace: 'cli/commands',
17
- summary: 'List, show, scaffold, or render page and block templates',
17
+ summary: 'List, show, or scaffold page and block templates',
18
18
  description:
19
19
  'One entry point for the template family: with no name it lists the discovered ' +
20
20
  'templates; with a name it shows the source or a layout skeleton, or scaffolds it ' +
@@ -22,9 +22,7 @@ export const doc = {
22
22
  'default for its Core id; use --package @astryxdesign/core for the original. ' +
23
23
  'Narrow other ambiguous names with --type and/or --package. --cdn writes the ' +
24
24
  'no-build-step CDN starter page, which ships as an asset rather than as a ' +
25
- 'discovered template. --framework html reads packages/vanilla/templates; ' +
26
- '--framework web-components reads packages/vanilla/elements-templates. Both ' +
27
- 'substitute a commit-pinned jsDelivr base URL.',
25
+ 'discovered template.',
28
26
  fn: 'template',
29
27
  args: [
30
28
  {
@@ -77,24 +75,6 @@ export const doc = {
77
75
  'The page goes to the --cdn value, else to <path>, else cdn.template.html, and that path is always the file itself. ' +
78
76
  'A value right after --cdn (anything not starting with -) is taken as that path',
79
77
  },
80
- {
81
- flag: '--framework <framework>',
82
- param: 'options.framework',
83
- description:
84
- 'Output framework: react (default), html, or web-components. HTML and web-components print one standalone page or list their files with --list.',
85
- },
86
- {
87
- flag: '--html',
88
- param: 'options.html',
89
- description:
90
- 'Deprecated alias for --framework html. Print one standalone packages/vanilla/templates page, or list those files with --list.',
91
- },
92
- {
93
- flag: '--cdn-ref <ref>',
94
- param: 'options.cdnRef',
95
- description:
96
- 'Override the Git ref in vanilla jsDelivr URLs. Requires a named html or web-components template and cannot be used with --list.',
97
- },
98
78
  {
99
79
  flag: '-f, --overwrite',
100
80
  param: 'options.overwrite',
@@ -117,14 +97,6 @@ export const doc = {
117
97
  cli: 'astryx template shell-side-nav ./src/app --package @astryxdesign/core',
118
98
  },
119
99
  {label: 'CDN starter page', cli: 'astryx template --cdn'},
120
- {
121
- label: 'Vanilla standalone HTML',
122
- cli: 'astryx template dashboard --framework html',
123
- },
124
- {
125
- label: 'Vanilla web-component page',
126
- cli: 'astryx template dashboard --framework web-components',
127
- },
128
100
  {
129
101
  label: 'CDN starter page, elsewhere',
130
102
  cli: 'astryx template --cdn public/demo.html',
@@ -137,7 +109,7 @@ export const doc = {
137
109
  },
138
110
  {
139
111
  code: 1,
140
- when: 'unknown or ambiguous template, unknown framework, invalid framework/--cdn-ref combinations, no source, a path escape, or an existing target without --overwrite',
112
+ when: 'unknown or ambiguous template, no source, a path escape, or an existing target without --overwrite',
141
113
  },
142
114
  ],
143
115
  related: ['component', 'search', 'discover', 'init'],
@@ -28,11 +28,7 @@ export {discoverTemplates, listTemplates} from '../../../api/template/template.m
28
28
  * import('../../../api/template/template.type.mjs').TemplateShowResponse |
29
29
  * import('../../../api/template/template.type.mjs').TemplateSkeletonResponse |
30
30
  * import('../../../api/template/template.type.mjs').TemplateCopyResponse |
31
- * import('../../../api/template/template.type.mjs').TemplateCdnResponse |
32
- * import('../../../api/template/html/html.type.mjs').TemplateHtmlListResponse |
33
- * import('../../../api/template/html/html.type.mjs').TemplateHtmlResponse |
34
- * import('../../../api/template/web-components/web-components.type.mjs').TemplateWebComponentsListResponse |
35
- * import('../../../api/template/web-components/web-components.type.mjs').TemplateWebComponentsResponse
31
+ * import('../../../api/template/template.type.mjs').TemplateCdnResponse
36
32
  * )} TemplateResponse
37
33
  */
38
34
 
@@ -50,12 +46,7 @@ function summarize(result) {
50
46
  return resultSet({count: result.data.length, resultKind: 'template'});
51
47
  case 'template.show':
52
48
  case 'template.skeleton':
53
- case 'template.html':
54
- case 'template.web-components':
55
49
  return resultSet({count: 1, resultKind: 'template', directMatch: true});
56
- case 'template.html.list':
57
- case 'template.web-components.list':
58
- return resultSet({count: result.data.length, resultKind: 'template'});
59
50
  case 'template.copy':
60
51
  case 'template.cdn':
61
52
  return NO_RESULT_SET;
@@ -72,7 +63,7 @@ export function registerTemplate(program) {
72
63
  /**
73
64
  * @param {string | undefined} name
74
65
  * @param {string | undefined} targetPath
75
- * @param {{list?: boolean, type?: string, package?: string, skeleton?: boolean, cdn?: boolean | string, html?: boolean, framework?: string, cdnRef?: string, overwrite?: boolean}} options
66
+ * @param {{list?: boolean, type?: string, package?: string, skeleton?: boolean, cdn?: boolean | string, overwrite?: boolean}} options
76
67
  */
77
68
  async (name, targetPath, options) => {
78
69
  const json = program.opts().json || false;
@@ -96,9 +87,6 @@ export function registerTemplate(program) {
96
87
  list: options.list,
97
88
  skeleton: options.skeleton,
98
89
  cdn: options.cdn,
99
- html: options.html,
100
- framework: /** @type {'react'|'html'|'web-components'|undefined} */ (options.framework),
101
- cdnRef: options.cdnRef,
102
90
  type: /** @type {'page' | 'block' | undefined} */ (options.type),
103
91
  package: options.package,
104
92
  targetPath,
@@ -155,29 +143,6 @@ export function registerTemplate(program) {
155
143
  break;
156
144
  }
157
145
 
158
- case 'template.html.list':
159
- case 'template.web-components.list': {
160
- const framework =
161
- result.type === 'template.html.list' ? 'HTML' : 'web-component';
162
- const assetDir =
163
- result.type === 'template.html.list'
164
- ? 'packages/vanilla/templates'
165
- : 'packages/vanilla/elements-templates';
166
- emit(
167
- section(`Vanilla ${framework} templates`),
168
- result.data.length > 0
169
- ? records(result.data, {fields: ['id', 'file']})
170
- : text(`No vanilla ${framework} templates found in ${assetDir}.`),
171
- );
172
- break;
173
- }
174
-
175
- case 'template.html':
176
- case 'template.web-components': {
177
- emit(code(result.data.source));
178
- break;
179
- }
180
-
181
146
  case 'template.skeleton': {
182
147
  const {template: tName, description, components, skeleton} = result.data;
183
148
  emit(
@@ -1,6 +1,12 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in foundation/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
+ /**
5
+ * Every module a theme source file imports or re-exports, as written.
6
+ * @param {string} file
7
+ * @returns {string[]}
8
+ */
9
+ export function themeFileImports(file: string): string[];
4
10
  /**
5
11
  * How messages about a theme descriptor name it.
6
12
  * @param {string} docPath
@@ -200,6 +200,15 @@ function moduleSpecifiers(file, jscodeshift) {
200
200
  return specifiers;
201
201
  }
202
202
 
203
+ /**
204
+ * Every module a theme source file imports or re-exports, as written.
205
+ * @param {string} file
206
+ * @returns {string[]}
207
+ */
208
+ export function themeFileImports(file) {
209
+ return moduleSpecifiers(file, sourceParser());
210
+ }
211
+
203
212
  /**
204
213
  * Validate that every local static dependency is copied with the theme.
205
214
  * @param {string} file
@@ -66,25 +66,6 @@ export const doc = {
66
66
  description:
67
67
  "One component's example blocks, as {component, showcase, examples, related} of BlockEntry.",
68
68
  },
69
- {
70
- value: 'component.html.list',
71
- description: 'The sorted packages/vanilla/markup files as {name, file}.',
72
- },
73
- {
74
- value: 'component.html',
75
- description:
76
- 'One vanilla component markup file as {component, file, source}, preserving docs and variant comments verbatim.',
77
- },
78
- {
79
- value: 'component.web-components.list',
80
- description:
81
- 'The sorted packages/vanilla/elements-markup files as {name, file}.',
82
- },
83
- {
84
- value: 'component.web-components',
85
- description:
86
- 'One vanilla web-component markup file as {component, file, source}, preserving generated docs and variant comments verbatim.',
87
- },
88
69
 
89
70
  // docs
90
71
  {
@@ -221,25 +202,6 @@ export const doc = {
221
202
  description:
222
203
  'A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success.',
223
204
  },
224
- {
225
- value: 'template.html.list',
226
- description: 'The sorted packages/vanilla/templates files as {id, file}.',
227
- },
228
- {
229
- value: 'template.html',
230
- description:
231
- 'One vanilla standalone page as {template, file, cdnRef, cdnBase, source}, with every CDN placeholder substituted.',
232
- },
233
- {
234
- value: 'template.web-components.list',
235
- description:
236
- 'The sorted packages/vanilla/elements-templates files as {id, file}.',
237
- },
238
- {
239
- value: 'template.web-components',
240
- description:
241
- 'One vanilla web-component page as {template, file, cdnRef, cdnBase, source}, with every CDN placeholder substituted.',
242
- },
243
205
 
244
206
  // hook
245
207
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.5-vanilla-poc.6e25cfc",
3
+ "version": "0.6.6",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -102,9 +102,9 @@
102
102
  },
103
103
  "peerDependencies": {
104
104
  "@astryxdesign/charts": "*",
105
- "@astryxdesign/core": "0.6.5-vanilla-poc.6e25cfc",
105
+ "@astryxdesign/core": "*",
106
106
  "@astryxdesign/lab": "*",
107
- "@astryxdesign/theme-neutral": "0.6.5-vanilla-poc.6e25cfc"
107
+ "@astryxdesign/theme-neutral": "*"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@astryxdesign/charts": {
@@ -122,9 +122,9 @@
122
122
  },
123
123
  "devDependencies": {
124
124
  "@astryxdesign/charts": "*",
125
- "@astryxdesign/core": "0.6.5-vanilla-poc.6e25cfc",
125
+ "@astryxdesign/core": "*",
126
126
  "@astryxdesign/lab": "*",
127
- "@astryxdesign/theme-neutral": "0.6.5-vanilla-poc.6e25cfc",
127
+ "@astryxdesign/theme-neutral": "*",
128
128
  "@heroicons/react": "^2.2.0",
129
129
  "@stylexjs/stylex": "^0.19.0",
130
130
  "@types/babel__core": "^7.20.5",
@@ -141,10 +141,6 @@
141
141
  "typecheck:strict": "tsc --project tsconfig.strict.json",
142
142
  "typecheck:authoring": "tsc --project tsconfig.authoring-contract.json",
143
143
  "sync:api-types": "node scripts/sync-api-types.mjs",
144
- "bundle:core-docs": "node scripts/generate-bundled-component-docs.mjs",
145
- "bundle:core-docs:check": "node scripts/generate-bundled-component-docs.mjs --check",
146
- "sync:vanilla-assets": "node scripts/sync-vanilla-assets.mjs",
147
- "sync:vanilla-assets:check": "node scripts/sync-vanilla-assets.mjs --check",
148
144
  "readme": "node scripts/generate-cli-readme.mjs",
149
145
  "readme:check": "node scripts/generate-cli-readme.mjs --check"
150
146
  }
@@ -1,10 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- /**
5
- * Prefer live checkout assets while developing, then fall back to the generated
6
- * copy included in the published CLI package.
7
- * @param {string} cwd
8
- * @returns {string}
9
- */
10
- export function requireVanillaAssetsDir(cwd: string): string;
@@ -1,59 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file Resolves vanilla framework assets from the source checkout or the CLI bundle.
5
- *
6
- * @input A caller working directory.
7
- * @output The checkout's packages/vanilla directory when present, otherwise the
8
- * generated assets/vanilla copy shipped with @astryxdesign/cli.
9
- * @position Shared environment adapter used only by the component and template
10
- * vanilla framework adapters so installed and source-checkout behavior agree.
11
- */
12
-
13
- import * as fs from 'node:fs';
14
- import * as path from 'node:path';
15
- import {ERROR_CODES} from '../foundation/response/error-codes.mjs';
16
- import {AstryxError} from './error.mjs';
17
-
18
- const BUNDLED_VANILLA_DIR = path.resolve(
19
- import.meta.dirname,
20
- '../assets/vanilla',
21
- );
22
-
23
- /** @param {string} candidate @returns {boolean} */
24
- function isDirectory(candidate) {
25
- return fs.existsSync(candidate) && fs.statSync(candidate).isDirectory();
26
- }
27
-
28
- /** @param {string} cwd @returns {string | null} */
29
- function findCheckoutVanillaDir(cwd) {
30
- let cursor = path.resolve(cwd);
31
- while (true) {
32
- const direct =
33
- path.basename(cursor) === 'vanilla' &&
34
- path.basename(path.dirname(cursor)) === 'packages'
35
- ? cursor
36
- : path.join(cursor, 'packages', 'vanilla');
37
- if (isDirectory(direct)) return direct;
38
- const parent = path.dirname(cursor);
39
- if (parent === cursor) return null;
40
- cursor = parent;
41
- }
42
- }
43
-
44
- /**
45
- * Prefer live checkout assets while developing, then fall back to the generated
46
- * copy included in the published CLI package.
47
- * @param {string} cwd
48
- * @returns {string}
49
- */
50
- export function requireVanillaAssetsDir(cwd) {
51
- const checkoutDir = findCheckoutVanillaDir(cwd);
52
- if (checkoutDir) return checkoutDir;
53
- if (isDirectory(BUNDLED_VANILLA_DIR)) return BUNDLED_VANILLA_DIR;
54
- throw new AstryxError(
55
- `Could not find vanilla framework assets from "${cwd}" or in the installed CLI`,
56
- undefined,
57
- ERROR_CODES.ERR_FILE_NOT_FOUND,
58
- );
59
- }
@@ -1,12 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- /**
5
- * @param {string|undefined} name
6
- * @param {{cwd?: string, list?: boolean}} [options]
7
- * @returns {import('./html.type.mjs').ComponentHtmlResponse | import('./html.type.mjs').ComponentHtmlListResponse}
8
- */
9
- export function componentHtml(name: string | undefined, options?: {
10
- cwd?: string;
11
- list?: boolean;
12
- }): import("./html.type.mjs").ComponentHtmlResponse | import("./html.type.mjs").ComponentHtmlListResponse;
@@ -1,5 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
5
- export const doc: import("@astryxdesign/cli/authoring").FunctionDoc;
@@ -1,66 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /** @type {import('@astryxdesign/cli/authoring').FunctionDoc} */
4
- export const doc = {
5
- type: 'function',
6
- kind: 'api',
7
- name: 'componentHtml',
8
- namespace: 'cli/api',
9
- displayName: 'componentHtml()',
10
- summary: 'List or read vanilla HTML component markup.',
11
- description:
12
- 'Reads packages/vanilla/markup in a source checkout and falls back to the bundled CLI copy after installation. List mode returns the available .html files; named mode returns one file verbatim, including its docs and variant comments.',
13
- importPath: '@astryxdesign/cli/api',
14
- signature:
15
- 'componentHtml(name?: string, options?: ComponentHtmlOptions): ComponentHtmlListResponse | ComponentHtmlResponse',
16
- keywords: ['component', 'html', 'vanilla', 'markup'],
17
- params: [
18
- {
19
- name: 'name',
20
- type: 'string',
21
- description: 'Exact vanilla component name.',
22
- },
23
- {
24
- name: 'options.cwd',
25
- type: 'string',
26
- description:
27
- 'Directory to search upward for packages/vanilla before using the bundled CLI copy.',
28
- default: 'process.cwd()',
29
- },
30
- {
31
- name: 'options.list',
32
- type: 'boolean',
33
- description: 'List available markup files instead of reading one.',
34
- default: 'false',
35
- },
36
- ],
37
- returns: [
38
- {
39
- type: 'component.html.list',
40
- description: 'Sorted vanilla component markup files as {name, file}.',
41
- },
42
- {
43
- type: 'component.html',
44
- description: 'One component markup file as {component, file, source}.',
45
- },
46
- ],
47
- throws: [
48
- {
49
- code: 'ERR_FILE_NOT_FOUND',
50
- when: 'neither checkout nor bundled vanilla assets are available',
51
- },
52
- {
53
- code: 'ERR_INVALID_ARGUMENT',
54
- when: 'name is not a safe component identifier',
55
- },
56
- {code: 'ERR_UNKNOWN_COMPONENT', when: 'no matching markup file exists'},
57
- ],
58
- examples: [
59
- {label: 'Read Button markup', code: "componentHtml('Button', {cwd})"},
60
- {
61
- label: 'List markup files',
62
- code: 'componentHtml(undefined, {cwd, list: true})',
63
- },
64
- ],
65
- related: ['component', 'templateHtml'],
66
- };
@@ -1,25 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- /**
4
- * @file Vanilla HTML projection for the component command.
5
- * @position api/component/html — routed by component.mjs for framework=html or the --html alias
6
- */
7
-
8
- import {
9
- listVanillaComponentHtml,
10
- readVanillaComponentHtml,
11
- } from '../_adapter.mjs';
12
-
13
- /**
14
- * @param {string|undefined} name
15
- * @param {{cwd?: string, list?: boolean}} [options]
16
- * @returns {import('./html.type.mjs').ComponentHtmlResponse | import('./html.type.mjs').ComponentHtmlListResponse}
17
- */
18
- export function componentHtml(name, options = {}) {
19
- const {cwd = process.cwd(), list = false} = options;
20
- if (list) {
21
- return {type: 'component.html.list', data: listVanillaComponentHtml(cwd)};
22
- }
23
- const data = readVanillaComponentHtml(/** @type {string} */ (name), cwd);
24
- return {type: 'component.html', data};
25
- }
@@ -1,61 +0,0 @@
1
- // Copyright (c) Meta Platforms, Inc. and affiliates.
2
-
3
- import {describe, expect, it} from 'vitest';
4
- import * as fs from 'node:fs';
5
- import * as os from 'node:os';
6
- import * as path from 'node:path';
7
- import {componentHtml} from './html.mjs';
8
-
9
- const FIXTURE = path.resolve(
10
- import.meta.dirname,
11
- '../../../test/fixtures/vanilla-project',
12
- );
13
-
14
- describe('componentHtml()', () => {
15
- it('lists sorted vanilla markup files', () => {
16
- expect(componentHtml(undefined, {cwd: FIXTURE, list: true})).toEqual({
17
- type: 'component.html.list',
18
- data: [{name: 'Button', file: 'Button.html'}],
19
- });
20
- });
21
-
22
- it('falls back to the bundled markup outside a checkout', () => {
23
- const outsideCheckout = fs.mkdtempSync(
24
- path.join(os.tmpdir(), 'astryx-cli-installed-'),
25
- );
26
- try {
27
- const result = componentHtml('Button', {cwd: outsideCheckout});
28
- expect(result.type).toBe('component.html');
29
- expect(result.data.source).toContain('ax-button');
30
- } finally {
31
- fs.rmSync(outsideCheckout, {recursive: true, force: true});
32
- }
33
- });
34
-
35
- it('returns docs and variants verbatim', () => {
36
- const result = componentHtml('Button', {cwd: FIXTURE});
37
- expect(result.type).toBe('component.html');
38
- expect(result.data.source).toContain(
39
- '<!-- docs: A button triggers an action. -->',
40
- );
41
- expect(result.data.source).toContain('<!-- variant: primary -->');
42
- expect(result.data.source).toContain('ax-button--secondary');
43
- });
44
-
45
- it('rejects traversal-shaped names', () => {
46
- expect(() => componentHtml('../Button', {cwd: FIXTURE})).toThrow(
47
- /Invalid vanilla component name/,
48
- );
49
- });
50
-
51
- it('reports a missing markup file as an unknown component', () => {
52
- const error = (() => {
53
- try {
54
- componentHtml('Card', {cwd: FIXTURE});
55
- } catch (caught) {
56
- return caught;
57
- }
58
- })();
59
- expect(error.code).toBe('ERR_UNKNOWN_COMPONENT');
60
- });
61
- });
@@ -1,23 +0,0 @@
1
- // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
- // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
-
4
- export type ComponentHtmlListEntry = {
5
- name: string;
6
- file: string;
7
- };
8
- export type ComponentHtmlListResponse = {
9
- type: "component.html.list";
10
- data: ComponentHtmlListEntry[];
11
- };
12
- export type ComponentHtmlResponse = {
13
- type: "component.html";
14
- data: {
15
- component: string;
16
- file: string;
17
- source: string;
18
- };
19
- };
20
- export type ComponentHtmlOptions = {
21
- cwd?: string | undefined;
22
- list?: boolean | undefined;
23
- };