@wootsup/yt-builder-mcp 0.2.0-alpha.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 (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -0
  3. package/bin/yt-builder-mcp.js +59 -0
  4. package/dist/auth.d.ts +39 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +93 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/client.d.ts +84 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +151 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/clients/claude-code.d.ts +18 -0
  13. package/dist/clients/claude-code.d.ts.map +1 -0
  14. package/dist/clients/claude-code.js +53 -0
  15. package/dist/clients/claude-code.js.map +1 -0
  16. package/dist/clients/claude-desktop.d.ts +19 -0
  17. package/dist/clients/claude-desktop.d.ts.map +1 -0
  18. package/dist/clients/claude-desktop.js +56 -0
  19. package/dist/clients/claude-desktop.js.map +1 -0
  20. package/dist/clients/cline.d.ts +26 -0
  21. package/dist/clients/cline.d.ts.map +1 -0
  22. package/dist/clients/cline.js +80 -0
  23. package/dist/clients/cline.js.map +1 -0
  24. package/dist/clients/codex-cli.d.ts +42 -0
  25. package/dist/clients/codex-cli.d.ts.map +1 -0
  26. package/dist/clients/codex-cli.js +194 -0
  27. package/dist/clients/codex-cli.js.map +1 -0
  28. package/dist/clients/continue.d.ts +13 -0
  29. package/dist/clients/continue.d.ts.map +1 -0
  30. package/dist/clients/continue.js +52 -0
  31. package/dist/clients/continue.js.map +1 -0
  32. package/dist/clients/cursor.d.ts +12 -0
  33. package/dist/clients/cursor.d.ts.map +1 -0
  34. package/dist/clients/cursor.js +38 -0
  35. package/dist/clients/cursor.js.map +1 -0
  36. package/dist/clients/gemini-cli.d.ts +18 -0
  37. package/dist/clients/gemini-cli.d.ts.map +1 -0
  38. package/dist/clients/gemini-cli.js +44 -0
  39. package/dist/clients/gemini-cli.js.map +1 -0
  40. package/dist/clients/home.d.ts +14 -0
  41. package/dist/clients/home.d.ts.map +1 -0
  42. package/dist/clients/home.js +20 -0
  43. package/dist/clients/home.js.map +1 -0
  44. package/dist/clients/index.d.ts +52 -0
  45. package/dist/clients/index.d.ts.map +1 -0
  46. package/dist/clients/index.js +72 -0
  47. package/dist/clients/index.js.map +1 -0
  48. package/dist/clients/roo-code.d.ts +23 -0
  49. package/dist/clients/roo-code.d.ts.map +1 -0
  50. package/dist/clients/roo-code.js +69 -0
  51. package/dist/clients/roo-code.js.map +1 -0
  52. package/dist/clients/zed.d.ts +12 -0
  53. package/dist/clients/zed.d.ts.map +1 -0
  54. package/dist/clients/zed.js +41 -0
  55. package/dist/clients/zed.js.map +1 -0
  56. package/dist/errors/hints.d.ts +51 -0
  57. package/dist/errors/hints.d.ts.map +1 -0
  58. package/dist/errors/hints.js +95 -0
  59. package/dist/errors/hints.js.map +1 -0
  60. package/dist/errors/mask.d.ts +35 -0
  61. package/dist/errors/mask.d.ts.map +1 -0
  62. package/dist/errors/mask.js +49 -0
  63. package/dist/errors/mask.js.map +1 -0
  64. package/dist/errors/sanitize.d.ts +31 -0
  65. package/dist/errors/sanitize.d.ts.map +1 -0
  66. package/dist/errors/sanitize.js +90 -0
  67. package/dist/errors/sanitize.js.map +1 -0
  68. package/dist/errors.d.ts +42 -0
  69. package/dist/errors.d.ts.map +1 -0
  70. package/dist/errors.js +61 -0
  71. package/dist/errors.js.map +1 -0
  72. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  73. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  74. package/dist/gateway/advanced-tool/discovery.js +53 -0
  75. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  76. package/dist/gateway/advanced-tool/domains.d.ts +42 -0
  77. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  78. package/dist/gateway/advanced-tool/domains.js +88 -0
  79. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  80. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  81. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  82. package/dist/gateway/advanced-tool/execute.js +54 -0
  83. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  84. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  85. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  86. package/dist/gateway/advanced-tool/index.js +39 -0
  87. package/dist/gateway/advanced-tool/index.js.map +1 -0
  88. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  89. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  90. package/dist/gateway/advanced-tool/register.js +62 -0
  91. package/dist/gateway/advanced-tool/register.js.map +1 -0
  92. package/dist/gateway/advanced-tool.d.ts +13 -0
  93. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  94. package/dist/gateway/advanced-tool.js +13 -0
  95. package/dist/gateway/advanced-tool.js.map +1 -0
  96. package/dist/gateway/capturing-server.d.ts +117 -0
  97. package/dist/gateway/capturing-server.d.ts.map +1 -0
  98. package/dist/gateway/capturing-server.js +103 -0
  99. package/dist/gateway/capturing-server.js.map +1 -0
  100. package/dist/gateway/essentials.d.ts +49 -0
  101. package/dist/gateway/essentials.d.ts.map +1 -0
  102. package/dist/gateway/essentials.js +62 -0
  103. package/dist/gateway/essentials.js.map +1 -0
  104. package/dist/gateway/test-support.d.ts +41 -0
  105. package/dist/gateway/test-support.d.ts.map +1 -0
  106. package/dist/gateway/test-support.js +60 -0
  107. package/dist/gateway/test-support.js.map +1 -0
  108. package/dist/index.d.ts +25 -0
  109. package/dist/index.d.ts.map +1 -0
  110. package/dist/index.js +77 -0
  111. package/dist/index.js.map +1 -0
  112. package/dist/install-skill.d.ts +35 -0
  113. package/dist/install-skill.d.ts.map +1 -0
  114. package/dist/install-skill.js +107 -0
  115. package/dist/install-skill.js.map +1 -0
  116. package/dist/platform/index.d.ts +49 -0
  117. package/dist/platform/index.d.ts.map +1 -0
  118. package/dist/platform/index.js +38 -0
  119. package/dist/platform/index.js.map +1 -0
  120. package/dist/server.d.ts +50 -0
  121. package/dist/server.d.ts.map +1 -0
  122. package/dist/server.js +117 -0
  123. package/dist/server.js.map +1 -0
  124. package/dist/setup-cli.d.ts +100 -0
  125. package/dist/setup-cli.d.ts.map +1 -0
  126. package/dist/setup-cli.js +355 -0
  127. package/dist/setup-cli.js.map +1 -0
  128. package/dist/setup-prompts.d.ts +41 -0
  129. package/dist/setup-prompts.d.ts.map +1 -0
  130. package/dist/setup-prompts.js +142 -0
  131. package/dist/setup-prompts.js.map +1 -0
  132. package/dist/setup-token.d.ts +38 -0
  133. package/dist/setup-token.d.ts.map +1 -0
  134. package/dist/setup-token.js +106 -0
  135. package/dist/setup-token.js.map +1 -0
  136. package/dist/setup-wizard-defaults.d.ts +43 -0
  137. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  138. package/dist/setup-wizard-defaults.js +160 -0
  139. package/dist/setup-wizard-defaults.js.map +1 -0
  140. package/dist/setup-wizard-handshake.d.ts +25 -0
  141. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  142. package/dist/setup-wizard-handshake.js +103 -0
  143. package/dist/setup-wizard-handshake.js.map +1 -0
  144. package/dist/setup-wizard-types.d.ts +148 -0
  145. package/dist/setup-wizard-types.d.ts.map +1 -0
  146. package/dist/setup-wizard-types.js +11 -0
  147. package/dist/setup-wizard-types.js.map +1 -0
  148. package/dist/setup-wizard.d.ts +33 -0
  149. package/dist/setup-wizard.d.ts.map +1 -0
  150. package/dist/setup-wizard.js +166 -0
  151. package/dist/setup-wizard.js.map +1 -0
  152. package/dist/setup.d.ts +17 -0
  153. package/dist/setup.d.ts.map +1 -0
  154. package/dist/setup.js +33 -0
  155. package/dist/setup.js.map +1 -0
  156. package/dist/tools/elements/builders.d.ts +24 -0
  157. package/dist/tools/elements/builders.d.ts.map +1 -0
  158. package/dist/tools/elements/builders.js +150 -0
  159. package/dist/tools/elements/builders.js.map +1 -0
  160. package/dist/tools/elements/handlers-write.d.ts +48 -0
  161. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  162. package/dist/tools/elements/handlers-write.js +141 -0
  163. package/dist/tools/elements/handlers-write.js.map +1 -0
  164. package/dist/tools/elements/handlers.d.ts +56 -0
  165. package/dist/tools/elements/handlers.d.ts.map +1 -0
  166. package/dist/tools/elements/handlers.js +113 -0
  167. package/dist/tools/elements/handlers.js.map +1 -0
  168. package/dist/tools/elements/index.d.ts +28 -0
  169. package/dist/tools/elements/index.d.ts.map +1 -0
  170. package/dist/tools/elements/index.js +27 -0
  171. package/dist/tools/elements/index.js.map +1 -0
  172. package/dist/tools/elements.d.ts +13 -0
  173. package/dist/tools/elements.d.ts.map +1 -0
  174. package/dist/tools/elements.js +13 -0
  175. package/dist/tools/elements.js.map +1 -0
  176. package/dist/tools/elicitation.d.ts +87 -0
  177. package/dist/tools/elicitation.d.ts.map +1 -0
  178. package/dist/tools/elicitation.js +100 -0
  179. package/dist/tools/elicitation.js.map +1 -0
  180. package/dist/tools/format/elements-format.d.ts +34 -0
  181. package/dist/tools/format/elements-format.d.ts.map +1 -0
  182. package/dist/tools/format/elements-format.js +112 -0
  183. package/dist/tools/format/elements-format.js.map +1 -0
  184. package/dist/tools/format/health-format.d.ts +73 -0
  185. package/dist/tools/format/health-format.d.ts.map +1 -0
  186. package/dist/tools/format/health-format.js +178 -0
  187. package/dist/tools/format/health-format.js.map +1 -0
  188. package/dist/tools/format/inspection-format.d.ts +45 -0
  189. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  190. package/dist/tools/format/inspection-format.js +125 -0
  191. package/dist/tools/format/inspection-format.js.map +1 -0
  192. package/dist/tools/format/pages-format.d.ts +39 -0
  193. package/dist/tools/format/pages-format.d.ts.map +1 -0
  194. package/dist/tools/format/pages-format.js +110 -0
  195. package/dist/tools/format/pages-format.js.map +1 -0
  196. package/dist/tools/format/sources-format.d.ts +25 -0
  197. package/dist/tools/format/sources-format.d.ts.map +1 -0
  198. package/dist/tools/format/sources-format.js +113 -0
  199. package/dist/tools/format/sources-format.js.map +1 -0
  200. package/dist/tools/health.d.ts +22 -0
  201. package/dist/tools/health.d.ts.map +1 -0
  202. package/dist/tools/health.js +147 -0
  203. package/dist/tools/health.js.map +1 -0
  204. package/dist/tools/index.d.ts +23 -0
  205. package/dist/tools/index.d.ts.map +1 -0
  206. package/dist/tools/index.js +23 -0
  207. package/dist/tools/index.js.map +1 -0
  208. package/dist/tools/inspection.d.ts +14 -0
  209. package/dist/tools/inspection.d.ts.map +1 -0
  210. package/dist/tools/inspection.js +115 -0
  211. package/dist/tools/inspection.js.map +1 -0
  212. package/dist/tools/layout-flatten.d.ts +63 -0
  213. package/dist/tools/layout-flatten.d.ts.map +1 -0
  214. package/dist/tools/layout-flatten.js +95 -0
  215. package/dist/tools/layout-flatten.js.map +1 -0
  216. package/dist/tools/pages/builders.d.ts +14 -0
  217. package/dist/tools/pages/builders.d.ts.map +1 -0
  218. package/dist/tools/pages/builders.js +97 -0
  219. package/dist/tools/pages/builders.js.map +1 -0
  220. package/dist/tools/pages/handlers-read.d.ts +24 -0
  221. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  222. package/dist/tools/pages/handlers-read.js +141 -0
  223. package/dist/tools/pages/handlers-read.js.map +1 -0
  224. package/dist/tools/pages/handlers-write.d.ts +21 -0
  225. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  226. package/dist/tools/pages/handlers-write.js +52 -0
  227. package/dist/tools/pages/handlers-write.js.map +1 -0
  228. package/dist/tools/pages/index.d.ts +17 -0
  229. package/dist/tools/pages/index.d.ts.map +1 -0
  230. package/dist/tools/pages/index.js +17 -0
  231. package/dist/tools/pages/index.js.map +1 -0
  232. package/dist/tools/pages/schemas.d.ts +30 -0
  233. package/dist/tools/pages/schemas.d.ts.map +1 -0
  234. package/dist/tools/pages/schemas.js +30 -0
  235. package/dist/tools/pages/schemas.js.map +1 -0
  236. package/dist/tools/pages.d.ts +13 -0
  237. package/dist/tools/pages.d.ts.map +1 -0
  238. package/dist/tools/pages.js +13 -0
  239. package/dist/tools/pages.js.map +1 -0
  240. package/dist/tools/progress-phases.d.ts +46 -0
  241. package/dist/tools/progress-phases.d.ts.map +1 -0
  242. package/dist/tools/progress-phases.js +48 -0
  243. package/dist/tools/progress-phases.js.map +1 -0
  244. package/dist/tools/shared-schemas.d.ts +15 -0
  245. package/dist/tools/shared-schemas.d.ts.map +1 -0
  246. package/dist/tools/shared-schemas.js +30 -0
  247. package/dist/tools/shared-schemas.js.map +1 -0
  248. package/dist/tools/sources/builders.d.ts +13 -0
  249. package/dist/tools/sources/builders.d.ts.map +1 -0
  250. package/dist/tools/sources/builders.js +88 -0
  251. package/dist/tools/sources/builders.js.map +1 -0
  252. package/dist/tools/sources/handlers-bind.d.ts +26 -0
  253. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  254. package/dist/tools/sources/handlers-bind.js +123 -0
  255. package/dist/tools/sources/handlers-bind.js.map +1 -0
  256. package/dist/tools/sources/handlers.d.ts +45 -0
  257. package/dist/tools/sources/handlers.d.ts.map +1 -0
  258. package/dist/tools/sources/handlers.js +84 -0
  259. package/dist/tools/sources/handlers.js.map +1 -0
  260. package/dist/tools/sources/index.d.ts +19 -0
  261. package/dist/tools/sources/index.d.ts.map +1 -0
  262. package/dist/tools/sources/index.js +18 -0
  263. package/dist/tools/sources/index.js.map +1 -0
  264. package/dist/tools/sources.d.ts +14 -0
  265. package/dist/tools/sources.d.ts.map +1 -0
  266. package/dist/tools/sources.js +14 -0
  267. package/dist/tools/sources.js.map +1 -0
  268. package/dist/tools/sparse-fields.d.ts +80 -0
  269. package/dist/tools/sparse-fields.d.ts.map +1 -0
  270. package/dist/tools/sparse-fields.js +144 -0
  271. package/dist/tools/sparse-fields.js.map +1 -0
  272. package/dist/tools/tool-builder/annotations.d.ts +22 -0
  273. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  274. package/dist/tools/tool-builder/annotations.js +35 -0
  275. package/dist/tools/tool-builder/annotations.js.map +1 -0
  276. package/dist/tools/tool-builder/define.d.ts +31 -0
  277. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  278. package/dist/tools/tool-builder/define.js +31 -0
  279. package/dist/tools/tool-builder/define.js.map +1 -0
  280. package/dist/tools/tool-builder/index.d.ts +28 -0
  281. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  282. package/dist/tools/tool-builder/index.js +27 -0
  283. package/dist/tools/tool-builder/index.js.map +1 -0
  284. package/dist/tools/tool-builder/results.d.ts +59 -0
  285. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  286. package/dist/tools/tool-builder/results.js +125 -0
  287. package/dist/tools/tool-builder/results.js.map +1 -0
  288. package/dist/tools/tool-builder/types.d.ts +82 -0
  289. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  290. package/dist/tools/tool-builder/types.js +9 -0
  291. package/dist/tools/tool-builder/types.js.map +1 -0
  292. package/dist/tools/tool-builder.d.ts +16 -0
  293. package/dist/tools/tool-builder.d.ts.map +1 -0
  294. package/dist/tools/tool-builder.js +16 -0
  295. package/dist/tools/tool-builder.js.map +1 -0
  296. package/icon.png +0 -0
  297. package/manifest.json +63 -0
  298. package/package.json +81 -0
  299. package/skills/yootheme-builder/SKILL.md +582 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 WootsUp / getimo productions
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,221 @@
1
+ # @wootsup/yt-builder-mcp — YT Builder MCP for YOOtheme Pro (unofficial)
2
+
3
+ > Drive your page builder via MCP. Built for YOOtheme Pro 4.0+ — connect **Claude Desktop**, **Cursor**, **Continue**, **Zed**, **Cline**, or **Roo Code** in one command.
4
+
5
+ > Independent third-party project. YOOtheme® is a registered trademark of YOOtheme GmbH
6
+ > ([yootheme.com](https://yootheme.com)). YT Builder MCP is built by WootsUp (getimo
7
+ > productions) and is not affiliated with, endorsed by, or sponsored by YOOtheme.
8
+ > The integration uses YOOtheme Pro's public extension points.
9
+
10
+ **License:** MIT
11
+ **Status:** Pre-alpha — under active development.
12
+
13
+ ---
14
+
15
+ ## Quick start
16
+
17
+ ```bash
18
+ # 1. Install the WordPress plugin (yt-builder-mcp).
19
+ # See https://wootsup.com/products/yt-builder-mcp
20
+
21
+ # 2. Generate a Bearer key in
22
+ # wp-admin → Tools → "YT Builder MCP" → Bearer Keys → Generate New Key.
23
+ # Key format: ytb_(live|test)_<payloadB64Url>.<sigB64Url>
24
+ # The key is shown ONCE — copy it now; it cannot be recovered later.
25
+
26
+ # 3. Run the wizard to configure your AI client(s):
27
+ npx -y @wootsup/yt-builder-mcp setup
28
+
29
+ # 4. (Optional) Install the bundled agent skill:
30
+ npx -y @wootsup/yt-builder-mcp install-skill
31
+
32
+ # 5. Restart your AI client.
33
+ ```
34
+
35
+ The wizard prompts for:
36
+
37
+ 1. Your WordPress site URL.
38
+ 2. The Bearer key you just generated.
39
+ 3. Which AI client(s) to configure (multi-select).
40
+
41
+ It probes `/wp-json/yt-builder-mcp/v1/health` to confirm the
42
+ plugin is reachable, `/etag` to validate the Bearer key, then writes
43
+ the MCP server entry into each selected client's config file. After
44
+ restart you should see the new tools prefixed with `yootheme_builder_*`.
45
+
46
+ ## Supported AI clients (6)
47
+
48
+ The wizard auto-detects and configures the following clients:
49
+
50
+ | Client | Config path | Notes |
51
+ |--------|-------------|-------|
52
+ | Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) | DXT bundle also supported (see below) |
53
+ | Cursor | `~/.cursor/mcp.json` | |
54
+ | Continue | `~/.continue/config.json` | |
55
+ | Zed | `~/.config/zed/settings.json` | |
56
+ | Cline | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | VS Code extension |
57
+ | Roo Code | same VS Code globalStorage path under `rooveterinaryinc.roo-cline` | VS Code extension |
58
+
59
+ ## Tool surface — gateway model
60
+
61
+ The server registers **22 tools total**, but only **10 entries appear
62
+ in `tools/list`** (well under Cursor's ~40-tool cap):
63
+
64
+ - **2 direct top-level tools** (always in `tools/list`):
65
+ `yootheme_builder_health`, `yootheme_builder_diagnose` — the
66
+ "the gateway itself might be broken" escape hatch.
67
+ - **7 essential forwarded tools** (always in `tools/list`): the most-
68
+ used reads and writes — `pages_list`, `get_etag`, `element_list`,
69
+ `element_add`, `element_update_settings`, `sources_list`,
70
+ `element_types_list`.
71
+ - **1 gateway tool** (`yootheme_builder_advanced`): exposes the
72
+ remaining **12 advanced tools** behind a single entry. Call
73
+ `yootheme_builder_advanced({ tool: "<name>" })` for discovery
74
+ (returns the schema) or `({ tool, arguments })` to execute.
75
+ - **12 advanced tools** dispatched via the gateway (page_get_layout,
76
+ page_get_schema, page_save, page_publish, element_get,
77
+ element_move, element_clone, element_delete,
78
+ element_get_binding, element_bind_source, element_unbind_source,
79
+ element_type_get_schema).
80
+
81
+ Total: **21 domain tools + 1 gateway = 22**. Surface: **10 entries
82
+ in tools/list**. See `skills/yootheme-builder/SKILL.md` for the
83
+ full catalog and the 5 canonical workflows.
84
+
85
+ ## Tool catalogue — 21 domain tools
86
+
87
+ | Domain | Count | Tools |
88
+ |------------|------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
89
+ | Health | 2 | `health`, `diagnose` |
90
+ | Pages | 6 | `pages_list`, `page_get_layout`, `page_get_schema`, `get_etag`, `page_save`, `page_publish` |
91
+ | Elements | 7 | `element_list`, `element_get`, `element_add`, `element_update_settings`, `element_move`, `element_clone`, `element_delete` |
92
+ | Sources | 4 | `sources_list`, `element_get_binding`, `element_bind_source`, `element_unbind_source` |
93
+ | Inspection | 2 | `element_types_list`, `element_type_get_schema` |
94
+
95
+ All tool names are prefixed with `yootheme_builder_` at the MCP
96
+ server boundary.
97
+
98
+ ## Subcommands
99
+
100
+ ```
101
+ yt-builder-mcp setup Interactive first-run wizard (default).
102
+ yt-builder-mcp install-skill Install the bundled agent skill.
103
+ yt-builder-mcp --version, -v Print package version.
104
+ yt-builder-mcp --help, -h Show usage.
105
+ ```
106
+
107
+ ### `install-skill` — bundled agent skill
108
+
109
+ Copies the bundled `skills/yootheme-builder/` folder into
110
+ `~/.claude/skills/` and appends a marker block to `~/AGENTS.md` so
111
+ other AI clients pick it up automatically.
112
+
113
+ `~/.claude/skills/` is the **universal marker path** recognised by
114
+ Claude Desktop and (per the same convention as `@wootsup/mcp`) other
115
+ AI clients that follow the `~/AGENTS.md` discovery protocol. The
116
+ single location keeps the skill discoverable across every supported
117
+ client without per-client write logic.
118
+
119
+ The skill ships with the 5 canonical workflows (build hero, bind
120
+ source, clone section, diagnose 401, add custom element) plus a
121
+ 21-tool auto-generated catalog appendix.
122
+
123
+ ## DXT bundle — Claude Desktop one-click install
124
+
125
+ The repo includes a `manifest.json` and `scripts/build-dxt.js` that
126
+ produces a `yt-builder-mcp.dxt` archive — the
127
+ [Desktop Extension](https://github.com/anthropics/dxt) format used
128
+ by Claude Desktop for one-click MCP installs. Build it from a
129
+ source checkout:
130
+
131
+ ```bash
132
+ npm run build:dxt
133
+ # → ./yt-builder-mcp.dxt
134
+ ```
135
+
136
+ Drop the `.dxt` file onto Claude Desktop's Extensions screen to
137
+ install. The bundle includes the compiled `dist/`, the bundled
138
+ skill, and `manifest.json`.
139
+
140
+ ## Environment variables
141
+
142
+ When launched by an AI client (or directly):
143
+
144
+ | Variable | Required? | Purpose |
145
+ |----------|-----------|---------|
146
+ | `YTB_MCP_WP_URL` | Yes | WordPress base URL (e.g. `https://example.com`). Trailing slash is stripped. |
147
+ | `YTB_MCP_BEARER_TOKEN` | Yes | Bearer key from wp-admin. Format-checked client-side: must match `ytb_(live\|test)_<payload>.<sig>`. Do **not** prepend `Bearer ` — the MCP server adds it. |
148
+ | `YTB_MCP_TIMEOUT_MS` | No | REST timeout (default 15000). |
149
+ | `YTB_MCP_TEST_MODE` | No | `1` skips the stdio loop (smoke tests). |
150
+
151
+ ## Manual MCP config (no wizard)
152
+
153
+ For users who don't want to run the wizard, paste this into your AI
154
+ client's MCP config file:
155
+
156
+ ```json
157
+ {
158
+ "mcpServers": {
159
+ "yootheme-builder": {
160
+ "command": "npx",
161
+ "args": ["-y", "@wootsup/yt-builder-mcp"],
162
+ "env": {
163
+ "YTB_MCP_WP_URL": "https://example.com",
164
+ "YTB_MCP_BEARER_TOKEN": "ytb_live_…"
165
+ }
166
+ }
167
+ }
168
+ }
169
+ ```
170
+
171
+ ## Non-interactive CI usage
172
+
173
+ For scripted / CI installs, pass the answers as flags and add
174
+ `--non-interactive` to skip every prompt. Missing required flags
175
+ exit with code `2` and a clear error to stderr:
176
+
177
+ ```bash
178
+ npx -y @wootsup/yt-builder-mcp setup \
179
+ --non-interactive \
180
+ --client cursor --client claude-desktop \
181
+ --url https://dev.wootsup.com/wordpress \
182
+ --token "$YTB_TOKEN"
183
+ ```
184
+
185
+ Supported flags:
186
+
187
+ | Flag | Required? | Description |
188
+ |------|-----------|-------------|
189
+ | `--non-interactive` | Yes | Opt-in to non-interactive mode (no prompts). |
190
+ | `--url <wp-url>` | Yes | WordPress base URL; trailing slash is stripped. |
191
+ | `--token <bearer>` | Yes | Bearer key from wp-admin (do not prepend `Bearer `). |
192
+ | `--client <id>` | Yes (≥1) | Client id; repeatable. Valid ids: `claude-desktop`, `cursor`, `zed`, `continue`, `cline`, `roo-code`. |
193
+
194
+ The wizard still runs its plugin-health + auth probes and uses the
195
+ exit codes documented in the table below — so CI can branch on the
196
+ exit code to detect whether the install actually succeeded.
197
+
198
+ ## Exit codes (CLI)
199
+
200
+ The CLI returns POSIX-style exit codes for scripting / CI:
201
+
202
+ | Code | Meaning |
203
+ |------|---------|
204
+ | 0 | Success |
205
+ | 1 | Invalid input / unknown subcommand |
206
+ | 2 | Health probe failed and user declined to continue (or install-skill failure) |
207
+ | 3 | Auth probe failed and user declined to continue |
208
+ | 4 | Write failed; configs rolled back |
209
+ | 5 | Handshake failed; configs rolled back |
210
+ | 99 | Unhandled fatal in dispatcher |
211
+ | 130 | User cancelled (SIGINT) |
212
+
213
+ ## Documentation
214
+
215
+ - [SKILL.md (bundled agent skill)](./skills/yootheme-builder/SKILL.md) — 5 canonical workflows, gateway model, tool catalog
216
+ - [REST API Reference](https://github.com/wootsup/yt-builder-mcp/blob/main/docs/rest-api-reference.md)
217
+ - [MCP Tool Reference](https://github.com/wootsup/yt-builder-mcp/blob/main/docs/mcp-tool-reference.md)
218
+
219
+ ## Repository
220
+
221
+ https://github.com/wootsup/yt-builder-mcp
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Entry point for `npx -y @wootsup/yt-builder-mcp`.
4
+ *
5
+ * Dispatch tree:
6
+ * - `setup` / `install-skill` / `install` / `--version` / `-v` /
7
+ * `--help` / `-h` / `help` → forward to `runCli()` in
8
+ * `dist/setup-cli.js` (Wave G.7).
9
+ * - no subcommand + interactive TTY → print a discoverability hint
10
+ * (don't accidentally start MCP server).
11
+ * - no subcommand + piped stdin/stdout → start the MCP stdio server
12
+ * (this is what AI clients invoke).
13
+ *
14
+ * The `runCli` / MCP-server split keeps the interactive ergonomics nice
15
+ * while letting AI clients launch the server with zero arguments.
16
+ *
17
+ * @license MIT
18
+ */
19
+ import { argv, stdout, stderr, exit } from 'node:process';
20
+
21
+ const args = argv.slice(2);
22
+ const subcommand = args[0];
23
+
24
+ const CLI_SUBCOMMANDS = new Set([
25
+ 'setup',
26
+ 'install-skill',
27
+ 'install',
28
+ 'help',
29
+ '--help',
30
+ '-h',
31
+ '--version',
32
+ '-v',
33
+ ]);
34
+
35
+ if (subcommand !== undefined && CLI_SUBCOMMANDS.has(subcommand)) {
36
+ try {
37
+ const { runCli } = await import('../dist/setup-cli.js');
38
+ const code = await runCli(args);
39
+ exit(code);
40
+ } catch (err) {
41
+ const msg = err instanceof Error ? err.message : String(err);
42
+ stderr.write(`yt-builder-mcp: fatal: ${msg}\n`);
43
+ exit(99);
44
+ }
45
+ } else if (
46
+ subcommand === undefined &&
47
+ stdout.isTTY === true &&
48
+ process.env.YTB_MCP_TEST_MODE !== '1'
49
+ ) {
50
+ stdout.write(
51
+ 'Run `npx -y @wootsup/yt-builder-mcp setup` to configure your AI client.\n',
52
+ );
53
+ stdout.write(
54
+ 'Run `npx -y @wootsup/yt-builder-mcp help` for usage.\n',
55
+ );
56
+ } else {
57
+ // Stdin/stdout piped (or YTB_MCP_TEST_MODE=1): MCP stdio mode.
58
+ await import('../dist/index.js');
59
+ }
package/dist/auth.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Auth / configuration loading for the MCP server.
3
+ *
4
+ * The MCP server reads two environment variables on startup:
5
+ *
6
+ * YTB_MCP_WP_URL — base URL of the WordPress install, e.g.
7
+ * `https://example.com`. The REST namespace
8
+ * `/wp-json/yt-builder-mcp/v1` is
9
+ * appended internally.
10
+ * YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
11
+ * Settings page (`wp-admin → YT Builder MCP`).
12
+ *
13
+ * `loadConfig()` throws `ConfigError` if either is missing, so the
14
+ * server fails fast with a useful message rather than emitting cryptic
15
+ * 401/Network errors deep in the request stack.
16
+ *
17
+ * @license MIT
18
+ */
19
+ export interface ServerConfig {
20
+ /** Base URL of the WordPress install (no trailing slash). */
21
+ readonly baseUrl: string;
22
+ /** Bearer key. */
23
+ readonly bearerToken: string;
24
+ /** Network timeout (ms) for REST calls. */
25
+ readonly timeoutMs: number;
26
+ }
27
+ export interface LoadConfigOptions {
28
+ /** Allow the bearer-token to be empty (for health-only smoke tests). */
29
+ readonly allowMissingToken?: boolean;
30
+ /** Source of env vars (defaults to process.env). */
31
+ readonly env?: NodeJS.ProcessEnv;
32
+ }
33
+ export declare const ENV_WP_URL = "YTB_MCP_WP_URL";
34
+ export declare const ENV_BEARER = "YTB_MCP_BEARER_TOKEN";
35
+ export declare const ENV_TIMEOUT = "YTB_MCP_TIMEOUT_MS";
36
+ export declare const ENV_TEST_MODE = "YTB_MCP_TEST_MODE";
37
+ export declare function loadConfig(options?: LoadConfigOptions): ServerConfig;
38
+ export declare function isTestMode(env?: NodeJS.ProcessEnv): boolean;
39
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,MAAM,WAAW,YAAY;IACzB,6DAA6D;IAC7D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AAkCjD,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,YAAY,CAiDxE;AAED,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExE"}
package/dist/auth.js ADDED
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Auth / configuration loading for the MCP server.
3
+ *
4
+ * The MCP server reads two environment variables on startup:
5
+ *
6
+ * YTB_MCP_WP_URL — base URL of the WordPress install, e.g.
7
+ * `https://example.com`. The REST namespace
8
+ * `/wp-json/yt-builder-mcp/v1` is
9
+ * appended internally.
10
+ * YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
11
+ * Settings page (`wp-admin → YT Builder MCP`).
12
+ *
13
+ * `loadConfig()` throws `ConfigError` if either is missing, so the
14
+ * server fails fast with a useful message rather than emitting cryptic
15
+ * 401/Network errors deep in the request stack.
16
+ *
17
+ * @license MIT
18
+ */
19
+ import { z } from 'zod';
20
+ import { ConfigError } from './errors.js';
21
+ export const ENV_WP_URL = 'YTB_MCP_WP_URL';
22
+ export const ENV_BEARER = 'YTB_MCP_BEARER_TOKEN';
23
+ export const ENV_TIMEOUT = 'YTB_MCP_TIMEOUT_MS';
24
+ export const ENV_TEST_MODE = 'YTB_MCP_TEST_MODE';
25
+ const DEFAULT_TIMEOUT_MS = 15_000;
26
+ /**
27
+ * Maximum accepted length for a Bearer token (defense-in-depth bound;
28
+ * the real plugin keys are ~150-300 bytes, the 512 ceiling protects
29
+ * against accidental file-pastes / log dumps / memory abuse).
30
+ */
31
+ const BEARER_MAX_LEN = 512;
32
+ /**
33
+ * Bearer-token format check — matches the plugin's `KeyService.php`
34
+ * `PREFIX = ytb_live_` (and the planned `ytb_test_` future variant).
35
+ * Token shape: `ytb_(live|test)_<payloadB64Url>.<sigB64Url>` where
36
+ * base64url uses `[A-Za-z0-9_-]` (no dots inside the payload or sig).
37
+ *
38
+ * Round-1 audit I7 fix (2026-05-22): the earlier `.trim()` + empty-check
39
+ * was not enough to catch the most common config mistakes — the leading
40
+ * `Bearer ` prefix accidentally pasted into the env var, copy-paste
41
+ * truncation (no `.` separator), or a totally wrong token style. We
42
+ * fail-fast here so the client never sends a known-bad value upstream.
43
+ */
44
+ const BEARER_FORMAT_SCHEMA = z
45
+ .string()
46
+ .max(BEARER_MAX_LEN, `Bearer too long (max ${String(BEARER_MAX_LEN)} chars). The env var YTB_MCP_BEARER_TOKEN seems to contain something other than a plain key — strip leading "Bearer " or paste only the key copied from wp-admin → "YT Builder MCP" → Settings.`)
47
+ .regex(/^ytb_(live|test)_[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/, 'Bearer must match ytb_(live|test)_<payloadB64Url>.<sigB64Url> format (copy the key as shown in wp-admin → "YT Builder MCP" → Settings; do NOT prepend "Bearer ").');
48
+ export function loadConfig(options = {}) {
49
+ const env = options.env ?? process.env;
50
+ const rawUrl = (env[ENV_WP_URL] ?? '').trim();
51
+ const rawToken = (env[ENV_BEARER] ?? '').trim();
52
+ const rawTimeout = (env[ENV_TIMEOUT] ?? '').trim();
53
+ if (rawUrl === '') {
54
+ throw new ConfigError(`Missing ${ENV_WP_URL}. Set it to your WordPress base URL ` +
55
+ '(e.g. https://example.com). Run `yt-builder-mcp setup` to configure.');
56
+ }
57
+ if (!options.allowMissingToken && rawToken === '') {
58
+ throw new ConfigError(`Missing ${ENV_BEARER}. Generate a Bearer key in wp-admin → "YT Builder MCP" → ` +
59
+ 'Settings, then run `yt-builder-mcp setup`.');
60
+ }
61
+ // I7-fix: enforce the Bearer-format contract before the client
62
+ // makes any request. Empty token is allowed only via
63
+ // `allowMissingToken` (the health-only smoke path); any other
64
+ // non-empty value MUST match the plugin's KeyService format.
65
+ if (rawToken !== '') {
66
+ const parsed = BEARER_FORMAT_SCHEMA.safeParse(rawToken);
67
+ if (!parsed.success) {
68
+ const issueMsg = parsed.error.issues
69
+ .map((iss) => iss.message)
70
+ .join(' ');
71
+ throw new ConfigError(`Invalid ${ENV_BEARER}: ${issueMsg}`);
72
+ }
73
+ }
74
+ let timeoutMs = DEFAULT_TIMEOUT_MS;
75
+ if (rawTimeout !== '') {
76
+ const parsed = Number.parseInt(rawTimeout, 10);
77
+ if (Number.isFinite(parsed) && parsed > 0) {
78
+ timeoutMs = parsed;
79
+ }
80
+ }
81
+ return {
82
+ baseUrl: stripTrailingSlash(rawUrl),
83
+ bearerToken: rawToken,
84
+ timeoutMs,
85
+ };
86
+ }
87
+ export function isTestMode(env = process.env) {
88
+ return (env[ENV_TEST_MODE] ?? '') === '1';
89
+ }
90
+ function stripTrailingSlash(url) {
91
+ return url.replace(/\/+$/, '');
92
+ }
93
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * `RestClient` — thin wrapper around `fetch` that targets the
3
+ * `yt-builder-mcp/v1` REST namespace.
4
+ *
5
+ * Responsibilities:
6
+ * - Compose final URLs (`{baseUrl}/wp-json/yt-builder-mcp/v1{path}`)
7
+ * - Attach `Authorization: Bearer …`
8
+ * - Encode JSON bodies + propagate `If-Match` etag headers
9
+ * - Map non-2xx into `RestError` with status / `code` / message
10
+ * - Map network failures into `NetworkError`
11
+ *
12
+ * The client deliberately keeps zero state beyond constructor config
13
+ * so each tool can hold a reference and call `.get/.post/.put/.delete`
14
+ * without coordinating sessions.
15
+ *
16
+ * @license MIT
17
+ */
18
+ import type { Platform } from './platform/index.js';
19
+ /**
20
+ * Canonical WordPress REST-namespace path. Re-exported for backward
21
+ * compat — new code should reach for `Platform.restNamespacePath`.
22
+ */
23
+ export declare const REST_NAMESPACE_PATH = "/wp-json/yt-builder-mcp/v1";
24
+ /**
25
+ * Legacy single-platform options shape. Kept so existing call-sites
26
+ * continue working without touching every entry point.
27
+ */
28
+ export interface LegacyRestClientOptions {
29
+ readonly baseUrl: string;
30
+ readonly bearerToken: string;
31
+ readonly timeoutMs?: number;
32
+ /** Injected for tests. Defaults to `globalThis.fetch`. */
33
+ readonly fetch?: typeof fetch;
34
+ }
35
+ /**
36
+ * Platform-aware options shape (Wave G.0+).
37
+ * Pass an instance of `WordPressPlatform` (or any future `Platform`)
38
+ * instead of a bare `baseUrl`.
39
+ */
40
+ export interface PlatformRestClientOptions {
41
+ readonly platform: Platform;
42
+ readonly bearerToken: string;
43
+ readonly timeoutMs?: number;
44
+ /** Injected for tests. Defaults to `globalThis.fetch`. */
45
+ readonly fetch?: typeof fetch;
46
+ }
47
+ /** Discriminated union: callers pick whichever shape suits them. */
48
+ export type RestClientOptions = LegacyRestClientOptions | PlatformRestClientOptions;
49
+ export interface RequestOptions {
50
+ /** Optional ETag for optimistic-lock (`If-Match` header). */
51
+ readonly etag?: string;
52
+ /** JSON body. */
53
+ readonly body?: unknown;
54
+ /** Extra headers. */
55
+ readonly headers?: Record<string, string>;
56
+ /** Optional AbortSignal. */
57
+ readonly signal?: AbortSignal;
58
+ }
59
+ export declare class RestClient {
60
+ private readonly platform;
61
+ private readonly baseUrl;
62
+ private readonly bearerToken;
63
+ private readonly timeoutMs;
64
+ private readonly fetchImpl;
65
+ constructor(options: RestClientOptions);
66
+ /** Expose the underlying platform (used by tools that need restNamespacePath/kind). */
67
+ getPlatform(): Platform;
68
+ get<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
69
+ post<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
70
+ put<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
71
+ delete<T = unknown>(path: string, options?: RequestOptions): Promise<T>;
72
+ request<T = unknown>(method: string, path: string, options?: RequestOptions): Promise<T>;
73
+ private buildUrl;
74
+ }
75
+ /**
76
+ * URL-encode a JSON-Pointer-style element path for use in the route.
77
+ *
78
+ * The plugin's regex captures everything after `/elements/`, so the
79
+ * raw `/grid/1/columns/0` path can be passed as-is — but each segment
80
+ * must be percent-encoded so reserved chars like `~` (used in
81
+ * JSON-Pointer escapes) don't collide with WordPress' router.
82
+ */
83
+ export declare function encodeElementPath(pointer: string): string;
84
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;GAGG;AACH,eAAO,MAAM,mBAAmB,+BAAgC,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,uBAAuB;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAED;;;;GAIG;AACH,MAAM,WAAW,yBAAyB;IACtC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;IAC5B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,0DAA0D;IAC1D,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACjC;AAED,oEAAoE;AACpE,MAAM,MAAM,iBAAiB,GAAG,uBAAuB,GAAG,yBAAyB,CAAC;AAEpF,MAAM,WAAW,cAAc;IAC3B,6DAA6D;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,iBAAiB;IACjB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,qBAAqB;IACrB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1C,4BAA4B;IAC5B,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CACjC;AAED,qBAAa,UAAU;IACnB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAW;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAS;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAe;gBAE7B,OAAO,EAAE,iBAAiB;IAYtC,uFAAuF;IACvF,WAAW,IAAI,QAAQ;IAIvB,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxE,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIzE,GAAG,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIxE,MAAM,CAAC,CAAC,GAAG,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,cAAmB,GAAG,OAAO,CAAC,CAAC,CAAC;IAIrE,OAAO,CAAC,CAAC,GAAG,OAAO,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,cAAmB,GAC7B,OAAO,CAAC,CAAC,CAAC;IAgDb,OAAO,CAAC,QAAQ;CAInB;AAgCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKzD"}