@cannbot-ai/install-helper 0.0.2-beta.65 → 0.0.2-beta.67
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/README.md +34 -192
- package/dist/index.js +36 -28
- package/dist/index.js.map +1 -1
- package/dist/install.ps1 +94 -18
- package/dist/locales/en_US.json +11 -7
- package/dist/locales/zh_CN.json +11 -7
- package/package.json +6 -6
package/dist/install.ps1
CHANGED
|
@@ -14,6 +14,7 @@ try {
|
|
|
14
14
|
} catch {}
|
|
15
15
|
|
|
16
16
|
$ErrorActionPreference = "Stop"
|
|
17
|
+
$ProgressPreference = "SilentlyContinue"
|
|
17
18
|
|
|
18
19
|
function Compare-SemVer($a, $b) {
|
|
19
20
|
$aParts = $a -split '-',2
|
|
@@ -37,7 +38,53 @@ Write-Host ""
|
|
|
37
38
|
Write-Host " CANNBot Install Helper" -ForegroundColor Cyan
|
|
38
39
|
Write-Host ""
|
|
39
40
|
|
|
40
|
-
# 1.
|
|
41
|
+
# 1. Path A: If Node.js 18+ is available, use npm install
|
|
42
|
+
$hasNode = $false
|
|
43
|
+
try {
|
|
44
|
+
$nodeVersion = & node --version 2>$null
|
|
45
|
+
if ($nodeVersion) {
|
|
46
|
+
$majorVersion = [int]($nodeVersion -replace '^v', '' -replace '\..*', '')
|
|
47
|
+
if ($majorVersion -ge 18) {
|
|
48
|
+
$hasNode = $true
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
} catch {}
|
|
52
|
+
|
|
53
|
+
if ($hasNode) {
|
|
54
|
+
Write-Host " [OK] Node.js $nodeVersion" -ForegroundColor Green
|
|
55
|
+
Write-Host ""
|
|
56
|
+
|
|
57
|
+
# Check if already installed
|
|
58
|
+
try {
|
|
59
|
+
$installedVersion = & install-helper --version 2>$null
|
|
60
|
+
if ($installedVersion) {
|
|
61
|
+
Write-Host " [OK] 检测到已安装 install-helper (版本: $installedVersion)" -ForegroundColor Yellow
|
|
62
|
+
}
|
|
63
|
+
} catch {}
|
|
64
|
+
|
|
65
|
+
Write-Host " 正在安装 @cannbot-ai/install-helper..." -ForegroundColor Cyan
|
|
66
|
+
Write-Host ""
|
|
67
|
+
|
|
68
|
+
& npm install -g @cannbot-ai/install-helper 2>&1
|
|
69
|
+
if ($LASTEXITCODE -eq 0) {
|
|
70
|
+
Write-Host ""
|
|
71
|
+
Write-Host " [OK] 安装成功!" -ForegroundColor Green
|
|
72
|
+
Write-Host ""
|
|
73
|
+
Write-Host " 请运行: install-helper" -ForegroundColor Cyan
|
|
74
|
+
exit 0
|
|
75
|
+
} else {
|
|
76
|
+
Write-Host ""
|
|
77
|
+
Write-Host " [ERROR] npm 安装失败" -ForegroundColor Red
|
|
78
|
+
Write-Host ""
|
|
79
|
+
Write-Host " 请尝试以管理员权限运行:"
|
|
80
|
+
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
81
|
+
exit 1
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
# 2. Path B: No Node.js — download prebuilt binary
|
|
86
|
+
|
|
87
|
+
# Detect platform
|
|
41
88
|
$Arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x64" }
|
|
42
89
|
$SubPkgName = "@cannbot-ai/install-helper-windows-$Arch"
|
|
43
90
|
$BinaryName = "install-helper.exe"
|
|
@@ -55,6 +102,7 @@ $Mirrors = @(
|
|
|
55
102
|
|
|
56
103
|
$Version = $null
|
|
57
104
|
$Registry = $null
|
|
105
|
+
$Errors = @()
|
|
58
106
|
foreach ($url in $Mirrors) {
|
|
59
107
|
foreach ($tag in @("beta", "latest")) {
|
|
60
108
|
try {
|
|
@@ -68,7 +116,7 @@ foreach ($url in $Mirrors) {
|
|
|
68
116
|
$Registry = $url
|
|
69
117
|
}
|
|
70
118
|
}
|
|
71
|
-
} catch {}
|
|
119
|
+
} catch { $Errors += $_ }
|
|
72
120
|
}
|
|
73
121
|
if ($Version) {
|
|
74
122
|
Write-Host " [OK] Version: $Version (from $Registry)" -ForegroundColor Green
|
|
@@ -78,32 +126,48 @@ foreach ($url in $Mirrors) {
|
|
|
78
126
|
|
|
79
127
|
if (-not $Version) {
|
|
80
128
|
Write-Host " [ERROR] Failed to query version from all registries" -ForegroundColor Red
|
|
129
|
+
if ($Errors.Count -gt 0) {
|
|
130
|
+
Write-Host " Errors:" -ForegroundColor Yellow
|
|
131
|
+
foreach ($err in $Errors) {
|
|
132
|
+
Write-Host " - $($err.Exception.Message)" -ForegroundColor Yellow
|
|
133
|
+
}
|
|
134
|
+
}
|
|
81
135
|
Write-Host ""
|
|
82
136
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
83
137
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
84
|
-
|
|
138
|
+
exit 1
|
|
85
139
|
}
|
|
86
140
|
|
|
87
|
-
# 3. Download tarball
|
|
141
|
+
# 3. Download tarball (with mirror fallback)
|
|
88
142
|
$InstallDir = Join-Path $env:USERPROFILE ".cannbot\bin"
|
|
89
143
|
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
|
|
90
144
|
|
|
91
145
|
$TarballName = "$($SubPkgName.Split('/')[1])-$Version.tgz"
|
|
92
|
-
$TarballUrl = "$Registry/$SubPkgName/-/$TarballName"
|
|
93
146
|
|
|
94
147
|
Write-Host ""
|
|
95
148
|
Write-Host " Downloading $TarballName ..." -ForegroundColor Cyan
|
|
96
149
|
|
|
97
150
|
$TempFile = Join-Path $env:TEMP "ih-tarball.tgz"
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
151
|
+
$Downloaded = $false
|
|
152
|
+
$DownloadMirrors = @($Registry) + ($Mirrors | Where-Object { $_ -ne $Registry })
|
|
153
|
+
foreach ($url in $DownloadMirrors) {
|
|
154
|
+
$TarballUrl = "$url/$SubPkgName/-/$TarballName"
|
|
155
|
+
try {
|
|
156
|
+
Invoke-WebRequest $TarballUrl -OutFile $TempFile -TimeoutSec 300 -UseBasicParsing
|
|
157
|
+
$Downloaded = $true
|
|
158
|
+
Write-Host " [OK] Download complete" -ForegroundColor Green
|
|
159
|
+
break
|
|
160
|
+
} catch {
|
|
161
|
+
Write-Host " [WARN] Download from $url failed: $($_.Exception.Message)" -ForegroundColor Yellow
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (-not $Downloaded) {
|
|
166
|
+
Write-Host " [ERROR] Download failed from all mirrors" -ForegroundColor Red
|
|
103
167
|
Write-Host ""
|
|
104
168
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
105
169
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
106
|
-
|
|
170
|
+
exit 1
|
|
107
171
|
}
|
|
108
172
|
|
|
109
173
|
# 4. Extract
|
|
@@ -122,7 +186,7 @@ try {
|
|
|
122
186
|
Write-Host " Windows 10 1803+ includes tar. For older Windows, use npm install."
|
|
123
187
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
124
188
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
125
|
-
|
|
189
|
+
exit 1
|
|
126
190
|
}
|
|
127
191
|
|
|
128
192
|
$BinarySrc = Join-Path $TempExtract "package\$BinaryName"
|
|
@@ -132,7 +196,7 @@ if (-not (Test-Path $BinarySrc)) {
|
|
|
132
196
|
Write-Host " [ERROR] Binary not found in tarball: $BinarySrc" -ForegroundColor Red
|
|
133
197
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
134
198
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
135
|
-
|
|
199
|
+
exit 1
|
|
136
200
|
}
|
|
137
201
|
|
|
138
202
|
Copy-Item $BinarySrc $BinaryDest -Force
|
|
@@ -144,13 +208,25 @@ Write-Host ""
|
|
|
144
208
|
|
|
145
209
|
# 5. PATH
|
|
146
210
|
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
147
|
-
if ($UserPath
|
|
211
|
+
if (-not $UserPath) {
|
|
212
|
+
[Environment]::SetEnvironmentVariable("Path", $InstallDir, "User")
|
|
213
|
+
Write-Host " [OK] Added to PATH (restart terminal to take effect)" -ForegroundColor Green
|
|
214
|
+
Write-Host ""
|
|
215
|
+
} elseif ($UserPath -notlike "*$InstallDir*") {
|
|
148
216
|
[Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User")
|
|
149
217
|
Write-Host " [OK] Added to PATH (restart terminal to take effect)" -ForegroundColor Green
|
|
150
218
|
Write-Host ""
|
|
151
219
|
}
|
|
152
220
|
|
|
153
|
-
# 6.
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
221
|
+
# 6. Verify binary and launch
|
|
222
|
+
try {
|
|
223
|
+
$null = & $BinaryDest --version 2>&1
|
|
224
|
+
Write-Host " Launching install-helper..." -ForegroundColor Cyan
|
|
225
|
+
Write-Host ""
|
|
226
|
+
& $BinaryDest
|
|
227
|
+
} catch {
|
|
228
|
+
Write-Host " [WARN] Binary failed to run" -ForegroundColor Yellow
|
|
229
|
+
Write-Host ""
|
|
230
|
+
Write-Host " Alternative (requires Node.js 18+):"
|
|
231
|
+
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
232
|
+
}
|
package/dist/locales/en_US.json
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
"wizard_detect": "Detecting installed AI coding tools...",
|
|
4
4
|
"wizard_select_tool": "Select AI coding tool",
|
|
5
5
|
"wizard_select_level": "Select install level",
|
|
6
|
-
"
|
|
7
|
-
"wizard_select_plugin": "Select a scenario to install (one only)",
|
|
6
|
+
"wizard_select_plugin": "Select a scenario to install",
|
|
8
7
|
"wizard_confirm": "Confirm installation",
|
|
9
8
|
"wizard_detected_tool": "Detected",
|
|
10
9
|
"wizard_confirm_tool": "Confirm using",
|
|
@@ -62,8 +61,6 @@
|
|
|
62
61
|
"error_not_installed": "Not installed",
|
|
63
62
|
"error_no_shell": "bash or sh not found, cannot execute install script. Please install Git Bash or WSL",
|
|
64
63
|
"error_symlink_windows": "Failed to create symlink, please run as administrator or enable Windows Developer Mode",
|
|
65
|
-
"quick_start": "Launch command",
|
|
66
|
-
"quick_start_hint": "Try: help me develop an Abs operator",
|
|
67
64
|
"skill_select_category": "Select Skill category",
|
|
68
65
|
"skill_select_items": "Select Skills to install (space to toggle, enter to confirm)",
|
|
69
66
|
"skill_already_installed": "installed",
|
|
@@ -103,7 +100,6 @@
|
|
|
103
100
|
"uninstall_no_record": "No install record found, may not be installed or record is corrupted",
|
|
104
101
|
"uninstall_no_record_hint": "For manual cleanup, delete related files in .opencode/ or .claude/ directory",
|
|
105
102
|
"uninstall_in_progress": "Uninstalling",
|
|
106
|
-
"uninstall_removed": "Uninstalled",
|
|
107
103
|
"uninstall_summary_format": "{name} (removed {files} files, {dirs} directories)",
|
|
108
104
|
"uninstall_files_gone": " files no longer exist, install record cleaned",
|
|
109
105
|
"uninstall_skills_in_progress": "Uninstalling",
|
|
@@ -137,6 +133,16 @@
|
|
|
137
133
|
"skill_record_corrupted": "Skill install record corrupted",
|
|
138
134
|
"plugin_yaml_error": "Plugin config parse error: {file}",
|
|
139
135
|
"record_write_failed": "Install record write failed, uninstall may not work properly",
|
|
136
|
+
"install_config_failed": "Failed to install config file: {error}",
|
|
137
|
+
"install_clone_failed": "git clone failed: {url}, clone manually: git clone {url} {dir}",
|
|
138
|
+
"install_link_config_failed": "Failed to link {name} to config directory",
|
|
139
|
+
"install_link_project_failed": "Failed to link {name} to project directory",
|
|
140
|
+
"install_link_workflows_failed": "Failed to link workflows to config directory",
|
|
141
|
+
"install_skill_source_not_found": "Skill source not found: {dir}",
|
|
142
|
+
"install_skill_not_found": "Skill not found: {name} in {dir}",
|
|
143
|
+
"install_skill_failed": "Failed to install skill: {name}",
|
|
144
|
+
"install_agent_not_found": "Agent not found: {name}",
|
|
145
|
+
"install_agent_failed": "Failed to install agent: {name}",
|
|
140
146
|
"install_no_skill_selected": "No Skill selected",
|
|
141
147
|
"install_to": "Install to",
|
|
142
148
|
"start_to_use": "Start {tool} to use",
|
|
@@ -153,8 +159,6 @@
|
|
|
153
159
|
"result_success_format": "{count} succeeded",
|
|
154
160
|
"result_failed_format": "{count} failed",
|
|
155
161
|
"uninstall_remove_label": "Removed",
|
|
156
|
-
"uninstall_remove_file_format": "Removed {count} files",
|
|
157
|
-
"uninstall_remove_dir_format": "{count} directories",
|
|
158
162
|
"uninstall_clean_empty_dir": "Cleaned empty directory",
|
|
159
163
|
"uninstall_skill_not_installed": "Not installed",
|
|
160
164
|
"available_plugins": "Available plugins",
|
package/dist/locales/zh_CN.json
CHANGED
|
@@ -3,8 +3,7 @@
|
|
|
3
3
|
"wizard_detect": "正在检测已安装的 AI 编程工具...",
|
|
4
4
|
"wizard_select_tool": "选择 AI 编程工具",
|
|
5
5
|
"wizard_select_level": "选择安装位置",
|
|
6
|
-
"
|
|
7
|
-
"wizard_select_plugin": "选择要安装的插件(仅可选择一个)",
|
|
6
|
+
"wizard_select_plugin": "选择要安装的插件",
|
|
8
7
|
"wizard_confirm": "确认安装",
|
|
9
8
|
"wizard_detected_tool": "检测到",
|
|
10
9
|
"wizard_confirm_tool": "使用",
|
|
@@ -62,8 +61,6 @@
|
|
|
62
61
|
"error_not_installed": "未安装",
|
|
63
62
|
"error_no_shell": "未找到 bash 或 sh,无法执行安装脚本。请安装 Git Bash 或 WSL",
|
|
64
63
|
"error_symlink_windows": "创建符号链接失败,请以管理员身份运行或开启 Windows 开发者模式",
|
|
65
|
-
"quick_start": "启动命令",
|
|
66
|
-
"quick_start_hint": "试试输入: 帮我开发一个 Abs 算子",
|
|
67
64
|
"skill_select_category": "选择 Skill 类别",
|
|
68
65
|
"skill_select_items": "选择要安装的 Skills",
|
|
69
66
|
"skill_already_installed": "已安装",
|
|
@@ -103,7 +100,6 @@
|
|
|
103
100
|
"uninstall_no_record": "未找到安装记录,可能未安装或安装记录已损坏",
|
|
104
101
|
"uninstall_no_record_hint": "如需强制清理,请手动删除 .opencode/ 或 .claude/ 目录中的相关文件",
|
|
105
102
|
"uninstall_in_progress": "正在卸载",
|
|
106
|
-
"uninstall_removed": "已卸载",
|
|
107
103
|
"uninstall_summary_format": "{name}(移除 {files} 个文件,{dirs} 个目录)",
|
|
108
104
|
"uninstall_files_gone": "的文件已不存在,已清理安装记录",
|
|
109
105
|
"uninstall_skills_in_progress": "正在卸载",
|
|
@@ -137,6 +133,16 @@
|
|
|
137
133
|
"skill_record_corrupted": "Skill 安装记录已损坏",
|
|
138
134
|
"plugin_yaml_error": "插件配置解析失败:{file}",
|
|
139
135
|
"record_write_failed": "安装记录写入失败,卸载时可能无法自动清理",
|
|
136
|
+
"install_config_failed": "配置文件安装失败: {error}",
|
|
137
|
+
"install_clone_failed": "git clone 失败: {url},请手动克隆: git clone {url} {dir}",
|
|
138
|
+
"install_link_config_failed": "链接 {name} 到配置目录失败",
|
|
139
|
+
"install_link_project_failed": "链接 {name} 到项目目录失败",
|
|
140
|
+
"install_link_workflows_failed": "链接 workflows 到配置目录失败",
|
|
141
|
+
"install_skill_source_not_found": "Skill 源目录未找到: {dir}",
|
|
142
|
+
"install_skill_not_found": "Skill 未找到: {name} (在 {dir})",
|
|
143
|
+
"install_skill_failed": "Skill 安装失败: {name}",
|
|
144
|
+
"install_agent_not_found": "Agent 未找到: {name}",
|
|
145
|
+
"install_agent_failed": "Agent 安装失败: {name}",
|
|
140
146
|
"install_no_skill_selected": "未选择任何 Skill",
|
|
141
147
|
"install_to": "安装到",
|
|
142
148
|
"start_to_use": "启动 {tool} 即可使用",
|
|
@@ -153,8 +159,6 @@
|
|
|
153
159
|
"result_success_format": "{count} 成功",
|
|
154
160
|
"result_failed_format": "{count} 失败",
|
|
155
161
|
"uninstall_remove_label": "移除",
|
|
156
|
-
"uninstall_remove_file_format": "移除 {count} 个文件",
|
|
157
|
-
"uninstall_remove_dir_format": "{count} 个目录",
|
|
158
162
|
"uninstall_clean_empty_dir": "清理空目录",
|
|
159
163
|
"uninstall_skill_not_installed": "未安装",
|
|
160
164
|
"available_plugins": "可用插件",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cannbot-ai/install-helper",
|
|
3
|
-
"version": "0.0.2-beta.
|
|
3
|
+
"version": "0.0.2-beta.67",
|
|
4
4
|
"description": "Install Helper - Interactive installer for CANN operator development skills",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -42,11 +42,11 @@
|
|
|
42
42
|
"yaml": "^2.6.0"
|
|
43
43
|
},
|
|
44
44
|
"optionalDependencies": {
|
|
45
|
-
"@cannbot-ai/install-helper-linux-x64": "0.0.2-beta.
|
|
46
|
-
"@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.
|
|
47
|
-
"@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.
|
|
48
|
-
"@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.
|
|
49
|
-
"@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.
|
|
45
|
+
"@cannbot-ai/install-helper-linux-x64": "0.0.2-beta.66",
|
|
46
|
+
"@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.66",
|
|
47
|
+
"@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.66",
|
|
48
|
+
"@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.66",
|
|
49
|
+
"@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.66"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.0.0",
|