Skip to content
infra-ts is early and moving fast.npm
infra-ts
Esc
navigateopen⌘Jpreview
On this page

CLI

Commands for planning, applying, checking out env, and running app commands.

The CLI and SDK share the same engine functions. Commands are thin wrappers around the runtime.

Commands

Command Purpose
infra-ts init Scaffold an infra.ts file.
infra-ts login Authenticate provider accounts when supported.
infra-ts link Bind account scopes such as orgs or teams into .infra.<env>.
infra-ts plan Read live state and preview changes.
infra-ts apply Reconcile live resources to match infra.ts.
infra-ts status Show live existence and pending drift.
infra-ts checkout Pull typed env outputs into .env.<env>.
infra-ts destroy Tear down all resources bound to the current environment.
infra-ts run -- <cmd> Run a child process with resolved env injected.

Global flags

infra-ts plan --env preview
infra-ts apply --only web db
infra-ts status --json
infra-ts --cwd ./apps/web plan

Safe defaults

plan is read-only. destroy prompts unless --yes is passed. checkout guards against drift unless you opt into ignoring it.

infra-ts checkout --ignore-diff
infra-ts destroy --env preview --yes

SDK shape

Everything the CLI does is also available through the runtime SDK:

import { apply, loadConfig, plan } from "infra-ts";

const loaded = await loadConfig({ cwd: process.cwd() });
const report = await plan(loaded.infra, { rootDir: loaded.rootDir });

if (report.changes.length > 0) {
	await apply(loaded.infra, { rootDir: loaded.rootDir });
}

Was this page helpful?