@cannbot-ai/install-helper 1.1.2 → 1.1.3
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 +1 -1
- package/dist/index.js +50 -24
- package/dist/index.js.map +1 -1
- package/dist/install.ps1 +76 -85
- package/dist/plugins.d/catlass-op-generator.yml +1 -1
- package/dist/plugins.d/model-infer-optimize.yml +1 -1
- package/dist/plugins.d/ops-code-reviewer.yml +1 -1
- package/dist/plugins.d/ops-direct-invoke-flash.yml +1 -1
- package/dist/plugins.d/ops-direct-invoke.yml +2 -2
- package/dist/plugins.d/ops-registry-invoke.yml +2 -2
- package/dist/plugins.d/triton-op-generator.yml +1 -1
- package/package.json +6 -6
package/dist/install.ps1
CHANGED
|
@@ -13,19 +13,27 @@ try {
|
|
|
13
13
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
14
14
|
} catch {}
|
|
15
15
|
|
|
16
|
+
# Channel selection: latest (default), beta, or explicit version
|
|
17
|
+
# Set $env:CANNBOT_CHANNEL = "beta" before running to install beta
|
|
18
|
+
$Channel = if ($env:CANNBOT_CHANNEL) { $env:CANNBOT_CHANNEL } else { "latest" }
|
|
19
|
+
|
|
20
|
+
# Auto-fix ExecutionPolicy for npm global tools (.ps1)
|
|
21
|
+
$execPolicy = Get-ExecutionPolicy -Scope CurrentUser
|
|
22
|
+
if ($execPolicy -eq "Restricted") {
|
|
23
|
+
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
|
|
24
|
+
Write-Host " [OK] ExecutionPolicy set to RemoteSigned (required for npm tools)" -ForegroundColor Green
|
|
25
|
+
}
|
|
26
|
+
|
|
16
27
|
$ErrorActionPreference = "Stop"
|
|
17
28
|
$ProgressPreference = "SilentlyContinue"
|
|
18
29
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if ($aParts.Length -eq 1) { return $true }
|
|
27
|
-
if ($bParts.Length -eq 1) { return $false }
|
|
28
|
-
return "$($aParts[1])" -gt "$($bParts[1])"
|
|
30
|
+
trap {
|
|
31
|
+
Write-Host ""
|
|
32
|
+
Write-Host " [ERROR] $_" -ForegroundColor Red
|
|
33
|
+
Write-Host ""
|
|
34
|
+
Write-Host " Press Enter to exit..."
|
|
35
|
+
Read-Host
|
|
36
|
+
return
|
|
29
37
|
}
|
|
30
38
|
|
|
31
39
|
Write-Host ""
|
|
@@ -38,53 +46,7 @@ Write-Host ""
|
|
|
38
46
|
Write-Host " CANNBot Install Helper" -ForegroundColor Cyan
|
|
39
47
|
Write-Host ""
|
|
40
48
|
|
|
41
|
-
# 1.
|
|
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
|
|
49
|
+
# 1. Detect platform
|
|
88
50
|
$Arch = if ($env:PROCESSOR_ARCHITECTURE -eq "ARM64") { "arm64" } else { "x64" }
|
|
89
51
|
$SubPkgName = "@cannbot-ai/install-helper-windows-$Arch"
|
|
90
52
|
$BinaryName = "install-helper.exe"
|
|
@@ -92,8 +54,8 @@ $BinaryName = "install-helper.exe"
|
|
|
92
54
|
Write-Host " [OK] Platform: windows-$Arch" -ForegroundColor Green
|
|
93
55
|
Write-Host ""
|
|
94
56
|
|
|
95
|
-
# 2. Query
|
|
96
|
-
Write-Host " Querying
|
|
57
|
+
# 2. Query version from npm registry (channel-specific)
|
|
58
|
+
Write-Host " Querying version ($Channel)..." -ForegroundColor Cyan
|
|
97
59
|
|
|
98
60
|
$Mirrors = @(
|
|
99
61
|
"https://registry.npmjs.org",
|
|
@@ -103,25 +65,27 @@ $Mirrors = @(
|
|
|
103
65
|
$Version = $null
|
|
104
66
|
$Registry = $null
|
|
105
67
|
$Errors = @()
|
|
106
|
-
|
|
107
|
-
|
|
68
|
+
|
|
69
|
+
if ($Channel -eq "latest" -or $Channel -eq "beta") {
|
|
70
|
+
foreach ($url in $Mirrors) {
|
|
108
71
|
try {
|
|
109
|
-
$resp = Invoke-RestMethod "$url/$SubPkgName/$
|
|
72
|
+
$resp = Invoke-RestMethod "$url/$SubPkgName/$Channel" -TimeoutSec 15
|
|
110
73
|
if ($resp.version) {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
$Registry = $url
|
|
114
|
-
} elseif (Compare-SemVer $resp.version $Version) {
|
|
115
|
-
$Version = $resp.version
|
|
116
|
-
$Registry = $url
|
|
117
|
-
}
|
|
74
|
+
$Version = $resp.version
|
|
75
|
+
$Registry = $url
|
|
118
76
|
}
|
|
119
77
|
} catch { $Errors += $_ }
|
|
78
|
+
if ($Version) {
|
|
79
|
+
break
|
|
80
|
+
}
|
|
120
81
|
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
82
|
+
} else {
|
|
83
|
+
$Version = $Channel
|
|
84
|
+
$Registry = $Mirrors[0]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
if ($Version) {
|
|
88
|
+
Write-Host " [OK] Version: $Version ($Channel)" -ForegroundColor Green
|
|
125
89
|
}
|
|
126
90
|
|
|
127
91
|
if (-not $Version) {
|
|
@@ -135,11 +99,39 @@ if (-not $Version) {
|
|
|
135
99
|
Write-Host ""
|
|
136
100
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
137
101
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
138
|
-
|
|
102
|
+
return
|
|
139
103
|
}
|
|
140
104
|
|
|
141
|
-
# 3.
|
|
105
|
+
# 3. Check if already installed and up-to-date
|
|
142
106
|
$InstallDir = Join-Path $env:USERPROFILE ".cannbot\bin"
|
|
107
|
+
$BinaryDest = Join-Path $InstallDir "install-helper.exe"
|
|
108
|
+
if (Test-Path $BinaryDest) {
|
|
109
|
+
try {
|
|
110
|
+
$prevEAP = $ErrorActionPreference
|
|
111
|
+
$ErrorActionPreference = "Continue"
|
|
112
|
+
$localVersion = (& $BinaryDest --version 2>$null)
|
|
113
|
+
$ErrorActionPreference = $prevEAP
|
|
114
|
+
if ($localVersion -and $localVersion.Trim() -eq $Version) {
|
|
115
|
+
Write-Host " [OK] Already up-to-date (v$Version)" -ForegroundColor Green
|
|
116
|
+
Write-Host ""
|
|
117
|
+
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
118
|
+
if (-not $UserPath) {
|
|
119
|
+
[Environment]::SetEnvironmentVariable("Path", $InstallDir, "User")
|
|
120
|
+
} elseif ($UserPath -notlike "*$InstallDir*") {
|
|
121
|
+
[Environment]::SetEnvironmentVariable("Path", "$UserPath;$InstallDir", "User")
|
|
122
|
+
}
|
|
123
|
+
Write-Host " Launching install-helper..." -ForegroundColor Cyan
|
|
124
|
+
Write-Host ""
|
|
125
|
+
& $BinaryDest
|
|
126
|
+
return
|
|
127
|
+
}
|
|
128
|
+
if ($localVersion) {
|
|
129
|
+
Write-Host " [INFO] Updating: v$($localVersion.Trim()) -> v$Version" -ForegroundColor Yellow
|
|
130
|
+
}
|
|
131
|
+
} catch {}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# 4. Download tarball (with mirror fallback)
|
|
143
135
|
New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
|
|
144
136
|
|
|
145
137
|
$TarballName = "$($SubPkgName.Split('/')[1])-$Version.tgz"
|
|
@@ -167,17 +159,17 @@ if (-not $Downloaded) {
|
|
|
167
159
|
Write-Host ""
|
|
168
160
|
Write-Host " Alternative (requires Node.js 18+):"
|
|
169
161
|
Write-Host " npm install -g @cannbot-ai/install-helper"
|
|
170
|
-
|
|
162
|
+
return
|
|
171
163
|
}
|
|
172
164
|
|
|
173
|
-
#
|
|
174
|
-
Write-Host " Installing..." -ForegroundColor Cyan
|
|
165
|
+
# 5. Extract
|
|
166
|
+
Write-Host " Installing v$Version..." -ForegroundColor Cyan
|
|
175
167
|
|
|
176
168
|
$TempExtract = Join-Path $env:TEMP "ih-extract-$(Get-Random)"
|
|
177
169
|
New-Item -ItemType Directory -Force -Path $TempExtract | Out-Null
|
|
178
170
|
|
|
179
171
|
try {
|
|
180
|
-
& tar xzf $TempFile -C $TempExtract 2
|
|
172
|
+
& tar xzf $TempFile -C $TempExtract 2>$null
|
|
181
173
|
if ($LASTEXITCODE -ne 0) {
|
|
182
174
|
throw "tar exit code $LASTEXITCODE"
|
|
183
175
|
}
|
|
@@ -186,17 +178,16 @@ try {
|
|
|
186
178
|
Write-Host " Windows 10 1803+ includes tar. For older Windows, use npm install."
|
|
187
179
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
188
180
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
189
|
-
|
|
181
|
+
return
|
|
190
182
|
}
|
|
191
183
|
|
|
192
184
|
$BinarySrc = Join-Path $TempExtract "package\$BinaryName"
|
|
193
|
-
$BinaryDest = Join-Path $InstallDir "install-helper.exe"
|
|
194
185
|
|
|
195
186
|
if (-not (Test-Path $BinarySrc)) {
|
|
196
187
|
Write-Host " [ERROR] Binary not found in tarball: $BinarySrc" -ForegroundColor Red
|
|
197
188
|
Remove-Item $TempExtract -Recurse -Force -ErrorAction SilentlyContinue
|
|
198
189
|
Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
199
|
-
|
|
190
|
+
return
|
|
200
191
|
}
|
|
201
192
|
|
|
202
193
|
Copy-Item $BinarySrc $BinaryDest -Force
|
|
@@ -206,7 +197,7 @@ Remove-Item $TempFile -Force -ErrorAction SilentlyContinue
|
|
|
206
197
|
Write-Host " [OK] Installation successful!" -ForegroundColor Green
|
|
207
198
|
Write-Host ""
|
|
208
199
|
|
|
209
|
-
#
|
|
200
|
+
# 6. PATH
|
|
210
201
|
$UserPath = [Environment]::GetEnvironmentVariable("Path", "User")
|
|
211
202
|
if (-not $UserPath) {
|
|
212
203
|
[Environment]::SetEnvironmentVariable("Path", $InstallDir, "User")
|
|
@@ -218,9 +209,9 @@ if (-not $UserPath) {
|
|
|
218
209
|
Write-Host ""
|
|
219
210
|
}
|
|
220
211
|
|
|
221
|
-
#
|
|
212
|
+
# 7. Verify binary and launch
|
|
222
213
|
try {
|
|
223
|
-
$null = & $BinaryDest --version 2
|
|
214
|
+
$null = & $BinaryDest --version 2>$null
|
|
224
215
|
Write-Host " Launching install-helper..." -ForegroundColor Cyan
|
|
225
216
|
Write-Host ""
|
|
226
217
|
& $BinaryDest
|
|
@@ -2,8 +2,8 @@ id: ops-direct-invoke
|
|
|
2
2
|
dir: plugins-official/ops-direct-invoke
|
|
3
3
|
displayName: AscendC Kernel 直调
|
|
4
4
|
aliases: [ops-direct, ascendc-direct, direct, kernel]
|
|
5
|
-
skills:
|
|
6
|
-
agents:
|
|
5
|
+
skills: 19
|
|
6
|
+
agents: 4
|
|
7
7
|
description: Ascend C 直调全流程:环境→设计→开发→审查→性能验收
|
|
8
8
|
version: "1.2.2"
|
|
9
9
|
configFile: AGENTS.md
|
|
@@ -2,8 +2,8 @@ id: ops-registry-invoke
|
|
|
2
2
|
dir: plugins-official/ops-registry-invoke
|
|
3
3
|
displayName: AscendC 算子注册调用
|
|
4
4
|
aliases: [ops-registry, ascendc-registry, registry]
|
|
5
|
-
skills:
|
|
6
|
-
agents:
|
|
5
|
+
skills: 26
|
|
6
|
+
agents: 3
|
|
7
7
|
description: 生产级 ACLNN 注册算子全流程:代码→UT/ST→上库
|
|
8
8
|
version: "1.2.2"
|
|
9
9
|
configFile: AGENTS.md
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cannbot-ai/install-helper",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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": "1.1.
|
|
46
|
-
"@cannbot-ai/install-helper-linux-arm64": "1.1.
|
|
47
|
-
"@cannbot-ai/install-helper-darwin-x64": "1.1.
|
|
48
|
-
"@cannbot-ai/install-helper-darwin-arm64": "1.1.
|
|
49
|
-
"@cannbot-ai/install-helper-windows-x64": "1.1.
|
|
45
|
+
"@cannbot-ai/install-helper-linux-x64": "1.1.3",
|
|
46
|
+
"@cannbot-ai/install-helper-linux-arm64": "1.1.3",
|
|
47
|
+
"@cannbot-ai/install-helper-darwin-x64": "1.1.3",
|
|
48
|
+
"@cannbot-ai/install-helper-darwin-arm64": "1.1.3",
|
|
49
|
+
"@cannbot-ai/install-helper-windows-x64": "1.1.3"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.0.0",
|