tako-cli 0.2.5 → 0.2.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/dist/catalog.json +243 -0
- package/dist/hub-web/404.html +2 -2
- package/dist/hub-web/apple-touch-icon-180x180.png +0 -0
- package/dist/hub-web/assets/index-BFFI6ZQs.js +567 -0
- package/dist/hub-web/assets/index-Cafcc5Wp.js +567 -0
- package/dist/hub-web/assets/index-Cb_RdKoR.js +567 -0
- package/dist/hub-web/assets/index-CgNhArY7.css +1 -0
- package/dist/hub-web/assets/index-urrIqv8H.js +567 -0
- package/dist/hub-web/assets/index-wkTDcFJS.js +567 -0
- package/dist/hub-web/assets/index-zzxKBcct.js +567 -0
- package/dist/hub-web/favicon.ico +0 -0
- package/dist/hub-web/icon.svg +25 -21
- package/dist/hub-web/index.html +2 -2
- package/dist/hub-web/mask-icon.svg +9 -2
- package/dist/hub-web/maskable-icon-512x512.png +0 -0
- package/dist/hub-web/pwa-192x192.png +0 -0
- package/dist/hub-web/pwa-512x512.png +0 -0
- package/dist/hub-web/pwa-64x64.png +0 -0
- package/dist/hub-web/sw.js +2 -2
- package/dist/index.js +323 -1710
- package/install.sh +14 -101
- package/package.json +21 -55
package/install.sh
CHANGED
|
@@ -34,51 +34,21 @@ error() {
|
|
|
34
34
|
|
|
35
35
|
# 检测用户所在地区
|
|
36
36
|
detect_region() {
|
|
37
|
-
# Fast path: locale/timezone heuristic (instant, no network)
|
|
38
|
-
local lang="${LANG:-}${LC_ALL:-}${LANGUAGE:-}"
|
|
39
|
-
if echo "$lang" | grep -qi '^zh_CN'; then
|
|
40
|
-
REGION="cn"
|
|
41
|
-
info "检测到中文环境,使用国内镜像"
|
|
42
|
-
return 0
|
|
43
|
-
fi
|
|
44
|
-
|
|
45
|
-
# Check timezone (CST or Asia/Shanghai variants)
|
|
46
|
-
local tz="${TZ:-}"
|
|
47
|
-
if [ -z "$tz" ]; then
|
|
48
|
-
tz=$(date +%Z 2>/dev/null || echo "")
|
|
49
|
-
fi
|
|
50
|
-
case "$tz" in
|
|
51
|
-
CST|Asia/Shanghai|Asia/Chongqing|Asia/Urumqi|Asia/Harbin)
|
|
52
|
-
REGION="cn"
|
|
53
|
-
info "检测到中国时区,使用国内镜像"
|
|
54
|
-
return 0
|
|
55
|
-
;;
|
|
56
|
-
esac
|
|
57
|
-
|
|
58
|
-
# Slow path: IP-based detection (with --max-time to cap total request time)
|
|
59
37
|
info "检测网络环境..."
|
|
60
38
|
|
|
61
39
|
local country=""
|
|
62
|
-
country=$(curl -s --connect-timeout 2
|
|
40
|
+
country=$(curl -s --connect-timeout 2 "http://ip-api.com/line/?fields=countryCode" 2>/dev/null || echo "")
|
|
63
41
|
|
|
64
42
|
if [ -z "$country" ]; then
|
|
65
|
-
country=$(curl -s --connect-timeout 2
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
if [ -z "$country" ]; then
|
|
69
|
-
country=$(curl -s --connect-timeout 2 --max-time 3 "https://api.ip.sb/geoip" 2>/dev/null | grep -o '"country_code":"[^"]*"' | head -1 | cut -d'"' -f4 || echo "")
|
|
43
|
+
country=$(curl -s --connect-timeout 2 "https://ipinfo.io/country" 2>/dev/null || echo "")
|
|
70
44
|
fi
|
|
71
45
|
|
|
72
46
|
if [ "$country" = "CN" ]; then
|
|
73
47
|
REGION="cn"
|
|
74
48
|
info "检测到中国大陆网络,使用国内镜像"
|
|
75
|
-
|
|
49
|
+
else
|
|
76
50
|
REGION="global"
|
|
77
51
|
info "使用国际源"
|
|
78
|
-
else
|
|
79
|
-
# 所有检测都失败,默认使用国内镜像(保守策略,与 TS 代码一致)
|
|
80
|
-
REGION="cn"
|
|
81
|
-
info "网络检测超时,默认使用国内镜像"
|
|
82
52
|
fi
|
|
83
53
|
}
|
|
84
54
|
|
|
@@ -118,68 +88,6 @@ install_dependencies() {
|
|
|
118
88
|
fi
|
|
119
89
|
}
|
|
120
90
|
|
|
121
|
-
# 从 npmmirror 直接下载安装 Bun(国内专用,不依赖 bun.sh 和 GitHub)
|
|
122
|
-
install_bun_from_npmmirror() {
|
|
123
|
-
local mirror="https://registry.npmmirror.com/-/binary/bun"
|
|
124
|
-
|
|
125
|
-
# 检测平台和架构
|
|
126
|
-
local os arch target
|
|
127
|
-
os=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
128
|
-
arch=$(uname -m)
|
|
129
|
-
|
|
130
|
-
case "$os" in
|
|
131
|
-
linux) os="linux" ;;
|
|
132
|
-
darwin) os="darwin" ;;
|
|
133
|
-
*) error "不支持的操作系统: $os" ;;
|
|
134
|
-
esac
|
|
135
|
-
|
|
136
|
-
case "$arch" in
|
|
137
|
-
x86_64|amd64) arch="x64" ;;
|
|
138
|
-
aarch64|arm64) arch="aarch64" ;;
|
|
139
|
-
*) error "不支持的架构: $arch" ;;
|
|
140
|
-
esac
|
|
141
|
-
|
|
142
|
-
# Alpine Linux 使用 musl 版本
|
|
143
|
-
target="bun-${os}-${arch}"
|
|
144
|
-
if [ "$os" = "linux" ] && [ -f /etc/alpine-release ]; then
|
|
145
|
-
target="${target}-musl"
|
|
146
|
-
fi
|
|
147
|
-
|
|
148
|
-
# 获取最新版本号
|
|
149
|
-
info "正在获取最新版本..."
|
|
150
|
-
local latest_version
|
|
151
|
-
latest_version=$(curl -s --connect-timeout 5 "$mirror/" 2>/dev/null \
|
|
152
|
-
| grep -o '"name":"bun-v[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/"' \
|
|
153
|
-
| sed 's/"name":"bun-v//;s/\/"//' \
|
|
154
|
-
| sort -t. -k1,1rn -k2,2rn -k3,3rn \
|
|
155
|
-
| head -1)
|
|
156
|
-
|
|
157
|
-
if [ -z "$latest_version" ]; then
|
|
158
|
-
error "无法获取 Bun 最新版本号"
|
|
159
|
-
fi
|
|
160
|
-
|
|
161
|
-
# 补回前缀
|
|
162
|
-
latest_version="bun-v${latest_version}"
|
|
163
|
-
|
|
164
|
-
local download_url="${mirror}/${latest_version}/${target}.zip"
|
|
165
|
-
local zip_file="/tmp/bun-install-$$.zip"
|
|
166
|
-
|
|
167
|
-
info "下载 Bun (${latest_version}) from npmmirror..."
|
|
168
|
-
curl --fail --location --progress-bar --output "$zip_file" "$download_url" || \
|
|
169
|
-
error "下载失败: $download_url"
|
|
170
|
-
|
|
171
|
-
# 解压到目标目录
|
|
172
|
-
local bin_dir="$TAKO_BUN_DIR/bin"
|
|
173
|
-
mkdir -p "$bin_dir"
|
|
174
|
-
|
|
175
|
-
unzip -oq "$zip_file" -d /tmp/bun-install-$$ || error "解压失败"
|
|
176
|
-
mv "/tmp/bun-install-$$/${target}/bun" "$bin_dir/bun"
|
|
177
|
-
chmod +x "$bin_dir/bun"
|
|
178
|
-
|
|
179
|
-
# 清理临时文件
|
|
180
|
-
rm -rf "$zip_file" "/tmp/bun-install-$$"
|
|
181
|
-
}
|
|
182
|
-
|
|
183
91
|
# 安装 Tako 专属 Bun
|
|
184
92
|
install_bun() {
|
|
185
93
|
# 检查是否已安装
|
|
@@ -193,15 +101,20 @@ install_bun() {
|
|
|
193
101
|
|
|
194
102
|
mkdir -p "$TAKO_BUN_DIR"
|
|
195
103
|
|
|
104
|
+
# 设置环境变量确保 bun 安装到正确位置
|
|
105
|
+
export BUN_INSTALL="$TAKO_BUN_DIR"
|
|
106
|
+
|
|
107
|
+
# 国内用户使用镜像
|
|
196
108
|
if [ "$REGION" = "cn" ]; then
|
|
197
|
-
|
|
198
|
-
install_bun_from_npmmirror
|
|
199
|
-
else
|
|
200
|
-
# 海外用户:使用官方安装脚本
|
|
201
|
-
export BUN_INSTALL="$TAKO_BUN_DIR"
|
|
202
|
-
curl -fsSL https://bun.sh/install | bash
|
|
109
|
+
export BUN_INSTALL_MIRROR="https://registry.npmmirror.com/-/binary/bun"
|
|
203
110
|
fi
|
|
204
111
|
|
|
112
|
+
# 执行 bun 安装脚本
|
|
113
|
+
curl -fsSL https://bun.sh/install | bash
|
|
114
|
+
|
|
115
|
+
# 清理环境变量
|
|
116
|
+
unset BUN_INSTALL_MIRROR
|
|
117
|
+
|
|
205
118
|
if [ ! -x "$TAKO_BUN_DIR/bin/bun" ]; then
|
|
206
119
|
error "Bun 安装失败,请检查网络连接"
|
|
207
120
|
fi
|
package/package.json
CHANGED
|
@@ -1,78 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tako-cli",
|
|
3
|
-
"version": "0.2.
|
|
4
|
-
"description": "Tako CLI - AI coding tools launcher
|
|
5
|
-
"author": "Tako Team",
|
|
6
|
-
"license": "AGPL-3.0-only",
|
|
3
|
+
"version": "0.2.8",
|
|
4
|
+
"description": "Tako CLI - AI coding tools launcher",
|
|
7
5
|
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"tako": "./dist/index.js"
|
|
8
|
+
},
|
|
8
9
|
"files": [
|
|
9
|
-
"dist/",
|
|
10
10
|
"install.sh",
|
|
11
|
-
"install.ps1"
|
|
11
|
+
"install.ps1",
|
|
12
|
+
"dist"
|
|
12
13
|
],
|
|
13
|
-
"imports": {
|
|
14
|
-
"#embedded-assets": {
|
|
15
|
-
"bun": "./src/runtime/embeddedAssets.bun.ts",
|
|
16
|
-
"default": "./src/runtime/embeddedAssets.stub.ts"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
14
|
"scripts": {
|
|
20
|
-
"typecheck": "tsc --noEmit",
|
|
21
|
-
"build:web": "cd ../hub/web && bun install && bun run build",
|
|
22
15
|
"build": "bun run scripts/build.ts",
|
|
23
16
|
"bump": "bun scripts/bump.ts",
|
|
24
17
|
"test": "bun test",
|
|
25
18
|
"test:unit": "bun test tests/unit.*.test.ts",
|
|
26
19
|
"test:integration": "bun test tests/integration.*.test.ts",
|
|
27
20
|
"test:platform": "bun test tests/platform.*.test.ts",
|
|
28
|
-
"test:pre-release": "bun test tests/pre-release.test.ts
|
|
21
|
+
"test:pre-release": "bun test tests/pre-release.test.ts",
|
|
29
22
|
"test:e2e": "bash scripts/test-install.sh",
|
|
30
|
-
"test:
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
},
|
|
35
|
-
"dependencies": {
|
|
36
|
-
"@modelcontextprotocol/sdk": "^1.25.1",
|
|
37
|
-
"@openpanel/sdk": "^1.0.4",
|
|
38
|
-
"axios": "^1.13.2",
|
|
39
|
-
"chalk": "^5.6.2",
|
|
40
|
-
"cross-spawn": "^7.0.6",
|
|
41
|
-
"fastify": "^5.6.2",
|
|
42
|
-
"fastify-type-provider-zod": "6.1.0",
|
|
43
|
-
"ink": "^6.6.0",
|
|
44
|
-
"ps-list": "^9.0.0",
|
|
45
|
-
"react": "^19.2.3",
|
|
46
|
-
"socket.io-client": "^4.8.3",
|
|
47
|
-
"tar": "^7.5.2",
|
|
48
|
-
"yaml": "^2.8.2",
|
|
49
|
-
"zod": "^4.2.1"
|
|
23
|
+
"test:watch": "bun test --watch",
|
|
24
|
+
"test:coverage": "bun test --coverage",
|
|
25
|
+
"release": "bun run test:pre-release && bun scripts/bump.ts patch && npm publish --registry https://registry.npmjs.org && ./scripts/sync-gitee.sh",
|
|
26
|
+
"prepublishOnly": "bun run build"
|
|
50
27
|
},
|
|
51
28
|
"devDependencies": {
|
|
52
|
-
"@tako/installer": "workspace:*",
|
|
53
|
-
"@tako/protocol": "workspace:*",
|
|
54
|
-
"tako-hub": "workspace:*",
|
|
55
29
|
"@clack/prompts": "^0.7.0",
|
|
56
|
-
"
|
|
57
|
-
"@types/node": ">=25",
|
|
58
|
-
"@types/ps-list": "^6.2.1",
|
|
59
|
-
"@types/react": "^19.2.7",
|
|
60
|
-
"bun-types": "latest",
|
|
61
|
-
"dotenv": "^17.2.3",
|
|
62
|
-
"typescript": "^5",
|
|
63
|
-
"vitest": "^4.0.16"
|
|
64
|
-
},
|
|
65
|
-
"resolutions": {
|
|
66
|
-
"whatwg-url": "14.2.0",
|
|
67
|
-
"parse-path": "7.0.3",
|
|
68
|
-
"@types/parse-path": "7.0.3"
|
|
30
|
+
"bun-types": "latest"
|
|
69
31
|
},
|
|
70
32
|
"keywords": [
|
|
71
33
|
"cli",
|
|
72
34
|
"ai",
|
|
73
35
|
"claude",
|
|
74
|
-
"codex"
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
36
|
+
"codex"
|
|
37
|
+
],
|
|
38
|
+
"license": "UNLICENSED",
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@openpanel/sdk": "^1.0.4",
|
|
41
|
+
"qrcode-terminal": "^0.12.0",
|
|
42
|
+
"smol-toml": "^1.3.1"
|
|
43
|
+
}
|
|
78
44
|
}
|