stigmergy 1.0.89 → 1.0.92
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/README.md +202 -189
- package/bin/stigmergy.cmd +5 -0
- package/docs/CONFLICT_PREVENTION.md +150 -0
- package/package.json +11 -5
- package/scripts/post-deployment-config.js +289 -0
- package/scripts/preinstall-check.js +111 -0
- package/scripts/safe-install.js +139 -0
- package/src/main.js +963 -892
- package/src/main_english.js +179 -35
- package/test/comprehensive-execution-test.js +428 -0
- package/test/conflict-prevention-test.js +95 -0
- package/test/deploy-hooks-test.js +250 -0
- package/test/error-handling-test.js +341 -0
- package/test/final-deploy-test.js +221 -0
- package/test/final-install-test.js +226 -0
- package/test/iflow-integration-test.js +292 -0
- package/test/improved-install-test.js +362 -0
- package/test/install-command-test.js +370 -0
- package/test/plugin-deployment-test.js +316 -0
- package/test/postinstall-test.js +269 -0
- package/test/simple-iflow-hook-test.js +137 -0
- package/test/tdd-deploy-fix-test.js +324 -0
package/src/main_english.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
/**
|
|
4
4
|
* Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System
|
|
5
5
|
* International Version - Pure English & ANSI Only
|
|
6
|
-
* Version: 1.0.
|
|
6
|
+
* Version: 1.0.90
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
console.log('[DEBUG] Stigmergy CLI script started...');
|
|
@@ -510,17 +510,35 @@ class StigmergyInstaller {
|
|
|
510
510
|
|
|
511
511
|
try {
|
|
512
512
|
const installCmd = toolInfo.install.split(' ');
|
|
513
|
-
|
|
513
|
+
console.log(`[DEBUG] Installing ${toolInfo.name} with command: ${toolInfo.install}`);
|
|
514
|
+
|
|
515
|
+
// Try with shell=true first (works better on Windows)
|
|
516
|
+
let result = spawnSync(installCmd[0], installCmd.slice(1), {
|
|
514
517
|
encoding: 'utf8',
|
|
515
518
|
timeout: 300000, // Increased to 5 minutes for CLI tools that download binaries
|
|
516
519
|
stdio: 'inherit',
|
|
517
|
-
env: process.env
|
|
520
|
+
env: process.env,
|
|
521
|
+
shell: true
|
|
518
522
|
});
|
|
519
523
|
|
|
524
|
+
// If shell=true fails, try without shell
|
|
525
|
+
if (result.status !== 0 && result.status !== null) {
|
|
526
|
+
console.log(`[DEBUG] Shell execution failed, trying without shell...`);
|
|
527
|
+
result = spawnSync(installCmd[0], installCmd.slice(1), {
|
|
528
|
+
encoding: 'utf8',
|
|
529
|
+
timeout: 300000,
|
|
530
|
+
stdio: 'inherit',
|
|
531
|
+
env: process.env
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
520
535
|
if (result.status === 0) {
|
|
521
536
|
console.log(`[OK] ${toolInfo.name} installed successfully`);
|
|
522
537
|
} else {
|
|
523
|
-
console.log(`[ERROR] Failed to install ${toolInfo.name}`);
|
|
538
|
+
console.log(`[ERROR] Failed to install ${toolInfo.name} (exit code: ${result.status})`);
|
|
539
|
+
if (result.error) {
|
|
540
|
+
console.log(`[ERROR] Installation error: ${result.error.message}`);
|
|
541
|
+
}
|
|
524
542
|
console.log(`[INFO] Please run manually: ${toolInfo.install}`);
|
|
525
543
|
}
|
|
526
544
|
} catch (error) {
|
|
@@ -535,6 +553,9 @@ class StigmergyInstaller {
|
|
|
535
553
|
async downloadRequiredAssets() {
|
|
536
554
|
console.log('\n[DOWNLOAD] Downloading required assets and plugins...');
|
|
537
555
|
|
|
556
|
+
// SAFETY CHECK: Verify no conflicting packages exist
|
|
557
|
+
await this.safetyCheck();
|
|
558
|
+
|
|
538
559
|
try {
|
|
539
560
|
// Create local assets directory
|
|
540
561
|
const assetsDir = path.join(os.homedir(), '.stigmergy', 'assets');
|
|
@@ -576,6 +597,47 @@ class StigmergyInstaller {
|
|
|
576
597
|
return false;
|
|
577
598
|
}
|
|
578
599
|
}
|
|
600
|
+
|
|
601
|
+
// Safety check to prevent conflicts with other CLI tools
|
|
602
|
+
async safetyCheck() {
|
|
603
|
+
console.log('[SAFETY] Running conflict prevention check...');
|
|
604
|
+
|
|
605
|
+
try {
|
|
606
|
+
// Check for problematic node package
|
|
607
|
+
const npmNodeModules = path.join(os.homedir(), 'AppData', 'Roaming', 'npm', 'node_modules');
|
|
608
|
+
const nodePackageDir = path.join(npmNodeModules, 'node');
|
|
609
|
+
|
|
610
|
+
try {
|
|
611
|
+
await fs.access(nodePackageDir);
|
|
612
|
+
console.warn('[WARNING] Conflicting "node" package detected!');
|
|
613
|
+
console.warn('[WARNING] This may interfere with other CLI tools.');
|
|
614
|
+
console.warn('[WARNING] Consider running: npm uninstall -g node');
|
|
615
|
+
} catch (error) {
|
|
616
|
+
// Package doesn't exist, that's good
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// Check for broken node executable
|
|
620
|
+
const npmDir = path.join(os.homedir(), 'AppData', 'Roaming', 'npm');
|
|
621
|
+
const nodeExecutable = path.join(npmDir, 'node');
|
|
622
|
+
|
|
623
|
+
try {
|
|
624
|
+
await fs.access(nodeExecutable);
|
|
625
|
+
const content = await fs.readFile(nodeExecutable, 'utf8');
|
|
626
|
+
if (content.includes('intentionally left blank') ||
|
|
627
|
+
content.includes('node_modules/node/bin/node')) {
|
|
628
|
+
console.warn('[WARNING] Broken node executable detected!');
|
|
629
|
+
console.warn('[WARNING] This will break other CLI tools.');
|
|
630
|
+
console.warn('[WARNING] Consider running: npm run fix-node-conflict');
|
|
631
|
+
}
|
|
632
|
+
} catch (error) {
|
|
633
|
+
// File doesn't exist, that's fine
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
console.log('[SAFETY] Check completed.');
|
|
637
|
+
} catch (error) {
|
|
638
|
+
console.log('[SAFETY] Could not complete safety check:', error.message);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
579
641
|
|
|
580
642
|
async copyDirectory(src, dst) {
|
|
581
643
|
await fs.mkdir(dst, { recursive: true });
|
|
@@ -690,6 +752,13 @@ class StigmergyInstaller {
|
|
|
690
752
|
async deployHooks(available) {
|
|
691
753
|
console.log('\n[DEPLOY] Deploying cross-CLI integration hooks...');
|
|
692
754
|
|
|
755
|
+
// Import the post-deployment configurer for executing installation scripts
|
|
756
|
+
const { PostDeploymentConfigurer } = require('./../scripts/post-deployment-config.js');
|
|
757
|
+
const configurer = new PostDeploymentConfigurer();
|
|
758
|
+
|
|
759
|
+
let successCount = 0;
|
|
760
|
+
let totalCount = Object.keys(available).length;
|
|
761
|
+
|
|
693
762
|
for (const [toolName, toolInfo] of Object.entries(available)) {
|
|
694
763
|
console.log(`\n[DEPLOY] Deploying hooks for ${toolInfo.name}...`);
|
|
695
764
|
|
|
@@ -701,22 +770,46 @@ class StigmergyInstaller {
|
|
|
701
770
|
await fs.mkdir(configDir, { recursive: true });
|
|
702
771
|
|
|
703
772
|
// Copy adapter files from local assets
|
|
704
|
-
|
|
773
|
+
// Mapping for tool names that don't match their adapter directory names
|
|
774
|
+
const toolNameToAdapterDir = {
|
|
775
|
+
'qodercli': 'qoder',
|
|
776
|
+
'qwencode': 'qwen'
|
|
777
|
+
};
|
|
778
|
+
const adapterDirName = toolNameToAdapterDir[toolName] || toolName;
|
|
779
|
+
const assetsAdaptersDir = path.join(os.homedir(), '.stigmergy', 'assets', 'adapters', adapterDirName);
|
|
705
780
|
if (await this.fileExists(assetsAdaptersDir)) {
|
|
706
781
|
await this.copyDirectory(assetsAdaptersDir, toolInfo.hooksDir);
|
|
707
782
|
console.log(`[OK] Copied adapter files for ${toolInfo.name}`);
|
|
708
783
|
}
|
|
709
784
|
|
|
785
|
+
// NEW: Execute the installation script to complete configuration
|
|
786
|
+
console.log(`[CONFIG] Running installation script for ${toolInfo.name}...`);
|
|
787
|
+
const installResult = await configurer.configureTool(toolName);
|
|
788
|
+
if (installResult.runSuccess) {
|
|
789
|
+
console.log(`[OK] ${toolInfo.name} configured successfully`);
|
|
790
|
+
successCount++;
|
|
791
|
+
} else {
|
|
792
|
+
console.log(`[WARN] ${toolInfo.name} configuration failed: ${installResult.error || 'Unknown error'}`);
|
|
793
|
+
console.log(`[INFO] You can manually configure ${toolInfo.name} later by running the installation script`);
|
|
794
|
+
}
|
|
795
|
+
|
|
710
796
|
console.log(`[OK] Created directories for ${toolInfo.name}`);
|
|
711
797
|
console.log(`[INFO] Hooks directory: ${toolInfo.hooksDir}`);
|
|
712
798
|
console.log(`[INFO] Config directory: ${configDir}`);
|
|
713
799
|
} catch (error) {
|
|
714
|
-
console.log(`[ERROR] Failed to
|
|
800
|
+
console.log(`[ERROR] Failed to deploy hooks for ${toolInfo.name}: ${error.message}`);
|
|
801
|
+
console.log(`[INFO] You can manually deploy hooks for ${toolInfo.name} later by running: stigmergy deploy`);
|
|
715
802
|
}
|
|
716
803
|
}
|
|
717
804
|
|
|
718
|
-
console.log(
|
|
719
|
-
|
|
805
|
+
console.log(`\n[SUMMARY] Hook deployment completed: ${successCount}/${totalCount} tools configured successfully`);
|
|
806
|
+
|
|
807
|
+
if (successCount < totalCount) {
|
|
808
|
+
console.log(`[INFO] ${totalCount - successCount} tools failed to configure. See warnings above for details.`);
|
|
809
|
+
console.log(`[INFO] Run 'stigmergy deploy' to retry configuration for failed tools.`);
|
|
810
|
+
}
|
|
811
|
+
|
|
812
|
+
return successCount > 0; // Return true if at least one tool was configured successfully
|
|
720
813
|
}
|
|
721
814
|
|
|
722
815
|
async initializeConfig() {
|
|
@@ -727,7 +820,7 @@ class StigmergyInstaller {
|
|
|
727
820
|
|
|
728
821
|
const configFile = path.join(this.configDir, 'config.json');
|
|
729
822
|
const config = {
|
|
730
|
-
version: '1.0.
|
|
823
|
+
version: '1.0.92',
|
|
731
824
|
initialized: true,
|
|
732
825
|
createdAt: new Date().toISOString(),
|
|
733
826
|
lastUpdated: new Date().toISOString(),
|
|
@@ -783,7 +876,7 @@ async function main() {
|
|
|
783
876
|
|
|
784
877
|
if (args.length === 0 || args.includes('--help') || args.includes('-h')) {
|
|
785
878
|
console.log('Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System');
|
|
786
|
-
console.log('Version: 1.0.
|
|
879
|
+
console.log('Version: 1.0.90');
|
|
787
880
|
console.log('');
|
|
788
881
|
console.log('[SYSTEM] Automated Installation and Deployment System');
|
|
789
882
|
console.log('');
|
|
@@ -901,38 +994,89 @@ async function main() {
|
|
|
901
994
|
console.log('[AUTO-INSTALL] Stigmergy CLI automated setup');
|
|
902
995
|
console.log('='.repeat(60));
|
|
903
996
|
|
|
904
|
-
|
|
905
|
-
|
|
997
|
+
try {
|
|
998
|
+
// Step 1: Download required assets
|
|
999
|
+
try {
|
|
1000
|
+
console.log('[STEP] Downloading required assets...');
|
|
1001
|
+
await installer.downloadRequiredAssets();
|
|
1002
|
+
console.log('[OK] Assets downloaded successfully');
|
|
1003
|
+
} catch (error) {
|
|
1004
|
+
console.log(`[WARN] Failed to download assets: ${error.message}`);
|
|
1005
|
+
console.log('[INFO] Continuing with installation...');
|
|
1006
|
+
}
|
|
906
1007
|
|
|
907
|
-
|
|
908
|
-
|
|
1008
|
+
// Step 2: Scan for CLI tools
|
|
1009
|
+
let autoAvailable = {}, autoMissing = {};
|
|
1010
|
+
try {
|
|
1011
|
+
console.log('[STEP] Scanning for CLI tools...');
|
|
1012
|
+
const scanResult = await installer.scanCLI();
|
|
1013
|
+
autoAvailable = scanResult.available;
|
|
1014
|
+
autoMissing = scanResult.missing;
|
|
1015
|
+
console.log('[OK] CLI tools scanned successfully');
|
|
1016
|
+
} catch (error) {
|
|
1017
|
+
console.log(`[WARN] Failed to scan CLI tools: ${error.message}`);
|
|
1018
|
+
console.log('[INFO] Continuing with installation...');
|
|
1019
|
+
}
|
|
909
1020
|
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
1021
|
+
// Step 3: Show summary to user after installation
|
|
1022
|
+
try {
|
|
1023
|
+
if (Object.keys(autoMissing).length > 0) {
|
|
1024
|
+
console.log('\n[INFO] Found ' + Object.keys(autoMissing).length + ' missing AI CLI tools:');
|
|
1025
|
+
for (const [toolName, toolInfo] of Object.entries(autoMissing)) {
|
|
1026
|
+
console.log(` - ${toolInfo.name} (${toolName})`);
|
|
1027
|
+
}
|
|
1028
|
+
console.log('\n[INFO] Auto-install mode detected. Skipping automatic installation of missing tools.');
|
|
1029
|
+
console.log('[INFO] For full functionality, please run "stigmergy install" after installation completes.');
|
|
1030
|
+
} else {
|
|
1031
|
+
console.log('\n[INFO] All AI CLI tools are already installed! No additional tools required.');
|
|
1032
|
+
}
|
|
1033
|
+
} catch (error) {
|
|
1034
|
+
console.log(`[WARN] Failed to show tool summary: ${error.message}`);
|
|
915
1035
|
}
|
|
916
|
-
console.log('\n[INFO] Auto-install mode detected. Skipping automatic installation of missing tools.');
|
|
917
|
-
console.log('[INFO] For full functionality, please run "stigmergy install" after installation completes.');
|
|
918
|
-
} else {
|
|
919
|
-
console.log('\n[INFO] All AI CLI tools are already installed! No additional tools required.');
|
|
920
|
-
}
|
|
921
1036
|
|
|
922
|
-
|
|
923
|
-
|
|
1037
|
+
// Step 4: Deploy hooks to available CLI tools
|
|
1038
|
+
try {
|
|
1039
|
+
console.log('[STEP] Deploying hooks to available CLI tools...');
|
|
1040
|
+
await installer.deployHooks(autoAvailable);
|
|
1041
|
+
console.log('[OK] Hooks deployed successfully');
|
|
1042
|
+
} catch (error) {
|
|
1043
|
+
console.log(`[ERROR] Failed to deploy hooks: ${error.message}`);
|
|
1044
|
+
console.log('[INFO] You can manually deploy hooks later by running: stigmergy deploy');
|
|
1045
|
+
}
|
|
924
1046
|
|
|
925
|
-
|
|
926
|
-
|
|
1047
|
+
// Step 5: Deploy project documentation
|
|
1048
|
+
try {
|
|
1049
|
+
console.log('[STEP] Deploying project documentation...');
|
|
1050
|
+
await installer.deployProjectDocumentation();
|
|
1051
|
+
console.log('[OK] Documentation deployed successfully');
|
|
1052
|
+
} catch (error) {
|
|
1053
|
+
console.log(`[WARN] Failed to deploy documentation: ${error.message}`);
|
|
1054
|
+
console.log('[INFO] Continuing with installation...');
|
|
1055
|
+
}
|
|
927
1056
|
|
|
928
|
-
|
|
929
|
-
|
|
1057
|
+
// Step 6: Initialize configuration
|
|
1058
|
+
try {
|
|
1059
|
+
console.log('[STEP] Initializing configuration...');
|
|
1060
|
+
await installer.initializeConfig();
|
|
1061
|
+
console.log('[OK] Configuration initialized successfully');
|
|
1062
|
+
} catch (error) {
|
|
1063
|
+
console.log(`[ERROR] Failed to initialize configuration: ${error.message}`);
|
|
1064
|
+
console.log('[INFO] You can manually initialize configuration later by running: stigmergy setup');
|
|
1065
|
+
}
|
|
930
1066
|
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
1067
|
+
// Step 7: Show final message to guide users
|
|
1068
|
+
console.log('\n[SUCCESS] Stigmergy CLI installed successfully!');
|
|
1069
|
+
console.log('[USAGE] Run "stigmergy setup" to complete full configuration and install missing AI CLI tools.');
|
|
1070
|
+
console.log('[USAGE] Run "stigmergy install" to install only missing AI CLI tools.');
|
|
1071
|
+
console.log('[USAGE] Run "stigmergy --help" to see all available commands.');
|
|
1072
|
+
} catch (fatalError) {
|
|
1073
|
+
console.error('[FATAL] Auto-install process failed:', fatalError.message);
|
|
1074
|
+
console.log('\n[TROUBLESHOOTING] To manually complete installation:');
|
|
1075
|
+
console.log('1. Run: stigmergy setup # Complete setup');
|
|
1076
|
+
console.log('2. Run: stigmergy install # Install missing tools');
|
|
1077
|
+
console.log('3. Run: stigmergy deploy # Deploy hooks manually');
|
|
1078
|
+
process.exit(1);
|
|
1079
|
+
}
|
|
936
1080
|
break;
|
|
937
1081
|
|
|
938
1082
|
default:
|