CodeExplorer.Core 0.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package CodeExplorer.Core --version 0.1.0
                    
NuGet\Install-Package CodeExplorer.Core -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CodeExplorer.Core" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeExplorer.Core" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="CodeExplorer.Core" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CodeExplorer.Core --version 0.1.0
                    
#r "nuget: CodeExplorer.Core, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package CodeExplorer.Core@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=CodeExplorer.Core&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=CodeExplorer.Core&version=0.1.0
                    
Install as a Cake Tool

CodeExplorer

Token-efficient .NET library and CLI for codebase exploration via tree-sitter AST parsing.

Index once. Query cheaply. Let your LLM focus on reasoning, not searching.

Originally inspired by the DotNetCodeMunch project.


What it does

Traditional AI agents exploring a codebase open entire files and flood their context window with irrelevant code. CodeExplorer indexes a codebase once using tree-sitter AST parsing, then lets you retrieve exactly the symbols you need — with O(1) byte-offset seeking, BM25 + fuzzy search, and full DI-friendliness.

No LLM required. This is a pure retrieval engine designed to be consumed by an LLM — not to contain one.

Task Brute-force CodeExplorer
Find a function ~40,000 tokens ~200 tokens
Understand module API ~15,000 tokens ~800 tokens
Explore repo structure ~200,000 tokens ~2,000 tokens

Artefacts

Artefact Description
CodeExplorer.Core NuGet library — all features, DI-friendly, no CLI dependency
cxp Self-contained CLI executable (Win/Linux/macOS, no .NET install required)

Quick Start

60-Second Quickstart

Install CLI (One-Line)

Windows (PowerShell):

Invoke-WebRequest -Uri https://github.com/<owner>/<repo>/releases/latest/download/cxp-win-x64.exe -OutFile cxp.exe; Move-Item cxp.exe "$env:LOCALAPPDATA\Microsoft\WindowsApps\cxp.exe" -Force

Linux:

curl -Lo cxp https://github.com/<owner>/<repo>/releases/latest/download/cxp-linux-x64 && chmod +x cxp && sudo mv cxp /usr/local/bin/

macOS:

curl -Lo cxp https://github.com/<owner>/<repo>/releases/latest/download/cxp-osx-arm64 && chmod +x cxp && sudo mv cxp /usr/local/bin/
First Commands
cxp index folder .
cxp search symbols --repo <folder-name> "Command"

Library

dotnet add package CodeExplorer.Core
services.AddCodeExplorer(options =>
{
    options.IndexPath        = "~/.code-index";
    options.MaxFileSizeBytes = 1_000_000;
});

var indexer   = sp.GetRequiredService<ICodeIndexer>();
var retriever = sp.GetRequiredService<ISymbolRetriever>();

await indexer.IndexRepoAsync("fastapi/fastapi");
var results = await retriever.SearchSymbolsAsync("fastapi/fastapi", "authenticate", kind: SymbolKind.Function);
var source  = await retriever.GetSymbolSourceAsync("fastapi/fastapi", results[0].Symbol.Id);

CLI

cxp index repo fastapi/fastapi
cxp index folder ./my-project

cxp search symbols --repo fastapi/fastapi "authenticate" --kind function
cxp search text    --repo fastapi/fastapi "TODO"

cxp get symbol  --repo fastapi/fastapi "fastapi/security/oauth2.py::OAuth2.authenticate#method"
cxp get context --repo fastapi/fastapi "auth flow" --budget 4000

cxp outline repo  fastapi/fastapi
cxp outline file  fastapi/fastapi --path fastapi/main.py

cxp analyze importance   fastapi/fastapi
cxp analyze dead-code    fastapi/fastapi
cxp analyze blast-radius fastapi/fastapi "fastapi/routing.py::APIRouter.add_api_route#method"

cxp list
cxp invalidate fastapi/fastapi

Architecture

CodeExplorer/
├── src/
│   ├── CodeExplorer.Core/
│   │   ├── Models/                  # Symbol, CodeIndex, SearchResult, ...
│   │   ├── Parsing/                 # tree-sitter AST + SymbolExtractor + LanguageRegistry
│   │   ├── Storage/                 # IIndexStore + JsonFileIndexStore
│   │   ├── Search/                  # BM25Engine + FuzzySearchEngine + HybridSearchEngine
│   │   ├── Summarizer/              # ISymbolSummarizer + SignatureFallbackSummarizer
│   │   ├── Retrieval/               # IRepositoryClient + OctokitRepositoryClient + LocalFolderClient
│   │   ├── Security/                # ISecurityFilter + DefaultSecurityFilter
│   │   ├── Analysis/                # PageRank + DeadCode + BlastRadius + GitDiff
│   │   ├── DependencyInjection/     # ServiceCollectionExtensions (AddCodeExplorer)
│   │   ├── CodeIndexer.cs           # ICodeIndexer orchestrator
│   │   ├── OutlineProvider.cs       # IOutlineProvider
│   │   └── Interfaces.cs            # All public interfaces
│   └── CodeExplorer.Cli/
│       ├── Commands/                # All Spectre.Console CLI commands
│       └── Program.cs
└── tests/
    ├── CodeExplorer.Core.Tests/     # xUnit + FluentAssertions + NSubstitute
    └── CodeExplorer.Benchmarks/     # BenchmarkDotNet

Swappable Components

Every meaningful dependency is behind an interface and registered as a singleton in DI:

Interface Default When to replace
ISymbolSummarizer SignatureFallbackSummarizer Custom summary extraction logic
IRepositoryClient OctokitRepositoryClient Custom GitHub auth, GitLab, Gitea, etc.
IIndexStore JsonFileIndexStore Store index in a database
ISecurityFilter DefaultSecurityFilter Custom file exclusion rules
ILanguageDetector DefaultLanguageDetector Add custom language extensions

Credits

This project was originally developed as DotNetCodeMunch and has been renamed to CodeExplorer (cxp). The core architecture — tree-sitter AST parsing, BM25/fuzzy search, byte-offset retrieval, and DI-based extensibility — originates from the CodeMunch concept.


Supported Languages

All grammars ship with TreeSitter.DotNet — no extra native libraries needed.

Programming Languages

Language Extensions Symbol types
Python .py function, class, method, constant
JavaScript .js, .jsx, .mjs, .cjs function, class, method, constant
TypeScript .ts, .tsx, .mts, .cts function, class, method, interface, type, enum, constant
Go .go function, method, type, constant
Rust .rs function, type, constant
Java .java class, method, field
PHP .php function, class, method, constant
C# .cs class, interface, enum, method, property, field, constant
C .c, .h function, type, constant
C++ .cpp, .hpp, .cc, .cxx, .hh function, class, method, type, field
Ruby .rb, .rake, .gemspec function, class, method, module, constant
Swift .swift function, class, method, type, enum, property
Scala .scala, .sc function, class, method, type
Haskell .hs function, type, class
Julia .jl function, type, module, constant
OCaml .ml, .mli function, type, module
Bash .sh, .bash function
Agda .agda function, type
CodeQL .ql, .qll function, class, module
SystemVerilog .sv, .v, .svh function, method, module

Markup, Data & Template Formats

Language Extensions Notes
HTML .html, .htm Language detection & AST parsing (no symbol extraction)
CSS .css Language detection & AST parsing (no symbol extraction)
JSON .json Language detection & AST parsing (no symbol extraction)
TOML .toml Language detection & AST parsing (no symbol extraction)
Razor .razor, .cshtml Language detection (symbols extracted from embedded C#)

Build & Test

# Build
dotnet build

# Run all unit tests
dotnet test tests/CodeExplorer.Core.Tests

# Run benchmarks (Release mode required)
dotnet run --project tests/CodeExplorer.Benchmarks -c Release

# Publish self-contained CLI
dotnet publish src/CodeExplorer.Cli -r linux-x64   -c Release --self-contained -p:PublishSingleFile=true
dotnet publish src/CodeExplorer.Cli -r win-x64     -c Release --self-contained -p:PublishSingleFile=true
dotnet publish src/CodeExplorer.Cli -r osx-arm64   -c Release --self-contained -p:PublishSingleFile=true

GitHub Actions & Release

This repository ships two workflows:

  • .github/workflows/ci.yml: build, test, and publish CLI artifacts on push/PR.
  • .github/workflows/release.yml: tag-based release pipeline that:
    • runs build + tests,
    • packs and publishes CodeExplorer.Core to NuGet,
    • builds cxp binaries for Linux, Windows, and macOS,
    • creates a GitHub Release and uploads all CLI binaries.

NuGet Deploy Setup

Add the following repository secret in GitHub:

  • NUGET_API_KEY: API key with push permission for CodeExplorer.Core.

Cut a Release

git tag v0.2.0
git push origin v0.2.0

The release workflow will publish to NuGet and attach release binaries automatically.


Environment Variables

Variable Purpose
GITHUB_TOKEN Raises GitHub API rate limits and enables private repos
CODE_INDEX_PATH Override default index path (~/.code-index)

License

MIT

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.3 0 3/31/2026
0.1.0 0 3/31/2026