{"id":50606904,"url":"https://github.com/gui-cs/cli","last_synced_at":"2026-06-06T00:02:27.511Z","repository":{"id":359885305,"uuid":"1247880871","full_name":"gui-cs/cli","owner":"gui-cs","description":"A `Terminal.Gui` library that lets applications expose Views as scriptable CLI commands with typed JSON output, POSIX exit codes, and AI-agent discoverability.","archived":false,"fork":false,"pushed_at":"2026-05-23T23:35:55.000Z","size":42,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-24T00:23:42.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gui-cs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":"AGENTS.md","dco":null,"cla":null}},"created_at":"2026-05-23T22:52:57.000Z","updated_at":"2026-05-23T23:10:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gui-cs/cli","commit_stats":null,"previous_names":["gui-cs/cli"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gui-cs/cli","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gui-cs%2Fcli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gui-cs%2Fcli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gui-cs%2Fcli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gui-cs%2Fcli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gui-cs","download_url":"https://codeload.github.com/gui-cs/cli/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gui-cs%2Fcli/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33964367,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-05T02:00:06.157Z","response_time":120,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-06T00:02:26.700Z","updated_at":"2026-06-06T00:02:27.506Z","avatar_url":"https://github.com/gui-cs.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Terminal.Gui.Cli\n\n[![NuGet](https://img.shields.io/nuget/vpre/Terminal.Gui.Cli)](https://www.nuget.org/packages/Terminal.Gui.Cli)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n\u003e A .NET library that turns [Terminal.Gui](https://github.com/gui-cs/Terminal.Gui) apps into scriptable CLI tools — with typed JSON output, POSIX exit codes, and built-in AI-agent discoverability.\n\n![Terminal.Gui.Cli in action](docs/images/hero.gif)\n\n## Why\n\nTerminal.Gui gives you rich TUI applications. **Terminal.Gui.Cli** lets those same apps participate in scripts, pipelines, and agentic workflows — no separate CLI layer needed.\n\nOne NuGet package. One `CliHost`. All your views become commands.\n\n## Features\n\n| Capability | How |\n|---|---|\n| **CLI parsing** | Positional command dispatch, typed options, `--initial` pre-fill |\n| **Structured output** | `--json` emits a versioned `JsonEnvelope` |\n| **Headless rendering** | `--cat` renders viewer content without a TUI |\n| **AI discoverability** | `--opencli` metadata + `agent-guide` embedded Markdown |\n| **Built-in help** | `--help` via pluggable `IHelpProvider` |\n| **Exit codes** | Deterministic POSIX codes from `CommandResult` |\n\n## Quickstart\n\n```sh\ndotnet add package Terminal.Gui.Cli\n```\n\n```csharp\nusing Terminal.Gui.Cli;\n\nCliHost host = new (options =\u003e\n{\n    options.ApplicationName = \"my-app\";\n    options.Version = \"1.0.0\";\n});\n\nhost.Registry.Register (new GreetCommand ());\n\nreturn await host.RunAsync (args);\n```\n\nThen run it:\n\n```sh\nmy-app greet --initial \"World\"          # interactive TUI\nmy-app greet --initial \"World\" --json   # → {\"schemaVersion\":1,\"status\":\"ok\",\"value\":\"Hello, World!\"}\nmy-app info --cat                       # headless viewer output\nmy-app --opencli                        # machine-readable command metadata\nmy-app agent-guide                      # embedded agent guidance (Markdown)\n```\n\n## Command model\n\n| Kind | Interface | Description |\n|------|-----------|-------------|\n| **Input** | `ICliCommand\u003cT\u003e` | Launches a Terminal.Gui UI, returns a typed result |\n| **Viewer** | `IViewerCommand` | Displays content; supports `--cat` for headless rendering |\n\nCommands register explicitly (no reflection scanning) and resolve by case-insensitive alias.\n\n## Global options\n\nEvery command inherits these from the host:\n\n| Option | Description |\n|--------|-------------|\n| `--help` / `-h` | Show help |\n| `--version` | Show version |\n| `--opencli` | Emit OpenCLI metadata JSON |\n| `--json` | Wrap output in JSON envelope |\n| `--initial \u003cvalue\u003e` | Pre-fill input value (non-interactive mode) |\n| `--timeout \u003cduration\u003e` | Cancel after duration (e.g., `30s`, `5m`) |\n| `--output \u003cpath\u003e` / `-o` | Write output to file |\n| `--cat` | Headless render (viewer commands only) |\n\n## Repository layout\n\n```\nsrc/          Terminal.Gui.Cli library\ntests/        Unit, integration, and smoke tests\nexamples/     Example console app (see hero GIF above)\nspecs/        Constitution and library specification\nscripts/      Tooling and recording scripts\ndocs/         Images and documentation assets\n```\n\n## Building from source\n\nRequires **.NET 10 SDK**. Solution: `Terminal.Gui.Cli.slnx`.\n\n```sh\ndotnet restore Terminal.Gui.Cli.slnx\ndotnet build   Terminal.Gui.Cli.slnx\n\n# Run all test tiers\ndotnet run --project tests/Terminal.Gui.Cli.Tests\ndotnet run --project tests/Terminal.Gui.Cli.IntegrationTests\ndotnet run --project tests/Terminal.Gui.Cli.SmokeTests\n\n# Try the example app\ndotnet run --project examples/Terminal.Gui.Cli.ExampleApp -- greet --initial \"World\" --json\n```\n\n## Status\n\n**Alpha** — `0.1.0-develop` pre-release. API surface is stabilizing; breaking changes possible.\n\n## Contributing\n\nSee [`specs/constitution.md`](specs/constitution.md) for architectural rules and PR requirements.\n\n## License\n\nMIT — see [`LICENSE`](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgui-cs%2Fcli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgui-cs%2Fcli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgui-cs%2Fcli/lists"}