docs(wiki): route node resolution through shortcut - #2132
Conversation
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8e19aae336465c4d5d044623d3df73a21f3f194d🧩 Skill updatenpx skills add larksuite/cli#docs/wiki-node-get-routing -y -g |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2132 +/- ##
==========================================
+ Coverage 75.46% 75.48% +0.01%
==========================================
Files 928 928
Lines 98457 98600 +143
==========================================
+ Hits 74303 74427 +124
- Misses 18506 18519 +13
- Partials 5648 5654 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
📝 WalkthroughWalkthroughThe pull request updates Wiki URL resolution guidance across Drive, Slides, and Wiki skills. It replaces direct ChangesWiki resolution guidance
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
e12a095 to
6f542aa
Compare
| ## 与 wiki URL 的关系 | ||
|
|
||
| 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`(例如想显式对底层 docx 申请),自行先调 `wiki spaces get_node` 拿 `obj_token + obj_type`,再用 bare token + `--type docx` 调本命令。 | ||
| 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`(例如想显式对底层 docx 申请),先调 `wiki +node-get --node-token '<wiki_url>' --as user --format json`,从顶层读取 `obj_token + obj_type`,再用 bare token + `--type docx` 调本命令。 |
There was a problem hiding this comment.
[P2] Point agents to the fields inside the JSON envelope
wiki +node-get --format json is emitted through RuntimeContext.OutFormat, so these flattened node fields live at data.space_id, data.obj_token, and data.obj_type, not at the JSON root. Calling them “top-level” can make agents read .space_id or .obj_token and pass an empty identifier into the next command; the same wording is repeated in the Wiki delete-space and Slides guidance. Please name the actual data.* paths, or explicitly say that these fields are top-level within data, throughout the changed documentation.
There was a problem hiding this comment.
Fixed in 8e19aae. The guidance now names the actual envelope paths (data.space_id, data.obj_token, and data.obj_type) across Wiki, delete-space, Drive permission, and Slides docs.
| - 用户要**整理 / 盘点 / 归类 / 重构知识库、个人文档库、文档库目录或 Wiki 节点结构**,或要生成整理方案、目标目录树、移动计划时,不要只使用 Wiki 节点 API。必须先阅读 [`../lark-drive/references/lark-drive-workflow.md`](../lark-drive/references/lark-drive-workflow.md),再按其中 `Workflow Registry` 进入 [`knowledge_organize`](../lark-drive/references/lark-drive-workflow-knowledge-organize.md) workflow;该 workflow 负责 Drive / Wiki / 个人文档库的统一入口解析、资源盘点、分类计划、写前确认和结果验证。 | ||
| - 用户要把**已有 Wiki 节点移出知识库,放到 Drive 文件夹或“我的空间”根目录**:使用 `wiki +move-to-drive`,不要使用 `wiki +move` 或 `drive +move`。这是会改变节点归属和权限继承的写操作,执行前确认源节点与目标位置。 | ||
| - 用户给的是知识库 URL(`.../wiki/<token>`),且后续要查成员/加成员/删成员:先调用 `lark-cli wiki spaces get_node --params '{"token":"<wiki_token>"}'` 获取 `space_id`,后续成员接口统一使用 `space_id`。 | ||
| - 用户给的是知识库 URL(`.../wiki/<token>`),且后续要查成员/加成员/删成员:先调用 `lark-cli wiki +node-get --node-token '<wiki_url>' --as user --format json` 获取顶层 `space_id`,后续成员接口统一使用 `space_id`。 |
There was a problem hiding this comment.
[P2] Resolve the node with the downstream identity
This command hard-codes --as user, but +node-get, +member-list, +member-add, +member-remove, and +delete-space all support bot identity, and the identity policy above requires --as bot when the user explicitly asks for the bot view. In a bot-only or bot-visible workflow, the new resolution step can fail before a valid bot operation or resolve against a different visibility set. Please instruct agents to use the same identity as the downstream operation, defaulting to user when no bot view was requested, and apply the same adjustment to the delete-space example.
There was a problem hiding this comment.
Fixed in 8e19aae. The Wiki and delete-space guidance now requires node resolution to use the same identity as the downstream operation: user by default, or bot when the bot view was explicitly requested.
| ## 与 wiki URL 的关系 | ||
|
|
||
| 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`(例如想显式对底层 docx 申请),自行先调 `wiki spaces get_node` 拿 `obj_token + obj_type`,再用 bare token + `--type docx` 调本命令。 | ||
| 传入 `/wiki/<node_token>` 时,shortcut 会直接用 `node_token` 作为路径参数并以 `type=wiki` 调用接口。如果需要先把 wiki 节点解析成 `obj_token`(例如想显式对底层 docx 申请),先调 `wiki +node-get --node-token '<wiki_url>' --as user --format json`,从顶层读取 `obj_token + obj_type`,再用 bare token + `--type docx` 调本命令。 |
There was a problem hiding this comment.
「再用 bare token + --type docx 调本命令。」 是否会误导都使用 --type docx,而不是真实obj_type
There was a problem hiding this comment.
Fixed in 8e19aae. The guidance now passes the resolved data.obj_type to --type; docx is retained only as an explicit example when the resolved type is actually docx.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
skills/lark-drive/references/lark-drive-apply-permission.md (1)
73-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winKeep this guidance at the caller/API level.
This line exposes shortcut internals, including path-parameter handling and
type=wiki. That detail can become stale and couples this Drive reference to implementation behavior. State only that callers can pass a Wiki URL directly, and usewiki +node-getwhen they needdata.obj_tokenanddata.obj_typefor a non-Wiki permission request.Based on learnings: keep Lark CLI skill guidance concise and avoid internal implementation or compatibility details.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@skills/lark-drive/references/lark-drive-apply-permission.md` at line 73, 简化该段调用说明:说明调用者可直接传入 Wiki URL;若需针对非 Wiki 类型申请权限,先使用 wiki +node-get 获取 data.obj_token 和 data.obj_type,再将这些值用于后续请求。移除路径参数、shortcut、type=wiki、身份复用及底层兼容性等实现细节。Source: Learnings
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@skills/lark-drive/references/lark-drive-apply-permission.md`:
- Line 73: 简化该段调用说明:说明调用者可直接传入 Wiki URL;若需针对非 Wiki 类型申请权限,先使用 wiki +node-get 获取
data.obj_token 和
data.obj_type,再将这些值用于后续请求。移除路径参数、shortcut、type=wiki、身份复用及底层兼容性等实现细节。
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 8dac7ce3-5b3d-4c26-9b86-0661b4961172
📒 Files selected for processing (4)
skills/lark-drive/references/lark-drive-apply-permission.mdskills/lark-slides/SKILL.mdskills/lark-wiki/SKILL.mdskills/lark-wiki/references/lark-wiki-delete-space.md
🚧 Files skipped from review as they are similar to previous changes (3)
- skills/lark-wiki/references/lark-wiki-delete-space.md
- skills/lark-slides/SKILL.md
- skills/lark-wiki/SKILL.md
Summary
Route explicit Wiki node resolution through
wiki +node-getinstead of teaching agents to call the rawwiki spaces get_nodecommand. This makes the preferred shortcut discoverable in high-frequency Wiki guidance while preservingdrive +inspectas the canonical token inference and resource-routing entry point.Changes
wiki +node-getand the correspondingdata.*envelope fields.drive +inspectrouting guidance and its canonical token inference behavior.get_nodeusage only as an explicit schema-first fallback in the Wiki skill.Test Plan
go test ./internal/qualitygate/skillscan ./internal/qualitygate/semanticgo run . wiki +node-get --node-token <wiki-url> --as user --format json --dry-runemits the expectedGET /open-apis/wiki/v2/spaces/get_noderequest.bash scripts/semantic-review-workflow.test.shgit diff --checkRelated Issues
Summary by CodeRabbit