@wootsup/yt-builder-mcp 1.1.5 → 1.1.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 (400) hide show
  1. package/README.md +56 -55
  2. package/dist/auth.d.ts +119 -0
  3. package/dist/auth.d.ts.map +1 -0
  4. package/dist/auth.js +226 -0
  5. package/dist/auth.js.map +1 -0
  6. package/dist/client.d.ts +84 -0
  7. package/dist/client.d.ts.map +1 -0
  8. package/dist/client.js +151 -0
  9. package/dist/client.js.map +1 -0
  10. package/dist/clients/claude-code.d.ts +18 -0
  11. package/dist/clients/claude-code.d.ts.map +1 -0
  12. package/dist/clients/claude-code.js +53 -0
  13. package/dist/clients/claude-code.js.map +1 -0
  14. package/dist/clients/claude-desktop.d.ts +19 -0
  15. package/dist/clients/claude-desktop.d.ts.map +1 -0
  16. package/dist/clients/claude-desktop.js +56 -0
  17. package/dist/clients/claude-desktop.js.map +1 -0
  18. package/dist/clients/cline.d.ts +26 -0
  19. package/dist/clients/cline.d.ts.map +1 -0
  20. package/dist/clients/cline.js +80 -0
  21. package/dist/clients/cline.js.map +1 -0
  22. package/dist/clients/codex-cli.d.ts +42 -0
  23. package/dist/clients/codex-cli.d.ts.map +1 -0
  24. package/dist/clients/codex-cli.js +194 -0
  25. package/dist/clients/codex-cli.js.map +1 -0
  26. package/dist/clients/continue.d.ts +13 -0
  27. package/dist/clients/continue.d.ts.map +1 -0
  28. package/dist/clients/continue.js +52 -0
  29. package/dist/clients/continue.js.map +1 -0
  30. package/dist/clients/cursor.d.ts +12 -0
  31. package/dist/clients/cursor.d.ts.map +1 -0
  32. package/dist/clients/cursor.js +38 -0
  33. package/dist/clients/cursor.js.map +1 -0
  34. package/dist/clients/gemini-cli.d.ts +18 -0
  35. package/dist/clients/gemini-cli.d.ts.map +1 -0
  36. package/dist/clients/gemini-cli.js +44 -0
  37. package/dist/clients/gemini-cli.js.map +1 -0
  38. package/dist/clients/home.d.ts +14 -0
  39. package/dist/clients/home.d.ts.map +1 -0
  40. package/dist/clients/home.js +20 -0
  41. package/dist/clients/home.js.map +1 -0
  42. package/dist/clients/index.d.ts +52 -0
  43. package/dist/clients/index.d.ts.map +1 -0
  44. package/dist/clients/index.js +72 -0
  45. package/dist/clients/index.js.map +1 -0
  46. package/dist/clients/roo-code.d.ts +23 -0
  47. package/dist/clients/roo-code.d.ts.map +1 -0
  48. package/dist/clients/roo-code.js +69 -0
  49. package/dist/clients/roo-code.js.map +1 -0
  50. package/dist/clients/zed.d.ts +12 -0
  51. package/dist/clients/zed.d.ts.map +1 -0
  52. package/dist/clients/zed.js +41 -0
  53. package/dist/clients/zed.js.map +1 -0
  54. package/dist/errors/hints.d.ts +51 -0
  55. package/dist/errors/hints.d.ts.map +1 -0
  56. package/dist/errors/hints.js +95 -0
  57. package/dist/errors/hints.js.map +1 -0
  58. package/dist/errors/mask.d.ts +35 -0
  59. package/dist/errors/mask.d.ts.map +1 -0
  60. package/dist/errors/mask.js +49 -0
  61. package/dist/errors/mask.js.map +1 -0
  62. package/dist/errors/sanitize.d.ts +31 -0
  63. package/dist/errors/sanitize.d.ts.map +1 -0
  64. package/dist/errors/sanitize.js +100 -0
  65. package/dist/errors/sanitize.js.map +1 -0
  66. package/dist/errors.d.ts +42 -0
  67. package/dist/errors.d.ts.map +1 -0
  68. package/dist/errors.js +61 -0
  69. package/dist/errors.js.map +1 -0
  70. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  71. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  72. package/dist/gateway/advanced-tool/discovery.js +53 -0
  73. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  74. package/dist/gateway/advanced-tool/domains.d.ts +47 -0
  75. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  76. package/dist/gateway/advanced-tool/domains.js +94 -0
  77. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  78. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  79. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  80. package/dist/gateway/advanced-tool/execute.js +54 -0
  81. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  82. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  83. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  84. package/dist/gateway/advanced-tool/index.js +39 -0
  85. package/dist/gateway/advanced-tool/index.js.map +1 -0
  86. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  87. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  88. package/dist/gateway/advanced-tool/register.js +69 -0
  89. package/dist/gateway/advanced-tool/register.js.map +1 -0
  90. package/dist/gateway/advanced-tool.d.ts +13 -0
  91. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  92. package/dist/gateway/advanced-tool.js +13 -0
  93. package/dist/gateway/advanced-tool.js.map +1 -0
  94. package/dist/gateway/capturing-server.d.ts +117 -0
  95. package/dist/gateway/capturing-server.d.ts.map +1 -0
  96. package/dist/gateway/capturing-server.js +103 -0
  97. package/dist/gateway/capturing-server.js.map +1 -0
  98. package/dist/gateway/essentials.d.ts +50 -0
  99. package/dist/gateway/essentials.d.ts.map +1 -0
  100. package/dist/gateway/essentials.js +94 -0
  101. package/dist/gateway/essentials.js.map +1 -0
  102. package/dist/gateway/test-support.d.ts +41 -0
  103. package/dist/gateway/test-support.d.ts.map +1 -0
  104. package/dist/gateway/test-support.js +60 -0
  105. package/dist/gateway/test-support.js.map +1 -0
  106. package/dist/index.d.ts +29 -0
  107. package/dist/index.d.ts.map +1 -0
  108. package/dist/index.js +111 -0
  109. package/dist/index.js.map +1 -0
  110. package/dist/install-skill.d.ts +43 -0
  111. package/dist/install-skill.d.ts.map +1 -0
  112. package/dist/install-skill.js +118 -0
  113. package/dist/install-skill.js.map +1 -0
  114. package/dist/platform/detect.d.ts +64 -0
  115. package/dist/platform/detect.d.ts.map +1 -0
  116. package/dist/platform/detect.js +98 -0
  117. package/dist/platform/detect.js.map +1 -0
  118. package/dist/platform/index.d.ts +121 -0
  119. package/dist/platform/index.d.ts.map +1 -0
  120. package/dist/platform/index.js +176 -0
  121. package/dist/platform/index.js.map +1 -0
  122. package/dist/platform/joomla.d.ts +44 -0
  123. package/dist/platform/joomla.d.ts.map +1 -0
  124. package/dist/platform/joomla.js +46 -0
  125. package/dist/platform/joomla.js.map +1 -0
  126. package/dist/server.d.ts +110 -0
  127. package/dist/server.d.ts.map +1 -0
  128. package/dist/server.js +274 -0
  129. package/dist/server.js.map +1 -0
  130. package/dist/setup-cli-confirm.d.ts +36 -0
  131. package/dist/setup-cli-confirm.d.ts.map +1 -0
  132. package/dist/setup-cli-confirm.js +59 -0
  133. package/dist/setup-cli-confirm.js.map +1 -0
  134. package/dist/setup-cli.d.ts +152 -0
  135. package/dist/setup-cli.d.ts.map +1 -0
  136. package/dist/setup-cli.js +870 -0
  137. package/dist/setup-cli.js.map +1 -0
  138. package/dist/setup-prompts.d.ts +41 -0
  139. package/dist/setup-prompts.d.ts.map +1 -0
  140. package/dist/setup-prompts.js +146 -0
  141. package/dist/setup-prompts.js.map +1 -0
  142. package/dist/setup-token.d.ts +38 -0
  143. package/dist/setup-token.d.ts.map +1 -0
  144. package/dist/setup-token.js +106 -0
  145. package/dist/setup-token.js.map +1 -0
  146. package/dist/setup-wizard-defaults.d.ts +43 -0
  147. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  148. package/dist/setup-wizard-defaults.js +160 -0
  149. package/dist/setup-wizard-defaults.js.map +1 -0
  150. package/dist/setup-wizard-handshake.d.ts +25 -0
  151. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  152. package/dist/setup-wizard-handshake.js +103 -0
  153. package/dist/setup-wizard-handshake.js.map +1 -0
  154. package/dist/setup-wizard-types.d.ts +164 -0
  155. package/dist/setup-wizard-types.d.ts.map +1 -0
  156. package/dist/setup-wizard-types.js +11 -0
  157. package/dist/setup-wizard-types.js.map +1 -0
  158. package/dist/setup-wizard.d.ts +33 -0
  159. package/dist/setup-wizard.d.ts.map +1 -0
  160. package/dist/setup-wizard.js +199 -0
  161. package/dist/setup-wizard.js.map +1 -0
  162. package/dist/setup.d.ts +17 -0
  163. package/dist/setup.d.ts.map +1 -0
  164. package/dist/setup.js +33 -0
  165. package/dist/setup.js.map +1 -0
  166. package/dist/sites/cli/add-site.d.ts +106 -0
  167. package/dist/sites/cli/add-site.d.ts.map +1 -0
  168. package/dist/sites/cli/add-site.js +185 -0
  169. package/dist/sites/cli/add-site.js.map +1 -0
  170. package/dist/sites/cli/list-sites.d.ts +40 -0
  171. package/dist/sites/cli/list-sites.d.ts.map +1 -0
  172. package/dist/sites/cli/list-sites.js +116 -0
  173. package/dist/sites/cli/list-sites.js.map +1 -0
  174. package/dist/sites/cli/remove-site.d.ts +60 -0
  175. package/dist/sites/cli/remove-site.d.ts.map +1 -0
  176. package/dist/sites/cli/remove-site.js +120 -0
  177. package/dist/sites/cli/remove-site.js.map +1 -0
  178. package/dist/sites/cli/set-default.d.ts +47 -0
  179. package/dist/sites/cli/set-default.d.ts.map +1 -0
  180. package/dist/sites/cli/set-default.js +69 -0
  181. package/dist/sites/cli/set-default.js.map +1 -0
  182. package/dist/sites/cli/test-site.d.ts +77 -0
  183. package/dist/sites/cli/test-site.d.ts.map +1 -0
  184. package/dist/sites/cli/test-site.js +146 -0
  185. package/dist/sites/cli/test-site.js.map +1 -0
  186. package/dist/sites/client-pool.d.ts +124 -0
  187. package/dist/sites/client-pool.d.ts.map +1 -0
  188. package/dist/sites/client-pool.js +172 -0
  189. package/dist/sites/client-pool.js.map +1 -0
  190. package/dist/sites/env-bridge.d.ts +55 -0
  191. package/dist/sites/env-bridge.d.ts.map +1 -0
  192. package/dist/sites/env-bridge.js +94 -0
  193. package/dist/sites/env-bridge.js.map +1 -0
  194. package/dist/sites/paths.d.ts +21 -0
  195. package/dist/sites/paths.d.ts.map +1 -0
  196. package/dist/sites/paths.js +37 -0
  197. package/dist/sites/paths.js.map +1 -0
  198. package/dist/sites/probe.d.ts +60 -0
  199. package/dist/sites/probe.d.ts.map +1 -0
  200. package/dist/sites/probe.js +112 -0
  201. package/dist/sites/probe.js.map +1 -0
  202. package/dist/sites/registry.d.ts +142 -0
  203. package/dist/sites/registry.d.ts.map +1 -0
  204. package/dist/sites/registry.js +163 -0
  205. package/dist/sites/registry.js.map +1 -0
  206. package/dist/sites/schema.d.ts +90 -0
  207. package/dist/sites/schema.d.ts.map +1 -0
  208. package/dist/sites/schema.js +71 -0
  209. package/dist/sites/schema.js.map +1 -0
  210. package/dist/sites/secret-resolver.d.ts +115 -0
  211. package/dist/sites/secret-resolver.d.ts.map +1 -0
  212. package/dist/sites/secret-resolver.js +225 -0
  213. package/dist/sites/secret-resolver.js.map +1 -0
  214. package/dist/sites/store.d.ts +82 -0
  215. package/dist/sites/store.d.ts.map +1 -0
  216. package/dist/sites/store.js +198 -0
  217. package/dist/sites/store.js.map +1 -0
  218. package/dist/sites/tools/index.d.ts +28 -0
  219. package/dist/sites/tools/index.d.ts.map +1 -0
  220. package/dist/sites/tools/index.js +30 -0
  221. package/dist/sites/tools/index.js.map +1 -0
  222. package/dist/sites/tools/sites-list.d.ts +48 -0
  223. package/dist/sites/tools/sites-list.d.ts.map +1 -0
  224. package/dist/sites/tools/sites-list.js +137 -0
  225. package/dist/sites/tools/sites-list.js.map +1 -0
  226. package/dist/sites/tools/sites-test.d.ts +47 -0
  227. package/dist/sites/tools/sites-test.d.ts.map +1 -0
  228. package/dist/sites/tools/sites-test.js +148 -0
  229. package/dist/sites/tools/sites-test.js.map +1 -0
  230. package/dist/skill-loader.d.ts +111 -0
  231. package/dist/skill-loader.d.ts.map +1 -0
  232. package/dist/skill-loader.js +191 -0
  233. package/dist/skill-loader.js.map +1 -0
  234. package/dist/tools/elements/builders.d.ts +24 -0
  235. package/dist/tools/elements/builders.d.ts.map +1 -0
  236. package/dist/tools/elements/builders.js +199 -0
  237. package/dist/tools/elements/builders.js.map +1 -0
  238. package/dist/tools/elements/handlers-write.d.ts +49 -0
  239. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  240. package/dist/tools/elements/handlers-write.js +148 -0
  241. package/dist/tools/elements/handlers-write.js.map +1 -0
  242. package/dist/tools/elements/handlers.d.ts +70 -0
  243. package/dist/tools/elements/handlers.d.ts.map +1 -0
  244. package/dist/tools/elements/handlers.js +292 -0
  245. package/dist/tools/elements/handlers.js.map +1 -0
  246. package/dist/tools/elements/index.d.ts +28 -0
  247. package/dist/tools/elements/index.d.ts.map +1 -0
  248. package/dist/tools/elements/index.js +27 -0
  249. package/dist/tools/elements/index.js.map +1 -0
  250. package/dist/tools/elements.d.ts +13 -0
  251. package/dist/tools/elements.d.ts.map +1 -0
  252. package/dist/tools/elements.js +13 -0
  253. package/dist/tools/elements.js.map +1 -0
  254. package/dist/tools/elicitation.d.ts +87 -0
  255. package/dist/tools/elicitation.d.ts.map +1 -0
  256. package/dist/tools/elicitation.js +100 -0
  257. package/dist/tools/elicitation.js.map +1 -0
  258. package/dist/tools/format/elements-format.d.ts +40 -0
  259. package/dist/tools/format/elements-format.d.ts.map +1 -0
  260. package/dist/tools/format/elements-format.js +194 -0
  261. package/dist/tools/format/elements-format.js.map +1 -0
  262. package/dist/tools/format/health-format.d.ts +79 -0
  263. package/dist/tools/format/health-format.d.ts.map +1 -0
  264. package/dist/tools/format/health-format.js +181 -0
  265. package/dist/tools/format/health-format.js.map +1 -0
  266. package/dist/tools/format/inspection-format.d.ts +59 -0
  267. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  268. package/dist/tools/format/inspection-format.js +303 -0
  269. package/dist/tools/format/inspection-format.js.map +1 -0
  270. package/dist/tools/format/pages-format.d.ts +57 -0
  271. package/dist/tools/format/pages-format.d.ts.map +1 -0
  272. package/dist/tools/format/pages-format.js +157 -0
  273. package/dist/tools/format/pages-format.js.map +1 -0
  274. package/dist/tools/format/sources-format.d.ts +44 -0
  275. package/dist/tools/format/sources-format.d.ts.map +1 -0
  276. package/dist/tools/format/sources-format.js +242 -0
  277. package/dist/tools/format/sources-format.js.map +1 -0
  278. package/dist/tools/health.d.ts +22 -0
  279. package/dist/tools/health.d.ts.map +1 -0
  280. package/dist/tools/health.js +220 -0
  281. package/dist/tools/health.js.map +1 -0
  282. package/dist/tools/index.d.ts +30 -0
  283. package/dist/tools/index.d.ts.map +1 -0
  284. package/dist/tools/index.js +39 -0
  285. package/dist/tools/index.js.map +1 -0
  286. package/dist/tools/inspection.d.ts +14 -0
  287. package/dist/tools/inspection.d.ts.map +1 -0
  288. package/dist/tools/inspection.js +208 -0
  289. package/dist/tools/inspection.js.map +1 -0
  290. package/dist/tools/layout-flatten.d.ts +75 -0
  291. package/dist/tools/layout-flatten.d.ts.map +1 -0
  292. package/dist/tools/layout-flatten.js +107 -0
  293. package/dist/tools/layout-flatten.js.map +1 -0
  294. package/dist/tools/multi-items/builders.d.ts +23 -0
  295. package/dist/tools/multi-items/builders.d.ts.map +1 -0
  296. package/dist/tools/multi-items/builders.js +78 -0
  297. package/dist/tools/multi-items/builders.js.map +1 -0
  298. package/dist/tools/multi-items/clean-implode-handler.d.ts +36 -0
  299. package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -0
  300. package/dist/tools/multi-items/clean-implode-handler.js +57 -0
  301. package/dist/tools/multi-items/clean-implode-handler.js.map +1 -0
  302. package/dist/tools/multi-items/index.d.ts +18 -0
  303. package/dist/tools/multi-items/index.d.ts.map +1 -0
  304. package/dist/tools/multi-items/index.js +18 -0
  305. package/dist/tools/multi-items/index.js.map +1 -0
  306. package/dist/tools/multi-items/inspect-handler.d.ts +41 -0
  307. package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -0
  308. package/dist/tools/multi-items/inspect-handler.js +50 -0
  309. package/dist/tools/multi-items/inspect-handler.js.map +1 -0
  310. package/dist/tools/multi-items/item-container-map.d.ts +41 -0
  311. package/dist/tools/multi-items/item-container-map.d.ts.map +1 -0
  312. package/dist/tools/multi-items/item-container-map.js +73 -0
  313. package/dist/tools/multi-items/item-container-map.js.map +1 -0
  314. package/dist/tools/pages/builders.d.ts +14 -0
  315. package/dist/tools/pages/builders.d.ts.map +1 -0
  316. package/dist/tools/pages/builders.js +136 -0
  317. package/dist/tools/pages/builders.js.map +1 -0
  318. package/dist/tools/pages/handlers-read.d.ts +33 -0
  319. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  320. package/dist/tools/pages/handlers-read.js +203 -0
  321. package/dist/tools/pages/handlers-read.js.map +1 -0
  322. package/dist/tools/pages/handlers-write.d.ts +21 -0
  323. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  324. package/dist/tools/pages/handlers-write.js +52 -0
  325. package/dist/tools/pages/handlers-write.js.map +1 -0
  326. package/dist/tools/pages/index.d.ts +17 -0
  327. package/dist/tools/pages/index.d.ts.map +1 -0
  328. package/dist/tools/pages/index.js +17 -0
  329. package/dist/tools/pages/index.js.map +1 -0
  330. package/dist/tools/pages/schemas.d.ts +45 -0
  331. package/dist/tools/pages/schemas.d.ts.map +1 -0
  332. package/dist/tools/pages/schemas.js +82 -0
  333. package/dist/tools/pages/schemas.js.map +1 -0
  334. package/dist/tools/pages.d.ts +13 -0
  335. package/dist/tools/pages.d.ts.map +1 -0
  336. package/dist/tools/pages.js +13 -0
  337. package/dist/tools/pages.js.map +1 -0
  338. package/dist/tools/pool-resolve-helper.d.ts +83 -0
  339. package/dist/tools/pool-resolve-helper.d.ts.map +1 -0
  340. package/dist/tools/pool-resolve-helper.js +148 -0
  341. package/dist/tools/pool-resolve-helper.js.map +1 -0
  342. package/dist/tools/progress-phases.d.ts +46 -0
  343. package/dist/tools/progress-phases.d.ts.map +1 -0
  344. package/dist/tools/progress-phases.js +48 -0
  345. package/dist/tools/progress-phases.js.map +1 -0
  346. package/dist/tools/shared-schemas.d.ts +25 -0
  347. package/dist/tools/shared-schemas.d.ts.map +1 -0
  348. package/dist/tools/shared-schemas.js +59 -0
  349. package/dist/tools/shared-schemas.js.map +1 -0
  350. package/dist/tools/sources/builders.d.ts +13 -0
  351. package/dist/tools/sources/builders.d.ts.map +1 -0
  352. package/dist/tools/sources/builders.js +118 -0
  353. package/dist/tools/sources/builders.js.map +1 -0
  354. package/dist/tools/sources/handlers-bind.d.ts +28 -0
  355. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  356. package/dist/tools/sources/handlers-bind.js +129 -0
  357. package/dist/tools/sources/handlers-bind.js.map +1 -0
  358. package/dist/tools/sources/handlers.d.ts +47 -0
  359. package/dist/tools/sources/handlers.d.ts.map +1 -0
  360. package/dist/tools/sources/handlers.js +108 -0
  361. package/dist/tools/sources/handlers.js.map +1 -0
  362. package/dist/tools/sources/index.d.ts +19 -0
  363. package/dist/tools/sources/index.d.ts.map +1 -0
  364. package/dist/tools/sources/index.js +18 -0
  365. package/dist/tools/sources/index.js.map +1 -0
  366. package/dist/tools/sources.d.ts +14 -0
  367. package/dist/tools/sources.d.ts.map +1 -0
  368. package/dist/tools/sources.js +14 -0
  369. package/dist/tools/sources.js.map +1 -0
  370. package/dist/tools/sparse-fields.d.ts +106 -0
  371. package/dist/tools/sparse-fields.d.ts.map +1 -0
  372. package/dist/tools/sparse-fields.js +165 -0
  373. package/dist/tools/sparse-fields.js.map +1 -0
  374. package/dist/tools/tool-builder/annotations.d.ts +55 -0
  375. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  376. package/dist/tools/tool-builder/annotations.js +86 -0
  377. package/dist/tools/tool-builder/annotations.js.map +1 -0
  378. package/dist/tools/tool-builder/define.d.ts +31 -0
  379. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  380. package/dist/tools/tool-builder/define.js +31 -0
  381. package/dist/tools/tool-builder/define.js.map +1 -0
  382. package/dist/tools/tool-builder/index.d.ts +28 -0
  383. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  384. package/dist/tools/tool-builder/index.js +27 -0
  385. package/dist/tools/tool-builder/index.js.map +1 -0
  386. package/dist/tools/tool-builder/results.d.ts +104 -0
  387. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  388. package/dist/tools/tool-builder/results.js +224 -0
  389. package/dist/tools/tool-builder/results.js.map +1 -0
  390. package/dist/tools/tool-builder/types.d.ts +97 -0
  391. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  392. package/dist/tools/tool-builder/types.js +9 -0
  393. package/dist/tools/tool-builder/types.js.map +1 -0
  394. package/dist/tools/tool-builder.d.ts +16 -0
  395. package/dist/tools/tool-builder.d.ts.map +1 -0
  396. package/dist/tools/tool-builder.js +16 -0
  397. package/dist/tools/tool-builder.js.map +1 -0
  398. package/manifest.json +1 -1
  399. package/package.json +2 -1
  400. package/skills/yt-builder-mcp/SKILL.md +108 -107
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
- # @wootsup/yt-builder-mcp YT Builder MCP for YOOtheme Pro (unofficial)
1
+ # @wootsup/yt-builder-mcp. YT Builder MCP for YOOtheme Pro (unofficial)
2
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.
3
+ > Drive your page builder via MCP. Built for YOOtheme Pro 4.0+ on **WordPress** and **Joomla 5/6**. Connect **Claude Desktop**, **Claude Code**, **Cursor**, **Zed**, **Continue**, **Cline**, **Roo Code**, **Codex CLI**, or **Gemini CLI** in one command.
4
4
 
5
5
  > Independent third-party project. YOOtheme® is a registered trademark of YOOtheme GmbH
6
6
  > ([yootheme.com](https://yootheme.com)). YT Builder MCP is built by WootsUp (getimo
@@ -8,20 +8,22 @@
8
8
  > The integration uses YOOtheme Pro's public extension points.
9
9
 
10
10
  **License:** MIT
11
- **Status:** Pre-alpha — under active development.
12
11
 
13
12
  ---
14
13
 
15
14
  ## Quick start
16
15
 
17
16
  ```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.
17
+ # 1. Install the host plugin for your CMS.
18
+ # WordPress: yt-builder-mcp-*.zip plugin.
19
+ # Joomla 5/6: pkg_ytbmcp-*.zip package (three sub-extensions in one go).
20
+ # See https://github.com/wootsup/yt-builder-mcp/releases
21
+
22
+ # 2. Generate a Bearer key.
23
+ # WordPress: wp-admin → Tools → "YT Builder MCP" → Bearer Keys.
24
+ # Joomla: Administrator → Components → "YT Builder MCP" → Bearer Keys.
23
25
  # Key format: ytb_(live|test)_<payloadB64Url>.<sigB64Url>
24
- # The key is shown ONCE copy it now; it cannot be recovered later.
26
+ # The key is shown ONCE. Copy it now; it cannot be recovered later.
25
27
 
26
28
  # 3. Run the wizard to configure your AI client(s):
27
29
  npx -y @wootsup/yt-builder-mcp setup
@@ -34,67 +36,66 @@ npx -y @wootsup/yt-builder-mcp install-skill
34
36
 
35
37
  The wizard prompts for:
36
38
 
37
- 1. Your WordPress site URL.
39
+ 1. Your site URL (WordPress or Joomla).
38
40
  2. The Bearer key you just generated.
39
41
  3. Which AI client(s) to configure (multi-select).
40
42
 
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_*`.
43
+ It probes the host plugin's `/health` endpoint (`/wp-json/yt-builder-mcp/v1/health`
44
+ on WordPress, `/api/index.php/v1/yt-builder-mcp/health` on Joomla) to confirm
45
+ the plugin is reachable, then `/etag` to validate the Bearer key. After restart
46
+ you should see the new tools prefixed with `yootheme_builder_*`.
45
47
 
46
- ## Supported AI clients (6)
48
+ ## Supported AI clients
47
49
 
48
50
  The wizard auto-detects and configures the following clients:
49
51
 
50
52
  | Client | Config path | Notes |
51
53
  |--------|-------------|-------|
52
54
  | Claude Desktop | `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) | DXT bundle also supported (see below) |
55
+ | Claude Code | `~/.claude.json` | |
53
56
  | Cursor | `~/.cursor/mcp.json` | |
54
- | Continue | `~/.continue/config.json` | |
55
57
  | Zed | `~/.config/zed/settings.json` | |
58
+ | Continue | `~/.continue/config.json` | |
56
59
  | Cline | `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json` | VS Code extension |
57
60
  | Roo Code | same VS Code globalStorage path under `rooveterinaryinc.roo-cline` | VS Code extension |
61
+ | Codex CLI | `~/.codex/config.toml` | |
62
+ | Gemini CLI | `~/.gemini/settings.json` | |
58
63
 
59
- ## Tool surface gateway model
64
+ ## Tool surface (gateway model)
60
65
 
61
- The server registers **24 tools total**, but only **11 entries appear
62
- in `tools/list`** (well under Cursor's ~40-tool cap):
66
+ The server registers **26 domain tools + 1 gateway = 27 reachable** tools,
67
+ of which **20 are advertised in `tools/list`** (well under Cursor's ~40-tool
68
+ cap):
63
69
 
64
70
  - **2 direct top-level tools** (always in `tools/list`):
65
- `yootheme_builder_health`, `yootheme_builder_diagnose` — the
71
+ `yootheme_builder_health`, `yootheme_builder_diagnose`. The
66
72
  "the gateway itself might be broken" escape hatch.
67
- - **8 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`, `inspect_multi_items_binding`.
71
- - **1 gateway tool** (`yootheme_builder_advanced`): exposes the
72
- remaining **13 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
- - **13 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
- clean_implode_directives, element_type_get_schema).
80
-
81
- Total: **23 domain tools + 1 gateway = 24**. Surface: **11 entries
82
- in tools/list**. See `skills/yt-builder-mcp/SKILL.md` for the
83
- full catalog and the 5 canonical workflows.
84
-
85
- ## Tool catalogue — 23 domain tools
73
+ - **17 essential forwarded tools** (always in `tools/list`): the most-used
74
+ reads and writes (`pages_list`, `get_etag`, `element_list`, `element_add`,
75
+ `element_update_settings`, `sources_list`, `element_types_list`,
76
+ `inspect_multi_items_binding`, and the multi-site `sites_list` / `sites_test`,
77
+ among others).
78
+ - **1 gateway tool** (`yootheme_builder_advanced`): exposes the remaining
79
+ **7 advanced tools** behind a single entry. Call
80
+ `yootheme_builder_advanced({ tool: "<name>" })` for discovery (returns the
81
+ schema) or `({ tool, arguments })` to execute.
82
+
83
+ See `skills/yt-builder-mcp/SKILL.md` for the full catalog and canonical
84
+ workflows, and `docs/TOOL-CATALOG.md` for an auto-generated reference.
85
+
86
+ ## Tool catalogue
86
87
 
87
88
  | Domain | Count | Tools |
88
89
  |-------------|------:|---------------------------------------------------------------------------------------------------------------------------------------------------------------------|
89
90
  | Health | 2 | `health`, `diagnose` |
90
- | Pages | 6 | `pages_list`, `page_get_layout`, `page_get_schema`, `get_etag`, `page_save`, `page_publish` |
91
+ | Sites | 2 | `sites_list`, `sites_test` |
92
+ | Pages | 7 | `pages_list`, `page_get_layout`, `page_get_schema`, `template_summary`, `get_etag`, `page_save`, `page_publish` |
91
93
  | 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
- | Multi-Items | 2 | `inspect_multi_items_binding`, `clean_implode_directives` |
94
- | Inspection | 2 | `element_types_list`, `element_type_get_schema` |
94
+ | Sources | 5 | `sources_list`, `element_get_binding`, `element_bind_source`, `element_unbind_source`, `inspect_multi_items_binding` |
95
+ | Inspection | 3 | `element_types_list`, `element_type_get_schema`, `clean_implode_directives` |
96
+ | Gateway | 1 | `advanced` |
95
97
 
96
- All tool names are prefixed with `yootheme_builder_` at the MCP
97
- server boundary.
98
+ All tool names are prefixed with `yootheme_builder_` at the MCP server boundary.
98
99
 
99
100
  ## Subcommands
100
101
 
@@ -105,7 +106,7 @@ yt-builder-mcp --version, -v Print package version.
105
106
  yt-builder-mcp --help, -h Show usage.
106
107
  ```
107
108
 
108
- ### `install-skill` bundled agent skill
109
+ ### `install-skill` (bundled agent skill)
109
110
 
110
111
  Copies the bundled `skills/yootheme-builder/` folder into
111
112
  `~/.claude/skills/` and appends a marker block to `~/AGENTS.md` so
@@ -121,10 +122,10 @@ The skill ships with the 5 canonical workflows (build hero, bind
121
122
  source, clone section, diagnose 401, add custom element) plus a
122
123
  23-tool auto-generated catalog appendix.
123
124
 
124
- ## DXT bundle Claude Desktop one-click install
125
+ ## DXT bundle (Claude Desktop one-click install)
125
126
 
126
127
  The repo includes a `manifest.json` and `scripts/build-dxt.js` that
127
- produces a `yt-builder-mcp.dxt` archive the
128
+ produces a `yt-builder-mcp.dxt` archive, the
128
129
  [Desktop Extension](https://github.com/anthropics/dxt) format used
129
130
  by Claude Desktop for one-click MCP installs. Build it from a
130
131
  source checkout:
@@ -145,8 +146,8 @@ When launched by an AI client (or directly):
145
146
  | Variable | Required? | Purpose |
146
147
  |----------|-----------|---------|
147
148
  | `YTB_MCP_SITE_URL` | Yes | Host CMS base URL (e.g. `https://example.com`). Works for BOTH WordPress and Joomla. Trailing slash is stripped. |
148
- | `YTB_MCP_WP_URL` | No (deprecated) | Legacy alias for `YTB_MCP_SITE_URL`; still honoured for pre-Wave-7 configurations. A non-fatal deprecation notice is written to stderr when this is used without `YTB_MCP_SITE_URL`. |
149
- | `YTB_MCP_BEARER_TOKEN` | Yes | Bearer key from wp-admin (WordPress: Tools → "YT Builder MCP") or Administrator → Components → "YT Builder MCP" (Joomla). Format-checked client-side: must match `ytb_(live\|test)_<payload>.<sig>`. Do **not** prepend `Bearer ` the MCP server adds it. |
149
+ | `YTB_MCP_WP_URL` | No (deprecated) | Legacy alias for `YTB_MCP_SITE_URL`. Still honoured for older WordPress-only configurations. A non-fatal deprecation notice is written to stderr when this is used without `YTB_MCP_SITE_URL`. |
150
+ | `YTB_MCP_BEARER_TOKEN` | Yes | Bearer key from wp-admin (WordPress: Tools → "YT Builder MCP") or Administrator → Components → "YT Builder MCP" (Joomla). Format-checked client-side: must match `ytb_(live\|test)_<payload>.<sig>`. Do **not** prepend `Bearer `. The MCP server adds it. |
150
151
  | `YTB_MCP_PLATFORM` | No | Explicit platform hint: `wordpress` or `joomla`. Set to `joomla` when `YTB_MCP_SITE_URL` is an origin-only Joomla URL (no `/api/index.php/` in the path). Defaults to URL-shape auto-detection. |
151
152
  | `YTB_MCP_TIMEOUT_MS` | No | REST timeout (default 15000). |
152
153
  | `YTB_MCP_TEST_MODE` | No | `1` skips the stdio loop (smoke tests). |
@@ -200,12 +201,12 @@ Supported flags:
200
201
  | Flag | Required? | Description |
201
202
  |------|-----------|-------------|
202
203
  | `--non-interactive` | Yes | Opt-in to non-interactive mode (no prompts). |
203
- | `--url <wp-url>` | Yes | WordPress base URL; trailing slash is stripped. |
204
- | `--token <bearer>` | Yes | Bearer key from wp-admin (do not prepend `Bearer `). |
205
- | `--client <id>` | Yes (≥1) | Client id; repeatable. Valid ids: `claude-desktop`, `cursor`, `zed`, `continue`, `cline`, `roo-code`. |
204
+ | `--url <site-url>` | Yes | Site base URL (WordPress or Joomla). Trailing slash is stripped. |
205
+ | `--token <bearer>` | Yes | Bearer key from the host plugin's admin UI (do not prepend `Bearer `). |
206
+ | `--client <id>` | Yes (≥1) | Client id; repeatable. Valid ids: `claude-desktop`, `claude-code`, `cursor`, `zed`, `continue`, `cline`, `roo-code`, `codex-cli`, `gemini-cli`. |
206
207
 
207
208
  The wizard still runs its plugin-health + auth probes and uses the
208
- exit codes documented in the table below so CI can branch on the
209
+ exit codes documented in the table below, so CI can branch on the
209
210
  exit code to detect whether the install actually succeeded.
210
211
 
211
212
  ## Exit codes (CLI)
@@ -225,7 +226,7 @@ The CLI returns POSIX-style exit codes for scripting / CI:
225
226
 
226
227
  ## Documentation
227
228
 
228
- - [SKILL.md (bundled agent skill)](./skills/yt-builder-mcp/SKILL.md) 5 canonical workflows, gateway model, tool catalog
229
+ - [SKILL.md (bundled agent skill)](./skills/yt-builder-mcp/SKILL.md): 5 canonical workflows, gateway model, tool catalog
229
230
  - [REST API Reference](https://github.com/wootsup/yt-builder-mcp/blob/main/docs/rest-api-reference.md)
230
231
  - [MCP Tool Reference](https://github.com/wootsup/yt-builder-mcp/blob/main/docs/mcp-tool-reference.md)
231
232
 
package/dist/auth.d.ts ADDED
@@ -0,0 +1,119 @@
1
+ /**
2
+ * Auth / configuration loading for the MCP server.
3
+ *
4
+ * The MCP server reads two environment variables on startup:
5
+ *
6
+ * YTB_MCP_SITE_URL — base URL of the host CMS install (WordPress
7
+ * OR Joomla), e.g. `https://example.com`.
8
+ * The per-platform REST namespace
9
+ * (`/wp-json/yt-builder-mcp/v1` for WP,
10
+ * `/api/index.php/v1/yt-builder-mcp` for
11
+ * Joomla) is appended internally based on
12
+ * runtime platform detection.
13
+ * YTB_MCP_WP_URL — DEPRECATED alias for YTB_MCP_SITE_URL,
14
+ * kept for back-compat with pre-Wave 7
15
+ * configurations. A non-fatal deprecation
16
+ * notice is written to stderr when the
17
+ * legacy var is used in non-test mode.
18
+ * YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
19
+ * Settings page (`wp-admin → YT Builder MCP`
20
+ * on WordPress, `Components → YT Builder MCP`
21
+ * on Joomla).
22
+ *
23
+ * `loadConfig()` throws `ConfigError` if either is missing, so the
24
+ * server fails fast with a useful message rather than emitting cryptic
25
+ * 401/Network errors deep in the request stack.
26
+ *
27
+ * @license MIT
28
+ */
29
+ import { SiteRegistry } from './sites/registry.js';
30
+ export interface ServerConfig {
31
+ /** Base URL of the host-CMS install (no trailing slash). */
32
+ readonly baseUrl: string;
33
+ /** Bearer key. */
34
+ readonly bearerToken: string;
35
+ /** Network timeout (ms) for REST calls. */
36
+ readonly timeoutMs: number;
37
+ /**
38
+ * Optional explicit platform hint from {@link ENV_PLATFORM}.
39
+ * `undefined` lets the consumer rely on URL-shape detection.
40
+ */
41
+ readonly platformHint?: 'wordpress' | 'joomla';
42
+ }
43
+ export interface LoadConfigOptions {
44
+ /** Allow the bearer-token to be empty (for health-only smoke tests). */
45
+ readonly allowMissingToken?: boolean;
46
+ /** Source of env vars (defaults to process.env). */
47
+ readonly env?: NodeJS.ProcessEnv;
48
+ }
49
+ /**
50
+ * Canonical env-var name for the host-CMS base URL (Wave 7+: covers
51
+ * both WordPress and Joomla). Prefer this for all new configurations.
52
+ */
53
+ export declare const ENV_SITE_URL = "YTB_MCP_SITE_URL";
54
+ /**
55
+ * Legacy env-var name kept for back-compat. Pre-Wave-7 configurations
56
+ * (every release through v1.0.x) used `YTB_MCP_WP_URL`. New code should
57
+ * use {@link ENV_SITE_URL}; this constant is retained so the wizard,
58
+ * tests, and error hints can still reference the legacy name.
59
+ */
60
+ export declare const ENV_WP_URL = "YTB_MCP_WP_URL";
61
+ export declare const ENV_BEARER = "YTB_MCP_BEARER_TOKEN";
62
+ export declare const ENV_TIMEOUT = "YTB_MCP_TIMEOUT_MS";
63
+ export declare const ENV_TEST_MODE = "YTB_MCP_TEST_MODE";
64
+ /**
65
+ * Optional platform hint env var — `'wordpress'` or `'joomla'`. When
66
+ * unset, the server auto-detects from the URL shape (cookbook §3.7.1):
67
+ * - URL contains `/wp-json/` → wordpress
68
+ * - URL contains `/api/index.php/` → joomla
69
+ * - origin-only URL → defaults to wordpress (back-compat)
70
+ *
71
+ * Set this to `'joomla'` when your YTB_MCP_SITE_URL is an origin-only
72
+ * Joomla URL like `https://example.com/joomla`.
73
+ */
74
+ export declare const ENV_PLATFORM = "YTB_MCP_PLATFORM";
75
+ /**
76
+ * W10 — canonical env-var name for the multi-site registry file. When
77
+ * set, {@link loadRegistry} loads + validates the JSON at this path and
78
+ * the legacy {@link ENV_SITE_URL} / {@link ENV_BEARER} pair is ignored.
79
+ * When unset, the env-bridge falls back to building a one-site registry
80
+ * from the legacy single-site pair.
81
+ */
82
+ export declare const ENV_SITES_FILE = "YTB_MCP_SITES_FILE";
83
+ export declare function loadConfig(options?: LoadConfigOptions): ServerConfig;
84
+ export declare function isTestMode(env?: NodeJS.ProcessEnv): boolean;
85
+ /**
86
+ * Options accepted by {@link loadRegistry}.
87
+ */
88
+ export interface LoadRegistryOptions {
89
+ /** Source of env vars (defaults to process.env). */
90
+ readonly env?: NodeJS.ProcessEnv;
91
+ }
92
+ /**
93
+ * W10 — canonical boot-time registry loader.
94
+ *
95
+ * Resolution order:
96
+ * 1. **Sites file** — if {@link ENV_SITES_FILE} is set to a non-empty
97
+ * string, parse + validate the JSON at that path and wrap it in a
98
+ * {@link SiteRegistry}. Schema failures bubble up as
99
+ * `SitesFileError` (the store does not swallow them); the caller
100
+ * decides whether to fail-fast or fall back. Wave 10 chooses
101
+ * fail-fast — explicit file = explicit intent.
102
+ *
103
+ * 2. **Legacy env-bridge** — synthesise a one-site registry from the
104
+ * pre-W10 single-site env-vars ({@link ENV_SITE_URL} +
105
+ * {@link ENV_BEARER}, with {@link ENV_PLATFORM} as optional hint).
106
+ * Preserves the single-site UX for every customer who has not
107
+ * migrated to a sites.json yet.
108
+ *
109
+ * 3. **Hard fail** — neither configured. Surface a {@link ConfigError}
110
+ * with the three setup options so the operator knows exactly which
111
+ * knob to turn.
112
+ *
113
+ * This function replaces {@link loadConfig} on the main boot path.
114
+ * `loadConfig` is intentionally retained for the test-mode fallback in
115
+ * `index.ts` (`--test-mode` smoke probes) and for any embedded consumer
116
+ * that still wants a flat `ServerConfig`.
117
+ */
118
+ export declare function loadRegistry(opts?: LoadRegistryOptions): Promise<SiteRegistry>;
119
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,WAAW,YAAY;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAClD;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;;;GAGG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,uBAAuB,CAAC;AAkCnD,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,YAAY,CA8ExE;AAED,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExE;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAC9B,IAAI,GAAE,mBAAwB,GAC/B,OAAO,CAAC,YAAY,CAAC,CA8CvB"}
package/dist/auth.js ADDED
@@ -0,0 +1,226 @@
1
+ /**
2
+ * Auth / configuration loading for the MCP server.
3
+ *
4
+ * The MCP server reads two environment variables on startup:
5
+ *
6
+ * YTB_MCP_SITE_URL — base URL of the host CMS install (WordPress
7
+ * OR Joomla), e.g. `https://example.com`.
8
+ * The per-platform REST namespace
9
+ * (`/wp-json/yt-builder-mcp/v1` for WP,
10
+ * `/api/index.php/v1/yt-builder-mcp` for
11
+ * Joomla) is appended internally based on
12
+ * runtime platform detection.
13
+ * YTB_MCP_WP_URL — DEPRECATED alias for YTB_MCP_SITE_URL,
14
+ * kept for back-compat with pre-Wave 7
15
+ * configurations. A non-fatal deprecation
16
+ * notice is written to stderr when the
17
+ * legacy var is used in non-test mode.
18
+ * YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
19
+ * Settings page (`wp-admin → YT Builder MCP`
20
+ * on WordPress, `Components → YT Builder MCP`
21
+ * on Joomla).
22
+ *
23
+ * `loadConfig()` throws `ConfigError` if either is missing, so the
24
+ * server fails fast with a useful message rather than emitting cryptic
25
+ * 401/Network errors deep in the request stack.
26
+ *
27
+ * @license MIT
28
+ */
29
+ import { z } from 'zod';
30
+ import { ConfigError } from './errors.js';
31
+ import { synthesiseFromEnv } from './sites/env-bridge.js';
32
+ import { SiteRegistry } from './sites/registry.js';
33
+ import { SitesFile } from './sites/schema.js';
34
+ import { loadSitesFile } from './sites/store.js';
35
+ /**
36
+ * Canonical env-var name for the host-CMS base URL (Wave 7+: covers
37
+ * both WordPress and Joomla). Prefer this for all new configurations.
38
+ */
39
+ export const ENV_SITE_URL = 'YTB_MCP_SITE_URL';
40
+ /**
41
+ * Legacy env-var name kept for back-compat. Pre-Wave-7 configurations
42
+ * (every release through v1.0.x) used `YTB_MCP_WP_URL`. New code should
43
+ * use {@link ENV_SITE_URL}; this constant is retained so the wizard,
44
+ * tests, and error hints can still reference the legacy name.
45
+ */
46
+ export const ENV_WP_URL = 'YTB_MCP_WP_URL';
47
+ export const ENV_BEARER = 'YTB_MCP_BEARER_TOKEN';
48
+ export const ENV_TIMEOUT = 'YTB_MCP_TIMEOUT_MS';
49
+ export const ENV_TEST_MODE = 'YTB_MCP_TEST_MODE';
50
+ /**
51
+ * Optional platform hint env var — `'wordpress'` or `'joomla'`. When
52
+ * unset, the server auto-detects from the URL shape (cookbook §3.7.1):
53
+ * - URL contains `/wp-json/` → wordpress
54
+ * - URL contains `/api/index.php/` → joomla
55
+ * - origin-only URL → defaults to wordpress (back-compat)
56
+ *
57
+ * Set this to `'joomla'` when your YTB_MCP_SITE_URL is an origin-only
58
+ * Joomla URL like `https://example.com/joomla`.
59
+ */
60
+ export const ENV_PLATFORM = 'YTB_MCP_PLATFORM';
61
+ /**
62
+ * W10 — canonical env-var name for the multi-site registry file. When
63
+ * set, {@link loadRegistry} loads + validates the JSON at this path and
64
+ * the legacy {@link ENV_SITE_URL} / {@link ENV_BEARER} pair is ignored.
65
+ * When unset, the env-bridge falls back to building a one-site registry
66
+ * from the legacy single-site pair.
67
+ */
68
+ export const ENV_SITES_FILE = 'YTB_MCP_SITES_FILE';
69
+ const DEFAULT_TIMEOUT_MS = 15_000;
70
+ /**
71
+ * Maximum accepted length for a Bearer token (defense-in-depth bound;
72
+ * the real plugin keys are ~150-300 bytes, the 512 ceiling protects
73
+ * against accidental file-pastes / log dumps / memory abuse).
74
+ */
75
+ const BEARER_MAX_LEN = 512;
76
+ /**
77
+ * Bearer-token format check — matches the plugin's `KeyService.php`
78
+ * `PREFIX = ytb_live_` (and the planned `ytb_test_` future variant).
79
+ * Token shape: `ytb_(live|test)_<payloadB64Url>.<sigB64Url>` where
80
+ * base64url uses `[A-Za-z0-9_-]` (no dots inside the payload or sig).
81
+ *
82
+ * Round-1 audit I7 fix (2026-05-22): the earlier `.trim()` + empty-check
83
+ * was not enough to catch the most common config mistakes — the leading
84
+ * `Bearer ` prefix accidentally pasted into the env var, copy-paste
85
+ * truncation (no `.` separator), or a totally wrong token style. We
86
+ * fail-fast here so the client never sends a known-bad value upstream.
87
+ */
88
+ const BEARER_FORMAT_SCHEMA = z
89
+ .string()
90
+ .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.`)
91
+ .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 ").');
92
+ export function loadConfig(options = {}) {
93
+ const env = options.env ?? process.env;
94
+ // Wave 7: YTB_MCP_SITE_URL is canonical (covers both WP + Joomla);
95
+ // YTB_MCP_WP_URL is retained as a deprecated back-compat alias.
96
+ // Resolution order: SITE_URL wins; legacy WP_URL fallback emits a
97
+ // soft deprecation note in non-test mode.
98
+ const rawSiteUrl = (env[ENV_SITE_URL] ?? '').trim();
99
+ const rawLegacyUrl = (env[ENV_WP_URL] ?? '').trim();
100
+ const rawUrl = rawSiteUrl !== '' ? rawSiteUrl : rawLegacyUrl;
101
+ // Soft deprecation notice — only when the loader is being used in
102
+ // its real-server role (env defaulted to process.env). Programmatic
103
+ // callers (tests, embedded uses) pass `options.env` explicitly and
104
+ // are silently treated as opt-in to the legacy var.
105
+ if (rawSiteUrl === ''
106
+ && rawLegacyUrl !== ''
107
+ && options.env === undefined
108
+ && !isTestMode(env)) {
109
+ process.stderr.write(`[yt-builder-mcp] notice: ${ENV_WP_URL} is deprecated — ` +
110
+ `set ${ENV_SITE_URL} instead (same value; covers WordPress + Joomla).\n`);
111
+ }
112
+ const rawToken = (env[ENV_BEARER] ?? '').trim();
113
+ const rawTimeout = (env[ENV_TIMEOUT] ?? '').trim();
114
+ if (rawUrl === '') {
115
+ throw new ConfigError(`Missing ${ENV_SITE_URL}. Set it to your CMS base URL ` +
116
+ '(e.g. https://example.com — WordPress or Joomla). ' +
117
+ 'Run `yt-builder-mcp setup` to configure.');
118
+ }
119
+ if (!options.allowMissingToken && rawToken === '') {
120
+ throw new ConfigError(`Missing ${ENV_BEARER}. Generate a Bearer key in wp-admin → "YT Builder MCP" → ` +
121
+ 'Settings, then run `yt-builder-mcp setup`.');
122
+ }
123
+ // I7-fix: enforce the Bearer-format contract before the client
124
+ // makes any request. Empty token is allowed only via
125
+ // `allowMissingToken` (the health-only smoke path); any other
126
+ // non-empty value MUST match the plugin's KeyService format.
127
+ if (rawToken !== '') {
128
+ const parsed = BEARER_FORMAT_SCHEMA.safeParse(rawToken);
129
+ if (!parsed.success) {
130
+ const issueMsg = parsed.error.issues
131
+ .map((iss) => iss.message)
132
+ .join(' ');
133
+ throw new ConfigError(`Invalid ${ENV_BEARER}: ${issueMsg}`);
134
+ }
135
+ }
136
+ let timeoutMs = DEFAULT_TIMEOUT_MS;
137
+ if (rawTimeout !== '') {
138
+ const parsed = Number.parseInt(rawTimeout, 10);
139
+ if (Number.isFinite(parsed) && parsed > 0) {
140
+ timeoutMs = parsed;
141
+ }
142
+ }
143
+ const rawPlatform = (env[ENV_PLATFORM] ?? '').trim().toLowerCase();
144
+ const platformHint = rawPlatform === 'wordpress' || rawPlatform === 'joomla'
145
+ ? rawPlatform
146
+ : undefined;
147
+ return {
148
+ baseUrl: stripTrailingSlash(rawUrl),
149
+ bearerToken: rawToken,
150
+ timeoutMs,
151
+ ...(platformHint !== undefined ? { platformHint } : {}),
152
+ };
153
+ }
154
+ export function isTestMode(env = process.env) {
155
+ return (env[ENV_TEST_MODE] ?? '') === '1';
156
+ }
157
+ function stripTrailingSlash(url) {
158
+ return url.replace(/\/+$/, '');
159
+ }
160
+ /**
161
+ * W10 — canonical boot-time registry loader.
162
+ *
163
+ * Resolution order:
164
+ * 1. **Sites file** — if {@link ENV_SITES_FILE} is set to a non-empty
165
+ * string, parse + validate the JSON at that path and wrap it in a
166
+ * {@link SiteRegistry}. Schema failures bubble up as
167
+ * `SitesFileError` (the store does not swallow them); the caller
168
+ * decides whether to fail-fast or fall back. Wave 10 chooses
169
+ * fail-fast — explicit file = explicit intent.
170
+ *
171
+ * 2. **Legacy env-bridge** — synthesise a one-site registry from the
172
+ * pre-W10 single-site env-vars ({@link ENV_SITE_URL} +
173
+ * {@link ENV_BEARER}, with {@link ENV_PLATFORM} as optional hint).
174
+ * Preserves the single-site UX for every customer who has not
175
+ * migrated to a sites.json yet.
176
+ *
177
+ * 3. **Hard fail** — neither configured. Surface a {@link ConfigError}
178
+ * with the three setup options so the operator knows exactly which
179
+ * knob to turn.
180
+ *
181
+ * This function replaces {@link loadConfig} on the main boot path.
182
+ * `loadConfig` is intentionally retained for the test-mode fallback in
183
+ * `index.ts` (`--test-mode` smoke probes) and for any embedded consumer
184
+ * that still wants a flat `ServerConfig`.
185
+ */
186
+ export async function loadRegistry(opts = {}) {
187
+ const env = opts.env ?? process.env;
188
+ // (1) sites file (preferred).
189
+ const sitesFilePath = (env[ENV_SITES_FILE] ?? '').trim();
190
+ if (sitesFilePath !== '') {
191
+ // loadSitesFile handles both "file present" and "file absent"
192
+ // (the latter returns an emptySitesFile). When the file is
193
+ // empty (no sites), fall through to env-bridge instead of
194
+ // booting with an empty registry — operators who set
195
+ // SITES_FILE to a not-yet-populated path should still get the
196
+ // legacy env-var ramp until they run `add-site`.
197
+ const file = await loadSitesFile(sitesFilePath);
198
+ if (file.sites.length > 0) {
199
+ return new SiteRegistry(file);
200
+ }
201
+ }
202
+ // (2) legacy env-bridge. The bridge already enforces URL/bearer
203
+ // non-emptiness and platform-hint validity, but we re-validate the
204
+ // full file shape through the W1 Zod schema before handing it to
205
+ // the registry. Defense-in-depth: a future env-bridge change cannot
206
+ // introduce a SitesFileT-shape regression that lands on the
207
+ // registry path without first failing this gate.
208
+ const synth = synthesiseFromEnv(env);
209
+ if (synth !== null) {
210
+ const parsed = SitesFile.safeParse(synth);
211
+ if (!parsed.success) {
212
+ const issues = parsed.error.issues
213
+ .map((i) => `${i.path.join('.')}: ${i.message}`)
214
+ .join('; ');
215
+ throw new ConfigError(`Env-bridge synthesised an invalid sites file: ${issues}`);
216
+ }
217
+ return new SiteRegistry(parsed.data);
218
+ }
219
+ // (3) fail-fast.
220
+ throw new ConfigError('No sites configured. Either: '
221
+ + '(a) set YTB_MCP_SITES_FILE to your sites.json path, or '
222
+ + '(b) set YTB_MCP_SITE_URL + YTB_MCP_BEARER_TOKEN for '
223
+ + 'single-site mode, or '
224
+ + '(c) run `npx -y @wootsup/yt-builder-mcp setup` interactively.');
225
+ }
226
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAuBjD;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC/C;;;;;GAKG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAC3C,MAAM,CAAC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AACjD,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAC;AAChD,MAAM,CAAC,MAAM,aAAa,GAAG,mBAAmB,CAAC;AACjD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,kBAAkB,CAAC;AAC/C;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,oBAAoB,CAAC;AAEnD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;;GAIG;AACH,MAAM,cAAc,GAAG,GAAG,CAAC;AAE3B;;;;;;;;;;;GAWG;AACH,MAAM,oBAAoB,GAAG,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I,EAAE,CAAC;QACjB,MAAM,MAAM,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC1C,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM;iBAC7B,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;iBAC/C,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,MAAM,IAAI,WAAW,CACjB,iDAAiD,MAAM,EAAE,CAC5D,CAAC;QACN,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB;IACjB,MAAM,IAAI,WAAW,CACjB,+BAA+B;UAC7B,yDAAyD;UACzD,sDAAsD;UACtD,uBAAuB;UACvB,+DAA+D,CACpE,CAAC;AACN,CAAC"}
@@ -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,M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