<repo_name>keyvanm/node-narrator<file_sep>/index.js
require('babel-register')({
   presets: [ 'es2015' ]
});

const play = require('./play').default;
console.log(play);
play();
<file_sep>/play.js
import Character from './character';


const player = new Character({ id: "self", name: "Anonymous" });
const ai = new Character({ id: "ai", name: "RE_" });

const play = () => {
  ai.says("Greetings!");
  player.name = ai.asks(player, "Whats your name?");
  ai.says(`Good to meet you ${player.name}`);
  player.age = ai.asks(player, "How old are you?");
  ai.says(`${player.age} is a good age`);
}

export default play;
<file_sep>/interface.js
// import prompt from 'prompt';
var promptSync = require('prompt-sync')();
// prompt.start();


export function dialog(character, text) {
  const message = {
    sender: {
      id: character.id
    },
    content: {
      type: 'text',
      text
    }
  };
  const logText = `> [${character.name}] ${text}`;
  console.log(logText);
  return logText;
}

export function askText(character, player, text) {
  const promptText = dialog(character, text);
  // prompt.get(promptText, (err, response) => {
  //   const message = {
  //     sender: {
  //       id: player.id
  //     },
  //     content: {
  //       type: 'text',
  //       text: response
  //     }
  //   };
  //   console.log(`\$ ${response}`);
  //   return response;
  // });
  const response = promptSync("$ ");
  const message = {
    sender: {
      id: player.id
    },
    content: {
      type: 'text',
      text: response
    }
  };
  return response;
}
