Add `entire repo mirror create` onboarding wizard · Entire

Add entire repo mirror create onboarding wizard

993f948→main·

toothbrush·3w ago·3 files·+658 added/-10 removed

Run entire repo mirror create with no args to onboard repos interactively: verifies auth, multi-select repos to mirror, multi-select regions, then creates every (repo, region) mirror in parallel and prints the clone URLs. The positional create <github-url> [cluster-host] form is unchanged.

Regions come from entire-core's GET /api/v1/clusters (ListClusters). The endpoint isn't deployed yet, so the /clusters spec fragment is hand-authored into core.openapi.json and the ogen client regenerated; a real spec refresh is idempotent.

Co-Authored-By: Claude Opus 4.8 (1M context) noreply@anthropic.com

Sessions

ee0c83e58bfcView transcript

Changes

3

47 unmodified lines

// defaultClusterHost is the cluster the mirror commands target when the
// caller omits the <cluster-host> argument. A pragmatic single-region
// default for now — once multi-cluster selection lands this should come
// from config/context rather than a constant.
const defaultClusterHost = "aws-us-east-2.entire.io"

// mirrorCreateConcurrency bounds how many (repo, region) mirror creations run
// at once. The slow phase is the per-mirror clone wait, which is I/O-bound on
// the cluster, so a modest fan-out keeps the wizard responsive without
// hammering the control plane or the user's STS.
const mirrorCreateConcurrency = 8

// Per-mirror outcome labels shown in the results table's STATUS column.
const (
    mirrorStatusReady      = "ready"      // clone landed, ready to use
    mirrorStatusRegistered = "registered" // placement created, clone in progress (--no-wait)
    mirrorStatusEmpty      = "empty"      // upstream has no commits, nothing to clone
    mirrorStatusSuspended  = "suspended"  // placement exists but the cluster won't issue clone tokens
    mirrorStatusTimedOut   = "timed out"  // clone didn't finish within --wait-timeout
    mirrorStatusError      = "error"      // create or probe failed
)

// regionChoice is one mirrorable region offered by the create wizard's region
// picker, sourced from the control plane's cluster catalog
// (GET /api/v1/clusters via availableRegions).
type regionChoice struct {
    slug         string
    jurisdiction string
    host         string // bare cluster host passed to CreateMirror / validateClusterHost
    isDefault    bool
}

// mirrorTarget is one unit of work: a selected repo to be mirrored into a
// selected region. The wizard creates the cross-product of repos × regions.
type mirrorTarget struct {
    owner  string
    repo   string
    region regionChoice
}

// mirrorResult is the outcome of creating one (repo, region) mirror.
type mirrorResult struct {
    owner       string
    repo        string
    regionLabel string
    cloneURL    string
    status      string // ready | registered | empty | suspended | timed out | error
    err         error
}

var mirrorCreateResultColumns = []string{"REPO", "REGION", "STATUS", "CLONE URL"}

func mirrorCreateResultRow(r mirrorResult) []string {
    url := r.cloneURL
    if url == "" {
        url = placeholderDash
    }
    return []string{r.owner + "/" + r.repo, r.regionLabel, r.status, url}
}