With the internal slab attached to the 1 W LED heatsink, some double-sided foam tape affixes an Arduino Nano to one side of the slab:
The MP1584 regulator and its 2.2 Ω current-sensing resistor (tacked down with acrylic adhesive) go on the other side:
The Arduino and regulator draw power from the Bafang motor controller’s 6.3 V headlight circuit. The 2.2 Ω resistor sets the LED current to 360 mA = 900 mW. The blue wire connects the Arduino’s default LED output pin (D13) to the regulator’s Enable input (pin 2) to allow programmatic blinkiness.
The end view shows everything Barely Fits™:
All it needs is a rear cover of some sort …