feat: Optimized project structure for better readability and maintain#38
Merged
cfc4n merged 1 commit intogojue:masterfrom May 24, 2025
Merged
feat: Optimized project structure for better readability and maintain#38cfc4n merged 1 commit intogojue:masterfrom
cfc4n merged 1 commit intogojue:masterfrom
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR reorganizes the services into dedicated subpackages under pkg/services and centralizes common context keys, configuration, and test utilities into pkg/comm, updating imports and initializers accordingly.
- Moved
servicespackage contents intocommand,browser, andabstractsubpackages - Renamed and refactored
initandmergeJSONToStructfunctions intoInitResourcesandutils.MergeJSONToStruct - Introduced
pkg/commfor shared types, context keys, andInitTestEnv, removing directcontext/zerologsetup in each service
Reviewed Changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/services/command/command_exec.go | Updated package to command |
| pkg/services/command/command_config.go | Updated package to command |
| pkg/services/command/command.go | Refactored imports, changed Init/NewCommandServer signatures |
| pkg/services/browser/*.go | Updated packages to browser, refactored context usage |
| pkg/services/abstract/mlservice.go | Renamed init to InitResources, updated fields and imports |
| pkg/comm/comm.go & pkg/comm/errors.go | Centralized context keys, logger setup, and error definitions |
| Other modules (pkg/server, pkg/config, cli) | Updated imports to use new comm, config, abstract packages |
Comments suppressed due to low confidence (4)
pkg/services/browser/browser_debugger.go:17
- Update the package-level comment to reflect the new
browserpackage name instead ofservicesfor accurate documentation.
// Package services provides a set of services for the MoLing application.
pkg/services/command/command.go:17
- The top comment should reference the
commandpackage rather thanservicesnow that the package name has changed.
// Package services Description: This file contains the implementation of the CommandServer interface for macOS and Linux.
pkg/services/command/command.go:58
- [nitpick] Core command service functionality was refactored—adding unit tests for
NewCommandServer,InitResources, andLoadConfigwould help ensure correct behavior under the new structure.
cs := &CommandServer{
pkg/comm/errors.go:17
- Service registration functions (
RegisterServandServiceList) were removed, but the CLI and server initialization still referenceServiceList. Reintroduce or relocate a central registry so services can register and be discovered at startup.
package comm
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.
Project Structure Optimization
Overview
This PR optimizes the codebase structure for better readability and maintainability by reorganizing files into a more logical hierarchy.
Changes
Before
After
Benefits
The new structure provides a solid foundation for future development while making the codebase more intuitive to navigate and maintain.