How larksuite/cli works
lark-cli is the official Lark/Feishu command-line client for people and AI agents. The main workflow is invoking a CLI command, shaping it through a human- and agent-friendly shortcut or a lower-level API command, sending requests to Lark, then rendering structured output. The product also supports credential setup and login, event consumption, and enterprise embedding through extension points. The README documents broad business-domain coverage and a three-layer command model; sampled source confirms event processing and API-request behavior, but not every command’s internal wiring.
Main entry points: main.go CLI entry · client.go API client · consume.go Event runtime · service.go API commands
Components 20
CLI and setup
- CLI entry
main.go - Config and auth
cmd/config/init.go
Command surfaces
- Domain shortcuts
shortcuts - API commands
cmd/service/service.go - Raw API access
cmd/api/api.go - Base operations
shortcuts/base - Apps operations
shortcuts/apps
Platform access
- Credential flow
internal/auth/token_store.go - API client
internal/client/client.go - Structured output
internal/output/emit.go
Event processing
- Event commands
cmd/event/consume.go - Event runtime
internal/event/consume/consume.go - Event adapters
internal/event/adapter/lark/websocket/source.go - Event pipeline
shortcuts/event/pipeline.go - Event handlers
events/all.go
Enterprise embedding
- Extension platform
extension/platform/handler.go - Transport registry
extension/transport/registry.go - Command policy
internal/cmdpolicy/engine.go
Other components
- User or agent
- Lark platform
Connections 26
- User or agent → CLI entry: invokes
- CLI entry → Config and auth: dispatches setup
- Config and auth → Credential flow: configures credentials
- CLI entry → Domain shortcuts: dispatches shortcut
- CLI entry → API commands: dispatches command
- CLI entry → Raw API access: dispatches raw API
- Domain shortcuts → Base operations: routes Base
- Domain shortcuts → Apps operations: routes Apps
- Base operations → API client: requests API
- Apps operations → API client: requests API
- API commands → API client: uses client
- Raw API access → API client: uses client
- API client → Lark platform: sends requests
- API client → Structured output: returns response
- CLI entry → Structured output: renders results
- CLI entry → Event commands: dispatches events
- Event commands → Event runtime: starts consumption
- Event runtime → Event adapters: receives events
- Event adapters → Event runtime: delivers events
- Event runtime → Event handlers: dispatches handlers
- Event commands → Event pipeline: processes stream
- Event pipeline → Structured output: prints events
- Event pipeline → Lark platform: receives callbacks
- Extension platform → Transport registry: registers transports
- Extension platform → API commands: hosts commands
- Command policy → API commands: evaluates command tree