# Build System\n\n**Purpose**: Core build tools for compiling Rust components and bundling Nushell libraries.\n\n## Tools\n\n### Compilation\n\n- **`compile-platform.nu`** - Compile Rust orchestrator, control-center, and MCP server\n  - Multi-platform cross-compilation\n  - Release/debug build modes\n  - Feature flag management\n  - Output to `dist/platform/`\n\n### Bundling\n\n- **`bundle-core.nu`** - Bundle Nushell core libraries and CLI\n  - Package provisioning CLI wrapper\n  - Core library bundling (lib_provisioning)\n  - Configuration system packaging\n  - Validation and syntax checking\n  - Optional compression (gzip)\n  - Output to `dist/core/`\n\n### Validation\n\n- **`check-system.nu`** - Validate build environment\n  - Check required tools (Rust, Nushell, Nickel)\n  - Verify dependencies\n  - Validate configuration\n\n## Build Process\n\nComplete build pipeline:\n\n```{$detected_lang}\njust build-all                  # Platform + core\njust build-platform             # Rust binaries only\njust build-core                 # Nushell libraries only\n```\n\nBuild with validation:\n\n```{$detected_lang}\njust build-core --validate      # Validate Nushell syntax\n```\n\nDebug build:\n\n```{$detected_lang}\njust build-debug                # Build with debug symbols\n```\n\n## Output\n\nBuild outputs go to `dist/`:\n\n- `dist/platform/` - Compiled Rust binaries\n- `dist/core/` - Nushell libraries and CLI\n- `dist/config/` - Configuration files\n- `dist/core/bundle-metadata.json` - Build metadata\n\n## Architecture\n\nEach build tool follows Nushell 0.109+ standards:\n\n- Immutable variable patterns\n- Explicit external command prefixes (`^`)\n- Error handling via `do { } | complete` pattern\n- Comprehensive logging\n\n## Related Files\n\n- `provisioning/justfiles/build.just` - Build recipe definitions\n- `provisioning/tools/distribution/` - Distribution generation using build outputs\n- `provisioning/tools/package/` - Packaging compiled binaries
