@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.
- package/CHANGELOG.md +53 -0
- package/README.md +21 -18
- package/app/canvas/activity.tsx +8 -15
- package/app/canvas/anchoring.ts +3 -5
- package/app/canvas/canvas-input.ts +151 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +5 -42
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +7 -3
- package/app/canvas/canvas-ui.ts +2 -1
- package/app/canvas/canvas.css +61 -26
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +204 -82
- package/app/canvas/element-picker.ts +200 -27
- package/app/canvas/engine/canvas-gestures.ts +72 -17
- package/app/canvas/engine/canvas-store.ts +17 -1
- package/app/canvas/engine/engine.css +6 -3
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +18 -2
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-node.tsx +43 -26
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +27 -0
- package/app/canvas/live-page.ts +142 -19
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/section-node.tsx +2 -0
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +16 -16
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +34 -40
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/xray.ts +3 -12
- package/app/frame.tsx +5 -0
- package/app/i18n/locales/en/messages.po +114 -12
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +114 -12
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/{sets/lucide.tsx → glyphs.tsx} +7 -5
- package/app/icons/index.tsx +3 -3
- package/app/icons/types.ts +3 -10
- package/app/index.html +3 -3
- package/app/main.tsx +3 -0
- package/app/pages/canvas-settings.tsx +35 -0
- package/app/pages/canvas.tsx +27 -8
- package/app/pages/commands-settings.tsx +16 -2
- package/app/shell/about.tsx +5 -4
- package/app/shell/feedback-details.ts +0 -3
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- 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/scaled-frame.tsx +21 -9
- 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/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +1 -1
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/dist/cli/banner.d.mts +4 -2
- package/dist/cli/banner.mjs +34 -11
- package/dist/cli/commands/app.mjs +19 -11
- 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/hook.mjs +2 -1
- 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 +6 -3
- package/dist/config/project-files.mjs +14 -5
- package/dist/config/renamed.d.mts +0 -2
- package/dist/config/renamed.mjs +1 -3
- package/dist/config/schema.d.mts +0 -5
- package/dist/config/schema.mjs +0 -5
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/content.d.mts +3 -141
- package/dist/content/content.mjs +7 -65
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/prototype-summary.d.mts +3 -39
- package/dist/content/prototype-summary.mjs +2 -3
- package/dist/content/prototypes.mjs +1 -1
- package/dist/content/snapshot-client.mjs +1 -1
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +309 -0
- package/dist/content/thread-module.mjs +1 -1
- package/dist/content/threads.mjs +1 -1
- package/dist/paths.d.mts +0 -2
- package/dist/paths.mjs +1 -3
- package/dist/server/agent-env.d.mts +5 -1
- package/dist/server/agent-env.mjs +7 -2
- package/dist/server/agent-session.d.mts +14 -1
- package/dist/server/agent-session.mjs +84 -19
- package/dist/server/brief.mjs +3 -3
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/channel.d.mts +19 -24
- package/dist/server/channel.mjs +70 -37
- package/dist/server/claimed-presence.d.mts +18 -0
- package/dist/server/claimed-presence.mjs +58 -0
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/comments/actions.d.mts +153 -0
- package/dist/server/comments/actions.mjs +154 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +88 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +36 -13
- package/dist/server/file-errors.d.mts +7 -2
- package/dist/server/file-errors.mjs +31 -8
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +7 -8
- package/dist/server/me.d.mts +1 -1
- package/dist/server/open-page.d.mts +22 -0
- package/dist/server/open-page.mjs +20 -2
- package/dist/server/outcome.d.mts +22 -0
- package/dist/server/outcome.mjs +8 -0
- package/dist/server/own-copies.mjs +2 -2
- package/dist/server/people.d.mts +1 -1
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +32 -47
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +18 -4
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.mjs +2 -2
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/reading.mjs +13 -4
- package/dist/server/tools/show.d.mts +1 -1
- package/dist/server/tools/snapshot.d.mts +1 -1
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.mjs +28 -31
- package/dist/server/web-app.mjs +7 -10
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.mjs +8 -14
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +118 -36
- package/dist/setup/design-system-checks.mjs +3 -12
- package/dist/setup/desktop-app-script.mjs +4 -3
- package/dist/setup/desktop-app-start.d.mts +8 -2
- package/dist/setup/desktop-app-start.mjs +64 -29
- package/dist/setup/desktop-app.d.mts +8 -0
- package/dist/setup/desktop-app.mjs +20 -4
- package/dist/setup/detect.d.mts +14 -7
- package/dist/setup/detect.mjs +56 -10
- package/dist/setup/doctor.mjs +2 -4
- package/dist/setup/existing-setup.d.mts +1 -3
- package/dist/setup/existing-setup.mjs +10 -11
- package/dist/setup/migrate/row-titles.mjs +1 -1
- 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 +6 -17
- package/dist/setup/project.mjs +17 -61
- 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.d.mts +2 -0
- package/dist/setup/starters.mjs +26 -9
- 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/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.mjs +1 -1
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +53 -0
- package/dist/shared/comments/routes.mjs +37 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/presence-core.d.mts +11 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +7 -1
- package/dist/shared/signup.d.mts +2 -5
- package/dist/shared/signup.mjs +2 -35
- package/dist/shared/studio-events.d.mts +0 -6
- package/dist/shared/studio-events.mjs +1 -5
- package/dist/shared/studio-files.d.mts +12 -0
- package/dist/shared/studio-files.mjs +6 -1
- package/dist/shared/studio-routes.d.mts +16 -62
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +2 -2
- package/dist/shared/threads-core.mjs +1 -1
- package/extension/dist/feedback.js +148 -138
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +146 -136
- package/package.json +3 -20
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +17 -9
- package/src/cli/commands/dev.ts +0 -3
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/help.ts +3 -3
- package/src/config/index.ts +6 -5
- package/src/config/project-files.ts +21 -11
- package/src/config/renamed.ts +0 -3
- package/src/config/schema.ts +0 -1
- package/src/content/capture.ts +6 -12
- package/src/content/content.ts +7 -244
- package/src/content/flow-specs.ts +2 -1
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/snapshot-client.ts +1 -1
- package/src/content/text-replace.ts +449 -0
- package/src/paths.ts +0 -8
- package/src/server/agent-env.ts +12 -2
- package/src/server/agent-session.ts +124 -34
- package/src/server/brief.ts +8 -3
- package/src/server/channel.ts +121 -52
- package/src/server/claimed-presence.ts +93 -0
- package/src/server/comments/actions.ts +352 -0
- package/src/server/comments/routes.ts +176 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +49 -15
- package/src/server/file-errors.ts +47 -13
- package/src/server/file-lock.ts +205 -54
- package/src/server/mcp.ts +13 -14
- package/src/server/me.ts +2 -5
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +2 -1
- package/src/server/port.ts +94 -20
- package/src/server/presence.ts +11 -3
- package/src/server/requests.ts +60 -70
- package/src/server/studio-for.ts +27 -3
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/watch.ts +7 -7
- package/src/server/vite.ts +37 -40
- package/src/server/web-app.ts +14 -12
- package/src/setup/apply.ts +10 -16
- package/src/setup/create.ts +143 -37
- package/src/setup/design-system-checks.ts +7 -15
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +24 -3
- package/src/setup/detect.ts +56 -14
- 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 +25 -118
- package/src/setup/prompts.ts +44 -127
- package/src/setup/questions.ts +27 -29
- package/src/setup/starters.ts +35 -10
- package/src/setup/workspace-setup.ts +8 -18
- package/src/setup/write.ts +52 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +79 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/page-review.ts +11 -16
- package/src/shared/presence-core.ts +16 -2
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +11 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +14 -0
- package/src/shared/studio-routes.ts +21 -64
- package/src/shared/threads-core.ts +2 -2
- 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/server/tools/close-reply.d.mts +0 -6
- package/dist/server/tools/close-reply.mjs +0 -138
- package/dist/server/tools/comment.d.mts +0 -6
- package/dist/server/tools/comment.mjs +0 -49
- 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/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
- 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/desktop-app.ts
CHANGED
|
@@ -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 {
|
|
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", "
|
|
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
|
-
|
|
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
|
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
|
|
|
@@ -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
|
};
|
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
|
}
|