@walkeros/mcp-source-browser 0.1.1-next-1773136823705 → 3.0.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/dist/index.js +81 -76
- package/dist/index.js.map +1 -1
- package/package.json +7 -8
package/dist/index.js
CHANGED
|
@@ -12,11 +12,11 @@ import { mcpResult, mcpError } from "@walkeros/core";
|
|
|
12
12
|
import { assign as o } from "@walkeros/core";
|
|
13
13
|
import { assign as r, createLogger as i } from "@walkeros/core";
|
|
14
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
|
-
import { isArray as
|
|
16
|
-
import { tryCatch as
|
|
17
|
-
import { getMappingValue as k, tryCatchAsync as
|
|
18
|
-
import { isObject as
|
|
19
|
-
import { assign as
|
|
15
|
+
import { isArray as b } from "@walkeros/core";
|
|
16
|
+
import { tryCatch as y, tryCatchAsync as v } from "@walkeros/core";
|
|
17
|
+
import { getMappingValue as k, tryCatchAsync as O } from "@walkeros/core";
|
|
18
|
+
import { isObject as C, tryCatchAsync as j, useHooks as q } from "@walkeros/core";
|
|
19
|
+
import { assign as L, getId as Q, isFunction as V, isString as _ } from "@walkeros/core";
|
|
20
20
|
import { isObject as K } from "@walkeros/core";
|
|
21
21
|
import { getGrantedConsent as en, processEventMapping as tn, tryCatchAsync as on, useHooks as sn } from "@walkeros/core";
|
|
22
22
|
import { useHooks as an, tryCatchAsync as cn } from "@walkeros/core";
|
|
@@ -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 a2(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];
|
|
@@ -52,16 +52,16 @@ function c2(e4, t4 = {}, n2 = {}) {
|
|
|
52
52
|
}, {});
|
|
53
53
|
return n2.shallow ? { ...e4, ...r3 } : (Object.assign(e4, r3), e4);
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function c3(e4) {
|
|
56
56
|
return Array.isArray(e4);
|
|
57
57
|
}
|
|
58
|
-
function
|
|
58
|
+
function s(e4) {
|
|
59
59
|
return void 0 !== e4;
|
|
60
60
|
}
|
|
61
|
-
function
|
|
61
|
+
function d3(e4) {
|
|
62
62
|
return "string" == typeof e4;
|
|
63
63
|
}
|
|
64
|
-
function
|
|
64
|
+
function f3(e4) {
|
|
65
65
|
if ("true" === e4) return true;
|
|
66
66
|
if ("false" === e4) return false;
|
|
67
67
|
const t4 = Number(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 T(t2(t4, w3(e4, n2, r3)) || "").reduce((e5, n3) => {
|
|
78
|
+
let [r4, o3] = P(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);
|
|
@@ -86,7 +86,7 @@ function k3(e4, t4, n2, r3 = true) {
|
|
|
86
86
|
o3 = "";
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
return r4.endsWith("[]") ? (r4 = r4.slice(0, -2),
|
|
89
|
+
return r4.endsWith("[]") ? (r4 = r4.slice(0, -2), c3(e5[r4]) || (e5[r4] = []), e5[r4].push(f3(o3))) : e5[r4] = f3(o3), e5;
|
|
90
90
|
}, {});
|
|
91
91
|
}
|
|
92
92
|
function x2(e4, t4 = t.Commands.Prefix) {
|
|
@@ -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, a3 = `[${w3(t4, i3, false)}]`, c4 = (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, a3)) && c4(r3), R(r3, a3, c4), 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,12 +120,12 @@ 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
|
|
124
|
-
if (!
|
|
125
|
-
const t5 = "page", r4 = `[${w3(n2, t5)}]`, [o5, i4] =
|
|
126
|
-
|
|
123
|
+
const a3 = T(o4.actionParams || "", ",").reduce((e5, t5) => (e5[g3(t5)] = true, e5), {}), c4 = A(n2, e4, a3, i3);
|
|
124
|
+
if (!c4.length) {
|
|
125
|
+
const t5 = "page", r4 = `[${w3(n2, t5)}]`, [o5, i4] = L2(e4, r4, n2, t5);
|
|
126
|
+
c4.push({ entity: t5, data: o5, nested: [], context: i4 });
|
|
127
127
|
}
|
|
128
|
-
|
|
128
|
+
c4.forEach((e5) => {
|
|
129
129
|
r3.push({ entity: e5.entity, action: o4.action, data: e5.data, trigger: t4, context: e5.context, nested: e5.nested });
|
|
130
130
|
});
|
|
131
131
|
}), r3) : r3;
|
|
@@ -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 S(t4, `[${n2}]`, (t5) => {
|
|
137
|
+
r3 = a2(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 T(e4).forEach((e5) => {
|
|
143
|
+
const [n2, r3] = P(e5), [o3, i3] = W(n2);
|
|
144
144
|
if (!o3) return;
|
|
145
|
-
let [
|
|
146
|
-
|
|
145
|
+
let [a3, c4] = W(r3 || "");
|
|
146
|
+
a3 = a3 || o3, t4[o3] || (t4[o3] = []), t4[o3].push({ trigger: o3, triggerParams: i3, action: a3, actionParams: c4 });
|
|
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 a3 = C2(e4, i3, t4, n2);
|
|
154
|
+
if (a3 && (o3.push(a3), r3)) break;
|
|
155
155
|
i3 = $(e4, i3);
|
|
156
156
|
}
|
|
157
157
|
return o3;
|
|
@@ -159,12 +159,12 @@ function A(e4, t4, n2, r3 = false) {
|
|
|
159
159
|
function C2(e4, t4, n2, r3) {
|
|
160
160
|
const o3 = t2(t4, w3(e4));
|
|
161
161
|
if (!o3 || r3 && !r3[o3]) return null;
|
|
162
|
-
const i3 = [t4],
|
|
162
|
+
const i3 = [t4], c4 = `[${w3(e4, o3)}],[${w3(e4, "")}]`, s2 = w3(e4, t.Commands.Link, false);
|
|
163
163
|
let l2 = {};
|
|
164
|
-
const u2 = [], [
|
|
165
|
-
|
|
166
|
-
const [n3, r4] =
|
|
167
|
-
"parent" === r4 &&
|
|
164
|
+
const u2 = [], [d4, f4] = L2(n2 || t4, c4, e4, o3);
|
|
165
|
+
R(t4, `[${s2}]`, (t5) => {
|
|
166
|
+
const [n3, r4] = P(t2(t5, s2));
|
|
167
|
+
"parent" === r4 && R(document.body, `[${s2}="${n3}:child"]`, (t6) => {
|
|
168
168
|
i3.push(t6);
|
|
169
169
|
const n4 = C2(e4, t6);
|
|
170
170
|
n4 && u2.push(n4);
|
|
@@ -172,56 +172,56 @@ function C2(e4, t4, n2, r3) {
|
|
|
172
172
|
});
|
|
173
173
|
const m3 = [];
|
|
174
174
|
i3.forEach((e5) => {
|
|
175
|
-
e5.matches(
|
|
175
|
+
e5.matches(c4) && m3.push(e5), R(e5, c4, (e6) => m3.push(e6));
|
|
176
176
|
});
|
|
177
177
|
let g4 = {};
|
|
178
178
|
return m3.forEach((t5) => {
|
|
179
|
-
g4 =
|
|
180
|
-
}), l2 =
|
|
181
|
-
|
|
179
|
+
g4 = a2(g4, k3(e4, t5, "")), l2 = a2(l2, k3(e4, t5, o3));
|
|
180
|
+
}), l2 = a2(a2(g4, l2), d4), i3.forEach((t5) => {
|
|
181
|
+
R(t5, `[${w3(e4)}]`, (t6) => {
|
|
182
182
|
const n3 = C2(e4, t6);
|
|
183
183
|
n3 && u2.push(n3);
|
|
184
184
|
});
|
|
185
|
-
}), { entity: o3, data: l2, context:
|
|
185
|
+
}), { entity: o3, data: l2, context: f4, nested: u2 };
|
|
186
186
|
}
|
|
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] =
|
|
190
|
+
const [e5, r3] = P(t2(t4, n2));
|
|
191
191
|
if ("child" === r3) {
|
|
192
192
|
let t5 = null;
|
|
193
|
-
return
|
|
193
|
+
return S(document, `[${n2}="${e5}:parent"]`, (e6) => {
|
|
194
194
|
t5 || (t5 = e6);
|
|
195
195
|
}), t5;
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
return !t4.parentElement && t4.getRootNode && t4.getRootNode() instanceof ShadowRoot ? t4.getRootNode().host : t4.parentElement;
|
|
199
199
|
}
|
|
200
|
-
function
|
|
200
|
+
function L2(e4, t4, n2, r3) {
|
|
201
201
|
let o3 = {};
|
|
202
202
|
const i3 = {};
|
|
203
|
-
let
|
|
204
|
-
const
|
|
203
|
+
let c4 = e4;
|
|
204
|
+
const s2 = `[${w3(n2, t.Commands.Context, false)}]`;
|
|
205
205
|
let l2 = 0;
|
|
206
|
-
for (;
|
|
206
|
+
for (; c4; ) c4.matches(t4) && (o3 = a2(k3(n2, c4, ""), o3), o3 = a2(k3(n2, c4, r3), o3)), c4.matches(s2) && (Object.entries(k3(n2, c4, t.Commands.Context, false)).forEach(([e5, t5]) => {
|
|
207
207
|
t5 && !i3[e5] && (i3[e5] = [t5, l2]);
|
|
208
|
-
}), ++l2),
|
|
208
|
+
}), ++l2), c4 = $(n2, c4);
|
|
209
209
|
return [o3, i3];
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function S(e4, t4, n2) {
|
|
212
212
|
e4.querySelectorAll(t4).forEach(n2);
|
|
213
213
|
}
|
|
214
|
-
function
|
|
215
|
-
e4.querySelectorAll(t4).forEach(n2), e4 instanceof Element && e4.shadowRoot &&
|
|
216
|
-
e5.shadowRoot &&
|
|
214
|
+
function R(e4, t4, n2) {
|
|
215
|
+
e4.querySelectorAll(t4).forEach(n2), e4 instanceof Element && e4.shadowRoot && R(e4.shadowRoot, t4, n2), e4.querySelectorAll("*").forEach((e5) => {
|
|
216
|
+
e5.shadowRoot && R(e5.shadowRoot, t4, n2);
|
|
217
217
|
});
|
|
218
218
|
}
|
|
219
|
-
function
|
|
219
|
+
function T(e4, t4 = ";") {
|
|
220
220
|
if (!e4) return [];
|
|
221
221
|
const n2 = new RegExp(`(?:[^${t4}']+|'[^']*')+`, "ig");
|
|
222
222
|
return e4.match(n2) || [];
|
|
223
223
|
}
|
|
224
|
-
function
|
|
224
|
+
function P(e4) {
|
|
225
225
|
const [t4, n2] = e4.split(/:(.+)/, 2);
|
|
226
226
|
return [g3(t4), g3(n2)];
|
|
227
227
|
}
|
|
@@ -233,44 +233,49 @@ var ge = {};
|
|
|
233
233
|
t3(ge, { env: () => pe, step: () => we });
|
|
234
234
|
var pe = {};
|
|
235
235
|
t3(pe, { push: () => ve });
|
|
236
|
-
var
|
|
236
|
+
var be = () => {
|
|
237
237
|
};
|
|
238
|
-
var
|
|
239
|
-
var ye = { error:
|
|
238
|
+
var he = () => () => Promise.resolve({ ok: true });
|
|
239
|
+
var ye = { error: be, warn: be, info: be, debug: be, throw: (e4) => {
|
|
240
240
|
throw "string" == typeof e4 ? new Error(e4) : e4;
|
|
241
|
-
}, json:
|
|
241
|
+
}, json: be, scope: () => ye };
|
|
242
242
|
var ve = { get push() {
|
|
243
|
-
return
|
|
243
|
+
return he();
|
|
244
244
|
}, get command() {
|
|
245
|
-
return
|
|
245
|
+
return he();
|
|
246
246
|
}, get elb() {
|
|
247
|
-
return
|
|
247
|
+
return he();
|
|
248
248
|
}, get window() {
|
|
249
|
-
return { addEventListener:
|
|
249
|
+
return { addEventListener: be, removeEventListener: be, 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 };
|
|
250
250
|
}, get document() {
|
|
251
|
-
return { addEventListener:
|
|
251
|
+
return { addEventListener: be, removeEventListener: be, querySelector: be, querySelectorAll: () => [], getElementById: be, getElementsByClassName: () => [], getElementsByTagName: () => [], createElement: () => ({ setAttribute: be, getAttribute: be, addEventListener: be, removeEventListener: be }), body: { appendChild: be, removeChild: be }, documentElement: { scrollTop: 0, scrollLeft: 0 }, readyState: "complete", title: "Test Page", referrer: "", cookie: "" };
|
|
252
252
|
}, logger: ye };
|
|
253
253
|
var we = {};
|
|
254
|
-
t3(we, { clickEvent: () => xe, pageView: () => ke });
|
|
254
|
+
t3(we, { clickEvent: () => xe, contextAndGlobals: () => Ce, dataAttributeTypes: () => Ae, impressionEvent: () => Oe, nestedEntities: () => je, pageView: () => ke, submitEvent: () => Ee });
|
|
255
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
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
|
-
|
|
257
|
+
var Ee = { in: { trigger: "submit", element: 'form[data-elb="signup"]', attributes: { "data-elb": "signup", "data-elb-signup": "plan:premium", "data-elbaction": "submit:complete" } }, out: { name: "signup complete", data: { plan: "premium" }, trigger: "submit", entity: "signup", action: "complete" } };
|
|
258
|
+
var Oe = { in: { trigger: "impression", element: 'div[data-elb="banner"]', attributes: { "data-elb": "banner", "data-elb-banner": "type:promotional;position:sidebar", "data-elbaction": "impression:view" } }, out: { name: "banner view", data: { type: "promotional", position: "sidebar" }, trigger: "impression", entity: "banner", action: "view" } };
|
|
259
|
+
var je = { in: { trigger: "load", element: 'div[data-elb="product"]', attributes: { "data-elb": "product", "data-elb-product": "id:SKU-42;name:Sneakers", "data-elbaction": "load:view" }, children: [{ "data-elb": "size", "data-elb-size": "selected:large;inStock:true" }] }, out: { name: "product view", data: { id: "SKU-42", name: "Sneakers" }, trigger: "load", entity: "product", action: "view", nested: [{ entity: "size", data: { selected: "large", inStock: true } }] } };
|
|
260
|
+
var Ae = { in: { trigger: "click", element: 'div[data-elb="product"]', attributes: { "data-elb": "product", "data-elb-product": "price:99.99;available:true;colors[]:red;colors[]:blue", "data-elbaction": "click:select" } }, out: { name: "product select", data: { price: 99.99, available: true, colors: ["red", "blue"] }, trigger: "click", entity: "product", action: "select" } };
|
|
261
|
+
var Ce = { in: { trigger: "click", element: 'div[data-elb="cta"]', attributes: { "data-elb": "cta", "data-elb-cta": "label:Try Now", "data-elbaction": "click:signup" }, context: { test: "engagement_flow" }, globals: { language: "en", plan: "premium" } }, out: { name: "cta signup", data: { label: "Try Now" }, trigger: "click", entity: "cta", action: "signup", context: { test: ["engagement_flow", 0] }, globals: { language: "en", plan: "premium" } } };
|
|
262
|
+
function $e(e4 = {}) {
|
|
258
263
|
const t4 = e4.prefix || "data-elb";
|
|
259
264
|
return function(e5) {
|
|
260
265
|
let n2, r3 = e5;
|
|
261
|
-
const o3 = {}, i3 = {},
|
|
262
|
-
function
|
|
266
|
+
const o3 = {}, i3 = {}, a3 = {}, c4 = {}, l2 = {}, u2 = {};
|
|
267
|
+
function f4(e6) {
|
|
263
268
|
return Object.entries(e6).map(([e7, t5]) => `${e7}:${(function(e8) {
|
|
264
|
-
if (!
|
|
269
|
+
if (!s(e8) || null === e8) return "undefined";
|
|
265
270
|
let t6 = String(e8);
|
|
266
271
|
return t6 = t6.replace(/\\/g, "\\\\"), t6 = t6.replace(/;/g, "\\;"), t6 = t6.replace(/:/g, "\\:"), t6 = t6.replace(/'/g, "\\'"), t6;
|
|
267
272
|
})(t5)}`).join(";");
|
|
268
273
|
}
|
|
269
274
|
const m3 = { entity: (e6) => (n2 = e6, r3 = e6, m3), data(e6, t5) {
|
|
270
275
|
const n3 = null != r3 ? r3 : "";
|
|
271
|
-
return o3[n3] || (o3[n3] = {}),
|
|
276
|
+
return o3[n3] || (o3[n3] = {}), d3(e6) ? o3[n3][e6] = t5 : Object.assign(o3[n3], e6), m3;
|
|
272
277
|
}, action(e6, t5) {
|
|
273
|
-
if (
|
|
278
|
+
if (d3(e6)) if (s(t5)) i3[e6] = t5;
|
|
274
279
|
else if (e6.includes(":")) {
|
|
275
280
|
const [t6, n3] = e6.split(":", 2);
|
|
276
281
|
i3[t6] = n3;
|
|
@@ -278,20 +283,20 @@ function Ee(e4 = {}) {
|
|
|
278
283
|
else Object.assign(i3, e6);
|
|
279
284
|
return m3;
|
|
280
285
|
}, actions(e6, t5) {
|
|
281
|
-
if (
|
|
286
|
+
if (d3(e6)) if (s(t5)) a3[e6] = t5;
|
|
282
287
|
else if (e6.includes(":")) {
|
|
283
288
|
const [t6, n3] = e6.split(":", 2);
|
|
284
|
-
|
|
285
|
-
} else
|
|
286
|
-
else Object.assign(
|
|
289
|
+
a3[t6] = n3;
|
|
290
|
+
} else a3[e6] = e6;
|
|
291
|
+
else Object.assign(a3, e6);
|
|
287
292
|
return m3;
|
|
288
|
-
}, context: (e6, t5) => (
|
|
293
|
+
}, context: (e6, t5) => (d3(e6) ? c4[e6] = t5 : Object.assign(c4, e6), m3), globals: (e6, t5) => (d3(e6) ? l2[e6] = t5 : Object.assign(l2, e6), m3), link: (e6, t5) => (d3(e6) ? u2[e6] = t5 : Object.assign(u2, e6), m3), get() {
|
|
289
294
|
const e6 = {};
|
|
290
295
|
return n2 && (e6[t4] = n2), Object.entries(o3).forEach(([n3, r4]) => {
|
|
291
296
|
if (Object.keys(r4).length > 0) {
|
|
292
|
-
e6[n3 ? `${t4}-${n3}` : `${t4}-`] =
|
|
297
|
+
e6[n3 ? `${t4}-${n3}` : `${t4}-`] = f4(r4);
|
|
293
298
|
}
|
|
294
|
-
}), Object.keys(i3).length > 0 && (e6[`${t4}action`] =
|
|
299
|
+
}), Object.keys(i3).length > 0 && (e6[`${t4}action`] = f4(i3)), Object.keys(a3).length > 0 && (e6[`${t4}actions`] = f4(a3)), Object.keys(c4).length > 0 && (e6[`${t4}context`] = f4(c4)), Object.keys(l2).length > 0 && (e6[`${t4}globals`] = f4(l2)), Object.keys(u2).length > 0 && (e6[`${t4}link`] = f4(u2)), e6;
|
|
295
300
|
} };
|
|
296
301
|
return m3;
|
|
297
302
|
};
|
|
@@ -379,7 +384,7 @@ function registerGenerateTool(server2) {
|
|
|
379
384
|
)
|
|
380
385
|
);
|
|
381
386
|
}
|
|
382
|
-
const tagger =
|
|
387
|
+
const tagger = $e(prefix ? { prefix } : void 0);
|
|
383
388
|
const t4 = tagger(entity);
|
|
384
389
|
if (entity) t4.entity(entity);
|
|
385
390
|
if (data) t4.data(data);
|
|
@@ -1137,7 +1142,7 @@ function registerDocResources(server2) {
|
|
|
1137
1142
|
// src/index.ts
|
|
1138
1143
|
var server = new McpServer({
|
|
1139
1144
|
name: "walkeros-source-browser",
|
|
1140
|
-
version: "0.
|
|
1145
|
+
version: "3.0.0"
|
|
1141
1146
|
});
|
|
1142
1147
|
registerGenerateTool(server);
|
|
1143
1148
|
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 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: TAGGER_DOCS,\n },\n ],\n }),\n );\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,KAAAA,UAAS;AAElB,SAAS,WAAW,gBAAgB;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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A;AAAA;AAAA;AAAA;AAAA;AAiQb,SAAS,qBAAqBE,SAAmB;AACtD,EAAAA,QAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,MACX,UAAU;AAAA,QACR;AAAA,UACE,KAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAAA,QAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aACE;AAAA,MACF,UAAU;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,MACX,UAAU;AAAA,QACR;AAAA,UACE,KAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AN/eA,IAAM,SAAS,IAAI,UAAU;AAAA,EAC3B,MAAM;AAAA,EACN,SAAS;AACX,CAAC;AAED,qBAAqB,MAAM;AAC3B,kBAAkB,MAAM;AACxB,qBAAqB,MAAM;AAC3B,qBAAqB,MAAM;AAE3B,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,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"]}
|
|
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: TAGGER_DOCS,\n },\n ],\n }),\n );\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;;;ACDrC,SAAS,KAAAA,UAAS;AAElB,SAAS,WAAW,gBAAgB;A;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiQb,SAAS,qBAAqBE,SAAmB;AACtD,EAAAA,QAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aAAa;AAAA,MACb,UAAU;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,MACX,UAAU;AAAA,QACR;AAAA,UACE,KAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,EAAAA,QAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,aACE;AAAA,MACF,UAAU;AAAA,IACZ;AAAA,IACA,aAAa;AAAA,MACX,UAAU;AAAA,QACR;AAAA,UACE,KAAK;AAAA,UACL,UAAU;AAAA,UACV,MAAM;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AACF;;;AN/eA,IAAM,SAAS,IAAI,UAAU;AAAA,EAC3B,MAAM;AAAA,EACN,SAAS;AACX,CAAC;AAED,qBAAqB,MAAM;AAC3B,kBAAkB,MAAM;AACxB,qBAAqB,MAAM;AAC3B,qBAAqB,MAAM;AAE3B,eAAe,OAAO;AACpB,QAAM,YAAY,IAAI,qBAAqB;AAC3C,QAAM,OAAO,QAAQ,SAAS;AAC9B,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,9 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@walkeros/mcp-source-browser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "3.0.0",
|
|
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,
|
|
7
6
|
"type": "module",
|
|
8
7
|
"main": "./dist/index.js",
|
|
9
8
|
"types": "./dist/index.d.ts",
|
|
@@ -32,16 +31,16 @@
|
|
|
32
31
|
},
|
|
33
32
|
"dependencies": {
|
|
34
33
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
35
|
-
"@walkeros/core": "
|
|
34
|
+
"@walkeros/core": "^3.0.0",
|
|
36
35
|
"jsdom": "^26.0.0"
|
|
37
36
|
},
|
|
38
37
|
"devDependencies": {
|
|
39
38
|
"@types/jsdom": "^21.0.0",
|
|
40
39
|
"@types/node": "^20.0.0",
|
|
41
|
-
"@walkeros/config": "
|
|
42
|
-
"@walkeros/web-source-browser": "
|
|
43
|
-
"@walkeros/collector": "
|
|
44
|
-
"@walkeros/web-core": "
|
|
40
|
+
"@walkeros/config": "*",
|
|
41
|
+
"@walkeros/web-source-browser": "^3.0.0",
|
|
42
|
+
"@walkeros/collector": "^3.0.0",
|
|
43
|
+
"@walkeros/web-core": "^3.0.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
47
46
|
"zod": "^4.0"
|
|
@@ -62,7 +61,7 @@
|
|
|
62
61
|
},
|
|
63
62
|
"repository": {
|
|
64
63
|
"url": "git+https://github.com/elbwalker/walkerOS.git",
|
|
65
|
-
"directory": "packages/
|
|
64
|
+
"directory": "packages/mcps/source-browser"
|
|
66
65
|
},
|
|
67
66
|
"author": "elbwalker <hello@elbwalker.com>",
|
|
68
67
|
"homepage": "https://github.com/elbwalker/walkerOS#readme",
|