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