bingocode 1.0.12 → 1.0.13

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": "bingocode",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -246,7 +246,8 @@ export const CliMenuManager: React.FC = () => {
246
246
  const fsReq = require('fs');
247
247
  const pathReq = require('path');
248
248
  const { spawn } = require('child_process');
249
- const pkgPath = pathReq.resolve(process.cwd(), 'package.json');
249
+ // import.meta.dir 定位包根,避免 process.cwd() 指向用户目录
250
+ const pkgPath = pathReq.resolve(import.meta.dir, '../../package.json');
250
251
  const pkgJson = JSON.parse(fsReq.readFileSync(pkgPath, 'utf-8'));
251
252
  const bins = pkgJson.bin || {};
252
253
  const isWin = process.platform === 'win32';
@@ -254,9 +255,10 @@ export const CliMenuManager: React.FC = () => {
254
255
  ? (bins['claude-haha'] ? 'claude-haha' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]))
255
256
  : (bins['claude-linux'] ? 'claude-linux' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]));
256
257
  const spawnCmd = isWin ? 'cmd' : 'sh';
257
- const spawnArgs = isWin ? ['/c', 'start', 'cmd', '/k', 'bun bingocode'] : ['-c', `./${binName}`];
258
+ // Windows 直接调全局 bingocode 命令,不用 bun 前缀
259
+ const spawnArgs = isWin ? ['/c', 'start', 'cmd', '/k', 'bingocode'] : ['-c', `${binName}`];
258
260
  spawn(spawnCmd, spawnArgs, {
259
- cwd: process.cwd(),
261
+ cwd: process.env.CALLER_DIR || process.cwd(),
260
262
  env: process.env,
261
263
  detached: true,
262
264
  stdio: 'ignore'
@@ -525,7 +527,8 @@ export const CliMenuManager: React.FC = () => {
525
527
  const fsReq = require('fs');
526
528
  const pathReq = require('path');
527
529
  const { spawn } = require('child_process');
528
- const pkgPath = pathReq.resolve(process.cwd(), 'package.json');
530
+ // import.meta.dir 定位包根,避免 process.cwd() 指向用户目录
531
+ const pkgPath = pathReq.resolve(import.meta.dir, '../../package.json');
529
532
  const pkgJson = JSON.parse(fsReq.readFileSync(pkgPath, 'utf-8'));
530
533
  const bins = pkgJson.bin || {};
531
534
  const isWin = process.platform === 'win32';
@@ -533,11 +536,12 @@ export const CliMenuManager: React.FC = () => {
533
536
  ? (bins['claude-haha'] ? 'claude-haha' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]))
534
537
  : (bins['claude-linux'] ? 'claude-linux' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]));
535
538
  const spawnCmd = isWin ? 'cmd' : 'sh';
539
+ // Windows 直接调全局 bingocode 命令,不用 bun 前缀
536
540
  const spawnArgs = isWin
537
- ? ['/c', 'start', 'cmd', '/k', `bun bingocode --resume ${sessionId}`]
538
- : ['-c', `./${binName} --resume ${sessionId}`];
541
+ ? ['/c', 'start', 'cmd', '/k', `bingocode --resume ${sessionId}`]
542
+ : ['-c', `${binName} --resume ${sessionId}`];
539
543
  spawn(spawnCmd, spawnArgs, {
540
- cwd: process.cwd(),
544
+ cwd: process.env.CALLER_DIR || process.cwd(),
541
545
  env: process.env,
542
546
  detached: true,
543
547
  stdio: 'ignore'