siluzan-tso-cli 1.1.11-beta.2 → 1.1.11-beta.4

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 CHANGED
@@ -49,7 +49,7 @@ siluzan-tso init -d /path/to/skills # 写入自定义目录
49
49
  siluzan-tso init --force # 强制覆盖已存在文件
50
50
  ```
51
51
 
52
- > **注意**:当前为测试版(1.1.11-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
52
+ > **注意**:当前为测试版(1.1.11-beta.4),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-tso-cli`。
53
53
 
54
54
  | 助手 | 建议 `--ai` |
55
55
  |------|-------------|
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "slug": "siluzan-tso",
3
- "version": "1.1.11-beta.2",
4
- "publishedAt": 1776308245270
3
+ "version": "1.1.11-beta.4",
4
+ "publishedAt": 1776318287754
5
5
  }
@@ -1,4 +1,4 @@
1
- #Requires -Version 5.1
1
+ #Requires -Version 5.1
2
2
  # =============================================================================
3
3
  # siluzan-tso-cli - One-click install script (PowerShell)
4
4
  # Supported: Windows 10/11 (PowerShell 5.1+ or PowerShell 7+)
@@ -7,13 +7,11 @@
7
7
  $ErrorActionPreference = 'Stop'
8
8
 
9
9
  # -- Package info (injected at build time) ------------------------------------
10
- $PKG_NAME = 'siluzan-tso-cli'
11
- $CLI_BIN = 'siluzan-tso'
12
- $SKILL_LABEL = 'Siluzan TSO'
13
- $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
14
- $PERMISSION_HINT = 'Assets + TSO (Ad Management)'
15
- $WEB_BASE = 'https://www-ci.siluzan.com'
16
- $API_KEY_URL = "$WEB_BASE/v3/foreign_trade/settings/apiKeyManagement"
10
+ $PKG_NAME = 'siluzan-tso-cli'
11
+ $CLI_BIN = 'siluzan-tso'
12
+ $SKILL_LABEL = 'Siluzan TSO'
13
+ $INSTALL_CMD = 'npm install -g siluzan-tso-cli@beta'
14
+ $WEB_BASE = 'https://www-ci.siluzan.com'
17
15
 
18
16
  # -- Constants ----------------------------------------------------------------
19
17
  $NODE_MAJOR_MIN = 18
@@ -25,12 +23,6 @@ function Write-Warn { param([string]$Msg) Write-Host "[!] $Msg" -ForegroundCol
25
23
  function Write-Err { param([string]$Msg) Write-Host "[X] $Msg" -ForegroundColor Red }
26
24
  function Write-Step { param([string]$Msg) Write-Host "`n-- $Msg --" -ForegroundColor White }
27
25
 
28
- function Read-Input {
29
- param([string]$Prompt)
30
- Write-Host $Prompt -NoNewline
31
- return [Console]::ReadLine()
32
- }
33
-
34
26
  function Refresh-Path {
35
27
  $machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
36
28
  $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
@@ -141,43 +133,19 @@ function Main {
141
133
  Write-Step "Step 2/4: Install $PKG_NAME"
142
134
 
143
135
  Write-Info "Running: $INSTALL_CMD"
144
- Invoke-Expression $INSTALL_CMD
136
+ $installParts = $INSTALL_CMD -split ' '
137
+ $installArgs = $installParts[1..($installParts.Length - 1)]
138
+ & $installParts[0] @installArgs
145
139
  if ($LASTEXITCODE -ne 0) { Write-Err "$INSTALL_CMD failed"; return }
146
140
  Write-Info "$PKG_NAME installed"
147
141
 
148
142
  Write-Info 'Registering Skill to all AI platform global directories...'
149
- Invoke-Expression "$CLI_BIN init --global --force"
143
+ & $CLI_BIN init --global --force
150
144
 
151
145
  # Step 3: Configure API Key
152
146
  Write-Step 'Step 3/4: Configure API Key'
153
147
  Write-Host ''
154
- Write-Host ' Opening the API Key management page. In your browser:'
155
- Write-Host ' 1. Sign up / Log in to your Siluzan account'
156
- Write-Host " 2. Click 'Create API Key'"
157
- Write-Host " 3. Select permissions: $PERMISSION_HINT"
158
- Write-Host ' 4. Copy the generated API Key'
159
- Write-Host ''
160
-
161
- try {
162
- Start-Process $API_KEY_URL
163
- Write-Info 'API Key management page opened in browser'
164
- } catch {
165
- Write-Warn 'Could not open browser automatically. Please visit:'
166
- Write-Host " $API_KEY_URL" -ForegroundColor Cyan
167
- }
168
-
169
- Write-Host ''
170
- $apiKey = Read-Input ' Paste API Key (press Enter to skip): '
171
-
172
- if (-not [string]::IsNullOrWhiteSpace($apiKey)) {
173
- Invoke-Expression "$CLI_BIN login --api-key $apiKey"
174
- Write-Info 'API Key saved to ~/.siluzan/config.json'
175
- } else {
176
- Write-Host ''
177
- Write-Warn 'API Key configuration skipped. You can set it later:'
178
- Write-Host " Option 1: $CLI_BIN login --api-key YOUR_API_KEY"
179
- Write-Host ' Option 2: $env:SILUZAN_API_KEY = ''YOUR_API_KEY'''
180
- }
148
+ & $CLI_BIN login
181
149
 
182
150
  # Step 4: Done
183
151
  Write-Step 'Step 4/4: Complete'
@@ -11,16 +11,14 @@ readonly PKG_NAME="siluzan-tso-cli"
11
11
  readonly CLI_BIN="siluzan-tso"
12
12
  readonly SKILL_LABEL="Siluzan TSO"
13
13
  readonly INSTALL_CMD="npm install -g siluzan-tso-cli@beta"
14
- readonly PERMISSION_HINT="Assets + TSO (Ad Management)"
15
14
  readonly WEB_BASE="https://www-ci.siluzan.com"
16
- readonly API_KEY_URL="${WEB_BASE}/v3/foreign_trade/settings/apiKeyManagement"
17
15
 
18
16
  # -- Constants ----------------------------------------------------------------
19
17
  readonly NODE_MAJOR_MIN=18
20
18
  readonly NPM_MIRROR="https://registry.npmmirror.com"
21
19
 
22
20
  RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
23
- CYAN='\033[0;36m'; BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
21
+ BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
24
22
 
25
23
  info() { printf "${GREEN}[OK]${NC} %s\n" "$1"; }
26
24
  warn() { printf "${YELLOW}[!]${NC} %s\n" "$1"; }
@@ -39,18 +37,6 @@ detect_os() {
39
37
  esac
40
38
  }
41
39
 
42
- # -- Open URL in browser ------------------------------------------------------
43
- open_url() {
44
- local url="$1" os_type
45
- os_type=$(detect_os)
46
- case "$os_type" in
47
- macos) open "$url" 2>/dev/null && return 0 ;;
48
- linux) xdg-open "$url" 2>/dev/null && return 0 ;;
49
- gitbash) start "$url" 2>/dev/null && return 0 ;;
50
- esac
51
- return 1
52
- }
53
-
54
40
  # -- Node.js ------------------------------------------------------------------
55
41
  node_version_ok() {
56
42
  command -v node >/dev/null 2>&1 || return 1
@@ -165,34 +151,7 @@ main() {
165
151
  # Step 3: Configure API Key
166
152
  step "Step 3/4: Configure API Key"
167
153
  echo ""
168
- echo " Opening the API Key management page. In your browser:"
169
- echo " 1. Sign up / Log in to your Siluzan account"
170
- echo " 2. Click 'Create API Key'"
171
- echo " 3. Select permissions: ${PERMISSION_HINT}"
172
- echo " 4. Copy the generated API Key"
173
- echo ""
174
-
175
- if ! open_url "$API_KEY_URL"; then
176
- warn "Could not open browser automatically. Please visit:"
177
- echo -e " ${CYAN}${API_KEY_URL}${NC}"
178
- else
179
- info "API Key management page opened in browser"
180
- fi
181
-
182
- echo ""
183
- printf " Paste API Key (press Enter to skip): "
184
- local api_key=""
185
- read -r api_key < /dev/tty 2>/dev/null || read -r api_key
186
-
187
- if [ -n "$api_key" ]; then
188
- ${CLI_BIN} login --api-key "$api_key"
189
- info "API Key saved to ~/.siluzan/config.json"
190
- else
191
- echo ""
192
- warn "API Key configuration skipped. You can set it later:"
193
- echo " Option 1: ${CLI_BIN} login --api-key YOUR_API_KEY"
194
- echo " Option 2: export SILUZAN_API_KEY=YOUR_API_KEY"
195
- fi
154
+ ${CLI_BIN} login
196
155
 
197
156
  # Step 4: Done
198
157
  step "Step 4/4: Complete"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-tso-cli",
3
- "version": "1.1.11-beta.2",
3
+ "version": "1.1.11-beta.4",
4
4
  "description": "Siluzan 广告账户管理 CLI — 查询账户、余额、消耗数据,管理绑定关系与充值。",
5
5
  "type": "module",
6
6
  "bin": {