安装指南

详细的 HiCLI 安装和配置说明。

系统要求

PC 端

系统 最低版本
Linux Ubuntu 20.04+
macOS 12.0+
Windows 10/11

移动端

系统 最低版本
iOS 14.0+
Android 8.0+

安装方式

方式一: 从源码构建

# 克隆仓库
git clone https://github.com/wsyb/touch_cli_plus.git
cd touch_cli_plus

# 构建 hicli
cd hicli-rs
cargo build --release
sudo cp target/release/hicli /usr/local/bin/

方式二: 使用安装脚本

# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/wsyb/touch_cli_plus/main/scripts/install.sh | bash

# Windows (PowerShell)
irm https://raw.githubusercontent.com/wsyb/touch_cli_plus/main/scripts/install.ps1 | iex

配置

环境变量

# HiCloud 服务地址
export HICLOUD_URL=https://cloud.hicli.dev

# 日志级别
export HICLI_LOG=info

配置文件

配置文件位于 ~/.hicli/config.json:

{
  "cloudUrl": "https://cloud.hicli.dev",
  "logLevel": "info"
}

守护进程

hidaemon 是 HiCLI 的后台守护进程,负责:

  • P2P 连接管理
  • 设备状态同步
  • 心跳检测

启动守护进程

cd hidaemon-rs
cargo run --release

系统服务 (Linux)

创建 systemd 服务:

sudo cat > /etc/systemd/system/hidaemon.service << EOF
[Unit]
Description=HiCLI Daemon
After=network.target

[Service]
Type=simple
User=YOUR_USER
ExecStart=/usr/local/bin/hidaemon
Restart=always

[Install]
WantedBy=multi-user.target
EOF

sudo systemctl enable hidaemon
sudo systemctl start hidaemon

验证

# 检查版本
hi --version

# 检查守护进程状态
hi status

故障排除

常见问题

  1. 连接失败: 检查防火墙设置,确保端口未被阻止
  2. 设备未发现: 确认两端登录了相同账号
  3. 传输中断: 检查网络稳定性

日志查看

# hicli 日志
tail -f ~/.hicli/logs/hicli.log

# hidaemon 日志
tail -f ~/.hicli/logs/hidaemon.log

下一步