@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
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Sources format-sidecar — pure transforms for `sources_list` (table) and
3
+ * `element_get_binding` (detail). Wave G.2.7 (Design §3.2 rows 16 / 17).
4
+ *
5
+ * @license MIT
6
+ */
7
+ // ─── sources_list columns (Design §3.2 row 16) ───────────────────────
8
+ export const SOURCES_TABLE_COLUMNS = [
9
+ { key: 'name', label: 'NAME', width: 36, llmOnly: true },
10
+ { key: 'label', label: 'LABEL', width: 28 },
11
+ { key: 'origin', label: 'ORIGIN', width: 12 },
12
+ { key: 'kind', label: 'KIND', width: 10 },
13
+ ];
14
+ // ─── Row mapper ──────────────────────────────────────────────────────
15
+ function asString(v) {
16
+ return typeof v === 'string' ? v : '';
17
+ }
18
+ export function mapSourceRow(input) {
19
+ return {
20
+ name: asString(input.name),
21
+ label: asString(input.label),
22
+ origin: asString(input.origin),
23
+ kind: asString(input.kind),
24
+ };
25
+ }
26
+ /**
27
+ * The REST plugin exposes sources EITHER as a grouped object
28
+ * `{apimapper:[…], wordpress:[…], essentials:[…]}` OR (post-refactor)
29
+ * as a flat array of `{name, label, origin, kind}`. This helper
30
+ * normalises both into a flat array — flattening adds `origin` from the
31
+ * group key when absent.
32
+ */
33
+ const KNOWN_ORIGINS = ['apimapper', 'wordpress', 'essentials'];
34
+ export function flattenSourcesPayload(payload) {
35
+ if (Array.isArray(payload)) {
36
+ return payload.filter((x) => x !== null && typeof x === 'object');
37
+ }
38
+ if (payload !== null && typeof payload === 'object') {
39
+ const out = [];
40
+ const obj = payload;
41
+ for (const origin of KNOWN_ORIGINS) {
42
+ const group = obj[origin];
43
+ if (Array.isArray(group)) {
44
+ for (const item of group) {
45
+ if (item !== null && typeof item === 'object') {
46
+ const rec = item;
47
+ out.push({ origin, ...rec });
48
+ }
49
+ }
50
+ }
51
+ }
52
+ return out;
53
+ }
54
+ return [];
55
+ }
56
+ // ─── Detail builder (Design §3.2 row 17) ─────────────────────────────
57
+ export function buildBindingDetail(payload) {
58
+ const b = payload.binding;
59
+ const sourceName = typeof b.source_name === 'string' ? b.source_name : null;
60
+ const configCount = b.source_config !== null && typeof b.source_config === 'object'
61
+ ? Object.keys(b.source_config).length
62
+ : 0;
63
+ const argsCount = b.source_args !== null && typeof b.source_args === 'object'
64
+ ? Object.keys(b.source_args).length
65
+ : 0;
66
+ return {
67
+ title: `Binding for ${payload.element_path}`,
68
+ groups: [
69
+ {
70
+ label: 'Element',
71
+ entries: [
72
+ {
73
+ key: 'template_id',
74
+ label: 'Template',
75
+ value: payload.template_id,
76
+ format: 'badge',
77
+ },
78
+ {
79
+ key: 'element_path',
80
+ label: 'Path',
81
+ value: payload.element_path,
82
+ format: 'code',
83
+ copyable: true,
84
+ },
85
+ ],
86
+ },
87
+ {
88
+ label: 'Binding',
89
+ entries: [
90
+ {
91
+ key: 'source_name',
92
+ label: 'Source',
93
+ value: sourceName,
94
+ format: 'badge',
95
+ },
96
+ {
97
+ key: 'config_keys',
98
+ label: 'Config keys',
99
+ value: configCount,
100
+ format: 'text',
101
+ },
102
+ {
103
+ key: 'args_keys',
104
+ label: 'Args keys',
105
+ value: argsCount,
106
+ format: 'text',
107
+ },
108
+ ],
109
+ },
110
+ ],
111
+ };
112
+ }
113
+ //# sourceMappingURL=sources-format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sources-format.js","sourceRoot":"","sources":["../../../src/tools/format/sources-format.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,wEAAwE;AAExE,MAAM,CAAC,MAAM,qBAAqB,GAA2B;IACzD,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE;IACxD,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE;IAC3C,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,EAAE;IAC7C,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE;CAC5C,CAAC;AAEF,wEAAwE;AAExE,SAAS,QAAQ,CAAC,CAAU;IACxB,OAAO,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1C,CAAC;AASD,MAAM,UAAU,YAAY,CAAC,KAA8B;IACvD,OAAO;QACH,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;QAC1B,KAAK,EAAE,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;QAC5B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC;QAC9B,IAAI,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ClB,KAAK,EAAE,SAAS;wBAChB,MAAM,EAAE,MAAM;qBACjB;iBACJ;aACJ;SACJ;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Health & diagnostics tools.
3
+ *
4
+ * yootheme_builder_health
5
+ * → GET /health (unauthenticated). Verifies the plugin is
6
+ * installed and reachable. Returns plugin/YT/WP/PHP versions
7
+ * + available endpoints.
8
+ *
9
+ * yootheme_builder_diagnose
10
+ * → Aggregates health + a Bearer-auth probe so the agent can
11
+ * distinguish "plugin missing" from "wrong key".
12
+ *
13
+ * Both tools emit `detailResult` (Wave G.2) so hosts that support
14
+ * structured content render a Detail-Card; the LLM still reads the text
15
+ * leg from `content[0].text`.
16
+ *
17
+ * @license MIT
18
+ */
19
+ import type { RestClient } from '../client.js';
20
+ import { type AnyToolDefinition } from './tool-builder.js';
21
+ export declare function buildHealthTools(client: RestClient): readonly AnyToolDefinition[];
22
+ //# sourceMappingURL=health.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,OAAO,EAMH,KAAK,iBAAiB,EACzB,MAAM,mBAAmB,CAAC;AA2B3B,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CAyGjF"}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Health & diagnostics tools.
3
+ *
4
+ * yootheme_builder_health
5
+ * → GET /health (unauthenticated). Verifies the plugin is
6
+ * installed and reachable. Returns plugin/YT/WP/PHP versions
7
+ * + available endpoints.
8
+ *
9
+ * yootheme_builder_diagnose
10
+ * → Aggregates health + a Bearer-auth probe so the agent can
11
+ * distinguish "plugin missing" from "wrong key".
12
+ *
13
+ * Both tools emit `detailResult` (Wave G.2) so hosts that support
14
+ * structured content render a Detail-Card; the LLM still reads the text
15
+ * leg from `content[0].text`.
16
+ *
17
+ * @license MIT
18
+ */
19
+ import { detailResult, statsResult } from '@getimo/mcp-toolkit';
20
+ import { z } from 'zod';
21
+ import { RestError } from '../errors.js';
22
+ import { buildDiagnoseDetail, buildHealthStats, } from './format/health-format.js';
23
+ import { defineTool, errorResult, jsonResult, readOnly, structuredResult, } from './tool-builder.js';
24
+ // ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
25
+ const HEALTH_OUTPUT_SCHEMA = z.object({
26
+ plugin_version: z.string(),
27
+ yootheme_version: z.string().nullable(),
28
+ wp_version: z.string().nullable(),
29
+ php_version: z.string(),
30
+ storage_type: z.string(),
31
+ storage_target: z.string(),
32
+ yootheme_loaded: z.boolean(),
33
+ available_endpoints: z.array(z.string()),
34
+ });
35
+ const DIAGNOSE_OUTPUT_SCHEMA = z.object({
36
+ plugin_reachable: z.boolean(),
37
+ plugin_version: z.string().optional(),
38
+ yootheme_loaded: z.boolean().optional(),
39
+ yootheme_version: z.string().nullable().optional(),
40
+ endpoint_count: z.number().optional(),
41
+ plugin_error: z.string().optional(),
42
+ bearer_valid: z.boolean().optional(),
43
+ bearer_error: z.string().optional(),
44
+ summary: z.string().optional(),
45
+ });
46
+ export function buildHealthTools(client) {
47
+ return [
48
+ defineTool({
49
+ name: 'yootheme_builder_health',
50
+ description: 'Check that the YT Builder MCP plugin is installed and reachable. ' +
51
+ 'Returns plugin version, YOOtheme Pro version (if loaded), and the list of ' +
52
+ 'available REST endpoints. Unauthenticated probe — call this first when ' +
53
+ 'troubleshooting connectivity.',
54
+ inputSchema: {},
55
+ outputSchema: HEALTH_OUTPUT_SCHEMA,
56
+ annotations: readOnly('Health Check'),
57
+ handler: async () => {
58
+ try {
59
+ const data = await client.get('/health');
60
+ // Round-1 audit I1 fix: spec §3.2 row 1 calls for
61
+ // `statsResult` (flat metrics). Earlier shipped
62
+ // `detailResult` — that's a Detail-Card variant, not
63
+ // the stats-display the spec asked for. The flat
64
+ // shape is built by `buildHealthStats`.
65
+ const toolkitResult = statsResult(buildHealthStats(data));
66
+ return structuredResult(toolkitResult, {
67
+ plugin_version: data.plugin_version,
68
+ yootheme_version: data.yootheme_version,
69
+ wp_version: data.wp_version,
70
+ php_version: data.php_version,
71
+ storage_type: data.storage_type,
72
+ storage_target: data.storage_target,
73
+ yootheme_loaded: data.yootheme_loaded,
74
+ available_endpoints: data.available_endpoints,
75
+ });
76
+ }
77
+ catch (e) {
78
+ return errorResult({
79
+ error: e,
80
+ context: {},
81
+ hint: 'Verify YTB_MCP_WP_URL points at a WordPress site with the ' +
82
+ 'yt-builder-mcp plugin active. Try opening ' +
83
+ '<wp_url>/wp-json/yt-builder-mcp/v1/health in a browser.',
84
+ });
85
+ }
86
+ },
87
+ }),
88
+ defineTool({
89
+ name: 'yootheme_builder_diagnose',
90
+ description: 'Run a full diagnostic: hit /health (no auth), then attempt an authenticated ' +
91
+ 'call (/etag) to confirm the Bearer key is valid. Use when health passes but ' +
92
+ 'tools return 401/403.',
93
+ inputSchema: {},
94
+ outputSchema: DIAGNOSE_OUTPUT_SCHEMA,
95
+ annotations: readOnly('Diagnose Connection'),
96
+ handler: async () => {
97
+ const checks = { plugin_reachable: false };
98
+ try {
99
+ const health = await client.get('/health');
100
+ checks.plugin_reachable = true;
101
+ checks.plugin_version = health.plugin_version;
102
+ checks.yootheme_loaded = health.yootheme_loaded;
103
+ checks.yootheme_version = health.yootheme_version;
104
+ checks.endpoint_count = health.available_endpoints.length;
105
+ }
106
+ catch (e) {
107
+ checks.plugin_reachable = false;
108
+ checks.plugin_error = e instanceof Error ? e.message : String(e);
109
+ // Plugin-unreachable path stays on jsonResult so the LLM
110
+ // sees the structured error hint inline (detailResult would
111
+ // hide the actionable "verify YTB_MCP_WP_URL" hint inside
112
+ // a sub-group). isError=true preserves SDK semantics.
113
+ return jsonResult({
114
+ ...checks,
115
+ hint: 'Plugin not reachable. Verify YTB_MCP_WP_URL and that the ' +
116
+ 'yt-builder-mcp WordPress plugin is active.',
117
+ }, { isError: true });
118
+ }
119
+ try {
120
+ await client.get('/etag');
121
+ checks.bearer_valid = true;
122
+ }
123
+ catch (e) {
124
+ checks.bearer_valid = false;
125
+ if (e instanceof RestError) {
126
+ checks.bearer_error = `HTTP ${String(e.status)}: ${e.message}`;
127
+ }
128
+ else {
129
+ checks.bearer_error = e instanceof Error ? e.message : String(e);
130
+ }
131
+ return jsonResult({
132
+ ...checks,
133
+ hint: 'Bearer key rejected. Regenerate the key in wp-admin → Tools → ' +
134
+ '"YT Builder MCP" → Bearer Keys and re-run ' +
135
+ '`yt-builder-mcp setup`.',
136
+ }, { isError: true });
137
+ }
138
+ const toolkitResult = detailResult(buildDiagnoseDetail(checks));
139
+ return structuredResult(toolkitResult, {
140
+ ...checks,
141
+ summary: 'OK — plugin reachable and Bearer key accepted.',
142
+ });
143
+ },
144
+ }),
145
+ ];
146
+ }
147
+ //# sourceMappingURL=health.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,mBAAmB,EACnB,gBAAgB,GAGnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,gBAAgB,GAEnB,MAAM,mBAAmB,CAAC;AAE3B,wEAAwE;AAExE,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,UAAU,EAAE,C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,MAAM,CAAC,CAAC,CAAC,CAAC;oBACrE,CAAC;oBACD,OAAO,UAAU,CAAC;wBACd,GAAG,MAAM;wBACT,IAAI,EACA,gEAAgE;4BAChE,4CAA4C;4BAC5C,yBAAyB;qBAChC,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC;gBAC1B,CAAC;gBAED,MAAM,aAAa,GAAG,YAAY,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,CAAC;gBAChE,OAAO,gBAAgB,CAAC,aAAa,EAAE;oBACnC,GAAG,MAAM;oBACT,OAAO,EAAE,gDAAgD;iBAC5D,CAAC,CAAC;YACP,CAAC;SACJ,CAAC;KACL,CAAC;AACN,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Tool aggregator — collects all domain tools into a single list.
3
+ * The MCP server iterates this list at startup to register handlers
4
+ * with `@modelcontextprotocol/sdk`.
5
+ *
6
+ * @license MIT
7
+ */
8
+ import type { RestClient } from '../client.js';
9
+ import type { McpServerWithElicitation } from './elicitation.js';
10
+ import type { AnyToolDefinition } from './tool-builder.js';
11
+ export interface BuildAllToolsOptions {
12
+ /**
13
+ * Optional MCP elicitation capability — see
14
+ * `src/tools/elicitation.ts` for the adapter. When supplied,
15
+ * destructive + ambiguity-resolution tools prompt the user via the
16
+ * elicitation channel; when omitted, they fall back to the
17
+ * preview-then-retry / `ambiguityFallbackError` flow.
18
+ */
19
+ readonly elicitation?: McpServerWithElicitation;
20
+ }
21
+ export declare function buildAllTools(client: RestClient, options?: BuildAllToolsOptions): readonly AnyToolDefinition[];
22
+ export type { AnyToolDefinition, ToolDefinition } from './tool-builder.js';
23
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAKjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACnD;AAED,wBAAgB,aAAa,CACzB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,oBAAyB,GACnC,SAAS,iBAAiB,EAAE,CAS9B;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Tool aggregator — collects all domain tools into a single list.
3
+ * The MCP server iterates this list at startup to register handlers
4
+ * with `@modelcontextprotocol/sdk`.
5
+ *
6
+ * @license MIT
7
+ */
8
+ import { buildElementsTools } from './elements/index.js';
9
+ import { buildHealthTools } from './health.js';
10
+ import { buildInspectionTools } from './inspection.js';
11
+ import { buildPagesTools } from './pages.js';
12
+ import { buildSourcesTools } from './sources/index.js';
13
+ export function buildAllTools(client, options = {}) {
14
+ const deps = options.elicitation !== undefined ? { elicitation: options.elicitation } : {};
15
+ return [
16
+ ...buildHealthTools(client),
17
+ ...buildPagesTools(client),
18
+ ...buildElementsTools(client, deps),
19
+ ...buildSourcesTools(client, deps),
20
+ ...buildInspectionTools(client),
21
+ ];
22
+ }
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAcvD,MAAM,UAAU,aAAa,CACzB,MAAkB,EAClB,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,OAAO;QACH,GAAG,gBAAgB,CAAC,MAAM,CAAC;QAC3B,GAAG,eAAe,CAAC,MAAM,CAAC;QAC1B,GAAG,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC;QACnC,GAAG,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;QAClC,GAAG,oBAAoB,CAAC,MAAM,CAAC;KAClC,CAAC;AACN,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Element-type inspection tools.
3
+ *
4
+ * yootheme_builder_element_types_list
5
+ * → catalogue of available element types (tableResult — Wave G.2)
6
+ * yootheme_builder_element_type_get_schema
7
+ * → field schema for a single element type (detailResult — Wave G.2)
8
+ *
9
+ * @license MIT
10
+ */
11
+ import type { RestClient } from '../client.js';
12
+ import { type AnyToolDefinition } from './tool-builder.js';
13
+ export declare function buildInspectionTools(client: RestClient): readonly AnyToolDefinition[];
14
+ //# sourceMappingURL=inspection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../src/tools/inspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,OAAO,EAKH,KAAK,iBAAiB,EACzB,MAAM,mBAAmB,CAAC;AAwB3B,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CA+FrF"}
@@ -0,0 +1,115 @@
1
+ /**
2
+ * Element-type inspection tools.
3
+ *
4
+ * yootheme_builder_element_types_list
5
+ * → catalogue of available element types (tableResult — Wave G.2)
6
+ * yootheme_builder_element_type_get_schema
7
+ * → field schema for a single element type (detailResult — Wave G.2)
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { detailResult, tableResult } from '@getimo/mcp-toolkit';
12
+ import { z } from 'zod';
13
+ import { TYPES_COMPACT_COLUMNS, TYPES_TABLE_COLUMNS, buildTypeSchemaDetail, flattenTypesPayload, mapTypeRow, } from './format/inspection-format.js';
14
+ import { defineTool, errorResult, readOnly, structuredResult, } from './tool-builder.js';
15
+ import { DEFAULT_FIELDS_TYPES_LIST, FIELDS, projectFields, projectedFieldsEcho, } from './sparse-fields.js';
16
+ // ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
17
+ const TYPES_LIST_OUTPUT_SCHEMA = z.object({
18
+ items: z.array(z.record(z.string(), z.unknown())),
19
+ total: z.number(),
20
+ projected_fields: z.array(z.string()).optional(),
21
+ });
22
+ const TYPE_SCHEMA_OUTPUT_SCHEMA = z.object({
23
+ name: z.string(),
24
+ label: z.string().optional(),
25
+ origin: z.string().optional(),
26
+ fields: z.record(z.string(), z.unknown()).optional(),
27
+ field_count: z.number(),
28
+ });
29
+ export function buildInspectionTools(client) {
30
+ return [
31
+ defineTool({
32
+ name: 'yootheme_builder_element_types_list',
33
+ description: 'List element types registered on this site (built-ins + ' +
34
+ 'YOOessentials/uEssentials extras). Names feed `element_type` of ' +
35
+ 'element_add. Pass `fields[]` to narrow each row.',
36
+ inputSchema: {
37
+ fields: FIELDS,
38
+ },
39
+ outputSchema: TYPES_LIST_OUTPUT_SCHEMA,
40
+ annotations: readOnly('List Element Types'),
41
+ handler: async ({ fields }) => {
42
+ try {
43
+ const data = await client.get('/element-types');
44
+ const flat = flattenTypesPayload(data);
45
+ const mapped = flat.map(mapTypeRow);
46
+ const mappedRecords = mapped;
47
+ const items = projectFields(mappedRecords, fields, DEFAULT_FIELDS_TYPES_LIST);
48
+ const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_TYPES_LIST);
49
+ const toolkitResult = tableResult(mappedRecords, {
50
+ columns: [...TYPES_TABLE_COLUMNS],
51
+ compactColumns: [...TYPES_COMPACT_COLUMNS],
52
+ header: (count) => `${String(count)} element types`,
53
+ footer: 'Use yootheme_builder_element_type_get_schema <name> for fields.',
54
+ });
55
+ return structuredResult(toolkitResult, {
56
+ items,
57
+ total: items.length,
58
+ ...(echo !== undefined ? { projected_fields: [...echo] } : {}),
59
+ });
60
+ }
61
+ catch (e) {
62
+ return errorResult({
63
+ error: e,
64
+ context: {},
65
+ hint: 'Run yootheme_builder_diagnose to verify auth.',
66
+ });
67
+ }
68
+ },
69
+ }),
70
+ defineTool({
71
+ name: 'yootheme_builder_element_type_get_schema',
72
+ description: 'Get the prop/field schema for a single element type. Use the result to discover ' +
73
+ 'valid keys for `props` when calling yootheme_builder_element_add or ' +
74
+ '_update_settings.',
75
+ inputSchema: {
76
+ type_name: z
77
+ .string()
78
+ .min(1)
79
+ .describe('Element type name (e.g. "headline", "text", "grid"). Use ' +
80
+ 'yootheme_builder_element_types_list to discover.'),
81
+ },
82
+ outputSchema: TYPE_SCHEMA_OUTPUT_SCHEMA,
83
+ annotations: readOnly('Get Element Type Schema'),
84
+ handler: async ({ type_name }) => {
85
+ try {
86
+ const data = await client.get(`/element-types/${encodeURIComponent(type_name)}/schema`);
87
+ const name = typeof data.name === 'string' ? data.name : type_name;
88
+ const label = typeof data.label === 'string' ? data.label : undefined;
89
+ const origin = typeof data.origin === 'string' ? data.origin : undefined;
90
+ const fields = data.fields !== null && typeof data.fields === 'object'
91
+ ? data.fields
92
+ : undefined;
93
+ const fieldCount = fields !== undefined ? Object.keys(fields).length : 0;
94
+ const toolkitResult = detailResult(buildTypeSchemaDetail({ name, label, origin, fields }));
95
+ return structuredResult(toolkitResult, {
96
+ name,
97
+ ...(label !== undefined ? { label } : {}),
98
+ ...(origin !== undefined ? { origin } : {}),
99
+ ...(fields !== undefined ? { fields } : {}),
100
+ field_count: fieldCount,
101
+ });
102
+ }
103
+ catch (e) {
104
+ return errorResult({
105
+ error: e,
106
+ context: { type_name },
107
+ hint: 'Verify type_name via yootheme_builder_element_types_list — names ' +
108
+ 'are case-sensitive.',
109
+ });
110
+ }
111
+ },
112
+ }),
113
+ ];
114
+ }
115
+ //# sourceMappingURL=inspection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inspection.js","sourceRoot":"","sources":["../../src/tools/inspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACH,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,yBAAyB,EACzB,MAAM,EACN,aAAa,EACb,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,wEAAwE;AAExE,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC;AAEH,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC5B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC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3
+ * layout tree into a flat array of `{ path, parent_path, depth,
4
+ * element_type, props }` records.
5
+ *
6
+ * Used by `yootheme_builder_page_get_layout` when called with
7
+ * `flat: true`. Per Design §4.4.1:
8
+ *
9
+ * - Walk-order: depth-first, parent BEFORE children, original child
10
+ * order preserved (no sort).
11
+ * - `path` uses JSON-Pointer-style notation rooted at `/layout/<key>`
12
+ * and descends via `/children/<index>` segments. The root segments
13
+ * mirror the keys the REST plugin produces (string keys "0","1",…
14
+ * when the top-level layout is an object; numeric indices when it
15
+ * happens to be an array).
16
+ * - `parent_path` is `null` for top-level entries.
17
+ * - The emitted record's `children` field is REMOVED — children become
18
+ * their own emitted entries with their own `path`. Keeping the nested
19
+ * array would defeat the purpose of flattening.
20
+ * - Non-object children are skipped silently but their index is
21
+ * preserved in the parent's child-numbering (the next valid sibling
22
+ * keeps its original index).
23
+ *
24
+ * Pure function — no I/O, no client dependency. Test-covered in
25
+ * `tests/tools/layout-flatten.test.ts`.
26
+ *
27
+ * @license MIT
28
+ */
29
+ /** A single emitted record in the flattened layout. */
30
+ export interface FlatElement {
31
+ /** JSON-Pointer-style path, e.g. "/layout/0/children/2". */
32
+ path: string;
33
+ /** Path of the parent element, or `null` for top-level entries. */
34
+ parent_path: string | null;
35
+ /** 0-based depth (top-level entries have depth 0). */
36
+ depth: number;
37
+ /** Element type string (the `type` field on the YT node, "" if missing). */
38
+ element_type: string;
39
+ /** Element props (passthrough; `undefined` when the node has none). */
40
+ props?: Record<string, unknown>;
41
+ /**
42
+ * Children intentionally absent — see file-header. Kept in the type
43
+ * so consumers can confirm the field is `undefined` rather than
44
+ * assume it exists.
45
+ */
46
+ children?: undefined;
47
+ /**
48
+ * Allow passthrough of any other top-level fields the REST plugin
49
+ * may add in future (e.g. `label`, `has_binding`, `name`). The
50
+ * walker preserves these verbatim so projection via `pickFields`
51
+ * downstream stays meaningful.
52
+ */
53
+ [extra: string]: unknown;
54
+ }
55
+ /**
56
+ * Flatten a YOOtheme nested layout tree.
57
+ *
58
+ * @param layout - The top-level layout container. Accepts either an
59
+ * object keyed by stringified indices ("0","1",…) or an actual array.
60
+ * Returns `[]` for empty input or anything that isn't iterable.
61
+ */
62
+ export declare function flattenLayout(layout: unknown): FlatElement[];
63
+ //# sourceMappingURL=layout-flatten.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout-flatten.d.ts","sourceRoot":"","sources":["../../src/tools/layout-flatten.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,uDAAuD;AACvD,MAAM,WAAW,WAAW;IACxB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,EAAE,CAmB5D"}