@dexhq/canvas 0.13.0 → 0.15.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 (341) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +21 -18
  3. package/app/canvas/activity.tsx +8 -15
  4. package/app/canvas/anchoring.ts +3 -5
  5. package/app/canvas/canvas-input.ts +151 -14
  6. package/app/canvas/canvas-keys.ts +9 -0
  7. package/app/canvas/canvas-model.ts +5 -42
  8. package/app/canvas/canvas-panels.ts +1 -17
  9. package/app/canvas/canvas-scene.ts +7 -3
  10. package/app/canvas/canvas-ui.ts +2 -1
  11. package/app/canvas/canvas.css +61 -26
  12. package/app/canvas/change-notice.tsx +10 -1
  13. package/app/canvas/comment-layer.tsx +2 -1
  14. package/app/canvas/comments.tsx +204 -82
  15. package/app/canvas/element-picker.ts +200 -27
  16. package/app/canvas/engine/canvas-gestures.ts +72 -17
  17. package/app/canvas/engine/canvas-store.ts +17 -1
  18. package/app/canvas/engine/engine.css +6 -3
  19. package/app/canvas/find-bar.tsx +817 -0
  20. package/app/canvas/find-model.ts +135 -0
  21. package/app/canvas/flow-canvas.tsx +18 -2
  22. package/app/canvas/follow-pin.ts +26 -6
  23. package/app/canvas/frame-node.tsx +43 -26
  24. package/app/canvas/imported-reviews.tsx +12 -22
  25. package/app/canvas/layout.ts +27 -0
  26. package/app/canvas/live-page.ts +142 -19
  27. package/app/canvas/page-find.ts +220 -0
  28. package/app/canvas/page-style.ts +23 -0
  29. package/app/canvas/section-node.tsx +2 -0
  30. package/app/canvas/spec-threads.ts +24 -23
  31. package/app/canvas/thread-focus.tsx +14 -12
  32. package/app/canvas/tool-cursors.ts +16 -16
  33. package/app/canvas/use-activity.ts +0 -8
  34. package/app/canvas/use-agent-changes.tsx +34 -40
  35. package/app/canvas/use-canvas-clipboard.tsx +11 -14
  36. package/app/canvas/xray.ts +3 -12
  37. package/app/frame.tsx +5 -0
  38. package/app/i18n/locales/en/messages.po +114 -12
  39. package/app/i18n/locales/en/messages.ts +1 -1
  40. package/app/i18n/locales/pseudo/messages.po +114 -12
  41. package/app/i18n/locales/pseudo/messages.ts +1 -1
  42. package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
  43. package/app/icons/index.tsx +3 -3
  44. package/app/icons/types.ts +3 -10
  45. package/app/index.html +3 -3
  46. package/app/main.tsx +3 -0
  47. package/app/pages/canvas-settings.tsx +35 -0
  48. package/app/pages/canvas.tsx +27 -8
  49. package/app/pages/commands-settings.tsx +16 -2
  50. package/app/shell/about.tsx +5 -4
  51. package/app/shell/feedback-details.ts +0 -3
  52. package/app/shell/feedback-form.tsx +10 -21
  53. package/app/shell/feedback-link.tsx +2 -1
  54. package/app/shell/instructions-editor.tsx +1 -1
  55. package/app/shell/presence-style.ts +59 -0
  56. package/app/shell/presence.tsx +6 -3
  57. package/app/shell/scaled-frame.tsx +21 -9
  58. package/app/shell/settings-sections.ts +12 -0
  59. package/app/shell/sidebar.tsx +1 -1
  60. package/app/studio-ui.d.ts +0 -9
  61. package/app/types.ts +21 -205
  62. package/app/ui/file-drop.ts +128 -0
  63. package/app/ui/prompt-editor.tsx +1 -1
  64. package/app/ui/shadcn/input-group.tsx +2 -2
  65. package/dist/cli/banner.d.mts +4 -2
  66. package/dist/cli/banner.mjs +34 -11
  67. package/dist/cli/commands/app.mjs +19 -11
  68. package/dist/cli/commands/create.d.mts +26 -14
  69. package/dist/cli/commands/create.mjs +13 -7
  70. package/dist/cli/commands/dev.mjs +2 -3
  71. package/dist/cli/commands/hook.mjs +2 -1
  72. package/dist/cli/commands/init.d.mts +11 -6
  73. package/dist/cli/help.d.mts +1 -1
  74. package/dist/cli/help.mjs +3 -3
  75. package/dist/cli/main.d.mts +22 -12
  76. package/dist/config/index.d.mts +6 -5
  77. package/dist/config/project-files.d.mts +6 -3
  78. package/dist/config/project-files.mjs +14 -5
  79. package/dist/config/renamed.d.mts +0 -2
  80. package/dist/config/renamed.mjs +1 -3
  81. package/dist/config/schema.d.mts +0 -5
  82. package/dist/config/schema.mjs +0 -5
  83. package/dist/content/capture.d.mts +2 -2
  84. package/dist/content/capture.mjs +2 -2
  85. package/dist/content/content.d.mts +3 -141
  86. package/dist/content/content.mjs +7 -65
  87. package/dist/content/flow-specs.mjs +1 -1
  88. package/dist/content/prototype-summary.d.mts +3 -39
  89. package/dist/content/prototype-summary.mjs +2 -3
  90. package/dist/content/prototypes.mjs +1 -1
  91. package/dist/content/snapshot-client.mjs +1 -1
  92. package/dist/content/text-replace.d.mts +30 -0
  93. package/dist/content/text-replace.mjs +309 -0
  94. package/dist/content/thread-module.mjs +1 -1
  95. package/dist/content/threads.mjs +1 -1
  96. package/dist/paths.d.mts +0 -2
  97. package/dist/paths.mjs +1 -3
  98. package/dist/server/agent-env.d.mts +5 -1
  99. package/dist/server/agent-env.mjs +7 -2
  100. package/dist/server/agent-session.d.mts +14 -1
  101. package/dist/server/agent-session.mjs +84 -19
  102. package/dist/server/brief.mjs +3 -3
  103. package/dist/server/build-pictures.mjs +1 -1
  104. package/dist/server/channel.d.mts +19 -24
  105. package/dist/server/channel.mjs +70 -37
  106. package/dist/server/claimed-presence.d.mts +18 -0
  107. package/dist/server/claimed-presence.mjs +58 -0
  108. package/dist/server/close-check.mjs +2 -2
  109. package/dist/server/comments/actions.d.mts +153 -0
  110. package/dist/server/comments/actions.mjs +154 -0
  111. package/dist/server/comments/routes.d.mts +25 -0
  112. package/dist/server/comments/routes.mjs +88 -0
  113. package/dist/server/comments/tools.d.mts +6 -0
  114. package/dist/server/comments/tools.mjs +154 -0
  115. package/dist/server/dev-server.mjs +36 -13
  116. package/dist/server/file-errors.d.mts +7 -2
  117. package/dist/server/file-errors.mjs +31 -8
  118. package/dist/server/file-lock.d.mts +2 -2
  119. package/dist/server/file-lock.mjs +130 -36
  120. package/dist/server/mcp.d.mts +0 -2
  121. package/dist/server/mcp.mjs +7 -8
  122. package/dist/server/me.d.mts +1 -1
  123. package/dist/server/open-page.d.mts +22 -0
  124. package/dist/server/open-page.mjs +20 -2
  125. package/dist/server/outcome.d.mts +22 -0
  126. package/dist/server/outcome.mjs +8 -0
  127. package/dist/server/own-copies.mjs +2 -2
  128. package/dist/server/people.d.mts +1 -1
  129. package/dist/server/port.d.mts +12 -0
  130. package/dist/server/port.mjs +66 -14
  131. package/dist/server/presence.d.mts +4 -1
  132. package/dist/server/presence.mjs +2 -2
  133. package/dist/server/requests.d.mts +5 -1
  134. package/dist/server/requests.mjs +32 -47
  135. package/dist/server/studio-for.d.mts +5 -0
  136. package/dist/server/studio-for.mjs +18 -4
  137. package/dist/server/sync-install.d.mts +8 -12
  138. package/dist/server/sync-install.mjs +12 -30
  139. package/dist/server/thread-source.mjs +2 -2
  140. package/dist/server/tools/describe.d.mts +1 -1
  141. package/dist/server/tools/describe.mjs +1 -1
  142. package/dist/server/tools/feedback.d.mts +1 -1
  143. package/dist/server/tools/reading.mjs +13 -4
  144. package/dist/server/tools/show.d.mts +1 -1
  145. package/dist/server/tools/snapshot.d.mts +1 -1
  146. package/dist/server/tools/thread-list.mjs +1 -1
  147. package/dist/server/tools/watch.mjs +5 -3
  148. package/dist/server/vite.mjs +28 -31
  149. package/dist/server/web-app.mjs +7 -10
  150. package/dist/server/work-groups.mjs +1 -1
  151. package/dist/setup/apply.mjs +8 -14
  152. package/dist/setup/create.d.mts +4 -2
  153. package/dist/setup/create.mjs +118 -36
  154. package/dist/setup/design-system-checks.mjs +3 -12
  155. package/dist/setup/desktop-app-script.mjs +4 -3
  156. package/dist/setup/desktop-app-start.d.mts +8 -2
  157. package/dist/setup/desktop-app-start.mjs +64 -29
  158. package/dist/setup/desktop-app.d.mts +8 -0
  159. package/dist/setup/desktop-app.mjs +20 -4
  160. package/dist/setup/detect.d.mts +14 -7
  161. package/dist/setup/detect.mjs +56 -10
  162. package/dist/setup/doctor.mjs +2 -4
  163. package/dist/setup/existing-setup.d.mts +1 -3
  164. package/dist/setup/existing-setup.mjs +10 -11
  165. package/dist/setup/migrate/row-titles.mjs +1 -1
  166. package/dist/setup/own-app.d.mts +1 -2
  167. package/dist/setup/own-app.mjs +4 -5
  168. package/dist/setup/plan.d.mts +8 -6
  169. package/dist/setup/plan.mjs +64 -48
  170. package/dist/setup/project.d.mts +6 -17
  171. package/dist/setup/project.mjs +17 -61
  172. package/dist/setup/prompts.d.mts +5 -5
  173. package/dist/setup/prompts.mjs +28 -61
  174. package/dist/setup/questions.d.mts +12 -4
  175. package/dist/setup/questions.mjs +10 -25
  176. package/dist/setup/starters.d.mts +2 -0
  177. package/dist/setup/starters.mjs +26 -9
  178. package/dist/setup/workspace-setup.d.mts +1 -2
  179. package/dist/setup/workspace-setup.mjs +4 -6
  180. package/dist/setup/write.d.mts +15 -5
  181. package/dist/setup/write.mjs +35 -9
  182. package/dist/shared/annotations-core.mjs +1 -1
  183. package/dist/shared/canvas-core.mjs +1 -1
  184. package/dist/shared/canvas-file.d.mts +201 -0
  185. package/dist/shared/canvas-file.mjs +1 -0
  186. package/dist/shared/comments/routes.d.mts +53 -0
  187. package/dist/shared/comments/routes.mjs +37 -0
  188. package/dist/shared/feedback.d.mts +8 -0
  189. package/dist/shared/feedback.mjs +10 -2
  190. package/dist/shared/page-review.d.mts +2 -11
  191. package/dist/shared/page-review.mjs +4 -13
  192. package/dist/shared/presence-core.d.mts +11 -0
  193. package/dist/shared/presence-core.mjs +11 -2
  194. package/dist/shared/review-file.d.mts +5 -0
  195. package/dist/shared/review-file.mjs +23 -13
  196. package/dist/shared/server-page.mjs +7 -1
  197. package/dist/shared/signup.d.mts +2 -5
  198. package/dist/shared/signup.mjs +2 -35
  199. package/dist/shared/studio-events.d.mts +0 -6
  200. package/dist/shared/studio-events.mjs +1 -5
  201. package/dist/shared/studio-files.d.mts +12 -0
  202. package/dist/shared/studio-files.mjs +6 -1
  203. package/dist/shared/studio-routes.d.mts +16 -62
  204. package/dist/shared/studio-routes.mjs +1 -69
  205. package/dist/shared/threads-core.d.mts +2 -2
  206. package/dist/shared/threads-core.mjs +1 -1
  207. package/extension/dist/feedback.js +148 -138
  208. package/extension/dist/manifest.json +1 -1
  209. package/extension/dist/picker.js +146 -136
  210. package/package.json +3 -20
  211. package/src/cli/banner.ts +45 -11
  212. package/src/cli/commands/app.ts +23 -8
  213. package/src/cli/commands/create.ts +17 -9
  214. package/src/cli/commands/dev.ts +0 -3
  215. package/src/cli/commands/hook.ts +4 -1
  216. package/src/cli/help.ts +3 -3
  217. package/src/config/index.ts +6 -5
  218. package/src/config/project-files.ts +21 -11
  219. package/src/config/renamed.ts +0 -3
  220. package/src/config/schema.ts +0 -1
  221. package/src/content/capture.ts +6 -12
  222. package/src/content/content.ts +7 -244
  223. package/src/content/flow-specs.ts +2 -1
  224. package/src/content/prototype-summary.ts +4 -44
  225. package/src/content/review-pages.ts +2 -1
  226. package/src/content/snapshot-client.ts +1 -1
  227. package/src/content/text-replace.ts +449 -0
  228. package/src/paths.ts +0 -8
  229. package/src/server/agent-env.ts +12 -2
  230. package/src/server/agent-session.ts +124 -34
  231. package/src/server/brief.ts +8 -3
  232. package/src/server/channel.ts +121 -52
  233. package/src/server/claimed-presence.ts +93 -0
  234. package/src/server/comments/actions.ts +352 -0
  235. package/src/server/comments/routes.ts +176 -0
  236. package/src/server/comments/tools.ts +317 -0
  237. package/src/server/dev-server.ts +49 -15
  238. package/src/server/file-errors.ts +47 -13
  239. package/src/server/file-lock.ts +205 -54
  240. package/src/server/mcp.ts +13 -14
  241. package/src/server/me.ts +2 -5
  242. package/src/server/open-page.ts +54 -4
  243. package/src/server/outcome.ts +26 -0
  244. package/src/server/people.ts +2 -1
  245. package/src/server/port.ts +94 -20
  246. package/src/server/presence.ts +11 -3
  247. package/src/server/requests.ts +60 -70
  248. package/src/server/studio-for.ts +27 -3
  249. package/src/server/sync-install.ts +35 -26
  250. package/src/server/thread-place.ts +2 -4
  251. package/src/server/tools/reading.ts +16 -3
  252. package/src/server/tools/watch.ts +7 -7
  253. package/src/server/vite.ts +37 -40
  254. package/src/server/web-app.ts +14 -12
  255. package/src/setup/apply.ts +10 -16
  256. package/src/setup/create.ts +143 -37
  257. package/src/setup/design-system-checks.ts +7 -15
  258. package/src/setup/desktop-app-script.ts +4 -3
  259. package/src/setup/desktop-app-start.ts +94 -26
  260. package/src/setup/desktop-app.ts +24 -3
  261. package/src/setup/detect.ts +56 -14
  262. package/src/setup/doctor.ts +4 -4
  263. package/src/setup/existing-setup.ts +10 -12
  264. package/src/setup/own-app.ts +2 -5
  265. package/src/setup/plan.ts +93 -84
  266. package/src/setup/project.ts +25 -118
  267. package/src/setup/prompts.ts +44 -127
  268. package/src/setup/questions.ts +27 -29
  269. package/src/setup/starters.ts +35 -10
  270. package/src/setup/workspace-setup.ts +8 -18
  271. package/src/setup/write.ts +52 -9
  272. package/src/shared/canvas-file.ts +205 -0
  273. package/src/shared/comments/routes.ts +79 -0
  274. package/src/shared/feedback.ts +14 -4
  275. package/src/shared/page-review.ts +11 -16
  276. package/src/shared/presence-core.ts +16 -2
  277. package/src/shared/review-file.ts +28 -12
  278. package/src/shared/server-page.ts +11 -1
  279. package/src/shared/signup.ts +4 -28
  280. package/src/shared/studio-events.ts +0 -13
  281. package/src/shared/studio-files.ts +14 -0
  282. package/src/shared/studio-routes.ts +21 -64
  283. package/src/shared/threads-core.ts +2 -2
  284. package/templates/methods/review.md +2 -2
  285. package/templates/rules/canvas-frames.md +104 -0
  286. package/templates/rules/canvas.md +8 -142
  287. package/templates/rules/prototypes.md +1 -1
  288. package/templates/rules/snapshots.md +52 -0
  289. package/templates/starters/standalone/README.md +7 -7
  290. package/templates/starters/standalone/components.json +1 -1
  291. package/templates/starters/standalone/package.json +1 -2
  292. package/templates/starters/turborepo/README.md +6 -6
  293. package/templates/starters/turborepo/apps/web/components.json +1 -1
  294. package/templates/starters/turborepo/apps/web/package.json +1 -2
  295. package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
  296. package/templates/starters/turborepo/packages/ui/components.json +1 -1
  297. package/templates/starters/turborepo/packages/ui/package.json +1 -2
  298. package/templates/starters/vite/README.md +7 -6
  299. package/templates/starters/vite/components.json +1 -1
  300. package/templates/starters/vite/package.json +1 -2
  301. package/templates/starters/vite/src/app.tsx +3 -4
  302. package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
  303. package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
  304. package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
  305. package/templates/starters/vite/src/components/ui/button.tsx +17 -12
  306. package/templates/starters/vite/src/components/ui/card.tsx +1 -1
  307. package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
  308. package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
  309. package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
  310. package/templates/starters/vite/src/components/ui/field.tsx +3 -1
  311. package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
  312. package/templates/starters/vite/src/components/ui/input.tsx +1 -1
  313. package/templates/starters/vite/src/components/ui/label.tsx +2 -0
  314. package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
  315. package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
  316. package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
  317. package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
  318. package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
  319. package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
  320. package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
  321. package/templates/starters/vite/src/index.css +533 -111
  322. package/app/icons/sets/hugeicons.tsx +0 -259
  323. package/app/icons/sets/phosphor.tsx +0 -251
  324. package/dist/server/icon-set.d.mts +0 -15
  325. package/dist/server/icon-set.mjs +0 -31
  326. package/dist/server/tools/close-reply.d.mts +0 -6
  327. package/dist/server/tools/close-reply.mjs +0 -138
  328. package/dist/server/tools/comment.d.mts +0 -6
  329. package/dist/server/tools/comment.mjs +0 -49
  330. package/dist/shared/icon-sets.d.mts +0 -9
  331. package/dist/shared/icon-sets.mjs +0 -21
  332. package/src/server/icon-set.ts +0 -56
  333. package/src/server/tools/close-reply.ts +0 -271
  334. package/src/server/tools/comment.ts +0 -96
  335. package/src/shared/icon-sets.ts +0 -23
  336. /package/app/public/{sudio-192.png → dex-192.png} +0 -0
  337. /package/app/public/{sudio-512.png → dex-512.png} +0 -0
  338. /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
  339. /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
  340. /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
  341. /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
@@ -14,11 +14,6 @@ import { isPath, providerModule } from "../config/design-system.ts";
14
14
  import { dependenciesOf, packageFolder } from "../config/project-files.ts";
15
15
  import { isDirectory, isFile } from "../paths.ts";
16
16
  import { checkAgents } from "../server/agents.ts";
17
- import {
18
- ICON_SET_NAMES,
19
- INTERFACE_ICONS,
20
- type InterfaceIcons,
21
- } from "../shared/icon-sets.ts";
22
17
  import { STUDIO_FILES } from "../shared/studio-files.ts";
23
18
  import type { FoundDesignMd } from "./design-md.ts";
24
19
  import {
@@ -42,7 +37,6 @@ import {
42
37
  type ComponentsChoice,
43
38
  type ComponentsFinding,
44
39
  componentsAt,
45
- iconsFinding,
46
40
  type PackageManagerChoice,
47
41
  type PackageManagerName,
48
42
  type ProjectFindings,
@@ -59,12 +53,16 @@ import {
59
53
  QUESTION,
60
54
  QUESTIONS,
61
55
  type SetupDecisions,
56
+ type ShadcnInit,
57
+ shadcnInitFlags,
62
58
  } from "./questions.ts";
63
59
 
64
60
  /** Every flag of `dex create` that answers a question or sets a fact. */
65
61
  export interface SetupFlags {
66
62
  /** The agents to connect: "claude,codex", or "none". */
67
63
  agent?: string;
64
+ /** shadcn's component library for `shadcn init`. Sets up shadcn. */
65
+ base?: string;
68
66
  /** The components' folder, or "none". */
69
67
  components?: string;
70
68
  /** How DESIGN.md starts: "draft", "none", a file to link or import, or a URL. */
@@ -73,14 +71,14 @@ export interface SetupFlags {
73
71
  dir?: string;
74
72
  /** Say what it would do, and do nothing. */
75
73
  dryRun?: boolean;
76
- /** The icon set the interface draws with: "lucide", "phosphor" or "hugeicons". */
77
- icons?: string;
78
74
  /** How prototypes import the components, when it cannot be derived. */
79
75
  import?: string;
80
76
  json?: boolean;
81
77
  /** The package manager, instead of the detected one. */
82
78
  pm?: string;
83
- /** Build the studio's interface from the components; false: never. */
79
+ /** shadcn's preset for `shadcn init`: a name or a code. Sets up shadcn. */
80
+ preset?: string;
81
+ /** Build the studio's interface from the components: off unless true. */
84
82
  primitives?: boolean;
85
83
  /** The module that wraps every prototype view, or "none". */
86
84
  provider?: string;
@@ -315,6 +313,25 @@ const decidedComponents = (
315
313
  ...(open ? { open } : {}),
316
314
  });
317
315
 
316
+ /** The component libraries `shadcn init --base` takes. */
317
+ const SHADCN_BASES = ["base", "radix", "aria"];
318
+ const PRESET_RE = /^[\w-]+$/;
319
+
320
+ /** `--preset` and `--base`, checked: what `shadcn init` is given. */
321
+ function shadcnInit({ preset, base }: SetupFlags): ShadcnInit {
322
+ if (base !== undefined && !SHADCN_BASES.includes(base)) {
323
+ throw new Error(
324
+ `Unknown --base "${base}". Choose ${SHADCN_BASES.join(", ")}.`
325
+ );
326
+ }
327
+ if (preset !== undefined && !PRESET_RE.test(preset)) {
328
+ throw new Error(
329
+ `--preset takes a preset's name (nova) or its code from https://ui.shadcn.com/create (b2fA), not "${preset}".`
330
+ );
331
+ }
332
+ return { ...(preset ? { preset } : {}), ...(base ? { base } : {}) };
333
+ }
334
+
318
335
  /** The components, from a flag, a question or what was found. */
319
336
  async function decideComponents(
320
337
  findings: ProjectFindings,
@@ -322,8 +339,11 @@ async function decideComponents(
322
339
  ui: Reporter,
323
340
  ask: boolean
324
341
  ): Promise<Decided<ComponentsDecision>> {
325
- if (flags.shadcn) {
326
- return decidedComponents({ kind: "shadcn" }, "--shadcn");
342
+ if (flags.shadcn || flags.preset || flags.base) {
343
+ return decidedComponents(
344
+ { kind: "shadcn", ...shadcnInit(flags) },
345
+ flags.shadcn ? "--shadcn" : shadcnInitFlags(shadcnInit(flags)).join(" ")
346
+ );
327
347
  }
328
348
  if (flags.components === "none") {
329
349
  return decidedComponents({ kind: "none" }, "--components none");
@@ -575,15 +595,11 @@ async function decideStyles(
575
595
 
576
596
  // --- Primitives ---------------------------------------------------------------
577
597
 
578
- async function decidePrimitives(
579
- findings: ProjectFindings,
598
+ function decidePrimitives(
580
599
  components: ComponentsDecision,
581
- flags: SetupFlags,
582
- ui: Reporter,
583
- ask: boolean
584
- ): Promise<Decided<boolean>> {
600
+ flags: SetupFlags
601
+ ): Decided<boolean> {
585
602
  const choice = components.kind === "folder" ? components.choice : undefined;
586
- const fits = Boolean(choice?.baseUi && choice.import);
587
603
  const decided = (value: boolean, source: string, warning?: string) => ({
588
604
  key: "primitives",
589
605
  value,
@@ -592,105 +608,17 @@ async function decidePrimitives(
592
608
  shown: value ? `yes, from ${choice?.import}` : "no, the studio's own",
593
609
  ...(warning ? { warning } : {}),
594
610
  });
595
- if (flags.primitives === false) {
596
- return decided(false, "--no-primitives");
611
+ if (flags.primitives !== true) {
612
+ return decided(false, "Dex's own, unless --primitives");
597
613
  }
598
- if (flags.primitives === true) {
599
- if (!choice?.import) {
600
- return decided(
601
- false,
602
- "--primitives",
603
- "--primitives needs components with an import path, so the studio keeps its own"
604
- );
605
- }
606
- return decided(true, "--primitives");
607
- }
608
- if (!fits) {
609
- return decided(false, findings.primitives.evidence);
610
- }
611
- if (!ask) {
612
- return decided(true, `${findings.primitives.evidence}, so they fit`);
613
- }
614
- const yes = answered(
615
- await ui.confirm(
616
- [
617
- `Build the studio's own buttons, menus and dialogs from ${choice?.import}?`,
618
- " Your components use shadcn's Base UI API, so they fit.",
619
- ` (${QUESTION.primitives.flag})`,
620
- ].join("\n")
621
- )
622
- );
623
- return decided(yes, ANSWERED);
624
- }
625
-
626
- // --- Icon set -------------------------------------------------------------------
627
-
628
- export function iconSet(flag: string): InterfaceIcons {
629
- const set = INTERFACE_ICONS.find((each) => each === flag.trim());
630
- if (!set) {
631
- throw new Error(
632
- `Unknown icon set "${flag}". Choose ${INTERFACE_ICONS.join(", ")}.`
614
+ if (!choice?.import) {
615
+ return decided(
616
+ false,
617
+ "--primitives",
618
+ "--primitives needs components with an import path, so the studio keeps its own"
633
619
  );
634
620
  }
635
- return set;
636
- }
637
-
638
- /** Components chosen instead of those found bring their own. */
639
- async function decideIcons(
640
- findings: ProjectFindings,
641
- components: ComponentsDecision,
642
- flags: SetupFlags,
643
- ui: Reporter,
644
- ask: boolean
645
- ): Promise<Decided<InterfaceIcons>> {
646
- const decided = (value: InterfaceIcons, source: string) => ({
647
- key: "icons",
648
- value,
649
- source,
650
- flag: QUESTION.icons.flag,
651
- shown: ICON_SET_NAMES[value],
652
- });
653
- if (flags.icons !== undefined) {
654
- return decided(iconSet(flags.icons), "--icons");
655
- }
656
- const choice = components.kind === "folder" ? components.choice : undefined;
657
- const finding =
658
- choice && choice.dir !== findings.components.value?.dir
659
- ? iconsFinding(findings.root, choice, "its components.json")
660
- : findings.icons;
661
- if (!ask) {
662
- // More than one set installed: the one taken is a guess.
663
- const others = finding.alternatives.map((set) => ICON_SET_NAMES[set]);
664
- return finding.confidence === "guess"
665
- ? {
666
- ...decided(finding.value, finding.evidence),
667
- warning: `${ICON_SET_NAMES[finding.value]}, though ${others.join(" and ")} ${others.length === 1 ? "is" : "are"} installed too: check it, or choose with --icons`,
668
- open: {
669
- candidates: [finding.value, ...finding.alternatives].map((set) => ({
670
- value: set,
671
- })),
672
- safe: true,
673
- },
674
- }
675
- : decided(finding.value, finding.evidence);
676
- }
677
- const answer = answered(
678
- await ui.choose<InterfaceIcons>(
679
- [
680
- "Icon set: what Dex's interface draws its icons with",
681
- ` ${ICON_SET_NAMES[finding.value]} (${finding.evidence})`,
682
- ` (${QUESTION.icons.flag})`,
683
- ].join("\n"),
684
- [
685
- finding.value,
686
- ...INTERFACE_ICONS.filter((set) => set !== finding.value),
687
- ].map((set) => ({ value: set, label: ICON_SET_NAMES[set] }))
688
- )
689
- );
690
- return decided(
691
- answer,
692
- answer === finding.value ? finding.evidence : ANSWERED
693
- );
621
+ return decided(true, "--primitives");
694
622
  }
695
623
 
696
624
  // --- Provider -------------------------------------------------------------------
@@ -1225,23 +1153,13 @@ export async function decide(
1225
1153
  ): Promise<SetupDecisions> {
1226
1154
  const dir = decideDir(flags);
1227
1155
  const packageManager = decidePackageManager(findings, flags);
1228
- // Unknown agents and icon sets stop setup before any question.
1156
+ // Unknown agents stop setup before any question.
1229
1157
  if (flags.agent !== undefined) {
1230
1158
  parseAgents(flags.agent);
1231
1159
  }
1232
- if (flags.icons !== undefined) {
1233
- iconSet(flags.icons);
1234
- }
1235
1160
  const components = await decideComponents(findings, flags, ui, ask);
1236
1161
  const styles = await decideStyles(findings, components.value, flags, ui, ask);
1237
- const primitives = await decidePrimitives(
1238
- findings,
1239
- components.value,
1240
- flags,
1241
- ui,
1242
- ask
1243
- );
1244
- const icons = await decideIcons(findings, components.value, flags, ui, ask);
1162
+ const primitives = decidePrimitives(components.value, flags);
1245
1163
  const designMd = await decideDesignMd(
1246
1164
  findings,
1247
1165
  { components: components.value, dir: dir.value, styles: styles.value },
@@ -1257,7 +1175,6 @@ export async function decide(
1257
1175
  components,
1258
1176
  styles,
1259
1177
  primitives,
1260
- icons,
1261
1178
  ...(provider ? { provider } : {}),
1262
1179
  designMd,
1263
1180
  agents,
@@ -5,19 +5,33 @@
5
5
 
6
6
  import { relative } from "node:path";
7
7
  import { posix } from "../paths.ts";
8
- import { ICON_SET_NAMES, type InterfaceIcons } from "../shared/icon-sets.ts";
9
8
  import { type DesignMdDecision, fromProject } from "./design-md-setup.ts";
10
9
  import type { Placement } from "./detect/workspace.ts";
11
10
  import type { AgentId } from "./detect.ts";
12
11
  import type { ComponentsChoice, PackageManagerChoice } from "./project.ts";
13
12
  import type { ProviderNeed } from "./provider.ts";
14
13
 
14
+ /**
15
+ * How `shadcn init` sets the project up, as its own flags say it: a preset
16
+ * (a name, or a code from ui.shadcn.com/create) and the component library.
17
+ */
18
+ export interface ShadcnInit {
19
+ base?: string;
20
+ preset?: string;
21
+ }
22
+
15
23
  /** What to build prototypes with. */
16
24
  export type ComponentsDecision =
17
25
  | { kind: "folder"; choice: ComponentsChoice }
18
- | { kind: "shadcn" }
26
+ | ({ kind: "shadcn" } & ShadcnInit)
19
27
  | { kind: "none" };
20
28
 
29
+ /** `--preset` and `--base` as setup passes them on to `shadcn init`. */
30
+ export const shadcnInitFlags = ({ preset, base }: ShadcnInit): string[] => [
31
+ ...(preset ? ["--preset", preset] : []),
32
+ ...(base ? ["--base", base] : []),
33
+ ];
34
+
21
35
  /**
22
36
  * What wraps every prototype view (`designSystem.provider`): a module of the
23
37
  * project's (a path from where setup looked, or a package's module), the
@@ -66,7 +80,6 @@ export interface SetupDecisions {
66
80
  components: Decided<ComponentsDecision>;
67
81
  designMd: Decided<DesignMdDecision>;
68
82
  dir: Decided<string>;
69
- icons: Decided<InterfaceIcons>;
70
83
  packageManager: Decided<PackageManagerChoice>;
71
84
  primitives: Decided<boolean>;
72
85
  /**
@@ -227,7 +240,11 @@ export const QUESTION: {
227
240
  : decision.kind,
228
241
  asFlags: (decision, { cwd }) => {
229
242
  if (decision.kind === "shadcn") {
230
- return ["--shadcn"];
243
+ return [
244
+ "--shadcn",
245
+ ...(decision.preset ? [`--preset ${decision.preset}`] : []),
246
+ ...(decision.base ? [`--base ${decision.base}`] : []),
247
+ ];
231
248
  }
232
249
  if (decision.kind === "none") {
233
250
  return ["--components none"];
@@ -259,31 +276,13 @@ export const QUESTION: {
259
276
  primitives: {
260
277
  key: "primitives",
261
278
  label: "Primitives",
262
- flag: "--primitives | --no-primitives",
279
+ flag: "--primitives",
263
280
  asJson: (primitives) => primitives,
264
- // --primitives is honoured for any components with an import path, Base UI
265
- // or not; --no-primitives only differs from the default on Base UI.
266
- asFlags: (primitives, { components }) => {
267
- if (components.kind !== "folder") {
268
- return [];
269
- }
270
- const { baseUi, import: specifier } = components.choice;
271
- if (primitives) {
272
- return specifier ? ["--primitives"] : [];
273
- }
274
- return baseUi ? ["--no-primitives"] : [];
275
- },
276
- },
277
- icons: {
278
- key: "icons",
279
- label: "Icon set",
280
- flag: "--icons lucide|phosphor|hugeicons",
281
- asked: {
282
- question: "Which icon set should Dex's interface draw with?",
283
- choice: (icons) => ({ value: icons, label: ICON_SET_NAMES[icons] }),
284
- },
285
- asJson: (icons) => icons,
286
- asFlags: (icons) => [`--icons ${icons}`],
281
+ // Off unless asked for: --primitives, for components with an import path.
282
+ asFlags: (primitives, { components }) =>
283
+ primitives && components.kind === "folder" && components.choice.import
284
+ ? ["--primitives"]
285
+ : [],
287
286
  },
288
287
  provider: {
289
288
  key: "provider",
@@ -353,7 +352,6 @@ export const QUESTIONS: readonly AnyQuestion[] = [
353
352
  QUESTION.components,
354
353
  QUESTION.styles,
355
354
  QUESTION.primitives,
356
- QUESTION.icons,
357
355
  QUESTION.provider,
358
356
  QUESTION.designMd,
359
357
  QUESTION.agents,
@@ -1,4 +1,4 @@
1
- // The projects `dex create` starts in an empty folder (`--template`), as
1
+ // The projects `dex create` starts in a folder with no project (`--template`), as
2
2
  // docs/planning/starters.md has them. Each is a folder in templates/starters,
3
3
  // copied with the project's name, title and package manager filled in. The
4
4
  // shadcn components are written once, in the vite starter; the others take
@@ -10,6 +10,7 @@ import { TEMPLATES_DIR } from "../paths.ts";
10
10
  import type { Exec } from "./apply.ts";
11
11
  import { type PackageManagerName, USER_AGENT_RE } from "./project.ts";
12
12
  import { packageManagerName } from "./prompts.ts";
13
+ import { withEsbuildBuilds } from "./write.ts";
13
14
 
14
15
  export const STARTERS_DIR = join(TEMPLATES_DIR, "starters");
15
16
 
@@ -68,7 +69,7 @@ export const STARTERS: Record<StarterName, Starter> = {
68
69
  workspace: false,
69
70
  shared: [],
70
71
  next: [
71
- { script: "studio", what: "the studio, with a first file" },
72
+ { script: "dex", what: "Dex, with a first file" },
72
73
  { script: "dev", what: "your app" },
73
74
  ],
74
75
  },
@@ -80,7 +81,7 @@ export const STARTERS: Record<StarterName, Starter> = {
80
81
  packageManager: "npm",
81
82
  workspace: false,
82
83
  shared: [COMPONENTS, LIB, STYLES],
83
- next: [{ script: "studio", what: "the studio, with a first file" }],
84
+ next: [{ script: "dex", what: "Dex, with a first file" }],
84
85
  },
85
86
  turborepo: {
86
87
  name: "turborepo",
@@ -102,8 +103,8 @@ export const STARTERS: Record<StarterName, Starter> = {
102
103
  { from: "vite/src/index.css", to: "packages/ui/src/styles/globals.css" },
103
104
  ],
104
105
  next: [
105
- { script: "studio", what: "the studio, with a first file" },
106
- { script: "dev", what: "every app: apps/web and the studio" },
106
+ { script: "dex", what: "Dex, with a first file" },
107
+ { script: "dev", what: "every app: apps/web and Dex" },
107
108
  ],
108
109
  },
109
110
  };
@@ -179,6 +180,13 @@ export interface StarterValues {
179
180
  // npm leaves .gitignore files out of packages, so the starters' are renamed.
180
181
  const RENAMED: Record<string, string> = { gitignore: ".gitignore" };
181
182
 
183
+ /** What a starter writes at the project's root: "package.json", "src". */
184
+ export async function starterRootNames(starter: Starter): Promise<string[]> {
185
+ const own = await readdir(join(STARTERS_DIR, starter.name));
186
+ const shared = starter.shared.map(({ to }) => to.split("/")[0] ?? to);
187
+ return [...new Set([...own.map((name) => RENAMED[name] ?? name), ...shared])];
188
+ }
189
+
182
190
  /** Copy a file or a folder, filling in the values and making the changes. */
183
191
  async function copyTree(
184
192
  from: string,
@@ -229,14 +237,29 @@ async function fitPackageManager(
229
237
  manifest.workspaces = undefined;
230
238
  }
231
239
  await writeFile(file, `${JSON.stringify(manifest, null, 2)}\n`);
232
- if (values.pm === "pnpm" && Array.isArray(workspaces)) {
233
- await writeFile(
234
- join(root, "pnpm-workspace.yaml"),
235
- `packages:\n${workspaces.map((glob) => ` - "${glob}"`).join("\n")}\n`
236
- );
240
+ if (values.pm === "pnpm") {
241
+ await writePnpmWorkspace(root, workspaces);
237
242
  }
238
243
  }
239
244
 
245
+ /**
246
+ * pnpm's settings file: the workspaces, in a workspace, and what to do with
247
+ * esbuild's install script. Vite brings esbuild, and pnpm 11 stops the
248
+ * install on a script nobody decided on (write.ts, withEsbuildBuilds).
249
+ */
250
+ async function writePnpmWorkspace(
251
+ root: string,
252
+ workspaces: unknown
253
+ ): Promise<void> {
254
+ const packages = Array.isArray(workspaces)
255
+ ? `packages:\n${workspaces.map((glob) => ` - "${glob}"`).join("\n")}\n`
256
+ : "";
257
+ await writeFile(
258
+ join(root, "pnpm-workspace.yaml"),
259
+ withEsbuildBuilds(packages) ?? packages
260
+ );
261
+ }
262
+
240
263
  /**
241
264
  * Copy `starter` into `root`, which is empty: its own files, then the files
242
265
  * it shares with another, with the name, title and package manager filled in.
@@ -268,5 +291,7 @@ export async function copyStarter(
268
291
  }
269
292
  if (starter.workspace) {
270
293
  await fitPackageManager(root, values);
294
+ } else if (values.pm === "pnpm") {
295
+ await writePnpmWorkspace(root, undefined);
271
296
  }
272
297
  }
@@ -7,7 +7,6 @@
7
7
 
8
8
  import { existsSync, readFileSync } from "node:fs";
9
9
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
10
- import { pmCommand } from "../config/package-manager.ts";
11
10
  import { PACKAGE_NAME, posix, studioVersion } from "../paths.ts";
12
11
  import { designMdFinding } from "./design-md-setup.ts";
13
12
  import {
@@ -22,8 +21,12 @@ import {
22
21
  ownAppFacts,
23
22
  rootStudioScript,
24
23
  } from "./own-app.ts";
25
- import type { StudioTarget, WorkspaceSetup } from "./plan.ts";
26
- import { findProject, iconsFinding, type ProjectFindings } from "./project.ts";
24
+ import {
25
+ installCommand,
26
+ type StudioTarget,
27
+ type WorkspaceSetup,
28
+ } from "./plan.ts";
29
+ import { findProject, type ProjectFindings } from "./project.ts";
27
30
  import type { SetupFlags } from "./prompts.ts";
28
31
  import type { SetupDecisions } from "./questions.ts";
29
32
 
@@ -124,14 +127,6 @@ export async function findingsFor(
124
127
  evidence: `${library.folder} is a shared package`,
125
128
  alternatives: candidates.filter((choice) => choice !== shared),
126
129
  },
127
- icons:
128
- shared === value
129
- ? findings.icons
130
- : iconsFinding(
131
- findings.root,
132
- shared,
133
- `${library.folder}'s components.json`
134
- ),
135
130
  designSystem: { ...findings.designSystem, name: library.name },
136
131
  };
137
132
  }
@@ -207,11 +202,7 @@ export function workspaceSetup(
207
202
  placement: Placement,
208
203
  findings: ProjectFindings,
209
204
  decisions: SetupDecisions,
210
- {
211
- flags,
212
- cwd,
213
- iconPackages,
214
- }: { flags: SetupFlags; cwd: string; iconPackages: Record<string, string> }
205
+ { flags, cwd }: { flags: SetupFlags; cwd: string }
215
206
  ): WorkspaceSetup {
216
207
  const manager = decisions.packageManager.value;
217
208
  const studioSpec = studioSpecFor(findings, placement, flags, {
@@ -224,13 +215,12 @@ export function workspaceSetup(
224
215
  ? ownAppFacts(workspace, placement, {
225
216
  componentsDir:
226
217
  components.kind === "folder" ? components.choice.dir : undefined,
227
- iconPackages,
228
218
  studioSpec: studioSpec ?? versionSpec(),
229
219
  })
230
220
  : undefined;
231
221
  return {
232
222
  app,
233
- install: pmCommand(manager.agent, "install", []),
223
+ install: installCommand(manager.agent),
234
224
  rootScripts: recordAt(readManifest(workspace.root), "scripts"),
235
225
  studioScript: rootStudioScript(workspace, manager, placement),
236
226
  studioSpec,
@@ -3,7 +3,7 @@
3
3
 
4
4
  import { isAbsolute, relative, resolve } from "node:path";
5
5
  import { componentName } from "../config/design-system.ts";
6
- import type { DesignSystemConfig, StudioInterface } from "../config/index.ts";
6
+ import type { DesignSystemConfig } from "../config/index.ts";
7
7
  import { PACKAGE_NAME, posix } from "../paths.ts";
8
8
  import { stateIgnoreLine } from "../server/state.ts";
9
9
  import type { StylingApproach } from "../shared/design-system.ts";
@@ -101,20 +101,17 @@ export function designSystemConfig(
101
101
  /**
102
102
  * dex.config.ts for a new studio: the choices made, and nothing the
103
103
  * project's files or the defaults say. `studio` is "studio", or "." for an
104
- * app of its own. The icon set is always written, Lucide too: it is a
105
- * choice the team made, and what the install brought in.
104
+ * app of its own.
106
105
  */
107
106
  export function configSource(
108
107
  designSystem: DesignSystemConfig | undefined,
109
108
  {
110
109
  studio,
111
110
  primitives,
112
- icons,
113
111
  next,
114
112
  }: {
115
113
  studio: string;
116
114
  primitives: boolean;
117
- icons: NonNullable<StudioInterface["icons"]>;
118
115
  next?: boolean;
119
116
  }
120
117
  ): string {
@@ -137,9 +134,9 @@ export default defineConfig({${content}});
137
134
  designSystem: designSystem as unknown as ConfigValue | undefined,
138
135
  plugins: next ? [{ code: "next()" }] : undefined,
139
136
  },
140
- // With primitives, the studio's interface uses the project's own
141
- // buttons, menus and dialogs rather than carrying second copies.
142
- ui: { icons, ...(primitives ? { primitives: true } : {}) },
137
+ // With primitives (--primitives), the studio's interface uses the
138
+ // project's own buttons, menus and dialogs rather than its own.
139
+ ...(primitives ? { ui: { primitives: true } } : {}),
143
140
  });
144
141
  }
145
142
 
@@ -252,11 +249,12 @@ export const fromStudio = (content: string, file: string): string => {
252
249
  * the project's own file changes by a dependency and a line.
253
250
  */
254
251
  export const STUDIO_SCRIPTS: Record<string, string> = {
255
- studio: "dex dev",
252
+ dex: "dex dev",
256
253
  };
257
254
 
258
255
  /** A later setup leaves these, as anything of the project's own: as Dex wrote them, or Sudio. */
259
256
  export const OLD_SCRIPTS: Record<string, string[]> = {
257
+ studio: ["dex dev", "sudio dev"],
260
258
  "studio:build": ["dex build", "sudio build"],
261
259
  "studio:claude": ["dex claude", "sudio claude"],
262
260
  };
@@ -309,6 +307,51 @@ export const withIgnoreLines = (
309
307
  ? gitignore
310
308
  : `${gitignore.trimEnd() ? `${gitignore.trimEnd()}\n\n` : ""}# Dex\n${missing.join("\n")}\n`;
311
309
 
310
+ // --- pnpm's build scripts -----------------------------------------------------
311
+ //
312
+ // The studio's Vite brings esbuild, whose install script pnpm runs only when
313
+ // the project allows it. pnpm 11 stops the install on a script nobody
314
+ // decided on (ERR_PNPM_IGNORED_BUILDS), and then every later install too;
315
+ // pnpm 10 warned. esbuild runs without its script (it only checks the
316
+ // binary its platform package brings), so setup says so for the project:
317
+ // `allowBuilds: { esbuild: false }`, which pnpm 10 reads as well.
318
+
319
+ const ESBUILD_DECIDED_RE = /^\s*-?\s*["']?esbuild["']?\s*(:|$)/m;
320
+ const ALL_BUILDS_RE =
321
+ /^(dangerouslyAllowAllBuilds:\s*true|strictDepBuilds:\s*false)\s*$/m;
322
+ const ALLOW_BUILDS_RE = /^allowBuilds:[ \t]*\n((?:[ \t]+.*\n?)*)/m;
323
+ const ALLOW_BUILDS_KEY_RE = /^allowBuilds:/m;
324
+ const INDENT_RE = /^([ \t]+)\S/;
325
+
326
+ /**
327
+ * Whether pnpm-workspace.yaml settles esbuild's install script already:
328
+ * names it in any list or map (allowBuilds, onlyBuiltDependencies...), or
329
+ * allows every script.
330
+ */
331
+ export const pnpmDecidesEsbuild = (yaml: string): boolean =>
332
+ ESBUILD_DECIDED_RE.test(yaml) || ALL_BUILDS_RE.test(yaml);
333
+
334
+ /**
335
+ * pnpm-workspace.yaml with `esbuild: false` under `allowBuilds`, keeping
336
+ * everything else; undefined when its `allowBuilds` is written some way
337
+ * this can't add to (`allowBuilds: {}`).
338
+ */
339
+ export function withEsbuildBuilds(yaml: string): string | undefined {
340
+ const block = ALLOW_BUILDS_RE.exec(yaml);
341
+ if (block) {
342
+ const indent = INDENT_RE.exec(block[1] ?? "")?.[1] ?? " ";
343
+ const end = block.index + block[0].length;
344
+ const before = yaml.slice(0, end);
345
+ const line = `${indent}esbuild: false\n`;
346
+ return `${before}${before.endsWith("\n") ? "" : "\n"}${line}${yaml.slice(end)}`;
347
+ }
348
+ if (ALLOW_BUILDS_KEY_RE.test(yaml)) {
349
+ return;
350
+ }
351
+ const kept = yaml.trimEnd();
352
+ return `${kept ? `${kept}\n` : ""}allowBuilds:\n esbuild: false\n`;
353
+ }
354
+
312
355
  /**
313
356
  * The pointer setup adds to the root's AGENTS.md or CLAUDE.md, so an agent
314
357
  * started at the root reads the studio's brief before studio work.