Plugin system #34
Replies: 4 comments 6 replies
-
|
@kaurifund The idea of Canvas -> Column -> Panels is that and "end user" could write their own "Panel" as a basic React component and just drop it into an extensions folder. The plugins would be sharable and if they proved to be good, could easily be imported into core. |
Beta Was this translation helpful? Give feedback.
-
|
@peterjthomson , We have pretty similar implementation plans, I didn't want to assume changes to the existing UI and structure, so I focused the plugsins on three modes, app (which is a full different UI page, same style guide as ledger, background plugins, with no UI, and two others, with is for popups or models that don't affect current pannel, and widget slots, which is the part similar to the canvas stuff. I am going to get the plugin stuff finished and push the branch and we can pick out the bits we like and merge whats needed, and rebase others. My branch has a left sidebar with icons of plugin 'app' type which you click and it changes the page to it. Should be flexible enough. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
|
@peterjthomson , great! This gives the project very solid bones. And the plugs give it a 'stable' area to experiment on new things, without any regression on the main features. Try make a plugin, their should be a plugin reference doc, and ask the agent to use the plugin examples as a guide. I want to see if 5.2 is able to do it, if it can't the instructions in the .md files are not good enough. |
Beta Was this translation helpful? Give feedback.



Uh oh!
There was an error while loading. Please reload this page.
-
Plugin System Proposal
Overview
This document proposes an extension system for Ledger that allows users and contributors to create custom panels without modifying core code. The goal is to provide an onramp for new developers to contribute panels that could eventually be added to core or shared with other users.
Goals
Approaches Considered
Option 1: Manual Registry (Rejected)
Pros: Simple, type-safe, no runtime compilation
Cons: Requires editing registry file, needs npm/build step for each plugin
Verdict: Too much friction for casual contributors
Option 2: Hot-Reload Dev Experience (Rejected)
File watcher that detects changes and recompiles plugins in real-time during development.
Pros: Great DX for plugin authors
Cons: Complex implementation, potential for memory leaks, harder to debug
Verdict: Over-engineered for the use case. Restart-on-change is acceptable.
Option 3: Folder Scan + Runtime Compilation (Recommended)
Scan a designated folder on app startup, compile TSX files with esbuild, inject into the app.
Pros:
Cons:
Verdict: Best balance of simplicity and capability
Recommended Architecture
Plugin Structure
Manifest Format
{ "id": "contributor-rank", "name": "Contributor Rank", "description": "Shows contributors ranked by commit count", "version": "1.0.0", "author": "Your Name", "slot": "editor", "icon": "👥" }Fields:
id: Unique identifier (matches folder name)name: Display name in panel pickerslot: Where plugin can be placed (editor,sidebar,viz)icon: Emoji or icon identifier for the panel pickerPlugin Component Contract
Curated Plugin API
Plugins receive a limited API object rather than full app access:
Why curated?
Compilation Pipeline
esbuild Configuration
Key decisions:
external: ['react', ...]- Use host app's React, don't bundle duplicateformat: 'iife'- Self-contained, easy to evalwrite: false- No temp files, fasterlogLevel: 'silent'- Prevents issues with esbuild's stdioPlugin Execution
Lessons Learned from POC
What Worked
What Didn't Work
Tricky Parts
Canvas/Layout Integration - Plugins need a way to be added to the UI. This required:
Style Isolation - Plugin CSS could conflict with app styles. Options:
Error Boundaries - Plugin errors shouldn't crash the app:
Implementation Phases
Phase 1: Foundation
Phase 2: Integration
Phase 3: Polish
Phase 4: Community (Future)
Open Questions
Plugin updates - How do users update plugins? Manual folder replacement? GitHub integration?
Shared state - Should plugins be able to communicate with each other? Probably not for v1.
Write operations - Should plugins be able to stage files, commit, etc.? Requires careful API design.
Multi-repo - How do plugins behave when switching repos? Probably just re-render with new context.
Performance budget - Should we limit number of plugins or add lazy loading?
Appendix: Example Plugin
manifest.json
{ "id": "contributor-rank", "name": "Contributor Rank", "description": "Shows contributors ranked by commit count", "version": "1.0.0", "author": "Ledger Contributors", "slot": "editor", "icon": "👥" }index.tsx
styles.css
This proposal is based on a proof-of-concept implementation. The POC code has been removed pending a decision on whether to proceed with full implementation.
Beta Was this translation helpful? Give feedback.
All reactions