feat(datasource): add Yuque (语雀) connector

Syncs personal and team Yuque knowledge bases into WeKnora as Markdown,
with full and incremental sync + deletion detection. Mirrors the Feishu
connector pattern; fetches V2Doc.body directly (no async export step).

Config: api_token (required) + base_url (optional, defaults to public cloud).
401/403 wraps ErrInvalidCredentials; 429 honors Retry-After; filters to
status=1 Doc-type at list stage to conserve API quota. Body is trusted as
Markdown for format=markdown|lake — empirically verified against the v2
API: Lake XML lives separately in body_lake, body itself is the Markdown
view. Other formats (e.g. html) are skipped with a placeholder item so
they surface in sync logs instead of silently feeding HTML to the parser.

v2Doc.status accepts both int and string shapes — Yuque's OpenAPI spec
declares string but the live API returns int. sanitizeFileName truncates
at a UTF-8 rune boundary so multi-byte titles don't emit invalid UTF-8
that downstream filename validation rejects.

Also adds logger.SetOutput test hook, used by the token-redaction test.
This commit is contained in:
nullkey
2026-04-21 17:29:37 +08:00
committed by lyingbug
parent 6accdc2a60
commit 656b07027a
9 changed files with 1953 additions and 2 deletions
+1
View File
@@ -29,6 +29,7 @@ const (
ChannelSlack = "slack" // Slack
ChannelIM = "im" // Generic IM channel
ChannelNotion = "notion" // Notion
ChannelYuque = "yuque" // Yuque (语雀)
)
// Knowledge parse status constants