- 移除 TodoItem 中的 priority、created_at 和 updated_at 字段 - 强制每个任务都必须有唯一 id,且由用户负责生成 - 修改合并模式逻辑,merge=true 下保留未提及的旧任务 - 支持已完成和已取消任务重新激活(状态改回 pending 或 in_progress) - 禁止 in_progress 状态退回到 pending,必须标记为 completed 或 cancelled - 优化状态转换校验,允许特定状态间合法切换 - 简化任务变更消息,移除详细的新增/更新/移除统计 - 更新文档和示例,明确 id 必须由用户生成和使用 - 修复和补充测试,增强状态转换和合并模式验证 - 调整任务时间戳生成逻辑,统一使用当前时间及索引 - 该变更提供更合理的任务状态机械及管理模式,提升稳定性和易用性
58 lines
2.8 KiB
Markdown
58 lines
2.8 KiB
Markdown
# task +create
|
|
|
|
> **Prerequisites:** Please read `../lark-shared/SKILL.md` to understand authentication, global parameters, and security rules.
|
|
|
|
Create a new task in Lark.
|
|
|
|
## Recommended Commands
|
|
|
|
```bash
|
|
# Create a task with all details
|
|
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"
|
|
|
|
# Create a task assigned to an app
|
|
lark-cli task +create \
|
|
--summary "Nightly Sync" \
|
|
--assignee "cli_xxx"
|
|
|
|
# Create a simple task
|
|
lark-cli task +create \
|
|
--summary "Buy milk"
|
|
|
|
# Preview the API call without executing
|
|
lark-cli task +create --summary "Test Task" --dry-run
|
|
```
|
|
|
|
## Parameters
|
|
|
|
| Parameter | Required | Description |
|
|
|-----------|----------|-------------|
|
|
| `--summary <text>` | Yes | The title or summary of the task |
|
|
| `--description <text>` | No | Detailed description of the task |
|
|
| `--assignee <id>` | No | Assignee ID. Use user `open_id` like `ou_xxx` for people, or app ID like `cli_xxx` for apps. |
|
|
| `--follower <id>` | No | Follower ID. Use user `open_id` like `ou_xxx` for people, or app ID like `cli_xxx` for apps. |
|
|
| `--due <time>` | No | Due date. Supports ISO 8601, `YYYY-MM-DD`, relative time (e.g., `+2d`), or ms timestamp. `YYYY-MM-DD` and relative time will automatically set it as an all-day task. |
|
|
| `--tasklist-id <id>` | No | The GUID of the tasklist, or a full AppLink URL (the CLI will automatically extract the `guid` parameter from the URL). |
|
|
| `--idempotency-key <key>` | No | Client token to ensure idempotency of the request. |
|
|
| `--dry-run` | No | Preview the API call (JSON payload) without actually creating the task. |
|
|
|
|
## Workflow
|
|
|
|
1. Confirm with the user: task summary, due date, assignee, and tasklist if necessary.
|
|
- **Crucial Rule for Assignee**: If the user explicitly or implicitly says "create a task for me" (给我创建一个任务), or "help me create a task" (帮我新建/创建一个任务), you MUST assign the task to the current logged-in user. You can get the current user's `open_id` by executing `lark-cli auth status` (it already outputs JSON by default, so do not add `--json`) or `lark-cli contact +get-user` first, extracting `.identities.user.openId` (from `auth status`) or `.data.user.open_id` (from `contact +get-user`), and then passing it to the `--assignee` parameter.
|
|
2. Execute `lark-cli task +create --summary "..." ...`
|
|
3. Report the result: task ID and summary.
|
|
|
|
> [!CAUTION]
|
|
> This is a **Write Operation** -- You must confirm the user's intent before executing.
|
|
|
|
## References
|
|
|
|
- [lark-task](../SKILL.md) -- All task commands
|
|
- [lark-shared](../../lark-shared/SKILL.md) -- Authentication and global parameters
|