@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
468 lines (420 loc) • 10.4 kB
text/typescript
/**
* Configuration Management Automation Types
* Type definitions for automated configuration management
*/
export type AutomationStatus =
| "pending"
| "running"
| "completed"
| "failed"
| "cancelled"
| "scheduled";
export type TaskType =
| "validation"
| "deployment"
| "backup"
| "migration"
| "test"
| "cleanup"
| "monitoring"
| "rollback";
export type Environment = "development" | "testing" | "staging" | "production";
export type DeploymentStrategy =
| "blue_green"
| "rolling"
| "canary"
| "recreate";
// Core automation task interface
export interface AutomationTask {
id: string;
name: string;
type: TaskType;
description: string;
environment: Environment;
status: AutomationStatus;
priority: "low" | "medium" | "high" | "critical";
scheduledAt?: Date;
startedAt?: Date;
completedAt?: Date;
duration?: number; // milliseconds
configuration: AutomationConfig;
rollbackConfiguration?: AutomationConfig;
dependencies: string[]; // task IDs
outputs: TaskOutput[];
logs: AutomationLog[];
retryCount: number;
maxRetries: number;
createdBy: string;
createdAt: Date;
updatedAt: Date;
}
export interface AutomationConfig {
[key: string]: unknown;
timeout?: number; // milliseconds
retryPolicy?: RetryPolicy;
notifications?: NotificationConfig;
validation?: ValidationConfig;
rollback?: RollbackConfig;
}
export interface RetryPolicy {
enabled: boolean;
maxAttempts: number;
backoffStrategy: "linear" | "exponential" | "fixed";
delayMs: number;
maxDelayMs?: number;
}
export interface NotificationConfig {
enabled: boolean;
onSuccess: boolean;
onFailure: boolean;
channels: NotificationChannel[];
}
export interface NotificationChannel {
type: "email" | "slack" | "webhook";
target: string; // email, slack channel, webhook URL
enabled: boolean;
}
export interface ValidationConfig {
preValidation: ValidationRule[];
postValidation: ValidationRule[];
skipOnFailure: boolean;
}
export interface ValidationRule {
id: string;
name: string;
type: "schema" | "api" | "file" | "custom";
rule: string; // JSON schema, API endpoint, file path, or custom script
required: boolean;
timeout?: number;
}
export interface RollbackConfig {
enabled: boolean;
strategy: "automatic" | "manual";
triggerOnFailure: boolean;
backupRequired: boolean;
rollbackSteps: RollbackStep[];
}
export interface RollbackStep {
id: string;
name: string;
action: string; // command or script to execute
timeout: number;
order: number;
}
export interface TaskOutput {
key: string;
value: unknown;
type: "string" | "number" | "boolean" | "object" | "array";
sensitive: boolean; // if true, value should be masked in logs
createdAt: Date;
}
export interface AutomationLog {
id: string;
taskId: string;
level: "debug" | "info" | "warn" | "error";
message: string;
metadata?: Record<string, unknown>;
timestamp: Date;
}
// Pipeline definitions
export interface AutomationPipeline {
id: string;
name: string;
description: string;
environment: Environment;
status: AutomationStatus;
tasks: AutomationTask[];
configuration: PipelineConfig;
triggers: PipelineTrigger[];
schedule?: PipelineSchedule;
createdBy: string;
createdAt: Date;
lastRunAt?: Date;
nextRunAt?: Date;
runCount: number;
successCount: number;
failureCount: number;
}
export interface PipelineConfig {
parallelism: number; // max concurrent tasks
failureStrategy: "fail_fast" | "continue" | "rollback" | "stop_on_failure";
executionMode: "parallel" | "sequential";
timeout: number; // milliseconds
notifications: NotificationConfig;
approval?: ApprovalConfig;
}
export interface ApprovalConfig {
required: boolean;
approvers: string[]; // user IDs
timeout: number; // milliseconds
autoApproveNonProd: boolean;
}
export interface PipelineTrigger {
id: string;
type: "manual" | "webhook" | "schedule" | "file_change" | "git_push";
configuration: TriggerConfig;
enabled: boolean;
}
export interface TriggerConfig {
[key: string]: unknown;
// webhook specific
webhookUrl?: string;
secret?: string;
// file change specific
watchPaths?: string[];
// git specific
repository?: string;
branch?: string;
}
export interface PipelineSchedule {
enabled: boolean;
cron: string; // cron expression
timezone: string;
maxRuns?: number;
endDate?: Date;
}
// Deployment specific types
export interface DeploymentConfig {
strategy: DeploymentStrategy;
target: DeploymentTarget;
source: DeploymentSource;
validation: ValidationConfig;
rollback: RollbackConfig;
scaling?: ScalingConfig;
}
export interface DeploymentTarget {
environment: Environment;
infrastructure: InfrastructureConfig;
services: ServiceConfig[];
loadBalancer?: LoadBalancerConfig;
}
export interface InfrastructureConfig {
provider: "aws" | "azure" | "gcp" | "docker" | "kubernetes";
region?: string;
resources: ResourceConfig[];
}
export interface ResourceConfig {
type: "compute" | "storage" | "database" | "cache" | "queue";
name: string;
configuration: Record<string, unknown>;
dependencies: string[];
}
export interface ServiceConfig {
name: string;
image: string;
version: string;
environment: Record<string, string>;
resources: {
cpu: string;
memory: string;
storage?: string;
};
healthCheck: HealthCheckConfig;
scaling: ScalingConfig;
}
export interface HealthCheckConfig {
enabled: boolean;
path: string;
port: number;
interval: number;
timeout: number;
retries: number;
initialDelay: number;
}
export interface ScalingConfig {
min: number;
max: number;
target: {
cpu?: number;
memory?: number;
requests?: number;
};
}
export interface LoadBalancerConfig {
type: "application" | "network";
listeners: ListenerConfig[];
healthCheck: HealthCheckConfig;
sslCertificate?: string;
}
export interface ListenerConfig {
port: number;
protocol: "http" | "https" | "tcp" | "udp";
target: {
port: number;
protocol: string;
};
}
export interface DeploymentSource {
type: "git" | "artifact" | "registry";
location: string; // repo URL, artifact path, or registry URL
version?: string; // branch/tag/commit or version
credentials?: CredentialConfig;
}
export interface CredentialConfig {
type: "basic" | "token" | "key" | "oauth";
reference: string; // reference to stored credential
}
// Monitoring types
export interface MonitoringConfig {
enabled: boolean;
interval: number; // milliseconds
targets: MonitoringTarget[];
alerts: AlertConfig[];
dashboards: DashboardConfig[];
}
export interface MonitoringTarget {
id: string;
name: string;
type: "service" | "database" | "infrastructure" | "pipeline";
endpoint: string;
healthCheck: HealthCheckConfig;
metrics: MetricConfig[];
}
export interface MetricConfig {
name: string;
type: "gauge" | "counter" | "histogram" | "summary";
query: string;
unit: string;
threshold?: {
warning: number;
critical: number;
};
}
export interface AlertConfig {
id: string;
name: string;
condition: string; // query expression
severity: "info" | "warning" | "critical";
enabled: boolean;
cooldown: number; // seconds between alerts
notification: NotificationConfig;
}
export interface DashboardConfig {
id: string;
name: string;
description: string;
panels: PanelConfig[];
refreshInterval: number; // seconds
}
export interface PanelConfig {
id: string;
title: string;
type: "graph" | "singlestat" | "table" | "heatmap";
queries: string[];
position: {
x: number;
y: number;
width: number;
height: number;
};
}
// Automation execution results
export interface AutomationResult {
taskId: string;
status: AutomationStatus;
startTime: Date;
endTime?: Date;
duration?: number;
success: boolean;
error?: string;
outputs: TaskOutput[];
logs: AutomationLog[];
metadata: Record<string, unknown>;
}
export interface PipelineResult {
pipelineId: string;
runId: string;
status: AutomationStatus;
startTime: Date;
endTime?: Date;
duration?: number;
success: boolean;
taskResults: AutomationResult[];
summary: {
totalTasks: number;
successfulTasks: number;
failedTasks: number;
skippedTasks: number;
};
}
// Event types for automation system
export interface AutomationEvent {
type:
| "task_started"
| "task_completed"
| "task_failed"
| "task_created"
| "task_retry"
| "pipeline_started"
| "pipeline_completed"
| "pipeline_failed"
| "pipeline_created"
| "pipeline_scheduled"
| "pipeline_cancelled"
| "pipeline_rollback_started"
| "pipeline_rollback_completed"
| "pipeline_rollback_failed";
taskId?: string;
pipelineId?: string;
timestamp: Date;
data: Record<string, unknown>;
}
// API request/response types
export interface CreateTaskRequest {
name: string;
type: TaskType;
description: string;
environment: Environment;
priority: "low" | "medium" | "high" | "critical";
configuration: AutomationConfig;
dependencies?: string[];
scheduledAt?: Date;
}
export interface UpdateTaskRequest {
name?: string;
description?: string;
priority?: "low" | "medium" | "high" | "critical";
configuration?: AutomationConfig;
scheduledAt?: Date;
}
export interface TaskSearchFilters {
status?: AutomationStatus[];
type?: TaskType[];
environment?: Environment[];
priority?: ("low" | "medium" | "high" | "critical")[];
createdBy?: string;
dateRange?: {
start: Date;
end: Date;
};
}
export interface AutomationMetrics {
totalTasks: number;
runningTasks: number;
completedTasks: number;
failedTasks: number;
averageExecutionTime: number; // milliseconds
successRate: number; // percentage
tasksByType: Record<TaskType, number>;
tasksByEnvironment: Record<Environment, number>;
recentFailures: AutomationTask[];
upcomingTasks: AutomationTask[];
}
// Add missing ExecutionResult type
export interface ExecutionResult {
taskId: string;
success: boolean;
error?: string;
message?: string;
output?: Record<string, unknown>;
executionTime: number;
timestamp: Date;
}
// Add missing ScheduleConfig type
export interface ScheduleConfig {
cron: string;
timezone: string;
enabled: boolean;
maxRuns?: number;
endDate?: Date;
}