#sdk #vanguard #development #plugin

vanguard-plugin-sdk

SDK for developing Vanguard plugins

5 releases

new 0.1.4 Mar 17, 2025
0.1.3 Mar 17, 2025
0.1.2 Mar 17, 2025
0.1.1 Mar 17, 2025
0.1.0 Mar 17, 2025

#1659 in Development tools

43 downloads per month

MIT license

86KB
2K SLoC

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

Dependencies

~3–12MB
~137K SLoC