Skip to content

Repl class

Home > streplts > Repl

Primary stateful orchestrator managing terminal streams, inputs, UI rendering, and script evaluation.

Signature:

export declare class Repl

Instantiates terminal raw environments to manage input text buffers, processes visual dropdown multi-line items, and maintains history and selection spaces for customized user sessions.

Constructor

Modifiers

Description

(constructor)(opts)

Initializes an instances of the interactive REPL shell environment.

Property

Modifiers

Type

Description

context

Record<string, any>

Contextual operational application state accessible in custom command hooks and run pipelines.

globals

Record<string, any>

Registered structural package tooling and globals bound into Javascript VM contexts.

Method

Modifiers

Description

after(fn)

Registers a post-execution completion monitoring hook triggered when commands finalize correctly.

ask(prompt)

Asks a yes/no question and waits for a valid response, resolving with the answer.

before(fn)

Registers an interception hook executing prior to executing valid matching user inputs.

box(content, padding)

Wraps a string (or multi-line string) in an ASCII box.

command(def)

Fluent interface attaching an executable or namespace definition to the application environment.

inspect(obj, depth)

Eliminates [Object object] by properly inspecting deeply nested objects and arrays.

progress(label)

Renders a progress bar. Usage: const update = repl.progress(“Building…”); update(0.5); // 50%

select(prompt, choices)

Shows a dropdown list allowing the user to select an option using arrow keys.

spinner(text)

Shows a spinner. Returns a stop function. Usage: const stop = this.spinner(“Loading…”); await task(); stop();

start()

Switches the selected stream target to interactive raw conditions and spins up active key reading pipelines.

table(data, options)

Renders an array of objects as a formatted table.