2025-09-22 22:11:41 +00:00
|
|
|
|
# Enhanced logging system for provisioning tool
|
|
|
|
|
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
|
use ../config/accessor.nu *
|
|
|
|
|
|
2025-09-22 22:11:41 +00:00
|
|
|
|
export def log-info [
|
|
|
|
|
message: string
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
|
|
|
|
let timestamp = (date now | format date '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"ℹ️ ($timestamp)($context_str) ($message)"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-success [
|
|
|
|
|
message: string
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
|
|
|
|
let timestamp = (date now | format date '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"✅ ($timestamp)($context_str) ($message)"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-warning [
|
|
|
|
|
message: string
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
|
|
|
|
let timestamp = (date now | format date '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"⚠️ ($timestamp)($context_str) ($message)"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-error [
|
|
|
|
|
message: string
|
|
|
|
|
context?: string
|
|
|
|
|
details?: string
|
|
|
|
|
] {
|
|
|
|
|
let timestamp = (date now | format date '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
let details_str = if ($details | is-not-empty) { $"\n Details: ($details)" } else { "" }
|
|
|
|
|
print $"🛑 ($timestamp)($context_str) ($message)($details_str)"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-debug [
|
|
|
|
|
message: string
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
feat: Complete config-driven architecture migration v2.0.0
Transform provisioning system from ENV-based to hierarchical config-driven architecture.
This represents a complete system redesign with breaking changes requiring migration.
## Migration Summary
- 65+ files migrated across entire codebase
- 200+ ENV variables replaced with 476 config accessors
- 29 syntax errors fixed across 17 files
- 92% token efficiency maintained during migration
## Core Features Added
### Hierarchical Configuration System
- 6-layer precedence: defaults → user → project → infra → env → runtime
- Deep merge strategy with intelligent precedence rules
- Multi-environment support (dev/test/prod) with auto-detection
- Configuration templates for all environments
### Enhanced Interpolation Engine
- Dynamic variables: {{paths.base}}, {{env.HOME}}, {{now.date}}
- Git context: {{git.branch}}, {{git.commit}}, {{git.remote}}
- SOPS integration: {{sops.decrypt()}} for secrets management
- Path operations: {{path.join()}} for dynamic construction
- Security: circular dependency detection, injection prevention
### Comprehensive Validation
- Structure, path, type, semantic, and security validation
- Code injection and path traversal detection
- Detailed error reporting with actionable messages
- Configuration health checks and warnings
## Architecture Changes
### Configuration Management (core/nulib/lib_provisioning/config/)
- loader.nu: 1600+ line hierarchical config loader with validation
- accessor.nu: 476 config accessor functions replacing ENV vars
### Provider System (providers/)
- AWS, UpCloud, Local providers fully config-driven
- Unified middleware system with standardized interfaces
### Task Services (core/nulib/taskservs/)
- Kubernetes, storage, networking, registry services migrated
- Template-driven configuration generation
### Cluster Management (core/nulib/clusters/)
- Complete lifecycle management through configuration
- Environment-specific cluster templates
## New Configuration Files
- config.defaults.toml: System defaults (84 lines)
- config.*.toml.example: Environment templates (400+ lines each)
- Enhanced CLI: validate, env, multi-environment support
## Security Enhancements
- Type-safe configuration access through validated functions
- SOPS integration for encrypted secrets management
- Input validation preventing injection attacks
- Environment isolation and access controls
## Breaking Changes
⚠️ ENV variables no longer supported as primary configuration
⚠️ Function signatures require --config parameter
⚠️ CLI arguments and return types modified
⚠️ Provider authentication now config-driven
## Migration Path
1. Backup current environment variables
2. Copy config.user.toml.example → config.user.toml
3. Migrate ENV vars to TOML format
4. Validate: ./core/nulib/provisioning validate config
5. Test functionality with new configuration
## Validation Results
✅ Structure valid
✅ Paths valid
✅ Types valid
✅ Semantic rules valid
✅ File references valid
System ready for production use with config-driven architecture.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
2025-09-23 02:36:50 +00:00
|
|
|
|
if (is-debug-enabled) {
|
2025-09-22 22:11:41 +00:00
|
|
|
|
let timestamp = (date now | format date '%Y-%m-%d %H:%M:%S')
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"🐛 ($timestamp)($context_str) ($message)"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-step [
|
|
|
|
|
step: string
|
|
|
|
|
total_steps: int
|
|
|
|
|
current_step: int
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
|
|
|
|
let progress = $"($current_step)/($total_steps)"
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"🔄 ($progress)($context_str) ($step)"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export def log-progress [
|
|
|
|
|
message: string
|
|
|
|
|
percent: int
|
|
|
|
|
context?: string
|
|
|
|
|
] {
|
|
|
|
|
let context_str = if ($context | is-not-empty) { $" [($context)]" } else { "" }
|
|
|
|
|
print $"📊 ($context_str) ($message) ($percent)%"
|
|
|
|
|
}
|