/** * Smart Workflow Tool * * Provides intelligent CI/CD workflow file analysis: * - GitHub Actions (.github/workflows/*.yml) * - GitLab CI (.gitlab-ci.yml) * - CircleCI (.circleci/config.yml) * - Azure Pipelines (azure-pipelines.yml) * - Workflow syntax validation * - Job and step parsing with dependency detection * - Security analysis (secrets, unsafe actions) * - Performance recommendations * - Cached results with file hash invalidation (24-hour TTL) */ import { CacheEngine } from '../../core/cache-engine.js'; import { TokenCounter } from '../../core/token-counter.js'; import { MetricsCollector } from '../../core/metrics.js'; export type WorkflowFormat = 'github' | 'gitlab' | 'circleci' | 'azure' | 'auto'; export interface SmartWorkflowOptions { enableCache?: boolean; ttl?: number; format?: WorkflowFormat; validateSyntax?: boolean; includeSecurityAnalysis?: boolean; includePerformanceRecommendations?: boolean; } export interface WorkflowTrigger { type: string; details?: Record; } export interface WorkflowStep { name?: string; uses?: string; run?: string; with?: Record; env?: Record; 'working-directory'?: string; if?: string; } export interface WorkflowJob { id: string; name?: string; 'runs-on'?: string | string[]; steps: WorkflowStep[]; env?: Record; needs?: string | string[]; outputs?: Record; if?: string; strategy?: { matrix?: Record; }; requires?: string[]; } export interface ParsedWorkflow { name?: string; format: WorkflowFormat; triggers: WorkflowTrigger[]; jobs: WorkflowJob[]; globalEnv?: Record; fileHash: string; timestamp: number; } export interface WorkflowValidationError { path: string; message: string; severity: 'error' | 'warning' | 'info'; suggestion?: string; } export interface WorkflowSecurityIssue { type: 'hardcoded_secret' | 'unsafe_action' | 'privileged_command'; message: string; path: string; severity: 'high' | 'medium' | 'low'; suggestion?: string; } export interface WorkflowOptimization { type: 'caching' | 'parallelization' | 'matrix' | 'reusability'; suggestion: string; impact: 'high' | 'medium' | 'low'; implementation?: string; } export interface SmartWorkflowResult { workflow: ParsedWorkflow; metadata: { path: string; format: WorkflowFormat; size: number; hash: string; fromCache: boolean; tokensSaved: number; tokenCount: number; originalTokenCount: number; compressionRatio: number; parseTime: number; }; validationErrors?: WorkflowValidationError[]; securityIssues?: WorkflowSecurityIssue[]; optimizations?: WorkflowOptimization[]; } export declare class SmartWorkflowTool { private cache; private tokenCounter; private metrics; constructor(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector); analyze(filePath: string, options?: SmartWorkflowOptions): Promise; listWorkflows(projectRoot: string): string[]; getJobs(parsedWorkflow: ParsedWorkflow): WorkflowJob[]; getTriggers(parsedWorkflow: ParsedWorkflow): WorkflowTrigger[]; validate(parsedWorkflow: ParsedWorkflow): WorkflowValidationError[]; optimize(parsedWorkflow: ParsedWorkflow): WorkflowOptimization[]; visualize(parsedWorkflow: ParsedWorkflow): Record; getSecrets(parsedWorkflow: ParsedWorkflow): string[]; private detectFormat; private parseWorkflow; private extractTriggers; private extractJobs; private validateWorkflow; private analyzeSecurityIssues; private recommendOptimizations; } export declare function getSmartWorkflowTool(cache: CacheEngine, tokenCounter: TokenCounter, metrics: MetricsCollector): SmartWorkflowTool; export declare const SMART_WORKFLOW_TOOL_DEFINITION: { name: string; description: string; inputSchema: { type: string; properties: { operation: { type: string; enum: string[]; description: string; }; filePath: { type: string; description: string; }; projectRoot: { type: string; description: string; }; parsedWorkflow: { type: string; description: string; }; options: { type: string; properties: { enableCache: { type: string; default: boolean; }; ttl: { type: string; default: number; }; format: { type: string; enum: string[]; default: string; }; validateSyntax: { type: string; default: boolean; }; includeSecurityAnalysis: { type: string; default: boolean; }; includePerformanceRecommendations: { type: string; default: boolean; }; }; }; }; required: string[]; }; }; //# sourceMappingURL=smart-workflow.d.ts.map