feat: POST /api/sandboxes/files - file upload endpoint

Merged
RE
7mo ago
+307-0

Summary

  • Implements POST /api/sandboxes/files endpoint for uploading files to GitHub org submodules
  • Accepts multipart form data with target path and files
  • Auth via validateAuthContext, resolves sandbox repo from account snapshot
  • Commits files via GitHub Contents API with submodule path resolution
  • Zod validation for request body

Related

  • Paperclip: REC-31 (API sub-issue of REC-29)

Test plan

  • Upload single file to sandbox repo
  • Upload multiple files
  • Verify submodule path resolution
  • Auth validation (unauthorized requests rejected)
  • Invalid path handling

Summary by CodeRabbit

  • New Features
    • Added authenticated API endpoint for uploading files to sandboxes, supporting multipart form submissions with optional custom paths and commit messages
    • Implemented CORS preflight request handling for browser compatibility
    • Integrated GitHub repository file creation and update operations
    • Included comprehensive request validation and error handling with partial upload support