feat: support .base import and export for bitable#599
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:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
✅ Files skipped from review due to trivial changes (8)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds Changes
Sequence Diagram(s)sequenceDiagram
participant CLI as Client (CLI)
participant API as Drive API
participant Disk as Local Disk
rect rgba(200,230,255,0.5)
CLI->>API: POST /open-apis/drive/v1/export_tasks {type: "bitable", file_extension: "base"}
API-->>CLI: {ticket}
CLI->>API: GET /open-apis/drive/v1/export_tasks/{ticket} (poll until done)
API-->>CLI: {status: "success", snapshot_url}
CLI->>API: GET snapshot_url
API-->>CLI: binary snapshot (Content-Disposition: crm.base)
CLI->>Disk: write "crm.base"
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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 docstrings
🧪 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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #599 +/- ##
==========================================
- Coverage 61.69% 59.96% -1.74%
==========================================
Files 402 405 +3
Lines 35073 42680 +7607
==========================================
+ Hits 21639 25592 +3953
- Misses 11429 15080 +3651
- Partials 2005 2008 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@16c9ed638025d5493154701b2631709a47160df8🧩 Skill updatenpx skills add larksuite/cli#feat/bitable-base-import-export -y -g |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
skills/lark-drive/references/lark-drive-import.md (1)
66-75:⚠️ Potential issue | 🟡 MinorAdd
.baseto the mismatch rules list.Line 66 adds
.basesupport, but the validation guidance below still omits the.base→bitable-only rule.📝 Proposed documentation update
> - `.xlsx` / `.csv` 文件**只能**导入为 `sheet` 或 `bitable` > - `.xls` 文件**只能**导入为 `sheet` +> - `.base` 文件**只能**导入为 `bitable` > - 例如:`.csv` 文件不能导入为 `docx`,`.md` 文件不能导入为 `sheet`🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-drive/references/lark-drive-import.md` around lines 66 - 75, Update the validation rules to include the new `.base` extension and state it can only be imported as `bitable`: add an explicit rule mapping `.base` → `bitable` alongside the other extension constraints, and ensure the explanatory note references the CLI flag `--type bitable` (and the user synonyms "Base"/"多维表格"/"bitable") so docs consistently enforce that `.base` files are accepted only when `--type bitable` is used.
🤖 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/drive/drive_export.go`:
- Line 34: The enum for the "file-extension" option in drive_export.go currently
includes "base", which is not supported by Lark Drive v1 export_tasks and will
cause runtime failures; remove "base" from the Enum slice in the option
definition where Name: "file-extension" and Desc: "export format..." is defined
(leave only "docx","pdf","xlsx","csv","markdown"), and if you intended to
support a new type ensure OAuth scope/type changes and API compatibility before
re-adding. Also add a dry-run E2E test under tests/cli_e2e/dryrun/ that invokes
the export shortcut command in dry-run mode and asserts the generated
command/flags include the corrected file-extension enum values (no "base") to
prevent regressions.
In `@shortcuts/drive/drive_import.go`:
- Line 30: Add a dry-run E2E test exercising the drive +import flow by creating
a sample .base file(s) and invoking the CLI with the same flags as the command
definition (the "file" flag described in shortcuts/drive/drive_import.go) using:
drive +import --file <sample>.base --type bitable --dry-run; place the test
under tests/cli_e2e/drive/ (or tests/cli_e2e/dryrun/) and ensure it (1) creates
a valid .base payload under the 20MB cap and asserts the CLI returns the
expected dry-run request structure (headers/body) without calling real APIs, and
(2) includes a negative case where a .base file >20MB is provided and the CLI
fails with the size-limit error; keep the test purely dry-run/mocked so no
external network calls occur.
---
Outside diff comments:
In `@skills/lark-drive/references/lark-drive-import.md`:
- Around line 66-75: Update the validation rules to include the new `.base`
extension and state it can only be imported as `bitable`: add an explicit rule
mapping `.base` → `bitable` alongside the other extension constraints, and
ensure the explanatory note references the CLI flag `--type bitable` (and the
user synonyms "Base"/"多维表格"/"bitable") so docs consistently enforce that `.base`
files are accepted only when `--type bitable` is used.
🪄 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: 63821b7b-8eac-4676-9217-95f1d92cc538
📒 Files selected for processing (9)
shortcuts/drive/drive_export.goshortcuts/drive/drive_export_common.goshortcuts/drive/drive_export_common_test.goshortcuts/drive/drive_export_test.goshortcuts/drive/drive_import.goshortcuts/drive/drive_import_common.goshortcuts/drive/drive_import_common_test.goskills/lark-drive/references/lark-drive-export.mdskills/lark-drive/references/lark-drive-import.md
0ad0b90 to
a94697a
Compare
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)
skills/lark-drive/references/lark-drive-export.md (1)
4-6:⚠️ Potential issue | 🟡 MinorFix markdownlint MD028 (blank line in blockquote).
There is a blank line immediately after the blockquote line, which triggers MD028. Remove the blank line or keep the following paragraph inside the same blockquote.
🧹 Proposed markdown lint fix
> **前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。 - 把 `doc` / `docx` / `sheet` / `bitable` 导出到本地文件。这个 shortcut 内置有限轮询:🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@skills/lark-drive/references/lark-drive-export.md` around lines 4 - 6, The blockquote line starting with "**前置条件:** 先阅读 [`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。" is followed by a blank line which triggers markdownlint MD028; remove that blank line or merge the subsequent paragraph ("把 `doc` / `docx` / `sheet` / `bitable` 导出到本地文件。这个 shortcut 内置有限轮询:") into the same blockquote so the content remains one continuous blockquote (edit the lines around the blockquote marker to eliminate the empty line).
🤖 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 `@skills/lark-drive/references/lark-drive-export.md`:
- Around line 4-6: The blockquote line starting with "**前置条件:** 先阅读
[`../lark-shared/SKILL.md`](../../lark-shared/SKILL.md) 了解认证、全局参数和安全规则。" is
followed by a blank line which triggers markdownlint MD028; remove that blank
line or merge the subsequent paragraph ("把 `doc` / `docx` / `sheet` / `bitable`
导出到本地文件。这个 shortcut 内置有限轮询:") into the same blockquote so the content remains
one continuous blockquote (edit the lines around the blockquote marker to
eliminate the empty line).
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 4b1a9a63-3f2c-43b6-a792-dc9c026cdb23
📒 Files selected for processing (9)
shortcuts/drive/drive_export.goshortcuts/drive/drive_export_common.goshortcuts/drive/drive_export_common_test.goshortcuts/drive/drive_export_test.goshortcuts/drive/drive_import.goshortcuts/drive/drive_import_common.goshortcuts/drive/drive_import_common_test.goskills/lark-drive/references/lark-drive-export.mdskills/lark-drive/references/lark-drive-import.md
✅ Files skipped from review due to trivial changes (2)
- shortcuts/drive/drive_import.go
- shortcuts/drive/drive_export_common_test.go
🚧 Files skipped from review as they are similar to previous changes (5)
- skills/lark-drive/references/lark-drive-import.md
- shortcuts/drive/drive_export_common.go
- shortcuts/drive/drive_export.go
- shortcuts/drive/drive_export_test.go
- shortcuts/drive/drive_import_common_test.go
a94697a to
7bdf03b
Compare
Allow drive +export to request bitable snapshots with --file-extension base and write them with a .base suffix. Allow drive +import to accept .base files for bitable only, enforce the 20 MB size limit, and document the new examples and constraints. Add unit tests for validation and size-limit coverage. Change-Id: Ia13f5013913812df5fc600c43f90918de4ca6b39
7bdf03b to
16c9ed6
Compare
Summary
Add
.baseimport/export support for bitable in the drive shortcuts.This lets users export a bitable snapshot to
.baseand import a.basesnapshot back into bitable with matching validation and docs.Changes
baseas a supported--file-extensionfordrive +exportand restrict it to--doc-type bitable.basefiles indrive +import, enforce the 20 MB size limit, and keep import/export filenames aligned with the.basesuffixTest Plan
go test ./shortcuts/drive)lark xxxcommand works as expectedRelated Issues
Summary by CodeRabbit
New Features
.basesnapshots (Bitable-only) and importing.basefiles as Bitable; CLI flags now acceptbaseand enforce Bitable-only where applicable.Documentation
.base; clarified compatibility and usage flows.Tests
.baseexport/import, validation, filename handling, and size-limit enforcement.