yingclaw 2.2.0 → 2.2.3
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 +10 -3
- package/lib/desktop.js +10 -5
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -787,7 +787,7 @@ program
|
|
|
787
787
|
{ padding: { top: 0, bottom: 0, left: 2, right: 2 }, borderStyle: 'round', borderColor: 'green', margin: { top: 1, bottom: 1 } }
|
|
788
788
|
));
|
|
789
789
|
|
|
790
|
-
if (process.platform === 'darwin') {
|
|
790
|
+
if (process.platform === 'darwin' || process.platform === 'win32') {
|
|
791
791
|
const shouldReopen = await confirm({ message: '是否现在重启 Claude 桌面应用使默认配置生效?', default: true });
|
|
792
792
|
if (shouldReopen) {
|
|
793
793
|
const openSpinner = ora('正在重启 Claude 桌面应用...').start();
|
|
@@ -795,8 +795,15 @@ program
|
|
|
795
795
|
await openClaudeDesktop();
|
|
796
796
|
openSpinner.succeed(chalk.green('Claude 桌面应用已重启(已恢复 1P 模式)'));
|
|
797
797
|
} catch (e) {
|
|
798
|
-
openSpinner.fail(chalk.red(
|
|
799
|
-
|
|
798
|
+
openSpinner.fail(chalk.red(`自动重启失败: ${e.message}`));
|
|
799
|
+
if (process.platform === 'win32') {
|
|
800
|
+
console.log(chalk.yellow('\n请手动操作(仅关闭窗口不够,进程还在系统托盘):'));
|
|
801
|
+
console.log(chalk.dim(' 1. 任务栏右下角找 Claude 图标 → 右键 → 退出'));
|
|
802
|
+
console.log(chalk.dim(' 2. 或在任务管理器中结束所有 Claude.exe 进程'));
|
|
803
|
+
console.log(chalk.dim(' 3. 然后重新打开 Claude'));
|
|
804
|
+
} else {
|
|
805
|
+
console.log(chalk.dim('请手动完全退出 Claude 后重新打开。'));
|
|
806
|
+
}
|
|
800
807
|
}
|
|
801
808
|
}
|
|
802
809
|
} else {
|
package/lib/desktop.js
CHANGED
|
@@ -231,7 +231,7 @@ function isDesktopConfigured(options = {}) {
|
|
|
231
231
|
return meta.entries.some((entry) => entry && entry.name === YINGCLAW_ENTRY_NAME);
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
-
function buildClaudeDesktopOpenCommands(platform = process.platform) {
|
|
234
|
+
function buildClaudeDesktopOpenCommands(platform = process.platform, options = {}) {
|
|
235
235
|
// 必须先完全退出 Claude,新配置只在启动时读取一次
|
|
236
236
|
if (platform === 'darwin') {
|
|
237
237
|
return [
|
|
@@ -244,10 +244,15 @@ function buildClaudeDesktopOpenCommands(platform = process.platform) {
|
|
|
244
244
|
}
|
|
245
245
|
|
|
246
246
|
if (platform === 'win32') {
|
|
247
|
-
//
|
|
247
|
+
// 在 Node 里展开 LOCALAPPDATA,避免 cmd /c 解析带空格的中文路径出错
|
|
248
|
+
const localAppData = options.localAppData
|
|
249
|
+
|| process.env.LOCALAPPDATA
|
|
250
|
+
|| `${options.homeDir || os.homedir()}\\AppData\\Local`;
|
|
251
|
+
const claudeDir = `${localAppData}\\AnthropicClaude`;
|
|
252
|
+
// taskkill /T 连带杀子进程;start "" /D 切到 Claude 目录后启动 Claude.exe(Squirrel 标准安装位置)
|
|
248
253
|
return [
|
|
249
|
-
{ command: 'taskkill', args: ['/IM', 'Claude.exe', '/F', '/T'], optional: true, waitAfter:
|
|
250
|
-
{ command: 'cmd', args: ['/c', 'start', '
|
|
254
|
+
{ command: 'taskkill', args: ['/IM', 'Claude.exe', '/F', '/T'], optional: true, waitAfter: 1500 },
|
|
255
|
+
{ command: 'cmd', args: ['/c', 'start', '', '/D', claudeDir, 'Claude.exe'], optional: true, waitAfter: 800 },
|
|
251
256
|
];
|
|
252
257
|
}
|
|
253
258
|
|
|
@@ -260,7 +265,7 @@ async function sleep(ms) {
|
|
|
260
265
|
|
|
261
266
|
async function openClaudeDesktop(options = {}) {
|
|
262
267
|
const platform = options.platform || process.platform;
|
|
263
|
-
const commands = buildClaudeDesktopOpenCommands(platform);
|
|
268
|
+
const commands = buildClaudeDesktopOpenCommands(platform, options);
|
|
264
269
|
if (!commands) return { result: 'unsupported' };
|
|
265
270
|
|
|
266
271
|
const runner = options.runner || spawnSync;
|