@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/routes.d.ts
CHANGED
|
@@ -514,7 +514,7 @@ type IssueAssignee = {
|
|
|
514
514
|
nickname: string;
|
|
515
515
|
username: string;
|
|
516
516
|
};
|
|
517
|
-
type
|
|
517
|
+
type IssueLabelItem = {
|
|
518
518
|
color: string;
|
|
519
519
|
description: string;
|
|
520
520
|
id: string;
|
|
@@ -557,7 +557,7 @@ type IssueComment = {
|
|
|
557
557
|
type IssueItem = {
|
|
558
558
|
assignees: IssueAssignee[];
|
|
559
559
|
author: IssueAuthor;
|
|
560
|
-
labels:
|
|
560
|
+
labels: IssueLabelItem[];
|
|
561
561
|
body: string;
|
|
562
562
|
last_acted_at: string;
|
|
563
563
|
number: string;
|
|
@@ -831,6 +831,141 @@ declare class AiBase extends CNBCore {
|
|
|
831
831
|
}): Promise<Result<any>>;
|
|
832
832
|
}
|
|
833
833
|
|
|
834
|
+
/**
|
|
835
|
+
* 标签基础类型
|
|
836
|
+
*/
|
|
837
|
+
type Label = {
|
|
838
|
+
/** 标签 ID */
|
|
839
|
+
id: string;
|
|
840
|
+
/** 标签名称 */
|
|
841
|
+
name: string;
|
|
842
|
+
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
843
|
+
color: string;
|
|
844
|
+
/** 标签描述 */
|
|
845
|
+
description: string;
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* 创建标签的表单数据
|
|
849
|
+
*/
|
|
850
|
+
type PostLabelForm = {
|
|
851
|
+
/** 标签名称 */
|
|
852
|
+
name: string;
|
|
853
|
+
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
854
|
+
color: string;
|
|
855
|
+
/** 标签描述 */
|
|
856
|
+
description?: string;
|
|
857
|
+
};
|
|
858
|
+
/**
|
|
859
|
+
* 更新标签的表单数据
|
|
860
|
+
*/
|
|
861
|
+
type PatchLabelForm = {
|
|
862
|
+
/** 标签颜色(十六进制颜色码,不含 # 前缀) */
|
|
863
|
+
color?: string;
|
|
864
|
+
/** 标签描述 */
|
|
865
|
+
description?: string;
|
|
866
|
+
/** 新标签名称 */
|
|
867
|
+
new_name?: string;
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* 设置 Issue 标签的表单数据(完全替换)
|
|
871
|
+
*/
|
|
872
|
+
type PutIssueLabelsForm = {
|
|
873
|
+
/** 标签名称数组 */
|
|
874
|
+
labels: string[];
|
|
875
|
+
};
|
|
876
|
+
/**
|
|
877
|
+
* 新增 Issue 标签的表单数据(追加)
|
|
878
|
+
*/
|
|
879
|
+
type PostIssueLabelsForm = {
|
|
880
|
+
/** 标签名称数组 */
|
|
881
|
+
labels: string[];
|
|
882
|
+
};
|
|
883
|
+
/**
|
|
884
|
+
* 仓库标签管理
|
|
885
|
+
*/
|
|
886
|
+
declare class RepoLabel extends CNBCore {
|
|
887
|
+
constructor(options: CNBCoreOptions);
|
|
888
|
+
/**
|
|
889
|
+
* 查询仓库的标签列表
|
|
890
|
+
* @param repo 仓库路径
|
|
891
|
+
* @param params 分页和搜索参数
|
|
892
|
+
*/
|
|
893
|
+
list(repo: string, params?: ListLabelsParams): Promise<Result<Label[]>>;
|
|
894
|
+
/**
|
|
895
|
+
* 创建一个标签
|
|
896
|
+
* @param repo 仓库路径
|
|
897
|
+
* @param data 标签数据
|
|
898
|
+
*/
|
|
899
|
+
create(repo: string, data: PostLabelForm): Promise<Result<Label>>;
|
|
900
|
+
/**
|
|
901
|
+
* 更新标签信息
|
|
902
|
+
* @param repo 仓库路径
|
|
903
|
+
* @param name 标签名称
|
|
904
|
+
* @param data 更新数据
|
|
905
|
+
*/
|
|
906
|
+
update(repo: string, name: string, data: PatchLabelForm): Promise<Result<Label>>;
|
|
907
|
+
/**
|
|
908
|
+
* 删除指定的仓库标签
|
|
909
|
+
* @param repo 仓库路径
|
|
910
|
+
* @param name 标签名称
|
|
911
|
+
*/
|
|
912
|
+
remove(repo: string, name: string): Promise<Result<void>>;
|
|
913
|
+
}
|
|
914
|
+
type ListLabelsParams = {
|
|
915
|
+
/** 分页页码 */
|
|
916
|
+
page?: number;
|
|
917
|
+
/** 分页每页大小 */
|
|
918
|
+
page_size?: number;
|
|
919
|
+
/** 标签搜索关键词 */
|
|
920
|
+
keyword?: string;
|
|
921
|
+
};
|
|
922
|
+
/**
|
|
923
|
+
* Issue 标签管理
|
|
924
|
+
*/
|
|
925
|
+
declare class IssueLabel extends CNBCore {
|
|
926
|
+
constructor(options: CNBCoreOptions);
|
|
927
|
+
/**
|
|
928
|
+
* 查询 issue 的标签列表
|
|
929
|
+
* @param repo 仓库路径
|
|
930
|
+
* @param number Issue 编号
|
|
931
|
+
* @param params 分页参数
|
|
932
|
+
*/
|
|
933
|
+
list(repo: string, number: string | number, params?: ListIssueLabelsParams): Promise<Result<Label[]>>;
|
|
934
|
+
/**
|
|
935
|
+
* 设置 issue 标签(完全替换现有标签)
|
|
936
|
+
* @param repo 仓库路径
|
|
937
|
+
* @param number Issue 编号
|
|
938
|
+
* @param data 标签数据
|
|
939
|
+
*/
|
|
940
|
+
set(repo: string, number: string | number, data: PutIssueLabelsForm): Promise<Result<Label>>;
|
|
941
|
+
/**
|
|
942
|
+
* 新增 issue 标签(追加到现有标签)
|
|
943
|
+
* @param repo 仓库路径
|
|
944
|
+
* @param number Issue 编号
|
|
945
|
+
* @param data 标签数据
|
|
946
|
+
*/
|
|
947
|
+
add(repo: string, number: string | number, data: PostIssueLabelsForm): Promise<Result<Label>>;
|
|
948
|
+
/**
|
|
949
|
+
* 清空 issue 标签(移除所有标签)
|
|
950
|
+
* @param repo 仓库路径
|
|
951
|
+
* @param number Issue 编号
|
|
952
|
+
*/
|
|
953
|
+
clear(repo: string, number: string | number): Promise<Result<void>>;
|
|
954
|
+
/**
|
|
955
|
+
* 删除 issue 标签(移除指定标签)
|
|
956
|
+
* @param repo 仓库路径
|
|
957
|
+
* @param number Issue 编号
|
|
958
|
+
* @param name 标签名称
|
|
959
|
+
*/
|
|
960
|
+
remove(repo: string, number: string | number, name: string): Promise<Result<void>>;
|
|
961
|
+
}
|
|
962
|
+
type ListIssueLabelsParams = {
|
|
963
|
+
/** 分页页码 */
|
|
964
|
+
page?: number;
|
|
965
|
+
/** 分页每页大小 */
|
|
966
|
+
page_size?: number;
|
|
967
|
+
};
|
|
968
|
+
|
|
834
969
|
type CNBOptions = CNBCoreOptions<{}>;
|
|
835
970
|
declare class CNB extends CNBCore {
|
|
836
971
|
workspace: Workspace;
|
|
@@ -841,12 +976,23 @@ declare class CNB extends CNBCore {
|
|
|
841
976
|
issue: Issue;
|
|
842
977
|
mission: Mission;
|
|
843
978
|
ai: AiBase;
|
|
979
|
+
labels: {
|
|
980
|
+
repoLabel: RepoLabel;
|
|
981
|
+
issueLabel: IssueLabel;
|
|
982
|
+
};
|
|
844
983
|
constructor(options: CNBOptions);
|
|
845
984
|
init(cnbOptions?: CNBOptions): void;
|
|
846
985
|
setToken(token: string): void;
|
|
847
986
|
setCookie(cookie: string): void;
|
|
987
|
+
getCNBVersion: () => Promise<VersionInfo>;
|
|
848
988
|
}
|
|
849
989
|
|
|
990
|
+
type VersionInfo = {
|
|
991
|
+
version: string;
|
|
992
|
+
commitID: string;
|
|
993
|
+
hash: string;
|
|
994
|
+
};
|
|
995
|
+
|
|
850
996
|
type CNBItem = {
|
|
851
997
|
username: string;
|
|
852
998
|
token: string;
|
package/dist/routes.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
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevisual/cnb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.53",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"basename": "/root/cnb",
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "bun bun.config.ts",
|
|
14
14
|
"flow": "ev npm patch && pnpm build && ev npm publish npm -p",
|
|
15
|
+
"cli": "bun agent/cli.ts ",
|
|
15
16
|
"compile": "bun build --compile --minify agent/commander.ts --outfile=./dist/cnb ",
|
|
16
17
|
"pub": "ev pack -u -m false -c -p"
|
|
17
18
|
},
|
|
@@ -57,7 +58,7 @@
|
|
|
57
58
|
},
|
|
58
59
|
"dependencies": {
|
|
59
60
|
"@kevisual/query": "^0.0.53",
|
|
60
|
-
"@kevisual/router": "^0.1.
|
|
61
|
+
"@kevisual/router": "^0.1.3",
|
|
61
62
|
"@kevisual/use-config": "^1.0.30",
|
|
62
63
|
"@opencode-ai/sdk": "^1.2.27",
|
|
63
64
|
"es-toolkit": "^1.45.1",
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,7 @@ import { Build } from "./build/index.ts";
|
|
|
7
7
|
import { Issue } from "./issue/index.ts";
|
|
8
8
|
import { Mission } from "./mission/index.ts";
|
|
9
9
|
import { AiBase } from "./ai/index.ts";
|
|
10
|
+
import { RepoLabel, IssueLabel } from "./labels/index.ts";
|
|
10
11
|
|
|
11
12
|
type CNBOptions = CNBCoreOptions<{
|
|
12
13
|
}>;
|
|
@@ -20,6 +21,10 @@ export class CNB extends CNBCore {
|
|
|
20
21
|
issue!: Issue;
|
|
21
22
|
mission!: Mission;
|
|
22
23
|
ai!: AiBase;
|
|
24
|
+
labels!: {
|
|
25
|
+
repoLabel: RepoLabel;
|
|
26
|
+
issueLabel: IssueLabel;
|
|
27
|
+
};
|
|
23
28
|
constructor(options: CNBOptions) {
|
|
24
29
|
super({ ...options, token: options.token, cookie: options.cookie, cnb: options.cnb });
|
|
25
30
|
this.init(options);
|
|
@@ -38,6 +43,10 @@ export class CNB extends CNBCore {
|
|
|
38
43
|
this.issue = new Issue(options);
|
|
39
44
|
this.mission = new Mission(options);
|
|
40
45
|
this.ai = new AiBase(options);
|
|
46
|
+
this.labels = {
|
|
47
|
+
repoLabel: new RepoLabel(options),
|
|
48
|
+
issueLabel: new IssueLabel(options),
|
|
49
|
+
};
|
|
41
50
|
}
|
|
42
51
|
setToken(token: string) {
|
|
43
52
|
this.token = token;
|
|
@@ -47,6 +56,8 @@ export class CNB extends CNBCore {
|
|
|
47
56
|
this.build.token = token;
|
|
48
57
|
this.issue.token = token;
|
|
49
58
|
this.mission.token = token;
|
|
59
|
+
this.labels.repoLabel.token = token;
|
|
60
|
+
this.labels.issueLabel.token = token;
|
|
50
61
|
}
|
|
51
62
|
setCookie(cookie: string) {
|
|
52
63
|
this.cookie = cookie;
|
|
@@ -56,7 +67,10 @@ export class CNB extends CNBCore {
|
|
|
56
67
|
this.build.cookie = cookie;
|
|
57
68
|
this.issue.cookie = cookie;
|
|
58
69
|
this.mission.cookie = cookie;
|
|
70
|
+
this.labels.repoLabel.cookie = cookie;
|
|
71
|
+
this.labels.issueLabel.cookie = cookie;
|
|
59
72
|
}
|
|
73
|
+
getCNBVersion = getCNBVersion
|
|
60
74
|
}
|
|
61
75
|
|
|
62
76
|
export * from './workspace/index.ts'
|
|
@@ -80,4 +94,5 @@ type VersionInfo = {
|
|
|
80
94
|
hash: string;
|
|
81
95
|
}
|
|
82
96
|
|
|
83
|
-
export * from './issue/npc/env.ts'
|
|
97
|
+
export * from './issue/npc/env.ts'
|
|
98
|
+
export * from './labels/index.ts'
|
package/src/issue/index.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type IssueAssignee = {
|
|
|
5
5
|
nickname: string;
|
|
6
6
|
username: string;
|
|
7
7
|
};
|
|
8
|
-
export type
|
|
8
|
+
export type IssueLabelItem = {
|
|
9
9
|
color: string;
|
|
10
10
|
description: string;
|
|
11
11
|
id: string;
|
|
@@ -56,7 +56,7 @@ export type IssueComment = {
|
|
|
56
56
|
export type IssueItem = {
|
|
57
57
|
assignees: IssueAssignee[];
|
|
58
58
|
author: IssueAuthor;
|
|
59
|
-
labels:
|
|
59
|
+
labels: IssueLabelItem[];
|
|
60
60
|
|
|
61
61
|
body: string;
|
|
62
62
|
last_acted_at: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './repo-label.ts';
|