psylch/lark-switch-skill · Archived

lark-switch

切换 lark-cli 飞书账号?

First seen Jun 21, 2026

Installation

$ npx skills add psylch/lark-switch-skill --skill lark-switch

Stronger alternatives

This repository is archived — consider an actively maintained alternative.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Repository health

License LICENSE
Default branch master
Open issues 0
Status Archived

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 2,810 B
  • docs SUMMARY.md 263 B

History

  1. First seen on skills.sh
  2. First recorded snapshot · 1 installs

SKILL.md

Lark Switch

Language

Match user's language: Respond in the same language the user uses.

Overview

在多个 lark-cli 飞书账号配置之间切换。每个 profile 对应一个飞书应用(App ID + Secret),通过替换 ~/.lark-cli/config.json 实现切换。Token 随 config 文件保存,切换后无需重新授权。

Runtime

Preflight

bash <SKILL_DIR>/scripts/helper.sh preflight

检查 lark-cli 是否安装、config 目录是否存在、有哪些可用 profiles。

切换账号

source ~/.lark-cli/switch.sh <profile>

示例:

source ~/.lark-cli/switch.sh personal   # 切到个人账号
source ~/.lark-cli/switch.sh einsia     # 切到 Einsia 组织账号
source ~/.lark-cli/switch.sh            # 查看所有可用 profiles

验证切换结果

lark-cli auth status

应返回 tokenStatus: "valid" 和正确的 userName。

新增 Profile

当用户需要添加新的飞书账号时:

# 1. 配置应用
echo "<app-secret>" | lark-cli config init --app-id <app-id> --app-secret-stdin --brand feishu

# 2. 登录用户身份
lark-cli auth login --domain docs,wiki,drive

# 3. 保存 profile
cp ~/.lark-cli/config.json ~/.lark-cli/config-<name>.json

# 4. 保存 secret(用于 keychain 恢复)
echo -n "<app-secret>" > ~/.lark-cli/.<name>.secret
chmod 600 ~/.lark-cli/.<name>.secret

# 5. 恢复之前的活跃 profile
source ~/.lark-cli/switch.sh <previous-profile>

注意:lark-cli config init 是破坏性操作,会覆盖当前 config.json。新增 profile 前务必确认当前 profile 已保存。

Token 过期处理

Token 有效期约 2 小时,refresh token 7 天。如果切换后 auth status 显示 token 过期:

lark-cli auth login --domain docs,wiki,drive
# 登录后重新保存 profile
cp ~/.lark-cli/config.json ~/.lark-cli/config-<current-profile>.json

Troubleshooting

症状 原因 解决
keychain entry not found keychain 中该 appId 的 secret 被清除 从 .<profile>.secret 文件恢复,或重新 config init
client secret is invalid 飞书后台的 secret 已刷新 获取新 secret,重新 config init 并保存
app is pending approval 组织应用未审批 联系管理员审批
切换后需要重新授权 config 文件中 token 丢失 确认保存的是登录后的完整 config

<!-- Keep this file under 200 lines. Move detailed docs to references/. -->