bookclerk_plugin_manifest::fmt

Development These docs follow the development version and change with every merge.

Last updated View as Markdown

Canonical plugin.toml formatting for SDK fmt / fmt --check.

Serializes a validated crate::PluginManifest with toml::to_string_pretty and ensures a trailing newline so fmt --check diffs stay stable across tools.

Functions

format_manifest

pub fn format_manifest(manifest: &PluginManifest) -> Result<String>

Serializes a validated manifest to canonical TOML.

The output is suitable for rewriting plugin.toml on disk or comparing against the on-disk file in fmt --check. Field order and pretty-print style follow toml crate defaults; a trailing \n is always present.

Arguments

Returns

Pretty-printed TOML ending with a newline.

Errors

Returns crate::Error::TomlSer when serialization fails.

Examples

use bookclerk_plugin_manifest::{format_manifest, parse};

let m = parse(r#"
api_version = 3
id = "echo"
runtime = "native"
command = "./echo"
entrypoints = ["cli"]

[capabilities.network]
mode = "deny"
"#).unwrap();
let formatted = format_manifest(&m).unwrap();
assert!(formatted.ends_with('\n'));
assert_eq!(parse(&formatted).unwrap(), m);

Generated from crates/bookclerk-plugin-manifest at main · View as Markdown