stigmergy 1.2.6 → 1.2.10
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 +69 -20
- package/STIGMERGY.md +26 -7
- package/docs/MULTI_USER_WIKI_COLLABORATION_SYSTEM.md +523 -0
- package/docs/PROMPT_BASED_SKILLS_SYSTEM_DESIGN.md +458 -0
- package/docs/SKILL_IMPLEMENTATION_CONSTRAINTS_AND_ALIGNMENT.md +423 -0
- package/docs/TECHNICAL_FEASIBILITY_ANALYSIS.md +308 -0
- package/examples/multilingual-hook-demo.js +125 -0
- package/package.json +30 -19
- package/scripts/dependency-analyzer.js +101 -0
- package/scripts/generate-cli-docs.js +64 -0
- package/scripts/postuninstall.js +46 -0
- package/scripts/preuninstall.js +85 -0
- package/scripts/run-layered-tests.js +3 -3
- package/src/adapters/claude/install_claude_integration.js +37 -37
- package/src/adapters/codebuddy/install_codebuddy_integration.js +66 -63
- package/src/adapters/codex/install_codex_integration.js +54 -55
- package/src/adapters/copilot/install_copilot_integration.js +46 -46
- package/src/adapters/gemini/install_gemini_integration.js +68 -68
- package/src/adapters/iflow/install_iflow_integration.js +77 -77
- package/src/adapters/qoder/install_qoder_integration.js +76 -76
- package/src/adapters/qwen/install_qwen_integration.js +23 -23
- package/src/cli/router.js +713 -163
- package/src/commands/skill-bridge.js +39 -0
- package/src/commands/skill-handler.js +150 -0
- package/src/commands/skill.js +127 -0
- package/src/core/cache_cleaner.js +767 -767
- package/src/core/cli_help_analyzer.js +680 -680
- package/src/core/cli_parameter_handler.js +132 -132
- package/src/core/cli_path_detector.js +573 -0
- package/src/core/cli_tools.js +160 -89
- package/src/core/coordination/index.js +16 -16
- package/src/core/coordination/nodejs/AdapterManager.js +130 -102
- package/src/core/coordination/nodejs/CLCommunication.js +132 -132
- package/src/core/coordination/nodejs/CLIIntegrationManager.js +272 -272
- package/src/core/coordination/nodejs/HealthChecker.js +76 -76
- package/src/core/coordination/nodejs/HookDeploymentManager.js +463 -274
- package/src/core/coordination/nodejs/StatisticsCollector.js +71 -71
- package/src/core/coordination/nodejs/index.js +90 -90
- package/src/core/coordination/nodejs/utils/Logger.js +29 -29
- package/src/core/directory_permission_manager.js +568 -0
- package/src/core/enhanced_cli_installer.js +609 -0
- package/src/core/error_handler.js +406 -406
- package/src/core/installer.js +263 -119
- package/src/core/memory_manager.js +83 -83
- package/src/core/multilingual/language-pattern-manager.js +200 -0
- package/src/core/persistent_shell_configurator.js +468 -0
- package/src/core/rest_client.js +160 -160
- package/src/core/skills/StigmergySkillManager.js +357 -0
- package/src/core/skills/__tests__/SkillInstaller.test.js +275 -0
- package/src/core/skills/__tests__/SkillParser.test.js +202 -0
- package/src/core/skills/__tests__/SkillReader.test.js +189 -0
- package/src/core/skills/cli-command-test.js +201 -0
- package/src/core/skills/comprehensive-e2e-test.js +473 -0
- package/src/core/skills/e2e-test.js +267 -0
- package/src/core/skills/embedded-openskills/SkillInstaller.js +438 -0
- package/src/core/skills/embedded-openskills/SkillParser.js +123 -0
- package/src/core/skills/embedded-openskills/SkillReader.js +143 -0
- package/src/core/skills/integration-test.js +248 -0
- package/src/core/skills/package.json +6 -0
- package/src/core/skills/regression-test.js +285 -0
- package/src/core/skills/run-all-tests.js +129 -0
- package/src/core/skills/sync-test.js +210 -0
- package/src/core/skills/test-runner.js +242 -0
- package/src/core/smart_router.js +261 -249
- package/src/core/upgrade_manager.js +48 -20
- package/src/index.js +30 -30
- package/src/test/cli-availability-checker.js +194 -194
- package/src/test/test-environment.js +289 -289
- package/src/utils/helpers.js +18 -35
- package/src/utils.js +921 -921
- package/src/weatherProcessor.js +228 -228
- package/test/multilingual/hook-deployment.test.js +91 -0
- package/test/multilingual/language-pattern-manager.test.js +140 -0
- package/test/multilingual/system-test.js +85 -0
- package/src/auth.js +0 -173
- package/src/auth_command.js +0 -208
- package/src/calculator.js +0 -313
- package/src/core/enhanced_installer.js +0 -479
- package/src/core/enhanced_uninstaller.js +0 -638
- package/src/data_encryption.js +0 -143
- package/src/data_structures.js +0 -440
- package/src/deploy.js +0 -55
package/src/core/installer.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
const fs = require('fs/promises');
|
|
3
3
|
const os = require('os');
|
|
4
|
-
const { spawnSync } = require('child_process');
|
|
4
|
+
const { spawn, spawnSync } = require('child_process');
|
|
5
5
|
const inquirer = require('inquirer');
|
|
6
6
|
const SmartRouter = require('./smart_router');
|
|
7
7
|
const { errorHandler } = require('./error_handler');
|
|
@@ -33,7 +33,7 @@ class StigmergyInstaller {
|
|
|
33
33
|
const whichCmd = process.platform === 'win32' ? 'where' : 'which';
|
|
34
34
|
const whichResult = spawnSync(whichCmd, [toolName], {
|
|
35
35
|
encoding: 'utf8',
|
|
36
|
-
timeout:
|
|
36
|
+
timeout: 10000,
|
|
37
37
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
38
38
|
shell: true,
|
|
39
39
|
});
|
|
@@ -93,7 +93,7 @@ class StigmergyInstaller {
|
|
|
93
93
|
const whichCmd = process.platform === 'win32' ? 'where' : 'which';
|
|
94
94
|
const whichResult = spawnSync(whichCmd, [toolName], {
|
|
95
95
|
encoding: 'utf8',
|
|
96
|
-
timeout:
|
|
96
|
+
timeout: 10000,
|
|
97
97
|
stdio: ['pipe', 'pipe', 'pipe'], // Use pipes to avoid file opening
|
|
98
98
|
shell: true,
|
|
99
99
|
});
|
|
@@ -141,7 +141,7 @@ class StigmergyInstaller {
|
|
|
141
141
|
try {
|
|
142
142
|
const result = spawnSync(toolName, check.args, {
|
|
143
143
|
encoding: 'utf8',
|
|
144
|
-
timeout:
|
|
144
|
+
timeout: 10000,
|
|
145
145
|
stdio: ['pipe', 'pipe', 'pipe'], // Ensure all IO is piped
|
|
146
146
|
shell: false, // Don't use shell to avoid extra window opening
|
|
147
147
|
windowsHide: true, // Hide console window on Windows
|
|
@@ -247,27 +247,111 @@ class StigmergyInstaller {
|
|
|
247
247
|
* Show install options for missing CLI tools
|
|
248
248
|
*/
|
|
249
249
|
async showInstallOptions(missingTools) {
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
250
|
+
if (Object.keys(missingTools).length === 0) {
|
|
251
|
+
console.log('[INSTALL] All tools are already installed!');
|
|
252
|
+
return [];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
console.log('\n[INSTALL] Missing AI CLI Tools:');
|
|
256
|
+
const options = [];
|
|
257
|
+
let index = 1;
|
|
258
|
+
|
|
259
|
+
for (const [toolName, toolInfo] of Object.entries(missingTools)) {
|
|
260
|
+
const option = {
|
|
261
|
+
name: `${index++}. ${toolInfo.name} - ${toolInfo.install}`,
|
|
262
|
+
value: toolName,
|
|
263
|
+
};
|
|
264
|
+
options.push(option);
|
|
265
|
+
console.log(` ${option.name}`);
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
return options;
|
|
253
269
|
}
|
|
254
270
|
|
|
255
271
|
/**
|
|
256
272
|
* Get user selection for CLI tools to install
|
|
257
273
|
*/
|
|
258
274
|
async getUserSelection(options, missingTools) {
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
275
|
+
if (options.length === 0) {
|
|
276
|
+
return [];
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
// For non-interactive mode, install all missing tools
|
|
280
|
+
if (process.env.CI || process.argv.includes('--auto-install') || process.argv.includes('--force')) {
|
|
281
|
+
console.log('[INSTALL] Auto-installing all missing tools...');
|
|
282
|
+
return options.map(option => option.value);
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
// Interactive mode
|
|
286
|
+
try {
|
|
287
|
+
const { selectedTools } = await inquirer.prompt([
|
|
288
|
+
{
|
|
289
|
+
type: 'checkbox',
|
|
290
|
+
name: 'selectedTools',
|
|
291
|
+
message: 'Select tools to install (Press Space to select, Enter to confirm):',
|
|
292
|
+
choices: options,
|
|
293
|
+
validate: (input) => {
|
|
294
|
+
if (input && input.length > 0) return true;
|
|
295
|
+
return 'Please select at least one tool to install';
|
|
296
|
+
},
|
|
297
|
+
},
|
|
298
|
+
]);
|
|
299
|
+
return selectedTools || [];
|
|
300
|
+
} catch (error) {
|
|
301
|
+
console.log('[INSTALL] Interactive mode failed, installing all missing tools...');
|
|
302
|
+
return options.map(option => option.value);
|
|
303
|
+
}
|
|
262
304
|
}
|
|
263
305
|
|
|
264
306
|
/**
|
|
265
307
|
* Install selected CLI tools
|
|
266
308
|
*/
|
|
267
309
|
async installTools(selectedTools, missingTools) {
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
310
|
+
const chalk = require('chalk');
|
|
311
|
+
let successCount = 0;
|
|
312
|
+
|
|
313
|
+
for (const toolName of selectedTools) {
|
|
314
|
+
const toolInfo = missingTools[toolName];
|
|
315
|
+
if (!toolInfo) continue;
|
|
316
|
+
|
|
317
|
+
console.log(`\n[INSTALL] Installing ${toolInfo.name}...`);
|
|
318
|
+
console.log(chalk.yellow(`Command: ${toolInfo.install}`));
|
|
319
|
+
|
|
320
|
+
try {
|
|
321
|
+
// Parse the install command
|
|
322
|
+
const [command, ...args] = toolInfo.install.split(' ');
|
|
323
|
+
|
|
324
|
+
// Execute the installation command
|
|
325
|
+
const result = spawnSync(command, args, {
|
|
326
|
+
stdio: 'inherit', // Show output in real-time
|
|
327
|
+
shell: true, // Use shell for npm commands
|
|
328
|
+
encoding: 'utf-8'
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
if (result.status === 0) {
|
|
332
|
+
console.log(chalk.green(`[OK] Successfully installed ${toolInfo.name}`));
|
|
333
|
+
successCount++;
|
|
334
|
+
} else {
|
|
335
|
+
console.log(chalk.red(`[ERROR] Failed to install ${toolInfo.name}. Exit code: ${result.status}`));
|
|
336
|
+
// Continue with other tools
|
|
337
|
+
}
|
|
338
|
+
} catch (error) {
|
|
339
|
+
console.log(chalk.red(`[ERROR] Installation failed for ${toolInfo.name}: ${error.message}`));
|
|
340
|
+
// Continue with other tools
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
if (successCount > 0) {
|
|
345
|
+
console.log(chalk.green(`\n[INSTALL] Successfully installed ${successCount}/${selectedTools.length} tools`));
|
|
346
|
+
|
|
347
|
+
// Add a short delay to ensure installations are complete
|
|
348
|
+
await new Promise(resolve => setTimeout(resolve, 2000));
|
|
349
|
+
|
|
350
|
+
return true;
|
|
351
|
+
} else {
|
|
352
|
+
console.log(chalk.red('[INSTALL] No tools were successfully installed'));
|
|
353
|
+
return false;
|
|
354
|
+
}
|
|
271
355
|
}
|
|
272
356
|
|
|
273
357
|
/**
|
|
@@ -311,7 +395,7 @@ class StigmergyInstaller {
|
|
|
311
395
|
await this.installToolIntegration(toolName, toolInfo);
|
|
312
396
|
|
|
313
397
|
console.log(`[OK] Hooks deployed successfully for ${toolInfo.name}`);
|
|
314
|
-
successCount
|
|
398
|
+
successCount++;
|
|
315
399
|
|
|
316
400
|
} catch (error) {
|
|
317
401
|
const { errorHandler } = require('./error_handler');
|
|
@@ -415,15 +499,66 @@ class StigmergyInstaller {
|
|
|
415
499
|
// Create PROJECT_CONSTITUTION.md if it doesn't exist
|
|
416
500
|
const projectConstitutionPath = path.join(currentDir, 'PROJECT_CONSTITUTION.md');
|
|
417
501
|
if (!(await fs.access(projectConstitutionPath).then(() => true).catch(() => false))) {
|
|
418
|
-
const constitutionContent = `#
|
|
419
|
-
|
|
420
|
-
##
|
|
421
|
-
-
|
|
422
|
-
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
502
|
+
const constitutionContent = `# Project Collaboration Constitution
|
|
503
|
+
|
|
504
|
+
## Basic Collaboration Principles
|
|
505
|
+
- All collaboration is coordinated through PROJECT_SPEC.json
|
|
506
|
+
- Agents make autonomous decisions based on background state
|
|
507
|
+
- No central scheduler, achieving decentralized collaboration
|
|
508
|
+
|
|
509
|
+
## PROJECT_SPEC.json Usage
|
|
510
|
+
The PROJECT_SPEC.json file serves as the central coordination point for all project activities.
|
|
511
|
+
|
|
512
|
+
### Basic Structure:
|
|
513
|
+
\`\`
|
|
514
|
+
{
|
|
515
|
+
"projectName": "your-project-name",
|
|
516
|
+
"version": "1.0.0",
|
|
517
|
+
"description": "Project description",
|
|
518
|
+
"collaboration": {
|
|
519
|
+
"activeTasks": [],
|
|
520
|
+
"completedTasks": [],
|
|
521
|
+
"sharedContext": {}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
\`\`
|
|
525
|
+
|
|
526
|
+
### Common Usage Examples:
|
|
527
|
+
1. Define project tasks:
|
|
528
|
+
\`\`
|
|
529
|
+
{
|
|
530
|
+
"collaboration": {
|
|
531
|
+
"activeTasks": [
|
|
532
|
+
{
|
|
533
|
+
"id": "task-001",
|
|
534
|
+
"name": "Implement feature X",
|
|
535
|
+
"status": "in-progress",
|
|
536
|
+
"assignedTo": "any",
|
|
537
|
+
"priority": "high",
|
|
538
|
+
"description": "Task details..."
|
|
539
|
+
}
|
|
540
|
+
]
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
\`\`
|
|
544
|
+
|
|
545
|
+
2. Track shared context:
|
|
546
|
+
\`\`
|
|
547
|
+
{
|
|
548
|
+
"collaboration": {
|
|
549
|
+
"sharedContext": {
|
|
550
|
+
"lastCompletion": "2025-02-22T10:00:00Z",
|
|
551
|
+
"activeDevelopers": ["developer1", "developer2"],
|
|
552
|
+
"currentSprint": "sprint-2"
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
\`\`
|
|
557
|
+
|
|
558
|
+
## Task Management Principles
|
|
559
|
+
- Agents can claim tasks assigned to themselves
|
|
560
|
+
- Agents can claim unassigned tasks that match their capabilities
|
|
561
|
+
- Task status is updated in real-time to the shared context
|
|
427
562
|
`;
|
|
428
563
|
await fs.writeFile(projectConstitutionPath, constitutionContent, 'utf8');
|
|
429
564
|
console.log('[PROJECT] Created PROJECT_CONSTITUTION.md');
|
|
@@ -436,47 +571,72 @@ class StigmergyInstaller {
|
|
|
436
571
|
}
|
|
437
572
|
}
|
|
438
573
|
|
|
439
|
-
/**
|
|
574
|
+
/**
|
|
440
575
|
* Install integration for a specific CLI tool using JavaScript
|
|
441
576
|
*/
|
|
442
577
|
async installToolIntegration(toolName, toolInfo) {
|
|
443
578
|
const fs = require('fs/promises');
|
|
444
579
|
const path = require('path');
|
|
445
580
|
const { spawn } = require('child_process');
|
|
446
|
-
|
|
581
|
+
|
|
447
582
|
console.log(`[CONFIG] Configuring ${toolInfo.name}...`);
|
|
448
|
-
|
|
583
|
+
|
|
449
584
|
try {
|
|
450
585
|
// Map tool names to their adapter directory names
|
|
451
586
|
const toolToAdapterDir = {
|
|
452
587
|
'qodercli': 'qoder',
|
|
453
588
|
'qwencode': 'qwen'
|
|
454
589
|
};
|
|
455
|
-
|
|
590
|
+
|
|
456
591
|
const adapterDirName = toolToAdapterDir[toolName] || toolName;
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
592
|
+
|
|
593
|
+
// Try to find the installation script using multiple approaches to handle different installation scenarios
|
|
594
|
+
let installScriptPath;
|
|
595
|
+
const possiblePaths = [
|
|
596
|
+
// Standard path: src/core/../adapters => src/adapters
|
|
597
|
+
path.join(__dirname, '..', 'adapters', adapterDirName, `install_${adapterDirName}_integration.js`),
|
|
598
|
+
// Path when running from global installation in a different context
|
|
599
|
+
path.join(process.cwd(), 'src', 'adapters', adapterDirName, `install_${adapterDirName}_integration.js`),
|
|
600
|
+
// Path when we might be in a different location due to module resolution
|
|
601
|
+
path.resolve(__dirname, '..', 'adapters', adapterDirName, `install_${adapterDirName}_integration.js`)
|
|
602
|
+
];
|
|
603
|
+
|
|
604
|
+
// Check if we're in the global npm installation by looking for the install script
|
|
605
|
+
for (const possiblePath of possiblePaths) {
|
|
606
|
+
try {
|
|
607
|
+
await fs.access(possiblePath);
|
|
608
|
+
installScriptPath = possiblePath;
|
|
609
|
+
console.log(`[DEBUG] Found installation script at: ${possiblePath}`);
|
|
610
|
+
break;
|
|
611
|
+
} catch (error) {
|
|
612
|
+
// Continue to next possible path
|
|
613
|
+
continue;
|
|
471
614
|
}
|
|
472
|
-
}
|
|
473
|
-
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
// If we still haven't found the installation script
|
|
618
|
+
if (!installScriptPath) {
|
|
619
|
+
console.log(`[WARN] JavaScript installation script not found for ${toolInfo.name} at possible paths:`, possiblePaths);
|
|
474
620
|
console.log(`[FALLBACK] Using inline configuration for ${toolInfo.name}...`);
|
|
475
|
-
|
|
476
|
-
// Fallback to inline configuration if script doesn't exist
|
|
477
621
|
await this.inlineToolConfiguration(toolName, toolInfo);
|
|
622
|
+
return;
|
|
478
623
|
}
|
|
479
|
-
|
|
624
|
+
|
|
625
|
+
// Installation script found, execute it
|
|
626
|
+
console.log(`[RUN] Running JavaScript installation script for ${toolInfo.name}...`);
|
|
627
|
+
|
|
628
|
+
// Run the JavaScript installation script
|
|
629
|
+
const result = await this.runInstallScript(installScriptPath);
|
|
630
|
+
|
|
631
|
+
if (result.success) {
|
|
632
|
+
console.log(`[OK] ${toolInfo.name} installation script completed successfully`);
|
|
633
|
+
} else {
|
|
634
|
+
console.log(`[WARN] ${toolInfo.name} installation script failed: ${result.error}`);
|
|
635
|
+
// If the installation script fails but was found, still try to use inline configuration as fallback
|
|
636
|
+
console.log(`[FALLBACK] Using inline configuration for ${toolInfo.name} after script failure...`);
|
|
637
|
+
await this.inlineToolConfiguration(toolName, toolInfo);
|
|
638
|
+
}
|
|
639
|
+
|
|
480
640
|
} catch (error) {
|
|
481
641
|
console.log(`[WARN] Configuration failed for ${toolInfo.name}: ${error.message}`);
|
|
482
642
|
}
|
|
@@ -490,7 +650,7 @@ class StigmergyInstaller {
|
|
|
490
650
|
const child = spawn('node', [scriptPath], {
|
|
491
651
|
cwd: path.dirname(scriptPath),
|
|
492
652
|
stdio: 'pipe',
|
|
493
|
-
timeout:
|
|
653
|
+
timeout: 100000 // 30 second timeout
|
|
494
654
|
});
|
|
495
655
|
|
|
496
656
|
let stdout = '';
|
|
@@ -533,11 +693,11 @@ class StigmergyInstaller {
|
|
|
533
693
|
// Step 1: Create tool-specific configuration
|
|
534
694
|
const config = {
|
|
535
695
|
cross_cli_enabled: true,
|
|
536
|
-
supported_clis: [
|
|
696
|
+
supported_clis: ['claude', 'gemini', 'qwen', 'iflow', 'qodercli', 'codebuddy', 'copilot', 'codex'],
|
|
537
697
|
auto_detect: true,
|
|
538
698
|
timeout: 30,
|
|
539
|
-
collaboration_mode:
|
|
540
|
-
stigmergy_version:
|
|
699
|
+
collaboration_mode: 'active',
|
|
700
|
+
stigmergy_version: '1.2.1',
|
|
541
701
|
deployment_time: new Date().toISOString()
|
|
542
702
|
};
|
|
543
703
|
|
|
@@ -546,10 +706,29 @@ class StigmergyInstaller {
|
|
|
546
706
|
console.log(`[OK] Configuration file created: ${toolInfo.config}`);
|
|
547
707
|
|
|
548
708
|
// Step 2: Copy adapter files if they exist
|
|
549
|
-
|
|
550
|
-
|
|
709
|
+
// Try to find the adapter directory using multiple approaches to handle different installation scenarios
|
|
710
|
+
let adapterDir;
|
|
711
|
+
const possibleAdapterPaths = [
|
|
712
|
+
// Standard path: src/core/../adapters => src/adapters
|
|
713
|
+
path.join(__dirname, '..', 'adapters', toolName === 'qodercli' ? 'qoder' : toolName),
|
|
714
|
+
// Path when running from global installation
|
|
715
|
+
path.resolve(__dirname, '..', 'adapters', toolName === 'qodercli' ? 'qoder' : toolName)
|
|
716
|
+
];
|
|
717
|
+
|
|
718
|
+
for (const possiblePath of possibleAdapterPaths) {
|
|
719
|
+
if (await this.fileExists(possiblePath)) {
|
|
720
|
+
adapterDir = possiblePath;
|
|
721
|
+
console.log(`[DEBUG] Found adapter directory at: ${possiblePath}`);
|
|
722
|
+
break;
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
// If we found the adapter directory, copy the files
|
|
727
|
+
if (adapterDir) {
|
|
551
728
|
await this.copyAdapterFiles(adapterDir, toolInfo.hooksDir);
|
|
552
729
|
console.log(`[OK] Adapter files copied for ${toolInfo.name}`);
|
|
730
|
+
} else {
|
|
731
|
+
console.log(`[WARN] Adapter directory not found for ${toolInfo.name} at possible paths:`, possibleAdapterPaths);
|
|
553
732
|
}
|
|
554
733
|
|
|
555
734
|
// Step 3: Create tool-specific hook files
|
|
@@ -579,12 +758,12 @@ class StigmergyInstaller {
|
|
|
579
758
|
const hooksConfig = {
|
|
580
759
|
cross_cli_adapter: {
|
|
581
760
|
enabled: true,
|
|
582
|
-
supported_tools: [
|
|
761
|
+
supported_tools: ['claude', 'gemini', 'qwen', 'iflow', 'qodercli', 'codebuddy', 'copilot', 'codex'],
|
|
583
762
|
trigger_patterns: [
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
763
|
+
'use\\s+(\\w+)\\s+to\\s+(.+)$',
|
|
764
|
+
'call\\s+(\\w+)\\s+(.+)$',
|
|
765
|
+
'ask\\s+(\\w+)\\s+(.+)$',
|
|
766
|
+
'stigmergy\\s+(\\w+)\\s+(.+)$'
|
|
588
767
|
]
|
|
589
768
|
}
|
|
590
769
|
};
|
|
@@ -617,8 +796,8 @@ class StigmergyInstaller {
|
|
|
617
796
|
await fs.access(settingsPath);
|
|
618
797
|
} catch {
|
|
619
798
|
const settings = {
|
|
620
|
-
version:
|
|
621
|
-
theme:
|
|
799
|
+
version: '1.0.0',
|
|
800
|
+
theme: 'default',
|
|
622
801
|
auto_save: true,
|
|
623
802
|
cross_cli_enabled: true
|
|
624
803
|
};
|
|
@@ -628,18 +807,18 @@ class StigmergyInstaller {
|
|
|
628
807
|
|
|
629
808
|
// Tool-specific configurations
|
|
630
809
|
switch (toolName) {
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
810
|
+
case 'copilot':
|
|
811
|
+
await this.createCopilotConfig(toolInfo);
|
|
812
|
+
break;
|
|
813
|
+
case 'iflow':
|
|
814
|
+
await this.createIflowConfig(toolInfo);
|
|
815
|
+
break;
|
|
816
|
+
case 'qodercli':
|
|
817
|
+
await this.createQoderConfig(toolInfo);
|
|
818
|
+
break;
|
|
819
|
+
case 'codebuddy':
|
|
820
|
+
await this.createCodeBuddyConfig(toolInfo);
|
|
821
|
+
break;
|
|
643
822
|
}
|
|
644
823
|
} catch (error) {
|
|
645
824
|
console.log(`[WARN] Failed to create tool-specific configs: ${error.message}`);
|
|
@@ -658,17 +837,17 @@ class StigmergyInstaller {
|
|
|
658
837
|
mcp: {
|
|
659
838
|
enabled: true,
|
|
660
839
|
servers: {
|
|
661
|
-
|
|
662
|
-
name:
|
|
663
|
-
description:
|
|
664
|
-
command:
|
|
665
|
-
args: [path.join(toolInfo.hooksDir,
|
|
840
|
+
'cross-cli-caller': {
|
|
841
|
+
name: 'CrossCLICaller',
|
|
842
|
+
description: 'Cross-CLI Tool Calling Agent',
|
|
843
|
+
command: 'node',
|
|
844
|
+
args: [path.join(toolInfo.hooksDir, 'cross_cli_caller.js')]
|
|
666
845
|
}
|
|
667
846
|
}
|
|
668
847
|
},
|
|
669
848
|
cross_cli_caller: {
|
|
670
|
-
name:
|
|
671
|
-
description:
|
|
849
|
+
name: 'CrossCLICaller',
|
|
850
|
+
description: 'Cross-CLI Tool Calling Agent'
|
|
672
851
|
}
|
|
673
852
|
};
|
|
674
853
|
|
|
@@ -724,7 +903,7 @@ class StigmergyInstaller {
|
|
|
724
903
|
cross_cli: true
|
|
725
904
|
},
|
|
726
905
|
keywords: {
|
|
727
|
-
cross_cli: [
|
|
906
|
+
cross_cli: ['请用', '调用', '用', '让', 'use', 'call', 'ask']
|
|
728
907
|
}
|
|
729
908
|
};
|
|
730
909
|
|
|
@@ -792,7 +971,7 @@ class StigmergyInstaller {
|
|
|
792
971
|
generateCrossCliGuide(toolName) {
|
|
793
972
|
const toolNames = {
|
|
794
973
|
'claude': 'Claude CLI',
|
|
795
|
-
'gemini': 'Gemini CLI',
|
|
974
|
+
'gemini': 'Gemini CLI',
|
|
796
975
|
'qwen': 'Qwen CLI',
|
|
797
976
|
'iflow': 'iFlow CLI',
|
|
798
977
|
'qodercli': 'Qoder CLI',
|
|
@@ -801,26 +980,8 @@ class StigmergyInstaller {
|
|
|
801
980
|
'codex': 'OpenAI Codex CLI'
|
|
802
981
|
};
|
|
803
982
|
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
if (isChinese) {
|
|
807
|
-
return `# ${toolNames[toolName]} Cross-CLI 通信指南
|
|
808
|
-
|
|
809
|
-
## Cross-CLI Communication
|
|
810
|
-
当您需要调用其他AI工具时,请使用以下提示<<<在shell中执行以下命令:stigmergy <工具名> <任务描述>>>
|
|
811
|
-
|
|
812
|
-
示例:
|
|
813
|
-
- 在shell中运行:stigmergy claude "写一个Python函数"
|
|
814
|
-
- 在shell中运行:stigmergy gemini "翻译这段文字"
|
|
815
|
-
- 在shell中运行:stigmergy qwen "分析这段代码"
|
|
816
|
-
|
|
817
|
-
可用工具:claude, gemini, qwen, iflow, qodercli, codebuddy, copilot, codex
|
|
818
|
-
|
|
819
|
-
---
|
|
820
|
-
*本文档由Stigmergy CLI自动生成和维护*
|
|
821
|
-
`;
|
|
822
|
-
} else {
|
|
823
|
-
return `# ${toolNames[toolName]} Cross-CLI Communication Guide
|
|
983
|
+
// All documentation generated in English for consistency
|
|
984
|
+
return `# ${toolNames[toolName]} Cross-CLI Communication Guide
|
|
824
985
|
|
|
825
986
|
## Cross-CLI Communication
|
|
826
987
|
When you need to call other AI tools, please use the following prompt <<<Execute the following command in shell: stigmergy <tool_name> <task_description>>>
|
|
@@ -835,7 +996,6 @@ Available tools: claude, gemini, qwen, iflow, qodercli, codebuddy, copilot, code
|
|
|
835
996
|
---
|
|
836
997
|
*This document is automatically generated and maintained by Stigmergy CLI*
|
|
837
998
|
`;
|
|
838
|
-
}
|
|
839
999
|
}
|
|
840
1000
|
|
|
841
1001
|
/**
|
|
@@ -876,23 +1036,8 @@ Available tools: claude, gemini, qwen, iflow, qodercli, codebuddy, copilot, code
|
|
|
876
1036
|
* Generate content to append to .md files
|
|
877
1037
|
*/
|
|
878
1038
|
generateCrossCliAppendContent(toolName) {
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
if (isChinese) {
|
|
882
|
-
return `
|
|
883
|
-
|
|
884
|
-
## Cross-CLI Communication
|
|
885
|
-
当您需要调用其他AI工具时,请使用以下提示<<<在shell中执行以下命令:stigmergy <工具名> <任务描述>>>
|
|
886
|
-
|
|
887
|
-
示例:
|
|
888
|
-
- 在shell中运行:stigmergy claude "写一个Python函数"
|
|
889
|
-
- 在shell中运行:stigmergy gemini "翻译这段文字"
|
|
890
|
-
- 在shell中运行:stigmergy qwen "分析这段代码"
|
|
891
|
-
|
|
892
|
-
可用工具:claude, gemini, qwen, iflow, qodercli, codebuddy, copilot, codex
|
|
893
|
-
`;
|
|
894
|
-
} else {
|
|
895
|
-
return `
|
|
1039
|
+
// All documentation generated in English for consistency
|
|
1040
|
+
return `
|
|
896
1041
|
|
|
897
1042
|
## Cross-CLI Communication
|
|
898
1043
|
When you need to call other AI tools, please use the following prompt <<<Execute the following command in shell: stigmergy <tool_name> <task_description>>>
|
|
@@ -904,7 +1049,6 @@ Examples:
|
|
|
904
1049
|
|
|
905
1050
|
Available tools: claude, gemini, qwen, iflow, qodercli, codebuddy, copilot, codex
|
|
906
1051
|
`;
|
|
907
|
-
}
|
|
908
1052
|
}
|
|
909
1053
|
|
|
910
1054
|
/**
|