refactor: introduce IRepl, move IReplEngine to own file, add guards, remove redundant code, fix code formatting