@ubiquity-os/plugin-sdk 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/constants.cjs +58 -0
- package/dist/constants.d.cts +9 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.js +26 -0
- package/dist/{index.mjs → index.cjs} +112 -80
- package/dist/index.d.cts +57 -0
- package/dist/index.d.ts +4 -23
- package/dist/index.js +73 -125
- package/dist/manifest.cjs +47 -0
- package/dist/{index.d.mts → manifest.d.cts} +7 -62
- package/dist/manifest.d.ts +21 -0
- package/dist/manifest.js +20 -0
- package/dist/signature.cjs +81 -0
- package/dist/signature.d.cts +12 -0
- package/dist/signature.d.ts +12 -0
- package/dist/signature.js +55 -0
- package/package.json +42 -8
package/dist/index.js
CHANGED
|
@@ -1,54 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/index.ts
|
|
31
|
-
var src_exports = {};
|
|
32
|
-
__export(src_exports, {
|
|
33
|
-
BOT_USER_ID: () => BOT_USER_ID,
|
|
34
|
-
CONFIG_FULL_PATH: () => CONFIG_FULL_PATH,
|
|
35
|
-
CONFIG_ORG_REPO: () => CONFIG_ORG_REPO,
|
|
36
|
-
DEV_CONFIG_FULL_PATH: () => DEV_CONFIG_FULL_PATH,
|
|
37
|
-
KERNEL_APP_ID: () => KERNEL_APP_ID,
|
|
38
|
-
KERNEL_PUBLIC_KEY: () => KERNEL_PUBLIC_KEY,
|
|
39
|
-
createActionsPlugin: () => createActionsPlugin,
|
|
40
|
-
createPlugin: () => createPlugin,
|
|
41
|
-
postComment: () => postComment
|
|
42
|
-
});
|
|
43
|
-
module.exports = __toCommonJS(src_exports);
|
|
44
|
-
|
|
45
1
|
// src/server.ts
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
2
|
+
import { Type as T } from "@sinclair/typebox";
|
|
3
|
+
import { Value } from "@sinclair/typebox/value";
|
|
4
|
+
import { LOG_LEVEL, LogReturn, Logs } from "@ubiquity-os/ubiquity-os-logger";
|
|
5
|
+
import { Hono } from "hono";
|
|
6
|
+
import { env as honoEnv } from "hono/adapter";
|
|
7
|
+
import { HTTPException } from "hono/http-exception";
|
|
52
8
|
|
|
53
9
|
// src/util.ts
|
|
54
10
|
function sanitizeMetadata(obj) {
|
|
@@ -91,11 +47,6 @@ ${metadataSerialized}
|
|
|
91
47
|
`;
|
|
92
48
|
}
|
|
93
49
|
|
|
94
|
-
// src/types/config.ts
|
|
95
|
-
var CONFIG_FULL_PATH = ".github/.ubiquity-os.config.yml";
|
|
96
|
-
var DEV_CONFIG_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
|
|
97
|
-
var CONFIG_ORG_REPO = ".ubiquity-os";
|
|
98
|
-
|
|
99
50
|
// src/constants.ts
|
|
100
51
|
var KERNEL_PUBLIC_KEY = `-----BEGIN PUBLIC KEY-----
|
|
101
52
|
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3
|
|
@@ -107,16 +58,14 @@ Plnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq
|
|
|
107
58
|
JQIDAQAB
|
|
108
59
|
-----END PUBLIC KEY-----
|
|
109
60
|
`;
|
|
110
|
-
var KERNEL_APP_ID = 975031;
|
|
111
|
-
var BOT_USER_ID = 178941584;
|
|
112
61
|
|
|
113
62
|
// src/octokit.ts
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
63
|
+
import { Octokit } from "@octokit/core";
|
|
64
|
+
import { paginateRest } from "@octokit/plugin-paginate-rest";
|
|
65
|
+
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
|
|
66
|
+
import { retry } from "@octokit/plugin-retry";
|
|
67
|
+
import { throttling } from "@octokit/plugin-throttling";
|
|
68
|
+
import { paginateGraphQL } from "@octokit/plugin-paginate-graphql";
|
|
120
69
|
var defaultOptions = {
|
|
121
70
|
throttle: {
|
|
122
71
|
onAbuseLimit: (retryAfter, options, octokit) => {
|
|
@@ -133,7 +82,7 @@ var defaultOptions = {
|
|
|
133
82
|
}
|
|
134
83
|
}
|
|
135
84
|
};
|
|
136
|
-
var customOctokit =
|
|
85
|
+
var customOctokit = Octokit.plugin(throttling, retry, paginateRest, restEndpointMethods, paginateGraphQL).defaults((instanceOptions) => {
|
|
137
86
|
return { ...defaultOptions, ...instanceOptions };
|
|
138
87
|
});
|
|
139
88
|
|
|
@@ -170,60 +119,66 @@ async function verifySignature(publicKeyPem, inputs, signature) {
|
|
|
170
119
|
}
|
|
171
120
|
|
|
172
121
|
// src/server.ts
|
|
173
|
-
var inputSchema =
|
|
174
|
-
stateId:
|
|
175
|
-
eventName:
|
|
176
|
-
eventPayload:
|
|
177
|
-
authToken:
|
|
178
|
-
settings:
|
|
179
|
-
ref:
|
|
180
|
-
signature:
|
|
122
|
+
var inputSchema = T.Object({
|
|
123
|
+
stateId: T.String(),
|
|
124
|
+
eventName: T.String(),
|
|
125
|
+
eventPayload: T.Record(T.String(), T.Any()),
|
|
126
|
+
authToken: T.String(),
|
|
127
|
+
settings: T.Record(T.String(), T.Any()),
|
|
128
|
+
ref: T.String(),
|
|
129
|
+
signature: T.String(),
|
|
130
|
+
bypassSignatureVerification: T.Optional(
|
|
131
|
+
T.Boolean({
|
|
132
|
+
default: false,
|
|
133
|
+
description: "Bypass signature verification (caution: only use this if you know what you're doing)"
|
|
134
|
+
})
|
|
135
|
+
)
|
|
181
136
|
});
|
|
182
137
|
function createPlugin(handler, manifest, options) {
|
|
183
138
|
const pluginOptions = {
|
|
184
|
-
kernelPublicKey: options?.kernelPublicKey
|
|
185
|
-
logLevel: options?.logLevel
|
|
186
|
-
postCommentOnError: options?.postCommentOnError
|
|
139
|
+
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY,
|
|
140
|
+
logLevel: options?.logLevel ?? LOG_LEVEL.INFO,
|
|
141
|
+
postCommentOnError: options?.postCommentOnError ?? true,
|
|
187
142
|
settingsSchema: options?.settingsSchema,
|
|
188
143
|
envSchema: options?.envSchema
|
|
189
144
|
};
|
|
190
|
-
const app = new
|
|
145
|
+
const app = new Hono();
|
|
191
146
|
app.get("/manifest.json", (ctx) => {
|
|
192
147
|
return ctx.json(manifest);
|
|
193
148
|
});
|
|
194
149
|
app.post("/", async (ctx) => {
|
|
195
150
|
if (ctx.req.header("content-type") !== "application/json") {
|
|
196
|
-
throw new
|
|
151
|
+
throw new HTTPException(400, { message: "Content-Type must be application/json" });
|
|
197
152
|
}
|
|
198
153
|
const body = await ctx.req.json();
|
|
199
|
-
const inputSchemaErrors = [...
|
|
154
|
+
const inputSchemaErrors = [...Value.Errors(inputSchema, body)];
|
|
200
155
|
if (inputSchemaErrors.length) {
|
|
201
156
|
console.dir(inputSchemaErrors, { depth: null });
|
|
202
|
-
throw new
|
|
157
|
+
throw new HTTPException(400, { message: "Invalid body" });
|
|
203
158
|
}
|
|
204
|
-
const inputs =
|
|
159
|
+
const inputs = Value.Decode(inputSchema, body);
|
|
205
160
|
const signature = inputs.signature;
|
|
206
|
-
if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
|
|
207
|
-
throw new
|
|
161
|
+
if (!options?.bypassSignatureVerification && !await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
|
|
162
|
+
throw new HTTPException(400, { message: "Invalid signature" });
|
|
208
163
|
}
|
|
209
164
|
let config2;
|
|
210
165
|
if (pluginOptions.settingsSchema) {
|
|
211
166
|
try {
|
|
212
|
-
config2 =
|
|
167
|
+
config2 = Value.Decode(pluginOptions.settingsSchema, Value.Default(pluginOptions.settingsSchema, inputs.settings));
|
|
213
168
|
} catch (e) {
|
|
214
|
-
console.dir(...
|
|
169
|
+
console.dir(...Value.Errors(pluginOptions.settingsSchema, inputs.settings), { depth: null });
|
|
215
170
|
throw e;
|
|
216
171
|
}
|
|
217
172
|
} else {
|
|
218
173
|
config2 = inputs.settings;
|
|
219
174
|
}
|
|
220
175
|
let env;
|
|
221
|
-
const honoEnvironment = (
|
|
176
|
+
const honoEnvironment = honoEnv(ctx);
|
|
222
177
|
if (pluginOptions.envSchema) {
|
|
223
178
|
try {
|
|
224
|
-
env =
|
|
179
|
+
env = Value.Decode(pluginOptions.envSchema, Value.Default(pluginOptions.envSchema, honoEnvironment));
|
|
225
180
|
} catch (e) {
|
|
226
|
-
console.dir(...
|
|
181
|
+
console.dir(...Value.Errors(pluginOptions.envSchema, honoEnvironment), { depth: null });
|
|
227
182
|
throw e;
|
|
228
183
|
}
|
|
229
184
|
} else {
|
|
@@ -235,7 +190,7 @@ function createPlugin(handler, manifest, options) {
|
|
|
235
190
|
octokit: new customOctokit({ auth: inputs.authToken }),
|
|
236
191
|
config: config2,
|
|
237
192
|
env,
|
|
238
|
-
logger: new
|
|
193
|
+
logger: new Logs(pluginOptions.logLevel)
|
|
239
194
|
};
|
|
240
195
|
try {
|
|
241
196
|
const result = await handler(context2);
|
|
@@ -245,7 +200,7 @@ function createPlugin(handler, manifest, options) {
|
|
|
245
200
|
let loggerError;
|
|
246
201
|
if (error instanceof Error) {
|
|
247
202
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
248
|
-
} else if (error instanceof
|
|
203
|
+
} else if (error instanceof LogReturn) {
|
|
249
204
|
loggerError = error;
|
|
250
205
|
} else {
|
|
251
206
|
loggerError = context2.logger.error(`Error: ${error}`);
|
|
@@ -253,36 +208,36 @@ function createPlugin(handler, manifest, options) {
|
|
|
253
208
|
if (pluginOptions.postCommentOnError && loggerError) {
|
|
254
209
|
await postComment(context2, loggerError);
|
|
255
210
|
}
|
|
256
|
-
throw new
|
|
211
|
+
throw new HTTPException(500, { message: "Unexpected error" });
|
|
257
212
|
}
|
|
258
213
|
});
|
|
259
214
|
return app;
|
|
260
215
|
}
|
|
261
216
|
|
|
262
217
|
// src/actions.ts
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
var inputSchema2 =
|
|
271
|
-
stateId:
|
|
272
|
-
eventName:
|
|
273
|
-
eventPayload:
|
|
274
|
-
authToken:
|
|
275
|
-
settings:
|
|
276
|
-
ref:
|
|
277
|
-
signature:
|
|
218
|
+
import * as core from "@actions/core";
|
|
219
|
+
import * as github from "@actions/github";
|
|
220
|
+
import { Type as T2 } from "@sinclair/typebox";
|
|
221
|
+
import { Value as Value2 } from "@sinclair/typebox/value";
|
|
222
|
+
import { LOG_LEVEL as LOG_LEVEL2, LogReturn as LogReturn2, Logs as Logs2 } from "@ubiquity-os/ubiquity-os-logger";
|
|
223
|
+
import { config } from "dotenv";
|
|
224
|
+
config();
|
|
225
|
+
var inputSchema2 = T2.Object({
|
|
226
|
+
stateId: T2.String(),
|
|
227
|
+
eventName: T2.String(),
|
|
228
|
+
eventPayload: T2.String(),
|
|
229
|
+
authToken: T2.String(),
|
|
230
|
+
settings: T2.String(),
|
|
231
|
+
ref: T2.String(),
|
|
232
|
+
signature: T2.String()
|
|
278
233
|
});
|
|
279
234
|
async function createActionsPlugin(handler, options) {
|
|
280
235
|
const pluginOptions = {
|
|
281
|
-
logLevel: options?.logLevel
|
|
282
|
-
postCommentOnError: options?.postCommentOnError
|
|
236
|
+
logLevel: options?.logLevel ?? LOG_LEVEL2.INFO,
|
|
237
|
+
postCommentOnError: options?.postCommentOnError ?? true,
|
|
283
238
|
settingsSchema: options?.settingsSchema,
|
|
284
239
|
envSchema: options?.envSchema,
|
|
285
|
-
kernelPublicKey: options?.kernelPublicKey
|
|
240
|
+
kernelPublicKey: options?.kernelPublicKey ?? KERNEL_PUBLIC_KEY
|
|
286
241
|
};
|
|
287
242
|
const pluginGithubToken = process.env.PLUGIN_GITHUB_TOKEN;
|
|
288
243
|
if (!pluginGithubToken) {
|
|
@@ -290,13 +245,13 @@ async function createActionsPlugin(handler, options) {
|
|
|
290
245
|
return;
|
|
291
246
|
}
|
|
292
247
|
const inputPayload = github.context.payload.inputs;
|
|
293
|
-
const inputSchemaErrors = [...
|
|
248
|
+
const inputSchemaErrors = [...Value2.Errors(inputSchema2, inputPayload)];
|
|
294
249
|
if (inputSchemaErrors.length) {
|
|
295
250
|
console.dir(inputSchemaErrors, { depth: null });
|
|
296
251
|
core.setFailed(`Error: Invalid inputs payload: ${inputSchemaErrors.join(",")}`);
|
|
297
252
|
return;
|
|
298
253
|
}
|
|
299
|
-
const inputs =
|
|
254
|
+
const inputs = Value2.Decode(inputSchema2, inputPayload);
|
|
300
255
|
const signature = inputs.signature;
|
|
301
256
|
if (!await verifySignature(pluginOptions.kernelPublicKey, inputs, signature)) {
|
|
302
257
|
core.setFailed(`Error: Invalid signature`);
|
|
@@ -305,9 +260,9 @@ async function createActionsPlugin(handler, options) {
|
|
|
305
260
|
let config2;
|
|
306
261
|
if (pluginOptions.settingsSchema) {
|
|
307
262
|
try {
|
|
308
|
-
config2 =
|
|
263
|
+
config2 = Value2.Decode(pluginOptions.settingsSchema, Value2.Default(pluginOptions.settingsSchema, JSON.parse(inputs.settings)));
|
|
309
264
|
} catch (e) {
|
|
310
|
-
console.dir(...
|
|
265
|
+
console.dir(...Value2.Errors(pluginOptions.settingsSchema, JSON.parse(inputs.settings)), { depth: null });
|
|
311
266
|
throw e;
|
|
312
267
|
}
|
|
313
268
|
} else {
|
|
@@ -316,9 +271,9 @@ async function createActionsPlugin(handler, options) {
|
|
|
316
271
|
let env;
|
|
317
272
|
if (pluginOptions.envSchema) {
|
|
318
273
|
try {
|
|
319
|
-
env =
|
|
274
|
+
env = Value2.Decode(pluginOptions.envSchema, Value2.Default(pluginOptions.envSchema, process.env));
|
|
320
275
|
} catch (e) {
|
|
321
|
-
console.dir(...
|
|
276
|
+
console.dir(...Value2.Errors(pluginOptions.envSchema, process.env), { depth: null });
|
|
322
277
|
throw e;
|
|
323
278
|
}
|
|
324
279
|
} else {
|
|
@@ -330,7 +285,7 @@ async function createActionsPlugin(handler, options) {
|
|
|
330
285
|
octokit: new customOctokit({ auth: inputs.authToken }),
|
|
331
286
|
config: config2,
|
|
332
287
|
env,
|
|
333
|
-
logger: new
|
|
288
|
+
logger: new Logs2(pluginOptions.logLevel)
|
|
334
289
|
};
|
|
335
290
|
try {
|
|
336
291
|
const result = await handler(context2);
|
|
@@ -342,7 +297,7 @@ async function createActionsPlugin(handler, options) {
|
|
|
342
297
|
if (error instanceof Error) {
|
|
343
298
|
core.setFailed(error);
|
|
344
299
|
loggerError = context2.logger.error(`Error: ${error}`, { error });
|
|
345
|
-
} else if (error instanceof
|
|
300
|
+
} else if (error instanceof LogReturn2) {
|
|
346
301
|
core.setFailed(error.logMessage.raw);
|
|
347
302
|
loggerError = error;
|
|
348
303
|
} else {
|
|
@@ -385,15 +340,8 @@ async function returnDataToKernel(repoToken, stateId, output) {
|
|
|
385
340
|
}
|
|
386
341
|
});
|
|
387
342
|
}
|
|
388
|
-
|
|
389
|
-
0 && (module.exports = {
|
|
390
|
-
BOT_USER_ID,
|
|
391
|
-
CONFIG_FULL_PATH,
|
|
392
|
-
CONFIG_ORG_REPO,
|
|
393
|
-
DEV_CONFIG_FULL_PATH,
|
|
394
|
-
KERNEL_APP_ID,
|
|
395
|
-
KERNEL_PUBLIC_KEY,
|
|
343
|
+
export {
|
|
396
344
|
createActionsPlugin,
|
|
397
345
|
createPlugin,
|
|
398
346
|
postComment
|
|
399
|
-
}
|
|
347
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/types/manifest.ts
|
|
21
|
+
var manifest_exports = {};
|
|
22
|
+
__export(manifest_exports, {
|
|
23
|
+
commandSchema: () => commandSchema,
|
|
24
|
+
manifestSchema: () => manifestSchema,
|
|
25
|
+
runEvent: () => runEvent
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(manifest_exports);
|
|
28
|
+
var import_typebox = require("@sinclair/typebox");
|
|
29
|
+
var import_webhooks = require("@octokit/webhooks");
|
|
30
|
+
var runEvent = import_typebox.Type.Union(import_webhooks.emitterEventNames.map((o) => import_typebox.Type.Literal(o)));
|
|
31
|
+
var commandSchema = import_typebox.Type.Object({
|
|
32
|
+
description: import_typebox.Type.String({ minLength: 1 }),
|
|
33
|
+
"ubiquity:example": import_typebox.Type.String({ minLength: 1 })
|
|
34
|
+
});
|
|
35
|
+
var manifestSchema = import_typebox.Type.Object({
|
|
36
|
+
name: import_typebox.Type.String({ minLength: 1 }),
|
|
37
|
+
description: import_typebox.Type.Optional(import_typebox.Type.String({ default: "" })),
|
|
38
|
+
commands: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), commandSchema, { default: {} })),
|
|
39
|
+
"ubiquity:listeners": import_typebox.Type.Optional(import_typebox.Type.Array(runEvent, { default: [] })),
|
|
40
|
+
configuration: import_typebox.Type.Optional(import_typebox.Type.Record(import_typebox.Type.String(), import_typebox.Type.Any(), { default: {} }))
|
|
41
|
+
});
|
|
42
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
43
|
+
0 && (module.exports = {
|
|
44
|
+
commandSchema,
|
|
45
|
+
manifestSchema,
|
|
46
|
+
runEvent
|
|
47
|
+
});
|
|
@@ -1,35 +1,11 @@
|
|
|
1
|
-
import * as hono_types from 'hono/types';
|
|
2
|
-
import { EmitterWebhookEventName, EmitterWebhookEvent } from '@octokit/webhooks';
|
|
3
1
|
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
4
|
-
import { Static
|
|
5
|
-
import { Logs, LogLevel, LogReturn } from '@ubiquity-os/ubiquity-os-logger';
|
|
6
|
-
import { Hono } from 'hono';
|
|
7
|
-
import * as _octokit_core_dist_types_types from '@octokit/core/dist-types/types';
|
|
8
|
-
import * as _octokit_plugin_paginate_graphql from '@octokit/plugin-paginate-graphql';
|
|
9
|
-
import * as _octokit_plugin_rest_endpoint_methods from '@octokit/plugin-rest-endpoint-methods';
|
|
10
|
-
import * as _octokit_plugin_paginate_rest from '@octokit/plugin-paginate-rest';
|
|
11
|
-
import * as _octokit_request_error from '@octokit/request-error';
|
|
12
|
-
import { Octokit } from '@octokit/core';
|
|
13
|
-
|
|
14
|
-
declare const customOctokit: typeof Octokit & _octokit_core_dist_types_types.Constructor<{
|
|
15
|
-
retry: {
|
|
16
|
-
retryRequest: (error: _octokit_request_error.RequestError, retries: number, retryAfter: number) => _octokit_request_error.RequestError;
|
|
17
|
-
};
|
|
18
|
-
} & {
|
|
19
|
-
paginate: _octokit_plugin_paginate_rest.PaginateInterface;
|
|
20
|
-
} & _octokit_plugin_rest_endpoint_methods.Api & _octokit_plugin_paginate_graphql.paginateGraphQLInterface>;
|
|
21
|
-
|
|
22
|
-
interface Context<TConfig = unknown, TEnv = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName> {
|
|
23
|
-
eventName: TSupportedEvents;
|
|
24
|
-
payload: {
|
|
25
|
-
[K in TSupportedEvents]: K extends EmitterWebhookEventName ? EmitterWebhookEvent<K> : never;
|
|
26
|
-
}[TSupportedEvents]["payload"];
|
|
27
|
-
octokit: InstanceType<typeof customOctokit>;
|
|
28
|
-
config: TConfig;
|
|
29
|
-
env: TEnv;
|
|
30
|
-
logger: Logs;
|
|
31
|
-
}
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
32
3
|
|
|
4
|
+
declare const runEvent: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"branch_protection_configuration" | "branch_protection_configuration.disabled" | "branch_protection_configuration.enabled" | "branch_protection_rule" | "branch_protection_rule.created" | "branch_protection_rule.deleted" | "branch_protection_rule.edited" | "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested" | "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested" | "code_scanning_alert" | "code_scanning_alert.appeared_in_branch" | "code_scanning_alert.closed_by_user" | "code_scanning_alert.created" | "code_scanning_alert.fixed" | "code_scanning_alert.reopened" | "code_scanning_alert.reopened_by_user" | "commit_comment" | "commit_comment.created" | "create" | "custom_property" | "custom_property.created" | "custom_property.deleted" | "custom_property.updated" | "custom_property_values" | "custom_property_values.updated" | "delete" | "dependabot_alert" | "dependabot_alert.auto_dismissed" | "dependabot_alert.auto_reopened" | "dependabot_alert.created" | "dependabot_alert.dismissed" | "dependabot_alert.fixed" | "dependabot_alert.reintroduced" | "dependabot_alert.reopened" | "deploy_key" | "deploy_key.created" | "deploy_key.deleted" | "deployment" | "deployment.created" | "deployment_protection_rule" | "deployment_protection_rule.requested" | "deployment_review" | "deployment_review.approved" | "deployment_review.rejected" | "deployment_review.requested" | "deployment_status" | "deployment_status.created" | "discussion" | "discussion.answered" | "discussion.category_changed" | "discussion.closed" | "discussion.created" | "discussion.deleted" | "discussion.edited" | "discussion.labeled" | "discussion.locked" | "discussion.pinned" | "discussion.reopened" | "discussion.transferred" | "discussion.unanswered" | "discussion.unlabeled" | "discussion.unlocked" | "discussion.unpinned" | "discussion_comment" | "discussion_comment.created" | "discussion_comment.deleted" | "discussion_comment.edited" | "fork" | "github_app_authorization" | "github_app_authorization.revoked" | "gollum" | "installation" | "installation.created" | "installation.deleted" | "installation.new_permissions_accepted" | "installation.suspend" | "installation.unsuspend" | "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed" | "installation_target" | "installation_target.renamed" | "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited" | "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.locked" | "issues.milestoned" | "issues.opened" | "issues.pinned" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled" | "issues.unlocked" | "issues.unpinned" | "label" | "label.created" | "label.deleted" | "label.edited" | "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased" | "member" | "member.added" | "member.edited" | "member.removed" | "membership" | "membership.added" | "membership.removed" | "merge_group" | "merge_group.checks_requested" | "merge_group.destroyed" | "meta" | "meta.deleted" | "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened" | "org_block" | "org_block.blocked" | "org_block.unblocked" | "organization" | "organization.deleted" | "organization.member_added" | "organization.member_invited" | "organization.member_removed" | "organization.renamed" | "package" | "package.published" | "package.updated" | "page_build" | "personal_access_token_request" | "personal_access_token_request.approved" | "personal_access_token_request.cancelled" | "personal_access_token_request.created" | "personal_access_token_request.denied" | "ping" | "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened" | "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved" | "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved" | "projects_v2" | "projects_v2.closed" | "projects_v2.created" | "projects_v2.deleted" | "projects_v2.edited" | "projects_v2.reopened" | "projects_v2_item" | "projects_v2_item.archived" | "projects_v2_item.converted" | "projects_v2_item.created" | "projects_v2_item.deleted" | "projects_v2_item.edited" | "projects_v2_item.reordered" | "projects_v2_item.restored" | "public" | "pull_request" | "pull_request.assigned" | "pull_request.auto_merge_disabled" | "pull_request.auto_merge_enabled" | "pull_request.closed" | "pull_request.converted_to_draft" | "pull_request.demilestoned" | "pull_request.dequeued" | "pull_request.edited" | "pull_request.enqueued" | "pull_request.labeled" | "pull_request.locked" | "pull_request.milestoned" | "pull_request.opened" | "pull_request.ready_for_review" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.synchronize" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.unlocked" | "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted" | "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited" | "pull_request_review_thread" | "pull_request_review_thread.resolved" | "pull_request_review_thread.unresolved" | "push" | "registry_package" | "registry_package.published" | "registry_package.updated" | "release" | "release.created" | "release.deleted" | "release.edited" | "release.prereleased" | "release.published" | "release.released" | "release.unpublished" | "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.edited" | "repository.privatized" | "repository.publicized" | "repository.renamed" | "repository.transferred" | "repository.unarchived" | "repository_advisory" | "repository_advisory.published" | "repository_advisory.reported" | "repository_dispatch" | "repository_dispatch.sample.collected" | "repository_import" | "repository_ruleset" | "repository_ruleset.created" | "repository_ruleset.deleted" | "repository_ruleset.edited" | "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.reopen" | "repository_vulnerability_alert.resolve" | "secret_scanning_alert" | "secret_scanning_alert.created" | "secret_scanning_alert.reopened" | "secret_scanning_alert.resolved" | "secret_scanning_alert.revoked" | "secret_scanning_alert.validated" | "secret_scanning_alert_location" | "secret_scanning_alert_location.created" | "security_advisory" | "security_advisory.published" | "security_advisory.updated" | "security_advisory.withdrawn" | "security_and_analysis" | "sponsorship" | "sponsorship.cancelled" | "sponsorship.created" | "sponsorship.edited" | "sponsorship.pending_cancellation" | "sponsorship.pending_tier_change" | "sponsorship.tier_changed" | "star" | "star.created" | "star.deleted" | "status" | "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository" | "team_add" | "watch" | "watch.started" | "workflow_dispatch" | "workflow_job" | "workflow_job.completed" | "workflow_job.in_progress" | "workflow_job.queued" | "workflow_job.waiting" | "workflow_run" | "workflow_run.completed" | "workflow_run.in_progress" | "workflow_run.requested">[]>;
|
|
5
|
+
declare const commandSchema: _sinclair_typebox.TObject<{
|
|
6
|
+
description: _sinclair_typebox.TString;
|
|
7
|
+
"ubiquity:example": _sinclair_typebox.TString;
|
|
8
|
+
}>;
|
|
33
9
|
declare const manifestSchema: _sinclair_typebox.TObject<{
|
|
34
10
|
name: _sinclair_typebox.TString;
|
|
35
11
|
description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
@@ -42,35 +18,4 @@ declare const manifestSchema: _sinclair_typebox.TObject<{
|
|
|
42
18
|
}>;
|
|
43
19
|
type Manifest = Static<typeof manifestSchema>;
|
|
44
20
|
|
|
45
|
-
|
|
46
|
-
kernelPublicKey?: string;
|
|
47
|
-
logLevel?: LogLevel;
|
|
48
|
-
postCommentOnError?: boolean;
|
|
49
|
-
settingsSchema?: TAnySchema;
|
|
50
|
-
envSchema?: TAnySchema;
|
|
51
|
-
}
|
|
52
|
-
declare function createPlugin<TConfig = unknown, TEnv = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TSupportedEvents>) => Promise<Record<string, unknown> | undefined>, manifest: Manifest, options?: Options$1): Hono<hono_types.BlankEnv, hono_types.BlankSchema, "/">;
|
|
53
|
-
|
|
54
|
-
interface Options {
|
|
55
|
-
logLevel?: LogLevel;
|
|
56
|
-
postCommentOnError?: boolean;
|
|
57
|
-
settingsSchema?: TAnySchema;
|
|
58
|
-
envSchema?: TAnySchema;
|
|
59
|
-
kernelPublicKey?: string;
|
|
60
|
-
}
|
|
61
|
-
declare function createActionsPlugin<TConfig = unknown, TEnv = unknown, TSupportedEvents extends EmitterWebhookEventName = EmitterWebhookEventName>(handler: (context: Context<TConfig, TEnv, TSupportedEvents>) => Promise<Record<string, unknown> | undefined>, options?: Options): Promise<void>;
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Posts a comment on a GitHub issue if the issue exists in the context payload, embedding structured metadata to it.
|
|
65
|
-
*/
|
|
66
|
-
declare function postComment(context: Context, message: LogReturn): Promise<void>;
|
|
67
|
-
|
|
68
|
-
declare const CONFIG_FULL_PATH = ".github/.ubiquity-os.config.yml";
|
|
69
|
-
declare const DEV_CONFIG_FULL_PATH = ".github/.ubiquity-os.config.dev.yml";
|
|
70
|
-
declare const CONFIG_ORG_REPO = ".ubiquity-os";
|
|
71
|
-
|
|
72
|
-
declare const KERNEL_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAs96DOU+JqM8SyNXOB6u3\nuBKIFiyrcST/LZTYN6y7LeJlyCuGPqSDrWCfjU9Ph5PLf9TWiNmeM8DGaOpwEFC7\nU3NRxOSglo4plnQ5zRwIHHXvxyK400sQP2oISXymISuBQWjEIqkC9DybQrKwNzf+\nI0JHWPqmwMIw26UvVOtXGOOWBqTkk+N2+/9f8eDIJP5QQVwwszc8s1rXOsLMlVIf\nwShw7GO4E2jyK8TSJKpyjV8eb1JJMDwFhPiRrtZfQJUtDf2mV/67shQww61BH2Y/\nPlnalo58kWIbkqZoq1yJrL5sFb73osM5+vADTXVn79bkvea7W19nSkdMiarYt4Hq\nJQIDAQAB\n-----END PUBLIC KEY-----\n";
|
|
73
|
-
declare const KERNEL_APP_ID = 975031;
|
|
74
|
-
declare const BOT_USER_ID = 178941584;
|
|
75
|
-
|
|
76
|
-
export { BOT_USER_ID, CONFIG_FULL_PATH, CONFIG_ORG_REPO, type Context, DEV_CONFIG_FULL_PATH, KERNEL_APP_ID, KERNEL_PUBLIC_KEY, type Manifest, createActionsPlugin, createPlugin, postComment };
|
|
21
|
+
export { type Manifest, commandSchema, manifestSchema, runEvent };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as _sinclair_typebox from '@sinclair/typebox';
|
|
2
|
+
import { Static } from '@sinclair/typebox';
|
|
3
|
+
|
|
4
|
+
declare const runEvent: _sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"branch_protection_configuration" | "branch_protection_configuration.disabled" | "branch_protection_configuration.enabled" | "branch_protection_rule" | "branch_protection_rule.created" | "branch_protection_rule.deleted" | "branch_protection_rule.edited" | "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested" | "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested" | "code_scanning_alert" | "code_scanning_alert.appeared_in_branch" | "code_scanning_alert.closed_by_user" | "code_scanning_alert.created" | "code_scanning_alert.fixed" | "code_scanning_alert.reopened" | "code_scanning_alert.reopened_by_user" | "commit_comment" | "commit_comment.created" | "create" | "custom_property" | "custom_property.created" | "custom_property.deleted" | "custom_property.updated" | "custom_property_values" | "custom_property_values.updated" | "delete" | "dependabot_alert" | "dependabot_alert.auto_dismissed" | "dependabot_alert.auto_reopened" | "dependabot_alert.created" | "dependabot_alert.dismissed" | "dependabot_alert.fixed" | "dependabot_alert.reintroduced" | "dependabot_alert.reopened" | "deploy_key" | "deploy_key.created" | "deploy_key.deleted" | "deployment" | "deployment.created" | "deployment_protection_rule" | "deployment_protection_rule.requested" | "deployment_review" | "deployment_review.approved" | "deployment_review.rejected" | "deployment_review.requested" | "deployment_status" | "deployment_status.created" | "discussion" | "discussion.answered" | "discussion.category_changed" | "discussion.closed" | "discussion.created" | "discussion.deleted" | "discussion.edited" | "discussion.labeled" | "discussion.locked" | "discussion.pinned" | "discussion.reopened" | "discussion.transferred" | "discussion.unanswered" | "discussion.unlabeled" | "discussion.unlocked" | "discussion.unpinned" | "discussion_comment" | "discussion_comment.created" | "discussion_comment.deleted" | "discussion_comment.edited" | "fork" | "github_app_authorization" | "github_app_authorization.revoked" | "gollum" | "installation" | "installation.created" | "installation.deleted" | "installation.new_permissions_accepted" | "installation.suspend" | "installation.unsuspend" | "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed" | "installation_target" | "installation_target.renamed" | "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited" | "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.locked" | "issues.milestoned" | "issues.opened" | "issues.pinned" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled" | "issues.unlocked" | "issues.unpinned" | "label" | "label.created" | "label.deleted" | "label.edited" | "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased" | "member" | "member.added" | "member.edited" | "member.removed" | "membership" | "membership.added" | "membership.removed" | "merge_group" | "merge_group.checks_requested" | "merge_group.destroyed" | "meta" | "meta.deleted" | "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened" | "org_block" | "org_block.blocked" | "org_block.unblocked" | "organization" | "organization.deleted" | "organization.member_added" | "organization.member_invited" | "organization.member_removed" | "organization.renamed" | "package" | "package.published" | "package.updated" | "page_build" | "personal_access_token_request" | "personal_access_token_request.approved" | "personal_access_token_request.cancelled" | "personal_access_token_request.created" | "personal_access_token_request.denied" | "ping" | "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened" | "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved" | "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved" | "projects_v2" | "projects_v2.closed" | "projects_v2.created" | "projects_v2.deleted" | "projects_v2.edited" | "projects_v2.reopened" | "projects_v2_item" | "projects_v2_item.archived" | "projects_v2_item.converted" | "projects_v2_item.created" | "projects_v2_item.deleted" | "projects_v2_item.edited" | "projects_v2_item.reordered" | "projects_v2_item.restored" | "public" | "pull_request" | "pull_request.assigned" | "pull_request.auto_merge_disabled" | "pull_request.auto_merge_enabled" | "pull_request.closed" | "pull_request.converted_to_draft" | "pull_request.demilestoned" | "pull_request.dequeued" | "pull_request.edited" | "pull_request.enqueued" | "pull_request.labeled" | "pull_request.locked" | "pull_request.milestoned" | "pull_request.opened" | "pull_request.ready_for_review" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.synchronize" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.unlocked" | "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted" | "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited" | "pull_request_review_thread" | "pull_request_review_thread.resolved" | "pull_request_review_thread.unresolved" | "push" | "registry_package" | "registry_package.published" | "registry_package.updated" | "release" | "release.created" | "release.deleted" | "release.edited" | "release.prereleased" | "release.published" | "release.released" | "release.unpublished" | "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.edited" | "repository.privatized" | "repository.publicized" | "repository.renamed" | "repository.transferred" | "repository.unarchived" | "repository_advisory" | "repository_advisory.published" | "repository_advisory.reported" | "repository_dispatch" | "repository_dispatch.sample.collected" | "repository_import" | "repository_ruleset" | "repository_ruleset.created" | "repository_ruleset.deleted" | "repository_ruleset.edited" | "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.reopen" | "repository_vulnerability_alert.resolve" | "secret_scanning_alert" | "secret_scanning_alert.created" | "secret_scanning_alert.reopened" | "secret_scanning_alert.resolved" | "secret_scanning_alert.revoked" | "secret_scanning_alert.validated" | "secret_scanning_alert_location" | "secret_scanning_alert_location.created" | "security_advisory" | "security_advisory.published" | "security_advisory.updated" | "security_advisory.withdrawn" | "security_and_analysis" | "sponsorship" | "sponsorship.cancelled" | "sponsorship.created" | "sponsorship.edited" | "sponsorship.pending_cancellation" | "sponsorship.pending_tier_change" | "sponsorship.tier_changed" | "star" | "star.created" | "star.deleted" | "status" | "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository" | "team_add" | "watch" | "watch.started" | "workflow_dispatch" | "workflow_job" | "workflow_job.completed" | "workflow_job.in_progress" | "workflow_job.queued" | "workflow_job.waiting" | "workflow_run" | "workflow_run.completed" | "workflow_run.in_progress" | "workflow_run.requested">[]>;
|
|
5
|
+
declare const commandSchema: _sinclair_typebox.TObject<{
|
|
6
|
+
description: _sinclair_typebox.TString;
|
|
7
|
+
"ubiquity:example": _sinclair_typebox.TString;
|
|
8
|
+
}>;
|
|
9
|
+
declare const manifestSchema: _sinclair_typebox.TObject<{
|
|
10
|
+
name: _sinclair_typebox.TString;
|
|
11
|
+
description: _sinclair_typebox.TOptional<_sinclair_typebox.TString>;
|
|
12
|
+
commands: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TObject<{
|
|
13
|
+
description: _sinclair_typebox.TString;
|
|
14
|
+
"ubiquity:example": _sinclair_typebox.TString;
|
|
15
|
+
}>>>;
|
|
16
|
+
"ubiquity:listeners": _sinclair_typebox.TOptional<_sinclair_typebox.TArray<_sinclair_typebox.TUnion<_sinclair_typebox.TLiteral<"branch_protection_configuration" | "branch_protection_configuration.disabled" | "branch_protection_configuration.enabled" | "branch_protection_rule" | "branch_protection_rule.created" | "branch_protection_rule.deleted" | "branch_protection_rule.edited" | "check_run" | "check_run.completed" | "check_run.created" | "check_run.requested_action" | "check_run.rerequested" | "check_suite" | "check_suite.completed" | "check_suite.requested" | "check_suite.rerequested" | "code_scanning_alert" | "code_scanning_alert.appeared_in_branch" | "code_scanning_alert.closed_by_user" | "code_scanning_alert.created" | "code_scanning_alert.fixed" | "code_scanning_alert.reopened" | "code_scanning_alert.reopened_by_user" | "commit_comment" | "commit_comment.created" | "create" | "custom_property" | "custom_property.created" | "custom_property.deleted" | "custom_property.updated" | "custom_property_values" | "custom_property_values.updated" | "delete" | "dependabot_alert" | "dependabot_alert.auto_dismissed" | "dependabot_alert.auto_reopened" | "dependabot_alert.created" | "dependabot_alert.dismissed" | "dependabot_alert.fixed" | "dependabot_alert.reintroduced" | "dependabot_alert.reopened" | "deploy_key" | "deploy_key.created" | "deploy_key.deleted" | "deployment" | "deployment.created" | "deployment_protection_rule" | "deployment_protection_rule.requested" | "deployment_review" | "deployment_review.approved" | "deployment_review.rejected" | "deployment_review.requested" | "deployment_status" | "deployment_status.created" | "discussion" | "discussion.answered" | "discussion.category_changed" | "discussion.closed" | "discussion.created" | "discussion.deleted" | "discussion.edited" | "discussion.labeled" | "discussion.locked" | "discussion.pinned" | "discussion.reopened" | "discussion.transferred" | "discussion.unanswered" | "discussion.unlabeled" | "discussion.unlocked" | "discussion.unpinned" | "discussion_comment" | "discussion_comment.created" | "discussion_comment.deleted" | "discussion_comment.edited" | "fork" | "github_app_authorization" | "github_app_authorization.revoked" | "gollum" | "installation" | "installation.created" | "installation.deleted" | "installation.new_permissions_accepted" | "installation.suspend" | "installation.unsuspend" | "installation_repositories" | "installation_repositories.added" | "installation_repositories.removed" | "installation_target" | "installation_target.renamed" | "issue_comment" | "issue_comment.created" | "issue_comment.deleted" | "issue_comment.edited" | "issues" | "issues.assigned" | "issues.closed" | "issues.deleted" | "issues.demilestoned" | "issues.edited" | "issues.labeled" | "issues.locked" | "issues.milestoned" | "issues.opened" | "issues.pinned" | "issues.reopened" | "issues.transferred" | "issues.unassigned" | "issues.unlabeled" | "issues.unlocked" | "issues.unpinned" | "label" | "label.created" | "label.deleted" | "label.edited" | "marketplace_purchase" | "marketplace_purchase.cancelled" | "marketplace_purchase.changed" | "marketplace_purchase.pending_change" | "marketplace_purchase.pending_change_cancelled" | "marketplace_purchase.purchased" | "member" | "member.added" | "member.edited" | "member.removed" | "membership" | "membership.added" | "membership.removed" | "merge_group" | "merge_group.checks_requested" | "merge_group.destroyed" | "meta" | "meta.deleted" | "milestone" | "milestone.closed" | "milestone.created" | "milestone.deleted" | "milestone.edited" | "milestone.opened" | "org_block" | "org_block.blocked" | "org_block.unblocked" | "organization" | "organization.deleted" | "organization.member_added" | "organization.member_invited" | "organization.member_removed" | "organization.renamed" | "package" | "package.published" | "package.updated" | "page_build" | "personal_access_token_request" | "personal_access_token_request.approved" | "personal_access_token_request.cancelled" | "personal_access_token_request.created" | "personal_access_token_request.denied" | "ping" | "project" | "project.closed" | "project.created" | "project.deleted" | "project.edited" | "project.reopened" | "project_card" | "project_card.converted" | "project_card.created" | "project_card.deleted" | "project_card.edited" | "project_card.moved" | "project_column" | "project_column.created" | "project_column.deleted" | "project_column.edited" | "project_column.moved" | "projects_v2" | "projects_v2.closed" | "projects_v2.created" | "projects_v2.deleted" | "projects_v2.edited" | "projects_v2.reopened" | "projects_v2_item" | "projects_v2_item.archived" | "projects_v2_item.converted" | "projects_v2_item.created" | "projects_v2_item.deleted" | "projects_v2_item.edited" | "projects_v2_item.reordered" | "projects_v2_item.restored" | "public" | "pull_request" | "pull_request.assigned" | "pull_request.auto_merge_disabled" | "pull_request.auto_merge_enabled" | "pull_request.closed" | "pull_request.converted_to_draft" | "pull_request.demilestoned" | "pull_request.dequeued" | "pull_request.edited" | "pull_request.enqueued" | "pull_request.labeled" | "pull_request.locked" | "pull_request.milestoned" | "pull_request.opened" | "pull_request.ready_for_review" | "pull_request.reopened" | "pull_request.review_request_removed" | "pull_request.review_requested" | "pull_request.synchronize" | "pull_request.unassigned" | "pull_request.unlabeled" | "pull_request.unlocked" | "pull_request_review" | "pull_request_review.dismissed" | "pull_request_review.edited" | "pull_request_review.submitted" | "pull_request_review_comment" | "pull_request_review_comment.created" | "pull_request_review_comment.deleted" | "pull_request_review_comment.edited" | "pull_request_review_thread" | "pull_request_review_thread.resolved" | "pull_request_review_thread.unresolved" | "push" | "registry_package" | "registry_package.published" | "registry_package.updated" | "release" | "release.created" | "release.deleted" | "release.edited" | "release.prereleased" | "release.published" | "release.released" | "release.unpublished" | "repository" | "repository.archived" | "repository.created" | "repository.deleted" | "repository.edited" | "repository.privatized" | "repository.publicized" | "repository.renamed" | "repository.transferred" | "repository.unarchived" | "repository_advisory" | "repository_advisory.published" | "repository_advisory.reported" | "repository_dispatch" | "repository_dispatch.sample.collected" | "repository_import" | "repository_ruleset" | "repository_ruleset.created" | "repository_ruleset.deleted" | "repository_ruleset.edited" | "repository_vulnerability_alert" | "repository_vulnerability_alert.create" | "repository_vulnerability_alert.dismiss" | "repository_vulnerability_alert.reopen" | "repository_vulnerability_alert.resolve" | "secret_scanning_alert" | "secret_scanning_alert.created" | "secret_scanning_alert.reopened" | "secret_scanning_alert.resolved" | "secret_scanning_alert.revoked" | "secret_scanning_alert.validated" | "secret_scanning_alert_location" | "secret_scanning_alert_location.created" | "security_advisory" | "security_advisory.published" | "security_advisory.updated" | "security_advisory.withdrawn" | "security_and_analysis" | "sponsorship" | "sponsorship.cancelled" | "sponsorship.created" | "sponsorship.edited" | "sponsorship.pending_cancellation" | "sponsorship.pending_tier_change" | "sponsorship.tier_changed" | "star" | "star.created" | "star.deleted" | "status" | "team" | "team.added_to_repository" | "team.created" | "team.deleted" | "team.edited" | "team.removed_from_repository" | "team_add" | "watch" | "watch.started" | "workflow_dispatch" | "workflow_job" | "workflow_job.completed" | "workflow_job.in_progress" | "workflow_job.queued" | "workflow_job.waiting" | "workflow_run" | "workflow_run.completed" | "workflow_run.in_progress" | "workflow_run.requested">[]>>>;
|
|
17
|
+
configuration: _sinclair_typebox.TOptional<_sinclair_typebox.TRecord<_sinclair_typebox.TString, _sinclair_typebox.TAny>>;
|
|
18
|
+
}>;
|
|
19
|
+
type Manifest = Static<typeof manifestSchema>;
|
|
20
|
+
|
|
21
|
+
export { type Manifest, commandSchema, manifestSchema, runEvent };
|
package/dist/manifest.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// src/types/manifest.ts
|
|
2
|
+
import { Type as T } from "@sinclair/typebox";
|
|
3
|
+
import { emitterEventNames } from "@octokit/webhooks";
|
|
4
|
+
var runEvent = T.Union(emitterEventNames.map((o) => T.Literal(o)));
|
|
5
|
+
var commandSchema = T.Object({
|
|
6
|
+
description: T.String({ minLength: 1 }),
|
|
7
|
+
"ubiquity:example": T.String({ minLength: 1 })
|
|
8
|
+
});
|
|
9
|
+
var manifestSchema = T.Object({
|
|
10
|
+
name: T.String({ minLength: 1 }),
|
|
11
|
+
description: T.Optional(T.String({ default: "" })),
|
|
12
|
+
commands: T.Optional(T.Record(T.String(), commandSchema, { default: {} })),
|
|
13
|
+
"ubiquity:listeners": T.Optional(T.Array(runEvent, { default: [] })),
|
|
14
|
+
configuration: T.Optional(T.Record(T.String(), T.Any(), { default: {} }))
|
|
15
|
+
});
|
|
16
|
+
export {
|
|
17
|
+
commandSchema,
|
|
18
|
+
manifestSchema,
|
|
19
|
+
runEvent
|
|
20
|
+
};
|