@pikecode/api-key-manager 2.0.8 → 2.1.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pikecode/api-key-manager",
3
- "version": "2.0.8",
3
+ "version": "2.1.0",
4
4
  "description": "A CLI tool for managing and switching multiple API provider configurations",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -59,16 +59,31 @@ async function executeWithEnv(config, launchArgs = []) {
59
59
 
60
60
  return new Promise((resolve, reject) => {
61
61
  const child = spawn('claude', args, {
62
- stdio: 'inherit',
62
+ stdio: ['inherit', 'inherit', 'pipe'],
63
63
  env,
64
64
  shell: false
65
65
  });
66
66
 
67
+ let stderrOutput = '';
68
+
69
+ // 捕获 stderr 用于检查错误信息
70
+ child.stderr.on('data', (data) => {
71
+ const output = data.toString();
72
+ stderrOutput += output;
73
+ // 同时输出 stderr 给用户
74
+ process.stderr.write(data);
75
+ });
76
+
67
77
  child.on('close', (code, signal) => {
68
78
  if (code === 0 || code === 130 || signal === 'SIGINT') {
69
79
  resolve();
70
80
  } else {
71
- reject(new Error(`Claude Code 异常退出,退出代码: ${code}\n提示: 请检查 API 配置是否正确`));
81
+ // 检查是否是"没有可恢复会话"的错误
82
+ if (stderrOutput.includes('No conversation found to continue')) {
83
+ reject(new Error('没有可恢复的会话\n提示: 请选择不带 --continue 参数重新开始'));
84
+ } else {
85
+ reject(new Error(`Claude Code 异常退出,退出代码: ${code}\n提示: 请检查 API 配置是否正确`));
86
+ }
72
87
  }
73
88
  });
74
89