bingocode 1.0.12 → 1.0.14

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.14",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
@@ -8,6 +8,7 @@ import { LogoV2 } from '../components/LogoV2/LogoV2.tsx';
8
8
  import { CondensedLogo } from '../components/LogoV2/CondensedLogo.tsx';
9
9
  import fs from 'fs';
10
10
  import path from 'path';
11
+ import os from 'os';
11
12
  import { ensureSingletonLocalServer } from '../server/ensureSingletonLocalServer.ts';
12
13
  // 新增:通用 UI 元素与顶部工具栏
13
14
  import { TopBar, BottomBar, Panel, Hint, Kbd, SecondaryMenu } from '../manager/CliMenuUi.tsx';
@@ -20,7 +21,8 @@ import { useTheme } from '../components/design-system/ThemeProvider.js';
20
21
  // 配置相关(仅使用可用接口)
21
22
  import { getGlobalConfig, saveGlobalConfig } from '../utils/config.ts';
22
23
 
23
- const MARKED_FILE = path.join(process.cwd(), 'markedSessions.json');
24
+ // markedSessions 存到 ~/.claude-cli/ 固定目录,不受 cwd 影响
25
+ const MARKED_FILE = path.join(os.homedir(), '.claude-cli', 'markedSessions.json');
24
26
 
25
27
  // 固定尺寸视口(可用环境变量覆盖)
26
28
  const VIEW_W = Number(process.env.CLI_VIEW_W || 96);
@@ -182,7 +184,7 @@ export const CliMenuManager: React.FC = () => {
182
184
  (async () => {
183
185
  try {
184
186
  if (apiUrl) return;
185
- const entry = path.resolve(process.cwd(), 'src/server/index.ts');
187
+ const entry = path.resolve(import.meta.dir, '../server/index.ts');
186
188
  const handle = await ensureSingletonLocalServer({ serverEntry: entry });
187
189
  if (!mounted) { await handle.stopIfLast(); return; }
188
190
  setApiUrl(handle.baseUrl);
@@ -246,7 +248,8 @@ export const CliMenuManager: React.FC = () => {
246
248
  const fsReq = require('fs');
247
249
  const pathReq = require('path');
248
250
  const { spawn } = require('child_process');
249
- const pkgPath = pathReq.resolve(process.cwd(), 'package.json');
251
+ // import.meta.dir 定位包根,避免 process.cwd() 指向用户目录
252
+ const pkgPath = pathReq.resolve(import.meta.dir, '../../package.json');
250
253
  const pkgJson = JSON.parse(fsReq.readFileSync(pkgPath, 'utf-8'));
251
254
  const bins = pkgJson.bin || {};
252
255
  const isWin = process.platform === 'win32';
@@ -254,9 +257,10 @@ export const CliMenuManager: React.FC = () => {
254
257
  ? (bins['claude-haha'] ? 'claude-haha' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]))
255
258
  : (bins['claude-linux'] ? 'claude-linux' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]));
256
259
  const spawnCmd = isWin ? 'cmd' : 'sh';
257
- const spawnArgs = isWin ? ['/c', 'start', 'cmd', '/k', 'bun bingocode'] : ['-c', `./${binName}`];
260
+ // Windows 直接调全局 bingocode 命令,不用 bun 前缀
261
+ const spawnArgs = isWin ? ['/c', 'start', 'cmd', '/k', 'bingocode'] : ['-c', `${binName}`];
258
262
  spawn(spawnCmd, spawnArgs, {
259
- cwd: process.cwd(),
263
+ cwd: process.env.CALLER_DIR || process.cwd(),
260
264
  env: process.env,
261
265
  detached: true,
262
266
  stdio: 'ignore'
@@ -525,7 +529,8 @@ export const CliMenuManager: React.FC = () => {
525
529
  const fsReq = require('fs');
526
530
  const pathReq = require('path');
527
531
  const { spawn } = require('child_process');
528
- const pkgPath = pathReq.resolve(process.cwd(), 'package.json');
532
+ // import.meta.dir 定位包根,避免 process.cwd() 指向用户目录
533
+ const pkgPath = pathReq.resolve(import.meta.dir, '../../package.json');
529
534
  const pkgJson = JSON.parse(fsReq.readFileSync(pkgPath, 'utf-8'));
530
535
  const bins = pkgJson.bin || {};
531
536
  const isWin = process.platform === 'win32';
@@ -533,11 +538,12 @@ export const CliMenuManager: React.FC = () => {
533
538
  ? (bins['claude-haha'] ? 'claude-haha' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]))
534
539
  : (bins['claude-linux'] ? 'claude-linux' : (bins['claude'] ? 'claude' : Object.keys(bins)[0]));
535
540
  const spawnCmd = isWin ? 'cmd' : 'sh';
541
+ // Windows 直接调全局 bingocode 命令,不用 bun 前缀
536
542
  const spawnArgs = isWin
537
- ? ['/c', 'start', 'cmd', '/k', `bun bingocode --resume ${sessionId}`]
538
- : ['-c', `./${binName} --resume ${sessionId}`];
543
+ ? ['/c', 'start', 'cmd', '/k', `bingocode --resume ${sessionId}`]
544
+ : ['-c', `${binName} --resume ${sessionId}`];
539
545
  spawn(spawnCmd, spawnArgs, {
540
- cwd: process.cwd(),
546
+ cwd: process.env.CALLER_DIR || process.cwd(),
541
547
  env: process.env,
542
548
  detached: true,
543
549
  stdio: 'ignore'
@@ -674,24 +680,7 @@ export const CliMenuManager: React.FC = () => {
674
680
  setSelectedHistory(null);
675
681
  setMsgsPage(0);
676
682
  } else if (item.value === '__continue') {
677
- try {
678
- const fsReq = require('fs');
679
- const pathReq = require('path');
680
- const { spawn } = require('child_process');
681
- const pkgPath = pathReq.resolve(process.cwd(), 'package.json');
682
- const pkgJson = JSON.parse(fsReq.readFileSync(pkgPath, 'utf-8'));
683
- const bins = pkgJson.bin || {};
684
- const isWin = process.platform === 'win32';
685
- let binName = isWin
686
- ? bins['claude-haha'] ? 'claude-haha' : bins['claude'] ? 'claude' : Object.keys(bins)[0]
687
- : bins['claude-linux'] ? 'claude-linux' : bins['claude'] ? 'claude' : Object.keys(bins)[0];
688
- const spawnCmd = isWin ? 'cmd' : 'sh';
689
- const spawnArgs = isWin
690
- ? ['/c', binName, '--resume', selectedHistory.id]
691
- : ['-c', `./${binName} --resume ${selectedHistory.id}`];
692
- // 静默启动继续会话
693
- resumeSession(selectedHistory.id);
694
- } catch { }
683
+ resumeSession(selectedHistory.id);
695
684
  } else if (item.value === '__delete') {
696
685
  setHistoryMenuStage('deleteConfirm');
697
686
  } else if (item.value === '__toggle_mark') {