Skip to content
Docs menu / cli

@konfig.ts/cli

@konfig.ts/cli ships the konfig binary, the command-line front-end to the rest of konfig.ts (@konfig.ts/core, @konfig.ts/argocd, and @konfig.ts/docker). When you run it, it finds your konfig.json, imports the entry file for the requested env, runs the app-of-apps program that file exports, and writes the resulting YAML into the configured output directory. The package is a bin only; there is no library entrypoint to import.

Install

Terminal window
bun add -d @konfig.ts/cli # in a workspace that uses konfig.ts
bunx @konfig.ts/cli --help # or run once without installing

Usage

Terminal window
konfig build prod # render manifests to outDir; input-hashed, a no-op build rewrites nothing
konfig validate prod --strict
konfig diff prod --format detail
konfig set prod api ghcr.io/example/api:1.2.3

Every command starts by walking up from the current directory until it finds a konfig.json. An env is a named render target such as prod or staging. Its entry file is whatever envs.<name>.entry points to in konfig.json, and defaults to <root>/env/<name>.ts. That module’s default export must be a program created with AppOfApps.fromModules.

Surface

CommandPurpose
konfig build <env>Render manifests to outDir.manifests; --log text|json, --verbose, --no-cache
konfig validate <env>Render in memory and run structural checks; --strict adds kubeconform, --ignore-missing-schemas
konfig diff <env>Structural diff against diff.baseline; --format summary|detail|json; Secret data is redacted
konfig set <env> <app> <image>Update one image ref in images.json
konfig crd extract|verifyCRD TypeScript codegen from Helm charts (--release <id> or --all) and drift check
konfig helm fetch --allPre-fetch chart tarballs into helm.cacheDir
konfig docker preview|write|diff <target>Dockerfile generation via @konfig.ts/docker; --prod-only, --dev-only; write adds --out-dir, --force; diff adds --format
konfig graph [target]Print the workspace dependency graph; --with-dev, --full, --width <n>

The three rendering commands (build, validate, diff) accept a shared set of flags that your program can read from its RenderContext:

FlagMeaning
--cluster <name>Which cluster the render targets
--k8s-version <ver>The Kubernetes version to render for
--flag k=vRepeatable free-form key/value pairs, exposed as ctx.flags (a Map)

Errors

The CLI raises tagged errors so that each failure mode has a stable name. Render-time failures are not listed here; they propagate as AnyRenderError from @konfig.ts/core.

ErrorWhen it is raised
ConfigNotFoundNo konfig.json found walking up from the cwd
ConfigParseErrorkonfig.json exists but did not decode
EnvEntryNotFoundThe env’s entry file does not exist
EnvLoadErrorImporting the env entry file failed
WriteEnvErrorWriting rendered output for the env failed
StructuralValidationFailedvalidate found structural problems
KubeconformNotFoundvalidate --strict could not find kubeconform
KubeconformReportErrorkubeconform reported failures
DiffBaselineMissingdiff has no diff.baseline to compare against
DiffNonEmptydiff found differences (non-zero exit)
SetUnknownEnvset was given an env not present in images.json
SetUnknownAppset was given an app not present for that env
ImagesFileErrorimages.json could not be read, decoded, or written
ReleaseNotFoundcrd --release <id> named an unknown release
MissingCrdFlagscrd was run without --release or --all
CrdDriftcrd verify found generated types out of date
MissingAllFlaghelm fetch was run without --all
SpecImportErrorA docker.ts spec could not be imported
SpecNotADockerAppThe imported spec’s default export is not a Docker.app
DiffDriftdocker diff found the on-disk Dockerfiles drifted
GraphTargetNotFoundgraph was given an unknown workspace target
BuildCacheErrorThe build’s input-hash cache could not be read or written
ChartRegistryErrorLoading the chart registry under charts/ failed
ChartRegistryEntryDecodeErrorA chart registry entry did not decode
CrdInputDecodeErrorInput for CRD extraction did not decode

Requirements

  • Depends on effect@^4.0.0-rc.111 and @effect/platform-node directly (Effect 4, release-candidate line), plus @konfig.ts/core, @konfig.ts/argocd, @konfig.ts/docker, json-schema-to-typescript, and semver. No peer dependencies.
  • External tools, only when the corresponding command needs them: helm, kubeconform (validate --strict), sops, kubeseal.

Source and README: packages/cli.