Refactor: Reorganize code into modular command and utility structure#33
Open
Refactor: Reorganize code into modular command and utility structure#33
Conversation
Split the flat src/ structure into organized directories: - commands/ — individual command handlers (download, checkDiff, apply, common) - services/ — vault interaction layer (VaultService, VaultNormalizer) - utils/ — generic utilities (diff, process, file) Removed monolithic Helpers.ts and Logic.ts in favor of focused, single-responsibility modules. Updated test imports accordingly. https://claude.ai/code/session_01KWCApFXhxZ6HqyYy9zoDUE
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
This PR refactors the codebase to improve modularity and maintainability by breaking down monolithic classes into focused, single-responsibility modules organized by feature and concern.
Key Changes
Structural Reorganization
Logic.tsandHelpers.tswhich contained mixed concernssrc/commands/download.ts- Secret download functionalitysrc/commands/checkDiff.ts- Diff checking functionalitysrc/commands/apply.ts- Change application functionalitysrc/commands/common.ts- Shared command utilitiesUtility Extraction
src/utils/diff.ts- Deep diff mapping logic (moved fromHelpers.ts)src/utils/file.ts- JSON file I/O operations (moved fromHelpers.ts)src/utils/process.ts- Child process execution utilities (moved fromHelpers.ts)Service Refactoring
VaultUtilitytoVaultServicefor clarity and consistencyVaultService.tsto use new utility functions instead ofHelpersclass methodsEntry Point Updates
src/App.tsto import command functions directly instead of usingLogicclass methods.bind(this)calls as functions are now standalone exports rather than class methodsBenefits
https://claude.ai/code/session_01KWCApFXhxZ6HqyYy9zoDUE