@monoes/monomindcli 2.16.1 → 2.16.2

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 (214) hide show
  1. package/.claude/helpers/handlers/edit-handler.cjs +14 -12
  2. package/.claude/helpers/handlers/route-handler.cjs +6 -0
  3. package/.claude/helpers/monograph-freshen.cjs +31 -113
  4. package/.claude/helpers/utils/monograph-resolve.cjs +497 -0
  5. package/.claude/helpers/utils/monograph.cjs +8 -51
  6. package/README.md +1 -1
  7. package/dist/src/commands/doctor-hook-monograph-checks.d.ts +8 -0
  8. package/dist/src/commands/doctor-hook-monograph-checks.d.ts.map +1 -0
  9. package/dist/src/commands/doctor-hook-monograph-checks.js +79 -0
  10. package/dist/src/commands/doctor-hook-monograph-checks.js.map +1 -0
  11. package/dist/src/commands/doctor.d.ts.map +1 -1
  12. package/dist/src/commands/doctor.js +4 -1
  13. package/dist/src/commands/doctor.js.map +1 -1
  14. package/dist/src/commands/monograph.d.ts.map +1 -1
  15. package/dist/src/commands/monograph.js +16 -1
  16. package/dist/src/commands/monograph.js.map +1 -1
  17. package/dist/src/orgrt/bash-timeout.d.ts +14 -0
  18. package/dist/src/orgrt/bash-timeout.d.ts.map +1 -0
  19. package/dist/src/orgrt/bash-timeout.js +18 -0
  20. package/dist/src/orgrt/bash-timeout.js.map +1 -0
  21. package/dist/src/orgrt/block-recheck.d.ts +30 -0
  22. package/dist/src/orgrt/block-recheck.d.ts.map +1 -0
  23. package/dist/src/orgrt/block-recheck.js +81 -0
  24. package/dist/src/orgrt/block-recheck.js.map +1 -0
  25. package/dist/src/orgrt/completion-gate.d.ts +4 -0
  26. package/dist/src/orgrt/completion-gate.d.ts.map +1 -1
  27. package/dist/src/orgrt/completion-gate.js +22 -2
  28. package/dist/src/orgrt/completion-gate.js.map +1 -1
  29. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  30. package/dist/src/orgrt/daemon.js +6 -4
  31. package/dist/src/orgrt/daemon.js.map +1 -1
  32. package/dist/src/orgrt/decisions.d.ts +1 -1
  33. package/dist/src/orgrt/decisions.d.ts.map +1 -1
  34. package/dist/src/orgrt/decisions.js +14 -6
  35. package/dist/src/orgrt/decisions.js.map +1 -1
  36. package/dist/src/orgrt/mailbox.d.ts +14 -0
  37. package/dist/src/orgrt/mailbox.d.ts.map +1 -1
  38. package/dist/src/orgrt/mailbox.js +31 -1
  39. package/dist/src/orgrt/mailbox.js.map +1 -1
  40. package/dist/src/orgrt/sandbox-fault.d.ts +16 -6
  41. package/dist/src/orgrt/sandbox-fault.d.ts.map +1 -1
  42. package/dist/src/orgrt/sandbox-fault.js +78 -33
  43. package/dist/src/orgrt/sandbox-fault.js.map +1 -1
  44. package/dist/src/orgrt/session.d.ts +4 -3
  45. package/dist/src/orgrt/session.d.ts.map +1 -1
  46. package/dist/src/orgrt/session.js +24 -13
  47. package/dist/src/orgrt/session.js.map +1 -1
  48. package/dist/src/orgrt/task-dag.d.ts +8 -2
  49. package/dist/src/orgrt/task-dag.d.ts.map +1 -1
  50. package/dist/src/orgrt/task-dag.js +10 -4
  51. package/dist/src/orgrt/task-dag.js.map +1 -1
  52. package/dist/src/orgrt/types.d.ts +11 -0
  53. package/dist/src/orgrt/types.d.ts.map +1 -1
  54. package/dist/src/orgrt/types.js +18 -0
  55. package/dist/src/orgrt/types.js.map +1 -1
  56. package/dist/src/utils/resource-governor.d.ts.map +1 -1
  57. package/dist/src/utils/resource-governor.js +35 -2
  58. package/dist/src/utils/resource-governor.js.map +1 -1
  59. package/dist/tsconfig.tsbuildinfo +1 -1
  60. package/package.json +6 -6
  61. package/.claude/skills/monodesign/SKILL.md +0 -257
  62. package/.claude/skills/monodesign/adapt.md +0 -53
  63. package/.claude/skills/monodesign/agents/monodesign-asset-producer.md +0 -100
  64. package/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +0 -103
  65. package/.claude/skills/monodesign/animate.md +0 -65
  66. package/.claude/skills/monodesign/audit.md +0 -89
  67. package/.claude/skills/monodesign/bolder.md +0 -50
  68. package/.claude/skills/monodesign/clarify.md +0 -64
  69. package/.claude/skills/monodesign/colorize.md +0 -68
  70. package/.claude/skills/monodesign/craft.md +0 -51
  71. package/.claude/skills/monodesign/critique.md +0 -66
  72. package/.claude/skills/monodesign/delight.md +0 -47
  73. package/.claude/skills/monodesign/distill.md +0 -56
  74. package/.claude/skills/monodesign/document.md +0 -83
  75. package/.claude/skills/monodesign/extract.md +0 -74
  76. package/.claude/skills/monodesign/harden.md +0 -65
  77. package/.claude/skills/monodesign/init.md +0 -30
  78. package/.claude/skills/monodesign/layout.md +0 -36
  79. package/.claude/skills/monodesign/live.md +0 -34
  80. package/.claude/skills/monodesign/onboard.md +0 -50
  81. package/.claude/skills/monodesign/optimize.md +0 -64
  82. package/.claude/skills/monodesign/overdrive.md +0 -56
  83. package/.claude/skills/monodesign/polish.md +0 -68
  84. package/.claude/skills/monodesign/quieter.md +0 -57
  85. package/.claude/skills/monodesign/reference/adapt.md +0 -312
  86. package/.claude/skills/monodesign/reference/adapt.native.md +0 -58
  87. package/.claude/skills/monodesign/reference/android.md +0 -40
  88. package/.claude/skills/monodesign/reference/animate.md +0 -203
  89. package/.claude/skills/monodesign/reference/antipatterns-catalog.md +0 -410
  90. package/.claude/skills/monodesign/reference/audit.md +0 -135
  91. package/.claude/skills/monodesign/reference/audit.native.md +0 -139
  92. package/.claude/skills/monodesign/reference/bolder.md +0 -120
  93. package/.claude/skills/monodesign/reference/brand-workflow.md +0 -180
  94. package/.claude/skills/monodesign/reference/brand.md +0 -108
  95. package/.claude/skills/monodesign/reference/clarify.md +0 -288
  96. package/.claude/skills/monodesign/reference/codex.md +0 -105
  97. package/.claude/skills/monodesign/reference/cognitive-load.md +0 -106
  98. package/.claude/skills/monodesign/reference/color-and-contrast.md +0 -105
  99. package/.claude/skills/monodesign/reference/colorize.md +0 -257
  100. package/.claude/skills/monodesign/reference/component-specs.md +0 -260
  101. package/.claude/skills/monodesign/reference/component-states.md +0 -274
  102. package/.claude/skills/monodesign/reference/component-system.md +0 -358
  103. package/.claude/skills/monodesign/reference/copy-formulas.md +0 -160
  104. package/.claude/skills/monodesign/reference/craft.md +0 -123
  105. package/.claude/skills/monodesign/reference/critique.md +0 -780
  106. package/.claude/skills/monodesign/reference/delight.md +0 -302
  107. package/.claude/skills/monodesign/reference/design-principles.md +0 -246
  108. package/.claude/skills/monodesign/reference/distill.md +0 -111
  109. package/.claude/skills/monodesign/reference/document.md +0 -429
  110. package/.claude/skills/monodesign/reference/extract.md +0 -69
  111. package/.claude/skills/monodesign/reference/harden.md +0 -347
  112. package/.claude/skills/monodesign/reference/heuristics-scoring.md +0 -234
  113. package/.claude/skills/monodesign/reference/hooks.md +0 -92
  114. package/.claude/skills/monodesign/reference/image-prompts.md +0 -130
  115. package/.claude/skills/monodesign/reference/init.md +0 -221
  116. package/.claude/skills/monodesign/reference/interaction-design.md +0 -189
  117. package/.claude/skills/monodesign/reference/ios.md +0 -45
  118. package/.claude/skills/monodesign/reference/layout.md +0 -185
  119. package/.claude/skills/monodesign/reference/live.md +0 -710
  120. package/.claude/skills/monodesign/reference/motion-design.md +0 -109
  121. package/.claude/skills/monodesign/reference/onboard.md +0 -234
  122. package/.claude/skills/monodesign/reference/optimize.md +0 -258
  123. package/.claude/skills/monodesign/reference/overdrive.md +0 -130
  124. package/.claude/skills/monodesign/reference/personas.md +0 -179
  125. package/.claude/skills/monodesign/reference/polish.md +0 -241
  126. package/.claude/skills/monodesign/reference/pre-delivery-checklist.md +0 -108
  127. package/.claude/skills/monodesign/reference/product.md +0 -60
  128. package/.claude/skills/monodesign/reference/quieter.md +0 -99
  129. package/.claude/skills/monodesign/reference/responsive-design.md +0 -114
  130. package/.claude/skills/monodesign/reference/shape.md +0 -165
  131. package/.claude/skills/monodesign/reference/spatial-design.md +0 -100
  132. package/.claude/skills/monodesign/reference/teach.md +0 -10
  133. package/.claude/skills/monodesign/reference/token-architecture.md +0 -222
  134. package/.claude/skills/monodesign/reference/typeset.md +0 -301
  135. package/.claude/skills/monodesign/reference/typography.md +0 -159
  136. package/.claude/skills/monodesign/reference/ux-research.md +0 -143
  137. package/.claude/skills/monodesign/reference/ux-rules.md +0 -211
  138. package/.claude/skills/monodesign/reference/ux-writing.md +0 -107
  139. package/.claude/skills/monodesign/scripts/command-metadata.json +0 -94
  140. package/.claude/skills/monodesign/scripts/context-signals.mjs +0 -260
  141. package/.claude/skills/monodesign/scripts/context.mjs +0 -1065
  142. package/.claude/skills/monodesign/scripts/critique-storage.mjs +0 -416
  143. package/.claude/skills/monodesign/scripts/detect-csp.mjs +0 -193
  144. package/.claude/skills/monodesign/scripts/detect.mjs +0 -33
  145. package/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +0 -1960
  146. package/.claude/skills/monodesign/scripts/detector/cli/main.mjs +0 -321
  147. package/.claude/skills/monodesign/scripts/detector/design-system.mjs +0 -814
  148. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +0 -5628
  149. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +0 -50
  150. package/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +0 -259
  151. package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +0 -339
  152. package/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +0 -636
  153. package/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +0 -1016
  154. package/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +0 -253
  155. package/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -198
  156. package/.claude/skills/monodesign/scripts/detector/findings.mjs +0 -12
  157. package/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +0 -181
  158. package/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +0 -373
  159. package/.claude/skills/monodesign/scripts/detector/fix/index.mjs +0 -426
  160. package/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +0 -198
  161. package/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +0 -166
  162. package/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +0 -563
  163. package/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +0 -3024
  164. package/.claude/skills/monodesign/scripts/detector/shared/color.mjs +0 -124
  165. package/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +0 -101
  166. package/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +0 -30
  167. package/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +0 -148
  168. package/.claude/skills/monodesign/scripts/detector/shared/page.mjs +0 -7
  169. package/.claude/skills/monodesign/scripts/hook-admin.mjs +0 -694
  170. package/.claude/skills/monodesign/scripts/hook-before-edit.mjs +0 -516
  171. package/.claude/skills/monodesign/scripts/hook-lib.mjs +0 -1785
  172. package/.claude/skills/monodesign/scripts/hook.mjs +0 -61
  173. package/.claude/skills/monodesign/scripts/lib/design-parser.mjs +0 -809
  174. package/.claude/skills/monodesign/scripts/lib/is-generated.mjs +0 -69
  175. package/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +0 -640
  176. package/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +0 -129
  177. package/.claude/skills/monodesign/scripts/lib/provider.mjs +0 -4
  178. package/.claude/skills/monodesign/scripts/lib/target-args.mjs +0 -42
  179. package/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +0 -50
  180. package/.claude/skills/monodesign/scripts/live/completion.mjs +0 -19
  181. package/.claude/skills/monodesign/scripts/live/event-validation.mjs +0 -137
  182. package/.claude/skills/monodesign/scripts/live/insert-ui.mjs +0 -458
  183. package/.claude/skills/monodesign/scripts/live/manual-apply.mjs +0 -939
  184. package/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +0 -357
  185. package/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +0 -152
  186. package/.claude/skills/monodesign/scripts/live/session-store.mjs +0 -293
  187. package/.claude/skills/monodesign/scripts/live/svelte-component.mjs +0 -826
  188. package/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +0 -279
  189. package/.claude/skills/monodesign/scripts/live/ui-core.mjs +0 -180
  190. package/.claude/skills/monodesign/scripts/live/vocabulary.mjs +0 -36
  191. package/.claude/skills/monodesign/scripts/live-accept.mjs +0 -812
  192. package/.claude/skills/monodesign/scripts/live-browser-dom.js +0 -147
  193. package/.claude/skills/monodesign/scripts/live-browser-session.js +0 -124
  194. package/.claude/skills/monodesign/scripts/live-browser.js +0 -11213
  195. package/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +0 -1241
  196. package/.claude/skills/monodesign/scripts/live-complete.mjs +0 -75
  197. package/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +0 -683
  198. package/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +0 -51
  199. package/.claude/skills/monodesign/scripts/live-inject.mjs +0 -596
  200. package/.claude/skills/monodesign/scripts/live-insert.mjs +0 -272
  201. package/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +0 -363
  202. package/.claude/skills/monodesign/scripts/live-poll.mjs +0 -384
  203. package/.claude/skills/monodesign/scripts/live-resume.mjs +0 -94
  204. package/.claude/skills/monodesign/scripts/live-server.mjs +0 -1210
  205. package/.claude/skills/monodesign/scripts/live-status.mjs +0 -61
  206. package/.claude/skills/monodesign/scripts/live-target.mjs +0 -30
  207. package/.claude/skills/monodesign/scripts/live-wrap.mjs +0 -884
  208. package/.claude/skills/monodesign/scripts/live.mjs +0 -297
  209. package/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +0 -14
  210. package/.claude/skills/monodesign/scripts/palette.mjs +0 -635
  211. package/.claude/skills/monodesign/scripts/pin.mjs +0 -221
  212. package/.claude/skills/monodesign/shape.md +0 -71
  213. package/.claude/skills/monodesign/teach.md +0 -18
  214. package/.claude/skills/monodesign/typeset.md +0 -59
@@ -1,279 +0,0 @@
1
- /**
2
- * SvelteKit live-mode adapter.
3
- *
4
- * SvelteKit must not be patched through src/app.html. That file is a document
5
- * template, not framework-owned component chrome. The adapter keeps SvelteKit
6
- * work limited to mounting a dev-only shadow host from +layout.svelte; the
7
- * actual live UI remains the shared plain-DOM browser chrome.
8
- */
9
-
10
- import fs from 'node:fs';
11
- import path from 'node:path';
12
-
13
- export const SVELTE_LIVE_ROOT_COMPONENT = 'src/lib/monodesign/MonodesignLiveRoot.svelte';
14
- export const SVELTE_LAYOUT_MARKER_OPEN = '<!-- monodesign-live-svelte-start -->';
15
- export const SVELTE_LAYOUT_MARKER_CLOSE = '<!-- monodesign-live-svelte-end -->';
16
- export const SVELTE_ROOT_IMPORT = "import MonodesignLiveRoot from '$lib/monodesign/MonodesignLiveRoot.svelte';";
17
-
18
- export function detectSvelteKitProject(cwd = process.cwd(), config = null) {
19
- const appHtml = findSvelteKitAppHtml(cwd, config);
20
- if (!appHtml) return null;
21
- const hasTemplateMarkers = fileIncludes(path.join(cwd, appHtml), '%sveltekit.body%')
22
- && fileIncludes(path.join(cwd, appHtml), '%sveltekit.head%');
23
- if (!hasTemplateMarkers) return null;
24
-
25
- const hasSvelteConfig = fs.existsSync(path.join(cwd, 'svelte.config.js'))
26
- || fs.existsSync(path.join(cwd, 'svelte.config.mjs'))
27
- || fs.existsSync(path.join(cwd, 'svelte.config.cjs'))
28
- || fs.existsSync(path.join(cwd, 'svelte.config.ts'));
29
- const hasKitPackage = packageHasSvelteKit(cwd);
30
- if (!hasSvelteConfig && !hasKitPackage) return null;
31
-
32
- return {
33
- appHtml,
34
- layoutFile: findSvelteKitLayout(cwd),
35
- rootComponent: SVELTE_LIVE_ROOT_COMPONENT,
36
- };
37
- }
38
-
39
- export function applySvelteKitLiveAdapter({ cwd = process.cwd(), port, authCred, config = null } = {}) {
40
- if (!Number.isFinite(Number(port))) {
41
- throw new Error('SvelteKit live adapter requires a numeric port');
42
- }
43
- if (!authCred) {
44
- throw new Error('SvelteKit live adapter requires an auth credential');
45
- }
46
- const detected = detectSvelteKitProject(cwd, config);
47
- if (!detected) return null;
48
-
49
- ensureSvelteLiveRootComponent(cwd, Number(port), authCred);
50
-
51
- const layoutRel = detected.layoutFile;
52
- const layoutAbs = path.join(cwd, layoutRel);
53
- fs.mkdirSync(path.dirname(layoutAbs), { recursive: true });
54
- const layoutExisted = fs.existsSync(layoutAbs);
55
- const before = layoutExisted ? fs.readFileSync(layoutAbs, 'utf-8') : defaultSvelteLayout();
56
- const after = patchSvelteLayout(before);
57
- fs.writeFileSync(layoutAbs, after, 'utf-8');
58
-
59
- return {
60
- file: layoutRel,
61
- adapter: 'sveltekit',
62
- inserted: after !== before || !layoutExisted,
63
- appHtmlUntouched: true,
64
- rootComponent: SVELTE_LIVE_ROOT_COMPONENT,
65
- };
66
- }
67
-
68
- export function removeSvelteKitLiveAdapter({ cwd = process.cwd(), config = null } = {}) {
69
- const detected = detectSvelteKitProject(cwd, config);
70
- if (!detected) return null;
71
-
72
- const layoutAbs = path.join(cwd, detected.layoutFile);
73
- let removed = false;
74
- if (fs.existsSync(layoutAbs)) {
75
- const before = fs.readFileSync(layoutAbs, 'utf-8');
76
- const after = unpatchSvelteLayout(before);
77
- if (after !== before) {
78
- fs.writeFileSync(layoutAbs, after, 'utf-8');
79
- removed = true;
80
- }
81
- }
82
-
83
- const rootAbs = path.join(cwd, SVELTE_LIVE_ROOT_COMPONENT);
84
- if (fs.existsSync(rootAbs)) {
85
- fs.rmSync(rootAbs, { force: true });
86
- removed = true;
87
- }
88
-
89
- pruneEmptyDir(path.dirname(rootAbs), path.join(cwd, 'src'));
90
-
91
- return {
92
- file: detected.layoutFile,
93
- adapter: 'sveltekit',
94
- removed,
95
- appHtmlUntouched: true,
96
- rootComponent: SVELTE_LIVE_ROOT_COMPONENT,
97
- };
98
- }
99
-
100
- export function patchSvelteLayout(content) {
101
- let out = String(content || '');
102
- if (!out.includes(SVELTE_ROOT_IMPORT)) {
103
- const scriptMatch = out.match(/<script(?:\s[^>]*)?>/i);
104
- if (scriptMatch) {
105
- const insertAt = scriptMatch.index + scriptMatch[0].length;
106
- out = `${out.slice(0, insertAt)}\n ${SVELTE_ROOT_IMPORT}${out.slice(insertAt)}`;
107
- } else {
108
- out = `<script>\n ${SVELTE_ROOT_IMPORT}\n</script>\n\n${out}`;
109
- }
110
- }
111
-
112
- if (!out.includes(SVELTE_LAYOUT_MARKER_OPEN)) {
113
- const block = `${SVELTE_LAYOUT_MARKER_OPEN}\n<MonodesignLiveRoot />\n${SVELTE_LAYOUT_MARKER_CLOSE}\n`;
114
- const renderMatch = out.match(/\{@render\s+children(?:\?\.)?\(\)\s*\}/);
115
- const slotMatch = out.match(/<slot\s*\/?>/);
116
- const match = renderMatch || slotMatch;
117
- if (match) {
118
- out = out.slice(0, match.index) + block + out.slice(match.index);
119
- } else {
120
- out = out.replace(/\s*$/, `\n\n${block}`);
121
- }
122
- }
123
-
124
- return out;
125
- }
126
-
127
- export function unpatchSvelteLayout(content) {
128
- let out = String(content || '');
129
- const blockRe = new RegExp(
130
- '([ \\t]*)' + escapeRegExp(SVELTE_LAYOUT_MARKER_OPEN)
131
- + '\\n<MonodesignLiveRoot\\s*/>\\n'
132
- + escapeRegExp(SVELTE_LAYOUT_MARKER_CLOSE)
133
- + '\\n?',
134
- 'g',
135
- );
136
- out = out.replace(blockRe, '$1');
137
- out = out.replace(new RegExp(`^\\s*${escapeRegExp(SVELTE_ROOT_IMPORT)}\\s*\\n?`, 'gm'), '');
138
- out = out.replace(/<script>\s*<\/script>\s*\n?/g, '');
139
- return out.replace(/\n{3,}/g, '\n\n');
140
- }
141
-
142
- export function ensureSvelteLiveRootComponent(cwd, port, authCred) {
143
- const file = path.join(cwd, SVELTE_LIVE_ROOT_COMPONENT);
144
- fs.mkdirSync(path.dirname(file), { recursive: true });
145
- fs.writeFileSync(file, buildSvelteLiveRootComponent(port, authCred), 'utf-8');
146
- return file;
147
- }
148
-
149
- export function buildSvelteLiveRootComponent(port, authCred) {
150
- const authQuery = new URLSearchParams();
151
- authQuery.set('token', String(authCred ?? ''));
152
- return `<script>
153
- import { onMount } from 'svelte';
154
-
155
- const LIVE_URL = 'http://localhost:${Number(port)}/live.js?${authQuery.toString()}';
156
- const HOST_ID = 'monodesign-live-root';
157
-
158
- onMount(() => {
159
- let host = document.querySelector('monodesign-live-root#' + HOST_ID) || document.getElementById(HOST_ID);
160
- if (!host) {
161
- host = document.createElement('monodesign-live-root');
162
- host.id = HOST_ID;
163
- document.body.appendChild(host);
164
- }
165
-
166
- host.dataset.monodesignLiveAdapter = 'sveltekit';
167
- host.style.setProperty('all', 'initial', 'important');
168
- host.style.setProperty('display', 'block', 'important');
169
- host.style.setProperty('position', 'fixed', 'important');
170
- host.style.setProperty('top', '0', 'important');
171
- host.style.setProperty('left', '0', 'important');
172
- host.style.setProperty('width', '0', 'important');
173
- host.style.setProperty('height', '0', 'important');
174
- host.style.setProperty('overflow', 'visible', 'important');
175
- host.style.setProperty('z-index', '2147483000', 'important');
176
- host.style.setProperty('pointer-events', 'none', 'important');
177
-
178
- const root = host.shadowRoot || host.attachShadow({ mode: 'open' });
179
- if (!root.querySelector('style[data-monodesign-live-reset]')) {
180
- const reset = document.createElement('style');
181
- reset.dataset.monodesignLiveReset = 'true';
182
- reset.textContent = ':host, :host *, * { box-sizing: border-box; }';
183
- root.appendChild(reset);
184
- }
185
-
186
- window.__MONODESIGN_LIVE_ADAPTER__ = 'sveltekit';
187
- window.__MONODESIGN_LIVE_UI_ROOT__ = root;
188
- window.__MONODESIGN_LIVE_CHROME_MOUNT__ = {
189
- adapter: 'sveltekit',
190
- version: 1,
191
- host,
192
- root,
193
- };
194
-
195
- const script = document.createElement('script');
196
- script.src = LIVE_URL;
197
- script.async = true;
198
- script.dataset.monodesignLiveScript = 'true';
199
- document.head.appendChild(script);
200
-
201
- return () => {
202
- script.remove();
203
- if (window.__MONODESIGN_LIVE_UI_ROOT__ === root) delete window.__MONODESIGN_LIVE_UI_ROOT__;
204
- if (window.__MONODESIGN_LIVE_CHROME_MOUNT__?.root === root) delete window.__MONODESIGN_LIVE_CHROME_MOUNT__;
205
- if (window.__MONODESIGN_LIVE_ADAPTER__ === 'sveltekit') delete window.__MONODESIGN_LIVE_ADAPTER__;
206
- };
207
- });
208
- </script>
209
- `;
210
- }
211
-
212
- function findSvelteKitAppHtml(cwd, config) {
213
- const files = Array.isArray(config?.files) ? config.files : ['src/app.html'];
214
- for (const rel of files) {
215
- if (rel.includes('*')) continue;
216
- const normalized = rel.split(path.sep).join('/');
217
- if (!normalized.endsWith('app.html')) continue;
218
- const abs = path.join(cwd, normalized);
219
- if (fs.existsSync(abs)) return normalized;
220
- }
221
- const fallback = 'src/app.html';
222
- return fs.existsSync(path.join(cwd, fallback)) ? fallback : null;
223
- }
224
-
225
- function findSvelteKitLayout(cwd) {
226
- const candidates = [
227
- 'src/routes/+layout.svelte',
228
- 'src/routes/(app)/+layout.svelte',
229
- ];
230
- for (const rel of candidates) {
231
- if (fs.existsSync(path.join(cwd, rel))) return rel;
232
- }
233
- return 'src/routes/+layout.svelte';
234
- }
235
-
236
- function defaultSvelteLayout() {
237
- return `<script>\n let { children } = $props();\n</script>\n\n{@render children?.()}\n`;
238
- }
239
-
240
- function packageHasSvelteKit(cwd) {
241
- const file = path.join(cwd, 'package.json');
242
- if (!fs.existsSync(file)) return false;
243
- try {
244
- const pkg = JSON.parse(fs.readFileSync(file, 'utf-8'));
245
- const deps = {
246
- ...(pkg.dependencies || {}),
247
- ...(pkg.devDependencies || {}),
248
- ...(pkg.peerDependencies || {}),
249
- };
250
- return Boolean(deps['@sveltejs/kit'] || deps['@sveltejs/vite-plugin-svelte'] || deps.svelte);
251
- } catch {
252
- return false;
253
- }
254
- }
255
-
256
- function fileIncludes(file, text) {
257
- try {
258
- return fs.readFileSync(file, 'utf-8').includes(text);
259
- } catch {
260
- return false;
261
- }
262
- }
263
-
264
- function pruneEmptyDir(dir, stopDir) {
265
- let current = dir;
266
- while (current.startsWith(stopDir) && current !== stopDir) {
267
- try {
268
- if (fs.readdirSync(current).length > 0) return;
269
- fs.rmdirSync(current);
270
- current = path.dirname(current);
271
- } catch {
272
- return;
273
- }
274
- }
275
- }
276
-
277
- function escapeRegExp(value) {
278
- return String(value).replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
279
- }
@@ -1,180 +0,0 @@
1
- /**
2
- * Framework-neutral Monodesign live chrome contract.
3
- *
4
- * The production browser bundle is intentionally plain DOM so Svelte, React,
5
- * Vue, and static adapters can all mount the same chrome. This module is the
6
- * testable contract/inventory for that bundle; live-browser.js mirrors these
7
- * values at runtime because it is served as a standalone script.
8
- */
9
-
10
- export const LIVE_CHROME_MOUNT_CONTRACT = Object.freeze([
11
- 'root',
12
- 'transport',
13
- 'state',
14
- 'actions',
15
- ]);
16
-
17
- export const LIVE_UI_SURFACES = Object.freeze([
18
- {
19
- key: 'global-bottom-bar',
20
- ids: [
21
- 'monodesign-live-global-bar',
22
- 'monodesign-live-global-bar-brand',
23
- 'monodesign-live-pick-toggle',
24
- 'monodesign-live-insert-toggle',
25
- 'monodesign-live-detect-toggle',
26
- 'monodesign-live-detect-badge',
27
- 'monodesign-live-design-toggle',
28
- 'monodesign-live-page-chat',
29
- 'monodesign-live-page-chat-input',
30
- 'monodesign-live-page-chat-voice',
31
- ],
32
- states: ['rest', 'hover', 'focus-visible', 'pressed', 'active', 'tooltip'],
33
- },
34
- {
35
- key: 'pending-copy-edit-dock',
36
- ids: ['monodesign-live-pending-dock'],
37
- states: ['closed', 'open', 'hover', 'pressed', 'loading', 'rollback', 'keep-fixing'],
38
- },
39
- {
40
- key: 'element-selection-chrome',
41
- ids: [
42
- 'monodesign-live-highlight',
43
- 'monodesign-live-tooltip',
44
- 'monodesign-live-bar',
45
- 'monodesign-live-selection-pill',
46
- 'monodesign-live-input',
47
- 'monodesign-live-configure-voice',
48
- 'monodesign-live-configure-bar-tooltip',
49
- ],
50
- states: ['rest', 'hover', 'focus-visible', 'pressed', 'disabled'],
51
- },
52
- {
53
- key: 'action-picker',
54
- ids: ['monodesign-live-picker'],
55
- states: ['closed', 'open', 'option-hover', 'option-focus'],
56
- },
57
- {
58
- key: 'edit-chrome',
59
- ids: ['monodesign-live-edit-badge'],
60
- states: ['enabled', 'disabled', 'editing', 'cancel', 'save', 'edited-content'],
61
- },
62
- {
63
- key: 'generating-row',
64
- ids: ['monodesign-live-bar', 'monodesign-live-shader'],
65
- states: ['action-label', 'animated-dots', 'generating', 'done'],
66
- },
67
- {
68
- key: 'variant-cycling-row',
69
- ids: ['monodesign-live-bar', 'monodesign-live-params-panel'],
70
- states: ['variant-1', 'variant-2', 'variant-3', 'left-disabled', 'right-disabled', 'dot-click', 'accept', 'discard'],
71
- },
72
- {
73
- key: 'variant-params-panel',
74
- ids: ['monodesign-live-params-panel'],
75
- states: ['closed', 'open-above', 'open-below', 'range', 'steps', 'toggle'],
76
- },
77
- {
78
- key: 'saving-confirmed-rows',
79
- ids: ['monodesign-live-bar'],
80
- states: ['saving', 'applying-variant', 'confirmed'],
81
- },
82
- {
83
- key: 'insert-mode-chrome',
84
- ids: [
85
- 'monodesign-live-insert-line',
86
- 'monodesign-live-insert-placeholder',
87
- 'monodesign-live-placeholder-resize',
88
- 'monodesign-live-insert-input',
89
- 'monodesign-live-insert-voice',
90
- 'monodesign-live-insert-create',
91
- 'monodesign-live-insert-create-tooltip',
92
- ],
93
- states: ['toggle-active', 'line', 'placeholder', 'resize', 'enabled', 'disabled', 'tooltip'],
94
- },
95
- {
96
- key: 'annotation-chrome',
97
- ids: [
98
- 'monodesign-live-annot',
99
- 'monodesign-live-annot-svg',
100
- 'monodesign-live-annot-pins',
101
- 'monodesign-live-annot-clear',
102
- ],
103
- states: ['overlay', 'drawing', 'pin', 'pin-edit', 'clear'],
104
- },
105
- {
106
- key: 'design-system-panel',
107
- ids: ['monodesign-live-design-host'],
108
- states: ['closed', 'open', 'tabs', 'token-tiles', 'copy'],
109
- },
110
- {
111
- key: 'toasts-and-errors',
112
- ids: ['monodesign-live-toast'],
113
- states: ['normal', 'error', 'no-variants-mounted'],
114
- },
115
- {
116
- key: 'css-isolation-boundary',
117
- ids: ['monodesign-live-root'],
118
- states: ['shadow-root', 'style-tags', 'hostile-css'],
119
- },
120
- ]);
121
-
122
- export const LIVE_UI_COMPONENT_IDS = Object.freeze([
123
- ...new Set(LIVE_UI_SURFACES.flatMap((surface) => surface.ids)),
124
- ]);
125
-
126
- export function resolveLiveUiRoot(env = globalThis) {
127
- const doc = env?.document;
128
- const explicit = env?.__MONODESIGN_LIVE_UI_ROOT__
129
- || env?.window?.__MONODESIGN_LIVE_UI_ROOT__;
130
- if (explicit && typeof explicit.appendChild === 'function') return explicit;
131
- return doc?.body || null;
132
- }
133
-
134
- export function getLiveUiElementById(id, env = globalThis) {
135
- const doc = env?.document;
136
- const root = resolveLiveUiRoot(env);
137
- if (!id) return null;
138
- if (root?.getElementById) {
139
- const found = root.getElementById(id);
140
- if (found) return found;
141
- }
142
- if (root?.querySelector) {
143
- const found = root.querySelector(`#${escapeCssIdent(id)}`);
144
- if (found) return found;
145
- }
146
- return doc?.getElementById?.(id) || null;
147
- }
148
-
149
- export function appendToLiveUiRoot(el, env = globalThis) {
150
- const root = resolveLiveUiRoot(env);
151
- if (!root) throw new Error('Monodesign live UI root is not available');
152
- root.appendChild(el);
153
- return el;
154
- }
155
-
156
- export function appendStyleToLiveUiRoot(styleEl, env = globalThis) {
157
- const doc = env?.document;
158
- const root = resolveLiveUiRoot(env);
159
- if (root && root !== doc?.body) {
160
- root.appendChild(styleEl);
161
- } else {
162
- (doc?.head || doc?.body || root).appendChild(styleEl);
163
- }
164
- return styleEl;
165
- }
166
-
167
- export function activeElementDeep(doc = globalThis.document) {
168
- let active = doc?.activeElement || null;
169
- while (active?.shadowRoot?.activeElement) {
170
- active = active.shadowRoot.activeElement;
171
- }
172
- return active;
173
- }
174
-
175
- function escapeCssIdent(value) {
176
- if (typeof CSS !== 'undefined' && typeof CSS.escape === 'function') {
177
- return CSS.escape(String(value));
178
- }
179
- return String(value).replace(/([ !"#$%&'()*+,./:;<=>?@[\\\]^`{|}~])/g, '\\$1');
180
- }
@@ -1,36 +0,0 @@
1
- /**
2
- * Canonical design-command vocabulary for Live Mode: each command's value, human
3
- * label, and SVG icon. Icons stack above the chip label; strokes use currentColor
4
- * so the icon recolors when its chip is selected.
5
- *
6
- * Single source of truth, consumed by:
7
- * - skill/scripts/live/event-validation.mjs — re-exports VISUAL_ACTIONS.
8
- * - skill/scripts/live-browser.js — the real picker. It is served raw and
9
- * injected as an IIFE, so it cannot import this at runtime; live-server.mjs
10
- * serializes LIVE_COMMANDS into window.__MONODESIGN_VOCAB__ alongside the
11
- * token/port, and live-browser.js builds its ICONS + ACTIONS from that.
12
- * - site/components/LiveDemoPalette.astro — the marketing demo palette (imported
13
- * at build time).
14
- *
15
- * Add, rename, or reorder a verb here and all three follow.
16
- */
17
-
18
- const ICON_ATTRS = 'width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" style="display:block"';
19
-
20
- export const LIVE_COMMANDS = [
21
- { value: 'monodesign', label: 'Freeform', icon: `<svg ${ICON_ATTRS}><path d="M4 20l4-1L18 9l-3-3L5 16z"/><path d="M14 7l3 3"/></svg>` },
22
- { value: 'bolder', label: 'Bolder', icon: `<svg ${ICON_ATTRS}><rect x="6" y="12" width="4" height="7" rx="0.5"/><rect x="14" y="5" width="4" height="14" rx="0.5"/></svg>` },
23
- { value: 'quieter', label: 'Quieter', icon: `<svg ${ICON_ATTRS}><rect x="6" y="5" width="4" height="14" rx="0.5"/><rect x="14" y="12" width="4" height="7" rx="0.5"/></svg>` },
24
- { value: 'distill', label: 'Distill', icon: `<svg ${ICON_ATTRS}><path d="M4 5h16l-6 8v7l-4-2v-5z"/></svg>` },
25
- { value: 'polish', label: 'Polish', icon: `<svg ${ICON_ATTRS}><path d="M15 3l1 3 3 1-3 1-1 3-1-3-3-1 3-1z"/><path d="M7 13l0.6 1.8 1.8 0.6-1.8 0.6-0.6 1.8-0.6-1.8-1.8-0.6 1.8-0.6z"/></svg>` },
26
- { value: 'typeset', label: 'Typeset', icon: `<svg ${ICON_ATTRS}><path d="M5 6h14" stroke-width="2.6"/><path d="M5 12h9" stroke-width="1.9"/><path d="M5 18h5" stroke-width="1.3"/></svg>` },
27
- { value: 'colorize', label: 'Colorize', icon: `<svg ${ICON_ATTRS}><circle cx="9" cy="10" r="5"/><circle cx="15" cy="10" r="5"/><circle cx="12" cy="15" r="5"/></svg>` },
28
- { value: 'layout', label: 'Layout', icon: `<svg ${ICON_ATTRS}><rect x="3" y="4" width="8" height="16" rx="0.5"/><rect x="13" y="4" width="8" height="7" rx="0.5"/><rect x="13" y="13" width="8" height="7" rx="0.5"/></svg>` },
29
- { value: 'adapt', label: 'Adapt', icon: `<svg ${ICON_ATTRS}><rect x="2.5" y="5" width="12" height="11" rx="1"/><line x1="2.5" y1="19" x2="14.5" y2="19"/><rect x="16.5" y="8" width="5" height="11" rx="1"/></svg>` },
30
- { value: 'animate', label: 'Animate', icon: `<svg ${ICON_ATTRS}><path d="M3 18c4-4 6-10 10-10"/><path d="M13 8c3 0 5 5 8 10"/><circle cx="13" cy="8" r="1.6" fill="currentColor" stroke="none"/></svg>` },
31
- { value: 'delight', label: 'Delight', icon: `<svg ${ICON_ATTRS}><path d="M12 3l2 6 6 2-6 2-2 6-2-6-6-2 6-2z"/></svg>` },
32
- { value: 'overdrive', label: 'Overdrive', icon: `<svg ${ICON_ATTRS}><path d="M13 3L5 13h5l-1 8 9-12h-6z"/></svg>` },
33
- ];
34
-
35
- // Action values accepted by the live event protocol, in palette order.
36
- export const VISUAL_ACTIONS = LIVE_COMMANDS.map((c) => c.value);