larkcc 0.1.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/CHANGELOG.md ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.0] - 2025-03-24
9
+
10
+ ### Added
11
+
12
+ - Initial release
13
+ - Feishu/Lark bot integration with Claude Code
14
+ - WebSocket real-time message handling
15
+ - Slash commands support (`/review`, `/fix`, `/commit`, `/pr`, etc.)
16
+ - Multi-profile support for multiple bots
17
+ - Session persistence with `--continue` flag
18
+ - Image and file handling
19
+ - Multi-file mode for batch file analysis
20
+ - Cloud document overflow for long messages
21
+ - Group chat support via @ mentions
22
+ - Auto-detection of owner's `open_id`
23
+ - Process locking to prevent conflicts
24
+ - Task control with `/stop` command
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 suj1e
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,617 @@
1
+ # larkcc
2
+
3
+ [![npm version](https://badge.fury.io/js/larkcc.svg)](https://badge.fury.io/js/larkcc)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ Claude Code in Feishu — 在任意项目目录启动,通过飞书机器人与 Claude 对话,体验等同于终端直接使用 Claude Code。
7
+
8
+ ## 安装
9
+
10
+ ```bash
11
+ git clone <repo>
12
+ cd larkcc
13
+ chmod +x install.sh
14
+ ./install.sh
15
+ ```
16
+
17
+ ## 快速开始
18
+
19
+ ```bash
20
+ # 1. 配置默认机器人(只需填 App ID 和 Secret)
21
+ larkcc --setup
22
+
23
+ # 2. 在你的项目目录启动
24
+ cd /your/project
25
+ larkcc
26
+
27
+ # 3. 给机器人发任意一条消息,自动检测并保存你的 open_id
28
+ # ✅ Auto-detected open_id: ou_xxx
29
+ # 之后就可以正常使用了
30
+ ```
31
+
32
+ ## 命令
33
+
34
+ ```bash
35
+ # 启动
36
+ larkcc # 默认机器人,新会话
37
+ larkcc --continue # 默认机器人,续接上次会话
38
+ larkcc -p mybot # 用 mybot 机器人
39
+ larkcc -p mybot --continue # 用 mybot 机器人,续接上次会话
40
+ larkcc -d # 后台运行
41
+
42
+ # 配置
43
+ larkcc --setup # 配置/更新默认机器人
44
+ larkcc --setup -p mybot # 配置/更新 mybot 机器人
45
+ larkcc --new-profile # 新增机器人
46
+ larkcc --list-profiles # 查看所有已配置的机器人
47
+
48
+ # Session 管理
49
+ larkcc --reset-session # 清除默认机器人的 session
50
+ larkcc -p mybot --reset-session # 清除 mybot 机器人的 session
51
+
52
+ # 进程管理
53
+ larkcc --ps # 查看运行中的 larkcc 进程
54
+ ```
55
+
56
+ ## 群聊支持
57
+
58
+ 可以把多个机器人拉进同一个飞书群,通过 @ 或引用回复来分别控制:
59
+
60
+ ```
61
+ 群:你 + 机器人A(tiz项目) + 机器人B(larkcc项目) + 机器人C + 机器人D
62
+
63
+ 你:@机器人A 帮我分析登录模块
64
+ 机器人A:好的,我来看 tiz 项目的登录模块...
65
+
66
+ 你:@机器人B 帮我看 agent.ts
67
+ 机器人B:好的,我来看 larkcc 的 agent.ts...
68
+
69
+ 你:[引用机器人A的回复] 这个问题怎么修?
70
+ 机器人A:续接上次对话继续回复...
71
+ ```
72
+
73
+ **触发规则:**
74
+ - 群消息:@ 机器人 或 引用机器人的消息 才会触发
75
+ - 单聊:直接发消息即可
76
+
77
+ **会话说明:**
78
+ - 单聊和群聊共用同一个 Claude session
79
+ - 无论在哪里发消息,Claude 都能记住上下文
80
+
81
+ **飞书权限需要额外添加:**
82
+ - `im:message.group_at_msg:readonly` — 接收群 @ 消息
83
+
84
+ ## Slash 命令
85
+
86
+ 在飞书发送 `/命令` 可以快速执行操作:
87
+
88
+ ### ⚡ 快速执行(不走 Claude,秒返回)
89
+
90
+ | 命令 | 说明 |
91
+ |------|------|
92
+ | `/stop` `/cancel` | **中断当前任务** |
93
+ | `/s` `/status` | git status + 最近提交 |
94
+ | `/d` `/diff` | git diff |
95
+ | `/l` `/log` | git log |
96
+ | `/b` `/branch` | 分支列表 |
97
+ | `/pwd` | 当前目录 + 文件列表 |
98
+ | `/ps` | 运行中的进程 |
99
+
100
+ ### 💬 Claude 快捷方式
101
+
102
+ | 命令 | 说明 |
103
+ |------|------|
104
+ | `/review` | 代码 review |
105
+ | `/fix` | 修复报错 |
106
+ | `/doc` | 生成/更新 README |
107
+ | `/test [文件]` | 生成单元测试 |
108
+ | `/explain [文件]` | 解释代码 |
109
+ | `/refactor [文件]` | 重构 |
110
+ | `/commit` | 生成 commit message |
111
+ | `/pr` | 生成 PR 描述 |
112
+ | `/todo` | 整理 TODO 清单 |
113
+ | `/summary` | 生成工作日报 |
114
+ | `/bsx [内容]` | 头脑风暴,不动代码 |
115
+ | `/upmd` | 更新 README.md 和 CLAUDE.md |
116
+ | `/build` | 构建项目 |
117
+ | `/install` | 安装依赖 |
118
+ | `/run [script]` | 运行 npm script |
119
+ | `/help` | 查看所有命令 |
120
+
121
+ ### 📁 多文件模式
122
+
123
+ | 命令 | 说明 |
124
+ |------|------|
125
+ | `/mf start` | 开始多文件模式 |
126
+ | `/mf done` | 结束并发送所有缓存的文件 |
127
+
128
+ ### 自定义命令
129
+
130
+ ```yaml
131
+ # ~/.larkcc/config.yml
132
+ commands:
133
+ # 基础用法
134
+ deploy: "按标准流程部署到测试环境,部署前先跑测试"
135
+ standup: "总结今天的代码改动,生成简洁日报"
136
+
137
+ # 使用 {input} 模板占位符
138
+ impl: "直接实现以下需求,不要讨论:\n\n{input}"
139
+ check: "只检查不修改,分析以下内容:\n\n{input}"
140
+ ```
141
+
142
+ **用法:**
143
+ ```
144
+ /impl 实现用户登录功能
145
+ → 直接实现以下需求,不要讨论:
146
+ → 实现用户登录功能
147
+ ```
148
+
149
+ **占位符说明:**
150
+ - `{input}` - 用户输入的参数(推荐)
151
+ - 不使用占位符时,参数会以 `补充信息:xxx` 形式附加
152
+
153
+ ## 任务控制
154
+
155
+ ```
156
+ 你:帮我重构整个项目...
157
+ 你:/stop → ⏹ 已发送中断信号
158
+ ```
159
+
160
+ 任务超过 10 分钟无响应自动释放锁,无需重启。
161
+
162
+ ## 图片支持
163
+
164
+ 支持多种图片发送方式,Claude 自动分析:
165
+
166
+ ```
167
+ 你:[截图] 帮我实现这个界面
168
+ 你:[报错截图] 这个怎么修
169
+ 你:[富文本含多图] 分析这几张图
170
+ ```
171
+
172
+ - 单独图片消息
173
+ - 富文本消息中的图片(支持多图)
174
+ - 混合文字+图片
175
+
176
+ ## 文件支持
177
+
178
+ 支持发送文件给 Claude 分析:
179
+
180
+ ```
181
+ 你:[文件 data.xlsx] 分析这个数据
182
+ Claude:我来读取这个文件...
183
+ ```
184
+
185
+ ### 单文件模式
186
+
187
+ 直接发送文件,Claude 自动读取并分析。
188
+
189
+ ### 多文件模式
190
+
191
+ 当需要同时分析多个文件时,使用多文件模式:
192
+
193
+ ```
194
+ 你:/mf start
195
+ Claude:📁 多文件模式已开始,请发送文件和说明文字,完成后发送 /mf done
196
+
197
+ 你:[文件 report.xlsx]
198
+ 你:[文件 data.csv]
199
+ 你:对比分析这两个数据
200
+
201
+ 你:/mf done
202
+ Claude:好的,我来分析这 2 个文件...
203
+ ```
204
+
205
+ **命令:**
206
+
207
+ | 命令 | 说明 |
208
+ |------|------|
209
+ | `/mf start` | 开始多文件模式(重复发送会重置) |
210
+ | `/mf done` | 结束并发送所有缓存的文件 |
211
+
212
+ **超时:** 默认 5 分钟超时,超时后需要重新 `/mf start`
213
+
214
+ **临时文件清理:**
215
+
216
+ ```bash
217
+ # 清理当前 profile 的临时文件
218
+ larkcc --cleanup-tmp-files
219
+
220
+ # 清理超过 24 小时的文件
221
+ larkcc --cleanup-tmp-files --older-than 24
222
+
223
+ # 清理所有 profile 的临时文件
224
+ larkcc --cleanup-tmp-files --all
225
+ ```
226
+
227
+ 临时文件目录:`~/.larkcc/temp/{profile}/`
228
+
229
+ ## 多机器人
230
+
231
+ ```bash
232
+ larkcc --new-profile # 新增机器人
233
+ larkcc --list-profiles # 查看所有机器人
234
+ larkcc -p mybot # 使用指定机器人
235
+ ```
236
+
237
+ ### Open ID 自动检测
238
+
239
+ setup 不需要填 open_id,发第一条消息自动保存。
240
+
241
+ ### 重复启动检测
242
+
243
+ 同一机器人在其他项目运行时提示确认,避免意外顶掉。
244
+
245
+ ## 飞书侧体验
246
+
247
+ - ✅ 启动/断开通知
248
+ - 👌 处理中打 reaction,完成换 DONE
249
+ - 💬 回复引用原消息
250
+ - ⚡ 工具调用实时展示
251
+ - 📋 Markdown 卡片渲染
252
+ - 📄 超长消息支持分段发送或写入云文档
253
+ - 🖼 图片理解(支持富文本多图)
254
+ - ⌨️ Slash 命令
255
+ - ⏹ `/stop` 中断任务
256
+ - 👥 群聊 @ 触发
257
+
258
+ ## 消息类型支持
259
+
260
+ | 类型 | 单聊 | 群聊 |
261
+ |------|------|------|
262
+ | 普通文本 | ✅ | ✅(需 @) |
263
+ | 富文本 | ✅ | ✅(需 @) |
264
+ | 富文本含图片 | ✅ | ✅(需 @) |
265
+ | 图片 | ✅ | ✅(需 @) |
266
+ | 引用回复 | ✅ | ✅ |
267
+
268
+ ## 配置文件
269
+
270
+ `~/.larkcc/config.yml`:
271
+
272
+ ```yaml
273
+ feishu:
274
+ app_id: cli_xxxxxxxx
275
+ app_secret: xxxxxxxxxxxxxxxx
276
+ owner_open_id: ou_xxxxxxxx # 首次收到消息后自动填入
277
+
278
+ claude:
279
+ permission_mode: acceptEdits
280
+ allowed_tools:
281
+ - Read
282
+ - Write
283
+ - Edit
284
+ - Bash
285
+ - Glob
286
+ - Grep
287
+ - LS
288
+
289
+ # 超长消息处理配置
290
+ overflow:
291
+ mode: document # chunk(分片发送)或 document(写入云文档)
292
+ chunk:
293
+ threshold: 2800 # 分片阈值
294
+ document:
295
+ threshold: 2800 # 写文档阈值
296
+ title_template: "{cwd} - {session_id} - {datetime}"
297
+
298
+ commands:
299
+ deploy: "部署到测试环境"
300
+
301
+ # 图片消息默认提示词(只发图片时会自动添加)
302
+ image_prompt: "分析图片,给出回应"
303
+
304
+ # 文件处理配置
305
+ file:
306
+ enabled: true # 是否启用文件处理
307
+ size_limit: 31457280 # 文件大小限制(bytes),默认 30MB
308
+ temp_dir: "~/.larkcc/temp" # 临时文件目录
309
+ prompt: "分析文件 {filename}(路径:{filepath},大小:{size},类型:{mime_type})"
310
+ multifile_prompt: "分析以下 {count} 个文件:\n{files}\n\n用户说明:{text}"
311
+ multifile_timeout: 300 # 多文件模式超时(秒)
312
+
313
+ profiles:
314
+ mybot:
315
+ feishu:
316
+ app_id: cli_bot_xxx
317
+ app_secret: xxxxxxxxxxxxxxxx
318
+ ```
319
+
320
+ ### 超长消息处理
321
+
322
+ 当回复内容超过阈值时,支持两种处理方式:
323
+
324
+ | 模式 | 说明 |
325
+ |------|------|
326
+ | `chunk` | 分片发送,每片带页码 |
327
+ | `document` | 写入飞书云文档,回复文档链接 |
328
+
329
+ **文档模式配置:**
330
+
331
+ 在飞书开发者后台为应用开通以下**用户身份**权限:
332
+
333
+ | 权限 | 说明 |
334
+ |------|------|
335
+ | `docx:document` | 创建/编辑云文档 |
336
+ | `drive:file` | 删除云空间文件 |
337
+
338
+ 开通后发布应用,文档会自动创建在您"我的空间"的`larkcc` 文件夹中。
339
+
340
+ **标题模板占位符:**
341
+ - `{cwd}` - 当前工作目录
342
+ - `{session_id}` - Claude 会话 ID
343
+ - `{datetime}` - 日期时间(2026-03-22 14:30:00)
344
+ - `{date}` - 日期(2026-03-22)
345
+ - `{profile}` - 机器人配置名
346
+
347
+ **文档结构:**
348
+
349
+ ```
350
+ > 用户原始消息内容
351
+
352
+ ──────────────────
353
+
354
+ 📁 工作目录: /opt/dev/myproject
355
+ 🤖 机器人: default
356
+ 🔗 会话ID: abc123def456
357
+ 📅 时间: 2026-03-22 14:30:00
358
+
359
+ ──────────────────
360
+
361
+ (实际回复内容...)
362
+ ```
363
+
364
+ - 支持 Markdown 格式(标题、代码块、列表等)
365
+
366
+ **自动清理:**
367
+
368
+ 创建新文档时,会自动清理超出数量的旧文档:
369
+
370
+ ```yaml
371
+ overflow:
372
+ mode: document
373
+ document:
374
+ threshold: 2800
375
+ title_template: "{datetime}"
376
+ cleanup:
377
+ enabled: true # 是否启用自动清理
378
+ max_docs: 50 # 最大保留文档数(每个 profile 独立计算)
379
+ notify: true # 清理时是否通知
380
+ ```
381
+
382
+ - 使用本地文档注册表追踪创建的文档(`~/.larkcc/doc-registry.json`)
383
+ - 每个 profile 独立管理,互不影响
384
+ - 按创建时间排序,保留最新的 `max_docs` 个文档
385
+ - 清理成功会在回复消息中附带通知
386
+ - 删除失败会忽略并继续,不影响正常流程
387
+
388
+ ### 自定义 API
389
+
390
+ `~/.claude/settings.json`:
391
+
392
+ ```json
393
+ {
394
+ "env": {
395
+ "ANTHROPIC_AUTH_TOKEN": "your-token",
396
+ "ANTHROPIC_BASE_URL": "https://ark.cn-beijing.volces.com/api/coding",
397
+ "ANTHROPIC_MODEL": "ark-code-latest",
398
+ "API_TIMEOUT_MS": "3000000"
399
+ }
400
+ }
401
+ ```
402
+
403
+ ## 飞书开放平台配置
404
+
405
+ > ⚠️ 改完权限必须**创建新版本并发布**
406
+
407
+ ### 权限
408
+
409
+ | 权限 | 用途 |
410
+ |------|------|
411
+ | `im:message` | 基础消息(含下载消息中的文件) |
412
+ | `im:message:send_as_bot` | 发送消息 |
413
+ | `im:message.p2p_msg:readonly` | 接收私聊 |
414
+ | `im:message.group_at_msg:readonly` | 接收群 @ 消息 |
415
+ | `im:message.reactions:write_only` | 打 reaction |
416
+ | `cardkit:card:write` | 发送卡片 |
417
+ | `docx:document` | 创建/编辑云文档(超长消息写入) |
418
+ | `drive:file` | 删除云空间文件(清理旧文档) |
419
+
420
+ > 💡 `im:message` 权限已包含下载消息中资源文件(图片、文件)的能力
421
+
422
+ ### 事件订阅
423
+
424
+ 使用**长连接** → 订阅 `im.message.receive_v1`
425
+
426
+ ## 状态文件
427
+
428
+ | 文件 | 说明 |
429
+ |------|------|
430
+ | `~/.larkcc/config.yml` | 配置 |
431
+ | `~/.larkcc/state.json` | 默认机器人状态 |
432
+ | `~/.larkcc/state-{profile}.json` | 各 profile 状态 |
433
+ | `~/.larkcc/lock-default.json` | 进程锁 |
434
+ | `~/.larkcc/lock-{profile}.json` | 各 profile 进程锁 |
435
+ | `~/.larkcc/doc-registry.json` | 默认 profile 文档注册表 |
436
+ | `~/.larkcc/doc-registry-{profile}.json` | 各 profile 文档注册表 |
437
+ | `~/.larkcc/temp/default/` | 默认 profile 临时文件目录 |
438
+ | `~/.larkcc/temp/{profile}/` | 各 profile 临时文件目录 |
439
+ | `~/.claude.json` | Claude onboarding(自动创建) |
440
+
441
+ ---
442
+
443
+ ## License
444
+
445
+ [MIT](LICENSE)
446
+
447
+ ## Disclaimer
448
+
449
+ This project is not officially affiliated with Lark, Feishu, or ByteDance.
450
+
451
+ ---
452
+
453
+ # English Documentation
454
+
455
+ Claude Code in Feishu/Lark — Start in any project directory, chat with Claude via Feishu bot, experience equivalent to using Claude Code directly in terminal.
456
+
457
+ ## Installation
458
+
459
+ ```bash
460
+ npm install -g larkcc
461
+ ```
462
+
463
+ ## Quick Start
464
+
465
+ ```bash
466
+ # 1. Configure default bot (only need App ID and Secret)
467
+ larkcc --setup
468
+
469
+ # 2. Start in your project directory
470
+ cd /your/project
471
+ larkcc
472
+
473
+ # 3. Send any message to the bot, it will auto-detect and save your open_id
474
+ # ✅ Auto-detected open_id: ou_xxx
475
+ # Now you can use it normally
476
+ ```
477
+
478
+ ## Commands
479
+
480
+ ```bash
481
+ # Start
482
+ larkcc # Default bot, new session
483
+ larkcc --continue # Default bot, continue last session
484
+ larkcc -p mybot # Use mybot profile
485
+ larkcc -p mybot --continue # Use mybot profile, continue last session
486
+ larkcc -d # Run in background
487
+
488
+ # Configuration
489
+ larkcc --setup # Configure/update default bot
490
+ larkcc --setup -p mybot # Configure/update mybot profile
491
+ larkcc --new-profile # Add new bot profile
492
+ larkcc --list-profiles # List all configured bots
493
+
494
+ # Session management
495
+ larkcc --reset-session # Clear default bot session
496
+ larkcc -p mybot --reset-session # Clear mybot session
497
+
498
+ # Process management
499
+ larkcc --ps # View running larkcc processes
500
+ ```
501
+
502
+ ## Group Chat Support
503
+
504
+ Add multiple bots to the same Feishu group, control them via @ mentions or reply:
505
+
506
+ ```
507
+ Group: You + BotA(project A) + BotB(project B)
508
+
509
+ You: @BotA Help me analyze the login module
510
+ BotA: OK, let me check project A's login module...
511
+
512
+ You: @BotB Help me check agent.ts
513
+ BotB: OK, let me check project B's agent.ts...
514
+
515
+ You: [Reply to BotA's message] How to fix this issue?
516
+ BotA: Continue from previous conversation...
517
+ ```
518
+
519
+ **Trigger rules:**
520
+ - Group message: @ bot or reply to bot's message to trigger
521
+ - Direct message: Just send message directly
522
+
523
+ **Session:**
524
+ - Direct chat and group chat share the same Claude session
525
+ - Claude remembers context regardless of where you send message
526
+
527
+ **Additional Feishu permission required:**
528
+ - `im:message.group_at_msg:readonly` — Receive group @ messages
529
+
530
+ ## Slash Commands
531
+
532
+ Send `/command` in Feishu for quick actions:
533
+
534
+ ### ⚡ Quick Execute (No Claude, instant return)
535
+
536
+ | Command | Description |
537
+ |---------|-------------|
538
+ | `/stop` `/cancel` | **Interrupt current task** |
539
+ | `/s` `/status` | git status + recent commits |
540
+ | `/d` `/diff` | git diff |
541
+ | `/l` `/log` | git log |
542
+ | `/b` `/branch` | Branch list |
543
+ | `/pwd` | Current directory + file list |
544
+ | `/ps` | Running processes |
545
+
546
+ ### 💬 Claude Shortcuts
547
+
548
+ | Command | Description |
549
+ |---------|-------------|
550
+ | `/review` | Code review |
551
+ | `/fix` | Fix errors |
552
+ | `/doc` | Generate/update README |
553
+ | `/test [file]` | Generate unit tests |
554
+ | `/explain [file]` | Explain code |
555
+ | `/refactor [file]` | Refactor |
556
+ | `/commit` | Generate commit message |
557
+ | `/pr` | Generate PR description |
558
+ | `/todo` | Organize TODO list |
559
+ | `/summary` | Generate daily report |
560
+ | `/bsx [content]` | Brainstorm without code changes |
561
+ | `/upmd` | Update README.md and CLAUDE.md |
562
+ | `/build` | Build project |
563
+ | `/install` | Install dependencies |
564
+ | `/run [script]` | Run npm script |
565
+ | `/help` | View all commands |
566
+
567
+ ## Image Support
568
+
569
+ Supports multiple image sending methods, Claude auto-analyzes:
570
+
571
+ ```
572
+ You: [Screenshot] Help me implement this UI
573
+ You: [Error screenshot] How to fix this
574
+ You: [Rich text with multiple images] Analyze these images
575
+ ```
576
+
577
+ ## File Support
578
+
579
+ Send files to Claude for analysis:
580
+
581
+ ```
582
+ You: [File data.xlsx] Analyze this data
583
+ Claude: Let me read this file...
584
+ ```
585
+
586
+ ## Multi-Bot Support
587
+
588
+ ```bash
589
+ larkcc --new-profile # Add new bot
590
+ larkcc --list-profiles # List all bots
591
+ larkcc -p mybot # Use specified bot
592
+ ```
593
+
594
+ ## Feishu Open Platform Configuration
595
+
596
+ > ⚠️ After changing permissions, you must **create a new version and publish**
597
+
598
+ ### Permissions
599
+
600
+ | Permission | Purpose |
601
+ |------------|---------|
602
+ | `im:message` | Basic message (including file download) |
603
+ | `im:message:send_as_bot` | Send messages |
604
+ | `im:message.p2p_msg:readonly` | Receive direct messages |
605
+ | `im:message.group_at_msg:readonly` | Receive group @ messages |
606
+ | `im:message.reactions:write_only` | Add reactions |
607
+ | `cardkit:card:write` | Send cards |
608
+ | `docx:document` | Create/edit cloud documents |
609
+ | `drive:file` | Delete cloud files |
610
+
611
+ ### Event Subscription
612
+
613
+ Use **Long Connection** → Subscribe to `im.message.receive_v1`
614
+
615
+ ## Contributing
616
+
617
+ See [CONTRIBUTING.md](CONTRIBUTING.md)
@@ -0,0 +1,9 @@
1
+ import * as lark from "@larksuiteoapi/node-sdk";
2
+ import { LarkccConfig } from "./config.js";
3
+ export interface ImageInput {
4
+ base64: string;
5
+ mediaType: string;
6
+ }
7
+ export declare function runAgent(prompt: string, cwd: string, config: LarkccConfig, client: lark.Client, chatId: string, rootMsgId: string, images?: ImageInput[], abortSignal?: AbortSignal, // 可选中断信号
8
+ profile?: string): Promise<void>;
9
+ export declare function ensureEnv(): void;