bingocode 1.1.127 → 1.1.128
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/.claude/settings.local.json +4 -1
- package/bin/bingo +35 -1
- package/bin/bingo-win.cjs +28 -26
- package/package.json +1 -1
- package/scripts/install-skills.cjs +0 -6
- package/scripts/install-bun.cjs +0 -89
|
@@ -11,7 +11,10 @@
|
|
|
11
11
|
"Bash(findstr /i goal)",
|
|
12
12
|
"Bash(bun run:*)",
|
|
13
13
|
"Bash(bunx tsc:*)",
|
|
14
|
-
"Bash(node_modules/.bin/tsc --noEmit --skipLibCheck)"
|
|
14
|
+
"Bash(node_modules/.bin/tsc --noEmit --skipLibCheck)",
|
|
15
|
+
"WebFetch(domain:www.npmjs.com)",
|
|
16
|
+
"Bash(npm info:*)",
|
|
17
|
+
"Bash(npm pack:*)"
|
|
15
18
|
]
|
|
16
19
|
}
|
|
17
20
|
}
|
package/bin/bingo
CHANGED
|
@@ -18,10 +18,44 @@ fi
|
|
|
18
18
|
|
|
19
19
|
cd "$ROOT_DIR"
|
|
20
20
|
|
|
21
|
+
# ── bun 检测与自动安装 ──
|
|
22
|
+
if ! command -v bun &>/dev/null && [[ ! -x "$HOME/.bun/bin/bun" ]]; then
|
|
23
|
+
echo "[bingocode] bun 未检测到,正在通过 npm 安装..."
|
|
24
|
+
_TMP_DIR="$(mktemp -d)"
|
|
25
|
+
_ARCH="$(uname -m)"
|
|
26
|
+
if [[ "$_ARCH" == "aarch64" || "$_ARCH" == "arm64" ]]; then
|
|
27
|
+
_BUN_PKG="@oven/bun-linux-aarch64"
|
|
28
|
+
else
|
|
29
|
+
_BUN_PKG="@oven/bun-linux-x64"
|
|
30
|
+
fi
|
|
31
|
+
|
|
32
|
+
if npm install "$_BUN_PKG" --prefix "$_TMP_DIR" --no-save --loglevel error; then
|
|
33
|
+
_BUN_SRC="$_TMP_DIR/node_modules/$_BUN_PKG/bin/bun"
|
|
34
|
+
if [[ -f "$_BUN_SRC" ]]; then
|
|
35
|
+
mkdir -p "$HOME/.bun/bin"
|
|
36
|
+
cp "$_BUN_SRC" "$HOME/.bun/bin/bun"
|
|
37
|
+
chmod +x "$HOME/.bun/bin/bun"
|
|
38
|
+
export PATH="$HOME/.bun/bin:$PATH"
|
|
39
|
+
echo "[bingocode] bun 安装完成,正在启动..."
|
|
40
|
+
else
|
|
41
|
+
echo "[bingocode] 安装失败:未找到 $_BUN_SRC" >&2
|
|
42
|
+
rm -rf "$_TMP_DIR"
|
|
43
|
+
exit 1
|
|
44
|
+
fi
|
|
45
|
+
else
|
|
46
|
+
echo "[bingocode] npm install $_BUN_PKG 失败,请手动安装 bun: https://bun.sh" >&2
|
|
47
|
+
rm -rf "$_TMP_DIR"
|
|
48
|
+
exit 1
|
|
49
|
+
fi
|
|
50
|
+
rm -rf "$_TMP_DIR"
|
|
51
|
+
fi
|
|
52
|
+
|
|
53
|
+
BUN_BIN="$(command -v bun 2>/dev/null || echo "$HOME/.bun/bin/bun")"
|
|
54
|
+
|
|
21
55
|
if [[ -f .env ]]; then
|
|
22
56
|
ENV_FILE_FLAG="--env-file=.env"
|
|
23
57
|
else
|
|
24
58
|
ENV_FILE_FLAG=""
|
|
25
59
|
fi
|
|
26
60
|
|
|
27
|
-
exec
|
|
61
|
+
exec "$BUN_BIN" --preload ./preload.ts $ENV_FILE_FLAG ./src/entrypoints/manager.tsx "$@"
|
package/bin/bingo-win.cjs
CHANGED
|
@@ -72,42 +72,44 @@ function bunExists() {
|
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
// 安装 bun
|
|
75
|
+
// 安装 bun(通过 npm 拉取官方包,不走 GitHub/bun.sh)
|
|
76
76
|
function installBun() {
|
|
77
|
-
|
|
78
|
-
const bundledBun = path.join(ROOT_DIR, 'runtime', 'bun.exe');
|
|
79
|
-
if (fs.existsSync(bundledBun)) {
|
|
80
|
-
console.log('[bingocode] 正在从包内部署 bun.exe...');
|
|
81
|
-
try {
|
|
82
|
-
const destDir = path.join(os.homedir(), '.bun', 'bin');
|
|
83
|
-
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
84
|
-
fs.copyFileSync(bundledBun, bunPath);
|
|
85
|
-
console.log('[bingocode] bun 已部署,正在启动...');
|
|
86
|
-
return true;
|
|
87
|
-
} catch (err) {
|
|
88
|
-
console.warn(`[bingocode] 包内部署失败: ${err.message},尝试在线安装...`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
77
|
+
console.log('[bingocode] bun 未检测到,正在通过 npm 安装...');
|
|
91
78
|
|
|
92
|
-
//
|
|
93
|
-
|
|
79
|
+
// 用 npm install 拉取平台对应包,安装到临时目录后复制 bun.exe
|
|
80
|
+
const tmpDir = path.join(os.tmpdir(), 'bingocode-bun-install');
|
|
94
81
|
try {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
82
|
+
fs.mkdirSync(tmpDir, { recursive: true });
|
|
83
|
+
|
|
84
|
+
// npm install @oven/bun-windows-x64 到临时目录
|
|
85
|
+
const npmResult = spawnSync(
|
|
86
|
+
'npm',
|
|
87
|
+
['install', '@oven/bun-windows-x64', '--prefix', tmpDir, '--no-save', '--loglevel', 'error'],
|
|
88
|
+
{ stdio: 'inherit', shell: true }
|
|
100
89
|
);
|
|
101
|
-
if (
|
|
102
|
-
throw new Error(`
|
|
90
|
+
if (npmResult.status !== 0) {
|
|
91
|
+
throw new Error(`npm install 失败,exit code ${npmResult.status}`);
|
|
103
92
|
}
|
|
93
|
+
|
|
94
|
+
// 从 node_modules 复制 bun.exe → ~/.bun/bin/bun.exe
|
|
95
|
+
const src = path.join(tmpDir, 'node_modules', '@oven', 'bun-windows-x64', 'bin', 'bun.exe');
|
|
96
|
+
if (!fs.existsSync(src)) {
|
|
97
|
+
throw new Error(`未找到 ${src}`);
|
|
98
|
+
}
|
|
99
|
+
const destDir = path.dirname(bunPath);
|
|
100
|
+
if (!fs.existsSync(destDir)) fs.mkdirSync(destDir, { recursive: true });
|
|
101
|
+
fs.copyFileSync(src, bunPath);
|
|
102
|
+
|
|
104
103
|
console.log('[bingocode] bun 安装完成,正在启动...');
|
|
104
|
+
return true;
|
|
105
105
|
} catch (err) {
|
|
106
106
|
console.error(`[bingocode] bun 自动安装失败: ${err.message}`);
|
|
107
|
-
console.log('[bingocode]
|
|
107
|
+
console.log('[bingocode] 请手动安装 bun: npm install -g @oven/bun-windows-x64');
|
|
108
108
|
return false;
|
|
109
|
+
} finally {
|
|
110
|
+
// 清理临时目录(非阻塞)
|
|
111
|
+
try { fs.rmSync(tmpDir, { recursive: true, force: true }); } catch (_) {}
|
|
109
112
|
}
|
|
110
|
-
return true;
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
if (!bunExists()) {
|
package/package.json
CHANGED
package/scripts/install-bun.cjs
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* postinstall helper: deploy bundled bun.exe → ~/.bun/bin/bun.exe
|
|
4
|
-
*
|
|
5
|
-
* Rules:
|
|
6
|
-
* - Only runs on Windows (win32). No-op on Linux/Mac.
|
|
7
|
-
* - Skips if ~/.bun/bin/bun.exe already exists (respect user's own install).
|
|
8
|
-
* - Appends %USERPROFILE%\.bun\bin to HKCU\Environment PATH via reg.exe (no admin needed).
|
|
9
|
-
* - CJS, no dependencies beyond Node built-ins.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
'use strict'
|
|
13
|
-
|
|
14
|
-
const fs = require('node:fs')
|
|
15
|
-
const path = require('node:path')
|
|
16
|
-
const os = require('node:os')
|
|
17
|
-
const { spawnSync } = require('node:child_process')
|
|
18
|
-
|
|
19
|
-
// Only relevant on Windows
|
|
20
|
-
if (process.platform !== 'win32') process.exit(0)
|
|
21
|
-
|
|
22
|
-
const home = os.homedir()
|
|
23
|
-
if (!home) process.exit(0)
|
|
24
|
-
|
|
25
|
-
const dest = path.join(home, '.bun', 'bin', 'bun.exe')
|
|
26
|
-
|
|
27
|
-
// Already installed — skip
|
|
28
|
-
if (fs.existsSync(dest)) {
|
|
29
|
-
console.log('[bingocode] bun already present, skipping bundled deploy.')
|
|
30
|
-
process.exit(0)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const src = path.join(__dirname, '..', 'runtime', 'bun.exe')
|
|
34
|
-
if (!fs.existsSync(src)) {
|
|
35
|
-
console.warn('[bingocode] runtime/bun.exe not found in package, skipping.')
|
|
36
|
-
process.exit(0)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Copy bun.exe
|
|
40
|
-
try {
|
|
41
|
-
fs.mkdirSync(path.dirname(dest), { recursive: true })
|
|
42
|
-
fs.copyFileSync(src, dest)
|
|
43
|
-
fs.chmodSync(dest, 0o755)
|
|
44
|
-
console.log(`[bingocode] deployed bun.exe → ${dest}`)
|
|
45
|
-
} catch (err) {
|
|
46
|
-
console.warn(`[bingocode] failed to deploy bun.exe: ${err.message}`)
|
|
47
|
-
process.exit(0)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Add ~/.bun/bin to HKCU PATH (no admin required)
|
|
51
|
-
try {
|
|
52
|
-
const bunBinDir = path.dirname(dest)
|
|
53
|
-
|
|
54
|
-
// Read current HKCU PATH
|
|
55
|
-
const query = spawnSync(
|
|
56
|
-
'reg',
|
|
57
|
-
['query', 'HKCU\\Environment', '/v', 'PATH'],
|
|
58
|
-
{ encoding: 'utf8', shell: false }
|
|
59
|
-
)
|
|
60
|
-
|
|
61
|
-
let currentPath = ''
|
|
62
|
-
if (query.status === 0 && query.stdout) {
|
|
63
|
-
const match = query.stdout.match(/PATH\s+REG(?:_EXPAND)?_SZ\s+(.+)/i)
|
|
64
|
-
if (match) currentPath = match[1].trim()
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// Already in PATH
|
|
68
|
-
if (currentPath.toLowerCase().includes(bunBinDir.toLowerCase())) {
|
|
69
|
-
console.log('[bingocode] PATH already contains bun bin dir.')
|
|
70
|
-
process.exit(0)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const newPath = currentPath ? `${currentPath};${bunBinDir}` : bunBinDir
|
|
74
|
-
|
|
75
|
-
const reg = spawnSync(
|
|
76
|
-
'reg',
|
|
77
|
-
['add', 'HKCU\\Environment', '/v', 'PATH', '/t', 'REG_EXPAND_SZ', '/d', newPath, '/f'],
|
|
78
|
-
{ encoding: 'utf8', shell: false }
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
if (reg.status === 0) {
|
|
82
|
-
console.log(`[bingocode] added ${bunBinDir} to user PATH.`)
|
|
83
|
-
console.log('[bingocode] NOTE: restart your terminal for PATH change to take effect.')
|
|
84
|
-
} else {
|
|
85
|
-
console.warn(`[bingocode] could not update PATH: ${reg.stderr}`)
|
|
86
|
-
}
|
|
87
|
-
} catch (err) {
|
|
88
|
-
console.warn(`[bingocode] PATH update failed (non-fatal): ${err.message}`)
|
|
89
|
-
}
|