@marver-design/marver 0.26.1 → 0.27.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 +104 -0
- package/README.md +8 -3
- package/dist/{anchor-check-l-ny3UzH.mjs → anchor-check-ChdDqL5z.mjs} +1 -1
- package/dist/{bake-C-awKgLA.mjs → bake-DM_uWgAA.mjs} +1 -1
- package/dist/{boards-DYG22tOe.mjs → boards-DlTcpF47.mjs} +1 -1
- package/dist/{build-BDRiO_mP.mjs → build-DZnFysGU.mjs} +4 -4
- package/dist/cli.mjs +28 -16
- package/dist/{comments-BqXua-XL.mjs → comments-DxOkCSNE.mjs} +4 -4
- package/dist/{daemon-DL6Fwq6D.mjs → daemon-BSA0lV8d.mjs} +8 -6
- package/dist/detect-C0wpaePX.mjs +125 -0
- package/dist/dev-eQJhWsqg.mjs +1273 -0
- package/dist/dev-lock-C_FC70Mu.mjs +65 -0
- package/dist/exclusive-B1RtpeeP.mjs +150 -0
- package/dist/{init-D8DtrK_F.mjs → init-COD0x48i.mjs} +5 -3
- package/dist/{link-BNzLvdhI.mjs → link-DDXZVGtv.mjs} +20 -8
- package/dist/ls-D7O1G505.mjs +38 -0
- package/dist/{marks-DyWMv_Z1.mjs → marks-CWM3WJjc.mjs} +1 -1
- package/dist/perf-BWzQwZqj.mjs +369 -0
- package/dist/perf-BoDSkbEb.mjs +429 -0
- package/dist/{perf-jam-BU3TVrZu.mjs → perf-jam-D55U3FZK.mjs} +5 -2
- package/dist/{plugin-DkGmZs_r.mjs → plugin-C-E7omsh.mjs} +394 -55
- package/dist/{poster-BdtSKMDm.mjs → poster-Bx83ZYVK.mjs} +1 -1
- package/dist/{profile-WU9qcbIo.mjs → profile-Bh5Y5zpW.mjs} +1 -1
- package/dist/{publish-bakes-9RzRToXV.mjs → publish-bakes-aljgm45S.mjs} +2 -2
- package/dist/{queue-29ok5_eZ.mjs → queue-CAM_vNmX.mjs} +1 -1
- package/dist/recover-t9Pno3u9.mjs +66 -0
- package/dist/{share--oFJ1bCI.mjs → share-W5H3BNvP.mjs} +1 -1
- package/dist/{shot-XQV7HC9A.mjs → shot-DoHLl6ig.mjs} +1 -1
- package/dist/{shot-DQeR_Pfn.mjs → shot-LFhC-WYD.mjs} +9 -3
- package/dist/slots-DCDo3N0x.mjs +471 -0
- package/dist/{sync-DKk-yT1V.mjs → sync-BQVlHZpx.mjs} +4 -3
- package/dist/{work-F5u-twpJ.mjs → work-Bp1p39kq.mjs} +4 -2
- package/dist/{work-VvX_JIgl.mjs → work-BroFwnup.mjs} +4 -2
- package/docs/boards-and-folders.md +3 -1
- package/docs/jam-session.md +55 -1
- package/docs/performance.md +262 -0
- package/package.json +2 -2
- package/src/client/content/index.tsx +3 -0
- package/src/client/content/video.tsx +6 -2
- package/src/client/frame-host/bridge.js +22 -6
- package/src/client/frame-host/main.tsx +17 -5
- package/src/client/shell/App.tsx +180 -25
- package/src/client/shell/BoardList.tsx +5 -5
- package/src/client/shell/Comments.tsx +3 -2
- package/src/client/shell/JamSurface.tsx +4 -2
- package/src/client/shell/LockedApp.tsx +5 -5
- package/src/client/shell/Play.tsx +16 -8
- package/src/client/shell/Toolbar.tsx +12 -1
- package/src/client/shell/api.ts +206 -0
- package/src/client/shell/canvas/Canvas.tsx +30 -3
- package/src/client/shell/canvas/FrameNode.tsx +12 -3
- package/src/client/shell/canvas/admission.ts +8 -1
- package/src/client/shell/canvas/camera-broadcast.ts +15 -5
- package/src/client/shell/canvas/ctl.ts +2 -0
- package/src/client/shell/canvas/frame-registry.ts +28 -2
- package/src/client/shell/canvas/sleep.ts +4 -1
- package/src/client/shell/comments-store.ts +12 -4
- package/src/client/shell/goto.ts +22 -10
- package/src/client/shell/jam-capture.ts +22 -8
- package/src/client/shell/jam-keys.ts +4 -0
- package/src/client/shell/jam-panel.tsx +3 -0
- package/src/client/shell/jam-queue.ts +3 -3
- package/src/client/shell/jam-session.tsx +14 -8
- package/src/client/shell/jam-voice.ts +7 -5
- package/src/client/shell/legacy-links.ts +2 -2
- package/src/client/shell/main.tsx +4 -0
- package/src/client/shell/notes.ts +8 -1
- package/src/client/shell/perf.ts +69 -58
- package/src/client/shell/recorder-core.ts +183 -0
- package/src/client/shell/recorder.ts +565 -0
- package/src/client/shell/store.ts +254 -98
- package/src/client/shell/styles.css +26 -1
- package/templates/AGENTS-embedded.md +22 -4
- package/templates/AGENTS-studio.md +22 -4
- package/templates/demo/dark.tsx +1 -1
- package/templates/demo/welcome.tsx +1 -1
- package/templates/instructions/welcome.md +6 -3
- package/dist/config-Cf7EjAMf.mjs +0 -292
- package/dist/dev-Bw_qYWWq.mjs +0 -755
- package/dist/dev-lock-DWSpa6nj.mjs +0 -179
- package/dist/perf-C75MZ73h.mjs +0 -167
- package/dist/perf-DPbLGhhO.mjs +0 -49
|
@@ -905,7 +905,7 @@ body.sh-hide-ui .sh-fab,
|
|
|
905
905
|
body.sh-hide-ui .sh-ctx,
|
|
906
906
|
body.sh-hide-ui .sh-update,
|
|
907
907
|
body.sh-hide-ui .sh-toasts,
|
|
908
|
-
body.sh-hide-ui .sh-banner,
|
|
908
|
+
body.sh-hide-ui .sh-banner:not(.sh-stopped), /* a stopped canvas stays said: the page holds what only it has */
|
|
909
909
|
body.sh-hide-ui .sh-play-nav { display: none !important }
|
|
910
910
|
|
|
911
911
|
/* the prototype pill reuses the shared pill LAYOUT but wears the discreet DARK skin of the
|
|
@@ -1888,6 +1888,31 @@ button.jm-link { padding: 0; border: 0; background: none; text-align: left; widt
|
|
|
1888
1888
|
.sh-app.jm-lane-on .sh-update { bottom: calc(var(--edge) + 56px) }
|
|
1889
1889
|
.sh-app.jm-lane-on .sh-toasts { bottom: calc(var(--edge) + 56px) }
|
|
1890
1890
|
.sh-app.jm-lane-on .sh-banner { bottom: calc(var(--edge) + 56px) }
|
|
1891
|
+
/* the canvas stopped (spec 28 A1.11): on the toolbar's centre line in the gap between the sidebar and the
|
|
1892
|
+
toolbar, or just below the toolbar row - placed by the shell (App.tsx placeBanner), which measures both; above
|
|
1893
|
+
play and focus. The fallback before it measures: top centre, on the line (34px tall, the row 46px) */
|
|
1894
|
+
.sh-app .sh-banner.sh-stopped { top: calc(var(--edge) + 6px); bottom: auto; left: 50%; right: auto; transform: translateX(-50%);
|
|
1895
|
+
z-index: 40; width: max-content; max-width: none; white-space: nowrap; text-align: center; text-wrap: balance; pointer-events: auto }
|
|
1896
|
+
.sh-banner.sh-stopped code { font: 500 11.5px/14px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 1px 5px; border-radius: 5px;
|
|
1897
|
+
background: color-mix(in srgb, currentColor 11%, transparent); white-space: nowrap }
|
|
1898
|
+
.sh-banner.sh-stopped .kept { color: var(--glass-ink-2) }
|
|
1899
|
+
.sh-banner.sh-stopped:is([data-at="stack"], [data-at="below"]) .dot { display: none }
|
|
1900
|
+
.sh-banner.sh-stopped:is([data-at="stack"], [data-at="below"]) .kept { display: block }
|
|
1901
|
+
/* over play and focus: the play chrome's dark skin (its pills, the navigator), warm light text - 13:1 */
|
|
1902
|
+
.sh-banner.sh-stopped.dark { background: rgba(18, 18, 24, .86); border-color: rgba(255, 255, 255, .1); color: #ffd9a0;
|
|
1903
|
+
backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); box-shadow: 0 2px 10px rgba(0, 0, 0, .35) } /* tight: never a smudge on the stage under it */
|
|
1904
|
+
.sh-banner.sh-stopped.dark::after { display: none }
|
|
1905
|
+
.sh-banner.sh-stopped.dark .kept { color: rgba(245, 245, 247, .78) }
|
|
1906
|
+
/* a frame (or the stage) whose canvas is away shows another project's "another canvas" page: one calm line over
|
|
1907
|
+
it, in the frame's own theme - the banner says what happened, once. Screen-size text, never wider than its frame */
|
|
1908
|
+
.sh-stranded { position: absolute; inset: 0; z-index: 2; display: grid; place-items: center; padding: 8%; container-type: size;
|
|
1909
|
+
background: var(--node-bg, var(--pdev-bg, #fff)); color: color-mix(in srgb, var(--head-ink, #18181b) 64%, var(--node-bg, #fff));
|
|
1910
|
+
pointer-events: none; text-align: center }
|
|
1911
|
+
.sh-stranded span { font-family: -apple-system, system-ui, sans-serif; font-weight: 500; font-size: min(calc(12px * var(--sh-inv, 1)), 7cqi); line-height: 1.35 }
|
|
1912
|
+
.sh-play .dev .sh-stranded { --node-bg: #fff; --head-ink: #18181b }
|
|
1913
|
+
.sh-play .dev[data-theme="dark"] .sh-stranded { --node-bg: #0f1015; --head-ink: #ececf1 }
|
|
1914
|
+
/* the tools that need the server, while the canvas is stopped: quiet, their tooltip says why */
|
|
1915
|
+
.sh-pill-btn[data-stopped], .sh-pill-btn[data-stopped]:hover { opacity: .38; background: none; cursor: default }
|
|
1891
1916
|
|
|
1892
1917
|
|
|
1893
1918
|
/* ---- words on this Mac (spec 27 Part 4): the live caption over the capture tile, the one question ---- */
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
You design by writing files. The canvas at the printed localhost URL reflects them live.
|
|
4
4
|
Never drive or automate the canvas UI; read and write files only. (Starting
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
the canvas so the human has a live one - first session, or on request - is the one
|
|
6
|
+
allowed touch: `npx marver dev`, never with a port. It takes a free slot,
|
|
7
|
+
localhost:4805-4824, usually the same one next time, and prints its link.)
|
|
8
|
+
|
|
9
|
+
**Keeping the canvas up.** A canvas you start dies with the job that started it: Claude Code
|
|
10
|
+
stops a background job after 10 minutes, and a headless session never exits while one runs.
|
|
11
|
+
So `npx marver ls` first - one may already run for this folder. None: ask the person to run
|
|
12
|
+
`npx marver dev` in their own terminal. If you start it yourself, start it detached so it
|
|
13
|
+
outlives you - `mkdir -p design/.local && nohup npx marver dev > design/.local/dev.log 2>&1 &` -
|
|
14
|
+
then read its link from `npx marver ls`. In a sandbox where it cannot start ("cannot watch
|
|
15
|
+
this folder") or cannot be reached ("cannot be reached from here"), ask the person to run it:
|
|
16
|
+
`npx marver shot`, `marks`, `ls` and `perf --loads` still work there.
|
|
7
17
|
|
|
8
18
|
## Before the method: a project with no `context/`
|
|
9
19
|
|
|
@@ -126,8 +136,10 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
126
136
|
scene ...>` for any set. Each opens a board they sit on (one link per board when they sit
|
|
127
137
|
on several) with them selected and in view -
|
|
128
138
|
the human finds the work at once on a board of fifty frames. Never a full-screen focus link
|
|
129
|
-
(`#/f/...`) unless they ask for full screen.
|
|
130
|
-
|
|
139
|
+
(`#/f/...`) unless they ask for full screen. `npx marver ls` lists the canvases running on
|
|
140
|
+
this Mac and their links; none for this folder? End by asking the person to run
|
|
141
|
+
`npx marver dev` in their own terminal (or start it detached: "Keeping the canvas up") - the
|
|
142
|
+
link carries its port.
|
|
131
143
|
- **Answer each comment thread you addressed, in the thread**: `npx marver comments reply
|
|
132
144
|
<thread> --body "<what changed>"` - one line, no longer than their comment. On a thread
|
|
133
145
|
the human started it posts as Marver and pings them on the frame. A reply that asks them
|
|
@@ -225,6 +237,10 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
225
237
|
waiting on them (your notes and replies they have not resolved - the ones that ask first) and
|
|
226
238
|
the frames new since they last looked. When it bears on the work, say so in your first message
|
|
227
239
|
("you have not looked at the checkout frames since I changed them").
|
|
240
|
+
- **Performance.** `npx marver perf --loads --json` says what each board load did - time to
|
|
241
|
+
settled, how many moves and why, the slowest frames, errors. To make a board faster, name
|
|
242
|
+
the lever, change it, compare the next load. A slow frame's `admittedMs` is when its turn to
|
|
243
|
+
start came: a long wait is the queue, not the frame (`ms - admittedMs` is the frame's own).
|
|
228
244
|
- **Names vs titles.** A board's file name, a folder's `name`, a scene's directory are
|
|
229
245
|
IDENTITIES: slugs you address, that publish.json, URLs and comment threads hold, and
|
|
230
246
|
that never move on a rename. `title` is what humans see - free text (casing,
|
|
@@ -247,6 +263,8 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
247
263
|
always yours (Show the work, step 1).
|
|
248
264
|
- Do not import from "design/" inside src/ or app/. The arrow points one way.
|
|
249
265
|
- Do not add network calls, app stores, or auth to frames or the presentational screens.
|
|
266
|
+
- Frames cannot register a service worker on the local canvas (it refuses the script): a PWA
|
|
267
|
+
prototype shows its screens, not its offline behaviour.
|
|
250
268
|
- A scene may not be named "components" or "screens".
|
|
251
269
|
|
|
252
270
|
## Handoff (when a design is approved)
|
|
@@ -2,8 +2,18 @@
|
|
|
2
2
|
|
|
3
3
|
You design by writing files. The canvas at the printed localhost URL reflects them live.
|
|
4
4
|
Never drive or automate the canvas UI; read and write files only. (Starting
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
the canvas so the human has a live one - first session, or on request - is the one
|
|
6
|
+
allowed touch: `npx marver dev`, never with a port. It takes a free slot,
|
|
7
|
+
localhost:4805-4824, usually the same one next time, and prints its link.)
|
|
8
|
+
|
|
9
|
+
**Keeping the canvas up.** A canvas you start dies with the job that started it: Claude Code
|
|
10
|
+
stops a background job after 10 minutes, and a headless session never exits while one runs.
|
|
11
|
+
So `npx marver ls` first - one may already run for this folder. None: ask the person to run
|
|
12
|
+
`npx marver dev` in their own terminal. If you start it yourself, start it detached so it
|
|
13
|
+
outlives you - `mkdir -p design/.local && nohup npx marver dev > design/.local/dev.log 2>&1 &` -
|
|
14
|
+
then read its link from `npx marver ls`. In a sandbox where it cannot start ("cannot watch
|
|
15
|
+
this folder") or cannot be reached ("cannot be reached from here"), ask the person to run it:
|
|
16
|
+
`npx marver shot`, `marks`, `ls` and `perf --loads` still work there.
|
|
7
17
|
|
|
8
18
|
## Before the method: a project with no `context/`
|
|
9
19
|
|
|
@@ -126,8 +136,10 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
126
136
|
scene ...>` for any set. Each opens a board they sit on (one link per board when they sit
|
|
127
137
|
on several) with them selected and in view -
|
|
128
138
|
the human finds the work at once on a board of fifty frames. Never a full-screen focus link
|
|
129
|
-
(`#/f/...`) unless they ask for full screen.
|
|
130
|
-
|
|
139
|
+
(`#/f/...`) unless they ask for full screen. `npx marver ls` lists the canvases running on
|
|
140
|
+
this Mac and their links; none for this folder? End by asking the person to run
|
|
141
|
+
`npx marver dev` in their own terminal (or start it detached: "Keeping the canvas up") - the
|
|
142
|
+
link carries its port.
|
|
131
143
|
- **Answer each comment thread you addressed, in the thread**: `npx marver comments reply
|
|
132
144
|
<thread> --body "<what changed>"` - one line, no longer than their comment. On a thread
|
|
133
145
|
the human started it posts as Marver and pings them on the frame. A reply that asks them
|
|
@@ -224,6 +236,10 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
224
236
|
waiting on them (your notes and replies they have not resolved - the ones that ask first) and
|
|
225
237
|
the frames new since they last looked. When it bears on the work, say so in your first message
|
|
226
238
|
("you have not looked at the checkout frames since I changed them").
|
|
239
|
+
- **Performance.** `npx marver perf --loads --json` says what each board load did - time to
|
|
240
|
+
settled, how many moves and why, the slowest frames, errors. To make a board faster, name
|
|
241
|
+
the lever, change it, compare the next load. A slow frame's `admittedMs` is when its turn to
|
|
242
|
+
start came: a long wait is the queue, not the frame (`ms - admittedMs` is the frame's own).
|
|
227
243
|
- **Names vs titles.** A board's file name, a folder's `name`, a scene's directory are
|
|
228
244
|
IDENTITIES: slugs you address, that publish.json, URLs and comment threads hold, and
|
|
229
245
|
that never move on a rename. `title` is what humans see - free text (casing,
|
|
@@ -247,6 +263,8 @@ The human reviews on the canvas, not in the chat - so the reply puts them there:
|
|
|
247
263
|
- Do not import from "design/" inside src/ or app/. The arrow points one way.
|
|
248
264
|
- Do not add network calls, app stores, or auth to frames. Mocked data only.
|
|
249
265
|
- Keep each frame self-sufficient: it must render from its file + fixtures + ui imports alone.
|
|
266
|
+
- Frames cannot register a service worker on the local canvas (it refuses the script): a PWA
|
|
267
|
+
prototype shows its screens, not its offline behaviour.
|
|
250
268
|
- A scene may not be named "components" or "screens".
|
|
251
269
|
|
|
252
270
|
## Promotion (when a design is approved)
|
package/templates/demo/dark.tsx
CHANGED
|
@@ -3,7 +3,7 @@ export const meta = { title: 'Demo - error state', viewport: 'mobile' }
|
|
|
3
3
|
|
|
4
4
|
export default function DarkError() {
|
|
5
5
|
return (
|
|
6
|
-
<div style={{ fontFamily: 'system-ui', minHeight: '100vh', background: '#12151f', color: '#e7eaf2', padding: 24, display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
6
|
+
<div style={{ fontFamily: 'system-ui', minHeight: '100vh', boxSizing: 'border-box', background: '#12151f', color: '#e7eaf2', padding: 24, display: 'flex', flexDirection: 'column', gap: 12 }}>
|
|
7
7
|
<b style={{ fontSize: 16 }}>‹ Checkout</b>
|
|
8
8
|
<div style={{ background: '#2a1215', border: '1px solid #5c2320', borderRadius: 8, padding: '12px 14px', color: '#f0776b', fontSize: 14, lineHeight: 1.5 }}>
|
|
9
9
|
<b style={{ display: 'block', color: '#f9a8a0' }}>Card declined</b>
|
|
@@ -4,7 +4,7 @@ import { fx } from './_fixtures.ts'
|
|
|
4
4
|
export const meta = { title: 'Demo - welcome', viewport: 'mobile' }
|
|
5
5
|
|
|
6
6
|
const s = {
|
|
7
|
-
wrap: { fontFamily: 'system-ui', minHeight: '100vh', display: 'flex', flexDirection: 'column', padding: 24, gap: 12, background: 'var(--background, #fff)', color: 'var(--foreground, #111)' },
|
|
7
|
+
wrap: { fontFamily: 'system-ui', minHeight: '100vh', boxSizing: 'border-box', display: 'flex', flexDirection: 'column', padding: 24, gap: 12, background: 'var(--background, #fff)', color: 'var(--foreground, #111)' },
|
|
8
8
|
h: { fontSize: 28, fontWeight: 700, letterSpacing: '-0.02em', margin: 0 },
|
|
9
9
|
p: { color: '#667085', margin: 0, lineHeight: 1.5 },
|
|
10
10
|
btn: { marginTop: 'auto', padding: '12px 16px', borderRadius: 8, border: 0, background: '#111', color: '#fff', fontWeight: 600, fontSize: 15, cursor: 'pointer' },
|
|
@@ -107,9 +107,12 @@ without narrating into the void; your next message is the reveal.
|
|
|
107
107
|
## The reveal
|
|
108
108
|
|
|
109
109
|
Deliver conversationally when the first draft is ready - a short guided
|
|
110
|
-
message, not a manual.
|
|
111
|
-
|
|
112
|
-
|
|
110
|
+
message, not a manual. The canvas must be running: `npx marver ls` lists it.
|
|
111
|
+
Not yet? Ask the person to run `npx marver dev` in their own terminal - a
|
|
112
|
+
canvas you start dies with your job - or start it detached, as design/AGENTS.md
|
|
113
|
+
says ("Keeping the canvas up"); never with a port. ALWAYS hand a deep link to
|
|
114
|
+
the board you prepared, using the port the dev server printed (`npx marver ls`
|
|
115
|
+
lists it):
|
|
113
116
|
`http://localhost:<port>/#/b/<board>` - never the bare root URL. The link goes
|
|
114
117
|
at the BOTTOM of the message, on its own line: the human reads through, then
|
|
115
118
|
clicks. The human has already played with the hosted tour by now, so keep it
|
package/dist/config-Cf7EjAMf.mjs
DELETED
|
@@ -1,292 +0,0 @@
|
|
|
1
|
-
import { m as readDescription } from "./board-tree-DRioF94d.mjs";
|
|
2
|
-
import { i as onPath, n as AGENT_NAMES, r as detectAgent, t as AGENT_BIN } from "./agent-BsieQGTD.mjs";
|
|
3
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
import { pathToFileURL } from "node:url";
|
|
6
|
-
//#region src/server/detect.ts
|
|
7
|
-
function readJson(file) {
|
|
8
|
-
try {
|
|
9
|
-
return JSON.parse(stripJsonComments(readFileSync(file, "utf8")));
|
|
10
|
-
} catch {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
function stripJsonComments(s) {
|
|
15
|
-
let out = "", inStr = false, inLine = false, inBlock = false;
|
|
16
|
-
for (let i = 0; i < s.length; i++) {
|
|
17
|
-
const c = s[i], n = s[i + 1];
|
|
18
|
-
if (inLine) {
|
|
19
|
-
if (c === "\n") {
|
|
20
|
-
inLine = false;
|
|
21
|
-
out += c;
|
|
22
|
-
}
|
|
23
|
-
continue;
|
|
24
|
-
}
|
|
25
|
-
if (inBlock) {
|
|
26
|
-
if (c === "*" && n === "/") {
|
|
27
|
-
inBlock = false;
|
|
28
|
-
i++;
|
|
29
|
-
}
|
|
30
|
-
continue;
|
|
31
|
-
}
|
|
32
|
-
if (inStr) {
|
|
33
|
-
out += c;
|
|
34
|
-
if (c === "\\") {
|
|
35
|
-
out += n ?? "";
|
|
36
|
-
i++;
|
|
37
|
-
} else if (c === "\"") inStr = false;
|
|
38
|
-
continue;
|
|
39
|
-
}
|
|
40
|
-
if (c === "\"") {
|
|
41
|
-
inStr = true;
|
|
42
|
-
out += c;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (c === "/" && n === "/") {
|
|
46
|
-
inLine = true;
|
|
47
|
-
i++;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
if (c === "/" && n === "*") {
|
|
51
|
-
inBlock = true;
|
|
52
|
-
i++;
|
|
53
|
-
continue;
|
|
54
|
-
}
|
|
55
|
-
out += c;
|
|
56
|
-
}
|
|
57
|
-
let res = "", inS = false;
|
|
58
|
-
for (let i = 0; i < out.length; i++) {
|
|
59
|
-
const c = out[i];
|
|
60
|
-
if (inS) {
|
|
61
|
-
res += c;
|
|
62
|
-
if (c === "\\") {
|
|
63
|
-
res += out[i + 1] ?? "";
|
|
64
|
-
i++;
|
|
65
|
-
} else if (c === "\"") inS = false;
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
if (c === "\"") {
|
|
69
|
-
inS = true;
|
|
70
|
-
res += c;
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (c === ",") {
|
|
74
|
-
let j = i + 1;
|
|
75
|
-
while (j < out.length && /\s/.test(out[j])) j++;
|
|
76
|
-
if (out[j] === "}" || out[j] === "]") continue;
|
|
77
|
-
}
|
|
78
|
-
res += c;
|
|
79
|
-
}
|
|
80
|
-
return res;
|
|
81
|
-
}
|
|
82
|
-
function detectHost(root) {
|
|
83
|
-
const pkg = readJson(join(root, "package.json")) ?? {};
|
|
84
|
-
const deps = {
|
|
85
|
-
...pkg.dependencies,
|
|
86
|
-
...pkg.devDependencies
|
|
87
|
-
};
|
|
88
|
-
const twRange = deps["tailwindcss"];
|
|
89
|
-
const tailwind = !twRange ? null : /(^|[^\d])4\./.test(twRange) || twRange.startsWith("^4") || twRange.startsWith("~4") ? 4 : 3;
|
|
90
|
-
const router = deps["next"] ? "next" : deps["react-router"] || deps["react-router-dom"] ? "react-router" : null;
|
|
91
|
-
const routerPkg = deps["react-router-dom"] ? "react-router-dom" : "react-router";
|
|
92
|
-
const toaster = deps["sonner"] ? "sonner" : deps["react-hot-toast"] ? "react-hot-toast" : null;
|
|
93
|
-
let shadcn = null;
|
|
94
|
-
const comp = readJson(join(root, "components.json"));
|
|
95
|
-
if (comp?.tailwind?.css) shadcn = {
|
|
96
|
-
themeCss: comp.tailwind.css,
|
|
97
|
-
uiAlias: comp.aliases?.ui ?? "@/components/ui"
|
|
98
|
-
};
|
|
99
|
-
const themeCss = shadcn?.themeCss && existsSync(join(root, shadcn.themeCss)) ? shadcn.themeCss : firstExisting(root, [
|
|
100
|
-
"src/index.css",
|
|
101
|
-
"src/styles/theme.css",
|
|
102
|
-
"src/styles/globals.css",
|
|
103
|
-
"src/app/globals.css",
|
|
104
|
-
"app/globals.css",
|
|
105
|
-
"src/globals.css",
|
|
106
|
-
"src/style.css",
|
|
107
|
-
"styles/globals.css"
|
|
108
|
-
]);
|
|
109
|
-
const ts = readJson(join(root, "tsconfig.json"));
|
|
110
|
-
const include = ts?.include;
|
|
111
|
-
const exclude = ts?.exclude ?? [];
|
|
112
|
-
const sweeps = ts != null && !exclude.some((e) => e === "design" || e.startsWith("design/")) && (!include || include.some((i) => i === "." || i.startsWith("**") || i.startsWith("design")));
|
|
113
|
-
return {
|
|
114
|
-
tailwind,
|
|
115
|
-
router,
|
|
116
|
-
routerPkg,
|
|
117
|
-
toaster,
|
|
118
|
-
shadcn,
|
|
119
|
-
themeCss,
|
|
120
|
-
tsconfigSweepsDesign: !!sweeps
|
|
121
|
-
};
|
|
122
|
-
}
|
|
123
|
-
function firstExisting(root, candidates) {
|
|
124
|
-
for (const c of candidates) if (existsSync(join(root, c))) return c;
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
//#endregion
|
|
128
|
-
//#region src/server/config.ts
|
|
129
|
-
const DEFAULTS = {
|
|
130
|
-
mode: "studio",
|
|
131
|
-
theme: null,
|
|
132
|
-
viewports: {
|
|
133
|
-
mobile: {
|
|
134
|
-
width: 390,
|
|
135
|
-
height: 844
|
|
136
|
-
},
|
|
137
|
-
tablet: {
|
|
138
|
-
width: 768,
|
|
139
|
-
height: 1024
|
|
140
|
-
},
|
|
141
|
-
laptop: {
|
|
142
|
-
width: 1280,
|
|
143
|
-
height: 800
|
|
144
|
-
},
|
|
145
|
-
monitor: {
|
|
146
|
-
width: 1920,
|
|
147
|
-
height: 1080
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
|
-
themes: ["light", "dark"],
|
|
151
|
-
port: 5199,
|
|
152
|
-
zoomSpeed: 1,
|
|
153
|
-
share: { branding: true }
|
|
154
|
-
};
|
|
155
|
-
/** Load design/config.ts via native TS import (Node >= 22.18). Missing or broken fields fall back to defaults. */
|
|
156
|
-
async function loadConfig(root) {
|
|
157
|
-
const file = join(root, "design", "config.ts");
|
|
158
|
-
if (!existsSync(file)) return {
|
|
159
|
-
...DEFAULTS,
|
|
160
|
-
...jamFields(void 0)
|
|
161
|
-
};
|
|
162
|
-
try {
|
|
163
|
-
const user = (await import(`${pathToFileURL(file).href}?t=${Date.now()}`)).default ?? {};
|
|
164
|
-
return {
|
|
165
|
-
...DEFAULTS,
|
|
166
|
-
...user,
|
|
167
|
-
viewports: validViewports(user.viewports) ?? DEFAULTS.viewports,
|
|
168
|
-
themes: Array.isArray(user.themes) && user.themes.length ? user.themes.map(String) : DEFAULTS.themes,
|
|
169
|
-
port: validPort(user.port) ?? DEFAULTS.port,
|
|
170
|
-
zoomSpeed: validZoom(user.zoomSpeed) ?? DEFAULTS.zoomSpeed,
|
|
171
|
-
description: readDescription(user.description),
|
|
172
|
-
share: {
|
|
173
|
-
branding: user.share?.branding !== false,
|
|
174
|
-
name: typeof user.share?.name === "string" ? user.share.name : void 0,
|
|
175
|
-
logo: typeof user.share?.logo === "string" ? user.share.logo : void 0,
|
|
176
|
-
frontDoor: user.share?.frontDoor !== false && user.share?.front_door !== false,
|
|
177
|
-
notify: user.share?.notify !== false
|
|
178
|
-
},
|
|
179
|
-
...jamFields(user.jam)
|
|
180
|
-
};
|
|
181
|
-
} catch (err) {
|
|
182
|
-
console.error(`[marver] design/config.ts failed to load, using defaults and leaving Live Jam OFF:\n ${err.message}`);
|
|
183
|
-
return {
|
|
184
|
-
...DEFAULTS,
|
|
185
|
-
jamOff: "unreadable"
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
const validDim = (n) => typeof n === "number" && Number.isFinite(n) && n >= 1 && n <= 2e4;
|
|
190
|
-
function validPort(n) {
|
|
191
|
-
return typeof n === "number" && Number.isInteger(n) && n > 0 && n < 65536 ? n : null;
|
|
192
|
-
}
|
|
193
|
-
function validZoom(n) {
|
|
194
|
-
return typeof n === "number" && Number.isFinite(n) && n >= .1 && n <= 10 ? n : null;
|
|
195
|
-
}
|
|
196
|
-
/** Six frames at once is what a jam actually feels like - at 3, half of a multi-frame
|
|
197
|
-
* ask sat waiting on the other half while the human watched. */
|
|
198
|
-
const DEFAULT_CONCURRENCY = 6;
|
|
199
|
-
/** A config value, printable in a warning. Never throws - a formatter that can crash inside an
|
|
200
|
-
* error path (JSON.stringify does, on a BigInt) turns a clear message into a mystery. */
|
|
201
|
-
const show = (v) => {
|
|
202
|
-
try {
|
|
203
|
-
return JSON.stringify(v) ?? String(v);
|
|
204
|
-
} catch {
|
|
205
|
-
return String(v);
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
/** A `{...}` written by hand, not a Date/Map/class instance that merely types as "object". */
|
|
209
|
-
const plainObject = (v) => {
|
|
210
|
-
if (!v || typeof v !== "object") return false;
|
|
211
|
-
const proto = Object.getPrototypeOf(v);
|
|
212
|
-
return proto === Object.prototype || proto === null;
|
|
213
|
-
};
|
|
214
|
-
/** The agent to arm with - or, when the human NAMED one we cannot use, why not (said once,
|
|
215
|
-
* here, because a bad `jam.agent` is a config-file error like any other).
|
|
216
|
-
*
|
|
217
|
-
* A named agent is never quietly swapped for another: running a different tool than the one
|
|
218
|
-
* asked for is worse than not running. Nor is one armed that cannot be spawned - that would
|
|
219
|
-
* claim every @marver mention, fail it, and never retry. */
|
|
220
|
-
function resolveAgent(named) {
|
|
221
|
-
if (named === void 0) return detectAgent() ?? "no-agent";
|
|
222
|
-
if (typeof named !== "string" || !Object.hasOwn(AGENT_BIN, named)) {
|
|
223
|
-
console.warn(`[marver] design/config.ts: jam.agent ${show(named)} is not an agent marver can spawn - Live Jam is off. Use ${AGENT_NAMES}.`);
|
|
224
|
-
return "bad-agent";
|
|
225
|
-
}
|
|
226
|
-
const agent = named;
|
|
227
|
-
if (!onPath(AGENT_BIN[agent])) {
|
|
228
|
-
console.warn(`[marver] design/config.ts names jam.agent "${agent}", but \`${AGENT_BIN[agent]}\` is not on PATH - Live Jam is off until it is installed.`);
|
|
229
|
-
return "bad-agent";
|
|
230
|
-
}
|
|
231
|
-
return agent;
|
|
232
|
-
}
|
|
233
|
-
/** Resolve the jam block. Live Jam is ON by default: an absent or partial `jam` resolves
|
|
234
|
-
* to whatever agent CLI this machine has, so a fresh workspace jams with nothing
|
|
235
|
-
* configured and an old one needs no re-init. `jam: false` is the off switch. */
|
|
236
|
-
function resolveJam(v) {
|
|
237
|
-
if (v === false) return "opted-out";
|
|
238
|
-
const shape = v === void 0 || v === true ? {} : typeof v === "string" ? { agent: v } : plainObject(v) ? v : null;
|
|
239
|
-
if (!shape) {
|
|
240
|
-
console.warn(`[marver] design/config.ts: jam must be false, an agent name, or an options object - got ${show(v)}. Live Jam is off.`);
|
|
241
|
-
return "bad-agent";
|
|
242
|
-
}
|
|
243
|
-
const j = shape;
|
|
244
|
-
const agent = resolveAgent(j.agent);
|
|
245
|
-
if (agent === "no-agent" || agent === "bad-agent") return agent;
|
|
246
|
-
const c = j.concurrency;
|
|
247
|
-
const pick = (key, v, ok, fallback, want) => {
|
|
248
|
-
if (v === void 0) return fallback;
|
|
249
|
-
if (ok(v)) return v;
|
|
250
|
-
console.warn(`[marver] design/config.ts: jam.${key} must be ${want} - got ${show(v)}. Using ${JSON.stringify(fallback)}.`);
|
|
251
|
-
return fallback;
|
|
252
|
-
};
|
|
253
|
-
const bool = (v) => typeof v === "boolean";
|
|
254
|
-
return {
|
|
255
|
-
agent,
|
|
256
|
-
concurrency: typeof c === "number" && Number.isInteger(c) && c >= 1 && c <= 16 ? c : DEFAULT_CONCURRENCY,
|
|
257
|
-
subagents: j.subagents !== false,
|
|
258
|
-
proactive: j.proactive === true,
|
|
259
|
-
chime: pick("chime", j.chime, bool, true, "true or false"),
|
|
260
|
-
capture: pick("capture", j.capture, (v) => v === "confirm" || v === "at-once", "confirm", `'confirm' or 'at-once'`),
|
|
261
|
-
loc: pick("loc", j.loc, bool, true, "true or false"),
|
|
262
|
-
names: pick("names", j.names, bool, true, "true or false")
|
|
263
|
-
};
|
|
264
|
-
}
|
|
265
|
-
/** Exactly one of `jam` (armed) or `jamOff` (why not) - so the dev server can speak up about
|
|
266
|
-
* the one off-state nothing has reported yet, and stay quiet about the rest. BOTH keys are
|
|
267
|
-
* always written: these spread over the user's own `jam`, and a raw `jam: false` reaching the
|
|
268
|
-
* server as config would arm the daemon against a truthy object check. */
|
|
269
|
-
function jamFields(v) {
|
|
270
|
-
const r = resolveJam(v);
|
|
271
|
-
return typeof r === "string" ? {
|
|
272
|
-
jam: void 0,
|
|
273
|
-
jamOff: r
|
|
274
|
-
} : {
|
|
275
|
-
jam: r,
|
|
276
|
-
jamOff: void 0
|
|
277
|
-
};
|
|
278
|
-
}
|
|
279
|
-
function validViewports(v) {
|
|
280
|
-
if (!v || typeof v !== "object") return null;
|
|
281
|
-
const out = {};
|
|
282
|
-
for (const [k, val] of Object.entries(v)) {
|
|
283
|
-
const vp = val;
|
|
284
|
-
if (validDim(vp?.width) && validDim(vp?.height)) out[k] = {
|
|
285
|
-
width: Math.round(vp.width),
|
|
286
|
-
height: Math.round(vp.height)
|
|
287
|
-
};
|
|
288
|
-
}
|
|
289
|
-
return Object.keys(out).length ? out : null;
|
|
290
|
-
}
|
|
291
|
-
//#endregion
|
|
292
|
-
export { readJson as i, loadConfig as n, detectHost as r, DEFAULTS as t };
|