feishu-bridge 1.0.0
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 +238 -0
- package/bin/feishu-bridge.js +5 -0
- package/dist/cli/index.d.mts +2 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +3324 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/index.mjs +3309 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/index.d.mts +114 -0
- package/dist/index.d.ts +114 -0
- package/dist/index.js +2832 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2800 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +80 -0
package/README.md
ADDED
|
@@ -0,0 +1,238 @@
|
|
|
1
|
+
# Feishu Bridge
|
|
2
|
+
|
|
3
|
+
๐ ่ฝป้็บง้ฃไนฆๆไปถ๏ผๆกฅๆฅ้ฃไนฆไธๅ็งAI็ผ็จIDE/CLIๅทฅๅ
ท
|
|
4
|
+
|
|
5
|
+
## โจ ็นๆง
|
|
6
|
+
|
|
7
|
+
- **๐ฏ ้ถไพ่ต**: ๆ ้OpenClaw๏ผ็ฌ็ซ่ฟ่ก
|
|
8
|
+
- **๐ ๅคIDEๆฏๆ**: VS Code, Cursor, Trae, OpenCode, Claude Code, Kiro, Antigravity
|
|
9
|
+
- **๐ฌ ๅ
จไบคไบ**: ้่ฟ้ฃไนฆๅฎๆๆๆๆไฝ๏ผ็ปๆ่ฟๅ้ฃไนฆ
|
|
10
|
+
- **๐ ๅฎๅ
จ**: Webhook็ญพๅ้ช่ฏ(HMAC-SHA256)๏ผ้ฒ้ๆพๆปๅป
|
|
11
|
+
- **๐ ็ๆง**: ๅฅๅบทๆฃๆฅ็ซฏ็น๏ผPrometheusๆๆ
|
|
12
|
+
- **๐ง ๅฎๆดCLI**: ้
็ฝฎ็ฎก็ใๅฎๆค่ฟ็จใ็ถๆ็ๆง
|
|
13
|
+
- **โก ่ชๅจๅฏๅจ**: Shell hook่ชๅจๆฃๆตIDE็ฏๅขๅนถๅฏๅจๆๅก
|
|
14
|
+
- **๐ ๅๆจกๅผ**: WebSocketๅWebhookๅ่ฟๆฅๆจกๅผๆฏๆ
|
|
15
|
+
- **๐พ ๅค็จ้ไฟก**: ๆไปถ็ณป็ปIPCๆบๅถ็กฎไฟๅฏ้ ๆง
|
|
16
|
+
|
|
17
|
+
## ๐ฆ ๅฎ่ฃ
|
|
18
|
+
|
|
19
|
+
### ๆนๅผไธ: curlไธ้ฎๅฎ่ฃ
(ๆจ่)
|
|
20
|
+
|
|
21
|
+
**Linux/macOS:**
|
|
22
|
+
```bash
|
|
23
|
+
curl -fsSL https://install.feishu-bridge.dev | bash
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Windows (PowerShell):**
|
|
27
|
+
```powershell
|
|
28
|
+
iwr -useb https://install.feishu-bridge.dev/install.ps1 | iex
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### ๆนๅผไบ: npmๅ
จๅฑๅฎ่ฃ
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g feishu-bridge
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### ๆนๅผไธ: ๆๅจๅฎ่ฃ
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
git clone https://github.com/your-org/feishu-bridge.git
|
|
41
|
+
cd feishu-bridge
|
|
42
|
+
npm install
|
|
43
|
+
npm run build
|
|
44
|
+
npm link
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Architecture
|
|
48
|
+
|
|
49
|
+
```
|
|
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
|
+
|
|
82
|
+
# Configure your Feishu app credentials
|
|
83
|
+
feishu-bridge config set appId YOUR_APP_ID
|
|
84
|
+
feishu-bridge config set appSecret YOUR_APP_SECRET
|
|
85
|
+
|
|
86
|
+
# Start the server
|
|
87
|
+
feishu-bridge start
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### Manual Install
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# Clone the repository
|
|
94
|
+
git clone https://github.com/your-org/feishu-bridge.git
|
|
95
|
+
cd feishu-bridge
|
|
96
|
+
|
|
97
|
+
# Install dependencies
|
|
98
|
+
npm install
|
|
99
|
+
|
|
100
|
+
# Build the project
|
|
101
|
+
npm run build
|
|
102
|
+
|
|
103
|
+
# Start the server
|
|
104
|
+
npm start
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Configuration
|
|
108
|
+
|
|
109
|
+
Create a `.env` file in your project root:
|
|
110
|
+
|
|
111
|
+
```env
|
|
112
|
+
FEISHU_APP_ID=your_app_id
|
|
113
|
+
FEISHU_APP_SECRET=your_app_secret
|
|
114
|
+
FEISHU_ENCRYPT_KEY=your_encrypt_key (optional)
|
|
115
|
+
FEISHU_VERIFICATION_TOKEN=your_verification_token (optional)
|
|
116
|
+
SERVER_PORT=3000
|
|
117
|
+
SERVER_HOST=0.0.0.0
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Usage
|
|
121
|
+
|
|
122
|
+
### CLI Commands
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
# Configuration
|
|
126
|
+
feishu-bridge config set appId <value>
|
|
127
|
+
feishu-bridge config set appSecret <value>
|
|
128
|
+
feishu-bridge config list
|
|
129
|
+
|
|
130
|
+
# Service management
|
|
131
|
+
feishu-bridge start # Start service
|
|
132
|
+
feishu-bridge start --daemon # Start in daemon mode
|
|
133
|
+
feishu-bridge daemon start # Start daemon
|
|
134
|
+
feishu-bridge daemon stop # Stop daemon
|
|
135
|
+
feishu-bridge status # Check service status
|
|
136
|
+
|
|
137
|
+
# Auto-start hook (install once)
|
|
138
|
+
curl -fsSL https://install.feishu-bridge.dev/hook.sh | bash
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Feishu Commands
|
|
142
|
+
|
|
143
|
+
Once the server is running, interact with your IDEs/CLIs directly from Feishu:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
@vscode /generate Create a React component for a todo list
|
|
147
|
+
@cursor /run npm start
|
|
148
|
+
@opencode /ask How do I implement authentication in Express.js?
|
|
149
|
+
@claude-code /explain this function
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Supported Commands
|
|
153
|
+
|
|
154
|
+
- `@vscode`: Interact with VS Code and GitHub Copilot
|
|
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
|
|
161
|
+
|
|
162
|
+
## Development
|
|
163
|
+
|
|
164
|
+
### Prerequisites
|
|
165
|
+
|
|
166
|
+
- Node.js 18+
|
|
167
|
+
- npm or yarn
|
|
168
|
+
|
|
169
|
+
### Setup
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Clone the repository
|
|
173
|
+
git clone https://github.com/your-org/feishu-bridge.git
|
|
174
|
+
cd feishu-bridge
|
|
175
|
+
|
|
176
|
+
# Install dependencies
|
|
177
|
+
npm install
|
|
178
|
+
|
|
179
|
+
# Build the project
|
|
180
|
+
npm run build
|
|
181
|
+
|
|
182
|
+
# Start in development mode
|
|
183
|
+
npm run dev
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Project Structure
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
src/
|
|
190
|
+
โโโ core/ # Core modules
|
|
191
|
+
โ โโโ bridge.ts # Main bridge coordinator
|
|
192
|
+
โ โโโ config.ts # Configuration management
|
|
193
|
+
โ โโโ logger.ts # Logging system
|
|
194
|
+
โ โโโ health.ts # Health monitoring & metrics
|
|
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
|