gitlab-auto-reviewers 2.0.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/LICENSE +21 -0
- package/README.md +1878 -0
- package/dist/api/gitlab-api.d.ts +136 -0
- package/dist/api/gitlab-api.d.ts.map +1 -0
- package/dist/api/gitlab-api.js +334 -0
- package/dist/api/gitlab-api.js.map +1 -0
- package/dist/bin/cli.d.ts +10 -0
- package/dist/bin/cli.d.ts.map +1 -0
- package/dist/bin/cli.js +186 -0
- package/dist/bin/cli.js.map +1 -0
- package/dist/bin/deprecated-mcp.d.ts +12 -0
- package/dist/bin/deprecated-mcp.d.ts.map +1 -0
- package/dist/bin/deprecated-mcp.js +73 -0
- package/dist/bin/deprecated-mcp.js.map +1 -0
- package/dist/bin/index.d.ts +18 -0
- package/dist/bin/index.d.ts.map +1 -0
- package/dist/bin/index.js +78 -0
- package/dist/bin/index.js.map +1 -0
- package/dist/bin/mcp.d.ts +11 -0
- package/dist/bin/mcp.d.ts.map +1 -0
- package/dist/bin/mcp.js +43 -0
- package/dist/bin/mcp.js.map +1 -0
- package/dist/cache/cache.service.d.ts +113 -0
- package/dist/cache/cache.service.d.ts.map +1 -0
- package/dist/cache/cache.service.js +213 -0
- package/dist/cache/cache.service.js.map +1 -0
- package/dist/cli/commands.d.ts +40 -0
- package/dist/cli/commands.d.ts.map +1 -0
- package/dist/cli/commands.js +142 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/output.d.ts +24 -0
- package/dist/cli/output.d.ts.map +1 -0
- package/dist/cli/output.js +143 -0
- package/dist/cli/output.js.map +1 -0
- package/dist/config/config.service.d.ts +89 -0
- package/dist/config/config.service.d.ts.map +1 -0
- package/dist/config/config.service.js +169 -0
- package/dist/config/config.service.js.map +1 -0
- package/dist/datasources/git-data-source.interface.d.ts +140 -0
- package/dist/datasources/git-data-source.interface.d.ts.map +1 -0
- package/dist/datasources/git-data-source.interface.js +2 -0
- package/dist/datasources/git-data-source.interface.js.map +1 -0
- package/dist/datasources/gitlab-api-data-source.d.ts +127 -0
- package/dist/datasources/gitlab-api-data-source.d.ts.map +1 -0
- package/dist/datasources/gitlab-api-data-source.js +248 -0
- package/dist/datasources/gitlab-api-data-source.js.map +1 -0
- package/dist/datasources/local-git-data-source.d.ts +124 -0
- package/dist/datasources/local-git-data-source.d.ts.map +1 -0
- package/dist/datasources/local-git-data-source.js +580 -0
- package/dist/datasources/local-git-data-source.js.map +1 -0
- package/dist/errors/error-handler.d.ts +113 -0
- package/dist/errors/error-handler.d.ts.map +1 -0
- package/dist/errors/error-handler.js +230 -0
- package/dist/errors/error-handler.js.map +1 -0
- package/dist/index.d.ts +139 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/logging/example.d.ts +15 -0
- package/dist/logging/example.d.ts.map +1 -0
- package/dist/logging/example.js +79 -0
- package/dist/logging/example.js.map +1 -0
- package/dist/logging/index.d.ts +7 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +7 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.service.d.ts +98 -0
- package/dist/logging/logger.service.d.ts.map +1 -0
- package/dist/logging/logger.service.js +160 -0
- package/dist/logging/logger.service.js.map +1 -0
- package/dist/mcp/server.d.ts +67 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +213 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +176 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/services/blacklist.service.d.ts +32 -0
- package/dist/services/blacklist.service.d.ts.map +1 -0
- package/dist/services/blacklist.service.js +59 -0
- package/dist/services/blacklist.service.js.map +1 -0
- package/dist/services/codeowners.service.d.ts +45 -0
- package/dist/services/codeowners.service.d.ts.map +1 -0
- package/dist/services/codeowners.service.js +200 -0
- package/dist/services/codeowners.service.js.map +1 -0
- package/dist/services/comment-builder.service.d.ts +48 -0
- package/dist/services/comment-builder.service.d.ts.map +1 -0
- package/dist/services/comment-builder.service.js +61 -0
- package/dist/services/comment-builder.service.js.map +1 -0
- package/dist/services/contributors.service.d.ts +52 -0
- package/dist/services/contributors.service.d.ts.map +1 -0
- package/dist/services/contributors.service.js +144 -0
- package/dist/services/contributors.service.js.map +1 -0
- package/dist/services/reviewer-service.d.ts +125 -0
- package/dist/services/reviewer-service.d.ts.map +1 -0
- package/dist/services/reviewer-service.js +554 -0
- package/dist/services/reviewer-service.js.map +1 -0
- package/dist/services/team-members.service.d.ts +29 -0
- package/dist/services/team-members.service.d.ts.map +1 -0
- package/dist/services/team-members.service.js +45 -0
- package/dist/services/team-members.service.js.map +1 -0
- package/dist/services/whitelist.service.d.ts +31 -0
- package/dist/services/whitelist.service.d.ts.map +1 -0
- package/dist/services/whitelist.service.js +51 -0
- package/dist/services/whitelist.service.js.map +1 -0
- package/dist/tools.d.ts +22 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +176 -0
- package/dist/tools.js.map +1 -0
- package/dist/types/index.d.ts +502 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +91 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types.d.ts +219 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +7 -0
- package/dist/types.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC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I,CAAC,kBAAkB,EAAE;YACnC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,OAAO;SACvB,CAAC,CAAC;QAEH,cAAc;QACd,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAEnB,eAAe;QACf,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;QAE1B,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC;IACxD,CAAC;CACF"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module defines all tools exposed by the Auto Reviewers MCP Server.
|
|
5
|
+
* Each tool follows the Model Context Protocol specification and includes
|
|
6
|
+
* detailed input schemas for validation.
|
|
7
|
+
*
|
|
8
|
+
* @module mcp/tools
|
|
9
|
+
*/
|
|
10
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Array of all tools exposed by the MCP server
|
|
13
|
+
*
|
|
14
|
+
* Tools:
|
|
15
|
+
* - suggest_reviewers: Suggest reviewers based on multiple factors
|
|
16
|
+
* - get_contributor_analysis: Analyze file contributors
|
|
17
|
+
* - get_reviewer_workload: Analyze reviewer workload
|
|
18
|
+
* - post_comment: Post a comment to a merge request
|
|
19
|
+
* - invite_reviewers: Suggest and invite reviewers
|
|
20
|
+
*/
|
|
21
|
+
export declare const TOOLS: Tool[];
|
|
22
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAE1D;;;;;;;;;GASG;AACH,eAAO,MAAM,KAAK,EAAE,IAAI,EAuKvB,CAAC"}
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tool Definitions
|
|
3
|
+
*
|
|
4
|
+
* This module defines all tools exposed by the Auto Reviewers MCP Server.
|
|
5
|
+
* Each tool follows the Model Context Protocol specification and includes
|
|
6
|
+
* detailed input schemas for validation.
|
|
7
|
+
*
|
|
8
|
+
* @module mcp/tools
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Array of all tools exposed by the MCP server
|
|
12
|
+
*
|
|
13
|
+
* Tools:
|
|
14
|
+
* - suggest_reviewers: Suggest reviewers based on multiple factors
|
|
15
|
+
* - get_contributor_analysis: Analyze file contributors
|
|
16
|
+
* - get_reviewer_workload: Analyze reviewer workload
|
|
17
|
+
* - post_comment: Post a comment to a merge request
|
|
18
|
+
* - invite_reviewers: Suggest and invite reviewers
|
|
19
|
+
*/
|
|
20
|
+
export const TOOLS = [
|
|
21
|
+
{
|
|
22
|
+
name: "suggest_reviewers",
|
|
23
|
+
description: "Automatically suggest reviewers for a GitLab merge request based on contributors, team members, and code owners",
|
|
24
|
+
inputSchema: {
|
|
25
|
+
type: "object",
|
|
26
|
+
properties: {
|
|
27
|
+
project: {
|
|
28
|
+
type: ["string", "number"],
|
|
29
|
+
description: "GitLab project ID (e.g., 12345) or project path (e.g., 'group/project-name')",
|
|
30
|
+
},
|
|
31
|
+
mergeRequestIid: {
|
|
32
|
+
type: "number",
|
|
33
|
+
description: "Merge request internal ID (optional if branch provided)",
|
|
34
|
+
},
|
|
35
|
+
branch: {
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Branch name (optional, uses current branch if not provided)",
|
|
38
|
+
},
|
|
39
|
+
gitlabToken: {
|
|
40
|
+
type: "string",
|
|
41
|
+
description: "GitLab API token (optional, uses environment variable if not provided)",
|
|
42
|
+
},
|
|
43
|
+
gitlabUrl: {
|
|
44
|
+
type: "string",
|
|
45
|
+
description: "GitLab instance URL (optional, defaults to gitlab.com)",
|
|
46
|
+
},
|
|
47
|
+
repoPath: {
|
|
48
|
+
type: "string",
|
|
49
|
+
description: "Local repository path (optional, uses API if not provided)",
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
required: [],
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: "get_contributor_analysis",
|
|
57
|
+
description: "Get detailed contributor analysis for changed files in a merge request",
|
|
58
|
+
inputSchema: {
|
|
59
|
+
type: "object",
|
|
60
|
+
properties: {
|
|
61
|
+
project: {
|
|
62
|
+
type: ["string", "number"],
|
|
63
|
+
description: "GitLab project ID (e.g., 12345) or project path (e.g., 'group/project-name')",
|
|
64
|
+
},
|
|
65
|
+
mergeRequestIid: {
|
|
66
|
+
type: "number",
|
|
67
|
+
description: "Merge request internal ID",
|
|
68
|
+
},
|
|
69
|
+
gitlabToken: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "GitLab API token (optional)",
|
|
72
|
+
},
|
|
73
|
+
gitlabUrl: {
|
|
74
|
+
type: "string",
|
|
75
|
+
description: "GitLab instance URL (optional)",
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: ["project", "mergeRequestIid"],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
name: "get_reviewer_workload",
|
|
83
|
+
description: "Get current workload analysis for potential reviewers",
|
|
84
|
+
inputSchema: {
|
|
85
|
+
type: "object",
|
|
86
|
+
properties: {
|
|
87
|
+
project: {
|
|
88
|
+
type: ["string", "number"],
|
|
89
|
+
description: "GitLab project ID (e.g., 12345) or project path (e.g., 'group/project-name')",
|
|
90
|
+
},
|
|
91
|
+
gitlabToken: {
|
|
92
|
+
type: "string",
|
|
93
|
+
description: "GitLab API token (optional)",
|
|
94
|
+
},
|
|
95
|
+
gitlabUrl: {
|
|
96
|
+
type: "string",
|
|
97
|
+
description: "GitLab instance URL (optional)",
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
required: ["project"],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
name: "post_comment",
|
|
105
|
+
description: "Post a comment to a GitLab merge request",
|
|
106
|
+
inputSchema: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
project: {
|
|
110
|
+
type: ["string", "number"],
|
|
111
|
+
description: "GitLab project ID or path (optional in local git mode)",
|
|
112
|
+
},
|
|
113
|
+
mergeRequestIid: {
|
|
114
|
+
type: "number",
|
|
115
|
+
description: "Merge request internal ID (optional if branch provided)",
|
|
116
|
+
},
|
|
117
|
+
branch: {
|
|
118
|
+
type: "string",
|
|
119
|
+
description: "Branch name (optional)",
|
|
120
|
+
},
|
|
121
|
+
comment: {
|
|
122
|
+
type: "string",
|
|
123
|
+
description: "Comment text to post",
|
|
124
|
+
},
|
|
125
|
+
gitlabToken: {
|
|
126
|
+
type: "string",
|
|
127
|
+
description: "GitLab API token (optional)",
|
|
128
|
+
},
|
|
129
|
+
gitlabUrl: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "GitLab instance URL (optional)",
|
|
132
|
+
},
|
|
133
|
+
repoPath: {
|
|
134
|
+
type: "string",
|
|
135
|
+
description: "Local repository path (optional)",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
required: ["comment"],
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
name: "invite_reviewers",
|
|
143
|
+
description: "Suggest reviewers, post comment, and invite them to a GitLab merge request",
|
|
144
|
+
inputSchema: {
|
|
145
|
+
type: "object",
|
|
146
|
+
properties: {
|
|
147
|
+
project: {
|
|
148
|
+
type: ["string", "number"],
|
|
149
|
+
description: "GitLab project ID or path (optional in local git mode)",
|
|
150
|
+
},
|
|
151
|
+
mergeRequestIid: {
|
|
152
|
+
type: "number",
|
|
153
|
+
description: "Merge request internal ID (optional if branch provided)",
|
|
154
|
+
},
|
|
155
|
+
branch: {
|
|
156
|
+
type: "string",
|
|
157
|
+
description: "Branch name (optional)",
|
|
158
|
+
},
|
|
159
|
+
gitlabToken: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: "GitLab API token (optional)",
|
|
162
|
+
},
|
|
163
|
+
gitlabUrl: {
|
|
164
|
+
type: "string",
|
|
165
|
+
description: "GitLab instance URL (optional)",
|
|
166
|
+
},
|
|
167
|
+
repoPath: {
|
|
168
|
+
type: "string",
|
|
169
|
+
description: "Local repository path (optional)",
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
required: [],
|
|
173
|
+
},
|
|
174
|
+
},
|
|
175
|
+
];
|
|
176
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/mcp/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,KAAK,GAAW;IAC3B;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,iHAAiH;QACnH,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,OAAO,EAAE;oBACP,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;oBAC1B,WAAW,EACT,8EAA8E;iBACjF;gBACD,eAAe,EAAE;oBACf,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,yDAAyD;iBAC5D;gBACD,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,6DAA6D;iBAChE;gBACD,WAAW,EAAE;oBACX,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,wEAAwE;iBAC3E;gBACD,SAAS,EAAE;oBACT,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,wDAAwD;iBACtE;gBACD,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EACT,4DAA4D;iBAC/D;aACF;YACD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
3
|
+
* Service for managing reviewer blacklists based on merge request history.
|
|
4
|
+
*
|
|
5
|
+
* Analyzes merge request notes to identify users who have been invited as reviewers
|
|
6
|
+
* and then had their review requests removed, building a blacklist of users who
|
|
7
|
+
* should not be automatically invited again.
|
|
8
|
+
*/
|
|
9
|
+
export declare class BlacklistService {
|
|
10
|
+
private dataSource;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a new BlacklistService instance.
|
|
13
|
+
*
|
|
14
|
+
* @param dataSource - The data source for accessing GitLab data
|
|
15
|
+
*/
|
|
16
|
+
constructor(dataSource: GitDataSource);
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the blacklist of users who should not be invited as reviewers.
|
|
19
|
+
*
|
|
20
|
+
* Analyzes merge request notes to find users who were invited as reviewers
|
|
21
|
+
* and then had their review requests removed. Also includes the MR author
|
|
22
|
+
* in the blacklist to prevent self-review.
|
|
23
|
+
*
|
|
24
|
+
* @param project - The GitLab project identifier (ID or path)
|
|
25
|
+
* @param mr - The merge request IID
|
|
26
|
+
* @param author - The username of the merge request author
|
|
27
|
+
* @returns Array of usernames that should be excluded from reviewer suggestions
|
|
28
|
+
*/
|
|
29
|
+
getBlackList(project: string, mr: number, author: string): Promise<string[]>;
|
|
30
|
+
private updateInvitation;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=blacklist.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blacklist.service.d.ts","sourceRoot":"","sources":["../../src/services/blacklist.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAG5E;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAMf,OAAO,CAAC,UAAU;IAL9B;;;;OAIG;gBACiB,UAAU,EAAE,aAAa;IAE7C;;;;;;;;;;;OAWG;IACG,YAAY,CAChB,OAAO,EAAE,MAAM,EACf,EAAE,EAAE,MAAM,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,EAAE,CAAC;IAmBpB,OAAO,CAAC,gBAAgB;CAgBzB"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for managing reviewer blacklists based on merge request history.
|
|
3
|
+
*
|
|
4
|
+
* Analyzes merge request notes to identify users who have been invited as reviewers
|
|
5
|
+
* and then had their review requests removed, building a blacklist of users who
|
|
6
|
+
* should not be automatically invited again.
|
|
7
|
+
*/
|
|
8
|
+
export class BlacklistService {
|
|
9
|
+
dataSource;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new BlacklistService instance.
|
|
12
|
+
*
|
|
13
|
+
* @param dataSource - The data source for accessing GitLab data
|
|
14
|
+
*/
|
|
15
|
+
constructor(dataSource) {
|
|
16
|
+
this.dataSource = dataSource;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves the blacklist of users who should not be invited as reviewers.
|
|
20
|
+
*
|
|
21
|
+
* Analyzes merge request notes to find users who were invited as reviewers
|
|
22
|
+
* and then had their review requests removed. Also includes the MR author
|
|
23
|
+
* in the blacklist to prevent self-review.
|
|
24
|
+
*
|
|
25
|
+
* @param project - The GitLab project identifier (ID or path)
|
|
26
|
+
* @param mr - The merge request IID
|
|
27
|
+
* @param author - The username of the merge request author
|
|
28
|
+
* @returns Array of usernames that should be excluded from reviewer suggestions
|
|
29
|
+
*/
|
|
30
|
+
async getBlackList(project, mr, author) {
|
|
31
|
+
const invited = {};
|
|
32
|
+
const notes = await this.dataSource.getNotes(project, mr);
|
|
33
|
+
notes.forEach((note) => {
|
|
34
|
+
if (note.body.startsWith("requested review from ")) {
|
|
35
|
+
this.updateInvitation(invited, note.body, true);
|
|
36
|
+
}
|
|
37
|
+
if (note.body.startsWith("removed review request for ")) {
|
|
38
|
+
this.updateInvitation(invited, note.body, false);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
return [
|
|
42
|
+
...Object.keys(invited).filter((username) => !invited[username]),
|
|
43
|
+
author,
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
updateInvitation(reviewers, text, invited) {
|
|
47
|
+
const splitter = /,? (?:and )?@/;
|
|
48
|
+
text
|
|
49
|
+
.split(splitter)
|
|
50
|
+
.slice(1)
|
|
51
|
+
.map((username) => username.toLowerCase())
|
|
52
|
+
.forEach((username) => {
|
|
53
|
+
if (!reviewers.hasOwnProperty(username)) {
|
|
54
|
+
reviewers[username] = invited;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=blacklist.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blacklist.service.js","sourceRoot":"","sources":["../../src/services/blacklist.service.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,MAAM,OAAO,gBAAgB;IAMP;IALpB;;;;OAIG;IACH,YAAoB,UAAyB;QAAzB,eAAU,GAAV,UAAU,CAAe;IAAG,CAAC;IAEjD;;;;;;;;;;;OAWG;IACH,KAAK,CAAC,YAAY,CAChB,OAAe,EACf,EAAU,EACV,MAAc;QAEd,MAAM,OAAO,GAA4B,EAAE,CAAC;QAC5C,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAE1D,KAAK,CAAC,OAAO,CAAC,CAAC,IAAgB,EAAE,EAAE;YACjC,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,wBAAwB,CAAC,EAAE,CAAC;gBACnD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;YAClD,CAAC;YACD,IAAI,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,6BAA6B,CAAC,EAAE,CAAC;gBACxD,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACnD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,OAAO;YACL,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAChE,MAAM;SACP,CAAC;IACJ,CAAC;IAEO,gBAAgB,CACtB,SAAkC,EAClC,IAAY,EACZ,OAAgB;QAEhB,MAAM,QAAQ,GAAG,eAAe,CAAC;QACjC,IAAI;aACD,KAAK,CAAC,QAAQ,CAAC;aACf,KAAK,CAAC,CAAC,CAAC;aACR,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC;aACzC,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YACpB,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACxC,SAAS,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC;YAChC,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;CACF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { GitDataSource } from "../datasources/git-data-source.interface.js";
|
|
2
|
+
import { CodeOwnerRule, CodeOwnerMatch, Contributor } from "../types.js";
|
|
3
|
+
interface LoadBalancedCodeOwnerGroup extends CodeOwnerMatch {
|
|
4
|
+
allOwners?: string[];
|
|
5
|
+
loadBalanced?: boolean;
|
|
6
|
+
ownerScores?: Array<{
|
|
7
|
+
username: string;
|
|
8
|
+
ratio: number;
|
|
9
|
+
fte: number;
|
|
10
|
+
assignedMRs: number;
|
|
11
|
+
}>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Service for parsing and matching CODEOWNERS files with load balancing support.
|
|
15
|
+
*
|
|
16
|
+
* Handles GitLab CODEOWNERS file format including sections, approval requirements,
|
|
17
|
+
* and default owners. Provides load balancing to distribute review assignments
|
|
18
|
+
* based on team member FTE and current workload.
|
|
19
|
+
*/
|
|
20
|
+
export declare class CodeOwnersService {
|
|
21
|
+
private dataSource;
|
|
22
|
+
/**
|
|
23
|
+
* Creates a new CodeOwnersService instance.
|
|
24
|
+
*
|
|
25
|
+
* @param dataSource - The data source for accessing GitLab data
|
|
26
|
+
*/
|
|
27
|
+
constructor(dataSource: GitDataSource);
|
|
28
|
+
/**
|
|
29
|
+
* Retrieves and parses the CODEOWNERS file from a GitLab project.
|
|
30
|
+
*
|
|
31
|
+
* Searches for CODEOWNERS file in standard locations (root, docs/, .gitlab/)
|
|
32
|
+
* and parses it into structured rules with sections and ownership information.
|
|
33
|
+
*
|
|
34
|
+
* @param project - The GitLab project identifier (ID or path)
|
|
35
|
+
* @param commitSha - The commit SHA to read CODEOWNERS from
|
|
36
|
+
* @returns Array of parsed code owner rules, or empty array if no CODEOWNERS file found
|
|
37
|
+
*/
|
|
38
|
+
getCodeOwners(project: string, commitSha: string): Promise<CodeOwnerRule[]>;
|
|
39
|
+
private parseCodeOwners;
|
|
40
|
+
matchCodeOwners(filePaths: string[], rules: CodeOwnerRule[]): CodeOwnerMatch[];
|
|
41
|
+
applyLoadBalancing(groups: CodeOwnerMatch[], contributors: Contributor[], workload: Record<string, number>): LoadBalancedCodeOwnerGroup[];
|
|
42
|
+
private matchesPattern;
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
45
|
+
//# sourceMappingURL=codeowners.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codeowners.service.d.ts","sourceRoot":"","sources":["../../src/services/codeowners.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAqBzE,UAAU,0BAA2B,SAAQ,cAAc;IACzD,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,CAAC;QACZ,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC,CAAC;CACJ;AAED;;;;;;GAMG;AACH,qBAAa,iBAAiB;IAMhB,OAAO,CAAC,UAAU;IAL9B;;;;OAIG;gBACiB,UAAU,EAAE,aAAa;IAE7C;;;;;;;;;OASG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,EAAE,CAAC;IAoBjF,OAAO,CAAC,eAAe;IAmDvB,eAAe,CACb,SAAS,EAAE,MAAM,EAAE,EACnB,KAAK,EAAE,aAAa,EAAE,GACrB,cAAc,EAAE;IAkDnB,kBAAkB,CAChB,MAAM,EAAE,cAAc,EAAE,EACxB,YAAY,EAAE,WAAW,EAAE,EAC3B,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,0BAA0B,EAAE;IAyC/B,OAAO,CAAC,cAAc;CAyCvB"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for parsing and matching CODEOWNERS files with load balancing support.
|
|
3
|
+
*
|
|
4
|
+
* Handles GitLab CODEOWNERS file format including sections, approval requirements,
|
|
5
|
+
* and default owners. Provides load balancing to distribute review assignments
|
|
6
|
+
* based on team member FTE and current workload.
|
|
7
|
+
*/
|
|
8
|
+
export class CodeOwnersService {
|
|
9
|
+
dataSource;
|
|
10
|
+
/**
|
|
11
|
+
* Creates a new CodeOwnersService instance.
|
|
12
|
+
*
|
|
13
|
+
* @param dataSource - The data source for accessing GitLab data
|
|
14
|
+
*/
|
|
15
|
+
constructor(dataSource) {
|
|
16
|
+
this.dataSource = dataSource;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves and parses the CODEOWNERS file from a GitLab project.
|
|
20
|
+
*
|
|
21
|
+
* Searches for CODEOWNERS file in standard locations (root, docs/, .gitlab/)
|
|
22
|
+
* and parses it into structured rules with sections and ownership information.
|
|
23
|
+
*
|
|
24
|
+
* @param project - The GitLab project identifier (ID or path)
|
|
25
|
+
* @param commitSha - The commit SHA to read CODEOWNERS from
|
|
26
|
+
* @returns Array of parsed code owner rules, or empty array if no CODEOWNERS file found
|
|
27
|
+
*/
|
|
28
|
+
async getCodeOwners(project, commitSha) {
|
|
29
|
+
const locations = ["CODEOWNERS", "docs/CODEOWNERS", ".gitlab/CODEOWNERS"];
|
|
30
|
+
for (const location of locations) {
|
|
31
|
+
try {
|
|
32
|
+
const content = await this.dataSource.getRawFile(project, commitSha, location);
|
|
33
|
+
if (!content)
|
|
34
|
+
throw new Error("File not found");
|
|
35
|
+
return this.parseCodeOwners(content);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
parseCodeOwners(content) {
|
|
44
|
+
const lines = content
|
|
45
|
+
.split("\n")
|
|
46
|
+
.map((l) => l.trim())
|
|
47
|
+
.filter((l) => l && !l.startsWith("#"));
|
|
48
|
+
const rules = [];
|
|
49
|
+
let currentSection = null;
|
|
50
|
+
for (const line of lines) {
|
|
51
|
+
if (line.startsWith("[")) {
|
|
52
|
+
const match = line.match(/^\[([^\]]+)\](?:\[(\d+)\])?\s*(.*)$/);
|
|
53
|
+
if (match) {
|
|
54
|
+
const [, sectionName, approvalCount, defaultOwners] = match;
|
|
55
|
+
currentSection = {
|
|
56
|
+
name: sectionName,
|
|
57
|
+
approvals: approvalCount ? parseInt(approvalCount) : 1,
|
|
58
|
+
defaultOwners: defaultOwners
|
|
59
|
+
? defaultOwners
|
|
60
|
+
.split(/\s+/)
|
|
61
|
+
.filter((o) => o.startsWith("@"))
|
|
62
|
+
.map((o) => o.substring(1).toLowerCase())
|
|
63
|
+
: [],
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const parts = line.split(/\s+/);
|
|
69
|
+
if (parts.length >= 1) {
|
|
70
|
+
const pattern = parts[0];
|
|
71
|
+
const owners = parts
|
|
72
|
+
.slice(1)
|
|
73
|
+
.filter((o) => o.startsWith("@"))
|
|
74
|
+
.map((o) => o.substring(1).toLowerCase());
|
|
75
|
+
if (owners.length > 0 || (currentSection?.defaultOwners && currentSection.defaultOwners.length > 0)) {
|
|
76
|
+
const allOwners = [...owners];
|
|
77
|
+
if (currentSection?.defaultOwners) {
|
|
78
|
+
currentSection.defaultOwners.forEach((o) => {
|
|
79
|
+
if (!allOwners.includes(o))
|
|
80
|
+
allOwners.push(o);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
rules.push({ pattern, owners: allOwners, section: currentSection?.name });
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return rules;
|
|
88
|
+
}
|
|
89
|
+
matchCodeOwners(filePaths, rules) {
|
|
90
|
+
const fileMatches = [];
|
|
91
|
+
for (const filePath of filePaths) {
|
|
92
|
+
let matchedOwners = [];
|
|
93
|
+
let matchedSection = null;
|
|
94
|
+
for (const rule of rules) {
|
|
95
|
+
if (this.matchesPattern(filePath, rule.pattern)) {
|
|
96
|
+
matchedOwners = rule.owners;
|
|
97
|
+
matchedSection = rule.section ? { name: rule.section, approvals: 1, defaultOwners: [] } : null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (matchedOwners.length > 0) {
|
|
101
|
+
fileMatches.push({
|
|
102
|
+
path: filePath,
|
|
103
|
+
owners: matchedOwners,
|
|
104
|
+
section: matchedSection || null,
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const sectionGroups = new Map();
|
|
109
|
+
for (const match of fileMatches) {
|
|
110
|
+
const sectionKey = match.section ? match.section.name : "Global";
|
|
111
|
+
if (!sectionGroups.has(sectionKey)) {
|
|
112
|
+
sectionGroups.set(sectionKey, {
|
|
113
|
+
sectionName: sectionKey,
|
|
114
|
+
approvals: match.section ? match.section.approvals : 1,
|
|
115
|
+
owners: new Set(),
|
|
116
|
+
files: [],
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
const group = sectionGroups.get(sectionKey);
|
|
120
|
+
match.owners.forEach((owner) => group.owners.add(owner));
|
|
121
|
+
group.files.push(match.path);
|
|
122
|
+
}
|
|
123
|
+
return Array.from(sectionGroups.values()).map((group) => ({
|
|
124
|
+
sectionName: group.sectionName,
|
|
125
|
+
files: group.files,
|
|
126
|
+
owners: Array.from(group.owners),
|
|
127
|
+
approvals: group.approvals,
|
|
128
|
+
}));
|
|
129
|
+
}
|
|
130
|
+
applyLoadBalancing(groups, contributors, workload) {
|
|
131
|
+
return groups.map((group) => {
|
|
132
|
+
const approvalCount = group.approvals !== undefined ? group.approvals : 1;
|
|
133
|
+
if (group.owners.length <= approvalCount) {
|
|
134
|
+
return group;
|
|
135
|
+
}
|
|
136
|
+
const ownerScores = group.owners.map((username) => {
|
|
137
|
+
const contributor = contributors.find((c) => c.username === username);
|
|
138
|
+
if (!contributor) {
|
|
139
|
+
console.error(`[CodeOwners] Owner ${username} not found in whitelist`);
|
|
140
|
+
return { username, ratio: 999, fte: 0, assignedMRs: 0 };
|
|
141
|
+
}
|
|
142
|
+
const assignedMRs = workload[username.toLowerCase()] || 0;
|
|
143
|
+
const relevantFte = contributor.teams?.reduce((sum, team) => sum + (team.fte || 0), 0) || 0;
|
|
144
|
+
const ratio = relevantFte > 0 ? assignedMRs / relevantFte : 999;
|
|
145
|
+
return { username, ratio, fte: relevantFte, assignedMRs };
|
|
146
|
+
});
|
|
147
|
+
const selectedOwners = ownerScores
|
|
148
|
+
.sort((a, b) => a.ratio - b.ratio)
|
|
149
|
+
.slice(0, approvalCount)
|
|
150
|
+
.map((o) => o.username);
|
|
151
|
+
return {
|
|
152
|
+
...group,
|
|
153
|
+
owners: selectedOwners,
|
|
154
|
+
allOwners: group.owners,
|
|
155
|
+
loadBalanced: true,
|
|
156
|
+
ownerScores: ownerScores.sort((a, b) => a.ratio - b.ratio),
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
matchesPattern(filePath, pattern) {
|
|
161
|
+
if (pattern === "*")
|
|
162
|
+
return true;
|
|
163
|
+
let isAbsolute = false;
|
|
164
|
+
if (pattern.startsWith("/")) {
|
|
165
|
+
isAbsolute = true;
|
|
166
|
+
pattern = pattern.substring(1);
|
|
167
|
+
}
|
|
168
|
+
if (pattern.endsWith("/")) {
|
|
169
|
+
const dirPattern = pattern.slice(0, -1);
|
|
170
|
+
if (isAbsolute) {
|
|
171
|
+
return filePath.startsWith(dirPattern + "/") || filePath === dirPattern;
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
return (filePath.includes("/" + dirPattern + "/") ||
|
|
175
|
+
filePath.startsWith(dirPattern + "/") ||
|
|
176
|
+
filePath === dirPattern);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
if (pattern.includes("*")) {
|
|
180
|
+
let regexPattern = pattern
|
|
181
|
+
.replace(/\./g, "\\.")
|
|
182
|
+
.replace(/\*\*/g, ".*")
|
|
183
|
+
.replace(/\*/g, "[^/]*");
|
|
184
|
+
if (isAbsolute) {
|
|
185
|
+
regexPattern = "^" + regexPattern + "$";
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
regexPattern = "(^|/)" + regexPattern + "$";
|
|
189
|
+
}
|
|
190
|
+
return new RegExp(regexPattern).test(filePath);
|
|
191
|
+
}
|
|
192
|
+
if (isAbsolute) {
|
|
193
|
+
return filePath === pattern;
|
|
194
|
+
}
|
|
195
|
+
else {
|
|
196
|
+
return filePath === pattern || filePath.endsWith("/" + pattern);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=codeowners.service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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,CAAC,GAAG,GAAG,UAAU,GAAG,GAAG,CAAC;oBACzC,QAAQ,CAAC,UAAU,CAAC,UAAU,GAAG,GAAG,CAAC;oBACrC,QAAQ,KAAK,UAAU,CACxB,CAAC;YACJ,CAAC;QACH,CAAC;QAED,IAAI,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YAC1B,IAAI,YAAY,GAAG,OAAO;iBACvB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;iBACrB,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;iBACtB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;YAC3B,IAAI,UAAU,EAAE,CAAC;gBACf,YAAY,GAAG,GAAG,GAAG,YAAY,GAAG,GAAG,CAAC;YAC1C,CAAC;iBAAM,CAAC;gBACN,YAAY,GAAG,OAAO,GAAG,YAAY,GAAG,GAAG,CAAC;YAC9C,CAAC;YACD,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjD,CAAC;QAED,IAAI,UAAU,EAAE,CAAC;YACf,OAAO,QAAQ,KAAK,OAAO,CAAC;QAC9B,CAAC;aAAM,CAAC;YACN,OAAO,QAAQ,KAAK,OAAO,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,GAAG,OAAO,CAAC,CAAC;QAClE,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { LoadBalancedTeam } from "../types/index.js";
|
|
2
|
+
interface ContributorChange {
|
|
3
|
+
path: string;
|
|
4
|
+
fragments?: string[];
|
|
5
|
+
}
|
|
6
|
+
interface ContributorForComment {
|
|
7
|
+
username: string;
|
|
8
|
+
changes: ContributorChange[];
|
|
9
|
+
}
|
|
10
|
+
interface CodeOwnerForComment {
|
|
11
|
+
sectionName: string;
|
|
12
|
+
files: string[];
|
|
13
|
+
owners: string[];
|
|
14
|
+
approvals?: number;
|
|
15
|
+
loadBalanced?: boolean;
|
|
16
|
+
allOwners?: string[];
|
|
17
|
+
ownerScores?: Array<{
|
|
18
|
+
username: string;
|
|
19
|
+
ratio: number;
|
|
20
|
+
fte?: number;
|
|
21
|
+
assignedMRs?: number;
|
|
22
|
+
}>;
|
|
23
|
+
}
|
|
24
|
+
interface ReviewerAssignmentCommentParams {
|
|
25
|
+
projectId: string;
|
|
26
|
+
base: string;
|
|
27
|
+
contributors: ContributorForComment[];
|
|
28
|
+
teamMembers: LoadBalancedTeam[];
|
|
29
|
+
codeOwners: CodeOwnerForComment[];
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Service for building formatted reviewer assignment comments for GitLab merge requests.
|
|
33
|
+
*
|
|
34
|
+
* Generates markdown-formatted comments that include reviewer suggestions with
|
|
35
|
+
* file links, load balancing information, and GitLab quick actions for assigning reviewers.
|
|
36
|
+
*/
|
|
37
|
+
export declare class CommentBuilderService {
|
|
38
|
+
private gitlabUrl;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new CommentBuilderService instance.
|
|
41
|
+
*
|
|
42
|
+
* @param gitlabUrl - The base URL of the GitLab instance (e.g., 'https://gitlab.com')
|
|
43
|
+
*/
|
|
44
|
+
constructor(gitlabUrl: string);
|
|
45
|
+
buildReviewerAssignmentComment({ projectId, base, contributors, teamMembers, codeOwners, }: ReviewerAssignmentCommentParams): string;
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=comment-builder.service.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment-builder.service.d.ts","sourceRoot":"","sources":["../../src/services/comment-builder.service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAuB,MAAM,mBAAmB,CAAC;AAE1E,UAAU,iBAAiB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,UAAU,qBAAqB;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED,UAAU,mBAAmB;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,CAAC,EAAE,KAAK,CAAC;QAClB,QAAQ,EAAE,MAAM,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,CAAC,EAAE,MAAM,CAAC;QACb,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC,CAAC;CACJ;AAED,UAAU,+BAA+B;IACvC,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,qBAAqB,EAAE,CAAC;IACtC,WAAW,EAAE,gBAAgB,EAAE,CAAC;IAChC,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC;AAED;;;;;GAKG;AACH,qBAAa,qBAAqB;IAMpB,OAAO,CAAC,SAAS;IAL7B;;;;OAIG;gBACiB,SAAS,EAAE,MAAM;IAErC,8BAA8B,CAAC,EAC7B,SAAS,EACT,IAAI,EACJ,YAAY,EACZ,WAAW,EACX,UAAU,GACX,EAAE,+BAA+B,GAAG,MAAM;CA0E5C"}
|