Skip to content

yllibed/repl

Repl Toolkit

NuGet Downloads CI License: MIT Ask DeepWiki

A .NET framework for building composable command surfaces.

  • Define your commands once — run them as a CLI, explore them in an interactive REPL,
  • host them in session-based terminals, expose them as MCP servers for AI agents,
  • or drive them from automation scripts.

New here? The DeepWiki has full architecture docs, diagrams, and an AI assistant you can ask questions about the toolkit.

Quick start

dotnet add package Repl
using Repl;

var app = ReplApp.Create().UseDefaultInteractive();
app.Map("hello", () => "world");
return app.Run(args);

Example

using Repl;

var app = ReplApp.Create().UseDefaultInteractive();

app.Context("client", client =>
{
    client.Map("list", () => new { Clients = new[] { "ACME", "Globex" } });

    client.Context("{id:int}", scoped =>
    {
        scoped.Map("show", (int id) => new { Id = id, Name = "ACME" });
        scoped.Map("remove", (int id) => Results.Cancelled($"Remove {id} cancelled."));
    });
});

return app.Run(args);

CLI mode:

$ myapp client list --json
{
  "clients": ["ACME", "Globex"]
}

REPL mode (same command graph):

$ myapp
> client 42 show --json
{ "id": 42, "name": "ACME" }

> client
[client]> list
ACME
Globex

MCP mode (same command graph, exposed to AI agents):

using Repl.Mcp;

app.UseMcpServer();  // add one line
{ "command": "myapp", "args": ["mcp", "serve"] }

One command graph. CLI, REPL, remote sessions, and AI agents — all from the same code.

What's included

Feature Package Guides
Unified command graph — routing, constraints, binding Repl.Core
Interactive REPL — scopes, history, autocomplete Repl.Defaults
Parameters & options — typed binding, options groups, response files Repl.Core
Multiple output formats — JSON, XML, YAML, Markdown Repl.Core
MCP server — expose commands as AI agent tools Repl.Mcp
Typed results & interactions — prompts, progress, cancellation Repl.Core
Session hosting — WebSocket, Telnet, remote terminals Repl.WebSocket Repl.Telnet
Shell completion — Bash, PowerShell, Zsh, Fish, Nushell Repl.Core
Spectre.Console — rich prompts, tables, charts Repl.Spectre
Testing toolkit — in-memory multi-session harness Repl.Testing
Machine-readable contracts — help schemas, error contracts Repl.Protocol
Conditional modules — channel-aware, feature-gated commands Repl.Core

Repl is the meta-package that bundles Core + Defaults + Protocol — start here.

Learn by example

Progressive learning path — each sample builds on the previous:

  1. Core Basics — routing, constraints, help, output modes
  2. Scoped Contacts — dynamic scoping, .. navigation
  3. Modular Ops — composable modules, generic CRUD
  4. Interactive Ops — prompts, progress, timeouts, cancellation
  5. Hosting Remote — WebSocket / Telnet session hosting
  6. Testing — multi-session typed assertions
  7. Spectre — Spectre.Console renderables, visualizations, rich prompts
  8. MCP Server — expose commands as MCP tools for AI agents

More documentation

Architecture blueprint Best practices
Comparison & migration Publishing & deployment
Glossary Interactive docs & AI Q&A

Contributing

Contributions welcome — please discuss new features first to keep the toolkit aligned with its goals. See CONTRIBUTING.md, CODE_OF_CONDUCT.md, and SECURITY.md.

License

MIT — Copyright (c) 2026 Yllibed project / Carl de Billy

About

Repl Toolkit is a foundational building block for .NET applications that need a serious command surface.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors