snow-ai 0.4.22 → 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 +100 -27
- package/package.json +1 -1
- package/readme.md +22 -0
- package/scripts/postinstall.cjs +28 -0
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
|
|
2508
|
+
const major2 = Number(parts[0]);
|
|
2509
2509
|
const build2 = Number(parts[2] ?? 0);
|
|
2510
|
-
if (
|
|
2510
|
+
if (major2 < 10) {
|
|
2511
2511
|
return true;
|
|
2512
2512
|
}
|
|
2513
|
-
if (
|
|
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
|
|
36202
|
-
if (
|
|
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
|
|
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 =
|
|
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.
|
|
219191
|
-
|
|
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
|
|
361149
|
-
module2.exports =
|
|
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
|
|
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(`${
|
|
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
|
|
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
|
|
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
|
|
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) || [];
|
|
@@ -403520,6 +403534,7 @@ function CustomHeadersScreen({ onBack }) {
|
|
|
403520
403534
|
const [headerEditingField, setHeaderEditingField] = (0, import_react68.useState)("key");
|
|
403521
403535
|
const [headerEditKey, setHeaderEditKey] = (0, import_react68.useState)("");
|
|
403522
403536
|
const [headerEditValue, setHeaderEditValue] = (0, import_react68.useState)("");
|
|
403537
|
+
const [previousView, setPreviousView] = (0, import_react68.useState)("add");
|
|
403523
403538
|
const actions = config2.schemes.length > 0 ? config2.active ? ["activate", "deactivate", "edit", "delete", "add", "back"] : ["activate", "edit", "delete", "add", "back"] : ["add", "back"];
|
|
403524
403539
|
(0, import_react68.useEffect)(() => {
|
|
403525
403540
|
const savedConfig = getCustomHeadersConfig();
|
|
@@ -403625,13 +403640,14 @@ function CustomHeadersScreen({ onBack }) {
|
|
|
403625
403640
|
}
|
|
403626
403641
|
};
|
|
403627
403642
|
const enterHeadersEditMode = () => {
|
|
403643
|
+
setPreviousView(view);
|
|
403628
403644
|
setHeaderKeys(Object.keys(editHeaders));
|
|
403629
403645
|
setHeaderSelectedIndex(0);
|
|
403630
403646
|
setHeaderEditingIndex(-1);
|
|
403631
403647
|
setView("editHeaders");
|
|
403632
403648
|
};
|
|
403633
403649
|
const exitHeadersEditMode = () => {
|
|
403634
|
-
setView(
|
|
403650
|
+
setView(previousView);
|
|
403635
403651
|
};
|
|
403636
403652
|
const addNewHeader = () => {
|
|
403637
403653
|
setHeaderEditKey("");
|
|
@@ -472830,7 +472846,17 @@ var init_codebaseIndexAgent = __esm({
|
|
|
472830
472846
|
async scanFiles() {
|
|
472831
472847
|
const files = [];
|
|
472832
472848
|
const scanDir = (dir) => {
|
|
472833
|
-
|
|
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
|
+
}
|
|
472834
472860
|
for (const entry of entries) {
|
|
472835
472861
|
if (this.shouldStop)
|
|
472836
472862
|
break;
|
|
@@ -476691,15 +476717,33 @@ var MCPConfigScreen_exports = {};
|
|
|
476691
476717
|
__export(MCPConfigScreen_exports, {
|
|
476692
476718
|
default: () => MCPConfigScreen
|
|
476693
476719
|
});
|
|
476694
|
-
import { spawn as spawn6 } from "child_process";
|
|
476720
|
+
import { spawn as spawn6, execSync as execSync5 } from "child_process";
|
|
476695
476721
|
import { writeFileSync as writeFileSync9, readFileSync as readFileSync14, existsSync as existsSync17 } from "fs";
|
|
476696
476722
|
import { join as join17 } from "path";
|
|
476697
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
|
+
}
|
|
476698
476732
|
function getSystemEditor() {
|
|
476699
476733
|
if (platform4() === "win32") {
|
|
476700
476734
|
return "notepad";
|
|
476701
476735
|
}
|
|
476702
|
-
|
|
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;
|
|
476703
476747
|
}
|
|
476704
476748
|
function MCPConfigScreen({ onBack }) {
|
|
476705
476749
|
const { exit } = use_app_default();
|
|
@@ -476708,6 +476752,15 @@ function MCPConfigScreen({ onBack }) {
|
|
|
476708
476752
|
const config2 = getMCPConfig();
|
|
476709
476753
|
writeFileSync9(MCP_CONFIG_FILE2, JSON.stringify(config2, null, 2), "utf8");
|
|
476710
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
|
+
}
|
|
476711
476764
|
exit();
|
|
476712
476765
|
const child = spawn6(editor, [MCP_CONFIG_FILE2], {
|
|
476713
476766
|
stdio: "inherit"
|
|
@@ -477673,10 +477726,30 @@ ${help}
|
|
|
477673
477726
|
var meow_default = meow;
|
|
477674
477727
|
|
|
477675
477728
|
// dist/cli.js
|
|
477676
|
-
import { execSync as
|
|
477729
|
+
import { execSync as execSync6 } from "child_process";
|
|
477677
477730
|
import { readFileSync as readFileSync15 } from "fs";
|
|
477678
477731
|
import { join as join18 } from "path";
|
|
477679
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
|
+
}
|
|
477680
477753
|
var originalEmitWarning = process.emitWarning;
|
|
477681
477754
|
process.emitWarning = function(warning, ...args2) {
|
|
477682
477755
|
if (args2[1] === "DEP0169")
|
|
@@ -477716,15 +477789,15 @@ async function loadDependencies() {
|
|
|
477716
477789
|
};
|
|
477717
477790
|
}
|
|
477718
477791
|
var execAsync2;
|
|
477719
|
-
async function checkForUpdates(
|
|
477792
|
+
async function checkForUpdates(currentVersion2) {
|
|
477720
477793
|
try {
|
|
477721
477794
|
const { stdout } = await execAsync2("npm view snow-ai version --registry https://registry.npmjs.org", {
|
|
477722
477795
|
encoding: "utf8"
|
|
477723
477796
|
});
|
|
477724
477797
|
const latestVersion = stdout.trim();
|
|
477725
|
-
if (latestVersion && latestVersion !==
|
|
477798
|
+
if (latestVersion && latestVersion !== currentVersion2) {
|
|
477726
477799
|
console.log("\n\u{1F514} Update available!");
|
|
477727
|
-
console.log(` Current version: ${
|
|
477800
|
+
console.log(` Current version: ${currentVersion2}`);
|
|
477728
477801
|
console.log(` Latest version: ${latestVersion}`);
|
|
477729
477802
|
console.log(' Run "snow --update" to update\n');
|
|
477730
477803
|
}
|
|
@@ -477766,7 +477839,7 @@ Options
|
|
|
477766
477839
|
if (cli.flags.update) {
|
|
477767
477840
|
console.log("\u{1F504} Updating snow-ai to latest version...");
|
|
477768
477841
|
try {
|
|
477769
|
-
|
|
477842
|
+
execSync6("npm install -g snow-ai@latest", { stdio: "inherit" });
|
|
477770
477843
|
console.log("\u2705 Update completed successfully!");
|
|
477771
477844
|
process.exit(0);
|
|
477772
477845
|
} catch (error) {
|
package/package.json
CHANGED
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
|
package/scripts/postinstall.cjs
CHANGED
|
@@ -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;
|