Skip to content

yllibed/repl

Repl Toolkit

NuGet Downloads CI License: MIT Ask DeepWiki Docs

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 and MCP Apps for AI agents,
  • or drive them from automation scripts.

New here? Start at repl.yllibed.org — installation, your first app, guides, cookbook, and API reference.

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"] }

MCP Apps (same server, host-rendered UI for capable clients):

app.Map("contacts dashboard", (IContactStore contacts) => BuildHtml(contacts))
    .WithDescription("Open the contacts dashboard")
    .AsMcpAppResource();

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

What's included

Feature Package Docs
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 + MCP Apps — expose commands as agent tools, resources, prompts, and UI 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. Each sample has a companion cookbook page with explanations and patterns.

Sample Cookbook
Core Basics — routing, constraints, help, output modes repl.yllibed.org/cookbook/core-basics/
Scoped Contacts — dynamic scoping, .. navigation repl.yllibed.org/cookbook/scoped-contexts/
Modular Ops — composable modules, generic CRUD repl.yllibed.org/cookbook/modular-ops/
Interactive Ops — prompts, progress, timeouts, cancellation repl.yllibed.org/cookbook/interactive-prompts/
Hosting Remote — WebSocket / Telnet session hosting repl.yllibed.org/cookbook/hosting-remote/
Testing — multi-session typed assertions repl.yllibed.org/cookbook/testing/
Spectre — Spectre.Console renderables, visualizations, rich prompts repl.yllibed.org/cookbook/spectre/
MCP Server — MCP tools, resources, prompts, and MCP Apps UI repl.yllibed.org/cookbook/mcp-server/

More documentation

Architecture Best Practices & FAQ
Coming from CLI frameworks Packaging & Distribution
Packages overview API Reference
Glossary Dependency Injection

AI-assisted development

If you use an AI coding agent (Claude Code, Cursor, Windsurf, Copilot, Codex, OpenCode, etc.) to build your Repl Toolkit app, install Context7 to give it access to Repl Toolkit documentation and code snippets.

Library ID: /yllibed/repl

Most agents that support MCP can use Context7 directly. Refer to your agent's documentation for MCP server configuration.

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