Skip to content

docs(wiki): route node resolution through shortcut - #2132

Open
liujinkun2025 wants to merge 2 commits into
mainfrom
docs/wiki-node-get-routing
Open

docs(wiki): route node resolution through shortcut#2132
liujinkun2025 wants to merge 2 commits into
mainfrom
docs/wiki-node-get-routing

Conversation

@liujinkun2025

@liujinkun2025 liujinkun2025 commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

Summary

Route explicit Wiki node resolution through wiki +node-get instead of teaching agents to call the raw wiki spaces get_node command. This makes the preferred shortcut discoverable in high-frequency Wiki guidance while preserving drive +inspect as the canonical token inference and resource-routing entry point.

Changes

  • Update Wiki member and space-resolution guidance to use wiki +node-get and the corresponding data.* envelope fields.
  • Keep node resolution on the same identity as the downstream operation, defaulting to user unless a bot view is explicitly requested.
  • Align the delete-space, Drive permission, and Slides references with the same shortcut-first guidance for explicit Wiki node resolution.
  • Preserve the shared drive +inspect routing guidance and its canonical token inference behavior.
  • Keep raw get_node usage only as an explicit schema-first fallback in the Wiki skill.

Test Plan

  • Unit tests pass: go test ./internal/qualitygate/skillscan ./internal/qualitygate/semantic
  • Manual local verification confirms go run . wiki +node-get --node-token <wiki-url> --as user --format json --dry-run emits the expected GET /open-apis/wiki/v2/spaces/get_node request.
  • bash scripts/semantic-review-workflow.test.sh
  • git diff --check

Related Issues

  • None

Summary by CodeRabbit

  • Documentation
    • Updated Wiki and Slides guidance for resolving links and node information.
    • Improved identification of spaces, pages, nodes, and underlying content types.
    • Standardized lookup behavior across supported Wiki workflows.
    • Added a validated fallback when the preferred lookup cannot provide required details.
    • Clarified that link resolution and follow-up actions use the same identity context.
    • Existing confirmation and deletion safeguards remain unchanged.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths labels Jul 31, 2026
@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@8e19aae336465c4d5d044623d3df73a21f3f194d

🧩 Skill update

npx skills add larksuite/cli#docs/wiki-node-get-routing -y -g

@codecov

codecov Bot commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.48%. Comparing base (41692b7) to head (8e19aae).
⚠️ Report is 2 commits behind head on main.

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The pull request updates Wiki URL resolution guidance across Drive, Slides, and Wiki skills. It replaces direct spaces get_node usage with wiki +node-get, reads top-level response fields, and documents a schema-validated fallback.

Changes

Wiki resolution guidance

Layer / File(s) Summary
Standardize Wiki node resolution
skills/lark-wiki/SKILL.md, skills/lark-drive/references/lark-drive-apply-permission.md, skills/lark-slides/SKILL.md
The documentation uses wiki +node-get for Wiki URL resolution. Drive and Slides guidance reads top-level obj_token and obj_type fields. Wiki guidance prefers the shortcut and allows a schema-validated fallback.
Update space deletion resolution
skills/lark-wiki/SKILL.md, skills/lark-wiki/references/lark-wiki-delete-space.md
Space deletion guidance reads top-level space_id from wiki +node-get. Existing deletion safeguards and fallback rules remain documented.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

  • larksuite/cli#982: Updates Wiki URL resolution to use wiki +node-get and parse top-level object fields.
  • larksuite/cli#1275: Updates Wiki node and space identifier guidance in skills/lark-wiki/SKILL.md.
  • larksuite/cli#2112: Routes Wiki URLs through wiki +node-get and resolves top-level object fields.

Suggested labels: documentation

Suggested reviewers: fangshuyu-768

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes routing Wiki node resolution through the shortcut.
Description check ✅ Passed The description covers the summary, changes, test plan, and related issues, with specific verification steps and scope.
✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Fix failing CI checks
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch docs/wiki-node-get-routing

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@liujinkun2025
liujinkun2025 force-pushed the docs/wiki-node-get-routing branch from e12a095 to 6f542aa Compare July 31, 2026 07:43
## 与 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` 调本命令。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread skills/lark-wiki/SKILL.md Outdated
- 用户要**整理 / 盘点 / 归类 / 重构知识库、个人文档库、文档库目录或 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`。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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` 调本命令。

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

「再用 bare token + --type docx 调本命令。」 是否会误导都使用 --type docx,而不是真实obj_type

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
skills/lark-drive/references/lark-drive-apply-permission.md (1)

73-73: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep 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 use wiki +node-get when they need data.obj_token and data.obj_type for 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

📥 Commits

Reviewing files that changed from the base of the PR and between 6f542aa and 8e19aae.

📒 Files selected for processing (4)
  • skills/lark-drive/references/lark-drive-apply-permission.md
  • skills/lark-slides/SKILL.md
  • skills/lark-wiki/SKILL.md
  • skills/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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants