install-claude-workflow-v2 1.0.2 ā 2.0.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/lib/installer.js +14 -9
- package/package.json +1 -1
package/lib/installer.js
CHANGED
|
@@ -4,6 +4,9 @@ const fs = require("fs");
|
|
|
4
4
|
|
|
5
5
|
const TIMEOUT_MS = 60000; // 60 second timeout for downloads
|
|
6
6
|
|
|
7
|
+
// Only these directories get installed to .claude/
|
|
8
|
+
const INSTALL_DIRS = ["agents", "commands", "hooks", "skills"];
|
|
9
|
+
|
|
7
10
|
/**
|
|
8
11
|
* Validate GitHub repository format
|
|
9
12
|
* @param {string} repo - Repository string to validate
|
|
@@ -32,13 +35,6 @@ async function install(repo, name) {
|
|
|
32
35
|
// MEDIUM-1 FIX: Use PID-based temp directory to prevent race conditions
|
|
33
36
|
const tempTarget = path.join(cwd, `.claude-temp-install-${process.pid}`);
|
|
34
37
|
|
|
35
|
-
// Check if plugin manifest already exists
|
|
36
|
-
if (fs.existsSync(path.join(target, ".claude-plugin"))) {
|
|
37
|
-
throw new Error(
|
|
38
|
-
`Plugin already installed at .claude/\nTo update: rm -rf .claude/.claude-plugin && npx add-skill ${name}`
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
38
|
const hasExisting = fs.existsSync(target);
|
|
43
39
|
if (hasExisting) {
|
|
44
40
|
console.log(`\nš Found existing .claude/ - will merge (nothing deleted)`);
|
|
@@ -92,9 +88,18 @@ async function install(repo, name) {
|
|
|
92
88
|
fs.mkdirSync(target, { recursive: true });
|
|
93
89
|
}
|
|
94
90
|
|
|
95
|
-
// Merge: copy
|
|
91
|
+
// Merge: copy only agents, commands, hooks, skills to target
|
|
96
92
|
const stats = { added: 0, skipped: 0 };
|
|
97
|
-
|
|
93
|
+
for (const dir of INSTALL_DIRS) {
|
|
94
|
+
const srcDir = path.join(tempTarget, dir);
|
|
95
|
+
const destDir = path.join(target, dir);
|
|
96
|
+
if (fs.existsSync(srcDir)) {
|
|
97
|
+
if (!fs.existsSync(destDir)) {
|
|
98
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
99
|
+
}
|
|
100
|
+
mergeDirectories(srcDir, destDir, stats);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
98
103
|
|
|
99
104
|
// Clean up temp
|
|
100
105
|
fs.rmSync(tempTarget, { recursive: true, force: true });
|