@marver-design/marver 0.16.1 → 0.18.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.
Files changed (43) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +3 -2
  3. package/dist/bake-jr38C_pX.mjs +747 -0
  4. package/dist/{build-B4yPgFNF.mjs → build-ER_7T6Cw.mjs} +179 -10
  5. package/dist/cli.mjs +21 -13
  6. package/dist/{comments-oYcZ3cE-.mjs → comments-ClVgfQib.mjs} +1 -1
  7. package/dist/{daemon-Bbh_jmui.mjs → daemon-CKhg0zuT.mjs} +1 -1
  8. package/dist/{dev-DH2W7Ffw.mjs → dev-BvLbY98O.mjs} +208 -9
  9. package/dist/{init-B7YhcN2o.mjs → init-BWbHqVng.mjs} +2 -2
  10. package/dist/{manifest-CaslQIAO.mjs → manifest-DAnEL8_a.mjs} +1 -1
  11. package/dist/{marver-id-gate-D6By7XHj.mjs → marver-id-gate-B_idGdHm.mjs} +1 -1
  12. package/dist/{plugin-BeBGu3gH.mjs → plugin-Cai5C1WV.mjs} +244 -47
  13. package/dist/{poster-CoyobbGW.mjs → poster-CIuz_PwH.mjs} +13 -5
  14. package/dist/publish-bakes-D0LhbQQ3.mjs +216 -0
  15. package/dist/{serve-Bcwfpvhl.mjs → serve-z5qtj_wJ.mjs} +3 -3
  16. package/dist/{share-Gqo_Ygqw.mjs → share--bdSc4G5.mjs} +1 -1
  17. package/dist/shot-BFEuYbaz.mjs +86 -0
  18. package/dist/shot-iicees2e.mjs +933 -0
  19. package/dist/{work-lzC-lPY0.mjs → work-0YopuMt9.mjs} +1 -1
  20. package/docs/live-jam.md +20 -8
  21. package/docs/publish.md +27 -5
  22. package/package.json +1 -1
  23. package/src/client/frame-host/bridge.js +4 -9
  24. package/src/client/frame-host/main.tsx +20 -6
  25. package/src/client/shell/App.tsx +7 -0
  26. package/src/client/shell/Comments.tsx +2 -2
  27. package/src/client/shell/canvas/Canvas.tsx +2 -2
  28. package/src/client/shell/canvas/FrameNode.tsx +82 -89
  29. package/src/client/shell/canvas/admission.ts +70 -0
  30. package/src/client/shell/canvas/sleep.ts +194 -0
  31. package/src/client/shell/store.ts +14 -0
  32. package/src/client/shell/styles.css +9 -25
  33. package/src/shared/sleep-rule.ts +41 -0
  34. package/templates/AGENTS-embedded.md +4 -1
  35. package/templates/AGENTS-studio.md +4 -1
  36. package/templates/instructions/craft.md +9 -0
  37. package/templates/instructions/jam.md +15 -3
  38. package/templates/instructions/publish.md +62 -9
  39. package/templates/instructions/shape.md +2 -1
  40. package/dist/shot-By1AItpD.mjs +0 -30
  41. package/dist/shot-z-d-zMzf.mjs +0 -528
  42. package/src/client/frame-host/serialize.ts +0 -195
  43. package/src/client/shell/canvas/snapshots.ts +0 -233
@@ -0,0 +1,86 @@
1
+ import { r as NAME } from "./cli.mjs";
2
+ import { readDevInfo } from "./work-CLrmY-vQ.mjs";
3
+ //#region src/cli/shot.ts
4
+ /**
5
+ * `marver shot <scene/frame> [...]`, `--scene <name>`, `--all` - render frames headless and
6
+ * print the PNG paths, one per line, in the order asked.
7
+ *
8
+ * The shell-ful agents' door into the same verify loop jam teaches: build, shoot, LOOK. One
9
+ * frame goes through /api/shot; several, a scene or everything go through /api/shots as ONE
10
+ * operation (one browser, several frames at a time), so shooting a scene costs about what
11
+ * shooting a frame did. shot.ts (server) has the capture story.
12
+ */
13
+ async function shotCommand(root, frames, opts) {
14
+ const usage = `${NAME} shot <scene/frame ...> | --scene <name> | --all [--theme <name>] [--scale 1-4] [--json]`;
15
+ if ([
16
+ frames.length > 0,
17
+ !!opts.scene,
18
+ !!opts.all
19
+ ].filter(Boolean).length !== 1) throw new Error(`name the frames, one way: ${usage}`);
20
+ const info = readDevInfo(root);
21
+ if (!info) throw new Error(`\`${NAME} dev\` is not running in this repo (design/.local/dev.json not found) - start it first.`);
22
+ const scale = opts.scale != null ? Number(opts.scale) : void 0;
23
+ const theme = opts.theme;
24
+ const single = frames.length === 1 && !opts.scene && !opts.all;
25
+ let res;
26
+ try {
27
+ if (single) {
28
+ const qs = new URLSearchParams({
29
+ frame: frames[0],
30
+ ...theme ? { theme } : {},
31
+ ...scale != null ? { scale: String(scale) } : {}
32
+ });
33
+ res = await fetch(`http://localhost:${info.port}/__mv/api/shot?${qs}`, { headers: { "x-mv-work": info.token } });
34
+ } else {
35
+ const sel = opts.all ? { all: true } : opts.scene ? { scene: opts.scene } : { frames };
36
+ res = await fetch(`http://localhost:${info.port}/__mv/api/shots`, {
37
+ method: "POST",
38
+ headers: {
39
+ "x-mv-work": info.token,
40
+ "content-type": "application/json"
41
+ },
42
+ body: JSON.stringify({
43
+ ...sel,
44
+ ...theme ? { theme } : {},
45
+ ...scale != null ? { scale } : {}
46
+ })
47
+ });
48
+ }
49
+ } catch {
50
+ throw new Error(`could not reach \`${NAME} dev\` on port ${info.port} - is it still running?`);
51
+ }
52
+ const data = await res.json().catch(() => ({}));
53
+ if (!res.ok) throw new Error(data.error ?? `shot failed (${res.status})`);
54
+ const one = data;
55
+ const results = single ? [one.path ? {
56
+ frame: frames[0],
57
+ ok: true,
58
+ path: one.path,
59
+ width: one.width,
60
+ height: one.height,
61
+ scale: one.scale,
62
+ ...one.truncated ? { truncated: true } : {},
63
+ ...one.unsettled ? { unsettled: true } : {},
64
+ ...one.note ? { note: one.note } : {}
65
+ } : {
66
+ frame: frames[0],
67
+ ok: false,
68
+ error: one.error ?? "shot failed"
69
+ }] : data.results ?? [];
70
+ if (opts.json) {
71
+ console.log(JSON.stringify({ results }, null, 2));
72
+ if (results.some((r) => !r.ok)) process.exitCode = 1;
73
+ return;
74
+ }
75
+ let failed = false;
76
+ for (const r of results) if (r.ok) {
77
+ console.log(r.path);
78
+ if (r.note) console.error(`${r.frame}: ${r.note}`);
79
+ } else {
80
+ failed = true;
81
+ console.error(`${r.frame}: ${r.error}`);
82
+ }
83
+ if (failed) process.exitCode = 1;
84
+ }
85
+ //#endregion
86
+ export { shotCommand };