PlanGuaranteetypeno test imports ittype PlanGuarantee = "faithful" | "partial" | "none";How faithful the plan of a tool is: faithful shows what would change, partial shows some of it and none shows nothing (the tool has no check mode).
The port of a dialect: the whole of what Archon knows of a tool. A dialect says what it can guarantee, as data, renders an order and a plan to files, and gives the steps its tool needs to carry the plan out. What it renders is generated, and the digest of what it rendered does not depend on the order the files were made in.
import { GENERATED_MARK, isGenerated, renderHeader } from "./types.ts";
isGenerated(`${renderHeader("yaml")}\n- hosts: all`); // truePlanGuaranteetypeno test imports ittype PlanGuarantee = "faithful" | "partial" | "none";How faithful the plan of a tool is: faithful shows what would change, partial shows some of it and none shows nothing (the tool has no check mode).
Guaranteestypetype Guarantees = {
/** The kinds of resource it can carry out. */
readonly kinds: readonly ResourceKindId[];
/** … (421 characters)type Guarantees = {
/** The kinds of resource it can carry out. */
readonly kinds: readonly ResourceKindId[];
/** The classes of subject it can reach. */
readonly subjects: readonly SubjectClass[];
readonly plan: PlanGuarantee;
/** Whether applying twice changes nothing the second time has been shown by its conformance suite. */
readonly idempotence: "proven" | "unproven";
readonly destroy: boolean;
};What a dialect says it can do, as data.
Renderedtypeno test imports ittype Rendered = { readonly files: ReadonlyMap<string, string>; readonly digest: Sha256 };What a dialect rendered: files by path, and the digest of all of them.
DialectSteptypeno test imports ittype DialectStep = {
/** The requirements it carries out. */
readonly covers: readonly RequirementId[];
readonly s… (515 characters)type DialectStep = {
/** The requirements it carries out. */
readonly covers: readonly RequirementId[];
readonly summary: string;
/** The argument vector that does it: it names the digest of what was rendered. */
readonly apply: readonly string[];
/** The argument vector that looks and changes nothing; none where the tool has no check mode. */
readonly check: readonly string[] | undefined;
/** The exit status of the check that means something would change. */
readonly changedExit?: number;
};One step the tool needs, for the executor of headless.
Dialecttypetype Dialect = {
readonly id: DialectId;
/** The tool, and the version the dialect pins. */
readonly tool: { reado… (505 characters)type Dialect = {
readonly id: DialectId;
/** The tool, and the version the dialect pins. */
readonly tool: { readonly name: string; readonly version: string };
readonly guarantees: Guarantees;
/** Renders an order and its plan to files, or says why it cannot. */
readonly render: (order: Order, plan: Plan) => Promise<Result<Rendered, readonly string[]>>;
/** The steps the tool needs to carry the plan out. */
readonly steps: (plan: Plan, rendered: Rendered) => readonly DialectStep[];
};A dialect.
GENERATED_MARKconstconst GENERATED_MARK: "GENERATED by archon; do not edit"The sentence every generated file carries.
FileKindtypeno test imports ittype FileKind = "yaml" | "shell" | "hcl" | "text" | "json";The kinds of file a dialect renders.
renderHeaderfunctionfunction renderHeader(kind: FileKind): stringThe line that says a file is generated, for a kind of file: a comment where the kind has comments, and a member _generated for JSON.
isGeneratedfunctionfunction isGenerated(text: string): booleanWhether a file says it is generated: the mark is in its first lines.
renderedOffunctionfunction renderedOf(files: ReadonlyMap<string, string>): Promise<Result<Rendered, readonly string[]>>What a set of files is, with the digest of them in the order of their paths.