@wootsup/yt-builder-mcp 1.1.6 → 1.2.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 +7 -7
- package/bin/yt-builder-mcp.js +55 -40
- package/dist/auth.d.ts +137 -0
- package/dist/auth.d.ts.map +1 -0
- package/dist/auth.js +244 -0
- package/dist/auth.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 +112 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +190 -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 +55 -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 +58 -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 +82 -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 +292 -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 +121 -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 +40 -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 +46 -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 +156 -0
- package/dist/clients/index.d.ts.map +1 -0
- package/dist/clients/index.js +213 -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 +71 -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 +43 -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 +100 -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 +47 -0
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -0
- package/dist/gateway/advanced-tool/domains.js +94 -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 +69 -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 +50 -0
- package/dist/gateway/essentials.d.ts.map +1 -0
- package/dist/gateway/essentials.js +108 -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 +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +119 -0
- package/dist/index.js.map +1 -0
- package/dist/install-skill.d.ts +43 -0
- package/dist/install-skill.d.ts.map +1 -0
- package/dist/install-skill.js +118 -0
- package/dist/install-skill.js.map +1 -0
- package/dist/platform/detect.d.ts +64 -0
- package/dist/platform/detect.d.ts.map +1 -0
- package/dist/platform/detect.js +98 -0
- package/dist/platform/detect.js.map +1 -0
- package/dist/platform/index.d.ts +121 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +176 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/platform/joomla.d.ts +44 -0
- package/dist/platform/joomla.d.ts.map +1 -0
- package/dist/platform/joomla.js +46 -0
- package/dist/platform/joomla.js.map +1 -0
- package/dist/server.d.ts +110 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +274 -0
- package/dist/server.js.map +1 -0
- package/dist/setup-cli-confirm.d.ts +36 -0
- package/dist/setup-cli-confirm.d.ts.map +1 -0
- package/dist/setup-cli-confirm.js +59 -0
- package/dist/setup-cli-confirm.js.map +1 -0
- package/dist/setup-cli.d.ts +193 -0
- package/dist/setup-cli.d.ts.map +1 -0
- package/dist/setup-cli.js +1032 -0
- package/dist/setup-cli.js.map +1 -0
- package/dist/setup-prompts.d.ts +64 -0
- package/dist/setup-prompts.d.ts.map +1 -0
- package/dist/setup-prompts.js +221 -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 +164 -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 +199 -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/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/cli/add-site.d.ts +106 -0
- package/dist/sites/cli/add-site.d.ts.map +1 -0
- package/dist/sites/cli/add-site.js +185 -0
- package/dist/sites/cli/add-site.js.map +1 -0
- package/dist/sites/cli/list-sites.d.ts +40 -0
- package/dist/sites/cli/list-sites.d.ts.map +1 -0
- package/dist/sites/cli/list-sites.js +116 -0
- package/dist/sites/cli/list-sites.js.map +1 -0
- package/dist/sites/cli/remove-site.d.ts +60 -0
- package/dist/sites/cli/remove-site.d.ts.map +1 -0
- package/dist/sites/cli/remove-site.js +120 -0
- package/dist/sites/cli/remove-site.js.map +1 -0
- package/dist/sites/cli/set-default.d.ts +47 -0
- package/dist/sites/cli/set-default.d.ts.map +1 -0
- package/dist/sites/cli/set-default.js +69 -0
- package/dist/sites/cli/set-default.js.map +1 -0
- package/dist/sites/cli/test-site.d.ts +77 -0
- package/dist/sites/cli/test-site.d.ts.map +1 -0
- package/dist/sites/cli/test-site.js +146 -0
- package/dist/sites/cli/test-site.js.map +1 -0
- package/dist/sites/client-pool.d.ts +157 -0
- package/dist/sites/client-pool.d.ts.map +1 -0
- package/dist/sites/client-pool.js +222 -0
- package/dist/sites/client-pool.js.map +1 -0
- package/dist/sites/env-bridge.d.ts +55 -0
- package/dist/sites/env-bridge.d.ts.map +1 -0
- package/dist/sites/env-bridge.js +94 -0
- package/dist/sites/env-bridge.js.map +1 -0
- package/dist/sites/paths.d.ts +21 -0
- package/dist/sites/paths.d.ts.map +1 -0
- package/dist/sites/paths.js +37 -0
- package/dist/sites/paths.js.map +1 -0
- package/dist/sites/probe.d.ts +60 -0
- package/dist/sites/probe.d.ts.map +1 -0
- package/dist/sites/probe.js +112 -0
- package/dist/sites/probe.js.map +1 -0
- package/dist/sites/registry.d.ts +142 -0
- package/dist/sites/registry.d.ts.map +1 -0
- package/dist/sites/registry.js +163 -0
- package/dist/sites/registry.js.map +1 -0
- package/dist/sites/schema.d.ts +90 -0
- package/dist/sites/schema.d.ts.map +1 -0
- package/dist/sites/schema.js +71 -0
- package/dist/sites/schema.js.map +1 -0
- package/dist/sites/secret-resolver.d.ts +115 -0
- package/dist/sites/secret-resolver.d.ts.map +1 -0
- package/dist/sites/secret-resolver.js +225 -0
- package/dist/sites/secret-resolver.js.map +1 -0
- package/dist/sites/store.d.ts +82 -0
- package/dist/sites/store.d.ts.map +1 -0
- package/dist/sites/store.js +198 -0
- package/dist/sites/store.js.map +1 -0
- package/dist/sites/tools/index.d.ts +28 -0
- package/dist/sites/tools/index.d.ts.map +1 -0
- package/dist/sites/tools/index.js +38 -0
- package/dist/sites/tools/index.js.map +1 -0
- package/dist/sites/tools/sites-list.d.ts +48 -0
- package/dist/sites/tools/sites-list.d.ts.map +1 -0
- package/dist/sites/tools/sites-list.js +137 -0
- package/dist/sites/tools/sites-list.js.map +1 -0
- package/dist/sites/tools/sites-test.d.ts +47 -0
- package/dist/sites/tools/sites-test.d.ts.map +1 -0
- package/dist/sites/tools/sites-test.js +148 -0
- package/dist/sites/tools/sites-test.js.map +1 -0
- 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 +183 -0
- package/dist/sites/tools/use-site.js.map +1 -0
- package/dist/skill-loader.d.ts +111 -0
- package/dist/skill-loader.d.ts.map +1 -0
- package/dist/skill-loader.js +191 -0
- package/dist/skill-loader.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 +208 -0
- package/dist/tools/elements/builders.js.map +1 -0
- package/dist/tools/elements/handlers-write.d.ts +49 -0
- package/dist/tools/elements/handlers-write.d.ts.map +1 -0
- package/dist/tools/elements/handlers-write.js +341 -0
- package/dist/tools/elements/handlers-write.js.map +1 -0
- package/dist/tools/elements/handlers.d.ts +70 -0
- package/dist/tools/elements/handlers.d.ts.map +1 -0
- package/dist/tools/elements/handlers.js +292 -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 +40 -0
- package/dist/tools/format/elements-format.d.ts.map +1 -0
- package/dist/tools/format/elements-format.js +193 -0
- package/dist/tools/format/elements-format.js.map +1 -0
- package/dist/tools/format/health-format.d.ts +79 -0
- package/dist/tools/format/health-format.d.ts.map +1 -0
- package/dist/tools/format/health-format.js +181 -0
- package/dist/tools/format/health-format.js.map +1 -0
- package/dist/tools/format/inspection-format.d.ts +70 -0
- package/dist/tools/format/inspection-format.d.ts.map +1 -0
- package/dist/tools/format/inspection-format.js +359 -0
- package/dist/tools/format/inspection-format.js.map +1 -0
- package/dist/tools/format/pages-format.d.ts +57 -0
- package/dist/tools/format/pages-format.d.ts.map +1 -0
- package/dist/tools/format/pages-format.js +157 -0
- package/dist/tools/format/pages-format.js.map +1 -0
- package/dist/tools/format/sources-format.d.ts +44 -0
- package/dist/tools/format/sources-format.d.ts.map +1 -0
- package/dist/tools/format/sources-format.js +242 -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 +220 -0
- package/dist/tools/health.js.map +1 -0
- package/dist/tools/index.d.ts +30 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +39 -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 +401 -0
- package/dist/tools/inspection.js.map +1 -0
- package/dist/tools/layout-flatten.d.ts +75 -0
- package/dist/tools/layout-flatten.d.ts.map +1 -0
- package/dist/tools/layout-flatten.js +107 -0
- package/dist/tools/layout-flatten.js.map +1 -0
- package/dist/tools/multi-items/builders.d.ts +23 -0
- package/dist/tools/multi-items/builders.d.ts.map +1 -0
- package/dist/tools/multi-items/builders.js +84 -0
- package/dist/tools/multi-items/builders.js.map +1 -0
- package/dist/tools/multi-items/clean-implode-handler.d.ts +36 -0
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +1 -0
- package/dist/tools/multi-items/clean-implode-handler.js +57 -0
- package/dist/tools/multi-items/clean-implode-handler.js.map +1 -0
- 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/index.d.ts +18 -0
- package/dist/tools/multi-items/index.d.ts.map +1 -0
- package/dist/tools/multi-items/index.js +18 -0
- package/dist/tools/multi-items/index.js.map +1 -0
- package/dist/tools/multi-items/inspect-handler.d.ts +76 -0
- package/dist/tools/multi-items/inspect-handler.d.ts.map +1 -0
- package/dist/tools/multi-items/inspect-handler.js +133 -0
- package/dist/tools/multi-items/inspect-handler.js.map +1 -0
- 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/multi-items/item-container-map.d.ts +41 -0
- package/dist/tools/multi-items/item-container-map.d.ts.map +1 -0
- package/dist/tools/multi-items/item-container-map.js +73 -0
- package/dist/tools/multi-items/item-container-map.js.map +1 -0
- package/dist/tools/pages/builders.d.ts +43 -0
- package/dist/tools/pages/builders.d.ts.map +1 -0
- package/dist/tools/pages/builders.js +229 -0
- package/dist/tools/pages/builders.js.map +1 -0
- package/dist/tools/pages/handlers-read.d.ts +33 -0
- package/dist/tools/pages/handlers-read.d.ts.map +1 -0
- package/dist/tools/pages/handlers-read.js +260 -0
- package/dist/tools/pages/handlers-read.js.map +1 -0
- package/dist/tools/pages/handlers-write.d.ts +63 -0
- package/dist/tools/pages/handlers-write.d.ts.map +1 -0
- package/dist/tools/pages/handlers-write.js +127 -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 +157 -0
- package/dist/tools/pages/schemas.d.ts.map +1 -0
- package/dist/tools/pages/schemas.js +232 -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/pool-resolve-helper.d.ts +83 -0
- package/dist/tools/pool-resolve-helper.d.ts.map +1 -0
- package/dist/tools/pool-resolve-helper.js +148 -0
- package/dist/tools/pool-resolve-helper.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 +25 -0
- package/dist/tools/shared-schemas.d.ts.map +1 -0
- package/dist/tools/shared-schemas.js +72 -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 +118 -0
- package/dist/tools/sources/builders.js.map +1 -0
- package/dist/tools/sources/handlers-bind.d.ts +28 -0
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -0
- package/dist/tools/sources/handlers-bind.js +181 -0
- package/dist/tools/sources/handlers-bind.js.map +1 -0
- package/dist/tools/sources/handlers.d.ts +47 -0
- package/dist/tools/sources/handlers.d.ts.map +1 -0
- package/dist/tools/sources/handlers.js +108 -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 +106 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -0
- package/dist/tools/sparse-fields.js +165 -0
- package/dist/tools/sparse-fields.js.map +1 -0
- package/dist/tools/tool-builder/annotations.d.ts +55 -0
- package/dist/tools/tool-builder/annotations.d.ts.map +1 -0
- package/dist/tools/tool-builder/annotations.js +86 -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 +104 -0
- package/dist/tools/tool-builder/results.d.ts.map +1 -0
- package/dist/tools/tool-builder/results.js +224 -0
- package/dist/tools/tool-builder/results.js.map +1 -0
- package/dist/tools/tool-builder/types.d.ts +97 -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/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 +4 -1
- package/skills/yt-builder-mcp/SKILL.md +30 -26
package/README.md
CHANGED
|
@@ -63,18 +63,18 @@ The wizard auto-detects and configures the following clients:
|
|
|
63
63
|
|
|
64
64
|
## Tool surface (gateway model)
|
|
65
65
|
|
|
66
|
-
The server registers **
|
|
67
|
-
of which **
|
|
66
|
+
The server registers **29 domain tools + 1 gateway = 30 reachable** tools,
|
|
67
|
+
of which **23 are advertised in `tools/list`** (well under Cursor's ~40-tool
|
|
68
68
|
cap):
|
|
69
69
|
|
|
70
70
|
- **2 direct top-level tools** (always in `tools/list`):
|
|
71
71
|
`yootheme_builder_health`, `yootheme_builder_diagnose`. The
|
|
72
72
|
"the gateway itself might be broken" escape hatch.
|
|
73
|
-
- **
|
|
74
|
-
reads and writes (`pages_list`, `
|
|
75
|
-
`
|
|
76
|
-
`inspect_multi_items_binding`, and the multi-site
|
|
77
|
-
among others).
|
|
73
|
+
- **20 essential forwarded tools** (always in `tools/list`): the most-used
|
|
74
|
+
reads and writes (`pages_list`, `pages_create`, `pages_delete`, `get_etag`,
|
|
75
|
+
`element_list`, `element_add`, `element_update_settings`, `sources_list`,
|
|
76
|
+
`element_types_list`, `inspect_multi_items_binding`, and the multi-site
|
|
77
|
+
`sites_list` / `sites_test`, among others).
|
|
78
78
|
- **1 gateway tool** (`yootheme_builder_advanced`): exposes the remaining
|
|
79
79
|
**7 advanced tools** behind a single entry. Call
|
|
80
80
|
`yootheme_builder_advanced({ tool: "<name>" })` for discovery (returns the
|
package/bin/yt-builder-mcp.js
CHANGED
|
@@ -2,43 +2,56 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Entry point for `npx -y @wootsup/yt-builder-mcp`.
|
|
4
4
|
*
|
|
5
|
-
* Dispatch tree
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
5
|
+
* Dispatch tree (the verdict comes from the pure, typed + tested
|
|
6
|
+
* `decideInvocation()` in `dist/cli/invocation-decision.js`):
|
|
7
|
+
* - 'cli' → known subcommand (`setup` / `install-skill` / `install` /
|
|
8
|
+
* `uninstall` / `remove` / `add-site` / `list-sites` /
|
|
9
|
+
* `remove-site` / `set-default` / `test-site` / `help` /
|
|
10
|
+
* `--help` / `-h` / `--version` / `-v`): forward argv to
|
|
11
|
+
* `runCli()` in `dist/setup-cli.js` (Wave G.7).
|
|
12
|
+
* - 'hint' → no OR unknown subcommand AND stdin is an interactive TTY
|
|
13
|
+
* (a human ran the bin directly): print a discoverability
|
|
14
|
+
* hint to stderr and exit 0, instead of silently blocking
|
|
15
|
+
* on the stdio read loop ("hang").
|
|
16
|
+
* - 'server' → no OR unknown subcommand AND stdin is NOT a TTY (a real
|
|
17
|
+
* AI client piping JSON-RPC over stdin): import
|
|
18
|
+
* `dist/index.js`, which starts the MCP stdio server (or,
|
|
19
|
+
* under YTB_MCP_TEST_MODE=1, prints the tool list to stderr
|
|
20
|
+
* and exits 0 — the test-mode branch lives in index.ts).
|
|
13
21
|
*
|
|
14
|
-
* The
|
|
15
|
-
*
|
|
22
|
+
* The guard is keyed on `process.stdin.isTTY`: it is `true` only for an
|
|
23
|
+
* interactive human terminal and `false`/`undefined` for the piped stdin
|
|
24
|
+
* every MCP client uses, so the client path stays byte-for-byte the same.
|
|
25
|
+
* YTB_MCP_TEST_MODE=1 forces the 'server' route so the smoke-test probe
|
|
26
|
+
* always reaches `dist/index.js` even when run from a TTY.
|
|
16
27
|
*
|
|
17
28
|
* @license MIT
|
|
18
29
|
*/
|
|
19
|
-
import { argv,
|
|
30
|
+
import { argv, stdin, stderr, exit } from 'node:process';
|
|
31
|
+
|
|
32
|
+
import {
|
|
33
|
+
decideInvocation,
|
|
34
|
+
isKnownSubcommand,
|
|
35
|
+
BARE_INVOCATION_HINT,
|
|
36
|
+
} from '../dist/cli/invocation-decision.js';
|
|
20
37
|
|
|
21
38
|
const args = argv.slice(2);
|
|
22
39
|
const subcommand = args[0];
|
|
23
40
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
'
|
|
31
|
-
|
|
32
|
-
'
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
'-h',
|
|
37
|
-
'--version',
|
|
38
|
-
'-v',
|
|
39
|
-
]);
|
|
41
|
+
// Decide the route. Known subcommands always go to the cli dispatcher.
|
|
42
|
+
// For the bare/unknown path, the smoke-test probe (YTB_MCP_TEST_MODE=1)
|
|
43
|
+
// must always reach dist/index.js — never the interactive hint — so it
|
|
44
|
+
// forces the 'server' route. Otherwise honour the strict-isTTY decision.
|
|
45
|
+
let action;
|
|
46
|
+
if (isKnownSubcommand(subcommand)) {
|
|
47
|
+
action = 'cli';
|
|
48
|
+
} else if (process.env.YTB_MCP_TEST_MODE === '1') {
|
|
49
|
+
action = 'server';
|
|
50
|
+
} else {
|
|
51
|
+
action = decideInvocation(subcommand, stdin.isTTY);
|
|
52
|
+
}
|
|
40
53
|
|
|
41
|
-
if (
|
|
54
|
+
if (action === 'cli') {
|
|
42
55
|
try {
|
|
43
56
|
const { runCli } = await import('../dist/setup-cli.js');
|
|
44
57
|
const code = await runCli(args);
|
|
@@ -48,18 +61,20 @@ if (subcommand !== undefined && CLI_SUBCOMMANDS.has(subcommand)) {
|
|
|
48
61
|
stderr.write(`yt-builder-mcp: fatal: ${msg}\n`);
|
|
49
62
|
exit(99);
|
|
50
63
|
}
|
|
51
|
-
} else if (
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
process.env.YTB_MCP_TEST_MODE !== '1'
|
|
55
|
-
) {
|
|
56
|
-
stdout.write(
|
|
57
|
-
'Run `npx -y @wootsup/yt-builder-mcp setup` to configure your AI client.\n',
|
|
58
|
-
);
|
|
59
|
-
stdout.write(
|
|
60
|
-
'Run `npx -y @wootsup/yt-builder-mcp help` for usage.\n',
|
|
61
|
-
);
|
|
64
|
+
} else if (action === 'hint') {
|
|
65
|
+
stderr.write(`${BARE_INVOCATION_HINT}\n`);
|
|
66
|
+
exit(0);
|
|
62
67
|
} else {
|
|
63
|
-
//
|
|
68
|
+
// 'server' — stdin is NOT a TTY (an AI client piping JSON-RPC → real
|
|
69
|
+
// MCP stdio server) or YTB_MCP_TEST_MODE=1 forced this route.
|
|
70
|
+
// `dist/index.js` branches on the env var: test-mode prints the tool
|
|
71
|
+
// list to stderr and exits 0; otherwise it starts the stdio server.
|
|
72
|
+
// Importing here does NOT itself force stdio mode.
|
|
73
|
+
if (process.env.YTB_MCP_TEST_MODE === '1') {
|
|
74
|
+
// Deterministic, synchronous marker so the smoke test can confirm
|
|
75
|
+
// the server route was reached without racing index.js's async
|
|
76
|
+
// `main()` stdout/stderr flush. Test-mode only — never a real run.
|
|
77
|
+
stderr.write('[yt-builder-mcp] server-route reached\n');
|
|
78
|
+
}
|
|
64
79
|
await import('../dist/index.js');
|
|
65
80
|
}
|
package/dist/auth.d.ts
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth / configuration loading for the MCP server.
|
|
3
|
+
*
|
|
4
|
+
* The MCP server reads two environment variables on startup:
|
|
5
|
+
*
|
|
6
|
+
* YTB_MCP_SITE_URL — base URL of the host CMS install (WordPress
|
|
7
|
+
* OR Joomla), e.g. `https://example.com`.
|
|
8
|
+
* The per-platform REST namespace
|
|
9
|
+
* (`/wp-json/yt-builder-mcp/v1` for WP,
|
|
10
|
+
* `/api/index.php/v1/yt-builder-mcp` for
|
|
11
|
+
* Joomla) is appended internally based on
|
|
12
|
+
* runtime platform detection.
|
|
13
|
+
* YTB_MCP_WP_URL — DEPRECATED alias for YTB_MCP_SITE_URL,
|
|
14
|
+
* kept for back-compat with pre-Wave 7
|
|
15
|
+
* configurations. A non-fatal deprecation
|
|
16
|
+
* notice is written to stderr when the
|
|
17
|
+
* legacy var is used in non-test mode.
|
|
18
|
+
* YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
|
|
19
|
+
* Settings page (`wp-admin → YT Builder MCP`
|
|
20
|
+
* on WordPress, `Components → YT Builder MCP`
|
|
21
|
+
* on Joomla).
|
|
22
|
+
*
|
|
23
|
+
* `loadConfig()` throws `ConfigError` if either is missing, so the
|
|
24
|
+
* server fails fast with a useful message rather than emitting cryptic
|
|
25
|
+
* 401/Network errors deep in the request stack.
|
|
26
|
+
*
|
|
27
|
+
* @license MIT
|
|
28
|
+
*/
|
|
29
|
+
import { SiteRegistry } from './sites/registry.js';
|
|
30
|
+
export interface ServerConfig {
|
|
31
|
+
/** Base URL of the host-CMS install (no trailing slash). */
|
|
32
|
+
readonly baseUrl: string;
|
|
33
|
+
/** Bearer key. */
|
|
34
|
+
readonly bearerToken: string;
|
|
35
|
+
/** Network timeout (ms) for REST calls. */
|
|
36
|
+
readonly timeoutMs: number;
|
|
37
|
+
/**
|
|
38
|
+
* Optional explicit platform hint from {@link ENV_PLATFORM}.
|
|
39
|
+
* `undefined` lets the consumer rely on URL-shape detection.
|
|
40
|
+
*/
|
|
41
|
+
readonly platformHint?: 'wordpress' | 'joomla';
|
|
42
|
+
}
|
|
43
|
+
export interface LoadConfigOptions {
|
|
44
|
+
/** Allow the bearer-token to be empty (for health-only smoke tests). */
|
|
45
|
+
readonly allowMissingToken?: boolean;
|
|
46
|
+
/** Source of env vars (defaults to process.env). */
|
|
47
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Canonical env-var name for the host-CMS base URL (Wave 7+: covers
|
|
51
|
+
* both WordPress and Joomla). Prefer this for all new configurations.
|
|
52
|
+
*/
|
|
53
|
+
export declare const ENV_SITE_URL = "YTB_MCP_SITE_URL";
|
|
54
|
+
/**
|
|
55
|
+
* Legacy env-var name kept for back-compat. Pre-Wave-7 configurations
|
|
56
|
+
* (every release through v1.0.x) used `YTB_MCP_WP_URL`. New code should
|
|
57
|
+
* use {@link ENV_SITE_URL}; this constant is retained so the wizard,
|
|
58
|
+
* tests, and error hints can still reference the legacy name.
|
|
59
|
+
*/
|
|
60
|
+
export declare const ENV_WP_URL = "YTB_MCP_WP_URL";
|
|
61
|
+
export declare const ENV_BEARER = "YTB_MCP_BEARER_TOKEN";
|
|
62
|
+
export declare const ENV_TIMEOUT = "YTB_MCP_TIMEOUT_MS";
|
|
63
|
+
export declare const ENV_TEST_MODE = "YTB_MCP_TEST_MODE";
|
|
64
|
+
/**
|
|
65
|
+
* Optional platform hint env var — `'wordpress'` or `'joomla'`. When
|
|
66
|
+
* unset, the server auto-detects from the URL shape (cookbook §3.7.1):
|
|
67
|
+
* - URL contains `/wp-json/` → wordpress
|
|
68
|
+
* - URL contains `/api/index.php/` → joomla
|
|
69
|
+
* - origin-only URL → defaults to wordpress (back-compat)
|
|
70
|
+
*
|
|
71
|
+
* Set this to `'joomla'` when your YTB_MCP_SITE_URL is an origin-only
|
|
72
|
+
* Joomla URL like `https://example.com/joomla`.
|
|
73
|
+
*/
|
|
74
|
+
export declare const ENV_PLATFORM = "YTB_MCP_PLATFORM";
|
|
75
|
+
/**
|
|
76
|
+
* W10 — canonical env-var name for the multi-site registry file. When
|
|
77
|
+
* set, {@link loadRegistry} loads + validates the JSON at this path and
|
|
78
|
+
* the legacy {@link ENV_SITE_URL} / {@link ENV_BEARER} pair is ignored.
|
|
79
|
+
* When unset, the env-bridge falls back to building a one-site registry
|
|
80
|
+
* from the legacy single-site pair.
|
|
81
|
+
*/
|
|
82
|
+
export declare const ENV_SITES_FILE = "YTB_MCP_SITES_FILE";
|
|
83
|
+
/**
|
|
84
|
+
* Optional boot-time active-site selector. Names a registry `site_id`
|
|
85
|
+
* that becomes the active (default-target) site the moment the server
|
|
86
|
+
* boots — the YT Builder analogue of api-mapper's `APIMAPPER_PROFILE`.
|
|
87
|
+
*
|
|
88
|
+
* Resolution (see {@link bootstrapActiveSite} in `sites/bootstrap.ts`):
|
|
89
|
+
* - unset / whitespace / `"default"` → no override; the registry's
|
|
90
|
+
* own default site applies.
|
|
91
|
+
* - `"<known site_id>"` → that site becomes active.
|
|
92
|
+
* - `"<unknown site_id>"` → silently ignored (no phantom
|
|
93
|
+
* switch on a fresh host that inherited the var from elsewhere).
|
|
94
|
+
*
|
|
95
|
+
* The runtime `yootheme_builder_use_site` tool switches it later within
|
|
96
|
+
* a session; this env var only seeds the INITIAL active site so a
|
|
97
|
+
* multi-client config (one MCP entry per client site, each with its own
|
|
98
|
+
* `YTB_MCP_PROFILE`) lands on the right site without a first tool call.
|
|
99
|
+
*/
|
|
100
|
+
export declare const ENV_PROFILE = "YTB_MCP_PROFILE";
|
|
101
|
+
export declare function loadConfig(options?: LoadConfigOptions): ServerConfig;
|
|
102
|
+
export declare function isTestMode(env?: NodeJS.ProcessEnv): boolean;
|
|
103
|
+
/**
|
|
104
|
+
* Options accepted by {@link loadRegistry}.
|
|
105
|
+
*/
|
|
106
|
+
export interface LoadRegistryOptions {
|
|
107
|
+
/** Source of env vars (defaults to process.env). */
|
|
108
|
+
readonly env?: NodeJS.ProcessEnv;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* W10 — canonical boot-time registry loader.
|
|
112
|
+
*
|
|
113
|
+
* Resolution order:
|
|
114
|
+
* 1. **Sites file** — if {@link ENV_SITES_FILE} is set to a non-empty
|
|
115
|
+
* string, parse + validate the JSON at that path and wrap it in a
|
|
116
|
+
* {@link SiteRegistry}. Schema failures bubble up as
|
|
117
|
+
* `SitesFileError` (the store does not swallow them); the caller
|
|
118
|
+
* decides whether to fail-fast or fall back. Wave 10 chooses
|
|
119
|
+
* fail-fast — explicit file = explicit intent.
|
|
120
|
+
*
|
|
121
|
+
* 2. **Legacy env-bridge** — synthesise a one-site registry from the
|
|
122
|
+
* pre-W10 single-site env-vars ({@link ENV_SITE_URL} +
|
|
123
|
+
* {@link ENV_BEARER}, with {@link ENV_PLATFORM} as optional hint).
|
|
124
|
+
* Preserves the single-site UX for every customer who has not
|
|
125
|
+
* migrated to a sites.json yet.
|
|
126
|
+
*
|
|
127
|
+
* 3. **Hard fail** — neither configured. Surface a {@link ConfigError}
|
|
128
|
+
* with the three setup options so the operator knows exactly which
|
|
129
|
+
* knob to turn.
|
|
130
|
+
*
|
|
131
|
+
* This function replaces {@link loadConfig} on the main boot path.
|
|
132
|
+
* `loadConfig` is intentionally retained for the test-mode fallback in
|
|
133
|
+
* `index.ts` (`--test-mode` smoke probes) and for any embedded consumer
|
|
134
|
+
* that still wants a flat `ServerConfig`.
|
|
135
|
+
*/
|
|
136
|
+
export declare function loadRegistry(opts?: LoadRegistryOptions): Promise<SiteRegistry>;
|
|
137
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAInD,MAAM,WAAW,YAAY;IACzB,4DAA4D;IAC5D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,kBAAkB;IAClB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,2CAA2C;IAC3C,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B;;;OAGG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,WAAW,GAAG,QAAQ,CAAC;CAClD;AAED,MAAM,WAAW,iBAAiB;IAC9B,wEAAwE;IACxE,QAAQ,CAAC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IACrC,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACpC;AAED;;;GAGG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C;;;;;GAKG;AACH,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAyB,CAAC;AACjD,eAAO,MAAM,WAAW,uBAAuB,CAAC;AAChD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD;;;;;;;;;GASG;AACH,eAAO,MAAM,YAAY,qBAAqB,CAAC;AAC/C;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,uBAAuB,CAAC;AACnD;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,WAAW,oBAAoB,CAAC;AAkC7C,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,YAAY,CA8ExE;AAED,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExE;AAMD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,oDAAoD;IACpD,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACpC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAsB,YAAY,CAC9B,IAAI,GAAE,mBAAwB,GAC/B,OAAO,CAAC,YAAY,CAAC,CA8CvB"}
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Auth / configuration loading for the MCP server.
|
|
3
|
+
*
|
|
4
|
+
* The MCP server reads two environment variables on startup:
|
|
5
|
+
*
|
|
6
|
+
* YTB_MCP_SITE_URL — base URL of the host CMS install (WordPress
|
|
7
|
+
* OR Joomla), e.g. `https://example.com`.
|
|
8
|
+
* The per-platform REST namespace
|
|
9
|
+
* (`/wp-json/yt-builder-mcp/v1` for WP,
|
|
10
|
+
* `/api/index.php/v1/yt-builder-mcp` for
|
|
11
|
+
* Joomla) is appended internally based on
|
|
12
|
+
* runtime platform detection.
|
|
13
|
+
* YTB_MCP_WP_URL — DEPRECATED alias for YTB_MCP_SITE_URL,
|
|
14
|
+
* kept for back-compat with pre-Wave 7
|
|
15
|
+
* configurations. A non-fatal deprecation
|
|
16
|
+
* notice is written to stderr when the
|
|
17
|
+
* legacy var is used in non-test mode.
|
|
18
|
+
* YTB_MCP_BEARER_TOKEN — the Bearer key generated by the plugin
|
|
19
|
+
* Settings page (`wp-admin → YT Builder MCP`
|
|
20
|
+
* on WordPress, `Components → YT Builder MCP`
|
|
21
|
+
* on Joomla).
|
|
22
|
+
*
|
|
23
|
+
* `loadConfig()` throws `ConfigError` if either is missing, so the
|
|
24
|
+
* server fails fast with a useful message rather than emitting cryptic
|
|
25
|
+
* 401/Network errors deep in the request stack.
|
|
26
|
+
*
|
|
27
|
+
* @license MIT
|
|
28
|
+
*/
|
|
29
|
+
import { z } from 'zod';
|
|
30
|
+
import { ConfigError } from './errors.js';
|
|
31
|
+
import { synthesiseFromEnv } from './sites/env-bridge.js';
|
|
32
|
+
import { SiteRegistry } from './sites/registry.js';
|
|
33
|
+
import { SitesFile } from './sites/schema.js';
|
|
34
|
+
import { loadSitesFile } from './sites/store.js';
|
|
35
|
+
/**
|
|
36
|
+
* Canonical env-var name for the host-CMS base URL (Wave 7+: covers
|
|
37
|
+
* both WordPress and Joomla). Prefer this for all new configurations.
|
|
38
|
+
*/
|
|
39
|
+
export const ENV_SITE_URL = 'YTB_MCP_SITE_URL';
|
|
40
|
+
/**
|
|
41
|
+
* Legacy env-var name kept for back-compat. Pre-Wave-7 configurations
|
|
42
|
+
* (every release through v1.0.x) used `YTB_MCP_WP_URL`. New code should
|
|
43
|
+
* use {@link ENV_SITE_URL}; this constant is retained so the wizard,
|
|
44
|
+
* tests, and error hints can still reference the legacy name.
|
|
45
|
+
*/
|
|
46
|
+
export const ENV_WP_URL = 'YTB_MCP_WP_URL';
|
|
47
|
+
export const ENV_BEARER = 'YTB_MCP_BEARER_TOKEN';
|
|
48
|
+
export const ENV_TIMEOUT = 'YTB_MCP_TIMEOUT_MS';
|
|
49
|
+
export const ENV_TEST_MODE = 'YTB_MCP_TEST_MODE';
|
|
50
|
+
/**
|
|
51
|
+
* Optional platform hint env var — `'wordpress'` or `'joomla'`. When
|
|
52
|
+
* unset, the server auto-detects from the URL shape (cookbook §3.7.1):
|
|
53
|
+
* - URL contains `/wp-json/` → wordpress
|
|
54
|
+
* - URL contains `/api/index.php/` → joomla
|
|
55
|
+
* - origin-only URL → defaults to wordpress (back-compat)
|
|
56
|
+
*
|
|
57
|
+
* Set this to `'joomla'` when your YTB_MCP_SITE_URL is an origin-only
|
|
58
|
+
* Joomla URL like `https://example.com/joomla`.
|
|
59
|
+
*/
|
|
60
|
+
export const ENV_PLATFORM = 'YTB_MCP_PLATFORM';
|
|
61
|
+
/**
|
|
62
|
+
* W10 — canonical env-var name for the multi-site registry file. When
|
|
63
|
+
* set, {@link loadRegistry} loads + validates the JSON at this path and
|
|
64
|
+
* the legacy {@link ENV_SITE_URL} / {@link ENV_BEARER} pair is ignored.
|
|
65
|
+
* When unset, the env-bridge falls back to building a one-site registry
|
|
66
|
+
* from the legacy single-site pair.
|
|
67
|
+
*/
|
|
68
|
+
export const ENV_SITES_FILE = 'YTB_MCP_SITES_FILE';
|
|
69
|
+
/**
|
|
70
|
+
* Optional boot-time active-site selector. Names a registry `site_id`
|
|
71
|
+
* that becomes the active (default-target) site the moment the server
|
|
72
|
+
* boots — the YT Builder analogue of api-mapper's `APIMAPPER_PROFILE`.
|
|
73
|
+
*
|
|
74
|
+
* Resolution (see {@link bootstrapActiveSite} in `sites/bootstrap.ts`):
|
|
75
|
+
* - unset / whitespace / `"default"` → no override; the registry's
|
|
76
|
+
* own default site applies.
|
|
77
|
+
* - `"<known site_id>"` → that site becomes active.
|
|
78
|
+
* - `"<unknown site_id>"` → silently ignored (no phantom
|
|
79
|
+
* switch on a fresh host that inherited the var from elsewhere).
|
|
80
|
+
*
|
|
81
|
+
* The runtime `yootheme_builder_use_site` tool switches it later within
|
|
82
|
+
* a session; this env var only seeds the INITIAL active site so a
|
|
83
|
+
* multi-client config (one MCP entry per client site, each with its own
|
|
84
|
+
* `YTB_MCP_PROFILE`) lands on the right site without a first tool call.
|
|
85
|
+
*/
|
|
86
|
+
export const ENV_PROFILE = 'YTB_MCP_PROFILE';
|
|
87
|
+
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
88
|
+
/**
|
|
89
|
+
* Maximum accepted length for a Bearer token (defense-in-depth bound;
|
|
90
|
+
* the real plugin keys are ~150-300 bytes, the 512 ceiling protects
|
|
91
|
+
* against accidental file-pastes / log dumps / memory abuse).
|
|
92
|
+
*/
|
|
93
|
+
const BEARER_MAX_LEN = 512;
|
|
94
|
+
/**
|
|
95
|
+
* Bearer-token format check — matches the plugin's `KeyService.php`
|
|
96
|
+
* `PREFIX = ytb_live_` (and the planned `ytb_test_` future variant).
|
|
97
|
+
* Token shape: `ytb_(live|test)_<payloadB64Url>.<sigB64Url>` where
|
|
98
|
+
* base64url uses `[A-Za-z0-9_-]` (no dots inside the payload or sig).
|
|
99
|
+
*
|
|
100
|
+
* Round-1 audit I7 fix (2026-05-22): the earlier `.trim()` + empty-check
|
|
101
|
+
* was not enough to catch the most common config mistakes — the leading
|
|
102
|
+
* `Bearer ` prefix accidentally pasted into the env var, copy-paste
|
|
103
|
+
* truncation (no `.` separator), or a totally wrong token style. We
|
|
104
|
+
* fail-fast here so the client never sends a known-bad value upstream.
|
|
105
|
+
*/
|
|
106
|
+
const BEARER_FORMAT_SCHEMA = z
|
|
107
|
+
.string()
|
|
108
|
+
.max(BEARER_MAX_LEN, `Bearer too long (max ${String(BEARER_MAX_LEN)} chars). The env var YTB_MCP_BEARER_TOKEN seems to contain something other than a plain key — strip leading "Bearer " or paste only the key copied from wp-admin → "YT Builder MCP" → Settings.`)
|
|
109
|
+
.regex(/^ytb_(live|test)_[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/, 'Bearer must match ytb_(live|test)_<payloadB64Url>.<sigB64Url> format (copy the key as shown in wp-admin → "YT Builder MCP" → Settings; do NOT prepend "Bearer ").');
|
|
110
|
+
export function loadConfig(options = {}) {
|
|
111
|
+
const env = options.env ?? process.env;
|
|
112
|
+
// Wave 7: YTB_MCP_SITE_URL is canonical (covers both WP + Joomla);
|
|
113
|
+
// YTB_MCP_WP_URL is retained as a deprecated back-compat alias.
|
|
114
|
+
// Resolution order: SITE_URL wins; legacy WP_URL fallback emits a
|
|
115
|
+
// soft deprecation note in non-test mode.
|
|
116
|
+
const rawSiteUrl = (env[ENV_SITE_URL] ?? '').trim();
|
|
117
|
+
const rawLegacyUrl = (env[ENV_WP_URL] ?? '').trim();
|
|
118
|
+
const rawUrl = rawSiteUrl !== '' ? rawSiteUrl : rawLegacyUrl;
|
|
119
|
+
// Soft deprecation notice — only when the loader is being used in
|
|
120
|
+
// its real-server role (env defaulted to process.env). Programmatic
|
|
121
|
+
// callers (tests, embedded uses) pass `options.env` explicitly and
|
|
122
|
+
// are silently treated as opt-in to the legacy var.
|
|
123
|
+
if (rawSiteUrl === ''
|
|
124
|
+
&& rawLegacyUrl !== ''
|
|
125
|
+
&& options.env === undefined
|
|
126
|
+
&& !isTestMode(env)) {
|
|
127
|
+
process.stderr.write(`[yt-builder-mcp] notice: ${ENV_WP_URL} is deprecated — ` +
|
|
128
|
+
`set ${ENV_SITE_URL} instead (same value; covers WordPress + Joomla).\n`);
|
|
129
|
+
}
|
|
130
|
+
const rawToken = (env[ENV_BEARER] ?? '').trim();
|
|
131
|
+
const rawTimeout = (env[ENV_TIMEOUT] ?? '').trim();
|
|
132
|
+
if (rawUrl === '') {
|
|
133
|
+
throw new ConfigError(`Missing ${ENV_SITE_URL}. Set it to your CMS base URL ` +
|
|
134
|
+
'(e.g. https://example.com — WordPress or Joomla). ' +
|
|
135
|
+
'Run `yt-builder-mcp setup` to configure.');
|
|
136
|
+
}
|
|
137
|
+
if (!options.allowMissingToken && rawToken === '') {
|
|
138
|
+
throw new ConfigError(`Missing ${ENV_BEARER}. Generate a Bearer key in wp-admin → "YT Builder MCP" → ` +
|
|
139
|
+
'Settings, then run `yt-builder-mcp setup`.');
|
|
140
|
+
}
|
|
141
|
+
// I7-fix: enforce the Bearer-format contract before the client
|
|
142
|
+
// makes any request. Empty token is allowed only via
|
|
143
|
+
// `allowMissingToken` (the health-only smoke path); any other
|
|
144
|
+
// non-empty value MUST match the plugin's KeyService format.
|
|
145
|
+
if (rawToken !== '') {
|
|
146
|
+
const parsed = BEARER_FORMAT_SCHEMA.safeParse(rawToken);
|
|
147
|
+
if (!parsed.success) {
|
|
148
|
+
const issueMsg = parsed.error.issues
|
|
149
|
+
.map((iss) => iss.message)
|
|
150
|
+
.join(' ');
|
|
151
|
+
throw new ConfigError(`Invalid ${ENV_BEARER}: ${issueMsg}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
let timeoutMs = DEFAULT_TIMEOUT_MS;
|
|
155
|
+
if (rawTimeout !== '') {
|
|
156
|
+
const parsed = Number.parseInt(rawTimeout, 10);
|
|
157
|
+
if (Number.isFinite(parsed) && parsed > 0) {
|
|
158
|
+
timeoutMs = parsed;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
const rawPlatform = (env[ENV_PLATFORM] ?? '').trim().toLowerCase();
|
|
162
|
+
const platformHint = rawPlatform === 'wordpress' || rawPlatform === 'joomla'
|
|
163
|
+
? rawPlatform
|
|
164
|
+
: undefined;
|
|
165
|
+
return {
|
|
166
|
+
baseUrl: stripTrailingSlash(rawUrl),
|
|
167
|
+
bearerToken: rawToken,
|
|
168
|
+
timeoutMs,
|
|
169
|
+
...(platformHint !== undefined ? { platformHint } : {}),
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
export function isTestMode(env = process.env) {
|
|
173
|
+
return (env[ENV_TEST_MODE] ?? '') === '1';
|
|
174
|
+
}
|
|
175
|
+
function stripTrailingSlash(url) {
|
|
176
|
+
return url.replace(/\/+$/, '');
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* W10 — canonical boot-time registry loader.
|
|
180
|
+
*
|
|
181
|
+
* Resolution order:
|
|
182
|
+
* 1. **Sites file** — if {@link ENV_SITES_FILE} is set to a non-empty
|
|
183
|
+
* string, parse + validate the JSON at that path and wrap it in a
|
|
184
|
+
* {@link SiteRegistry}. Schema failures bubble up as
|
|
185
|
+
* `SitesFileError` (the store does not swallow them); the caller
|
|
186
|
+
* decides whether to fail-fast or fall back. Wave 10 chooses
|
|
187
|
+
* fail-fast — explicit file = explicit intent.
|
|
188
|
+
*
|
|
189
|
+
* 2. **Legacy env-bridge** — synthesise a one-site registry from the
|
|
190
|
+
* pre-W10 single-site env-vars ({@link ENV_SITE_URL} +
|
|
191
|
+
* {@link ENV_BEARER}, with {@link ENV_PLATFORM} as optional hint).
|
|
192
|
+
* Preserves the single-site UX for every customer who has not
|
|
193
|
+
* migrated to a sites.json yet.
|
|
194
|
+
*
|
|
195
|
+
* 3. **Hard fail** — neither configured. Surface a {@link ConfigError}
|
|
196
|
+
* with the three setup options so the operator knows exactly which
|
|
197
|
+
* knob to turn.
|
|
198
|
+
*
|
|
199
|
+
* This function replaces {@link loadConfig} on the main boot path.
|
|
200
|
+
* `loadConfig` is intentionally retained for the test-mode fallback in
|
|
201
|
+
* `index.ts` (`--test-mode` smoke probes) and for any embedded consumer
|
|
202
|
+
* that still wants a flat `ServerConfig`.
|
|
203
|
+
*/
|
|
204
|
+
export async function loadRegistry(opts = {}) {
|
|
205
|
+
const env = opts.env ?? process.env;
|
|
206
|
+
// (1) sites file (preferred).
|
|
207
|
+
const sitesFilePath = (env[ENV_SITES_FILE] ?? '').trim();
|
|
208
|
+
if (sitesFilePath !== '') {
|
|
209
|
+
// loadSitesFile handles both "file present" and "file absent"
|
|
210
|
+
// (the latter returns an emptySitesFile). When the file is
|
|
211
|
+
// empty (no sites), fall through to env-bridge instead of
|
|
212
|
+
// booting with an empty registry — operators who set
|
|
213
|
+
// SITES_FILE to a not-yet-populated path should still get the
|
|
214
|
+
// legacy env-var ramp until they run `add-site`.
|
|
215
|
+
const file = await loadSitesFile(sitesFilePath);
|
|
216
|
+
if (file.sites.length > 0) {
|
|
217
|
+
return new SiteRegistry(file);
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
// (2) legacy env-bridge. The bridge already enforces URL/bearer
|
|
221
|
+
// non-emptiness and platform-hint validity, but we re-validate the
|
|
222
|
+
// full file shape through the W1 Zod schema before handing it to
|
|
223
|
+
// the registry. Defense-in-depth: a future env-bridge change cannot
|
|
224
|
+
// introduce a SitesFileT-shape regression that lands on the
|
|
225
|
+
// registry path without first failing this gate.
|
|
226
|
+
const synth = synthesiseFromEnv(env);
|
|
227
|
+
if (synth !== null) {
|
|
228
|
+
const parsed = SitesFile.safeParse(synth);
|
|
229
|
+
if (!parsed.success) {
|
|
230
|
+
const issues = parsed.error.issues
|
|
231
|
+
.map((i) => `${i.path.join('.')}: ${i.message}`)
|
|
232
|
+
.join('; ');
|
|
233
|
+
throw new ConfigError(`Env-bridge synthesised an invalid sites file: ${issues}`);
|
|
234
|
+
}
|
|
235
|
+
return new SiteRegistry(parsed.data);
|
|
236
|
+
}
|
|
237
|
+
// (3) fail-fast.
|
|
238
|
+
throw new ConfigError('No sites configured. Either: '
|
|
239
|
+
+ '(a) set YTB_MCP_SITES_FILE to your sites.json path, or '
|
|
240
|
+
+ '(b) set YTB_MCP_SITE_URL + YTB_MCP_BEARER_TOKEN for '
|
|
241
|
+
+ 'single-site mode, or '
|
|
242
|
+
+ '(c) run `npx -y @wootsup/yt-builder-mcp setup` interactively.');
|
|
243
|
+
}
|
|
244
|
+
//# sourceMappingURL=auth.js.map
|
package/dist/auth.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../src/auth.ts"],"names":[],"mappings":"AAAA;;;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,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,CAAC;iBAC/C,IAAI,CAAC,IAAI,CAAC,CAAC;YAChB,MAAM,IAAI,WAAW,CACjB,iDAAiD,MAAM,EAAE,CAC5D,CAAC;QACN,CAAC;QACD,OAAO,IAAI,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,iBAAiB;IACjB,MAAM,IAAI,WAAW,CACjB,+BAA+B;UAC7B,yDAAyD;UACzD,sDAAsD;UACtD,uBAAuB;UACvB,+DAA+D,CACpE,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure decision core for the `bin/yt-builder-mcp.js` dispatcher.
|
|
3
|
+
*
|
|
4
|
+
* The bin is a thin JS shim (not type-checked, not linted) so the
|
|
5
|
+
* branching logic that decides what a given invocation should DO lives
|
|
6
|
+
* here, in a typed + tested + covered module. The shim imports the
|
|
7
|
+
* compiled `dist/cli/invocation-decision.js` and acts on the verdict.
|
|
8
|
+
*
|
|
9
|
+
* Three outcomes:
|
|
10
|
+
* - 'cli' → a known subcommand (setup / uninstall / add-site / …):
|
|
11
|
+
* forward argv to the setup-cli dispatcher.
|
|
12
|
+
* - 'hint' → no or unknown subcommand AND stdin is an interactive
|
|
13
|
+
* TTY (a human ran the bin directly): print the
|
|
14
|
+
* discoverability hint to stderr and exit 0, rather than
|
|
15
|
+
* silently blocking on the stdio read loop ("hang").
|
|
16
|
+
* - 'server' → no or unknown subcommand AND stdin is NOT a TTY (a real
|
|
17
|
+
* MCP client piping JSON-RPC over stdin): boot the stdio
|
|
18
|
+
* server. This path MUST stay byte-for-byte equivalent to
|
|
19
|
+
* the pre-hint behaviour — the guard is strict on isTTY so
|
|
20
|
+
* the client path is never diverted.
|
|
21
|
+
*
|
|
22
|
+
* @license MIT
|
|
23
|
+
*/
|
|
24
|
+
/**
|
|
25
|
+
* Canonical set of subcommands handled by the setup-cli dispatcher.
|
|
26
|
+
*
|
|
27
|
+
* Mirrors `CLI_SUBCOMMANDS` in `bin/yt-builder-mcp.js`. Kept frozen so a
|
|
28
|
+
* consumer cannot mutate the shared decision surface at runtime.
|
|
29
|
+
*/
|
|
30
|
+
export declare const KNOWN_SUBCOMMANDS: ReadonlySet<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Discoverability hint printed to stderr when a human runs the bin
|
|
33
|
+
* directly (no/unknown subcommand at an interactive TTY). stderr, not
|
|
34
|
+
* stdout, so it never contaminates a JSON-RPC frame if redirected.
|
|
35
|
+
*/
|
|
36
|
+
export declare const BARE_INVOCATION_HINT: string;
|
|
37
|
+
/** What the bin should do for a given invocation. */
|
|
38
|
+
export type InvocationAction = 'cli' | 'hint' | 'server';
|
|
39
|
+
/**
|
|
40
|
+
* True when `sub` is a subcommand the setup-cli dispatcher handles.
|
|
41
|
+
* `undefined` (no argument) is never a known subcommand.
|
|
42
|
+
*/
|
|
43
|
+
export declare function isKnownSubcommand(sub: string | undefined): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Decide the bin action from the first CLI argument and whether stdin is
|
|
46
|
+
* an interactive TTY.
|
|
47
|
+
*
|
|
48
|
+
* @param subcommand argv[2], or undefined when no argument was passed.
|
|
49
|
+
* @param stdinIsTTY `process.stdin.isTTY` — `true` only for an
|
|
50
|
+
* interactive human terminal; `false`/`undefined` for
|
|
51
|
+
* a piped stream (which is how every MCP client runs
|
|
52
|
+
* the server). The guard is STRICT: only `=== true`
|
|
53
|
+
* yields the hint, so the MCP-client path is never
|
|
54
|
+
* diverted.
|
|
55
|
+
*/
|
|
56
|
+
export declare function decideInvocation(subcommand: string | undefined, stdinIsTTY: boolean | undefined): InvocationAction;
|
|
57
|
+
//# sourceMappingURL=invocation-decision.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"invocation-decision.d.ts","sourceRoot":"","sources":["../../src/cli/invocation-decision.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,WAAW,CAAC,MAAM,CAoBjD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAKxB,CAAC;AAEZ,qDAAqD;AACrD,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,CAAC;AAEzD;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAElE;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gBAAgB,CAC5B,UAAU,EAAE,MAAM,GAAG,SAAS,EAC9B,UAAU,EAAE,OAAO,GAAG,SAAS,GAChC,gBAAgB,CAMlB"}
|