""" Workspace Configuration Schema Defines the complete structure for workspace configuration in KCL format. Replaces provisioning.yaml with type-safe, validated configuration. """ import regex # ============================================================================ # Workspace Metadata # ============================================================================ schema Workspace: """Workspace identification and versioning""" name: str version: str created: str current_infra: str current_environment: str check: len(name) > 0, "Workspace name required" regex.match(version, r"^\d+\.\d+\.\d+$"), \ "Version must be semantic versioning (e.g., 1.0.0)" # ============================================================================ # Path Configuration # ============================================================================ schema Paths: """Path definitions for all workspace resources""" base: str infra: str cache: str runtime: str providers: str taskservs: str clusters: str orchestrator: str control_center: str kms: str generate: str run_clusters: str run_taskservs: str extensions: str resources: str templates: str tools: str # ============================================================================ # Provisioning System Configuration # ============================================================================ schema ProvisioningConfig: """Provisioning system path and identification""" path: str schema CoreConfig: """Core provisioning settings""" version: str name: str # ============================================================================ # Debug and Output Settings # ============================================================================ schema DebugConfig: """Debug settings and verbosity control""" enabled: bool metadata: bool check_mode: bool validation: bool remote: bool log_level: str no_terminal: bool schema OutputConfig: """Output format and display settings""" file_viewer: str format: str # ============================================================================ # HTTP Client Configuration # ============================================================================ schema HttpConfig: """HTTP client settings""" use_curl: bool timeout: int check: timeout > 0, "Timeout must be positive" # ============================================================================ # Provider Configuration # ============================================================================ schema ProviderConfig: """Provider configuration and defaults""" active: [str] default: str # ============================================================================ # Platform Services Configuration # ============================================================================ schema PlatformConfig: """Platform services enablement""" orchestrator_enabled: bool control_center_enabled: bool mcp_enabled: bool # ============================================================================ # Secrets Management Configuration # ============================================================================ schema SecretsConfig: """Secrets management configuration""" provider: str sops_enabled: bool kms_enabled: bool # ============================================================================ # KMS Configuration # ============================================================================ schema KmsConfig: """KMS (Key Management System) configuration""" mode: str config_file: str # ============================================================================ # SOPS Configuration # ============================================================================ schema SopsConfig: """SOPS (Secrets Operations) configuration""" use_sops: bool config_path: str key_search_paths: [str] # ============================================================================ # AI Configuration # ============================================================================ schema AiConfig: """AI service configuration""" enabled: bool provider: str config_path: str # ============================================================================ # Task Services Configuration # ============================================================================ schema TaskservsConfig: """Task services runtime configuration""" run_path: str # ============================================================================ # Clusters Configuration # ============================================================================ schema ClustersConfig: """Clusters runtime configuration""" run_path: str # ============================================================================ # Generation Configuration # ============================================================================ schema GenerationConfig: """Code/manifest generation settings""" dir_path: str defs_file: str # ============================================================================ # Cache Configuration # ============================================================================ schema CacheConfig: """Caching configuration""" enabled: bool path: str infra_cache: str grace_period: int check_updates: bool max_cache_size: str check: grace_period > 0, "Grace period must be positive" # ============================================================================ # Infrastructure Context # ============================================================================ schema InfraConfig: """Infrastructure context settings""" current: str # ============================================================================ # Tools Configuration # ============================================================================ schema ToolsConfig: """Tool detection and plugin settings""" use_kcl: bool use_kcl_plugin: bool use_tera_plugin: bool # ============================================================================ # KCL Module Configuration # ============================================================================ schema KclConfig: """KCL module and package configuration""" core_module: str core_version: str core_package_name: str use_module_loader: bool module_loader_path: str modules_dir: str # ============================================================================ # SSH Configuration # ============================================================================ schema SshConfig: """SSH client configuration""" user: str options: [str] timeout: int debug: bool check: timeout > 0, "Timeout must be positive" # ============================================================================ # Main Workspace Configuration # ============================================================================ schema WorkspaceConfig: """Complete workspace configuration""" workspace: Workspace paths: Paths provisioning: ProvisioningConfig core: CoreConfig debug: DebugConfig output: OutputConfig http: HttpConfig providers: ProviderConfig platform: PlatformConfig secrets: SecretsConfig kms: KmsConfig sops: SopsConfig ai: AiConfig taskservs: TaskservsConfig clusters: ClustersConfig generation: GenerationConfig cache: CacheConfig infra: InfraConfig tools: ToolsConfig kcl: KclConfig ssh: SshConfig check: len(workspace.name) > 0, "Workspace name required" len(paths.base) > 0, "Base path required"