A .NET CLI that uses the OpenAI Chat Completions API (gpt-4o) to generate unit tests and XML documentation comments for C# code in the current solution.
OAICLI scans the current .sln and .csproj files, gathers C# source files, and posts them to OpenAI along with a structured prompt and response schema. The model returns JSON containing a summary, file edits, and a commit message; the tool then displays the diff and (optionally) applies the changes.
| Command | Status | Purpose |
|---|---|---|
test (default) |
available | Generate MSTest unit tests for the current solution. |
document |
available | Add or improve XML doc comments on C# files. |
code-review |
stubbed | Source exists; the file-diff and atomic-write logic is currently commented out. |
- Built on
ktsu.Sdk.App(multi-targeted from netstandard2.0 through net10.0). - CLI uses Spectre.Console.Cli with
CommandLineParserfor option parsing, plus Spectre'sJsonandImageSharpextensions for rich console output. - Calls the OpenAI HTTP API directly (
POST https://api.openai.com/v1/chat/completions) — does not depend on any OpenAI SDK. - The expected response schema is generated via
NJsonSchema. - Hard-codes the
gpt-4omodel.
On first run the tool prompts for an OpenAI API key and stores it in the operating system's secret store via
ktsu.CredentialCache — Windows Credential Manager, macOS Keychain, or libsecret (Secret Service) on Linux.
Subsequent runs reuse the stored key.
A key saved by an earlier version, which kept it in plaintext in ktsu.AppDataStorage's JSON file (typically
%APPDATA%\ktsu\OAICLI on Windows), is migrated into the secret store on the next run and blanked in the old
file. Nothing needs to be re-entered.
If no secret store is available — most often a Linux host with no Secret Service provider installed and unlocked, which is common over SSH and in containers — the tool reports that and stops. It does not fall back to writing the key to a plain file.
git clone <repo>
cd OAICLI
dotnet build# Generate tests for the current solution (default)
OAICLI
# Generate XML doc comments for the current solution
OAICLI documentThe commands take no arguments or options. Each one sends the C# files it finds from the current
directory: test everything below the solution, document everything below the project. Extra
context files (--context), a file path, and accepting edits without a preview (--force) are not
supported yet; passing any of them is an error rather than being silently ignored.
MIT — see LICENSE.md.