formatHostErrorfunctionno test imports itfunction formatHostError(e: HostError): stringA host error as one sentence.
Real git, run by its argument vector for the quality branch (commons 0001-quality-evidence FR-021, FR-023): never through a shell, with no pager, no terminal prompt and messages in English. The host's own Git configuration is what signs (gpg.format, user.signingkey, commit.gpgsign) and names the committer; nothing here holds a key. Every failure is a Result, a missing git included.
import { git, text } from "./git.ts";
const r = await git(".", ["rev-parse", "HEAD"]);
if (r.kind === "ok") console.log(text(r.value).trim());formatHostErrorfunctionno test imports itfunction formatHostError(e: HostError): stringA host error as one sentence.
HostErrortypeno test imports ittype HostError =
| { readonly kind: "git-missing" }
| { readonly kind: "git"; readonly args: readonly string[]; read… (520 characters)type HostError =
| { readonly kind: "git-missing" }
| { readonly kind: "git"; readonly args: readonly string[]; readonly code: number; readonly message: string }
| { readonly kind: "exists"; readonly path: string }
| { readonly kind: "moved"; readonly branch: string }
| { readonly kind: "unknown-commit"; readonly commit: string }
| { readonly kind: "unsigned"; readonly reason: string }
| { readonly kind: "refused"; readonly reason: string }
| { readonly kind: "unreadable"; readonly reason: string };Why the quality branch could not be read or written.
GitInputtypeno test imports ittype GitInput = { readonly input?: string | Uint8Array; readonly env?: Readonly<Record<string, string>> };What git is given besides its arguments: text for its standard input, and variables for its environment.
GitRantypeno test imports ittype GitRan = { readonly stdout: Uint8Array; readonly stderr: string; readonly code: number };What a git run wrote, and how it ended.
gitRawfunctionno test imports itfunction gitRaw(repo: string, args: readonly string[], options?: GitInput): Promise<Result<GitRan, HostError>>git --no-pager -C repo ...args: what it wrote and its status; git-missing where there is no git. A non-zero status is not an error here.
gitfunctionfunction git(repo: string, args: readonly string[], options?: GitInput): Promise<Result<Uint8Array<ArrayBufferLike>, HostError>>git run, where a status of 0 is a success: its output; the failure otherwise names what git said.
textfunctionno test imports itfunction text(bytes: Uint8Array<ArrayBufferLike>): stringBytes as UTF-8 text.
gitTextfunctionno test imports itfunction gitText(repo: string, args: readonly string[], options?: GitInput): Promise<Result<string, HostError>>git run for its text, trimmed.