@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.
- package/CHANGELOG.md +17 -0
- package/README.md +16 -15
- package/app/canvas/frame-node.tsx +34 -17
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/i18n/locales/en/messages.po +26 -4
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +26 -4
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +3 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/instructions-editor.tsx +1 -1
- package/app/shell/presence-style.ts +59 -0
- package/app/shell/presence.tsx +6 -3
- package/app/shell/settings-sections.ts +12 -0
- package/app/shell/sidebar.tsx +1 -1
- package/app/studio-ui.d.ts +0 -9
- package/app/ui/prompt-editor.tsx +1 -1
- package/dist/cli/commands/create.d.mts +26 -14
- package/dist/cli/commands/create.mjs +13 -7
- package/dist/cli/commands/dev.mjs +2 -3
- package/dist/cli/commands/init.d.mts +11 -6
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +3 -3
- package/dist/cli/main.d.mts +22 -12
- package/dist/config/index.d.mts +6 -5
- package/dist/config/project-files.d.mts +0 -3
- package/dist/config/project-files.mjs +0 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/content.mjs +0 -3
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/paste/paste.mjs +1 -1
- package/dist/server/brief.mjs +3 -3
- package/dist/server/channel.d.mts +6 -0
- package/dist/server/channel.mjs +16 -1
- package/dist/server/claimed-presence.d.mts +17 -0
- package/dist/server/claimed-presence.mjs +50 -0
- package/dist/server/dev-server.mjs +9 -0
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/requests.mjs +1 -1
- package/dist/server/studio-for.mjs +1 -1
- package/dist/server/vite.mjs +26 -29
- package/dist/server/web-app.mjs +3 -3
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.mjs +51 -19
- package/dist/setup/desktop-app.mjs +1 -1
- package/dist/setup/detect.d.mts +14 -5
- package/dist/setup/detect.mjs +56 -8
- package/dist/setup/doctor.mjs +1 -3
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/own-app.d.mts +1 -2
- package/dist/setup/own-app.mjs +4 -5
- package/dist/setup/plan.d.mts +8 -6
- package/dist/setup/plan.mjs +64 -48
- package/dist/setup/project.d.mts +0 -16
- package/dist/setup/project.mjs +8 -52
- package/dist/setup/prompts.d.mts +5 -5
- package/dist/setup/prompts.mjs +28 -61
- package/dist/setup/questions.d.mts +12 -4
- package/dist/setup/questions.mjs +10 -25
- package/dist/setup/starters.mjs +19 -8
- package/dist/setup/workspace-setup.d.mts +1 -2
- package/dist/setup/workspace-setup.mjs +4 -6
- package/dist/setup/write.d.mts +15 -5
- package/dist/setup/write.mjs +35 -9
- package/dist/shared/server-page.mjs +6 -0
- package/extension/dist/feedback.js +1 -1
- package/extension/dist/manifest.json +1 -1
- package/package.json +2 -19
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +0 -5
- package/src/config/schema.ts +0 -1
- package/src/content/content.ts +0 -3
- package/src/content/snapshot-client.ts +1 -1
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +27 -0
- package/src/server/claimed-presence.ts +77 -0
- package/src/server/dev-server.ts +13 -0
- package/src/server/file-errors.ts +47 -13
- package/src/server/studio-for.ts +1 -1
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +3 -3
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +52 -20
- package/src/setup/desktop-app.ts +1 -1
- package/src/setup/detect.ts +56 -10
- package/src/setup/doctor.ts +4 -4
- package/src/setup/existing-setup.ts +10 -12
- package/src/setup/own-app.ts +2 -5
- package/src/setup/plan.ts +93 -84
- package/src/setup/project.ts +16 -110
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +27 -9
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/server-page.ts +9 -0
- package/templates/methods/review.md +2 -2
- package/templates/rules/canvas-frames.md +104 -0
- package/templates/rules/canvas.md +8 -142
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/snapshots.md +52 -0
- package/templates/starters/standalone/README.md +7 -7
- package/templates/starters/standalone/components.json +1 -1
- package/templates/starters/standalone/package.json +1 -2
- package/templates/starters/turborepo/README.md +6 -6
- package/templates/starters/turborepo/apps/web/components.json +1 -1
- package/templates/starters/turborepo/apps/web/package.json +1 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +4 -5
- package/templates/starters/turborepo/packages/ui/components.json +1 -1
- package/templates/starters/turborepo/packages/ui/package.json +1 -2
- package/templates/starters/vite/README.md +7 -6
- package/templates/starters/vite/components.json +1 -1
- package/templates/starters/vite/package.json +1 -2
- package/templates/starters/vite/src/app.tsx +3 -4
- package/templates/starters/vite/src/components/ui/accordion.tsx +71 -0
- package/templates/starters/vite/src/components/ui/attachment.tsx +1 -1
- package/templates/starters/vite/src/components/ui/badge.tsx +2 -2
- package/templates/starters/vite/src/components/ui/button.tsx +17 -12
- package/templates/starters/vite/src/components/ui/card.tsx +1 -1
- package/templates/starters/vite/src/components/ui/checkbox.tsx +28 -0
- package/templates/starters/vite/src/components/ui/dialog.tsx +5 -5
- package/templates/starters/vite/src/components/ui/dropdown-menu.tsx +17 -14
- package/templates/starters/vite/src/components/ui/field.tsx +3 -1
- package/templates/starters/vite/src/components/ui/input-group.tsx +5 -3
- package/templates/starters/vite/src/components/ui/input.tsx +1 -1
- package/templates/starters/vite/src/components/ui/label.tsx +2 -0
- package/templates/starters/vite/src/components/ui/native-select.tsx +3 -4
- package/templates/starters/vite/src/components/ui/popover.tsx +1 -1
- package/templates/starters/vite/src/components/ui/separator.tsx +2 -0
- package/templates/starters/vite/src/components/ui/spinner.tsx +3 -7
- package/templates/starters/vite/src/components/ui/switch.tsx +1 -1
- package/templates/starters/vite/src/components/ui/textarea.tsx +1 -1
- package/templates/starters/vite/src/components/ui/toggle.tsx +4 -2
- package/templates/starters/vite/src/index.css +533 -111
- package/app/icons/sets/hugeicons.tsx +0 -259
- package/app/icons/sets/phosphor.tsx +0 -251
- package/dist/server/icon-set.d.mts +0 -15
- package/dist/server/icon-set.mjs +0 -31
- package/dist/shared/icon-sets.d.mts +0 -9
- package/dist/shared/icon-sets.mjs +0 -21
- package/src/server/icon-set.ts +0 -56
- package/src/shared/icon-sets.ts +0 -23
- /package/app/public/{sudio-192.png → dex-192.png} +0 -0
- /package/app/public/{sudio-512.png → dex-512.png} +0 -0
- /package/app/public/{apple-touch-icon.png → dex-apple-touch-icon.png} +0 -0
- /package/app/public/{favicon-32.png → dex-icon-32.png} +0 -0
- /package/app/public/{favicon.svg → dex-icon.svg} +0 -0
- /package/app/public/{sudio-maskable-512.png → dex-maskable-512.png} +0 -0
package/src/setup/create.ts
CHANGED
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
// after the plan. With `--json`, what setup isn't sure of is a `question`
|
|
18
18
|
// event, for an agent to ask the person, then run it with the answers' flags.
|
|
19
19
|
|
|
20
|
-
import {
|
|
20
|
+
import { execFileSync } from "node:child_process";
|
|
21
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
21
22
|
import { readdir, readFile } from "node:fs/promises";
|
|
22
23
|
import { basename, join, relative, resolve } from "node:path";
|
|
23
24
|
import { type Check, createReporter, type Reporter } from "../cli/ui.ts";
|
|
@@ -39,7 +40,6 @@ import {
|
|
|
39
40
|
import { agentSetups } from "../server/agents.ts";
|
|
40
41
|
import { nextPackage } from "../server/next.ts";
|
|
41
42
|
import { isOneOf } from "../shared/checks.ts";
|
|
42
|
-
import { ICON_SET_NAMES } from "../shared/icon-sets.ts";
|
|
43
43
|
import { STUDIO_FILES } from "../shared/studio-files.ts";
|
|
44
44
|
import {
|
|
45
45
|
type ApplyResult,
|
|
@@ -89,6 +89,7 @@ import {
|
|
|
89
89
|
import {
|
|
90
90
|
changesAnything,
|
|
91
91
|
inPackage,
|
|
92
|
+
installCommand,
|
|
92
93
|
planLines,
|
|
93
94
|
planSetup,
|
|
94
95
|
type SetUpAgain,
|
|
@@ -104,7 +105,6 @@ import {
|
|
|
104
105
|
connectInStudio,
|
|
105
106
|
createCommandFor,
|
|
106
107
|
findProject,
|
|
107
|
-
iconPackagesToAdd,
|
|
108
108
|
type PackageManagerName,
|
|
109
109
|
type ProjectFindings,
|
|
110
110
|
resolvedStudio,
|
|
@@ -145,7 +145,6 @@ import {
|
|
|
145
145
|
} from "./starters.ts";
|
|
146
146
|
import {
|
|
147
147
|
findingsFor,
|
|
148
|
-
packageDirOf,
|
|
149
148
|
targetFor,
|
|
150
149
|
workspaceFor,
|
|
151
150
|
workspaceSetup,
|
|
@@ -233,7 +232,6 @@ function detectionLines(
|
|
|
233
232
|
styles.value
|
|
234
233
|
? `Styles: ${styles.value} ${evidence(styles)}`
|
|
235
234
|
: `Styles: none found (${styles.evidence})`,
|
|
236
|
-
`Icon set: ${ICON_SET_NAMES[findings.icons.value]} ${evidence(findings.icons)}`,
|
|
237
235
|
...(findings.provider.value
|
|
238
236
|
? [
|
|
239
237
|
`Provider: ${findings.provider.value.library} needs ${findings.provider.value.component} around every view ${evidence(findings.provider)}`,
|
|
@@ -276,8 +274,6 @@ function reportFindings(
|
|
|
276
274
|
}
|
|
277
275
|
);
|
|
278
276
|
finding("styles", findings.styles, findings.styles.value);
|
|
279
|
-
finding("primitives", findings.primitives, findings.primitives.value);
|
|
280
|
-
finding("icons", findings.icons, findings.icons.value);
|
|
281
277
|
const need = findings.provider.value;
|
|
282
278
|
if (need) {
|
|
283
279
|
finding("provider", findings.provider, {
|
|
@@ -537,13 +533,14 @@ function nextLines(
|
|
|
537
533
|
}
|
|
538
534
|
): string[] {
|
|
539
535
|
const { agent } = decisions.packageManager.value;
|
|
540
|
-
const start = pmCommand(agent, "run", ["
|
|
536
|
+
const start = pmCommand(agent, "run", ["dex"]).join(" ");
|
|
541
537
|
// The studio's own commands run in its package, with the project's runner.
|
|
542
538
|
const inPackage = cdInto(placement);
|
|
543
539
|
const dex = dexRunner(agent).join(" ");
|
|
544
540
|
const where = placement ? " (from the workspace root)" : "";
|
|
545
541
|
// A draft has the facts; the person and their agent write the rest.
|
|
546
542
|
const drafted = result.designMd.kind === "draft" && result.designMd.written;
|
|
543
|
+
const connected = decisions.agents.value.length > 0;
|
|
547
544
|
const asks = [
|
|
548
545
|
...(drafted
|
|
549
546
|
? ['"Finish DESIGN.md with me." (it follows methods/design-md.md)']
|
|
@@ -564,7 +561,9 @@ function nextLines(
|
|
|
564
561
|
),
|
|
565
562
|
blockers.length > 0
|
|
566
563
|
? `Then start it: ${start}${where}`
|
|
567
|
-
: `Start
|
|
564
|
+
: `Start Dex: ${start}${where}`,
|
|
565
|
+
// No agent chosen: there is none to ask until one is connected.
|
|
566
|
+
...(connected ? [] : [`Connect your agent: ${connectInStudio()}`]),
|
|
568
567
|
...asks.map(
|
|
569
568
|
(ask, index) =>
|
|
570
569
|
`${index === 0 ? "Then ask your agent: " : " "}${ask}`
|
|
@@ -600,6 +599,41 @@ function cdInto(placement: Placement | undefined): string {
|
|
|
600
599
|
|
|
601
600
|
// --- Setting up -------------------------------------------------------------------
|
|
602
601
|
|
|
602
|
+
const PNPM_FIELD_RE = /^pnpm@(\d+)/;
|
|
603
|
+
/** The first version of pnpm to stop an install on an undecided build script. */
|
|
604
|
+
const PNPM_STRICT_BUILDS = 11;
|
|
605
|
+
|
|
606
|
+
/**
|
|
607
|
+
* Whether the project's pnpm stops an install on a build script nobody
|
|
608
|
+
* decided on: the version its packageManager field names, else the pnpm on
|
|
609
|
+
* PATH. Unknown, it is taken not to.
|
|
610
|
+
*/
|
|
611
|
+
function pnpmStopsOnBuilds(root: string): boolean {
|
|
612
|
+
let major: string | undefined;
|
|
613
|
+
try {
|
|
614
|
+
const manifest = JSON.parse(
|
|
615
|
+
readFileSync(join(root, "package.json"), "utf8")
|
|
616
|
+
) as { packageManager?: unknown };
|
|
617
|
+
major = PNPM_FIELD_RE.exec(String(manifest.packageManager ?? ""))?.[1];
|
|
618
|
+
} catch {
|
|
619
|
+
// No package.json to read: the pnpm on PATH says.
|
|
620
|
+
}
|
|
621
|
+
if (major === undefined) {
|
|
622
|
+
try {
|
|
623
|
+
major = execFileSync("pnpm", ["--version"], {
|
|
624
|
+
cwd: root,
|
|
625
|
+
encoding: "utf8",
|
|
626
|
+
env: { ...process.env, COREPACK_ENABLE_DOWNLOAD_PROMPT: "0" },
|
|
627
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
628
|
+
timeout: 10_000,
|
|
629
|
+
}).split(".")[0];
|
|
630
|
+
} catch {
|
|
631
|
+
return false;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
return Number(major) >= PNPM_STRICT_BUILDS;
|
|
635
|
+
}
|
|
636
|
+
|
|
603
637
|
/** Read what the plan needs to know is there, from `root`. */
|
|
604
638
|
async function onDisk(root: string, target: StudioTarget) {
|
|
605
639
|
const { studio } = target;
|
|
@@ -646,6 +680,9 @@ async function onDisk(root: string, target: StudioTarget) {
|
|
|
646
680
|
hostGitignore: existsSync(join(root, ".gitignore"))
|
|
647
681
|
? await read(".gitignore")
|
|
648
682
|
: undefined,
|
|
683
|
+
pnpmWorkspace: existsSync(join(root, "pnpm-workspace.yaml"))
|
|
684
|
+
? await read("pnpm-workspace.yaml")
|
|
685
|
+
: undefined,
|
|
649
686
|
tsconfig: existing.has(tsconfig) ? await read(tsconfig) : undefined,
|
|
650
687
|
read,
|
|
651
688
|
};
|
|
@@ -660,7 +697,6 @@ interface Prepared {
|
|
|
660
697
|
designSystem?: DesignSystemChoices;
|
|
661
698
|
existing?: ExistingStudio;
|
|
662
699
|
findings: ProjectFindings;
|
|
663
|
-
iconPackages: Record<string, string>;
|
|
664
700
|
/** In a workspace: where the studio goes, and what that adds. */
|
|
665
701
|
placement?: { decided: Decided<Placement>; target: StudioTarget };
|
|
666
702
|
/** Where the plan's paths start: the project, or the workspace root. */
|
|
@@ -756,16 +792,11 @@ function settled(
|
|
|
756
792
|
...(title ? { title } : {}),
|
|
757
793
|
...(where ? { placement: where } : {}),
|
|
758
794
|
});
|
|
759
|
-
const iconPackages = iconPackagesToAdd(
|
|
760
|
-
decisions.icons.value,
|
|
761
|
-
placement ? packageDirOf(placement) : root
|
|
762
|
-
);
|
|
763
795
|
return {
|
|
764
796
|
cwd,
|
|
765
797
|
root,
|
|
766
798
|
findings,
|
|
767
799
|
decisions,
|
|
768
|
-
iconPackages,
|
|
769
800
|
target,
|
|
770
801
|
...(where ? { placement: where } : {}),
|
|
771
802
|
...(workspace && placement
|
|
@@ -773,7 +804,6 @@ function settled(
|
|
|
773
804
|
workspace: workspaceSetup(workspace, placement, findings, decisions, {
|
|
774
805
|
flags,
|
|
775
806
|
cwd,
|
|
776
|
-
iconPackages,
|
|
777
807
|
}),
|
|
778
808
|
}
|
|
779
809
|
: {}),
|
|
@@ -1066,7 +1096,6 @@ async function planFor(
|
|
|
1066
1096
|
);
|
|
1067
1097
|
const again: SetUpAgain | undefined = existing && {
|
|
1068
1098
|
config: configChange(existing, prepared.designSystem, {
|
|
1069
|
-
icons: decisions.icons.value,
|
|
1070
1099
|
next: nextPackage(viewFolders) !== undefined,
|
|
1071
1100
|
root,
|
|
1072
1101
|
}),
|
|
@@ -1079,7 +1108,9 @@ async function planFor(
|
|
|
1079
1108
|
existing: disk.existing,
|
|
1080
1109
|
gitignore: disk.gitignore,
|
|
1081
1110
|
hostGitignore: disk.hostGitignore,
|
|
1082
|
-
|
|
1111
|
+
pnpmWorkspace: disk.pnpmWorkspace,
|
|
1112
|
+
pnpmStopsOnBuilds:
|
|
1113
|
+
decisions.packageManager.value.name === "pnpm" && pnpmStopsOnBuilds(root),
|
|
1083
1114
|
quiet: !ask,
|
|
1084
1115
|
rootGuide: findings.rootGuide
|
|
1085
1116
|
? { file: findings.rootGuide, text: await disk.read(findings.rootGuide) }
|
|
@@ -1518,7 +1549,8 @@ function readyLines(
|
|
|
1518
1549
|
}));
|
|
1519
1550
|
const width = Math.max(...commands.map(({ line }) => line.length)) + 4;
|
|
1520
1551
|
const lines = [
|
|
1521
|
-
|
|
1552
|
+
// Made in this folder: there is nowhere to go.
|
|
1553
|
+
...(where === "." ? [] : [`cd ${where}`]),
|
|
1522
1554
|
...commands.map(({ line, what }) => `${line.padEnd(width)}# ${what}`),
|
|
1523
1555
|
];
|
|
1524
1556
|
// No agent was chosen: there is none to ask until one is connected.
|
|
@@ -1572,7 +1604,7 @@ async function newProject(
|
|
|
1572
1604
|
const project: NewProject = {
|
|
1573
1605
|
agents,
|
|
1574
1606
|
dir: studioDir(flags.dir),
|
|
1575
|
-
install:
|
|
1607
|
+
install: installCommand(pm),
|
|
1576
1608
|
name,
|
|
1577
1609
|
pm,
|
|
1578
1610
|
starter,
|
package/src/setup/desktop-app.ts
CHANGED
|
@@ -71,7 +71,7 @@ export const STARTED_EXIT = 3;
|
|
|
71
71
|
const LSREGISTER =
|
|
72
72
|
"/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
|
|
73
73
|
const ICON = "Dex";
|
|
74
|
-
const ICON_SOURCE = join(APP_DIR, "public", "
|
|
74
|
+
const ICON_SOURCE = join(APP_DIR, "public", "dex-512.png");
|
|
75
75
|
/** The icons iconutil takes, by name, and their pixels, up to the source's. */
|
|
76
76
|
const ICON_FILES: [string, number][] = [
|
|
77
77
|
["icon_16x16", 16],
|
package/src/setup/detect.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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
|
|
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", ["
|
|
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
|
|
|
@@ -455,7 +502,6 @@ function shadcnLibrary(
|
|
|
455
502
|
importBase: config.import,
|
|
456
503
|
components: componentFiles(config.folder),
|
|
457
504
|
baseUi: config.baseUi,
|
|
458
|
-
...(config.icons ? { icons: config.icons } : {}),
|
|
459
505
|
globalCss: config.css ? relative(root, config.css) : undefined,
|
|
460
506
|
source: relative(root, config.file) || "components.json",
|
|
461
507
|
};
|
package/src/setup/doctor.ts
CHANGED
|
@@ -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
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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
|
-
|
|
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
|
-
|
|
502
|
-
|
|
503
|
-
|
|
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
|
}
|
package/src/setup/own-app.ts
CHANGED
|
@@ -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
|
|
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" : "
|
|
375
|
+
const script = own ? "dev" : "dex";
|
|
379
376
|
if (own && workspace.tool.value === "turbo") {
|
|
380
377
|
return `turbo run dev --filter=${target}`;
|
|
381
378
|
}
|