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)
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 negotiation) layered over Repl.WebSocket
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
┌────────────────────────────────────────────────────────────────────────────────────┐
│ Local console │ Repl.WebSocket │ Repl.Telnet │ Repl.Mcp │ Repl.Testing │ custom… │
└────────────────────────────────────────────────────────────────────────────────────┘

Repl.Core has no dependencies outside the .NET BCL. All integration packages depend on Core but not on each other — you pick what you need.

  1. Parse — route matched, parameters bound and validated against constraints
  2. Middleware — ordered pipeline of IReplMiddleware (auth, logging, tracing, etc.)
  3. Dispatch — handler invoked via DI
  4. Output — return value passed to the output transformer for the active channel
  5. Render — formatter (text/JSON/YAML/XML/Spectre) writes to the channel’s output stream

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 implement StreamedReplHost, which accepts any (TextReader, TextWriter) pair. 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)

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