Improve error diagnostics
Errors that are thrown within node REPL are serialized and returned as string to repl_manager. At this point it is a bit hard to understand what has just happened within repl_manager; parsing stack traces is not fun and error-prone. In order to work this issue around I first go through all the source code lines and separate REPL commands from the actual source code. After this I reorder source code lines: all theREPL commands (.break, .clear) go first, all the source code goes after and it is wrapped into a ‘try/catch’ block that just returns an exception message if it catches anything.
Another improvement was to extract the javascript code templates used by repl manager into repl_scripts.json file and use them as templates.