feat: create a new repo (or fork) plus environment from within Roomote - #792
Open
mrubens wants to merge 2 commits into
Open
feat: create a new repo (or fork) plus environment from within Roomote#792mrubens wants to merge 2 commits into
mrubens wants to merge 2 commits into
Conversation
Make brand-new GitHub repositories a first-class setup target instead of a dead end: - Handle installation_repositories.added/removed and repository.created/deleted/renamed webhooks with a full installation resync, so repos created on github.com appear without a manual refresh. - Survive cloning empty repositories in the worker: point the unborn HEAD at the stored default branch and skip remote-ref sync steps; reject sha pins against empty remotes with a clear error. - Teach the environment-setup skill an empty-repository bootstrap: push one initial commit (README + .gitignore) to the default branch, then define the smallest valid environment. No app scaffolding - building the project is the user's first task. - Flag empty repos in the environment-definition kickoff prompt (inline fallback for older worker images) and stop blocking all-empty selections in onboarding and the environments start command. - New CreateGitHubRepoDialog (github.com/new with owner prefill, or fork an existing repo by URL) with live detection of newly synced repos, wired into onboarding repo selection, Settings > Environments > New (?create-repo=1 deep link), and the workspace picker. - Docs: brand-new-repository flow in environments.mdx and the webhook-event note in the GitHub provider guide.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Makes brand-new GitHub repositories a first-class setup target instead of a dead end. Users can now click "Create a new repository" in Roomote, create the repo (or fork one by URL) on github.com, and have Roomote pick it up automatically, bootstrap it if it's empty, and set up a basic environment — no repo-creation API permissions required.
Why
Today repos only enter Roomote via GitHub App installation sync, and empty repos hit a hard wall: onboarding blocks with "Push an initial commit before continuing." Going from "I want a new project" to a working environment required manual round trips through GitHub and git. Creating repos via API would have required
administration:writeon the App manifest (with a manual permission-update step for every existing self-hosted App, and no coverage for personal accounts) — so instead the flow sends the user togithub.com/newand automates everything after that click.How
Backend
handleInstallationRepositoriesChangewebhook handler registered forinstallation_repositories.added/removed(selected-repos installs) andrepository.created/deleted/renamed(all-repos installs), performing a fullsyncGitHubInstallationresync. No manifest change needed:installation_repositoriesis auto-delivered to GitHub Apps andRepositoryis already inGITHUB_APP_DEFAULT_EVENTS.syncRepositoryGitStatenow detects a branchless remote in the branch-resolution failure path, points the unborn HEAD at the stored default branch, and skips the remote-ref sync steps. SHA pins against empty remotes throw a clear error; local commits in a reused workspace are preserved.buildCreateEnvironmentDefinitionPromptgains optionalemptyRepositoryFullNames(byte-identical output when absent; the prompt restates bootstrap rules inline as an N-1 fallback for worker images whose packaged skill predates the section). The onboardingassertHasCommittedRepositorySelectionthrow is removed — empty selections proceed.Web UI
CreateGitHubRepoDialog: "New repository" tab (opensgithub.com/new?owner=<login>with the installation owner prefilled) and "Fork existing" tab (paste a URL orowner/repo→ GitHub's fork page). Polls the repository list while open, syncs on return to the tab, offers manual refresh and the inline Update GitHub flow, and surfaces newly appeared repos with a "Use this repository" action.?create-repo=1deep link), and the workspace picker (admin-only "New GitHub repository" item).environments.mdx; webhook-event note in the GitHub provider guide (apps predating theRepositorydefault event should confirm it's enabled — there's no API to update app event subscriptions).Zero DB schema changes.
Testing
apps/api(webhook handler, known-installation gating),apps/worker(empty-remote sync paths),packages/cloud-agents(skill guardrails),packages/types/apps/web(prompt builder variants, command plumbing, dialog, onboarding step, environments page, workspace picker).pnpm lint,pnpm check-types, andpnpm knippass.installation_repositories.addeddeliveries arrive for a manifest-created App, and one end-to-end run of create-empty-repo → auto-detect → bootstrap → verified environment.