PlatformIO Community

Custom upload protocol defined from board JSON

I usually program the new ATtiny series 1 using pyupdi with a USB to Serial adapter.
I then upload the firmware.hex file built with PlatformIO through terminal commands.
I would like to define the upload command into the custom board JSON file so that every time I create a new project the platformio.ini already contains the instructions needed to upload the firmware.
I’m not sure this is possible and spending some time looking at the documentation and the PlatformIO code I concluded that I need to create a new framework.
Whatever setting I use I still get avrdude as default upload command.
Can you help me understand if there is a way to define pyupdi as default upload command when creating a project with certain boards?
Thanks for the help.

Just in case someone is interested I came across another piece of documentation I missed earlier: Custom Upload Tool

Apparently the way to go is to define an extra script in the platformio.ini file:

; place it into the root of project or use full path
extra_scripts = extra_script.py
upload_protocol = custom

And override the UPLOADCMD variable in extra_script.py script placed in the project main folder:

Import("env")

# In-line command with arguments
env.Replace(
    UPLOADCMD="executable -arg1 -arg2 $SOURCE"
)

Unfortunately, this still requires making these changes every time a new project is created so it doesn’t help my cause.
But still, happy to understand PlatformIO better.