OpenCli is a C#/.NET terminal assistant that lets you interact with the OpenAI API from the command line.
The goal of this project is to practice .NET fundamentals while building a useful developer-focused CLI tool. The app currently supports interactive chat mode, one-shot questions, and reading local files so their contents can be sent to the AI.
This project is meant to help me learn and practice:
- C# and .NET project structure
- Building command-line applications
- Separating CLI code from core logic
- Async/await and
Task<T> - Calling external APIs
- Managing environment variables safely
- Reading files from the command line
- Writing unit tests with xUnit
- Designing simple classes and interfaces
- Using dependency injection to avoid calling real APIs in tests
- Interactive terminal chat mode
- One-shot
askcommand - File reading command
read filefor sending local file contents to the AI - Conversation tracking with user and assistant messages
- OpenAI API integration
- Fake message client for testing without using API tokens
- Basic xUnit tests for core chat behavior
- Better file review prompts
- Compiler error explanation command
- Saved chat history
- Prompt profiles, such as C# tutor or code reviewer
- Full conversation context sent to the API
- Streaming responses
- Markdown output files
- Support for multiple input files
OpenCli/
OpenCli.Cli/
Program.cs
TerminalApp.cs
OpenCli.Core/
Message.cs
Conversation.cs
ChatSession.cs
IMessageClient.cs
MessageClient.cs
OpenCli.Tests/
ConversationTests.cs
ChatSessionTests.cs
MessageClientTests.cs