@silicaclaw/cli 1.0.0-beta.11 → 1.0.0-beta.13

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/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@
8
8
  - `INSTALL.md`
9
9
  - `DEMO_GUIDE.md`
10
10
  - `RELEASE_NOTES_v1.0.md`
11
+ - CLI onboarding install UX polish:
12
+ - added shell alias fallback (`silicaclaw -> npx @silicaclaw/cli@beta`) when global install is unavailable
13
+ - reduced reliance on manual PATH/env edits for first-run success
14
+ - `silicaclaw update` guidance polish:
15
+ - prioritize zero-setup `npx` flow
16
+ - clarify global install is optional
11
17
  - README first-screen and structure polish:
12
18
  - fixed v1.0 beta project positioning
13
19
  - added concise feature summary
package/INSTALL.md CHANGED
@@ -57,6 +57,14 @@ silicaclaw gateway status
57
57
  silicaclaw gateway stop
58
58
  ```
59
59
 
60
+ If global install fails with `EACCES`, use alias mode (no PATH edits):
61
+
62
+ ```bash
63
+ alias silicaclaw='npx -y @silicaclaw/cli@beta'
64
+ silicaclaw onboard
65
+ silicaclaw update
66
+ ```
67
+
60
68
  ## 3. Run
61
69
 
62
70
  Start local console:
package/README.md CHANGED
@@ -92,6 +92,14 @@ silicaclaw gateway status
92
92
  silicaclaw gateway stop
93
93
  ```
94
94
 
95
+ If global install is blocked by system permissions (`EACCES`), use alias mode:
96
+
97
+ ```bash
98
+ alias silicaclaw='npx -y @silicaclaw/cli@beta'
99
+ silicaclaw onboard
100
+ silicaclaw update
101
+ ```
102
+
95
103
  ## Quick Start (OpenClaw-style)
96
104
 
97
105
  ### 1. Prerequisites
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silicaclaw/cli",
3
- "version": "1.0.0-beta.11",
3
+ "version": "1.0.0-beta.13",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -79,6 +79,61 @@ EOF
79
79
  return 0
80
80
  }
81
81
 
82
+ default_system_bin_dir() {
83
+ if [ -d "/usr/local/bin" ]; then
84
+ printf '/usr/local/bin'
85
+ return 0
86
+ fi
87
+ if [ -d "/opt/homebrew/bin" ]; then
88
+ printf '/opt/homebrew/bin'
89
+ return 0
90
+ fi
91
+ printf '/usr/local/bin'
92
+ }
93
+
94
+ detect_shell_rc_file() {
95
+ local sh_name="${SHELL:-}"
96
+ case "$sh_name" in
97
+ */zsh) printf '%s' "$HOME/.zshrc" ;;
98
+ */bash) printf '%s' "$HOME/.bashrc" ;;
99
+ *)
100
+ if [ -n "${ZSH_VERSION:-}" ]; then
101
+ printf '%s' "$HOME/.zshrc"
102
+ else
103
+ printf '%s' "$HOME/.bashrc"
104
+ fi
105
+ ;;
106
+ esac
107
+ }
108
+
109
+ install_npx_alias() {
110
+ local rc_file
111
+ rc_file="$(detect_shell_rc_file)"
112
+ local begin_mark="# >>> silicaclaw npx alias >>>"
113
+ local end_mark="# <<< silicaclaw npx alias <<<"
114
+ local alias_line="alias silicaclaw='npx -y @silicaclaw/cli@beta'"
115
+
116
+ mkdir -p "$(dirname "$rc_file")"
117
+ touch "$rc_file"
118
+
119
+ if grep -Fq "$begin_mark" "$rc_file"; then
120
+ echo "已存在 silicaclaw alias 配置: $rc_file"
121
+ return 0
122
+ fi
123
+
124
+ {
125
+ echo ""
126
+ echo "$begin_mark"
127
+ echo "$alias_line"
128
+ echo "$end_mark"
129
+ } >>"$rc_file"
130
+
131
+ echo "已写入 alias 到: $rc_file"
132
+ echo "执行以下命令即可在当前 shell 立即生效:"
133
+ echo "source \"$rc_file\""
134
+ return 0
135
+ }
136
+
82
137
  ask_yes_no() {
83
138
  local prompt="$1"
84
139
  local default="${2:-Y}"
@@ -208,11 +263,14 @@ if command -v silicaclaw >/dev/null 2>&1; then
208
263
  else
209
264
  echo "将尝试无 sudo 安装 silicaclaw 命令到 PATH 中可写目录。"
210
265
  BIN_DIR="$(first_writable_path_dir || true)"
266
+ INSTALLED=0
211
267
  if [ -n "${BIN_DIR:-}" ]; then
212
268
  if install_command_shim "$BIN_DIR"; then
213
269
  echo "命令已安装: $BIN_DIR/silicaclaw"
270
+ hash -r || true
214
271
  if command -v silicaclaw >/dev/null 2>&1; then
215
272
  echo "验证成功: $(command -v silicaclaw)"
273
+ INSTALLED=1
216
274
  else
217
275
  echo "命令已写入,但当前 shell 未立即识别。请新开终端后运行 silicaclaw。"
218
276
  fi
@@ -221,7 +279,42 @@ else
221
279
  fi
222
280
  else
223
281
  echo "当前 PATH 中没有可写目录,无法无 sudo 安装系统命令。"
224
- echo "你仍可直接使用: npx @silicaclaw/cli@beta <command>"
282
+ fi
283
+
284
+ if [ "$INSTALLED" != "1" ]; then
285
+ SYS_BIN_DIR="$(default_system_bin_dir)"
286
+ echo "为保证开箱即用体验,建议安装到系统目录: $SYS_BIN_DIR/silicaclaw"
287
+ if ask_yes_no "是否使用 sudo 安装系统命令?" "Y"; then
288
+ run_cmd "sudo mkdir -p \"$SYS_BIN_DIR\""
289
+ run_cmd "sudo tee \"$SYS_BIN_DIR/silicaclaw\" >/dev/null <<'EOF'
290
+ #!/usr/bin/env bash
291
+ set -euo pipefail
292
+ exec node \"$WORK_DIR/scripts/silicaclaw-cli.mjs\" \"\$@\"
293
+ EOF"
294
+ run_cmd "sudo chmod +x \"$SYS_BIN_DIR/silicaclaw\""
295
+ hash -r || true
296
+ if command -v silicaclaw >/dev/null 2>&1; then
297
+ echo "验证成功: $(command -v silicaclaw)"
298
+ INSTALLED=1
299
+ else
300
+ echo "安装完成,但当前 shell 未刷新。请新开终端后运行 silicaclaw。"
301
+ fi
302
+ else
303
+ echo "已跳过 sudo 安装。"
304
+ fi
305
+ fi
306
+
307
+ if [ "$INSTALLED" != "1" ]; then
308
+ echo "无需改 PATH/环境变量,也可一键使用 silicaclaw。"
309
+ if ask_yes_no "是否自动写入 shell alias(silicaclaw -> npx @silicaclaw/cli@beta)?" "Y"; then
310
+ if install_npx_alias; then
311
+ echo "alias 安装完成。新开终端后可直接使用 silicaclaw。"
312
+ else
313
+ echo "alias 安装失败。可继续使用: npx @silicaclaw/cli@beta <command>"
314
+ fi
315
+ else
316
+ echo "你仍可继续使用: npx @silicaclaw/cli@beta <command>"
317
+ fi
225
318
  fi
226
319
  fi
227
320
 
@@ -73,11 +73,16 @@ function showUpdateGuide(current, latest, beta) {
73
73
  }
74
74
  console.log("");
75
75
  console.log("Recommended commands:");
76
- console.log("1) npx mode (no global install)");
76
+ console.log("1) npx mode (recommended, zero setup)");
77
77
  console.log(" npx @silicaclaw/cli@beta onboard");
78
78
  console.log(" npx @silicaclaw/cli@beta connect");
79
+ console.log(" npx @silicaclaw/cli@beta update");
79
80
  console.log("");
80
- console.log("2) global install mode");
81
+ console.log("2) shell alias mode (no global install / no PATH edits)");
82
+ console.log(" alias silicaclaw='npx -y @silicaclaw/cli@beta'");
83
+ console.log(" silicaclaw version");
84
+ console.log("");
85
+ console.log("3) global install mode (optional)");
81
86
  console.log(" npm i -g @silicaclaw/cli@beta");
82
87
  console.log(" silicaclaw version");
83
88
  console.log("");