Skip to content

Config & Discovery

Where the CLI's package list comes from, and how to add repos to it without hand-editing JSON.

Multiple hosts

A repo's host — GitHub or GitLab — is never configured by hand. Every command that needs it (bump, doctor, prs, release, list, tag) detects it per repo from git remote get-url origin, so a single folder can freely mix GitHub and GitLab repos and everything just works. gitlab.com is always recognized; a self-hosted GitLab instance needs its hostname registered once, since there's no way to tell "some other git server" from "our corporate GitLab" by URL shape alone — the same limitation gh/glab themselves have for GitHub Enterprise/self-hosted instances. Anything not recognized as GitLab is treated as GitHub, so a GitHub-only setup needs no configuration at all.

Registering a self-hosted host is one more entry through setup (below), or by hand in gitlabHosts:

json
{
  "roots": ["C:\\work\\NPM"],
  "packages": [],
  "gitlabHosts": ["gitlab.company.com"]
}

setup

An interactive menu for the config file itself. Shows the current roots, packages, and gitlabHosts lists with ✓ exists / ✗ not found (and, for packages, ! no package.json/.git here when the folder exists but isn't a package), and lets you add a root, package directory, or GitLab host, edit an existing entry, or remove one (with confirmation).

bash
polyrepo setup

A path isn't checked strictly — adding one that doesn't exist yet just prints a warning, in case the folder shows up later (a hostname isn't checked at all, there's nothing on disk to look for). Changes are only written to disk when you choose "Save and exit"; "Discard changes and exit" throws away anything done in that session.

Example output — the current state, right before the menu itself:

Configure package sources

Editing: C:\work\NPM\polyrepo.config.json

roots (subfolders are scanned as packages)
  1. C:\work\NPM  ✓ exists

packages (the folder itself is the package)
  (none)

gitlabHosts (self-hosted GitLab instances — gitlab.com always works)
  (none)

? What do you want to do?

Options

--config <path>

Edit a config file other than the default one next to the CLI itself.

Example:

bash
polyrepo setup --config "/path/to/polyrepo.config.json"

clone

Diffs a GitHub org's (or GitLab group's) repo list against what's already cloned under one root directory, and clones whatever's missing.

bash
polyrepo clone --org <name> [options]
  1. gh repo list <org> (or, with --provider gitlab, glab repo list --group <name>) — every repo under that org/group (archived ones are skipped by default).
  2. Compares the names against the directories already found under the target root (--root, or the first root in the config if not given).
  3. Shows a checkbox of the missing ones (all checked by default), then git clones each selected one into the target root, one at a time.

--org is required and isn't stored in the config — the config's roots/packages describe where local repos live, not which account they came from. Unlike every other command, clone can't autodetect the host from a local repo's origin remote — the repo doesn't exist locally yet — so --provider says which one --org refers to.

Example output — two repos picked from the checkbox, cloned one at a time:

Clone missing repos from my-github-org (github)

Target root: C:\work\NPM

? Pick repos to clone into C:\work\NPM:
    vue-command-palette
    vue-toast-kit

[1/2] vue-command-palette
  $ git clone https://github.com/my-github-org/vue-command-palette.git C:\work\NPM\vue-command-palette
  ✓ Cloned into C:\work\NPM\vue-command-palette.

[2/2] vue-toast-kit
  $ git clone https://github.com/my-github-org/vue-toast-kit.git C:\work\NPM\vue-toast-kit
  ✓ Cloned into C:\work\NPM\vue-toast-kit.

Options

--org <name>

GitHub org/user, or GitLab group, to list repos from. Required.

--provider <github|gitlab>

Which host --org refers to. Defaults to github.

--root <path>

Root directory to clone into. Defaults to the config's first roots entry.

--include-archived

Also offer archived repos (skipped by default).

--packages <a,b,c>

Only offer these repo names, skipping the interactive checkbox.

--yes

Skip the "proceed?" confirmation.

--dry-run

Print what would be cloned, without actually cloning anything.

Example:

bash
polyrepo clone --org my-github-org --root "C:\work\NPM" --yes
polyrepo clone --org my-gitlab-group --provider gitlab --yes