bookclerk_plugin_manifest::fmt
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.
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.
manifest- Manifest that has already passedPluginManifest::validate(typically fromPluginManifest::parse).
Pretty-printed TOML ending with a newline.
Returns crate::Error::TomlSer when serialization fails.
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