喵完美🐾
](https://swift.org)  
一个纯Swift CLI/TUI客户端 克劳德博特 网关。
特性
- CLI接口:发送消息、检查状态、查看历史记录
- TUI接口:终端UI(即将推出)
- MCP 服务器:Claude桌面集成
- 纯Swift:不需要Node.js-本机macOS性能
- 网关协议v3:完全支持WebSocket
安装
从源代码构建
git clone https://github.com/yourusername/Purrfect.git
cd Purrfect
swift build -c release
cp .build/release/purrfect /usr/local/bin/配置
配置文件
创建 ~/.purrfect/config.yaml:
gateway:
url: ws://localhost:3030/gateway
token: null
password: null
defaults:
sessionKey: main
channel: null
deliver: false
sessions:
directory: ~/.purrfect/sessions
retainHours: 168或者使用默认值进行初始化:
purrfect config init环境变量
环境变量覆盖配置文件值。CLI参数具有最高优先级。
# Gateway connection
export GATEWAY_URL="ws://localhost:3030/gateway"
export GATEWAY_TOKEN="your-token"
export GATEWAY_PASSWORD="your-password"
# Session defaults
export SESSION_KEY="main"
export CHANNEL="telegram"优先级顺序:
- 命令行参数(最高)
- 环境变量
- 配置文件值
- 内置默认值(最低)
CLI覆盖示例
# CLI arg overrides env var and config file
purrfect ask "Hello" --gateway-url ws://other-host:3030/gateway
# CLI arg with env var fallback
purrfect ask "Hello" --session work # or export SESSION_KEY=work用法
CLI命令
问一个问题:
purrfect ask "What's the weather today?"
purrfect ask "Explain quantum computing" --stream检查网关状态:
purrfect status
purrfect status --json查看消息渠道:
purrfect channels查看聊天记录:
purrfect history
purrfect history --limit 50 --reverse管理配置:
purrfect config show
purrfect config set gateway.url ws://localhost:3030/gateway
purrfect config set defaults.session my-session全局选项
--gateway-url, -g Gateway WebSocket URL
--token, -t Authentication token
--password Authentication password
--session, -s Session key
--verbose Enable verbose output例子
发送到特定频道:
purrfect ask "Send this to Telegram" --channel telegram --deliver使用不同的会话:
purrfect ask "Hello" --session work
purrfect history --session work流响应:
purrfect ask "Write a story" --streamMCP服务器(克劳德桌面)
添加到 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"purrfect": {
"command": "/usr/local/bin/purrfect-mcp"
}
}
}可用的MCP工具:
ask-向Clawdbot代理发送消息status-获取网关状态channels-获取消息通道状态history-获取聊天记录
建筑
Purrfect/
├── Sources/
│ ├── PurrfectCore/ # Shared library
│ │ ├── Models/ # Gateway protocol types
│ │ ├── Gateway/ # WebSocket client
│ │ ├── Config/ # Configuration loader
│ │ ├── Events/ # Event bus
│ │ └── Sessions/ # Session persistence
│ ├── PurrfectCLI/ # CLI executable
│ │ └── Commands/ # CLI commands
│ ├── PurrfectTUI/ # TUI executable (coming soon)
│ └── PurrfectMCP/ # MCP server executable
└── Package.swift需求
- macOS 14.0+
- Swift 6.0+
- Clawdbot网关正在运行(默认值:
ws://localhost:3030/gateway)
网关协议
Purrfect使用WebSocket协议v3连接到Clawdbot网关。不需要对Clawdbot进行任何更改,它是一个纯客户端实现。
关键网关方法:
connect-验证并建立会话agent-向AI代理发送消息chat.send-发送聊天消息chat.history-检索聊天记录status-获取网关状态channels.status-获取消息通道状态
发展
构建:
swift build运行测试:
swift test运行CLI:
swift run purrfect ask "Hello"运行MCP服务器:
swift run purrfect-mcp路线图
- \[x\] CLI界面
- \[x\] MCP服务器集成
- \[\]带标签的TUI界面
- \[\]会话管理UI
- \[\]实时事件流
- \[\]本地缓存
- \[\]离线模式
许可证
麻省理工学院
