GitHub
Skip to content

Modules

The layers under createOut, from reader detection to prompts and progress, each importable on its own subpath.

readerly exports everything below. Each subpath loads only its own layer.

import { createOut } from "readerly/out";
ts

createOut, the console a command writes to. See Output.

import { detect } from "readerly/detect";

const { reader, reason } = detect(); // "agent", "AI_AGENT"
ts

Who reads the output, and the signal that decided it. It also exports ciName and the harnesses registry. See Readers.

import { resolveProfile } from "readerly/profile";

const profile = resolveProfile({ tool: "acme", argv: process.argv.slice(2) });
ts

The format, color, prompts and budget for a run, with why for each. readerFlags scans argv for the reader flags, and formatEnvName("acme") gives ACME_FORMAT.

import { colorEnabled, createStyle } from "readerly/color";

const style = createStyle(colorEnabled({ env: process.env, isTTY: process.stdout.isTTY }));
console.log(style("red", "failed"));
ts

Whether to color, from --color, FORCE_COLOR, NO_COLOR and the TTY, and a styleText that returns plain text when color is off.

import { DEFAULT_REPORT_BUDGET, planBudget } from "readerly/budget";
ts

Plans which groups and rows of a report fit a character budget, errors first. DEFAULT_REPORT_BUDGET is 8000.

import { githubAnnotations } from "readerly/github";

process.stderr.write(githubAnnotations(diagnostics));
ts

GitHub Actions workflow commands for the errors and warnings that have a file, at most 10 of each by default.

import { createProgress } from "readerly/progress";

const bar = createProgress("Scanning files");
ts

A progress line on stderr for a step that takes over two seconds. See Progress.

import { ask, canPrompt, confirm, readInput } from "readerly/prompt";
ts

Answers from a flag, --input, a variable, a prompt or the default, else an action_required failure. See Prompts and input.

import { actionRequired, failure, FailureError, toFailure } from "readerly/envelope";
ts

Failures with a kind, a status and an exit code. See Failures.

import { tree } from "readerly/tree";

tree("✖ Account is required.", [["fix", "Pass --account."], ["rerun", "acme deploy --account <account>"]]);
ts

A headline and its ├▶ and ╰▶ branches, as the terminal prints a diagnostic.

import { fromNostics, nosticsReporter } from "readerly/nostics";

const report = nosticsReporter(out);
ts

Turns nostics diagnostics into readerly's, without depending on nostics. nosticsReporter(out) sends each one to out.