import { OpResource } from "./resource.js"; import type { OpConfig, PhaseDefinition, StepDefinition, ActivityStep, GateStep } from "./types.js"; /** * Declare a named, phased Temporal workflow. * * @example * ```ts * export default Op({ * name: "alb-deploy", * overview: "Build and deploy the ALB multi-service stack", * phases: [ * phase("Build", [build("examples/gitlab-aws-alb-infra")], { parallel: true }), * phase("Deploy", [kubectlApply("dist/alb-infra.yaml")]), * ], * }); * ``` */ export declare function Op(config: OpConfig): InstanceType; /** Define a named execution phase containing one or more steps. */ export declare function phase(name: string, steps: StepDefinition[], opts?: { parallel?: boolean; }): PhaseDefinition; /** Reference a pre-built or custom activity by function name. */ export declare function activity(fn: string, args?: Record, profile?: ActivityStep["profile"]): ActivityStep; /** Insert a human gate — the workflow pauses until the named signal is received. */ export declare function gate(signalName: string, opts?: { timeout?: string; description?: string; }): GateStep; /** Run an npm build script in the given project directory. `opts.script` selects the script (default `build`, e.g. `build:aws`); `opts.env` adds env vars. */ export declare const build: (path: string, opts?: Record) => ActivityStep; /** Run `kubectl apply -f `. Defaults to the `longInfra` profile (override via `opts.profile`). */ export declare const kubectlApply: (manifest: string, opts?: Record) => ActivityStep; /** Run `helm upgrade --install`. Defaults to the `longInfra` profile (override via `opts.profile`). */ export declare const helmInstall: (name: string, chart: string, opts?: { values?: string; namespace?: string; profile?: ActivityStep["profile"]; [k: string]: unknown; }) => ActivityStep; /** Poll for stack readiness (kubectl rollout, CloudFormation complete, etc). Defaults to the `k8sWait` profile (override via `opts.profile`). */ export declare const waitForStack: (name: string, opts?: Record) => ActivityStep; /** Poll any operator-backed Kubernetes resource until it reports ready, driven by a data-only readiness spec (CRD-aware; #365). Defaults to the `k8sWait` profile (override via `opts.profile`). */ export declare const waitForReady: (kind: string, name: string, opts?: Record) => ActivityStep; /** Trigger and wait for a GitLab CI pipeline to complete. Defaults to the `longInfra` profile (override via `opts.profile`). */ export declare const gitlabPipeline: (name: string, opts?: Record) => ActivityStep; /** Take a chant lifecycle snapshot for the given environment. */ export declare const lifecycleSnapshot: (env: string) => ActivityStep; /** * Run an arbitrary shell command. Tag long-running commands with a `profile` * (e.g. `longInfra` for a multi-GB image push) so they get the right * start-to-close timeout under both the local executor and Temporal. */ export declare const shell: (cmd: string, opts?: { env?: Record; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Run `chant teardown` in the given project directory. Uses `longInfra` profile. */ export declare const teardown: (path: string) => ActivityStep; /** * Tear down one environment's marker-owned resources — the durable form of * `chant lifecycle teardown --yes` (#1222). The activity runs core's * teardown engine in-process: enumerate by ownership marker (this project's * `ownership.stack` + `env`), delete through each lexicon's `executeTeardown` * capability, retry failures once, and fail the step when any candidate is * still failed. Distinct from {@link teardown}, which runs a project's own * `npm run teardown` script. * * The CLI's guards apply unchanged, and a production-like environment name * needs `confirmProd: true` in `opts` — the authored counterpart of * `--confirm-prod`, since an Op never prompts. An ordinary {@link gate} step * placed before this one composes as usual (steps run in authored order), so * a human approval can precede the deletion: * * ```ts * phase("Teardown", [ * gate("approve-teardown", { description: "Release the staging teardown" }), * envTeardown("staging"), * ]), * ``` * * `opts` also accepts `path` (the chant project directory, default the * worker's cwd). Defaults to the `longInfra` profile (override via * `opts.profile`). */ export declare const envTeardown: (env: string, opts?: Record) => ActivityStep; /** * Create a local k3d cluster (vanilla Kubernetes in Docker). Idempotent: skips * creation if a cluster of the same name already exists. Defaults to the * `longInfra` profile (creating a cluster may pull the k3s image); override via * `opts.profile`. * * The implementation lives in the k3d lexicon (chant #1410) — the project's * `chant.config.ts` must list `"k3d"` in `lexicons` for the activity to load. * Unlike the upstream CLI, the activity leaves the caller's default kubeconfig * and current context alone by default (chant #1411); pass * `updateDefaultKubeconfig: true` / `switchCurrentContext: true` to opt back * in. It resolves `{ context, kubeconfigPath? }` for reaching the cluster. * * `opts` accepts `servers`, `agents`, `image`, `ports` (e.g. * `["8080:80@loadbalancer"]`), `registryCreate`, `configFile`, `timeout`, * `updateDefaultKubeconfig`, and `switchCurrentContext`. */ export declare const k3dUp: (name: string, opts?: Record) => ActivityStep; /** * Delete a local k3d cluster. Defaults to the `fastIdempotent` profile * (override via `opts.profile`). Implementation lives in the k3d lexicon * (chant #1410) — requires `"k3d"` in the project's `lexicons`. */ export declare const k3dDown: (name: string, opts?: Record) => ActivityStep; /** * Boot a local Floci AWS emulator in Docker and point subsequent steps at it — * sets `AWS_ENDPOINT_URL` + test creds in the process env so a following * `cloudformation` apply targets the emulator (local executor). Idempotent: * reuses a running container of the same name. Defaults to the `longInfra` * profile (the image may pull); override via `opts.profile`. * * `opts` accepts `name`, `port`, `image`, `dockerSocket` (mount the docker * socket for the ECR backing registry), `region`, `readyService`, `timeoutMs`. */ export declare const flociUp: (opts?: Record) => ActivityStep; /** Stop and remove the local Floci emulator container. Defaults to the `fastIdempotent` profile (override via `opts.profile`). */ export declare const flociDown: (opts?: Record) => ActivityStep; /** * Boot a local floci-az (Azure emulator) and return its ARM `endpoint` — the * typed twin of {@link flociUp} for `azApply`, so the emulator lifecycle is a * modeled step, not a `docker run` shell. Provided by the azure lexicon; loaded * when the project lists `azure`. Idempotent; defaults to the `longInfra` * profile. `opts` accepts `name`, `port`, `image`, `timeoutMs`, `intervalMs`. */ export declare const flociAzUp: (opts?: Record) => ActivityStep; /** Stop and remove the local floci-az container. Defaults to the `fastIdempotent` profile (override via `opts.profile`). */ export declare const flociAzDown: (opts?: Record) => ActivityStep; /** * Boot a local floci-gcp (GCP emulator) and return its `endpoint` — the typed * twin of {@link flociUp} for `gcpApply`, so the emulator lifecycle is a modeled * step, not a `docker run` shell. Provided by the gcp lexicon; loaded when the * project lists `gcp`. Idempotent; defaults to the `longInfra` profile. `opts` * accepts `name`, `port`, `image`, `timeoutMs`, `intervalMs`. */ export declare const flociGcpUp: (opts?: Record) => ActivityStep; /** Stop and remove the local floci-gcp container. Defaults to the `fastIdempotent` profile (override via `opts.profile`). */ export declare const flociGcpDown: (opts?: Record) => ActivityStep; /** * Assert an HTTP endpoint responds as expected — a typed verify step replacing * `shell("curl -fs ...")`. Fails the phase if the status/body doesn't match. * Defaults to the `fastIdempotent` profile. `opts` accepts `method`, `status` * (default any 2xx), `contains` (body substring), `retries`, `intervalMs`. */ export declare const httpCheck: (url: string, opts?: Record) => ActivityStep; /** * Ensure an Azure resource group exists before an ARM apply. `az deployment * group create` (the `arm` apply target) fails without its group, so place this * before the deploy phase. Idempotent. Defaults to the `fastIdempotent` profile * (override via `opts.profile`). `opts` accepts `location` (default `eastus`). */ export declare const azGroupEnsure: (resourceGroup: string, opts?: Record) => ActivityStep; /** Delete an Azure resource group and its contents (non-blocking). Defaults to the `fastIdempotent` profile (override via `opts.profile`). */ export declare const azGroupDelete: (resourceGroup: string, opts?: Record) => ActivityStep; /** * Apply chant's built ARM template directly to the ARM resource API — the Azure * twin of {@link gcpApply}. Targets floci-az's resource CRUD (which `az deployment` * can't, floci-az having no deployments provider) or real Azure by endpoint * override; ensures the resource group first. Defaults to the `longInfra` profile. * * `opts` requires `resourceGroup`; accepts `location`, `endpoint` (floci-az * `http://localhost:4577`), `subscriptionId`, and `prune` (owned-only prune of * chant-managed resources no longer in the template — destructive, off by default). */ export declare const azApply: (templatePath: string, opts?: Record) => ActivityStep; /** Delete the Azure (ARM) resources in a built template — the inverse of {@link azApply}. Defaults to the `longInfra` profile (override via `opts.profile`). `opts` requires `resourceGroup`. */ export declare const azDelete: (templatePath: string, opts?: Record) => ActivityStep; /** * Deploy a built CloudFormation template by calling the CloudFormation API * directly (create-or-update + poll) — the direct twin of {@link azApply} / * {@link gcpApply} for AWS, targeting a local Floci emulator or real AWS by * endpoint override. Speaks the CFN API over HTTP rather than shelling `aws` — * `nativeApply({ target: "cloudformation" })` routes here too (#1449). Provided by * the aws lexicon; loaded when the project lists `aws`. Defaults to the * `longInfra` profile. `opts` requires `stackName`; accepts `endpoint`, `region`, * `capabilities`, `timeoutMs`, `intervalMs`. */ export declare const awsApply: (templatePath: string, opts?: Record) => ActivityStep; /** Delete a CloudFormation stack — the inverse of {@link awsApply}. Defaults to the `longInfra` profile (override via `opts.profile`). `opts` requires `stackName`. */ export declare const awsDelete: (templatePath: string, opts?: Record) => ActivityStep; /** * Apply chant's built GCP (CNRM) resources directly to their GCP REST APIs, * targeting a local floci-gcp emulator or real GCP by endpoint override — the * native GCP applier (#706 starter #711). `nativeApply({ target: "gcp" })` * routes here too (#1449). Defaults to the `longInfra` profile (override via * `opts.profile`). * * `opts` accepts `endpoint` (default `GCP_ENDPOINT_URL` env / each kind's * real-GCP host) and `project` (default `GOOGLE_CLOUD_PROJECT` env / the CNRM * project-id annotation). */ export declare const gcpApply: (manifestPath: string, opts?: Record) => ActivityStep; /** Delete the GCP (CNRM) resources in a built manifest — the inverse of {@link gcpApply}. Defaults to the `longInfra` profile (override via `opts.profile`). */ export declare const gcpDelete: (manifestPath: string, opts?: Record) => ActivityStep; /** Create a sprite with a caller-chosen `name` (used as its id). Defaults to the `longInfra` profile (override via `profile`). */ export declare const spriteCreate: (args: { name: string; image?: string; size?: string; policy?: unknown; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Run a command in a sprite; a non-zero exit fails the step. Defaults to the `longInfra` profile (override via `profile`). */ export declare const spriteExec: (args: { id: string; cmd: string; timeoutMs?: number; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Checkpoint a sprite under a caller-chosen `comment` (the transactional boundary). Defaults to the `longInfra` profile (override via `profile`). */ export declare const spriteCheckpoint: (args: { id: string; comment?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** * Restore a sprite — the checkpoint-as-compensation step (S5). Target an * explicit `checkpoint` id, or the newest checkpoint carrying `comment`, or (with * neither) the newest checkpoint overall. Defaults to the `longInfra` profile * (override via `profile`). */ export declare const spriteRestore: (args: { id: string; checkpoint?: string; comment?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** List a sprite's checkpoints (`[{ id, comment, create_time, is_auto }]`). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const listCheckpoints: (args: { id: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Destroy a sprite (idempotent). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteDestroy: (args: { id: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Write a file into a sprite. Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteWriteFile: (args: { id: string; path: string; content: string; mode?: string; mkdir?: boolean; workingDir?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Read a file from a sprite (returns `{ content }`). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteReadFile: (args: { id: string; path: string; workingDir?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** List a directory in a sprite (returns `[{ name, type, size? }]`). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteListDir: (args: { id: string; path: string; workingDir?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Remove a path in a sprite (idempotent). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteRemove: (args: { id: string; path: string; recursive?: boolean; asRoot?: boolean; workingDir?: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Reconcile a sprite's outbound network policy (whole-object replace). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteApplyNetworkPolicy: (args: { id: string; rules: Array<{ domain: string; action: "allow" | "deny"; }>; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Reconcile a sprite's background services (create-or-update, optionally start). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteApplyServices: (args: { id: string; services: Array<{ name: string; cmd: string; args?: string[]; env?: Record; dir?: string; needs?: string[]; http_port?: number; }>; start?: boolean; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Create a keep-alive task holding the sprite active. Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteTaskCreate: (args: { id: string; name: string; expire?: number | string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Refresh a keep-alive task's expiry. Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteTaskRefresh: (args: { id: string; name: string; expire?: number | string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Release a keep-alive task (idempotent). Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spriteTaskRelease: (args: { id: string; name: string; endpoint?: string; token?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** * Boot a local spritzer (Fly Sprites API emulator) in Docker — the typed twin of * `flociGcpUp` for Sprites. Resolves to the `spritesUp` activity. Defaults to the * `longInfra` profile (the image may pull); override via `profile`. */ export declare const spritesUp: (args?: { name?: string; port?: number; image?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** Stop and remove the local spritzer container. Resolves to the `spritesDown` activity. Defaults to the `fastIdempotent` profile (override via `profile`). */ export declare const spritesDown: (args?: { name?: string; profile?: ActivityStep["profile"]; }) => ActivityStep; /** * Gate an apply on organizational policy: build the project and run its * `lint.policies` over the resolved resources, blocking the workflow on any * violation. Place it before the apply phase. `env` (or `ownership.env`) lets a * policy branch on environment. Single-attempt (`policyCheck` profile) — a * deterministic violation is not retried. */ export declare const policyGate: (opts?: { env?: string; path?: string; }) => ActivityStep; //# sourceMappingURL=builders.d.ts.map