bingocode 1.1.142 → 1.1.144

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.
@@ -10,7 +10,8 @@
10
10
  "WebSearch",
11
11
  "WebFetch(domain:www.anthropic.com)",
12
12
  "Bash(grep -v \"node_modules\\\\|bun:\\\\|bun/\\\\|bun@\\\\|\\\\.bun\\\\|bunfig\\\\|bundl\\\\|bunny\\\\|abun\\\\|debug\\\\|comment\\\\|//.*bun\\\\|bunta\\\\|buno\")",
13
- "Bash(grep:*)"
13
+ "Bash(grep:*)",
14
+ "Bash(node:*)"
14
15
  ]
15
16
  }
16
17
  }
package/bin/bingo-win.cjs CHANGED
@@ -56,31 +56,27 @@ const ROOT_DIR = getProjectRoot();
56
56
  }
57
57
  })();
58
58
 
59
- // 自动定位 bun 可执行路径(返回绝对路径或 null)
59
+ // 自动定位 bun.exe(纯文件系统查找,无子进程,无 DEP0190 警告)
60
60
  function resolveBunExe() {
61
- // 优先环境变量
61
+ // 1. 用户指定路径
62
62
  if (process.env.BUN_PATH && fs.existsSync(process.env.BUN_PATH)) {
63
63
  return process.env.BUN_PATH;
64
64
  }
65
- // npm install -g bun 的真实位置:{npm prefix -g}/node_modules/bun/bin/bun.exe
66
- try {
67
- const npmPrefix = spawnSync('npm', ['prefix', '-g'], { shell: true, encoding: 'utf-8' });
68
- if (npmPrefix.status === 0) {
69
- const npmBun = path.join(npmPrefix.stdout.trim(), 'node_modules', 'bun', 'bin', 'bun.exe');
70
- if (fs.existsSync(npmBun)) return npmBun;
71
- }
72
- } catch (_) {}
73
- // ~/.bun/bin/bun.exe(bun 官方安装脚本的位置)
74
- const homeBun = path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
75
- if (fs.existsSync(homeBun)) return homeBun;
76
- // where bun.exe(PATH 兜底搜索)
77
- try {
78
- const where = spawnSync('where', ['bun.exe'], { shell: true, encoding: 'utf-8' });
79
- if (where.status === 0) {
80
- const found = where.stdout.trim().split(/\r?\n/)[0];
81
- if (found && fs.existsSync(found)) return found;
82
- }
83
- } catch (_) {}
65
+ const home = os.homedir();
66
+ const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
67
+ const candidates = [
68
+ // npm install -g bun 的真实 exe(最常见)
69
+ path.join(appData, 'npm', 'node_modules', 'bun', 'bin', 'bun.exe'),
70
+ // bun 官方安装脚本位置
71
+ path.join(home, '.bun', 'bin', 'bun.exe'),
72
+ ];
73
+ // 遍历 PATH 中每个目录查找 bun.exe
74
+ for (const dir of (process.env.PATH || '').split(path.delimiter)) {
75
+ candidates.push(path.join(dir, 'bun.exe'));
76
+ }
77
+ for (const c of candidates) {
78
+ try { if (fs.existsSync(c)) return c; } catch (_) {}
79
+ }
84
80
  return null;
85
81
  }
86
82
 
@@ -95,9 +91,9 @@ function installBun() {
95
91
 
96
92
  try {
97
93
  const npmResult = spawnSync(
98
- 'npm',
94
+ 'npm.cmd',
99
95
  ['install', '-g', 'bun', '--loglevel', 'error'],
100
- { stdio: 'inherit', shell: true }
96
+ { stdio: 'inherit' }
101
97
  );
102
98
  if (npmResult.status !== 0) {
103
99
  throw new Error(`npm install -g bun 失败,exit code ${npmResult.status}`);
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { spawn, spawnSync } = require('node:child_process');
3
+ const { spawn } = require('node:child_process');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
  const fs = require('fs');
@@ -33,31 +33,27 @@ process.env.NoDefaultCurrentDirectoryInExePath = '1';
33
33
  }
34
34
  })();
35
35
 
36
- // 自动定位 bun 可执行路径(返回绝对路径或 null)
36
+ // 自动定位 bun.exe(纯文件系统查找,无子进程,无 DEP0190 警告)
37
37
  function resolveBunExe() {
38
- // 优先环境变量
38
+ // 1. 用户指定路径
39
39
  if (process.env.BUN_PATH && fs.existsSync(process.env.BUN_PATH)) {
40
40
  return process.env.BUN_PATH;
41
41
  }
42
- // npm install -g bun 的真实位置:{npm prefix -g}/node_modules/bun/bin/bun.exe
43
- try {
44
- const npmPrefix = spawnSync('npm', ['prefix', '-g'], { shell: true, encoding: 'utf-8' });
45
- if (npmPrefix.status === 0) {
46
- const npmBun = path.join(npmPrefix.stdout.trim(), 'node_modules', 'bun', 'bin', 'bun.exe');
47
- if (fs.existsSync(npmBun)) return npmBun;
48
- }
49
- } catch (_) {}
50
- // ~/.bun/bin/bun.exe(bun 官方安装脚本的位置)
51
- const homeBun = path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
52
- if (fs.existsSync(homeBun)) return homeBun;
53
- // where bun.exe 兜底
54
- try {
55
- const where = spawnSync('where', ['bun.exe'], { shell: true, encoding: 'utf-8' });
56
- if (where.status === 0) {
57
- const found = where.stdout.trim().split(/\r?\n/)[0];
58
- if (found && fs.existsSync(found)) return found;
59
- }
60
- } catch (_) {}
42
+ const home = os.homedir();
43
+ const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
44
+ const candidates = [
45
+ // npm install -g bun 的真实 exe(最常见)
46
+ path.join(appData, 'npm', 'node_modules', 'bun', 'bin', 'bun.exe'),
47
+ // bun 官方安装脚本位置
48
+ path.join(home, '.bun', 'bin', 'bun.exe'),
49
+ ];
50
+ // 遍历 PATH 中每个目录查找 bun.exe
51
+ for (const dir of (process.env.PATH || '').split(path.delimiter)) {
52
+ candidates.push(path.join(dir, 'bun.exe'));
53
+ }
54
+ for (const c of candidates) {
55
+ try { if (fs.existsSync(c)) return c; } catch (_) {}
56
+ }
61
57
  return null;
62
58
  }
63
59
 
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const { spawn, spawnSync } = require('node:child_process');
3
+ const { spawn } = require('node:child_process');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
  const fs = require('fs');
@@ -32,30 +32,27 @@ process.env.NoDefaultCurrentDirectoryInExePath = '1';
32
32
  }
33
33
  })();
34
34
 
35
- // 自动定位 bun 可执行路径(返回绝对路径或 null)
35
+ // 自动定位 bun.exe(纯文件系统查找,无子进程,无 DEP0190 警告)
36
36
  function resolveBunExe() {
37
+ // 1. 用户指定路径
37
38
  if (process.env.BUN_PATH && fs.existsSync(process.env.BUN_PATH)) {
38
39
  return process.env.BUN_PATH;
39
40
  }
40
- // npm install -g bun 的真实位置:{npm prefix -g}/node_modules/bun/bin/bun.exe
41
- try {
42
- const npmPrefix = spawnSync('npm', ['prefix', '-g'], { shell: true, encoding: 'utf-8' });
43
- if (npmPrefix.status === 0) {
44
- const npmBun = path.join(npmPrefix.stdout.trim(), 'node_modules', 'bun', 'bin', 'bun.exe');
45
- if (fs.existsSync(npmBun)) return npmBun;
46
- }
47
- } catch (_) {}
48
- // ~/.bun/bin/bun.exe(bun 官方安装脚本的位置)
49
- const homeBun = path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
50
- if (fs.existsSync(homeBun)) return homeBun;
51
- // where bun.exe 兜底
52
- try {
53
- const where = spawnSync('where', ['bun.exe'], { shell: true, encoding: 'utf-8' });
54
- if (where.status === 0) {
55
- const found = where.stdout.trim().split(/\r?\n/)[0];
56
- if (found && fs.existsSync(found)) return found;
57
- }
58
- } catch (_) {}
41
+ const home = os.homedir();
42
+ const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
43
+ const candidates = [
44
+ // npm install -g bun 的真实 exe(最常见)
45
+ path.join(appData, 'npm', 'node_modules', 'bun', 'bin', 'bun.exe'),
46
+ // bun 官方安装脚本位置
47
+ path.join(home, '.bun', 'bin', 'bun.exe'),
48
+ ];
49
+ // 遍历 PATH 中每个目录查找 bun.exe
50
+ for (const dir of (process.env.PATH || '').split(path.delimiter)) {
51
+ candidates.push(path.join(dir, 'bun.exe'));
52
+ }
53
+ for (const c of candidates) {
54
+ try { if (fs.existsSync(c)) return c; } catch (_) {}
55
+ }
59
56
  return null;
60
57
  }
61
58
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bingocode",
3
- "version": "1.1.142",
3
+ "version": "1.1.144",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -1,5 +1,5 @@
1
1
  // server/ensureSingletonLocalServer.ts
2
- import { spawn, spawnSync } from 'child_process';
2
+ import { spawn } from 'child_process';
3
3
  import fs from 'fs';
4
4
  import fsp from 'fs/promises';
5
5
  import path from 'path';
@@ -46,33 +46,25 @@
46
46
  const fromEnv = process.env.BUN_PATH;
47
47
  if (fromEnv && fs.existsSync(fromEnv)) return fromEnv;
48
48
 
49
- // Windows:查找真实 bun.exe 绝对路径,避免 spawn 'bun' ENOENT
49
+ // Windows:纯文件系统查找 bun.exe,无子进程,无 DEP0190 警告
50
50
  if (process.platform === 'win32') {
51
- // npm install -g bun 的真实位置:{npm prefix -g}/node_modules/bun/bin/bun.exe
52
- try {
53
- const npmPrefix = spawnSync('npm', ['prefix', '-g'], { shell: true, encoding: 'utf-8' });
54
- if (npmPrefix.status === 0) {
55
- const npmBun = path.join(npmPrefix.stdout.trim(), 'node_modules', 'bun', 'bin', 'bun.exe');
56
- if (fs.existsSync(npmBun)) return npmBun;
57
- }
58
- } catch (_) {}
59
- // ~/.bun/bin/bun.exe(bun 官方安装脚本位置)
60
- const homeBun = path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
61
- if (fs.existsSync(homeBun)) return homeBun;
62
- // where bun.exe 兜底
63
- try {
64
- const where = spawnSync('where', ['bun.exe'], { shell: true, encoding: 'utf-8' });
65
- if (where.status === 0) {
66
- const found = where.stdout.trim().split(/\r?\n/)[0];
67
- if (found && fs.existsSync(found)) return found;
68
- }
69
- } catch (_) {}
51
+ const home = os.homedir();
52
+ const appData = process.env.APPDATA || path.join(home, 'AppData', 'Roaming');
53
+ const candidates = [
54
+ path.join(appData, 'npm', 'node_modules', 'bun', 'bin', 'bun.exe'),
55
+ path.join(home, '.bun', 'bin', 'bun.exe'),
56
+ ];
57
+ for (const dir of (process.env.PATH || '').split(path.delimiter)) {
58
+ candidates.push(path.join(dir, 'bun.exe'));
59
+ }
60
+ for (const c of candidates) {
61
+ try { if (fs.existsSync(c)) return c; } catch (_) {}
62
+ }
70
63
  } else {
71
- // Linux/macOS:which bun
72
- const r = spawnSync('which', ['bun'], { encoding: 'utf-8' });
73
- if (r.status === 0) {
74
- const found = r.stdout.trim();
75
- if (found) return found;
64
+ // Linux/macOS:遍历 PATH 查找 bun
65
+ for (const dir of (process.env.PATH || '').split(path.delimiter)) {
66
+ const c = path.join(dir, 'bun');
67
+ try { if (fs.existsSync(c)) return c; } catch (_) {}
76
68
  }
77
69
  }
78
70