@c-d-cc/reap 0.10.3 → 0.11.0
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/README.ja.md +28 -6
- package/README.ko.md +28 -6
- package/README.md +20 -4
- package/README.zh-CN.md +28 -6
- package/dist/cli.js +4644 -1307
- package/dist/templates/artifacts/01-objective.md +1 -0
- package/dist/templates/artifacts/02-planning.md +1 -0
- package/dist/templates/artifacts/03-implementation.md +1 -0
- package/dist/templates/artifacts/04-validation.md +1 -0
- package/dist/templates/artifacts/05-completion.md +1 -0
- package/dist/templates/artifacts/merge/01-detect.md +1 -0
- package/dist/templates/artifacts/merge/02-mate.md +1 -0
- package/dist/templates/artifacts/merge/03-merge.md +1 -0
- package/dist/templates/artifacts/merge/04-sync.md +1 -0
- package/dist/templates/artifacts/merge/05-validation.md +1 -0
- package/dist/templates/artifacts/merge/06-completion.md +1 -0
- package/dist/templates/commands/reap.abort.md +1 -69
- package/dist/templates/commands/reap.back.md +1 -52
- package/dist/templates/commands/reap.completion.md +1 -190
- package/dist/templates/commands/reap.evolve.md +1 -62
- package/dist/templates/commands/reap.help.md +1 -90
- package/dist/templates/commands/reap.implementation.md +1 -105
- package/dist/templates/commands/reap.merge.completion.md +1 -55
- package/dist/templates/commands/reap.merge.detect.md +1 -23
- package/dist/templates/commands/reap.merge.evolve.md +1 -37
- package/dist/templates/commands/reap.merge.mate.md +1 -30
- package/dist/templates/commands/reap.merge.md +1 -43
- package/dist/templates/commands/reap.merge.merge.md +1 -25
- package/dist/templates/commands/reap.merge.start.md +1 -25
- package/dist/templates/commands/reap.merge.sync.md +1 -35
- package/dist/templates/commands/reap.merge.validation.md +1 -29
- package/dist/templates/commands/reap.next.md +1 -32
- package/dist/templates/commands/reap.objective.md +1 -259
- package/dist/templates/commands/reap.planning.md +1 -104
- package/dist/templates/commands/reap.pull.md +1 -49
- package/dist/templates/commands/reap.push.md +1 -14
- package/dist/templates/commands/reap.report.md +1 -123
- package/dist/templates/commands/reap.start.md +1 -48
- package/dist/templates/commands/reap.status.md +1 -76
- package/dist/templates/commands/reap.sync.environment.md +1 -80
- package/dist/templates/commands/reap.sync.genome.md +1 -105
- package/dist/templates/commands/reap.sync.md +1 -13
- package/dist/templates/commands/reap.update.md +1 -40
- package/dist/templates/commands/reap.validation.md +1 -88
- package/dist/templates/hooks/reap-guide.md +1 -0
- package/package.json +1 -1
|
@@ -2,58 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Completion — Finalize the merge generation with archiving"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Finalize the merge generation after validation passes.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: completion
|
|
11
|
-
- Verify `05-validation.md` exists
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Write `06-completion.md` with:
|
|
16
|
-
- Summary of what was merged
|
|
17
|
-
- Genome changes applied
|
|
18
|
-
- Lessons learned
|
|
19
|
-
|
|
20
|
-
### Hook Execution + Archiving + Commit
|
|
21
|
-
|
|
22
|
-
**This phase handles hook execution, archiving, and commit (previously done by `reap.next`).**
|
|
23
|
-
|
|
24
|
-
2. **Hook Execution** (before archiving, before commit):
|
|
25
|
-
Execute hooks for event `onMergeCompleted` following the Hook System protocol:
|
|
26
|
-
- Scan `.reap/hooks/` for `onMergeCompleted.*` files
|
|
27
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
28
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
29
|
-
- All hook outputs are included in the same generation commit
|
|
30
|
-
|
|
31
|
-
3. **Archiving**:
|
|
32
|
-
- Add the current timestamp to `completedAt` in `current.yml`
|
|
33
|
-
- Create the lineage directory: `.reap/lineage/[gen-id]-[goal-slug]/`
|
|
34
|
-
- Goal slug: lowercase, non-alphanumeric/hangul replaced with `-`, max 30 chars
|
|
35
|
-
- **Write `meta.yml`** in the lineage directory with DAG metadata:
|
|
36
|
-
```yaml
|
|
37
|
-
id: [gen-id]
|
|
38
|
-
type: merge
|
|
39
|
-
parents: [parent generation IDs from current.yml]
|
|
40
|
-
goal: [goal from current.yml]
|
|
41
|
-
genomeHash: [genomeHash from current.yml, or compute from .reap/genome/]
|
|
42
|
-
startedAt: [startedAt from current.yml]
|
|
43
|
-
completedAt: [current ISO 8601]
|
|
44
|
-
```
|
|
45
|
-
- Move artifact files (`01-*.md` through `06-*.md`) from `.reap/life/` to the lineage directory
|
|
46
|
-
- Process backlog files from `.reap/life/backlog/`:
|
|
47
|
-
- Create `.reap/lineage/[gen-id]-[goal-slug]/backlog/` directory
|
|
48
|
-
- Files with `status: consumed` → move to lineage backlog
|
|
49
|
-
- Files with `status: pending` or no status field → copy to lineage backlog, carry over to `.reap/life/backlog/`
|
|
50
|
-
- Clear `current.yml` (write empty content)
|
|
51
|
-
- Recreate `.reap/life/backlog/` directory (with carried-over pending items)
|
|
52
|
-
|
|
53
|
-
4. **Commit** (source + archiving in a single commit):
|
|
54
|
-
- **Submodule check**: If any git submodule has uncommitted changes, commit and push inside the submodule first, then stage the updated submodule pointer in the parent repo
|
|
55
|
-
- Stage all changed files (merged source + genome changes + `.reap/` artifacts + hook outputs)
|
|
56
|
-
- Commit message format: `merge(gen-NNN-hash): [generation goal summary]`
|
|
57
|
-
|
|
58
|
-
## Completion
|
|
59
|
-
- "Merge generation [id] complete and archived. Run `/reap.start` to begin a new generation."
|
|
5
|
+
Run `reap run merge-completion` and follow the stdout instructions exactly.
|
|
@@ -2,26 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Detect — Analyze divergence between branches"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Analyze the divergence between the current branch and the target branch.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: detect
|
|
11
|
-
|
|
12
|
-
## Steps
|
|
13
|
-
|
|
14
|
-
1. Read `01-detect.md` (created by `reap merge` CLI)
|
|
15
|
-
2. Review the divergence report with the human:
|
|
16
|
-
- Common ancestor
|
|
17
|
-
- Genome changes on each side
|
|
18
|
-
- Conflicts (WRITE-WRITE, CROSS-FILE)
|
|
19
|
-
3. If the detect needs to be re-run, use `reap merge {branch}` again
|
|
20
|
-
4. When satisfied, execute hooks and proceed with `/reap.next`
|
|
21
|
-
|
|
22
|
-
### Hook Execution
|
|
23
|
-
Execute hooks for event `onMergeDetected` following the Hook System protocol:
|
|
24
|
-
- Scan `.reap/hooks/` for `onMergeDetected.*` files
|
|
25
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
26
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
27
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
5
|
+
Run `reap run merge-detect` and follow the stdout instructions exactly.
|
|
@@ -2,40 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Evolve — Run the full merge lifecycle automatically"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Run the entire merge lifecycle from the current stage to completion.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge
|
|
11
|
-
|
|
12
|
-
## Hook Auto-Execution
|
|
13
|
-
Each merge stage command automatically executes its own hook at completion:
|
|
14
|
-
- `/reap.merge.detect` → `onMergeDetected`
|
|
15
|
-
- `/reap.merge.mate` → `onMergeMated`
|
|
16
|
-
- `/reap.merge.merge` → `onMergeMerged`
|
|
17
|
-
- `/reap.merge.sync` → `onMergeSynced`
|
|
18
|
-
- `/reap.merge.validation` → `onMergeValidated`
|
|
19
|
-
- `/reap.merge.completion` → `onMergeCompleted` (before archiving and commit)
|
|
20
|
-
|
|
21
|
-
`/reap.next` only handles stage transitions — it does NOT execute hooks or archiving.
|
|
22
|
-
`/reap.merge.completion` handles archiving and the final commit.
|
|
23
|
-
|
|
24
|
-
## Steps
|
|
25
|
-
|
|
26
|
-
Execute the merge lifecycle loop:
|
|
27
|
-
1. Read `current.yml` to determine stage
|
|
28
|
-
2. Execute the corresponding merge stage command:
|
|
29
|
-
- `detect` → `/reap.merge.detect`
|
|
30
|
-
- `mate` → `/reap.merge.mate`
|
|
31
|
-
- `merge` → `/reap.merge.merge`
|
|
32
|
-
- `sync` → `/reap.merge.sync`
|
|
33
|
-
- `validation` → `/reap.merge.validation`
|
|
34
|
-
- `completion` → `/reap.merge.completion`
|
|
35
|
-
3. When a stage command completes (hooks already executed by the stage command):
|
|
36
|
-
- If the current stage is `completion`: `/reap.merge.completion` handles archiving and commit internally. The loop ends.
|
|
37
|
-
- Otherwise: run `/reap.next` to advance, then return to step 1.
|
|
38
|
-
|
|
39
|
-
## Autonomous Override
|
|
40
|
-
Same rules as `/reap.evolve` — skip routine confirmations, stop only when genuinely blocked.
|
|
41
|
-
**Exception**: `/reap.merge.sync` inconsistencies always require user confirmation even in autonomous mode.
|
|
5
|
+
Run `reap run merge-evolve` and follow the stdout instructions exactly.
|
|
@@ -2,33 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Mate — Resolve genome conflicts through mating"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Resolve genome conflicts identified in the detect stage. The genome must be fully finalized before source merge.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: mate
|
|
11
|
-
- Verify `01-detect.md` exists
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Read conflicts from `01-detect.md`
|
|
16
|
-
2. For each WRITE-WRITE conflict:
|
|
17
|
-
- Show both versions to the human
|
|
18
|
-
- Ask: keep A, keep B, or merge manually
|
|
19
|
-
3. For each CROSS-FILE conflict:
|
|
20
|
-
- Show the changes and ask if they are logically compatible
|
|
21
|
-
4. Apply the resolved genome to `.reap/genome/`
|
|
22
|
-
5. Record all decisions in `02-mate.md`
|
|
23
|
-
6. Execute hooks and proceed with `/reap.next`
|
|
24
|
-
|
|
25
|
-
### Hook Execution
|
|
26
|
-
Execute hooks for event `onMergeMated` following the Hook System protocol:
|
|
27
|
-
- Scan `.reap/hooks/` for `onMergeMated.*` files
|
|
28
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
29
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
30
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
31
|
-
|
|
32
|
-
## Escalation
|
|
33
|
-
- If conflicts are complex or ambiguous, STOP and ask the human
|
|
34
|
-
- Never auto-resolve WRITE-WRITE conflicts
|
|
5
|
+
Run `reap run merge-mate` and follow the stdout instructions exactly.
|
|
@@ -2,46 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge — Run a full merge generation for a local branch"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Run a full merge generation lifecycle for a local branch. This is the local/worktree equivalent of `/reap.pull` — no fetch needed.
|
|
8
|
-
|
|
9
|
-
If the target branch already includes all local work (fast-forward), skip the merge lifecycle entirely.
|
|
10
|
-
|
|
11
|
-
## Gate (Preconditions)
|
|
12
|
-
- Verify no active generation exists (`.reap/life/current.yml` must be empty)
|
|
13
|
-
- If an active generation exists: ERROR — "Complete the current generation before merging."
|
|
14
|
-
|
|
15
|
-
## Arguments
|
|
16
|
-
- `{branch}` — Target local branch to merge (required)
|
|
17
|
-
|
|
18
|
-
## Steps
|
|
19
|
-
|
|
20
|
-
### Phase 1: Detect
|
|
21
|
-
1. Verify the target branch exists: `git rev-parse --verify {branch}`
|
|
22
|
-
- If not found: ERROR — "Branch {branch} does not exist."
|
|
23
|
-
2. Scan the target branch's `.reap/lineage/` via git refs
|
|
24
|
-
3. Compare with local lineage to identify new generations
|
|
25
|
-
4. If no new generations: "Already up to date." → STOP
|
|
26
|
-
|
|
27
|
-
### Phase 2: Fast-Forward Check
|
|
28
|
-
5. Determine the local latest generation ID and the target branch's latest generation ID
|
|
29
|
-
6. Build a combined DAG from both lineage metadata
|
|
30
|
-
7. Check if the local latest generation is an ancestor of the target's latest generation:
|
|
31
|
-
- **If yes (fast-forward possible)**:
|
|
32
|
-
- Run `git merge --ff {branch}`
|
|
33
|
-
- Report: "Fast-forwarded to {branch}. No merge generation needed."
|
|
34
|
-
- **STOP**
|
|
35
|
-
- **If same generation**: "Already up to date." → **STOP**
|
|
36
|
-
- **If no (diverged)**: Continue to Phase 3
|
|
37
|
-
|
|
38
|
-
### Phase 3: Merge Generation
|
|
39
|
-
8. Execute `/reap.merge.start` with the target branch
|
|
40
|
-
- This creates the merge generation and runs detect (01-detect.md)
|
|
41
|
-
9. Execute `/reap.merge.evolve` to run the full merge lifecycle:
|
|
42
|
-
- Detect → Mate → Merge → Sync → Validation → Completion
|
|
43
|
-
10. The merge generation is archived upon completion
|
|
44
|
-
|
|
45
|
-
## Completion
|
|
46
|
-
- Fast-forward: "Fast-forwarded to {branch}. No merge generation needed."
|
|
47
|
-
- Full merge: "Merge complete. Merged {branch} into {current-branch}. Generation {id} archived."
|
|
5
|
+
Run `reap run merge` and follow the stdout instructions exactly.
|
|
@@ -2,28 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Merge — Merge source code with finalized genome as guide"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Merge the source code from the target branch, using the finalized genome as the authoritative guide.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: merge
|
|
11
|
-
- Verify `02-mate.md` exists
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Run `git merge --no-commit {target-branch}` to start the source merge
|
|
16
|
-
2. If git merge conflicts exist:
|
|
17
|
-
- Resolve each conflict guided by the finalized genome
|
|
18
|
-
- Record resolutions in `03-merge.md`
|
|
19
|
-
3. If no git conflicts:
|
|
20
|
-
- Check for semantic conflicts (code that compiles but contradicts the genome)
|
|
21
|
-
4. Do NOT commit yet — sync and validation must pass first
|
|
22
|
-
5. Execute hooks and proceed with `/reap.next`
|
|
23
|
-
|
|
24
|
-
### Hook Execution
|
|
25
|
-
Execute hooks for event `onMergeMerged` following the Hook System protocol:
|
|
26
|
-
- Scan `.reap/hooks/` for `onMergeMerged.*` files
|
|
27
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
28
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
29
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
5
|
+
Run `reap run merge-merge` and follow the stdout instructions exactly.
|
|
@@ -2,28 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Start — Start a merge generation to combine divergent branches"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Start a merge generation by specifying a target branch to merge into the current branch.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify no active generation exists
|
|
11
|
-
- Verify the target branch exists (`git rev-parse --verify {branch}`)
|
|
12
|
-
- Verify that the common ancestor is NOT inside `epoch.md`. If it is: ERROR — "The common ancestor has been epoch-compressed and cannot be used as a merge base. The generation is archived in epoch.md for historical reference only."
|
|
13
|
-
|
|
14
|
-
## Steps
|
|
15
|
-
|
|
16
|
-
1. Ask the human for the target branch name (if not provided)
|
|
17
|
-
2. Run detect: scan target branch genome/lineage via git refs, find common ancestor, extract diffs
|
|
18
|
-
3. Create merge generation in `current.yml` (type: merge, stage: detect)
|
|
19
|
-
4. Generate `01-detect.md` artifact with divergence report
|
|
20
|
-
5. Report: parents, common ancestor, conflict count
|
|
21
|
-
6. If genome conflicts exist: proceed to `/reap.merge.mate`
|
|
22
|
-
7. If no genome conflicts: mate can auto-pass, proceed to `/reap.merge.merge`
|
|
23
|
-
|
|
24
|
-
### Hook Execution
|
|
25
|
-
Execute hooks for event `onMergeStarted` following the Hook System protocol:
|
|
26
|
-
- Scan `.reap/hooks/` for `onMergeStarted.*` files
|
|
27
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
28
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
29
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
5
|
+
Run `reap run merge-start` and follow the stdout instructions exactly.
|
|
@@ -2,38 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Sync — Verify genome-source consistency"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Verify that the merged source code is consistent with the finalized genome. This is NOT validation (tests/build) — this is a semantic check that the code matches the genome's rules and decisions.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: sync
|
|
11
|
-
- Verify `03-merge.md` exists
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Read the finalized genome (`.reap/genome/`)
|
|
16
|
-
2. Compare genome rules against the merged source code:
|
|
17
|
-
- **conventions.md**: Are naming conventions, code style, and patterns followed?
|
|
18
|
-
- **constraints.md**: Are tech stack choices and constraints respected?
|
|
19
|
-
- **principles.md**: Are architecture decisions reflected in the code?
|
|
20
|
-
- **domain/**: Are business rules implemented correctly?
|
|
21
|
-
- **source-map.md**: Do documented components match actual files?
|
|
22
|
-
3. For each inconsistency found:
|
|
23
|
-
- **STOP and present to the human**
|
|
24
|
-
- Ask: fix the source, update the genome, or accept as-is with rationale
|
|
25
|
-
- Record the decision in `04-sync.md`
|
|
26
|
-
4. If no inconsistencies: record "All consistent" in `04-sync.md`
|
|
27
|
-
5. Execute hooks and proceed with `/reap.next`
|
|
28
|
-
|
|
29
|
-
### Hook Execution
|
|
30
|
-
Execute hooks for event `onMergeSynced` following the Hook System protocol:
|
|
31
|
-
- Scan `.reap/hooks/` for `onMergeSynced.*` files
|
|
32
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
33
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
34
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
35
|
-
|
|
36
|
-
## Escalation
|
|
37
|
-
- **Every inconsistency requires user confirmation** — do NOT auto-resolve
|
|
38
|
-
- If fixing requires significant code changes, consider `/reap.back merge`
|
|
39
|
-
- If fixing requires genome changes, consider `/reap.back mate`
|
|
5
|
+
Run `reap run merge-sync` and follow the stdout instructions exactly.
|
|
@@ -2,32 +2,4 @@
|
|
|
2
2
|
description: "REAP Merge Validation — Run tests, type check, and build"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
Run all validation commands to verify the merged code works correctly. Same as normal generation validation.
|
|
8
|
-
|
|
9
|
-
## Gate
|
|
10
|
-
- Verify current generation is type: merge and stage: validation
|
|
11
|
-
- Verify `04-sync.md` exists
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
1. Read validation commands from `.reap/genome/constraints.md`
|
|
16
|
-
2. Execute all commands in order:
|
|
17
|
-
- Tests (`bun test`)
|
|
18
|
-
- Type check (`bunx tsc --noEmit`)
|
|
19
|
-
- Build (`npm run build`)
|
|
20
|
-
3. Record results in `05-validation.md`
|
|
21
|
-
4. If all pass: execute hooks and proceed with `/reap.next`
|
|
22
|
-
5. If any fail:
|
|
23
|
-
- Analyze the failure
|
|
24
|
-
- `/reap.back merge` to fix source issues
|
|
25
|
-
- Or `/reap.back mate` if the genome needs adjustment
|
|
26
|
-
|
|
27
|
-
### Hook Execution
|
|
28
|
-
Execute hooks for event `onMergeValidated` following the Hook System protocol:
|
|
29
|
-
- Scan `.reap/hooks/` for `onMergeValidated.*` files
|
|
30
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
31
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
32
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
33
|
-
- **Only execute on pass** — do NOT execute hooks if validation fails
|
|
5
|
+
Run `reap run merge-validation` and follow the stdout instructions exactly.
|
|
@@ -2,35 +2,4 @@
|
|
|
2
2
|
description: "REAP Next — Advance to the next lifecycle stage"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
This command is the **ONLY legitimate way** to advance the lifecycle stage. All stage transitions MUST go through this command. Direct modification of `current.yml` is strictly prohibited.
|
|
8
|
-
|
|
9
|
-
## Gate (Preconditions)
|
|
10
|
-
- Read `.reap/life/current.yml`
|
|
11
|
-
- If no active Generation: ERROR — "No active Generation. Run `/reap.start` first." **STOP**
|
|
12
|
-
|
|
13
|
-
## Steps
|
|
14
|
-
|
|
15
|
-
### Stage Transition
|
|
16
|
-
- Stage order (normal): objective → planning → implementation → validation → completion
|
|
17
|
-
- Stage order (merge): detect → mate → merge → sync → validation → completion
|
|
18
|
-
- Update the `stage` in `current.yml` to the next stage
|
|
19
|
-
- Add an entry to `timeline`:
|
|
20
|
-
```yaml
|
|
21
|
-
- stage: [next stage]
|
|
22
|
-
at: [current ISO 8601]
|
|
23
|
-
```
|
|
24
|
-
- Immediately create the next stage's artifact file from template (empty, ready to fill)
|
|
25
|
-
|
|
26
|
-
**Note**: Stage-specific hooks (e.g., `onLifeObjected`) are handled by each stage command at its own completion, NOT by this command. Archiving is handled by `reap.completion` (normal) or `reap.merge.completion` (merge).
|
|
27
|
-
|
|
28
|
-
### Hook Execution (Transition)
|
|
29
|
-
After updating `current.yml`, execute the generic transition hook based on generation type:
|
|
30
|
-
- If `type` is `merge` (or current stage is a merge stage): execute hooks for event `onMergeTransited`
|
|
31
|
-
- Otherwise (normal): execute hooks for event `onLifeTransited`
|
|
32
|
-
|
|
33
|
-
Scan `.reap/hooks/` for `{event}.*` files, sort by frontmatter `order` then alphabetically, evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script).
|
|
34
|
-
|
|
35
|
-
## Completion
|
|
36
|
-
- "Advanced to [next stage]. Proceed with `/reap.[next stage]`."
|
|
5
|
+
Run `reap run next` and follow the stdout instructions exactly.
|
|
@@ -2,262 +2,4 @@
|
|
|
2
2
|
description: "REAP Objective — Define the goal and specification for this Generation"
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<HARD-GATE>
|
|
8
|
-
Do NOT write any code until the artifact (01-objective.md) has been confirmed by the human.
|
|
9
|
-
If the goal is ambiguous, do NOT guess — STOP and ask the human. This is non-negotiable.
|
|
10
|
-
Brainstorming is triggered based on goal complexity — simple tasks skip it, complex tasks require it. The human can always override the AI's assessment.
|
|
11
|
-
</HARD-GATE>
|
|
12
|
-
|
|
13
|
-
## Gate (Preconditions)
|
|
14
|
-
- Read `.reap/life/current.yml` and verify that stage is `objective`
|
|
15
|
-
- If not met: ERROR — "Current stage is not objective. Start a new Generation with `/reap.start` or check the current state with `reap status`." then **STOP**
|
|
16
|
-
|
|
17
|
-
## Context (Generation Info)
|
|
18
|
-
- Read `.reap/life/current.yml` for the current generation info (id, goal, genomeVersion)
|
|
19
|
-
- Reference this info in all subsequent artifacts and conversations
|
|
20
|
-
|
|
21
|
-
## Re-entry Check
|
|
22
|
-
- If `.reap/life/01-objective.md` already exists, this is a **re-entry due to regression**
|
|
23
|
-
- Read the existing artifact; if a `## Regression` section exists, understand the regression reason
|
|
24
|
-
- Use the existing content as reference, but overwrite it with modifications that address the regression reason
|
|
25
|
-
|
|
26
|
-
## Steps
|
|
27
|
-
|
|
28
|
-
### 1. Environment Check
|
|
29
|
-
- Read `.reap/environment/summary.md`
|
|
30
|
-
- If summary.md exists: review it for relevant context to this generation's goal
|
|
31
|
-
- **If empty or missing**: inform the user — "Environment가 설정되지 않았습니다. `/reap.sync.environment`로 외부 환경 정보를 설정할 수 있습니다."
|
|
32
|
-
- Do NOT block — proceed with the objective. Environment is optional but recommended.
|
|
33
|
-
|
|
34
|
-
### 2. Previous Generation Reference
|
|
35
|
-
- If a `05-completion.md` exists for the most recent generation in `.reap/lineage/`, read it
|
|
36
|
-
- Reference lessons learned and next-generation suggestions from the previous generation
|
|
37
|
-
|
|
38
|
-
### 3. Backlog Review
|
|
39
|
-
- Read all files in `.reap/life/backlog/`
|
|
40
|
-
- Review deferred tasks and planned goals
|
|
41
|
-
|
|
42
|
-
### 4. Genome Health Check
|
|
43
|
-
- Read all files in `.reap/genome/` (principles.md, conventions.md, constraints.md, domain/)
|
|
44
|
-
- Read `.reap/config.yml` to determine the `entryMode` (greenfield, migration, adoption)
|
|
45
|
-
|
|
46
|
-
- **If this is the first generation** (`.reap/lineage/` is empty):
|
|
47
|
-
- This is the sole exception to the Genome immutability principle: **direct genome authoring is permitted only during the first generation's Objective**
|
|
48
|
-
- **Brief the human on what Genome means**:
|
|
49
|
-
> "Genome is where we record this project's **design and knowledge** — things the team decides and controls internally.
|
|
50
|
-
> Architecture principles, business rules, development conventions, and technical constraints.
|
|
51
|
-
> It's the project's DNA that evolves across generations."
|
|
52
|
-
|
|
53
|
-
- **If entryMode is `greenfield`** (new project):
|
|
54
|
-
1. Ask about the application first:
|
|
55
|
-
- "What application do you want to build? Give me a brief introduction."
|
|
56
|
-
- "Who are the primary users? What problem does it solve?"
|
|
57
|
-
2. Based on the app description, **recommend a tech stack**:
|
|
58
|
-
- Propose 2-3 options with pros/cons based on the app type (web, API, CLI, mobile, etc.)
|
|
59
|
-
- If the human already has a preferred stack, respect that
|
|
60
|
-
3. After stack is decided, ask additional questions:
|
|
61
|
-
- "Any architecture principles or design decisions already in mind?"
|
|
62
|
-
- "Any development conventions? (coding style, branch strategy, test policy, etc.)"
|
|
63
|
-
- "Any technical constraints? (performance requirements, compatibility, dependency restrictions, etc.)"
|
|
64
|
-
4. Populate `principles.md`, `conventions.md`, `constraints.md` with collected information
|
|
65
|
-
|
|
66
|
-
- **If entryMode is `adoption`** (existing codebase):
|
|
67
|
-
1. **Validate REAP root**:
|
|
68
|
-
- Check for project root signals (package.json, go.mod, .git, etc.)
|
|
69
|
-
- If parent directory has root signals, warn: "This may be a subdirectory. Is [parent] the actual project root?"
|
|
70
|
-
- If workspace config exists in parent (pnpm-workspace.yaml, lerna.json, etc.), ask: "Monorepo detected. Init for the whole repo or just this package?"
|
|
71
|
-
- If sibling directories contain other sub-projects, suggest: "Other sub-projects found at the same level. Consider init from the parent directory."
|
|
72
|
-
- Proceed after human confirmation (intentional subdirectory init is allowed)
|
|
73
|
-
2. **Scan for existing documentation**:
|
|
74
|
-
- Search for README.md, CONTRIBUTING.md, ARCHITECTURE.md, docs/, CLAUDE.md, AGENTS.md, ADR directories
|
|
75
|
-
- Show discovered documents to the human and ask for each: "Is this still current?"
|
|
76
|
-
- Current → use as genome source
|
|
77
|
-
- Partially outdated → use as reference, prioritize code analysis
|
|
78
|
-
- No longer valid → skip
|
|
79
|
-
3. **Analyze existing source code**:
|
|
80
|
-
- Infer tech stack from config files (package.json, tsconfig, Dockerfile, etc.)
|
|
81
|
-
- Infer architecture patterns from directory structure
|
|
82
|
-
- Extract conventions from linter/formatter configs
|
|
83
|
-
- Identify test strategy from test configs
|
|
84
|
-
4. **Present combined analysis** (verified docs + code analysis) as genome draft:
|
|
85
|
-
- "Based on existing documents and source analysis, here's the proposed Genome. Please review."
|
|
86
|
-
- Human confirms/modifies each section
|
|
87
|
-
5. Ask about anything not derivable from code or docs (business context, team decisions, etc.)
|
|
88
|
-
6. Populate genome files with confirmed information
|
|
89
|
-
|
|
90
|
-
- **If entryMode is `migration`**: Follow the `adoption` flow for analysis of the existing system, but note that the new project may diverge in architecture
|
|
91
|
-
|
|
92
|
-
- **For subsequent generations**:
|
|
93
|
-
- Evaluate the health of each file:
|
|
94
|
-
- **Files with only placeholders** → flag as "genome needs enhancement"
|
|
95
|
-
- **Files exceeding 100 lines** → flag as "needs extraction to domain/"
|
|
96
|
-
- **domain/ has only README.md and no rule files** → flag as "domain rules undefined"
|
|
97
|
-
- **constraints.md has empty Validation Commands** → flag as "test commands undefined"
|
|
98
|
-
- Report the genome health status to the human
|
|
99
|
-
|
|
100
|
-
### 5. Goal + Spec Definition (with optional Brainstorming)
|
|
101
|
-
|
|
102
|
-
Before entering brainstorming, evaluate whether the goal requires it.
|
|
103
|
-
|
|
104
|
-
#### Complexity Gate
|
|
105
|
-
Assess the goal's complexity based on these criteria:
|
|
106
|
-
|
|
107
|
-
**Skip brainstorming** (proceed directly to Step 6 with simple goal+spec definition):
|
|
108
|
-
- Simple bugfix with clear cause and fix
|
|
109
|
-
- Configuration change or settings adjustment
|
|
110
|
-
- Documentation-only changes
|
|
111
|
-
- Single-file refactoring with obvious approach
|
|
112
|
-
- Tasks where the "what" and "how" are both already clear
|
|
113
|
-
|
|
114
|
-
**Enter brainstorming** (follow sub-steps 5a–5e):
|
|
115
|
-
- New feature development spanning multiple components
|
|
116
|
-
- Architecture changes or new module design
|
|
117
|
-
- Tasks with multiple valid implementation approaches
|
|
118
|
-
- Requirements that need further exploration or clarification
|
|
119
|
-
- Integration with external systems or complex data flows
|
|
120
|
-
|
|
121
|
-
**Under Autonomous Override**: Assess automatically. If the goal from `current.yml` clearly fits "skip" criteria, skip brainstorming.
|
|
122
|
-
**Human override**: The human can always request brainstorming ("let's brainstorm this") or skip it ("just do it", "skip brainstorming") regardless of the AI's assessment.
|
|
123
|
-
|
|
124
|
-
When skipping brainstorming, converse with the human to refine the goal:
|
|
125
|
-
- Criteria for a good goal: achievable within a single Generation, verifiable completion criteria (no vague wording), relevant genome areas identified
|
|
126
|
-
- Then proceed directly to Step 6 (Genome Gap Analysis)
|
|
127
|
-
|
|
128
|
-
When entering brainstorming, follow the structured brainstorming process below to produce a well-designed objective. Follow the sub-steps in order.
|
|
129
|
-
|
|
130
|
-
#### 5a. Visual Companion Proposal
|
|
131
|
-
- Evaluate whether this generation's goal involves visual questions (UI design, architecture diagrams, layout comparisons, etc.)
|
|
132
|
-
- If visual questions are likely, propose the Visual Companion in a **standalone message** (do NOT combine with other questions):
|
|
133
|
-
> "이번 설계에서 목업이나 다이어그램으로 보여드리면 이해하기 쉬운 부분이 있을 수 있습니다.
|
|
134
|
-
> 브라우저에서 시각 자료를 보여드릴 수 있는 비주얼 컴패니언을 사용할까요?
|
|
135
|
-
> (로컬 서버를 띄워 브라우저에서 확인하는 방식입니다)"
|
|
136
|
-
- If the human accepts: start the brainstorm server (`bash` the start script in `.reap/brainstorm/start-server.sh` or `node` the server directly). Read `src/templates/brainstorm/visual-companion-guide.md` for usage rules.
|
|
137
|
-
- If the human declines: proceed terminal-only. Do NOT offer again.
|
|
138
|
-
- **This step applies even under `/reap.evolve` Autonomous Override** — only skip if the human has explicitly declined.
|
|
139
|
-
|
|
140
|
-
#### 5b. Clarifying Questions (One at a Time)
|
|
141
|
-
- **CRITICAL**: Ask only ONE question per message. Never bundle multiple questions.
|
|
142
|
-
- Prefer **multiple choice** over open-ended questions when possible.
|
|
143
|
-
- Goal: understand purpose, constraints, success criteria, and scope.
|
|
144
|
-
- Continue asking until you have enough information to propose approaches.
|
|
145
|
-
- Good question flow:
|
|
146
|
-
1. Purpose/motivation: "What problem does this solve?"
|
|
147
|
-
2. Users/stakeholders: "Who benefits from this?"
|
|
148
|
-
3. Constraints: "Are there any hard constraints?" (with examples as choices)
|
|
149
|
-
4. Success criteria: "How will you know this is done?"
|
|
150
|
-
- Under Autonomous Override: Use existing context (genome, backlog, goal from `current.yml`) to answer these questions yourself. Only STOP and ask if genuinely ambiguous.
|
|
151
|
-
|
|
152
|
-
#### 5c. Approach Exploration (2-3 Alternatives)
|
|
153
|
-
- Propose **2-3 approaches** with clear trade-offs.
|
|
154
|
-
- Present as a comparison table:
|
|
155
|
-
|
|
156
|
-
| Aspect | Approach A | Approach B | Approach C |
|
|
157
|
-
|--------|-----------|-----------|-----------|
|
|
158
|
-
| Summary | ... | ... | ... |
|
|
159
|
-
| Pros | ... | ... | ... |
|
|
160
|
-
| Cons | ... | ... | ... |
|
|
161
|
-
| Complexity | ... | ... | ... |
|
|
162
|
-
| Recommendation | ... | ... | ... |
|
|
163
|
-
|
|
164
|
-
- Include a clear recommendation with reasoning.
|
|
165
|
-
- If using Visual Companion: show approaches visually in the browser for comparison.
|
|
166
|
-
- If only one sensible approach exists, state why alternatives were considered but dismissed.
|
|
167
|
-
- Wait for the human to choose (or confirm the recommendation).
|
|
168
|
-
- Under Autonomous Override: choose the recommended approach and proceed.
|
|
169
|
-
|
|
170
|
-
#### 5d. Sectional Design Approval
|
|
171
|
-
- Present the design in sections, scaled to complexity:
|
|
172
|
-
- **Simple** (few sentences per section): small feature, bug fix, config change
|
|
173
|
-
- **Medium** (1-2 paragraphs per section): new module, refactoring, integration
|
|
174
|
-
- **Detailed** (200-300 words per section): new system, major architecture change
|
|
175
|
-
- Sections to cover (skip if not applicable):
|
|
176
|
-
1. **Architecture** — high-level structure, module relationships
|
|
177
|
-
2. **Components** — key components and their responsibilities
|
|
178
|
-
3. **Data Flow** — how data moves through the system
|
|
179
|
-
4. **Error Handling** — failure modes and recovery strategies
|
|
180
|
-
5. **Testing Strategy** — what and how to test
|
|
181
|
-
- **After each section**, ask: "Does this look right so far?" (or confirm under Autonomous Override)
|
|
182
|
-
- If using Visual Companion: show architecture/data flow diagrams in the browser.
|
|
183
|
-
- Iterate until the human approves each section.
|
|
184
|
-
|
|
185
|
-
#### 5e. Scope Decomposition Check
|
|
186
|
-
- **Check for multi-subsystem scope**: If the goal describes 2+ independent subsystems (e.g., "build chat + file storage + billing"):
|
|
187
|
-
- Flag immediately: "This goal covers multiple independent subsystems. I recommend splitting into separate Generations."
|
|
188
|
-
- Help decompose into sub-goals, each getting its own Generation.
|
|
189
|
-
- **Check FR count**: If functional requirements exceed 10, warn and suggest splitting.
|
|
190
|
-
- Under Autonomous Override: if scope is clearly single-subsystem, proceed without asking.
|
|
191
|
-
|
|
192
|
-
### 6. Genome Gap Analysis
|
|
193
|
-
- Identify information required to achieve the goal that is missing from the genome
|
|
194
|
-
- For each missing item, record it in `.reap/life/backlog/`:
|
|
195
|
-
```markdown
|
|
196
|
-
---
|
|
197
|
-
type: genome-change
|
|
198
|
-
status: pending
|
|
199
|
-
target: genome/{file}
|
|
200
|
-
---
|
|
201
|
-
# [Title]
|
|
202
|
-
[Specifically what is lacking and how it should be changed]
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### 7. Requirements Finalization
|
|
206
|
-
- Organize functional requirements (FR) and non-functional requirements
|
|
207
|
-
- Define acceptance criteria
|
|
208
|
-
- **Limit**: Maximum 10 functional requirements. If exceeding 10, split into separate generations.
|
|
209
|
-
- **Limit**: Maximum 7 completion criteria. Each must be verifiable.
|
|
210
|
-
- Finalize with the human
|
|
211
|
-
|
|
212
|
-
### 8. Spec Review Loop
|
|
213
|
-
- After the artifact is complete, dispatch a **spec-document-reviewer subagent** (using the Agent tool with the prompt from `src/templates/brainstorm/spec-reviewer-prompt.md`):
|
|
214
|
-
- The subagent reads `.reap/life/01-objective.md` and reviews for completeness, consistency, clarity, scope, YAGNI, and verifiability.
|
|
215
|
-
- If **Issues Found**: fix the issues in the artifact and re-dispatch the reviewer.
|
|
216
|
-
- If **Approved**: proceed to human review.
|
|
217
|
-
- **Maximum 3 iterations**. If issues persist after 3 rounds, present remaining issues to the human for decision.
|
|
218
|
-
- Under Autonomous Override: run the review loop automatically. Only escalate if the reviewer flags blocking issues after 3 rounds.
|
|
219
|
-
|
|
220
|
-
## Escalation
|
|
221
|
-
In the following situations, do NOT guess — **STOP and ask the human**:
|
|
222
|
-
- When the scope of the goal is unclear
|
|
223
|
-
- When two or more reasonable interpretations are possible
|
|
224
|
-
- When contradictory information exists in the genome
|
|
225
|
-
|
|
226
|
-
## Self-Verification
|
|
227
|
-
Before saving the artifact, verify:
|
|
228
|
-
- [ ] Is the goal clearly stated in a single sentence?
|
|
229
|
-
- [ ] Are all completion criteria verifiable? (No vague wording like "improve" or "make better"?)
|
|
230
|
-
- [ ] Are exclusions explicitly stated in the scope?
|
|
231
|
-
- [ ] Do functional requirements have FR-XXX numbering?
|
|
232
|
-
- [ ] Does the Design section include the chosen approach with rationale?
|
|
233
|
-
- [ ] Has the spec review loop completed (approved or human-overridden)?
|
|
234
|
-
|
|
235
|
-
❌ Bad completion criterion: "Stabilize the service"
|
|
236
|
-
✅ Good completion criterion: "`npm run lint` reports 0 errors, `npm run build` succeeds"
|
|
237
|
-
|
|
238
|
-
## Artifact Generation (Progressive Recording)
|
|
239
|
-
- **Language**: Write all artifact content in the user's configured language (see REAP Guide § Language).
|
|
240
|
-
- **Immediately upon entering this stage**: Read `~/.reap/templates/01-objective.md` and create `.reap/life/01-objective.md` with the Goal section filled in (from `current.yml` goal)
|
|
241
|
-
- **Update incrementally**: As each step progresses, update the artifact in place:
|
|
242
|
-
- After Environment Scan → update Background section
|
|
243
|
-
- After Previous Generation Reference → update Background section
|
|
244
|
-
- After Backlog Review → update Background section
|
|
245
|
-
- After Genome Health Check → update Genome Reference section
|
|
246
|
-
- After Brainstorming Design (5a-5e) → update Goal, Scope, Design sections
|
|
247
|
-
- After Genome Gap Analysis → update Backlog section
|
|
248
|
-
- After Requirements Finalization → update Requirements, Completion Criteria sections
|
|
249
|
-
- After Spec Review Loop → update with any review-driven changes
|
|
250
|
-
- The artifact should reflect the **current state of work at all times**
|
|
251
|
-
- Do NOT wait until the end to write the artifact
|
|
252
|
-
|
|
253
|
-
## Hook Execution
|
|
254
|
-
Execute hooks for event `onLifeObjected` following the Hook System protocol:
|
|
255
|
-
- Scan `.reap/hooks/` for `onLifeObjected.*` files
|
|
256
|
-
- Sort by frontmatter `order`, then alphabetically
|
|
257
|
-
- Evaluate `condition`, execute `.md` (AI prompt) or `.sh` (shell script)
|
|
258
|
-
- All hooks run BEFORE any commit (hook outputs included in the same commit)
|
|
259
|
-
|
|
260
|
-
## Completion
|
|
261
|
-
- **If called from `/reap.evolve`** (Autonomous Override active): Save the artifact, execute hooks, and proceed automatically. Do NOT pause for human confirmation.
|
|
262
|
-
- **If called standalone**: Show the artifact to the human and get confirmation. Then execute hooks.
|
|
263
|
-
- After confirmation or auto-proceed: "Proceed to the Planning stage with `/reap.next`."
|
|
5
|
+
Run `reap run objective` and follow the stdout instructions exactly.
|