Skip to content

Conversation

@eciuca
Copy link

@eciuca eciuca commented Oct 13, 2025

Summary

This PR introduces a plugin architecture that allows extending Backlog CLI with additional commands without modifying the core codebase. The implementation follows the git plugin pattern (similar to git-lfs, git-flow, etc.).

What's Changed

Core Changes

  • Plugin Router: Added src/core/plugin-router.ts to handle plugin discovery and execution
  • CLI Integration: Modified src/cli.ts to route unknown commands to plugins
  • Type System: Extended Task type with index signature to allow plugins to add custom fields
  • Parser Enhancement: Updated markdown parser to preserve custom fields from plugins

Documentation

  • Plugin Guide: Added comprehensive docs/plugins.md with:
    • How plugins work
    • Installation and usage instructions
    • Plugin development guide with examples
    • Best practices

Task Definitions

Added task documentation for the implementation:

  • TASK-298: Plugin routing system
  • TASK-299: Adapter pattern for plugin integration
  • TASK-300: Generic type support for plugins

How It Works

  1. Plugin Discovery: When running backlog <command>, CLI checks if it's a core command
  2. Plugin Routing: If not found, looks for backlog-<command> executable in PATH or node_modules/.bin
  3. Plugin Execution: Executes the plugin and forwards output directly to terminal

Example Usage

# Install a plugin globally
npm install -g backlog-jira

# Use the plugin
backlog jira sync
backlog jira push task-123

Design Principles

  • Zero Core Changes: Plugins don't require modifying core code
  • Zero Coupling: Plugins interact via CLI interface, not internal APIs
  • Backward Compatible: All existing functionality remains unchanged
  • Simple & Familiar: Follows git plugin pattern that developers already know

Example Plugin

A working implementation is available at:
https://github.com/eciuca/Backlog.md-jira-plugin

This Jira integration plugin demonstrates:

  • Bidirectional sync with Jira
  • Custom field storage (jiraKey, jiraStatus, etc.)
  • Independent deployment and versioning
  • Zero modifications to core Backlog.md

Benefits

  1. Extensibility: Add new integrations without touching core
  2. Maintainability: Plugins are independently maintained and versioned
  3. Community: Enables community-contributed integrations
  4. Clean Core: Keeps core focused on task management

Testing

The plugin architecture has been tested with the Jira plugin implementation, including:

  • Plugin discovery and routing
  • Custom field persistence
  • CLI command forwarding
  • Error handling

Related

- Add plugin-router for extensible CLI commands
- Add plugin system documentation
- Enables external plugins like backlog-jira to extend Backlog.md
- Zero-impact on core functionality when no plugins are installed
…y generic

Enhanced plugin support with zero Jira-specific code in core:

TASK-298: Implement plugin routing system
- Added PluginRouter integration to CLI
- Routes commands to plugins before Commander parsing
- Seamless plugin command execution

TASK-299: Refactor display code to use adapter pattern
- Removed hardcoded Jira metadata display from task viewer
- Plugins now handle their own display via 'view' command
- Clean separation of concerns

TASK-300: Remove Jira-specific code from core types and parser
- Changed Task interface to use index signature for dynamic fields
- Parser spreads all frontmatter fields instead of hardcoding Jira fields
- Allows any plugin to add custom fields without core modifications

This achieves true plugin architecture: core has zero knowledge of
specific plugins, yet supports unlimited plugin functionality.
Add Plugin Support Infrastructure
@MrLesk
Copy link
Owner

MrLesk commented Oct 14, 2025

Hi @eciuca
PR looks good from a quick check. I am finishing the implementation of the MCP integration and will check your PR in detail as soon as possible

@eciuca eciuca changed the title Add Plugin Architecture for Extensible CLI WIP: Add Plugin Architecture for Extensible CLI Oct 14, 2025
@eciuca
Copy link
Author

eciuca commented Oct 14, 2025

I updated as WIP as I need to make sure it integrates correctly with plugin commands. And to test it some more on the projects I work on

@eciuca eciuca force-pushed the feature/plugin-support branch from 2833127 to f7c16d2 Compare October 20, 2025 11:17
@mindofjonas
Copy link

Any update on this one? Was looking to create a plugin to embedded Excalidraw diagrams into docs/tasks

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.

3 participants