Skip to content
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

feat: plugin refactor #78

Merged
merged 8 commits into from
Feb 20, 2025
Merged

feat: plugin refactor #78

merged 8 commits into from
Feb 20, 2025

Conversation

yusufhm
Copy link
Contributor

@yusufhm yusufhm commented Feb 18, 2025

Major Refactoring of Plugin Architecture

This PR introduces a significant refactoring of the plugin architecture to improve code organization, reduce duplication, and make the codebase more maintainable.

Key Changes

Plugin Management

  • Introduced a new plugin management system with a generic Manager type
  • Moved plugin registration and lifecycle management into dedicated managers for each plugin type (analyse, fact, connection)
  • Simplified plugin interfaces and reduced code duplication

Code Organization

  • Removed redundant plugin template files and consolidated common functionality
  • Moved base plugin functionality into shared components
  • Improved error handling and validation across plugin types

Testing

  • Updated test infrastructure to work with new plugin architecture
  • Simplified test helpers and reduced test code duplication
  • Added new tests for plugin management functionality

Other Improvements

  • Removed deprecated code and unused files
  • Improved logging and error reporting
  • Better separation of concerns between plugin types
  • More consistent plugin initialization and configuration

Impact

This refactoring makes the codebase more maintainable and easier to extend with new plugins. While this is a large change, it should be largely transparent to end users of the system.

Testing

All existing tests have been updated and pass. New tests have been added to cover the plugin management functionality.

#CursorAI-IsAwesome

This commit introduces core plugin management components:
- Created base plugin types and interfaces
- Implemented plugin registry and manager
- Added support for generic plugin registration and retrieval
- Included test coverage for plugin manager functionality
This commit refactors the fact plugin system by:
- Introducing a BaseFact struct to provide common functionality
- Updating fact plugin types and interfaces
- Migrating command and test fact plugins to use the new base implementation
- Aligning fact plugin management with the new plugin infrastructure
This commit continues the refactoring of the fact plugin system by:
- Removing the `factplugin.go.tmpl` template file
- Updating the `gen.go` command to remove fact plugin generation logic
- Cleaning up fact plugin generation references in various files
- Simplifying the fact plugin generation process by leveraging the new BaseFact implementation
This commit updates the test data and fact plugin infrastructure by:
- Modifying the TestFacter struct to use the new BaseFact implementation
- Updating test files to use the new `testdata.New()` constructor
- Replacing direct fact plugin registry access with manager methods
- Simplifying fact plugin initialization and data handling in test scenarios
This commit updates the fact plugin validation and input handling by:
- Modifying validation methods to be standalone functions
- Updating input validation to use data formats instead of plugin names
- Simplifying connection and input validation logic
- Improving error handling and logging for fact plugin validation
- Removing redundant methods from the Facter interface
This commit updates the analyse plugin system by:
- Introducing a BaseAnalyser struct to provide common functionality
- Implementing a new plugin manager for analyse plugins
- Updating analyse plugin types and interfaces
- Migrating existing analyse plugins to use the new base implementation
- Improving plugin registration, configuration, and error handling
- Removing deprecated registry and global state management
This commit updates the connection plugin system by:
- Introducing a BaseConnection struct to provide common functionality
- Implementing a new plugin manager for connection plugins
- Updating connection plugin types and interfaces
- Migrating existing connection plugins to use the new base implementation
- Improving plugin registration, configuration, and error handling
- Removing deprecated registry and global state management
- Updating command and fact plugin references to use the new connection plugin manager
@yusufhm yusufhm merged commit 3d1aed7 into 1.x Feb 20, 2025
3 of 4 checks passed
@yusufhm yusufhm deleted the feature/plugin-refactor branch February 20, 2025 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants