Refactor: Split large files into one-file-per-declaration structure (#16)#17
Merged
Refactor: Split large files into one-file-per-declaration structure (#16)#17
Conversation
- Created Sources/PostServer/Models/ directory - Split 11 model types into separate files: - ServerInfo, MessageHeader, MessageDetail - AttachmentInfo, AttachmentData - MailboxInfo, RawMessage, DraftResult - NamespaceEntry, NamespaceInfo, SearchCount - Deleted original Models.swift - Zero new warnings, all tests pass Issue: #16
- Created Sources/post/Commands/ directory - Extracted 22 command structs into separate files: - List, Fetch, Search, Draft, Flag, Junk, Trash, Archive - Move, Copy, Servers, Folders, Create, Status, Quota - Attachment, PDF, Idle, EML, Expunge - Credential (+ nested Set/Delete/List) - APIKey (+ nested Create/List/Delete) - Reduced PostCLI.swift from 2,225 to 743 lines (-1,504 lines) - Kept all shared utilities in main file - Zero new warnings, all tests pass Issue: #16
…Phase 3 partial) - Created PostServer+IDLE.swift extension (~820 lines) - Extracted all IDLE watch, hook, and message payload logic - Removed ~800 lines from main PostServer.swift - Changed private → internal for cross-file extension access: - connectionManager, logger, idleWatchTasks - withServer, formatDate, logDiagnostic - Helper structs: HookPayload, HookMessagePayload, HookAttachmentPayload - Zero new warnings, all tests pass Issue: #16
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
Systematic refactoring to improve code navigation and maintainability by splitting large monolithic files into focused, single-responsibility files.
Changes
Phase 1: Models (commit 8e24a34)
Models.swiftinto 11 individual files inSources/PostServer/Models/Phase 2: Commands (commit d926a7c)
PostCLI.swiftintoSources/post/Commands/Phase 3: IDLE Extension (commit 2cc088d)
PostServer+IDLE.swiftprivate→internalfor cross-file extension accessHelper Access (commit 73af797)
internalfor future extension useImpact
Before/After
PostCLI.swift:
PostServer.swift:
Testing
Issue
Closes #16