|
| 1 | +# Roadmap to Plugin-Based Architecture |
| 2 | + |
| 3 | +## Objective |
| 4 | + |
| 5 | +Define and implement a plugin-based architecture for language-specific logic to improve modularity, scalability, and maintainability of the docstring generator. |
| 6 | + |
| 7 | +## Goals |
| 8 | + |
| 9 | +- Extract language-specific responsibilities (parsing, comment styles, header handling) into separate plugins. |
| 10 | +- Simplify `core.py` to function as a pure orchestrator using a standardized plugin interface. |
| 11 | +- Maintain shared data structures (`ClassInfo`, `SignatureInfo`) and common utilities in `common.py`. |
| 12 | +- Improve testability by allowing isolated testing of each language plugin. |
| 13 | + |
| 14 | +## Phases |
| 15 | + |
| 16 | +### Phase 1: Define Plugin Interface |
| 17 | + |
| 18 | +- Introduce `LanguagePlugin` interface in `common.py` with methods: |
| 19 | + - `get_comment_style() -> CommentStyle` |
| 20 | + - `parse(lines: List[str]) -> Tuple[List[ClassInfo], List[SignatureInfo]]` |
| 21 | + - `get_preserved_header_end_line(lines: List[str]) -> int` |
| 22 | + - `remove_agent_docstring(text: str) -> str` |
| 23 | +- Document interface contract and update developer guide. |
| 24 | + |
| 25 | +### Phase 2: Implement Language Plugins |
| 26 | + |
| 27 | +- Create plugin classes for each supported language: |
| 28 | + - Python, Go, Java, Kotlin, JavaScript, TypeScript, C#, C/C++, PowerShell, Delphi. |
| 29 | +- Move existing language-specific logic from `core.py` and `common.py` into respective plugin implementations. |
| 30 | +- Register each plugin in a `LANG_PLUGINS` registry keyed by file extension. |
| 31 | + |
| 32 | +### Phase 3: Refactor Core Orchestrator |
| 33 | + |
| 34 | +- Replace `EXT_TO_LANG` and `LANG_PARSERS` maps with the new plugin registry. |
| 35 | +- Update `process_file()` to load and invoke plugin methods exclusively. |
| 36 | +- Remove all `if language == ...` branches from `core.py` and `common.py`. |
| 37 | + |
| 38 | +### Phase 4: Update Common Utilities |
| 39 | + |
| 40 | +- Retain shared data types (`ClassInfo`, `SignatureInfo`) in `common.py`. |
| 41 | +- Optionally move default comment-style configurations into plugins or keep shared defaults. |
| 42 | +- Ensure `common.py` only defines interfaces and general-purpose helpers. |
| 43 | + |
| 44 | +### Phase 5: Testing & Validation |
| 45 | + |
| 46 | +- Develop unit tests for each plugin method in isolation. |
| 47 | +- Update existing core and integration tests to use the plugin-based workflow. |
| 48 | +- Validate end-to-end functionality across all supported languages. |
| 49 | + |
| 50 | +### Phase 6: Documentation & Release |
| 51 | + |
| 52 | +- Update `README.md` and project documentation with new architecture overview. |
| 53 | +- Add a migration guide for contributors and users. |
| 54 | +- Tag a beta release for community feedback, then finalize and publish. |
| 55 | + |
| 56 | +## Estimated Timeline |
| 57 | + |
| 58 | +- **Q3 2025:** Complete Phases 1–3 (interface definition, plugin implementation, core refactor). |
| 59 | +- **Q4 2025:** Complete Phases 4–6 (utilities update, testing, documentation, release). |
0 commit comments