feat(twitter): migrate from xreach to bird CLI

- Replace xreach CLI with bird (@steipete/bird) as Twitter/X backend
- bird uses AUTH_TOKEN/CT0 env vars (simpler than xreach's session.json)
- Accept both 'bird' and 'birdx' binary names
- Remove version detection logic (bird v0.8.0 is the baseline)
- Write credentials.env to ~/.config/bird/ for easy sourcing
- Keep xfetch session.json sync for backward compatibility
- Update SKILL.md commands: bird search/read/user-tweets/thread
- Update install/uninstall to use npm @steipete/bird
- All 52 tests pass
This commit is contained in:
Panniantong
2026-03-23 08:51:22 +01:00
parent c1af1cad14
commit 7ae0cd8c0a
13 changed files with 199 additions and 193 deletions
+14 -15
View File
@@ -1,44 +1,43 @@
# 常见问题排查
## Twitter/X: xreach CLI "fetch failed"
## Twitter/X: bird CLI 连接失败
**症状:** `xreach search` 或其他命令返回 "fetch failed"
**症状:** `bird search` 或其他命令返回错误
**原因:** xreach CLI 使用 Node.js 的 `undici` 库发请求。如果你的网络环境需要代理才能访问 x.com,需要明确传入代理参数
**原因:** bird CLI 需要 AUTH_TOKEN 和 CT0 环境变量才能访问 Twitter API。如果你的网络环境需要代理才能访问 x.com,需要配置代理
**解决方案:**
### 方案 1使用 --proxy 参数
### 方案 1设置环境变量代理
```bash
xreach search "test" --auth-token "$AUTH_TOKEN" --ct0 "$CT0" --proxy "http://user:pass@host:port"
export HTTP_PROXY="http://user:pass@host:port"
export HTTPS_PROXY="http://user:pass@host:port"
bird search "test" -n 1
```
### 方案 2:使用全局代理工具
让代理工具接管所有网络流量,这样 xreach 的请求也会走代理:
让代理工具接管所有网络流量,这样 bird 的请求也会走代理:
```bash
# macOS — ClashX / Surge 开启"增强模式"
# Linux — proxychains 或 tun2socks
proxychains xreach search "test" -n 1
proxychains bird search "test" -n 1
```
### 方案 3:不用 xreach,用 Exa 搜索替代
### 方案 3:不用 bird,用 Exa 搜索替代
xreach 不可用时,可以直接用 Exa 搜索 Twitter 内容:
bird 不可用时,可以直接用 Exa 搜索 Twitter 内容:
```bash
mcporter call 'exa.web_search_exa(query: "site:x.com 搜索词", numResults: 5)'
```
### 方案 4设置 HTTP_PROXY 环境变量
### 方案 4检查认证
```bash
export HTTP_PROXY="http://127.0.0.1:7890"
export HTTPS_PROXY="http://127.0.0.1:7890"
xreach search "test"
bird check
```
> ⚠️ 注意:Node.js 原生 fetch 不一定读取这些环境变量,推荐用方案 1 的 --proxy 参数
> 如果返回 "Missing credentials",需要设置 AUTH_TOKEN 和 CT0 环境变量