Let’s add the option to add the vercel connector to workspaces

ready…
osebo30d ago

Let’s add the option to add the vercel connector to workspaces

2 repliesoldestnewest
Osebotfable-5-130d ago

There is already a Vercel connector implementation on PR #47 (branch thread/e88cfacf, opened 3 Oct, never merged): connectors table + repos.deploy, lib/connectors/{index,vercel,deploy}.ts, owner routes POST/DELETE /api/workspaces/[id]/connectors, POST …/deploy (members), the runner deploy tool, and a Connectors card + "Deploy to Vercel" per repo on the manage page.

That branch is ~3 weeks behind main (slug URLs, photo, theme, migrations 0005–0013, BYOK keys, runner usage reporting, new workspace page layout), so I won't merge it as-is. Plan:

  1. Port the three commits from PR #47 onto this branch by hand: migration becomes drizzle/0014_connectors.sql, schema/data/launch/runner/context changes re-applied against today's files.
  2. Encrypt the pasted Vercel token at rest with lib/crypto.ts (the BYOK sealing added since then) instead of storing it plaintext as #47 did.
  3. Wire the Connectors card into the current /workspaces/[id] manage page (owner: paste token + optional team, verify via Vercel API; members: see "connected as", per-repo Deploy / redeploy with project + last deployment link).
  4. npx tsc + a static mockup screenshot of the card; then I'll suggest closing #47 in favour of this PR.
Osebotfable-5-130d agothreadide@c435008

Done on thread/c56c85fb (threadide @ c435008, three commits). This is PR #47's Vercel connector ported onto today's main; #47 can be closed once this merges.

What you get

  • /workspaces/<id> → new Connectors card (members): owners paste a Vercel access token (+ optional team slug), the server verifies it against /v2/user + /v2/teams, shows "Vercel as Acme (team), connected by osebo", two-tap disconnect.
  • Every repo row gets Deploy to Vercel (members): first click reuses-or-creates a Vercel project linked to the GitHub repo and triggers a production deployment; afterwards the row shows ▲ project, "last deploy" (inspector link) and "redeploy".
  • Osebot: sandbox env VERCEL_TOKEN / VERCEL_ORG_ID / VERCEL_TEAM_ID / VERCEL_SCOPE, a deploy(repo_alias, ref?) tool registered only when the workspace has the connector, and a <connectors> block in the prompt, so "deploy this" works from a thread.

Different from #47: the token is sealed at rest with lib/crypto.ts (AES-GCM under CREDENTIALS_SECRET ?? AUTH_SECRET, byte-identical to the BYOK branch's helper so they merge cleanly) and only opened server-side; the card is members-only (open-workspace visitors of the manage page don't see it).

Caveats: the repo's GitHub org needs the Vercel GitHub App installed or project creation fails (Vercel's message shows in the row); this is a pasted token, not Vercel OAuth. tsc is clean; the Vercel calls were not exercised against a live token in the sandbox, so the first real connect is the integration test. Migration 0014_connectors is additive and runs on the production build.

Manage page mockup at 900px: Repos rows with the Vercel project link / redeploy and the first-deploy pill, Connectors card connected and empty (owner form)
Manage page mockup at 900px: Repos rows with the Vercel project link / redeploy and the first-deploy pill, Connectors card connected and empty (owner form)
Same mockup at 390px: alias column shrinks, branch hidden, deploy control wraps under the repo name, connect form stacks
Same mockup at 390px: alias column shrinks, branch hidden, deploy control wraps under the repo name, connect form stacks