Skip to content

feat(drive): add +member-add shortcut for Drive collaborator permissions#1204

Open
zhaojiaxing-coding wants to merge 1 commit into
mainfrom
feat/drive-member-add-shortcut
Open

feat(drive): add +member-add shortcut for Drive collaborator permissions#1204
zhaojiaxing-coding wants to merge 1 commit into
mainfrom
feat/drive-member-add-shortcut

Conversation

@zhaojiaxing-coding

@zhaojiaxing-coding zhaojiaxing-coding commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

Add drive +member-add shortcut to grant collaborator permissions on Drive documents, files, folders, and wiki nodes. Supports single and batch member add (up to 10).

Changes

• New shortcut shortcuts/drive/drive_member_add.go — implements +member-add command with --member-type, --perm, --perm-type flags; auto-infers resource type from Feishu/Lark/Doubao URL or token prefix
• Extended resource parsing shortcuts/common/resource_url.go — added InferResourceTypeFromToken and URL parsing support
• Shortcut registration shortcuts/drive/shortcuts.go — registered +member-add in the drive command group
• Unit tests shortcuts/drive/drive_member_add_test.go — covers single/batch add, bot execution, flag validation, error handling
• E2E tests tests/cli_e2e/drive/drive_member_add_dryrun_test.go — dry-run end-to-end tests covering various input combinations
• Documentation skills/lark-drive/SKILL.md and skills/lark-drive/references/lark-drive-member-add.md — updated skill docs and new command reference
• Review fixes — fixed batch result validation (use rawMemberID instead of backfilled memberID), added query contract assertions, merged adjacent blockquotes to fix markdownlint MD028

Test Plan

[✓] All unit tests pass
[✓] All E2E dry-run tests pass (16/16)
[✓] All CI checks pass (19/19)

Related Issues

None

Summary by CodeRabbit

  • New Features
    • Added drive +member-add shortcut for granting collaborator permissions to Drive resources (docs, folders, spaces, wiki nodes)
    • Supports single and batch member additions (up to 10 per batch) with multiple member types (email, openid, unionid, groupid, appid, opendepartmentid)
    • Includes documentation, dry-run support, and partial-failure detection for batch operations

@CLAassistant

CLAassistant commented Jun 1, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

Adds a new drive +member-add shortcut with token-prefix resource-type inference, flag/spec parsing and validation, single and batch execution (with partial-failure detection), response shaping, comprehensive tests (unit/integration/e2e), and documentation updates.

Changes

Drive +member-add shortcut and resource type inference

Layer / File(s) Summary
Token prefix inference
shortcuts/common/resource_url.go, shortcuts/common/resource_url_test.go
Adds tokenPrefixToType and exported InferResourceTypeFromToken; tests cover recognized prefixes, trimming, case-insensitivity, and negative cases.
Shortcut registration
shortcuts/drive/shortcuts.go, shortcuts/drive/shortcuts_test.go
Registers DriveMemberAdd in the drive shortcuts list and updates tests to expect +member-add.
Spec model & flag parsing
shortcuts/drive/drive_member_add.go
(lines 1–219)
Introduces driveMemberAddSpec and readDriveMemberAddSpec: flag parsing, batch ID constraints/duplicate checks, perm defaults, wiki-only perm_type rules, need-notification gating, and member-type normalization.
Token/URL resolution & member-type inference
shortcuts/drive/drive_member_add.go
(lines 220–356)
Resolves --token as trusted URL or bare token (using inference), validates resource type, infers/normalizes --member-type from IDs, detects conflicts with explicit --member-type, and derives collaborator type for request bodies.
Dry-run rendering
shortcuts/drive/drive_member_add.go
(lines 358–377)
Renders preview POST URL and request body for single and batch endpoints using normalized spec and computed collaborator kind.
Single execution
shortcuts/drive/drive_member_add.go
(lines 379–399)
Implements single-member create: request build, API call with query params, progress logging, and flattened output.
Batch execution & partial failure handling
shortcuts/drive/drive_member_add.go
(lines 401–437)
Implements batch create, aligns returned members to requested set, detects missing/mismatched items, computes partial flag, and raises partial_failure on partial results.
Batch request building & reconciliation
shortcuts/drive/drive_member_add.go
(lines 439–506)
Builds batch member bodies and reconciles returned member_ids against requested IDs to compute succeeded/missing/mismatched counts and the partial indicator.
Response shaping & backfill
shortcuts/drive/drive_member_add.go
(lines 508–552)
Flattens and sanitizes API responses, backfills missing fields (member_id, member_type, perm, perm_type, member_kind), and removes internal temp fields.
Unit & integration tests
shortcuts/drive/drive_member_add_test.go
Comprehensive tests for token/URL parsing, member-type inference/normalization, member splitting, spec construction, perm/notification rules, batch constraints, dry-run correctness, response shaping, bot vs user behavior, and high-risk confirmation gating.
CLI e2e dry-run tests
tests/cli_e2e/drive/drive_member_add_dryrun_test.go
E2E dry-run tests validate generated HTTP method, URL, params.type, need_notification handling, body fields for single/batch, and invalid-input error cases.
Skill docs & reference
skills/lark-drive/SKILL.md, skills/lark-drive/references/lark-drive-member-add.md
SKILL.md clarifies wiki-token handling and bot permission flow using drive +member-add; adds reference page documenting flags, examples, and output shapes (including partial failures).

Sequence Diagram

sequenceDiagram
  participant User
  participant CLI as "drive +member-add"
  participant Parser as "readDriveMemberAddSpec"
  participant Inference as "InferResourceTypeFromToken"
  participant DriveAPI as "Drive API"
  participant Output as "driveMemberAddOutput"
  User->>CLI: invoke with --token, --member-id, flags
  CLI->>Parser: parse flags
  Parser->>Inference: infer resource type from token
  Inference-->>Parser: resource type or not found
  Parser->>Parser: validate member-type, perm, need-notification
  Parser->>DriveAPI: POST single or POST /members/batch_create
  DriveAPI-->>Output: API response (members / errors)
  Output->>Output: align/backfill/mask internal fields
  Output-->>User: flattened JSON + status or partial_failure
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~75 minutes

Possibly related PRs

  • larksuite/cli#841: Both PRs modify the Drive shortcut registry and tests to add new drive shortcuts.

Suggested reviewers

  • fangshuyu-768
  • wittam-01

Poem

🐰 A tiny hop, a helpful tweak,

tokens trimmed and secrets speak,
members join in single or crowd,
dry-runs show the request aloud,
docs and tests make the rabbit proud.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.87% 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 specifically describes the main change: adding a +member-add shortcut for Drive collaborator permissions.
Description check ✅ Passed The description covers all required template sections with sufficient detail: clear summary, comprehensive change list, completed test plan with verification results, and related issues section.
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 unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drive-member-add-shortcut

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/L Large or sensitive change across domains or core paths labels Jun 1, 2026
@codecov

codecov Bot commented Jun 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.24731% with 40 lines in your changes missing coverage. Please review.
✅ Project coverage is 72.91%. Comparing base (c000dc3) to head (31b4788).
⚠️ Report is 68 commits behind head on main.

Files with missing lines Patch % Lines
shortcuts/drive/drive_member_add.go 89.21% 24 Missing and 16 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1204      +/-   ##
==========================================
+ Coverage   69.64%   72.91%   +3.27%     
==========================================
  Files         666      732      +66     
  Lines       64413    69483    +5070     
==========================================
+ Hits        44861    50667    +5806     
+ Misses      15943    15023     -920     
- Partials     3609     3793     +184     

☔ View full report in Codecov by Harness.
📢 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.

@github-actions

github-actions Bot commented Jun 1, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@31b4788f8505248f22580c2709b3503317d8b07c

🧩 Skill update

npx skills add larksuite/cli#feat/drive-member-add-shortcut -y -g

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 4

🤖 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/drive/drive_member_add_test.go`:
- Around line 673-711: The test currently only asserts the POST body but must
also assert the bot request omitted the need_notification query param; update
the test that uses the httpmock.Stub (stub) in DriveMemberAdd/mountAndRunDrive
to capture the incoming request's URL.RawQuery (or use the stub's
CapturedRequest/URL field) after mountAndRunDrive runs, then assert that the raw
query string does not contain "need_notification" (or that parsed query has no
"need_notification" key); keep existing body assertions (captured["perm"] ==
"edit") and add a failing t.Fatalf message if the query contains
need_notification so the execute-path contract is enforced.

In `@shortcuts/drive/drive_member_add.go`:
- Around line 414-438: The loop currently only appends members when
rawMembers[i] is a valid map and falls back to backfilling only if results is
empty; change it to iterate over spec.MemberIDs (by index) and for each index
attempt to read rawMembers[i] as a map[string]interface{}—if present use
driveMemberAddOutput(spec, memberID, m), otherwise call
driveMemberAddOutput(spec, memberID, nil) so every requested member is
represented; ensure results is built in the same order as spec.MemberIDs and
that the final runtime.Out and the printed count reflect the full spec.MemberIDs
length.

In `@skills/lark-drive/SKILL.md`:
- Around line 259-261: The two adjacent blockquote paragraphs in SKILL.md need
to be merged into one contiguous blockquote to satisfy markdownlint MD028;
remove the blank line between the two blocks and combine their text into a
single blockquote so the note about member-type mapping and recommendation to
use bot open_id appears as one continuous block (look for the blockquote
starting with "注意:此方式仅适用于需要授权给**当前应用**的场景。" and the following "补充:" paragraph
and join them).

In `@tests/cli_e2e/drive/drive_member_add_dryrun_test.go`:
- Around line 319-320: The test currently asserts the dry-run validation error
only against result.Stderr; update the assertion so Validate-stage failures are
checked from the full CLI output by combining result.Stdout and result.Stderr.
Replace the require.Contains call that uses result.Stderr with one that checks
result.Stdout+result.Stderr (keeping the existing result.AssertExitCode(t, 2)
and tt.wantErr), so the test verifies the error message in the structured stdout
envelope as well as stderr.
🪄 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: e259d1a8-6b0f-4838-9192-0e4b19d3539b

📥 Commits

Reviewing files that changed from the base of the PR and between 0bdd7de and 737045a.

📒 Files selected for processing (9)
  • shortcuts/common/resource_url.go
  • shortcuts/common/resource_url_test.go
  • shortcuts/drive/drive_member_add.go
  • shortcuts/drive/drive_member_add_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-member-add.md
  • tests/cli_e2e/drive/drive_member_add_dryrun_test.go

Comment thread shortcuts/drive/drive_member_add_test.go
Comment thread shortcuts/drive/drive_member_add.go Outdated
Comment thread skills/lark-drive/SKILL.md Outdated
Comment thread tests/cli_e2e/drive/drive_member_add_dryrun_test.go Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

♻️ Duplicate comments (2)
shortcuts/drive/drive_member_add_test.go (1)

867-910: ⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Assert need_notification is omitted for bot execution.

This still only checks the captured body. Without inspecting req.URL.RawQuery, a regression that starts sending need_notification for --as bot will slip through even though the comment says that contract matters.

Suggested test update
 func TestDriveMemberAdd_ExecuteSuccessAsBot(t *testing.T) {
 	t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())

 	f, stdout, _, reg := cmdutil.TestFactory(t, driveTestConfig())
+	var capturedQuery string

 	stub := &httpmock.Stub{
 		Method: "POST",
 		URL:    "/open-apis/drive/v1/permissions/wikcnBotTok/members",
+		OnMatch: func(req *http.Request) {
+			capturedQuery = req.URL.RawQuery
+		},
 		Body: map[string]interface{}{
 			"code": 0,
 			"msg":  "success",
 			"data": map[string]interface{}{
@@
 	if captured["perm"] != "edit" {
 		t.Fatalf("captured body perm = %v, want edit", captured["perm"])
 	}
+	if strings.Contains(capturedQuery, "need_notification=") {
+		t.Fatalf("captured query = %q, want need_notification omitted", capturedQuery)
+	}

 	data := decodeDriveEnvelope(t, stdout)
🤖 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/drive/drive_member_add_test.go` around lines 867 - 910, Add an
assertion in TestDriveMemberAdd_ExecuteSuccessAsBot to verify the HTTP request
query does NOT include need_notification for the "--as bot" case: after
mountAndRunDrive and after decoding stub.CapturedBody keep the existing body
checks, then inspect the request captured by the stub (e.g.,
stub.CapturedRequest.URL.RawQuery or parse stub.CapturedRequest.URL.Query()) and
fail the test if the "need_notification" parameter is present or non-empty;
reference the test function TestDriveMemberAdd_ExecuteSuccessAsBot and the stub
variable to locate where to add this check.
shortcuts/drive/drive_member_add.go (1)

443-496: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Don't validate batch success from a backfilled member_id.

This loop backfills member_id before it decides whether a row succeeded, so a same-length response that omits member_id can still be counted as a full success. It also builds members only from rawMembers, which means shorter/malformed arrays still drop requested IDs from the partial-failure payload instead of returning one slot per requested member.

💡 Suggested fix
 func buildDriveMemberAddBatchResult(spec driveMemberAddSpec, data map[string]interface{}) map[string]interface{} {
 	rawMembers, _ := data["members"].([]interface{})
-	results := make([]map[string]interface{}, 0, len(rawMembers))
-	succeededIDs := make(map[string]bool, len(rawMembers))
+	results := make([]map[string]interface{}, 0, len(spec.MemberIDs))
+	succeededIDs := make(map[string]bool, len(spec.MemberIDs))
 	var mismatched []map[string]interface{}

-	for i, raw := range rawMembers {
-		m, ok := raw.(map[string]interface{})
-		if !ok {
-			continue
-		}
-		fallbackMemberID := ""
-		if len(rawMembers) == len(spec.MemberIDs) && i < len(spec.MemberIDs) {
-			fallbackMemberID = spec.MemberIDs[i]
-		}
-		out := driveMemberAddOutputWithOptions(spec, fallbackMemberID, m, len(rawMembers) == len(spec.MemberIDs))
-		memberID := common.GetString(out, "member_id")
-		if i < len(spec.MemberIDs) {
-			requestedID := spec.MemberIDs[i]
-			rawMemberID := common.GetString(m, "member_id")
-			if rawMemberID != "" && rawMemberID != requestedID {
-				mismatched = append(mismatched, map[string]interface{}{
-					"index":     i + 1,
-					"requested": requestedID,
-					"returned":  rawMemberID,
-				})
-			} else if memberID == requestedID {
-				succeededIDs[requestedID] = true
-			}
-		}
-		results = append(results, out)
+	for i, requestedID := range spec.MemberIDs {
+		var rawMember map[string]interface{}
+		if i < len(rawMembers) {
+			rawMember, _ = rawMembers[i].(map[string]interface{})
+		}
+
+		if rawMemberID := common.GetString(rawMember, "member_id"); rawMemberID != "" {
+			if rawMemberID != requestedID {
+				mismatched = append(mismatched, map[string]interface{}{
+					"index":     i + 1,
+					"requested": requestedID,
+					"returned":  rawMemberID,
+				})
+			} else {
+				succeededIDs[requestedID] = true
+			}
+		}
+
+		results = append(results, driveMemberAddOutputWithOptions(spec, requestedID, rawMember, true))
 	}
🤖 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/drive/drive_member_add.go` around lines 443 - 496, The function
buildDriveMemberAddBatchResult currently backfills member_id via
driveMemberAddOutputWithOptions before deciding success and builds the members
slice only from rawMembers, causing missing/short responses to be counted as
successes and to drop slots for requested IDs; fix by: iterate over
spec.MemberIDs as the primary loop, for each index obtain raw entry from
rawMembers if present (raw := rawMembers[i] else nil), extract rawMemberID
directly from the raw map (do not rely on the backfilled out member_id) to
determine success and populate succeededIDs only when rawMemberID ==
requestedID, call driveMemberAddOutputWithOptions to build the output but ensure
you create placeholder outputs for missing/raw-invalid entries so the resulting
members slice has one entry per requested ID, and recompute
partial/missing/mismatched accordingly (refer to buildDriveMemberAddBatchResult,
spec.MemberIDs, rawMembers, driveMemberAddOutputWithOptions, and the "member_id"
field).
🧹 Nitpick comments (1)
shortcuts/drive/drive_member_add_test.go (1)

674-728: ⚡ Quick win

Assert the batch execute query contract.

This test pins the batch path and body, but it never inspects req.URL.RawQuery, so a regression that stops sending the inferred type query param would still pass. Capture the request query in this happy-path execute test and assert it matches the inferred resource type for bascnTok.

Suggested test update
 func TestDriveMemberAdd_ExecuteBatchSuccess(t *testing.T) {
 	t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir())

 	f, stdout, stderr, reg := cmdutil.TestFactory(t, driveTestConfig())
+	var capturedQuery string

 	stub := &httpmock.Stub{
 		Method: "POST",
 		URL:    "/open-apis/drive/v1/permissions/bascnTok/members/batch_create",
+		OnMatch: func(req *http.Request) {
+			capturedQuery = req.URL.RawQuery
+		},
 		Body: map[string]interface{}{
 			"code": 0,
 			"msg":  "success",
 			"data": map[string]interface{}{
@@
 	if err != nil {
 		t.Fatalf("unexpected error: %v", err)
 	}
+	if !strings.Contains(capturedQuery, "type=") {
+		t.Fatalf("captured query = %q, want inferred type query param", capturedQuery)
+	}

 	data := decodeDriveEnvelope(t, stdout)
🤖 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/drive/drive_member_add_test.go` around lines 674 - 728, The test
doesn't assert the outgoing request query so a regression removing the inferred
type query param won't be caught; modify TestDriveMemberAdd_ExecuteBatchSuccess
to capture the HTTP request's URL.RawQuery when the stub is invoked (e.g.
register a handler/closure with reg or httpmock that saves the *http.Request
into a local variable before returning the stub response) and after
mountAndRunDrive assert the captured RawQuery contains the expected
"type=<resource>" value for token "bascnTok" (keep the rest of the test
assertions intact); reference TestDriveMemberAdd_ExecuteBatchSuccess, the
existing stub registration, and the mountAndRunDrive call to locate where to add
the request capture and subsequent assertion.
🤖 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.

Duplicate comments:
In `@shortcuts/drive/drive_member_add_test.go`:
- Around line 867-910: Add an assertion in
TestDriveMemberAdd_ExecuteSuccessAsBot to verify the HTTP request query does NOT
include need_notification for the "--as bot" case: after mountAndRunDrive and
after decoding stub.CapturedBody keep the existing body checks, then inspect the
request captured by the stub (e.g., stub.CapturedRequest.URL.RawQuery or parse
stub.CapturedRequest.URL.Query()) and fail the test if the "need_notification"
parameter is present or non-empty; reference the test function
TestDriveMemberAdd_ExecuteSuccessAsBot and the stub variable to locate where to
add this check.

In `@shortcuts/drive/drive_member_add.go`:
- Around line 443-496: The function buildDriveMemberAddBatchResult currently
backfills member_id via driveMemberAddOutputWithOptions before deciding success
and builds the members slice only from rawMembers, causing missing/short
responses to be counted as successes and to drop slots for requested IDs; fix
by: iterate over spec.MemberIDs as the primary loop, for each index obtain raw
entry from rawMembers if present (raw := rawMembers[i] else nil), extract
rawMemberID directly from the raw map (do not rely on the backfilled out
member_id) to determine success and populate succeededIDs only when rawMemberID
== requestedID, call driveMemberAddOutputWithOptions to build the output but
ensure you create placeholder outputs for missing/raw-invalid entries so the
resulting members slice has one entry per requested ID, and recompute
partial/missing/mismatched accordingly (refer to buildDriveMemberAddBatchResult,
spec.MemberIDs, rawMembers, driveMemberAddOutputWithOptions, and the "member_id"
field).

---

Nitpick comments:
In `@shortcuts/drive/drive_member_add_test.go`:
- Around line 674-728: The test doesn't assert the outgoing request query so a
regression removing the inferred type query param won't be caught; modify
TestDriveMemberAdd_ExecuteBatchSuccess to capture the HTTP request's
URL.RawQuery when the stub is invoked (e.g. register a handler/closure with reg
or httpmock that saves the *http.Request into a local variable before returning
the stub response) and after mountAndRunDrive assert the captured RawQuery
contains the expected "type=<resource>" value for token "bascnTok" (keep the
rest of the test assertions intact); reference
TestDriveMemberAdd_ExecuteBatchSuccess, the existing stub registration, and the
mountAndRunDrive call to locate where to add the request capture and subsequent
assertion.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: af292443-0256-4d73-88ac-18ece2f48ca5

📥 Commits

Reviewing files that changed from the base of the PR and between 737045a and 7fbe968.

📒 Files selected for processing (7)
  • shortcuts/common/resource_url.go
  • shortcuts/common/resource_url_test.go
  • shortcuts/drive/drive_member_add.go
  • shortcuts/drive/drive_member_add_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-member-add.md
  • tests/cli_e2e/drive/drive_member_add_dryrun_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • skills/lark-drive/SKILL.md
  • tests/cli_e2e/drive/drive_member_add_dryrun_test.go

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@tests/cli_e2e/drive/drive_member_add_dryrun_test.go`:
- Around line 354-359: The file contains duplicate trailing closing braces after
the test TestDrive_MemberAddDryRunRejectsInvalidInputs which cause a compile
parse error; remove the extra duplicated tokens — the stray "})", "}", "}" that
appear after the legitimate closing of t.Run/for/function so that only the
original three closers remain and the file ends immediately after the proper
function closing for TestDrive_MemberAddDryRunRejectsInvalidInputs.
🪄 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: 41aed911-639c-4f2c-a36a-f21c4d9163d8

📥 Commits

Reviewing files that changed from the base of the PR and between 7fbe968 and 1a2dc7b.

📒 Files selected for processing (1)
  • tests/cli_e2e/drive/drive_member_add_dryrun_test.go

Comment thread tests/cli_e2e/drive/drive_member_add_dryrun_test.go
Comment thread shortcuts/common/resource_url.go Outdated
@zhaojiaxing-coding zhaojiaxing-coding force-pushed the feat/drive-member-add-shortcut branch 3 times, most recently from ea4f8e8 to d6cceb2 Compare June 4, 2026 08:15
@zhaojiaxing-coding zhaojiaxing-coding force-pushed the feat/drive-member-add-shortcut branch from 9da4de2 to a49b266 Compare June 11, 2026 06:05
Add the drive +member-add shortcut for granting collaborator permissions
to Drive resources (docx, sheet, bitable, file, folder, wiki, mindnote,
slides, minutes). Supports single and batch member addition with
auto-inference of resource type from URL, case-insensitive enum inputs,
wiki space member support, and structured error hints for common API
failures.

Key behaviors:
- --token accepts bare tokens or full URLs; type is auto-inferred from
  URL path (e.g. /docx/, /mindnotes/, /wiki/)
- --perm defaults to view; --perm-type only applies to wiki resources
- Batch add supports up to 10 members via comma-separated --member-id
- Non-wiki resources omit perm_type from output to avoid misleading data
- Enum values (perm, member-type, perm-type) accept case-insensitive input
- Wiki space members (wikispaceid) use explicit --member-kind for body type
- Actionable error hints for invalid members and duplicate collaborators
@zhaojiaxing-coding zhaojiaxing-coding force-pushed the feat/drive-member-add-shortcut branch from d3ea5c8 to 31b4788 Compare June 11, 2026 09:37
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/L Large or sensitive change across domains or core paths

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants