coding-tool-x 3.4.8 → 3.4.9

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": "coding-tool-x",
3
- "version": "3.4.8",
3
+ "version": "3.4.9",
4
4
  "description": "Vibe Coding 增强工作助手 - 智能会话管理、动态渠道切换、全局搜索、实时监控",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -101,9 +101,9 @@ function generateSystemNotificationCommand(type, platformOverride = platform) {
101
101
  } else if (platformOverride === 'win32') {
102
102
  // Windows
103
103
  if (type === 'dialog') {
104
- return `powershell -Command "Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('Claude Code 任务已完成 | 等待交互', 'Coding Tool', 'OK', 'Information')" || ${buildWindowsPopupCommand()}`;
104
+ return `powershell -NoProfile -Command "Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('Claude Code 任务已完成 | 等待交互', 'Coding Tool', 'OK', 'Information')" || ${buildWindowsPopupCommand()}`;
105
105
  } else {
106
- return `powershell -NoProfile -Command "try { [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null; [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null; $xml = New-Object Windows.Data.Xml.Dom.XmlDocument; $xml.LoadXml('<toast><visual><binding template=\\"ToastGeneric\\"><text>Coding Tool</text><text>任务已完成 | 等待交互</text></binding></visual><audio src=\\"ms-winsoundevent:Notification.Default\\"/></toast>'); $toast = [Windows.UI.Notifications.ToastNotification]::new($xml); [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Coding Tool').Show($toast) } catch { $wshell = New-Object -ComObject Wscript.Shell; $wshell.Popup('任务已完成 | 等待交互', 5, 'Coding Tool', 0x40) }" || ${buildWindowsPopupCommand()}`;
106
+ return buildWindowsPopupCommand();
107
107
  }
108
108
  } else {
109
109
  // Linux
@@ -49,7 +49,7 @@ function buildWindowsSettingChangeScript() {
49
49
  ].join('\n');
50
50
  }
51
51
 
52
- function buildWindowsEnvBatchScript(operations = [], { includeSettingChangeBroadcast = true } = {}) {
52
+ function buildWindowsEnvBatchScript(operations = [], { includeSettingChangeBroadcast = false } = {}) {
53
53
  const normalizedOperations = Array.isArray(operations) ? operations.filter(Boolean) : [];
54
54
  const lines = normalizedOperations.map((operation) => {
55
55
  const key = powershellQuote(operation.key || '');
@@ -396,7 +396,16 @@ function syncWindowsEnvironment(nextValues, previousState, options) {
396
396
 
397
397
  const changed = operations.length > 0;
398
398
  if (changed) {
399
- runWindowsEnvCommand(buildWindowsEnvBatchScript(operations), execSync);
399
+ runWindowsEnvCommand(
400
+ buildWindowsEnvBatchScript(operations, { includeSettingChangeBroadcast: false }),
401
+ execSync
402
+ );
403
+ try {
404
+ // WM_SETTINGCHANGE 只是帮助已打开的应用刷新环境变量,失败不应让主流程报错。
405
+ broadcastWindowsSettingChange(execSync);
406
+ } catch {
407
+ // ignore broadcast failures; registry writes are already durable
408
+ }
400
409
  }
401
410
 
402
411
  if (nextKeys.length > 0) {
@@ -348,20 +348,7 @@ function notify(mode, message) {
348
348
  const command = 'powershell -NoProfile -Command ' + JSON.stringify(ps) + ' || ' + popupCommand
349
349
  execSync(command, { stdio: 'ignore', windowsHide: true })
350
350
  } else {
351
- const toastXml = '<toast><visual><binding template="ToastGeneric"><text>' +
352
- escapeForXml(title) + '</text><text>' + escapeForXml(message) +
353
- '</text></binding></visual><audio src="ms-winsoundevent:Notification.Default"/></toast>'
354
- const ps = 'try { ' +
355
- '[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null; ' +
356
- '[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null; ' +
357
- '$xml = New-Object Windows.Data.Xml.Dom.XmlDocument; ' +
358
- '$xml.LoadXml(\\'' + toastXml.replace(/'/g, "''") + '\\'); ' +
359
- '$toast = [Windows.UI.Notifications.ToastNotification]::new($xml); ' +
360
- "[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Coding Tool').Show($toast) " +
361
- "} catch { $wshell = New-Object -ComObject Wscript.Shell; $wshell.Popup('" +
362
- escapeForPowerShellSingleQuote(message) + "', 5, '" + escapeForPowerShellSingleQuote(title) + "', 0x40) }"
363
- const command = 'powershell -NoProfile -Command ' + JSON.stringify(ps) + ' || ' + popupCommand
364
- execSync(command, { stdio: 'ignore', windowsHide: true })
351
+ execSync(popupCommand, { stdio: 'ignore', windowsHide: true })
365
352
  }
366
353
  return
367
354
  }
@@ -912,9 +899,7 @@ function generateSystemNotificationCommand(type, message, platformOverride = os.
912
899
  if (normalizedType === 'dialog') {
913
900
  return `powershell -NoProfile -Command "Add-Type -AssemblyName PresentationFramework; [System.Windows.MessageBox]::Show('${escapeForPowerShellSingleQuote(message)}', '${escapeForPowerShellSingleQuote(title)}', 'OK', 'Information')" || ${popupCommand}`;
914
901
  }
915
-
916
- const toastXml = `<toast><visual><binding template="ToastGeneric"><text>${escapeForXml(title)}</text><text>${escapeForXml(message)}</text></binding></visual><audio src="ms-winsoundevent:Notification.Default"/></toast>`;
917
- return `powershell -NoProfile -Command "try { [Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] > $null; [Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] > $null; $xml = New-Object Windows.Data.Xml.Dom.XmlDocument; $xml.LoadXml('${toastXml.replace(/'/g, "''")}'); $toast = [Windows.UI.Notifications.ToastNotification]::new($xml); [Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('Coding Tool').Show($toast) } catch { $wshell = New-Object -ComObject Wscript.Shell; $wshell.Popup('${escapeForPowerShellSingleQuote(message)}', 5, '${escapeForPowerShellSingleQuote(title)}', 0x40) }" || ${popupCommand}`;
902
+ return popupCommand;
918
903
  }
919
904
 
920
905
  if (normalizedType === 'dialog') {