@monoes/monomindcli 2.15.5 → 2.15.7

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 (226) hide show
  1. package/dist/src/commands/cleanup-plan.d.ts +57 -0
  2. package/dist/src/commands/cleanup-plan.d.ts.map +1 -0
  3. package/dist/src/commands/cleanup-plan.js +379 -0
  4. package/dist/src/commands/cleanup-plan.js.map +1 -0
  5. package/dist/src/commands/cleanup.d.ts.map +1 -1
  6. package/dist/src/commands/cleanup.js +87 -160
  7. package/dist/src/commands/cleanup.js.map +1 -1
  8. package/dist/src/commands/search-universal.d.ts +8 -0
  9. package/dist/src/commands/search-universal.d.ts.map +1 -1
  10. package/dist/src/commands/search-universal.js +14 -0
  11. package/dist/src/commands/search-universal.js.map +1 -1
  12. package/dist/src/index.d.ts.map +1 -1
  13. package/dist/src/index.js +11 -2
  14. package/dist/src/index.js.map +1 -1
  15. package/dist/src/orgrt/completion-gate.d.ts +40 -0
  16. package/dist/src/orgrt/completion-gate.d.ts.map +1 -1
  17. package/dist/src/orgrt/completion-gate.js +90 -9
  18. package/dist/src/orgrt/completion-gate.js.map +1 -1
  19. package/dist/src/orgrt/daemon.d.ts +4 -0
  20. package/dist/src/orgrt/daemon.d.ts.map +1 -1
  21. package/dist/src/orgrt/daemon.js +15 -2
  22. package/dist/src/orgrt/daemon.js.map +1 -1
  23. package/dist/src/orgrt/decisions.d.ts +24 -1
  24. package/dist/src/orgrt/decisions.d.ts.map +1 -1
  25. package/dist/src/orgrt/decisions.js +171 -11
  26. package/dist/src/orgrt/decisions.js.map +1 -1
  27. package/dist/src/orgrt/idle-deadline.d.ts +10 -0
  28. package/dist/src/orgrt/idle-deadline.d.ts.map +1 -1
  29. package/dist/src/orgrt/idle-deadline.js +8 -0
  30. package/dist/src/orgrt/idle-deadline.js.map +1 -1
  31. package/dist/src/orgrt/mailbox.d.ts +7 -0
  32. package/dist/src/orgrt/mailbox.d.ts.map +1 -1
  33. package/dist/src/orgrt/mailbox.js +14 -0
  34. package/dist/src/orgrt/mailbox.js.map +1 -1
  35. package/dist/src/orgrt/review-packet.d.ts +1 -1
  36. package/dist/src/orgrt/review-packet.d.ts.map +1 -1
  37. package/dist/src/orgrt/review-packet.js +2 -1
  38. package/dist/src/orgrt/review-packet.js.map +1 -1
  39. package/dist/src/orgrt/role-sandbox.d.ts +1 -0
  40. package/dist/src/orgrt/role-sandbox.d.ts.map +1 -1
  41. package/dist/src/orgrt/role-sandbox.js +6 -1
  42. package/dist/src/orgrt/role-sandbox.js.map +1 -1
  43. package/dist/src/orgrt/session.d.ts +3 -0
  44. package/dist/src/orgrt/session.d.ts.map +1 -1
  45. package/dist/src/orgrt/session.js +8 -1
  46. package/dist/src/orgrt/session.js.map +1 -1
  47. package/dist/src/orgrt/task-dag.d.ts +3 -0
  48. package/dist/src/orgrt/task-dag.d.ts.map +1 -1
  49. package/dist/src/orgrt/task-dag.js +7 -0
  50. package/dist/src/orgrt/task-dag.js.map +1 -1
  51. package/dist/src/orgrt/types.d.ts +3 -0
  52. package/dist/src/orgrt/types.d.ts.map +1 -1
  53. package/dist/src/orgrt/types.js +6 -2
  54. package/dist/src/orgrt/types.js.map +1 -1
  55. package/dist/src/update/checker.d.ts +3 -1
  56. package/dist/src/update/checker.d.ts.map +1 -1
  57. package/dist/src/update/checker.js +7 -3
  58. package/dist/src/update/checker.js.map +1 -1
  59. package/dist/src/update/index.d.ts +16 -0
  60. package/dist/src/update/index.d.ts.map +1 -1
  61. package/dist/src/update/index.js +37 -1
  62. package/dist/src/update/index.js.map +1 -1
  63. package/dist/src/update/refresh-worker.d.ts +9 -0
  64. package/dist/src/update/refresh-worker.d.ts.map +1 -0
  65. package/dist/src/update/refresh-worker.js +17 -0
  66. package/dist/src/update/refresh-worker.js.map +1 -0
  67. package/dist/src/utils/resource-governor.d.ts +44 -2
  68. package/dist/src/utils/resource-governor.d.ts.map +1 -1
  69. package/dist/src/utils/resource-governor.js +157 -40
  70. package/dist/src/utils/resource-governor.js.map +1 -1
  71. package/dist/tsconfig.tsbuildinfo +1 -1
  72. package/package.json +4 -4
  73. package/.claude/skills/monodesign/SKILL.md +0 -257
  74. package/.claude/skills/monodesign/adapt.md +0 -53
  75. package/.claude/skills/monodesign/agents/monodesign-asset-producer.md +0 -100
  76. package/.claude/skills/monodesign/agents/monodesign-manual-edit-applier.md +0 -103
  77. package/.claude/skills/monodesign/animate.md +0 -65
  78. package/.claude/skills/monodesign/audit.md +0 -89
  79. package/.claude/skills/monodesign/bolder.md +0 -50
  80. package/.claude/skills/monodesign/clarify.md +0 -64
  81. package/.claude/skills/monodesign/colorize.md +0 -68
  82. package/.claude/skills/monodesign/craft.md +0 -51
  83. package/.claude/skills/monodesign/critique.md +0 -66
  84. package/.claude/skills/monodesign/delight.md +0 -47
  85. package/.claude/skills/monodesign/distill.md +0 -56
  86. package/.claude/skills/monodesign/document.md +0 -83
  87. package/.claude/skills/monodesign/extract.md +0 -74
  88. package/.claude/skills/monodesign/harden.md +0 -65
  89. package/.claude/skills/monodesign/init.md +0 -30
  90. package/.claude/skills/monodesign/layout.md +0 -36
  91. package/.claude/skills/monodesign/live.md +0 -34
  92. package/.claude/skills/monodesign/onboard.md +0 -50
  93. package/.claude/skills/monodesign/optimize.md +0 -64
  94. package/.claude/skills/monodesign/overdrive.md +0 -56
  95. package/.claude/skills/monodesign/polish.md +0 -68
  96. package/.claude/skills/monodesign/quieter.md +0 -57
  97. package/.claude/skills/monodesign/reference/adapt.md +0 -312
  98. package/.claude/skills/monodesign/reference/adapt.native.md +0 -58
  99. package/.claude/skills/monodesign/reference/android.md +0 -40
  100. package/.claude/skills/monodesign/reference/animate.md +0 -203
  101. package/.claude/skills/monodesign/reference/antipatterns-catalog.md +0 -410
  102. package/.claude/skills/monodesign/reference/audit.md +0 -135
  103. package/.claude/skills/monodesign/reference/audit.native.md +0 -139
  104. package/.claude/skills/monodesign/reference/bolder.md +0 -120
  105. package/.claude/skills/monodesign/reference/brand-workflow.md +0 -180
  106. package/.claude/skills/monodesign/reference/brand.md +0 -108
  107. package/.claude/skills/monodesign/reference/clarify.md +0 -288
  108. package/.claude/skills/monodesign/reference/codex.md +0 -105
  109. package/.claude/skills/monodesign/reference/cognitive-load.md +0 -106
  110. package/.claude/skills/monodesign/reference/color-and-contrast.md +0 -105
  111. package/.claude/skills/monodesign/reference/colorize.md +0 -257
  112. package/.claude/skills/monodesign/reference/component-specs.md +0 -260
  113. package/.claude/skills/monodesign/reference/component-states.md +0 -274
  114. package/.claude/skills/monodesign/reference/component-system.md +0 -358
  115. package/.claude/skills/monodesign/reference/copy-formulas.md +0 -160
  116. package/.claude/skills/monodesign/reference/craft.md +0 -123
  117. package/.claude/skills/monodesign/reference/critique.md +0 -780
  118. package/.claude/skills/monodesign/reference/delight.md +0 -302
  119. package/.claude/skills/monodesign/reference/design-principles.md +0 -246
  120. package/.claude/skills/monodesign/reference/distill.md +0 -111
  121. package/.claude/skills/monodesign/reference/document.md +0 -429
  122. package/.claude/skills/monodesign/reference/extract.md +0 -69
  123. package/.claude/skills/monodesign/reference/harden.md +0 -347
  124. package/.claude/skills/monodesign/reference/heuristics-scoring.md +0 -234
  125. package/.claude/skills/monodesign/reference/hooks.md +0 -92
  126. package/.claude/skills/monodesign/reference/image-prompts.md +0 -130
  127. package/.claude/skills/monodesign/reference/init.md +0 -221
  128. package/.claude/skills/monodesign/reference/interaction-design.md +0 -189
  129. package/.claude/skills/monodesign/reference/ios.md +0 -45
  130. package/.claude/skills/monodesign/reference/layout.md +0 -185
  131. package/.claude/skills/monodesign/reference/live.md +0 -710
  132. package/.claude/skills/monodesign/reference/motion-design.md +0 -109
  133. package/.claude/skills/monodesign/reference/onboard.md +0 -234
  134. package/.claude/skills/monodesign/reference/optimize.md +0 -258
  135. package/.claude/skills/monodesign/reference/overdrive.md +0 -130
  136. package/.claude/skills/monodesign/reference/personas.md +0 -179
  137. package/.claude/skills/monodesign/reference/polish.md +0 -241
  138. package/.claude/skills/monodesign/reference/pre-delivery-checklist.md +0 -108
  139. package/.claude/skills/monodesign/reference/product.md +0 -60
  140. package/.claude/skills/monodesign/reference/quieter.md +0 -99
  141. package/.claude/skills/monodesign/reference/responsive-design.md +0 -114
  142. package/.claude/skills/monodesign/reference/shape.md +0 -165
  143. package/.claude/skills/monodesign/reference/spatial-design.md +0 -100
  144. package/.claude/skills/monodesign/reference/teach.md +0 -10
  145. package/.claude/skills/monodesign/reference/token-architecture.md +0 -222
  146. package/.claude/skills/monodesign/reference/typeset.md +0 -301
  147. package/.claude/skills/monodesign/reference/typography.md +0 -159
  148. package/.claude/skills/monodesign/reference/ux-research.md +0 -143
  149. package/.claude/skills/monodesign/reference/ux-rules.md +0 -211
  150. package/.claude/skills/monodesign/reference/ux-writing.md +0 -107
  151. package/.claude/skills/monodesign/scripts/command-metadata.json +0 -94
  152. package/.claude/skills/monodesign/scripts/context-signals.mjs +0 -260
  153. package/.claude/skills/monodesign/scripts/context.mjs +0 -1065
  154. package/.claude/skills/monodesign/scripts/critique-storage.mjs +0 -416
  155. package/.claude/skills/monodesign/scripts/detect-csp.mjs +0 -193
  156. package/.claude/skills/monodesign/scripts/detect.mjs +0 -33
  157. package/.claude/skills/monodesign/scripts/detector/browser/injected/index.mjs +0 -1960
  158. package/.claude/skills/monodesign/scripts/detector/cli/main.mjs +0 -321
  159. package/.claude/skills/monodesign/scripts/detector/design-system.mjs +0 -814
  160. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns-browser.js +0 -5628
  161. package/.claude/skills/monodesign/scripts/detector/detect-antipatterns.mjs +0 -50
  162. package/.claude/skills/monodesign/scripts/detector/engines/browser/detect-url.mjs +0 -259
  163. package/.claude/skills/monodesign/scripts/detector/engines/browser/drivers.mjs +0 -349
  164. package/.claude/skills/monodesign/scripts/detector/engines/regex/detect-text.mjs +0 -636
  165. package/.claude/skills/monodesign/scripts/detector/engines/static-html/css-cascade.mjs +0 -1016
  166. package/.claude/skills/monodesign/scripts/detector/engines/static-html/detect-html.mjs +0 -253
  167. package/.claude/skills/monodesign/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -198
  168. package/.claude/skills/monodesign/scripts/detector/findings.mjs +0 -12
  169. package/.claude/skills/monodesign/scripts/detector/fix/css-regions.mjs +0 -181
  170. package/.claude/skills/monodesign/scripts/detector/fix/fixers.mjs +0 -373
  171. package/.claude/skills/monodesign/scripts/detector/fix/index.mjs +0 -426
  172. package/.claude/skills/monodesign/scripts/detector/node/file-system.mjs +0 -198
  173. package/.claude/skills/monodesign/scripts/detector/profile/profiler.mjs +0 -166
  174. package/.claude/skills/monodesign/scripts/detector/registry/antipatterns.mjs +0 -563
  175. package/.claude/skills/monodesign/scripts/detector/rules/checks.mjs +0 -3024
  176. package/.claude/skills/monodesign/scripts/detector/shared/color.mjs +0 -124
  177. package/.claude/skills/monodesign/scripts/detector/shared/constants.mjs +0 -101
  178. package/.claude/skills/monodesign/scripts/detector/shared/fonts.mjs +0 -30
  179. package/.claude/skills/monodesign/scripts/detector/shared/inline-ignores.mjs +0 -148
  180. package/.claude/skills/monodesign/scripts/detector/shared/page.mjs +0 -7
  181. package/.claude/skills/monodesign/scripts/hook-admin.mjs +0 -694
  182. package/.claude/skills/monodesign/scripts/hook-before-edit.mjs +0 -516
  183. package/.claude/skills/monodesign/scripts/hook-lib.mjs +0 -1785
  184. package/.claude/skills/monodesign/scripts/hook.mjs +0 -61
  185. package/.claude/skills/monodesign/scripts/lib/design-parser.mjs +0 -809
  186. package/.claude/skills/monodesign/scripts/lib/is-generated.mjs +0 -69
  187. package/.claude/skills/monodesign/scripts/lib/monodesign-config.mjs +0 -640
  188. package/.claude/skills/monodesign/scripts/lib/monodesign-paths.mjs +0 -129
  189. package/.claude/skills/monodesign/scripts/lib/provider.mjs +0 -4
  190. package/.claude/skills/monodesign/scripts/lib/target-args.mjs +0 -42
  191. package/.claude/skills/monodesign/scripts/live/browser-script-parts.mjs +0 -50
  192. package/.claude/skills/monodesign/scripts/live/completion.mjs +0 -19
  193. package/.claude/skills/monodesign/scripts/live/event-validation.mjs +0 -137
  194. package/.claude/skills/monodesign/scripts/live/insert-ui.mjs +0 -458
  195. package/.claude/skills/monodesign/scripts/live/manual-apply.mjs +0 -939
  196. package/.claude/skills/monodesign/scripts/live/manual-edit-routes.mjs +0 -357
  197. package/.claude/skills/monodesign/scripts/live/manual-edits-buffer.mjs +0 -152
  198. package/.claude/skills/monodesign/scripts/live/session-store.mjs +0 -293
  199. package/.claude/skills/monodesign/scripts/live/svelte-component.mjs +0 -826
  200. package/.claude/skills/monodesign/scripts/live/sveltekit-adapter.mjs +0 -279
  201. package/.claude/skills/monodesign/scripts/live/ui-core.mjs +0 -180
  202. package/.claude/skills/monodesign/scripts/live/vocabulary.mjs +0 -36
  203. package/.claude/skills/monodesign/scripts/live-accept.mjs +0 -812
  204. package/.claude/skills/monodesign/scripts/live-browser-dom.js +0 -147
  205. package/.claude/skills/monodesign/scripts/live-browser-session.js +0 -124
  206. package/.claude/skills/monodesign/scripts/live-browser.js +0 -11213
  207. package/.claude/skills/monodesign/scripts/live-commit-manual-edits.mjs +0 -1241
  208. package/.claude/skills/monodesign/scripts/live-complete.mjs +0 -75
  209. package/.claude/skills/monodesign/scripts/live-copy-edit-agent.mjs +0 -683
  210. package/.claude/skills/monodesign/scripts/live-discard-manual-edits.mjs +0 -51
  211. package/.claude/skills/monodesign/scripts/live-inject.mjs +0 -596
  212. package/.claude/skills/monodesign/scripts/live-insert.mjs +0 -272
  213. package/.claude/skills/monodesign/scripts/live-manual-edit-evidence.mjs +0 -363
  214. package/.claude/skills/monodesign/scripts/live-poll.mjs +0 -384
  215. package/.claude/skills/monodesign/scripts/live-resume.mjs +0 -94
  216. package/.claude/skills/monodesign/scripts/live-server.mjs +0 -1210
  217. package/.claude/skills/monodesign/scripts/live-status.mjs +0 -61
  218. package/.claude/skills/monodesign/scripts/live-target.mjs +0 -30
  219. package/.claude/skills/monodesign/scripts/live-wrap.mjs +0 -884
  220. package/.claude/skills/monodesign/scripts/live.mjs +0 -297
  221. package/.claude/skills/monodesign/scripts/modern-screenshot.umd.js +0 -14
  222. package/.claude/skills/monodesign/scripts/palette.mjs +0 -635
  223. package/.claude/skills/monodesign/scripts/pin.mjs +0 -221
  224. package/.claude/skills/monodesign/shape.md +0 -71
  225. package/.claude/skills/monodesign/teach.md +0 -18
  226. 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);