CLI

The kikx binary, built from cli/. It reads and writes the filesystem directly and needs no running backend.

kikx <COMMAND>

Command

Purpose

Reads kikx.toml

Writes kikx.toml

init

Create a project

no

yes

add

Render one component into the output directory

yes

no

list

Print the built-in components

no

no

presets

Print the built-in preset templates

no

no

setup

Create a project from a preset template, file or URL

no

yes

apply

Render a preset template, file or URL into an existing directory

no

no

diff

Show what add or apply would change, without writing

for a component

no

upgrade

Replace kikx with the latest release

no

no

Global options:

Option

Effect

-h, --help

Print help

-V, --version

Print the version, for example kikx 0.4.0

All paths are resolved against the current working directory. The CLI reads no environment variables.

kikx --help lists each command with a one-line description:

Vendor real, editable infrastructure files into your project

Usage: kikx <COMMAND>

Commands:
  init     Create kikx.toml in the current directory
  add      Render a component and write its files into the project
  list     List the built-in components with their fields
  presets  List the built-in preset templates
  setup    Bootstrap a new project from a preset template, file or URL
  apply    Vendor a preset template, file or URL into an existing project
  diff     Show what add or apply would change in the project, without writing
  help     Print this message or the help of the given subcommand(s)

Options:
  -h, --help     Print help
  -V, --version  Print version

kikx <COMMAND> --help prints the same description above the command’s usage.

Exit status

Status

Cause

0

Success

1

Operation error. The message is printed to stderr as Error: <message>, followed by Caused by: lines when present

2

Argument parsing error, for example a missing required option, a --label or --set value without =, or a number out of range

kikx init

kikx init [OPTIONS]

Writes kikx.toml in the current directory and creates the output directory.

Option

Type

Default

Description

-n, --name <NAME>

string

name of the current directory, or kikx-project when it has none

Project name, stored as project.name

-d, --dir <DIR>

path

infra

Output directory, stored as project.output_dir

-N, --namespace <NAMESPACE>

string

default

Default namespace, stored as project.default_namespace

-f, --force

flag

off

Overwrite an existing kikx.toml

Condition

Result

kikx.toml exists, no --force

Exit 1: kikx.toml already exists in <dir>. Pass --force to overwrite

kikx.toml exists, --force

kikx.toml is replaced. Files already in the output directory are kept

Output on success:

Initialized kikx project `demo`. Vendor components with `kikx add <category>/<component>` (see `kikx list`)

kikx add

kikx add [OPTIONS] --name <NAME> <REFERENCE>

Renders one component with the project’s default_namespace and writes its files under the project’s output_dir.

Argument

Description

<REFERENCE>

Built-in reference (k8s/deployment), URL, or local path to a registry-item.json. See Registry item format

Option

Type

Default

Sets field

-n, --name <NAME>

string

required

name in the template context

-i, --image <IMAGE>

string

registry default

image

-r, --replicas <REPLICAS>

unsigned 32-bit integer

registry default

replicas

-p, --port <PORT>

integer 0 to 65535

registry default

port

-t, --target-port <TARGET_PORT>

integer 0 to 65535

registry default

target_port

-N, --namespace <NAMESPACE>

string

project.default_namespace

namespace

-H, --host <HOST>

string

registry default

host

-P, --path <PATH>

string

registry default

path

-S, --service <SERVICE>

string

registry default

service

-l, --label <KEY=VALUE>

key/value, repeatable

app=<name>

an entry of labels

-s, --set <KEY=VALUE>

key/value, repeatable

field KEY

-f, --force

flag

off

Overwrite existing files

Field precedence, highest first: --set, the dedicated option (--image, --port, …), the registry default. A later --set for the same key wins over an earlier one. --label app=<value> replaces the default app label.

The dedicated options set their field on any component. A field the component does not declare is still passed to the template.

Condition

Result

No kikx.toml in the current directory

Exit 1: no kikx.toml found in <dir>. Run `kikx init` first

Unknown reference

Exit 1: `<reference>` isn't a built-in component, and isn't a URL or existing local file. Run `kikx list` to see built-ins, or pass a URL/path to a registry-item.json

Required field missing with no default

Exit 1: field `<field>` is required for <reference>

A field with a format has an invalid value

Exit 1: field `<field>` of <reference>: <reason>, where the reason names the corrected value when there is one. No file is written

Rendered path is absolute

Exit 1: refusing to write `<path>`: absolute paths are not allowed

Rendered path leaves the output directory

Exit 1: refusing to write `<path>`: it escapes the target directory

A target file exists, no --force

Exit 1: <path> already exists. Pass --force to overwrite. No file is written

Template error

Exit 1 with the template engine message

Output on success, one line per file:

Vendored /home/user/demo/infra/web-deployment.yaml

Example:

kikx add k8s/deployment --name web --image nginx:1.27 --replicas 3 --label tier=frontend --set port=8080

kikx list

kikx list

Prints every built-in component with its fields. Takes no options besides --help. Does not need kikx.toml.

Each field line shows, when present: required, default <value> (omitted for an empty default), e.g. <example>, format <format>, one of <options>.

Available components:

  k8s/deployment: Pods running one container image.
      --set image=…  (required; e.g. nginx:1.27)
      --set replicas=…  (default 1)
      --set port=…  (default 80)

The full list is in Components.

kikx presets

kikx presets

Prints every built-in preset template with its name, title, component count and description. Takes no options besides --help. Does not need kikx.toml.

Preset templates:

  k8s-web-app: Kubernetes web app (7 components)
      A web frontend and an API behind ingresses, plus a background worker.

  single-server: Single server with Ansible (7 components)
      One DigitalOcean droplet, configured by a common role through a site playbook.

  kubeadm-cluster: Kubernetes cluster with kubeadm (11 components)
      Hetzner servers bootstrapped into a three-node control plane and three workers.

  web-and-database: Web servers and a database (13 components)
      Existing servers split into a web tier and a PostgreSQL primary with a replica.

  multi-tier-platform: Multi-tier platform (35 components)
      A storefront platform: edge load balancers, web/app tiers, PostgreSQL primary + replicas, Redis, monitoring and a Kubernetes cluster.

Start one with `kikx setup <name>`, or add it to a project with `kikx apply <name>`.

The name in the first column is what setup and apply accept. The templates are described in Preset format.

kikx setup

kikx setup [OPTIONS] <REFERENCE>

Renders every component of a preset into the preset’s output directory, then writes kikx.toml.

Argument

Description

<REFERENCE>

Template name (see kikx presets), URL (http:// or https://) or local path to a preset file. See Preset format

Option

Type

Default

Description

-f, --force

flag

off

Overwrite an existing kikx.toml and existing files

Values taken from the preset’s project object:

kikx.toml key

From

When project is absent

name

project.name, else the current directory name

current directory name

default_namespace

project.namespace (default default)

default

output_dir

project.outputDir (default infra)

infra

Condition

Result

kikx.toml exists, no --force

Exit 1, nothing written

Reference is not a template name, a URL or an existing file

Exit 1: `<reference>` isn't a template name, a URL or an existing local file. Run `kikx presets` to see the templates

Preset does not parse

Exit 1: <reference> is not a valid kikx preset manifest

Two components render the same path

Exit 1: two files rendered to the same path: `<path>`

A target file exists, no --force

Exit 1, no file and no kikx.toml written

Output on success:

Initialized kikx project `multi-tier-platform`: wrote 77 file(s) to /home/user/demo/infra
  /home/user/demo/infra/lb-hetzner.tf
  ...

Example, starting from a template:

kikx setup single-server

kikx apply

kikx apply [OPTIONS] <REFERENCE>

Renders every component of a preset into the current directory, or into --into. Never reads or writes kikx.toml. The namespace is project.namespace from the preset, else default. The preset’s project.outputDir is not used.

Argument

Description

<REFERENCE>

Template name, URL or local path to a preset file

Option

Type

Default

Description

-i, --into <INTO>

path

current directory

Directory to write into, joined to the current directory

-f, --force

flag

off

Overwrite existing files

Error conditions are those of setup, except the kikx.toml check.

Output on success:

Vendored 77 file(s):
  /home/user/repo/vendor/lb-hetzner.tf
  ...

Example, adding a template to an existing repo:

kikx apply k8s-web-app --into deploy/k8s

kikx diff

kikx diff [OPTIONS] <REFERENCE>

Renders like add or apply and compares the result with the files on disk. Nothing is written. Use it to preview an upgrade or a field change before passing --force.

With --name, <REFERENCE> is a component and accepts the same field and label options as add; files are compared under the output directory from kikx.toml. Without --name, <REFERENCE> is a preset and files are compared under the current directory, or --into.

Option

Type

Default

Description

-n, --name <NAME>

string

none

Component name. Field and label options require it

--into <INTO>

path

current directory

Preset only: directory to compare against

Each rendered file is reported as Added (not on disk yet), Modified (followed by a unified diff from the file on disk to the new render) or Unchanged, then a summary line. Path checks are those of the write rules.

Example:

kikx diff k8s/deployment --name web --image nginx:1.28
Modified  infra/web-deployment.yaml
@@ -19,6 +19,6 @@
     spec:
       containers:
         - name: web
-          image: nginx:1.27
+          image: nginx:1.28
           ports:
             - containerPort: 80

0 added, 1 modified, 0 unchanged. Nothing was written.

Write rules

add, setup and apply validate every rendered path before writing any file:

  1. Absolute paths are refused.

  2. A path whose .. components climb above the target directory at any point is refused.

  3. Two files with the same path are refused.

  4. Without --force, any existing target file stops the operation before the first write.

Parent directories are created as needed.

kikx upgrade

kikx upgrade [OPTIONS]

Downloads the release for this system from the project’s GitHub releases and replaces the running kikx binary. Does not need kikx.toml.

Option

Type

Default

Effect

-c, --check

flag

off

Only report whether a newer release exists

-v, --version <VERSION>

version

latest

Install this release instead, for example 0.2.0

Upgrading kikx 0.2.0 to 0.3.0
Extracting archive... Done
Replacing binary file... Done
kikx is now 0.3.0.

When no newer release exists it prints kikx <version> is the latest version. Releases are published for macOS arm64 and x64, Linux x64 and arm64, and Windows x64; on other systems it stops with no kikx release is published for this platform. If the binary sits in a directory you cannot write to, such as /usr/local/bin, run it with sudo.

See also