@cocorograph/hub-agent 0.6.74 → 0.6.75
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 +1 -1
- package/scripts/install.sh +18 -3
package/package.json
CHANGED
package/scripts/install.sh
CHANGED
|
@@ -228,8 +228,14 @@ persist_user_brew_shellenv() {
|
|
|
228
228
|
# 後で system 版 node / npm に切り替わる可能性も考えて user 領域に逃がしておく。
|
|
229
229
|
# system mode(/opt/homebrew 等)では何もしない(既存挙動を温存)。
|
|
230
230
|
ensure_npm_user_prefix() {
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
# macOS は user-mode (brew が $HOME/homebrew) のときだけ切替(既存挙動を温存)。
|
|
232
|
+
# Linux は apt 等の global prefix が sudo 必須 / global bin が PATH に通らない問題を
|
|
233
|
+
# 起こしやすい(npm i -g は成功しても hub-agent / claude が command not found になる)。
|
|
234
|
+
# そのため Linux では常に $HOME/.npm-global へ寄せ、sudo 不要・bin パス確定・PATH 反映を
|
|
235
|
+
# 一貫させる(WSL クリーン Ubuntu で発覚)。
|
|
236
|
+
if [[ "$(uname)" == "Darwin" ]]; then
|
|
237
|
+
[[ -d "$HOME/homebrew" ]] || return 0 # user-mode 検知
|
|
238
|
+
fi
|
|
233
239
|
|
|
234
240
|
# 既に $HOME/.npm-global が prefix なら何もしない
|
|
235
241
|
local cur_prefix
|
|
@@ -247,8 +253,17 @@ ensure_npm_user_prefix() {
|
|
|
247
253
|
local snippet='export PATH="$HOME/.npm-global/bin:$PATH"'
|
|
248
254
|
local marker="# >>> hub-agent: npm-global PATH (user-mode) >>>"
|
|
249
255
|
local end_marker="# <<< hub-agent: npm-global PATH <<<"
|
|
256
|
+
# 永続先は OS で出し分け。Linux の hub-agent は systemd --user 起動時や
|
|
257
|
+
# `$SHELL -lic` 経由の env 注入で PATH を解決するため、login(.profile) と
|
|
258
|
+
# interactive(.bashrc) の双方に通す。macOS は従来どおり zsh/bash の profile。
|
|
259
|
+
local targets
|
|
260
|
+
if [[ "$(uname)" == "Darwin" ]]; then
|
|
261
|
+
targets=("$HOME/.zprofile" "$HOME/.bash_profile")
|
|
262
|
+
else
|
|
263
|
+
targets=("$HOME/.bashrc" "$HOME/.profile")
|
|
264
|
+
fi
|
|
250
265
|
local target
|
|
251
|
-
for target in "$
|
|
266
|
+
for target in "${targets[@]}"; do
|
|
252
267
|
if [[ -f "$target" ]] && grep -Fq "$snippet" "$target"; then
|
|
253
268
|
continue
|
|
254
269
|
fi
|