Merged
Conversation
Analyze current code structure and propose a step-by-step plan to extract well-defined packages from the monolithic main package. First step: extract findnext/ package (pure algorithm, zero dependencies). https://claude.ai/code/session_01Hpdc7emSdo5SfustrYFjjr
Detail where shared functions (startCommand, runCommand, git wrappers, injectCommandWithMessage, etc.) will live. Introduce git.Context struct concept to encapsulate global state (workingDir, GitPassthroughStderrStdout). https://claude.ai/code/session_01Hpdc7emSdo5SfustrYFjjr
Move FindNextTypist algorithm and its helpers into a dedicated package. This is a pure algorithm with zero external dependencies, making it the ideal first extraction in the package restructuring. - findNextTypist() -> findnext.FindNextTypist() (exported) - Helper functions (reverse, lookahead, contains, min, prepend) stay unexported - Tests moved to findnext/findnext_test.go using test.Equals https://claude.ai/code/session_01Hpdc7emSdo5SfustrYFjjr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR extracts the "find next typist" algorithm into its own dedicated package as the first step of a larger refactoring to improve code organization and separation of concerns in mob.sh.
Changes Made
New package
findnext/: Created a new package containing the algorithm for determining who should type next based on commit historyfindnext/findnext.go: ContainsFindNextTypist()function (exported) and helper functions (unexported)findnext/findnext_test.go: Moved all 12 existing tests with updated importsUpdated
mob.go:findnextpackagefindnext.FindNextTypist()instead of the localfindNextTypist()functionRemoved from main package:
find_next.go(moved tofindnext/findnext.go)find_next_test.go(moved tofindnext/findnext_test.go)Added documentation: Comprehensive refactoring plan in
plan/packagestruktur.mdoutlining the vision for the entire codebase restructuring, including dependency hierarchy and future extraction stepsImplementation Details
findNextTypist()toFindNextTypist()to follow Go naming conventions for exported functionsreverse,lookahead,contains,min,prepend) remain unexported within the packagecoauthor/,git/,branch/, etc.)https://claude.ai/code/session_01Hpdc7emSdo5SfustrYFjjr