feat: Plugin architecture and Persistence layer#31
Conversation
- Added `codesage/core/interfaces.py` defining `Plugin`, `Rule`, and `Analyzer` interfaces. - Implemented `PluginManager` in `codesage/cli/plugin_loader.py` for dynamic plugin loading. - Created `codesage/history/models.py` with SQLAlchemy models (`Project`, `Snapshot`, `Issue`, `Dependency`). - Refactored `codesage/history/store.py` to use `StorageEngine` with SQLAlchemy. - Updated `codesage scan` command to load plugins and persist results to DB. - Added `sqlalchemy` and `alembic` dependencies. - Added sample custom rule plugin in `examples/plugins/my_custom_rule.py`. - Initialized Alembic for database migrations.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
This change implements Phase 4 of the codesage project, introducing a plugin architecture and replacing file-based storage with a database-backed persistence layer using SQLAlchemy.
Key changes:
PluginManagerallows dynamic loading of external Python modules that implement thePlugininterface. Users can define customRules andAnalyzers.StorageEngineclass manages database interactions using SQLAlchemy. The default database is SQLite (codesage.db), but it supports any SQLAlchemy-compatible database via connection string.Project,Snapshot,Issue, andDependencyreplace the previous flat YAML storage.codesage scancommand now accepts--plugins-dirand--db-urlarguments. It executes loaded plugins against the snapshot and saves the results to the database.SQLAlchemyandAlembic.The change ensures backward compatibility with existing snapshot generation logic while enabling advanced historical analysis and extensibility.
PR created automatically by Jules for task 18056630340618888762 started by @turtacn