Cofounder

Import a Repo and Ship a Change

Connect your existing code to the company, work on it locally, and deploy a change.

Connect your existing codebase to the company so your agents can work on it locally and ship changes to your live app.

Steps

Pick Your Code Source Before Setup

For a new company with an existing GitHub repository, run cofounder company setup --repository-source github (MCP: company_setup_start with repository_source: "github"). Wait for setup to finish. Hosting and the database get set up without a starter repository. To upload a local folder instead, pick the local-folder option in Managed Setup.

Connect GitHub and Import

Tell your agent to import your repo. It runs cofounder repo import or code_repository_import_start without a repository name and gives you a link to connect GitHub.

  • If your agent's app supports MCP events, your agent listens for the returned step's resume_event before giving you the link, and resumes the import once GitHub access is ready. Otherwise, go back to your agent after connecting, or run the CLI command again.
  • If GitHub gives access to exactly one repository you can write to, the import uses it. If several are listed, choose one with cofounder repo import <owner/repo>. To see more, use the repository paging options.
  • Review the suggested app folder and build settings, then run cofounder repo import continue to set up the existing Vercel project for that app. Check progress with cofounder repo import status.

A standard single-app import doesn't need GitHub connected in Vercel. If an older company's import reports awaiting_vercel_link, follow the Git settings instructions it returns, then continue.

Importing does not deploy. Follow its next_steps to fix build or runtime errors, set up Vercel and Supabase, request missing secrets safely, and check the deployed app.

Clone and Look Around

Imported repositories can't get Cofounder SSH access. Clone over HTTPS with a short-lived token from cofounder code push-token create (code_push_token_create on MCP), which needs the Cofounder GitHub App installed on the repository. cofounder repo clone works only if your own SSH key already has access on GitHub. Inside the clone, cofounder repo status shows the production branch, the last production deploy, and every open PR.

Make the Change

Branch, commit, and push with the same token, and request a new one when it expires. When a different agent takes over, repo handoff marks the branch for it.

Deploy

Your agent ships with hosting_deploy / cofounder hosting deploy / POST /cofounder-cli/v1/company/repository/deploy. It follows the rollout with hosting_deployments_get and checks hosting_deployments_readiness_get before calling it done.

Keep Your Existing Supabase Database

If your app already has a production database, connect it before you deploy:

  1. Call database_import_connect or run cofounder database import connect. Open the link it returns, then check database_import_connect_status_get or cofounder database import connect-status get until it says connected. Wait the suggested time between checks, and ask for a new link if it expires.
  2. Call database_import_candidates_list or run cofounder database import candidates list to find your project ref.
  3. Call database_import_attach with project_ref, or run cofounder database import attach --project-ref <ref>.

Attaching replaces the company's current database and updates its Supabase sign-in settings and Vercel credentials, so review your existing sign-in settings first. It does not move your schema or data, bring over other environment variables, or deploy the app. Attach one database at a time per company. Check the result with cofounder database refs list.

If Something Goes Wrong

  • If GitHub approval is pending, ask your GitHub organization admin to approve access, then check again in the dashboard. The dashboard can find access that's already been approved. If the access link expires, retry the import to get a new one.
  • If the repo is in a different GitHub installation, finish connecting in the dashboard to give access to this repository. The import remembers that installation and keeps the company's existing GitHub connection for other repositories.
  • If the import never finishes, repo import status names what's blocking it, and code repository-import cancel cancels it. After an import, cofounder repo disconnect brings back the previous managed repository if there was one. GitHub-first setup has no starter repo to bring back. Hosting and the database stay ready for another import.
  • If the deploy succeeded but the app shows errors, hosting_deployments_events has the build and runtime logs.
  • If the database schema is out of sync, cofounder database migrations list shows what's been applied, and database migrations apply runs what's pending.