A CC-CV control is a classic in battery management systems. Basically, you have two loops:
a voltage loop for constant-voltage operation (CV) which observes the output voltage and maintains it to the regulated level by generating a frequency-compensated error voltage.
a current loop for constant-current operation (CC) which senses the output current - usually via a resistive shunt - and keeps it constant while the output voltage goes down.
In a practical implementation, the two loops are ORed meaning that when one takes the lead, the other one is silent. For instance, if you want to regulate at a 12-V level with a 1-A CC current, then if you draw 650 mA, the CC loop remains silent while the CV takes the leads. If you increase the current and reaches 1 A, then the CC will take the lead, making the output voltage drop as the current increases (the output is the load resistance by the CC current). As voltage regulation is lost, the CV loop becomes silent and the CC loop leads the regulation effort.
Above is a typical configuration for two ORed op-amps with two different reference voltages. A 2.5-V source for the CV and a much lower value, e.g. 100 mV, for the current sense (you want a low-value shunt resistance). When the CV op-amp takes the lead, e.g. with an output current less than the CC value, the \$D_V\$ diode conducts and drives \$V_{err}\$. Because the current is below the CC level, op-amp CC rails up and thus \$D_I\$ is blocked. When you now reach the CC target and \$V_{out}\$ starts dropping, \$D_V\$ blocks and \$D_I\$ conducts with the CC op-amp taking the lead.
In your case, you have to identify how the buck is controlled and build the CC-CV circuitry. Ac compensation differs for the two loops but, usually, the CC section Bode plot is the CV section scaled down by the shut element value. I have covered a compensation example in my blue book on control loops.