bingocode 1.0.0 → 1.0.2
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-win.cjs +34 -3
- package/package.json +2 -4
- package/src/cli/ProviderPanel.tsx +725 -418
- package/src/manager/CliMenuManager.tsx +30 -25
- package/src/manager/CliMenuUi.tsx +43 -15
- package/src/server/api/providers.ts +26 -0
- package/src/server/config/providerPresets.ts +93 -86
- package/src/server/config/providers.yaml +145 -41
- package/src/server/proxy/handler.ts +319 -206
- package/src/server/services/providerService.ts +94 -0
- package/src/server/types/provider.ts +19 -0
package/bin/bingo-win.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
const { spawn } = require('node:child_process');
|
|
3
|
+
const { spawn, spawnSync } = require('node:child_process');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const os = require('os');
|
|
6
6
|
const fs = require('fs');
|
|
@@ -8,11 +8,42 @@ const fs = require('fs');
|
|
|
8
8
|
process.env.NoDefaultCurrentDirectoryInExePath = '1';
|
|
9
9
|
|
|
10
10
|
// 自动定位 bun 路径
|
|
11
|
-
const
|
|
11
|
+
const bunPath =
|
|
12
12
|
process.env.BUN_PATH ||
|
|
13
13
|
path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
|
|
14
14
|
|
|
15
|
-
//
|
|
15
|
+
// 检查 bun 是否可用(先看固定路径,再看 PATH)
|
|
16
|
+
function bunExists() {
|
|
17
|
+
if (fs.existsSync(bunPath)) return true;
|
|
18
|
+
// 尝试 PATH 中的 bun
|
|
19
|
+
const result = spawnSync('bun', ['--version'], { stdio: 'ignore', shell: true });
|
|
20
|
+
return result.status === 0;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// 安装 bun(Windows PowerShell 方式)
|
|
24
|
+
function installBun() {
|
|
25
|
+
console.log('[bingocode] bun 未检测到,正在自动安装...');
|
|
26
|
+
const result = spawnSync(
|
|
27
|
+
'powershell',
|
|
28
|
+
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
|
29
|
+
'irm bun.sh/install.ps1 | iex'],
|
|
30
|
+
{ stdio: 'inherit', shell: false }
|
|
31
|
+
);
|
|
32
|
+
if (result.status !== 0) {
|
|
33
|
+
console.error('[bingocode] bun 安装失败,请手动安装:https://bun.sh');
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
console.log('[bingocode] bun 安装完成,正在启动...');
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (!bunExists()) {
|
|
40
|
+
installBun();
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// 安装后 bun.exe 在固定位置;若在 PATH 里则直接用 "bun"
|
|
44
|
+
const bun = fs.existsSync(bunPath) ? bunPath : 'bun';
|
|
45
|
+
|
|
46
|
+
// 主 CLI 入口
|
|
16
47
|
const entry = path.join(__dirname, '..', 'src', 'entrypoints', 'cli.tsx');
|
|
17
48
|
|
|
18
49
|
// 检查 .env
|
package/package.json
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bingocode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"claude": "bin/claude-win.cjs",
|
|
7
|
-
"claude-haha": "bin/claude-win.cjs",
|
|
8
7
|
"claude-linux": "bin/claude",
|
|
9
8
|
"bingocode": "bin/bingocode-win.cjs",
|
|
10
9
|
"bingo": "bin/bingo-win.cjs"
|
|
11
10
|
},
|
|
12
11
|
"scripts": {
|
|
13
|
-
"
|
|
14
|
-
"start": "bun run ./bin/claude-haha",
|
|
12
|
+
"start": "bun run ./bin/bingo-win.cjs",
|
|
15
13
|
"bingo": "bun run ./bin/bingo-win.cjs",
|
|
16
14
|
"bingocode": "bun run ./bin/bingocode-win.cjs",
|
|
17
15
|
"docs:dev": "vitepress dev docs",
|