Currently, TruShell handles all functionality within its core codebase. We need a robust plugin system that allows users and developers to extend TruShell’s capabilities without modifying the core source code. This aligns with our goal of making TruShell a highly customizable environment for power users.
Key Requirements:
-
Discovery & Loading:
Ability to discover plugins from a specific directory (e.g., ~/.trushell/plugins/) or via PyPI packages.
Dynamic loading of plugins at startup or on-demand.
-
Hook System: Define clear hooks where plugins can interact with the shell lifecycle:
on_startup: Run when TruShell initializes.
pre_command: Intercept/modify commands before execution.
post_command: Access results/output after command execution.
on_exit: Cleanup tasks when TruShell closes.
- Isolation & Safety:
- Plugins should run in a way that doesn’t crash the main shell if they fail.
- Basic sandboxing or permission checks to prevent malicious plugins from accessing sensitive system resources.
- API Documentation:
- Create a simple Python API for developers to create their own plugins.
- Example: A decorator-based approach like @trushell.plugin or a class-based interface.
- Management Commands: Add built-in commands to manage plugins:
plugin list: Show installed plugins.
plugin install <name>: Install a new plugin.
plugin disable <name>: Temporarily disable a plugin.
Currently, TruShell handles all functionality within its core codebase. We need a robust plugin system that allows users and developers to extend TruShell’s capabilities without modifying the core source code. This aligns with our goal of making TruShell a highly customizable environment for power users.
Key Requirements:
Discovery & Loading:
Ability to discover plugins from a specific directory (e.g., ~/.trushell/plugins/) or via PyPI packages.
Dynamic loading of plugins at startup or on-demand.
Hook System: Define clear hooks where plugins can interact with the shell lifecycle:
on_startup: Run when TruShell initializes.pre_command: Intercept/modify commands before execution.post_command: Access results/output after command execution.on_exit: Cleanup tasks when TruShell closes.plugin list: Show installed plugins.plugin install <name>: Install a new plugin.plugin disable <name>: Temporarily disable a plugin.