import { type Document } from "scripted-yaml/core"; import type { Marked } from "./markers.js"; import type { InputUse, PipelineSpec } from "./spec.js"; /** Where the file reads a variable. `within` is the `env:` key whose value reads it. */ export interface InputRead { name: string; use: InputUse; /** A shell `${NAME:-default}`. */ default?: string; within?: string; /** A `when` read: the stage it is in. None for the top-level `when`. */ stage?: string; } /** A variable of `$vars`. Required: neither `optional: true` nor a `default`, so a run without it is bad usage. */ export interface DeclaredVariable { name: string; required: boolean; default?: string; about?: string; secret: boolean; } type Raw = Record; /** * A checked pipeline: its spec, the one YAML file it runs from, and the * loaded scripted-yaml document that computes its formulas for a run. */ export declare class PipelineDefinition { readonly spec: PipelineSpec; /** The file with `$extends` and overrides applied. It needs nothing else to run. */ readonly text: string; /** Every variable the file reads, and where. */ readonly reads: InputRead[]; private readonly document; private readonly markers; constructor(spec: PipelineSpec, /** The file with `$extends` and overrides applied. It needs nothing else to run. */ text: string, /** Every variable the file reads, and where. */ reads: InputRead[], document: Document, markers: Map); /** The checks the runner makes before the first stage, by prerequisite: `$value!sh`, `$value!file`, `$value!changes`. */ checks(): Map; /** The variables `$vars` declares, with what a UI needs to ask for one. */ variables(): DeclaredVariable[]; /** The `default` of each variable `$vars` declares: a stage's shell sees it when no one set the variable. */ defaults(): Record; /** * Runs the file's `$tests`: each gives variables and the values it expects. * Call it before the checks: an unchecked check reads as false, as a test says. */ test(): Promise>; /** Every formula and `{{ }}` computed with these variables. Checks the runner has not made read as false. */ values(vars: Record): PipelineValues; } /** One run's values of a pipeline: what passes, what runs, the texts with `{{ }}` filled in. */ export declare class PipelineValues { private readonly spec; private readonly data; constructor(spec: PipelineSpec, data: Raw); passes(name: string): boolean; /** The top-level `when`. */ runs(): boolean; stageRuns(id: string): boolean; /** Why `when` is false: the message of the first prerequisite it reads that does not pass. */ reason(names: string[], formula: string | undefined): string; /** The stage's text: its task, its question or what it extracts. */ task(id: string): string; summary(): string | undefined; /** `env:` as the shell gets it. A value that is null is not set. */ env(): Record; packages(): Record; private stage; private truth; private static texts; private static isRecord; } export {};