@ziniao-open/cli 0.1.0-beta.82 → 0.1.0-beta.89

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ziniao-open/cli",
3
- "version": "0.1.0-beta.82",
3
+ "version": "0.1.0-beta.89",
4
4
  "description": "紫鸟开放平台命令行工具,为开发者和 AI Agent 提供统一的接口调用入口。",
5
5
  "license": "UNLICENSED",
6
6
  "bin": {
@@ -18,7 +18,7 @@ switch ($arch.ToLowerInvariant()) {
18
18
  "amd64" { $archDir = "x64" }
19
19
  "x86_64" { $archDir = "x64" }
20
20
  "arm64" { $archDir = "arm64" }
21
- default { throw "不支持的 CPU 架构: $arch" }
21
+ default { throw "Unsupported CPU architecture: $arch" }
22
22
  }
23
23
 
24
24
  $sourceName = "ziniao.exe"
@@ -52,25 +52,19 @@ if (-not $sourcePath) {
52
52
  }
53
53
  }
54
54
  if ($env:ZINIAO_APP_CACHE_DIR) {
55
- $appCacheDir = $env:ZINIAO_APP_CACHE_DIR
55
+ $targetDir = Join-Path $env:ZINIAO_APP_CACHE_DIR "cli"
56
56
  } else {
57
- $appCacheDir = Get-FirstExistingDirectory @(
58
- (Join-Path $env:APPDATA "ziniao"),
59
- (Join-Path $env:LOCALAPPDATA "ziniao")
60
- )
61
- if (-not $appCacheDir) { $appCacheDir = Join-Path $env:APPDATA "ziniao" }
62
- $appCacheDir = Join-Path $appCacheDir "app-cache"
57
+ $targetDir = Join-Path $env:APPDATA "ziniaobrowser\cli"
63
58
  }
64
59
 
65
- $targetDir = Join-Path $appCacheDir "cli"
66
60
  $targetPath = Join-Path $targetDir $sourceName
67
61
  New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
68
62
 
69
63
  if (-not $sourcePath) {
70
64
  if (Test-Path -LiteralPath $targetPath -PathType Leaf) {
71
- Write-Log "未找到安装目录中的 CLI 源文件,保留现有 AppCache CLI: $targetPath"
65
+ Write-Log "Desktop CLI source not found; keeping existing AppCache CLI: $targetPath"
72
66
  } else {
73
- Write-Log "WARN: 未找到安装目录中的 ${sourceName},跳过复制;可设置 `$env:ZINIAO_INSTALL_DIR `$env:ZINIAO_CLI_SOURCE"
67
+ Write-Log "WARN: ${sourceName} was not found in the desktop installation; skipping copy. Set `$env:ZINIAO_INSTALL_DIR or `$env:ZINIAO_CLI_SOURCE."
74
68
  }
75
69
  } else {
76
70
  $needsCopy = -not (Test-Path -LiteralPath $targetPath -PathType Leaf)
@@ -79,9 +73,9 @@ if (-not $sourcePath) {
79
73
  }
80
74
  if ($needsCopy) {
81
75
  Copy-Item -LiteralPath $sourcePath -Destination $targetPath -Force
82
- Write-Log "已同步 CLI: $sourcePath -> $targetPath"
76
+ Write-Log "Synchronized CLI: $sourcePath -> $targetPath"
83
77
  } else {
84
- Write-Log "AppCache CLI 已是最新: $targetPath"
78
+ Write-Log "AppCache CLI is already up to date: $targetPath"
85
79
  }
86
80
  }
87
81
 
@@ -90,7 +84,7 @@ function Install-PathShim {
90
84
  foreach ($pathEntry in @($env:Path -split ";" | Where-Object { $_ })) {
91
85
  if ($pathEntry.TrimEnd('\') -ieq $targetDir.TrimEnd('\')) {
92
86
  $script:shimInstalled = $true
93
- Write-Log "当前 PATH 已包含 AppCache CLI 目录: $targetDir"
87
+ Write-Log "Current PATH already contains the AppCache CLI directory: $targetDir"
94
88
  return
95
89
  }
96
90
  $shimPath = Join-Path $pathEntry $sourceName
@@ -98,13 +92,13 @@ function Install-PathShim {
98
92
  try {
99
93
  Copy-Item -LiteralPath $targetPath -Destination $shimPath -Force -ErrorAction Stop
100
94
  $script:shimInstalled = $true
101
- Write-Log "已在现有 PATH 中创建 CLI shim: $shimPath"
95
+ Write-Log "Created a CLI shim in an existing PATH directory: $shimPath"
102
96
  return
103
97
  } catch {
104
98
  continue
105
99
  }
106
100
  }
107
- Write-Log "WARN: 没有可写的现有 PATH 目录,无法立即提供 ziniao 命令。"
101
+ Write-Log "WARN: No writable existing PATH directory was found; the ziniao command is not immediately available."
108
102
  }
109
103
 
110
104
  $shimInstalled = $false
@@ -114,7 +108,7 @@ $userPath = [Environment]::GetEnvironmentVariable("Path", "User")
114
108
  $entries = @($userPath -split ";" | Where-Object { $_ })
115
109
  if (-not ($entries | Where-Object { $_.TrimEnd('\') -ieq $targetDir.TrimEnd('\') })) {
116
110
  [Environment]::SetEnvironmentVariable("Path", (($entries + $targetDir) -join ";"), "User")
117
- Write-Log "已写入用户 PATH: $targetDir"
111
+ Write-Log "Added to the user PATH: $targetDir"
118
112
  }
119
113
 
120
114
  $currentEntries = @($env:Path -split ";" | Where-Object { $_ })
@@ -122,10 +116,10 @@ if (-not ($currentEntries | Where-Object { $_.TrimEnd('\') -ieq $targetDir.TrimE
122
116
  $env:Path = "$targetDir;$env:Path"
123
117
  }
124
118
  if ($shimInstalled) {
125
- Write-Log "CLI 已位于当前 PATH,当前 PowerShell 无需刷新 PATH"
119
+ Write-Log "CLI is already available through the current PATH; no PowerShell refresh is required."
126
120
  } elseif ($isDotSourced) {
127
- Write-Log "当前 PowerShell PATH 已刷新"
121
+ Write-Log "Refreshed the current PowerShell PATH."
128
122
  } else {
129
- Write-Log "当前进程 PATH 已刷新;父级 PowerShell 请执行 dot-source 或重新打开 terminal"
123
+ Write-Log "Refreshed this process PATH; dot-source the script or open a new terminal to refresh the parent PowerShell."
130
124
  }
131
- Write-Log "验证命令: Get-Command ziniao"
125
+ Write-Log "Verify with: Get-Command ziniao"