@seanyao/roll 3.610.1 → 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 (73) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/README.md +5 -5
  3. package/dist/roll.mjs +9115 -11282
  4. package/package.json +3 -1
  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/lib/i18n/slides.sh +0 -3
  52. package/lib/i18n/slides_build.sh +0 -38
  53. package/lib/i18n/slides_delete.sh +0 -19
  54. package/lib/i18n/slides_list.sh +0 -14
  55. package/lib/i18n/slides_logs.sh +0 -12
  56. package/lib/i18n/slides_new.sh +0 -15
  57. package/lib/i18n/slides_preview.sh +0 -14
  58. package/lib/i18n/slides_templates.sh +0 -7
  59. package/lib/slides/components/README.md +0 -123
  60. package/lib/slides/components/cards-2.html +0 -9
  61. package/lib/slides/components/cards-3.html +0 -9
  62. package/lib/slides/components/cards-4.html +0 -9
  63. package/lib/slides/components/compare.html +0 -22
  64. package/lib/slides/components/highlight.html +0 -9
  65. package/lib/slides/components/pipeline.html +0 -12
  66. package/lib/slides/components/plain.html +0 -7
  67. package/lib/slides/components/quote.html +0 -4
  68. package/lib/slides/components/timeline.html +0 -9
  69. package/lib/slides/templates/introduction-v3.html +0 -571
  70. package/lib/slides/templates/pitch.html +0 -0
  71. package/skills/roll-deck/SKILL.md +0 -296
  72. /package/skills/roll-debug/{injectable-bb.js → assets/injectable-bb.js} +0 -0
  73. /package/skills/roll-design/{ENGINEERING_CHECKLIST.md → references/engineering-checklist.md} +0 -0
@@ -2,883 +2,47 @@
2
2
  name: roll-build
3
3
  license: MIT
4
4
  allowed-tools: "Read, Edit, Write, Glob, Grep, Bash, Skill, Agent"
5
- description: "Universal delivery skill. Handles any input: a US-XXX ID executes from BACKLOG via TCR; a FIX-XXX redirects to roll-fix; any other text auto-clarifies, designs, and ships as a new Story."
5
+ description: "Load when a user gives a US-XXX story or asks to ship a feature through Roll TCR delivery, from clarification through verification and backlog write-back."
6
6
  ---
7
+ # Roll Build
7
8
 
8
- # Roll Build (Universal Delivery)
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.
9
10
 
10
- > Follows the Architecture Constraints, Development Discipline, and Engineering Common Sense defined in the project AGENTS.md.
11
+ ## Load
11
12
 
12
- One entry point. Any input. Full delivery.
13
+ Load when a user gives a US-XXX story or asks to ship a feature through Roll TCR delivery, from clarification through verification and backlog write-back.
13
14
 
14
- ## Trigger
15
+ ## When Not to Use
15
16
 
16
- **Input detection:**
17
+ - Pure design or backlog splitting without code; load roll-design.
18
+ - Narrow FIX/BUG repair; load roll-fix.
17
19
 
18
- ```
19
- Input received
20
- ├── matches "US-[A-Z]+-[0-9]+" → Story mode: read BACKLOG → TCR workflow
21
- ├── matches "FIX-[A-Z]+-[0-9]+" → redirect to $roll-fix
22
- ├── matches "IDEA-[0-9]+" → redirect to $roll-idea (lookup and expand)
23
- └── anything else → Fly mode: clarify → design → execute
24
- ```
20
+ ## Read On Demand
25
21
 
26
- **Story mode** use when:
27
- - The user provides a `US-XXX` identifier
28
- - An existing backlog Story needs to be executed
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
+ - Keep this hub in context for trigger boundaries and hard gates.
29
24
 
30
- **Fly mode** — use when:
31
- - The user has a vague one-sentence request
32
- - No `US-XXX` exists yet; planning and execution are both needed
33
- - No input at all — ask the user what they want to build
25
+ ## Workflow Skeleton
34
26
 
35
- **Redirect to `$roll-fix`** when:
36
- - Input matches `FIX-XXX` or `BUG-XXX` pattern
27
+ 1. Classify input as Story mode or Fly mode.
28
+ 2. Read backlog/spec and decide if the story fits one cycle.
29
+ 3. Split into small TCR actions and define verification.
30
+ 4. Run test-first implementation, self-review, evidence, and write-back.
31
+ 5. Commit on green, open PR, and leave remote evidence.
37
32
 
38
- Do not use for:
39
- - Pure analysis or research with no code changes (use `$roll-design`)
40
- - Single-line hotfix with no planning needed (use `$roll-fix`)
33
+ ## Hard Gates
41
34
 
42
- ## Core Philosophy
35
+ - TCR for every micro-step.
36
+ - No WIP commits or bypassed verification.
37
+ - Self-review, attest, E2E evidence, and self-score remain required.
43
38
 
44
- 1. **Clarity over assumptions** — When scope is unclear, clarify first
45
- 2. **Just enough planning** — Plan to the level the uncertainty demands
46
- 3. **TCR rhythm** — Test-first, micro-steps, auto-commit on green, auto-revert on red
47
- 4. **Push to GitHub** — Complete implementation, commit, and push; code is on remote
48
- 5. **Stay reversible** — Every micro-step leaves the repo in a clean, green state
39
+ ## Gotchas
49
40
 
50
- ---
51
-
52
- ## Mode A: Story Mode (US-XXX input)
53
-
54
- Activate when input is a `US-[A-Z]+-[0-9]+` identifier.
55
-
56
- ### Step 0: Pre-flight self-check (US-AGENT-007)
57
-
58
- Before reading the Story in depth or splitting actions, **read the Agent profile** from the story's feature md and decide whether this cycle can realistically deliver it. The check is mechanical and turns on a single axis — the story's `est_min` estimate (US-AGENT-022 retired the old three-dimension type/est/risk routing; there is no per-agent capacity range, risk zone, or history threshold anymore):
59
-
60
- ```
61
- inputs:
62
- story.est_min (from **Agent profile:** block, US-AGENT-001)
63
- story.chain_depth (0 unless already a downgrade product)
64
-
65
- complexity tier (lib/loop_pick_agent.py, single source of truth):
66
- est_min <= 8 → easy
67
- 8 < est_min <= 20 → default
68
- est_min > 20 → hard
69
- missing / illegal → default
70
-
71
- verdict:
72
- too_big when:
73
- story.est_min is large enough that even the `hard` tier won't fit one
74
- cycle — i.e. the work plainly composes too many files / behaviours to
75
- land green in a single cycle — AND story.chain_depth == 0
76
- (still have downgrade budget; don't burn a cycle on a guaranteed miss).
77
- ok otherwise
78
- ```
79
-
80
- Output the verdict as the first line of the cycle response:
81
-
82
- ```yaml
83
- verdict: ok # or: too_big
84
- reason: <one short line — which condition triggered, with numbers>
85
- ```
86
-
87
- When `verdict: ok` → continue to Step 1 normally.
88
- When `verdict: too_big` → go to **US-AGENT-008 self-downgrade path**, **but** first run the **US-AGENT-009 chain_depth cap check**:
89
-
90
- ```bash
91
- # 0a. Cap check: refuse the third consecutive auto-split.
92
- # exit 0 → split allowed; exit 1 → cap hit, take cap-hit path instead.
93
- if ! bash -c 'source "$(command -v roll)"; _loop_chain_depth_cap_check US-XXX-NNN'; then
94
- # Cap hit (chain_depth ≥ 2): hold + ALERT, exit cleanly.
95
- bash -c 'source "$(command -v roll)"; _loop_split_cap_hit US-XXX-NNN "depth >= 2, human triage required"'
96
- exit 0
97
- fi
98
-
99
- # 1. Invoke roll-design to re-split the story into smaller sub-stories.
100
- # Each sub-story carries chain_depth = (parent.chain_depth + 1).
101
- # Sub-stories land as 📋 Todo with depends-on:<parent> chained.
102
- Skill("roll-design", "--from-story US-XXX-NNN")
103
-
104
- # 2. After the sub-stories are written to BACKLOG, flip the parent
105
- # to 🚫 Hold and emit the downgrade event. The helper handles ALERT.
106
- bash -c 'source "$(command -v roll)"; _loop_self_downgrade US-XXX-NNN "too_big: <reason from verdict>" "US-XXX-NNNa,US-XXX-NNNb"'
107
-
108
- # 3. Exit cleanly — no TCR commits this cycle. The next loop cycle picks
109
- # up the first sub-story (which is smaller and should pass pre-flight).
110
- exit 0
111
- ```
112
-
113
- If `roll-design` cannot produce ≥2 sub-stories (story is already irreducible), fall through to **US-AGENT-009 cap-hit path** by invoking `_loop_split_cap_hit` directly. The cap is purely about stopping infinite split chains; even on the first re-split, if the design step gives up, the cap-hit handler raises ALERT for human triage.
114
-
115
- > Pre-flight is honest, not paranoid: a small story (est_min ≤ 8 — the `easy` tier — with chain_depth=0) should almost always go `ok`. The check pays off on the long tail — stories with a large `est_min` that, on inspection, plainly compose far more files and behaviours than one cycle can land green.
116
-
117
- ### Step 1: Read the Story
118
-
119
- 1. Open `.roll/backlog.md`, find the US row, follow the link to `.roll/features/<epic>/<story>/spec.md`
120
- 2. Read the full AC / Files / Dependencies section
121
- 3. If a plan doc (`<feature>-plan.md`) exists, read it for context
122
-
123
- ### Step 2: Split into Actions
124
-
125
- - Write 2–6 candidate Actions
126
- - Pick the smallest shippable Action first
127
- - **Granularity constraint**: Each Action completable in 2–5 minutes; split if larger
128
- - **No placeholders**: Action descriptions must be specific and directly executable
129
- - **Test-quality self-check (US-QA-011)** — for every Action that adds tests:
130
- 1. Tests call project functions / public command entry points; do NOT inline
131
- external-tool behaviour (`sed`/`awk`/`grep`/`find`/`cut` pipelines that
132
- duplicate logic already in `lib/` or `bin/`) — rubric ❼.
133
- 2. Tests sandbox filesystem state via `BATS_TMPDIR` (or equivalent); do NOT
134
- touch or assert on paths outside this repo (`~/.codex`, `~/.kimi`,
135
- `~/.roll/`, `/etc/...`) — rubric ❽.
136
- 3. If you can't satisfy (1) or (2), reshape the Action: extract a project
137
- helper, redirect the env var to a tmp dir, or move the test to an
138
- integration tier where the boundary is intentional and documented.
139
-
140
- #### 2.5 Parallel Dispatch (auto-determined)
141
-
142
- After splitting Actions, check if they can run in parallel:
143
-
144
- ```
145
- Conflict detection:
146
- ├── List files involved in each Action
147
- ├── Same file → cannot parallelize, must run sequentially
148
- ├── Same directory, different files → can parallelize
149
- └── Different directories → safe to parallelize
150
- ```
151
-
152
- **If 2+ Actions can run in parallel, automatically enable Worktree isolation:**
153
-
154
- ```bash
155
- git worktree add .worktrees/{action-id} -b dispatch/{action-id}
156
- ```
157
-
158
- - Each sub-agent executes TCR in its own worktree
159
- - Sub-agent briefs must be **self-contained** (include: what to do, where, how to verify, what not to do)
160
- - After all complete: review each → merge to main → run integration tests → clean up worktrees
161
-
162
- **Status notifications (required):**
163
-
164
- ```
165
- 🔀 $(msg build.parallel_dispatch N)
166
-
167
- $(msg build.agent_running 1 "...")
168
- $(msg build.agent_running 2 "...")
169
-
170
- $(msg build.agent_done 1 "..." N)
171
- $(msg build.agent_done 2 "..." N)
172
-
173
- 🔀 $(msg build.merge_summary N N)
174
- 🧪 $(msg build.integration_tests)
175
- ```
176
-
177
- When parallel conditions are not met, execute Actions sequentially.
178
-
179
- ### Step 3: Define Verification
180
-
181
- - Test matrix: happy path + edge/failure/regression cases
182
- - What "online verification" means for this repo (URL, endpoint, UI flow, log signal)
183
- - Reference `$roll-.qa` for test pyramid (unit → E2E → visual → smoke)
184
-
185
- Proceed to the **Shared TCR Workflow** (Phase 4 onward).
186
-
187
- ---
188
-
189
- ## Mode B: Fly Mode (free-text or no-input)
190
-
191
- Activate when input does not match any `US-XXX` / `FIX-XXX` pattern, or when no input is given.
192
-
193
- ### Phase 1: Clarify & Assess
194
-
195
- Before any code, assess clarity:
196
-
197
- ```
198
- 🎯 $(msg build.clarified_goal): {1-2 sentences capturing user intent}
199
- 📏 $(msg build.complexity_assessment): {small|medium|large}
200
- 🔍 $(msg build.uncertainty_areas): {list what needs investigation/decision}
201
- ```
202
-
203
- **If uncertainty areas are non-empty or the request is vague, auto-trigger `$roll-.clarify`:**
204
- - Output the clarification block above
205
- - Follow with 3–5 targeted questions
206
- - Stop and wait for user answers before proceeding
207
-
208
- **Approach Confirmation (required for UX / format / automation decisions):**
209
-
210
- If the request involves any of: output format, layout, automation level (manual vs automatic), or architecture structure — output a confirmation block **before writing any code**:
211
-
212
- ```
213
- 📐 $(msg build.approach_confirmation)
214
-
215
- 1. $(msg build.what_changes): {what will be built or modified}
216
- 2. $(msg build.the_approach): {specific format / automation level / structure chosen}
217
- 3. $(msg build.files_touched): {list of files}
218
-
219
- Proceeding unless you say otherwise.
220
- ```
221
-
222
- Wait for the user's response before editing files. If the user does not object within one exchange, proceed.
223
-
224
- **Complexity Rules (AI coding time):**
225
-
226
- | Level | Scope | Action |
227
- |-------|-------|--------|
228
- | Small | ≤3 files, 5–15 min, single concern | Skip detailed planning, implement directly |
229
- | Medium | Crosses modules, needs trade-offs, 15–30 min | Mini-plan then implement |
230
- | Large | Multi-step, architectural, 30–60 min+ | Full plan + split into Actions via `$roll-design` |
231
-
232
- ### Phase 2: Create US / Actions
233
-
234
- - Use `$roll-design` to split vague request into INVEST-compliant User Stories
235
- - Insert US into `.roll/backlog.md` under the relevant Epic > Feature group
236
- - If a new story folder is needed, mint it via `roll story new <ID> --title <t> --epic <e>` (the single channel, US-META-009), then edit the spec
237
-
238
- After creation, switch to **Story mode** and execute the first US immediately.
239
-
240
- Proceed to the **Shared TCR Workflow** (Phase 4 onward).
241
-
242
- ---
243
-
244
- ## Shared TCR Workflow
245
-
246
- The following phases apply to both Story mode and Fly mode after planning is complete.
247
-
248
- ### Phase 3.5: Peer Review Gate
249
-
250
- After planning is complete, before entering Test Design Review, assess whether the plan warrants peer review:
251
-
252
- **Auto-trigger `$roll-peer` when any of the following is true:**
253
- - Plan affects **>3 files** or **crosses modules**
254
- - **Architecture decisions** or non-obvious trade-offs are involved
255
- - **Destructive / irreversible operations** (deletions, migrations, production deploys)
256
- - **High-risk signal words** detected in user request ("critical / important / don't break / 关键 / 别搞砸")
257
- - User explicitly requests peer review ("/peer", "叫上 peer")
258
-
259
- **With 10s opt-out:**
260
- ```
261
- Plan affects N files across M modules. Estimated peer review: 2–3 rounds, ~X tokens.
262
- Press Enter to launch peer review, or type 'n' to skip. Auto-executing in 10s...
263
- ```
264
-
265
- **After peer review result:**
266
- - **AGREE** → proceed to Phase 4 (Test Design Review)
267
- - **REFINE** → incorporate feedback, regenerate plan, re-run Phase 3.5
268
- - **OBJECT** → consider alternative plan, re-run Phase 3.5 with revised proposal
269
- - **ESCALATE** → present both proposals to user for final decision before proceeding
270
-
271
- **Never trigger:**
272
- - Single-file changes or well-defined fixes
273
- - Plans with no cross-module impact and no architecture decisions
274
-
275
- ### Phase 4: Test Design Review
276
-
277
- Before writing implementation code:
278
-
279
- ```
280
- 🧪 $(msg build.test_design): {Action name}
281
-
282
- $(msg build.scenarios):
283
- ├── {Happy path scenario}
284
- ├── {Edge case scenario}
285
- └── {Failure/regression scenario}
286
-
287
- $(msg build.test_types):
288
- ├── Unit tests for: {logic components}
289
- ├── Integration tests for: {API/data flows}
290
- └── Manual verification for: {UI/visual elements}
291
- ```
292
-
293
- **Self-review on test design:**
294
- - Are we testing the right behavior?
295
- - Are edge cases covered?
296
- - Are tests independent and deterministic?
297
-
298
- Reference `$roll-.qa` for coverage requirements and test pyramid strategy.
299
-
300
- **Why this phase**: TCR only guarantees code passes tests — verify tests are correct first.
301
-
302
- ### Phase 5: TCR Implementation Loop
303
-
304
- ```
305
- ┌────────────────────────────────────────────────────────────┐
306
- │ $(msg build.tcr_cycle) │
307
- └────────────────────────────────────────────────────────────┘
308
-
309
- $(msg build.micro_step {N} "{description of smallest testable change}")
310
-
311
- Step 1: Write/Update Test
312
- └── Run test → Confirm RED (expected failure)
313
-
314
- Step 2: Implement Minimal Code
315
- └── Write just enough to make test pass
316
-
317
- Step 3: TCR Decision
318
- └── Run test
319
- ├── ✅ GREEN → git commit -m "tcr: {micro-step description}"
320
- └── ❌ RED → git checkout -- . → Retry with new approach
321
-
322
- Step 4: Refactor (optional, while green)
323
- └── Run test → ✅ GREEN → Amend or new TCR cycle
324
- ```
325
-
326
- **Micro-step guidelines:**
327
-
328
- | Change Type | Typical Micro-Steps |
329
- |-------------|---------------------|
330
- | Logic / algorithm | 1 function = 1–2 micro-steps |
331
- | API endpoint | Route → Handler → Validation → Response |
332
- | UI component | Skeleton → Props → Interaction → Styling |
333
- | Bug fix | Regression test → Fix → Verify |
334
- | Refactor | Extract method → Update calls → Remove old |
335
-
336
- Accumulate 3–5 micro-commits per Action. Each commit is a guaranteed working state.
337
-
338
- #### Architectural Friction Signal (non-blocking)
339
-
340
- While implementing, watch for these signals:
341
-
342
- - This Action requires touching code in 3+ unrelated modules
343
- - The existing module boundary has to be bent or bypassed to make this work
344
- - A data structure or interface needs to change in a way that ripples across contexts
345
- - The implementation feels "wrong" even when the test passes
346
-
347
- When any signal appears, **do not stop — flag it**:
348
-
349
- ```bash
350
- # 1. Append to .roll/backlog.md under ## ♻️ Refactor
351
- # REFACTOR-XXX | <one-line description> | 📋 Todo
352
-
353
- # 2. Append a brief entry to .roll/features/autonomous-evolution/refactor-log.md
354
- ```
355
-
356
- **REFACTOR entry format in .roll/backlog.md:**
357
-
358
- ```markdown
359
- | REFACTOR-001 | {one-line plain-language description} | 📋 Todo |
360
- ```
361
-
362
- 描述写法:参见 AGENTS.md "Backlog descriptions" 规则。说清楚"什么需要改"以及"不改会怎样",技术细节写在 `.roll/features/<epic>/refactor-log.md`。
363
-
364
- **refactor-log.md entry format:**
365
-
366
- ```markdown
367
- ## REFACTOR-001 Extract payment boundary
368
-
369
- **Flagged**: {YYYY-MM-DD} during US-XXX
370
- **Signal**: {which friction signal triggered this}
371
- **Observation**: {1–3 sentences describing what felt wrong}
372
- **Suggested scope**: {rough sense of what a fix would touch}
373
- ```
374
-
375
- Then continue implementing the current Story normally.
376
-
377
- **Event emission** — after all TCR micro-steps for a Story complete, emit a `build` event so the cycle event stream reflects the work done:
378
-
379
- ```bash
380
- # _tcr_count = number of "tcr:" prefix commits made during this Story
381
- _loop_event build "$US_ID" "${_tcr_count} commits" "" 2>/dev/null || true
382
- ```
383
-
384
- ### Phase 5.5: E2E Deposit
385
-
386
- After TCR micro-steps pass, deposit an E2E test for this Story's core user flow.
387
-
388
- ```
389
- E2E DEPOSIT
390
-
391
- Step 1: Detect
392
- └── Read project's existing E2E infrastructure
393
- (test directories, config files, framework, naming conventions)
394
-
395
- Step 2: Write
396
- └── One E2E test covering the Story's golden path
397
- (the critical user journey this Story delivers)
398
-
399
- Step 3: Run
400
- └── Execute the new E2E test
401
-
402
- Step 4: TCR
403
- ├── ✅ GREEN → git commit -m "tcr: e2e deposit for {story}"
404
- └── ❌ RED → Fix via TCR cycle until green
405
- ```
406
-
407
- **Rules:**
408
- - Follow whatever E2E patterns the project already uses — framework, directory, naming
409
- - If no E2E infrastructure exists, reference `$roll-.qa` "Missing Test Infrastructure" section to bootstrap minimally, then deposit
410
- - One test per Story — covers the golden path, not exhaustive edge cases (those are unit/integration from Phase 5)
411
- - Each deposited E2E becomes a replayable case: CI runs it on every push, Sentinel can sample it against production
412
-
413
- ### Phase 6: Pre-Push CI Gate
414
-
415
- After all micro-steps, run full CI locally before pushing:
416
-
417
- ```bash
418
- npm run ci:local 2>/dev/null || (npm run lint && npm run build && npm test -- --run)
419
- ```
420
-
421
- **If CI fails:**
422
- ```
423
- ❌ Local CI check failed
424
- ├── Run 'npm run ci:fix' or 'npm run format' for auto-fixable issues
425
- ├── Fix remaining lint/build/test errors via new TCR cycle
426
- └── Re-run until all pass
427
- ```
428
-
429
- **Setup `ci:local` script (if not in `package.json`):**
430
- ```json
431
- {
432
- "scripts": {
433
- "ci:local": "npm run format:check && npm run lint && npm run build && npm run test -- --run",
434
- "ci:fix": "npm run format && npm run lint -- --fix"
435
- }
436
- }
437
- ```
438
-
439
- **Setup pre-push hook (recommended, one-time):**
440
- ```bash
441
- cat > .git/hooks/pre-push << 'EOF'
442
- #!/bin/bash
443
- echo "🔍 Running local CI checks..."
444
- if ! npm run ci:local 2>/dev/null && ! (npm run lint && npm run build); then
445
- echo "❌ CI check failed, push blocked"
446
- exit 1
447
- fi
448
- echo "✅ CI check passed"
449
- EOF
450
- chmod +x .git/hooks/pre-push
451
- ```
452
-
453
- ### Phase 7: Pre-Push Code Review (Three-Axis Deep Review)
454
-
455
- This phase runs **once per Story** (not per micro-step) on the full accumulated diff.
456
- Per-micro-step review uses `$roll-.review staged` inline checklist (zero extra cost).
457
-
458
- **Phase 3.5 vs Phase 7 split**: Phase 3.5 (Peer Review) focuses on architectural direction
459
- and approach before coding begins. Phase 7 focuses on implementation quality after all
460
- micro-steps are done — catching issues that only appear at diff scale (parameter sprawl
461
- across files, copy-paste patterns, cross-file N+1, etc.).
462
-
463
- ```bash
464
- # Capture full Story diff
465
- git diff main...HEAD
466
- ```
467
-
468
- **Launch three review agents in parallel** (each receives the full diff):
469
-
470
- ```
471
- Agent 1: Reuse Review
472
- → Search for existing utilities / helpers the new code could use instead
473
- → Flag any new function that duplicates existing functionality
474
- → Flag inline logic replaceable by existing tools
475
-
476
- Agent 2: Quality Review
477
- → Redundant state, Parameter sprawl, Copy-paste near-duplicate,
478
- Leaky abstraction, Stringly-typed, JSX nesting,
479
- Nested conditionals ≥3 deep, Unnecessary comments
480
-
481
- Agent 3: Efficiency Review
482
- → Redundant computation / N+1, Missed concurrency,
483
- Hot-path bloat, Loop no-op updates, TOCTOU existence pre-check,
484
- Memory leaks, Overly broad operations
485
- ```
486
-
487
- Wait for all three agents to complete. Aggregate findings → fix each issue
488
- (false positives: note and skip, no debate) → summarize what was fixed.
489
-
490
- **Fallback**: If parallel agent invocation fails, run `$roll-.review staged` on
491
- the full diff as a single-pass fallback — do not skip review entirely.
492
-
493
- **Decision:**
494
- ```
495
- 🔴 Critical > 0 → Fix via new TCR cycle → Re-review
496
- 🟡 Warnings > 0 → Fix if quick (< 5 min) or document
497
- 🟢 Suggestions / ✅ All clear → Proceed to Phase 8
498
- ```
499
-
500
- ### Phase 8: Commit & Push (branch + PR — NEVER direct to main)
501
-
502
- `main` is PR-protected. Push the worktree's branch and open a PR — never
503
- `git push origin main`. (When invoked by `roll-loop`, the runner already
504
- created the worktree + branch and opens the PR; this is the manual-path
505
- equivalent.)
506
-
507
- ```bash
508
- # All TCR micro-commits are already made on the worktree's branch (Phase 0).
509
- git log --oneline -{n} # Review TCR commits
510
- git push -u origin <branch> # the dispatch/<id> branch from Phase 0
511
- gh pr create --title "{story-id}: …" --body "…"
512
- # After CI is green: gh pr merge --rebase
513
- ```
514
-
515
- Commit message (if squashing):
516
- ```
517
- {story-id}: {action description}
518
-
519
- - {what changed}
520
- - {why}
521
- - {test coverage}
522
- - TCR: {n} micro-commits
523
- ```
524
-
525
- ### Phase 9: Watch CI & Deploy
526
-
527
- ```
528
- ⏳ CI Running...
529
- ├── ✅ PASS → Proceed to deploy
530
- └── ❌ FAIL →
531
- ├── Diagnose failure
532
- ├── Create new TCR micro-step to fix
533
- └── Push and retry
534
- ```
535
-
536
- Follow the repo's deployment path (Vercel / Railway / etc.) and record the deployed target.
537
-
538
- **CI failure recovery:**
539
- ```
540
- 1. Diagnose: environment-specific or real failure?
541
-
542
- 2. If real failure:
543
- ├── git reset --soft HEAD~{n}
544
- ├── TCR micro-step to fix
545
- └── Push again
546
-
547
- 3. If environment-specific:
548
- ├── Document exception
549
- └── Get user approval to proceed
550
- ```
551
-
552
- ### Phase 10: Runtime Verification
553
-
554
- - **Web apps**: verify on deployed URL (happy path, edge cases, no regression)
555
- - **CLI tools**: verify via command execution
556
- - **Libraries**: verify via test usage or example scripts
557
-
558
- ### Phase 10.5: Verification Gate (MANDATORY)
559
-
560
- **Before marking as DONE, fresh evidence must be provided.**
561
-
562
- ```
563
- 🚦 $(msg build.verification_gate)
564
-
565
- $(msg build.evidence_checklist):
566
- ├── [ ] $(msg build.tests_passed)
567
- ├── [ ] $(msg build.build_succeeded)
568
- ├── [ ] $(msg build.online_verification)
569
- └── [ ] $(msg build.no_regression)
570
-
571
- $(msg build.gate_decision):
572
- ├── ✅ $(msg build.gate_pass)
573
- └── ❌ $(msg build.gate_fail)
574
- ```
575
-
576
- **Hard Rule**: "I confirmed the tests passed" does not count as evidence. Must be **freshly run** command output from this session.
577
-
578
- ### Phase 10.6: Acceptance Evidence (after Gate PASS)
579
-
580
- Runs ONLY on a ✅ Gate PASS (a FAIL retry must not mint a misleading report). Non-blocking: any failure here → WARN, continue to Phase 11.
581
-
582
- 0. **Before/after pairing (owner ruling 2026-06-06)**: when the story CHANGES
583
- existing behavior, capture the prior state (`screenshots/before-*.png`)
584
- before building and the new state (`screenshots/after-*.png`) at acceptance —
585
- contrast is the clearest evidence. Brand-new capability with no prior state:
586
- skip the pair; capture the new surface only.
587
-
588
- 1. **Dump raw evidence** produced in this session to story-level dirs:
589
- `.roll/features/<epic>/{ID}/screenshots/*.png` — the DEFAULT evidence class for
590
- every surface, **CLI included** (US-ATTEST-010): text evidence is the agent's
591
- own report (nothing stops a fabricated `echo "✓ passed" > evidence.txt`); a
592
- screenshot is an OS-level capture of really-rendered pixels — an independent
593
- channel with a categorically higher forgery cost. Combined with the
594
- never-overwritten run dirs (D4) and the render-layer red line, it is the
595
- strongest link in the evidence chain.
596
- `.roll/features/<epic>/{ID}/evidence/*.txt` (resolve `<epic>` via `.roll/index.json`; `roll attest` writes the report there as `{ID}-report.html`) — supplementary (searchable,
597
- copyable); keep raw command outputs here, but do not let a text file be the
598
- ONLY evidence for an AC that has a visible surface.
599
-
600
- **CLI capture recipe**: run the verifying command in a REAL terminal (the
601
- tmux observation window `roll-loop-<slug>` is a natural target — display the
602
- proof there), then `screencapture -x -R <window-rect>` (macOS) into
603
- `screenshots/`. Capture ONLY the relevant work area — a focused window, not
604
- the whole desktop. Unattended cycles: drive the capture from the dispatcher
605
- (deterministic), never hand-craft an image; if the capture channel is
606
- unavailable (no GUI session / no permission), fall back to text evidence and
607
- mark the AC `partial` with a note — never fake a screenshot.
608
- 2. **Write the intent map** `.roll/features/<epic>/{ID}/ac-map.json` — for EVERY AC (ids `{ID}:AC1..n`) pick `pass|readonly|partial|claimed|missing` and reference only evidence that exists (paths relative to the run dir; story-level dirs are reachable as `../evidence/...` / `../screenshots/...`):
609
-
610
- ```json
611
- [{ "ac": "{ID}:AC1", "status": "pass",
612
- "evidence": [
613
- { "kind": "screenshot", "label": "terminal run (real pixels)", "href": "../screenshots/ac1-terminal.png" },
614
- { "kind": "text", "label": "vitest (supplementary)", "textFile": "../evidence/vitest.txt" }
615
- ] }]
616
- ```
617
-
618
- No evidence for an AC → say `claimed` yourself; the renderer enforces that downgrade anyway (red line) and lists it under Discrepancies.
619
- 3. **Run** `roll attest {ID}` (add `--deploy-url <url>` when one exists). The report lands at `.roll/features/<epic>/{ID}/latest/{ID}-report.html` (archive-per-card layout, US-META-001). The report is now layered (US-ATTEST-013): card context + conclusion/business badges + key screenshots up front, technical ANSI/command output folded into collapsed `<details>`, and a closing block (quality gate + evidence index + self-score).
620
- 4. **Design QA checklist (US-ATTEST-013) — READABILITY ONLY**. After the report
621
- renders, open it and run the checklist below. This is a presentation review of
622
- the rendered HTML, NOT an evidence review.
623
- **HARD RULE: this checklist NEVER changes any AC's status, evidence, or
624
- `pass|readonly|partial|fail|blocked|claimed|missing` verdict.** Those are
625
- fixed at step 2 (the ac-map) and enforced by the render-layer red line. If a
626
- readability item fails, fix the *presentation* (a missing context field, an
627
- uncropped screenshot, a layout overflow) — never edit a verdict to make the
628
- report look cleaner.
629
- - [ ] **首屏 10s 可懂** — a product/business reviewer grasps what shipped and
630
- whether it passed within ten seconds, without scrolling into the technical fold.
631
- - [ ] **390 / 320px 无横滚** — no horizontal scroll at mobile widths; before/after
632
- pairs stack rather than overflow.
633
- - [ ] **打印可读** — print preview (or print-to-PDF) is legible; AC cards don't
634
- split awkwardly across pages.
635
- - [ ] **状态不只靠颜色** — every status reads from its icon + bilingual word, not
636
- color alone (colorblind-safe).
637
- - [ ] **截图裁切与清晰度** — screenshots are cropped to the relevant work area and
638
- legible; no full-desktop captures, no blurry/half-rendered frames.
639
- If you cannot open the report (headless cycle), note that the design QA was
640
- deferred and say so in the cycle report — do NOT silently skip it, and do NOT
641
- substitute it for an evidence judgement.
642
-
643
- ### Phase 11: Write Back Status (REQUIRED)
644
-
645
- Both locations must be updated — neither can be skipped:
646
-
647
- **① Update .roll/backlog.md index row (Status column):**
648
-
649
- **Location rule (FIX-198)**: edit the MAIN project's backlog by ABSOLUTE path — `${ROLL_MAIN_PROJECT:-$PWD}/.roll/backlog.md`. In ordinary projects the cycle worktree has NO `.roll/` (gitignored, never checked out): a relative `.roll/backlog.md` edit writes into the void and the flip silently vanishes.
650
-
651
-
652
- ```markdown
653
- | [US-{ID}](.roll/features/<epic>/US-{ID}/spec.md) | {Title} | ✅ Done · [evidence](.roll/features/<epic>/US-{ID}/latest/US-{ID}-report.html) |
654
- ```
655
-
656
- Change the Status from `📋 Todo` or `🔨 In Progress` (whichever the row currently shows) to `✅ Done`. When invoked by `roll-loop`, the row will already be `🔨 In Progress` — that is the expected starting state, and the transition is the same Edit operation.
657
- For Fly mode: first append an index row under the appropriate Epic > Feature group, then mark it done.
658
-
659
- **② Update `.roll/features/<epic>/<story>/spec.md`:**
660
-
661
- ```markdown
662
- ## US-{ID} {Story Title} ✅
663
-
664
- **Completed**: {YYYY-MM-DD}
665
-
666
- **AC:**
667
- - [x] {Completed acceptance criterion 1}
668
- - [x] {Completed acceptance criterion 2}
669
-
670
- **Files:**
671
- - `{added/modified file 1}`
672
- - `{added/modified file 2}`
673
- ```
674
-
675
- - Add ✅ to the heading
676
- - Add `**Completed**` date
677
- - Change AC items from `[ ]` to `[x]`
678
- - Update Files to reflect actual changed files
679
-
680
- If the US section does not yet exist, create the full section (AC / Files / Dependencies).
681
-
682
- **Before committing, run `$roll-.changelog`** to stage CHANGELOG.md — then include
683
- it in the completion commit so no separate changelog commit is created.
684
-
685
- ```bash
686
- # 1. Stage changelog (roll-.changelog stages CHANGELOG.md only, does not commit)
687
- $roll-.changelog
688
-
689
- # 2. Commit BACKLOG + feature doc + CHANGELOG.md together
690
- git add .roll/backlog.md .roll/features/ CHANGELOG.md
691
- git commit -m "docs: mark {US-ID} as completed"
692
- git push
693
- ```
694
-
695
- ### Phase 12: Report & Celebrate
696
-
697
- ```
698
- ✅ $(msg build.pushed_to)
699
- 🚀 $(msg build.deployed): <url>
700
- ✅ $(msg build.verified): <what was checked>
701
- 📦 $(msg build.changes_summary): <summary>
702
- 🔢 $(msg build.commits_count): <count> micro-commits via TCR
703
- 🧪 $(msg build.tests_added): <what tests were added/modified>
704
- 📊 $(msg build.tcr_stats): <success rate, revert count if any>
705
- 📋 $(msg build.review_gate): <self-review findings summary>
706
- 📝 $(msg build.backlog_updated "<US-ID>")
707
- 📄 $(msg build.changelog_bundled)
708
-
709
- 🎉 $(msg build.shipped)
710
-
711
- 🔄 $(msg build.next_options):
712
- 1. Continue to next Action (if Story has more)
713
- 2. Start next US (if Fly mode created multiple)
714
- 3. Done (if all completed)
715
- ```
716
-
717
- ---
718
-
719
- ## Project Context Rule
720
-
721
- Before creating any file or directory:
722
-
723
- 1. **Read existing project structure** — check for `package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, existing `src/`, `api/`, `cmd/` directories
724
- 2. **Infer conventions from evidence** — don't assume a project type; observe what already exists
725
- 3. **Follow what already exists** — introduce new patterns only when the current structure has no precedent
726
-
727
- > `roll init` no longer asks for project type. Skills are responsible for reading context and acting accordingly.
728
-
729
- ---
730
-
731
- ## Hard Rules
732
-
733
- 0. **Worktree-first, PR-at-end (ALWAYS)**
734
- Before writing any code, work in a dedicated git worktree on its own
735
- branch (`git worktree add ../wt-<id> -b <branch>`), never in the shared
736
- checkout — so concurrent cycles / sessions never collide. Finish by
737
- pushing the branch and opening a PR; `main` is PR-protected — NEVER
738
- `git push origin main`. (Under `roll-loop` the runner creates the
739
- worktree + branch and opens the PR; this rule is the manual-path
740
- equivalent and must hold either way.)
741
-
742
- 1. **No local-only "done"**
743
- Work is not complete until it reaches:
744
- commit → push → CI signal → deploy → online verification → backlog update
745
-
746
- 2. **TCR for every micro-step**
747
- - Each behavior change: Test → Green=Commit / Red=Revert
748
- - No "I'll fix it in the next step" — revert and retry
749
- - Each commit is a guaranteed working state
750
-
751
- 3. **Test Design Review before implementation**
752
- - Design test scenarios and edge cases first
753
- - TCR only works if tests are correct — validate early
754
-
755
- 4. **Micro-steps only**
756
- - If a step feels "a bit complex", split it
757
- - Each micro-step completable in 1–3 minutes
758
- - **No placeholders**: Action/AC descriptions must be specific — no "TBD"
759
-
760
- 5. **Pre-push self-review required**
761
- - Run `$roll-.review staged` on final diff
762
- - Fix blocking (Critical) issues via new TCR cycle
763
-
764
- 6. **No hidden work**
765
- - Every file changed must relate to the current Action
766
- - No "while I'm here" refactors unless in a separate TCR cycle
767
-
768
- 7. **Always update BACKLOG status**
769
- - .roll/backlog.md index row and `.roll/features/<feature>.md` US section are both required
770
- - Neither can be skipped
771
-
772
- ---
773
-
774
- ## Definition of Done (per Action)
775
-
776
- - [ ] Story and Action clearly defined
777
- - [ ] Test design reviewed and approved
778
- - [ ] **TCR cycles completed** (all micro-steps via Test && Commit)
779
- - [ ] **E2E deposited** (golden path test for this Story, committed via TCR)
780
- - [ ] All commits are green states (no broken commits)
781
- - [ ] Local CI checks passed (format + lint + build + test)
782
- - [ ] Self-code-review passed, blocking issues fixed via TCR
783
- - [ ] Changes pushed to remote
784
- - [ ] CI is green (or explicit, recorded exception)
785
- - [ ] Deployed to production
786
- - [ ] Online verification performed
787
- - [ ] **Verification Gate passed** (fresh evidence for tests, build, deploy, no regression)
788
- - [ ] **.roll/backlog.md index status updated** (📋 → ✅, REQUIRED)
789
- - [ ] **`.roll/features/<feature>.md` US section updated** (Completed date + [x] ACs, REQUIRED)
790
- - [ ] **CHANGELOG.md staged and bundled** into completion commit via `$roll-.changelog` in Phase 11 (REQUIRED)
791
- - [ ] **Self-score note written (US-SKILL-010 / 012)** — see "Self-score" subsection below
792
- - [ ] Summary reported to user
793
-
794
- ### Self-score (US-SKILL-012)
795
-
796
- Before reporting completion to the user, write one self-score note. The
797
- helper lands the note under `.roll/features/<epic>/<US-id>/notes/<date>-roll-build-<US-id>-<epoch>.md` (the card folder is the note home, US-META-008; resolve <epic> via .roll/index.json)
798
- with YAML frontmatter so trend analysis (US-SKILL-014) can aggregate later:
799
-
800
- ```bash
801
- bash -c 'source "$(command -v roll)"; \
802
- _skill_write_self_score roll-build US-XXX-NNN <score 1..10> <good|ok|regression> "<rationale>"'
803
- ```
804
-
805
- Score guidance (integer 1..10):
806
- - **9..10** — story shipped cleanly: AC fully met, TCR rhythm tight, no
807
- re-tries from `verdict: too_big`, peer review concerns addressed inline.
808
- - **6..8** — shipped with caveats: re-tries on red, edge case left to a
809
- follow-up FIX, documentation lagged behind code by one cycle, etc.
810
- - **1..5** — shipped but at low confidence: AC partially met (note which),
811
- TCR rhythm broken (multiple revert iterations), or `regression` verdict.
812
-
813
- Verdict values:
814
- - `good` — story fully delivered; AC met; no concerning signal.
815
- - `ok` — shipped but with at least one documented trade-off (use rationale).
816
- - `regression` — story landed but another behaviour broke (rare; open a FIX).
817
-
818
- ---
819
-
820
- ## TCR Recovery Patterns
821
-
822
- ### Pattern 1: Red After Multiple Attempts
823
-
824
- ```
825
- If same micro-step fails 3 times:
826
- 1. Revert to clean state
827
- 2. Escalate: "This micro-step is actually medium complexity"
828
- 3. Split into smaller micro-steps
829
- 4. Retry TCR
830
- ```
831
-
832
- ### Pattern 2: Refactoring While Green
833
-
834
- ```
835
- If refactoring during green state:
836
- Option A: Amend last commit (if refactor is tiny)
837
- Option B: New TCR cycle (treat as new micro-step)
838
- ```
839
-
840
- ### Pattern 3: Test Design Was Wrong
841
-
842
- ```
843
- If implementation reveals test design flaw:
844
- 1. Revert current micro-step
845
- 2. Return to Phase 4 (Test Design Review)
846
- 3. Update test design
847
- 4. Resume TCR cycles
848
- ```
849
-
850
- ### Pattern 4: Complex State vs Simple Reset
851
-
852
- ```
853
- When complex state management is error-prone → consider full reset + re-initialization.
854
- 60% less code, zero bugs is better than an elegant but fragile transition.
855
- ```
856
-
857
- ---
858
-
859
- ## When to Use What
860
-
861
- ```
862
- roll-build → ship anything (new idea, US-ID, free-text request)
863
- roll-fix → fix a specific known bug (FIX-XXX / BUG-XXX)
864
- roll-design → plan and design before building (no code output)
865
- roll-idea → fast capture a bug or idea into .roll/backlog.md
866
- roll-.clarify → passive scope clarification for vague build requests
867
- ```
868
-
869
- ---
870
-
871
- ## Required Artifacts (per Action)
41
+ - Do not use for pure design/backlog splitting; route that to roll-design until implementation starts.
42
+ - TCR and evidence gates remain mandatory even when the code change looks small.
872
43
 
873
- The agent must explicitly produce (in text) before or during execution:
44
+ ## Maintenance
874
45
 
875
- - **Current User Story**: 1–3 sentences, INVEST-lean
876
- - **Current Action**: smallest shippable increment
877
- - **Acceptance criteria**: measurable outcomes for this Action
878
- - **Write scope**: files/areas expected to change
879
- - **Test Design**: scenarios, edge cases, test types
880
- - **Test Design Review**: coverage validation result
881
- - **TCR Log**: micro-step descriptions and commit count
882
- - **E2E Deposit**: golden path E2E test file for this Story
883
- - **Quality Review**: post-TCR code review result
884
- - **Deployment target**: where it will be verified
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.