@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
bun add -d @konfig.ts/cli # in a workspace that uses konfig.tsbunx @konfig.ts/cli --help # or run once without installingUsage
konfig build prod # render manifests to outDir; input-hashed, a no-op build rewrites nothingkonfig validate prod --strictkonfig diff prod --format detailkonfig set prod api ghcr.io/example/api:1.2.3Every 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
| Command | Purpose |
|---|---|
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|verify | CRD TypeScript codegen from Helm charts (--release <id> or --all) and drift check |
konfig helm fetch --all | Pre-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:
| Flag | Meaning |
|---|---|
--cluster <name> | Which cluster the render targets |
--k8s-version <ver> | The Kubernetes version to render for |
--flag k=v | Repeatable 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.
| Error | When it is raised |
|---|---|
ConfigNotFound | No konfig.json found walking up from the cwd |
ConfigParseError | konfig.json exists but did not decode |
EnvEntryNotFound | The env’s entry file does not exist |
EnvLoadError | Importing the env entry file failed |
WriteEnvError | Writing rendered output for the env failed |
StructuralValidationFailed | validate found structural problems |
KubeconformNotFound | validate --strict could not find kubeconform |
KubeconformReportError | kubeconform reported failures |
DiffBaselineMissing | diff has no diff.baseline to compare against |
DiffNonEmpty | diff found differences (non-zero exit) |
SetUnknownEnv | set was given an env not present in images.json |
SetUnknownApp | set was given an app not present for that env |
ImagesFileError | images.json could not be read, decoded, or written |
ReleaseNotFound | crd --release <id> named an unknown release |
MissingCrdFlags | crd was run without --release or --all |
CrdDrift | crd verify found generated types out of date |
MissingAllFlag | helm fetch was run without --all |
SpecImportError | A docker.ts spec could not be imported |
SpecNotADockerApp | The imported spec’s default export is not a Docker.app |
DiffDrift | docker diff found the on-disk Dockerfiles drifted |
GraphTargetNotFound | graph was given an unknown workspace target |
BuildCacheError | The build’s input-hash cache could not be read or written |
ChartRegistryError | Loading the chart registry under charts/ failed |
ChartRegistryEntryDecodeError | A chart registry entry did not decode |
CrdInputDecodeError | Input for CRD extraction did not decode |
Requirements
- Depends on
effect@^4.0.0-rc.111and@effect/platform-nodedirectly (Effect 4, release-candidate line), plus@konfig.ts/core,@konfig.ts/argocd,@konfig.ts/docker,json-schema-to-typescript, andsemver. No peer dependencies. - External tools, only when the corresponding command needs them:
helm,kubeconform(validate --strict),sops,kubeseal.
Source and README: packages/cli.