Skip to content

Commit 2eb8452

Browse files
gcampclaude
andcommitted
Initial implementation of image-upload-transit CLI
- Python CLI with 1Password integration for credentials - File validation (size, type) - GCS upload with OAuth2 - CI/CD with GitHub Actions - Homebrew formula for easy installation Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent bc39248 commit 2eb8452

File tree

12 files changed

+646
-0
lines changed

12 files changed

+646
-0
lines changed

.claude/settings.local.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(op vault list:*)",
5+
"Bash(op account list:*)",
6+
"Bash(python3:*)",
7+
"Bash(chmod:*)",
8+
"Bash(terraform init:*)",
9+
"Bash(terraform plan:*)"
10+
]
11+
}
12+
}

.github/workflows/ci.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
lint-and-test:
11+
runs-on: macos-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Set up Python
16+
uses: actions/setup-python@v5
17+
with:
18+
python-version: "3.11"
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install --upgrade pip
23+
pip install ruff pytest
24+
25+
- name: Lint with ruff
26+
run: ruff check image_upload_transit.py
27+
28+
- name: Run tests
29+
run: python -m pytest tests/ -v

.github/workflows/release.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "image_upload_transit.py"
8+
9+
jobs:
10+
check-version:
11+
runs-on: ubuntu-latest
12+
outputs:
13+
should_release: ${{ steps.check.outputs.should_release }}
14+
version: ${{ steps.check.outputs.version }}
15+
steps:
16+
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check for version change
21+
id: check
22+
run: |
23+
VERSION=$(grep -E "^VERSION = " image_upload_transit.py | sed 's/VERSION = "\(.*\)"/\1/')
24+
echo "version=$VERSION" >> $GITHUB_OUTPUT
25+
26+
if git tag | grep -q "^v$VERSION$"; then
27+
echo "should_release=false" >> $GITHUB_OUTPUT
28+
else
29+
echo "should_release=true" >> $GITHUB_OUTPUT
30+
fi
31+
32+
release:
33+
needs: check-version
34+
if: needs.check-version.outputs.should_release == 'true'
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: write
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- name: Create tag
42+
run: |
43+
git config user.name "github-actions[bot]"
44+
git config user.email "github-actions[bot]@users.noreply.github.com"
45+
git tag -a "v${{ needs.check-version.outputs.version }}" -m "Release v${{ needs.check-version.outputs.version }}"
46+
git push origin "v${{ needs.check-version.outputs.version }}"
47+
48+
- name: Create GitHub Release
49+
uses: softprops/action-gh-release@v1
50+
with:
51+
tag_name: v${{ needs.check-version.outputs.version }}
52+
name: v${{ needs.check-version.outputs.version }}
53+
generate_release_notes: true
54+
55+
- name: Update Homebrew formula
56+
run: |
57+
VERSION="${{ needs.check-version.outputs.version }}"
58+
SHA256=$(sha256sum image_upload_transit.py | cut -d' ' -f1)
59+
60+
cat > Formula/image-upload-transit.rb << 'FORMULA_EOF'
61+
class ImageUploadTransit < Formula
62+
desc "CLI tool for uploading images and videos to Transit's CDN"
63+
homepage "https://github.com/TransitApp/image-upload-transit"
64+
url "https://raw.githubusercontent.com/TransitApp/image-upload-transit/v${VERSION}/image_upload_transit.py"
65+
sha256 "${SHA256}"
66+
license "MIT"
67+
68+
depends_on "python@3.11"
69+
depends_on "1password-cli"
70+
71+
def install
72+
bin.install "image_upload_transit.py" => "image-upload-transit"
73+
end
74+
75+
test do
76+
system "#{bin}/image-upload-transit", "--version"
77+
end
78+
end
79+
FORMULA_EOF
80+
81+
# Replace variables
82+
sed -i "s/\${VERSION}/$VERSION/g" Formula/image-upload-transit.rb
83+
sed -i "s/\${SHA256}/$SHA256/g" Formula/image-upload-transit.rb
84+
85+
git config user.name "github-actions[bot]"
86+
git config user.email "github-actions[bot]@users.noreply.github.com"
87+
git add Formula/image-upload-transit.rb
88+
git commit -m "Update formula for v${VERSION}" || true
89+
git push

Formula/image-upload-transit.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
class ImageUploadTransit < Formula
2+
desc "CLI tool for uploading images and videos to Transit's CDN"
3+
homepage "https://github.com/TransitApp/image-upload-transit"
4+
url "https://raw.githubusercontent.com/TransitApp/image-upload-transit/v1.0.0/image_upload_transit.py"
5+
sha256 "PLACEHOLDER"
6+
license "MIT"
7+
8+
depends_on "python@3.11"
9+
depends_on "1password-cli"
10+
11+
def install
12+
bin.install "image_upload_transit.py" => "image-upload-transit"
13+
end
14+
15+
test do
16+
system "#{bin}/image-upload-transit", "--version"
17+
end
18+
end

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Transit Inc.
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# image-upload-transit
2+
3+
CLI tool for uploading images and videos to Transit's CDN.
4+
5+
## Installation
6+
7+
```bash
8+
brew tap transitapp/image-upload-transit https://github.com/TransitApp/image-upload-transit
9+
brew install image-upload-transit
10+
```
11+
12+
## Usage
13+
14+
```bash
15+
# Upload single file
16+
image-upload-transit screenshot.png
17+
18+
# Upload multiple files
19+
image-upload-transit photo1.jpg photo2.png video.mp4
20+
21+
# Upload to staging
22+
image-upload-transit --staging debug-screenshot.png
23+
```
24+
25+
## Supported Formats
26+
27+
**Images (max 25 MB):** jpg, jpeg, png, gif, webp, avif, heic, bmp, tiff, svg
28+
29+
**Videos (max 100 MB):** mp4, mov, webm
30+
31+
## First Run
32+
33+
On first run, you'll need:
34+
35+
1. [1Password CLI](https://developer.1password.com/docs/cli/) installed and signed in
36+
2. Access to the Transit 1Password Shared vault
37+
38+
The tool will fetch credentials from 1Password and cache them locally.
39+
40+
## Development
41+
42+
```bash
43+
# Run tests
44+
python3 -m pytest tests/ -v
45+
46+
# Lint
47+
ruff check image_upload_transit.py
48+
```
8.5 KB
Binary file not shown.

0 commit comments

Comments
 (0)