cloneUrlOffunctionfunction cloneUrlOf(ref: RepoRef): stringThe HTTPS URL a repository is cloned from, with no credential in it.
A Git remote URL read as a repository on a host (commons 0001-githost FR-005, FR-007, FR-008): the https, git://, ssh:// and scp-like (git@host:owner/repo) forms give the same RepoRef, whichever way the remote is written, so that a clone made over SSH is the repository the manifest names over HTTPS.
A credential in the URL (https://user:token@host/...) is dropped: no result, no error and no message holds it. The host name is lower-cased and its port is dropped (an SSH port and an HTTPS port say how to reach a host, not which repository it is); the path is kept as the host writes it, without .git and without a trailing slash. The kind of host is GitHub for github.com, GitLab for gitlab.com and for a host a map names, and plain Git for every other: a self-managed GitLab is named, never guessed from a URL (FR-019).
cloneUrlOffunctionfunction cloneUrlOf(ref: RepoRef): stringThe HTTPS URL a repository is cloned from, with no credential in it.
describeReffunctionno test imports itfunction describeRef(ref: RepoRef): stringA repository as host/owner/repo: the name used in messages, never a URL with a credential.
describeRemoteErrorfunctionfunction describeRemoteError(e: RemoteError): stringA remote error as one sentence.
hostKindOffunctionfunction hostKindOf(host: string, hostKinds?: Readonly<Record<string, HostKind>>): HostKindThe kind of a host: GitHub for github.com, GitLab for gitlab.com, what the map says for a host it names, and plain Git for every other (0001-githost FR-005).
HostKindstypeno test imports ittype HostKinds = Readonly<Record<string, HostKind>>;The hosts that are not plain Git, by name: a map from a lower-case host name to its kind, as the manifest names them (a self-managed GitLab, or GitHub Enterprise Server).
parseRemotefunctionfunction parseRemote(url: string, hostKinds?: Readonly<Record<string, HostKind>>): Result<RepoRef, RemoteError>A remote URL as the repository it names. The forms: https://host/path(.git), http://, git://, ssh://[user@]host[:port]/path(.git) and [user@]host:path(.git). A credential in the URL is dropped; hostKinds names the hosts that are not plain Git.
readRemotefunctionfunction readRemote(input: string, hostKinds?: Readonly<Record<string, HostKind>>): Result<ReadRemote, RemoteError>A remote as a person writes it, where the domain says the rest: github.com/owner/repo and gitlab.example.com/group/sub/repo need no https://, owner/repo is a repository of GitHub, github:owner/repo and gitlab:group/sub/repo name the host's kind, and the address of a branch's page (.../tree/main) is the repository and that branch. Every form parseRemote reads is read as it does. A text that begins with /, . or ~, a Windows drive or a file: URL is a path on this computer and an error, as it is there.
ReadRemotetypeno test imports ittype ReadRemote = { readonly ref: RepoRef; readonly branch?: string };A remote as a person writes it: the repository, and the branch where the text is the address of a branch's page.
RemoteErrortypeno test imports ittype RemoteError =
| { readonly kind: "empty" }
| { readonly kind: "local-path" }
| { readonly kind: "unsupported-scheme"; readonly scheme: string }
| { readonly kind: "no-host" }
| { readonly kind: "no-path" }
| { readonly kind: "bad-segment"; readonly reason: string };Why a text is not a remote URL of a repository on a host. Never holds the URL, which may hold a credential.
sameRepositoryfunctionfunction sameRepository(a: RepoRef, b: RepoRef): booleanWhether two references name the same repository: the same host, and paths equal by their case (GitHub and GitLab paths are not case-sensitive).