Pre- and post-hooks for 'clean' target

I just noted that per and post-hooks do not work for the clean target. Could that be added? Or is there a way to make it work by some advanced scripting?

The reason I would like to have a hook on clean is that I want to have an easily accessible command to disable the debugWire mode of an AVR MCU.


I don’t see in the core how that would be a hookable event, so you would need to open an issue at Issues · platformio/platformio-core · GitHub.

Do you really want this to be a side-effect of a “Clean Project”? Modifying the MCU? I think that’s better suited for a custom target, that also shows up in the VSCode task list as its own task. See example.


Thanks a lot,