IF Commons GitHub

repoctl

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0006-repoctl-surfaces FR-006

repoctl, the operations program of a repository (commons repoctl 0006-repoctl-surfaces; 0010-repoctl-host): a generic host on Headless driven by the typed configuration repoctl.config.ts at the root of the repository it operates (or the file --config FILE names). Its verbs are declared with the facts of their actions and Headless runs them: it parses the words, decides whether a run proceeds, previews, asks or is refused, draws the output (the report on standard output; the problems, the verdict and the one next: command on standard error), explains the problem codes (repoctl explain <code>) and generates its help, completions and man page. The tier the program holds is the host's (the configuration names the variable, REPOCTL_TIER by default: public, contributor, releaser; contributor where it says nothing).

repoctl check                          # at the root of a repository that has a repoctl.config.ts
repoctl --config ci/repoctl.config.ts sync --check

A run ends in Headless' statuses: 0 ok, 1 findings, 2 a command line that does not fit, 3 a host that cannot do it (a repository with no usable configuration is one), 4 where a check finds something pending. The repository's root is the folder of the configuration file. help, explain and doctor run where there is no configuration, and say so.

import { main } from "./repoctl.ts";
const status = await main(["help"], { cwd: "/tmp", out: () => undefined, err: () => undefined });
status; // 0

Source: commons/repoctl/src/repoctl.ts

1 of 2 exports are imported by a test of the run. A test that imports an export may not call it or check what it returns.

mainfunction
function main(argv: readonly string[], deps?: MainDeps): Promise<number>

Runs repoctl with the words after its name; returns the exit status.

Imported by 46 tests of the run (46 passed, 0 failed): the library's results

MainDepstypeno test imports it
type MainDeps = {
  readonly env?: Readonly<Record<string, string | undefined>>;
  readonly cwd?: string;
  /** Where the report goes (standard output by default). */
  readonly out?: (text: string) => void;
  /** Where the problems and the verdict go (standard error by default). */
  readonly err?: (text: string) => void;
};

What main is given besides the command line; each is read from this process where it is not.

Titles, headings, exports, tables, columns and requirements. Esc closes.