@wootsup/yt-builder-mcp 1.9.0 → 1.11.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 +19 -10
- package/dist/gateway/advanced-read-tool.d.ts.map +1 -1
- package/dist/gateway/advanced-read-tool.js +14 -2
- package/dist/gateway/advanced-read-tool.js.map +1 -1
- package/dist/gateway/advanced-tool/domains.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/domains.js +5 -0
- package/dist/gateway/advanced-tool/domains.js.map +1 -1
- package/dist/gateway/advanced-tool/execute.d.ts +7 -1
- package/dist/gateway/advanced-tool/execute.d.ts.map +1 -1
- package/dist/gateway/advanced-tool/execute.js +58 -4
- package/dist/gateway/advanced-tool/execute.js.map +1 -1
- package/dist/server.d.ts +14 -11
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +14 -11
- package/dist/server.js.map +1 -1
- package/dist/sites/tools/sites-list.d.ts.map +1 -1
- package/dist/sites/tools/sites-list.js +22 -2
- package/dist/sites/tools/sites-list.js.map +1 -1
- package/dist/tools/elements/builders.d.ts.map +1 -1
- package/dist/tools/elements/builders.js +69 -31
- package/dist/tools/elements/builders.js.map +1 -1
- package/dist/tools/elements/handlers-write.d.ts +2 -0
- package/dist/tools/elements/handlers-write.d.ts.map +1 -1
- package/dist/tools/elements/handlers-write.js +132 -9
- package/dist/tools/elements/handlers-write.js.map +1 -1
- package/dist/tools/elements/handlers.d.ts +7 -4
- package/dist/tools/elements/handlers.d.ts.map +1 -1
- package/dist/tools/elements/handlers.js +49 -8
- package/dist/tools/elements/handlers.js.map +1 -1
- package/dist/tools/elements/schema-validation.d.ts +18 -0
- package/dist/tools/elements/schema-validation.d.ts.map +1 -1
- package/dist/tools/elements/schema-validation.js +49 -5
- package/dist/tools/elements/schema-validation.js.map +1 -1
- package/dist/tools/format/sources-format.d.ts +12 -5
- package/dist/tools/format/sources-format.d.ts.map +1 -1
- package/dist/tools/format/sources-format.js +31 -6
- package/dist/tools/format/sources-format.js.map +1 -1
- package/dist/tools/health.d.ts.map +1 -1
- package/dist/tools/health.js +18 -5
- package/dist/tools/health.js.map +1 -1
- package/dist/tools/inspection.d.ts.map +1 -1
- package/dist/tools/inspection.js +81 -12
- package/dist/tools/inspection.js.map +1 -1
- package/dist/tools/layout-flatten.d.ts +7 -1
- package/dist/tools/layout-flatten.d.ts.map +1 -1
- package/dist/tools/layout-flatten.js +24 -13
- package/dist/tools/layout-flatten.js.map +1 -1
- package/dist/tools/library.d.ts +23 -0
- package/dist/tools/library.d.ts.map +1 -1
- package/dist/tools/library.js +213 -15
- package/dist/tools/library.js.map +1 -1
- package/dist/tools/local-content/builders.js +11 -11
- package/dist/tools/local-content/builders.js.map +1 -1
- package/dist/tools/local-content/handlers.d.ts.map +1 -1
- package/dist/tools/local-content/handlers.js +34 -5
- package/dist/tools/local-content/handlers.js.map +1 -1
- package/dist/tools/local-content/schemas.d.ts +9 -4
- package/dist/tools/local-content/schemas.d.ts.map +1 -1
- package/dist/tools/local-content/schemas.js +14 -6
- package/dist/tools/local-content/schemas.js.map +1 -1
- package/dist/tools/multi-items/builders.d.ts.map +1 -1
- package/dist/tools/multi-items/builders.js +11 -8
- package/dist/tools/multi-items/builders.js.map +1 -1
- package/dist/tools/pages/builders.d.ts.map +1 -1
- package/dist/tools/pages/builders.js +122 -46
- package/dist/tools/pages/builders.js.map +1 -1
- package/dist/tools/pages/handlers-audit.d.ts +129 -0
- package/dist/tools/pages/handlers-audit.d.ts.map +1 -0
- package/dist/tools/pages/handlers-audit.js +704 -0
- package/dist/tools/pages/handlers-audit.js.map +1 -0
- package/dist/tools/pages/handlers-read.d.ts +8 -3
- package/dist/tools/pages/handlers-read.d.ts.map +1 -1
- package/dist/tools/pages/handlers-read.js +172 -25
- package/dist/tools/pages/handlers-read.js.map +1 -1
- package/dist/tools/pages/handlers-write.d.ts +17 -3
- package/dist/tools/pages/handlers-write.d.ts.map +1 -1
- package/dist/tools/pages/handlers-write.js +79 -26
- package/dist/tools/pages/handlers-write.js.map +1 -1
- package/dist/tools/pages/index.d.ts +5 -1
- package/dist/tools/pages/index.d.ts.map +1 -1
- package/dist/tools/pages/index.js +5 -1
- package/dist/tools/pages/index.js.map +1 -1
- package/dist/tools/pages/schemas.d.ts +319 -1
- package/dist/tools/pages/schemas.d.ts.map +1 -1
- package/dist/tools/pages/schemas.js +340 -4
- package/dist/tools/pages/schemas.js.map +1 -1
- package/dist/tools/pages/target.d.ts +162 -0
- package/dist/tools/pages/target.d.ts.map +1 -0
- package/dist/tools/pages/target.js +239 -0
- package/dist/tools/pages/target.js.map +1 -0
- package/dist/tools/shared-schemas.d.ts +22 -0
- package/dist/tools/shared-schemas.d.ts.map +1 -1
- package/dist/tools/shared-schemas.js +22 -0
- package/dist/tools/shared-schemas.js.map +1 -1
- package/dist/tools/sources/builders.d.ts.map +1 -1
- package/dist/tools/sources/builders.js +46 -28
- package/dist/tools/sources/builders.js.map +1 -1
- package/dist/tools/sources/handlers-bind.d.ts +7 -8
- package/dist/tools/sources/handlers-bind.d.ts.map +1 -1
- package/dist/tools/sources/handlers-bind.js +106 -7
- package/dist/tools/sources/handlers-bind.js.map +1 -1
- package/dist/tools/sparse-fields.d.ts +12 -0
- package/dist/tools/sparse-fields.d.ts.map +1 -1
- package/dist/tools/sparse-fields.js +34 -2
- package/dist/tools/sparse-fields.js.map +1 -1
- package/dist/tools/tool-builder/results.d.ts.map +1 -1
- package/dist/tools/tool-builder/results.js +114 -0
- package/dist/tools/tool-builder/results.js.map +1 -1
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/skills/yt-builder-mcp/SKILL.md +735 -44
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `pages_audit` handler — Task 6 of the pages_audit implementation plan
|
|
3
|
+
* (2026-07-19-04). Kept in its OWN file (not `handlers-read.ts`, already
|
|
4
|
+
* 981 LoC) per the plan's explicit instruction.
|
|
5
|
+
*
|
|
6
|
+
* The handler is a thin REST-to-MCP adapter: `GET /pages/audit` already
|
|
7
|
+
* returns the FULL, severity-sorted, deterministic sweep
|
|
8
|
+
* ({@see \WootsUp\BuilderMcp\Pages\Audit\PageAuditService::audit()}); this
|
|
9
|
+
* file only (a) forwards the optional filters as query params, (b) renders
|
|
10
|
+
* a COMPACT truncate-tolerant text-leg table (never the raw JSON dump —
|
|
11
|
+
* design §5), and (c) carries the complete, UNTRIMMED payload in
|
|
12
|
+
* `structuredContent` via `structuredResult` (mirrors
|
|
13
|
+
* `local-content/handlers.ts` — `applyMaxChars` only ever clips the text
|
|
14
|
+
* leg, never `structuredContent`).
|
|
15
|
+
*
|
|
16
|
+
* @license MIT
|
|
17
|
+
*/
|
|
18
|
+
import type { RestClient } from '../../client.js';
|
|
19
|
+
import { type ToolResult } from '../tool-builder.js';
|
|
20
|
+
import { type PagesTarget } from './target.js';
|
|
21
|
+
/** Design §2 — the four check categories `checks[]` filters on. */
|
|
22
|
+
type CheckCategory = 'seo' | 'structure' | 'content' | 'links';
|
|
23
|
+
/**
|
|
24
|
+
* The human-locatable address of ONE audit hit (B-3/B-5 — mirrors the PHP
|
|
25
|
+
* `FindingLocator::toArray()` wire shape verbatim).
|
|
26
|
+
*
|
|
27
|
+
* `path` stays the machine write address (RFC-6901 JSON-Pointer); the rest is
|
|
28
|
+
* what a HUMAN needs to find that element in the YOOtheme customizer. Per the
|
|
29
|
+
* PHP null-key policy the four always-meaningful fields (`path`, `breadcrumb`,
|
|
30
|
+
* `element_type`, `repeat`) are ALWAYS emitted — `element_type: ''` means "the
|
|
31
|
+
* path no longer resolves" — while the genuinely optional ones are OMITTED
|
|
32
|
+
* rather than sent as null. `prop` / `name` ride ALONGSIDE the locator fields
|
|
33
|
+
* on the checks that need them (which prop of a link element is empty, which
|
|
34
|
+
* anchor name collided).
|
|
35
|
+
*/
|
|
36
|
+
export interface FindingLocator {
|
|
37
|
+
readonly path: string;
|
|
38
|
+
readonly breadcrumb: string;
|
|
39
|
+
readonly element_type: string;
|
|
40
|
+
readonly element_name?: string | null;
|
|
41
|
+
readonly heading_source?: string | null;
|
|
42
|
+
readonly content_snippet?: string | null;
|
|
43
|
+
readonly repeat: number;
|
|
44
|
+
readonly prop?: string | null;
|
|
45
|
+
readonly name?: string | null;
|
|
46
|
+
readonly [extra: string]: unknown;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* PERF-4 / PROD-2 — the DEFAULT ceiling (chars of serialised JSON) on the
|
|
50
|
+
* `structuredContent` leg of one `pages_audit` result.
|
|
51
|
+
*
|
|
52
|
+
* There was NO ceiling at all: `applyMaxChars` clips only `content[0].text`
|
|
53
|
+
* (it says so in its own docblock), `max_chars` has no default, and the
|
|
54
|
+
* projection forwarded `findings` verbatim. Measured on this transport: **349.1
|
|
55
|
+
* KB (~89k tokens)** for a site sweep and **193.9 KB (~50k tokens)** for ONE
|
|
56
|
+
* busy page — against 12,000 chars for the identical request on the in-process
|
|
57
|
+
* native transport. A single tool result could eat most of a context window.
|
|
58
|
+
*
|
|
59
|
+
* WHY 48,000 and not the native handler's 12,000:
|
|
60
|
+
*
|
|
61
|
+
* - The two transports carry DIFFERENT things under that number. Native emits
|
|
62
|
+
* ONE payload — the audit JSON rendered as the text the model reads — so
|
|
63
|
+
* 12,000 chars is the whole result. Here the legs are separate: the text leg
|
|
64
|
+
* is independently bounded ({@link LOCATOR_LINES_PER_FINDING} = 15 locators
|
|
65
|
+
* per finding) and `structuredContent` is the MACHINE leg an agent drills
|
|
66
|
+
* into for the exact paths it is about to write to. Sharing one constant
|
|
67
|
+
* across that boundary would make each transport's budget wrong for the
|
|
68
|
+
* other's payload.
|
|
69
|
+
* - 48,000 chars ≈ 12k tokens at 4 chars/token — a bounded, predictable slice
|
|
70
|
+
* of a context window, and still a ~7× cut from the measured 349 KB.
|
|
71
|
+
* - It is above every realistic SINGLE-page audit (the headline case: ~100
|
|
72
|
+
* hits × ~250 chars of locator ≈ 25 KB), so the capability that motivated
|
|
73
|
+
* locators is never shed on a normal page — only pathological ones degrade.
|
|
74
|
+
*
|
|
75
|
+
* `max_chars` overrides it in BOTH directions (the schema's range is
|
|
76
|
+
* 200…100,000), which is why the `max_chars` describe on THIS tool states that
|
|
77
|
+
* it bounds both legs while the shared one still says text-only.
|
|
78
|
+
*/
|
|
79
|
+
export declare const STRUCTURED_BUDGET_CHARS = 48000;
|
|
80
|
+
/**
|
|
81
|
+
* The per-page-entry keys the evidence rung KEEPS — mirrors
|
|
82
|
+
* `McpPagesAuditHandler::PAGE_IDENTITY_KEYS`, and is pinned against the value
|
|
83
|
+
* PHP derives from its own constant by
|
|
84
|
+
* `tests/contracts/audit-shrink-ladder.test.ts`.
|
|
85
|
+
*
|
|
86
|
+
* An allow-list, not a drop-list, on purpose: evidence keys are check-SPECIFIC
|
|
87
|
+
* (`paths`, `alt_paths`, `anchors`, `generic_alts`, `skips`, `dead_anchors`,
|
|
88
|
+
* `long_headings`, `first_headline_path`, `cluster_id`, `iterated`, …) and a
|
|
89
|
+
* new check on the HOST adds new ones this package has never heard of. A
|
|
90
|
+
* drop-list would silently stop shedding the day a host ships one; an
|
|
91
|
+
* allow-list keeps identity + counts protected by construction.
|
|
92
|
+
*/
|
|
93
|
+
export declare const PAGE_IDENTITY_KEYS: readonly string[];
|
|
94
|
+
/**
|
|
95
|
+
* BUGS-2 — the raw per-hit evidence arrays that are a PROVABLE DUPLICATE of the
|
|
96
|
+
* locators riding on the same page entry, and may therefore be shed BEFORE a
|
|
97
|
+
* single locator is thinned. Mirrors
|
|
98
|
+
* `McpPagesAuditHandler::REDUNDANT_EVIDENCE_KEYS`; same contract test pins it.
|
|
99
|
+
*
|
|
100
|
+
* "Provable" means every field the array element carries also rides on the
|
|
101
|
+
* locator built from the SAME hit, host-side in `AuditCheckRegistry`:
|
|
102
|
+
* `paths` → path (+ the locator adds heading_source + repeat, which a bare
|
|
103
|
+
* pointer cannot express), `alt_paths` → path (+ prop), `dead_anchors` →
|
|
104
|
+
* {path,name}, `anchors` → {path,reason,text}, `generic_alts` →
|
|
105
|
+
* {path,prop,text}, `long_headings` → {path,length}.
|
|
106
|
+
*
|
|
107
|
+
* DELIBERATELY ABSENT: `skips` (heading-skip). Its elements are
|
|
108
|
+
* `{path, from, to}` and that check builds its locator with no from/to rider,
|
|
109
|
+
* so the jumped heading levels ride on that array and nothing else. It is shed
|
|
110
|
+
* by the allow-list rung instead.
|
|
111
|
+
*
|
|
112
|
+
* Being a DROP-list this one is allowed to be incomplete — a new host check's
|
|
113
|
+
* array simply is not shed EARLY, and the allow-list rung behind it still sheds
|
|
114
|
+
* everything. Opposite failure modes on purpose: this one under-sheds, the
|
|
115
|
+
* other cannot.
|
|
116
|
+
*/
|
|
117
|
+
export declare const REDUNDANT_EVIDENCE_KEYS: readonly string[];
|
|
118
|
+
export interface PagesAuditArgs {
|
|
119
|
+
readonly types?: readonly string[];
|
|
120
|
+
readonly checks?: readonly CheckCategory[];
|
|
121
|
+
readonly thin_content_threshold?: number;
|
|
122
|
+
readonly stale_after_months?: number;
|
|
123
|
+
readonly max_chars?: number;
|
|
124
|
+
/** A-6: scope the sweep to ONE page (exactly one member — handler-validated). */
|
|
125
|
+
readonly target?: PagesTarget;
|
|
126
|
+
}
|
|
127
|
+
export declare function handlePagesAudit(client: RestClient, { types, checks, thin_content_threshold, stale_after_months, max_chars, target }: PagesAuditArgs): Promise<ToolResult>;
|
|
128
|
+
export {};
|
|
129
|
+
//# sourceMappingURL=handlers-audit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers-audit.d.ts","sourceRoot":"","sources":["../../../src/tools/pages/handlers-audit.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,EAAiC,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAUH,KAAK,WAAW,EACnB,MAAM,aAAa,CAAC;AAErB,mEAAmE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