I'd love to be able to create a new repo from here
Create new repo
merged…
Osebotfable-5-150d ago
Plan: let a workspace owner create a brand-new GitHub repo from the workspace page and have it attached to the workspace in one step.
- API
POST /api/github/repos— body{ name, private?, description?, workspaceId?, alias? }. Creates the repo with the requester's GitHub OAuth token (the existingreposcope already allows this) viaPOST /user/repos, orPOST /orgs/:org/reposwhennameisorg/name. Alwaysauto_init: true— the launcher doesgit checkout -b thread/… origin/<defaultBranch>, so an empty repo would crash every run. IfworkspaceIdis given it checks owner membership before calling GitHub, thenaddRepo()s with the realdefault_branchfrom the response. Surfaces GitHub's own error message (e.g. "name already exists"). - UI — new
components/create-github-repo.tsx: a "create a new GitHub repo" link next to "browse your GitHub repos" in the Repos card (owner only) that expands into name / description / private checkbox / alias. Submits, thenrouter.refresh(). - Token lookup gets a small shared helper so
GETandPOST /api/github/reposdon't each duplicate the accounts query. - Typecheck, static mockup screenshot, push, open PR.
Osebotfable-5-150d ago
threadide@405c7ecDone — PR #46, branch thread/67ef89c5.
How it works
On a workspace page you own, the Repos card now has "create a new GitHub repo" next to "browse your GitHub repos". It expands into name / description / private (default on) / alias. Submit → the repo is created on GitHub under your account and attached to the workspace in one go; the page refreshes with it in the list. Type org/name to create under an org instead (the osebo/ prefix in the field disappears when you do).
Behind it
POST /api/github/repos{ name, description?, private?, workspaceId?, alias? }— uses the requester's GitHub OAuth token (the existingreposcope already allows repo creation, no re-auth needed).GETon the same route (the picker) now shares auserGithubToken()helper inlib/data.tsthat also refreshes expiring GitHub App tokens likeownerGithubdoes.- Always
auto_init: true— this is the important bit.lib/agent/launch.tsrunsgit checkout -b thread/… origin/<defaultBranch>; on an empty repo that fails and every run would die with "crashed before finishing". The README commit gives Claude amainto branch from. The storeddefaultBranchcomes from GitHub's response, not assumed. - Owner membership is checked before calling GitHub, so a 403 can't leave an orphan repo. GitHub's own error text is surfaced in the form (e.g. "GitHub: name already exists on this account", returned as 409).
- Files:
app/api/github/repos/route.ts,components/create-github-repo.tsx(new),app/workspaces/[id]/page.tsx,lib/data.ts,app/globals.css(.repo-sources,form.repo-create*), README.
Caveats
- Not exercised against GitHub for real — doing so from the sandbox would create repos on your account. The call is a plain
POST /user/repos/POST /orgs/:org/repos; worth one try after merge (a throwaway private repo, then delete it on GitHub). Org creation needs you to have create-repo permission in that org; otherwise GitHub returns 404/403 and the form shows it. - Not on the
/workspacescreate-workspace form (that's a plain URL textarea). Flow is: create workspace → open it → create repo. Easy follow-up if wanted. - Screenshot is a static mockup against the real stylesheet (app can't run in the sandbox). Noticed while shooting, pre-existing and untouched: long aliases like
threadide/wrap in.repo-row's 90px column, and the old "Add repo" URL row gets squeezed at 390px.
tsc --noEmit clean.
Pull requests:threadide #46
