@wootsup/yt-builder-mcp 1.1.7 → 1.3.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.
- package/README.md +14 -10
- package/bin/yt-builder-mcp.js +55 -40
- package/dist/auth.d.ts +18 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +18 -0
- package/dist/auth.js.map +1 -1
- package/dist/catalog/build-catalog.d.ts +63 -0
- package/dist/catalog/build-catalog.d.ts.map +1 -0
- package/dist/catalog/build-catalog.js +166 -0
- package/dist/catalog/build-catalog.js.map +1 -0
- package/dist/cli/invocation-decision.d.ts +57 -0
- package/dist/cli/invocation-decision.d.ts.map +1 -0
- package/dist/cli/invocation-decision.js +86 -0
- package/dist/cli/invocation-decision.js.map +1 -0
- package/dist/client.d.ts +28 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +40 -1
- package/dist/client.js.map +1 -1
- package/dist/clients/claude-code.d.ts.map +1 -1
- package/dist/clients/claude-code.js +3 -1
- package/dist/clients/claude-code.js.map +1 -1
- package/dist/clients/claude-desktop.d.ts.map +1 -1
- package/dist/clients/claude-desktop.js +3 -1
- package/dist/clients/claude-desktop.js.map +1 -1
- package/dist/clients/cline.d.ts.map +1 -1
- package/dist/clients/cline.js +3 -1
- package/dist/clients/cline.js.map +1 -1
- package/dist/clients/codex-cli.d.ts +1 -1
- package/dist/clients/codex-cli.d.ts.map +1 -1
- package/dist/clients/codex-cli.js +98 -0
- package/dist/clients/codex-cli.js.map +1 -1
- package/dist/clients/continue.d.ts.map +1 -1
- package/dist/clients/continue.js +70 -1
- package/dist/clients/continue.js.map +1 -1
- package/dist/clients/cursor.d.ts.map +1 -1
- package/dist/clients/cursor.js +3 -1
- package/dist/clients/cursor.js.map +1 -1
- package/dist/clients/gemini-cli.d.ts.map +1 -1
- package/dist/clients/gemini-cli.js +3 -1
- package/dist/clients/gemini-cli.js.map +1 -1
- package/dist/clients/index.d.ts +104 -0
- package/dist/clients/index.d.ts.map +1 -1
- package/dist/clients/index.js +141 -0
- package/dist/clients/index.js.map +1 -1
- package/dist/clients/roo-code.d.ts.map +1 -1
- package/dist/clients/roo-code.js +3 -1
- package/dist/clients/roo-code.js.map +1 -1
- package/dist/clients/zed.d.ts.map +1 -1
- package/dist/clients/zed.js +3 -1
- package/dist/clients/zed.js.map +1 -1
- package/dist/gateway/advanced-read-tool.d.ts +37 -0
- package/dist/gateway/advanced-read-tool.d.ts.map +1 -0
- package/dist/gateway/advanced-read-tool.js +156 -0
- package/dist/gateway/advanced-read-tool.js.map +1 -0
- package/dist/gateway/advanced-tool/domains.d.ts +18 -3
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/domains.js +28 -9
- package/dist/gateway/advanced-tool/domains.js.map +1 -1
- package/dist/gateway/advanced-tool/register.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/register.js +43 -11
- package/dist/gateway/advanced-tool/register.js.map +1 -1
- package/dist/gateway/essentials.d.ts +14 -4
- package/dist/gateway/essentials.d.ts.map +1 -1
- package/dist/gateway/essentials.js +55 -5
- package/dist/gateway/essentials.js.map +1 -1
- package/dist/gateway/test-support.d.ts +3 -3
- package/dist/gateway/test-support.js +3 -3
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -1
- package/dist/index.js.map +1 -1
- package/dist/install-skill.js +1 -1
- package/dist/proxy/bridge.d.ts +36 -0
- package/dist/proxy/bridge.d.ts.map +1 -0
- package/dist/proxy/bridge.js +129 -0
- package/dist/proxy/bridge.js.map +1 -0
- package/dist/proxy/mode.d.ts +10 -0
- package/dist/proxy/mode.d.ts.map +1 -0
- package/dist/proxy/mode.js +20 -0
- package/dist/proxy/mode.js.map +1 -0
- package/dist/server.d.ts +6 -4
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -4
- package/dist/server.js.map +1 -1
- package/dist/setup-cli.d.ts +41 -0
- package/dist/setup-cli.d.ts.map +1 -1
- package/dist/setup-cli.js +163 -1
- package/dist/setup-cli.js.map +1 -1
- package/dist/setup-prompts.d.ts +23 -0
- package/dist/setup-prompts.d.ts.map +1 -1
- package/dist/setup-prompts.js +76 -1
- package/dist/setup-prompts.js.map +1 -1
- package/dist/setup-wizard.d.ts.map +1 -1
- package/dist/setup-wizard.js +7 -0
- package/dist/setup-wizard.js.map +1 -1
- package/dist/sites/bootstrap.d.ts +41 -0
- package/dist/sites/bootstrap.d.ts.map +1 -0
- package/dist/sites/bootstrap.js +58 -0
- package/dist/sites/bootstrap.js.map +1 -0
- package/dist/sites/client-pool.d.ts +33 -0
- package/dist/sites/client-pool.d.ts.map +1 -1
- package/dist/sites/client-pool.js +69 -1
- package/dist/sites/client-pool.js.map +1 -1
- package/dist/sites/registry.d.ts +30 -0
- package/dist/sites/registry.d.ts.map +1 -1
- package/dist/sites/registry.js.map +1 -1
- package/dist/sites/store.d.ts +8 -1
- package/dist/sites/store.d.ts.map +1 -1
- package/dist/sites/store.js +17 -2
- package/dist/sites/store.js.map +1 -1
- package/dist/sites/tools/index.d.ts.map +1 -1
- package/dist/sites/tools/index.js +9 -1
- package/dist/sites/tools/index.js.map +1 -1
- package/dist/sites/tools/use-site.d.ts +47 -0
- package/dist/sites/tools/use-site.d.ts.map +1 -0
- package/dist/sites/tools/use-site.js +203 -0
- package/dist/sites/tools/use-site.js.map +1 -0
- package/dist/tools/bind-guidance.d.ts +80 -0
- package/dist/tools/bind-guidance.d.ts.map +1 -0
- package/dist/tools/bind-guidance.js +95 -0
- package/dist/tools/bind-guidance.js.map +1 -0
- package/dist/tools/elements/builders.d.ts.map +1 -1
- package/dist/tools/elements/builders.js +75 -18
- package/dist/tools/elements/builders.js.map +1 -1
- package/dist/tools/elements/handlers-write.d.ts +20 -3
- package/dist/tools/elements/handlers-write.d.ts.map +1 -1
- package/dist/tools/elements/handlers-write.js +372 -10
- package/dist/tools/elements/handlers-write.js.map +1 -1
- package/dist/tools/elements/handlers.d.ts +6 -1
- package/dist/tools/elements/handlers.d.ts.map +1 -1
- package/dist/tools/elements/handlers.js +77 -10
- package/dist/tools/elements/handlers.js.map +1 -1
- package/dist/tools/elements/layout-hierarchy-rules.d.ts +62 -0
- package/dist/tools/elements/layout-hierarchy-rules.d.ts.map +1 -0
- package/dist/tools/elements/layout-hierarchy-rules.js +154 -0
- package/dist/tools/elements/layout-hierarchy-rules.js.map +1 -0
- package/dist/tools/format/elements-format.d.ts +35 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -1
- package/dist/tools/format/elements-format.js +134 -12
- package/dist/tools/format/elements-format.js.map +1 -1
- package/dist/tools/format/inspection-format.d.ts +29 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -1
- package/dist/tools/format/inspection-format.js +99 -22
- package/dist/tools/format/inspection-format.js.map +1 -1
- package/dist/tools/format/pages-format.d.ts.map +1 -1
- package/dist/tools/format/pages-format.js +7 -0
- package/dist/tools/format/pages-format.js.map +1 -1
- package/dist/tools/format/sources-format.d.ts +8 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -1
- package/dist/tools/format/sources-format.js +10 -0
- package/dist/tools/format/sources-format.js.map +1 -1
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +24 -0
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +4 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/inspection.d.ts +24 -0
- package/dist/tools/inspection.d.ts.map +1 -1
- package/dist/tools/inspection.js +297 -5
- package/dist/tools/inspection.js.map +1 -1
- package/dist/tools/layout-flatten.d.ts +11 -8
- package/dist/tools/layout-flatten.d.ts.map +1 -1
- package/dist/tools/layout-flatten.js +17 -6
- package/dist/tools/layout-flatten.js.map +1 -1
- package/dist/tools/multi-items/builders.d.ts.map +1 -1
- package/dist/tools/multi-items/builders.js +18 -3
- package/dist/tools/multi-items/builders.js.map +1 -1
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/clean-implode-handler.js +2 -2
- package/dist/tools/multi-items/clean-implode-handler.js.map +1 -1
- package/dist/tools/multi-items/format/inspection-format.d.ts +41 -0
- package/dist/tools/multi-items/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/multi-items/format/inspection-format.js +64 -0
- package/dist/tools/multi-items/format/inspection-format.js.map +1 -0
- package/dist/tools/multi-items/inspect-handler.d.ts +50 -2
- package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -1
- package/dist/tools/multi-items/inspect-handler.js +237 -10
- package/dist/tools/multi-items/inspect-handler.js.map +1 -1
- package/dist/tools/multi-items/inspection-cache.d.ts +85 -0
- package/dist/tools/multi-items/inspection-cache.d.ts.map +1 -0
- package/dist/tools/multi-items/inspection-cache.js +126 -0
- package/dist/tools/multi-items/inspection-cache.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +31 -2
- package/dist/tools/pages/builders.d.ts.map +1 -1
- package/dist/tools/pages/builders.js +173 -17
- package/dist/tools/pages/builders.js.map +1 -1
- package/dist/tools/pages/handlers-read.d.ts +6 -2
- package/dist/tools/pages/handlers-read.d.ts.map +1 -1
- package/dist/tools/pages/handlers-read.js +228 -26
- package/dist/tools/pages/handlers-read.js.map +1 -1
- package/dist/tools/pages/handlers-write.d.ts +143 -7
- package/dist/tools/pages/handlers-write.d.ts.map +1 -1
- package/dist/tools/pages/handlers-write.js +215 -11
- package/dist/tools/pages/handlers-write.js.map +1 -1
- package/dist/tools/pages/index.d.ts +1 -1
- package/dist/tools/pages/index.d.ts.map +1 -1
- package/dist/tools/pages/index.js +1 -1
- package/dist/tools/pages/index.js.map +1 -1
- package/dist/tools/pages/schemas.d.ts +166 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -1
- package/dist/tools/pages/schemas.js +347 -0
- package/dist/tools/pages/schemas.js.map +1 -1
- package/dist/tools/shared-schemas.d.ts.map +1 -1
- package/dist/tools/shared-schemas.js +26 -11
- package/dist/tools/shared-schemas.js.map +1 -1
- package/dist/tools/sources/builders.d.ts.map +1 -1
- package/dist/tools/sources/builders.js +64 -6
- package/dist/tools/sources/builders.js.map +1 -1
- package/dist/tools/sources/handlers-bind.d.ts +13 -1
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -1
- package/dist/tools/sources/handlers-bind.js +219 -5
- package/dist/tools/sources/handlers-bind.js.map +1 -1
- package/dist/tools/sources/handlers.d.ts +3 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -1
- package/dist/tools/sources/handlers.js +45 -8
- package/dist/tools/sources/handlers.js.map +1 -1
- package/dist/tools/sparse-fields.d.ts +23 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -1
- package/dist/tools/sparse-fields.js +29 -0
- package/dist/tools/sparse-fields.js.map +1 -1
- package/dist/tools/sublayout/builders.d.ts +23 -0
- package/dist/tools/sublayout/builders.d.ts.map +1 -0
- package/dist/tools/sublayout/builders.js +54 -0
- package/dist/tools/sublayout/builders.js.map +1 -0
- package/dist/tools/sublayout/index.d.ts +13 -0
- package/dist/tools/sublayout/index.d.ts.map +1 -0
- package/dist/tools/sublayout/index.js +13 -0
- package/dist/tools/sublayout/index.js.map +1 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.d.ts +95 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.d.ts.map +1 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.js +181 -0
- package/dist/tools/sublayout/inspect-sublayout-handler.js.map +1 -0
- package/dist/tools/tool-builder/results.d.ts +31 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -1
- package/dist/tools/tool-builder/results.js +95 -4
- package/dist/tools/tool-builder/results.js.map +1 -1
- package/dist/uninstall-skill.d.ts +52 -0
- package/dist/uninstall-skill.d.ts.map +1 -0
- package/dist/uninstall-skill.js +146 -0
- package/dist/uninstall-skill.js.map +1 -0
- package/dist/uninstall.d.ts +73 -0
- package/dist/uninstall.d.ts.map +1 -0
- package/dist/uninstall.js +82 -0
- package/dist/uninstall.js.map +1 -0
- package/icon.png +0 -0
- package/manifest.json +10 -10
- package/package.json +7 -3
- package/skills/yt-builder-mcp/SKILL.md +157 -88
package/dist/clients/index.d.ts
CHANGED
|
@@ -33,7 +33,88 @@ export interface ClientWriter {
|
|
|
33
33
|
isDetected: () => boolean;
|
|
34
34
|
/** Apply the MCP server config to the file. Creates the file if missing. */
|
|
35
35
|
apply: (serverName: string, config: McpServerConfig) => Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Inspect the config file for an existing yt-builder-mcp server entry.
|
|
38
|
+
* The inverse of {@link apply} — used by the `uninstall` subcommand to
|
|
39
|
+
* decide which clients to surface in the removal checklist.
|
|
40
|
+
*
|
|
41
|
+
* Matches by EITHER a known server key (`yt-builder-mcp` /
|
|
42
|
+
* `yootheme-builder`, see {@link KNOWN_SERVER_KEYS}) OR any entry whose
|
|
43
|
+
* command/args reference the `@wootsup/yt-builder-mcp` npm package —
|
|
44
|
+
* this catches legacy/renamed leftovers a user may have hand-edited or
|
|
45
|
+
* an older wizard version wrote under a different key.
|
|
46
|
+
*
|
|
47
|
+
* Never throws on a missing / malformed file; returns `present: false`.
|
|
48
|
+
*/
|
|
49
|
+
detect: () => Promise<ClientDetection>;
|
|
50
|
+
/**
|
|
51
|
+
* Remove the matched yt-builder-mcp server entry from the config file.
|
|
52
|
+
* Inverse of {@link apply}: atomic (read → mutate → write), preserves
|
|
53
|
+
* every other server + unrelated config, idempotent (a no-op when no
|
|
54
|
+
* matching entry exists), and never creates the file if it is missing.
|
|
55
|
+
*
|
|
56
|
+
* Returns the keys/names actually removed so the caller can render an
|
|
57
|
+
* accurate summary.
|
|
58
|
+
*/
|
|
59
|
+
remove: () => Promise<ClientRemoval>;
|
|
36
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Result of a {@link ClientWriter.detect} probe.
|
|
63
|
+
*/
|
|
64
|
+
export interface ClientDetection {
|
|
65
|
+
/** True when at least one matching server entry was found. */
|
|
66
|
+
readonly present: boolean;
|
|
67
|
+
/** Absolute config-file path that was inspected. */
|
|
68
|
+
readonly configPath: string;
|
|
69
|
+
/**
|
|
70
|
+
* The server keys/names that matched (e.g. `['yt-builder-mcp']`). For
|
|
71
|
+
* the Continue array-format this is the entry `name`s; for codex-cli it
|
|
72
|
+
* is the TOML table key. Empty when `present` is false.
|
|
73
|
+
*/
|
|
74
|
+
readonly matchedKeys: readonly string[];
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Result of a {@link ClientWriter.remove} operation.
|
|
78
|
+
*/
|
|
79
|
+
export interface ClientRemoval {
|
|
80
|
+
/** True when one or more entries were removed from the file. */
|
|
81
|
+
readonly removed: boolean;
|
|
82
|
+
/** Absolute config-file path that was mutated (or inspected). */
|
|
83
|
+
readonly configPath: string;
|
|
84
|
+
/** The server keys/names actually removed. Empty on a no-op. */
|
|
85
|
+
readonly removedKeys: readonly string[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Canonical + legacy server keys the wizard has ever written. `detect` /
|
|
89
|
+
* `remove` match any of these by name, in addition to the
|
|
90
|
+
* package-reference heuristic. Ordered canonical-first.
|
|
91
|
+
*
|
|
92
|
+
* - `yt-builder-mcp` — current key (1.0.2 Wave-R Part 2, see setup-wizard.ts).
|
|
93
|
+
* - `yootheme-builder` — pre-1.0.1 key (alpha-tester only; no production installs).
|
|
94
|
+
*/
|
|
95
|
+
export declare const KNOWN_SERVER_KEYS: readonly string[];
|
|
96
|
+
/**
|
|
97
|
+
* The npm package name an AI-client server entry runs. Used by the
|
|
98
|
+
* package-reference heuristic in `detect` / `remove` so a hand-edited or
|
|
99
|
+
* differently-keyed leftover (e.g. `"yt-builder": { command: "npx", args:
|
|
100
|
+
* ["-y", "@wootsup/yt-builder-mcp"] }`) is still caught.
|
|
101
|
+
*/
|
|
102
|
+
export declare const PACKAGE_NAME = "@wootsup/yt-builder-mcp";
|
|
103
|
+
/**
|
|
104
|
+
* True when a JSON MCP-server entry references our npm package via its
|
|
105
|
+
* `command` / `args`. Defensive across shapes: an entry might be `{
|
|
106
|
+
* command: 'npx', args: ['-y', '@wootsup/yt-builder-mcp'] }`, or a
|
|
107
|
+
* Zed-style `{ command: { path, args } }`, or a Continue-style `{
|
|
108
|
+
* transport: { command, args } }`. We stringify the command+args island
|
|
109
|
+
* and substring-match the package name.
|
|
110
|
+
*/
|
|
111
|
+
export declare function entryReferencesPackage(entry: unknown): boolean;
|
|
112
|
+
/**
|
|
113
|
+
* Compute which keys of a JSON server-map (`mcpServers` /
|
|
114
|
+
* `context_servers`) match yt-builder-mcp — by known key name OR by
|
|
115
|
+
* package reference. Shared by the JSON-format clients' detect/remove.
|
|
116
|
+
*/
|
|
117
|
+
export declare function matchServerMapKeys(servers: Record<string, unknown>): string[];
|
|
37
118
|
export declare const ALL_CLIENTS: readonly ClientWriter[];
|
|
38
119
|
export interface DetectedClient {
|
|
39
120
|
readonly id: string;
|
|
@@ -48,5 +129,28 @@ export declare function findClient(id: string): ClientWriter | undefined;
|
|
|
48
129
|
* Creates parent directories if missing.
|
|
49
130
|
*/
|
|
50
131
|
export declare function patchJsonFile(path: string, mutator: (current: Record<string, unknown>) => Record<string, unknown>): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Read a JSON config file WITHOUT creating it. Returns `null` when the
|
|
134
|
+
* file is missing or unparseable (the inverse-friendly read for detect /
|
|
135
|
+
* remove, which must be no-ops on absent config). On a parse error we
|
|
136
|
+
* return `null` rather than `{}` so callers can distinguish "no config to
|
|
137
|
+
* touch" from "empty object".
|
|
138
|
+
*/
|
|
139
|
+
export declare function readJsonFileOrNull(path: string): Promise<Record<string, unknown> | null>;
|
|
140
|
+
/**
|
|
141
|
+
* Detect helper for the JSON server-map clients (Claude Desktop / Code,
|
|
142
|
+
* Cursor, Cline, Roo Code, Gemini CLI use `mcpServers`; Zed uses
|
|
143
|
+
* `context_servers`). Reads the file, pulls the named map, and returns
|
|
144
|
+
* the matching keys.
|
|
145
|
+
*/
|
|
146
|
+
export declare function detectInServerMap(path: string, mapKey: 'mcpServers' | 'context_servers'): Promise<ClientDetection>;
|
|
147
|
+
/**
|
|
148
|
+
* Remove helper for the JSON server-map clients. Atomic read → delete →
|
|
149
|
+
* write, preserving every other key in the map AND every other top-level
|
|
150
|
+
* key in the file. No-op (no write) when nothing matches or the file is
|
|
151
|
+
* absent. When the map becomes empty it is dropped entirely so we don't
|
|
152
|
+
* leave a dangling `"mcpServers": {}` behind.
|
|
153
|
+
*/
|
|
154
|
+
export declare function removeFromServerMap(path: string, mapKey: 'mcpServers' | 'context_servers'): Promise<ClientRemoval>;
|
|
51
155
|
export { claudeCodeClient, claudeDesktopClient, clineClient, codexCliClient, continueClient, cursorClient, geminiCliClient, rooCodeClient, zedClient, };
|
|
52
156
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +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,MAA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AAM,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;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACpC,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAazC;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACnC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,GAAG,iBAAiB,GACzC,OAAO,CAAC,eAAe,CAAC,CAW1B;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,YAAY,GAAG,iBAAiB,GACzC,OAAO,CAAC,aAAa,CAAC,CAuBxB;AAED,OAAO,EACH,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,cAAc,EACd,cAAc,EACd,YAAY,EACZ,eAAe,EACf,aAAa,EACb,SAAS,GACZ,CAAC"}
|
package/dist/clients/index.js
CHANGED
|
@@ -22,6 +22,72 @@ import { cursorClient } from './cursor.js';
|
|
|
22
22
|
import { geminiCliClient } from './gemini-cli.js';
|
|
23
23
|
import { rooCodeClient } from './roo-code.js';
|
|
24
24
|
import { zedClient } from './zed.js';
|
|
25
|
+
/**
|
|
26
|
+
* Canonical + legacy server keys the wizard has ever written. `detect` /
|
|
27
|
+
* `remove` match any of these by name, in addition to the
|
|
28
|
+
* package-reference heuristic. Ordered canonical-first.
|
|
29
|
+
*
|
|
30
|
+
* - `yt-builder-mcp` — current key (1.0.2 Wave-R Part 2, see setup-wizard.ts).
|
|
31
|
+
* - `yootheme-builder` — pre-1.0.1 key (alpha-tester only; no production installs).
|
|
32
|
+
*/
|
|
33
|
+
export const KNOWN_SERVER_KEYS = ['yt-builder-mcp', 'yootheme-builder'];
|
|
34
|
+
/**
|
|
35
|
+
* The npm package name an AI-client server entry runs. Used by the
|
|
36
|
+
* package-reference heuristic in `detect` / `remove` so a hand-edited or
|
|
37
|
+
* differently-keyed leftover (e.g. `"yt-builder": { command: "npx", args:
|
|
38
|
+
* ["-y", "@wootsup/yt-builder-mcp"] }`) is still caught.
|
|
39
|
+
*/
|
|
40
|
+
export const PACKAGE_NAME = '@wootsup/yt-builder-mcp';
|
|
41
|
+
/**
|
|
42
|
+
* True when a JSON MCP-server entry references our npm package via its
|
|
43
|
+
* `command` / `args`. Defensive across shapes: an entry might be `{
|
|
44
|
+
* command: 'npx', args: ['-y', '@wootsup/yt-builder-mcp'] }`, or a
|
|
45
|
+
* Zed-style `{ command: { path, args } }`, or a Continue-style `{
|
|
46
|
+
* transport: { command, args } }`. We stringify the command+args island
|
|
47
|
+
* and substring-match the package name.
|
|
48
|
+
*/
|
|
49
|
+
export function entryReferencesPackage(entry) {
|
|
50
|
+
if (entry === null || typeof entry !== 'object')
|
|
51
|
+
return false;
|
|
52
|
+
const haystacks = [];
|
|
53
|
+
const rec = entry;
|
|
54
|
+
haystacks.push(rec.command, rec.args);
|
|
55
|
+
// Zed nests command under `command: { path, args }`.
|
|
56
|
+
if (rec.command !== null && typeof rec.command === 'object') {
|
|
57
|
+
const cmd = rec.command;
|
|
58
|
+
haystacks.push(cmd.path, cmd.args);
|
|
59
|
+
}
|
|
60
|
+
// Continue nests under `transport: { command, args }`.
|
|
61
|
+
if (rec.transport !== null && typeof rec.transport === 'object') {
|
|
62
|
+
const t = rec.transport;
|
|
63
|
+
haystacks.push(t.command, t.args);
|
|
64
|
+
}
|
|
65
|
+
for (const h of haystacks) {
|
|
66
|
+
if (typeof h === 'string' && h.includes(PACKAGE_NAME))
|
|
67
|
+
return true;
|
|
68
|
+
if (Array.isArray(h)) {
|
|
69
|
+
for (const v of h) {
|
|
70
|
+
if (typeof v === 'string' && v.includes(PACKAGE_NAME))
|
|
71
|
+
return true;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Compute which keys of a JSON server-map (`mcpServers` /
|
|
79
|
+
* `context_servers`) match yt-builder-mcp — by known key name OR by
|
|
80
|
+
* package reference. Shared by the JSON-format clients' detect/remove.
|
|
81
|
+
*/
|
|
82
|
+
export function matchServerMapKeys(servers) {
|
|
83
|
+
const matched = [];
|
|
84
|
+
for (const [key, entry] of Object.entries(servers)) {
|
|
85
|
+
if (KNOWN_SERVER_KEYS.includes(key) || entryReferencesPackage(entry)) {
|
|
86
|
+
matched.push(key);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return matched;
|
|
90
|
+
}
|
|
25
91
|
export const ALL_CLIENTS = [
|
|
26
92
|
claudeDesktopClient,
|
|
27
93
|
claudeCodeClient,
|
|
@@ -68,5 +134,80 @@ export async function patchJsonFile(path, mutator) {
|
|
|
68
134
|
const next = mutator(current);
|
|
69
135
|
await writeFile(path, JSON.stringify(next, null, 2) + '\n', 'utf-8');
|
|
70
136
|
}
|
|
137
|
+
/**
|
|
138
|
+
* Read a JSON config file WITHOUT creating it. Returns `null` when the
|
|
139
|
+
* file is missing or unparseable (the inverse-friendly read for detect /
|
|
140
|
+
* remove, which must be no-ops on absent config). On a parse error we
|
|
141
|
+
* return `null` rather than `{}` so callers can distinguish "no config to
|
|
142
|
+
* touch" from "empty object".
|
|
143
|
+
*/
|
|
144
|
+
export async function readJsonFileOrNull(path) {
|
|
145
|
+
if (!existsSync(path))
|
|
146
|
+
return null;
|
|
147
|
+
try {
|
|
148
|
+
const raw = await readFile(path, 'utf-8');
|
|
149
|
+
if (raw.trim() === '')
|
|
150
|
+
return null;
|
|
151
|
+
const parsed = JSON.parse(raw);
|
|
152
|
+
if (parsed !== null && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
153
|
+
return parsed;
|
|
154
|
+
}
|
|
155
|
+
return null;
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Detect helper for the JSON server-map clients (Claude Desktop / Code,
|
|
163
|
+
* Cursor, Cline, Roo Code, Gemini CLI use `mcpServers`; Zed uses
|
|
164
|
+
* `context_servers`). Reads the file, pulls the named map, and returns
|
|
165
|
+
* the matching keys.
|
|
166
|
+
*/
|
|
167
|
+
export async function detectInServerMap(path, mapKey) {
|
|
168
|
+
const current = await readJsonFileOrNull(path);
|
|
169
|
+
if (current === null) {
|
|
170
|
+
return { present: false, configPath: path, matchedKeys: [] };
|
|
171
|
+
}
|
|
172
|
+
const raw = current[mapKey];
|
|
173
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
174
|
+
return { present: false, configPath: path, matchedKeys: [] };
|
|
175
|
+
}
|
|
176
|
+
const matched = matchServerMapKeys(raw);
|
|
177
|
+
return { present: matched.length > 0, configPath: path, matchedKeys: matched };
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Remove helper for the JSON server-map clients. Atomic read → delete →
|
|
181
|
+
* write, preserving every other key in the map AND every other top-level
|
|
182
|
+
* key in the file. No-op (no write) when nothing matches or the file is
|
|
183
|
+
* absent. When the map becomes empty it is dropped entirely so we don't
|
|
184
|
+
* leave a dangling `"mcpServers": {}` behind.
|
|
185
|
+
*/
|
|
186
|
+
export async function removeFromServerMap(path, mapKey) {
|
|
187
|
+
const current = await readJsonFileOrNull(path);
|
|
188
|
+
if (current === null) {
|
|
189
|
+
return { removed: false, configPath: path, removedKeys: [] };
|
|
190
|
+
}
|
|
191
|
+
const raw = current[mapKey];
|
|
192
|
+
if (raw === null || typeof raw !== 'object' || Array.isArray(raw)) {
|
|
193
|
+
return { removed: false, configPath: path, removedKeys: [] };
|
|
194
|
+
}
|
|
195
|
+
const servers = { ...raw };
|
|
196
|
+
const matched = matchServerMapKeys(servers);
|
|
197
|
+
if (matched.length === 0) {
|
|
198
|
+
return { removed: false, configPath: path, removedKeys: [] };
|
|
199
|
+
}
|
|
200
|
+
for (const key of matched)
|
|
201
|
+
delete servers[key];
|
|
202
|
+
const next = { ...current };
|
|
203
|
+
if (Object.keys(servers).length === 0) {
|
|
204
|
+
delete next[mapKey];
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
next[mapKey] = servers;
|
|
208
|
+
}
|
|
209
|
+
await writeFile(path, JSON.stringify(next, null, 2) + '\n', 'utf-8');
|
|
210
|
+
return { removed: true, configPath: path, removedKeys: matched };
|
|
211
|
+
}
|
|
71
212
|
export { claudeCodeClient, claudeDesktopClient, clineClient, codexCliClient, continueClient, cursorClient, geminiCliClient, rooCodeClient, zedClient, };
|
|
72
213
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clients/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;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,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qB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b,SAAS,GACZ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roo-code.d.ts","sourceRoot":"","sources":["../../src/clients/roo-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,
|
|
1
|
+
{"version":3,"file":"roo-code.d.ts","sourceRoot":"","sources":["../../src/clients/roo-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAOH,OAAO,EAIH,KAAK,YAAY,EAEpB,MAAM,YAAY,CAAC;AAkCpB,eAAO,MAAM,aAAa,EAAE,YAuB3B,CAAC"}
|
package/dist/clients/roo-code.js
CHANGED
|
@@ -22,7 +22,7 @@ import { existsSync } from 'node:fs';
|
|
|
22
22
|
import { platform } from 'node:os';
|
|
23
23
|
import { join } from 'node:path';
|
|
24
24
|
import { userHome } from './home.js';
|
|
25
|
-
import { patchJsonFile } from './index.js';
|
|
25
|
+
import { detectInServerMap, patchJsonFile, removeFromServerMap, } from './index.js';
|
|
26
26
|
const EXTENSION_ID = 'rooveterinaryinc.roo-cline';
|
|
27
27
|
const SETTINGS_FILENAME = 'mcp_settings.json';
|
|
28
28
|
function vsCodeUserDir() {
|
|
@@ -65,5 +65,7 @@ export const rooCodeClient = {
|
|
|
65
65
|
return { ...current, mcpServers: servers };
|
|
66
66
|
});
|
|
67
67
|
},
|
|
68
|
+
detect: () => detectInServerMap(configPath(), 'mcpServers'),
|
|
69
|
+
remove: () => removeFromServerMap(configPath(), 'mcpServers'),
|
|
68
70
|
};
|
|
69
71
|
//# sourceMappingURL=roo-code.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"roo-code.js","sourceRoot":"","sources":["../../src/clients/roo-code.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,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"AAAA;;;;;;;;GAQG;AAMH,OAAO,
|
|
1
|
+
{"version":3,"file":"zed.d.ts","sourceRoot":"","sources":["../../src/clients/zed.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,EAIH,KAAK,YAAY,EAEpB,MAAM,YAAY,CAAC;AAMpB,eAAO,MAAM,SAAS,EAAE,YA0BvB,CAAC"}
|
package/dist/clients/zed.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
import { existsSync } from 'node:fs';
|
|
11
11
|
import { join } from 'node:path';
|
|
12
12
|
import { userHome } from './home.js';
|
|
13
|
-
import { patchJsonFile } from './index.js';
|
|
13
|
+
import { detectInServerMap, patchJsonFile, removeFromServerMap, } from './index.js';
|
|
14
14
|
function configPath() {
|
|
15
15
|
return join(userHome(), '.config', 'zed', 'settings.json');
|
|
16
16
|
}
|
|
@@ -37,5 +37,7 @@ export const zedClient = {
|
|
|
37
37
|
return { ...current, context_servers: servers };
|
|
38
38
|
});
|
|
39
39
|
},
|
|
40
|
+
detect: () => detectInServerMap(configPath(), 'context_servers'),
|
|
41
|
+
remove: () => removeFromServerMap(configPath(), 'context_servers'),
|
|
40
42
|
};
|
|
41
43
|
//# sourceMappingURL=zed.js.map
|
package/dist/clients/zed.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zed.js","sourceRoot":"","sources":["../../src/clients/zed.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,
|
|
1
|
+
{"version":3,"file":"zed.js","sourceRoot":"","sources":["../../src/clients/zed.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,E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AE,iBAAiB,CAAC;IAChE,MAAM,EAAE,GAAG,EAAE,CAAC,mBAAmB,CAAC,UAAU,EAAE,EAAE,iBAAiB,CAAC;CACrE,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yootheme_builder_advanced_read` — a READ-ONLY sibling of the
|
|
3
|
+
* `yootheme_builder_advanced` gateway (F200a, 2026-06-12).
|
|
4
|
+
*
|
|
5
|
+
* The Desktop-E2E #2 forensic showed approval-gates firing on EVERY advanced
|
|
6
|
+
* call. Root cause: the single `yootheme_builder_advanced` gateway is annotated
|
|
7
|
+
* `readOnlyHint:false` + `destructiveHint:true` (correctly — it can route into
|
|
8
|
+
* delete / unbind handlers), so spec-compliant MCP hosts gate it
|
|
9
|
+
* conservatively. The read-only L2 subtools (page_get_schema,
|
|
10
|
+
* element_get_binding, inspect_sublayout) inherited that gate even though they
|
|
11
|
+
* mutate nothing — a per-call approval tax on pure inspection.
|
|
12
|
+
*
|
|
13
|
+
* This second gateway WHITELISTS only read-only advanced entries (annotation
|
|
14
|
+
* `readOnlyHint:true`) and is itself annotated `readOnly()`, so hosts can
|
|
15
|
+
* auto-allow it. Writing subtools (unbind, clean-implode) stay reachable ONLY
|
|
16
|
+
* through the existing (gated) `yootheme_builder_advanced` — defense-in-depth:
|
|
17
|
+
* the read gateway physically cannot route to them (they are not in its
|
|
18
|
+
* registry view).
|
|
19
|
+
*
|
|
20
|
+
* Two modes mirror the write gateway:
|
|
21
|
+
* { tool } → discovery (target schema + annotations; no invoke).
|
|
22
|
+
* { tool, arguments } → execution (strict-validated, then handler called).
|
|
23
|
+
*
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/
|
|
26
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
27
|
+
import type { AdvancedToolEntry } from './capturing-server.js';
|
|
28
|
+
/** The pinned name — never rename (host configs + skill docs reference it). */
|
|
29
|
+
export declare const ADVANCED_READ_TOOL_NAME = "yootheme_builder_advanced_read";
|
|
30
|
+
/**
|
|
31
|
+
* Registers `yootheme_builder_advanced_read` on the real McpServer.
|
|
32
|
+
*
|
|
33
|
+
* @param realServer the McpServer that exposes the read gateway tool
|
|
34
|
+
* @param advancedRegistry the captured non-essential tools (from CapturingServer)
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerAdvancedReadTool(realServer: McpServer, advancedRegistry: Map<string, AdvancedToolEntry>): void;
|
|
37
|
+
//# sourceMappingURL=advanced-read-tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-read-tool.d.ts","sourceRoot":"","sources":["../../src/gateway/advanced-read-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAMzE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAM/D,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,mCAAmC,CAAC;AAgExE;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACpC,UAAU,EAAE,SAAS,EACrB,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC,GACjD,IAAI,CAwEN"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `yootheme_builder_advanced_read` — a READ-ONLY sibling of the
|
|
3
|
+
* `yootheme_builder_advanced` gateway (F200a, 2026-06-12).
|
|
4
|
+
*
|
|
5
|
+
* The Desktop-E2E #2 forensic showed approval-gates firing on EVERY advanced
|
|
6
|
+
* call. Root cause: the single `yootheme_builder_advanced` gateway is annotated
|
|
7
|
+
* `readOnlyHint:false` + `destructiveHint:true` (correctly — it can route into
|
|
8
|
+
* delete / unbind handlers), so spec-compliant MCP hosts gate it
|
|
9
|
+
* conservatively. The read-only L2 subtools (page_get_schema,
|
|
10
|
+
* element_get_binding, inspect_sublayout) inherited that gate even though they
|
|
11
|
+
* mutate nothing — a per-call approval tax on pure inspection.
|
|
12
|
+
*
|
|
13
|
+
* This second gateway WHITELISTS only read-only advanced entries (annotation
|
|
14
|
+
* `readOnlyHint:true`) and is itself annotated `readOnly()`, so hosts can
|
|
15
|
+
* auto-allow it. Writing subtools (unbind, clean-implode) stay reachable ONLY
|
|
16
|
+
* through the existing (gated) `yootheme_builder_advanced` — defense-in-depth:
|
|
17
|
+
* the read gateway physically cannot route to them (they are not in its
|
|
18
|
+
* registry view).
|
|
19
|
+
*
|
|
20
|
+
* Two modes mirror the write gateway:
|
|
21
|
+
* { tool } → discovery (target schema + annotations; no invoke).
|
|
22
|
+
* { tool, arguments } → execution (strict-validated, then handler called).
|
|
23
|
+
*
|
|
24
|
+
* @license MIT
|
|
25
|
+
*/
|
|
26
|
+
import { z } from 'zod';
|
|
27
|
+
import { readOnly } from '../tools/tool-builder.js';
|
|
28
|
+
import { isEssential, isDirectTopLevel } from './essentials.js';
|
|
29
|
+
import { discoveryResult } from './advanced-tool/discovery.js';
|
|
30
|
+
import { renderGroupedList } from './advanced-tool/domains.js';
|
|
31
|
+
import { errorResult, executeAdvancedTool } from './advanced-tool/execute.js';
|
|
32
|
+
/** The pinned name — never rename (host configs + skill docs reference it). */
|
|
33
|
+
export const ADVANCED_READ_TOOL_NAME = 'yootheme_builder_advanced_read';
|
|
34
|
+
/**
|
|
35
|
+
* True iff a captured advanced entry advertises `readOnlyHint:true`. The
|
|
36
|
+
* single source of truth for "is this subtool safe to auto-allow" — the same
|
|
37
|
+
* annotation the host reads. No name allowlist to drift: adding a new
|
|
38
|
+
* read-only advanced tool surfaces here automatically.
|
|
39
|
+
*/
|
|
40
|
+
function isReadOnlyEntry(entry) {
|
|
41
|
+
const annotations = entry.config.annotations;
|
|
42
|
+
return annotations?.readOnlyHint === true;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Builds the read-gateway's input schema.
|
|
46
|
+
*
|
|
47
|
+
* F205 (P2): `tool` is a free z.string(), NOT a z.enum — same trap as the write
|
|
48
|
+
* gateway. The MCP SDK validates the inputSchema before the handler runs; an
|
|
49
|
+
* enum rejected first-class names with a raw McpError -32602 so the handler's
|
|
50
|
+
* not_read_only / first_class_tool / unknown steering never ran. A plain string
|
|
51
|
+
* lets every name reach the handler.
|
|
52
|
+
*/
|
|
53
|
+
function readGatewayInputSchema() {
|
|
54
|
+
return {
|
|
55
|
+
tool: z.string().describe('Read-only advanced tool to route to (e.g. "yootheme_builder_page_get_schema"). ' +
|
|
56
|
+
'Must be one of the read-only advanced tools listed in this description. ' +
|
|
57
|
+
'First-class tools (yootheme_builder_health, ...) are called DIRECTLY; ' +
|
|
58
|
+
'writing tools use yootheme_builder_advanced. ' +
|
|
59
|
+
'Omit `arguments` to discover its schema first.'),
|
|
60
|
+
arguments: z.record(z.string(), z.unknown()).optional().describe('Arguments for the target tool. Omit for discovery mode ' +
|
|
61
|
+
"(returns the tool's schema + annotations)."),
|
|
62
|
+
// `input` is a tolerated alias for `arguments` (same back-compat carve
|
|
63
|
+
// the write gateway makes — see register.ts F107).
|
|
64
|
+
input: z.record(z.string(), z.unknown()).optional().describe('Alias for `arguments` (tolerated for back-compat). Prefer `arguments`.'),
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
/** Builds the read-gateway's description, listing only the whitelisted read-only tools. */
|
|
68
|
+
function buildReadDescription(readOnlyNames) {
|
|
69
|
+
const count = readOnlyNames.length;
|
|
70
|
+
return (`Routes to ${String(count)} READ-ONLY advanced YOOtheme Builder tool` +
|
|
71
|
+
`${count === 1 ? '' : 's'}. ` +
|
|
72
|
+
// F214: stop the model habitually routing first-class tools through the
|
|
73
|
+
// gateway (a wasted invalid_arguments cycle each time). State the scope
|
|
74
|
+
// boundary up front, before the grouped-tool list.
|
|
75
|
+
'ONLY for the read-only advanced tools listed below — every tool that ' +
|
|
76
|
+
'appears directly in tools/list is FIRST-CLASS: call it directly, never via this gateway. ' +
|
|
77
|
+
'Itself read-only (no write-approval gate) — prefer it over ' +
|
|
78
|
+
'yootheme_builder_advanced for inspection. Call { tool } for its ' +
|
|
79
|
+
'schema, or { tool, arguments } to run it.' +
|
|
80
|
+
'\n\nAvailable read-only advanced tools by domain:\n' +
|
|
81
|
+
`${renderGroupedList(readOnlyNames)}\n\n` +
|
|
82
|
+
'Writing tools (unbind, clean-implode): use yootheme_builder_advanced. ' +
|
|
83
|
+
'Connectivity: yootheme_builder_health / yootheme_builder_diagnose.');
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Registers `yootheme_builder_advanced_read` on the real McpServer.
|
|
87
|
+
*
|
|
88
|
+
* @param realServer the McpServer that exposes the read gateway tool
|
|
89
|
+
* @param advancedRegistry the captured non-essential tools (from CapturingServer)
|
|
90
|
+
*/
|
|
91
|
+
export function registerAdvancedReadTool(realServer, advancedRegistry) {
|
|
92
|
+
// Build the read-only view of the registry — the gateway literally cannot
|
|
93
|
+
// see (let alone route to) writing tools.
|
|
94
|
+
const readOnlyRegistry = new Map();
|
|
95
|
+
for (const [name, entry] of advancedRegistry) {
|
|
96
|
+
if (isReadOnlyEntry(entry)) {
|
|
97
|
+
readOnlyRegistry.set(name, entry);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const readOnlyNames = [...readOnlyRegistry.keys()].sort();
|
|
101
|
+
realServer.registerTool(ADVANCED_READ_TOOL_NAME, {
|
|
102
|
+
title: 'Advanced Read-Only Gateway',
|
|
103
|
+
description: buildReadDescription(readOnlyNames),
|
|
104
|
+
inputSchema: readGatewayInputSchema(),
|
|
105
|
+
// F200a: read-only annotation so hosts auto-allow. Unlike the write
|
|
106
|
+
// gateway, this one can never reach a mutating handler.
|
|
107
|
+
annotations: readOnly('Advanced Read-Only Gateway'),
|
|
108
|
+
}, async (args, extra) => {
|
|
109
|
+
const entry = readOnlyRegistry.get(args.tool);
|
|
110
|
+
if (!entry) {
|
|
111
|
+
// F205: a WRITE subtool name that exists in the FULL advanced
|
|
112
|
+
// registry but not the read whitelist gets a targeted steer to
|
|
113
|
+
// the write gateway. This branch MUST stay ahead of the
|
|
114
|
+
// first_class_tool check (an advanced write subtool is not a
|
|
115
|
+
// first-class tool).
|
|
116
|
+
if (advancedRegistry.has(args.tool)) {
|
|
117
|
+
return errorResult({
|
|
118
|
+
message: `"${args.tool}" is not a read-only tool — it mutates state and is not ` +
|
|
119
|
+
'reachable through yootheme_builder_advanced_read.',
|
|
120
|
+
code: 'not_read_only',
|
|
121
|
+
suggestion: `Call it through the full gateway instead: ` +
|
|
122
|
+
`yootheme_builder_advanced({ tool: "${args.tool}", arguments: {...} }).`,
|
|
123
|
+
details: { tool: args.tool },
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// F205: a first-class tool (L1 essential or L3 direct
|
|
127
|
+
// top-level) is steered to a direct call rather than treated
|
|
128
|
+
// as a typo.
|
|
129
|
+
if (isEssential(args.tool) || isDirectTopLevel(args.tool)) {
|
|
130
|
+
return errorResult({
|
|
131
|
+
message: `"${args.tool}" is a FIRST-CLASS tool — it appears directly in tools/list.`,
|
|
132
|
+
code: 'first_class_tool',
|
|
133
|
+
suggestion: `Call "${args.tool}" directly instead of routing it through ` +
|
|
134
|
+
'yootheme_builder_advanced_read. This gateway only routes the read-only ' +
|
|
135
|
+
'advanced tools listed in its description.',
|
|
136
|
+
details: { tool: args.tool },
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
return errorResult({
|
|
140
|
+
message: `Unknown read-only advanced tool: "${args.tool}".`,
|
|
141
|
+
code: 'unknown_read_tool',
|
|
142
|
+
suggestion: 'This gateway routes ONLY read-only advanced tools. If you meant a ' +
|
|
143
|
+
'WRITING tool (unbind, clean-implode), use yootheme_builder_advanced ' +
|
|
144
|
+
'instead. Otherwise pick one of the valid read-only tools below.\n\n' +
|
|
145
|
+
`Valid read-only advanced tools by domain:\n${renderGroupedList(readOnlyNames)}`,
|
|
146
|
+
details: { valid_read_tools_by_domain: renderGroupedList(readOnlyNames) },
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
// `arguments` is canonical; `input` is a tolerated alias (F107).
|
|
150
|
+
const callArgs = args.arguments ?? args.input;
|
|
151
|
+
if (callArgs === undefined)
|
|
152
|
+
return discoveryResult(args.tool, entry);
|
|
153
|
+
return executeAdvancedTool(args.tool, entry, callArgs, extra);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
//# sourceMappingURL=advanced-read-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"advanced-read-tool.js","sourceRoot":"","sources":["../../src/gateway/advanced-read-tool.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAIH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAGpD,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAE9E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AAExE;;;;;GAKG;AACH,SAAS,eAAe,CAAC,KAAwB;IAC7C,MAAM,WAAW,GAAI,KAAK,CAAC,MAAuD,CAAC,WAAW,CAAC;IAC/F,OAAO,WAAW,EAAE,YAAY,KAAK,IAAI,CAAC;AAC9C,CAAC;AAED;;;;;;;;GAQG;AACH,SAAS,sBAAsB;IAC3B,OAAO;QACH,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CACrB,iFAAiF;YAC7E,0EAA0E;YAC1E,wEAAwE;YACxE,+CAA+C;YAC/C,gDAAgD,CACvD;QACD,SAAS,EAAE,CAAC,CAAC,M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AI,CAAC,IAAI,EAAE;iBAC/B,CAAC,CAAC;YACP,CAAC;YACD,OAAO,WAAW,CAAC;gBACf,OAAO,EAAE,qCAAqC,IAAI,CAAC,IAAI,IAAI;gBAC3D,IAAI,EAAE,mBAAmB;gBACzB,UAAU,EACN,oEAAoE;oBACpE,sEAAsE;oBACtE,qEAAqE;oBACrE,8CAA8C,iBAAiB,CAAC,aAAa,CAAC,EAAE;gBACpF,OAAO,EAAE,EAAE,0BAA0B,EAAE,iBAAiB,CAAC,aAAa,CAAC,EAAE;aAC5E,CAAC,CAAC;QACP,CAAC;QACD,iEAAiE;QACjE,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,KAAK,CAAC;QAC9C,IAAI,QAAQ,KAAK,SAAS;YAAE,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QACrE,OAAO,mBAAmB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,CAAC,CAAC;IAClE,CAAC,CACJ,CAAC;AACN,CAAC"}
|
|
@@ -23,14 +23,19 @@ import type { AdvancedToolEntry } from '../capturing-server.js';
|
|
|
23
23
|
export declare const DOMAIN_ORDER: readonly ["pages", "elements", "sources", "multi-items", "inspection"];
|
|
24
24
|
/**
|
|
25
25
|
* Prefix→domain routing table. Each domain accepts plural
|
|
26
|
-
* (`pages_list`) + singular (`
|
|
27
|
-
* stems via `stem.startsWith(prefix + '_')` or full-equality.
|
|
28
|
-
* outside the taxonomy falls through to 'misc'.
|
|
26
|
+
* (`pages_list`) + singular (`page_get_schema`, `element_unbind_source`,
|
|
27
|
+
* `source_…`) stems via `stem.startsWith(prefix + '_')` or full-equality.
|
|
28
|
+
* Anything outside the taxonomy falls through to 'misc'.
|
|
29
29
|
*
|
|
30
30
|
* The `multi-items` domain captures the YT-Pro Multi-Items binding
|
|
31
31
|
* pattern tools (inspect / clean-implode). Stems used:
|
|
32
32
|
* - `inspect_multi_items_binding` → starts with `inspect_multi_items`
|
|
33
33
|
* - `clean_implode_directives` → starts with `clean_implode`
|
|
34
|
+
*
|
|
35
|
+
* The `inspection` domain captures layout inspectors that surface a
|
|
36
|
+
* YT-Pro footgun the raw layout tree hides. Stems used:
|
|
37
|
+
* - `inspect_sublayout` (F154) → full-equality `inspect_sublayout`
|
|
38
|
+
* (the YT5 `< SUBLAYOUT` fragment-subtree + inner-grid-gate inspector).
|
|
34
39
|
*/
|
|
35
40
|
export declare const DOMAIN_PREFIX_MAP: Record<(typeof DOMAIN_ORDER)[number], readonly string[]>;
|
|
36
41
|
export declare const TOOL_PREFIX = "yootheme_builder_";
|
|
@@ -40,6 +45,16 @@ export declare function domainOf(toolName: string): string;
|
|
|
40
45
|
export declare function groupByDomain(toolNames: string[]): Map<string, string[]>;
|
|
41
46
|
/** Renders the grouped tool list as readable text (used in description + errors). */
|
|
42
47
|
export declare function renderGroupedList(toolNames: string[]): string;
|
|
48
|
+
/**
|
|
49
|
+
* F176 (2026-06-12): the former "★ Bind a source" callout was removed. The
|
|
50
|
+
* bind tool (`yootheme_builder_element_bind_source`) plus `page_save` /
|
|
51
|
+
* `page_publish` were promoted to L1 by F116 and live in `tools/list` as
|
|
52
|
+
* first-class entries; the DISJOINT-LANE invariant guarantees they are NEVER
|
|
53
|
+
* in the advanced registry, so the gateway description must not advertise a
|
|
54
|
+
* gateway wrap for them (it would steer agents into an `unknown_tool` dead
|
|
55
|
+
* end on a current build). The binding workflow is now discoverable directly
|
|
56
|
+
* in `tools/list`.
|
|
57
|
+
*/
|
|
43
58
|
/** Builds the gateway tool's description, grouping every advanced tool by domain. */
|
|
44
59
|
export declare function buildDescription(toolNames: string[]): string;
|
|
45
60
|
/** Re-export the AdvancedToolEntry type so consumers don't need a second import path. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/gateway/advanced-tool/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,wEAAyE,CAAC;AAEnG
|
|
1
|
+
{"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../../src/gateway/advanced-tool/domains.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAEhE;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,wEAAyE,CAAC;AAEnG;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAMtF,CAAC;AAEF,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAE/C,8FAA8F;AAC9F,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQjD;AAED,uEAAuE;AACvE,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAYxE;AAED,qFAAqF;AACrF,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAO7D;AAED;;;;;;;;;GASG;AAEH,qFAAqF;AACrF,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,CAmB5D;AAED,yFAAyF;AACzF,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|