snow-ai 0.4.23 → 0.4.24

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/bundle/cli.mjs CHANGED
@@ -2505,12 +2505,12 @@ var init_base = __esm({
2505
2505
  return false;
2506
2506
  }
2507
2507
  const parts = os.release().split(".");
2508
- const major = Number(parts[0]);
2508
+ const major2 = Number(parts[0]);
2509
2509
  const build2 = Number(parts[2] ?? 0);
2510
- if (major < 10) {
2510
+ if (major2 < 10) {
2511
2511
  return true;
2512
2512
  }
2513
- if (major === 10 && build2 < 10586) {
2513
+ if (major2 === 10 && build2 < 10586) {
2514
2514
  return true;
2515
2515
  }
2516
2516
  return false;
@@ -36198,8 +36198,8 @@ var init_lib = __esm({
36198
36198
  minNodeVersion = process && process.env && process.env.YARGS_MIN_NODE_VERSION ? Number(process.env.YARGS_MIN_NODE_VERSION) : 12;
36199
36199
  nodeVersion = (_b13 = (_a14 = process === null || process === void 0 ? void 0 : process.versions) === null || _a14 === void 0 ? void 0 : _a14.node) !== null && _b13 !== void 0 ? _b13 : (_c5 = process === null || process === void 0 ? void 0 : process.version) === null || _c5 === void 0 ? void 0 : _c5.slice(1);
36200
36200
  if (nodeVersion) {
36201
- const major = Number(nodeVersion.match(/^([^.]+)/)[1]);
36202
- if (major < minNodeVersion) {
36201
+ const major2 = Number(nodeVersion.match(/^([^.]+)/)[1]);
36202
+ if (major2 < minNodeVersion) {
36203
36203
  throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
36204
36204
  }
36205
36205
  }
@@ -54623,6 +54623,14 @@ function updateProxyConfig(proxyConfig) {
54623
54623
  const { openai, ...configWithoutOpenai } = fullConfig;
54624
54624
  const configData = JSON.stringify(configWithoutOpenai, null, 2);
54625
54625
  writeFileSync4(CONFIG_FILE, configData, "utf8");
54626
+ try {
54627
+ const { getActiveProfileName: getActiveProfileName2, saveProfile: saveProfile2 } = (init_configManager(), __toCommonJS(configManager_exports));
54628
+ const activeProfileName = getActiveProfileName2();
54629
+ if (activeProfileName) {
54630
+ saveProfile2(activeProfileName, fullConfig);
54631
+ }
54632
+ } catch {
54633
+ }
54626
54634
  } catch (error) {
54627
54635
  throw new Error(`Failed to save proxy configuration: ${error}`);
54628
54636
  }
@@ -183598,7 +183606,7 @@ var require_prettier = __commonJS({
183598
183606
  gte: require_gte2()
183599
183607
  };
183600
183608
  var arrayify = require_arrayify();
183601
- var currentVersion = require_package().version;
183609
+ var currentVersion2 = require_package().version;
183602
183610
  var coreOptions = require_core_options().options;
183603
183611
  function getSupportInfo2({
183604
183612
  plugins: plugins2 = [],
@@ -183606,7 +183614,7 @@ var require_prettier = __commonJS({
183606
183614
  showDeprecated = false,
183607
183615
  showInternal = false
183608
183616
  } = {}) {
183609
- const version22 = currentVersion.split("-", 1)[0];
183617
+ const version22 = currentVersion2.split("-", 1)[0];
183610
183618
  const languages = plugins2.flatMap((plugin) => plugin.languages || []).filter(filterSince);
183611
183619
  const options2 = arrayify(Object.assign({}, ...plugins2.map(({
183612
183620
  options: options22
@@ -219187,8 +219195,14 @@ var init_vscodeConnection = __esm({
219187
219195
  }
219188
219196
  if (this.client) {
219189
219197
  try {
219190
- this.client.removeAllListeners();
219191
- this.client.close();
219198
+ this.client.on("error", () => {
219199
+ });
219200
+ this.client.removeAllListeners("open");
219201
+ this.client.removeAllListeners("message");
219202
+ this.client.removeAllListeners("close");
219203
+ if (this.client.readyState !== import_websocket.default.CLOSED && this.client.readyState !== import_websocket.default.CLOSING) {
219204
+ this.client.close();
219205
+ }
219192
219206
  } catch (error) {
219193
219207
  }
219194
219208
  this.client = null;
@@ -361145,8 +361159,8 @@ var require_major = __commonJS({
361145
361159
  "node_modules/semver/functions/major.js"(exports2, module2) {
361146
361160
  "use strict";
361147
361161
  var SemVer = require_semver();
361148
- var major = (a, loose) => new SemVer(a, loose).major;
361149
- module2.exports = major;
361162
+ var major2 = (a, loose) => new SemVer(a, loose).major;
361163
+ module2.exports = major2;
361150
361164
  }
361151
361165
  });
361152
361166
 
@@ -361392,12 +361406,12 @@ var require_coerce = __commonJS({
361392
361406
  if (match === null) {
361393
361407
  return null;
361394
361408
  }
361395
- const major = match[2];
361409
+ const major2 = match[2];
361396
361410
  const minor = match[3] || "0";
361397
361411
  const patch = match[4] || "0";
361398
361412
  const prerelease = options2.includePrerelease && match[5] ? `-${match[5]}` : "";
361399
361413
  const build2 = options2.includePrerelease && match[6] ? `+${match[6]}` : "";
361400
- return parse2(`${major}.${minor}.${patch}${prerelease}${build2}`, options2);
361414
+ return parse2(`${major2}.${minor}.${patch}${prerelease}${build2}`, options2);
361401
361415
  };
361402
361416
  module2.exports = coerce2;
361403
361417
  }
@@ -362419,7 +362433,7 @@ var require_semver2 = __commonJS({
362419
362433
  var clean = require_clean();
362420
362434
  var inc = require_inc();
362421
362435
  var diff2 = require_diff();
362422
- var major = require_major();
362436
+ var major2 = require_major();
362423
362437
  var minor = require_minor();
362424
362438
  var patch = require_patch();
362425
362439
  var prerelease = require_prerelease();
@@ -362457,7 +362471,7 @@ var require_semver2 = __commonJS({
362457
362471
  clean,
362458
362472
  inc,
362459
362473
  diff: diff2,
362460
- major,
362474
+ major: major2,
362461
362475
  minor,
362462
362476
  patch,
362463
362477
  prerelease,
@@ -389469,10 +389483,10 @@ function detectBrowserPlatform() {
389469
389483
  function isWindows11(version2) {
389470
389484
  const parts = version2.split(".");
389471
389485
  if (parts.length > 2) {
389472
- const major = parseInt(parts[0], 10);
389486
+ const major2 = parseInt(parts[0], 10);
389473
389487
  const minor = parseInt(parts[1], 10);
389474
389488
  const patch = parseInt(parts[2], 10);
389475
- return major > 10 || major === 10 && minor > 0 || major === 10 && minor === 0 && patch >= 22e3;
389489
+ return major2 > 10 || major2 === 10 && minor > 0 || major2 === 10 && minor === 0 && patch >= 22e3;
389476
389490
  }
389477
389491
  return false;
389478
389492
  }
@@ -401043,7 +401057,7 @@ async function collectAllMCPTools() {
401043
401057
  return await getCachedTools();
401044
401058
  }
401045
401059
  async function getMCPServicesInfo() {
401046
- if (!isCacheValid()) {
401060
+ if (!await isCacheValid()) {
401047
401061
  await refreshToolsCache();
401048
401062
  }
401049
401063
  return (toolsCache == null ? void 0 : toolsCache.servicesInfo) || [];
@@ -472832,7 +472846,17 @@ var init_codebaseIndexAgent = __esm({
472832
472846
  async scanFiles() {
472833
472847
  const files = [];
472834
472848
  const scanDir = (dir) => {
472835
- const entries = fs32.readdirSync(dir, { withFileTypes: true });
472849
+ let entries;
472850
+ try {
472851
+ entries = fs32.readdirSync(dir, { withFileTypes: true });
472852
+ } catch (error) {
472853
+ if (error.code === "EPERM" || error.code === "EACCES") {
472854
+ logger.warn(`\u8DF3\u8FC7\u65E0\u6743\u9650\u8BBF\u95EE\u7684\u76EE\u5F55: ${dir}`);
472855
+ return;
472856
+ }
472857
+ logger.warn(`\u626B\u63CF\u76EE\u5F55\u5931\u8D25 (${error.code || "unknown"}): ${dir}`);
472858
+ return;
472859
+ }
472836
472860
  for (const entry of entries) {
472837
472861
  if (this.shouldStop)
472838
472862
  break;
@@ -476693,15 +476717,33 @@ var MCPConfigScreen_exports = {};
476693
476717
  __export(MCPConfigScreen_exports, {
476694
476718
  default: () => MCPConfigScreen
476695
476719
  });
476696
- import { spawn as spawn6 } from "child_process";
476720
+ import { spawn as spawn6, execSync as execSync5 } from "child_process";
476697
476721
  import { writeFileSync as writeFileSync9, readFileSync as readFileSync14, existsSync as existsSync17 } from "fs";
476698
476722
  import { join as join17 } from "path";
476699
476723
  import { homedir as homedir11, platform as platform4 } from "os";
476724
+ function checkCommandExists(command) {
476725
+ try {
476726
+ execSync5(`which ${command}`, { stdio: "ignore" });
476727
+ return true;
476728
+ } catch {
476729
+ return false;
476730
+ }
476731
+ }
476700
476732
  function getSystemEditor() {
476701
476733
  if (platform4() === "win32") {
476702
476734
  return "notepad";
476703
476735
  }
476704
- return process.env["EDITOR"] || "vim";
476736
+ const envEditor = process.env["EDITOR"];
476737
+ if (envEditor && checkCommandExists(envEditor)) {
476738
+ return envEditor;
476739
+ }
476740
+ const editors = ["nano", "vim", "vi"];
476741
+ for (const editor of editors) {
476742
+ if (checkCommandExists(editor)) {
476743
+ return editor;
476744
+ }
476745
+ }
476746
+ return null;
476705
476747
  }
476706
476748
  function MCPConfigScreen({ onBack }) {
476707
476749
  const { exit } = use_app_default();
@@ -476710,6 +476752,15 @@ function MCPConfigScreen({ onBack }) {
476710
476752
  const config2 = getMCPConfig();
476711
476753
  writeFileSync9(MCP_CONFIG_FILE2, JSON.stringify(config2, null, 2), "utf8");
476712
476754
  const editor = getSystemEditor();
476755
+ if (!editor) {
476756
+ console.error("No text editor found! Please install nano or vim, or set the EDITOR environment variable.");
476757
+ console.error("Installation command:");
476758
+ console.error(" Ubuntu/Debian: sudo apt-get install nano");
476759
+ console.error(" CentOS/RHEL: sudo yum install nano");
476760
+ console.error(" macOS: nano is usually pre-installed");
476761
+ process.exit(1);
476762
+ return;
476763
+ }
476713
476764
  exit();
476714
476765
  const child = spawn6(editor, [MCP_CONFIG_FILE2], {
476715
476766
  stdio: "inherit"
@@ -477675,10 +477726,30 @@ ${help}
477675
477726
  var meow_default = meow;
477676
477727
 
477677
477728
  // dist/cli.js
477678
- import { execSync as execSync5 } from "child_process";
477729
+ import { execSync as execSync6 } from "child_process";
477679
477730
  import { readFileSync as readFileSync15 } from "fs";
477680
477731
  import { join as join18 } from "path";
477681
477732
  import { fileURLToPath as fileURLToPath5 } from "url";
477733
+ var MIN_NODE_VERSION = 16;
477734
+ var currentVersion = process.version;
477735
+ var major = parseInt(currentVersion.slice(1).split(".")[0] || "0", 10);
477736
+ if (major < MIN_NODE_VERSION) {
477737
+ console.error("\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501");
477738
+ console.error(" \u26A0\uFE0F Node.js Version Compatibility Error");
477739
+ console.error("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n");
477740
+ console.error(`Current Node.js version: ${currentVersion}`);
477741
+ console.error(`Required: Node.js >= ${MIN_NODE_VERSION}.x
477742
+ `);
477743
+ console.error("Please upgrade Node.js to continue:\n");
477744
+ console.error("# Using nvm (recommended):");
477745
+ console.error(` nvm install ${MIN_NODE_VERSION}`);
477746
+ console.error(` nvm use ${MIN_NODE_VERSION}
477747
+ `);
477748
+ console.error("# Or download from official website:");
477749
+ console.error(" https://nodejs.org/\n");
477750
+ console.error("\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\n");
477751
+ process.exit(1);
477752
+ }
477682
477753
  var originalEmitWarning = process.emitWarning;
477683
477754
  process.emitWarning = function(warning, ...args2) {
477684
477755
  if (args2[1] === "DEP0169")
@@ -477718,15 +477789,15 @@ async function loadDependencies() {
477718
477789
  };
477719
477790
  }
477720
477791
  var execAsync2;
477721
- async function checkForUpdates(currentVersion) {
477792
+ async function checkForUpdates(currentVersion2) {
477722
477793
  try {
477723
477794
  const { stdout } = await execAsync2("npm view snow-ai version --registry https://registry.npmjs.org", {
477724
477795
  encoding: "utf8"
477725
477796
  });
477726
477797
  const latestVersion = stdout.trim();
477727
- if (latestVersion && latestVersion !== currentVersion) {
477798
+ if (latestVersion && latestVersion !== currentVersion2) {
477728
477799
  console.log("\n\u{1F514} Update available!");
477729
- console.log(` Current version: ${currentVersion}`);
477800
+ console.log(` Current version: ${currentVersion2}`);
477730
477801
  console.log(` Latest version: ${latestVersion}`);
477731
477802
  console.log(' Run "snow --update" to update\n');
477732
477803
  }
@@ -477768,7 +477839,7 @@ Options
477768
477839
  if (cli.flags.update) {
477769
477840
  console.log("\u{1F504} Updating snow-ai to latest version...");
477770
477841
  try {
477771
- execSync5("npm install -g snow-ai@latest", { stdio: "inherit" });
477842
+ execSync6("npm install -g snow-ai@latest", { stdio: "inherit" });
477772
477843
  console.log("\u2705 Update completed successfully!");
477773
477844
  process.exit(0);
477774
477845
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "snow-ai",
3
- "version": "0.4.23",
3
+ "version": "0.4.24",
4
4
  "description": "Intelligent Command Line Assistant powered by AI",
5
5
  "license": "MIT",
6
6
  "bin": {
package/readme.md CHANGED
@@ -12,6 +12,28 @@ _An intelligent AI-powered CLI tool for developers_
12
12
 
13
13
  ---
14
14
 
15
+ ## Requirements
16
+
17
+ - **Node.js >= 16.x** (Required for ES2020 features)
18
+ - npm >= 8.3.0
19
+
20
+ ### Check Your Node.js Version
21
+
22
+ ```bash
23
+ $ node --version
24
+ ```
25
+
26
+ If your version is below 16.x, please upgrade:
27
+
28
+ ```bash
29
+ # Using nvm (recommended)
30
+ $ nvm install 16
31
+ $ nvm use 16
32
+
33
+ # Or download from official website
34
+ # https://nodejs.org/
35
+ ```
36
+
15
37
  ## Installation
16
38
 
17
39
  ```bash
@@ -54,10 +54,38 @@ function getCurrentRegistry() {
54
54
  }
55
55
  }
56
56
 
57
+ /**
58
+ * Check Node.js version compatibility
59
+ */
60
+ function checkNodeVersion() {
61
+ const currentVersion = process.version;
62
+ const major = parseInt(currentVersion.slice(1).split('.')[0], 10);
63
+ const minVersion = 16;
64
+
65
+ if (major < minVersion) {
66
+ console.error(`\n${colors.bright}${colors.yellow}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${colors.reset}`);
67
+ console.error(`${colors.bright}${colors.yellow} ⚠️ Node.js Version Compatibility Error${colors.reset}`);
68
+ console.error(`${colors.bright}${colors.yellow}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${colors.reset}\n`);
69
+ console.error(`${colors.yellow}Current Node.js version: ${currentVersion}${colors.reset}`);
70
+ console.error(`${colors.yellow}Required: Node.js >= ${minVersion}.x${colors.reset}\n`);
71
+ console.error(`${colors.green}Please upgrade Node.js to continue:${colors.reset}\n`);
72
+ console.error(`${colors.cyan}# Using nvm (recommended):${colors.reset}`);
73
+ console.error(` nvm install ${minVersion}`);
74
+ console.error(` nvm use ${minVersion}\n`);
75
+ console.error(`${colors.cyan}# Or download from official website:${colors.reset}`);
76
+ console.error(` https://nodejs.org/\n`);
77
+ console.error(`${colors.yellow}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${colors.reset}\n`);
78
+ process.exit(1);
79
+ }
80
+ }
81
+
57
82
  /**
58
83
  * Main function
59
84
  */
60
85
  async function main() {
86
+ // Check Node.js version first
87
+ checkNodeVersion();
88
+
61
89
  // Skip if running in CI environment
62
90
  if (process.env.CI || process.env.CONTINUOUS_INTEGRATION) {
63
91
  return;