@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/plan.ts
CHANGED
|
@@ -9,21 +9,27 @@ import type { Agent } from "package-manager-detector";
|
|
|
9
9
|
import { pmCommand } from "../config/package-manager.ts";
|
|
10
10
|
import { parseJsonc } from "../config/project-files.ts";
|
|
11
11
|
import { PACKAGE_NAME } from "../paths.ts";
|
|
12
|
-
import { ICON_SET_NAMES } from "../shared/icon-sets.ts";
|
|
13
12
|
import { listing } from "../shared/listing.ts";
|
|
14
13
|
import { STUDIO_FILES } from "../shared/studio-files.ts";
|
|
15
14
|
import { designMdDetail, fromProject } from "./design-md-setup.ts";
|
|
16
15
|
import type { AgentId } from "./detect.ts";
|
|
17
16
|
import type { OwnAppFacts } from "./own-app.ts";
|
|
18
17
|
import { agentName, type StudioPackage } from "./project.ts";
|
|
19
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
PROVIDER_FILE,
|
|
20
|
+
type SetupDecisions,
|
|
21
|
+
type ShadcnInit,
|
|
22
|
+
shadcnInitFlags,
|
|
23
|
+
} from "./questions.ts";
|
|
20
24
|
import {
|
|
21
25
|
hasPointer,
|
|
22
26
|
ignoreFile,
|
|
23
27
|
missingIgnoreLines,
|
|
24
28
|
missingScripts,
|
|
25
29
|
OLD_SCRIPTS,
|
|
30
|
+
pnpmDecidesEsbuild,
|
|
26
31
|
STUDIO_TYPES_FILE,
|
|
32
|
+
withEsbuildBuilds,
|
|
27
33
|
} from "./write.ts";
|
|
28
34
|
|
|
29
35
|
/** A file or folder setup writes, by what it is. */
|
|
@@ -39,7 +45,8 @@ export type WriteKind =
|
|
|
39
45
|
| "agent"
|
|
40
46
|
| "app-package"
|
|
41
47
|
| "turbo"
|
|
42
|
-
| "root-script"
|
|
48
|
+
| "root-script"
|
|
49
|
+
| "pnpm-builds";
|
|
43
50
|
|
|
44
51
|
/** A command setup runs, by what it is for. */
|
|
45
52
|
export type RunKind = "shadcn" | "install" | "link";
|
|
@@ -104,15 +111,13 @@ export interface WorkspaceSetup {
|
|
|
104
111
|
install: string[];
|
|
105
112
|
/** The workspace root's package.json scripts. */
|
|
106
113
|
rootScripts: Record<string, string>;
|
|
107
|
-
/** The root's "
|
|
114
|
+
/** The root's "dex" script: "turbo run dev --filter=@acme/studio". */
|
|
108
115
|
studioScript: string;
|
|
109
116
|
/** How package.json asks for the studio: "^0.3.0", "file:..."; undefined when listed. */
|
|
110
117
|
studioSpec: string | undefined;
|
|
111
118
|
}
|
|
112
119
|
|
|
113
120
|
export interface SetupPlan {
|
|
114
|
-
/** The icon set's packages the studio's package gets: in a workspace, in its package.json. */
|
|
115
|
-
iconPackages: Record<string, string>;
|
|
116
121
|
steps: PlanStep[];
|
|
117
122
|
/** The studio's folder, relative to where the plan starts: "studio". */
|
|
118
123
|
studio: string;
|
|
@@ -153,8 +158,10 @@ export interface PlanInput {
|
|
|
153
158
|
gitignore: string;
|
|
154
159
|
/** The .gitignore where the plan starts. */
|
|
155
160
|
hostGitignore: string | undefined;
|
|
156
|
-
/**
|
|
157
|
-
|
|
161
|
+
/** pnpm 11 or later: it stops an install on a build script nobody decided on. */
|
|
162
|
+
pnpmStopsOnBuilds?: boolean;
|
|
163
|
+
/** pnpm-workspace.yaml where the plan starts, when it has one. */
|
|
164
|
+
pnpmWorkspace?: string;
|
|
158
165
|
/** Where setup looked, absolute: the files decisions name are shown from it. */
|
|
159
166
|
projectRoot?: string;
|
|
160
167
|
/** Ask nothing: no terminal, or --yes. */
|
|
@@ -203,34 +210,20 @@ const AGENT_DETAIL: Record<string, string> = {
|
|
|
203
210
|
/** A command as one line: "bun add -D @dexhq/canvas". */
|
|
204
211
|
export const commandLine = (command: string[]): string => command.join(" ");
|
|
205
212
|
|
|
213
|
+
/**
|
|
214
|
+
* npm's audit and funding notes are about the project's whole tree, not the
|
|
215
|
+
* studio: setup leaves them out of its installs, as shadcn does.
|
|
216
|
+
*/
|
|
217
|
+
const quietly = (agent: Agent, command: string[]): string[] =>
|
|
218
|
+
agent === "npm" ? [...command, "--no-audit", "--no-fund"] : command;
|
|
219
|
+
|
|
206
220
|
/** `<manager> add -D <specs>`, as the project's package manager writes it. */
|
|
207
221
|
export const addCommand = (agent: Agent, ...specs: string[]): string[] =>
|
|
208
|
-
pmCommand(agent, "add", ["-D", ...specs]);
|
|
209
|
-
|
|
210
|
-
/** As an install names them: "@phosphor-icons/react@^2.1.10". */
|
|
211
|
-
const specsOf = (packages: Record<string, string>): string[] =>
|
|
212
|
-
Object.entries(packages).map(([name, range]) => `${name}@${range}`);
|
|
222
|
+
quietly(agent, pmCommand(agent, "add", ["-D", ...specs]));
|
|
213
223
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
: detail;
|
|
218
|
-
|
|
219
|
-
/** The icon set's packages on their own, for a project that has the studio. */
|
|
220
|
-
function iconSteps(input: PlanInput): PlanStep[] {
|
|
221
|
-
const icons = specsOf(input.iconPackages);
|
|
222
|
-
if (icons.length === 0) {
|
|
223
|
-
return [];
|
|
224
|
-
}
|
|
225
|
-
return [
|
|
226
|
-
{
|
|
227
|
-
action: "run",
|
|
228
|
-
run: "install",
|
|
229
|
-
command: addCommand(input.decisions.packageManager.value.agent, ...icons),
|
|
230
|
-
detail: `${ICON_SET_NAMES[input.decisions.icons.value]}, the icon set`,
|
|
231
|
-
},
|
|
232
|
-
];
|
|
233
|
-
}
|
|
224
|
+
/** `<manager> install`, as the project's package manager writes it. */
|
|
225
|
+
export const installCommand = (agent: Agent): string[] =>
|
|
226
|
+
quietly(agent, pmCommand(agent, "install", []));
|
|
234
227
|
|
|
235
228
|
function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
|
|
236
229
|
const { agent } = input.decisions.packageManager.value;
|
|
@@ -239,15 +232,8 @@ function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
|
|
|
239
232
|
{
|
|
240
233
|
action: "run",
|
|
241
234
|
run: "install",
|
|
242
|
-
command: addCommand(
|
|
243
|
-
|
|
244
|
-
`${PACKAGE_NAME}@${again.upgrade.to}`,
|
|
245
|
-
...specsOf(input.iconPackages)
|
|
246
|
-
),
|
|
247
|
-
detail: withIcons(
|
|
248
|
-
input,
|
|
249
|
-
`the studio, ${again.upgrade.from} → ${again.upgrade.to}: what this setup writes needs it`
|
|
250
|
-
),
|
|
235
|
+
command: addCommand(agent, `${PACKAGE_NAME}@${again.upgrade.to}`),
|
|
236
|
+
detail: `the studio, ${again.upgrade.from} → ${again.upgrade.to}: what this setup writes needs it`,
|
|
251
237
|
},
|
|
252
238
|
];
|
|
253
239
|
}
|
|
@@ -256,13 +242,12 @@ function againSteps(input: PlanInput, again: SetUpAgain): PlanStep[] {
|
|
|
256
242
|
{
|
|
257
243
|
action: "run",
|
|
258
244
|
run: "install",
|
|
259
|
-
command:
|
|
245
|
+
command: installCommand(agent),
|
|
260
246
|
detail: "the studio is in package.json, not installed yet",
|
|
261
247
|
},
|
|
262
|
-
...iconSteps(input),
|
|
263
248
|
];
|
|
264
249
|
}
|
|
265
|
-
return
|
|
250
|
+
return [];
|
|
266
251
|
}
|
|
267
252
|
|
|
268
253
|
/** The install, or the advice that replaces it, for how the studio is in. */
|
|
@@ -274,9 +259,7 @@ function installSteps(input: PlanInput): PlanStep[] {
|
|
|
274
259
|
}
|
|
275
260
|
const { again } = input;
|
|
276
261
|
if (workspace) {
|
|
277
|
-
|
|
278
|
-
workspace.studioSpec || Object.keys(input.iconPackages).length > 0;
|
|
279
|
-
if (again?.installed && !asks) {
|
|
262
|
+
if (again?.installed && !workspace.studioSpec) {
|
|
280
263
|
return [];
|
|
281
264
|
}
|
|
282
265
|
// Everything is in package.json already: one install, at the root.
|
|
@@ -288,29 +271,25 @@ function installSteps(input: PlanInput): PlanStep[] {
|
|
|
288
271
|
action: "run",
|
|
289
272
|
run: "install",
|
|
290
273
|
command: workspace.install,
|
|
291
|
-
detail:
|
|
292
|
-
|
|
293
|
-
workspace
|
|
294
|
-
? `from the workspace root: ${PACKAGE_NAME} ${workspace.studioSpec}${links}`
|
|
295
|
-
: "from the workspace root"
|
|
296
|
-
),
|
|
274
|
+
detail: workspace.studioSpec
|
|
275
|
+
? `from the workspace root: ${PACKAGE_NAME} ${workspace.studioSpec}${links}`
|
|
276
|
+
: "from the workspace root",
|
|
297
277
|
},
|
|
298
278
|
];
|
|
299
279
|
}
|
|
300
280
|
const { agent, name } = decisions.packageManager.value;
|
|
301
|
-
const icons = specsOf(input.iconPackages);
|
|
302
281
|
if (studioSpec) {
|
|
303
282
|
return [
|
|
304
283
|
{
|
|
305
284
|
action: "run",
|
|
306
285
|
run: "install",
|
|
307
|
-
command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}
|
|
308
|
-
detail:
|
|
286
|
+
command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}`),
|
|
287
|
+
detail: `the studio, from ${studioSpec}`,
|
|
309
288
|
},
|
|
310
289
|
];
|
|
311
290
|
}
|
|
312
291
|
if (studioPackage.kind === "listed") {
|
|
313
|
-
return again ? againSteps(input, again) :
|
|
292
|
+
return again ? againSteps(input, again) : [];
|
|
314
293
|
}
|
|
315
294
|
if (studioPackage.kind === "linked") {
|
|
316
295
|
// Linked into the project (`bun link`): installing would replace a working
|
|
@@ -324,7 +303,6 @@ function installSteps(input: PlanInput): PlanStep[] {
|
|
|
324
303
|
detail:
|
|
325
304
|
"keeps the linked studio in package.json, not installed from npm",
|
|
326
305
|
},
|
|
327
|
-
...iconSteps(input),
|
|
328
306
|
];
|
|
329
307
|
}
|
|
330
308
|
const protocol = name === "npm" ? "file" : "link";
|
|
@@ -332,11 +310,7 @@ function installSteps(input: PlanInput): PlanStep[] {
|
|
|
332
310
|
{
|
|
333
311
|
action: "ask",
|
|
334
312
|
command: commandLine(
|
|
335
|
-
addCommand(
|
|
336
|
-
agent,
|
|
337
|
-
`${PACKAGE_NAME}@${protocol}:${studioPackage.dir}`,
|
|
338
|
-
...icons
|
|
339
|
-
)
|
|
313
|
+
addCommand(agent, `${PACKAGE_NAME}@${protocol}:${studioPackage.dir}`)
|
|
340
314
|
),
|
|
341
315
|
detail: `${PACKAGE_NAME} is linked into this project, so it is not installed. It is not in package.json, so the next install may remove the link. To keep it, run`,
|
|
342
316
|
},
|
|
@@ -346,8 +320,8 @@ function installSteps(input: PlanInput): PlanStep[] {
|
|
|
346
320
|
{
|
|
347
321
|
action: "run",
|
|
348
322
|
run: "install",
|
|
349
|
-
command: addCommand(agent, PACKAGE_NAME
|
|
350
|
-
detail:
|
|
323
|
+
command: addCommand(agent, PACKAGE_NAME),
|
|
324
|
+
detail: "the studio",
|
|
351
325
|
},
|
|
352
326
|
];
|
|
353
327
|
}
|
|
@@ -395,6 +369,18 @@ function configDetail(input: PlanInput): string {
|
|
|
395
369
|
return parts.join(", ");
|
|
396
370
|
}
|
|
397
371
|
|
|
372
|
+
/**
|
|
373
|
+
* What `shadcn init` is given: the preset and library chosen, or, asking
|
|
374
|
+
* nothing, its defaults (`--defaults`: the base-nova preset).
|
|
375
|
+
*/
|
|
376
|
+
function shadcnArgs(init: ShadcnInit, quiet: boolean): string[] {
|
|
377
|
+
const chosen = shadcnInitFlags(init);
|
|
378
|
+
if (!quiet) {
|
|
379
|
+
return chosen;
|
|
380
|
+
}
|
|
381
|
+
return [...(init.preset ? chosen : ["--defaults", ...chosen]), "--yes"];
|
|
382
|
+
}
|
|
383
|
+
|
|
398
384
|
/** shadcn first, when the person has no components yet. */
|
|
399
385
|
function shadcnSteps(input: PlanInput): PlanStep[] {
|
|
400
386
|
const { decisions, quiet } = input;
|
|
@@ -408,7 +394,10 @@ function shadcnSteps(input: PlanInput): PlanStep[] {
|
|
|
408
394
|
command: pmCommand(decisions.packageManager.value.agent, "execute", [
|
|
409
395
|
"shadcn@latest",
|
|
410
396
|
"init",
|
|
411
|
-
...(
|
|
397
|
+
...shadcnArgs(decisions.components.value, quiet),
|
|
398
|
+
// A first component, so a preset leaves a components folder too,
|
|
399
|
+
// as --defaults does.
|
|
400
|
+
"button",
|
|
412
401
|
]),
|
|
413
402
|
interactive: !quiet,
|
|
414
403
|
detail: "sets up shadcn's components and styles first",
|
|
@@ -429,18 +418,12 @@ function tsconfigDetail(input: PlanInput): string {
|
|
|
429
418
|
}
|
|
430
419
|
|
|
431
420
|
/** Its own app's package.json: the line that says what it depends on. */
|
|
432
|
-
function appDetail(
|
|
433
|
-
app: OwnAppFacts,
|
|
434
|
-
iconPackages: Record<string, string>
|
|
435
|
-
): string {
|
|
421
|
+
function appDetail(app: OwnAppFacts): string {
|
|
436
422
|
const parts = [PACKAGE_NAME];
|
|
437
423
|
if (app.designSystem) {
|
|
438
424
|
parts.push(`${app.designSystem} ${app.dependencies[app.designSystem]}`);
|
|
439
425
|
}
|
|
440
426
|
parts.push(`react ${app.dependencies.react}`);
|
|
441
|
-
for (const [name, range] of Object.entries(iconPackages)) {
|
|
442
|
-
parts.push(`${name} ${range}`);
|
|
443
|
-
}
|
|
444
427
|
return parts.join(", ");
|
|
445
428
|
}
|
|
446
429
|
|
|
@@ -455,7 +438,7 @@ function appSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
|
|
|
455
438
|
action: "create",
|
|
456
439
|
write: "app-package",
|
|
457
440
|
path: inPackage(target.package, "package.json"),
|
|
458
|
-
detail: appDetail(app
|
|
441
|
+
detail: appDetail(app),
|
|
459
442
|
},
|
|
460
443
|
];
|
|
461
444
|
if (app.turbo) {
|
|
@@ -599,7 +582,7 @@ function studioSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
|
|
|
599
582
|
];
|
|
600
583
|
}
|
|
601
584
|
|
|
602
|
-
/** "+ script "
|
|
585
|
+
/** "+ script "dex"". */
|
|
603
586
|
const scriptsDetail = (names: string[]): string =>
|
|
604
587
|
`+ ${names.length === 1 ? "script" : "scripts"} ${names.map((name) => `"${name}"`).join(", ")}`;
|
|
605
588
|
|
|
@@ -624,11 +607,6 @@ function scriptSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
|
|
|
624
607
|
...(workspace?.studioSpec
|
|
625
608
|
? [studioDetail(input, workspace.studioSpec)]
|
|
626
609
|
: []),
|
|
627
|
-
...(workspace
|
|
628
|
-
? Object.entries(input.iconPackages).map(
|
|
629
|
-
([name, range]) => `+ devDependency ${name} ${range}`
|
|
630
|
-
)
|
|
631
|
-
: []),
|
|
632
610
|
];
|
|
633
611
|
if (added.length > 0 && existing.has(path)) {
|
|
634
612
|
steps.push({
|
|
@@ -639,12 +617,12 @@ function scriptSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
|
|
|
639
617
|
});
|
|
640
618
|
}
|
|
641
619
|
}
|
|
642
|
-
if (workspace && !("
|
|
620
|
+
if (workspace && !("dex" in workspace.rootScripts)) {
|
|
643
621
|
steps.push({
|
|
644
622
|
action: "edit",
|
|
645
623
|
write: "root-script",
|
|
646
624
|
path: "package.json",
|
|
647
|
-
detail: `+ script "
|
|
625
|
+
detail: `+ script "dex": "${workspace.studioScript}"`,
|
|
648
626
|
});
|
|
649
627
|
}
|
|
650
628
|
return steps;
|
|
@@ -719,6 +697,37 @@ function noteSteps(input: PlanInput, target: StudioTarget): PlanStep[] {
|
|
|
719
697
|
return notes;
|
|
720
698
|
}
|
|
721
699
|
|
|
700
|
+
/**
|
|
701
|
+
* With pnpm 11 or later, what the project says about esbuild's install
|
|
702
|
+
* script, when it says nothing yet and the studio is about to be installed:
|
|
703
|
+
* pnpm stops the install otherwise (write.ts, withEsbuildBuilds). pnpm 10
|
|
704
|
+
* only warns, so its projects keep their files as they are.
|
|
705
|
+
*/
|
|
706
|
+
function pnpmSteps(input: PlanInput): PlanStep[] {
|
|
707
|
+
const yaml = input.pnpmWorkspace ?? "";
|
|
708
|
+
const installs =
|
|
709
|
+
input.skipInstall ||
|
|
710
|
+
installSteps(input).some((step) => step.action === "run");
|
|
711
|
+
if (
|
|
712
|
+
input.decisions.packageManager.value.name !== "pnpm" ||
|
|
713
|
+
!input.pnpmStopsOnBuilds ||
|
|
714
|
+
!installs ||
|
|
715
|
+
pnpmDecidesEsbuild(yaml) ||
|
|
716
|
+
withEsbuildBuilds(yaml) === undefined
|
|
717
|
+
) {
|
|
718
|
+
return [];
|
|
719
|
+
}
|
|
720
|
+
return [
|
|
721
|
+
{
|
|
722
|
+
action: input.pnpmWorkspace === undefined ? "create" : "edit",
|
|
723
|
+
write: "pnpm-builds",
|
|
724
|
+
path: "pnpm-workspace.yaml",
|
|
725
|
+
detail:
|
|
726
|
+
"+ allowBuilds: esbuild: false (the studio's Vite runs without its install script; pnpm 11 stops without a choice)",
|
|
727
|
+
},
|
|
728
|
+
];
|
|
729
|
+
}
|
|
730
|
+
|
|
722
731
|
/** Every step `dex create` takes, in order. */
|
|
723
732
|
export function planSetup(input: PlanInput): SetupPlan {
|
|
724
733
|
const target: StudioTarget = input.target ?? {
|
|
@@ -727,7 +736,6 @@ export function planSetup(input: PlanInput): SetupPlan {
|
|
|
727
736
|
studio: input.decisions.dir.value,
|
|
728
737
|
};
|
|
729
738
|
return {
|
|
730
|
-
iconPackages: input.iconPackages,
|
|
731
739
|
studio: target.studio,
|
|
732
740
|
target,
|
|
733
741
|
...(input.workspace ? { workspace: input.workspace } : {}),
|
|
@@ -738,6 +746,7 @@ export function planSetup(input: PlanInput): SetupPlan {
|
|
|
738
746
|
...projectSteps(input, target),
|
|
739
747
|
...agentSteps(input),
|
|
740
748
|
...noteSteps(input, target),
|
|
749
|
+
...pnpmSteps(input),
|
|
741
750
|
...installSteps(input),
|
|
742
751
|
],
|
|
743
752
|
};
|
package/src/setup/project.ts
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
// here asks or writes.
|
|
5
5
|
|
|
6
6
|
import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
7
|
-
import { createRequire } from "node:module";
|
|
8
7
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
9
8
|
import type { Agent, AgentName } from "package-manager-detector";
|
|
10
9
|
import { detect } from "package-manager-detector/detect";
|
|
@@ -12,16 +11,12 @@ import {
|
|
|
12
11
|
dependenciesOf,
|
|
13
12
|
exportedComponents,
|
|
14
13
|
filesImport,
|
|
14
|
+
installedPackageDir,
|
|
15
15
|
packageAt,
|
|
16
16
|
packageFolder,
|
|
17
17
|
} from "../config/project-files.ts";
|
|
18
|
-
import { PACKAGE_NAME, posix
|
|
18
|
+
import { PACKAGE_NAME, posix } from "../paths.ts";
|
|
19
19
|
import type { StylingApproach } from "../shared/design-system.ts";
|
|
20
|
-
import {
|
|
21
|
-
ICON_SET_PACKAGES,
|
|
22
|
-
type InterfaceIcons,
|
|
23
|
-
iconSetsIn,
|
|
24
|
-
} from "../shared/icon-sets.ts";
|
|
25
20
|
import { STUDIO_FILES } from "../shared/studio-files.ts";
|
|
26
21
|
import type { FoundDesignMd } from "./design-md.ts";
|
|
27
22
|
import { designMdFinding } from "./design-md-setup.ts";
|
|
@@ -36,6 +31,7 @@ import {
|
|
|
36
31
|
globalCssFiles,
|
|
37
32
|
isMixedFolder,
|
|
38
33
|
libraryAt,
|
|
34
|
+
runningAgent,
|
|
39
35
|
} from "./detect.ts";
|
|
40
36
|
import { type Finding, found } from "./findings.ts";
|
|
41
37
|
import { type ProviderNeed, providerFinding } from "./provider.ts";
|
|
@@ -69,11 +65,6 @@ export interface ComponentsChoice {
|
|
|
69
65
|
dir: string;
|
|
70
66
|
/** Relative to the project, with forward slashes: "src/components/ui". */
|
|
71
67
|
folder: string;
|
|
72
|
-
/**
|
|
73
|
-
* The icon set they draw with (components.json's iconLibrary), when the
|
|
74
|
-
* studio's interface has it too.
|
|
75
|
-
*/
|
|
76
|
-
icons?: InterfaceIcons;
|
|
77
68
|
/** How prototypes import them: "@/components/ui"; undefined when unknown. */
|
|
78
69
|
import: string | undefined;
|
|
79
70
|
/** The first few components' names, to recognise the folder by. */
|
|
@@ -136,12 +127,9 @@ export interface ProjectFindings {
|
|
|
136
127
|
imports: string[];
|
|
137
128
|
styling: StylingApproach | undefined;
|
|
138
129
|
};
|
|
139
|
-
/** The icon set the project draws with already, else Lucide. */
|
|
140
|
-
icons: Finding<InterfaceIcons>;
|
|
141
130
|
/** The package's name, from package.json. */
|
|
142
131
|
name: string | undefined;
|
|
143
132
|
packageManager: Finding<PackageManagerChoice>;
|
|
144
|
-
primitives: Finding<boolean>;
|
|
145
133
|
/** A provider the design system needs around every view, when it needs one. */
|
|
146
134
|
provider: Finding<ProviderNeed | undefined>;
|
|
147
135
|
/** Absolute: the project's folder. */
|
|
@@ -187,7 +175,6 @@ export function componentsChoice(
|
|
|
187
175
|
count: library.components.length,
|
|
188
176
|
names: library.components.slice(0, NAMES_SHOWN).map(({ path }) => path),
|
|
189
177
|
baseUi: Boolean(library.baseUi),
|
|
190
|
-
...(library.icons ? { icons: library.icons } : {}),
|
|
191
178
|
styles: library.globalCss ? posix(library.globalCss) : undefined,
|
|
192
179
|
};
|
|
193
180
|
}
|
|
@@ -326,96 +313,6 @@ function stylesFinding(
|
|
|
326
313
|
);
|
|
327
314
|
}
|
|
328
315
|
|
|
329
|
-
function primitivesFinding(
|
|
330
|
-
components: ComponentsChoice | undefined,
|
|
331
|
-
source: string
|
|
332
|
-
): Finding<boolean> {
|
|
333
|
-
if (components?.baseUi && components.import) {
|
|
334
|
-
return found(true, `${source} → style is shadcn on Base UI`);
|
|
335
|
-
}
|
|
336
|
-
return found(
|
|
337
|
-
false,
|
|
338
|
-
components
|
|
339
|
-
? "your components are not shadcn on Base UI"
|
|
340
|
-
: "no components to build it from"
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
/** Icon packages people draw with that Dex's interface has no set for. */
|
|
345
|
-
const OTHER_ICON_PACKAGES = [
|
|
346
|
-
"@heroicons/react",
|
|
347
|
-
"@primer/octicons-react",
|
|
348
|
-
"@radix-ui/react-icons",
|
|
349
|
-
"@tabler/icons-react",
|
|
350
|
-
"@mui/icons-material",
|
|
351
|
-
"@fortawesome/react-fontawesome",
|
|
352
|
-
"@iconify/react",
|
|
353
|
-
"@remixicon/react",
|
|
354
|
-
"react-icons",
|
|
355
|
-
];
|
|
356
|
-
|
|
357
|
-
/**
|
|
358
|
-
* `source` names the components.json. Beside Lucide, which shadcn's
|
|
359
|
-
* components bring, another set is the one chosen.
|
|
360
|
-
*/
|
|
361
|
-
export function iconsFinding(
|
|
362
|
-
root: string,
|
|
363
|
-
components: ComponentsChoice | undefined,
|
|
364
|
-
source: string
|
|
365
|
-
): Finding<InterfaceIcons> {
|
|
366
|
-
if (components?.icons) {
|
|
367
|
-
return found(components.icons, `${source} → iconLibrary`, "certain");
|
|
368
|
-
}
|
|
369
|
-
const home = components && packageFolder(components.dir);
|
|
370
|
-
const manifests = [...(home && home !== root ? [home] : []), root];
|
|
371
|
-
const sets = manifests.flatMap((dir) =>
|
|
372
|
-
iconSetsIn(dependenciesOf(dir).all)
|
|
373
|
-
.sort((a, b) => Number(a === "lucide") - Number(b === "lucide"))
|
|
374
|
-
.map((set) => ({ dir, set }))
|
|
375
|
-
);
|
|
376
|
-
const [first, ...rest] = sets;
|
|
377
|
-
if (!first) {
|
|
378
|
-
const other = manifests
|
|
379
|
-
.flatMap((dir) => {
|
|
380
|
-
const { all } = dependenciesOf(dir);
|
|
381
|
-
return OTHER_ICON_PACKAGES.filter((name) => all[name]);
|
|
382
|
-
})
|
|
383
|
-
.at(0);
|
|
384
|
-
return found(
|
|
385
|
-
"lucide",
|
|
386
|
-
other
|
|
387
|
-
? `${other} isn't one Dex draws with, so Lucide`
|
|
388
|
-
: "no iconLibrary in components.json, and no icon set in package.json, so Lucide",
|
|
389
|
-
"likely"
|
|
390
|
-
);
|
|
391
|
-
}
|
|
392
|
-
const others = [...new Set(rest.map(({ set }) => set))].filter(
|
|
393
|
-
(set) => set !== first.set
|
|
394
|
-
);
|
|
395
|
-
return found(
|
|
396
|
-
first.set,
|
|
397
|
-
`${shown(root, join(first.dir, "package.json"))} → ${ICON_SET_PACKAGES[first.set][0]}`,
|
|
398
|
-
others.length > 0 ? "guess" : "likely",
|
|
399
|
-
others
|
|
400
|
-
);
|
|
401
|
-
}
|
|
402
|
-
|
|
403
|
-
/** At the range @dexhq/canvas asks for; Lucide's comes with @dexhq/canvas. */
|
|
404
|
-
export function iconPackagesToAdd(
|
|
405
|
-
set: InterfaceIcons,
|
|
406
|
-
dir: string
|
|
407
|
-
): Record<string, string> {
|
|
408
|
-
if (set === "lucide") {
|
|
409
|
-
return {};
|
|
410
|
-
}
|
|
411
|
-
const declared = dependenciesOf(dir).all;
|
|
412
|
-
return Object.fromEntries(
|
|
413
|
-
ICON_SET_PACKAGES[set]
|
|
414
|
-
.filter((name) => !declared[name])
|
|
415
|
-
.map((name) => [name, studioPeer(name) ?? "*"])
|
|
416
|
-
);
|
|
417
|
-
}
|
|
418
|
-
|
|
419
316
|
const AGENT_NAMES: Record<AgentId, string> = {
|
|
420
317
|
claude: "Claude Code",
|
|
421
318
|
codex: "Codex",
|
|
@@ -441,9 +338,20 @@ function agentsFinding(root: string): Finding<AgentId[]> {
|
|
|
441
338
|
if (agents.length === 0) {
|
|
442
339
|
return found([], "no agent's files in this folder", "likely");
|
|
443
340
|
}
|
|
341
|
+
const running = runningAgent();
|
|
342
|
+
const files = agents
|
|
343
|
+
.filter(({ id }) => id !== running?.id)
|
|
344
|
+
.map(({ evidence }) => evidence);
|
|
345
|
+
const said = [
|
|
346
|
+
...(running ? [`running this: ${running.evidence} is set`] : []),
|
|
347
|
+
...(files.length > 0 ? [`found ${files.join(", ")}`] : []),
|
|
348
|
+
].join("; ");
|
|
349
|
+
// AGENTS.md alone: most agents read it, so Codex is only likely.
|
|
350
|
+
const onlyGuide = agents.length === 1 && agents[0]?.evidence === "AGENTS.md";
|
|
444
351
|
return found(
|
|
445
352
|
agents.map(({ id }) => id),
|
|
446
|
-
|
|
353
|
+
said,
|
|
354
|
+
onlyGuide ? "likely" : "certain"
|
|
447
355
|
);
|
|
448
356
|
}
|
|
449
357
|
|
|
@@ -509,18 +417,19 @@ export async function packageManagerFinding(
|
|
|
509
417
|
return found({ name: "npm", agent: "npm" }, "no lockfile, so npm", "guess");
|
|
510
418
|
}
|
|
511
419
|
|
|
512
|
-
/**
|
|
420
|
+
/**
|
|
421
|
+
* Where the project already resolves the studio from, if it does. Its own
|
|
422
|
+
* node_modules' entry is kept as it is, so `isLinked` sees a `bun link`; one
|
|
423
|
+
* above is followed through its links, as Node resolves it, so a workspace's
|
|
424
|
+
* install is never taken for a link.
|
|
425
|
+
*/
|
|
513
426
|
export function resolvedStudio(root: string): string | undefined {
|
|
514
427
|
const local = join(root, "node_modules", PACKAGE_NAME);
|
|
515
428
|
if (existsSync(join(local, "package.json"))) {
|
|
516
429
|
return local;
|
|
517
430
|
}
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
return dirname(require.resolve(`${PACKAGE_NAME}/package.json`));
|
|
521
|
-
} catch {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
431
|
+
const above = installedPackageDir(dirname(resolve(root)), PACKAGE_NAME);
|
|
432
|
+
return above && realpathSync(above);
|
|
524
433
|
}
|
|
525
434
|
|
|
526
435
|
/**
|
|
@@ -570,8 +479,8 @@ export async function findProject(
|
|
|
570
479
|
const agentRoot = options.agentRoot ?? root;
|
|
571
480
|
const system = detectDesignSystem(root);
|
|
572
481
|
const { finding: components, ambiguous } = componentsFinding(root);
|
|
573
|
-
// The components.json the components came from, which the styles
|
|
574
|
-
//
|
|
482
|
+
// The components.json the components came from, which the styles
|
|
483
|
+
// finding cites when it comes from it too.
|
|
575
484
|
const source = components.evidence.split(" → ")[0] ?? "components.json";
|
|
576
485
|
const workspace = findWorkspace(root);
|
|
577
486
|
const folders = components.value
|
|
@@ -601,8 +510,6 @@ export async function findProject(
|
|
|
601
510
|
...(workspace.isWorkspace ? { workspaceRoot: workspace.root } : {}),
|
|
602
511
|
}),
|
|
603
512
|
styles: stylesFinding(root, components.value, source),
|
|
604
|
-
primitives: primitivesFinding(components.value, source),
|
|
605
|
-
icons: iconsFinding(root, components.value, source),
|
|
606
513
|
provider: providerFinding(root),
|
|
607
514
|
agents: agentsFinding(agentRoot),
|
|
608
515
|
packageManager: await packageManagerFinding(agentRoot, options),
|