claude-flow 1.0.13 → 1.0.14
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/src/cli/main.js +53 -14
package/package.json
CHANGED
package/src/cli/main.js
CHANGED
|
@@ -129,29 +129,68 @@ function main() {
|
|
|
129
129
|
process.exit(1);
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// Try to use the
|
|
133
|
-
const
|
|
132
|
+
// Try to use the full TypeScript CLI first
|
|
133
|
+
const mainTsPath = path.join(__dirname, 'main.ts');
|
|
134
|
+
const cliCorePath = path.join(__dirname, 'cli-core.ts');
|
|
134
135
|
|
|
135
|
-
|
|
136
|
-
|
|
136
|
+
// Check which TypeScript file exists and use it
|
|
137
|
+
let tsPath = null;
|
|
138
|
+
if (fs.existsSync(mainTsPath)) {
|
|
139
|
+
tsPath = mainTsPath;
|
|
140
|
+
} else if (fs.existsSync(cliCorePath)) {
|
|
141
|
+
// If cli-core exists, we have the full implementation
|
|
142
|
+
tsPath = mainTsPath; // Still use main.ts as entry point
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (tsPath && fs.existsSync(tsPath)) {
|
|
146
|
+
const child = spawn(denoPath, ['run', '--allow-all', tsPath, ...args], {
|
|
137
147
|
stdio: 'inherit',
|
|
138
148
|
env: process.env
|
|
139
149
|
});
|
|
140
150
|
|
|
141
151
|
child.on('error', (err) => {
|
|
142
|
-
|
|
143
|
-
console.
|
|
144
|
-
|
|
152
|
+
// If TypeScript fails, fall back to simple CLI
|
|
153
|
+
console.warn('Failed to run TypeScript CLI, falling back to simple mode...');
|
|
154
|
+
runSimpleCLI();
|
|
145
155
|
});
|
|
146
156
|
|
|
147
|
-
child.on('exit', (code) =>
|
|
157
|
+
child.on('exit', (code) => {
|
|
158
|
+
if (code !== 0) {
|
|
159
|
+
// If TypeScript CLI failed, try simple CLI
|
|
160
|
+
runSimpleCLI();
|
|
161
|
+
} else {
|
|
162
|
+
process.exit(0);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
148
165
|
} else {
|
|
149
|
-
//
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
166
|
+
// No TypeScript files found, use simple CLI
|
|
167
|
+
runSimpleCLI();
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function runSimpleCLI() {
|
|
171
|
+
const simplePath = path.join(__dirname, 'simple-cli.js');
|
|
172
|
+
|
|
173
|
+
if (fs.existsSync(simplePath)) {
|
|
174
|
+
const child = spawn(denoPath, ['run', '--allow-all', simplePath, ...args], {
|
|
175
|
+
stdio: 'inherit',
|
|
176
|
+
env: process.env
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
child.on('error', (err) => {
|
|
180
|
+
console.error(`${colors.red}❌ Error: Failed to execute command${colors.reset}`);
|
|
181
|
+
console.error(err.message);
|
|
182
|
+
process.exit(1);
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
186
|
+
} else {
|
|
187
|
+
// If we can't find the files, show a helpful error
|
|
188
|
+
console.error(`${colors.red}❌ Error: Claude-Flow CLI files not found${colors.reset}`);
|
|
189
|
+
console.error('This might be a packaging issue. Please try:');
|
|
190
|
+
console.error(' 1. Clone from source: git clone https://github.com/ruvnet/claude-code-flow');
|
|
191
|
+
console.error(' 2. Run: cd claude-code-flow && npm install');
|
|
192
|
+
process.exit(1);
|
|
193
|
+
}
|
|
155
194
|
}
|
|
156
195
|
}
|
|
157
196
|
|