@c-d-cc/reap 0.7.6 → 0.7.8
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 -12
- package/dist/templates/hooks/session-start.cjs +13 -10
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -10762,17 +10762,6 @@ async function updateProject(projectRoot, dryRun = false) {
|
|
|
10762
10762
|
async function migrateLegacyFiles(paths, dryRun, result) {
|
|
10763
10763
|
await removeDirIfExists(paths.legacyCommands, ".reap/commands/", dryRun, result);
|
|
10764
10764
|
await removeDirIfExists(paths.legacyTemplates, ".reap/templates/", dryRun, result);
|
|
10765
|
-
try {
|
|
10766
|
-
const claudeCmdDir = paths.legacyClaudeCommands;
|
|
10767
|
-
const files = await readdir9(claudeCmdDir);
|
|
10768
|
-
for (const file of files) {
|
|
10769
|
-
if (file.startsWith("reap.") && file.endsWith(".md")) {
|
|
10770
|
-
if (!dryRun)
|
|
10771
|
-
await unlink3(join10(claudeCmdDir, file));
|
|
10772
|
-
result.removed.push(`.claude/commands/${file}`);
|
|
10773
|
-
}
|
|
10774
|
-
}
|
|
10775
|
-
} catch {}
|
|
10776
10765
|
try {
|
|
10777
10766
|
const legacyHooksJson = paths.legacyClaudeHooksJson;
|
|
10778
10767
|
const fileContent = await readTextFile(legacyHooksJson);
|
|
@@ -10906,7 +10895,7 @@ async function fixProject(projectRoot) {
|
|
|
10906
10895
|
// src/cli/index.ts
|
|
10907
10896
|
init_fs();
|
|
10908
10897
|
import { join as join11 } from "path";
|
|
10909
|
-
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.
|
|
10898
|
+
program.name("reap").description("REAP — Recursive Evolutionary Autonomous Pipeline").version("0.7.8");
|
|
10910
10899
|
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) => {
|
|
10911
10900
|
try {
|
|
10912
10901
|
const cwd = process.cwd();
|
|
@@ -28,7 +28,7 @@ if (!gl.dirExists(reapDir)) {
|
|
|
28
28
|
process.exit(0);
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
// Step 0: Install project-level command symlinks
|
|
31
|
+
// Step 0: Install project-level command files (copy, not symlink — Claude Code doesn't follow symlinks)
|
|
32
32
|
const fs = require('fs');
|
|
33
33
|
const os = require('os');
|
|
34
34
|
const userReapCommands = path.join(os.homedir(), '.reap', 'commands');
|
|
@@ -38,34 +38,37 @@ if (gl.dirExists(userReapCommands)) {
|
|
|
38
38
|
try {
|
|
39
39
|
fs.mkdirSync(projectClaudeCommands, { recursive: true });
|
|
40
40
|
const cmdFiles = fs.readdirSync(userReapCommands).filter(f => f.startsWith('reap.') && f.endsWith('.md'));
|
|
41
|
+
let installed = 0;
|
|
41
42
|
for (const file of cmdFiles) {
|
|
42
43
|
const src = path.join(userReapCommands, file);
|
|
43
44
|
const dest = path.join(projectClaudeCommands, file);
|
|
44
45
|
try {
|
|
45
46
|
const stat = fs.lstatSync(dest);
|
|
46
47
|
if (stat.isSymbolicLink()) {
|
|
47
|
-
|
|
48
|
-
if (target === src) continue; // already correct
|
|
49
|
-
fs.unlinkSync(dest); // stale symlink
|
|
48
|
+
fs.unlinkSync(dest); // replace legacy symlink with real file
|
|
50
49
|
} else {
|
|
51
|
-
//
|
|
50
|
+
// Skip if content is identical
|
|
51
|
+
const srcContent = fs.readFileSync(src);
|
|
52
|
+
const destContent = fs.readFileSync(dest);
|
|
53
|
+
if (srcContent.equals(destContent)) continue;
|
|
52
54
|
fs.unlinkSync(dest);
|
|
53
55
|
}
|
|
54
56
|
} catch { /* dest doesn't exist */ }
|
|
55
|
-
fs.
|
|
57
|
+
fs.copyFileSync(src, dest);
|
|
58
|
+
installed++;
|
|
56
59
|
}
|
|
57
|
-
// Ensure .gitignore excludes these
|
|
60
|
+
// Ensure .gitignore excludes these files
|
|
58
61
|
const gitignorePath = path.join(projectRoot, '.gitignore');
|
|
59
62
|
const gitignoreEntry = '.claude/commands/reap.*';
|
|
60
63
|
try {
|
|
61
64
|
const gitignore = fs.existsSync(gitignorePath) ? fs.readFileSync(gitignorePath, 'utf-8') : '';
|
|
62
65
|
if (!gitignore.includes(gitignoreEntry)) {
|
|
63
|
-
fs.appendFileSync(gitignorePath, `\n# REAP command
|
|
66
|
+
fs.appendFileSync(gitignorePath, `\n# REAP command files (managed by session-start hook)\n${gitignoreEntry}\n`);
|
|
64
67
|
}
|
|
65
68
|
} catch { /* best effort */ }
|
|
66
|
-
process.stderr.write(`[REAP]
|
|
69
|
+
process.stderr.write(`[REAP] Installed ${installed} commands to .claude/commands/ (${cmdFiles.length - installed} unchanged)\n`);
|
|
67
70
|
} catch (err) {
|
|
68
|
-
process.stderr.write(`[REAP] Warning: failed to
|
|
71
|
+
process.stderr.write(`[REAP] Warning: failed to install commands: ${err.message}\n`);
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
|