Skip to content

hyperpolymath/fslint-plugin-api

fslint-plugin-api

Rust 1.70+ MIT License RSR Tier 1

Plugin API for FSLint - trait definitions and core types for building file scanning plugins.

1. Overview

This crate provides the core trait and types needed to build plugins for FSLint (part of file-soup). It defines the Plugin trait that all scanner plugins must implement.

1.1. Features

  • Type-safe plugin interface - Strongly typed API prevents common errors

  • Rich result types - Detailed status and metadata for scan results

  • Zero dependencies - Minimal footprint for plugin development

  • RSR Tier 1 - First-class Rust support

2. Installation

Add to your Cargo.toml:

[dependencies]
fslint-plugin-api = "0.1"

3. Quick Start

use fslint_plugin_api::{Plugin, PluginContext, PluginResult, PluginMetadata, PluginError};

pub struct MyPlugin;

impl Plugin for MyPlugin {
    fn metadata() -> PluginMetadata {
        PluginMetadata {
            name: "my-plugin".into(),
            version: "0.1.0".into(),
            description: "My custom file scanner".into(),
            author: Some("Your Name".into()),
            enabled_by_default: true,
        }
    }

    fn check(&self, context: &PluginContext) -> Result<PluginResult, PluginError> {
        // Your plugin logic here
        Ok(PluginResult::active("my-plugin", "Found something"))
    }
}

4. API Reference

4.1. Core Trait

4.1.1. Plugin

The main trait all plugins must implement:

pub trait Plugin {
    fn metadata() -> PluginMetadata;
    fn check(&self, context: &PluginContext) -> Result<PluginResult, PluginError>;
}

4.2. Types

Type Description

Plugin

The main trait all plugins implement

PluginContext

Context passed to plugins (file path, metadata, etc.)

PluginResult

Result returned by plugin checks

PluginStatus

Status enum: Active, Inactive, Alert, Warning, Error, Skipped

PluginMetadata

Plugin name, version, description, author

PluginError

Error types for plugin operations

4.3. Status Types

pub enum PluginStatus {
    Active,    // Plugin found something noteworthy
    Inactive,  // Plugin ran but found nothing
    Alert,     // High-priority finding
    Warning,   // Medium-priority finding
    Error,     // Plugin encountered an error
    Skipped,   // Plugin skipped this file
}

6. License

MIT OR Apache-2.0

See LICENSE-MIT for details.

7. Contributing

Contributions welcome! Please read CONTRIBUTING.md first.

About

Plugin API for FSLint - trait definitions and core types for building file scanning plugins

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •