UNPKG

@restnfeel/agentc-starter-kit

Version:

한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템

806 lines (665 loc) 16.3 kB
export type EnvironmentType = | "development" | "testing" | "staging" | "production" | "preview" | "hotfix"; export type DeploymentStatus = | "pending" | "in_progress" | "testing" | "deploying" | "success" | "failed" | "rolled_back" | "cancelled"; export type PipelineStage = | "build" | "test" | "security_scan" | "quality_gate" | "staging_deploy" | "integration_test" | "approval" | "production_deploy" | "post_deploy_test" | "monitoring" | "cleanup"; export type DeploymentStrategy = | "blue_green" | "rolling" | "canary" | "recreate" | "immediate"; export type InfrastructureProvider = | "aws" | "azure" | "gcp" | "vercel" | "netlify" | "cloudflare" | "kubernetes" | "docker"; export type TestType = | "unit" | "integration" | "e2e" | "security" | "performance" | "accessibility" | "smoke" | "regression"; export interface EnvironmentConfig { id: string; name: string; type: EnvironmentType; description: string; // Infrastructure provider: InfrastructureProvider; region: string; instances: InstanceConfig[]; // Configuration variables: Record<string, string>; secrets: Record<string, string>; features: FeatureFlag[]; // Networking domain: string; subdomains: string[]; ssl: SSLConfig; cdn: CDNConfig; // Database database: DatabaseConfig; // Monitoring monitoring: MonitoringConfig; // Deployment deploymentStrategy: DeploymentStrategy; autoScale: AutoScaleConfig; healthCheck: HealthCheckConfig; // Lifecycle active: boolean; protected: boolean; // Requires approval for changes // Metadata createdBy: string; createdAt: Date; updatedAt: Date; lastDeployment?: Date; } export interface InstanceConfig { id: string; name: string; type: string; // Instance type (e.g., t3.medium) count: number; // Resources cpu: number; memory: number; // GB storage: StorageConfig; // Network subnet?: string; securityGroups: string[]; // Configuration userdata?: string; tags: Record<string, string>; } export interface StorageConfig { type: "gp2" | "gp3" | "io1" | "io2" | "sc1" | "st1"; size: number; // GB encrypted: boolean; backupRetention: number; // Days } export interface FeatureFlag { id: string; name: string; enabled: boolean; percentage?: number; // For gradual rollout conditions?: Record<string, unknown>; } export interface SSLConfig { enabled: boolean; certificateProvider: "letsencrypt" | "aws_acm" | "custom"; certificate?: string; privateKey?: string; autoRenewal: boolean; } export interface CDNConfig { enabled: boolean; provider: "cloudflare" | "aws_cloudfront" | "fastly"; cacheRules: CacheRule[]; origins: OriginConfig[]; } export interface CacheRule { path: string; ttl: number; // seconds cacheHeaders: string[]; } export interface OriginConfig { id: string; url: string; weight: number; healthCheck: boolean; } export interface DatabaseConfig { provider: "postgresql" | "mysql" | "mongodb" | "redis"; host: string; port: number; database: string; username: string; password: string; // Encrypted // Connection pool minConnections: number; maxConnections: number; // Backup backupSchedule: string; // Cron format backupRetention: number; // Days // Replication replication: boolean; readReplicas: number; } export interface MonitoringConfig { enabled: boolean; provider: "datadog" | "newrelic" | "prometheus" | "aws_cloudwatch"; // Metrics customMetrics: MetricConfig[]; // Alerts alerts: AlertConfig[]; // Logging logging: LoggingConfig; // APM apm: APMConfig; } export interface MetricConfig { name: string; type: "counter" | "gauge" | "histogram"; description: string; labels: string[]; } export interface AlertConfig { id: string; name: string; condition: string; threshold: number; severity: "low" | "medium" | "high" | "critical"; // Notification channels: NotificationChannel[]; // Configuration enabled: boolean; cooldown: number; // Minutes } export interface NotificationChannel { type: "email" | "slack" | "webhook" | "pagerduty"; target: string; enabled: boolean; } export interface LoggingConfig { level: "debug" | "info" | "warn" | "error"; retention: number; // Days structured: boolean; // Aggregation aggregation: boolean; aggregationProvider?: "elasticsearch" | "splunk" | "datadog"; } export interface APMConfig { enabled: boolean; provider: "datadog" | "newrelic" | "dynatrace"; tracing: boolean; profiling: boolean; } export interface AutoScaleConfig { enabled: boolean; minInstances: number; maxInstances: number; // Triggers cpuThreshold: number; // Percentage memoryThreshold: number; // Percentage requestThreshold: number; // Requests per second // Timing scaleUpCooldown: number; // Seconds scaleDownCooldown: number; // Seconds } export interface HealthCheckConfig { enabled: boolean; path: string; protocol: "http" | "https" | "tcp"; port: number; // Timing interval: number; // Seconds timeout: number; // Seconds // Thresholds healthyThreshold: number; unhealthyThreshold: number; // Response validation expectedStatus: number; expectedBody?: string; } export interface DeploymentPipeline { id: string; name: string; description: string; // Configuration sourceRepository: RepositoryConfig; targetEnvironments: EnvironmentType[]; // Stages stages: PipelineStageConfig[]; // Triggers triggers: TriggerConfig[]; // Approval approvalRequired: boolean; approvers: string[]; // Options allowParallel: boolean; allowManualRun: boolean; // Active status active: boolean; // Metadata createdBy: string; createdAt: Date; updatedAt: Date; } export interface RepositoryConfig { provider: "github" | "gitlab" | "bitbucket" | "azure_devops"; url: string; branch: string; // Authentication credentials: RepositoryCredentials; // Build configuration buildCommand?: string; testCommand?: string; outputDirectory?: string; // Webhooks webhookEnabled: boolean; webhookSecret?: string; } export interface RepositoryCredentials { type: "token" | "ssh_key" | "username_password"; token?: string; username?: string; password?: string; privateKey?: string; } export interface PipelineStageConfig { id: string; name: string; type: PipelineStage; description: string; order: number; // Dependencies dependsOn: string[]; // Configuration commands: string[]; environment: Record<string, string>; workingDirectory?: string; // Conditions runCondition?: string; allowFailure: boolean; // Timing timeout: number; // Minutes // Parallelization parallel: boolean; parallelGroup?: string; // Artifacts artifacts: ArtifactConfig[]; // Testing tests: TestConfig[]; } export interface ArtifactConfig { name: string; path: string; type: "build" | "test_report" | "coverage" | "docker_image"; retention: number; // Days // Storage storage: ArtifactStorage; } export interface ArtifactStorage { provider: "s3" | "gcs" | "azure_blob" | "artifactory"; bucket?: string; path?: string; encryption: boolean; } export interface TestConfig { type: TestType; command: string; reportPath?: string; // Coverage coverageEnabled: boolean; coverageThreshold?: number; // Percentage // Parallel execution parallel: boolean; parallelism?: number; } export interface TriggerConfig { type: "webhook" | "schedule" | "manual"; // Webhook webhookEvents?: string[]; // Schedule schedule?: string; // Cron format timezone?: string; // Conditions branches?: string[]; tags?: string[]; paths?: string[]; } export interface DeploymentExecution { id: string; pipelineId: string; environment: EnvironmentType; // Version version: string; commitHash: string; branch: string; tag?: string; // Status status: DeploymentStatus; startedAt: Date; completedAt?: Date; duration?: number; // Seconds // Stages stages: StageExecution[]; // Results success: boolean; errorMessage?: string; logs: LogEntry[]; // Rollback rollbackTo?: string; // Previous deployment ID rollbackReason?: string; // Approval approvedBy?: string; approvedAt?: Date; approvalNotes?: string; // Triggered by triggeredBy: string; triggerType: "manual" | "webhook" | "schedule"; // Metadata metadata: Record<string, unknown>; } export interface StageExecution { stageId: string; name: string; status: DeploymentStatus; // Timing startedAt: Date; completedAt?: Date; duration?: number; // Seconds // Output logs: LogEntry[]; artifacts: ExecutionArtifact[]; // Results success: boolean; errorMessage?: string; exitCode?: number; // Tests testResults: TestResult[]; } export interface LogEntry { timestamp: Date; level: "debug" | "info" | "warn" | "error"; message: string; stage?: string; component?: string; metadata?: Record<string, unknown>; } export interface ExecutionArtifact { name: string; url: string; size: number; type: string; hash: string; } export interface TestResult { name: string; type: TestType; status: "passed" | "failed" | "skipped"; // Metrics duration: number; // Milliseconds testCount: number; passedCount: number; failedCount: number; skippedCount: number; // Coverage coverage?: CoverageResult; // Output reportUrl?: string; errorMessage?: string; } export interface CoverageResult { percentage: number; lines: CoverageMetric; functions: CoverageMetric; branches: CoverageMetric; statements: CoverageMetric; } export interface CoverageMetric { total: number; covered: number; percentage: number; } export interface DeploymentTemplate { id: string; name: string; description: string; version: string; // Template content content: string; // YAML/JSON Infrastructure as Code parameters: TemplateParameter[]; // Supported providers providers: InfrastructureProvider[]; // Categories category: "web_app" | "api" | "database" | "microservice" | "full_stack"; tags: string[]; // Resources estimatedCost: number; // USD per month resources: ResourceEstimate[]; // Validation validated: boolean; validationResults?: ValidationResult[]; // Metadata author: string; createdAt: Date; updatedAt: Date; downloadCount: number; } export interface TemplateParameter { name: string; type: "string" | "number" | "boolean" | "array" | "object"; description: string; required: boolean; defaultValue?: unknown; allowedValues?: unknown[]; validation?: string; // Regex pattern } export interface ResourceEstimate { type: string; quantity: number; unit: string; monthlyCost: number; } export interface ValidationResult { rule: string; status: "passed" | "failed" | "warning"; message: string; severity: "low" | "medium" | "high"; } export interface RollbackConfig { enabled: boolean; automatic: boolean; // Triggers healthCheckFailures: number; errorRate: number; // Percentage latencyThreshold: number; // Milliseconds // Timing monitoringPeriod: number; // Minutes rollbackTimeout: number; // Minutes // Strategy strategy: DeploymentStrategy; preserveData: boolean; } export interface DeploymentMonitoring { deploymentId: string; environment: EnvironmentType; // Health metrics healthStatus: "healthy" | "degraded" | "unhealthy"; uptime: number; // Percentage // Performance metrics responseTime: PerformanceMetric; throughput: PerformanceMetric; errorRate: PerformanceMetric; // Resource metrics cpuUsage: ResourceMetric; memoryUsage: ResourceMetric; diskUsage: ResourceMetric; networkUsage: ResourceMetric; // Alerts activeAlerts: ActiveAlert[]; // Last updated lastUpdated: Date; } export interface PerformanceMetric { current: number; average: number; min: number; max: number; trend: "improving" | "stable" | "degrading"; } export interface ResourceMetric { current: number; // Percentage average: number; // Percentage peak: number; // Percentage limit: number; } export interface ActiveAlert { id: string; name: string; severity: "low" | "medium" | "high" | "critical"; message: string; triggeredAt: Date; acknowledged: boolean; acknowledgedBy?: string; } // API interfaces export interface DeploymentAPI { // Environment management getEnvironments(): Promise<EnvironmentConfig[]>; getEnvironment(id: string): Promise<EnvironmentConfig>; createEnvironment( config: Omit<EnvironmentConfig, "id" | "createdAt" | "updatedAt"> ): Promise<EnvironmentConfig>; updateEnvironment( id: string, updates: Partial<EnvironmentConfig> ): Promise<EnvironmentConfig>; deleteEnvironment(id: string): Promise<boolean>; // Pipeline management getPipelines(): Promise<DeploymentPipeline[]>; getPipeline(id: string): Promise<DeploymentPipeline>; createPipeline( pipeline: Omit<DeploymentPipeline, "id" | "createdAt" | "updatedAt"> ): Promise<DeploymentPipeline>; updatePipeline( id: string, updates: Partial<DeploymentPipeline> ): Promise<DeploymentPipeline>; deletePipeline(id: string): Promise<boolean>; // Deployment execution startDeployment( pipelineId: string, environment: EnvironmentType, options?: DeploymentOptions ): Promise<DeploymentExecution>; getDeployment(id: string): Promise<DeploymentExecution>; getDeployments(filters?: DeploymentFilters): Promise<DeploymentExecution[]>; cancelDeployment(id: string): Promise<boolean>; rollbackDeployment( id: string, targetVersion?: string ): Promise<DeploymentExecution>; // Monitoring getDeploymentMonitoring(deploymentId: string): Promise<DeploymentMonitoring>; getEnvironmentHealth( environment: EnvironmentType ): Promise<EnvironmentHealth>; // Templates getTemplates(): Promise<DeploymentTemplate[]>; getTemplate(id: string): Promise<DeploymentTemplate>; validateTemplate( content: string, provider: InfrastructureProvider ): Promise<ValidationResult[]>; } export interface DeploymentOptions { version?: string; branch?: string; tag?: string; commitHash?: string; skipTests?: boolean; skipApproval?: boolean; strategy?: DeploymentStrategy; rollbackConfig?: RollbackConfig; variables?: Record<string, string>; } export interface DeploymentFilters { environment?: EnvironmentType; status?: DeploymentStatus; pipelineId?: string; branch?: string; dateRange?: { start: Date; end: Date; }; limit?: number; offset?: number; } export interface EnvironmentHealth { environment: EnvironmentType; overall: "healthy" | "degraded" | "unhealthy"; // Component health components: ComponentHealth[]; // Recent deployments recentDeployments: DeploymentExecution[]; // Metrics summary metrics: HealthMetrics; // Last check lastChecked: Date; } export interface ComponentHealth { name: string; type: "application" | "database" | "cache" | "queue" | "cdn"; status: "healthy" | "degraded" | "unhealthy"; message?: string; lastChecked: Date; } export interface HealthMetrics { uptime: number; // Percentage averageResponseTime: number; // Milliseconds errorRate: number; // Percentage throughput: number; // Requests per second } // Search and filtering export interface DeploymentSearchQuery { environment?: EnvironmentType; status?: DeploymentStatus[]; pipelineId?: string; deployedBy?: string; branch?: string; tag?: string; dateRange?: { start: Date; end: Date; }; search?: string; sortBy?: "startedAt" | "completedAt" | "duration" | "status"; sortOrder?: "asc" | "desc"; limit?: number; offset?: number; } export interface DeploymentSearchResult { deployments: DeploymentExecution[]; total: number; page: number; limit: number; hasMore: boolean; facets: { status: { [K in DeploymentStatus]?: number }; environment: { [K in EnvironmentType]?: number }; pipeline: { [key: string]: number }; branch: { [key: string]: number }; }; }