Skip to main content

write_ai_plugin_json

Function write_ai_plugin_json 

Source
pub fn write_ai_plugin_json(
    ctx: &PluginContext,
    cfg: &SsgConfig,
) -> Result<(), SsgError>
Expand description

Render and write .well-known/ai-plugin.json under ctx.site_dir.

§Errors

Returns SsgError::Io if the .well-known directory cannot be created or the manifest cannot be written.

§Examples

use ssg::cmd::SsgConfig;
use ssg::plugin::PluginContext;
use ssg::postprocess::agentic_discovery::write_ai_plugin_json;
let tmp = tempfile::tempdir().unwrap();
let cfg = SsgConfig::builder()
    .site_name("Example".into())
    .base_url("https://example.com".into())
    .build()
    .unwrap();
let ctx = PluginContext::new(tmp.path(), tmp.path(), tmp.path(), tmp.path());
write_ai_plugin_json(&ctx, &cfg).unwrap();
assert!(tmp.path().join(".well-known/ai-plugin.json").exists());