gravityfile_plugin/lib.rs
1//! Language-agnostic plugin system for gravityfile.
2//!
3//! This crate provides a trait-based plugin architecture that supports multiple
4//! scripting language runtimes (Lua, Rhai, and WASM).
5//!
6//! # Architecture
7//!
8//! The plugin system is built around the [`PluginRuntime`] trait, which defines
9//! the interface that any scripting language runtime must implement. This allows
10//! users to write plugins in their preferred language.
11//!
12//! # Plugin Types
13//!
14//! - **Analyzers**: Custom file/directory analysis (async, returns data)
15//! - **Previewers**: File content preview generation (async, isolated)
16//! - **Actions**: Custom file operations (async with progress)
17//! - **Renderers**: Custom column/cell rendering (sync)
18//! - **Filters**: Search/filter plugins (sync/async)
19//! - **Hooks**: Event listeners (sync callbacks)
20//!
21//! # Example
22//!
23//! ```ignore
24//! use gravityfile_plugin::{PluginManager, PluginConfig};
25//!
26//! let config = PluginConfig::default();
27//! let mut manager = PluginManager::new(config)?;
28//!
29//! // Load plugins from user config directory
30//! manager.discover_plugins().await?;
31//!
32//! // Dispatch a hook to all registered plugins
33//! manager.dispatch_hook(&Hook::OnScanComplete { tree }).await?;
34//! ```
35
36mod config;
37mod hooks;
38pub mod lua;
39pub mod rhai;
40mod runtime;
41mod sandbox;
42mod types;
43pub mod wasm;
44
45pub use config::{PluginConfig, PluginMetadata};
46pub use hooks::{Hook, HookContext, HookResult};
47pub use runtime::{IsolatedContext, PluginHandle, PluginManager, PluginRuntime};
48pub use sandbox::{Permission, SandboxConfig};
49pub use types::{PluginError, PluginKind, PluginResult, Value};