@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
@@ -1,8 +1,9 @@
1
1
  import { posix as posix$1 } from "../paths.mjs";
2
- import { ICON_SET_NAMES } from "../shared/icon-sets.mjs";
3
2
  import { fromProject } from "./design-md-setup.mjs";
4
3
  import { relative } from "node:path";
5
4
  //#region src/setup/questions.ts
5
+ /** `--preset` and `--base` as setup passes them on to `shadcn init`. */
6
+ const shadcnInitFlags = ({ preset, base }) => [...preset ? ["--preset", preset] : [], ...base ? ["--base", base] : []];
6
7
  /** The file setup writes the provider to, in the studio's folder. */
7
8
  const PROVIDER_FILE = "provider.tsx";
8
9
  /** How prototypes import a components folder, when it cannot be derived. */
@@ -90,7 +91,11 @@ const QUESTION = {
90
91
  import: decision.choice.barrel ?? decision.choice.import
91
92
  } : decision.kind,
92
93
  asFlags: (decision, { cwd }) => {
93
- if (decision.kind === "shadcn") return ["--shadcn"];
94
+ if (decision.kind === "shadcn") return [
95
+ "--shadcn",
96
+ ...decision.preset ? [`--preset ${decision.preset}`] : [],
97
+ ...decision.base ? [`--base ${decision.base}`] : []
98
+ ];
94
99
  if (decision.kind === "none") return ["--components none"];
95
100
  const { barrel, dir, import: specifier } = decision.choice;
96
101
  return [`--components ${fromCwd(dir, cwd)}`, ...specifier && !barrel ? [`--import ${specifier}`] : []];
@@ -113,28 +118,9 @@ const QUESTION = {
113
118
  primitives: {
114
119
  key: "primitives",
115
120
  label: "Primitives",
116
- flag: "--primitives | --no-primitives",
121
+ flag: "--primitives",
117
122
  asJson: (primitives) => primitives,
118
- asFlags: (primitives, { components }) => {
119
- if (components.kind !== "folder") return [];
120
- const { baseUi, import: specifier } = components.choice;
121
- if (primitives) return specifier ? ["--primitives"] : [];
122
- return baseUi ? ["--no-primitives"] : [];
123
- }
124
- },
125
- icons: {
126
- key: "icons",
127
- label: "Icon set",
128
- flag: "--icons lucide|phosphor|hugeicons",
129
- asked: {
130
- question: "Which icon set should Dex's interface draw with?",
131
- choice: (icons) => ({
132
- value: icons,
133
- label: ICON_SET_NAMES[icons]
134
- })
135
- },
136
- asJson: (icons) => icons,
137
- asFlags: (icons) => [`--icons ${icons}`]
123
+ asFlags: (primitives, { components }) => primitives && components.kind === "folder" && components.choice.import ? ["--primitives"] : []
138
124
  },
139
125
  provider: {
140
126
  key: "provider",
@@ -192,7 +178,6 @@ const QUESTIONS = [
192
178
  QUESTION.components,
193
179
  QUESTION.styles,
194
180
  QUESTION.primitives,
195
- QUESTION.icons,
196
181
  QUESTION.provider,
197
182
  QUESTION.designMd,
198
183
  QUESTION.agents,
@@ -229,4 +214,4 @@ function questionEvent(question, decided, context) {
229
214
  };
230
215
  }
231
216
  //#endregion
232
- export { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS, questionEvent, questionFor };
217
+ export { IMPORT_FLAG, PROVIDER_FILE, QUESTION, QUESTIONS, questionEvent, questionFor, shadcnInitFlags };
@@ -1,5 +1,6 @@
1
1
  import { TEMPLATES_DIR } from "../paths.mjs";
2
2
  import { USER_AGENT_RE } from "./project.mjs";
3
+ import { withEsbuildBuilds } from "./write.mjs";
3
4
  import { packageManagerName } from "./prompts.mjs";
4
5
  import { dirname, join } from "node:path";
5
6
  import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
@@ -22,8 +23,8 @@ const STARTERS = {
22
23
  workspace: false,
23
24
  shared: [],
24
25
  next: [{
25
- script: "studio",
26
- what: "the studio, with a first file"
26
+ script: "dex",
27
+ what: "Dex, with a first file"
27
28
  }, {
28
29
  script: "dev",
29
30
  what: "your app"
@@ -51,8 +52,8 @@ const STARTERS = {
51
52
  }
52
53
  ],
53
54
  next: [{
54
- script: "studio",
55
- what: "the studio, with a first file"
55
+ script: "dex",
56
+ what: "Dex, with a first file"
56
57
  }]
57
58
  },
58
59
  turborepo: {
@@ -78,11 +79,11 @@ const STARTERS = {
78
79
  }
79
80
  ],
80
81
  next: [{
81
- script: "studio",
82
- what: "the studio, with a first file"
82
+ script: "dex",
83
+ what: "Dex, with a first file"
83
84
  }, {
84
85
  script: "dev",
85
- what: "every app: apps/web and the studio"
86
+ what: "every app: apps/web and Dex"
86
87
  }]
87
88
  }
88
89
  };
@@ -146,7 +147,16 @@ async function fitPackageManager(root, values) {
146
147
  if (values.pmVersion) manifest.packageManager = `${values.pm}@${values.pmVersion}`;
147
148
  if (values.pm === "pnpm") manifest.workspaces = void 0;
148
149
  await writeFile(file, `${JSON.stringify(manifest, null, 2)}\n`);
149
- if (values.pm === "pnpm" && Array.isArray(workspaces)) await writeFile(join(root, "pnpm-workspace.yaml"), `packages:\n${workspaces.map((glob) => ` - "${glob}"`).join("\n")}\n`);
150
+ if (values.pm === "pnpm") await writePnpmWorkspace(root, workspaces);
151
+ }
152
+ /**
153
+ * pnpm's settings file: the workspaces, in a workspace, and what to do with
154
+ * esbuild's install script. Vite brings esbuild, and pnpm 11 stops the
155
+ * install on a script nobody decided on (write.ts, withEsbuildBuilds).
156
+ */
157
+ async function writePnpmWorkspace(root, workspaces) {
158
+ const packages = Array.isArray(workspaces) ? `packages:\n${workspaces.map((glob) => ` - "${glob}"`).join("\n")}\n` : "";
159
+ await writeFile(join(root, "pnpm-workspace.yaml"), withEsbuildBuilds(packages) ?? packages);
150
160
  }
151
161
  /**
152
162
  * Copy `starter` into `root`, which is empty: its own files, then the files
@@ -161,6 +171,7 @@ async function copyStarter(starter, root, values) {
161
171
  await copyTree(join(STARTERS_DIR, shared.from), join(root, shared.to), (text) => replace.reduce((changed, [from, to]) => changed.replaceAll(from, to), fill(text)));
162
172
  }
163
173
  if (starter.workspace) await fitPackageManager(root, values);
174
+ else if (values.pm === "pnpm") await writePnpmWorkspace(root, void 0);
164
175
  }
165
176
  //#endregion
166
177
  export { DEFAULT_STARTER, STARTERS, STARTERS_DIR, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager };
@@ -25,10 +25,9 @@ export declare function findingsFor(workspace: Workspace, placement: Placement,
25
25
  userAgent?: string;
26
26
  }): Promise<ProjectFindings>;
27
27
  /** What the plan adds for a workspace, once the decisions are made. */
28
- export declare function workspaceSetup(workspace: Workspace, placement: Placement, findings: ProjectFindings, decisions: SetupDecisions, { flags, cwd, iconPackages }: {
28
+ export declare function workspaceSetup(workspace: Workspace, placement: Placement, findings: ProjectFindings, decisions: SetupDecisions, { flags, cwd }: {
29
29
  flags: SetupFlags;
30
30
  cwd: string;
31
- iconPackages: Record<string, string>;
32
31
  }): WorkspaceSetup;
33
32
  /**
34
33
  * What to look at before going ahead: a shared package's components that
@@ -1,9 +1,9 @@
1
1
  import { PACKAGE_NAME, posix as posix$1, studioVersion } from "../paths.mjs";
2
2
  import { findWorkspace } from "./detect/workspace.mjs";
3
3
  import { designMdFinding } from "./design-md-setup.mjs";
4
- import { pmCommand } from "../config/package-manager.mjs";
5
- import { findProject, iconsFinding } from "./project.mjs";
4
+ import { findProject } from "./project.mjs";
6
5
  import { designSystemPackage, internalAliases, ownAppFacts, rootStudioScript } from "./own-app.mjs";
6
+ import { installCommand } from "./plan.mjs";
7
7
  import { existsSync, readFileSync } from "node:fs";
8
8
  import { dirname, isAbsolute, join, relative, resolve } from "node:path";
9
9
  //#region src/setup/workspace-setup.ts
@@ -74,7 +74,6 @@ async function findingsFor(workspace, placement, options = {}) {
74
74
  evidence: `${library.folder} is a shared package`,
75
75
  alternatives: candidates.filter((choice) => choice !== shared)
76
76
  },
77
- icons: shared === value ? findings.icons : iconsFinding(findings.root, shared, `${library.folder}'s components.json`),
78
77
  designSystem: {
79
78
  ...findings.designSystem,
80
79
  name: library.name
@@ -120,7 +119,7 @@ function studioSpecFor(findings, placement, flags, { cwd, manager }) {
120
119
  return versionSpec();
121
120
  }
122
121
  /** What the plan adds for a workspace, once the decisions are made. */
123
- function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd, iconPackages }) {
122
+ function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd }) {
124
123
  const manager = decisions.packageManager.value;
125
124
  const studioSpec = studioSpecFor(findings, placement, flags, {
126
125
  cwd,
@@ -130,10 +129,9 @@ function workspaceSetup(workspace, placement, findings, decisions, { flags, cwd,
130
129
  return {
131
130
  app: placement.kind === "own-app" ? ownAppFacts(workspace, placement, {
132
131
  componentsDir: components.kind === "folder" ? components.choice.dir : void 0,
133
- iconPackages,
134
132
  studioSpec: studioSpec ?? versionSpec()
135
133
  }) : void 0,
136
- install: pmCommand(manager.agent, "install", []),
134
+ install: installCommand(manager.agent),
137
135
  rootScripts: recordAt(readManifest(workspace.root), "scripts"),
138
136
  studioScript: rootStudioScript(workspace, manager, placement),
139
137
  studioSpec
@@ -1,5 +1,5 @@
1
1
  import { StylingApproach } from "../shared/design-system.mjs";
2
- import { DesignSystemConfig, StudioInterface } from "../config/index.mjs";
2
+ import { DesignSystemConfig } from "../config/index.mjs";
3
3
  //#region src/setup/write.d.ts
4
4
  /**
5
5
  * The sentence in the pointer setup adds to the root's AGENTS.md or
@@ -42,13 +42,11 @@ export declare function designSystemConfig(facts: DesignSystemFacts, root: strin
42
42
  /**
43
43
  * dex.config.ts for a new studio: the choices made, and nothing the
44
44
  * project's files or the defaults say. `studio` is "studio", or "." for an
45
- * app of its own. The icon set is always written, Lucide too: it is a
46
- * choice the team made, and what the install brought in.
45
+ * app of its own.
47
46
  */
48
- export declare function configSource(designSystem: DesignSystemConfig | undefined, { studio, primitives, icons, next }: {
47
+ export declare function configSource(designSystem: DesignSystemConfig | undefined, { studio, primitives, next }: {
49
48
  studio: string;
50
49
  primitives: boolean;
51
- icons: NonNullable<StudioInterface["icons"]>;
52
50
  next?: boolean;
53
51
  }): string;
54
52
  /**
@@ -105,6 +103,18 @@ export declare const ignoreFile: (studio: string, { hasOwn }: {
105
103
  export declare const missingIgnoreLines: (gitignore: string, wanted: string[]) => string[];
106
104
  /** The .gitignore with the studio's lines added under a heading. */
107
105
  export declare const withIgnoreLines: (gitignore: string, missing: string[]) => string;
106
+ /**
107
+ * Whether pnpm-workspace.yaml settles esbuild's install script already:
108
+ * names it in any list or map (allowBuilds, onlyBuiltDependencies...), or
109
+ * allows every script.
110
+ */
111
+ export declare const pnpmDecidesEsbuild: (yaml: string) => boolean;
112
+ /**
113
+ * pnpm-workspace.yaml with `esbuild: false` under `allowBuilds`, keeping
114
+ * everything else; undefined when its `allowBuilds` is written some way
115
+ * this can't add to (`allowBuilds: {}`).
116
+ */
117
+ export declare function withEsbuildBuilds(yaml: string): string | undefined;
108
118
  /**
109
119
  * The pointer setup adds to the root's AGENTS.md or CLAUDE.md, so an agent
110
120
  * started at the root reads the studio's brief before studio work.
@@ -51,10 +51,9 @@ function designSystemConfig(facts, root) {
51
51
  /**
52
52
  * dex.config.ts for a new studio: the choices made, and nothing the
53
53
  * project's files or the defaults say. `studio` is "studio", or "." for an
54
- * app of its own. The icon set is always written, Lucide too: it is a
55
- * choice the team made, and what the install brought in.
54
+ * app of its own.
56
55
  */
57
- function configSource(designSystem, { studio, primitives, icons, next }) {
56
+ function configSource(designSystem, { studio, primitives, next }) {
58
57
  const content = studio === "." ? "" : `\n content: "./${studio}",\n`;
59
58
  const base = `import { defineConfig } from "${PACKAGE_NAME}/config";
60
59
 
@@ -70,10 +69,7 @@ export default defineConfig({${content}});
70
69
  designSystem,
71
70
  plugins: next ? [{ code: "next()" }] : void 0
72
71
  },
73
- ui: {
74
- icons,
75
- ...primitives ? { primitives: true } : {}
76
- }
72
+ ...primitives ? { ui: { primitives: true } } : {}
77
73
  });
78
74
  }
79
75
  /** What views need that a project's own tsconfig doesn't give them. */
@@ -153,9 +149,10 @@ const fromStudio = (content, file) => {
153
149
  * The script setup adds to package.json, when the name is free: one, so
154
150
  * the project's own file changes by a dependency and a line.
155
151
  */
156
- const STUDIO_SCRIPTS = { studio: "dex dev" };
152
+ const STUDIO_SCRIPTS = { dex: "dex dev" };
157
153
  /** A later setup leaves these, as anything of the project's own: as Dex wrote them, or Sudio. */
158
154
  const OLD_SCRIPTS = {
155
+ studio: ["dex dev", "sudio dev"],
159
156
  "studio:build": ["dex build", "sudio build"],
160
157
  "studio:claude": ["dex claude", "sudio claude"]
161
158
  };
@@ -185,6 +182,35 @@ const missingIgnoreLines = (gitignore, wanted) => {
185
182
  };
186
183
  /** The .gitignore with the studio's lines added under a heading. */
187
184
  const withIgnoreLines = (gitignore, missing) => missing.length === 0 ? gitignore : `${gitignore.trimEnd() ? `${gitignore.trimEnd()}\n\n` : ""}# Dex\n${missing.join("\n")}\n`;
185
+ const ESBUILD_DECIDED_RE = /^\s*-?\s*["']?esbuild["']?\s*(:|$)/m;
186
+ const ALL_BUILDS_RE = /^(dangerouslyAllowAllBuilds:\s*true|strictDepBuilds:\s*false)\s*$/m;
187
+ const ALLOW_BUILDS_RE = /^allowBuilds:[ \t]*\n((?:[ \t]+.*\n?)*)/m;
188
+ const ALLOW_BUILDS_KEY_RE = /^allowBuilds:/m;
189
+ const INDENT_RE = /^([ \t]+)\S/;
190
+ /**
191
+ * Whether pnpm-workspace.yaml settles esbuild's install script already:
192
+ * names it in any list or map (allowBuilds, onlyBuiltDependencies...), or
193
+ * allows every script.
194
+ */
195
+ const pnpmDecidesEsbuild = (yaml) => ESBUILD_DECIDED_RE.test(yaml) || ALL_BUILDS_RE.test(yaml);
196
+ /**
197
+ * pnpm-workspace.yaml with `esbuild: false` under `allowBuilds`, keeping
198
+ * everything else; undefined when its `allowBuilds` is written some way
199
+ * this can't add to (`allowBuilds: {}`).
200
+ */
201
+ function withEsbuildBuilds(yaml) {
202
+ const block = ALLOW_BUILDS_RE.exec(yaml);
203
+ if (block) {
204
+ const indent = INDENT_RE.exec(block[1] ?? "")?.[1] ?? " ";
205
+ const end = block.index + block[0].length;
206
+ const before = yaml.slice(0, end);
207
+ const line = `${indent}esbuild: false\n`;
208
+ return `${before}${before.endsWith("\n") ? "" : "\n"}${line}${yaml.slice(end)}`;
209
+ }
210
+ if (ALLOW_BUILDS_KEY_RE.test(yaml)) return;
211
+ const kept = yaml.trimEnd();
212
+ return `${kept ? `${kept}\n` : ""}allowBuilds:\n esbuild: false\n`;
213
+ }
188
214
  /**
189
215
  * The pointer setup adds to the root's AGENTS.md or CLAUDE.md, so an agent
190
216
  * started at the root reads the studio's brief before studio work.
@@ -202,4 +228,4 @@ const withPointer = (guide, studio) => {
202
228
  return body ? `${body}\n\n${pointerText(studio)}` : pointerText(studio);
203
229
  };
204
230
  //#endregion
205
- export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pointerPlace, pointerText, tsconfigJson, withIgnoreLines, withPointer };
231
+ export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, pointerPlace, pointerText, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer };
@@ -250,6 +250,11 @@ setInterval(() => {
250
250
  else if (Date.now() - lastCheck >= 1000) { lastCheck = Date.now(); post("check"); }
251
251
  }, CONFIG.inApp ? 500 : 2000);
252
252
  `;
253
+ /**
254
+ * The tab's icon, inlined, as this page shows while the server that serves
255
+ * app/public/dex-icon.svg is down. Drawn by scripts/studio-icons.mjs.
256
+ */
257
+ const ICON = `data:image/svg+xml,${encodeURIComponent("<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><rect width=\"24\" height=\"24\" rx=\"5.5\" fill=\"#155dfc\"/><path transform=\"translate(6.206 4.750) scale(0.3625)\" fill=\"#ffffff\" d=\"M0,10.13333l0,-10.13333h14.5c7.45773,0 13.96208,4.08187 17.4008,10.13333zM34.5,20c0,1.75052 -0.2249,3.44852 -0.64737,5.06667l-33.85263,0l0,-10.13333l33.85263,0c0.42247,1.61815 0.64737,3.31614 0.64737,5.06667zM31.9008,29.86667c-3.43872,6.05147 -9.94307,10.13333 -17.4008,10.13333h-14.5l0,-10.13333z\"/></svg>")}`;
253
258
  /** The whole page, saying `options.state` first. */
254
259
  const serverPage = (options) => {
255
260
  const name = escapeHtml(options.name);
@@ -262,6 +267,7 @@ const serverPage = (options) => {
262
267
  <meta name="viewport" content="width=device-width, initial-scale=1">
263
268
  <meta name="color-scheme" content="light dark">
264
269
  <title>${name}</title>
270
+ <link rel="icon" href="${ICON}" type="image/svg+xml">
265
271
  <style>${STYLE}</style>
266
272
  </head>
267
273
  <body>