push-docs-to-feishulisted
Install: claude install-skill therain2020/therain2020-agent
# Push Docs to Feishu Wiki Skill
Push local Markdown files to a Feishu Wiki space using lark-cli.
## Prerequisites
- `lark-cli.exe` at `D:\GitHub\larksuite-cli\lark-cli.exe`
- Authenticated (`lark-cli wiki +space-list` returns `"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 space
```
## Phase 1: Assess
1. List local docs to push: `Get-ChildItem <dir> -Filter "*.md"`
2. Check which ones already exist in the wiki (optional — use `wiki +space-list` and `wiki +node-list` to check)
3. 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 use `Out-File -Encoding utf8`
- **Relative paths**: `Set-Location` to lark-cli directory before each call
- **Rate limit**: `Start-Sleep -Seconds 2` between each doc
- **Shell CWD**: lark-cli resets working directory after each call; always `Set-Location` before calling
```powershell
$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 '