@raolin2025/claude-code-node 2.6.7 → 2.6.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": "@raolin2025/claude-code-node",
3
- "version": "2.6.7",
3
+ "version": "2.6.9",
4
4
  "description": "Node.js AI Code Agent CLI - Zero dependencies, pure JavaScript, security hardened, multi-channel notifications, Telegram & QQ Bot remote programming, rich media upload, multi-account management",
5
5
  "type": "module",
6
6
  "main": "src/core/index.js",
package/src/core/cli.js CHANGED
@@ -1008,6 +1008,9 @@ const systemPrompt = cliArgs.systemPrompt || DEFAULT_SYSTEM_PROMPT
1008
1008
  }
1009
1009
  },
1010
1010
  })
1011
+ // 关键:把 startBuiltinListeners 内置监听器的 tgListener 赋给全局 tgListener,
1012
+ // 否则 onConfirmTool 的 tgListener?.bot 恒为 false,权限确认不会推送 Telegram。
1013
+ if (builtinNotify?.tgListener) tgListener = builtinNotify.tgListener
1011
1014
  console.log('📡 Built-in channel listeners started (--with-notify)')
1012
1015
  }
1013
1016
 
package/src/tools/bash.js CHANGED
@@ -3,6 +3,7 @@
3
3
  * 对应原版: src/tools/BashTool/
4
4
  */
5
5
  import { spawn } from 'child_process'
6
+ import { existsSync } from 'node:fs'
6
7
  import { ToolDef } from '../types/index.js'
7
8
  import { checkBashSafety } from '../security/bash-guard.js'
8
9
 
@@ -51,8 +52,35 @@ Usage:
51
52
  }
52
53
 
53
54
  return new Promise((resolve, reject) => {
54
- const shell = process.env.SHELL || '/bin/bash'
55
- const proc = spawn(shell, ['-c', command], {
55
+ // 跨平台 shell 选择:
56
+ // - Windows: 优先用 Git Bash(如已安装),否则用 cmd.exe /c
57
+ // - 其他平台: 用 SHELL 环境变量或默认 /bin/bash
58
+ const isWindows = process.platform === 'win32'
59
+ let shell, shellArgs
60
+ if (isWindows) {
61
+ // 检测 Git Bash 是否可用
62
+ const gitBashCandidates = [
63
+ process.env.GIT_BASH,
64
+ 'C:\\Program Files\\Git\\bin\\bash.exe',
65
+ 'C:\\Program Files (x86)\\Git\\bin\\bash.exe',
66
+ ].filter(Boolean)
67
+ let gitBash = null
68
+ try {
69
+ gitBash = gitBashCandidates.find((p) => existsSync(p)) || null
70
+ } catch {}
71
+ if (gitBash) {
72
+ shell = gitBash
73
+ shellArgs = ['-c', command]
74
+ } else {
75
+ // 无 Git Bash → 用 cmd.exe
76
+ shell = process.env.ComSpec || 'cmd.exe'
77
+ shellArgs = ['/c', command]
78
+ }
79
+ } else {
80
+ shell = process.env.SHELL || '/bin/bash'
81
+ shellArgs = ['-c', command]
82
+ }
83
+ const proc = spawn(shell, shellArgs, {
56
84
  cwd,
57
85
  env: { ...process.env, ...extraEnv },
58
86
  stdio: ['pipe', 'pipe', 'pipe'],