@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
@@ -32,15 +32,22 @@ import {
32
32
  import { homedir, tmpdir } from "node:os";
33
33
  import { basename, dirname, join } from "node:path";
34
34
  import { promisify } from "node:util";
35
+ import type { ViteDevServer } from "vite";
35
36
  import {
36
37
  APP_DIR,
37
38
  installedBin,
38
39
  PACKAGE_ROOT,
39
40
  studioVersion,
40
41
  } from "../paths.ts";
42
+ import { servedPort } from "../server/port.ts";
41
43
  import { projectId } from "../server/project-id.ts";
42
44
  import { PRODUCT } from "../shared/product.ts";
43
- import { STATE_SLOT, serverPage, shownPath } from "../shared/server-page.ts";
45
+ import {
46
+ GIVE_UP_AFTER_MS,
47
+ STATE_SLOT,
48
+ serverPage,
49
+ shownPath,
50
+ } from "../shared/server-page.ts";
44
51
  import { appScript } from "./desktop-app-script.ts";
45
52
 
46
53
  const run = promisify(execFile);
@@ -71,7 +78,7 @@ export const STARTED_EXIT = 3;
71
78
  const LSREGISTER =
72
79
  "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
73
80
  const ICON = "Dex";
74
- const ICON_SOURCE = join(APP_DIR, "public", "sudio-512.png");
81
+ const ICON_SOURCE = join(APP_DIR, "public", "dex-512.png");
75
82
  /** The icons iconutil takes, by name, and their pixels, up to the source's. */
76
83
  const ICON_FILES: [string, number][] = [
77
84
  ["icon_16x16", 16],
@@ -221,6 +228,13 @@ export function desktopApp(
221
228
  };
222
229
  }
223
230
 
231
+ /**
232
+ * The app a `dex dev` server makes: for the port and base it is served
233
+ * at, so the app opens that server, also when it moved off a taken port.
234
+ */
235
+ export const servedApp = (root: string, server: ViteDevServer): DesktopApp =>
236
+ desktopApp({ root, port: servedPort(server), base: server.config.base });
237
+
224
238
  /** Where apps go: `~/Applications`, the person's own. */
225
239
  const applications = (home: string): string => join(home, "Applications");
226
240
 
@@ -344,6 +358,8 @@ const shellWord = (text: string): string =>
344
358
  export const logFile = (home: string, project: string): string =>
345
359
  join(home, "Library", "Logs", "Dex", `${project}.log`);
346
360
 
361
+ const MS_PER_MINUTE = 60_000;
362
+
347
363
  /** Where the launcher looks for Node besides the PATH it is opened with. */
348
364
  export const RUNTIME_PLACES = "/opt/homebrew/bin:/usr/local/bin";
349
365
 
@@ -370,6 +386,8 @@ const portLine = (app: DesktopApp): string =>
370
386
  * start`, whose output goes in the log after the mark and whose answer is
371
387
  * the launcher's. All it does itself is what `dex` cannot: say the
372
388
  * project is gone (and the `dex` installed in it with it), and find Node.
389
+ * It keeps the pid file of a start still coming up, which `dex app start`
390
+ * waits on, and clears it when it gives up.
373
391
  * The Node (or Bun) the app was made with may be gone since (a version
374
392
  * manager's, an upgrade): one on the PATH will do then, or the one the
375
393
  * person's own shell finds, as nvm and fnm set theirs up there. With none
@@ -389,8 +407,10 @@ PID_FILE=${shellWord(pidFile(home, app.project))}
389
407
 
390
408
  /bin/mkdir -p "$(/usr/bin/dirname "$LOG")"
391
409
  echo ${shellWord(LOG_MARK)} "$(/bin/date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$LOG"
392
- /bin/rm -f "$PID_FILE"
410
+ # A start older than the window waits for is over; its pid may be reused.
411
+ /usr/bin/find "$PID_FILE" -mmin +${Math.ceil(GIVE_UP_AFTER_MS / MS_PER_MINUTE)} -delete 2>/dev/null
393
412
  if [ ! -d "$ROOT" ]; then
413
+ /bin/rm -f "$PID_FILE"
394
414
  echo ${shellWord(projectGone(app.root, home))} >>"$LOG"
395
415
  exit 1
396
416
  fi
@@ -400,6 +420,7 @@ if [ ! -x "$RUNTIME" ]; then
400
420
  RUNTIME=$(PATH="$PATH:${RUNTIME_PLACES}" command -v "$NAME") ||
401
421
  RUNTIME=$("\${SHELL:-/bin/zsh}" -ilc "command -v $NAME" 2>/dev/null | /usr/bin/tail -n 1)
402
422
  if [ ! -x "$RUNTIME" ]; then
423
+ /bin/rm -f "$PID_FILE"
403
424
  echo "Dex needs $NAME to start, and $GONE is gone. Install $NAME, then open Dex again." >>"$LOG"
404
425
  exit 1
405
426
  fi
@@ -27,7 +27,6 @@ import {
27
27
  import { posix } from "../paths.ts";
28
28
  import { AGENTS, type AgentKey } from "../server/agents.ts";
29
29
  import type { StylingApproach } from "../shared/design-system.ts";
30
- import type { InterfaceIcons } from "../shared/icon-sets.ts";
31
30
 
32
31
  // What setup can tell about a project without asking: its design system,
33
32
  // where its components are and how that design system is styled. Each
@@ -285,8 +284,6 @@ export interface ComponentLibrary {
285
284
  folder: string;
286
285
  /** The stylesheet components.json names, relative to the project. */
287
286
  globalCss?: string;
288
- /** The icon set its components.json draws with, when the interface has it. */
289
- icons?: InterfaceIcons;
290
287
  /** How the project imports the folder's files: "@/components/ui". */
291
288
  importBase: string | undefined;
292
289
  kind: "shadcn" | "folder";
@@ -357,24 +354,74 @@ export function detectDesignSystem(
357
354
  /** The agents the studio can connect, as `--agent` names them. */
358
355
  export type AgentId = "claude" | "codex" | "cursor" | "copilot" | "opencode";
359
356
 
360
- /** Which coding agents the project already uses, and the file that says so. */
357
+ /**
358
+ * What each agent sets in the environment of the commands it runs, as
359
+ * std-env reads them (Storybook and Turborepo do the same). `AI_AGENT`, the
360
+ * shared one, names the agent instead.
361
+ */
362
+ const AGENT_ENV: Record<AgentId, string[]> = {
363
+ claude: ["CLAUDECODE", "CLAUDE_CODE"],
364
+ codex: ["CODEX_SANDBOX", "CODEX_THREAD_ID"],
365
+ cursor: ["CURSOR_AGENT"],
366
+ copilot: ["COPILOT_AGENT", "COPILOT_CLI"],
367
+ opencode: ["OPENCODE"],
368
+ };
369
+ const AI_AGENT_NAMES: Record<string, AgentId> = {
370
+ "claude-code": "claude",
371
+ claude: "claude",
372
+ codex: "codex",
373
+ cursor: "cursor",
374
+ "github-copilot": "copilot",
375
+ copilot: "copilot",
376
+ opencode: "opencode",
377
+ };
378
+
379
+ /**
380
+ * The agent running this command, and the variable that says so: the one
381
+ * setup is most likely being run by, so the one to connect.
382
+ */
383
+ export function runningAgent(
384
+ env: NodeJS.ProcessEnv = process.env
385
+ ): { id: AgentId; evidence: string } | undefined {
386
+ const named = env.AI_AGENT?.toLowerCase();
387
+ if (named && AI_AGENT_NAMES[named]) {
388
+ return { id: AI_AGENT_NAMES[named], evidence: `AI_AGENT=${named}` };
389
+ }
390
+ for (const [id, names] of Object.entries(AGENT_ENV)) {
391
+ const name = names.find((each) => env[each]);
392
+ if (name) {
393
+ return { id: id as AgentId, evidence: name };
394
+ }
395
+ }
396
+ }
397
+
398
+ /**
399
+ * Which coding agents the project already uses, and the file that says so,
400
+ * with the agent running this command first. AGENTS.md is read by most
401
+ * agents, so it counts for Codex only when nothing else is found.
402
+ */
361
403
  export function detectAgentsWithEvidence(
362
- root: string
404
+ root: string,
405
+ env: NodeJS.ProcessEnv = process.env
363
406
  ): { id: AgentId; evidence: string }[] {
364
- const found: { id: AgentId; evidence: string }[] = [];
407
+ const running = runningAgent(env);
408
+ const found: { id: AgentId; evidence: string }[] = running ? [running] : [];
365
409
  const first = (paths: string[]): string | undefined =>
366
410
  paths.find((path) => existsSync(join(root, path)));
367
411
  const add = (id: AgentId, paths: string[]) => {
368
412
  const path = first(paths);
369
- if (path) {
413
+ if (path && !found.some((each) => each.id === id)) {
370
414
  found.push({ id, evidence: path });
371
415
  }
372
416
  };
373
- add("claude", [".claude", "CLAUDE.md"]);
417
+ add("claude", [".claude", "CLAUDE.md", ".mcp.json"]);
374
418
  add("cursor", [".cursor"]);
375
- add("codex", ["AGENTS.md", ".codex"]);
419
+ add("codex", [".codex"]);
376
420
  add("copilot", [".github/copilot-instructions.md", ".vscode/mcp.json"]);
377
421
  add("opencode", ["opencode.json"]);
422
+ if (found.length === 0) {
423
+ add("codex", ["AGENTS.md"]);
424
+ }
378
425
  return found;
379
426
  }
380
427
 
@@ -410,10 +457,6 @@ export function installedAgents(): AgentId[] {
410
457
  });
411
458
  }
412
459
 
413
- /** Which coding agents the project already uses. */
414
- export const detectAgents = (root: string): AgentId[] =>
415
- detectAgentsWithEvidence(root).map(({ id }) => id);
416
-
417
460
  // --- Where the project's components live ---------------------------------------
418
461
  //
419
462
  // A studio must build with the components the project already has. If it
@@ -455,7 +498,6 @@ function shadcnLibrary(
455
498
  importBase: config.import,
456
499
  components: componentFiles(config.folder),
457
500
  baseUi: config.baseUi,
458
- ...(config.icons ? { icons: config.icons } : {}),
459
501
  globalCss: config.css ? relative(root, config.css) : undefined,
460
502
  source: relative(root, config.file) || "components.json",
461
503
  };
@@ -31,7 +31,6 @@ import {
31
31
  studioCommand,
32
32
  } from "../server/agents.ts";
33
33
  import { readGitSettings } from "../server/git-settings.ts";
34
- import { missingIconSet } from "../server/icon-set.ts";
35
34
  import { lacksNext } from "../server/next.ts";
36
35
  import { outputOf } from "../server/quiet-run.ts";
37
36
  import { checkForUpdate, updateCheckProblem } from "../server/updates.ts";
@@ -416,9 +415,10 @@ async function runChecks(
416
415
 
417
416
  checkFiles(content, log);
418
417
  checkDependencies(project.root, log);
419
- const icons = missingIconSet(project);
420
- if (icons) {
421
- log.warn(icons.message, `${icons.fix}.`);
418
+ if (project.ui && "icons" in project.ui) {
419
+ log.note(
420
+ "ui.icons is no longer read: Dex's interface always draws with Lucide. Take it out of dex.config.ts."
421
+ );
422
422
  }
423
423
  checkDesignSystem(project, log);
424
424
  await checkNext(project, log);
@@ -25,7 +25,6 @@ import {
25
25
  import { withNewPackage } from "../config/renamed.ts";
26
26
  import { isDirectory, isFile, isOlder, PACKAGE_NAME, posix } from "../paths.ts";
27
27
  import { isRecord } from "../shared/checks.ts";
28
- import { INTERFACE_ICONS, type InterfaceIcons } from "../shared/icon-sets.ts";
29
28
  import { listing } from "../shared/listing.ts";
30
29
  import { STUDIO_FILES } from "../shared/studio-files.ts";
31
30
  import { choicesOnly, type DesignSystemChoices } from "./config-choices.ts";
@@ -187,10 +186,6 @@ function configChoices(
187
186
  flags.dir = dir;
188
187
  }
189
188
  const ui = uiOf(read);
190
- const icons = INTERFACE_ICONS.find((set) => set === ui.icons);
191
- if (icons) {
192
- flags.icons = icons;
193
- }
194
189
  const primitives = ui.primitives;
195
190
  if (
196
191
  !uiInCode(read, "primitives") &&
@@ -203,7 +198,12 @@ function configChoices(
203
198
  const { resolved } = designSystem;
204
199
  const components = componentsFlags(written, resolved, packageDir);
205
200
  if (components) {
206
- Object.assign(flags, components, { shadcn: false });
201
+ // shadcn is for a project with no components: --preset and --base too.
202
+ Object.assign(flags, components, {
203
+ shadcn: false,
204
+ preset: undefined,
205
+ base: undefined,
206
+ });
207
207
  }
208
208
  const styles = stylesFlag(resolved, root);
209
209
  if (styles) {
@@ -220,7 +220,6 @@ function configChoices(
220
220
  /** Each flag is named for the decision it answers. */
221
221
  const ANSWERABLE = [
222
222
  "dir",
223
- "icons",
224
223
  "primitives",
225
224
  "components",
226
225
  "styles",
@@ -452,11 +451,9 @@ export function configChange(
452
451
  existing: ExistingStudio,
453
452
  designSystem: DesignSystemChoices | undefined,
454
453
  {
455
- icons,
456
454
  next,
457
455
  root,
458
456
  }: {
459
- icons: InterfaceIcons;
460
457
  next: boolean;
461
458
  /** Where the plan's paths start: files are named from here. */
462
459
  root: string;
@@ -498,9 +495,10 @@ export function configChange(
498
495
  }
499
496
  changes.push(`+ plugins: [${local}()]`);
500
497
  }
501
- if (!uiInCode(read, "icons") && uiOf(read).icons === undefined) {
502
- edits.ui = { icons };
503
- changes.push(`+ ui.icons: "${icons}"`);
498
+ // ui.icons is no longer read: the interface draws with Lucide.
499
+ if (!uiInCode(read, "icons") && uiOf(read).icons !== undefined) {
500
+ edits.remove = [...(edits.remove ?? []), "ui.icons"];
501
+ changes.push("- ui.icons: Dex draws with Lucide");
504
502
  }
505
503
  return changes.length > 0 ? edited(existing, edits, changes) : undefined;
506
504
  }
@@ -207,7 +207,7 @@ function devTask(
207
207
 
208
208
  /**
209
209
  * A turbo.json for the studio's app, when the root's cannot start it as
210
- * the studio needs, so `STUDIO_PORT=4103 npm run studio` serves on 4103.
210
+ * the studio needs, so `STUDIO_PORT=4103 npm run dex` serves on 4103.
211
211
  */
212
212
  function packageTurbo(
213
213
  workspace: Workspace,
@@ -248,11 +248,9 @@ export function ownAppFacts(
248
248
  placement: OwnAppPlacement,
249
249
  {
250
250
  componentsDir,
251
- iconPackages,
252
251
  studioSpec,
253
252
  }: {
254
253
  componentsDir: string | undefined;
255
- iconPackages: Record<string, string>;
256
254
  studioSpec: string;
257
255
  }
258
256
  ): OwnAppFacts {
@@ -282,7 +280,6 @@ export function ownAppFacts(
282
280
  [PACKAGE_NAME]: studioSpec,
283
281
  ...(tsconfig?.package ? { [tsconfig.package]: protocol } : {}),
284
282
  ...vite,
285
- ...iconPackages,
286
283
  };
287
284
  const turbo = packageTurbo(workspace, designSystem);
288
285
  return {
@@ -375,7 +372,7 @@ export function rootStudioScript(
375
372
  const folder = own ? placement.folder : placement.packageFolder;
376
373
  const target = selector(placement.packageName, folder);
377
374
  // Its own app starts with dev; an existing app keeps dev for itself.
378
- const script = own ? "dev" : "studio";
375
+ const script = own ? "dev" : "dex";
379
376
  if (own && workspace.tool.value === "turbo") {
380
377
  return `turbo run dev --filter=${target}`;
381
378
  }