# ============================================================================= # Smart Build Feature - Justfile Template # ============================================================================= # This file demonstrates layered override system for smart build commands. # It will be imported by the main justfile when smart-build feature is enabled. # Layer: Feature > Template > Framework # Set shell for commands set shell := ["bash", "-c"] # ============================================================================= # SMART BUILD FEATURE COMMANDS # ============================================================================= # Build with intelligent caching (L1/L2/L3 cache layers) build-smart: @echo "โšก Building with smart caching..." cargo run --bin smart-build -- build --cached --optimization aggressive # Build with cache statistics build-cached: @echo "๐Ÿ“Š Building with cache monitoring..." cargo run --bin smart-build -- build --cached --stats --output build-stats.json # Clean build cache selectively cache-clean level="l1": @echo "๐Ÿงน Cleaning {{level}} cache layer..." cargo run --bin smart-build -- cache clean --level {{level}} # Clean all cache layers cache-clean-all: @echo "๐Ÿงน Cleaning all cache layers..." cargo run --bin smart-build -- cache clean --all --force # Show detailed cache statistics cache-stats: @echo "๐Ÿ“Š Smart build cache statistics:" cargo run --bin smart-build -- cache stats --detailed --format table # Optimize cache for better performance cache-optimize: @echo "โšก Optimizing build cache..." cargo run --bin smart-build -- cache optimize --aggressive --compress # Validate cache integrity cache-validate: @echo "๐Ÿ” Validating cache integrity..." cargo run --bin smart-build -- cache validate --repair --verbose # Show cache usage breakdown cache-usage: @echo "๐Ÿ’พ Cache usage breakdown:" cargo run --bin smart-build -- cache usage --breakdown --size-limit 1GB # Export cache configuration cache-export path="cache-config.json": @echo "๐Ÿ“ค Exporting cache configuration to {{path}}..." cargo run --bin smart-build -- cache export --config --output {{path}} # Import cache configuration cache-import path: @echo "๐Ÿ“ฅ Importing cache configuration from {{path}}..." cargo run --bin smart-build -- cache import --config --file {{path}} --validate # ============================================================================= # INCREMENTAL BUILD COMMANDS # ============================================================================= # Incremental build with dependency tracking build-incremental: @echo "๐Ÿ”„ Running incremental build..." cargo run --bin smart-build -- build --incremental --track-deps --parallel # Build only changed components build-changed: @echo "๐ŸŽฏ Building only changed components..." cargo run --bin smart-build -- build --changed-only --since HEAD~1 # Rebuild specific component with cache build-component component: @echo "๐Ÿ”จ Building component {{component}} with cache..." cargo run --bin smart-build -- build --component {{component}} --cached # Build with dependency graph analysis build-analyze: @echo "๐Ÿ“Š Building with dependency analysis..." cargo run --bin smart-build -- build --analyze-deps --output build-analysis.json --visualize # Build performance profiling build-profile: @echo "โฑ๏ธ Building with performance profiling..." cargo run --bin smart-build -- build --profile --output build-profile.json --flame-graph # ============================================================================= # SMART BUILD OPTIMIZATION # ============================================================================= # Optimize build pipeline optimize-pipeline: @echo "โšก Optimizing build pipeline..." cargo run --bin smart-build -- optimize pipeline --auto-tune --save-config # Benchmark build performance benchmark-build iterations="5": @echo "๐Ÿ Benchmarking build performance ({{iterations}} iterations)..." cargo run --bin smart-build -- benchmark --iterations {{iterations}} --compare-baseline # Tune cache parameters tune-cache: @echo "๐ŸŽ›๏ธ Auto-tuning cache parameters..." cargo run --bin smart-build -- tune cache --auto --save --test-build # Analyze build bottlenecks analyze-bottlenecks: @echo "๐Ÿ” Analyzing build bottlenecks..." cargo run --bin smart-build -- analyze bottlenecks --trace --suggestions # Optimize for CI/CD optimize-ci: @echo "๐Ÿญ Optimizing for CI/CD environments..." cargo run --bin smart-build -- optimize ci --docker --parallel --cache-remote # ============================================================================= # CACHE MANAGEMENT WORKFLOWS # ============================================================================= # Cache maintenance routine cache-maintain: @echo "๐Ÿ”ง Running cache maintenance..." #!/usr/bin/env bash set -euo pipefail echo "1. Validating cache integrity..." just cache-validate echo "2. Optimizing cache..." just cache-optimize echo "3. Cleaning old entries..." cargo run --bin smart-build -- cache clean --expired --older-than 7d echo "4. Updating cache statistics..." just cache-stats echo "โœ… Cache maintenance completed" # Cache health check cache-health: @echo "๐Ÿฅ Smart build cache health check..." cargo run --bin smart-build -- cache health --detailed --repair-suggestions # Setup cache for new project cache-setup: @echo "๐Ÿš€ Setting up smart build cache..." cargo run --bin smart-build -- cache setup --auto-configure --optimal-size # Cache backup and restore cache-backup: @echo "๐Ÿ’พ Backing up smart build cache..." mkdir -p backups/smart-build cargo run --bin smart-build -- cache backup --output backups/smart-build/cache_$(date +%Y%m%d_%H%M%S).tar.gz cache-restore backup_file: @echo "๐Ÿ“‚ Restoring smart build cache from {{backup_file}}..." cargo run --bin smart-build -- cache restore --file {{backup_file}} --validate # ============================================================================= # DEVELOPMENT WORKFLOWS # ============================================================================= # Smart development build (fastest for development) dev-build: @echo "๐Ÿš€ Smart development build..." cargo run --bin smart-build -- build --dev --hot-reload --incremental --fast # Production build with maximum optimization prod-build: @echo "๐Ÿญ Smart production build..." cargo run --bin smart-build -- build --prod --optimize-size --optimize-speed --strip # Test build with cache warming test-build: @echo "๐Ÿงช Test build with cache warming..." cargo run --bin smart-build -- build --test --warm-cache --parallel cargo test # Clean development workflow clean-dev: @echo "๐Ÿงน Clean development reset..." just cache-clean l1 just dev-build @echo "โœ… Clean development environment ready" # ============================================================================= # MONITORING AND REPORTING # ============================================================================= # Generate build report build-report: @echo "๐Ÿ“Š Generating smart build report..." cargo run --bin smart-build -- report --comprehensive --output reports/build_$(date +%Y%m%d).html # Monitor build performance monitor-builds duration="3600": @echo "๐Ÿ‘€ Monitoring build performance for {{duration}} seconds..." cargo run --bin smart-build -- monitor --duration {{duration}} --real-time --alert-threshold 120s # Compare build performance compare-builds baseline="main": @echo "๐Ÿ“ˆ Comparing build performance against {{baseline}}..." cargo run --bin smart-build -- compare --baseline {{baseline}} --metrics --visualization # Smart build dashboard build-dashboard: @echo "๐Ÿ“‹ Starting smart build dashboard..." cargo run --bin smart-build -- dashboard --bind 0.0.0.0:3002 --real-time # Export build metrics export-metrics days="7": @echo "๐Ÿ“ค Exporting build metrics (last {{days}} days)..." mkdir -p exports/smart-build cargo run --bin smart-build -- export metrics --days {{days}} --format json --output exports/smart-build/metrics_$(date +%Y%m%d).json # ============================================================================= # INTEGRATION AND TESTING # ============================================================================= # Test smart build functionality test-smart-build: @echo "๐Ÿงช Testing smart build functionality..." cargo test --package smart-build --all-features cargo run --bin smart-build -- test integration --verbose # Validate smart build setup validate-setup: @echo "โœ… Validating smart build setup..." cargo run --bin smart-build -- validate setup --environment --dependencies --cache-config # Integration test with other features test-integration: @echo "๐Ÿ”— Testing smart build integration..." @if command -v npm >/dev/null 2>&1; then \ if [ -f "e2e/smart-build.spec.js" ]; then \ npm run test:e2e:smart-build; \ fi; \ fi # Stress test build system stress-test: @echo "๐Ÿ’ช Running smart build stress test..." cargo run --bin smart-build -- stress-test --duration 300s --concurrent-builds 4 --memory-limit 2GB # ============================================================================= # CONFIGURATION MANAGEMENT # ============================================================================= # Show smart build configuration show-config: @echo "โš™๏ธ Smart Build Configuration:" cargo run --bin smart-build -- config show --detailed --effective # Update configuration update-config key value: @echo "๐Ÿ”ง Updating smart build config: {{key}} = {{value}}" cargo run --bin smart-build -- config set {{key}} {{value}} --validate # Reset to default configuration reset-config: @echo "๐Ÿ”„ Resetting smart build configuration to defaults..." cargo run --bin smart-build -- config reset --backup --confirm # Export configuration template export-config-template: @echo "๐Ÿ“‹ Exporting smart build configuration template..." cargo run --bin smart-build -- config template --output config/smart-build-template.toml # ============================================================================= # STATUS AND INFORMATION # ============================================================================= # Smart build feature status smart-build-status: @echo "โšก Smart Build Feature Status:" @echo " Version: $(cargo run --bin smart-build -- version)" @echo " Cache Size: $(cargo run --bin smart-build -- cache stats --json | jq -r '.total_size')" @echo " Hit Rate: $(cargo run --bin smart-build -- cache stats --json | jq -r '.hit_rate')%" @echo " Last Build: $(cargo run --bin smart-build -- status --json | jq -r '.last_build')" @echo " Build Time Saved: $(cargo run --bin smart-build -- status --json | jq -r '.time_saved')" # Smart build documentation smart-build-docs: @echo "๐Ÿ“š Smart Build feature documentation:" @echo " - Configuration: config/features/smart-build/" @echo " - Cache Location: $(cargo run --bin smart-build -- config get cache_dir)" @echo " - Dashboard: http://localhost:3002" @echo " - Logs: logs/smart-build-*.log" @echo " - Reports: reports/build_*.html" # ============================================================================= # LOCAL CUSTOMIZATION NOTES # ============================================================================= # # This is a feature-layer justfile that gets imported when smart-build feature # is enabled. To customize smart build commands locally: # # 1. Create 'config/local/justfile' in your project # 2. Override any smart-build commands there # 3. They will take precedence due to layer priority: Local > Feature > Template # # Example local override: # ``` # # Override build-smart with custom optimization # build-smart: # @echo "๐ŸŽฏ Custom smart build with team settings..." # cargo run --bin smart-build -- build --cached --team-optimized --notification slack # ``` # =============================================================================