Skip to main content

Crate progit_plugin_sdk

Crate progit_plugin_sdk 

Source
Expand description

§ProGit Plugin SDK

LSL-1.0 licensed SDK for building ProGit plugins in Lua or WASM.

§Architecture

The SDK is the single contract between the ProGit TUI core (LCL-1.0) and community / commercial plugins. The SDK itself is LSL-1.0 (file-level copyleft + explicit patent grant) so corporations can ship closed plugins without license contagion. Modifications to SDK files stay open.

§Plugin Types

  • Lua Plugins — lightweight scripting via LuaJIT, sandboxed by default.
  • WASM Plugins — high-performance compiled plugins, available behind the wasm feature flag. Off by default to keep the binary lean.

§v0.2 Highlights

  • One canonical event::PluginEvent enum (host no longer redefines it).
  • LuaJIT runtime is sandboxed: dangerous stdlib (os.execute, io.popen, package.loadlib, debug) is dropped by default.
  • Per-plugin memory limits and instruction caps via lua::LuaPluginOptions.
  • Injected log and storage globals so plugins do not have to invent their own logging or persistence.
  • Per-plugin failure isolation with quarantine after N consecutive errors.
  • SDK API versioning + capability declarations on the plugin metadata.

§Example

use progit_plugin_sdk::prelude::*;

let mut plugin = LuaPlugin::load("plugins/my-plugin.lua")?;
let context = PluginContext {
    repo_path: "/path/to/repo".into(),
    user: Some("developer".into()),
    env: Default::default(),
    config: Default::default(),
};
plugin.init(&context)?;

if plugin.supports_hook(&PluginHook::OnIssueCreated) {
    let data = serde_json::json!({"id": "123", "title": "Bug fix"});
    plugin.execute_hook(&PluginHook::OnIssueCreated, &data)?;
}

Modules§

contributions
Plugin contribution contract.
event
Canonical plugin event model.
lua
Sandboxed LuaJIT plugin runtime.
manifest
Plugin manifest (.progit-plugin.json) — typed mirror.
prelude
Convenience re-exports for plugin development.
render
Render-time plugin contract — synchronous highlight requests.
storage
Plugin storage API
traits
Plugin trait definitions

Constants§

SDK_API_VERSION
SDK API contract version. Plugins declare a compatible version in their metadata; the loader rejects plugins with a mismatched major.
VERSION
Plugin SDK semantic version (taken from Cargo.toml at build time).