Repository navigation
fix(skills): align skill guidance with the typed error contract #1785
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -130,33 +130,38 @@ lark-cli slides xml_presentation.slide replace --as user --params '{ | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "code": 0, | ||||||||||||||||||||||||||||||||||
| "ok": true, | ||||||||||||||||||||||||||||||||||
| "identity": "user", | ||||||||||||||||||||||||||||||||||
| "data": { | ||||||||||||||||||||||||||||||||||
| "revision_id": 105 | ||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||
| "msg": "success" | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ### 失败(任一 part 失败,整批不生效) | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| 失败时返回非零错误码(如 3350001)。若后端能定位失败的 part,`data` 中可能附带: | ||||||||||||||||||||||||||||||||||
| 失败时命令以非零退出码结束,stderr 返回类型化错误信封(`error.type` / `error.subtype` / `error.code`(如 3350001)/ `error.message` / `error.hint`)。这个普通写命令的失败路径不会在 stdout 额外打印后端原始响应;脚本和 agent 应以退出码与 stderr 信封为准。 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ```json | ||||||||||||||||||||||||||||||||||
| { | ||||||||||||||||||||||||||||||||||
| "code": 3350001, | ||||||||||||||||||||||||||||||||||
| "data": { | ||||||||||||||||||||||||||||||||||
| "failed_part_index": 0, | ||||||||||||||||||||||||||||||||||
| "failed_reason": "block not found" | ||||||||||||||||||||||||||||||||||
| "ok": false, | ||||||||||||||||||||||||||||||||||
| "identity": "user", | ||||||||||||||||||||||||||||||||||
| "error": { | ||||||||||||||||||||||||||||||||||
| "type": "api", | ||||||||||||||||||||||||||||||||||
| "subtype": "...", | ||||||||||||||||||||||||||||||||||
| "code": 3350001, | ||||||||||||||||||||||||||||||||||
| "message": "...", | ||||||||||||||||||||||||||||||||||
| "hint": "..." | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||
| ``` | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| | 字段 | 类型 | 说明 | | ||||||||||||||||||||||||||||||||||
| |------|------|------| | ||||||||||||||||||||||||||||||||||
| | `data.revision_id` | integer | 成功时返回更新后最新版本号 | | ||||||||||||||||||||||||||||||||||
| | `data.failed_part_index` | integer | 失败的 part 在 `parts` 数组中的索引(从 0 起) | | ||||||||||||||||||||||||||||||||||
| | `data.failed_reason` | string | 失败原因 | | ||||||||||||||||||||||||||||||||||
| | `error.code` | integer | 失败时的上游 API 错误码 | | ||||||||||||||||||||||||||||||||||
| | `error.subtype` | string | 类型化错误子类,脚本可与 `error.code` 一起判断恢复动作 | | ||||||||||||||||||||||||||||||||||
| | `error.hint` | string | 建议的恢复动作 | | ||||||||||||||||||||||||||||||||||
|
Comment on lines
159
to
+164
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win Document the full failure envelope. The new example exposes Proposed fix | `data.revision_id` | integer | 成功时返回更新后最新版本号 |
+| `error.type` | string | 失败时的错误类型 |
+| `error.message` | string | 失败原因说明 |
| `error.code` | integer | 失败时的上游 API 错误码 |
| `error.subtype` | string | 类型化错误子类,脚本可与 `error.code` 一起判断恢复动作 |
| `error.hint` | string | 建议的恢复动作 |📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| ## 常见错误 | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Document the stable error discriminators too.
The example already relies on
error.type/error.subtype, but the table only explainserror.codeand the message fields. Please add the typed discriminator rows so readers don’t treatcodeas the only branching key.♻️ Suggested table update
📝 Committable suggestion
🤖 Prompt for AI Agents