@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/dist/setup/plan.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ import { SetupDecisions } from "./questions.mjs";
|
|
|
5
5
|
import { Agent } from "package-manager-detector";
|
|
6
6
|
//#region src/setup/plan.d.ts
|
|
7
7
|
/** A file or folder setup writes, by what it is. */
|
|
8
|
-
export type WriteKind = "config" | "guide" | "provider" | "tsconfig" | "types" | "scripts" | "gitignore" | "pointer" | "agent" | "app-package" | "turbo" | "root-script";
|
|
8
|
+
export type WriteKind = "config" | "guide" | "provider" | "tsconfig" | "types" | "scripts" | "gitignore" | "pointer" | "agent" | "app-package" | "turbo" | "root-script" | "pnpm-builds";
|
|
9
9
|
/** A command setup runs, by what it is for. */
|
|
10
10
|
export type RunKind = "shadcn" | "install" | "link";
|
|
11
11
|
export type PlanStep = {
|
|
@@ -62,14 +62,12 @@ export interface WorkspaceSetup {
|
|
|
62
62
|
install: string[];
|
|
63
63
|
/** The workspace root's package.json scripts. */
|
|
64
64
|
rootScripts: Record<string, string>;
|
|
65
|
-
/** The root's "
|
|
65
|
+
/** The root's "dex" script: "turbo run dev --filter=@acme/studio". */
|
|
66
66
|
studioScript: string;
|
|
67
67
|
/** How package.json asks for the studio: "^0.3.0", "file:..."; undefined when listed. */
|
|
68
68
|
studioSpec: string | undefined;
|
|
69
69
|
}
|
|
70
70
|
export interface SetupPlan {
|
|
71
|
-
/** The icon set's packages the studio's package gets: in a workspace, in its package.json. */
|
|
72
|
-
iconPackages: Record<string, string>;
|
|
73
71
|
steps: PlanStep[];
|
|
74
72
|
/** The studio's folder, relative to where the plan starts: "studio". */
|
|
75
73
|
studio: string;
|
|
@@ -109,8 +107,10 @@ export interface PlanInput {
|
|
|
109
107
|
gitignore: string;
|
|
110
108
|
/** The .gitignore where the plan starts. */
|
|
111
109
|
hostGitignore: string | undefined;
|
|
112
|
-
/**
|
|
113
|
-
|
|
110
|
+
/** pnpm 11 or later: it stops an install on a build script nobody decided on. */
|
|
111
|
+
pnpmStopsOnBuilds?: boolean;
|
|
112
|
+
/** pnpm-workspace.yaml where the plan starts, when it has one. */
|
|
113
|
+
pnpmWorkspace?: string;
|
|
114
114
|
/** Where setup looked, absolute: the files decisions name are shown from it. */
|
|
115
115
|
projectRoot?: string;
|
|
116
116
|
/** Ask nothing: no terminal, or --yes. */
|
|
@@ -144,6 +144,8 @@ export declare const AGENT_FILES: Record<AgentId, string[]>;
|
|
|
144
144
|
export declare const commandLine: (command: string[]) => string;
|
|
145
145
|
/** `<manager> add -D <specs>`, as the project's package manager writes it. */
|
|
146
146
|
export declare const addCommand: (agent: Agent, ...specs: string[]) => string[];
|
|
147
|
+
/** `<manager> install`, as the project's package manager writes it. */
|
|
148
|
+
export declare const installCommand: (agent: Agent) => string[];
|
|
147
149
|
/** Every step `dex create` takes, in order. */
|
|
148
150
|
export declare function planSetup(input: PlanInput): SetupPlan;
|
|
149
151
|
/** The plan as lines: "create dex.config.ts design system …". */
|
package/dist/setup/plan.mjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { PACKAGE_NAME } from "../paths.mjs";
|
|
2
2
|
import { STUDIO_FILES } from "../shared/studio-files.mjs";
|
|
3
|
-
import { ICON_SET_NAMES } from "../shared/icon-sets.mjs";
|
|
4
3
|
import { parseJsonc } from "../config/project-files.mjs";
|
|
5
4
|
import { listing } from "../shared/listing.mjs";
|
|
6
5
|
import { designMdDetail, fromProject } from "./design-md-setup.mjs";
|
|
7
6
|
import { pmCommand } from "../config/package-manager.mjs";
|
|
8
7
|
import { agentName } from "./project.mjs";
|
|
9
|
-
import { OLD_SCRIPTS, STUDIO_TYPES_FILE, hasPointer, ignoreFile, missingIgnoreLines, missingScripts } from "./write.mjs";
|
|
10
|
-
import { PROVIDER_FILE } from "./questions.mjs";
|
|
8
|
+
import { OLD_SCRIPTS, STUDIO_TYPES_FILE, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, withEsbuildBuilds } from "./write.mjs";
|
|
9
|
+
import { PROVIDER_FILE, shadcnInitFlags } from "./questions.mjs";
|
|
11
10
|
//#region src/setup/plan.ts
|
|
12
11
|
/** `path` in the package at `folder`: "apps/web/package.json". */
|
|
13
12
|
const inPackage = (folder, path) => folder === "." ? path : `${folder}/${path}`;
|
|
@@ -29,37 +28,34 @@ const AGENT_DETAIL = {
|
|
|
29
28
|
};
|
|
30
29
|
/** A command as one line: "bun add -D @dexhq/canvas". */
|
|
31
30
|
const commandLine = (command) => command.join(" ");
|
|
31
|
+
/**
|
|
32
|
+
* npm's audit and funding notes are about the project's whole tree, not the
|
|
33
|
+
* studio: setup leaves them out of its installs, as shadcn does.
|
|
34
|
+
*/
|
|
35
|
+
const quietly = (agent, command) => agent === "npm" ? [
|
|
36
|
+
...command,
|
|
37
|
+
"--no-audit",
|
|
38
|
+
"--no-fund"
|
|
39
|
+
] : command;
|
|
32
40
|
/** `<manager> add -D <specs>`, as the project's package manager writes it. */
|
|
33
|
-
const addCommand = (agent, ...specs) => pmCommand(agent, "add", ["-D", ...specs]);
|
|
34
|
-
/**
|
|
35
|
-
const
|
|
36
|
-
const withIcons = (input, detail) => Object.keys(input.iconPackages).length > 0 ? `${detail}, and ${ICON_SET_NAMES[input.decisions.icons.value]}, its icon set` : detail;
|
|
37
|
-
/** The icon set's packages on their own, for a project that has the studio. */
|
|
38
|
-
function iconSteps(input) {
|
|
39
|
-
const icons = specsOf(input.iconPackages);
|
|
40
|
-
if (icons.length === 0) return [];
|
|
41
|
-
return [{
|
|
42
|
-
action: "run",
|
|
43
|
-
run: "install",
|
|
44
|
-
command: addCommand(input.decisions.packageManager.value.agent, ...icons),
|
|
45
|
-
detail: `${ICON_SET_NAMES[input.decisions.icons.value]}, the icon set`
|
|
46
|
-
}];
|
|
47
|
-
}
|
|
41
|
+
const addCommand = (agent, ...specs) => quietly(agent, pmCommand(agent, "add", ["-D", ...specs]));
|
|
42
|
+
/** `<manager> install`, as the project's package manager writes it. */
|
|
43
|
+
const installCommand = (agent) => quietly(agent, pmCommand(agent, "install", []));
|
|
48
44
|
function againSteps(input, again) {
|
|
49
45
|
const { agent } = input.decisions.packageManager.value;
|
|
50
46
|
if (again.upgrade) return [{
|
|
51
47
|
action: "run",
|
|
52
48
|
run: "install",
|
|
53
|
-
command: addCommand(agent, `${PACKAGE_NAME}@${again.upgrade.to}
|
|
54
|
-
detail:
|
|
49
|
+
command: addCommand(agent, `${PACKAGE_NAME}@${again.upgrade.to}`),
|
|
50
|
+
detail: `the studio, ${again.upgrade.from} → ${again.upgrade.to}: what this setup writes needs it`
|
|
55
51
|
}];
|
|
56
52
|
if (!again.installed) return [{
|
|
57
53
|
action: "run",
|
|
58
54
|
run: "install",
|
|
59
|
-
command:
|
|
55
|
+
command: installCommand(agent),
|
|
60
56
|
detail: "the studio is in package.json, not installed yet"
|
|
61
|
-
}
|
|
62
|
-
return
|
|
57
|
+
}];
|
|
58
|
+
return [];
|
|
63
59
|
}
|
|
64
60
|
/** The install, or the advice that replaces it, for how the studio is in. */
|
|
65
61
|
function installSteps(input) {
|
|
@@ -67,43 +63,41 @@ function installSteps(input) {
|
|
|
67
63
|
if (skipInstall) return [];
|
|
68
64
|
const { again } = input;
|
|
69
65
|
if (workspace) {
|
|
70
|
-
|
|
71
|
-
if (again?.installed && !asks) return [];
|
|
66
|
+
if (again?.installed && !workspace.studioSpec) return [];
|
|
72
67
|
const links = workspace.app?.designSystem ? `, and links ${workspace.app.designSystem}` : "";
|
|
73
68
|
return [{
|
|
74
69
|
action: "run",
|
|
75
70
|
run: "install",
|
|
76
71
|
command: workspace.install,
|
|
77
|
-
detail:
|
|
72
|
+
detail: workspace.studioSpec ? `from the workspace root: ${PACKAGE_NAME} ${workspace.studioSpec}${links}` : "from the workspace root"
|
|
78
73
|
}];
|
|
79
74
|
}
|
|
80
75
|
const { agent, name } = decisions.packageManager.value;
|
|
81
|
-
const icons = specsOf(input.iconPackages);
|
|
82
76
|
if (studioSpec) return [{
|
|
83
77
|
action: "run",
|
|
84
78
|
run: "install",
|
|
85
|
-
command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}
|
|
86
|
-
detail:
|
|
79
|
+
command: addCommand(agent, `${PACKAGE_NAME}@${studioSpec}`),
|
|
80
|
+
detail: `the studio, from ${studioSpec}`
|
|
87
81
|
}];
|
|
88
|
-
if (studioPackage.kind === "listed") return again ? againSteps(input, again) :
|
|
82
|
+
if (studioPackage.kind === "listed") return again ? againSteps(input, again) : [];
|
|
89
83
|
if (studioPackage.kind === "linked") {
|
|
90
84
|
if (name === "bun") return [{
|
|
91
85
|
action: "run",
|
|
92
86
|
run: "link",
|
|
93
87
|
command: addCommand(agent, `link:${PACKAGE_NAME}`),
|
|
94
88
|
detail: "keeps the linked studio in package.json, not installed from npm"
|
|
95
|
-
}
|
|
89
|
+
}];
|
|
96
90
|
return [{
|
|
97
91
|
action: "ask",
|
|
98
|
-
command: commandLine(addCommand(agent, `${PACKAGE_NAME}@${name === "npm" ? "file" : "link"}:${studioPackage.dir}
|
|
92
|
+
command: commandLine(addCommand(agent, `${PACKAGE_NAME}@${name === "npm" ? "file" : "link"}:${studioPackage.dir}`)),
|
|
99
93
|
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`
|
|
100
94
|
}];
|
|
101
95
|
}
|
|
102
96
|
return [{
|
|
103
97
|
action: "run",
|
|
104
98
|
run: "install",
|
|
105
|
-
command: addCommand(agent, PACKAGE_NAME
|
|
106
|
-
detail:
|
|
99
|
+
command: addCommand(agent, PACKAGE_NAME),
|
|
100
|
+
detail: "the studio"
|
|
107
101
|
}];
|
|
108
102
|
}
|
|
109
103
|
/** A file the decisions name, as the person gave it: from the project. */
|
|
@@ -128,6 +122,15 @@ function configDetail(input) {
|
|
|
128
122
|
if (designMd.value.kind === "link") parts.push(`guide ${shownFrom(input, designMd.value.file)}`);
|
|
129
123
|
return parts.join(", ");
|
|
130
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* What `shadcn init` is given: the preset and library chosen, or, asking
|
|
127
|
+
* nothing, its defaults (`--defaults`: the base-nova preset).
|
|
128
|
+
*/
|
|
129
|
+
function shadcnArgs(init, quiet) {
|
|
130
|
+
const chosen = shadcnInitFlags(init);
|
|
131
|
+
if (!quiet) return chosen;
|
|
132
|
+
return [...init.preset ? chosen : ["--defaults", ...chosen], "--yes"];
|
|
133
|
+
}
|
|
131
134
|
/** shadcn first, when the person has no components yet. */
|
|
132
135
|
function shadcnSteps(input) {
|
|
133
136
|
const { decisions, quiet } = input;
|
|
@@ -138,7 +141,8 @@ function shadcnSteps(input) {
|
|
|
138
141
|
command: pmCommand(decisions.packageManager.value.agent, "execute", [
|
|
139
142
|
"shadcn@latest",
|
|
140
143
|
"init",
|
|
141
|
-
...quiet
|
|
144
|
+
...shadcnArgs(decisions.components.value, quiet),
|
|
145
|
+
"button"
|
|
142
146
|
]),
|
|
143
147
|
interactive: !quiet,
|
|
144
148
|
detail: "sets up shadcn's components and styles first"
|
|
@@ -152,11 +156,10 @@ function tsconfigDetail(input) {
|
|
|
152
156
|
return app ? "views import packages as your apps do" : "views type-checked on their own: the project has no tsconfig";
|
|
153
157
|
}
|
|
154
158
|
/** Its own app's package.json: the line that says what it depends on. */
|
|
155
|
-
function appDetail(app
|
|
159
|
+
function appDetail(app) {
|
|
156
160
|
const parts = [PACKAGE_NAME];
|
|
157
161
|
if (app.designSystem) parts.push(`${app.designSystem} ${app.dependencies[app.designSystem]}`);
|
|
158
162
|
parts.push(`react ${app.dependencies.react}`);
|
|
159
|
-
for (const [name, range] of Object.entries(iconPackages)) parts.push(`${name} ${range}`);
|
|
160
163
|
return parts.join(", ");
|
|
161
164
|
}
|
|
162
165
|
/** Its own app's package.json and turbo.json, when it is its own app. */
|
|
@@ -167,7 +170,7 @@ function appSteps(input, target) {
|
|
|
167
170
|
action: "create",
|
|
168
171
|
write: "app-package",
|
|
169
172
|
path: inPackage(target.package, "package.json"),
|
|
170
|
-
detail: appDetail(app
|
|
173
|
+
detail: appDetail(app)
|
|
171
174
|
}];
|
|
172
175
|
if (app.turbo) steps.push({
|
|
173
176
|
action: "create",
|
|
@@ -267,7 +270,7 @@ function studioSteps(input, target) {
|
|
|
267
270
|
...tsconfigSteps(input, studio)
|
|
268
271
|
];
|
|
269
272
|
}
|
|
270
|
-
/** "+ script "
|
|
273
|
+
/** "+ script "dex"". */
|
|
271
274
|
const scriptsDetail = (names) => `+ ${names.length === 1 ? "script" : "scripts"} ${names.map((name) => `"${name}"`).join(", ")}`;
|
|
272
275
|
const studioDetail = (input, spec) => input.again?.upgrade ? `devDependency ${PACKAGE_NAME} ${input.again.upgrade.from} → ${spec}` : `+ devDependency ${PACKAGE_NAME} ${spec}`;
|
|
273
276
|
/** The package's own package.json, and the root's, with the studio's scripts. */
|
|
@@ -278,11 +281,7 @@ function scriptSteps(input, target) {
|
|
|
278
281
|
if (!own || input.again) {
|
|
279
282
|
const path = inPackage(target.package, "package.json");
|
|
280
283
|
const scripts = own ? [] : Object.keys(missingScripts(input.scripts));
|
|
281
|
-
const added = [
|
|
282
|
-
...scripts.length > 0 ? [scriptsDetail(scripts)] : [],
|
|
283
|
-
...workspace?.studioSpec ? [studioDetail(input, workspace.studioSpec)] : [],
|
|
284
|
-
...workspace ? Object.entries(input.iconPackages).map(([name, range]) => `+ devDependency ${name} ${range}`) : []
|
|
285
|
-
];
|
|
284
|
+
const added = [...scripts.length > 0 ? [scriptsDetail(scripts)] : [], ...workspace?.studioSpec ? [studioDetail(input, workspace.studioSpec)] : []];
|
|
286
285
|
if (added.length > 0 && existing.has(path)) steps.push({
|
|
287
286
|
action: "edit",
|
|
288
287
|
write: "scripts",
|
|
@@ -290,11 +289,11 @@ function scriptSteps(input, target) {
|
|
|
290
289
|
detail: added.join(", ")
|
|
291
290
|
});
|
|
292
291
|
}
|
|
293
|
-
if (workspace && !("
|
|
292
|
+
if (workspace && !("dex" in workspace.rootScripts)) steps.push({
|
|
294
293
|
action: "edit",
|
|
295
294
|
write: "root-script",
|
|
296
295
|
path: "package.json",
|
|
297
|
-
detail: `+ script "
|
|
296
|
+
detail: `+ script "dex": "${workspace.studioScript}"`
|
|
298
297
|
});
|
|
299
298
|
return steps;
|
|
300
299
|
}
|
|
@@ -348,6 +347,23 @@ function noteSteps(input, target) {
|
|
|
348
347
|
});
|
|
349
348
|
return notes;
|
|
350
349
|
}
|
|
350
|
+
/**
|
|
351
|
+
* With pnpm 11 or later, what the project says about esbuild's install
|
|
352
|
+
* script, when it says nothing yet and the studio is about to be installed:
|
|
353
|
+
* pnpm stops the install otherwise (write.ts, withEsbuildBuilds). pnpm 10
|
|
354
|
+
* only warns, so its projects keep their files as they are.
|
|
355
|
+
*/
|
|
356
|
+
function pnpmSteps(input) {
|
|
357
|
+
const yaml = input.pnpmWorkspace ?? "";
|
|
358
|
+
const installs = input.skipInstall || installSteps(input).some((step) => step.action === "run");
|
|
359
|
+
if (input.decisions.packageManager.value.name !== "pnpm" || !input.pnpmStopsOnBuilds || !installs || pnpmDecidesEsbuild(yaml) || withEsbuildBuilds(yaml) === void 0) return [];
|
|
360
|
+
return [{
|
|
361
|
+
action: input.pnpmWorkspace === void 0 ? "create" : "edit",
|
|
362
|
+
write: "pnpm-builds",
|
|
363
|
+
path: "pnpm-workspace.yaml",
|
|
364
|
+
detail: "+ allowBuilds: esbuild: false (the studio's Vite runs without its install script; pnpm 11 stops without a choice)"
|
|
365
|
+
}];
|
|
366
|
+
}
|
|
351
367
|
/** Every step `dex create` takes, in order. */
|
|
352
368
|
function planSetup(input) {
|
|
353
369
|
const target = input.target ?? {
|
|
@@ -356,7 +372,6 @@ function planSetup(input) {
|
|
|
356
372
|
studio: input.decisions.dir.value
|
|
357
373
|
};
|
|
358
374
|
return {
|
|
359
|
-
iconPackages: input.iconPackages,
|
|
360
375
|
studio: target.studio,
|
|
361
376
|
target,
|
|
362
377
|
...input.workspace ? { workspace: input.workspace } : {},
|
|
@@ -367,6 +382,7 @@ function planSetup(input) {
|
|
|
367
382
|
...projectSteps(input, target),
|
|
368
383
|
...agentSteps(input),
|
|
369
384
|
...noteSteps(input, target),
|
|
385
|
+
...pnpmSteps(input),
|
|
370
386
|
...installSteps(input)
|
|
371
387
|
]
|
|
372
388
|
};
|
|
@@ -394,4 +410,4 @@ function planCounts(plan) {
|
|
|
394
410
|
};
|
|
395
411
|
}
|
|
396
412
|
//#endregion
|
|
397
|
-
export { AGENT_FILES, addCommand, changesAnything, commandLine, inPackage, planCounts, planLines, planSetup };
|
|
413
|
+
export { AGENT_FILES, addCommand, changesAnything, commandLine, inPackage, installCommand, planCounts, planLines, planSetup };
|
package/dist/setup/project.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StylingApproach } from "../shared/design-system.mjs";
|
|
2
|
-
import { InterfaceIcons } from "../shared/icon-sets.mjs";
|
|
3
2
|
import { FoundDesignMd } from "./design-md.mjs";
|
|
4
3
|
import { Finding } from "./findings.mjs";
|
|
5
4
|
import { AgentId, ComponentLibrary } from "./detect.mjs";
|
|
@@ -25,11 +24,6 @@ export interface ComponentsChoice {
|
|
|
25
24
|
dir: string;
|
|
26
25
|
/** Relative to the project, with forward slashes: "src/components/ui". */
|
|
27
26
|
folder: string;
|
|
28
|
-
/**
|
|
29
|
-
* The icon set they draw with (components.json's iconLibrary), when the
|
|
30
|
-
* studio's interface has it too.
|
|
31
|
-
*/
|
|
32
|
-
icons?: InterfaceIcons;
|
|
33
27
|
/** How prototypes import them: "@/components/ui"; undefined when unknown. */
|
|
34
28
|
import: string | undefined;
|
|
35
29
|
/** The first few components' names, to recognise the folder by. */
|
|
@@ -91,12 +85,9 @@ export interface ProjectFindings {
|
|
|
91
85
|
imports: string[];
|
|
92
86
|
styling: StylingApproach | undefined;
|
|
93
87
|
};
|
|
94
|
-
/** The icon set the project draws with already, else Lucide. */
|
|
95
|
-
icons: Finding<InterfaceIcons>;
|
|
96
88
|
/** The package's name, from package.json. */
|
|
97
89
|
name: string | undefined;
|
|
98
90
|
packageManager: Finding<PackageManagerChoice>;
|
|
99
|
-
primitives: Finding<boolean>;
|
|
100
91
|
/** A provider the design system needs around every view, when it needs one. */
|
|
101
92
|
provider: Finding<ProviderNeed | undefined>;
|
|
102
93
|
/** Absolute: the project's folder. */
|
|
@@ -116,13 +107,6 @@ export interface ProjectFindings {
|
|
|
116
107
|
export declare function componentsChoice(library: ComponentLibrary, root: string): ComponentsChoice;
|
|
117
108
|
/** The components in a folder someone named, as setup offers them. */
|
|
118
109
|
export declare const componentsAt: (root: string, folder: string) => ComponentsChoice;
|
|
119
|
-
/**
|
|
120
|
-
* `source` names the components.json. Beside Lucide, which shadcn's
|
|
121
|
-
* components bring, another set is the one chosen.
|
|
122
|
-
*/
|
|
123
|
-
export declare function iconsFinding(root: string, components: ComponentsChoice | undefined, source: string): Finding<InterfaceIcons>;
|
|
124
|
-
/** At the range @dexhq/canvas asks for; Lucide's comes with @dexhq/canvas. */
|
|
125
|
-
export declare function iconPackagesToAdd(set: InterfaceIcons, dir: string): Record<string, string>;
|
|
126
110
|
export declare const agentName: (id: AgentId) => string;
|
|
127
111
|
/**
|
|
128
112
|
* How to connect an agent from the studio's "Connect your agent" dialog:
|
|
@@ -140,7 +124,12 @@ export declare const USER_AGENT_RE: RegExp;
|
|
|
140
124
|
export declare function packageManagerFinding(root: string, { userAgent }?: {
|
|
141
125
|
userAgent?: string;
|
|
142
126
|
}): Promise<Finding<PackageManagerChoice>>;
|
|
143
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* Where the project already resolves the studio from, if it does. Its own
|
|
129
|
+
* node_modules' entry is kept as it is, so `isLinked` sees a `bun link`; one
|
|
130
|
+
* above is followed through its links, as Node resolves it, so a workspace's
|
|
131
|
+
* install is never taken for a link.
|
|
132
|
+
*/
|
|
144
133
|
export declare function resolvedStudio(root: string): string | undefined;
|
|
145
134
|
/** Whether the studio is a dependency already, linked in, or neither. */
|
|
146
135
|
export declare function studioPackage(root: string): StudioPackage;
|
package/dist/setup/project.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { PACKAGE_NAME, posix as posix$1
|
|
1
|
+
import { PACKAGE_NAME, posix as posix$1 } from "../paths.mjs";
|
|
2
2
|
import { STUDIO_FILES } from "../shared/studio-files.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import { dependenciesOf, exportedComponents, filesImport, packageAt, packageFolder } from "../config/project-files.mjs";
|
|
3
|
+
import { dependenciesOf, exportedComponents, filesImport, installedPackageDir, packageAt, packageFolder } from "../config/project-files.mjs";
|
|
5
4
|
import { found } from "./findings.mjs";
|
|
6
5
|
import { findWorkspace, isInside } from "./detect/workspace.mjs";
|
|
7
6
|
import { designMdFinding } from "./design-md-setup.mjs";
|
|
8
|
-
import { builtGlobalCss, componentLibraries, detectAgentsWithEvidence, detectDesignSystem, globalCssFiles, isMixedFolder, libraryAt } from "./detect.mjs";
|
|
7
|
+
import { builtGlobalCss, componentLibraries, detectAgentsWithEvidence, detectDesignSystem, globalCssFiles, isMixedFolder, libraryAt, runningAgent } from "./detect.mjs";
|
|
9
8
|
import { providerFinding } from "./provider.mjs";
|
|
10
|
-
import { createRequire } from "node:module";
|
|
11
9
|
import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
12
10
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
13
11
|
import { detect } from "package-manager-detector/detect";
|
|
@@ -45,7 +43,6 @@ function componentsChoice(library, root) {
|
|
|
45
43
|
count: library.components.length,
|
|
46
44
|
names: library.components.slice(0, NAMES_SHOWN).map(({ path }) => path),
|
|
47
45
|
baseUi: Boolean(library.baseUi),
|
|
48
|
-
...library.icons ? { icons: library.icons } : {},
|
|
49
46
|
styles: library.globalCss ? posix$1(library.globalCss) : void 0
|
|
50
47
|
};
|
|
51
48
|
}
|
|
@@ -105,50 +102,6 @@ function stylesFinding(root, components, source) {
|
|
|
105
102
|
}
|
|
106
103
|
return found(first, `${first} imports Tailwind or defines tokens`, "likely", rest);
|
|
107
104
|
}
|
|
108
|
-
function primitivesFinding(components, source) {
|
|
109
|
-
if (components?.baseUi && components.import) return found(true, `${source} → style is shadcn on Base UI`);
|
|
110
|
-
return found(false, components ? "your components are not shadcn on Base UI" : "no components to build it from");
|
|
111
|
-
}
|
|
112
|
-
/** Icon packages people draw with that Dex's interface has no set for. */
|
|
113
|
-
const OTHER_ICON_PACKAGES = [
|
|
114
|
-
"@heroicons/react",
|
|
115
|
-
"@primer/octicons-react",
|
|
116
|
-
"@radix-ui/react-icons",
|
|
117
|
-
"@tabler/icons-react",
|
|
118
|
-
"@mui/icons-material",
|
|
119
|
-
"@fortawesome/react-fontawesome",
|
|
120
|
-
"@iconify/react",
|
|
121
|
-
"@remixicon/react",
|
|
122
|
-
"react-icons"
|
|
123
|
-
];
|
|
124
|
-
/**
|
|
125
|
-
* `source` names the components.json. Beside Lucide, which shadcn's
|
|
126
|
-
* components bring, another set is the one chosen.
|
|
127
|
-
*/
|
|
128
|
-
function iconsFinding(root, components, source) {
|
|
129
|
-
if (components?.icons) return found(components.icons, `${source} → iconLibrary`, "certain");
|
|
130
|
-
const home = components && packageFolder(components.dir);
|
|
131
|
-
const manifests = [...home && home !== root ? [home] : [], root];
|
|
132
|
-
const [first, ...rest] = manifests.flatMap((dir) => iconSetsIn(dependenciesOf(dir).all).sort((a, b) => Number(a === "lucide") - Number(b === "lucide")).map((set) => ({
|
|
133
|
-
dir,
|
|
134
|
-
set
|
|
135
|
-
})));
|
|
136
|
-
if (!first) {
|
|
137
|
-
const other = manifests.flatMap((dir) => {
|
|
138
|
-
const { all } = dependenciesOf(dir);
|
|
139
|
-
return OTHER_ICON_PACKAGES.filter((name) => all[name]);
|
|
140
|
-
}).at(0);
|
|
141
|
-
return found("lucide", other ? `${other} isn't one Dex draws with, so Lucide` : "no iconLibrary in components.json, and no icon set in package.json, so Lucide", "likely");
|
|
142
|
-
}
|
|
143
|
-
const others = [...new Set(rest.map(({ set }) => set))].filter((set) => set !== first.set);
|
|
144
|
-
return found(first.set, `${shown(root, join(first.dir, "package.json"))} → ${ICON_SET_PACKAGES[first.set][0]}`, others.length > 0 ? "guess" : "likely", others);
|
|
145
|
-
}
|
|
146
|
-
/** At the range @dexhq/canvas asks for; Lucide's comes with @dexhq/canvas. */
|
|
147
|
-
function iconPackagesToAdd(set, dir) {
|
|
148
|
-
if (set === "lucide") return {};
|
|
149
|
-
const declared = dependenciesOf(dir).all;
|
|
150
|
-
return Object.fromEntries(ICON_SET_PACKAGES[set].filter((name) => !declared[name]).map((name) => [name, studioPeer(name) ?? "*"]));
|
|
151
|
-
}
|
|
152
105
|
const AGENT_NAMES = {
|
|
153
106
|
claude: "Claude Code",
|
|
154
107
|
codex: "Codex",
|
|
@@ -166,7 +119,11 @@ const AGENT_IDS = Object.keys(AGENT_NAMES);
|
|
|
166
119
|
function agentsFinding(root) {
|
|
167
120
|
const agents = detectAgentsWithEvidence(root);
|
|
168
121
|
if (agents.length === 0) return found([], "no agent's files in this folder", "likely");
|
|
169
|
-
|
|
122
|
+
const running = runningAgent();
|
|
123
|
+
const files = agents.filter(({ id }) => id !== running?.id).map(({ evidence }) => evidence);
|
|
124
|
+
const said = [...running ? [`running this: ${running.evidence} is set`] : [], ...files.length > 0 ? [`found ${files.join(", ")}`] : []].join("; ");
|
|
125
|
+
const onlyGuide = agents.length === 1 && agents[0]?.evidence === "AGENTS.md";
|
|
126
|
+
return found(agents.map(({ id }) => id), said, onlyGuide ? "likely" : "certain");
|
|
170
127
|
}
|
|
171
128
|
const LOCKFILES = [
|
|
172
129
|
["bun.lock", "bun"],
|
|
@@ -210,16 +167,17 @@ async function packageManagerFinding(root, { userAgent = process.env.npm_config_
|
|
|
210
167
|
agent: "npm"
|
|
211
168
|
}, "no lockfile, so npm", "guess");
|
|
212
169
|
}
|
|
213
|
-
/**
|
|
170
|
+
/**
|
|
171
|
+
* Where the project already resolves the studio from, if it does. Its own
|
|
172
|
+
* node_modules' entry is kept as it is, so `isLinked` sees a `bun link`; one
|
|
173
|
+
* above is followed through its links, as Node resolves it, so a workspace's
|
|
174
|
+
* install is never taken for a link.
|
|
175
|
+
*/
|
|
214
176
|
function resolvedStudio(root) {
|
|
215
177
|
const local = join(root, "node_modules", PACKAGE_NAME);
|
|
216
178
|
if (existsSync(join(local, "package.json"))) return local;
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
return dirname(require.resolve(`${PACKAGE_NAME}/package.json`));
|
|
220
|
-
} catch {
|
|
221
|
-
return;
|
|
222
|
-
}
|
|
179
|
+
const above = installedPackageDir(dirname(resolve(root)), PACKAGE_NAME);
|
|
180
|
+
return above && realpathSync(above);
|
|
223
181
|
}
|
|
224
182
|
/**
|
|
225
183
|
* Whether `dir` is a link to a studio outside the project (`bun link`, `npm
|
|
@@ -286,8 +244,6 @@ async function findProject(root, options = {}) {
|
|
|
286
244
|
...workspace.isWorkspace ? { workspaceRoot: workspace.root } : {}
|
|
287
245
|
}),
|
|
288
246
|
styles: stylesFinding(root, components.value, source),
|
|
289
|
-
primitives: primitivesFinding(components.value, source),
|
|
290
|
-
icons: iconsFinding(root, components.value, source),
|
|
291
247
|
provider: providerFinding(root),
|
|
292
248
|
agents: agentsFinding(agentRoot),
|
|
293
249
|
packageManager: await packageManagerFinding(agentRoot, options),
|
|
@@ -296,4 +252,4 @@ async function findProject(root, options = {}) {
|
|
|
296
252
|
};
|
|
297
253
|
}
|
|
298
254
|
//#endregion
|
|
299
|
-
export { AGENT_IDS, CREATE_COMMAND, USER_AGENT_RE, agentName, componentsAt, componentsChoice, connectInStudio, createCommandFor, findProject,
|
|
255
|
+
export { AGENT_IDS, CREATE_COMMAND, USER_AGENT_RE, agentName, componentsAt, componentsChoice, connectInStudio, createCommandFor, findProject, packageManagerFinding, resolvedStudio, studioPackage };
|
package/dist/setup/prompts.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Reporter } from "../cli/ui.mjs";
|
|
2
|
-
import { InterfaceIcons } from "../shared/icon-sets.mjs";
|
|
3
2
|
import { DesignMdDecision } from "./design-md-setup.mjs";
|
|
4
3
|
import { AgentId } from "./detect.mjs";
|
|
5
4
|
import { ComponentsChoice, PackageManagerName, ProjectFindings } from "./project.mjs";
|
|
@@ -9,6 +8,8 @@ import { ComponentsDecision, Decided, SetupDecisions } from "./questions.mjs";
|
|
|
9
8
|
export interface SetupFlags {
|
|
10
9
|
/** The agents to connect: "claude,codex", or "none". */
|
|
11
10
|
agent?: string;
|
|
11
|
+
/** shadcn's component library for `shadcn init`. Sets up shadcn. */
|
|
12
|
+
base?: string;
|
|
12
13
|
/** The components' folder, or "none". */
|
|
13
14
|
components?: string;
|
|
14
15
|
/** How DESIGN.md starts: "draft", "none", a file to link or import, or a URL. */
|
|
@@ -17,14 +18,14 @@ export interface SetupFlags {
|
|
|
17
18
|
dir?: string;
|
|
18
19
|
/** Say what it would do, and do nothing. */
|
|
19
20
|
dryRun?: boolean;
|
|
20
|
-
/** The icon set the interface draws with: "lucide", "phosphor" or "hugeicons". */
|
|
21
|
-
icons?: string;
|
|
22
21
|
/** How prototypes import the components, when it cannot be derived. */
|
|
23
22
|
import?: string;
|
|
24
23
|
json?: boolean;
|
|
25
24
|
/** The package manager, instead of the detected one. */
|
|
26
25
|
pm?: string;
|
|
27
|
-
/**
|
|
26
|
+
/** shadcn's preset for `shadcn init`: a name or a code. Sets up shadcn. */
|
|
27
|
+
preset?: string;
|
|
28
|
+
/** Build the studio's interface from the components: off unless true. */
|
|
28
29
|
primitives?: boolean;
|
|
29
30
|
/** The module that wraps every prototype view, or "none". */
|
|
30
31
|
provider?: string;
|
|
@@ -52,7 +53,6 @@ export declare const NO_STYLES = "--styles none";
|
|
|
52
53
|
/** "4 components: Badge, Button, Card, Input". */
|
|
53
54
|
export declare const describeComponents: (choice: ComponentsChoice) => string;
|
|
54
55
|
export declare function showComponents(decision: ComponentsDecision): string;
|
|
55
|
-
export declare function iconSet(flag: string): InterfaceIcons;
|
|
56
56
|
/** The folder a draft names stylesheets from: the workspace, else the project. */
|
|
57
57
|
export declare const repositoryRoot: (findings: ProjectFindings) => string;
|
|
58
58
|
export declare function showDesignMd(decision: DesignMdDecision, root: string): string;
|