Guides

Plugin System

Extend QCoder with custom tools, hooks, commands, and settings through the plugin architecture.

Plugin Architecture

QCoder's plugin system lets you extend the editor with custom functionality. Plugins can be installed from two locations:

  • Workspace plugins -- .qcoder/plugins/ in your project root. These are project-specific.
  • npm packages -- node_modules/@qcoder/ scope. Install with npm install @qcoder/plugin-name.

Plugins are loaded automatically when QCoder starts or when a workspace is opened.

What Plugins Can Register

Plugins can extend QCoder in five ways:

Tools -- Add new tools that the AI can call during conversations. For example, a plugin could add a query_database tool or a deploy_to_staging tool.

Hooks -- Intercept and modify behavior at 13 hook points in the QCoder lifecycle: 1. beforeMessage -- Before a user message is sent to the AI 2. afterMessage -- After the AI responds 3. beforeToolCall -- Before a tool is executed 4. afterToolCall -- After a tool finishes 5. beforeFileRead -- Before a file is read 6. afterFileRead -- After a file is read 7. beforeFileWrite -- Before a file is written 8. afterFileWrite -- After a file is written 9. beforeCommand -- Before a shell command is executed 10. afterCommand -- After a shell command finishes 11. onError -- When an error occurs 12. onSessionStart -- When a new chat session begins 13. onSessionEnd -- When a chat session ends

Commands -- Register custom commands accessible from the Command Palette (Ctrl+Shift+P).

Settings -- Add custom configuration options that appear in the Settings panel.

Storage -- Persist plugin-specific data across sessions using the provided storage API.

Plugin Manifest

Each plugin declares its capabilities in its package.json:

json{
  "name": "@qcoder/plugin-example",
  "version": "1.0.0",
  "qcoder": {
    "displayName": "Example Plugin",
    "description": "An example QCoder plugin",
    "tools": ["query_database"],
    "hooks": ["beforeFileWrite", "afterCommand"],
    "commands": [
      {
        "id": "example.runQuery",
        "title": "Run Database Query"
      }
    ],
    "settings": [
      {
        "id": "example.connectionString",
        "type": "string",
        "title": "Database Connection String",
        "default": ""
      }
    ]
  },
  "main": "./dist/index.js"
}

The qcoder field in package.json is required. It tells QCoder what the plugin provides so that registration happens correctly.

Plugin Marketplace

Browse and install community plugins through the built-in Plugin Marketplace:

  1. Open Settings > Plugins tab.
  2. Browse available plugins by category or search by name.
  3. Click Install to add a plugin.
  4. Some plugins require configuration -- check the plugin's settings section after installation.

You can also enable, disable, or uninstall plugins from this panel. Disabled plugins remain installed but do not load at startup.