@wootsup/yt-builder-mcp 1.1.6 → 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 (397) hide show
  1. package/dist/auth.d.ts +119 -0
  2. package/dist/auth.d.ts.map +1 -0
  3. package/dist/auth.js +226 -0
  4. package/dist/auth.js.map +1 -0
  5. package/dist/client.d.ts +84 -0
  6. package/dist/client.d.ts.map +1 -0
  7. package/dist/client.js +151 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/clients/claude-code.d.ts +18 -0
  10. package/dist/clients/claude-code.d.ts.map +1 -0
  11. package/dist/clients/claude-code.js +53 -0
  12. package/dist/clients/claude-code.js.map +1 -0
  13. package/dist/clients/claude-desktop.d.ts +19 -0
  14. package/dist/clients/claude-desktop.d.ts.map +1 -0
  15. package/dist/clients/claude-desktop.js +56 -0
  16. package/dist/clients/claude-desktop.js.map +1 -0
  17. package/dist/clients/cline.d.ts +26 -0
  18. package/dist/clients/cline.d.ts.map +1 -0
  19. package/dist/clients/cline.js +80 -0
  20. package/dist/clients/cline.js.map +1 -0
  21. package/dist/clients/codex-cli.d.ts +42 -0
  22. package/dist/clients/codex-cli.d.ts.map +1 -0
  23. package/dist/clients/codex-cli.js +194 -0
  24. package/dist/clients/codex-cli.js.map +1 -0
  25. package/dist/clients/continue.d.ts +13 -0
  26. package/dist/clients/continue.d.ts.map +1 -0
  27. package/dist/clients/continue.js +52 -0
  28. package/dist/clients/continue.js.map +1 -0
  29. package/dist/clients/cursor.d.ts +12 -0
  30. package/dist/clients/cursor.d.ts.map +1 -0
  31. package/dist/clients/cursor.js +38 -0
  32. package/dist/clients/cursor.js.map +1 -0
  33. package/dist/clients/gemini-cli.d.ts +18 -0
  34. package/dist/clients/gemini-cli.d.ts.map +1 -0
  35. package/dist/clients/gemini-cli.js +44 -0
  36. package/dist/clients/gemini-cli.js.map +1 -0
  37. package/dist/clients/home.d.ts +14 -0
  38. package/dist/clients/home.d.ts.map +1 -0
  39. package/dist/clients/home.js +20 -0
  40. package/dist/clients/home.js.map +1 -0
  41. package/dist/clients/index.d.ts +52 -0
  42. package/dist/clients/index.d.ts.map +1 -0
  43. package/dist/clients/index.js +72 -0
  44. package/dist/clients/index.js.map +1 -0
  45. package/dist/clients/roo-code.d.ts +23 -0
  46. package/dist/clients/roo-code.d.ts.map +1 -0
  47. package/dist/clients/roo-code.js +69 -0
  48. package/dist/clients/roo-code.js.map +1 -0
  49. package/dist/clients/zed.d.ts +12 -0
  50. package/dist/clients/zed.d.ts.map +1 -0
  51. package/dist/clients/zed.js +41 -0
  52. package/dist/clients/zed.js.map +1 -0
  53. package/dist/errors/hints.d.ts +51 -0
  54. package/dist/errors/hints.d.ts.map +1 -0
  55. package/dist/errors/hints.js +95 -0
  56. package/dist/errors/hints.js.map +1 -0
  57. package/dist/errors/mask.d.ts +35 -0
  58. package/dist/errors/mask.d.ts.map +1 -0
  59. package/dist/errors/mask.js +49 -0
  60. package/dist/errors/mask.js.map +1 -0
  61. package/dist/errors/sanitize.d.ts +31 -0
  62. package/dist/errors/sanitize.d.ts.map +1 -0
  63. package/dist/errors/sanitize.js +100 -0
  64. package/dist/errors/sanitize.js.map +1 -0
  65. package/dist/errors.d.ts +42 -0
  66. package/dist/errors.d.ts.map +1 -0
  67. package/dist/errors.js +61 -0
  68. package/dist/errors.js.map +1 -0
  69. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  70. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  71. package/dist/gateway/advanced-tool/discovery.js +53 -0
  72. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  73. package/dist/gateway/advanced-tool/domains.d.ts +47 -0
  74. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  75. package/dist/gateway/advanced-tool/domains.js +94 -0
  76. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  77. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  78. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  79. package/dist/gateway/advanced-tool/execute.js +54 -0
  80. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  81. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  82. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  83. package/dist/gateway/advanced-tool/index.js +39 -0
  84. package/dist/gateway/advanced-tool/index.js.map +1 -0
  85. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  86. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  87. package/dist/gateway/advanced-tool/register.js +69 -0
  88. package/dist/gateway/advanced-tool/register.js.map +1 -0
  89. package/dist/gateway/advanced-tool.d.ts +13 -0
  90. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  91. package/dist/gateway/advanced-tool.js +13 -0
  92. package/dist/gateway/advanced-tool.js.map +1 -0
  93. package/dist/gateway/capturing-server.d.ts +117 -0
  94. package/dist/gateway/capturing-server.d.ts.map +1 -0
  95. package/dist/gateway/capturing-server.js +103 -0
  96. package/dist/gateway/capturing-server.js.map +1 -0
  97. package/dist/gateway/essentials.d.ts +50 -0
  98. package/dist/gateway/essentials.d.ts.map +1 -0
  99. package/dist/gateway/essentials.js +94 -0
  100. package/dist/gateway/essentials.js.map +1 -0
  101. package/dist/gateway/test-support.d.ts +41 -0
  102. package/dist/gateway/test-support.d.ts.map +1 -0
  103. package/dist/gateway/test-support.js +60 -0
  104. package/dist/gateway/test-support.js.map +1 -0
  105. package/dist/index.d.ts +29 -0
  106. package/dist/index.d.ts.map +1 -0
  107. package/dist/index.js +111 -0
  108. package/dist/index.js.map +1 -0
  109. package/dist/install-skill.d.ts +43 -0
  110. package/dist/install-skill.d.ts.map +1 -0
  111. package/dist/install-skill.js +118 -0
  112. package/dist/install-skill.js.map +1 -0
  113. package/dist/platform/detect.d.ts +64 -0
  114. package/dist/platform/detect.d.ts.map +1 -0
  115. package/dist/platform/detect.js +98 -0
  116. package/dist/platform/detect.js.map +1 -0
  117. package/dist/platform/index.d.ts +121 -0
  118. package/dist/platform/index.d.ts.map +1 -0
  119. package/dist/platform/index.js +176 -0
  120. package/dist/platform/index.js.map +1 -0
  121. package/dist/platform/joomla.d.ts +44 -0
  122. package/dist/platform/joomla.d.ts.map +1 -0
  123. package/dist/platform/joomla.js +46 -0
  124. package/dist/platform/joomla.js.map +1 -0
  125. package/dist/server.d.ts +110 -0
  126. package/dist/server.d.ts.map +1 -0
  127. package/dist/server.js +274 -0
  128. package/dist/server.js.map +1 -0
  129. package/dist/setup-cli-confirm.d.ts +36 -0
  130. package/dist/setup-cli-confirm.d.ts.map +1 -0
  131. package/dist/setup-cli-confirm.js +59 -0
  132. package/dist/setup-cli-confirm.js.map +1 -0
  133. package/dist/setup-cli.d.ts +152 -0
  134. package/dist/setup-cli.d.ts.map +1 -0
  135. package/dist/setup-cli.js +870 -0
  136. package/dist/setup-cli.js.map +1 -0
  137. package/dist/setup-prompts.d.ts +41 -0
  138. package/dist/setup-prompts.d.ts.map +1 -0
  139. package/dist/setup-prompts.js +146 -0
  140. package/dist/setup-prompts.js.map +1 -0
  141. package/dist/setup-token.d.ts +38 -0
  142. package/dist/setup-token.d.ts.map +1 -0
  143. package/dist/setup-token.js +106 -0
  144. package/dist/setup-token.js.map +1 -0
  145. package/dist/setup-wizard-defaults.d.ts +43 -0
  146. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  147. package/dist/setup-wizard-defaults.js +160 -0
  148. package/dist/setup-wizard-defaults.js.map +1 -0
  149. package/dist/setup-wizard-handshake.d.ts +25 -0
  150. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  151. package/dist/setup-wizard-handshake.js +103 -0
  152. package/dist/setup-wizard-handshake.js.map +1 -0
  153. package/dist/setup-wizard-types.d.ts +164 -0
  154. package/dist/setup-wizard-types.d.ts.map +1 -0
  155. package/dist/setup-wizard-types.js +11 -0
  156. package/dist/setup-wizard-types.js.map +1 -0
  157. package/dist/setup-wizard.d.ts +33 -0
  158. package/dist/setup-wizard.d.ts.map +1 -0
  159. package/dist/setup-wizard.js +199 -0
  160. package/dist/setup-wizard.js.map +1 -0
  161. package/dist/setup.d.ts +17 -0
  162. package/dist/setup.d.ts.map +1 -0
  163. package/dist/setup.js +33 -0
  164. package/dist/setup.js.map +1 -0
  165. package/dist/sites/cli/add-site.d.ts +106 -0
  166. package/dist/sites/cli/add-site.d.ts.map +1 -0
  167. package/dist/sites/cli/add-site.js +185 -0
  168. package/dist/sites/cli/add-site.js.map +1 -0
  169. package/dist/sites/cli/list-sites.d.ts +40 -0
  170. package/dist/sites/cli/list-sites.d.ts.map +1 -0
  171. package/dist/sites/cli/list-sites.js +116 -0
  172. package/dist/sites/cli/list-sites.js.map +1 -0
  173. package/dist/sites/cli/remove-site.d.ts +60 -0
  174. package/dist/sites/cli/remove-site.d.ts.map +1 -0
  175. package/dist/sites/cli/remove-site.js +120 -0
  176. package/dist/sites/cli/remove-site.js.map +1 -0
  177. package/dist/sites/cli/set-default.d.ts +47 -0
  178. package/dist/sites/cli/set-default.d.ts.map +1 -0
  179. package/dist/sites/cli/set-default.js +69 -0
  180. package/dist/sites/cli/set-default.js.map +1 -0
  181. package/dist/sites/cli/test-site.d.ts +77 -0
  182. package/dist/sites/cli/test-site.d.ts.map +1 -0
  183. package/dist/sites/cli/test-site.js +146 -0
  184. package/dist/sites/cli/test-site.js.map +1 -0
  185. package/dist/sites/client-pool.d.ts +124 -0
  186. package/dist/sites/client-pool.d.ts.map +1 -0
  187. package/dist/sites/client-pool.js +172 -0
  188. package/dist/sites/client-pool.js.map +1 -0
  189. package/dist/sites/env-bridge.d.ts +55 -0
  190. package/dist/sites/env-bridge.d.ts.map +1 -0
  191. package/dist/sites/env-bridge.js +94 -0
  192. package/dist/sites/env-bridge.js.map +1 -0
  193. package/dist/sites/paths.d.ts +21 -0
  194. package/dist/sites/paths.d.ts.map +1 -0
  195. package/dist/sites/paths.js +37 -0
  196. package/dist/sites/paths.js.map +1 -0
  197. package/dist/sites/probe.d.ts +60 -0
  198. package/dist/sites/probe.d.ts.map +1 -0
  199. package/dist/sites/probe.js +112 -0
  200. package/dist/sites/probe.js.map +1 -0
  201. package/dist/sites/registry.d.ts +142 -0
  202. package/dist/sites/registry.d.ts.map +1 -0
  203. package/dist/sites/registry.js +163 -0
  204. package/dist/sites/registry.js.map +1 -0
  205. package/dist/sites/schema.d.ts +90 -0
  206. package/dist/sites/schema.d.ts.map +1 -0
  207. package/dist/sites/schema.js +71 -0
  208. package/dist/sites/schema.js.map +1 -0
  209. package/dist/sites/secret-resolver.d.ts +115 -0
  210. package/dist/sites/secret-resolver.d.ts.map +1 -0
  211. package/dist/sites/secret-resolver.js +225 -0
  212. package/dist/sites/secret-resolver.js.map +1 -0
  213. package/dist/sites/store.d.ts +82 -0
  214. package/dist/sites/store.d.ts.map +1 -0
  215. package/dist/sites/store.js +198 -0
  216. package/dist/sites/store.js.map +1 -0
  217. package/dist/sites/tools/index.d.ts +28 -0
  218. package/dist/sites/tools/index.d.ts.map +1 -0
  219. package/dist/sites/tools/index.js +30 -0
  220. package/dist/sites/tools/index.js.map +1 -0
  221. package/dist/sites/tools/sites-list.d.ts +48 -0
  222. package/dist/sites/tools/sites-list.d.ts.map +1 -0
  223. package/dist/sites/tools/sites-list.js +137 -0
  224. package/dist/sites/tools/sites-list.js.map +1 -0
  225. package/dist/sites/tools/sites-test.d.ts +47 -0
  226. package/dist/sites/tools/sites-test.d.ts.map +1 -0
  227. package/dist/sites/tools/sites-test.js +148 -0
  228. package/dist/sites/tools/sites-test.js.map +1 -0
  229. package/dist/skill-loader.d.ts +111 -0
  230. package/dist/skill-loader.d.ts.map +1 -0
  231. package/dist/skill-loader.js +191 -0
  232. package/dist/skill-loader.js.map +1 -0
  233. package/dist/tools/elements/builders.d.ts +24 -0
  234. package/dist/tools/elements/builders.d.ts.map +1 -0
  235. package/dist/tools/elements/builders.js +199 -0
  236. package/dist/tools/elements/builders.js.map +1 -0
  237. package/dist/tools/elements/handlers-write.d.ts +49 -0
  238. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  239. package/dist/tools/elements/handlers-write.js +148 -0
  240. package/dist/tools/elements/handlers-write.js.map +1 -0
  241. package/dist/tools/elements/handlers.d.ts +70 -0
  242. package/dist/tools/elements/handlers.d.ts.map +1 -0
  243. package/dist/tools/elements/handlers.js +292 -0
  244. package/dist/tools/elements/handlers.js.map +1 -0
  245. package/dist/tools/elements/index.d.ts +28 -0
  246. package/dist/tools/elements/index.d.ts.map +1 -0
  247. package/dist/tools/elements/index.js +27 -0
  248. package/dist/tools/elements/index.js.map +1 -0
  249. package/dist/tools/elements.d.ts +13 -0
  250. package/dist/tools/elements.d.ts.map +1 -0
  251. package/dist/tools/elements.js +13 -0
  252. package/dist/tools/elements.js.map +1 -0
  253. package/dist/tools/elicitation.d.ts +87 -0
  254. package/dist/tools/elicitation.d.ts.map +1 -0
  255. package/dist/tools/elicitation.js +100 -0
  256. package/dist/tools/elicitation.js.map +1 -0
  257. package/dist/tools/format/elements-format.d.ts +40 -0
  258. package/dist/tools/format/elements-format.d.ts.map +1 -0
  259. package/dist/tools/format/elements-format.js +194 -0
  260. package/dist/tools/format/elements-format.js.map +1 -0
  261. package/dist/tools/format/health-format.d.ts +79 -0
  262. package/dist/tools/format/health-format.d.ts.map +1 -0
  263. package/dist/tools/format/health-format.js +181 -0
  264. package/dist/tools/format/health-format.js.map +1 -0
  265. package/dist/tools/format/inspection-format.d.ts +59 -0
  266. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  267. package/dist/tools/format/inspection-format.js +303 -0
  268. package/dist/tools/format/inspection-format.js.map +1 -0
  269. package/dist/tools/format/pages-format.d.ts +57 -0
  270. package/dist/tools/format/pages-format.d.ts.map +1 -0
  271. package/dist/tools/format/pages-format.js +157 -0
  272. package/dist/tools/format/pages-format.js.map +1 -0
  273. package/dist/tools/format/sources-format.d.ts +44 -0
  274. package/dist/tools/format/sources-format.d.ts.map +1 -0
  275. package/dist/tools/format/sources-format.js +242 -0
  276. package/dist/tools/format/sources-format.js.map +1 -0
  277. package/dist/tools/health.d.ts +22 -0
  278. package/dist/tools/health.d.ts.map +1 -0
  279. package/dist/tools/health.js +220 -0
  280. package/dist/tools/health.js.map +1 -0
  281. package/dist/tools/index.d.ts +30 -0
  282. package/dist/tools/index.d.ts.map +1 -0
  283. package/dist/tools/index.js +39 -0
  284. package/dist/tools/index.js.map +1 -0
  285. package/dist/tools/inspection.d.ts +14 -0
  286. package/dist/tools/inspection.d.ts.map +1 -0
  287. package/dist/tools/inspection.js +208 -0
  288. package/dist/tools/inspection.js.map +1 -0
  289. package/dist/tools/layout-flatten.d.ts +75 -0
  290. package/dist/tools/layout-flatten.d.ts.map +1 -0
  291. package/dist/tools/layout-flatten.js +107 -0
  292. package/dist/tools/layout-flatten.js.map +1 -0
  293. package/dist/tools/multi-items/builders.d.ts +23 -0
  294. package/dist/tools/multi-items/builders.d.ts.map +1 -0
  295. package/dist/tools/multi-items/builders.js +78 -0
  296. package/dist/tools/multi-items/builders.js.map +1 -0
  297. package/dist/tools/multi-items/clean-implode-handler.d.ts +36 -0
  298. package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -0
  299. package/dist/tools/multi-items/clean-implode-handler.js +57 -0
  300. package/dist/tools/multi-items/clean-implode-handler.js.map +1 -0
  301. package/dist/tools/multi-items/index.d.ts +18 -0
  302. package/dist/tools/multi-items/index.d.ts.map +1 -0
  303. package/dist/tools/multi-items/index.js +18 -0
  304. package/dist/tools/multi-items/index.js.map +1 -0
  305. package/dist/tools/multi-items/inspect-handler.d.ts +41 -0
  306. package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -0
  307. package/dist/tools/multi-items/inspect-handler.js +50 -0
  308. package/dist/tools/multi-items/inspect-handler.js.map +1 -0
  309. package/dist/tools/multi-items/item-container-map.d.ts +41 -0
  310. package/dist/tools/multi-items/item-container-map.d.ts.map +1 -0
  311. package/dist/tools/multi-items/item-container-map.js +73 -0
  312. package/dist/tools/multi-items/item-container-map.js.map +1 -0
  313. package/dist/tools/pages/builders.d.ts +14 -0
  314. package/dist/tools/pages/builders.d.ts.map +1 -0
  315. package/dist/tools/pages/builders.js +136 -0
  316. package/dist/tools/pages/builders.js.map +1 -0
  317. package/dist/tools/pages/handlers-read.d.ts +33 -0
  318. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  319. package/dist/tools/pages/handlers-read.js +203 -0
  320. package/dist/tools/pages/handlers-read.js.map +1 -0
  321. package/dist/tools/pages/handlers-write.d.ts +21 -0
  322. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  323. package/dist/tools/pages/handlers-write.js +52 -0
  324. package/dist/tools/pages/handlers-write.js.map +1 -0
  325. package/dist/tools/pages/index.d.ts +17 -0
  326. package/dist/tools/pages/index.d.ts.map +1 -0
  327. package/dist/tools/pages/index.js +17 -0
  328. package/dist/tools/pages/index.js.map +1 -0
  329. package/dist/tools/pages/schemas.d.ts +45 -0
  330. package/dist/tools/pages/schemas.d.ts.map +1 -0
  331. package/dist/tools/pages/schemas.js +82 -0
  332. package/dist/tools/pages/schemas.js.map +1 -0
  333. package/dist/tools/pages.d.ts +13 -0
  334. package/dist/tools/pages.d.ts.map +1 -0
  335. package/dist/tools/pages.js +13 -0
  336. package/dist/tools/pages.js.map +1 -0
  337. package/dist/tools/pool-resolve-helper.d.ts +83 -0
  338. package/dist/tools/pool-resolve-helper.d.ts.map +1 -0
  339. package/dist/tools/pool-resolve-helper.js +148 -0
  340. package/dist/tools/pool-resolve-helper.js.map +1 -0
  341. package/dist/tools/progress-phases.d.ts +46 -0
  342. package/dist/tools/progress-phases.d.ts.map +1 -0
  343. package/dist/tools/progress-phases.js +48 -0
  344. package/dist/tools/progress-phases.js.map +1 -0
  345. package/dist/tools/shared-schemas.d.ts +25 -0
  346. package/dist/tools/shared-schemas.d.ts.map +1 -0
  347. package/dist/tools/shared-schemas.js +59 -0
  348. package/dist/tools/shared-schemas.js.map +1 -0
  349. package/dist/tools/sources/builders.d.ts +13 -0
  350. package/dist/tools/sources/builders.d.ts.map +1 -0
  351. package/dist/tools/sources/builders.js +118 -0
  352. package/dist/tools/sources/builders.js.map +1 -0
  353. package/dist/tools/sources/handlers-bind.d.ts +28 -0
  354. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  355. package/dist/tools/sources/handlers-bind.js +129 -0
  356. package/dist/tools/sources/handlers-bind.js.map +1 -0
  357. package/dist/tools/sources/handlers.d.ts +47 -0
  358. package/dist/tools/sources/handlers.d.ts.map +1 -0
  359. package/dist/tools/sources/handlers.js +108 -0
  360. package/dist/tools/sources/handlers.js.map +1 -0
  361. package/dist/tools/sources/index.d.ts +19 -0
  362. package/dist/tools/sources/index.d.ts.map +1 -0
  363. package/dist/tools/sources/index.js +18 -0
  364. package/dist/tools/sources/index.js.map +1 -0
  365. package/dist/tools/sources.d.ts +14 -0
  366. package/dist/tools/sources.d.ts.map +1 -0
  367. package/dist/tools/sources.js +14 -0
  368. package/dist/tools/sources.js.map +1 -0
  369. package/dist/tools/sparse-fields.d.ts +106 -0
  370. package/dist/tools/sparse-fields.d.ts.map +1 -0
  371. package/dist/tools/sparse-fields.js +165 -0
  372. package/dist/tools/sparse-fields.js.map +1 -0
  373. package/dist/tools/tool-builder/annotations.d.ts +55 -0
  374. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  375. package/dist/tools/tool-builder/annotations.js +86 -0
  376. package/dist/tools/tool-builder/annotations.js.map +1 -0
  377. package/dist/tools/tool-builder/define.d.ts +31 -0
  378. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  379. package/dist/tools/tool-builder/define.js +31 -0
  380. package/dist/tools/tool-builder/define.js.map +1 -0
  381. package/dist/tools/tool-builder/index.d.ts +28 -0
  382. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  383. package/dist/tools/tool-builder/index.js +27 -0
  384. package/dist/tools/tool-builder/index.js.map +1 -0
  385. package/dist/tools/tool-builder/results.d.ts +104 -0
  386. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  387. package/dist/tools/tool-builder/results.js +224 -0
  388. package/dist/tools/tool-builder/results.js.map +1 -0
  389. package/dist/tools/tool-builder/types.d.ts +97 -0
  390. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  391. package/dist/tools/tool-builder/types.js +9 -0
  392. package/dist/tools/tool-builder/types.js.map +1 -0
  393. package/dist/tools/tool-builder.d.ts +16 -0
  394. package/dist/tools/tool-builder.d.ts.map +1 -0
  395. package/dist/tools/tool-builder.js +16 -0
  396. package/dist/tools/tool-builder.js.map +1 -0
  397. package/package.json +2 -1
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Gateway test helpers — Wave G.1.
3
+ *
4
+ * After the gateway lands, tests that previously looked tools up from
5
+ * `McpServer._registeredTools` no longer find advanced tools (they're
6
+ * captured in the advanced registry, not on the real server). These
7
+ * helpers expose a unified view across all three lanes:
8
+ *
9
+ * - L1 essentials → real server's `_registeredTools`
10
+ * - L2 advanced → CapturingServer's `getAdvancedRegistry()`
11
+ * - L3 + gateway → real server's `_registeredTools`
12
+ *
13
+ * Test-only: never imported by any runtime path.
14
+ *
15
+ * @license MIT
16
+ */
17
+ import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
18
+ import type { CallToolResult } from '@modelcontextprotocol/sdk/types.js';
19
+ import type { CapturingServer } from './capturing-server.js';
20
+ /** A tool entry as seen by tests: handler + the registered config. */
21
+ export interface CollectedTool {
22
+ handler: (args: Record<string, unknown>, extra?: unknown) => CallToolResult | Promise<CallToolResult>;
23
+ title?: string;
24
+ description?: string;
25
+ inputSchema?: unknown;
26
+ annotations?: Record<string, unknown>;
27
+ }
28
+ /**
29
+ * Returns every tool — essentials + gateway on the real McpServer plus
30
+ * the advanced tools captured by the CapturingServer — keyed by tool
31
+ * name. The CapturingServer must have been used to register the L1/L2
32
+ * tools, and `registerAdvancedTool` must have run, before this is called.
33
+ *
34
+ * Production size = 22:
35
+ * 7 L1 essentials (real server) + 12 L2 advanced (registry)
36
+ * + 2 L3 direct (real server) + 1 gateway (real server) = 22.
37
+ */
38
+ export declare function collectAllRegisteredTools(server: McpServer, capturing: CapturingServer): Record<string, CollectedTool>;
39
+ /** By-name lookup over a `collectAllRegisteredTools` map. */
40
+ export declare function findTool(tools: Record<string, CollectedTool>, name: string): CollectedTool | undefined;
41
+ //# sourceMappingURL=test-support.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.d.ts","sourceRoot":"","sources":["../../src/gateway/test-support.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAE7D,sEAAsE;AACtE,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,CACL,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,KAAK,CAAC,EAAE,OAAO,KACd,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACzC;AAkBD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CACrC,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,eAAe,GAC3B,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAuC/B;AAED,6DAA6D;AAC7D,wBAAgB,QAAQ,CACpB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,EACpC,IAAI,EAAE,MAAM,GACb,aAAa,GAAG,SAAS,CAE3B"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * Gateway test helpers — Wave G.1.
3
+ *
4
+ * After the gateway lands, tests that previously looked tools up from
5
+ * `McpServer._registeredTools` no longer find advanced tools (they're
6
+ * captured in the advanced registry, not on the real server). These
7
+ * helpers expose a unified view across all three lanes:
8
+ *
9
+ * - L1 essentials → real server's `_registeredTools`
10
+ * - L2 advanced → CapturingServer's `getAdvancedRegistry()`
11
+ * - L3 + gateway → real server's `_registeredTools`
12
+ *
13
+ * Test-only: never imported by any runtime path.
14
+ *
15
+ * @license MIT
16
+ */
17
+ /**
18
+ * Returns every tool — essentials + gateway on the real McpServer plus
19
+ * the advanced tools captured by the CapturingServer — keyed by tool
20
+ * name. The CapturingServer must have been used to register the L1/L2
21
+ * tools, and `registerAdvancedTool` must have run, before this is called.
22
+ *
23
+ * Production size = 22:
24
+ * 7 L1 essentials (real server) + 12 L2 advanced (registry)
25
+ * + 2 L3 direct (real server) + 1 gateway (real server) = 22.
26
+ */
27
+ export function collectAllRegisteredTools(server, capturing) {
28
+ const result = {};
29
+ // The SDK changed the internal field name from `handler` to `callback`
30
+ // over its 1.x lifetime; accept either to keep the helper resilient.
31
+ const real = server;
32
+ for (const [name, tool] of Object.entries(real._registeredTools)) {
33
+ const callback = 'callback' in tool && typeof tool.callback === 'function'
34
+ ? tool.callback
35
+ : tool.handler;
36
+ result[name] = {
37
+ handler: callback,
38
+ title: tool.title,
39
+ description: tool.description,
40
+ inputSchema: tool.inputSchema,
41
+ annotations: tool.annotations,
42
+ };
43
+ }
44
+ for (const [name, entry] of capturing.getAdvancedRegistry()) {
45
+ const cfg = entry.config;
46
+ result[name] = {
47
+ handler: entry.handler,
48
+ title: cfg.title,
49
+ description: cfg.description,
50
+ inputSchema: cfg.inputSchema,
51
+ annotations: cfg.annotations,
52
+ };
53
+ }
54
+ return result;
55
+ }
56
+ /** By-name lookup over a `collectAllRegisteredTools` map. */
57
+ export function findTool(tools, name) {
58
+ return tools[name];
59
+ }
60
+ //# sourceMappingURL=test-support.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"test-support.js","sourceRoot":"","sources":["../../src/gateway/test-support.ts"],"names":[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AC,IAAI,CAAC,CAAC;AACvB,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * MCP server entrypoint (stdio transport).
3
+ *
4
+ * Reads config from environment variables (see `auth.ts`), spins up a
5
+ * `McpServer` with all tools registered, connects to stdio, and lets
6
+ * the host (Claude Desktop / Cursor / Zed / …) drive.
7
+ *
8
+ * `YTB_MCP_TEST_MODE=1` short-circuits: prints the tool registry and
9
+ * exits 0. Used by the smoke test and by `release.php` to validate
10
+ * that the bundled `dist/` is loadable on the target Node version.
11
+ *
12
+ * @license MIT
13
+ */
14
+ export { createServer, SERVER_NAME, SERVER_VERSION } from './server.js';
15
+ export { RestClient, REST_NAMESPACE_PATH, encodeElementPath } from './client.js';
16
+ export { loadConfig, loadRegistry, isTestMode, ENV_SITE_URL, ENV_WP_URL, ENV_BEARER, ENV_SITES_FILE, ENV_TEST_MODE, } from './auth.js';
17
+ export { ConfigError, RestError, NetworkError } from './errors.js';
18
+ export { buildAllTools } from './tools/index.js';
19
+ export { ClientPool, NoDefaultSiteError, UnknownSiteError } from './sites/client-pool.js';
20
+ export { SiteRegistry } from './sites/registry.js';
21
+ export { synthesiseFromEnv } from './sites/env-bridge.js';
22
+ export { defaultSecretResolver, PlainSecretResolver } from './sites/secret-resolver.js';
23
+ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel, } from './gateway/essentials.js';
24
+ export { CapturingServer, type AdvancedToolEntry, type CapturedToolHandler, type ToolRegistrar, } from './gateway/capturing-server.js';
25
+ export { registerAdvancedTool } from './gateway/advanced-tool.js';
26
+ export { collectAllRegisteredTools, findTool, type CollectedTool, } from './gateway/test-support.js';
27
+ declare function main(): Promise<void>;
28
+ export { main };
29
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAWH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EACH,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd,aAAa,GAChB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACxF,OAAO,EACH,eAAe,EACf,sBAAsB,EACtB,WAAW,EACX,gBAAgB,GACnB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EACH,eAAe,EACf,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,aAAa,GACrB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EACH,yBAAyB,EACzB,QAAQ,EACR,KAAK,aAAa,GACrB,MAAM,2BAA2B,CAAC;AAEnC,iBAAe,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAgEnC;AAkBD,OAAO,EAAE,IAAI,EAAE,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,111 @@
1
+ /**
2
+ * MCP server entrypoint (stdio transport).
3
+ *
4
+ * Reads config from environment variables (see `auth.ts`), spins up a
5
+ * `McpServer` with all tools registered, connects to stdio, and lets
6
+ * the host (Claude Desktop / Cursor / Zed / …) drive.
7
+ *
8
+ * `YTB_MCP_TEST_MODE=1` short-circuits: prints the tool registry and
9
+ * exits 0. Used by the smoke test and by `release.php` to validate
10
+ * that the bundled `dist/` is loadable on the target Node version.
11
+ *
12
+ * @license MIT
13
+ */
14
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
15
+ import { isTestMode, loadRegistry } from './auth.js';
16
+ import { ConfigError } from './errors.js';
17
+ import { ClientPool } from './sites/client-pool.js';
18
+ import { SiteRegistry } from './sites/registry.js';
19
+ import { defaultSecretResolver } from './sites/secret-resolver.js';
20
+ import { createServer } from './server.js';
21
+ export { createServer, SERVER_NAME, SERVER_VERSION } from './server.js';
22
+ export { RestClient, REST_NAMESPACE_PATH, encodeElementPath } from './client.js';
23
+ export { loadConfig, loadRegistry, isTestMode, ENV_SITE_URL, ENV_WP_URL, ENV_BEARER, ENV_SITES_FILE, ENV_TEST_MODE, } from './auth.js';
24
+ export { ConfigError, RestError, NetworkError } from './errors.js';
25
+ export { buildAllTools } from './tools/index.js';
26
+ // W6 — multi-site primitives exported for dist consumers (scripts,
27
+ // embedded uses). The `ClientPool` is the new wiring contract.
28
+ export { ClientPool, NoDefaultSiteError, UnknownSiteError } from './sites/client-pool.js';
29
+ export { SiteRegistry } from './sites/registry.js';
30
+ export { synthesiseFromEnv } from './sites/env-bridge.js';
31
+ export { defaultSecretResolver, PlainSecretResolver } from './sites/secret-resolver.js';
32
+ export { ESSENTIAL_TOOLS, DIRECT_TOP_LEVEL_TOOLS, isEssential, isDirectTopLevel, } from './gateway/essentials.js';
33
+ export { CapturingServer, } from './gateway/capturing-server.js';
34
+ export { registerAdvancedTool } from './gateway/advanced-tool.js';
35
+ export { collectAllRegisteredTools, findTool, } from './gateway/test-support.js';
36
+ async function main() {
37
+ const testMode = isTestMode();
38
+ // W10 — multi-site bootstrap is now centralised in
39
+ // `auth.loadRegistry()`. The canonical resolution order is:
40
+ // 1. YTB_MCP_SITES_FILE → loadSitesFile + SiteRegistry
41
+ // 2. env-bridge (YTB_MCP_SITE_URL + YTB_MCP_BEARER_TOKEN)
42
+ // 3. ConfigError("No sites configured.")
43
+ //
44
+ // The single exception lives here: `--test-mode` smoke probes
45
+ // (release.php, CI tool-list dumps) must boot even when neither
46
+ // path is configured. We honor loadRegistry first, then trap the
47
+ // ConfigError in test-mode and synthesise an empty registry so the
48
+ // tool list still prints. Tools will refuse to run, which is
49
+ // expected — `--test-mode` never invokes them.
50
+ let registry;
51
+ try {
52
+ registry = await loadRegistry();
53
+ }
54
+ catch (e) {
55
+ // Never crash the transport over a config problem. A DXT host
56
+ // (Claude Desktop) auto-starts the server the moment the
57
+ // extension is installed — before any Site URL / Bearer /
58
+ // sites-file is entered — and also restarts it after every config
59
+ // edit. Exiting here surfaced a scary "Server disconnected" toast
60
+ // for two common cases: (1) no config at all (ConfigError), and
61
+ // (2) a half-finished or malformed sites.json (schema validation,
62
+ // e.g. a leftover PASTE_… placeholder bearer). Both now boot with
63
+ // an empty registry: the server connects, advertises its tools,
64
+ // `sites_list` shows "(no sites)", and any tool needing a site
65
+ // returns a friendly NoDefaultSiteError at call-time. The real
66
+ // reason is written to stderr (visible in the host's MCP logs).
67
+ // In `--test-mode` this also lets the print-tools probe boot with
68
+ // zero or broken config.
69
+ const msg = e instanceof Error ? e.message : String(e);
70
+ const kind = e instanceof ConfigError
71
+ ? 'starting unconfigured'
72
+ : 'config problem, starting with no sites';
73
+ process.stderr.write(`[yt-builder-mcp] ${kind} — ${msg}\n`);
74
+ registry = new SiteRegistry({
75
+ schema_version: 1,
76
+ default_site_id: null,
77
+ sites: [],
78
+ });
79
+ }
80
+ const secretResolver = defaultSecretResolver();
81
+ const pool = new ClientPool(registry, secretResolver);
82
+ const { mcp, tools } = createServer({ pool });
83
+ if (testMode) {
84
+ // Print a one-line per tool summary to stderr (stdout is reserved
85
+ // for the JSON-RPC frame in real runs) and exit cleanly.
86
+ process.stderr.write(`[yt-builder-mcp] test mode — ${String(tools.length)} tools registered:\n`);
87
+ for (const tool of tools) {
88
+ process.stderr.write(` - ${tool.name}\n`);
89
+ }
90
+ process.exit(0);
91
+ }
92
+ const transport = new StdioServerTransport();
93
+ await mcp.connect(transport);
94
+ }
95
+ /**
96
+ * Auto-run unless explicitly disabled. Tests set `YTB_MCP_NO_AUTORUN=1`
97
+ * to import the module without firing up the stdio server.
98
+ *
99
+ * The bin dispatcher (`bin/yt-builder-mcp.js`) imports
100
+ * `dist/index.js` dynamically and expects `main()` to take over — so by
101
+ * default we run on import.
102
+ */
103
+ if (process.env.YTB_MCP_NO_AUTORUN !== '1') {
104
+ main().catch((e) => {
105
+ const message = e instanceof Error ? e.message : String(e);
106
+ process.stderr.write(`[yt-builder-mcp] fatal: ${message}\n`);
107
+ process.exit(1);
108
+ });
109
+ }
110
+ export { main };
111
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACjF,OAAO,EACH,UAAU,EACV,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,UAAU,EACV,UAAU,EACV,cAAc,EACd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C,GAAG,CAAC,kBAAkB,KAAK,GAAG,EAAE,CAAC;IACzC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,CAAU,EAAE,EAAE;QACxB,MAAM,OAAO,GAAG,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAC3D,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,OAAO,IAAI,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
+ *
4
+ * Copies the bundled `skills/yt-builder-mcp/` directory into the user's
5
+ * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
+ * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
+ *
8
+ * Idempotent: re-running overwrites existing skill files and skips the
9
+ * AGENTS.md append when the marker is already present.
10
+ *
11
+ * Mirrors the pattern from `@wootsup/mcp install-skill` so users on both
12
+ * products get the same workflow.
13
+ *
14
+ * @license MIT
15
+ */
16
+ export declare const MARKER_LINE = "<!-- yt-builder-mcp:skill-installed -->";
17
+ export interface InstallSkillOptions {
18
+ /**
19
+ * Package root that contains the bundled `skills/` dir. Defaults to
20
+ * walking up from this file (works in both source and `dist/` layouts).
21
+ */
22
+ readonly pkgRoot?: string;
23
+ /** Target dir where the `yt-builder-mcp/` skill folder will land. */
24
+ readonly targetSkillsDir?: string;
25
+ /**
26
+ * 1.0.1 Wave-R: when `true` (default), the installer removes any
27
+ * legacy `yootheme-builder/` directory left behind by pre-1.0.1
28
+ * installs so the user doesn't end up with two side-by-side skill
29
+ * copies under the same `~/.claude/skills/` root. Set to `false` to
30
+ * keep the legacy dir.
31
+ */
32
+ readonly removeLegacyDir?: boolean;
33
+ /** Target AGENTS.md file to append the marker to. */
34
+ readonly targetAgentsFile?: string;
35
+ }
36
+ export interface InstallSkillResult {
37
+ readonly copied: boolean;
38
+ readonly markerAlreadyPresent: boolean;
39
+ readonly skillTargetDir: string;
40
+ readonly agentsFile: string;
41
+ }
42
+ export declare function installSkill(options?: InstallSkillOptions): Promise<InstallSkillResult>;
43
+ //# sourceMappingURL=install-skill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-skill.d.ts","sourceRoot":"","sources":["../src/install-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAiBH,eAAO,MAAM,WAAW,4CAA4C,CAAC;AAiBrE,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,qEAAqE;IACrE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC;;;;;;OAMG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,OAAO,CAAC;IACnC,qDAAqD;IACrD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,kBAAkB;IAC/B,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;CAC/B;AAwCD,wBAAsB,YAAY,CAC9B,OAAO,GAAE,mBAAwB,GAClC,OAAO,CAAC,kBAAkB,CAAC,CAmD7B"}
@@ -0,0 +1,118 @@
1
+ /**
2
+ * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
+ *
4
+ * Copies the bundled `skills/yt-builder-mcp/` directory into the user's
5
+ * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
+ * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
+ *
8
+ * Idempotent: re-running overwrites existing skill files and skips the
9
+ * AGENTS.md append when the marker is already present.
10
+ *
11
+ * Mirrors the pattern from `@wootsup/mcp install-skill` so users on both
12
+ * products get the same workflow.
13
+ *
14
+ * @license MIT
15
+ */
16
+ import { appendFileSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync, } from 'node:fs';
17
+ import { homedir } from 'node:os';
18
+ import { dirname, join, resolve } from 'node:path';
19
+ import { fileURLToPath } from 'node:url';
20
+ export const MARKER_LINE = '<!-- yt-builder-mcp:skill-installed -->';
21
+ const MARKER_BLOCK = `
22
+
23
+ ## YT Builder MCP
24
+
25
+ ${MARKER_LINE}
26
+ The YT Builder MCP skill is installed at \`~/.claude/skills/yt-builder-mcp/\`
27
+ — the universal-marker path recognised by Claude Desktop and other AI
28
+ clients that follow the \`~/AGENTS.md\` discovery protocol.
29
+
30
+ It documents the 24 MCP tools (23 domain + 1 gateway, 11 entries in
31
+ \`tools/list\`), the 5 canonical workflows (build hero, bind dynamic
32
+ source, clone section, diagnose 401, add custom element), and the
33
+ gateway routing model. Source: https://github.com/wootsup/yt-builder-mcp.
34
+ `;
35
+ function defaultPkgRoot() {
36
+ // src/install-skill.ts → pkg root is one level up.
37
+ // When running from dist/install-skill.js the layout is identical
38
+ // (TypeScript emits `dist/install-skill.js` mirroring `src/`).
39
+ const here = dirname(fileURLToPath(import.meta.url));
40
+ return resolve(here, '..');
41
+ }
42
+ function copyDirRecursive(src, dst) {
43
+ if (!existsSync(dst))
44
+ mkdirSync(dst, { recursive: true });
45
+ for (const entry of readdirSync(src)) {
46
+ const sPath = join(src, entry);
47
+ const dPath = join(dst, entry);
48
+ const stat = statSync(sPath);
49
+ if (stat.isDirectory()) {
50
+ copyDirRecursive(sPath, dPath);
51
+ }
52
+ else {
53
+ copyFileSync(sPath, dPath);
54
+ }
55
+ }
56
+ }
57
+ /**
58
+ * Locate the bundled `skills/yt-builder-mcp` directory.
59
+ *
60
+ * Production layout: the skill folder is bundled INSIDE the npm package
61
+ * (`packages/mcp/skills/yt-builder-mcp/`), next to `dist/`. The same
62
+ * layout exists in the source tree (per Design-Doc §13.1) so source-mode
63
+ * smoke tests and the published tarball use the same single path.
64
+ *
65
+ * Earlier drafts walked `../..` up to a monorepo-root `skills/` dir;
66
+ * that layout was eliminated in Round-1 audit fix C1 because it produced
67
+ * a tarball without `skills/` (skill-not-found at first run).
68
+ */
69
+ function findSkillSource(pkgRoot) {
70
+ return join(pkgRoot, 'skills', 'yt-builder-mcp');
71
+ }
72
+ export async function installSkill(options = {}) {
73
+ const pkgRoot = options.pkgRoot ?? defaultPkgRoot();
74
+ const targetSkillsDir = options.targetSkillsDir ?? join(homedir(), '.claude', 'skills');
75
+ const targetAgentsFile = options.targetAgentsFile ?? join(homedir(), 'AGENTS.md');
76
+ const srcSkillDir = findSkillSource(pkgRoot);
77
+ if (!existsSync(srcSkillDir)) {
78
+ throw new Error(`Bundled skill not found at ${srcSkillDir}. ` +
79
+ `Is the package installed correctly? (pkgRoot=${pkgRoot})`);
80
+ }
81
+ if (!existsSync(targetSkillsDir)) {
82
+ mkdirSync(targetSkillsDir, { recursive: true });
83
+ }
84
+ const skillTargetDir = join(targetSkillsDir, 'yt-builder-mcp');
85
+ copyDirRecursive(srcSkillDir, skillTargetDir);
86
+ // 1.0.1 Wave-R: clean up the legacy directory created by pre-1.0.1
87
+ // installs so the user doesn't end up with two side-by-side skill
88
+ // copies (`yootheme-builder/` AND `yt-builder-mcp/`) under the same
89
+ // `~/.claude/skills/` root.
90
+ const removeLegacy = options.removeLegacyDir ?? true;
91
+ if (removeLegacy) {
92
+ const legacyDir = join(targetSkillsDir, 'yootheme-builder');
93
+ if (existsSync(legacyDir) && legacyDir !== skillTargetDir) {
94
+ rmSync(legacyDir, { recursive: true, force: true });
95
+ }
96
+ }
97
+ let markerAlreadyPresent = false;
98
+ if (existsSync(targetAgentsFile)) {
99
+ const existing = readFileSync(targetAgentsFile, 'utf-8');
100
+ if (existing.includes(MARKER_LINE)) {
101
+ markerAlreadyPresent = true;
102
+ }
103
+ else {
104
+ appendFileSync(targetAgentsFile, MARKER_BLOCK);
105
+ }
106
+ }
107
+ else {
108
+ // Create with a sensible top-line and the marker block (trimmed).
109
+ writeFileSync(targetAgentsFile, MARKER_BLOCK.trimStart(), 'utf-8');
110
+ }
111
+ return {
112
+ copied: true,
113
+ markerAlreadyPresent,
114
+ skillTargetDir,
115
+ agentsFile: targetAgentsFile,
116
+ };
117
+ }
118
+ //# sourceMappingURL=install-skill.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"install-skill.js","sourceRoot":"","sources":["../src/install-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACH,cAAc,EACd,YAAY,EACZ,UAAU,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,MAAM,EACN,QAAQ,EACR,aAAa,GAChB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,CAAC,MAAM,WAAW,GAAG,yCAAyC,CAAC;AAErE,MAAM,YAAY,GAAG;;;;EAInB,WAAW;;;;;;;;;CASZ,CAAC;AA6BF,SAAS,cAAc;IACnB,mDAAmD;IACnD,kEAAkE;IAClE,+DAA+D;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IACrD,OAAO,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AAC/B,CAAC;AAED,SAAS,gBAAgB,CAAC,GAAW,EAAE,GAAW;IAC9C,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;QAAE,SAAS,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAA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probe (P0 customer fix).
3
+ *
4
+ * The static URL-shape heuristic in `detectPlatformFromUrl()` only works
5
+ * when the user-supplied base URL already carries `/wp-json/` or
6
+ * `/api/index.php/` in its path. That is RARELY the case in practice —
7
+ * the DXT/manifest tells the user to enter the **site origin** (or a
8
+ * subfolder install like `https://dev.example.com/joomla`), neither of
9
+ * which contains those markers. The heuristic then silently falls back
10
+ * to the WordPress default and the Joomla customer experiences a
11
+ * 24/24 FAIL until they manually set `YTB_MCP_PLATFORM=joomla`.
12
+ *
13
+ * This module adds a *runtime probe*: lightweight unauthenticated GETs
14
+ * against both platforms' `/health` endpoints. Whichever returns a
15
+ * yt-builder-mcp-shaped response (a JSON body carrying `plugin_version`)
16
+ * wins. Joomla is probed first because the negative case (probe fails)
17
+ * is the long-tail and the positive case (probe succeeds) returns fast
18
+ * — letting the more common WordPress install just fall through to the
19
+ * second probe without paying for a wasted full timeout.
20
+ *
21
+ * The probe is fire-and-forget safe:
22
+ * - 3 s `AbortSignal.timeout` per request (so a totally broken host
23
+ * blocks ~6 s worst case, not the request's full 15 s default).
24
+ * - Non-200 responses are ignored (Joomla on a WP-only install
25
+ * answers 404; that's fine).
26
+ * - Non-JSON / wrong-shape 200 responses are ignored (a WP frontend
27
+ * without the plugin renders the homepage HTML, which `JSON.parse`
28
+ * refuses — handled).
29
+ * - Any thrown error (DNS, TLS, abort) is swallowed → try next.
30
+ *
31
+ * The function returns `null` when BOTH probes fail; the caller then
32
+ * falls back to the URL-shape heuristic or the wordpress default. We do
33
+ * NOT throw, because a missing-plugin or wrong-URL diagnosis belongs to
34
+ * the first real authenticated request — not to silent boot-time probing.
35
+ *
36
+ * @license MIT
37
+ */
38
+ import { type PlatformKind } from './index.js';
39
+ /**
40
+ * Minimal fetch type so callers (and tests) can inject a stub without
41
+ * pulling DOM types. Matches the global `fetch` contract we actually use.
42
+ */
43
+ export type ProbeFetch = (input: string, init?: {
44
+ signal?: AbortSignal;
45
+ }) => Promise<Response>;
46
+ export interface DetectPlatformAtRuntimeOptions {
47
+ /** Override the per-probe timeout (ms). Default 3000. */
48
+ readonly timeoutMs?: number;
49
+ /** Injectable fetch (tests). Defaults to the global `fetch`. */
50
+ readonly fetchImpl?: ProbeFetch;
51
+ }
52
+ /**
53
+ * Probe both platforms' health endpoints and return the first kind that
54
+ * answers with a yt-builder-mcp-shaped JSON payload. Returns `null`
55
+ * when neither responds usefully (so the caller can fall through to the
56
+ * URL-shape heuristic / default).
57
+ *
58
+ * NB: `baseUrl` is taken verbatim except for trimming trailing slashes.
59
+ * If `baseUrl` itself carries a path component (e.g. subfolder install
60
+ * `https://dev.example.com/joomla`) we preserve it — that path is where
61
+ * Joomla's `/api/index.php/...` is rooted.
62
+ */
63
+ export declare function detectPlatformAtRuntime(baseUrl: string, options?: DetectPlatformAtRuntimeOptions): Promise<PlatformKind | null>;
64
+ //# sourceMappingURL=detect.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../src/platform/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EAGH,KAAK,YAAY,EACpB,MAAM,YAAY,CAAC;AAKpB;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,CACrB,KAAK,EAAE,MAAM,EACb,IAAI,CAAC,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,CAAA;CAAE,KAC9B,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,MAAM,WAAW,8BAA8B;IAC3C,yDAAyD;IACzD,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,CAAC;CACnC;AAaD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,MAAM,EACf,OAAO,GAAE,8BAAmC,GAC7C,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAgB9B"}
@@ -0,0 +1,98 @@
1
+ /**
2
+ * Runtime platform detection — F-Platform-Detect-Probe (P0 customer fix).
3
+ *
4
+ * The static URL-shape heuristic in `detectPlatformFromUrl()` only works
5
+ * when the user-supplied base URL already carries `/wp-json/` or
6
+ * `/api/index.php/` in its path. That is RARELY the case in practice —
7
+ * the DXT/manifest tells the user to enter the **site origin** (or a
8
+ * subfolder install like `https://dev.example.com/joomla`), neither of
9
+ * which contains those markers. The heuristic then silently falls back
10
+ * to the WordPress default and the Joomla customer experiences a
11
+ * 24/24 FAIL until they manually set `YTB_MCP_PLATFORM=joomla`.
12
+ *
13
+ * This module adds a *runtime probe*: lightweight unauthenticated GETs
14
+ * against both platforms' `/health` endpoints. Whichever returns a
15
+ * yt-builder-mcp-shaped response (a JSON body carrying `plugin_version`)
16
+ * wins. Joomla is probed first because the negative case (probe fails)
17
+ * is the long-tail and the positive case (probe succeeds) returns fast
18
+ * — letting the more common WordPress install just fall through to the
19
+ * second probe without paying for a wasted full timeout.
20
+ *
21
+ * The probe is fire-and-forget safe:
22
+ * - 3 s `AbortSignal.timeout` per request (so a totally broken host
23
+ * blocks ~6 s worst case, not the request's full 15 s default).
24
+ * - Non-200 responses are ignored (Joomla on a WP-only install
25
+ * answers 404; that's fine).
26
+ * - Non-JSON / wrong-shape 200 responses are ignored (a WP frontend
27
+ * without the plugin renders the homepage HTML, which `JSON.parse`
28
+ * refuses — handled).
29
+ * - Any thrown error (DNS, TLS, abort) is swallowed → try next.
30
+ *
31
+ * The function returns `null` when BOTH probes fail; the caller then
32
+ * falls back to the URL-shape heuristic or the wordpress default. We do
33
+ * NOT throw, because a missing-plugin or wrong-URL diagnosis belongs to
34
+ * the first real authenticated request — not to silent boot-time probing.
35
+ *
36
+ * @license MIT
37
+ */
38
+ import { JOOMLA_REST_NAMESPACE_PATH, WORDPRESS_REST_NAMESPACE_PATH, } from './index.js';
39
+ /** Per-probe HTTP timeout. Keep tight — boot-time UX is on the line. */
40
+ const PROBE_TIMEOUT_MS = 3_000;
41
+ const PROBE_CANDIDATES = [
42
+ // Joomla first — see module header rationale.
43
+ { kind: 'joomla', path: `${JOOMLA_REST_NAMESPACE_PATH}/health` },
44
+ { kind: 'wordpress', path: `${WORDPRESS_REST_NAMESPACE_PATH}/health` },
45
+ ];
46
+ /**
47
+ * Probe both platforms' health endpoints and return the first kind that
48
+ * answers with a yt-builder-mcp-shaped JSON payload. Returns `null`
49
+ * when neither responds usefully (so the caller can fall through to the
50
+ * URL-shape heuristic / default).
51
+ *
52
+ * NB: `baseUrl` is taken verbatim except for trimming trailing slashes.
53
+ * If `baseUrl` itself carries a path component (e.g. subfolder install
54
+ * `https://dev.example.com/joomla`) we preserve it — that path is where
55
+ * Joomla's `/api/index.php/...` is rooted.
56
+ */
57
+ export async function detectPlatformAtRuntime(baseUrl, options = {}) {
58
+ const timeoutMs = options.timeoutMs ?? PROBE_TIMEOUT_MS;
59
+ const fetchImpl = options.fetchImpl ?? globalThis.fetch;
60
+ if (typeof fetchImpl !== 'function')
61
+ return null;
62
+ const trimmed = baseUrl.replace(/\/+$/, '');
63
+ for (const { kind, path } of PROBE_CANDIDATES) {
64
+ const matched = await probeOne(trimmed + path, timeoutMs, fetchImpl);
65
+ if (matched)
66
+ return kind;
67
+ }
68
+ return null;
69
+ }
70
+ async function probeOne(url, timeoutMs, fetchImpl) {
71
+ try {
72
+ const signal = AbortSignal.timeout(timeoutMs);
73
+ const r = await fetchImpl(url, { signal });
74
+ if (!r.ok)
75
+ return false;
76
+ // Some hosts answer JSON with `text/html` Content-Type; don't
77
+ // rely on the header. Parse defensively.
78
+ const text = await r.text();
79
+ let body;
80
+ try {
81
+ body = JSON.parse(text);
82
+ }
83
+ catch {
84
+ return false;
85
+ }
86
+ return isYtbHealthShape(body);
87
+ }
88
+ catch {
89
+ return false;
90
+ }
91
+ }
92
+ /** Recognises a yt-builder-mcp `/health` response. */
93
+ function isYtbHealthShape(body) {
94
+ return (typeof body === 'object'
95
+ && body !== null
96
+ && 'plugin_version' in body);
97
+ }
98
+ //# sourceMappingURL=detect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"detect.js","sourceRoot":"","sources":["../../src/platform/detect.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,OAAO,EACH,0BAA0B,EAC1B,6BAA6B,GAEhC,MAAM,YAAY,CAAC;AAEpB,wEAAwE;AACxE,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAuB/B,MAAM,gBAAgB,GAA8B;IAChD,8CAA8C;IAC9C,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,0BAA0B,SAAS,EAAE;IAChE,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,6BAA6B,SAAS,EAAE;CACzE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CACzC,OAAe,EACf,UAA0C,EAAE;IAE5C,MAAM,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,gBAAgB,CAAC;IACxD,MAAM,SAAS,GACX,OAAO,CAAC,SAAS,IAAK,UAAU,CAAC,KAAoB,CAAC;IAC1D,IAAI,OAAO,SAAS,KAAK,UAAU;QAAE,OAAO,IAAI,CAAC;IAEjD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IAC5C,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,gBAAgB,EAAE,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAC1B,OAAO,GAAG,IAAI,EACd,SAAS,EACT,SAAS,CACZ,CAAC;QACF,IAAI,OAAO;YAAE,OAAO,IAAI,CAAC;IAC7B,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,QAAQ,CACnB,GAAW,EACX,SAAiB,EACjB,SAAqB;IAErB,IAAI,CAAC;QACD,MAAM,M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