How to migrate contracts between complex Daml models, using generated Daml code

Update: I ended up writing a small extension to the DAML LF API Type Signature library extracting those type metadata which are needed for codegen, e.g. for variants:

{
    "path" : "<path/to/the/dalf.dalf>",
    "kind" : "variant",
    "typeConstructor" : "<type constructor of the variant>",
    "options" : [
      {
        "valueConstructor" : "<value constructor of option #1>",
        "fields" : 0
      },
      {
        "valueConstructor" : "<value constructor of option #2>",
        "fields" : 1
      }
    ],
    "typeParams" : 0
  },