Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [14, 16, 18, 20]
node-version: [18, 20, 22, 24]

steps:
- uses: actions/checkout@v3
Expand All @@ -28,13 +28,17 @@ jobs:
run: npm ci

- name: Run linter
run: npm run lint
run: npm run check

- name: Run tests
run: npm test

- name: Collect native CLI coverage
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '24'
run: mkdir -p coverage && node --experimental-test-coverage --test --test-reporter=lcov --test-reporter-destination=coverage/lcov.info test/cli.test.js

- name: Upload coverage
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '18'
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '24'
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
Expand Down Expand Up @@ -72,3 +76,4 @@ jobs:
body_path: CHANGELOG.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

24 changes: 24 additions & 0 deletions .github/workflows/raycast.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Raycast extension
on:
push:
paths: ["raycast/**", ".github/workflows/raycast.yml"]
pull_request:
paths: ["raycast/**", ".github/workflows/raycast.yml"]
jobs:
check:
runs-on: macos-latest
defaults:
run:
working-directory: raycast
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
cache: npm
cache-dependency-path: raycast/package-lock.json
- run: npm ci
- run: npm test
- run: npm run typecheck
- run: npm run lint
- run: npm run build
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ This writes `.quick-share.json` and adds a short Quick Share section to that pro

## Important Boundaries

- Read-only: no upload, delete, move, or overwrite command exists.
- The asset-discovery CLI is read-only: it does not upload, delete, move or overwrite objects. The optional Raycast extension separately uploads a file explicitly chosen by its user to that user's configured public R2 bucket. It uses bucket-scoped preferences, unique object keys and no fallback to shell credentials.
- Public-first: treat returned URLs as public.
- Not authentication: do not use this for private client assets without adding signed URLs or auth.
- Durability depends on the R2 object and public asset domain staying available.
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,7 @@ npm run check
### Local shell uploader (macOS)

Run `./upload-file.sh` to choose a file, or `./upload-file.sh "path/to/file.pdf"` to upload directly. Cancelling exits without uploading. Uses `~/.r2-config`, created by `./setup-r2.sh`. Uploads are public; matching filenames are replaced.

## Raycast Extension

The macOS extension in [raycast/](raycast/) adds **Upload File** and **Recent Uploads**. Each user supplies their own R2 bucket and credentials in Raycast preferences. It uses rclone, gives each upload a unique public URL, and copies the link. See [installation and development](raycast/README.md). The CLI and Worker API remain read-only.
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"preview": "./scripts/preview-library.sh",
"quick-share": "node bin/quick-share.js",
"agent": "node bin/quick-share.js",
"install-project": "./scripts/install-project.sh"
"install-project": "./scripts/install-project.sh",
"test": "node --test test/cli.test.js"
},
"engines": {
"node": ">=18"
}
}
3 changes: 3 additions & 0 deletions raycast/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
raycast-env.d.ts
66 changes: 66 additions & 0 deletions raycast/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Quick Share for Raycast

Choose a file in Raycast, upload it to Cloudflare R2, and copy a public link. Each user configures their own Cloudflare R2 account in Raycast. No shared storage, embedded credentials, or fallback to the shell uploader's configuration.

## Install locally

Requires macOS, Raycast, Node **22.22.2 or newer**, and rclone (`brew install rclone`).

From the repository root:

```sh
cd raycast
npm ci
npm run dev
```

Raycast registers **Upload File** and **Recent Uploads**. Search for **Upload File**, choose a file, then press **Command–Return**. The public link is copied and the result offers copy/open actions. Use Recent Uploads to find earlier links. The development watcher can be stopped after registration; rerun it when editing the extension.

## Set up your own Cloudflare storage

1. Sign into **your own** Cloudflare account and create an R2 bucket.
2. Create an R2 S3 token with **Object Read & Write**, scoped to **that bucket only**. Copy its Access Key ID, Secret Access Key, and S3 endpoint.
3. In your bucket's Settings, connect your own public custom domain, or enable its Public Development URL for testing. Cloudflare recommends a custom domain for production sharing.
4. Open Upload File in Raycast. First launch requires your bucket name, S3 endpoint, access key, secret key, and public bucket URL in extension preferences. The two credential fields use Raycast password preferences.
5. Upload a harmless test file and open its link to check the public domain matches your bucket.

Uploads go directly from your Mac to the configured endpoint and bucket. Storage usage belongs to that Cloudflare account. There is no developer-hosted upload service, bundled account, or default public URL. The extension never reads `~/.r2-config` or imports credentials from shell/rclone configuration. Missing preferences block uploads; there is no fallback.

Credentials are supplied locally by each user and passed to rclone through environment variables. They are not written to upload history, source control, or command arguments. The optional rclone executable preference supports nonstandard installations.

Cloudflare setup references: [bucket-scoped S3 credentials](https://developers.cloudflare.com/r2/get-started/s3/) and [public bucket configuration](https://developers.cloudflare.com/r2/buckets/public-buckets/).

## Behaviour

- One regular file per upload, with no file-type restriction.
- Files upload under `raycast/<uuid>/<original filename>`. Matching names do not overwrite earlier uploads.
- Public URL path segments are encoded for spaces, Unicode, and punctuation.
- The progress toast reports upload success or failure. A clipboard/history failure leaves the completed upload's link visible.
- Uploads are public to anyone who has the link. They remain available while the R2 object and public domain exist. There is no automatic expiry.
- Recent Uploads stores the latest 100 links locally in Raycast. It does not list the entire bucket or import shell uploads. Clearing history does not remove uploaded files.
- Large files are streamed by rclone rather than buffered in the extension. Upload timeout is 30 minutes. Closing Raycast during an upload is not a promised cancellation mechanism.
- A public R2 base URL is required. The extension does not configure bucket visibility or deploy the read-only Worker.

## Checks

```sh
npm test
npm run typecheck
npm run lint
npm run build
```

Tests cover required user configuration with no shared defaults, unique keys, URL encoding, file validation, safe argument handling, environment-based credentials, and redacted upload failures. The underlying uploader was verified with a real R2 upload and public content readback before this onboarding change. The new per-user configuration flow is covered with an isolated mock upload; no credentials are pre-filled in the local installation. Raycast command registration and the native upload form were checked in the installed app.

## Research and publishing

This is a native React/TypeScript extension, using Raycast's FilePicker, clipboard, preferences, and LocalStorage APIs:

- [Getting started](https://developers.raycast.com/basics/getting-started)
- [Forms and file picker](https://developers.raycast.com/api-reference/user-interface/form)
- [Extension manifest](https://developers.raycast.com/information/manifest)
- [Preferences](https://developers.raycast.com/api-reference/preferences)
- [Clipboard](https://developers.raycast.com/api-reference/clipboard)
- [Local storage](https://developers.raycast.com/api-reference/storage)

It is installed locally for development, not published to the Raycast Store. Store submission would be a separate step through Raycast's official extension repository, with screenshots and submission review. The manifest author matches Jack's verified Raycast profile, `jack_schofield`.
Binary file added raycast/assets/extension-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions raycast/eslint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const raycast = require("@raycast/eslint-config");
module.exports = [...raycast];
Loading
Loading