@seanyao/roll 3.620.1 → 3.624.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +46 -0
- package/dist/roll.mjs +4563 -3369
- package/package.json +1 -1
- package/lib/__pycache__/changelog_audit.cpython-314.pyc +0 -0
- package/lib/__pycache__/github_sync.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop-fmt.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_result_eval.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_unstick.cpython-314.pyc +0 -0
- package/lib/__pycache__/model_prices.cpython-314.pyc +0 -0
- package/lib/__pycache__/prices_fetcher.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-home.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-loop-status.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_git.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_render.cpython-314.pyc +0 -0
- package/lib/__pycache__/slides-render.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/__init__.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/gemini.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/kimi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/openai.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi_emit.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/qwen.cpython-314.pyc +0 -0
- package/skills/README.md +0 -64
- package/skills/docs/skill-authoring.md +0 -74
- package/skills/reports/skill-audit-summary.md +0 -53
- package/skills/roll-.changelog/SKILL.md +0 -47
- package/skills/roll-.changelog/references/full-contract.md +0 -462
- package/skills/roll-.clarify/SKILL.md +0 -64
- package/skills/roll-.dream/SKILL.md +0 -47
- package/skills/roll-.dream/references/full-contract.md +0 -365
- package/skills/roll-.echo/SKILL.md +0 -118
- package/skills/roll-.qa/SKILL.md +0 -47
- package/skills/roll-.qa/references/full-contract.md +0 -256
- package/skills/roll-.review/SKILL.md +0 -148
- package/skills/roll-build/SKILL.md +0 -49
- package/skills/roll-build/references/full-contract.md +0 -968
- package/skills/roll-debug/SKILL.md +0 -48
- package/skills/roll-debug/assets/injectable-bb.js +0 -263
- package/skills/roll-debug/references/full-contract.md +0 -607
- package/skills/roll-design/SKILL.md +0 -52
- package/skills/roll-design/references/engineering-checklist.md +0 -298
- package/skills/roll-design/references/full-contract.md +0 -940
- package/skills/roll-doc-audit/SKILL.md +0 -51
- package/skills/roll-doc-audit/references/full-contract.md +0 -796
- package/skills/roll-doctor/SKILL.md +0 -211
- package/skills/roll-fix/SKILL.md +0 -49
- package/skills/roll-fix/references/full-contract.md +0 -672
- package/skills/roll-idea/SKILL.md +0 -62
- package/skills/roll-loop/SKILL.md +0 -50
- package/skills/roll-loop/references/full-contract.md +0 -534
- package/skills/roll-notes/SKILL.md +0 -107
- package/skills/roll-onboard/SKILL.md +0 -238
- package/skills/roll-peer/SKILL.md +0 -47
- package/skills/roll-peer/references/full-contract.md +0 -323
- package/skills/roll-propose/SKILL.md +0 -155
- package/skills/roll-review-pr/SKILL.md +0 -62
- package/skills/roll-spar/SKILL.md +0 -47
- package/skills/roll-spar/references/full-contract.md +0 -288
- package/skills/route-cases/skills.json +0 -216
- package/skills/scripts/audit-skills.mjs +0 -272
- package/skills/scripts/test-audit-skills.mjs +0 -39
- package/skills/tests/fixtures/skill-audit/block-skill/SKILL.md +0 -12
- package/skills/tests/fixtures/skill-audit/minimal-skill/SKILL.md +0 -8
- package/skills/tests/fixtures/skill-audit/quoted-skill/SKILL.md +0 -10
- package/skills/tests/fixtures/skill-audit/route-cases.json +0 -21
- package/skills/tests/fixtures/skill-audit/spoke-skill/SKILL.md +0 -12
- package/skills/tests/fixtures/skill-audit/spoke-skill/references/runbook.md +0 -3
|
@@ -1,607 +0,0 @@
|
|
|
1
|
-
# Full Contract Reference
|
|
2
|
-
|
|
3
|
-
This file preserves the detailed contract extracted from SKILL.md. Read it when the hub points here for exact workflow steps, templates, rubrics, or recovery branches.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# Roll Debug
|
|
8
|
-
|
|
9
|
-
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**.
|
|
10
|
-
|
|
11
|
-
## Philosophy
|
|
12
|
-
|
|
13
|
-
- BB is a **diagnostic probe**, not a product feature. Pages do not need to integrate BB natively.
|
|
14
|
-
- For any web diagnosis, **mount BB first** (unless already present).
|
|
15
|
-
- The entire lifecycle is **explicit and visible**: you see when BB mounts, when it collects, and when it unmounts.
|
|
16
|
-
- A visible **BB button** appears on the page during diagnosis so you always know the probe is active.
|
|
17
|
-
|
|
18
|
-
## When to Use
|
|
19
|
-
|
|
20
|
-
- "Debug the page"
|
|
21
|
-
- "See what's wrong"
|
|
22
|
-
- "Page shows blank"
|
|
23
|
-
- "Feature not working"
|
|
24
|
-
- User uploads a diagnostic file (`diagnostics-*.json`, `bb-report.json`)
|
|
25
|
-
- "Analyze BB data", "look at the diagnostic file"
|
|
26
|
-
- Any scenario requiring web page diagnosis
|
|
27
|
-
|
|
28
|
-
## When Not to Use
|
|
29
|
-
|
|
30
|
-
- Non-web environments (CLI tools, backend-only services) — outside this skill's scope
|
|
31
|
-
- Scheduled production sampling / acceptance checks (use `$roll-sentinel`)
|
|
32
|
-
- Pure source-reading without runtime reproduction
|
|
33
|
-
|
|
34
|
-
## Quick Start
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Full workflow: mount + collect + analyze + unmount (recommended)
|
|
38
|
-
$roll-debug https://example.com/page
|
|
39
|
-
|
|
40
|
-
# Collect data only, skip analysis
|
|
41
|
-
$roll-debug https://example.com/page --no-analyze
|
|
42
|
-
|
|
43
|
-
# Skip BB mount, use built-in universal collector
|
|
44
|
-
$roll-debug https://example.com/page --universal
|
|
45
|
-
|
|
46
|
-
# Use a custom BB SDK instead of the built-in stub
|
|
47
|
-
$roll-debug https://example.com/page --bb-sdk-url https://cdn.example.com/bb.js
|
|
48
|
-
|
|
49
|
-
# Analyze an existing report file (skip collection)
|
|
50
|
-
$roll-debug --report /tmp/bb-report.json
|
|
51
|
-
|
|
52
|
-
# Batch: diagnose multiple pages
|
|
53
|
-
$roll-debug https://site.com/page1,https://site.com/page2
|
|
54
|
-
$roll-debug --file urls.txt
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
## BB Probe Lifecycle
|
|
58
|
-
|
|
59
|
-
```
|
|
60
|
-
User: "Debug the page"
|
|
61
|
-
│
|
|
62
|
-
▼
|
|
63
|
-
┌─────────────────────────────────────┐
|
|
64
|
-
│ 1. Mount BB Probe │
|
|
65
|
-
│ ├── Check: page already has BB? │
|
|
66
|
-
│ │ ├── Yes → reuse existing │
|
|
67
|
-
│ │ └── No → inject BB │
|
|
68
|
-
│ │ ├── Built-in stub (default)
|
|
69
|
-
│ │ └── Custom SDK (--bb-sdk-url)
|
|
70
|
-
│ ├── Wait for initialization │
|
|
71
|
-
│ └── BB button appears on page │
|
|
72
|
-
└──────────────────┬──────────────────┘
|
|
73
|
-
│
|
|
74
|
-
▼
|
|
75
|
-
┌─────────────────────────────────────┐
|
|
76
|
-
│ 2. Collect diagnostic data │
|
|
77
|
-
│ ├── Console logs │
|
|
78
|
-
│ ├── Network requests │
|
|
79
|
-
│ ├── DOM state │
|
|
80
|
-
│ ├── Performance metrics │
|
|
81
|
-
│ └── Screenshot │
|
|
82
|
-
└──────────────────┬──────────────────┘
|
|
83
|
-
│
|
|
84
|
-
▼
|
|
85
|
-
┌─────────────────────────────────────┐
|
|
86
|
-
│ 3. Analyze report │
|
|
87
|
-
│ ├── Read /tmp/bb-report.json │
|
|
88
|
-
│ ├── Root cause analysis │
|
|
89
|
-
│ ├── Issue severity │
|
|
90
|
-
│ └── Structured findings │
|
|
91
|
-
└──────────────────┬──────────────────┘
|
|
92
|
-
│
|
|
93
|
-
▼
|
|
94
|
-
┌─────────────────────────────────────┐
|
|
95
|
-
│ 4. Unmount BB Probe │
|
|
96
|
-
│ ├── Restore console/fetch/XHR │
|
|
97
|
-
│ ├── Remove BB button from DOM │
|
|
98
|
-
│ ├── Delete window.__BB_DATA__ │
|
|
99
|
-
│ └── Page state fully restored │
|
|
100
|
-
└──────────────────┬──────────────────┘
|
|
101
|
-
│
|
|
102
|
-
▼
|
|
103
|
-
┌─────────────────────────────────────┐
|
|
104
|
-
│ 5. Auto-Fix Decision Gate │
|
|
105
|
-
│ ├── Assess root cause location │
|
|
106
|
-
│ │ and fixability │
|
|
107
|
-
│ ├── Fixable? │
|
|
108
|
-
│ │ ├── Yes (single-file, │
|
|
109
|
-
│ │ │ bounded scope) │
|
|
110
|
-
│ │ │ → enter $roll-fix TCR │
|
|
111
|
-
│ │ │ workflow automatically │
|
|
112
|
-
│ │ ├── Complex (cross-module, │
|
|
113
|
-
│ │ │ architectural) │
|
|
114
|
-
│ │ │ → create US-XXX │
|
|
115
|
-
│ │ │ → suggest $roll-build │
|
|
116
|
-
│ │ └── External (third-party │
|
|
117
|
-
│ │ API, infra) │
|
|
118
|
-
│ │ → report findings only │
|
|
119
|
-
│ └── Tell user what was found │
|
|
120
|
-
│ and what was done │
|
|
121
|
-
└──────────────────┬──────────────────┘
|
|
122
|
-
│ (if auto-fixed)
|
|
123
|
-
▼
|
|
124
|
-
┌─────────────────────────────────────┐
|
|
125
|
-
│ 6. Re-verify (after fix) │
|
|
126
|
-
│ ├── Re-mount BB probe │
|
|
127
|
-
│ ├── Collect + analyze again │
|
|
128
|
-
│ ├── Confirm issue is resolved │
|
|
129
|
-
│ └── Unmount BB probe │
|
|
130
|
-
└──────────────────┬──────────────────┘
|
|
131
|
-
│
|
|
132
|
-
▼
|
|
133
|
-
Report to user (findings + actions taken)
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
## Collection Modes
|
|
137
|
-
|
|
138
|
-
### Mode 1: Mounted BB (Default)
|
|
139
|
-
|
|
140
|
-
BB probe is mounted on the page — either reused from an existing BB or freshly injected.
|
|
141
|
-
|
|
142
|
-
**Visual indicator**: a red circular **BB** button appears at the bottom-right of the page.
|
|
143
|
-
|
|
144
|
-
**Data collected via BB interface**:
|
|
145
|
-
- Console logs (error/warn/info)
|
|
146
|
-
- Network requests (failed XHR/fetch, slow requests)
|
|
147
|
-
- DOM state (key elements visibility, HTML length)
|
|
148
|
-
- Performance metrics (load time, FCP, LCP)
|
|
149
|
-
- JavaScript errors with stack traces
|
|
150
|
-
|
|
151
|
-
**BB Sources**:
|
|
152
|
-
|
|
153
|
-
| Source | When Used | Capability |
|
|
154
|
-
|--------|-----------|------------|
|
|
155
|
-
| Existing native BB | Page already has `[data-testid="bb-toggle"]` or `window.__BB_DATA__` | Full app-specific metrics (contentState, audioState, etc.) |
|
|
156
|
-
| Built-in stub | Default when no BB present | Generic metrics (console, network, DOM, performance, errors) |
|
|
157
|
-
| Custom SDK | `--bb-sdk-url` provided | Determined by the SDK implementation |
|
|
158
|
-
|
|
159
|
-
### Mode 2: Universal Diagnostic (No BB)
|
|
160
|
-
|
|
161
|
-
When `--universal` is passed, skip BB mount entirely. Use Playwright's built-in event listeners directly.
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
$roll-debug https://example.com/page --universal
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
Useful when:
|
|
168
|
-
- You explicitly do not want to modify the page state
|
|
169
|
-
- The page has strict CSP that blocks script injection
|
|
170
|
-
- You need a quick check without probe overhead
|
|
171
|
-
|
|
172
|
-
## Usage Examples
|
|
173
|
-
|
|
174
|
-
### Example 1: Full auto-mount + analyze (default)
|
|
175
|
-
|
|
176
|
-
```bash
|
|
177
|
-
$roll-debug https://yyy.up.railway.app/story/cars/chapter/1
|
|
178
|
-
|
|
179
|
-
🔍 Diagnosing https://yyy.up.railway.app/story/cars/chapter/1
|
|
180
|
-
📡 Mounting BB probe...
|
|
181
|
-
├── Source: built-in stub
|
|
182
|
-
└── Status: ready (320ms)
|
|
183
|
-
└── BB button visible on page ✓
|
|
184
|
-
📊 Collecting data via BB...
|
|
185
|
-
├── Console: 3 errors, 5 warnings
|
|
186
|
-
├── Network: 2 failed requests
|
|
187
|
-
├── DOM: #app rendered, .content empty
|
|
188
|
-
└── Screenshot: saved to /tmp/bb-screenshot.png
|
|
189
|
-
🔬 Analyzing...
|
|
190
|
-
🧹 Unmounting BB probe... done
|
|
191
|
-
└── Page state restored ✓
|
|
192
|
-
|
|
193
|
-
Report: /tmp/bb-report.json
|
|
194
|
-
|
|
195
|
-
## Diagnostic Analysis Report
|
|
196
|
-
|
|
197
|
-
### Basic Info
|
|
198
|
-
| Field | Value |
|
|
199
|
-
|-------|-------|
|
|
200
|
-
| Diagnostic Mode | mounted-bb (stub) |
|
|
201
|
-
| Page URL | https://yyy.up.railway.app/story/cars/chapter/1 |
|
|
202
|
-
|
|
203
|
-
### Key Findings
|
|
204
|
-
| Metric | Value | Status |
|
|
205
|
-
|--------|-------|--------|
|
|
206
|
-
| contentLength | 0 | Not loaded |
|
|
207
|
-
| audioState.src | "" | Not set |
|
|
208
|
-
| hasText | false | No content |
|
|
209
|
-
| Console Errors | 3 | Critical |
|
|
210
|
-
| Network Failed | 2 | Critical |
|
|
211
|
-
|
|
212
|
-
### Diagnosis Conclusion
|
|
213
|
-
useEffect dependency error causing content not to load.
|
|
214
|
-
Dependency `[chapter?.id]` should be `[chapter?.number]`
|
|
215
|
-
|
|
216
|
-
### Auto-Fix
|
|
217
|
-
Root cause is in project source (Player.tsx:45), single-file, bounded scope.
|
|
218
|
-
Entering $roll-fix TCR workflow...
|
|
219
|
-
|
|
220
|
-
🧪 Test: added regression test for chapter content loading
|
|
221
|
-
🔧 Fix: Player.tsx:45 — useEffect dep [chapter?.id] → [chapter?.number]
|
|
222
|
-
✅ TCR: test green, committed
|
|
223
|
-
🔍 Review: $roll-.review passed
|
|
224
|
-
📤 Push: origin/main
|
|
225
|
-
⏳ CI: green
|
|
226
|
-
🚀 Deploy: https://yyy.up.railway.app
|
|
227
|
-
|
|
228
|
-
🔄 Re-verifying...
|
|
229
|
-
📡 Re-mounting BB probe...
|
|
230
|
-
📊 Collecting data...
|
|
231
|
-
├── Console: 0 errors
|
|
232
|
-
├── contentLength: 2340
|
|
233
|
-
└── hasText: true
|
|
234
|
-
🧹 Unmounting BB probe... done
|
|
235
|
-
|
|
236
|
-
✅ Issue resolved. Content now loads correctly.
|
|
237
|
-
```
|
|
238
|
-
|
|
239
|
-
### Example 2: Reuse existing native BB
|
|
240
|
-
|
|
241
|
-
```bash
|
|
242
|
-
$roll-debug https://example.com/page
|
|
243
|
-
|
|
244
|
-
🔍 Diagnosing https://example.com/page
|
|
245
|
-
📡 Mounting BB probe...
|
|
246
|
-
├── Native BB detected
|
|
247
|
-
└── Reusing existing probe
|
|
248
|
-
📊 Collecting data via BB...
|
|
249
|
-
├── Console: 0 errors
|
|
250
|
-
├── Network: 0 failed
|
|
251
|
-
└── DOM: fully rendered
|
|
252
|
-
🔬 Analyzing...
|
|
253
|
-
🧹 Unmounting BB probe... skipped
|
|
254
|
-
└── Native BB left intact
|
|
255
|
-
|
|
256
|
-
No issues found. Page is healthy.
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### Example 3: Universal mode (no BB mount)
|
|
260
|
-
|
|
261
|
-
```bash
|
|
262
|
-
$roll-debug https://example.com --universal
|
|
263
|
-
|
|
264
|
-
🔍 Diagnosing https://example.com (universal mode)
|
|
265
|
-
📡 BB mount skipped (--universal)
|
|
266
|
-
📊 Collecting data via Playwright events...
|
|
267
|
-
├── Console Errors: 2
|
|
268
|
-
│ ├── TypeError: Cannot read property 'id' of undefined
|
|
269
|
-
│ │ at Player.tsx:45
|
|
270
|
-
│ └── ReferenceError: AudioContext is not defined
|
|
271
|
-
├── Failed Network: 1
|
|
272
|
-
│ └── GET https://api.example.com/data 404
|
|
273
|
-
└── Screenshot: /tmp/bb-screenshot.png
|
|
274
|
-
🔬 Analyzing...
|
|
275
|
-
|
|
276
|
-
Report: /tmp/bb-report.json
|
|
277
|
-
|
|
278
|
-
### Key Findings
|
|
279
|
-
| Metric | Value | Status |
|
|
280
|
-
|--------|-------|--------|
|
|
281
|
-
| Console Errors | 2 | Critical |
|
|
282
|
-
| Network Failed | 1 | Critical |
|
|
283
|
-
```
|
|
284
|
-
|
|
285
|
-
### Example 4: Analyze existing report file
|
|
286
|
-
|
|
287
|
-
```bash
|
|
288
|
-
$roll-debug --report /tmp/bb-report.json
|
|
289
|
-
|
|
290
|
-
Reading report: /tmp/bb-report.json (mode: mounted-bb)
|
|
291
|
-
|
|
292
|
-
### Key Findings
|
|
293
|
-
...
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
## Analysis: Supported Report Formats
|
|
297
|
-
|
|
298
|
-
| Format | Source | Description |
|
|
299
|
-
|--------|--------|-------------|
|
|
300
|
-
| Mounted BB (stub) | Injected built-in stub | `window.__BB_DATA__` via assets/injectable-bb.js |
|
|
301
|
-
| Mounted BB (native) | Page with existing Black Box | `window.__BB_DATA__` or `localStorage.bb_diagnostic` |
|
|
302
|
-
| Mounted BB (custom) | Custom SDK via `--bb-sdk-url` | Determined by SDK |
|
|
303
|
-
| Universal | Playwright native events | Direct event listener data |
|
|
304
|
-
| Legacy | Old diagnostic files | Backward compatible |
|
|
305
|
-
|
|
306
|
-
### Mounted BB Mode Fields
|
|
307
|
-
|
|
308
|
-
```javascript
|
|
309
|
-
const bbData = report.diagnostic.bbData;
|
|
310
|
-
bbData.contentState?.hasText
|
|
311
|
-
bbData.contentState?.contentLength
|
|
312
|
-
bbData.audioState?.src
|
|
313
|
-
bbData.audioState?.error
|
|
314
|
-
bbData.hasAudio
|
|
315
|
-
bbData.errors
|
|
316
|
-
bbData.console.errors
|
|
317
|
-
bbData.console.warnings
|
|
318
|
-
bbData.network.failed
|
|
319
|
-
bbData.dom.keyElements
|
|
320
|
-
bbData.performance.loadComplete
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
### Universal Mode Fields
|
|
324
|
-
|
|
325
|
-
```javascript
|
|
326
|
-
const d = report.diagnostic;
|
|
327
|
-
d.console.errors
|
|
328
|
-
d.console.warnings
|
|
329
|
-
d.network.failed
|
|
330
|
-
d.network.slow
|
|
331
|
-
d.dom.title
|
|
332
|
-
d.dom['#root']
|
|
333
|
-
d.dom.htmlLength
|
|
334
|
-
d.performance.loadComplete
|
|
335
|
-
d.performance.domContentLoaded
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
## Analysis Report Template
|
|
339
|
-
|
|
340
|
-
```markdown
|
|
341
|
-
## Diagnostic Analysis Report
|
|
342
|
-
|
|
343
|
-
### Basic Info
|
|
344
|
-
| Field | Value |
|
|
345
|
-
|-------|-------|
|
|
346
|
-
| Diagnostic Mode | {mounted-bb / universal} |
|
|
347
|
-
| BB Source | {native / stub / custom-sdk} |
|
|
348
|
-
| Page URL | {url} |
|
|
349
|
-
| Collected At | {timestamp} |
|
|
350
|
-
|
|
351
|
-
### Key Findings
|
|
352
|
-
| Metric | Value | Status |
|
|
353
|
-
|--------|-------|--------|
|
|
354
|
-
| Console Errors | {N} | {Critical if >0, OK if 0} |
|
|
355
|
-
| Network Failed | {N} | {Critical if >0, OK if 0} |
|
|
356
|
-
| DOM Rendering | {status} | {OK / Not rendered} |
|
|
357
|
-
| Load Time | {X}ms | {OK <2s, Slow 2-5s, Critical >5s} |
|
|
358
|
-
|
|
359
|
-
### Diagnosis Conclusion
|
|
360
|
-
{Root cause in plain language}
|
|
361
|
-
|
|
362
|
-
### Suggested Fix
|
|
363
|
-
{Actionable fix steps}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
## Common Issue Patterns
|
|
367
|
-
|
|
368
|
-
### Blank Page
|
|
369
|
-
- `dom.htmlLength < 500` or `dom['#root'].visible = false`
|
|
370
|
-
- Fix: Check console errors, add error boundary
|
|
371
|
-
|
|
372
|
-
### Content Not Loading
|
|
373
|
-
- `hasText = false` or `contentLength = 0`
|
|
374
|
-
- Fix: Check API, refresh OSS URL, fix useEffect dependencies
|
|
375
|
-
|
|
376
|
-
### Audio Error
|
|
377
|
-
- `audioState.error` exists
|
|
378
|
-
- Fix: Refresh signed URL, check audio format compatibility
|
|
379
|
-
|
|
380
|
-
### Network Failure
|
|
381
|
-
- `network.failed` has 4xx/5xx responses
|
|
382
|
-
- Fix: Check API routes, add CORS headers
|
|
383
|
-
|
|
384
|
-
### Performance Issues
|
|
385
|
-
- LCP > 5s or DOMContentLoaded > 3s
|
|
386
|
-
- Fix: Code-split large bundles, lazy-load images, cache API responses
|
|
387
|
-
|
|
388
|
-
## Implementation Notes
|
|
389
|
-
|
|
390
|
-
### BB Mount Flow (Playwright)
|
|
391
|
-
|
|
392
|
-
```javascript
|
|
393
|
-
// Pseudocode for AI agent execution
|
|
394
|
-
async function diagnose(page, url, args) {
|
|
395
|
-
log(`🔍 Diagnosing ${url}`);
|
|
396
|
-
|
|
397
|
-
// Step 1: Mount
|
|
398
|
-
const bbState = await mountBB(page, args);
|
|
399
|
-
log(`📡 Mounting BB probe...`);
|
|
400
|
-
log(` ├── Source: ${bbState.source}`); // native / stub / custom
|
|
401
|
-
log(` └── Status: ${bbState.ready ? 'ready' : 'failed'}`);
|
|
402
|
-
|
|
403
|
-
if (bbState.ready && bbState.source !== 'native') {
|
|
404
|
-
log(` └── BB button visible on page ✓`);
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
// Step 2: Collect
|
|
408
|
-
log(`📊 Collecting data via BB...`);
|
|
409
|
-
const data = await collectViaBB(page);
|
|
410
|
-
|
|
411
|
-
// Step 3: Analyze
|
|
412
|
-
log(`🔬 Analyzing...`);
|
|
413
|
-
const analysis = await analyze(data);
|
|
414
|
-
|
|
415
|
-
// Step 4: Unmount (unless native BB)
|
|
416
|
-
if (bbState.source !== 'native') {
|
|
417
|
-
log(`🧹 Unmounting BB probe...`);
|
|
418
|
-
const ok = await page.evaluate(() => window.__BB_UNMOUNT__?.());
|
|
419
|
-
log(` └── ${ok ? 'done' : 'failed'}`);
|
|
420
|
-
log(` └── Page state restored ✓`);
|
|
421
|
-
} else {
|
|
422
|
-
log(`🧹 Unmounting BB probe... skipped`);
|
|
423
|
-
log(` └── Native BB left intact`);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
return analysis;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
async function mountBB(page, args) {
|
|
430
|
-
// Check for existing BB
|
|
431
|
-
const hasNative = await page.evaluate(() =>
|
|
432
|
-
!!document.querySelector('[data-testid="bb-toggle"]') || !!window.__BB_DATA__
|
|
433
|
-
);
|
|
434
|
-
if (hasNative) {
|
|
435
|
-
return { source: 'native', ready: true };
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
if (args.universal) {
|
|
439
|
-
return { source: 'universal', ready: false };
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
// Inject BB
|
|
443
|
-
try {
|
|
444
|
-
if (args.bbSdkUrl) {
|
|
445
|
-
await page.addScriptTag({ url: args.bbSdkUrl });
|
|
446
|
-
} else {
|
|
447
|
-
const skillRoot = path.resolve(__dirname, '..');
|
|
448
|
-
const stubPath = path.join(skillRoot, 'assets', '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 (`assets/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
|
-
```
|
|
549
|
-
|
|
550
|
-
## Capability Comparison
|
|
551
|
-
|
|
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 |
|
|
564
|
-
|
|
565
|
-
## Safety & Cleanup Guarantees
|
|
566
|
-
|
|
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.
|
|
572
|
-
|
|
573
|
-
## Auto-Fix Behavior
|
|
574
|
-
|
|
575
|
-
After diagnosis, roll-debug automatically assesses whether the root cause can be fixed — **no flag needed**. The decision is context-driven:
|
|
576
|
-
|
|
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
|
-
```
|
|
599
|
-
|
|
600
|
-
**Quality gates preserved**: When auto-fixing, all `$roll-fix` quality gates apply — TCR, `$roll-.review`, push, CI, deploy. No shortcuts.
|
|
601
|
-
|
|
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.
|
|
603
|
-
|
|
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)
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: roll-design
|
|
3
|
-
license: MIT
|
|
4
|
-
allowed-tools: "Read, Edit, Write, Glob, Grep, Bash(git:*), WebSearch, WebFetch, Skill"
|
|
5
|
-
description: "Load when the user wants to discuss approaches, design a solution, model domains, split work into INVEST stories, or write backlog/spec artifacts without coding."
|
|
6
|
-
---
|
|
7
|
-
# Roll Design
|
|
8
|
-
|
|
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.
|
|
10
|
-
|
|
11
|
-
## Load
|
|
12
|
-
|
|
13
|
-
Load when the user wants to discuss approaches, design a solution, model domains, split work into INVEST stories, or write backlog/spec artifacts without coding.
|
|
14
|
-
|
|
15
|
-
## When Not to Use
|
|
16
|
-
|
|
17
|
-
- Existing US implementation; load roll-build.
|
|
18
|
-
- Narrow bug repair; load roll-fix.
|
|
19
|
-
|
|
20
|
-
## Read On Demand
|
|
21
|
-
|
|
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 [engineering checklist](references/engineering-checklist.md) when validating design output quality.
|
|
24
|
-
- Keep this hub in context for trigger boundaries and hard gates.
|
|
25
|
-
|
|
26
|
-
## Workflow Skeleton
|
|
27
|
-
|
|
28
|
-
1. Clarify only when intent or boundaries are unclear.
|
|
29
|
-
2. Model domain depth proportional to risk and novelty.
|
|
30
|
-
3. Detailed design before decomposition — for any non-trivial work, produce a concrete, implementable design artifact and get owner sign-off: (a) data/contract schema, (b) AT LEAST ONE complete worked sample of the intended output/behavior, (c) key interface signatures, (d) mapping/normalization rules, (e) edge cases & failure modes. Depth scales with risk/novelty; trivial work may be light.
|
|
31
|
-
4. Split into INVEST stories — each a slice of the agreed detailed design.
|
|
32
|
-
5. Write specs through roll story new and update backlog.
|
|
33
|
-
|
|
34
|
-
## Hard Gates
|
|
35
|
-
|
|
36
|
-
- Do not start implementation from this skill.
|
|
37
|
-
- Backlog rows and spec files must stay consistent.
|
|
38
|
-
- Peer review gates apply only when explicitly available/requested.
|
|
39
|
-
- No story decomposition until a detailed design exists and the owner has signed off (proportional to risk). Decomposition slices an agreed design — it is NOT a substitute for designing. If you cannot show at least one complete worked sample of the intended output/behavior, the design is NOT done.
|
|
40
|
-
- **Visual-evidence contract (FIX-311 — design-phase gate)**: every story spec is born honest. By default each story MUST carry one AC that captures its user-visible surface (web/CLI/TUI), and a web/visual card MUST declare the real product surface in its spec frontmatter — `deliverable_url:` (alias `screenshot_url:`) pointing at the actual deliverable page (e.g. `.roll/features/index.html#casting`), NEVER the card's own dossier/report page. A card with genuinely no visual surface writes `screenshot_exempt: <reason>` (a naked `true`/`yes` is NOT a valid exemption — it must carry a reason). This is enforced, not advisory: `validateStoryVisualEvidence(specText)` in `packages/cli/src/lib/design-visual-evidence.ts` returns `ok:false` for a non-exempt spec with no visual-evidence AC, or one that declares a visual surface but no `deliverable_url`. Keyword matching may only RECOGNISE an exemption / an existing visual-evidence AC — it may NEVER be used to decide a card needs a screenshot (it always does, by default). This is the same contract the runtime enforce gate (FIX-309) and archive gate (FIX-334) hold; the three must agree.
|
|
41
|
-
|
|
42
|
-
## Gotchas
|
|
43
|
-
|
|
44
|
-
- Design writes backlog/spec artifacts; it must not quietly start code implementation.
|
|
45
|
-
- Use roll story new for story directories; do not hand-create backlog rows without matching dossier structure.
|
|
46
|
-
- Jumping from idea straight to INVEST stories (skipping detailed design) produces shallow specs and improvised, inconsistent implementation. Decomposition must slice a concrete, owner-agreed detailed design — schema + at least one complete worked sample + interfaces + mapping rules + edge cases.
|
|
47
|
-
|
|
48
|
-
## Maintenance
|
|
49
|
-
|
|
50
|
-
- Description changes require updates in `route-cases/skills.json`.
|
|
51
|
-
- New observed failures should add a gotcha and the matching positive or negative route case.
|
|
52
|
-
- Heavy examples, templates, recovery paths, and deterministic snippets belong in `references/`, `assets/`, or `scripts/`, not in this hub.
|