siluzan-cso-cli 1.1.12-beta.1 → 1.1.12-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.12-beta.1),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
53
+ > **注意**:当前为测试版(1.1.12-beta.2),供内部测试使用。正式发布后安装命令将改为 `npm install -g siluzan-cso-cli`。
54
54
 
55
55
  | 助手 | 建议 `--ai` |
56
56
  |------|-------------|
package/dist/index.js CHANGED
@@ -2539,10 +2539,16 @@ function readConfigRaw() {
2539
2539
  return {};
2540
2540
  }
2541
2541
  }
2542
- function writeConfigRaw(data) {
2542
+ function mergeWriteConfig(updates) {
2543
2543
  try {
2544
2544
  fs4.mkdirSync(path4.dirname(CONFIG_FILE2), { recursive: true });
2545
- fs4.writeFileSync(CONFIG_FILE2, JSON.stringify(data, null, 2), "utf8");
2545
+ let existing = {};
2546
+ try {
2547
+ existing = JSON.parse(fs4.readFileSync(CONFIG_FILE2, "utf8"));
2548
+ } catch {
2549
+ }
2550
+ Object.assign(existing, updates);
2551
+ fs4.writeFileSync(CONFIG_FILE2, JSON.stringify(existing, null, 2), "utf8");
2546
2552
  if (process.platform !== "win32") {
2547
2553
  fs4.chmodSync(CONFIG_FILE2, 384);
2548
2554
  }
@@ -2572,8 +2578,7 @@ async function notifyIfOutdated() {
2572
2578
  fetchVersionByTag(tag, latestCacheKey, cfg),
2573
2579
  fetchVersionByTag(minTag, minCacheKey, cfg)
2574
2580
  ]);
2575
- writeConfigRaw({
2576
- ...cfg,
2581
+ mergeWriteConfig({
2577
2582
  _csoLastVersionCheck: (/* @__PURE__ */ new Date()).toISOString(),
2578
2583
  [latestCacheKey]: latest ?? "",
2579
2584
  [minCacheKey]: minRequired ?? ""
@@ -2582,7 +2587,7 @@ async function notifyIfOutdated() {
2582
2587
  if (Date.now() - lastNotified < 24 * 60 * 60 * 1e3) return;
2583
2588
  const tagLabel = isBeta ? "\uFF08\u6D4B\u8BD5\u7248\uFF09" : "\uFF08\u6B63\u5F0F\u7248\uFF09";
2584
2589
  if (minRequired && isNewer(current, minRequired)) {
2585
- writeConfigRaw({ ...cfg, _csoLastNotified: (/* @__PURE__ */ new Date()).toISOString() });
2590
+ mergeWriteConfig({ _csoLastNotified: (/* @__PURE__ */ new Date()).toISOString() });
2586
2591
  console.log(
2587
2592
  `
2588
2593
  [SILUZAN_FORCE_UPDATE] \u5F53\u524D\u7248\u672C ${current} \u5DF2\u8FC7\u671F\uFF0C\u6700\u4F4E\u8981\u6C42\u7248\u672C ${minRequired}${tagLabel}
@@ -2593,7 +2598,7 @@ async function notifyIfOutdated() {
2593
2598
  return;
2594
2599
  }
2595
2600
  if (latest && isNewer(current, latest)) {
2596
- writeConfigRaw({ ...cfg, _csoLastNotified: (/* @__PURE__ */ new Date()).toISOString() });
2601
+ mergeWriteConfig({ _csoLastNotified: (/* @__PURE__ */ new Date()).toISOString() });
2597
2602
  console.log(
2598
2603
  `
2599
2604
  [SILUZAN_UPDATE_AVAILABLE] \u53D1\u73B0\u65B0\u7248\u672C ${latest}${tagLabel}\uFF08\u5F53\u524D ${current}\uFF09
@@ -10,8 +10,14 @@ compatibility: Requires siluzan-cso-cli installed and authenticated via `siluzan
10
10
 
11
11
  如果 CLI 尚未安装,直接帮用户执行对应平台的安装脚本:
12
12
 
13
- - **macOS / Linux / WSL:** `bash scripts/install.sh`
14
- - **Windows PowerShell:** `powershell -ExecutionPolicy Bypass -File scripts/install.ps1`
13
+ - **macOS / Linux / WSL:**
14
+ ```bash
15
+ bash <(curl -fsSL https://unpkg.com/siluzan-cso-cli@latest/dist/skill/scripts/install.sh)
16
+ ```
17
+ - **Windows PowerShell:**
18
+ ```powershell
19
+ irm https://unpkg.com/siluzan-cso-cli@latest/dist/skill/scripts/install.ps1 | iex
20
+ ```
15
21
 
16
22
  脚本会自动完成 Node.js 检测/安装、CLI 安装、Skill 全局注册,并引导用户配置 API Key。无需选择,本脚本专为 siluzan-cso-cli 定制。
17
23
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "slug": "siluzan-cso",
3
- "version": "1.1.12-beta.1",
4
- "publishedAt": 1776333768936,
3
+ "version": "1.1.12-beta.2",
4
+ "publishedAt": 1776410237594,
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,167 @@
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
+ $WEB_BASE = 'https://www-ci.siluzan.com'
15
+
16
+ # -- Constants ----------------------------------------------------------------
17
+ $NODE_MAJOR_MIN = 18
18
+ $NPM_MIRROR = 'https://registry.npmmirror.com'
19
+
20
+ # -- Helpers ------------------------------------------------------------------
21
+ function Write-Info { param([string]$Msg) Write-Host "[OK] $Msg" -ForegroundColor Green }
22
+ function Write-Warn { param([string]$Msg) Write-Host "[!] $Msg" -ForegroundColor Yellow }
23
+ function Write-Err { param([string]$Msg) Write-Host "[X] $Msg" -ForegroundColor Red }
24
+ function Write-Step { param([string]$Msg) Write-Host "`n-- $Msg --" -ForegroundColor White }
25
+
26
+ function Refresh-Path {
27
+ $machinePath = [Environment]::GetEnvironmentVariable('Path', 'Machine')
28
+ $userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
29
+ $env:Path = "$machinePath;$userPath"
30
+ }
31
+
32
+ # -- Node.js ------------------------------------------------------------------
33
+ function Test-NodeVersion {
34
+ try {
35
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
36
+ if (-not $nodeCmd) { return $false }
37
+ $ver = (node -v) -replace '^v', ''
38
+ $major = [int]($ver.Split('.')[0])
39
+ return $major -ge $NODE_MAJOR_MIN
40
+ } catch {
41
+ return $false
42
+ }
43
+ }
44
+
45
+ function Get-NodeVersionString {
46
+ try { return (node -v) } catch { return 'N/A' }
47
+ }
48
+
49
+ function Install-NodeJS {
50
+ $hasWinget = $null -ne (Get-Command winget -ErrorAction SilentlyContinue)
51
+ if ($hasWinget) {
52
+ Write-Info 'Installing Node.js LTS via winget...'
53
+ winget install -e --id OpenJS.NodeJS.LTS --silent --accept-package-agreements --accept-source-agreements
54
+ if ($LASTEXITCODE -ne 0) {
55
+ Write-Warn 'winget returned non-zero, trying fallback...'
56
+ Install-NodeFallback
57
+ return
58
+ }
59
+ } else {
60
+ Install-NodeFallback
61
+ return
62
+ }
63
+ Refresh-Path
64
+ if (-not (Test-NodeVersion)) {
65
+ Write-Warn 'Node.js not found after PATH refresh, locating install dir...'
66
+ $nodePath = "$env:ProgramFiles\nodejs"
67
+ if (Test-Path "$nodePath\node.exe") {
68
+ $env:Path = "$nodePath;$env:Path"
69
+ }
70
+ }
71
+ }
72
+
73
+ function Install-NodeFallback {
74
+ Write-Err 'Cannot auto-install Node.js'
75
+ Write-Host ''
76
+ Write-Host ' Please install Node.js manually:' -ForegroundColor Cyan
77
+ Write-Host ' https://nodejs.org/en/download/'
78
+ Write-Host ''
79
+ Write-Host ' After installation, reopen PowerShell and run this script again.'
80
+ throw 'Node.js is required'
81
+ }
82
+
83
+ # -- Main ---------------------------------------------------------------------
84
+ function Main {
85
+ Write-Host ''
86
+ Write-Host '+---------------------------------------------+' -ForegroundColor White
87
+ Write-Host "| $SKILL_LABEL -- Install |" -ForegroundColor White
88
+ Write-Host '+---------------------------------------------+' -ForegroundColor White
89
+ Write-Host ''
90
+
91
+ # Step 1: Environment check
92
+ Write-Step 'Step 1/4: Environment check'
93
+
94
+ if (Test-NodeVersion) {
95
+ Write-Info "Node.js $(Get-NodeVersionString) found"
96
+ } else {
97
+ $nodeCmd = Get-Command node -ErrorAction SilentlyContinue
98
+ if ($nodeCmd) {
99
+ Write-Warn "Node.js $(Get-NodeVersionString) is too old (need >= $NODE_MAJOR_MIN), upgrading..."
100
+ } else {
101
+ Write-Warn 'Node.js not found, installing...'
102
+ }
103
+ Install-NodeJS
104
+ if (-not (Test-NodeVersion)) {
105
+ Write-Err 'Node.js installation failed. Please install manually: https://nodejs.org/'
106
+ return
107
+ }
108
+ Write-Info "Node.js $(Get-NodeVersionString) installed"
109
+ }
110
+
111
+ $npmCmd = Get-Command npm -ErrorAction SilentlyContinue
112
+ if (-not $npmCmd) {
113
+ Refresh-Path
114
+ $npmCmd = Get-Command npm -ErrorAction SilentlyContinue
115
+ }
116
+ if (-not $npmCmd) {
117
+ Write-Err 'npm not found (Node.js installation may be incomplete)'
118
+ return
119
+ }
120
+ Write-Info 'npm ready'
121
+
122
+ $currentRegistry = ''
123
+ try { $currentRegistry = (npm config get registry 2>$null).Trim() } catch {}
124
+ if ($currentRegistry -ne $NPM_MIRROR -and $currentRegistry -ne "$NPM_MIRROR/") {
125
+ Write-Info 'Switching npm registry to China mirror for faster downloads...'
126
+ npm config set registry $NPM_MIRROR
127
+ Write-Info "npm registry set to $NPM_MIRROR"
128
+ } else {
129
+ Write-Info 'npm registry already set to China mirror'
130
+ }
131
+
132
+ # Step 2: Install CLI
133
+ Write-Step "Step 2/4: Install $PKG_NAME"
134
+
135
+ Write-Info "Running: $INSTALL_CMD"
136
+ $installParts = $INSTALL_CMD -split ' '
137
+ $installArgs = $installParts[1..($installParts.Length - 1)]
138
+ & $installParts[0] @installArgs
139
+ if ($LASTEXITCODE -ne 0) { Write-Err "$INSTALL_CMD failed"; return }
140
+ Write-Info "$PKG_NAME installed"
141
+
142
+ Write-Info 'Registering Skill to all AI platform global directories...'
143
+ & $CLI_BIN init --global --force
144
+
145
+ # Step 3: Configure API Key
146
+ Write-Step 'Step 3/4: Configure API Key'
147
+ Write-Host ''
148
+ & $CLI_BIN login
149
+
150
+ # Step 4: Done
151
+ Write-Step 'Step 4/4: Complete'
152
+ Write-Host ''
153
+ Write-Host " $SKILL_LABEL installed successfully!" -ForegroundColor Green
154
+ Write-Host ''
155
+ Write-Host ' Skill registered to these global directories (all AI assistants):'
156
+ Write-Host ' ~/.cursor/skills/ ~/.claude/skills/ ~/.agents/skills/' -ForegroundColor DarkGray
157
+ Write-Host ' ~/.gemini/skills/ ~/.codex/skills/ ~/.kilo/skills/' -ForegroundColor DarkGray
158
+ Write-Host ' ~/.codeium/windsurf/skills/ ~/.config/opencode/skills/' -ForegroundColor DarkGray
159
+ Write-Host ' ~/.openclaw/skills/ ~/.workbuddy/skills/' -ForegroundColor DarkGray
160
+ Write-Host ''
161
+ Write-Host " Update CLI & Skill files: $CLI_BIN update"
162
+ Write-Host ''
163
+ Write-Info "Need help? Visit $WEB_BASE"
164
+ Write-Host ''
165
+ }
166
+
167
+ Main
@@ -0,0 +1,173 @@
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 WEB_BASE="https://www-ci.siluzan.com"
15
+
16
+ # -- Constants ----------------------------------------------------------------
17
+ readonly NODE_MAJOR_MIN=18
18
+ readonly NPM_MIRROR="https://registry.npmmirror.com"
19
+
20
+ RED='\033[0;31m'; GREEN='\033[0;32m'; YELLOW='\033[1;33m'
21
+ BOLD='\033[1m'; DIM='\033[2m'; NC='\033[0m'
22
+
23
+ info() { printf "${GREEN}[OK]${NC} %s\n" "$1"; }
24
+ warn() { printf "${YELLOW}[!]${NC} %s\n" "$1"; }
25
+ error() { printf "${RED}[X]${NC} %s\n" "$1" >&2; }
26
+ step() { printf "\n${BOLD}-- %s --${NC}\n" "$1"; }
27
+
28
+ # -- Detect OS ----------------------------------------------------------------
29
+ detect_os() {
30
+ local uname_out
31
+ uname_out=$(uname -s 2>/dev/null || echo "Unknown")
32
+ case "$uname_out" in
33
+ Darwin*) echo "macos" ;;
34
+ Linux*) echo "linux" ;;
35
+ MINGW*|MSYS*|CYGWIN*) echo "gitbash" ;;
36
+ *) echo "unknown" ;;
37
+ esac
38
+ }
39
+
40
+ # -- Node.js ------------------------------------------------------------------
41
+ node_version_ok() {
42
+ command -v node >/dev/null 2>&1 || return 1
43
+ local major
44
+ major=$(node -v | tr -d 'v' | cut -d. -f1)
45
+ [ "$major" -ge "$NODE_MAJOR_MIN" ]
46
+ }
47
+
48
+ install_node() {
49
+ local os_type
50
+ os_type=$(detect_os)
51
+ case "$os_type" in
52
+ macos)
53
+ if command -v brew >/dev/null 2>&1; then
54
+ info "Installing Node.js LTS via Homebrew..."
55
+ brew install node@22
56
+ brew link --overwrite node@22 2>/dev/null || true
57
+ else
58
+ info "Installing Node.js LTS via install-node.vercel.app..."
59
+ curl -fsSL https://install-node.vercel.app/lts | bash -s -- --yes
60
+ fi
61
+ ;;
62
+ linux)
63
+ if command -v apt-get >/dev/null 2>&1; then
64
+ info "Installing Node.js 22.x via NodeSource (apt)..."
65
+ curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash -
66
+ sudo apt-get install -y nodejs
67
+ elif command -v yum >/dev/null 2>&1; then
68
+ info "Installing Node.js 22.x via NodeSource (yum)..."
69
+ curl -fsSL https://rpm.nodesource.com/setup_22.x | sudo -E bash -
70
+ sudo yum install -y nodejs
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
+ gitbash)
77
+ error "Cannot auto-install Node.js in Git Bash. Please use the PowerShell script or install manually."
78
+ echo " https://nodejs.org/en/download/"
79
+ exit 1
80
+ ;;
81
+ *)
82
+ error "Unsupported OS. Please install Node.js >= ${NODE_MAJOR_MIN} manually:"
83
+ echo " https://nodejs.org/en/download/"
84
+ exit 1
85
+ ;;
86
+ esac
87
+
88
+ export PATH="$HOME/.local/bin:$HOME/.nodejs/bin:/usr/local/bin:$PATH"
89
+ hash -r 2>/dev/null || true
90
+
91
+ if ! node_version_ok; then
92
+ error "Node.js installation failed. Please install manually:"
93
+ echo " https://nodejs.org/en/download/"
94
+ exit 1
95
+ fi
96
+ }
97
+
98
+ # -- Main ---------------------------------------------------------------------
99
+ main() {
100
+ echo ""
101
+ echo -e "${BOLD}+---------------------------------------------+${NC}"
102
+ echo -e "${BOLD}| ${SKILL_LABEL} -- Install |${NC}"
103
+ echo -e "${BOLD}+---------------------------------------------+${NC}"
104
+ echo ""
105
+
106
+ # Step 1: Environment check
107
+ step "Step 1/4: Environment check"
108
+
109
+ if node_version_ok; then
110
+ info "Node.js $(node -v) found"
111
+ else
112
+ if command -v node >/dev/null 2>&1; then
113
+ warn "Node.js $(node -v) is too old (need >= ${NODE_MAJOR_MIN}), upgrading..."
114
+ else
115
+ warn "Node.js not found, installing..."
116
+ fi
117
+ install_node
118
+ info "Node.js $(node -v) installed"
119
+ fi
120
+
121
+ if command -v pnpm >/dev/null 2>&1; then
122
+ PKG_MANAGER="pnpm"
123
+ elif command -v npm >/dev/null 2>&1; then
124
+ PKG_MANAGER="npm"
125
+ else
126
+ error "npm not found (Node.js installation may be incomplete)"
127
+ exit 1
128
+ fi
129
+ info "$PKG_MANAGER ready"
130
+
131
+ local current_registry
132
+ current_registry=$(npm config get registry 2>/dev/null || echo "")
133
+ if [ "$current_registry" != "$NPM_MIRROR" ] && [ "$current_registry" != "${NPM_MIRROR}/" ]; then
134
+ info "Switching npm registry to China mirror for faster downloads..."
135
+ npm config set registry "$NPM_MIRROR"
136
+ info "npm registry set to $NPM_MIRROR"
137
+ else
138
+ info "npm registry already set to China mirror"
139
+ fi
140
+
141
+ # Step 2: Install CLI
142
+ step "Step 2/4: Install ${PKG_NAME}"
143
+
144
+ info "Running: ${INSTALL_CMD}"
145
+ $PKG_MANAGER install -g ${PKG_NAME}$(echo "${INSTALL_CMD}" | grep -o '@[^ ]*' || true)
146
+ info "${PKG_NAME} installed"
147
+
148
+ info "Registering Skill to all AI platform global directories..."
149
+ ${CLI_BIN} init --global --force
150
+
151
+ # Step 3: Configure API Key
152
+ step "Step 3/4: Configure API Key"
153
+ echo ""
154
+ ${CLI_BIN} login
155
+
156
+ # Step 4: Done
157
+ step "Step 4/4: Complete"
158
+ echo ""
159
+ echo -e " ${GREEN}${SKILL_LABEL} installed successfully!${NC}"
160
+ echo ""
161
+ echo " Skill registered to these global directories (all AI assistants):"
162
+ echo -e " ${DIM}~/.cursor/skills/ ~/.claude/skills/ ~/.agents/skills/"
163
+ echo -e " ~/.gemini/skills/ ~/.codex/skills/ ~/.kilo/skills/"
164
+ echo -e " ~/.codeium/windsurf/skills/ ~/.config/opencode/skills/"
165
+ echo -e " ~/.openclaw/skills/ ~/.workbuddy/skills/${NC}"
166
+ echo ""
167
+ echo " Update CLI & Skill files: ${CLI_BIN} update"
168
+ echo ""
169
+ info "Need help? Visit ${WEB_BASE}"
170
+ echo ""
171
+ }
172
+
173
+ main "$@"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "siluzan-cso-cli",
3
- "version": "1.1.12-beta.1",
3
+ "version": "1.1.12-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": {