Skip to content

[FEATURE] Roadmap to Plugin-Based Architecture #23

@Artemonim

Description

@Artemonim

Roadmap to Plugin-Based Architecture

Objective

Define and implement a plugin-based architecture for language-specific logic to improve modularity, scalability, and maintainability of the docstring generator.

Goals

  • Extract language-specific responsibilities (parsing, comment styles, header handling) into separate plugins.
  • Simplify core.py to function as a pure orchestrator using a standardized plugin interface.
  • Maintain shared data structures (ClassInfo, SignatureInfo) and common utilities in common.py.
  • Improve testability by allowing isolated testing of each language plugin.

Phases

Phase 1: Define Plugin Interface

  • Introduce LanguagePlugin interface in common.py with methods:
    • get_comment_style() -> CommentStyle
    • parse(lines: List[str]) -> Tuple[List[ClassInfo], List[SignatureInfo]]
    • get_preserved_header_end_line(lines: List[str]) -> int
    • remove_agent_docstring(text: str) -> str
  • Document interface contract and update developer guide.

Phase 2: Implement Language Plugins

  • Create plugin classes for each supported language:
    • Python, Go, Java, Kotlin, JavaScript, TypeScript, C#, C/C++, PowerShell, Delphi.
  • Move existing language-specific logic from core.py and common.py into respective plugin implementations.
  • Register each plugin in a LANG_PLUGINS registry keyed by file extension.

Phase 3: Refactor Core Orchestrator

  • Replace EXT_TO_LANG and LANG_PARSERS maps with the new plugin registry.
  • Update process_file() to load and invoke plugin methods exclusively.
  • Remove all if language == ... branches from core.py and common.py.

Phase 4: Update Common Utilities

  • Retain shared data types (ClassInfo, SignatureInfo) in common.py.
  • Optionally move default comment-style configurations into plugins or keep shared defaults.
  • Ensure common.py only defines interfaces and general-purpose helpers.

Phase 5: Testing & Validation

  • Develop unit tests for each plugin method in isolation.
  • Update existing core and integration tests to use the plugin-based workflow.
  • Validate end-to-end functionality across all supported languages.

Problem Statement

The current architecture is difficult to support in all languages at the same time.

Priority Level

🫠 Critical - Blocking my workflow completely

Implementation Complexity

  • 🤔 Simple - Minor change or addition
  • 😑 Moderate - Requires new parsing logic
  • 🛠️ Complex - Major feature requiring significant development
  • 😎 I don't know

Contribution

  • I would like to implement this feature myself
  • I can help with testing
  • I can provide sample code files for testing

Metadata

Metadata

Assignees

Labels

🤖.43726561746564206279204149🪲 enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions