#16594: feat(feishu): add set_public_permission doc action
channel: feishu
size: S
Cluster:
Memory Management Enhancements
## Summary
- feat(feishu): add set_public_permission doc action
- 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-doc-set-public-permission-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>
Adds a new `set_public_permission` action to the Feishu document tool, allowing users to set a document's public link sharing permission to either `read` or `edit` access. The implementation calls the Feishu Drive `permissionPublic.patch` API with appropriate `link_share_entity` and `security_entity` values. Changes are well-scoped across the schema, implementation, and tests.
- New `setDocPublicPermission` function in `docx.ts` correctly maps `read`/`edit` access to Feishu API permission entities
- Schema addition in `doc-schema.ts` uses `Type.Union([Type.Literal(...)])` for the `access` field, which conflicts with the repo's tool-schema guardrails recommending `optionalStringEnum` instead
- Test covers the `access: "edit"` path with proper mock setup and assertion of API call parameters
<h3>Confidence Score: 4/5</h3>
- This PR is safe to merge with minimal risk; it adds a single new action to an existing tool with no changes to existing behavior.
- The implementation is straightforward and follows existing patterns in the codebase. The only concern is a style issue (Type.Union vs optionalStringEnum) per repo guidelines. No logical errors or security issues found.
- `extensions/feishu/src/doc-schema.ts` has a minor style issue with `Type.Union` usage that should ideally use `optionalStringEnum` per repo guidelines.
<sub>Last reviewed commit: 9fade64</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))
<!-- /greptile_comment -->
Most Similar PRs
#16607: feat(feishu): add get_public_permission doc action
by ciberponk · 2026-02-14
93.3%
#16637: feat(feishu_doc): support optional public_access on create
by ciberponk · 2026-02-14
87.6%
#16438: feat(feishu): add create_from_markdown import action
by ciberponk · 2026-02-14
76.2%
#16592: feat(feishu): add write mode import for markdown documents
by ciberponk · 2026-02-14
75.3%
#16647: feat(feishu_doc): allow optional initial content on create
by ciberponk · 2026-02-15
73.2%
#23382: docs(feishu): add cardkit:card:write permission for streaming card ...
by SidQin-cyber · 2026-02-22
71.8%
#9410: docs: add cardkit permissions to Feishu channel setup
by Cassius0924 · 2026-02-05
71.4%
#20304: feat(feishu): support Docx table create/write + image/file upload a...
by xuhao1 · 2026-02-18
70.7%
#14037: docs: improved permission configuration instructions
by LHB6540 · 2026-02-11
69.7%
#14674: feat(feishu): add feishu_chat tool for chat info/member queries
by liuweifly · 2026-02-12
68.7%