snow-flow 8.32.12 → 8.32.14

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.
@@ -2,7 +2,7 @@
2
2
  * Snow-Flow Health Monitoring API
3
3
  * Real-time system health and monitoring endpoints
4
4
  */
5
- declare const app: any;
5
+ declare const app: import("express-serve-static-core").Express;
6
6
  declare function start(): Promise<void>;
7
7
  export { app, start };
8
8
  //# sourceMappingURL=health-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"health-api.d.ts","sourceRoot":"","sources":["../../src/api/health-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,QAAA,MAAM,GAAG,KAAY,CAAC;AAyQtB,iBAAe,KAAK,kBAanB;AAoCD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"health-api.d.ts","sourceRoot":"","sources":["../../src/api/health-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,QAAA,MAAM,GAAG,6CAAY,CAAC;AAyQtB,iBAAe,KAAK,kBAanB;AAoCD,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC"}
@@ -2,6 +2,6 @@
2
2
  * Snow-Flow Simple Health Monitoring API
3
3
  * Lightweight real-time system health endpoints
4
4
  */
5
- declare const app: any;
5
+ declare const app: import("express-serve-static-core").Express;
6
6
  export { app };
7
7
  //# sourceMappingURL=simple-health-api.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"simple-health-api.d.ts","sourceRoot":"","sources":["../../src/api/simple-health-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,QAAA,MAAM,GAAG,KAAY,CAAC;AAkhBtB,OAAO,EAAE,GAAG,EAAE,CAAC"}
1
+ {"version":3,"file":"simple-health-api.d.ts","sourceRoot":"","sources":["../../src/api/simple-health-api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,QAAA,MAAM,GAAG,6CAAY,CAAC;AAkhBtB,OAAO,EAAE,GAAG,EAAE,CAAC"}
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AAqsGH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,OAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CA+Sf"}
1
+ {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;GAEG;AA2hGH,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,KAAK,GAAE,OAAe,GACrB,OAAO,CAAC,IAAI,CAAC,CA+Sf"}
package/dist/cli.js CHANGED
@@ -57,6 +57,8 @@ const chalk_1 = __importDefault(require("chalk"));
57
57
  const prompts = __importStar(require("@clack/prompts"));
58
58
  // Load MCP Persistent Guard for bulletproof server protection
59
59
  const mcp_persistent_guard_js_1 = require("./utils/mcp-persistent-guard.js");
60
+ // Automatic snow-code update utility
61
+ const auto_update_snow_code_js_1 = require("./utils/auto-update-snow-code.js");
60
62
  // Activate MCP guard ONLY for commands that actually use MCP servers
61
63
  // Explicitly exclude: init, version, help, auth, export, config commands
62
64
  const commandsNeedingMCP = ['swarm', 'status', 'monitor', 'mcp'];
@@ -254,6 +256,22 @@ program
254
256
  cliLogger.info(`\nšŸš€ Snow-Flow v${version_js_1.VERSION}`);
255
257
  console.log(chalk_1.default.blue(`šŸ“‹ ${objective}`));
256
258
  }
259
+ // Ensure snow-code is up-to-date before starting swarm execution
260
+ try {
261
+ if (options.verbose) {
262
+ cliLogger.info('šŸ”„ Checking for snow-code updates...');
263
+ }
264
+ const updateResult = await (0, auto_update_snow_code_js_1.autoUpdateSnowCode)(process.cwd(), options.verbose);
265
+ if (updateResult.success && options.verbose) {
266
+ cliLogger.info(`āœ“ Snow-code v${updateResult.mainPackageVersion || 'latest'} ready`);
267
+ }
268
+ // Silently continue if update fails - don't block swarm execution
269
+ }
270
+ catch (updateErr) {
271
+ if (options.verbose) {
272
+ cliLogger.debug('Snow-code update check failed (non-critical):', updateErr);
273
+ }
274
+ }
257
275
  // Only show detailed config in verbose mode
258
276
  if (options.verbose) {
259
277
  cliLogger.info(`āš™ļø Strategy: ${options.strategy} | Mode: ${options.mode} | Max Agents: ${options.maxAgents}`);
@@ -541,173 +559,12 @@ function stopMCPServers() {
541
559
  // Ignore errors
542
560
  }
543
561
  }
544
- // Helper function to auto-update SnowCode to latest version
545
- async function autoUpdateSnowCode(verbose = false) {
546
- try {
547
- const { execSync } = require('child_process');
548
- const { existsSync, readdirSync, rmSync } = require('fs');
549
- const { join, dirname } = require('path');
550
- if (verbose) {
551
- cliLogger.info('šŸ”„ Checking for SnowCode updates...');
552
- }
553
- // Get current version
554
- const currentVersion = execSync('snow-code --version', { encoding: 'utf8' }).trim();
555
- // Get latest version from npm
556
- const latestVersion = execSync('npm view @groeimetai/snow-code version', { encoding: 'utf8' }).trim();
557
- // Helper to find node_modules in current and parent directories
558
- const findNodeModules = (startPath) => {
559
- const found = [];
560
- let currentPath = startPath;
561
- // Check up to 3 levels up
562
- for (let i = 0; i < 3; i++) {
563
- const nodeModulesPath = join(currentPath, 'node_modules', '@groeimetai');
564
- if (existsSync(nodeModulesPath)) {
565
- found.push(currentPath);
566
- }
567
- const parent = dirname(currentPath);
568
- if (parent === currentPath)
569
- break; // Reached root
570
- currentPath = parent;
571
- }
572
- return found;
573
- };
574
- // Helper to update local node_modules
575
- const updateLocalNodeModules = (projectRoot) => {
576
- const groeimetaiPath = join(projectRoot, 'node_modules', '@groeimetai');
577
- if (existsSync(groeimetaiPath)) {
578
- // Check main package version AND platform binaries
579
- const snowcodePackage = join(groeimetaiPath, 'snow-code', 'package.json');
580
- let needsUpdate = false;
581
- if (existsSync(snowcodePackage)) {
582
- const pkg = JSON.parse(require('fs').readFileSync(snowcodePackage, 'utf8'));
583
- if (pkg.version !== latestVersion) {
584
- needsUpdate = true;
585
- if (verbose) {
586
- cliLogger.info(`Main package outdated: ${pkg.version} → ${latestVersion}`);
587
- }
588
- }
589
- }
590
- else {
591
- needsUpdate = true;
592
- }
593
- // Also check platform binaries (snow-code-darwin-arm64, etc.)
594
- if (!needsUpdate) {
595
- try {
596
- const packages = readdirSync(groeimetaiPath);
597
- for (const pkg of packages) {
598
- if (pkg.startsWith('snow-code-')) {
599
- const pkgJsonPath = join(groeimetaiPath, pkg, 'package.json');
600
- if (existsSync(pkgJsonPath)) {
601
- const pkgJson = JSON.parse(require('fs').readFileSync(pkgJsonPath, 'utf8'));
602
- if (pkgJson.version !== latestVersion) {
603
- needsUpdate = true;
604
- if (verbose) {
605
- cliLogger.info(`Platform binary outdated: ${pkg}@${pkgJson.version} → ${latestVersion}`);
606
- }
607
- break;
608
- }
609
- }
610
- }
611
- }
612
- }
613
- catch (err) {
614
- if (verbose) {
615
- cliLogger.debug(`Error checking platform binaries: ${err}`);
616
- }
617
- }
618
- }
619
- if (needsUpdate) {
620
- if (verbose) {
621
- cliLogger.info(`šŸ“¦ Updating SnowCode in ${projectRoot}...`);
622
- }
623
- // Remove old platform binaries to force reinstall
624
- try {
625
- const packages = readdirSync(groeimetaiPath);
626
- for (const pkg of packages) {
627
- if (pkg.startsWith('snow-code-') || pkg === 'snow-code') {
628
- const pkgPath = join(groeimetaiPath, pkg);
629
- cliLogger.debug(`Removing old package: ${pkg}`);
630
- rmSync(pkgPath, { recursive: true, force: true });
631
- }
632
- }
633
- }
634
- catch (err) {
635
- cliLogger.debug(`Cleanup error: ${err}`);
636
- }
637
- // Remove package-lock.json to ensure fresh install (avoid stale lockfile cache)
638
- const lockfilePath = join(projectRoot, 'package-lock.json');
639
- if (existsSync(lockfilePath)) {
640
- cliLogger.debug('Removing stale package-lock.json');
641
- rmSync(lockfilePath, { force: true });
642
- }
643
- // Install fresh version
644
- execSync('npm install @groeimetai/snow-code@latest', {
645
- stdio: 'inherit',
646
- cwd: projectRoot
647
- });
648
- // Restore executable permissions for platform binaries
649
- try {
650
- const packages = readdirSync(groeimetaiPath);
651
- for (const pkg of packages) {
652
- if (pkg.startsWith('snow-code-')) {
653
- const binPath = join(groeimetaiPath, pkg, 'bin');
654
- if (existsSync(binPath)) {
655
- const binaries = readdirSync(binPath);
656
- for (const binary of binaries) {
657
- const binaryPath = join(binPath, binary);
658
- try {
659
- execSync(`chmod +x "${binaryPath}"`, { stdio: 'ignore' });
660
- cliLogger.debug(`Set executable: ${pkg}/bin/${binary}`);
661
- }
662
- catch (err) {
663
- cliLogger.debug(`Chmod error for ${binary}: ${err}`);
664
- }
665
- }
666
- }
667
- }
668
- }
669
- }
670
- catch (err) {
671
- cliLogger.debug(`Error setting permissions: ${err}`);
672
- }
673
- cliLogger.info(`āœ… Updated SnowCode in ${projectRoot}`);
674
- }
675
- }
676
- };
677
- if (currentVersion !== latestVersion) {
678
- cliLogger.info(`šŸ“¦ Updating SnowCode: ${currentVersion} → ${latestVersion}`);
679
- // Update global version
680
- execSync('npm install -g @groeimetai/snow-code@latest', { stdio: 'inherit' });
681
- // Update all local node_modules
682
- const projectRoots = findNodeModules(process.cwd());
683
- cliLogger.info(`Found ${projectRoots.length} project(s) with node_modules`);
684
- for (const root of projectRoots) {
685
- updateLocalNodeModules(root);
686
- }
687
- cliLogger.info(`āœ… SnowCode updated to ${latestVersion}`);
688
- }
689
- else {
690
- cliLogger.info(`āœ… SnowCode is up-to-date (${currentVersion})`);
691
- // Even if global is up-to-date, check local node_modules
692
- const projectRoots = findNodeModules(process.cwd());
693
- cliLogger.debug(`Checking ${projectRoots.length} project(s) for local updates`);
694
- for (const root of projectRoots) {
695
- updateLocalNodeModules(root);
696
- }
697
- }
698
- }
699
- catch (error) {
700
- // Log error but don't block execution
701
- cliLogger.warn(`āš ļø Auto-update check failed: ${error instanceof Error ? error.message : String(error)}`);
702
- cliLogger.debug(`Full error: ${error}`);
703
- }
704
- }
705
562
  // Helper function to execute SnowCode directly with the objective
706
563
  async function executeSnowCode(objective, options) {
707
564
  let mcpServerPIDs = [];
708
565
  try {
709
566
  // Auto-update SnowCode to latest version
710
- await autoUpdateSnowCode(options.verbose);
567
+ await (0, auto_update_snow_code_js_1.autoUpdateSnowCode)(process.cwd(), options.verbose);
711
568
  // Check if SnowCode CLI is available
712
569
  const { execSync } = require('child_process');
713
570
  try {
@@ -814,7 +671,7 @@ async function executeSnowCode(objective, options) {
814
671
  stopMCPServers();
815
672
  }
816
673
  cliLogger.error('āŒ Error launching SnowCode:', error instanceof Error ? error.message : String(error));
817
- cliLogger.info('šŸ“‹ Please start SnowCode manually: snowcode');
674
+ cliLogger.info('šŸ“‹ Please start SnowCode manually: snow-code');
818
675
  return false;
819
676
  }
820
677
  }
@@ -1678,41 +1535,28 @@ program
1678
1535
  await migrationUtil.migrate();
1679
1536
  s.stop('Migration complete');
1680
1537
  }
1681
- // Install/Update SnowCode (both global and local peer dependency)
1538
+ // Install/Update SnowCode with comprehensive auto-update utility
1682
1539
  const snowcodeSpinner = prompts.spinner();
1683
- snowcodeSpinner.start('Checking SnowCode installation');
1540
+ snowcodeSpinner.start('Updating snow-code to latest version');
1684
1541
  try {
1685
- const { execSync } = await Promise.resolve().then(() => __importStar(require('child_process')));
1686
- // Update GLOBAL snow-code first (used by snow-flow auth login)
1687
- snowcodeSpinner.message('Updating global @groeimetai/snow-code');
1688
- try {
1689
- execSync('npm install -g @groeimetai/snow-code@latest', {
1690
- stdio: 'ignore'
1691
- });
1692
- snowcodeSpinner.message('Global SnowCode updated to latest');
1693
- }
1694
- catch (globalErr) {
1695
- // Continue even if global update fails
1696
- }
1697
- // Update local peer dependency - ALWAYS use @latest to avoid cached old versions
1698
- snowcodeSpinner.message('Updating local @groeimetai/snow-code');
1699
- try {
1700
- // ALWAYS install @latest instead of peerDependency version
1701
- // This ensures users get the newest features/fixes, not a cached older version
1702
- execSync('npm install @groeimetai/snow-code@latest', {
1703
- stdio: 'ignore',
1704
- cwd: targetDir
1705
- });
1706
- snowcodeSpinner.message('Local SnowCode updated to latest');
1542
+ const updateResult = await (0, auto_update_snow_code_js_1.autoUpdateSnowCode)(targetDir, false);
1543
+ if (updateResult.success) {
1544
+ snowcodeSpinner.stop(`āœ“ Snow-code updated to v${updateResult.mainPackageVersion || 'latest'}`);
1545
+ if (updateResult.binaryPackagesUpdated > 0) {
1546
+ prompts.log.info(` Updated ${updateResult.binaryPackagesUpdated} platform-specific binaries`);
1547
+ }
1707
1548
  }
1708
- catch (localErr) {
1709
- // Continue even if local update fails
1549
+ else {
1550
+ snowcodeSpinner.stop('āš ļø Snow-code update completed with warnings');
1551
+ if (updateResult.errors.length > 0) {
1552
+ prompts.log.warn('Some updates failed - run manually if needed:');
1553
+ prompts.log.warn(' npm install -g @groeimetai/snow-code@latest');
1554
+ prompts.log.warn(' npm run update-deps');
1555
+ }
1710
1556
  }
1711
- // Verify installation
1712
- snowcodeSpinner.stop('SnowCode updated (global + local)');
1713
1557
  }
1714
1558
  catch (err) {
1715
- snowcodeSpinner.stop('Could not update SnowCode');
1559
+ snowcodeSpinner.stop('Could not update snow-code');
1716
1560
  prompts.log.warn('Run: npm install -g @groeimetai/snow-code@latest');
1717
1561
  prompts.log.warn('And: npm run update-deps');
1718
1562
  }