@kevisual/cnb 0.0.52 → 0.0.54

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/routes.d.ts CHANGED
@@ -514,7 +514,7 @@ type IssueAssignee = {
514
514
  nickname: string;
515
515
  username: string;
516
516
  };
517
- type IssueLabel = {
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: IssueLabel[];
560
+ labels: IssueLabelItem[];
561
561
  body: string;
562
562
  last_acted_at: string;
563
563
  number: string;
@@ -701,6 +701,93 @@ type AliveMetadata = {
701
701
  }[];
702
702
  };
703
703
 
704
+ declare const fields: readonly [{
705
+ readonly name: "resource_type";
706
+ readonly interaction_type: "radio";
707
+ readonly operators: readonly [];
708
+ readonly value: readonly ["issues", "pull_requests"];
709
+ }, {
710
+ readonly name: "started_at";
711
+ readonly interaction_type: "time_selector";
712
+ readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
713
+ readonly value: readonly [];
714
+ }, {
715
+ readonly name: "ended_at";
716
+ readonly interaction_type: "time_selector";
717
+ readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
718
+ readonly value: readonly [];
719
+ }, {
720
+ readonly name: "closed_at";
721
+ readonly interaction_type: "time_selector";
722
+ readonly operators: readonly ["equals", "before", "after", "empty", "not_empty"];
723
+ readonly value: readonly [];
724
+ }, {
725
+ readonly name: "assignee";
726
+ readonly interaction_type: "checkbox";
727
+ readonly operators: readonly ["contains", "contains_all", "not_contains", "equals", "not_equals", "empty", "not_empty"];
728
+ readonly value: readonly [{
729
+ readonly id: "";
730
+ readonly user_name: "";
731
+ readonly nick_name: "";
732
+ readonly user_type: 0;
733
+ }, {
734
+ readonly id: "2026622946958528512";
735
+ readonly user_name: "cnb.cAiAVfFPgKA";
736
+ readonly nick_name: "里海暗红色";
737
+ readonly user_type: 0;
738
+ }, {
739
+ readonly id: "1915352477005254656";
740
+ readonly user_name: "kevisual";
741
+ readonly nick_name: "科学和哲学";
742
+ readonly user_type: 0;
743
+ }, {
744
+ readonly id: "1935321989751226368";
745
+ readonly user_name: "xiongxiao";
746
+ readonly nick_name: "小熊猫呜呜呜";
747
+ readonly user_type: 0;
748
+ }];
749
+ }, {
750
+ readonly name: "repo";
751
+ readonly interaction_type: "checkbox";
752
+ readonly operators: readonly ["contains", "not_contains"];
753
+ readonly value: readonly ["kevisual/kevisual", "kevisual/cnb", "abearxiong/blog", "abearxiong/abearxiong"];
754
+ }, {
755
+ readonly name: "created_at";
756
+ readonly interaction_type: "time_selector";
757
+ readonly operators: readonly ["equals", "before", "after"];
758
+ readonly value: readonly [];
759
+ }, {
760
+ readonly name: "last_acted_at";
761
+ readonly interaction_type: "time_selector";
762
+ readonly operators: readonly ["equals", "before", "after"];
763
+ readonly value: readonly [];
764
+ }, {
765
+ readonly name: "priority";
766
+ readonly interaction_type: "checkbox";
767
+ readonly operators: readonly ["contains", "not_contains", "empty", "not_empty"];
768
+ readonly value: readonly ["-2P", "-1P", "P0", "P1", "P2", "P3", ""];
769
+ }, {
770
+ readonly name: "state";
771
+ readonly interaction_type: "radio";
772
+ readonly operators: readonly ["equals", "not_equals"];
773
+ readonly value: readonly ["open", "closed"];
774
+ }, {
775
+ readonly name: "label";
776
+ readonly interaction_type: "radio";
777
+ readonly operators: readonly ["equals", "not_equals"];
778
+ readonly value: readonly ["AICoding"];
779
+ }];
780
+ type FieldName = typeof fields[number]['name'];
781
+
782
+ type Selector = {
783
+ /**
784
+ * 字段名称,例如 resource_type、state 等
785
+ */
786
+ field: FieldName;
787
+ operator: 'equals' | 'not_equals' | 'contains' | 'not_contains' | 'in' | 'not_in';
788
+ value: any;
789
+ };
790
+
704
791
  declare class Mission extends CNBCore {
705
792
  constructor(options: CNBCoreOptions);
706
793
  /**
@@ -763,6 +850,13 @@ declare class Mission extends CNBCore {
763
850
  * @returns 操作结果
764
851
  */
765
852
  setVisibility(mission: string, visibility: 'Private' | 'Public'): Promise<Result<any>>;
853
+ /**
854
+ * 查询任务集资源
855
+ * @param repo 仓库路径
856
+ * @param selectors 查询条件
857
+ * @returns 资源列表
858
+ */
859
+ queryResources(repo: string, selectors?: Selector[]): Promise<any>;
766
860
  }
767
861
  type GetMissionsParams = {
768
862
  page?: number;
@@ -831,6 +925,141 @@ declare class AiBase extends CNBCore {
831
925
  }): Promise<Result<any>>;
832
926
  }
833
927
 
928
+ /**
929
+ * 标签基础类型
930
+ */
931
+ type Label = {
932
+ /** 标签 ID */
933
+ id: string;
934
+ /** 标签名称 */
935
+ name: string;
936
+ /** 标签颜色(十六进制颜色码,不含 # 前缀) */
937
+ color: string;
938
+ /** 标签描述 */
939
+ description: string;
940
+ };
941
+ /**
942
+ * 创建标签的表单数据
943
+ */
944
+ type PostLabelForm = {
945
+ /** 标签名称 */
946
+ name: string;
947
+ /** 标签颜色(十六进制颜色码,不含 # 前缀) */
948
+ color: string;
949
+ /** 标签描述 */
950
+ description?: string;
951
+ };
952
+ /**
953
+ * 更新标签的表单数据
954
+ */
955
+ type PatchLabelForm = {
956
+ /** 标签颜色(十六进制颜色码,不含 # 前缀) */
957
+ color?: string;
958
+ /** 标签描述 */
959
+ description?: string;
960
+ /** 新标签名称 */
961
+ new_name?: string;
962
+ };
963
+ /**
964
+ * 设置 Issue 标签的表单数据(完全替换)
965
+ */
966
+ type PutIssueLabelsForm = {
967
+ /** 标签名称数组 */
968
+ labels: string[];
969
+ };
970
+ /**
971
+ * 新增 Issue 标签的表单数据(追加)
972
+ */
973
+ type PostIssueLabelsForm = {
974
+ /** 标签名称数组 */
975
+ labels: string[];
976
+ };
977
+ /**
978
+ * 仓库标签管理
979
+ */
980
+ declare class RepoLabel extends CNBCore {
981
+ constructor(options: CNBCoreOptions);
982
+ /**
983
+ * 查询仓库的标签列表
984
+ * @param repo 仓库路径
985
+ * @param params 分页和搜索参数
986
+ */
987
+ list(repo: string, params?: ListLabelsParams): Promise<Result<Label[]>>;
988
+ /**
989
+ * 创建一个标签
990
+ * @param repo 仓库路径
991
+ * @param data 标签数据
992
+ */
993
+ create(repo: string, data: PostLabelForm): Promise<Result<Label>>;
994
+ /**
995
+ * 更新标签信息
996
+ * @param repo 仓库路径
997
+ * @param name 标签名称
998
+ * @param data 更新数据
999
+ */
1000
+ update(repo: string, name: string, data: PatchLabelForm): Promise<Result<Label>>;
1001
+ /**
1002
+ * 删除指定的仓库标签
1003
+ * @param repo 仓库路径
1004
+ * @param name 标签名称
1005
+ */
1006
+ remove(repo: string, name: string): Promise<Result<void>>;
1007
+ }
1008
+ type ListLabelsParams = {
1009
+ /** 分页页码 */
1010
+ page?: number;
1011
+ /** 分页每页大小 */
1012
+ page_size?: number;
1013
+ /** 标签搜索关键词 */
1014
+ keyword?: string;
1015
+ };
1016
+ /**
1017
+ * Issue 标签管理
1018
+ */
1019
+ declare class IssueLabel extends CNBCore {
1020
+ constructor(options: CNBCoreOptions);
1021
+ /**
1022
+ * 查询 issue 的标签列表
1023
+ * @param repo 仓库路径
1024
+ * @param number Issue 编号
1025
+ * @param params 分页参数
1026
+ */
1027
+ list(repo: string, number: string | number, params?: ListIssueLabelsParams): Promise<Result<Label[]>>;
1028
+ /**
1029
+ * 设置 issue 标签(完全替换现有标签)
1030
+ * @param repo 仓库路径
1031
+ * @param number Issue 编号
1032
+ * @param data 标签数据
1033
+ */
1034
+ set(repo: string, number: string | number, data: PutIssueLabelsForm): Promise<Result<Label>>;
1035
+ /**
1036
+ * 新增 issue 标签(追加到现有标签)
1037
+ * @param repo 仓库路径
1038
+ * @param number Issue 编号
1039
+ * @param data 标签数据
1040
+ */
1041
+ add(repo: string, number: string | number, data: PostIssueLabelsForm): Promise<Result<Label>>;
1042
+ /**
1043
+ * 清空 issue 标签(移除所有标签)
1044
+ * @param repo 仓库路径
1045
+ * @param number Issue 编号
1046
+ */
1047
+ clear(repo: string, number: string | number): Promise<Result<void>>;
1048
+ /**
1049
+ * 删除 issue 标签(移除指定标签)
1050
+ * @param repo 仓库路径
1051
+ * @param number Issue 编号
1052
+ * @param name 标签名称
1053
+ */
1054
+ remove(repo: string, number: string | number, name: string): Promise<Result<void>>;
1055
+ }
1056
+ type ListIssueLabelsParams = {
1057
+ /** 分页页码 */
1058
+ page?: number;
1059
+ /** 分页每页大小 */
1060
+ page_size?: number;
1061
+ };
1062
+
834
1063
  type CNBOptions = CNBCoreOptions<{}>;
835
1064
  declare class CNB extends CNBCore {
836
1065
  workspace: Workspace;
@@ -841,12 +1070,23 @@ declare class CNB extends CNBCore {
841
1070
  issue: Issue;
842
1071
  mission: Mission;
843
1072
  ai: AiBase;
1073
+ labels: {
1074
+ repoLabel: RepoLabel;
1075
+ issueLabel: IssueLabel;
1076
+ };
844
1077
  constructor(options: CNBOptions);
845
1078
  init(cnbOptions?: CNBOptions): void;
846
1079
  setToken(token: string): void;
847
1080
  setCookie(cookie: string): void;
1081
+ getCNBVersion: () => Promise<VersionInfo>;
848
1082
  }
849
1083
 
1084
+ type VersionInfo = {
1085
+ version: string;
1086
+ commitID: string;
1087
+ hash: string;
1088
+ };
1089
+
850
1090
  type CNBItem = {
851
1091
  username: string;
852
1092
  token: string;