siluzan-cso-cli 1.1.9-beta.3 → 1.1.11-beta.2

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
@@ -50,7 +50,7 @@ siluzan-cso init -d /path/to/skills # 写入自定义目录
50
50
  siluzan-cso init --force # 强制覆盖已存在文件
51
51
  ```
52
52
 
53
- > **注意**:当前为测试版(1.1.9-beta.3),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
53
+ > **注意**:当前为测试版(1.1.11-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
54
54
 
55
55
  | 助手 | 建议 `--ai` |
56
56
  |------|-------------|
@@ -9,6 +9,14 @@ compatibility: Requires siluzan-cso-cli installed and authenticated via `siluzan
9
9
 
10
10
  # siluzan-cso
11
11
 
12
+ ## 一键安装
13
+
14
+ 如果 CLI 尚未安装,直接帮用户执行对应平台的安装脚本:
15
+
16
+ - **macOS / Linux / WSL:** `bash scripts/install.sh`
17
+ - **Windows PowerShell:** `powershell -ExecutionPolicy Bypass -File scripts/install.ps1`
18
+
19
+ 脚本会自动完成 Node.js 检测/安装、CLI 安装、Skill 全局注册,并引导用户配置 API Key。无需选择,本脚本专为 siluzan-cso-cli 定制。
12
20
 
13
21
  ---
14
22
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "siluzan-cso",
3
- "version": "1.1.9-beta.3",
4
- "publishedAt": 1776246656610,
3
+ "version": "1.1.11-beta.2",
4
+ "publishedAt": 1776308196940,
5
5
  "homepage": "https://www.siluzan.com",
6
6
  "source": "https://dev.azure.com/jack4it/Sammamish/_git/siluzan-skill",
7
7
  "requiredBinaries": [
@@ -0,0 +1,199 @@
1
+ #Requires -Version 5.1
2
+ # =============================================================================
3
+ # siluzan-cso-cli - One-click install script (PowerShell)
4
+ # Supported: Windows 10/11 (PowerShell 5.1+ or PowerShell 7+)
5
+ # =============================================================================
6
+
7
+ $ErrorActionPreference = 'Stop'
8
+
9
+ # -- Package info (injected at build time) ------------------------------------
10
+ $PKG_NAME = 'siluzan-cso-cli'
11
+ $CLI_BIN = 'siluzan-cso'
12
+ $SKILL_LABEL = 'Siluzan CSO'
13
+ $INSTALL_CMD = 'npm install -g siluzan-cso-cli@beta'
14
+ $PERMISSION_HINT = 'Assets + CSO (Content Publishing)'
15
+ $WEB_BASE = 'https://www-ci.siluzan.com'
16
+ $API_KEY_URL = "$WEB_BASE/v3/foreign_trade/settings/apiKeyManagement"
17
+
18
+ # -- Constants ----------------------------------------------------------------
19
+ $NODE_MAJOR_MIN = 18
20
+ $NPM_MIRROR = 'https://registry.npmmirror.com'
21
+
22
+ # -- Helpers ------------------------------------------------------------------
23
+ function Write-Info { param([string]$Msg) Write-Host "[OK] $Msg" -ForegroundColor Green }
24
+ function Write-Warn { param([string]$Msg) Write-Host "[!] $Msg" -ForegroundColor Yellow }
25
+ function Write-Err { param([string]$Msg) Write-Host "[X] $Msg" -ForegroundColor Red }
26
+ function Write-Step { param([string]$Msg) Write-Host "`n-- $Msg --" -ForegroundColor White }
27
+
28
+ function Read-Input {
29
+ param([string]$Prompt)
30
+ Write-Host $Prompt -NoNewline
31
+ return [Console]::ReadLine()
32
+ }
33
+
34
+ function Refresh-Path {
35
+ $machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
36
+ $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
37
+ $env:Path = "$machinePath;$userPath"
38
+ }
39
+
40
+ # -- Node.js ------------------------------------------------------------------
41
+ function Test-NodeVersion {
42
+ try {
43
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
44
+ if (-not $nodeCmd) { return $false }
45
+ $ver = (node -v) -replace '^v', ''
46
+ $major = [int]($ver.Split('.')[0])
47
+ return $major -ge $NODE_MAJOR_MIN
48
+ } catch {
49
+ return $false
50
+ }
51
+ }
52
+
53
+ function Get-NodeVersionString {
54
+ try { return (node -v) } catch { return 'N/A' }
55
+ }
56
+
57
+ function Install-NodeJS {
58
+ $hasWinget = $null -ne (Get-Command winget -ErrorAction SilentlyContinue)
59
+ if ($hasWinget) {
60
+ Write-Info 'Installing Node.js LTS via winget...'
61
+ winget install -e --id OpenJS.NodeJS.LTS --silent --accept-package-agreements --accept-source-agreements
62
+ if ($LASTEXITCODE -ne 0) {
63
+ Write-Warn 'winget returned non-zero, trying fallback...'
64
+ Install-NodeFallback
65
+ return
66
+ }
67
+ } else {
68
+ Install-NodeFallback
69
+ return
70
+ }
71
+ Refresh-Path
72
+ if (-not (Test-NodeVersion)) {
73
+ Write-Warn 'Node.js not found after PATH refresh, locating install dir...'
74
+ $nodePath = "$env:ProgramFiles\nodejs"
75
+ if (Test-Path "$nodePath\node.exe") {
76
+ $env:Path = "$nodePath;$env:Path"
77
+ }
78
+ }
79
+ }
80
+
81
+ function Install-NodeFallback {
82
+ Write-Err 'Cannot auto-install Node.js'
83
+ Write-Host ''
84
+ Write-Host ' Please install Node.js manually:' -ForegroundColor Cyan
85
+ Write-Host ' https://nodejs.org/en/download/'
86
+ Write-Host ''
87
+ Write-Host ' After installation, reopen PowerShell and run this script again.'
88
+ throw 'Node.js is required'
89
+ }
90
+
91
+ # -- Main ---------------------------------------------------------------------
92
+ function Main {
93
+ Write-Host ''
94
+ Write-Host '+---------------------------------------------+' -ForegroundColor White
95
+ Write-Host "| $SKILL_LABEL -- Install |" -ForegroundColor White
96
+ Write-Host '+---------------------------------------------+' -ForegroundColor White
97
+ Write-Host ''
98
+
99
+ # Step 1: Environment check
100
+ Write-Step 'Step 1/4: Environment check'
101
+
102
+ if (Test-NodeVersion) {
103
+ Write-Info "Node.js $(Get-NodeVersionString) found"
104
+ } else {
105
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
106
+ if ($nodeCmd) {
107
+ Write-Warn "Node.js $(Get-NodeVersionString) is too old (need >= $NODE_MAJOR_MIN), upgrading..."
108
+ } else {
109
+ Write-Warn 'Node.js not found, installing...'
110
+ }
111
+ Install-NodeJS
112
+ if (-not (Test-NodeVersion)) {
113
+ Write-Err 'Node.js installation failed. Please install manually: https://nodejs.org/'
114
+ return
115
+ }
116
+ Write-Info "Node.js $(Get-NodeVersionString) installed"
117
+ }
118
+
119
+ $npmCmd = Get-Command npm -ErrorAction SilentlyContinue
120
+ if (-not $npmCmd) {
121
+ Refresh-Path
122
+ $npmCmd = Get-Command npm -ErrorAction SilentlyContinue
123
+ }
124
+ if (-not $npmCmd) {
125
+ Write-Err 'npm not found (Node.js installation may be incomplete)'
126
+ return
127
+ }
128
+ Write-Info 'npm ready'
129
+
130
+ $currentRegistry = ''
131
+ try { $currentRegistry = (npm config get registry 2>$null).Trim() } catch {}
132
+ if ($currentRegistry -ne $NPM_MIRROR -and $currentRegistry -ne "$NPM_MIRROR/") {
133
+ Write-Info 'Switching npm registry to China mirror for faster downloads...'
134
+ npm config set registry $NPM_MIRROR
135
+ Write-Info "npm registry set to $NPM_MIRROR"
136
+ } else {
137
+ Write-Info 'npm registry already set to China mirror'
138
+ }
139
+
140
+ # Step 2: Install CLI
141
+ Write-Step "Step 2/4: Install $PKG_NAME"
142
+
143
+ Write-Info "Running: $INSTALL_CMD"
144
+ Invoke-Expression $INSTALL_CMD
145
+ if ($LASTEXITCODE -ne 0) { Write-Err "$INSTALL_CMD failed"; return }
146
+ Write-Info "$PKG_NAME installed"
147
+
148
+ Write-Info 'Registering Skill to all AI platform global directories...'
149
+ Invoke-Expression "$CLI_BIN init --global --force"
150
+
151
+ # Step 3: Configure API Key
152
+ Write-Step 'Step 3/4: Configure API Key'
153
+ 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
+ }
181
+
182
+ # Step 4: Done
183
+ Write-Step 'Step 4/4: Complete'
184
+ Write-Host ''
185
+ Write-Host " $SKILL_LABEL installed successfully!" -ForegroundColor Green
186
+ Write-Host ''
187
+ Write-Host ' Skill registered to these global directories (all AI assistants):'
188
+ Write-Host ' ~/.cursor/skills/ ~/.claude/skills/ ~/.agents/skills/' -ForegroundColor DarkGray
189
+ Write-Host ' ~/.gemini/skills/ ~/.codex/skills/ ~/.kilo/skills/' -ForegroundColor DarkGray
190
+ Write-Host ' ~/.codeium/windsurf/skills/ ~/.config/opencode/skills/' -ForegroundColor DarkGray
191
+ Write-Host ' ~/.openclaw/skills/ ~/.workbuddy/skills/' -ForegroundColor DarkGray
192
+ Write-Host ''
193
+ Write-Host " Update CLI & Skill files: $CLI_BIN update"
194
+ Write-Host ''
195
+ Write-Info "Need help? Visit $WEB_BASE"
196
+ Write-Host ''
197
+ }
198
+
199
+ Main
@@ -0,0 +1,214 @@
1
+ #!/usr/bin/env bash
2
+ # =============================================================================
3
+ # siluzan-cso-cli - One-click install script
4
+ # Supported: macOS, Linux, Windows (WSL)
5
+ # =============================================================================
6
+
7
+ set -euo pipefail
8
+
9
+ # -- Package info (injected at build time) ------------------------------------
10
+ readonly PKG_NAME="siluzan-cso-cli"
11
+ readonly CLI_BIN="siluzan-cso"
12
+ readonly SKILL_LABEL="Siluzan CSO"
13
+ readonly INSTALL_CMD="npm install -g siluzan-cso-cli@beta"
14
+ readonly PERMISSION_HINT="Assets + CSO (Content Publishing)"
15
+ readonly WEB_BASE="https://www-ci.siluzan.com"
16
+ readonly API_KEY_URL="${WEB_BASE}/v3/foreign_trade/settings/apiKeyManagement"
17
+
18
+ # -- Constants ----------------------------------------------------------------
19
+ readonly NODE_MAJOR_MIN=18
20
+ readonly NPM_MIRROR="https://registry.npmmirror.com"
21
+
22
+ 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'
24
+
25
+ info() { printf "${GREEN}[OK]${NC} %s\n" "$1"; }
26
+ warn() { printf "${YELLOW}[!]${NC} %s\n" "$1"; }
27
+ error() { printf "${RED}[X]${NC} %s\n" "$1" >&2; }
28
+ step() { printf "\n${BOLD}-- %s --${NC}\n" "$1"; }
29
+
30
+ # -- Detect OS ----------------------------------------------------------------
31
+ detect_os() {
32
+ local uname_out
33
+ uname_out=$(uname -s 2>/dev/null || echo "Unknown")
34
+ case "$uname_out" in
35
+ Darwin*) echo "macos" ;;
36
+ Linux*) echo "linux" ;;
37
+ MINGW*|MSYS*|CYGWIN*) echo "gitbash" ;;
38
+ *) echo "unknown" ;;
39
+ esac
40
+ }
41
+
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
+ # -- Node.js ------------------------------------------------------------------
55
+ node_version_ok() {
56
+ command -v node >/dev/null 2>&1 || return 1
57
+ local major
58
+ major=$(node -v | tr -d 'v' | cut -d. -f1)
59
+ [ "$major" -ge "$NODE_MAJOR_MIN" ]
60
+ }
61
+
62
+ install_node() {
63
+ local os_type
64
+ os_type=$(detect_os)
65
+ case "$os_type" in
66
+ macos)
67
+ if command -v brew >/dev/null 2>&1; then
68
+ info "Installing Node.js LTS via Homebrew..."
69
+ brew install node@22
70
+ brew link --overwrite node@22 2>/dev/null || true
71
+ else
72
+ info "Installing Node.js LTS via install-node.vercel.app..."
73
+ curl -fsSL https://install-node.vercel.app/lts | bash -s -- --yes
74
+ fi
75
+ ;;
76
+ linux)
77
+ if command -v apt-get >/dev/null 2>&1; then
78
+ info "Installing Node.js 22.x via NodeSource (apt)..."
79
+ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
80
+ sudo apt-get install -y nodejs
81
+ elif command -v yum >/dev/null 2>&1; then
82
+ info "Installing Node.js 22.x via NodeSource (yum)..."
83
+ curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo -E bash -
84
+ sudo yum install -y nodejs
85
+ else
86
+ info "Installing Node.js LTS via install-node.vercel.app..."
87
+ curl -fsSL https://install-node.vercel.app/lts | bash -s -- --yes
88
+ fi
89
+ ;;
90
+ gitbash)
91
+ error "Cannot auto-install Node.js in Git Bash. Please use the PowerShell script or install manually."
92
+ echo " https://nodejs.org/en/download/"
93
+ exit 1
94
+ ;;
95
+ *)
96
+ error "Unsupported OS. Please install Node.js >= ${NODE_MAJOR_MIN} manually:"
97
+ echo " https://nodejs.org/en/download/"
98
+ exit 1
99
+ ;;
100
+ esac
101
+
102
+ export PATH="$HOME/.local/bin:$HOME/.nodejs/bin:/usr/local/bin:$PATH"
103
+ hash -r 2>/dev/null || true
104
+
105
+ if ! node_version_ok; then
106
+ error "Node.js installation failed. Please install manually:"
107
+ echo " https://nodejs.org/en/download/"
108
+ exit 1
109
+ fi
110
+ }
111
+
112
+ # -- Main ---------------------------------------------------------------------
113
+ main() {
114
+ echo ""
115
+ echo -e "${BOLD}+---------------------------------------------+${NC}"
116
+ echo -e "${BOLD}| ${SKILL_LABEL} -- Install |${NC}"
117
+ echo -e "${BOLD}+---------------------------------------------+${NC}"
118
+ echo ""
119
+
120
+ # Step 1: Environment check
121
+ step "Step 1/4: Environment check"
122
+
123
+ if node_version_ok; then
124
+ info "Node.js $(node -v) found"
125
+ else
126
+ if command -v node >/dev/null 2>&1; then
127
+ warn "Node.js $(node -v) is too old (need >= ${NODE_MAJOR_MIN}), upgrading..."
128
+ else
129
+ warn "Node.js not found, installing..."
130
+ fi
131
+ install_node
132
+ info "Node.js $(node -v) installed"
133
+ fi
134
+
135
+ if command -v pnpm >/dev/null 2>&1; then
136
+ PKG_MANAGER="pnpm"
137
+ elif command -v npm >/dev/null 2>&1; then
138
+ PKG_MANAGER="npm"
139
+ else
140
+ error "npm not found (Node.js installation may be incomplete)"
141
+ exit 1
142
+ fi
143
+ info "$PKG_MANAGER ready"
144
+
145
+ local current_registry
146
+ current_registry=$(npm config get registry 2>/dev/null || echo "")
147
+ if [ "$current_registry" != "$NPM_MIRROR" ] && [ "$current_registry" != "${NPM_MIRROR}/" ]; then
148
+ info "Switching npm registry to China mirror for faster downloads..."
149
+ npm config set registry "$NPM_MIRROR"
150
+ info "npm registry set to $NPM_MIRROR"
151
+ else
152
+ info "npm registry already set to China mirror"
153
+ fi
154
+
155
+ # Step 2: Install CLI
156
+ step "Step 2/4: Install ${PKG_NAME}"
157
+
158
+ info "Running: ${INSTALL_CMD}"
159
+ $PKG_MANAGER install -g ${PKG_NAME}$(echo "${INSTALL_CMD}" | grep -o '@[^ ]*' || true)
160
+ info "${PKG_NAME} installed"
161
+
162
+ info "Registering Skill to all AI platform global directories..."
163
+ ${CLI_BIN} init --global --force
164
+
165
+ # Step 3: Configure API Key
166
+ step "Step 3/4: Configure API Key"
167
+ 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
196
+
197
+ # Step 4: Done
198
+ step "Step 4/4: Complete"
199
+ echo ""
200
+ echo -e " ${GREEN}${SKILL_LABEL} installed successfully!${NC}"
201
+ echo ""
202
+ echo " Skill registered to these global directories (all AI assistants):"
203
+ echo -e " ${DIM}~/.cursor/skills/ ~/.claude/skills/ ~/.agents/skills/"
204
+ echo -e " ~/.gemini/skills/ ~/.codex/skills/ ~/.kilo/skills/"
205
+ echo -e " ~/.codeium/windsurf/skills/ ~/.config/opencode/skills/"
206
+ echo -e " ~/.openclaw/skills/ ~/.workbuddy/skills/${NC}"
207
+ echo ""
208
+ echo " Update CLI & Skill files: ${CLI_BIN} update"
209
+ echo ""
210
+ info "Need help? Visit ${WEB_BASE}"
211
+ echo ""
212
+ }
213
+
214
+ main "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-cso-cli",
3
- "version": "1.1.9-beta.3",
3
+ "version": "1.1.11-beta.2",
4
4
  "description": "Siluzan platform AI Skill CLI — multi-platform content publishing (video/image-text) for Cursor, Claude Code, and OpenClaw.",
5
5
  "type": "module",
6
6
  "bin": {