← Back to PRs

#16592: feat(feishu): add write mode import for markdown documents

by ciberponk open 2026-02-14 22:25 View on GitHub →
channel: feishu size: M
## Summary - feat(feishu): add write mode import for markdown documents - Split from our `v2026.2.13` patch train as a single-purpose change for easier review. ## Why - Keep the diff focused and low-risk so it can be merged or reverted independently. ## Scope - Branch: `feat/feishu-write-mode-import-en` - Files changed: 3 - Key files: - `extensions/feishu/src/doc-schema.ts` - `extensions/feishu/src/docx.test.ts` - `extensions/feishu/src/docx.ts` ## Test Plan - Suggested local command: - `./node_modules/.bin/vitest run extensions/feishu/src/docx.test.ts` - Validation status: - [ ] CI checks pass - [ ] Maintainer re-ran local tests ## Risk & Rollback - Risk: low to medium; impact limited to touched module(s). - Rollback: revert this PR commit(s) cleanly. ## Co-authorship - Co-authored by @ciberponk and Codex (GPT-5). <!-- greptile_comment --> <h3>Greptile Summary</h3> This PR adds a new `import` mode to the `feishu_doc` write action, allowing markdown documents to be imported via Feishu's Import Task API rather than the existing blocks-based approach. The change introduces optional parameters (`mode`, `title`, `folder_token`) to the write action schema, implements `createDocFromMarkdownViaImport()` function that creates a temporary document, uploads the markdown file, triggers the import task, polls for completion, and cleans up the temporary document. Key changes: - Added `mode` parameter to write action schema with values `"blocks"` (default) or `"import"` - New `createDocFromMarkdownViaImport()` function handles the import workflow - Tests cover both success and validation error scenarios - Import mode requires `title` and `folder_token` parameters for proper operation Two issues were previously identified and remain unresolved: - Schema uses `Type.Union` which violates the repository's tool schema guidelines (should use `optionalStringEnum` from `openclaw/plugin-sdk`) - Polling loop has no delay between API retries, which will hammer the Feishu API unnecessarily <h3>Confidence Score: 2/5</h3> - This PR has two unresolved issues that should be fixed before merging - Score reflects two previously-reported but still-unfixed issues: schema guideline violation and missing retry delay in polling loop. Both issues are straightforward to fix but impact code quality and API behavior. - `extensions/feishu/src/doc-schema.ts` (schema guideline violation) and `extensions/feishu/src/docx.ts` (missing polling delay) <sub>Last reviewed commit: c923500</sub> <!-- greptile_other_comments_section --> **Context used:** - Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8)) - Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13)) <!-- /greptile_comment -->

Most Similar PRs