feat(drive): add drive preview and cover shortcuts and document quota details#1254
feat(drive): add drive preview and cover shortcuts and document quota details#1254zhoujunteng-max wants to merge 2 commits into
Conversation
📝 WalkthroughWalkthroughThis PR introduces two new Drive CLI shortcuts— ChangesDrive Preview and Cover Shortcuts
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 docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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: 2
🤖 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_preview_common.go`:
- Around line 304-311: When matching aliases (using previewAliasesForCandidate)
against requested, don't return the first match blindly; collect all
drivePreviewCandidate matches and if any match is downloadable (e.g.,
candidate.Downloadable or candidate.IsDownloadable), return a downloadable
candidate first, otherwise return the first matched candidate; update the loop
over candidates/requested to gather matches and prefer a downloadable
drivePreviewCandidate before falling back to the first match.
In `@tests/cli_e2e/drive/drive_preview_workflow_test.go`:
- Around line 136-139: The retry predicate currently only inspects result.Stderr
for transient 404/no-artifact signals; update the predicate to concatenate
result.Stdout and result.Stderr (e.g., combined := result.Stdout +
result.Stderr) and run the existing checks against that combined string (use
strings.Contains(combined, ...) and strings.Contains(strings.ToLower(combined),
"no artifact")). Modify the three occurrences that call
strings.Contains(result.Stderr, ...) to use the combined variable so transient
errors surfaced in stdout are also caught for retries.
🪄 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: 733352de-f5fd-49c5-95e5-20a40b2445ed
📒 Files selected for processing (11)
shortcuts/drive/drive_cover.goshortcuts/drive/drive_preview.goshortcuts/drive/drive_preview_common.goshortcuts/drive/drive_preview_test.goshortcuts/drive/shortcuts.goshortcuts/drive/shortcuts_test.goskills/lark-drive/SKILL.mdskills/lark-drive/references/lark-drive-cover.mdskills/lark-drive/references/lark-drive-preview.mdtests/cli_e2e/drive/drive_preview_dryrun_test.gotests/cli_e2e/drive/drive_preview_workflow_test.go
fa89798 to
ae9df5a
Compare
🚀 PR Preview Install Guide🧰 CLI updatenpm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@9090fe9065f24d16bcafa91a784b606bd3126e0f🧩 Skill updatenpx skills add larksuite/cli#feat/drive-preview-cover-and-quota -y -g |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1254 +/- ##
==========================================
- Coverage 69.90% 69.70% -0.21%
==========================================
Files 645 669 +24
Lines 60233 64900 +4667
==========================================
+ Hits 42108 45239 +3131
- Misses 14823 16011 +1188
- Partials 3302 3650 +348 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
98291c1 to
c525b50
Compare
- add `drive +preview` and `drive +cover` shortcuts - wrap `preview_result` output with stable preview item fields - support cover download via `preview_download` with validated preset mappings - update lark-drive skill references for preview and cover usage
c525b50 to
9090fe9
Compare
Summary
This PR adds
drive +previewanddrive +covershortcuts for Drive file preview artifact and cover downloads, and updates thelark-driveskill metadata to expose quota detail capability and the new shortcuts to AI agents.Changes
drive +previewto list and download available preview artifactsdrive +coverto list and download built-in cover presetsskills/lark-drive/SKILL.mdand add preview/cover referencesquota_details.getinskills/lark-drive/SKILL.mdTest Plan
lark-cli drive +previewandlark-cli drive +covercommands work as expectedAdditional verification:
make unit-testgo test ./shortcuts/drive -run 'TestDrivePreview|TestDriveCover|TestShortcutsIncludesExpectedCommands'go test ./tests/cli_e2e/drive -run 'TestDrive(Preview|Cover)DryRun'go test ./tests/cli_e2e/drive -run 'TestDrive_PreviewAndCoverWorkflow'Related Issues
Summary by CodeRabbit
Release Notes
New Features
drive +previewshortcut for listing and downloading Drive preview artifacts in multiple formats (PDF, text, HTML).drive +covershortcut for listing and downloading stable Drive cover presets.quota_detailsAPI resource for retrieving user capacity and quota information.Documentation