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
226 lines • 6.02 kB
TypeScript
/**
* Plugin Installation System
*
* Comprehensive installer supporting frameworks, add-ons, and extensions
* with dependency resolution, registry management, and atomic installation.
*
* Features:
* - Install from local path or plugin ID
* - Dependency resolution (add-ons require parent framework)
* - Automatic registry updates
* - Directory structure creation
* - Manifest validation
* - Atomic installation (rollback on failure)
* - Dry-run mode
*
* @module src/plugin/plugin-installer
* @implements @.aiwg/requirements/use-cases/UC-010-rollback-plugin-installation.md
* @architecture @.aiwg/architecture/software-architecture-doc.md - Section 5.1 PluginManager
* @adr @.aiwg/architecture/decisions/ADR-006-plugin-rollback-strategy.md
* @nfr @.aiwg/requirements/nfr-modules/reliability.md - NFR-REL-002 (zero data loss)
* @tests @test/unit/plugin/plugin-installer.test.ts
* @depends @src/plugin/metadata-validator.ts
* @depends @src/plugin/framework-config-loader.ts
*/
/**
* Plugin types
*/
export type PluginType = 'framework' | 'add-on' | 'extension';
/**
* Plugin manifest structure
*/
export interface PluginManifest {
/** Plugin identifier */
id: string;
/** Plugin type */
type: PluginType;
/** Human-readable name */
name: string;
/** Semantic version */
version: string;
/** Description */
description: string;
/** Author */
author?: string;
/** License */
license?: string;
/** Repository URL */
repository?: string;
/** Required parent framework (for add-ons) */
parentFramework?: string;
/** Dependencies on other plugins */
dependencies?: Record<string, string>;
/** Entry points */
entry?: {
agents?: string;
commands?: string;
templates?: string;
};
/** Keywords for search */
keywords?: string[];
}
/**
* Installation options
*/
export interface InstallOptions {
/** Plugin type (required if installing from local path) */
type?: PluginType;
/** Parent framework ID (required for add-ons) */
parentFramework?: string;
/** Dry-run mode (preview without executing) */
dryRun?: boolean;
/** Force reinstallation even if already installed */
force?: boolean;
/** Custom target directory */
targetDir?: string;
/** Skip dependency check */
skipDependencyCheck?: boolean;
}
/**
* Installation result
*/
export interface InstallResult {
/** Whether installation succeeded */
success: boolean;
/** Plugin ID */
pluginId: string;
/** Plugin version */
version: string;
/** Installation path */
installPath: string;
/** Actions taken */
actions: InstallAction[];
/** Errors encountered */
errors: string[];
/** Warnings */
warnings: string[];
}
/**
* Single installation action
*/
export interface InstallAction {
/** Action type */
type: 'create-dir' | 'copy-file' | 'update-registry' | 'validate' | 'rollback';
/** Action description */
description: string;
/** Path affected */
path?: string;
/** Whether action was executed or just planned (dry-run) */
executed: boolean;
}
/**
* Registry entry structure (simplified)
*/
interface RegistryEntry {
id: string;
type: PluginType;
name: string;
version: string;
path: string;
installedAt: string;
parentFramework?: string;
health?: {
status: 'healthy' | 'warning' | 'error';
lastCheck: string;
};
}
/**
* PluginInstaller - Install and manage plugins
*
* @example
* ```typescript
* const installer = new PluginInstaller('~/.local/share/ai-writing-guide');
*
* // Install framework
* const result = await installer.install('/path/to/sdlc-complete');
*
* // Install add-on with parent
* const addonResult = await installer.install('/path/to/gdpr-compliance', {
* type: 'add-on',
* parentFramework: 'sdlc-complete'
* });
*
* // Dry-run preview
* const preview = await installer.install('/path/to/plugin', { dryRun: true });
* ```
*/
export declare class PluginInstaller {
private aiwgRoot;
private registryPath;
private rollbackActions;
constructor(aiwgRoot: string);
/**
* Install a plugin from a source path
*
* @param source - Path to plugin directory or plugin ID
* @param options - Installation options
* @returns Installation result
*/
install(source: string, options?: InstallOptions): Promise<InstallResult>;
/**
* Load and validate plugin manifest
*/
private loadManifest;
/**
* Validate manifest has required fields
*/
private validateManifest;
/**
* Check if plugin is already installed
*/
private isPluginInstalled;
/**
* Validate plugin dependencies
*/
private validateDependencies;
/**
* Get installation path for plugin type
*/
private getInstallPath;
/**
* Create directory structure for plugin
*/
private createDirectoryStructure;
/**
* Copy plugin files to installation directory
*/
private copyPluginFiles;
/**
* Recursively copy directory
*/
private copyDirectory;
/**
* Update registry with new plugin
*/
private updateRegistry;
/**
* Load registry file
*/
private loadRegistry;
/**
* Rollback changes on failure
*/
private rollback;
/**
* List installed plugins
*/
listInstalled(): Promise<RegistryEntry[]>;
/**
* Get plugin info by ID
*/
getPluginInfo(pluginId: string): Promise<RegistryEntry | null>;
/**
* Validate manifest without installing
*/
validatePlugin(source: string): Promise<{
valid: boolean;
manifest?: PluginManifest;
errors: string[];
}>;
}
/**
* Create a PluginInstaller with default AIWG root
*/
export declare function createInstaller(): PluginInstaller;
export {};
//# sourceMappingURL=plugin-installer.d.ts.map