aiwg
Version:
Deployment tool and support utility for AI context. Copies agents, skills, commands, rules, and behaviors into the paths each AI platform reads (Claude Code, Codex, Copilot, Cursor, Warp, OpenClaw, and 6 more) so one source of truth works across 10 platfo
149 lines • 4.24 kB
TypeScript
/**
* Plugin Registry Validator
*
* Validates registry consistency with filesystem, detects orphaned/missing plugins,
* and validates cross-framework references.
*
* @module src/plugin/registry-validator
* @implements @.aiwg/requirements/use-cases/UC-011-validate-plugin-security.md
* @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
* @adr @.aiwg/architecture/decisions/ADR-002-plugin-isolation-strategy.md
* @tests @test/unit/plugin/registry-validator.test.ts
* @depends @src/plugin/metadata-validator.ts
*/
/**
* Registry entry structure
*/
export interface RegistryEntry {
id: string;
type: 'framework' | 'add-on' | 'extension';
name: string;
version: string;
path: string;
installedAt: string;
parentFramework?: string;
projects?: string[];
health?: {
status: 'healthy' | 'warning' | 'error';
lastCheck: string;
issues?: string[];
};
}
/**
* Registry structure
*/
export interface Registry {
version: string;
lastModified: string;
plugins: RegistryEntry[];
}
/**
* Validation issue
*/
export interface ValidationIssue {
type: 'error' | 'warning';
category: 'orphaned' | 'missing' | 'mismatch' | 'invalid-ref' | 'stale-health';
pluginId?: string;
path?: string;
message: string;
suggestion?: string;
}
/**
* Validation result
*/
export interface RegistryValidationResult {
valid: boolean;
issues: ValidationIssue[];
stats: {
totalPlugins: number;
healthyPlugins: number;
orphanedPlugins: number;
missingPlugins: number;
invalidRefs: number;
};
}
/**
* Validation options
*/
export interface RegistryValidationOptions {
/** Check that filesystem directories match registry entries */
checkFilesystem?: boolean;
/** Check parent framework references are valid */
checkFrameworkRefs?: boolean;
/** Check health status is not stale (older than threshold) */
checkHealthStaleness?: boolean;
/** Health staleness threshold in hours (default: 24) */
healthStaleThresholdHours?: number;
/** Auto-fix issues where possible */
autoFix?: boolean;
}
/**
* RegistryValidator validates plugin registry consistency
*/
export declare class RegistryValidator {
private registryPath;
private aiwgRoot;
private options;
constructor(aiwgRoot: string, options?: RegistryValidationOptions);
/**
* Validate the entire registry
*
* @returns Validation result with issues and stats
*/
validate(): Promise<RegistryValidationResult>;
/**
* Validate a single plugin entry
*
* @param plugin - Plugin registry entry
* @returns Array of validation issues
*/
private validatePlugin;
/**
* Find directories in the plugins folder that aren't in the registry
*
* @param registry - Current registry
* @returns Array of validation issues for orphaned directories
*/
private findOrphanedDirectories;
/**
* Validate parent framework references
*
* @param registry - Current registry
* @returns Array of validation issues for invalid references
*/
private validateFrameworkReferences;
/**
* Validate registry against filesystem and return consistency status
*
* @returns True if registry and filesystem are consistent
*/
isConsistent(): Promise<boolean>;
/**
* Get orphaned plugins (in registry but not filesystem)
*
* @returns Array of orphaned plugin IDs
*/
getOrphanedPlugins(): Promise<string[]>;
/**
* Get missing plugins (in filesystem but not registry)
*
* @returns Array of directory paths not in registry
*/
getMissingPlugins(): Promise<string[]>;
/**
* Generate a validation report
*
* @param format - Report format (text or json)
* @returns Formatted report string
*/
generateReport(format?: 'text' | 'json'): Promise<string>;
/**
* Load and parse registry file
*/
private loadRegistry;
/**
* Generate text format report
*/
private generateTextReport;
}
//# sourceMappingURL=registry-validator.d.ts.map