claude-flow-novice 2.3.3 → 2.3.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.
@@ -2,70 +2,17 @@
2
2
 
3
3
  /**
4
4
  * Post-installation script for claude-flow-novice
5
- * Copies .claude directory from node_modules to project root
6
- * Preserves existing custom files unless CLAUDE_FORCE_UPDATE=true
5
+ * Copies .claude directory from package to project root
6
+ * Overwrites existing files to ensure updates work correctly
7
7
  */
8
8
 
9
- import { existsSync, mkdirSync, cpSync, readdirSync, statSync, copyFileSync } from 'fs';
10
- import { dirname, join, relative } from 'path';
9
+ import { existsSync, cpSync } from 'fs';
10
+ import { dirname, join } from 'path';
11
11
  import { fileURLToPath } from 'url';
12
12
 
13
13
  const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = dirname(__filename);
15
15
 
16
- const stats = {
17
- copied: [],
18
- skipped: [],
19
- updated: []
20
- };
21
-
22
- /**
23
- * Recursively copy files, skipping existing ones unless forced
24
- */
25
- function smartCopy(source, target, forceUpdate = false, verbose = false) {
26
- if (!existsSync(source)) return;
27
-
28
- const stat = statSync(source);
29
-
30
- if (stat.isDirectory()) {
31
- // Create directory if it doesn't exist
32
- if (!existsSync(target)) {
33
- mkdirSync(target, { recursive: true });
34
- }
35
-
36
- // Copy contents
37
- const entries = readdirSync(source);
38
- for (const entry of entries) {
39
- smartCopy(join(source, entry), join(target, entry), forceUpdate, verbose);
40
- }
41
- } else {
42
- // File - check if it exists
43
- const targetExists = existsSync(target);
44
- const relativePath = relative(process.cwd(), target);
45
-
46
- if (!targetExists) {
47
- // New file - always copy
48
- copyFileSync(source, target);
49
- stats.copied.push(relativePath);
50
- if (verbose) {
51
- console.log(` āœ… ${relativePath}`);
52
- }
53
- } else if (forceUpdate) {
54
- // Existing file + force update - overwrite
55
- copyFileSync(source, target);
56
- stats.updated.push(relativePath);
57
- if (verbose) {
58
- console.log(` šŸ”„ ${relativePath}`);
59
- }
60
- } else {
61
- // Existing file - skip to preserve custom changes
62
- stats.skipped.push(relativePath);
63
- if (verbose) {
64
- console.log(` ā­ļø ${relativePath}`);
65
- }
66
- }
67
- }
68
- }
69
16
 
70
17
  /**
71
18
  * Copy .claude directory from node_modules to project root
@@ -83,19 +30,9 @@ function copyClaudeDirectory() {
83
30
 
84
31
  const sourceDir = possibleSources.find(dir => existsSync(dir));
85
32
  const targetDir = join(projectRoot, '.claude');
86
- const forceUpdate = process.env.CLAUDE_FORCE_UPDATE === 'true';
87
- const verbose = process.env.CLAUDE_VERBOSE === 'true' || process.env.npm_config_loglevel === 'verbose';
88
33
 
89
34
  console.log('šŸš€ claude-flow-novice post-install: Setting up .claude directory...');
90
35
 
91
- if (forceUpdate) {
92
- console.log('āš ļø CLAUDE_FORCE_UPDATE=true - will overwrite existing files');
93
- }
94
-
95
- if (verbose) {
96
- console.log('šŸ“¢ Verbose mode enabled - showing all file operations\n');
97
- }
98
-
99
36
  // Check if source directory was found
100
37
  if (!sourceDir) {
101
38
  console.error('āŒ Source .claude directory not found. Tried:');
@@ -104,55 +41,13 @@ function copyClaudeDirectory() {
104
41
  process.exit(1);
105
42
  }
106
43
 
107
- // Create target directory if it doesn't exist
108
- const isNewInstall = !existsSync(targetDir);
109
- if (isNewInstall) {
110
- mkdirSync(targetDir, { recursive: true });
111
- console.log('āœ… Created .claude directory in project root');
112
- }
113
-
114
- // Smart copy - preserve existing files
115
- smartCopy(sourceDir, targetDir, forceUpdate, verbose);
44
+ // Copy entire directory, overwriting existing files
45
+ cpSync(sourceDir, targetDir, { recursive: true, force: true });
116
46
 
117
- console.log('āœ… Successfully synced .claude directory');
47
+ console.log('āœ… Successfully installed .claude directory');
118
48
  console.log('šŸ“ Location:', targetDir);
119
49
 
120
- // Report statistics
121
- console.log('\nšŸ“Š Installation Summary:');
122
- console.log(` āœ… New files copied: ${stats.copied.length}`);
123
- console.log(` ā­ļø Existing files preserved: ${stats.skipped.length}`);
124
- if (stats.updated.length > 0) {
125
- console.log(` šŸ”„ Files updated (forced): ${stats.updated.length}`);
126
- }
127
-
128
- if (stats.skipped.length > 0 && !isNewInstall) {
129
- console.log('\nšŸ’” Tip: Your custom agents and configurations were preserved.');
130
- console.log(' To force update all files: CLAUDE_FORCE_UPDATE=true npx claude-flow-novice@latest');
131
- console.log(' To see all file operations: CLAUDE_VERBOSE=true npx claude-flow-novice@latest');
132
- }
133
-
134
- // Verify key components
135
- const agentsDir = join(targetDir, 'agents');
136
- const commandsDir = join(targetDir, 'commands');
137
- const coreDir = join(targetDir, 'core');
138
-
139
- if (existsSync(agentsDir)) {
140
- const agentFiles = readdirSync(agentsDir).length;
141
- console.log(`\nšŸ“‹ Total agents available: ${agentFiles}`);
142
- }
143
-
144
- if (existsSync(commandsDir)) {
145
- const commandFiles = readdirSync(commandsDir).length;
146
- console.log(`⚔ Total commands available: ${commandFiles}`);
147
- }
148
-
149
- if (existsSync(coreDir)) {
150
- const coreFiles = readdirSync(coreDir).length;
151
- console.log(`šŸ”§ Total core files: ${coreFiles}`);
152
- }
153
-
154
- console.log('\nšŸŽ‰ Installation complete! claude-flow-novice is ready to use.');
155
- console.log('šŸŽÆ Run: npx claude-flow-novice --help');
50
+ console.log('šŸŽ‰ Installation complete! claude-flow-novice is ready to use.');
156
51
 
157
52
  } catch (error) {
158
53
  console.error('āŒ Post-install script failed:', error.message);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-flow-novice",
3
- "version": "2.3.3",
3
+ "version": "2.3.5",
4
4
  "description": "Simplified Claude Flow for beginners - AI agent orchestration made easy",
5
5
  "type": "module",
6
6
  "mcpName": "io.github.ruvnet/claude-flow",
@@ -2,70 +2,17 @@
2
2
 
3
3
  /**
4
4
  * Post-installation script for claude-flow-novice
5
- * Copies .claude directory from node_modules to project root
6
- * Preserves existing custom files unless CLAUDE_FORCE_UPDATE=true
5
+ * Copies .claude directory from package to project root
6
+ * Overwrites existing files to ensure updates work correctly
7
7
  */
8
8
 
9
- import { existsSync, mkdirSync, cpSync, readdirSync, statSync, copyFileSync } from 'fs';
10
- import { dirname, join, relative } from 'path';
9
+ import { existsSync, cpSync } from 'fs';
10
+ import { dirname, join } from 'path';
11
11
  import { fileURLToPath } from 'url';
12
12
 
13
13
  const __filename = fileURLToPath(import.meta.url);
14
14
  const __dirname = dirname(__filename);
15
15
 
16
- const stats = {
17
- copied: [],
18
- skipped: [],
19
- updated: []
20
- };
21
-
22
- /**
23
- * Recursively copy files, skipping existing ones unless forced
24
- */
25
- function smartCopy(source, target, forceUpdate = false, verbose = false) {
26
- if (!existsSync(source)) return;
27
-
28
- const stat = statSync(source);
29
-
30
- if (stat.isDirectory()) {
31
- // Create directory if it doesn't exist
32
- if (!existsSync(target)) {
33
- mkdirSync(target, { recursive: true });
34
- }
35
-
36
- // Copy contents
37
- const entries = readdirSync(source);
38
- for (const entry of entries) {
39
- smartCopy(join(source, entry), join(target, entry), forceUpdate, verbose);
40
- }
41
- } else {
42
- // File - check if it exists
43
- const targetExists = existsSync(target);
44
- const relativePath = relative(process.cwd(), target);
45
-
46
- if (!targetExists) {
47
- // New file - always copy
48
- copyFileSync(source, target);
49
- stats.copied.push(relativePath);
50
- if (verbose) {
51
- console.log(` āœ… ${relativePath}`);
52
- }
53
- } else if (forceUpdate) {
54
- // Existing file + force update - overwrite
55
- copyFileSync(source, target);
56
- stats.updated.push(relativePath);
57
- if (verbose) {
58
- console.log(` šŸ”„ ${relativePath}`);
59
- }
60
- } else {
61
- // Existing file - skip to preserve custom changes
62
- stats.skipped.push(relativePath);
63
- if (verbose) {
64
- console.log(` ā­ļø ${relativePath}`);
65
- }
66
- }
67
- }
68
- }
69
16
 
70
17
  /**
71
18
  * Copy .claude directory from node_modules to project root
@@ -83,19 +30,9 @@ function copyClaudeDirectory() {
83
30
 
84
31
  const sourceDir = possibleSources.find(dir => existsSync(dir));
85
32
  const targetDir = join(projectRoot, '.claude');
86
- const forceUpdate = process.env.CLAUDE_FORCE_UPDATE === 'true';
87
- const verbose = process.env.CLAUDE_VERBOSE === 'true' || process.env.npm_config_loglevel === 'verbose';
88
33
 
89
34
  console.log('šŸš€ claude-flow-novice post-install: Setting up .claude directory...');
90
35
 
91
- if (forceUpdate) {
92
- console.log('āš ļø CLAUDE_FORCE_UPDATE=true - will overwrite existing files');
93
- }
94
-
95
- if (verbose) {
96
- console.log('šŸ“¢ Verbose mode enabled - showing all file operations\n');
97
- }
98
-
99
36
  // Check if source directory was found
100
37
  if (!sourceDir) {
101
38
  console.error('āŒ Source .claude directory not found. Tried:');
@@ -104,55 +41,13 @@ function copyClaudeDirectory() {
104
41
  process.exit(1);
105
42
  }
106
43
 
107
- // Create target directory if it doesn't exist
108
- const isNewInstall = !existsSync(targetDir);
109
- if (isNewInstall) {
110
- mkdirSync(targetDir, { recursive: true });
111
- console.log('āœ… Created .claude directory in project root');
112
- }
113
-
114
- // Smart copy - preserve existing files
115
- smartCopy(sourceDir, targetDir, forceUpdate, verbose);
44
+ // Copy entire directory, overwriting existing files
45
+ cpSync(sourceDir, targetDir, { recursive: true, force: true });
116
46
 
117
- console.log('āœ… Successfully synced .claude directory');
47
+ console.log('āœ… Successfully installed .claude directory');
118
48
  console.log('šŸ“ Location:', targetDir);
119
49
 
120
- // Report statistics
121
- console.log('\nšŸ“Š Installation Summary:');
122
- console.log(` āœ… New files copied: ${stats.copied.length}`);
123
- console.log(` ā­ļø Existing files preserved: ${stats.skipped.length}`);
124
- if (stats.updated.length > 0) {
125
- console.log(` šŸ”„ Files updated (forced): ${stats.updated.length}`);
126
- }
127
-
128
- if (stats.skipped.length > 0 && !isNewInstall) {
129
- console.log('\nšŸ’” Tip: Your custom agents and configurations were preserved.');
130
- console.log(' To force update all files: CLAUDE_FORCE_UPDATE=true npx claude-flow-novice@latest');
131
- console.log(' To see all file operations: CLAUDE_VERBOSE=true npx claude-flow-novice@latest');
132
- }
133
-
134
- // Verify key components
135
- const agentsDir = join(targetDir, 'agents');
136
- const commandsDir = join(targetDir, 'commands');
137
- const coreDir = join(targetDir, 'core');
138
-
139
- if (existsSync(agentsDir)) {
140
- const agentFiles = readdirSync(agentsDir).length;
141
- console.log(`\nšŸ“‹ Total agents available: ${agentFiles}`);
142
- }
143
-
144
- if (existsSync(commandsDir)) {
145
- const commandFiles = readdirSync(commandsDir).length;
146
- console.log(`⚔ Total commands available: ${commandFiles}`);
147
- }
148
-
149
- if (existsSync(coreDir)) {
150
- const coreFiles = readdirSync(coreDir).length;
151
- console.log(`šŸ”§ Total core files: ${coreFiles}`);
152
- }
153
-
154
- console.log('\nšŸŽ‰ Installation complete! claude-flow-novice is ready to use.');
155
- console.log('šŸŽÆ Run: npx claude-flow-novice --help');
50
+ console.log('šŸŽ‰ Installation complete! claude-flow-novice is ready to use.');
156
51
 
157
52
  } catch (error) {
158
53
  console.error('āŒ Post-install script failed:', error.message);