feat(task): add upload task attachment shortcut#736
Conversation
Change-Id: I668bf3d856baa6e35ed982a33c4bf4d03b924f4b
|
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 (2)
📝 WalkthroughWalkthroughAdds a new CLI shortcut ChangesUpload attachment shortcut
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant FS as File System
participant Builder as Request Builder
participant HTTP as HTTP Client
participant API as Task API
participant Handler as Response Handler
User->>CLI: task +upload-attachment --resource-id=ID --file=path
CLI->>CLI: validate inputs (exists, regular file, ≤50MB)
CLI->>FS: open/read file stream
FS-->>CLI: file stream
CLI->>Builder: build multipart (resource_type, resource_id, file with real filename)
Builder-->>CLI: multipart request
CLI->>HTTP: POST /open-apis/task/v2/attachments/upload (stream)
HTTP->>API: deliver multipart payload
API-->>HTTP: JSON response
HTTP-->>CLI: response bytes
CLI->>Handler: parse and handle API result
Handler-->>CLI: attachment record (guid, name, size)
CLI-->>User: success summary (resource, file name, size, guid)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 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 unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@skills/lark-task/references/lark-task-upload-attachment.md`:
- Around line 48-52: Remove the empty blank line between the two blockquote
sections so the blockquotes using "[!CAUTION]" and "[!NOTE]" are consecutive
lines without an intervening blank line; specifically edit the block containing
"> [!CAUTION] ... " and "> [!NOTE] ..." to delete the blank line that triggers
markdownlint MD028 (no-blanks-blockquote) so both blockquotes are back-to-back.
🪄 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: 43ff6aba-e52a-4dd7-b9cf-30c664dab4b9
📒 Files selected for processing (6)
shortcuts/task/shortcuts.goshortcuts/task/task_upload_attachment.goshortcuts/task/task_upload_attachment_test.goskills/lark-task/SKILL.mdskills/lark-task/references/lark-task-upload-attachment.mdtests/cli_e2e/task/task_upload_attachment_dryrun_test.go
Change-Id: I3ef1aba33ee22e8b03e6f59bc2fb64f55a742270
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #736 +/- ##
==========================================
+ Coverage 64.57% 64.98% +0.41%
==========================================
Files 516 503 -13
Lines 45749 46357 +608
==========================================
+ Hits 29541 30125 +584
+ Misses 13623 13605 -18
- Partials 2585 2627 +42 ☔ 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@a944e97f566b97c173558b19b164749965b628b2🧩 Skill updatenpx skills add bytedance-zxy/cli#feat-task-attachment -y -g |
* feat(task): add upload task attachment shortcut Change-Id: I668bf3d856baa6e35ed982a33c4bf4d03b924f4b * feat(task): update SKILL.md adding resource_type description Change-Id: I3ef1aba33ee22e8b03e6f59bc2fb64f55a742270
* feat(task): add upload task attachment shortcut Change-Id: I668bf3d856baa6e35ed982a33c4bf4d03b924f4b * feat(task): update SKILL.md adding resource_type description Change-Id: I3ef1aba33ee22e8b03e6f59bc2fb64f55a742270
Summary
Adds a new task +upload-attachment shortcut that uploads a single local file as an attachment to a task (or other resource type supported by the Task attachment endpoint), wrapping the POST /open-apis/task/v2/attachments/upload multipart API.
Motivation
The Task service exposes an attachment upload endpoint that was not yet reachable via the CLI, forcing agents and users to hand-craft multipart requests. Adding it as a first-class shortcut lets AI agents and humans attach files to tasks through the same structured pipeline used by other Task shortcuts.
Changes
Summary by CodeRabbit
New Features
Documentation
Tests