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 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
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLIๅ…ฅๅฃๆ–‡ไปถ - ๅง”ๆ‰˜ๅˆฐ็ผ–่ฏ‘ๅŽ็š„CLI
4
+ */
5
+ require('../dist/cli/index.js');
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }