Terminal¶
The Terminal class creates an interactive shell — it manages the readline loop, command dispatch, lifecycle hooks, and history persistence.
History — command history persistence
Commands — defining commands
Arguments — typed accessors and prompting
Hooks — lifecycle event reference
Options¶
| Option | Default | Description |
|---|---|---|
prompt |
"> " |
Prompt string |
stdin |
process.stdin |
Input stream |
stdout |
process.stdout |
Output stream |
historySize |
100 |
Readline history size |
historyPath |
— | Path for persisting command history (JSON array) |
Lifecycle¶
start() initializes the readline interface, fires onStart hooks, and begins accepting input. stop() terminates the loop, runs beforeExit / onStop hooks, and cleans up. setPrompt() changes the prompt string at runtime.