@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/server.d.ts CHANGED
@@ -29,13 +29,72 @@
29
29
  * @license MIT
30
30
  */
31
31
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
32
- import type { RestClient } from './client.js';
33
32
  import { CapturingServer } from './gateway/capturing-server.js';
33
+ import type { ClientPool } from './sites/client-pool.js';
34
+ import type { SiteRegistry } from './sites/registry.js';
34
35
  import { type ToolDefinition } from './tools/index.js';
35
36
  export declare const SERVER_NAME = "@wootsup/yt-builder-mcp";
36
37
  export declare const SERVER_VERSION = "0.2.0-alpha.2";
38
+ /**
39
+ * W8 — stable URI under which the live sites snapshot is exposed via
40
+ * MCP `resources/*`. Single fixed resource (no list-changed needed) —
41
+ * MCP hosts can fetch the current registry roster on demand without
42
+ * having to invoke a tool.
43
+ */
44
+ export declare const SITES_RESOURCE_URI = "sites://current";
45
+ /** Human-readable resource name surfaced in `resources/list`. */
46
+ export declare const SITES_RESOURCE_NAME = "Currently configured sites";
47
+ /** Short description for `resources/list` consumers. */
48
+ export declare const SITES_RESOURCE_DESCRIPTION: string;
49
+ /** MIME type for the `sites://current` payload. */
50
+ export declare const SITES_RESOURCE_MIME_TYPE = "application/json";
51
+ /**
52
+ * Bearer-redacted JSON payload shape for the W8 `sites://current`
53
+ * resource. Mirrors the structured-content shape of the
54
+ * `yootheme_builder_sites_list` tool but never reveals bearer or
55
+ * bearer_ref — only safe-to-render display fields land in the
56
+ * `sites[]` rows.
57
+ */
58
+ export interface SitesResourcePayload {
59
+ readonly default_site_id: string | null;
60
+ readonly sites: readonly SitesResourceRow[];
61
+ }
62
+ /**
63
+ * One row inside {@link SitesResourcePayload.sites}. Strictly the
64
+ * fields enumerated by plan §W8 Z.929 — no bearer / bearer_ref /
65
+ * bearer_source. `label` and `platform_resolved` are optional (only
66
+ * present when the underlying registry entry / probe carries them).
67
+ */
68
+ export interface SitesResourceRow {
69
+ readonly site_id: string;
70
+ readonly url: string;
71
+ readonly platform: 'wordpress' | 'joomla' | 'auto';
72
+ readonly is_default: boolean;
73
+ readonly label?: string;
74
+ }
75
+ /**
76
+ * Build the JSON payload served by the `sites://current` resource.
77
+ *
78
+ * Field projection (per plan §W8 Z.925-933):
79
+ * - `default_site_id` from {@link SiteRegistry.defaultSiteId}.
80
+ * - `sites[].site_id` / `url` / `is_default` / `label` verbatim.
81
+ * - `sites[].platform` prefers the resolved kind from the W3 memo
82
+ * cache (peek-only, no probe) and falls back to the configured
83
+ * hint when no probe has run.
84
+ *
85
+ * Bearer fields are NEVER referenced. The `bearer_source` hint that
86
+ * the W7 `sites_list` tool exposes is intentionally omitted from this
87
+ * resource: even the "plain" vs "op" hint hints at storage layout,
88
+ * and the resource is positioned as a host-facing public roster.
89
+ */
90
+ export declare function buildSitesResourcePayload(registry: SiteRegistry): SitesResourcePayload;
37
91
  export interface CreateServerOptions {
38
- readonly client: RestClient;
92
+ /**
93
+ * Multi-site client pool — replaces the single `client` parameter
94
+ * shipped pre-W6. Each tool handler asks `pool.resolve(site_id)`
95
+ * for the per-call REST client + resolved site descriptor.
96
+ */
97
+ readonly pool: ClientPool;
39
98
  /** Override the tool set (defaults to `buildAllTools`). */
40
99
  readonly tools?: readonly ToolDefinition[];
41
100
  }
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGpE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,eAAe,EAAsB,MAAM,+BAA+B,CAAC;AAUpF,OAAO,EAAiB,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEtE,eAAO,MAAM,WAAW,4BAA4B,CAAC;AACrD,eAAO,MAAM,cAAc,kBAAkB,CAAC;AAE9C,MAAM,WAAW,mBAAmB;IAChC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;IAC5B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;CACvC;AAED,wBAAgB,YAAY,CAAC,O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AAgB,yBAAyB,CACrC,QAAQ,EAAE,YAAY,GACvB,oBAAoB,CAmBtB;AAED,MAAM,WAAW,mBAAmB;IAChC;;;;OAIG;IACH,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAC1B,2DAA2D;IAC3D,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,cAAc,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,GAAG,EAAE,SAAS,CAAC;IACxB,gFAAgF;IAChF,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IAC1C,qEAAqE;IACrE,QAAQ,CAAC,SAAS,EAAE,eAAe,CAAC;CACvC;AAED,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,aAAa,CAuIxE"}
package/dist/server.js CHANGED
@@ -37,6 +37,55 @@ import { toElicitationCapability } from './tools/elicitation.js';
37
37
  import { buildAllTools } from './tools/index.js';
38
38
  export const SERVER_NAME = '@wootsup/yt-builder-mcp';
39
39
  export const SERVER_VERSION = '0.2.0-alpha.2';
40
+ /**
41
+ * W8 — stable URI under which the live sites snapshot is exposed via
42
+ * MCP `resources/*`. Single fixed resource (no list-changed needed) —
43
+ * MCP hosts can fetch the current registry roster on demand without
44
+ * having to invoke a tool.
45
+ */
46
+ export const SITES_RESOURCE_URI = 'sites://current';
47
+ /** Human-readable resource name surfaced in `resources/list`. */
48
+ export const SITES_RESOURCE_NAME = 'Currently configured sites';
49
+ /** Short description for `resources/list` consumers. */
50
+ export const SITES_RESOURCE_DESCRIPTION = 'Live snapshot of sites wired into this MCP server (site_id, URL, ' +
51
+ 'platform, default flag, label). Bearer fields are redacted. ' +
52
+ 'Mirrors what `yootheme_builder_sites_list` would print.';
53
+ /** MIME type for the `sites://current` payload. */
54
+ export const SITES_RESOURCE_MIME_TYPE = 'application/json';
55
+ /**
56
+ * Build the JSON payload served by the `sites://current` resource.
57
+ *
58
+ * Field projection (per plan §W8 Z.925-933):
59
+ * - `default_site_id` from {@link SiteRegistry.defaultSiteId}.
60
+ * - `sites[].site_id` / `url` / `is_default` / `label` verbatim.
61
+ * - `sites[].platform` prefers the resolved kind from the W3 memo
62
+ * cache (peek-only, no probe) and falls back to the configured
63
+ * hint when no probe has run.
64
+ *
65
+ * Bearer fields are NEVER referenced. The `bearer_source` hint that
66
+ * the W7 `sites_list` tool exposes is intentionally omitted from this
67
+ * resource: even the "plain" vs "op" hint hints at storage layout,
68
+ * and the resource is positioned as a host-facing public roster.
69
+ */
70
+ export function buildSitesResourcePayload(registry) {
71
+ const rows = registry.listForDisplay();
72
+ return {
73
+ default_site_id: registry.defaultSiteId(),
74
+ sites: rows.map((row) => {
75
+ const platform = row.platform_resolved ?? row.platform_hint;
76
+ const out = {
77
+ site_id: row.site_id,
78
+ url: row.url,
79
+ platform,
80
+ is_default: row.is_default,
81
+ };
82
+ if (row.label !== undefined) {
83
+ out.label = row.label;
84
+ }
85
+ return out;
86
+ }),
87
+ };
88
+ }
40
89
  export function createServer(options) {
41
90
  // Stream B1 — Skill-Distribution via MCP-Protocol.
42
91
  //
@@ -53,7 +102,14 @@ export function createServer(options) {
53
102
  //
54
103
  // Reading SKILL.md is synchronous (small file, ~17 KB) and cached
55
104
  // after first call by `loadSkillContent` — no async cost.
56
- const instructions = loadSkillContent();
105
+ //
106
+ // W8 — pass the pool's registry so loadSkillContent can append the
107
+ // live "Currently configured sites" block. When the registry is
108
+ // empty (fresh install, no sites yet) the appendix is silently
109
+ // omitted and the host receives the unchanged skill content.
110
+ // Bearer fields are never touched by the appendix (see
111
+ // {@link appendSitesBlock} in skill-loader.ts).
112
+ const instructions = loadSkillContent(options.pool.registry);
57
113
  const mcp = new McpServer({
58
114
  name: SERVER_NAME,
59
115
  version: SERVER_VERSION,
@@ -77,6 +133,34 @@ export function createServer(options) {
77
133
  },
78
134
  ],
79
135
  }));
136
+ // W8 — `sites://current` resource: live registry snapshot as JSON.
137
+ //
138
+ // The payload is computed on every read (cheap — listForDisplay()
139
+ // is in-memory) so hosts that re-fetch after a sites file edit see
140
+ // up-to-date data. We do NOT emit `notifications/resources/updated`
141
+ // since the only mutation path is the W9 CLI which itself requires
142
+ // an AI-client restart (per plan §W8 line 919) — the resource is
143
+ // structurally static for the lifetime of the MCP session.
144
+ //
145
+ // Bearer / bearer_ref are NEVER referenced (see
146
+ // {@link buildSitesResourcePayload}). The resource intentionally
147
+ // omits the `bearer_source` hint that the `sites_list` tool
148
+ // surfaces; a host-facing roster should not even hint at storage
149
+ // layout.
150
+ const registry = options.pool.registry;
151
+ mcp.registerResource(SITES_RESOURCE_NAME, SITES_RESOURCE_URI, {
152
+ title: SITES_RESOURCE_NAME,
153
+ description: SITES_RESOURCE_DESCRIPTION,
154
+ mimeType: SITES_RESOURCE_MIME_TYPE,
155
+ }, async (uri) => ({
156
+ contents: [
157
+ {
158
+ uri: uri.toString(),
159
+ mimeType: SITES_RESOURCE_MIME_TYPE,
160
+ text: JSON.stringify(buildSitesResourcePayload(registry), null, 2),
161
+ },
162
+ ],
163
+ }));
80
164
  // Wave G.4.5 — MCP elicitation capability wiring.
81
165
  //
82
166
  // `toElicitationCapability(mcp)` bridges the SDK's stricter
@@ -89,7 +173,7 @@ export function createServer(options) {
89
173
  // `elicitConfirmation` return `null` / `false` and the tool falls
90
174
  // back to the structured-error / preview path (no hang, no guess).
91
175
  const elicitation = toElicitationCapability(mcp);
92
- const tools = options.tools ?? buildAllTools(options.client, { elicitation });
176
+ const tools = options.tools ?? buildAllTools(options.pool, { elicitation });
93
177
  // L3 — direct top-level: registered FIRST on the real McpServer, before
94
178
  // the CapturingServer wraps it. These names get a no-op route inside
95
179
  // the CapturingServer (see capturing-server.ts), so the SDK never sees
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;A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E,KAAK,EAAE,SAAS,EAAE,CAAC;AACrC,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,cAAc,CAAC,SAAwB,EAAE,IAAoB;IAClE,sEAAsE;IACtE,wEAAwE;IACxE,sEAAsE;IACtE,MAAM,WAAW,GAAG,IAAI,CAAC,WAAgC,CAAC;IAE1D,wEAAwE;IACxE,wEAAwE;IACxE,yEAAyE;IACzE,qEAAqE;IACrE,iCAAiC;IACjC,MAAM,YAAY,GACd,IAAI,CAAC,YAAY,KAAK,SAAS;QAC3B,CAAC,CAAE,IAAI,CAAC,YAA6C;QACrD,CAAC,CAAC,SAAS,CAAC;IAEpB,SAAS,CAAC,YAAY,CAClB,IAAI,CAAC,IAAI,EACT;QACI,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,WAAW;QACX,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,WAAW,EAAE,IAAI,CAAC,WAAW;KAChC;IACD,oEAAoE;IACpE,+DAA+D;IAC/D,iEAAiE;IACjE,iEAAiE;IACjE,kEAAkE;IAClE,8DAA8D;IAC9D,4IAA4I;IAC5I,CAAC,KAAK,EAAE,IAAS,EAAE,KAAU,EAAE,EAAE;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACrC,CAAC,CAAU,CACd,CAAC;AACN,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * W12-R2A — TTY confirm prompt for destructive CLI subcommands.
3
+ *
4
+ * Hosts `confirmTTY(prompt)`, the y/N readline callback the W9
5
+ * dispatcher wires into the `removeSiteCommand` / `setDefaultCommand`
6
+ * deps bag. Lives in its own file so the dispatcher stays a thin
7
+ * routing layer and so tests can mock the prompt without touching the
8
+ * subcommand factories.
9
+ *
10
+ * Contract:
11
+ *
12
+ * - Returns `true` ONLY when stdin is a TTY AND the operator types
13
+ * "y", "Y", or "yes" (case-insensitive). Anything else (incl. EOF,
14
+ * empty line, Ctrl-D) returns `false` → caller treats this as a
15
+ * cancel and skips the write.
16
+ *
17
+ * - When stdin is NOT a TTY (CI, piped input, MCP-server stdio), the
18
+ * function does NOT block — it returns `false` immediately and
19
+ * writes a one-line hint to stderr telling the operator to pass
20
+ * `--yes` for non-interactive use. The dispatcher then surfaces a
21
+ * typed `CONFIRM_REQUIRED` / `SET_DEFAULT_CONFIRM_REQUIRED` error
22
+ * via the subcommand factory (which fails closed when no confirm
23
+ * hook AND no --yes is in play).
24
+ *
25
+ * - No external deps; uses Node's built-in `node:readline` so the
26
+ * package keeps the same dep-graph as Round-1.
27
+ *
28
+ * @license MIT
29
+ */
30
+ /**
31
+ * Read one line via readline and resolve `true` on y/Y/yes,
32
+ * `false` otherwise. Stdin-not-a-TTY short-circuits to `false` with a
33
+ * stderr hint so a piped invocation can't silently hang.
34
+ */
35
+ export declare function confirmTTY(prompt: string): Promise<boolean>;
36
+ //# sourceMappingURL=setup-cli-confirm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-cli-confirm.d.ts","sourceRoot":"","sources":["../src/setup-cli-confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH;;;;GAIG;AACH,wBAAsB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBjE"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * W12-R2A — TTY confirm prompt for destructive CLI subcommands.
3
+ *
4
+ * Hosts `confirmTTY(prompt)`, the y/N readline callback the W9
5
+ * dispatcher wires into the `removeSiteCommand` / `setDefaultCommand`
6
+ * deps bag. Lives in its own file so the dispatcher stays a thin
7
+ * routing layer and so tests can mock the prompt without touching the
8
+ * subcommand factories.
9
+ *
10
+ * Contract:
11
+ *
12
+ * - Returns `true` ONLY when stdin is a TTY AND the operator types
13
+ * "y", "Y", or "yes" (case-insensitive). Anything else (incl. EOF,
14
+ * empty line, Ctrl-D) returns `false` → caller treats this as a
15
+ * cancel and skips the write.
16
+ *
17
+ * - When stdin is NOT a TTY (CI, piped input, MCP-server stdio), the
18
+ * function does NOT block — it returns `false` immediately and
19
+ * writes a one-line hint to stderr telling the operator to pass
20
+ * `--yes` for non-interactive use. The dispatcher then surfaces a
21
+ * typed `CONFIRM_REQUIRED` / `SET_DEFAULT_CONFIRM_REQUIRED` error
22
+ * via the subcommand factory (which fails closed when no confirm
23
+ * hook AND no --yes is in play).
24
+ *
25
+ * - No external deps; uses Node's built-in `node:readline` so the
26
+ * package keeps the same dep-graph as Round-1.
27
+ *
28
+ * @license MIT
29
+ */
30
+ import { createInterface } from 'node:readline';
31
+ /**
32
+ * Read one line via readline and resolve `true` on y/Y/yes,
33
+ * `false` otherwise. Stdin-not-a-TTY short-circuits to `false` with a
34
+ * stderr hint so a piped invocation can't silently hang.
35
+ */
36
+ export async function confirmTTY(prompt) {
37
+ // process.stdin.isTTY is `true | undefined` per Node's typings —
38
+ // explicit !== true guards against both undefined and false.
39
+ if (process.stdin.isTTY !== true) {
40
+ process.stderr.write('yt-builder-mcp: no TTY available for confirmation. '
41
+ + 'Pass --yes to run this subcommand non-interactively.\n');
42
+ return false;
43
+ }
44
+ const rl = createInterface({
45
+ input: process.stdin,
46
+ output: process.stderr,
47
+ });
48
+ try {
49
+ const answer = await new Promise((resolve) => {
50
+ rl.question(`${prompt} [y/N] `, (line) => resolve(line));
51
+ });
52
+ const normalised = answer.trim().toLowerCase();
53
+ return normalised === 'y' || normalised === 'yes';
54
+ }
55
+ finally {
56
+ rl.close();
57
+ }
58
+ }
59
+ //# sourceMappingURL=setup-cli-confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-cli-confirm.js","sourceRoot":"","sources":["../src/setup-cli-confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAEhD;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,MAAc;IAC3C,iEAAiE;IACjE,6DAA6D;IAC7D,IAAI,OAAO,CAAC,KAAK,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,CAAC,MAAM,CAAC,KAAK,CAChB,qDAAqD;cAC/C,wDAAwD,CACjE,CAAC;QACF,OAAO,KAAK,CAAC;IACjB,CAAC;IACD,MAAM,EAAE,GAAG,eAAe,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACzB,CAAC,CAAC;IACH,IAAI,CAAC;QACD,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;YACjD,EAAE,CAAC,QAAQ,CAAC,GAAG,MAAM,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;QAC/C,OAAO,UAAU,KAAK,GAAG,IAAI,UAAU,KAAK,KAAK,CAAC;IACtD,CAAC;YAAS,CAAC;QACP,EAAE,CAAC,KAAK,EAAE,CAAC;IACf,CAAC;AACL,CAAC"}
@@ -23,11 +23,16 @@
23
23
  */
24
24
  import { installSkill as defaultInstallSkill } from './install-skill.js';
25
25
  import type { WizardDeps } from './setup-wizard-types.js';
26
+ import { type AddSiteArgs, type AddSiteDeps, type AddSiteResult } from './sites/cli/add-site.js';
27
+ import { type ListSitesDeps } from './sites/cli/list-sites.js';
28
+ import { type RemoveSiteDeps } from './sites/cli/remove-site.js';
29
+ import { type SetDefaultDeps } from './sites/cli/set-default.js';
30
+ import { type TestSiteDeps } from './sites/cli/test-site.js';
26
31
  export { DEFAULT_WIZARD_DEPS, majorMinor, runWizard, type AuthProbeResult, type HandshakeResult, type HealthProbeResult, type WizardAnswers, type WizardDeps, type WriteResult, } from './setup-wizard.js';
27
32
  export interface ParsedSetupArgs {
28
33
  /** True when `--non-interactive` was passed. Always boolean. */
29
34
  readonly nonInteractive: boolean;
30
- /** WordPress base URL from `--url`, trailing slash stripped, trimmed. */
35
+ /** Site base URL from `--url` (WordPress or Joomla), trailing slash stripped, trimmed. */
31
36
  readonly url: string;
32
37
  /** Bearer token from `--token`, trimmed. */
33
38
  readonly token: string;
@@ -85,6 +90,28 @@ export declare function buildNonInteractiveDeps(parsed: ParsedSetupArgs, base?:
85
90
  * `confirmContinue` returns `false` (same rationale as non-interactive).
86
91
  */
87
92
  export declare function buildPickupDeps(parsed: ParsedSetupArgs, base?: WizardDeps): WizardDeps;
93
+ /**
94
+ * Parsed shape for the `add-site` subcommand. Pure-data; tests
95
+ * exercise this without filesystem deps.
96
+ */
97
+ export interface ParsedAddSiteArgs {
98
+ readonly url: string;
99
+ readonly token: string;
100
+ readonly tokenRef: string;
101
+ readonly platform?: 'auto' | 'wordpress' | 'joomla';
102
+ readonly label: string;
103
+ readonly siteId: string;
104
+ readonly default: boolean;
105
+ readonly yes: boolean;
106
+ readonly sitesFile?: string;
107
+ readonly errors: readonly string[];
108
+ }
109
+ /**
110
+ * Parse `add-site` flags from the tail of argv. Accepts both
111
+ * `--key value` and `--key=value` styles. Unknown flags are reported
112
+ * as errors so typos never silently disable validation.
113
+ */
114
+ export declare function parseAddSiteArgs(argv: readonly string[]): ParsedAddSiteArgs;
88
115
  export interface RunCliDeps {
89
116
  /**
90
117
  * Wizard runner. The optional deps bag lets the non-interactive
@@ -95,6 +122,31 @@ export interface RunCliDeps {
95
122
  installSkill: typeof defaultInstallSkill;
96
123
  log?: (line: string) => void;
97
124
  error?: (line: string) => void;
125
+ /** Test injection — override the resolved sites.json path. */
126
+ resolveSitesPath?: () => string;
127
+ addSiteDeps?: AddSiteDeps;
128
+ listSitesDeps?: ListSitesDeps;
129
+ removeSiteDeps?: RemoveSiteDeps;
130
+ setDefaultDeps?: SetDefaultDeps;
131
+ testSiteDeps?: TestSiteDeps;
132
+ /**
133
+ * W12-R2A — y/N prompt for destructive subcommands (remove-site,
134
+ * set-default). Defaults to {@link defaultConfirmTTY} which reads
135
+ * from process.stdin via readline. Tests inject a stub.
136
+ *
137
+ * Note: when the operator passes `--yes`, this hook is NEVER
138
+ * invoked — the subcommand factory short-circuits before reaching
139
+ * the confirm step. When `--yes` is absent AND no confirm hook is
140
+ * injectable (CI / piped stdin), the factory throws a typed
141
+ * CONFIRM_REQUIRED / SET_DEFAULT_CONFIRM_REQUIRED error.
142
+ */
143
+ confirm?: (message: string) => Promise<boolean>;
144
+ /**
145
+ * Optional override for the post-wizard `addSiteCommand` call.
146
+ * Tests stub this to assert the wizard wires through addSiteCommand
147
+ * without writing to disk.
148
+ */
149
+ addSiteFromWizard?: (args: AddSiteArgs, path: string) => Promise<AddSiteResult>;
98
150
  }
99
151
  export declare function runCli(argv: readonly string[], deps?: Partial<RunCliDeps>): Promise<number>;
100
152
  //# sourceMappingURL=setup-cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setup-cli.d.ts","sourceRoot":"","sources":["../src/setup-cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,YAAY,IAAI,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIzE,OAAO,EACH,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,KAAK,eAAe,EACpB,KAAK,eAAe,EACpB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,WAAW,GACnB,MAAM,mBAAmB,CAAC;AAyD3B,MAAM,WAAW,eAAe;IAC5B,gEAAgE;IAChE,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,GAAG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