push-docs-to-feishu
Skill0 starsChanged 6 months agoMITView on GitHub
Push local project Markdown documents to Feishu Wiki using lark-cli. Handles creation (docs +create v2), wiki move, UTF-8 encoding, rate limiting, and CLAUDE.md reference updates. Two-step pipeline: create docx + move to wiki.
In this repository2 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- update-docsSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Check which ones already exist in the wiki (optional — use wiki +space-list and wiki +node-list to check)
- Distinctive: line 48
Use this PowerShell pattern.
- Distinctive: line 86
After successful upload, update CLAUDE.md to add the new docs to the Design Reference or Project Docs table.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Push Docs to Feishu Wiki Skill
Push local Markdown files to a Feishu Wiki space using lark-cli.
Prerequisites
lark-cli.exeatD:\GitHub\larksuite-cli\lark-cli.exe- Authenticated (
lark-cli wiki +space-listreturns"ok": true) - Target wiki space ID:
7644823612574141651(Agent 设计文档)
The Pipeline
Each document goes through a two-step pipeline:
1. docs +create --api-version v2 --content @file --doc-format markdown --title "..."
→ returns document_id
2. wiki +move --obj-type docx --obj-token <doc_id> --target-space-id <space_id>
→ moves into wiki spacePhase 1: Assess
- List local docs to push:
Get-ChildItem <dir> -Filter "*.md" - Check which ones already exist in the wiki (optional — use
wiki +space-listandwiki +node-listto check) - Report: "Found N docs. M new, K already in wiki."
Phase 2: Push
Use this PowerShell pattern. Critical rules:
- UTF-8 no BOM:
[System.Text.UTF8Encoding]::new($false)— never useOut-File -Encoding utf8 - Relative paths:
Set-Locationto lark-cli directory before each call - Rate limit:
Start-Sleep -Seconds 2between each doc - Shell CWD: lark-cli resets working directory after each call; always
Set-Locationbefore calling
$cli = "D:\GitHub\larksuite-cli\lark-cli.exe"
$spaceId = "7644823612574141651"
$tmpDir = "D:\GitHub\larksuite-cli"
foreach ($f in Get-ChildItem $sourceDir -Filter "*.md" | Sort-Object Name) {
$title = $f.BaseName -replace '-', ' '
if ($title.Length -gt 60) { $title = $title.Substring(0, 60) }
$content = [System.IO.File]::ReadAllText($f.FullName, [System.Text.UTF8Encoding]::new($false))
[System.IO.File]::WriteAllText("$tmpDir\tmp-md.txt", $content, [System.Text.UTF8Encoding]::new($false))
# Step 1: Create docx
Set-Location $tmpDir
$raw = & $cli docs +create --api-version v2 --content "@tmp-md.txt" --doc-format markdown --title "$title" 2>&1 | Out-String
Set-Location "D:\GitHub\therain2020-agent"
if ($raw -match '"document_id":\s*"([^"]+)"') {
$docId = $matches[1]
# Step 2: Move to wiki
Set-Location $tmpDir
$moveResult = & $cli wiki +move --obj-type docx --obj-token $docId --target-space-id $spaceId 2>&1 | Out-String
Set-Location "D:\GitHub\therain2020-agent"
if ($moveResult -match '"ok":\s*true') { Write-Host " OK: $title" } else { Write-Host " MOVE FAIL: $title" }
} else { Write-Host " CREATE FAIL: $title" }
Start-Sleep -Seconds 2
}
Remove-Item "$tmpDir\tmp-md.txt" -ErrorAction SilentlyContinuePhase 3: Update References
After successful upload, update CLAUDE.md to add the new docs to the Design Reference or Project Docs table.
The wiki space URL is: https://ycn21rm70xup.feishu.cn/wiki/space/7644823612574141651
Common Pitfalls
| Symptom | Cause | Fix |
--data invalid JSON format | File has UTF-8 BOM from Out-File -Encoding utf8 | Use [System.Text.UTF8Encoding]::new($false) |
cannot read file "tmp-md.txt" | CWD was reset by previous lark-cli call | Set-Location $tmpDir before every CLI call |
--content is required | Using v1 syntax (--markdown) with v2 API | Use --content @file --doc-format markdown |
| First 18 docs OK, rest fail | Rate limiting | Start-Sleep -Seconds 2 minimum |
unknown flag: --wiki-space | v2 API removed this flag | Two-step: create + wiki move |
Target Directories
| Local path | Content type | Wiki section |
D:\GitHub\agent-design\temp\ | 设计文档 (30篇) | Root of wiki space |
D:\GitHub\therain2020-agent\docs\ | 项目文档 (5篇) | Root of wiki space |
Does 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.

