$ show PowerShell/DSC
This repository is the Microsoft Desired State Configuration (DSC) v3 platform, a cross-platform (Linux, macOS, Windows) configuration management CLI tool written in Rust. It provides a declarative, idempotent system for managing operating system and application settings through resources (e.g., registry, services, firewall, packages) and configuration documents (JSON/YAML). The architecture is a Rust workspace of ~30 crates including the main `dsc` CLI binary, a core library (`dsc-lib`) with resource discovery and invocation, a JSON schema generation library (`dsc-lib-jsonschema`) with VS Code integration, platform abstraction libraries, and many individual resource executables (each a separate binary). It supports adapters for PowerShell and Windows PowerShell, extensions for discovery and secrets, an MCP server for AI tool integration, and Bicep integration via a gRPC server. The codebase is well-engineered with extensive tests, i18n, and consistent patterns, though its large surface area and Windows-specific code present maintenance challenges.
The LLM identified 4 files worth highlighting for reuse:
Provides a trait with ~40 methods on `serde_json::Value` for manipulating JSON Schema documents: getting/setting keywords, managing `$defs`, canonicalizing `$ref`, walking schemas, and more. This is a self-contained, generic library that can be extracted for any Rust project needing programmatic JSON Schema transformation, demonstrating non-obvious skill in schema manipulation and error handling.
Implements a robust `SemanticVersionReq` type that wraps `semver::VersionReq` with additional validation (forbids build metadata, requires explicit operators), custom parsing with strict regex, and many trait implementations (PartialEq, Ord, Display, JsonSchema). This is a reusable, well-tested version constraint type that could be extracted for any Rust project needing strict semantic version matching, demonstrating careful edge-case handling and comprehensive test coverage.
Defines the `DscRepoSchema` trait and supporting infrastructure for automatically generating JSON Schema from Rust structs with internationalized documentation. The `#[derive(DscRepoSchema)]` macro automatically generates `schema_field()` methods and schema URIs for canonical, bundled, and VS Code-enhanced versions. This pattern is reusable for any project needing schema generation with i18n, demonstrating mastery of Rust proc macros and JSON Schema mechanics.
A tree-sitter grammar for the DSC expression language used in configuration documents. It defines the syntax for functions, identifiers, strings, numbers, booleans, arrays, objects, and operators. This grammar is self-contained and can be reused in editors, CLI tools, or other language bindings to parse DSC expressions, demonstrating clean parser design and test-driven grammar development.