feat(task): add upload task attachment shortcut#736
feat(task): add upload task attachment shortcut#736bytedance-zxy wants to merge 1 commit intolarksuite:mainfrom
Conversation
Change-Id: I668bf3d856baa6e35ed982a33c4bf4d03b924f4b
📝 WalkthroughWalkthroughA new CLI shortcut Changes
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant FileSystem as File System
participant RequestBuilder as Request Builder
participant HTTPClient as HTTP Client
participant API as Task API
participant ResponseHandler as Response Handler
User->>CLI: task +upload-attachment --resource-id=ID --file=path
CLI->>CLI: Validate inputs (size ≤ 50MB, file exists)
CLI->>FileSystem: Read file
FileSystem-->>CLI: File bytes
CLI->>RequestBuilder: Build multipart form data
RequestBuilder->>RequestBuilder: Add resource_type, resource_id, file
RequestBuilder-->>CLI: Multipart request
CLI->>HTTPClient: POST /open-apis/task/v2/attachments/upload
HTTPClient->>API: Stream multipart payload
API-->>HTTPClient: JSON response {data: {items: [...]}}
HTTPClient-->>CLI: Response bytes
CLI->>ResponseHandler: Handle API result
ResponseHandler-->>CLI: Parsed attachment record
CLI-->>User: Success message with attachment GUID, name, size
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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.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
| > [!CAUTION] | ||
| > This is a **Write Operation** -- You must confirm the user's intent before executing. | ||
|
|
||
| > [!NOTE] | ||
| > The Task attachment upload endpoint accepts exactly one file per call. To upload multiple files, invoke the shortcut once per file. |
There was a problem hiding this comment.
Fix markdownlint MD028 in adjacent blockquotes.
There is a blank line between blockquote sections that triggers no-blanks-blockquote and may break docs lint checks.
✏️ Proposed fix
> [!CAUTION]
> This is a **Write Operation** -- You must confirm the user's intent before executing.
-
> [!NOTE]
> The Task attachment upload endpoint accepts exactly one file per call. To upload multiple files, invoke the shortcut once per file.📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| > [!CAUTION] | |
| > This is a **Write Operation** -- You must confirm the user's intent before executing. | |
| > [!NOTE] | |
| > The Task attachment upload endpoint accepts exactly one file per call. To upload multiple files, invoke the shortcut once per file. | |
| > [!CAUTION] | |
| > This is a **Write Operation** -- You must confirm the user's intent before executing. | |
| > [!NOTE] | |
| > The Task attachment upload endpoint accepts exactly one file per call. To upload multiple files, invoke the shortcut once per file. |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)
[warning] 50-50: Blank line inside blockquote
(MD028, no-blanks-blockquote)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@skills/lark-task/references/lark-task-upload-attachment.md` around lines 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.
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