stigmergy 1.3.16-beta.2 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stigmergy",
3
- "version": "1.3.16-beta.2",
3
+ "version": "1.3.18-beta.0",
4
4
  "description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -5,6 +5,7 @@
5
5
 
6
6
  const chalk = require('chalk');
7
7
  const { handleInstallCommand } = require('./install');
8
+ const { handleDeployCommand } = require('./project');
8
9
 
9
10
  /**
10
11
  * Handle auto-install command - Automated installation for npm postinstall
@@ -20,7 +21,7 @@ async function handleAutoInstallCommand(options = {}) {
20
21
 
21
22
  criticalLog(chalk.cyan('šŸš€ STIGMERGY CLI AUTO-INSTALL STARTING'));
22
23
  criticalLog('='.repeat(60));
23
- criticalLog('Installing cross-CLI integration and scanning for AI tools...');
24
+ criticalLog('Installing CLI tools and deploying hooks (including ResumeSession)...');
24
25
  criticalLog('='.repeat(60));
25
26
 
26
27
  console.log(chalk.blue('[AUTO-INSTALL] Stigmergy CLI automated setup'));
@@ -29,7 +30,7 @@ async function handleAutoInstallCommand(options = {}) {
29
30
  // Check if we're in npm postinstall environment
30
31
  if (isNpmPostinstall) {
31
32
  console.log(chalk.yellow('šŸ“¦ Detected npm postinstall environment'));
32
- console.log(chalk.gray('Setting up CLI integrations automatically...'));
33
+ console.log(chalk.gray('Setting up CLI integrations and hooks automatically...'));
33
34
  }
34
35
 
35
36
  // Auto-install options - non-interactive mode
@@ -44,17 +45,16 @@ async function handleAutoInstallCommand(options = {}) {
44
45
 
45
46
  console.log(chalk.blue('šŸ” Scanning for available CLI tools...'));
46
47
 
47
- // Run the installation
48
- console.log(chalk.blue('šŸ› ļø Starting automated CLI tool installation...'));
48
+ // Step 1: Install CLI tools
49
+ console.log(chalk.blue('šŸ› ļø Step 1/2: Installing CLI tools...'));
49
50
 
50
51
  const installResult = await handleInstallCommand(autoInstallOptions);
51
52
 
52
53
  if (installResult.success) {
53
- console.log(chalk.green('\nāœ… Auto-install completed successfully!'));
54
+ console.log(chalk.green('\nāœ… CLI tools installed successfully!'));
54
55
 
55
56
  if (isNpmPostinstall) {
56
- criticalLog(chalk.green('āœ… STIGMERGY CLI SETUP COMPLETE'));
57
- criticalLog(chalk.gray('You can now use: stigmergy <tool> <command>'));
57
+ criticalLog(chalk.green('āœ… CLI TOOLS INSTALLED'));
58
58
  }
59
59
 
60
60
  // Show summary of what was installed
@@ -79,12 +79,37 @@ async function handleAutoInstallCommand(options = {}) {
79
79
  });
80
80
  }
81
81
 
82
+ // Step 2: Deploy hooks and ResumeSession
83
+ console.log(chalk.blue('\nšŸš€ Step 2/2: Deploying hooks and ResumeSession integration...'));
84
+
85
+ try {
86
+ const deployResult = await handleDeployCommand({
87
+ verbose: options.verbose || process.env.DEBUG === 'true',
88
+ force: options.force || false
89
+ });
90
+
91
+ if (deployResult.success) {
92
+ console.log(chalk.green('\nāœ… Hooks and ResumeSession deployed successfully!'));
93
+
94
+ if (isNpmPostinstall) {
95
+ criticalLog(chalk.green('āœ… HOOKS AND RESUMESESSION DEPLOYED'));
96
+ criticalLog(chalk.green('āœ… /stigmergy-resume command is now available in all CLIs'));
97
+ }
98
+ } else {
99
+ console.log(chalk.yellow('\nāš ļø Hook deployment encountered issues'));
100
+ console.log(chalk.yellow('Run: stigmergy deploy --verbose for details'));
101
+ }
102
+ } catch (deployError) {
103
+ console.log(chalk.red(`\nāŒ Hook deployment failed: ${deployError.message}`));
104
+ console.log(chalk.yellow('Run: stigmergy deploy manually to complete setup'));
105
+ }
106
+
82
107
  } else {
83
108
  console.log(chalk.red('\nāŒ Auto-install encountered issues'));
84
109
 
85
110
  if (isNpmPostinstall) {
86
111
  criticalLog(chalk.red('āŒ STIGMERGY CLI SETUP INCOMPLETE'));
87
- criticalLog(chalk.yellow('Run: stigmergy install to complete setup manually'));
112
+ criticalLog(chalk.yellow('Run: stigmergy install && stigmergy deploy to complete setup manually'));
88
113
  }
89
114
 
90
115
  if (installResult.error) {
@@ -99,7 +124,9 @@ async function handleAutoInstallCommand(options = {}) {
99
124
  const verificationChecks = [
100
125
  { name: 'Core modules accessible', check: () => require('../utils/formatters') && require('../utils/environment') },
101
126
  { name: 'Error handler available', check: () => require('../../core/error_handler') },
102
- { name: 'Smart router available', check: () => require('../../core/smart_router') }
127
+ { name: 'Smart router available', check: () => require('../../core/smart_router') },
128
+ { name: 'Hook deployment manager', check: () => require('../../core/coordination/nodejs/HookDeploymentManager') },
129
+ { name: 'ResumeSession generator', check: () => require('../../core/coordination/nodejs/generators/ResumeSessionGenerator') }
103
130
  ];
104
131
 
105
132
  let verificationPassed = 0;
@@ -118,6 +145,7 @@ async function handleAutoInstallCommand(options = {}) {
118
145
 
119
146
  if (isNpmPostinstall) {
120
147
  criticalLog(chalk.green('šŸŽ‰ STIGMERGY CLI IS READY TO USE!'));
148
+ criticalLog(chalk.green('šŸŽÆ All CLI tools configured with ResumeSession support'));
121
149
  }
122
150
  } else {
123
151
  console.log(chalk.yellow('\nāš ļø Some verification checks failed'));
@@ -129,6 +157,11 @@ async function handleAutoInstallCommand(options = {}) {
129
157
  criticalLog('='.repeat(60));
130
158
  criticalLog(chalk.cyan('šŸŽÆ STIGMERGY CLI AUTO-INSTALL FINISHED'));
131
159
  criticalLog('='.repeat(60));
160
+ criticalLog(chalk.green('āœ… All CLI tools installed and configured'));
161
+ criticalLog(chalk.green('āœ… Hooks deployed for all CLIs'));
162
+ criticalLog(chalk.green('āœ… ResumeSession integration enabled'));
163
+ criticalLog(chalk.cyan('šŸ“ Usage: /stigmergy-resume in any CLI'));
164
+ criticalLog('='.repeat(60));
132
165
  }
133
166
 
134
167
  return {
@@ -146,7 +179,7 @@ async function handleAutoInstallCommand(options = {}) {
146
179
 
147
180
  if (isNpmPostinstall) {
148
181
  criticalLog(chalk.red('šŸ’„ AUTO-INSTALL FAILED'));
149
- criticalLog(chalk.yellow('Run: stigmergy install --verbose for detailed installation'));
182
+ criticalLog(chalk.yellow('Run: stigmergy install --verbose && stigmergy deploy --verbose'));
150
183
  }
151
184
 
152
185
  return { success: false, error: error.message };
@@ -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 = Object.keys(available).length;
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
- console.log(`[OK] Node.js hooks deployed successfully for ${toolInfo.name}`);
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
- // Run JavaScript-based installation for each tool
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
- console.log(
424
- `[ERROR] Failed to deploy hooks for ${toolInfo.name}: ${error.message}`,
425
- );
426
- console.log('[INFO] Continuing with other tools...');
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
- console.log(
431
- `\n[SUMMARY] Hook deployment completed: ${successCount}/${totalCount} tools successful`,
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