Skip to content

add change-coupling report (--coupling / --coupling-for) - #733

Merged
boyter merged 12 commits into
masterfrom
coupling
Jul 20, 2026
Merged

add change-coupling report (--coupling / --coupling-for)#733
boyter merged 12 commits into
masterfrom
coupling

Conversation

@boyter

@boyter boyter commented Jul 19, 2026

Copy link
Copy Markdown
Owner

Adds a change-coupling report derived from git history which files tend to change together in the same commits.

@pr-insights pr-insights Bot added VH/complexity Very high complexity XL/size Extra large change labels Jul 19, 2026
@boyter
boyter requested a review from Copilot July 19, 2026 22:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new git-history “change coupling” report to show which files tend to change together (repo-wide pair overview via --coupling, and per-file “blast radius” via --coupling-for), with MCP and CLI flag wiring. The PR also adjusts several existing history report renderers to better fit the 79/109-column tabular layouts and refine what gets shown.

Changes:

  • Add change-coupling analysis + renderers (tabular/csv/json) and a dedicated test suite.
  • Wire --coupling / --coupling-for into CLI processing and expose a new MCP coupling tool.
  • Tweak history report tabular outputs (hotspots, authors, author timeline, languages timeline) for wide layouts and/or row selection.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
processor/processor.go Adds coupling globals + dispatch, enforces report exclusivity, hooks coupling into history-flag validation flow.
processor/history_languages.go Changes languages timeline tabular rendering to show all rows (removes prior top-N cap).
processor/history_hotspots.go Adjusts wide hotspots formatting widths and changes tabular filtering to skip zero-score rows.
processor/history_coupling.go New coupling report implementation: co-change counting, rename folding, target resolution, and renderers.
processor/history_coupling_test.go New tests covering target-path normalization, counting, rename folding, and partner ranking behavior.
processor/history_authors.go Adjusts wide author table formatting to better fill the wide-column rule and show longer names.
processor/history_author_timeline.go Improves tabular author timeline: wide name column and “others (N)” aggregation beyond top-N.
mcp.go Adds MCP coupling tool and handler (blast-radius JSON) with depth/limit controls.
config.go Registers --coupling and --coupling-for flags.
Comments suppressed due to low confidence (1)

processor/processor.go:929

  • validateHistoryFlags currently returns early unless one of Hotspots, ByAuthor, or Timeline is set (see processor/history_validation.go:17). With --coupling enabled, this call won’t validate --depth or emit the standard warnings (extra positional paths, ignored flags), even though coupling is also a history report. The validation gate should include Coupling (and likely CouplingFor) so coupling runs get the same safety checks/warnings.
	if Hotspots || Coupling || ByAuthor || Timeline {
		if err := validateHistoryFlags(os.Stderr); err != nil {
			fmt.Println(err)
			os.Exit(1)
		}

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread processor/processor.go Outdated
Comment thread processor/history_coupling.go Outdated
Comment thread mcp.go Outdated
Comment thread mcp.go Outdated
boyter and others added 6 commits July 20, 2026 08:40
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Re-indent the mcp.WithNumber("limit") description line that was left
under-indented, restoring gofmt compliance.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@boyter

boyter commented Jul 20, 2026

Copy link
Copy Markdown
Owner Author

@copilot resolve the merge conflicts in this pull request

Copilot AI commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

@copilot resolve the merge conflicts in this pull request

Addressed in b53a09f.

@boyter
boyter merged commit 079f7b3 into master Jul 20, 2026
4 checks passed
@boyter
boyter deleted the coupling branch July 20, 2026 05:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

VH/complexity Very high complexity XL/size Extra large change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants