package main // AnalysisResult holds all extracted data from Go source analysis. type AnalysisResult struct { Modules []Module Dependencies []Dependency Imports []ImportInfo } // TotalFeatures returns the count of all features across all modules. func (r *AnalysisResult) TotalFeatures() int { count := 0 for _, m := range r.Modules { count += len(m.Features) } return count } // TotalTests returns the count of all tests across all modules. func (r *AnalysisResult) TotalTests() int { count := 0 for _, m := range r.Modules { count += len(m.Tests) } return count } // Module represents a logical grouping of Go source files. type Module struct { Name string Description string GoPackage string GoFile string // primary file or directory GoLineCount int Features []Feature Tests []TestFunc } // Feature represents a function or method extracted from Go source. type Feature struct { Name string Description string GoFile string GoClass string // receiver type, empty for package-level functions GoMethod string GoLineNumber int GoLineCount int } // TestFunc represents a test function extracted from Go source. type TestFunc struct { Name string Description string GoFile string GoClass string GoMethod string GoLineNumber int GoLineCount int // FeatureName links this test to a feature by naming convention FeatureName string // Calls holds raw function/method calls extracted from the test body AST Calls []CallInfo // LinkedFeatures holds indices into the parent module's Features slice LinkedFeatures []int // BestFeatureIdx is the primary feature match index (-1 = none) BestFeatureIdx int } // CallInfo represents a function or method call extracted from a test body. type CallInfo struct { FuncName string // direct call name: "newMemStore" RecvOrPkg string // selector receiver/pkg: "ms", "fmt", "t" MethodName string // selector method: "StoreMsg", "Fatalf" IsSelector bool // true for X.Y() form } // callKey returns a deduplication key for this call. func (c CallInfo) callKey() string { if c.IsSelector { return c.RecvOrPkg + "." + c.MethodName } return c.FuncName } // Dependency represents a call relationship between two items. type Dependency struct { SourceModule string SourceFeature string // empty for module-level deps TargetModule string TargetFeature string // empty for module-level deps DependencyKind string // "calls" } // ImportInfo represents a Go import path found in source files. type ImportInfo struct { ImportPath string IsStdlib bool UsedInFiles []string }