Documentation
¶
Index ¶
- Constants
- Variables
- func FormatDependencyGraph(result *DependencyGraphResult) string
- func FormatMarkdownScanResult(files []MarkdownFile) string
- func GitHubSearchCode(ctx context.Context, github repository.GitHubClient, query string, ...) (string, error)
- func OutlineGoPackage(ctx context.Context, fw repository.FileWalker, directory string, ...) (string, error)
- func PrintGitHubTree(ctx context.Context, b *strings.Builder, client *infra.GitHubClient, ...) error
- func PrintTree(ctx context.Context, b *strings.Builder, walker repository.DirWalker, ...) error
- func ReadGoDocPaged(httpcli *infra.HttpClient, packageURL string, offset, limit int) (string, int, bool, error)
- func ReadPyDocPaged(httpcli *infra.HttpClient, moduleName string, offset, limit int) (string, int, bool, error)
- func ReadRustDocPaged(httpcli *infra.HttpClient, crateURL string, offset, limit int) (string, int, bool, error)
- func SearchGoDoc(httpcli *infra.HttpClient, query string) (string, error)
- func SearchLocalFiles(ctx context.Context, fw repository.FileWalker, path, extension, query string, ...) ([]model.SearchResult, error)
- func SearchPyDoc(httpcli *infra.HttpClient, query string) (string, error)
- func SearchRustDoc(httpcli *infra.HttpClient, query string) (string, error)
- type CallGraphEntry
- type CallGraphResult
- type Declaration
- type DeclarationExtractResult
- type DependencyGraphResult
- type FunctionCall
- type GoDocSearchResult
- type MarkdownFile
- type MarkdownHeading
- type OutlineGoPackageOptions
- type PackageDependency
- type PackageImport
- type PyDocSearchResult
- type RustDocSearchResult
- type ValidationReport
- type ValidationResult
Constants ¶
const DefaultLinesPerPage = 100
Variables ¶
var ErrNotFound = errors.New("not found")
Functions ¶
func FormatDependencyGraph ¶
func FormatDependencyGraph(result *DependencyGraphResult) string
FormatDependencyGraph formats the dependency graph results as a readable string
func FormatMarkdownScanResult ¶
func FormatMarkdownScanResult(files []MarkdownFile) string
FormatMarkdownScanResult formats the scan results as a readable string
func GitHubSearchCode ¶
func GitHubSearchCode( ctx context.Context, github repository.GitHubClient, query string, language, repo *string, ) (string, error)
func OutlineGoPackage ¶ added in v0.1.5
func OutlineGoPackage( ctx context.Context, fw repository.FileWalker, directory string, opts OutlineGoPackageOptions, ) (string, error)
OutlineGoPackage produces a comprehensive outline of a Go package: dependencies, exported declarations, and call graph. Individual sections can be disabled via opts to reduce output size.
func PrintGitHubTree ¶
func PrintGitHubTree( ctx context.Context, b *strings.Builder, client *infra.GitHubClient, owner, repo, path string, ignoreDot bool, maxDepth int, ) error
PrintGitHubTree prints a tree representation of a GitHub repository path using the same formatting as PrintTree does for local directories.
func ReadGoDocPaged ¶
func ReadGoDocPaged( httpcli *infra.HttpClient, packageURL string, offset, limit int, ) (string, int, bool, error)
ReadGoDocPaged reads Go documentation for a given package URL with line-based paging. packageURL must be in "golang.org/x/net/html" format. Returns: content, totalLines, hasMore, error
func ReadPyDocPaged ¶ added in v0.1.5
func ReadRustDocPaged ¶ added in v0.1.5
func ReadRustDocPaged( httpcli *infra.HttpClient, crateURL string, offset, limit int, ) (string, int, bool, error)
ReadRustDocPaged reads Rust documentation for a given crate URL with line-based paging. crateURL can be "serde", "serde/de", "tokio/runtime", etc.
func SearchGoDoc ¶
func SearchGoDoc(httpcli *infra.HttpClient, query string) (string, error)
func SearchLocalFiles ¶
func SearchLocalFiles( ctx context.Context, fw repository.FileWalker, path, extension, query string, maxMatches int, ) ([]model.SearchResult, error)
func SearchPyDoc ¶ added in v0.1.5
func SearchPyDoc(httpcli *infra.HttpClient, query string) (string, error)
func SearchRustDoc ¶ added in v0.1.5
func SearchRustDoc(httpcli *infra.HttpClient, query string) (string, error)
Types ¶
type CallGraphEntry ¶
type CallGraphEntry struct {
Function string // Function name that makes calls
Calls []FunctionCall // Functions that it calls
}
type CallGraphResult ¶
type CallGraphResult struct {
Filename string // Source file path
CallGraph []CallGraphEntry // Call relationships
}
func ExtractCallGraph ¶
func ExtractCallGraph(filePath string) (*CallGraphResult, error)
ExtractCallGraph extracts function call relationships from a single Go file.
type Declaration ¶
type DeclarationExtractResult ¶
type DeclarationExtractResult struct {
Filename string
Declarations []Declaration
}
func ExtractDeclarations ¶
func ExtractDeclarations( ctx context.Context, fw repository.FileWalker, path string, ) ([]DeclarationExtractResult, error)
ExtractDeclarations extracts all exported declarations from Go source files in the specified directory.
func ExtractFunctionNames ¶
func ExtractFunctionNames( ctx context.Context, fw repository.FileWalker, path string, ) ([]DeclarationExtractResult, error)
ExtractFunctionNames extracts function names from Go source files in the specified directory. This is kept for backward compatibility with existing MCP tools.
type DependencyGraphResult ¶
type DependencyGraphResult struct {
ProjectPath string // Root project path
ModuleName string // Module name from go.mod
Dependencies []PackageDependency // Package dependencies for each file
}
DependencyGraphResult represents the package dependency analysis for a directory
func ExtractPackageDependencies ¶
func ExtractPackageDependencies( ctx context.Context, fw repository.FileWalker, projectPath string, ) (*DependencyGraphResult, error)
ExtractPackageDependencies analyzes Go files in a directory and extracts package-level import dependencies
type FunctionCall ¶
type GoDocSearchResult ¶
type GoDocSearchResult struct {
PackageURL string
Matches []model.SearchMatch
Truncated bool
}
func SearchWithinGoDoc ¶
func SearchWithinGoDoc( httpcli *infra.HttpClient, packageURL string, keyword string, maxMatches int, ) (*GoDocSearchResult, error)
SearchWithinGoDoc searches for a keyword within Go documentation and returns all matches. Similar to SearchLocalFiles but for a single Go documentation page.
type MarkdownFile ¶
type MarkdownFile struct {
FileName string
Headings []MarkdownHeading
}
func ScanMarkdownFiles ¶
func ScanMarkdownFiles( ctx context.Context, fw repository.FileWalker, path string, ) ([]MarkdownFile, error)
ScanMarkdownFiles scans a directory or single file for markdown files and extracts headings with line numbers
type MarkdownHeading ¶
type OutlineGoPackageOptions ¶ added in v0.1.5
type OutlineGoPackageOptions struct {
SkipDependencies bool
SkipDeclarations bool
SkipCallGraph bool
}
OutlineGoPackageOptions controls which sections are included in the outline.
type PackageDependency ¶
type PackageDependency struct {
FilePath string // Absolute path to the Go file
PackageName string // Package name declared in the file
Imports []PackageImport // All imports in the file
}
PackageDependency represents a Go file's package and its imports
type PackageImport ¶
type PackageImport struct {
Path string // Import path (e.g., "fmt", "github.com/user/repo/pkg")
Alias string // Import alias if any (e.g., "f" in `import f "fmt"`)
Line int // Line number where import appears
IsStdlib bool // Whether this is a standard library import
IsLocal bool // Whether this is a local project import
}
PackageImport represents an import statement in a Go file
type PyDocSearchResult ¶ added in v0.1.5
type PyDocSearchResult struct {
ModuleName string
Matches []model.SearchMatch
Truncated bool
}
func SearchWithinPyDoc ¶ added in v0.1.5
func SearchWithinPyDoc( httpcli *infra.HttpClient, moduleName string, keyword string, maxMatches int, ) (*PyDocSearchResult, error)
type RustDocSearchResult ¶ added in v0.1.5
type RustDocSearchResult struct {
CrateURL string
Matches []model.SearchMatch
Truncated bool
}
func SearchWithinRustDoc ¶ added in v0.1.5
func SearchWithinRustDoc( httpcli *infra.HttpClient, crateURL string, keyword string, maxMatches int, ) (*RustDocSearchResult, error)
type ValidationReport ¶
type ValidationReport struct {
Directory string `json:"directory"`
Results []ValidationResult `json:"results"`
Summary string `json:"summary"`
}
ValidationReport represents the complete validation report
func ValidateGoCode ¶
func ValidateGoCode(ctx context.Context, directory string) (*ValidationReport, error)
ValidateGoCode runs multiple Go validation checks on the specified directory