Skip to content

refactor(cli): split app.go into domain-focused files#472

Merged
dlorenc merged 1 commit into
mainfrom
work/bold-hawk
May 9, 2026
Merged

refactor(cli): split app.go into domain-focused files#472
dlorenc merged 1 commit into
mainfrom
work/bold-hawk

Conversation

@dlorenc

@dlorenc dlorenc commented May 9, 2026

Copy link
Copy Markdown
Owner

Summary

  • 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 domain files; app.go reduced from 3626 → 1870 lines
  • Also consolidated 7 near-identical HTTP helpers into a single doRequest(method, url, body, identity) method; each helper delegates to it

New files

File Contents Lines
review.go Reviews, Review, Comment, Comments, Checks, Check, branchHeadSequence, RetryChecks 383
git_import.go ImportGit, importGitReplay, importGitSquash 195
org.go Orgs*, OrgMembers*, OrgInvites*, Roles* 363
repo.go Repos*, RepoGet, BranchDelete, Purge 174
releases.go releaseEntry, listReleasesResponse, Release* 165
proposals.go Proposal* 121
webhooks.go Subscription* 113
issues.go Issue* 294

What 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 ./... passes
  • go test ./internal/cli/... -count=1 passes (2.656s)
  • No behavioral changes — pure file reorganization with no logic modifications

Opportunities noted (not implemented)

  • Secrets (SecretsList, SecretsSet, SecretsUnset) could also be extracted to secrets.go for full symmetry, but the task spec left them in app.go
  • branchHeadSequence is used by both review.go and app.go's Checks; currently duplicated call site in review.go only — no issue

🤖 Generated with Claude Code

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]>
@dlorenc dlorenc merged commit 6892fd3 into main May 9, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant