@felixgeelhaar/cclint
Version:
A comprehensive linter for CLAUDE.md files with multi-language code block validation
99 lines • 3.11 kB
TypeScript
import type { Plugin, PluginModule } from '../domain/CustomRule.js';
import type { RuleRegistry } from './RuleRegistry.js';
import type { PluginConfig } from '../domain/Config.js';
/**
* Result of plugin loading operation
*/
export interface PluginLoadResult {
loaded: string[];
failed: Array<{
name: string;
error: Error;
}>;
}
/**
* Handles dynamic loading and management of custom rule plugins
*/
export declare class PluginLoader {
private loadedPlugins;
private registry;
private sandbox;
private pathValidator;
private trustedPlugins;
constructor(registry: RuleRegistry);
/**
* Dynamic import wrapper with security checks
*/
protected importPlugin(pluginName: string): Promise<PluginModule>;
/**
* Check if a plugin is from a trusted source
*/
private isPluginTrusted;
/**
* Load a single plugin by name
* @param pluginName The name/path of the plugin to load
* @param options Optional configuration for the plugin
*/
loadPlugin(pluginName: string, _options?: Record<string, unknown>): Promise<void>;
/**
* Check if a plugin name is already loaded
*/
private isPluginNameLoaded;
/**
* Check plugin for potential security issues
*/
private checkPluginSecurity;
/**
* Load multiple plugins from configuration
* @param pluginConfigs Array of plugin configurations
* @returns Result object with loaded and failed plugins
*/
loadPluginsFromConfig(pluginConfigs: PluginConfig[]): Promise<PluginLoadResult>;
/**
* Unload a plugin and all its rules
* @param pluginName The name of the plugin to unload
*/
unloadPlugin(pluginName: string): void;
/**
* Check if a plugin is currently loaded
* @param pluginName The name of the plugin to check
* @returns True if the plugin is loaded
*/
isPluginLoaded(pluginName: string): boolean;
/**
* Get information about a loaded plugin
* @param pluginName The name of the plugin
* @returns Plugin information or undefined if not loaded
*/
getPluginInfo(pluginName: string): Plugin | undefined;
/**
* Get all loaded plugin names
* @returns Array of loaded plugin names
*/
getLoadedPlugins(): string[];
/**
* Reload a plugin (unload and load again)
* @param pluginName The name of the plugin to reload
* @param options Optional new configuration
*/
reloadPlugin(pluginName: string, _options?: Record<string, unknown>): Promise<void>;
/**
* Validate plugin structure and requirements
* @param plugin The plugin to validate
* @param pluginName The name of the plugin for error messages
*/
private validatePlugin;
/**
* Get statistics about loaded plugins
*/
getStats(): {
loadedPlugins: number;
totalRulesFromPlugins: number;
pluginDetails: Array<{
name: string;
version: string;
rules: number;
}>;
};
}
//# sourceMappingURL=PluginLoader.d.ts.map