Skip to content

feat: hosted relay core (cloud mode, sub-project #1)#2

Merged
PengSpirit merged 5 commits into
mainfrom
feat/hosted-relay
Jun 21, 2026
Merged

feat: hosted relay core (cloud mode, sub-project #1)#2
PengSpirit merged 5 commits into
mainfrom
feat/hosted-relay

Conversation

@PengSpirit

Copy link
Copy Markdown
Member

What

Adds an open-core cloud mode so one account's Claude Code sessions sync messages in real time across machines. Local JSONL mode is unchanged (MIT/free); cloud activates after cc-bridge login.

This is sub-project #1 of 3 toward selling cc-bridge as a hosted relay SaaS. Billing (#2) and the /b distribution command (#3) follow as their own PRs.

How

The CLI already routed all storage through sendMessage() / listen(). This adds cloud equivalents behind a backend resolver — no custom server:

  • send → INSERT a row into Supabase messages
  • listen → subscribe to postgres_changes (replay + ULID dedupe)
  • auth → Supabase email OTP; user JWT + RLS (owner = auth.uid()) for isolation

Changes

  • New deps: @supabase/supabase-js (only)
  • New lib: config, credentials (0600 storage adapter), supabase client, message-row mapping, send-remote, async-queue, listen-remote, backend resolver, auth
  • CLI: login / logout / whoami commands + --local flag on send/listen
  • Migration: supabase/migrations/20260621000000_messages.sql (table + RLS + realtime)
  • Spec + plan under docs/superpowers/

Verification

  • typecheck + lint + build clean
  • 95 tests pass, 1 live smoke test env-gated (CC_BRIDGE_SMOKE=1)

Not in this PR (go-live, manual)

  1. Run the migration in the cc-bridge Supabase project
  2. Auth → Email Templates → Magic Link → add {{ .Token }}
  3. npm linkcc-bridge login → cross-machine round-trip

🤖 Generated with Claude Code

PengSpirit and others added 5 commits June 21, 2026 09:03
Supabase open-core: cross-machine real-time relay behind auth+RLS.
Decomposes the "sell cc-bridge" goal into 3 sub-projects; this spec
covers #1 (relay core). Billing (#2) and /b distribution (#3) deferred.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…bridge)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…nd/listen

Tasks 1-11 of the relay-core plan. New: config, credentials storage,
supabase client, message<->row mapping, sendRemote, async-queue,
listenRemote (subscribe+replay+dedupe), backend resolver, OTP auth lib,
CLI login/logout/whoami + --local routing, migration SQL, tests.
Local JSONL mode unchanged. 95 unit/integration tests pass; live smoke
env-gated. Pending: run migration in cc-bridge Supabase + cross-machine login test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@PengSpirit PengSpirit merged commit 3213661 into main Jun 21, 2026
1 of 4 checks passed
@PengSpirit PengSpirit deleted the feat/hosted-relay branch June 21, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant