claude-flow-novice 2.10.0 → 2.10.2
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/package.json +1 -1
- package/scripts/init-project.js +52 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claude-flow-novice",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.2",
|
|
4
4
|
"description": "AI agent orchestration framework with namespace-isolated skills, agents, and CFN Loop validation. Safe installation with ~0.01% collision risk.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
package/scripts/init-project.js
CHANGED
|
@@ -15,7 +15,26 @@ const mkdirAsync = promisify(fs.mkdir);
|
|
|
15
15
|
const existsAsync = promisify(fs.exists);
|
|
16
16
|
|
|
17
17
|
// Find the CFN package root (works both in dev and installed contexts)
|
|
18
|
-
|
|
18
|
+
function findCfnRoot() {
|
|
19
|
+
// During postinstall, we're inside the package being installed
|
|
20
|
+
const packageJsonPath = path.resolve(__dirname, '..', 'package.json');
|
|
21
|
+
if (fs.existsSync(packageJsonPath)) {
|
|
22
|
+
try {
|
|
23
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
24
|
+
if (pkg.name === 'claude-flow-novice') {
|
|
25
|
+
// We're running from within the claude-flow-novice package (postinstall)
|
|
26
|
+
return path.resolve(__dirname, '..');
|
|
27
|
+
}
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// Not a valid package.json, continue
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// We're running from a project that has installed claude-flow-novice
|
|
34
|
+
return path.resolve(process.cwd(), 'node_modules', 'claude-flow-novice');
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const cfnRoot = findCfnRoot();
|
|
19
38
|
|
|
20
39
|
// Configuration for CFN initialization paths
|
|
21
40
|
const CFN_PATHS = {
|
|
@@ -66,14 +85,28 @@ async function ensureDirectories() {
|
|
|
66
85
|
}
|
|
67
86
|
|
|
68
87
|
async function verifyCfnInstallation() {
|
|
69
|
-
|
|
70
|
-
if (!fs.existsSync(
|
|
71
|
-
console.error(chalk.red('❌ claude-flow-novice
|
|
88
|
+
// Check if cfnRoot exists (works during postinstall and after install)
|
|
89
|
+
if (!fs.existsSync(cfnRoot)) {
|
|
90
|
+
console.error(chalk.red('❌ claude-flow-novice package root not found'));
|
|
91
|
+
console.error(chalk.yellow('cfnRoot:', cfnRoot));
|
|
72
92
|
process.exit(1);
|
|
73
93
|
}
|
|
94
|
+
|
|
95
|
+
// Verify critical directories exist
|
|
96
|
+
const criticalPaths = [
|
|
97
|
+
path.join(cfnRoot, '.claude/agents/cfn-dev-team'),
|
|
98
|
+
path.join(cfnRoot, '.claude/skills')
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
for (const p of criticalPaths) {
|
|
102
|
+
if (!fs.existsSync(p)) {
|
|
103
|
+
console.error(chalk.red(`❌ Critical path missing: ${p}`));
|
|
104
|
+
process.exit(1);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
74
107
|
}
|
|
75
108
|
|
|
76
|
-
async function copyFiles(src, dest, pattern) {
|
|
109
|
+
async function copyFiles(src, dest, pattern, forceOverwrite = true) {
|
|
77
110
|
try {
|
|
78
111
|
if (!fs.existsSync(src)) {
|
|
79
112
|
console.warn(chalk.yellow(`⚠️ Source not found: ${src}`));
|
|
@@ -88,15 +121,26 @@ async function copyFiles(src, dest, pattern) {
|
|
|
88
121
|
for (const item of matched) {
|
|
89
122
|
const itemSrc = path.join(src, item);
|
|
90
123
|
const itemDest = path.join(dest, item);
|
|
124
|
+
|
|
125
|
+
// For cfn-prefixed items, remove existing to ensure clean update
|
|
126
|
+
if (forceOverwrite && fs.existsSync(itemDest)) {
|
|
127
|
+
fs.rmSync(itemDest, { recursive: true, force: true });
|
|
128
|
+
}
|
|
129
|
+
|
|
91
130
|
await mkdirAsync(path.dirname(itemDest), { recursive: true });
|
|
92
131
|
await cpAsync(itemSrc, itemDest, { recursive: true, force: true });
|
|
93
132
|
}
|
|
94
|
-
console.log(chalk.green(`✅ Copied ${matched.length} ${pattern} items from ${src}`));
|
|
133
|
+
console.log(chalk.green(`✅ Copied ${matched.length} ${pattern} items from ${src} (overwrite: ${forceOverwrite})`));
|
|
95
134
|
} else {
|
|
96
|
-
// Copy entire directory
|
|
135
|
+
// Copy entire directory (e.g., cfn-dev-team)
|
|
136
|
+
// Remove existing destination to ensure clean update
|
|
137
|
+
if (forceOverwrite && fs.existsSync(dest)) {
|
|
138
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
139
|
+
}
|
|
140
|
+
|
|
97
141
|
await mkdirAsync(path.dirname(dest), { recursive: true });
|
|
98
142
|
await cpAsync(src, dest, { recursive: true, force: true });
|
|
99
|
-
console.log(chalk.green(`✅ Copied ${src} → ${dest}`));
|
|
143
|
+
console.log(chalk.green(`✅ Copied ${src} → ${dest} (overwrite: ${forceOverwrite})`));
|
|
100
144
|
}
|
|
101
145
|
return true;
|
|
102
146
|
} catch (error) {
|