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.
- package/dist/scripts/postinstall.js +8 -113
- package/package.json +1 -1
- package/scripts/postinstall.js +8 -113
|
@@ -2,70 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Post-installation script for claude-flow-novice
|
|
5
|
-
* Copies .claude directory from
|
|
6
|
-
*
|
|
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,
|
|
10
|
-
import { dirname, join
|
|
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
|
-
//
|
|
108
|
-
|
|
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
|
|
47
|
+
console.log('ā
Successfully installed .claude directory');
|
|
118
48
|
console.log('š Location:', targetDir);
|
|
119
49
|
|
|
120
|
-
|
|
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
package/scripts/postinstall.js
CHANGED
|
@@ -2,70 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Post-installation script for claude-flow-novice
|
|
5
|
-
* Copies .claude directory from
|
|
6
|
-
*
|
|
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,
|
|
10
|
-
import { dirname, join
|
|
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
|
-
//
|
|
108
|
-
|
|
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
|
|
47
|
+
console.log('ā
Successfully installed .claude directory');
|
|
118
48
|
console.log('š Location:', targetDir);
|
|
119
49
|
|
|
120
|
-
|
|
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);
|