Skip to content
This repository has been archived by the owner on Oct 9, 2024. It is now read-only.

Create NPM Module #1

Closed
0x4007 opened this issue Feb 15, 2024 · 14 comments · Fixed by #2
Closed

Create NPM Module #1

0x4007 opened this issue Feb 15, 2024 · 14 comments · Fixed by #2

Comments

@0x4007
Copy link
Member

0x4007 commented Feb 15, 2024

Plugin developers need to import the configuration to modify the output of their plugins. We should make this as simple as possible with an NPM module. This module should abstract away the following:

  1. fetching the repository configuration
  2. fetching the organization configuration
  3. merging to a single configuration
  4. config validation

Pseudo code (I didn't deeply think through this):

import { getConfig } from "@ubiquibot/configuration";
const config = await getConfig(context);

I meant that the configuration could be it's own repository that we distribute as an npm package. This way any project that needs the configuration can just add something like "@ubiquibot/configuration" in the npm packages of the project, this way you get access to the configuration easily, with the parsing / generation methods as well.

Original post: ubiquity/pay.ubq.fi#135 (comment)

That's a great idea. I do envision a developer SDK for our plugins which absolutely should make configuration imports simple (as they seem to need to be handled by the plugin itself.)

@gentlementlegen
Copy link
Member

@pavlovcik would like to work on it, but shouldn't you merge back your Ubiquibot fork?

@0x4007
Copy link
Member Author

0x4007 commented Feb 16, 2024

I have a few things on my plate now so you may be better off just working on my fork lol

@gentlementlegen
Copy link
Member

/start

Copy link

ubiquibot bot commented Feb 17, 2024

DeadlineSun, Feb 18, 5:02 AM UTC
Registered Wallet 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

@FernandVEYRIER please refer to the kernel code when designing this.

For context: the kernel is still in a very young development stage. Just to get started we are including some simple GitHub webhook event handlers inside of the kernel. However the plan is to move all of these event handlers into seperate plugins (loaded in from separate codebases)

https://github.com/ubiquity/ubiquibot-kernel/blob/development/src/github/handlers/issue-comment/created.ts

And here is how it is currently mounted:

https://github.com/ubiquity/ubiquibot-kernel/blob/development/src/github/handlers/index.ts


I was doing some research around this earlier in the week, and when I loaded the configuration, I would need to do that right after the plugin module's entry (like within the first line of code inside of the function body i.e. here.)

There is a lot of noise in my example because I would not have pushed it under normal circumstances but I wanted to share my insights.

https://github.com/ubiquity/ubiquibot-kernel/blob/f0be88d83d04d50918ca4acfa38814227ffdb73a/src/github/handlers/issue-comment/created.ts#L9

@gentlementlegen
Copy link
Member

@pavlovcik Okay thanks for the info. Shouldn't I just focus for now on separating the configuration from the code to make it a standalone easy to integrate in any other project?

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

Yes I just wanted to provide context so you know how it is likely to be implemented.

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

Now you probably have a better idea of why I want to make a local office. Fast iteration across multiple interconnected systems may be easier in the same room with a whiteboard occasionally.

@gentlementlegen
Copy link
Member

I noticed that you have already a repository for NPM packages, currently used for the Ubiquibot logs
https://github.com/ubiquity/ubiquibot-logger
We can use the same process for the configuration.

I think what is needed would be a file representing all the services and the communication with each module of the whole project

@0x4007
Copy link
Member Author

0x4007 commented Feb 17, 2024

I think what is needed would be a file representing all the services and the communication with each module of the whole project

It's a good idea although I fear that depending on the level of detail it can become deprecated quite fast. I'll see if I can get some help from ChatGPT.

Copy link

ubiquibot bot commented Feb 19, 2024

+ Evaluating results. Please wait...

@0x4007
Copy link
Member Author

0x4007 commented Feb 19, 2024

+ Evaluating results. Please wait...

Looks like the private key is wrong on this org. We need to fix this from the code to take the private key from the runtime secrets (netlify) but let me try and make a quick fix here.

@0x4007 0x4007 reopened this Feb 19, 2024
@0x4007 0x4007 closed this as completed Feb 19, 2024
Copy link

ubiquibot bot commented Feb 19, 2024

+ Evaluating results. Please wait...

Copy link

ubiquibot bot commented Feb 19, 2024

[ 98 WXDAI ]

@pavlovcik
Contributions Overview
ViewContributionCountReward
IssueSpecification121
IssueComment667.4
ReviewComment29.6
Conversation Incentives
CommentFormattingRelevanceReward
Plugin developers need to import the configuration to modify the...
21
li:
  count: 4
  score: "4"
  words: 15
code:
  count: 1
  score: "1"
  words: 0
121
I have a few things on my plate now so you may be better off jus...
4.20.334.2
@FernandVEYRIER please refer to the kernel code when designing t...
38.2
a:
  count: 1
  score: "1"
  words: 1
hr:
  count: 1
  score: "1"
  words: 0
0.6838.2
Yes I just wanted to provide context so you know how it is likel...
3.40.5353.4
Now you probably have a better idea of why I want to make a loca...
6.60.536.6
> I think what is needed would be a file representing all the se...
6.40.36.4
> ```diff > + Evaluating results. Please wait... > ```

Look...

8.6

code:
  count: 1
  score: "1"
  words: 0
0.258.6
> A key should be needed to publish the package to NPM.

I don...

3.60.353.6
Hey writing a test case would be appreciated to show that it wor...
60.596

[ 212.9 WXDAI ]

@FernandVEYRIER
Contributions Overview
ViewContributionCountReward
IssueTask1.00200
IssueComment30
ReviewComment212.9
Conversation Incentives
CommentFormattingRelevanceReward
@pavlovcik would like to work on it, but shouldn't you merge bac...
-0.43-
@pavlovcik Okay thanks for the info. Shouldn't I just focus for ...
-0.65-
I noticed that you have already a repository for NPM packages, c...
-0.48-
A key should be needed to publish the package to NPM.

The way...

7.9

code:
  count: 1
  score: "1"
  words: 1
0.67.9
@pavlovcik Renamed all to use `@ubiquibot` scoped name. I will n...
5
code:
  count: 2
  score: "2"
  words: 2
0.725

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants