cli README

The project's README from github.com/larksuite/cli. As one markdown file: README.md.

lark-cli

License: MIT Go Version npm version

中文版 | English

The official Lark/Feishu CLI tool, maintained by the larksuite team — built for humans and AI Agents. Covers core business domains including Messenger, Docs, Base, Sheets, Slides, Calendar, Mail, Tasks, Meetings, Markdown, and more, with 200+ commands and 26 AI Agent Skills.

Install · AI Agent Skills · Auth · Commands · Advanced · Enterprise · Security · Contributing

Why lark-cli?

Personal or Enterprise?

You are... Recommended path
An individual developer — using lark-cli in your terminal or with your own AI Agent Follow the Quick Start below
Enterprise IT / ISV — embedding lark-cli into your own Agent or platform, with centralized credentials (database / Vault / config center), unified audit logging, and a restricted command surface Read Embed lark-cli in your Agent and the extension/ packages — extend via a wrapper main, no need to modify CLI source

💡 For AI Agents: append .md to any Open Platform doc URL to fetch it as raw Markdown, e.g. embed-feishu-cli-in-agent.md.

Features

Category Capabilities
📅 Calendar View, create and update events, invite attendees, find meeting rooms, RSVP to invitations, check free/busy & time suggestions
💬 Messenger Send/reply messages, create and manage group chats, view chat history & threads, search messages, download media
📄 Docs Create, read, update, and search documents, read/write media & whiteboards
📁 Drive Upload and download files, search docs & wiki, manage comments
📝 Markdown Create, fetch, patch, and overwrite Drive-native .md files
📊 Base Create and manage tables, fields, records, views, dashboards, workflows, forms, roles & permissions, data aggregation & analytics
📈 Sheets Create, read, write, append, find, and export spreadsheet data
🖼️ Slides Create and manage presentations, read presentation content, and add or remove slides
✅ Tasks Create, query, update, and complete tasks; manage task lists, subtasks, comments & reminders
📚 Wiki Create and manage knowledge spaces, nodes, and documents
👤 Contact Search users by name/email/phone, get user profiles
📧 Mail Browse, search, read emails, send, reply, forward, manage drafts, watch new mail
🎥 Meetings Search live and historical meetings, inspect participants and artifacts, analyze transcripts, manage Minutes, and assist in meetings
🕐 Attendance Query personal attendance check-in records
✍️ Approval Query approval tasks, approve/reject/transfer tasks, cancel and CC instances
🎯 OKR Query, create, update OKRs; manage objective & key results, alignments, indicators and progress.
📋 Project Meegle — manage work items, schedules, and data via the standalone meegle-cli (install separately)
🔗 Apps Create Spark/Miaoda apps, publish HTML/static sites, run cloud generation, and manage access scope

Installation & Quick Start

Requirements

Before you start, make sure you have:

Quick Start (Human Users)

Note for AI assistants: If you are an AI Agent helping the user with installation, jump directly to Quick Start (AI Agent), which contains all the steps you need to complete.

Install

Choose one of the following methods:

Option 1 — From npm (recommended):

npx @larksuite/cli@latest install

Option 2 — From source:

Requires Go v1.23+ and Python 3.

git clone https://github.com/larksuite/cli.git
cd cli
make install

# Install CLI SKILL (required)
npx skills add larksuite/cli -y -g

Configure & Use

# 1. Configure app credentials (one-time, interactive guided setup)
lark-cli config init

# 2. Log in (--recommend auto-selects commonly used scopes)
lark-cli auth login --recommend

# 3. Start using
lark-cli calendar +agenda

Quick Start (AI Agent)

The following steps are for AI Agents. Some steps require the user to complete actions in a browser.

Step 1 — Install

npx @larksuite/cli@latest install

Step 2 — Configure app credentials

Run this command in the background. It will output an authorization URL — extract it and send it to the user. The command exits automatically after the user completes the setup in the browser.

lark-cli config init --new

Step 3 — Login

Same as above: run in the background, extract the authorization URL and send it to the user.

lark-cli auth login --recommend

Step 4 — Verify

lark-cli auth status

Agent Skills

Skill Description
lark-shared App config, auth login, identity switching, scope management, security rules (auto-loaded by all other skills)
lark-calendar Calendar events (create/update), agenda view, free/busy queries, time suggestions, room finding, RSVP replies
lark-im Send/reply messages, group chat management, message search, upload/download images & files, reactions
lark-doc Create, read, update, search documents (Markdown-based)
lark-drive Upload, download files, manage permissions & comments
lark-markdown Create, fetch, patch, and overwrite Drive-native Markdown files
lark-sheets Create, read, write, append, find, export spreadsheets
lark-slides Create and manage presentations, read presentation content, and add or remove slides
lark-base Tables, fields, records, views, dashboards, data aggregation & analytics
lark-task Tasks, task lists, subtasks, reminders, member assignment
lark-mail Browse, search, read emails, send, reply, forward, draft management, watch new mail
lark-contact Search users by name/email/phone, get user profiles
lark-wiki Knowledge spaces, nodes, documents
lark-event Real-time event subscriptions (WebSocket), regex routing & agent-friendly format
lark-meeting Search live or historical meetings, inspect participants and artifacts, analyze transcripts, manage Minutes, and assist in meetings
lark-whiteboard Whiteboard/chart DSL rendering
lark-openapi-explorer Explore underlying APIs from official docs
lark-skill-maker Custom skill creation framework
lark-attendance Query personal attendance check-in records
lark-approval Query approval tasks, approve/reject/transfer tasks, cancel and CC instances
lark-workflow-meeting-summary Workflow: meeting minutes aggregation & structured report
lark-workflow-standup-report Workflow: agenda & todo summary
lark-okr Query, create, update OKRs; manage objective & key results, alignments and indicators.

Authentication

Command Description
auth login OAuth login with interactive selection or CLI flags for scopes
auth logout Sign out and remove stored credentials
auth status Show current login status and granted scopes
auth check Verify a specific scope (exit 0 = ok, 1 = missing)
auth scopes List all available scopes for the app
auth list List all authenticated users
# Interactive login (TUI guides domain and permission level selection)
lark-cli auth login

# Filter by domain
lark-cli auth login --domain calendar,task

# Recommended auto-approval scopes
lark-cli auth login --recommend

# Exact scope
lark-cli auth login --scope "calendar:calendar:read"

# Agent mode: return verification URL immediately, non-blocking
lark-cli auth login --domain calendar --no-wait
# Resume polling later
lark-cli auth login --device-code <DEVICE_CODE>

# Identity switching: execute commands as user or bot
lark-cli calendar +agenda --as user
lark-cli im +messages-send --as bot --chat-id "oc_xxx" --text "Hello"

Three-Layer Command System

The CLI provides three levels of granularity, covering everything from quick operations to fully custom API calls:

1. Shortcuts

Prefixed with +, designed to be friendly for both humans and AI, with smart defaults, table output, and dry-run previews.

lark-cli calendar +agenda
lark-cli im +messages-send --chat-id "oc_xxx" --text "Hello"
lark-cli docs +create --doc-format markdown --content $'<title>Weekly Report</title>\n# Progress\n- Completed feature X'

Run lark-cli <service> --help to see all shortcut commands.

2. API Commands

Auto-generated from Lark OAPI metadata, curated through evaluation and quality gates — 100+ commands mapped 1:1 to platform endpoints.

lark-cli calendar calendars list
lark-cli calendar events instance_view --params '{"calendar_id":"primary","start_time":"1700000000","end_time":"1700086400"}'

3. Raw API Calls

Call any Lark Open Platform endpoint directly, covering 2500+ APIs.

lark-cli api GET /open-apis/calendar/v4/calendars
lark-cli api POST /open-apis/im/v1/messages --params '{"receive_id_type":"chat_id"}' --data '{"receive_id":"oc_xxx","msg_type":"text","content":"{\"text\":\"Hello\"}"}'

Advanced Usage

Output Formats

--format json      # Full JSON response (default)
--format pretty    # Human-friendly formatted output
--format table     # Readable table
--format ndjson    # Newline-delimited JSON (for piping)
--format csv       # Comma-separated values

JSON Output Contract

With --format json (the default), success and error envelopes are distinct.

Success goes to stdout, exit code 0:

{ "ok": true, "identity": "user", "data": { "guid": "..." }, "meta": { "count": 1 } }

Errors go to stderr, non-zero exit code:

{ "ok": false, "identity": "user", "error": { "type": "api", "subtype": "...", "code": 99991679, "message": "...", "hint": "..." } }

To check whether a command succeeded, test ok == true (or the exit code) — not code == 0. Unlike raw OpenAPI responses ({"code": 0, "msg": "ok", ...}), the success envelope carries no code or msg field; code appears only inside error as the upstream OpenAPI code. See errs/ERROR_CONTRACT.md for the full error taxonomy.

Pagination

--page-all                  # Auto-paginate through all pages
--page-limit 5              # Max 5 pages
--page-delay 500            # 500ms between page requests

Dry Run

For commands that may have side effects, preview the request with --dry-run first:

lark-cli im +messages-send --chat-id oc_xxx --text "hello" --dry-run

Schema Introspection

Use schema to inspect any API method's parameters, request body, response structure, supported identities, and scopes:

lark-cli schema
lark-cli schema calendar.events.instance_view
lark-cli schema im.messages.delete

Security & Risk Warnings (Read Before Use)

This tool can be invoked by AI Agents to automate operations on the Lark/Feishu Open Platform, and carries inherent risks such as model hallucinations, unpredictable execution, and prompt injection. After you authorize Lark/Feishu permissions, the AI Agent will act under your user identity within the authorized scope, which may lead to high-risk consequences such as leakage of sensitive data or unauthorized operations. Please use with caution.

To reduce these risks, the tool enables default security protections at multiple layers. However, these risks still exist. We strongly recommend that you do not proactively modify any default security settings; once relevant restrictions are relaxed, the risks will increase significantly, and you will bear the consequences.

We recommend using the Lark/Feishu bot integrated with this tool as a private conversational assistant. Do not add it to group chats or allow other users to interact with it, to avoid abuse of permissions or data leakage.

To reduce the security risks associated with access token theft, the CLI sends a minimal set of risk-control signals with OpenAPI requests made to exact official Feishu/Lark HTTPS domains. These signals are used to help identify anomalous API activity. This protection is enabled by default. The information sent is limited to:

To disable this protection for the current workspace, run:

lark-cli config risk-control off

To enable this protection for the current workspace, run:

lark-cli config risk-control on

To restore the default policy for the current workspace, run:

lark-cli config risk-control default

Please fully understand all usage risks. By using this tool, you are deemed to voluntarily assume all related responsibilities.

Contributing

Community contributions are welcome! If you find a bug or have feature suggestions, please submit an Issue or Pull Request.

For major changes, we recommend discussing with us first via an Issue.

Before opening a PR, see AGENTS.md for the local build, test, and PR checklist used by contributors and AI agents.

License

This project is licensed under the MIT License. When running, it calls Lark/Feishu Open Platform APIs. To use these APIs, you must comply with the following agreements and privacy policies:

cli (larksuite/cli)

Searching Database…

17.7K ·GitHub
这是什么?lark-cli 是 Lark/Feishu 开放平台的官方命令行工具,由 larksuite 团队开发,面向人类开发者和 AI 智能体(AI Agent)。它覆盖 18 个业务领域(消息、文档、多维表格、电子表格、日历、邮件、任务、会议等),提供 200 多个命令和 26 项 AI 智能体技能(Skills)。
这只是一个命令行工具,还是可以嵌入我自己的 AI 智能体?它可以作为独立的命令行工具使用,采用三层命令体系(快捷命令、API 命令、原始 API)。它也可以通过 extension/ 目录下的软件包嵌入你自己的智能体或平台,并集中管理凭据、记录审计日志,适用于企业场景。
我该如何安装并开始使用?可以通过 npm 安装(推荐),也可以从源码构建;然后配置应用凭据,并运行交互式 OAuth 登录。README 称,从安装到完成第一次 API 调用大约只需 3 分钟。
使用前需要先安装什么?运行命令行工具需要 Node.js(npm/npx);如果从源码构建,还需要 Go v1.23+ 和 Python 3。
让 AI 智能体操作这个工具有哪些风险?智能体会以你授权的用户身份执行操作,因此模型幻觉、执行过程不可预测或提示词注入,都可能导致敏感数据泄露或越权操作。README 建议不要放宽默认的安全保护措施。
这是面向个人使用,还是面向企业集成?两者都适用:个人开发者只需在终端中按照快速入门操作即可;企业 IT 部门或独立软件供应商(ISV)可以把 lark-cli 嵌入自己的智能体或平台,集中存储凭据、统一记录审计日志,并限制可用的命令范围。
它会向 Lark/Feishu 回传哪些数据?默认情况下,它会在 API 请求中附带少量风控信号,仅包括操作系统类型(macOS/Windows/Linux)和设备硬件型号,用于发现异常行为。可以按工作区关闭此功能。
从许可证来看,这真的可以免费使用吗?是的,命令行工具本身采用 MIT 许可证。但调用 Feishu/Lark 的 API 时,仍需遵守 Feishu/Lark 开放平台的服务条款和隐私政策。
lark-cli 中的 AI 智能体技能是什么?它们是 26 个结构化、预先构建好的技能定义(如 lark-im、lark-calendar、lark-doc),主流 AI 工具可以开箱即用地加载,让智能体无需额外设置即可操作 Lark/Feishu 的各项功能。
凭据是如何存储的?凭据通过操作系统原生的钥匙串(keychain)存储。命令行工具还加入了输入注入防护和终端输出清理,使 AI 驱动的使用更加安全。
我也能用它管理 Meegle 项目数据吗?项目管理功能由独立的 meegle-cli 提供,需要单独安装。lark-cli 功能表中的 Project 一行只是指向它。
如何判断一条命令是否执行成功?请检查 JSON 输出中的 ok 字段(或退出码),而不是 code == 0。成功的响应结构中没有 code 和 msg 字段,这与原始 OpenAPI 响应不同。
Creator
larksuite
Size
141.5 MB
Stars
17.7K
Age
6mo
Commits · 90 Days