Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extendable plugins with developer ecosystem #414

Closed
matthewwong525 opened this issue Oct 31, 2022 · 3 comments · Fixed by #622
Closed

extendable plugins with developer ecosystem #414

matthewwong525 opened this issue Oct 31, 2022 · 3 comments · Fixed by #622

Comments

@matthewwong525
Copy link
Collaborator

matthewwong525 commented Oct 31, 2022

User workflow:

  1. in user settings, the user selects from a list of plugins, enables it then configures the settings. (e.g. twitter api key, +enable switch)
  2. user will type a command (e.g. /twitter) with auto complete.
  3. When they select the autocomplete option, it will run a function (e.g. function sends a note to Twitter to make a post on their behalf)
  4. the /url text will be deleted automatically when function successfully runs. If it fails, it'll stay there and a popup will say that command failed. Only if they select the autocomplete option will it trigger.

Developer workflow:

  1. Developer writes a javascript file with a function with parameters to be passed in (e.g. url). main.ts
exports.function = (body) => {
  // code goes here. (body.params.url, body.params.method is accessible)
}
  1. The file also contains an object called request_body which defines the parameters to pass in. these will be. maybe something like this? :
// will tell the settings page what type of inputs to give
exports.settings = {
  "url": {
     "title": "URL",
     "description": "A url that the command calls (e.g. https://www.google.com)",
     "type": "string"
  },
  "method": {
    "title": "Method",
    "description": "Type of request to make (e.g. GET, POST)",
    "type": "string"
  }
  1. Once they want to release the app, they will update a JSON file, maybe release.json and make a PR to the sample repo. json might look something like:
[
...
  {
    "id": "A unique ID for your plugin."
    "name": "a unique name for your theme. Must not collide with other themes.",
    "author": "the author's name for display.",
    "description": "A short description of what your plugin does.",
    "repo": "the GitHub repository identifier, in the form of user-name/repo-name, if your GitHub repo is located at https://github.com/user-name/repo-name."
  }
]
  1. they will also make a Github "release" of the app

So there will be 3 files in the sample repo: main.ts, releases.json, README.md

Integration guideline

my ideas on how to integrate this. please provide your suggestions as well.

  1. Figure out if [flutter_js](https://medium.com/@mustafatahirhussein/javascript-with-flutter-is-it-possible-c6ed53704c1b)is a viable option to make a request (on all platforms) and get it to work. Create a plugin.dart file / class under lib/services. This class will have functions to convert a string javascript file to an actual flutter function that is callable (maybe store it for access later?).
  2. Once you confirmed that the function works. create a sample repo with the files specified under "Developer Workflow". Then, create a github action that calls a supabase-function. This supabase-function will grab the releases.json from the repo and perform an upsert to a new table called plugins with all the data specified in releases.json.
  3. document the steps
  4. Create a plugins page that will pull from plugins table and allow the user to add plugins into their application in the flutter app. Once the plugins are enabled, store the information on the enabled plugins locally. Also when they are enabled, it will pull the "latest" github release main.ts file and parse it using plugin.dart class created in step 1.
  5. The settings will be generated from the exports.settings object parsed from the plugin.dart class. also, there'll be an alias command so that they can change it from /url to /whatevertheywant.
  6. Create a plugin that sends a GET request to a specified URL
  7. Document process on how to create a plugin, also say this is in alpha phase and may change at any time without warning.

considerations

  • if flutter_js doesn't work consider using edge functions and database webhooks. (but preferably want to do it on client side)
  • We may want to have local interaction in the future.
  • Users can import multiples of the same plugin.
@matthewwong525 matthewwong525 changed the title Functional tags with developer ecosystem Functional commands with developer ecosystem Nov 1, 2022
@ethan-liong
Copy link
Contributor

Are plugins already implemented?

@matthewwong525 matthewwong525 changed the title Functional commands with developer ecosystem extendable plugins with developer ecosystem Mar 11, 2023
@matthewwong525
Copy link
Collaborator Author

fleetingnotes/fleeting-notes-plugins#1 will be completed with this so it can have immediate value!

@matthewwong525
Copy link
Collaborator Author

matthewwong525 commented May 15, 2023

Let's make it a lot easier:

  • user inputs (add in settings): unique function name, required metadata, & name command alias (1 hour). Also, can add multiple of the same commands
  • slash commands that get mapped to the functions setup in the settings (2 hour)
  • Create a function to call plugin (with following info : note, current selection, command id run) (1 hour)
  • Handle return note and updating current note! (1 hour)
  • If status is not 200, then show a dialog informing the user that the command has failed (also show return message in JSON) (1 hour)
  • Create a deno function that uses Open AI to do above (1 hour)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants