@walkeros/mcp-source-browser 0.1.0 → 0.1.1-next-1773136823705
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/dist/index.js +101 -63
- package/dist/index.js.map +1 -1
- package/package.json +7 -6
package/dist/index.js
CHANGED
|
@@ -11,15 +11,15 @@ import { mcpResult, mcpError } from "@walkeros/core";
|
|
|
11
11
|
// ../../collector/dist/index.mjs
|
|
12
12
|
import { assign as o } from "@walkeros/core";
|
|
13
13
|
import { assign as r, createLogger as i } from "@walkeros/core";
|
|
14
|
-
import { assign as a, clone as c, debounce as u, getId as f, getGrantedConsent as l, isDefined as
|
|
14
|
+
import { assign as a, clone as c, debounce as u, getId as f, getGrantedConsent as l, isDefined as g, isFunction as d, isObject as m, processEventMapping as p, tryCatchAsync as h, useHooks as w } from "@walkeros/core";
|
|
15
15
|
import { isArray as y } from "@walkeros/core";
|
|
16
16
|
import { tryCatch as b, tryCatchAsync as v } from "@walkeros/core";
|
|
17
17
|
import { getMappingValue as k, tryCatchAsync as C } from "@walkeros/core";
|
|
18
|
-
import { isObject as O, tryCatchAsync as
|
|
19
|
-
import { assign as M, getId as Q, isFunction as V, isString as
|
|
20
|
-
import { isObject as
|
|
21
|
-
import { getGrantedConsent as
|
|
22
|
-
import { useHooks as
|
|
18
|
+
import { isObject as O, tryCatchAsync as j, useHooks as q } from "@walkeros/core";
|
|
19
|
+
import { assign as M, getId as Q, isFunction as V, isString as _ } from "@walkeros/core";
|
|
20
|
+
import { isObject as K } from "@walkeros/core";
|
|
21
|
+
import { getGrantedConsent as en, processEventMapping as tn, tryCatchAsync as on, useHooks as sn } from "@walkeros/core";
|
|
22
|
+
import { useHooks as an, tryCatchAsync as cn } from "@walkeros/core";
|
|
23
23
|
var e = { Action: "action", Actions: "actions", Config: "config", Consent: "consent", Context: "context", Custom: "custom", Destination: "destination", Elb: "elb", Globals: "globals", Hook: "hook", Init: "init", Link: "link", On: "on", Prefix: "data-elb", Ready: "ready", Run: "run", Session: "session", Shutdown: "shutdown", User: "user", Walker: "walker" };
|
|
24
24
|
var t = { Commands: e, Utils: { Storage: { Cookie: "cookie", Local: "local", Session: "session" } } };
|
|
25
25
|
|
|
@@ -44,7 +44,7 @@ var n = Object.defineProperty;
|
|
|
44
44
|
var r2;
|
|
45
45
|
var o2 = ((r2 = o2 || {})[r2.ERROR = 0] = "ERROR", r2[r2.WARN = 1] = "WARN", r2[r2.INFO = 2] = "INFO", r2[r2.DEBUG = 3] = "DEBUG", r2);
|
|
46
46
|
var i2 = { merge: true, shallow: true, extend: true };
|
|
47
|
-
function
|
|
47
|
+
function c2(e4, t4 = {}, n2 = {}) {
|
|
48
48
|
n2 = { ...i2, ...n2 };
|
|
49
49
|
const r3 = Object.entries(t4).reduce((t5, [r4, o3]) => {
|
|
50
50
|
const i3 = e4[r4];
|
|
@@ -58,7 +58,7 @@ function s(e4) {
|
|
|
58
58
|
function a2(e4) {
|
|
59
59
|
return void 0 !== e4;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function f2(e4) {
|
|
62
62
|
return "string" == typeof e4;
|
|
63
63
|
}
|
|
64
64
|
function d3(e4) {
|
|
@@ -74,8 +74,8 @@ function w3(e4, t4, n2 = true) {
|
|
|
74
74
|
return e4 + (t4 = null != t4 ? (n2 ? "-" : "") + t4 : "");
|
|
75
75
|
}
|
|
76
76
|
function k3(e4, t4, n2, r3 = true) {
|
|
77
|
-
return
|
|
78
|
-
let [r4, o3] =
|
|
77
|
+
return P(t2(t4, w3(e4, n2, r3)) || "").reduce((e5, n3) => {
|
|
78
|
+
let [r4, o3] = T(n3);
|
|
79
79
|
if (!r4) return e5;
|
|
80
80
|
if (o3 || (r4.endsWith(":") && (r4 = r4.slice(0, -1)), o3 = ""), o3.startsWith("#")) {
|
|
81
81
|
o3 = o3.slice(1);
|
|
@@ -94,12 +94,12 @@ function x2(e4, t4 = t.Commands.Prefix) {
|
|
|
94
94
|
const r3 = e4 || document.body;
|
|
95
95
|
if (!r3) return [];
|
|
96
96
|
let o3 = [];
|
|
97
|
-
const i3 = t.Commands.Action,
|
|
97
|
+
const i3 = t.Commands.Action, c3 = `[${w3(t4, i3, false)}]`, s2 = (e5) => {
|
|
98
98
|
Object.keys(k3(t4, e5, i3, false)).forEach((n3) => {
|
|
99
99
|
o3 = o3.concat(E(e5, n3, t4));
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
-
return r3 !== document && (null == (n2 = r3.matches) ? void 0 : n2.call(r3,
|
|
102
|
+
return r3 !== document && (null == (n2 = r3.matches) ? void 0 : n2.call(r3, c3)) && s2(r3), S(r3, c3, s2), o3;
|
|
103
103
|
}
|
|
104
104
|
function E(e4, t4, n2 = t.Commands.Prefix) {
|
|
105
105
|
const r3 = [], { actions: o3, nearestOnly: i3 } = (function(e5, t5, n3) {
|
|
@@ -120,7 +120,7 @@ function E(e4, t4, n2 = t.Commands.Prefix) {
|
|
|
120
120
|
return { actions: [], nearestOnly: false };
|
|
121
121
|
})(n2, e4, t4);
|
|
122
122
|
return o3.length ? (o3.forEach((o4) => {
|
|
123
|
-
const
|
|
123
|
+
const c3 = P(o4.actionParams || "", ",").reduce((e5, t5) => (e5[g3(t5)] = true, e5), {}), s2 = A(n2, e4, c3, i3);
|
|
124
124
|
if (!s2.length) {
|
|
125
125
|
const t5 = "page", r4 = `[${w3(n2, t5)}]`, [o5, i4] = L(e4, r4, n2, t5);
|
|
126
126
|
s2.push({ entity: t5, data: o5, nested: [], context: i4 });
|
|
@@ -133,25 +133,25 @@ function E(e4, t4, n2 = t.Commands.Prefix) {
|
|
|
133
133
|
function O2(e4 = t.Commands.Prefix, t4 = document) {
|
|
134
134
|
const n2 = w3(e4, t.Commands.Globals, false);
|
|
135
135
|
let r3 = {};
|
|
136
|
-
return
|
|
137
|
-
r3 =
|
|
136
|
+
return R(t4, `[${n2}]`, (t5) => {
|
|
137
|
+
r3 = c2(r3, k3(e4, t5, t.Commands.Globals, false));
|
|
138
138
|
}), r3;
|
|
139
139
|
}
|
|
140
140
|
function j2(e4) {
|
|
141
141
|
const t4 = {};
|
|
142
|
-
return
|
|
143
|
-
const [n2, r3] =
|
|
142
|
+
return P(e4).forEach((e5) => {
|
|
143
|
+
const [n2, r3] = T(e5), [o3, i3] = W(n2);
|
|
144
144
|
if (!o3) return;
|
|
145
|
-
let [
|
|
146
|
-
|
|
145
|
+
let [c3, s2] = W(r3 || "");
|
|
146
|
+
c3 = c3 || o3, t4[o3] || (t4[o3] = []), t4[o3].push({ trigger: o3, triggerParams: i3, action: c3, actionParams: s2 });
|
|
147
147
|
}), t4;
|
|
148
148
|
}
|
|
149
149
|
function A(e4, t4, n2, r3 = false) {
|
|
150
150
|
const o3 = [];
|
|
151
151
|
let i3 = t4;
|
|
152
152
|
for (n2 = 0 !== Object.keys(n2 || {}).length ? n2 : void 0; i3; ) {
|
|
153
|
-
const
|
|
154
|
-
if (
|
|
153
|
+
const c3 = C2(e4, i3, t4, n2);
|
|
154
|
+
if (c3 && (o3.push(c3), r3)) break;
|
|
155
155
|
i3 = $(e4, i3);
|
|
156
156
|
}
|
|
157
157
|
return o3;
|
|
@@ -161,9 +161,9 @@ function C2(e4, t4, n2, r3) {
|
|
|
161
161
|
if (!o3 || r3 && !r3[o3]) return null;
|
|
162
162
|
const i3 = [t4], s2 = `[${w3(e4, o3)}],[${w3(e4, "")}]`, a3 = w3(e4, t.Commands.Link, false);
|
|
163
163
|
let l2 = {};
|
|
164
|
-
const u2 = [], [
|
|
164
|
+
const u2 = [], [f3, d4] = L(n2 || t4, s2, e4, o3);
|
|
165
165
|
S(t4, `[${a3}]`, (t5) => {
|
|
166
|
-
const [n3, r4] =
|
|
166
|
+
const [n3, r4] = T(t2(t5, a3));
|
|
167
167
|
"parent" === r4 && S(document.body, `[${a3}="${n3}:child"]`, (t6) => {
|
|
168
168
|
i3.push(t6);
|
|
169
169
|
const n4 = C2(e4, t6);
|
|
@@ -176,8 +176,8 @@ function C2(e4, t4, n2, r3) {
|
|
|
176
176
|
});
|
|
177
177
|
let g4 = {};
|
|
178
178
|
return m3.forEach((t5) => {
|
|
179
|
-
g4 =
|
|
180
|
-
}), l2 =
|
|
179
|
+
g4 = c2(g4, k3(e4, t5, "")), l2 = c2(l2, k3(e4, t5, o3));
|
|
180
|
+
}), l2 = c2(c2(g4, l2), f3), i3.forEach((t5) => {
|
|
181
181
|
S(t5, `[${w3(e4)}]`, (t6) => {
|
|
182
182
|
const n3 = C2(e4, t6);
|
|
183
183
|
n3 && u2.push(n3);
|
|
@@ -187,8 +187,13 @@ function C2(e4, t4, n2, r3) {
|
|
|
187
187
|
function $(e4, t4) {
|
|
188
188
|
const n2 = w3(e4, t.Commands.Link, false);
|
|
189
189
|
if (t4.matches(`[${n2}]`)) {
|
|
190
|
-
const [e5, r3] =
|
|
191
|
-
if ("child" === r3)
|
|
190
|
+
const [e5, r3] = T(t2(t4, n2));
|
|
191
|
+
if ("child" === r3) {
|
|
192
|
+
let t5 = null;
|
|
193
|
+
return R(document, `[${n2}="${e5}:parent"]`, (e6) => {
|
|
194
|
+
t5 || (t5 = e6);
|
|
195
|
+
}), t5;
|
|
196
|
+
}
|
|
192
197
|
}
|
|
193
198
|
return !t4.parentElement && t4.getRootNode && t4.getRootNode() instanceof ShadowRoot ? t4.getRootNode().host : t4.parentElement;
|
|
194
199
|
}
|
|
@@ -198,57 +203,62 @@ function L(e4, t4, n2, r3) {
|
|
|
198
203
|
let s2 = e4;
|
|
199
204
|
const a3 = `[${w3(n2, t.Commands.Context, false)}]`;
|
|
200
205
|
let l2 = 0;
|
|
201
|
-
for (; s2; ) s2.matches(t4) && (o3 =
|
|
206
|
+
for (; s2; ) s2.matches(t4) && (o3 = c2(k3(n2, s2, ""), o3), o3 = c2(k3(n2, s2, r3), o3)), s2.matches(a3) && (Object.entries(k3(n2, s2, t.Commands.Context, false)).forEach(([e5, t5]) => {
|
|
202
207
|
t5 && !i3[e5] && (i3[e5] = [t5, l2]);
|
|
203
208
|
}), ++l2), s2 = $(n2, s2);
|
|
204
209
|
return [o3, i3];
|
|
205
210
|
}
|
|
206
|
-
function
|
|
211
|
+
function R(e4, t4, n2) {
|
|
207
212
|
e4.querySelectorAll(t4).forEach(n2);
|
|
208
213
|
}
|
|
209
|
-
function
|
|
214
|
+
function S(e4, t4, n2) {
|
|
215
|
+
e4.querySelectorAll(t4).forEach(n2), e4 instanceof Element && e4.shadowRoot && S(e4.shadowRoot, t4, n2), e4.querySelectorAll("*").forEach((e5) => {
|
|
216
|
+
e5.shadowRoot && S(e5.shadowRoot, t4, n2);
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
function P(e4, t4 = ";") {
|
|
210
220
|
if (!e4) return [];
|
|
211
221
|
const n2 = new RegExp(`(?:[^${t4}']+|'[^']*')+`, "ig");
|
|
212
222
|
return e4.match(n2) || [];
|
|
213
223
|
}
|
|
214
|
-
function
|
|
224
|
+
function T(e4) {
|
|
215
225
|
const [t4, n2] = e4.split(/:(.+)/, 2);
|
|
216
226
|
return [g3(t4), g3(n2)];
|
|
217
227
|
}
|
|
218
|
-
function
|
|
228
|
+
function W(e4) {
|
|
219
229
|
const [t4, n2] = e4.split("(", 2);
|
|
220
230
|
return [t4, n2 ? n2.slice(0, -1) : ""];
|
|
221
231
|
}
|
|
222
|
-
var
|
|
223
|
-
t3(
|
|
224
|
-
var
|
|
225
|
-
t3(
|
|
226
|
-
var
|
|
232
|
+
var ge = {};
|
|
233
|
+
t3(ge, { env: () => pe, step: () => we });
|
|
234
|
+
var pe = {};
|
|
235
|
+
t3(pe, { push: () => ve });
|
|
236
|
+
var he = () => {
|
|
227
237
|
};
|
|
228
|
-
var
|
|
229
|
-
var
|
|
238
|
+
var be = () => () => Promise.resolve({ ok: true });
|
|
239
|
+
var ye = { error: he, warn: he, info: he, debug: he, throw: (e4) => {
|
|
230
240
|
throw "string" == typeof e4 ? new Error(e4) : e4;
|
|
231
|
-
}, json:
|
|
232
|
-
var
|
|
233
|
-
return
|
|
241
|
+
}, json: he, scope: () => ye };
|
|
242
|
+
var ve = { get push() {
|
|
243
|
+
return be();
|
|
234
244
|
}, get command() {
|
|
235
|
-
return
|
|
245
|
+
return be();
|
|
236
246
|
}, get elb() {
|
|
237
|
-
return
|
|
247
|
+
return be();
|
|
238
248
|
}, get window() {
|
|
239
|
-
return { addEventListener:
|
|
249
|
+
return { addEventListener: he, removeEventListener: he, location: { href: "https://example.com/page", pathname: "/page", search: "?query=test", hash: "#section", host: "example.com", hostname: "example.com", origin: "https://example.com", protocol: "https:" }, document: {}, navigator: { language: "en-US", userAgent: "Mozilla/5.0 (Test)" }, screen: { width: 1920, height: 1080 }, innerWidth: 1920, innerHeight: 1080, pageXOffset: 0, pageYOffset: 0, scrollX: 0, scrollY: 0 };
|
|
240
250
|
}, get document() {
|
|
241
|
-
return { addEventListener:
|
|
242
|
-
}, logger:
|
|
243
|
-
var
|
|
244
|
-
t3(
|
|
245
|
-
var
|
|
246
|
-
var
|
|
247
|
-
function
|
|
251
|
+
return { addEventListener: he, removeEventListener: he, querySelector: he, querySelectorAll: () => [], getElementById: he, getElementsByClassName: () => [], getElementsByTagName: () => [], createElement: () => ({ setAttribute: he, getAttribute: he, addEventListener: he, removeEventListener: he }), body: { appendChild: he, removeChild: he }, documentElement: { scrollTop: 0, scrollLeft: 0 }, readyState: "complete", title: "Test Page", referrer: "", cookie: "" };
|
|
252
|
+
}, logger: ye };
|
|
253
|
+
var we = {};
|
|
254
|
+
t3(we, { clickEvent: () => xe, pageView: () => ke });
|
|
255
|
+
var ke = { in: { trigger: "load", url: "https://example.com/docs", title: "Documentation", referrer: "https://example.com/" }, out: { name: "page view", data: { domain: "example.com", title: "Documentation", referrer: "https://example.com/", id: "/docs" }, trigger: "load", entity: "page", action: "view", source: { type: "browser", id: "https://example.com/docs", previous_id: "https://example.com/" } } };
|
|
256
|
+
var xe = { in: { trigger: "click", element: 'button[data-elb="cta"]', attributes: { "data-elb": "cta", "data-elb-cta": "label:Sign Up", "data-elbaction": "click:click" } }, out: { name: "cta click", data: { label: "Sign Up" }, trigger: "click", entity: "cta", action: "click" } };
|
|
257
|
+
function Ee(e4 = {}) {
|
|
248
258
|
const t4 = e4.prefix || "data-elb";
|
|
249
259
|
return function(e5) {
|
|
250
260
|
let n2, r3 = e5;
|
|
251
|
-
const o3 = {}, i3 = {},
|
|
261
|
+
const o3 = {}, i3 = {}, c3 = {}, s2 = {}, l2 = {}, u2 = {};
|
|
252
262
|
function d4(e6) {
|
|
253
263
|
return Object.entries(e6).map(([e7, t5]) => `${e7}:${(function(e8) {
|
|
254
264
|
if (!a2(e8) || null === e8) return "undefined";
|
|
@@ -258,9 +268,9 @@ function ke(e4 = {}) {
|
|
|
258
268
|
}
|
|
259
269
|
const m3 = { entity: (e6) => (n2 = e6, r3 = e6, m3), data(e6, t5) {
|
|
260
270
|
const n3 = null != r3 ? r3 : "";
|
|
261
|
-
return o3[n3] || (o3[n3] = {}),
|
|
271
|
+
return o3[n3] || (o3[n3] = {}), f2(e6) ? o3[n3][e6] = t5 : Object.assign(o3[n3], e6), m3;
|
|
262
272
|
}, action(e6, t5) {
|
|
263
|
-
if (
|
|
273
|
+
if (f2(e6)) if (a2(t5)) i3[e6] = t5;
|
|
264
274
|
else if (e6.includes(":")) {
|
|
265
275
|
const [t6, n3] = e6.split(":", 2);
|
|
266
276
|
i3[t6] = n3;
|
|
@@ -268,20 +278,20 @@ function ke(e4 = {}) {
|
|
|
268
278
|
else Object.assign(i3, e6);
|
|
269
279
|
return m3;
|
|
270
280
|
}, actions(e6, t5) {
|
|
271
|
-
if (
|
|
281
|
+
if (f2(e6)) if (a2(t5)) c3[e6] = t5;
|
|
272
282
|
else if (e6.includes(":")) {
|
|
273
283
|
const [t6, n3] = e6.split(":", 2);
|
|
274
|
-
|
|
275
|
-
} else
|
|
276
|
-
else Object.assign(
|
|
284
|
+
c3[t6] = n3;
|
|
285
|
+
} else c3[e6] = e6;
|
|
286
|
+
else Object.assign(c3, e6);
|
|
277
287
|
return m3;
|
|
278
|
-
}, context: (e6, t5) => (
|
|
288
|
+
}, context: (e6, t5) => (f2(e6) ? s2[e6] = t5 : Object.assign(s2, e6), m3), globals: (e6, t5) => (f2(e6) ? l2[e6] = t5 : Object.assign(l2, e6), m3), link: (e6, t5) => (f2(e6) ? u2[e6] = t5 : Object.assign(u2, e6), m3), get() {
|
|
279
289
|
const e6 = {};
|
|
280
290
|
return n2 && (e6[t4] = n2), Object.entries(o3).forEach(([n3, r4]) => {
|
|
281
291
|
if (Object.keys(r4).length > 0) {
|
|
282
292
|
e6[n3 ? `${t4}-${n3}` : `${t4}-`] = d4(r4);
|
|
283
293
|
}
|
|
284
|
-
}), Object.keys(i3).length > 0 && (e6[`${t4}action`] = d4(i3)), Object.keys(
|
|
294
|
+
}), Object.keys(i3).length > 0 && (e6[`${t4}action`] = d4(i3)), Object.keys(c3).length > 0 && (e6[`${t4}actions`] = d4(c3)), Object.keys(s2).length > 0 && (e6[`${t4}context`] = d4(s2)), Object.keys(l2).length > 0 && (e6[`${t4}globals`] = d4(l2)), Object.keys(u2).length > 0 && (e6[`${t4}link`] = d4(u2)), e6;
|
|
285
295
|
} };
|
|
286
296
|
return m3;
|
|
287
297
|
};
|
|
@@ -369,7 +379,7 @@ function registerGenerateTool(server2) {
|
|
|
369
379
|
)
|
|
370
380
|
);
|
|
371
381
|
}
|
|
372
|
-
const tagger =
|
|
382
|
+
const tagger = Ee(prefix ? { prefix } : void 0);
|
|
373
383
|
const t4 = tagger(entity);
|
|
374
384
|
if (entity) t4.entity(entity);
|
|
375
385
|
if (data) t4.data(data);
|
|
@@ -404,9 +414,17 @@ function withDom(html, fn) {
|
|
|
404
414
|
const dom = new JSDOM(html);
|
|
405
415
|
const prevDoc = globals.document;
|
|
406
416
|
const prevWin = globals.window;
|
|
417
|
+
const prevElement = globals.Element;
|
|
418
|
+
const prevHTMLElement = globals.HTMLElement;
|
|
419
|
+
const prevHTMLSelectElement = globals.HTMLSelectElement;
|
|
420
|
+
const prevNode = globals.Node;
|
|
407
421
|
try {
|
|
408
422
|
globals.document = dom.window.document;
|
|
409
423
|
globals.window = dom.window;
|
|
424
|
+
globals.Element = dom.window.Element;
|
|
425
|
+
globals.HTMLElement = dom.window.HTMLElement;
|
|
426
|
+
globals.HTMLSelectElement = dom.window.HTMLSelectElement;
|
|
427
|
+
globals.Node = dom.window.Node;
|
|
410
428
|
if (!globals.ShadowRoot) {
|
|
411
429
|
globals.ShadowRoot = dom.window.ShadowRoot || class ShadowRoot {
|
|
412
430
|
};
|
|
@@ -423,6 +441,26 @@ function withDom(html, fn) {
|
|
|
423
441
|
} else {
|
|
424
442
|
delete globals.window;
|
|
425
443
|
}
|
|
444
|
+
if (prevElement !== void 0) {
|
|
445
|
+
globals.Element = prevElement;
|
|
446
|
+
} else {
|
|
447
|
+
delete globals.Element;
|
|
448
|
+
}
|
|
449
|
+
if (prevHTMLElement !== void 0) {
|
|
450
|
+
globals.HTMLElement = prevHTMLElement;
|
|
451
|
+
} else {
|
|
452
|
+
delete globals.HTMLElement;
|
|
453
|
+
}
|
|
454
|
+
if (prevHTMLSelectElement !== void 0) {
|
|
455
|
+
globals.HTMLSelectElement = prevHTMLSelectElement;
|
|
456
|
+
} else {
|
|
457
|
+
delete globals.HTMLSelectElement;
|
|
458
|
+
}
|
|
459
|
+
if (prevNode !== void 0) {
|
|
460
|
+
globals.Node = prevNode;
|
|
461
|
+
} else {
|
|
462
|
+
delete globals.Node;
|
|
463
|
+
}
|
|
426
464
|
}
|
|
427
465
|
}
|
|
428
466
|
|
|
@@ -1099,7 +1137,7 @@ function registerDocResources(server2) {
|
|
|
1099
1137
|
// src/index.ts
|
|
1100
1138
|
var server = new McpServer({
|
|
1101
1139
|
name: "walkeros-source-browser",
|
|
1102
|
-
version: "0.1.
|
|
1140
|
+
version: "0.1.1-next-1773136823705"
|
|
1103
1141
|
});
|
|
1104
1142
|
registerGenerateTool(server);
|
|
1105
1143
|
registerParseTool(server);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/tools/generate.ts","../src/schemas/output.ts","../src/tools/parse.ts","../src/lib/dom.ts","../src/tools/validate.ts","../src/resources/docs.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { registerGenerateTool } from './tools/generate.js';\nimport { registerParseTool } from './tools/parse.js';\nimport { registerValidateTool } from './tools/validate.js';\nimport { registerDocResources } from './resources/docs.js';\n\ndeclare const __VERSION__: string;\n\nconst server = new McpServer({\n name: 'walkeros-source-browser',\n version: __VERSION__,\n});\n\nregisterGenerateTool(server);\nregisterParseTool(server);\nregisterValidateTool(server);\nregisterDocResources(server);\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('walkerOS source-browser MCP server running on stdio');\n}\n\nmain().catch((error) => {\n console.error('Failed to start MCP server:', error);\n process.exit(1);\n});\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { createTagger } from '@walkeros/web-source-browser';\nimport { GenerateTaggingOutputShape } from '../schemas/output.js';\n\nexport function registerGenerateTool(server: McpServer) {\n server.registerTool(\n 'generate_tagging',\n {\n title: 'Generate Tagging',\n description:\n 'Generate walkerOS data-elb HTML attributes from structured input. ' +\n 'Returns attribute key-value pairs and an example HTML snippet.',\n inputSchema: {\n entity: z\n .string()\n .optional()\n .describe(\n 'Entity name (creates data-elb=\"entity\" and scopes data-elb-entity properties)',\n ),\n data: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Entity properties as key:value pairs'),\n action: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Trigger:action pairs for data-elbaction (nearest entity only)',\n ),\n actions: z\n .record(z.string(), z.string())\n .optional()\n .describe('Trigger:action pairs for data-elbactions (all entities)'),\n context: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Context properties for data-elbcontext'),\n globals: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Global properties for data-elbglobals'),\n link: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Link relationships for data-elblink (id:type, e.g. {\"details\":\"parent\"})',\n ),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: GenerateTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({\n entity,\n data,\n action,\n actions,\n context,\n globals,\n link,\n prefix,\n }) => {\n try {\n const hasInput =\n entity || data || action || actions || context || globals || link;\n if (!hasInput) {\n return mcpError(\n new Error(\n 'Provide at least one parameter (entity, data, action, etc.)',\n ),\n );\n }\n\n const tagger = createTagger(prefix ? { prefix } : undefined);\n // Pass entity to factory (sets naming scope) and call .entity() (creates data-elb attr)\n const t = tagger(entity);\n if (entity) t.entity(entity);\n if (data) t.data(data);\n if (action) t.action(action);\n if (actions) t.actions(actions);\n if (context) t.context(context);\n if (globals) t.globals(globals);\n if (link) t.link(link);\n\n const attributes = t.get();\n\n const attrString = Object.entries(attributes)\n .map(([k, v]) => (v ? `${k}=\"${v}\"` : k))\n .join('\\n ');\n const html = `<div\\n ${attrString}\\n>\\n <!-- content -->\\n</div>`;\n\n return mcpResult({ attributes, html });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\n\nexport const GenerateTaggingOutputShape = {\n attributes: z\n .record(z.string(), z.string())\n .describe('Generated HTML data attributes'),\n html: z.string().describe('Example HTML element with the attributes applied'),\n};\n\nconst eventShape = z.object({\n entity: z.string(),\n action: z.string(),\n data: z.record(z.string(), z.unknown()).optional(),\n trigger: z.string().optional(),\n context: z.record(z.string(), z.unknown()).optional(),\n nested: z.array(z.unknown()).optional(),\n});\n\nexport const ParseTaggingOutputShape = {\n events: z.array(eventShape).describe('Extracted walkerOS events'),\n globals: z.record(z.string(), z.unknown()).describe('Global properties'),\n summary: z.string().describe('Human-readable summary'),\n};\n\nconst validationIssueShape = z.object({\n check: z.string().describe('Name of the validation check'),\n message: z.string().describe('Human-readable description'),\n element: z.string().describe('HTML snippet of the problematic element'),\n});\n\nexport const ValidateTaggingOutputShape = {\n valid: z.boolean().describe('True if no errors found'),\n errors: z.array(validationIssueShape).describe('Critical issues'),\n warnings: z.array(validationIssueShape).describe('Potential issues'),\n info: z.array(validationIssueShape).describe('Informational notes'),\n summary: z.string().describe('Human-readable validation summary'),\n};\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { getAllEvents, getGlobals } from '@walkeros/web-source-browser';\nimport { withDom } from '../lib/dom.js';\nimport { ParseTaggingOutputShape } from '../schemas/output.js';\n\nexport function registerParseTool(server: McpServer) {\n server.registerTool(\n 'parse_tagging',\n {\n title: 'Parse Tagging',\n description:\n 'Parse HTML with data-elb attributes using real DOM parsing (JSDOM). ' +\n 'Extracts all walkerOS events and globals. Use validate_tagging for issue detection.',\n inputSchema: {\n html: z.string().describe('HTML snippet with data-elb attributes'),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: ParseTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ html, prefix: customPrefix }) => {\n try {\n if (!html || !html.trim()) {\n return mcpError(new Error('html is required'));\n }\n\n const prefix = customPrefix || 'data-elb';\n\n return withDom(html, (dom) => {\n const doc = dom.window.document;\n const body = doc.body;\n\n // Extract events using walker parser\n const events = getAllEvents(body, prefix);\n\n // Extract globals\n const globals = getGlobals(prefix, doc);\n\n const summary = `Found ${events.length} event(s), ${Object.keys(globals).length} global(s)`;\n\n return mcpResult({ events, globals, summary });\n });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { JSDOM } from 'jsdom';\n\n/**\n * Typed view of globalThis for assigning JSDOM globals in Node.js.\n * Walker parser functions read from globalThis.document internally.\n */\ninterface DomGlobals {\n document?: Document;\n window?: Window & typeof globalThis;\n // Intentionally loose: JSDOM may not provide ShadowRoot, so we polyfill with a stub class\n ShadowRoot?: { new (): unknown; prototype: unknown };\n}\n\nconst globals = globalThis as unknown as DomGlobals;\n\n/**\n * Execute a function with JSDOM globals (document, window) temporarily set.\n * Walker parser functions read from globalThis.document internally.\n */\nexport function withDom<T>(html: string, fn: (dom: JSDOM) => T): T {\n const dom = new JSDOM(html);\n const prevDoc = globals.document;\n const prevWin = globals.window;\n\n try {\n globals.document = dom.window.document;\n globals.window = dom.window as unknown as Window & typeof globalThis;\n // Polyfill ShadowRoot if missing (JSDOM may not provide it)\n if (!globals.ShadowRoot) {\n globals.ShadowRoot =\n (dom.window as unknown as DomGlobals).ShadowRoot || class ShadowRoot {};\n }\n return fn(dom);\n } finally {\n if (prevDoc !== undefined) {\n globals.document = prevDoc;\n } else {\n delete globals.document;\n }\n if (prevWin !== undefined) {\n globals.window = prevWin;\n } else {\n delete globals.window;\n }\n }\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { withDom } from '../lib/dom.js';\nimport { ValidateTaggingOutputShape } from '../schemas/output.js';\n\nconst KNOWN_TRIGGERS = [\n 'load',\n 'click',\n 'impression',\n 'visible',\n 'hover',\n 'submit',\n 'wait',\n 'pulse',\n];\n\ntype Issue = { check: string; message: string; element: string };\n\nexport function registerValidateTool(server: McpServer) {\n server.registerTool(\n 'validate_tagging',\n {\n title: 'Validate Tagging',\n description:\n 'Validate HTML data-elb tagging for common mistakes. ' +\n 'Checks for orphan actions, missing entities, unknown triggers, and more.',\n inputSchema: {\n html: z.string().describe('HTML snippet to validate'),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: ValidateTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ html, prefix: customPrefix }) => {\n try {\n if (!html || !html.trim()) {\n return mcpError(new Error('html is required'));\n }\n\n const prefix = customPrefix || 'data-elb';\n\n return withDom(html, (dom) => {\n const body = dom.window.document.body;\n const errors: Issue[] = [];\n const warnings: Issue[] = [];\n const info: Issue[] = [];\n const snip = (el: Element) => el.outerHTML.slice(0, 120);\n const actionAttr = `${prefix}action`;\n const actionsAttr = `${prefix}actions`;\n\n // 1. Empty entity names\n body.querySelectorAll(`[${prefix}]`).forEach((el) => {\n if (!el.getAttribute(prefix)?.trim()) {\n errors.push({\n check: 'empty_entity',\n message: 'Empty entity name',\n element: snip(el),\n });\n }\n });\n\n // 2. Orphan actions\n body\n .querySelectorAll(`[${actionAttr}], [${actionsAttr}]`)\n .forEach((el) => {\n let parent = el.parentElement;\n let hasEntity = el.hasAttribute(prefix);\n while (parent && parent !== body && !hasEntity) {\n if (parent.hasAttribute(prefix)) hasEntity = true;\n parent = parent.parentElement;\n }\n if (!hasEntity) {\n warnings.push({\n check: 'orphan_action',\n message:\n 'Action without entity ancestor (will fire as \"page\" entity)',\n element: snip(el),\n });\n }\n });\n\n // 3. Entities without actions\n body.querySelectorAll(`[${prefix}]`).forEach((el) => {\n const hasAction =\n el.querySelector(`[${actionAttr}], [${actionsAttr}]`) ||\n el.hasAttribute(actionAttr) ||\n el.hasAttribute(actionsAttr);\n if (!hasAction) {\n const name = el.getAttribute(prefix);\n info.push({\n check: 'entity_without_action',\n message: `Entity \"${name}\" has no action — won't produce events without a trigger`,\n element: snip(el),\n });\n }\n });\n\n // 4. Orphan properties\n body.querySelectorAll('*').forEach((el) => {\n Array.from(el.attributes).forEach((attr) => {\n const match = attr.name.match(new RegExp(`^${prefix}-(.+)$`));\n if (!match) return;\n const entityName = match[1];\n if (!entityName) return;\n\n // Walk up to find matching data-elb=\"entityName\"\n let parent: Element | null = el;\n let found = false;\n while (parent && parent !== body) {\n if (parent.getAttribute(prefix) === entityName) {\n found = true;\n break;\n }\n parent = parent.parentElement;\n }\n if (!found) {\n warnings.push({\n check: 'orphan_property',\n message: `Property \"${attr.name}\" without matching entity data-elb=\"${entityName}\" ancestor (may be intentional if using tagger scope)`,\n element: snip(el),\n });\n }\n });\n });\n\n // 5. Unknown triggers\n body\n .querySelectorAll(`[${actionAttr}], [${actionsAttr}]`)\n .forEach((el) => {\n const val =\n el.getAttribute(actionAttr) ||\n el.getAttribute(actionsAttr) ||\n '';\n val.split(';').forEach((pair) => {\n const trigger = pair\n .split(':')[0]\n ?.trim()\n .replace(/\\(.*\\)$/, '');\n if (trigger && !KNOWN_TRIGGERS.includes(trigger)) {\n warnings.push({\n check: 'unknown_trigger',\n message: `Unknown trigger \"${trigger}\" (known: ${KNOWN_TRIGGERS.join(', ')})`,\n element: snip(el),\n });\n }\n });\n });\n\n const valid = errors.length === 0;\n const total = errors.length + warnings.length + info.length;\n const summary = valid\n ? total === 0\n ? 'Valid — no issues found'\n : `Valid — ${warnings.length} warning(s), ${info.length} info(s)`\n : `Invalid — ${errors.length} error(s), ${warnings.length} warning(s), ${info.length} info(s)`;\n\n return mcpResult({ valid, errors, warnings, info, summary });\n });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nconst HTML_ATTRIBUTES_DOCS = `# HTML Attributes\n\nTag your web components using \\`data-elb\\` attributes to enable structured event tracking without custom JavaScript.\n\nBy adding a few simple attributes to your markup, you can track user behavior such as clicks, views, form submissions, and more.\n\n## Concept\n\n\\`\\`\\`html\n<!-- Generic usage -->\n<div\n data-elb=\"ENTITY\"\n data-elb-ENTITY=\"KEY:VALUE\"\n data-elbaction=\"TRIGGER:ACTION\" <!-- nearest entity only -->\n data-elbactions=\"TRIGGER:ACTION\" <!-- all entities -->\n data-elbcontext=\"KEY:VALUE\"\n data-elbglobals=\"KEY:VALUE\"\n/>\n\n<!-- Example usage -->\n<div data-elbglobals=\"language:en\">\n <div data-elbcontext=\"test:engagement\">\n <div data-elb=\"promotion\" data-elbaction=\"visible:view\">\n <h1 data-elb-promotion=\"name:Setting up tracking easily\">\n Setting up tracking easily\n </h1>\n <p data-elb-promotion=\"category:analytics\">Analytics</p>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n## Entity and action\n\nYou define the entity **scope** by setting the \\`data-elb\\` attribute with the name of an entity to an element, e.g. \\`data-elb=\"promotion\"\\`. The default entity is \\`page\\` when no \\`data-elb\\` is set.\n\nAn **action** can be added by setting one of the following attributes on the **same level** or **child elements** in combination with a **matching trigger**:\n\n- **\\`data-elbaction\\`** - applies action to the **nearest entity only**\n- **\\`data-elbactions\\`** - applies action to **all entities** in the DOM hierarchy\n\nBoth attributes use the same syntax, e.g., \\`data-elbaction=\"visible:view\"\\` or \\`data-elbactions=\"click:select\"\\` to fire events when triggered.\n\nTo define the entities' **properties**, set the **composited attribute** \\`data-elb-ENTITY\\` with the key and value, e.g. \\`data-elb-promotion=\"name:tagging is fun;position:overlay\"\\`.\n\n## Triggers\n\n| **Trigger** | **Definition** |\n|-------------|----------------|\n| load | after loading a page when DOM is ready |\n| click | when an element or a child is clicked |\n| impression | after an element has been in the viewport for at least 50% for one second |\n| visible | each time an element re-enters the viewport after being out of view |\n| hover | each time the mouse enters the corresponding element |\n| submit | on valid form submission |\n| wait(ms) | waits ms seconds (15 seconds by default) until triggering |\n| pulse(ms) | recurring trigger every ms seconds (15 seconds by default) if the page is not hidden |\n\n> **Note:** Trigger names are predefined and to be selected from the list, while the action can be an arbitrarily defined name.\n\n### Abbreviation\n\nIf the trigger and action values are equal, e.g. for click events, you can shorten the implementation:\n\n\\`\\`\\`html\n<b data-elbaction=\"click\">\n Use the short version, instead of\n <s data-elbaction=\"click:click\">long</s>\n</b>\n\\`\\`\\`\n\n### Parameters\n\nSome triggers accept optional parameters. Use brackets behind the trigger to pass that information.\n\n\\`\\`\\`html\n<p data-elbaction=\"wait(10):interested\"></p>\n<p data-elbaction=\"pulse(10):interested\"></p>\n\\`\\`\\`\n\n### Action filter\n\nTo prevent an action from triggering unwanted entities, restrict the action to a specific entity by adding the name:\n\n\\`\\`\\`html\n<div data-elb=\"foo\">\n <div data-elb=\"bar\" data-elbaction=\"load:hello(bar)\">\n only the bar hello event fires.\n </div>\n</div>\n\\`\\`\\`\n\n## Linking elements\n\nUse \\`data-elblink\\` to extend the scope of an entity by elements placed somewhere else (like modals). Specific IDs connect linked elements hierarchically as parent or child.\n\n\\`\\`\\`html\n<div data-elb=\"info\" data-elblink=\"details:parent\">...</div>\n...\n<div data-elblink=\"details:child\" data-elbaction=\"visible\">...</div>\n<p data-elblink=\"another:child\">...</p>\n\\`\\`\\`\n\n## Data\n\n### Basic attributes\n\nTo specify data, use the name of the entity. Data attributes must be inside the entity scope or a parent.\n\n\\`\\`\\`html\n<div data-elb-entity=\"source:parent\">\n <div data-elb=\"entity\">\n <p data-elb-entity=\"key:value\">...</p>\n <p data-elb-entity=\"foo:bar\">...</p>\n </div>\n</div>\n\\`\\`\\`\n\n### Type casting\n\nProperty values will be cast to their type, supporting string, number & boolean.\n\n\\`\\`\\`html\n<div data-elb=\"types\">\n <p data-elb-types=\"string:text\">{ string: \"text\" }</p>\n <p data-elb-types=\"int:42;float:3.14\">{ int: 42, float: 3.14 }</p>\n <p data-elb-types=\"bool:true\">{ bool: true }</p>\n</div>\n\\`\\`\\`\n\n### Multiple attributes\n\nUse semicolons to separate key-value pairs. Use single quotes to escape values that contain semicolons.\n\n\\`\\`\\`html\n<p data-elb=\"foo\" data-elb-foo=\"b:a;r\">{ \"b\": \"a\", \"r\": true }</p>\n<p data-elb=\"foo\" data-elb-foo=\"b:'a;r'\">{ \"b\": \"a;r\" }</p>\n\\`\\`\\`\n\n### Dynamic field values\n\nUse \\`#\\` at the beginning followed by the attribute name to access the value of the element attribute.\n\n\\`\\`\\`html\n<input type=\"text\" value=\"blue\" data-elb-product=\"color:#value\" />\n<div data-elb-product=\"name:#innerHTML\">Everyday Ruck Snack</div>\n\\`\\`\\`\n\n### Arrays\n\nAdd the \\`[]\\` suffix to a property's name, such as \\`size[]:m\\`. It will generate de-duplicated data properties.\n\n\\`\\`\\`html\n<div data-elb=\"product\">\n <p data-elb-product=\"size[]:s;size[]:l\"></p>\n <p data-elb-product=\"size[]:l\"></p>\n</div>\n\\`\\`\\`\n\n### Generic properties\n\nLeave the entity name empty (only \\`data-elb-\\`) to add the property to any related entity. Explicitly named properties are preferred over generic ones.\n\n## Globals\n\nProperties that apply to **all events on a page**. Define them anywhere using the \\`data-elbglobals\\` attribute. Globals are collected once, right before the first event.\n\n\\`\\`\\`html\n<div data-elbglobals=\"outof:scope\"></div>\n<div data-elb=\"entity\" data-elb-entity=\"foo:bar\" data-elbaction=\"load:action\" />\n\\`\\`\\`\n\n## Context\n\nContext provides framing information for events (position, test, component). Use \\`data-elbcontext\\` on ancestor elements.\n\n\\`\\`\\`html\n<div data-elbcontext=\"test:engagement\" data-elbglobals=\"plan:paid\">\n <div data-elbcontext=\"recommendation:smart_ai\">\n <div data-elb=\"promotion\" data-elbaction=\"click\" data-elb-promotion=\"title:click me\">\n click me\n </div>\n </div>\n</div>\n\\`\\`\\`\n\nContext properties are tuples with the value and an index, starting at the closest parent (\\`[value, index]\\`).\n\n## Nested entities\n\nA \\`data-elb\\` entity within another \\`data-elb\\` entity is called a nested entity. Nested entities are accessible in the \\`nested\\` array of each event.\n\n\\`\\`\\`html\n<div data-elb=\"mother\" data-elb-mother=\"label:caring\" data-elbaction=\"load:view\">\n <div data-elb=\"son\" data-elb-son=\"age:23\"></div>\n <div data-elb=\"daughter\" data-elb-daughter=\"age:32\">\n <div data-elb=\"baby\" data-elb-baby=\"status:infant\"></div>\n </div>\n</div>\n\\`\\`\\`\n\n## Reserved attributes\n\n\\`data-elb\\`, \\`data-elbaction\\`, \\`data-elbactions\\`, \\`data-elbcontext\\`, \\`data-elbglobals\\`, and \\`data-elblink\\` are reserved attributes. \\`data-elb-*\\` attributes may be arbitrary combinations based on the related entity name.\n`;\n\nconst TAGGER_DOCS = `# Tagger\n\nThe tagger is a utility for generating HTML data attributes that the walkerOS browser source uses for event tracking. It provides a fluent interface to create properly formatted and escaped data attributes for your HTML elements.\n\nPackage: \\`@walkeros/web-source-browser\\`\n\n## Why use the tagger?\n\n- **Consistent formatting** - Ensures data attributes follow walkerOS conventions\n- **Automatic escaping** - Handles special characters in values (semicolons, colons, quotes, backslashes)\n- **Type safety** - Provides TypeScript support for better development experience\n- **Fluent API** - Chainable methods for building complex attribute sets\n- **Maintainability** - Centralized logic for attribute generation\n\n## Installation\n\n\\`\\`\\`bash\nnpm install @walkeros/web-source-browser\n\\`\\`\\`\n\n## Initialization\n\n\\`\\`\\`typescript\nimport { createTagger } from '@walkeros/web-source-browser';\n\n// Create with default configuration\nconst tagger = createTagger();\n\n// Create with custom configuration\nconst customTagger = createTagger({\n prefix: 'data-elb',\n});\n\\`\\`\\`\n\n## Usage examples\n\n### Basic data tagging (without entity)\n\n\\`\\`\\`typescript\nconst tagger = createTagger();\n\n// Using tagger with a scope parameter sets naming for data attributes only\nconst attributes = tagger('product')\n .data('id', '123')\n .data('name', 'Widget')\n .get();\n\n// Result:\n// {\n// 'data-elb-product': 'id:123;name:Widget'\n// }\n// Note: No 'data-elb' entity attribute is created\n\\`\\`\\`\n\n### Entity tagging\n\n\\`\\`\\`typescript\n// To create an entity attribute, use the .entity() method\nconst attributes = tagger()\n .entity('product')\n .data('id', '123')\n .data('name', 'Widget')\n .get();\n\n// Result:\n// {\n// 'data-elb': 'product',\n// 'data-elb-product': 'id:123;name:Widget'\n// }\n\\`\\`\\`\n\n### Action mapping\n\n\\`\\`\\`typescript\nconst attributes = tagger()\n .action('load', 'view')\n .action('click', 'select')\n .get();\n\n// Result:\n// {\n// 'data-elbaction': 'load:view;click:select'\n// }\n\\`\\`\\`\n\n### Context and global properties\n\n\\`\\`\\`typescript\nconst attributes = tagger('product')\n .data('id', 123)\n .context('test', 'engagement')\n .globals('lang', 'en')\n .get();\n\n// Result:\n// {\n// 'data-elb': 'product',\n// 'data-elb-product': 'id:123',\n// 'data-elbcontext': 'test:engagement',\n// 'data-elbglobals': 'lang:en'\n// }\n\\`\\`\\`\n\n## Available methods (API reference)\n\n##### \\`tagger(scope?: string)\\`\n\nCreates a new tagger instance. The optional scope parameter sets the naming scope for data attributes without creating an entity attribute.\n\n\\`\\`\\`typescript\n// Without scope - generic data attributes\ntagger().data('key', 'value');\n// Creates: data-elb-=\"key:value\"\n\n// With scope - scoped data attributes (no entity attribute)\ntagger('product').data('id', '123');\n// Creates: data-elb-product=\"id:123\"\n\\`\\`\\`\n\n##### \\`.entity(name: string)\\`\n\nSets the entity attribute and updates the naming scope for subsequent data calls.\n\n\\`\\`\\`typescript\ntagger().entity('product').data('id', '123');\n// Creates: data-elb=\"product\" data-elb-product=\"id:123\"\n\n// Entity changes the naming scope\ntagger('foo').entity('bar').data('a', 1);\n// Creates: data-elb=\"bar\" data-elb-bar=\"a:1\"\n\\`\\`\\`\n\n##### \\`.data(key: string, value: Property)\\` | \\`.data(object: Properties)\\`\n\nAdds data properties using the current naming scope.\n\n\\`\\`\\`typescript\n// Single property\ntagger('product').data('id', 123);\n// Creates: data-elb-product=\"id:123\"\n\n// Multiple properties\ntagger('product').data({ id: 123, name: 'Widget', price: 99.99 });\n// Creates: data-elb-product=\"id:123;name:Widget;price:99.99\"\n\\`\\`\\`\n\n##### \\`.action(trigger: string, action?: string)\\` | \\`.action(object: Record<string, string>)\\`\n\nAdds action mappings for event triggers. Creates a \\`data-elbaction\\` attribute.\n\n\\`\\`\\`typescript\ntagger().action('load', 'view');\ntagger().action({ load: 'view', click: 'select', impression: 'view' });\n\\`\\`\\`\n\n##### \\`.actions(trigger: string, action?: string)\\` | \\`.actions(object: Record<string, string>)\\`\n\nAdds action mappings for event triggers. Creates a \\`data-elbactions\\` attribute.\n\n\\`\\`\\`typescript\ntagger().actions('load', 'view');\ntagger().actions({ load: 'view', click: 'select', visible: 'visible' });\n\n// Can be combined with action() method\ntagger().action('click', 'select').actions('load', 'view');\n\\`\\`\\`\n\n##### \\`.context(key: string, value: Property)\\` | \\`.context(object: Properties)\\`\n\nAdds context properties.\n\n\\`\\`\\`typescript\ntagger().context('test', 'engagement');\ntagger().context({ test: 'engagement', position: 'header', type: 'promo' });\n\\`\\`\\`\n\n##### \\`.globals(key: string, value: Property)\\` | \\`.globals(object: Properties)\\`\n\nAdds global properties.\n\n\\`\\`\\`typescript\ntagger().globals('lang', 'en');\ntagger().globals({ lang: 'en', plan: 'paid', version: '1.0' });\n\\`\\`\\`\n\n##### \\`.link(id: string, type: string)\\` | \\`.link(object: Record<string, string>)\\`\n\nAdds link relationships between elements.\n\n\\`\\`\\`typescript\ntagger().link('details', 'parent');\ntagger().link({ details: 'parent', modal: 'child', sidebar: 'child' });\n\\`\\`\\`\n\n##### \\`.get()\\`\n\nGenerates the final HTML attributes object.\n\n\\`\\`\\`typescript\n// With naming scope only\nconst attributes = tagger('product').data('id', '123').get();\n// Returns: { 'data-elb-product': 'id:123' }\n\n// With entity attribute\nconst attributes = tagger().entity('product').data('id', '123').get();\n// Returns: { 'data-elb': 'product', 'data-elb-product': 'id:123' }\n\\`\\`\\`\n\nAll methods return the tagger instance for method chaining, except \\`get()\\` which returns the final attributes object.\n\n## Common use cases\n\n### Product listing page\n\n\\`\\`\\`typescript\nfunction ProductCard({ product }) {\n return (\n <div\n {...tagger('product')\n .data({\n id: product.id,\n name: product.name,\n price: product.price,\n category: product.category\n })\n .action('click', 'select')\n .get()}\n >\n {product.name}\n </div>\n );\n}\n\\`\\`\\`\n\n### Shopping cart\n\n\\`\\`\\`typescript\nfunction CartItem({ item }) {\n return (\n <div\n {...tagger()\n .entity('cart')\n .data({\n productId: item.id,\n quantity: item.quantity,\n price: item.price\n })\n .action('click', 'remove')\n .get()}\n >\n {item.name}\n </div>\n );\n}\n\\`\\`\\`\n`;\n\nexport function registerDocResources(server: McpServer) {\n server.resource(\n 'tagging-html-attributes',\n 'walkeros://docs/tagging/html-attributes',\n {\n title: 'walkerOS HTML Attributes Tagging Reference',\n description: 'Complete guide to data-elb HTML attribute tagging',\n mimeType: 'text/markdown',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://docs/tagging/html-attributes',\n mimeType: 'text/markdown' as const,\n text: HTML_ATTRIBUTES_DOCS,\n },\n ],\n }),\n );\n\n server.resource(\n 'tagging-tagger-api',\n 'walkeros://docs/tagging/tagger',\n {\n title: 'walkerOS Tagger API Reference',\n description:\n 'createTagger() fluent API for generating data-elb attributes',\n mimeType: 'text/markdown',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://docs/tagging/tagger',\n mimeType: 'text/markdown' as const,\n text: TAGGER_DOCS,\n },\n ],\n }),\n );\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,KAAAA,UAAS;AAElB,SAAS,WAAW,gBAAgB;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACFpC,SAAS,SAAS;AAEX,IAAM,6BAA6B;AAAA,EACxC,YAAY,EACT,OAAO,EAAE,OAAO,GAAG,EAAE,OAAO,CAAC,EAC7B,SAAS,gCAAgC;AAAA,EAC5C,MAAM,EAAE,OAAO,EAAE,SAAS,kDAAkD;AAC9E;AAEA,IAAM,aAAa,EAAE,OAAO;AAAA,EAC1B,QAAQ,EAAE,OA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AChB,CAAC;","names":["z","server","z","globals","t","k","v","z","mcpResult","mcpError","server","z","mcpError","x","globals","O","mcpResult","z","mcpResult","mcpError","server","z","mcpError","mcpResult","server"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/tools/generate.ts","../src/schemas/output.ts","../src/tools/parse.ts","../src/lib/dom.ts","../src/tools/validate.ts","../src/resources/docs.ts"],"sourcesContent":["import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';\nimport { registerGenerateTool } from './tools/generate.js';\nimport { registerParseTool } from './tools/parse.js';\nimport { registerValidateTool } from './tools/validate.js';\nimport { registerDocResources } from './resources/docs.js';\n\ndeclare const __VERSION__: string;\n\nconst server = new McpServer({\n name: 'walkeros-source-browser',\n version: __VERSION__,\n});\n\nregisterGenerateTool(server);\nregisterParseTool(server);\nregisterValidateTool(server);\nregisterDocResources(server);\n\nasync function main() {\n const transport = new StdioServerTransport();\n await server.connect(transport);\n console.error('walkerOS source-browser MCP server running on stdio');\n}\n\nmain().catch((error) => {\n console.error('Failed to start MCP server:', error);\n process.exit(1);\n});\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { createTagger } from '@walkeros/web-source-browser';\nimport { GenerateTaggingOutputShape } from '../schemas/output.js';\n\nexport function registerGenerateTool(server: McpServer) {\n server.registerTool(\n 'generate_tagging',\n {\n title: 'Generate Tagging',\n description:\n 'Generate walkerOS data-elb HTML attributes from structured input. ' +\n 'Returns attribute key-value pairs and an example HTML snippet.',\n inputSchema: {\n entity: z\n .string()\n .optional()\n .describe(\n 'Entity name (creates data-elb=\"entity\" and scopes data-elb-entity properties)',\n ),\n data: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Entity properties as key:value pairs'),\n action: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Trigger:action pairs for data-elbaction (nearest entity only)',\n ),\n actions: z\n .record(z.string(), z.string())\n .optional()\n .describe('Trigger:action pairs for data-elbactions (all entities)'),\n context: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Context properties for data-elbcontext'),\n globals: z\n .record(z.string(), z.union([z.string(), z.number(), z.boolean()]))\n .optional()\n .describe('Global properties for data-elbglobals'),\n link: z\n .record(z.string(), z.string())\n .optional()\n .describe(\n 'Link relationships for data-elblink (id:type, e.g. {\"details\":\"parent\"})',\n ),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: GenerateTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({\n entity,\n data,\n action,\n actions,\n context,\n globals,\n link,\n prefix,\n }) => {\n try {\n const hasInput =\n entity || data || action || actions || context || globals || link;\n if (!hasInput) {\n return mcpError(\n new Error(\n 'Provide at least one parameter (entity, data, action, etc.)',\n ),\n );\n }\n\n const tagger = createTagger(prefix ? { prefix } : undefined);\n // Pass entity to factory (sets naming scope) and call .entity() (creates data-elb attr)\n const t = tagger(entity);\n if (entity) t.entity(entity);\n if (data) t.data(data);\n if (action) t.action(action);\n if (actions) t.actions(actions);\n if (context) t.context(context);\n if (globals) t.globals(globals);\n if (link) t.link(link);\n\n const attributes = t.get();\n\n const attrString = Object.entries(attributes)\n .map(([k, v]) => (v ? `${k}=\"${v}\"` : k))\n .join('\\n ');\n const html = `<div\\n ${attrString}\\n>\\n <!-- content -->\\n</div>`;\n\n return mcpResult({ attributes, html });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { z } from 'zod';\n\nexport const GenerateTaggingOutputShape = {\n attributes: z\n .record(z.string(), z.string())\n .describe('Generated HTML data attributes'),\n html: z.string().describe('Example HTML element with the attributes applied'),\n};\n\nconst eventShape = z.object({\n entity: z.string(),\n action: z.string(),\n data: z.record(z.string(), z.unknown()).optional(),\n trigger: z.string().optional(),\n context: z.record(z.string(), z.unknown()).optional(),\n nested: z.array(z.unknown()).optional(),\n});\n\nexport const ParseTaggingOutputShape = {\n events: z.array(eventShape).describe('Extracted walkerOS events'),\n globals: z.record(z.string(), z.unknown()).describe('Global properties'),\n summary: z.string().describe('Human-readable summary'),\n};\n\nconst validationIssueShape = z.object({\n check: z.string().describe('Name of the validation check'),\n message: z.string().describe('Human-readable description'),\n element: z.string().describe('HTML snippet of the problematic element'),\n});\n\nexport const ValidateTaggingOutputShape = {\n valid: z.boolean().describe('True if no errors found'),\n errors: z.array(validationIssueShape).describe('Critical issues'),\n warnings: z.array(validationIssueShape).describe('Potential issues'),\n info: z.array(validationIssueShape).describe('Informational notes'),\n summary: z.string().describe('Human-readable validation summary'),\n};\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { getAllEvents, getGlobals } from '@walkeros/web-source-browser';\nimport { withDom } from '../lib/dom.js';\nimport { ParseTaggingOutputShape } from '../schemas/output.js';\n\nexport function registerParseTool(server: McpServer) {\n server.registerTool(\n 'parse_tagging',\n {\n title: 'Parse Tagging',\n description:\n 'Parse HTML with data-elb attributes using real DOM parsing (JSDOM). ' +\n 'Extracts all walkerOS events and globals. Use validate_tagging for issue detection.',\n inputSchema: {\n html: z.string().describe('HTML snippet with data-elb attributes'),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: ParseTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ html, prefix: customPrefix }) => {\n try {\n if (!html || !html.trim()) {\n return mcpError(new Error('html is required'));\n }\n\n const prefix = customPrefix || 'data-elb';\n\n return withDom(html, (dom) => {\n const doc = dom.window.document;\n const body = doc.body;\n\n // Extract events using walker parser\n const events = getAllEvents(body, prefix);\n\n // Extract globals\n const globals = getGlobals(prefix, doc);\n\n const summary = `Found ${events.length} event(s), ${Object.keys(globals).length} global(s)`;\n\n return mcpResult({ events, globals, summary });\n });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import { JSDOM } from 'jsdom';\n\n/**\n * Typed view of globalThis for assigning JSDOM globals in Node.js.\n * Walker parser functions read from globalThis.document internally.\n */\ninterface DomGlobals {\n document?: Document;\n window?: Window & typeof globalThis;\n Element?: typeof Element;\n HTMLElement?: typeof HTMLElement;\n HTMLSelectElement?: typeof HTMLSelectElement;\n Node?: typeof Node;\n // Intentionally loose: JSDOM may not provide ShadowRoot, so we polyfill with a stub class\n ShadowRoot?: { new (): unknown; prototype: unknown };\n}\n\nconst globals = globalThis as unknown as DomGlobals;\n\n/**\n * Execute a function with JSDOM globals (document, window) temporarily set.\n * Walker parser functions read from globalThis.document internally.\n */\nexport function withDom<T>(html: string, fn: (dom: JSDOM) => T): T {\n const dom = new JSDOM(html);\n const prevDoc = globals.document;\n const prevWin = globals.window;\n\n const prevElement = globals.Element;\n const prevHTMLElement = globals.HTMLElement;\n const prevHTMLSelectElement = globals.HTMLSelectElement;\n const prevNode = globals.Node;\n\n try {\n globals.document = dom.window.document;\n globals.window = dom.window as unknown as Window & typeof globalThis;\n globals.Element = dom.window.Element as unknown as typeof Element;\n globals.HTMLElement = dom.window\n .HTMLElement as unknown as typeof HTMLElement;\n globals.HTMLSelectElement = dom.window\n .HTMLSelectElement as unknown as typeof HTMLSelectElement;\n globals.Node = dom.window.Node as unknown as typeof Node;\n // Polyfill ShadowRoot if missing (JSDOM may not provide it)\n if (!globals.ShadowRoot) {\n globals.ShadowRoot =\n (dom.window as unknown as DomGlobals).ShadowRoot || class ShadowRoot {};\n }\n return fn(dom);\n } finally {\n if (prevDoc !== undefined) {\n globals.document = prevDoc;\n } else {\n delete globals.document;\n }\n if (prevWin !== undefined) {\n globals.window = prevWin;\n } else {\n delete globals.window;\n }\n if (prevElement !== undefined) {\n globals.Element = prevElement;\n } else {\n delete globals.Element;\n }\n if (prevHTMLElement !== undefined) {\n globals.HTMLElement = prevHTMLElement;\n } else {\n delete globals.HTMLElement;\n }\n if (prevHTMLSelectElement !== undefined) {\n globals.HTMLSelectElement = prevHTMLSelectElement;\n } else {\n delete globals.HTMLSelectElement;\n }\n if (prevNode !== undefined) {\n globals.Node = prevNode;\n } else {\n delete globals.Node;\n }\n }\n}\n","import { z } from 'zod';\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { mcpResult, mcpError } from '@walkeros/core';\nimport { withDom } from '../lib/dom.js';\nimport { ValidateTaggingOutputShape } from '../schemas/output.js';\n\nconst KNOWN_TRIGGERS = [\n 'load',\n 'click',\n 'impression',\n 'visible',\n 'hover',\n 'submit',\n 'wait',\n 'pulse',\n];\n\ntype Issue = { check: string; message: string; element: string };\n\nexport function registerValidateTool(server: McpServer) {\n server.registerTool(\n 'validate_tagging',\n {\n title: 'Validate Tagging',\n description:\n 'Validate HTML data-elb tagging for common mistakes. ' +\n 'Checks for orphan actions, missing entities, unknown triggers, and more.',\n inputSchema: {\n html: z.string().describe('HTML snippet to validate'),\n prefix: z\n .string()\n .optional()\n .describe('Custom prefix (default: data-elb)'),\n },\n outputSchema: ValidateTaggingOutputShape,\n annotations: {\n readOnlyHint: true,\n destructiveHint: false,\n idempotentHint: true,\n openWorldHint: false,\n },\n },\n async ({ html, prefix: customPrefix }) => {\n try {\n if (!html || !html.trim()) {\n return mcpError(new Error('html is required'));\n }\n\n const prefix = customPrefix || 'data-elb';\n\n return withDom(html, (dom) => {\n const body = dom.window.document.body;\n const errors: Issue[] = [];\n const warnings: Issue[] = [];\n const info: Issue[] = [];\n const snip = (el: Element) => el.outerHTML.slice(0, 120);\n const actionAttr = `${prefix}action`;\n const actionsAttr = `${prefix}actions`;\n\n // 1. Empty entity names\n body.querySelectorAll(`[${prefix}]`).forEach((el) => {\n if (!el.getAttribute(prefix)?.trim()) {\n errors.push({\n check: 'empty_entity',\n message: 'Empty entity name',\n element: snip(el),\n });\n }\n });\n\n // 2. Orphan actions\n body\n .querySelectorAll(`[${actionAttr}], [${actionsAttr}]`)\n .forEach((el) => {\n let parent = el.parentElement;\n let hasEntity = el.hasAttribute(prefix);\n while (parent && parent !== body && !hasEntity) {\n if (parent.hasAttribute(prefix)) hasEntity = true;\n parent = parent.parentElement;\n }\n if (!hasEntity) {\n warnings.push({\n check: 'orphan_action',\n message:\n 'Action without entity ancestor (will fire as \"page\" entity)',\n element: snip(el),\n });\n }\n });\n\n // 3. Entities without actions\n body.querySelectorAll(`[${prefix}]`).forEach((el) => {\n const hasAction =\n el.querySelector(`[${actionAttr}], [${actionsAttr}]`) ||\n el.hasAttribute(actionAttr) ||\n el.hasAttribute(actionsAttr);\n if (!hasAction) {\n const name = el.getAttribute(prefix);\n info.push({\n check: 'entity_without_action',\n message: `Entity \"${name}\" has no action — won't produce events without a trigger`,\n element: snip(el),\n });\n }\n });\n\n // 4. Orphan properties\n body.querySelectorAll('*').forEach((el) => {\n Array.from(el.attributes).forEach((attr) => {\n const match = attr.name.match(new RegExp(`^${prefix}-(.+)$`));\n if (!match) return;\n const entityName = match[1];\n if (!entityName) return;\n\n // Walk up to find matching data-elb=\"entityName\"\n let parent: Element | null = el;\n let found = false;\n while (parent && parent !== body) {\n if (parent.getAttribute(prefix) === entityName) {\n found = true;\n break;\n }\n parent = parent.parentElement;\n }\n if (!found) {\n warnings.push({\n check: 'orphan_property',\n message: `Property \"${attr.name}\" without matching entity data-elb=\"${entityName}\" ancestor (may be intentional if using tagger scope)`,\n element: snip(el),\n });\n }\n });\n });\n\n // 5. Unknown triggers\n body\n .querySelectorAll(`[${actionAttr}], [${actionsAttr}]`)\n .forEach((el) => {\n const val =\n el.getAttribute(actionAttr) ||\n el.getAttribute(actionsAttr) ||\n '';\n val.split(';').forEach((pair) => {\n const trigger = pair\n .split(':')[0]\n ?.trim()\n .replace(/\\(.*\\)$/, '');\n if (trigger && !KNOWN_TRIGGERS.includes(trigger)) {\n warnings.push({\n check: 'unknown_trigger',\n message: `Unknown trigger \"${trigger}\" (known: ${KNOWN_TRIGGERS.join(', ')})`,\n element: snip(el),\n });\n }\n });\n });\n\n const valid = errors.length === 0;\n const total = errors.length + warnings.length + info.length;\n const summary = valid\n ? total === 0\n ? 'Valid — no issues found'\n : `Valid — ${warnings.length} warning(s), ${info.length} info(s)`\n : `Invalid — ${errors.length} error(s), ${warnings.length} warning(s), ${info.length} info(s)`;\n\n return mcpResult({ valid, errors, warnings, info, summary });\n });\n } catch (error) {\n return mcpError(error);\n }\n },\n );\n}\n","import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\n\nconst HTML_ATTRIBUTES_DOCS = `# HTML Attributes\n\nTag your web components using \\`data-elb\\` attributes to enable structured event tracking without custom JavaScript.\n\nBy adding a few simple attributes to your markup, you can track user behavior such as clicks, views, form submissions, and more.\n\n## Concept\n\n\\`\\`\\`html\n<!-- Generic usage -->\n<div\n data-elb=\"ENTITY\"\n data-elb-ENTITY=\"KEY:VALUE\"\n data-elbaction=\"TRIGGER:ACTION\" <!-- nearest entity only -->\n data-elbactions=\"TRIGGER:ACTION\" <!-- all entities -->\n data-elbcontext=\"KEY:VALUE\"\n data-elbglobals=\"KEY:VALUE\"\n/>\n\n<!-- Example usage -->\n<div data-elbglobals=\"language:en\">\n <div data-elbcontext=\"test:engagement\">\n <div data-elb=\"promotion\" data-elbaction=\"visible:view\">\n <h1 data-elb-promotion=\"name:Setting up tracking easily\">\n Setting up tracking easily\n </h1>\n <p data-elb-promotion=\"category:analytics\">Analytics</p>\n </div>\n </div>\n</div>\n\\`\\`\\`\n\n## Entity and action\n\nYou define the entity **scope** by setting the \\`data-elb\\` attribute with the name of an entity to an element, e.g. \\`data-elb=\"promotion\"\\`. The default entity is \\`page\\` when no \\`data-elb\\` is set.\n\nAn **action** can be added by setting one of the following attributes on the **same level** or **child elements** in combination with a **matching trigger**:\n\n- **\\`data-elbaction\\`** - applies action to the **nearest entity only**\n- **\\`data-elbactions\\`** - applies action to **all entities** in the DOM hierarchy\n\nBoth attributes use the same syntax, e.g., \\`data-elbaction=\"visible:view\"\\` or \\`data-elbactions=\"click:select\"\\` to fire events when triggered.\n\nTo define the entities' **properties**, set the **composited attribute** \\`data-elb-ENTITY\\` with the key and value, e.g. \\`data-elb-promotion=\"name:tagging is fun;position:overlay\"\\`.\n\n## Triggers\n\n| **Trigger** | **Definition** |\n|-------------|----------------|\n| load | after loading a page when DOM is ready |\n| click | when an element or a child is clicked |\n| impression | after an element has been in the viewport for at least 50% for one second |\n| visible | each time an element re-enters the viewport after being out of view |\n| hover | each time the mouse enters the corresponding element |\n| submit | on valid form submission |\n| wait(ms) | waits ms seconds (15 seconds by default) until triggering |\n| pulse(ms) | recurring trigger every ms seconds (15 seconds by default) if the page is not hidden |\n\n> **Note:** Trigger names are predefined and to be selected from the list, while the action can be an arbitrarily defined name.\n\n### Abbreviation\n\nIf the trigger and action values are equal, e.g. for click events, you can shorten the implementation:\n\n\\`\\`\\`html\n<b data-elbaction=\"click\">\n Use the short version, instead of\n <s data-elbaction=\"click:click\">long</s>\n</b>\n\\`\\`\\`\n\n### Parameters\n\nSome triggers accept optional parameters. Use brackets behind the trigger to pass that information.\n\n\\`\\`\\`html\n<p data-elbaction=\"wait(10):interested\"></p>\n<p data-elbaction=\"pulse(10):interested\"></p>\n\\`\\`\\`\n\n### Action filter\n\nTo prevent an action from triggering unwanted entities, restrict the action to a specific entity by adding the name:\n\n\\`\\`\\`html\n<div data-elb=\"foo\">\n <div data-elb=\"bar\" data-elbaction=\"load:hello(bar)\">\n only the bar hello event fires.\n </div>\n</div>\n\\`\\`\\`\n\n## Linking elements\n\nUse \\`data-elblink\\` to extend the scope of an entity by elements placed somewhere else (like modals). Specific IDs connect linked elements hierarchically as parent or child.\n\n\\`\\`\\`html\n<div data-elb=\"info\" data-elblink=\"details:parent\">...</div>\n...\n<div data-elblink=\"details:child\" data-elbaction=\"visible\">...</div>\n<p data-elblink=\"another:child\">...</p>\n\\`\\`\\`\n\n## Data\n\n### Basic attributes\n\nTo specify data, use the name of the entity. Data attributes must be inside the entity scope or a parent.\n\n\\`\\`\\`html\n<div data-elb-entity=\"source:parent\">\n <div data-elb=\"entity\">\n <p data-elb-entity=\"key:value\">...</p>\n <p data-elb-entity=\"foo:bar\">...</p>\n </div>\n</div>\n\\`\\`\\`\n\n### Type casting\n\nProperty values will be cast to their type, supporting string, number & boolean.\n\n\\`\\`\\`html\n<div data-elb=\"types\">\n <p data-elb-types=\"string:text\">{ string: \"text\" }</p>\n <p data-elb-types=\"int:42;float:3.14\">{ int: 42, float: 3.14 }</p>\n <p data-elb-types=\"bool:true\">{ bool: true }</p>\n</div>\n\\`\\`\\`\n\n### Multiple attributes\n\nUse semicolons to separate key-value pairs. Use single quotes to escape values that contain semicolons.\n\n\\`\\`\\`html\n<p data-elb=\"foo\" data-elb-foo=\"b:a;r\">{ \"b\": \"a\", \"r\": true }</p>\n<p data-elb=\"foo\" data-elb-foo=\"b:'a;r'\">{ \"b\": \"a;r\" }</p>\n\\`\\`\\`\n\n### Dynamic field values\n\nUse \\`#\\` at the beginning followed by the attribute name to access the value of the element attribute.\n\n\\`\\`\\`html\n<input type=\"text\" value=\"blue\" data-elb-product=\"color:#value\" />\n<div data-elb-product=\"name:#innerHTML\">Everyday Ruck Snack</div>\n\\`\\`\\`\n\n### Arrays\n\nAdd the \\`[]\\` suffix to a property's name, such as \\`size[]:m\\`. It will generate de-duplicated data properties.\n\n\\`\\`\\`html\n<div data-elb=\"product\">\n <p data-elb-product=\"size[]:s;size[]:l\"></p>\n <p data-elb-product=\"size[]:l\"></p>\n</div>\n\\`\\`\\`\n\n### Generic properties\n\nLeave the entity name empty (only \\`data-elb-\\`) to add the property to any related entity. Explicitly named properties are preferred over generic ones.\n\n## Globals\n\nProperties that apply to **all events on a page**. Define them anywhere using the \\`data-elbglobals\\` attribute. Globals are collected once, right before the first event.\n\n\\`\\`\\`html\n<div data-elbglobals=\"outof:scope\"></div>\n<div data-elb=\"entity\" data-elb-entity=\"foo:bar\" data-elbaction=\"load:action\" />\n\\`\\`\\`\n\n## Context\n\nContext provides framing information for events (position, test, component). Use \\`data-elbcontext\\` on ancestor elements.\n\n\\`\\`\\`html\n<div data-elbcontext=\"test:engagement\" data-elbglobals=\"plan:paid\">\n <div data-elbcontext=\"recommendation:smart_ai\">\n <div data-elb=\"promotion\" data-elbaction=\"click\" data-elb-promotion=\"title:click me\">\n click me\n </div>\n </div>\n</div>\n\\`\\`\\`\n\nContext properties are tuples with the value and an index, starting at the closest parent (\\`[value, index]\\`).\n\n## Nested entities\n\nA \\`data-elb\\` entity within another \\`data-elb\\` entity is called a nested entity. Nested entities are accessible in the \\`nested\\` array of each event.\n\n\\`\\`\\`html\n<div data-elb=\"mother\" data-elb-mother=\"label:caring\" data-elbaction=\"load:view\">\n <div data-elb=\"son\" data-elb-son=\"age:23\"></div>\n <div data-elb=\"daughter\" data-elb-daughter=\"age:32\">\n <div data-elb=\"baby\" data-elb-baby=\"status:infant\"></div>\n </div>\n</div>\n\\`\\`\\`\n\n## Reserved attributes\n\n\\`data-elb\\`, \\`data-elbaction\\`, \\`data-elbactions\\`, \\`data-elbcontext\\`, \\`data-elbglobals\\`, and \\`data-elblink\\` are reserved attributes. \\`data-elb-*\\` attributes may be arbitrary combinations based on the related entity name.\n`;\n\nconst TAGGER_DOCS = `# Tagger\n\nThe tagger is a utility for generating HTML data attributes that the walkerOS browser source uses for event tracking. It provides a fluent interface to create properly formatted and escaped data attributes for your HTML elements.\n\nPackage: \\`@walkeros/web-source-browser\\`\n\n## Why use the tagger?\n\n- **Consistent formatting** - Ensures data attributes follow walkerOS conventions\n- **Automatic escaping** - Handles special characters in values (semicolons, colons, quotes, backslashes)\n- **Type safety** - Provides TypeScript support for better development experience\n- **Fluent API** - Chainable methods for building complex attribute sets\n- **Maintainability** - Centralized logic for attribute generation\n\n## Installation\n\n\\`\\`\\`bash\nnpm install @walkeros/web-source-browser\n\\`\\`\\`\n\n## Initialization\n\n\\`\\`\\`typescript\nimport { createTagger } from '@walkeros/web-source-browser';\n\n// Create with default configuration\nconst tagger = createTagger();\n\n// Create with custom configuration\nconst customTagger = createTagger({\n prefix: 'data-elb',\n});\n\\`\\`\\`\n\n## Usage examples\n\n### Basic data tagging (without entity)\n\n\\`\\`\\`typescript\nconst tagger = createTagger();\n\n// Using tagger with a scope parameter sets naming for data attributes only\nconst attributes = tagger('product')\n .data('id', '123')\n .data('name', 'Widget')\n .get();\n\n// Result:\n// {\n// 'data-elb-product': 'id:123;name:Widget'\n// }\n// Note: No 'data-elb' entity attribute is created\n\\`\\`\\`\n\n### Entity tagging\n\n\\`\\`\\`typescript\n// To create an entity attribute, use the .entity() method\nconst attributes = tagger()\n .entity('product')\n .data('id', '123')\n .data('name', 'Widget')\n .get();\n\n// Result:\n// {\n// 'data-elb': 'product',\n// 'data-elb-product': 'id:123;name:Widget'\n// }\n\\`\\`\\`\n\n### Action mapping\n\n\\`\\`\\`typescript\nconst attributes = tagger()\n .action('load', 'view')\n .action('click', 'select')\n .get();\n\n// Result:\n// {\n// 'data-elbaction': 'load:view;click:select'\n// }\n\\`\\`\\`\n\n### Context and global properties\n\n\\`\\`\\`typescript\nconst attributes = tagger('product')\n .data('id', 123)\n .context('test', 'engagement')\n .globals('lang', 'en')\n .get();\n\n// Result:\n// {\n// 'data-elb': 'product',\n// 'data-elb-product': 'id:123',\n// 'data-elbcontext': 'test:engagement',\n// 'data-elbglobals': 'lang:en'\n// }\n\\`\\`\\`\n\n## Available methods (API reference)\n\n##### \\`tagger(scope?: string)\\`\n\nCreates a new tagger instance. The optional scope parameter sets the naming scope for data attributes without creating an entity attribute.\n\n\\`\\`\\`typescript\n// Without scope - generic data attributes\ntagger().data('key', 'value');\n// Creates: data-elb-=\"key:value\"\n\n// With scope - scoped data attributes (no entity attribute)\ntagger('product').data('id', '123');\n// Creates: data-elb-product=\"id:123\"\n\\`\\`\\`\n\n##### \\`.entity(name: string)\\`\n\nSets the entity attribute and updates the naming scope for subsequent data calls.\n\n\\`\\`\\`typescript\ntagger().entity('product').data('id', '123');\n// Creates: data-elb=\"product\" data-elb-product=\"id:123\"\n\n// Entity changes the naming scope\ntagger('foo').entity('bar').data('a', 1);\n// Creates: data-elb=\"bar\" data-elb-bar=\"a:1\"\n\\`\\`\\`\n\n##### \\`.data(key: string, value: Property)\\` | \\`.data(object: Properties)\\`\n\nAdds data properties using the current naming scope.\n\n\\`\\`\\`typescript\n// Single property\ntagger('product').data('id', 123);\n// Creates: data-elb-product=\"id:123\"\n\n// Multiple properties\ntagger('product').data({ id: 123, name: 'Widget', price: 99.99 });\n// Creates: data-elb-product=\"id:123;name:Widget;price:99.99\"\n\\`\\`\\`\n\n##### \\`.action(trigger: string, action?: string)\\` | \\`.action(object: Record<string, string>)\\`\n\nAdds action mappings for event triggers. Creates a \\`data-elbaction\\` attribute.\n\n\\`\\`\\`typescript\ntagger().action('load', 'view');\ntagger().action({ load: 'view', click: 'select', impression: 'view' });\n\\`\\`\\`\n\n##### \\`.actions(trigger: string, action?: string)\\` | \\`.actions(object: Record<string, string>)\\`\n\nAdds action mappings for event triggers. Creates a \\`data-elbactions\\` attribute.\n\n\\`\\`\\`typescript\ntagger().actions('load', 'view');\ntagger().actions({ load: 'view', click: 'select', visible: 'visible' });\n\n// Can be combined with action() method\ntagger().action('click', 'select').actions('load', 'view');\n\\`\\`\\`\n\n##### \\`.context(key: string, value: Property)\\` | \\`.context(object: Properties)\\`\n\nAdds context properties.\n\n\\`\\`\\`typescript\ntagger().context('test', 'engagement');\ntagger().context({ test: 'engagement', position: 'header', type: 'promo' });\n\\`\\`\\`\n\n##### \\`.globals(key: string, value: Property)\\` | \\`.globals(object: Properties)\\`\n\nAdds global properties.\n\n\\`\\`\\`typescript\ntagger().globals('lang', 'en');\ntagger().globals({ lang: 'en', plan: 'paid', version: '1.0' });\n\\`\\`\\`\n\n##### \\`.link(id: string, type: string)\\` | \\`.link(object: Record<string, string>)\\`\n\nAdds link relationships between elements.\n\n\\`\\`\\`typescript\ntagger().link('details', 'parent');\ntagger().link({ details: 'parent', modal: 'child', sidebar: 'child' });\n\\`\\`\\`\n\n##### \\`.get()\\`\n\nGenerates the final HTML attributes object.\n\n\\`\\`\\`typescript\n// With naming scope only\nconst attributes = tagger('product').data('id', '123').get();\n// Returns: { 'data-elb-product': 'id:123' }\n\n// With entity attribute\nconst attributes = tagger().entity('product').data('id', '123').get();\n// Returns: { 'data-elb': 'product', 'data-elb-product': 'id:123' }\n\\`\\`\\`\n\nAll methods return the tagger instance for method chaining, except \\`get()\\` which returns the final attributes object.\n\n## Common use cases\n\n### Product listing page\n\n\\`\\`\\`typescript\nfunction ProductCard({ product }) {\n return (\n <div\n {...tagger('product')\n .data({\n id: product.id,\n name: product.name,\n price: product.price,\n category: product.category\n })\n .action('click', 'select')\n .get()}\n >\n {product.name}\n </div>\n );\n}\n\\`\\`\\`\n\n### Shopping cart\n\n\\`\\`\\`typescript\nfunction CartItem({ item }) {\n return (\n <div\n {...tagger()\n .entity('cart')\n .data({\n productId: item.id,\n quantity: item.quantity,\n price: item.price\n })\n .action('click', 'remove')\n .get()}\n >\n {item.name}\n </div>\n );\n}\n\\`\\`\\`\n`;\n\nexport function registerDocResources(server: McpServer) {\n server.resource(\n 'tagging-html-attributes',\n 'walkeros://docs/tagging/html-attributes',\n {\n title: 'walkerOS HTML Attributes Tagging Reference',\n description: 'Complete guide to data-elb HTML attribute tagging',\n mimeType: 'text/markdown',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://docs/tagging/html-attributes',\n mimeType: 'text/markdown' as const,\n text: HTML_ATTRIBUTES_DOCS,\n },\n ],\n }),\n );\n\n server.resource(\n 'tagging-tagger-api',\n 'walkeros://docs/tagging/tagger',\n {\n title: 'walkerOS Tagger API Reference',\n description:\n 'createTagger() fluent API for generating data-elb attributes',\n mimeType: 'text/markdown',\n },\n async () => ({\n contents: [\n {\n uri: 'walkeros://docs/tagging/tagger',\n mimeType: 'text/markdown' as const,\n text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UAAQ,MAAM,qDAAqD;AACrE;AAEA,KAAK,EAAE,MAAM,CAAC,UAAU;AACtB,UAAQ,MAAM,+BAA+B,KAAK;AAClD,UAAQ,KAAK,CAAC;AAChB,CAAC;","names":["z","server","z","globals","t","k","v","z","mcpResult","mcpError","server","z","mcpError","x","globals","O","mcpResult","z","mcpResult","mcpError","server","z","mcpError","mcpResult","server"]}
|
package/package.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/mcp-source-browser",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1-next-1773136823705",
|
|
4
4
|
"description": "MCP server for walkerOS data-elb HTML tagging — generate, parse, and validate tracking attributes with real DOM parsing",
|
|
5
5
|
"license": "MIT",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"type": "module",
|
|
7
8
|
"main": "./dist/index.js",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
@@ -31,16 +32,16 @@
|
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
34
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
34
|
-
"@walkeros/core": "
|
|
35
|
+
"@walkeros/core": "2.2.0-next-1773136823705",
|
|
35
36
|
"jsdom": "^26.0.0"
|
|
36
37
|
},
|
|
37
38
|
"devDependencies": {
|
|
38
39
|
"@types/jsdom": "^21.0.0",
|
|
39
40
|
"@types/node": "^20.0.0",
|
|
40
|
-
"@walkeros/config": "
|
|
41
|
-
"@walkeros/web-source-browser": "
|
|
42
|
-
"@walkeros/collector": "
|
|
43
|
-
"@walkeros/web-core": "
|
|
41
|
+
"@walkeros/config": "2.2.0-next-1773136823705",
|
|
42
|
+
"@walkeros/web-source-browser": "2.2.0-next-1773136823705",
|
|
43
|
+
"@walkeros/collector": "2.2.0-next-1773136823705",
|
|
44
|
+
"@walkeros/web-core": "2.2.0-next-1773136823705"
|
|
44
45
|
},
|
|
45
46
|
"peerDependencies": {
|
|
46
47
|
"zod": "^4.0"
|