CodeContext.CLI
1.1.0
dotnet tool install --global CodeContext.CLI --version 1.1.0
dotnet new tool-manifest
dotnet tool install --local CodeContext.CLI --version 1.1.0
#tool dotnet:?package=CodeContext.CLI&version=1.1.0
nuke :add-package CodeContext.CLI --version 1.1.0
CodeContext.NET
Ever spent hours explaining your codebase patterns to ChatGPT? Or wished GitHub Copilot understood your team's coding style? CodeContext.NET solves that.
What It Does
This tool scans your C# project and creates a context file that tells AI assistants how your code works. No more explaining your patterns over and over.
New: Now detects and maps all your API endpoints automatically.
codecontext --path ./MyProject
That's it. You get a context file ready to paste into any AI chat.
Real Example
Let's say you have this in your codebase:
private readonly IUserService _userService;
public async Task<Result<User>> GetUserAsync(int id)
{
// your implementation
}
CodeContext detects:
- You use underscore for private fields
- Your async methods end with "Async"
- You prefer Result<T> over exceptions
- All your API endpoints with routes and auth info
Next time you ask AI for help, it writes code YOUR way, not some generic tutorial style.
Quick Start
Install it:
dotnet tool install --global CodeContext.CLI
Run it:
codecontext
You'll get something like:
✓ Found 5 patterns
✓ Found 12 packages
✓ Context saved to: codebase-context.md
The Output
Here's what you actually get:
Private fields start with underscore (_)
Async methods end with 'Async' suffix
Use Result<T> pattern for error handling
Dependencies injected through constructor
API Endpoints:
- GET /api/users → GetAllUsers() [Authorize]
- POST /api/users → CreateUser(UserDto dto) [Admin]
- DELETE /api/users/{id} → DeleteUser(int id) [Authorize]
Just copy this into ChatGPT/Claude/Copilot before asking for code.
Options
Keep it simple:
codecontext # scan current folder
codecontext -p ../other-project # scan different folder
codecontext -f json # want JSON instead
codecontext -v # see what it's doing
Building From Source
Standard .NET stuff:
git clone https://github.com/Nonanti/CodeContext.NET
cd CodeContext.NET
dotnet build
Why I Built This
Got tired of ChatGPT writing Java-style C# code. Wanted it to match my style without a 10-paragraph prompt every time.
Requirements
- .NET 9.0+
- Windows/Mac/Linux
License
MIT - do whatever you want with it.
Built by @Nonanti
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.