@cannbot-ai/install-helper 0.0.2-beta.76 → 0.0.2-beta.78

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,6 +13,10 @@ 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
+
16
20
  # Auto-fix ExecutionPolicy for npm global tools (.ps1)
17
21
  $execPolicy = Get-ExecutionPolicy -Scope CurrentUser
18
22
  if ($execPolicy -eq "Restricted") {
@@ -32,18 +36,6 @@ trap {
32
36
  return
33
37
  }
34
38
 
35
- function Compare-SemVer($a, $b) {
36
- $aParts = $a -split '-',2
37
- $bParts = $b -split '-',2
38
- try { $aVer = [version]$aParts[0] } catch { return $false }
39
- try { $bVer = [version]$bParts[0] } catch { return $false }
40
- if ($aVer -ne $bVer) { return $aVer -gt $bVer }
41
- if ($aParts.Length -eq 1 -and $bParts.Length -eq 1) { return $false }
42
- if ($aParts.Length -eq 1) { return $true }
43
- if ($bParts.Length -eq 1) { return $false }
44
- return "$($aParts[1])" -gt "$($bParts[1])"
45
- }
46
-
47
39
  Write-Host ""
48
40
  Write-Host " ____ _ _ _ _ _ ____ _ " -ForegroundColor Cyan
49
41
  Write-Host " / ___| / \ | \ | | \ | | __ ) ___ | |_ " -ForegroundColor Cyan
@@ -62,8 +54,8 @@ $BinaryName = "install-helper.exe"
62
54
  Write-Host " [OK] Platform: windows-$Arch" -ForegroundColor Green
63
55
  Write-Host ""
64
56
 
65
- # 2. Query latest version from npm registry
66
- Write-Host " Querying latest version..." -ForegroundColor Cyan
57
+ # 2. Query version from npm registry (channel-specific)
58
+ Write-Host " Querying version ($Channel)..." -ForegroundColor Cyan
67
59
 
68
60
  $Mirrors = @(
69
61
  "https://registry.npmjs.org",
@@ -73,25 +65,27 @@ $Mirrors = @(
73
65
  $Version = $null
74
66
  $Registry = $null
75
67
  $Errors = @()
76
- foreach ($url in $Mirrors) {
77
- foreach ($tag in @("beta", "latest")) {
68
+
69
+ if ($Channel -eq "latest" -or $Channel -eq "beta") {
70
+ foreach ($url in $Mirrors) {
78
71
  try {
79
- $resp = Invoke-RestMethod "$url/$SubPkgName/$tag" -TimeoutSec 15
72
+ $resp = Invoke-RestMethod "$url/$SubPkgName/$Channel" -TimeoutSec 15
80
73
  if ($resp.version) {
81
- if (-not $Version) {
82
- $Version = $resp.version
83
- $Registry = $url
84
- } elseif (Compare-SemVer $resp.version $Version) {
85
- $Version = $resp.version
86
- $Registry = $url
87
- }
74
+ $Version = $resp.version
75
+ $Registry = $url
88
76
  }
89
77
  } catch { $Errors += $_ }
78
+ if ($Version) {
79
+ break
80
+ }
90
81
  }
91
- if ($Version) {
92
- Write-Host " [OK] Version: $Version (from $Registry)" -ForegroundColor Green
93
- break
94
- }
82
+ } else {
83
+ $Version = $Channel
84
+ $Registry = $Mirrors[0]
85
+ }
86
+
87
+ if ($Version) {
88
+ Write-Host " [OK] Version: $Version ($Channel)" -ForegroundColor Green
95
89
  }
96
90
 
97
91
  if (-not $Version) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cannbot-ai/install-helper",
3
- "version": "0.0.2-beta.76",
3
+ "version": "0.0.2-beta.78",
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.76",
46
- "@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.76",
47
- "@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.76",
48
- "@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.76",
49
- "@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.76"
45
+ "@cannbot-ai/install-helper-linux-x64": "0.0.2-beta.78",
46
+ "@cannbot-ai/install-helper-linux-arm64": "0.0.2-beta.78",
47
+ "@cannbot-ai/install-helper-darwin-x64": "0.0.2-beta.78",
48
+ "@cannbot-ai/install-helper-darwin-arm64": "0.0.2-beta.78",
49
+ "@cannbot-ai/install-helper-windows-x64": "0.0.2-beta.78"
50
50
  },
51
51
  "devDependencies": {
52
52
  "@types/node": "^22.0.0",