### Start using Larksuite CLI Source: https://github.com/larksuite/cli/blob/main/README.md Example command to start using the Larksuite CLI after installation and configuration. This specific command accesses the calendar agenda. ```bash lark-cli calendar +agenda ``` -------------------------------- ### Shortcut Commands Examples Source: https://github.com/larksuite/cli/blob/main/README.md Examples of using shortcut commands for calendar and messaging operations. ```bash lark-cli calendar +agenda ``` ```bash lark-cli im +messages-send --chat-id "oc_xxx" --text "Hello" ``` ```bash lark-cli docs +create --api-version v2 --doc-format markdown --content $'Weekly Report\n# Progress\n- Completed feature X' ``` -------------------------------- ### Raw API Calls Examples Source: https://github.com/larksuite/cli/blob/main/README.md Examples of making raw GET and POST requests to Lark Open Platform APIs. ```bash lark-cli api GET /open-apis/calendar/v4/calendars ``` ```bash 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\"}"}' ``` -------------------------------- ### API Commands Examples Source: https://github.com/larksuite/cli/blob/main/README.md Examples of using API commands to list calendar events and view instances. ```bash lark-cli calendar calendars list ``` ```bash lark-cli calendar events instance_view --params '{"calendar_id":"primary","start_time":"1700000000","end_time":"1700086400"}' ``` -------------------------------- ### Install Larksuite CLI from Source Source: https://github.com/larksuite/cli/blob/main/README.md Follow these steps to install the Larksuite CLI by building from source. This method requires Go v1.23+ and Python 3. ```bash git clone https://github.com/larksuite/cli.git cd cli make install ``` -------------------------------- ### Install Larksuite CLI via npm Source: https://github.com/larksuite/cli/blob/main/README.md Use this command to install the Larksuite CLI using npm. This is the recommended installation method for most users. ```bash npx @larksuite/cli@latest install ``` -------------------------------- ### Example Prompt for Testcase Writer Source: https://github.com/larksuite/cli/blob/main/tests/cli_e2e/README.md An example prompt demonstrating how to use the CLI E2E testcase writer skill to generate test cases for specific domains. ```text Use $cli-e2e-testcase-writer to write lark-cli xxx domain related testcases. Put them under tests/cli_e2e/xxx. ``` -------------------------------- ### Configure Larksuite CLI App Credentials Source: https://github.com/larksuite/cli/blob/main/README.md Initialize the Larksuite CLI configuration with app credentials. This is a one-time interactive guided setup. ```bash lark-cli config init ``` -------------------------------- ### Complete Record Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-base/references/lark-base-cell-value.md An example demonstrating the combined structure for various CellValue types when creating or updating a record. ```json { "标题": "Created from shortcut", "状态": "Todo", "标签": ["高优", "外部依赖"], "工时": 8, "截止时间": "2026-03-24 10:00:00", "已完成": false, "负责人": [{ "id": "ou_123" }], "关联任务": [{ "id": "rec_456" }], "坐标": { "lng": 116.397428, "lat": 39.90923 } } ``` -------------------------------- ### IM Reaction Create Response Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-reactions.md Example JSON response when successfully creating a reaction. ```json { "reaction_id": "ZCaCIjUBVVWSrm5L-3ZTw_xxx", "operator": { "operator_id": "ou_xxx", "operator_type": "user" }, "action_time": "1663054162546", "reaction_type": { "emoji_type": "SMILE" } } ``` -------------------------------- ### Search User by Name and Send Message Source: https://github.com/larksuite/cli/blob/main/skills/lark-contact/SKILL.md Example of searching for a user by name and then sending them a message. This involves two separate commands: first searching for the user to get their open_id, then sending a message using that open_id. ```bash lark-cli contact +search-user --query "张三" --has-chatted --as user lark-cli im +messages-send --user-id ou_xxx --text "Hi!" ``` -------------------------------- ### JSON Output Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-wiki/references/lark-wiki-member-list.md An example of the JSON output structure when fetching wiki space members. Includes member details, pagination information, and metadata. ```json { "ok": true, "data": { "space_id": "7160145948494381236", "members": [ { "member_id": "ou_449b53ad6aee526f7ed311b216aabcef", "member_type": "openid", "member_role": "admin" }, { "member_id": "ou_67e5ecb64ce1c0bd94612c17999db411", "member_type": "openid", "member_role": "member" } ], "has_more": false, "page_token": "" }, "meta": { "count": 2 } } ``` -------------------------------- ### Install Larksuite CLI Skill Source: https://github.com/larksuite/cli/blob/main/README.md After installing the CLI from source, install the required CLI SKILL. This command adds the skill globally. ```bash npx skills add larksuite/cli -y -g ``` -------------------------------- ### HTTPClientAction JSON Response Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-base/references/lark-base-workflow-schema.md Example configuration and output references for an HTTPClientAction with JSON response type. ```json { "id": "step_http_1", "type": "HTTPClientAction", "data": { "response_type": "json", "response_value": "{\"success\":true,\"message\":\"ok\"}" } } // Possible references: // $.step_http_1.body // $.step_http_1.body.success // $.step_http_1.body.message // $.step_http_1.status_code ``` -------------------------------- ### Full Scope Authorization Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/references/lark-drive-push.md An example command to log in and authorize all necessary scopes for lark-cli operations, including file upload, metadata read, folder creation, and document deletion. ```bash lark-cli auth login --scope "drive:drive.metadata:readonly drive:file:upload space:folder:create space:document:delete" ``` -------------------------------- ### Progress Report Examples Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/references/lark-drive-workflow-knowledge-organize-execution.md Examples of progress reports for different stages of execution. These are used when the total number of created and moved items exceeds 50. ```text 执行开始:本次将创建 个目录 / 节点,移动 个资源。任务较大,我会约每 60 秒汇报一次进度。 ``` ```text 执行进度:移动资源 /,失败 。 ``` ```text 执行暂停: 阶段遇到 ,已完成 /,需要 。 ``` -------------------------------- ### Feed Shortcut Response Structure Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-feed-shortcut-list.md An example JSON response for the feed shortcut list command, including detail enrichment for CHAT-type shortcuts. It shows the `shortcuts` array, `has_more` flag, and `page_token`. ```json { "data": { "shortcuts": [ { "feed_card_id": "oc_092f0100fe59c35995727db1039777a8", "type": 1, "detail": { "chat_id": "oc_092f0100fe59c35995727db1039777a8", "chat_mode": "group", "name": "Engineering", "avatar": "https://...", "description": "", "external": false, "owner_id": "ou_xxx", "owner_id_type": "open_id", "tenant_key": "..." } }, { "feed_card_id": "oc_c82061d126a06635aa3569587b134bb1", "type": 1, "detail": { "chat_id": "oc_c82061d126a06635aa3569587b134bb1", "chat_mode": "p2p", "name": "", "p2p_target_id": "ou_xxx", "p2p_target_type": "user", "avatar": "", "description": "", "external": false, "tenant_key": "..." } } ], "has_more": false, "page_token": "v1.example-opaque-token" } } ``` -------------------------------- ### Pretty Output Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-vc-agent/references/lark-vc-agent-meeting-events.md Displays a formatted output of meeting events, including participant actions and shared content. ```text 会议主题:张三的视频会议 会议时间:2026-04-17 15:28:52(进行中) [00:00:33] 明日之虾BOE(ou_xxx) 加入了会议 [00:00:41] 张三(ou_xxx): [text] 6666 [00:00:44] 张三(ou_xxx) 开始共享《智能纪要:飞书20251022-140223 2026年3月9日》 URL: https://... [00:01:32] 张三(ou_xxx): [reaction] JIAYI ``` -------------------------------- ### Successful Empty Application List Response Source: https://github.com/larksuite/cli/blob/main/skills/lark-apps/references/lark-apps-list.md Example of a successful response when no applications are found. ```json { "ok": true, "data": { "items": [], "has_more": false } } ``` -------------------------------- ### Building and Verifying Plugin Installation Source: https://github.com/larksuite/cli/blob/main/extension/platform/README.md Command to build the lark-cli fork with the embedded plugin and then verify that the plugin is recognized by the CLI. ```sh go build -o larkx ./cmd/larkx && ./larkx config plugins show ``` -------------------------------- ### Scenario: Search chats by keyword Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-chat-search.md A practical example demonstrating how to search for chats containing the keyword 'design review'. ```bash lark-cli im +chat-search --query "design review" ``` -------------------------------- ### Basic Command Examples Source: https://github.com/larksuite/cli/blob/main/skills/lark-doc/references/lark-doc-md.md These commands are applicable when using `--doc-format markdown` with `docs +fetch`, `docs +create`, or `docs +update`. ```shell docs +fetch --api-version v2 --doc-format markdown ``` ```shell docs +create --api-version v2 --doc-format markdown ``` ```shell docs +update --api-version v2 --doc-format markdown ``` -------------------------------- ### Search Users with Multiple Filters Source: https://github.com/larksuite/cli/blob/main/skills/lark-contact/references/lark-contact-search-user.md Combine multiple filters to narrow down user search results. This example finds employees within the same tenant who have an enterprise email and whose name starts with '王'. ```bash # 多 filter 组合:同租户的、有企业邮箱的「王」姓员工 lark-cli contact +search-user --query "王" --exclude-external-users --has-enterprise-email ``` -------------------------------- ### Run Sidecar Server Demo Source: https://github.com/larksuite/cli/blob/main/sidecar/server-demo/README.md Execute the sidecar server demo with specified listen address, key file, and log file. ```bash ./sidecar-server-demo \ --listen 127.0.0.1:16384 \ --key-file /.lark-sidecar/proxy.key \ --log-file /.lark-sidecar/audit.log ``` -------------------------------- ### Get Lark Slides Presentation XML with Specific ID Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-xml-presentations-get.md This is a basic example of fetching the XML content for a presentation using its ID. The `--params` flag takes a JSON string with the presentation ID. ```bash lark-cli slides xml_presentations get --as user --params '{"xml_presentation_id":"slides_example_presentation_id"}' ``` -------------------------------- ### Example Asset Plan: Chart Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/planning-layer.md Defines a chart asset, its purpose, a suggested query for finding it, and a fallback visual plan. ```json {"asset_type":"chart","purpose":"Show adoption trend.","suggested_query":"monthly adoption trend chart","fallback_if_missing":"Draw a simple trend line chart with axis labels and data points."} ``` -------------------------------- ### Explore Live CLI Help Source: https://github.com/larksuite/cli/blob/main/tests/cli_e2e/cli-e2e-testcase-writer/SKILL.md Use these commands to explore the CLI's help messages and schema before writing test cases. This helps in understanding available commands, groups, methods, and their parameters. ```bash lark-cli --help lark-cli --help lark-cli + -h lark-cli --help lark-cli -h lark-cli schema .. ``` -------------------------------- ### URL Mode Output (--url-only) Source: https://github.com/larksuite/cli/blob/main/skills/lark-minutes/references/lark-minutes-download.md Example JSON output when using the `--url-only` flag to get a download link for a Lark Minute media file. Includes token and the download URL. ```json { "minute_token": "obcnxxxxxxxxxxxxxxxxxxxx", "download_url": "https://..." } ``` -------------------------------- ### Lark CLI Wiki Shortcut Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-wiki/SKILL.md Demonstrates the general format for using Lark CLI Wiki Shortcuts. Replace with a specific action like 'move' or 'node-create'. ```bash lark-cli wiki + [flags] ``` -------------------------------- ### Get Time Suggestions within a Specific Range Source: https://github.com/larksuite/cli/blob/main/skills/lark-calendar/references/lark-calendar-suggestion.md Fetches recommended time slots within a specified start and end time. Supports various date formats including shorthand and ISO 8601. ```APIDOC ## GET /calendar/suggestion ### Description Gets time suggestions within a specified date range. ### Method GET ### Endpoint /calendar/suggestion ### Query Parameters - **start** (string) - Optional - The start time for the search range. Defaults to the current time. - **end** (string) - Optional - The end time for the search range. Defaults to the end of the day of the start time. ### Request Example ```bash lark-cli calendar +suggestion \ --start "2026-03-19" \ --end "2026-03-20" ``` ``` -------------------------------- ### Start Multi-Tenant Sidecar Server Source: https://github.com/larksuite/cli/blob/main/sidecar/server-multi-tenant-demo/README.md Command to launch the sidecar server with specified listen address, shared key file, keys directory, and log file. The server automatically rescans keys on cache miss. ```bash ./sidecar-multi-tenant-demo \ --listen 127.0.0.1:16384 \ --key-file /path/to/keys/proxy.key \ --keys-dir /path/to/keys/ \ --log-file /path/to/audit.log ``` -------------------------------- ### Get Time Suggestions within a Specific Date Range Source: https://github.com/larksuite/cli/blob/main/skills/lark-calendar/references/lark-calendar-suggestion.md Retrieves time suggestions within a specified date range. Supports both shorthand dates and full ISO 8601 formats for the start and end parameters. ```bash lark-cli calendar +suggestion \ --start "2026-03-19" \ --end "2026-03-20" ``` -------------------------------- ### Delete a slide using jq for confirmation Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-xml-presentation-slide-delete.md This example shows how to first retrieve the XML content to confirm the slide to be deleted, and then proceed with the deletion using the known slide ID. It utilizes `jq` to parse the JSON output from the `get` command. ```bash # 先读取 XML 内容,确认待删除页面 lark-cli slides xml_presentations get --as user --params '{"xml_presentation_id":"slides_example_presentation_id"}' | jq -r '.data.xml_presentation.content' # 然后按已知 slide_id 删除 lark-cli slides xml_presentation.slide delete --as user --params '{"xml_presentation_id":"slides_example_presentation_id","slide_id":"slide_example_id"}' ``` -------------------------------- ### List Applications (Default Page Size) Source: https://github.com/larksuite/cli/blob/main/skills/lark-apps/references/lark-apps-list.md Fetches the first page of applications with the default page size of 20. ```bash lark-cli apps +list ``` -------------------------------- ### Create Presentation with Slides Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/SKILL.md Use this shortcut to create a new presentation and optionally add slides with placeholder images. For complex content or more than 10 pages, create a blank presentation first and add slides individually. ```bash lark-cli slides +create --slides '[...]' ``` -------------------------------- ### Lark Drive CLI Time Range Cropping Notice Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/references/lark-drive-search.md This notice example demonstrates how the Lark Drive CLI automatically crops time ranges for `--opened-*` parameters when the query span exceeds the server-side limit of 90 days. It shows how a long query is split into multiple slices with specific start and end times for each slice. ```text notice: --opened-* window spans 240 days (~8 months), exceeds the server-side 3-month (90-day) limit. this query was narrowed to the most recent slice; 3 slices total: [slice 1/3 current] --opened-since 2026-01-24T21:54:02+08:00 --opened-until 2026-04-24T21:54:02+08:00 [slice 2/3] --opened-since 2025-10-26T21:54:02+08:00 --opened-until 2026-01-24T21:54:02+08:00 [slice 3/3] --opened-since 2025-08-27T21:54:02+08:00 --opened-until 2025-10-26T21:54:02+08:00 pagination: paginate within a slice via --page-token using that slice's --opened-since / --opened-until values verbatim (NOT the original relative time like '1y' / '8m' — relative times re-resolve against time.Now() and would mismatch the page_token); switch to the next slice's --opened-* flags only after has_more=false, and do not carry --page-token across slices. ``` -------------------------------- ### Multiple Parts Execution Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-xml-presentation-slide-replace.md Demonstrates applying multiple actions (replace and insert) atomically in a single request. All parts are executed in order, or none are applied if any part fails. ```bash lark-cli slides xml_presentation.slide replace --as user --params '{ "xml_presentation_id": "slides_example_presentation_id", "slide_id": "slide_example_id" }' --data '{ "parts": [ {"action":"block_replace","block_id":"bab","replacement":"

新标题

"}, {"action":"block_insert","insertion":"\" topLeftX=\"700\" topLeftY=\"400\" width=\"180\" height=\"100\"/>"} ] }' ``` -------------------------------- ### Create New Presentation with Image Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-media-upload.md Demonstrates creating a new presentation with an image, utilizing the `@` placeholder in the `--slides` argument for automatic image upload. This is the recommended approach for new presentations with images. ```bash # 不需要单独 +media-upload,写 src="@<本地路径>" 即可 lark-cli slides +create --as user --title "图测试" --slides ' ""' ] ``` -------------------------------- ### Wiring a Plugin into Lark-CLI Source: https://github.com/larksuite/cli/blob/main/extension/platform/README.md Demonstrates how to wire a custom plugin into the lark-cli binary using a blank import. This ensures the plugin's init() function is called during startup. ```go // cmd/larkx/main.go in your fork package main import ( _ "github.com/me/myplugin" // blank import → init() runs "github.com/larksuite/cli/cmd" "os" ) func main() { os.Exit(cmd.Execute()) } ``` -------------------------------- ### Task Event Payload Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-task/references/lark-task-subscribe-event.md An example of the JSON payload structure for a task update event. ```json { "event_id": "evt_xxx", "event_types": ["task_summary_update"], "task_guid": "task_guid_xxx", "timestamp": "1775793266152", "type": "task.task.update_user_access_v2" } ``` -------------------------------- ### Create Task with All Details Source: https://github.com/larksuite/cli/blob/main/skills/lark-task/references/lark-task-create.md Use this command to create a task with a summary, description, assignee, due date, and task list ID. ```bash lark-cli task +create \ --summary "Quarterly Sales Review" \ --description "Review the sales performance for the last quarter." \ --assignee "ou_xxx" \ --due "2026-03-25" \ --tasklist-id "https://applink.larkoffice.com/client/todo/task_list?guid=a4b00000-000-000-000-00000000036c" ``` -------------------------------- ### End-to-End Workflow Example Source: https://github.com/larksuite/cli/blob/main/sidecar/server-multi-tenant-demo/README.md Illustrates the complete process from a server operator generating a new client key to a client logging in and using lark-cli commands. This ensures the client's identity is automatically resolved by the sidecar. ```bash # 1. Server operator generates a key for a new client openssl rand -hex 32 > /path/to/keys/alice.key # 2. Client environment is configured (e.g. in .bashrc or container init) export LARKSUITE_CLI_AUTH_PROXY="http://host.docker.internal:16384" export LARKSUITE_CLI_PROXY_KEY="$(cat /path/to/keys/alice.key)" export LARKSUITE_CLI_APP_ID="cli_xxx" export LARKSUITE_CLI_BRAND="feishu" # 3. Client logs in (one-time) # (using a helper script that calls the management endpoints) lark-auth login # 4. Client uses lark-cli as normal — identity is automatically resolved lark api GET /open-apis/authen/v1/user_info --as user # → returns alice's Feishu identity, not another user's ``` -------------------------------- ### Join Meeting and Then Query Events Source: https://github.com/larksuite/cli/blob/main/skills/lark-vc-agent/references/lark-vc-agent-meeting-events.md Demonstrates the recommended sequence of operations: first join a meeting, record the meeting ID, and then query events for that meeting. ```bash # First, join the meeting lark-cli vc +meeting-join --meeting-number 123456789 # Then, query events using the returned meeting.id lark-cli vc +meeting-events --meeting-id ``` -------------------------------- ### Migration Workflow: Copying a Subtree Source: https://github.com/larksuite/cli/blob/main/skills/lark-wiki/references/lark-wiki-node-copy.md This example demonstrates a two-step process for migrating a subtree from one space to another. First, list nodes in the source space, then copy each node to the target space using the +node-copy command. ```bash # 1. List nodes in the source space lark-cli wiki +node-list --space-id source_space_id # 2. Copy each node to the target space lark-cli wiki +node-copy \ --space-id \ --node-token wikcn_EXAMPLE_TOKEN \ --target-space-id \ --yes ``` -------------------------------- ### Feed Shortcut Create Response Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-feed-shortcut-create.md Illustrates a partial failure response for adding feed shortcuts. Check `ok` status and `failed_shortcuts` for details. ```json { "ok": false, "data": { "total": 2, "success_count": 1, "failure_count": 1, "succeeded_shortcuts": [ { "feed_card_id": "oc_good", "type": 1 } ], "failed_shortcuts": [ { "shortcut": { "feed_card_id": "oc_bad", "type": 1 }, "reason": 2, "reason_label": "invalid_item" } ] } } ``` -------------------------------- ### Create Lark Slides Presentation with Initial Slides Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-create.md Create a presentation and add initial slide content using a JSON array of XML slide definitions. Each XML string defines a slide's structure and content. ```bash # 创建 PPT + 添加 slide 页面 lark-cli slides +create --title "项目汇报" --slides '[ "

封面

", "

第二页

" ]' ``` -------------------------------- ### Tasklist API: Create Tasklist Source: https://github.com/larksuite/cli/blob/main/skills/lark-task/SKILL.md Use the native API to create a tasklist. Consult the schema for the correct `--data` or `--params` structure. ```bash lark-cli task tasklists create --data "{...}" ``` -------------------------------- ### IM Reactions List Response Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-reactions.md Example JSON response when listing reactions for a message, including items, pagination info, and reaction details. ```json { "items": [ { "reaction_id": "ZCaCIjUBVVWSrm5L-3ZTw_xxx", "operator": { "operator_id": "ou_xxx", "operator_type": "user" }, "action_time": "1663054162546", "reaction_type": { "emoji_type": "SMILE" } } ], "has_more": true, "page_token": "YhljsPiGfUgnVAg9urvRFd-BvSqRLxxxx" } ``` -------------------------------- ### Create Wiki Space Command Source: https://github.com/larksuite/cli/blob/main/skills/lark-wiki/references/lark-wiki-space-create.md Use this command to create a new wiki space. Provide a name and optionally a description. The `--as user` flag is required for authentication. ```bash lark-cli wiki +space-create \ --name \ [--description ] \ [--as user] ``` -------------------------------- ### Example Wiki Node Query Response Source: https://github.com/larksuite/cli/blob/main/skill-template/domains/sheets.md This is an example of the JSON response when querying a Wiki node. It provides the object type, object token, and title of the node. ```json { "node": { "obj_type": "docx", "obj_token": "xxxx", "title": "标题", "node_type": "origin", "space_id": "12345678910" } } ``` -------------------------------- ### OKR Cycle List JSON Output Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-okr/references/lark-okr-cycle-list.md This is an example of the JSON output returned by the `lark-cli okr +cycle-list` command. It includes details about the cycles found and the total count. ```json { "cycles": [ { "id": "1234567890123456789", "create_time": "2025-01-01 00:00:00", "update_time": "2025-01-01 00:00:00", "tenant_cycle_id": "789", "owner": { "owner_type": "user", "user_id": "ou_xxx" }, "start_time": "2025-01-01 00:00:00", "end_time": "2025-06-30 00:00:00", "cycle_status": "normal", "score": 0 } ], "total": 1 } ``` -------------------------------- ### Create a Simple Task Source: https://github.com/larksuite/cli/blob/main/skills/lark-task/references/lark-task-create.md A basic command to create a task with only a summary. ```bash lark-cli task +create \ --summary "Buy milk" ``` -------------------------------- ### Export-Update Workflow Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-doc/references/lark-doc-md.md Demonstrates a typical workflow for exporting content, performing replacements, and updating documents, emphasizing the preservation of escaped characters. ```shell docs +fetch --api-version v2 ``` ```shell str_replace --pattern 'C:\\Users\\test\[1\]' ``` ```shell --content C:\\Users\\prod\[2\] ``` -------------------------------- ### Field Reference Set Comparison Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-base/references/lookup-field-guide.md Illustrates how 'field_ref' uses set comparison semantics. The example shows a user field with multiple names intersecting with a text value. ```json ["user_field", "intersects", { "type": "field_ref", "field": "text_field" }] ``` -------------------------------- ### Field Property Drilling Examples Source: https://github.com/larksuite/cli/blob/main/skills/lark-base/references/lark-base-workflow-schema.md Examples demonstrating how to access specific properties of fields, such as 'fieldId', 'fieldName', 'name' for user fields, 'timestamp' for date fields, and 'fileName' for attachment fields. ```json $.{stepId}.{fieldId} $.{stepId}.{fieldId}.fieldId $.{stepId}.{fieldId}.fieldName $.{stepId}.{fieldId}.name $.{stepId}.{fieldId}.unionId $.{stepId}.{fieldId}.timestamp $.{stepId}.{fieldId}.fileName $.{stepId}.{fieldId}.fileToken ``` -------------------------------- ### Build Sidecar Server Binary Source: https://github.com/larksuite/cli/blob/main/sidecar/server-demo/README.md Build the trusted server binary using the `authsidecar_demo` build tag. ```bash go build -tags authsidecar_demo -o sidecar-server-demo ./sidecar/server-demo/ ``` -------------------------------- ### Hour Aggregation Notice Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/references/lark-drive-search.md This example demonstrates the notice printed to stderr when hour-level granularity is applied to `my_edit_time` or `my_comment_time` fields, showing the adjustment from the input time to the nearest hour. ```text notice: my_edit_time has hour-level granularity server-side; start 2026-04-22 16:23:00 -> 2026-04-22 16:00:00 end 2026-04-22 16:28:00 -> 2026-04-22 17:00:00 ``` -------------------------------- ### Using Shortcuts Source: https://github.com/larksuite/cli/blob/main/skill-template/skill-template.md Shortcuts provide a high-level abstraction for common operations. It is recommended to use shortcuts whenever available. The general format is `lark-cli + [flags]`. ```APIDOC ## Shortcuts Shortcut 是对常用操作的高级封装(`lark-cli {{service}} + [flags]`)。有 Shortcut 的操作优先使用。 | Shortcut | 说明 | |----------|------| {{shortcut_rows}} ``` -------------------------------- ### Registering an Audit Plugin Source: https://github.com/larksuite/cli/blob/main/extension/platform/README.md Example of registering a plugin that observes command execution and logs command path and errors. This is useful for auditing purposes. ```go package myplugin import ( "context" "log" "github.com/larksuite/cli/extension/platform" ) func init() { platform.Register( platform.NewPlugin("audit", "0.1.0"). Observer(platform.After, "log-cmd", platform.All(), func(ctx context.Context, inv platform.Invocation) { log.Printf("cmd=%s err=%v", inv.Cmd().Path(), inv.Err()) }). FailOpen(). MustBuild()) } ``` -------------------------------- ### Build and Run Audit Observer Plugin Source: https://github.com/larksuite/cli/blob/main/extension/platform/examples/audit-observer/README.md Builds the audit-cli binary and demonstrates its usage by showing installed plugins and making an API call, which triggers the audit observer. ```sh cd extension/platform/examples/audit-observer go build -o audit-cli . ./audit-cli config plugins show # {"plugins":[{"name":"audit", ...}], "total":1} ./audit-cli api GET /open-apis/contact/v3/users/me # [audit] api ok (on stderr) ``` -------------------------------- ### Get Bot Open ID and Authorize Document Access Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/SKILL.md Use this snippet to get the current application's open ID and then authorize it to access a document. Replace placeholders with actual values. ```bash # 1. 获取当前应用的 open_id lark-cli api GET /open-apis/bot/v3/info --as bot # 从返回值中取 bot.open_id # 2. 授权当前应用访问文档 lark-cli drive permission.members create \ --params '{"token":"","type":""}' \ --data '{"member_type":"openid","member_id":"","perm":"view","type":"user"}' ``` -------------------------------- ### Scenario 2: Paginate Through a Long Thread Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-threads-messages-list.md Illustrates how to fetch the first page of a thread and then use the pagination token to retrieve subsequent pages if more messages exist. ```bash # First page lark-cli im +threads-messages-list --thread omt_xxx ``` ```bash # If has_more=true is returned, continue with page_token lark-cli im +threads-messages-list --thread omt_xxx --page-token ``` -------------------------------- ### Create Lark Slides Presentation with Local Image Placeholder Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-create.md Create a presentation and include a local image using the `@` placeholder in the `` src attribute. The CLI uploads the image and replaces the placeholder with a file token. ```bash lark-cli slides +create --as user --title "图测试" --slides '[ "" ]' ``` -------------------------------- ### Importing CSV with Literal Strings starting with '=' using +csv-put Source: https://github.com/larksuite/cli/blob/main/skills/lark-sheets/references/lark-sheets-write-cells.md When using `+csv-put`, strings starting with '=' are treated as literal text and not interpreted as formulas. For formula insertion, `+cells-set` must be used. ```bash lark-cli sheets +csv-put --url "..." --sheet-name "Sheet1" \ --start-cell "A1" \ --csv $'name,score\nalice,=SUM(B2:B10)' ``` -------------------------------- ### Upload File Using Feishu Task Applink Source: https://github.com/larksuite/cli/blob/main/skills/lark-task/references/lark-task-upload-attachment.md Upload a local file to a task by providing a Feishu task applink URL instead of a raw GUID. The command automatically extracts the task GUID from the applink. ```bash lark-cli task +upload-attachment \ --resource-id "https://applink.feishu.cn/client/todo/task?guid=" \ --file "./note.md" ``` -------------------------------- ### Build and Run Read-Only CLI Source: https://github.com/larksuite/cli/blob/main/extension/platform/examples/readonly-policy/README.md Builds the read-only CLI and demonstrates showing the policy configuration. It also shows the expected output for a denied write command and a successful read command. ```sh cd extension/platform/examples/readonly-policy go build -o readonly-cli . ./readonly-cli config policy show # { # "source": "plugin", # "source_name": "readonly", # "denied_paths": N, # "rule": { # "name": "agent-readonly", # "allow": ["docs/**", "im/**"], # "deny": [], # "max_risk": "read", # "identities": [], # "allow_unannotated": false # } # } ./readonly-cli docs +update --doc-token X --content Y # {"ok":false,"error":{ # "type":"command_denied", # "detail":{ # "layer":"policy", # "policy_source":"plugin:readonly", # "rule_name":"agent-readonly", # "reason_code":"write_not_allowed" # } # }} ./readonly-cli docs +fetch --doc-token X # Normal read response (assuming credentials) ``` -------------------------------- ### Construct GET Mail API Command Source: https://github.com/larksuite/cli/blob/main/skill-template/domains/mail.md For GET requests, construct the command using the resource, method, and the `--params` flag for path and query parameters defined in the schema. Path parameters are automatically filled into the URL. ```bash lark-cli mail user_mailbox.messages list \ --params '{"user_mailbox_id":"me","page_size":20,"folder_id":"INBOX"}' ``` -------------------------------- ### Create Group and Send Welcome Message Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-chat-create.md Create a new group, capture its chat ID, and then send a welcome message to the new group. Requires `jq` for JSON parsing. ```bash CHAT_ID=$(lark-cli im +chat-create --name "New Group" --format json | jq -r '.data.chat_id') lark-cli im +messages-send --chat-id "$CHAT_ID" --text "Welcome, everyone!" ``` -------------------------------- ### Whiteboard Element with SVG Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-slides/references/lark-slides-whiteboard.md Example of a `` element containing an SVG graphic. The SVG is defined with a namespace and includes basic shapes like a rectangle and text. SVG coordinates are relative to the whiteboard's top-left corner. ```xml ABC ``` -------------------------------- ### Create Group with Users and Bots Source: https://github.com/larksuite/cli/blob/main/skills/lark-im/references/lark-im-chat-create.md Create a group, assign an owner, and invite both users and bots as members. ```bash lark-cli im +chat-create --name "Project Discussion Group" \ --owner ou_xxx \ --users "ou_aaa,ou_bbb" \ --bots "cli_aaa" ``` -------------------------------- ### Lark Drive Search Error Code Example Source: https://github.com/larksuite/cli/blob/main/skills/lark-drive/references/lark-drive-search.md This example shows a common error code encountered in Lark Drive searches and its corresponding meaning and resolution. It is related to open_id visibility within the application's address book scope. ```text 99992351 --creator-ids / --sharer-ids 里有 open_id 超出**应用的通讯录可见范围**,服务端拒绝识别 ``` -------------------------------- ### user_mailbox.messages get Source: https://github.com/larksuite/cli/blob/main/skills/lark-mail/SKILL.md Retrieves the details of a specific email. ```APIDOC ## lark-cli mail user_mailbox.messages get ### Description Fetches the full content and metadata of a specific email. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters (Refer to `lark-cli schema mail.user_mailbox.messages.get` for parameter details.) ### Request Example ```bash lark-cli mail user_mailbox.messages get --message-id "msg-abc" ``` ### Response (The response will contain the email's content and details.) ``` -------------------------------- ### user_mailbox.labels get Source: https://github.com/larksuite/cli/blob/main/skills/lark-mail/SKILL.md Retrieves information about a specific label. ```APIDOC ## lark-cli mail user_mailbox.labels get ### Description Fetches detailed information about a specific label. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters (Refer to `lark-cli schema mail.user_mailbox.labels.get` for parameter details.) ### Request Example ```bash lark-cli mail user_mailbox.labels get --label-id "label-abc" ``` ### Response (The response will contain the label's details.) ``` -------------------------------- ### List Applications with Custom Page Size Source: https://github.com/larksuite/cli/blob/main/skills/lark-apps/references/lark-apps-list.md Fetches applications with a specified page size. ```bash lark-cli apps +list --page-size 50 ``` -------------------------------- ### user_mailbox.threads get Source: https://github.com/larksuite/cli/blob/main/skills/lark-mail/SKILL.md Retrieves the details of a specific email thread. ```APIDOC ## lark-cli mail user_mailbox.threads get ### Description Fetches the full details of a specific email thread, including all associated messages. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters (Refer to `lark-cli schema mail.user_mailbox.threads.get` for parameter details.) ### Request Example ```bash lark-cli mail user_mailbox.threads get --thread-id "thread-1" ``` ### Response (The response will contain the thread's details and messages.) ``` -------------------------------- ### user_mailbox.template.attachments download_url Source: https://github.com/larksuite/cli/blob/main/skills/lark-mail/SKILL.md Gets the download URL for an attachment of a template. ```APIDOC ## lark-cli mail user_mailbox.template.attachments download_url ### Description Retrieves a downloadable URL for a specific attachment associated with an email template. ### Method CLI Command ### Endpoint N/A (CLI command) ### Parameters (Refer to `lark-cli schema mail.user_mailbox.template.attachments.download_url` for parameter details.) ### Request Example ```bash lark-cli mail user_mailbox.template.attachments download_url --template-id "tmpl-abc" --attachment-id "att-xyz" ``` ### Response (The response will contain the URL to download the template attachment.) ```