8000 feat: Optimized project structure for better readability and maintain by HildaM · Pull Request #38 · gojue/moling · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

feat: Optimized project structure for better readability and maintain #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 24, 2025

Conversation

HildaM
Copy link
Contributor
@HildaM HildaM commented May 24, 2025

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

  • Flat structure with mixed components
  • Unclear boundaries between different parts of the system
  • Difficult navigation between related files

After

  • pkg/ - Core functionality
    • comm/ - Common entities
    • config/ - Configuration management
    • server/ - Server implementation
    • services/ - Service implementations
    • utils/ - Utility functions

Benefits

  • Clearer separation of concerns
  • Improved code discoverability
  • Enhanced maintainability
  • Better module boundaries

The new structure provides a solid foundation for future development while making the codebase more intuitive to navigate and maintain.

@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels May 24, 2025
@cfc4n cfc4n requested a review from Copilot May 24, 2025 15:06
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 services package contents into command, browser, and abstract subpackages
  • Renamed and refactored init and mergeJSONToStruct functions into InitResources and utils.MergeJSONToStruct
  • Introduced pkg/comm for shared types, context keys, and InitTestEnv, removing direct context/zerolog setup 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 browser package name instead of services for 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 command package rather than services now 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, and LoadConfig would help ensure correct behavior under the new structure.
cs := &CommandServer{

pkg/comm/errors.go:17

  • Service registration functions (RegisterServ and ServiceList) were removed, but the CLI and server initialization still reference ServiceList. Reintroduce or relocate a central registry so services can register and be discovered at startup.
package comm

Copy link
Member
@cfc4n cfc4n left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, Thanks.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label May 24, 2025
@cfc4n cfc4n merged commit d6ba6d4 into gojue:master May 24, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0