@seanyao/roll 4.630.2 → 4.702.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 +64 -0
- package/README.md +65 -56
- package/conventions/global/AGENTS.md +8 -7
- package/dist/roll.mjs +12909 -8532
- package/docs/INDEX.md +32 -0
- package/docs/architecture.md +444 -0
- package/docs/difftest-freeze-paradigm.md +113 -0
- package/docs/live-console.md +203 -0
- package/docs/manifesto.md +65 -0
- package/docs/migration/role-taxonomy-v4.md +60 -0
- package/docs/verification.md +83 -0
- package/guide/INDEX.md +86 -0
- package/guide/assets/layouts/cards-2.png +0 -0
- package/guide/assets/layouts/cards-3.png +0 -0
- package/guide/assets/layouts/cards-4.png +0 -0
- package/guide/assets/layouts/compare.png +0 -0
- package/guide/assets/layouts/highlight.png +0 -0
- package/guide/assets/layouts/pipeline.png +0 -0
- package/guide/assets/layouts/plain.png +0 -0
- package/guide/assets/layouts/quote.png +0 -0
- package/guide/assets/layouts/timeline.png +0 -0
- package/guide/en/acceptance-evidence.md +231 -0
- package/guide/en/ai-agents.md +185 -0
- package/guide/en/backlog-github-sync.md +108 -0
- package/guide/en/changelog.md +66 -0
- package/guide/en/configuration.md +112 -0
- package/guide/en/consistency.md +58 -0
- package/guide/en/conventions.md +113 -0
- package/guide/en/dream.md +121 -0
- package/guide/en/faq.md +855 -0
- package/guide/en/feedback.md +31 -0
- package/guide/en/getting-started.md +103 -0
- package/guide/en/installation.md +86 -0
- package/guide/en/legacy-onboarding.md +195 -0
- package/guide/en/loop-data-layout.md +256 -0
- package/guide/en/loop-driven-architecture.md +186 -0
- package/guide/en/loop.md +1324 -0
- package/guide/en/methodology.md +715 -0
- package/guide/en/migration-2.0.md +154 -0
- package/guide/en/overview.md +190 -0
- package/guide/en/pairing.md +151 -0
- package/guide/en/patterns/README.md +76 -0
- package/guide/en/patterns/graft-pattern.md +110 -0
- package/guide/en/patterns/replant-pattern.md +114 -0
- package/guide/en/patterns/seed-pattern.md +132 -0
- package/guide/en/peer.md +71 -0
- package/guide/en/pr-review.md +62 -0
- package/guide/en/practices/engineering-common-sense.md +395 -0
- package/guide/en/pricing.md +116 -0
- package/guide/en/project-setup.md +126 -0
- package/guide/en/roll-doc-audit.md +98 -0
- package/guide/en/skills.md +206 -0
- package/guide/en/test-isolation.md +51 -0
- package/guide/en/testing/quality-rubric.md +340 -0
- package/guide/en/testing.md +123 -0
- package/guide/en/tools.md +173 -0
- package/guide/skills.md +30 -0
- package/guide/zh/acceptance-evidence.md +194 -0
- package/guide/zh/ai-agents.md +170 -0
- package/guide/zh/backlog-github-sync.md +105 -0
- package/guide/zh/changelog.md +57 -0
- package/guide/zh/configuration.md +99 -0
- package/guide/zh/consistency.md +48 -0
- package/guide/zh/conventions.md +96 -0
- package/guide/zh/dream.md +97 -0
- package/guide/zh/faq.md +773 -0
- package/guide/zh/feedback.md +30 -0
- package/guide/zh/getting-started.md +96 -0
- package/guide/zh/installation.md +83 -0
- package/guide/zh/legacy-onboarding.md +192 -0
- package/guide/zh/loop-data-layout.md +236 -0
- package/guide/zh/loop-driven-architecture.md +186 -0
- package/guide/zh/loop.md +1124 -0
- package/guide/zh/methodology.md +702 -0
- package/guide/zh/migration-2.0.md +154 -0
- package/guide/zh/overview.md +186 -0
- package/guide/zh/pairing.md +117 -0
- package/guide/zh/patterns/README.md +74 -0
- package/guide/zh/patterns/graft-pattern.md +108 -0
- package/guide/zh/patterns/replant-pattern.md +112 -0
- package/guide/zh/patterns/seed-pattern.md +130 -0
- package/guide/zh/peer.md +63 -0
- package/guide/zh/pr-review.md +54 -0
- package/guide/zh/practices/engineering-common-sense.md +393 -0
- package/guide/zh/pricing.md +97 -0
- package/guide/zh/project-setup.md +114 -0
- package/guide/zh/roll-doc-audit.md +90 -0
- package/guide/zh/skills.md +191 -0
- package/guide/zh/test-isolation.md +46 -0
- package/guide/zh/testing/quality-rubric.md +284 -0
- package/guide/zh/testing.md +116 -0
- package/guide/zh/tools.md +173 -0
- package/package.json +4 -1
- package/skills/README.md +1 -0
- package/skills/roll-.qa/SKILL.md +1 -1
- package/skills/roll-.review/SKILL.md +1 -1
- package/skills/roll-build/SKILL.md +1 -1
- package/skills/roll-build/references/full-contract.md +16 -13
- package/skills/roll-design/SKILL.md +3 -3
- package/skills/roll-design/references/full-contract.md +17 -13
- package/skills/roll-fix/SKILL.md +1 -1
- package/skills/roll-fix/references/full-contract.md +13 -10
- package/skills/roll-peer/SKILL.md +1 -1
- package/skills/roll-prime/SKILL.md +77 -0
- package/skills/roll-prime/references/explorer-annex.md +39 -0
- package/skills/roll-prime/references/supervisor-prompt.md +165 -0
- package/skills/route-cases/skills.json +10 -0
- package/template/AGENTS.md +3 -1
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Roll — Configuration
|
|
2
|
+
|
|
3
|
+
Roll resolves three environment variables at startup. Override any of them
|
|
4
|
+
before running `roll` to change where it looks for state, skills, and
|
|
5
|
+
shared conventions.
|
|
6
|
+
|
|
7
|
+
## Environment Variables
|
|
8
|
+
|
|
9
|
+
| Variable | Default | Purpose |
|
|
10
|
+
|----------|---------|---------|
|
|
11
|
+
| `ROLL_HOME` | `~/.roll` | Per-user state root. Holds `config.yaml`, installed `skills/`, synced `conventions/`. |
|
|
12
|
+
| `ROLL_CONFIG` | `$ROLL_HOME/config.yaml` | Editor, loop/dream/brief schedule hours, and per-tool (`ai_*`) config. Agent routing is **not** here — it lives in per-project `.roll/agents.yaml` (see [ai-agents.md](ai-agents.md)). |
|
|
13
|
+
| `ROLL_GLOBAL` | `$ROLL_HOME/conventions/global` | Global convention files (`AGENTS.md`, `CLAUDE.md`, etc.) synced into AI tool directories. |
|
|
14
|
+
| `ROLL_LANG` | unset | Per-process language override for CLI/help/HTML user surfaces. Supported values are `en` and `zh`; when unset, Roll uses the saved config preference or locale detection. |
|
|
15
|
+
| `ROLL_HEARTBEAT_TIMEOUT` | `1800` (seconds) | How long without a heartbeat write before the loop runner treats an inner cycle as orphan and heals state. Raise it if your cycles can legitimately stay quiet longer than 30 minutes. |
|
|
16
|
+
| `ROLL_LOOP_FORCE` | unset | When set to any non-empty value, `roll loop` bypasses the active-window check and the pause file. `roll loop now` and `roll loop test` set this internally; export it manually only when you want a cron-scheduled run to ignore quiet hours. |
|
|
17
|
+
| `ROLL_LOOP_NO_HEAL` | `0` | Set to `1` to disable post-build CI self-heal and restore fail-fast behaviour. Useful for debugging or when you want to cap autonomous spend per cycle. |
|
|
18
|
+
| `ROLL_LOOP_HEAL_MAX` | `2` | Maximum number of CI self-heal attempts per story after the build commits land. Raise it for noisy CI environments; lower it to fail faster. |
|
|
19
|
+
| `ROLL_PR_MERGE_TIMEOUT` | `600` (seconds) | **Deprecated (US-AUTO-044).** The main loop no longer waits for merge, so this is unused; PR merging is now handled asynchronously by the dedicated PR Loop. |
|
|
20
|
+
| `ROLL_LOOP_NO_POPUP` | unset | When set to any non-empty value, the runner does **not** auto-spawn a macOS Terminal.app window running `tmux attach`. For tests and headless batch runs — the popup outlives the killed tmux session and clutters the desktop. |
|
|
21
|
+
| `ROLL_LOOP_GC_RETENTION_DAYS` | `30` | Override the GC retention period for `roll loop gc`. Takes precedence over `loop_gc.retention_days` in `.roll/local.yaml`. |
|
|
22
|
+
| `ROLL_FEED_BUDGET_BYTES` | `16384` | Byte budget for the context feed handed to the inner agent each cycle. Set it to a positive integer to dial the feed to the inner agent's capacity; non-numeric or non-positive values fall back to the default. |
|
|
23
|
+
| `ROLL_AGENT_NUDGE` | `1` (on) | Compatibility agent preference switch. The scoped role binding is the primary selector; set this to `0` (or `off`/`false`/`no`) to disable legacy history preference. |
|
|
24
|
+
| `ROLL_RUN_DIR` | unset | Canonical acceptance-evidence run directory. The loop runner sets it before agent spawn; `roll attest --run-dir` and standalone `roll attest` can also consume it. |
|
|
25
|
+
| `ROLL_EVIDENCE_DIR` | derived from `ROLL_RUN_DIR` | Directory for raw command/test artifacts inside the open evidence frame. Normally set by the runner or `roll test`, not by hand. |
|
|
26
|
+
| `ROLL_SCREENSHOTS_DIR` | derived from `ROLL_RUN_DIR` | Directory for visual proof inside the open evidence frame. Normally set by the runner or capture lane, not by hand. |
|
|
27
|
+
|
|
28
|
+
`ROLL_CONFIG` and `ROLL_GLOBAL` derive from `ROLL_HOME`, so usually you only
|
|
29
|
+
need to override `ROLL_HOME` to relocate everything together.
|
|
30
|
+
|
|
31
|
+
## Common Overrides
|
|
32
|
+
|
|
33
|
+
Pin roll's state to a project-local directory (useful for CI, tests, or
|
|
34
|
+
isolated experimentation):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
export ROLL_HOME="$PWD/.roll-sandbox"
|
|
38
|
+
roll setup
|
|
39
|
+
roll loop now
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Run roll against an alternate convention set without touching `~/.roll`:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
ROLL_GLOBAL=/path/to/team-conventions roll init
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Point `ROLL_CONFIG` at a one-off config file to test changes:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
ROLL_CONFIG=/tmp/test-config.yaml roll status
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Language Selection
|
|
55
|
+
|
|
56
|
+
Language has two controls:
|
|
57
|
+
|
|
58
|
+
- `ROLL_LANG=en|zh` overrides the language for the current process and wins over
|
|
59
|
+
saved config.
|
|
60
|
+
- `roll config lang en|zh` saves the preference in Roll config;
|
|
61
|
+
`roll config lang --reset` clears it so locale detection applies again.
|
|
62
|
+
|
|
63
|
+
`roll help --lang en|zh <topic>` is a one-command override for help and guide
|
|
64
|
+
reads. `roll doctor language` audits active docs, conventions, skills, and
|
|
65
|
+
generated surfaces for mixed-language drift. The expected CLI language snapshots
|
|
66
|
+
are maintained in `packages/cli/test/cli-language-surface.test.ts` and
|
|
67
|
+
`packages/cli/test/__snapshots__/cli-language-surface.test.ts.snap`; the audit
|
|
68
|
+
surface is covered by `packages/cli/test/doctor-language.test.ts`.
|
|
69
|
+
|
|
70
|
+
User-facing surfaces still render one visible language at a time. Agent
|
|
71
|
+
contracts, code, git metadata, and stable schema keys remain English.
|
|
72
|
+
Owner-facing conversation follows the language the owner uses in the current
|
|
73
|
+
task.
|
|
74
|
+
|
|
75
|
+
## Project Policy
|
|
76
|
+
|
|
77
|
+
Project-local safety policy lives in `.roll/policy.yaml`. The acceptance
|
|
78
|
+
evidence gate defaults to `hard`: a delivered story with ACs needs a fresh,
|
|
79
|
+
contentful attest report before it can be marked `✅ Done`.
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
loop_safety:
|
|
83
|
+
attest_gate: hard
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Use `attest_gate: soft` only for an explicit migration window. Soft mode keeps
|
|
87
|
+
the audit trail and alert, but it does not block the delivery cycle.
|
|
88
|
+
|
|
89
|
+
## Verifying
|
|
90
|
+
|
|
91
|
+
`roll status` prints the resolved paths so you can confirm overrides took
|
|
92
|
+
effect. Invoke the `roll-doctor` skill (`$roll-doctor`) to diagnose
|
|
93
|
+
directory structure issues under the resolved `ROLL_HOME`.
|
|
94
|
+
|
|
95
|
+
## Agent Installation
|
|
96
|
+
|
|
97
|
+
Install the agent CLI, then declare or bind it through the scoped agent files:
|
|
98
|
+
`~/.roll/agents.yaml` for Machine Scope and `.roll/agents.yaml` for Project
|
|
99
|
+
Scope. For example:
|
|
100
|
+
|
|
101
|
+
- Codex CLI: `npm install -g @openai/codex`
|
|
102
|
+
- Antigravity CLI: `npm install -g @antigravity/agy`
|
|
103
|
+
|
|
104
|
+
Run `roll agent` to inspect the effective scopes, or `roll agent migrate
|
|
105
|
+
--dry-run` to convert legacy agent config. See [ai-agents.md](ai-agents.md) for
|
|
106
|
+
the full model and supported agent list.
|
|
107
|
+
|
|
108
|
+
## See Also
|
|
109
|
+
|
|
110
|
+
- [overview.md](overview.md) — three-layer model, BACKLOG priority
|
|
111
|
+
- [loop.md](loop.md) — `roll loop` subcommands
|
|
112
|
+
- [ai-agents.md](ai-agents.md) — supported AI agents
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Consistency — the release gate inside `roll release`
|
|
2
|
+
|
|
3
|
+
Seven dimensions are continuously reconciled against truth anchors. A backlog
|
|
4
|
+
`✅ Done` row is a claim; merge evidence on `main`, acceptance reports, terminal
|
|
5
|
+
cycle events, and release-gate events are the facts. The dimensions are:
|
|
6
|
+
① code ↔ backlog claims · ② cards (every live backlog row owns
|
|
7
|
+
`features/<epic>/<ID>/spec.md`; evidence links never dangle; card-era delivered
|
|
8
|
+
stories with ACs own a `latest/<ID>-report.html`; pre-card-era Done rows are
|
|
9
|
+
counted, not failed) · ③ docs (changelog / features / guide / README / --help)
|
|
10
|
+
· ④ tests · ⑤ locale parity (guide en↔zh + i18n keys) · ⑥ site ·
|
|
11
|
+
⑦ truth-live (`ensureDeliveriesFresh` + `queryStoryDelivery` must prove each
|
|
12
|
+
release-delta story is actually delivered, with PR refs matching the Done row
|
|
13
|
+
when present).
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
roll release # the ONE release flow — the gate runs inside it
|
|
17
|
+
roll release --dry-run # preview the plan; nothing mutates
|
|
18
|
+
roll release --gate-check # machine entry (CI uses it); exit 0 = all pass
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## The release gate
|
|
22
|
+
|
|
23
|
+
`roll release` runs the **consistency gate twice in the same place: before
|
|
24
|
+
anything irreversible.** Locally, the gate runs on the release branch — after
|
|
25
|
+
the version bump and changelog fold are committed, but **before** the PR is
|
|
26
|
+
opened or merged. A failing dimension aborts the release while it is still just
|
|
27
|
+
a local branch: the bump+changelog never reach `main`, so there is no
|
|
28
|
+
merged-but-untagged half-product. Remotely, every `v*` tag re-runs the same gate
|
|
29
|
+
in `release.yml` before the GitHub Release is created. Shipping with a known
|
|
30
|
+
drift requires fixing the drift — not skipping the gate.
|
|
31
|
+
|
|
32
|
+
`main` stays PR-protected, so the release opens a PR even for itself. It then
|
|
33
|
+
drives the merge through GitHub-native **auto-merge** (`gh pr merge --auto
|
|
34
|
+
--squash`) rather than waiting on a background lane: the merge completes when CI
|
|
35
|
+
goes green, even if you close the terminal. While it waits, the release prints a
|
|
36
|
+
progress line per poll and nudges CI (an empty commit) if a fresh PR's checks
|
|
37
|
+
never schedule. This needs **"Allow auto-merge"** enabled on the repo (Settings
|
|
38
|
+
→ General → Pull Requests); without it the release stops with an honest error
|
|
39
|
+
asking you to enable the setting or merge the PR manually — never a silent hang.
|
|
40
|
+
|
|
41
|
+
The acceptance-evidence gate is `hard` by default. `loop_safety.attest_gate: soft`
|
|
42
|
+
is an explicit project policy for migration windows; consistency still reports
|
|
43
|
+
missing or dangling evidence so the gap cannot disappear silently.
|
|
44
|
+
|
|
45
|
+
The truth-live dimension is the anti-false-Done guard. It first rebuilds the
|
|
46
|
+
delivery projection from `runs.jsonl` plus first-parent `main` merge commits,
|
|
47
|
+
then calls `queryStoryDelivery()` for every story id found in the release delta.
|
|
48
|
+
Backlog markdown is only the human claim; `deliveries.jsonl` is a rebuildable
|
|
49
|
+
cache; git merges and run events are the facts.
|
|
50
|
+
|
|
51
|
+
## Doc alignment boundary
|
|
52
|
+
|
|
53
|
+
Registry drift is already a hard red line: if the command registry, README,
|
|
54
|
+
guide, or `--help` disagree, the FIX-242 guard fails consistency and release.
|
|
55
|
+
The `doc-gap` signal in `roll attest` is shadow-only. It warns when a delivery
|
|
56
|
+
diff changes user-visible command or output-copy files without a README/docs/guide/site
|
|
57
|
+
touch in the same diff, but it does not change the report exit code or Gate
|
|
58
|
+
verdict yet.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
# Roll — Conventions & AGENTS.md
|
|
2
|
+
|
|
3
|
+
Roll's convention system gives every AI agent the same shared understanding of
|
|
4
|
+
your project — its domain, coding standards, and navigation pointers.
|
|
5
|
+
|
|
6
|
+
## AGENTS.md
|
|
7
|
+
|
|
8
|
+
`AGENTS.md` is the primary convention file. It defines:
|
|
9
|
+
|
|
10
|
+
- **Domain model**: bounded contexts, aggregates, key entities
|
|
11
|
+
- **Coding standards**: language idioms, naming, forbidden patterns
|
|
12
|
+
- **Scope rules**: which files an agent is allowed to touch
|
|
13
|
+
- **Where to Look**: named pointers to key docs and directories
|
|
14
|
+
- **Goal-Driven Execution**: instructions for agents to define verifiable goals before acting
|
|
15
|
+
|
|
16
|
+
Roll writes an `AGENTS.md` skeleton during `roll init`. You fill in the domain
|
|
17
|
+
model and standards that are specific to your project.
|
|
18
|
+
|
|
19
|
+
## Goal-Driven Execution Rule
|
|
20
|
+
|
|
21
|
+
Every agent must define a verifiable goal before starting work:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
Verifiable Goal: <one sentence that can be confirmed true or false>
|
|
25
|
+
Success Criteria: <measurable outcomes>
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
This prevents vague execution ("refactor the auth module") and forces the agent
|
|
29
|
+
to state what "done" looks like. Roll's skills enforce this at the start of each
|
|
30
|
+
story.
|
|
31
|
+
|
|
32
|
+
## Where to Look
|
|
33
|
+
|
|
34
|
+
The `AGENTS.md` navigation section maps concept names to file paths. Roll 2.0
|
|
35
|
+
consolidates everything Roll touches under `.roll/`, so navigation is anchored
|
|
36
|
+
there:
|
|
37
|
+
|
|
38
|
+
```markdown
|
|
39
|
+
## Where to Look
|
|
40
|
+
|
|
41
|
+
| Concept | Location |
|
|
42
|
+
|---------|----------|
|
|
43
|
+
| Backlog index | `.roll/backlog.md` |
|
|
44
|
+
| Feature specs | `.roll/features/<name>.md` |
|
|
45
|
+
| Domain model | `.roll/domain/context-map.md` |
|
|
46
|
+
| Architecture decisions | `.roll/decisions/` |
|
|
47
|
+
| Autonomous output (briefs, dream) | `.roll/briefs/`, `.roll/dream/` |
|
|
48
|
+
| User guides | `guide/en/`, `guide/zh/` |
|
|
49
|
+
| Test helpers | `tests/unit/helpers.bash` |
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
The contract: `AGENTS.md` lives at the project root (every AI client reads it
|
|
53
|
+
first); everything it points into lives under `.roll/`. The root stays clean,
|
|
54
|
+
and the navigation table is the single map agents need.
|
|
55
|
+
|
|
56
|
+
`$roll-design` maintains this table as new docs and directories are added.
|
|
57
|
+
Any agent entering the project can navigate to authoritative sources without
|
|
58
|
+
scanning the whole tree.
|
|
59
|
+
|
|
60
|
+
## Language Surface Policy
|
|
61
|
+
|
|
62
|
+
Roll separates the contract language from rendered user language:
|
|
63
|
+
|
|
64
|
+
- Agent contracts, TypeScript code, git metadata, schemas, and stable keys stay
|
|
65
|
+
in English.
|
|
66
|
+
- Owner conversation follows the owner's language in the current task.
|
|
67
|
+
- CLI output, help, docs, and HTML pages render one visible language at a time,
|
|
68
|
+
selected by `ROLL_LANG`, `roll config lang`, `roll help --lang`, or locale
|
|
69
|
+
detection.
|
|
70
|
+
|
|
71
|
+
Write user documentation in the matching locale file under `guide/en/` or
|
|
72
|
+
`guide/zh/`. For CLI and generated HTML, add or update i18n catalog entries
|
|
73
|
+
instead of putting translation pairs into one output string. Run
|
|
74
|
+
`roll doctor language` before release when conventions, help, docs, or generated
|
|
75
|
+
surfaces changed. The policy is covered by
|
|
76
|
+
`packages/cli/test/cli-language-surface.test.ts`,
|
|
77
|
+
`packages/cli/test/__snapshots__/cli-language-surface.test.ts.snap`, and
|
|
78
|
+
`packages/cli/test/doctor-language.test.ts`.
|
|
79
|
+
|
|
80
|
+
## Existing Codebases: `$roll-onboard` and `$roll-doc-audit`
|
|
81
|
+
|
|
82
|
+
For an existing codebase with no `.roll/` yet, the entry point is
|
|
83
|
+
`$roll-onboard` (the **graft** adoption pattern). It scans the code, asks a
|
|
84
|
+
focused set of cognition / scope / privacy questions, and writes
|
|
85
|
+
`.roll/onboard-plan.yaml` as a reviewable contract. After review,
|
|
86
|
+
`roll init --apply` prints the planned operation checkpoint and waits for
|
|
87
|
+
confirmation before turning that plan into the on-disk structure; non-interactive
|
|
88
|
+
automation must use `roll init --apply --auto` — see
|
|
89
|
+
[legacy-onboarding.md](legacy-onboarding.md) and
|
|
90
|
+
[patterns/](patterns/README.md).
|
|
91
|
+
|
|
92
|
+
For projects that already have `AGENTS.md` but scattered or stale docs:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
$roll-doc-audit
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`roll-doc-audit` checks README, guides, site pages, CLI help, and docs against
|
|
99
|
+
implemented behavior. When inventory is requested, it infers domain structure
|
|
100
|
+
from existing code, refreshes the `Where to Look` navigation table, and flags
|
|
101
|
+
documentation gaps (missing architecture docs, undocumented public APIs) for
|
|
102
|
+
`$roll-build` to fill.
|
|
103
|
+
|
|
104
|
+
## Global Conventions
|
|
105
|
+
|
|
106
|
+
Files in `~/.roll/conventions/global/` are synced into every AI tool's config
|
|
107
|
+
directory by `roll setup` and `roll sync`. Changes to global conventions
|
|
108
|
+
propagate to all projects on your next sync.
|
|
109
|
+
|
|
110
|
+
## See Also
|
|
111
|
+
|
|
112
|
+
- [project-setup.md](project-setup.md) — `roll init` creates AGENTS.md
|
|
113
|
+
- [overview.md](overview.md) — three-layer model (human / BACKLOG / autonomous)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# roll-.dream — Nightly Code Health Scanner
|
|
2
|
+
|
|
3
|
+
`roll-.dream` is a nightly skill that scans the codebase for architectural friction,
|
|
4
|
+
dead code, and technical debt. It runs automatically at 3am (via launchd, installed by
|
|
5
|
+
`roll loop on`) and deposits `REFACTOR-NNN` entries into `BACKLOG.md` for loop to execute.
|
|
6
|
+
|
|
7
|
+
The schedule fires a self-contained v3 runner whose heart is `roll dream run-once`
|
|
8
|
+
(the TS command that resolves the `roll-.dream` skill and spawns the agent in place) —
|
|
9
|
+
the same shape as the loop runner, with no bash-engine dependency.
|
|
10
|
+
|
|
11
|
+
## What Dream Does
|
|
12
|
+
|
|
13
|
+
Dream runs one full scan per night and produces these outputs:
|
|
14
|
+
|
|
15
|
+
1. **`.roll/dream/YYYY-MM-DD.md`** — detailed report in Chinese (one file per night)
|
|
16
|
+
2. **BACKLOG.md entries** — actionable `REFACTOR-NNN` items appended to the `## ♻️ Refactor` table
|
|
17
|
+
3. **`.roll/dream/structure-scan.json`** — deterministic TypeScript/AST evidence for code-structure findings
|
|
18
|
+
|
|
19
|
+
The report covers:
|
|
20
|
+
|
|
21
|
+
- Dead code and unused functions, seeded by TypeScript Language Service references
|
|
22
|
+
- Duplicated logic across modules, seeded by normalized AST fingerprints
|
|
23
|
+
- Module boundary violations (one concern leaking into another)
|
|
24
|
+
- Missing tests for shipped behavior
|
|
25
|
+
- Documentation coverage gaps (missing EN/ZH guides, stale references)
|
|
26
|
+
|
|
27
|
+
Code-structure findings now come from the deterministic pre-scan first: dead exports,
|
|
28
|
+
unreachable branches, duplicate AST shapes, single-implementation abstractions, and
|
|
29
|
+
undocumented env variables are written to `structure-scan.json` before the agent runs.
|
|
30
|
+
The agent consumes that artifact instead of re-running grep-style heuristics. Document
|
|
31
|
+
coverage, freshness, and existence-drift checks stay in the existing Dream flow.
|
|
32
|
+
|
|
33
|
+
## How to Read Dream Logs
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# See last 3 nights
|
|
37
|
+
ls -lt .roll/dream/ | head -4
|
|
38
|
+
|
|
39
|
+
# Read latest report
|
|
40
|
+
cat .roll/dream/$(ls -1t .roll/dream/ | head -1)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Each report section ends with a priority classification:
|
|
44
|
+
|
|
45
|
+
- **P0** — blocks other work, should be addressed this sprint
|
|
46
|
+
- **P1** — significant friction, address within 2 weeks
|
|
47
|
+
- **P2** — low severity, address when convenient
|
|
48
|
+
|
|
49
|
+
## REFACTOR Item Generation
|
|
50
|
+
|
|
51
|
+
When dream finds a concrete, actionable issue it appends a row to BACKLOG.md:
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
| REFACTOR-005 | Extract _for_each_ai_tool() — 4 duplicate iteration loops | 📋 Todo |
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Loop picks these up at normal priority (after FIX-XXX, alongside US-XXX).
|
|
58
|
+
|
|
59
|
+
Dream does **not** generate REFACTOR entries for:
|
|
60
|
+
- Issues that would take >1 day to fix (escalates as IDEA instead)
|
|
61
|
+
- Purely stylistic preferences
|
|
62
|
+
- Issues already in BACKLOG as US or FIX items
|
|
63
|
+
|
|
64
|
+
## Schedule Configuration
|
|
65
|
+
|
|
66
|
+
Dream runs at 3am by default. The recommended way to change the time is the
|
|
67
|
+
`roll config dream-time` facade — it writes both keys at once, no hand-editing yaml:
|
|
68
|
+
推荐用 `roll config dream-time` 改时间 —— 一条命令同时写两个 key,免手工编辑 yaml:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
roll config dream-time 03:20 # sets loop_dream_hour + loop_dream_minute
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`roll config` writes to the project's `.roll/local.yaml` by default (`--project`);
|
|
75
|
+
pass `--global` to write `~/.roll/config.yaml` instead:
|
|
76
|
+
`roll config` 默认写项目的 `.roll/local.yaml`(`--project`);加 `--global` 改写 `~/.roll/config.yaml`:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
roll config loop_dream_hour 3 # set a single key, project scope
|
|
80
|
+
roll config loop_dream_hour 3 --global # set a single key, global scope
|
|
81
|
+
roll config loop_dream_hour # print current value + source
|
|
82
|
+
roll config --list # list all loop/dream/brief schedule keys
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
The underlying keys (resolved here as `.roll/local.yaml`):
|
|
86
|
+
底层 key(这里以 `.roll/local.yaml` 为例):
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
loop_dream_hour: 3 # 0-23, default 3
|
|
90
|
+
loop_dream_minute: 12 # 0-59, omit to auto-derive
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Changing the time writes config only; apply the new schedule by re-running
|
|
94
|
+
`roll loop on` (a config write no longer remounts launchd — US-PORT-006).
|
|
95
|
+
`roll loop on` installs the dream plist alongside the loop and pr plists.
|
|
96
|
+
改完时间只写配置;用 `roll loop on` 重挂应用新调度(config 写入不再自动重挂
|
|
97
|
+
launchd —— US-PORT-006)。`roll loop on` 会把 dream plist 和 loop、pr plist 一起安装。
|
|
98
|
+
All three services are managed together:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
roll loop on # install loop + pr + dream
|
|
102
|
+
roll loop off # boot out loop + pr + dream
|
|
103
|
+
roll loop status # shows all three service states
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Manual Run
|
|
107
|
+
|
|
108
|
+
To run a dream scan immediately (without waiting for the scheduled 3am run):
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
# v3-native — same heart the nightly runner uses
|
|
112
|
+
roll dream run-once
|
|
113
|
+
|
|
114
|
+
# Or drive the skill via Claude Code directly
|
|
115
|
+
$roll-.dream
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
Dream always writes to today's date file and always appends to BACKLOG.md —
|
|
119
|
+
running it twice in one day appends a second pass (safe but redundant).
|
|
120
|
+
Each run also refreshes `.roll/dream/structure-scan.json`; inspect that file when you
|
|
121
|
+
need machine-readable evidence behind code-structure REFACTOR rows.
|