Skip to content

Commit 1b3b242

Browse files
refactor(analysis): hoist coupling rows for annotations
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent 5930a5d commit 1b3b242

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

internal/analysis/coupling/service.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ func New(db *gorm.DB) *Service {
3030
return &Service{db: db}
3131
}
3232

33+
// pairRow holds one cross-community edge aggregation row.
34+
// @intent transport GROUP BY join results from Analyze into post-processing.
35+
type pairRow struct {
36+
FromCommID uint
37+
ToCommID uint
38+
EdgeCount int64
39+
}
40+
3341
// Analyze measures coupling strength between communities.
3442
// Used by MCP get_architecture_overview tool and architecture_map prompt.
3543
//
@@ -39,12 +47,6 @@ func New(db *gorm.DB) *Service {
3947
// @domainRule only cross-community edges are counted
4048
func (s *Service) Analyze(ctx context.Context) ([]CouplingPair, error) {
4149
ns := ctxns.FromContext(ctx)
42-
43-
type pairRow struct {
44-
FromCommID uint
45-
ToCommID uint
46-
EdgeCount int64
47-
}
4850
var rows []pairRow
4951
q := s.db.WithContext(ctx).
5052
Model(&model.Edge{}).

0 commit comments

Comments
 (0)