feat(base): add base block shortcuts#1044
Conversation
|
Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds five new CLI commands for base block container management (list, create, move, rename, delete) with shared operations for dry-run preview and API execution. Includes unit and e2e tests, catalog registration, and user documentation. ChangesBase Block CLI Commands
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
tests/cli_e2e/base/base_block_dryrun_test.go (1)
52-53: ⚡ Quick winAssert HTTP method in every request-shape subtest.
Line 52 and Line 112 currently assert URL/body but skip method; this leaves a request-contract gap in dry-run coverage for
list folderandmove after.Proposed diff
@@ out := result.Stdout require.Equal(t, "/open-apis/base/v3/bases/app_x/blocks/list", gjson.Get(out, "api.0.url").String(), out) + require.Equal(t, "POST", gjson.Get(out, "api.0.method").String(), out) require.Equal(t, "blk_folder", gjson.Get(out, "api.0.body.parent_id").String(), out) @@ out := result.Stdout require.Equal(t, "/open-apis/base/v3/bases/app_x/blocks/blk_a/move", gjson.Get(out, "api.0.url").String(), out) + require.Equal(t, "POST", gjson.Get(out, "api.0.method").String(), out) require.Equal(t, "blk_folder", gjson.Get(out, "api.0.body.parent_id").String(), out) require.Equal(t, "blk_b", gjson.Get(out, "api.0.body.after_id").String(), out)Also applies to: 112-114
🤖 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/base/base_block_dryrun_test.go` around lines 52 - 53, Add assertions that verify the HTTP method in each request-shape subtest by checking gjson.Get(out, "api.<index>.method").String() with require.Equal so the dry-run covers request method as well as URL/body; specifically, in the "list folder" subtest (where you already assert "/open-apis/base/v3/bases/app_x/blocks/list" and parent_id "blk_folder") add require.Equal(t, "GET", gjson.Get(out, "api.0.method").String(), out), and in the "move after" subtest (the assertions around lines 112-114) add the corresponding require.Equal for the expected method (e.g., "POST") using the correct api index (e.g., "api.0.method") to ensure method is asserted.
🤖 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/base/coverage.md`:
- Around line 4-6: The coverage numbers in the file use stale metrics: update
the “Covered” and “Coverage” lines in coverage.md to match the table (change the
“Covered: 15” entry to “Covered: 18” and update “Coverage: 19.2%” to the correct
percentage “Coverage: 23.1%”); ensure you only edit the lines containing the
text tokens “Denominator:”, “Covered:”, and “Coverage:” so they reflect the
current table values.
---
Nitpick comments:
In `@tests/cli_e2e/base/base_block_dryrun_test.go`:
- Around line 52-53: Add assertions that verify the HTTP method in each
request-shape subtest by checking gjson.Get(out, "api.<index>.method").String()
with require.Equal so the dry-run covers request method as well as URL/body;
specifically, in the "list folder" subtest (where you already assert
"/open-apis/base/v3/bases/app_x/blocks/list" and parent_id "blk_folder") add
require.Equal(t, "GET", gjson.Get(out, "api.0.method").String(), out), and in
the "move after" subtest (the assertions around lines 112-114) add the
corresponding require.Equal for the expected method (e.g., "POST") using the
correct api index (e.g., "api.0.method") to ensure method is asserted.
🪄 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: 7792882d-d7db-4d40-8897-ffea9d065319
📒 Files selected for processing (18)
shortcuts/base/base_block_create.goshortcuts/base/base_block_delete.goshortcuts/base/base_block_list.goshortcuts/base/base_block_move.goshortcuts/base/base_block_ops.goshortcuts/base/base_block_rename.goshortcuts/base/base_dryrun_ops_test.goshortcuts/base/base_shortcuts_test.goshortcuts/base/shortcuts.goskills/lark-base/SKILL.mdskills/lark-base/references/lark-base-base-block-create.mdskills/lark-base/references/lark-base-base-block-delete.mdskills/lark-base/references/lark-base-base-block-list.mdskills/lark-base/references/lark-base-base-block-move.mdskills/lark-base/references/lark-base-base-block-rename.mdskills/lark-base/references/lark-base-base-block.mdtests/cli_e2e/base/base_block_dryrun_test.gotests/cli_e2e/base/coverage.md
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@e4b84470e39739de74a25c7ce03f6dac40d62d96🧩 Skill updatenpx skills add zgz2048/cli#codex/base-block-shortcuts -y -g |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1044 +/- ##
==========================================
+ Coverage 67.77% 67.81% +0.03%
==========================================
Files 590 596 +6
Lines 55194 55334 +140
==========================================
+ Hits 37406 37522 +116
- Misses 14677 14691 +14
- Partials 3111 3121 +10 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Add Base container block shortcuts for listing, creating, moving, renaming, and deleting folder/table/docx/dashboard/workflow entries.
Changes
base +base-block-list/create/move/rename/deleteshortcuts backed by Base v3/blocksAPIs.limit/offset; omitted--parent-idmeans root for create/move and all blocks for list.Test Plan
git diff --checkgo test ./shortcuts/...go test ./tests/cli_e2e/base -run 'TestBaseBlockDryRun|TestBase_AttachmentDryRun|TestBaseFormDetailDryRun' -count=1lark-cli base +base-block-list --helpexposes the new command.Related Issues
Summary by CodeRabbit
New Features
Documentation
Tests