Skip to content

feat(sheets): add filter view and condition shortcuts#422

Merged
fangshuyu-768 merged 1 commit intomainfrom
feat/filter_view
Apr 13, 2026
Merged

feat(sheets): add filter view and condition shortcuts#422
fangshuyu-768 merged 1 commit intomainfrom
feat/filter_view

Conversation

@caojie0621
Copy link
Copy Markdown
Collaborator

@caojie0621 caojie0621 commented Apr 11, 2026

Summary

Add 10 new sheets shortcuts for filter view and filter condition CRUD, covering the full lifecycle of spreadsheet filter views.

Changes

Filter views (5)

  • +create-filter-view: create a filter view with range, optional name and custom ID
  • +update-filter-view: update filter view range or name
  • +list-filter-views: list all filter views in a sheet
  • +get-filter-view: get a filter view by ID
  • +delete-filter-view: delete a filter view

Filter view conditions (5)

  • +create-filter-view-condition: create a filter condition on a column (number/text/color/hiddenValue)
  • +update-filter-view-condition: update a filter condition
  • +list-filter-view-conditions: list all conditions of a filter view
  • +get-filter-view-condition: get a condition by column
  • +delete-filter-view-condition: delete a condition

Other

  • Unit tests for all 10 shortcuts (39 cases, 88-93% coverage)
  • Skill reference docs for all 10 shortcuts

Test Plan

  • Unit tests pass (go test ./shortcuts/sheets/)
  • Manual local verification confirms all 10 lark-cli sheets +xxx commands work as expected

Related Issues

  • None

Summary by CodeRabbit

  • New Features

    • Added 10 new Sheets commands to manage filter views and their conditions (create, update, list, get, delete).
  • Documentation

    • Added reference docs for each new command with examples, parameters, usage notes, and expected JSON outputs.
  • Tests

    • Added an extensive test suite covering validation rules, dry-run/execute behavior, error cases, request/response shapes, and URL-based token handling.

@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 Apr 11, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 11, 2026

📝 Walkthrough

Walkthrough

Adds 10 new Sheets CLI shortcuts (5 for filter views, 5 for filter-view conditions), their implementations and helpers, token validation, comprehensive tests, registers the shortcuts, and adds corresponding documentation pages.

Changes

Cohort / File(s) Summary
Filter View Implementation
shortcuts/sheets/sheet_filter_view.go
Adds 5 shortcuts: create/update/list/get/delete filter views; path helpers, token resolution/validation, DryRun request construction, and Execute via runtime.CallAPI.
Filter Condition Implementation
shortcuts/sheets/sheet_filter_view_condition.go
Adds 5 shortcuts: create/update/list/get/delete filter-view conditions; path helpers, buildConditionBody, validateExpectedFlag, JSON parsing for --expected, DryRun and Execute.
Tests
shortcuts/sheets/sheet_filter_view_test.go
Adds extensive tests covering flag validation (--url vs --spreadsheet-token), DryRun request shapes, execute flows with httpmock (success & failure), URL-derived tokens, and --expected serialization/validation.
Shortcuts Registration
shortcuts/sheets/shortcuts.go
Registers the 10 new shortcut variables in Shortcuts().
Skill Manifest
skills/lark-sheets/SKILL.md
Adds entries for the 10 new lark-cli sheets +... commands.
Reference Docs — Filter Views
skills/lark-sheets/references/lark-sheets-{create,update,list,get,delete}-filter-view.md
Adds documentation pages for filter view operations: usage, parameters (--url/--spreadsheet-token rules), examples, and expected outputs.
Reference Docs — Filter Conditions
skills/lark-sheets/references/lark-sheets-{create,update,list,get,delete}-filter-view-condition.md
Adds documentation pages for condition management: usage, parameter tables, examples, expected as JSON array, and output shapes.

Sequence Diagram(s)

sequenceDiagram
    participant CLI as CLI (lark-cli)
    participant Runtime as RuntimeContext
    participant API as Sheets API (v3)
    participant Out as stdout

    CLI->>Runtime: Validate flags, derive token (--url or --spreadsheet-token)
    CLI->>Runtime: Build path & body (path helpers, buildConditionBody)
    Runtime->>API: CallAPI(method, path, body, token)
    API-->>Runtime: HTTP response (200/4xx/5xx)
    Runtime-->>Out: write response JSON or error
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Suggested reviewers

  • fangshuyu-768

Poem

🐇 I hopped through code and left neat little tracks,
Ten new shortcuts, stamped with tiny snacks.
Tests sniffed the paths, docs hung the sign,
Sheets now filter sweetly — carrot time! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and concisely summarizes the main change: adding 10 filter view and condition shortcuts to the sheets module.
Description check ✅ Passed The PR description follows the template structure with all required sections (Summary, Changes, Test Plan, Related Issues) fully completed with specific details.

✏️ 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/filter_view

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 11, 2026

Greptile Summary

This PR adds 10 new sheets shortcuts covering the full CRUD lifecycle for filter views and filter-view conditions, backed by 39 unit tests and reference documentation. The two previously-flagged "no-op update" concerns are now addressed — both update validators explicitly require at least one field to be changed before issuing the write call.

Confidence Score: 5/5

Safe to merge; the only remaining finding is a minor edge-case P2 that requires deliberately passing an empty-string flag value.

Both previously-flagged P1 issues (no-op update validators) are resolved. The remaining P2 concern — a semantic gap between Changed-flag validation and empty-string body-building in buildConditionBody — requires an adversarial empty-string argument to trigger and is unlikely in normal use. All 39 tests pass, DryRun/Execute paths are consistent, and path-segment encoding is applied throughout.

shortcuts/sheets/sheet_filter_view_condition.go — the buildConditionBody/Validate gap described in the inline comment.

Important Files Changed

Filename Overview
shortcuts/sheets/sheet_filter_view.go Adds 5 filter-view shortcuts (create/update/list/get/delete); DryRun/Execute paths are consistent, update validator correctly requires at least one changed field.
shortcuts/sheets/sheet_filter_view_condition.go Adds 5 filter-condition shortcuts; update validator guards against no-op using Flags().Changed(), but buildConditionBody uses non-empty string checks — passing an explicitly-empty flag value passes validation yet still produces a sparse/empty PUT body.
shortcuts/sheets/sheet_filter_view_test.go 39 test cases covering validate, dry-run, execute, URL-flag and API-error paths for all 10 shortcuts; coverage is thorough.
shortcuts/sheets/shortcuts.go Registers all 10 new shortcuts in the correct order.
skills/lark-sheets/SKILL.md Adds 10 rows to the shortcut table with correct links to new reference docs.

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI
    participant LarkAPI

    User->>CLI: sheets +create-filter-view --range ...
    CLI->>LarkAPI: POST /spreadsheets/:token/sheets/:sheetId/filter_views
    LarkAPI-->>CLI: { filter_view: { filter_view_id, range } }
    CLI-->>User: JSON output

    User->>CLI: sheets +create-filter-view-condition --filter-type number ...
    CLI->>LarkAPI: POST .../filter_views/:fvId/conditions
    LarkAPI-->>CLI: { condition: { condition_id, filter_type, ... } }
    CLI-->>User: JSON output

    User->>CLI: sheets +update-filter-view-condition --filter-type text ...
    CLI->>LarkAPI: PUT .../filter_views/:fvId/conditions/:condId
    LarkAPI-->>CLI: { condition: { ... } }
    CLI-->>User: JSON output

    User->>CLI: sheets +delete-filter-view
    CLI->>LarkAPI: DELETE .../filter_views/:fvId
    LarkAPI-->>CLI: { code: 0 }
    CLI-->>User: JSON output
Loading

Reviews (2): Last reviewed commit: "feat(sheets): add filter view and condit..." | Re-trigger Greptile

Comment thread shortcuts/sheets/sheet_filter_view_condition.go
Comment thread shortcuts/sheets/sheet_filter_view.go Outdated
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: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@shortcuts/sheets/sheet_filter_view_condition.go`:
- Around line 80-103: The Validate implementation in the
sheet_filter_view_condition.go command only checks auth token and allows no-op
updates; change Validate (the Validate func) to also require at least one of the
update flags before returning success: inspect runtime.Str or
runtime.Has/appropriate accessors for "filter-type", "compare-type", and
"expected" (the same keys used by buildConditionBody) and if all three are
empty/absent return a descriptive error (e.g., "must provide at least one of
--filter-type, --compare-type, or --expected"); keep the existing token
validation by calling validateFilterViewToken(runtime) first and return its
error if present.

In `@shortcuts/sheets/sheet_filter_view.go`:
- Around line 99-125: The current Validate in the +update-filter-view shortcut
only checks token and allows an empty PATCH body; update the Validate function
(the Validate closure that calls validateFilterViewToken) to also require that
at least one of runtime.Str("range") or runtime.Str("filter-view-name") is
non-empty and return a clear error if both are empty so users get an immediate
CLI error; keep the DryRun and Execute body-building logic (which reads
runtime.Str("range") and runtime.Str("filter-view-name")) unchanged so the
validation matches what filterViewItemPath/runtime.CallAPI expect.

In `@skills/lark-sheets/references/lark-sheets-get-filter-view.md`:
- Around line 19-22: Update the documentation for the lark-sheets Get Filter
View flags to indicate that the `--url` and `--spreadsheet-token` flags are
mutually optional but one is required: clarify in the table row for `--url` and
`--spreadsheet-token` (and/or add a short note below the table) that at least
one of `--url` or `--spreadsheet-token` must be provided to avoid the flag
validation error when both are omitted.

In `@skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md`:
- Around line 21-24: The doc incorrectly marks both `--url` and
`--spreadsheet-token` as optional for the `+list-filter-view-conditions`
command; update the wording and table so it clearly states that one of these two
auth inputs is mandatory (i.e., "one of `--url` or `--spreadsheet-token` must be
provided"), and adjust the description for `--url` and `--spreadsheet-token` in
the table to indicate "one required" or add a note that the command rejects
requests when both are omitted; reference the `+list-filter-view-conditions`
command and the `--url`/`--spreadsheet-token` flags when making this change.
🪄 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: 41e4ea8f-0bea-4b3e-a7fe-fe5dad00c480

📥 Commits

Reviewing files that changed from the base of the PR and between a9c07ce and 0f2dce2.

📒 Files selected for processing (15)
  • shortcuts/sheets/sheet_filter_view.go
  • shortcuts/sheets/sheet_filter_view_condition.go
  • shortcuts/sheets/sheet_filter_view_test.go
  • shortcuts/sheets/shortcuts.go
  • skills/lark-sheets/SKILL.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view.md
  • skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md
  • skills/lark-sheets/references/lark-sheets-list-filter-views.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view.md

Comment thread shortcuts/sheets/sheet_filter_view_condition.go
Comment thread shortcuts/sheets/sheet_filter_view.go
Comment thread skills/lark-sheets/references/lark-sheets-get-filter-view.md
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 11, 2026

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@32f08695331c9ca943d9eb0c02838e2badb71323

🧩 Skill update

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

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.

♻️ Duplicate comments (2)
shortcuts/sheets/sheet_filter_view_condition.go (1)

80-83: ⚠️ Potential issue | 🟡 Minor

Reject empty +update-filter-view-condition updates in Validate.

This path currently allows PUT {} when none of --filter-type, --compare-type, or --expected is provided. Please validate this upfront.

Suggested fix
 	Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
-		_, err := validateFilterViewToken(runtime)
-		return err
+		if _, err := validateFilterViewToken(runtime); err != nil {
+			return err
+		}
+		if runtime.Str("filter-type") == "" &&
+			runtime.Str("compare-type") == "" &&
+			runtime.Str("expected") == "" {
+			return common.FlagErrorf("specify at least one of --filter-type, --compare-type, or --expected")
+		}
+		return nil
 	},

Also applies to: 84-97

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/sheets/sheet_filter_view_condition.go` around lines 80 - 83, The
Validate function in sheet_filter_view_condition.go currently returns success
for empty update payloads; update it to explicitly reject requests that don't
provide any of the updatable fields by checking the runtime for at least one of
the flags/values (--filter-type, --compare-type, --expected) before calling
validateFilterViewToken, and return an error if none are present; apply the same
check for the other Validate blocks around the 84-97 region so both update paths
enforce "no-empty-update" validation using the same flag presence logic and
error message.
shortcuts/sheets/sheet_filter_view.go (1)

99-102: ⚠️ Potential issue | 🟡 Minor

Reject no-op +update-filter-view requests in validation.

+update-filter-view currently allows PATCH {} when neither --range nor --filter-view-name is set. Please fail fast in Validate with a flag error.

Suggested fix
 	Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
-		_, err := validateFilterViewToken(runtime)
-		return err
+		if _, err := validateFilterViewToken(runtime); err != nil {
+			return err
+		}
+		if runtime.Str("range") == "" && runtime.Str("filter-view-name") == "" {
+			return common.FlagErrorf("specify --range or --filter-view-name")
+		}
+		return nil
 	},

Also applies to: 103-115, 116-126

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/sheets/sheet_filter_view.go` around lines 99 - 102, The Validate
implementation for the +update-filter-view command currently only calls
validateFilterViewToken(runtime) and permits no-op PATCH requests; update
Validate (the anonymous Validate func and the related validators around
validateFilterViewToken) to check that at least one of the change flags is
present (e.g., runtime.Flags or the parsed flags for --range and
--filter-view-name) and return a flag error when both are empty, so the command
fails fast instead of allowing PATCH {}. Locate the anonymous Validate
function(s) that call validateFilterViewToken and add a pre-check that inspects
the runtime/flags for --range or --filter-view-name, returning a descriptive
flag error if neither is provided. Ensure the same change is applied to the
other similar Validate blocks referenced (lines handling the same command).
🧹 Nitpick comments (1)
shortcuts/sheets/sheet_filter_view.go (1)

53-75: Extract duplicated filter-view body construction to one helper.

Create/update each build the same body twice (DryRun + Execute). A shared helper will reduce drift risk.

Also applies to: 103-125

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/sheets/sheet_filter_view.go` around lines 53 - 75, Both DryRun and
Execute duplicate the same body construction (using runtime.Str("range"),
"filter-view-name", "filter-view-id"); create a small helper function (e.g.,
buildFilterViewBody(runtime *common.RuntimeContext) map[string]interface{}) and
replace the inline body creation in DryRun and Execute with a call to that
helper, keeping validateFilterViewToken and filterViewBasePath usage unchanged;
also update the other similar block (lines ~103-125) to use the same helper so
both cases share one source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@shortcuts/sheets/sheet_filter_view_condition.go`:
- Around line 80-83: The Validate function in sheet_filter_view_condition.go
currently returns success for empty update payloads; update it to explicitly
reject requests that don't provide any of the updatable fields by checking the
runtime for at least one of the flags/values (--filter-type, --compare-type,
--expected) before calling validateFilterViewToken, and return an error if none
are present; apply the same check for the other Validate blocks around the 84-97
region so both update paths enforce "no-empty-update" validation using the same
flag presence logic and error message.

In `@shortcuts/sheets/sheet_filter_view.go`:
- Around line 99-102: The Validate implementation for the +update-filter-view
command currently only calls validateFilterViewToken(runtime) and permits no-op
PATCH requests; update Validate (the anonymous Validate func and the related
validators around validateFilterViewToken) to check that at least one of the
change flags is present (e.g., runtime.Flags or the parsed flags for --range and
--filter-view-name) and return a flag error when both are empty, so the command
fails fast instead of allowing PATCH {}. Locate the anonymous Validate
function(s) that call validateFilterViewToken and add a pre-check that inspects
the runtime/flags for --range or --filter-view-name, returning a descriptive
flag error if neither is provided. Ensure the same change is applied to the
other similar Validate blocks referenced (lines handling the same command).

---

Nitpick comments:
In `@shortcuts/sheets/sheet_filter_view.go`:
- Around line 53-75: Both DryRun and Execute duplicate the same body
construction (using runtime.Str("range"), "filter-view-name", "filter-view-id");
create a small helper function (e.g., buildFilterViewBody(runtime
*common.RuntimeContext) map[string]interface{}) and replace the inline body
creation in DryRun and Execute with a call to that helper, keeping
validateFilterViewToken and filterViewBasePath usage unchanged; also update the
other similar block (lines ~103-125) to use the same helper so both cases share
one source of truth.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 1e9c1b69-74f4-444c-b260-8477bf035145

📥 Commits

Reviewing files that changed from the base of the PR and between 0f2dce2 and 19324bf.

📒 Files selected for processing (15)
  • shortcuts/sheets/sheet_filter_view.go
  • shortcuts/sheets/sheet_filter_view_condition.go
  • shortcuts/sheets/sheet_filter_view_test.go
  • shortcuts/sheets/shortcuts.go
  • skills/lark-sheets/SKILL.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view.md
  • skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md
  • skills/lark-sheets/references/lark-sheets-list-filter-views.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view.md
✅ Files skipped from review due to trivial changes (10)
  • skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-list-filter-views.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view-condition.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • shortcuts/sheets/shortcuts.go
  • skills/lark-sheets/SKILL.md
  • shortcuts/sheets/sheet_filter_view_test.go

Comment thread shortcuts/sheets/sheet_filter_view.go
Comment thread shortcuts/sheets/sheet_filter_view_condition.go
Comment thread shortcuts/sheets/sheet_filter_view_condition.go
Add 10 new sheet shortcuts for filter view management:

Filter views:
- +create-filter-view, +update-filter-view, +list-filter-views
- +get-filter-view, +delete-filter-view

Filter view conditions:
- +create-filter-view-condition, +update-filter-view-condition
- +list-filter-view-conditions, +get-filter-view-condition
- +delete-filter-view-condition

Includes unit tests (39 cases, 88-93% coverage) and skill reference docs.
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.

♻️ Duplicate comments (2)
shortcuts/sheets/sheet_filter_view.go (1)

103-106: ⚠️ Potential issue | 🟡 Minor

+update-filter-view still allows a no-op with empty values.

Line 103 checks only whether flags were set, not whether they carry usable values. --range "" and --filter-view-name "" can pass validation and still produce an empty PATCH body downstream.

Suggested fix
 	Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
 		if _, err := validateFilterViewToken(runtime); err != nil {
 			return err
 		}
-		if !runtime.Cmd.Flags().Changed("range") &&
-			!runtime.Cmd.Flags().Changed("filter-view-name") {
-			return common.FlagErrorf("specify at least one of --range or --filter-view-name")
+		if runtime.Str("range") == "" && runtime.Str("filter-view-name") == "" {
+			return common.FlagErrorf("specify at least one of --range or --filter-view-name with a non-empty value")
 		}
 		return nil
 	},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/sheets/sheet_filter_view.go` around lines 103 - 106, The current
validation only checks whether flags were set (runtime.Cmd.Flags().Changed) and
thus allows empty values like --range "" or --filter-view-name ""; update the
check to read the actual flag values (e.g.,
runtime.Cmd.Flags().GetString("range") and GetString("filter-view-name")), trim
them and ensure at least one is non-empty, and if both are empty return the same
common.FlagErrorf("specify at least one of --range or --filter-view-name"); this
prevents creating an empty PATCH body downstream in the update-filter-view
handler.
shortcuts/sheets/sheet_filter_view_condition.go (1)

86-93: ⚠️ Potential issue | 🟡 Minor

+update-filter-view-condition can still pass with no effective update.

Line 86 only checks whether flags changed. If users pass empty values (for example --expected ""), validation can pass but the request body remains empty because Line 254 only includes non-empty values.

Suggested fix
 	Validate: func(ctx context.Context, runtime *common.RuntimeContext) error {
 		if _, err := validateFilterViewToken(runtime); err != nil {
 			return err
 		}
-		if !runtime.Cmd.Flags().Changed("filter-type") &&
-			!runtime.Cmd.Flags().Changed("compare-type") &&
-			!runtime.Cmd.Flags().Changed("expected") {
-			return common.FlagErrorf("specify at least one of --filter-type, --compare-type, or --expected")
+		if runtime.Str("filter-type") == "" &&
+			runtime.Str("compare-type") == "" &&
+			runtime.Str("expected") == "" {
+			return common.FlagErrorf("specify at least one of --filter-type, --compare-type, or --expected with a non-empty value")
 		}
 		if s := runtime.Str("expected"); s != "" {
 			return validateExpectedFlag(s)
 		}
 		return nil
 	},
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@shortcuts/sheets/sheet_filter_view_condition.go` around lines 86 - 93, The
current guard only checks whether flags were changed
(runtime.Cmd.Flags().Changed) which allows empty values (e.g.,
runtime.Str("expected") == "") to pass but produce no effective update; change
the check to require at least one flag that is both changed and has a non-empty
value (e.g., check runtime.Cmd.Flags().Changed("expected") &&
runtime.Str("expected") != ""), or alternatively after constructing the request
body (the code path that only includes non-empty values) validate that the body
is not empty and return a FlagErrorf if it is; also keep the existing
validateExpectedFlag(runtime.Str("expected")) call but only invoke it when
runtime.Str("expected") is non-empty.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@shortcuts/sheets/sheet_filter_view_condition.go`:
- Around line 86-93: The current guard only checks whether flags were changed
(runtime.Cmd.Flags().Changed) which allows empty values (e.g.,
runtime.Str("expected") == "") to pass but produce no effective update; change
the check to require at least one flag that is both changed and has a non-empty
value (e.g., check runtime.Cmd.Flags().Changed("expected") &&
runtime.Str("expected") != ""), or alternatively after constructing the request
body (the code path that only includes non-empty values) validate that the body
is not empty and return a FlagErrorf if it is; also keep the existing
validateExpectedFlag(runtime.Str("expected")) call but only invoke it when
runtime.Str("expected") is non-empty.

In `@shortcuts/sheets/sheet_filter_view.go`:
- Around line 103-106: The current validation only checks whether flags were set
(runtime.Cmd.Flags().Changed) and thus allows empty values like --range "" or
--filter-view-name ""; update the check to read the actual flag values (e.g.,
runtime.Cmd.Flags().GetString("range") and GetString("filter-view-name")), trim
them and ensure at least one is non-empty, and if both are empty return the same
common.FlagErrorf("specify at least one of --range or --filter-view-name"); this
prevents creating an empty PATCH body downstream in the update-filter-view
handler.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: a663b09c-08d8-44cf-90e4-f3c9f2cb85ee

📥 Commits

Reviewing files that changed from the base of the PR and between 19324bf and 32f0869.

📒 Files selected for processing (15)
  • shortcuts/sheets/sheet_filter_view.go
  • shortcuts/sheets/sheet_filter_view_condition.go
  • shortcuts/sheets/sheet_filter_view_test.go
  • shortcuts/sheets/shortcuts.go
  • skills/lark-sheets/SKILL.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view.md
  • skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md
  • skills/lark-sheets/references/lark-sheets-list-filter-views.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view.md
✅ Files skipped from review due to trivial changes (11)
  • skills/lark-sheets/references/lark-sheets-get-filter-view.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-list-filter-views.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view.md
  • skills/lark-sheets/references/lark-sheets-get-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-update-filter-view-condition.md
  • skills/lark-sheets/references/lark-sheets-delete-filter-view.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view-condition.md
  • shortcuts/sheets/shortcuts.go
  • skills/lark-sheets/references/lark-sheets-list-filter-view-conditions.md
  • skills/lark-sheets/references/lark-sheets-create-filter-view.md
🚧 Files skipped from review as they are similar to previous changes (2)
  • skills/lark-sheets/SKILL.md
  • shortcuts/sheets/sheet_filter_view_test.go

@fangshuyu-768 fangshuyu-768 merged commit 74f7de3 into main Apr 13, 2026
17 checks passed
@fangshuyu-768 fangshuyu-768 deleted the feat/filter_view branch April 13, 2026 13:41
yxzhaao pushed a commit to yxzhaao/cli that referenced this pull request Apr 14, 2026
Add 10 new sheet shortcuts for filter view management:

Filter views:
- +create-filter-view, +update-filter-view, +list-filter-views
- +get-filter-view, +delete-filter-view

Filter view conditions:
- +create-filter-view-condition, +update-filter-view-condition
- +list-filter-view-conditions, +get-filter-view-condition
- +delete-filter-view-condition

Includes unit tests (39 cases, 88-93% coverage) and skill reference docs.
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.

2 participants