## 诊断流程样例
### 输入
| 字段 | 示例 | 来源 |
| --- | --- | --- |
| wiki_url | `https://bytedance.feishu.cn/wiki/...` | 用户粘贴的飞书 wiki 链接 |
| preview_comment_id | `xxxx` | URL 参数、评论预览链接或用户给定 id |
| title | `商品埋点方案-v1` | 用户要创建的新文档标题 |
### 运行
```bash
lark-wiki-comment-preflight \
--wiki-url "https://bytedance.feishu.cn/wiki/..." \
--preview-comment-id "xxxx" \
--title "商品埋点方案-v1" \
--dry-run
```
### 核心检查
| 步骤 | 检查内容 | 成功信号 | 失败信号 |
| --- | --- | --- | --- |
| 1 | 识别 wiki URL,不把 URL token 直接当 doc token | `wiki_node_token` 与 `doc_token` 分开输出 | `wiki_node_unresolved` |
| 2 | 探测 lark-cli 当前账号配置 | 输出 account/app_id/config_path | `account_config_missing` 或 `auth_expired` |
| 3 | 用真实 doc token 读取评论上下文 | 输出 `comment_excerpt` 和所在段落 | `comment_not_found` |
| 4 | 可选创建新文档并回读 | `new_doc_url` 存在,标题和核心章节校验通过 | `created_doc_verify_failed` |
### 通过后的输出
```json
{
"status": "pass",
"account": "work",
"source": {
"wiki_node_token": "...",
"doc_token": "...",
"comment_id": "xxxx",
"comment_excerpt": "..."
},
"create_ready": true
}
```
### 失败时的动作
- `wiki_node_unresolved`:不要继续创建文档,先修 wiki node 到 doc token 的解析。
- `account_config_missing`:先检查 `~/.lark-cli/config.json` 和 `~/Library/Application Support/lark-cli/`。
- `comment_not_found`:回到用户给的 preview 链接或评论 id,避免在错误上下文里写方案。
- `created_doc_verify_failed`:保留新文档 URL,但标记未验收,必须回读后再交付。