DR

dingtalk-real-ai/dingtalk-workspace-cli

Developer tools
2,4 тыс. stars Качество 81 Тренд 81

DingTalk Workspace is an officially open-sourced cross-platform CLI tool from DingTalk. It unifies DingTalk’s full suite of product capabilities into a single package, is designed for both human...

Обзор

dws — DingTalk Workspace on the command line, built for humans and AI agents. : This project accesses DingTalk enterprise data and requires enterprise admin authorization. Join the DingTalk DWS co-creation group for support and updates. See Getting Started below. - — --help for usage, --dry-run to preview requests, -f table/json/raw for output formats. - — structured JSON responses + built-in Agent Skills, ready out of the box. - — zero-trust architecture: OAuth device-flow auth + domain allowlisting + least-privilege scoping. The installer ships skills in one of two layouts. CLI commands (dws aitable ..., dws calendar ...) are identical in both modes — only the agent-side skill layout differs. 🧪 18 product-scoped skills all pass the dispatch verifier, but interface, naming and cross-skill references may change in future releases. For production / shared environments, prefer mono. File issues if you hit problems. - (one-liner above): non-interactive, installs mono.

README

DingTalk Workspace CLI (dws)

dws — DingTalk Workspace on the command line, built for humans and AI agents.

中文版 · English · Reference · Changelog

[!IMPORTANT] Co-creation Phase: This project accesses DingTalk enterprise data and requires enterprise admin authorization. Join the DingTalk DWS co-creation group for support and updates. See Getting Started below.


Why dws?

  • For humans--help for usage, --dry-run to preview requests, -f table/json/raw for output formats.
  • For AI agents — structured JSON responses + built-in Agent Skills, ready out of the box.
  • For enterprise admins — zero-trust architecture: OAuth device-flow auth + domain allowlisting + least-privilege scoping. Not a single byte can bypass authentication and audit.

Installation

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.sh | sh

Windows (PowerShell):

irm https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install.ps1 | iex

China mirror

For users in mainland China, the following channels avoid GitHub network issues. By default (without setting these environment variables) the installer pulls from GitHub.

1. Install script + pre-built binary (Gitee mirror):

Repository mirror: https://gitee.com/DingTalk-Real-AI/dingtalk-workspace-cli

DWS_GITEE_REPO=DingTalk-Real-AI/dingtalk-workspace-cli curl -fsSL https://gitee.com/DingTalk-Real-AI/dingtalk-workspace-cli/raw/main/scripts/install.sh | sh

With DWS_GITEE_REPO set, the installer resolves the latest version and every release asset (binary, checksums, skills) from the Gitee API instead of GitHub. If it is unset, installation defaults to GitHub.

2. npm package (npmmirror mirror):

npm install -g dingtalk-workspace-cli --registry=https://registry.npmmirror.com

npmmirror automatically syncs public packages from the public npm registry, so this works directly in China.

3. Skills only (Gitee mirror):

DWS_GITEE_REPO=DingTalk-Real-AI/dingtalk-workspace-cli curl -fsSL https://gitee.com/DingTalk-Real-AI/dingtalk-workspace-cli/raw/main/scripts/install-skills.sh | sh

With DWS_GITEE_REPO set, install-skills.sh resolves the version and skills package from Gitee; it also auto-falls back to the Gitee mirror when GitHub is unreachable.

Upgrade

Requires v1.0.7 or later. For earlier versions, please re-run the install script to upgrade.

dws has built-in self-upgrade capability. Updates are pulled directly from GitHub Releases with SHA256 integrity verification and automatic backup.

dws upgrade                    # interactive upgrade to latest version
dws upgrade --check            # check for new versions without installing
dws upgrade --list             # list stable release versions
dws upgrade --beta             # upgrade to the latest beta pre-release
dws upgrade --check --beta     # check the beta track without installing
dws upgrade --list --beta      # list beta pre-release versions
dws upgrade --version v1.0.7   # upgrade to a specific version
dws upgrade --version v1.0.8-beta.1  # upgrade to a specific beta version
dws upgrade --rollback         # rollback to the previous version
dws upgrade -y                 # skip confirmation prompt

By default, dws upgrade follows the stable release track. Use --beta only when you explicitly want the newest GitHub pre-release build.

Getting Started

dws auth login            # browser opens automatically
dws auth login --device   # for headless environments (Docker, SSH, CI)

Select your organization and authorize. That’s it.

If your organization hasn’t enabled CLI access, you’ll be prompted to send an access request to your admin. Once approved, re-run dws auth login.

Quick Start

dws contact user search --query "engineering"      # search contacts
dws calendar event list                            # list today's calendar events
dws doc search --query "quarterly"                 # search DingTalk Docs
dws minutes list mine                              # list AI meeting notes I created
dws drive list                                     # list DingTalk drive files
dws todo task create --title "Quarterly report" --executors ""   # create a todo (replace )
dws todo task list --dry-run                       # preview without executing

Full command list: docs/command-index.md — all commands with descriptions and when-to-use guidance.

Using with Agents

dws is designed as an AI-native CLI. Complete Installation and Getting Started first, then configure your agent:

Agent Invocation Patterns

# Use --yes to skip confirmation prompts (required for agents)
dws todo task create --title "Review PR" --executors "" --yes

# Use --dry-run to preview operations (safe execution)
dws contact user search --query "engineering" --dry-run

# Use --jq to extract precisely (save tokens)
dws contact user get-self --jq '.result[0].orgEmployeeModel | {name: .orgUserName, dept: .depts[0].deptName, userId}'

Command Help and Schema

Product commands are compiled into the binary in static endpoint mode. Use --help and the bundled Agent Skills as the source of truth; dws schema is retained for helper-only schemas such as dev.*.

# Inspect the current compiled command surface
dws aitable record query --help

# Helper-only schema introspection
dws schema "dev app create"

# Construct the call
dws aitable record query --base-id BASE_ID --table-id TABLE_ID --limit 10

Agent Skills

The repo ships a complete Agent Skill system under skills/, now organized into two layouts:

  • skills/mono/ — single-skill layout (one SKILL.md + references/products/), recommended default.
  • skills/multi/ — per-product skills (dingtalk-aitable/, dingtalk-calendar/, dingtalk-chat/, … 20 products in total), each with its own SKILL.md. 🧪 EXPERIMENTAL / preview — see banner in each multi SKILL.md for caveats.

After installing, AI tools like Claude Code / Cursor can operate DingTalk directly through natural language:

# Install skills into current project (defaults to mono)
curl -fsSL https://raw.githubusercontent.com/DingTalk-Real-AI/dingtalk-workspace-cli/main/scripts/install-skills.sh | sh

install.sh installs to $HOME/.agents/skills/dws (global); install-skills.sh installs to ./.agents/skills/dws (current project).

China users: prefix DWS_GITEE_REPO to use the Gitee mirror — see China mirror.

Switching or re-installing with dws skill setup:

# Interactive: prompts for mode + target agents
dws skill setup

# Install mono skill to every detected agent home (claude / cursor / codex / opencode / qoder)
dws skill setup --mode mono --target all --yes

# Install multi skills to a single agent home
dws skill setup --mode multi --target cursor --yes

# Point at a local source tree (e.g. a fork or work-in-progress)
DWS_SKILL_SOURCE=/path/to/skills dws skill setup --mode multi
Flag Values Description
--mode mono | multi Skill layout; defaults to interactive prompt
--target all | claude | cursor | codex | opencode | qoder Where to install; all covers every detected agent home
--source path Local source directory (overrides bundled skills)
--yes Skip confirmation prompts

Env vars: DWS_SKILL_MODE=mono|multi (also honored by install.sh / install.ps1), DWS_SKILL_SOURCE=.

What’s included (mono layout):

Component Path Description
Master Skill skills/mono/SKILL.md Intent routing, decision tree, safety rules, error handling
Product references skills/mono/references/products/*.md Per-product command reference (aitable, chat, calendar, etc.)
Intent guide skills/mono/references/intent-guide.md Disambiguation for confusing scenarios (e.g. report vs todo)
Global reference skills/mono/references/global-reference.md Auth, output formats, global flags
Error codes skills/mono/references/error-codes.md Error codes + debugging workflows
Recovery guide skills/mono/references/recovery-guide.md RECOVERY_EVENT_ID handling
Ready-made scripts skills/mono/scripts/*.py 13 batch operation scripts (see below)

ISV Integration: Author your own Agent Skills and orchestrate them with dws skills for cross-product workflows: ISV Skill → dws Skill → DingTalk Open Platform API (enforced auth + full audit).

Features

DingTalk bot — connect a robot to your local AI

dws dev connect bridges a DingTalk robot to a local AI CLI (Claude Code / Codex / opencode / Qoder / Gemini, or any tool via --agent-cmd): @-mention the bot in a chat and it answers using your local agent, keeping per-conversation multi-turn memory.

dws dev connect --channel auto --unified-app-id 

--unified-app-id resolves clientSecret at runtime via dev app credentials get, so the secret never appears in argv (ps / journald / shell history). The legacy --robot-client-id --robot-client-secret still works but the CLI will warn you.

In-chat session commands (send the bare command as the whole message — no agent turn, no tokens):

Command Effect
/new (aliases /start, /reset) Start a fresh session; the previous one is left intact (resumable where the agent supports it)
/clear Wipe the current session — disposed through the agent’s real session op (opencode issues DELETE /session/:id); channels whose agent exposes no delete primitive fall back to a reset

See docs/robot-quickstart.md for the full 4-step walkthrough (install → create robot → connect → add to a group).

Key Services

Service Command Capabilities
Contact contact Look up users by name / mobile / job-number, departments, labels & roles, roster profiles & dismissals
Chat / IM chat (im) Send / reply / search messages, group & member management, bot & webhook messaging, reactions, recall
Calendar calendar Events CRUD, attendees, meeting rooms, free/busy & time suggestions
Todo todo Create / list / update / complete tasks and comments
Approval oa Approve / reject / revoke / transfer; query pending / initiated / CC instances and forms
Attendance attendance Clock-in records, shifts, summaries, group rules (read-only)
Ding ding Send / recall DING messages
Report report Create / submit logs, inbox & outbox, templates, statistics
AI Tables aitable Bases / tables / records / fields / views, permissions & roles, automation, charts & dashboards, import / export
Doc doc Search / read / write docs, block-level editing, comments, permissions, media, up / download
Drive drive List / search / download, folders, upload, copy / move / rename, permissions
Minutes minutes AI meeting notes: list, summary / keywords / transcription / todos, mind map, speakers, tags
Mail mail Mailboxes, KQL search, read / send, drafts, folders, templates, contacts
Sheet sheet Online spreadsheets: worksheet & range read / write, filters, conditional format, images, CSV
Wiki wiki Knowledge bases: spaces, members, node tree, docs & files
DevDoc devdoc Search the Open Platform docs and diagnose API errors
AI Search aisearch Enterprise people search by name / dept / role / duty / supervisor / phone / job-number
Live live List my live streams
Raw API api Call any DingTalk OpenAPI directly, with managed app-level token

Full command listing with usage scenarios: docs/command-index.md. Run dws --help for the top-level tree, or dws --help for any service’s subcommands.

Note on chat bot: bot capabilities (send-by-bot / recall-by-bot / add-bot / send-by-webhook / bot search) are merged into the relevant chat subtrees (e.g. dws chat message send-by-bot, dws chat group members add-bot) so the agent-facing command surface stays flat and discoverable. There is no longer a separate top-level bot product.

Security by Design

dws treats security as a first-class architectural concern, not an afterthought. Credentials never touch disk, tokens never leave trusted domains, permissions never exceed grants, operations never escape audit — every API call must pass through DingTalk Open Platform’s authentication and audit chain, no exceptions.

Found a vulnerability? Report via GitHub Security Advisories. See SECURITY.md.

Reference & Docs

  • Command Index — every runtime command with description and when-to-use guidance
  • Reference — environment variables, exit codes, output formats, shell completion
  • Architecture — static endpoint pipeline, command surface, transport layer
  • Open Platform App Command Routing — yulan dev app command design, MCP overlay, permission flow, and Agent routing
  • Changelog — release history and migration notes

Contributing

See CONTRIBUTING.md for build instructions, testing, and development workflow.

License

Apache-2.0

View this README on GitHub

Рекомендуемые инструменты

Попробуйте другой запрос или уберите фильтр.

Установка

npx skillfish add dingtalk-real-ai/dingtalk-workspace-cli