Skip to main content
← Back to list
01Issue
FeatureOpenSwamp CLI
AssigneesNone

Relationships

#1376 CLI: swamp invite <email> to drive the platform-invite API

Opened by keeb · 7/24/2026

Problem

swamp-club now exposes an authenticated endpoint to invite someone to the platform: POST /api/v1/invites (session cookie or personal API key). An operative who invites someone whose recruit later reaches Tier 5 earns 200,000 points and the First Rule badge. Today the only way to call it is a hand-rolled curl with a bearer token — there's no first-class CLI affordance, so the feature is effectively invisible to CLI-first operatives.

The CLI already holds the operative's swamp-club auth (OAuth device session / personal API key), so it's positioned to drive this endpoint directly.

Proposed solution

Add a command — swamp invite <email> — that POSTs to /api/v1/invites using the operative's existing credential and reports the result.

Endpoint contract (already live in swamp-club, routes/api/v1/invites/index.ts):

  • POST {origin}/api/v1/invites, body {"email": "<addr>"}
  • Auth: Authorization: Bearer swamp_* / x-api-key (the credential the CLI already presents to swamp-club)
  • Responses:
    • 200 {"ok": true}uniform for created / already-invited no-op / stale-resend / already-an-operative. This is deliberate anti-enumeration: the endpoint never reveals whether the address is new, already invited, or already a member. The CLI must not claim to know which happened.
    • 400 {"error": "..."} — malformed email / missing body
    • 429 {"error": "..."} — the inviter's pending-invite cap (20) is reached
    • 401 {"error": "Unauthorized"} — not authenticated → the CLI should nudge swamp auth login

UX / messaging:

  • On 200, print something anti-enumeration-safe, e.g. Invited <email> to the swamp. — never "new user created" vs "already a member".
  • Because the reward is deferred (200k + First Rule badge land only once the recruit accepts and reaches Tier 5), the CLI should NOT imply an immediate reward. A one-line hint is fine: "You'll earn the First Rule badge if they reach Tier 5."
  • Surface 429 as a friendly cap message and 401 as a login prompt.

Exit codes: 0 on 200; non-zero on 4xx, with the server's error string printed.

Alternatives considered

  • Leave it to manual curl — works, but undiscoverable and easy to get the auth header wrong.
  • Web-only — the invite form/flow lives on swamp-club; but CLI-first operatives (the ones most likely to farm the reward legitimately) never see it.

Notes

  • Code for the endpoint is in swamp-club (routes/api/v1/invites/index.ts, lib/app/invite-to-platform.ts); this issue is only about the swamp CLI client (~/git/swamp).
  • The origin should follow whatever base URL the CLI already uses for swamp-club API calls (e.g. whoami), not a new hardcoded host.
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED

Open

7/24/2026, 12:45:26 AM

No activity in this phase yet.

03Sludge Pulse

Sign in to post a ripple.