@kevisual/cnb 0.0.51 → 0.0.53
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/agent/cli.ts +3 -1
- package/agent/npc.ts +2 -2
- package/agent/routes/repo/repo-label.ts +152 -0
- package/dist/cli.js +120 -30
- package/dist/npc.js +120 -31
- package/dist/opencode.js +113 -27
- package/dist/routes.d.ts +148 -2
- package/dist/routes.js +112 -26
- package/package.json +3 -2
- package/src/index.ts +16 -1
- package/src/issue/index.ts +2 -2
- package/src/labels/index.ts +1 -0
- package/src/labels/repo-label.ts +208 -0
package/dist/npc.js
CHANGED
|
@@ -4432,7 +4432,7 @@ var require_commander = __commonJS((exports) => {
|
|
|
4432
4432
|
exports.InvalidOptionArgumentError = InvalidArgumentError3;
|
|
4433
4433
|
});
|
|
4434
4434
|
|
|
4435
|
-
// ../../node_modules/.pnpm/@kevisual+router@0.1.
|
|
4435
|
+
// ../../node_modules/.pnpm/@kevisual+router@0.1.3/node_modules/@kevisual/router/dist/router.js
|
|
4436
4436
|
import { createRequire as createRequire2 } from "node:module";
|
|
4437
4437
|
import { webcrypto as crypto } from "node:crypto";
|
|
4438
4438
|
import url2 from "node:url";
|
|
@@ -25135,6 +25135,78 @@ class AiBase extends CNBCore {
|
|
|
25135
25135
|
}
|
|
25136
25136
|
}
|
|
25137
25137
|
|
|
25138
|
+
// src/labels/repo-label.ts
|
|
25139
|
+
class RepoLabel extends CNBCore {
|
|
25140
|
+
constructor(options) {
|
|
25141
|
+
super(options);
|
|
25142
|
+
}
|
|
25143
|
+
list(repo, params) {
|
|
25144
|
+
const url3 = `/${repo}/-/labels`;
|
|
25145
|
+
return this.get({
|
|
25146
|
+
url: url3,
|
|
25147
|
+
params,
|
|
25148
|
+
headers: {
|
|
25149
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25150
|
+
}
|
|
25151
|
+
});
|
|
25152
|
+
}
|
|
25153
|
+
create(repo, data) {
|
|
25154
|
+
const url3 = `/${repo}/-/labels`;
|
|
25155
|
+
return this.post({
|
|
25156
|
+
url: url3,
|
|
25157
|
+
data
|
|
25158
|
+
});
|
|
25159
|
+
}
|
|
25160
|
+
update(repo, name, data) {
|
|
25161
|
+
const url3 = `/${repo}/-/labels/${encodeURIComponent(name)}`;
|
|
25162
|
+
return this.patch({
|
|
25163
|
+
url: url3,
|
|
25164
|
+
data
|
|
25165
|
+
});
|
|
25166
|
+
}
|
|
25167
|
+
remove(repo, name) {
|
|
25168
|
+
const url3 = `/${repo}/-/labels/${encodeURIComponent(name)}`;
|
|
25169
|
+
return this.delete({ url: url3 });
|
|
25170
|
+
}
|
|
25171
|
+
}
|
|
25172
|
+
|
|
25173
|
+
class IssueLabel extends CNBCore {
|
|
25174
|
+
constructor(options) {
|
|
25175
|
+
super(options);
|
|
25176
|
+
}
|
|
25177
|
+
list(repo, number4, params) {
|
|
25178
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
25179
|
+
return this.get({
|
|
25180
|
+
url: url3,
|
|
25181
|
+
params,
|
|
25182
|
+
headers: {
|
|
25183
|
+
Accept: "application/vnd.cnb.api+json"
|
|
25184
|
+
}
|
|
25185
|
+
});
|
|
25186
|
+
}
|
|
25187
|
+
set(repo, number4, data) {
|
|
25188
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
25189
|
+
return this.put({
|
|
25190
|
+
url: url3,
|
|
25191
|
+
data
|
|
25192
|
+
});
|
|
25193
|
+
}
|
|
25194
|
+
add(repo, number4, data) {
|
|
25195
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
25196
|
+
return this.post({
|
|
25197
|
+
url: url3,
|
|
25198
|
+
data
|
|
25199
|
+
});
|
|
25200
|
+
}
|
|
25201
|
+
clear(repo, number4) {
|
|
25202
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
25203
|
+
return this.delete({ url: url3 });
|
|
25204
|
+
}
|
|
25205
|
+
remove(repo, number4, name) {
|
|
25206
|
+
const url3 = `/${repo}/-/issues/${number4}/labels/${encodeURIComponent(name)}`;
|
|
25207
|
+
return this.delete({ url: url3 });
|
|
25208
|
+
}
|
|
25209
|
+
}
|
|
25138
25210
|
// src/index.ts
|
|
25139
25211
|
class CNB extends CNBCore {
|
|
25140
25212
|
workspace;
|
|
@@ -25145,6 +25217,7 @@ class CNB extends CNBCore {
|
|
|
25145
25217
|
issue;
|
|
25146
25218
|
mission;
|
|
25147
25219
|
ai;
|
|
25220
|
+
labels;
|
|
25148
25221
|
constructor(options) {
|
|
25149
25222
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
25150
25223
|
this.init(options);
|
|
@@ -25163,6 +25236,10 @@ class CNB extends CNBCore {
|
|
|
25163
25236
|
this.issue = new Issue(options);
|
|
25164
25237
|
this.mission = new Mission(options);
|
|
25165
25238
|
this.ai = new AiBase(options);
|
|
25239
|
+
this.labels = {
|
|
25240
|
+
repoLabel: new RepoLabel(options),
|
|
25241
|
+
issueLabel: new IssueLabel(options)
|
|
25242
|
+
};
|
|
25166
25243
|
}
|
|
25167
25244
|
setToken(token) {
|
|
25168
25245
|
this.token = token;
|
|
@@ -25172,6 +25249,8 @@ class CNB extends CNBCore {
|
|
|
25172
25249
|
this.build.token = token;
|
|
25173
25250
|
this.issue.token = token;
|
|
25174
25251
|
this.mission.token = token;
|
|
25252
|
+
this.labels.repoLabel.token = token;
|
|
25253
|
+
this.labels.issueLabel.token = token;
|
|
25175
25254
|
}
|
|
25176
25255
|
setCookie(cookie) {
|
|
25177
25256
|
this.cookie = cookie;
|
|
@@ -25181,8 +25260,15 @@ class CNB extends CNBCore {
|
|
|
25181
25260
|
this.build.cookie = cookie;
|
|
25182
25261
|
this.issue.cookie = cookie;
|
|
25183
25262
|
this.mission.cookie = cookie;
|
|
25263
|
+
this.labels.repoLabel.cookie = cookie;
|
|
25264
|
+
this.labels.issueLabel.cookie = cookie;
|
|
25184
25265
|
}
|
|
25266
|
+
getCNBVersion = getCNBVersion;
|
|
25185
25267
|
}
|
|
25268
|
+
var getCNBVersion = () => {
|
|
25269
|
+
const url3 = "https://cnb.cool/api/version";
|
|
25270
|
+
return fetch(url3).then((res) => res.json());
|
|
25271
|
+
};
|
|
25186
25272
|
|
|
25187
25273
|
// ../../node_modules/.pnpm/@ai-sdk+provider@3.0.8/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
25188
25274
|
var marker = "vercel.ai.error";
|
|
@@ -47982,7 +48068,7 @@ app.route({
|
|
|
47982
48068
|
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
47983
48069
|
const state = ctx.query?.state;
|
|
47984
48070
|
const keyword = ctx.query?.keyword;
|
|
47985
|
-
const
|
|
48071
|
+
const labels2 = ctx.query?.labels;
|
|
47986
48072
|
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
47987
48073
|
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
47988
48074
|
const order_by = ctx.query?.order_by;
|
|
@@ -47994,8 +48080,8 @@ app.route({
|
|
|
47994
48080
|
params.state = state;
|
|
47995
48081
|
if (keyword)
|
|
47996
48082
|
params.keyword = keyword;
|
|
47997
|
-
if (
|
|
47998
|
-
params.labels =
|
|
48083
|
+
if (labels2)
|
|
48084
|
+
params.labels = labels2;
|
|
47999
48085
|
if (page)
|
|
48000
48086
|
params.page = page;
|
|
48001
48087
|
if (page_size)
|
|
@@ -48064,7 +48150,7 @@ app.route({
|
|
|
48064
48150
|
const title = ctx.query?.title;
|
|
48065
48151
|
const body = ctx.query?.body;
|
|
48066
48152
|
const assignees = ctx.query?.assignees;
|
|
48067
|
-
const
|
|
48153
|
+
const labels2 = ctx.query?.labels;
|
|
48068
48154
|
const priority = ctx.query?.priority;
|
|
48069
48155
|
if (!repo2 || !title) {
|
|
48070
48156
|
ctx.throw(400, "缺少参数 repo 或 title");
|
|
@@ -48073,7 +48159,7 @@ app.route({
|
|
|
48073
48159
|
title,
|
|
48074
48160
|
body,
|
|
48075
48161
|
assignees,
|
|
48076
|
-
labels,
|
|
48162
|
+
labels: labels2,
|
|
48077
48163
|
priority
|
|
48078
48164
|
});
|
|
48079
48165
|
ctx.forward(res);
|
|
@@ -48330,7 +48416,7 @@ var getLiveMdContent = (opts) => {
|
|
|
48330
48416
|
2. Opencode web访问说明
|
|
48331
48417
|
Opencode打开web地址,需要在浏览器输入用户名和密码,用户名固定为root,密码为CNB_TOKEN的值. 纯连接打开包含账号密码,第一次点击后,需要把账号密码清理掉才能访问,opencode的bug导致的。
|
|
48332
48418
|
`;
|
|
48333
|
-
const
|
|
48419
|
+
const labels2 = [
|
|
48334
48420
|
{
|
|
48335
48421
|
key: "vscodeWebUrl",
|
|
48336
48422
|
title: "VSCode Web 地址",
|
|
@@ -48387,11 +48473,11 @@ Opencode打开web地址,需要在浏览器输入用户名和密码,用户名
|
|
|
48387
48473
|
}
|
|
48388
48474
|
];
|
|
48389
48475
|
const osInfoList = createOSInfo(more);
|
|
48390
|
-
|
|
48391
|
-
return
|
|
48476
|
+
labels2.push(...osInfoList);
|
|
48477
|
+
return labels2;
|
|
48392
48478
|
};
|
|
48393
48479
|
var createOSInfo = (more = false) => {
|
|
48394
|
-
const
|
|
48480
|
+
const labels2 = [];
|
|
48395
48481
|
const startTimer = useKey("CNB_BUILD_START_TIME") || "";
|
|
48396
48482
|
const cpus = os2.cpus();
|
|
48397
48483
|
let totalIdle = 0;
|
|
@@ -48451,7 +48537,7 @@ var createOSInfo = (more = false) => {
|
|
|
48451
48537
|
} catch (e) {
|
|
48452
48538
|
diskUsage = "获取失败";
|
|
48453
48539
|
}
|
|
48454
|
-
|
|
48540
|
+
labels2.push({
|
|
48455
48541
|
key: "cpuUsage",
|
|
48456
48542
|
title: "CPU 使用率",
|
|
48457
48543
|
value: `${cpuUsage}%`,
|
|
@@ -48493,7 +48579,7 @@ var createOSInfo = (more = false) => {
|
|
|
48493
48579
|
const buildUptime = Date.now() - buildStartTimestamp;
|
|
48494
48580
|
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
|
|
48495
48581
|
const maxRunTime = useKey("CNB_PIPELINE_MAX_RUN_TIME") || 0;
|
|
48496
|
-
|
|
48582
|
+
labels2.push({
|
|
48497
48583
|
key: "buildStartTime",
|
|
48498
48584
|
title: "构建启动时间",
|
|
48499
48585
|
value: buildStartTime,
|
|
@@ -48512,13 +48598,13 @@ var createOSInfo = (more = false) => {
|
|
|
48512
48598
|
timeTo4 = today4am.add(1, "day").valueOf() - now.valueOf();
|
|
48513
48599
|
}
|
|
48514
48600
|
const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
|
|
48515
|
-
|
|
48601
|
+
labels2.push({
|
|
48516
48602
|
key: "buildMaxRunTime",
|
|
48517
48603
|
title: "最大运行时间",
|
|
48518
48604
|
value: formatUptime(Math.floor(maxRunTime / 1000)),
|
|
48519
48605
|
description: "构建最大运行时间(限制时间)"
|
|
48520
48606
|
});
|
|
48521
|
-
|
|
48607
|
+
labels2.unshift({
|
|
48522
48608
|
key: "remainingTime",
|
|
48523
48609
|
title: "剩余时间",
|
|
48524
48610
|
value: maxRunTime - buildUptime,
|
|
@@ -48528,7 +48614,7 @@ var createOSInfo = (more = false) => {
|
|
|
48528
48614
|
}
|
|
48529
48615
|
if (more) {
|
|
48530
48616
|
const loadavg = os2.loadavg();
|
|
48531
|
-
|
|
48617
|
+
labels2.push({
|
|
48532
48618
|
key: "hostname",
|
|
48533
48619
|
title: "主机名",
|
|
48534
48620
|
value: os2.hostname(),
|
|
@@ -48565,7 +48651,7 @@ var createOSInfo = (more = false) => {
|
|
|
48565
48651
|
description: "系统负载 (15分钟)"
|
|
48566
48652
|
});
|
|
48567
48653
|
}
|
|
48568
|
-
return
|
|
48654
|
+
return labels2;
|
|
48569
48655
|
};
|
|
48570
48656
|
|
|
48571
48657
|
// agent/routes/cnb-board/cnb-dev-env.ts
|
|
@@ -48602,7 +48688,7 @@ app.route({
|
|
|
48602
48688
|
if (notCNBCheck(ctx))
|
|
48603
48689
|
return;
|
|
48604
48690
|
const repoNameFromSlug = repoSlug.split("/").pop() || "";
|
|
48605
|
-
const
|
|
48691
|
+
const labels2 = [
|
|
48606
48692
|
{
|
|
48607
48693
|
title: "CNB_REPO_SLUG",
|
|
48608
48694
|
value: repoSlug,
|
|
@@ -48636,7 +48722,7 @@ app.route({
|
|
|
48636
48722
|
];
|
|
48637
48723
|
ctx.body = {
|
|
48638
48724
|
title: "CNB_BOARD_LIVE_REPO_INFO",
|
|
48639
|
-
list:
|
|
48725
|
+
list: labels2
|
|
48640
48726
|
};
|
|
48641
48727
|
}).addTo(app);
|
|
48642
48728
|
app.route({
|
|
@@ -48647,7 +48733,7 @@ app.route({
|
|
|
48647
48733
|
}).define(async (ctx) => {
|
|
48648
48734
|
if (notCNBCheck(ctx))
|
|
48649
48735
|
return;
|
|
48650
|
-
const
|
|
48736
|
+
const labels2 = [
|
|
48651
48737
|
{
|
|
48652
48738
|
title: "CNB_BUILD_ID",
|
|
48653
48739
|
value: useKey("CNB_BUILD_ID") || "",
|
|
@@ -48781,7 +48867,7 @@ app.route({
|
|
|
48781
48867
|
];
|
|
48782
48868
|
ctx.body = {
|
|
48783
48869
|
title: "CNB_BOARD_LIVE_BUILD_INFO",
|
|
48784
|
-
list:
|
|
48870
|
+
list: labels2
|
|
48785
48871
|
};
|
|
48786
48872
|
}).addTo(app);
|
|
48787
48873
|
app.route({
|
|
@@ -48790,7 +48876,7 @@ app.route({
|
|
|
48790
48876
|
description: "获取cnb-board live的PR信息",
|
|
48791
48877
|
middleware: ["auth-admin"]
|
|
48792
48878
|
}).define(async (ctx) => {
|
|
48793
|
-
const
|
|
48879
|
+
const labels2 = [
|
|
48794
48880
|
{
|
|
48795
48881
|
title: "CNB_PULL_REQUEST",
|
|
48796
48882
|
value: useKey("CNB_PULL_REQUEST") || "",
|
|
@@ -48879,7 +48965,7 @@ app.route({
|
|
|
48879
48965
|
];
|
|
48880
48966
|
ctx.body = {
|
|
48881
48967
|
title: "CNB_BOARD_LIVE_PULL_INFO",
|
|
48882
|
-
list:
|
|
48968
|
+
list: labels2
|
|
48883
48969
|
};
|
|
48884
48970
|
}).addTo(app);
|
|
48885
48971
|
app.route({
|
|
@@ -48890,7 +48976,7 @@ app.route({
|
|
|
48890
48976
|
}).define(async (ctx) => {
|
|
48891
48977
|
if (notCNBCheck(ctx))
|
|
48892
48978
|
return;
|
|
48893
|
-
const
|
|
48979
|
+
const labels2 = [
|
|
48894
48980
|
{
|
|
48895
48981
|
title: "CNB_NPC_SLUG",
|
|
48896
48982
|
value: useKey("CNB_NPC_SLUG") || "",
|
|
@@ -48924,7 +49010,7 @@ app.route({
|
|
|
48924
49010
|
];
|
|
48925
49011
|
ctx.body = {
|
|
48926
49012
|
title: "CNB_BOARD_LIVE_NPC_INFO",
|
|
48927
|
-
list:
|
|
49013
|
+
list: labels2
|
|
48928
49014
|
};
|
|
48929
49015
|
}).addTo(app);
|
|
48930
49016
|
app.route({
|
|
@@ -48935,7 +49021,7 @@ app.route({
|
|
|
48935
49021
|
}).define(async (ctx) => {
|
|
48936
49022
|
if (notCNBCheck(ctx))
|
|
48937
49023
|
return;
|
|
48938
|
-
const
|
|
49024
|
+
const labels2 = [
|
|
48939
49025
|
{
|
|
48940
49026
|
title: "CNB_COMMENT_ID",
|
|
48941
49027
|
value: useKey("CNB_COMMENT_ID") || "",
|
|
@@ -48969,7 +49055,7 @@ app.route({
|
|
|
48969
49055
|
];
|
|
48970
49056
|
ctx.body = {
|
|
48971
49057
|
title: "CNB_BOARD_LIVE_COMMENT_INFO",
|
|
48972
|
-
list:
|
|
49058
|
+
list: labels2
|
|
48973
49059
|
};
|
|
48974
49060
|
}).addTo(app);
|
|
48975
49061
|
|
|
@@ -55643,7 +55729,7 @@ class RemoteApp {
|
|
|
55643
55729
|
}
|
|
55644
55730
|
}
|
|
55645
55731
|
|
|
55646
|
-
// ../../node_modules/.pnpm/@kevisual+router@0.1.
|
|
55732
|
+
// ../../node_modules/.pnpm/@kevisual+router@0.1.3/node_modules/@kevisual/router/src/commander.ts
|
|
55647
55733
|
var groupByPath = (routes) => {
|
|
55648
55734
|
return routes.reduce((acc, route) => {
|
|
55649
55735
|
const path3 = route.path || "default";
|
|
@@ -55755,7 +55841,7 @@ var createCommand2 = (opts) => {
|
|
|
55755
55841
|
}
|
|
55756
55842
|
};
|
|
55757
55843
|
var parse8 = async (opts) => {
|
|
55758
|
-
const { description, parse: parse5 = true, version: version3 } = opts;
|
|
55844
|
+
const { description, parse: parse5 = true, version: version3, exitOnEnd = true } = opts;
|
|
55759
55845
|
const app3 = opts.app;
|
|
55760
55846
|
const _program = opts.program || program;
|
|
55761
55847
|
_program.description(description || "Router 命令行工具");
|
|
@@ -55796,7 +55882,10 @@ var parse8 = async (opts) => {
|
|
|
55796
55882
|
return;
|
|
55797
55883
|
}
|
|
55798
55884
|
if (parse5) {
|
|
55799
|
-
_program.
|
|
55885
|
+
await _program.parseAsync(process.argv);
|
|
55886
|
+
if (exitOnEnd) {
|
|
55887
|
+
process.exit(0);
|
|
55888
|
+
}
|
|
55800
55889
|
}
|
|
55801
55890
|
};
|
|
55802
55891
|
// ../../node_modules/.pnpm/es-toolkit@1.45.1/node_modules/es-toolkit/dist/object/pick.mjs
|
|
@@ -55836,8 +55925,8 @@ var getIssuesLabels = async () => {
|
|
|
55836
55925
|
});
|
|
55837
55926
|
if (res.code === 200) {
|
|
55838
55927
|
const issueData = res.data;
|
|
55839
|
-
const
|
|
55840
|
-
return
|
|
55928
|
+
const labels2 = issueData.labels || [];
|
|
55929
|
+
return labels2;
|
|
55841
55930
|
}
|
|
55842
55931
|
console.error("获取 Issue 详情失败", res);
|
|
55843
55932
|
return [];
|
package/dist/opencode.js
CHANGED
|
@@ -2339,7 +2339,7 @@ var require_src = __commonJS((exports) => {
|
|
|
2339
2339
|
};
|
|
2340
2340
|
});
|
|
2341
2341
|
|
|
2342
|
-
// ../../node_modules/.pnpm/@kevisual+router@0.1.
|
|
2342
|
+
// ../../node_modules/.pnpm/@kevisual+router@0.1.3/node_modules/@kevisual/router/dist/router.js
|
|
2343
2343
|
import { createRequire as createRequire2 } from "node:module";
|
|
2344
2344
|
import { webcrypto as crypto } from "node:crypto";
|
|
2345
2345
|
import url2 from "node:url";
|
|
@@ -23008,6 +23008,78 @@ class AiBase extends CNBCore {
|
|
|
23008
23008
|
}
|
|
23009
23009
|
}
|
|
23010
23010
|
|
|
23011
|
+
// src/labels/repo-label.ts
|
|
23012
|
+
class RepoLabel extends CNBCore {
|
|
23013
|
+
constructor(options) {
|
|
23014
|
+
super(options);
|
|
23015
|
+
}
|
|
23016
|
+
list(repo, params) {
|
|
23017
|
+
const url3 = `/${repo}/-/labels`;
|
|
23018
|
+
return this.get({
|
|
23019
|
+
url: url3,
|
|
23020
|
+
params,
|
|
23021
|
+
headers: {
|
|
23022
|
+
Accept: "application/vnd.cnb.api+json"
|
|
23023
|
+
}
|
|
23024
|
+
});
|
|
23025
|
+
}
|
|
23026
|
+
create(repo, data) {
|
|
23027
|
+
const url3 = `/${repo}/-/labels`;
|
|
23028
|
+
return this.post({
|
|
23029
|
+
url: url3,
|
|
23030
|
+
data
|
|
23031
|
+
});
|
|
23032
|
+
}
|
|
23033
|
+
update(repo, name, data) {
|
|
23034
|
+
const url3 = `/${repo}/-/labels/${encodeURIComponent(name)}`;
|
|
23035
|
+
return this.patch({
|
|
23036
|
+
url: url3,
|
|
23037
|
+
data
|
|
23038
|
+
});
|
|
23039
|
+
}
|
|
23040
|
+
remove(repo, name) {
|
|
23041
|
+
const url3 = `/${repo}/-/labels/${encodeURIComponent(name)}`;
|
|
23042
|
+
return this.delete({ url: url3 });
|
|
23043
|
+
}
|
|
23044
|
+
}
|
|
23045
|
+
|
|
23046
|
+
class IssueLabel extends CNBCore {
|
|
23047
|
+
constructor(options) {
|
|
23048
|
+
super(options);
|
|
23049
|
+
}
|
|
23050
|
+
list(repo, number4, params) {
|
|
23051
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
23052
|
+
return this.get({
|
|
23053
|
+
url: url3,
|
|
23054
|
+
params,
|
|
23055
|
+
headers: {
|
|
23056
|
+
Accept: "application/vnd.cnb.api+json"
|
|
23057
|
+
}
|
|
23058
|
+
});
|
|
23059
|
+
}
|
|
23060
|
+
set(repo, number4, data) {
|
|
23061
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
23062
|
+
return this.put({
|
|
23063
|
+
url: url3,
|
|
23064
|
+
data
|
|
23065
|
+
});
|
|
23066
|
+
}
|
|
23067
|
+
add(repo, number4, data) {
|
|
23068
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
23069
|
+
return this.post({
|
|
23070
|
+
url: url3,
|
|
23071
|
+
data
|
|
23072
|
+
});
|
|
23073
|
+
}
|
|
23074
|
+
clear(repo, number4) {
|
|
23075
|
+
const url3 = `/${repo}/-/issues/${number4}/labels`;
|
|
23076
|
+
return this.delete({ url: url3 });
|
|
23077
|
+
}
|
|
23078
|
+
remove(repo, number4, name) {
|
|
23079
|
+
const url3 = `/${repo}/-/issues/${number4}/labels/${encodeURIComponent(name)}`;
|
|
23080
|
+
return this.delete({ url: url3 });
|
|
23081
|
+
}
|
|
23082
|
+
}
|
|
23011
23083
|
// src/index.ts
|
|
23012
23084
|
class CNB extends CNBCore {
|
|
23013
23085
|
workspace;
|
|
@@ -23018,6 +23090,7 @@ class CNB extends CNBCore {
|
|
|
23018
23090
|
issue;
|
|
23019
23091
|
mission;
|
|
23020
23092
|
ai;
|
|
23093
|
+
labels;
|
|
23021
23094
|
constructor(options) {
|
|
23022
23095
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
23023
23096
|
this.init(options);
|
|
@@ -23036,6 +23109,10 @@ class CNB extends CNBCore {
|
|
|
23036
23109
|
this.issue = new Issue(options);
|
|
23037
23110
|
this.mission = new Mission(options);
|
|
23038
23111
|
this.ai = new AiBase(options);
|
|
23112
|
+
this.labels = {
|
|
23113
|
+
repoLabel: new RepoLabel(options),
|
|
23114
|
+
issueLabel: new IssueLabel(options)
|
|
23115
|
+
};
|
|
23039
23116
|
}
|
|
23040
23117
|
setToken(token) {
|
|
23041
23118
|
this.token = token;
|
|
@@ -23045,6 +23122,8 @@ class CNB extends CNBCore {
|
|
|
23045
23122
|
this.build.token = token;
|
|
23046
23123
|
this.issue.token = token;
|
|
23047
23124
|
this.mission.token = token;
|
|
23125
|
+
this.labels.repoLabel.token = token;
|
|
23126
|
+
this.labels.issueLabel.token = token;
|
|
23048
23127
|
}
|
|
23049
23128
|
setCookie(cookie) {
|
|
23050
23129
|
this.cookie = cookie;
|
|
@@ -23054,8 +23133,15 @@ class CNB extends CNBCore {
|
|
|
23054
23133
|
this.build.cookie = cookie;
|
|
23055
23134
|
this.issue.cookie = cookie;
|
|
23056
23135
|
this.mission.cookie = cookie;
|
|
23136
|
+
this.labels.repoLabel.cookie = cookie;
|
|
23137
|
+
this.labels.issueLabel.cookie = cookie;
|
|
23057
23138
|
}
|
|
23139
|
+
getCNBVersion = getCNBVersion;
|
|
23058
23140
|
}
|
|
23141
|
+
var getCNBVersion = () => {
|
|
23142
|
+
const url3 = "https://cnb.cool/api/version";
|
|
23143
|
+
return fetch(url3).then((res) => res.json());
|
|
23144
|
+
};
|
|
23059
23145
|
|
|
23060
23146
|
// ../../node_modules/.pnpm/@ai-sdk+provider@3.0.8/node_modules/@ai-sdk/provider/dist/index.mjs
|
|
23061
23147
|
var marker = "vercel.ai.error";
|
|
@@ -45855,7 +45941,7 @@ app.route({
|
|
|
45855
45941
|
let repo2 = ctx.query?.repo || useKey("CNB_REPO_SLUG_LOWERCASE");
|
|
45856
45942
|
const state = ctx.query?.state;
|
|
45857
45943
|
const keyword = ctx.query?.keyword;
|
|
45858
|
-
const
|
|
45944
|
+
const labels2 = ctx.query?.labels;
|
|
45859
45945
|
const page = ctx.query?.page ? Number(ctx.query.page) : undefined;
|
|
45860
45946
|
const page_size = ctx.query?.page_size ? Number(ctx.query.page_size) : undefined;
|
|
45861
45947
|
const order_by = ctx.query?.order_by;
|
|
@@ -45867,8 +45953,8 @@ app.route({
|
|
|
45867
45953
|
params.state = state;
|
|
45868
45954
|
if (keyword)
|
|
45869
45955
|
params.keyword = keyword;
|
|
45870
|
-
if (
|
|
45871
|
-
params.labels =
|
|
45956
|
+
if (labels2)
|
|
45957
|
+
params.labels = labels2;
|
|
45872
45958
|
if (page)
|
|
45873
45959
|
params.page = page;
|
|
45874
45960
|
if (page_size)
|
|
@@ -45937,7 +46023,7 @@ app.route({
|
|
|
45937
46023
|
const title = ctx.query?.title;
|
|
45938
46024
|
const body = ctx.query?.body;
|
|
45939
46025
|
const assignees = ctx.query?.assignees;
|
|
45940
|
-
const
|
|
46026
|
+
const labels2 = ctx.query?.labels;
|
|
45941
46027
|
const priority = ctx.query?.priority;
|
|
45942
46028
|
if (!repo2 || !title) {
|
|
45943
46029
|
ctx.throw(400, "缺少参数 repo 或 title");
|
|
@@ -45946,7 +46032,7 @@ app.route({
|
|
|
45946
46032
|
title,
|
|
45947
46033
|
body,
|
|
45948
46034
|
assignees,
|
|
45949
|
-
labels,
|
|
46035
|
+
labels: labels2,
|
|
45950
46036
|
priority
|
|
45951
46037
|
});
|
|
45952
46038
|
ctx.forward(res);
|
|
@@ -46203,7 +46289,7 @@ var getLiveMdContent = (opts) => {
|
|
|
46203
46289
|
2. Opencode web访问说明
|
|
46204
46290
|
Opencode打开web地址,需要在浏览器输入用户名和密码,用户名固定为root,密码为CNB_TOKEN的值. 纯连接打开包含账号密码,第一次点击后,需要把账号密码清理掉才能访问,opencode的bug导致的。
|
|
46205
46291
|
`;
|
|
46206
|
-
const
|
|
46292
|
+
const labels2 = [
|
|
46207
46293
|
{
|
|
46208
46294
|
key: "vscodeWebUrl",
|
|
46209
46295
|
title: "VSCode Web 地址",
|
|
@@ -46260,11 +46346,11 @@ Opencode打开web地址,需要在浏览器输入用户名和密码,用户名
|
|
|
46260
46346
|
}
|
|
46261
46347
|
];
|
|
46262
46348
|
const osInfoList = createOSInfo(more);
|
|
46263
|
-
|
|
46264
|
-
return
|
|
46349
|
+
labels2.push(...osInfoList);
|
|
46350
|
+
return labels2;
|
|
46265
46351
|
};
|
|
46266
46352
|
var createOSInfo = (more = false) => {
|
|
46267
|
-
const
|
|
46353
|
+
const labels2 = [];
|
|
46268
46354
|
const startTimer = useKey("CNB_BUILD_START_TIME") || "";
|
|
46269
46355
|
const cpus = os2.cpus();
|
|
46270
46356
|
let totalIdle = 0;
|
|
@@ -46324,7 +46410,7 @@ var createOSInfo = (more = false) => {
|
|
|
46324
46410
|
} catch (e) {
|
|
46325
46411
|
diskUsage = "获取失败";
|
|
46326
46412
|
}
|
|
46327
|
-
|
|
46413
|
+
labels2.push({
|
|
46328
46414
|
key: "cpuUsage",
|
|
46329
46415
|
title: "CPU 使用率",
|
|
46330
46416
|
value: `${cpuUsage}%`,
|
|
@@ -46366,7 +46452,7 @@ var createOSInfo = (more = false) => {
|
|
|
46366
46452
|
const buildUptime = Date.now() - buildStartTimestamp;
|
|
46367
46453
|
const buildUptimeStr = formatUptime(Math.floor(buildUptime / 1000));
|
|
46368
46454
|
const maxRunTime = useKey("CNB_PIPELINE_MAX_RUN_TIME") || 0;
|
|
46369
|
-
|
|
46455
|
+
labels2.push({
|
|
46370
46456
|
key: "buildStartTime",
|
|
46371
46457
|
title: "构建启动时间",
|
|
46372
46458
|
value: buildStartTime,
|
|
@@ -46385,13 +46471,13 @@ var createOSInfo = (more = false) => {
|
|
|
46385
46471
|
timeTo4 = today4am.add(1, "day").valueOf() - now.valueOf();
|
|
46386
46472
|
}
|
|
46387
46473
|
const timeTo4Str = `[距离晚上4点重启时间: ${formatUptime(Math.floor(timeTo4 / 1000))}]`;
|
|
46388
|
-
|
|
46474
|
+
labels2.push({
|
|
46389
46475
|
key: "buildMaxRunTime",
|
|
46390
46476
|
title: "最大运行时间",
|
|
46391
46477
|
value: formatUptime(Math.floor(maxRunTime / 1000)),
|
|
46392
46478
|
description: "构建最大运行时间(限制时间)"
|
|
46393
46479
|
});
|
|
46394
|
-
|
|
46480
|
+
labels2.unshift({
|
|
46395
46481
|
key: "remainingTime",
|
|
46396
46482
|
title: "剩余时间",
|
|
46397
46483
|
value: maxRunTime - buildUptime,
|
|
@@ -46401,7 +46487,7 @@ var createOSInfo = (more = false) => {
|
|
|
46401
46487
|
}
|
|
46402
46488
|
if (more) {
|
|
46403
46489
|
const loadavg = os2.loadavg();
|
|
46404
|
-
|
|
46490
|
+
labels2.push({
|
|
46405
46491
|
key: "hostname",
|
|
46406
46492
|
title: "主机名",
|
|
46407
46493
|
value: os2.hostname(),
|
|
@@ -46438,7 +46524,7 @@ var createOSInfo = (more = false) => {
|
|
|
46438
46524
|
description: "系统负载 (15分钟)"
|
|
46439
46525
|
});
|
|
46440
46526
|
}
|
|
46441
|
-
return
|
|
46527
|
+
return labels2;
|
|
46442
46528
|
};
|
|
46443
46529
|
|
|
46444
46530
|
// agent/routes/cnb-board/cnb-dev-env.ts
|
|
@@ -46475,7 +46561,7 @@ app.route({
|
|
|
46475
46561
|
if (notCNBCheck(ctx))
|
|
46476
46562
|
return;
|
|
46477
46563
|
const repoNameFromSlug = repoSlug.split("/").pop() || "";
|
|
46478
|
-
const
|
|
46564
|
+
const labels2 = [
|
|
46479
46565
|
{
|
|
46480
46566
|
title: "CNB_REPO_SLUG",
|
|
46481
46567
|
value: repoSlug,
|
|
@@ -46509,7 +46595,7 @@ app.route({
|
|
|
46509
46595
|
];
|
|
46510
46596
|
ctx.body = {
|
|
46511
46597
|
title: "CNB_BOARD_LIVE_REPO_INFO",
|
|
46512
|
-
list:
|
|
46598
|
+
list: labels2
|
|
46513
46599
|
};
|
|
46514
46600
|
}).addTo(app);
|
|
46515
46601
|
app.route({
|
|
@@ -46520,7 +46606,7 @@ app.route({
|
|
|
46520
46606
|
}).define(async (ctx) => {
|
|
46521
46607
|
if (notCNBCheck(ctx))
|
|
46522
46608
|
return;
|
|
46523
|
-
const
|
|
46609
|
+
const labels2 = [
|
|
46524
46610
|
{
|
|
46525
46611
|
title: "CNB_BUILD_ID",
|
|
46526
46612
|
value: useKey("CNB_BUILD_ID") || "",
|
|
@@ -46654,7 +46740,7 @@ app.route({
|
|
|
46654
46740
|
];
|
|
46655
46741
|
ctx.body = {
|
|
46656
46742
|
title: "CNB_BOARD_LIVE_BUILD_INFO",
|
|
46657
|
-
list:
|
|
46743
|
+
list: labels2
|
|
46658
46744
|
};
|
|
46659
46745
|
}).addTo(app);
|
|
46660
46746
|
app.route({
|
|
@@ -46663,7 +46749,7 @@ app.route({
|
|
|
46663
46749
|
description: "获取cnb-board live的PR信息",
|
|
46664
46750
|
middleware: ["auth-admin"]
|
|
46665
46751
|
}).define(async (ctx) => {
|
|
46666
|
-
const
|
|
46752
|
+
const labels2 = [
|
|
46667
46753
|
{
|
|
46668
46754
|
title: "CNB_PULL_REQUEST",
|
|
46669
46755
|
value: useKey("CNB_PULL_REQUEST") || "",
|
|
@@ -46752,7 +46838,7 @@ app.route({
|
|
|
46752
46838
|
];
|
|
46753
46839
|
ctx.body = {
|
|
46754
46840
|
title: "CNB_BOARD_LIVE_PULL_INFO",
|
|
46755
|
-
list:
|
|
46841
|
+
list: labels2
|
|
46756
46842
|
};
|
|
46757
46843
|
}).addTo(app);
|
|
46758
46844
|
app.route({
|
|
@@ -46763,7 +46849,7 @@ app.route({
|
|
|
46763
46849
|
}).define(async (ctx) => {
|
|
46764
46850
|
if (notCNBCheck(ctx))
|
|
46765
46851
|
return;
|
|
46766
|
-
const
|
|
46852
|
+
const labels2 = [
|
|
46767
46853
|
{
|
|
46768
46854
|
title: "CNB_NPC_SLUG",
|
|
46769
46855
|
value: useKey("CNB_NPC_SLUG") || "",
|
|
@@ -46797,7 +46883,7 @@ app.route({
|
|
|
46797
46883
|
];
|
|
46798
46884
|
ctx.body = {
|
|
46799
46885
|
title: "CNB_BOARD_LIVE_NPC_INFO",
|
|
46800
|
-
list:
|
|
46886
|
+
list: labels2
|
|
46801
46887
|
};
|
|
46802
46888
|
}).addTo(app);
|
|
46803
46889
|
app.route({
|
|
@@ -46808,7 +46894,7 @@ app.route({
|
|
|
46808
46894
|
}).define(async (ctx) => {
|
|
46809
46895
|
if (notCNBCheck(ctx))
|
|
46810
46896
|
return;
|
|
46811
|
-
const
|
|
46897
|
+
const labels2 = [
|
|
46812
46898
|
{
|
|
46813
46899
|
title: "CNB_COMMENT_ID",
|
|
46814
46900
|
value: useKey("CNB_COMMENT_ID") || "",
|
|
@@ -46842,7 +46928,7 @@ app.route({
|
|
|
46842
46928
|
];
|
|
46843
46929
|
ctx.body = {
|
|
46844
46930
|
title: "CNB_BOARD_LIVE_COMMENT_INFO",
|
|
46845
|
-
list:
|
|
46931
|
+
list: labels2
|
|
46846
46932
|
};
|
|
46847
46933
|
}).addTo(app);
|
|
46848
46934
|
|
|
@@ -53016,7 +53102,7 @@ app.route({
|
|
|
53016
53102
|
}
|
|
53017
53103
|
}).addTo(app, { overwrite: false });
|
|
53018
53104
|
|
|
53019
|
-
// ../../node_modules/.pnpm/@kevisual+router@0.1.
|
|
53105
|
+
// ../../node_modules/.pnpm/@kevisual+router@0.1.3/node_modules/@kevisual/router/dist/opencode.js
|
|
53020
53106
|
import { createRequire as createRequire4 } from "node:module";
|
|
53021
53107
|
import { webcrypto as crypto2 } from "node:crypto";
|
|
53022
53108
|
var __create4 = Object.create;
|