-
Notifications
You must be signed in to change notification settings - Fork 2
Add plugin integration for creating tasks from comments #20
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
Open
Kvadratni
wants to merge
8
commits into
main
Choose a base branch
from
feature/plugin-system
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds foundational plugin system that allows loading third-party functionality at runtime without modifying core code. Core components: - C ABI with VTable pattern for stable cross-version compatibility - Plugin discovery from ~/.config/staged/plugins/ - TOML-based manifest parsing (plugin.toml) - Dynamic library loading using libloading - API version checking and validation - Plugin initialization with context (app handle, data dir, config) Technical details: - Plugins expose staged_plugin_entry() function returning PluginVTable - VTable contains function pointers for init, shutdown, and registration - Plugin manager discovers, loads, and initializes plugins at app startup - Managed state integration with Tauri Files added: - src-tauri/src/plugin/mod.rs: PluginManager implementation - src-tauri/src/plugin/api.rs: C ABI definitions Files modified: - src-tauri/Cargo.toml: Added libloading, toml, glob dependencies - src-tauri/src/lib.rs: Integrated plugin module and initialization Next phase: Command registration system Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds runtime command dispatch system allowing plugins to register
commands callable from the frontend via a universal dispatcher.
Core components:
- PluginCommandRegistry: Thread-safe command registry with HashMap
- CommandRegistrarImpl: C ABI bridge for plugin command registration
- Universal plugin_invoke dispatcher: Single Tauri command routing to all plugins
- Panic catching with AssertUnwindSafe for plugin stability
- JSON payload serialization/deserialization
Command flow:
1. Plugin registers commands during initialization
2. Frontend calls invoke('plugin_invoke', {pluginName, commandName, payload})
3. Dispatcher routes to correct plugin command handler
4. JSON response returned to frontend
New Tauri commands:
- plugin_invoke: Execute plugin command
- list_plugin_commands: Get all registered commands
- list_plugins: Get plugin manifests for frontend
Technical details:
- 64KB max response buffer per command
- Commands identified as "plugin:command" format
- Per-plugin isolation in command registry
- Command handlers receive JSON in/out via C strings
Files added:
- src-tauri/src/plugin/commands.rs: Command registry and dispatcher
Files modified:
- src-tauri/src/plugin/mod.rs: Added command registration integration
- src-tauri/src/lib.rs: Added plugin commands to Tauri handler
Next phase: Frontend integration
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds complete frontend plugin system with dynamic asset loading and modal UI support. Frontend components: - PluginAPI: Interface for plugins to interact with Stage - PluginSystem class: Manages plugin lifecycle and asset loading - Modal system: Plugins can register and show modal overlays - Asset loading: Dynamic script/CSS injection from plugin directories Backend additions: - get_plugin_asset command: Serves plugin JS/CSS files via file:// URLs - Path traversal protection: Validates assets stay in plugin directory - list_plugins command: Returns manifests with frontend metadata Frontend integration: - App.svelte: Initializes plugin system on mount - Modal backdrop: Renders plugin modals with backdrop - Plugin API includes: invoke, registerModal, showModal, closeModal Plugin workflow: 1. Backend discovers plugins at startup 2. Frontend calls list_plugins to get manifests 3. For each plugin with frontend assets: - Load CSS (if present) - Load JS and call initialization function - Plugin receives PluginAPI and registers modals 4. Plugins can show modals via API Security: - Asset paths validated against directory traversal - Plugins loaded from trusted config directory - Modal isolation with separate component instances Files added: - src/lib/services/plugins.ts: Frontend plugin system Files modified: - src-tauri/src/lib.rs: Added get_plugin_asset command - src/App.svelte: Plugin initialization and modal rendering Next phase: Menu registration and event hooks Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds complete plugin lifecycle event system and menu registration capabilities, enabling plugins to respond to app events and extend menus. Event system: - PluginEvent enum: Startup, Shutdown, Commit, ReviewCompleted, etc. - EventDispatcher: Thread-safe event subscription and emission - EventSubscriberImpl: C ABI bridge for plugin event subscriptions - Event callbacks with panic catching and error handling Menu system: - MenuRegistry: Stores plugin menu items - PluginMenuItem: Menu metadata (id, parent, label, shortcut) - MenuRegistrarImpl: C ABI bridge for menu registration Plugin lifecycle: 1. Init → Register commands → Register menus → Subscribe to events 2. Runtime: Receive events, handle commands, show modals 3. Shutdown: Cleanup and event notification Event integration points: - Startup: After all plugins initialized - Commit: After git commit created (commit command in lib.rs:139) - ReviewCompleted: After review cleared (clear_review in lib.rs:312) - Shutdown: Before plugins destroyed Technical details: - Events serialized to JSON for C ABI crossing - Panic catching on all event handlers - Multiple subscribers supported per event - Menu items stored for later dynamic menu building Files added: - src-tauri/src/plugin/events.rs: Event system - src-tauri/src/plugin/menus.rs: Menu registration Files modified: - src-tauri/src/plugin/mod.rs: Integrated events and menus - src-tauri/src/lib.rs: Event emissions, menu/event registration Next phase: Permission system (basic validation) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Implements plugin permission validation and enforcement to ensure plugins only access resources they declare in their manifests. Permission types: - File system: fs_read and fs_write with glob patterns - Network: URL patterns with wildcard matching - Tauri commands: Whitelist of allowed commands - External programs: List of allowed executables PermissionChecker features: - Manifest validation at plugin load time - Runtime permission checks (can_read_file, can_write_file, etc.) - Glob pattern matching for file paths - Variable expansion: $REPO, $DATA, $HOME - Path traversal prevention - URL pattern matching for network access Security features: - Validates patterns don't contain ".." (path traversal) - Network patterns must start with http:// or https:// - Permissions registered per plugin at load time - Permission checks available for future enforcement Integration: - Permission checker integrated into PluginManager - Validates manifest before loading plugin - Registers permissions after validation Note: Permission enforcement is validation-only in this phase. Future phases can add runtime enforcement in command/file handlers. Files added: - src-tauri/src/plugin/permissions.rs: Permission checker Files modified: - src-tauri/src/plugin/mod.rs: Integrated permission checker All 5 phases complete! Plugin system ready for testing. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit adds the ability to create Builder Bot tasks directly from code review comments with a single click. Frontend changes: - Add "Create Task" button (⚡ icon) to TopBar next to copy/delete buttons - Only visible when Builder Bot plugin is installed - Integrates with plugin system to pass comments as initial prompt - Exports comments as markdown and pre-fills plugin modal - Add PluginModalWrapper for rendering plugin modals - Add PluginSettings UI for managing plugins - Integrate plugin system into App.svelte with keyboard shortcuts Backend changes: - Fix plugin command registration system using thread-local storage - Commands now properly register with plugin-name:command-name format - Plugins can now be invoked from frontend without "command not found" errors - Add plugin system initialization and event handling The create task button: - Only appears when Builder Bot plugin is installed - Only visible when comments exist - Opens Builder Bot modal with comments pre-filled - Formats comments as markdown for better context Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
7b3c0d4 to
2188edc
Compare
Comprehensive guide covering: - Plugin architecture and structure - Quick start with simplest possible plugin example - Plugin API reference - Building and installing plugins - Advanced examples and best practices - Troubleshooting guide Includes complete working code for: - Frontend-only 'Hello Stage' plugin - Full-stack plugin with Rust backend - Modal components with props - Backend command handlers Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
When creating a task from comments, now passes: - PR number (if viewing a PR) - Repository path This allows the plugin to automatically attach the PR as an artifact to the created task using the bb CLI. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to create Builder Bot tasks directly from code review comments with a single click. This integrates the plugin system with the comment workflow, making it easy to convert review feedback into actionable tasks.
Changes
Frontend
initialPromptand other contextBackend
plugin-name:command-nameformatTest Plan
Screenshots
[Add screenshot of the create task button in action]
Related
🤖 Generated with Claude Code