A Go SDK for Windows Configuration Service Providers (CSPs), generated from Microsoft's canonical DDF v2 (Device Description Framework) metadata.
The lifecycle is: collect → snapshot → generate → ship.
Microsoft DDF v2 zip ──fetchddf──▶ metadata/csp/*.json ──gencsp──▶ windowscsp/{csp,policy}/<area>/
(download.microsoft.com) (committed, reviewed) (generated LCRUD packages)
| Concern | Borrowed from |
|---|---|
| DDF acquisition, snapshots, provenance, update PR workflow | go-bindings-wmi (cmd/fetchddf, internal/cspschema) |
| Client + per-domain service registry | go-sdk-jamfpro-v2 (jamfpro.go, account_preferences) |
| Template-driven codegen, view/render firewall, file separation, regen CI gate | go-bindings-win32 (internal/codegen, functions.tmpl, biometricframework) |
go.mod:github.com/deploymenttheory/go-sdk-windowscsp, Go 1.22.- Directory layout:
cmd/fetchddf/ acquisition CLI (download, verify, snapshot)
cmd/gencsp/ codegen CLI (offline, deterministic)
internal/ddf/ DDF v2 XML parser + snapshot model
internal/codegen/ naming / pipeline / view / build / render / fileasm / generator
metadata/csp/ committed JSON snapshots + PROVENANCE.json
windowscsp/ public SDK root (Client, registry)
windowscsp/client/ transport interface, Value, mock transport
windowscsp/syncml/ SyncML (OMA-DM) document builder + recorder transport
windowscsp/csp/<area>/ generated: standalone CSPs (~70)
windowscsp/policy/<area>/ generated: Policy areas (~240)
- Parser for DDF v2 XML (
MgmtTree/Node/DFProperties+MSFT:extensions).AccessType/DFFormatare sets of empty child elements — captured with anxml:",any"+xml.Namecatch-all. Dynamic nodes have an emptyNodeNameand carryMSFT:DynamicNodeNaming; the model keepstitle(DFTitle),dynamicNaming, applicability, allowed values, deprecation, GP mapping. cmd/fetchddf: downloads the pinned release (DDFv2Feb2026.zip, sha256bf667d…ff14), verifies the digest, parses every.xmlzip entry, writes one JSON snapshot per CSP tometadata/csp/plusPROVENANCE.json, prunes stale snapshots.-zipfor offline runs,-discoverscrapes the Microsoft Learn DDF page for a newer drop URL.- Snapshots are committed; fetching a new release is a deliberate, reviewed act.
Two-firewall architecture:
- build is the only stage that inspects the snapshot model. It flattens node trees into fully-resolved view models: URI constants/builders, LCRUD methods, enum constant blocks, service metadata.
- render turns view models into Go source only through embedded
text/templatefiles (templates/*.tmpl):doc.tmpl,service.tmpl,uris.tmpl,functions.tmpl,enums.tmpl,registry.tmpl.
fileasm is the single scaffold chokepoint: // Code generated by go-sdk-windowscsp-codegen. DO NOT EDIT. header, package clause, grouped
imports, go/format.Source. The header doubles as the prune sentinel:
generated files not rewritten in a run are deleted; hand-written files are
never touched.
Determinism: sorted node walks, sorted package lists, deterministic collision
suffixing, LF-normalized output (.gitattributes), gofmt.
| DDF access | Generated method | Notes |
|---|---|---|
Get (leaf) |
Get<Node>(ctx) (T, error) |
T from DFFormat: int→int64, bool→bool, chr/date/time/xml→string, b64/bin→[]byte, float→float64 |
Get (interior with dynamic children) |
List<Node>(ctx) ([]string, error) |
OMA-DM Get on an interior node enumerates children |
Add (leaf) |
Create<Node>(ctx, value T) error |
|
Add (dynamic interior) |
Create<Node>(ctx, name string) error |
creates the container node |
Replace |
Update<Node>(ctx, value T) error |
|
Delete |
Delete<Node>(ctx[, name string]) error |
|
Exec |
Exec<Node>(ctx[, value T]) error |
value omitted for null format |
Dynamic path segments (empty NodeName) become string parameters, named
from the node's DFTitle when present. Method doc comments carry the DDF
description, default, applicability (min OS build, CSP version), and
deprecation notices.
client.Clientis the narrow transport interface all generated services depend on:Get,List,Add,Replace,Delete,Execagainst OMA-URIs with a typedValue{Format, Data}.client.MockClient: in-memory CSP tree for tests.syncml: renders operations into OMA-DM SyncML fragments/documents (for MDM servers and Intune custom OMA-URI), plus aRecordertransport that queues writes and emits the batch document.- Root package
windowscsp:NewClient(transport) *Clientwith generatedCSPandPolicyfamily registries (one field per generated domain), the jamfpro three-tier registry pattern. - A real device-side executor (MDM WMI bridge,
root\cimv2\mdm\dmmap) can implementclient.Clientout-of-tree (e.g. from go-bindings-wmi).
- Run
fetchddfagainst the Feb 2026 drop → commitmetadata/csp/. - Run
gencsp→ commitwindowscsp/csp/,windowscsp/policy/, registries. go build ./...must pass.
internal/ddf: fixture DDF XML covering enums, dynamic nodes, applicability, deprecation → parsed-model assertions.internal/codegen: golden-file tests (fixture snapshot → expected emitted files) + naming unit tests.cmd/fetchddf: synthetic in-memory zip round-trip.- Generated-surface smoke tests against
client.MockClient(Reboot CSP, one Policy area) — typed round-trips, URI correctness. windowscsp/syncml: document rendering tests.- Determinism: regen-twice equality is enforced by the CI diff gate.
ci.ymltest: build, vet (non-generated), unit tests (ubuntu + windows).regen:go run ./cmd/gencspfrom committed snapshots, thengit add -N windowscsp && git diff --exit-code— the determinism gate.
ddf-update.yml: weekly schedule + manual dispatch. Runsfetchddf -discover(finds new Microsoft drops), regenerates, and opens a PR viapeter-evans/create-pull-requestwhenmetadata/or generated code changed.- Existing template workflows (lint, release-please, dependabot) retained.
- Executing CSP operations on-device (WMI/MDM bridge) — interface seam only.
- SyncML client protocol (sessions, auth); only document construction.
- DDF
DependencyBehavior/CommonErrorResultsmodeling.