refactor: split 6 large files into focused sub-modules (wave 2)#385
Open
refactor: split 6 large files into focused sub-modules (wave 2)#385
Conversation
- rules-command-operations.ts: 727→58 (barrel; types, CRUD, config, migration ops) - ai.ts: 763→18 (barrel; completion, model-cache, provider command groups) - config.ts: 677→30 (barrel; helpers, list/show, get/set, validate/doctor) - deps-rendering.ts: 637→14 (barrel; ASCII rendering vs Graphviz rendering) - formatting-utilities.ts: 636→23 (barrel; config formatting split by concern) - taskCommands.ts: 694→31 (barrel; query vs mutation command groups) All exports preserved via re-export barrels. No behavioral changes. https://claude.ai/code/session_01MbaCeaVY3c1KPcofP4Cvd8
Review fixes:
- Replace 8x hand-rolled error extraction with getErrorMessage()
- Rename 9x unused context params to _context
- Move configCommandParams to config/shared.ts (break cross-module coupling)
- Remove dead resolveRepoPath double-call and taskId alias in query-commands
- Remove voided dead params in deps-rendering-ascii
- Use TASK_STATUS constants in deps-rendering-graphviz
- Convert dynamic import("fs/promises") to static import
- Remove redundant destExists=false catch assignment
Flaky test fix:
- Add afterEach cleanup to rules.test.ts mock filesystem
- Use unique test directory paths to prevent cross-test interference
https://claude.ai/code/session_01MbaCeaVY3c1KPcofP4Cvd8
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
Continuation of the large file audit. Splits 6 files in the 636-763 line range into focused sub-modules, all under 400 lines.
adapters/shared/commands/ai.tsdomain/rules/rules-command-operations.tsdomain/tasks/taskCommands.tsadapters/shared/commands/config.tsadapters/shared/commands/tasks/deps-rendering.tsadapters/cli/utilities/formatting-utilities.tsAll original files become thin barrel re-exports. 20 new focused sub-modules created. No behavioral changes.
Files deliberately NOT split (and why):
session-workspace.ts(796) — MCP tools actively evolvingtest-context.ts(759) — runtime AI context component, inherently verbosesession-parameters.ts(724) — pure param definitions, low complexity/lineremote.ts(711),github.ts(659) — already refactored, monolithic class structuremigrate-backend-command.ts(708) — single cohesive migration flowResult: 65 → 59 files over 400 lines.
Test plan
bun run typecheck— 0 errorsbun test— 1515 pass, 0 failbun run lint— 0 errors, 146 warnings (under 167 threshold)https://claude.ai/code/session_01MbaCeaVY3c1KPcofP4Cvd8