lark-bot-permissions
Skill20 starsChanged 6 months agoMITView on GitHub
Grant/open Feishu permission scopes for a TaroCub Lark bot APP by driving the Feishu developer console in a browser — QR-login (send the QR to the user over the bridge), bulk-import the scope JSON, 申请开通, verify, and restart the instance. Use when the user wants to "开/加/申请 权限/scope" for a bot (e.g. 群里非@也回应 / Sheets / Calendar / Base / Wiki) — anything where the bot APP itself needs a console scope import. NOT for user-identity (lark-cli) features like creating Docs/Sheets/Calendar "as me" — those already work through the operator's lark-cli login and need no console import.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- cloveric/cc-telegram-bridgeword for word, first seen Oct 9, 2026
Other versions1 project uses a version of this.
Word for word · 1
- cloveric/cc-telegram-bridge★ 20100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository4 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- scraplingSkill
- tarocub-service-opsSkill
The file
We split this skill into the rules it gives an agent
5 rules. About 0 are common, 3 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 34
Do not guess scope names or URLs.
- Distinctive: line 58
If the title is the login page instead, do a QR login and hand the QR to the user over the bridge (they are usually on mobile / away from …
- Very specific: line 74
Read the crop to confirm it's a clean QR (adjust --cropOffset/-c if the window size differs), then send it: …
- Very specific: line 78
After they confirm, agent-browser --session feishu get title should now show the 权限管理 page.
- Distinctive: line 95
NOT corrupt it (typing char-by-char would).
≈ “Common” is an estimate: at least 1 in 5 of the 364,980 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Grant Feishu scopes to a TaroCub bot (console import via browser)
Productizes the manual flow: log into the Feishu developer console, bulk-import a scope group for a bot's app, 申请开通, verify it's live, restart the instance.
When this is needed (and when it is NOT)
- Needed — the bot app must receive/send something it can't yet: non-@ group
messages (
im:message.group_msg), broad chat/member admin, or any advanced family imported as a tenant scope. The QR registration auto-grants NONE of these; they require a console import + (for non-personal apps) a version publish. - NOT needed — "create a Doc/Sheet/Calendar event as me". Those run through the operator's lark-cli user login (full user scopes), not the bot app, so they already work. Don't send the user to the console for these.
- Creating a new bot is a different step:
node dist/src/index.js lark setup --identity bot-only(QR PersonalAgent registration). This skill is only the permission part for an app that already exists.
Inputs
- The instance name, e.g.
ccfcc3(state dir~/.cctb/<inst>). - Which feature/scope group, e.g. "群里非@也回" → the
group-messagesgroup (im:message,im:message.group_msg). The exact JSON comes from step 1 — never hand-type scope strings.
Step 1 — Get the exact import JSON, appId, and console URL from the bridge
Do not guess scope names or URLs; the bridge prints them per feature group:
env CCTB_LARK_STATE_DIR="$HOME/.cctb/<inst>" CCTB_LARK_INSTANCE=<inst> TAROCUB_INSTANCE=<inst> \
node dist/src/index.js lark permissionsCopy the line for the feature the user asked for, e.g.:
• ordinary (non-@) group messages — /group all: {"scopes":{"tenant":["im:message","im:message.group_msg"]}}
and note the app's permission URL: https://open.feishu.cn/app/<appId>/auth
(also printed by lark provision as the "permissions page" line).
Step 2 — Browser session + Feishu console login
The browser is agent-browser (its own managed Chrome — NOT the user's main one),
session name feishu. Saved console auth lives at ~/.cctb/feishu-console-auth.json.
# Try the saved login first (refreshed each successful run):
agent-browser --session feishu state load ~/.cctb/feishu-console-auth.json
agent-browser --session feishu open "https://open.feishu.cn/app/<appId>/auth"
agent-browser --session feishu get title # logged in ⇒ "权限管理 - <APP> - 开发者后台"If the title is the login page instead, do a QR login and hand the QR to the user over the bridge (they are usually on mobile / away from the Mac):
agent-browser --session feishu --headed open "https://open.feishu.cn/app/<appId>/auth"(redirects toaccounts.feishu.cn/.../login).agent-browser --session feishu screenshotthenReadit. If the QR shows a "刷新二维码" refresh overlay it has EXPIRED — find that element and click it:REF=$(agent-browser --session feishu snapshot -i | grep 刷新二维码 | grep -oE 'ref=e[0-9]+' | head -1 | cut -d= -f2)→agent-browser --session feishu click "@$REF"→ re-screenshot.- Crop just the QR (the screenshot is Retina 2×, ~1200px wide; the QR sits
center-left). Stage it inside the instance workspace — the bridge only
delivers files under
~/.cctb/<inst>/workspace/(a/tmppath is rejected with "文件未发送:路径不在允许目录内"):
Read the crop to confirm it's a clean QR (adjustSRC=$(ls -t ~/.agent-browser/tmp/screenshots/*.png | head -1) sips -c 320 320 --cropOffset 450 180 "$SRC" -o ~/.cctb/<inst>/workspace/feishu-qr.png--cropOffset/-cif the window size differs), then send it:[send-image:/Users/<you>/.cctb/<inst>/workspace/feishu-qr.png]Tell them to scan with Feishu mobile (扫一扫 → 相册). QRs expire in ~1–2 min; refresh and resend if they're slow. - After they confirm,
agent-browser --session feishu get titleshould now show the 权限管理 page.
Step 3 — Bulk-import the scope JSON (Monaco editor)
# Open the dialog (find by text — refs change between runs):
agent-browser --session feishu snapshot -i | grep '批量导入/导出权限' # → click that ref
# Ensure the 导入 (import) tab is active; the editor is a Monaco textbox
# labelled "Editor content;Press Alt+F1 ...".Gotchas (learned the hard way):
fillPREPENDS, it does not replace. Clear first: click the editor,press "Meta+a",press "Backspace", screenshot to confirm it's empty.- Then
fill @<editor-ref> '{"scopes":{"tenant":["im:message","im:message.group_msg"]}}'. agent-browser'sfillinserts in bulk, so Monaco's auto-closing brackets do NOT corrupt it (typing char-by-char would). Screenshot to verify line 1 is exactly your JSON with no leftover sample and no doubled brackets. window.monacois NOT exposed, soagent-browser evalcannot setValue — use the clear-then-fill keyboard path above.
Then: click "下一步,确认新增权限" → a confirm dialog lists the scopes (verify
they match what the user wanted; sensitive ones like 获取群组中所有消息 are flagged
敏感权限) → click "申请开通" (find the real button ref, not the container).
Step 4 — Verify it's granted, and publish only if required
env CCTB_LARK_STATE_DIR="$HOME/.cctb/<inst>" CCTB_LARK_INSTANCE=<inst> TAROCUB_INSTANCE=<inst> \
node dist/src/index.js lark provision | grep -i 'Optional —'Success = the feature's Optional — <group>: … line has disappeared from the
missing list (the API now reports those scopes as granted).
Publish requirement depends on app type (read the console's top banner):
- 飞书个人版 / 正式应用@飞书个人版 → banner shows "当前修改均已发布"; 申请开通 is immediate, no version publish needed.
- Other app types → open 版本管理与发布, create + publish a version (and wait for admin approval if prompted). Confirm with the user before publishing.
Step 5 — Restart the instance so the long-connection picks up the scope
env CCTB_LARK_STATE_DIR="$HOME/.cctb/<inst>" CCTB_LARK_INSTANCE=<inst> TAROCUB_INSTANCE=<inst> \
node dist/src/index.js lark service restartRestart only the affected instance (not --all), and never the instance currently
serving the chat you're replying through.
For the group-messages scope specifically, tell the user the runtime switch:
pull the bot into the target group and send /group all (it auto-authorizes the
group, enables group mode, and turns on non-@ listening for that group only).
Step 6 — Cleanup
agent-browser --session feishu state save ~/.cctb/feishu-console-auth.json # refresh saved login
rm -f ~/.cctb/<inst>/workspace/feishu-qr.png
agent-browser --session feishu closeDoes it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

