Context
Corrected again 2026-07-21 — the previous version of this issue was still wrong. It specced creating the repo with JSONbored's own OAuth token, which would put every APR repo under JSONbored/<repo-name> regardless of who actually submitted the idea. That's not the intended behavior: an APR repo must be created under the submitting customer's own GitHub account (e.g. joesmoe/<repo-name> for a customer logged in as joesmoe), using their OAuth authorization, not the operator's.
Requirements
Add a function that creates a new GitHub repository owned by the submitting customer, using this codebase's existing multi-user OAuth session infrastructure in src/auth/github-oauth.ts — do not build a new auth flow, and do not use any single fixed account's token:
- The OAuth flow the customer completes before idea submission (per the ratified first-run flow: sign-in gates submission) must request
repo scope in addition to read:user — add this as a parameter/variant of the existing flow functions, do not duplicate them.
- Use
getLiveSessionGitHubToken(env, sessionId) (src/auth/github-oauth.ts:285) with that specific customer's own session ID — never a fixed/operator session — to obtain a live token for the repo-creation call.
- Call GitHub's "Create a repository for the authenticated user" endpoint (
POST /user/repos) with that customer-specific token, returning the created repo's full name (which will be <their-login>/<repo-name>), URL, and node ID.
⚠️ Do not create a GitHub App, an org, an installation-token-based driver, or use any single hardcoded account/session for repo creation. The whole point is that each customer's OAuth grant produces a repo under their own account. A PR that creates repos under a fixed operator account does NOT satisfy this issue.
Deliverables
Test Coverage Requirements
src/auth/github-oauth.ts and any new file under src/** — standard 99%+ Codecov patch target, both branches of the scope-selection logic.
Expected Outcome
A tested, reusable way to create a repo directly under whichever real customer authorized it, using the existing per-session OAuth token system — no fixed account, no org, no installation-token driver.
Links & Resources
Context
Corrected again 2026-07-21 — the previous version of this issue was still wrong. It specced creating the repo with JSONbored's own OAuth token, which would put every APR repo under
JSONbored/<repo-name>regardless of who actually submitted the idea. That's not the intended behavior: an APR repo must be created under the submitting customer's own GitHub account (e.g.joesmoe/<repo-name>for a customer logged in asjoesmoe), using their OAuth authorization, not the operator's.Requirements
Add a function that creates a new GitHub repository owned by the submitting customer, using this codebase's existing multi-user OAuth session infrastructure in
src/auth/github-oauth.ts— do not build a new auth flow, and do not use any single fixed account's token:reposcope in addition toread:user— add this as a parameter/variant of the existing flow functions, do not duplicate them.getLiveSessionGitHubToken(env, sessionId)(src/auth/github-oauth.ts:285) with that specific customer's own session ID — never a fixed/operator session — to obtain a live token for the repo-creation call.POST /user/repos) with that customer-specific token, returning the created repo's full name (which will be<their-login>/<repo-name>), URL, and node ID.Deliverables
POST /user/repos, parameterized by a session ID, using that session's own live token — returning the created repo's full name/URL/node ID.repo-scope extension to the existing OAuth flow (explicit variant, not a silent global change — the default login flow must keep requesting onlyread:user).Test Coverage Requirements
src/auth/github-oauth.tsand any new file undersrc/**— standard 99%+ Codecov patch target, both branches of the scope-selection logic.Expected Outcome
A tested, reusable way to create a repo directly under whichever real customer authorized it, using the existing per-session OAuth token system — no fixed account, no org, no installation-token driver.
Links & Resources
src/auth/github-oauth.ts(the existing multi-user OAuth session flow this extends — read the whole file, the per-session token storage/refresh pattern is already built and must be reused)