Skip to main content

generate

Function generate 

Source
pub fn generate(
    target_version: u32,
    opts: &GenerateOptions<'_>,
) -> Result<String, Error>
Expand description

Generate a canonical TOML config at target_version, derived by running the V1 fixture forward through the typed migration chain.

target_version must be in 1..=CURRENT_SCHEMA_VERSION. The chain is the same one used to migrate real on-disk configs — V1 fixture → V1Config::migrate → V2 typed value → V2Config::migrate → V3 typed value — so generate <n> shows exactly the shape an operator running zeroclaw config migrate would land on if they started from the V1 fixture.

When GenerateOptions::encrypt_secrets is set, secret-bearing string values (api_key, bot_token, access_token, etc. — see [SECRET_KEY_NAMES]) are ChaCha20-Poly1305-encrypted with the .secret_key under secret_store_dir. Works at every version.