Skip to content

Add upload command for file attachments#6

Open
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1762547587-upload-command
Open

Add upload command for file attachments#6
devin-ai-integration[bot] wants to merge 1 commit intomainfrom
devin/1762547587-upload-command

Conversation

@devin-ai-integration
Copy link

Add upload command for file attachments

Summary

Implements a new upload CLI command that allows users to upload files to Devin sessions via the attachments API endpoint (POST https://api.devin.ai/v1/attachments). The command uploads a file and returns the attachment URL that can be used in session prompts with the ATTACHMENT:"<url>" format.

Changes:

  • Added upload_file() helper function for API interaction (60s timeout for uploads)
  • Added upload CLI command with --output (json/table) and --format-prompt flags
  • Added 5 comprehensive tests covering success and error cases (41 total tests pass)
  • Updated README.md with usage examples and documentation

Verification:

  • ✅ All 41 automated tests pass (including 5 new upload tests)
  • ✅ Manually tested with real API using multiple file types (text, JSON, CSV, Python)
  • ✅ Tested both output formats and --format-prompt flag
  • ✅ Error handling verified (file not found, API errors)

Review & Testing Checklist for Human

This is a low-risk change that follows existing CLI patterns, but requires end-to-end verification:

  • End-to-end test: Upload a file using devin-cli upload <file>, then create a Devin session using the returned URL with ATTACHMENT:"<url>" format to verify Devin can actually access and use the uploaded file
  • Large file testing: Test uploading larger files (e.g., images, PDFs) to verify the 60-second timeout is sufficient and there are no size limit issues
  • Edge case testing: Try uploading files with special characters in names, or test permission/locked file scenarios to ensure error messages are helpful

Notes

  • The implementation follows the same patterns as existing commands (create, get, message)
  • No new dependencies added (uses existing click and requests)
  • The API returns URLs in quoted format (e.g., "https://..."), which is automatically stripped
  • Files are opened in binary mode as required by the multipart/form-data upload

Devin Session: https://app.devin.ai/sessions/91d7514b99244be9a28804450a01cf51
Requested by: @parkerduff (parker.duff@codeium.com)

- Add upload_file() helper function for POST to /v1/attachments
- Add upload CLI command with --output and --format-prompt flags
- Support json and table output formats
- Display ATTACHMENT: format instructions for users
- Add comprehensive tests for upload functionality
- Update README with upload command documentation and examples
- Handle file not found, network errors, and API failures
- Tested with multiple file types (text, JSON, Python, CSV)
- All 41 tests pass including 5 new upload tests

Co-Authored-By: parker.duff@codeium.com <pwjduff@gmail.com>
@devin-ai-integration
Copy link
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants

Comments