@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
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { posix as posix$1 } from "../paths.mjs";
|
|
2
|
-
import { componentsJsonError, projectPaths } from "../config/project-files.mjs";
|
|
2
|
+
import { componentsJsonError, installedPackageDir, projectPaths } from "../config/project-files.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
5
5
|
import { dirname, isAbsolute, join, relative } from "node:path";
|
|
@@ -43,15 +43,6 @@ const localTo = (root) => {
|
|
|
43
43
|
const aliases = projectPaths(root).map(([pattern]) => pattern.replace(WILDCARD_RE, ""));
|
|
44
44
|
return (name) => name.startsWith(".") || name.startsWith("@/") || aliases.some((alias) => name === alias || name.startsWith(`${alias}/`));
|
|
45
45
|
};
|
|
46
|
-
/** Where an installed package lives, looking up from `from`. */
|
|
47
|
-
const packageDir = (from, name) => {
|
|
48
|
-
let dir = from;
|
|
49
|
-
while (dir !== dirname(dir)) {
|
|
50
|
-
const candidate = join(dir, "node_modules", name);
|
|
51
|
-
if (existsSync(join(candidate, "package.json"))) return candidate;
|
|
52
|
-
dir = dirname(dir);
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
46
|
const VITE_CONDITIONS = /* @__PURE__ */ new Set([
|
|
56
47
|
"browser",
|
|
57
48
|
"import",
|
|
@@ -109,7 +100,7 @@ function unbuiltPackages(project) {
|
|
|
109
100
|
if (!project.designSystem) return [];
|
|
110
101
|
const isLocal = localTo(project.root);
|
|
111
102
|
return importedPackages(project.designSystem).filter((name) => !isLocal(name)).flatMap((name) => {
|
|
112
|
-
const dir =
|
|
103
|
+
const dir = installedPackageDir(project.content, name);
|
|
113
104
|
const missing = dir ? missingExports(dir) : [];
|
|
114
105
|
return missing.length > 0 ? [{
|
|
115
106
|
name,
|
|
@@ -121,7 +112,7 @@ function checkImports({ content, root, designSystem }, { ok, warn }) {
|
|
|
121
112
|
const isLocal = localTo(root);
|
|
122
113
|
if (designSystem.imports.length === 0) warn("The design system lists no imports", "Fill in `designSystem.imports` in dex.config.ts so the audit can tell your components apart.");
|
|
123
114
|
for (const name of importedPackages(designSystem)) {
|
|
124
|
-
const dir = isLocal(name) ? void 0 :
|
|
115
|
+
const dir = isLocal(name) ? void 0 : installedPackageDir(content, name);
|
|
125
116
|
const resolves = isLocal(name) || canResolve(content, `${name}/package.json`) || canResolve(content, name) || dir !== void 0;
|
|
126
117
|
const missing = dir ? missingExports(dir) : [];
|
|
127
118
|
if (resolves && missing.length > 0) warn(`${name} is not built: ${missing.slice(0, 3).join(", ")} ${missing.length === 1 ? "is" : "are"} missing`, `Build it before starting the studio (in a monorepo, \`npx turbo run build --filter=${name}\`), or views cannot import it.`);
|
|
@@ -162,9 +162,10 @@ function startOutput() {
|
|
|
162
162
|
ObjC.bindFunction("kill", ["int", ["int", "int"]]);
|
|
163
163
|
|
|
164
164
|
/**
|
|
165
|
-
* Whether the server the launcher started last still runs. The
|
|
166
|
-
*
|
|
167
|
-
*
|
|
165
|
+
* Whether the server the launcher started last still runs. The pid file
|
|
166
|
+
* names the start the window waits on; the launcher clears it when it
|
|
167
|
+
* gives up, and dex app start when the port is taken, so without one,
|
|
168
|
+
* nothing is starting.
|
|
168
169
|
*/
|
|
169
170
|
function startAlive() {
|
|
170
171
|
const pid = Number(readText(DEX.pidFile).trim());
|
|
@@ -18,10 +18,14 @@ export type AppStart =
|
|
|
18
18
|
state: "gone";
|
|
19
19
|
message: string;
|
|
20
20
|
} |
|
|
21
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Something other than this project's Dex holds the port. `ownUrl` is
|
|
23
|
+
* where this project's Dex answers instead, when it runs on another port.
|
|
24
|
+
*/
|
|
22
25
|
{
|
|
23
26
|
state: "taken";
|
|
24
27
|
taken: PortTaken;
|
|
28
|
+
ownUrl?: string;
|
|
25
29
|
};
|
|
26
30
|
export interface AppStartOptions {
|
|
27
31
|
/** The `dex` to run `dev` with. */
|
|
@@ -53,7 +57,9 @@ export declare function loginShellPath(env: NodeJS.ProcessEnv): Promise<string |
|
|
|
53
57
|
export declare const launchPath: (runtime: string, login: string | undefined) => string;
|
|
54
58
|
/**
|
|
55
59
|
* Show this project's Dex, or start it: never a server another project,
|
|
56
|
-
* or anything else, put on the port.
|
|
60
|
+
* or anything else, put on the port. The app's start link asks again as
|
|
61
|
+
* the app opens: then the `dex dev` it started is still coming up, and
|
|
62
|
+
* it waits on that one rather than start another.
|
|
57
63
|
*/
|
|
58
64
|
export declare function startForApp(options: AppStartOptions): Promise<AppStart>;
|
|
59
65
|
//#endregion
|
|
@@ -1,36 +1,21 @@
|
|
|
1
|
-
import { lsofHolder, whatHolds } from "../server/port.mjs";
|
|
1
|
+
import { heldOnLocalhost, lsofHolder, whatHolds } from "../server/port.mjs";
|
|
2
|
+
import { GIVE_UP_AFTER_MS } from "../shared/server-page.mjs";
|
|
2
3
|
import { FROM_APP_ENV } from "../server/roster.mjs";
|
|
4
|
+
import { ownPort, studioFor } from "../server/studio-for.mjs";
|
|
3
5
|
import { logFile, pidFile, projectGone } from "./desktop-app.mjs";
|
|
4
6
|
import { existsSync } from "node:fs";
|
|
5
7
|
import { dirname } from "node:path";
|
|
6
8
|
import { promisify } from "node:util";
|
|
7
9
|
import { execFile, spawn } from "node:child_process";
|
|
8
|
-
import { mkdir, open, rm, writeFile } from "node:fs/promises";
|
|
9
|
-
import { connect } from "node:net";
|
|
10
|
+
import { mkdir, open, readFile, rm, stat, writeFile } from "node:fs/promises";
|
|
10
11
|
//#region src/setup/desktop-app-start.ts
|
|
11
12
|
const run = promisify(execFile);
|
|
12
13
|
/** Where Node, git and the rest usually are on a Mac, when the shell can't say. */
|
|
13
14
|
const DEFAULT_PATH = "/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin";
|
|
14
15
|
/** How long the login shell may take to say its PATH. */
|
|
15
16
|
const SHELL_TIMEOUT_MS = 5e3;
|
|
16
|
-
/** How long the port may take to answer a connection. */
|
|
17
|
-
const CONNECT_TIMEOUT_MS = 1e3;
|
|
18
17
|
/** Comes before the PATH in the shell's output, past whatever its startup prints. */
|
|
19
18
|
const PATH_MARK = "__DEX_PATH__";
|
|
20
|
-
/** Whether anything accepts a connection on the port, on localhost. */
|
|
21
|
-
const listening = (port) => new Promise((answer) => {
|
|
22
|
-
const socket = connect({
|
|
23
|
-
port,
|
|
24
|
-
host: "localhost"
|
|
25
|
-
});
|
|
26
|
-
const done = (open) => {
|
|
27
|
-
socket.destroy();
|
|
28
|
-
answer(open);
|
|
29
|
-
};
|
|
30
|
-
socket.setTimeout(CONNECT_TIMEOUT_MS, () => done(false));
|
|
31
|
-
socket.once("connect", () => done(true));
|
|
32
|
-
socket.once("error", () => done(false));
|
|
33
|
-
});
|
|
34
19
|
/**
|
|
35
20
|
* The PATH the person's own shell sets up at login, as a terminal has it:
|
|
36
21
|
* the app is opened with only the system's, and `dex dev` runs git,
|
|
@@ -88,26 +73,76 @@ async function startDev(options) {
|
|
|
88
73
|
}
|
|
89
74
|
}
|
|
90
75
|
/**
|
|
76
|
+
* The `dex dev` the last start began, while it may still come up: alive,
|
|
77
|
+
* and started less than the minute the app's window waits for it. Past
|
|
78
|
+
* that, its pid may be another process's.
|
|
79
|
+
*/
|
|
80
|
+
async function startUnderWay(file) {
|
|
81
|
+
try {
|
|
82
|
+
const [text, { mtimeMs }] = await Promise.all([readFile(file, "utf8"), stat(file)]);
|
|
83
|
+
const pid = Number(text.trim());
|
|
84
|
+
const young = Date.now() - mtimeMs <= GIVE_UP_AFTER_MS;
|
|
85
|
+
if (!(Number.isInteger(pid) && pid > 0 && young)) return;
|
|
86
|
+
process.kill(pid, 0);
|
|
87
|
+
return pid;
|
|
88
|
+
} catch {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* The port this project's Dex is on, as its roster says, or undefined.
|
|
94
|
+
* On the app's port, it was only slow to answer, and the app opens it. On
|
|
95
|
+
* another port, the app can't open it, so it says where it is.
|
|
96
|
+
*/
|
|
97
|
+
async function ownDexPort(root, port, holderOf) {
|
|
98
|
+
try {
|
|
99
|
+
const { loadProject } = await import("../config/load.mjs");
|
|
100
|
+
const { content } = await loadProject(root);
|
|
101
|
+
return ownPort(await studioFor({
|
|
102
|
+
content,
|
|
103
|
+
root,
|
|
104
|
+
port
|
|
105
|
+
}, { holderOf }));
|
|
106
|
+
} catch {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
91
111
|
* Show this project's Dex, or start it: never a server another project,
|
|
92
|
-
* or anything else, put on the port.
|
|
112
|
+
* or anything else, put on the port. The app's start link asks again as
|
|
113
|
+
* the app opens: then the `dex dev` it started is still coming up, and
|
|
114
|
+
* it waits on that one rather than start another.
|
|
93
115
|
*/
|
|
94
116
|
async function startForApp(options) {
|
|
95
117
|
const { home, project, root, port, holderOf = lsofHolder } = options;
|
|
96
|
-
|
|
97
|
-
if (!existsSync(root))
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
118
|
+
const pidPath = pidFile(home, project);
|
|
119
|
+
if (!existsSync(root)) {
|
|
120
|
+
await rm(pidPath, { force: true });
|
|
121
|
+
return {
|
|
122
|
+
state: "gone",
|
|
123
|
+
message: projectGone(root, home)
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
if (await heldOnLocalhost(port)) {
|
|
102
127
|
const taken = await whatHolds(port, project, holderOf);
|
|
103
|
-
|
|
128
|
+
if (taken.sameProject) return { state: "running" };
|
|
129
|
+
const underWay = taken.by === "Dex" ? void 0 : await startUnderWay(pidPath);
|
|
130
|
+
if (underWay) return {
|
|
131
|
+
state: "started",
|
|
132
|
+
pid: underWay
|
|
133
|
+
};
|
|
134
|
+
const own = await ownDexPort(root, port, holderOf);
|
|
135
|
+
if (own === port) return { state: "running" };
|
|
136
|
+
await rm(pidPath, { force: true });
|
|
137
|
+
return {
|
|
104
138
|
state: "taken",
|
|
105
|
-
taken
|
|
139
|
+
taken,
|
|
140
|
+
...own === void 0 ? {} : { ownUrl: `http://localhost:${own}` }
|
|
106
141
|
};
|
|
107
142
|
}
|
|
108
143
|
return {
|
|
109
144
|
state: "started",
|
|
110
|
-
pid: await startDev(options)
|
|
145
|
+
pid: await startUnderWay(pidPath) ?? await startDev(options)
|
|
111
146
|
};
|
|
112
147
|
}
|
|
113
148
|
//#endregion
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ViteDevServer } from "vite";
|
|
1
2
|
//#region src/setup/desktop-app.d.ts
|
|
2
3
|
/**
|
|
3
4
|
* The launcher's answer when `dex app start` started `dex dev`; 0 is
|
|
@@ -72,6 +73,11 @@ export declare const urlScheme: (root: string) => string;
|
|
|
72
73
|
export declare function desktopApp(project: DesktopProject, running?: {
|
|
73
74
|
execPath: string;
|
|
74
75
|
}): DesktopApp;
|
|
76
|
+
/**
|
|
77
|
+
* The app a `dex dev` server makes: for the port and base it is served
|
|
78
|
+
* at, so the app opens that server, also when it moved off a taken port.
|
|
79
|
+
*/
|
|
80
|
+
export declare const servedApp: (root: string, server: ViteDevServer) => DesktopApp;
|
|
75
81
|
/** Where the app goes: `~/Applications/Dex.app`. */
|
|
76
82
|
export declare const bundlePath: (home: string) => string;
|
|
77
83
|
/**
|
|
@@ -109,6 +115,8 @@ export declare const projectGone: (root: string, home: string) => string;
|
|
|
109
115
|
* start`, whose output goes in the log after the mark and whose answer is
|
|
110
116
|
* the launcher's. All it does itself is what `dex` cannot: say the
|
|
111
117
|
* project is gone (and the `dex` installed in it with it), and find Node.
|
|
118
|
+
* It keeps the pid file of a start still coming up, which `dex app start`
|
|
119
|
+
* waits on, and clears it when it gives up.
|
|
112
120
|
* The Node (or Bun) the app was made with may be gone since (a version
|
|
113
121
|
* manager's, an upgrade): one on the PATH will do then, or the one the
|
|
114
122
|
* person's own shell finds, as nvm and fnm set theirs up there. With none
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { APP_DIR, PACKAGE_ROOT, installedBin, studioVersion } from "../paths.mjs";
|
|
2
2
|
import { projectId } from "../server/project-id.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { servedPort } from "../server/port.mjs";
|
|
4
|
+
import { GIVE_UP_AFTER_MS, STATE_SLOT, serverPage, shownPath } from "../shared/server-page.mjs";
|
|
4
5
|
import "../shared/product.mjs";
|
|
5
6
|
import { appScript } from "./desktop-app-script.mjs";
|
|
6
7
|
import { basename, dirname, join } from "node:path";
|
|
@@ -36,7 +37,7 @@ const APPLET_ICONS = ["applet.icns", "Assets.car"];
|
|
|
36
37
|
const STARTED_EXIT = 3;
|
|
37
38
|
const LSREGISTER = "/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister";
|
|
38
39
|
const ICON = "Dex";
|
|
39
|
-
const ICON_SOURCE = join(APP_DIR, "public", "
|
|
40
|
+
const ICON_SOURCE = join(APP_DIR, "public", "dex-512.png");
|
|
40
41
|
/** The icons iconutil takes, by name, and their pixels, up to the source's. */
|
|
41
42
|
const ICON_FILES = [
|
|
42
43
|
["icon_16x16", 16],
|
|
@@ -103,6 +104,15 @@ function desktopApp(project, running = process) {
|
|
|
103
104
|
version: studioVersion()
|
|
104
105
|
};
|
|
105
106
|
}
|
|
107
|
+
/**
|
|
108
|
+
* The app a `dex dev` server makes: for the port and base it is served
|
|
109
|
+
* at, so the app opens that server, also when it moved off a taken port.
|
|
110
|
+
*/
|
|
111
|
+
const servedApp = (root, server) => desktopApp({
|
|
112
|
+
root,
|
|
113
|
+
port: servedPort(server),
|
|
114
|
+
base: server.config.base
|
|
115
|
+
});
|
|
106
116
|
/** Where apps go: `~/Applications`, the person's own. */
|
|
107
117
|
const applications = (home) => join(home, "Applications");
|
|
108
118
|
/** Where the app goes: `~/Applications/Dex.app`. */
|
|
@@ -191,6 +201,7 @@ ${[
|
|
|
191
201
|
const shellWord = (text) => `'${text.replace(CONTROL_RE, "").replaceAll("'", `'\\''`)}'`;
|
|
192
202
|
/** Where the app keeps `dex dev`'s output, by the project's id. */
|
|
193
203
|
const logFile = (home, project) => join(home, "Library", "Logs", "Dex", `${project}.log`);
|
|
204
|
+
const MS_PER_MINUTE = 6e4;
|
|
194
205
|
/** Where the launcher looks for Node besides the PATH it is opened with. */
|
|
195
206
|
const RUNTIME_PLACES = "/opt/homebrew/bin:/usr/local/bin";
|
|
196
207
|
/** Where `dex app start` keeps the process id of the server it started. */
|
|
@@ -209,6 +220,8 @@ const portLine = (app) => `PORT=${shellWord(String(app.port))}`;
|
|
|
209
220
|
* start`, whose output goes in the log after the mark and whose answer is
|
|
210
221
|
* the launcher's. All it does itself is what `dex` cannot: say the
|
|
211
222
|
* project is gone (and the `dex` installed in it with it), and find Node.
|
|
223
|
+
* It keeps the pid file of a start still coming up, which `dex app start`
|
|
224
|
+
* waits on, and clears it when it gives up.
|
|
212
225
|
* The Node (or Bun) the app was made with may be gone since (a version
|
|
213
226
|
* manager's, an upgrade): one on the PATH will do then, or the one the
|
|
214
227
|
* person's own shell finds, as nvm and fnm set theirs up there. With none
|
|
@@ -225,8 +238,10 @@ PID_FILE=${shellWord(pidFile(home, app.project))}
|
|
|
225
238
|
|
|
226
239
|
/bin/mkdir -p "$(/usr/bin/dirname "$LOG")"
|
|
227
240
|
echo ${shellWord(LOG_MARK)} "$(/bin/date -u +%Y-%m-%dT%H:%M:%SZ)" >>"$LOG"
|
|
228
|
-
|
|
241
|
+
# A start older than the window waits for is over; its pid may be reused.
|
|
242
|
+
/usr/bin/find "$PID_FILE" -mmin +${Math.ceil(GIVE_UP_AFTER_MS / MS_PER_MINUTE)} -delete 2>/dev/null
|
|
229
243
|
if [ ! -d "$ROOT" ]; then
|
|
244
|
+
/bin/rm -f "$PID_FILE"
|
|
230
245
|
echo ${shellWord(projectGone(app.root, home))} >>"$LOG"
|
|
231
246
|
exit 1
|
|
232
247
|
fi
|
|
@@ -236,6 +251,7 @@ if [ ! -x "$RUNTIME" ]; then
|
|
|
236
251
|
RUNTIME=$(PATH="$PATH:${RUNTIME_PLACES}" command -v "$NAME") ||
|
|
237
252
|
RUNTIME=$("\${SHELL:-/bin/zsh}" -ilc "command -v $NAME" 2>/dev/null | /usr/bin/tail -n 1)
|
|
238
253
|
if [ ! -x "$RUNTIME" ]; then
|
|
254
|
+
/bin/rm -f "$PID_FILE"
|
|
239
255
|
echo "Dex needs $NAME to start, and $GONE is gone. Install $NAME, then open Dex again." >>"$LOG"
|
|
240
256
|
exit 1
|
|
241
257
|
fi
|
|
@@ -532,4 +548,4 @@ const openApp = async (path) => {
|
|
|
532
548
|
await run("/usr/bin/open", [path]);
|
|
533
549
|
};
|
|
534
550
|
//#endregion
|
|
535
|
-
export { APP_NAME, LOG_MARK, RUNTIME_PLACES, STARTED_EXIT, appSource, bundlePath, desktopApp, desktopAppState, desktopAppUnavailable, infoPlist, installDesktopApp, isConfined, isDexBundle, launcherScript, legacyBundlePath, logFile, macLaunchServices, openApp, pidFile, programStamp, projectGone, refreshDesktopApp, removeDesktopApp, revealInFinder, urlScheme };
|
|
551
|
+
export { APP_NAME, LOG_MARK, RUNTIME_PLACES, STARTED_EXIT, appSource, bundlePath, desktopApp, desktopAppState, desktopAppUnavailable, infoPlist, installDesktopApp, isConfined, isDexBundle, launcherScript, legacyBundlePath, logFile, macLaunchServices, openApp, pidFile, programStamp, projectGone, refreshDesktopApp, removeDesktopApp, revealInFinder, servedApp, urlScheme };
|
package/dist/setup/detect.d.mts
CHANGED
|
@@ -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
|
-
/**
|
|
52
|
-
|
|
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
|
}[];
|
|
@@ -58,8 +67,6 @@ export declare function detectAgentsWithEvidence(root: string): {
|
|
|
58
67
|
* (its launch) is on PATH.
|
|
59
68
|
*/
|
|
60
69
|
export declare function installedAgents(): AgentId[];
|
|
61
|
-
/** Which coding agents the project already uses. */
|
|
62
|
-
export declare const detectAgents: (root: string) => AgentId[];
|
|
63
70
|
/** A folder named with `--components`: as it is, whatever is in it. */
|
|
64
71
|
export declare function libraryAt(root: string, components: string): ComponentLibrary;
|
|
65
72
|
/**
|
package/dist/setup/detect.mjs
CHANGED
|
@@ -211,22 +211,71 @@ function detectDesignSystem(root, { components } = {}) {
|
|
|
211
211
|
...library ? { library } : {}
|
|
212
212
|
};
|
|
213
213
|
}
|
|
214
|
-
/**
|
|
215
|
-
|
|
216
|
-
|
|
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", [
|
|
269
|
+
add("claude", [
|
|
270
|
+
".claude",
|
|
271
|
+
"CLAUDE.md",
|
|
272
|
+
".mcp.json"
|
|
273
|
+
]);
|
|
226
274
|
add("cursor", [".cursor"]);
|
|
227
|
-
add("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) => {
|
|
@@ -251,8 +300,6 @@ function installedAgents() {
|
|
|
251
300
|
return id !== "other" && cli !== void 0 && onPath(cli);
|
|
252
301
|
});
|
|
253
302
|
}
|
|
254
|
-
/** Which coding agents the project already uses. */
|
|
255
|
-
const detectAgents = (root) => detectAgentsWithEvidence(root).map(({ id }) => id);
|
|
256
303
|
const MIN_COMPONENTS = 3;
|
|
257
304
|
const COMMON_FOLDERS = [
|
|
258
305
|
"components/ui",
|
|
@@ -281,7 +328,6 @@ function shadcnLibrary(dir, root) {
|
|
|
281
328
|
importBase: config.import,
|
|
282
329
|
components: componentFiles(config.folder),
|
|
283
330
|
baseUi: config.baseUi,
|
|
284
|
-
...config.icons ? { icons: config.icons } : {},
|
|
285
331
|
globalCss: config.css ? relative(root, config.css) : void 0,
|
|
286
332
|
source: relative(root, config.file) || "components.json"
|
|
287
333
|
};
|
|
@@ -343,4 +389,4 @@ function findComponentLibrary(root, { components } = {}) {
|
|
|
343
389
|
return componentLibraries(root)[0];
|
|
344
390
|
}
|
|
345
391
|
//#endregion
|
|
346
|
-
export { builtGlobalCss, componentLibraries,
|
|
392
|
+
export { builtGlobalCss, componentLibraries, detectAgentsWithEvidence, detectDesignSystem, findComponentLibrary, findGlobalCss, globalCssFiles, installedAgents, isMixedFolder, libraryAt, runningAgent };
|
package/dist/setup/doctor.mjs
CHANGED
|
@@ -5,6 +5,7 @@ import { outputOf } from "../server/quiet-run.mjs";
|
|
|
5
5
|
import { checkForUpdate, updateCheckProblem } from "../server/updates.mjs";
|
|
6
6
|
import { canImport } from "../config/project-files.mjs";
|
|
7
7
|
import { dexRunner, packageManager, withRunner } from "../config/package-manager.mjs";
|
|
8
|
+
import { checkDesignSystem } from "./design-system-checks.mjs";
|
|
8
9
|
import { check, identify } from "../content/content.mjs";
|
|
9
10
|
import { AGENTS, agentRootOf, agentSetups, claudeHookCommands, studioCommand } from "../server/agents.mjs";
|
|
10
11
|
import { CREATE_COMMAND, connectInStudio } from "./project.mjs";
|
|
@@ -12,8 +13,6 @@ import { findConfigFile, loadProject } from "../config/load.mjs";
|
|
|
12
13
|
import { INSTALL_BROWSER, browserInstalled } from "../content/screenshot.mjs";
|
|
13
14
|
import { lacksNext } from "../server/next.mjs";
|
|
14
15
|
import { readGitSettings } from "../server/git-settings.mjs";
|
|
15
|
-
import { missingIconSet } from "../server/icon-set.mjs";
|
|
16
|
-
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";
|
|
19
18
|
import { createRequire } from "node:module";
|
|
@@ -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
|
-
|
|
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, {
|
|
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
|
|
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, {
|
|
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, {
|
|
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
|
|
272
|
-
edits.
|
|
273
|
-
changes.push(
|
|
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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { foldRowTitles } from "../../shared/canvas-core.mjs";
|
|
1
2
|
import { UPGRADE_COMMAND } from "./migration.mjs";
|
|
2
3
|
import { walkPrototypes } from "../../content/prototypes.mjs";
|
|
3
|
-
import { foldRowTitles } from "../../shared/canvas-core.mjs";
|
|
4
4
|
import { canvasParts } from "../../content/content.mjs";
|
|
5
5
|
import { relative, sep } from "node:path";
|
|
6
6
|
import { readFile, writeFile } from "node:fs/promises";
|
package/dist/setup/own-app.d.mts
CHANGED
|
@@ -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,
|
|
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. */
|
package/dist/setup/own-app.mjs
CHANGED
|
@@ -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
|
|
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,
|
|
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" : "
|
|
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}`;
|