@candriajs/git-neko-kit 0.8.7 → 0.9.0

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/index.d.ts CHANGED
@@ -1,28 +1,4 @@
1
1
  import { RawAxiosResponseHeaders, AxiosResponseHeaders } from 'axios';
2
- import { ExecException, exec } from 'child_process';
3
-
4
- /**
5
- * 获取本地仓库的默认分支
6
- * @param local_path - 本地仓库路径
7
- * @returns 默认分支名称
8
- * @example
9
- * ```ts
10
- * console.log(await get_local_repo_default_branch('/path/to/repo'))
11
- * -> 'main'
12
- * ```
13
- */
14
- declare function get_local_repo_default_branch(local_path: string): Promise<string>;
15
- /**
16
- * 获取远程仓库的默认分支
17
- * @param remote_url - 远程仓库URL
18
- * @returns 默认分支名称
19
- * @example
20
- * ```ts
21
- * console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit'))
22
- * -> 'main'
23
- * ```
24
- */
25
- declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
26
2
 
27
3
  /** 代理地址类型 */
28
4
  type ProxyUrlType = string;
@@ -32,55 +8,67 @@ type ProxyUrlType = string;
32
8
  * - original: 原始代理
33
9
  * - common: 通用代理
34
10
  */
35
- type ProxyType = 'reverse' | 'original' | 'common';
11
+ declare enum ProxyType {
12
+ /** 反向代理 */
13
+ Reverse = "reverse",
14
+ /** 原始代理 */
15
+ Original = "original",
16
+ /** 通用代理 */
17
+ Common = "common"
18
+ }
36
19
  /** Git类型 */
37
20
  type GitType = 'github' | 'gitee' | 'gitcode';
38
- /**
39
- * 通用代理配置
40
- */
41
- interface CommonProxyType {
42
- type: 'common';
43
- /** 代理基础地址 */
44
- address: ProxyUrlType;
45
- }
46
- /**
47
- * 反向代理配置
48
- */
49
- interface ReverseProxyType {
50
- type: 'reverse';
51
- /** 代理基础地址 */
52
- address: ProxyUrlType;
53
- }
54
- /**
55
- * HTTP 代理配置
56
- */
57
- interface HttpProxyType {
58
- type: 'http';
59
- address: ProxyUrlType;
21
+ /** 代理协议类型 */
22
+ declare enum ProxyProtocol {
23
+ /** HTTP */
24
+ HTTP = "http",
25
+ /** HTTPS */
26
+ HTTPS = "https",
27
+ /** SOCKS */
28
+ SOCKS = "socks",
29
+ /** SOCKS5 */
30
+ SOCKS5 = "socks5"
60
31
  }
61
32
  /**
62
- * HTTPS 代理配置
33
+ * 基本代理配置
34
+ * @typeparam T - 代理类型或协议类型
63
35
  */
64
- interface HttpsProxyType {
65
- type: 'https';
36
+ interface BaseProxyType<T extends ProxyType | ProxyProtocol> {
37
+ type: T;
66
38
  address: ProxyUrlType;
67
39
  }
68
- /**
69
- * SOCKS5 代理配置
70
- */
71
- interface SocksProxyType {
72
- type: 'socks';
73
- address: ProxyUrlType;
40
+ /** 代理配置参数类型 */
41
+ type ProxyParamsType = BaseProxyType<ProxyProtocol.HTTP> | BaseProxyType<ProxyProtocol.HTTPS> | BaseProxyType<ProxyProtocol.SOCKS> | BaseProxyType<ProxyProtocol.SOCKS5> | BaseProxyType<ProxyType.Common> | BaseProxyType<ProxyType.Reverse>;
42
+
43
+ /** 本地Git仓库信息 */
44
+ interface LocalGitInfoType {
45
+ /** 文件夹名称 */
46
+ name: string;
47
+ /** 文件夹路径 */
48
+ path: string;
49
+ /**
50
+ * git地址,原始地址可能是反代的地址
51
+ * */
52
+ url: string;
53
+ /**
54
+ * 仓库地址, 这个是经过处理的,保证是不经过任何代理地址的地址
55
+ * */
56
+ html_url: string;
57
+ /** 仓库名称 */
58
+ owner: string;
59
+ /** 仓库名称 */
60
+ repo: string;
74
61
  }
75
- /**
76
- * SOCKS5 代理配置
77
- */
78
- interface Socks5ProxyType {
79
- type: 'socks5';
80
- address: ProxyUrlType;
62
+ /** 获取本地路径的Git仓库信息列表 */
63
+ type LocalGitInfoListType = Array<LocalGitInfoType>;
64
+ interface LocalGitInfoListOptionsType {
65
+ /** 是否递归查找 */
66
+ loop?: boolean;
67
+ /** 递归最大深度 */
68
+ maxDepth?: number;
69
+ /** 忽略目录 */
70
+ dir?: string[];
81
71
  }
82
- /** 代理配置参数类型 */
83
- type ProxyParamsType = HttpProxyType | HttpsProxyType | SocksProxyType | Socks5ProxyType | CommonProxyType | ReverseProxyType;
84
72
 
85
73
  interface PkgInfoType {
86
74
  /** 包名 */
@@ -122,6 +110,14 @@ interface ApiResponseType<D = any> extends Omit<ResponseType<D>, 'headers'> {
122
110
  status: 'ok' | 'error';
123
111
  }
124
112
 
113
+ interface GitRepoType {
114
+ /** 仓库的地址 */
115
+ html_url: string;
116
+ /** 仓库的拥有者 */
117
+ owner: string;
118
+ /** 仓库的名称 */
119
+ repo: string;
120
+ }
125
121
  /**
126
122
  * 单日贡献数据
127
123
  */
@@ -143,34 +139,6 @@ interface ContributionResult {
143
139
  */
144
140
  contributions: ContributionData[][];
145
141
  }
146
- /**
147
- * 执行 shell 命令返回类型
148
- */
149
- interface ExecType {
150
- /** 是否执行成功 */
151
- status: boolean;
152
- /** 错误对象,如果命令执行失败则包含错误信息 */
153
- error: ExecException | null;
154
- /** 标准错误输出 */
155
- stderr: string;
156
- /** 标准输出 */
157
- stdout: string;
158
- }
159
- /**
160
- * 执行 shell 命令返回类型泛型
161
- */
162
- type ExecReturn<K extends boolean> = K extends true ? boolean : ExecType;
163
- /**
164
- * 执行 shell 命令参数
165
- */
166
- type ExecOptions<T extends boolean> = Parameters<typeof exec>[1] & {
167
- /** 是否打印日志 默认不打印 */
168
- log?: boolean;
169
- /** 是否只返回布尔值 表示命令是否成功执行 优先级比抛错误高 */
170
- booleanResult?: T;
171
- /** 是否去除日志中的换行符 默认不去除 */
172
- trim?: boolean;
173
- };
174
142
 
175
143
  interface AccessTokenType {
176
144
  /** 访问令牌 */
@@ -245,6 +213,13 @@ interface PullRequestNumberParamType {
245
213
  /** 拉取请求id */
246
214
  pr_number: number;
247
215
  }
216
+ /**
217
+ * 工作流参数
218
+ */
219
+ interface workflowIdParamType {
220
+ /** 工作流id */
221
+ workflow_id: number | string;
222
+ }
248
223
  /**
249
224
  * 角色名称参数
250
225
  * - 角色名称
@@ -333,10 +308,6 @@ interface GitUser extends Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers
333
308
  /** 日期字符串 */
334
309
  date: string;
335
310
  }
336
- /**
337
- * 验证信息类型
338
- * 这个只有GitHub平台返回
339
- */
340
311
  interface Commit$1 {
341
312
  /** 提交的URL */
342
313
  url: string;
@@ -437,7 +408,7 @@ type CommitListParamType = RepoParamType & {
437
408
  type CommitListResponseType = CommitInfoResponseType[];
438
409
 
439
410
  /** 仓库所有者参数类型 */
440
- type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos'>;
411
+ type RepoUser = Omit<UserInfoResponseType, 'followers' | 'following' | 'blog' | 'bio' | 'public_repos' | 'email'>;
441
412
  /** 仓库列表参数类型 */
442
413
  interface RepoListBaseParamType {
443
414
  /** 排序方式,可选created, updated, pushed, full_name, 默认为 full_name */
@@ -869,7 +840,7 @@ interface CreateAccessTokenForAppParamType {
869
840
  interface CreateAccessTokenForAppResponseType {
870
841
  /** 访问令牌 */
871
842
  token: string;
872
- /** 访问令牌过期时间 */
843
+ /** 访问令牌过期时间, UTC 时间格式 */
873
844
  expires_at: string;
874
845
  /** 访问令牌权限 */
875
846
  permissions: Record<string, string>;
@@ -885,6 +856,8 @@ interface RevokeAccessTokenResponseType {
885
856
  /** 撤销结果信息 */
886
857
  message: string;
887
858
  }
859
+ /** 判断应用程序是否安装在仓库中参数类型 */
860
+ type isAppInstalledInRepo = RepoBaseParamType;
888
861
 
889
862
  /** Github 授权令牌接口返回类型 */
890
863
  interface TokenResponseType {
@@ -932,6 +905,97 @@ interface CheckTokenResponseType {
932
905
  message: string;
933
906
  }
934
907
 
908
+ /** 工作流状态 */
909
+ declare const enum WorkflowState {
910
+ /** 工作流已激活 */
911
+ Active = "active",
912
+ /** 工作流已删除 */
913
+ Deleted = "deleted",
914
+ /** for仓库未启用工作流 */
915
+ DisabledFork = "disabled_fork",
916
+ /** 工作流已禁用(因为超过30天未使用) */
917
+ DisabledInactivity = "disabled_inactivity",
918
+ /** 工作流已禁用(手动) */
919
+ DisabledManually = "disabled_manually"
920
+ }
921
+ /** 工作流信息参数类型 */
922
+ type WorkflowInfoParamType = RepoBaseParamType & workflowIdParamType;
923
+ /** 工作流信息响应类型 */
924
+ interface WorkflowInfoResponseType {
925
+ /** 工作流id */
926
+ id: number;
927
+ /** 工作流所属仓库的URL */
928
+ html_url: string;
929
+ /** 工作流名称 */
930
+ name: string;
931
+ /** 工作流文件路径 */
932
+ path: string;
933
+ /** 工作流状态 */
934
+ state: WorkflowState;
935
+ /** 工作流创建时间 */
936
+ created_at: string;
937
+ /** 工作流更新时间 */
938
+ updated_at: string;
939
+ }
940
+ /** 获取仓库工作流列表参数类型 */
941
+ interface GetRepoWorkflowsList extends RepoBaseParamType {
942
+ /** 每页数量 */
943
+ per_page?: number;
944
+ /** 页码 */
945
+ page?: number;
946
+ }
947
+ /** 获取仓库工作流列表响应类型 */
948
+ interface GetRepoWorkflowsListResponseType {
949
+ /** 总数 */
950
+ total: number;
951
+ /** 工作流列表 */
952
+ workflows: WorkflowInfoResponseType[];
953
+ }
954
+ /** 运行仓库工作流参数类型 */
955
+ interface RunRepoWorkflow extends WorkflowInfoParamType {
956
+ /** 分支或者标签名称 */
957
+ ref: string;
958
+ /** 工作流输入参数, 该参数最多10个 */
959
+ inputs?: Record<string, string | number>;
960
+ }
961
+ /** 运行仓库工作流响应类型 */
962
+ interface RunRepoWorkflowResponseType {
963
+ /** 是否成功 */
964
+ success: boolean;
965
+ /** 运行状态信息 */
966
+ message: string;
967
+ }
968
+ /** 启用仓库工作流参数类型 */
969
+ type EnableRepoWorkflowParamType = WorkflowInfoParamType;
970
+ /** 启用仓库工作流响应类型 */
971
+ interface EnableRepoWorkflowResponseType {
972
+ /** 是否成功 */
973
+ success: boolean;
974
+ /** 启用状态信息 */
975
+ message: string;
976
+ }
977
+ /** 禁用仓库工作流参数类型 */
978
+ type DisEnableRepoWorkflowParamType = WorkflowInfoParamType;
979
+ /** 禁用仓库工作流响应类型 */
980
+ interface DisEnableRepoWorkflowResponseType {
981
+ /** 是否成功 */
982
+ success: boolean;
983
+ /** 禁用状态信息 */
984
+ message: string;
985
+ }
986
+ /** 重新运行仓库工作流参数类型 */
987
+ interface ReRunRepoWorkflowParamType extends Omit<WorkflowInfoParamType, 'workflow_id'> {
988
+ /** 工作流作业id */
989
+ job_id: number;
990
+ }
991
+ /** 重新运行仓库工作流响应类型 */
992
+ interface ReRunRepoWorkflowResponseType {
993
+ /** 是否成功重新运行仓库工作流 */
994
+ success: boolean;
995
+ /** 重新运行状态信息 */
996
+ message: string;
997
+ }
998
+
935
999
  /** 议题用户信息响应类型 */
936
1000
  type IssueUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'type'>;
937
1001
  /** 议题标签类型 */
@@ -1014,7 +1078,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1014
1078
  /**
1015
1079
  * 里程碑筛选
1016
1080
  * @default *
1017
- * @enum {string | number}
1018
1081
  * - 传入数字时:按里程碑编号筛选
1019
1082
  * - 传入 "*":接受任何里程碑的议题
1020
1083
  * - 传入 "none":返回没有里程碑的议题
@@ -1023,7 +1086,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1023
1086
  /**
1024
1087
  * 议题状态
1025
1088
  * @default "open"
1026
- * @enum {string}
1027
1089
  * - open: 打开的议题
1028
1090
  * - closed: 关闭的议题
1029
1091
  * - all: 所有议题
@@ -1055,7 +1117,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1055
1117
  /**
1056
1118
  * 排序方式
1057
1119
  * @default "created"
1058
- * @enum {string}
1059
1120
  * - created: 按创建时间排序
1060
1121
  * - updated: 按更新时间排序
1061
1122
  * - comments: 按评论数排序
@@ -1064,7 +1125,6 @@ type RepoIssueListParamType = RepoBaseParamType & {
1064
1125
  /**
1065
1126
  * 排序方向
1066
1127
  * @default "desc"
1067
- * @enum {string}
1068
1128
  * - asc: 升序
1069
1129
  * - desc: 降序
1070
1130
  */
@@ -1182,7 +1242,6 @@ interface RepoCommentsListParamType extends RepoBaseParamType {
1182
1242
  * 排序依据
1183
1243
  * 用于指定结果的排序属性
1184
1244
  * @default created
1185
- * @enum {string}
1186
1245
  * - created: 按创建时间排序
1187
1246
  * - updated: 按更新时间排序
1188
1247
  */
@@ -1192,7 +1251,6 @@ interface RepoCommentsListParamType extends RepoBaseParamType {
1192
1251
  * 指定结果的排序方向
1193
1252
  * 注意:如果没有指定 sort 参数,此参数将被忽略
1194
1253
  * @default desc 当 sort 参数存在时
1195
- * @enum {string}
1196
1254
  * - asc: 升序
1197
1255
  * - desc: 降序
1198
1256
  */
@@ -1673,7 +1731,7 @@ interface DeletePullRequestCommentResponseType {
1673
1731
  message: string;
1674
1732
  }
1675
1733
 
1676
- type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos'>;
1734
+ type ReleaseUser = Omit<UserInfoResponseType, 'bio' | 'blog' | 'followers' | 'following' | 'public_repos' | 'email'>;
1677
1735
  /** 反应信息类型 */
1678
1736
  interface ReactionInfoType {
1679
1737
  /** 反应 API URL */
@@ -1782,6 +1840,43 @@ interface DeleteReleaseResponseType {
1782
1840
  message: string;
1783
1841
  }
1784
1842
 
1843
+ type SearchUser = Pick<UserInfoResponseType, 'id' | 'login' | 'name' | 'avatar_url' | 'html_url' | 'email'>;
1844
+ type SearchRepo = Pick<RepoInfoResponseType, 'id' | 'owner' | 'name' | 'full_name' | 'description' | 'visibility' | 'public' | 'private' | 'archived' | 'language' | 'pushed_at'>;
1845
+ /** 搜索用户参数列表 */
1846
+ interface SearchUsersParamType {
1847
+ /** 搜索关键字 */
1848
+ q: string;
1849
+ /** 排序顺序 */
1850
+ order: 'desc' | 'asc';
1851
+ /** 每页数量 */
1852
+ per_page?: number;
1853
+ /** 页码 */
1854
+ page?: number;
1855
+ }
1856
+ /** 搜索用户响应列表 */
1857
+ interface SearchUsersResponseType {
1858
+ /** 搜索结果数量 */
1859
+ total_count: number;
1860
+ /** 用户列表 */
1861
+ items: Array<SearchUser>;
1862
+ }
1863
+ interface SearchReposParamType {
1864
+ /** 搜索关键字 */
1865
+ q: string;
1866
+ /** 排序顺序 */
1867
+ order: 'desc' | 'asc';
1868
+ /** 每页数量 */
1869
+ per_page?: number;
1870
+ /** 页码 */
1871
+ page?: number;
1872
+ }
1873
+ interface SearchReposResponseType {
1874
+ /** 搜索结果数量 */
1875
+ total_count: number;
1876
+ /** 用户列表 */
1877
+ items: Array<SearchRepo>;
1878
+ }
1879
+
1785
1880
  interface WebHookSignatureParamType {
1786
1881
  /** 请求体 */
1787
1882
  payload: string;
@@ -1795,6 +1890,76 @@ interface WebHookSignatureResponseType {
1795
1890
  message: string;
1796
1891
  }
1797
1892
 
1893
+ /**
1894
+ * 获取本地 Git 仓库信息
1895
+ * @description 获取本地 Git 仓库信息,返回仓库名称、仓库路径、仓库地址等信息
1896
+ * @param local_path - 本地仓库路径
1897
+ * @returns Git 仓库信息
1898
+ * @example
1899
+ * ```ts
1900
+ * const info = await get_local_git_repo_info('D:/project/repo')
1901
+ * console.log(info)
1902
+ * -> {
1903
+ * name: 'repo',
1904
+ * path: 'D:/project/repo',
1905
+ * url: 'https://github.com/owner/repo.git',
1906
+ * html_url: 'https://github.com/owner/repo',
1907
+ * owner: 'owner',
1908
+ * repo: 'repo'
1909
+ * }
1910
+ * ```
1911
+ */
1912
+ declare function get_local_git_repo_info(local_path: string): Promise<LocalGitInfoType | null>;
1913
+ /**
1914
+ * 获取本地仓库信息列表
1915
+ * @param local_path 本地仓库路径
1916
+ * @param options 配置项
1917
+ * - loop 是否递归查找
1918
+ * - maxDepth 递归最大深度
1919
+ * - dir 忽略的文件夹名称列表
1920
+ * @returns
1921
+ * @example
1922
+ * ```ts
1923
+ * // 无数据
1924
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
1925
+ * -> []
1926
+ * // 有数据
1927
+ * const res = await get_local_git_repo_list('D:\\project\\GitHub', { loop: true, maxDepth: 5, dir: ['node_modules'] })
1928
+ * -> [
1929
+ * {
1930
+ * "name": "GitHub",
1931
+ * "path": "D:\\project\\GitHub\\GitHub",
1932
+ * "url": "https://github.com/GitHub/GitHub.git",
1933
+ * "html_url": "https://github.com/GitHub/GitHub",
1934
+ * "owner": "GitHub",
1935
+ * "repo": "GitHub"
1936
+ * }
1937
+ * ]
1938
+ */
1939
+ declare function get_local_git_repo_list(local_path: string, options?: LocalGitInfoListOptionsType): Promise<LocalGitInfoListType>;
1940
+ /**
1941
+ * 获取本地仓库的默认分支
1942
+ * @param local_path - 本地仓库路径
1943
+ * @returns 默认分支名称
1944
+ * @example
1945
+ * ```ts
1946
+ * console.log(await get_local_repo_default_branch('/path/to/repo'))
1947
+ * -> 'main'
1948
+ * ```
1949
+ */
1950
+ declare function get_local_repo_default_branch(local_path: string): Promise<string>;
1951
+ /**
1952
+ * 获取远程仓库的默认分支
1953
+ * @param remote_url - 远程仓库URL
1954
+ * @returns 默认分支名称
1955
+ * @example
1956
+ * ```ts
1957
+ * console.log(await get_remote_repo_default_branch('https://github.com/CandriaJS/git-neko-kit'))
1958
+ * -> 'main'
1959
+ * ```
1960
+ */
1961
+ declare function get_remote_repo_default_branch(remote_url: string): Promise<string>;
1962
+
1798
1963
  /**
1799
1964
  * 格式化日期
1800
1965
  * @param dateString - 日期字符串
@@ -2665,7 +2830,7 @@ declare class Repo extends GitHubClient {
2665
2830
  */
2666
2831
  get_org_repos_list(options: OrgRepoListParmType): Promise<ApiResponseType<OrgRepoListResponseType>>;
2667
2832
  /**
2668
- * 查询仓库详细信息
2833
+ * 通过授权用户查询仓库列表
2669
2834
  * 权限: Metadata - read-only , 如果获取公开仓库可无需此权限
2670
2835
  * @param options - 请求参数对象
2671
2836
  * - type - 仓库类型,可选值:可选all, public, private
@@ -2916,6 +3081,79 @@ declare class Repo extends GitHubClient {
2916
3081
  get_repo_main_language(options: GetRepoMainLanguageParamType): Promise<GetRepoMainLanguageResponseType>;
2917
3082
  }
2918
3083
 
3084
+ /**
3085
+ * GitHub 搜索管理类
3086
+ *
3087
+ * 提供对GitHub Search的完整管理功能,包括:
3088
+ * - 搜索用户
3089
+ * - 搜索仓库
3090
+ *
3091
+ */
3092
+ declare class Search extends GitHubClient {
3093
+ constructor(base: GitHubClient);
3094
+ /**
3095
+ * 搜索用户
3096
+ *
3097
+ * @param options 搜索参数
3098
+ * - q 搜索关键字
3099
+ * - order 排序顺序
3100
+ * - per_page 每页数量
3101
+ * - page 页码
3102
+ * @returns 搜索结果
3103
+ * @example
3104
+ * ```ts
3105
+ * const users = await search.search_users({ q: 'username', order: 'desc' })
3106
+ * -> {
3107
+ * total_count: 1,
3108
+ * items: [
3109
+ * {
3110
+ * id: 1,
3111
+ * login: 'username',
3112
+ * name: 'username',
3113
+ * email: 'username@example.com',
3114
+ * avatar_url: 'https://avatars.githubusercontent.com/u/1?v=4',
3115
+ * html_url: 'https://github.com/username'
3116
+ * }
3117
+ * ]
3118
+ * }
3119
+ * ```
3120
+ */
3121
+ search_users(options: SearchUsersParamType): Promise<ApiResponseType<SearchUsersResponseType>>;
3122
+ /**
3123
+ * 搜索仓库
3124
+ *
3125
+ * @param options 搜索参数
3126
+ * - q 搜索关键字
3127
+ * - order 排序顺序
3128
+ * - per_page 每页数量
3129
+ * - page 页码
3130
+ * @returns 搜索结果
3131
+ * @example
3132
+ * ```ts
3133
+ * const repos = await search.search_repos({ q: 'repo', order: 'desc' })
3134
+ * -> {
3135
+ * total_count: 1,
3136
+ * items: [
3137
+ * {
3138
+ * id: 1,
3139
+ * owner: 'username',
3140
+ * name: 'repo',
3141
+ * full_name: 'username/repo',
3142
+ * description: 'repo description',
3143
+ * visibility: 'public',
3144
+ * public: true,
3145
+ * private: false,
3146
+ * archived: false,
3147
+ * language: 'JavaScript',
3148
+ * pushed_at: '2021-01-01T00:00:00Z'
3149
+ * }
3150
+ * ]
3151
+ * }
3152
+ * ```
3153
+ */
3154
+ search_repos(options: SearchReposParamType): Promise<ApiResponseType<SearchReposResponseType>>;
3155
+ }
3156
+
2919
3157
  /**
2920
3158
  * Base 用户操作类
2921
3159
  *
@@ -3057,7 +3295,6 @@ declare class User extends GitHubClient {
3057
3295
  * - 检查webhook签名是否正确
3058
3296
  */
3059
3297
  declare class WebHook extends GitHubClient {
3060
- constructor(base: GitHubClient);
3061
3298
  /**
3062
3299
  * 检查WebHook签名是否正确
3063
3300
  * 权限:无需任何权限
@@ -3086,6 +3323,116 @@ declare class WebHook extends GitHubClient {
3086
3323
  check_webhook_signature(options: WebHookSignatureParamType): Promise<ApiResponseType<WebHookSignatureResponseType>>;
3087
3324
  }
3088
3325
 
3326
+ /**
3327
+ * GitHub 工作流管理类
3328
+ *
3329
+ * 提供对GitHub Workflow的完整管理功能,包括:
3330
+ * - 仓库工作流信息
3331
+ *
3332
+ */
3333
+ declare class Workflow extends GitHubClient {
3334
+ constructor(base: GitHubClient);
3335
+ /**
3336
+ * 获取仓库工作流信息
3337
+ * 权限:
3338
+ * - 'actions': 'read-only'
3339
+ * @param options 获取工作流信息参数
3340
+ * - owner 仓库拥有者
3341
+ * - repo 仓库名称
3342
+ * - workflow_id 工作流id
3343
+ * @returns 包含工作流信息的响应对象
3344
+ * @example
3345
+ * ```ts
3346
+ * const res = await workflow.get_workflow_info()
3347
+ * -> 工作流信息对象
3348
+ * ```
3349
+ */
3350
+ get_workflow_info(options: WorkflowInfoParamType): Promise<ApiResponseType<WorkflowInfoResponseType>>;
3351
+ /**
3352
+ * 获取仓库工作流列表
3353
+ * 权限:
3354
+ * - 'actions': 'read-only'
3355
+ * @param options 获取工作流列表参数
3356
+ * - owner 仓库拥有者
3357
+ * - repo 仓库名称
3358
+ * - per_page 每页数量
3359
+ * - page 页码
3360
+ * @returns 包含工作流列表的响应对象
3361
+ * @example
3362
+ * ```ts
3363
+ * const res = await workflow.get_repo_workflows_list()
3364
+ * -> 工作流列表对象
3365
+ * ```
3366
+ */
3367
+ get_repo_workflows_list(options: GetRepoWorkflowsList): Promise<ApiResponseType<GetRepoWorkflowsListResponseType>>;
3368
+ /**
3369
+ * 运行仓库工作流
3370
+ * 权限:
3371
+ * - 'actions': 'read-and-write'
3372
+ * @param options 运行工作流参数
3373
+ * - owner 仓库拥有者
3374
+ * - repo 仓库名称
3375
+ * - workflow_id 工作流id
3376
+ * - ref 分支或者标签名称
3377
+ * - inputs 工作流输入参数
3378
+ * @returns 运行工作流结果对象
3379
+ * @example
3380
+ * ```ts
3381
+ * const res = await workflow.run_repo_workflow()
3382
+ * -> 运行工作流结果对象
3383
+ * ```
3384
+ */
3385
+ run_repo_workflow(options: RunRepoWorkflow): Promise<ApiResponseType<RunRepoWorkflowResponseType>>;
3386
+ /**
3387
+ * 启用仓库工作流
3388
+ * 权限:
3389
+ * - 'actions': 'read-and-write'
3390
+ * @param options 启用工作流参数
3391
+ * - owner 仓库拥有者
3392
+ * - repo 仓库名称
3393
+ * - workflow_id 工作流id
3394
+ * @returns 启用工作流结果对象
3395
+ * @example
3396
+ * ```ts
3397
+ * const res = await workflow.enable_repo_workflow()
3398
+ * -> 启用工作流结果对象
3399
+ * ```
3400
+ */
3401
+ enable_repo_workflow(options: EnableRepoWorkflowParamType): Promise<ApiResponseType<EnableRepoWorkflowResponseType>>;
3402
+ /**
3403
+ * 禁用仓库工作流
3404
+ * 权限:
3405
+ * - 'actions': 'read-and-write'
3406
+ * @param options 禁用工作流参数
3407
+ * - owner 仓库拥有者
3408
+ * - repo 仓库名称
3409
+ * - workflow_id 工作流id
3410
+ * @returns 禁用工作流结果对象
3411
+ * @example
3412
+ * ```ts
3413
+ * const res = await workflow.disable_repo_workflow()
3414
+ * -> 禁用工作流结果对象
3415
+ * ```
3416
+ */
3417
+ disable_repo_workflow(options: DisEnableRepoWorkflowParamType): Promise<ApiResponseType<DisEnableRepoWorkflowResponseType>>;
3418
+ /**
3419
+ * 重新运行仓库工作流
3420
+ * 权限:
3421
+ * - 'actions': 'read-and-write'
3422
+ * @param options 重新运行工作流参数
3423
+ * - owner 仓库拥有者
3424
+ * - repo 仓库名称
3425
+ * - job_id 工作流作业id
3426
+ * @returns 重新运行工作流结果对象
3427
+ * @example
3428
+ * ```ts
3429
+ * const res = await workflow.rerun_repo_workflow()
3430
+ * -> 重新运行工作流结果对象
3431
+ * ```
3432
+ */
3433
+ rerun_repo_workflow(options: ReRunRepoWorkflowParamType): Promise<ApiResponseType<ReRunRepoWorkflowResponseType>>;
3434
+ }
3435
+
3089
3436
  /**
3090
3437
  * GitHub API 基础服务类,提供与GitHub API交互的核心功能
3091
3438
  *
@@ -3117,6 +3464,8 @@ declare class GitHubClient {
3117
3464
  issue: Issue;
3118
3465
  org: Org;
3119
3466
  pull_request: Pull_Request;
3467
+ workflow: Workflow;
3468
+ search: Search;
3120
3469
  base_url: string;
3121
3470
  api_url: string;
3122
3471
  jwtToken: string;
@@ -3149,6 +3498,10 @@ declare class GitHubClient {
3149
3498
  * ```
3150
3499
  */
3151
3500
  get is_app_client(): boolean;
3501
+ /**
3502
+ * 检查App客户端参数是否完整
3503
+ * @returns
3504
+ */
3152
3505
  private validateAppClient;
3153
3506
  /**
3154
3507
  * 获取App实例
@@ -3231,6 +3584,24 @@ declare class GitHubClient {
3231
3584
  * ```
3232
3585
  */
3233
3586
  get_pull_request(): Promise<Pull_Request>;
3587
+ /**
3588
+ * 获取Workflow实例
3589
+ * @returns Workflow实例
3590
+ * @example
3591
+ * ```ts
3592
+ * const workflow = await GitHubClient.get_workflow()
3593
+ * ```
3594
+ */
3595
+ get_workflow(): Promise<Workflow>;
3596
+ /**
3597
+ * 获取Search实例
3598
+ * @returns Search实例
3599
+ * @example
3600
+ * ```ts
3601
+ * const search = await GitHubClient.get_search()
3602
+ * ```
3603
+ */
3604
+ get_search(): Promise<Search>;
3234
3605
  /**
3235
3606
  * 设置请求代理
3236
3607
  * @param proxy 代理参数
@@ -3242,10 +3613,19 @@ declare class GitHubClient {
3242
3613
  * })
3243
3614
  * ```
3244
3615
  */
3616
+ /**
3617
+ * 设置请求代理
3618
+ * @param proxy 代理参数
3619
+ * @example
3620
+ * setProxy({
3621
+ * type: 'http',
3622
+ * address: 'http://127.0.0.1:7890'
3623
+ * })
3624
+ */
3245
3625
  setProxy(proxy: ProxyParamsType): void;
3246
3626
  /**
3247
3627
  * 设置 token
3248
- * 传入的 token 必须以 ghu_ 或ghp_开头,否则会抛出错误
3628
+ * 传入的 token 必须以 ghu_ 或 ghp_ 或 ghs_ 开头,否则会抛出错误
3249
3629
  * @param token 传入的 token
3250
3630
  * @example
3251
3631
  * ```ts
@@ -3266,9 +3646,14 @@ declare class GitHubClient {
3266
3646
  * ```
3267
3647
  */
3268
3648
  private generate_jwt;
3649
+ /**
3650
+ * 获取当前请求的配置
3651
+ * @returns 当前请求的配置对象
3652
+ */
3653
+ private getCurrentRequestConfig;
3269
3654
  /**
3270
3655
  * 设置当前请求的配置
3271
- * @protected - 仅在类内部访问
3656
+ * @protected - 仅在父类与子类中方法中可访问
3272
3657
  * @param config - 配置对象,包含以下属性:
3273
3658
  * - url: 请求的URL
3274
3659
  * - token: 认证令牌
@@ -3476,7 +3861,7 @@ declare class App extends GitHubClient {
3476
3861
  * const isInstalled = await app.is_app_inttalled_in_repo({ owner: 'owner', repo: 'repo' })
3477
3862
  * -> false
3478
3863
  */
3479
- is_app_installed_in_repo(options: RepoBaseParamType): Promise<boolean>;
3864
+ is_app_installed_in_repo(options: isAppInstalledInRepo): Promise<boolean>;
3480
3865
  }
3481
3866
 
3482
3867
  type index_App = App;
@@ -3495,12 +3880,16 @@ type index_Pull_Request = Pull_Request;
3495
3880
  declare const index_Pull_Request: typeof Pull_Request;
3496
3881
  type index_Repo = Repo;
3497
3882
  declare const index_Repo: typeof Repo;
3883
+ type index_Search = Search;
3884
+ declare const index_Search: typeof Search;
3498
3885
  type index_User = User;
3499
3886
  declare const index_User: typeof User;
3500
3887
  type index_WebHook = WebHook;
3501
3888
  declare const index_WebHook: typeof WebHook;
3889
+ type index_Workflow = Workflow;
3890
+ declare const index_Workflow: typeof Workflow;
3502
3891
  declare namespace index {
3503
- export { index_App as App, index_Auth as Auth, index_Commit as Commit, index_GitHubClient as GitHubClient, index_Issue as Issue, index_Org as Org, index_Pull_Request as Pull_Request, index_Repo as Repo, index_User as User, index_WebHook as WebHook };
3892
+ export { index_App as App, index_Auth as Auth, index_Commit as Commit, index_GitHubClient as GitHubClient, index_Issue as Issue, index_Org as Org, index_Pull_Request as Pull_Request, index_Repo as Repo, index_Search as Search, index_User as User, index_WebHook as WebHook, index_Workflow as Workflow };
3504
3893
  }
3505
3894
 
3506
3895
  /** 基本客户端 */
@@ -3509,4 +3898,4 @@ declare class Client {
3509
3898
  constructor(options: ClientType);
3510
3899
  }
3511
3900
 
3512
- export { type AccessCodeType, type AccessTokenClentTYpe, type AccessTokenPermissionsType, type AccessTokenType, type AddCollaboratorResponseType, type AddMemberParamType, type AddMemberResponseType, type ApiResponseType, type AppClientType, type AppInfoParamType, type AppInfoResponseType, type AppPermissions, type AppRepoInfoResponseType, type AppUser, type CheckTokenResponseType, Client, type ClientType, type CloseIssueParamType, type CloseIssueResponseType, type CollaboratorInfoResponseType, type CollaboratorParamType, type CollaboratorPermissionType, type CommentIdParamType, type Commit$1 as Commit, type CommitInfoCommonParamType, type CommitInfoParamType, type CommitInfoResponseType, type CommitListParamType, type CommitListResponseType, type CommitStats, type CommonProxyType, type ContributionData, type ContributionResult, type CreateAccessTokenForAppParamType, type CreateAccessTokenForAppResponseType, type CreateIssueResponseType, type CreatePullRequestCommentParamType, type CreatePullRequestCommentResponseType, type CreatePullRequestParamType, type CreatePullRequestResponseType, type CreateReleaseParamType, type CreateReleaseResponseType, type CreateSubIssueParamType, type CreateSubIssueResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeletePullRequestCommentParamType, type DeletePullRequestCommentResponseType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, type ExecOptions, type ExecReturn, type ExecType, type GetAppInfoByOrgParamType, type GetAppInfoByOrgResponseType, type GetAppInfoByRepoParamType, type GetAppInfoByRepoResponseType, type GetAppInfoByUserParamType, type GetAppInfoByUserResponseType, type GetCollaboratorListParamType, type GetCollaboratorListResponseType, type GetPullRequestCommentInfoParamType, type GetPullRequestCommentInfoResponseType, type GetPullRequestCommentsListParamType, type GetPullRequestCommentsListResponseType, type GetPullRequestFilesListParamType, type GetPullRequestFilesListResponseType, type GetRepoDefaultBranchParamType, type GetRepoDefaultBranchResponseType, type GetRepoMainLanguageParamType, type GetRepoMainLanguageResponseType, type GetRepoVisibilityParamType, type GetRepoVisibilityResponseType, type GitHubBaseClient, GitHubClient, type GitHubClientType, type GitType, type GitUser, type HttpProxyType, type HttpsProxyType, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentsListParamType, type IssueCommentsListResponseType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type IssueNumberParamType, type IssueUser, type LanguageInfo, type LockIssueParamType, type LockIssueResponseType, type MergeMethodType, type MergePullRequestParamType, type MergePullRequestResponseType, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgInfoParamType, type OrgInfoResponseType, type OrgNameParamType, type OrgRepoCreateParamType, type OrgRepoCreateResponseType, type OrgRepoListParmType, type OrgRepoListResponseType, type ParentCommit, type PkgInfoType, type PrRepo, type PrUser, type ProxyParamsType, type ProxyType, type ProxyUrlType, type PullRequestFilesListType, type PullRequestInfoParamType, type PullRequestInfoResponseType, type PullRequestListParamType, type PullRequestListResponseType, type PullRequestNumberParamType, type ReactionInfoType, type RefreshTokenResponseType, type RefreshTokenType, type ReleaseAssetsType, type ReleaseInfoByTagParamType, type ReleaseInfoByTagResponseType, type ReleaseInfoParamType, type ReleaseInfoResponseType, type ReleaseLatestParamTypeType, type ReleaseLatestResponseType, type ReleaseListParamType, type ReleaseListResponseType, type ReleaseUser, type RemoveCollaboratorParamType, type RemoveCollaboratorResponseType, type RemoveIssueCommentParamType, type RemoveIssueCommentResponseType, type RemoveSubIssueParamType, type RemoveSubIssueResponseType, type RepoBaseParamType, type RepoCommentsListParamType, type RepoCommentsListResponseType, type RepoInfoParamType, type RepoInfoResponseType, type RepoIssueListParamType, type RepoLanguagesListParamType, type RepoLanguagesListResponseType, type RepoListBaseParamType, type RepoNameParamType, type RepoOwnerParamType, type RepoParamType, type RepoUrlParamType, type RepoUser, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseHeadersType, type ResponseMsgType, type ResponseStatusCodeType, type ResponseSuccessType, type ResponseType, type ReverseProxyType, type RevokeAccessTokenResponseType, type RoleNameType, type ShaParamType, type Socks5ProxyType, type SocksProxyType, type SubIssueListParamType, type SubIssueListResponseType, type TokenResponseType, type UnLockIssueParamType, type UnLockIssueResponseType, type UpdateIssueCommentParamType, type UpdateIssueCommentResponseType, type UpdateIssueParamType, type UpdateIssueResponseType, type UpdatePullRequestCommentParamType, type UpdatePullRequestCommentResponseType, type UpdatePullRequestParamType, type UpdatePullRequestResponseType, type UpdateReleaseParamType, type UpdateReleaseResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByIdParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserRepoCreateParamType, type UserRepoCreateResponseType, type UserRepoListParamType, type UserRepoListType, type WebHookSignatureParamType, type WebHookSignatureResponseType, create_state_id, Client as default, type formatParamType, format_date, get_langage_color, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index as github };
3901
+ export { type AccessCodeType, type AccessTokenClentTYpe, type AccessTokenPermissionsType, type AccessTokenType, type AddCollaboratorResponseType, type AddMemberParamType, type AddMemberResponseType, type ApiResponseType, type AppClientType, type AppInfoParamType, type AppInfoResponseType, type AppPermissions, type AppRepoInfoResponseType, type AppUser, type BaseProxyType, type CheckTokenResponseType, Client, type ClientType, type CloseIssueParamType, type CloseIssueResponseType, type CollaboratorInfoResponseType, type CollaboratorParamType, type CollaboratorPermissionType, type CommentIdParamType, type Commit$1 as Commit, type CommitInfoCommonParamType, type CommitInfoParamType, type CommitInfoResponseType, type CommitListParamType, type CommitListResponseType, type CommitStats, type ContributionData, type ContributionResult, type CreateAccessTokenForAppParamType, type CreateAccessTokenForAppResponseType, type CreateIssueResponseType, type CreatePullRequestCommentParamType, type CreatePullRequestCommentResponseType, type CreatePullRequestParamType, type CreatePullRequestResponseType, type CreateReleaseParamType, type CreateReleaseResponseType, type CreateSubIssueParamType, type CreateSubIssueResponseType, type CreteIssueCommentParamType, type CreteIssueCommentResponseType, type CreteIssueParamType, type DeletePullRequestCommentParamType, type DeletePullRequestCommentResponseType, type DeleteReleaseParamType, type DeleteReleaseResponseType, type DiffEntry, type DisEnableRepoWorkflowParamType, type DisEnableRepoWorkflowResponseType, type EnableRepoWorkflowParamType, type EnableRepoWorkflowResponseType, type GetAppInfoByOrgParamType, type GetAppInfoByOrgResponseType, type GetAppInfoByRepoParamType, type GetAppInfoByRepoResponseType, type GetAppInfoByUserParamType, type GetAppInfoByUserResponseType, type GetCollaboratorListParamType, type GetCollaboratorListResponseType, type GetPullRequestCommentInfoParamType, type GetPullRequestCommentInfoResponseType, type GetPullRequestCommentsListParamType, type GetPullRequestCommentsListResponseType, type GetPullRequestFilesListParamType, type GetPullRequestFilesListResponseType, type GetRepoDefaultBranchParamType, type GetRepoDefaultBranchResponseType, type GetRepoMainLanguageParamType, type GetRepoMainLanguageResponseType, type GetRepoVisibilityParamType, type GetRepoVisibilityResponseType, type GetRepoWorkflowsList, type GetRepoWorkflowsListResponseType, type GitHubBaseClient, GitHubClient, type GitHubClientType, type GitRepoType, type GitType, type GitUser, type IssueCommentInfoParamType, type IssueCommentInfoResponseType, type IssueCommentsListParamType, type IssueCommentsListResponseType, type IssueInfoParamType, type IssueInfoResponseType, type IssueLabelType, type IssueListResponseType, type IssueNumberParamType, type IssueUser, type LanguageInfo, type LocalGitInfoListOptionsType, type LocalGitInfoListType, type LocalGitInfoType, type LockIssueParamType, type LockIssueResponseType, type MergeMethodType, type MergePullRequestParamType, type MergePullRequestResponseType, type MilestoneType, type OpenIssueParamType, type OpenIssueResponseType, type OrgInfoParamType, type OrgInfoResponseType, type OrgNameParamType, type OrgRepoCreateParamType, type OrgRepoCreateResponseType, type OrgRepoListParmType, type OrgRepoListResponseType, type ParentCommit, type PkgInfoType, type PrRepo, type PrUser, type ProxyParamsType, ProxyProtocol, ProxyType, type ProxyUrlType, type PullRequestFilesListType, type PullRequestInfoParamType, type PullRequestInfoResponseType, type PullRequestListParamType, type PullRequestListResponseType, type PullRequestNumberParamType, type ReRunRepoWorkflowParamType, type ReRunRepoWorkflowResponseType, type ReactionInfoType, type RefreshTokenResponseType, type RefreshTokenType, type ReleaseAssetsType, type ReleaseInfoByTagParamType, type ReleaseInfoByTagResponseType, type ReleaseInfoParamType, type ReleaseInfoResponseType, type ReleaseLatestParamTypeType, type ReleaseLatestResponseType, type ReleaseListParamType, type ReleaseListResponseType, type ReleaseUser, type RemoveCollaboratorParamType, type RemoveCollaboratorResponseType, type RemoveIssueCommentParamType, type RemoveIssueCommentResponseType, type RemoveSubIssueParamType, type RemoveSubIssueResponseType, type RepoBaseParamType, type RepoCommentsListParamType, type RepoCommentsListResponseType, type RepoInfoParamType, type RepoInfoResponseType, type RepoIssueListParamType, type RepoLanguagesListParamType, type RepoLanguagesListResponseType, type RepoListBaseParamType, type RepoNameParamType, type RepoOwnerParamType, type RepoParamType, type RepoUrlParamType, type RepoUser, type ReprioritizeSubIssueParamType, type ReprioritizeSubIssueResponseType, type RequestConfigType, type RequestTokenType, type ResponseHeadersType, type ResponseMsgType, type ResponseStatusCodeType, type ResponseSuccessType, type ResponseType, type RevokeAccessTokenResponseType, type RoleNameType, type RunRepoWorkflow, type RunRepoWorkflowResponseType, type SearchRepo, type SearchReposParamType, type SearchReposResponseType, type SearchUser, type SearchUsersParamType, type SearchUsersResponseType, type ShaParamType, type SubIssueListParamType, type SubIssueListResponseType, type TokenResponseType, type UnLockIssueParamType, type UnLockIssueResponseType, type UpdateIssueCommentParamType, type UpdateIssueCommentResponseType, type UpdateIssueParamType, type UpdateIssueResponseType, type UpdatePullRequestCommentParamType, type UpdatePullRequestCommentResponseType, type UpdatePullRequestParamType, type UpdatePullRequestResponseType, type UpdateReleaseParamType, type UpdateReleaseResponseType, type UserByTokenRepoListParamType, type UserIdParamType, type UserInfoByIdParamType, type UserInfoParamType, type UserInfoResponseType, type UserNameParamType, type UserRepoCreateParamType, type UserRepoCreateResponseType, type UserRepoListParamType, type UserRepoListType, type WebHookSignatureParamType, type WebHookSignatureResponseType, type WorkflowInfoParamType, type WorkflowInfoResponseType, WorkflowState, create_state_id, Client as default, type formatParamType, format_date, get_langage_color, get_local_git_repo_info, get_local_git_repo_list, get_local_repo_default_branch, get_relative_time, get_remote_repo_default_branch, index as github, type isAppInstalledInRepo, type workflowIdParamType };