Skip to content

ReplApp

DI-enabled REPL application facade for common hosting scenarios.

public sealed class ReplApp : IReplApp, ICoreReplApp, IReplMap
  • BuildMcpServerOptions(ICoreReplApp, Action<ReplMcpServerOptions>, IServiceProvider)
  • UseGlobalOptions<T>(ReplApp)
  • BuildMcpServerOptions(ReplApp, Action<ReplMcpServerOptions>)
  • UseMcpServer(ReplApp, Action<ReplMcpServerOptions>)
  • UseDocumentationExport(ReplApp, Action<DocumentationExportOptions>)
  • UseCliProfile(ReplApp)
  • UseDefaultInteractive(ReplApp)
  • UseEmbeddedConsoleProfile(ReplApp)
  • UseSpectreConsole(ReplApp, Action<SpectreConsoleOptions>)

Context(string, Action<IReplApp>, Delegate?)

Section titled “Context(string, Action<IReplApp>, Delegate?)”

Creates a top-level context segment and configures nested routes.

public IContextBuilder Context(string segment, Action<IReplApp> configure, Delegate? validation = null)

IContextBuilder

Context(string, Action<IReplMap>, Delegate?)

Section titled “Context(string, Action<IReplMap>, Delegate?)”

Creates a top-level context segment and configures nested routes. Compatibility overload for IReplMap callbacks.

public IContextBuilder Context(string segment, Action<IReplMap> configure, Delegate? validation = null)

IContextBuilder

Creates a DI-enabled REPL application.

public static ReplApp Create()

ReplApp - A new ReplApp instance.

Creates a DI-enabled REPL application and configures services.

public static ReplApp Create(Action<IServiceCollection> configureServices)
  • configureServices (Action<IServiceCollection>): Service registration callback.

ReplApp - A new ReplApp instance.

Builds a structured documentation model of the command graph.

public ReplDocumentationModel CreateDocumentationModel(string? targetPath = null)
  • targetPath (string): Optional target path to scope the model. When null, returns the full model. When specified and not found, returns an empty model.

ReplDocumentationModel - A structured documentation model.

Invalidates active routing cache so module presence predicates are re-evaluated on next resolution.

public void InvalidateRouting()

Maps a route and command handler.

public CommandBuilder Map(string route, Delegate handler)

CommandBuilder

Maps a module instance.

public ReplApp MapModule(IReplModule module)

ReplApp

Maps a module instance with an injectable runtime presence predicate.

public ReplApp MapModule(IReplModule module, Delegate isPresent)

ReplApp

MapModule(IReplModule, Func<ModulePresenceContext, bool>)

Section titled “MapModule(IReplModule, Func<ModulePresenceContext, bool>)”

Maps a module instance with a runtime presence predicate.

public ReplApp MapModule(IReplModule module, Func<ModulePresenceContext, bool> isPresent)
  • module (IReplModule)
  • isPresent (Func<ModulePresenceContext, bool>)

ReplApp

Maps a module resolved through runtime DI activation.

public ReplApp MapModule<TModule>() where TModule : class, IReplModule
  • TModule

ReplApp

Configures application options.

public ReplApp Options(Action<ReplOptions> configure)
  • configure (Action<ReplOptions>)

ReplApp

Runs using an externally managed host.

public int Run(string[] args, IHost host, ReplRunOptions? options = null)

int

Runs against an externally managed input/output host.

public int Run(string[] args, IReplHost host, ReplRunOptions? options = null)

int

Run(string[], IReplHost, IServiceProvider, ReplRunOptions?)

Section titled “Run(string[], IReplHost, IServiceProvider, ReplRunOptions?)”

Runs against an externally managed input/output host with an external service provider.

public int Run(string[] args, IReplHost host, IServiceProvider services, ReplRunOptions? options = null)

int

Runs using internally configured services.

public int Run(string[] args, ReplRunOptions? options = null)

int

Run(string[], IServiceProvider, ReplRunOptions?)

Section titled “Run(string[], IServiceProvider, ReplRunOptions?)”

Runs using an externally managed service provider.

public int Run(string[] args, IServiceProvider services, ReplRunOptions? options = null)

int

RunAsync(string[], IHost, ReplRunOptions?, CancellationToken)

Section titled “RunAsync(string[], IHost, ReplRunOptions?, CancellationToken)”

Runs using an externally managed host.

public ValueTask<int> RunAsync(string[] args, IHost host, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int>

RunAsync(string[], IReplHost, ReplRunOptions?, CancellationToken)

Section titled “RunAsync(string[], IReplHost, ReplRunOptions?, CancellationToken)”

Runs against an externally managed input/output host.

public ValueTask<int> RunAsync(string[] args, IReplHost host, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int>

RunAsync(string[], IReplHost, IServiceProvider, ReplRunOptions?, CancellationToken)

Section titled “RunAsync(string[], IReplHost, IServiceProvider, ReplRunOptions?, CancellationToken)”

Runs against an externally managed input/output host with an external service provider.

public ValueTask<int> RunAsync(string[] args, IReplHost host, IServiceProvider services, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int>

RunAsync(string[], ReplRunOptions?, CancellationToken)

Section titled “RunAsync(string[], ReplRunOptions?, CancellationToken)”

Runs using internally configured services.

public ValueTask<int> RunAsync(string[] args, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int>

RunAsync(string[], IServiceProvider, ReplRunOptions?, CancellationToken)

Section titled “RunAsync(string[], IServiceProvider, ReplRunOptions?, CancellationToken)”

Runs using an externally managed service provider.

public ValueTask<int> RunAsync(string[] args, IServiceProvider services, ReplRunOptions? options = null, CancellationToken cancellationToken = default)

ValueTask<int>

Runs using internally configured services.

public ValueTask<int> RunAsync(string[] args, CancellationToken cancellationToken)

ValueTask<int>

Use(Func<ReplExecutionContext, ReplNext, ValueTask>)

Section titled “Use(Func<ReplExecutionContext, ReplNext, ValueTask>)”

Registers middleware in the execution pipeline.

public ReplApp Use(Func<ReplExecutionContext, ReplNext, ValueTask> middleware)
  • middleware (Func<ReplExecutionContext, ReplNext, ValueTask>)

ReplApp

Registers a banner delegate rendered at startup after the header line.

public ReplApp WithBanner(Delegate bannerProvider)

ReplApp

Registers a static banner string rendered at startup after the header line.

public ReplApp WithBanner(string text)

ReplApp

Sets an application description for discovery and banner usage.

public ReplApp WithDescription(string text)

ReplApp

Returns the shared service provider, building it on first access. This provider is reused for both module resolution and runtime execution, ensuring DI-resolved modules share the same service instances as handlers.

public IServiceProvider Services { get; }

IServiceProvider