feat(cli): add file upload/download commands for issues
Description
Add CLI commands to upload and download files/images via the Storage API, so users can attach them to issues (e.g. paste markdown links into issue descriptions or comments).
New commands
-
pgai issues files upload <path>— upload a file, get URL and markdown link -
pgai issues files download <url> [-o <output>]— download a file from storage
Storage API
-
POST /upload(multipart/form-data) — upload -
GET /files/:orgId/:filename— download - Auth:
access-tokenheader (same API token as other commands) - Default base URL:
https://postgres.ai/storage(configurable via--storage-base-urlorPGAI_STORAGE_BASE_URL)
Acceptance criteria
-
pgai issues files upload ./screenshot.pnguploads and prints URL + markdown -
pgai issues files download /files/123/xxx.png -o ./out.pngdownloads the file -
--debugand--jsonflags work on upload - Unit and integration tests cover the new functionality
Definition of Done
- Upload and download commands merged and released in a new CLI version
-
pgai issues files uploadreturns a valid URL and markdown-formatted link -
pgai issues files downloadcorrectly saves files to the specified output path -
--debugand--jsonflags produce expected output for upload operations - Unit and integration tests pass in CI
- Storage API base URL is configurable via
--storage-base-urlorPGAI_STORAGE_BASE_URLenvironment variable
Edited by Nikolay Samokhvalov