vanguard-plugin-sdk

Crates.iovanguard-plugin-sdk
lib.rsvanguard-plugin-sdk
version0.1.4
created_at2025-03-17 12:55:01.974891+00
updated_at2025-03-17 22:11:43.740246+00
descriptionSDK for developing Vanguard plugins
homepage
repositoryhttps://github.com/find-how/pioneer-vanguard
max_upload_size
id1595441
size28,010
Rick Cohen (rickco75)

documentation

https://docs.rs/vanguard-plugin-sdk

README

Vanguard Plugin SDK

Development SDK for creating plugins for the Vanguard version manager.

This SDK provides utilities, macros, and templates for easily creating plugins that can be loaded and used by the Vanguard version manager.

Features

  • Helper macros for implementing plugins
  • Template generation for new plugins
  • Type-safe plugin configuration
  • Full integration with Vanguard's plugin system

Usage

Creating a new plugin

Use the Vanguard CLI:

vanguard plugin create my-plugin --description "My custom plugin" --author "Your Name"

Manual implementation

use serde::{Deserialize, Serialize};
use vanguard_plugin_sdk::{metadata, plugin, plugin_config, PluginMetadata, PluginMetadataBuilder};

#[derive(Debug, Serialize, Deserialize)]
pub struct MyPluginConfig {
    pub value: String,
}

plugin_config!(MyPluginConfig, serde_json::json!({
    "type": "object",
    "required": ["value"],
    "properties": {
        "value": {
            "type": "string",
            "description": "Example configuration value"
        }
    }
}));

#[derive(Debug)]
pub struct MyPlugin {
    metadata: PluginMetadata,
    config: Option<MyPluginConfig>,
}

impl MyPlugin {
    pub fn new() -> Self {
        Self {
            metadata: metadata()
                .name("my-plugin")
                .version("0.1.0")
                .description("My custom plugin")
                .author("Your Name")
                .build(),
            config: None,
        }
    }
}

plugin!(MyPlugin, MyPluginConfig);

License

MIT

Commit count: 0

cargo fmt