app

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 26 Imported by: 0

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 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 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)

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 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 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", "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