Skip to content

feat(wiki): support appid member type#1235

Open
caojie0621 wants to merge 1 commit into
mainfrom
feat/wiki_member
Open

feat(wiki): support appid member type#1235
caojie0621 wants to merge 1 commit into
mainfrom
feat/wiki_member

Conversation

@caojie0621
Copy link
Copy Markdown
Collaborator

@caojie0621 caojie0621 commented Jun 2, 2026

Summary

Support `appid` as a valid wiki space member type so `wiki +member-add` can add app members whose IDs are typically formatted as `cli_xxx`. This also updates the wiki skill guidance and     

reference docs so agents can correctly choose --member-type=appid for app membership flows.

## Changes                                                                                                                                                                                    
                                                                                                                                                                                              
- Add `appid` to the shared wiki member type enum used by member shortcuts.                                                                                                                   
- Add unit coverage for:                                                                                                                                                                      
  - `appid` being included in supported member types.                                                                                                                                         
  - `wiki +member-add` dry-run request body with `member_type=appid`.                                                                                                                         
  - `appid` member IDs being accepted without CLI-side format validation.                                                                                                                     
- Add dry-run E2E coverage for `wiki +member-add --member-type appid`.                                                                                                                        
- Update `lark-wiki` skill docs and skill template to include app member handling.                                                                                                            
- Update member add/remove reference docs to list `appid` as a supported `--member-type`.                                                                                                     
                                                                                                                                                                                              
## Test Plan                                                                                                                                                                                  
                                                                                                                                                                                              
- [x] Unit tests pass                                                                                                                                                                         
  - `go test ./shortcuts/wiki`                                                                                                                                                                
- [x] Manual local verification confirms the `lark-cli wiki +member-add` flow works as expected                                                                                               
  - `make build`                                                                                                                                                                              
  - `go test ./tests/cli_e2e/wiki -run TestWikiMemberAddDryRun -count=1`                                                                                                                      
- [x] Formatting / diff checks pass                                                                                                                                                           
  - `gofmt`                                                                                                                                                                                   
  - `git diff --check`                                                                                                                                                                        
                                                                                                                                                                                              
## Related Issues                                                                                                                                                                             
                                                                                                                                                                                              
- None    

Summary by CodeRabbit

  • New Features

    • Wiki space member management now supports applications via --member-type=appid in addition to users, groups, and departments.
  • Documentation

    • Updated member management guides with expanded workflow covering application member support and clarified constraints for certain scenarios.
  • Tests

    • Added tests to verify application member type support and related functionality.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 2, 2026

Review Change Stack

📝 Walkthrough

Walkthrough

This PR extends the wiki space-member shortcuts to accept appid as a valid member type. It adds "appid" to the accepted types enum, covers the change with unit and end-to-end tests, and updates skill template and CLI reference documentation to explain how to add applications as wiki space members using the new type.

Changes

Wiki App Member Support

Layer / File(s) Summary
Core appid type support
shortcuts/wiki/wiki_member_helpers.go
wikiMemberTypes slice is extended to include "appid" as a valid member_type value for member-add and member-remove shortcuts.
Unit tests for appid support
shortcuts/wiki/wiki_member_test.go
Added three test cases: one verifying "appid" is in wikiMemberTypes, one testing +member-add dry-run with appid parameters, and one confirming readWikiMemberAddSpec accepts appid member IDs. Also added newMemberAddCmd helper to construct the wiki +member-add cobra command with required flags.
End-to-end test for appid member-add
tests/cli_e2e/wiki/wiki_member_add_dryrun_test.go
New e2e test verifies wiki +member-add --dry-run executes successfully with appid parameters and generates the correct POST request to the wiki members API endpoint with expected body fields.
Skill template documentation (English)
skill-template/domains/wiki.md
Updated member management workflow to categorize targets as user / group / department / app, explicitly prohibit the unsupported department + bot path, and document the --member-type=appid flow for adding applications to wiki spaces.
Skill documentation (Chinese)
skills/lark-wiki/SKILL.md
Updated member management workflow to expand target types to include apps, clarify the unsupported department + bot constraint, and document the --member-type=appid resolution path for application membership.
CLI reference documentation
skills/lark-wiki/references/lark-wiki-member-add.md, skills/lark-wiki/references/lark-wiki-member-remove.md
Updated +member-add and +member-remove reference docs to list appid as a supported --member-type value and added a note explaining that app members should use --member-type=appid with the app ID (e.g., cli_xxx) as --member-id.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • larksuite/cli#417: Both PRs update the member management workflow in skills/lark-wiki/SKILL.md, including department + --as bot constraints; this PR extends that guidance to include app (appid) member handling.
  • larksuite/cli#997: This PR directly builds on the wiki member shortcut infrastructure introduced in PR #997 by extending wikiMemberTypes to accept appid and adding corresponding tests.

Suggested labels

size/M, domain/ccm

Suggested reviewers

  • fangshuyu-768

Poem

🐰 A rabbit hops through the wiki with glee,
Apps as members now—appid to see!
From users and groups to applications bright,
The shortcut expands, the workflow feels right.
Tests verify paths that once had no way,
Docs bloom in both tongues—hip hip hooray! 🥕

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 23.08% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding support for appid as a wiki member type, which is the primary focus of the changeset.
Description check ✅ Passed The description comprehensively covers all required template sections: Summary explains the motivation, Changes lists main modifications with good detail, and Test Plan documents verification with specific commands executed.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/wiki_member

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact labels Jun 2, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 69.22%. Comparing base (c8e205e) to head (3fb4d95).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1235   +/-   ##
=======================================
  Coverage   69.22%   69.22%           
=======================================
  Files         635      635           
  Lines       59689    59689           
=======================================
  Hits        41322    41322           
  Misses      15033    15033           
  Partials     3334     3334           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@shortcuts/wiki/wiki_member_helpers.go`:
- Around line 15-17: Update the wikiMemberTypes allowlist to match the
documented enum for Lark/Feishu Wiki V2 by removing the unsupported "appid"
entry from the slice named wikiMemberTypes; ensure the remaining values are
exactly "openchat", "userid", "email", "opendepartmentid", "openid", "unionid"
(reorder if necessary) and run any unit/integration tests that exercise member
creation/deletion to confirm no other code expects "appid"; if an app-related
member type is actually required, replace "appid" with the correct documented
enum name and adjust code paths that handle member_type accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 27e697a4-6243-4177-b2a7-035212baf4cb

📥 Commits

Reviewing files that changed from the base of the PR and between c8e205e and 3fb4d95.

📒 Files selected for processing (7)
  • shortcuts/wiki/wiki_member_helpers.go
  • shortcuts/wiki/wiki_member_test.go
  • skill-template/domains/wiki.md
  • skills/lark-wiki/SKILL.md
  • skills/lark-wiki/references/lark-wiki-member-add.md
  • skills/lark-wiki/references/lark-wiki-member-remove.md
  • tests/cli_e2e/wiki/wiki_member_add_dryrun_test.go

Comment on lines 15 to 17
var wikiMemberTypes = []string{
"openid", "userid", "email", "unionid", "openchat", "opendepartmentid",
"openid", "userid", "email", "unionid", "openchat", "opendepartmentid", "appid",
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

Lark Feishu wiki v2 space member create API member_type enum accepted values app

💡 Result:

In the Lark/Feishu Wiki V2 "Create Wiki space member" API, the accepted enum values for the member_type field are as follows [1][2]: - openchat: Group ID (refer to group ID documentation) [1][2] - userid: User ID [1][2] - email: User email address [1][2] - opendepartmentid: Department ID [1][2] - openid: User's Open ID [1][2] - unionid: User's Union ID [1][2] These values specify the type of identifier used in the member_id field to designate the collaborator being added to the wiki space [1][2].

Citations:


Fix member_type allowlist: remove/adjust unsupported appid

Lark/Feishu Wiki V2 space-member create/delete member_type is documented to accept only: openchat, userid, email, opendepartmentid, openid, unionidappid is not listed (so the CLI will now allow a value the server likely rejects). Update wikiMemberTypes in shortcuts/wiki/wiki_member_helpers.go (lines 15-17) to match the documented enum, or confirm the correct enum value/name for app-related members.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@shortcuts/wiki/wiki_member_helpers.go` around lines 15 - 17, Update the
wikiMemberTypes allowlist to match the documented enum for Lark/Feishu Wiki V2
by removing the unsupported "appid" entry from the slice named wikiMemberTypes;
ensure the remaining values are exactly "openchat", "userid", "email",
"opendepartmentid", "openid", "unionid" (reorder if necessary) and run any
unit/integration tests that exercise member creation/deletion to confirm no
other code expects "appid"; if an app-related member type is actually required,
replace "appid" with the correct documented enum name and adjust code paths that
handle member_type accordingly.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 2, 2026

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3fb4d95cf6eddcddc576e3b05208b10a35fb2570

🧩 Skill update

npx skills add larksuite/cli#feat/wiki_member -y -g

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

domain/ccm PR touches the ccm domain size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant