refactor: split oversized files for code clarity#63
Merged
Conversation
Extract the Bubble Tea event loop (Update, applyPromptArrowKey) into chat_update.go and the tool-registry construction (essential/optional tools, defaultRegistry) into chat_tools.go. chat.go now holds only model construction and lifecycle, dropping from 1501 to 582 LOC. Pure code movement; no behavior or public API changes.
…oject_conventions.go
…core_dimensions.go
…hms into algorithms_cgo_more.go
e34d623 to
e3e68b2
Compare
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
Code-clarity refactor of the
hawkagent: split every oversized source file (>1000 LOC) into smaller, single-responsibility files. Pure mechanical extraction — no behavior, API, or public-symbol changes. All splits keep the same package, so external/import surfaces are untouched.Files split (16 commits, one logical split each)
cmd/chat.go(1501) →chat_tools.go,chat_update.gocmd/markdown.go(1137) →markdown_renderer.gointernal/engine/review/review_bot.go(1282) →review_bot_rules.gointernal/multiagent/agents/persona.go(1236) →persona_builtins.gointernal/feature/fingerprint/project.go(1450) →project_detect.go,project_conventions.gointernal/intelligence/repomap/depgraph.go(1329) →depgraph_build.go,depgraph_analysis.gointernal/intelligence/repomap/summary.go(1047) →summary_helpers.gointernal/intelligence/repomap/health_score.go(1030) →health_score_dimensions.gointernal/engine/project/project_analyzer.go(1224) →project_metrics.go,project_patterns.go,project_report.gointernal/engine/scaffold/scaffold.go(1182) →scaffold_builtins.gointernal/engine/semantic_diff.go(1105) →semantic_diff_helpers.gointernal/engine/code/code_explainer.go(1036) →code_explainer_helpers.gointernal/tool/codegen.go(1180) →codegen_builtins.gointernal/feature/eval/tasks_go.go(1332) →tasks_go_more.gointernal/codegraph/codegraph_cgo.go(1487) →codegraph_cgo_query.go(cgo-tagged)internal/codegraph/algorithms_cgo.go(1050) →algorithms_cgo_more.go(cgo-tagged)After this pass, no non-test
hawksource file exceeds ~920 LOC. (Remaining >1000 LOC files are inexternal/ecosystem repos — separate Go modules, out of scope — and long table-driven*_test.gofiles.)Boundary check
Verified the
internal/boundary is hard: everyexternal/ecosystem repo is its own Go module and none importgithub.com/GrayCodeAI/hawk/internal/....Test plan
CGO_ENABLED=1 go build ./...— cleanCGO_ENABLED=1 go vet ./...— cleanCGO_ENABLED=1 go test ./...— 107 packages ok, 0 failuresgolangci-lint runon every touched package — 0 issuesMade with Cursor