bingocode 1.0.7 → 1.0.8

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/bin/bingo CHANGED
@@ -12,4 +12,4 @@ else
12
12
  ENV_FILE_FLAG=""
13
13
  fi
14
14
 
15
- exec bun $ENV_FILE_FLAG ./src/entrypoints/cli.tsx --cli-menu-demo "$@"
15
+ exec bun --preload ./preload.ts $ENV_FILE_FLAG ./src/entrypoints/cli.tsx --cli-menu-demo "$@"
package/bin/bingo-win.cjs CHANGED
@@ -46,6 +46,9 @@ const bun = fs.existsSync(bunPath) ? bunPath : 'bun';
46
46
  // 主 CLI 入口
47
47
  const entry = path.join(__dirname, '..', 'src', 'entrypoints', 'cli.tsx');
48
48
 
49
+ // preload shim(定义 MACRO 全局变量)
50
+ const preload = path.join(__dirname, '..', 'preload.ts');
51
+
49
52
  // 检查 .env
50
53
  let envFlag = '';
51
54
  const envPath = path.join(__dirname, '..', '.env');
@@ -54,7 +57,7 @@ if (fs.existsSync(envPath)) {
54
57
  }
55
58
 
56
59
  const extraArgs = process.argv.slice(2);
57
- const args = [envFlag, entry, '--cli-menu-demo', ...extraArgs].filter(Boolean);
60
+ const args = [`--preload=${preload}`, envFlag, entry, '--cli-menu-demo', ...extraArgs].filter(Boolean);
58
61
 
59
62
  const child = spawn(bun, args, { stdio: 'inherit' });
60
63
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bingocode",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "claude": "bin/claude-win.cjs",
package/preload.ts CHANGED
@@ -1,4 +1,13 @@
1
- const version = process.env.CLAUDE_CODE_LOCAL_VERSION ?? '999.0.0-local';
1
+ // 优先用环境变量,其次从 package.json 读取真实版本号
2
+ import { readFileSync } from 'fs'
3
+ import { join } from 'path'
4
+ let _pkgVersion = '1.0.0'
5
+ try {
6
+ const _pkgPath = join(import.meta.dir, 'package.json')
7
+ const _pkg = JSON.parse(readFileSync(_pkgPath, 'utf-8')) as { version?: string }
8
+ if (_pkg.version) _pkgVersion = _pkg.version
9
+ } catch { /* ignore */ }
10
+ const version = process.env.CLAUDE_CODE_LOCAL_VERSION ?? _pkgVersion;
2
11
  const packageUrl = process.env.CLAUDE_CODE_LOCAL_PACKAGE_URL ?? 'claude-code-local';
3
12
  const buildTime = process.env.CLAUDE_CODE_LOCAL_BUILD_TIME ?? new Date().toISOString();
4
13