BoostIO / BoostNote-App

Boost Note is a document driven project management tool that maximizes remote DevOps team velocity.
https://boostnote.io
Other
3.8k stars 373 forks source link

Plugins: Discussion of design #306

Closed shmolf closed 3 years ago

shmolf commented 4 years ago

Plugins: Some want them, all need them [see your local physician for details]

I think plugins could help expand and encapsulate functionality in the new application.

If one user wants charts, and another wants WordPress sync support, then all users should not be subjected to load time and functionality where not desired. For if one JS function fails, it could at least disrupt other functionality.

This begs the question of how to design, implement, and assign responsibility for various plugins.

The foundation of a plugin system needs to consider numerous points of conflict of views, and enable independent plugins that can share resources, whilst not disabling another (except where dependencies lay).

I myself have my own considerations, but this issue is to open a topic for other's points of view to declare their thoughts.

qrospars commented 4 years ago

I don't have enough knowledge about this type of questions so I can't really help. But it is an important topic that should probably be discussed. For example, I don't know if it could be considered as a plugin, but the different supports for Latex or Mermaid that we could find in the old version of Boostnote were super useful for me.

Also, I really liked the fact that loading my notes was super fast (<1s) so I would always recommend personnally to put that in front instead of plugins.

arcturus140 commented 4 years ago

is it necessary to introduce all these concepts from the beginning? I don't know if for example sibling plugins can be supported later on?

I am really missing my admonitions in Boost Note, that should be a small and easy plugin to start with.

shmolf commented 4 years ago

TLDR: Plugin interaction can have side affects. Basic plugin system would be a good start.


A plugin might encompass direct Dropbox Sync support.

Something as important as synchronization might be important for someone who accesses their notes across devices (but isn't using the proprietary cloud storage).

How plugins should interact, and what limitations/responsibilities they should have, are crucial to the foundational architecture of a plugin system.

ZeroX-DG commented 4 years ago

I agree with this idea. We need to plan out this plugin architecture as soon as possible otherwise the app will need to be restructuring and that could cost a lot of time. That's why I open an issue when this repo was first back in development: https://github.com/BoostIO/BoostNote.next/issues/48


shmolf commented 4 years ago

NPM and Composer use semantic versioning. I think it'd be good to follow through to base any plugin versioning on the this same system.


ZeroX-DG commented 4 years ago

Yeah good ideas. Another way of installing the plugin is via git and clone the repo to the app directory but it will require git to be installed. However it's also a good way to consider.

If we were going to allow sibling plugin then we have to support a kind of mechanism to prevent a plugin from being removed if another plugin is depending on it.

Rokt33r commented 4 years ago

What I'm thinking is like this. https://github.com/denoland/deno_website2/blob/master/src/database.json

A single repository(should be this repo) will have a file like the database.json. The file is having github url of each available plugins. To register a plugin, plugin dev will submit a PR. Once it is registered, the app will fetch the plugin's compiled asset from its releases page.

Rokt33r commented 4 years ago

@ZeroX-DG @shmolf And thanks for sharing your idea. It is really helpful. I'll keep checking further discussion.

shmolf commented 4 years ago

I like the database option. And if it pulls from the Release's page, that would be ideal. It alleviates the need for calling git clone.


One of my projects has a sort of permissions controller. Making sure an action can be taken, before it actually is.

An example of a negative scenario that might be preventable.

I don't think it's impossible to prevent a plugin from accessing any part of the application, and intentionally breaking the user's experience. But the idea is that the plugins will be made to enhance the users experience, so hopefully the plugin would be written with good-intentions in mind.

If a basic application interface was created to give access points for plugins to work with, it would allow for plugins to safely communicate to the application, without inadvertently breaking anything.

Similarly, each plugin should be required to implement a common interface expected by the note application, so that basic communication can exist, such as version checks and the like.


Here's where I may be "tool shedding"

Even with a basic application API for which plugins can interface, it could still allow a plugin too much access. Using the Plugin list, adding another attribute for permissions would allow the application to grant specific or a collection of methods to the plugin.

Specific Boostnote Module/Lib

const init = () => { doThings(); };
const make = (cupSize) => { return brewCoffee(cupSize); };
const drink = (coffee) => { carefullySip(coffee); };
export default {
  init,
  make
};

Boostnote-defined Permission List for API.

And taking from @Rokt33r's database.json example

{
  "abc": {
    "type": "github",
    "owner": "zhmushan",
    "repo": "abc",
    "desc": "A better Deno framework to create web application",
    "perms": ["coffee.make"]
  }
}

The benefit of this structure, is that as long as the Plugin interfaces only through the API, they would be limited to the permissions designated.

shmolf commented 4 years ago

Correction, the permissions shouldn't point to a specific Specific Boostnote Module/Lib. They should only point to API functions. The Specific Boostnote Module/Lib should not be directly accessible by the plugins.

RonWalker22 commented 4 years ago

@ZeroX-DG

Sorry I'm late to the party.....

The "Central API", as mentioned in #48, is key. All the core features should be plugins based off the Central API. That's how VS Code does it:

almost every part of VS Code can be customized and enhanced through the Extension API. In fact, many core features of VS Code are built as extensions and use the same Extension API .

source: https://code.visualstudio.com/api

Rokt33r commented 4 years ago

@RonWalker22 Thanks for the information. I guess I should try to make some VSCode plugin and figure out how how should we present DX.