-
Notifications
You must be signed in to change notification settings - Fork 74
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
Enhance Patchwork's Extensibility: Decoupling and Generalizing Core Components #492
Comments
Hi @Greyisheep , thank you for contributing to the project and attempting to add a new Patchflow. In general, patchflows follow these series of patterns: For the creation of a unit test creating Patchflow, I believe the Step: ExtractCodeContexts would be used to extract for classes or methods in codes to generate unit tests for.
This is because CallCode2Prompt is something we classify internally as an external tool use, something similar to ScanSemgrep and ScanDepscan. Each external tool used "Step" is indeed made for a specific patchflow in mind at the point of writing. This leads to the proposed solution:
With the context of ScanSemgrep and ScanDepscan, perhaps a base class that encapsulates the idea of a external tool use would be appropriate. The base class handles how it will run an external tool, usually another CLI, and its mode handles how we handle the outputs of such an external tool from files or stdout.
Yes, you are right we should allow another mode of operations other than just making code changes in place. I believe for the creation of a unit test Patchflow, you would need a way to create new files rather than just editing current files.
This is currently in the works. The planned changes are to add additional status values, rather than just "No errors" -> |
While attempting to extend the library by creating a GenerateUnitTests patchflow, several limitations in the current architecture were identified. These limitations hinder the easy extension of the library, which is one of the short-term goals of Patchwork.
Current Limitations
Tight Coupling: The CallCode2Prompt step is tightly coupled to the GenerateREADME patchflow. This makes it difficult to reuse or adapt for other patchflows.
Limited Functionality: The current
CallCode2Prompt.py
in the main branch has limited functionality, focusing only on README.md file handling.Inflexible ModifyCode Class: The ModifyCode class in ModifyCode.py is not designed to handle multiple modes of operation, making it challenging to add new patchflow types.
Lack of Standardized Extension Method: There's no clear, standardized base model to add new patchflows to the library.
Proposed Solutions
Generalize CallCode2Prompt:
Enhance ModifyCode Class:
Standardize Patchflow Creation:
Update Existing Patchflows:
Improve Documentation:
Discussion Points
By addressing these points, we can significantly improve Patchwork's extensibility, making it easier for contributors to add new features and patchflows in the future.
Some Changes Already Being Worked on
Here's a link to a branch with the proposed changes already been worked.
The text was updated successfully, but these errors were encountered: