@seanyao/roll 3.609.2 → 3.610.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +44 -1
- package/README.md +5 -6
- package/dist/roll.mjs +16146 -16186
- package/package.json +3 -2
- 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/bin/roll +0 -15361
- package/lib/backfill-pi-usage.py +0 -243
- package/lib/changelog_audit.py +0 -149
- package/lib/changelog_generate.py +0 -470
- package/lib/consistency_check.py +0 -409
- package/lib/context_feed_budget.sh +0 -194
- package/lib/github_sync.py +0 -876
- 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/i18n.sh +0 -211
- package/lib/loop-exit-summary.py +0 -393
- package/lib/loop-fmt.py +0 -589
- package/lib/loop_pick_agent.py +0 -316
- package/lib/loop_result_eval.py +0 -469
- package/lib/loop_unstick.py +0 -180
- package/lib/model_prices.py +0 -194
- package/lib/prices_fetcher.py +0 -534
- package/lib/roll-backlog.py +0 -225
- package/lib/roll-brief.py +0 -286
- package/lib/roll-help.py +0 -158
- package/lib/roll-home.py +0 -556
- package/lib/roll-init.py +0 -156
- package/lib/roll-loop-status.py +0 -1691
- package/lib/roll-loop-story.py +0 -191
- package/lib/roll-peer.py +0 -252
- package/lib/roll-setup.py +0 -102
- package/lib/roll-status.py +0 -367
- package/lib/roll_git.py +0 -41
- package/lib/roll_render.py +0 -414
- 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/lib/slides-render.py +0 -778
- package/lib/slides-validate.py +0 -357
- package/lib/test_quality_gate.py +0 -143
- 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,365 @@
|
|
|
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 Dream (Nightly Code Health Scan)
|
|
8
|
+
|
|
9
|
+
> Follows the Architecture Constraints, Development Discipline, and Engineering
|
|
10
|
+
> Common Sense defined in the project AGENTS.md.
|
|
11
|
+
|
|
12
|
+
**Passively triggered — do not invoke manually.** Runs nightly via scheduler.
|
|
13
|
+
Consolidates structural signals accumulated during the day, surfaces technical
|
|
14
|
+
debt, and writes REFACTOR entries to BACKLOG. The human reviews the dream log
|
|
15
|
+
in the morning brief.
|
|
16
|
+
|
|
17
|
+
## Distinction from roll-sentinel
|
|
18
|
+
|
|
19
|
+
| | roll-sentinel | roll-.dream |
|
|
20
|
+
|--|--------------|------------|
|
|
21
|
+
| **Trigger** | Post-deploy, scheduled patrol | Nightly, fixed schedule |
|
|
22
|
+
| **Target** | Runtime behavior (production) | Code structure (codebase) |
|
|
23
|
+
| **Output** | FIX entries | REFACTOR entries + dream log |
|
|
24
|
+
| **Question** | "Is the product working?" | "Is the code healthy?" |
|
|
25
|
+
|
|
26
|
+
## Scan Logic
|
|
27
|
+
|
|
28
|
+
Run all scans every night. Each scan is independent.
|
|
29
|
+
|
|
30
|
+
### Scan 1 — Dead Code
|
|
31
|
+
|
|
32
|
+
Find code that is defined but never referenced:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Unused exports (TypeScript/JS)
|
|
36
|
+
grep -r "^export " src/ --include="*.ts" -l | while read f; do
|
|
37
|
+
symbol=$(grep -o "export \(function\|const\|class\|type\|interface\) [A-Za-z]*" "$f" | awk '{print $NF}')
|
|
38
|
+
# check if symbol appears anywhere else in the codebase
|
|
39
|
+
done
|
|
40
|
+
|
|
41
|
+
# Unused files (no imports pointing to them)
|
|
42
|
+
# Git: files not touched in 90+ days and not imported anywhere
|
|
43
|
+
git log --since="90 days ago" --name-only --format="" | sort -u > /tmp/recently_touched
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Flag: files or exports with zero references outside their own file.
|
|
47
|
+
|
|
48
|
+
### Scan 2 — Architectural Drift
|
|
49
|
+
|
|
50
|
+
Compare current code structure against the domain model in `.roll/domain/`:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Read context-map.md and ubiquitous-language.md if they exist
|
|
54
|
+
# Check: do module/directory names match Bounded Context names?
|
|
55
|
+
# Check: do cross-module imports respect Context boundaries?
|
|
56
|
+
# Check: do any modules import directly across Context lines without ACL?
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Flag: modules that import directly from a different Bounded Context without
|
|
60
|
+
an Anti-Corruption Layer, or module names that have diverged from the
|
|
61
|
+
Ubiquitous Language.
|
|
62
|
+
|
|
63
|
+
**Distinction from Scan 6C**: Scan 2 flags *import boundary violations* (cross-context coupling). Scan 6C flags *missing documentation entries* (module exists but has no entry in `.roll/domain/*.md`). Never double-flag — Scan 2 and Scan 6C are orthogonal checks.
|
|
64
|
+
|
|
65
|
+
### Scan 3 — Pruning Candidates
|
|
66
|
+
|
|
67
|
+
Find over-engineering that can be simplified:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Abstractions with only one implementation
|
|
71
|
+
grep -r "interface \|abstract class " src/ --include="*.ts" -l
|
|
72
|
+
|
|
73
|
+
# Wrapper functions that do nothing but delegate
|
|
74
|
+
# Config flags that are never toggled (always true or always false)
|
|
75
|
+
# Error handling for paths that cannot occur
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Flag: interfaces with exactly one implementor, feature flags frozen to one
|
|
79
|
+
value, wrapper layers with no logic.
|
|
80
|
+
|
|
81
|
+
### Scan 4 — Emerging Patterns
|
|
82
|
+
|
|
83
|
+
Find repeated structures that warrant extraction:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
# Duplicated code blocks (>10 lines, similar structure)
|
|
87
|
+
# Similar file structures across multiple modules
|
|
88
|
+
# Repeated try/catch patterns with identical handling
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Flag: any pattern appearing 3+ times that could be extracted into a shared
|
|
92
|
+
utility or convention.
|
|
93
|
+
|
|
94
|
+
### Scan 5 — Doc Coverage Check
|
|
95
|
+
|
|
96
|
+
Check documentation structure against the conventions in `AGENTS.md § Documentation Conventions`.
|
|
97
|
+
|
|
98
|
+
**Check A — BACKLOG Done stories missing guide/en/ docs:**
|
|
99
|
+
|
|
100
|
+
Scan .roll/backlog.md for features with multiple ✅ Done stories. For each feature epic, check whether a corresponding `guide/en/<topic>.md` exists. If a feature has ≥3 Done stories and no guide doc, flag it.
|
|
101
|
+
|
|
102
|
+
**Check B — guide/en/ files missing guide/zh/ translations:**
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
for f in guide/en/*.md; do
|
|
106
|
+
base=$(basename "$f")
|
|
107
|
+
[ ! -f "guide/zh/$base" ] && echo "missing ZH: $base"
|
|
108
|
+
done
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Flag any `guide/en/<topic>.md` that has no matching `guide/zh/<topic>.md`, provided the EN file has existed since before the most recent git tag (i.e., at least one release cycle old).
|
|
112
|
+
|
|
113
|
+
**Check C — stray files in docs/ root (根目录散落文件):**
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
find docs/ -maxdepth 1 -name '*.md' 2>/dev/null
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Flag any `.md` file directly in `docs/` root (allowed subdirs: `guide/`, `domain/`, `features/`, `practices/`, `briefs/`, `dream/`).
|
|
120
|
+
|
|
121
|
+
**Check D — features.md Feature Coverage (US-DOC-009):**
|
|
122
|
+
|
|
123
|
+
Dependency gate: skip when `.roll/features.md` does not exist.
|
|
124
|
+
|
|
125
|
+
Parse .roll/backlog.md for all `### Feature: <name>` groups that contain ≥1 ✅ Done story. Parse `.roll/features.md` for Feature names. If any Feature group with Done stories is absent from `.roll/features.md`, the catalog is stale — flag as REFACTOR:
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
| REFACTOR-XXX | features.md 功能目录落后于 BACKLOG,N 个已完成功能区未收录,用户无法通过产品目录发现这些功能 — flagged by dream YYYY-MM-DD | 📋 Todo |
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
The catalog is auto-updated by the release script (maintainer-private at `roll-meta/ops/release.sh`) at release time (Section 8 of roll-.changelog). Between releases, this check surfaces the coverage gap so it isn't silently skipped.
|
|
132
|
+
|
|
133
|
+
**REFACTOR entry format for doc findings:**
|
|
134
|
+
|
|
135
|
+
```markdown
|
|
136
|
+
| REFACTOR-XXX | docs: {具体缺口描述} — flagged by dream {YYYY-MM-DD} | 📋 Todo |
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
**Dream log section** — add after existing sections:
|
|
140
|
+
|
|
141
|
+
```markdown
|
|
142
|
+
## 文档覆盖度
|
|
143
|
+
- features.md 功能区覆盖:{N}/{M} 个已完成功能区已收录(缺失:{列表 或 "无"})
|
|
144
|
+
{其他发现内容 或 "文档结构符合规范,无缺口。"}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Scan 6 — 文档新鲜度 (Doc Freshness)
|
|
148
|
+
|
|
149
|
+
**Dependency gate**: Skip Scan 6 entirely when `$roll-doc` (US-SKILL-008) is not yet deployed.
|
|
150
|
+
Check: `[ -f "$ROLL_HOME/skills/roll-doc/SKILL.md" ]`. If absent, log "Scan 6 skipped — roll-doc not deployed" in the dream log and stop. No fallback.
|
|
151
|
+
|
|
152
|
+
When deployed, each finding produces a REFACTOR entry with `$roll-doc` as execution hint:
|
|
153
|
+
```markdown
|
|
154
|
+
| REFACTOR-XXX | docs: <description> — flagged by dream <date> (hint: $roll-doc) | 📋 Todo |
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
#### Check A — Stale Docs
|
|
158
|
+
|
|
159
|
+
Flag source files whose owning doc is >30 days stale:
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# For each file listed in .roll/features/*.md or README.md "## Files:" sections:
|
|
163
|
+
# owner_doc_commit = git log -1 --format="%ci" -- <doc_file>
|
|
164
|
+
# source_commit = git log -1 --format="%ci" -- <source_file>
|
|
165
|
+
# lag_days = (source_commit - owner_doc_commit) in days
|
|
166
|
+
# if lag_days > 30 AND doc contains at least one specific file path reference → flag
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
The "owner doc" for a source file is the nearest `README.md` or `.roll/features/*.md` that lists the file path in a `## Files:` section. Skip docs that contain only conceptual descriptions (no specific file path references) — they cannot be objectively stale.
|
|
170
|
+
|
|
171
|
+
#### Check B — Undocumented ENV Vars
|
|
172
|
+
|
|
173
|
+
Flag environment variables that appear frequently in source but have no documentation:
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
# Detect ENV var patterns in non-test source files:
|
|
177
|
+
patterns=(
|
|
178
|
+
'process\.env\.[A-Z_]+' # Node.js
|
|
179
|
+
'os\.getenv\("[A-Z_]+"\)' # Python
|
|
180
|
+
'ENV\["[A-Z_]+"\]' # Ruby
|
|
181
|
+
)
|
|
182
|
+
# For each matched variable name:
|
|
183
|
+
# count occurrences across all source files
|
|
184
|
+
# if count >= 5 AND zero mentions in any .md file → flag
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Flag variables appearing ≥5× in source with zero mentions in any `.md`.
|
|
188
|
+
"Other convention signals" (comment clusters, module structure templates) are explicitly deferred — too vague for deterministic detection.
|
|
189
|
+
|
|
190
|
+
#### Check C — Existence Drift
|
|
191
|
+
|
|
192
|
+
Find module directories that exist in code but are absent from architecture docs.
|
|
193
|
+
This is distinct from Scan 2 (which checks *import violations*) — Scan 6C checks *documentation existence*:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
# Walk all non-excluded directories
|
|
197
|
+
# For each dir with >= 3 non-hidden, non-.md source files:
|
|
198
|
+
# check if any .roll/domain/*.md contains the directory name
|
|
199
|
+
# if not found → flag as "existence drift"
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Exclusions: `node_modules/`, `.git/`, `dist/`, `build/`, `.shared/`, `docs/`, `tests/`.
|
|
203
|
+
|
|
204
|
+
Flag directories with ≥3 source files and zero name-match in `.roll/domain/*.md`.
|
|
205
|
+
|
|
206
|
+
#### Dream Log Section
|
|
207
|
+
|
|
208
|
+
Add after `## 文档覆盖度` section:
|
|
209
|
+
|
|
210
|
+
```markdown
|
|
211
|
+
## 文档新鲜度
|
|
212
|
+
- 滞后文档:{N} 个(超过 30 天未更新但绑定了代码文件)
|
|
213
|
+
- 未记录 ENV 变量:{N} 个(出现 ≥5 次但无文档)
|
|
214
|
+
- 架构文档缺失模块:{N} 个(≥3 个源文件的目录未出现在 .roll/domain/)
|
|
215
|
+
{发现内容列表 或 "文档新鲜度良好,无滞后或缺失项。"}
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Scan 7 — Test Quality (rubric-driven)
|
|
219
|
+
|
|
220
|
+
Apply the test-quality rubric at [guide/en/testing/quality-rubric.md](../../guide/en/testing/quality-rubric.md)
|
|
221
|
+
(Chinese: [quality-rubric.zh.md](../../guide/zh/testing/quality-rubric.md)) against every file under
|
|
222
|
+
`tests/`. The rubric publishes six anti-pattern categories (❶..❻); each has a
|
|
223
|
+
**Signals** subsection that lists the matching heuristics. Scan 7 is purely a
|
|
224
|
+
mechanical apply-the-rubric step — no new logic.
|
|
225
|
+
|
|
226
|
+
**Per-category signals** — read from the rubric, summarized here:
|
|
227
|
+
|
|
228
|
+
| Marker | Anti-pattern | Cheapest signal |
|
|
229
|
+
|--------|--------------|-----------------|
|
|
230
|
+
| ❶ | Hardcoded business data | Bare numeric / version / pricing literal inside `[[ "$output" == *"..."*` that matches a value also defined in `lib/` |
|
|
231
|
+
| ❷ | Over-mocking real boundaries | `function git() {` / `function gh() {` overrides at the top of a unit test |
|
|
232
|
+
| ❸ | Asserting implementation details | `grep '_internal_helper'` against output; assertions on `.roll/internal/*` paths |
|
|
233
|
+
| ❹ | Fixture order coupling | `setup_file` writes shared mutable state without per-test reset |
|
|
234
|
+
| ❺ | Testing private functions | Test sources a `lib/` file and calls a `_underscore_prefixed` helper directly |
|
|
235
|
+
| ❻ | Asserting framework behavior | References to `$BATS_TEST_NUMBER`, `$BATS_SUITE_NAME` in assertions |
|
|
236
|
+
|
|
237
|
+
**Rate cap — 每轮 ≤ 5 条 test-quality REFACTOR entries**. Same dream cycle may
|
|
238
|
+
emit more than 5 findings; the dream scan must rank by severity (❶ > ❷ > ❸ > ❹ > ❺ > ❻
|
|
239
|
+
and within a class, by occurrence count) and only persist the top 5 to BACKLOG.
|
|
240
|
+
Remaining findings go into the dream log under `## 测试质量` but are not made
|
|
241
|
+
into REFACTOR rows — this prevents the backlog from being drowned in test-debt
|
|
242
|
+
on the first scan after rubric publication.
|
|
243
|
+
|
|
244
|
+
**REFACTOR entry format** — same as other scans, but tagged with category:
|
|
245
|
+
|
|
246
|
+
```markdown
|
|
247
|
+
| REFACTOR-XXX | docs: <one-line description> [test-quality:❶] — flagged by dream YYYY-MM-DD | 📋 Todo |
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
The `[test-quality:❶]` (through `❻`) tag is **required** so downstream filtering
|
|
251
|
+
(e.g. "show me all ❶ items still open") is mechanical. The marker character must
|
|
252
|
+
match the rubric exactly.
|
|
253
|
+
|
|
254
|
+
**Optional helper** — `bin/dream-test-quality-scan` is a thin shell script
|
|
255
|
+
maintainers can invoke ad-hoc to dry-run the ❶ detector against a single file
|
|
256
|
+
or directory (see `bin/dream-test-quality-scan --help`). The dream skill itself
|
|
257
|
+
does **not** depend on the helper — Scan 7 is the AI agent applying the rubric.
|
|
258
|
+
The helper just exists so a maintainer (or this skill's smoke test) can confirm
|
|
259
|
+
the ❶ heuristic still finds known instances.
|
|
260
|
+
|
|
261
|
+
#### Dream Log Section (Scan 7)
|
|
262
|
+
|
|
263
|
+
Add after `## 文档新鲜度` section:
|
|
264
|
+
|
|
265
|
+
```markdown
|
|
266
|
+
## 测试质量
|
|
267
|
+
- 本轮发现 {N} 项(写入 BACKLOG 的前 5 项见下;剩余 {M} 项仅记录于本日志)
|
|
268
|
+
- ❶ 硬编码业务数据:{count}
|
|
269
|
+
- ❷ 过度 mock:{count}
|
|
270
|
+
- ❸ 断言实现细节:{count}
|
|
271
|
+
- ❹ Fixture 顺序耦合:{count}
|
|
272
|
+
- ❺ 测私有函数:{count}
|
|
273
|
+
- ❻ 断言框架行为:{count}
|
|
274
|
+
{命中文件列表 或 "未发现可治理的测试反模式。"}
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Output
|
|
278
|
+
|
|
279
|
+
### REFACTOR Entry (.roll/backlog.md)
|
|
280
|
+
|
|
281
|
+
For each finding that warrants action, append one row to the `## ♻️ Refactor`
|
|
282
|
+
section of .roll/backlog.md:
|
|
283
|
+
|
|
284
|
+
```markdown
|
|
285
|
+
| REFACTOR-XXX | {one-line description} — flagged by dream {YYYY-MM-DD} | 📋 Todo |
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
`{one-line description}` 写法:一句人话说清楚"什么地方需要改"以及"不改会怎样"。不写函数名、文件路径、技术方案。例:`loop 状态读取逻辑分散在多处,修一处容易遗漏另一处`。
|
|
289
|
+
|
|
290
|
+
**Threshold**: only flag items where the fix would meaningfully reduce
|
|
291
|
+
complexity or prevent future bugs. Ignore cosmetic issues.
|
|
292
|
+
|
|
293
|
+
### Dream Log (.roll/dream/YYYY-MM-DD.md)
|
|
294
|
+
|
|
295
|
+
Always write a log, even when no REFACTOR entries are created. Output uses
|
|
296
|
+
Chinese to align with roll-brief style — easier for the morning reader to scan
|
|
297
|
+
without context switching:
|
|
298
|
+
|
|
299
|
+
```markdown
|
|
300
|
+
# Dream Log {YYYY-MM-DD}
|
|
301
|
+
|
|
302
|
+
## 概要
|
|
303
|
+
- 扫描项:死代码 / 架构漂移 / 裁剪候选 / 新兴模式 / 文档覆盖度 / 文档新鲜度
|
|
304
|
+
- 发现:{N} 项标记,{M} 个 REFACTOR 条目已创建
|
|
305
|
+
|
|
306
|
+
## 死代码
|
|
307
|
+
{发现内容 或 "未发现死代码。"}
|
|
308
|
+
|
|
309
|
+
## 架构漂移
|
|
310
|
+
{发现内容 或 "未发现架构漂移。"}
|
|
311
|
+
|
|
312
|
+
## 裁剪候选
|
|
313
|
+
{发现内容 或 "未发现可裁剪项。"}
|
|
314
|
+
|
|
315
|
+
## 新兴模式
|
|
316
|
+
{发现内容 或 "未发现可提取的重复模式。"}
|
|
317
|
+
|
|
318
|
+
## 文档覆盖度
|
|
319
|
+
{发现内容 或 "文档结构符合规范,无缺口。"}
|
|
320
|
+
|
|
321
|
+
## 文档新鲜度
|
|
322
|
+
- 滞后文档:{N} 个
|
|
323
|
+
- 未记录 ENV 变量:{N} 个
|
|
324
|
+
- 架构文档缺失模块:{N} 个
|
|
325
|
+
{发现内容 或 "文档新鲜度良好,无滞后或缺失项。"}
|
|
326
|
+
|
|
327
|
+
## 创建的 REFACTOR 条目
|
|
328
|
+
{列表 或 "无。"}
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### Commit
|
|
332
|
+
|
|
333
|
+
扫描完成后立即提交,把 dream 发现纳入 git 历史,便于晨报追溯:
|
|
334
|
+
|
|
335
|
+
```bash
|
|
336
|
+
git add .roll/backlog.md .roll/dream/YYYY-MM-DD.md
|
|
337
|
+
# 有 REFACTOR 条目时:
|
|
338
|
+
git commit -m "chore: dream scan YYYY-MM-DD — {N} REFACTOR entries"
|
|
339
|
+
# 无发现时:
|
|
340
|
+
git commit -m "chore: dream scan YYYY-MM-DD — no findings"
|
|
341
|
+
git push origin main
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
- .roll/backlog.md 和 dream 日志必须在**同一个 commit** 里入库,避免出现"REFACTOR 已加但日志找不到"或反过来的撕裂状态
|
|
345
|
+
- 写文件失败时不要执行 commit;保持工作区干净,由调度器负责重试
|
|
346
|
+
- 仅 `.roll/backlog.md` 和 `.roll/dream/YYYY-MM-DD.md` 入 commit,不要顺带带入其他无关变更
|
|
347
|
+
|
|
348
|
+
## Scheduler Configuration
|
|
349
|
+
|
|
350
|
+
roll-.dream runs **locally** — it reads the local codebase directly.
|
|
351
|
+
|
|
352
|
+
### Local cron (default)
|
|
353
|
+
|
|
354
|
+
Installed automatically via `roll loop on` alongside roll-loop and roll-brief.
|
|
355
|
+
The cron entry is generated using the configured agent — no manual cron editing needed.
|
|
356
|
+
|
|
357
|
+
## Failure Handling
|
|
358
|
+
|
|
359
|
+
If the scan fails partway through:
|
|
360
|
+
|
|
361
|
+
1. Write partial results to `.roll/dream/YYYY-MM-DD.md` with a `## 状态:部分完成` header
|
|
362
|
+
2. Do not write incomplete REFACTOR entries to BACKLOG
|
|
363
|
+
3. Log the error to `~/.shared/roll/dream/error.log`
|
|
364
|
+
|
|
365
|
+
The scheduler (not this skill) is responsible for retry and human notification.
|
|
@@ -2,13 +2,15 @@
|
|
|
2
2
|
hidden: true
|
|
3
3
|
name: roll-.echo
|
|
4
4
|
license: MIT
|
|
5
|
-
description:
|
|
6
|
-
Passive intent clarification skill. Automatically activates when user input is vague, rambling, contradictory, or unclear. Restates the user's intent in structured, concise form and confirms before proceeding. Does NOT activate when intent is already clear — in that case, just execute directly.
|
|
7
|
-
This is a passive skill. Never announce "I'm using roll-.echo." Just do it naturally: restate, confirm, proceed.
|
|
5
|
+
description: "Load when user intent is vague, contradictory, rambling, or unclear and should be restated for confirmation before action."
|
|
8
6
|
---
|
|
9
|
-
|
|
10
7
|
# Echo
|
|
11
8
|
|
|
9
|
+
## Gotchas
|
|
10
|
+
|
|
11
|
+
- Echo confirms unclear intent; it must not add scope, design decisions, or backlog artifacts on its own.
|
|
12
|
+
- Do not load for clear actionable requests, even if the task is large.
|
|
13
|
+
|
|
12
14
|
> Passive intent clarification — restate messy thoughts as clear intent, confirm, then act.
|
|
13
15
|
|
|
14
16
|
## When to Activate
|
package/skills/roll-.qa/SKILL.md
CHANGED
|
@@ -3,256 +3,45 @@ hidden: true
|
|
|
3
3
|
name: roll-.qa
|
|
4
4
|
license: MIT
|
|
5
5
|
allowed-tools: "Read"
|
|
6
|
-
description:
|
|
6
|
+
description: "Load when a build, fix, review, or story needs Roll QA coverage standards: test pyramid, evidence expectations, visual/E2E boundaries, or CI gates."
|
|
7
7
|
---
|
|
8
|
+
# Roll QA
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
This hub keeps the routing boundary, hard gates, and execution skeleton in the initial context. Load the heavier runbook only when the task actually needs the detailed contract.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
+
## Load
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
Any product with a user interface (Web, Desktop, Mobile) must follow these testing standards.
|
|
14
|
+
Load when a build, fix, review, or story needs Roll QA coverage standards: test pyramid, evidence expectations, visual/E2E boundaries, or CI gates.
|
|
16
15
|
|
|
17
16
|
## When Not to Use
|
|
18
17
|
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
- Per-commit self-review of diffs (use `$roll-.review`)
|
|
22
|
-
|
|
23
|
-
## Required Testing Levels
|
|
24
|
-
|
|
25
|
-
### 1. Unit Tests (Logic)
|
|
26
|
-
- **Tool**: Vitest / Jest
|
|
27
|
-
- **Coverage**: Business logic, utilities, hooks
|
|
28
|
-
- **Run**: `npm run test`
|
|
29
|
-
|
|
30
|
-
### 2. E2E Tests (User Flows)
|
|
31
|
-
- **Tool**: **Playwright** (default)
|
|
32
|
-
- **Coverage**: Critical user paths, interactions
|
|
33
|
-
- **Run**: `npm run test:e2e`
|
|
34
|
-
|
|
35
|
-
### 3. Visual Regression (UI Stability)
|
|
36
|
-
- **Tool**: Playwright screenshot testing
|
|
37
|
-
- **Coverage**: Key UI states
|
|
38
|
-
- **Run**: Part of E2E tests
|
|
39
|
-
- **Baseline**: Stored in `e2e/__snapshots__/`
|
|
40
|
-
|
|
41
|
-
### 4. Smoke Tests (Post-deploy)
|
|
42
|
-
- **Tool**: Playwright
|
|
43
|
-
- **Coverage**: Core functionality on production
|
|
44
|
-
- **Run**: `npm run test:e2e:smoke`
|
|
45
|
-
|
|
46
|
-
## Playwright Setup
|
|
47
|
-
|
|
48
|
-
### Installation
|
|
49
|
-
```bash
|
|
50
|
-
npm install -D @playwright/test
|
|
51
|
-
npx playwright install chromium
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Configuration (playwright.config.ts)
|
|
55
|
-
```typescript
|
|
56
|
-
import { defineConfig, devices } from '@playwright/test';
|
|
57
|
-
|
|
58
|
-
export default defineConfig({
|
|
59
|
-
testDir: './e2e',
|
|
60
|
-
fullyParallel: true,
|
|
61
|
-
retries: process.env.CI ? 2 : 0,
|
|
62
|
-
reporter: 'html',
|
|
63
|
-
use: {
|
|
64
|
-
baseURL: process.env.PLAYWRIGHT_BASE_URL || 'http://localhost:5173',
|
|
65
|
-
trace: 'on-first-retry',
|
|
66
|
-
screenshot: 'only-on-failure',
|
|
67
|
-
},
|
|
68
|
-
projects: [
|
|
69
|
-
{ name: 'chromium', use: { ...devices['Desktop Chrome'] } },
|
|
70
|
-
],
|
|
71
|
-
});
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
### Required Test Files
|
|
75
|
-
|
|
76
|
-
**e2e/smoke.spec.ts** (Deployment verification)
|
|
77
|
-
```typescript
|
|
78
|
-
import { test, expect } from '@playwright/test';
|
|
79
|
-
|
|
80
|
-
test('app loads', async ({ page }) => {
|
|
81
|
-
await page.goto('/');
|
|
82
|
-
await expect(page.locator('#app')).toBeVisible();
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
**e2e/interaction.spec.ts** (User flows)
|
|
87
|
-
```typescript
|
|
88
|
-
test('user can complete core flow', async ({ page }) => {
|
|
89
|
-
await page.goto('/');
|
|
90
|
-
// Test critical user journey
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
**e2e/visual.spec.ts** (Visual regression)
|
|
95
|
-
```typescript
|
|
96
|
-
test('homepage visual', async ({ page }) => {
|
|
97
|
-
await page.goto('/');
|
|
98
|
-
await expect(page).toHaveScreenshot('homepage.png');
|
|
99
|
-
});
|
|
100
|
-
```
|
|
101
|
-
|
|
102
|
-
### Package.json Scripts
|
|
103
|
-
```json
|
|
104
|
-
{
|
|
105
|
-
"scripts": {
|
|
106
|
-
"test:e2e": "playwright test",
|
|
107
|
-
"test:e2e:ui": "playwright test --ui",
|
|
108
|
-
"test:e2e:smoke": "playwright test smoke.spec.ts",
|
|
109
|
-
"test:all": "npm run test && npm run test:e2e"
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
## Visual Regression Workflow
|
|
115
|
-
|
|
116
|
-
### 1. Create Baseline (First Time)
|
|
117
|
-
```bash
|
|
118
|
-
npx playwright test --update-snapshots
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### 2. Commit Baseline
|
|
122
|
-
```bash
|
|
123
|
-
git add e2e/__snapshots__/
|
|
124
|
-
git commit -m "chore: add visual regression baselines"
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### 3. Subsequent Runs (Compare)
|
|
128
|
-
```bash
|
|
129
|
-
npm run test:e2e
|
|
130
|
-
# Fails if screenshots differ beyond threshold
|
|
131
|
-
```
|
|
132
|
-
|
|
133
|
-
### 4. Update Baseline (Intentional UI Change)
|
|
134
|
-
```bash
|
|
135
|
-
npx playwright test --update-snapshots
|
|
136
|
-
git add e2e/__snapshots__/
|
|
137
|
-
git commit -m "chore: update visual baseline for new design"
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## CI/CD Integration
|
|
141
|
-
|
|
142
|
-
### Local Pre-push Checklist
|
|
143
|
-
- [ ] `npm run test` passes
|
|
144
|
-
- [ ] `npm run test:e2e` passes
|
|
145
|
-
- [ ] No unexpected visual regressions
|
|
146
|
-
|
|
147
|
-
### Post-deploy Smoke Test
|
|
148
|
-
```bash
|
|
149
|
-
# Against production URL
|
|
150
|
-
PLAYWRIGHT_BASE_URL=https://your-app.com npm run test:e2e:smoke
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## Common Patterns
|
|
154
|
-
|
|
155
|
-
### Testing Canvas/Game Rendering
|
|
156
|
-
```typescript
|
|
157
|
-
test('game renders', async ({ page }) => {
|
|
158
|
-
await page.goto('/');
|
|
159
|
-
const canvas = page.locator('#gameCanvas');
|
|
160
|
-
await expect(canvas).toBeVisible();
|
|
161
|
-
|
|
162
|
-
// Visual regression for canvas
|
|
163
|
-
await expect(page).toHaveScreenshot('game-initial.png', {
|
|
164
|
-
maxDiffPixels: 100,
|
|
165
|
-
});
|
|
166
|
-
});
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
### Testing Responsive Layouts
|
|
170
|
-
```typescript
|
|
171
|
-
test('responsive design', async ({ page }) => {
|
|
172
|
-
await page.setViewportSize({ width: 375, height: 667 });
|
|
173
|
-
await page.goto('/');
|
|
174
|
-
await expect(page.locator('.mobile-menu')).toBeVisible();
|
|
175
|
-
});
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
### Testing Voice/Audio Features
|
|
179
|
-
```typescript
|
|
180
|
-
test('voice button toggles', async ({ page }) => {
|
|
181
|
-
await page.goto('/');
|
|
182
|
-
const btn = page.locator('#voiceBtn');
|
|
183
|
-
await btn.click();
|
|
184
|
-
await expect(btn).toHaveClass(/active/);
|
|
185
|
-
});
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Failure Handling
|
|
189
|
-
|
|
190
|
-
### Flaky Tests
|
|
191
|
-
- Add `test.fixme()` to skip temporarily
|
|
192
|
-
- Increase `timeout` for slow operations
|
|
193
|
-
- Use `retries` in config for network-dependent tests
|
|
194
|
-
|
|
195
|
-
### Visual Regression Failures
|
|
196
|
-
1. Check if change is intentional
|
|
197
|
-
2. If yes: `npx playwright test --update-snapshots`
|
|
198
|
-
3. If no: fix the code
|
|
199
|
-
|
|
200
|
-
### Missing Test Infrastructure
|
|
201
|
-
If project lacks Playwright setup:
|
|
202
|
-
1. Install dependencies
|
|
203
|
-
2. Create config
|
|
204
|
-
3. Add basic smoke test
|
|
205
|
-
4. Run to create baseline
|
|
206
|
-
5. Commit as separate "test infrastructure" change
|
|
207
|
-
|
|
208
|
-
## CI Failure Triage
|
|
209
|
-
|
|
210
|
-
When CI goes red, triage the failure into an actionable item instead of ignoring it.
|
|
211
|
-
|
|
212
|
-
### Step 1: Read the CI Log
|
|
213
|
-
|
|
214
|
-
```
|
|
215
|
-
CI failure
|
|
216
|
-
│
|
|
217
|
-
├── Which step failed? (lint / build / test / e2e)
|
|
218
|
-
├── What is the error message?
|
|
219
|
-
├── Is it reproducible locally?
|
|
220
|
-
└── Is it flaky (passes on retry)?
|
|
221
|
-
```
|
|
18
|
+
- Post-TCR code review; load roll-.review.
|
|
19
|
+
- PR review verdicts; load roll-review-pr.
|
|
222
20
|
|
|
223
|
-
|
|
21
|
+
## Read On Demand
|
|
224
22
|
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
| Critical | Build or core tests fail, blocks all merges | Fix immediately via `$roll-fix` |
|
|
228
|
-
| High | E2E test fails on a key user flow | Create FIX-XXX, fix within current sprint |
|
|
229
|
-
| Medium | Visual regression, non-critical test failure | Create FIX-XXX, prioritize in backlog |
|
|
230
|
-
| Low | Lint warning, flaky test (passes on retry) | Create FIX-XXX or IDEA-XXX, fix when convenient |
|
|
23
|
+
- Read [the full contract](references/full-contract.md) before executing the workflow end to end, recovering from failures, or checking exact output templates.
|
|
24
|
+
- Keep this hub in context for trigger boundaries and hard gates.
|
|
231
25
|
|
|
232
|
-
|
|
26
|
+
## Workflow Skeleton
|
|
233
27
|
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
28
|
+
1. Map risk to unit, integration, E2E, visual, and smoke layers.
|
|
29
|
+
2. Define acceptance evidence per story.
|
|
30
|
+
3. Use the lightest layer that proves the risk.
|
|
31
|
+
4. Escalate coverage when behavior crosses boundaries.
|
|
237
32
|
|
|
238
|
-
|
|
239
|
-
$roll-idea idea "CI: investigate flaky {test name}"
|
|
240
|
-
```
|
|
33
|
+
## Hard Gates
|
|
241
34
|
|
|
242
|
-
|
|
35
|
+
- Tests must exercise product code or public entry points.
|
|
36
|
+
- Visual checks require rendered evidence when UI is touched.
|
|
243
37
|
|
|
244
|
-
|
|
245
|
-
FIX-XXX created
|
|
246
|
-
│
|
|
247
|
-
├── Critical / High → $roll-fix FIX-XXX (immediate)
|
|
248
|
-
├── Medium → schedule in backlog, $roll-fix when ready
|
|
249
|
-
└── Low → backlog, fix opportunistically
|
|
250
|
-
```
|
|
38
|
+
## Gotchas
|
|
251
39
|
|
|
252
|
-
|
|
40
|
+
- QA chooses evidence depth; it does not replace story-specific acceptance criteria or TCR test design.
|
|
41
|
+
- Do not use visual/E2E layers as a substitute for focused unit coverage when the risk is pure logic.
|
|
253
42
|
|
|
254
|
-
##
|
|
43
|
+
## Maintenance
|
|
255
44
|
|
|
256
|
-
-
|
|
257
|
-
-
|
|
258
|
-
-
|
|
45
|
+
- Description changes require updates in `route-cases/skills.json`.
|
|
46
|
+
- New observed failures should add a gotcha and the matching positive or negative route case.
|
|
47
|
+
- Heavy examples, templates, recovery paths, and deterministic snippets belong in `references/`, `assets/`, or `scripts/`, not in this hub.
|