Libraw has a cli tool (or sample) ‘4channels’. It probably works different for xtrans camera’s (or not at all) but it writes 4 pgm files for the 4 channels in the Bayer data , raw with no white balance and gamma and black subtraction and such.
Tools like imagemagick or vips can tell you the maximum value your camera can record (not the same for every camera ) . The white points per channel for your camera are in libraw / dcraw / other OSS raw converter source code . Maybe exiftool can even extract it from the metadata. I believe the ‘just show me info do not process’ mode from the libraw dcraw emu shows you this.
I would parse the max from vips output, or even have imagemagick write a ‘clipped’ or ‘safe’ depending if the max value is in your file.