@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
package/src/setup/plan.ts CHANGED
@@ -9,21 +9,27 @@ import type { Agent } from "package-manager-detector";
9
9
  import { pmCommand } from "../config/package-manager.ts";
10
10
  import { parseJsonc } from "../config/project-files.ts";
11
11
  import { PACKAGE_NAME } from "../paths.ts";
12
- import { ICON_SET_NAMES } from "../shared/icon-sets.ts";
13
12
  import { listing } from "../shared/listing.ts";
14
13
  import { STUDIO_FILES } from "../shared/studio-files.ts";
15
14
  import { designMdDetail, fromProject } from "./design-md-setup.ts";
16
15
  import type { AgentId } from "./detect.ts";
17
16
  import type { OwnAppFacts } from "./own-app.ts";
18
17
  import { agentName, type StudioPackage } from "./project.ts";
19
- import { PROVIDER_FILE, type SetupDecisions } from "./questions.ts";
18
+ import {
19
+ PROVIDER_FILE,
20
+ type SetupDecisions,
21
+ type ShadcnInit,
22
+ shadcnInitFlags,
23
+ } from "./questions.ts";
20
24
  import {
21
25
  hasPointer,
22
26
  ignoreFile,
23
27
  missingIgnoreLines,
24
28
  missingScripts,
25
29
  OLD_SCRIPTS,
30
+ pnpmDecidesEsbuild,
26
31
  STUDIO_TYPES_FILE,
32
+ withEsbuildBuilds,
27
33
  } from "./write.ts";
28
34
 
29
35
  /** A file or folder setup writes, by what it is. */
@@ -39,7 +45,8 @@ export type WriteKind =
39
45
  | "agent"
40
46
  | "app-package"
41
47
  | "turbo"
42
- | "root-script";
48
+ | "root-script"
49
+ | "pnpm-builds";
43
50
 
44
51
  /** A command setup runs, by what it is for. */
45
52
  export type RunKind = "shadcn" | "install" | "link";
@@ -104,15 +111,13 @@ export interface WorkspaceSetup {
104
111
  install: string[];
105
112
  /** The workspace root's package.json scripts. */
106
113
  rootScripts: Record<string, string>;
107
- /** The root's "studio" script: "turbo run dev --filter=@acme/studio". */
114
+ /** The root's "dex" script: "turbo run dev --filter=@acme/studio". */
108
115
  studioScript: string;
109
116
  /** How package.json asks for the studio: "^0.3.0", "file:..."; undefined when listed. */
110
117
  studioSpec: string | undefined;
111
118
  }
112
119
 
113
120
  export interface SetupPlan {
114
- /** The icon set's packages the studio's package gets: in a workspace, in its package.json. */
115
- iconPackages: Record<string, string>;
116
121
  steps: PlanStep[];
117
122
  /** The studio's folder, relative to where the plan starts: "studio". */
118
123
  studio: string;
@@ -153,8 +158,10 @@ export interface PlanInput {
153
158
  gitignore: string;
154
159
  /** The .gitignore where the plan starts. */
155
160
  hostGitignore: string | undefined;
156
- /** The icon set's packages it lacks: none for Lucide, which comes with the studio. */
157
- iconPackages: Record<string, string>;
161
+ /** pnpm 11 or later: it stops an install on a build script nobody decided on. */
162
+ pnpmStopsOnBuilds?: boolean;
163
+ /** pnpm-workspace.yaml where the plan starts, when it has one. */
164
+ pnpmWorkspace?: string;
158
165
  /** Where setup looked, absolute: the files decisions name are shown from it. */
159
166
  projectRoot?: string;
160
167
  /** Ask nothing: no terminal, or --yes. */
@@ -203,34 +210,20 @@ const AGENT_DETAIL: Record<string, string> = {
203
210
  /** A command as one line: "bun add -D @dexhq/canvas". */
204
211
  export const commandLine = (command: string[]): string => command.join(" ");
205
212
 
213
+ /**
214
+ * npm's audit and funding notes are about the project's whole tree, not the
215
+ * studio: setup leaves them out of its installs, as shadcn does.
216
+ */
217
+ const quietly = (agent: Agent, command: string[]): string[] =>
218
+ agent === "npm" ? [...command, "--no-audit", "--no-fund"] : command;
219
+
206
220
  /** `<manager> add -D <specs>`, as the project's package manager writes it. */
207
221
  export const addCommand = (agent: Agent, ...specs: string[]): string[] =>
208
- pmCommand(agent, "add", ["-D", ...specs]);
209
-
210
- /** As an install names them: "@phosphor-icons/react@^2.1.10". */
211
- const specsOf = (packages: Record<string, string>): string[] =>
212
- Object.entries(packages).map(([name, range]) => `${name}@${range}`);
222
+ quietly(agent, pmCommand(agent, "add", ["-D", ...specs]));
213
223
 
214
- const withIcons = (input: PlanInput, detail: string): string =>
215
- Object.keys(input.iconPackages).length > 0
216
- ? `${detail}, and ${ICON_SET_NAMES[input.decisions.icons.value]}, its icon set`
217
- : detail;
218
-
219
- /** The icon set's packages on their own, for a project that has the studio. */
220
- function iconSteps(input: PlanInput): PlanStep[] {
221
- const icons = specsOf(input.iconPackages);
222
- if (icons.length === 0) {
223
- return [];
224
- }
225
- return [
226
- {
227
- action: "run",
228
- run: "install",
229
- command: addCommand(input.decisions.packageManager.value.agent, ...icons),
230
- detail: `${ICON_SET_NAMES[input.decisions.icons.value]}, the icon set`,
231
- },
232
- ];
233
- }
224
+ /** `<manager> install`, as the project's package manager writes it. */
225
+ export const installCommand = (agent: Agent): string[] =>
226
+ quietly(agent, pmCommand(agent, "install", []));
234
227
 
235
228
  function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
236
229
  const { agent } = input.decisions.packageManager.value;
@@ -239,15 +232,8 @@ function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
239
232
  {
240
233
  action: "run",
241
234
  run: "install",
242
- command: addCommand(
243
- agent,
244
- `${PACKAGE_NAME}@${again.upgrade.to}`,
245
- ...specsOf(input.iconPackages)
246
- ),
247
- detail: withIcons(
248
- input,
249
- `the studio, ${again.upgrade.from} → ${again.upgrade.to}: what this setup writes needs it`
250
- ),
235
+ command: addCommand(agent, `${PACKAGE_NAME}@${again.upgrade.to}`),
236
+ detail: `the studio, ${again.upgrade.from} → ${again.upgrade.to}: what this setup writes needs it`,
251
237
  },
252
238
  ];
253
239
  }
@@ -256,13 +242,12 @@ function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
256
242
  {
257
243
  action: "run",
258
244
  run: "install",
259
- command: pmCommand(agent, "install", []),
245
+ command: installCommand(agent),
260
246
  detail: "the studio is in package.json, not installed yet",
261
247
  },
262
- ...iconSteps(input),
263
248
  ];
264
249
  }
265
- return iconSteps(input);
250
+ return [];
266
251
  }
267
252
 
268
253
  /** The install, or the advice that replaces it, for how the studio is in. */
@@ -274,9 +259,7 @@ function installSteps(input: PlanInput): PlanStep[] {
274
259
  }
275
260
  const { again } = input;
276
261
  if (workspace) {
277
- const asks =
278
- workspace.studioSpec || Object.keys(input.iconPackages).length > 0;
279
- if (again?.installed && !asks) {
262
+ if (again?.installed && !workspace.studioSpec) {
280
263
  return [];
281
264
  }
282
265
  // Everything is in package.json already: one install, at the root.
@@ -288,29 +271,25 @@ function installSteps(input: PlanInput): PlanStep[] {
288
271
  action: "run",
289
272
  run: "install",
290
273
  command: workspace.install,
291
- detail: withIcons(
292
- input,
293
- workspace.studioSpec
294
- ? `from the workspace root: ${PACKAGE_NAME} ${workspace.studioSpec}${links}`
295
- : "from the workspace root"
296
- ),
274
+ detail: workspace.studioSpec
275
+ ? `from the workspace root: ${PACKAGE_NAME} ${workspace.studioSpec}${links}`
276
+ : "from the workspace root",
297
277
  },
298
278
  ];
299
279
  }
300
280
  const { agent, name } = decisions.packageManager.value;
301
- const icons = specsOf(input.iconPackages);
302
281
  if (studioSpec) {
303
282
  return [
304
283
  {
305
284
  action: "run",
306
285
  run: "install",
307
- command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}`, ...icons),
308
- detail: withIcons(input, `the studio, from ${studioSpec}`),
286
+ command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}`),
287
+ detail: `the studio, from ${studioSpec}`,
309
288
  },
310
289
  ];
311
290
  }
312
291
  if (studioPackage.kind === "listed") {
313
- return again ? againSteps(input, again) : iconSteps(input);
292
+ return again ? againSteps(input, again) : [];
314
293
  }
315
294
  if (studioPackage.kind === "linked") {
316
295
  // Linked into the project (`bun link`): installing would replace a working
@@ -324,7 +303,6 @@ function installSteps(input: PlanInput): PlanStep[] {
324
303
  detail:
325
304
  "keeps the linked studio in package.json, not installed from npm",
326
305
  },
327
- ...iconSteps(input),
328
306
  ];
329
307
  }
330
308
  const protocol = name === "npm" ? "file" : "link";
@@ -332,11 +310,7 @@ function installSteps(input: PlanInput): PlanStep[] {
332
310
  {
333
311
  action: "ask",
334
312
  command: commandLine(
335
- addCommand(
336
- agent,
337
- `${PACKAGE_NAME}@${protocol}:${studioPackage.dir}`,
338
- ...icons
339
- )
313
+ addCommand(agent, `${PACKAGE_NAME}@${protocol}:${studioPackage.dir}`)
340
314
  ),
341
315
  detail: `${PACKAGE_NAME} is linked into this project, so it is not installed. It is not in package.json, so the next install may remove the link. To keep it, run`,
342
316
  },
@@ -346,8 +320,8 @@ function installSteps(input: PlanInput): PlanStep[] {
346
320
  {
347
321
  action: "run",
348
322
  run: "install",
349
- command: addCommand(agent, PACKAGE_NAME, ...icons),
350
- detail: withIcons(input, "the studio"),
323
+ command: addCommand(agent, PACKAGE_NAME),
324
+ detail: "the studio",
351
325
  },
352
326
  ];
353
327
  }
@@ -395,6 +369,18 @@ function configDetail(input: PlanInput): string {
395
369
  return parts.join(", ");
396
370
  }
397
371
 
372
+ /**
373
+ * What `shadcn init` is given: the preset and library chosen, or, asking
374
+ * nothing, its defaults (`--defaults`: the base-nova preset).
375
+ */
376
+ function shadcnArgs(init: ShadcnInit, quiet: boolean): string[] {
377
+ const chosen = shadcnInitFlags(init);
378
+ if (!quiet) {
379
+ return chosen;
380
+ }
381
+ return [...(init.preset ? chosen : ["--defaults", ...chosen]), "--yes"];
382
+ }
383
+
398
384
  /** shadcn first, when the person has no components yet. */
399
385
  function shadcnSteps(input: PlanInput): PlanStep[] {
400
386
  const { decisions, quiet } = input;
@@ -408,7 +394,10 @@ function shadcnSteps(input: PlanInput): PlanStep[] {
408
394
  command: pmCommand(decisions.packageManager.value.agent, "execute", [
409
395
  "shadcn@latest",
410
396
  "init",
411
- ...(quiet ? ["--defaults", "--yes"] : []),
397
+ ...shadcnArgs(decisions.components.value, quiet),
398
+ // A first component, so a preset leaves a components folder too,
399
+ // as --defaults does.
400
+ "button",
412
401
  ]),
413
402
  interactive: !quiet,
414
403
  detail: "sets up shadcn's components and styles first",
@@ -429,18 +418,12 @@ function tsconfigDetail(input: PlanInput): string {
429
418
  }
430
419
 
431
420
  /** Its own app's package.json: the line that says what it depends on. */
432
- function appDetail(
433
- app: OwnAppFacts,
434
- iconPackages: Record<string, string>
435
- ): string {
421
+ function appDetail(app: OwnAppFacts): string {
436
422
  const parts = [PACKAGE_NAME];
437
423
  if (app.designSystem) {
438
424
  parts.push(`${app.designSystem} ${app.dependencies[app.designSystem]}`);
439
425
  }
440
426
  parts.push(`react ${app.dependencies.react}`);
441
- for (const [name, range] of Object.entries(iconPackages)) {
442
- parts.push(`${name} ${range}`);
443
- }
444
427
  return parts.join(", ");
445
428
  }
446
429
 
@@ -455,7 +438,7 @@ function appSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
455
438
  action: "create",
456
439
  write: "app-package",
457
440
  path: inPackage(target.package, "package.json"),
458
- detail: appDetail(app, input.iconPackages),
441
+ detail: appDetail(app),
459
442
  },
460
443
  ];
461
444
  if (app.turbo) {
@@ -599,7 +582,7 @@ function studioSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
599
582
  ];
600
583
  }
601
584
 
602
- /** "+ script "studio"". */
585
+ /** "+ script "dex"". */
603
586
  const scriptsDetail = (names: string[]): string =>
604
587
  `+ ${names.length === 1 ? "script" : "scripts"} ${names.map((name) => `"${name}"`).join(", ")}`;
605
588
 
@@ -624,11 +607,6 @@ function scriptSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
624
607
  ...(workspace?.studioSpec
625
608
  ? [studioDetail(input, workspace.studioSpec)]
626
609
  : []),
627
- ...(workspace
628
- ? Object.entries(input.iconPackages).map(
629
- ([name, range]) => `+ devDependency ${name} ${range}`
630
- )
631
- : []),
632
610
  ];
633
611
  if (added.length > 0 && existing.has(path)) {
634
612
  steps.push({
@@ -639,12 +617,12 @@ function scriptSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
639
617
  });
640
618
  }
641
619
  }
642
- if (workspace && !("studio" in workspace.rootScripts)) {
620
+ if (workspace && !("dex" in workspace.rootScripts)) {
643
621
  steps.push({
644
622
  action: "edit",
645
623
  write: "root-script",
646
624
  path: "package.json",
647
- detail: `+ script "studio": "${workspace.studioScript}"`,
625
+ detail: `+ script "dex": "${workspace.studioScript}"`,
648
626
  });
649
627
  }
650
628
  return steps;
@@ -719,6 +697,37 @@ function noteSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
719
697
  return notes;
720
698
  }
721
699
 
700
+ /**
701
+ * With pnpm 11 or later, what the project says about esbuild's install
702
+ * script, when it says nothing yet and the studio is about to be installed:
703
+ * pnpm stops the install otherwise (write.ts, withEsbuildBuilds). pnpm 10
704
+ * only warns, so its projects keep their files as they are.
705
+ */
706
+ function pnpmSteps(input: PlanInput): PlanStep[] {
707
+ const yaml = input.pnpmWorkspace ?? "";
708
+ const installs =
709
+ input.skipInstall ||
710
+ installSteps(input).some((step) => step.action === "run");
711
+ if (
712
+ input.decisions.packageManager.value.name !== "pnpm" ||
713
+ !input.pnpmStopsOnBuilds ||
714
+ !installs ||
715
+ pnpmDecidesEsbuild(yaml) ||
716
+ withEsbuildBuilds(yaml) === undefined
717
+ ) {
718
+ return [];
719
+ }
720
+ return [
721
+ {
722
+ action: input.pnpmWorkspace === undefined ? "create" : "edit",
723
+ write: "pnpm-builds",
724
+ path: "pnpm-workspace.yaml",
725
+ detail:
726
+ "+ allowBuilds: esbuild: false (the studio's Vite runs without its install script; pnpm 11 stops without a choice)",
727
+ },
728
+ ];
729
+ }
730
+
722
731
  /** Every step `dex create` takes, in order. */
723
732
  export function planSetup(input: PlanInput): SetupPlan {
724
733
  const target: StudioTarget = input.target ?? {
@@ -727,7 +736,6 @@ export function planSetup(input: PlanInput): SetupPlan {
727
736
  studio: input.decisions.dir.value,
728
737
  };
729
738
  return {
730
- iconPackages: input.iconPackages,
731
739
  studio: target.studio,
732
740
  target,
733
741
  ...(input.workspace ? { workspace: input.workspace } : {}),
@@ -738,6 +746,7 @@ export function planSetup(input: PlanInput): SetupPlan {
738
746
  ...projectSteps(input, target),
739
747
  ...agentSteps(input),
740
748
  ...noteSteps(input, target),
749
+ ...pnpmSteps(input),
741
750
  ...installSteps(input),
742
751
  ],
743
752
  };
@@ -4,7 +4,6 @@
4
4
  // here asks or writes.
5
5
 
6
6
  import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
7
- import { createRequire } from "node:module";
8
7
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
9
8
  import type { Agent, AgentName } from "package-manager-detector";
10
9
  import { detect } from "package-manager-detector/detect";
@@ -12,16 +11,12 @@ import {
12
11
  dependenciesOf,
13
12
  exportedComponents,
14
13
  filesImport,
14
+ installedPackageDir,
15
15
  packageAt,
16
16
  packageFolder,
17
17
  } from "../config/project-files.ts";
18
- import { PACKAGE_NAME, posix, studioPeer } from "../paths.ts";
18
+ import { PACKAGE_NAME, posix } from "../paths.ts";
19
19
  import type { StylingApproach } from "../shared/design-system.ts";
20
- import {
21
- ICON_SET_PACKAGES,
22
- type InterfaceIcons,
23
- iconSetsIn,
24
- } from "../shared/icon-sets.ts";
25
20
  import { STUDIO_FILES } from "../shared/studio-files.ts";
26
21
  import type { FoundDesignMd } from "./design-md.ts";
27
22
  import { designMdFinding } from "./design-md-setup.ts";
@@ -36,6 +31,7 @@ import {
36
31
  globalCssFiles,
37
32
  isMixedFolder,
38
33
  libraryAt,
34
+ runningAgent,
39
35
  } from "./detect.ts";
40
36
  import { type Finding, found } from "./findings.ts";
41
37
  import { type ProviderNeed, providerFinding } from "./provider.ts";
@@ -69,11 +65,6 @@ export interface ComponentsChoice {
69
65
  dir: string;
70
66
  /** Relative to the project, with forward slashes: "src/components/ui". */
71
67
  folder: string;
72
- /**
73
- * The icon set they draw with (components.json's iconLibrary), when the
74
- * studio's interface has it too.
75
- */
76
- icons?: InterfaceIcons;
77
68
  /** How prototypes import them: "@/components/ui"; undefined when unknown. */
78
69
  import: string | undefined;
79
70
  /** The first few components' names, to recognise the folder by. */
@@ -136,12 +127,9 @@ export interface ProjectFindings {
136
127
  imports: string[];
137
128
  styling: StylingApproach | undefined;
138
129
  };
139
- /** The icon set the project draws with already, else Lucide. */
140
- icons: Finding<InterfaceIcons>;
141
130
  /** The package's name, from package.json. */
142
131
  name: string | undefined;
143
132
  packageManager: Finding<PackageManagerChoice>;
144
- primitives: Finding<boolean>;
145
133
  /** A provider the design system needs around every view, when it needs one. */
146
134
  provider: Finding<ProviderNeed | undefined>;
147
135
  /** Absolute: the project's folder. */
@@ -187,7 +175,6 @@ export function componentsChoice(
187
175
  count: library.components.length,
188
176
  names: library.components.slice(0, NAMES_SHOWN).map(({ path }) => path),
189
177
  baseUi: Boolean(library.baseUi),
190
- ...(library.icons ? { icons: library.icons } : {}),
191
178
  styles: library.globalCss ? posix(library.globalCss) : undefined,
192
179
  };
193
180
  }
@@ -326,96 +313,6 @@ function stylesFinding(
326
313
  );
327
314
  }
328
315
 
329
- function primitivesFinding(
330
- components: ComponentsChoice | undefined,
331
- source: string
332
- ): Finding<boolean> {
333
- if (components?.baseUi && components.import) {
334
- return found(true, `${source} → style is shadcn on Base UI`);
335
- }
336
- return found(
337
- false,
338
- components
339
- ? "your components are not shadcn on Base UI"
340
- : "no components to build it from"
341
- );
342
- }
343
-
344
- /** Icon packages people draw with that Dex's interface has no set for. */
345
- const OTHER_ICON_PACKAGES = [
346
- "@heroicons/react",
347
- "@primer/octicons-react",
348
- "@radix-ui/react-icons",
349
- "@tabler/icons-react",
350
- "@mui/icons-material",
351
- "@fortawesome/react-fontawesome",
352
- "@iconify/react",
353
- "@remixicon/react",
354
- "react-icons",
355
- ];
356
-
357
- /**
358
- * `source` names the components.json. Beside Lucide, which shadcn's
359
- * components bring, another set is the one chosen.
360
- */
361
- export function iconsFinding(
362
- root: string,
363
- components: ComponentsChoice | undefined,
364
- source: string
365
- ): Finding<InterfaceIcons> {
366
- if (components?.icons) {
367
- return found(components.icons, `${source} → iconLibrary`, "certain");
368
- }
369
- const home = components && packageFolder(components.dir);
370
- const manifests = [...(home && home !== root ? [home] : []), root];
371
- const sets = manifests.flatMap((dir) =>
372
- iconSetsIn(dependenciesOf(dir).all)
373
- .sort((a, b) => Number(a === "lucide") - Number(b === "lucide"))
374
- .map((set) => ({ dir, set }))
375
- );
376
- const [first, ...rest] = sets;
377
- if (!first) {
378
- const other = manifests
379
- .flatMap((dir) => {
380
- const { all } = dependenciesOf(dir);
381
- return OTHER_ICON_PACKAGES.filter((name) => all[name]);
382
- })
383
- .at(0);
384
- return found(
385
- "lucide",
386
- other
387
- ? `${other} isn't one Dex draws with, so Lucide`
388
- : "no iconLibrary in components.json, and no icon set in package.json, so Lucide",
389
- "likely"
390
- );
391
- }
392
- const others = [...new Set(rest.map(({ set }) => set))].filter(
393
- (set) => set !== first.set
394
- );
395
- return found(
396
- first.set,
397
- `${shown(root, join(first.dir, "package.json"))} → ${ICON_SET_PACKAGES[first.set][0]}`,
398
- others.length > 0 ? "guess" : "likely",
399
- others
400
- );
401
- }
402
-
403
- /** At the range @dexhq/canvas asks for; Lucide's comes with @dexhq/canvas. */
404
- export function iconPackagesToAdd(
405
- set: InterfaceIcons,
406
- dir: string
407
- ): Record<string, string> {
408
- if (set === "lucide") {
409
- return {};
410
- }
411
- const declared = dependenciesOf(dir).all;
412
- return Object.fromEntries(
413
- ICON_SET_PACKAGES[set]
414
- .filter((name) => !declared[name])
415
- .map((name) => [name, studioPeer(name) ?? "*"])
416
- );
417
- }
418
-
419
316
  const AGENT_NAMES: Record<AgentId, string> = {
420
317
  claude: "Claude Code",
421
318
  codex: "Codex",
@@ -441,9 +338,20 @@ function agentsFinding(root: string): Finding<AgentId[]> {
441
338
  if (agents.length === 0) {
442
339
  return found([], "no agent's files in this folder", "likely");
443
340
  }
341
+ const running = runningAgent();
342
+ const files = agents
343
+ .filter(({ id }) => id !== running?.id)
344
+ .map(({ evidence }) => evidence);
345
+ const said = [
346
+ ...(running ? [`running this: ${running.evidence} is set`] : []),
347
+ ...(files.length > 0 ? [`found ${files.join(", ")}`] : []),
348
+ ].join("; ");
349
+ // AGENTS.md alone: most agents read it, so Codex is only likely.
350
+ const onlyGuide = agents.length === 1 && agents[0]?.evidence === "AGENTS.md";
444
351
  return found(
445
352
  agents.map(({ id }) => id),
446
- `found ${agents.map(({ evidence }) => evidence).join(", ")}`
353
+ said,
354
+ onlyGuide ? "likely" : "certain"
447
355
  );
448
356
  }
449
357
 
@@ -509,18 +417,19 @@ export async function packageManagerFinding(
509
417
  return found({ name: "npm", agent: "npm" }, "no lockfile, so npm", "guess");
510
418
  }
511
419
 
512
- /** Where the project already resolves the studio from, if it does. */
420
+ /**
421
+ * Where the project already resolves the studio from, if it does. Its own
422
+ * node_modules' entry is kept as it is, so `isLinked` sees a `bun link`; one
423
+ * above is followed through its links, as Node resolves it, so a workspace's
424
+ * install is never taken for a link.
425
+ */
513
426
  export function resolvedStudio(root: string): string | undefined {
514
427
  const local = join(root, "node_modules", PACKAGE_NAME);
515
428
  if (existsSync(join(local, "package.json"))) {
516
429
  return local;
517
430
  }
518
- try {
519
- const require = createRequire(join(root, "package.json"));
520
- return dirname(require.resolve(`${PACKAGE_NAME}/package.json`));
521
- } catch {
522
- return;
523
- }
431
+ const above = installedPackageDir(dirname(resolve(root)), PACKAGE_NAME);
432
+ return above && realpathSync(above);
524
433
  }
525
434
 
526
435
  /**
@@ -570,8 +479,8 @@ export async function findProject(
570
479
  const agentRoot = options.agentRoot ?? root;
571
480
  const system = detectDesignSystem(root);
572
481
  const { finding: components, ambiguous } = componentsFinding(root);
573
- // The components.json the components came from, which the styles and
574
- // primitives findings cite when they come from it too.
482
+ // The components.json the components came from, which the styles
483
+ // finding cites when it comes from it too.
575
484
  const source = components.evidence.split(" → ")[0] ?? "components.json";
576
485
  const workspace = findWorkspace(root);
577
486
  const folders = components.value
@@ -601,8 +510,6 @@ export async function findProject(
601
510
  ...(workspace.isWorkspace ? { workspaceRoot: workspace.root } : {}),
602
511
  }),
603
512
  styles: stylesFinding(root, components.value, source),
604
- primitives: primitivesFinding(components.value, source),
605
- icons: iconsFinding(root, components.value, source),
606
513
  provider: providerFinding(root),
607
514
  agents: agentsFinding(agentRoot),
608
515
  packageManager: await packageManagerFinding(agentRoot, options),