install-claude-workflow-v2 1.0.0 → 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/bin/cli.js CHANGED
@@ -26,7 +26,9 @@ Repository: https://github.com/CloudAI-X/claude-workflow
26
26
  }
27
27
 
28
28
  // Run the installer
29
- install(REPO, NAME).catch((err) => {
30
- console.error(`\n❌ ${err.message}`);
31
- process.exit(1);
32
- });
29
+ install(REPO, NAME)
30
+ .then(() => process.exit(0))
31
+ .catch((err) => {
32
+ console.error(`\n❌ ${err.message}`);
33
+ process.exit(1);
34
+ });
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)`);
@@ -58,12 +54,15 @@ async function install(repo, name) {
58
54
  verbose: false,
59
55
  });
60
56
 
57
+ let timeoutId;
61
58
  try {
62
- const timeoutPromise = new Promise((_, reject) =>
63
- setTimeout(() => reject(new Error("Download timed out after 60 seconds")), TIMEOUT_MS)
64
- );
59
+ const timeoutPromise = new Promise((_, reject) => {
60
+ timeoutId = setTimeout(() => reject(new Error("Download timed out after 60 seconds")), TIMEOUT_MS);
61
+ });
65
62
  await Promise.race([emitter.clone(tempTarget), timeoutPromise]);
63
+ clearTimeout(timeoutId);
66
64
  } catch (err) {
65
+ clearTimeout(timeoutId);
67
66
  // Clean up temp on failure
68
67
  if (fs.existsSync(tempTarget)) {
69
68
  fs.rmSync(tempTarget, { recursive: true, force: true });
@@ -89,9 +88,18 @@ async function install(repo, name) {
89
88
  fs.mkdirSync(target, { recursive: true });
90
89
  }
91
90
 
92
- // Merge: copy from temp to target, preserving existing files
91
+ // Merge: copy only agents, commands, hooks, skills to target
93
92
  const stats = { added: 0, skipped: 0 };
94
- mergeDirectories(tempTarget, target, stats);
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
+ }
95
103
 
96
104
  // Clean up temp
97
105
  fs.rmSync(tempTarget, { recursive: true, force: true });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "install-claude-workflow-v2",
3
- "version": "1.0.0",
3
+ "version": "2.0.3",
4
4
  "type": "commonjs",
5
5
  "description": "Install Claude Code skills and plugins via npx",
6
6
  "bin": {