feat(cli): add issues files upload/download commands

Closes #135 (closed)

Summary

  • Add pgai issues files upload <path> — uploads a file to Storage API, returns URL and ready-to-paste markdown link
  • Add pgai issues files download <url> [-o <output>] — downloads a file from storage
  • New cli/lib/storage.ts — Storage API client (uploadFile, downloadFile, buildMarkdownLink)
  • Add --storage-base-url global option and PGAI_STORAGE_BASE_URL env var (default: https://postgres.ai/storage)

Usage

# Upload a screenshot and get markdown to paste into issue
pgai issues files upload ./screenshot.png
# → URL: https://postgres.ai/storage/files/123/xxx.png
# → Markdown: ![screenshot.png](https://postgres.ai/storage/files/123/xxx.png)

# Download a file
pgai issues files download /files/123/xxx.png -o ./downloaded.png

Test plan

  • 25 unit tests for lib/storage.ts (buildMarkdownLink, uploadFile, downloadFile)
  • 8 CLI integration tests with fake storage server (upload/download end-to-end, auth checks, help text)
  • All 540 existing tests still pass
  • No new type errors in source files
Edited by Bogdan Tsechoev

Merge request reports

Loading