Skip to content

TimeWarpEngineering/timewarp-nuru

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

TimeWarp.Nuru

NuGet Version NuGet Downloads Build Status License

Route-based CLI framework for .NET - bringing web-style routing to command-line applications

Nuru means "light" in Swahili - illuminating the path to your commands with clarity and simplicity.

Note

No Commercial License Required - TimeWarp.Nuru and TimeWarp.Mediator are both released under the Unlicense. Unlike MediatR (which now requires commercial licensing), our libraries are free for any use, commercial or otherwise.

πŸ“¦ Installation

dotnet add package TimeWarp.Nuru

πŸš€ Quick Start

using TimeWarp.Nuru;

NuruApp app = new NuruAppBuilder()
  .AddRoute
  (
    "add {x:double} {y:double}",
    (double x, double y) => Console.WriteLine($"{x} + {y} = {x + y}")
  )
  .Build();

return await app.RunAsync(args);
dotnet run -- add 15 25
# Output: 15 + 25 = 40

β†’ Full Getting Started Guide

✨ Key Features

Feature Description Learn More
🎯 Web-Style Routing Familiar "deploy {env} --version {tag}" syntax Routing Guide
⚑ Dual Approach Mix Direct (fast) + Mediator (structured) Architecture Choices
πŸ›‘οΈ Roslyn Analyzer Catch route errors at compile-time Analyzer Docs
⌨️ Shell Completion Tab completion for bash, zsh, PowerShell, fish Shell Completion
πŸ€– MCP Server AI-assisted development with Claude MCP Server Guide
πŸ“Š Logging Package Zero-overhead structured logging Logging Docs
πŸš€ Native AOT 3.3 MB binaries, instant startup Deployment Guide
πŸ”’ Type-Safe Parameters Automatic type conversion and validation Supported Types
πŸ“– Auto-Help Generate help from route patterns Auto-Help Feature

πŸ“š Documentation

Getting Started

Core Features

Tools & Deployment

Reference

🎯 Two Powerful Use Cases

πŸ†• Greenfield CLI Applications

Build modern command-line tools from scratch:

NuruApp app = new NuruAppBuilder()
  .AddRoute
  (
    "deploy {env} --version {tag?}",
    (string env, string? tag) => Deploy(env, tag)
  )
  .AddRoute
  (
    "backup {source} {dest?} --compress",
    (string source, string? dest, bool compress) => Backup(source, dest, compress)
  )
  .Build();

πŸ”„ Progressive Enhancement

Wrap existing CLIs to add auth, logging, or validation:

NuruApp app = new NuruAppBuilder()
  .AddRoute
  (
    "deploy prod",
    async () =>
    {
      if (!await ValidateAccess()) return 1;
      return await Shell.ExecuteAsync("existing-cli", "deploy", "prod");
    }
  )
  .AddRoute
  (
    "{*args}",
    async (string[] args) => await Shell.ExecuteAsync("existing-cli", args)
  )
  .Build();

β†’ Detailed Use Cases with Examples

🌟 Working Examples

Calculator Samples - Three complete implementations you can run now:

./Samples/Calculator/calc-mixed.cs add 10 20        # Direct: fast
./Samples/Calculator/calc-mixed.cs factorial 5      # Mediator: structured

Cocona Comparison - Migration guides from Cocona

⚑ Performance

Implementation Memory Speed (37 tests) Binary Size
Direct (JIT) ~4 KB 2.49s N/A
Direct (AOT) ~4 KB 0.30s πŸš€ 3.3 MB
Mediator (AOT) Moderate 0.42s πŸš€ 4.8 MB

Native AOT is 88-93% faster than JIT β†’ Full Performance Benchmarks

πŸ€– AI-Powered Development

Install the MCP server for AI assistance:

dotnet tool install --global TimeWarp.Nuru.Mcp

Get instant help in Claude Code, Roo Code, or Continue:

  • Validate route patterns before writing code
  • Generate handler code automatically
  • Get syntax examples on demand
  • Real-time error guidance

β†’ MCP Server Setup Guide

⌨️ Shell Completion

Enable tab completion for your CLI with one line of code:

NuruApp app = new NuruAppBuilder()
  .AddRoute("deploy {env} --version {tag}", (string env, string tag) => Deploy(env, tag))
  .AddRoute("status", () => ShowStatus())
  .EnableStaticCompletion()  // ← Add this
  .Build();

Generate completion scripts for your shell:

# Bash
./myapp --generate-completion bash >> ~/.bashrc

# Zsh
./myapp --generate-completion zsh >> ~/.zshrc

# PowerShell
./myapp --generate-completion powershell >> $PROFILE

# Fish
./myapp --generate-completion fish > ~/.config/fish/completions/myapp.fish

Supports:

  • βœ… Command completion (deploy, status)
  • βœ… Option completion (--version, --force)
  • βœ… Short option aliases (-v, -f)
  • βœ… All 4 major shells (bash, zsh, PowerShell, fish)

See ShellCompletionExample for a complete working example.

🀝 Contributing

We welcome contributions! See CONTRIBUTING.md for details.

For Contributors:

πŸ“„ License

This project is licensed under the Unlicense - see the LICENSE file for details.


Ready to build powerful CLI applications?

Get Started in 5 Minutes β€’ View Examples β€’ Read the Docs

About

Route-based CLI framework for .NET - Nuru means 'light' in Swahili

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •