Repository navigation
refactor: split the root main.go into topical files (pure declaration moves) - #745
Merged
Merged
Conversation
Pure declaration moves, no behaviour change. New files: cli_support.go, task_cmd.go, generate_image_cmd.go, generate_video_cmd.go, generate_audio_cmd.go, delegate_cmd.go, fleet_serve_cmd.go, doctor_cmd.go, report_cmd.go, learn_cmd.go, confhead_cmd.go. main.go keeps the entry point and the functions that source-scanning tests read by file name. The census tool's before/after output is byte-identical (1002 declarations); the file paths named in docs/systems follow, and a changes/unreleased fragment is added. Co-Authored-By: Claude Fable 5.1 <[email protected]>
The main.go split moved about 21 of 22 core.Request literals out of main.go, so the door lint went blind. The source-scanning tests now read main.go plus the 11 split files (shared mainSplitFiles list, mainSplitSource and parseMainSplit helpers in main_door_test.go); what each asserts is unchanged. - TestEveryCLIRequestCarriesADoor: scans every core.Request literal in all 12 files (22 literals), reports file:line. - TestServeBuildsItsJobStoreThroughNewFleetJobs: text of the 12 files. - TestFleetServeStartsItsSamplerThroughTheChooser: text of the 12 files (call counts across the set). - TestFleetServePrintsTheAuthLineOnEveryStart: text of the 12 files. - TestRunMCPCapturesTheStartupImageBeforeOpeningAnything and the runFleetServe capture pin: funcBody reads the 12 files. - TestTheCLIVerbsPrepareEachSubtaskOnItsOwnAndSpliceTheRefusals, TestFleetServeStartsAndStopsTheDisplayWatch, TestRunFleetServeAppliesItsNodeIDBeforeOpeningThePipeline, TestRunFleetServePassesTheConfigItReadToTheStartupRefusal, TestFleetServeWiresTheLeaseStanding, TestTheResearchVerbChecksItsQuotesAgainstThePages: parse the 12 files as one declaration set. Left on main.go by name because the dispatch and usage text stayed there: TestRecipeAuditIsRegisteredInMain, TestTraceCorpusIsRegisteredInMain, TestVersionSourcesAgree. bare_http_client_allowlist_test.go keys no main.go site, so no counts moved. Co-Authored-By: Claude Fable 5.1 <[email protected]>
…kage The lint built its builders map per file, so cliPinOptions, which moved to a split file of main.go, no longer vouched for the two engine calls that stayed in main.go. Builders are now collected in a first pass over every file and keyed by package directory, then every call is checked. Co-Authored-By: Claude Fable 5.1 <[email protected]>
dmmdea
force-pushed
the
refactor/split-root-main
branch
from
October 30, 2026 02:24
00a220f to
2050728
Compare
The render test that checks the shipped template list reads the --template help sentence from the Go source; that flag moved from main.go to generate_video_cmd.go in the split. The test now reads that file; the other five places it checks are unchanged. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Merged
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.
Intent
Desloppify backlog ("god files"): the root main.go was 5359 lines. It is split into topical files of package main by pure declaration moves; identical behaviour.
Scope
The root package: main.go plus 11 new files (cli_support.go, task_cmd.go, generate_image_cmd.go, generate_video_cmd.go, generate_audio_cmd.go, delegate_cmd.go, fleet_serve_cmd.go, doctor_cmd.go, report_cmd.go, learn_cmd.go, confhead_cmd.go), eleven root tests that read main.go by name re-keyed to the split set, six docs/systems pointer updates, the fragment. No declaration renamed or edited.
What changed
main.go 5359 -> 1196 (keeps func main, usage/usageTo, hoistGlobalConfig, the subcommand dispatch, const version). Second commit: main_door_test.go holds the shared 12-file list (mainSplitFiles) and two helpers; TestEveryCLIRequestCarriesADoor now sees all 22 core.Request literals (before the split it saw only the 1 in main.go after the move, so the lint had gone blind); the fleet-serve, mcp-startup, display-watch, lease-standing, research-quotes and delegate-intake wiring tests parse the 12 files as one declaration set.
The real run and its output
Declaration census (go/ast hash of every top-level declaration, comments stripped) before and after: 1002 declarations, diff empty, run by the builder and again by an independent verifier in a throwaway worktree of origin/main. go build ./... ok; go vet . ok; gofmt clean on every new file; the changelog/version/pins/deletion lints ok; every re-keyed test PASS by name; TestRecipeAuditIsRegisteredInMain, TestTraceCorpusIsRegisteredInMain, TestVersionSourcesAgree, TestIngressGuardNoteIsPrintedWhereTheOperatorLooks and TestNoNewBareHTTPClient checked and PASS unchanged. CI runs the whole package.
Blast radius
None at runtime; file layout of the root package.
Risk
Low. Tier: no_review (ordinary change (consequential 0.3, blast 1.82))
Follow-ups (not in this PR)
🤖 Generated with Claude Code