yingclaw 2.5.26 → 2.5.27
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/bin/cli.js +15 -6
- package/lib/install.js +7 -3
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -736,11 +736,16 @@ program
|
|
|
736
736
|
|
|
737
737
|
console.log(chalk.dim(getStorageHint(file)));
|
|
738
738
|
const displayedConfig = effectiveConfig;
|
|
739
|
+
const needsGatewayHint = process.platform !== 'darwin' && process.platform !== 'win32'
|
|
740
|
+
&& isOpenAiCompatibleConfig(effectiveConfig);
|
|
739
741
|
console.log(boxen(
|
|
740
742
|
chalk.bold('Claude Code 终端已接入\n\n') +
|
|
741
743
|
chalk.dim('Base URL ') + chalk.cyan(buildClaudeEnv(displayedConfig).ANTHROPIC_BASE_URL) + '\n' +
|
|
742
744
|
chalk.dim('模型 ') + chalk.yellow(displayedConfig.model) + '\n\n' +
|
|
743
|
-
|
|
745
|
+
(needsGatewayHint
|
|
746
|
+
? chalk.yellow('注:OpenAI 兼容接口需要本机 Gateway,请在新终端运行 ') + chalk.cyan.bold('claw gateway') + chalk.yellow(' 并保持运行。\n\n')
|
|
747
|
+
: '') +
|
|
748
|
+
chalk.white('需要启动时,在主菜单选择”启动 Claude Code”,或直接输入 ') + chalk.cyan.bold('claude') + '\n' +
|
|
744
749
|
chalk.dim(getActivationHint(file)),
|
|
745
750
|
{ padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
|
|
746
751
|
));
|
|
@@ -848,12 +853,17 @@ program
|
|
|
848
853
|
return;
|
|
849
854
|
}
|
|
850
855
|
|
|
856
|
+
const vscodeNeedsGatewayHint = process.platform !== 'darwin' && process.platform !== 'win32'
|
|
857
|
+
&& isOpenAiCompatibleConfig(effectiveConfig);
|
|
851
858
|
console.log(boxen(
|
|
852
859
|
chalk.bold('VS Code Claude Code 扩展已配置\n\n') +
|
|
853
860
|
chalk.dim('共享设置 ') + chalk.cyan(result.claudeSettings.file) + '\n' +
|
|
854
861
|
chalk.dim('VS Code ') + chalk.cyan(result.vscodeSettings.file) + '\n' +
|
|
855
862
|
chalk.dim('主模型 ') + chalk.yellow(vscodeModel) + '\n' +
|
|
856
863
|
chalk.dim('快速模型 ') + chalk.yellow(vscodeFastModel) + '\n\n' +
|
|
864
|
+
(vscodeNeedsGatewayHint
|
|
865
|
+
? chalk.yellow('注:OpenAI 兼容接口需要本机 Gateway,请在新终端运行 ') + chalk.cyan.bold('claw gateway') + chalk.yellow(' 并保持运行。\n\n')
|
|
866
|
+
: '') +
|
|
857
867
|
chalk.white('已写入 Claude Code settings.json 的 env,并关闭 VS Code 扩展登录提示。\n') +
|
|
858
868
|
chalk.dim('如果 VS Code 已打开,请执行 Developer: Reload Window 或完全重启 VS Code。'),
|
|
859
869
|
{ padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
|
|
@@ -1397,12 +1407,11 @@ program
|
|
|
1397
1407
|
{ padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
|
|
1398
1408
|
));
|
|
1399
1409
|
process.exit(0);
|
|
1400
|
-
} else if (result.status === null) {
|
|
1401
|
-
console.log(chalk.red('\nnpm 命令未找到,请确认 Node.js 和 npm 已正确安装后手动运行:'));
|
|
1402
|
-
console.log(chalk.cyan('npm install -g yingclaw@latest'));
|
|
1403
1410
|
} else {
|
|
1404
|
-
|
|
1405
|
-
console.log(chalk.
|
|
1411
|
+
const hints = getInstallFailureHints(result, chalk);
|
|
1412
|
+
console.log(chalk.red('\n升级失败'));
|
|
1413
|
+
if (hints.length > 0) console.log(...hints);
|
|
1414
|
+
console.log(chalk.dim('\n手动运行:') + chalk.cyan('npm install -g yingclaw@latest'));
|
|
1406
1415
|
}
|
|
1407
1416
|
});
|
|
1408
1417
|
|
package/lib/install.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
const path = require('path');
|
|
1
2
|
const { execSync } = require('child_process');
|
|
2
3
|
|
|
3
4
|
function buildClaudeInstallCommand(network) {
|
|
@@ -20,9 +21,12 @@ function quoteWindowsBatchArg(value) {
|
|
|
20
21
|
return `"${String(value).replace(/"/g, '""')}"`;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
function buildWindowsYingclawUpgradeScript(network) {
|
|
24
|
-
const
|
|
25
|
-
|
|
24
|
+
function buildWindowsYingclawUpgradeScript(network, options = {}) {
|
|
25
|
+
const nodePath = options.nodePath || process.execPath;
|
|
26
|
+
// 用绝对路径避免 PATH 里的残留 npm 被优先找到(System32 等位置)
|
|
27
|
+
const npmCmd = options.npmCmd || path.win32.join(path.win32.dirname(nodePath), 'npm.cmd');
|
|
28
|
+
const { args } = buildYingclawUpgradeCommand(network);
|
|
29
|
+
const commandLine = `call ${quoteWindowsBatchArg(npmCmd)} ${args.map(quoteWindowsBatchArg).join(' ')}`;
|
|
26
30
|
return [
|
|
27
31
|
'@echo off',
|
|
28
32
|
'chcp 65001 >nul',
|