feishu-bridge 1.0.3 → 1.0.5
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/README.md +351 -163
- package/dist/cli/index.js +1053 -67
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +1053 -67
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +1048 -64
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1048 -64
- package/dist/index.mjs.map +1 -1
- package/package.json +32 -8
- package/scripts/install-hook.sh +319 -0
- package/scripts/shell-hook.sh +320 -0
- package/scripts/test-hook.sh +244 -0
package/README.md
CHANGED
|
@@ -1,22 +1,30 @@
|
|
|
1
|
-
# Feishu Bridge
|
|
1
|
+
# 飞书桥接器 (Feishu Bridge)
|
|
2
2
|
|
|
3
|
-
🚀 轻量级飞书插件,桥接飞书与各种AI编程IDE/CLI工具
|
|
3
|
+
🚀 轻量级飞书插件,桥接飞书与各种 AI 编程 IDE/CLI 工具
|
|
4
4
|
|
|
5
5
|
## ✨ 特性
|
|
6
6
|
|
|
7
|
-
- **🎯 零依赖**: 无需OpenClaw,独立运行
|
|
8
|
-
- **🔌 多IDE支持**: VS Code, Cursor, Trae, OpenCode, Claude Code, Kiro, Antigravity
|
|
7
|
+
- **🎯 零依赖**: 无需 OpenClaw,独立运行
|
|
8
|
+
- **🔌 多 IDE 支持**: VS Code, Cursor, Trae, OpenCode, Claude Code, Kiro, Antigravity
|
|
9
9
|
- **💬 全交互**: 通过飞书完成所有操作,结果返回飞书
|
|
10
|
-
- **🔒 安全**: Webhook签名验证(HMAC-SHA256),防重放攻击
|
|
11
|
-
- **📊 监控**: 健康检查端点,Prometheus指标
|
|
12
|
-
- **🔧 完整CLI**: 配置管理、守护进程、状态监控
|
|
13
|
-
- **⚡ 自动启动**: Shell hook自动检测IDE环境并启动服务
|
|
14
|
-
- **🔄 双模式**: WebSocket和Webhook双连接模式支持
|
|
15
|
-
- **💾 备用通信**: 文件系统IPC机制确保可靠性
|
|
10
|
+
- **🔒 安全**: Webhook 签名验证(HMAC-SHA256),防重放攻击
|
|
11
|
+
- **📊 监控**: 健康检查端点,Prometheus 指标
|
|
12
|
+
- **🔧 完整 CLI**: 配置管理、守护进程、状态监控
|
|
13
|
+
- **⚡ 自动启动**: Shell hook 自动检测 IDE 环境并启动服务
|
|
14
|
+
- **🔄 双模式**: WebSocket 和 Webhook 双连接模式支持
|
|
15
|
+
- **💾 备用通信**: 文件系统 IPC 机制确保可靠性
|
|
16
|
+
|
|
17
|
+
---
|
|
16
18
|
|
|
17
19
|
## 📦 安装
|
|
18
20
|
|
|
19
|
-
### 方式一:
|
|
21
|
+
### 方式一: npm 全局安装(推荐)
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npm install -g feishu-bridge
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### 方式二: curl 一键安装
|
|
20
28
|
|
|
21
29
|
**Linux/macOS:**
|
|
22
30
|
```bash
|
|
@@ -28,12 +36,6 @@ curl -fsSL https://install.feishu-bridge.dev | bash
|
|
|
28
36
|
iwr -useb https://install.feishu-bridge.dev/install.ps1 | iex
|
|
29
37
|
```
|
|
30
38
|
|
|
31
|
-
### 方式二: npm全局安装
|
|
32
|
-
|
|
33
|
-
```bash
|
|
34
|
-
npm install -g feishu-bridge
|
|
35
|
-
```
|
|
36
|
-
|
|
37
39
|
### 方式三: 手动安装
|
|
38
40
|
|
|
39
41
|
```bash
|
|
@@ -44,195 +46,381 @@ npm run build
|
|
|
44
46
|
npm link
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 🔄 更新与卸载
|
|
52
|
+
|
|
53
|
+
### 更新到最新版本
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# 查看当前版本
|
|
57
|
+
feishu-bridge --version
|
|
58
|
+
|
|
59
|
+
# 更新到最新版本
|
|
60
|
+
npm update -g feishu-bridge
|
|
61
|
+
|
|
62
|
+
# 或重新安装最新版本
|
|
63
|
+
npm install -g feishu-bridge@latest
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 完全卸载
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# 1. 停止服务(如果正在运行)
|
|
70
|
+
feishu-bridge daemon stop
|
|
71
|
+
|
|
72
|
+
# 2. 卸载 npm 包
|
|
73
|
+
npm uninstall -g feishu-bridge
|
|
48
74
|
|
|
75
|
+
# 3. 清理配置文件(可选)
|
|
76
|
+
rm -rf ~/.config/feishu-bridge
|
|
77
|
+
|
|
78
|
+
# 4. 卸载 Shell Hook(如果已安装)
|
|
79
|
+
curl -fsSL https://install.feishu-bridge.dev/hook.sh | bash -s uninstall
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## 🚀 快速开始
|
|
85
|
+
|
|
86
|
+
### 1. 配置飞书应用
|
|
87
|
+
|
|
88
|
+
1. 访问 [飞书开放平台](https://open.feishu.cn/)
|
|
89
|
+
2. 创建企业自建应用
|
|
90
|
+
3. 获取 **App ID** 和 **App Secret**
|
|
91
|
+
4. 启用机器人功能
|
|
92
|
+
5. 选择连接模式(WebSocket 推荐)
|
|
93
|
+
|
|
94
|
+
### 2. 配置桥接器
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# 设置 App ID
|
|
98
|
+
feishu-bridge config set feishu.appId cli_xxxxxxxxxxxx
|
|
99
|
+
|
|
100
|
+
# 设置 App Secret
|
|
101
|
+
feishu-bridge config set feishu.appSecret xxxxxxxxxxxxxxxxxxxxxxxx
|
|
102
|
+
|
|
103
|
+
# 设置连接模式(推荐 WebSocket,无需公网 IP)
|
|
104
|
+
feishu-bridge config set feishu.connectionMode websocket
|
|
105
|
+
|
|
106
|
+
# 验证配置
|
|
107
|
+
feishu-bridge config list
|
|
49
108
|
```
|
|
50
|
-
┌─────────────────┐ WebSocket/Webhook ┌─────────────────────────┐
|
|
51
|
-
│ Feishu │ ◄──────────────────────► │ Feishu Bot │
|
|
52
|
-
│ (手机/PC/Web) │ │ (自建应用机器人) │
|
|
53
|
-
└─────────────────┘ └─────────────────────────┘
|
|
54
|
-
│
|
|
55
|
-
▼
|
|
56
|
-
┌─────────────────────────────────────────────────────────────────────┐
|
|
57
|
-
│ Feishu Bridge Core │
|
|
58
|
-
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌────────────┐ │
|
|
59
|
-
│ │ Message │ │ Session │ │ Tool │ │ Response │ │
|
|
60
|
-
│ │ Handler │ │ Manager │ │ Router │ │ Formatter │ │
|
|
61
|
-
│ └─────────────┘ └─────────────┘ └─────────────┘ └────────────┘ │
|
|
62
|
-
└─────────────────────────────────────────────────────────────────────┘
|
|
63
|
-
│
|
|
64
|
-
▼
|
|
65
|
-
┌─────────────────────────────────────────────────────────────────────┐
|
|
66
|
-
│ IDE/CLI Adapters Layer │
|
|
67
|
-
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
|
|
68
|
-
│ │ VS Code │ │ Cursor │ │ Trae │ │ OpenCode │ │ Claude │ │
|
|
69
|
-
│ │ Adapter │ │ Adapter │ │ Adapter │ │ Adapter │ │ Adapter │ │
|
|
70
|
-
│ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ │
|
|
71
|
-
└─────────────────────────────────────────────────────────────────────┘
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Installation
|
|
75
|
-
|
|
76
|
-
### npm Global Install
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
# Install globally
|
|
80
|
-
npm install -g feishu-bridge
|
|
81
109
|
|
|
82
|
-
|
|
83
|
-
feishu-bridge config set appId YOUR_APP_ID
|
|
84
|
-
feishu-bridge config set appSecret YOUR_APP_SECRET
|
|
110
|
+
### 3. 启动服务
|
|
85
111
|
|
|
86
|
-
|
|
112
|
+
```bash
|
|
113
|
+
# 前台模式(调试用)
|
|
87
114
|
feishu-bridge start
|
|
115
|
+
|
|
116
|
+
# 或后台模式(生产用)
|
|
117
|
+
feishu-bridge daemon start
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 4. 在飞书使用
|
|
121
|
+
|
|
122
|
+
在配置了机器人的飞书群组中发送:
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
@vscode /generate a React button component
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## 💬 使用指南
|
|
131
|
+
|
|
132
|
+
### 命令格式
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
@<目标> <命令>
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 支持的目标
|
|
139
|
+
|
|
140
|
+
| 目标 | 说明 | 示例 |
|
|
141
|
+
|------|------|------|
|
|
142
|
+
| `@vscode` | VS Code | `@vscode /generate login form` |
|
|
143
|
+
| `@cursor` | Cursor | `@cursor /run npm test` |
|
|
144
|
+
| `@trae` | Trae | `@trae build project` |
|
|
145
|
+
| `@opencode` | OpenCode | `@opencode fix bug` |
|
|
146
|
+
| `@claude` | Claude Code | `@claude explain code` |
|
|
147
|
+
| `@antigravity` | Antigravity | `@antigravity deploy` |
|
|
148
|
+
| `@kiro` | Kiro | `@kiro generate API` |
|
|
149
|
+
|
|
150
|
+
### 常用命令
|
|
151
|
+
|
|
152
|
+
**代码生成:**
|
|
153
|
+
```
|
|
154
|
+
@vscode /generate a React login form with TypeScript
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**运行命令:**
|
|
158
|
+
```
|
|
159
|
+
@cursor /run npm install axios
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
**打开文件:**
|
|
163
|
+
```
|
|
164
|
+
@vscode open src/App.tsx
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**解释代码:**
|
|
168
|
+
```
|
|
169
|
+
@claude explain the authentication flow
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
**搜索代码:**
|
|
173
|
+
```
|
|
174
|
+
@vscode /search "function handleSubmit"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**构建项目:**
|
|
178
|
+
```
|
|
179
|
+
@trae /build
|
|
88
180
|
```
|
|
89
181
|
|
|
90
|
-
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## ⚙️ 配置详解
|
|
185
|
+
|
|
186
|
+
### 配置文件
|
|
187
|
+
|
|
188
|
+
位置:`~/.config/feishu-bridge/config.json`
|
|
189
|
+
|
|
190
|
+
```json
|
|
191
|
+
{
|
|
192
|
+
"feishu": {
|
|
193
|
+
"appId": "cli_xxxxxxxxxxxx",
|
|
194
|
+
"appSecret": "xxxxxxxxxxxxxxxxxxxxxxxx",
|
|
195
|
+
"domain": "feishu",
|
|
196
|
+
"connectionMode": "websocket",
|
|
197
|
+
"encryptKey": "可选"
|
|
198
|
+
},
|
|
199
|
+
"server": {
|
|
200
|
+
"port": 3000,
|
|
201
|
+
"host": "0.0.0.0"
|
|
202
|
+
},
|
|
203
|
+
"adapters": {
|
|
204
|
+
"vscode": { "enabled": true },
|
|
205
|
+
"cursor": { "enabled": true },
|
|
206
|
+
"trae": { "enabled": true }
|
|
207
|
+
},
|
|
208
|
+
"behavior": {
|
|
209
|
+
"autoStart": true,
|
|
210
|
+
"maxOutputLength": 2000,
|
|
211
|
+
"sessionTimeout": 30,
|
|
212
|
+
"reverseChannelEnabled": true
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### CLI 命令
|
|
91
218
|
|
|
92
219
|
```bash
|
|
93
|
-
#
|
|
94
|
-
|
|
95
|
-
|
|
220
|
+
# 服务管理
|
|
221
|
+
feishu-bridge start # 前台启动
|
|
222
|
+
feishu-bridge daemon start # 后台启动
|
|
223
|
+
feishu-bridge daemon stop # 停止服务
|
|
224
|
+
feishu-bridge daemon restart # 重启服务
|
|
225
|
+
feishu-bridge status # 查看状态
|
|
226
|
+
|
|
227
|
+
# 配置管理
|
|
228
|
+
feishu-bridge config set <key> <value> # 设置配置
|
|
229
|
+
feishu-bridge config get <key> # 获取配置
|
|
230
|
+
feishu-bridge config delete <key> # 删除配置
|
|
231
|
+
feishu-bridge config list # 列出所有配置
|
|
232
|
+
|
|
233
|
+
# 其他
|
|
234
|
+
feishu-bridge --version # 查看版本
|
|
235
|
+
feishu-bridge --help # 显示帮助
|
|
236
|
+
```
|
|
96
237
|
|
|
97
|
-
|
|
98
|
-
npm install
|
|
238
|
+
---
|
|
99
239
|
|
|
100
|
-
|
|
101
|
-
npm run build
|
|
240
|
+
## 🔌 连接模式
|
|
102
241
|
|
|
103
|
-
|
|
104
|
-
|
|
242
|
+
### WebSocket 模式(推荐)
|
|
243
|
+
|
|
244
|
+
**优点:**
|
|
245
|
+
- 无需公网 IP
|
|
246
|
+
- 无需配置 Webhook URL
|
|
247
|
+
- 自动重连
|
|
248
|
+
|
|
249
|
+
**配置:**
|
|
250
|
+
```bash
|
|
251
|
+
feishu-bridge config set feishu.connectionMode websocket
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
**飞书端配置:**
|
|
255
|
+
1. 进入应用 → 事件订阅
|
|
256
|
+
2. 选择「长连接(WebSocket)」
|
|
257
|
+
3. 开启连接
|
|
258
|
+
|
|
259
|
+
### Webhook 模式
|
|
260
|
+
|
|
261
|
+
**适用场景:**
|
|
262
|
+
- 有固定公网 IP
|
|
263
|
+
- 使用内网穿透工具(如 ngrok)
|
|
264
|
+
|
|
265
|
+
**配置:**
|
|
266
|
+
```bash
|
|
267
|
+
feishu-bridge config set feishu.connectionMode webhook
|
|
268
|
+
feishu-bridge config set server.webhookPath /webhook/feishu
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
**飞书端配置:**
|
|
272
|
+
1. 进入应用 → 事件订阅
|
|
273
|
+
2. 选择「HTTP 推送」
|
|
274
|
+
3. 配置 URL: `http://你的IP:3000/webhook/feishu`
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## 🏗️ 架构
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
┌─────────────────┐ WebSocket/Webhook ┌─────────────────────────┐
|
|
282
|
+
│ 飞书用户 │ ───────────────────► │ 桥接器服务 │
|
|
283
|
+
│ (群组消息) │ │ (feishu-bridge) │
|
|
284
|
+
└─────────────────┘ └───────────┬─────────────┘
|
|
285
|
+
│
|
|
286
|
+
文件系统 IPC │
|
|
287
|
+
/tmp/feishu-bridge/ ▼
|
|
288
|
+
│
|
|
289
|
+
┌────────────────────────────────┴────────────────┐
|
|
290
|
+
│ │
|
|
291
|
+
┌────────▼─────────┐ ┌──────────▼──────┐ ┌───────▼───────┐
|
|
292
|
+
│ VS Code │ │ Cursor │ │ Trae │
|
|
293
|
+
│ 扩展/脚本 │ │ 脚本 │ │ 脚本 │
|
|
294
|
+
└──────────────────┘ └─────────────────┘ └───────────────┘
|
|
105
295
|
```
|
|
106
296
|
|
|
107
|
-
|
|
297
|
+
**工作流程:**
|
|
298
|
+
1. 用户在飞书发送 `@vscode /generate button`
|
|
299
|
+
2. 桥接器接收消息并解析
|
|
300
|
+
3. 写入指令文件到 `/tmp/feishu-bridge/vscode/`
|
|
301
|
+
4. IDE 扩展/脚本读取并执行
|
|
302
|
+
5. 结果写回文件系统
|
|
303
|
+
6. 桥接器发送回飞书
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 🛠️ 故障排除
|
|
108
308
|
|
|
109
|
-
|
|
309
|
+
### 服务无法启动
|
|
110
310
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
SERVER_PORT=3000
|
|
117
|
-
SERVER_HOST=0.0.0.0
|
|
311
|
+
**端口被占用:**
|
|
312
|
+
```bash
|
|
313
|
+
# 更换端口
|
|
314
|
+
feishu-bridge config set server.port 3001
|
|
315
|
+
feishu-bridge start
|
|
118
316
|
```
|
|
119
317
|
|
|
120
|
-
|
|
318
|
+
### 无法接收消息
|
|
121
319
|
|
|
122
|
-
|
|
320
|
+
**检查清单:**
|
|
321
|
+
1. 服务是否运行:`feishu-bridge status`
|
|
322
|
+
2. 飞书应用是否已发布
|
|
323
|
+
3. 机器人是否在群组中
|
|
324
|
+
4. WebSocket 是否连接成功(查看日志)
|
|
123
325
|
|
|
326
|
+
**查看日志:**
|
|
124
327
|
```bash
|
|
125
|
-
#
|
|
126
|
-
feishu-bridge
|
|
127
|
-
feishu-bridge config set appSecret <value>
|
|
128
|
-
feishu-bridge config list
|
|
328
|
+
# 前台模式直接查看
|
|
329
|
+
feishu-bridge start
|
|
129
330
|
|
|
130
|
-
#
|
|
131
|
-
feishu-bridge
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
331
|
+
# 后台模式查看日志
|
|
332
|
+
feishu-bridge daemon logs
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
### IDE 无响应
|
|
336
|
+
|
|
337
|
+
**检查指令文件:**
|
|
338
|
+
```bash
|
|
339
|
+
# Windows
|
|
340
|
+
ls $env:TEMP\feishu-bridge\vscode\
|
|
136
341
|
|
|
137
|
-
#
|
|
138
|
-
|
|
342
|
+
# macOS/Linux
|
|
343
|
+
ls /tmp/feishu-bridge/vscode/
|
|
139
344
|
```
|
|
140
345
|
|
|
141
|
-
|
|
346
|
+
**手动创建测试指令:**
|
|
347
|
+
```bash
|
|
348
|
+
# 创建指令文件测试 IDE 响应
|
|
349
|
+
echo '{"type":"command","command":"/test","timestamp":'$(date +%s%3N)'}' > /tmp/feishu-bridge/vscode/cmd_test.json
|
|
350
|
+
```
|
|
142
351
|
|
|
143
|
-
|
|
352
|
+
### WebSocket 连接失败
|
|
144
353
|
|
|
354
|
+
**症状:**
|
|
145
355
|
```
|
|
146
|
-
|
|
147
|
-
@cursor /run npm start
|
|
148
|
-
@opencode /ask How do I implement authentication in Express.js?
|
|
149
|
-
@claude-code /explain this function
|
|
356
|
+
WebSocket connection failed: Authentication failed
|
|
150
357
|
```
|
|
151
358
|
|
|
152
|
-
|
|
359
|
+
**解决:**
|
|
360
|
+
1. 检查 App ID 和 App Secret
|
|
361
|
+
2. 确保应用已发布
|
|
362
|
+
3. 切换到 Webhook 模式:
|
|
363
|
+
```bash
|
|
364
|
+
feishu-bridge config set feishu.connectionMode webhook
|
|
365
|
+
feishu-bridge start
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## 📊 监控
|
|
153
371
|
|
|
154
|
-
|
|
155
|
-
- `@cursor`: Interact with Cursor IDE
|
|
156
|
-
- `@opencode`: Interact with OpenCode
|
|
157
|
-
- `@claude`: Interact with Claude Code
|
|
158
|
-
- `@trae`: Interact with Trae
|
|
159
|
-
- `@antigravity`: Interact with Antigravity
|
|
160
|
-
- `@kiro`: Interact with Kiro
|
|
372
|
+
### 健康检查
|
|
161
373
|
|
|
162
|
-
|
|
374
|
+
```bash
|
|
375
|
+
curl http://localhost:3000/health
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
响应:
|
|
379
|
+
```json
|
|
380
|
+
{
|
|
381
|
+
"status": "healthy",
|
|
382
|
+
"version": "1.0.3",
|
|
383
|
+
"timestamp": "2026-02-08T12:00:00.000Z"
|
|
384
|
+
}
|
|
385
|
+
```
|
|
163
386
|
|
|
164
|
-
###
|
|
387
|
+
### Prometheus 指标
|
|
165
388
|
|
|
166
|
-
|
|
167
|
-
|
|
389
|
+
```bash
|
|
390
|
+
curl http://localhost:3000/metrics
|
|
391
|
+
```
|
|
168
392
|
|
|
169
|
-
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## 🧪 开发
|
|
170
396
|
|
|
171
397
|
```bash
|
|
172
|
-
#
|
|
398
|
+
# 克隆项目
|
|
173
399
|
git clone https://github.com/your-org/feishu-bridge.git
|
|
174
400
|
cd feishu-bridge
|
|
175
401
|
|
|
176
|
-
#
|
|
402
|
+
# 安装依赖
|
|
177
403
|
npm install
|
|
178
404
|
|
|
179
|
-
#
|
|
405
|
+
# 开发模式(热重载)
|
|
406
|
+
npm run dev
|
|
407
|
+
|
|
408
|
+
# 构建
|
|
180
409
|
npm run build
|
|
181
410
|
|
|
182
|
-
#
|
|
183
|
-
npm
|
|
411
|
+
# 测试
|
|
412
|
+
npm test
|
|
413
|
+
|
|
414
|
+
# 运行
|
|
415
|
+
npm start
|
|
184
416
|
```
|
|
185
417
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
│ └── daemon.ts # Process daemon & auto-restart
|
|
196
|
-
├── feishu/ # Feishu integration
|
|
197
|
-
│ ├── client.ts # Feishu API client
|
|
198
|
-
│ ├── webhook.ts # Webhook handler with signature verification
|
|
199
|
-
│ ├── websocket.ts # WebSocket connection handler
|
|
200
|
-
│ └── types.ts # Feishu type definitions
|
|
201
|
-
├── adapters/ # IDE/CLI adapters (7 implementations)
|
|
202
|
-
│ ├── base.ts # Adapter base class
|
|
203
|
-
│ ├── vscode.ts # VS Code adapter
|
|
204
|
-
│ ├── cursor.ts # Cursor adapter
|
|
205
|
-
│ ├── opencode.ts # OpenCode adapter (Socket)
|
|
206
|
-
│ └── ...
|
|
207
|
-
├── cli/ # CLI implementation
|
|
208
|
-
│ ├── index.ts # CLI entry & commands
|
|
209
|
-
│ └── config.ts # Config management
|
|
210
|
-
├── commands/ # Command processing
|
|
211
|
-
│ ├── executor.ts # Command executor
|
|
212
|
-
│ └── parser.ts # Command parser
|
|
213
|
-
├── session/ # Session management
|
|
214
|
-
│ └── manager.ts # Session manager
|
|
215
|
-
└── utils/ # Utility functions
|
|
216
|
-
└── http.ts # HTTP utilities
|
|
217
|
-
|
|
218
|
-
scripts/ # Installation scripts
|
|
219
|
-
├── install.sh # Linux/macOS installer
|
|
220
|
-
├── install.ps1 # Windows installer
|
|
221
|
-
└── install-hook.sh # Auto-start hook installer
|
|
222
|
-
|
|
223
|
-
tests/ # Test suite (54 tests)
|
|
224
|
-
├── unit/ # Unit tests
|
|
225
|
-
└── integration/ # Integration tests
|
|
226
|
-
```
|
|
227
|
-
|
|
228
|
-
## Contributing
|
|
229
|
-
|
|
230
|
-
1. Fork the repository
|
|
231
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
232
|
-
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
|
|
233
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
234
|
-
5. Open a Pull Request
|
|
235
|
-
|
|
236
|
-
## License
|
|
237
|
-
|
|
238
|
-
MIT License
|
|
418
|
+
---
|
|
419
|
+
|
|
420
|
+
## 📄 许可证
|
|
421
|
+
|
|
422
|
+
MIT License
|
|
423
|
+
|
|
424
|
+
---
|
|
425
|
+
|
|
426
|
+
**Happy Coding!** 🚀
|