Janeway is a Node.js console REPL with an interactive TUI (Terminal User Interface). It provides:
- Interactive object inspection (clickable, expandable properties)
- Syntax-highlighted CLI input with autocomplete
- Hex viewer for binary Buffers
- Status bar with spinners
- Console hijacking (reformats console.log/warn/error output)
Used by AlchemyMVC to provide an enhanced development console.
const Janeway = require('janeway');
Janeway.start(options, callback);
// Logging (or just use console.log - it's hijacked)
Janeway.print('info', ['message', object]);
// Status bar
Janeway.setStatus('Processing...');
Janeway.setStatus({text: 'Loading', spinner: 'dots'});
// Terminal title
Janeway.setTitle('My App');
// Menu indicators
Janeway.addIndicator('⚡', {weight: 10, callback: () => {}});┌─────────────────────────────────────────┐
│ [Copy JSON] indicators... │ ← Menu bar (height: 1)
├─────────────────────────────────────────┤
│ │
│ Log output (scrollable, clickable) │ ← LogList manages LogLines
│ │
├─────────────────────────────────────────┤
│ > cli input status │ ← Editarea + Status
└─────────────────────────────────────────┘
console.log(value)
→ Janeway.print('info', args, options)
→ LogList.consoleLog(args, type, options)
→ Creates LogLine subclass (InfoLogLine, ArgsLogLine, etc.)
→ line.dissect() - breaks args into inspectable parts
→ LogList.pushLine(line)
→ Renders to blessed box
JanewayClass (lib/init.js)
- Main singleton, controls TUI via
reblessed - Hijacks console methods
- Manages VM context for CLI evaluation
LogList (lib/class/log_list.js)
- Manages output box content
- Array of LogLine instances
- Handles scroll, click, drag events
- Deduplicates consecutive identical lines
LogLine hierarchy (lib/class/):
LogLine- Base class with gutter, fileinfo, coloringArgsLogLine- Multiple arguments, dissects into propertiesPropertyLogLine- Single object propertyStringLogLine- String displayHexLogLine- Buffer hex viewerCommandLogLine,EvalOutputLogLine- CLI I/OErrorLogLine,WarningLogLine,InfoLogLine- Log types
Status (lib/class/status.js) - Bottom status bar with spinner support
Indicator (lib/class/indicator.js) - Top menu bar items
User config: ~/.janeway/janeway.js or ~/.janeway/janeway.json
Key options for Janeway.start(options):
{
output_to_stdout: false, // Also write to stdout (not just TUI)
screen: null, // Custom blessed screen
extra_output: null, // Additional output stream
}Objects can customize their Janeway representation using symbols:
const Janeway = require('janeway');
class MyClass {
get [Janeway.ARG_LEFT]() {
return 'MyClass'; // Yellow left side: type/name
}
get [Janeway.ARG_RIGHT]() {
return '5 items'; // White right side: size/summary
}
}
// Displays as: {MyClass 5 items}Janeway.LEVELS = {
FATAL: 0, SEVERE: 1, ERROR: 2, WARNING: 3,
TODO: 4, INFO: 5, DEBUG: 6, HIDEBUG: 7
};lib/
├── init.js # Main JanewayClass (2600+ lines)
├── class/
│ ├── log_list.js # Output management
│ ├── log_line.js # Base log line class
│ ├── args_log_line.js # Argument dissection & inspection
│ ├── property_log_line.js
│ ├── string_log_line.js
│ ├── hex_log_line.js # Binary hex viewer
│ ├── other_log_line.js # Command, Eval, Error, Warning, Info lines
│ ├── editarea.js # CLI input widget
│ ├── indicator.js # Menu indicators
│ └── status.js # Status bar
└── spinners.js # Spinner animation frames
Interactive (TUI):
- Requires TTY (
process.stdout.isTTY === true) - Full blessed screen with mouse/keyboard
- Object inspection, autocomplete, status bar
Janeway.start()createsthis.logList
Non-Interactive (stdout):
- When
!this.logList(Janeway not started) oroutput_to_stdout: true - Goes through
print()method lines 985-1043 - Format:
[type] [file:line] inspected_args...
Compact mode (automatic for LLM/CI contexts):
- Enabled when
!process.stdout.isTTYorJANEWAY_COMPACT=1env var - No ANSI colors (also strips from string arguments)
- No terminal title escape sequences
- Objects summarized:
depth: 1,maxArrayLength: 3,maxStringLength: 100 - Output format:
file:line message(info/log) or[error] file:line message
CLI input is evaluated in a separate VM context:
$0- Last selected/clicked value- All requires resolve from
process.cwd()/node_modules - Supports
awaitat top level
-
TTY required for TUI - Janeway checks
process.stdout.isTTY; fails gracefully without it -
Console hijacking -
console.log/warn/errorare replaced; original saved asconsole._logetc. -
Deduplication - Identical consecutive logs show count instead of repeating
-
Color handling - In compact mode (non-TTY), colors are never added; otherwise stripped if
!COLORTERM -
ArgsLogLine.dissect() - Core method that breaks objects into displayable parts; uses
ARG_LEFT/ARG_RIGHTsymbols -
Blessed library - Uses
reblessed(fork of blessed) for TUI; screen.render() is throttled