Conversation
📝 WalkthroughWalkthroughThis PR introduces support for a repeatable Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR adds a repeatable The implementation correctly handles multi-value Confidence Score: 5/5Safe to merge — correct multi-value query parameter handling verified in both execute and dry-run paths, with tests covering repeatable flags, percent-encoding, and legacy flag rejection. All findings are P2 or lower. The implementation correctly delegates No files require special attention.
|
| Filename | Overview |
|---|---|
| shortcuts/base/record_list.go | Adds --field-id as a string_array flag to BaseRecordList; clean and consistent with other shortcut definitions. |
| shortcuts/base/record_ops.go | Both execute and dry-run paths correctly pass field_id as a multi-value query parameter; url.Values.Encode() handles percent-encoding and sorting by key. |
| shortcuts/base/helpers.go | No functional changes to baseV3Raw; existing []string branch already handles repeated query params correctly. |
| shortcuts/base/base_execute_test.go | New tests cover: repeated --field-id, comma-containing field names (URL-encoded), and rejection of the legacy --fields flag in both normal and dry-run modes. |
| shortcuts/base/base_dryrun_ops_test.go | Dry-run tests updated to use newBaseTestRuntimeWithArrays and assert correct field_id encoding in the generated URL. |
| shortcuts/base/base_shortcuts_test.go | Adds newBaseTestRuntimeWithArrays helper and a new validate assertion confirming BaseRecordList.Validate is nil (required for repeatable flags). |
| skills/lark-base/references/lark-base-record-get.md | Correctly removes stale --fields example and parameter row; updates return-value description to match actual executeRecordGet behavior. |
| skills/lark-base/references/lark-base-record-list.md | Adds --field-id to the params table, documents query_context.field_scope return fields, and adds pagination/field-filter pitfall notes. |
| skills/lark-base/SKILL.md | Updates pagination and field-filter guidance; no logic changes. |
| skills/lark-base/references/lark-base-record.md | Minor index update to note --field-id support in +record-list. |
Sequence Diagram
sequenceDiagram
participant CLI as CLI (cobra)
participant RL as record_list.go
participant RO as record_ops.go
participant H as helpers.go (baseV3Raw)
participant API as Lark Base API
CLI->>RL: +record-list --field-id Name --field-id Age ...
RL->>RO: executeRecordList(runtime)
RO->>RO: recordListFields(runtime) → ["Name","Age"]
RO->>RO: params["field_id"] = []string{"Name","Age"}
RO->>H: baseV3Call(GET, .../records, params, nil)
H->>H: for each field: queryParams.Add("field_id", field)
H->>API: GET /records?field_id=Name&field_id=Age&limit=N&offset=M
API-->>H: {code:0, data:{...}}
H-->>RO: data map
RO-->>CLI: runtime.Out(data)
Note over RL,RO: Dry-run path uses url.Values.Add + Encode() producing same percent-encoded query string
Reviews (3): Last reviewed commit: "refactor(base): remove field-id from rec..." | Re-trigger Greptile
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@7c69b7ad010496097afeb97846e22eff58cab245🧩 Skill updatenpx skills add larksuite/cli#feat-record-field-filter -y -g |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
shortcuts/base/base_shortcuts_test.go (1)
24-56:⚠️ Potential issue | 🟡 MinorAdd per-test config-dir isolation in the runtime helper.
This shared helper should set an isolated
LARKSUITE_CLI_CONFIG_DIRto avoid cross-test config state leakage.As per coding guidelines: Isolate config state in Go tests by using
t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()).🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@shortcuts/base/base_shortcuts_test.go` around lines 24 - 56, The helper newBaseTestRuntimeWithArrays should set an isolated config dir for each test; change its signature to accept t *testing.T (e.g., newBaseTestRuntimeWithArrays(t *testing.T, ...)) and inside the function call t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) before creating the cobra.Command, then update all call sites to pass the test *testing.T argument; this ensures per-test isolation of CLI config state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Outside diff comments:
In `@shortcuts/base/base_shortcuts_test.go`:
- Around line 24-56: The helper newBaseTestRuntimeWithArrays should set an
isolated config dir for each test; change its signature to accept t *testing.T
(e.g., newBaseTestRuntimeWithArrays(t *testing.T, ...)) and inside the function
call t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) before creating the
cobra.Command, then update all call sites to pass the test *testing.T argument;
this ensures per-test isolation of CLI config state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 058d46be-2c67-4c2b-b790-b1f7bc9b832f
📒 Files selected for processing (11)
shortcuts/base/base_dryrun_ops_test.goshortcuts/base/base_execute_test.goshortcuts/base/base_shortcuts_test.goshortcuts/base/helpers.goshortcuts/base/record_get.goshortcuts/base/record_list.goshortcuts/base/record_ops.goskills/lark-base/SKILL.mdskills/lark-base/references/lark-base-record-get.mdskills/lark-base/references/lark-base-record-list.mdskills/lark-base/references/lark-base-record.md
Summary
Add record field filter support for Base record operations and align CLI flag behavior/docs with OpenAPI params, including dry-run behavior consistency.
Changes
Test Plan
make unit-test)lark xxxcommand works as expectedgo mod tidy(nogo.mod/go.sumchanges)golangci-lint --new-from-rev=origin/main(blocked locally by existing unrelatedforbidigofinding inshortcuts/drive/drive_upload.go)Related Issues
Summary by CodeRabbit
New Features
--field-idparameter to+record-listcommand for selective field filtering.Bug Fixes
--fieldsflag from+record-getcommand.Documentation
+record-listdocumentation with field filtering and pagination constraints.+record-getreference to reflect API response structure.