@c-d-cc/reap 0.7.1 → 0.7.3
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/dist/cli.js +25 -1
- package/dist/templates/commands/reap.sync.md +14 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -9137,6 +9137,29 @@ async function syncGenomeFromProject(projectRoot, genomePath, onProgress) {
|
|
|
9137
9137
|
await writeTextFile2(join4(genomePath, "principles.md"), generatePrinciples(scan));
|
|
9138
9138
|
log("Generating source-map.md...");
|
|
9139
9139
|
await writeTextFile2(join4(genomePath, "source-map.md"), generateSourceMap(scan));
|
|
9140
|
+
const { mkdir: mkdir3 } = await import("fs/promises");
|
|
9141
|
+
const domainDir = join4(genomePath, "domain");
|
|
9142
|
+
await mkdir3(domainDir, { recursive: true });
|
|
9143
|
+
const domainReadme = join4(domainDir, "README.md");
|
|
9144
|
+
if (!await fileExists(domainReadme)) {
|
|
9145
|
+
await writeTextFile2(domainReadme, [
|
|
9146
|
+
"# Domain Rules",
|
|
9147
|
+
"",
|
|
9148
|
+
"> This directory stores business rules that cannot be derived from code structure alone.",
|
|
9149
|
+
"> Run `/reap.sync` to scan source code for domain knowledge and auto-generate domain files.",
|
|
9150
|
+
"",
|
|
9151
|
+
"Examples of domain rules:",
|
|
9152
|
+
"- State machines and status transitions",
|
|
9153
|
+
"- Policy rules with thresholds or conditions",
|
|
9154
|
+
"- Classification logic driven by business categories",
|
|
9155
|
+
"- Hardcoded domain constants with business meaning",
|
|
9156
|
+
"- Workflow orchestration sequences",
|
|
9157
|
+
"",
|
|
9158
|
+
"Each file should follow the domain-guide template (`~/.reap/templates/domain-guide.md`).",
|
|
9159
|
+
""
|
|
9160
|
+
].join(`
|
|
9161
|
+
`));
|
|
9162
|
+
}
|
|
9140
9163
|
}
|
|
9141
9164
|
var init_genome_sync = __esm(() => {
|
|
9142
9165
|
init_fs();
|
|
@@ -9790,6 +9813,7 @@ async function initProject(projectRoot, projectName, entryMode, preset, onProgre
|
|
|
9790
9813
|
version: "0.1.0",
|
|
9791
9814
|
project: projectName,
|
|
9792
9815
|
entryMode,
|
|
9816
|
+
autoUpdate: true,
|
|
9793
9817
|
...preset && { preset }
|
|
9794
9818
|
};
|
|
9795
9819
|
await ConfigManager.write(paths, config);
|
|
@@ -10946,7 +10970,7 @@ async function fixProject(projectRoot) {
|
|
|
10946
10970
|
// src/cli/index.ts
|
|
10947
10971
|
init_fs();
|
|
10948
10972
|
import { join as join11 } from "path";
|
|
10949
|
-
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.
|
|
10973
|
+
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.3");
|
|
10950
10974
|
program.command("init").description("Initialize a new REAP project (Genesis)").argument("[project-name]", "Project name (defaults to current directory name)").option("-m, --mode <mode>", "Entry mode: greenfield, migration, adoption", "greenfield").option("-p, --preset <preset>", "Bootstrap with a genome preset (e.g., bun-hono-react)").action(async (projectName, options) => {
|
|
10951
10975
|
try {
|
|
10952
10976
|
const cwd = process.cwd();
|
|
@@ -46,12 +46,26 @@ Scan the project to understand its current state:
|
|
|
46
46
|
- Environment requirements, runtime constraints
|
|
47
47
|
- External service dependencies
|
|
48
48
|
|
|
49
|
+
**Domain Knowledge** (→ `genome/domain/`):
|
|
50
|
+
- Read `~/.reap/templates/domain-guide.md` for domain file writing principles
|
|
51
|
+
- Scan source code for business rules NOT derivable from infrastructure analysis:
|
|
52
|
+
- State machines and status transitions (e.g., post lifecycle, order states)
|
|
53
|
+
- Policy rules with thresholds, limits, or conditions (e.g., rate limits, scoring criteria)
|
|
54
|
+
- Classification/branching logic driven by business categories (e.g., template selection by type)
|
|
55
|
+
- Hardcoded domain constants (keyword lists, prompt templates, magic numbers with business meaning)
|
|
56
|
+
- Workflow orchestration sequences (e.g., approval flows, pipeline stages)
|
|
57
|
+
- For each discovered domain rule cluster, evaluate:
|
|
58
|
+
- "Would an agent implementing this feature ask 'where is this rule?'" → YES = create domain file
|
|
59
|
+
- "Does a single item in an upper-level genome file require 3+ lines of explanation?" → YES = extract to domain file
|
|
60
|
+
- Even if `genome/domain/` is currently empty, treat it as "not yet created" rather than "not needed"
|
|
61
|
+
|
|
49
62
|
### 3. Diff Analysis
|
|
50
63
|
Compare source analysis with current Genome and identify:
|
|
51
64
|
- **Additions**: Things in code but not in Genome
|
|
52
65
|
- **Changes**: Things in Genome that no longer match code
|
|
53
66
|
- **Removals**: Things in Genome that no longer exist in code
|
|
54
67
|
- **Gaps**: Areas where Genome has placeholders but code has established patterns
|
|
68
|
+
- **Domain gaps**: Business rules in code that have no corresponding `domain/` file
|
|
55
69
|
|
|
56
70
|
### 4. Report to Human
|
|
57
71
|
Present a structured diff report:
|