Documentation
¶
Overview ¶
Package csharp provides a documentation source adapter that reads C# source code from a local clone of a .NET/ASP.NET/EF Core GitHub repository. It parses raw .cs source via tree-sitter to extract classes, interfaces, structs, records, enums, delegates, methods, properties, and XML doc comments without making any network calls during parsing.
Index ¶
- func NewABPFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewASPNetCoreFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAutoMapperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAvaloniaFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewBlazorFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewCarterFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDapperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDotNetBCLFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewEFCoreFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewFluentValidationFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewMAUIFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewMassTransitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewMediatRFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNUnitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNewtonsoftJsonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewOrleansFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPollyFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSerilogFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewServiceStackFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewWolverineFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewXUnitFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- type CSharpSource
- func (s *CSharpSource) DetectWrapper(method *source.Method) (bool, string, string)
- func (s *CSharpSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
- func (s *CSharpSource) ID() string
- func (s *CSharpSource) Meta() source.LibraryMeta
- func (s *CSharpSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
- func (s *CSharpSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
- func (s *CSharpSource) ParseSourceCode(entityID string, content []byte) (string, error)
- func (s *CSharpSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
- type Config
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewABPFactory ¶
NewABPFactory creates a Source for the ABP Framework.
func NewASPNetCoreFactory ¶
NewASPNetCoreFactory creates a Source for ASP.NET Core.
func NewAutoMapperFactory ¶
NewAutoMapperFactory creates a Source for AutoMapper.
func NewAvaloniaFactory ¶
NewAvaloniaFactory creates a Source for Avalonia UI.
func NewBlazorFactory ¶
NewBlazorFactory creates a Source for Blazor.
func NewCarterFactory ¶
NewCarterFactory creates a Source for Carter.
func NewDapperFactory ¶
NewDapperFactory creates a Source for Dapper.
func NewDotNetBCLFactory ¶
NewDotNetBCLFactory creates a Source for the .NET Base Class Library.
func NewEFCoreFactory ¶
NewEFCoreFactory creates a Source for Entity Framework Core.
func NewFluentValidationFactory ¶
func NewFluentValidationFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
NewFluentValidationFactory creates a Source for FluentValidation.
func NewMAUIFactory ¶
NewMAUIFactory creates a Source for .NET MAUI.
func NewMassTransitFactory ¶
NewMassTransitFactory creates a Source for MassTransit.
func NewMediatRFactory ¶
NewMediatRFactory creates a Source for MediatR.
func NewNUnitFactory ¶
NewNUnitFactory creates a Source for NUnit.
func NewNewtonsoftJsonFactory ¶
NewNewtonsoftJsonFactory creates a Source for Newtonsoft.Json.
func NewOrleansFactory ¶
NewOrleansFactory creates a Source for Orleans.
func NewPollyFactory ¶
NewPollyFactory creates a Source for Polly.
func NewSerilogFactory ¶
NewSerilogFactory creates a Source for Serilog.
func NewServiceStackFactory ¶
NewServiceStackFactory creates a Source for ServiceStack.
func NewWolverineFactory ¶
NewWolverineFactory creates a Source for Wolverine.
func NewXUnitFactory ¶
NewXUnitFactory creates a Source for xUnit.net.
Types ¶
type CSharpSource ¶
type CSharpSource struct {
// contains filtered or unexported fields
}
CSharpSource is a documentation source adapter that reads C# source code from a local repository clone. It parses raw .cs source using tree-sitter to extract all public type declarations and their members.
func New ¶
func New(repoPath string, cfg Config, opts ...Option) *CSharpSource
New constructs a new CSharpSource pointing at a local clone of a C# repo.
func (*CSharpSource) DetectWrapper ¶
DetectWrapper analyzes a method's source code for delegation patterns.
func (*CSharpSource) DiscoverEntities ¶
func (s *CSharpSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
DiscoverEntities walks the local repository and returns identifiers for all public type declarations. The fetch parameter is unused for local sources.
func (*CSharpSource) ID ¶
func (s *CSharpSource) ID() string
ID returns the canonical library ID (e.g., "csharp/aspnetcore").
func (*CSharpSource) Meta ¶
func (s *CSharpSource) Meta() source.LibraryMeta
Meta returns metadata for the library record.
func (*CSharpSource) ParseEntity ¶
func (s *CSharpSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
ParseEntity parses a single entity from file content, identified by entityID. The entityID has the form "filepath#Namespace.TypeName".
func (*CSharpSource) ParseMethod ¶
func (s *CSharpSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
ParseMethod parses a single method from file content. The methodID has the form "filepath#Namespace.TypeName.MethodName".
func (*CSharpSource) ParseSourceCode ¶
func (s *CSharpSource) ParseSourceCode(entityID string, content []byte) (string, error)
ParseSourceCode extracts just the source code of a specific entity or method.
func (*CSharpSource) ResolveWrapperURL ¶
func (s *CSharpSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
ResolveWrapperURL constructs the identifier to fetch a wrapped target's source.
type Config ¶
type Config struct {
// LibraryID is the canonical library ID (e.g., "csharp/aspnetcore").
LibraryID string
// Name is the human-readable library name.
Name string
// Description is a brief description of the library.
Description string
// SourceURL is the canonical GitHub URL of the repository.
SourceURL string
// SourceDirs lists relative directories within the repo to scan.
// If empty, the entire repo is scanned (excluding test/obj/bin dirs).
SourceDirs []string
}
Config holds settings for a C# source adapter. It is configurable for any C# library (.NET runtime, ASP.NET Core, EF Core, etc.).