@dexhq/canvas 0.13.0 → 0.14.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 (159) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/README.md +16 -15
  3. package/app/canvas/frame-node.tsx +34 -17
  4. package/app/canvas/tool-cursors.ts +16 -16
  5. package/app/i18n/locales/en/messages.po +26 -4
  6. package/app/i18n/locales/en/messages.ts +1 -1
  7. package/app/i18n/locales/pseudo/messages.po +26 -4
  8. package/app/i18n/locales/pseudo/messages.ts +1 -1
  9. package/app/icons/{sets/lucide.tsx → glyphs.tsx} +3 -5
  10. package/app/icons/index.tsx +3 -3
  11. package/app/icons/types.ts +3 -10
  12. package/app/index.html +3 -3
  13. package/app/pages/canvas-settings.tsx +35 -0
  14. package/app/shell/about.tsx +5 -4
  15. package/app/shell/feedback-details.ts +0 -3
  16. package/app/shell/instructions-editor.tsx +1 -1
  17. package/app/shell/presence-style.ts +59 -0
  18. package/app/shell/presence.tsx +6 -3
  19. package/app/shell/settings-sections.ts +12 -0
  20. package/app/shell/sidebar.tsx +1 -1
  21. package/app/studio-ui.d.ts +0 -9
  22. package/app/ui/prompt-editor.tsx +1 -1
  23. package/dist/cli/commands/create.d.mts +26 -14
  24. package/dist/cli/commands/create.mjs +13 -7
  25. package/dist/cli/commands/dev.mjs +2 -3
  26. package/dist/cli/commands/init.d.mts +11 -6
  27. package/dist/cli/help.d.mts +1 -1
  28. package/dist/cli/help.mjs +3 -3
  29. package/dist/cli/main.d.mts +22 -12
  30. package/dist/config/index.d.mts +6 -5
  31. package/dist/config/project-files.d.mts +0 -3
  32. package/dist/config/project-files.mjs +0 -3
  33. package/dist/config/schema.d.mts +0 -5
  34. package/dist/config/schema.mjs +0 -5
  35. package/dist/content/content.mjs +0 -3
  36. package/dist/content/snapshot-client.mjs +1 -1
  37. package/dist/paste/paste.mjs +1 -1
  38. package/dist/server/brief.mjs +3 -3
  39. package/dist/server/channel.d.mts +6 -0
  40. package/dist/server/channel.mjs +16 -1
  41. package/dist/server/claimed-presence.d.mts +17 -0
  42. package/dist/server/claimed-presence.mjs +50 -0
  43. package/dist/server/dev-server.mjs +9 -0
  44. package/dist/server/file-errors.d.mts +7 -2
  45. package/dist/server/file-errors.mjs +31 -8
  46. package/dist/server/requests.mjs +1 -1
  47. package/dist/server/studio-for.mjs +1 -1
  48. package/dist/server/vite.mjs +26 -29
  49. package/dist/server/web-app.mjs +3 -3
  50. package/dist/setup/apply.mjs +8 -14
  51. package/dist/setup/create.mjs +51 -19
  52. package/dist/setup/desktop-app.mjs +1 -1
  53. package/dist/setup/detect.d.mts +14 -5
  54. package/dist/setup/detect.mjs +56 -8
  55. package/dist/setup/doctor.mjs +1 -3
  56. package/dist/setup/existing-setup.d.mts +1 -3
  57. package/dist/setup/existing-setup.mjs +10 -11
  58. package/dist/setup/own-app.d.mts +1 -2
  59. package/dist/setup/own-app.mjs +4 -5
  60. package/dist/setup/plan.d.mts +8 -6
  61. package/dist/setup/plan.mjs +64 -48
  62. package/dist/setup/project.d.mts +0 -16
  63. package/dist/setup/project.mjs +8 -52
  64. package/dist/setup/prompts.d.mts +5 -5
  65. package/dist/setup/prompts.mjs +28 -61
  66. package/dist/setup/questions.d.mts +12 -4
  67. package/dist/setup/questions.mjs +10 -25
  68. package/dist/setup/starters.mjs +19 -8
  69. package/dist/setup/workspace-setup.d.mts +1 -2
  70. package/dist/setup/workspace-setup.mjs +4 -6
  71. package/dist/setup/write.d.mts +15 -5
  72. package/dist/setup/write.mjs +35 -9
  73. package/dist/shared/server-page.mjs +6 -0
  74. package/extension/dist/feedback.js +1 -1
  75. package/extension/dist/manifest.json +1 -1
  76. package/package.json +2 -19
  77. package/src/cli/commands/create.ts +17 -9
  78. package/src/cli/commands/dev.ts +0 -3
  79. package/src/cli/help.ts +3 -3
  80. package/src/config/index.ts +6 -5
  81. package/src/config/project-files.ts +0 -5
  82. package/src/config/schema.ts +0 -1
  83. package/src/content/content.ts +0 -3
  84. package/src/content/snapshot-client.ts +1 -1
  85. package/src/server/brief.ts +8 -3
  86. package/src/server/channel.ts +27 -0
  87. package/src/server/claimed-presence.ts +77 -0
  88. package/src/server/dev-server.ts +13 -0
  89. package/src/server/file-errors.ts +47 -13
  90. package/src/server/studio-for.ts +1 -1
  91. package/src/server/vite.ts +37 -40
  92. package/src/server/web-app.ts +3 -3
  93. package/src/setup/apply.ts +10 -16
  94. package/src/setup/create.ts +52 -20
  95. package/src/setup/desktop-app.ts +1 -1
  96. package/src/setup/detect.ts +56 -10
  97. package/src/setup/doctor.ts +4 -4
  98. package/src/setup/existing-setup.ts +10 -12
  99. package/src/setup/own-app.ts +2 -5
  100. package/src/setup/plan.ts +93 -84
  101. package/src/setup/project.ts +16 -110
  102. package/src/setup/prompts.ts +44 -127
  103. package/src/setup/questions.ts +27 -29
  104. package/src/setup/starters.ts +27 -9
  105. package/src/setup/workspace-setup.ts +8 -18
  106. package/src/setup/write.ts +52 -9
  107. package/src/shared/server-page.ts +9 -0
  108. package/templates/methods/review.md +2 -2
  109. package/templates/rules/canvas-frames.md +104 -0
  110. package/templates/rules/canvas.md +8 -142
  111. package/templates/rules/prototypes.md +1 -1
  112. package/templates/rules/snapshots.md +52 -0
  113. package/templates/starters/standalone/README.md +7 -7
  114. package/templates/starters/standalone/components.json +1 -1
  115. package/templates/starters/standalone/package.json +1 -2
  116. package/templates/starters/turborepo/README.md +6 -6
  117. package/templates/starters/turborepo/apps/web/components.json +1 -1
  118. package/templates/starters/turborepo/apps/web/package.json +1 -2
  119. package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
  120. package/templates/starters/turborepo/packages/ui/components.json +1 -1
  121. package/templates/starters/turborepo/packages/ui/package.json +1 -2
  122. package/templates/starters/vite/README.md +7 -6
  123. package/templates/starters/vite/components.json +1 -1
  124. package/templates/starters/vite/package.json +1 -2
  125. package/templates/starters/vite/src/app.tsx +3 -4
  126. package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
  127. package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
  128. package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
  129. package/templates/starters/vite/src/components/ui/button.tsx +17 -12
  130. package/templates/starters/vite/src/components/ui/card.tsx +1 -1
  131. package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
  132. package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
  133. package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
  134. package/templates/starters/vite/src/components/ui/field.tsx +3 -1
  135. package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
  136. package/templates/starters/vite/src/components/ui/input.tsx +1 -1
  137. package/templates/starters/vite/src/components/ui/label.tsx +2 -0
  138. package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
  139. package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
  140. package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
  141. package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
  142. package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
  143. package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
  144. package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
  145. package/templates/starters/vite/src/index.css +533 -111
  146. package/app/icons/sets/hugeicons.tsx +0 -259
  147. package/app/icons/sets/phosphor.tsx +0 -251
  148. package/dist/server/icon-set.d.mts +0 -15
  149. package/dist/server/icon-set.mjs +0 -31
  150. package/dist/shared/icon-sets.d.mts +0 -9
  151. package/dist/shared/icon-sets.mjs +0 -21
  152. package/src/server/icon-set.ts +0 -56
  153. package/src/shared/icon-sets.ts +0 -23
  154. /package/app/public/{sudio-192.png → dex-192.png} +0 -0
  155. /package/app/public/{sudio-512.png → dex-512.png} +0 -0
  156. /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
  157. /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
  158. /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
  159. /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
@@ -2,19 +2,18 @@ import { PACKAGE_NAME, TEMPLATES_DIR, isDirectory, posix as posix$1, studioVersi
2
2
  import { createReporter } from "../cli/ui.mjs";
3
3
  import { isOneOf } from "../shared/checks.mjs";
4
4
  import { STUDIO_FILES } from "../shared/studio-files.mjs";
5
- import { ICON_SET_NAMES } from "../shared/icon-sets.mjs";
6
5
  import { dependenciesOf } from "../config/project-files.mjs";
7
6
  import { componentFolders, recommendPlacement } from "./detect/workspace.mjs";
8
7
  import { summaryLines } from "./design-md-setup.mjs";
9
8
  import { dexRunner, pmCommand } from "../config/package-manager.mjs";
10
9
  import { createPrototype, loadStudio, scratchView } from "../content/content.mjs";
11
10
  import { agentSetups } from "../server/agents.mjs";
12
- import { AGENT_IDS, CREATE_COMMAND, agentName, connectInStudio, createCommandFor, findProject, iconPackagesToAdd, resolvedStudio } from "./project.mjs";
11
+ import { AGENT_IDS, CREATE_COMMAND, agentName, connectInStudio, createCommandFor, findProject, resolvedStudio } from "./project.mjs";
13
12
  import { prepareContent } from "../content/first-run.mjs";
14
13
  import { nextPackage } from "../server/next.mjs";
15
14
  import { STUDIO_TYPES_FILE } from "./write.mjs";
16
15
  import { PROVIDER_FILE, QUESTIONS, questionEvent, questionFor } from "./questions.mjs";
17
- import { changesAnything, inPackage, planLines, planSetup } from "./plan.mjs";
16
+ import { changesAnything, inPackage, installCommand, planLines, planSetup } from "./plan.mjs";
18
17
  import { Cancelled, NeedsChoice, decide, decisionList, describeComponents, packageManagerName, parseAgents, studioDir } from "./prompts.mjs";
19
18
  import { applyPlan, foldersOf, nextFolders, projectTsconfig, runCommand, studioDesignSystem } from "./apply.mjs";
20
19
  import { doctor, realProbes, startProblems } from "./doctor.mjs";
@@ -22,9 +21,10 @@ import { configChange, decideAgain, existingStudio, newStudioSpec, placementOf,
22
21
  import { setupHints } from "./hints.mjs";
23
22
  import { PLACEMENT, decidePlacement, describePlacement, workspaceLines } from "./placement.mjs";
24
23
  import { DEFAULT_STARTER, STARTERS, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager } from "./starters.mjs";
25
- import { findingsFor, packageDirOf, targetFor, workspaceFor, workspaceSetup, workspaceWarnings } from "./workspace-setup.mjs";
26
- import { existsSync } from "node:fs";
24
+ import { findingsFor, targetFor, workspaceFor, workspaceSetup, workspaceWarnings } from "./workspace-setup.mjs";
25
+ import { existsSync, readFileSync } from "node:fs";
27
26
  import { basename, join, relative, resolve } from "node:path";
27
+ import { execFileSync } from "node:child_process";
28
28
  import { readFile, readdir } from "node:fs/promises";
29
29
  //#region src/setup/create.ts
30
30
  /** Exit code when no default is safe and the person must choose. */
@@ -56,7 +56,6 @@ function detectionLines(findings, { situation = true } = {}) {
56
56
  components.value ? `Components: ${describeComponents(components.value)} ${evidence(components)}` : `Components: none found (${components.evidence})`,
57
57
  ...components.alternatives.map((alt) => ` also ${describeComponents(alt)}`),
58
58
  styles.value ? `Styles: ${styles.value} ${evidence(styles)}` : `Styles: none found (${styles.evidence})`,
59
- `Icon set: ${ICON_SET_NAMES[findings.icons.value]} ${evidence(findings.icons)}`,
60
59
  ...findings.provider.value ? [`Provider: ${findings.provider.value.library} needs ${findings.provider.value.component} around every view ${evidence(findings.provider)}`] : [],
61
60
  findings.designMd.value ? `DESIGN.md: ${findings.designMd.evidence}` : `DESIGN.md: none found (${findings.designMd.evidence})`,
62
61
  agents.value.length > 0 ? `Agents: ${agents.value.map(agentName).join(", ")} ${evidence(agents)}` : `Agents: none found (${agents.evidence})`
@@ -78,8 +77,6 @@ function reportFindings(ui, findings, title = "Looked at this folder") {
78
77
  count: components.value.count
79
78
  });
80
79
  finding("styles", findings.styles, findings.styles.value);
81
- finding("primitives", findings.primitives, findings.primitives.value);
82
- finding("icons", findings.icons, findings.icons.value);
83
80
  const need = findings.provider.value;
84
81
  if (need) finding("provider", findings.provider, {
85
82
  library: need.library,
@@ -215,19 +212,22 @@ function sameSetup(decisions, { cwd, placement, root }) {
215
212
  }
216
213
  function nextLines(decisions, result, { blockers = [], cwd, root, placement }) {
217
214
  const { agent } = decisions.packageManager.value;
218
- const start = pmCommand(agent, "run", ["studio"]).join(" ");
215
+ const start = pmCommand(agent, "run", ["dex"]).join(" ");
219
216
  const inPackage = cdInto(placement);
220
217
  const dex = dexRunner(agent).join(" ");
221
218
  const where = placement ? " (from the workspace root)" : "";
219
+ const drafted = result.designMd.kind === "draft" && result.designMd.written;
220
+ const connected = decisions.agents.value.length > 0;
222
221
  const asks = [
223
- ...result.designMd.kind === "draft" && result.designMd.written ? ["\"Finish DESIGN.md with me.\" (it follows methods/design-md.md)"] : [],
222
+ ...drafted ? ["\"Finish DESIGN.md with me.\" (it follows methods/design-md.md)"] : [],
224
223
  "\"Create a new file for <your idea>.\"",
225
224
  "\"Watch the studio for feedback and work through it.\""
226
225
  ];
227
226
  const lines = [
228
227
  ...result.failedInstall ? [`Install it first: ${result.failedInstall} (it failed: fix what it said, then run it again)`] : [],
229
228
  ...blockers.map(({ fix, message }) => `Fix this first: ${fix} (${message})`),
230
- blockers.length > 0 ? `Then start it: ${start}${where}` : `Start the studio: ${start}${where}`,
229
+ blockers.length > 0 ? `Then start it: ${start}${where}` : `Start Dex: ${start}${where}`,
230
+ ...connected ? [] : [`Connect your agent: ${connectInStudio()}`],
231
231
  ...asks.map((ask, index) => `${index === 0 ? "Then ask your agent: " : " "}${ask}`)
232
232
  ];
233
233
  if (result.decisions.components.value.kind === "none") {
@@ -247,6 +247,40 @@ function cdInto(placement) {
247
247
  const folder = placement.kind === "own-app" ? placement.folder : placement.packageFolder;
248
248
  return folder === "." ? "" : `cd ${folder} && `;
249
249
  }
250
+ const PNPM_FIELD_RE = /^pnpm@(\d+)/;
251
+ /** The first version of pnpm to stop an install on an undecided build script. */
252
+ const PNPM_STRICT_BUILDS = 11;
253
+ /**
254
+ * Whether the project's pnpm stops an install on a build script nobody
255
+ * decided on: the version its packageManager field names, else the pnpm on
256
+ * PATH. Unknown, it is taken not to.
257
+ */
258
+ function pnpmStopsOnBuilds(root) {
259
+ let major;
260
+ try {
261
+ const manifest = JSON.parse(readFileSync(join(root, "package.json"), "utf8"));
262
+ major = PNPM_FIELD_RE.exec(String(manifest.packageManager ?? ""))?.[1];
263
+ } catch {}
264
+ if (major === void 0) try {
265
+ major = execFileSync("pnpm", ["--version"], {
266
+ cwd: root,
267
+ encoding: "utf8",
268
+ env: {
269
+ ...process.env,
270
+ COREPACK_ENABLE_DOWNLOAD_PROMPT: "0"
271
+ },
272
+ stdio: [
273
+ "ignore",
274
+ "pipe",
275
+ "ignore"
276
+ ],
277
+ timeout: 1e4
278
+ }).split(".")[0];
279
+ } catch {
280
+ return false;
281
+ }
282
+ return Number(major) >= PNPM_STRICT_BUILDS;
283
+ }
250
284
  /** Read what the plan needs to know is there, from `root`. */
251
285
  async function onDisk(root, target) {
252
286
  const { studio } = target;
@@ -282,6 +316,7 @@ async function onDisk(root, target) {
282
316
  scripts,
283
317
  gitignore: await read(ignore),
284
318
  hostGitignore: existsSync(join(root, ".gitignore")) ? await read(".gitignore") : void 0,
319
+ pnpmWorkspace: existsSync(join(root, "pnpm-workspace.yaml")) ? await read("pnpm-workspace.yaml") : void 0,
285
320
  tsconfig: existing.has(tsconfig) ? await read(tsconfig) : void 0,
286
321
  read
287
322
  };
@@ -339,19 +374,16 @@ function settled(ui, { cwd, decisions, findings, flags, placed, root, workspace
339
374
  ...title ? { title } : {},
340
375
  ...where ? { placement: where } : {}
341
376
  });
342
- const iconPackages = iconPackagesToAdd(decisions.icons.value, placement ? packageDirOf(placement) : root);
343
377
  return {
344
378
  cwd,
345
379
  root,
346
380
  findings,
347
381
  decisions,
348
- iconPackages,
349
382
  target,
350
383
  ...where ? { placement: where } : {},
351
384
  ...workspace && placement ? { workspace: workspaceSetup(workspace, placement, findings, decisions, {
352
385
  flags,
353
- cwd,
354
- iconPackages
386
+ cwd
355
387
  }) } : {}
356
388
  };
357
389
  }
@@ -531,7 +563,6 @@ async function planFor(prepared, flags, ui, ask) {
531
563
  }));
532
564
  const again = existing && {
533
565
  config: configChange(existing, prepared.designSystem, {
534
- icons: decisions.icons.value,
535
566
  next: nextPackage(viewFolders) !== void 0,
536
567
  root
537
568
  }),
@@ -544,7 +575,8 @@ async function planFor(prepared, flags, ui, ask) {
544
575
  existing: disk.existing,
545
576
  gitignore: disk.gitignore,
546
577
  hostGitignore: disk.hostGitignore,
547
- iconPackages: prepared.iconPackages,
578
+ pnpmWorkspace: disk.pnpmWorkspace,
579
+ pnpmStopsOnBuilds: decisions.packageManager.value.name === "pnpm" && pnpmStopsOnBuilds(root),
548
580
  quiet: !ask,
549
581
  rootGuide: findings.rootGuide ? {
550
582
  file: findings.rootGuide,
@@ -838,7 +870,7 @@ function readyLines(root, project, result) {
838
870
  what
839
871
  }));
840
872
  const width = Math.max(...commands.map(({ line }) => line.length)) + 4;
841
- const lines = [`cd ${where}`, ...commands.map(({ line, what }) => `${line.padEnd(width)}# ${what}`)];
873
+ const lines = [...where === "." ? [] : [`cd ${where}`], ...commands.map(({ line, what }) => `${line.padEnd(width)}# ${what}`)];
842
874
  if (!connected) lines.push(`Then connect your agent: ${connectInStudio()}.`);
843
875
  if (drafted) {
844
876
  const ask = connected ? "Then ask your agent" : "Once it's connected, ask it";
@@ -875,7 +907,7 @@ async function newProject(root, flags, deps) {
875
907
  const project = {
876
908
  agents,
877
909
  dir: studioDir(flags.dir),
878
- install: pmCommand(pm, "install", []),
910
+ install: installCommand(pm),
879
911
  name,
880
912
  pm,
881
913
  starter
@@ -36,7 +36,7 @@ const APPLET_ICONS = ["applet.icns", "Assets.car"];
36
36
  const STARTED_EXIT = 3;
37
37
  const LSREGISTER = "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
38
38
  const ICON = "Dex";
39
- const ICON_SOURCE = join(APP_DIR, "public", "sudio-512.png");
39
+ const ICON_SOURCE = join(APP_DIR, "public", "dex-512.png");
40
40
  /** The icons iconutil takes, by name, and their pixels, up to the source's. */
41
41
  const ICON_FILES = [
42
42
  ["icon_16x16", 16],
@@ -1,6 +1,5 @@
1
1
  import { StylingApproach } from "../shared/design-system.mjs";
2
2
  import { ComponentFile } from "../config/design-system.mjs";
3
- import { InterfaceIcons } from "../shared/icon-sets.mjs";
4
3
  //#region src/setup/detect.d.ts
5
4
  export declare const globalCssFiles: (root: string) => string[];
6
5
  /** The global stylesheets a build made, which are never the styles. */
@@ -18,8 +17,6 @@ export interface ComponentLibrary {
18
17
  folder: string;
19
18
  /** The stylesheet components.json names, relative to the project. */
20
19
  globalCss?: string;
21
- /** The icon set its components.json draws with, when the interface has it. */
22
- icons?: InterfaceIcons;
23
20
  /** How the project imports the folder's files: "@/components/ui". */
24
21
  importBase: string | undefined;
25
22
  kind: "shadcn" | "folder";
@@ -48,8 +45,20 @@ export declare function detectDesignSystem(root: string, { components }?: {
48
45
  }): DetectedDesignSystem;
49
46
  /** The agents the studio can connect, as `--agent` names them. */
50
47
  export type AgentId = "claude" | "codex" | "cursor" | "copilot" | "opencode";
51
- /** Which coding agents the project already uses, and the file that says so. */
52
- export declare function detectAgentsWithEvidence(root: string): {
48
+ /**
49
+ * The agent running this command, and the variable that says so: the one
50
+ * setup is most likely being run by, so the one to connect.
51
+ */
52
+ export declare function runningAgent(env?: NodeJS.ProcessEnv): {
53
+ id: AgentId;
54
+ evidence: string;
55
+ } | undefined;
56
+ /**
57
+ * Which coding agents the project already uses, and the file that says so,
58
+ * with the agent running this command first. AGENTS.md is read by most
59
+ * agents, so it counts for Codex only when nothing else is found.
60
+ */
61
+ export declare function detectAgentsWithEvidence(root: string, env?: NodeJS.ProcessEnv): {
53
62
  id: AgentId;
54
63
  evidence: string;
55
64
  }[];
@@ -211,22 +211,71 @@ function detectDesignSystem(root, { components } = {}) {
211
211
  ...library ? { library } : {}
212
212
  };
213
213
  }
214
- /** Which coding agents the project already uses, and the file that says so. */
215
- function detectAgentsWithEvidence(root) {
216
- const found = [];
214
+ /**
215
+ * What each agent sets in the environment of the commands it runs, as
216
+ * std-env reads them (Storybook and Turborepo do the same). `AI_AGENT`, the
217
+ * shared one, names the agent instead.
218
+ */
219
+ const AGENT_ENV = {
220
+ claude: ["CLAUDECODE", "CLAUDE_CODE"],
221
+ codex: ["CODEX_SANDBOX", "CODEX_THREAD_ID"],
222
+ cursor: ["CURSOR_AGENT"],
223
+ copilot: ["COPILOT_AGENT", "COPILOT_CLI"],
224
+ opencode: ["OPENCODE"]
225
+ };
226
+ const AI_AGENT_NAMES = {
227
+ "claude-code": "claude",
228
+ claude: "claude",
229
+ codex: "codex",
230
+ cursor: "cursor",
231
+ "github-copilot": "copilot",
232
+ copilot: "copilot",
233
+ opencode: "opencode"
234
+ };
235
+ /**
236
+ * The agent running this command, and the variable that says so: the one
237
+ * setup is most likely being run by, so the one to connect.
238
+ */
239
+ function runningAgent(env = process.env) {
240
+ const named = env.AI_AGENT?.toLowerCase();
241
+ if (named && AI_AGENT_NAMES[named]) return {
242
+ id: AI_AGENT_NAMES[named],
243
+ evidence: `AI_AGENT=${named}`
244
+ };
245
+ for (const [id, names] of Object.entries(AGENT_ENV)) {
246
+ const name = names.find((each) => env[each]);
247
+ if (name) return {
248
+ id,
249
+ evidence: name
250
+ };
251
+ }
252
+ }
253
+ /**
254
+ * Which coding agents the project already uses, and the file that says so,
255
+ * with the agent running this command first. AGENTS.md is read by most
256
+ * agents, so it counts for Codex only when nothing else is found.
257
+ */
258
+ function detectAgentsWithEvidence(root, env = process.env) {
259
+ const running = runningAgent(env);
260
+ const found = running ? [running] : [];
217
261
  const first = (paths) => paths.find((path) => existsSync(join(root, path)));
218
262
  const add = (id, paths) => {
219
263
  const path = first(paths);
220
- if (path) found.push({
264
+ if (path && !found.some((each) => each.id === id)) found.push({
221
265
  id,
222
266
  evidence: path
223
267
  });
224
268
  };
225
- add("claude", [".claude", "CLAUDE.md"]);
269
+ add("claude", [
270
+ ".claude",
271
+ "CLAUDE.md",
272
+ ".mcp.json"
273
+ ]);
226
274
  add("cursor", [".cursor"]);
227
- add("codex", ["AGENTS.md", ".codex"]);
275
+ add("codex", [".codex"]);
228
276
  add("copilot", [".github/copilot-instructions.md", ".vscode/mcp.json"]);
229
277
  add("opencode", ["opencode.json"]);
278
+ if (found.length === 0) add("codex", ["AGENTS.md"]);
230
279
  return found;
231
280
  }
232
281
  const isExecutableFile = (path) => {
@@ -281,7 +330,6 @@ function shadcnLibrary(dir, root) {
281
330
  importBase: config.import,
282
331
  components: componentFiles(config.folder),
283
332
  baseUi: config.baseUi,
284
- ...config.icons ? { icons: config.icons } : {},
285
333
  globalCss: config.css ? relative(root, config.css) : void 0,
286
334
  source: relative(root, config.file) || "components.json"
287
335
  };
@@ -343,4 +391,4 @@ function findComponentLibrary(root, { components } = {}) {
343
391
  return componentLibraries(root)[0];
344
392
  }
345
393
  //#endregion
346
- export { builtGlobalCss, componentLibraries, detectAgents, detectAgentsWithEvidence, detectDesignSystem, findComponentLibrary, findGlobalCss, globalCssFiles, installedAgents, isMixedFolder, libraryAt };
394
+ export { builtGlobalCss, componentLibraries, detectAgents, detectAgentsWithEvidence, detectDesignSystem, findComponentLibrary, findGlobalCss, globalCssFiles, installedAgents, isMixedFolder, libraryAt, runningAgent };
@@ -12,7 +12,6 @@ import { findConfigFile, loadProject } from "../config/load.mjs";
12
12
  import { INSTALL_BROWSER, browserInstalled } from "../content/screenshot.mjs";
13
13
  import { lacksNext } from "../server/next.mjs";
14
14
  import { readGitSettings } from "../server/git-settings.mjs";
15
- import { missingIconSet } from "../server/icon-set.mjs";
16
15
  import { checkDesignSystem } from "./design-system-checks.mjs";
17
16
  import { checkGitSetup, checkLog, realGitProbes } from "./git-checks.mjs";
18
17
  import { planMigrations, warningsOf } from "./migrate/migrations.mjs";
@@ -214,8 +213,7 @@ async function runChecks(cwd, log, probes) {
214
213
  const { content } = project;
215
214
  checkFiles(content, log);
216
215
  checkDependencies(project.root, log);
217
- const icons = missingIconSet(project);
218
- if (icons) log.warn(icons.message, `${icons.fix}.`);
216
+ if (project.ui && "icons" in project.ui) log.note("ui.icons is no longer read: Dex's interface always draws with Lucide. Take it out of dex.config.ts.");
219
217
  checkDesignSystem(project, log);
220
218
  await checkNext(project, log);
221
219
  await checkContributor(project, log, probes);
@@ -1,5 +1,4 @@
1
1
  import { Reporter } from "../cli/ui.mjs";
2
- import { InterfaceIcons } from "../shared/icon-sets.mjs";
3
2
  import { ConfigData } from "./config-source.mjs";
4
3
  import { DesignSystemChoices } from "./config-choices.mjs";
5
4
  import { Placement, Workspace } from "./detect/workspace.mjs";
@@ -42,8 +41,7 @@ export declare function decideAgain(ui: Reporter, existing: ExistingStudio, find
42
41
  */
43
42
  export declare function newStudioSpec(asked: string | undefined, listed: string | undefined, dir: string): string | undefined;
44
43
  /** dex.config.ts as this version would leave it: comments and formatting stay. */
45
- export declare function configChange(existing: ExistingStudio, designSystem: DesignSystemChoices | undefined, { icons, next, root }: {
46
- icons: InterfaceIcons;
44
+ export declare function configChange(existing: ExistingStudio, designSystem: DesignSystemChoices | undefined, { next, root }: {
47
45
  next: boolean;
48
46
  /** Where the plan's paths start: files are named from here. */
49
47
  root: string;
@@ -2,7 +2,6 @@ import { PACKAGE_NAME, isDirectory, isFile, isOlder, posix as posix$1 } from "..
2
2
  import { isRecord } from "../shared/checks.mjs";
3
3
  import { withNewPackage } from "../config/renamed.mjs";
4
4
  import { STUDIO_FILES } from "../shared/studio-files.mjs";
5
- import { INTERFACE_ICONS } from "../shared/icon-sets.mjs";
6
5
  import { dependenciesOf, packageEntry, readComponentsJson } from "../config/project-files.mjs";
7
6
  import { listing } from "../shared/listing.mjs";
8
7
  import { dexRunner, packageManager } from "../config/package-manager.mjs";
@@ -88,16 +87,17 @@ function configChoices(existing, designSystem, { needsProvider, root }) {
88
87
  const flags = {};
89
88
  const dir = posix$1(relative(packageDir, content));
90
89
  if (dir && dir !== ".") flags.dir = dir;
91
- const ui = uiOf(read);
92
- const icons = INTERFACE_ICONS.find((set) => set === ui.icons);
93
- if (icons) flags.icons = icons;
94
- const primitives = ui.primitives;
90
+ const primitives = uiOf(read).primitives;
95
91
  if (!uiInCode(read, "primitives") && (primitives === void 0 || typeof primitives === "boolean")) flags.primitives = primitives === true;
96
92
  if (designSystem) {
97
93
  const written = read.data.designSystem;
98
94
  const { resolved } = designSystem;
99
95
  const components = componentsFlags(written, resolved, packageDir);
100
- if (components) Object.assign(flags, components, { shadcn: false });
96
+ if (components) Object.assign(flags, components, {
97
+ shadcn: false,
98
+ preset: void 0,
99
+ base: void 0
100
+ });
101
101
  const styles = stylesFlag(resolved, root);
102
102
  if (styles) flags.styles = styles;
103
103
  const provider = providerFlag(resolved, needsProvider);
@@ -108,7 +108,6 @@ function configChoices(existing, designSystem, { needsProvider, root }) {
108
108
  /** Each flag is named for the decision it answers. */
109
109
  const ANSWERABLE = [
110
110
  "dir",
111
- "icons",
112
111
  "primitives",
113
112
  "components",
114
113
  "styles",
@@ -241,7 +240,7 @@ function droppedPhrases(dropped, { components, packageJson }) {
241
240
  });
242
241
  }
243
242
  /** dex.config.ts as this version would leave it: comments and formatting stay. */
244
- function configChange(existing, designSystem, { icons, next, root }) {
243
+ function configChange(existing, designSystem, { next, root }) {
245
244
  const { read, packageDir } = existing;
246
245
  const edits = {};
247
246
  const renamed = configRename(existing.file);
@@ -268,9 +267,9 @@ function configChange(existing, designSystem, { icons, next, root }) {
268
267
  }];
269
268
  changes.push(`+ plugins: [${local}()]`);
270
269
  }
271
- if (!uiInCode(read, "icons") && uiOf(read).icons === void 0) {
272
- edits.ui = { icons };
273
- changes.push(`+ ui.icons: "${icons}"`);
270
+ if (!uiInCode(read, "icons") && uiOf(read).icons !== void 0) {
271
+ edits.remove = [...edits.remove ?? [], "ui.icons"];
272
+ changes.push("- ui.icons: Dex draws with Lucide");
274
273
  }
275
274
  return changes.length > 0 ? edited(existing, edits, changes) : void 0;
276
275
  }
@@ -39,9 +39,8 @@ export interface OwnAppFacts {
39
39
  versionsFrom: string | undefined;
40
40
  }
41
41
  /** The studio's own app: its dependencies, tsconfig and turbo.json. */
42
- export declare function ownAppFacts(workspace: Workspace, placement: OwnAppPlacement, { componentsDir, iconPackages, studioSpec }: {
42
+ export declare function ownAppFacts(workspace: Workspace, placement: OwnAppPlacement, { componentsDir, studioSpec }: {
43
43
  componentsDir: string | undefined;
44
- iconPackages: Record<string, string>;
45
44
  studioSpec: string;
46
45
  }): OwnAppFacts;
47
46
  /** apps/<name>/package.json. */
@@ -99,7 +99,7 @@ function devTask(turbo, designSystem) {
99
99
  }
100
100
  /**
101
101
  * A turbo.json for the studio's app, when the root's cannot start it as
102
- * the studio needs, so `STUDIO_PORT=4103 npm run studio` serves on 4103.
102
+ * the studio needs, so `STUDIO_PORT=4103 npm run dex` serves on 4103.
103
103
  */
104
104
  function packageTurbo(workspace, designSystem) {
105
105
  const { turbo } = workspace;
@@ -121,7 +121,7 @@ function packageTurbo(workspace, designSystem) {
121
121
  };
122
122
  }
123
123
  /** The studio's own app: its dependencies, tsconfig and turbo.json. */
124
- function ownAppFacts(workspace, placement, { componentsDir, iconPackages, studioSpec }) {
124
+ function ownAppFacts(workspace, placement, { componentsDir, studioSpec }) {
125
125
  const designSystem = designSystemPackage(workspace, componentsDir);
126
126
  const sibling = siblingApp(workspace, designSystem);
127
127
  const versions = dependenciesOf(sibling ? manifestOf(sibling) : void 0);
@@ -137,8 +137,7 @@ function ownAppFacts(workspace, placement, { componentsDir, iconPackages, studio
137
137
  const devDependencies = {
138
138
  [PACKAGE_NAME]: studioSpec,
139
139
  ...tsconfig?.package ? { [tsconfig.package]: protocol } : {},
140
- ...vite,
141
- ...iconPackages
140
+ ...vite
142
141
  };
143
142
  const turbo = packageTurbo(workspace, designSystem);
144
143
  return {
@@ -207,7 +206,7 @@ function rootStudioScript(workspace, manager, placement) {
207
206
  const own = placement.kind === "own-app";
208
207
  const folder = own ? placement.folder : placement.packageFolder;
209
208
  const target = selector(placement.packageName, folder);
210
- const script = own ? "dev" : "studio";
209
+ const script = own ? "dev" : "dex";
211
210
  if (own && workspace.tool.value === "turbo") return `turbo run dev --filter=${target}`;
212
211
  switch (manager.name) {
213
212
  case "pnpm": return `pnpm --filter ${target} ${script}`;
@@ -5,7 +5,7 @@ import { SetupDecisions } from "./questions.mjs";
5
5
  import { Agent } from "package-manager-detector";
6
6
  //#region src/setup/plan.d.ts
7
7
  /** A file or folder setup writes, by what it is. */
8
- export type WriteKind = "config" | "guide" | "provider" | "tsconfig" | "types" | "scripts" | "gitignore" | "pointer" | "agent" | "app-package" | "turbo" | "root-script";
8
+ export type WriteKind = "config" | "guide" | "provider" | "tsconfig" | "types" | "scripts" | "gitignore" | "pointer" | "agent" | "app-package" | "turbo" | "root-script" | "pnpm-builds";
9
9
  /** A command setup runs, by what it is for. */
10
10
  export type RunKind = "shadcn" | "install" | "link";
11
11
  export type PlanStep = {
@@ -62,14 +62,12 @@ export interface WorkspaceSetup {
62
62
  install: string[];
63
63
  /** The workspace root's package.json scripts. */
64
64
  rootScripts: Record<string, string>;
65
- /** The root's "studio" script: "turbo run dev --filter=@acme/studio". */
65
+ /** The root's "dex" script: "turbo run dev --filter=@acme/studio". */
66
66
  studioScript: string;
67
67
  /** How package.json asks for the studio: "^0.3.0", "file:..."; undefined when listed. */
68
68
  studioSpec: string | undefined;
69
69
  }
70
70
  export interface SetupPlan {
71
- /** The icon set's packages the studio's package gets: in a workspace, in its package.json. */
72
- iconPackages: Record<string, string>;
73
71
  steps: PlanStep[];
74
72
  /** The studio's folder, relative to where the plan starts: "studio". */
75
73
  studio: string;
@@ -109,8 +107,10 @@ export interface PlanInput {
109
107
  gitignore: string;
110
108
  /** The .gitignore where the plan starts. */
111
109
  hostGitignore: string | undefined;
112
- /** The icon set's packages it lacks: none for Lucide, which comes with the studio. */
113
- iconPackages: Record<string, string>;
110
+ /** pnpm 11 or later: it stops an install on a build script nobody decided on. */
111
+ pnpmStopsOnBuilds?: boolean;
112
+ /** pnpm-workspace.yaml where the plan starts, when it has one. */
113
+ pnpmWorkspace?: string;
114
114
  /** Where setup looked, absolute: the files decisions name are shown from it. */
115
115
  projectRoot?: string;
116
116
  /** Ask nothing: no terminal, or --yes. */
@@ -144,6 +144,8 @@ export declare const AGENT_FILES: Record<AgentId, string[]>;
144
144
  export declare const commandLine: (command: string[]) => string;
145
145
  /** `<manager> add -D <specs>`, as the project's package manager writes it. */
146
146
  export declare const addCommand: (agent: Agent, ...specs: string[]) => string[];
147
+ /** `<manager> install`, as the project's package manager writes it. */
148
+ export declare const installCommand: (agent: Agent) => string[];
147
149
  /** Every step `dex create` takes, in order. */
148
150
  export declare function planSetup(input: PlanInput): SetupPlan;
149
151
  /** The plan as lines: "create dex.config.ts design system …". */