Evolution of thermally pulsing asymptotic giant branch stars - I. the COLIBRI code