Skip to content

Architecture

PackagePurpose
Repl.CoreDependency-free authoring/runtime core: routing, parsing, binding, output pipeline, CoreReplApp, IReplMap, Results.*
Repl.DefaultsDI-enabled facade (ReplApp), lifecycle orchestration, default composition profiles (UseDefaultInteractive, UseCliProfile, UseEmbeddedConsoleProfile)
ReplMeta-package — bundles Core + Defaults + Protocol. Start here.
Repl.ProtocolMachine-readable contracts: help schemas, error contracts, minimal MCP manifest types
Repl.WebSocketWebSocket transport for hosted sessions (ReplWebSocketSession over StreamedReplHost)
Repl.TelnetTelnet session protocol (framing, NAWS and terminal-type negotiation) over a WebSocket, a Stream or an IDuplexPipe
Repl.RemoteRemote administration of a running process: wire contracts, named-pipe listener, console and one-shot clients
Repl.Remote.DefaultsConnects Repl.Remote to a ReplApp through ReplAppRemoteBackend
Repl.SpectreSpectre.Console integration: rich prompts, renderables, IAnsiConsole DI injection
Repl.McpMCP server: UseMcpServer(), tool/resource/prompt mapping, MCP Apps, transport factory
Repl.TestingIn-memory multi-session test harness: ReplTestHost, ReplSessionHandle, typed results/events
Your application registers commands via Repl.Defaults ReplApp, UseDefaultInteractive, UseCliProfile Repl.Core routing, binding, output dispatches to runtime channels Console local WebSocket Repl.WebSocket Telnet Repl.Telnet MCP Repl.Mcp Remote Repl.Remote Testing Repl.Testing Custom any stream
Every channel runs the same command graph, registered once through Repl.Defaults and Repl.Core.

Repl.Core has no dependencies outside the .NET BCL. Integration packages depend on Core but not on each other, so you pick what you need. The remote pair is the one exception: Repl.Remote depends on nothing in Repl, and Repl.Remote.Defaults connects it to Repl.Defaults.

1 Parse route + bind 2 Middleware app.Use(...) 3 Dispatch handler via DI 4 Output transformer 5 Render formatter
The main path of a command, in five phases. Pipelines & Integration lists the twelve stages in detail.
  • Parse — route matched, parameters bound and validated against constraints
  • Middleware — the ordered pipeline registered with app.Use(...) (auth, logging, tracing, etc.)
  • Dispatch — handler invoked via DI
  • Output — return value passed to the output transformer for the active channel
  • Render — formatter (text/JSON/YAML/XML/Spectre) writes to the channel’s output stream

Pipelines & Integration lists the twelve stages behind these phases, including the help and completion short-circuit and the exit code.

A channel is the transport through which a session runs. The same command graph is executed on all channels. Each channel implementation adapts input/output to its transport protocol.

Custom transports use StreamedReplHost: it writes to a TextWriter, receives text through EnqueueInput, and runs a session with RunSessionAsync. The built-in Repl.WebSocket and Repl.Telnet packages are examples — SSH, named pipes, TCP sockets, or gRPC streams fit the same model.

TypeRole
IReplMapRegistration interface — Map(...), Context(...), AutomationHidden(), AsResource()
IReplAppRuntime interface — Run(args)
IReplInteractionChannelPrompt/progress channel injected into handlers — namespace Repl.Interaction
ITerminalInfoSession metadata (window size, ANSI capabilities) — namespace Repl.Interaction
IReplIoContextActive I/O context (Output, Error, IsHostedSession, …)
ResultsSemantic return helpers — Results.Success(msg), Results.Error(code, msg), Results.Cancelled(msg)

First-class paging contracts (IReplPageSource<T>, ReplPage<T>) sit in the Output phase above, at stage 10 (Result Processing) of the full pipeline. The integrated terminal pager, the JSON page envelope ($type: "page"), and the MCP _replCursor/_replPageSize inputs are all driven from this layer — the same handler code works across all output formats.

→ Result-Flow Paging · Cursor Patterns

Full architecture documentation (with diagrams): docs/architecture.md in the source repository.