bingocode 1.0.36 → 1.0.38
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/LICENSE +29 -29
- package/bin/bingo +27 -27
- package/bin/bingo-win.cjs +58 -26
- package/bin/bingocode-win.cjs +3 -2
- package/bin/claude-win.cjs +3 -2
- package/config/bingo-defaults/settings.json +6 -7
- package/package.json +1 -1
- package/src/entrypoints/manager.tsx +10 -10
- package/src/server/cli/providersMenu.tsx +3 -3
- package/src/utils/config.ts +15 -0
- package/bingocode-1.0.33.tgz +0 -0
package/LICENSE
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025-2026 Leanchy
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
22
|
-
|
|
23
|
-
---
|
|
24
|
-
|
|
25
|
-
BingoCode is an independent open-source project by Leanchy, built upon and
|
|
26
|
-
substantially modified from Claude Code (originally developed by Anthropic, PBC).
|
|
27
|
-
Original upstream components remain the property of their respective copyright holders.
|
|
28
|
-
All modifications, extensions, and original contributions in this repository are
|
|
29
|
-
copyright Leanchy, released under the MIT License above.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Leanchy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
BingoCode is an independent open-source project by Leanchy, built upon and
|
|
26
|
+
substantially modified from Claude Code (originally developed by Anthropic, PBC).
|
|
27
|
+
Original upstream components remain the property of their respective copyright holders.
|
|
28
|
+
All modifications, extensions, and original contributions in this repository are
|
|
29
|
+
copyright Leanchy, released under the MIT License above.
|
package/bin/bingo
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
set -euo pipefail
|
|
3
|
-
|
|
4
|
-
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
-
export CALLER_DIR="${CALLER_DIR:-$(pwd -W 2>/dev/null || pwd)}"
|
|
6
|
-
|
|
7
|
-
# ── 首次部署:将默认 bingo 配置复制到 ~/.claude/bingo/ ──
|
|
8
|
-
_BINGO_CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
9
|
-
_BINGO_DIR="$_BINGO_CONFIG_DIR/bingo"
|
|
10
|
-
_BINGO_TARGET="$_BINGO_DIR/settings.json"
|
|
11
|
-
_BINGO_SRC="$ROOT_DIR/config/bingo-defaults/settings.json"
|
|
12
|
-
|
|
13
|
-
if [ ! -f "$_BINGO_TARGET" ] && [ -f "$_BINGO_SRC" ]; then
|
|
14
|
-
mkdir -p "$_BINGO_DIR"
|
|
15
|
-
cp "$_BINGO_SRC" "$_BINGO_TARGET" 2>/dev/null && \
|
|
16
|
-
echo "[bingo] 首次启动:已部署默认配置到 $_BINGO_TARGET" || true
|
|
17
|
-
fi
|
|
18
|
-
|
|
19
|
-
cd "$ROOT_DIR"
|
|
20
|
-
|
|
21
|
-
if [[ -f .env ]]; then
|
|
22
|
-
ENV_FILE_FLAG="--env-file=.env"
|
|
23
|
-
else
|
|
24
|
-
ENV_FILE_FLAG=""
|
|
25
|
-
fi
|
|
26
|
-
|
|
27
|
-
exec bun --preload ./preload.ts $ENV_FILE_FLAG ./src/entrypoints/manager.tsx "$@"
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
5
|
+
export CALLER_DIR="${CALLER_DIR:-$(pwd -W 2>/dev/null || pwd)}"
|
|
6
|
+
|
|
7
|
+
# ── 首次部署:将默认 bingo 配置复制到 ~/.claude/bingo/ ──
|
|
8
|
+
_BINGO_CONFIG_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}"
|
|
9
|
+
_BINGO_DIR="$_BINGO_CONFIG_DIR/bingo"
|
|
10
|
+
_BINGO_TARGET="$_BINGO_DIR/settings.json"
|
|
11
|
+
_BINGO_SRC="$ROOT_DIR/config/bingo-defaults/settings.json"
|
|
12
|
+
|
|
13
|
+
if [ ! -f "$_BINGO_TARGET" ] && [ -f "$_BINGO_SRC" ]; then
|
|
14
|
+
mkdir -p "$_BINGO_DIR"
|
|
15
|
+
cp "$_BINGO_SRC" "$_BINGO_TARGET" 2>/dev/null && \
|
|
16
|
+
echo "[bingo] 首次启动:已部署默认配置到 $_BINGO_TARGET" || true
|
|
17
|
+
fi
|
|
18
|
+
|
|
19
|
+
cd "$ROOT_DIR"
|
|
20
|
+
|
|
21
|
+
if [[ -f .env ]]; then
|
|
22
|
+
ENV_FILE_FLAG="--env-file=.env"
|
|
23
|
+
else
|
|
24
|
+
ENV_FILE_FLAG=""
|
|
25
|
+
fi
|
|
26
|
+
|
|
27
|
+
exec bun --preload ./preload.ts $ENV_FILE_FLAG ./src/entrypoints/manager.tsx "$@"
|
package/bin/bingo-win.cjs
CHANGED
|
@@ -8,17 +8,38 @@ const fs = require('fs');
|
|
|
8
8
|
process.env.NoDefaultCurrentDirectoryInExePath = '1';
|
|
9
9
|
|
|
10
10
|
// ── 首次部署:将默认 bingo 配置复制到 ~/.claude/bingo/ ──
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
/**
|
|
12
|
+
* 更加健壮的根目录定位:
|
|
13
|
+
* 1. 如果 preload.ts 在 ../ (当前 bin/ 目录下运行)
|
|
14
|
+
* 2. 否则查找同级及上级目录中的 package.json
|
|
15
|
+
*/
|
|
16
|
+
function getProjectRoot() {
|
|
17
|
+
let curr = __dirname;
|
|
18
|
+
try {
|
|
19
|
+
while (curr !== path.dirname(curr)) {
|
|
20
|
+
if (fs.existsSync(path.join(curr, 'preload.ts')) || fs.existsSync(path.join(curr, 'package.json'))) {
|
|
21
|
+
return curr;
|
|
22
|
+
}
|
|
23
|
+
const parent = path.dirname(curr);
|
|
24
|
+
if (fs.existsSync(path.join(parent, 'preload.ts'))) return parent;
|
|
25
|
+
curr = parent;
|
|
26
|
+
}
|
|
27
|
+
} catch (err) {
|
|
28
|
+
// 防止权限拒绝等导致挂死
|
|
29
|
+
}
|
|
30
|
+
return path.join(__dirname, '..');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const ROOT_DIR = getProjectRoot();
|
|
34
|
+
|
|
14
35
|
(function deployBingoDefaults() {
|
|
15
36
|
const configDir = process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude');
|
|
16
37
|
const bingoDir = path.join(configDir, 'bingo');
|
|
17
38
|
const targetSettings = path.join(bingoDir, 'settings.json');
|
|
18
39
|
|
|
19
|
-
// 只在 settings.json
|
|
40
|
+
// 只在 settings.json 不存在时才部署
|
|
20
41
|
if (!fs.existsSync(targetSettings)) {
|
|
21
|
-
const defaultsDir = path.join(
|
|
42
|
+
const defaultsDir = path.join(ROOT_DIR, 'config', 'bingo-defaults');
|
|
22
43
|
const srcSettings = path.join(defaultsDir, 'settings.json');
|
|
23
44
|
|
|
24
45
|
if (fs.existsSync(srcSettings)) {
|
|
@@ -40,42 +61,53 @@ const bunPath =
|
|
|
40
61
|
process.env.BUN_PATH ||
|
|
41
62
|
path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
|
|
42
63
|
|
|
43
|
-
// 检查 bun
|
|
64
|
+
// 检查 bun 是否可用
|
|
44
65
|
function bunExists() {
|
|
45
66
|
if (fs.existsSync(bunPath)) return true;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
67
|
+
try {
|
|
68
|
+
const result = spawnSync('bun', ['--version'], { stdio: 'ignore', shell: true });
|
|
69
|
+
return result.status === 0;
|
|
70
|
+
} catch (e) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
49
73
|
}
|
|
50
74
|
|
|
51
|
-
// 安装 bun
|
|
75
|
+
// 安装 bun
|
|
52
76
|
function installBun() {
|
|
53
77
|
console.log('[bingocode] bun 未检测到,正在自动安装...');
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
78
|
+
try {
|
|
79
|
+
const result = spawnSync(
|
|
80
|
+
'powershell',
|
|
81
|
+
['-NoProfile', '-ExecutionPolicy', 'Bypass', '-Command',
|
|
82
|
+
'irm bun.sh/install.ps1 | iex'],
|
|
83
|
+
{ stdio: 'inherit', shell: false }
|
|
84
|
+
);
|
|
85
|
+
if (result.status !== 0) {
|
|
86
|
+
throw new Error(`Exit code ${result.status}`);
|
|
87
|
+
}
|
|
88
|
+
console.log('[bingocode] bun 安装完成,正在启动...');
|
|
89
|
+
} catch (err) {
|
|
90
|
+
console.error(`[bingocode] bun 自动安装失败: ${err.message}`);
|
|
91
|
+
console.log('[bingocode] 请手动从 https://bun.sh 安装 Bun 后重试。');
|
|
92
|
+
return false;
|
|
63
93
|
}
|
|
64
|
-
|
|
94
|
+
return true;
|
|
65
95
|
}
|
|
66
96
|
|
|
67
97
|
if (!bunExists()) {
|
|
68
|
-
installBun()
|
|
98
|
+
if (!installBun()) {
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
69
101
|
}
|
|
70
102
|
|
|
71
103
|
// 安装后 bun.exe 在固定位置;若在 PATH 里则直接用 "bun"
|
|
72
104
|
const bun = fs.existsSync(bunPath) ? bunPath : 'bun';
|
|
73
105
|
|
|
74
|
-
// Bingo Manager
|
|
75
|
-
const entry = path.join(
|
|
106
|
+
// Bingo Manager 入口
|
|
107
|
+
const entry = path.join(ROOT_DIR, 'src', 'entrypoints', 'manager.tsx');
|
|
76
108
|
|
|
77
|
-
// preload shim
|
|
78
|
-
const preload = path.join(
|
|
109
|
+
// preload shim
|
|
110
|
+
const preload = path.join(ROOT_DIR, 'preload.ts');
|
|
79
111
|
if (!fs.existsSync(preload)) {
|
|
80
112
|
console.error('[bingocode] 找不到 preload.ts,MACRO 将无法注入:' + preload);
|
|
81
113
|
process.exit(1);
|
|
@@ -83,7 +115,7 @@ if (!fs.existsSync(preload)) {
|
|
|
83
115
|
|
|
84
116
|
// 检查 .env
|
|
85
117
|
let envFlag = '';
|
|
86
|
-
const envPath = path.join(
|
|
118
|
+
const envPath = path.join(ROOT_DIR, '.env');
|
|
87
119
|
if (fs.existsSync(envPath)) {
|
|
88
120
|
envFlag = `--env-file=${envPath}`;
|
|
89
121
|
}
|
package/bin/bingocode-win.cjs
CHANGED
|
@@ -33,10 +33,11 @@ process.env.NoDefaultCurrentDirectoryInExePath = '1';
|
|
|
33
33
|
}
|
|
34
34
|
})();
|
|
35
35
|
|
|
36
|
-
// 自动定位 bun
|
|
37
|
-
const
|
|
36
|
+
// 自动定位 bun 路径(优先用环境变量,再检查默认安装位置,最后 fallback 到 PATH)
|
|
37
|
+
const bunPath =
|
|
38
38
|
process.env.BUN_PATH ||
|
|
39
39
|
path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
|
|
40
|
+
const bun = fs.existsSync(bunPath) ? bunPath : 'bun';
|
|
40
41
|
|
|
41
42
|
// 主 CLI 入口
|
|
42
43
|
const entry = path.join(__dirname, '..', 'src', 'entrypoints', 'cli.tsx');
|
package/bin/claude-win.cjs
CHANGED
|
@@ -32,10 +32,11 @@ process.env.NoDefaultCurrentDirectoryInExePath = '1';
|
|
|
32
32
|
}
|
|
33
33
|
})();
|
|
34
34
|
|
|
35
|
-
// 自动定位 bun
|
|
36
|
-
const
|
|
35
|
+
// 自动定位 bun 路径(优先用环境变量,再检查默认安装位置,最后 fallback 到 PATH)
|
|
36
|
+
const bunPath =
|
|
37
37
|
process.env.BUN_PATH ||
|
|
38
38
|
path.join(os.homedir(), '.bun', 'bin', 'bun.exe');
|
|
39
|
+
const bun = fs.existsSync(bunPath) ? bunPath : 'bun';
|
|
39
40
|
|
|
40
41
|
// 主 CLI 入口
|
|
41
42
|
const entry = path.join(__dirname, '..', 'src', 'entrypoints', 'cli.tsx');
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"env": {
|
|
3
|
-
"ANTHROPIC_AUTH_TOKEN": "pending-provider-setup",
|
|
4
|
-
"ANTHROPIC_BASE_URL": "http://127.0.0.1:3456"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"env": {
|
|
3
|
+
"ANTHROPIC_AUTH_TOKEN": "pending-provider-setup",
|
|
4
|
+
"ANTHROPIC_BASE_URL": "http://127.0.0.1:3456"
|
|
5
|
+
}
|
|
6
|
+
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bingo Manager 入口
|
|
3
|
-
* 直接渲染 CliMenuManager(窗口管理控制台),不走 cli.tsx 的完整启动流程。
|
|
4
|
-
* 由 bin/bingo-win.cjs 和 bin/bingo 调用。
|
|
5
|
-
*/
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { render } from 'ink';
|
|
8
|
-
import { CliMenuManager } from '../manager/CliMenuManager.tsx';
|
|
9
|
-
|
|
10
|
-
render(<CliMenuManager />);
|
|
1
|
+
/**
|
|
2
|
+
* Bingo Manager 入口
|
|
3
|
+
* 直接渲染 CliMenuManager(窗口管理控制台),不走 cli.tsx 的完整启动流程。
|
|
4
|
+
* 由 bin/bingo-win.cjs 和 bin/bingo 调用。
|
|
5
|
+
*/
|
|
6
|
+
import React from 'react';
|
|
7
|
+
import { render } from 'ink';
|
|
8
|
+
import { CliMenuManager } from '../manager/CliMenuManager.tsx';
|
|
9
|
+
|
|
10
|
+
render(<CliMenuManager />);
|
|
@@ -82,11 +82,11 @@ const ProvidersMenu: React.FC = () => {
|
|
|
82
82
|
refresh();
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
|
-
} else if (inputKey.toLowerCase() === 'q') {
|
|
85
|
+
} else if (inputKey.toLowerCase() === 'q' || key.escape) {
|
|
86
86
|
setRemoveConfirm(false); setMode('list');
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
-
});
|
|
89
|
+
}, { isActive: mode === 'list' || mode === 'removeConfirm' });
|
|
90
90
|
|
|
91
91
|
// ADD模式交互
|
|
92
92
|
useInput((inputKey, key) => {
|
|
@@ -102,7 +102,7 @@ const ProvidersMenu: React.FC = () => {
|
|
|
102
102
|
else if (key.upArrow) setModelSelectIdx(idx => Math.max(0, idx - 1));
|
|
103
103
|
else if (key.return) { setAddStep(1); }
|
|
104
104
|
}
|
|
105
|
-
});
|
|
105
|
+
}, { isActive: mode === 'add' });
|
|
106
106
|
|
|
107
107
|
// 新增表单
|
|
108
108
|
const addSubmit = async (keyInput: string) => {
|
package/src/utils/config.ts
CHANGED
|
@@ -720,6 +720,21 @@ function computeTrustDialogAccepted(): boolean {
|
|
|
720
720
|
return true
|
|
721
721
|
}
|
|
722
722
|
|
|
723
|
+
// Fallback: also check the raw original CWD path directly.
|
|
724
|
+
// This handles the case where trust was saved under CWD (no .git at the time),
|
|
725
|
+
// but now .git exists so getProjectPathForConfig() returns the git root instead.
|
|
726
|
+
// Without this fallback the old trust entry would never be found, causing the
|
|
727
|
+
// trust dialog to reappear after `git init` / `git clone`.
|
|
728
|
+
const normalizedOriginalCwd = normalizePathForConfigKey(
|
|
729
|
+
resolve(getOriginalCwd()),
|
|
730
|
+
)
|
|
731
|
+
if (normalizedOriginalCwd !== projectPath) {
|
|
732
|
+
const cwdConfig = config.projects?.[normalizedOriginalCwd]
|
|
733
|
+
if (cwdConfig?.hasTrustDialogAccepted) {
|
|
734
|
+
return true
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
|
|
723
738
|
// Now check from current working directory and its parents
|
|
724
739
|
// Normalize paths for consistent JSON key lookup
|
|
725
740
|
let currentPath = normalizePathForConfigKey(getCwd())
|
package/bingocode-1.0.33.tgz
DELETED
|
Binary file
|