Skip to content

CLI Reference

Krait edited this page May 28, 2026 · 1 revision

The KOSL CLI utility (kosl) is the companion tool to parse, check, format, and transpile KOSL configuration files.

Installation

Ensure you have a working Rust toolchain. Run:

cargo install --path crates/kosl-cli

Available Subcommands

1. parse

Analyzes a KOSL file and displays its validated Abstract Syntax Tree (AST) output. This is useful for debugging syntax configurations.

kosl parse file.kosl

2. transpile

Translates a valid KOSL configuration into TOML syntax. It is primarily used to map Cargo.kosl to Cargo.toml.

# Output format defaults to replacing the extension with .toml
kosl transpile Cargo.kosl

# Specify a custom output path
kosl transpile Cargo.kosl --output Cargo.toml

Error Handling & Diagnostics

The CLI provides clear diagnostics for malformed inputs. Common syntax validation errors include:

  • Duplicate Key Errors: Under the KOSL specification, keys inside the same object scope cannot be redefined.
    Error: Duplicate key strictly prohibited: 'dependencies'
    
  • Type Ambiguity: Catching invalid float representations and missing object closing tags.

Clone this wiki locally