refactor(cli): split app.go into domain-focused files#472
Merged
Conversation
app.go was 3626 lines handling org management, repo management, branch operations, issues, proposals, releases, webhooks, git import, and the review/comment system all in one file. Split into 8 focused files: - review.go: Reviews, Review, Comment, Comments, Checks, Check, branchHeadSequence, RetryChecks (383 lines) - git_import.go: ImportGit, importGitReplay, importGitSquash (195 lines) - org.go: Orgs*, OrgMembers*, OrgInvites*, Roles* (363 lines) - repo.go: Repos*, RepoGet, BranchDelete, Purge (174 lines) - releases.go: Release* + local types (165 lines) - proposals.go: Proposal* (121 lines) - webhooks.go: Subscription* (113 lines) - issues.go: Issue* (294 lines) app.go reduced from 3626 → 1870 lines (core App struct, config/state loading, HTTP helpers, sync/tree operations, commit/merge/rebase/resolve). Also consolidated 7 near-identical HTTP helpers into a single doRequest method; each helper delegates to it rather than duplicating request construction logic. go build ./... and go test ./internal/cli/... -count=1 both pass. Co-Authored-By: Claude Sonnet 4.6 (1M context) <[email protected]>
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
app.gowas 3626 lines handling org management, repo management, branch operations, issues, proposals, releases, webhooks, git import, and the review/comment system all in one fileapp.goreduced from 3626 → 1870 linesdoRequest(method, url, body, identity)method; each helper delegates to itNew files
review.gogit_import.goorg.gorepo.goreleases.goproposals.gowebhooks.goissues.goWhat stays in app.go
Core App struct, Config/State types, config/state loading helpers, file scanning/hashing utilities, HTTP helpers (now backed by
doRequest), sync/tree operations, and the main commit/merge/rebase/resolve/pull/push flows. Secrets also remain in app.go.Test plan
go build ./...passesgo test ./internal/cli/... -count=1passes (2.656s)Opportunities noted (not implemented)
SecretsList,SecretsSet,SecretsUnset) could also be extracted tosecrets.gofor full symmetry, but the task spec left them in app.gobranchHeadSequenceis used by both review.go and app.go'sChecks; currently duplicated call site in review.go only — no issue🤖 Generated with Claude Code