PicoBot/skills/lark-wiki/references/lark-wiki-node-copy.md
ooodc a7883dbed9 refactor(todo): 重构待办事项管理逻辑及更新状态规则
- 移除 TodoItem 中的 priority、created_at 和 updated_at 字段
- 强制每个任务都必须有唯一 id,且由用户负责生成
- 修改合并模式逻辑,merge=true 下保留未提及的旧任务
- 支持已完成和已取消任务重新激活(状态改回 pending 或 in_progress)
- 禁止 in_progress 状态退回到 pending,必须标记为 completed 或 cancelled
- 优化状态转换校验,允许特定状态间合法切换
- 简化任务变更消息,移除详细的新增/更新/移除统计
- 更新文档和示例,明确 id 必须由用户生成和使用
- 修复和补充测试,增强状态转换和合并模式验证
- 调整任务时间戳生成逻辑,统一使用当前时间及索引
- 该变更提供更合理的任务状态机械及管理模式,提升稳定性和易用性
2026-06-13 09:22:33 +08:00

73 lines
2.3 KiB
Markdown

# lark-wiki +node-copy
Copy a wiki node (including its content) to a target space or under a target parent node. Used for cross-space migration.
> ⚠️ **High-risk write** — the upstream API is flagged `danger: true`, so this shortcut requires explicit `--yes` confirmation before issuing the request. Forgetting `--yes` returns a `confirmation_required` error and the copy is **not** performed.
## Usage
```bash
lark-cli wiki +node-copy \
--space-id <source_space_id> \
--node-token <source_node_token> \
(--target-space-id <target_space_id> | --target-parent-node-token <token>) \
[--title <new_title>] \
--yes \
[--as user|bot]
```
## Flags
| Flag | Required | Description |
|------|----------|-------------|
| `--space-id` | **Yes** | Source wiki space ID |
| `--node-token` | **Yes** | Source node token to copy |
| `--target-space-id` | Conditional | Target space ID. Required if `--target-parent-node-token` is not set |
| `--target-parent-node-token` | Conditional | Target parent node token. Required if `--target-space-id` is not set |
| `--title` | No | New title for the copied node. Omit to keep the original title |
| `--yes` | **Yes** | Confirm the high-risk operation. Without this flag the shortcut refuses to send the API request |
| `--format` | No | Output format: `json` (default) / `pretty` / `table` / `csv` / `ndjson` |
| `--as` | No | Identity `user`/`bot` (default `auto`); wiki is user-centric → pass `--as user` |
> At least one of `--target-space-id` or `--target-parent-node-token` must be provided.
## Output
```json
{
"space_id": "target_space_id",
"node_token": "wikcn_EXAMPLE_TOKEN",
"obj_token": "doccn_EXAMPLE_TOKEN",
"obj_type": "docx",
"node_type": "origin",
"title": "Getting Started (Copy)",
"parent_node_token": "",
"has_child": false
}
```
## Migration workflow
To migrate a subtree from one space to another:
```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 <source_space_id> \
--node-token wikcn_EXAMPLE_TOKEN \
--target-space-id <target_space_id> \
--yes
```
## Notes
- Copying is recursive — the subtree under the node is also copied.
- There is no native move API; migration = copy to target + (manually delete source if needed).
## Required Scope
`wiki:node:copy`