@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.
- package/LICENSE +21 -0
- package/README.md +221 -0
- package/bin/yt-builder-mcp.js +59 -0
- package/dist/auth.d.ts +39 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +93 -0
- package/dist/auth.js.map +1 -0
- package/dist/client.d.ts +84 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +151 -0
- package/dist/client.js.map +1 -0
- package/dist/clients/claude-code.d.ts +18 -0
- package/dist/clients/claude-code.d.ts.map +1 -0
- package/dist/clients/claude-code.js +53 -0
- package/dist/clients/claude-code.js.map +1 -0
- package/dist/clients/claude-desktop.d.ts +19 -0
- package/dist/clients/claude-desktop.d.ts.map +1 -0
- package/dist/clients/claude-desktop.js +56 -0
- package/dist/clients/claude-desktop.js.map +1 -0
- package/dist/clients/cline.d.ts +26 -0
- package/dist/clients/cline.d.ts.map +1 -0
- package/dist/clients/cline.js +80 -0
- package/dist/clients/cline.js.map +1 -0
- package/dist/clients/codex-cli.d.ts +42 -0
- package/dist/clients/codex-cli.d.ts.map +1 -0
- package/dist/clients/codex-cli.js +194 -0
- package/dist/clients/codex-cli.js.map +1 -0
- package/dist/clients/continue.d.ts +13 -0
- package/dist/clients/continue.d.ts.map +1 -0
- package/dist/clients/continue.js +52 -0
- package/dist/clients/continue.js.map +1 -0
- package/dist/clients/cursor.d.ts +12 -0
- package/dist/clients/cursor.d.ts.map +1 -0
- package/dist/clients/cursor.js +38 -0
- package/dist/clients/cursor.js.map +1 -0
- package/dist/clients/gemini-cli.d.ts +18 -0
- package/dist/clients/gemini-cli.d.ts.map +1 -0
- package/dist/clients/gemini-cli.js +44 -0
- package/dist/clients/gemini-cli.js.map +1 -0
- package/dist/clients/home.d.ts +14 -0
- package/dist/clients/home.d.ts.map +1 -0
- package/dist/clients/home.js +20 -0
- package/dist/clients/home.js.map +1 -0
- package/dist/clients/index.d.ts +52 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +72 -0
- package/dist/clients/index.js.map +1 -0
- package/dist/clients/roo-code.d.ts +23 -0
- package/dist/clients/roo-code.d.ts.map +1 -0
- package/dist/clients/roo-code.js +69 -0
- package/dist/clients/roo-code.js.map +1 -0
- package/dist/clients/zed.d.ts +12 -0
- package/dist/clients/zed.d.ts.map +1 -0
- package/dist/clients/zed.js +41 -0
- package/dist/clients/zed.js.map +1 -0
- package/dist/errors/hints.d.ts +51 -0
- package/dist/errors/hints.d.ts.map +1 -0
- package/dist/errors/hints.js +95 -0
- package/dist/errors/hints.js.map +1 -0
- package/dist/errors/mask.d.ts +35 -0
- package/dist/errors/mask.d.ts.map +1 -0
- package/dist/errors/mask.js +49 -0
- package/dist/errors/mask.js.map +1 -0
- package/dist/errors/sanitize.d.ts +31 -0
- package/dist/errors/sanitize.d.ts.map +1 -0
- package/dist/errors/sanitize.js +90 -0
- package/dist/errors/sanitize.js.map +1 -0
- package/dist/errors.d.ts +42 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +61 -0
- package/dist/errors.js.map +1 -0
- package/dist/gateway/advanced-tool/discovery.d.ts +19 -0
- package/dist/gateway/advanced-tool/discovery.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/discovery.js +53 -0
- package/dist/gateway/advanced-tool/discovery.js.map +1 -0
- package/dist/gateway/advanced-tool/domains.d.ts +42 -0
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/domains.js +88 -0
- package/dist/gateway/advanced-tool/domains.js.map +1 -0
- package/dist/gateway/advanced-tool/execute.d.ts +29 -0
- package/dist/gateway/advanced-tool/execute.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/execute.js +54 -0
- package/dist/gateway/advanced-tool/execute.js.map +1 -0
- package/dist/gateway/advanced-tool/index.d.ts +36 -0
- package/dist/gateway/advanced-tool/index.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/index.js +39 -0
- package/dist/gateway/advanced-tool/index.js.map +1 -0
- package/dist/gateway/advanced-tool/register.d.ts +18 -0
- package/dist/gateway/advanced-tool/register.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/register.js +62 -0
- package/dist/gateway/advanced-tool/register.js.map +1 -0
- package/dist/gateway/advanced-tool.d.ts +13 -0
- package/dist/gateway/advanced-tool.d.ts.map +1 -0
- package/dist/gateway/advanced-tool.js +13 -0
- package/dist/gateway/advanced-tool.js.map +1 -0
- package/dist/gateway/capturing-server.d.ts +117 -0
- package/dist/gateway/capturing-server.d.ts.map +1 -0
- package/dist/gateway/capturing-server.js +103 -0
- package/dist/gateway/capturing-server.js.map +1 -0
- package/dist/gateway/essentials.d.ts +49 -0
- package/dist/gateway/essentials.d.ts.map +1 -0
- package/dist/gateway/essentials.js +62 -0
- package/dist/gateway/essentials.js.map +1 -0
- package/dist/gateway/test-support.d.ts +41 -0
- package/dist/gateway/test-support.d.ts.map +1 -0
- package/dist/gateway/test-support.js +60 -0
- package/dist/gateway/test-support.js.map +1 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +77 -0
- package/dist/index.js.map +1 -0
- package/dist/install-skill.d.ts +35 -0
- package/dist/install-skill.d.ts.map +1 -0
- package/dist/install-skill.js +107 -0
- package/dist/install-skill.js.map +1 -0
- package/dist/platform/index.d.ts +49 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +38 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/server.d.ts +50 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +117 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-cli.d.ts +100 -0
- package/dist/setup-cli.d.ts.map +1 -0
- package/dist/setup-cli.js +355 -0
- package/dist/setup-cli.js.map +1 -0
- package/dist/setup-prompts.d.ts +41 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +142 -0
- package/dist/setup-prompts.js.map +1 -0
- package/dist/setup-token.d.ts +38 -0
- package/dist/setup-token.d.ts.map +1 -0
- package/dist/setup-token.js +106 -0
- package/dist/setup-token.js.map +1 -0
- package/dist/setup-wizard-defaults.d.ts +43 -0
- package/dist/setup-wizard-defaults.d.ts.map +1 -0
- package/dist/setup-wizard-defaults.js +160 -0
- package/dist/setup-wizard-defaults.js.map +1 -0
- package/dist/setup-wizard-handshake.d.ts +25 -0
- package/dist/setup-wizard-handshake.d.ts.map +1 -0
- package/dist/setup-wizard-handshake.js +103 -0
- package/dist/setup-wizard-handshake.js.map +1 -0
- package/dist/setup-wizard-types.d.ts +148 -0
- package/dist/setup-wizard-types.d.ts.map +1 -0
- package/dist/setup-wizard-types.js +11 -0
- package/dist/setup-wizard-types.js.map +1 -0
- package/dist/setup-wizard.d.ts +33 -0
- package/dist/setup-wizard.d.ts.map +1 -0
- package/dist/setup-wizard.js +166 -0
- package/dist/setup-wizard.js.map +1 -0
- package/dist/setup.d.ts +17 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +33 -0
- package/dist/setup.js.map +1 -0
- package/dist/tools/elements/builders.d.ts +24 -0
- package/dist/tools/elements/builders.d.ts.map +1 -0
- package/dist/tools/elements/builders.js +150 -0
- package/dist/tools/elements/builders.js.map +1 -0
- package/dist/tools/elements/handlers-write.d.ts +48 -0
- package/dist/tools/elements/handlers-write.d.ts.map +1 -0
- package/dist/tools/elements/handlers-write.js +141 -0
- package/dist/tools/elements/handlers-write.js.map +1 -0
- package/dist/tools/elements/handlers.d.ts +56 -0
- package/dist/tools/elements/handlers.d.ts.map +1 -0
- package/dist/tools/elements/handlers.js +113 -0
- package/dist/tools/elements/handlers.js.map +1 -0
- package/dist/tools/elements/index.d.ts +28 -0
- package/dist/tools/elements/index.d.ts.map +1 -0
- package/dist/tools/elements/index.js +27 -0
- package/dist/tools/elements/index.js.map +1 -0
- package/dist/tools/elements.d.ts +13 -0
- package/dist/tools/elements.d.ts.map +1 -0
- package/dist/tools/elements.js +13 -0
- package/dist/tools/elements.js.map +1 -0
- package/dist/tools/elicitation.d.ts +87 -0
- package/dist/tools/elicitation.d.ts.map +1 -0
- package/dist/tools/elicitation.js +100 -0
- package/dist/tools/elicitation.js.map +1 -0
- package/dist/tools/format/elements-format.d.ts +34 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -0
- package/dist/tools/format/elements-format.js +112 -0
- package/dist/tools/format/elements-format.js.map +1 -0
- package/dist/tools/format/health-format.d.ts +73 -0
- package/dist/tools/format/health-format.d.ts.map +1 -0
- package/dist/tools/format/health-format.js +178 -0
- package/dist/tools/format/health-format.js.map +1 -0
- package/dist/tools/format/inspection-format.d.ts +45 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/format/inspection-format.js +125 -0
- package/dist/tools/format/inspection-format.js.map +1 -0
- package/dist/tools/format/pages-format.d.ts +39 -0
- package/dist/tools/format/pages-format.d.ts.map +1 -0
- package/dist/tools/format/pages-format.js +110 -0
- package/dist/tools/format/pages-format.js.map +1 -0
- package/dist/tools/format/sources-format.d.ts +25 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -0
- package/dist/tools/format/sources-format.js +113 -0
- package/dist/tools/format/sources-format.js.map +1 -0
- package/dist/tools/health.d.ts +22 -0
- package/dist/tools/health.d.ts.map +1 -0
- package/dist/tools/health.js +147 -0
- package/dist/tools/health.js.map +1 -0
- package/dist/tools/index.d.ts +23 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +23 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/inspection.d.ts +14 -0
- package/dist/tools/inspection.d.ts.map +1 -0
- package/dist/tools/inspection.js +115 -0
- package/dist/tools/inspection.js.map +1 -0
- package/dist/tools/layout-flatten.d.ts +63 -0
- package/dist/tools/layout-flatten.d.ts.map +1 -0
- package/dist/tools/layout-flatten.js +95 -0
- package/dist/tools/layout-flatten.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +14 -0
- package/dist/tools/pages/builders.d.ts.map +1 -0
- package/dist/tools/pages/builders.js +97 -0
- package/dist/tools/pages/builders.js.map +1 -0
- package/dist/tools/pages/handlers-read.d.ts +24 -0
- package/dist/tools/pages/handlers-read.d.ts.map +1 -0
- package/dist/tools/pages/handlers-read.js +141 -0
- package/dist/tools/pages/handlers-read.js.map +1 -0
- package/dist/tools/pages/handlers-write.d.ts +21 -0
- package/dist/tools/pages/handlers-write.d.ts.map +1 -0
- package/dist/tools/pages/handlers-write.js +52 -0
- package/dist/tools/pages/handlers-write.js.map +1 -0
- package/dist/tools/pages/index.d.ts +17 -0
- package/dist/tools/pages/index.d.ts.map +1 -0
- package/dist/tools/pages/index.js +17 -0
- package/dist/tools/pages/index.js.map +1 -0
- package/dist/tools/pages/schemas.d.ts +30 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -0
- package/dist/tools/pages/schemas.js +30 -0
- package/dist/tools/pages/schemas.js.map +1 -0
- package/dist/tools/pages.d.ts +13 -0
- package/dist/tools/pages.d.ts.map +1 -0
- package/dist/tools/pages.js +13 -0
- package/dist/tools/pages.js.map +1 -0
- package/dist/tools/progress-phases.d.ts +46 -0
- package/dist/tools/progress-phases.d.ts.map +1 -0
- package/dist/tools/progress-phases.js +48 -0
- package/dist/tools/progress-phases.js.map +1 -0
- package/dist/tools/shared-schemas.d.ts +15 -0
- package/dist/tools/shared-schemas.d.ts.map +1 -0
- package/dist/tools/shared-schemas.js +30 -0
- package/dist/tools/shared-schemas.js.map +1 -0
- package/dist/tools/sources/builders.d.ts +13 -0
- package/dist/tools/sources/builders.d.ts.map +1 -0
- package/dist/tools/sources/builders.js +88 -0
- package/dist/tools/sources/builders.js.map +1 -0
- package/dist/tools/sources/handlers-bind.d.ts +26 -0
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
- package/dist/tools/sources/handlers-bind.js +123 -0
- package/dist/tools/sources/handlers-bind.js.map +1 -0
- package/dist/tools/sources/handlers.d.ts +45 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -0
- package/dist/tools/sources/handlers.js +84 -0
- package/dist/tools/sources/handlers.js.map +1 -0
- package/dist/tools/sources/index.d.ts +19 -0
- package/dist/tools/sources/index.d.ts.map +1 -0
- package/dist/tools/sources/index.js +18 -0
- package/dist/tools/sources/index.js.map +1 -0
- package/dist/tools/sources.d.ts +14 -0
- package/dist/tools/sources.d.ts.map +1 -0
- package/dist/tools/sources.js +14 -0
- package/dist/tools/sources.js.map +1 -0
- package/dist/tools/sparse-fields.d.ts +80 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -0
- package/dist/tools/sparse-fields.js +144 -0
- package/dist/tools/sparse-fields.js.map +1 -0
- package/dist/tools/tool-builder/annotations.d.ts +22 -0
- package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
- package/dist/tools/tool-builder/annotations.js +35 -0
- package/dist/tools/tool-builder/annotations.js.map +1 -0
- package/dist/tools/tool-builder/define.d.ts +31 -0
- package/dist/tools/tool-builder/define.d.ts.map +1 -0
- package/dist/tools/tool-builder/define.js +31 -0
- package/dist/tools/tool-builder/define.js.map +1 -0
- package/dist/tools/tool-builder/index.d.ts +28 -0
- package/dist/tools/tool-builder/index.d.ts.map +1 -0
- package/dist/tools/tool-builder/index.js +27 -0
- package/dist/tools/tool-builder/index.js.map +1 -0
- package/dist/tools/tool-builder/results.d.ts +59 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -0
- package/dist/tools/tool-builder/results.js +125 -0
- package/dist/tools/tool-builder/results.js.map +1 -0
- package/dist/tools/tool-builder/types.d.ts +82 -0
- package/dist/tools/tool-builder/types.d.ts.map +1 -0
- package/dist/tools/tool-builder/types.js +9 -0
- package/dist/tools/tool-builder/types.js.map +1 -0
- package/dist/tools/tool-builder.d.ts +16 -0
- package/dist/tools/tool-builder.d.ts.map +1 -0
- package/dist/tools/tool-builder.js +16 -0
- package/dist/tools/tool-builder.js.map +1 -0
- package/icon.png +0 -0
- package/manifest.json +63 -0
- package/package.json +81 -0
- package/skills/yootheme-builder/SKILL.md +582 -0
package/dist/client.js
ADDED
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `RestClient` — thin wrapper around `fetch` that targets the
|
|
3
|
+
* `yt-builder-mcp/v1` REST namespace.
|
|
4
|
+
*
|
|
5
|
+
* Responsibilities:
|
|
6
|
+
* - Compose final URLs (`{baseUrl}/wp-json/yt-builder-mcp/v1{path}`)
|
|
7
|
+
* - Attach `Authorization: Bearer …`
|
|
8
|
+
* - Encode JSON bodies + propagate `If-Match` etag headers
|
|
9
|
+
* - Map non-2xx into `RestError` with status / `code` / message
|
|
10
|
+
* - Map network failures into `NetworkError`
|
|
11
|
+
*
|
|
12
|
+
* The client deliberately keeps zero state beyond constructor config
|
|
13
|
+
* so each tool can hold a reference and call `.get/.post/.put/.delete`
|
|
14
|
+
* without coordinating sessions.
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
import { NetworkError, RestError } from './errors.js';
|
|
19
|
+
import { WordPressPlatform, WORDPRESS_REST_NAMESPACE_PATH } from './platform/index.js';
|
|
20
|
+
/**
|
|
21
|
+
* Canonical WordPress REST-namespace path. Re-exported for backward
|
|
22
|
+
* compat — new code should reach for `Platform.restNamespacePath`.
|
|
23
|
+
*/
|
|
24
|
+
export const REST_NAMESPACE_PATH = WORDPRESS_REST_NAMESPACE_PATH;
|
|
25
|
+
export class RestClient {
|
|
26
|
+
platform;
|
|
27
|
+
baseUrl;
|
|
28
|
+
bearerToken;
|
|
29
|
+
timeoutMs;
|
|
30
|
+
fetchImpl;
|
|
31
|
+
constructor(options) {
|
|
32
|
+
// Dual-form: accept either a `Platform` or a legacy `baseUrl`.
|
|
33
|
+
const platform = isPlatformOptions(options)
|
|
34
|
+
? options.platform
|
|
35
|
+
: new WordPressPlatform(options.baseUrl);
|
|
36
|
+
this.platform = platform;
|
|
37
|
+
this.baseUrl = platform.baseUrl.replace(/\/+$/, '');
|
|
38
|
+
this.bearerToken = options.bearerToken;
|
|
39
|
+
this.timeoutMs = options.timeoutMs ?? 15_000;
|
|
40
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
41
|
+
}
|
|
42
|
+
/** Expose the underlying platform (used by tools that need restNamespacePath/kind). */
|
|
43
|
+
getPlatform() {
|
|
44
|
+
return this.platform;
|
|
45
|
+
}
|
|
46
|
+
get(path, options = {}) {
|
|
47
|
+
return this.request('GET', path, options);
|
|
48
|
+
}
|
|
49
|
+
post(path, options = {}) {
|
|
50
|
+
return this.request('POST', path, options);
|
|
51
|
+
}
|
|
52
|
+
put(path, options = {}) {
|
|
53
|
+
return this.request('PUT', path, options);
|
|
54
|
+
}
|
|
55
|
+
delete(path, options = {}) {
|
|
56
|
+
return this.request('DELETE', path, options);
|
|
57
|
+
}
|
|
58
|
+
async request(method, path, options = {}) {
|
|
59
|
+
const url = this.buildUrl(path);
|
|
60
|
+
const headers = {
|
|
61
|
+
Authorization: `Bearer ${this.bearerToken}`,
|
|
62
|
+
Accept: 'application/json',
|
|
63
|
+
...(options.headers ?? {}),
|
|
64
|
+
};
|
|
65
|
+
if (options.etag !== undefined && options.etag !== '') {
|
|
66
|
+
headers['If-Match'] = options.etag;
|
|
67
|
+
}
|
|
68
|
+
const init = { method, headers };
|
|
69
|
+
if (options.body !== undefined) {
|
|
70
|
+
headers['Content-Type'] = 'application/json';
|
|
71
|
+
init.body = JSON.stringify(options.body);
|
|
72
|
+
}
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const timeoutId = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
75
|
+
if (options.signal !== undefined) {
|
|
76
|
+
options.signal.addEventListener('abort', () => controller.abort());
|
|
77
|
+
}
|
|
78
|
+
init.signal = controller.signal;
|
|
79
|
+
let response;
|
|
80
|
+
try {
|
|
81
|
+
response = await this.fetchImpl(url, init);
|
|
82
|
+
}
|
|
83
|
+
catch (e) {
|
|
84
|
+
throw new NetworkError({ cause: e, url });
|
|
85
|
+
}
|
|
86
|
+
finally {
|
|
87
|
+
clearTimeout(timeoutId);
|
|
88
|
+
}
|
|
89
|
+
const text = await response.text();
|
|
90
|
+
const parsed = parseJsonSafe(text);
|
|
91
|
+
if (!response.ok) {
|
|
92
|
+
throw new RestError({
|
|
93
|
+
status: response.status,
|
|
94
|
+
code: extractErrorCode(parsed),
|
|
95
|
+
message: extractErrorMessage(parsed, response.statusText),
|
|
96
|
+
body: parsed,
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
return parsed;
|
|
100
|
+
}
|
|
101
|
+
buildUrl(path) {
|
|
102
|
+
const normalized = path.startsWith('/') ? path : `/${path}`;
|
|
103
|
+
return `${this.baseUrl}${this.platform.restNamespacePath}${normalized}`;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
/** Type guard — discriminate between the two RestClientOptions shapes. */
|
|
107
|
+
function isPlatformOptions(opts) {
|
|
108
|
+
return 'platform' in opts && opts.platform !== undefined;
|
|
109
|
+
}
|
|
110
|
+
function parseJsonSafe(text) {
|
|
111
|
+
if (text.trim() === '')
|
|
112
|
+
return null;
|
|
113
|
+
try {
|
|
114
|
+
return JSON.parse(text);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
return text;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function extractErrorCode(body) {
|
|
121
|
+
if (body !== null && typeof body === 'object' && 'code' in body) {
|
|
122
|
+
const code = body.code;
|
|
123
|
+
if (typeof code === 'string')
|
|
124
|
+
return code;
|
|
125
|
+
}
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
function extractErrorMessage(body, fallback) {
|
|
129
|
+
if (body !== null && typeof body === 'object' && 'message' in body) {
|
|
130
|
+
const msg = body.message;
|
|
131
|
+
if (typeof msg === 'string' && msg !== '')
|
|
132
|
+
return msg;
|
|
133
|
+
}
|
|
134
|
+
return fallback !== '' ? fallback : 'Unknown REST error';
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* URL-encode a JSON-Pointer-style element path for use in the route.
|
|
138
|
+
*
|
|
139
|
+
* The plugin's regex captures everything after `/elements/`, so the
|
|
140
|
+
* raw `/grid/1/columns/0` path can be passed as-is — but each segment
|
|
141
|
+
* must be percent-encoded so reserved chars like `~` (used in
|
|
142
|
+
* JSON-Pointer escapes) don't collide with WordPress' router.
|
|
143
|
+
*/
|
|
144
|
+
export function encodeElementPath(pointer) {
|
|
145
|
+
if (pointer === '' || pointer === '/')
|
|
146
|
+
return '';
|
|
147
|
+
// Strip leading slash, split, encode each segment, rejoin.
|
|
148
|
+
const segments = pointer.replace(/^\//, '').split('/');
|
|
149
|
+
return segments.map(encodeURIComponent).join('/');
|
|
150
|
+
}
|
|
151
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAEtD,OAAO,EAAE,iBAAiB,EAAE,6BAA6B,EAAE,MAAM,qBAAqB,CAAC;AAEvF;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,6BAA6B,CAAC;AAyCjE,MAAM,OAAO,UAAU;IACF,QAAQ,CAAW;IACnB,OAAO,CAAS;IAChB,WAAW,CAAS;IACpB,SAAS,CAAS;IAClB,SAAS,CAAe;IAEzC,YAAY,OAA0B;QAClC,+DAA+D;QAC/D,MAAM,QAAQ,GAAa,iBAAiB,CAAC,OAAO,CAAC;YACjD,CAAC,CAAC,OAAO,CAAC,QAAQ;YAClB,CAAC,CAAC,IAAI,iBAAiB,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC7C,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,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CAAC;AACrB,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAa,EAAE,QAAgB;IACxD,IAAI,IAAI,KAAK,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,SAAS,IAAI,IAAI,EAAE,CAAC;QACjE,MAAM,GAAG,GAAI,IAA6B,CAAC,OAAO,CAAC;QACnD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,KAAK,EAAE;YAAE,OAAO,GAAG,CAAC;IAC1D,CAAC;IACD,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC;AAC7D,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC7C,IAAI,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,GAAG;QAAE,OAAO,EAAE,CAAC;IACjD,2DAA2D;IAC3D,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACvD,OAAO,QAAQ,CAAC,GAAG,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code (Anthropic CLI) config writer.
|
|
3
|
+
*
|
|
4
|
+
* All platforms: ~/.claude.json (single file)
|
|
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 claudeCodeClient: ClientWriter;
|
|
18
|
+
//# sourceMappingURL=claude-code.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.d.ts","sourceRoot":"","sources":["../../src/clients/claude-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAgBpF,eAAO,MAAM,gBAAgB,EAAE,YAqB9B,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Code (Anthropic CLI) config writer.
|
|
3
|
+
*
|
|
4
|
+
* All platforms: ~/.claude.json (single file)
|
|
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(), '.claude.json');
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Detection: either the user-config file already exists, or the
|
|
25
|
+
* `~/.claude/` directory does (Claude Code creates it on first run
|
|
26
|
+
* for skills, transcripts, etc., even before the JSON file lands).
|
|
27
|
+
*/
|
|
28
|
+
function isDetected() {
|
|
29
|
+
const home = userHome();
|
|
30
|
+
return existsSync(join(home, '.claude.json')) || existsSync(join(home, '.claude'));
|
|
31
|
+
}
|
|
32
|
+
export const claudeCodeClient = {
|
|
33
|
+
id: 'claude-code',
|
|
34
|
+
label: 'Claude Code',
|
|
35
|
+
configPath,
|
|
36
|
+
isDetected,
|
|
37
|
+
apply: async (serverName, config) => {
|
|
38
|
+
await patchJsonFile(configPath(), (current) => {
|
|
39
|
+
const servers = current.mcpServers !== null &&
|
|
40
|
+
typeof current.mcpServers === 'object' &&
|
|
41
|
+
!Array.isArray(current.mcpServers)
|
|
42
|
+
? { ...current.mcpServers }
|
|
43
|
+
: {};
|
|
44
|
+
servers[serverName] = {
|
|
45
|
+
command: config.command,
|
|
46
|
+
args: config.args,
|
|
47
|
+
env: config.env,
|
|
48
|
+
};
|
|
49
|
+
return { ...current, mcpServers: servers };
|
|
50
|
+
});
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=claude-code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-code.js","sourceRoot":"","sources":["../../src/clients/claude-code.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,cAAc,CAAC,CAAC;AAC5C,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU;IACf,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC;AACvF,CAAC;AAED,MAAM,CAAC,MAAM,gBAAgB,GAAiB;IAC1C,EAAE,EAAE,aAAa;IACjB,KAAK,EAAE,aAAa;IACpB,UAAU;IACV,UAAU;IACV,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,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Desktop config writer.
|
|
3
|
+
*
|
|
4
|
+
* macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
5
|
+
* Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
6
|
+
* Linux: ~/.config/Claude/claude_desktop_config.json (unofficial)
|
|
7
|
+
*
|
|
8
|
+
* Schema:
|
|
9
|
+
* {
|
|
10
|
+
* "mcpServers": {
|
|
11
|
+
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
import { type ClientWriter } from './index.js';
|
|
18
|
+
export declare const claudeDesktopClient: ClientWriter;
|
|
19
|
+
//# sourceMappingURL=claude-desktop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-desktop.d.ts","sourceRoot":"","sources":["../../src/clients/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAOH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AAgBpF,eAAO,MAAM,mBAAmB,EAAE,YAqBjC,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Claude Desktop config writer.
|
|
3
|
+
*
|
|
4
|
+
* macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
|
|
5
|
+
* Windows: %APPDATA%\Claude\claude_desktop_config.json
|
|
6
|
+
* Linux: ~/.config/Claude/claude_desktop_config.json (unofficial)
|
|
7
|
+
*
|
|
8
|
+
* Schema:
|
|
9
|
+
* {
|
|
10
|
+
* "mcpServers": {
|
|
11
|
+
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
12
|
+
* }
|
|
13
|
+
* }
|
|
14
|
+
*
|
|
15
|
+
* @license MIT
|
|
16
|
+
*/
|
|
17
|
+
import { existsSync } from 'node:fs';
|
|
18
|
+
import { platform } from 'node:os';
|
|
19
|
+
import { join } from 'node:path';
|
|
20
|
+
import { userHome } from './home.js';
|
|
21
|
+
import { patchJsonFile } from './index.js';
|
|
22
|
+
function configPath() {
|
|
23
|
+
const home = userHome();
|
|
24
|
+
switch (platform()) {
|
|
25
|
+
case 'darwin':
|
|
26
|
+
return join(home, 'Library', 'Application Support', 'Claude', 'claude_desktop_config.json');
|
|
27
|
+
case 'win32': {
|
|
28
|
+
const appData = process.env.APPDATA ?? join(home, 'AppData', 'Roaming');
|
|
29
|
+
return join(appData, 'Claude', 'claude_desktop_config.json');
|
|
30
|
+
}
|
|
31
|
+
default:
|
|
32
|
+
return join(home, '.config', 'Claude', 'claude_desktop_config.json');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export const claudeDesktopClient = {
|
|
36
|
+
id: 'claude-desktop',
|
|
37
|
+
label: 'Claude Desktop',
|
|
38
|
+
configPath,
|
|
39
|
+
isDetected: () => existsSync(configPath()),
|
|
40
|
+
apply: async (serverName, config) => {
|
|
41
|
+
await patchJsonFile(configPath(), (current) => {
|
|
42
|
+
const servers = current.mcpServers !== null &&
|
|
43
|
+
typeof current.mcpServers === 'object' &&
|
|
44
|
+
!Array.isArray(current.mcpServers)
|
|
45
|
+
? { ...current.mcpServers }
|
|
46
|
+
: {};
|
|
47
|
+
servers[serverName] = {
|
|
48
|
+
command: config.command,
|
|
49
|
+
args: config.args,
|
|
50
|
+
env: config.env,
|
|
51
|
+
};
|
|
52
|
+
return { ...current, mcpServers: servers };
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=claude-desktop.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude-desktop.js","sourceRoot":"","sources":["../../src/clients/claude-desktop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,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,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,QAAQ,QAAQ,EAAE,EAAE,CAAC;QACjB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;QAChG,KAAK,OAAO,CAAC,CAAC,CAAC;YACX,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;YACxE,OAAO,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;QACjE,CAAC;QACD;YACI,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,4BAA4B,CAAC,CAAC;IAC7E,CAAC;AACL,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAiB;IAC7C,EAAE,EAAE,gBAAgB;IACpB,KAAK,EAAE,gBAAgB;IACvB,UAAU;IACV,UAAU,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;IAC1C,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,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cline MCP config writer.
|
|
3
|
+
*
|
|
4
|
+
* Cline ships as the VS Code extension `saoudrizwan.claude-dev`. Per
|
|
5
|
+
* Cline's docs (`docs.cline.bot` "MCP / Configuration"), the per-user
|
|
6
|
+
* MCP server registry lives at
|
|
7
|
+
* `<vsCodeUserDir>/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
8
|
+
*
|
|
9
|
+
* VS Code's `<vsCodeUserDir>` is:
|
|
10
|
+
* macOS: ~/Library/Application Support/Code/User
|
|
11
|
+
* Linux: ~/.config/Code/User
|
|
12
|
+
* Windows: %APPDATA%\Code\User
|
|
13
|
+
*
|
|
14
|
+
* Schema mirrors Claude Desktop's `mcpServers` map:
|
|
15
|
+
*
|
|
16
|
+
* {
|
|
17
|
+
* "mcpServers": {
|
|
18
|
+
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @license MIT
|
|
23
|
+
*/
|
|
24
|
+
import { type ClientWriter } from './index.js';
|
|
25
|
+
export declare const clineClient: ClientWriter;
|
|
26
|
+
//# sourceMappingURL=cline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline.d.ts","sourceRoot":"","sources":["../../src/clients/cline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAOH,OAAO,EAAiB,KAAK,YAAY,EAAwB,MAAM,YAAY,CAAC;AA0CpF,eAAO,MAAM,WAAW,EAAE,YAqBzB,CAAC"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Cline MCP config writer.
|
|
3
|
+
*
|
|
4
|
+
* Cline ships as the VS Code extension `saoudrizwan.claude-dev`. Per
|
|
5
|
+
* Cline's docs (`docs.cline.bot` "MCP / Configuration"), the per-user
|
|
6
|
+
* MCP server registry lives at
|
|
7
|
+
* `<vsCodeUserDir>/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
|
|
8
|
+
*
|
|
9
|
+
* VS Code's `<vsCodeUserDir>` is:
|
|
10
|
+
* macOS: ~/Library/Application Support/Code/User
|
|
11
|
+
* Linux: ~/.config/Code/User
|
|
12
|
+
* Windows: %APPDATA%\Code\User
|
|
13
|
+
*
|
|
14
|
+
* Schema mirrors Claude Desktop's `mcpServers` map:
|
|
15
|
+
*
|
|
16
|
+
* {
|
|
17
|
+
* "mcpServers": {
|
|
18
|
+
* "<name>": { "command": "npx", "args": [...], "env": {...} }
|
|
19
|
+
* }
|
|
20
|
+
* }
|
|
21
|
+
*
|
|
22
|
+
* @license MIT
|
|
23
|
+
*/
|
|
24
|
+
import { existsSync } from 'node:fs';
|
|
25
|
+
import { platform } from 'node:os';
|
|
26
|
+
import { join } from 'node:path';
|
|
27
|
+
import { userHome } from './home.js';
|
|
28
|
+
import { patchJsonFile } from './index.js';
|
|
29
|
+
const EXTENSION_ID = 'saoudrizwan.claude-dev';
|
|
30
|
+
const SETTINGS_FILENAME = 'cline_mcp_settings.json';
|
|
31
|
+
function vsCodeUserDir() {
|
|
32
|
+
const home = userHome();
|
|
33
|
+
switch (platform()) {
|
|
34
|
+
case 'darwin':
|
|
35
|
+
return join(home, 'Library', 'Application Support', 'Code', 'User');
|
|
36
|
+
case 'win32': {
|
|
37
|
+
const appData = process.env.APPDATA ?? join(home, 'AppData', 'Roaming');
|
|
38
|
+
return join(appData, 'Code', 'User');
|
|
39
|
+
}
|
|
40
|
+
default:
|
|
41
|
+
return join(home, '.config', 'Code', 'User');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function configPath() {
|
|
45
|
+
return join(vsCodeUserDir(), 'globalStorage', EXTENSION_ID, 'settings', SETTINGS_FILENAME);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Detection: prefer the most concrete signal we can get without
|
|
49
|
+
* triggering false-negatives on a fresh install. The extension's
|
|
50
|
+
* globalStorage directory is created on first launch — checking for
|
|
51
|
+
* its existence reliably distinguishes "Cline installed" from "VS
|
|
52
|
+
* Code installed without Cline". As a fallback we accept the bare
|
|
53
|
+
* VS Code user dir so the wizard at least surfaces the option.
|
|
54
|
+
*/
|
|
55
|
+
function isDetected() {
|
|
56
|
+
const extDir = join(vsCodeUserDir(), 'globalStorage', EXTENSION_ID);
|
|
57
|
+
return existsSync(extDir) || existsSync(configPath());
|
|
58
|
+
}
|
|
59
|
+
export const clineClient = {
|
|
60
|
+
id: 'cline',
|
|
61
|
+
label: 'Cline (VS Code)',
|
|
62
|
+
configPath,
|
|
63
|
+
isDetected,
|
|
64
|
+
apply: async (serverName, config) => {
|
|
65
|
+
await patchJsonFile(configPath(), (current) => {
|
|
66
|
+
const servers = current.mcpServers !== null &&
|
|
67
|
+
typeof current.mcpServers === 'object' &&
|
|
68
|
+
!Array.isArray(current.mcpServers)
|
|
69
|
+
? { ...current.mcpServers }
|
|
70
|
+
: {};
|
|
71
|
+
servers[serverName] = {
|
|
72
|
+
command: config.command,
|
|
73
|
+
args: config.args,
|
|
74
|
+
env: config.env,
|
|
75
|
+
};
|
|
76
|
+
return { ...current, mcpServers: servers };
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
//# sourceMappingURL=cline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cline.js","sourceRoot":"","sources":["../../src/clients/cline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,aAAa,EAA2C,MAAM,YAAY,CAAC;AAEpF,MAAM,YAAY,GAAG,wBAAwB,CAAC;AAC9C,MAAM,iBAAiB,GAAG,yBAAyB,CAAC;AAEpD,SAAS,aAAa;IAClB,MAAM,IAAI,GAAG,QAAQ,EAAE,CAAC;IACxB,QAAQ,QAAQ,EAAE,EAAE,CAAC;QACjB,KAAK,QAAQ;YACT,OAAO,IAAI,CAAC,IAAI,EAAE,SAAS,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACxE,KAAK,OAAO,CAAC,CAAC,CAAC;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G,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,42 @@
|
|
|
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 type { ClientWriter } from './index.js';
|
|
41
|
+
export declare const codexCliClient: ClientWriter;
|
|
42
|
+
//# sourceMappingURL=codex-cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-cli.d.ts","sourceRoot":"","sources":["../../src/clients/codex-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsCG;AAOH,OAAO,KAAK,EAAE,YAAY,EAAmB,MAAM,YAAY,CAAC;AA4HhE,eAAO,MAAM,cAAc,EAAE,YA6B5B,CAAC"}
|