Initial refactor of cli.js to nodeterm.js