Files
dingtalk-workspace-cli/docs/reference.md
T
qinzeandClaude Opus 4.6 077039bbf3 docs: streamline README layout and add reference manual
- Simplify README.md and README_en.md with cleaner structure
- Add centralized navigation links (reference, changelog)
- Condense co-creation notice and quick-start sections
- Add docs/reference.md as a unified command reference manual

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-28 20:26:20 +08:00

61 lines
2.4 KiB
Markdown

# Reference / 参考手册
## Environment Variables / 环境变量
| Variable | Purpose / 用途 |
|---------|---------|
| `DWS_CONFIG_DIR` | Override default config directory / 覆盖默认配置目录 |
| `DWS_SERVERS_URL` | Point discovery at a custom server registry endpoint / 将服务发现指向自定义端点 |
| `DWS_CLIENT_ID` | OAuth client ID (DingTalk AppKey) |
| `DWS_CLIENT_SECRET` | OAuth client secret (DingTalk AppSecret) |
| `DWS_TRUSTED_DOMAINS` | Comma-separated trusted domains for bearer token (default: `*.dingtalk.com`). `*` for dev only / Bearer token 允许发送的域名白名单,默认 `*.dingtalk.com`,仅开发环境可设为 `*` |
| `DWS_ALLOW_HTTP_ENDPOINTS` | Set `1` to allow HTTP for loopback during dev / 设为 `1` 允许回环地址 HTTP,仅用于开发调试 |
## Exit Codes / 退出码
| Code | Category | Description / 描述 |
|------|----------|-------------|
| 0 | Success | Command completed successfully / 命令执行成功 |
| 1 | API | MCP tool call or upstream API failure / MCP 工具调用或上游 API 失败 |
| 2 | Auth | Authentication or authorization failure / 身份认证或授权失败 |
| 3 | Validation | Invalid input, flags, or parameter schema mismatch / 输入参数校验失败 |
| 4 | Discovery | Server discovery, cache, or protocol negotiation failure / 服务发现失败 |
| 5 | Internal | Unexpected internal error / 未预期的内部错误 |
With `-f json`, error responses include structured payloads: `category`, `reason`, `hint`, `actions`.
使用 `-f json` 时,错误响应包含结构化字段:`category`、`reason`、`hint`、`actions`。
## Output Formats / 输出格式
```bash
dws contact user search --keyword "Alice" -f table # Table (default, human-friendly / 表格,默认)
dws contact user search --keyword "Alice" -f json # JSON (for agents and piping / 适合 agent)
dws contact user search --keyword "Alice" -f raw # Raw API response / 原始响应
```
## Dry Run / 试运行
```bash
dws todo task list --dry-run # Preview MCP call without executing / 预览但不执行
```
## Output to File / 输出到文件
```bash
dws contact user search --keyword "Alice" -o result.json
```
## Shell Completion / 自动补全
```bash
# Bash
dws completion bash > /etc/bash_completion.d/dws
# Zsh
dws completion zsh > "${fpath[1]}/_dws"
# Fish
dws completion fish > ~/.config/fish/completions/dws.fish
```