feishu-user-plugin 1.2.0 → 1.3.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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "feishu-user-plugin",
3
- "version": "1.2.0",
4
- "description": "All-in-one Feishu plugin for Claude Code — send messages as yourself, read chats, manage docs/tables/wiki. 33 tools + 9 skills, 3 auth layers.",
3
+ "version": "1.3.0",
4
+ "description": "All-in-one Feishu plugin for Claude Code — messaging, docs, bitable, calendar, tasks, drive. 76 tools + 9 skills, 3 auth layers.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
7
7
  "feishu-user-plugin": "src/cli.js"
@@ -3,17 +3,17 @@
3
3
  ## What This Is
4
4
  All-in-one Feishu plugin for Claude Code with three auth layers:
5
5
  - **User Identity** (cookie auth): Send messages (text, image, file, post, sticker, audio) as yourself
6
- - **Official API** (app credentials): Read group messages, docs, tables, wiki, drive, contacts
6
+ - **Official API** (app credentials): Read group messages, docs, tables, wiki, drive, contacts, upload files
7
7
  - **User OAuth UAT** (user_access_token): Read P2P chat history, list all user's chats
8
8
 
9
- ## Tool Categories
9
+ ## Tool Categories (76 tools)
10
10
 
11
11
  ### User Identity — Messaging (reverse-engineered, cookie-based)
12
- - `send_to_user` — Search user + send text (one step, most common)
13
- - `send_to_group` — Search group + send text (one step)
12
+ - `send_to_user` — Search user + send text (one step, most common). Returns candidates if multiple matches.
13
+ - `send_to_group` — Search group + send text (one step). Returns candidates if multiple matches.
14
14
  - `send_as_user` — Send text to any chat by ID, supports reply threading (root_id/parent_id)
15
- - `send_image_as_user` — Send image (requires image_key from upload)
16
- - `send_file_as_user` — Send file (requires file_key from upload)
15
+ - `send_image_as_user` — Send image (requires image_key from `upload_image`)
16
+ - `send_file_as_user` — Send file (requires file_key from `upload_file`)
17
17
  - `send_post_as_user` — Send rich text with title + formatted paragraphs
18
18
  - `send_sticker_as_user` — Send sticker/emoji
19
19
  - `send_audio_as_user` — Send audio message
@@ -21,64 +21,176 @@ All-in-one Feishu plugin for Claude Code with three auth layers:
21
21
  ### User Identity — Contacts & Info
22
22
  - `search_contacts` — Search users/groups by name
23
23
  - `create_p2p_chat` — Create/get P2P chat
24
- - `get_chat_info` — Group details (name, members, owner)
25
- - `get_user_info` — User display name lookup (from search cache)
24
+ - `get_chat_info` — Group details (name, members, owner). Supports both oc_xxx and numeric chat_id (Official API + protobuf fallback)
25
+ - `get_user_info` — User display name lookup (official API first, cookie cache fallback)
26
26
  - `get_login_status` — Check cookie, app, and UAT status
27
27
 
28
28
  ### User OAuth UAT Tools (P2P chat reading)
29
- - `read_p2p_messages` — Read P2P (direct message) chat history. chat_id accepts both numeric IDs (from create_p2p_chat) and oc_xxx format.
29
+ - `read_p2p_messages` — Read P2P (direct message) chat history. chat_id accepts both numeric IDs (from create_p2p_chat) and oc_xxx format. Returns newest messages first by default.
30
30
  - `list_user_chats` — List group chats the user is in. Note: API only returns groups, not P2P. For P2P, use: `search_contacts` → `create_p2p_chat` → `read_p2p_messages`.
31
31
 
32
32
  ### Official API Tools (app credentials)
33
- - `list_chats` / `read_messages` — Chat history (accepts chat name, oc_ ID, or numeric ID; auto-falls back to UAT for external groups)
34
- - `reply_message` / `forward_message` Message operations (as bot). reply_message only works for text messages.
35
- - `search_docs` / `read_doc` / `create_doc` Document operations
36
- - `list_bitable_tables` / `list_bitable_fields` / `search_bitable_records` Table queries
37
- - `create_bitable_record` / `update_bitable_record` — Table writes
33
+ - `list_chats` / `read_messages` — Chat history (read_messages accepts chat name, oc_ ID, or numeric ID; auto-resolves via bot's group list → im.chat.search → search_contacts). **Auto-falls back to UAT for external groups the bot cannot access.** Returns newest messages first by default. Messages include sender names.
34
+ - `send_message_as_bot` — Bot sends message to any chat (text, post, interactive, etc.)
35
+ - `reply_message` / `forward_message` Message operations (as bot)
36
+ - `delete_message` / `update_message` Recall or edit bot's own messages
37
+ - `add_reaction` / `delete_reaction` — Emoji reactions on messages
38
+ - `pin_message` / `unpin_message` — Pin/unpin messages in chat
39
+ - `create_group` / `update_group` — Create and manage group chats
40
+ - `list_members` / `add_members` / `remove_members` — Group membership management
41
+ - `search_docs` / `read_doc` / `get_doc_blocks` / `create_doc` — Document operations
42
+ - `create_doc_block` / `update_doc_block` / `delete_doc_blocks` — Document content editing (insert/update/delete blocks)
43
+ - `create_bitable` — Create a new Bitable (multi-dimensional table) app
44
+ - `list_bitable_tables` / `create_bitable_table` — Table management
45
+ - `list_bitable_fields` / `create_bitable_field` / `update_bitable_field` / `delete_bitable_field` — Field (column) management
46
+ - `list_bitable_views` — List views in a table
47
+ - `search_bitable_records` — Query records with filter/sort
48
+ - `create_bitable_record` / `update_bitable_record` / `delete_bitable_record` — Single record CRUD
49
+ - `batch_create_bitable_records` / `batch_update_bitable_records` / `batch_delete_bitable_records` — Batch operations (max 500/call)
38
50
  - `list_wiki_spaces` / `search_wiki` / `list_wiki_nodes` — Wiki
39
51
  - `list_files` / `create_folder` — Drive
52
+ - `copy_file` / `move_file` / `delete_file` — Drive file operations (copy, move, delete)
53
+ - `upload_image` / `upload_file` — Upload image/file, returns key for send_image/send_file
40
54
  - `find_user` — Contact lookup by email/mobile
55
+ - `list_calendars` / `create_calendar_event` / `list_calendar_events` / `delete_calendar_event` — Calendar management
56
+ - `get_freebusy` — Check user availability
57
+ - `create_task` / `get_task` / `list_tasks` / `update_task` / `complete_task` — Task management
41
58
 
42
59
  ## Usage Patterns
60
+
61
+ ### Messaging
43
62
  - Send text as yourself → `send_to_user` or `send_to_group`
44
- - Send rich content → `send_post_as_user` (formatted text), `send_image_as_user` (images)
63
+ - Send image → `upload_image` `send_image_as_user`
64
+ - Send file → `upload_file` → `send_file_as_user`
65
+ - Send rich content → `send_post_as_user` (formatted text with links, @mentions)
66
+ - Reply as user in thread → `send_as_user` with root_id
67
+ - Reply as bot → `reply_message` (official API)
68
+
69
+ ### Reading
45
70
  - Read any group chat history → `read_messages` with chat name or ID (auto-handles external groups via UAT fallback)
46
71
  - Read P2P chat history → `search_contacts` → `create_p2p_chat` → `read_p2p_messages`
47
- - Reply as user in thread → `send_as_user` with root_id
48
- - Reply as bot → `reply_message` (official API, text messages only)
72
+ - Get chat details → `get_chat_info` (supports both oc_xxx and numeric ID)
73
+
74
+ ### Bitable (Multi-dimensional Tables)
75
+ - Create a bitable from scratch → `create_bitable` → `create_bitable_table` → `create_bitable_field`
76
+ - Query data → `list_bitable_tables` → `list_bitable_fields` → `search_bitable_records`
77
+ - Single record CRUD → `create_bitable_record` / `update_bitable_record` / `delete_bitable_record`
78
+ - Bulk operations → `batch_create_bitable_records` / `batch_update_bitable_records` / `batch_delete_bitable_records` (max 500/call)
79
+ - Manage fields → `create_bitable_field` / `update_bitable_field` (requires type param) / `delete_bitable_field`
80
+
81
+ ### Group Management
82
+ - Create a group → `create_group` with name and optional member open_ids
83
+ - Add/remove members → `add_members` / `remove_members` with chat_id + user open_ids
84
+ - List members → `list_members`
85
+
86
+ ### Document Editing
87
+ - Create doc with content → `create_doc` → `create_doc_block` (use document_id as parent_block_id for root)
88
+ - Edit existing block → `get_doc_blocks` to find block_id → `update_doc_block`
89
+ - Delete blocks → `delete_doc_blocks` with start/end index range
90
+
91
+ ### Calendar
92
+ - View schedule → `list_calendars` → `list_calendar_events`
93
+ - Create event → `create_calendar_event` with calendar_id, summary, start/end time
94
+ - Check availability → `get_freebusy` with user open_ids and time range
95
+
96
+ ### Tasks
97
+ - Create task → `create_task` with summary, optional description/due
98
+ - Track tasks → `list_tasks` → `update_task` / `complete_task`
99
+
100
+ ### Diagnostics
49
101
  - Diagnose issues → `get_login_status` first
50
102
 
51
103
  ## Auth & Session
52
- - **LARK_COOKIE**: Required for user identity tools. Session auto-refreshed every 4h via heartbeat.
104
+ - **LARK_COOKIE**: Required for user identity tools. Session auto-refreshed every 4h via heartbeat and persisted to config.
53
105
  - **LARK_APP_ID + LARK_APP_SECRET**: Required for official API tools.
54
- - **LARK_USER_ACCESS_TOKEN + LARK_USER_REFRESH_TOKEN**: Required for P2P reading. Auto-refreshed via refresh_token.
106
+ - **LARK_USER_ACCESS_TOKEN + LARK_USER_REFRESH_TOKEN**: Required for P2P reading. Auto-refreshed on expiry (error codes 99991668/99991663/99991677). Token auto-persisted to MCP config on refresh.
107
+ - Cookie expiry: sl_session has 12h max-age, auto-refreshed by heartbeat every 4h.
108
+ - UAT expiry: 2h, auto-refreshed via refresh_token.
109
+ - Refresh token expiry: 7 days. Use `keepalive` cron to prevent expiration.
55
110
 
56
- ## Automated Cookie Setup via Playwright
111
+ ## Required Environment Variables (ALL are required for full functionality)
112
+
113
+ | Variable | Purpose |
114
+ |----------|---------|
115
+ | LARK_COOKIE | User identity messaging |
116
+ | LARK_APP_ID | Official API access |
117
+ | LARK_APP_SECRET | Official API access |
118
+ | LARK_USER_ACCESS_TOKEN | P2P chat reading |
119
+ | LARK_USER_REFRESH_TOKEN | UAT auto-refresh |
120
+
121
+ All 5 must be configured. Without UAT, `read_p2p_messages` and `list_user_chats` will not work.
122
+
123
+ ## Installation
124
+
125
+ ### Config location
126
+
127
+ Credentials are stored in `~/.claude.json` top-level `mcpServers` (global — works in all directories).
128
+ **Do NOT put credentials in project-level config** (`projects[*].mcpServers` or `.mcp.json`) — this causes scope issues.
129
+
130
+ ### Non-interactive setup (for Claude Code agents)
131
+
132
+ ```bash
133
+ npx feishu-user-plugin setup --app-id <APP_ID> --app-secret <APP_SECRET>
134
+ ```
57
135
 
58
- When LARK_COOKIE is missing or expired, obtain it using Playwright MCP.
136
+ Writes config to `~/.claude.json` top-level `mcpServers` without any interactive prompts. Supports `--cookie` flag too.
137
+
138
+ ### Interactive setup
139
+
140
+ ```bash
141
+ npx feishu-user-plugin setup # Interactive setup wizard
142
+ npx feishu-user-plugin oauth # Get OAuth UAT tokens
143
+ npx feishu-user-plugin status # Check auth status
144
+ npx feishu-user-plugin keepalive # Refresh cookie + UAT (for cron jobs)
145
+ ```
146
+
147
+ ### Token auto-renewal via cron (optional)
148
+
149
+ To keep tokens alive even when Claude Code is closed:
150
+
151
+ ```bash
152
+ crontab -e
153
+ # Add: 0 */4 * * * npx feishu-user-plugin keepalive >> /tmp/feishu-keepalive.log 2>&1
154
+ ```
155
+
156
+ ## Automated Cookie Setup via Playwright
59
157
 
60
158
  ### Prerequisites
61
- Playwright MCP must be available. If not:
62
- > Run: `npx @anthropic-ai/claude-code mcp add playwright -- npx @anthropic-ai/mcp-server-playwright`
63
- > Then restart Claude Code.
159
+ Playwright MCP must be available. If not installed:
160
+ > Run: `npx @anthropic-ai/claude-code mcp add playwright -- npx @anthropic-ai/mcp-server-playwright` then restart Claude Code.
64
161
 
65
- ### Automated Flow — FOLLOW EXACTLY
162
+ ### Automated Flow — FOLLOW EXACTLY, DO NOT IMPROVISE
66
163
 
67
- **Step 1: Clear cookies first** (Playwright uses persistent browser profile that may have a DIFFERENT account cached):
164
+ **Step 1: Clear existing browser session (MANDATORY)**
165
+
166
+ Playwright MCP uses Edge's persistent profile. It may have a cached login from a DIFFERENT Feishu account. You MUST clear cookies first:
167
+
168
+ ```
169
+ browser_run_code:
170
+ await context.clearCookies();
171
+ ```
172
+
173
+ Then navigate:
68
174
  ```
69
- browser_run_code: await context.clearCookies();
70
175
  browser_navigate: https://www.feishu.cn/messenger/
71
176
  ```
72
177
 
73
- **Step 2: Show QR code and wait for login**:
178
+ **Step 2: Wait for user to scan QR code**
179
+
180
+ Take a screenshot to show the QR code:
74
181
  ```
75
182
  browser_take_screenshot
76
183
  ```
77
- Poll `browser_snapshot` every 5s until URL changes from `/accounts/`.
78
184
 
79
- **Step 3: Extract cookie TWO-STEP approach** (NEVER use browser_run_code output directly as cookie):
185
+ Tell the user: "Please scan the QR code with Feishu mobile app to log in. Make sure you use the correct account."
186
+
187
+ Poll with `browser_snapshot` every 5 seconds until the URL changes away from `/accounts/` (indicating login complete).
188
+
189
+ **Step 3: Extract cookie — TWO-STEP approach (MANDATORY)**
190
+
191
+ NEVER use `browser_run_code` output directly as the cookie string. Its output includes `### Result\n` markdown prefix, page snapshots, and console logs that contaminate the cookie.
80
192
 
81
- Step 3a via `browser_run_code`:
193
+ Step 3a — Store cookie in page context via `browser_run_code`:
82
194
  ```js
83
195
  const cookies = await page.context().cookies('https://www.feishu.cn');
84
196
  const str = cookies.map(c => c.name + '=' + c.value).join('; ');
@@ -86,47 +198,170 @@ await page.evaluate(s => { window.__COOKIE__ = s; }, str);
86
198
  return 'Stored ' + cookies.length + ' cookies, length=' + str.length;
87
199
  ```
88
200
 
89
- Step 3b via `browser_evaluate`:
201
+ Step 3b — Read the clean cookie string via `browser_evaluate`:
90
202
  ```js
91
203
  window.__COOKIE__
92
204
  ```
93
205
 
94
- **Step 4: Validate** Must be pure ASCII, contain `session=` and `sl_session=`, length 500-5000. If >10000, it's contaminated.
206
+ This two-step approach ensures the cookie string is clean, with no markdown prefix or page content mixed in.
95
207
 
96
- **Step 5: Write config** using exact format:
97
- ```json
98
- {
99
- "feishu-user-plugin": {
100
- "command": "npx",
101
- "args": ["-y", "feishu-user-plugin"],
102
- "env": {
103
- "LARK_COOKIE": "<cookie>",
104
- "LARK_APP_ID": "<id>",
105
- "LARK_APP_SECRET": "<secret>",
106
- "LARK_USER_ACCESS_TOKEN": "<uat>",
107
- "LARK_USER_REFRESH_TOKEN": "<refresh>"
108
- }
109
- }
110
- }
208
+ **Step 4: Validate BEFORE writing (MANDATORY)**
209
+
210
+ Check the cookie string:
211
+ 1. Must be pure ASCII — no Chinese characters, no markdown (`###`), no HTML
212
+ 2. Must contain `session=` and `sl_session=`
213
+ 3. Length should be 500-5000 characters. If >10000, it is contaminated — DO NOT write it.
214
+ 4. Must NOT start with `###` or contain `\n` followed by non-cookie content
215
+
216
+ If validation fails: STOP. Debug the extraction. Do NOT write a bad cookie to config.
217
+
218
+ **Step 5: Write cookie to config**
219
+
220
+ Use `persistToConfig` or directly update the `LARK_COOKIE` field in `~/.claude.json` → `mcpServers` → `feishu-user-plugin` → `env`.
221
+
222
+ **Step 6: Run OAuth for UAT (if not already configured)**
223
+
224
+ ```bash
225
+ npx feishu-user-plugin oauth
226
+ ```
227
+
228
+ This opens a browser for OAuth consent. After completion, tokens are auto-saved to `~/.claude.json`.
229
+
230
+ **Step 7: Close browser and prompt restart**
231
+
232
+ ```
233
+ browser_close
111
234
  ```
112
235
 
113
- ## Troubleshooting
236
+ Tell user to restart Claude Code. Only ONE restart should be needed.
237
+
238
+ ## Troubleshooting Guide
239
+
240
+ ### If MCP tools are not available
241
+ 1. Check `~/.claude.json` — config must be in **top-level** `mcpServers`, not inside `projects[*]`
242
+ 2. Restart Claude Code after config changes
243
+ 3. After restart, tools may take a few seconds to register — if first call fails with "No such tool", wait and retry once
114
244
 
115
245
  ### If cookie authentication fails
246
+ - `document.cookie` in browser console CANNOT access HttpOnly cookies (`session`, `sl_session`)
247
+ - **Correct method**: Network tab → first request → Request Headers → Cookie → Copy value
116
248
  - **Best method**: Playwright two-step extraction (see above)
117
- - **Manual fallback**: Network tab → first request → Request Headers → Cookie → Copy value
118
- - Do NOT use `document.cookie` or Application → Cookies (misses HttpOnly cookies)
119
249
 
120
- ### If Playwright logs into the wrong account
121
- - Always `context.clearCookies()` BEFORE navigating to feishu.cn
122
- - Verify account by checking URL domain after login
250
+ ### If Playwright logs into the wrong Feishu account
251
+ - Playwright uses Edge's persistent profile with cached sessions
252
+ - **ALWAYS clear cookies first** with `context.clearCookies()` before navigating to feishu.cn
253
+
254
+ ### If read_messages returns an error
255
+ - Error messages include the actual Feishu error code and description
256
+ - `read_messages` auto-falls back to UAT when bot API fails (e.g. external groups)
257
+ - Chat name resolution: bot's group list → `im.chat.search` → `search_contacts` (cookie)
258
+ - If all three strategies fail, provide the oc_xxx or numeric chat ID directly
123
259
 
124
- ### If UAT refresh fails with "invalid_grant" (error 28003/20003/20005)
125
- - Refresh token expired re-run `node src/oauth.js` (needs LARK_APP_ID + LARK_APP_SECRET in `.env`)
126
- - Copy new UAT + refresh token from `.env` to MCP config, then restart Claude Code
260
+ ### If UAT refresh fails with "invalid_grant"
261
+ - The refresh token has expired or been revoked auto-refresh cannot recover this
262
+ - **Fix**: Re-run OAuth: `npx feishu-user-plugin oauth`
263
+ - Then restart Claude Code
264
+
265
+ ### If OAuth fails with "Missing LARK_APP_ID"
266
+ - `oauth.js` reads credentials from `~/.claude.json` MCP config (not .env)
267
+ - Run `npx feishu-user-plugin setup` first, then re-run OAuth
268
+
269
+ ### If two MCP servers are running (duplicate tools)
270
+ - This happens when both `~/.claude.json` mcpServers AND a team-skills plugin have feishu-user-plugin
271
+ - team-skills plugin should NOT have `.mcp.json` — it only provides skills and CLAUDE.md
272
+ - Delete `.mcp.json` from the team-skills plugin directory if it exists
127
273
 
128
274
  ### If list_user_chats doesn't return P2P chats
129
- - Expected — API only returns groups. Use: `search_contacts` → `create_p2p_chat` → `read_p2p_messages`.
275
+ - This is expected the API only returns group chats
276
+ - **Correct P2P flow**: `search_contacts` → `create_p2p_chat` → `read_p2p_messages`
277
+
278
+ ## Architecture
279
+
280
+ ### Two distribution channels
281
+ - **npm package** (`npx feishu-user-plugin`): MCP server code + skills + CLAUDE.md. For external users.
282
+ - **team-skills plugin**: Skills + CLAUDE.md only (no .mcp.json). For internal team members.
283
+
284
+ ### Config management
285
+ - `src/config.js`: Unified config module. Discovers config in `~/.claude.json` (top-level + project-level) and `.mcp.json`.
286
+ - `setup` always writes to `~/.claude.json` top-level `mcpServers` (global).
287
+ - `persistToConfig()` finds the correct config entry and writes back (used by heartbeat + UAT refresh).
288
+
289
+ ## Development & Publishing
290
+
291
+ ### Publishing to npm
292
+
293
+ ```bash
294
+ # 1. Update version in package.json
295
+ # 2. Commit and tag
296
+ git add -A && git commit -m "v1.2.1: description"
297
+ git tag v1.2.1
298
+ git push && git push --tags
299
+ # 3. GitHub Actions auto-publishes to npm on tag push
300
+ ```
301
+
302
+ GitHub Actions workflow (`.github/workflows/publish.yml`) auto-publishes on `v*` tags.
303
+ NPM_TOKEN is stored as a GitHub repo secret.
304
+
305
+ ### Syncing to team-skills
306
+
307
+ After publishing, sync plugin assets to team-skills:
308
+
309
+ ```bash
310
+ # From the feishu-user-plugin repo:
311
+ cp -r skills/ /path/to/team-skills/plugins/feishu-user-plugin/skills/
312
+ cp .claude-plugin/plugin.json /path/to/team-skills/plugins/feishu-user-plugin/.claude-plugin/
313
+ # Do NOT copy .mcp.json — team-skills plugin should not have one
314
+ ```
315
+
316
+ ## Development Workflow
317
+
318
+ ### Keeping ROADMAP.md up to date
319
+ - When completing a feature or fixing a bug, check the corresponding item in ROADMAP.md as `[x]` done
320
+ - When discovering new bugs, limitations, or feature ideas during development, add them to the appropriate section in ROADMAP.md
321
+ - When a version is released (tag pushed), move completed items under the "已完成" section with the version number
322
+ - When researching a direction and deciding not to implement, add it to "已调研但暂不实施" with the reasoning
323
+
324
+ ### When adding new tools
325
+ 1. Add method to `src/official.js`(Official API)or `src/client.js`(Cookie 身份)
326
+ 2. Add tool definition to `TOOLS` array in `src/index.js`
327
+ 3. Add handler case in `handleTool()` switch in `src/index.js`
328
+ 4. Run `node -c src/official.js && node -c src/index.js` to verify syntax
329
+ 5. Update this file (CLAUDE.md) — tool count, tool list, usage patterns
330
+ 6. Update ROADMAP.md if relevant
331
+
332
+ ### When fixing bugs
333
+ 1. Write a standalone test script (`node -e "..."`) to reproduce the bug before fixing
334
+ 2. After fixing, verify with the same script
335
+ 3. If the bug affects MCP tool behavior, test via MCP tool call after server restart
336
+
337
+ ### Commit conventions
338
+ - `feat:` new tools or capabilities
339
+ - `fix:` bug fixes
340
+ - `docs:` CLAUDE.md, ROADMAP.md, README updates
341
+ - `chore:` dependencies, CI, config changes
342
+
343
+ ### Publishing
344
+ 1. Update `version` in `package.json`
345
+ 2. `git add <files> && git commit -m "v1.x.x: description"`
346
+ 3. `git tag v1.x.x && git push && git push --tags`
347
+ 4. GitHub Actions auto-publishes to npm. Users get the new version on next Claude Code restart.
348
+
349
+ ### Syncing to team-skills (after any CLAUDE.md or skills change)
350
+ 1. Copy CLAUDE.md to skill reference: `cp CLAUDE.md skills/feishu-user-plugin/references/CLAUDE.md`
351
+ 2. Sync to team-skills repo: `cp -r skills/ /Users/abble/team-skills/plugins/feishu-user-plugin/skills/`
352
+ 3. Also sync plugin.json: `cp .claude-plugin/plugin.json /Users/abble/team-skills/plugins/feishu-user-plugin/.claude-plugin/`
353
+ 4. Commit and push both repos
354
+
355
+ ### Testing a tool
356
+ - For Official API tools: can test directly via MCP tool call or standalone script using `readCredentials()` from `src/config.js`
357
+ - For Cookie tools: need active session, test via MCP tool call
358
+ - Always verify `_safeSDKCall` handles the response format (multipart uploads return data at top level, not nested under `.data`)
130
359
 
131
- ### If reply_message fails with error 230054
132
- - Only text messages can be replied to via this API.
360
+ ## Known Limitations
361
+ - CARD message type (type=14) not yet implemented complex JSON schema
362
+ - External tenant users may not be resolvable via `get_user_info` (contact API scope limitation)
363
+ - Cookie auth requires human interaction (QR scan) — cannot be fully automated
364
+ - Refresh token expires after 7 days without use — set up `keepalive` cron to prevent this
365
+ - `update_bitable_field` requires `type` parameter even when only changing field name (Feishu API requirement)
366
+ - `list_wiki_spaces` may return empty if bot lacks `wiki:wiki:readonly` permission
367
+ - `search_wiki` uses same API as `search_docs` — `docs_types` filter may not work as expected