@wootsup/yt-builder-mcp 1.0.0 → 1.0.1
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/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/{yootheme-builder → yt-builder-mcp}/SKILL.md +1 -1
- package/dist/auth.d.ts +0 -39
- package/dist/auth.d.ts.map +0 -1
- package/dist/auth.js +0 -93
- package/dist/auth.js.map +0 -1
- package/dist/client.d.ts +0 -84
- package/dist/client.d.ts.map +0 -1
- package/dist/client.js +0 -151
- package/dist/client.js.map +0 -1
- package/dist/clients/claude-code.d.ts +0 -18
- package/dist/clients/claude-code.d.ts.map +0 -1
- package/dist/clients/claude-code.js +0 -53
- package/dist/clients/claude-code.js.map +0 -1
- package/dist/clients/claude-desktop.d.ts +0 -19
- package/dist/clients/claude-desktop.d.ts.map +0 -1
- package/dist/clients/claude-desktop.js +0 -56
- package/dist/clients/claude-desktop.js.map +0 -1
- package/dist/clients/cline.d.ts +0 -26
- package/dist/clients/cline.d.ts.map +0 -1
- package/dist/clients/cline.js +0 -80
- package/dist/clients/cline.js.map +0 -1
- package/dist/clients/codex-cli.d.ts +0 -42
- package/dist/clients/codex-cli.d.ts.map +0 -1
- package/dist/clients/codex-cli.js +0 -194
- package/dist/clients/codex-cli.js.map +0 -1
- package/dist/clients/continue.d.ts +0 -13
- package/dist/clients/continue.d.ts.map +0 -1
- package/dist/clients/continue.js +0 -52
- package/dist/clients/continue.js.map +0 -1
- package/dist/clients/cursor.d.ts +0 -12
- package/dist/clients/cursor.d.ts.map +0 -1
- package/dist/clients/cursor.js +0 -38
- package/dist/clients/cursor.js.map +0 -1
- package/dist/clients/gemini-cli.d.ts +0 -18
- package/dist/clients/gemini-cli.d.ts.map +0 -1
- package/dist/clients/gemini-cli.js +0 -44
- package/dist/clients/gemini-cli.js.map +0 -1
- package/dist/clients/home.d.ts +0 -14
- package/dist/clients/home.d.ts.map +0 -1
- package/dist/clients/home.js +0 -20
- package/dist/clients/home.js.map +0 -1
- package/dist/clients/index.d.ts +0 -52
- package/dist/clients/index.d.ts.map +0 -1
- package/dist/clients/index.js +0 -72
- package/dist/clients/index.js.map +0 -1
- package/dist/clients/roo-code.d.ts +0 -23
- package/dist/clients/roo-code.d.ts.map +0 -1
- package/dist/clients/roo-code.js +0 -69
- package/dist/clients/roo-code.js.map +0 -1
- package/dist/clients/zed.d.ts +0 -12
- package/dist/clients/zed.d.ts.map +0 -1
- package/dist/clients/zed.js +0 -41
- package/dist/clients/zed.js.map +0 -1
- package/dist/errors/hints.d.ts +0 -51
- package/dist/errors/hints.d.ts.map +0 -1
- package/dist/errors/hints.js +0 -95
- package/dist/errors/hints.js.map +0 -1
- package/dist/errors/mask.d.ts +0 -35
- package/dist/errors/mask.d.ts.map +0 -1
- package/dist/errors/mask.js +0 -49
- package/dist/errors/mask.js.map +0 -1
- package/dist/errors/sanitize.d.ts +0 -31
- package/dist/errors/sanitize.d.ts.map +0 -1
- package/dist/errors/sanitize.js +0 -90
- package/dist/errors/sanitize.js.map +0 -1
- package/dist/errors.d.ts +0 -42
- package/dist/errors.d.ts.map +0 -1
- package/dist/errors.js +0 -61
- package/dist/errors.js.map +0 -1
- package/dist/gateway/advanced-tool/discovery.d.ts +0 -19
- package/dist/gateway/advanced-tool/discovery.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/discovery.js +0 -53
- package/dist/gateway/advanced-tool/discovery.js.map +0 -1
- package/dist/gateway/advanced-tool/domains.d.ts +0 -47
- package/dist/gateway/advanced-tool/domains.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/domains.js +0 -94
- package/dist/gateway/advanced-tool/domains.js.map +0 -1
- package/dist/gateway/advanced-tool/execute.d.ts +0 -29
- package/dist/gateway/advanced-tool/execute.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/execute.js +0 -54
- package/dist/gateway/advanced-tool/execute.js.map +0 -1
- package/dist/gateway/advanced-tool/index.d.ts +0 -36
- package/dist/gateway/advanced-tool/index.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/index.js +0 -39
- package/dist/gateway/advanced-tool/index.js.map +0 -1
- package/dist/gateway/advanced-tool/register.d.ts +0 -18
- package/dist/gateway/advanced-tool/register.d.ts.map +0 -1
- package/dist/gateway/advanced-tool/register.js +0 -69
- package/dist/gateway/advanced-tool/register.js.map +0 -1
- package/dist/gateway/advanced-tool.d.ts +0 -13
- package/dist/gateway/advanced-tool.d.ts.map +0 -1
- package/dist/gateway/advanced-tool.js +0 -13
- package/dist/gateway/advanced-tool.js.map +0 -1
- package/dist/gateway/capturing-server.d.ts +0 -117
- package/dist/gateway/capturing-server.d.ts.map +0 -1
- package/dist/gateway/capturing-server.js +0 -103
- package/dist/gateway/capturing-server.js.map +0 -1
- package/dist/gateway/essentials.d.ts +0 -49
- package/dist/gateway/essentials.d.ts.map +0 -1
- package/dist/gateway/essentials.js +0 -79
- package/dist/gateway/essentials.js.map +0 -1
- package/dist/gateway/test-support.d.ts +0 -41
- package/dist/gateway/test-support.d.ts.map +0 -1
- package/dist/gateway/test-support.js +0 -60
- package/dist/gateway/test-support.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -77
- package/dist/index.js.map +0 -1
- package/dist/install-skill.d.ts +0 -35
- package/dist/install-skill.d.ts.map +0 -1
- package/dist/install-skill.js +0 -107
- package/dist/install-skill.js.map +0 -1
- package/dist/platform/index.d.ts +0 -49
- package/dist/platform/index.d.ts.map +0 -1
- package/dist/platform/index.js +0 -38
- package/dist/platform/index.js.map +0 -1
- package/dist/server.d.ts +0 -50
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -153
- package/dist/server.js.map +0 -1
- package/dist/setup-cli.d.ts +0 -100
- package/dist/setup-cli.d.ts.map +0 -1
- package/dist/setup-cli.js +0 -355
- package/dist/setup-cli.js.map +0 -1
- package/dist/setup-prompts.d.ts +0 -41
- package/dist/setup-prompts.d.ts.map +0 -1
- package/dist/setup-prompts.js +0 -142
- package/dist/setup-prompts.js.map +0 -1
- package/dist/setup-token.d.ts +0 -38
- package/dist/setup-token.d.ts.map +0 -1
- package/dist/setup-token.js +0 -106
- package/dist/setup-token.js.map +0 -1
- package/dist/setup-wizard-defaults.d.ts +0 -43
- package/dist/setup-wizard-defaults.d.ts.map +0 -1
- package/dist/setup-wizard-defaults.js +0 -160
- package/dist/setup-wizard-defaults.js.map +0 -1
- package/dist/setup-wizard-handshake.d.ts +0 -25
- package/dist/setup-wizard-handshake.d.ts.map +0 -1
- package/dist/setup-wizard-handshake.js +0 -103
- package/dist/setup-wizard-handshake.js.map +0 -1
- package/dist/setup-wizard-types.d.ts +0 -148
- package/dist/setup-wizard-types.d.ts.map +0 -1
- package/dist/setup-wizard-types.js +0 -11
- package/dist/setup-wizard-types.js.map +0 -1
- package/dist/setup-wizard.d.ts +0 -33
- package/dist/setup-wizard.d.ts.map +0 -1
- package/dist/setup-wizard.js +0 -166
- package/dist/setup-wizard.js.map +0 -1
- package/dist/setup.d.ts +0 -17
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -33
- package/dist/setup.js.map +0 -1
- package/dist/skill-loader.d.ts +0 -51
- package/dist/skill-loader.d.ts.map +0 -1
- package/dist/skill-loader.js +0 -78
- package/dist/skill-loader.js.map +0 -1
- package/dist/tools/elements/builders.d.ts +0 -24
- package/dist/tools/elements/builders.d.ts.map +0 -1
- package/dist/tools/elements/builders.js +0 -177
- package/dist/tools/elements/builders.js.map +0 -1
- package/dist/tools/elements/handlers-write.d.ts +0 -49
- package/dist/tools/elements/handlers-write.d.ts.map +0 -1
- package/dist/tools/elements/handlers-write.js +0 -148
- package/dist/tools/elements/handlers-write.js.map +0 -1
- package/dist/tools/elements/handlers.d.ts +0 -61
- package/dist/tools/elements/handlers.d.ts.map +0 -1
- package/dist/tools/elements/handlers.js +0 -170
- package/dist/tools/elements/handlers.js.map +0 -1
- package/dist/tools/elements/index.d.ts +0 -28
- package/dist/tools/elements/index.d.ts.map +0 -1
- package/dist/tools/elements/index.js +0 -27
- package/dist/tools/elements/index.js.map +0 -1
- package/dist/tools/elements.d.ts +0 -13
- package/dist/tools/elements.d.ts.map +0 -1
- package/dist/tools/elements.js +0 -13
- package/dist/tools/elements.js.map +0 -1
- package/dist/tools/elicitation.d.ts +0 -87
- package/dist/tools/elicitation.d.ts.map +0 -1
- package/dist/tools/elicitation.js +0 -100
- package/dist/tools/elicitation.js.map +0 -1
- package/dist/tools/format/elements-format.d.ts +0 -40
- package/dist/tools/format/elements-format.d.ts.map +0 -1
- package/dist/tools/format/elements-format.js +0 -194
- package/dist/tools/format/elements-format.js.map +0 -1
- package/dist/tools/format/health-format.d.ts +0 -73
- package/dist/tools/format/health-format.d.ts.map +0 -1
- package/dist/tools/format/health-format.js +0 -178
- package/dist/tools/format/health-format.js.map +0 -1
- package/dist/tools/format/inspection-format.d.ts +0 -58
- package/dist/tools/format/inspection-format.d.ts.map +0 -1
- package/dist/tools/format/inspection-format.js +0 -164
- package/dist/tools/format/inspection-format.js.map +0 -1
- package/dist/tools/format/pages-format.d.ts +0 -42
- package/dist/tools/format/pages-format.d.ts.map +0 -1
- package/dist/tools/format/pages-format.js +0 -113
- package/dist/tools/format/pages-format.js.map +0 -1
- package/dist/tools/format/sources-format.d.ts +0 -25
- package/dist/tools/format/sources-format.d.ts.map +0 -1
- package/dist/tools/format/sources-format.js +0 -208
- package/dist/tools/format/sources-format.js.map +0 -1
- package/dist/tools/health.d.ts +0 -22
- package/dist/tools/health.d.ts.map +0 -1
- package/dist/tools/health.js +0 -147
- package/dist/tools/health.js.map +0 -1
- package/dist/tools/index.d.ts +0 -23
- package/dist/tools/index.d.ts.map +0 -1
- package/dist/tools/index.js +0 -25
- package/dist/tools/index.js.map +0 -1
- package/dist/tools/inspection.d.ts +0 -14
- package/dist/tools/inspection.d.ts.map +0 -1
- package/dist/tools/inspection.js +0 -125
- package/dist/tools/inspection.js.map +0 -1
- package/dist/tools/layout-flatten.d.ts +0 -75
- package/dist/tools/layout-flatten.d.ts.map +0 -1
- package/dist/tools/layout-flatten.js +0 -107
- package/dist/tools/layout-flatten.js.map +0 -1
- package/dist/tools/multi-items/builders.d.ts +0 -23
- package/dist/tools/multi-items/builders.d.ts.map +0 -1
- package/dist/tools/multi-items/builders.js +0 -56
- package/dist/tools/multi-items/builders.js.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.d.ts +0 -28
- package/dist/tools/multi-items/clean-implode-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/clean-implode-handler.js +0 -40
- package/dist/tools/multi-items/clean-implode-handler.js.map +0 -1
- package/dist/tools/multi-items/index.d.ts +0 -18
- package/dist/tools/multi-items/index.d.ts.map +0 -1
- package/dist/tools/multi-items/index.js +0 -18
- package/dist/tools/multi-items/index.js.map +0 -1
- package/dist/tools/multi-items/inspect-handler.d.ts +0 -41
- package/dist/tools/multi-items/inspect-handler.d.ts.map +0 -1
- package/dist/tools/multi-items/inspect-handler.js +0 -50
- package/dist/tools/multi-items/inspect-handler.js.map +0 -1
- package/dist/tools/multi-items/item-container-map.d.ts +0 -41
- package/dist/tools/multi-items/item-container-map.d.ts.map +0 -1
- package/dist/tools/multi-items/item-container-map.js +0 -73
- package/dist/tools/multi-items/item-container-map.js.map +0 -1
- package/dist/tools/pages/builders.d.ts +0 -14
- package/dist/tools/pages/builders.d.ts.map +0 -1
- package/dist/tools/pages/builders.js +0 -115
- package/dist/tools/pages/builders.js.map +0 -1
- package/dist/tools/pages/handlers-read.d.ts +0 -33
- package/dist/tools/pages/handlers-read.d.ts.map +0 -1
- package/dist/tools/pages/handlers-read.js +0 -161
- package/dist/tools/pages/handlers-read.js.map +0 -1
- package/dist/tools/pages/handlers-write.d.ts +0 -21
- package/dist/tools/pages/handlers-write.d.ts.map +0 -1
- package/dist/tools/pages/handlers-write.js +0 -52
- package/dist/tools/pages/handlers-write.js.map +0 -1
- package/dist/tools/pages/index.d.ts +0 -17
- package/dist/tools/pages/index.d.ts.map +0 -1
- package/dist/tools/pages/index.js +0 -17
- package/dist/tools/pages/index.js.map +0 -1
- package/dist/tools/pages/schemas.d.ts +0 -30
- package/dist/tools/pages/schemas.d.ts.map +0 -1
- package/dist/tools/pages/schemas.js +0 -30
- package/dist/tools/pages/schemas.js.map +0 -1
- package/dist/tools/pages.d.ts +0 -13
- package/dist/tools/pages.d.ts.map +0 -1
- package/dist/tools/pages.js +0 -13
- package/dist/tools/pages.js.map +0 -1
- package/dist/tools/progress-phases.d.ts +0 -46
- package/dist/tools/progress-phases.d.ts.map +0 -1
- package/dist/tools/progress-phases.js +0 -48
- package/dist/tools/progress-phases.js.map +0 -1
- package/dist/tools/shared-schemas.d.ts +0 -15
- package/dist/tools/shared-schemas.d.ts.map +0 -1
- package/dist/tools/shared-schemas.js +0 -30
- package/dist/tools/shared-schemas.js.map +0 -1
- package/dist/tools/sources/builders.d.ts +0 -13
- package/dist/tools/sources/builders.d.ts.map +0 -1
- package/dist/tools/sources/builders.js +0 -103
- package/dist/tools/sources/builders.js.map +0 -1
- package/dist/tools/sources/handlers-bind.d.ts +0 -28
- package/dist/tools/sources/handlers-bind.d.ts.map +0 -1
- package/dist/tools/sources/handlers-bind.js +0 -129
- package/dist/tools/sources/handlers-bind.js.map +0 -1
- package/dist/tools/sources/handlers.d.ts +0 -45
- package/dist/tools/sources/handlers.d.ts.map +0 -1
- package/dist/tools/sources/handlers.js +0 -91
- package/dist/tools/sources/handlers.js.map +0 -1
- package/dist/tools/sources/index.d.ts +0 -19
- package/dist/tools/sources/index.d.ts.map +0 -1
- package/dist/tools/sources/index.js +0 -18
- package/dist/tools/sources/index.js.map +0 -1
- package/dist/tools/sources.d.ts +0 -14
- package/dist/tools/sources.d.ts.map +0 -1
- package/dist/tools/sources.js +0 -14
- package/dist/tools/sources.js.map +0 -1
- package/dist/tools/sparse-fields.d.ts +0 -80
- package/dist/tools/sparse-fields.d.ts.map +0 -1
- package/dist/tools/sparse-fields.js +0 -144
- package/dist/tools/sparse-fields.js.map +0 -1
- package/dist/tools/tool-builder/annotations.d.ts +0 -55
- package/dist/tools/tool-builder/annotations.d.ts.map +0 -1
- package/dist/tools/tool-builder/annotations.js +0 -86
- package/dist/tools/tool-builder/annotations.js.map +0 -1
- package/dist/tools/tool-builder/define.d.ts +0 -31
- package/dist/tools/tool-builder/define.d.ts.map +0 -1
- package/dist/tools/tool-builder/define.js +0 -31
- package/dist/tools/tool-builder/define.js.map +0 -1
- package/dist/tools/tool-builder/index.d.ts +0 -28
- package/dist/tools/tool-builder/index.d.ts.map +0 -1
- package/dist/tools/tool-builder/index.js +0 -27
- package/dist/tools/tool-builder/index.js.map +0 -1
- package/dist/tools/tool-builder/results.d.ts +0 -59
- package/dist/tools/tool-builder/results.d.ts.map +0 -1
- package/dist/tools/tool-builder/results.js +0 -125
- package/dist/tools/tool-builder/results.js.map +0 -1
- package/dist/tools/tool-builder/types.d.ts +0 -82
- package/dist/tools/tool-builder/types.d.ts.map +0 -1
- package/dist/tools/tool-builder/types.js +0 -9
- package/dist/tools/tool-builder/types.js.map +0 -1
- package/dist/tools/tool-builder.d.ts +0 -16
- package/dist/tools/tool-builder.d.ts.map +0 -1
- package/dist/tools/tool-builder.js +0 -16
- package/dist/tools/tool-builder.js.map +0 -1
package/dist/tools/health.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Health & diagnostics tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_health
|
|
5
|
-
* → GET /health (unauthenticated). Verifies the plugin is
|
|
6
|
-
* installed and reachable. Returns plugin/YT/WP/PHP versions
|
|
7
|
-
* + available endpoints.
|
|
8
|
-
*
|
|
9
|
-
* yootheme_builder_diagnose
|
|
10
|
-
* → Aggregates health + a Bearer-auth probe so the agent can
|
|
11
|
-
* distinguish "plugin missing" from "wrong key".
|
|
12
|
-
*
|
|
13
|
-
* Both tools emit `detailResult` (Wave G.2) so hosts that support
|
|
14
|
-
* structured content render a Detail-Card; the LLM still reads the text
|
|
15
|
-
* leg from `content[0].text`.
|
|
16
|
-
*
|
|
17
|
-
* @license MIT
|
|
18
|
-
*/
|
|
19
|
-
import type { RestClient } from '../client.js';
|
|
20
|
-
import { type AnyToolDefinition } from './tool-builder.js';
|
|
21
|
-
export declare function buildHealthTools(client: RestClient): readonly AnyToolDefinition[];
|
|
22
|
-
//# sourceMappingURL=health.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,OAAO,EAMH,KAAK,iBAAiB,EACzB,MAAM,mBAAmB,CAAC;AA2B3B,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CAyGjF"}
|
package/dist/tools/health.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Health & diagnostics tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_health
|
|
5
|
-
* → GET /health (unauthenticated). Verifies the plugin is
|
|
6
|
-
* installed and reachable. Returns plugin/YT/WP/PHP versions
|
|
7
|
-
* + available endpoints.
|
|
8
|
-
*
|
|
9
|
-
* yootheme_builder_diagnose
|
|
10
|
-
* → Aggregates health + a Bearer-auth probe so the agent can
|
|
11
|
-
* distinguish "plugin missing" from "wrong key".
|
|
12
|
-
*
|
|
13
|
-
* Both tools emit `detailResult` (Wave G.2) so hosts that support
|
|
14
|
-
* structured content render a Detail-Card; the LLM still reads the text
|
|
15
|
-
* leg from `content[0].text`.
|
|
16
|
-
*
|
|
17
|
-
* @license MIT
|
|
18
|
-
*/
|
|
19
|
-
import { detailResult, statsResult } from '@getimo/mcp-toolkit';
|
|
20
|
-
import { z } from 'zod';
|
|
21
|
-
import { RestError } from '../errors.js';
|
|
22
|
-
import { buildDiagnoseDetail, buildHealthStats, } from './format/health-format.js';
|
|
23
|
-
import { defineTool, errorResult, jsonResult, readOnly, structuredResult, } from './tool-builder.js';
|
|
24
|
-
// ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
|
|
25
|
-
const HEALTH_OUTPUT_SCHEMA = z.object({
|
|
26
|
-
plugin_version: z.string(),
|
|
27
|
-
yootheme_version: z.string().nullable(),
|
|
28
|
-
wp_version: z.string().nullable(),
|
|
29
|
-
php_version: z.string(),
|
|
30
|
-
storage_type: z.string(),
|
|
31
|
-
storage_target: z.string(),
|
|
32
|
-
yootheme_loaded: z.boolean(),
|
|
33
|
-
available_endpoints: z.array(z.string()),
|
|
34
|
-
});
|
|
35
|
-
const DIAGNOSE_OUTPUT_SCHEMA = z.object({
|
|
36
|
-
plugin_reachable: z.boolean(),
|
|
37
|
-
plugin_version: z.string().optional(),
|
|
38
|
-
yootheme_loaded: z.boolean().optional(),
|
|
39
|
-
yootheme_version: z.string().nullable().optional(),
|
|
40
|
-
endpoint_count: z.number().optional(),
|
|
41
|
-
plugin_error: z.string().optional(),
|
|
42
|
-
bearer_valid: z.boolean().optional(),
|
|
43
|
-
bearer_error: z.string().optional(),
|
|
44
|
-
summary: z.string().optional(),
|
|
45
|
-
});
|
|
46
|
-
export function buildHealthTools(client) {
|
|
47
|
-
return [
|
|
48
|
-
defineTool({
|
|
49
|
-
name: 'yootheme_builder_health',
|
|
50
|
-
description: 'Check that the YT Builder MCP plugin is installed and reachable. ' +
|
|
51
|
-
'Returns plugin version, YOOtheme Pro version (if loaded), and the list of ' +
|
|
52
|
-
'available REST endpoints. Unauthenticated probe — call this first when ' +
|
|
53
|
-
'troubleshooting connectivity.',
|
|
54
|
-
inputSchema: {},
|
|
55
|
-
outputSchema: HEALTH_OUTPUT_SCHEMA,
|
|
56
|
-
annotations: readOnly('Health Check'),
|
|
57
|
-
handler: async () => {
|
|
58
|
-
try {
|
|
59
|
-
const data = await client.get('/health');
|
|
60
|
-
// Round-1 audit I1 fix: spec §3.2 row 1 calls for
|
|
61
|
-
// `statsResult` (flat metrics). Earlier shipped
|
|
62
|
-
// `detailResult` — that's a Detail-Card variant, not
|
|
63
|
-
// the stats-display the spec asked for. The flat
|
|
64
|
-
// shape is built by `buildHealthStats`.
|
|
65
|
-
const toolkitResult = statsResult(buildHealthStats(data));
|
|
66
|
-
return structuredResult(toolkitResult, {
|
|
67
|
-
plugin_version: data.plugin_version,
|
|
68
|
-
yootheme_version: data.yootheme_version,
|
|
69
|
-
wp_version: data.wp_version,
|
|
70
|
-
php_version: data.php_version,
|
|
71
|
-
storage_type: data.storage_type,
|
|
72
|
-
storage_target: data.storage_target,
|
|
73
|
-
yootheme_loaded: data.yootheme_loaded,
|
|
74
|
-
available_endpoints: data.available_endpoints,
|
|
75
|
-
});
|
|
76
|
-
}
|
|
77
|
-
catch (e) {
|
|
78
|
-
return errorResult({
|
|
79
|
-
error: e,
|
|
80
|
-
context: {},
|
|
81
|
-
hint: 'Verify YTB_MCP_WP_URL points at a WordPress site with the ' +
|
|
82
|
-
'yt-builder-mcp plugin active. Try opening ' +
|
|
83
|
-
'<wp_url>/wp-json/yt-builder-mcp/v1/health in a browser.',
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
}),
|
|
88
|
-
defineTool({
|
|
89
|
-
name: 'yootheme_builder_diagnose',
|
|
90
|
-
description: 'Run a full diagnostic: hit /health (no auth), then attempt an authenticated ' +
|
|
91
|
-
'call (/etag) to confirm the Bearer key is valid. Use when health passes but ' +
|
|
92
|
-
'tools return 401/403.',
|
|
93
|
-
inputSchema: {},
|
|
94
|
-
outputSchema: DIAGNOSE_OUTPUT_SCHEMA,
|
|
95
|
-
annotations: readOnly('Diagnose Connection'),
|
|
96
|
-
handler: async () => {
|
|
97
|
-
const checks = { plugin_reachable: false };
|
|
98
|
-
try {
|
|
99
|
-
const health = await client.get('/health');
|
|
100
|
-
checks.plugin_reachable = true;
|
|
101
|
-
checks.plugin_version = health.plugin_version;
|
|
102
|
-
checks.yootheme_loaded = health.yootheme_loaded;
|
|
103
|
-
checks.yootheme_version = health.yootheme_version;
|
|
104
|
-
checks.endpoint_count = health.available_endpoints.length;
|
|
105
|
-
}
|
|
106
|
-
catch (e) {
|
|
107
|
-
checks.plugin_reachable = false;
|
|
108
|
-
checks.plugin_error = e instanceof Error ? e.message : String(e);
|
|
109
|
-
// Plugin-unreachable path stays on jsonResult so the LLM
|
|
110
|
-
// sees the structured error hint inline (detailResult would
|
|
111
|
-
// hide the actionable "verify YTB_MCP_WP_URL" hint inside
|
|
112
|
-
// a sub-group). isError=true preserves SDK semantics.
|
|
113
|
-
return jsonResult({
|
|
114
|
-
...checks,
|
|
115
|
-
hint: 'Plugin not reachable. Verify YTB_MCP_WP_URL and that the ' +
|
|
116
|
-
'yt-builder-mcp WordPress plugin is active.',
|
|
117
|
-
}, { isError: true });
|
|
118
|
-
}
|
|
119
|
-
try {
|
|
120
|
-
await client.get('/etag');
|
|
121
|
-
checks.bearer_valid = true;
|
|
122
|
-
}
|
|
123
|
-
catch (e) {
|
|
124
|
-
checks.bearer_valid = false;
|
|
125
|
-
if (e instanceof RestError) {
|
|
126
|
-
checks.bearer_error = `HTTP ${String(e.status)}: ${e.message}`;
|
|
127
|
-
}
|
|
128
|
-
else {
|
|
129
|
-
checks.bearer_error = e instanceof Error ? e.message : String(e);
|
|
130
|
-
}
|
|
131
|
-
return jsonResult({
|
|
132
|
-
...checks,
|
|
133
|
-
hint: 'Bearer key rejected. Regenerate the key in wp-admin → Tools → ' +
|
|
134
|
-
'"YT Builder MCP" → Bearer Keys and re-run ' +
|
|
135
|
-
'`yt-builder-mcp setup`.',
|
|
136
|
-
}, { isError: true });
|
|
137
|
-
}
|
|
138
|
-
const toolkitResult = detailResult(buildDiagnoseDetail(checks));
|
|
139
|
-
return structuredResult(toolkitResult, {
|
|
140
|
-
...checks,
|
|
141
|
-
summary: 'OK — plugin reachable and Bearer key accepted.',
|
|
142
|
-
});
|
|
143
|
-
},
|
|
144
|
-
}),
|
|
145
|
-
];
|
|
146
|
-
}
|
|
147
|
-
//# sourceMappingURL=health.js.map
|
package/dist/tools/health.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"health.js","sourceRoot":"","sources":["../../src/tools/health.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EACH,mBAAmB,EACnB,gBAAgB,GAGnB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,UAAU,EACV,WAAW,EACX,UAAU,EACV,QAAQ,EACR,gBAAgB,GAEnB,MAAM,mBAAmB,CAAC;AAE3B,wEAAwE;AAExE,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,gBAAgB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACvC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACjC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE;IACvB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE;IAC1B,eAAe,EAAE,CAAC,CAAC,OAAO,EAAE;IAC5B,mBAAmB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC;CAC3C,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,gBAAgB,EAAE,CAAC,CAAC,OAAO,EAAE;IAC7B,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC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
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool aggregator — collects all domain tools into a single list.
|
|
3
|
-
* The MCP server iterates this list at startup to register handlers
|
|
4
|
-
* with `@modelcontextprotocol/sdk`.
|
|
5
|
-
*
|
|
6
|
-
* @license MIT
|
|
7
|
-
*/
|
|
8
|
-
import type { RestClient } from '../client.js';
|
|
9
|
-
import type { McpServerWithElicitation } from './elicitation.js';
|
|
10
|
-
import type { AnyToolDefinition } from './tool-builder.js';
|
|
11
|
-
export interface BuildAllToolsOptions {
|
|
12
|
-
/**
|
|
13
|
-
* Optional MCP elicitation capability — see
|
|
14
|
-
* `src/tools/elicitation.ts` for the adapter. When supplied,
|
|
15
|
-
* destructive + ambiguity-resolution tools prompt the user via the
|
|
16
|
-
* elicitation channel; when omitted, they fall back to the
|
|
17
|
-
* preview-then-retry / `ambiguityFallbackError` flow.
|
|
18
|
-
*/
|
|
19
|
-
readonly elicitation?: McpServerWithElicitation;
|
|
20
|
-
}
|
|
21
|
-
export declare function buildAllTools(client: RestClient, options?: BuildAllToolsOptions): readonly AnyToolDefinition[];
|
|
22
|
-
export type { AnyToolDefinition, ToolDefinition } from './tool-builder.js';
|
|
23
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAMjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAE3D,MAAM,WAAW,oBAAoB;IACjC;;;;;;OAMG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,wBAAwB,CAAC;CACnD;AAED,wBAAgB,aAAa,CACzB,MAAM,EAAE,UAAU,EAClB,OAAO,GAAE,oBAAyB,GACnC,SAAS,iBAAiB,EAAE,CAU9B;AAED,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/tools/index.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Tool aggregator — collects all domain tools into a single list.
|
|
3
|
-
* The MCP server iterates this list at startup to register handlers
|
|
4
|
-
* with `@modelcontextprotocol/sdk`.
|
|
5
|
-
*
|
|
6
|
-
* @license MIT
|
|
7
|
-
*/
|
|
8
|
-
import { buildElementsTools } from './elements/index.js';
|
|
9
|
-
import { buildHealthTools } from './health.js';
|
|
10
|
-
import { buildInspectionTools } from './inspection.js';
|
|
11
|
-
import { buildMultiItemsTools } from './multi-items/index.js';
|
|
12
|
-
import { buildPagesTools } from './pages.js';
|
|
13
|
-
import { buildSourcesTools } from './sources/index.js';
|
|
14
|
-
export function buildAllTools(client, options = {}) {
|
|
15
|
-
const deps = options.elicitation !== undefined ? { elicitation: options.elicitation } : {};
|
|
16
|
-
return [
|
|
17
|
-
...buildHealthTools(client),
|
|
18
|
-
...buildPagesTools(client),
|
|
19
|
-
...buildElementsTools(client, deps),
|
|
20
|
-
...buildSourcesTools(client, deps),
|
|
21
|
-
...buildMultiItemsTools(client),
|
|
22
|
-
...buildInspectionTools(client),
|
|
23
|
-
];
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=index.js.map
|
package/dist/tools/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAcvD,MAAM,UAAU,aAAa,CACzB,MAAkB,EAClB,UAAgC,EAAE;IAElC,MAAM,IAAI,GAAG,OAAO,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC3F,OAAO;QACH,GAAG,gBAAgB,CAAC,MAAM,CAAC;QAC3B,GAAG,eAAe,CAAC,MAAM,CAAC;QAC1B,GAAG,kBAAkB,CAAC,MAAM,EAAE,IAAI,CAAC;QACnC,GAAG,iBAAiB,CAAC,MAAM,EAAE,IAAI,CAAC;QAClC,GAAG,oBAAoB,CAAC,MAAM,CAAC;QAC/B,GAAG,oBAAoB,CAAC,MAAM,CAAC;KAClC,CAAC;AACN,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-type inspection tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_element_types_list
|
|
5
|
-
* → catalogue of available element types (tableResult — Wave G.2)
|
|
6
|
-
* yootheme_builder_element_type_get_schema
|
|
7
|
-
* → field schema for a single element type (detailResult — Wave G.2)
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import type { RestClient } from '../client.js';
|
|
12
|
-
import { type AnyToolDefinition } from './tool-builder.js';
|
|
13
|
-
export declare function buildInspectionTools(client: RestClient): readonly AnyToolDefinition[];
|
|
14
|
-
//# sourceMappingURL=inspection.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspection.d.ts","sourceRoot":"","sources":["../../src/tools/inspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAQ/C,OAAO,EAKH,KAAK,iBAAiB,EACzB,MAAM,mBAAmB,CAAC;AA2B3B,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CAsGrF"}
|
package/dist/tools/inspection.js
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Element-type inspection tools.
|
|
3
|
-
*
|
|
4
|
-
* yootheme_builder_element_types_list
|
|
5
|
-
* → catalogue of available element types (tableResult — Wave G.2)
|
|
6
|
-
* yootheme_builder_element_type_get_schema
|
|
7
|
-
* → field schema for a single element type (detailResult — Wave G.2)
|
|
8
|
-
*
|
|
9
|
-
* @license MIT
|
|
10
|
-
*/
|
|
11
|
-
import { detailResult, tableResult } from '@getimo/mcp-toolkit';
|
|
12
|
-
import { z } from 'zod';
|
|
13
|
-
import { TYPES_COMPACT_COLUMNS, TYPES_TABLE_COLUMNS, buildTypeSchemaDetail, flattenTypesPayload, mapTypeRow, } from './format/inspection-format.js';
|
|
14
|
-
import { defineTool, errorResult, readOnly, structuredResult, } from './tool-builder.js';
|
|
15
|
-
import { DEFAULT_FIELDS_TYPES_LIST, FIELDS, projectFields, projectedFieldsEcho, } from './sparse-fields.js';
|
|
16
|
-
// ─── outputSchemas (Wave G.2 §4) ─────────────────────────────────────
|
|
17
|
-
const TYPES_LIST_OUTPUT_SCHEMA = z.object({
|
|
18
|
-
items: z.array(z.record(z.string(), z.unknown())),
|
|
19
|
-
total: z.number(),
|
|
20
|
-
projected_fields: z.array(z.string()).optional(),
|
|
21
|
-
});
|
|
22
|
-
const TYPE_SCHEMA_OUTPUT_SCHEMA = z.object({
|
|
23
|
-
name: z.string(),
|
|
24
|
-
label: z.string().optional(),
|
|
25
|
-
origin: z.string().optional(),
|
|
26
|
-
// The REST endpoint returns `fields` as a list of {name,type,label?}
|
|
27
|
-
// field descriptors — each `name` is a valid prop key for element_add /
|
|
28
|
-
// _update_settings.
|
|
29
|
-
fields: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
30
|
-
field_count: z.number(),
|
|
31
|
-
});
|
|
32
|
-
export function buildInspectionTools(client) {
|
|
33
|
-
return [
|
|
34
|
-
defineTool({
|
|
35
|
-
name: 'yootheme_builder_element_types_list',
|
|
36
|
-
description: 'List element types registered on this site (built-ins + ' +
|
|
37
|
-
'YOOessentials/uEssentials extras). Names feed `element_type` of ' +
|
|
38
|
-
'element_add. Pass `fields[]` to narrow each row.',
|
|
39
|
-
inputSchema: {
|
|
40
|
-
fields: FIELDS,
|
|
41
|
-
},
|
|
42
|
-
outputSchema: TYPES_LIST_OUTPUT_SCHEMA,
|
|
43
|
-
annotations: readOnly('List Element Types'),
|
|
44
|
-
handler: async ({ fields }) => {
|
|
45
|
-
try {
|
|
46
|
-
const data = await client.get('/element-types');
|
|
47
|
-
const flat = flattenTypesPayload(data);
|
|
48
|
-
const mapped = flat.map(mapTypeRow);
|
|
49
|
-
const mappedRecords = mapped;
|
|
50
|
-
const items = projectFields(mappedRecords, fields, DEFAULT_FIELDS_TYPES_LIST);
|
|
51
|
-
const echo = projectedFieldsEcho(fields, DEFAULT_FIELDS_TYPES_LIST);
|
|
52
|
-
const toolkitResult = tableResult(mappedRecords, {
|
|
53
|
-
columns: [...TYPES_TABLE_COLUMNS],
|
|
54
|
-
compactColumns: [...TYPES_COMPACT_COLUMNS],
|
|
55
|
-
header: (count) => `${String(count)} element types`,
|
|
56
|
-
footer: 'Use yootheme_builder_element_type_get_schema <name> for fields.',
|
|
57
|
-
});
|
|
58
|
-
return structuredResult(toolkitResult, {
|
|
59
|
-
items,
|
|
60
|
-
total: items.length,
|
|
61
|
-
...(echo !== undefined ? { projected_fields: [...echo] } : {}),
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
catch (e) {
|
|
65
|
-
return errorResult({
|
|
66
|
-
error: e,
|
|
67
|
-
context: {},
|
|
68
|
-
hint: 'Run yootheme_builder_diagnose to verify auth.',
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
}),
|
|
73
|
-
defineTool({
|
|
74
|
-
name: 'yootheme_builder_element_type_get_schema',
|
|
75
|
-
description: 'Get the prop/field schema for a single element type. Use the result to discover ' +
|
|
76
|
-
'valid keys for `props` when calling yootheme_builder_element_add or ' +
|
|
77
|
-
'_update_settings.',
|
|
78
|
-
inputSchema: {
|
|
79
|
-
type_name: z
|
|
80
|
-
.string()
|
|
81
|
-
.min(1)
|
|
82
|
-
.describe('Element type name (e.g. "headline", "text", "grid"). Use ' +
|
|
83
|
-
'yootheme_builder_element_types_list to discover.'),
|
|
84
|
-
},
|
|
85
|
-
outputSchema: TYPE_SCHEMA_OUTPUT_SCHEMA,
|
|
86
|
-
annotations: readOnly('Get Element Type Schema'),
|
|
87
|
-
handler: async ({ type_name }) => {
|
|
88
|
-
try {
|
|
89
|
-
const data = await client.get(`/element-types/${encodeURIComponent(type_name)}/schema`);
|
|
90
|
-
// The REST endpoint nests the type schema under `schema`:
|
|
91
|
-
// {type_name, schema:{name,label,origin,has_children,fields:[…]}}.
|
|
92
|
-
// Fall back to the top-level object for older backends.
|
|
93
|
-
const schema = data.schema !== null && typeof data.schema === 'object'
|
|
94
|
-
? data.schema
|
|
95
|
-
: data;
|
|
96
|
-
const name = typeof schema.name === 'string' ? schema.name : type_name;
|
|
97
|
-
const label = typeof schema.label === 'string' ? schema.label : undefined;
|
|
98
|
-
const origin = typeof schema.origin === 'string' ? schema.origin : undefined;
|
|
99
|
-
// `fields` is a list of {name,type,label?} field descriptors.
|
|
100
|
-
const fields = Array.isArray(schema.fields)
|
|
101
|
-
? schema.fields
|
|
102
|
-
: undefined;
|
|
103
|
-
const fieldCount = fields !== undefined ? fields.length : 0;
|
|
104
|
-
const toolkitResult = detailResult(buildTypeSchemaDetail({ name, label, origin, fields }));
|
|
105
|
-
return structuredResult(toolkitResult, {
|
|
106
|
-
name,
|
|
107
|
-
...(label !== undefined ? { label } : {}),
|
|
108
|
-
...(origin !== undefined ? { origin } : {}),
|
|
109
|
-
...(fields !== undefined ? { fields } : {}),
|
|
110
|
-
field_count: fieldCount,
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
catch (e) {
|
|
114
|
-
return errorResult({
|
|
115
|
-
error: e,
|
|
116
|
-
context: { type_name },
|
|
117
|
-
hint: 'Verify type_name via yootheme_builder_element_types_list — names ' +
|
|
118
|
-
'are case-sensitive.',
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
}),
|
|
123
|
-
];
|
|
124
|
-
}
|
|
125
|
-
//# sourceMappingURL=inspection.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inspection.js","sourceRoot":"","sources":["../../src/tools/inspection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACH,qBAAqB,EACrB,mBAAmB,EACnB,qBAAqB,EACrB,mBAAmB,EACnB,UAAU,GACb,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,UAAU,EACV,WAAW,EACX,QAAQ,EACR,gBAAgB,GAEnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACH,yBAAyB,EACzB,MAAM,EACN,aAAa,EACb,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAE5B,wEAAwE;AAExE,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IACjD,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,gBAAgB,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACnD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,CAAC,EAAE,CAAC;wBAC3C,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;wBAC3C,WAAW,EAAE,UAAU;qBAC1B,CAAC,CAAC;gBACP,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,OAAO,WAAW,CAAC;wBACf,KAAK,EAAE,CAAC;wBACR,OAAO,EAAE,EAAE,SAAS,EAAE;wBACtB,IAAI,EACA,mEAAmE;4BACnE,qBAAqB;qBAC5B,CAAC,CAAC;gBACP,CAAC;YACL,CAAC;SACJ,CAAC;KACL,CAAC;AACN,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Layout-flatten helper — depth-first walk that turns a nested YOOtheme
|
|
3
|
-
* layout tree into a flat array of `{ path, parent_path, depth,
|
|
4
|
-
* element_type, props }` records.
|
|
5
|
-
*
|
|
6
|
-
* Used by `yootheme_builder_page_get_layout` when called with
|
|
7
|
-
* `flat: true`. Per Design §4.4.1:
|
|
8
|
-
*
|
|
9
|
-
* - Walk-order: depth-first, parent BEFORE children, original child
|
|
10
|
-
* order preserved (no sort).
|
|
11
|
-
* - `path` uses JSON-Pointer-style notation rooted at `/layout/<key>`
|
|
12
|
-
* and descends via `/children/<index>` segments. The root segments
|
|
13
|
-
* mirror the keys the REST plugin produces (string keys "0","1",…
|
|
14
|
-
* when the top-level layout is an object; numeric indices when it
|
|
15
|
-
* happens to be an array).
|
|
16
|
-
* - `parent_path` is `null` for top-level entries.
|
|
17
|
-
* - The emitted record's `children` field is REMOVED — children become
|
|
18
|
-
* their own emitted entries with their own `path`. Keeping the nested
|
|
19
|
-
* array would defeat the purpose of flattening.
|
|
20
|
-
* - Non-object children are skipped silently but their index is
|
|
21
|
-
* preserved in the parent's child-numbering (the next valid sibling
|
|
22
|
-
* keeps its original index).
|
|
23
|
-
*
|
|
24
|
-
* Pure function — no I/O, no client dependency. Test-covered in
|
|
25
|
-
* `tests/tools/layout-flatten.test.ts`.
|
|
26
|
-
*
|
|
27
|
-
* @license MIT
|
|
28
|
-
*/
|
|
29
|
-
/** A single emitted record in the flattened layout. */
|
|
30
|
-
export interface FlatElement {
|
|
31
|
-
/** JSON-Pointer-style path, e.g. "/layout/0/children/2". */
|
|
32
|
-
path: string;
|
|
33
|
-
/**
|
|
34
|
-
* Path with the `/layout` prefix stripped, e.g. "/0/children/2".
|
|
35
|
-
* N-01 (Audit v4): mirrors the `rel_path` column element_list emits
|
|
36
|
-
* so `fields:["rel_path",...]` projection works on the flat layout.
|
|
37
|
-
*/
|
|
38
|
-
rel_path: string;
|
|
39
|
-
/** Path of the parent element, or `null` for top-level entries. */
|
|
40
|
-
parent_path: string | null;
|
|
41
|
-
/** 0-based depth (top-level entries have depth 0). */
|
|
42
|
-
depth: number;
|
|
43
|
-
/** Element type string (the `type` field on the YT node, "" if missing). */
|
|
44
|
-
element_type: string;
|
|
45
|
-
/**
|
|
46
|
-
* True iff the node carries a source-binding. N-01 (Audit v4):
|
|
47
|
-
* derived via the same `hasSourceBinding` SSoT element_list uses,
|
|
48
|
-
* or an explicit REST-plugin boolean when present.
|
|
49
|
-
*/
|
|
50
|
-
has_binding: boolean;
|
|
51
|
-
/** Element props (passthrough; `undefined` when the node has none). */
|
|
52
|
-
props?: Record<string, unknown>;
|
|
53
|
-
/**
|
|
54
|
-
* Children intentionally absent — see file-header. Kept in the type
|
|
55
|
-
* so consumers can confirm the field is `undefined` rather than
|
|
56
|
-
* assume it exists.
|
|
57
|
-
*/
|
|
58
|
-
children?: undefined;
|
|
59
|
-
/**
|
|
60
|
-
* Allow passthrough of any other top-level fields the REST plugin
|
|
61
|
-
* may add in future (e.g. `label`, `has_binding`, `name`). The
|
|
62
|
-
* walker preserves these verbatim so projection via `pickFields`
|
|
63
|
-
* downstream stays meaningful.
|
|
64
|
-
*/
|
|
65
|
-
[extra: string]: unknown;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Flatten a YOOtheme nested layout tree.
|
|
69
|
-
*
|
|
70
|
-
* @param layout - The top-level layout container. Accepts either an
|
|
71
|
-
* object keyed by stringified indices ("0","1",…) or an actual array.
|
|
72
|
-
* Returns `[]` for empty input or anything that isn't iterable.
|
|
73
|
-
*/
|
|
74
|
-
export declare function flattenLayout(layout: unknown): FlatElement[];
|
|
75
|
-
//# sourceMappingURL=layout-flatten.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-flatten.d.ts","sourceRoot":"","sources":["../../src/tools/layout-flatten.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAIH,uDAAuD;AACvD,MAAM,WAAW,WAAW;IACxB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,mEAAmE;IACnE,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sDAAsD;IACtD,KAAK,EAAE,MAAM,CAAC;IACd,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB;;;;;OAKG;IACH,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,WAAW,EAAE,CAmB5D"}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Layout-flatten helper — depth-first walk that turns a nested YOOtheme
|
|
3
|
-
* layout tree into a flat array of `{ path, parent_path, depth,
|
|
4
|
-
* element_type, props }` records.
|
|
5
|
-
*
|
|
6
|
-
* Used by `yootheme_builder_page_get_layout` when called with
|
|
7
|
-
* `flat: true`. Per Design §4.4.1:
|
|
8
|
-
*
|
|
9
|
-
* - Walk-order: depth-first, parent BEFORE children, original child
|
|
10
|
-
* order preserved (no sort).
|
|
11
|
-
* - `path` uses JSON-Pointer-style notation rooted at `/layout/<key>`
|
|
12
|
-
* and descends via `/children/<index>` segments. The root segments
|
|
13
|
-
* mirror the keys the REST plugin produces (string keys "0","1",…
|
|
14
|
-
* when the top-level layout is an object; numeric indices when it
|
|
15
|
-
* happens to be an array).
|
|
16
|
-
* - `parent_path` is `null` for top-level entries.
|
|
17
|
-
* - The emitted record's `children` field is REMOVED — children become
|
|
18
|
-
* their own emitted entries with their own `path`. Keeping the nested
|
|
19
|
-
* array would defeat the purpose of flattening.
|
|
20
|
-
* - Non-object children are skipped silently but their index is
|
|
21
|
-
* preserved in the parent's child-numbering (the next valid sibling
|
|
22
|
-
* keeps its original index).
|
|
23
|
-
*
|
|
24
|
-
* Pure function — no I/O, no client dependency. Test-covered in
|
|
25
|
-
* `tests/tools/layout-flatten.test.ts`.
|
|
26
|
-
*
|
|
27
|
-
* @license MIT
|
|
28
|
-
*/
|
|
29
|
-
import { hasSourceBinding } from './format/elements-format.js';
|
|
30
|
-
/**
|
|
31
|
-
* Flatten a YOOtheme nested layout tree.
|
|
32
|
-
*
|
|
33
|
-
* @param layout - The top-level layout container. Accepts either an
|
|
34
|
-
* object keyed by stringified indices ("0","1",…) or an actual array.
|
|
35
|
-
* Returns `[]` for empty input or anything that isn't iterable.
|
|
36
|
-
*/
|
|
37
|
-
export function flattenLayout(layout) {
|
|
38
|
-
const out = [];
|
|
39
|
-
if (layout === null || typeof layout !== 'object') {
|
|
40
|
-
return out;
|
|
41
|
-
}
|
|
42
|
-
// Iterate top-level entries in insertion order. For arrays this gives
|
|
43
|
-
// numeric indices; for objects keyed by "0","1",… it gives the same
|
|
44
|
-
// ordering YT serialises.
|
|
45
|
-
const entries = Array.isArray(layout)
|
|
46
|
-
? layout.map((v, i) => [String(i), v])
|
|
47
|
-
: Object.entries(layout);
|
|
48
|
-
for (const [key, node] of entries) {
|
|
49
|
-
walk(node, `/layout/${key}`, null, 0, out);
|
|
50
|
-
}
|
|
51
|
-
return out;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Depth-first walker. Emits the node, then recurses into its children.
|
|
55
|
-
* Skips non-object nodes silently while preserving child-index numbering.
|
|
56
|
-
*/
|
|
57
|
-
function walk(node, path, parentPath, depth, out) {
|
|
58
|
-
if (node === null || typeof node !== 'object' || Array.isArray(node)) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
const obj = node;
|
|
62
|
-
const elementType = typeof obj.type === 'string' ? obj.type : '';
|
|
63
|
-
const props = obj.props !== null && typeof obj.props === 'object' && !Array.isArray(obj.props)
|
|
64
|
-
? obj.props
|
|
65
|
-
: undefined;
|
|
66
|
-
// N-01: derive the projection-relevant fields up-front so a
|
|
67
|
-
// `fields:["rel_path","has_binding",...]` projection finds them.
|
|
68
|
-
// `rel_path` strips the `/layout` prefix; `has_binding` honours an
|
|
69
|
-
// explicit REST boolean else derives via the shared SSoT.
|
|
70
|
-
const relPath = path.replace(/^\/layout/, '') || '/';
|
|
71
|
-
const hasBinding = typeof obj.has_binding === 'boolean'
|
|
72
|
-
? obj.has_binding
|
|
73
|
-
: hasSourceBinding(obj);
|
|
74
|
-
// Build a passthrough shallow-clone WITHOUT the children field. We
|
|
75
|
-
// copy every other top-level key so future REST additions (label,
|
|
76
|
-
// …) survive the flatten.
|
|
77
|
-
const emitted = {
|
|
78
|
-
path,
|
|
79
|
-
rel_path: relPath,
|
|
80
|
-
parent_path: parentPath,
|
|
81
|
-
depth,
|
|
82
|
-
element_type: elementType,
|
|
83
|
-
has_binding: hasBinding,
|
|
84
|
-
};
|
|
85
|
-
for (const [k, v] of Object.entries(obj)) {
|
|
86
|
-
if (k === 'children' || k === 'type' || k === 'props' || k === 'has_binding') {
|
|
87
|
-
continue;
|
|
88
|
-
}
|
|
89
|
-
emitted[k] = v;
|
|
90
|
-
}
|
|
91
|
-
if (props !== undefined)
|
|
92
|
-
emitted.props = props;
|
|
93
|
-
out.push(emitted);
|
|
94
|
-
const children = obj.children;
|
|
95
|
-
if (Array.isArray(children)) {
|
|
96
|
-
for (let i = 0; i < children.length; i++) {
|
|
97
|
-
const child = children[i];
|
|
98
|
-
if (child === null || typeof child !== 'object' || Array.isArray(child)) {
|
|
99
|
-
// Skip non-object children; their index is preserved in
|
|
100
|
-
// the next sibling's path.
|
|
101
|
-
continue;
|
|
102
|
-
}
|
|
103
|
-
walk(child, `${path}/children/${String(i)}`, path, depth + 1, out);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
//# sourceMappingURL=layout-flatten.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout-flatten.js","sourceRoot":"","sources":["../../src/tools/layout-flatten.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAyC/D;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,MAAe;IACzC,MAAM,GAAG,GAAkB,EAAE,CAAC;IAE9B,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;QAChD,OAAO,GAAG,CAAC;IACf,CAAC;IAED,sEAAsE;IACtE,oEAAoE;IACpE,0BAA0B;IAC1B,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QACjC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QACzD,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAiC,CAAC,CAAC;IAExD,KAAK,MAAM,CAAC,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T-Pro Multi-Items binding
|
|
5
|
-
* pattern (container ↔ `*_item` pairings — see
|
|
6
|
-
* `./item-container-map.ts`):
|
|
7
|
-
*
|
|
8
|
-
* yootheme_builder_inspect_multi_items_binding
|
|
9
|
-
* → Reports the binding level (none/container/item), the matching
|
|
10
|
-
* container/item pair, and whether legacy implode directives are
|
|
11
|
-
* attached. Surfaces a `recommended_fix` when the binding sits on
|
|
12
|
-
* the container level.
|
|
13
|
-
*
|
|
14
|
-
* yootheme_builder_clean_implode_directives
|
|
15
|
-
* → Removes every `props.source.props.*.implode` directive from
|
|
16
|
-
* the addressed element. Returns the audit log + new etag.
|
|
17
|
-
*
|
|
18
|
-
* @license MIT
|
|
19
|
-
*/
|
|
20
|
-
import type { RestClient } from '../../client.js';
|
|
21
|
-
import { type AnyToolDefinition } from '../tool-builder.js';
|
|
22
|
-
export declare function buildMultiItemsTools(client: RestClient): readonly AnyToolDefinition[];
|
|
23
|
-
//# sourceMappingURL=builders.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.ts","sourceRoot":"","sources":["../../../src/tools/multi-items/builders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,oBAAoB,CAAC;AAW5B,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,iBAAiB,EAAE,CAmCrF"}
|