A fast C# code structure analyzer that generates a hierarchical map of your codebase using Roslyn syntax analysis. Optimized for AI/LLM agents to understand codebases efficiently.
- 📊 Public API Surface Only - Filters to public/internal members only (Goldilocks zone for LLMs)
- 🔍 Multi-Project Support - Auto-detects and processes all
.csprojfiles - 📍 Line Numbers - Jump directly to code locations
- 🏷️ Rich Metadata - Namespaces, base types, interfaces, attributes, static indicators
- 📝 Smart Documentation - Extracts first sentence of XML docs (not verbose)
- 📁 Triple Output - Text, JSON, or YAML format
- ⚡ Fast & Efficient - Uses Roslyn for accurate syntax analysis
- 🏗️ AOT Ready - .NET 9.0 native AOT support
curl -fsSL https://raw.githubusercontent.com/DennisDyallo/CodeMapper/main/install.sh | bashOr with wget:
wget -qO- https://raw.githubusercontent.com/DennisDyallo/CodeMapper/main/install.sh | bashOptions:
- Use
| sudo bashto install to/usr/local/bin - Set
PREFIXto customize install location:PREFIX=$HOME/custom curl ... | bash - Set
VERSIONto install specific version:VERSION=v1.0.0 curl ... | bash
irm https://raw.githubusercontent.com/DennisDyallo/CodeMapper/main/install.ps1 | iexOptions:
- Set
$env:INSTALL_DIRto customize install location - Set
$env:VERSIONto install specific version:$env:VERSION="v1.0.0"; irm ... | iex
git clone https://github.com/DennisDyallo/CodeMapper
cd CodeMapper
dotnet build
# Run directly with dotnet
dotnet run -- "/path/to/your/repo"dotnet publish -c Release -o publishAfter installation, try it out:
codemapper /path/to/repocodemapper /path/to/repocodemapper <path> [options]
Options:
--format, -f <text|json|yaml> Output format (default: text)
--output <dir> Output directory (default: ./codebase_ast)
# Analyze repo, output as text
codemapper /path/to/repo
# Output as JSON (better for programmatic use)
codemapper /path/to/repo --format json
# Output as YAML
codemapper /path/to/repo -f yaml
# Custom output directory
codemapper /path/to/repo --output ./my-output# Summary: 12 files, 3 namespaces, 24 types, 156 methods
# MyProject/Services/UserService.cs
[Namespace] MyApp.Services
[Class] UserService : BaseService, IUserService [ApiController] :15
[Constructor] UserService(ILogger logger, IRepository repo) :17
[Property] string Name :22
[Method:static] User GetUser(int id) :25 // Gets a user by ID.
{
"summary": { "files": 12, "namespaces": 3, "types": 24, "methods": 156 },
"files": [
{
"filePath": "Services/UserService.cs",
"members": [
{
"type": "Class",
"signature": "UserService",
"lineNumber": 15,
"baseTypes": ["BaseService", "IUserService"],
"attributes": ["ApiController"],
"children": [...]
}
]
}
]
}summary:
files: 12
namespaces: 3
types: 24
methods: 156
files:
- path: "Services/UserService.cs"
members:
- type: Namespace
signature: "MyApp.Services"
members:
- type: Class
signature: "UserService"
line: 15
baseTypes:
- "BaseService"
- "IUserService"
attributes:
- "ApiController"
members:
- type: Constructor
signature: "UserService(ILogger logger, IRepository repo)"
line: 17
- type: Method
signature: "User GetUser(int id)"
line: 25
static: true
doc: "Gets a user by ID."| Type | Description |
|---|---|
| Namespaces | Regular and file-scoped namespaces |
| Classes | Public/internal classes with base types |
| Interfaces | Interface definitions with inheritance |
| Records | Record types with positional parameters |
| Enums | Enum declarations with member names |
| Constructors | Public constructors (reveals DI dependencies) |
| Methods | Signatures with return types and parameters |
| Properties | Property declarations with types |
| Attributes | Attributes on all public API elements |
| Static | Static indicator on classes/methods/properties |
| Documentation | First sentence of XML <summary> tags |
- .NET 9.0 SDK or runtime
dotnet testDefault output directory: ./codebase_ast/
Each project generates a file with its code structure (.txt, .json, or .yaml).
MIT