@seanyao/roll 0.5.0 → 2.602.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +717 -0
- package/LICENSE +21 -0
- package/README.md +65 -165
- package/bin/dream-test-quality-scan +110 -0
- package/bin/roll +14897 -815
- package/conventions/config.yaml +17 -1
- package/conventions/global/AGENTS.md +146 -100
- package/conventions/global/CLAUDE.md +1 -21
- package/conventions/global/GEMINI.md +8 -22
- package/conventions/global/project_rules.md +9 -0
- package/conventions/templates/backend-service/AGENTS.md +30 -81
- package/conventions/templates/backend-service/GEMINI.md +3 -3
- package/conventions/templates/backend-service/project_rules.md +16 -0
- package/conventions/templates/cli/AGENTS.md +31 -58
- package/conventions/templates/cli/CLAUDE.md +3 -5
- package/conventions/templates/cli/GEMINI.md +3 -3
- package/conventions/templates/cli/project_rules.md +16 -0
- package/conventions/templates/frontend-only/AGENTS.md +29 -64
- package/conventions/templates/frontend-only/GEMINI.md +3 -3
- package/conventions/templates/frontend-only/project_rules.md +14 -0
- package/conventions/templates/fullstack/AGENTS.md +31 -79
- package/conventions/templates/fullstack/CLAUDE.md +1 -1
- package/conventions/templates/fullstack/GEMINI.md +3 -3
- package/conventions/templates/fullstack/project_rules.md +15 -0
- package/lib/README.md +42 -0
- package/lib/__pycache__/github_sync.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop-fmt.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_result_eval.cpython-314.pyc +0 -0
- package/lib/__pycache__/loop_unstick.cpython-314.pyc +0 -0
- package/lib/__pycache__/model_prices.cpython-314.pyc +0 -0
- package/lib/__pycache__/prices_fetcher.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-home.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll-loop-status.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_git.cpython-314.pyc +0 -0
- package/lib/__pycache__/roll_render.cpython-314.pyc +0 -0
- package/lib/__pycache__/slides-render.cpython-314.pyc +0 -0
- package/lib/agent_usage/README.md +49 -0
- package/lib/agent_usage/__init__.py +108 -0
- package/lib/agent_usage/__pycache__/__init__.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/gemini.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/kimi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/openai.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/pi_emit.cpython-314.pyc +0 -0
- package/lib/agent_usage/__pycache__/qwen.cpython-314.pyc +0 -0
- package/lib/agent_usage/gemini.py +127 -0
- package/lib/agent_usage/kimi.py +278 -0
- package/lib/agent_usage/kimi_emit.py +123 -0
- package/lib/agent_usage/openai.py +126 -0
- package/lib/agent_usage/pi.py +200 -0
- package/lib/agent_usage/pi_emit.py +135 -0
- package/lib/agent_usage/qwen.py +128 -0
- package/lib/backfill-pi-usage.py +243 -0
- package/lib/changelog_audit.py +155 -0
- package/lib/changelog_generate.py +263 -0
- package/lib/context_feed_budget.sh +194 -0
- package/lib/github_sync.py +876 -0
- package/lib/i18n/README.md +54 -0
- package/lib/i18n/agent.sh +75 -0
- package/lib/i18n/alert.sh +20 -0
- package/lib/i18n/backlog.sh +96 -0
- package/lib/i18n/brief.sh +5 -0
- package/lib/i18n/changelog.sh +5 -0
- package/lib/i18n/ci.sh +15 -0
- package/lib/i18n/debug.sh +0 -0
- package/lib/i18n/doctor.sh +44 -0
- package/lib/i18n/dream.sh +0 -0
- package/lib/i18n/init.sh +91 -0
- package/lib/i18n/lang.sh +10 -0
- package/lib/i18n/loop.sh +140 -0
- package/lib/i18n/migrate.sh +74 -0
- package/lib/i18n/offboard.sh +31 -0
- package/lib/i18n/onboard.sh +0 -0
- package/lib/i18n/peer.sh +41 -0
- package/lib/i18n/peer_help.sh +25 -0
- package/lib/i18n/peer_reset.sh +7 -0
- package/lib/i18n/peer_status.sh +5 -0
- package/lib/i18n/prices.sh +3 -0
- package/lib/i18n/prices_refresh.sh +17 -0
- package/lib/i18n/prices_show.sh +7 -0
- package/lib/i18n/propose.sh +0 -0
- package/lib/i18n/release.sh +0 -0
- package/lib/i18n/research.sh +0 -0
- package/lib/i18n/review_pr.sh +0 -0
- package/lib/i18n/sentinel.sh +0 -0
- package/lib/i18n/setup.sh +3 -0
- package/lib/i18n/shared.sh +157 -0
- package/lib/i18n/skills/roll-brief.sh +47 -0
- package/lib/i18n/skills/roll-build.sh +97 -0
- package/lib/i18n/skills/roll-design.sh +18 -0
- package/lib/i18n/skills/roll-fix.sh +53 -0
- package/lib/i18n/skills/roll-loop.sh +28 -0
- package/lib/i18n/skills/roll-onboard.sh +33 -0
- package/lib/i18n/skills_catalog.sh +30 -0
- package/lib/i18n/slides.sh +3 -0
- package/lib/i18n/slides_build.sh +38 -0
- package/lib/i18n/slides_delete.sh +19 -0
- package/lib/i18n/slides_list.sh +14 -0
- package/lib/i18n/slides_logs.sh +12 -0
- package/lib/i18n/slides_new.sh +15 -0
- package/lib/i18n/slides_preview.sh +14 -0
- package/lib/i18n/slides_templates.sh +7 -0
- package/lib/i18n/status.sh +21 -0
- package/lib/i18n/update.sh +24 -0
- package/lib/i18n.sh +211 -0
- package/lib/loop-exit-summary.py +393 -0
- package/lib/loop-fmt.py +589 -0
- package/lib/loop_pick_agent.py +316 -0
- package/lib/loop_result_eval.py +469 -0
- package/lib/loop_unstick.py +180 -0
- package/lib/model_prices.py +186 -0
- package/lib/prices/README.md +35 -0
- package/lib/prices/snapshot-2026-05-22.json +22 -0
- package/lib/prices/snapshot-2026-05-23-deepseek.json +15 -0
- package/lib/prices/snapshot-2026-05-23-kimi.json +14 -0
- package/lib/prices_fetcher.py +285 -0
- package/lib/roll-backlog.py +225 -0
- package/lib/roll-brief.py +286 -0
- package/lib/roll-help.py +158 -0
- package/lib/roll-home.py +556 -0
- package/lib/roll-init.py +156 -0
- package/lib/roll-loop-status.py +1683 -0
- package/lib/roll-loop-story.py +191 -0
- package/lib/roll-onboard-render.py +378 -0
- package/lib/roll-peer.py +252 -0
- package/lib/roll-plan-validate.py +386 -0
- package/lib/roll-setup.py +102 -0
- package/lib/roll-status.py +367 -0
- package/lib/roll_git.py +41 -0
- package/lib/roll_render.py +414 -0
- package/lib/slides/components/README.md +123 -0
- package/lib/slides/components/cards-2.html +9 -0
- package/lib/slides/components/cards-3.html +9 -0
- package/lib/slides/components/cards-4.html +9 -0
- package/lib/slides/components/compare.html +22 -0
- package/lib/slides/components/highlight.html +9 -0
- package/lib/slides/components/pipeline.html +12 -0
- package/lib/slides/components/plain.html +7 -0
- package/lib/slides/components/quote.html +4 -0
- package/lib/slides/components/timeline.html +9 -0
- package/lib/slides/templates/introduction-v3.html +571 -0
- package/lib/slides/templates/pitch.html +0 -0
- package/lib/slides-render.py +778 -0
- package/lib/slides-validate.py +357 -0
- package/lib/test_quality_gate.py +143 -0
- package/package.json +8 -7
- package/skills/roll-.changelog/SKILL.md +406 -33
- package/skills/roll-.clarify/SKILL.md +5 -2
- package/skills/roll-.dream/SKILL.md +374 -0
- package/skills/roll-.echo/SKILL.md +5 -2
- package/skills/roll-.qa/SKILL.md +57 -3
- package/skills/roll-.review/SKILL.md +42 -3
- package/skills/roll-brief/SKILL.md +209 -0
- package/skills/roll-build/SKILL.md +308 -63
- package/skills/roll-debug/SKILL.md +341 -162
- package/skills/roll-debug/injectable-bb.js +263 -0
- package/skills/roll-deck/SKILL.md +296 -0
- package/skills/roll-design/ENGINEERING_CHECKLIST.md +1 -1
- package/skills/roll-design/SKILL.md +727 -94
- package/skills/roll-doc/SKILL.md +595 -0
- package/skills/roll-doctor/SKILL.md +192 -0
- package/skills/roll-fix/SKILL.md +149 -32
- package/skills/{roll-jot → roll-idea}/SKILL.md +18 -10
- package/skills/roll-loop/SKILL.md +578 -0
- package/skills/roll-notes/SKILL.md +103 -0
- package/skills/roll-onboard/SKILL.md +234 -0
- package/skills/roll-peer/SKILL.md +336 -0
- package/skills/roll-propose/SKILL.md +157 -0
- package/skills/roll-review-pr/SKILL.md +58 -0
- package/skills/roll-sentinel/SKILL.md +11 -2
- package/skills/roll-spar/SKILL.md +8 -6
- package/template/.github/workflows/ci.yml +5 -2
- package/template/AGENTS.md +20 -74
- package/skills/roll-research/SKILL.md +0 -307
- package/skills/roll-research/references/schema.json +0 -162
- package/skills/roll-research/scripts/md_to_pdf.py +0 -289
- package/tools/roll-fetch/SKILL.md +0 -182
- package/tools/roll-fetch/package.json +0 -15
- package/tools/roll-fetch/smart-web-fetch.js +0 -558
- package/tools/roll-probe/SKILL.md +0 -84
- /package/template/{BACKLOG.md → .roll/backlog.md} +0 -0
|
@@ -0,0 +1,374 @@
|
|
|
1
|
+
---
|
|
2
|
+
hidden: true
|
|
3
|
+
name: roll-.dream
|
|
4
|
+
license: MIT
|
|
5
|
+
allowed-tools: "Read, Glob, Grep, Bash(git:*, curl:*, claude:*), Write, Edit"
|
|
6
|
+
description: |
|
|
7
|
+
Nightly code and architecture health scan. Passively triggered by scheduler
|
|
8
|
+
(cron or GitHub Actions), not invoked by users directly. Detects dead code,
|
|
9
|
+
architectural drift from domain model, pruning candidates, emerging patterns,
|
|
10
|
+
doc coverage gaps, and doc staleness (文档新鲜度).
|
|
11
|
+
Outputs REFACTOR entries to .roll/backlog.md and a daily log to .roll/dream/.
|
|
12
|
+
Distinct from roll-sentinel: sentinel monitors runtime behavior; dream reviews
|
|
13
|
+
code structure and architectural health.
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# Roll Dream (Nightly Code Health Scan)
|
|
17
|
+
|
|
18
|
+
> Follows the Architecture Constraints, Development Discipline, and Engineering
|
|
19
|
+
> Common Sense defined in the project AGENTS.md.
|
|
20
|
+
|
|
21
|
+
**Passively triggered — do not invoke manually.** Runs nightly via scheduler.
|
|
22
|
+
Consolidates structural signals accumulated during the day, surfaces technical
|
|
23
|
+
debt, and writes REFACTOR entries to BACKLOG. The human reviews the dream log
|
|
24
|
+
in the morning brief.
|
|
25
|
+
|
|
26
|
+
## Distinction from roll-sentinel
|
|
27
|
+
|
|
28
|
+
| | roll-sentinel | roll-.dream |
|
|
29
|
+
|--|--------------|------------|
|
|
30
|
+
| **Trigger** | Post-deploy, scheduled patrol | Nightly, fixed schedule |
|
|
31
|
+
| **Target** | Runtime behavior (production) | Code structure (codebase) |
|
|
32
|
+
| **Output** | FIX entries | REFACTOR entries + dream log |
|
|
33
|
+
| **Question** | "Is the product working?" | "Is the code healthy?" |
|
|
34
|
+
|
|
35
|
+
## Scan Logic
|
|
36
|
+
|
|
37
|
+
Run all scans every night. Each scan is independent.
|
|
38
|
+
|
|
39
|
+
### Scan 1 — Dead Code
|
|
40
|
+
|
|
41
|
+
Find code that is defined but never referenced:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Unused exports (TypeScript/JS)
|
|
45
|
+
grep -r "^export " src/ --include="*.ts" -l | while read f; do
|
|
46
|
+
symbol=$(grep -o "export \(function\|const\|class\|type\|interface\) [A-Za-z]*" "$f" | awk '{print $NF}')
|
|
47
|
+
# check if symbol appears anywhere else in the codebase
|
|
48
|
+
done
|
|
49
|
+
|
|
50
|
+
# Unused files (no imports pointing to them)
|
|
51
|
+
# Git: files not touched in 90+ days and not imported anywhere
|
|
52
|
+
git log --since="90 days ago" --name-only --format="" | sort -u > /tmp/recently_touched
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Flag: files or exports with zero references outside their own file.
|
|
56
|
+
|
|
57
|
+
### Scan 2 — Architectural Drift
|
|
58
|
+
|
|
59
|
+
Compare current code structure against the domain model in `.roll/domain/`:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Read context-map.md and ubiquitous-language.md if they exist
|
|
63
|
+
# Check: do module/directory names match Bounded Context names?
|
|
64
|
+
# Check: do cross-module imports respect Context boundaries?
|
|
65
|
+
# Check: do any modules import directly across Context lines without ACL?
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Flag: modules that import directly from a different Bounded Context without
|
|
69
|
+
an Anti-Corruption Layer, or module names that have diverged from the
|
|
70
|
+
Ubiquitous Language.
|
|
71
|
+
|
|
72
|
+
**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.
|
|
73
|
+
|
|
74
|
+
### Scan 3 — Pruning Candidates
|
|
75
|
+
|
|
76
|
+
Find over-engineering that can be simplified:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Abstractions with only one implementation
|
|
80
|
+
grep -r "interface \|abstract class " src/ --include="*.ts" -l
|
|
81
|
+
|
|
82
|
+
# Wrapper functions that do nothing but delegate
|
|
83
|
+
# Config flags that are never toggled (always true or always false)
|
|
84
|
+
# Error handling for paths that cannot occur
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Flag: interfaces with exactly one implementor, feature flags frozen to one
|
|
88
|
+
value, wrapper layers with no logic.
|
|
89
|
+
|
|
90
|
+
### Scan 4 — Emerging Patterns
|
|
91
|
+
|
|
92
|
+
Find repeated structures that warrant extraction:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Duplicated code blocks (>10 lines, similar structure)
|
|
96
|
+
# Similar file structures across multiple modules
|
|
97
|
+
# Repeated try/catch patterns with identical handling
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Flag: any pattern appearing 3+ times that could be extracted into a shared
|
|
101
|
+
utility or convention.
|
|
102
|
+
|
|
103
|
+
### Scan 5 — Doc Coverage Check
|
|
104
|
+
|
|
105
|
+
Check documentation structure against the conventions in `AGENTS.md § Documentation Conventions`.
|
|
106
|
+
|
|
107
|
+
**Check A — BACKLOG Done stories missing guide/en/ docs:**
|
|
108
|
+
|
|
109
|
+
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.
|
|
110
|
+
|
|
111
|
+
**Check B — guide/en/ files missing guide/zh/ translations:**
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
for f in guide/en/*.md; do
|
|
115
|
+
base=$(basename "$f")
|
|
116
|
+
[ ! -f "guide/zh/$base" ] && echo "missing ZH: $base"
|
|
117
|
+
done
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
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).
|
|
121
|
+
|
|
122
|
+
**Check C — stray files in docs/ root (根目录散落文件):**
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
find docs/ -maxdepth 1 -name '*.md' 2>/dev/null
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Flag any `.md` file directly in `docs/` root (allowed subdirs: `guide/`, `domain/`, `features/`, `practices/`, `briefs/`, `dream/`).
|
|
129
|
+
|
|
130
|
+
**Check D — features.md Feature Coverage (US-DOC-009):**
|
|
131
|
+
|
|
132
|
+
Dependency gate: skip when `.roll/features.md` does not exist.
|
|
133
|
+
|
|
134
|
+
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:
|
|
135
|
+
|
|
136
|
+
```markdown
|
|
137
|
+
| REFACTOR-XXX | features.md 功能目录落后于 BACKLOG,N 个已完成功能区未收录,用户无法通过产品目录发现这些功能 — flagged by dream YYYY-MM-DD | 📋 Todo |
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
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.
|
|
141
|
+
|
|
142
|
+
**REFACTOR entry format for doc findings:**
|
|
143
|
+
|
|
144
|
+
```markdown
|
|
145
|
+
| REFACTOR-XXX | docs: {具体缺口描述} — flagged by dream {YYYY-MM-DD} | 📋 Todo |
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
**Dream log section** — add after existing sections:
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
## 文档覆盖度
|
|
152
|
+
- features.md 功能区覆盖:{N}/{M} 个已完成功能区已收录(缺失:{列表 或 "无"})
|
|
153
|
+
{其他发现内容 或 "文档结构符合规范,无缺口。"}
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Scan 6 — 文档新鲜度 (Doc Freshness)
|
|
157
|
+
|
|
158
|
+
**Dependency gate**: Skip Scan 6 entirely when `$roll-doc` (US-SKILL-008) is not yet deployed.
|
|
159
|
+
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.
|
|
160
|
+
|
|
161
|
+
When deployed, each finding produces a REFACTOR entry with `$roll-doc` as execution hint:
|
|
162
|
+
```markdown
|
|
163
|
+
| REFACTOR-XXX | docs: <description> — flagged by dream <date> (hint: $roll-doc) | 📋 Todo |
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
#### Check A — Stale Docs
|
|
167
|
+
|
|
168
|
+
Flag source files whose owning doc is >30 days stale:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
# For each file listed in .roll/features/*.md or README.md "## Files:" sections:
|
|
172
|
+
# owner_doc_commit = git log -1 --format="%ci" -- <doc_file>
|
|
173
|
+
# source_commit = git log -1 --format="%ci" -- <source_file>
|
|
174
|
+
# lag_days = (source_commit - owner_doc_commit) in days
|
|
175
|
+
# if lag_days > 30 AND doc contains at least one specific file path reference → flag
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
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.
|
|
179
|
+
|
|
180
|
+
#### Check B — Undocumented ENV Vars
|
|
181
|
+
|
|
182
|
+
Flag environment variables that appear frequently in source but have no documentation:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
# Detect ENV var patterns in non-test source files:
|
|
186
|
+
patterns=(
|
|
187
|
+
'process\.env\.[A-Z_]+' # Node.js
|
|
188
|
+
'os\.getenv\("[A-Z_]+"\)' # Python
|
|
189
|
+
'ENV\["[A-Z_]+"\]' # Ruby
|
|
190
|
+
)
|
|
191
|
+
# For each matched variable name:
|
|
192
|
+
# count occurrences across all source files
|
|
193
|
+
# if count >= 5 AND zero mentions in any .md file → flag
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Flag variables appearing ≥5× in source with zero mentions in any `.md`.
|
|
197
|
+
"Other convention signals" (comment clusters, module structure templates) are explicitly deferred — too vague for deterministic detection.
|
|
198
|
+
|
|
199
|
+
#### Check C — Existence Drift
|
|
200
|
+
|
|
201
|
+
Find module directories that exist in code but are absent from architecture docs.
|
|
202
|
+
This is distinct from Scan 2 (which checks *import violations*) — Scan 6C checks *documentation existence*:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Walk all non-excluded directories
|
|
206
|
+
# For each dir with >= 3 non-hidden, non-.md source files:
|
|
207
|
+
# check if any .roll/domain/*.md contains the directory name
|
|
208
|
+
# if not found → flag as "existence drift"
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
Exclusions: `node_modules/`, `.git/`, `dist/`, `build/`, `.shared/`, `docs/`, `tests/`.
|
|
212
|
+
|
|
213
|
+
Flag directories with ≥3 source files and zero name-match in `.roll/domain/*.md`.
|
|
214
|
+
|
|
215
|
+
#### Dream Log Section
|
|
216
|
+
|
|
217
|
+
Add after `## 文档覆盖度` section:
|
|
218
|
+
|
|
219
|
+
```markdown
|
|
220
|
+
## 文档新鲜度
|
|
221
|
+
- 滞后文档:{N} 个(超过 30 天未更新但绑定了代码文件)
|
|
222
|
+
- 未记录 ENV 变量:{N} 个(出现 ≥5 次但无文档)
|
|
223
|
+
- 架构文档缺失模块:{N} 个(≥3 个源文件的目录未出现在 .roll/domain/)
|
|
224
|
+
{发现内容列表 或 "文档新鲜度良好,无滞后或缺失项。"}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Scan 7 — Test Quality (rubric-driven)
|
|
228
|
+
|
|
229
|
+
Apply the test-quality rubric at [guide/en/testing/quality-rubric.md](../../guide/en/testing/quality-rubric.md)
|
|
230
|
+
(Chinese: [quality-rubric.zh.md](../../guide/zh/testing/quality-rubric.md)) against every file under
|
|
231
|
+
`tests/`. The rubric publishes six anti-pattern categories (❶..❻); each has a
|
|
232
|
+
**Signals** subsection that lists the matching heuristics. Scan 7 is purely a
|
|
233
|
+
mechanical apply-the-rubric step — no new logic.
|
|
234
|
+
|
|
235
|
+
**Per-category signals** — read from the rubric, summarized here:
|
|
236
|
+
|
|
237
|
+
| Marker | Anti-pattern | Cheapest signal |
|
|
238
|
+
|--------|--------------|-----------------|
|
|
239
|
+
| ❶ | Hardcoded business data | Bare numeric / version / pricing literal inside `[[ "$output" == *"..."*` that matches a value also defined in `lib/` |
|
|
240
|
+
| ❷ | Over-mocking real boundaries | `function git() {` / `function gh() {` overrides at the top of a unit test |
|
|
241
|
+
| ❸ | Asserting implementation details | `grep '_internal_helper'` against output; assertions on `.roll/internal/*` paths |
|
|
242
|
+
| ❹ | Fixture order coupling | `setup_file` writes shared mutable state without per-test reset |
|
|
243
|
+
| ❺ | Testing private functions | Test sources a `lib/` file and calls a `_underscore_prefixed` helper directly |
|
|
244
|
+
| ❻ | Asserting framework behavior | References to `$BATS_TEST_NUMBER`, `$BATS_SUITE_NAME` in assertions |
|
|
245
|
+
|
|
246
|
+
**Rate cap — 每轮 ≤ 5 条 test-quality REFACTOR entries**. Same dream cycle may
|
|
247
|
+
emit more than 5 findings; the dream scan must rank by severity (❶ > ❷ > ❸ > ❹ > ❺ > ❻
|
|
248
|
+
and within a class, by occurrence count) and only persist the top 5 to BACKLOG.
|
|
249
|
+
Remaining findings go into the dream log under `## 测试质量` but are not made
|
|
250
|
+
into REFACTOR rows — this prevents the backlog from being drowned in test-debt
|
|
251
|
+
on the first scan after rubric publication.
|
|
252
|
+
|
|
253
|
+
**REFACTOR entry format** — same as other scans, but tagged with category:
|
|
254
|
+
|
|
255
|
+
```markdown
|
|
256
|
+
| REFACTOR-XXX | docs: <one-line description> [test-quality:❶] — flagged by dream YYYY-MM-DD | 📋 Todo |
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The `[test-quality:❶]` (through `❻`) tag is **required** so downstream filtering
|
|
260
|
+
(e.g. "show me all ❶ items still open") is mechanical. The marker character must
|
|
261
|
+
match the rubric exactly.
|
|
262
|
+
|
|
263
|
+
**Optional helper** — `bin/dream-test-quality-scan` is a thin shell script
|
|
264
|
+
maintainers can invoke ad-hoc to dry-run the ❶ detector against a single file
|
|
265
|
+
or directory (see `bin/dream-test-quality-scan --help`). The dream skill itself
|
|
266
|
+
does **not** depend on the helper — Scan 7 is the AI agent applying the rubric.
|
|
267
|
+
The helper just exists so a maintainer (or this skill's smoke test) can confirm
|
|
268
|
+
the ❶ heuristic still finds known instances.
|
|
269
|
+
|
|
270
|
+
#### Dream Log Section (Scan 7)
|
|
271
|
+
|
|
272
|
+
Add after `## 文档新鲜度` section:
|
|
273
|
+
|
|
274
|
+
```markdown
|
|
275
|
+
## 测试质量
|
|
276
|
+
- 本轮发现 {N} 项(写入 BACKLOG 的前 5 项见下;剩余 {M} 项仅记录于本日志)
|
|
277
|
+
- ❶ 硬编码业务数据:{count}
|
|
278
|
+
- ❷ 过度 mock:{count}
|
|
279
|
+
- ❸ 断言实现细节:{count}
|
|
280
|
+
- ❹ Fixture 顺序耦合:{count}
|
|
281
|
+
- ❺ 测私有函数:{count}
|
|
282
|
+
- ❻ 断言框架行为:{count}
|
|
283
|
+
{命中文件列表 或 "未发现可治理的测试反模式。"}
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
## Output
|
|
287
|
+
|
|
288
|
+
### REFACTOR Entry (.roll/backlog.md)
|
|
289
|
+
|
|
290
|
+
For each finding that warrants action, append one row to the `## ♻️ Refactor`
|
|
291
|
+
section of .roll/backlog.md:
|
|
292
|
+
|
|
293
|
+
```markdown
|
|
294
|
+
| REFACTOR-XXX | {one-line description} — flagged by dream {YYYY-MM-DD} | 📋 Todo |
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
`{one-line description}` 写法:一句人话说清楚"什么地方需要改"以及"不改会怎样"。不写函数名、文件路径、技术方案。例:`loop 状态读取逻辑分散在多处,修一处容易遗漏另一处`。
|
|
298
|
+
|
|
299
|
+
**Threshold**: only flag items where the fix would meaningfully reduce
|
|
300
|
+
complexity or prevent future bugs. Ignore cosmetic issues.
|
|
301
|
+
|
|
302
|
+
### Dream Log (.roll/dream/YYYY-MM-DD.md)
|
|
303
|
+
|
|
304
|
+
Always write a log, even when no REFACTOR entries are created. Output uses
|
|
305
|
+
Chinese to align with roll-brief style — easier for the morning reader to scan
|
|
306
|
+
without context switching:
|
|
307
|
+
|
|
308
|
+
```markdown
|
|
309
|
+
# Dream Log {YYYY-MM-DD}
|
|
310
|
+
|
|
311
|
+
## 概要
|
|
312
|
+
- 扫描项:死代码 / 架构漂移 / 裁剪候选 / 新兴模式 / 文档覆盖度 / 文档新鲜度
|
|
313
|
+
- 发现:{N} 项标记,{M} 个 REFACTOR 条目已创建
|
|
314
|
+
|
|
315
|
+
## 死代码
|
|
316
|
+
{发现内容 或 "未发现死代码。"}
|
|
317
|
+
|
|
318
|
+
## 架构漂移
|
|
319
|
+
{发现内容 或 "未发现架构漂移。"}
|
|
320
|
+
|
|
321
|
+
## 裁剪候选
|
|
322
|
+
{发现内容 或 "未发现可裁剪项。"}
|
|
323
|
+
|
|
324
|
+
## 新兴模式
|
|
325
|
+
{发现内容 或 "未发现可提取的重复模式。"}
|
|
326
|
+
|
|
327
|
+
## 文档覆盖度
|
|
328
|
+
{发现内容 或 "文档结构符合规范,无缺口。"}
|
|
329
|
+
|
|
330
|
+
## 文档新鲜度
|
|
331
|
+
- 滞后文档:{N} 个
|
|
332
|
+
- 未记录 ENV 变量:{N} 个
|
|
333
|
+
- 架构文档缺失模块:{N} 个
|
|
334
|
+
{发现内容 或 "文档新鲜度良好,无滞后或缺失项。"}
|
|
335
|
+
|
|
336
|
+
## 创建的 REFACTOR 条目
|
|
337
|
+
{列表 或 "无。"}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Commit
|
|
341
|
+
|
|
342
|
+
扫描完成后立即提交,把 dream 发现纳入 git 历史,便于晨报追溯:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
git add .roll/backlog.md .roll/dream/YYYY-MM-DD.md
|
|
346
|
+
# 有 REFACTOR 条目时:
|
|
347
|
+
git commit -m "chore: dream scan YYYY-MM-DD — {N} REFACTOR entries"
|
|
348
|
+
# 无发现时:
|
|
349
|
+
git commit -m "chore: dream scan YYYY-MM-DD — no findings"
|
|
350
|
+
git push origin main
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
- .roll/backlog.md 和 dream 日志必须在**同一个 commit** 里入库,避免出现"REFACTOR 已加但日志找不到"或反过来的撕裂状态
|
|
354
|
+
- 写文件失败时不要执行 commit;保持工作区干净,由调度器负责重试
|
|
355
|
+
- 仅 `.roll/backlog.md` 和 `.roll/dream/YYYY-MM-DD.md` 入 commit,不要顺带带入其他无关变更
|
|
356
|
+
|
|
357
|
+
## Scheduler Configuration
|
|
358
|
+
|
|
359
|
+
roll-.dream runs **locally** — it reads the local codebase directly.
|
|
360
|
+
|
|
361
|
+
### Local cron (default)
|
|
362
|
+
|
|
363
|
+
Installed automatically via `roll loop on` alongside roll-loop and roll-brief.
|
|
364
|
+
The cron entry is generated using the configured agent — no manual cron editing needed.
|
|
365
|
+
|
|
366
|
+
## Failure Handling
|
|
367
|
+
|
|
368
|
+
If the scan fails partway through:
|
|
369
|
+
|
|
370
|
+
1. Write partial results to `.roll/dream/YYYY-MM-DD.md` with a `## 状态:部分完成` header
|
|
371
|
+
2. Do not write incomplete REFACTOR entries to BACKLOG
|
|
372
|
+
3. Log the error to `~/.shared/roll/dream/error.log`
|
|
373
|
+
|
|
374
|
+
The scheduler (not this skill) is responsible for retry and human notification.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
hidden: true
|
|
3
3
|
name: roll-.echo
|
|
4
|
+
license: MIT
|
|
4
5
|
description: |
|
|
5
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.
|
|
6
7
|
This is a passive skill. Never announce "I'm using roll-.echo." Just do it naturally: restate, confirm, proceed.
|
|
@@ -22,11 +23,13 @@ This skill fires **automatically** when the AI detects unclear intent. It should
|
|
|
22
23
|
- Vague scope: "make it better", "fix this area", "do something about"
|
|
23
24
|
- The intent could reasonably be interpreted in 2+ very different ways
|
|
24
25
|
|
|
25
|
-
|
|
26
|
+
## When Not to Use
|
|
27
|
+
|
|
26
28
|
- Intent is already clear and actionable ("add a login button to the header")
|
|
27
|
-
- User gives a specific command with a skill trigger ("$roll-
|
|
29
|
+
- User gives a specific command with a skill trigger ("$roll-build US-001")
|
|
28
30
|
- User is answering a question you asked (they're clarifying, not initiating)
|
|
29
31
|
- The task is simple enough that misinterpretation risk is negligible
|
|
32
|
+
- User needs targeted Q&A to fill specific gaps (use `$roll-.clarify`)
|
|
30
33
|
|
|
31
34
|
**When in doubt**: If you're 80%+ confident you understand correctly, just execute. Echo is for the 50/50 situations where getting it wrong would waste real effort.
|
|
32
35
|
|
package/skills/roll-.qa/SKILL.md
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
1
|
---
|
|
2
2
|
hidden: true
|
|
3
|
-
name: roll-.qa
|
|
3
|
+
name: roll-.qa
|
|
4
|
+
license: MIT
|
|
5
|
+
allowed-tools: "Read"
|
|
4
6
|
description: QA coverage reference for build skills. Defines test pyramid (unit/E2E/visual/smoke), coverage requirements, and CI gates. Ensures quality assurance across all testing layers.
|
|
5
7
|
---
|
|
6
8
|
|
|
7
9
|
# QA Cover
|
|
8
10
|
|
|
9
|
-
This is a **reference skill** used by `roll-
|
|
11
|
+
This is a **reference skill** used by `roll-build` and `roll-fix` for quality assurance and test coverage.
|
|
10
12
|
|
|
11
13
|
## When to Apply
|
|
12
14
|
|
|
13
15
|
Any product with a user interface (Web, Desktop, Mobile) must follow these testing standards.
|
|
14
16
|
|
|
17
|
+
## When Not to Use
|
|
18
|
+
|
|
19
|
+
- Non-UI backends (APIs, CLI tools, data pipelines) — use project-specific test frameworks
|
|
20
|
+
- Spike code or throwaway prototypes that won't ship
|
|
21
|
+
- Per-commit self-review of diffs (use `$roll-.review`)
|
|
22
|
+
|
|
15
23
|
## Required Testing Levels
|
|
16
24
|
|
|
17
25
|
### 1. Unit Tests (Logic)
|
|
@@ -197,8 +205,54 @@ If project lacks Playwright setup:
|
|
|
197
205
|
4. Run to create baseline
|
|
198
206
|
5. Commit as separate "test infrastructure" change
|
|
199
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
|
+
```
|
|
222
|
+
|
|
223
|
+
### Step 2: Classify Severity
|
|
224
|
+
|
|
225
|
+
| Severity | Signal | Action |
|
|
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 |
|
|
231
|
+
|
|
232
|
+
### Step 3: Create Backlog Entry
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
# For fixable bugs — create FIX entry
|
|
236
|
+
$roll-idea fix "CI: {step} fails — {root cause summary}"
|
|
237
|
+
|
|
238
|
+
# For flaky/environmental issues — create IDEA entry
|
|
239
|
+
$roll-idea idea "CI: investigate flaky {test name}"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Step 4: Execute Fix
|
|
243
|
+
|
|
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
|
+
```
|
|
251
|
+
|
|
252
|
+
All fixes go through `$roll-fix` TCR workflow — test, fix, review, commit, push, CI green.
|
|
253
|
+
|
|
200
254
|
## References
|
|
201
255
|
|
|
202
256
|
- [Playwright Docs](https://playwright.dev/)
|
|
203
257
|
- [Visual Regression Guide](https://playwright.dev/docs/test-snapshots)
|
|
204
|
-
- Example implementation:
|
|
258
|
+
- Example implementation: `<owner>/<repo>/e2e/`
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
hidden: true
|
|
3
|
-
name: roll-.
|
|
3
|
+
name: roll-.review
|
|
4
|
+
license: MIT
|
|
5
|
+
allowed-tools: "Read, Bash(git:*)"
|
|
4
6
|
description: Self code review step in the TCR workflow. Runs after each micro-step is completed and before commit, checking code quality, security, and design issues.
|
|
5
7
|
---
|
|
6
8
|
|
|
@@ -21,9 +23,15 @@ TCR Loop:
|
|
|
21
23
|
|
|
22
24
|
## When Triggered
|
|
23
25
|
|
|
24
|
-
- **Auto-triggered**: After each TCR micro-step in `$roll-
|
|
26
|
+
- **Auto-triggered**: After each TCR micro-step in `$roll-build` / `$roll-fix`
|
|
25
27
|
- **Manual trigger**: When the user wants to review current changes
|
|
26
28
|
|
|
29
|
+
## When Not to Use
|
|
30
|
+
|
|
31
|
+
- Docs-only changes (README, CHANGELOG) with no code diff
|
|
32
|
+
- Test pyramid / coverage standards check (use `$roll-.qa`)
|
|
33
|
+
- Post-deploy production sampling (use `$roll-sentinel`)
|
|
34
|
+
|
|
27
35
|
## Review Scope
|
|
28
36
|
|
|
29
37
|
```bash
|
|
@@ -37,7 +45,9 @@ $roll-.review unstaged
|
|
|
37
45
|
$roll-.review files src/utils.ts
|
|
38
46
|
```
|
|
39
47
|
|
|
40
|
-
## Review Dimensions (
|
|
48
|
+
## Review Dimensions (7 Core Dimensions)
|
|
49
|
+
|
|
50
|
+
Original 6 dimensions plus Reuse (added in REFACTOR-022, simplify three-axis integration):
|
|
41
51
|
|
|
42
52
|
```
|
|
43
53
|
┌─────────────────────────────────────────────────────────┐
|
|
@@ -46,13 +56,42 @@ $roll-.review files src/utils.ts
|
|
|
46
56
|
│ ✅ Correctness - Logic is correct, no bugs │
|
|
47
57
|
│ ✅ Security - No vulnerabilities, input valid. │
|
|
48
58
|
│ ✅ Maintainability - Clear naming, sound structure │
|
|
59
|
+
│ Quality anti-patterns (check each): │
|
|
60
|
+
│ □ Redundant state / cached values that could be │
|
|
61
|
+
│ derived directly │
|
|
62
|
+
│ □ Parameter sprawl — new param vs. restructure │
|
|
63
|
+
│ □ Copy-paste with slight variation (near-dup) │
|
|
64
|
+
│ □ Leaky abstraction — exposes internal details │
|
|
65
|
+
│ □ Stringly-typed — raw string where constant │
|
|
66
|
+
│ / enum exists │
|
|
67
|
+
│ □ Unnecessary JSX nesting (no layout value) │
|
|
68
|
+
│ □ Nested conditionals ≥3 deep (ternary chains, │
|
|
69
|
+
│ nested if/else) — flatten with early return │
|
|
70
|
+
│ □ Unnecessary comments explaining WHAT │
|
|
49
71
|
│ ✅ Performance - No performance pitfalls │
|
|
72
|
+
│ Efficiency anti-patterns (check each): │
|
|
73
|
+
│ □ Redundant computation / repeated file read / │
|
|
74
|
+
│ duplicate API call / N+1 pattern │
|
|
75
|
+
│ □ Missed concurrency — independent ops sequential │
|
|
76
|
+
│ □ Hot-path bloat — blocking work in startup or │
|
|
77
|
+
│ per-request path │
|
|
78
|
+
│ □ Loop no-op updates — missing change-detection │
|
|
79
|
+
│ guard │
|
|
80
|
+
│ □ TOCTOU existence pre-check — operate directly + │
|
|
81
|
+
│ handle error instead │
|
|
82
|
+
│ □ Memory — unbounded structures / missing cleanup │
|
|
83
|
+
│ □ Overly broad op — reading full file for a slice │
|
|
50
84
|
│ ✅ Testability - Easy to test, edge cases covered │
|
|
51
85
|
│ ✅ Scope - Focused on current task, no │
|
|
52
86
|
│ unrelated changes │
|
|
87
|
+
│ ✅ Reuse - No new code duplicating existing │
|
|
88
|
+
│ □ New function duplicates existing utility/helper │
|
|
89
|
+
│ □ Inline logic replaceable by existing tool │
|
|
53
90
|
└─────────────────────────────────────────────────────────┘
|
|
54
91
|
```
|
|
55
92
|
|
|
93
|
+
**Usage in TCR**: Each micro-step review is a lightweight self-check against this checklist — no sub-agents, zero extra token cost. The three-axis deep review with parallel agents runs once per Story in `$roll-build` Phase 7.
|
|
94
|
+
|
|
56
95
|
## Severity Levels and Decisions
|
|
57
96
|
|
|
58
97
|
| Level | Definition | Decision |
|