IF Commons GitHub

logical/doctor

Written to: 1 requirement: 1 proved, 0 partly, 0 failing, 0 with no test recorded. 0005-repoctl-library-commit-doctor FR-008

repoctl doctor (commons repoctl 0005-repoctl-library-commit-doctor FR-008): what is wrong with this checkout and what to do about it, in the order a person would fix it: Git and the checkout, the installed dependencies, the links of the libraries, Node at the configured least version, the version of Bun the repository pins, and the generated files that are stale. The facts are gathered through the ports; the diagnosis is a function of the facts.

import { diagnose } from "./doctor.ts";
const policy = { minNode: 26, bunPin: undefined, links: undefined, install: "bun install" };
diagnose({ git: { works: true, inside: true, origin: true }, installed: true, unlinked: [], node: "v26.13.1", bun: "1.4.4", pinnedBun: "1.4.4", stale: [] }, policy); // []

Source: commons/repoctl/src/logical/doctor.ts

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

logical.Factstypeno test imports it
type Facts = { readonly git: { readonly works: boolean; readonly inside: boolean; readonly origin: boolean }; /** Wh… (713 characters)
type Facts = {
  readonly git: { readonly works: boolean; readonly inside: boolean; readonly origin: boolean };
  /** Whether the root has its `node_modules`. */
  readonly installed: boolean;
  /** The libraries that are not linked under the policy's folder of links (none where the policy has none). */
  readonly unlinked: readonly string[];
  /** What `node --version` says, or undefined where Node does not run. */
  readonly node: string | undefined;
  /** What `bun --version` says. */
  readonly bun: string | undefined;
  /** The version of Bun the policy's pin file names. */
  readonly pinnedBun: string | undefined;
  /** The generated files that are stale. */
  readonly stale: readonly Finding[];
};

What is found of the checkout and the tools.

logical.majorOffunctionno test imports it
function majorOf(version: string | undefined): number | undefined

The major number of a version such as v26.13.1, or undefined.

logical.diagnosefunctionno test imports it
function diagnose(f: Facts, policy: DoctorPolicy): readonly Finding[]

Everything wrong, in the order to fix it.

logical.gatherFactsfunctionno test imports it
function gatherFacts(w: World, order: readonly Generator[], policy: DoctorPolicy): Promise<Facts>

Gathers the facts through the ports.

Factstype
type Facts = { readonly git: { readonly works: boolean; readonly inside: boolean; readonly origin: boolean }; /** Wh… (713 characters)
type Facts = {
  readonly git: { readonly works: boolean; readonly inside: boolean; readonly origin: boolean };
  /** Whether the root has its `node_modules`. */
  readonly installed: boolean;
  /** The libraries that are not linked under the policy's folder of links (none where the policy has none). */
  readonly unlinked: readonly string[];
  /** What `node --version` says, or undefined where Node does not run. */
  readonly node: string | undefined;
  /** What `bun --version` says. */
  readonly bun: string | undefined;
  /** The version of Bun the policy's pin file names. */
  readonly pinnedBun: string | undefined;
  /** The generated files that are stale. */
  readonly stale: readonly Finding[];
};

What is found of the checkout and the tools.

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

majorOffunction
function majorOf(version: string | undefined): number | undefined

The major number of a version such as v26.13.1, or undefined.

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

diagnosefunction
function diagnose(f: Facts, policy: DoctorPolicy): readonly Finding[]

Everything wrong, in the order to fix it.

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

gatherFactsfunction
function gatherFacts(w: World, order: readonly Generator[], policy: DoctorPolicy): Promise<Facts>

Gathers the facts through the ports.

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

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