app

package
v0.1.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 26 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const DefaultLinesPerPage = 100

Variables

View Source
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 PrintTree

func PrintTree(
	ctx context.Context,
	b *strings.Builder,
	walker repository.DirWalker,
	path string,
	ignoreDot bool,
	maxDepth int,
) error

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 ReadPyDocPaged(
	httpcli *infra.HttpClient,
	moduleName string,
	offset, limit int,
) (string, int, bool, error)

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 Declaration struct {
	Name string
	Type string // "function", "type", "interface", "struct", "const", "var"
	Info string // Additional info like receiver type for methods, struct fields count, etc.
	Line int    // Line number in the file where the declaration starts
}

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 FunctionCall struct {
	Name    string // Function name (e.g., "fmt.Println", "myFunc")
	Package string // Package name if external call (e.g., "fmt")
}

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 MarkdownHeading struct {
	Title string
	Level int
	Line  int
}

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

type ValidationResult

type ValidationResult struct {
	Check   string `json:"check"`
	Status  string `json:"status"` // pass, fail, or error
	Output  string `json:"output,omitempty"`
	Summary string `json:"summary"`
}

ValidationResult represents the result of a single validation check

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL