Bring a large saucepan of salted water to the boil. Add the wholegrain pasta and cook for 10-12 minutes until al dente. Reserve about 60ml of the pasta water, then drain the pasta.
Meanwhile, heat 2 tbsp olive oil in a large frying pan over a medium heat until it shimmers.
Add the garlic and chilli flakes (if using) and sauté for 1-2 minutes, stirring constantly, until the garlic is fragrant and just starting to turn golden.
Add the halved cherry tomatoes and cook for 3-5 minutes, stirring occasionally, until they soften and begin to burst.
Add the spinach in batches, stirring until wilted, then pour in the vegetable stock and stir to combine.
Add the drained pasta to the pan and toss to coat. If the sauce seems too thick, add a little of the reserved pasta water to loosen it.
Season generously with salt and freshly ground black pepper and toss again.
Divide between plates and serve immediately, scattering over the grated Parmesan.