Skip to content

feat(drive): add +update-title shortcut - #2172

Merged
zzzchao123 merged 1 commit into
mainfrom
feat/drive-update-title-shortcut
Aug 6, 2026
Merged

feat(drive): add +update-title shortcut#2172
zzzchao123 merged 1 commit into
mainfrom
feat/drive-update-title-shortcut

Conversation

@zzzchao123

@zzzchao123 zzzchao123 commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Summary

Wrap the Drive title endpoint as drive +update-title. Accept a resource URL (recommended) or bare token + --type for the target, covering every type the endpoint takes: docx, doc, sheet, bitable (base alias), slides, mindnote, file, folder and wiki. --title carries the new title and also accepts --new-title, matching the API field name.

Wiki inputs are patched as the wiki node they name: the endpoint resolves type=wiki against the node token itself, so a /wiki/ URL needs no get_node unwrapping step, and node and underlying document titles stay in sync either way it is renamed. A whitespace-only title is rejected locally because the server accepts an empty new_title and leaves the resource with a blank title. The two codes this endpoint collapses many causes into get command-level hints: 981003 explains that the lookup runs under the declared type (and, for wiki, that the document token is not accepted there), 981004 points at the missing edit permission.

Pre-flight scopes are intentionally empty: the endpoint's scope set is an any-of that depends on --type (docx:document:write_only, sheets:spreadsheet:write_only, base:app:update, drive:file:upload), and unconditional pre-flight is ALL-of, so declaring them there would reject tokens holding only the scope for the target type. They are declared as conditional scopes instead, and the per-type mapping is documented in the skill reference.

Cover the shortcut with unit tests, dry-run e2e and a self-contained live workflow (upload -> rename file -> verify -> rename folder -> verify -> type-mismatch negative leg), and register it in
tests/cli_e2e/drive/coverage.md. Route rename intents in the lark-drive skill to the shortcut instead of the raw files patch service command.

Changes

  • Change 1
  • Change 2

Test Plan

  • Unit tests pass
  • Manual local verification confirms the lark-cli <domain> <command> flow works as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added drive +update-title for renaming files, folders, documents, bitables, slides, mindnotes, and wiki nodes.
    • Supports URLs or tokens, type validation, title trimming, dry-run mode, structured output, and API error guidance.
    • Added configurable file-extension handling, including preservation, rejection, or explicit override.
  • Documentation

    • Added usage instructions, supported resource types, URL and token rules, extension policies, and examples.
  • Tests

    • Added comprehensive unit and end-to-end coverage for validation, dry runs, workflows, extension handling, and error scenarios.

@coderabbitai

coderabbitai Bot commented Aug 4, 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 drive +update-title for renaming supported Drive resources and Wiki nodes. The shortcut resolves URLs and typed tokens, validates inputs, applies file-extension policies, supports dry runs, sends PATCH requests, reports results, and provides API error guidance.

Changes

Drive title update

Layer / File(s) Summary
Input contract and resolution
shortcuts/drive/drive_update_title.go, shortcuts/drive/drive_update_title_test.go
Defines resource types, input structures, and resolution logic. Resolves URLs and typed tokens. Validates resource types and titles. Normalizes type aliases such as base to bitable.
Shortcut implementation and execution
shortcuts/drive/drive_update_title.go, shortcuts/drive/drive_update_title_test.go
Implements the shortcut command. Builds PATCH requests. Manages file extension guards by reading current filenames. Formats results. Decorates API errors with recovery guidance.
Registration and documentation
shortcuts/drive/shortcuts.go, shortcuts/drive/shortcuts_test.go, skills/lark-drive/SKILL.md, skills/lark-drive/references/lark-drive-update-title.md
Registers the shortcut in the collection. Documents command parameters, behavior, examples, error handling, and references.
End-to-end tests and coverage
tests/cli_e2e/drive/drive_update_title_dryrun_test.go, tests/cli_e2e/drive/drive_update_title_workflow_test.go, tests/cli_e2e/drive/coverage.md
Tests dry-run and live workflows. Covers file and folder renames, extension policies, response metadata, mismatched types, and command coverage metrics.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant DriveUpdateTitle as drive +update-title
  participant DriveAPI as Drive API
  User->>DriveUpdateTitle: Provide URL/token and new title
  DriveUpdateTitle->>DriveUpdateTitle: Resolve and validate input
  alt File with extension guard
    DriveUpdateTitle->>DriveAPI: Read current title for extension
    DriveAPI-->>DriveUpdateTitle: Return current filename
  end
  DriveUpdateTitle->>DriveAPI: Send typed PATCH request
  DriveAPI-->>DriveUpdateTitle: Return response or error
  DriveUpdateTitle-->>User: Report result or recovery guidance
Loading

Suggested reviewers: liangshuo-1, fangshuyu-768

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 44.44% 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 identifies the primary change: adding the drive +update-title shortcut.
Description check ✅ Passed The description covers the scope, implementation, testing, documentation, and related issues; the Changes list retains placeholder items but the content is otherwise complete.
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.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/drive-update-title-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.

@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 Aug 4, 2026
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch 2 times, most recently from 51545bf to c44603d Compare August 4, 2026 06:16
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@3625b9f2586d8f36c96c789c9b525315df5ce2be

🧩 Skill update

npx skills add larksuite/cli#feat/drive-update-title-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: 5

🤖 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_update_title.go`:
- Around line 110-126: Update readDriveUpdateTitleSpec to store the raw
runtime.Str("title") value in driveUpdateTitleSpec.Title, while
validateDriveUpdateTitleSpec trims only a temporary copy to reject
whitespace-only titles. Preserve surrounding whitespace for valid titles and
update the request-body test to expect the raw "  Q3 plan  " value.
- Around line 174-176: Update the validation error return in the drive
update-title flow to chain the original error via WithCause(err) while retaining
WithParam(sourceFlag). Extend the “token with path fragments” test to verify the
wrapped *errs.ValidationError cause can be inspected with errors.As.

In `@skills/lark-drive/references/lark-drive-update-title.md`:
- Around line 42-52: Update the JSON output example in the “输出” section to wrap
updated, file_token, type, title, and url inside a data object, matching the
envelope consumed by the command tests.

In `@tests/cli_e2e/drive/coverage.md`:
- Around line 4-6: Update the coverage summary in coverage.md to match the
command table’s 45 total rows and 24 covered rows, recalculating the percentage
accordingly; if any rows are intentionally excluded, document the exclusion
criteria and adjust the totals consistently.

In `@tests/cli_e2e/drive/drive_update_title_dryrun_test.go`:
- Around line 147-156: Update the negative tests to assert structured
typed-error metadata: in
tests/cli_e2e/drive/drive_update_title_dryrun_test.go:147-156, assert exit code
2, empty stdout, and parsed error.type, error.subtype, error.param, and
error.message for --title; at :175-181, assert the same validation envelope for
--type; in tests/cli_e2e/drive/drive_update_title_workflow_test.go:119-125,
retain code 981003 and assert the API error type with a non-empty subtype; in
shortcuts/drive/drive_update_title_test.go:393-402, use errs.ProblemOf to assert
errs.CategoryAPI and a non-empty Subtype alongside the existing code and
recovery hint.
🪄 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 Plus

Run ID: f5153979-c58c-4874-907d-dc281e151da0

📥 Commits

Reviewing files that changed from the base of the PR and between f1dc4fc and e33a990.

📒 Files selected for processing (9)
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go

Comment thread shortcuts/drive/drive_update_title.go
Comment thread shortcuts/drive/drive_update_title.go
Comment thread skills/lark-drive/references/lark-drive-update-title.md
Comment thread tests/cli_e2e/drive/coverage.md Outdated
Comment thread tests/cli_e2e/drive/drive_update_title_dryrun_test.go
@codecov

codecov Bot commented Aug 4, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.37086% with 17 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.13%. Comparing base (9759167) to head (3625b9f).

Files with missing lines Patch % Lines
shortcuts/drive/drive_update_title.go 94.35% 11 Missing and 6 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2172      +/-   ##
==========================================
+ Coverage   76.08%   76.13%   +0.05%     
==========================================
  Files         983      984       +1     
  Lines      103429   103731     +302     
==========================================
+ Hits        78692    78977     +285     
- Misses      18752    18763      +11     
- Partials     5985     5991       +6     

☔ 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.

@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_update_title.go (2)

110-126: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve whitespace in accepted titles.

Line 112 still stores the trimmed value in spec.Title. A title such as " Q3 plan " is sent to the API and reported as "Q3 plan". Store the raw flag value, and trim only a temporary copy for the whitespace-only check.

Proposed fix
 	spec := driveUpdateTitleSpec{
 		Ref:   ref,
-		Title: strings.TrimSpace(runtime.Str("title")),
+		Title: runtime.Str("title"),
 	}
 func validateDriveUpdateTitleSpec(spec driveUpdateTitleSpec) error {
-	if spec.Title == "" {
+	if strings.TrimSpace(spec.Title) == "" {

As per coding guidelines: "When transcribing input or transforming requests, preserve values faithfully; never silently coerce unsupported inputs".

🤖 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_update_title.go` around lines 110 - 126, Update the
driveUpdateTitleSpec construction to preserve the raw title flag value in
spec.Title, and adjust validateDriveUpdateTitleSpec to trim only a temporary
value when checking for an empty or whitespace-only title. Keep validation
behavior unchanged while ensuring accepted titles retain their original
whitespace when sent to the API.

Source: Coding guidelines


174-176: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve the validate.ResourceName cause.

The validate.ResourceName error is still only interpolated into the message. Chain it with WithCause(err) so callers can inspect it with errors.As.

Proposed fix
 	if err := validate.ResourceName(raw, sourceFlag); err != nil {
 		return driveUpdateTitleRef{}, errs.NewValidationError(errs.SubtypeInvalidArgument, "%s", err).
-			WithParam(sourceFlag)
+			WithParam(sourceFlag).
+			WithCause(err)
 	}
🤖 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_update_title.go` around lines 174 - 176, Update the
validation error construction in the drive update-title flow after
validate.ResourceName returns an error to chain the original err via
WithCause(err), while preserving the existing subtype, message, and sourceFlag
parameter.

Source: Coding guidelines

🧹 Nitpick comments (1)
shortcuts/drive/drive_update_title.go (1)

159-167: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Add a test for the unsupported URL resource type branch.

Codecov reports lines 160-166 as uncovered. This branch produces a user-facing message that lists the supported types. Add one case to resolveDriveUpdateTitleInput tests with a URL that common.ParseResourceURL recognizes but whose type is outside driveUpdateTitleAPITypes.

🤖 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_update_title.go` around lines 159 - 167, Add a test
case in the resolveDriveUpdateTitleInput tests using a URL recognized by
common.ParseResourceURL whose resource type is not included in
driveUpdateTitleAPITypes, then assert the returned validation error and its
user-facing message lists the unsupported type and supported types.

Source: Linters/SAST tools

🤖 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_update_title.go`:
- Around line 110-126: Update the driveUpdateTitleSpec construction to preserve
the raw title flag value in spec.Title, and adjust validateDriveUpdateTitleSpec
to trim only a temporary value when checking for an empty or whitespace-only
title. Keep validation behavior unchanged while ensuring accepted titles retain
their original whitespace when sent to the API.
- Around line 174-176: Update the validation error construction in the drive
update-title flow after validate.ResourceName returns an error to chain the
original err via WithCause(err), while preserving the existing subtype, message,
and sourceFlag parameter.

---

Nitpick comments:
In `@shortcuts/drive/drive_update_title.go`:
- Around line 159-167: Add a test case in the resolveDriveUpdateTitleInput tests
using a URL recognized by common.ParseResourceURL whose resource type is not
included in driveUpdateTitleAPITypes, then assert the returned validation error
and its user-facing message lists the unsupported type and supported types.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9301bb1a-26f4-4e0d-968b-3900feee5081

📥 Commits

Reviewing files that changed from the base of the PR and between e33a990 and c44603d.

📒 Files selected for processing (9)
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • shortcuts/drive/shortcuts.go
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • shortcuts/drive/shortcuts_test.go
  • tests/cli_e2e/drive/coverage.md
  • shortcuts/drive/drive_update_title_test.go

Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from c44603d to 65a161c Compare August 4, 2026 06:31
Comment thread skills/lark-drive/references/lark-drive-update-title.md

@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 `@skills/lark-drive/SKILL.md`:
- Line 55: Update the rename guidance near the drive title instructions to apply
only to resource types supported by drive +update-title, explicitly excluding
apps or providing its documented fallback. Preserve the existing reference to
lark-drive-update-title.md for supported resources.
🪄 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 Plus

Run ID: 9411ee16-67ee-44ce-b29e-42b521111ec1

📥 Commits

Reviewing files that changed from the base of the PR and between c44603d and 65a161c.

📒 Files selected for processing (9)
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (7)
  • shortcuts/drive/shortcuts.go
  • skills/lark-drive/references/lark-drive-update-title.md
  • shortcuts/drive/shortcuts_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go

Comment thread skills/lark-drive/SKILL.md
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from 65a161c to 852c3ae Compare August 4, 2026 09:14

@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

🧹 Nitpick comments (2)
tests/cli_e2e/drive/drive_update_title_workflow_test.go (1)

153-157: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove the dead Stdout != "" guard.

Line 154 calls AssertStdoutStatus(t, true), which already requires a parsable, non-empty stdout. The allowResult.Stdout != "" guard therefore never short-circuits, and if it ever did, the assertion would silently pass. Assert previous_title absence unconditionally.

♻️ Proposed simplification
-	if allowResult.Stdout != "" && gjson.Get(allowResult.Stdout, "data.previous_title").Exists() {
+	if gjson.Get(allowResult.Stdout, "data.previous_title").Exists() {
 		t.Fatalf("allow should not read the current title, so previous_title must be absent\nstdout:\n%s", allowResult.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 `@tests/cli_e2e/drive/drive_update_title_workflow_test.go` around lines 153 -
157, In the allowResult assertion block, remove the redundant allowResult.Stdout
!= "" condition and check gjson.Get(allowResult.Stdout,
"data.previous_title").Exists() unconditionally after AssertStdoutStatus.
Preserve the existing failure message and AssertExitCode behavior.
skills/lark-drive/references/lark-drive-update-title.md (1)

41-42: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Trim the internal mechanics from the caller guidance.

Line 41 documents the internal metas.batch_query read and the conditional metadata scope. Prior guidance for skills/lark-drive/references/*.md is to keep caller guidance concise and to describe missing permissions at the API level through typed errors and ConditionalScopes, not through internal resolution logic. Consider reducing line 41 to the observable behavior: the default appends the current extension and reports it in extension_appended, and allow submits the title verbatim.

Line 42 calls the wiki input wiki_token. The command and its tips call it the node token. Use one term.

Based on learnings: "avoid exposing internal implementation/compatibility details ... or any conditional metadata-scope behavior. Keep the guidance for callers concise".

🤖 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 `@skills/lark-drive/references/lark-drive-update-title.md` around lines 41 -
42, 简化默认扩展名行为说明,移除 metas.batch_query、metadata scope
及其他内部解析细节;仅保留可观察行为:默认补齐当前后缀并通过 extension_appended 说明,使用 allow 时原样提交标题。将
wiki_token 统一改称为命令和提示中使用的“node token”,保持 wiki URL 输入行为不变。

Source: Learnings

🤖 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/coverage.md`:
- Line 59: Update the coverage row for drive +update-title to list
TestDriveUpdateTitleDryRun_RejectsExtensionPolicyOnNonFileType,
TestDriveUpdateTitleDryRun_RejectsEmptyTitle, and
TestDriveUpdateTitleDryRun_RejectsTypeConflict alongside the existing test
references, keeping the validation notes consistent with the complete test list.

---

Nitpick comments:
In `@skills/lark-drive/references/lark-drive-update-title.md`:
- Around line 41-42: 简化默认扩展名行为说明,移除 metas.batch_query、metadata scope
及其他内部解析细节;仅保留可观察行为:默认补齐当前后缀并通过 extension_appended 说明,使用 allow 时原样提交标题。将
wiki_token 统一改称为命令和提示中使用的“node token”,保持 wiki URL 输入行为不变。

In `@tests/cli_e2e/drive/drive_update_title_workflow_test.go`:
- Around line 153-157: In the allowResult assertion block, remove the redundant
allowResult.Stdout != "" condition and check gjson.Get(allowResult.Stdout,
"data.previous_title").Exists() unconditionally after AssertStdoutStatus.
Preserve the existing failure message and AssertExitCode behavior.
🪄 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 Plus

Run ID: 771906a5-b272-4613-b94b-0cf0fd407b20

📥 Commits

Reviewing files that changed from the base of the PR and between 65a161c and 852c3ae.

📒 Files selected for processing (9)
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (2)
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go

Comment thread tests/cli_e2e/drive/coverage.md Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from 852c3ae to 5c0c2ae Compare August 4, 2026 09:29

@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: 2

🧹 Nitpick comments (1)
skills/lark-drive/references/lark-drive-update-title.md (1)

41-41: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Keep metadata permission guidance at the API level.

Lines [41] and [73] expose the internal metas.batch_query call and the conditional drive:drive.metadata:readonly behavior. These details can become stale when the resolver changes.

Keep the documented extension policy and extension_appended result. Describe permission failures through the command’s typed error and ConditionalScopes. Retain the type-specific write scopes in the table.

Suggested wording change
-- 默认会兜住丢后缀:`--type file` 时 CLI 先读一次当前文件名(`metas.batch_query`,需要 `drive:drive.metadata:readonly`),标题缺后缀就补上当前后缀并在输出的 `extension_appended` 里说明;标题改了后缀(`a.md` → `a.txt`)默认报错,确认要改就加 `--on-extension-mismatch=allow`。`allow` 同时跳过这次读取,没有 metadata scope 时也能改名
+- 默认会兜住丢后缀:`--type file` 时,标题缺后缀就补上当前后缀并在输出的 `extension_appended` 里说明;标题改了后缀(`a.md` → `a.txt`)默认报错,确认要改就加 `--on-extension-mismatch=allow`。`allow` 原样提交标题,可能丢失原扩展名
...
-| `99991672` / `99991679` | 缺 scope:应用未申请 / 用户未授权 | ... `--type file` 的后缀兜底还要 `drive:drive.metadata:readonly`,不想加就用 `--on-extension-mismatch=allow` 跳过 |
+| `99991672` / `99991679` | 缺 scope:应用未申请 / 用户未授权 | ... 按命令返回的 typed error 补充缺失权限;只有确认要原样提交标题时才使用 `--on-extension-mismatch=allow` |

Based on learnings, Lark CLI skill/help documentation should avoid exposing internal implementation or compatibility details, including conditional metadata-scope behavior, and should describe missing permissions at the API level using typed errors and ConditionalScopes.

Also applies to: 73-73

🤖 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 `@skills/lark-drive/references/lark-drive-update-title.md` at line 41, Update
the documentation around the extension policy and extension_appended result to
remove references to metas.batch_query, metadata reads, and conditional
metadata-scope behavior. Describe missing permissions only through the command’s
typed error and ConditionalScopes, while retaining the type-specific write
scopes in the permissions table.

Source: Learnings

🤖 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 `@skills/lark-drive/SKILL.md`:
- Line 55: Update the rename guidance near “drive +update-title” to explicitly
limit this shortcut to the resource types supported by that command, and
describe the appropriate fallback for unsupported types such as apps. Preserve
the existing reference and serial-processing/rate-limit guidance.

In `@tests/cli_e2e/drive/drive_update_title_workflow_test.go`:
- Around line 131-136: Strengthen the negative-path assertions in
tests/cli_e2e/drive/drive_update_title_workflow_test.go at lines 131-136 by
requiring exit code 2, empty stdout, and the expected stderr typed metadata via
errs.ProblemOf: category/error.type, subtype, and param. At lines 189-194,
retain the existing 981003 assertion and additionally validate the expected
typed API error metadata through errs.ProblemOf, including category, subtype,
and param.

---

Nitpick comments:
In `@skills/lark-drive/references/lark-drive-update-title.md`:
- Line 41: Update the documentation around the extension policy and
extension_appended result to remove references to metas.batch_query, metadata
reads, and conditional metadata-scope behavior. Describe missing permissions
only through the command’s typed error and ConditionalScopes, while retaining
the type-specific write scopes in the permissions table.
🪄 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 Plus

Run ID: 5dab8849-4fa0-428b-b5f3-7aadb8ed35e6

📥 Commits

Reviewing files that changed from the base of the PR and between 852c3ae and 5c0c2ae.

📒 Files selected for processing (9)
  • shortcuts/drive/drive_update_title.go
  • shortcuts/drive/drive_update_title_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/shortcuts_test.go
  • skills/lark-drive/SKILL.md
  • skills/lark-drive/references/lark-drive-update-title.md
  • tests/cli_e2e/drive/coverage.md
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • tests/cli_e2e/drive/drive_update_title_workflow_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
  • shortcuts/drive/shortcuts_test.go
  • shortcuts/drive/shortcuts.go
  • shortcuts/drive/drive_update_title.go
  • tests/cli_e2e/drive/drive_update_title_dryrun_test.go
  • shortcuts/drive/drive_update_title_test.go

Comment thread skills/lark-drive/SKILL.md Outdated
Comment thread tests/cli_e2e/drive/drive_update_title_workflow_test.go Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch 6 times, most recently from 4d90360 to b4a5cae Compare August 4, 2026 11:59
@zzzchao123 zzzchao123 self-assigned this Aug 4, 2026
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from b4a5cae to 8913edc Compare August 4, 2026 12:14
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread shortcuts/drive/drive_update_title.go
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch 2 times, most recently from 2236f2c to 3443d45 Compare August 4, 2026 12:32
Comment thread shortcuts/drive/drive_update_title.go
Comment thread skills/lark-drive/references/lark-drive-update-title.md Outdated
Comment thread shortcuts/drive/drive_update_title.go
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch 3 times, most recently from 0e233d4 to 6d5143b Compare August 5, 2026 06:36
Comment thread shortcuts/drive/drive_update_title.go
Comment thread shortcuts/drive/drive_update_title.go
Comment thread shortcuts/drive/drive_update_title.go Outdated
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from 6d5143b to 04b0090 Compare August 6, 2026 03:58
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from 04b0090 to c281310 Compare August 6, 2026 07:53
@zzzchao123
zzzchao123 requested a review from liangshuo-1 as a code owner August 6, 2026 07:53
@zzzchao123
zzzchao123 force-pushed the feat/drive-update-title-shortcut branch from c281310 to 3625b9f Compare August 6, 2026 08:26
@zzzchao123
zzzchao123 merged commit 010029c into main Aug 6, 2026
27 checks passed
@zzzchao123
zzzchao123 deleted the feat/drive-update-title-shortcut branch August 6, 2026 09:10
zkh-bytedance pushed a commit that referenced this pull request Aug 6, 2026
Co-authored-by: TRAE CLI <traecli@bytedance.com>
@liangshuo-1 liangshuo-1 mentioned this pull request Aug 7, 2026
3 tasks
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.

4 participants