My particular immediate use case would be to export the board outline and mounting holes from a kicad project (SVG or DXF, whatever works) and build a chassis for it. Obviously I can do this in freecad but I've been looking for an intuitive cad-as-code system to check into git instead. So this would be awesome!
While not code as CAD, Dune 3D has the creation of enclosures for electronics projects as its _raison d’être_, and has a facility for Python scripting: