Runtime config files allow repository owners to define custom rendering rules and profiles that are specific to their project. When kat is run, it searches for a runtime config file starting from the target path and walking up the directory tree.
The following file names are recognized (in order of precedence):
.katrc.yamlkatrc.yaml.katrc.ymlkatrc.yml
Because runtime configurations can define arbitrary rendering commands, kat implements a trust system to protect users from potentially malicious configurations.
When a runtime config file is found in an untrusted project:
- Interactive mode: A prompt asks the user to trust or skip the runtime configuration
- Non-interactive mode: The runtime configuration is skipped with a warning
You can control trust behavior without prompting using CLI flags:
| Flag | Description |
|---|---|
--trust |
Trust the runtime configuration without prompting (adds to trust list) |
--no-trust |
Skip the runtime configuration without prompting |
These flags are mutually exclusive.
Trusted projects are stored in a policy.yaml file in your config directory, under projects.trust:
# yaml-language-server: $schema=https://jacobcolvin.com/kat/schemas/policies.v1beta1.json
apiVersion: kat.jacobcolvin.com/v1beta1
kind: Policy
projects:
trust:
- path: /path/to/trusted/project
- path: /another/trusted/projectRuntime configurations use kind: RuntimeConfig and can define rules and/or profiles.
# yaml-language-server: $schema=https://jacobcolvin.com/kat/schemas/runtimeconfigs.v1beta1.json
apiVersion: kat.jacobcolvin.com/v1beta1
kind: RuntimeConfig
rules:
- match: <expression>
profile: <profile name>
profiles:
<profile name>:
command: <cmd>
args: [<arg>]When a runtime configuration is loaded, it merges with the global configuration:
- Profiles: Runtime profiles override global profiles with the same key
- Rules: Runtime rules are prepended to global rules (i.e. they are evaluated first)
This allows projects to override specific profiles while falling back to global defaults for others.
A project that adds a custom profile for a specific tool:
# yaml-language-server: $schema=https://jacobcolvin.com/kat/schemas/runtimeconfigs.v1beta1.json
apiVersion: kat.jacobcolvin.com/v1beta1
kind: RuntimeConfig
rules:
- match: >-
files.exists(f, pathExt(f) == ".jsonnet")
profile: jsonnet
profiles:
jsonnet:
source: >-
files.filter(f, pathExt(f) in [".jsonnet", ".libsonnet"])
command: jsonnet
args: ["-y", "main.jsonnet"]- Runtime configurations can execute arbitrary commands defined in profiles
- Always review runtime config files before trusting a project
- Use
--no-trustin CI/CD pipelines or automated environments where you want to use only the global configuration - The trust prompt displays the full path to both the configuration file and project directory