stigmergy 1.3.17-beta.0 → 1.3.18-beta.0
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/core/installer.js +33 -23
package/package.json
CHANGED
package/src/core/installer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const chalk = require('chalk');
|
|
1
2
|
const path = require('path');
|
|
2
3
|
const fs = require('fs/promises');
|
|
3
4
|
const os = require('os');
|
|
@@ -11,6 +12,7 @@ const EnhancedCLIInstaller = require('./enhanced_cli_installer');
|
|
|
11
12
|
class StigmergyInstaller extends EnhancedCLIInstaller {
|
|
12
13
|
constructor(options = {}) {
|
|
13
14
|
super(options);
|
|
15
|
+
this.concurrency = options.concurrency || 4;
|
|
14
16
|
this.router = new SmartRouter();
|
|
15
17
|
this.memory = new MemoryManager();
|
|
16
18
|
this.configDir = path.join(os.homedir(), '.stigmergy');
|
|
@@ -375,43 +377,39 @@ class StigmergyInstaller extends EnhancedCLIInstaller {
|
|
|
375
377
|
*/
|
|
376
378
|
async deployHooks(available) {
|
|
377
379
|
console.log('\n[DEPLOY] Deploying cross-CLI integration hooks...');
|
|
380
|
+
console.log(chalk.blue(`[INFO] Using parallel deployment with concurrency: ${this.concurrency || 4}`));
|
|
378
381
|
|
|
379
382
|
const HookDeploymentManager = require('./coordination/nodejs/HookDeploymentManager');
|
|
380
383
|
const hookManager = new HookDeploymentManager();
|
|
381
384
|
|
|
382
385
|
await hookManager.initialize();
|
|
383
386
|
|
|
387
|
+
const toolEntries = Object.entries(available);
|
|
384
388
|
let successCount = 0;
|
|
385
|
-
let totalCount =
|
|
386
|
-
|
|
387
|
-
for (const [toolName, toolInfo] of Object.entries(available)) {
|
|
388
|
-
console.log(`\n[DEPLOY] Deploying hooks for ${toolInfo.name}...`);
|
|
389
|
+
let totalCount = toolEntries.length;
|
|
390
|
+
const concurrency = this.concurrency || 4;
|
|
389
391
|
|
|
392
|
+
const deployForTool = async ([toolName, toolInfo]) => {
|
|
393
|
+
const startTime = Date.now();
|
|
394
|
+
|
|
390
395
|
try {
|
|
391
396
|
const fs = require('fs/promises');
|
|
392
397
|
const path = require('path');
|
|
393
398
|
|
|
394
|
-
// Create hooks directory
|
|
395
399
|
await fs.mkdir(toolInfo.hooksDir, { recursive: true });
|
|
396
|
-
console.log(`[OK] Created hooks directory: ${toolInfo.hooksDir}`);
|
|
397
|
-
|
|
398
|
-
// Create config directory
|
|
399
400
|
const configDir = path.dirname(toolInfo.config);
|
|
400
401
|
await fs.mkdir(configDir, { recursive: true });
|
|
401
|
-
console.log(`[OK] Created config directory: ${configDir}`);
|
|
402
402
|
|
|
403
|
-
// Use HookDeploymentManager to deploy Node.js hooks
|
|
404
403
|
const deploySuccess = await hookManager.deployHooksForCLI(toolName);
|
|
405
404
|
|
|
406
405
|
if (deploySuccess) {
|
|
407
|
-
|
|
406
|
+
await this.installToolIntegration(toolName, toolInfo);
|
|
407
|
+
const duration = Date.now() - startTime;
|
|
408
|
+
console.log(`[OK] ${toolInfo.name} deployed successfully (${duration}ms)`);
|
|
409
|
+
return { success: true, toolName, duration };
|
|
408
410
|
}
|
|
409
411
|
|
|
410
|
-
|
|
411
|
-
await this.installToolIntegration(toolName, toolInfo);
|
|
412
|
-
|
|
413
|
-
console.log(`[OK] Hooks deployed successfully for ${toolInfo.name}`);
|
|
414
|
-
successCount++;
|
|
412
|
+
return { success: false, toolName, duration: Date.now() - startTime };
|
|
415
413
|
|
|
416
414
|
} catch (error) {
|
|
417
415
|
const { errorHandler } = require('./error_handler');
|
|
@@ -420,16 +418,28 @@ class StigmergyInstaller extends EnhancedCLIInstaller {
|
|
|
420
418
|
'ERROR',
|
|
421
419
|
`StigmergyInstaller.deployHooks.${toolName}`,
|
|
422
420
|
);
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
);
|
|
426
|
-
|
|
421
|
+
|
|
422
|
+
const duration = Date.now() - startTime;
|
|
423
|
+
console.log(`[ERROR] Failed to deploy hooks for ${toolInfo.name}: ${error.message} (${duration}ms)`);
|
|
424
|
+
|
|
425
|
+
return { success: false, toolName, duration, error: error.message };
|
|
427
426
|
}
|
|
427
|
+
};
|
|
428
|
+
|
|
429
|
+
const results = [];
|
|
430
|
+
for (let i = 0; i < toolEntries.length; i += concurrency) {
|
|
431
|
+
const batch = toolEntries.slice(i, i + concurrency);
|
|
432
|
+
const batchResults = await Promise.all(batch.map(deployForTool));
|
|
433
|
+
results.push(...batchResults);
|
|
428
434
|
}
|
|
429
435
|
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
436
|
+
successCount = results.filter(r => r.success).length;
|
|
437
|
+
const totalDuration = Math.max(...results.map(r => r.duration));
|
|
438
|
+
|
|
439
|
+
console.log(`\n[SUMMARY] Hook deployment completed: ${successCount}/${totalCount} tools successful`);
|
|
440
|
+
console.log(chalk.blue(`[PERFORMANCE] Total deployment time: ${totalDuration}ms`));
|
|
441
|
+
console.log(chalk.blue(`[PERFORMANCE] Average per tool: ${Math.round(totalDuration / totalCount)}ms`));
|
|
442
|
+
|
|
433
443
|
return successCount > 0;
|
|
434
444
|
}
|
|
435
445
|
|