@c-d-cc/reap 0.7.3 → 0.7.5
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 +14 -45
- package/package.json +1 -1
- package/scripts/postinstall.cjs +27 -32
package/dist/cli.js
CHANGED
|
@@ -9373,16 +9373,6 @@ class ClaudeCodeAdapter {
|
|
|
9373
9373
|
const dest = join2(ReapPaths.userReapCommands, `${cmd}.md`);
|
|
9374
9374
|
await writeTextFile(dest, await readTextFileOrThrow(src));
|
|
9375
9375
|
}
|
|
9376
|
-
await mkdir(this.commandsDir, { recursive: true });
|
|
9377
|
-
for (const cmd of commandNames) {
|
|
9378
|
-
const dest = join2(this.commandsDir, `${cmd}.md`);
|
|
9379
|
-
const redirectContent = `---
|
|
9380
|
-
description: "REAP — redirected to ~/.reap/commands/"
|
|
9381
|
-
---
|
|
9382
|
-
Read \`~/.reap/commands/${cmd}.md\` and follow the instructions there.
|
|
9383
|
-
`;
|
|
9384
|
-
await writeTextFile(dest, redirectContent);
|
|
9385
|
-
}
|
|
9386
9376
|
}
|
|
9387
9377
|
async removeStaleCommands(validNames) {
|
|
9388
9378
|
try {
|
|
@@ -9604,16 +9594,6 @@ class OpenCodeAdapter {
|
|
|
9604
9594
|
const dest = join3(ReapPaths.userReapCommands, `${cmd}.md`);
|
|
9605
9595
|
await writeTextFile(dest, await readTextFileOrThrow(src));
|
|
9606
9596
|
}
|
|
9607
|
-
await mkdir2(this.commandsDir, { recursive: true });
|
|
9608
|
-
for (const cmd of commandNames) {
|
|
9609
|
-
const dest = join3(this.commandsDir, `${cmd}.md`);
|
|
9610
|
-
const redirectContent = `---
|
|
9611
|
-
description: "REAP — redirected to ~/.reap/commands/"
|
|
9612
|
-
---
|
|
9613
|
-
Read \`~/.reap/commands/${cmd}.md\` and follow the instructions there.
|
|
9614
|
-
`;
|
|
9615
|
-
await writeTextFile(dest, redirectContent);
|
|
9616
|
-
}
|
|
9617
9597
|
}
|
|
9618
9598
|
async removeStaleCommands(validNames) {
|
|
9619
9599
|
try {
|
|
@@ -10706,32 +10686,21 @@ async function updateProject(projectRoot, dryRun = false) {
|
|
|
10706
10686
|
}
|
|
10707
10687
|
for (const adapter of adapters) {
|
|
10708
10688
|
const agentCmdDir = adapter.getCommandsDir();
|
|
10709
|
-
const label =
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
if (existingContent !== null && existingContent === redirectContent) {
|
|
10722
|
-
result.skipped.push(`[${label}] commands/${file}`);
|
|
10723
|
-
} else {
|
|
10724
|
-
if (!dryRun) {
|
|
10725
|
-
await mkdir6(agentCmdDir, { recursive: true });
|
|
10726
|
-
await writeTextFile(dest, redirectContent);
|
|
10689
|
+
const label = adapter.displayName;
|
|
10690
|
+
try {
|
|
10691
|
+
const existing = await readdir9(agentCmdDir);
|
|
10692
|
+
for (const file of existing) {
|
|
10693
|
+
if (!file.startsWith("reap.") || !file.endsWith(".md"))
|
|
10694
|
+
continue;
|
|
10695
|
+
const filePath = join10(agentCmdDir, file);
|
|
10696
|
+
const content = await readTextFile(filePath);
|
|
10697
|
+
if (content !== null && content.includes("redirected to ~/.reap/commands/")) {
|
|
10698
|
+
if (!dryRun)
|
|
10699
|
+
await unlink3(filePath);
|
|
10700
|
+
result.removed.push(`[${label}] commands/${file} (Phase 2: redirect removed)`);
|
|
10727
10701
|
}
|
|
10728
|
-
result.updated.push(`[${label}] commands/${file}`);
|
|
10729
10702
|
}
|
|
10730
|
-
}
|
|
10731
|
-
const validCommandFiles = new Set(commandFiles);
|
|
10732
|
-
if (!dryRun) {
|
|
10733
|
-
await adapter.removeStaleCommands(validCommandFiles);
|
|
10734
|
-
}
|
|
10703
|
+
} catch {}
|
|
10735
10704
|
}
|
|
10736
10705
|
await mkdir6(ReapPaths.userReapTemplates, { recursive: true });
|
|
10737
10706
|
const artifactFiles = ["01-objective.md", "02-planning.md", "03-implementation.md", "04-validation.md", "05-completion.md"];
|
|
@@ -10970,7 +10939,7 @@ async function fixProject(projectRoot) {
|
|
|
10970
10939
|
// src/cli/index.ts
|
|
10971
10940
|
init_fs();
|
|
10972
10941
|
import { join as join11 } from "path";
|
|
10973
|
-
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.
|
|
10942
|
+
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.5");
|
|
10974
10943
|
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) => {
|
|
10975
10944
|
try {
|
|
10976
10945
|
const cwd = process.cwd();
|
package/package.json
CHANGED
package/scripts/postinstall.cjs
CHANGED
|
@@ -1,56 +1,51 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* postinstall — install REAP slash commands to
|
|
3
|
+
* postinstall — install REAP slash commands to ~/.reap/commands/.
|
|
4
4
|
* Runs after `npm install -g @c-d-cc/reap`.
|
|
5
|
+
* Project-level symlinks are created by session-start.cjs at session time.
|
|
5
6
|
* Graceful: never fails npm install (always exits 0).
|
|
6
7
|
*/
|
|
7
|
-
const {
|
|
8
|
-
const { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync } = require("fs");
|
|
8
|
+
const { readdirSync, readFileSync, writeFileSync, mkdirSync, existsSync, unlinkSync } = require("fs");
|
|
9
9
|
const { join, dirname } = require("path");
|
|
10
10
|
const { homedir } = require("os");
|
|
11
11
|
|
|
12
|
-
const AGENTS = [
|
|
13
|
-
{ name: "Claude Code", bin: "claude", commandsDir: join(homedir(), ".claude", "commands") },
|
|
14
|
-
{ name: "OpenCode", bin: "opencode", commandsDir: join(homedir(), ".config", "opencode", "commands") },
|
|
15
|
-
];
|
|
16
|
-
|
|
17
|
-
function isInstalled(bin) {
|
|
18
|
-
try {
|
|
19
|
-
execSync(`which ${bin}`, { stdio: "ignore" });
|
|
20
|
-
return true;
|
|
21
|
-
} catch {
|
|
22
|
-
return false;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
12
|
try {
|
|
27
13
|
// Resolve commands source: dist/templates/commands/ relative to this script
|
|
28
14
|
const commandsSource = join(dirname(__dirname), "dist", "templates", "commands");
|
|
29
15
|
if (!existsSync(commandsSource)) {
|
|
30
|
-
// During development or if dist not built yet, skip silently
|
|
31
16
|
process.exit(0);
|
|
32
17
|
}
|
|
33
18
|
|
|
34
19
|
const commandFiles = readdirSync(commandsSource).filter(f => f.endsWith(".md"));
|
|
35
20
|
if (commandFiles.length === 0) process.exit(0);
|
|
36
21
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const src = readFileSync(join(commandsSource, file), "utf-8");
|
|
44
|
-
writeFileSync(join(agent.commandsDir, file), src);
|
|
45
|
-
}
|
|
46
|
-
installed++;
|
|
47
|
-
console.log(` reap: ${agent.name} — ${commandFiles.length} slash commands installed`);
|
|
22
|
+
// Install originals to ~/.reap/commands/
|
|
23
|
+
const reapCommandsDir = join(homedir(), ".reap", "commands");
|
|
24
|
+
mkdirSync(reapCommandsDir, { recursive: true });
|
|
25
|
+
for (const file of commandFiles) {
|
|
26
|
+
const src = readFileSync(join(commandsSource, file), "utf-8");
|
|
27
|
+
writeFileSync(join(reapCommandsDir, file), src);
|
|
48
28
|
}
|
|
29
|
+
console.log(` reap: ${commandFiles.length} slash commands installed to ~/.reap/commands/`);
|
|
49
30
|
|
|
50
|
-
|
|
51
|
-
|
|
31
|
+
// Phase 2 cleanup: remove redirect stubs from agent user-level dirs
|
|
32
|
+
const agentDirs = [
|
|
33
|
+
join(homedir(), ".claude", "commands"),
|
|
34
|
+
join(homedir(), ".config", "opencode", "commands"),
|
|
35
|
+
];
|
|
36
|
+
for (const agentDir of agentDirs) {
|
|
37
|
+
if (!existsSync(agentDir)) continue;
|
|
38
|
+
try {
|
|
39
|
+
const files = readdirSync(agentDir).filter(f => f.startsWith("reap.") && f.endsWith(".md"));
|
|
40
|
+
for (const file of files) {
|
|
41
|
+
const filePath = join(agentDir, file);
|
|
42
|
+
const content = readFileSync(filePath, "utf-8");
|
|
43
|
+
if (content.includes("redirected to ~/.reap/commands/")) {
|
|
44
|
+
unlinkSync(filePath);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
} catch { /* best effort */ }
|
|
52
48
|
}
|
|
53
49
|
} catch (err) {
|
|
54
|
-
// Graceful failure — never break npm install
|
|
55
50
|
console.warn(" reap: postinstall warning —", err.message);
|
|
56
51
|
}
|