/** * Smart Docker Tool - Docker Operations with Intelligence * * Wraps Docker commands to provide: * - Build, run, stop, logs operations * - Image layer analysis * - Resource usage tracking * - Token-optimized output */ import { CacheEngine } from '../../core/cache-engine.js'; interface SmartDockerOptions { /** * Docker operation to perform */ operation: 'build' | 'run' | 'stop' | 'logs' | 'ps'; /** * Force operation (ignore cache) */ force?: boolean; /** * Project root directory */ projectRoot?: string; /** * Dockerfile path */ dockerfile?: string; /** * Image name for build/run */ imageName?: string; /** * Container name for run/stop/logs */ containerName?: string; /** * Build context directory */ context?: string; /** * Port mappings for run (e.g., ['8080:80', '443:443']) */ ports?: string[]; /** * Environment variables for run */ env?: Record; /** * Follow logs (tail mode) */ follow?: boolean; /** * Number of log lines to show */ tail?: number; /** * Maximum cache age in seconds (default: 3600 = 1 hour) */ maxCacheAge?: number; } interface SmartDockerOutput { /** * Operation summary */ summary: { success: boolean; operation: string; duration: number; fromCache: boolean; }; /** * Container information */ containers?: Array<{ id: string; name: string; image: string; status: string; ports: string[]; }>; /** * Image information */ images?: Array<{ id: string; repository: string; tag: string; size: string; }>; /** * Log entries (for logs operation) */ logs?: Array<{ timestamp: string; level: string; message: string; }>; /** * Build information (for build operation) */ buildInfo?: { layers: number; cacheHits: number; totalSize: string; }; /** * Optimization suggestions */ suggestions: Array<{ type: 'performance' | 'security' | 'size'; message: string; impact: 'high' | 'medium' | 'low'; }>; /** * Token reduction metrics */ metrics: { originalTokens: number; compactedTokens: number; reductionPercentage: number; }; } export declare class SmartDocker { private cache; private cacheNamespace; private projectRoot; constructor(cache: CacheEngine, projectRoot?: string); /** * Run Docker operation with smart analysis */ run(options: SmartDockerOptions): Promise; /** * Run Docker operation */ private runDockerOperation; /** * Docker build operation */ private dockerBuild; /** * Docker run operation */ private dockerRun; /** * Docker stop operation */ private dockerStop; /** * Docker logs operation */ private dockerLogs; /** * Docker ps operation */ private dockerPs; /** * Execute Docker command */ private execDocker; /** * Parse container list */ private parseContainers; /** * Parse log output */ private parseLogs; /** * Count build layers */ private countBuildLayers; /** * Generate optimization suggestions */ private generateSuggestions; /** * Generate cache key */ private generateCacheKey; /** * Count layers in a Dockerfile */ private countDockerfileLayers; /** * Get cached result */ private getCachedResult; /** * Cache result */ private cacheResult; /** * Transform to smart output */ private transformOutput; /** * Format cached output */ private formatCachedOutput; /** * Estimate original output size */ private estimateOriginalOutputSize; /** * Estimate compact output size */ private estimateCompactSize; /** * Close cache connection */ close(): void; } /** * Factory function for dependency injection */ export declare function getSmartDocker(cache: CacheEngine, projectRoot?: string): SmartDocker; /** * CLI-friendly function for running smart docker */ export declare function runSmartDocker(options: SmartDockerOptions): Promise; export declare const SMART_DOCKER_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { operation: { type: string; enum: string[]; description: string; }; force: { type: string; description: string; default: boolean; }; projectRoot: { type: string; description: string; }; dockerfile: { type: string; description: string; }; imageName: { type: string; description: string; }; containerName: { type: string; description: string; }; context: { type: string; description: string; }; ports: { type: string; items: { type: string; }; description: string; }; env: { type: string; description: string; }; follow: { type: string; description: string; default: boolean; }; tail: { type: string; description: string; }; maxCacheAge: { type: string; description: string; default: number; }; }; required: string[]; }; }; export {}; //# sourceMappingURL=smart-docker.d.ts.map