stigmergy 1.3.2-beta.4 → 1.3.2-beta.5

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.2-beta.4",
3
+ "version": "1.3.2-beta.5",
4
4
  "description": "Stigmergy CLI - Multi-Agents Cross-AI CLI Tools Collaboration System",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -1,8 +1,8 @@
1
1
  const path = require('path');
2
2
  const os = require('os');
3
+ const { spawnSync } = require('child_process');
3
4
  const { errorHandler, ERROR_TYPES } = require('./error_handler');
4
5
  const CLIPathDetector = require('./cli_path_detector');
5
- const StigmergyInstaller = require('./installer');
6
6
 
7
7
  // AI CLI Tools Configuration
8
8
  const CLI_TOOLS = {
@@ -341,21 +341,33 @@ async function setupCLIPaths() {
341
341
  // 3. Check and update PATH if needed
342
342
  const pathStatus = await detector.updatePATHIfMissing();
343
343
 
344
- // 4. Create an enhanced report using StigmergyInstaller detection logic
345
- const installer = new StigmergyInstaller();
346
- const scanResult = await installer.scanCLI();
347
-
344
+ // 4. Create an enhanced report that checks if tools are actually executable
348
345
  const enhancedReport = {
349
346
  platform: detector.platform,
350
347
  npmGlobalPaths: detector.npmGlobalPaths,
351
348
  detectedPaths: detector.detectedPaths,
352
349
  summary: {
353
350
  total: Object.keys(detector.cliNameMap).length,
354
- found: Object.keys(scanResult.available).length,
355
- missing: Object.keys(scanResult.missing).length
351
+ found: 0, // Will be calculated below
352
+ missing: 0 // Will be calculated below
356
353
  }
357
354
  };
358
355
 
356
+ // Count actually executable tools
357
+ let executableCount = 0;
358
+ for (const [toolName, toolPath] of Object.entries(detectedPaths)) {
359
+ if (toolPath) {
360
+ // Check if the CLI is actually executable
361
+ const isExecutable = await checkIfCLIExecutable(toolName);
362
+ if (isExecutable) {
363
+ executableCount++;
364
+ }
365
+ }
366
+ }
367
+
368
+ enhancedReport.summary.found = executableCount;
369
+ enhancedReport.summary.missing = Object.keys(detector.cliNameMap).length - executableCount;
370
+
359
371
  return {
360
372
  detectedPaths,
361
373
  pathStatus,
@@ -554,26 +566,35 @@ async function checkIfCLIExecutable(toolName) {
554
566
  * @returns {Promise<Object>} Scan results
555
567
  */
556
568
  async function scanForTools(options = {}) {
557
- // Use StigmergyInstaller detection logic directly
558
- const installer = new StigmergyInstaller();
559
- const scanResult = await installer.scanCLI();
569
+ const detector = getPathDetector();
570
+
571
+ // Load cached paths first
572
+ await detector.loadDetectedPaths();
573
+
574
+ // Detect all CLI paths
575
+ const detectedPaths = await detector.detectAllCLIPaths();
560
576
 
561
577
  const found = [];
562
578
  const missing = [];
563
579
 
564
- // Convert scanResult to the expected format
565
- for (const [toolName, toolInfo] of Object.entries(scanResult.available)) {
566
- found.push({
567
- name: toolName,
568
- path: null, // Path is not provided by scanCLI, but we can potentially add it
569
- type: 'cli',
570
- status: 'installed',
571
- description: CLI_TOOLS[toolName]?.name || toolName
572
- });
573
- }
574
-
575
- for (const [toolName, toolInfo] of Object.entries(scanResult.missing)) {
576
- missing.push(toolName);
580
+ for (const [toolName, toolPath] of Object.entries(detectedPaths)) {
581
+ if (toolPath) {
582
+ // Additional check: verify the CLI is actually executable
583
+ const isExecutable = await checkIfCLIExecutable(toolName);
584
+ if (isExecutable) {
585
+ found.push({
586
+ name: toolName,
587
+ path: toolPath,
588
+ type: 'cli',
589
+ status: 'installed',
590
+ description: CLI_TOOLS[toolName]?.name || toolName
591
+ });
592
+ } else {
593
+ missing.push(toolName);
594
+ }
595
+ } else {
596
+ missing.push(toolName);
597
+ }
577
598
  }
578
599
 
579
600
  return {
@@ -591,25 +612,21 @@ async function scanForTools(options = {}) {
591
612
  async function checkInstallation(toolName) {
592
613
  validateCLITool(toolName);
593
614
 
594
- // Use StigmergyInstaller detection logic directly
595
- const installer = new StigmergyInstaller();
596
- const isAvailable = await installer.checkCLI(toolName);
597
-
598
- // If the tool is available, try to get its path and version
599
- let toolPath = null;
600
- let version = null;
615
+ // Get path using the detector
616
+ const detector = getPathDetector();
617
+ await detector.loadDetectedPaths();
618
+ let toolPath = detector.getDetectedPath(toolName);
601
619
 
602
- if (isAvailable) {
603
- // Get path using the detector
604
- const detector = getPathDetector();
605
- await detector.loadDetectedPaths();
606
- toolPath = detector.getDetectedPath(toolName);
620
+ if (!toolPath) {
621
+ toolPath = await detector.detectCLIPath(toolName);
622
+ }
607
623
 
608
- if (!toolPath) {
609
- toolPath = await detector.detectCLIPath(toolName);
610
- }
624
+ // Check if the tool is actually executable, not just if the path exists
625
+ const isExecutable = await checkIfCLIExecutable(toolName);
626
+ const installed = !!toolPath && isExecutable;
611
627
 
612
- // Get version
628
+ let version = null;
629
+ if (installed) {
613
630
  try {
614
631
  const { spawnSync } = require('child_process');
615
632
  const toolConfig = CLI_TOOLS[toolName];
@@ -630,7 +647,7 @@ async function checkInstallation(toolName) {
630
647
  }
631
648
 
632
649
  return {
633
- installed: isAvailable,
650
+ installed,
634
651
  path: toolPath,
635
652
  version,
636
653
  lastChecked: new Date().toISOString()