Overview

June 25, 2026 · View on GitHub

Rust parser and renderer for K9 self-validating configuration files — declares software components with provenance tracking, security classification, build recipes, and runtime contracts.

Overview

K9 is a configuration format for software component declarations. Each component carries:

  • Pedigree — provenance: origin URL, author, license, supply-chain hashes

  • SecurityLevel — Kennel / Yard / Hunt (same three-tier model as K9 Nickel components)

  • Recipe — build or assembly instructions (tool + command)

  • Contracts — runtime invariants with check commands and severity levels

k9-rs supports two surface formats:

  • .k9 — YAML-like plain-text format parsed natively

    * .k9.ncl — Nickel format; detected and returned as `K9Error
    NickelFormat` (requires the Nickel evaluator — use pandoc-k9 for Nickel K9 files)

    == Quick Start

use k9_svc::parser::parse;
use k9_svc::renderer::render;

let input = r#"component: my-svc
  version: 0.1.0
  pedigree:
    origin: https://github.com/example/svc
    author: Alice
  security: kennel
"#;

let components = parse(input)?;
let output = render(&components)?;

Security Levels

LevelMeaning
kennelData-only. No execution. Strict sandbox. Safe to parse anywhere.
yardNickel evaluation + limited I/O. Capability-based sandbox.
huntFull shell execution via recipes. Cryptographic signature required.

Modules

ModulePurpose
typesComponent, Pedigree, SecurityLevel, Recipe, Contract
parserparse(str) Vec<Component> — detects Nickel format
rendererrender(&[Component]) String
errorK9Error: ParseError, NickelFormat, Io, RenderError

Related

License

MPL-2.0 (MPL-2.0 preferred; MPL-2.0 required for crates.io). See LICENSE.