Skip to content

Extract coauthors package from main mob.go#479

Merged
hollesse merged 3 commits intomainfrom
claude/plan-coauthors-package-ezqQn
Feb 16, 2026
Merged

Extract coauthors package from main mob.go#479
hollesse merged 3 commits intomainfrom
claude/plan-coauthors-package-ezqQn

Conversation

@hollesse
Copy link
Member

Summary

This PR extracts the coauthors functionality into a dedicated coauthors/ package, following the same pattern established by the earlier findnext/ package extraction. This is the second step in the planned package restructuring.

Key Changes

  • New Package: Created coauthors/ package with coauthors.go containing all coauthor-related logic
  • Exported Functions: Made three functions public for external use:
    • CollectCoauthorsFromWipCommits() - parses and processes coauthors from SQUASH_MSG
    • AppendCoauthorsToSquashMsg() - orchestrates reading and appending coauthors to commit message
    • CreateCommitMessage() - formats coauthors as commit message trailer
  • Dependency Injection: Added currentUserEmail parameter to CollectCoauthorsFromWipCommits() and AppendCoauthorsToSquashMsg() instead of calling gitUserEmail() internally, eliminating external dependencies
  • Tests Reorganized:
    • Moved unit tests (TestCreateCommitMessage, TestSortByLength, TestRemoveDuplicateValues) to coauthors/coauthors_test.go
    • Kept integration test TestStartDoneCoAuthors in root coauthors_test.go since it tests the full session workflow
  • Updated Caller: Modified mob.go to import and call the new package functions with the required email parameter

Implementation Details

  • All helper functions (parseCoauthors, stripToAuthor, sortByLength, removeElementsContaining, removeDuplicateValues) remain unexported within the package
  • The Author type alias is now exported from the package
  • No breaking changes to public APIs (all changes are internal to the mob tool)
  • Minimal risk: single call site in done() function, straightforward parameter passing

https://claude.ai/code/session_01L7s8YbrDAfSPJu47wmcM3w

Erweitert den bisherigen kurzen Ausblick (Sektion 6) zu einem
vollstaendigen Plan mit Analyse der Funktionen und Abhaengigkeiten,
konkreten Schritten (2.1-2.7), Signatur-Aenderungen, Teststrategie
und Risikobewertung - analog zum bestehenden findnext/-Plan.

https://claude.ai/code/session_01L7s8YbrDAfSPJu47wmcM3w
Move co-author tracking logic (AppendCoauthorsToSquashMsg,
CollectCoauthorsFromWipCommits, CreateCommitMessage and helper
functions) into a dedicated coauthors/ package. The gitUserEmail()
dependency is now injected as a parameter instead of called internally.

Unit tests moved to coauthors/coauthors_test.go, integration test
TestStartDoneCoAuthors remains in root package.

https://claude.ai/code/session_01L7s8YbrDAfSPJu47wmcM3w
Only AppendCoauthorsToSquashMsg needs to be exported since it's the
only function called from outside the package. collectCoauthorsFromWipCommits
and createCommitMessage are now unexported.

https://claude.ai/code/session_01L7s8YbrDAfSPJu47wmcM3w
@hollesse hollesse merged commit 679e434 into main Feb 16, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants