@hecom/codearts 0.1.0 → 0.2.1

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.
@@ -1,4 +1,4 @@
1
- import { AllWorkHourStats, HuaweiCloudConfig, IssueDetailResponseV2, IssueItem, IterationInfo, ProjectMember, WorkHourStats, WorkProgressStats } from '../types';
1
+ import { AllWorkHourStats, HuaweiCloudConfig, IssueItem, IssueItemV2, IterationInfo, ProjectMember, ProjectRole, WorkHourStats, WorkProgressStats } from '../types';
2
2
  import { ApiService } from './api.service';
3
3
  /**
4
4
  * 业务服务类
@@ -19,6 +19,12 @@ export declare class BusinessService {
19
19
  * @returns 指定角色的成员列表
20
20
  */
21
21
  getMembersByRoleId(projectId: string, roleId: number): Promise<ProjectMember[]>;
22
+ /**
23
+ * 获取项目中的所有角色列表(去重)
24
+ * @param projectId 项目ID
25
+ * @returns 项目中的所有角色列表
26
+ */
27
+ getProjectRoles(projectId: string): Promise<ProjectRole[]>;
22
28
  /**
23
29
  * 获取指定日期之后的迭代列表
24
30
  * @param projectId 项目ID
@@ -42,7 +48,6 @@ export declare class BusinessService {
42
48
  * @returns Task和Story类型的工作项列表
43
49
  */
44
50
  getWorkloadByIterationAndUsers(projectId: string, iterationId: number, userIds: string[]): Promise<IssueItem[]>;
45
- addIssueNote(projectId: string, issueId: number, content: string): Promise<IssueDetailResponseV2>;
46
51
  /**
47
52
  * 统计工作项进度信息
48
53
  * @param issues 工作项列表
@@ -57,6 +62,20 @@ export declare class BusinessService {
57
62
  * @returns 工时统计结果,包括总工时和按用户分组的工时详情
58
63
  */
59
64
  getDailyWorkHourStats(projectId: string, userIds: string[], date: string): Promise<WorkHourStats>;
65
+ /**
66
+ * 根据迭代标题获取迭代信息
67
+ * @param projectId 项目ID
68
+ * @param iterationTitles 迭代标题列表
69
+ * @returns 匹配的迭代信息列表
70
+ */
71
+ getIterationsByTitles(projectId: string, iterationTitles: string[]): Promise<IterationInfo[]>;
72
+ /**
73
+ * 根据迭代标题获取所有 Story
74
+ * @param projectId 项目ID
75
+ * @param iterationTitles 迭代标题列表
76
+ * @returns Story 类型的工作项列表
77
+ */
78
+ getStoriesByIterationTitles(projectId: string, iterationTitles: string[]): Promise<IssueItem[]>;
60
79
  /**
61
80
  * 查询指定用户在指定时间段内的所有工时统计(按人和领域分组)
62
81
  * @param projectId 项目ID
@@ -66,4 +85,25 @@ export declare class BusinessService {
66
85
  * @returns 工时统计结果,按用户和领域两个维度分组
67
86
  */
68
87
  getAllWorkHourStats(projectId: string, userIds: string[], beginDate: string, endDate: string): Promise<AllWorkHourStats>;
88
+ /**
89
+ * 获取指定工作项的所有子工作项(处理分页)
90
+ * @param projectId 项目ID
91
+ * @param issueId 父工作项ID
92
+ * @returns 所有子工作项列表
93
+ */
94
+ getChildIssues(projectId: string, issueId: string): Promise<IssueItemV2[]>;
95
+ /**
96
+ * 验证 IAM 凭证是否有效
97
+ * @returns 验证结果,包含成功状态和可能的错误信息
98
+ */
99
+ validateCredentials(): Promise<{
100
+ success: boolean;
101
+ error?: string;
102
+ }>;
103
+ /**
104
+ * 获取项目列表
105
+ * @param limit 返回的项目数量限制,默认100
106
+ * @returns 项目列表
107
+ */
108
+ getProjects(limit?: number): Promise<import('../types').Project[]>;
69
109
  }
@@ -32,6 +32,45 @@ class BusinessService {
32
32
  const allMembers = membersResponse.data?.members || [];
33
33
  return allMembers.filter((member) => member.role_id === roleId);
34
34
  }
35
+ /**
36
+ * 获取项目中的所有角色列表(去重)
37
+ * @param projectId 项目ID
38
+ * @returns 项目中的所有角色列表
39
+ */
40
+ async getProjectRoles(projectId) {
41
+ // 分页获取所有成员
42
+ const allMembers = [];
43
+ const pageSize = 100;
44
+ let offset = 0;
45
+ let hasMore = true;
46
+ while (hasMore) {
47
+ const membersResponse = await this.apiService.getMembers(projectId, {
48
+ limit: pageSize,
49
+ offset: offset,
50
+ });
51
+ if (!membersResponse.success) {
52
+ throw new Error(`获取成员列表失败: ${membersResponse.error || '未知错误'}`);
53
+ }
54
+ const members = membersResponse.data?.members.filter((member) => member.role_id !== -1 && member.nick_name != null) || [];
55
+ allMembers.push(...members);
56
+ // 判断是否还有更多数据
57
+ const total = membersResponse.data?.total || 0;
58
+ offset += pageSize;
59
+ hasMore = offset < total;
60
+ }
61
+ // 使用 Map 去重,key 为 role_id
62
+ const rolesMap = new Map();
63
+ allMembers.forEach((member) => {
64
+ if (!rolesMap.has(member.role_id)) {
65
+ rolesMap.set(member.role_id, {
66
+ role_id: member.role_id,
67
+ role_name: member.role_name,
68
+ });
69
+ }
70
+ });
71
+ // 转换为数组并按 role_id 排序
72
+ return Array.from(rolesMap.values()).sort((a, b) => a.role_id - b.role_id);
73
+ }
35
74
  /**
36
75
  * 获取指定日期之后的迭代列表
37
76
  * @param projectId 项目ID
@@ -103,17 +142,6 @@ class BusinessService {
103
142
  }
104
143
  return issuesResponse.data?.issues || [];
105
144
  }
106
- async addIssueNote(projectId, issueId, content) {
107
- const result = await this.apiService.addIssueNotes({
108
- projectUUId: projectId,
109
- id: String(issueId),
110
- notes: content,
111
- });
112
- if (result.data?.status === 'success') {
113
- return result.data.result.issue;
114
- }
115
- throw new Error(`添加工作项备注失败: ${result.data?.status || '未知错误'}`);
116
- }
117
145
  /**
118
146
  * 统计工作项进度信息
119
147
  * @param issues 工作项列表
@@ -210,6 +238,62 @@ class BusinessService {
210
238
  userStats,
211
239
  };
212
240
  }
241
+ /**
242
+ * 根据迭代标题获取迭代信息
243
+ * @param projectId 项目ID
244
+ * @param iterationTitles 迭代标题列表
245
+ * @returns 匹配的迭代信息列表
246
+ */
247
+ async getIterationsByTitles(projectId, iterationTitles) {
248
+ const iterationsResponse = await this.apiService.getIterations(projectId, {
249
+ include_deleted: false,
250
+ });
251
+ if (!iterationsResponse.success) {
252
+ throw new Error(`获取迭代列表失败: ${iterationsResponse.error || '未知错误'}`);
253
+ }
254
+ const iterations = iterationsResponse.data?.iterations || [];
255
+ // 过滤出标题匹配的迭代
256
+ return iterations.filter((iteration) => iterationTitles.includes(iteration.name));
257
+ }
258
+ /**
259
+ * 根据迭代标题获取所有 Story
260
+ * @param projectId 项目ID
261
+ * @param iterationTitles 迭代标题列表
262
+ * @returns Story 类型的工作项列表
263
+ */
264
+ async getStoriesByIterationTitles(projectId, iterationTitles) {
265
+ // Step 1: 根据标题获取迭代信息
266
+ const iterations = await this.getIterationsByTitles(projectId, iterationTitles);
267
+ if (iterations.length === 0) {
268
+ return [];
269
+ }
270
+ // Step 2: 提取迭代ID
271
+ const iterationIds = iterations.map((iteration) => iteration.id);
272
+ // Step 3: 分页查询所有 Story(tracker_id = 7)
273
+ const allStories = [];
274
+ const pageSize = 100;
275
+ let offset = 0;
276
+ let hasMore = true;
277
+ while (hasMore) {
278
+ const issuesResponse = await this.apiService.getIssues(projectId, {
279
+ iteration_ids: iterationIds,
280
+ tracker_ids: [7], // 7=Story
281
+ include_deleted: false,
282
+ limit: pageSize,
283
+ offset: offset,
284
+ });
285
+ if (!issuesResponse.success) {
286
+ throw new Error(`获取Story列表失败: ${issuesResponse.error || '未知错误'}`);
287
+ }
288
+ const stories = issuesResponse.data?.issues || [];
289
+ allStories.push(...stories);
290
+ // 判断是否还有更多数据
291
+ const total = issuesResponse.data?.total || 0;
292
+ offset += pageSize;
293
+ hasMore = offset < total;
294
+ }
295
+ return allStories;
296
+ }
213
297
  /**
214
298
  * 查询指定用户在指定时间段内的所有工时统计(按人和领域分组)
215
299
  * @param projectId 项目ID
@@ -326,5 +410,55 @@ class BusinessService {
326
410
  userStats,
327
411
  };
328
412
  }
413
+ /**
414
+ * 获取指定工作项的所有子工作项(处理分页)
415
+ * @param projectId 项目ID
416
+ * @param issueId 父工作项ID
417
+ * @returns 所有子工作项列表
418
+ */
419
+ async getChildIssues(projectId, issueId) {
420
+ const allChildIssues = [];
421
+ const pageSize = 100;
422
+ let pageNo = 1;
423
+ let hasMore = true;
424
+ while (hasMore) {
425
+ const response = await this.apiService.getChildIssuesV2(projectId, issueId, pageSize, pageNo);
426
+ if (!response.success || !response.data) {
427
+ throw new Error(`获取子工作项失败: ${response.error || '未知错误'}`);
428
+ }
429
+ const childIssues = response.data.result.issues || [];
430
+ allChildIssues.push(...childIssues);
431
+ const total = response.data.result.total_count || 0;
432
+ hasMore = pageNo * pageSize < total;
433
+ pageNo++;
434
+ }
435
+ return allChildIssues;
436
+ }
437
+ /**
438
+ * 验证 IAM 凭证是否有效
439
+ * @returns 验证结果,包含成功状态和可能的错误信息
440
+ */
441
+ async validateCredentials() {
442
+ try {
443
+ await this.apiService.refreshToken();
444
+ return { success: true };
445
+ }
446
+ catch (error) {
447
+ const errorMsg = error instanceof Error ? error.message : String(error);
448
+ return { success: false, error: errorMsg };
449
+ }
450
+ }
451
+ /**
452
+ * 获取项目列表
453
+ * @param limit 返回的项目数量限制,默认100
454
+ * @returns 项目列表
455
+ */
456
+ async getProjects(limit = 100) {
457
+ const response = await this.apiService.getProjects({ limit });
458
+ if (!response.success || !response.data) {
459
+ throw new Error(response.error || '获取项目列表失败');
460
+ }
461
+ return response.data.projects;
462
+ }
329
463
  }
330
464
  exports.BusinessService = BusinessService;
@@ -95,29 +95,12 @@ export interface ApiResponse<T = unknown> {
95
95
  message?: string;
96
96
  error?: string;
97
97
  }
98
- export interface RawData {
99
- id: string;
100
- timestamp: string;
101
- content: unknown;
102
- metadata?: Record<string, unknown>;
103
- }
104
- export interface ProcessedData {
105
- id: string;
106
- processedAt: string;
107
- result: unknown;
108
- summary?: string;
109
- }
110
98
  export interface RequestOptions {
111
99
  method?: 'GET' | 'POST' | 'PUT' | 'DELETE';
112
100
  headers?: Record<string, string>;
113
101
  params?: Record<string, unknown>;
114
102
  data?: unknown;
115
103
  }
116
- export interface ProjectType {
117
- SCRUM: 'scrum';
118
- NORMAL: 'normal';
119
- XBOARD: 'xboard';
120
- }
121
104
  export interface ProjectQueryParams {
122
105
  offset?: number;
123
106
  limit?: number;
@@ -169,6 +152,10 @@ export interface ProjectMemberQueryParams {
169
152
  offset?: number;
170
153
  limit?: number;
171
154
  }
155
+ export interface ProjectRole {
156
+ role_id: number;
157
+ role_name: string;
158
+ }
172
159
  export interface ShowProjectWorkHoursRequest {
173
160
  begin_time?: string;
174
161
  end_time?: string;
@@ -338,124 +325,142 @@ export interface AddIssueNotesRequest {
338
325
  projectUUId: string;
339
326
  type?: string;
340
327
  }
341
- export interface UserVO {
342
- assigned_nick_name?: string;
343
- first_name?: string;
344
- id?: number;
345
- identifier?: string;
346
- last_name?: string;
347
- name?: string;
328
+ export interface ListChildIssuesV4Response {
329
+ issues: IssueItem[];
330
+ total: number;
348
331
  }
349
- export interface CustomFieldV2 {
350
- name?: string;
351
- value?: string;
352
- new_name?: string;
332
+ export interface IssueUserV2 {
333
+ firstName: string;
334
+ lastName: string;
335
+ identifier: string;
336
+ imageId?: string;
337
+ name: string;
338
+ id: number;
339
+ assignedNickName?: string;
340
+ authorNickName?: string;
341
+ closederNickName?: string;
353
342
  }
354
- export interface IssueDetailCustomFieldV2 {
355
- custom_field?: string;
356
- field_name?: string;
357
- value?: string;
358
- field_type?: string;
359
- description?: string;
343
+ export interface IssueParentV2 {
344
+ subject: string;
345
+ id: number;
360
346
  }
361
- export interface DomainVO {
362
- id?: number;
363
- name?: string;
347
+ export interface IssueProjectV2 {
348
+ identifier: string;
349
+ name: string;
350
+ id: number;
351
+ type: string;
364
352
  }
365
- export interface ProjectVO {
366
- identifier?: string;
367
- name?: string;
368
- id?: number;
369
- project_type?: string;
353
+ export interface IssueTrackerV2 {
354
+ name: string;
355
+ id: number;
370
356
  }
371
- export interface IterationVO {
372
- id?: number;
373
- name?: string;
357
+ export interface IssueSeverityV2 {
358
+ name: string;
359
+ id: number;
374
360
  }
375
- export interface StoryPointVO {
376
- id?: number;
377
- name?: string;
361
+ export interface IssuePriorityV2 {
362
+ name: string;
363
+ id: number;
378
364
  }
379
- export interface ModuleVO {
380
- id?: number;
381
- name?: string;
365
+ export interface IssueStatusV2 {
366
+ name: string;
367
+ id: number;
382
368
  }
383
- export interface ParentIssueVO {
384
- id?: number;
385
- name?: string;
369
+ export interface IssueStatusAttributeV2 {
370
+ name: string;
371
+ id: number;
386
372
  }
387
- export interface PriorityVO {
388
- id?: number;
389
- name?: string;
373
+ export interface IssueDomainV2 {
374
+ name: string;
375
+ id: number;
390
376
  }
391
- export interface SeverityVO {
377
+ export interface IssueModuleV2 {
392
378
  id?: number;
393
379
  name?: string;
394
380
  }
395
- export interface StatusVO {
381
+ export interface IssueDeveloperV2 {
396
382
  id?: number;
397
383
  name?: string;
398
384
  }
399
- export interface EnvVO {
400
- id?: number;
401
- name?: string;
385
+ export interface IssueFixedVersionV2 {
386
+ name: string;
387
+ id: number;
402
388
  }
403
- export interface TrackerVO {
404
- id?: number;
405
- name?: string;
389
+ export interface IssueOrderV2 {
390
+ name: number;
391
+ id: number;
406
392
  }
407
- export interface IssueAccessoryV2 {
408
- attachment_id?: number;
409
- issue_id?: number;
410
- creator_num_id?: number;
411
- created_date?: string;
412
- file_name?: string;
413
- container_type?: string;
414
- disk_file_name?: string;
415
- digest?: string;
416
- disk_directory?: string;
417
- creator_id?: string;
418
- }
419
- export interface IssueDetailResponseV2 {
420
- actual_work_hours?: number;
421
- assigned_cc_user?: UserVO[];
422
- assigned_to?: UserVO;
423
- start_date?: string;
424
- created_on?: string;
425
- author?: UserVO;
426
- custom_fields?: CustomFieldV2[];
427
- custom_value_new?: IssueDetailCustomFieldV2;
428
- developer?: UserVO;
429
- domain?: DomainVO;
430
- done_ratio?: number;
431
- end_time?: string;
432
- expected_work_hours?: number;
433
- id?: number;
434
- project?: ProjectVO;
435
- iteration?: IterationVO;
436
- story_point?: StoryPointVO;
437
- module?: ModuleVO;
438
- subject?: string;
439
- parent_issue?: ParentIssueVO;
440
- priority?: PriorityVO;
441
- severity?: SeverityVO;
442
- status?: StatusVO;
443
- release_dev?: string;
444
- find_release_dev?: string;
445
- env?: EnvVO;
446
- tracker?: TrackerVO;
447
- updated_on?: string;
448
- closed_time?: string;
449
- description?: string;
450
- accessories_list?: IssueAccessoryV2[];
451
- inner_text?: string;
452
- }
453
- export interface AddIssueNotesResult {
454
- issue: IssueDetailResponseV2;
455
- }
456
- export interface AddIssueNotesResponse {
457
- result: AddIssueNotesResult;
458
- status: string;
393
+ export interface IssueCustomValueNewV2 {
394
+ [key: string]: string;
395
+ }
396
+ export interface IssueItemV2 {
397
+ id: number;
398
+ subject: string;
399
+ description: string;
400
+ updated_on: string;
401
+ created_on: string;
402
+ closed_on: string;
403
+ parent_issue?: IssueParentV2;
404
+ parent_issue_id?: number;
405
+ project: IssueProjectV2;
406
+ done_ratio: number;
407
+ findReleaseDev: string;
408
+ tracker: IssueTrackerV2;
409
+ releaseDev: string;
410
+ customValueNew?: IssueCustomValueNewV2;
411
+ order?: IssueOrderV2;
412
+ assigned_to: IssueUserV2;
413
+ status_attribute: IssueStatusAttributeV2;
414
+ severity: IssueSeverityV2;
415
+ isParent: boolean;
416
+ author: IssueUserV2;
417
+ module: IssueModuleV2;
418
+ expected_work_hours: number;
419
+ priority: IssuePriorityV2;
420
+ actual_work_hours: number;
421
+ is_watcher: boolean;
422
+ deleted: boolean;
423
+ fixed_version?: IssueFixedVersionV2;
424
+ is_archived: boolean;
425
+ domain: IssueDomainV2;
426
+ developer: IssueDeveloperV2;
427
+ closeder?: IssueUserV2;
428
+ position: string;
429
+ closed_flag: number;
430
+ assigned_cc_user: IssueUserV2[];
431
+ status: IssueStatusV2;
432
+ }
433
+ export interface ListChildIssuesV2Response {
434
+ result: {
435
+ total_count: number;
436
+ issues: IssueItemV2[];
437
+ };
438
+ status: 'success';
439
+ }
440
+ /**
441
+ * 自定义字段类型枚举
442
+ */
443
+ export type CustomFieldType = 'textbox' | 'textarea' | 'checkbox' | 'radio' | 'select' | 'date' | 'number';
444
+ /**
445
+ * 缺陷技术分析选项枚举
446
+ * custom_field32(缺陷技术分析)字段的选项值枚举定义
447
+ */
448
+ export declare enum DefectAnalysisType {
449
+ FUNCTION_IMPLEMENTATION = "\u529F\u80FD\u5B9E\u73B0\u95EE\u9898",
450
+ REQUIREMENT_CHANGE = "\u9700\u6C42\u53D8\u66F4\u95EE\u9898",
451
+ LEGACY_ISSUE = "\u5386\u53F2\u9057\u7559\u95EE\u9898",
452
+ CODE_LOGIC = "\u4EE3\u7801\u903B\u8F91\u95EE\u9898",
453
+ USER_INTERFACE = "\u7528\u6237\u754C\u9762\u95EE\u9898",
454
+ INTERFACE = "\u63A5\u53E3\u95EE\u9898",
455
+ DATA = "\u6570\u636E\u95EE\u9898",
456
+ PERFORMANCE = "\u6027\u80FD\u95EE\u9898",
457
+ ENVIRONMENT = "\u73AF\u5883\u95EE\u9898",
458
+ COMPATIBILITY = "\u517C\u5BB9\u6027\u95EE\u9898",
459
+ PRODUCT_DESIGN = "\u4EA7\u54C1\u8BBE\u8BA1\u95EE\u9898",
460
+ OPTIMIZATION_SUGGESTION = "\u4F18\u5316\u5EFA\u8BAE\u95EE\u9898",
461
+ TECH_REQUIREMENT_CHANGE = "\u6280\u672F\u5F15\u8D77\u7684\u9700\u6C42\u53D8\u66F4\u95EE\u9898",
462
+ USAGE_AND_CONFIG = "\u4F7F\u7528\u53CA\u914D\u7F6E\u95EE\u9898",
463
+ OTHER = "\u5176\u4ED6\u95EE\u9898"
459
464
  }
460
465
  /**
461
466
  * 用户工作项统计信息
@@ -520,3 +525,42 @@ export interface AllWorkHourStats {
520
525
  totalEntries: number;
521
526
  userStats: UserAllWorkHourStats[];
522
527
  }
528
+ /**
529
+ * 配置键枚举
530
+ * 用于类型安全的配置项访问
531
+ */
532
+ export declare enum ConfigKey {
533
+ HUAWEI_CLOUD_IAM_ENDPOINT = "HUAWEI_CLOUD_IAM_ENDPOINT",
534
+ HUAWEI_CLOUD_REGION = "HUAWEI_CLOUD_REGION",
535
+ HUAWEI_CLOUD_USERNAME = "HUAWEI_CLOUD_USERNAME",
536
+ HUAWEI_CLOUD_PASSWORD = "HUAWEI_CLOUD_PASSWORD",
537
+ HUAWEI_CLOUD_DOMAIN = "HUAWEI_CLOUD_DOMAIN",
538
+ CODEARTS_BASE_URL = "CODEARTS_BASE_URL",
539
+ PROJECT_ID = "PROJECT_ID",
540
+ ROLE_ID = "ROLE_ID"
541
+ }
542
+ /**
543
+ * 不可变配置键(只能通过 config 命令设置)
544
+ */
545
+ export declare const IMMUTABLE_CONFIG_KEYS: ConfigKey[];
546
+ /**
547
+ * 可变配置键(可以通过命令行参数覆盖)
548
+ */
549
+ export declare const MUTABLE_CONFIG_KEYS: ConfigKey[];
550
+ /**
551
+ * 类型安全的配置映射
552
+ */
553
+ export type ConfigMap = {
554
+ [ConfigKey.HUAWEI_CLOUD_IAM_ENDPOINT]: string;
555
+ [ConfigKey.HUAWEI_CLOUD_REGION]: string;
556
+ [ConfigKey.HUAWEI_CLOUD_USERNAME]: string;
557
+ [ConfigKey.HUAWEI_CLOUD_PASSWORD]: string;
558
+ [ConfigKey.HUAWEI_CLOUD_DOMAIN]: string;
559
+ [ConfigKey.CODEARTS_BASE_URL]: string;
560
+ [ConfigKey.PROJECT_ID]: string;
561
+ [ConfigKey.ROLE_ID]: string;
562
+ };
563
+ /**
564
+ * 部分配置映射(用于读取配置文件)
565
+ */
566
+ export type PartialConfigMap = Partial<ConfigMap>;
@@ -1,2 +1,58 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.MUTABLE_CONFIG_KEYS = exports.IMMUTABLE_CONFIG_KEYS = exports.ConfigKey = exports.DefectAnalysisType = void 0;
4
+ /**
5
+ * 缺陷技术分析选项枚举
6
+ * custom_field32(缺陷技术分析)字段的选项值枚举定义
7
+ */
8
+ var DefectAnalysisType;
9
+ (function (DefectAnalysisType) {
10
+ DefectAnalysisType["FUNCTION_IMPLEMENTATION"] = "\u529F\u80FD\u5B9E\u73B0\u95EE\u9898";
11
+ DefectAnalysisType["REQUIREMENT_CHANGE"] = "\u9700\u6C42\u53D8\u66F4\u95EE\u9898";
12
+ DefectAnalysisType["LEGACY_ISSUE"] = "\u5386\u53F2\u9057\u7559\u95EE\u9898";
13
+ DefectAnalysisType["CODE_LOGIC"] = "\u4EE3\u7801\u903B\u8F91\u95EE\u9898";
14
+ DefectAnalysisType["USER_INTERFACE"] = "\u7528\u6237\u754C\u9762\u95EE\u9898";
15
+ DefectAnalysisType["INTERFACE"] = "\u63A5\u53E3\u95EE\u9898";
16
+ DefectAnalysisType["DATA"] = "\u6570\u636E\u95EE\u9898";
17
+ DefectAnalysisType["PERFORMANCE"] = "\u6027\u80FD\u95EE\u9898";
18
+ DefectAnalysisType["ENVIRONMENT"] = "\u73AF\u5883\u95EE\u9898";
19
+ DefectAnalysisType["COMPATIBILITY"] = "\u517C\u5BB9\u6027\u95EE\u9898";
20
+ DefectAnalysisType["PRODUCT_DESIGN"] = "\u4EA7\u54C1\u8BBE\u8BA1\u95EE\u9898";
21
+ DefectAnalysisType["OPTIMIZATION_SUGGESTION"] = "\u4F18\u5316\u5EFA\u8BAE\u95EE\u9898";
22
+ DefectAnalysisType["TECH_REQUIREMENT_CHANGE"] = "\u6280\u672F\u5F15\u8D77\u7684\u9700\u6C42\u53D8\u66F4\u95EE\u9898";
23
+ DefectAnalysisType["USAGE_AND_CONFIG"] = "\u4F7F\u7528\u53CA\u914D\u7F6E\u95EE\u9898";
24
+ DefectAnalysisType["OTHER"] = "\u5176\u4ED6\u95EE\u9898";
25
+ })(DefectAnalysisType || (exports.DefectAnalysisType = DefectAnalysisType = {}));
26
+ /**
27
+ * 配置键枚举
28
+ * 用于类型安全的配置项访问
29
+ */
30
+ var ConfigKey;
31
+ (function (ConfigKey) {
32
+ // 不可变配置(只能通过 config 命令设置)
33
+ ConfigKey["HUAWEI_CLOUD_IAM_ENDPOINT"] = "HUAWEI_CLOUD_IAM_ENDPOINT";
34
+ ConfigKey["HUAWEI_CLOUD_REGION"] = "HUAWEI_CLOUD_REGION";
35
+ ConfigKey["HUAWEI_CLOUD_USERNAME"] = "HUAWEI_CLOUD_USERNAME";
36
+ ConfigKey["HUAWEI_CLOUD_PASSWORD"] = "HUAWEI_CLOUD_PASSWORD";
37
+ ConfigKey["HUAWEI_CLOUD_DOMAIN"] = "HUAWEI_CLOUD_DOMAIN";
38
+ ConfigKey["CODEARTS_BASE_URL"] = "CODEARTS_BASE_URL";
39
+ ConfigKey["PROJECT_ID"] = "PROJECT_ID";
40
+ // 可变配置(可以通过命令行参数覆盖)
41
+ ConfigKey["ROLE_ID"] = "ROLE_ID";
42
+ })(ConfigKey || (exports.ConfigKey = ConfigKey = {}));
43
+ /**
44
+ * 不可变配置键(只能通过 config 命令设置)
45
+ */
46
+ exports.IMMUTABLE_CONFIG_KEYS = [
47
+ ConfigKey.HUAWEI_CLOUD_IAM_ENDPOINT,
48
+ ConfigKey.HUAWEI_CLOUD_REGION,
49
+ ConfigKey.HUAWEI_CLOUD_USERNAME,
50
+ ConfigKey.HUAWEI_CLOUD_PASSWORD,
51
+ ConfigKey.HUAWEI_CLOUD_DOMAIN,
52
+ ConfigKey.CODEARTS_BASE_URL,
53
+ ConfigKey.PROJECT_ID,
54
+ ];
55
+ /**
56
+ * 可变配置键(可以通过命令行参数覆盖)
57
+ */
58
+ exports.MUTABLE_CONFIG_KEYS = [ConfigKey.ROLE_ID];
@@ -1,13 +1,27 @@
1
- import { HuaweiCloudConfig } from '../types';
1
+ import { HuaweiCloudConfig, PartialConfigMap } from '../types';
2
+ /**
3
+ * 获取全局配置文件路径
4
+ */
5
+ export declare function getGlobalConfigPath(): string;
6
+ /**
7
+ * 检查全局配置文件是否存在
8
+ */
9
+ export declare function globalConfigExists(): boolean;
10
+ /**
11
+ * 读取全局配置
12
+ */
13
+ export declare function readGlobalConfig(): PartialConfigMap;
14
+ /**
15
+ * 写入全局配置
16
+ * 支持动态配置项,自动按分组组织配置文件
17
+ */
18
+ export declare function writeGlobalConfig(config: PartialConfigMap): void;
19
+ /**
20
+ * 删除全局配置
21
+ */
22
+ export declare function deleteGlobalConfig(): void;
2
23
  export interface CliOptions {
3
- projectId?: string;
4
24
  roleId?: string;
5
- username?: string;
6
- password?: string;
7
- domain?: string;
8
- region?: string;
9
- iamEndpoint?: string;
10
- codeartsUrl?: string;
11
25
  }
12
26
  export interface LoadedConfig {
13
27
  projectId: string;
@@ -15,8 +29,13 @@ export interface LoadedConfig {
15
29
  config: HuaweiCloudConfig;
16
30
  }
17
31
  /**
18
- * 加载配置,优先级:命令行参数 > 当前目录 .env > 全局配置 > 默认值
32
+ * 加载配置,优先级:命令行参数 > 全局配置
19
33
  * @param cliOptions 命令行选项
20
34
  * @returns 加载的配置
21
35
  */
22
36
  export declare function loadConfig(cliOptions?: CliOptions): LoadedConfig;
37
+ /**
38
+ * 获取最终合并后的配置(用于显示)
39
+ * @returns 合并后的配置映射
40
+ */
41
+ export declare function getConfig(): PartialConfigMap;