ubiquity-os / ubiquity-os-kernel

1 stars 13 forks source link

feat: help command manifest #71

Closed gentlementlegen closed 2 months ago

gentlementlegen commented 2 months ago

Resolves #58

gentlementlegen commented 2 months ago

What's new

The command description and example is now taken from a manifest.json file from the plugin itself. When it comes to Github action, it is directly read from the repo; for Workers, directly retrieved from their url appending /manifest.json. Commands are sorted alphabetically for convenience.

QA run

https://github.com/Meniole/ubiquibot-kernel/issues/1#issuecomment-2219502284

About the unit tests

bun is broken with msw before release 1.1.9, as described in this blog post due to the node implementation of bun being incomplete. This breaks the tests, because routes are not being mocked. I succeded to make it run locally by manually linking node libs on top of bun, which seems silly to do. 1.1.9 is not released yet, latest bun is still 1.1.18. We can either:

whilefoo commented 2 months ago

bun is broken with msw before release 1.1.9

I think it's not a good idea to run tests with different runtime than running the bot. Anyway as part of #64 I had to switch to node/jest because crypto is not compatible by Bun

gentlementlegen commented 2 months ago

@whilefoo Are you still using bun for the runtime then or did you remove it? It seems that you are still using it in your PR so we would indeed be using 2 different runtimes. I will add jest here as well.

whilefoo commented 2 months ago

@whilefoo Are you still using bun for the runtime then or did you remove it?

It's only being used as a package manager

gentlementlegen commented 2 months ago

@whilefoo I fixed all the tests within https://github.com/ubiquity/ubiquibot-kernel/pull/74

rndquu commented 2 months ago

@gentlementlegen Could you update readme with an example for manifest.json and 2 use cases where it must be stored (root server folder for worker and root github repository folder for "github action" plugins)?

gentlementlegen commented 2 months ago

@gentlementlegen Could you update readme with an example for manifest.json and 2 use cases where it must be stored (root server folder for worker and root github repository folder for "github action" plugins)?

I will add an example. I also added boilerplate code within the plugin-template. Its location is the same within the repo regardless of the plugin being a Worker or a Github action. The difference is that for a worker the file must be served, see this code.

rndquu commented 2 months ago

@gentlementlegen Could you update readme with an example for manifest.json and 2 use cases where it must be stored (root server folder for worker and root github repository folder for "github action" plugins)?

I will add an example. I also added boilerplate code within the plugin-template. Its location is the same within the repo regardless of the plugin being a Worker or a Github action. The difference is that for a worker the file must be served, see this code.

Oh, the example exists here so I think updating the kernel's readme with manifest example is not really necessary