Skip to content

Conversation

DuckyOnQuack-999
Copy link
Owner

@DuckyOnQuack-999 DuckyOnQuack-999 commented Aug 9, 2025

Enhance HyprRice with DuckyCoder v4, adding comprehensive input management, a secure plugin system, and complete theme configurations.


Open in Cursor Open in Web

Summary by Sourcery

Implement DuckyCoder v4 enhancements by revamping the plugin architecture with sandbox security, adding a complete input manager, delivering full theme configurations, and improving logging, error handling, and maintainability

New Features:

  • Introduce a secure plugin sandbox with execution timeouts, resource limits, and import restrictions
  • Enhance plugin base and manager to support plugin lifecycle, discovery, loading, unloading, event dispatching and metadata tracking
  • Implement full input management for Hyprland including config loading, parsing, validation, application, and device enumeration
  • Provide complete theme files for cyberpunk, minimal, and pastel themes

Bug Fixes:

  • Restore missing import in main module to prevent runtime errors
  • Populate previously empty theme files with full configurations

Enhancements:

  • Standardize logging and error handling across modules and add type annotations for better maintainability
  • Strengthen plugin security checks to detect malicious patterns and enforce file size limits

Documentation:

  • Add a comprehensive DuckyCoder v4 master transformation report detailing the update scope, metrics, and future recommendations

Co-authored-by: joshinhd1 <joshinhd1@gmail.com>
Copy link

cursor bot commented Aug 9, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

Copy link

sourcery-ai bot commented Aug 9, 2025

Reviewer's Guide

This PR integrates DuckyCoder v4 into HyprRice by overhauling the plugin framework with sandboxed execution, extending plugin lifecycle APIs, fully implementing Hyprland input management, populating previously empty theme files, and adding a comprehensive AI-driven transformation report.

Sequence diagram for secure plugin loading and event dispatch

sequenceDiagram
    participant App
    participant PluginManager
    participant PluginSandbox
    participant PluginModule
    participant PluginInstance
    App->>PluginManager: load_plugin(plugin_name, app)
    PluginManager->>PluginSandbox: execute_with_timeout(_load_module_safe, ...)
    PluginSandbox->>PluginManager: returns PluginModule
    PluginManager->>PluginModule: register(app)
    PluginModule->>PluginInstance: returns PluginInstance
    PluginManager->>App: returns PluginInstance
    App->>PluginManager: dispatch_event(event, context)
    PluginManager->>PluginInstance: sandboxed execute event handler
    PluginInstance-->>PluginManager: event handled
    PluginManager-->>App: event dispatch complete
Loading

Class diagram for enhanced plugin system and input management

classDiagram
    class PluginSandbox {
        +max_execution_time: int
        +max_memory_mb: int
        +execute_with_timeout(func, *args, **kwargs): Any
    }
    class PluginBase {
        +name: str
        +version: str
        +author: str
        +description: str
        +register(app): PluginBase
        +unregister(app): None
        +is_active(): bool
        +get_info(): Dict[str, str]
        +register_event_handler(event, handler): None
        +get_event_handlers(event): List[Callable]
        +validate_context(context): bool
        +before_apply(context): None
        +after_apply(context): None
        +before_theme_change(context): None
        +after_theme_change(context): None
        +before_import(context): None
        +after_import(context): None
        +on_preview_update(context): None
        +on_startup(app): None
        +on_shutdown(app): None
    }
    class PluginManager {
        +plugins_dir: Path
        +enable_sandbox: bool
        +sandbox: PluginSandbox
        +available_plugins: List[str]
        +loaded_plugins: Dict[str, module]
        +plugin_instances: Dict[str, PluginBase]
        +plugin_metadata: Dict[str, Any]
        +max_plugins: int
        +allowed_imports: set
        +blocked_imports: set
        +list_plugins(): List[str]
        +list_loaded_plugins(): List[Dict[str, str]]
        +load_plugin(plugin_name, app): Optional[PluginBase]
        +unload_plugin(plugin_name, app): bool
        +reload_plugin(plugin_name, app): bool
        +dispatch_event(event, context): None
        +get_plugin_info(plugin_name): Optional[Dict[str, Any]]
        +unload_all_plugins(app): None
        +get_plugin_statistics(): Dict[str, Any]
    }
    class InputManager {
        +config_path: Path
        +get_input_config(): Dict[str, Any]
        +set_input_config(config): None
        +apply_input_config(config): bool
        +set_keyboard_repeat_rate(rate): bool
        +set_keyboard_repeat_delay(delay): bool
        +set_mouse_sensitivity(sensitivity): bool
        +set_mouse_accel_profile(profile): bool
        +toggle_touchpad_natural_scroll(enabled): bool
        +toggle_touchpad_tap_to_click(enabled): bool
        +get_input_devices(): List[Dict[str, str]]
        +get_keyboard_layouts(): List[str]
        +reset_to_defaults(): bool
    }
    PluginManager --> PluginSandbox
    PluginManager --> PluginBase
    PluginBase <|-- PluginSandbox
Loading

File-Level Changes

Change Details Files
Plugin system overhaul with sandboxed execution and enhanced lifecycle
  • Added PluginSandbox for time- and memory-restricted plugin execution
  • Extended PluginBase with metadata, register/unregister hooks, and event handler API
  • Rewrote PluginManager to discover, validate, sandbox-load/unload/reload, and dispatch events in isolation
src/hyprrice/plugins.py
Complete Hyprland input management implementation
  • Loaded and parsed the ‘input’ section from the Hyprland config
  • Implemented get/set/apply methods with validation and error handling
  • Added device enumeration and keyboard layout listing
src/hyprrice/hyprland/input.py
Populated theme files with full configurations
  • Filled cyberpunk, minimal, and pastel themes with complete Hyprland, Waybar, and Rofi settings
themes/cyberpunk.hyprrice
themes/minimal.hyprrice
themes/pastel.hyprrice
Added DuckyCoder v4 master transformation report
  • Introduced DUCKYCODER_V4_MASTER_REPORT.md containing an executive summary, issue analysis, metrics, and architecture diagrams
DUCKYCODER_V4_MASTER_REPORT.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants