@inizioevoke/veeva-astroclm 1.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.
Files changed (67) hide show
  1. package/.claude/settings.local.json +10 -0
  2. package/.claude/skills/evoke-analytics-auditor/SKILL.md +509 -0
  3. package/.claude/skills/evoke-astro-core/SKILL.md +395 -0
  4. package/.claude/skills/evoke-page-manager/SKILL.md +75 -0
  5. package/.claude/skills/evoke-veeva-config-manager/SKILL.md +17 -0
  6. package/.claude/skills/evoke-veeva-config-manager/create.md +189 -0
  7. package/.claude/skills/evoke-veeva-config-manager/manage.md +48 -0
  8. package/.editorconfig +12 -0
  9. package/.env.development +3 -0
  10. package/.env.veeva-client +1 -0
  11. package/.env.veeva-client-training +2 -0
  12. package/.env.veeva-evoke +4 -0
  13. package/README.md +43 -0
  14. package/_contents.yml.example +6 -0
  15. package/astro.config.ts +36 -0
  16. package/package.json +40 -0
  17. package/public/astroclm.png +0 -0
  18. package/public/favicon.png +0 -0
  19. package/public/shared/salesforce.js +2586 -0
  20. package/public/shared/vault.js +2417 -0
  21. package/src/components/content/readme.md +1 -0
  22. package/src/components/isi/ISIContent.tsx +137 -0
  23. package/src/components/isi/_isi.scss +22 -0
  24. package/src/components/nav/MainNav/MainNav.astro +20 -0
  25. package/src/components/nav/MainNav/MainNav.tsx +36 -0
  26. package/src/components/nav/NavList.tsx +66 -0
  27. package/src/components/ui/Button.astro +19 -0
  28. package/src/components/ui/Image.astro +36 -0
  29. package/src/components/ui/IvaConsole/IvaConsole.astro +12 -0
  30. package/src/components/ui/IvaConsole/IvaConsole.scss +62 -0
  31. package/src/components/ui/IvaConsole/IvaConsole.ts +144 -0
  32. package/src/components/ui/Link.astro +39 -0
  33. package/src/components/ui/Link.tsx +36 -0
  34. package/src/components/ui/NavLink.astro +46 -0
  35. package/src/components/ui/NavLink.tsx +41 -0
  36. package/src/components/ui/VeevaControls/VeevaControls.astro +48 -0
  37. package/src/components/ui/VeevaControls/VeevaControls.scss +145 -0
  38. package/src/components/ui/VeevaLink.astro +36 -0
  39. package/src/data/pages.tsx +50 -0
  40. package/src/env.d.ts +14 -0
  41. package/src/lib/client/context.ts +45 -0
  42. package/src/lib/client/main.ts +54 -0
  43. package/src/lib/client/readme.md +1 -0
  44. package/src/lib/client/swipe-nav.ts +35 -0
  45. package/src/lib/client/utils.ts +58 -0
  46. package/src/lib/server/readme.md +1 -0
  47. package/src/lib/server/screen.ts +10 -0
  48. package/src/middleware.ts.bak +12 -0
  49. package/src/scss/_mixins.scss +1 -0
  50. package/src/scss/_variables.scss +6 -0
  51. package/src/scss/ipads.scss +89 -0
  52. package/src/shared/img/veeva/veeva-action.png +0 -0
  53. package/src/shared/img/veeva/veeva-desktop-action.png +0 -0
  54. package/src/shared/img/veeva/veeva-desktop-navigation.png +0 -0
  55. package/src/shared/img/veeva/veeva-desktop-next.png +0 -0
  56. package/src/shared/img/veeva/veeva-desktop-previous.png +0 -0
  57. package/src/shared/img/veeva/veeva-highlighter.png +0 -0
  58. package/src/shared/img/veeva/veeva-history-back.png +0 -0
  59. package/src/shared/img/veeva/veeva-history-forward.png +0 -0
  60. package/src/shared/img/veeva/veeva-navigation.png +0 -0
  61. package/src/shared/img/veeva/veeva-reactions.png +0 -0
  62. package/tasks/page-manager.ts +4 -0
  63. package/tasks/util.ts +7 -0
  64. package/tasks/veeva-config.ts +4 -0
  65. package/tasks/veeva-deploy.ts +21 -0
  66. package/tsconfig.json +23 -0
  67. package/veeva-metadata.js +461 -0
@@ -0,0 +1,10 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "mcp__plugin_playwright_playwright__browser_snapshot",
5
+ "mcp__plugin_playwright_playwright__browser_click",
6
+ "mcp__plugin_playwright_playwright__browser_wait_for",
7
+ "mcp__plugin_playwright_playwright__browser_console_messages"
8
+ ]
9
+ }
10
+ }
@@ -0,0 +1,509 @@
1
+ ---
2
+ name: evoke-analytics-auditor
3
+ description: >
4
+ Starts the Astro dev server, visits every page, clicks configurable CSS selectors,
5
+ captures all browser console messages, and writes a deduplication report of unique
6
+ log messages grouped by page. Use this skill whenever the user asks to audit,
7
+ record, or report on analytics, metrics, or events.
8
+ ---
9
+
10
+ # Analytics Auditor Skill
11
+
12
+ ## Purpose
13
+
14
+ Start the dev server, click interactive elements, harvest every `console.*` message,
15
+ and produce a timestamped report of **unique messages** (grouped by page) written to
16
+ `analytics-audit-report-<timestamp>.md` in the project root.
17
+
18
+ ---
19
+
20
+ ## Instructions
21
+
22
+ ### Step 0 — Load the Playwright MCP tool schemas
23
+
24
+ Before doing anything else, call:
25
+ ```
26
+ ToolSearch({ query: "select:mcp__plugin_playwright_playwright__browser_navigate,mcp__plugin_playwright_playwright__browser_click,mcp__plugin_playwright_playwright__browser_console_messages,mcp__plugin_playwright_playwright__browser_snapshot,mcp__plugin_playwright_playwright__browser_wait_for,mcp__plugin_playwright_playwright__browser_evaluate,mcp__plugin_playwright_playwright__browser_handle_dialog,mcp__plugin_playwright_playwright__browser_close" })
27
+ ```
28
+
29
+ You will need all of those tools to be loaded and callable.
30
+
31
+ ---
32
+
33
+ ### Step 1 — Start the dev server and detect its port
34
+
35
+ Always start a fresh dev server. Use a timestamped log filename so the poll can never
36
+ accidentally read the port from a previously running server's log:
37
+
38
+ ```bash
39
+ ASTRO_LOG="/tmp/astro-dev-$(date +%s).log"
40
+ npm run dev > "$ASTRO_LOG" 2>&1 &
41
+ echo "$ASTRO_LOG"
42
+ ```
43
+
44
+ Save the log path printed by the `echo` — you will need it for polling and cleanup.
45
+
46
+ Then poll the log file until Astro prints its ready URL. **Do not use `grep -P`** —
47
+ it is not supported on Windows. Use this portable polling loop instead:
48
+
49
+ ```bash
50
+ port=""
51
+ for i in $(seq 1 30); do
52
+ port=$(grep -o 'localhost:[0-9]*' "$ASTRO_LOG" | head -1 | grep -o '[0-9]*$')
53
+ if [ -n "$port" ]; then echo "$port"; break; fi
54
+ sleep 1
55
+ done
56
+ if [ -z "$port" ]; then
57
+ echo "ERROR: dev server did not produce a port within 30 seconds" >&2
58
+ cat "$ASTRO_LOG" >&2
59
+ exit 1
60
+ fi
61
+ ```
62
+
63
+ If the loop exits without a port, stop and report the error to the user — do not
64
+ continue with subsequent steps.
65
+
66
+ Extract the port from that output and use it as `DEV_PORT` for all subsequent URLs
67
+ (e.g. `http://localhost:${DEV_PORT}/home/`).
68
+
69
+ Once the port has been extracted, delete the log file:
70
+ ```bash
71
+ rm -f "$ASTRO_LOG"
72
+ ```
73
+
74
+ ---
75
+
76
+ ### Step 2 — Capture timestamp, discover pages, and define click selectors
77
+
78
+ #### Report timestamp
79
+
80
+ Before starting any browser work, generate the timestamp that will be used in the
81
+ report filename. Use `browser_evaluate` once the browser is open, or compute it via
82
+ any available JS execution context:
83
+
84
+ ```js
85
+ new Date().toISOString().replace(/[^\d]/g, '').substring(0, 14)
86
+ ```
87
+
88
+ Store the result as **`TIMESTAMP`** (e.g. `20260616143022`). It is used once in Step 5
89
+ to name the output file.
90
+
91
+ #### Page URLs
92
+
93
+ Do **not** hardcode the page list. Instead, read the `src/pages` directory to discover
94
+ all `.astro` files:
95
+ ```bash
96
+ find src/pages -name "*.astro" | sort
97
+ ```
98
+
99
+ **Skip any file whose name contains `[` or `]`** — these are dynamic route templates
100
+ that require parameter values and cannot be visited directly. Record each skipped file
101
+ in a list for the report's header section.
102
+
103
+ Convert each remaining file path to a URL route using these rules:
104
+ - Strip the `src/pages/` prefix and `.astro` extension
105
+ - A file named `index.astro` maps to `/`
106
+ - All other files map to `/<name>/` (trailing slash)
107
+ - Nested files (e.g. `src/pages/about/moa.astro`) map to `/about/moa/`
108
+
109
+ Prepend `http://localhost:${DEV_PORT}` from Step 1 to form the full URL.
110
+
111
+ Example — `src/pages/home.astro` → `http://localhost:${DEV_PORT}/home/`
112
+
113
+ #### Click selectors
114
+
115
+ **Before finalizing the selector list, read `src/lib/client/main.ts`** (and any other
116
+ files it imports from `src/lib/client/`) and check whether `IVA.configure()` or
117
+ `IVA.init()` is called with a config object that contains any of these properties:
118
+
119
+ - **`selectors.clickable`** — if present, it is a CSS selector string that replaces
120
+ the non-`[data-evotrk]` selectors in the default list. Replace those defaults with
121
+ this value, but **keep `[data-evotrk]`** (or the `attrs.data`-derived selector, see
122
+ below) in the final list.
123
+
124
+ - **`attrs.data`** — if present, it is the attribute name used instead of
125
+ `data-evotrk` to mark tracked elements. It may or may not include surrounding
126
+ brackets. Normalize it: if it already starts with `[`, use it as-is; otherwise wrap
127
+ it as `[<value>]`. Replace `[data-evotrk]` in the selector list with this normalized
128
+ value.
129
+
130
+ - **`attrs.navigateDisabled`** — if present, it is the attribute name IVA checks to
131
+ decide whether to skip its `navigate()` call. Store this value (without brackets)
132
+ as **`NAVIGATE_DISABLED_ATTR`** for use in Step 3. Default if absent:
133
+ `data-navigate-disabled`.
134
+
135
+ - **`attrs.gotoslide`** — if present, it is the attribute name IVA uses to identify
136
+ which `<a>` elements it has bound its click handler to. Store this value (without
137
+ brackets) as **`GOTO_SLIDE_ATTR`** for use in Step 3. Default if absent:
138
+ `data-gotoslide`.
139
+
140
+ If none of these properties are found, use this default list unchanged:
141
+
142
+ ```
143
+ [data-evotrk]
144
+ a
145
+ button
146
+ [role="button"]
147
+ [role="link"]
148
+ [role="tab"]
149
+ input[type="checkbox"]
150
+ input[type="radio"]
151
+ [role="checkbox"]
152
+ [role="radio"]
153
+ ```
154
+
155
+ On every page, query for all elements matching the final selector list and click each
156
+ one that is visible and not disabled.
157
+
158
+ Use a single combined CSS selector string joined with commas when querying the page.
159
+ The user may supply additional or replacement selectors in their request — merge them
160
+ into this list rather than replacing it entirely unless the user says otherwise.
161
+
162
+ ---
163
+
164
+ ### Step 3 — Per-page procedure
165
+
166
+ For **each page URL** discovered in Step 2, also initialize a **`pageMessages`** list
167
+ (reset to empty for each new page) that accumulates all console messages seen on the
168
+ current page.
169
+
170
+ 1. Navigate to the page URL.
171
+ 2. Wait for the page to load (use `browser_wait_for` with a known selector like `h1`).
172
+ 3. **Disable navigation on all links** using `browser_evaluate`. Pass
173
+ `NAVIGATE_DISABLED_ATTR` as the attribute name. This approach is reliable because
174
+ it works at the DOM level before any click handler fires:
175
+
176
+ - **IVA-bound links** — if the `<a>` element has the `GOTO_SLIDE_ATTR` attribute,
177
+ IVA has registered its click handler on it. Set `<NAVIGATE_DISABLED_ATTR>="true"`
178
+ on the element so IVA skips its `navigate()` call. IVA already calls
179
+ `e.preventDefault()` unconditionally, so browser default navigation is also
180
+ suppressed.
181
+
182
+ - **All other links** — if the `<a>` element does not have `GOTO_SLIDE_ATTR`
183
+ (external links, PDF links, plain anchors, etc.), remove the `href` attribute
184
+ entirely (store the original value in `data-original-href`). Without an `href`
185
+ the browser will not navigate; any IVA tracking handler still fires normally.
186
+
187
+ Use this script (substitute the actual attribute names for the placeholders):
188
+ ```js
189
+ (gotoSlideAttr, navigateDisabledAttr) => {
190
+ document.querySelectorAll('a').forEach(a => {
191
+ if (a.hasAttribute(gotoSlideAttr)) {
192
+ // IVA-bound link — use IVA's own escape hatch
193
+ a.setAttribute(navigateDisabledAttr, 'true');
194
+ } else {
195
+ // Not IVA-bound — strip href to prevent browser navigation
196
+ const href = a.getAttribute('href');
197
+ if (href) {
198
+ a.dataset.originalHref = href;
199
+ a.removeAttribute('href');
200
+ }
201
+ }
202
+ });
203
+ }
204
+ ```
205
+
206
+ Call this evaluate **after** the page loads (Step 3.2) and **again after any
207
+ DOM mutation** (modal open, tab switch, dynamic content) that may have added new
208
+ `<a>` elements.
209
+
210
+ 4. Take a `browser_snapshot` to get the current accessibility tree. Use the refs from
211
+ this snapshot for all subsequent clicks on this page.
212
+
213
+ 5. For **each matched element** (visible, not disabled):
214
+ a. Click it using `browser_click`.
215
+ b. Wait 500ms for async effects.
216
+ c. **Call `browser_console_messages` with `level: "debug"`** to get all messages
217
+ accumulated on this page so far. Identify the **newly appeared messages** by
218
+ comparing the full returned list against `pageMessages` (new = any message whose
219
+ de-timestamped text is not already present in `pageMessages`). Add all new
220
+ messages to `pageMessages`.
221
+ d. Take a `browser_snapshot`. If the tree is structurally unchanged from the
222
+ previous snapshot, the existing refs remain valid — no action needed. If the
223
+ tree changed, use the new snapshot's refs going forward.
224
+ e. If the snapshot shows a modal is now open (`Modal state` present in the tree):
225
+ i. Use `browser_evaluate` to collect identifying information for all clickable
226
+ elements inside the modal:
227
+ ```js
228
+ () => {
229
+ const modal = document.querySelector('[role="dialog"], [aria-modal="true"]');
230
+ if (!modal) return [];
231
+ const sel = 'a,button,[role="button"],[role="link"],[role="tab"],input[type="checkbox"],input[type="radio"],[role="checkbox"],[role="radio"]';
232
+ return Array.from(modal.querySelectorAll(sel))
233
+ .filter(el => !el.disabled && el.offsetParent !== null)
234
+ .map(el => el.getAttribute('aria-label') || el.textContent.trim() || el.tagName);
235
+ }
236
+ ```
237
+ Cross-reference the returned labels/text against the current snapshot to
238
+ identify the corresponding accessibility-tree refs for clicking.
239
+ ii. For each visible, non-disabled modal element: click it using its ref, wait
240
+ 500ms, then apply the same **step 5c** above (call `browser_console_messages`
241
+ and diff). Re-snapshot if the modal content changes.
242
+ iii. After all modal elements have been clicked, dismiss the modal by clicking
243
+ its close button — look for a button with `aria-label="Close"` or visible
244
+ text "×", "Close", or "Dismiss" in the snapshot. Only use
245
+ `browser_handle_dialog` if a **native** browser dialog (`alert`/`confirm`/
246
+ `prompt`) is present — it has no effect on custom DOM modals.
247
+ iv. Take a fresh `browser_snapshot` after the modal closes before continuing
248
+ to the next page-level element — refs from before the modal opened are stale.
249
+ f. If no modal appeared but the DOM changed significantly, use the new snapshot's
250
+ refs before proceeding.
251
+
252
+ 6. After all clicks on the page, call `browser_console_messages` **once more** with
253
+ `level: "debug"` to catch any async messages that fired after the last click. Diff
254
+ against `pageMessages` and append any remaining new messages.
255
+
256
+ 7. Store all messages in `pageMessages` with the page route (e.g. `/home/`) as their
257
+ source.
258
+
259
+ 8. **Flag ambiguous click data.** After collecting tracking events for the page, check
260
+ each event against these criteria and mark it ambiguous if **any** apply:
261
+
262
+ - **Missing or empty field** — `slide`, `type`, or `name` is absent, `null`, `""`,
263
+ or the literal string `"undefined"`.
264
+ - **Generic name** — `name` is a value like `"button"`, `"link"`, `"click"`,
265
+ `"undefined"`, or matches the pattern `/^(button|link|click|item|element|tab)\d*$/i`
266
+ with no further specificity.
267
+ - **Name equals type** — `name` and `type` have the same value (e.g.
268
+ `{ type: "button", name: "button" }`).
269
+ - **Duplicate (slide, name) pair on the same page** — the same `(slide, name)`
270
+ combination fires more than once from distinct elements on the same page, making
271
+ it impossible to distinguish which element the user clicked.
272
+ - **Slide mismatch** — the `slide` value in the event does not match the route of
273
+ the page it was captured on (e.g. `slide: "home"` on `/about/`).
274
+
275
+ For each ambiguous event store:
276
+ ```
277
+ {
278
+ page: string, // route where it was captured
279
+ event: { slide, type, name },
280
+ reasons: string[] // one entry per applicable criterion above
281
+ }
282
+ ```
283
+
284
+ ---
285
+
286
+ ### Step 4 — Parse, deduplicate, and structure the data
287
+
288
+ #### Identify tracking events
289
+
290
+ When an element is clicked the app emits a tracking log in this format:
291
+ ```
292
+ [HH:MM:SS.mmm] DEBUG: track {slide: 'home', type: 'button', name: 'button_evo_flip_card_trigger'}
293
+ ```
294
+
295
+ For every console message, check whether its text matches this pattern:
296
+ ```
297
+ DEBUG: track {…}
298
+ ```
299
+
300
+ If it matches, parse out the object payload `{ slide, type, name }` — these are the
301
+ primary data points of interest. Store them as structured tracking events separate from
302
+ general log messages.
303
+
304
+ #### Collect all messages
305
+
306
+ Gather every console message captured across all pages into a flat list:
307
+ ```
308
+ {
309
+ page: string, // route, e.g. "/home/"
310
+ level: "log"|"warn"|"error"|"info"|"debug",
311
+ text: string, // full raw message text
312
+ tracking: { // only present when the message is a tracking event
313
+ slide: string,
314
+ type: string,
315
+ name: string
316
+ } | null
317
+ }
318
+ ```
319
+
320
+ #### Deduplicate
321
+
322
+ Before comparing, **strip the leading timestamp prefix** from each message's `text`
323
+ (the `[HH:MM:SS.mmm]` portion) — timestamps differ per run and would prevent identical
324
+ messages from being recognized as duplicates. Compare only the de-timestamped text.
325
+
326
+ Two messages are duplicates if their de-timestamped texts are equal. When the same
327
+ message appears on multiple pages, record all pages it appeared on.
328
+
329
+ #### Classify global vs. slide-specific tracking events
330
+
331
+ After collecting all tracking events, split them into two groups. An event is **Global**
332
+ if **either** condition is true:
333
+
334
+ 1. Its `type` starts with `header-`, `footer-`, or `nav-`; **or**
335
+ 2. The `(type, name)` pair appears on **≥ 80%** of the total audited pages.
336
+
337
+ Everything else is a **Slide Event**.
338
+
339
+ For global events, drop the `slide` dimension entirely — only `type` and `name` are needed.
340
+ For slide events, retain `slide`, `type`, and `name`.
341
+
342
+ #### Deduplicate ambiguous events
343
+
344
+ Apply the same timestamp-stripping deduplication to the ambiguous events list. Two
345
+ ambiguous events are duplicates if their `(page, slide, type, name)` tuples are equal —
346
+ keep one entry but merge their `reasons` arrays (union, no duplicates).
347
+
348
+ #### Tiers
349
+
350
+ Organize into five tiers:
351
+ 1. **Tracking Events** — messages matching the `DEBUG: track` pattern (split into Global and Slide sub-sections, see Step 5)
352
+ 2. **Ambiguous Events** — tracking events that matched one or more ambiguity criteria in Step 3.8
353
+ 3. **Errors** — `console.error`
354
+ 4. **Warnings** — `console.warn`
355
+ 5. **Info / Log** — `console.log`, `console.info`, `console.debug` (excluding tracking events)
356
+
357
+ ---
358
+
359
+ ### Step 5 — Write the report
360
+
361
+ Before inserting any message text into a Markdown table cell, **escape every `|`
362
+ character as `\|`** to prevent table corruption.
363
+
364
+ Write a Markdown file to `analytics-audit-report-<TIMESTAMP>.md` in the project root with this
365
+ structure:
366
+
367
+ ```markdown
368
+ # Browser Console Log Audit
369
+
370
+ **Date:** <today's date>
371
+ **Pages audited:** /home/, /about/, /about/moa/
372
+ **Total unique messages:** <N> tracking events (<G> global, <S> slide-specific, <A> ambiguous), <E> errors, <W> warnings, <I> info/log
373
+
374
+ > **Skipped (dynamic routes):** src/pages/[slug].astro, src/pages/[...path].astro
375
+
376
+ ---
377
+
378
+ ## Tracking Events (<count>)
379
+
380
+ > Events are grouped by slide. Each slide's `type` and `name` are set by the IVA tracking library at click time; the `slide` value is defined by each page's own configuration.
381
+
382
+ ### Global Events (<G> — type prefixed `header-`/`footer-`/`nav-`, or present on ≥80% of pages)
383
+
384
+ These `(type, name)` pairs represent shared UI (navigation, ISI controls, header/footer
385
+ links, etc.). The slide name is omitted since it is not meaningful here.
386
+
387
+ | Type | Name |
388
+ |------|------|
389
+ | `nav-button` | `nav-button_about_pbc` |
390
+
391
+ ### Slide Events (<S> — page-specific)
392
+
393
+ These events fire on fewer than 80% of pages and are meaningful to a specific slide or
394
+ feature.
395
+
396
+ | Slide | Type | Name |
397
+ |-------|------|------|
398
+ | `home` | `button` | `button_important_safety_information` |
399
+
400
+ ## Ambiguous Events (<A>)
401
+
402
+ > These tracking events could not be unambiguously attributed to a specific element or
403
+ > action. Review and correct the tracking configuration for each one.
404
+
405
+ | Page | Slide | Type | Name | Reason(s) |
406
+ |------|-------|------|------|-----------|
407
+ | `/home/` | `home` | `button` | `button` | Generic name; Name equals type |
408
+
409
+ ## Errors (<count>)
410
+
411
+ | Message | Pages |
412
+ |---------|-------|
413
+ | `<message text>` | /home/, /about/ |
414
+
415
+ ## Warnings (<count>)
416
+
417
+ | Message | Pages |
418
+ |---------|-------|
419
+ | `<message text>` | /home/ |
420
+
421
+ ## Info / Log (<count>)
422
+
423
+ | Message | Pages |
424
+ |---------|-------|
425
+ | `<message text>` | /about/moa/ |
426
+
427
+ ---
428
+
429
+ *Generated by the analytics-auditor skill.*
430
+ ```
431
+
432
+ Omit the "Skipped" blockquote if no dynamic routes were found. If a tier has zero
433
+ messages, write `_None_` instead of a table. If there are no slide-specific events,
434
+ write `_None_` under that sub-section. Omit the Global Events sub-section header note
435
+ if there are no global events. If there are no ambiguous events, write `_None_` under
436
+ the Ambiguous Events section.
437
+
438
+ After writing the Markdown file, write a CSV file to the project root using the same
439
+ base name with the extension changed to `.csv` (e.g. `analytics-audit-report-20260616143022.csv`).
440
+
441
+ The CSV contains one row per unique tracking event (global and slide, excluding
442
+ ambiguous). Use this header and column rules:
443
+
444
+ ```
445
+ slide,type,name
446
+ ```
447
+
448
+ - **Global events** — set `slide` to `GLOBAL`. Use the event's own `type` and `name`.
449
+ - **Slide events** — set `slide` to the event's `slide` value. Use `type` and `name` as-is.
450
+
451
+ Output global events first (sorted by `type`, then `name`), followed by slide events
452
+ (sorted by `slide`, then `type`, then `name`).
453
+
454
+ If a field value contains a comma, double-quote, or newline, wrap it in double quotes
455
+ and escape any internal double quotes by doubling them (`"` → `""`).
456
+
457
+ Example:
458
+ ```csv
459
+ slide,type,name
460
+ GLOBAL,nav-button,nav-button_about_pbc
461
+ GLOBAL,nav-button,nav-button_home
462
+ home,button,button_important_safety_information
463
+ about,button,button_request_info
464
+ ```
465
+
466
+ After writing the file, tell the user both filenames and give a brief summary (e.g.
467
+ "Found 8 tracking events (5 global, 3 slide-specific, 2 ambiguous), 2 errors, 1
468
+ warning, 5 info messages across 3 pages"). If there are any ambiguous events, call them
469
+ out explicitly in the summary so the user knows action is needed.
470
+
471
+ ---
472
+
473
+ ### Step 6 — Shut down and clean up
474
+
475
+ Call `browser_close` to end the Playwright session.
476
+
477
+ Then stop the dev server and delete the Playwright working directory:
478
+ ```bash
479
+ kill $(lsof -ti tcp:$DEV_PORT) 2>/dev/null || true
480
+ rm -rf .playwright-mcp
481
+ ```
482
+
483
+ ---
484
+
485
+ ## Notes
486
+
487
+ - The Astro dev server defaults to port **4321** but increments on collision — always
488
+ read the actual port from the server output as described in Step 1.
489
+ - **`grep -P` is not supported on Windows** — use `grep -o` with basic regex patterns.
490
+ - **Snapshot refs go stale** after DOM mutations (modal open/close, tab switches). Always
491
+ re-snapshot after any click that visibly changes the page structure.
492
+ - **`browser_console_messages` fails if a native dialog is showing** — dismiss with
493
+ `browser_handle_dialog` before calling it.
494
+ - **`browser_handle_dialog` only works for native browser dialogs** (`alert`, `confirm`,
495
+ `prompt`) — it has no effect on custom DOM modals. Dismiss those by clicking their
496
+ close button.
497
+ - **Navigation prevention uses DOM attributes, not event listeners.** IVA's click
498
+ handler calls `e.preventDefault()` unconditionally and then checks
499
+ `<navigateDisabledAttr>="true"` before calling `navigate()`. Setting that attribute
500
+ on IVA-bound links is therefore the most reliable way to suppress navigation without
501
+ interfering with tracking. All other links have their `href` removed instead.
502
+ - **Re-run the link-disabling evaluate after DOM mutations** (modal open, dynamic
503
+ tab content, etc.) — newly inserted `<a>` elements will not have the attribute yet.
504
+ - **`browser_console_messages` is called after every click** so that tracking events
505
+ are captured incrementally. The final per-page call catches any late async messages.
506
+ - If the user provides their own list of selectors or pages, replace the defaults in
507
+ Step 2 before proceeding.
508
+ - If a selector does not match any element on a page, log a warning in the report's
509
+ header section rather than failing.