remote-claude 0.1.3 → 0.1.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/init.sh +32 -4
- package/package.json +1 -1
package/init.sh
CHANGED
|
@@ -36,6 +36,24 @@ print_header() {
|
|
|
36
36
|
echo ""
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
# 确保 ~/.local/bin 在 PATH 中
|
|
40
|
+
setup_path() {
|
|
41
|
+
local PROFILE="$HOME/.bash_profile"
|
|
42
|
+
# 不存在则创建
|
|
43
|
+
[[ -f "$PROFILE" ]] || touch "$PROFILE"
|
|
44
|
+
|
|
45
|
+
# 未写入则追加
|
|
46
|
+
if ! grep -qF '$HOME/.local/bin' "$PROFILE" 2>/dev/null; then
|
|
47
|
+
echo "" >> "$PROFILE"
|
|
48
|
+
echo '# remote-claude: 确保 ~/.local/bin 在 PATH' >> "$PROFILE"
|
|
49
|
+
echo 'export PATH="$HOME/.local/bin:$PATH"' >> "$PROFILE"
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
# 使当前脚本会话立即生效
|
|
53
|
+
source "$PROFILE" 2>/dev/null || true
|
|
54
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
# 检查操作系统
|
|
40
58
|
check_os() {
|
|
41
59
|
print_header "检查系统环境"
|
|
@@ -78,16 +96,22 @@ check_uv() {
|
|
|
78
96
|
# 方式二:pip + PyPI(GitHub 访问受限时首选;国内镜像比 GitHub 稳定)
|
|
79
97
|
if ! command -v uv &> /dev/null && [[ -n "$PIP_CMD" ]]; then
|
|
80
98
|
print_warning "尝试 pip 安装 uv(官方 PyPI)..."
|
|
81
|
-
$PIP_CMD install uv --quiet 2>/dev/null
|
|
99
|
+
($PIP_CMD install uv --quiet 2>/dev/null || \
|
|
100
|
+
$PIP_CMD install uv --quiet --break-system-packages 2>/dev/null) && \
|
|
101
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
82
102
|
fi
|
|
83
103
|
|
|
84
104
|
# 方式三:pip + 国内镜像(清华 PyPI,适合无法访问 GitHub/pypi.org 的内网环境)
|
|
85
105
|
if ! command -v uv &> /dev/null && [[ -n "$PIP_CMD" ]]; then
|
|
86
106
|
print_warning "尝试 pip 安装 uv(清华镜像)..."
|
|
87
|
-
$PIP_CMD install uv --quiet \
|
|
107
|
+
($PIP_CMD install uv --quiet \
|
|
108
|
+
-i https://pypi.tuna.tsinghua.edu.cn/simple/ \
|
|
109
|
+
--trusted-host pypi.tuna.tsinghua.edu.cn 2>/dev/null || \
|
|
110
|
+
$PIP_CMD install uv --quiet \
|
|
88
111
|
-i https://pypi.tuna.tsinghua.edu.cn/simple/ \
|
|
89
|
-
--trusted-host pypi.tuna.tsinghua.edu.cn
|
|
90
|
-
&&
|
|
112
|
+
--trusted-host pypi.tuna.tsinghua.edu.cn \
|
|
113
|
+
--break-system-packages 2>/dev/null) && \
|
|
114
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
91
115
|
fi
|
|
92
116
|
|
|
93
117
|
# 方式四:conda/mamba(适合已有 Anaconda/Miniconda 环境的机器)
|
|
@@ -514,6 +538,9 @@ ${YELLOW}快捷命令:${NC}
|
|
|
514
538
|
|
|
515
539
|
详细使用说明请阅读 README.md
|
|
516
540
|
|
|
541
|
+
${YELLOW}提示:${NC}请运行以下命令使 PATH 生效,或重新打开终端:
|
|
542
|
+
source ~/.bash_profile
|
|
543
|
+
|
|
517
544
|
EOF
|
|
518
545
|
}
|
|
519
546
|
|
|
@@ -532,6 +559,7 @@ main() {
|
|
|
532
559
|
echo -e "${GREEN}━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━${NC}"
|
|
533
560
|
echo ""
|
|
534
561
|
|
|
562
|
+
setup_path
|
|
535
563
|
check_os
|
|
536
564
|
check_uv
|
|
537
565
|
check_tmux
|