@wootsup/yt-builder-mcp 1.0.0 → 1.1.0

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 (187) hide show
  1. package/README.md +18 -6
  2. package/bin/yt-builder-mcp.js +6 -0
  3. package/dist/auth.d.ts +86 -6
  4. package/dist/auth.d.ts.map +1 -1
  5. package/dist/auth.js +141 -8
  6. package/dist/auth.js.map +1 -1
  7. package/dist/errors/sanitize.d.ts.map +1 -1
  8. package/dist/errors/sanitize.js +10 -0
  9. package/dist/errors/sanitize.js.map +1 -1
  10. package/dist/gateway/essentials.d.ts +1 -1
  11. package/dist/gateway/essentials.d.ts.map +1 -1
  12. package/dist/gateway/essentials.js +15 -2
  13. package/dist/gateway/essentials.js.map +1 -1
  14. package/dist/index.d.ts +5 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +52 -16
  17. package/dist/index.js.map +1 -1
  18. package/dist/install-skill.d.ts +10 -2
  19. package/dist/install-skill.d.ts.map +1 -1
  20. package/dist/install-skill.js +18 -7
  21. package/dist/install-skill.js.map +1 -1
  22. package/dist/platform/detect.d.ts +64 -0
  23. package/dist/platform/detect.d.ts.map +1 -0
  24. package/dist/platform/detect.js +98 -0
  25. package/dist/platform/detect.js.map +1 -0
  26. package/dist/platform/index.d.ts +72 -0
  27. package/dist/platform/index.d.ts.map +1 -1
  28. package/dist/platform/index.js +138 -0
  29. package/dist/platform/index.js.map +1 -1
  30. package/dist/platform/joomla.d.ts +44 -0
  31. package/dist/platform/joomla.d.ts.map +1 -0
  32. package/dist/platform/joomla.js +46 -0
  33. package/dist/platform/joomla.js.map +1 -0
  34. package/dist/server.d.ts +61 -2
  35. package/dist/server.d.ts.map +1 -1
  36. package/dist/server.js +86 -2
  37. package/dist/server.js.map +1 -1
  38. package/dist/setup-cli-confirm.d.ts +36 -0
  39. package/dist/setup-cli-confirm.d.ts.map +1 -0
  40. package/dist/setup-cli-confirm.js +59 -0
  41. package/dist/setup-cli-confirm.js.map +1 -0
  42. package/dist/setup-cli.d.ts +53 -1
  43. package/dist/setup-cli.d.ts.map +1 -1
  44. package/dist/setup-cli.js +525 -10
  45. package/dist/setup-cli.js.map +1 -1
  46. package/dist/setup-prompts.d.ts.map +1 -1
  47. package/dist/setup-prompts.js +12 -8
  48. package/dist/setup-prompts.js.map +1 -1
  49. package/dist/setup-wizard-types.d.ts +19 -3
  50. package/dist/setup-wizard-types.d.ts.map +1 -1
  51. package/dist/setup-wizard.d.ts.map +1 -1
  52. package/dist/setup-wizard.js +34 -1
  53. package/dist/setup-wizard.js.map +1 -1
  54. package/dist/sites/cli/add-site.d.ts +106 -0
  55. package/dist/sites/cli/add-site.d.ts.map +1 -0
  56. package/dist/sites/cli/add-site.js +185 -0
  57. package/dist/sites/cli/add-site.js.map +1 -0
  58. package/dist/sites/cli/list-sites.d.ts +40 -0
  59. package/dist/sites/cli/list-sites.d.ts.map +1 -0
  60. package/dist/sites/cli/list-sites.js +117 -0
  61. package/dist/sites/cli/list-sites.js.map +1 -0
  62. package/dist/sites/cli/remove-site.d.ts +60 -0
  63. package/dist/sites/cli/remove-site.d.ts.map +1 -0
  64. package/dist/sites/cli/remove-site.js +120 -0
  65. package/dist/sites/cli/remove-site.js.map +1 -0
  66. package/dist/sites/cli/set-default.d.ts +47 -0
  67. package/dist/sites/cli/set-default.d.ts.map +1 -0
  68. package/dist/sites/cli/set-default.js +69 -0
  69. package/dist/sites/cli/set-default.js.map +1 -0
  70. package/dist/sites/cli/test-site.d.ts +77 -0
  71. package/dist/sites/cli/test-site.d.ts.map +1 -0
  72. package/dist/sites/cli/test-site.js +146 -0
  73. package/dist/sites/cli/test-site.js.map +1 -0
  74. package/dist/sites/client-pool.d.ts +124 -0
  75. package/dist/sites/client-pool.d.ts.map +1 -0
  76. package/dist/sites/client-pool.js +172 -0
  77. package/dist/sites/client-pool.js.map +1 -0
  78. package/dist/sites/env-bridge.d.ts +55 -0
  79. package/dist/sites/env-bridge.d.ts.map +1 -0
  80. package/dist/sites/env-bridge.js +94 -0
  81. package/dist/sites/env-bridge.js.map +1 -0
  82. package/dist/sites/paths.d.ts +21 -0
  83. package/dist/sites/paths.d.ts.map +1 -0
  84. package/dist/sites/paths.js +37 -0
  85. package/dist/sites/paths.js.map +1 -0
  86. package/dist/sites/probe.d.ts +60 -0
  87. package/dist/sites/probe.d.ts.map +1 -0
  88. package/dist/sites/probe.js +112 -0
  89. package/dist/sites/probe.js.map +1 -0
  90. package/dist/sites/registry.d.ts +142 -0
  91. package/dist/sites/registry.d.ts.map +1 -0
  92. package/dist/sites/registry.js +163 -0
  93. package/dist/sites/registry.js.map +1 -0
  94. package/dist/sites/schema.d.ts +90 -0
  95. package/dist/sites/schema.d.ts.map +1 -0
  96. package/dist/sites/schema.js +71 -0
  97. package/dist/sites/schema.js.map +1 -0
  98. package/dist/sites/secret-resolver.d.ts +109 -0
  99. package/dist/sites/secret-resolver.d.ts.map +1 -0
  100. package/dist/sites/secret-resolver.js +189 -0
  101. package/dist/sites/secret-resolver.js.map +1 -0
  102. package/dist/sites/store.d.ts +82 -0
  103. package/dist/sites/store.d.ts.map +1 -0
  104. package/dist/sites/store.js +198 -0
  105. package/dist/sites/store.js.map +1 -0
  106. package/dist/sites/tools/index.d.ts +28 -0
  107. package/dist/sites/tools/index.d.ts.map +1 -0
  108. package/dist/sites/tools/index.js +30 -0
  109. package/dist/sites/tools/index.js.map +1 -0
  110. package/dist/sites/tools/sites-list.d.ts +48 -0
  111. package/dist/sites/tools/sites-list.d.ts.map +1 -0
  112. package/dist/sites/tools/sites-list.js +135 -0
  113. package/dist/sites/tools/sites-list.js.map +1 -0
  114. package/dist/sites/tools/sites-test.d.ts +47 -0
  115. package/dist/sites/tools/sites-test.d.ts.map +1 -0
  116. package/dist/sites/tools/sites-test.js +148 -0
  117. package/dist/sites/tools/sites-test.js.map +1 -0
  118. package/dist/skill-loader.d.ts +63 -3
  119. package/dist/skill-loader.d.ts.map +1 -1
  120. package/dist/skill-loader.js +123 -10
  121. package/dist/skill-loader.js.map +1 -1
  122. package/dist/tools/elements/builders.d.ts +2 -2
  123. package/dist/tools/elements/builders.d.ts.map +1 -1
  124. package/dist/tools/elements/builders.js +45 -23
  125. package/dist/tools/elements/builders.js.map +1 -1
  126. package/dist/tools/elements/handlers.d.ts +8 -1
  127. package/dist/tools/elements/handlers.d.ts.map +1 -1
  128. package/dist/tools/elements/handlers.js +37 -1
  129. package/dist/tools/elements/handlers.js.map +1 -1
  130. package/dist/tools/format/health-format.d.ts +12 -6
  131. package/dist/tools/format/health-format.d.ts.map +1 -1
  132. package/dist/tools/format/health-format.js +14 -11
  133. package/dist/tools/format/health-format.js.map +1 -1
  134. package/dist/tools/format/pages-format.d.ts +7 -1
  135. package/dist/tools/format/pages-format.d.ts.map +1 -1
  136. package/dist/tools/format/pages-format.js +25 -1
  137. package/dist/tools/format/pages-format.js.map +1 -1
  138. package/dist/tools/health.d.ts +2 -2
  139. package/dist/tools/health.d.ts.map +1 -1
  140. package/dist/tools/health.js +120 -47
  141. package/dist/tools/health.js.map +1 -1
  142. package/dist/tools/index.d.ts +9 -2
  143. package/dist/tools/index.d.ts.map +1 -1
  144. package/dist/tools/index.js +21 -7
  145. package/dist/tools/index.js.map +1 -1
  146. package/dist/tools/inspection.d.ts +2 -2
  147. package/dist/tools/inspection.d.ts.map +1 -1
  148. package/dist/tools/inspection.js +67 -22
  149. package/dist/tools/inspection.js.map +1 -1
  150. package/dist/tools/multi-items/builders.d.ts +2 -2
  151. package/dist/tools/multi-items/builders.d.ts.map +1 -1
  152. package/dist/tools/multi-items/builders.js +21 -8
  153. package/dist/tools/multi-items/builders.js.map +1 -1
  154. package/dist/tools/pages/builders.d.ts +2 -2
  155. package/dist/tools/pages/builders.d.ts.map +1 -1
  156. package/dist/tools/pages/builders.js +36 -24
  157. package/dist/tools/pages/builders.js.map +1 -1
  158. package/dist/tools/pages/handlers-read.d.ts.map +1 -1
  159. package/dist/tools/pages/handlers-read.js +10 -0
  160. package/dist/tools/pages/handlers-read.js.map +1 -1
  161. package/dist/tools/pages/schemas.d.ts.map +1 -1
  162. package/dist/tools/pages/schemas.js +18 -0
  163. package/dist/tools/pages/schemas.js.map +1 -1
  164. package/dist/tools/pool-resolve-helper.d.ts +83 -0
  165. package/dist/tools/pool-resolve-helper.d.ts.map +1 -0
  166. package/dist/tools/pool-resolve-helper.js +148 -0
  167. package/dist/tools/pool-resolve-helper.js.map +1 -0
  168. package/dist/tools/shared-schemas.d.ts +10 -0
  169. package/dist/tools/shared-schemas.d.ts.map +1 -1
  170. package/dist/tools/shared-schemas.js +20 -2
  171. package/dist/tools/shared-schemas.js.map +1 -1
  172. package/dist/tools/sources/builders.d.ts +2 -2
  173. package/dist/tools/sources/builders.d.ts.map +1 -1
  174. package/dist/tools/sources/builders.js +27 -15
  175. package/dist/tools/sources/builders.js.map +1 -1
  176. package/dist/tools/tool-builder/index.d.ts +1 -1
  177. package/dist/tools/tool-builder/index.d.ts.map +1 -1
  178. package/dist/tools/tool-builder/index.js +1 -1
  179. package/dist/tools/tool-builder/index.js.map +1 -1
  180. package/dist/tools/tool-builder/results.d.ts +34 -0
  181. package/dist/tools/tool-builder/results.d.ts.map +1 -1
  182. package/dist/tools/tool-builder/results.js +86 -0
  183. package/dist/tools/tool-builder/results.js.map +1 -1
  184. package/manifest.json +27 -10
  185. package/package.json +3 -1
  186. package/skills/yt-builder-mcp/SKILL.md +846 -0
  187. package/skills/yootheme-builder/SKILL.md +0 -587
package/dist/index.js.map CHANGED
@@ -1 +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,UAAU,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,WAAW,EAA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CAAC,CAAC,CAAC;AACP,CAAC;AAED,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
3
  *
4
- * Copies the bundled `skills/yootheme-builder/` directory into the user's
4
+ * Copies the bundled `skills/yt-builder-mcp/` directory into the user's
5
5
  * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
6
  * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
7
  *
@@ -20,8 +20,16 @@ export interface InstallSkillOptions {
20
20
  * walking up from this file (works in both source and `dist/` layouts).
21
21
  */
22
22
  readonly pkgRoot?: string;
23
- /** Target dir where the `yootheme-builder/` skill folder will land. */
23
+ /** Target dir where the `yt-builder-mcp/` skill folder will land. */
24
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;
25
33
  /** Target AGENTS.md file to append the marker to. */
26
34
  readonly targetAgentsFile?: string;
27
35
  }
@@ -1 +1 @@
1
- {"version":3,"file":"install-skill.d.ts","sourceRoot":"","sources":["../src/install-skill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,eAAO,MAAM,WAAW,4CAA4C,CAAC;AAiBrE,MAAM,WAAW,mBAAmB;IAChC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,uEAAuE;IACvE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAClC,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,CAuC7B"}
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"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * `install-skill` subcommand for `@wootsup/yt-builder-mcp`.
3
3
  *
4
- * Copies the bundled `skills/yootheme-builder/` directory into the user's
4
+ * Copies the bundled `skills/yt-builder-mcp/` directory into the user's
5
5
  * agent-skill folder (typically `~/.claude/skills/`) and appends a marker
6
6
  * block to `~/AGENTS.md` so other AI clients pick it up automatically.
7
7
  *
@@ -13,7 +13,7 @@
13
13
  *
14
14
  * @license MIT
15
15
  */
16
- import { appendFileSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync, } from 'node:fs';
16
+ import { appendFileSync, copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync, } from 'node:fs';
17
17
  import { homedir } from 'node:os';
18
18
  import { dirname, join, resolve } from 'node:path';
19
19
  import { fileURLToPath } from 'node:url';
@@ -23,7 +23,7 @@ const MARKER_BLOCK = `
23
23
  ## YT Builder MCP
24
24
 
25
25
  ${MARKER_LINE}
26
- The YOOtheme Builder skill is installed at \`~/.claude/skills/yootheme-builder/\`
26
+ The YT Builder MCP skill is installed at \`~/.claude/skills/yt-builder-mcp/\`
27
27
  — the universal-marker path recognised by Claude Desktop and other AI
28
28
  clients that follow the \`~/AGENTS.md\` discovery protocol.
29
29
 
@@ -55,10 +55,10 @@ function copyDirRecursive(src, dst) {
55
55
  }
56
56
  }
57
57
  /**
58
- * Locate the bundled `skills/yootheme-builder` directory.
58
+ * Locate the bundled `skills/yt-builder-mcp` directory.
59
59
  *
60
60
  * Production layout: the skill folder is bundled INSIDE the npm package
61
- * (`packages/mcp/skills/yootheme-builder/`), next to `dist/`. The same
61
+ * (`packages/mcp/skills/yt-builder-mcp/`), next to `dist/`. The same
62
62
  * layout exists in the source tree (per Design-Doc §13.1) so source-mode
63
63
  * smoke tests and the published tarball use the same single path.
64
64
  *
@@ -67,7 +67,7 @@ function copyDirRecursive(src, dst) {
67
67
  * a tarball without `skills/` (skill-not-found at first run).
68
68
  */
69
69
  function findSkillSource(pkgRoot) {
70
- return join(pkgRoot, 'skills', 'yootheme-builder');
70
+ return join(pkgRoot, 'skills', 'yt-builder-mcp');
71
71
  }
72
72
  export async function installSkill(options = {}) {
73
73
  const pkgRoot = options.pkgRoot ?? defaultPkgRoot();
@@ -81,8 +81,19 @@ export async function installSkill(options = {}) {
81
81
  if (!existsSync(targetSkillsDir)) {
82
82
  mkdirSync(targetSkillsDir, { recursive: true });
83
83
  }
84
- const skillTargetDir = join(targetSkillsDir, 'yootheme-builder');
84
+ const skillTargetDir = join(targetSkillsDir, 'yt-builder-mcp');
85
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
+ }
86
97
  let markerAlreadyPresent = false;
87
98
  if (existsSync(targetAgentsFile)) {
88
99
  const existing = readFileSync(targetAgentsFile, 'utf-8');
@@ -1 +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,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;AAqBF,SAAS,cAAc;IACnB,mDAAmD;IACnD,kEAAkE;IAClE,+DAA+D;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,G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AC;IACL,CAAC;IAED,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC;QAC/B,MAAM,QAAQ,GAAG,YAAY,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;QACzD,IAAI,QAAQ,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;YACjC,oBAAoB,GAAG,IAAI,CAAC;QAChC,CAAC;aAAM,CAAC;YACJ,cAAc,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC;QACnD,CAAC;IACL,CAAC;SAAM,CAAC;QACJ,kEAAkE;QAClE,aAAa,CAAC,gBAAgB,EAAE,YAAY,CAAC,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;IAED,OAAO;QACH,MAAM,EAAE,IAAI;QACZ,oBAAoB;QACpB,cAAc;QACd,UAAU,EAAE,gBAAgB;KAC/B,CAAC;AACN,CAAC"}
@@ -0,0 +1,64 @@
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 { 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,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AAED,sDAAsD;AACtD,SAAS,gBAAgB,CAAC,IAAa;IACnC,OAAO,CACH,OAAO,IAAI,KAAK,QAAQ;WACrB,IAAI,KAAK,IAAI;WACb,gBAAgB,IAAI,IAAI,CAC9B,CAAC;AACN,CAAC"}
@@ -46,4 +46,76 @@ export declare class WordPressPlatform implements Platform {
46
46
  readonly restNamespacePath: string;
47
47
  constructor(baseUrl: string);
48
48
  }
49
+ export { JoomlaPlatform, JOOMLA_REST_NAMESPACE_PATH } from './joomla.js';
50
+ /**
51
+ * Detect which {@link Platform} a base URL targets based on the URL
52
+ * shape alone (no network call).
53
+ *
54
+ * - pathname starts with `/wp-json/` → `'wordpress'`
55
+ * - pathname starts with `/api/index.php/` → `'joomla'`
56
+ * - otherwise → `null` (ambiguous — caller may probe `/identity`)
57
+ *
58
+ * Round-6 A1 polish: detection switched from `String.includes` to a
59
+ * proper `URL`-parse + `pathname.startsWith` so query-string payloads
60
+ * cannot cause mis-detection (e.g. a Joomla site URL like
61
+ * `https://example.com/?redirect=/wp-json/foo` no longer pretends to
62
+ * be WordPress). Malformed URLs that the `URL` constructor rejects
63
+ * gracefully fall back to the legacy substring scan so callers that
64
+ * accidentally pass a host-only string (e.g. `example.com`) keep
65
+ * working — they would have already failed the actual network call
66
+ * with a clearer error before this function was reached in practice.
67
+ *
68
+ * Cookbook §3.7.1 — the runtime tie-breaker (when this returns `null`)
69
+ * is the `/identity` endpoint, which returns
70
+ * `{ product: 'yt-builder-mcp', platform: 'wordpress'|'joomla', ... }`
71
+ * on both platforms.
72
+ */
73
+ export declare function detectPlatformFromUrl(url: string): PlatformKind | null;
74
+ /**
75
+ * Construct the right {@link Platform} for a base URL.
76
+ *
77
+ * When the URL shape gives an unambiguous hint via
78
+ * {@link detectPlatformFromUrl}, that wins. Otherwise the caller can
79
+ * pass an explicit `hint` (e.g. from a config flag) or fall back to
80
+ * the default (`'wordpress'` for back-compat — Joomla support landed
81
+ * in Wave 7, so existing WordPress installs never need to flag).
82
+ *
83
+ * Synchronous variant — kept for back-compat with callers that cannot
84
+ * (or do not need to) probe over the network. Prefer
85
+ * {@link platformForUrlAsync} when running in the server boot path:
86
+ * it adds a runtime probe that disambiguates origin-only / subfolder
87
+ * URLs (e.g. `https://example.com/joomla`) where the URL shape alone
88
+ * is silent.
89
+ */
90
+ export declare function platformForUrl(baseUrl: string, hint?: PlatformKind): Platform;
91
+ /**
92
+ * Async variant of {@link platformForUrl} that adds a runtime probe
93
+ * step for URLs the URL-shape heuristic cannot disambiguate.
94
+ *
95
+ * Resolution order (first match wins):
96
+ * 1. Explicit `hint` from `YTB_MCP_PLATFORM` env var → no probe.
97
+ * 2. URL-shape via {@link detectPlatformFromUrl} (clear `/wp-json/`
98
+ * or `/api/index.php/` marker) → no probe.
99
+ * 3. Runtime probe via `detectPlatformAtRuntime` (the F-Platform-
100
+ * Detect-Probe fix — handles subfolder installs like
101
+ * `https://dev.example.com/joomla` where steps 1+2 return null).
102
+ * 4. Final fallback: `'wordpress'` (back-compat).
103
+ *
104
+ * The probe step is what unblocks origin-only Joomla customers without
105
+ * forcing them to manually set `YTB_MCP_PLATFORM=joomla` — the DXT
106
+ * default of `auto` finally lives up to its name.
107
+ *
108
+ * If both probes fail (server unreachable, plugin not installed, etc.)
109
+ * we fall back to the wordpress default and emit a single stderr note
110
+ * so the customer at least sees *why* the next authenticated call may
111
+ * 404; the real diagnosis still belongs to the first authenticated
112
+ * tool invocation.
113
+ *
114
+ * @param opts.probe Optional probe override (tests / DI).
115
+ * @param opts.logger Optional stderr writer (defaults to `process.stderr.write`).
116
+ */
117
+ export declare function platformForUrlAsync(baseUrl: string, hint?: PlatformKind, opts?: {
118
+ readonly probe?: (url: string) => Promise<PlatformKind | null>;
119
+ readonly logger?: (msg: string) => void;
120
+ }): Promise<Platform>;
49
121
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;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D,OAAO,EAAE,cAAc,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAetE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,cAAc,CAC1B,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,YAAY,GACpB,QAAQ,CAMV;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,mBAAmB,CACrC,OAAO,EAAE,MAAM,EACf,IAAI,CAAC,EAAE,YAAY,EACnB,IAAI,GAAE;IACF,QAAQ,CAAC,KAAK,CAAC,EAAE,CACb,GAAG,EAAE,MAAM,KACV,OAAO,CAAC,YAAY,GAAG,IAAI,CAAC,CAAC;IAClC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACtC,GACP,OAAO,CAAC,QAAQ,CAAC,CA0CnB"}
@@ -35,4 +35,142 @@ export class WordPressPlatform {
35
35
  this.restNamespacePath = WORDPRESS_REST_NAMESPACE_PATH;
36
36
  }
37
37
  }
38
+ // Local import keeps the symbol in scope for `platformForUrl` below;
39
+ // the re-export immediately after surfaces it to outside callers so
40
+ // the platform barrel remains the single import point (cookbook
41
+ // Ch1 Finding 2).
42
+ import { JoomlaPlatform } from './joomla.js';
43
+ export { JoomlaPlatform, JOOMLA_REST_NAMESPACE_PATH } from './joomla.js';
44
+ /**
45
+ * Detect which {@link Platform} a base URL targets based on the URL
46
+ * shape alone (no network call).
47
+ *
48
+ * - pathname starts with `/wp-json/` → `'wordpress'`
49
+ * - pathname starts with `/api/index.php/` → `'joomla'`
50
+ * - otherwise → `null` (ambiguous — caller may probe `/identity`)
51
+ *
52
+ * Round-6 A1 polish: detection switched from `String.includes` to a
53
+ * proper `URL`-parse + `pathname.startsWith` so query-string payloads
54
+ * cannot cause mis-detection (e.g. a Joomla site URL like
55
+ * `https://example.com/?redirect=/wp-json/foo` no longer pretends to
56
+ * be WordPress). Malformed URLs that the `URL` constructor rejects
57
+ * gracefully fall back to the legacy substring scan so callers that
58
+ * accidentally pass a host-only string (e.g. `example.com`) keep
59
+ * working — they would have already failed the actual network call
60
+ * with a clearer error before this function was reached in practice.
61
+ *
62
+ * Cookbook §3.7.1 — the runtime tie-breaker (when this returns `null`)
63
+ * is the `/identity` endpoint, which returns
64
+ * `{ product: 'yt-builder-mcp', platform: 'wordpress'|'joomla', ... }`
65
+ * on both platforms.
66
+ */
67
+ export function detectPlatformFromUrl(url) {
68
+ let pathname;
69
+ try {
70
+ pathname = new URL(url).pathname;
71
+ }
72
+ catch {
73
+ // Fallback for inputs the URL constructor rejects (host-only
74
+ // strings, relative paths). Preserves the legacy substring
75
+ // behaviour as a defensive net.
76
+ if (url.includes('/wp-json/'))
77
+ return 'wordpress';
78
+ if (url.includes('/api/index.php/'))
79
+ return 'joomla';
80
+ return null;
81
+ }
82
+ if (pathname.startsWith('/wp-json/'))
83
+ return 'wordpress';
84
+ if (pathname.startsWith('/api/index.php/'))
85
+ return 'joomla';
86
+ return null;
87
+ }
88
+ /**
89
+ * Construct the right {@link Platform} for a base URL.
90
+ *
91
+ * When the URL shape gives an unambiguous hint via
92
+ * {@link detectPlatformFromUrl}, that wins. Otherwise the caller can
93
+ * pass an explicit `hint` (e.g. from a config flag) or fall back to
94
+ * the default (`'wordpress'` for back-compat — Joomla support landed
95
+ * in Wave 7, so existing WordPress installs never need to flag).
96
+ *
97
+ * Synchronous variant — kept for back-compat with callers that cannot
98
+ * (or do not need to) probe over the network. Prefer
99
+ * {@link platformForUrlAsync} when running in the server boot path:
100
+ * it adds a runtime probe that disambiguates origin-only / subfolder
101
+ * URLs (e.g. `https://example.com/joomla`) where the URL shape alone
102
+ * is silent.
103
+ */
104
+ export function platformForUrl(baseUrl, hint) {
105
+ const detected = detectPlatformFromUrl(baseUrl);
106
+ const kind = detected ?? hint ?? 'wordpress';
107
+ return kind === 'joomla'
108
+ ? new JoomlaPlatform(baseUrl)
109
+ : new WordPressPlatform(baseUrl);
110
+ }
111
+ /**
112
+ * Async variant of {@link platformForUrl} that adds a runtime probe
113
+ * step for URLs the URL-shape heuristic cannot disambiguate.
114
+ *
115
+ * Resolution order (first match wins):
116
+ * 1. Explicit `hint` from `YTB_MCP_PLATFORM` env var → no probe.
117
+ * 2. URL-shape via {@link detectPlatformFromUrl} (clear `/wp-json/`
118
+ * or `/api/index.php/` marker) → no probe.
119
+ * 3. Runtime probe via `detectPlatformAtRuntime` (the F-Platform-
120
+ * Detect-Probe fix — handles subfolder installs like
121
+ * `https://dev.example.com/joomla` where steps 1+2 return null).
122
+ * 4. Final fallback: `'wordpress'` (back-compat).
123
+ *
124
+ * The probe step is what unblocks origin-only Joomla customers without
125
+ * forcing them to manually set `YTB_MCP_PLATFORM=joomla` — the DXT
126
+ * default of `auto` finally lives up to its name.
127
+ *
128
+ * If both probes fail (server unreachable, plugin not installed, etc.)
129
+ * we fall back to the wordpress default and emit a single stderr note
130
+ * so the customer at least sees *why* the next authenticated call may
131
+ * 404; the real diagnosis still belongs to the first authenticated
132
+ * tool invocation.
133
+ *
134
+ * @param opts.probe Optional probe override (tests / DI).
135
+ * @param opts.logger Optional stderr writer (defaults to `process.stderr.write`).
136
+ */
137
+ export async function platformForUrlAsync(baseUrl, hint, opts = {}) {
138
+ // 1. Explicit hint wins — probe-less, by design (user override).
139
+ if (hint !== undefined) {
140
+ return hint === 'joomla'
141
+ ? new JoomlaPlatform(baseUrl)
142
+ : new WordPressPlatform(baseUrl);
143
+ }
144
+ // 2. Static URL-shape heuristic.
145
+ const detected = detectPlatformFromUrl(baseUrl);
146
+ if (detected !== null) {
147
+ return detected === 'joomla'
148
+ ? new JoomlaPlatform(baseUrl)
149
+ : new WordPressPlatform(baseUrl);
150
+ }
151
+ // 3. Runtime probe. Lazy-imported so the sync `platformForUrl`
152
+ // barrel above stays free of any fetch dependency for callers
153
+ // that do not opt-in.
154
+ const probe = opts.probe
155
+ ?? (async (url) => {
156
+ const mod = await import('./detect.js');
157
+ return mod.detectPlatformAtRuntime(url);
158
+ });
159
+ const probed = await probe(baseUrl);
160
+ if (probed !== null) {
161
+ return probed === 'joomla'
162
+ ? new JoomlaPlatform(baseUrl)
163
+ : new WordPressPlatform(baseUrl);
164
+ }
165
+ // 4. Final fallback — emit a single soft note so the user knows
166
+ // we tried and that explicit YTB_MCP_PLATFORM may rescue.
167
+ const logger = opts.logger
168
+ ?? ((msg) => {
169
+ process.stderr.write(msg);
170
+ });
171
+ logger('[yt-builder-mcp] notice: platform auto-detection probe failed for '
172
+ + `${baseUrl} — falling back to wordpress. Set YTB_MCP_PLATFORM=joomla `
173
+ + 'if this is a Joomla install.\n');
174
+ return new WordPressPlatform(baseUrl);
175
+ }
38
176
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkBH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACV,IAAI,GAAG,WAAoB,CAAC;IAC5B,OAAO,CAAS;IAChB,iBAAiB,CAAS;IAE1C,YAAY,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,6BAA6B,CAAC;IAC3D,CAAC;CACJ"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/platform/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkBH,+DAA+D;AAC/D,MAAM,CAAC,MAAM,6BAA6B,GAAG,4BAA4B,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,OAAO,iBAAiB;IACV,IAAI,GAAG,WAAoB,CAAC;IAC5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AAM,GACR,IAAI,CAAC,MAAM;WACR,CAAC,CAAC,GAAW,EAAE,EAAE;YAChB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,CAAC,CAAC;IACP,MAAM,CACF,oEAAoE;UAC9D,GAAG,OAAO,4DAA4D;UACtE,gCAAgC,CACzC,CAAC;IACF,OAAO,IAAI,iBAAiB,CAAC,OAAO,CAAC,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Joomla 5/6 platform implementation — Wave 7 prep.
3
+ *
4
+ * Mirrors {@link WordPressPlatform} but targets the Joomla Web Services
5
+ * API surface registered by `plg_system_ytbmcp` (see
6
+ * `src/packaging/joomla/extensions/plg_system_ytbmcp/src/Extension/Ytbmcp.php`
7
+ * — `onBeforeApiRoute()` mounts the routes under
8
+ * `v1/yt-builder-mcp/...` against `com_ytbmcp`).
9
+ *
10
+ * The full request URL composed by {@link RestClient} is:
11
+ *
12
+ * {baseUrl}/api/index.php/v1/yt-builder-mcp/{path}
13
+ *
14
+ * — where `{baseUrl}` is the Joomla site origin (e.g. `https://example.com`
15
+ * or `https://example.com/joomla` for a subfolder install) and `{path}`
16
+ * is the per-tool REST path (e.g. `/health`, `/pages`, `/etag`).
17
+ *
18
+ * Cookbook Ch1 Finding 2: the `PlatformKind` union already declared
19
+ * `'joomla'` in Wave G.0; this class fills the seam so no tool handler
20
+ * has to change.
21
+ *
22
+ * Cookbook §3.7 (cross-platform parity): the REST byte-shape returned
23
+ * by every endpoint is identical across platforms — only the route
24
+ * prefix differs.
25
+ *
26
+ * @license MIT
27
+ */
28
+ import type { Platform } from './index.js';
29
+ /** Canonical Joomla REST namespace prefix for this plugin. */
30
+ export declare const JOOMLA_REST_NAMESPACE_PATH = "/api/index.php/v1/yt-builder-mcp";
31
+ /**
32
+ * Joomla platform implementation.
33
+ *
34
+ * `restNamespacePath` is fixed to the Web Services API mount point that
35
+ * `plg_system_ytbmcp::onBeforeApiRoute()` registers; the caller supplies
36
+ * only the site origin.
37
+ */
38
+ export declare class JoomlaPlatform implements Platform {
39
+ readonly kind: "joomla";
40
+ readonly baseUrl: string;
41
+ readonly restNamespacePath: string;
42
+ constructor(baseUrl: string);
43
+ }
44
+ //# sourceMappingURL=joomla.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joomla.d.ts","sourceRoot":"","sources":["../../src/platform/joomla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,8DAA8D;AAC9D,eAAO,MAAM,0BAA0B,qCAAqC,CAAC;AAE7E;;;;;;GAMG;AACH,qBAAa,cAAe,YAAW,QAAQ;IAC3C,SAAgB,IAAI,EAAG,QAAQ,CAAU;IACzC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,iBAAiB,EAAE,MAAM,CAAC;gBAE9B,OAAO,EAAE,MAAM;CAI9B"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Joomla 5/6 platform implementation — Wave 7 prep.
3
+ *
4
+ * Mirrors {@link WordPressPlatform} but targets the Joomla Web Services
5
+ * API surface registered by `plg_system_ytbmcp` (see
6
+ * `src/packaging/joomla/extensions/plg_system_ytbmcp/src/Extension/Ytbmcp.php`
7
+ * — `onBeforeApiRoute()` mounts the routes under
8
+ * `v1/yt-builder-mcp/...` against `com_ytbmcp`).
9
+ *
10
+ * The full request URL composed by {@link RestClient} is:
11
+ *
12
+ * {baseUrl}/api/index.php/v1/yt-builder-mcp/{path}
13
+ *
14
+ * — where `{baseUrl}` is the Joomla site origin (e.g. `https://example.com`
15
+ * or `https://example.com/joomla` for a subfolder install) and `{path}`
16
+ * is the per-tool REST path (e.g. `/health`, `/pages`, `/etag`).
17
+ *
18
+ * Cookbook Ch1 Finding 2: the `PlatformKind` union already declared
19
+ * `'joomla'` in Wave G.0; this class fills the seam so no tool handler
20
+ * has to change.
21
+ *
22
+ * Cookbook §3.7 (cross-platform parity): the REST byte-shape returned
23
+ * by every endpoint is identical across platforms — only the route
24
+ * prefix differs.
25
+ *
26
+ * @license MIT
27
+ */
28
+ /** Canonical Joomla REST namespace prefix for this plugin. */
29
+ export const JOOMLA_REST_NAMESPACE_PATH = '/api/index.php/v1/yt-builder-mcp';
30
+ /**
31
+ * Joomla platform implementation.
32
+ *
33
+ * `restNamespacePath` is fixed to the Web Services API mount point that
34
+ * `plg_system_ytbmcp::onBeforeApiRoute()` registers; the caller supplies
35
+ * only the site origin.
36
+ */
37
+ export class JoomlaPlatform {
38
+ kind = 'joomla';
39
+ baseUrl;
40
+ restNamespacePath;
41
+ constructor(baseUrl) {
42
+ this.baseUrl = baseUrl;
43
+ this.restNamespacePath = JOOMLA_REST_NAMESPACE_PATH;
44
+ }
45
+ }
46
+ //# sourceMappingURL=joomla.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"joomla.js","sourceRoot":"","sources":["../../src/platform/joomla.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,8DAA8D;AAC9D,MAAM,CAAC,MAAM,0BAA0B,GAAG,kCAAkC,CAAC;AAE7E;;;;;;GAMG;AACH,MAAM,OAAO,cAAc;IACP,IAAI,GAAG,QAAiB,CAAC;IACzB,OAAO,CAAS;IAChB,iBAAiB,CAAS;IAE1C,YAAY,OAAe;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,iBAAiB,GAAG,0BAA0B,CAAC;IACxD,CAAC;CACJ"}