@wootsup/yt-builder-mcp 0.2.0-alpha.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (299) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +221 -0
  3. package/bin/yt-builder-mcp.js +59 -0
  4. package/dist/auth.d.ts +39 -0
  5. package/dist/auth.d.ts.map +1 -0
  6. package/dist/auth.js +93 -0
  7. package/dist/auth.js.map +1 -0
  8. package/dist/client.d.ts +84 -0
  9. package/dist/client.d.ts.map +1 -0
  10. package/dist/client.js +151 -0
  11. package/dist/client.js.map +1 -0
  12. package/dist/clients/claude-code.d.ts +18 -0
  13. package/dist/clients/claude-code.d.ts.map +1 -0
  14. package/dist/clients/claude-code.js +53 -0
  15. package/dist/clients/claude-code.js.map +1 -0
  16. package/dist/clients/claude-desktop.d.ts +19 -0
  17. package/dist/clients/claude-desktop.d.ts.map +1 -0
  18. package/dist/clients/claude-desktop.js +56 -0
  19. package/dist/clients/claude-desktop.js.map +1 -0
  20. package/dist/clients/cline.d.ts +26 -0
  21. package/dist/clients/cline.d.ts.map +1 -0
  22. package/dist/clients/cline.js +80 -0
  23. package/dist/clients/cline.js.map +1 -0
  24. package/dist/clients/codex-cli.d.ts +42 -0
  25. package/dist/clients/codex-cli.d.ts.map +1 -0
  26. package/dist/clients/codex-cli.js +194 -0
  27. package/dist/clients/codex-cli.js.map +1 -0
  28. package/dist/clients/continue.d.ts +13 -0
  29. package/dist/clients/continue.d.ts.map +1 -0
  30. package/dist/clients/continue.js +52 -0
  31. package/dist/clients/continue.js.map +1 -0
  32. package/dist/clients/cursor.d.ts +12 -0
  33. package/dist/clients/cursor.d.ts.map +1 -0
  34. package/dist/clients/cursor.js +38 -0
  35. package/dist/clients/cursor.js.map +1 -0
  36. package/dist/clients/gemini-cli.d.ts +18 -0
  37. package/dist/clients/gemini-cli.d.ts.map +1 -0
  38. package/dist/clients/gemini-cli.js +44 -0
  39. package/dist/clients/gemini-cli.js.map +1 -0
  40. package/dist/clients/home.d.ts +14 -0
  41. package/dist/clients/home.d.ts.map +1 -0
  42. package/dist/clients/home.js +20 -0
  43. package/dist/clients/home.js.map +1 -0
  44. package/dist/clients/index.d.ts +52 -0
  45. package/dist/clients/index.d.ts.map +1 -0
  46. package/dist/clients/index.js +72 -0
  47. package/dist/clients/index.js.map +1 -0
  48. package/dist/clients/roo-code.d.ts +23 -0
  49. package/dist/clients/roo-code.d.ts.map +1 -0
  50. package/dist/clients/roo-code.js +69 -0
  51. package/dist/clients/roo-code.js.map +1 -0
  52. package/dist/clients/zed.d.ts +12 -0
  53. package/dist/clients/zed.d.ts.map +1 -0
  54. package/dist/clients/zed.js +41 -0
  55. package/dist/clients/zed.js.map +1 -0
  56. package/dist/errors/hints.d.ts +51 -0
  57. package/dist/errors/hints.d.ts.map +1 -0
  58. package/dist/errors/hints.js +95 -0
  59. package/dist/errors/hints.js.map +1 -0
  60. package/dist/errors/mask.d.ts +35 -0
  61. package/dist/errors/mask.d.ts.map +1 -0
  62. package/dist/errors/mask.js +49 -0
  63. package/dist/errors/mask.js.map +1 -0
  64. package/dist/errors/sanitize.d.ts +31 -0
  65. package/dist/errors/sanitize.d.ts.map +1 -0
  66. package/dist/errors/sanitize.js +90 -0
  67. package/dist/errors/sanitize.js.map +1 -0
  68. package/dist/errors.d.ts +42 -0
  69. package/dist/errors.d.ts.map +1 -0
  70. package/dist/errors.js +61 -0
  71. package/dist/errors.js.map +1 -0
  72. package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
  73. package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
  74. package/dist/gateway/advanced-tool/discovery.js +53 -0
  75. package/dist/gateway/advanced-tool/discovery.js.map +1 -0
  76. package/dist/gateway/advanced-tool/domains.d.ts +42 -0
  77. package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
  78. package/dist/gateway/advanced-tool/domains.js +88 -0
  79. package/dist/gateway/advanced-tool/domains.js.map +1 -0
  80. package/dist/gateway/advanced-tool/execute.d.ts +29 -0
  81. package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
  82. package/dist/gateway/advanced-tool/execute.js +54 -0
  83. package/dist/gateway/advanced-tool/execute.js.map +1 -0
  84. package/dist/gateway/advanced-tool/index.d.ts +36 -0
  85. package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
  86. package/dist/gateway/advanced-tool/index.js +39 -0
  87. package/dist/gateway/advanced-tool/index.js.map +1 -0
  88. package/dist/gateway/advanced-tool/register.d.ts +18 -0
  89. package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
  90. package/dist/gateway/advanced-tool/register.js +62 -0
  91. package/dist/gateway/advanced-tool/register.js.map +1 -0
  92. package/dist/gateway/advanced-tool.d.ts +13 -0
  93. package/dist/gateway/advanced-tool.d.ts.map +1 -0
  94. package/dist/gateway/advanced-tool.js +13 -0
  95. package/dist/gateway/advanced-tool.js.map +1 -0
  96. package/dist/gateway/capturing-server.d.ts +117 -0
  97. package/dist/gateway/capturing-server.d.ts.map +1 -0
  98. package/dist/gateway/capturing-server.js +103 -0
  99. package/dist/gateway/capturing-server.js.map +1 -0
  100. package/dist/gateway/essentials.d.ts +49 -0
  101. package/dist/gateway/essentials.d.ts.map +1 -0
  102. package/dist/gateway/essentials.js +62 -0
  103. package/dist/gateway/essentials.js.map +1 -0
  104. package/dist/gateway/test-support.d.ts +41 -0
  105. package/dist/gateway/test-support.d.ts.map +1 -0
  106. package/dist/gateway/test-support.js +60 -0
  107. package/dist/gateway/test-support.js.map +1 -0
  108. package/dist/index.d.ts +25 -0
  109. package/dist/index.d.ts.map +1 -0
  110. package/dist/index.js +77 -0
  111. package/dist/index.js.map +1 -0
  112. package/dist/install-skill.d.ts +35 -0
  113. package/dist/install-skill.d.ts.map +1 -0
  114. package/dist/install-skill.js +107 -0
  115. package/dist/install-skill.js.map +1 -0
  116. package/dist/platform/index.d.ts +49 -0
  117. package/dist/platform/index.d.ts.map +1 -0
  118. package/dist/platform/index.js +38 -0
  119. package/dist/platform/index.js.map +1 -0
  120. package/dist/server.d.ts +50 -0
  121. package/dist/server.d.ts.map +1 -0
  122. package/dist/server.js +117 -0
  123. package/dist/server.js.map +1 -0
  124. package/dist/setup-cli.d.ts +100 -0
  125. package/dist/setup-cli.d.ts.map +1 -0
  126. package/dist/setup-cli.js +355 -0
  127. package/dist/setup-cli.js.map +1 -0
  128. package/dist/setup-prompts.d.ts +41 -0
  129. package/dist/setup-prompts.d.ts.map +1 -0
  130. package/dist/setup-prompts.js +142 -0
  131. package/dist/setup-prompts.js.map +1 -0
  132. package/dist/setup-token.d.ts +38 -0
  133. package/dist/setup-token.d.ts.map +1 -0
  134. package/dist/setup-token.js +106 -0
  135. package/dist/setup-token.js.map +1 -0
  136. package/dist/setup-wizard-defaults.d.ts +43 -0
  137. package/dist/setup-wizard-defaults.d.ts.map +1 -0
  138. package/dist/setup-wizard-defaults.js +160 -0
  139. package/dist/setup-wizard-defaults.js.map +1 -0
  140. package/dist/setup-wizard-handshake.d.ts +25 -0
  141. package/dist/setup-wizard-handshake.d.ts.map +1 -0
  142. package/dist/setup-wizard-handshake.js +103 -0
  143. package/dist/setup-wizard-handshake.js.map +1 -0
  144. package/dist/setup-wizard-types.d.ts +148 -0
  145. package/dist/setup-wizard-types.d.ts.map +1 -0
  146. package/dist/setup-wizard-types.js +11 -0
  147. package/dist/setup-wizard-types.js.map +1 -0
  148. package/dist/setup-wizard.d.ts +33 -0
  149. package/dist/setup-wizard.d.ts.map +1 -0
  150. package/dist/setup-wizard.js +166 -0
  151. package/dist/setup-wizard.js.map +1 -0
  152. package/dist/setup.d.ts +17 -0
  153. package/dist/setup.d.ts.map +1 -0
  154. package/dist/setup.js +33 -0
  155. package/dist/setup.js.map +1 -0
  156. package/dist/tools/elements/builders.d.ts +24 -0
  157. package/dist/tools/elements/builders.d.ts.map +1 -0
  158. package/dist/tools/elements/builders.js +150 -0
  159. package/dist/tools/elements/builders.js.map +1 -0
  160. package/dist/tools/elements/handlers-write.d.ts +48 -0
  161. package/dist/tools/elements/handlers-write.d.ts.map +1 -0
  162. package/dist/tools/elements/handlers-write.js +141 -0
  163. package/dist/tools/elements/handlers-write.js.map +1 -0
  164. package/dist/tools/elements/handlers.d.ts +56 -0
  165. package/dist/tools/elements/handlers.d.ts.map +1 -0
  166. package/dist/tools/elements/handlers.js +113 -0
  167. package/dist/tools/elements/handlers.js.map +1 -0
  168. package/dist/tools/elements/index.d.ts +28 -0
  169. package/dist/tools/elements/index.d.ts.map +1 -0
  170. package/dist/tools/elements/index.js +27 -0
  171. package/dist/tools/elements/index.js.map +1 -0
  172. package/dist/tools/elements.d.ts +13 -0
  173. package/dist/tools/elements.d.ts.map +1 -0
  174. package/dist/tools/elements.js +13 -0
  175. package/dist/tools/elements.js.map +1 -0
  176. package/dist/tools/elicitation.d.ts +87 -0
  177. package/dist/tools/elicitation.d.ts.map +1 -0
  178. package/dist/tools/elicitation.js +100 -0
  179. package/dist/tools/elicitation.js.map +1 -0
  180. package/dist/tools/format/elements-format.d.ts +34 -0
  181. package/dist/tools/format/elements-format.d.ts.map +1 -0
  182. package/dist/tools/format/elements-format.js +112 -0
  183. package/dist/tools/format/elements-format.js.map +1 -0
  184. package/dist/tools/format/health-format.d.ts +73 -0
  185. package/dist/tools/format/health-format.d.ts.map +1 -0
  186. package/dist/tools/format/health-format.js +178 -0
  187. package/dist/tools/format/health-format.js.map +1 -0
  188. package/dist/tools/format/inspection-format.d.ts +45 -0
  189. package/dist/tools/format/inspection-format.d.ts.map +1 -0
  190. package/dist/tools/format/inspection-format.js +125 -0
  191. package/dist/tools/format/inspection-format.js.map +1 -0
  192. package/dist/tools/format/pages-format.d.ts +39 -0
  193. package/dist/tools/format/pages-format.d.ts.map +1 -0
  194. package/dist/tools/format/pages-format.js +110 -0
  195. package/dist/tools/format/pages-format.js.map +1 -0
  196. package/dist/tools/format/sources-format.d.ts +25 -0
  197. package/dist/tools/format/sources-format.d.ts.map +1 -0
  198. package/dist/tools/format/sources-format.js +113 -0
  199. package/dist/tools/format/sources-format.js.map +1 -0
  200. package/dist/tools/health.d.ts +22 -0
  201. package/dist/tools/health.d.ts.map +1 -0
  202. package/dist/tools/health.js +147 -0
  203. package/dist/tools/health.js.map +1 -0
  204. package/dist/tools/index.d.ts +23 -0
  205. package/dist/tools/index.d.ts.map +1 -0
  206. package/dist/tools/index.js +23 -0
  207. package/dist/tools/index.js.map +1 -0
  208. package/dist/tools/inspection.d.ts +14 -0
  209. package/dist/tools/inspection.d.ts.map +1 -0
  210. package/dist/tools/inspection.js +115 -0
  211. package/dist/tools/inspection.js.map +1 -0
  212. package/dist/tools/layout-flatten.d.ts +63 -0
  213. package/dist/tools/layout-flatten.d.ts.map +1 -0
  214. package/dist/tools/layout-flatten.js +95 -0
  215. package/dist/tools/layout-flatten.js.map +1 -0
  216. package/dist/tools/pages/builders.d.ts +14 -0
  217. package/dist/tools/pages/builders.d.ts.map +1 -0
  218. package/dist/tools/pages/builders.js +97 -0
  219. package/dist/tools/pages/builders.js.map +1 -0
  220. package/dist/tools/pages/handlers-read.d.ts +24 -0
  221. package/dist/tools/pages/handlers-read.d.ts.map +1 -0
  222. package/dist/tools/pages/handlers-read.js +141 -0
  223. package/dist/tools/pages/handlers-read.js.map +1 -0
  224. package/dist/tools/pages/handlers-write.d.ts +21 -0
  225. package/dist/tools/pages/handlers-write.d.ts.map +1 -0
  226. package/dist/tools/pages/handlers-write.js +52 -0
  227. package/dist/tools/pages/handlers-write.js.map +1 -0
  228. package/dist/tools/pages/index.d.ts +17 -0
  229. package/dist/tools/pages/index.d.ts.map +1 -0
  230. package/dist/tools/pages/index.js +17 -0
  231. package/dist/tools/pages/index.js.map +1 -0
  232. package/dist/tools/pages/schemas.d.ts +30 -0
  233. package/dist/tools/pages/schemas.d.ts.map +1 -0
  234. package/dist/tools/pages/schemas.js +30 -0
  235. package/dist/tools/pages/schemas.js.map +1 -0
  236. package/dist/tools/pages.d.ts +13 -0
  237. package/dist/tools/pages.d.ts.map +1 -0
  238. package/dist/tools/pages.js +13 -0
  239. package/dist/tools/pages.js.map +1 -0
  240. package/dist/tools/progress-phases.d.ts +46 -0
  241. package/dist/tools/progress-phases.d.ts.map +1 -0
  242. package/dist/tools/progress-phases.js +48 -0
  243. package/dist/tools/progress-phases.js.map +1 -0
  244. package/dist/tools/shared-schemas.d.ts +15 -0
  245. package/dist/tools/shared-schemas.d.ts.map +1 -0
  246. package/dist/tools/shared-schemas.js +30 -0
  247. package/dist/tools/shared-schemas.js.map +1 -0
  248. package/dist/tools/sources/builders.d.ts +13 -0
  249. package/dist/tools/sources/builders.d.ts.map +1 -0
  250. package/dist/tools/sources/builders.js +88 -0
  251. package/dist/tools/sources/builders.js.map +1 -0
  252. package/dist/tools/sources/handlers-bind.d.ts +26 -0
  253. package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
  254. package/dist/tools/sources/handlers-bind.js +123 -0
  255. package/dist/tools/sources/handlers-bind.js.map +1 -0
  256. package/dist/tools/sources/handlers.d.ts +45 -0
  257. package/dist/tools/sources/handlers.d.ts.map +1 -0
  258. package/dist/tools/sources/handlers.js +84 -0
  259. package/dist/tools/sources/handlers.js.map +1 -0
  260. package/dist/tools/sources/index.d.ts +19 -0
  261. package/dist/tools/sources/index.d.ts.map +1 -0
  262. package/dist/tools/sources/index.js +18 -0
  263. package/dist/tools/sources/index.js.map +1 -0
  264. package/dist/tools/sources.d.ts +14 -0
  265. package/dist/tools/sources.d.ts.map +1 -0
  266. package/dist/tools/sources.js +14 -0
  267. package/dist/tools/sources.js.map +1 -0
  268. package/dist/tools/sparse-fields.d.ts +80 -0
  269. package/dist/tools/sparse-fields.d.ts.map +1 -0
  270. package/dist/tools/sparse-fields.js +144 -0
  271. package/dist/tools/sparse-fields.js.map +1 -0
  272. package/dist/tools/tool-builder/annotations.d.ts +22 -0
  273. package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
  274. package/dist/tools/tool-builder/annotations.js +35 -0
  275. package/dist/tools/tool-builder/annotations.js.map +1 -0
  276. package/dist/tools/tool-builder/define.d.ts +31 -0
  277. package/dist/tools/tool-builder/define.d.ts.map +1 -0
  278. package/dist/tools/tool-builder/define.js +31 -0
  279. package/dist/tools/tool-builder/define.js.map +1 -0
  280. package/dist/tools/tool-builder/index.d.ts +28 -0
  281. package/dist/tools/tool-builder/index.d.ts.map +1 -0
  282. package/dist/tools/tool-builder/index.js +27 -0
  283. package/dist/tools/tool-builder/index.js.map +1 -0
  284. package/dist/tools/tool-builder/results.d.ts +59 -0
  285. package/dist/tools/tool-builder/results.d.ts.map +1 -0
  286. package/dist/tools/tool-builder/results.js +125 -0
  287. package/dist/tools/tool-builder/results.js.map +1 -0
  288. package/dist/tools/tool-builder/types.d.ts +82 -0
  289. package/dist/tools/tool-builder/types.d.ts.map +1 -0
  290. package/dist/tools/tool-builder/types.js +9 -0
  291. package/dist/tools/tool-builder/types.js.map +1 -0
  292. package/dist/tools/tool-builder.d.ts +16 -0
  293. package/dist/tools/tool-builder.d.ts.map +1 -0
  294. package/dist/tools/tool-builder.js +16 -0
  295. package/dist/tools/tool-builder.js.map +1 -0
  296. package/icon.png +0 -0
  297. package/manifest.json +63 -0
  298. package/package.json +81 -0
  299. package/skills/yootheme-builder/SKILL.md +582 -0
@@ -0,0 +1,194 @@
1
+ /**
2
+ * OpenAI Codex CLI config writer.
3
+ *
4
+ * All platforms: ~/.codex/config.toml
5
+ *
6
+ * TOML schema:
7
+ *
8
+ * [mcp_servers.<name>]
9
+ * command = "npx"
10
+ * args = ["-y", "@wootsup/yt-builder-mcp"]
11
+ *
12
+ * [mcp_servers.<name>.env]
13
+ * KEY = "value"
14
+ *
15
+ * No TOML library is currently in this package's dependency closure
16
+ * (see `pnpm list` at build-time). To avoid pulling a new dep for one
17
+ * tiny use-case, this adapter uses a minimal serializer + an
18
+ * "append-or-replace section" regex strategy:
19
+ *
20
+ * - To write: emit the full `[mcp_servers.<name>] ...` block and
21
+ * any sub-tables (currently just `.env`) as a contiguous chunk.
22
+ * - To merge with an existing file: regex-delete any prior chunk
23
+ * for the same server name (top-level table + its sub-tables),
24
+ * then append the new chunk.
25
+ *
26
+ * Constraints (deliberately narrow — we own ALL writes via this
27
+ * adapter, so we never have to round-trip arbitrary user TOML):
28
+ *
29
+ * - string keys only
30
+ * - values: string, string[]
31
+ * - sub-tables: one level deep (just `.env`)
32
+ * - no inline tables, no datetime, no float, no bool
33
+ *
34
+ * If a customer hand-edits the file with richer TOML, those edits
35
+ * are preserved verbatim because we only touch our own
36
+ * `[mcp_servers.<name>]` sections by name.
37
+ *
38
+ * @license MIT
39
+ */
40
+ import { existsSync } from 'node:fs';
41
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
42
+ import { dirname, join } from 'node:path';
43
+ import { userHome } from './home.js';
44
+ function configPath() {
45
+ return join(userHome(), '.codex', 'config.toml');
46
+ }
47
+ /**
48
+ * Escape a string for use as a TOML basic-string value (between
49
+ * double quotes). Handles backslash, double-quote, and control
50
+ * characters via TOML's standard escape sequences.
51
+ */
52
+ function escapeTomlString(input) {
53
+ let out = '';
54
+ for (const ch of input) {
55
+ const code = ch.codePointAt(0) ?? 0;
56
+ if (ch === '\\')
57
+ out += '\\\\';
58
+ else if (ch === '"')
59
+ out += '\\"';
60
+ else if (ch === '\b')
61
+ out += '\\b';
62
+ else if (ch === '\t')
63
+ out += '\\t';
64
+ else if (ch === '\n')
65
+ out += '\\n';
66
+ else if (ch === '\f')
67
+ out += '\\f';
68
+ else if (ch === '\r')
69
+ out += '\\r';
70
+ else if (code < 0x20)
71
+ out += '\\u' + code.toString(16).padStart(4, '0').toUpperCase();
72
+ else
73
+ out += ch;
74
+ }
75
+ return out;
76
+ }
77
+ /**
78
+ * Bare key validity per TOML spec: ASCII letters, digits, underscore,
79
+ * dash. Anything else gets quoted.
80
+ */
81
+ function tomlKey(key) {
82
+ return /^[A-Za-z0-9_-]+$/.test(key) ? key : `"${escapeTomlString(key)}"`;
83
+ }
84
+ function tomlStringValue(value) {
85
+ return `"${escapeTomlString(value)}"`;
86
+ }
87
+ function tomlStringArray(values) {
88
+ return '[' + values.map((v) => tomlStringValue(v)).join(', ') + ']';
89
+ }
90
+ /**
91
+ * Render the `[mcp_servers.<name>]` block plus a `[mcp_servers.<name>.env]`
92
+ * sub-table when the env map is non-empty. Always ends with a trailing
93
+ * blank line so successive sections are visually separated.
94
+ */
95
+ function renderServerBlock(serverName, config) {
96
+ const nameKey = tomlKey(serverName);
97
+ const lines = [];
98
+ lines.push(`[mcp_servers.${nameKey}]`);
99
+ lines.push(`command = ${tomlStringValue(config.command)}`);
100
+ lines.push(`args = ${tomlStringArray(config.args)}`);
101
+ const envKeys = Object.keys(config.env);
102
+ if (envKeys.length === 0) {
103
+ lines.push('');
104
+ return lines.join('\n') + '\n';
105
+ }
106
+ lines.push('');
107
+ lines.push(`[mcp_servers.${nameKey}.env]`);
108
+ for (const key of envKeys) {
109
+ const v = config.env[key];
110
+ if (typeof v !== 'string')
111
+ continue;
112
+ lines.push(`${tomlKey(key)} = ${tomlStringValue(v)}`);
113
+ }
114
+ lines.push('');
115
+ return lines.join('\n') + '\n';
116
+ }
117
+ /**
118
+ * Strip any prior `[mcp_servers.<name>]` (and its `[mcp_servers.<name>.<sub>]`
119
+ * children) from an existing TOML body. We anchor on the literal table
120
+ * header and consume up to the next top-level `[...]` header or EOF.
121
+ *
122
+ * Regex notes:
123
+ * - `^` with `m` flag so the table header must start a line
124
+ * - `[\s\S]*?` lazy so we stop at the next header
125
+ * - `(?=\n\[[^.])` lookahead: next `[xxx]` that is NOT a sub-table
126
+ * of our removed section (sub-tables start with `[mcp_servers.<name>.`,
127
+ * containing a dot — so we want the next `[` followed by a non-`m`
128
+ * OR more conservatively, any `[` that doesn't start a sub-table).
129
+ *
130
+ * To keep this readable we just delete `[mcp_servers.<name>]` and any
131
+ * `[mcp_servers.<name>.*]` blocks individually.
132
+ */
133
+ function stripExistingSection(body, serverName) {
134
+ // Build matchers for both bare and quoted forms of the server key.
135
+ const bare = /^[A-Za-z0-9_-]+$/.test(serverName) ? serverName : null;
136
+ const quoted = `"${escapeTomlString(serverName)}"`;
137
+ const keyAlternatives = bare ? [bare, quoted] : [quoted];
138
+ let result = body;
139
+ for (const k of keyAlternatives) {
140
+ // Escape regex specials in the key (quoted form contains backslashes
141
+ // for embedded quotes — escape those for the regex itself).
142
+ const kEsc = k.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
143
+ // Match `[mcp_servers.<key>]` or `[mcp_servers.<key>.<sub>]` and
144
+ // everything up to the next top-level table header or EOF.
145
+ // A top-level header is `[mcp_servers.X]` (X != <key>) or `[anything]`
146
+ // that isn't our sub-table. To keep this simple we stop at the next
147
+ // line starting with `[` that isn't a sub-table of our key.
148
+ const re = new RegExp(`(^|\\n)\\[mcp_servers\\.${kEsc}(?:\\.[^\\]]+)?\\][^\\[]*?(?=\\n\\[|$)`, 'g');
149
+ result = result.replace(re, (match, leading) => leading);
150
+ }
151
+ // Collapse 3+ consecutive newlines to 2 so deletions don't leave gaps.
152
+ result = result.replace(/\n{3,}/g, '\n\n');
153
+ return result;
154
+ }
155
+ /**
156
+ * Detection: the `~/.codex/` directory exists. Codex CLI creates it
157
+ * during first-run auth (`codex login`), even before the user has
158
+ * configured any MCP servers.
159
+ */
160
+ function isDetected() {
161
+ return existsSync(join(userHome(), '.codex'));
162
+ }
163
+ export const codexCliClient = {
164
+ id: 'codex-cli',
165
+ label: 'Codex CLI',
166
+ configPath,
167
+ isDetected,
168
+ apply: async (serverName, config) => {
169
+ const path = configPath();
170
+ let existing = '';
171
+ if (existsSync(path)) {
172
+ try {
173
+ existing = await readFile(path, 'utf-8');
174
+ }
175
+ catch {
176
+ existing = '';
177
+ }
178
+ }
179
+ else {
180
+ await mkdir(dirname(path), { recursive: true });
181
+ }
182
+ const stripped = stripExistingSection(existing, serverName);
183
+ // Ensure a clean separator before our new section if there is
184
+ // pre-existing content that doesn't already end with a blank line.
185
+ let prefix = stripped;
186
+ if (prefix.length > 0 && !prefix.endsWith('\n\n')) {
187
+ prefix = prefix.endsWith('\n') ? prefix + '\n' : prefix + '\n\n';
188
+ }
189
+ const block = renderServerBlock(serverName, config);
190
+ const next = prefix + block;
191
+ await writeFile(path, next, 'utf-8');
192
+ },
193
+ };
194
+ //# sourceMappingURL=codex-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"codex-cli.js","sourceRoot":"","sources":["../../src/clients/codex-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAGrC,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,QAAQ,EAAE,aAAa,CAAC,CAAC;AACrD,CAAC;AAED;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,KAAa;IACnC,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,KAAK,MAAM,EAAE,IAAI,KAAK,EAAE,CAAC;QACrB,MAAM,IAAI,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;QACpC,IAAI,EAAE,KAAK,IAAI;YAAE,GAAG,IAAI,MAAM,CAAC;aAC1B,IAAI,EAAE,KAAK,GAAG;YAAE,GAAG,IAAI,KAAK,CAAC;aAC7B,IAAI,EAAE,KAAK,IAAI;YAAE,GAAG,IAAI,KAAK,CAAC;aAC9B,IAAI,EAAE,KAAK,IAAI;YAAE,GAAG,IAAI,KAAK,CAAC;aAC9B,IAAI,EAAE,KAAK,IAAI;YAAE,GAAG,IAAI,KAAK,CAAC;aAC9B,IAAI,EAAE,KAAK,IAAI;YAAE,GAAG,IAAI,KAAK,C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,QAAQ,GAAG,oBAAoB,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;QAC5D,8DAA8D;QAC9D,mEAAmE;QACnE,IAAI,MAAM,GAAG,QAAQ,CAAC;QACtB,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;YAChD,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC;QACrE,CAAC;QACD,MAAM,KAAK,GAAG,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACpD,MAAM,IAAI,GAAG,MAAM,GAAG,KAAK,CAAC;QAC5B,MAAM,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;CACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Continue MCP config writer.
3
+ *
4
+ * Global: ~/.continue/config.json
5
+ *
6
+ * Schema: `experimental.modelContextProtocolServers` array of
7
+ * { transport: { type: 'stdio', command, args, env } } entries.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { type ClientWriter } from './index.js';
12
+ export declare const continueClient: ClientWriter;
13
+ //# sourceMappingURL=continue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.d.ts","sourceRoot":"","sources":["../../src/clients/continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAgBpF,eAAO,MAAM,cAAc,EAAE,YAqC5B,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Continue MCP config writer.
3
+ *
4
+ * Global: ~/.continue/config.json
5
+ *
6
+ * Schema: `experimental.modelContextProtocolServers` array of
7
+ * { transport: { type: 'stdio', command, args, env } } entries.
8
+ *
9
+ * @license MIT
10
+ */
11
+ import { existsSync } from 'node:fs';
12
+ import { join } from 'node:path';
13
+ import { userHome } from './home.js';
14
+ import { patchJsonFile } from './index.js';
15
+ function configPath() {
16
+ return join(userHome(), '.continue', 'config.json');
17
+ }
18
+ export const continueClient = {
19
+ id: 'continue',
20
+ label: 'Continue',
21
+ configPath,
22
+ isDetected: () => existsSync(join(userHome(), '.continue')),
23
+ apply: async (serverName, config) => {
24
+ await patchJsonFile(configPath(), (current) => {
25
+ const experimental = current.experimental !== null &&
26
+ typeof current.experimental === 'object' &&
27
+ !Array.isArray(current.experimental)
28
+ ? { ...current.experimental }
29
+ : {};
30
+ const rawList = experimental.modelContextProtocolServers;
31
+ const list = Array.isArray(rawList)
32
+ ? rawList.filter((e) => e !== null &&
33
+ typeof e === 'object' &&
34
+ typeof e.name === 'string')
35
+ : [];
36
+ const entry = {
37
+ name: serverName,
38
+ transport: {
39
+ type: 'stdio',
40
+ command: config.command,
41
+ args: config.args,
42
+ env: config.env,
43
+ },
44
+ };
45
+ const filtered = list.filter((e) => e.name !== serverName);
46
+ filtered.push(entry);
47
+ experimental.modelContextProtocolServers = filtered;
48
+ return { ...current, experimental };
49
+ });
50
+ },
51
+ };
52
+ //# sourceMappingURL=continue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"continue.js","sourceRoot":"","sources":["../../src/clients/continue.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC;AACxD,CAAC;AAYD,MAAM,CAAC,MAAM,cAAc,GAAiB;IACxC,EAAE,EAAE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;YACrB,YAAY,CAAC,2BAA2B,GAAG,QAAQ,CAAC;YACpD,OAAO,EAAE,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC;QACxC,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Cursor MCP config writer.
3
+ *
4
+ * Global: ~/.cursor/mcp.json
5
+ *
6
+ * Schema mirrors Claude Desktop's `mcpServers` map.
7
+ *
8
+ * @license MIT
9
+ */
10
+ import { type ClientWriter } from './index.js';
11
+ export declare const cursorClient: ClientWriter;
12
+ //# sourceMappingURL=cursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.d.ts","sourceRoot":"","sources":["../../src/clients/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAMpF,eAAO,MAAM,YAAY,EAAE,YAqB1B,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Cursor MCP config writer.
3
+ *
4
+ * Global: ~/.cursor/mcp.json
5
+ *
6
+ * Schema mirrors Claude Desktop's `mcpServers` map.
7
+ *
8
+ * @license MIT
9
+ */
10
+ import { existsSync } from 'node:fs';
11
+ import { join } from 'node:path';
12
+ import { userHome } from './home.js';
13
+ import { patchJsonFile } from './index.js';
14
+ function configPath() {
15
+ return join(userHome(), '.cursor', 'mcp.json');
16
+ }
17
+ export const cursorClient = {
18
+ id: 'cursor',
19
+ label: 'Cursor',
20
+ configPath,
21
+ isDetected: () => existsSync(join(userHome(), '.cursor')),
22
+ apply: async (serverName, config) => {
23
+ await patchJsonFile(configPath(), (current) => {
24
+ const servers = current.mcpServers !== null &&
25
+ typeof current.mcpServers === 'object' &&
26
+ !Array.isArray(current.mcpServers)
27
+ ? { ...current.mcpServers }
28
+ : {};
29
+ servers[serverName] = {
30
+ command: config.command,
31
+ args: config.args,
32
+ env: config.env,
33
+ };
34
+ return { ...current, mcpServers: servers };
35
+ });
36
+ },
37
+ };
38
+ //# sourceMappingURL=cursor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cursor.js","sourceRoot":"","sources":["../../src/clients/cursor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAiB;IACtC,EAAE,EAAE,QAAQ;IACZ,KAAK,EAAE,QAAQ;IACf,UAAU;IACV,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;IACzD,KAAK,EAAE,KAAK,EAAE,UAAkB,EAAE,MAAuB,EAAE,EAAE;QACzD,MAAM,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,OAAO,GACT,OAAO,CAAC,UAAU,KAAK,IAAI;gBAC3B,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;gBACtC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC9B,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,UAAsC,EAAE;gBACxD,CAAC,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,UAAU,CAAC,GAAG;gBAClB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;YACF,OAAO,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Google Gemini CLI config writer.
3
+ *
4
+ * All platforms: ~/.gemini/settings.json
5
+ *
6
+ * Schema mirrors Claude Desktop's `mcpServers` map:
7
+ *
8
+ * {
9
+ * "mcpServers": {
10
+ * "<name>": { "command": "npx", "args": [...], "env": {...} }
11
+ * }
12
+ * }
13
+ *
14
+ * @license MIT
15
+ */
16
+ import { type ClientWriter } from './index.js';
17
+ export declare const geminiCliClient: ClientWriter;
18
+ //# sourceMappingURL=gemini-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-cli.d.ts","sourceRoot":"","sources":["../../src/clients/gemini-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAMpF,eAAO,MAAM,eAAe,EAAE,YAqB7B,CAAC"}
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Google Gemini CLI config writer.
3
+ *
4
+ * All platforms: ~/.gemini/settings.json
5
+ *
6
+ * Schema mirrors Claude Desktop's `mcpServers` map:
7
+ *
8
+ * {
9
+ * "mcpServers": {
10
+ * "<name>": { "command": "npx", "args": [...], "env": {...} }
11
+ * }
12
+ * }
13
+ *
14
+ * @license MIT
15
+ */
16
+ import { existsSync } from 'node:fs';
17
+ import { join } from 'node:path';
18
+ import { userHome } from './home.js';
19
+ import { patchJsonFile } from './index.js';
20
+ function configPath() {
21
+ return join(userHome(), '.gemini', 'settings.json');
22
+ }
23
+ export const geminiCliClient = {
24
+ id: 'gemini-cli',
25
+ label: 'Gemini CLI',
26
+ configPath,
27
+ isDetected: () => existsSync(join(userHome(), '.gemini')),
28
+ apply: async (serverName, config) => {
29
+ await patchJsonFile(configPath(), (current) => {
30
+ const servers = current.mcpServers !== null &&
31
+ typeof current.mcpServers === 'object' &&
32
+ !Array.isArray(current.mcpServers)
33
+ ? { ...current.mcpServers }
34
+ : {};
35
+ servers[serverName] = {
36
+ command: config.command,
37
+ args: config.args,
38
+ env: config.env,
39
+ };
40
+ return { ...current, mcpServers: servers };
41
+ });
42
+ },
43
+ };
44
+ //# sourceMappingURL=gemini-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gemini-cli.js","sourceRoot":"","sources":["../../src/clients/gemini-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,SAAS,UAAU;IACf,OAAO,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AACxD,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAiB;IACzC,EAAE,EAAE,YAAY;IAChB,KAAK,EAAE,YAAY;IACnB,UAAU;IACV,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,SAAS,CAAC,CAAC;IACzD,KAAK,EAAE,KAAK,EAAE,UAAkB,EAAE,MAAuB,EAAE,EAAE;QACzD,MAAM,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,OAAO,EAAE,EAAE;YAC1C,MAAM,OAAO,GACT,OAAO,CAAC,UAAU,KAAK,IAAI;gBAC3B,OAAO,OAAO,CAAC,UAAU,KAAK,QAAQ;gBACtC,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;gBAC9B,CAAC,CAAC,EAAE,GAAI,OAAO,CAAC,UAAsC,EAAE;gBACxD,CAAC,CAAC,EAAE,CAAC;YACb,OAAO,CAAC,UAAU,CAAC,GAAG;gBAClB,OAAO,EAAE,MAAM,CAAC,OAAO;gBACvB,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,GAAG,EAAE,MAAM,CAAC,GAAG;aAClB,CAAC;YACF,OAAO,EAAE,GAAG,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,CAAC;QAC/C,CAAC,CAAC,CAAC;IACP,CAAC;CACJ,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * `userHome()` — single source of truth for "where do AI clients live?".
3
+ *
4
+ * Returns `process.env.HOME` (or `USERPROFILE` on Windows) if set, falling
5
+ * back to `os.homedir()`. The env-first ordering is important for tests:
6
+ * Node's `os.homedir()` on POSIX uses `getpwuid_r`, which IGNORES the HOME
7
+ * env override — so tests that set `process.env.HOME = tmpDir` would
8
+ * otherwise stomp the real Claude / Cursor / Zed configs on the
9
+ * developer's machine. Hard-learned during Wave-4 setup.
10
+ *
11
+ * @license MIT
12
+ */
13
+ export declare function userHome(): string;
14
+ //# sourceMappingURL=home.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.d.ts","sourceRoot":"","sources":["../../src/clients/home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,wBAAgB,QAAQ,IAAI,MAAM,CAIjC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `userHome()` — single source of truth for "where do AI clients live?".
3
+ *
4
+ * Returns `process.env.HOME` (or `USERPROFILE` on Windows) if set, falling
5
+ * back to `os.homedir()`. The env-first ordering is important for tests:
6
+ * Node's `os.homedir()` on POSIX uses `getpwuid_r`, which IGNORES the HOME
7
+ * env override — so tests that set `process.env.HOME = tmpDir` would
8
+ * otherwise stomp the real Claude / Cursor / Zed configs on the
9
+ * developer's machine. Hard-learned during Wave-4 setup.
10
+ *
11
+ * @license MIT
12
+ */
13
+ import { homedir } from 'node:os';
14
+ export function userHome() {
15
+ const home = process.env.HOME ?? process.env.USERPROFILE;
16
+ if (home !== undefined && home !== '')
17
+ return home;
18
+ return homedir();
19
+ }
20
+ //# sourceMappingURL=home.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"home.js","sourceRoot":"","sources":["../../src/clients/home.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAElC,MAAM,UAAU,QAAQ;IACpB,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC;IACzD,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACnD,OAAO,OAAO,EAAE,CAAC;AACrB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Client-config-writers.
3
+ *
4
+ * Each supported AI client has its own module that knows
5
+ * - which config file to read/write
6
+ * - what JSON shape to inject under `mcpServers` (or equivalent)
7
+ *
8
+ * The setup wizard calls `detectAvailableClients()` to enumerate, then
9
+ * `writeClientConfig({client, server})` once the user picks one.
10
+ *
11
+ * @license MIT
12
+ */
13
+ import { claudeCodeClient } from './claude-code.js';
14
+ import { claudeDesktopClient } from './claude-desktop.js';
15
+ import { clineClient } from './cline.js';
16
+ import { codexCliClient } from './codex-cli.js';
17
+ import { continueClient } from './continue.js';
18
+ import { cursorClient } from './cursor.js';
19
+ import { geminiCliClient } from './gemini-cli.js';
20
+ import { rooCodeClient } from './roo-code.js';
21
+ import { zedClient } from './zed.js';
22
+ export interface McpServerConfig {
23
+ readonly command: string;
24
+ readonly args: readonly string[];
25
+ readonly env: Record<string, string>;
26
+ }
27
+ export interface ClientWriter {
28
+ readonly id: string;
29
+ readonly label: string;
30
+ /** Absolute path to the config file. */
31
+ configPath: () => string;
32
+ /** Returns true if the config file exists (client is "installed"). */
33
+ isDetected: () => boolean;
34
+ /** Apply the MCP server config to the file. Creates the file if missing. */
35
+ apply: (serverName: string, config: McpServerConfig) => Promise<void>;
36
+ }
37
+ export declare const ALL_CLIENTS: readonly ClientWriter[];
38
+ export interface DetectedClient {
39
+ readonly id: string;
40
+ readonly label: string;
41
+ readonly configPath: string;
42
+ readonly detected: boolean;
43
+ }
44
+ export declare function detectAvailableClients(): DetectedClient[];
45
+ export declare function findClient(id: string): ClientWriter | undefined;
46
+ /**
47
+ * Shared helper: read a JSON file, mutate via callback, write back.
48
+ * Creates parent directories if missing.
49
+ */
50
+ export declare function patchJsonFile(path: string, mutator: (current: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
51
+ export { claudeCodeClient, claudeDesktopClient, clineClient, codexCliClient, continueClient, cursorClient, geminiCliClient, rooCodeClient, zedClient, };
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,MAAM,WAAW,eAAe;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,MAAM,WAAW,YAAY;IACzB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,UAAU,EAAE,MAAM,MAAM,CAAC;IACzB,sEAAsE;IACtE,UAAU,EAAE,MAAM,OAAO,CAAC;IAC1B,4EAA4E;IAC5E,KAAK,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACzE;AAED,eAAO,MAAM,WAAW,EAAE,SAAS,YAAY,EAU9C,CAAC;AAEF,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;CAC9B;AAED,wBAAgB,sBAAsB,IAAI,cAAc,EAAE,CAOzD;AAED,wBAAgB,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,YAAY,GAAG,SAAS,CAE/D;AAED;;;GAGG;AACH,wBAAsB,aAAa,CAC/B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACvE,OAAO,CAAC,IAAI,CAAC,CAkBf;AAED,OAAO,EACH,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,SAAS,GACZ,CAAC"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Client-config-writers.
3
+ *
4
+ * Each supported AI client has its own module that knows
5
+ * - which config file to read/write
6
+ * - what JSON shape to inject under `mcpServers` (or equivalent)
7
+ *
8
+ * The setup wizard calls `detectAvailableClients()` to enumerate, then
9
+ * `writeClientConfig({client, server})` once the user picks one.
10
+ *
11
+ * @license MIT
12
+ */
13
+ import { existsSync } from 'node:fs';
14
+ import { mkdir, readFile, writeFile } from 'node:fs/promises';
15
+ import { dirname } from 'node:path';
16
+ import { claudeCodeClient } from './claude-code.js';
17
+ import { claudeDesktopClient } from './claude-desktop.js';
18
+ import { clineClient } from './cline.js';
19
+ import { codexCliClient } from './codex-cli.js';
20
+ import { continueClient } from './continue.js';
21
+ import { cursorClient } from './cursor.js';
22
+ import { geminiCliClient } from './gemini-cli.js';
23
+ import { rooCodeClient } from './roo-code.js';
24
+ import { zedClient } from './zed.js';
25
+ export const ALL_CLIENTS = [
26
+ claudeDesktopClient,
27
+ claudeCodeClient,
28
+ cursorClient,
29
+ zedClient,
30
+ continueClient,
31
+ clineClient,
32
+ rooCodeClient,
33
+ codexCliClient,
34
+ geminiCliClient,
35
+ ];
36
+ export function detectAvailableClients() {
37
+ return ALL_CLIENTS.map((c) => ({
38
+ id: c.id,
39
+ label: c.label,
40
+ configPath: c.configPath(),
41
+ detected: c.isDetected(),
42
+ }));
43
+ }
44
+ export function findClient(id) {
45
+ return ALL_CLIENTS.find((c) => c.id === id);
46
+ }
47
+ /**
48
+ * Shared helper: read a JSON file, mutate via callback, write back.
49
+ * Creates parent directories if missing.
50
+ */
51
+ export async function patchJsonFile(path, mutator) {
52
+ let current = {};
53
+ if (existsSync(path)) {
54
+ try {
55
+ const raw = await readFile(path, 'utf-8');
56
+ const parsed = raw.trim() === '' ? {} : JSON.parse(raw);
57
+ if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
58
+ current = parsed;
59
+ }
60
+ }
61
+ catch {
62
+ current = {};
63
+ }
64
+ }
65
+ else {
66
+ await mkdir(dirname(path), { recursive: true });
67
+ }
68
+ const next = mutator(current);
69
+ await writeFile(path, JSON.stringify(next, null, 2) + '\n', 'utf-8');
70
+ }
71
+ export { claudeCodeClient, claudeDesktopClient, clineClient, codexCliClient, continueClient, cursorClient, geminiCliClient, rooCodeClient, zedClient,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@ -0,0 +1,23 @@
1
+ /**
2
+ * Roo Code MCP config writer.
3
+ *
4
+ * Roo Code (formerly Roo Cline) is the VS Code extension
5
+ * `rooveterinaryinc.roo-cline` — a fork of Cline. It follows the
6
+ * same VS Code globalStorage layout but its own settings file is
7
+ * named `mcp_settings.json` (without the legacy `cline_` prefix
8
+ * its parent uses).
9
+ *
10
+ * <vsCodeUserDir>/globalStorage/rooveterinaryinc.roo-cline/settings/mcp_settings.json
11
+ *
12
+ * VS Code's `<vsCodeUserDir>` is:
13
+ * macOS: ~/Library/Application Support/Code/User
14
+ * Linux: ~/.config/Code/User
15
+ * Windows: %APPDATA%\Code\User
16
+ *
17
+ * Schema mirrors Claude Desktop's `mcpServers` map.
18
+ *
19
+ * @license MIT
20
+ */
21
+ import { type ClientWriter } from './index.js';
22
+ export declare const rooCodeClient: ClientWriter;
23
+ //# sourceMappingURL=roo-code.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"roo-code.d.ts","sourceRoot":"","sources":["../../src/clients/roo-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAkCpF,eAAO,MAAM,aAAa,EAAE,YAqB3B,CAAC"}