Skip to content

Feature: Create new GitHub repository from the Add Project UI #1568

@leex279

Description

@leex279

Summary

Allow users to create brand-new GitHub repositories directly from the Archon Add Project screen, without needing to first create the repo on GitHub and then paste the URL. Since Archon already holds a GitHub token (used to clone private repos and push code in existing workflows), the same credential can be used to call the GitHub API and provision a new repo on behalf of the user.

Motivation

Today, adding a project to Archon requires an existing GitHub URL. This creates unnecessary friction for the common "start from scratch" case: the user must context-switch to GitHub, create a repo, copy the URL, come back to Archon, and then register it. Archon already has everything needed to eliminate those steps.

Proposed UX Flow

  1. On the Add Project screen, expose a toggle or tab: "Add existing repo" (current behaviour) vs "Create new repo" (new).
  2. In the "Create new repo" panel, collect:
    • Repository name (required)
    • Description (optional)
    • Visibility: Public / Private (radio or select)
    • Owner: personal account or an organisation the token has access to (dropdown populated via GET /user/orgs)
    • Initialise with README (checkbox, optional)
    • Add .gitignore template (optional, e.g. Node, Python, etc.)
  3. On submit:
    • Call POST /user/repos (personal) or POST /orgs/{org}/repos (org) with the supplied fields.
    • Receive the new repo's clone URL from the API response.
    • Clone it locally into ~/.archon/workspaces/<owner>/<repo>/source/ (same layout as existing projects).
    • Register it as a project in Archon's database (same path as the existing "add by URL" flow).
    • Redirect the user to the newly registered project.

GitHub API Surface

Action Endpoint
Create personal repo POST /user/repos
Create org repo POST /orgs/{org}/repos
List orgs for token GET /user/orgs

All calls use the existing GitHub token already stored for the user/workspace.

Implementation Notes

  • Backend: Add a new API route (e.g. POST /api/github/repos/create) that accepts { name, description, private, org?, initReadme?, gitignoreTemplate? }, calls the GitHub API, clones the result, and registers the codebase — reusing the existing clone + register logic.
  • Auth: Use the same GitHub token already plumbed through for private-repo cloning and push workflows. No new credential surface needed.
  • Frontend: Extend the Add Project dialog/page with the new panel; use the existing API client patterns.
  • Error handling: Surface GitHub API errors clearly (name taken, insufficient org permissions, token lacks repo scope, etc.).
  • Scope gate: If the token only has public_repo scope and the user tries to create a private repo, return a clear error message rather than a generic failure.

Acceptance Criteria

  • User can create a new GitHub repository (personal or org) from the Add Project UI without leaving Archon.
  • Repo visibility (public/private) is configurable in the UI.
  • Optional README and .gitignore initialisation work correctly.
  • The new repo is automatically cloned and registered as an Archon project.
  • Meaningful error messages are shown for common failure modes (name conflict, missing scope, org permission denied).
  • Existing "add by URL" flow is unchanged.

Out of Scope (for this issue)

  • Repository template selection (can be a follow-up).
  • SSH key management (HTTPS clone with token is sufficient).
  • Deleting or archiving repos from Archon.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestNew functionality (external suggestion, needs review)uxUser experience improvements

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions