/** * Typed step-builder API (#658) — ergonomic sugar over the kind-literal * `Step`/`BuildSpec` contract. `phase("Verify", [healthGate({ path })])` * is exactly `phase("Verify", [{ kind: "health-gate", path }])`, but * with per-verb argument checking and autocomplete from each capability's own * `Input` type. Core exports the agnostic verbs' builders; a lexicon exports * its own (e.g. the aws lexicon's `cfnDeploy`, reusing the exported `step`). * * These are pure projections: a builder returns the same kind-literal the * driver dispatches on (see ./component.ts's `Step`), so the JSON contract * (component.schema.json) stays authoritative and a hand-written or * non-chant-authored component keeps working. The runtime `Capability` * objects live under `*Capability` names (./verbs/*), registered by `.kind`. */ import type { BuildSpec, Step } from "./component"; import type { DockerBuildInput, ZipPackageInput, JvmBuildInput, GenerateSbomInput, SignInput, AttestProvenanceInput, VerifyInput, ScanVulnerabilitiesInput, VulnGateInput, WaitClusterHealthyInput, WaitEndpointInput, HealthGateInput, ShellInput, } from "./verbs/index"; /** * Build a `(input) => Step` for one deploy verb: tags the input with its * `kind`. Exported so a lexicon's capability plugin (e.g. the aws lexicon, * which owns the `cfn-deploy`/`emr-*`/… builders) can offer the same typed * sugar for its own verbs without re-implementing this projection. */ export function step(kind: string): (input: In) => Step { return (input) => ({ kind, ...input }) as Step; } /** Build a `(input) => BuildSpec` for one build verb (the `build` field, not `deploy`). */ function buildSpec(kind: string): (input: In) => BuildSpec { return (input) => ({ kind, ...input }) as BuildSpec; } // ── build family → BuildSpec (the component's `build` field) ───────────────── export const dockerBuild = buildSpec("docker-build"); export const zipPackage = buildSpec("zip-package"); export const jvmBuild = buildSpec("jvm-build"); // ── sbom ───────────────────────────────────────────────────────────────────── export const generateSbom = step("generate-sbom"); // ── supply-chain security / policy ─────────────────────────────────────────── export const sign = step("sign"); export const attestProvenance = step("attest-provenance"); export const verify = step("verify"); export const scanVulnerabilities = step("scan-vulnerabilities"); export const vulnGate = step("vuln-gate"); // ── wait / verify (agnostic) ───────────────────────────────────────────────── // The cloud-specific waits (`wait-for-stack`/`wait-steady-state`/`wait-job`) // ship as builders from the aws lexicon, alongside their capabilities. export const waitClusterHealthy = step("wait-cluster-healthy"); export const waitEndpoint = step("wait-endpoint"); export const healthGate = step("health-gate"); // ── escape hatch ───────────────────────────────────────────────────────────── export const shell = step("shell");