@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
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W2 — Secret-Resolver: produce a bearer-token for a `SiteEntryT` at call
|
|
3
|
+
* time, supporting either a plain in-file token (`bearer`) or a 1Password
|
|
4
|
+
* Secret Reference (`bearer_ref`) resolved through the `op` CLI.
|
|
5
|
+
*
|
|
6
|
+
* Design choices (per plan §W2):
|
|
7
|
+
* - **`execFile`, never `exec`/`spawn` with `shell:true`.** `op read <ref>`
|
|
8
|
+
* must run as a direct `execve` with an argv array — no shell, no
|
|
9
|
+
* metacharacter expansion. The W1 schema already enforces
|
|
10
|
+
* {@link OP_REF_REGEX}; this module re-enforces it at the call site as
|
|
11
|
+
* defence-in-depth (a hand-edited sites.json could otherwise sneak a
|
|
12
|
+
* payload past validation).
|
|
13
|
+
* - **5-second hard timeout.** `op` is interactive in some failure modes
|
|
14
|
+
* (Touch-ID, biometric retry). We cap with a real timer + `kill()` to
|
|
15
|
+
* avoid agent-loop wedging on a stalled subprocess.
|
|
16
|
+
* - **Pluggable for testing.** The OpSecretResolver accepts an injected
|
|
17
|
+
* `execFile` callback so tests can mock subprocess invocation without
|
|
18
|
+
* monkey-patching the global `node:child_process` module.
|
|
19
|
+
*
|
|
20
|
+
* @license MIT
|
|
21
|
+
*/
|
|
22
|
+
import { execFile as nodeExecFile } from 'node:child_process';
|
|
23
|
+
import { existsSync } from 'node:fs';
|
|
24
|
+
import { OP_REF_REGEX } from './schema.js';
|
|
25
|
+
/** Hard cap for any single `op read` invocation. */
|
|
26
|
+
const OP_TIMEOUT_MS = 5_000;
|
|
27
|
+
/**
|
|
28
|
+
* Common absolute install locations for the 1Password CLI. GUI-spawned
|
|
29
|
+
* MCP hosts (Claude Desktop, etc.) launch the server subprocess with a
|
|
30
|
+
* minimal PATH that usually omits `/opt/homebrew/bin` and `/usr/local/bin`,
|
|
31
|
+
* so a bare `op` resolves to ENOENT even when the user has `op` working in
|
|
32
|
+
* their shell. We probe these absolute paths before falling back to PATH.
|
|
33
|
+
*
|
|
34
|
+
* Order: Homebrew (Apple Silicon) → Homebrew/manual (Intel + /usr/local) →
|
|
35
|
+
* Linux package managers → PATH.
|
|
36
|
+
*/
|
|
37
|
+
const OP_BINARY_CANDIDATES = [
|
|
38
|
+
'/opt/homebrew/bin/op',
|
|
39
|
+
'/usr/local/bin/op',
|
|
40
|
+
'/usr/bin/op',
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* Resolve the `op` binary to an absolute path so it works under a
|
|
44
|
+
* stripped-down GUI PATH. Precedence: explicit `YTB_MCP_OP_BINARY` env
|
|
45
|
+
* override → first existing well-known absolute path → bare `op` (PATH).
|
|
46
|
+
*/
|
|
47
|
+
export function resolveOpBinary(env = process.env) {
|
|
48
|
+
const override = (env.YTB_MCP_OP_BINARY ?? '').trim();
|
|
49
|
+
if (override.length > 0)
|
|
50
|
+
return override;
|
|
51
|
+
for (const candidate of OP_BINARY_CANDIDATES) {
|
|
52
|
+
try {
|
|
53
|
+
if (existsSync(candidate))
|
|
54
|
+
return candidate;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
// ignore stat errors and keep probing
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return 'op';
|
|
61
|
+
}
|
|
62
|
+
/** `op` CLI exit-code → friendly hint mapping. */
|
|
63
|
+
const OP_EXIT_CODE_HINTS = {
|
|
64
|
+
6: 'Not signed in to 1Password CLI. Run `op signin` and retry.',
|
|
65
|
+
1: 'Generic op CLI error — verify the secret reference exists and the vault is accessible.',
|
|
66
|
+
};
|
|
67
|
+
/** Domain-tagged error so callers (auth, client) can branch on `code`. */
|
|
68
|
+
export class SecretResolverError extends Error {
|
|
69
|
+
code;
|
|
70
|
+
constructor(code, message) {
|
|
71
|
+
super(message);
|
|
72
|
+
this.code = code;
|
|
73
|
+
this.name = 'SecretResolverError';
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
/** Default factory wrapping Node's real `execFile`. Adapter for type-shape. */
|
|
77
|
+
const defaultExecFile = (file, args, options, callback) => {
|
|
78
|
+
// Pass `encoding: 'utf8'` explicitly so stdout/stderr are guaranteed
|
|
79
|
+
// strings, not Buffers. The execFile overload resolution returns `string`
|
|
80
|
+
// for both when `encoding` is set.
|
|
81
|
+
nodeExecFile(file, args, { ...options, encoding: 'utf8' }, (err, stdout, stderr) => {
|
|
82
|
+
callback(err, stdout, stderr);
|
|
83
|
+
});
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Plain in-file bearer — used when `site.bearer` is populated. Returns the
|
|
87
|
+
* stored token verbatim, with `source:'plain'`.
|
|
88
|
+
*/
|
|
89
|
+
export class PlainSecretResolver {
|
|
90
|
+
async resolve(site) {
|
|
91
|
+
const token = site.bearer;
|
|
92
|
+
if (token === undefined || token.length === 0) {
|
|
93
|
+
throw new SecretResolverError('PLAIN_BEARER_MISSING', `Site '${site.site_id}' has no inline 'bearer' — set one or configure 'bearer_ref'.`);
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
token,
|
|
97
|
+
source: 'plain',
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Resolves `bearer_ref` (`op://vault/item/field`) through the 1Password CLI.
|
|
103
|
+
*
|
|
104
|
+
* Failure surface:
|
|
105
|
+
* - Missing `bearer_ref` → `OP_REF_MISSING`
|
|
106
|
+
* - Malformed ref at call site → `OP_REF_INVALID`
|
|
107
|
+
* - `op` binary not on PATH (ENOENT) → `OP_CLI_MISSING`
|
|
108
|
+
* - `op` exit-code 6 (not signed in) → `OP_NOT_SIGNED_IN`
|
|
109
|
+
* - 5-second timeout exceeded → `OP_TIMEOUT`
|
|
110
|
+
* - Empty/whitespace stdout → `OP_EMPTY_OUTPUT`
|
|
111
|
+
* - Any other non-zero exit → `OP_EXEC_FAILED`
|
|
112
|
+
*/
|
|
113
|
+
export class OpSecretResolver {
|
|
114
|
+
opBinary;
|
|
115
|
+
execFile;
|
|
116
|
+
timeoutMs;
|
|
117
|
+
constructor(opBinary = resolveOpBinary(), execFile = defaultExecFile, timeoutMs = OP_TIMEOUT_MS) {
|
|
118
|
+
this.opBinary = opBinary;
|
|
119
|
+
this.execFile = execFile;
|
|
120
|
+
this.timeoutMs = timeoutMs;
|
|
121
|
+
}
|
|
122
|
+
async resolve(site) {
|
|
123
|
+
const ref = site.bearer_ref;
|
|
124
|
+
if (ref === undefined || ref.length === 0) {
|
|
125
|
+
throw new SecretResolverError('OP_REF_MISSING', `Site '${site.site_id}' has no 'bearer_ref' — OpSecretResolver requires one.`);
|
|
126
|
+
}
|
|
127
|
+
// Defence-in-depth: re-validate the ref shape at the call site,
|
|
128
|
+
// BEFORE we hand the string to a subprocess. The W1 schema also
|
|
129
|
+
// enforces this on load/save, but a hand-edited or hot-loaded
|
|
130
|
+
// sites.json could in theory bypass that.
|
|
131
|
+
if (!OP_REF_REGEX.test(ref)) {
|
|
132
|
+
throw new SecretResolverError('OP_REF_INVALID', `Site '${site.site_id}' has an invalid 'bearer_ref' shape — must match op://<vault>/<item>/<field>.`);
|
|
133
|
+
}
|
|
134
|
+
const stdout = await this.runOpRead(ref);
|
|
135
|
+
const token = stdout.trim();
|
|
136
|
+
if (token.length === 0) {
|
|
137
|
+
throw new SecretResolverError('OP_EMPTY_OUTPUT', `op returned empty output for '${ref}' — verify the field exists and is non-empty.`);
|
|
138
|
+
}
|
|
139
|
+
return {
|
|
140
|
+
token,
|
|
141
|
+
source: 'op',
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Invokes `op read <ref>` with a hard timeout. The promise is wrapped
|
|
146
|
+
* so a stalled subprocess (e.g. waiting on biometric prompt) cannot
|
|
147
|
+
* outlive {@link timeoutMs}.
|
|
148
|
+
*/
|
|
149
|
+
runOpRead(ref) {
|
|
150
|
+
return new Promise((resolve, reject) => {
|
|
151
|
+
let settled = false;
|
|
152
|
+
const timer = setTimeout(() => {
|
|
153
|
+
if (settled)
|
|
154
|
+
return;
|
|
155
|
+
settled = true;
|
|
156
|
+
reject(new SecretResolverError('OP_TIMEOUT', `op read '${ref}' exceeded ${this.timeoutMs}ms — is 1Password CLI hung on a biometric prompt?`));
|
|
157
|
+
}, this.timeoutMs);
|
|
158
|
+
// Allow the test process to exit even if `op` is still pending.
|
|
159
|
+
if (typeof timer.unref === 'function')
|
|
160
|
+
timer.unref();
|
|
161
|
+
this.execFile(this.opBinary, ['read', ref], { timeout: this.timeoutMs, maxBuffer: 1024 * 64 }, (err, stdout, stderr) => {
|
|
162
|
+
if (settled)
|
|
163
|
+
return;
|
|
164
|
+
settled = true;
|
|
165
|
+
clearTimeout(timer);
|
|
166
|
+
if (err) {
|
|
167
|
+
reject(this.mapExecError(err, stderr, ref));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
resolve(stdout);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
mapExecError(err, stderr, ref) {
|
|
175
|
+
const codeStr = typeof err.code === 'string' ? err.code : '';
|
|
176
|
+
const codeNum = typeof err.code === 'number' ? err.code : NaN;
|
|
177
|
+
if (codeStr === 'ENOENT') {
|
|
178
|
+
return new SecretResolverError('OP_CLI_MISSING', `op CLI not found in PATH — install 1Password CLI or use plain bearer field instead of bearer_ref.`);
|
|
179
|
+
}
|
|
180
|
+
// W12-R1.2 (A5-S4): the `op` CLI returns "isn't an item" / "item
|
|
181
|
+
// not found" on stderr when the ref points to a nonexistent item.
|
|
182
|
+
// Surfaced as generic OP_EXEC_FAILED pre-W12, which left the
|
|
183
|
+
// customer guessing whether their ref shape was wrong vs whether
|
|
184
|
+
// the item was deleted. Brand it explicitly so the recovery hint
|
|
185
|
+
// can name the right knob.
|
|
186
|
+
const stderrLower = (stderr || '').toLowerCase();
|
|
187
|
+
if (stderrLower.includes(`isn't an item`)
|
|
188
|
+
|| stderrLower.includes('item not found')) {
|
|
189
|
+
return new SecretResolverError('OP_ITEM_NOT_FOUND', `1Password item not found at '${ref}'. `
|
|
190
|
+
+ 'Verify the ref points to an existing item, or update sites.json bearer_ref.');
|
|
191
|
+
}
|
|
192
|
+
if (Number.isFinite(codeNum)) {
|
|
193
|
+
const hint = OP_EXIT_CODE_HINTS[codeNum];
|
|
194
|
+
if (codeNum === 6) {
|
|
195
|
+
return new SecretResolverError('OP_NOT_SIGNED_IN', hint ?? `op exited 6 — not signed in.`);
|
|
196
|
+
}
|
|
197
|
+
return new SecretResolverError('OP_EXEC_FAILED', `op read '${ref}' failed with exit ${codeNum}: ${(stderr || '').trim() || (hint ?? 'no stderr')}`);
|
|
198
|
+
}
|
|
199
|
+
return new SecretResolverError('OP_EXEC_FAILED', `op read '${ref}' failed: ${err.message}`);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Composite resolver — chooses Plain/Op per site at resolve-time. This is
|
|
204
|
+
* the resolver wired into the registry in W4; W2 ships it standalone so
|
|
205
|
+
* unit tests cover the routing logic in isolation from any caching.
|
|
206
|
+
*/
|
|
207
|
+
export class CompositeSecretResolver {
|
|
208
|
+
plain;
|
|
209
|
+
op;
|
|
210
|
+
constructor(plain = new PlainSecretResolver(), op = new OpSecretResolver()) {
|
|
211
|
+
this.plain = plain;
|
|
212
|
+
this.op = op;
|
|
213
|
+
}
|
|
214
|
+
async resolve(site) {
|
|
215
|
+
if (site.bearer_ref !== undefined) {
|
|
216
|
+
return this.op.resolve(site);
|
|
217
|
+
}
|
|
218
|
+
return this.plain.resolve(site);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
/** Default factory consumed by the W4 registry / W5 auth pipeline. */
|
|
222
|
+
export function defaultSecretResolver() {
|
|
223
|
+
return new CompositeSecretResolver();
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=secret-resolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-resolver.js","sourceRoot":"","sources":["../../src/sites/secret-resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,QAAQ,IAAI,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAC;AAE5D,oDAAoD;AACpD,MAAM,aAAa,GAAG,KAAK,CAAC;AAE5B;;;;;;;;;GASG;AACH,MAAM,oBAAoB,GAAsB;IAC5C,sBAAsB;IACtB,mBAAmB;IACnB,aAAa;CAChB,CAAC;AAEF;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAC3B,MAAyB,OAAO,CAAC,GAAG;IAEpC,MAAM,QAAQ,GAAG,CAAC,GAAG,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACtD,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,QAAQ,CAAC;IACzC,KAAK,MAAM,SAAS,IAAI,oBAAoB,EAAE,CAAC;QAC3C,IAAI,CAAC;YACD,IAAI,UAAU,CAAC,SAAS,CAAC;gBAAE,OAAO,SAAS,CAAC;QAChD,CAAC;QAAC,MAAM,CAAC;YACL,sCAAsC;QAC1C,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,kDAAkD;AAClD,MAAM,kBAAkB,GAA2B;IAC/C,CAAC,EAAE,4DAA4D;IAC/D,CAAC,E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jC,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;CACJ;AAED,sEAAsE;AACtE,MAAM,UAAU,qBAAqB;IACjC,OAAO,IAAI,uBAAuB,EAAE,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W1 — Sites-Storage Foundation: load/save the sites file.
|
|
3
|
+
*
|
|
4
|
+
* Guarantees:
|
|
5
|
+
* - **Atomic replace.** Writes go to a sibling `*.tmp.<rand>` file, are
|
|
6
|
+
* fsynced, chmod'd to 0600, and then `rename(2)`d over the target.
|
|
7
|
+
* A SIGINT/SIGKILL between any two of these steps leaves either the
|
|
8
|
+
* old file intact or the new file fully written — never a torn write.
|
|
9
|
+
* - **Lock for concurrent writers.** `proper-lockfile` acquires an
|
|
10
|
+
* advisory lockfile (`<file>.lock`) before any read/modify/write
|
|
11
|
+
* cycle. Default `stale: 10000` ms; second concurrent save retries
|
|
12
|
+
* with exponential back-off (`retries: 10, minTimeout: 50`).
|
|
13
|
+
* - **0600 mode on write.** The temp file is opened/chmod'd to 0600
|
|
14
|
+
* BEFORE the rename so the new inode never exists with looser perms,
|
|
15
|
+
* even for one fsync window.
|
|
16
|
+
* - **Schema-version gate.** Refuses to load a file with a version we
|
|
17
|
+
* don't understand — explicit error, never silent migration.
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*/
|
|
21
|
+
import { type SitesFileT } from './schema.js';
|
|
22
|
+
/** Base class for any sites-file IO/format failure. */
|
|
23
|
+
export declare class SitesFileError extends Error {
|
|
24
|
+
readonly cause?: unknown | undefined;
|
|
25
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
26
|
+
}
|
|
27
|
+
/** Thrown when the on-disk file declares a `schema_version` we don't know. */
|
|
28
|
+
export declare class SchemaVersionError extends SitesFileError {
|
|
29
|
+
readonly found: unknown;
|
|
30
|
+
constructor(found: unknown);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Discriminated lock-acquisition failure. W12-R1.2 (A4-F1): the
|
|
34
|
+
* pre-W12 `SitesFileError` collapsed three distinct failure modes into
|
|
35
|
+
* one opaque "lock not acquired" string. Operators triaging a stuck
|
|
36
|
+
* setup wizard need to distinguish them to choose the right recovery:
|
|
37
|
+
*
|
|
38
|
+
* - LOCK_TIMEOUT → another setup process is currently writing.
|
|
39
|
+
* Wait + retry; do NOT touch the lockfile.
|
|
40
|
+
* - LOCK_ORPHAN → stale lock from a crashed prior process.
|
|
41
|
+
* Manual `rm <lockfilePath>` is the only fix.
|
|
42
|
+
* - LOCK_PERMISSION → the lock dir itself is not writable. Fix
|
|
43
|
+
* file-system permissions.
|
|
44
|
+
*
|
|
45
|
+
* The `lockCode` discriminant + `lockfilePath` field let CLI surfaces
|
|
46
|
+
* (and pre-flight automation) emit precise hints.
|
|
47
|
+
*/
|
|
48
|
+
export type SitesFileLockCode = 'LOCK_TIMEOUT' | 'LOCK_ORPHAN' | 'LOCK_PERMISSION';
|
|
49
|
+
export declare class SitesFileLockError extends SitesFileError {
|
|
50
|
+
readonly lockCode: SitesFileLockCode;
|
|
51
|
+
readonly lockfilePath: string;
|
|
52
|
+
constructor(lockCode: SitesFileLockCode, lockfilePath: string, message: string, cause?: unknown);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Returns the empty seed used when a sites file does not yet exist.
|
|
56
|
+
* Callers (W3 registry) detect "no file → run env-bridge fallback".
|
|
57
|
+
*/
|
|
58
|
+
export declare function emptySitesFile(): SitesFileT;
|
|
59
|
+
/**
|
|
60
|
+
* Load + validate a sites file.
|
|
61
|
+
*
|
|
62
|
+
* Returns {@link emptySitesFile} when the path does not exist (no error).
|
|
63
|
+
* Throws {@link SchemaVersionError} for a known-unknown version and
|
|
64
|
+
* {@link SitesFileError} for JSON-parse or Zod-validation failures.
|
|
65
|
+
*/
|
|
66
|
+
export declare function loadSitesFile(path: string): Promise<SitesFileT>;
|
|
67
|
+
/**
|
|
68
|
+
* Persist + validate a sites file atomically with chmod 0600.
|
|
69
|
+
*
|
|
70
|
+
* Pipeline:
|
|
71
|
+
* 1. Acquire `<path>.lock` via proper-lockfile (with retries).
|
|
72
|
+
* 2. Validate `data` through {@link SitesFile} (rejects bad input
|
|
73
|
+
* before touching the filesystem).
|
|
74
|
+
* 3. Ensure parent directory exists.
|
|
75
|
+
* 4. Write JSON to `<path>.tmp.<pid>.<rand>`, fsync, chmod 0600.
|
|
76
|
+
* 5. `renameSync` over `<path>`.
|
|
77
|
+
* 6. Release lock.
|
|
78
|
+
*
|
|
79
|
+
* Tmp-file cleanup on any failure path.
|
|
80
|
+
*/
|
|
81
|
+
export declare function saveSitesFile(path: string, data: SitesFileT): Promise<void>;
|
|
82
|
+
//# sourceMappingURL=store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/sites/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAkBH,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzD,uDAAuD;AACvD,qBAAa,cAAe,SAAQ,KAAK;aACQ,KAAK,CAAC,EAAE,OAAO;gBAAhD,OAAO,EAAE,MAAM,EAAkB,KAAK,CAAC,EAAE,OAAO,YAAA;CAI/D;AAED,8EAA8E;AAC9E,qBAAa,kBAAmB,SAAQ,cAAc;aACtB,KAAK,EAAE,OAAO;gBAAd,KAAK,EAAE,OAAO;CAQ7C;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,MAAM,iBAAiB,GAAG,cAAc,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAEnF,qBAAa,kBAAmB,SAAQ,cAAc;aAE9B,QAAQ,EAAE,iBAAiB;aAC3B,YAAY,EAAE,MAAM;gBADpB,QAAQ,EAAE,iBAAiB,EAC3B,YAAY,EAAE,MAAM,EACpC,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,OAAO;CAKtB;AAED;;;GAGG;AACH,wBAAgB,cAAc,IAAI,UAAU,CAE3C;AAED;;;;;;GAMG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAiCrE;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAoFjF"}
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W1 — Sites-Storage Foundation: load/save the sites file.
|
|
3
|
+
*
|
|
4
|
+
* Guarantees:
|
|
5
|
+
* - **Atomic replace.** Writes go to a sibling `*.tmp.<rand>` file, are
|
|
6
|
+
* fsynced, chmod'd to 0600, and then `rename(2)`d over the target.
|
|
7
|
+
* A SIGINT/SIGKILL between any two of these steps leaves either the
|
|
8
|
+
* old file intact or the new file fully written — never a torn write.
|
|
9
|
+
* - **Lock for concurrent writers.** `proper-lockfile` acquires an
|
|
10
|
+
* advisory lockfile (`<file>.lock`) before any read/modify/write
|
|
11
|
+
* cycle. Default `stale: 10000` ms; second concurrent save retries
|
|
12
|
+
* with exponential back-off (`retries: 10, minTimeout: 50`).
|
|
13
|
+
* - **0600 mode on write.** The temp file is opened/chmod'd to 0600
|
|
14
|
+
* BEFORE the rename so the new inode never exists with looser perms,
|
|
15
|
+
* even for one fsync window.
|
|
16
|
+
* - **Schema-version gate.** Refuses to load a file with a version we
|
|
17
|
+
* don't understand — explicit error, never silent migration.
|
|
18
|
+
*
|
|
19
|
+
* @license MIT
|
|
20
|
+
*/
|
|
21
|
+
import { chmodSync, closeSync, existsSync, fsyncSync, mkdirSync, openSync, readFileSync, renameSync, unlinkSync, writeSync, } from 'node:fs';
|
|
22
|
+
import { dirname } from 'node:path';
|
|
23
|
+
import lockfile from 'proper-lockfile';
|
|
24
|
+
import { SitesFile } from './schema.js';
|
|
25
|
+
/** Base class for any sites-file IO/format failure. */
|
|
26
|
+
export class SitesFileError extends Error {
|
|
27
|
+
cause;
|
|
28
|
+
constructor(message, cause) {
|
|
29
|
+
super(message);
|
|
30
|
+
this.cause = cause;
|
|
31
|
+
this.name = 'SitesFileError';
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
/** Thrown when the on-disk file declares a `schema_version` we don't know. */
|
|
35
|
+
export class SchemaVersionError extends SitesFileError {
|
|
36
|
+
found;
|
|
37
|
+
constructor(found) {
|
|
38
|
+
super(`Unsupported sites-file schema_version: ${String(found)}. ` +
|
|
39
|
+
`This build supports schema_version: 1. ` +
|
|
40
|
+
`Upgrade @wootsup/yt-builder-mcp or revert the file.`);
|
|
41
|
+
this.found = found;
|
|
42
|
+
this.name = 'SchemaVersionError';
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class SitesFileLockError extends SitesFileError {
|
|
46
|
+
lockCode;
|
|
47
|
+
lockfilePath;
|
|
48
|
+
constructor(lockCode, lockfilePath, message, cause) {
|
|
49
|
+
super(message, cause);
|
|
50
|
+
this.lockCode = lockCode;
|
|
51
|
+
this.lockfilePath = lockfilePath;
|
|
52
|
+
this.name = 'SitesFileLockError';
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Returns the empty seed used when a sites file does not yet exist.
|
|
57
|
+
* Callers (W3 registry) detect "no file → run env-bridge fallback".
|
|
58
|
+
*/
|
|
59
|
+
export function emptySitesFile() {
|
|
60
|
+
return { schema_version: 1, default_site_id: null, sites: [] };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Load + validate a sites file.
|
|
64
|
+
*
|
|
65
|
+
* Returns {@link emptySitesFile} when the path does not exist (no error).
|
|
66
|
+
* Throws {@link SchemaVersionError} for a known-unknown version and
|
|
67
|
+
* {@link SitesFileError} for JSON-parse or Zod-validation failures.
|
|
68
|
+
*/
|
|
69
|
+
export async function loadSitesFile(path) {
|
|
70
|
+
if (!existsSync(path)) {
|
|
71
|
+
return emptySitesFile();
|
|
72
|
+
}
|
|
73
|
+
let raw;
|
|
74
|
+
try {
|
|
75
|
+
raw = readFileSync(path, 'utf-8');
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
throw new SitesFileError(`Failed to read sites file at ${path}`, e);
|
|
79
|
+
}
|
|
80
|
+
let parsed;
|
|
81
|
+
try {
|
|
82
|
+
parsed = JSON.parse(raw);
|
|
83
|
+
}
|
|
84
|
+
catch (e) {
|
|
85
|
+
throw new SitesFileError(`Sites file at ${path} is not valid JSON`, e);
|
|
86
|
+
}
|
|
87
|
+
if (typeof parsed === 'object' && parsed !== null
|
|
88
|
+
&& 'schema_version' in parsed
|
|
89
|
+
&& parsed.schema_version !== 1) {
|
|
90
|
+
throw new SchemaVersionError(parsed.schema_version);
|
|
91
|
+
}
|
|
92
|
+
const result = SitesFile.safeParse(parsed);
|
|
93
|
+
if (!result.success) {
|
|
94
|
+
throw new SitesFileError(`Sites file at ${path} failed schema validation: ` +
|
|
95
|
+
result.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; '));
|
|
96
|
+
}
|
|
97
|
+
return result.data;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Persist + validate a sites file atomically with chmod 0600.
|
|
101
|
+
*
|
|
102
|
+
* Pipeline:
|
|
103
|
+
* 1. Acquire `<path>.lock` via proper-lockfile (with retries).
|
|
104
|
+
* 2. Validate `data` through {@link SitesFile} (rejects bad input
|
|
105
|
+
* before touching the filesystem).
|
|
106
|
+
* 3. Ensure parent directory exists.
|
|
107
|
+
* 4. Write JSON to `<path>.tmp.<pid>.<rand>`, fsync, chmod 0600.
|
|
108
|
+
* 5. `renameSync` over `<path>`.
|
|
109
|
+
* 6. Release lock.
|
|
110
|
+
*
|
|
111
|
+
* Tmp-file cleanup on any failure path.
|
|
112
|
+
*/
|
|
113
|
+
export async function saveSitesFile(path, data) {
|
|
114
|
+
const validated = SitesFile.safeParse(data);
|
|
115
|
+
if (!validated.success) {
|
|
116
|
+
throw new SitesFileError(`Refusing to write invalid sites file: ` +
|
|
117
|
+
validated.error.issues.map((i) => `${i.path.join('.')}: ${i.message}`).join('; '));
|
|
118
|
+
}
|
|
119
|
+
const dir = dirname(path);
|
|
120
|
+
// W12-R1.2 (A2-M3): the on-disk sites file ends up chmod 0600, but
|
|
121
|
+
// the parent directory was previously created with the process
|
|
122
|
+
// umask — typically 0o755 on Linux/macOS, which is world-readable.
|
|
123
|
+
// A world-readable parent dir is harmless for the bearers (they
|
|
124
|
+
// live in 0600 files) but DOES leak the existence of a sites.json
|
|
125
|
+
// to any local user. Tighten to 0700 (owner-only rwx) on creation.
|
|
126
|
+
// Existing directories are left as-is — mkdirSync is a no-op when
|
|
127
|
+
// the dir exists, and chmod'ing an existing dir would surprise
|
|
128
|
+
// operators who chose a shared location intentionally.
|
|
129
|
+
mkdirSync(dir, { recursive: true, mode: 0o700 });
|
|
130
|
+
// proper-lockfile defaults to realpath:true, which throws ENOENT for
|
|
131
|
+
// a not-yet-existing target. Disable realpath + steer the lock at an
|
|
132
|
+
// explicit sibling path. The lock dir always exists (mkdirSync above).
|
|
133
|
+
const lockfilePath = `${path}.lock`;
|
|
134
|
+
let release;
|
|
135
|
+
try {
|
|
136
|
+
release = await lockfile.lock(path, {
|
|
137
|
+
lockfilePath,
|
|
138
|
+
realpath: false,
|
|
139
|
+
stale: 10_000,
|
|
140
|
+
retries: { retries: 10, minTimeout: 50, maxTimeout: 500, factor: 2 },
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
// W12-R1.2 (A4-F1): map the underlying error code into a
|
|
145
|
+
// discriminated lock-failure so callers can render the right
|
|
146
|
+
// recovery hint instead of telling the user three possible
|
|
147
|
+
// causes at once.
|
|
148
|
+
const errCode = e !== null && typeof e === 'object' && 'code' in e
|
|
149
|
+
? e.code
|
|
150
|
+
: undefined;
|
|
151
|
+
let lockCode;
|
|
152
|
+
let hint;
|
|
153
|
+
if (errCode === 'ELOCKED') {
|
|
154
|
+
lockCode = 'LOCK_TIMEOUT';
|
|
155
|
+
hint =
|
|
156
|
+
'Another setup process is currently writing — retry in 30s.';
|
|
157
|
+
}
|
|
158
|
+
else if (errCode === 'EACCES' || errCode === 'EPERM') {
|
|
159
|
+
lockCode = 'LOCK_PERMISSION';
|
|
160
|
+
hint = `Cannot write to lock dir. Check permissions on ${dir}.`;
|
|
161
|
+
}
|
|
162
|
+
else {
|
|
163
|
+
lockCode = 'LOCK_ORPHAN';
|
|
164
|
+
hint =
|
|
165
|
+
`Stale lock from prior crashed process. Remove with: rm ${lockfilePath}`;
|
|
166
|
+
}
|
|
167
|
+
throw new SitesFileLockError(lockCode, lockfilePath, `Could not acquire lock on ${lockfilePath}. ${hint}`, e);
|
|
168
|
+
}
|
|
169
|
+
const tmpPath = `${path}.tmp.${process.pid}.${Math.random().toString(36).slice(2, 10)}`;
|
|
170
|
+
try {
|
|
171
|
+
const fd = openSync(tmpPath, 'w', 0o600);
|
|
172
|
+
try {
|
|
173
|
+
const payload = JSON.stringify(validated.data, null, 2) + '\n';
|
|
174
|
+
writeSync(fd, payload);
|
|
175
|
+
fsyncSync(fd);
|
|
176
|
+
}
|
|
177
|
+
finally {
|
|
178
|
+
closeSync(fd);
|
|
179
|
+
}
|
|
180
|
+
// Belt-and-braces: openSync's mode arg may be umask-clamped on
|
|
181
|
+
// some platforms; the explicit chmod guarantees 0600 regardless.
|
|
182
|
+
chmodSync(tmpPath, 0o600);
|
|
183
|
+
renameSync(tmpPath, path);
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
// Best-effort tmp cleanup; ignore failures.
|
|
187
|
+
try {
|
|
188
|
+
if (existsSync(tmpPath))
|
|
189
|
+
unlinkSync(tmpPath);
|
|
190
|
+
}
|
|
191
|
+
catch { /* swallow */ }
|
|
192
|
+
throw new SitesFileError(`Failed to write sites file at ${path}`, e);
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
await release().catch(() => { });
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
//# sourceMappingURL=store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/sites/store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EACH,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,UAAU,EACV,SAAS,GACZ,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAEzD,uDAAuD;AACvD,MAAM,OAAO,cAAe,SAAQ,KAAK;IACQ;IAA7C,YAAY,OAAe,EAAkB,KAAe;QACxD,KAAK,CAAC,OAAO,CAAC,CAAC;QAD0B,UAAK,GAAL,KAAK,CAAU;QAExD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;IACjC,CAAC;CACJ;AAED,8EAA8E;AAC9E,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IACtB;IAA5B,YAA4B,KAAc;QACtC,KAAK,CACD,0CAA0C,MAAM,CAAC,KAAK,CAAC,IAAI;YAC3D,yCAAyC;YACzC,qDAAqD,CACxD,CAAC;QALsB,UAAK,GAAL,KAAK,CAAS;QAMtC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;IACrC,CAAC;CACJ;AAoBD,MAAM,OAAO,kBAAmB,SAAQ,cAAc;IAE9B;IACA;IAFpB,YACoB,QAA2B,EAC3B,YAAoB,EACpC,OAAe,EACf,KAAe;QAEf,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QALN,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,iBAAY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O,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC;YACD,MAAM,OAAO,GAAG,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC;YAC/D,SAAS,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YACvB,SAAS,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;gBAAS,CAAC;YACP,SAAS,CAAC,EAAE,CAAC,CAAC;QAClB,CAAC;QACD,+DAA+D;QAC/D,iEAAiE;QACjE,SAAS,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QAC1B,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;IAC9B,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACT,4CAA4C;QAC5C,IAAI,CAAC;YAAC,IAAI,UAAU,CAAC,OAAO,CAAC;gBAAE,UAAU,CAAC,OAAO,CAAC,CAAC;QAAC,CAAC;QAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC;QAC7E,MAAM,IAAI,cAAc,CAAC,iCAAiC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACzE,CAAC;YAAS,CAAC;QACP,MAAM,OAAO,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAA4C,CAAC,CAAC,CAAC;IAC9E,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W7 — sites/tools/ aggregator.
|
|
3
|
+
*
|
|
4
|
+
* Returns the two L1 platform-agnostic site-management tools:
|
|
5
|
+
* - `yootheme_builder_sites_list` (registry inspection — no REST)
|
|
6
|
+
* - `yootheme_builder_sites_test` (per-site connectivity probe)
|
|
7
|
+
*
|
|
8
|
+
* Wired into `buildAllTools(pool)` — the aggregator pulls the
|
|
9
|
+
* read-only `SiteRegistry` off the pool internally so callers thread
|
|
10
|
+
* only the pool through, never the registry separately.
|
|
11
|
+
*
|
|
12
|
+
* @license MIT
|
|
13
|
+
*/
|
|
14
|
+
import type { ClientPool } from '../client-pool.js';
|
|
15
|
+
import type { AnyToolDefinition } from '../../tools/tool-builder.js';
|
|
16
|
+
/**
|
|
17
|
+
* Build the W7 sites-management tool pair. The pool's read-only
|
|
18
|
+
* `registry` accessor feeds `buildSitesListTool` (which never resolves
|
|
19
|
+
* a bearer); the pool itself feeds `buildSitesTestTool` (which calls
|
|
20
|
+
* `pool.resolve(site_id)` to obtain a `RestClient`).
|
|
21
|
+
*
|
|
22
|
+
* W12-R1.3 (A1-L-01): single-arg signature — reading the registry off
|
|
23
|
+
* the pool inside this aggregator removes the only call-site that
|
|
24
|
+
* needed the pool's `registry` getter, so the getter can stay
|
|
25
|
+
* `@internal`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildSitesTools(pool: ClientPool): readonly AnyToolDefinition[];
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/sites/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAMrE;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC3B,IAAI,EAAE,UAAU,GACjB,SAAS,iBAAiB,EAAE,CAS9B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W7 — sites/tools/ aggregator.
|
|
3
|
+
*
|
|
4
|
+
* Returns the two L1 platform-agnostic site-management tools:
|
|
5
|
+
* - `yootheme_builder_sites_list` (registry inspection — no REST)
|
|
6
|
+
* - `yootheme_builder_sites_test` (per-site connectivity probe)
|
|
7
|
+
*
|
|
8
|
+
* Wired into `buildAllTools(pool)` — the aggregator pulls the
|
|
9
|
+
* read-only `SiteRegistry` off the pool internally so callers thread
|
|
10
|
+
* only the pool through, never the registry separately.
|
|
11
|
+
*
|
|
12
|
+
* @license MIT
|
|
13
|
+
*/
|
|
14
|
+
import { buildSitesListTool } from './sites-list.js';
|
|
15
|
+
import { buildSitesTestTool } from './sites-test.js';
|
|
16
|
+
import { buildUseSiteTool } from './use-site.js';
|
|
17
|
+
/**
|
|
18
|
+
* Build the W7 sites-management tool pair. The pool's read-only
|
|
19
|
+
* `registry` accessor feeds `buildSitesListTool` (which never resolves
|
|
20
|
+
* a bearer); the pool itself feeds `buildSitesTestTool` (which calls
|
|
21
|
+
* `pool.resolve(site_id)` to obtain a `RestClient`).
|
|
22
|
+
*
|
|
23
|
+
* W12-R1.3 (A1-L-01): single-arg signature — reading the registry off
|
|
24
|
+
* the pool inside this aggregator removes the only call-site that
|
|
25
|
+
* needed the pool's `registry` getter, so the getter can stay
|
|
26
|
+
* `@internal`.
|
|
27
|
+
*/
|
|
28
|
+
export function buildSitesTools(pool) {
|
|
29
|
+
return [
|
|
30
|
+
buildSitesListTool(pool.registry),
|
|
31
|
+
buildSitesTestTool(pool),
|
|
32
|
+
// Phase 3 — runtime active-site switch (mirrors api-mapper's
|
|
33
|
+
// `apimapper_use_profile`). Reuses the pool's in-memory active-
|
|
34
|
+
// site override; never rebuilds the multi-site engine.
|
|
35
|
+
buildUseSiteTool(pool),
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/sites/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAKH,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,UAAU,eAAe,CAC3B,IAAgB;IAEhB,OAAO;QACH,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC;QACjC,kBAAkB,CAAC,IAAI,CAAC;QACxB,6DAA6D;QAC7D,gEAAgE;QAChE,uDAAuD;QACvD,gBAAgB,CAAC,IAAI,CAAC;KACzB,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* W7 — `yootheme_builder_sites_list` L1 tool.
|
|
3
|
+
*
|
|
4
|
+
* Platform-agnostic registry inspection: lists the in-process
|
|
5
|
+
* {@link SiteRegistry} as a tabular result so an agent (or a Maria-class
|
|
6
|
+
* Claude-Desktop user) can discover which site_ids are wired into this
|
|
7
|
+
* MCP server WITHOUT a network round-trip.
|
|
8
|
+
*
|
|
9
|
+
* Why it does NOT call `pool.resolve()`:
|
|
10
|
+
* - The tool reads the registry verbatim and never touches bearers, the
|
|
11
|
+
* secret-resolver, or any HTTP endpoint. Resolving through the pool
|
|
12
|
+
* would force a default-site requirement that is exactly the
|
|
13
|
+
* bootstrap failure-mode the tool is meant to diagnose ("I added
|
|
14
|
+
* sites but forgot to mark a default"). For the same reason the
|
|
15
|
+
* handler intentionally skips `withSiteMeta` — there is no resolved
|
|
16
|
+
* site to stamp; instead we emit a `structuredContent._meta.tool_kind
|
|
17
|
+
* = 'registry'` marker so MCP hosts can route the result through a
|
|
18
|
+
* registry-aware UI if/when they grow one.
|
|
19
|
+
*
|
|
20
|
+
* Why `site_id` is exposed but unused:
|
|
21
|
+
* - The W5 SITE_ID_SCHEMA pin requires EVERY tool to expose the
|
|
22
|
+
* optional `site_id` field so legacy/scripted callers never trip a
|
|
23
|
+
* Zod parse on an extra-property. The W12-R1.3 DESCRIPTION_SUFFIX_EXEMPT
|
|
24
|
+
* list opts this tool out of the canonical description suffix
|
|
25
|
+
* because "operates on the default site" would imply per-row
|
|
26
|
+
* filtering that the handler does not perform.
|
|
27
|
+
*
|
|
28
|
+
* W12-R1.3 (A2-L4): `bearer_source` was previously projected into the
|
|
29
|
+
* output row + table column. Even though it carried only the literal
|
|
30
|
+
* `'plain'` / `'op'`, the `sites://current` resource already omits
|
|
31
|
+
* this field (see ADR rationale in server.ts) and the tool surface
|
|
32
|
+
* should match for cross-surface consistency. The field is dropped
|
|
33
|
+
* from both the structured row AND the table column.
|
|
34
|
+
*
|
|
35
|
+
* @license MIT
|
|
36
|
+
*/
|
|
37
|
+
import type { SiteRegistry } from '../registry.js';
|
|
38
|
+
import { type AnyToolDefinition } from '../../tools/tool-builder.js';
|
|
39
|
+
/**
|
|
40
|
+
* Build the W7 `yootheme_builder_sites_list` tool.
|
|
41
|
+
*
|
|
42
|
+
* Signature accepts the {@link SiteRegistry} directly — unlike other
|
|
43
|
+
* tool-builders, it does NOT need the {@link ClientPool} because it
|
|
44
|
+
* never resolves a site. Callers wire `buildSitesListTool(pool.registry)`
|
|
45
|
+
* from the W7 aggregator (`src/sites/tools/index.ts`).
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildSitesListTool(registry: SiteRegistry): AnyToolDefinition;
|
|
48
|
+
//# sourceMappingURL=sites-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sites-list.d.ts","sourceRoot":"","sources":["../../../src/sites/tools/sites-list.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAEnD,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,6BAA6B,CAAC;AA+BrC;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,YAAY,GAAG,iBAAiB,CAqE5E"}
|