@dexhq/canvas 0.14.0 → 0.16.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 +70 -0
- package/README.md +5 -3
- package/app/canvas/activity-parts.tsx +50 -6
- package/app/canvas/activity.tsx +10 -18
- package/app/canvas/agent-changes.ts +18 -8
- package/app/canvas/anchoring.ts +15 -7
- package/app/canvas/canvas-context.tsx +6 -2
- package/app/canvas/canvas-input.ts +186 -14
- package/app/canvas/canvas-keys.ts +9 -0
- package/app/canvas/canvas-model.ts +7 -44
- package/app/canvas/canvas-panels.ts +1 -17
- package/app/canvas/canvas-scene.ts +250 -27
- package/app/canvas/canvas-ui.ts +13 -3
- package/app/canvas/canvas.css +147 -29
- package/app/canvas/change-notice.tsx +10 -1
- package/app/canvas/comment-layer.tsx +2 -1
- package/app/canvas/comments.tsx +270 -111
- package/app/canvas/element-link.ts +135 -0
- package/app/canvas/element-picker.ts +223 -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/export-dialog.tsx +265 -0
- package/app/canvas/find-bar.tsx +817 -0
- package/app/canvas/find-model.ts +135 -0
- package/app/canvas/flow-canvas.tsx +83 -16
- package/app/canvas/follow-pin.ts +26 -6
- package/app/canvas/frame-context-menu.tsx +61 -7
- package/app/canvas/frame-node.tsx +19 -20
- package/app/canvas/imported-reviews.tsx +12 -22
- package/app/canvas/layout.ts +68 -22
- package/app/canvas/linked-element.tsx +196 -0
- package/app/canvas/live-page.ts +156 -19
- package/app/canvas/mentions.tsx +209 -0
- package/app/canvas/page-find.ts +220 -0
- package/app/canvas/page-style.ts +23 -0
- package/app/canvas/picked-box.tsx +21 -0
- package/app/canvas/removed-views-panel.tsx +4 -4
- package/app/canvas/request-node.tsx +151 -0
- package/app/canvas/review-panel.tsx +8 -3
- package/app/canvas/section-node.tsx +6 -133
- package/app/canvas/spec-margin.tsx +4 -1
- package/app/canvas/spec-threads.ts +24 -23
- package/app/canvas/teammates-layer.tsx +205 -0
- package/app/canvas/text-layer.tsx +103 -17
- package/app/canvas/thread-focus.tsx +14 -12
- package/app/canvas/tool-cursors.ts +7 -6
- package/app/canvas/tool-icons.tsx +24 -56
- package/app/canvas/typing.ts +12 -0
- package/app/canvas/use-activity.ts +0 -8
- package/app/canvas/use-agent-changes.tsx +40 -42
- package/app/canvas/use-canvas-clipboard.tsx +11 -14
- package/app/canvas/use-canvas-editor.ts +4 -2
- package/app/canvas/xray.ts +3 -12
- package/app/export/player-model.ts +159 -0
- package/app/export/player.tsx +198 -0
- package/app/export.html +31 -0
- package/app/export.tsx +9 -0
- package/app/frame/announce-refreshes.ts +21 -0
- package/app/frame/start-frame.tsx +50 -0
- package/app/frame/view-loads.ts +161 -0
- package/app/frame/views.ts +13 -49
- package/app/frame.tsx +2 -33
- package/app/i18n/locales/en/messages.po +233 -14
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +232 -13
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/dex-glyphs.tsx +219 -0
- package/app/icons/glyphs.tsx +80 -80
- package/app/kit/use-flow.ts +2 -1
- package/app/live/canvas-teammates.ts +90 -0
- package/app/live/studio-api.ts +30 -20
- package/app/main.tsx +3 -0
- package/app/pages/canvas.tsx +45 -14
- package/app/pages/commands-settings.tsx +17 -3
- package/app/pages/render.tsx +39 -11
- package/app/shell/bell.tsx +15 -5
- package/app/shell/feedback-form.tsx +10 -21
- package/app/shell/feedback-link.tsx +2 -1
- package/app/shell/presence.tsx +123 -26
- package/app/shell/scaled-frame.tsx +21 -9
- package/app/shell/thread-list.tsx +25 -8
- package/app/shell/working-on.tsx +35 -3
- package/app/types.ts +21 -205
- package/app/ui/file-drop.ts +128 -0
- package/app/ui/prompt-editor.tsx +39 -11
- package/app/ui/reference.tsx +21 -8
- package/app/ui/shadcn/input-group.tsx +2 -2
- package/bin/sudio.mjs +1 -1
- 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 +5 -5
- package/dist/cli/commands/create.mjs +4 -4
- package/dist/cli/commands/export.d.mts +40 -0
- package/dist/cli/commands/export.mjs +66 -0
- package/dist/cli/commands/hook.mjs +2 -1
- package/dist/cli/commands/init.d.mts +2 -2
- package/dist/cli/commands/upgrade.mjs +1 -1
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +13 -7
- package/dist/cli/main.d.mts +42 -5
- package/dist/cli/main.mjs +1 -0
- package/dist/config/load.mjs +14 -2
- package/dist/config/project-files.d.mts +11 -0
- package/dist/config/project-files.mjs +23 -2
- package/dist/config/renamed.d.mts +7 -2
- package/dist/config/renamed.mjs +13 -3
- package/dist/content/capture.d.mts +2 -2
- package/dist/content/capture.mjs +2 -2
- package/dist/content/commands.d.mts +11 -9
- package/dist/content/commands.mjs +22 -16
- package/dist/content/comments-log.mjs +2 -1
- package/dist/content/content.d.mts +13 -143
- package/dist/content/content.mjs +55 -76
- package/dist/content/element-words.d.mts +42 -0
- package/dist/content/element-words.mjs +112 -0
- package/dist/content/flow-specs.mjs +1 -1
- package/dist/content/hosted-person.d.mts +31 -0
- package/dist/content/hosted-person.mjs +68 -0
- package/dist/content/merge-rules.d.mts +5 -0
- package/dist/content/merge-rules.mjs +17 -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/screenshot.mjs +9 -0
- package/dist/content/text-edit.d.mts +24 -14
- package/dist/content/text-edit.mjs +92 -81
- package/dist/content/text-replace.d.mts +30 -0
- package/dist/content/text-replace.mjs +285 -0
- package/dist/content/thread-module.d.mts +2 -4
- package/dist/content/thread-module.mjs +4 -5
- package/dist/content/threads.mjs +1 -1
- package/dist/paste/paste.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/agents.d.mts +10 -0
- package/dist/server/agents.mjs +21 -6
- package/dist/server/build-pictures.mjs +1 -1
- package/dist/server/canvas-presence.d.mts +22 -0
- package/dist/server/canvas-presence.mjs +160 -0
- package/dist/server/channel.d.mts +13 -24
- package/dist/server/channel.mjs +55 -37
- package/dist/server/claimed-presence.d.mts +3 -2
- package/dist/server/claimed-presence.mjs +15 -7
- package/dist/server/close-check.mjs +2 -2
- package/dist/server/command-settings.mjs +1 -1
- package/dist/server/comments/actions.d.mts +145 -0
- package/dist/server/comments/actions.mjs +146 -0
- package/dist/server/comments/routes.d.mts +25 -0
- package/dist/server/comments/routes.mjs +67 -0
- package/dist/server/comments/tools.d.mts +6 -0
- package/dist/server/comments/tools.mjs +154 -0
- package/dist/server/dev-server.mjs +59 -23
- package/dist/server/export/build.d.mts +15 -0
- package/dist/server/export/build.mjs +220 -0
- package/dist/server/export/page.d.mts +25 -0
- package/dist/server/export/page.mjs +40 -0
- package/dist/server/export/plugin.d.mts +31 -0
- package/dist/server/export/plugin.mjs +69 -0
- package/dist/server/export/run.d.mts +9 -0
- package/dist/server/export/run.mjs +61 -0
- package/dist/server/export/save.d.mts +7 -0
- package/dist/server/export/save.mjs +29 -0
- package/dist/server/file-lock.d.mts +2 -2
- package/dist/server/file-lock.mjs +130 -36
- package/dist/server/hosted.d.mts +8 -0
- package/dist/server/hosted.mjs +78 -0
- package/dist/server/live-mirror.mjs +66 -10
- package/dist/server/live.mjs +28 -1
- package/dist/server/mcp.d.mts +0 -2
- package/dist/server/mcp.mjs +9 -8
- package/dist/server/me.d.mts +3 -1
- package/dist/server/me.mjs +8 -2
- package/dist/server/notices.d.mts +1 -1
- package/dist/server/notices.mjs +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 +1 -1
- package/dist/server/people.d.mts +8 -3
- package/dist/server/people.mjs +6 -2
- package/dist/server/pictures.d.mts +1 -1
- package/dist/server/pictures.mjs +2 -2
- package/dist/server/port.d.mts +12 -0
- package/dist/server/port.mjs +66 -14
- package/dist/server/prebundle.d.mts +32 -0
- package/dist/server/prebundle.mjs +115 -0
- package/dist/server/presence.d.mts +4 -1
- package/dist/server/presence.mjs +2 -2
- package/dist/server/problems.d.mts +8 -0
- package/dist/server/problems.mjs +13 -0
- package/dist/server/requests.d.mts +5 -1
- package/dist/server/requests.mjs +76 -78
- package/dist/server/source-stamp.d.mts +4 -3
- package/dist/server/source-stamp.mjs +60 -31
- package/dist/server/state.d.mts +19 -10
- package/dist/server/state.mjs +27 -18
- package/dist/server/studio-for.d.mts +5 -0
- package/dist/server/studio-for.mjs +17 -3
- package/dist/server/sync-install.d.mts +8 -12
- package/dist/server/sync-install.mjs +12 -30
- package/dist/server/thread-source.d.mts +8 -0
- package/dist/server/thread-source.mjs +25 -6
- package/dist/server/tools/describe.d.mts +1 -1
- package/dist/server/tools/describe.mjs +1 -1
- package/dist/server/tools/export.d.mts +5 -0
- package/dist/server/tools/export.mjs +35 -0
- package/dist/server/tools/feedback.d.mts +1 -1
- package/dist/server/tools/place-frame.mjs +16 -16
- 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 +2 -2
- package/dist/server/tools/watch.mjs +5 -3
- package/dist/server/vite.d.mts +9 -4
- package/dist/server/vite.mjs +65 -63
- package/dist/server/web-app.mjs +4 -7
- package/dist/server/welcome.mjs +2 -1
- package/dist/server/work-groups.mjs +1 -1
- package/dist/setup/apply.d.mts +4 -0
- package/dist/setup/apply.mjs +5 -4
- package/dist/setup/create.d.mts +4 -2
- package/dist/setup/create.mjs +72 -22
- package/dist/setup/design-system-checks.mjs +3 -17
- 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 +19 -3
- package/dist/setup/detect/workspace.d.mts +10 -10
- package/dist/setup/detect/workspace.mjs +10 -12
- package/dist/setup/detect.d.mts +0 -2
- package/dist/setup/detect.mjs +1 -3
- package/dist/setup/doctor.d.mts +4 -1
- package/dist/setup/doctor.mjs +8 -6
- package/dist/setup/migrate/dex-folder.d.mts +61 -0
- package/dist/setup/migrate/dex-folder.mjs +544 -0
- package/dist/setup/migrate/files-folder.mjs +1 -1
- package/dist/setup/migrate/guides.mjs +1 -1
- package/dist/setup/migrate/migrations.mjs +4 -0
- package/dist/setup/migrate/row-titles.mjs +1 -1
- package/dist/setup/migrate/setup-files.d.mts +5 -0
- package/dist/setup/migrate/setup-files.mjs +115 -0
- package/dist/setup/migrate/studio-state.d.mts +2 -2
- package/dist/setup/migrate/studio-state.mjs +4 -4
- package/dist/setup/placement.d.mts +1 -1
- package/dist/setup/placement.mjs +5 -4
- package/dist/setup/plan.d.mts +5 -5
- package/dist/setup/plan.mjs +8 -12
- package/dist/setup/project.d.mts +6 -1
- package/dist/setup/project.mjs +10 -10
- package/dist/setup/prompts.d.mts +2 -1
- package/dist/setup/prompts.mjs +4 -3
- package/dist/setup/questions.mjs +3 -2
- package/dist/setup/starters.d.mts +3 -1
- package/dist/setup/starters.mjs +9 -3
- package/dist/setup/write.d.mts +15 -3
- package/dist/setup/write.mjs +23 -3
- package/dist/shared/annotations-core.mjs +1 -1
- package/dist/shared/canvas-core.d.mts +22 -7
- package/dist/shared/canvas-core.mjs +39 -11
- package/dist/shared/canvas-file.d.mts +201 -0
- package/dist/shared/canvas-file.mjs +1 -0
- package/dist/shared/comments/routes.d.mts +55 -0
- package/dist/shared/comments/routes.mjs +39 -0
- package/dist/shared/export-core.d.mts +62 -0
- package/dist/shared/export-core.mjs +101 -0
- package/dist/shared/feedback.d.mts +8 -0
- package/dist/shared/feedback.mjs +10 -2
- package/dist/shared/live-core.d.mts +2 -0
- package/dist/shared/live-core.mjs +6 -1
- package/dist/shared/live-presence.d.mts +57 -2
- package/dist/shared/live-presence.mjs +90 -4
- package/dist/shared/page-messages.d.mts +14 -1
- package/dist/shared/page-messages.mjs +30 -3
- package/dist/shared/page-review.d.mts +2 -11
- package/dist/shared/page-review.mjs +4 -13
- package/dist/shared/people-core.d.mts +28 -0
- package/dist/shared/people-core.mjs +27 -1
- package/dist/shared/presence-core.d.mts +13 -0
- package/dist/shared/presence-core.mjs +11 -2
- package/dist/shared/references-core.d.mts +4 -0
- package/dist/shared/references-core.mjs +12 -4
- package/dist/shared/review-file.d.mts +5 -0
- package/dist/shared/review-file.mjs +23 -13
- package/dist/shared/server-page.mjs +1 -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 +21 -0
- package/dist/shared/studio-files.mjs +16 -2
- package/dist/shared/studio-routes.d.mts +29 -63
- package/dist/shared/studio-routes.mjs +1 -69
- package/dist/shared/threads-core.d.mts +29 -6
- package/dist/shared/threads-core.mjs +68 -13
- package/extension/dist/feedback.js +104 -284
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +104 -284
- package/package.json +2 -2
- package/src/cli/banner.ts +45 -11
- package/src/cli/commands/app.ts +23 -8
- package/src/cli/commands/create.ts +4 -4
- package/src/cli/commands/export.ts +78 -0
- package/src/cli/commands/hook.ts +4 -1
- package/src/cli/commands/upgrade.ts +1 -1
- package/src/cli/help.ts +13 -7
- package/src/cli/main.ts +1 -0
- package/src/config/load.ts +26 -2
- package/src/config/project-files.ts +36 -6
- package/src/config/renamed.ts +19 -4
- package/src/content/capture.ts +6 -12
- package/src/content/commands.ts +30 -18
- package/src/content/comments-log.ts +4 -1
- package/src/content/content.ts +71 -257
- package/src/content/element-words.ts +175 -0
- package/src/content/flow-specs.ts +2 -1
- package/src/content/hosted-person.ts +107 -0
- package/src/content/merge-rules.ts +29 -0
- package/src/content/prototype-summary.ts +4 -44
- package/src/content/review-pages.ts +2 -1
- package/src/content/screenshot.ts +14 -0
- package/src/content/text-edit.ts +172 -105
- package/src/content/text-replace.ts +420 -0
- package/src/content/thread-module.ts +2 -4
- package/src/content/trash.ts +1 -1
- 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/agents.ts +48 -17
- package/src/server/canvas-presence.ts +237 -0
- package/src/server/channel.ts +95 -53
- package/src/server/claimed-presence.ts +26 -10
- package/src/server/command-settings.ts +1 -1
- package/src/server/comments/actions.ts +333 -0
- package/src/server/comments/routes.ts +131 -0
- package/src/server/comments/tools.ts +317 -0
- package/src/server/dev-server.ts +94 -33
- package/src/server/export/build.ts +310 -0
- package/src/server/export/page.ts +85 -0
- package/src/server/export/plugin.ts +138 -0
- package/src/server/export/run.ts +79 -0
- package/src/server/export/save.ts +38 -0
- package/src/server/file-lock.ts +205 -54
- package/src/server/hosted.ts +113 -0
- package/src/server/live-mirror.ts +93 -8
- package/src/server/live.ts +46 -1
- package/src/server/machine-update.ts +3 -3
- package/src/server/mcp.ts +15 -14
- package/src/server/me.ts +12 -6
- package/src/server/notices.ts +2 -2
- package/src/server/open-page.ts +54 -4
- package/src/server/outcome.ts +26 -0
- package/src/server/people.ts +13 -3
- package/src/server/pictures.ts +2 -2
- package/src/server/port.ts +94 -20
- package/src/server/prebundle.ts +230 -0
- package/src/server/presence.ts +12 -4
- package/src/server/problems.ts +11 -0
- package/src/server/requests.ts +115 -110
- package/src/server/roster.ts +1 -1
- package/src/server/saved.ts +1 -1
- package/src/server/source-stamp.ts +118 -37
- package/src/server/state.ts +53 -31
- package/src/server/studio-for.ts +26 -2
- package/src/server/sync-install.ts +35 -26
- package/src/server/thread-place.ts +2 -4
- package/src/server/thread-source.ts +35 -3
- package/src/server/tools/export.ts +56 -0
- package/src/server/tools/place-frame.ts +23 -15
- package/src/server/tools/reading.ts +16 -3
- package/src/server/tools/thread-list.ts +1 -1
- package/src/server/tools/watch.ts +7 -7
- package/src/server/updates.ts +2 -2
- package/src/server/vite.ts +106 -110
- package/src/server/web-app.ts +11 -9
- package/src/server/welcome.ts +3 -1
- package/src/setup/apply.ts +8 -5
- package/src/setup/create.ts +101 -27
- package/src/setup/design-system-checks.ts +8 -21
- package/src/setup/desktop-app-script.ts +4 -3
- package/src/setup/desktop-app-start.ts +94 -26
- package/src/setup/desktop-app.ts +23 -2
- package/src/setup/detect/workspace.ts +20 -21
- package/src/setup/detect.ts +0 -4
- package/src/setup/doctor.ts +13 -6
- package/src/setup/migrate/dex-folder.ts +842 -0
- package/src/setup/migrate/files-folder.ts +1 -1
- package/src/setup/migrate/guides.ts +3 -1
- package/src/setup/migrate/migrations.ts +8 -2
- package/src/setup/migrate/setup-files.ts +198 -0
- package/src/setup/migrate/studio-state.ts +12 -10
- package/src/setup/own-app.ts +1 -1
- package/src/setup/placement.ts +7 -6
- package/src/setup/plan.ts +13 -18
- package/src/setup/project.ts +11 -10
- package/src/setup/prompts.ts +5 -4
- package/src/setup/questions.ts +6 -3
- package/src/setup/starters.ts +11 -4
- package/src/setup/write.ts +34 -3
- package/src/shared/canvas-core.ts +48 -9
- package/src/shared/canvas-file.ts +205 -0
- package/src/shared/comments/routes.ts +81 -0
- package/src/shared/export-core.ts +198 -0
- package/src/shared/feedback.ts +14 -4
- package/src/shared/live-core.ts +8 -0
- package/src/shared/live-presence.ts +171 -2
- package/src/shared/page-messages.ts +38 -2
- package/src/shared/page-review.ts +11 -16
- package/src/shared/people-core.ts +44 -0
- package/src/shared/presence-core.ts +18 -2
- package/src/shared/references-core.ts +22 -3
- package/src/shared/review-file.ts +28 -12
- package/src/shared/server-page.ts +2 -1
- package/src/shared/signup.ts +4 -28
- package/src/shared/studio-events.ts +0 -13
- package/src/shared/studio-files.ts +29 -1
- package/src/shared/studio-routes.ts +32 -65
- package/src/shared/threads-core.ts +134 -12
- package/templates/methods/explore.md +1 -1
- package/templates/methods/handoff.md +1 -1
- package/templates/methods/review.md +2 -1
- package/templates/rules/canvas-frames.md +6 -3
- package/templates/rules/commands.md +1 -0
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/studio.md +17 -11
- package/templates/skills/comprehend/SKILL.md +56 -0
- package/templates/skills/distill/SKILL.md +172 -0
- package/templates/skills/export-prototype/SKILL.md +35 -0
- package/templates/skills/riff/SKILL.md +21 -0
- package/templates/skills/riff-deep/SKILL.md +40 -0
- package/templates/skills/riff-max/SKILL.md +46 -0
- package/templates/skills/riff-state/SKILL.md +45 -0
- package/templates/skills/riff-up/SKILL.md +38 -0
- package/templates/skills/riff-wide/SKILL.md +40 -0
- package/templates/starters/standalone/README.md +1 -1
- package/templates/starters/turborepo/README.md +2 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +2 -2
- package/templates/starters/vite/README.md +1 -1
- 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/src/server/tools/close-reply.ts +0 -271
- package/src/server/tools/comment.ts +0 -96
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { posix as posix$1 } from "../../paths.mjs";
|
|
2
|
+
import { MERGE_RULES, withNewMerges } from "../../content/merge-rules.mjs";
|
|
3
|
+
import { UPGRADE_COMMAND } from "./migration.mjs";
|
|
4
|
+
import { listing } from "../../shared/listing.mjs";
|
|
5
|
+
import { AGENTS, addAgent, agentRootOf, agentSetups } from "../../server/agents.mjs";
|
|
6
|
+
import { STUDIO_TYPES, STUDIO_TYPES_FILE, copiesPaths, renamedScripts } from "../write.mjs";
|
|
7
|
+
import { AGENT_FILES } from "../plan.mjs";
|
|
8
|
+
import { editManifest, studioTsconfig } from "../apply.mjs";
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import { join, relative, resolve } from "node:path";
|
|
11
|
+
import { readFile, writeFile } from "node:fs/promises";
|
|
12
|
+
//#region src/setup/migrate/setup-files.ts
|
|
13
|
+
const readIfThere = async (file) => existsSync(file) ? await readFile(file, "utf8") : void 0;
|
|
14
|
+
/** Agents whose config has the studio only under an older name. */
|
|
15
|
+
async function agentChanges({ root, content }) {
|
|
16
|
+
const agentRoot = agentRootOf(root);
|
|
17
|
+
return (await agentSetups(root, content, agentRoot)).flatMap(({ id, old, oneClick }) => {
|
|
18
|
+
if (!(old && oneClick && id !== "other")) return [];
|
|
19
|
+
const files = AGENT_FILES[id].filter((file) => existsSync(join(agentRoot, file)));
|
|
20
|
+
return [{
|
|
21
|
+
does: `${listing(files)} (${AGENTS[id].name ?? id})`,
|
|
22
|
+
path: join(agentRoot, files[0] ?? ""),
|
|
23
|
+
write: () => addAgent(id, root, content, agentRoot)
|
|
24
|
+
}];
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
/** The studio's tsconfig, when it copies paths as setups before 0.13 did. */
|
|
28
|
+
async function tsconfigChanges({ root, content }) {
|
|
29
|
+
const path = join(content, "tsconfig.json");
|
|
30
|
+
const own = resolve(content) === resolve(root);
|
|
31
|
+
const text = await readIfThere(path);
|
|
32
|
+
if (own || text === void 0 || !copiesPaths(text)) return [];
|
|
33
|
+
const types = join(content, STUDIO_TYPES_FILE);
|
|
34
|
+
return [{
|
|
35
|
+
does: posix$1(relative(root, path)),
|
|
36
|
+
path,
|
|
37
|
+
write: async () => {
|
|
38
|
+
await writeFile(path, studioTsconfig({
|
|
39
|
+
content,
|
|
40
|
+
packageDir: root
|
|
41
|
+
}));
|
|
42
|
+
if (!existsSync(types)) await writeFile(types, STUDIO_TYPES);
|
|
43
|
+
}
|
|
44
|
+
}];
|
|
45
|
+
}
|
|
46
|
+
/** The scripts setup wrote running `sudio`. */
|
|
47
|
+
async function scriptChanges({ root }) {
|
|
48
|
+
const path = join(root, "package.json");
|
|
49
|
+
const text = await readIfThere(path);
|
|
50
|
+
let scripts = {};
|
|
51
|
+
try {
|
|
52
|
+
scripts = JSON.parse(text ?? "{}").scripts ?? {};
|
|
53
|
+
} catch {
|
|
54
|
+
return [];
|
|
55
|
+
}
|
|
56
|
+
const renamed = renamedScripts(scripts);
|
|
57
|
+
const names = Object.keys(renamed).map((name) => `"${name}"`);
|
|
58
|
+
if (names.length === 0) return [];
|
|
59
|
+
return [{
|
|
60
|
+
does: `package.json ${names.length === 1 ? "script" : "scripts"} ${listing(names)}`,
|
|
61
|
+
path,
|
|
62
|
+
write: () => editManifest(path, (manifest) => {
|
|
63
|
+
manifest.scripts = {
|
|
64
|
+
...manifest.scripts,
|
|
65
|
+
...renamed
|
|
66
|
+
};
|
|
67
|
+
})
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
70
|
+
/** Each .gitattributes the studio wrote that names Sudio's merges. */
|
|
71
|
+
async function mergeChanges({ root, content }) {
|
|
72
|
+
const changes = [];
|
|
73
|
+
for (const folder of Object.keys(MERGE_RULES)) {
|
|
74
|
+
const path = join(content, folder, ".gitattributes");
|
|
75
|
+
const text = await readIfThere(path);
|
|
76
|
+
const updated = text === void 0 ? text : withNewMerges(text);
|
|
77
|
+
if (updated !== void 0 && updated !== text) changes.push({
|
|
78
|
+
does: posix$1(relative(root, path)),
|
|
79
|
+
path,
|
|
80
|
+
write: () => writeFile(path, updated)
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
return changes;
|
|
84
|
+
}
|
|
85
|
+
/** Every file setup wrote that an older name is left in. */
|
|
86
|
+
const changesIn = async (project) => (await Promise.all([
|
|
87
|
+
agentChanges,
|
|
88
|
+
tsconfigChanges,
|
|
89
|
+
scriptChanges,
|
|
90
|
+
mergeChanges
|
|
91
|
+
].map((changes) => changes(project)))).flat();
|
|
92
|
+
const listOf = (steps) => steps.map(({ does }) => does).join(", ");
|
|
93
|
+
/** What setup wrote under older names is written as setup writes it now. */
|
|
94
|
+
const setupFilesMigration = {
|
|
95
|
+
name: "setup files",
|
|
96
|
+
plan: async (project) => (await changesIn(project)).map(({ does, path }) => ({
|
|
97
|
+
kind: "change",
|
|
98
|
+
does,
|
|
99
|
+
path
|
|
100
|
+
})),
|
|
101
|
+
apply: async (project, steps) => {
|
|
102
|
+
const planned = new Set(steps.map(({ path }) => path));
|
|
103
|
+
for (const change of await changesIn(project)) if (planned.has(change.path)) await change.write();
|
|
104
|
+
},
|
|
105
|
+
report: (steps, { dryRun }) => {
|
|
106
|
+
if (steps.length === 0) return dryRun ? ["Agents' configs, the tsconfig, scripts and merges: nothing to change."] : [];
|
|
107
|
+
return [`${dryRun ? "Would write" : "Wrote"} as setup does now, with Dex's names: ${listOf(steps)}`, ""];
|
|
108
|
+
},
|
|
109
|
+
warning: (steps) => ({
|
|
110
|
+
message: `Written by an older setup, with names Dex no longer uses (sudio, @sudio/core): ${listOf(steps)}`,
|
|
111
|
+
fix: `Run ${UPGRADE_COMMAND} to write ${steps.length === 1 ? "it" : "them"} as \`dex create\` does now, keeping anything else in ${steps.length === 1 ? "it" : "them"}.`
|
|
112
|
+
})
|
|
113
|
+
};
|
|
114
|
+
//#endregion
|
|
115
|
+
export { setupFilesMigration };
|
|
@@ -8,7 +8,7 @@ export interface StateChange {
|
|
|
8
8
|
path: string;
|
|
9
9
|
}
|
|
10
10
|
/**
|
|
11
|
-
* Move a studio's presence and snapshots into `.
|
|
11
|
+
* Move a studio's presence and snapshots into `.local/`, and its
|
|
12
12
|
* `.gitignore` to the one line. `root` is the project (where `.gitignore`
|
|
13
13
|
* and `dex.config.*` are), `content` the studio folder. Returns what it
|
|
14
14
|
* changed; with `dryRun`, what it would change, changing nothing. Running it
|
|
@@ -17,6 +17,6 @@ export interface StateChange {
|
|
|
17
17
|
export declare function migrateStudioState(root: string, content: string, { dryRun }?: {
|
|
18
18
|
dryRun?: boolean;
|
|
19
19
|
}): Promise<StateChange[]>;
|
|
20
|
-
/** Presence and snapshots move into `.
|
|
20
|
+
/** Presence and snapshots move into `.local/`. */
|
|
21
21
|
export declare const studioStateMigration: Migration;
|
|
22
22
|
//#endregion
|
|
@@ -86,7 +86,7 @@ function snapshotsStep(root, content) {
|
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
* Move a studio's presence and snapshots into `.
|
|
89
|
+
* Move a studio's presence and snapshots into `.local/`, and its
|
|
90
90
|
* `.gitignore` to the one line. `root` is the project (where `.gitignore`
|
|
91
91
|
* and `dex.config.*` are), `content` the studio folder. Returns what it
|
|
92
92
|
* changed; with `dryRun`, what it would change, changing nothing. Running it
|
|
@@ -105,7 +105,7 @@ async function migrateStudioState(root, content, { dryRun = false } = {}) {
|
|
|
105
105
|
}
|
|
106
106
|
return changes;
|
|
107
107
|
}
|
|
108
|
-
/** Presence and snapshots move into `.
|
|
108
|
+
/** Presence and snapshots move into `.local/`. */
|
|
109
109
|
const studioStateMigration = {
|
|
110
110
|
name: "studio state",
|
|
111
111
|
plan: async ({ root, content }) => (await migrateStudioState(root, content, { dryRun: true })).map(({ does, path }) => ({
|
|
@@ -117,12 +117,12 @@ const studioStateMigration = {
|
|
|
117
117
|
await migrateStudioState(root, content);
|
|
118
118
|
},
|
|
119
119
|
report: (steps, { dryRun }) => steps.length === 0 ? [] : [
|
|
120
|
-
`Studio state${dryRun ? " (would move)" : ""}: into .
|
|
120
|
+
`Studio state${dryRun ? " (would move)" : ""}: into .local/`,
|
|
121
121
|
...steps.map(({ does }) => ` ${does}`),
|
|
122
122
|
""
|
|
123
123
|
],
|
|
124
124
|
warning: (steps) => ({
|
|
125
|
-
message: "The studio keeps presence or snapshots outside .
|
|
125
|
+
message: "The studio keeps presence or snapshots outside .local/",
|
|
126
126
|
fix: `Run ${UPGRADE_COMMAND} to ${steps.map(({ does }) => does).join("; ")}.`
|
|
127
127
|
})
|
|
128
128
|
};
|
|
@@ -15,7 +15,7 @@ export declare const PLACEMENT_FLAG = "--app <name> | --in <package>";
|
|
|
15
15
|
* then its apps and the packages that hold components.
|
|
16
16
|
*/
|
|
17
17
|
export declare function workspaceLines(workspace: Workspace): string[];
|
|
18
|
-
/** A placement, for people: "its own app, apps/
|
|
18
|
+
/** A placement, for people: "its own app, apps/dex (@acme/dex)". */
|
|
19
19
|
export declare function describePlacement(placement: Placement): string;
|
|
20
20
|
/** Its own app, named: apps/<name>, scoped as the workspace's packages are. */
|
|
21
21
|
export declare function namedOwnApp(workspace: Workspace, name: string): OwnAppPlacement;
|
package/dist/setup/placement.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import "../shared/studio-files.mjs";
|
|
1
2
|
import { readJson } from "../config/project-files.mjs";
|
|
2
3
|
import { insideAppPlacement, outsideGlobs, ownAppPlacement } from "./detect/workspace.mjs";
|
|
3
4
|
import { Cancelled } from "./prompts.mjs";
|
|
@@ -86,7 +87,7 @@ function workspaceLines(workspace) {
|
|
|
86
87
|
...others > 0 ? [`and ${others} other package${others === 1 ? "" : "s"}`] : []
|
|
87
88
|
];
|
|
88
89
|
}
|
|
89
|
-
/** A placement, for people: "its own app, apps/
|
|
90
|
+
/** A placement, for people: "its own app, apps/dex (@acme/dex)". */
|
|
90
91
|
function describePlacement(placement) {
|
|
91
92
|
if (placement.kind === "own-app") return `its own app, ${placement.folder} (${placement.packageName})`;
|
|
92
93
|
return `inside ${placement.packageFolder === "." ? "the workspace root" : placement.packageFolder}, in ${placement.folder}`;
|
|
@@ -99,7 +100,7 @@ const placementLabel = (placement, recommended) => {
|
|
|
99
100
|
/** Its own app, named: apps/<name>, scoped as the workspace's packages are. */
|
|
100
101
|
function namedOwnApp(workspace, name) {
|
|
101
102
|
const clean = name.trim().replace(TRAILING_SLASHES_RE, "");
|
|
102
|
-
if (!APP_NAME_RE.test(clean)) throw new Error(`--app takes a folder name, like "
|
|
103
|
+
if (!APP_NAME_RE.test(clean)) throw new Error(`--app takes a folder name, like "dex" or "design-dex", not "${name}".`);
|
|
103
104
|
const parent = ownAppPlacement(workspace).folder.split("/").slice(0, -1).join("/");
|
|
104
105
|
const folder = parent ? `${parent}/${clean}` : clean;
|
|
105
106
|
const dir = join(workspace.root, ...folder.split("/"));
|
|
@@ -124,8 +125,8 @@ const rootPlacement = (workspace) => ({
|
|
|
124
125
|
packageDir: workspace.root,
|
|
125
126
|
packageFolder: ".",
|
|
126
127
|
packageName: void 0,
|
|
127
|
-
dir: join(workspace.root, "
|
|
128
|
-
folder: "
|
|
128
|
+
dir: join(workspace.root, "dex"),
|
|
129
|
+
folder: "dex",
|
|
129
130
|
flag: "--in ."
|
|
130
131
|
});
|
|
131
132
|
/** The package `--in` names, by folder or by name. */
|
package/dist/setup/plan.d.mts
CHANGED
|
@@ -46,12 +46,12 @@ export type PlanStep = {
|
|
|
46
46
|
export interface StudioTarget {
|
|
47
47
|
/**
|
|
48
48
|
* single: the project on its own, or a package set up by itself;
|
|
49
|
-
* inside-app: a
|
|
49
|
+
* inside-app: a Dex folder, dex/, of a workspace app; own-app: apps/<name>.
|
|
50
50
|
*/
|
|
51
51
|
kind: "single" | "inside-app" | "own-app";
|
|
52
|
-
/** The package that holds dex.config.ts: ".", "apps/web", "apps/
|
|
52
|
+
/** The package that holds dex.config.ts: ".", "apps/web", "apps/dex". */
|
|
53
53
|
package: string;
|
|
54
|
-
/** The
|
|
54
|
+
/** The Dex folder: "dex", "apps/web/dex", "apps/dex". */
|
|
55
55
|
studio: string;
|
|
56
56
|
}
|
|
57
57
|
/** What setting up in a workspace adds to a single project's setup. */
|
|
@@ -69,7 +69,7 @@ export interface WorkspaceSetup {
|
|
|
69
69
|
}
|
|
70
70
|
export interface SetupPlan {
|
|
71
71
|
steps: PlanStep[];
|
|
72
|
-
/** The studio's folder, relative to where the plan starts: "
|
|
72
|
+
/** The studio's folder, relative to where the plan starts: "dex". */
|
|
73
73
|
studio: string;
|
|
74
74
|
target: StudioTarget;
|
|
75
75
|
/** Set in a workspace. */
|
|
@@ -129,7 +129,7 @@ export interface PlanInput {
|
|
|
129
129
|
studioPackage: StudioPackage;
|
|
130
130
|
/** `--studio`: where to install the studio from. */
|
|
131
131
|
studioSpec: string | undefined;
|
|
132
|
-
/** Where the studio goes;
|
|
132
|
+
/** Where the studio goes; the project's Dex folder, dex/, by default. */
|
|
133
133
|
target?: StudioTarget;
|
|
134
134
|
/** The studio's tsconfig.json as it is, when it has one. */
|
|
135
135
|
tsconfig?: string;
|
package/dist/setup/plan.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { PACKAGE_NAME } from "../paths.mjs";
|
|
2
2
|
import { STUDIO_FILES } from "../shared/studio-files.mjs";
|
|
3
|
-
import { parseJsonc } from "../config/project-files.mjs";
|
|
4
3
|
import { listing } from "../shared/listing.mjs";
|
|
5
4
|
import { designMdDetail, fromProject } from "./design-md-setup.mjs";
|
|
6
5
|
import { pmCommand } from "../config/package-manager.mjs";
|
|
7
6
|
import { agentName } from "./project.mjs";
|
|
8
|
-
import { OLD_SCRIPTS, STUDIO_TYPES_FILE, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, withEsbuildBuilds } from "./write.mjs";
|
|
7
|
+
import { OLD_SCRIPTS, STUDIO_TYPES_FILE, copiesPaths, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, renamedScripts, withEsbuildBuilds } from "./write.mjs";
|
|
9
8
|
import { PROVIDER_FILE, shadcnInitFlags } from "./questions.mjs";
|
|
10
9
|
//#region src/setup/plan.ts
|
|
11
10
|
/** `path` in the package at `folder`: "apps/web/package.json". */
|
|
@@ -180,15 +179,6 @@ function appSteps(input, target) {
|
|
|
180
179
|
});
|
|
181
180
|
return steps.filter((step) => step.action !== "create" || !input.existing.has(step.path));
|
|
182
181
|
}
|
|
183
|
-
/** Whether a tsconfig copies `paths`, as older setups wrote it. */
|
|
184
|
-
function copiesPaths(tsconfig) {
|
|
185
|
-
try {
|
|
186
|
-
const { compilerOptions } = parseJsonc(tsconfig);
|
|
187
|
-
return typeof compilerOptions?.paths === "object";
|
|
188
|
-
} catch {
|
|
189
|
-
return false;
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
182
|
/**
|
|
193
183
|
* Made again when it copies the project's paths, which go stale; one
|
|
194
184
|
* without is the person's to have changed, and is left as it is.
|
|
@@ -272,6 +262,7 @@ function studioSteps(input, target) {
|
|
|
272
262
|
}
|
|
273
263
|
/** "+ script "dex"". */
|
|
274
264
|
const scriptsDetail = (names) => `+ ${names.length === 1 ? "script" : "scripts"} ${names.map((name) => `"${name}"`).join(", ")}`;
|
|
265
|
+
const renamedDetail = (names) => `sudio → dex in ${listing(names.map((name) => `"${name}"`))}`;
|
|
275
266
|
const studioDetail = (input, spec) => input.again?.upgrade ? `devDependency ${PACKAGE_NAME} ${input.again.upgrade.from} → ${spec}` : `+ devDependency ${PACKAGE_NAME} ${spec}`;
|
|
276
267
|
/** The package's own package.json, and the root's, with the studio's scripts. */
|
|
277
268
|
function scriptSteps(input, target) {
|
|
@@ -281,7 +272,12 @@ function scriptSteps(input, target) {
|
|
|
281
272
|
if (!own || input.again) {
|
|
282
273
|
const path = inPackage(target.package, "package.json");
|
|
283
274
|
const scripts = own ? [] : Object.keys(missingScripts(input.scripts));
|
|
284
|
-
const
|
|
275
|
+
const renamed = Object.keys(renamedScripts(input.scripts));
|
|
276
|
+
const added = [
|
|
277
|
+
...scripts.length > 0 ? [scriptsDetail(scripts)] : [],
|
|
278
|
+
...renamed.length > 0 ? [renamedDetail(renamed)] : [],
|
|
279
|
+
...workspace?.studioSpec ? [studioDetail(input, workspace.studioSpec)] : []
|
|
280
|
+
];
|
|
285
281
|
if (added.length > 0 && existing.has(path)) steps.push({
|
|
286
282
|
action: "edit",
|
|
287
283
|
write: "scripts",
|
package/dist/setup/project.d.mts
CHANGED
|
@@ -124,7 +124,12 @@ export declare const USER_AGENT_RE: RegExp;
|
|
|
124
124
|
export declare function packageManagerFinding(root: string, { userAgent }?: {
|
|
125
125
|
userAgent?: string;
|
|
126
126
|
}): Promise<Finding<PackageManagerChoice>>;
|
|
127
|
-
/**
|
|
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
|
+
*/
|
|
128
133
|
export declare function resolvedStudio(root: string): string | undefined;
|
|
129
134
|
/** Whether the studio is a dependency already, linked in, or neither. */
|
|
130
135
|
export declare function studioPackage(root: string): StudioPackage;
|
package/dist/setup/project.mjs
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { PACKAGE_NAME, posix as posix$1 } from "../paths.mjs";
|
|
2
2
|
import { STUDIO_FILES } from "../shared/studio-files.mjs";
|
|
3
|
-
import { dependenciesOf, exportedComponents, filesImport, packageAt, packageFolder } from "../config/project-files.mjs";
|
|
3
|
+
import { dependenciesOf, exportedComponents, filesImport, installedPackageDir, packageAt, packageFolder } from "../config/project-files.mjs";
|
|
4
4
|
import { found } from "./findings.mjs";
|
|
5
5
|
import { findWorkspace, isInside } from "./detect/workspace.mjs";
|
|
6
6
|
import { designMdFinding } from "./design-md-setup.mjs";
|
|
7
7
|
import { builtGlobalCss, componentLibraries, detectAgentsWithEvidence, detectDesignSystem, globalCssFiles, isMixedFolder, libraryAt, runningAgent } from "./detect.mjs";
|
|
8
8
|
import { providerFinding } from "./provider.mjs";
|
|
9
|
-
import { createRequire } from "node:module";
|
|
10
9
|
import { existsSync, lstatSync, readFileSync, realpathSync } from "node:fs";
|
|
11
10
|
import { dirname, isAbsolute, join, relative, resolve } from "node:path";
|
|
12
11
|
import { detect } from "package-manager-detector/detect";
|
|
@@ -168,16 +167,17 @@ async function packageManagerFinding(root, { userAgent = process.env.npm_config_
|
|
|
168
167
|
agent: "npm"
|
|
169
168
|
}, "no lockfile, so npm", "guess");
|
|
170
169
|
}
|
|
171
|
-
/**
|
|
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
|
+
*/
|
|
172
176
|
function resolvedStudio(root) {
|
|
173
177
|
const local = join(root, "node_modules", PACKAGE_NAME);
|
|
174
178
|
if (existsSync(join(local, "package.json"))) return local;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return dirname(require.resolve(`${PACKAGE_NAME}/package.json`));
|
|
178
|
-
} catch {
|
|
179
|
-
return;
|
|
180
|
-
}
|
|
179
|
+
const above = installedPackageDir(dirname(resolve(root)), PACKAGE_NAME);
|
|
180
|
+
return above && realpathSync(above);
|
|
181
181
|
}
|
|
182
182
|
/**
|
|
183
183
|
* Whether `dir` is a link to a studio outside the project (`bun link`, `npm
|
|
@@ -240,7 +240,7 @@ async function findProject(root, options = {}) {
|
|
|
240
240
|
componentPackages: componentPackages(root, workspace, folders),
|
|
241
241
|
designMd: designMdFinding(root, {
|
|
242
242
|
componentsDir: components.value?.dir,
|
|
243
|
-
exclude: join(root, "
|
|
243
|
+
exclude: join(root, "dex", STUDIO_FILES.instructions),
|
|
244
244
|
...workspace.isWorkspace ? { workspaceRoot: workspace.root } : {}
|
|
245
245
|
}),
|
|
246
246
|
styles: stylesFinding(root, components.value, source),
|
package/dist/setup/prompts.d.mts
CHANGED
|
@@ -62,7 +62,8 @@ export declare function parseAgents(text: string): AgentId[];
|
|
|
62
62
|
export declare function packageManagerName(pm: string): PackageManagerName;
|
|
63
63
|
/**
|
|
64
64
|
* `--dir`, checked: a folder below the project, never the project itself
|
|
65
|
-
* (setup would write the studio's files among its own) or a hidden one such
|
|
65
|
+
* (setup would write the studio's files among its own) or a hidden one such
|
|
66
|
+
* as `.git`. Without it, the Dex folder: `dex`.
|
|
66
67
|
*/
|
|
67
68
|
export declare function studioDir(flag: string | undefined): string;
|
|
68
69
|
/**
|
package/dist/setup/prompts.mjs
CHANGED
|
@@ -696,12 +696,13 @@ const FOLDER_RE = /^[\w.@-]+(?:\/[\w.@-]+)*$/;
|
|
|
696
696
|
const LEADING_DOT_SLASH_RE = /^(?:\.\/)+/;
|
|
697
697
|
/**
|
|
698
698
|
* `--dir`, checked: a folder below the project, never the project itself
|
|
699
|
-
* (setup would write the studio's files among its own) or a hidden one such
|
|
699
|
+
* (setup would write the studio's files among its own) or a hidden one such
|
|
700
|
+
* as `.git`. Without it, the Dex folder: `dex`.
|
|
700
701
|
*/
|
|
701
702
|
function studioDir(flag) {
|
|
702
|
-
const dir = (flag ?? "
|
|
703
|
+
const dir = (flag ?? "dex").replace(TRAILING_SLASHES_RE, "").replace(LEADING_DOT_SLASH_RE, "");
|
|
703
704
|
const hidden = dir.split("/").some((part) => part.startsWith("."));
|
|
704
|
-
if (!FOLDER_RE.test(dir) || hidden) throw new Error(`--dir takes a folder inside the project, like "
|
|
705
|
+
if (!FOLDER_RE.test(dir) || hidden) throw new Error(`--dir takes a folder inside the project, like "dex" or "design/dex", not "${flag}".`);
|
|
705
706
|
return dir;
|
|
706
707
|
}
|
|
707
708
|
function decideDir(flags) {
|
package/dist/setup/questions.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { posix as posix$1 } from "../paths.mjs";
|
|
2
|
+
import "../shared/studio-files.mjs";
|
|
2
3
|
import { fromProject } from "./design-md-setup.mjs";
|
|
3
4
|
import { relative } from "node:path";
|
|
4
5
|
//#region src/setup/questions.ts
|
|
@@ -167,10 +168,10 @@ const QUESTION = {
|
|
|
167
168
|
},
|
|
168
169
|
dir: {
|
|
169
170
|
key: "dir",
|
|
170
|
-
label: "
|
|
171
|
+
label: "Dex folder",
|
|
171
172
|
flag: "--dir <folder>",
|
|
172
173
|
asJson: (dir) => dir,
|
|
173
|
-
asFlags: (dir, { placement }) => dir !== "
|
|
174
|
+
asFlags: (dir, { placement }) => dir !== "dex" && placement?.kind !== "own-app" ? [`--dir ${dir}`] : []
|
|
174
175
|
}
|
|
175
176
|
};
|
|
176
177
|
/** Every question, in the order they are shown. */
|
|
@@ -30,7 +30,7 @@ export interface Starter {
|
|
|
30
30
|
/** The package manager when neither --pm nor the one running create says. */
|
|
31
31
|
packageManager: PackageManagerName;
|
|
32
32
|
shared: SharedFiles[];
|
|
33
|
-
/** A workspace: the studio gets an app of its own (apps/
|
|
33
|
+
/** A workspace: the studio gets an app of its own (apps/dex). */
|
|
34
34
|
workspace: boolean;
|
|
35
35
|
}
|
|
36
36
|
export declare const STARTERS: Record<StarterName, Starter>;
|
|
@@ -60,6 +60,8 @@ export interface StarterValues {
|
|
|
60
60
|
pmVersion?: string;
|
|
61
61
|
title: string;
|
|
62
62
|
}
|
|
63
|
+
/** What a starter writes at the project's root: "package.json", "src". */
|
|
64
|
+
export declare function starterRootNames(starter: Starter): Promise<string[]>;
|
|
63
65
|
/**
|
|
64
66
|
* Copy `starter` into `root`, which is empty: its own files, then the files
|
|
65
67
|
* it shares with another, with the name, title and package manager filled in.
|
package/dist/setup/starters.mjs
CHANGED
|
@@ -17,7 +17,7 @@ const STARTERS = {
|
|
|
17
17
|
vite: {
|
|
18
18
|
name: "vite",
|
|
19
19
|
label: "Vite + React app",
|
|
20
|
-
hint: "an app in src/ with the studio beside it in
|
|
20
|
+
hint: "an app in src/ with the studio beside it in dex/",
|
|
21
21
|
description: "a Vite + React app with shadcn on Base UI",
|
|
22
22
|
packageManager: "npm",
|
|
23
23
|
workspace: false,
|
|
@@ -59,7 +59,7 @@ const STARTERS = {
|
|
|
59
59
|
turborepo: {
|
|
60
60
|
name: "turborepo",
|
|
61
61
|
label: "Turborepo",
|
|
62
|
-
hint: "apps/web, a shared packages/ui and the studio in apps/
|
|
62
|
+
hint: "apps/web, a shared packages/ui and the studio in apps/dex",
|
|
63
63
|
description: "a Turborepo: apps/web, and packages/ui (@workspace/ui) with shadcn on Base UI",
|
|
64
64
|
packageManager: "bun",
|
|
65
65
|
workspace: true,
|
|
@@ -123,6 +123,12 @@ async function packageManagerVersion(pm, exec, cwd) {
|
|
|
123
123
|
return version;
|
|
124
124
|
}
|
|
125
125
|
const RENAMED = { gitignore: ".gitignore" };
|
|
126
|
+
/** What a starter writes at the project's root: "package.json", "src". */
|
|
127
|
+
async function starterRootNames(starter) {
|
|
128
|
+
const own = await readdir(join(STARTERS_DIR, starter.name));
|
|
129
|
+
const shared = starter.shared.map(({ to }) => to.split("/")[0] ?? to);
|
|
130
|
+
return [.../* @__PURE__ */ new Set([...own.map((name) => RENAMED[name] ?? name), ...shared])];
|
|
131
|
+
}
|
|
126
132
|
/** Copy a file or a folder, filling in the values and making the changes. */
|
|
127
133
|
async function copyTree(from, to, fill) {
|
|
128
134
|
if (!(await stat(from)).isDirectory()) {
|
|
@@ -174,4 +180,4 @@ async function copyStarter(starter, root, values) {
|
|
|
174
180
|
else if (values.pm === "pnpm") await writePnpmWorkspace(root, void 0);
|
|
175
181
|
}
|
|
176
182
|
//#endregion
|
|
177
|
-
export { DEFAULT_STARTER, STARTERS, STARTERS_DIR, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager };
|
|
183
|
+
export { DEFAULT_STARTER, STARTERS, STARTERS_DIR, STARTER_NAMES, TEMPLATE_FLAG, copyStarter, packageManagerVersion, starterNamed, starterPackageManager, starterRootNames };
|
package/dist/setup/write.d.mts
CHANGED
|
@@ -41,7 +41,7 @@ export interface DesignSystemFacts {
|
|
|
41
41
|
export declare function designSystemConfig(facts: DesignSystemFacts, root: string): DesignSystemConfig;
|
|
42
42
|
/**
|
|
43
43
|
* dex.config.ts for a new studio: the choices made, and nothing the
|
|
44
|
-
* project's files or the defaults say. `studio` is "
|
|
44
|
+
* project's files or the defaults say. `studio` is "dex", or "." for an
|
|
45
45
|
* app of its own.
|
|
46
46
|
*/
|
|
47
47
|
export declare function configSource(designSystem: DesignSystemConfig | undefined, { studio, primitives, next }: {
|
|
@@ -78,6 +78,12 @@ export declare function tsconfigJson({ extends: project, compile, exclude }: {
|
|
|
78
78
|
compile: ProjectCompile;
|
|
79
79
|
exclude: string[];
|
|
80
80
|
}): string;
|
|
81
|
+
/**
|
|
82
|
+
* Whether the studio's tsconfig copies `paths`, as setups before 0.13 wrote
|
|
83
|
+
* it (with the kit's types and path through @sudio/core): made again, it
|
|
84
|
+
* extends the project's instead. One without is the person's to have changed.
|
|
85
|
+
*/
|
|
86
|
+
export declare function copiesPaths(tsconfig: string): boolean;
|
|
81
87
|
/** A path from the studio's folder, as `extends` writes it: "../tsconfig.json". */
|
|
82
88
|
export declare const fromStudio: (content: string, file: string) => string;
|
|
83
89
|
/**
|
|
@@ -85,8 +91,14 @@ export declare const fromStudio: (content: string, file: string) => string;
|
|
|
85
91
|
* the project's own file changes by a dependency and a line.
|
|
86
92
|
*/
|
|
87
93
|
export declare const STUDIO_SCRIPTS: Record<string, string>;
|
|
88
|
-
/**
|
|
89
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Scripts older setups added, as Dex wrote them and then as Sudio did. A
|
|
96
|
+
* later setup keeps them, as anything of the project's own, but runs Dex in
|
|
97
|
+
* Sudio's: `sudio` comes with the package only to say it is `dex` now.
|
|
98
|
+
*/
|
|
99
|
+
export declare const OLD_SCRIPTS: Record<string, [dex: string, ...older: string[]]>;
|
|
100
|
+
/** The scripts an older setup wrote with Sudio's command, as Dex's. */
|
|
101
|
+
export declare const renamedScripts: (scripts: Record<string, string>) => Record<string, string>;
|
|
90
102
|
/** The scripts missing from `scripts`. */
|
|
91
103
|
export declare const missingScripts: (scripts: Record<string, string>) => Record<string, string>;
|
|
92
104
|
/**
|
package/dist/setup/write.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PACKAGE_NAME, posix as posix$1 } from "../paths.mjs";
|
|
2
2
|
import { stateIgnoreLine } from "../server/state.mjs";
|
|
3
|
+
import { parseJsonc } from "../config/project-files.mjs";
|
|
3
4
|
import { componentName } from "../config/design-system.mjs";
|
|
4
5
|
import { formattedJson } from "../shared/json-style.mjs";
|
|
5
6
|
import { editConfig } from "./config-source.mjs";
|
|
@@ -50,7 +51,7 @@ function designSystemConfig(facts, root) {
|
|
|
50
51
|
}
|
|
51
52
|
/**
|
|
52
53
|
* dex.config.ts for a new studio: the choices made, and nothing the
|
|
53
|
-
* project's files or the defaults say. `studio` is "
|
|
54
|
+
* project's files or the defaults say. `studio` is "dex", or "." for an
|
|
54
55
|
* app of its own.
|
|
55
56
|
*/
|
|
56
57
|
function configSource(designSystem, { studio, primitives, next }) {
|
|
@@ -140,6 +141,19 @@ function tsconfigJson({ extends: project, compile, exclude }) {
|
|
|
140
141
|
exclude
|
|
141
142
|
});
|
|
142
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Whether the studio's tsconfig copies `paths`, as setups before 0.13 wrote
|
|
146
|
+
* it (with the kit's types and path through @sudio/core): made again, it
|
|
147
|
+
* extends the project's instead. One without is the person's to have changed.
|
|
148
|
+
*/
|
|
149
|
+
function copiesPaths(tsconfig) {
|
|
150
|
+
try {
|
|
151
|
+
const { compilerOptions } = parseJsonc(tsconfig);
|
|
152
|
+
return typeof compilerOptions?.paths === "object";
|
|
153
|
+
} catch {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
143
157
|
/** A path from the studio's folder, as `extends` writes it: "../tsconfig.json". */
|
|
144
158
|
const fromStudio = (content, file) => {
|
|
145
159
|
const path = posix$1(relative(content, file));
|
|
@@ -150,12 +164,18 @@ const fromStudio = (content, file) => {
|
|
|
150
164
|
* the project's own file changes by a dependency and a line.
|
|
151
165
|
*/
|
|
152
166
|
const STUDIO_SCRIPTS = { dex: "dex dev" };
|
|
153
|
-
/**
|
|
167
|
+
/**
|
|
168
|
+
* Scripts older setups added, as Dex wrote them and then as Sudio did. A
|
|
169
|
+
* later setup keeps them, as anything of the project's own, but runs Dex in
|
|
170
|
+
* Sudio's: `sudio` comes with the package only to say it is `dex` now.
|
|
171
|
+
*/
|
|
154
172
|
const OLD_SCRIPTS = {
|
|
155
173
|
studio: ["dex dev", "sudio dev"],
|
|
156
174
|
"studio:build": ["dex build", "sudio build"],
|
|
157
175
|
"studio:claude": ["dex claude", "sudio claude"]
|
|
158
176
|
};
|
|
177
|
+
/** The scripts an older setup wrote with Sudio's command, as Dex's. */
|
|
178
|
+
const renamedScripts = (scripts) => Object.fromEntries(Object.entries(OLD_SCRIPTS).flatMap(([name, [dex, ...older]]) => older.includes(scripts[name] ?? "") ? [[name, dex]] : []));
|
|
159
179
|
/** The scripts missing from `scripts`. */
|
|
160
180
|
const missingScripts = (scripts) => Object.fromEntries(Object.entries(STUDIO_SCRIPTS).filter(([name]) => !(name in scripts)));
|
|
161
181
|
/**
|
|
@@ -228,4 +248,4 @@ const withPointer = (guide, studio) => {
|
|
|
228
248
|
return body ? `${body}\n\n${pointerText(studio)}` : pointerText(studio);
|
|
229
249
|
};
|
|
230
250
|
//#endregion
|
|
231
|
-
export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, pointerPlace, pointerText, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer };
|
|
251
|
+
export { OLD_SCRIPTS, POINTER, STUDIO_SCRIPTS, STUDIO_TYPES, STUDIO_TYPES_FILE, configSource, copiesPaths, designSystemConfig, fromRoot, fromStudio, hasPointer, ignoreFile, missingIgnoreLines, missingScripts, pnpmDecidesEsbuild, pointerPlace, pointerText, renamedScripts, tsconfigJson, withEsbuildBuilds, withIgnoreLines, withPointer };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { isSlug } from "./prototypes-core.mjs";
|
|
2
1
|
import { isRecord, isText } from "./checks.mjs";
|
|
2
|
+
import { isSlug } from "./prototypes-core.mjs";
|
|
3
3
|
import { frameKey, isFrameUid, legacyFrameUid } from "./canvas-core.mjs";
|
|
4
4
|
import { rowOwner } from "./people-core.mjs";
|
|
5
5
|
//#region src/shared/annotations-core.ts
|
|
@@ -342,6 +342,19 @@ export declare const insertUnder: <F extends Stepped>(row: {
|
|
|
342
342
|
export declare const insertInCell: <F extends Stepped>(row: {
|
|
343
343
|
frames: F[];
|
|
344
344
|
}, frame: F, cell: Pick<Cell, "beside" | "over" | "step" | "under">) => string;
|
|
345
|
+
/**
|
|
346
|
+
* The cell a request for a new view fills: a step in its row, or in a new
|
|
347
|
+
* row, right above the row `above` names (a step in a row has no row to go
|
|
348
|
+
* above), else at the end of the section.
|
|
349
|
+
*/
|
|
350
|
+
export declare const requestCell: ({ above, row, section, step }: Pick<Cell, "above" | "row" | "section" | "step">) => Cell;
|
|
351
|
+
/**
|
|
352
|
+
* Put a new row among a section's rows: right above the row `above` names,
|
|
353
|
+
* as the + on the line between two rows asks, else below the others.
|
|
354
|
+
*/
|
|
355
|
+
export declare const addRowAbove: <R extends {
|
|
356
|
+
id: string;
|
|
357
|
+
}>(rows: R[], row: R, above?: string) => void;
|
|
345
358
|
/** A new, empty row for a section with `rows`, its id from `name`. A row
|
|
346
359
|
* has no name of its own: only its frames are named. */
|
|
347
360
|
export declare const emptyRow: <F>(rows: readonly {
|
|
@@ -389,15 +402,17 @@ interface CellFrame extends Stepped {
|
|
|
389
402
|
export declare const sizeForCell: (canvas: CanvasShape<CellFrame>, cell: Cell) => PageSize | undefined;
|
|
390
403
|
/**
|
|
391
404
|
* Put a frame for a view in a cell: on its step in its row, or in a new row
|
|
392
|
-
*
|
|
393
|
-
* size
|
|
405
|
+
* when the cell names none (addRowAbove). It takes `viewport`'s size, else
|
|
406
|
+
* `size`, else the size of the frame before it, else `fallback` (the team's
|
|
394
407
|
* default device), else desktop's. A frame for the view already on that step
|
|
395
408
|
* (in that row, or any row of the section for a new row) is kept as it is.
|
|
396
409
|
* Returns a new canvas, the frame's key and whether it was added; or the
|
|
397
410
|
* problem when the section or row is not there.
|
|
398
411
|
*/
|
|
399
|
-
export declare function placeViewInCell<C extends CanvasShape<CellFrame>>(canvas: C, cell: Cell, { view, viewport, fallback }: {
|
|
412
|
+
export declare function placeViewInCell<C extends CanvasShape<CellFrame>>(canvas: C, cell: Cell, { view, viewport, size, fallback }: {
|
|
400
413
|
fallback?: PageSize;
|
|
414
|
+
/** The size asked for it: a request's, set on the canvas. */
|
|
415
|
+
size?: PageSize;
|
|
401
416
|
view: string;
|
|
402
417
|
viewport?: Viewport;
|
|
403
418
|
}): {
|
|
@@ -408,10 +423,10 @@ export declare function placeViewInCell<C extends CanvasShape<CellFrame>>(canvas
|
|
|
408
423
|
problem: string;
|
|
409
424
|
};
|
|
410
425
|
/**
|
|
411
|
-
* Put a frame in a cell: on its step in its row, or in a new row
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
*
|
|
426
|
+
* Put a frame in a cell: on its step in its row, or in a new row when the
|
|
427
|
+
* cell names none (addRowAbove). A frame already on that step, and those
|
|
428
|
+
* after it, move one step along. Returns a new canvas and the frame's key,
|
|
429
|
+
* or the problem when the section or row is not there.
|
|
415
430
|
*/
|
|
416
431
|
export declare function placeFrameInCell<F extends Stepped & {
|
|
417
432
|
id: string;
|