argusqa-os 9.2.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 (57) hide show
  1. package/.mcp.json +8 -0
  2. package/LICENSE +21 -0
  3. package/README.md +879 -0
  4. package/package.json +69 -0
  5. package/src/adapters/browser.js +82 -0
  6. package/src/argus.js +8 -0
  7. package/src/batch-runner.js +8 -0
  8. package/src/cli/init.js +314 -0
  9. package/src/config/schema.js +108 -0
  10. package/src/config/targets.js +309 -0
  11. package/src/domain/finding.js +25 -0
  12. package/src/mcp-server.js +156 -0
  13. package/src/orchestration/crawl-and-report.js +16 -0
  14. package/src/orchestration/dispatcher.js +263 -0
  15. package/src/orchestration/env-comparison.js +498 -0
  16. package/src/orchestration/orchestrator.js +1128 -0
  17. package/src/orchestration/report-processor.js +134 -0
  18. package/src/orchestration/slack-notifier.js +337 -0
  19. package/src/orchestration/watch-mode.js +316 -0
  20. package/src/registry.js +18 -0
  21. package/src/server/index.js +94 -0
  22. package/src/server/interaction-handler.js +126 -0
  23. package/src/server/slash-command-handler.js +185 -0
  24. package/src/utils/api-frequency.js +128 -0
  25. package/src/utils/baseline-manager.js +255 -0
  26. package/src/utils/codebase-analyzer.js +299 -0
  27. package/src/utils/content-analyzer.js +155 -0
  28. package/src/utils/contract-validator.js +178 -0
  29. package/src/utils/css-analyzer.js +407 -0
  30. package/src/utils/diff.js +189 -0
  31. package/src/utils/flakiness-detector.js +82 -0
  32. package/src/utils/flow-runner.js +572 -0
  33. package/src/utils/github-reporter.js +310 -0
  34. package/src/utils/hover-analyzer.js +214 -0
  35. package/src/utils/html-reporter.js +301 -0
  36. package/src/utils/issues-analyzer.js +171 -0
  37. package/src/utils/keyboard-analyzer.js +141 -0
  38. package/src/utils/lighthouse-checker.js +120 -0
  39. package/src/utils/logger.js +39 -0
  40. package/src/utils/login-orchestrator.js +99 -0
  41. package/src/utils/mcp-client.js +264 -0
  42. package/src/utils/mcp-parsers.js +57 -0
  43. package/src/utils/memory-analyzer.js +270 -0
  44. package/src/utils/network-timing-analyzer.js +76 -0
  45. package/src/utils/parallel-crawler.js +28 -0
  46. package/src/utils/responsive-analyzer.js +253 -0
  47. package/src/utils/retry.js +36 -0
  48. package/src/utils/route-discoverer.js +306 -0
  49. package/src/utils/security-analyzer.js +302 -0
  50. package/src/utils/seo-analyzer.js +164 -0
  51. package/src/utils/session-manager.js +12 -0
  52. package/src/utils/session-persistence.js +214 -0
  53. package/src/utils/severity-overrides.js +91 -0
  54. package/src/utils/slack-guard.js +18 -0
  55. package/src/utils/slug.js +8 -0
  56. package/src/utils/snapshot-analyzer.js +330 -0
  57. package/src/utils/telemetry.js +190 -0
package/README.md ADDED
@@ -0,0 +1,879 @@
1
+ # Argus โ€” AI-Powered Dev Testing Tool
2
+
3
+ > *Argus Panoptes โ€” the all-seeing giant of Greek mythology with a hundred eyes who never slept.*
4
+
5
+ Automated browser testing pipeline that catches bugs, compares environments, and sends rich reports to Slack (or generates a self-contained HTML dashboard when Slack is not configured) โ€” powered by Chrome DevTools MCP and Claude Code.
6
+
7
+ The `landing/` directory contains the product landing page (React + Vite + Tailwind + Framer Motion) with Supabase-backed waitlist and enterprise contact forms. Live at **[argus-qa.com](https://argus-qa.com)** (deployed via Cloudflare Pages; background video served from Cloudflare R2). See [landing/README.md](landing/README.md) for setup.
8
+
9
+ <div align="center">
10
+
11
+ [![Tech stack icons](https://skillicons.dev/icons?i=nodejs,js,expressjs,react,css,sass,github,githubactions,vscode)](https://skillicons.dev)
12
+
13
+ </div>
14
+
15
+ <div align="center">
16
+
17
+ | ๐Ÿ”ด Critical / ๐ŸŸก Warning / ๐Ÿ”ต Info | โš™๏ธ | ๐Ÿงช | ๐Ÿ“‹ |
18
+ | :---: | :---: | :---: | :---: |
19
+ | **114 distinct issue types detected** | **24 analysis engines** | **348 test assertions** | **82 test blocks** |
20
+
21
+ </div>
22
+
23
+ ---
24
+
25
+ ## What Argus Catches
26
+
27
+ Argus runs **24 analysis engines** per run and detects **114 distinct issue types** across JavaScript runtime, network, CSS, performance, accessibility, SEO, security, content quality, responsive layout, memory, runtime anti-patterns, hover-state interactions, accessibility tree snapshots, keyboard focus, and Chrome DevTools issues panel โ€” plus flakiness detection, historical baselines, user flow assertions, and environment comparison as cross-cutting layers. Every finding is classified by severity (`critical` / `warning` / `info`) and routed to the right Slack channel โ€” or rendered as a local `report.html` when Slack is not configured.
28
+
29
+ ### JavaScript Runtime
30
+
31
+ | Severity | Bug / Issue | Detection Method |
32
+ | --- | --- | --- |
33
+ | ๐Ÿ”ด Critical | Uncaught exceptions โ€” `TypeError`, `ReferenceError`, etc. | `window.onerror` listener injected before page load |
34
+ | ๐Ÿ”ด Critical | Unhandled Promise rejections | `unhandledrejection` event listener injected into the page |
35
+ | ๐ŸŸก Warning | `console.error` calls (on non-critical routes) | Chrome DevTools `list_console_messages` |
36
+ | ๐Ÿ”ด Critical | `console.error` calls (on critical routes) | Chrome DevTools `list_console_messages` |
37
+ | ๐Ÿ”ต Info | `console.warn` deprecation notices and warnings | Chrome DevTools `list_console_messages` |
38
+
39
+ ### Network & API
40
+
41
+ | Severity | Bug / Issue | Detection Method |
42
+ | --- | --- | --- |
43
+ | ๐Ÿ”ด Critical | HTTP 5xx server errors on any request | `list_network_requests` โ†’ status โ‰ฅ 500 |
44
+ | ๐Ÿ”ด Critical | 401 / 403 auth failures โ€” user is being kicked out | `list_network_requests` โ†’ status 401 or 403 |
45
+ | ๐Ÿ”ด Critical | API endpoint called 5+ times in one page load โ€” likely an infinite loop | Network frequency grouping by normalized URL + method |
46
+ | ๐ŸŸก Warning | HTTP 4xx client errors (404, 422, 429, etc.) | `list_network_requests` โ†’ status 400โ€“499 (non-auth) |
47
+ | ๐ŸŸก Warning | API endpoint called 3โ€“4 times โ€” likely a double-fetch bug | Frequency grouping โ†’ 3 โ‰ค count โ‰ค 4 (check `useEffect` deps) |
48
+ | ๐Ÿ”ต Info | API endpoint called twice โ€” may be intentional prefetch | Frequency grouping โ†’ count = 2 |
49
+ | ๐Ÿ”ต Info | API call summary per page load (total calls, unique endpoints, duplicates) | Aggregated network analysis |
50
+ | ๐ŸŸก Warning | Redirect chain longer than 2 hops โ€” extra round-trips inflate load time | Navigation Timing `redirectCount` read after page settle |
51
+ | ๐ŸŸก Warning | Broken internal link โ€” `<a href>` target returns HTTP 404 | `<a>` elements harvested via `evaluate_script`, each verified against `list_network_requests` |
52
+
53
+ ### Page Health
54
+
55
+ | Severity | Bug / Issue | Detection Method |
56
+ | --- | --- | --- |
57
+ | ๐Ÿ”ด Critical | Blank or near-empty page โ€” less than 50 characters of body text | `document.body.innerText` length check after navigation |
58
+ | ๐ŸŸก Warning | Expected element never appeared โ€” page may have crashed mid-load | `waitFor` selector timeout after 10 seconds |
59
+
60
+ ### CSS & Styling
61
+
62
+ | Severity | Bug / Issue | Detection Method |
63
+ | --- | --- | --- |
64
+ | ๐ŸŸก Warning | `!important` cascade conflict โ€” forced override fighting another rule | CSS rule walk: property declared with `!important` on same element |
65
+ | ๐ŸŸก Warning | Component style leak โ€” BEM selector found in the wrong stylesheet | `.block__element` selector in a file whose name doesn't match `block` |
66
+ | ๐ŸŸก Warning | React inline style overriding a stylesheet declaration on the same element | `style=""` attribute vs. matching CSS rule, `__reactFiber` presence confirmed |
67
+ | ๐Ÿ”ต Info | CSS property declared by multiple rules on the same element (cascade override) | Computed style walk across all matched rules per key element |
68
+ | ๐Ÿ”ต Info | Unused CSS rules โ€” selectors matching no element on the page (> 10 flagged) | `querySelectorAll(selector).length === 0` for every rule |
69
+ | ๐Ÿ”ต Info | CSS Modules detected โ€” hashed class names found on DOM elements | Pattern `_ComponentName_class_hash` matched on live DOM |
70
+ | ๐Ÿ”ต Info | SCSS source map found โ€” compiled CSS traced back to `.scss` origin file | `sourceMappingURL` comment in `<style>` tags |
71
+
72
+ ### Performance
73
+
74
+ | Severity | Bug / Issue | Detection Method |
75
+ | --- | --- | --- |
76
+ | ๐ŸŸก Warning | LCP > 2500ms โ€” largest element took too long to paint | Chrome performance trace โ†’ `performance_analyze_insight` |
77
+ | ๐ŸŸก Warning | CLS > 0.1 โ€” layout shifted significantly after initial render | Chrome performance trace |
78
+ | ๐ŸŸก Warning | FID / TBT > 100ms โ€” main thread was blocked during interaction | Chrome performance trace |
79
+ | ๐ŸŸก Warning | TTFB > 800ms โ€” server took too long to send the first byte | Chrome performance trace |
80
+
81
+ ### Accessibility
82
+
83
+ | Severity | Bug / Issue | Detection Method |
84
+ | --- | --- | --- |
85
+ | ๐Ÿ”ด Critical | Lighthouse accessibility score below 50 / 100 | Lighthouse audit via `lighthouse_audit` |
86
+ | ๐ŸŸก Warning | Lighthouse accessibility score 50โ€“89 / 100 | Lighthouse audit |
87
+ | ๐ŸŸก Warning | Missing alt text on images | Individual Lighthouse audit check |
88
+ | ๐ŸŸก Warning | Insufficient color contrast ratio | Individual Lighthouse audit check |
89
+ | ๐ŸŸก Warning | Missing ARIA labels on interactive elements | Individual Lighthouse audit check |
90
+ | ๐ŸŸก Warning | Keyboard navigation broken or unreachable elements | Individual Lighthouse audit check |
91
+
92
+ ### SEO
93
+
94
+ | Severity | Bug / Issue | Detection Method |
95
+ | --- | --- | --- |
96
+ | ๐ŸŸก Warning | Missing `<meta name="description">` | DOM inspection via `evaluate_script` |
97
+ | ๐ŸŸก Warning | Missing Open Graph tags (`og:title`, `og:description`, `og:image`) | DOM inspection via `evaluate_script` |
98
+ | ๐ŸŸก Warning | `og:image` URL is relative โ€” Open Graph requires an absolute URL | DOM inspection + URL prefix check (`http://` / `https://`) |
99
+ | ๐ŸŸก Warning | Multiple `<h1>` tags on one page | DOM inspection โ€” `querySelectorAll('h1').length > 1` |
100
+ | ๐ŸŸก Warning | Zero `<h1>` tags โ€” page has no primary heading | DOM inspection โ€” `querySelectorAll('h1').length === 0` |
101
+ | ๐ŸŸก Warning | Generic page title (less than 10 characters, or default placeholder) | DOM inspection + length check |
102
+ | ๐ŸŸก Warning | Missing `<link rel="canonical">` | DOM inspection via `evaluate_script` |
103
+ | ๐ŸŸก Warning | Missing `<meta name="viewport">` | DOM inspection via `evaluate_script` |
104
+
105
+ ### Security
106
+
107
+ | Severity | Bug / Issue | Detection Method |
108
+ | --- | --- | --- |
109
+ | ๐Ÿ”ด Critical | Auth token found in `localStorage` or `sessionStorage` | `evaluate_script` walks storage keys for token patterns |
110
+ | ๐Ÿ”ด Critical | Sensitive token in the page URL (query param or hash) | URL pattern match against current `window.location.href` |
111
+ | ๐Ÿ”ด Critical | `eval()` call detected in page scripts | `evaluate_script` AST-style text scan of inline `<script>` tags |
112
+ | ๐Ÿ”ด Critical | CSP violation โ€” inline script or external resource blocked by Content-Security-Policy | Chrome DevTools Issues panel (`list_console_messages({ types: ['issue'] })`) |
113
+ | ๐ŸŸก Warning | Sensitive data (`password`, `token`, `secret`) logged to the console | `list_console_messages` + keyword match |
114
+ | ๐ŸŸก Warning | Missing `Content-Security-Policy` response header | `fetch(location.href)` inside the page โ†’ response headers check |
115
+ | ๐ŸŸก Warning | Missing `X-Frame-Options` response header | Same headers fetch |
116
+ | ๐ŸŸก Warning | Cross-origin `<iframe>` without `sandbox` attribute โ€” enables form submission, parent navigation, cookie access | `evaluate_script` checks `iframe[src]` elements for missing sandbox attribute |
117
+ | ๐ŸŸก Warning | Page served over plain HTTP with no HTTPS upgrade redirect | URL protocol check (`http://` + non-localhost) |
118
+ | ๐Ÿ”ต Info | Cookie present without `HttpOnly` flag (limited detection โ€” JS-visible cookies only) | `document.cookie` inspection |
119
+ | ๐Ÿ”ต Info | Deprecated browser API usage (e.g. `document.domain`, `DOMSubtreeModified`) | Chrome DevTools Issues panel |
120
+
121
+ ### Content Quality
122
+
123
+ | Severity | Bug / Issue | Detection Method |
124
+ | --- | --- | --- |
125
+ | ๐ŸŸก Warning | `null` or `undefined` rendered as visible text | DOM text scan for literal "null" / "undefined" strings |
126
+ | ๐ŸŸก Warning | Lorem ipsum / placeholder copy still in production | DOM text scan for "lorem ipsum" and common placeholder strings |
127
+ | ๐ŸŸก Warning | Broken image (404 or failed to load) | `evaluate_script` checks `img.naturalWidth === 0` on all images |
128
+ | ๐Ÿ”ต Info | Empty data list โ€” `<ul>`, `<ol>`, or `<select>` with no children | DOM structure check |
129
+
130
+ ### Responsive / Mobile
131
+
132
+ | Severity | Bug / Issue | Detection Method |
133
+ | --- | --- | --- |
134
+ | ๐Ÿ”ด Critical | Horizontal overflow at mobile / tablet viewport (โ‰ค 768px) | `emulate` at 375px and 768px โ†’ `document.documentElement.scrollWidth > clientWidth` |
135
+ | ๐ŸŸก Warning | Touch target smaller than 44ร—44 px at mobile or tablet viewport | CSS computed size check on interactive elements at 375px and 768px |
136
+ | ๐Ÿ”ต Info | Responsive screenshot grid โ€” snapshots at 375 / 768 / 1024 / 1440px | `emulate` at 4 breakpoints, screenshots dispatched to Slack |
137
+
138
+ ### Network Performance
139
+
140
+ | Severity | Bug / Issue | Detection Method |
141
+ | --- | --- | --- |
142
+ | ๐Ÿ”ด Critical | API response time > 3000ms | `PerformanceObserver` entries for `fetch` / XHR calls |
143
+ | ๐ŸŸก Warning | API response time > 1000ms | Same observer, lower threshold |
144
+ | ๐Ÿ”ด Critical | API response payload > 2 MB | `list_network_requests` โ†’ response body size |
145
+ | ๐ŸŸก Warning | API response payload > 500 KB | Same, lower threshold |
146
+ | ๐ŸŸก Warning | Cross-origin (third-party) script TTFB > 2000ms โ€” blocking render or late interactivity | HAR `timing.wait` field from `list_network_requests` HAR data; cross-origin requests only |
147
+
148
+ ### Network Request Origin Tagging
149
+
150
+ All network findings carry an `origin` field (`'first-party'` / `'third-party'`) so operators can triage critical first-party failures separately from third-party noise.
151
+
152
+ ### Lighthouse Audits
153
+
154
+ | Severity | Bug / Issue | Detection Method |
155
+ | --- | --- | --- |
156
+ | ๐Ÿ”ด Critical | Lighthouse accessibility score < 50 / 100 | `lighthouse_audit` (accessibility category) |
157
+ | ๐ŸŸก Warning | Lighthouse accessibility score 50โ€“89 / 100 | `lighthouse_audit` |
158
+ | ๐ŸŸก Warning | Lighthouse performance score < 90 / 100 | `lighthouse_audit` (performance category) |
159
+ | ๐ŸŸก Warning | Lighthouse SEO score < 90 / 100 | `lighthouse_audit` (seo category) |
160
+ | ๐ŸŸก Warning | Lighthouse best-practices score < 90 / 100 | `lighthouse_audit` (best-practices category) |
161
+ | ๐ŸŸก Warning | Individual failing Lighthouse audit items | Surfaced per-audit from the full Lighthouse report |
162
+
163
+ ### Memory Leaks
164
+
165
+ | Severity | Bug / Issue | Detection Method |
166
+ | --- | --- | --- |
167
+ | ๐Ÿ”ด Critical | > 100 detached DOM nodes in V8 heap โ€” severe leak | `take_memory_snapshot` โ†’ parse flat nodes array for "Detached Xxx" names |
168
+ | ๐ŸŸก Warning | > 10 detached DOM nodes in V8 heap โ€” probable leak | Same snapshot parse, lower threshold |
169
+ | ๐ŸŸก Warning | Heap grew > 2 MB after navigate-away + navigate-back โ€” probable per-load leak | `performance.memory.usedJSHeapSize` delta across round-trip (soft โ€” GC-dependent) |
170
+
171
+ ### Runtime Anti-Patterns
172
+
173
+ | Severity | Bug / Issue | Detection Method |
174
+ | --- | --- | --- |
175
+ | ๐ŸŸก Warning | Synchronous `XMLHttpRequest` โ€” blocks the main thread until the server responds | `XMLHttpRequest.open` patched via `addScriptToEvaluateOnNewDocument`; `async === false` calls recorded |
176
+ | ๐ŸŸก Warning | `document.write` / `document.writeln` called โ€” can erase the page or block parsing | `document.write` and `document.writeln` patched before page load; calls recorded with method + content |
177
+ | ๐ŸŸก Warning | Long task > 50ms on the main thread โ€” blocks user interaction | `PerformanceObserver` with `entryTypes: ['longtask']` injected before page load |
178
+ | ๐Ÿ”ด Critical | CORS policy violation โ€” cross-origin fetch blocked by the browser | `list_console_messages` + pattern match for `"has been blocked by CORS policy"` |
179
+ | ๐ŸŸก Warning | Service worker registration failure โ€” SW script returns 4xx or is invalid | `navigator.serviceWorker.register` patched before page load; `.catch()` records failing script URL |
180
+ | ๐Ÿ”ต Info | Same-origin static asset (`.js`, `.css`, `.png`, `.woff2`, etc.) served without `Cache-Control` or `ETag` โ€” browsers cannot cache it efficiently | `evaluate_script` reads `performance.getEntriesByType('resource')`, HEAD-fetches each unique same-origin asset, checks response headers |
181
+
182
+ ### Historical Baselines & Trends
183
+
184
+ | Severity | Bug / Issue | Detection Method |
185
+ | --- | --- | --- |
186
+ | ๐Ÿ”ด Critical | New critical finding not present in the saved baseline โ€” regression introduced since last run | `applyBaseline` compares finding keys (`type::message[:100]::status`) against `reports/baselines/<branch>.json` (D7.2 per-branch) |
187
+ | ๐ŸŸก Warning | New warning finding not present in the baseline | Same key comparison, warning severity |
188
+ | ๐Ÿ”ต Info | Pre-existing finding still present โ€” no change since last run | Suppressed from real-time alerts; included in info digest only |
189
+ | ๐Ÿ”ต Info | Run trend summary โ€” new vs resolved counts, saved per run | Appended to `reports/baselines/<branch>-trends.json`; surfaced as a trend line in Slack digest |
190
+
191
+ ### Hover-State Bugs
192
+
193
+ | Severity | Bug / Issue | Detection Method |
194
+ | --- | --- | --- |
195
+ | ๐ŸŸก Warning / ๐Ÿ”ด Critical | `[aria-haspopup]` element whose controlled popup does not become visible after hover โ€” `aria-expanded` stays false and popup remains `display:none` / `visibility:hidden` / `opacity:0` | `hover` dispatches `mousemove`; `evaluate_script` checks `aria-expanded` + `getComputedStyle` on the controlled element; critical on routes marked `critical: true` |
196
+ | ๐ŸŸก Warning | `[data-tooltip]` element whose `[role="tooltip"]` is not visible in the DOM after hover โ€” not found or opacity โ‰ค 0.05 | Same hover + `evaluate_script` checks tooltip opacity, `display`, `visibility`, and `offsetHeight` |
197
+
198
+ ### Accessibility Snapshot Analysis
199
+
200
+ | Severity | Bug / Issue | Detection Method |
201
+ | --- | --- | --- |
202
+ | ๐ŸŸก Warning | Interactive element (`<button>`, `<a>`, `[role="button"]`, `[role="link"]`) with no accessible name โ€” no text content, `aria-label`, `aria-labelledby`, `title`, or `alt` | `take_snapshot` captures DOM/AX state; `evaluate_script` queries each visible interactive element for accessible name sources |
203
+ | ๐ŸŸก Warning | Form control (`<input>`, `<select>`, `<textarea>`) with no associated label โ€” no `<label for="...">`, `aria-label`, or `aria-labelledby` (placeholder is intentionally excluded โ€” not a valid accessible name per WCAG 2.1 ยง3.3.2) | `evaluate_script` checks `label[for]`, ancestor `<label>`, `aria-label`, and `aria-labelledby` for each visible control |
204
+ | ๐ŸŸก Warning | Landmark role appearing more than once without distinct `aria-label` / `aria-labelledby` โ€” screen readers cannot differentiate them | `evaluate_script` counts `[role=X]` instances and checks for unique label values across: `main`, `banner`, `contentinfo`, `navigation`, `search`, `complementary`, `form`, `region` |
205
+ | ๐ŸŸก Warning | Heading level skip โ€” h1โ†’h3 or h4โ†’h6 jumps more than one level, breaking WCAG 1.3.1 document outline | DOM walk of `h1`โ€“`h6` elements; detects gaps > 1 between consecutive heading levels |
206
+ | ๐ŸŸก Warning | `aria-expanded` button/control has no `aria-controls` attribute or references a non-existent element | `evaluate_script` checks `[aria-expanded]` elements for missing or broken `aria-controls` pointer |
207
+
208
+ ### Keyboard Accessibility
209
+
210
+ | Severity | Bug / Issue | Detection Method |
211
+ | --- | --- | --- |
212
+ | ๐ŸŸก Warning | Button or focusable element has `outline:0` with no `box-shadow` fallback โ€” no visible focus ring | `press_key({ key: 'Tab' })` walk + `evaluate_script` reads `document.activeElement` computed style for outline/box-shadow |
213
+
214
+ ### Flakiness Detection
215
+
216
+ | Severity | Bug / Issue | Detection Method |
217
+ | --- | --- | --- |
218
+ | original | Confirmed finding โ€” present in both crawl runs | `mergeRunResults` finds the key in both run1 and run2 (`type::message[:100]::status` scheme); original severity kept |
219
+ | ๐Ÿ”ต Info | Flaky finding โ€” appeared in only one of two crawl runs | Present in run1 or run2 but not both; downgraded to `severity: 'info'`, labelled `:zap: _flaky_` in Slack digest |
220
+
221
+ ### User Flow Assertions
222
+
223
+ | Severity | Bug / Issue | Detection Method |
224
+ | --- | --- | --- |
225
+ | ๐Ÿ”ด Critical | Flow step failed โ€” navigate/fill/click/waitFor threw mid-flow (page state unknown) | `flow-runner.js` wraps every step; any throw emits `flow_step_failed` and halts the flow |
226
+ | ๐Ÿ”ด Critical | `element_visible` assert โ€” expected selector absent within timeout | Polled via `evaluate_script` + `document.querySelector` (MCP `wait_for` doesn't reliably throw on timeout) |
227
+ | ๐ŸŸก Warning | `no_console_errors` assert โ€” console errors recorded *during* this flow (baseline-sliced, not session-wide) | Baseline snapshot of `list_console_messages` at flow start; only messages after that offset count |
228
+ | ๐ŸŸก Warning | `no_network_errors` assert โ€” 4xx/5xx request during this flow (baseline-sliced) | Baseline snapshot of `list_network_requests` at flow start; status โ‰ฅ 400 after offset |
229
+ | ๐ŸŸก Warning | `url_contains` assert โ€” URL does not include expected substring after flow completes | `evaluate_script` reads `window.location.href` |
230
+ | ๐ŸŸก Warning | `element_not_visible` assert โ€” selector unexpectedly present in DOM | `evaluate_script` โ†’ `!document.querySelector(...)` |
231
+ | ๐Ÿ”ด Critical | `no_js_errors` assert โ€” uncaught exceptions captured in `window.__argusErrors` during flow | Script parses the injected error buffer |
232
+
233
+ ### Environment Regressions *(dev vs staging)*
234
+
235
+ | Severity | Bug / Issue | Detection Method |
236
+ | --- | --- | --- |
237
+ | ๐Ÿ”ด Critical | API status regressed โ€” request that returned 2xx in dev now returns 5xx in staging | Network diff between both environments |
238
+ | ๐ŸŸก Warning | Visual change > 0.5% pixels different between dev and staging screenshots | `pixelmatch` pixel-level comparison + diff overlay image |
239
+ | ๐ŸŸก Warning | New console error in staging that doesn't exist in dev | Console message diff |
240
+ | ๐ŸŸก Warning | New network request in staging โ€” unexpected endpoint appeared | Network request URL diff |
241
+ | ๐ŸŸก Warning | Request present in dev is missing in staging โ€” endpoint removed or broken | Network request URL diff |
242
+ | ๐ŸŸก Warning | API status changed between environments (any non-5xx change) | Network status diff |
243
+ | ๐Ÿ”ต Info | DOM structural change โ€” element count differs between dev and staging | HTML tag count comparison across snapshots |
244
+
245
+ ---
246
+
247
+ ## What It Does
248
+
249
+ Argus watches your running application and automatically surfaces issues that test suites miss: visual regressions, API loops, CSS drift, console noise, and accessibility failures โ€” all with screenshots delivered directly to Slack.
250
+
251
+ | Feature | Description |
252
+ | --- | --- |
253
+ | **Error Detection** | Crawls your app's routes; captures JS exceptions, console errors, failed API calls, redirect chains, and broken internal links |
254
+ | **Environment Comparison** | Diffs dev vs staging: screenshots, DOM structure, network requests, console errors |
255
+ | **CSS Analysis** | Detects cascade overrides, component style leaks, unused rules, React inline style conflicts |
256
+ | **API Frequency Analysis** | Flags endpoints called more than once per page load (double-fetch, missing `useEffect` deps, infinite loops) |
257
+ | **Network Performance** | `slow_api` > 1s/3s and `large_payload` > 500KB/2MB per API call |
258
+ | **SEO Checks** | Missing meta description, OG tags, canonical, viewport, h1 โ€” DOM-inspected on every route |
259
+ | **Security Checks** | localStorage tokens, token-in-URL, `eval()`, sensitive console output, missing CSP/X-Frame-Options |
260
+ | **Content Quality** | `null`/`undefined` rendered text, lorem ipsum, broken images, empty data lists |
261
+ | **Responsive Analysis** | Overflow + touch target checks at 375/768px; screenshot grid at 4 breakpoints dispatched to Slack |
262
+ | **Memory Leak Detection** | V8 heap snapshot โ†’ detached DOM node count; heap growth across navigate-away + navigate-back |
263
+ | **Runtime Anti-Patterns** | Synchronous XHR, `document.write`, long tasks > 50ms, CORS violations, service worker registration failures, and missing cache headers on static assets โ€” detected via script injection and post-load HEAD checks |
264
+ | **Hover-State Bug Detection** | Fires `hover` on every `[aria-haspopup]` and `[data-tooltip]` element; detects broken dropdowns and invisible tooltips that CSS `:hover` was supposed to reveal |
265
+ | **Accessibility Snapshot Analysis** | Calls `take_snapshot` then `evaluate_script`; flags interactive elements missing accessible names, unlabelled form controls, duplicate landmark regions, heading level skips, and `aria-expanded` buttons with missing/broken `aria-controls` |
266
+ | **Keyboard Focus Analysis** | Tab-walks every focusable element (up to 20 steps); detects `focus_visible_missing` (button/link with `outline:0` and no `box-shadow` fallback โ€” keyboard users cannot see where focus is) |
267
+ | **Chrome DevTools Issues Panel** | Queries `list_console_messages({ types: ['issue'] })` for the Issues panel namespace, which is entirely separate from `console.error`; catches CSP violations and deprecated API usage (verified) โ€” additional Chrome-surfaced types (CORS blocks, mixed content, cookie misconfiguration, low-contrast) are classified when present |
268
+ | **Mobile CPU Throttling** | Applies 4ร— CPU throttle (`emulate_cpu({ throttlingRate: 4 })`) during โ‰ค768px responsive breakpoints โ€” finds layout reflow and animation jank that only manifests under realistic mobile CPU pressure |
269
+ | **Origin-Tagged Network Findings** | All network error and timing findings carry `origin: 'first-party' \| 'third-party'` so operators can triage critical first-party failures without digging through third-party CDN noise |
270
+ | **Historical Baselines** | Saves finding keys after each run; subsequent runs only alert on *new* issues; trend summary in Slack digest |
271
+ | **Flakiness Detection** | Crawls each route twice per run; findings in both runs are confirmed (original severity); findings in only one run are marked flaky (`severity: info`, `:zap: _flaky_` label) |
272
+ | **User Flow Assertions** | Named multi-step flows (`navigate/fill/click/press_key/drag/upload_file/waitFor/sleep/handle_dialog/assert`) with baseline-sliced `no_console_errors`, `no_network_errors`, `element_visible`, `url_contains`, `no_js_errors` asserts โ€” runs end-to-end user journeys without writing Playwright specs ยท Use `typing: true` on a fill step to dispatch real keyboard events via `mcp.type_text` (triggers input-event validation) ยท Use `drag` step to fire dragstartโ†’dragoverโ†’drop sequences ยท Use `upload_file` step to deliver a local file to a file input via CDP (`{ action: 'upload_file', selector: 'input[type=file]', filePath: '/path/to/file' }`) |
273
+ | **API Contract Validation** | Define `apiContracts[]` in `targets.js` with inline `schema` or `schemaFile`; validates captured response bodies against JSON Schema (type, required, properties, items) โ€” emits `api_contract_violation` warnings when shapes diverge from spec |
274
+ | **Severity Policy Overrides** | Define `severityOverrides` in `targets.js` (`{ finding_type: 'info' \| 'warning' \| 'critical' \| 'suppress' }`); applied before Slack routing โ€” remap or silence specific detections without touching analyzer code |
275
+ | **Auth Token Refresh** | `refreshSession()` is called before each route; re-runs the login flow when the saved session has less than `sessionRefreshWindowMs` (default 5 min) remaining โ€” prevents long crawls from failing mid-run when the auth cookie expires |
276
+ | **Slack-optional mode** | When `SLACK_BOT_TOKEN` is not configured, Argus skips Slack entirely and auto-generates a local `report.html` (all findings + inline screenshots) and opens it in the default browser โ€” zero setup required to start using Argus |
277
+ | **Codebase Cross-Reference** | Points `ARGUS_SOURCE_DIR` at your app source to detect: missing env vars (`process.env.X` used in code but absent from `.env`), feature flag leakage (conditional env var that is falsy/unset), console error stack traces resolved to `file:line`, and internal links that return 404 โ€” all without opening a browser |
278
+ | **GitHub PR Integration** | Posts a structured Markdown findings table as a PR comment (updates in-place โ€” one comment per PR, no spam); sets an `argus-qa` commit status check (`failure` when new criticals exist, `success` otherwise) โ€” blocks merge via branch protection when regressions are introduced. Requires `GITHUB_TOKEN` + `GITHUB_REPOSITORY` env vars |
279
+ | **Auto Route Discovery** | Augments manual `routes[]` with paths from three sources: fetches `/sitemap.xml` (follows one sitemap-index level, 10s timeout), scans Next.js `pages/` (Next 12) and `app/` (Next 13+) directories stripping route groups `(auth)`, and greps JS/TS source for React Router `<Route path>` declarations. Dynamic `[param]` segments are skipped โ€” no concrete URL to crawl. Manual route config (`critical`, `waitFor`) always takes precedence. |
280
+ | **`argus init` Setup Wizard** | `npm run init` (or `npx argus init`) guides first-time setup: collects target URLs, detects the app framework (Next.js / React Router / unknown) from the source directory's `package.json`, runs C3 route discovery against the dev URL, prompts for optional Slack tokens and GitHub credentials, then writes a populated `.env` and a pre-filled `src/config/targets.js` โ€” zero manual config editing required. |
281
+ | **Watch Mode** | `npm run watch` attaches to whatever Chrome tab is open and polls `list_console_messages` + `list_network_requests` every 3 s (configurable via `ARGUS_WATCH_INTERVAL_MS`). Reports new console errors, network failures (4xx/5xx), CORS blocks, and auth failures in real time โ€” without navigating. On `Ctrl+C`, generates a final `reports/report.html`. No route config needed. |
282
+ | **Full Lighthouse Suite** | All 4 Lighthouse categories (performance, SEO, best-practices, accessibility) with per-audit items |
283
+ | **Performance Budgets** | Enforces LCP < 2500ms, CLS < 0.1, FID < 100ms, TTFB < 800ms per route |
284
+ | **Slack Notifications** | Rich Block Kit reports with inline screenshots routed to `#bugs-critical`, `#bugs-warnings`, `#bugs-digest` |
285
+ | **Slash Command** | `/argus-retest <url>` triggers an on-demand test from any Slack channel |
286
+ | **CI Integration** | GitHub Actions workflow runs daily at 6 AM UTC and on every push to `main` |
287
+ | **MCP Server (AI-callable Argus)** | Register Argus as an MCP server via `.mcp.json`; Claude (or any MCP client) can call `argus_audit`, `argus_audit_full`, `argus_compare`, `argus_last_report` directly from a conversation โ€” no CLI, no terminal required (`npm run mcp-server`) |
288
+
289
+ Works with **React + SCSS**, CSS Modules, CSS-in-JS (styled-components / emotion), and plain HTML/CSS apps.
290
+
291
+ ---
292
+
293
+ ## How It Works
294
+
295
+ Three components run against the same Chrome instance:
296
+
297
+ ```text
298
+ Claude Code (Terminal / VS Code)
299
+ โ”œโ”€โ”€ MCP Protocol โ†’ Chrome DevTools MCP Server โ†’ Chrome
300
+ โ””โ”€โ”€ Writes โ†’ Orchestration Layer โ†’ Slack Bot API
301
+ ```
302
+
303
+ - **Chrome DevTools MCP Server** โ€” programmatic access to Chrome: network traffic, console, screenshots, DOM, performance traces
304
+ - **Claude Code** โ€” orchestration hub: reads codebase, drives the MCP tools, classifies findings, posts to Slack
305
+ - **Slack Bot (BugBot)** โ€” receives reports, exposes `/argus-retest` slash command, handles Acknowledge / Retest button actions
306
+
307
+ In interactive mode (running from Claude Code), MCP tools are called natively. In CI mode (GitHub Actions), `src/utils/mcp-client.js` spawns `chrome-devtools-mcp` as a child process and communicates via JSON-RPC over stdio.
308
+
309
+ ---
310
+
311
+ ## Prerequisites
312
+
313
+ | Requirement | Version | Notes |
314
+ | --- | --- | --- |
315
+ | Node.js | v20.19+ | Required by Chrome DevTools MCP |
316
+ | Chrome | Stable (current) | Must be installed |
317
+ | Claude Code | Latest | `npm install -g @anthropic-ai/claude-code` |
318
+ | Slack workspace | โ€” | **Optional** โ€” only needed if you want Slack reports. Without it, Argus generates a local `report.html` instead |
319
+
320
+ ---
321
+
322
+ ## One-Time Setup
323
+
324
+ ### 1. Clone and install
325
+
326
+ ```bash
327
+ git clone <your-repo-url>
328
+ cd argus
329
+ npm install
330
+ npm run setup # creates reports/ directory
331
+ ```
332
+
333
+ ### 2. Configure environment variables
334
+
335
+ **Recommended: use the interactive setup wizard**
336
+
337
+ ```bash
338
+ npm run init
339
+ ```
340
+
341
+ The wizard prompts for your dev and staging URLs, detects your framework (Next.js / React Router), auto-discovers routes from `sitemap.xml` and your file structure, and optionally collects Slack and GitHub credentials. It writes a populated `.env` and a pre-filled `src/config/targets.js` โ€” no manual editing required.
342
+
343
+ **Alternative: manual setup**
344
+
345
+ ```bash
346
+ cp .env.example .env
347
+ ```
348
+
349
+ Open `.env` and fill in:
350
+
351
+ ```env
352
+ # Your app URLs (required)
353
+ TARGET_DEV_URL=http://localhost:3000
354
+ TARGET_STAGING_URL=https://staging.yourapp.com # leave blank โ†’ CSS-only analysis mode
355
+
356
+ # Slack โ€” OPTIONAL. Omit to get a local report.html instead of Slack messages.
357
+ # Get from: api.slack.com/apps โ†’ BugBot โ†’ OAuth & Permissions
358
+ # SLACK_BOT_TOKEN=xoxb-...
359
+ # SLACK_SIGNING_SECRET=...
360
+
361
+ # Channel IDs โ€” only needed when SLACK_BOT_TOKEN is set
362
+ # SLACK_CHANNEL_CRITICAL=C0000000000
363
+ # SLACK_CHANNEL_WARNINGS=C0000000001
364
+ # SLACK_CHANNEL_DIGEST=C0000000002
365
+ ```
366
+
367
+ ### 3. Configure your routes
368
+
369
+ If you used `npm run init` in Step 2, this file was generated for you โ€” skip to Step 4.
370
+
371
+ Otherwise, edit [src/config/targets.js](src/config/targets.js) โ€” add every key page of your app:
372
+
373
+ ```js
374
+ export const routes = [
375
+ { path: '/', name: 'Home', critical: true, waitFor: 'main' },
376
+ { path: '/login', name: 'Login', critical: true, waitFor: 'form' },
377
+ { path: '/dashboard', name: 'Dashboard', critical: true, waitFor: '[data-testid="dashboard"]' },
378
+ { path: '/settings', name: 'Settings', critical: false, waitFor: null },
379
+ ];
380
+ ```
381
+
382
+ - `critical: true` โ€” any error on this route goes to `#bugs-critical`
383
+ - `waitFor` โ€” CSS selector Argus waits for before capturing (signals the page is ready)
384
+
385
+ ### 4. Connect Chrome DevTools MCP to Claude Code
386
+
387
+ ```bash
388
+ claude mcp add chrome-devtools -- npx chrome-devtools-mcp@latest
389
+ ```
390
+
391
+ Verify it's working โ€” in Claude Code, ask:
392
+ > "List all open Chrome pages"
393
+
394
+ You should see a list of tabs. If you do, the MCP connection is live.
395
+
396
+ ### 5. Set up the Slack App (BugBot) *(optional)*
397
+
398
+ > Skip this step if you don't need Slack notifications. Argus will generate a local `report.html` and open it in the browser instead.
399
+
400
+ 1. Go to [api.slack.com/apps](https://api.slack.com/apps) โ†’ **Create New App** โ†’ From scratch โ†’ name it **BugBot**
401
+ 2. **OAuth & Permissions** โ†’ Bot Token Scopes: add `chat:write`, `files:write`, `files:read`
402
+ 3. Click **Install to Workspace** โ†’ Authorize
403
+ 4. Copy the **Bot User OAuth Token** (`xoxb-...`) into `.env` as `SLACK_BOT_TOKEN`
404
+ 5. **Basic Information** โ†’ copy **Signing Secret** into `.env` as `SLACK_SIGNING_SECRET`
405
+ 6. Create channels: `#bugs-critical`, `#bugs-warnings`, `#bugs-digest`
406
+ 7. In each channel: `/invite @BugBot`
407
+
408
+ ---
409
+
410
+ ## Running Argus
411
+
412
+ ### Option A: From Claude Code (interactive โ€” recommended)
413
+
414
+ Open Claude Code in this project directory. With Chrome DevTools MCP connected, ask:
415
+
416
+ ```text
417
+ Run the Argus error detection crawl on localhost:3000
418
+ ```
419
+
420
+ Claude calls `runCrawl(mcp)` with live MCP tools โ€” navigates pages, captures errors, posts to Slack.
421
+
422
+ ```text
423
+ Run the Argus environment comparison between localhost:3000 and staging
424
+ ```
425
+
426
+ Claude calls `runComparison(mcp)` โ€” screenshots both, diffs them, posts results.
427
+
428
+ ### Option B: From the terminal (CI / headless)
429
+
430
+ ```bash
431
+ # Error detection crawl
432
+ npm run crawl
433
+
434
+ # Generate a self-contained HTML report from the latest JSON (offline-friendly)
435
+ npm run report:html
436
+
437
+ # Environment comparison (or CSS analysis if no staging URL)
438
+ npm run compare
439
+
440
+ # Start the Slack interaction server
441
+ npm run server
442
+ ```
443
+
444
+ Reports are saved to `reports/` as JSON files. Screenshots saved alongside. Run `npm run report:html` after any crawl to get a portable `reports/report.html` with all screenshots inlined โ€” useful for sharing with designers, PMs, or reviewing offline.
445
+
446
+ ### Option C: Watch Mode (passive monitoring)
447
+
448
+ Watch mode attaches to whatever page Chrome already has open and polls for new issues at a 3-second interval โ€” without navigating anywhere. Use this for real-time reporting while you develop.
449
+
450
+ **Requires 2 terminals:**
451
+
452
+ | Terminal | Command | Purpose |
453
+ | --- | --- | --- |
454
+ | 1 | `npm start` *(or your app's dev command)* | Your application |
455
+ | 2 | `npm run watch` | Argus passive monitor |
456
+
457
+ **Sequential steps:**
458
+
459
+ 1. Open Chrome and navigate to your app's local URL
460
+ 2. Terminal 1: start your application
461
+ 3. Terminal 2: `npm run watch` โ€” Argus begins polling
462
+ 4. Develop normally โ€” any new console errors, network failures (4xx/5xx), CORS blocks, or auth failures are printed in Terminal 2 in real time
463
+ 5. `Ctrl+C` in Terminal 2 โ€” stops the monitor and writes `reports/report.html` if any issues were found
464
+
465
+ **To target a specific URL:**
466
+
467
+ ```bash
468
+ npm run watch http://localhost:4000
469
+ ```
470
+
471
+ **Environment variables:**
472
+
473
+ | Variable | Default | Description |
474
+ | --- | --- | --- |
475
+ | `ARGUS_WATCH_INTERVAL_MS` | `3000` | Poll interval in milliseconds |
476
+ | `TARGET_DEV_URL` | `http://localhost:3000` | URL attributed to findings when none passed as argument |
477
+
478
+ Watch mode uses the same Slack integration as `npm run crawl` โ€” if `SLACK_BOT_TOKEN` is configured, new findings are posted to Slack in real time. On `Ctrl+C`, the HTML report is generated from all accumulated findings for the session.
479
+
480
+ ### Option D: From Slack (on-demand)
481
+
482
+ ```text
483
+ /argus-retest https://staging.yourapp.com/checkout
484
+ ```
485
+
486
+ BugBot responds immediately, runs the test, and posts results back to the channel. Detailed bug reports go to `#bugs-critical`.
487
+
488
+ ---
489
+
490
+ ## CSS Analysis Mode
491
+
492
+ When `TARGET_STAGING_URL` is not set in `.env`, `npm run compare` automatically switches to **CSS analysis mode** instead of comparing two environments.
493
+
494
+ **What it analyzes on your dev environment:**
495
+
496
+ | Check | What it catches |
497
+ | --- | --- |
498
+ | **Cascade overrides** | Same CSS property declared multiple times on an element; `!important` flagged as warning |
499
+ | **Component style leaks** | BEM selector (`.card__title`) found in a stylesheet that doesn't belong to that component |
500
+ | **Unused rules** | CSS selectors that match no element on the current page |
501
+ | **CSS Modules** | Detects hashed class names; extracts readable component names (`Button`, `Card`, etc.) |
502
+ | **React inline style conflicts** | `style=""` attribute overriding a stylesheet declaration on the same element |
503
+ | **SCSS source maps** | Traces compiled CSS back to original `.scss` files where source maps are available |
504
+
505
+ **API frequency analysis** also runs automatically:
506
+
507
+ | Call count | Severity | Likely cause |
508
+ | --- | --- | --- |
509
+ | 2 calls | info | Possible prefetch + actual โ€” verify intentional |
510
+ | 3โ€“4 calls | warning | Double-fetch โ€” check `useEffect` deps or component re-mounts |
511
+ | 5+ calls | critical | Runaway loop โ€” missing cleanup, infinite re-render |
512
+
513
+ ---
514
+
515
+ ## Performance Budgets
516
+
517
+ Argus enforces these thresholds on every crawl:
518
+
519
+ | Metric | Threshold | Severity |
520
+ | --- | --- | --- |
521
+ | LCP (Largest Contentful Paint) | < 2500ms | warning |
522
+ | CLS (Cumulative Layout Shift) | < 0.1 | warning |
523
+ | FID / TBT (interaction latency) | < 100ms | warning |
524
+ | TTFB (Time to First Byte) | < 800ms | warning |
525
+
526
+ Violations are reported as individual warning bugs with the measured value.
527
+
528
+ ---
529
+
530
+ ## Lighthouse Suite
531
+
532
+ Runs all four Lighthouse categories on every route:
533
+
534
+ - **Accessibility** โ€” score < 50 โ†’ `critical`; score < 90 โ†’ `warning`
535
+ - **Performance** โ€” score < 90 โ†’ `warning`
536
+ - **SEO** โ€” score < 90 โ†’ `warning`
537
+ - **Best Practices** โ€” score < 90 โ†’ `warning`
538
+
539
+ Individual failing audit items (e.g., missing alt text, low contrast, render-blocking resources) are surfaced as separate findings alongside the category score.
540
+
541
+ ---
542
+
543
+ ## Slack Channel Routing
544
+
545
+ > **Slack is optional.** When `SLACK_BOT_TOKEN` is not set, Argus skips Slack entirely and
546
+ > auto-generates a local `report.html` (all findings + inline screenshots) and opens it in
547
+ > the default browser. No Slack setup needed to start using Argus.
548
+
549
+ When Slack **is** configured, findings are routed by severity:
550
+
551
+ | Severity | Channel | When |
552
+ | --- | --- | --- |
553
+ | `critical` | `#bugs-critical` | JS exceptions, HTTP 5xx, blank page, auth failure, API called 5+ times, Lighthouse accessibility < 50, auth token in storage/URL, responsive overflow, slow API > 3s, payload > 2MB, > 100 detached DOM nodes, CORS policy violations, `debugger;` statements in production code, blocked mixed content (HTTP resource on HTTPS page) |
554
+ | `warning` | `#bugs-warnings` | Visual regression > 0.5%, HTTP 4xx, CSS overrides with `!important`, API called 3โ€“4ร—, Lighthouse scores < 90, missing SEO/OG tags, missing security headers, placeholder content, touch targets too small, slow API > 1s, payload > 500KB, > 10 detached DOM nodes, redirect chains > 2 hops, broken links, sync XHR, `document.write`, long tasks > 50ms, SW registration failures, duplicate `id` attributes, passive mixed content (images/audio on HTTPS page) |
555
+ | `info` | `#bugs-digest` | Console warnings, unused CSS rules, API summaries, CSS Modules detection, empty data lists, responsive screenshot grid, missing cache headers on static assets |
556
+
557
+ Each message includes:
558
+
559
+ - Severity badge + affected URL + timestamp
560
+ - AI-generated description
561
+ - Inline screenshot (uploaded directly to Slack โ€” no external hosting)
562
+ - **View Page**, **Acknowledge**, and **Retest** action buttons
563
+
564
+ ---
565
+
566
+ ## Slack Slash Command Setup
567
+
568
+ To use `/argus-retest` from Slack, you need to expose the Argus server publicly.
569
+
570
+ ### Step 1 โ€” Start the server
571
+
572
+ ```bash
573
+ npm run server
574
+ ```
575
+
576
+ Server runs on port 3001.
577
+
578
+ ### Step 2 โ€” Expose with Cloudflare Tunnel
579
+
580
+ Download [cloudflared](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/downloads/) (free, no account needed), then:
581
+
582
+ ```bash
583
+ cloudflared tunnel --url http://localhost:3001
584
+ ```
585
+
586
+ Alternatively, with no install at all (SSH tunnel):
587
+
588
+ ```bash
589
+ ssh -R 80:localhost:3001 nokey@localhost.run
590
+ ```
591
+
592
+ Copy the public HTTPS URL that appears.
593
+
594
+ ### Step 3 โ€” Configure Slack App
595
+
596
+ 1. [api.slack.com/apps](https://api.slack.com/apps) โ†’ BugBot โ†’ **Slash Commands** โ†’ Create New Command:
597
+ - Command: `/argus-retest`
598
+ - Request URL: `https://your-public-url/slack/commands`
599
+ - Description: `Run Argus regression test on a URL`
600
+ - Usage hint: `<url>`
601
+
602
+ 2. **Interactivity & Shortcuts** โ†’ Enable โ†’ Request URL: `https://your-public-url/slack/interactions`
603
+
604
+ 3. **OAuth & Permissions** โ†’ **Reinstall to Workspace**
605
+
606
+ ### Step 4 โ€” Test
607
+
608
+ ```text
609
+ /argus-retest http://localhost:3000
610
+ ```
611
+
612
+ BugBot should reply within 3 seconds with a "running" acknowledgement, then post results.
613
+
614
+ ---
615
+
616
+ ## GitHub Actions CI Setup
617
+
618
+ ### Add secrets to your repository
619
+
620
+ Go to GitHub repo โ†’ **Settings** โ†’ **Secrets and variables** โ†’ **Actions** โ†’ add:
621
+
622
+ | Secret name | Required | Value |
623
+ | --- | --- | --- |
624
+ | `SLACK_BOT_TOKEN` | No | Your `xoxb-...` token. **Omit entirely to use Slack-optional mode** โ€” Argus generates `report.html` instead |
625
+ | `SLACK_SIGNING_SECRET` | No* | From Slack App โ†’ Basic Information (only needed for `/argus-retest` slash command) |
626
+ | `SLACK_CHANNEL_CRITICAL` | No* | Channel ID (required when Slack is configured) |
627
+ | `SLACK_CHANNEL_WARNINGS` | No* | Channel ID (required when Slack is configured) |
628
+ | `SLACK_CHANNEL_DIGEST` | No* | Channel ID (required when Slack is configured) |
629
+ | `TARGET_STAGING_URL` | Yes | Your staging base URL |
630
+ | `GITHUB_TOKEN` | No | For C2 PR integration โ€” auto-injected by GitHub Actions as `secrets.GITHUB_TOKEN` |
631
+ | `GITHUB_REPOSITORY` | No | For C2 PR integration โ€” `owner/repo` format (e.g., `acme/my-app`) |
632
+
633
+ > **C2 PR integration**: when `GITHUB_TOKEN` and `GITHUB_REPOSITORY` are set, Argus posts a PR comment and commit status check for every crawl. `GITHUB_PR_NUMBER` is injected automatically by the workflow from `github.event.pull_request.number`. The included workflow does not wire these up by default โ€” add them to the `env:` block in `.github/workflows/argus.yml` if you want PR-level comments.
634
+
635
+ The workflow at [.github/workflows/argus.yml](.github/workflows/argus.yml) runs:
636
+
637
+ - On every push to `main` / `master`
638
+ - Daily at 6 AM UTC (before the team starts work)
639
+ - Manually via **Actions** โ†’ **Run workflow** (with optional URL override)
640
+
641
+ If critical issues are found, the pipeline **fails** โ€” preventing silent regressions from being missed.
642
+
643
+ ---
644
+
645
+ ## Project Structure
646
+
647
+ ```text
648
+ argus/
649
+ โ”œโ”€โ”€ .env # Your secrets (never commit this)
650
+ โ”œโ”€โ”€ .env.example # Template โ€” copy to .env
651
+ โ”œโ”€โ”€ .gitignore
652
+ โ”œโ”€โ”€ package.json
653
+ โ”œโ”€โ”€ README.md
654
+ โ”œโ”€โ”€ .claude/
655
+ โ”‚ โ””โ”€โ”€ settings.json # Claude Code permission config (auto-approve node/npm/reports)
656
+ โ”œโ”€โ”€ .github/
657
+ โ”‚ โ””โ”€โ”€ workflows/
658
+ โ”‚ โ””โ”€โ”€ argus.yml # CI pipeline
659
+ โ”œโ”€โ”€ .vscode/
660
+ โ”‚ โ””โ”€โ”€ mcp.json # Chrome DevTools MCP config for VS Code
661
+ โ”œโ”€โ”€ .mcp.json # Argus MCP server registration โ€” exposes argus_audit/argus_audit_full/argus_compare/argus_last_report to Claude
662
+ โ”œโ”€โ”€ src/
663
+ โ”‚ โ”œโ”€โ”€ argus.js # Single-page audit entry point
664
+ โ”‚ โ”œโ”€โ”€ batch-runner.js # Multi-page batch audit
665
+ โ”‚ โ”œโ”€โ”€ mcp-server.js # Argus MCP server โ€” argus_audit / argus_audit_full / argus_compare / argus_last_report
666
+ โ”‚ โ”œโ”€โ”€ adapters/
667
+ โ”‚ โ”‚ โ””โ”€โ”€ browser.js # CdpBrowserAdapter โ€” facade over all chrome-devtools-mcp calls
668
+ โ”‚ โ”œโ”€โ”€ domain/
669
+ โ”‚ โ”‚ โ””โ”€โ”€ finding.js # createFinding() factory โ€” canonical finding shape
670
+ โ”‚ โ”œโ”€โ”€ registry.js # Analyzer plugin registry โ€” registerExpensive/getCheap/getExpensive
671
+ โ”‚ โ”œโ”€โ”€ config/
672
+ โ”‚ โ”‚ โ”œโ”€โ”€ targets.js # Routes to test, thresholds, config
673
+ โ”‚ โ”‚ โ””โ”€โ”€ schema.js # Zod validation schema; validateConfig() called inside runCrawl()
674
+ โ”‚ โ”œโ”€โ”€ orchestration/
675
+ โ”‚ โ”‚ โ”œโ”€โ”€ crawl-and-report.js # Backward-compat re-export shell โ†’ orchestrator + report-processor + dispatcher
676
+ โ”‚ โ”‚ โ”œโ”€โ”€ orchestrator.js # Crawl loop, route/flow crawl, runCrawl()
677
+ โ”‚ โ”‚ โ”œโ”€โ”€ report-processor.js # Dedup โ†’ severity overrides โ†’ baseline โ†’ JSON write
678
+ โ”‚ โ”‚ โ”œโ”€โ”€ dispatcher.js # Slack / GitHub / HTML dispatch
679
+ โ”‚ โ”‚ โ”œโ”€โ”€ env-comparison.js # Dev vs staging diff + CSS analysis mode
680
+ โ”‚ โ”‚ โ”œโ”€โ”€ watch-mode.js # Passive browser monitoring (WatchSession + runWatchMode)
681
+ โ”‚ โ”‚ โ””โ”€โ”€ slack-notifier.js # Slack Block Kit dispatcher
682
+ โ”‚ โ”œโ”€โ”€ server/
683
+ โ”‚ โ”‚ โ”œโ”€โ”€ index.js # Express server (port 3001)
684
+ โ”‚ โ”‚ โ”œโ”€โ”€ slash-command-handler.js # /argus-retest handler
685
+ โ”‚ โ”‚ โ””โ”€โ”€ interaction-handler.js # Acknowledge + Retest button handler
686
+ โ”‚ โ”œโ”€โ”€ utils/
687
+ โ”‚ โ”‚ โ”œโ”€โ”€ css-analyzer.js # CSS analysis script injected into the browser
688
+ โ”‚ โ”‚ โ”œโ”€โ”€ seo-analyzer.js # SEO checks: meta, OG tags, h1, canonical, viewport
689
+ โ”‚ โ”‚ โ”œโ”€โ”€ security-analyzer.js # Security: localStorage tokens, eval(), headers, cookies
690
+ โ”‚ โ”‚ โ”œโ”€โ”€ content-analyzer.js # Content quality: null text, placeholders, broken images
691
+ โ”‚ โ”‚ โ”œโ”€โ”€ responsive-analyzer.js # Responsive: overflow + touch targets at 4 breakpoints
692
+ โ”‚ โ”‚ โ”œโ”€โ”€ memory-analyzer.js # Memory leaks: V8 heap snapshot + heap growth
693
+ โ”‚ โ”‚ โ”œโ”€โ”€ logger.js # Pino structured logger โ€” childLogger(module)โ”‚ โ”‚ โ”œโ”€โ”€ retry.js # withRetry() exponential backoff โ€” navigate/fill only; Number.isFinite guardโ”‚ โ”‚ โ”œโ”€โ”€ telemetry.js # OTel tracing + metrics โ€” startSpan() / recordFinding() / recordFlaky() / recordNewFindings(); no-op defaultโ”‚ โ”‚ โ”œโ”€โ”€ session-manager.js # Auth: backward-compat re-export barrelโ”‚ โ”‚ โ”œโ”€โ”€ session-persistence.js # Auth: saveSession (mkdirSync+atomic write), restoreSession, hasSession, clearSessionโ”‚ โ”‚ โ”œโ”€โ”€ login-orchestrator.js # Auth: runLoginFlow, refreshSession + lock fileโ”‚ โ”‚ โ”œโ”€โ”€ baseline-manager.js # Baselines: loadBaseline, saveBaseline, applyBaseline, appendTrend
694
+ โ”‚ โ”‚ โ”œโ”€โ”€ flakiness-detector.js # Flakiness: mergeRunResults โ€” confirmed vs flaky per double-crawl
695
+ โ”‚ โ”‚ โ”œโ”€โ”€ flow-runner.js # User flow assertions: runFlow / runAllFlows โ€” assert DSL
696
+ โ”‚ โ”‚ โ”œโ”€โ”€ html-reporter.js # HTML dashboard: generateHtmlReport() + npm run report:html (D7.1 / D7.7)
697
+ โ”‚ โ”‚ โ”œโ”€โ”€ parallel-crawler.js # chunkArray sharding utility (ARGUS_CONCURRENCY=N parallel crawl)
698
+ โ”‚ โ”‚ โ”œโ”€โ”€ contract-validator.js # API contract validation: validateSchema, matchesContract (D7.4)
699
+ โ”‚ โ”‚ โ”œโ”€โ”€ severity-overrides.js # Severity policy overrides: applyOverrides (D7.5)
700
+ โ”‚ โ”‚ โ”œโ”€โ”€ slack-guard.js # Slack-optional guard: isSlackConfigured() (D7.7)
701
+ โ”‚ โ”‚ โ”œโ”€โ”€ hover-analyzer.js # Hover-state bug detection โ€” aria-haspopup + data-tooltip (D8.1)
702
+ โ”‚ โ”‚ โ”œโ”€โ”€ snapshot-analyzer.js # Accessibility tree snapshot โ€” missing names, labels, landmarks, heading hierarchy, ARIA state (D8.2 + v6)
703
+ โ”‚ โ”‚ โ”œโ”€โ”€ issues-analyzer.js # Chrome DevTools Issues panel โ€” CSP/deprecated/cookie issues
704
+ โ”‚ โ”‚ โ”œโ”€โ”€ network-timing-analyzer.js # HAR timing analysis โ€” slow third-party detection
705
+ โ”‚ โ”‚ โ”œโ”€โ”€ keyboard-analyzer.js # Keyboard Tab-walk โ€” focus_visible_missing, focus_lost
706
+ โ”‚ โ”‚ โ”œโ”€โ”€ codebase-analyzer.js # Codebase cross-reference โ€” env vars, feature flags, dead routes (C1)
707
+ โ”‚ โ”‚ โ”œโ”€โ”€ github-reporter.js # GitHub PR comment + commit status integration (C2)
708
+ โ”‚ โ”‚ โ”œโ”€โ”€ route-discoverer.js # Auto route discovery โ€” sitemap + Next.js + React Router (C3)
709
+ โ”‚ โ”‚ โ”œโ”€โ”€ diff.js # pixelmatch screenshot + DOM/network diff utilities
710
+ โ”‚ โ”‚ โ”œโ”€โ”€ mcp-parsers.js # Text-format parsers for list_console_messages + list_network_requests (v9)
711
+ โ”‚ โ”‚ โ””โ”€โ”€ mcp-client.js # Headless JSON-RPC MCP client for CI mode
712
+ โ”‚ โ””โ”€โ”€ cli/
713
+ โ”‚ โ””โ”€โ”€ init.js # argus init setup wizard โ€” detect framework, discover routes, write .env + targets.js (C4)
714
+ โ”œโ”€โ”€ test/
715
+ โ”‚ โ””โ”€โ”€ unit/ # Vitest unit tests โ€” no Chrome required
716
+ โ”‚ โ”œโ”€โ”€ finding.test.js # createFinding() โ€” fields, throws, frozen, extra fields (8 tests)
717
+ โ”‚ โ”œโ”€โ”€ config-schema.test.js # validateConfig() + ConfigSchema.safeParse (8 tests)
718
+ โ”‚ โ”œโ”€โ”€ report-processor.test.js # deduplicateFindings + rebuildSummary (11 tests)
719
+ โ”‚ โ”œโ”€โ”€ flakiness-detector.test.js # findingKey normalization + mergeRunResults (13 tests)
720
+ โ”‚ โ”œโ”€โ”€ baseline-manager.test.js # loadBaseline/saveBaseline/applyBaseline (9 tests)
721
+ โ”‚ โ””โ”€โ”€ flow-runner.test.js # normalizeArray (pure) + runFlow mock browser (11 tests)
722
+ โ”œโ”€โ”€ landing/ # Product landing page (React 18 + Vite + Tailwind + Framer Motion)
723
+ โ”‚ โ”œโ”€โ”€ src/
724
+ โ”‚ โ”‚ โ”œโ”€โ”€ App.jsx # Single-page app โ€” hero, features, comparison, waitlist + enterprise modals
725
+ โ”‚ โ”‚ โ””โ”€โ”€ supabase.js # Supabase client factory (null-safe when env vars missing)
726
+ โ”‚ โ”œโ”€โ”€ public/
727
+ โ”‚ โ”‚ โ”œโ”€โ”€ favicon.svg # SVG favicon โ€” purple ring + dot
728
+ โ”‚ โ”‚ โ”œโ”€โ”€ argus-poster.png # Video poster fallback (1918ร—1078)
729
+ โ”‚ โ”‚ โ”œโ”€โ”€ og-image-v2.jpg # OG social card โ€” 1200ร—630 JPEG, branded overlay, black-outlined stat numbers
730
+ โ”‚ โ”‚ โ”œโ”€โ”€ robots.txt # Allows all crawlers; Sitemap reference
731
+ โ”‚ โ”‚ โ””โ”€โ”€ sitemap.xml # Canonical URL for argus-qa.com/
732
+ โ”‚ โ”œโ”€โ”€ index.html # Vite entry; OG/Twitter/JSON-LD SEO tags; canonical; favicon
733
+ โ”‚ โ”œโ”€โ”€ package.json
734
+ โ”‚ โ”œโ”€โ”€ .env.example # VITE_SUPABASE_URL + VITE_SUPABASE_ANON_KEY template
735
+ โ”‚ โ””โ”€โ”€ README.md # Setup guide, Supabase SQL schema, env vars, deployment
736
+ โ”œโ”€โ”€ scripts/
737
+ โ”‚ โ””โ”€โ”€ dispatch-report.js # Standalone Slack re-dispatch script (re-posts last report.json to Slack)
738
+ โ”œโ”€โ”€ test-harness/ # Fixture server + test runner (82 blocks, 348 hard assertions, 54 fixture pages)
739
+ โ”‚ โ”œโ”€โ”€ README.md
740
+ โ”‚ โ”œโ”€โ”€ server.js # Express fixture server (ports 3100 dev / 3101 staging)
741
+ โ”‚ โ”œโ”€โ”€ harness-config.js # Route definitions + expected findings
742
+ โ”‚ โ”œโ”€โ”€ validate.js # Test runner โ€” 82 numbered blocks ([80] MCP server, [81] createFinding, [82] withRetry)
743
+ โ”‚ โ”œโ”€โ”€ pages/ # 54 fixture pages (one per detection category)
744
+ โ”‚ โ”œโ”€โ”€ nextjs-fixture/ # Next.js app structure for C3 discovery tests (10 files)
745
+ โ”‚ โ”œโ”€โ”€ source-fixture/ # Minimal app.js for C1 codebase-analyzer tests (env var audit)
746
+ โ”‚ โ””โ”€โ”€ static/
747
+ โ”‚ โ””โ”€โ”€ button-styles.css # BEM card selectors in button file โ†’ component leak
748
+ โ””โ”€โ”€ reports/ # Output: JSON reports + screenshots (gitignored)
749
+ โ”œโ”€โ”€ baselines/
750
+ โ”‚ โ”œโ”€โ”€ <branch>.json # Per-route finding keys โ€” per git branch (D7.2)
751
+ โ”‚ โ””โ”€โ”€ <branch>-trends.json # Append-only run history per branch (D7.2)
752
+ โ””โ”€โ”€ .gitkeep
753
+ ```
754
+
755
+ ---
756
+
757
+ ## Key Technical Decisions
758
+
759
+ | Decision | Choice | Reason |
760
+ | --- | --- | --- |
761
+ | Screenshot comparison | pixelmatch + AI classification | pixelmatch is fast and deterministic; Claude removes false positives from anti-aliasing and dynamic content |
762
+ | Slack API | Bot API, not Incoming Webhooks | Bot API supports file uploads, message updates, interactive buttons, and threads |
763
+ | File uploads | `files.getUploadURLExternal` + PUT + `files.completeUploadExternal` | `files.upload` is deprecated; pre-signed URL requires PUT โ€” POST silently produces broken files |
764
+ | CSS analysis | Script injected via `evaluate_script` | Runs in page context so it sees the live computed styles, CSS Modules hashes, and React fiber properties |
765
+ | Responsive viewport | `emulate` (not `resize_page`) | `resize_page` only resizes the browser window and does not update CSS viewport width โ€” `emulate` is the correct API |
766
+ | Viewport width measurement | `document.documentElement.clientWidth` | After `emulate` with mobile flag, `window.innerWidth` returns the legacy layout viewport (~952px), not the device width |
767
+ | V8 heap snapshot | `take_memory_snapshot({ filePath })` โ†’ read from disk | The MCP tool writes JSON to disk (not inline); parse with `JSON.parse(fs.readFileSync(filePath))` then delete the temp file |
768
+ | Detached DOM detection | Walk flat `nodes` array for "Detached " prefix in strings table | Chrome serializes detached elements as "Detached HTMLDivElement" etc.; secondary check on `detachedness === 2` (Chrome 90+) |
769
+ | Baseline finding key | `type::message[:100]::status` | Excludes timestamps and dynamic URL path IDs; message truncated to 100 chars to handle slight wording variations; `::status` suffix only added when non-null |
770
+ | Baseline alert filter | `isNew === true` (strict) | Only findings explicitly marked new by `applyBaseline` are dispatched to Slack โ€” prevents stale re-dispatch if baseline-manager is not called (fails silently rather than spamming) |
771
+ | Flakiness routing | `severity: 'info'` for flaky findings | Downgrading severity means existing `dispatchToSlack` routing sends them to the info digest with zero routing changes โ€” only the `:zap: _flaky_` label needed |
772
+ | Private `findingKey` per module | Each of `baseline-manager.js` and `flakiness-detector.js` has its own copy | Avoids coupling two independently-useful modules via a shared export for a trivial 3-line function |
773
+ | Runtime anti-pattern injection | `addScriptToEvaluateOnNewDocument` via MCP | Scripts registered this way run in the new page context before any page script โ€” intercepts `XMLHttpRequest.open`, `document.write`, and `navigator.serviceWorker.register` before the page can call them |
774
+ | CORS error detection | `list_console_messages` + text match, not in-page intercept | CORS errors are generated by the browser itself, not by page JS โ€” `console.error` patcher misses them; the MCP console log captures them |
775
+ | Long task detection | `PerformanceObserver({ entryTypes: ['longtask'] })` injected before load | Only the duration is included in the finding message (not `startTime`) โ€” ensures identical tasks on two crawl runs produce the same dedup key |
776
+ | CI MCP client | JSON-RPC over stdio | In CI there's no Claude Code agent โ€” the headless client replaces it with the same API surface |
777
+ | Node.js | v20.19+ | Minimum required by Chrome DevTools MCP |
778
+
779
+ ---
780
+
781
+ ## Known MCP Tool Limitations
782
+
783
+ The Chrome DevTools MCP behavioral constraints below cause **3 permanent test failures** in the harness (`345/348` pass). These are MCP-layer restrictions โ€” they cannot be fixed in Argus code.
784
+
785
+ > **`type_text` clarification**: `type_text` does fire DOM `input` events when the element is properly focused first with `mcp.click({ uid })`. Always use uid-based focus โ€” passing `{ selector }` to `mcp.click` silently does nothing.
786
+
787
+ | Tool | Constraint | Impact |
788
+ | --- | --- | --- |
789
+ | `drag` | Uses mouse simulation, **not** HTML5 DnD API | `dragstart`/`dragover`/`drop` events never fire |
790
+ | `list_console_messages({ types: ['issue'] })` | Issues panel returns empty even when violations exist | CSP and deprecated-API detection is unreliable |
791
+
792
+ These constraints are documented with workarounds in [SKILL.md ยง10](SKILL.md).
793
+
794
+ ---
795
+
796
+ ## Environment Variables Reference
797
+
798
+ | Variable | Required | Description |
799
+ | --- | --- | --- |
800
+ | `SLACK_BOT_TOKEN` | No | `xoxb-...` Bot User OAuth Token. **Omit to enable Slack-optional mode** โ€” Argus generates `report.html` and opens it in the browser instead |
801
+ | `SLACK_SIGNING_SECRET` | No* | Verifies slash command / interaction requests from Slack (required only when using `/argus-retest`) |
802
+ | `SLACK_CHANNEL_CRITICAL` | No* | Channel ID for critical bugs (required when Slack is configured) |
803
+ | `SLACK_CHANNEL_WARNINGS` | No* | Channel ID for warnings (required when Slack is configured) |
804
+ | `SLACK_CHANNEL_DIGEST` | No* | Channel ID for info / daily digest (required when Slack is configured) |
805
+ | `TARGET_DEV_URL` | Yes | Base URL of your dev environment |
806
+ | `TARGET_STAGING_URL` | No | Base URL of staging. If blank โ†’ CSS analysis mode |
807
+ | `SCREENSHOT_DIFF_THRESHOLD` | No | Pixel diff % to flag (default: `0.5`) |
808
+ | `REPORT_OUTPUT_DIR` | No | Where to write reports (default: `./reports`) |
809
+ | `ARGUS_CONCURRENCY` | No | Number of parallel MCP clients for route crawling (default: `1` = sequential) |
810
+ | `PORT` | No | Server port (default: `3001`) |
811
+ | `ARGUS_LOG_LEVEL` | No | Pino log level โ€” `trace`, `debug`, `info`, `warn`, `error`, `fatal` (default: `info`) |
812
+ | `ARGUS_LOG_PRETTY` | No | Set to `1` for human-readable log output instead of JSON (dev mode) |
813
+ | `ARGUS_RETRY_ATTEMPTS` | No | Max retry attempts for `navigate`/`fill` MCP calls (default: `3`) |
814
+ | `OTEL_EXPORTER_OTLP_ENDPOINT` | No | OTLP collector endpoint โ€” enables span/metric export to Jaeger, Grafana Tempo, Datadog, etc. |
815
+ | `ARGUS_OTEL_CONSOLE` | No | Set to `1` to print OTel spans to stdout without an OTLP endpoint (dev tracing) |
816
+ | `ARGUS_WATCH_INTERVAL_MS` | No | Watch mode poll interval in milliseconds (default: `3000`) |
817
+ | `ARGUS_SOURCE_DIR` | No | Path to your app's source directory โ€” enables codebase cross-reference (env var detection, feature flag leakage, dead routes) |
818
+ | `ARGUS_ENV_FILE` | No | Path to your app's `.env` file โ€” C1 cross-references env vars used in source code against this file to detect missing declarations |
819
+ | `GITHUB_TOKEN` | No | GitHub personal access token โ€” required for PR comment + commit status integration |
820
+ | `GITHUB_REPOSITORY` | No | Repository in `owner/repo` format โ€” required for GitHub PR integration |
821
+ | `GITHUB_SHA` | No | Commit SHA for the commit status check โ€” injected automatically by GitHub Actions (`${{ github.sha }}`) |
822
+ | `GITHUB_PR_NUMBER` | No | PR number for comment targeting โ€” set via `${{ github.event.pull_request.number }}` in your workflow |
823
+ | `ARGUS_REPORT_URL` | No | Full URL to the hosted HTML report โ€” linked from the GitHub commit status check |
824
+
825
+ ---
826
+
827
+ ## Troubleshooting
828
+
829
+ ### Chrome DevTools MCP not connecting
830
+
831
+ ```bash
832
+ claude mcp add chrome-devtools -- npx chrome-devtools-mcp@latest
833
+ # Then restart Claude Code
834
+ ```
835
+
836
+ ### Slack messages not posting
837
+
838
+ - Confirm `SLACK_BOT_TOKEN` starts with `xoxb-` (not `xoxp-`, `xoxe-`, or `xapp-`)
839
+ - Verify BugBot is invited to each channel: `/invite @BugBot`
840
+ - Check token scopes: `chat:write`, `files:write`, `files:read`
841
+
842
+ ### Screenshots not appearing in Slack messages
843
+
844
+ - The upload uses a pre-signed URL that requires `PUT`, not `POST` โ€” if you see a broken image, check that the Slack token has `files:write` scope and the channel is correct
845
+
846
+ ### Slash command returns "dispatch_failed"
847
+
848
+ - Your tunnel URL has changed (Cloudflare Tunnel / localhost.run URLs change on restart)
849
+ - Update the Request URL in Slack App โ†’ Slash Commands and reinstall
850
+
851
+ ### CSS analysis returns empty results
852
+
853
+ - Page may be behind auth โ€” make sure you're logged in on the Chrome instance Argus is controlling
854
+ - Cross-origin stylesheets (CDN fonts, third-party widgets) can't be read due to browser security restrictions โ€” this is expected
855
+
856
+ ### Screenshots are blank
857
+
858
+ - Page hasn't finished loading โ€” increase `pageSettleMs` in `src/config/targets.js`
859
+ - Add a `waitFor` selector for that route
860
+
861
+ ### CI pipeline fails immediately
862
+
863
+ - Chrome may not be starting fast enough โ€” increase the `sleep 3` after Chrome launch to `sleep 5` in `.github/workflows/argus.yml`
864
+
865
+ ---
866
+
867
+ ## How Argus Differs From Playwright / Cypress
868
+
869
+ Argus is not a replacement for unit or E2E tests. It's a complementary layer:
870
+
871
+ | | Playwright / Cypress | Argus |
872
+ | --- | --- | --- |
873
+ | **Tests** | Your logic and API contracts | What the user actually sees |
874
+ | **Catches** | Regression in behaviour | CSS drift, visual regressions, API redundancy, console noise, perf budgets |
875
+ | **Runs** | In your test suite | Continuously, on the live running app |
876
+ | **Setup** | Write test files | Configure routes in `targets.js` |
877
+ | **Output** | Pass / fail | Structured Slack reports with screenshots and action buttons |
878
+
879
+ They complement each other โ€” Argus catches what test suites miss.