@seanyao/roll 3.609.2 → 3.610.2

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 (103) hide show
  1. package/CHANGELOG.md +44 -1
  2. package/README.md +5 -6
  3. package/dist/roll.mjs +16146 -16186
  4. package/package.json +3 -2
  5. package/skills/README.md +14 -1
  6. package/skills/docs/skill-authoring.md +66 -0
  7. package/skills/reports/skill-audit-summary.md +53 -0
  8. package/skills/roll-.changelog/SKILL.md +25 -443
  9. package/skills/roll-.changelog/references/full-contract.md +462 -0
  10. package/skills/roll-.clarify/SKILL.md +6 -4
  11. package/skills/roll-.dream/SKILL.md +26 -353
  12. package/skills/roll-.dream/references/full-contract.md +365 -0
  13. package/skills/roll-.echo/SKILL.md +6 -4
  14. package/skills/roll-.qa/SKILL.md +25 -236
  15. package/skills/roll-.qa/references/full-contract.md +256 -0
  16. package/skills/roll-.review/SKILL.md +6 -2
  17. package/skills/roll-brief/SKILL.md +6 -8
  18. package/skills/roll-build/SKILL.md +28 -864
  19. package/skills/roll-build/references/full-contract.md +883 -0
  20. package/skills/roll-debug/SKILL.md +26 -585
  21. package/skills/roll-debug/references/full-contract.md +607 -0
  22. package/skills/roll-design/SKILL.md +28 -903
  23. package/skills/roll-design/references/full-contract.md +923 -0
  24. package/skills/roll-doc/SKILL.md +25 -574
  25. package/skills/roll-doc/references/full-contract.md +594 -0
  26. package/skills/roll-doctor/SKILL.md +21 -2
  27. package/skills/roll-fix/SKILL.md +28 -621
  28. package/skills/roll-fix/references/full-contract.md +640 -0
  29. package/skills/roll-idea/SKILL.md +6 -2
  30. package/skills/roll-loop/SKILL.md +27 -543
  31. package/skills/roll-loop/references/full-contract.md +555 -0
  32. package/skills/roll-notes/SKILL.md +6 -2
  33. package/skills/roll-onboard/SKILL.md +6 -2
  34. package/skills/roll-peer/SKILL.md +27 -316
  35. package/skills/roll-peer/references/full-contract.md +329 -0
  36. package/skills/roll-propose/SKILL.md +6 -8
  37. package/skills/roll-review-pr/SKILL.md +6 -2
  38. package/skills/roll-sentinel/SKILL.md +26 -344
  39. package/skills/roll-sentinel/references/full-contract.md +363 -0
  40. package/skills/roll-spar/SKILL.md +27 -269
  41. package/skills/roll-spar/references/full-contract.md +288 -0
  42. package/skills/route-cases/skills.json +235 -0
  43. package/skills/scripts/audit-skills.mjs +272 -0
  44. package/skills/scripts/test-audit-skills.mjs +39 -0
  45. package/skills/tests/fixtures/skill-audit/block-skill/SKILL.md +12 -0
  46. package/skills/tests/fixtures/skill-audit/minimal-skill/SKILL.md +8 -0
  47. package/skills/tests/fixtures/skill-audit/quoted-skill/SKILL.md +10 -0
  48. package/skills/tests/fixtures/skill-audit/route-cases.json +21 -0
  49. package/skills/tests/fixtures/skill-audit/spoke-skill/SKILL.md +12 -0
  50. package/skills/tests/fixtures/skill-audit/spoke-skill/references/runbook.md +3 -0
  51. package/bin/roll +0 -15361
  52. package/lib/backfill-pi-usage.py +0 -243
  53. package/lib/changelog_audit.py +0 -149
  54. package/lib/changelog_generate.py +0 -470
  55. package/lib/consistency_check.py +0 -409
  56. package/lib/context_feed_budget.sh +0 -194
  57. package/lib/github_sync.py +0 -876
  58. package/lib/i18n/slides.sh +0 -3
  59. package/lib/i18n/slides_build.sh +0 -38
  60. package/lib/i18n/slides_delete.sh +0 -19
  61. package/lib/i18n/slides_list.sh +0 -14
  62. package/lib/i18n/slides_logs.sh +0 -12
  63. package/lib/i18n/slides_new.sh +0 -15
  64. package/lib/i18n/slides_preview.sh +0 -14
  65. package/lib/i18n/slides_templates.sh +0 -7
  66. package/lib/i18n.sh +0 -211
  67. package/lib/loop-exit-summary.py +0 -393
  68. package/lib/loop-fmt.py +0 -589
  69. package/lib/loop_pick_agent.py +0 -316
  70. package/lib/loop_result_eval.py +0 -469
  71. package/lib/loop_unstick.py +0 -180
  72. package/lib/model_prices.py +0 -194
  73. package/lib/prices_fetcher.py +0 -534
  74. package/lib/roll-backlog.py +0 -225
  75. package/lib/roll-brief.py +0 -286
  76. package/lib/roll-help.py +0 -158
  77. package/lib/roll-home.py +0 -556
  78. package/lib/roll-init.py +0 -156
  79. package/lib/roll-loop-status.py +0 -1691
  80. package/lib/roll-loop-story.py +0 -191
  81. package/lib/roll-peer.py +0 -252
  82. package/lib/roll-setup.py +0 -102
  83. package/lib/roll-status.py +0 -367
  84. package/lib/roll_git.py +0 -41
  85. package/lib/roll_render.py +0 -414
  86. package/lib/slides/components/README.md +0 -123
  87. package/lib/slides/components/cards-2.html +0 -9
  88. package/lib/slides/components/cards-3.html +0 -9
  89. package/lib/slides/components/cards-4.html +0 -9
  90. package/lib/slides/components/compare.html +0 -22
  91. package/lib/slides/components/highlight.html +0 -9
  92. package/lib/slides/components/pipeline.html +0 -12
  93. package/lib/slides/components/plain.html +0 -7
  94. package/lib/slides/components/quote.html +0 -4
  95. package/lib/slides/components/timeline.html +0 -9
  96. package/lib/slides/templates/introduction-v3.html +0 -571
  97. package/lib/slides/templates/pitch.html +0 -0
  98. package/lib/slides-render.py +0 -778
  99. package/lib/slides-validate.py +0 -357
  100. package/lib/test_quality_gate.py +0 -143
  101. package/skills/roll-deck/SKILL.md +0 -296
  102. /package/skills/roll-debug/{injectable-bb.js → assets/injectable-bb.js} +0 -0
  103. /package/skills/roll-design/{ENGINEERING_CHECKLIST.md → references/engineering-checklist.md} +0 -0
@@ -2,606 +2,47 @@
2
2
  name: roll-debug
3
3
  license: MIT
4
4
  allowed-tools: "Read, Edit, Write, Bash, Agent"
5
- description: Universal web debugger. Mounts a Black Box (BB) diagnostic probe on any page, collects rich diagnostics, analyzes root causes, and auto-fixes when the root cause is in project source. Cleans up after itself.
5
+ description: "Load when a web page needs black-box browser diagnostics, console/network/state capture, root-cause analysis, and source fixes for project-owned issues."
6
6
  ---
7
-
8
7
  # Roll Debug
9
8
 
10
- Web debugging tool that treats the **Black Box (BB) as a diagnostic probe** — mounted when needed, unmounted when done. Combines diagnostic collection, analysis, and auto-repair into a single workflow: **Mount Collect Analyze Unmount Auto-Fix (when fixable) Re-verify**.
11
-
12
- ## Philosophy
13
-
14
- - BB is a **diagnostic probe**, not a product feature. Pages do not need to integrate BB natively.
15
- - For any web diagnosis, **mount BB first** (unless already present).
16
- - The entire lifecycle is **explicit and visible**: you see when BB mounts, when it collects, and when it unmounts.
17
- - A visible **BB button** appears on the page during diagnosis so you always know the probe is active.
9
+ This hub keeps the routing boundary, hard gates, and execution skeleton in the initial context. Load the heavier runbook only when the task actually needs the detailed contract.
18
10
 
19
- ## When to Use
11
+ ## Load
20
12
 
21
- - "Debug the page"
22
- - "See what's wrong"
23
- - "Page shows blank"
24
- - "Feature not working"
25
- - User uploads a diagnostic file (`diagnostics-*.json`, `bb-report.json`)
26
- - "Analyze BB data", "look at the diagnostic file"
27
- - Any scenario requiring web page diagnosis
13
+ Load when a web page needs black-box browser diagnostics, console/network/state capture, root-cause analysis, and source fixes for project-owned issues.
28
14
 
29
15
  ## When Not to Use
30
16
 
31
- - Non-web environments (CLI tools, backend-only services) — outside this skill's scope
32
- - Scheduled production sampling / acceptance checks (use `$roll-sentinel`)
33
- - Pure source-reading without runtime reproduction
34
-
35
- ## Quick Start
36
-
37
- ```bash
38
- # Full workflow: mount + collect + analyze + unmount (recommended)
39
- $roll-debug https://example.com/page
40
-
41
- # Collect data only, skip analysis
42
- $roll-debug https://example.com/page --no-analyze
43
-
44
- # Skip BB mount, use built-in universal collector
45
- $roll-debug https://example.com/page --universal
46
-
47
- # Use a custom BB SDK instead of the built-in stub
48
- $roll-debug https://example.com/page --bb-sdk-url https://cdn.example.com/bb.js
49
-
50
- # Analyze an existing report file (skip collection)
51
- $roll-debug --report /tmp/bb-report.json
52
-
53
- # Batch: diagnose multiple pages
54
- $roll-debug https://site.com/page1,https://site.com/page2
55
- $roll-debug --file urls.txt
56
- ```
57
-
58
- ## BB Probe Lifecycle
59
-
60
- ```
61
- User: "Debug the page"
62
-
63
-
64
- ┌─────────────────────────────────────┐
65
- │ 1. Mount BB Probe │
66
- │ ├── Check: page already has BB? │
67
- │ │ ├── Yes → reuse existing │
68
- │ │ └── No → inject BB │
69
- │ │ ├── Built-in stub (default)
70
- │ │ └── Custom SDK (--bb-sdk-url)
71
- │ ├── Wait for initialization │
72
- │ └── BB button appears on page │
73
- └──────────────────┬──────────────────┘
74
-
75
-
76
- ┌─────────────────────────────────────┐
77
- │ 2. Collect diagnostic data │
78
- │ ├── Console logs │
79
- │ ├── Network requests │
80
- │ ├── DOM state │
81
- │ ├── Performance metrics │
82
- │ └── Screenshot │
83
- └──────────────────┬──────────────────┘
84
-
85
-
86
- ┌─────────────────────────────────────┐
87
- │ 3. Analyze report │
88
- │ ├── Read /tmp/bb-report.json │
89
- │ ├── Root cause analysis │
90
- │ ├── Issue severity │
91
- │ └── Structured findings │
92
- └──────────────────┬──────────────────┘
93
-
94
-
95
- ┌─────────────────────────────────────┐
96
- │ 4. Unmount BB Probe │
97
- │ ├── Restore console/fetch/XHR │
98
- │ ├── Remove BB button from DOM │
99
- │ ├── Delete window.__BB_DATA__ │
100
- │ └── Page state fully restored │
101
- └──────────────────┬──────────────────┘
102
-
103
-
104
- ┌─────────────────────────────────────┐
105
- │ 5. Auto-Fix Decision Gate │
106
- │ ├── Assess root cause location │
107
- │ │ and fixability │
108
- │ ├── Fixable? │
109
- │ │ ├── Yes (single-file, │
110
- │ │ │ bounded scope) │
111
- │ │ │ → enter $roll-fix TCR │
112
- │ │ │ workflow automatically │
113
- │ │ ├── Complex (cross-module, │
114
- │ │ │ architectural) │
115
- │ │ │ → create US-XXX │
116
- │ │ │ → suggest $roll-build │
117
- │ │ └── External (third-party │
118
- │ │ API, infra) │
119
- │ │ → report findings only │
120
- │ └── Tell user what was found │
121
- │ and what was done │
122
- └──────────────────┬──────────────────┘
123
- │ (if auto-fixed)
124
-
125
- ┌─────────────────────────────────────┐
126
- │ 6. Re-verify (after fix) │
127
- │ ├── Re-mount BB probe │
128
- │ ├── Collect + analyze again │
129
- │ ├── Confirm issue is resolved │
130
- │ └── Unmount BB probe │
131
- └──────────────────┬──────────────────┘
132
-
133
-
134
- Report to user (findings + actions taken)
135
- ```
136
-
137
- ## Collection Modes
138
-
139
- ### Mode 1: Mounted BB (Default)
140
-
141
- BB probe is mounted on the page — either reused from an existing BB or freshly injected.
142
-
143
- **Visual indicator**: a red circular **BB** button appears at the bottom-right of the page.
144
-
145
- **Data collected via BB interface**:
146
- - Console logs (error/warn/info)
147
- - Network requests (failed XHR/fetch, slow requests)
148
- - DOM state (key elements visibility, HTML length)
149
- - Performance metrics (load time, FCP, LCP)
150
- - JavaScript errors with stack traces
151
-
152
- **BB Sources**:
153
-
154
- | Source | When Used | Capability |
155
- |--------|-----------|------------|
156
- | Existing native BB | Page already has `[data-testid="bb-toggle"]` or `window.__BB_DATA__` | Full app-specific metrics (contentState, audioState, etc.) |
157
- | Built-in stub | Default when no BB present | Generic metrics (console, network, DOM, performance, errors) |
158
- | Custom SDK | `--bb-sdk-url` provided | Determined by the SDK implementation |
159
-
160
- ### Mode 2: Universal Diagnostic (No BB)
161
-
162
- When `--universal` is passed, skip BB mount entirely. Use Playwright's built-in event listeners directly.
163
-
164
- ```bash
165
- $roll-debug https://example.com/page --universal
166
- ```
167
-
168
- Useful when:
169
- - You explicitly do not want to modify the page state
170
- - The page has strict CSP that blocks script injection
171
- - You need a quick check without probe overhead
172
-
173
- ## Usage Examples
174
-
175
- ### Example 1: Full auto-mount + analyze (default)
176
-
177
- ```bash
178
- $roll-debug https://yyy.up.railway.app/story/cars/chapter/1
179
-
180
- 🔍 Diagnosing https://yyy.up.railway.app/story/cars/chapter/1
181
- 📡 Mounting BB probe...
182
- ├── Source: built-in stub
183
- └── Status: ready (320ms)
184
- └── BB button visible on page ✓
185
- 📊 Collecting data via BB...
186
- ├── Console: 3 errors, 5 warnings
187
- ├── Network: 2 failed requests
188
- ├── DOM: #app rendered, .content empty
189
- └── Screenshot: saved to /tmp/bb-screenshot.png
190
- 🔬 Analyzing...
191
- 🧹 Unmounting BB probe... done
192
- └── Page state restored ✓
193
-
194
- Report: /tmp/bb-report.json
195
-
196
- ## Diagnostic Analysis Report
197
-
198
- ### Basic Info
199
- | Field | Value |
200
- |-------|-------|
201
- | Diagnostic Mode | mounted-bb (stub) |
202
- | Page URL | https://yyy.up.railway.app/story/cars/chapter/1 |
203
-
204
- ### Key Findings
205
- | Metric | Value | Status |
206
- |--------|-------|--------|
207
- | contentLength | 0 | Not loaded |
208
- | audioState.src | "" | Not set |
209
- | hasText | false | No content |
210
- | Console Errors | 3 | Critical |
211
- | Network Failed | 2 | Critical |
212
-
213
- ### Diagnosis Conclusion
214
- useEffect dependency error causing content not to load.
215
- Dependency `[chapter?.id]` should be `[chapter?.number]`
216
-
217
- ### Auto-Fix
218
- Root cause is in project source (Player.tsx:45), single-file, bounded scope.
219
- Entering $roll-fix TCR workflow...
220
-
221
- 🧪 Test: added regression test for chapter content loading
222
- 🔧 Fix: Player.tsx:45 — useEffect dep [chapter?.id] → [chapter?.number]
223
- ✅ TCR: test green, committed
224
- 🔍 Review: $roll-.review passed
225
- 📤 Push: origin/main
226
- ⏳ CI: green
227
- 🚀 Deploy: https://yyy.up.railway.app
228
-
229
- 🔄 Re-verifying...
230
- 📡 Re-mounting BB probe...
231
- 📊 Collecting data...
232
- ├── Console: 0 errors
233
- ├── contentLength: 2340
234
- └── hasText: true
235
- 🧹 Unmounting BB probe... done
236
-
237
- ✅ Issue resolved. Content now loads correctly.
238
- ```
239
-
240
- ### Example 2: Reuse existing native BB
241
-
242
- ```bash
243
- $roll-debug https://example.com/page
244
-
245
- 🔍 Diagnosing https://example.com/page
246
- 📡 Mounting BB probe...
247
- ├── Native BB detected
248
- └── Reusing existing probe
249
- 📊 Collecting data via BB...
250
- ├── Console: 0 errors
251
- ├── Network: 0 failed
252
- └── DOM: fully rendered
253
- 🔬 Analyzing...
254
- 🧹 Unmounting BB probe... skipped
255
- └── Native BB left intact
256
-
257
- No issues found. Page is healthy.
258
- ```
259
-
260
- ### Example 3: Universal mode (no BB mount)
261
-
262
- ```bash
263
- $roll-debug https://example.com --universal
264
-
265
- 🔍 Diagnosing https://example.com (universal mode)
266
- 📡 BB mount skipped (--universal)
267
- 📊 Collecting data via Playwright events...
268
- ├── Console Errors: 2
269
- │ ├── TypeError: Cannot read property 'id' of undefined
270
- │ │ at Player.tsx:45
271
- │ └── ReferenceError: AudioContext is not defined
272
- ├── Failed Network: 1
273
- │ └── GET https://api.example.com/data 404
274
- └── Screenshot: /tmp/bb-screenshot.png
275
- 🔬 Analyzing...
276
-
277
- Report: /tmp/bb-report.json
278
-
279
- ### Key Findings
280
- | Metric | Value | Status |
281
- |--------|-------|--------|
282
- | Console Errors | 2 | Critical |
283
- | Network Failed | 1 | Critical |
284
- ```
285
-
286
- ### Example 4: Analyze existing report file
287
-
288
- ```bash
289
- $roll-debug --report /tmp/bb-report.json
290
-
291
- Reading report: /tmp/bb-report.json (mode: mounted-bb)
292
-
293
- ### Key Findings
294
- ...
295
- ```
296
-
297
- ## Analysis: Supported Report Formats
298
-
299
- | Format | Source | Description |
300
- |--------|--------|-------------|
301
- | Mounted BB (stub) | Injected built-in stub | `window.__BB_DATA__` via injectable-bb.js |
302
- | Mounted BB (native) | Page with existing Black Box | `window.__BB_DATA__` or `localStorage.bb_diagnostic` |
303
- | Mounted BB (custom) | Custom SDK via `--bb-sdk-url` | Determined by SDK |
304
- | Universal | Playwright native events | Direct event listener data |
305
- | Legacy | Old diagnostic files | Backward compatible |
306
-
307
- ### Mounted BB Mode Fields
308
-
309
- ```javascript
310
- const bbData = report.diagnostic.bbData;
311
- bbData.contentState?.hasText
312
- bbData.contentState?.contentLength
313
- bbData.audioState?.src
314
- bbData.audioState?.error
315
- bbData.hasAudio
316
- bbData.errors
317
- bbData.console.errors
318
- bbData.console.warnings
319
- bbData.network.failed
320
- bbData.dom.keyElements
321
- bbData.performance.loadComplete
322
- ```
323
-
324
- ### Universal Mode Fields
325
-
326
- ```javascript
327
- const d = report.diagnostic;
328
- d.console.errors
329
- d.console.warnings
330
- d.network.failed
331
- d.network.slow
332
- d.dom.title
333
- d.dom['#root']
334
- d.dom.htmlLength
335
- d.performance.loadComplete
336
- d.performance.domContentLoaded
337
- ```
338
-
339
- ## Analysis Report Template
340
-
341
- ```markdown
342
- ## Diagnostic Analysis Report
343
-
344
- ### Basic Info
345
- | Field | Value |
346
- |-------|-------|
347
- | Diagnostic Mode | {mounted-bb / universal} |
348
- | BB Source | {native / stub / custom-sdk} |
349
- | Page URL | {url} |
350
- | Collected At | {timestamp} |
351
-
352
- ### Key Findings
353
- | Metric | Value | Status |
354
- |--------|-------|--------|
355
- | Console Errors | {N} | {Critical if >0, OK if 0} |
356
- | Network Failed | {N} | {Critical if >0, OK if 0} |
357
- | DOM Rendering | {status} | {OK / Not rendered} |
358
- | Load Time | {X}ms | {OK <2s, Slow 2-5s, Critical >5s} |
359
-
360
- ### Diagnosis Conclusion
361
- {Root cause in plain language}
362
-
363
- ### Suggested Fix
364
- {Actionable fix steps}
365
- ```
366
-
367
- ## Common Issue Patterns
368
-
369
- ### Blank Page
370
- - `dom.htmlLength < 500` or `dom['#root'].visible = false`
371
- - Fix: Check console errors, add error boundary
372
-
373
- ### Content Not Loading
374
- - `hasText = false` or `contentLength = 0`
375
- - Fix: Check API, refresh OSS URL, fix useEffect dependencies
376
-
377
- ### Audio Error
378
- - `audioState.error` exists
379
- - Fix: Refresh signed URL, check audio format compatibility
380
-
381
- ### Network Failure
382
- - `network.failed` has 4xx/5xx responses
383
- - Fix: Check API routes, add CORS headers
384
-
385
- ### Performance Issues
386
- - LCP > 5s or DOMContentLoaded > 3s
387
- - Fix: Code-split large bundles, lazy-load images, cache API responses
388
-
389
- ## Implementation Notes
390
-
391
- ### BB Mount Flow (Playwright)
392
-
393
- ```javascript
394
- // Pseudocode for AI agent execution
395
- async function diagnose(page, url, args) {
396
- log(`🔍 Diagnosing ${url}`);
397
-
398
- // Step 1: Mount
399
- const bbState = await mountBB(page, args);
400
- log(`📡 Mounting BB probe...`);
401
- log(` ├── Source: ${bbState.source}`); // native / stub / custom
402
- log(` └── Status: ${bbState.ready ? 'ready' : 'failed'}`);
403
-
404
- if (bbState.ready && bbState.source !== 'native') {
405
- log(` └── BB button visible on page ✓`);
406
- }
407
-
408
- // Step 2: Collect
409
- log(`📊 Collecting data via BB...`);
410
- const data = await collectViaBB(page);
411
-
412
- // Step 3: Analyze
413
- log(`🔬 Analyzing...`);
414
- const analysis = await analyze(data);
415
-
416
- // Step 4: Unmount (unless native BB)
417
- if (bbState.source !== 'native') {
418
- log(`🧹 Unmounting BB probe...`);
419
- const ok = await page.evaluate(() => window.__BB_UNMOUNT__?.());
420
- log(` └── ${ok ? 'done' : 'failed'}`);
421
- log(` └── Page state restored ✓`);
422
- } else {
423
- log(`🧹 Unmounting BB probe... skipped`);
424
- log(` └── Native BB left intact`);
425
- }
426
-
427
- return analysis;
428
- }
429
-
430
- async function mountBB(page, args) {
431
- // Check for existing BB
432
- const hasNative = await page.evaluate(() =>
433
- !!document.querySelector('[data-testid="bb-toggle"]') || !!window.__BB_DATA__
434
- );
435
- if (hasNative) {
436
- return { source: 'native', ready: true };
437
- }
438
-
439
- if (args.universal) {
440
- return { source: 'universal', ready: false };
441
- }
442
-
443
- // Inject BB
444
- try {
445
- if (args.bbSdkUrl) {
446
- await page.addScriptTag({ url: args.bbSdkUrl });
447
- } else {
448
- const stubPath = path.join(__dirname, 'injectable-bb.js');
449
- await page.addScriptTag({ path: stubPath });
450
- }
451
-
452
- // Poll for readiness
453
- const ready = await poll(
454
- () => page.evaluate(() => !!window.__BB_DATA__),
455
- { timeout: 5000, interval: 200 }
456
- );
457
-
458
- return { source: args.bbSdkUrl ? 'custom' : 'stub', ready };
459
- } catch (e) {
460
- return { source: 'stub', ready: false, error: e.message };
461
- }
462
- }
463
- ```
464
-
465
- ### Built-in Stub (`injectable-bb.js`)
466
-
467
- The stub is injected via `page.addScriptTag({ path })` when no native BB exists.
468
-
469
- **Capabilities**:
470
- - Hooks `console.*` with internal error firewall (stub bugs never leak to page)
471
- - Hooks `fetch` and `XMLHttpRequest` transparently — original behavior fully preserved
472
- - Listens for `error` and `unhandledrejection`
473
- - Captures Performance Navigation Timing + FCP + LCP
474
- - Captures DOM state (title, HTML length, key element visibility)
475
- - Renders a visible **BB** button on the page
476
-
477
- **Cleanup**:
478
- - `window.__BB_UNMOUNT__()` restores all modified globals to their original references
479
- - Removes the BB button from DOM
480
- - Deletes `window.__BB_DATA__` and `window.__BB_UNMOUNT__`
481
-
482
- ### Universal Mode (No BB)
483
-
484
- When `--universal` is used, collect via Playwright native events:
485
-
486
- ```javascript
487
- page.on('console', msg => ...);
488
- page.on('requestfailed', req => ...);
489
- page.on('response', res => ...);
490
- page.on('pageerror', err => ...);
491
- ```
492
-
493
- No page state is modified.
494
-
495
- ## Data Output Formats
496
-
497
- ### Mounted BB Mode
498
-
499
- ```json
500
- {
501
- "mode": "mounted-bb",
502
- "bbSource": "stub",
503
- "timestamp": "2024-01-15T10:30:00Z",
504
- "url": "https://example.com/page",
505
- "bbData": {},
506
- "mountedAt": 1705315800000,
507
- "unmountedAt": 1705315805000
508
- }
509
- ```
510
-
511
- ### Universal Mode
512
-
513
- ```json
514
- {
515
- "mode": "universal",
516
- "timestamp": "2024-01-15T10:30:00Z",
517
- "url": "https://example.com/page",
518
- "diagnostic": {
519
- "console": {
520
- "errors": [{"message": "...", "stack": "...", "timestamp": "..."}],
521
- "warnings": [],
522
- "logs": []
523
- },
524
- "network": {
525
- "failed": [{"url": "...", "status": 404, "method": "GET"}],
526
- "slow": [{"url": "...", "duration": 5000}]
527
- },
528
- "dom": {
529
- "title": "Page Title",
530
- "htmlLength": 2340,
531
- "keyElements": {
532
- "#root": {"exists": true, "visible": true, "text": "..."},
533
- ".error": {"exists": false}
534
- }
535
- },
536
- "performance": {
537
- "domContentLoaded": 1200,
538
- "loadComplete": 2300,
539
- "firstContentfulPaint": 2300,
540
- "largestContentfulPaint": 4500
541
- }
542
- },
543
- "screenshots": {
544
- "viewport": "/tmp/roll-debug-viewport.png",
545
- "fullPage": "/tmp/roll-debug-fullpage.png"
546
- }
547
- }
548
- ```
17
+ - Static architecture scans; load roll-.dream.
18
+ - General code review; load roll-.review or roll-review-pr.
549
19
 
550
- ## Capability Comparison
20
+ ## Read On Demand
551
21
 
552
- | Feature | Mounted BB (stub) | Mounted BB (native) | Universal |
553
- |---------|-------------------|---------------------|-----------|
554
- | Page modification | Yes (mount/unmount) | No (already there) | No |
555
- | Visible BB button | Yes | If native has one | No |
556
- | Console logs | Yes | Yes | Yes |
557
- | Network data | Yes | Yes | Yes |
558
- | DOM state | Detailed | Detailed | Key elements |
559
- | App-specific metrics | No | Yes | No |
560
- | Screenshot | Yes | Yes | Yes |
561
- | Performance metrics | Yes | Yes | Yes |
562
- | Works offline | Yes | Yes | Yes |
563
- | Cleanup on exit | Yes (full restore) | N/A | N/A |
22
+ - Read [the full contract](references/full-contract.md) before executing the workflow end to end, recovering from failures, or checking exact output templates.
23
+ - Read [Black Box probe asset](assets/injectable-bb.js) when mounting the built-in diagnostic stub.
24
+ - Keep this hub in context for trigger boundaries and hard gates.
564
25
 
565
- ## Safety & Cleanup Guarantees
26
+ ## Workflow Skeleton
566
27
 
567
- 1. **Stub errors are firewalled** — every hook wraps its internal logic in try/catch. A bug in the stub cannot crash the page.
568
- 2. **Original behavior preserved** — fetch/XHR wrappers return the exact same values/throw the exact same errors as the originals.
569
- 3. **Full unmount** — `__BB_UNMOUNT__()` restores console, fetch, XHR, removes listeners, removes DOM element, and deletes globals.
570
- 4. **Native BB untouched** if a page already has BB, it is reused but never unmounted.
571
- 5. **CSP fallback** if script injection fails (CSP), automatically falls back to Universal mode.
28
+ 1. Open or attach to the target page.
29
+ 2. Mount the Black Box probe and collect diagnostics.
30
+ 3. Analyze console, network, DOM, storage, and source clues.
31
+ 4. Fix only project-owned root causes.
32
+ 5. Unmount the probe and report evidence.
572
33
 
573
- ## Auto-Fix Behavior
34
+ ## Hard Gates
574
35
 
575
- After diagnosis, roll-debug automatically assesses whether the root cause can be fixed — **no flag needed**. The decision is context-driven:
36
+ - Cleanup is mandatory.
37
+ - Do not hide external-service or environment faults as source fixes.
576
38
 
577
- ```
578
- Root cause identified
579
-
580
- ├── In project source + single-file + bounded scope
581
- │ └── AUTO-FIX: enter $roll-fix TCR workflow
582
- │ ├── Write regression test (RED)
583
- │ ├── Apply fix (GREEN)
584
- │ ├── TCR commit
585
- │ ├── $roll-.review staged
586
- │ ├── Push → CI → Deploy
587
- │ └── Re-mount BB → re-verify on page
588
-
589
- ├── In project source + cross-module / architectural
590
- │ └── ESCALATE: create US-XXX in .roll/backlog.md
591
- │ ├── Suggest: $roll-build US-XXX
592
- │ └── Report diagnosis findings
593
-
594
- └── External (third-party API, infra, CDN, DNS)
595
- └── REPORT ONLY
596
- ├── What was found
597
- └── Suggested actions (manual or external)
598
- ```
39
+ ## Gotchas
599
40
 
600
- **Quality gates preserved**: When auto-fixing, all `$roll-fix` quality gates apply TCR, `$roll-.review`, push, CI, deploy. No shortcuts.
41
+ - Mount the black-box probe only long enough to diagnose; clean it up before final delivery.
42
+ - Only auto-fix root causes in project source; external services and browser environment issues need clear attribution.
601
43
 
602
- **Re-verification**: After a successful auto-fix, roll-debug re-mounts the BB probe on the same page and re-runs diagnosis to confirm the issue is actually resolved. If the issue persists, it reports the remaining findings.
44
+ ## Maintenance
603
45
 
604
- **User communication**: roll-debug always tells the user:
605
- - What was found (root cause, severity)
606
- - What was done (auto-fixed / escalated / reported)
607
- - Why (fixability assessment reasoning)
46
+ - Description changes require updates in `route-cases/skills.json`.
47
+ - New observed failures should add a gotcha and the matching positive or negative route case.
48
+ - Heavy examples, templates, recovery paths, and deterministic snippets belong in `references/`, `assets/`, or `scripts/`, not in this hub.