@astryxdesign/cli 0.7.18-canary.gfca8508 → 0.7.18

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 (341) hide show
  1. package/CHANGELOG.md +185 -19
  2. package/README.md +19 -19
  3. package/api/component/_adapter.d.mts +2 -1
  4. package/api/component/_adapter.mjs +2 -1
  5. package/api/docs/_adapter.d.mts +6 -5
  6. package/api/docs/_adapter.mjs +36 -5
  7. package/api/doctor/_adapter.d.mts +6 -3
  8. package/api/doctor/_adapter.mjs +13 -5
  9. package/api/doctor/doctor.mjs +2 -2
  10. package/api/doctor/font-packages.d.mts +36 -0
  11. package/api/doctor/font-packages.mjs +124 -0
  12. package/api/doctor/theme-checks.mjs +110 -49
  13. package/api/experimental.d.mts +0 -2
  14. package/api/experimental.mjs +0 -12
  15. package/api/icon/_adapter.d.mts +1 -1
  16. package/api/icon/_adapter.mjs +1 -0
  17. package/api/icon/_authoring.mjs +17 -8
  18. package/api/icon/_default-look.mjs +15 -15
  19. package/api/icon/add/add.mjs +9 -4
  20. package/api/icon/exportIconIndex.doc.mjs +1 -1
  21. package/api/icon/icon.doc.mjs +1 -1
  22. package/api/icon/icon.type.d.mts +33 -33
  23. package/api/icon/icon.type.mjs +45 -45
  24. package/api/icon/iconAdd.doc.mjs +1 -1
  25. package/api/icon/iconNewSet.doc.mjs +3 -3
  26. package/api/icon/iconUse.doc.mjs +5 -5
  27. package/api/icon/rankIconIndex.doc.mjs +1 -1
  28. package/api/icon/use/use.mjs +4 -4
  29. package/api/init/run/run.mjs +0 -1
  30. package/api/integration/add-helpers.mjs +1 -1
  31. package/api/render/_adapter.mjs +7 -1
  32. package/api/search/ORDERING.md +1 -1
  33. package/api/search/_candidate-score.mjs +20 -0
  34. package/api/search/_words.d.mts +8 -0
  35. package/api/search/_words.mjs +15 -0
  36. package/api/template/template.type.d.mts +2 -2
  37. package/api/template/template.type.mjs +2 -2
  38. package/api/theme/_adapter.mjs +19 -11
  39. package/api/theme/build/build.d.mts +19 -51
  40. package/api/theme/build/build.mjs +195 -189
  41. package/api/theme/build/font-warning.d.mts +19 -2
  42. package/api/theme/build/font-warning.mjs +46 -5
  43. package/api/theme/generateTonalPalette.doc.mjs +1 -1
  44. package/api/theme/palette/generate/derive-look.mjs +108 -37
  45. package/api/theme/palette/generate/mapping.mjs +2 -0
  46. package/api/theme/template/template.d.mts +0 -17
  47. package/api/theme/template/template.mjs +1 -42
  48. package/api/theme/theme.type.d.mts +5 -4
  49. package/api/theme/theme.type.mjs +5 -4
  50. package/api/theme/themePaletteGenerate.doc.mjs +1 -1
  51. package/api/theme/themeRemove.doc.mjs +1 -1
  52. package/assets/codemods/transforms/v0.7.0/preserve-bottom-sheet-content-padding.mjs +3 -1
  53. package/assets/component-list.generated.json +1 -1
  54. package/assets/discover/official-packages.json +26 -2
  55. package/assets/docs/author-a-theme.doc.mjs +6 -5
  56. package/assets/docs/browser-support.doc.mjs +1 -0
  57. package/assets/docs/icons.doc.mjs +8 -7
  58. package/assets/docs/motion.doc.mjs +46 -0
  59. package/assets/docs/theme.doc.dense.mjs +6 -17
  60. package/assets/docs/theme.doc.mjs +6 -16
  61. package/assets/docs/theme.doc.zh.mjs +6 -16
  62. package/assets/docs/tree/ci-and-containers.doc.mjs +1 -1
  63. package/assets/docs/tree/font-setup.doc.mjs +30 -0
  64. package/assets/docs/tree/icon-sets.doc.mjs +1 -1
  65. package/assets/docs/tree/template-icons.doc.mjs +3 -3
  66. package/assets/docs/tree/tokens-color.doc.mjs +5 -0
  67. package/assets/docs/tree/tokens.doc.mjs +4 -3
  68. package/assets/docs/tree/updates.doc.mjs +1 -1
  69. package/assets/docs-routes.generated.json +1 -1
  70. package/assets/docs.generated.json +2 -2
  71. package/assets/icons/definitions/drag.doc.mjs +1 -0
  72. package/assets/search-catalog.generated.json +2 -2
  73. package/assets/self-audit.generated.json +1 -1
  74. package/assets/templates/blocks/components/Card/SelectableCardElevated.doc.mjs +1 -1
  75. package/assets/templates/blocks/components/Card/SelectableCardElevated.tsx +20 -10
  76. package/assets/templates/blocks/components/Card/SelectableCardShowcase.doc.mjs +1 -1
  77. package/assets/templates/blocks/components/Card/SelectableCardShowcase.tsx +36 -16
  78. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMentionTrigger.tsx +6 -0
  79. package/assets/templates/blocks/components/ChatComposerInput/ChatComposerInputMultipleTriggers.tsx +6 -0
  80. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.doc.mjs +14 -0
  81. package/assets/templates/blocks/components/Hooks/useIndicatorFocusRingHookUsage.tsx +63 -0
  82. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.doc.mjs +29 -0
  83. package/assets/templates/blocks/components/Hooks/useLongPressHookUsage.tsx +237 -0
  84. package/assets/templates/blocks/components/SideNav/SideNavShowcase.tsx +10 -72
  85. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.doc.mjs +1 -1
  86. package/assets/templates/blocks/components/SideNav/SideNavWithHeaderMenu.tsx +7 -7
  87. package/assets/templates/blocks/components/Table/TableCustomRowTable.doc.mjs +14 -0
  88. package/assets/templates/blocks/components/Table/TableCustomRowTable.tsx +96 -0
  89. package/assets/templates/components.generated.json +1 -1
  90. package/assets/templates/pages/ai-chat-landing/page.tsx +4 -0
  91. package/assets/templates/pages/dashboard-scorecard/page.tsx +26 -7
  92. package/assets/templates/pages/editor/page.tsx +13 -3
  93. package/assets/templates/themes/butter/butterPaletteRefs.generated.ts +2 -2
  94. package/assets/templates/themes/butter/butterTheme.ts +12 -10
  95. package/assets/templates/themes/butter/icons.tsx +2 -0
  96. package/assets/templates/themes/chocolate/chocolateTheme.ts +1 -0
  97. package/assets/templates/themes/chocolate/icons.tsx +2 -0
  98. package/assets/templates/themes/gothic/gothicPaletteRefs.generated.ts +1 -1
  99. package/assets/templates/themes/gothic/gothicTheme.ts +1 -0
  100. package/assets/templates/themes/gothic/icons.tsx +2 -0
  101. package/assets/templates/themes/matcha/icons.tsx +2 -0
  102. package/assets/templates/themes/matcha/matchaPaletteRefs.generated.ts +2 -2
  103. package/assets/templates/themes/matcha/matchaTheme.ts +1 -0
  104. package/assets/templates/themes/neutral/icons.tsx +2 -0
  105. package/assets/templates/themes/neutral/neutralPaletteRefs.generated.ts +2 -2
  106. package/assets/templates/themes/neutral/neutralTheme.ts +1 -0
  107. package/assets/templates/themes/stone/icons.tsx +2 -0
  108. package/assets/templates/themes/stone/stonePaletteRefs.generated.ts +1 -1
  109. package/assets/templates/themes/stone/stoneTheme.ts +1 -0
  110. package/assets/templates/themes/y2k/icons.tsx +2 -0
  111. package/assets/templates/themes/y2k/y2kTheme.ts +1 -0
  112. package/assets/theme.template.ts +9 -5
  113. package/authoring/config/parse.mjs +1 -1
  114. package/authoring/doctypes/base/type.ts +2 -3
  115. package/authoring/doctypes/component/component.doc.mjs +1 -1
  116. package/authoring/doctypes/icon-set/icon-names.mjs +1 -0
  117. package/authoring/integration/integration.doc.mjs +1 -1
  118. package/authoring/integration/type.ts +1 -1
  119. package/clients/cli/build-id.generated.json +1 -1
  120. package/clients/cli/commands/experimental/icon.mjs +7 -7
  121. package/clients/cli/commands/experimental/index.mjs +0 -5
  122. package/clients/cli/commands/experimental-icon-new-set.doc.mjs +2 -2
  123. package/clients/cli/commands/experimental-icon-use.doc.mjs +4 -4
  124. package/clients/cli/commands/experimental-icon.doc.mjs +1 -1
  125. package/clients/cli/commands/experimental.doc.mjs +2 -6
  126. package/clients/cli/commands/template.mjs +1 -1
  127. package/clients/cli/commands/theme-build.doc.mjs +8 -1
  128. package/clients/cli/commands/theme-palette-generate.doc.mjs +1 -1
  129. package/clients/cli/commands/theme-remove.doc.mjs +1 -1
  130. package/clients/cli/commands/theme.doc.mjs +1 -11
  131. package/clients/cli/commands/theme.mjs +110 -475
  132. package/clients/cli/commands.generated.json +1 -1
  133. package/clients/cli/index.mjs +4 -34
  134. package/clients/cli/lib/base-gate.mjs +2 -3
  135. package/clients/cli/lib/cli-error.mjs +8 -72
  136. package/clients/cli/lib/define-command.mjs +0 -19
  137. package/clients/cli/lib/json-shim.mjs +11 -633
  138. package/clients/cli/lib/manifest.mjs +0 -4
  139. package/clients/cli/lib/stray-option.mjs +1 -2
  140. package/clients/cli/manifest.generated.json +1 -1
  141. package/foundation/agent-docs/agent-docs.mjs +1 -1
  142. package/foundation/color/css-color.mjs +2 -3
  143. package/foundation/discovery/app-layout.d.mts +13 -0
  144. package/foundation/discovery/app-layout.mjs +35 -0
  145. package/foundation/discovery/fixture-refs.d.mts +51 -0
  146. package/foundation/discovery/fixture-refs.mjs +351 -0
  147. package/foundation/discovery/icon-definition-discovery.mjs +1 -1
  148. package/foundation/discovery/icon-ranking.mjs +2 -2
  149. package/foundation/discovery/icon-set-checks.mjs +1 -1
  150. package/foundation/discovery/icon-set-discovery.mjs +1 -1
  151. package/foundation/discovery/icon-set-writer.d.mts +24 -7
  152. package/foundation/discovery/icon-set-writer.mjs +66 -22
  153. package/foundation/discovery/static-descriptor.d.mts +49 -0
  154. package/foundation/discovery/static-descriptor.mjs +548 -0
  155. package/foundation/discovery/template-adapter.d.mts +0 -47
  156. package/foundation/discovery/template-adapter.mjs +1 -333
  157. package/foundation/discovery/theme-discovery.d.mts +6 -47
  158. package/foundation/discovery/theme-discovery.mjs +15 -537
  159. package/foundation/doc-compiler/import.mjs +1 -1
  160. package/foundation/env/user-dirs.d.mts +5 -2
  161. package/foundation/env/user-dirs.mjs +12 -5
  162. package/foundation/fonts/next-font.d.mts +26 -0
  163. package/foundation/fonts/next-font.mjs +149 -0
  164. package/foundation/fs/empty-folder.mjs +2 -2
  165. package/foundation/fs/read-record.mjs +11 -4
  166. package/foundation/pictures/pictures.d.mts +1 -45
  167. package/foundation/pictures/pictures.mjs +8 -8
  168. package/foundation/release/folder-lock.mjs +3 -2
  169. package/foundation/render/cut-short.d.mts +2 -2
  170. package/foundation/render/cut-short.mjs +2 -2
  171. package/foundation/render/drawn-contrast.d.mts +2 -2
  172. package/foundation/render/drawn-contrast.mjs +2 -2
  173. package/foundation/render/font-probe.d.mts +2 -2
  174. package/foundation/render/font-probe.mjs +2 -2
  175. package/foundation/render/layers.mjs +1 -2
  176. package/foundation/render/package-resolve-hooks.d.mts +25 -5
  177. package/foundation/render/package-resolve-hooks.mjs +77 -14
  178. package/foundation/render/page-worker.mjs +24 -12
  179. package/foundation/render/part-boxes.d.mts +2 -3
  180. package/foundation/render/part-boxes.mjs +2 -3
  181. package/foundation/render/picture-chrome.mjs +5 -0
  182. package/foundation/render/render-page.d.mts +1 -1
  183. package/foundation/render/render-page.mjs +4 -5
  184. package/foundation/render/single-copy-hooks.d.mts +2 -0
  185. package/foundation/render/single-copy-hooks.mjs +2 -0
  186. package/foundation/response/error-codes.doc.mjs +14 -14
  187. package/foundation/response/error-codes.mjs +13 -13
  188. package/foundation/response/response-types.doc.mjs +7 -68
  189. package/foundation/runtime/css-tree.mjs +2 -2
  190. package/foundation/runtime/word-table.d.mts +1 -1
  191. package/foundation/runtime/word-table.mjs +1 -1
  192. package/foundation/suggest/other-command.d.mts +52 -15
  193. package/foundation/suggest/other-command.mjs +168 -45
  194. package/foundation/text/suggest-order.d.mts +7 -0
  195. package/foundation/text/suggest-order.mjs +1 -1
  196. package/package.json +7 -8
  197. package/api/theme-edit/_adapter.d.mts +0 -228
  198. package/api/theme-edit/_adapter.mjs +0 -2025
  199. package/api/theme-edit/_catalog.d.mts +0 -172
  200. package/api/theme-edit/_catalog.mjs +0 -806
  201. package/api/theme-edit/_check.d.mts +0 -391
  202. package/api/theme-edit/_check.mjs +0 -9370
  203. package/api/theme-edit/_color.d.mts +0 -135
  204. package/api/theme-edit/_color.mjs +0 -480
  205. package/api/theme-edit/_compiler.d.mts +0 -77
  206. package/api/theme-edit/_compiler.mjs +0 -1053
  207. package/api/theme-edit/_context.d.mts +0 -399
  208. package/api/theme-edit/_context.mjs +0 -1778
  209. package/api/theme-edit/_css.d.mts +0 -169
  210. package/api/theme-edit/_css.mjs +0 -1167
  211. package/api/theme-edit/_edit.d.mts +0 -167
  212. package/api/theme-edit/_edit.mjs +0 -11220
  213. package/api/theme-edit/_how-commands.d.mts +0 -315
  214. package/api/theme-edit/_how-commands.mjs +0 -1664
  215. package/api/theme-edit/_how-question.d.mts +0 -341
  216. package/api/theme-edit/_how-question.mjs +0 -33339
  217. package/api/theme-edit/_how-sides.d.mts +0 -22
  218. package/api/theme-edit/_how-sides.mjs +0 -173
  219. package/api/theme-edit/_how-steps.d.mts +0 -42
  220. package/api/theme-edit/_how-steps.mjs +0 -208
  221. package/api/theme-edit/_how-values.d.mts +0 -29
  222. package/api/theme-edit/_how-values.mjs +0 -111
  223. package/api/theme-edit/_how-words.d.mts +0 -15
  224. package/api/theme-edit/_how-words.mjs +0 -239
  225. package/api/theme-edit/_how.d.mts +0 -55
  226. package/api/theme-edit/_how.mjs +0 -2388
  227. package/api/theme-edit/_importers.d.mts +0 -38
  228. package/api/theme-edit/_importers.mjs +0 -188
  229. package/api/theme-edit/_marks.d.mts +0 -39
  230. package/api/theme-edit/_marks.mjs +0 -67
  231. package/api/theme-edit/_missed.d.mts +0 -56
  232. package/api/theme-edit/_missed.mjs +0 -1128
  233. package/api/theme-edit/_name-rule.d.mts +0 -11
  234. package/api/theme-edit/_name-rule.mjs +0 -12
  235. package/api/theme-edit/_normal.d.mts +0 -365
  236. package/api/theme-edit/_normal.mjs +0 -1978
  237. package/api/theme-edit/_overview.d.mts +0 -9
  238. package/api/theme-edit/_overview.mjs +0 -293
  239. package/api/theme-edit/_palette.d.mts +0 -616
  240. package/api/theme-edit/_palette.mjs +0 -2776
  241. package/api/theme-edit/_part-pieces.d.mts +0 -54
  242. package/api/theme-edit/_part-pieces.mjs +0 -179
  243. package/api/theme-edit/_part-words.d.mts +0 -39
  244. package/api/theme-edit/_part-words.mjs +0 -242
  245. package/api/theme-edit/_parts.d.mts +0 -402
  246. package/api/theme-edit/_parts.mjs +0 -2322
  247. package/api/theme-edit/_picture-traits.d.mts +0 -259
  248. package/api/theme-edit/_picture-traits.mjs +0 -1030
  249. package/api/theme-edit/_png.d.mts +0 -94
  250. package/api/theme-edit/_png.mjs +0 -479
  251. package/api/theme-edit/_preview-app.d.mts +0 -172
  252. package/api/theme-edit/_preview-app.mjs +0 -6430
  253. package/api/theme-edit/_preview.d.mts +0 -484
  254. package/api/theme-edit/_preview.mjs +0 -2775
  255. package/api/theme-edit/_project.d.mts +0 -207
  256. package/api/theme-edit/_project.mjs +0 -643
  257. package/api/theme-edit/_resolved.d.mts +0 -46
  258. package/api/theme-edit/_resolved.mjs +0 -800
  259. package/api/theme-edit/_set-line.d.mts +0 -29
  260. package/api/theme-edit/_set-line.mjs +0 -100
  261. package/api/theme-edit/_settings.d.mts +0 -2426
  262. package/api/theme-edit/_settings.mjs +0 -18449
  263. package/api/theme-edit/_tables.d.mts +0 -227
  264. package/api/theme-edit/_tables.mjs +0 -1128
  265. package/api/theme-edit/_text-looks.d.mts +0 -78
  266. package/api/theme-edit/_text-looks.mjs +0 -376
  267. package/api/theme-edit/_vet.d.mts +0 -50
  268. package/api/theme-edit/_vet.mjs +0 -166
  269. package/api/theme-edit/how/how.d.mts +0 -17
  270. package/api/theme-edit/how/how.mjs +0 -28
  271. package/api/theme-edit/new/new.d.mts +0 -11
  272. package/api/theme-edit/new/new.mjs +0 -22
  273. package/api/theme-edit/preview-add/preview-add.d.mts +0 -14
  274. package/api/theme-edit/preview-add/preview-add.mjs +0 -25
  275. package/api/theme-edit/preview-app/preview-app.d.mts +0 -13
  276. package/api/theme-edit/preview-app/preview-app.mjs +0 -24
  277. package/api/theme-edit/preview-list/preview-list.d.mts +0 -10
  278. package/api/theme-edit/preview-list/preview-list.mjs +0 -21
  279. package/api/theme-edit/preview-remove/preview-remove.d.mts +0 -12
  280. package/api/theme-edit/preview-remove/preview-remove.mjs +0 -23
  281. package/api/theme-edit/set/set.d.mts +0 -13
  282. package/api/theme-edit/set/set.mjs +0 -24
  283. package/api/theme-edit/show/show.d.mts +0 -13
  284. package/api/theme-edit/show/show.mjs +0 -24
  285. package/api/theme-edit/theme-edit.d.mts +0 -12
  286. package/api/theme-edit/theme-edit.mjs +0 -36
  287. package/api/theme-edit/theme-edit.type.d.mts +0 -730
  288. package/api/theme-edit/theme-edit.type.mjs +0 -342
  289. package/api/theme-edit/themeEditHow.doc.d.mts +0 -6
  290. package/api/theme-edit/themeEditHow.doc.mjs +0 -105
  291. package/api/theme-edit/themeEditNew.doc.d.mts +0 -5
  292. package/api/theme-edit/themeEditNew.doc.mjs +0 -112
  293. package/api/theme-edit/themeEditPreviewAdd.doc.d.mts +0 -6
  294. package/api/theme-edit/themeEditPreviewAdd.doc.mjs +0 -121
  295. package/api/theme-edit/themeEditPreviewApp.doc.d.mts +0 -6
  296. package/api/theme-edit/themeEditPreviewApp.doc.mjs +0 -87
  297. package/api/theme-edit/themeEditPreviewList.doc.d.mts +0 -6
  298. package/api/theme-edit/themeEditPreviewList.doc.mjs +0 -62
  299. package/api/theme-edit/themeEditPreviewRemove.doc.d.mts +0 -6
  300. package/api/theme-edit/themeEditPreviewRemove.doc.mjs +0 -96
  301. package/api/theme-edit/themeEditSet.doc.d.mts +0 -6
  302. package/api/theme-edit/themeEditSet.doc.mjs +0 -175
  303. package/api/theme-edit/themeEditShow.doc.d.mts +0 -6
  304. package/api/theme-edit/themeEditShow.doc.mjs +0 -118
  305. package/api/theme-edit/themeEditUndo.doc.d.mts +0 -6
  306. package/api/theme-edit/themeEditUndo.doc.mjs +0 -133
  307. package/api/theme-edit/undo/undo.d.mts +0 -13
  308. package/api/theme-edit/undo/undo.mjs +0 -24
  309. package/assets/preview-app/README.md +0 -6
  310. package/assets/preview-app/css.d.ts +0 -5
  311. package/assets/preview-app/gitignore +0 -4
  312. package/assets/preview-app/next.config.mjs +0 -12
  313. package/assets/preview-app/package.json +0 -24
  314. package/assets/preview-app/src/app/globals.css +0 -6
  315. package/assets/preview-app/src/app/layout.tsx +0 -21
  316. package/assets/preview-app/src/app/page.tsx +0 -94
  317. package/assets/preview-app/src/app/providers.tsx +0 -16
  318. package/assets/preview-app/tsconfig.json +0 -27
  319. package/clients/cli/commands/experimental/theme.mjs +0 -2990
  320. package/clients/cli/commands/experimental-theme-add.doc.mjs +0 -80
  321. package/clients/cli/commands/experimental-theme-compile.doc.mjs +0 -98
  322. package/clients/cli/commands/experimental-theme-editor-how.doc.mjs +0 -196
  323. package/clients/cli/commands/experimental-theme-editor-new.doc.mjs +0 -174
  324. package/clients/cli/commands/experimental-theme-editor-set.doc.mjs +0 -139
  325. package/clients/cli/commands/experimental-theme-editor-show.doc.mjs +0 -77
  326. package/clients/cli/commands/experimental-theme-editor-undo.doc.mjs +0 -105
  327. package/clients/cli/commands/experimental-theme-editor.doc.mjs +0 -49
  328. package/clients/cli/commands/experimental-theme-eject.doc.mjs +0 -72
  329. package/clients/cli/commands/experimental-theme-list.doc.mjs +0 -49
  330. package/clients/cli/commands/experimental-theme-preview-add.doc.mjs +0 -88
  331. package/clients/cli/commands/experimental-theme-preview-app.doc.mjs +0 -61
  332. package/clients/cli/commands/experimental-theme-preview-list.doc.mjs +0 -48
  333. package/clients/cli/commands/experimental-theme-preview-remove.doc.mjs +0 -59
  334. package/clients/cli/commands/experimental-theme-preview.doc.mjs +0 -41
  335. package/clients/cli/commands/experimental-theme-remove.doc.mjs +0 -57
  336. package/clients/cli/commands/experimental-theme-targets.doc.mjs +0 -62
  337. package/clients/cli/commands/experimental-theme-template.doc.mjs +0 -63
  338. package/clients/cli/commands/experimental-theme-use.doc.mjs +0 -57
  339. package/clients/cli/commands/experimental-theme.doc.mjs +0 -60
  340. package/foundation/fonts/fontsource-families.generated.d.mts +0 -5
  341. package/foundation/fonts/fontsource-families.generated.mjs +0 -2110
@@ -96,7 +96,6 @@ import {
96
96
  themeSourceFiles,
97
97
  themeSourceGuesses,
98
98
  buildSuggestion,
99
- generatedSourceCommand,
100
99
  writeDeferredBuildOutputs,
101
100
  } from '../../../api/theme/build/build.mjs';
102
101
  import {
@@ -128,25 +127,12 @@ import {doc as themeTargetsFn} from '../../../api/theme/themeTargets.doc.mjs';
128
127
  import {doc as themePaletteGenerateFn} from '../../../api/theme/themePaletteGenerate.doc.mjs';
129
128
 
130
129
  /**
131
- * The words a theme command is run with: `theme build` here, and the copies
132
- * under `experimental theme`, where `build` is called `compile`. The actions
133
- * and API calls are the same; only these words and the docs differ.
130
+ * The words a theme command is run with, and what the build reads beside a
131
+ * theme file.
134
132
  * @typedef {object} ThemeCommandWords
135
- * @property {string} group - The group's command path: `theme` or `experimental theme`.
136
- * @property {string} build - The build subcommand's name: `build` or `compile`.
137
- * @property {(err: import('../../../api/error.mjs').AstryxError, cwd: string) => import('../../../api/error.mjs').AstryxError | null} [explain] - A clearer refusal for this group, or null.
138
- * @property {(files: string[], options: {cwd: string, check?: boolean, family?: boolean, iconsSpecifier?: string, out?: string}) => Promise<import('../../../api/error.mjs').AstryxError | null>} [preflight] - A refusal before a build starts, or null.
139
- * @property {(err: import('../../../api/error.mjs').AstryxError, cwd: string) => Promise<import('../../../api/error.mjs').AstryxError>} [follow] - The refusal with its first suggested build checked and repaired as the build would check it.
140
- * @property {(file: string, cwd: string) => import('../../../api/theme/build/build.mjs').FontHelp | null} [fontHelp] - How a group says to load a theme's fonts when it loads them itself (the editor's app copy).
141
- * @property {(file: string, cwd: string) => string | null} [install] - How the app takes a theme a group wires another way than importing the build's outputs (the editor's app copy), for the full report.
142
- * @property {(file: string, cwd: string) => string | null} [sourcePath] - The path a source builds under, when not the typed one; null to keep it.
143
- * @property {(files: string[], cwd: string) => Promise<Record<string, Record<string, unknown>>>} [afterBuild] - Writes a group makes once a build's outputs are written (the editor's app copy), with what each did, by file, for its result.
144
- * @property {(files: string[], options: {cwd: string, check?: boolean, out?: string}) => Promise<() => Promise<void>>} [hold] - Locks held while a build or check runs; resolves to their release.
145
- * @property {(file: string, cwd: string, opts: {check: boolean, upToDate?: boolean, out?: string, iconsSpecifier?: string}) => Record<string, unknown> | null | Promise<Record<string, unknown> | null>} [extraData] - Fields a group adds to a build's result data (the editor's `appCopyStale`); in a check, `upToDate: false` fails it.
146
- * @property {(file: string, cwd: string) => (['light'] | ['dark'] | null)} [colorModes] - The one color mode a theme file has that the file itself cannot say, for the build to write into the built module.
133
+ * @property {string} group - The group's command path: `theme`.
134
+ * @property {string} build - The build subcommand's name: `build`.
147
135
  * @property {(file: string, cwd: string) => ((family: string) => boolean) | null | Promise<((family: string) => boolean) | null>} [loadedFonts] - Font families the app loads for a theme file that the file itself cannot say, so the build does not name them as unloaded.
148
- * @property {(file: string, cwd: string) => {name: string, reason: string} | null} [missingSource] - For a source file that is not there, this group's way to write it again, or null.
149
- * @property {(options: {targetPath?: string, overwrite?: boolean, cwd?: string}) => import('../../../api/theme/theme.type.mjs').ThemeTemplateResponse} [template] - This group's template write, in place of `themeTemplate`.
150
136
  */
151
137
 
152
138
  /** @type {ThemeCommandWords} */
@@ -178,115 +164,25 @@ function fontsLoadedBeside(file, cwd) {
178
164
  }
179
165
 
180
166
  /**
181
- * Text as the group that ran the command words it: under `experimental
182
- * theme`, the commands it names are that group's own (`build` is `compile`
183
- * there). Only a command the CLI wrote is reworded: one after the CLI's
184
- * name, or in backticks; text a person typed (a path, a name) stays as
185
- * typed. Under `theme`, the text is unchanged.
186
- * @param {string} text
187
- * @param {ThemeCommandWords} words
188
- */
189
- function inGroupWords(text, words) {
190
- if (words.group === THEME_WORDS.group) return text;
191
- // An argument the person typed can hold the same words (a filter of
192
- // `astryx theme list`); it is echoed as typed. Only an argument with a
193
- // space or a backtick can match, and it is set aside only where the CLI
194
- // echoes it: in double quotes, or as the argument after a subcommand.
195
- const typed = [...new Set(process.argv.slice(2))]
196
- .filter(arg => /[\s`]/.test(arg))
197
- .sort((a, b) => b.length - a.length);
198
- /** @type {string[]} */
199
- const kept = [];
200
- let masked = String(text);
201
- for (const arg of typed) {
202
- const escaped = arg.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
203
- masked = masked.replace(
204
- new RegExp(
205
- `(?<="|\\b(?:add|use|remove|eject|targets|template|build|compile) )${escaped}(?="|\`|\\s|$)`,
206
- 'g',
207
- ),
208
- () => `\uE000${kept.push(arg) - 1}\uE001`,
209
- );
210
- }
211
- return masked
212
- .replace(
213
- /((?:\bastryx|@astryxdesign\/cli@[\w.-]+) |`)theme (add|use|remove|list|build|eject|template|targets)\b/g,
214
- (_, lead, sub) =>
215
- `${lead}${words.group} ${sub === 'build' ? words.build : sub}`,
216
- )
217
- .replace(/\uE000(\d+)\uE001/g, (_, i) => kept[Number(i)]);
218
- }
219
-
220
- /**
221
- * A theme app result with its notes in the words of the group that ran it.
222
- * @template {{data: {notes?: string[]}}} R
223
- * @param {R} result
224
- * @param {ThemeCommandWords} words
225
- * @returns {R}
226
- */
227
- function inGroupNotes(result, words) {
228
- if (!result?.data?.notes || words.group === THEME_WORDS.group) return result;
229
- return {
230
- ...result,
231
- data: {
232
- ...result.data,
233
- notes: result.data.notes.map(n => inGroupWords(n, words)),
234
- },
235
- };
236
- }
237
-
238
- /**
239
- * A theme API refusal as the group that ran it words it: under
240
- * `experimental theme`, the commands it names are that group's own (`build`
241
- * is `compile` there). Under `theme`, the text is unchanged.
242
- * A refusal that names no command gets `fallback`: a command of the same
243
- * group that works whatever went wrong.
167
+ * A theme API refusal. A refusal that names no command gets `fallback`: a
168
+ * theme command that works whatever went wrong.
244
169
  * @param {import('../../../api/error.mjs').AstryxError} err
245
- * @param {ThemeCommandWords} [words]
246
170
  * @param {Array<{name: string, reason?: string}>} [fallback]
247
171
  */
248
- function themeError(err, words = THEME_WORDS, fallback = []) {
249
- err = words.explain?.(err, process.cwd()) ?? err;
250
- /** @param {string} text */
251
- const local = text => inGroupWords(text, words);
172
+ function themeError(err, fallback = []) {
252
173
  const given = err.suggestions || [];
253
174
  // Suggested commands stay bare (`astryx …`): the JSON envelope carries
254
175
  // them so, and the text output starts them the way this project runs the
255
176
  // CLI.
256
- return cliError(local(err.message), {
257
- suggestions: (given.length > 0 ? given : fallback).map(x => ({
258
- ...x,
259
- name: local(x.name),
260
- ...(x.reason ? {reason: local(x.reason)} : {}),
261
- })),
177
+ return cliError(err.message, {
178
+ suggestions: given.length > 0 ? given : fallback,
262
179
  code: err.code,
263
180
  });
264
181
  }
265
182
 
266
- /**
267
- * Add a group's fields to a build's result data. Its warnings and notices
268
- * join the build's own, and are printed as the build's are (`--json`
269
- * prints none).
270
- * @param {Record<string, any>} data
271
- * @param {Record<string, unknown>} extra
272
- */
273
- function mergeResultData(data, extra) {
274
- const {warnings, notices, ...rest} = /** @type {any} */ (extra);
275
- Object.assign(data, rest);
276
- if (Array.isArray(warnings) && warnings.length > 0) {
277
- data.warnings = [...(data.warnings ?? []), ...warnings];
278
- for (const w of warnings) logger.warn(`Warning: ${w}`);
279
- }
280
- if (Array.isArray(notices) && notices.length > 0) {
281
- data.notices = [...(data.notices ?? []), ...notices];
282
- for (const n of notices) logger.log(`[note] ${n}`);
283
- }
284
- }
285
-
286
183
  /**
287
184
  * The builds a quoted glob means: each theme source it matches, or for a
288
- * family run the one family of them, in the caller's mode, each marked for
289
- * the group's checks.
185
+ * family run the one family of them, in the caller's mode.
290
186
  * @param {string} pattern
291
187
  * @param {{out?: string, check?: boolean, iconsSpecifier?: string, family?: boolean, familyKey?: string}} options
292
188
  * @param {ThemeCommandWords} words
@@ -294,35 +190,24 @@ function mergeResultData(data, extra) {
294
190
  function globSuggestions(pattern, options, words) {
295
191
  const sources = globSources(pattern);
296
192
  const reason = `${sources.length > 1 ? 'theme sources' : 'a theme source'} ${pattern} matches (globs are expanded by your shell, not in quotes)`;
297
- const mode = {
298
- check: Boolean(options.check),
299
- iconsSpecifier: options.iconsSpecifier,
300
- };
301
193
  if (options.family)
302
194
  return sources.length
303
195
  ? [
304
- buildRun(
305
- {
306
- name: buildSuggestion(sources, options, process.cwd(), words, {
307
- family: true,
308
- ...(options.familyKey
309
- ? {familyKey: String(options.familyKey)}
310
- : {}),
311
- }),
312
- reason,
313
- },
314
- sources,
315
- {...mode, family: true},
316
- ),
196
+ {
197
+ name: buildSuggestion(sources, options, process.cwd(), words, {
198
+ family: true,
199
+ ...(options.familyKey
200
+ ? {familyKey: String(options.familyKey)}
201
+ : {}),
202
+ }),
203
+ reason,
204
+ },
317
205
  ]
318
206
  : [];
319
- return sources.map(source =>
320
- buildRun(
321
- {name: buildSuggestion(source, options, process.cwd(), words), reason},
322
- [source],
323
- {...mode, family: false, out: options.out},
324
- ),
325
- );
207
+ return sources.map(source => ({
208
+ name: buildSuggestion(source, options, process.cwd(), words),
209
+ reason,
210
+ }));
326
211
  }
327
212
 
328
213
  /**
@@ -359,26 +244,6 @@ function fileStartsWith(file, text) {
359
244
  }
360
245
  }
361
246
 
362
- /** Marks a suggested build with what it builds, for the group's checks. */
363
- const BUILD_RUN = Symbol('build run');
364
-
365
- /**
366
- * A suggested build, marked with the files and mode it builds so the
367
- * group's own checks can vet it before it is shown (the mark is not part of
368
- * what is printed).
369
- * @template {{name: string, reason: string}} S
370
- * @param {S} suggestion
371
- * @param {string[]} files
372
- * @param {{check?: boolean, family?: boolean, iconsSpecifier?: string, out?: string}} mode
373
- * @returns {S}
374
- */
375
- function buildRun(suggestion, files, mode) {
376
- return Object.defineProperty(suggestion, BUILD_RUN, {
377
- value: {files, mode},
378
- enumerable: false,
379
- });
380
- }
381
-
382
247
  /**
383
248
  * A command of this CLI as this project runs it, each argument quoted for the
384
249
  * shell.
@@ -854,7 +719,7 @@ function printThemeApp(result) {
854
719
  if (undo.kept.length > 0)
855
720
  emit(
856
721
  text(
857
- `[note] Kept ${undo.kept.join(', ')}: changed since theme add wrote them.`,
722
+ `[note] Kept the copy of ${change.slug} whole, with its receipt: ${undo.kept.join(', ')} changed since theme add wrote them.`,
858
723
  ),
859
724
  );
860
725
  if (undo.uninstalled.length > 0)
@@ -998,28 +863,12 @@ function printThemeApp(result) {
998
863
  );
999
864
  }
1000
865
 
1001
- /**
1002
- * The base the experimental theme editor can start an ejected theme from,
1003
- * by the editor's own check: the theme's slug when it is a built-in base the
1004
- * editor knows (LIKE) and its package is installed where the command runs
1005
- * (baseInstalled), else neutral. Loaded only for an eject.
1006
- * @param {{slug?: string | null}} data
1007
- * @param {string} cwd
1008
- * @returns {Promise<string>}
1009
- */
1010
- export async function editorBaseFor(data, cwd) {
1011
- if (!data.slug) return 'neutral';
1012
- const {editorBaseIn} = await import('../../../api/theme-edit/_adapter.mjs');
1013
- return editorBaseIn(data.slug, cwd);
1014
- }
1015
-
1016
866
  /**
1017
867
  * Print every field in a source-fork receipt.
1018
868
  * @param {import('../../../api/theme/theme.type.mjs').ThemeEjectResponse} result
1019
869
  * @param {ThemeCommandWords} [words]
1020
- * @param {string} [like] the base the theme editor line starts from
1021
870
  */
1022
- function printThemeEject(result, words = THEME_WORDS, like = 'neutral') {
871
+ function printThemeEject(result, words = THEME_WORDS) {
1023
872
  const {data} = result;
1024
873
  emit(
1025
874
  section('Ejected theme'),
@@ -1049,12 +898,6 @@ function printThemeEject(result, words = THEME_WORDS, like = 'neutral') {
1049
898
  text(
1050
899
  `This is a local fork. Build it with ${buildStep(getCliInvocation(), words, path.join(data.outputDir, data.entry))}.`,
1051
900
  ),
1052
- // One theme-only line (AST-017 FR27): the editor builds only on an
1053
- // Astryx theme package, so a theme from another package starts from
1054
- // neutral.
1055
- text(
1056
- `To make or change a theme: the experimental theme editor, ${getCliInvocation()} experimental theme editor new <name> --like ${like}.`,
1057
- ),
1058
901
  );
1059
902
  }
1060
903
 
@@ -1083,9 +926,9 @@ function buildStep(invocation, words, file) {
1083
926
  }
1084
927
 
1085
928
  /**
1086
- * The CommandDocs one copy of the theme subcommands is built from.
929
+ * The CommandDocs the theme subcommands are built from.
1087
930
  * @typedef {object} ThemeCommandDocs
1088
- * @property {import('@astryxdesign/cli/authoring').CommandDoc} [palette] - With `paletteGenerate`; a copy without them has no palette commands.
931
+ * @property {import('@astryxdesign/cli/authoring').CommandDoc} [palette] - With `paletteGenerate`; without them there are no palette commands.
1089
932
  * @property {import('@astryxdesign/cli/authoring').CommandDoc} [paletteGenerate]
1090
933
  * @property {import('@astryxdesign/cli/authoring').CommandDoc} build
1091
934
  * @property {import('@astryxdesign/cli/authoring').CommandDoc} list
@@ -1131,7 +974,6 @@ export function registerTheme(program) {
1131
974
  (theme.commands || [])
1132
975
  .filter(c => commandAvailable(c, helpBase()))
1133
976
  .map(c => c.name()),
1134
- theme,
1135
977
  );
1136
978
  return cliError(message, {
1137
979
  suggestions,
@@ -1179,9 +1021,8 @@ export function registerTheme(program) {
1179
1021
 
1180
1022
  /**
1181
1023
  * Register the theme subcommands under a group: palette (generate) when its
1182
- * docs are given, build, list, add, remove, use, eject, template and targets. `astryx theme` and the
1183
- * copies under `astryx experimental theme` share these actions and their API
1184
- * calls; `docs` and `words` give each copy its own names.
1024
+ * docs are given, build, list, add, remove, use, eject, template and targets,
1025
+ * with the names `docs` and `words` give.
1185
1026
  * @param {import('commander').Command} theme the group to register under
1186
1027
  * @param {import('commander').Command} program the root program
1187
1028
  * @param {ThemeCommandDocs} docs
@@ -1254,7 +1095,7 @@ function registerPaletteCommands(
1254
1095
  } catch (error) {
1255
1096
  const err =
1256
1097
  /** @type {import('../../../api/error.mjs').AstryxError} */ (error);
1257
- return themeError(err, words);
1098
+ return themeError(err);
1258
1099
  }
1259
1100
 
1260
1101
  // Generating a palette computes and writes candidate files; the numbers
@@ -1295,10 +1136,6 @@ function registerPaletteCommands(
1295
1136
  text(
1296
1137
  'Review and edit the candidate before adopting it as theme-owned palette data.',
1297
1138
  ),
1298
- // One theme-only line (AST-017 FR27).
1299
- text(
1300
- `To make or change a theme: the experimental theme editor makes the palettes from one color, ${getCliInvocation(process.cwd())} experimental theme editor set <name> accent <color>.`,
1301
- ),
1302
1139
  );
1303
1140
  return NO_RESULT_SET;
1304
1141
  },
@@ -1313,54 +1150,31 @@ function registerPaletteCommands(
1313
1150
  * @param {ThemeCommandWords} words
1314
1151
  */
1315
1152
  function registerThemeCommands(theme, program, docs, words) {
1316
- /** The locks the group holds for one build run (see words.hold below). */
1317
- /** @type {(() => Promise<void>) | undefined} */
1318
- let release;
1319
1153
  const buildAction = async (
1320
- /** @type {string[]} */ typedFiles,
1154
+ /** @type {string[]} */ files,
1321
1155
  /** @type {{out?: string, watch?: boolean, check?: boolean, iconsSpecifier?: string, family?: boolean, familyKey?: string}} */ options,
1322
1156
  ) => {
1323
- // A group may name the path a source builds under (an editor theme
1324
- // reached through a link builds under its own path, which its
1325
- // outputs' headers name).
1326
- const files = typedFiles.map(
1327
- file => words.sourcePath?.(file, process.cwd()) ?? file,
1328
- );
1329
- // Every suggested build passes the group's own checks before it is
1330
- // shown (from a subfolder an editor theme compiles from the app
1331
- // root): a suggestion the group refuses gives way to the group's own
1332
- // suggestion, which does.
1333
- /** @param {Array<{name: string, reason?: string}> | undefined} list */
1334
- const vet = async list => {
1335
- /** @type {Array<{name: string, reason?: string}>} */
1336
- const out = [];
1337
- for (const s of list ?? []) {
1338
- const run = /** @type {any} */ (s)[BUILD_RUN];
1339
- const refused = run
1340
- ? await words.preflight?.(run.files, {
1341
- cwd: process.cwd(),
1342
- ...run.mode,
1343
- })
1344
- : null;
1345
- out.push(...(refused ? (refused.suggestions ?? []) : [s]));
1346
- }
1347
- // Two guesses can lead to the same line: it is offered once.
1348
- return out.filter((s, i) => out.findIndex(x => x.name === s.name) === i);
1349
- };
1157
+ /**
1158
+ * Two guesses can lead to the same line: it is offered once.
1159
+ * @param {Array<{name: string, reason?: string}> | undefined} list
1160
+ */
1161
+ const once = list =>
1162
+ (list ?? []).filter(
1163
+ (s, i, all) => all.findIndex(x => x.name === s.name) === i,
1164
+ );
1350
1165
  /** @param {string} message @param {Parameters<typeof cliError>[1]} [opts] */
1351
1166
  const refuse = async (message, opts = {}) =>
1352
1167
  cliError(message, {
1353
1168
  ...opts,
1354
- suggestions: await vet(opts.suggestions),
1169
+ suggestions: once(opts.suggestions),
1355
1170
  });
1356
1171
  /**
1357
1172
  * @param {import('../../../api/error.mjs').AstryxError} err
1358
- * @param {ThemeCommandWords} [w]
1359
1173
  * @param {Array<{name: string, reason?: string}>} [fallback]
1360
1174
  */
1361
- const refuseTheme = async (err, w = words, fallback = []) => {
1362
- err.suggestions = await vet(err.suggestions);
1363
- return themeError(err, w, await vet(fallback));
1175
+ const refuseTheme = async (err, fallback = []) => {
1176
+ err.suggestions = once(err.suggestions);
1177
+ return themeError(err, once(fallback));
1364
1178
  };
1365
1179
 
1366
1180
  const json = program.opts().json || false;
@@ -1384,75 +1198,26 @@ function registerThemeCommands(theme, program, docs, words) {
1384
1198
  const guesses = looksGlobby
1385
1199
  ? []
1386
1200
  : themeSourceGuesses(entry.file, process.cwd());
1387
- // An editor theme's own source, deleted by hand: the editor writes
1388
- // it again.
1389
- const rewrite = looksGlobby
1390
- ? null
1391
- : (words.missingSource?.(entry.file, process.cwd()) ?? null);
1392
- // A file another command generates, gone from a folder whose other
1393
- // files carry that command's mark: that command writes it again; a
1394
- // blank theme template is no way back. A theme source that exists
1395
- // near the name given is what it meant instead.
1396
- const by =
1397
- rewrite || looksGlobby || guesses.length > 0
1398
- ? null
1399
- : generatedSourceCommand(entry.filePath);
1400
- if (by)
1401
- return await refuse(
1402
- `File not found: ${entry.filePath}. It is a generated file: the files beside it are written by ${by}, so rebuild it with the command that made it.`,
1403
- {
1404
- code: ERROR_CODES.ERR_FILE_NOT_FOUND,
1405
- suggestions: /^astryx(\s|$)/.test(by)
1406
- ? [
1407
- {
1408
- name: `${getCliInvocation(process.cwd())} ${by.replace(/^astryx\s*/, '')}`.trim(),
1409
- reason: 'the command that writes these files',
1410
- },
1411
- ]
1412
- : [],
1413
- },
1414
- );
1415
1201
  return await refuse(`File not found: ${entry.filePath}`, {
1416
1202
  code: ERROR_CODES.ERR_FILE_NOT_FOUND,
1417
- suggestions: rewrite
1418
- ? [rewrite]
1419
- : looksGlobby
1420
- ? // The pattern, expanded as the shell would: the theme
1421
- // sources it matches, each a build the checks then vet (an
1422
- // editor theme's own files give way to its source); a
1423
- // family run, the one family of them.
1424
- globSuggestions(entry.file, options, words)
1425
- : guesses.length > 0
1426
- ? guesses.map(guess =>
1427
- buildRun(
1428
- {
1429
- // The same build of that source: a --check stays a
1430
- // check.
1431
- name: buildSuggestion(
1432
- guess,
1433
- options,
1434
- process.cwd(),
1435
- words,
1436
- ),
1437
- reason: 'a theme source that exists',
1438
- },
1439
- [guess],
1440
- {
1441
- check: Boolean(options.check),
1442
- family: Boolean(options.family),
1443
- iconsSpecifier: options.iconsSpecifier,
1444
- out: options.out,
1445
- },
1446
- ),
1447
- )
1448
- : [
1449
- themeCommand(
1450
- words,
1451
- 'template',
1452
- ['theme.template.ts'],
1453
- 'start a theme source from the annotated template',
1454
- ),
1455
- ],
1203
+ suggestions: looksGlobby
1204
+ ? // The pattern, expanded as the shell would: the theme sources it
1205
+ // matches; a family run, the one family of them.
1206
+ globSuggestions(entry.file, options, words)
1207
+ : guesses.length > 0
1208
+ ? guesses.map(guess => ({
1209
+ // The same build of that source: a --check stays a check.
1210
+ name: buildSuggestion(guess, options, process.cwd(), words),
1211
+ reason: 'a theme source that exists',
1212
+ }))
1213
+ : [
1214
+ themeCommand(
1215
+ words,
1216
+ 'template',
1217
+ ['theme.template.ts'],
1218
+ 'start a theme source from the annotated template',
1219
+ ),
1220
+ ],
1456
1221
  });
1457
1222
  }
1458
1223
 
@@ -1464,32 +1229,23 @@ function registerThemeCommands(theme, program, docs, words) {
1464
1229
  * @param {string[]} [only] the files to build, when not all of them
1465
1230
  */
1466
1231
  const buildWithout = (drop, reason, only = files) =>
1467
- buildRun(
1468
- themeCommand(
1469
- words,
1470
- words.build,
1471
- [
1472
- ...(options.family && !drop.includes('family')
1473
- ? ['--family', ...only, '--family-key', String(options.familyKey)]
1474
- : only),
1475
- ...(options.out && !drop.includes('out')
1476
- ? ['--out', options.out]
1477
- : []),
1478
- ...(options.check && !drop.includes('check') ? ['--check'] : []),
1479
- ...(options.watch && !drop.includes('watch') ? ['--watch'] : []),
1480
- ...(options.iconsSpecifier
1481
- ? ['--icons-specifier', options.iconsSpecifier]
1482
- : []),
1483
- ],
1484
- reason,
1485
- ),
1486
- only,
1487
- {
1488
- check: Boolean(options.check) && !drop.includes('check'),
1489
- family: Boolean(options.family) && !drop.includes('family'),
1490
- iconsSpecifier: options.iconsSpecifier,
1491
- out: drop.includes('out') ? undefined : options.out,
1492
- },
1232
+ themeCommand(
1233
+ words,
1234
+ words.build,
1235
+ [
1236
+ ...(options.family && !drop.includes('family')
1237
+ ? ['--family', ...only, '--family-key', String(options.familyKey)]
1238
+ : only),
1239
+ ...(options.out && !drop.includes('out')
1240
+ ? ['--out', options.out]
1241
+ : []),
1242
+ ...(options.check && !drop.includes('check') ? ['--check'] : []),
1243
+ ...(options.watch && !drop.includes('watch') ? ['--watch'] : []),
1244
+ ...(options.iconsSpecifier
1245
+ ? ['--icons-specifier', options.iconsSpecifier]
1246
+ : []),
1247
+ ],
1248
+ reason,
1493
1249
  );
1494
1250
 
1495
1251
  // A refusal from the build that names no command: without --out the
@@ -1543,30 +1299,21 @@ function registerThemeCommands(theme, program, docs, words) {
1543
1299
  {
1544
1300
  code: ERROR_CODES.ERR_THEME_INVALID,
1545
1301
  suggestions: [
1546
- buildRun(
1547
- themeCommand(
1548
- words,
1549
- words.build,
1550
- [
1551
- ...files,
1552
- // --out names one output, so it goes with one file only.
1553
- ...(options.out && files.length === 1
1554
- ? ['--out', options.out]
1555
- : []),
1556
- ...(options.iconsSpecifier
1557
- ? ['--icons-specifier', options.iconsSpecifier]
1558
- : []),
1559
- ...(options.check ? ['--check'] : []),
1560
- ],
1561
- 'build each theme on its own',
1562
- ),
1563
- files,
1564
- {
1565
- check: Boolean(options.check),
1566
- family: false,
1567
- iconsSpecifier: options.iconsSpecifier,
1568
- out: files.length === 1 ? options.out : undefined,
1569
- },
1302
+ themeCommand(
1303
+ words,
1304
+ words.build,
1305
+ [
1306
+ ...files,
1307
+ // --out names one output, so it goes with one file only.
1308
+ ...(options.out && files.length === 1
1309
+ ? ['--out', options.out]
1310
+ : []),
1311
+ ...(options.iconsSpecifier
1312
+ ? ['--icons-specifier', options.iconsSpecifier]
1313
+ : []),
1314
+ ...(options.check ? ['--check'] : []),
1315
+ ],
1316
+ 'build each theme on its own',
1570
1317
  ),
1571
1318
  ],
1572
1319
  },
@@ -1653,20 +1400,6 @@ function registerThemeCommands(theme, program, docs, words) {
1653
1400
  });
1654
1401
  }
1655
1402
 
1656
- const refused = await words.preflight?.(files, {
1657
- cwd: process.cwd(),
1658
- check: options.check,
1659
- family: Boolean(options.family),
1660
- iconsSpecifier: options.iconsSpecifier,
1661
- out: options.out,
1662
- });
1663
- if (refused)
1664
- return await refuseTheme(
1665
- (await words.follow?.(refused, process.cwd())) ?? refused,
1666
- words,
1667
- buildFallback,
1668
- );
1669
-
1670
1403
  if (options.family) {
1671
1404
  try {
1672
1405
  const result = await themeBuildFamily(
@@ -1694,7 +1427,7 @@ function registerThemeCommands(theme, program, docs, words) {
1694
1427
  } catch (e) {
1695
1428
  const err =
1696
1429
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1697
- return await refuseTheme(err, words, [
1430
+ return await refuseTheme(err, [
1698
1431
  buildWithout(['family'], 'build each theme on its own'),
1699
1432
  ]);
1700
1433
  }
@@ -1727,7 +1460,6 @@ function registerThemeCommands(theme, program, docs, words) {
1727
1460
  const writeFailed = async (/** @type {unknown} */ error) =>
1728
1461
  refuseTheme(
1729
1462
  /** @type {import('../../../api/error.mjs').AstryxError} */ (error),
1730
- words,
1731
1463
  [
1732
1464
  buildWithout(
1733
1465
  [],
@@ -1744,21 +1476,11 @@ function registerThemeCommands(theme, program, docs, words) {
1744
1476
  const writes = [];
1745
1477
  const log = logger.log;
1746
1478
  const warn = logger.warn;
1747
- // A group may know fonts the app loads that the theme file cannot
1748
- // say (the editor's app copy stylesheet): the build leaves them out
1749
- // of every "not loaded" note, family by family.
1479
+ // The fonts the app loads that the theme file cannot say (the font
1480
+ // stylesheet beside a local theme): the build leaves them out of
1481
+ // every "not loaded" note, family by family.
1750
1482
  const loads =
1751
1483
  (await words.loadedFonts?.(entry.file, process.cwd())) ?? null;
1752
- // A check whose result a group may still fail holds its lines
1753
- // until the group has looked.
1754
- /** @type {Array<string | undefined> | null} */
1755
- let held = null;
1756
- if (options.check && words.extraData && !deferred) {
1757
- held = [];
1758
- logger.log = (/** @type {string | undefined} */ message) => {
1759
- held?.push(message);
1760
- };
1761
- }
1762
1484
  if (deferred) {
1763
1485
  logger.log = (/** @type {string | undefined} */ message) => {
1764
1486
  lines.push(() => log.call(logger, message));
@@ -1778,9 +1500,6 @@ function registerThemeCommands(theme, program, docs, words) {
1778
1500
  claimedOutputs,
1779
1501
  deferredWrites: deferred ? writes : undefined,
1780
1502
  commandWords: words,
1781
- colorModes: words.colorModes?.(entry.file, process.cwd()) ?? null,
1782
- fontHelp: words.fontHelp?.(entry.file, process.cwd()) ?? null,
1783
- install: words.install?.(entry.file, process.cwd()) ?? null,
1784
1503
  loadedFonts: loads,
1785
1504
  };
1786
1505
  let result;
@@ -1815,29 +1534,6 @@ function registerThemeCommands(theme, program, docs, words) {
1815
1534
  }
1816
1535
  logger.log = log;
1817
1536
  logger.warn = warn;
1818
- // A group may add to a build's result (the editor's app copy:
1819
- // what keeps it behind, and in a check whether it is current).
1820
- const extra = await words.extraData?.(entry.file, process.cwd(), {
1821
- check: Boolean(options.check),
1822
- upToDate: /** @type {any} */ (result)?.data?.upToDate,
1823
- out: options.out,
1824
- iconsSpecifier: options.iconsSpecifier,
1825
- });
1826
- if (extra && result?.data) mergeResultData(result.data, extra);
1827
- // A check the group failed says so where the check said ok.
1828
- if (held) {
1829
- logger.log = log;
1830
- for (const line of held)
1831
- log.call(
1832
- logger,
1833
- extra?.upToDate === false &&
1834
- typeof line === 'string' &&
1835
- /^\s*\[ok\]/.test(line)
1836
- ? `[fail] ${String(extra.appCopyStale ?? 'not up to date')}`
1837
- : line,
1838
- );
1839
- held = null;
1840
- }
1841
1537
  results.push({file: entry.file, receipt: result ?? null});
1842
1538
  if (deferred) built.push({writes, lines});
1843
1539
  if (
@@ -1851,8 +1547,6 @@ function registerThemeCommands(theme, program, docs, words) {
1851
1547
  } catch (e) {
1852
1548
  logger.log = log;
1853
1549
  logger.warn = warn;
1854
- for (const line of held ?? []) log.call(logger, line);
1855
- held = null;
1856
1550
  const err =
1857
1551
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
1858
1552
  // Stop at the first failure, as a shell loop under `set -e` does.
@@ -1862,7 +1556,7 @@ function registerThemeCommands(theme, program, docs, words) {
1862
1556
  if (/** @type {any} */ (err).outputCollision) {
1863
1557
  // Nothing is written, so only this theme's warnings are shown.
1864
1558
  for (const show of lines) show();
1865
- return await refuseTheme(err, words, [
1559
+ return await refuseTheme(err, [
1866
1560
  buildWithout([], 'build the first theme on its own', [
1867
1561
  entries[0].file,
1868
1562
  ]),
@@ -1898,13 +1592,7 @@ function registerThemeCommands(theme, program, docs, words) {
1898
1592
  /\s*Nothing was written\.?$/,
1899
1593
  ` Nothing was written for ${entry.file}.`,
1900
1594
  )} The themes before it were built and written: ${written.join(', ')}.`;
1901
- return await refuseTheme(
1902
- entries.length === 1
1903
- ? ((await words.follow?.(err, process.cwd())) ?? err)
1904
- : err,
1905
- words,
1906
- buildFallback,
1907
- );
1595
+ return await refuseTheme(err, buildFallback);
1908
1596
  }
1909
1597
  }
1910
1598
  if (deferred) {
@@ -1914,18 +1602,6 @@ function registerThemeCommands(theme, program, docs, words) {
1914
1602
  return writeFailed(e);
1915
1603
  }
1916
1604
  }
1917
- // A group follows the written outputs with writes of its own (the
1918
- // editor's app copy), and each result says what they did.
1919
- if (words.afterBuild && !options.check) {
1920
- const more = await words.afterBuild(
1921
- results.map(r => r.file),
1922
- process.cwd(),
1923
- );
1924
- for (const r of results) {
1925
- const data = /** @type {any} */ (r.receipt)?.data;
1926
- if (data && more[r.file]) mergeResultData(data, more[r.file]);
1927
- }
1928
- }
1929
1605
 
1930
1606
  if (json) {
1931
1607
  // One theme keeps the single-envelope contract it has always had; a
@@ -1966,38 +1642,10 @@ function registerThemeCommands(theme, program, docs, words) {
1966
1642
  // are effects — the receipt (and the exit code) carry the outcome.
1967
1643
  return NO_RESULT_SET;
1968
1644
  };
1969
- const buildCli = defineCommand(theme, docs.build, {
1645
+ defineCommand(theme, docs.build, {
1970
1646
  fn: themeBuildFn,
1971
- // The locks taken for the run go when the action ends, however it ends:
1972
- // a refusal that exits releases them on exit, and a run in process
1973
- // (which has no exit) here.
1974
- action: async (
1975
- /** @type {string[]} */ typedFiles,
1976
- /** @type {any} */ options,
1977
- ) => {
1978
- try {
1979
- return await buildAction(typedFiles, options);
1980
- } finally {
1981
- await release?.();
1982
- release = undefined;
1983
- }
1984
- },
1647
+ action: buildAction,
1985
1648
  });
1986
- // A group may hold locks while a build or check runs (the editor's theme
1987
- // lock), so it never reads a change half written.
1988
- if (words.hold) {
1989
- buildCli.hook('preAction', async (_, cmd) => {
1990
- // Under --watch each rebuild runs on its own and takes the locks
1991
- // itself; holding them for the whole watch would block every one.
1992
- if (cmd.opts().watch) return;
1993
- const o = cmd.opts();
1994
- release = await words.hold?.(cmd.args, {
1995
- cwd: process.cwd(),
1996
- check: Boolean(o.check),
1997
- out: o.out,
1998
- });
1999
- });
2000
- }
2001
1649
 
2002
1650
  const listCli = defineCommand(theme, docs.list, {
2003
1651
  fn: themeListFn,
@@ -2013,7 +1661,7 @@ function registerThemeCommands(theme, program, docs, words) {
2013
1661
  } catch (e) {
2014
1662
  const err =
2015
1663
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2016
- return themeError(err, words, [
1664
+ return themeError(err, [
2017
1665
  options.package
2018
1666
  ? themeCommand(words, 'list', [], 'every theme, from every package')
2019
1667
  : {
@@ -2067,7 +1715,7 @@ function registerThemeCommands(theme, program, docs, words) {
2067
1715
  } catch (e) {
2068
1716
  const err =
2069
1717
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2070
- return themeError(err, words, [
1718
+ return themeError(err, [
2071
1719
  themeCommand(words, 'list', [], 'the themes you can add'),
2072
1720
  ]);
2073
1721
  }
@@ -2078,10 +1726,6 @@ function registerThemeCommands(theme, program, docs, words) {
2078
1726
  ? resultSet({count: result.data.length, resultKind: 'theme'})
2079
1727
  : NO_RESULT_SET;
2080
1728
 
2081
- if (result.type !== 'theme.list')
2082
- result = /** @type {any} */ (
2083
- inGroupNotes(/** @type {any} */ (result), words)
2084
- );
2085
1729
  if (json) {
2086
1730
  jsonOut(result);
2087
1731
  return answered;
@@ -2108,12 +1752,11 @@ function registerThemeCommands(theme, program, docs, words) {
2108
1752
  } catch (e) {
2109
1753
  const err =
2110
1754
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2111
- return themeError(err, words, [
1755
+ return themeError(err, [
2112
1756
  themeCommand(words, 'list', [], 'the themes this app has added'),
2113
1757
  ]);
2114
1758
  }
2115
1759
  await warnOnThemeIntegrationIssues(json);
2116
- result = inGroupNotes(result, words);
2117
1760
  if (json) jsonOut(result);
2118
1761
  else printThemeApp(result);
2119
1762
  return NO_RESULT_SET;
@@ -2131,12 +1774,11 @@ function registerThemeCommands(theme, program, docs, words) {
2131
1774
  } catch (e) {
2132
1775
  const err =
2133
1776
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2134
- return themeError(err, words, [
1777
+ return themeError(err, [
2135
1778
  themeCommand(words, 'list', [], 'the themes this app has added'),
2136
1779
  ]);
2137
1780
  }
2138
1781
  await warnOnThemeIntegrationIssues(json);
2139
- result = inGroupNotes(result, words);
2140
1782
  if (json) jsonOut(result);
2141
1783
  else printThemeApp(result);
2142
1784
  return NO_RESULT_SET;
@@ -2166,18 +1808,13 @@ function registerThemeCommands(theme, program, docs, words) {
2166
1808
  } catch (e) {
2167
1809
  const err =
2168
1810
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2169
- return themeError(err, words, [
1811
+ return themeError(err, [
2170
1812
  themeCommand(words, 'list', [], 'the themes you can fork'),
2171
1813
  ]);
2172
1814
  }
2173
1815
  await warnOnThemeIntegrationIssues(json);
2174
1816
  if (json) jsonOut(result);
2175
- else
2176
- printThemeEject(
2177
- result,
2178
- words,
2179
- await editorBaseFor(result.data, process.cwd()),
2180
- );
1817
+ else printThemeEject(result, words);
2181
1818
  return NO_RESULT_SET;
2182
1819
  },
2183
1820
  });
@@ -2193,9 +1830,7 @@ function registerThemeCommands(theme, program, docs, words) {
2193
1830
  /** @type {import('../../../api/theme/theme.type.mjs').ThemeTemplateResponse} */
2194
1831
  let result;
2195
1832
  try {
2196
- // The experimental command passes its own write, which protects
2197
- // only the editor's own files.
2198
- result = (words.template ?? themeTemplate)({
1833
+ result = themeTemplate({
2199
1834
  targetPath,
2200
1835
  overwrite: options.overwrite,
2201
1836
  cwd: process.cwd(),
@@ -2203,7 +1838,7 @@ function registerThemeCommands(theme, program, docs, words) {
2203
1838
  } catch (e) {
2204
1839
  const err =
2205
1840
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2206
- return themeError(err, words, [
1841
+ return themeError(err, [
2207
1842
  // No path: the template at the project root, from any folder.
2208
1843
  themeCommand(
2209
1844
  words,
@@ -2268,7 +1903,7 @@ function registerThemeCommands(theme, program, docs, words) {
2268
1903
  } catch (e) {
2269
1904
  const err =
2270
1905
  /** @type {import('../../../api/error.mjs').AstryxError} */ (e);
2271
- return themeError(err, words, [
1906
+ return themeError(err, [
2272
1907
  themeCommand(words, 'targets', [], 'every theming target'),
2273
1908
  ]);
2274
1909
  }