yingclaw 2.4.0 → 2.4.2

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.
Files changed (2) hide show
  1. package/bin/cli.js +32 -12
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { Command } = require('commander');
4
- const { select, input, confirm, editor } = require('@inquirer/prompts');
4
+ const { select, input, confirm } = require('@inquirer/prompts');
5
5
  const {
6
6
  loadConfig,
7
7
  saveConfig,
@@ -25,7 +25,7 @@ const pkg = require('../package.json');
25
25
  const { buildMenuStatusLines, buildStatusView } = require('../lib/panel');
26
26
  const { buildClaudeInstallCommand } = require('../lib/install');
27
27
  const { clearClaudeDesktopConfig, isDesktopConfigured, openClaudeDesktop, writeClaudeDesktopConfig } = require('../lib/desktop');
28
- const { runDoctorChecks, summarize, STATUS_OK, STATUS_FAIL, STATUS_WARN, STATUS_INFO } = require('../lib/doctor');
28
+ const { runDoctorChecks, summarize, checkShellRcBlock, STATUS_OK, STATUS_FAIL, STATUS_WARN, STATUS_INFO } = require('../lib/doctor');
29
29
 
30
30
  const program = new Command();
31
31
 
@@ -684,14 +684,22 @@ program
684
684
  const spinner = ora('清除中...').start();
685
685
  setSystemPrompt(config, null);
686
686
  saveConfig(config);
687
+ const rcBlockOnClear = checkShellRcBlock();
688
+ if (rcBlockOnClear.found) {
689
+ writeEnvToZshrc(config.baseUrl, config.apiKey, config.model, config.fastModel, {});
690
+ }
687
691
  spinner.succeed(chalk.green('系统提示词已清除'));
688
692
  return;
689
693
  }
690
694
 
691
- const newPrompt = await editor({
692
- message: chalk.cyan('编辑系统提示词(保存并关闭编辑器后生效)'),
693
- default: currentPrompt || '',
694
- waitForUseInput: false,
695
+ if (currentPrompt) {
696
+ console.log(chalk.dim(' 直接输入新内容覆盖,留空并回车取消'));
697
+ }
698
+
699
+ const newPrompt = await input({
700
+ message: chalk.cyan('系统提示词'),
701
+ default: currentPrompt || undefined,
702
+ validate: () => true,
695
703
  });
696
704
 
697
705
  if (!newPrompt || !newPrompt.trim()) {
@@ -702,13 +710,25 @@ program
702
710
  const spinner = ora('保存中...').start();
703
711
  setSystemPrompt(config, newPrompt);
704
712
  saveConfig(config);
705
- spinner.succeed(chalk.green('系统提示词已保存'));
706
713
 
707
- console.log(boxen(
708
- chalk.dim('• 通过菜单"启动 Claude Code"时自动应用\n') +
709
- chalk.dim('• 终端直接使用 claude 命令请重新运行 ') + chalk.cyan('claw code'),
710
- { padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
711
- ));
714
+ // 如果终端已配置,自动同步 shell RC
715
+ const rcBlock = checkShellRcBlock();
716
+ if (rcBlock.found) {
717
+ writeEnvToZshrc(config.baseUrl, config.apiKey, config.model, config.fastModel, { systemPrompt: getSystemPrompt(config) });
718
+ spinner.succeed(chalk.green('系统提示词已保存,已同步到终端配置'));
719
+ console.log(boxen(
720
+ chalk.dim('• 通过菜单"启动 Claude Code"立即生效\n') +
721
+ chalk.dim('• 终端直接运行 claude 需先执行:') + chalk.cyan(`source ${rcBlock.file}`),
722
+ { padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
723
+ ));
724
+ } else {
725
+ spinner.succeed(chalk.green('系统提示词已保存'));
726
+ console.log(boxen(
727
+ chalk.dim('• 通过菜单"启动 Claude Code"时自动应用\n') +
728
+ chalk.dim('• 终端直接使用 claude 命令请重新运行 ') + chalk.cyan('claw code'),
729
+ { padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
730
+ ));
731
+ }
712
732
  });
713
733
 
714
734
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yingclaw",
3
- "version": "2.4.0",
3
+ "version": "2.4.2",
4
4
  "description": "Claude Code × 国产大模型一键接入:DeepSeek、Kimi、Qwen、MiniMax、GLM、MiMo",
5
5
  "main": "index.js",
6
6
  "bin": {