basalt-ui 3.0.0 → 3.1.0

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 (512) hide show
  1. package/AGENTS.md +1 -0
  2. package/CHANGELOG.md +72 -39
  3. package/MIGRATING.md +44 -2
  4. package/README.md +39 -12
  5. package/agent/rules/basalt-tokens.md +1 -1
  6. package/agent/rules/basalt-ui.md +3 -3
  7. package/agent/skills/basalt-app/references/live.md +4 -4
  8. package/agent/skills/basalt-app/references/migrate.md +2 -2
  9. package/agent/skills/basalt-app/references/setup.md +17 -8
  10. package/agent/skills/basalt-app/references/testing.md +8 -6
  11. package/agent/skills/basalt-design/SKILL.md +2 -1
  12. package/agent/skills/basalt-design/references/controls.md +1 -0
  13. package/agent/skills/basalt-design/references/parts.md +5 -1
  14. package/agent/templates/AGENTS-block.md.tpl +6 -23
  15. package/agent/templates/AGENTS-block.site.md.tpl +5 -18
  16. package/agent/templates/AGENTS-block.tokens.md.tpl +3 -7
  17. package/agent/templates/DESIGN.md.tpl +1 -1
  18. package/agent/templates/_app-error.i18n.tpl +8 -32
  19. package/agent/templates/_app-error.tpl +8 -32
  20. package/agent/templates/_app-pending.i18n.tpl +5 -3
  21. package/agent/templates/_app-pending.tpl +5 -4
  22. package/agent/templates/main.i18n.tpl +8 -3
  23. package/agent/templates/main.tpl +8 -3
  24. package/agent/templates/router.start.tpl +8 -3
  25. package/agent/templates/seed-messages.json +0 -30
  26. package/configs/oxlint-app.json +9 -1
  27. package/configs/oxlint-bridge.json +3 -1
  28. package/configs/oxlint-parts.json +9 -1
  29. package/configs/oxlint-site.json +3 -1
  30. package/dist/astro/shiki.d.ts +3 -2
  31. package/dist/astro/shiki.d.ts.map +1 -1
  32. package/dist/cards/bar-list.d.ts.map +1 -1
  33. package/dist/cards/bar-list.js +2 -1
  34. package/dist/cards/chain-view.d.ts +37 -8
  35. package/dist/cards/chain-view.d.ts.map +1 -1
  36. package/dist/cards/chain-view.js +105 -38
  37. package/dist/cards/contract.d.ts +8 -1
  38. package/dist/cards/contract.d.ts.map +1 -1
  39. package/dist/cards/data-panel.d.ts.map +1 -1
  40. package/dist/cards/data-panel.js +1 -0
  41. package/dist/cards/event-list.d.ts.map +1 -1
  42. package/dist/cards/event-list.js +3 -2
  43. package/dist/cards/index.d.ts +1 -1
  44. package/dist/cards/index.d.ts.map +1 -1
  45. package/dist/cards/row-list.d.ts.map +1 -1
  46. package/dist/cards/row-list.js +2 -1
  47. package/dist/cards/stat-card-parts.d.ts +3 -3
  48. package/dist/cards/stat-card-parts.d.ts.map +1 -1
  49. package/dist/cards/stat-card-parts.js +8 -2
  50. package/dist/cards/stat-card.d.ts.map +1 -1
  51. package/dist/cards/stat-card.js +34 -9
  52. package/dist/charts/core/compile.d.ts +2 -0
  53. package/dist/charts/core/compile.d.ts.map +1 -1
  54. package/dist/charts/core/compile.js +16 -8
  55. package/dist/charts/core/cursor.d.ts +2 -1
  56. package/dist/charts/core/cursor.d.ts.map +1 -1
  57. package/dist/charts/core/cursor.js +8 -1
  58. package/dist/charts/core/tooltip-said.d.ts +16 -0
  59. package/dist/charts/core/tooltip-said.d.ts.map +1 -0
  60. package/dist/charts/core/tooltip-said.js +39 -0
  61. package/dist/charts/focus.d.ts.map +1 -1
  62. package/dist/charts/focus.js +1 -1
  63. package/dist/charts/parts/chart-card.d.ts.map +1 -1
  64. package/dist/charts/parts/chart-card.js +1 -0
  65. package/dist/cli/agent-note.d.ts +3 -3
  66. package/dist/cli/agent-note.d.ts.map +1 -1
  67. package/dist/cli/agent-note.js +5 -5
  68. package/dist/cli/budget/index.d.ts +7 -0
  69. package/dist/cli/budget/index.d.ts.map +1 -1
  70. package/dist/cli/budget/index.js +11 -5
  71. package/dist/cli/config.d.ts +1 -1
  72. package/dist/cli/doctor/app.d.ts.map +1 -1
  73. package/dist/cli/doctor/app.js +53 -24
  74. package/dist/cli/doctor/eject.d.ts.map +1 -1
  75. package/dist/cli/doctor/eject.js +16 -9
  76. package/dist/cli/doctor/guards.d.ts.map +1 -1
  77. package/dist/cli/doctor/guards.js +11 -8
  78. package/dist/cli/doctor/hook.js +1 -1
  79. package/dist/cli/doctor/install.d.ts.map +1 -1
  80. package/dist/cli/doctor/install.js +46 -22
  81. package/dist/cli/doctor/translations.d.ts.map +1 -1
  82. package/dist/cli/doctor/translations.js +11 -4
  83. package/dist/cli/doctor/types.d.ts +2 -2
  84. package/dist/cli/doctor/types.d.ts.map +1 -1
  85. package/dist/cli/doctor/types.js +1 -1
  86. package/dist/cli/doctor/wiring.d.ts.map +1 -1
  87. package/dist/cli/doctor/wiring.js +26 -15
  88. package/dist/cli/eject/dropped-slots.d.ts +6 -0
  89. package/dist/cli/eject/dropped-slots.d.ts.map +1 -0
  90. package/dist/cli/eject/dropped-slots.js +9 -0
  91. package/dist/cli/eject/index.d.ts.map +1 -1
  92. package/dist/cli/eject/index.js +9 -8
  93. package/dist/cli/help.d.ts.map +1 -1
  94. package/dist/cli/help.js +7 -2
  95. package/dist/cli/index.d.ts +6 -5
  96. package/dist/cli/index.d.ts.map +1 -1
  97. package/dist/cli/index.js +38 -7
  98. package/dist/cli/init/index.d.ts +10 -0
  99. package/dist/cli/init/index.d.ts.map +1 -1
  100. package/dist/cli/init/index.js +61 -10
  101. package/dist/cli/init/locales.d.ts +7 -0
  102. package/dist/cli/init/locales.d.ts.map +1 -1
  103. package/dist/cli/init/locales.js +21 -6
  104. package/dist/cli/init/router-seeds.d.ts.map +1 -1
  105. package/dist/cli/init/router-seeds.js +16 -3
  106. package/dist/cli/init/steps.d.ts +36 -3
  107. package/dist/cli/init/steps.d.ts.map +1 -1
  108. package/dist/cli/init/steps.js +201 -34
  109. package/dist/cli/lint/baseline.d.ts +27 -0
  110. package/dist/cli/lint/baseline.d.ts.map +1 -0
  111. package/dist/cli/lint/baseline.js +96 -0
  112. package/dist/cli/lint/engine.d.ts +2 -0
  113. package/dist/cli/lint/engine.d.ts.map +1 -1
  114. package/dist/cli/lint/engine.js +18 -8
  115. package/dist/cli/lint/hook.d.ts.map +1 -1
  116. package/dist/cli/lint/hook.js +8 -3
  117. package/dist/cli/lint/index.d.ts +3 -0
  118. package/dist/cli/lint/index.d.ts.map +1 -1
  119. package/dist/cli/lint/index.js +67 -8
  120. package/dist/cli/manifest.d.ts +46 -3
  121. package/dist/cli/manifest.d.ts.map +1 -1
  122. package/dist/cli/manifest.js +71 -1
  123. package/dist/cli/migrate/census.d.ts +6 -0
  124. package/dist/cli/migrate/census.d.ts.map +1 -1
  125. package/dist/cli/migrate/census.js +22 -1
  126. package/dist/cli/migrate/index.d.ts +5 -0
  127. package/dist/cli/migrate/index.d.ts.map +1 -1
  128. package/dist/cli/migrate/index.js +36 -3
  129. package/dist/cli/migrate/lost-classes.d.ts +20 -0
  130. package/dist/cli/migrate/lost-classes.d.ts.map +1 -0
  131. package/dist/cli/migrate/lost-classes.js +145 -0
  132. package/dist/cli/migrate/rows.d.ts +10 -0
  133. package/dist/cli/migrate/rows.d.ts.map +1 -1
  134. package/dist/cli/migrate/rows.js +15 -0
  135. package/dist/cli/package-manager.d.ts.map +1 -1
  136. package/dist/cli/package-manager.js +2 -1
  137. package/dist/cli/peers.d.ts +2 -0
  138. package/dist/cli/peers.d.ts.map +1 -1
  139. package/dist/cli/peers.js +7 -0
  140. package/dist/cli/presets.d.ts.map +1 -1
  141. package/dist/cli/presets.js +27 -11
  142. package/dist/cli/resolver.d.ts +13 -4
  143. package/dist/cli/resolver.d.ts.map +1 -1
  144. package/dist/cli/resolver.js +39 -5
  145. package/dist/cli/router-wiring.d.ts +1 -0
  146. package/dist/cli/router-wiring.d.ts.map +1 -1
  147. package/dist/cli/router-wiring.js +1 -1
  148. package/dist/cli/sync/engine.d.ts +8 -1
  149. package/dist/cli/sync/engine.d.ts.map +1 -1
  150. package/dist/cli/sync/engine.js +25 -14
  151. package/dist/cli/sync/index.d.ts.map +1 -1
  152. package/dist/cli/sync/index.js +7 -4
  153. package/dist/cli/sync/render.d.ts.map +1 -1
  154. package/dist/cli/sync/render.js +21 -28
  155. package/dist/cli/tokens-css.d.ts +2 -0
  156. package/dist/cli/tokens-css.d.ts.map +1 -1
  157. package/dist/cli/tokens-css.js +28 -6
  158. package/dist/controls/contract.d.ts +2 -1
  159. package/dist/controls/contract.d.ts.map +1 -1
  160. package/dist/controls/control-home.d.ts +4 -1
  161. package/dist/controls/control-home.d.ts.map +1 -1
  162. package/dist/controls/control-home.js +5 -3
  163. package/dist/controls/local-control.d.ts +28 -1
  164. package/dist/controls/local-control.d.ts.map +1 -1
  165. package/dist/controls/local-control.js +14 -2
  166. package/dist/core/cn.d.ts.map +1 -1
  167. package/dist/core/cn.js +6 -5
  168. package/dist/core/frame-figure.d.ts +2 -0
  169. package/dist/core/frame-figure.d.ts.map +1 -1
  170. package/dist/core/frame-figure.js +5 -2
  171. package/dist/core/frame-head.d.ts +3 -1
  172. package/dist/core/frame-head.d.ts.map +1 -1
  173. package/dist/core/frame-head.js +28 -7
  174. package/dist/core/frame-regions.d.ts +1 -1
  175. package/dist/core/frame-regions.d.ts.map +1 -1
  176. package/dist/core/frame-regions.js +18 -8
  177. package/dist/core/info-hint.d.ts +5 -0
  178. package/dist/core/info-hint.d.ts.map +1 -1
  179. package/dist/core/info-hint.js +22 -1
  180. package/dist/core/mark-tone.d.ts +6 -2
  181. package/dist/core/mark-tone.d.ts.map +1 -1
  182. package/dist/core/mark-tone.js +1 -1
  183. package/dist/core/mark-types.d.ts +4 -2
  184. package/dist/core/mark-types.d.ts.map +1 -1
  185. package/dist/core/messages/chain.d.ts +2 -1
  186. package/dist/core/messages/chain.d.ts.map +1 -1
  187. package/dist/core/messages/chain.js +1 -0
  188. package/dist/core/messages/index.d.ts +2 -1
  189. package/dist/core/messages/index.d.ts.map +1 -1
  190. package/dist/core/messages/index.js +2 -0
  191. package/dist/core/messages/runs.d.ts +20 -0
  192. package/dist/core/messages/runs.d.ts.map +1 -0
  193. package/dist/core/messages/runs.js +18 -0
  194. package/dist/core/phase.d.ts +25 -2
  195. package/dist/core/phase.d.ts.map +1 -1
  196. package/dist/core/ports.d.ts +4 -1
  197. package/dist/core/ports.d.ts.map +1 -1
  198. package/dist/core/provider.d.ts +3 -1
  199. package/dist/core/provider.d.ts.map +1 -1
  200. package/dist/core/provider.js +5 -3
  201. package/dist/core/scheme.d.ts +2 -1
  202. package/dist/core/scheme.d.ts.map +1 -1
  203. package/dist/core/scheme.js +1 -0
  204. package/dist/core/spark/mini-bars.d.ts +6 -4
  205. package/dist/core/spark/mini-bars.d.ts.map +1 -1
  206. package/dist/core/spark/mini-bars.js +36 -11
  207. package/dist/core/spark/sparkline.d.ts +2 -2
  208. package/dist/core/spark/sparkline.d.ts.map +1 -1
  209. package/dist/core/spark/sparkline.js +21 -2
  210. package/dist/css/bridge.css +63 -0
  211. package/dist/css/generate.d.ts +2 -2
  212. package/dist/css/generate.d.ts.map +1 -1
  213. package/dist/css/generate.js +25 -0
  214. package/dist/data/live/live-query.d.ts +2 -2
  215. package/dist/data/live/live-query.d.ts.map +1 -1
  216. package/dist/data/live/live-query.js +2 -1
  217. package/dist/lint/preset.d.ts +12 -3
  218. package/dist/lint/preset.d.ts.map +1 -1
  219. package/dist/lint/preset.js +30 -10
  220. package/dist/lint/rules/class/table.d.ts.map +1 -1
  221. package/dist/lint/rules/class/table.js +3 -1
  222. package/dist/lint/rules/structure/control-home.js +1 -1
  223. package/dist/lint/rules/structure/import-boundary.d.ts.map +1 -1
  224. package/dist/lint/rules/structure/import-boundary.js +2 -0
  225. package/dist/lint/rules/structure/label-literal.d.ts.map +1 -1
  226. package/dist/lint/rules/structure/label-literal.js +1 -1
  227. package/dist/lint/shadcn.d.ts +562 -0
  228. package/dist/lint/shadcn.d.ts.map +1 -0
  229. package/dist/lint/shadcn.js +52 -0
  230. package/dist/lint/stylelint/render.d.ts +3 -1
  231. package/dist/lint/stylelint/render.d.ts.map +1 -1
  232. package/dist/lint/stylelint/render.js +23 -2
  233. package/dist/lint/stylelint/rules.d.ts +3 -2
  234. package/dist/lint/stylelint/rules.d.ts.map +1 -1
  235. package/dist/lint/stylelint/rules.js +11 -6
  236. package/dist/lint/weakened.d.ts +8 -0
  237. package/dist/lint/weakened.d.ts.map +1 -1
  238. package/dist/lint/weakened.js +44 -1
  239. package/dist/messages/de.d.ts.map +1 -1
  240. package/dist/messages/de.js +15 -0
  241. package/dist/messages/es.d.ts.map +1 -1
  242. package/dist/messages/es.js +15 -0
  243. package/dist/messages/fr.d.ts.map +1 -1
  244. package/dist/messages/fr.js +15 -0
  245. package/dist/messages/zh-hans.d.ts.map +1 -1
  246. package/dist/messages/zh-hans.js +15 -0
  247. package/dist/page/bar-title.d.ts +25 -0
  248. package/dist/page/bar-title.d.ts.map +1 -0
  249. package/dist/page/bar-title.js +10 -0
  250. package/dist/page/contract.d.ts +11 -1
  251. package/dist/page/contract.d.ts.map +1 -1
  252. package/dist/page/empty-state.d.ts +5 -2
  253. package/dist/page/empty-state.d.ts.map +1 -1
  254. package/dist/page/empty-state.js +14 -3
  255. package/dist/page/facts.d.ts +19 -2
  256. package/dist/page/facts.d.ts.map +1 -1
  257. package/dist/page/facts.js +26 -5
  258. package/dist/page/index.d.ts +8 -0
  259. package/dist/page/index.d.ts.map +1 -1
  260. package/dist/page/index.js +9 -0
  261. package/dist/page/page-bar.d.ts.map +1 -1
  262. package/dist/page/page-bar.js +2 -7
  263. package/dist/page/page-summary.d.ts +2 -1
  264. package/dist/page/page-summary.d.ts.map +1 -1
  265. package/dist/page/page-summary.js +1 -1
  266. package/dist/page/run-button.d.ts +26 -0
  267. package/dist/page/run-button.d.ts.map +1 -0
  268. package/dist/page/run-button.js +31 -0
  269. package/dist/page/run-list.d.ts +28 -0
  270. package/dist/page/run-list.d.ts.map +1 -0
  271. package/dist/page/run-list.js +88 -0
  272. package/dist/page/run-queue.d.ts +78 -0
  273. package/dist/page/run-queue.d.ts.map +1 -0
  274. package/dist/page/run-queue.js +93 -0
  275. package/dist/page/section.d.ts +6 -1
  276. package/dist/page/section.d.ts.map +1 -1
  277. package/dist/page/section.js +34 -16
  278. package/dist/shell/commands/command-palette.d.ts.map +1 -1
  279. package/dist/shell/commands/command-palette.js +5 -1
  280. package/dist/shell/parts/header.js +1 -1
  281. package/dist/surfaces.d.ts +15 -1
  282. package/dist/surfaces.d.ts.map +1 -1
  283. package/dist/surfaces.js +19 -2
  284. package/dist/testing/index.d.ts +1 -0
  285. package/dist/testing/index.d.ts.map +1 -1
  286. package/dist/testing/index.js +3 -0
  287. package/dist/testing/pseudo-locale.d.ts +41 -0
  288. package/dist/testing/pseudo-locale.d.ts.map +1 -0
  289. package/dist/testing/pseudo-locale.js +74 -0
  290. package/dist/testing/quality.d.ts +6 -0
  291. package/dist/testing/quality.d.ts.map +1 -1
  292. package/dist/testing/quality.js +139 -1
  293. package/dist/tokens/bridge-sheet.d.ts +21 -0
  294. package/dist/tokens/bridge-sheet.d.ts.map +1 -0
  295. package/dist/tokens/bridge-sheet.js +68 -0
  296. package/dist/tokens/emit.d.ts +6 -1
  297. package/dist/tokens/emit.d.ts.map +1 -1
  298. package/dist/tokens/emit.js +26 -1
  299. package/dist/ui/accordion.js +1 -1
  300. package/dist/ui/card.d.ts +32 -4
  301. package/dist/ui/card.d.ts.map +1 -1
  302. package/dist/ui/card.js +26 -3
  303. package/dist/ui/collapsible.d.ts +4 -2
  304. package/dist/ui/collapsible.d.ts.map +1 -1
  305. package/dist/ui/collapsible.js +1 -1
  306. package/dist/ui/combobox.js +1 -1
  307. package/dist/ui/meter.d.ts +34 -3
  308. package/dist/ui/meter.d.ts.map +1 -1
  309. package/dist/ui/meter.guard.d.ts +2 -0
  310. package/dist/ui/meter.guard.d.ts.map +1 -1
  311. package/dist/ui/meter.guard.js +20 -0
  312. package/dist/ui/meter.js +23 -7
  313. package/dist/ui/primitive.contract.d.ts.map +1 -1
  314. package/dist/ui/primitive.contract.js +7 -0
  315. package/dist/ui/remote-pad.d.ts +62 -0
  316. package/dist/ui/remote-pad.d.ts.map +1 -0
  317. package/dist/ui/remote-pad.guard.d.ts +21 -0
  318. package/dist/ui/remote-pad.guard.d.ts.map +1 -0
  319. package/dist/ui/remote-pad.guard.js +6 -0
  320. package/dist/ui/remote-pad.js +148 -0
  321. package/dist/ui/segmented.d.ts.map +1 -1
  322. package/dist/ui/segmented.js +4 -0
  323. package/dist/ui/skeleton.d.ts +9 -4
  324. package/dist/ui/skeleton.d.ts.map +1 -1
  325. package/dist/ui/skeleton.guard.d.ts +6 -2
  326. package/dist/ui/skeleton.guard.d.ts.map +1 -1
  327. package/dist/ui/skeleton.guard.js +4 -0
  328. package/dist/ui/skeleton.js +2 -1
  329. package/dist/ui/slots.d.ts +2 -1
  330. package/dist/ui/slots.d.ts.map +1 -1
  331. package/dist/ui/slots.js +2 -1
  332. package/dist/vite/allotment.d.ts +1 -1
  333. package/dist/vite/allotment.d.ts.map +1 -1
  334. package/dist/vite/allotment.js +15 -1
  335. package/dist/vite/doc.d.ts +1 -1
  336. package/dist/vite/doc.d.ts.map +1 -1
  337. package/dist/vite/doc.js +12 -2
  338. package/dist/vite/head.d.ts +4 -3
  339. package/dist/vite/head.d.ts.map +1 -1
  340. package/dist/vite/index.d.ts.map +1 -1
  341. package/dist/vite/index.js +4 -1
  342. package/dist/vite/shell-worker.d.ts +6 -0
  343. package/dist/vite/shell-worker.d.ts.map +1 -0
  344. package/dist/vite/shell-worker.js +92 -0
  345. package/docs/astro.md +19 -4
  346. package/docs/bar-list.md +3 -2
  347. package/docs/bar-title.md +33 -0
  348. package/docs/basalt-provider.md +2 -1
  349. package/docs/card.md +24 -4
  350. package/docs/chain-view.md +12 -7
  351. package/docs/chart-card.md +3 -2
  352. package/docs/collapsible.md +4 -2
  353. package/docs/control-home.md +4 -2
  354. package/docs/create-run-queue.md +40 -0
  355. package/docs/data-panel.md +3 -2
  356. package/docs/de.md +1 -1
  357. package/docs/empty-state.md +3 -1
  358. package/docs/es.md +1 -1
  359. package/docs/event-list.md +3 -2
  360. package/docs/fact.md +6 -1
  361. package/docs/facts.md +5 -1
  362. package/docs/fr.md +1 -1
  363. package/docs/live-query.md +1 -1
  364. package/docs/meter.md +17 -13
  365. package/docs/mini-bars.md +7 -5
  366. package/docs/pseudo-basalt-messages.md +30 -0
  367. package/docs/pseudo-messages.md +27 -0
  368. package/docs/quality.md +2 -1
  369. package/docs/recipes/localise-app.md +2 -2
  370. package/docs/remote-pad.md +40 -0
  371. package/docs/row-list.md +3 -2
  372. package/docs/run-button.md +45 -0
  373. package/docs/run-list.md +71 -0
  374. package/docs/section.md +7 -1
  375. package/docs/set-scheme.md +2 -2
  376. package/docs/skeleton.md +4 -3
  377. package/docs/slots.md +1 -1
  378. package/docs/sparkline.md +5 -2
  379. package/docs/stat-card.md +6 -4
  380. package/docs/testing.md +64 -0
  381. package/docs/use-local-control.md +8 -1
  382. package/docs/use-runs.md +32 -0
  383. package/docs/vite.md +12 -2
  384. package/docs/zh-hans.md +1 -1
  385. package/llms.txt +88 -21
  386. package/migrations/areas/shadcn.json +338 -0
  387. package/package.json +9 -2
  388. package/src/astro/shiki.ts +3 -1
  389. package/src/cards/bar-list.tsx +2 -1
  390. package/src/cards/chain-view.tsx +167 -55
  391. package/src/cards/contract.ts +8 -1
  392. package/src/cards/data-panel.tsx +1 -0
  393. package/src/cards/event-list.tsx +2 -1
  394. package/src/cards/index.ts +1 -0
  395. package/src/cards/row-list.tsx +2 -1
  396. package/src/cards/stat-card-parts.tsx +9 -7
  397. package/src/cards/stat-card.tsx +39 -12
  398. package/src/charts/core/compile.ts +31 -19
  399. package/src/charts/core/cursor.ts +11 -3
  400. package/src/charts/core/tooltip-said.ts +55 -0
  401. package/src/charts/focus.tsx +4 -1
  402. package/src/charts/parts/chart-card.tsx +1 -0
  403. package/src/cli/agent-note.ts +12 -5
  404. package/src/cli/budget/index.ts +22 -5
  405. package/src/cli/config.ts +1 -1
  406. package/src/cli/doctor/app.ts +75 -23
  407. package/src/cli/doctor/eject.ts +30 -10
  408. package/src/cli/doctor/guards.ts +11 -8
  409. package/src/cli/doctor/hook.ts +1 -1
  410. package/src/cli/doctor/install.ts +61 -24
  411. package/src/cli/doctor/translations.ts +13 -4
  412. package/src/cli/doctor/types.ts +2 -3
  413. package/src/cli/doctor/wiring.ts +30 -16
  414. package/src/cli/eject/dropped-slots.ts +11 -0
  415. package/src/cli/eject/index.ts +13 -9
  416. package/src/cli/help.ts +34 -10
  417. package/src/cli/index.ts +56 -14
  418. package/src/cli/init/index.ts +64 -5
  419. package/src/cli/init/locales.ts +41 -8
  420. package/src/cli/init/router-seeds.ts +17 -3
  421. package/src/cli/init/steps.ts +308 -41
  422. package/src/cli/lint/baseline.ts +141 -0
  423. package/src/cli/lint/engine.ts +33 -10
  424. package/src/cli/lint/hook.ts +11 -3
  425. package/src/cli/lint/index.ts +77 -12
  426. package/src/cli/manifest.ts +132 -4
  427. package/src/cli/migrate/census.ts +35 -1
  428. package/src/cli/migrate/index.ts +46 -3
  429. package/src/cli/migrate/lost-classes.ts +203 -0
  430. package/src/cli/migrate/rows.ts +21 -0
  431. package/src/cli/package-manager.ts +4 -1
  432. package/src/cli/peers.ts +11 -0
  433. package/src/cli/presets.ts +32 -11
  434. package/src/cli/resolver.ts +58 -10
  435. package/src/cli/router-wiring.ts +3 -1
  436. package/src/cli/sync/engine.ts +30 -14
  437. package/src/cli/sync/index.ts +7 -4
  438. package/src/cli/sync/render.ts +29 -37
  439. package/src/cli/tokens-css.ts +42 -5
  440. package/src/controls/contract.ts +2 -0
  441. package/src/controls/control-home.tsx +15 -4
  442. package/src/controls/local-control.ts +49 -3
  443. package/src/core/cn.ts +9 -5
  444. package/src/core/frame-figure.tsx +7 -1
  445. package/src/core/frame-head.tsx +32 -6
  446. package/src/core/frame-regions.tsx +18 -8
  447. package/src/core/info-hint.tsx +26 -0
  448. package/src/core/mark-tone.ts +10 -3
  449. package/src/core/mark-types.ts +4 -2
  450. package/src/core/messages/chain.ts +2 -1
  451. package/src/core/messages/index.ts +4 -0
  452. package/src/core/messages/runs.ts +40 -0
  453. package/src/core/phase.ts +22 -2
  454. package/src/core/ports.ts +13 -1
  455. package/src/core/provider.tsx +7 -3
  456. package/src/core/scheme.ts +6 -2
  457. package/src/core/spark/mini-bars.tsx +59 -15
  458. package/src/core/spark/sparkline.tsx +26 -4
  459. package/src/css/bridge.css +63 -0
  460. package/src/css/generate.ts +40 -3
  461. package/src/data/live/live-query.ts +4 -3
  462. package/src/lint/preset.ts +52 -13
  463. package/src/lint/rules/class/table.ts +3 -1
  464. package/src/lint/rules/structure/control-home.ts +1 -1
  465. package/src/lint/rules/structure/import-boundary.ts +2 -0
  466. package/src/lint/rules/structure/label-literal.ts +3 -1
  467. package/src/lint/shadcn.ts +91 -0
  468. package/src/lint/stylelint/render.ts +31 -1
  469. package/src/lint/stylelint/rules.ts +19 -7
  470. package/src/lint/weakened.ts +59 -1
  471. package/src/messages/de.ts +20 -0
  472. package/src/messages/es.ts +20 -0
  473. package/src/messages/fr.ts +20 -0
  474. package/src/messages/zh-hans.ts +20 -0
  475. package/src/page/bar-title.tsx +35 -0
  476. package/src/page/contract.ts +11 -1
  477. package/src/page/empty-state.tsx +18 -8
  478. package/src/page/facts.tsx +43 -5
  479. package/src/page/index.ts +8 -0
  480. package/src/page/page-bar.tsx +2 -9
  481. package/src/page/page-summary.tsx +4 -3
  482. package/src/page/run-button.tsx +52 -0
  483. package/src/page/run-list.tsx +151 -0
  484. package/src/page/run-queue.ts +185 -0
  485. package/src/page/section.tsx +30 -5
  486. package/src/shell/commands/command-palette.tsx +10 -1
  487. package/src/shell/parts/header.tsx +1 -1
  488. package/src/surfaces.ts +18 -1
  489. package/src/testing/index.ts +1 -0
  490. package/src/testing/pseudo-locale.ts +149 -0
  491. package/src/testing/quality.ts +188 -0
  492. package/src/tokens/bridge-sheet.ts +80 -0
  493. package/src/tokens/emit.ts +45 -6
  494. package/src/ui/accordion.tsx +1 -1
  495. package/src/ui/card.tsx +56 -6
  496. package/src/ui/collapsible.tsx +5 -3
  497. package/src/ui/combobox.tsx +1 -1
  498. package/src/ui/meter.guard.ts +23 -0
  499. package/src/ui/meter.tsx +76 -27
  500. package/src/ui/no-restyle.generated.json +8 -0
  501. package/src/ui/primitive.contract.ts +7 -0
  502. package/src/ui/remote-pad.guard.ts +24 -0
  503. package/src/ui/remote-pad.tsx +249 -0
  504. package/src/ui/segmented.tsx +6 -0
  505. package/src/ui/skeleton.guard.ts +7 -2
  506. package/src/ui/skeleton.tsx +10 -4
  507. package/src/ui/slots.ts +2 -1
  508. package/src/vite/allotment.ts +15 -1
  509. package/src/vite/doc.ts +12 -2
  510. package/src/vite/head.ts +4 -3
  511. package/src/vite/index.ts +4 -1
  512. package/src/vite/shell-worker.ts +115 -0
@@ -8,10 +8,11 @@ import { SOURCES_PATH } from '../../vite/sources'
8
8
  import { existsSync, mkdirSync, writeFileSync } from 'node:fs'
9
9
  import { basename, dirname, join, relative, resolve } from 'node:path'
10
10
 
11
- import { BUDGET_PATH, seedBudget, writeBudget } from '../budget'
11
+ import { BUDGET_PATH, readBudget, seedBudget, writeBudget } from '../budget'
12
+ import { cleanRoot, PROFILE_RANK } from '../doctor/types'
12
13
  import { detectHarnesses, placedDirs, placementFor } from '../harness'
13
14
  import type { Harness } from '../harness'
14
- import { readManifest, writeManifest } from '../manifest'
15
+ import { DESIGN_FILE, readManifest, writeManifest } from '../manifest'
15
16
  import type { Manifest, Profile } from '../manifest'
16
17
  import {
17
18
  OXLINT_PRESET_FILE,
@@ -21,12 +22,13 @@ import {
21
22
  } from '../presets'
22
23
  import { lintSettingsUnits } from '../lint-settings'
23
24
  import { addCommand, packageManager } from '../package-manager'
24
- import { BUILD_PEERS, RUNTIME_PEERS, satisfiesRange } from '../peers'
25
+ import { aboveRange, BUILD_PEERS, peerAddLine, RUNTIME_PEERS, satisfiesRange } from '../peers'
25
26
  import { INVOKERS, LINT_INVOCATION } from '../doctor/wiring'
26
27
  import { parseJsonc, readIfExists } from '../source-text'
27
- import { findRepoRoot, resolveAppDir } from '../index'
28
+ import { collectWorkspacePackages, findRepoRoot, readBasaltConfig, resolveAppDir } from '../index'
28
29
  import { ROUTER_PLUGIN_OPTIONS } from '../route-tree'
29
- import { isSiblingApp } from '../resolver'
30
+ import { VITE_CONFIGS } from '../router-wiring'
31
+ import { isSiblingApp, peerHome, unplacedPeers } from '../resolver'
30
32
  import { sync } from '../sync'
31
33
  import { claimPrefix } from '../sync/sibling'
32
34
  import { tokensCss } from '../tokens-css'
@@ -47,6 +49,7 @@ import {
47
49
  LOCALE_DEV,
48
50
  LOCALE_GATE,
49
51
  LOCALE_RUNTIME,
52
+ keptCatalogs,
50
53
  translatedInstall,
51
54
  } from './locales'
52
55
 
@@ -68,6 +71,12 @@ export type Args = {
68
71
  harnesses?: Harness[]
69
72
  /** `--locales`: the languages the app ships; absent keeps the manifest's. */
70
73
  locales?: string[]
74
+ /** `--agents`: the file the block lives in; absent keeps the manifest's, else `AGENTS.md`. */
75
+ agents?: string
76
+ /** `--design`: where the design record lives; absent keeps the manifest's, else `DESIGN.md`. */
77
+ design?: string
78
+ /** `--catalogs`: where the app's catalogues live; absent keeps the manifest's. */
79
+ catalogs?: string[]
71
80
  }
72
81
 
73
82
  export type Ctx = {
@@ -80,6 +89,8 @@ export type Ctx = {
80
89
  problems: string[]
81
90
  /** Lines the user has to apply by hand, printed together at the end. */
82
91
  todo: string[]
92
+ /** The roots the manifest recorded before this run: `seedBudgetFile` tells an added root by them. */
93
+ previousRoots: Record<string, Profile>
83
94
  /** Set by `placeRouterSeeds`: the app is file-routed, so the Vite config gets the router plugin. */
84
95
  routerPlugin?: boolean
85
96
  /** Set by `placeRouterSeeds`: the catalogue wiring (`./locales`) was placed, so the Vite config, the gate and the ignores follow it. */
@@ -100,6 +111,20 @@ export function translatedApp(ctx: Ctx): boolean {
100
111
  )
101
112
  }
102
113
 
114
+ /** The app's own catalogues (`./locales` `keptCatalogs`), from the manifest `declareManifest` wrote. */
115
+ export function appCatalogs(ctx: Ctx): readonly string[] | undefined {
116
+ const read = readManifest(ctx.root)
117
+ const app = resolveAppDir(ctx.root)
118
+ return keptCatalogs(
119
+ read === null || 'error' in read ? undefined : read.manifest.catalogs,
120
+ 'error' in app ? '' : app.rel,
121
+ )
122
+ }
123
+
124
+ /** A translated app whose catalogue `init` writes: its packages, wiring and ignores follow. */
125
+ export const scaffoldsCatalog = (ctx: Ctx): boolean =>
126
+ translatedApp(ctx) && appCatalogs(ctx) === undefined
127
+
103
128
  /** The paths this run wrote, from the install root: the closing formatter pass reads them. */
104
129
  const written = new Set<string>()
105
130
 
@@ -128,6 +153,27 @@ export function installRoot(dir: string): string {
128
153
  }
129
154
  }
130
155
 
156
+ /**
157
+ * Why `init` run from `cwd` must stop before writing, or null. A package below the repo root that
158
+ * is no workspace package of it and declares no `basalt.sibling` has no install of its own, and
159
+ * the install root is the repo root: a first run would write the host repo.
160
+ */
161
+ export function belowRootRefusal(cwd: string, root: string): string | null {
162
+ let pkg = resolve(cwd)
163
+ while (pkg !== resolve(root) && !existsSync(join(pkg, 'package.json'))) pkg = dirname(pkg)
164
+ if (pkg === resolve(root) || pkg.length < resolve(root).length) return null
165
+ if (isSiblingApp(pkg)) {
166
+ return `${pkg} declares \`basalt.sibling\`, so its install lives there: run init from ${pkg}. Nothing was written.`
167
+ }
168
+ const member = collectWorkspacePackages(root).packages.some(({ dir }) => resolve(dir) === pkg)
169
+ const rootApp = readBasaltConfig(root).app
170
+ if (member || (rootApp !== undefined && resolve(root, rootApp) === pkg)) return null
171
+ return (
172
+ `${pkg} is a package below the repo root ${root} that is not one of its workspace packages, so init would install at the repo root. ` +
173
+ 'To give this package its own install, add `"basalt": { "sibling": true }` to its package.json and run init again; to install at the repo root, run init there. Nothing was written.'
174
+ )
175
+ }
176
+
131
177
  /** True when `text` is plain JSON: a file that parses only as JSONC would lose its comments on a rewrite. */
132
178
  function isStrictJson(text: string): boolean {
133
179
  try {
@@ -188,6 +234,9 @@ export function generateTokens(ctx: Ctx): boolean {
188
234
  return true
189
235
  }
190
236
 
237
+ const higher = (a: Profile, b: Profile): Profile => (PROFILE_RANK[b] > PROFILE_RANK[a] ? b : a)
238
+ const lower = (a: Profile, b: Profile): Profile => (PROFILE_RANK[b] < PROFILE_RANK[a] ? b : a)
239
+
191
240
  /**
192
241
  * Writes the manifest: the declared profile, roots and token rows over whatever is already there.
193
242
  * A 2.x manifest (`legacy`) holds none of the three, so it is replaced.
@@ -212,14 +261,19 @@ export function declareManifest(ctx: Ctx, legacy = false): { error: string } | n
212
261
  } satisfies Manifest)
213
262
  const rows = tokenRows(ctx.args)
214
263
  const declared = new Set(rows.map((r) => r.out))
264
+ const merged = { ...base.roots, ...Object.fromEntries(roots.map((r) => [r, profile])) }
215
265
  const manifest: Manifest = {
216
266
  ...base,
217
- profile,
218
- roots: { ...base.roots, ...Object.fromEntries(roots.map((r) => [r, profile])) },
267
+ // The default profile is the highest declared one: a second root below it never replaces it.
268
+ profile: Object.values(merged).reduce(higher, profile),
269
+ roots: merged,
219
270
  tokens: [...base.tokens.filter((t) => !declared.has(t.out)), ...rows],
220
271
  harnesses:
221
272
  ctx.args.harnesses ?? base.harnesses ?? detectHarnesses(ctx.root, findRepoRoot(ctx.root)),
222
- ...(ctx.args.locales === undefined ? {} : { locales: ctx.args.locales }),
273
+ ...localeKeys(ctx.args.locales, base.partialLocales),
274
+ ...(ctx.args.agents === undefined ? {} : { agents: ctx.args.agents }),
275
+ ...(ctx.args.design === undefined ? {} : { design: ctx.args.design }),
276
+ ...(ctx.args.catalogs === undefined ? {} : { catalogs: ctx.args.catalogs }),
223
277
  ...(extra === undefined ? {} : { extra }),
224
278
  ...(isSiblingApp(ctx.root) ? { sibling: base.sibling ?? claimPrefix(ctx.root) } : {}),
225
279
  }
@@ -227,6 +281,15 @@ export function declareManifest(ctx: Ctx, legacy = false): { error: string } | n
227
281
  return null
228
282
  }
229
283
 
284
+ /** `--locales` into the manifest: a partial language it drops, or makes the source, goes too, else no verb reads the file. */
285
+ function localeKeys(
286
+ locales: string[] | undefined,
287
+ partial: readonly string[] = [],
288
+ ): Pick<Manifest, 'locales' | 'partialLocales'> {
289
+ if (locales === undefined) return {}
290
+ return { locales, partialLocales: partial.filter((l) => locales.indexOf(l) > 0) }
291
+ }
292
+
230
293
  // ── peers ───────────────────────────────────────────────────────────────────────────────────────
231
294
 
232
295
  type PackageJson = {
@@ -245,10 +308,32 @@ export const readPackage = (dir: string): PackageJson | null => {
245
308
  }
246
309
  }
247
310
 
248
- /** True when the repo formats with Prettier and has no `.oxfmtrc.json`: then `oxfmt` is not its formatter. */
311
+ /** The config files oxfmt loads besides `.oxfmtrc.json`; it refuses to run when two of them exist. */
312
+ const OXFMT_OTHER_CONFIGS = [
313
+ 'oxfmt.config.ts',
314
+ 'oxfmt.config.mts',
315
+ 'oxfmt.config.cts',
316
+ 'oxfmt.config.js',
317
+ 'oxfmt.config.mjs',
318
+ 'oxfmt.config.cjs',
319
+ '.oxfmtrc.jsonc',
320
+ ]
321
+
322
+ /** The repo's own oxfmt config when it is not `.oxfmtrc.json` (a code or commented file `init` cannot rewrite). */
323
+ export function otherOxfmtConfig(root: string): { dir: string; name: string } | null {
324
+ // A sibling app is formatted by the repo root's config when it has none of its own.
325
+ for (const dir of isSiblingApp(root) ? [root, findRepoRoot(root)] : [root]) {
326
+ const name = OXFMT_OTHER_CONFIGS.find((file) => readText(dir, file) !== null)
327
+ if (name !== undefined) return { dir, name }
328
+ }
329
+ return null
330
+ }
331
+
332
+ /** True when the repo formats with Prettier and has no oxfmt config: then `oxfmt` is not its formatter. */
249
333
  export function formatsWithPrettier(root: string): boolean {
250
334
  return (
251
335
  readText(root, '.oxfmtrc.json') === null &&
336
+ otherOxfmtConfig(root) === null &&
252
337
  (readText(root, '.prettierignore') !== null ||
253
338
  readPackage(root)?.devDependencies?.['prettier'] !== undefined)
254
339
  )
@@ -364,13 +449,84 @@ export function peerPlan(
364
449
  export const installCommand = (root: string, specs: string[], dev = true): string[] =>
365
450
  addCommand(root, specs, dev)
366
451
 
452
+ /** True when the repo saves exact versions by default: `bunfig.toml` `exact = true` or `.npmrc` `save-exact=true`, in the package or the install root. */
453
+ export function savesExact(home: string, root: string): boolean {
454
+ return [home, root].some(
455
+ (dir) =>
456
+ /^\s*exact\s*=\s*true\b/m.test(readText(dir, 'bunfig.toml') ?? '') ||
457
+ /^\s*save-exact\s*=\s*true\b/m.test(readText(dir, '.npmrc') ?? ''),
458
+ )
459
+ }
460
+
461
+ /**
462
+ * Where the repo saves exact versions, a peer installed at a range (`^4.3.5`) is rewritten to the
463
+ * version the install resolved, read from `node_modules`, so the package keeps its own pins.
464
+ */
465
+ function pinResolved(home: string, root: string, names: readonly string[]): void {
466
+ const path = resolve(home, 'package.json')
467
+ let text = readIfExists(path)
468
+ if (text === null) return
469
+ for (const name of names) {
470
+ // The package's own node_modules first, then each directory up to the install root (a hoisted layout).
471
+ let installed: string | null = null
472
+ for (let at = home; installed === null; at = dirname(at)) {
473
+ installed = readIfExists(resolve(at, 'node_modules', name, 'package.json'))
474
+ if (at === root || at === dirname(at)) break
475
+ }
476
+ const version =
477
+ installed === null ? undefined : (JSON.parse(installed) as { version?: string }).version
478
+ if (version === undefined) continue
479
+ const escaped = name.replace(/[.*+?^${}()|[\]\\/]/g, '\\$&')
480
+ const entry = new RegExp(`("${escaped}"\\s*:\\s*")[~^][^"]*(")`, 'g')
481
+ // Only the dependency blocks: an `overrides` or peer entry of the same name keeps its own range.
482
+ text = text.replace(/"(?:dev)?[dD]ependencies"\s*:\s*\{[^}]*\}/g, (block) =>
483
+ block.replace(entry, `$1${version}$2`),
484
+ )
485
+ }
486
+ if (text !== readIfExists(path)) writeFileSync(path, text)
487
+ }
488
+
489
+ /** The lint tools a workspace root must declare, beside basalt-ui, when the app below it lints. */
490
+ const ROOT_LINT_TOOLS = ['oxlint', '@shadcn/lint', 'oxfmt'] as const
491
+
492
+ /**
493
+ * A workspace app's lint config sits at the workspace root, and oxlint resolves its `jsPlugins` from there,
494
+ * so the root must declare basalt-ui and the lint tools too. `init` never writes a workspace root's
495
+ * package.json, so it names the add line for the root.
496
+ */
497
+ function rootLintTodo(ctx: Ctx, home: string, plan: PeerPlan, own: PackageJson | null): void {
498
+ if (home === ctx.root || plan.dev['oxlint'] === undefined) return
499
+ const root = readPackage(ctx.root)
500
+ const declared = { ...root?.dependencies, ...root?.devDependencies }
501
+ const appBasalt =
502
+ own?.dependencies?.['basalt-ui'] ??
503
+ own?.devDependencies?.['basalt-ui'] ??
504
+ own?.peerDependencies?.['basalt-ui']
505
+ const tools = ROOT_LINT_TOOLS.filter((name) => plan.dev[name] !== undefined).map(
506
+ (name): [string, string | undefined] => [name, plan.dev[name]],
507
+ )
508
+ const wanted: [string, string | undefined][] = [['basalt-ui', appBasalt], ...tools]
509
+ const missing = wanted.filter(([name]) => declared[name] === undefined)
510
+ if (missing.length === 0) return
511
+ ctx.todo.push(
512
+ `the workspace root loads the lint config, so it needs these devDependencies too: ${peerAddLine(ctx.root, missing, true)}`,
513
+ )
514
+ }
515
+
367
516
  export function installPeers(ctx: Ctx): void {
368
- const translated = translatedApp(ctx)
517
+ const translated = scaffoldsCatalog(ctx)
369
518
  const plan = peerPlan(ctx.pkgRoot, ctx.args.profile, !formatsWithPrettier(ctx.root), translated)
370
- const own = readPackage(ctx.root)
371
- const base = isSiblingApp(ctx.root) ? findRepoRoot(ctx.root) : ctx.root
372
- // A sibling install adds at the repo root, so a TypeScript declared there is the app's too.
373
- const root = readPackage(base)
519
+ const home = peerHome(ctx.root, ctx.args.roots)
520
+ const own = readPackage(home)
521
+ const base = home
522
+ // A sibling and a package outside any workspace share the repo root's TypeScript; a workspace app is
523
+ // judged on its own package.json, since a dependency declared at the workspace root is invisible to it.
524
+ const shared =
525
+ isSiblingApp(ctx.root) ||
526
+ !collectWorkspacePackages(ctx.root).packages.some((pkg) => pkg.dir === home)
527
+ const root = shared
528
+ ? readPackage(isSiblingApp(ctx.root) ? findRepoRoot(ctx.root) : ctx.root)
529
+ : null
374
530
  const rootTs = { ...root?.dependencies, ...root?.devDependencies }['typescript']
375
531
  const have: Record<string, string> = {
376
532
  ...(rootTs === undefined ? {} : { typescript: rootTs }),
@@ -378,16 +534,22 @@ export function installPeers(ctx: Ctx): void {
378
534
  ...own?.devDependencies,
379
535
  }
380
536
  // Installed only where no declared version (or range floor) meets the range; a scaffold dependency
381
- // and TypeScript are the app's own and kept at any declared version (a site's only at 5 or 6), and so
382
- // is a ranged peer whose declaration names no version (a tag).
537
+ // and TypeScript are the app's own and kept at any declared version (a site's only at 5 or above), and so
538
+ // is a ranged peer whose declaration names no version (a tag). A version above the range is never
539
+ // lowered: it is kept and `doctor` names it.
383
540
  const met = (name: string, spec: string): boolean => {
384
541
  const declared = have[name]
385
542
  if (declared === undefined) return false
386
- // `astro check` needs the compiler API of TypeScript 5 or 6, so a site keeps its own only there.
387
- // A range, a tag or an alias is read by its first number; a tag names none and is replaced.
543
+ // `astro check` needs the compiler API of TypeScript 5 or 6, so a site replaces an older one. A
544
+ // range or an alias is read by its first number; a tag names none and is replaced.
388
545
  if (name === 'typescript' && ctx.args.profile === 'site') {
389
- const major = /\d+/.exec(declared)?.[0]
390
- if (major !== '5' && major !== '6') return false
546
+ const major = Number(/\d+/.exec(declared)?.[0] ?? 0)
547
+ if (major < 5) return false
548
+ if (major > 6) {
549
+ say(
550
+ `peers: typescript ${declared} kept: a site's \`astro check\` needs 5 or 6, and init never lowers a major`,
551
+ )
552
+ }
391
553
  }
392
554
  // The catalogue packages are the app's own once declared, like the scaffold's: a newer one is kept.
393
555
  if (
@@ -398,9 +560,17 @@ export function installPeers(ctx: Ctx): void {
398
560
  ) {
399
561
  return true
400
562
  }
563
+ const range = plan.ranges[name] ?? spec
564
+ // Read before the exact-version test: a partial range or a prerelease names a major too.
565
+ if (aboveRange(declared.replace(/^(?:\^|~|>=?)\s*/, ''), range)) {
566
+ say(
567
+ `peers: ${name} ${declared} is above what basalt-ui supports (${range}); kept, init never lowers a major`,
568
+ )
569
+ return true
570
+ }
401
571
  const version = /^[~^]?(\d+\.\d+\.\d+)$/.exec(declared)?.[1]
402
572
  if (version === undefined) return !/^\d+\.\d+\.\d+$/.test(spec)
403
- return satisfiesRange(version, plan.ranges[name] ?? spec)
573
+ return satisfiesRange(version, range)
404
574
  }
405
575
  const missing = (group: Record<string, string>): string[] =>
406
576
  Object.entries(group)
@@ -408,6 +578,7 @@ export function installPeers(ctx: Ctx): void {
408
578
  .map(([name, spec]) => `${name}@${spec}`)
409
579
  const runtime = missing(plan.runtime)
410
580
  const dev = missing(plan.dev)
581
+ rootLintTodo(ctx, home, plan, own)
411
582
  for (const spec of [...runtime, ...dev]) {
412
583
  const name = spec.slice(0, spec.lastIndexOf('@'))
413
584
  const declared = have[name]
@@ -422,15 +593,33 @@ export function installPeers(ctx: Ctx): void {
422
593
  ...(dev.length > 0 ? [installCommand(base, dev)] : []),
423
594
  ]
424
595
  if (commands.length === 0) return say('peers: already at their pins.')
596
+ // Where the command runs, named in every line that prints it: the root's own package.json is not the app's.
597
+ const at = relative(ctx.root, home)
598
+ const where = at === '' ? '' : `in ${at}: `
599
+ // A workspace whose app cannot be told never gets the peers at its root; the commands are printed to run in the app.
600
+ const unplaced = unplacedPeers(ctx.root, home)
425
601
  for (const command of commands) {
426
- if (own === null || ctx.run === undefined) {
427
- const why = own === null ? `no package.json at ${ctx.root}` : '--no-install'
428
- ctx.todo.push(`install the peers (${why}): ${command.join(' ')}`)
602
+ if (own === null || ctx.run === undefined || unplaced !== null) {
603
+ const why =
604
+ own === null
605
+ ? `no package.json at ${ctx.root}`
606
+ : unplaced !== null
607
+ ? `run it in the app package; ${unplaced}`
608
+ : '--no-install'
609
+ const shown = unplaced === null ? command : command.filter((arg) => arg !== '-w')
610
+ ctx.todo.push(`install the peers (${why}): ${where}${shown.join(' ')}`)
611
+ continue
612
+ }
613
+ say(`peers: ${where}${command.join(' ')}`)
614
+ if (!ctx.run(command, home)) {
615
+ ctx.problems.push(`the peer install failed: ${where}${command.join(' ')}`)
429
616
  continue
430
617
  }
431
- say(`peers: ${command.join(' ')}`)
432
- if (!ctx.run(command, ctx.root)) {
433
- ctx.problems.push(`the peer install failed: ${command.join(' ')}`)
618
+ if (savesExact(home, ctx.root)) {
619
+ const ranged = command
620
+ .filter((arg) => /^@?[^@]+@[~^]/.test(arg))
621
+ .map((arg) => arg.slice(0, arg.lastIndexOf('@')))
622
+ pinResolved(home, ctx.root, ranged)
434
623
  }
435
624
  }
436
625
  }
@@ -452,11 +641,49 @@ export function placeManaged(ctx: Ctx): void {
452
641
  if (code !== 0) ctx.problems.push('sync could not place the managed files')
453
642
  }
454
643
 
455
- /** `.basalt/budget.json` once: the ceiling only moves through a raise row (`eject --raise`), never through `init`. */
644
+ /** The floor an added root gets: its profile, or that of a recorded root around it, if higher. */
645
+ function floorFor(root: string, profile: Profile, floors: Record<string, Profile>): Profile {
646
+ return Object.entries(floors)
647
+ .filter(([outer]) => outer === '.' || root.startsWith(`${outer}/`))
648
+ .reduce((floor, [, own]) => higher(floor, own), profile)
649
+ }
650
+
651
+ /**
652
+ * `.basalt/budget.json`: seeded once, and the ceiling only moves through a raise row (`eject --raise`),
653
+ * never through `init`. A root this run adds records its own profile floor, and `profileFloor` follows
654
+ * down to the lowest; a root already declared (or once recorded) keeps its floor, so declaring it
655
+ * lower stays a doctor finding.
656
+ */
456
657
  export function seedBudgetFile(ctx: Ctx): void {
457
- if (existsSync(resolve(ctx.root, BUDGET_PATH))) return
458
- writeBudget(ctx.root, seedBudget(ctx.args.profile))
459
- say(`wrote ${BUDGET_PATH} (the eject ceiling)`)
658
+ const exists = existsSync(resolve(ctx.root, BUDGET_PATH))
659
+ const read = exists ? readBudget(ctx.root) : null
660
+ // An unreadable budget is doctor's to name, never overwritten.
661
+ if (read !== null && 'error' in read) return
662
+ const { profile } = ctx.args
663
+ const before = Object.entries(ctx.previousRoots).map(([root, own]): [string, Profile] => [
664
+ cleanRoot(root),
665
+ own,
666
+ ])
667
+ const budget =
668
+ read?.budget ?? seedBudget(before.reduce((floor, [, own]) => lower(floor, own), profile))
669
+ const floors: Record<string, Profile> = {
670
+ // A root the budget has no entry for was declared at the manifest's profile, never below the floor.
671
+ ...Object.fromEntries(before.map(([root, own]) => [root, higher(own, budget.profileFloor)])),
672
+ ...budget.rootFloors,
673
+ }
674
+ const added = ctx.args.roots.map(cleanRoot).filter((root) => floors[root] === undefined)
675
+ if (exists && added.length === 0) return
676
+ for (const root of added) floors[root] = floorFor(root, profile, floors)
677
+ const profileFloor = added.reduce<Profile>(
678
+ (floor, root) => lower(floor, floors[root] ?? profile),
679
+ budget.profileFloor,
680
+ )
681
+ writeBudget(ctx.root, { ...budget, profileFloor, rootFloors: floors })
682
+ say(
683
+ exists
684
+ ? `${BUDGET_PATH}: profile floor ${added.map((root) => `${root} ${floors[root]}`).join(', ')}`
685
+ : `wrote ${BUDGET_PATH} (the eject ceiling)`,
686
+ )
460
687
  }
461
688
 
462
689
  /**
@@ -535,7 +762,7 @@ function rootFormatterSettings(ctx: Ctx): Record<string, unknown> | null {
535
762
  function ignoreFile(ctx: Ctx): void {
536
763
  const ignored = [
537
764
  ...formatterIgnore(ctx.root),
538
- ...generatedTreeIgnores(ctx.args, translatedApp(ctx)),
765
+ ...generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx)),
539
766
  ]
540
767
  const missing = (text: string): string[] =>
541
768
  ignored.filter((p) => !text.split('\n').some((line) => line.trim() === p))
@@ -551,6 +778,17 @@ function ignoreFile(ctx: Ctx): void {
551
778
  return say(`.prettierignore: ignores ${add.join(', ')}`)
552
779
  }
553
780
 
781
+ const other = oxfmt === null ? otherOxfmtConfig(ctx.root) : null
782
+ if (other !== null) {
783
+ // A second config file makes oxfmt refuse both: the repo's own gets the lines by hand.
784
+ const text = readText(other.dir, other.name) ?? ''
785
+ const add = ignored.filter((p) => !text.includes(p))
786
+ if (add.length === 0) return
787
+ return void ctx.todo.push(
788
+ `add to ignorePatterns in ${relative(ctx.root, join(other.dir, other.name))} (init writes no second oxfmt config): ${add.join(', ')}`,
789
+ )
790
+ }
791
+
554
792
  if (oxfmt === null) {
555
793
  const settings = rootFormatterSettings(ctx)
556
794
  if (settings === null)
@@ -590,7 +828,7 @@ function oxlintExtends(ctx: Ctx): void {
590
828
  const line = `./${OXLINT_PRESET_FILE}`
591
829
  const text = readText(ctx.root, '.oxlintrc.json')
592
830
  if (text === null) {
593
- const ignorePatterns = generatedTreeIgnores(ctx.args, translatedApp(ctx))
831
+ const ignorePatterns = generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx))
594
832
  const fresh = { extends: [line], ...(ignorePatterns.length > 0 ? { ignorePatterns } : {}) }
595
833
  writeText(ctx.root, '.oxlintrc.json', `${JSON.stringify(fresh, null, 2)}\n`)
596
834
  return say('wrote .oxlintrc.json (extends the basalt preset)')
@@ -609,7 +847,7 @@ function oxlintExtends(ctx: Ctx): void {
609
847
  const listed = Array.isArray(config?.['ignorePatterns'])
610
848
  ? (config['ignorePatterns'] as string[])
611
849
  : []
612
- const trees = generatedTreeIgnores(ctx.args, translatedApp(ctx)).filter(
850
+ const trees = generatedTreeIgnores(ctx.args, scaffoldsCatalog(ctx)).filter(
613
851
  (p) => !listed.includes(p),
614
852
  )
615
853
  if (hasExtends && !stock && trees.length === 0) return
@@ -668,6 +906,10 @@ export function wireLintScript(ctx: Ctx): void {
668
906
  return void ctx.todo.push('run `basalt-ui lint` from a package script, lefthook or make check')
669
907
  }
670
908
  const lint = pkg.scripts?.['lint']
909
+ // A Makefile or a `check` script is the repo's gate already: a second `lint` script would be a rival.
910
+ if (lint === undefined && ownsGate(ctx.root, pkg)) {
911
+ return void ctx.todo.push('run `basalt-ui lint` from the Makefile or the check script')
912
+ }
671
913
  if (lint !== undefined && lint !== 'oxlint' && lint !== 'eslint .') return
672
914
  const scripts = {
673
915
  ...pkg.scripts,
@@ -684,11 +926,25 @@ export function wireLintScript(ctx: Ctx): void {
684
926
  */
685
927
  export function wireFormatScript(ctx: Ctx): void {
686
928
  if (ctx.args.profile === 'tokens' || formatsWithPrettier(ctx.root)) return
929
+ // A Makefile or a `check` script already runs the repo's formatter.
930
+ if (ownsGate(ctx.root, readPackage(ctx.root))) return
687
931
  if (addScript(ctx, 'package.json', 'format', 'oxfmt .')) {
688
932
  say('package.json: the format script runs oxfmt')
689
933
  }
690
934
  }
691
935
 
936
+ /** True when a Makefile (a sibling's is the repo root's) or a `check` script is the gate, so `init` adds no `lint` or `format` script beside it. */
937
+ function ownsGate(
938
+ root: string,
939
+ pkg: (PackageJson & { scripts?: Record<string, string> }) | null,
940
+ ): boolean {
941
+ const makefiles = isSiblingApp(root) ? [root, findRepoRoot(root)] : [root]
942
+ return (
943
+ makefiles.some((dir) => readText(dir, 'Makefile') !== null) ||
944
+ pkg?.scripts?.['check'] !== undefined
945
+ )
946
+ }
947
+
692
948
  /** Adds `scripts.<name>` to the `package.json` at `rel` when none by that name exists; true when it wrote. */
693
949
  export function addScript(ctx: Ctx, rel: string, name: string, command: string): boolean {
694
950
  const text = readText(ctx.root, rel)
@@ -769,11 +1025,21 @@ export function wireCheckScript(ctx: Ctx): void {
769
1025
 
770
1026
  // ── DESIGN.md ───────────────────────────────────────────────────────────────────────────────────
771
1027
 
772
- /** The seed, only when no declared root (nor the install root) has a DESIGN.md; never at `tokens`. */
1028
+ /**
1029
+ * The seed, only when no declared root (nor the install root) has a DESIGN.md; never at `tokens`.
1030
+ * With a `design` path (`--design`, or the manifest's) the record lives there and nowhere else is looked at.
1031
+ */
773
1032
  export function seedDesign(ctx: Ctx): void {
774
1033
  if (ctx.args.profile === 'tokens') return
1034
+ const read = readManifest(ctx.root)
1035
+ const design =
1036
+ ctx.args.design ?? (read === null || 'error' in read ? undefined : read.manifest.design)
775
1037
  const homes = ['.', ...ctx.args.roots, ...ctx.args.roots.map((r) => dirname(r))]
776
- if (homes.some((dir) => existsSync(resolve(ctx.root, dir, 'DESIGN.md')))) return
1038
+ const seen =
1039
+ design === undefined
1040
+ ? homes.some((dir) => existsSync(resolve(ctx.root, dir, DESIGN_FILE)))
1041
+ : existsSync(resolve(ctx.root, design))
1042
+ if (seen) return
777
1043
  const template = readIfExists(resolve(ctx.pkgRoot, 'agent/templates/DESIGN.md.tpl'))
778
1044
  if (template === null) return void ctx.problems.push(`${ctx.pkgRoot} ships no DESIGN.md.tpl`)
779
1045
  const [first = '.'] = ctx.args.roots
@@ -785,8 +1051,8 @@ export function seedDesign(ctx: Ctx): void {
785
1051
  SERIES_MODULE_PATH: series,
786
1052
  }
787
1053
  const text = template.replace(/\{\{(\w+)\}\}/g, (all, key: string) => vars[key] ?? all)
788
- writeText(ctx.root, 'DESIGN.md', text)
789
- say('wrote DESIGN.md')
1054
+ writeText(ctx.root, design ?? DESIGN_FILE, text)
1055
+ say(`wrote ${design ?? DESIGN_FILE}`)
790
1056
  }
791
1057
 
792
1058
  /** The phone contract: `viewport-fit=cover` for the safe-area insets, and no zoom lock. */
@@ -833,7 +1099,6 @@ export function appName(root: string): string {
833
1099
 
834
1100
  // ── Vite and CSS ────────────────────────────────────────────────────────────────────────────────
835
1101
 
836
- const VITE_CONFIGS = ['vite.config.ts', 'vite.config.mts', 'vite.config.js', 'vite.config.mjs']
837
1102
  export const CSS_ENTRIES = ['index.css', 'styles.css', 'main.css', 'app.css', 'globals.css']
838
1103
  const BASALT_IMPORT = "import { basalt } from 'basalt-ui/vite'"
839
1104
  const ROUTER_IMPORT = "import { tanstackRouter } from '@tanstack/router-plugin/vite'"
@@ -1059,10 +1324,12 @@ export function wireApp(ctx: Ctx): void {
1059
1324
  .flatMap((d) => VITE_CONFIGS.map((f) => join(d, f)))
1060
1325
  .find((f) => existsSync(resolve(ctx.root, f)))
1061
1326
  if (vite !== undefined) {
1062
- ignoreGenerated(ctx, dirname(vite), translatedApp(ctx) ? [`src/${COMPILED_GLOB}`] : [])
1327
+ ignoreGenerated(ctx, dirname(vite), scaffoldsCatalog(ctx) ? [`src/${COMPILED_GLOB}`] : [])
1063
1328
  const text = readText(ctx.root, vite) ?? ''
1064
1329
  if (isStock('vite.config', text) || isRenderedVite(text)) {
1065
- if (writeText(ctx.root, vite, renderViteConfig(first, ctx.localeScaffold === true)))
1330
+ // A config that already loads the catalogue plugin keeps it: the app's own catalogue may need it.
1331
+ const lingui = ctx.localeScaffold === true || text.includes('@lingui/vite-plugin')
1332
+ if (writeText(ctx.root, vite, renderViteConfig(first, lingui)))
1066
1333
  say(`${vite}: added the Vite plugins`)
1067
1334
  } else {
1068
1335
  say(`kept ${vite}: not the stock create-vite config; doctor names the plugins it needs`)