You could do something like this:

View the simulation in falstad.com
To build it1, I started with a simple 3-bit "up" counter, similar to the one below - except I used T-flip flops for simplicity, and we only need the first three stages.

image credit: www.allaboutcircuits.com
And a "down" counter:

image credit: www.allaboutcircuits.com
The goal is to have the circuit change from an "up" counter to a "down" counter, and vice versa, when the outputs become binary 111 and 000, respectively.
To do this, I added A1, to detect when the outputs are all high, and A2 to detect when they are all low. The outputs of these two detectors are then sent to Q4 to set and reset the direction flow. So, Q4 can be thought of as a direction controller.
Notice that when Q4 is reset (i.e. has a 0 output) the XOR gates X1 and X2 are simply voltage followers of Q1 and Q2. So, X1 and X2 essentially become transparent.
When Q4 is set (has a 1 output), X1 and X2 invert the outputs of Q1 and Q2, and therefore mimic the \$\bar Q\$ signals. And it is the \$\bar Q\$ signals which are used to create the "down" counter, in the image above.
1I'm using the "I" here because there are likely many different ways to accomplish this. Here, I'm just discussing what I did.