@c-d-cc/reap 0.7.4 → 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 +1 -1
- package/package.json +1 -1
- package/scripts/postinstall.cjs +27 -32
package/dist/cli.js
CHANGED
|
@@ -10939,7 +10939,7 @@ async function fixProject(projectRoot) {
|
|
|
10939
10939
|
// src/cli/index.ts
|
|
10940
10940
|
init_fs();
|
|
10941
10941
|
import { join as join11 } from "path";
|
|
10942
|
-
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");
|
|
10943
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) => {
|
|
10944
10944
|
try {
|
|
10945
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
|
}
|