@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/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
- function Compare-SemVer($a, $b) {
20
- $aParts = $a -split '-',2
21
- $bParts = $b -split '-',2
22
- try { $aVer = [version]$aParts[0] } catch { return $false }
23
- try { $bVer = [version]$bParts[0] } catch { return $false }
24
- if ($aVer -ne $bVer) { return $aVer -gt $bVer }
25
- if ($aParts.Length -eq 1 -and $bParts.Length -eq 1) { return $false }
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. 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
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 latest version from npm registry
96
- Write-Host " Querying latest version..." -ForegroundColor Cyan
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
- foreach ($url in $Mirrors) {
107
- foreach ($tag in @("beta", "latest")) {
68
+
69
+ if ($Channel -eq "latest" -or $Channel -eq "beta") {
70
+ foreach ($url in $Mirrors) {
108
71
  try {
109
- $resp = Invoke-RestMethod "$url/$SubPkgName/$tag" -TimeoutSec 15
72
+ $resp = Invoke-RestMethod "$url/$SubPkgName/$Channel" -TimeoutSec 15
110
73
  if ($resp.version) {
111
- if (-not $Version) {
112
- $Version = $resp.version
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
- if ($Version) {
122
- Write-Host " [OK] Version: $Version (from $Registry)" -ForegroundColor Green
123
- break
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
- exit 1
102
+ return
139
103
  }
140
104
 
141
- # 3. Download tarball (with mirror fallback)
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
- exit 1
162
+ return
171
163
  }
172
164
 
173
- # 4. Extract
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>&1 | Out-Null
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
- exit 1
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
- exit 1
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
- # 5. PATH
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
- # 6. Verify binary and launch
212
+ # 7. Verify binary and launch
222
213
  try {
223
- $null = & $BinaryDest --version 2>&1
214
+ $null = & $BinaryDest --version 2>$null
224
215
  Write-Host " Launching install-helper..." -ForegroundColor Cyan
225
216
  Write-Host ""
226
217
  & $BinaryDest
@@ -2,7 +2,7 @@ id: catlass-op-generator
2
2
  dir: plugins-official/catlass-op-generator
3
3
  displayName: Catlass 算子直调
4
4
  aliases: [catlass]
5
- skills: 10
5
+ skills: 14
6
6
  agents: 3
7
7
  description: Catlass 模板拼装 GEMM/Matmul/Epilogue 算子开发
8
8
  version: "1.2.2"
@@ -2,7 +2,7 @@ id: model-infer-optimize
2
2
  dir: plugins-official/model-infer-optimize
3
3
  displayName: NPU 推理优化
4
4
  aliases: [model-infer, infer, inference]
5
- skills: 11
5
+ skills: 12
6
6
  agents: 3
7
7
  description: NPU 模型推理端到端优化(并行/KVCache/融合/量化/图模式/多流/SuperKernel)
8
8
  version: "1.2.2"
@@ -3,7 +3,7 @@ dir: plugins-official/ops-code-reviewer
3
3
  displayName: 代码检视
4
4
  aliases: [code-review, reviewer, review]
5
5
  skills: 5
6
- agents: 1
6
+ agents: 2
7
7
  description: Ascend C 算子代码 4 阶段全量检视(主 Agent 编排 + 子 Agent 并行检视)
8
8
  version: "1.2.2"
9
9
  configFile: AGENTS.md
@@ -2,7 +2,7 @@ id: ops-direct-invoke-flash
2
2
  dir: plugins-official/ops-direct-invoke-flash
3
3
  displayName: AscendC Kernel 直调(快速版)
4
4
  aliases: [flash, kernel-flash]
5
- skills: 1
5
+ skills: 7
6
6
  agents: 1
7
7
  description: 从数学公式或代码片段快速构建并验证 Ascend NPU 核函数
8
8
  version: "1.2.2"
@@ -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: 16
6
- agents: 3
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: 12
6
- agents: 4
5
+ skills: 26
6
+ agents: 3
7
7
  description: 生产级 ACLNN 注册算子全流程:代码→UT/ST→上库
8
8
  version: "1.2.2"
9
9
  configFile: AGENTS.md
@@ -3,7 +3,7 @@ dir: plugins-official/triton-op-generator
3
3
  displayName: Triton 算子开发
4
4
  aliases: [triton]
5
5
  skills: 6
6
- agents: 1
6
+ agents: 0
7
7
  description: Triton-Ascend 算子 6 阶段自动生成与优化(描述→代码→验证→优化)
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.2",
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.2",
46
- "@cannbot-ai/install-helper-linux-arm64": "1.1.2",
47
- "@cannbot-ai/install-helper-darwin-x64": "1.1.2",
48
- "@cannbot-ai/install-helper-darwin-arm64": "1.1.2",
49
- "@cannbot-ai/install-helper-windows-x64": "1.1.2"
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",