Skip to content

Implement a Plugin Architecture for TruShell #18

@AkshajSinghal

Description

@AkshajSinghal

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:

  1. 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.

  2. 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.
  1. 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.
  1. 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.
  1. 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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions