Skip to content

Commit

Permalink
Cleanup and updates in prep for official 1.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
jwarkentin committed Jun 23, 2017
1 parent 94ecab0 commit 7394f0f
Show file tree
Hide file tree
Showing 11 changed files with 3,655 additions and 39 deletions.
5 changes: 3 additions & 2 deletions TODO.md
Expand Up @@ -10,6 +10,7 @@
- This would create a mechanism that could be used to expire sessions if, for example, a developer connected from a user's machine to debug and then walked away and forgot to disconnect, thus leaving a knowledgable user with full access to the internals of the server.

### Documentation
- Show good examples (video?) of wrapping an existing server socket with Node Monkey websocket and including script on page
- Show example of running command to SSH to server on SSH doc page
- Show examples of how to implement custom SSH commands under server `addCmd()` documentation
- Clarify that "Client" refers to the browser in the documentation
Expand All @@ -32,12 +33,12 @@

### SSH
- Allow an application name to be set (default: 'Node Monkey') which gets interpolated into the prompt text
- Implement CTRL_K, CTRL_U and any other standard terminal features that seem useful
- Refactor to improve organization and keep terminal events, data and management separate. Also need to expose more useful API.
- Consider how to make authentication and command management pluggable in preparation for moving to its own module
- Break out into separate module

### Browser
- Hide reconnection errors and just show 'Reconnecting...' instead. Once it connects, show a simple horizontal rule to break up the output.
- Consider possibility of implementing a simple CLI emulator
- Create shortcut in browser (`Alt+R`?) to pop up prompt for command and then show the output in an alert box instead of the terminal

Expand All @@ -49,4 +50,4 @@
- Replace object's functions with a call that sends a command, runs the function and returns the result
- Is it possible to rebuild full objects including inheritance?
- Implement a way to document command help info and view existing commands as well as individual command documentation
- NOTE: The full set of available commands can already be seen by pressing `TAB` to auto-complete with nothing entered over SSH, but this doesn't solve the problem for the browser. Probably just need to add a command to list commands (possibly with an auto-complete like prefix filter).
- NOTE: The full set of available commands can already be seen by pressing `TAB` to auto-complete with nothing entered over SSH, but this doesn't solve the problem for the browser. Probably just need to add a command to list commands (possibly with an auto-complete-like prefix filter).
2 changes: 1 addition & 1 deletion dist/monkey.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/monkey.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/server.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/server.js.map

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions doc/server.md
Expand Up @@ -69,7 +69,7 @@ The `options` object you can provide to Node Monkey is nested and hopefully some
* `disableLocalOutput<bool>`: When `true` and `attachConsole()` has been called all local console output will be silenced and logged output will only be visible in the browser console. Can be overridden on each individual call to `attachConsole()` (see [docs](nodemonkeyattachconsole)).

* `client<object>`
* `showCallerInfo<bool>`: When `true` all browser console output will show at least the file and line number where the call was made that logged the output.
* `showCallerInfo<bool>`: When `true` all browser console output will show at least the file and line number where the call was made that logged the output. There is a generally negligible performance penalty (microseconds) for showing call traces. The only time it would matter is during rapid, continuous execution of a function that triggers a call trace.
* `convertStyles<bool>`: Sometimes terminal output contains special codes that create colored output in the terminal. When true, this attempts to convert the terminal output styles to the equivalent browser console styles.

* `ssh<object>`
Expand Down Expand Up @@ -126,16 +126,15 @@ If you provide your own server you can view output in the console of your own we

### NodeMonkey#BUNYAN_STREAM

If you use the awesome [Bunyan](https://github.com/trentm/node-bunyan) library for logging, you can add Node Monkey as a Bunyan log stream. If you pass Bunyan's `src: true` option in development you will get good call traces in the web console. You generally should not set this flag in production as it can seriously hurt performance.
If you use the awesome [Bunyan](https://github.com/trentm/node-bunyan) library for logging, you can add Node Monkey as a Bunyan log stream. It is highly recommended that you don't pass `src: true` when creating the logger since there is a performance penalty and it will be ignored since Node Monkey already performs its own optional call traces.

**Example**
```js
let monkey = require('node-monkey')(),
bunyan = require('bunyan')
let monkey = require('node-monkey')()
let bunyan = require('bunyan')

let logger = bunyan.createLogger({
name: 'app',
src: true, // NOTE: Do not enable this flag in production
streams: [
{
level: 'info',
Expand Down
26 changes: 23 additions & 3 deletions doc/ssh.md
Expand Up @@ -18,12 +18,34 @@ let monkey = require('node-monkey')({

## Usage

**SSH connection example**

If you were running your server on `localhost` on the default port and without any accounts created, you would run this command:

```
ssh guest@localhost -p 50501
```

You would then be prompted for a password. The default password for the guest account is 'guest'. Once authenticated, you will be presented with a command prompt provided by your application with any custom commands you've registered that looks like this (by default):

```
[Node Monkey] guest@YourHostName:
```

Pressing `TAB` at an empty prompt will show you all available commands and allow you to select one using `TAB` or the left and right arrow keys.

#### Features currently supported

* Tab autocomplete for commands
* Command history (with up/down arrow keys)
* Space at start of command prevents it from being recorded in command history
* Holding CTRL while pressing the right and left arrow keys jumps the cursor by whole words
* CTRL+D exits
* CTRL+L clears the screen
* CTRL+K clears from the cursor to the end of the line
* CTRL+U clears from the cursor to the beginning of the line
* CTRL+W clears the previous word
* ALT+D clears the next word

#### Built-in commands

Expand All @@ -36,6 +58,4 @@ let monkey = require('node-monkey')({

#### Notable missing features

* Holding CTRL while pressing the right and left arrow keys does nothing
* CTRL+C to stop commands
* CTRL+U and CTRL+K for clearing from cursor to beginning and end of line
* CTRL+C to abort running commands

0 comments on commit 7394f0f

Please sign in to comment.