Hello!
If you're asking how to go from code to blocks, we don't have any specific for doing that. It's hard to do generally because there are some JavaScript semantics (like assigning functions to variables) that Blockly doesn't have a way to visualize. Theoretically you could create a parser for a restricted set of JavaScript and use that to create your blocks.
If you just want to create blocks programmatically (not go from code to blocks), you can check out our
serialization docs.
I hope that helps! If you have any further questions please reply =)
--Beka