@andrebuzeli/git-mcp 5.0.5 → 5.0.7
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 +143 -89
- package/dist/config.d.ts +72 -71
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +226 -139
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +15 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +133 -128
- package/dist/index.js.map +1 -1
- package/dist/providers/base-provider.d.ts +42 -153
- package/dist/providers/base-provider.d.ts.map +1 -1
- package/dist/providers/base-provider.js +42 -302
- package/dist/providers/base-provider.js.map +1 -1
- package/dist/providers/gitea-provider.d.ts +67 -118
- package/dist/providers/gitea-provider.d.ts.map +1 -1
- package/dist/providers/gitea-provider.js +484 -1161
- package/dist/providers/gitea-provider.js.map +1 -1
- package/dist/providers/github-provider.d.ts +70 -81
- package/dist/providers/github-provider.d.ts.map +1 -1
- package/dist/providers/github-provider.js +638 -278
- package/dist/providers/github-provider.js.map +1 -1
- package/dist/providers/index.d.ts +9 -9
- package/dist/providers/index.d.ts.map +1 -1
- package/dist/providers/index.js +13 -19
- package/dist/providers/index.js.map +1 -1
- package/dist/providers/provider-factory.d.ts +29 -59
- package/dist/providers/provider-factory.d.ts.map +1 -1
- package/dist/providers/provider-factory.js +134 -265
- package/dist/providers/provider-factory.js.map +1 -1
- package/dist/providers/provider-operation-handler.d.ts +93 -0
- package/dist/providers/provider-operation-handler.d.ts.map +1 -0
- package/dist/providers/provider-operation-handler.js +331 -0
- package/dist/providers/provider-operation-handler.js.map +1 -0
- package/dist/providers/types.d.ts +201 -355
- package/dist/providers/types.d.ts.map +1 -1
- package/dist/providers/types.js +3 -2
- package/dist/providers/types.js.map +1 -1
- package/dist/server.d.ts +34 -8
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +436 -494
- package/dist/server.js.map +1 -1
- package/dist/tools/git-analytics.d.ts +239 -16
- package/dist/tools/git-analytics.d.ts.map +1 -1
- package/dist/tools/git-analytics.js +737 -25
- package/dist/tools/git-analytics.js.map +1 -1
- package/dist/tools/git-archive.d.ts +109 -15
- package/dist/tools/git-archive.d.ts.map +1 -1
- package/dist/tools/git-archive.js +462 -10
- package/dist/tools/git-archive.js.map +1 -1
- package/dist/tools/git-backup.d.ts +101 -15
- package/dist/tools/git-backup.d.ts.map +1 -1
- package/dist/tools/git-backup.js +410 -10
- package/dist/tools/git-backup.js.map +1 -1
- package/dist/tools/git-branches.d.ts +141 -15
- package/dist/tools/git-branches.d.ts.map +1 -1
- package/dist/tools/git-branches.js +466 -11
- package/dist/tools/git-branches.js.map +1 -1
- package/dist/tools/git-config.d.ts +115 -15
- package/dist/tools/git-config.d.ts.map +1 -1
- package/dist/tools/git-config.js +446 -11
- package/dist/tools/git-config.js.map +1 -1
- package/dist/tools/git-files.d.ts +179 -59
- package/dist/tools/git-files.d.ts.map +1 -1
- package/dist/tools/git-files.js +699 -221
- package/dist/tools/git-files.js.map +1 -1
- package/dist/tools/git-issues.d.ts +158 -15
- package/dist/tools/git-issues.d.ts.map +1 -1
- package/dist/tools/git-issues.js +323 -11
- package/dist/tools/git-issues.js.map +1 -1
- package/dist/tools/git-monitor.d.ts +149 -14
- package/dist/tools/git-monitor.d.ts.map +1 -1
- package/dist/tools/git-monitor.js +528 -11
- package/dist/tools/git-monitor.js.map +1 -1
- package/dist/tools/git-packages.d.ts +163 -15
- package/dist/tools/git-packages.d.ts.map +1 -1
- package/dist/tools/git-packages.js +526 -11
- package/dist/tools/git-packages.js.map +1 -1
- package/dist/tools/git-pulls.d.ts +174 -15
- package/dist/tools/git-pulls.d.ts.map +1 -1
- package/dist/tools/git-pulls.js +352 -11
- package/dist/tools/git-pulls.js.map +1 -1
- package/dist/tools/git-release.d.ts +167 -15
- package/dist/tools/git-release.d.ts.map +1 -1
- package/dist/tools/git-release.js +465 -11
- package/dist/tools/git-release.js.map +1 -1
- package/dist/tools/git-remote.d.ts +124 -15
- package/dist/tools/git-remote.d.ts.map +1 -1
- package/dist/tools/git-remote.js +539 -11
- package/dist/tools/git-remote.js.map +1 -1
- package/dist/tools/git-reset.d.ts +100 -15
- package/dist/tools/git-reset.d.ts.map +1 -1
- package/dist/tools/git-reset.js +409 -11
- package/dist/tools/git-reset.js.map +1 -1
- package/dist/tools/git-stash.d.ts +120 -15
- package/dist/tools/git-stash.d.ts.map +1 -1
- package/dist/tools/git-stash.js +503 -11
- package/dist/tools/git-stash.js.map +1 -1
- package/dist/tools/git-sync.d.ts +160 -16
- package/dist/tools/git-sync.d.ts.map +1 -1
- package/dist/tools/git-sync.js +462 -113
- package/dist/tools/git-sync.js.map +1 -1
- package/dist/tools/git-tags.d.ts +142 -15
- package/dist/tools/git-tags.d.ts.map +1 -1
- package/dist/tools/git-tags.js +471 -11
- package/dist/tools/git-tags.js.map +1 -1
- package/dist/tools/git-workflow.d.ts +151 -80
- package/dist/tools/git-workflow.d.ts.map +1 -1
- package/dist/tools/git-workflow.js +407 -912
- package/dist/tools/git-workflow.js.map +1 -1
- package/dist/utils/credential-manager.d.ts +119 -0
- package/dist/utils/credential-manager.d.ts.map +1 -0
- package/dist/utils/credential-manager.js +450 -0
- package/dist/utils/credential-manager.js.map +1 -0
- package/dist/utils/git-command-executor.d.ts +330 -0
- package/dist/utils/git-command-executor.d.ts.map +1 -0
- package/dist/utils/git-command-executor.js +889 -0
- package/dist/utils/git-command-executor.js.map +1 -0
- package/dist/utils/logger.d.ts +143 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +473 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/operation-error-handler.d.ts +54 -41
- package/dist/utils/operation-error-handler.d.ts.map +1 -1
- package/dist/utils/operation-error-handler.js +211 -227
- package/dist/utils/operation-error-handler.js.map +1 -1
- package/dist/utils/parameter-validator.d.ts +41 -0
- package/dist/utils/parameter-validator.d.ts.map +1 -0
- package/dist/utils/parameter-validator.js +465 -0
- package/dist/utils/parameter-validator.js.map +1 -0
- package/dist/utils/repository-detector.d.ts +128 -0
- package/dist/utils/repository-detector.d.ts.map +1 -0
- package/dist/utils/repository-detector.js +422 -0
- package/dist/utils/repository-detector.js.map +1 -0
- package/dist/utils/response-formatter.d.ts +146 -0
- package/dist/utils/response-formatter.d.ts.map +1 -0
- package/dist/utils/response-formatter.js +378 -0
- package/dist/utils/response-formatter.js.map +1 -0
- package/dist/utils/retry.d.ts +12 -0
- package/dist/utils/retry.d.ts.map +1 -0
- package/dist/utils/retry.js +28 -0
- package/dist/utils/retry.js.map +1 -0
- package/dist/utils/terminal-controller.d.ts +73 -139
- package/dist/utils/terminal-controller.d.ts.map +1 -1
- package/dist/utils/terminal-controller.js +272 -457
- package/dist/utils/terminal-controller.js.map +1 -1
- package/package.json +79 -60
- package/dist/providers/error-handler.d.ts +0 -51
- package/dist/providers/error-handler.d.ts.map +0 -1
- package/dist/providers/error-handler.js +0 -176
- package/dist/providers/error-handler.js.map +0 -1
- package/dist/providers/github-provider-backup.d.ts +0 -81
- package/dist/providers/github-provider-backup.d.ts.map +0 -1
- package/dist/providers/github-provider-backup.js +0 -1179
- package/dist/providers/github-provider-backup.js.map +0 -1
- package/dist/providers/github-provider-complete.d.ts +0 -1
- package/dist/providers/github-provider-complete.d.ts.map +0 -1
- package/dist/providers/github-provider-complete.js +0 -2
- package/dist/providers/github-provider-complete.js.map +0 -1
- package/dist/tools/git-init.d.ts +0 -50
- package/dist/tools/git-init.d.ts.map +0 -1
- package/dist/tools/git-init.js +0 -258
- package/dist/tools/git-init.js.map +0 -1
- package/dist/tools/git-log.d.ts +0 -67
- package/dist/tools/git-log.d.ts.map +0 -1
- package/dist/tools/git-log.js +0 -320
- package/dist/tools/git-log.js.map +0 -1
- package/dist/tools/git-status.d.ts +0 -29
- package/dist/tools/git-status.d.ts.map +0 -1
- package/dist/tools/git-status.js +0 -182
- package/dist/tools/git-status.js.map +0 -1
- package/dist/tools/git-update.d.ts +0 -34
- package/dist/tools/git-update.d.ts.map +0 -1
- package/dist/tools/git-update.js +0 -191
- package/dist/tools/git-update.js.map +0 -1
- package/dist/utils/auto-detection.d.ts +0 -120
- package/dist/utils/auto-detection.d.ts.map +0 -1
- package/dist/utils/auto-detection.js +0 -259
- package/dist/utils/auto-detection.js.map +0 -1
- package/dist/utils/configuration-error-generator.d.ts +0 -41
- package/dist/utils/configuration-error-generator.d.ts.map +0 -1
- package/dist/utils/configuration-error-generator.js +0 -168
- package/dist/utils/configuration-error-generator.js.map +0 -1
- package/dist/utils/configuration-validator.d.ts +0 -67
- package/dist/utils/configuration-validator.d.ts.map +0 -1
- package/dist/utils/configuration-validator.js +0 -257
- package/dist/utils/configuration-validator.js.map +0 -1
- package/dist/utils/error-handler.d.ts +0 -107
- package/dist/utils/error-handler.d.ts.map +0 -1
- package/dist/utils/error-handler.js +0 -331
- package/dist/utils/error-handler.js.map +0 -1
- package/dist/utils/git-operations.d.ts +0 -200
- package/dist/utils/git-operations.d.ts.map +0 -1
- package/dist/utils/git-operations.js +0 -836
- package/dist/utils/git-operations.js.map +0 -1
- package/dist/utils/multi-provider-error-handler.d.ts +0 -75
- package/dist/utils/multi-provider-error-handler.d.ts.map +0 -1
- package/dist/utils/multi-provider-error-handler.js +0 -276
- package/dist/utils/multi-provider-error-handler.js.map +0 -1
- package/dist/utils/multi-provider-operation-handler.d.ts +0 -113
- package/dist/utils/multi-provider-operation-handler.d.ts.map +0 -1
- package/dist/utils/multi-provider-operation-handler.js +0 -303
- package/dist/utils/multi-provider-operation-handler.js.map +0 -1
- package/dist/utils/provider-operation-handler.d.ts +0 -80
- package/dist/utils/provider-operation-handler.d.ts.map +0 -1
- package/dist/utils/provider-operation-handler.js +0 -201
- package/dist/utils/provider-operation-handler.js.map +0 -1
- package/dist/utils/response-helper.d.ts +0 -57
- package/dist/utils/response-helper.d.ts.map +0 -1
- package/dist/utils/response-helper.js +0 -54
- package/dist/utils/response-helper.js.map +0 -1
- package/dist/utils/user-detection.d.ts +0 -25
- package/dist/utils/user-detection.d.ts.map +0 -1
- package/dist/utils/user-detection.js +0 -54
- package/dist/utils/user-detection.js.map +0 -1
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parameter Validation
|
|
4
|
+
*
|
|
5
|
+
* Provides robust input validation for all Git MCP operations.
|
|
6
|
+
* Validates required parameters, formats, and operation support.
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ParameterValidator = void 0;
|
|
13
|
+
const path_1 = __importDefault(require("path"));
|
|
14
|
+
class ParameterValidator {
|
|
15
|
+
static VALID_PROVIDERS = ['github', 'gitea', 'both'];
|
|
16
|
+
static TOOL_OPERATIONS = {
|
|
17
|
+
'git-workflow': ['init', 'commit', 'sync', 'status', 'backup', 'create', 'list', 'get', 'update', 'delete', 'fork', 'search'],
|
|
18
|
+
'git-files': ['read', 'create', 'update', 'delete', 'search', 'backup', 'list'],
|
|
19
|
+
'git-branches': ['create', 'list', 'get', 'delete', 'merge', 'compare'],
|
|
20
|
+
'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'],
|
|
21
|
+
'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'],
|
|
22
|
+
'git-tags': ['create', 'list', 'get', 'delete', 'search'],
|
|
23
|
+
'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'],
|
|
24
|
+
'git-remote': ['add', 'remove', 'rename', 'show', 'set-url', 'prune'],
|
|
25
|
+
'git-reset': ['soft', 'mixed', 'hard', 'reset-to-commit', 'reset-branch'],
|
|
26
|
+
'git-stash': ['stash', 'pop', 'apply', 'list', 'show', 'drop', 'clear'],
|
|
27
|
+
'git-config': ['get', 'set', 'unset', 'list', 'edit', 'show'],
|
|
28
|
+
'git-monitor': ['log', 'status', 'commits', 'contributors'],
|
|
29
|
+
'git-backup': ['backup', 'restore', 'list', 'verify'],
|
|
30
|
+
'git-archive': ['create', 'extract', 'list', 'verify'],
|
|
31
|
+
'git-packages': ['list', 'get', 'create', 'update', 'delete', 'publish', 'download'],
|
|
32
|
+
'git-analytics': ['stats', 'commits', 'contributors'],
|
|
33
|
+
'git-sync': ['sync', 'status']
|
|
34
|
+
};
|
|
35
|
+
static REMOTE_OPERATIONS = {
|
|
36
|
+
'git-workflow': ['create', 'list', 'get', 'update', 'delete', 'fork', 'search'],
|
|
37
|
+
// git-files operations are local by default, remote only when provider is explicitly specified
|
|
38
|
+
'git-files': ['read', 'create', 'update', 'delete', 'search', 'list'],
|
|
39
|
+
'git-branches': [], // All branch operations are local for now
|
|
40
|
+
'git-issues': ['create', 'list', 'get', 'update', 'close', 'comment', 'search'],
|
|
41
|
+
'git-pulls': ['create', 'list', 'get', 'update', 'merge', 'close', 'review', 'search'],
|
|
42
|
+
'git-tags': ['create', 'list', 'get', 'delete', 'search'],
|
|
43
|
+
'git-release': ['create', 'list', 'get', 'update', 'delete', 'publish', 'download'],
|
|
44
|
+
'git-remote': [], // Remote operations are local Git commands
|
|
45
|
+
'git-reset': [], // Reset operations are local
|
|
46
|
+
'git-stash': [], // Stash operations are local
|
|
47
|
+
'git-config': [], // Config operations are local
|
|
48
|
+
'git-monitor': [], // Monitor operations are local
|
|
49
|
+
'git-backup': [], // Backup operations are local
|
|
50
|
+
'git-archive': [], // Archive operations are local
|
|
51
|
+
'git-packages': ['create', 'update', 'delete', 'publish', 'download'], // list and get are local
|
|
52
|
+
'git-analytics': [], // All analytics operations are local by default
|
|
53
|
+
'git-sync': ['sync'] // Sync can be remote
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Validates basic tool parameters
|
|
57
|
+
*/
|
|
58
|
+
static validateToolParams(toolName, params) {
|
|
59
|
+
const result = {
|
|
60
|
+
isValid: true,
|
|
61
|
+
errors: [],
|
|
62
|
+
warnings: [],
|
|
63
|
+
suggestions: []
|
|
64
|
+
};
|
|
65
|
+
// Validate required parameters
|
|
66
|
+
if (!params.projectPath) {
|
|
67
|
+
result.errors.push('projectPath is required for all operations');
|
|
68
|
+
result.suggestions.push('Provide the absolute path to your project directory');
|
|
69
|
+
result.isValid = false;
|
|
70
|
+
}
|
|
71
|
+
if (!params.action) {
|
|
72
|
+
result.errors.push('action is required to specify the operation to perform');
|
|
73
|
+
result.suggestions.push(`Valid actions for ${toolName}: ${this.TOOL_OPERATIONS[toolName]?.join(', ') || 'unknown tool'}`);
|
|
74
|
+
result.isValid = false;
|
|
75
|
+
}
|
|
76
|
+
// Validate tool exists
|
|
77
|
+
if (!this.TOOL_OPERATIONS[toolName]) {
|
|
78
|
+
result.errors.push(`Unknown tool: ${toolName}`);
|
|
79
|
+
result.suggestions.push(`Available tools: ${Object.keys(this.TOOL_OPERATIONS).join(', ')}`);
|
|
80
|
+
result.isValid = false;
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
// Validate action is supported by tool
|
|
84
|
+
if (params.action && !this.TOOL_OPERATIONS[toolName].includes(params.action)) {
|
|
85
|
+
result.errors.push(`Action '${params.action}' is not supported by ${toolName}`);
|
|
86
|
+
result.suggestions.push(`Valid actions: ${this.TOOL_OPERATIONS[toolName].join(', ')}`);
|
|
87
|
+
result.isValid = false;
|
|
88
|
+
}
|
|
89
|
+
// Validate provider parameter
|
|
90
|
+
if (params.provider && !this.VALID_PROVIDERS.includes(params.provider)) {
|
|
91
|
+
result.errors.push(`Invalid provider: ${params.provider}`);
|
|
92
|
+
result.suggestions.push(`Valid providers: ${this.VALID_PROVIDERS.join(', ')}`);
|
|
93
|
+
result.isValid = false;
|
|
94
|
+
}
|
|
95
|
+
// Check if provider is required for remote operations
|
|
96
|
+
const toolRemoteOps = this.REMOTE_OPERATIONS[toolName] || [];
|
|
97
|
+
if (params.action && toolRemoteOps.includes(params.action) && !params.provider) {
|
|
98
|
+
result.errors.push(`Provider is required for remote operation: ${params.action}`);
|
|
99
|
+
result.suggestions.push(`Specify provider as one of: ${this.VALID_PROVIDERS.join(', ')}`);
|
|
100
|
+
result.isValid = false;
|
|
101
|
+
}
|
|
102
|
+
// Validate projectPath format
|
|
103
|
+
if (params.projectPath && typeof params.projectPath !== 'string') {
|
|
104
|
+
result.errors.push('projectPath must be a string');
|
|
105
|
+
result.isValid = false;
|
|
106
|
+
}
|
|
107
|
+
// Check for common parameter format issues
|
|
108
|
+
if (params.projectPath && params.projectPath.includes('\\') && !params.projectPath.includes(':\\')) {
|
|
109
|
+
result.warnings.push('projectPath contains backslashes - ensure it is a valid absolute path');
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Validates specific operation parameters
|
|
115
|
+
*/
|
|
116
|
+
static validateOperationParams(toolName, action, params) {
|
|
117
|
+
const result = {
|
|
118
|
+
isValid: true,
|
|
119
|
+
errors: [],
|
|
120
|
+
warnings: [],
|
|
121
|
+
suggestions: []
|
|
122
|
+
};
|
|
123
|
+
// Tool-specific validations
|
|
124
|
+
switch (toolName) {
|
|
125
|
+
case 'git-workflow':
|
|
126
|
+
return this.validateWorkflowParams(action, params);
|
|
127
|
+
case 'git-files':
|
|
128
|
+
return this.validateFilesParams(action, params);
|
|
129
|
+
case 'git-branches':
|
|
130
|
+
return this.validateBranchesParams(action, params);
|
|
131
|
+
case 'git-issues':
|
|
132
|
+
return this.validateIssuesParams(action, params);
|
|
133
|
+
case 'git-pulls':
|
|
134
|
+
return this.validatePullsParams(action, params);
|
|
135
|
+
default:
|
|
136
|
+
// Generic validation for other tools
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
static validateWorkflowParams(action, params) {
|
|
141
|
+
const result = {
|
|
142
|
+
isValid: true,
|
|
143
|
+
errors: [],
|
|
144
|
+
warnings: [],
|
|
145
|
+
suggestions: []
|
|
146
|
+
};
|
|
147
|
+
switch (action) {
|
|
148
|
+
case 'commit':
|
|
149
|
+
if (!params.message) {
|
|
150
|
+
result.errors.push('message is required for commit operation');
|
|
151
|
+
result.suggestions.push('Provide a commit message describing your changes');
|
|
152
|
+
result.isValid = false;
|
|
153
|
+
}
|
|
154
|
+
break;
|
|
155
|
+
case 'create':
|
|
156
|
+
if (!params.name) {
|
|
157
|
+
result.errors.push('name is required for repository creation');
|
|
158
|
+
result.suggestions.push('Provide a repository name');
|
|
159
|
+
result.isValid = false;
|
|
160
|
+
}
|
|
161
|
+
break;
|
|
162
|
+
case 'get':
|
|
163
|
+
case 'update':
|
|
164
|
+
case 'delete':
|
|
165
|
+
case 'fork':
|
|
166
|
+
if (!params.owner || !params.repo) {
|
|
167
|
+
result.errors.push('owner and repo are required for repository operations');
|
|
168
|
+
result.suggestions.push('Provide both owner (username/organization) and repository name');
|
|
169
|
+
result.isValid = false;
|
|
170
|
+
}
|
|
171
|
+
break;
|
|
172
|
+
case 'search':
|
|
173
|
+
if (!params.query) {
|
|
174
|
+
result.errors.push('query is required for search operation');
|
|
175
|
+
result.suggestions.push('Provide a search query string');
|
|
176
|
+
result.isValid = false;
|
|
177
|
+
}
|
|
178
|
+
break;
|
|
179
|
+
case 'backup':
|
|
180
|
+
if (params.backupPath && typeof params.backupPath !== 'string') {
|
|
181
|
+
result.errors.push('backupPath must be a string');
|
|
182
|
+
result.isValid = false;
|
|
183
|
+
}
|
|
184
|
+
break;
|
|
185
|
+
case 'sync':
|
|
186
|
+
if (params.remote && typeof params.remote !== 'string') {
|
|
187
|
+
result.errors.push('remote must be a string');
|
|
188
|
+
result.isValid = false;
|
|
189
|
+
}
|
|
190
|
+
if (params.branch && typeof params.branch !== 'string') {
|
|
191
|
+
result.errors.push('branch must be a string');
|
|
192
|
+
result.isValid = false;
|
|
193
|
+
}
|
|
194
|
+
break;
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
static validateFilesParams(action, params) {
|
|
199
|
+
const result = {
|
|
200
|
+
isValid: true,
|
|
201
|
+
errors: [],
|
|
202
|
+
warnings: [],
|
|
203
|
+
suggestions: []
|
|
204
|
+
};
|
|
205
|
+
switch (action) {
|
|
206
|
+
case 'read':
|
|
207
|
+
case 'delete':
|
|
208
|
+
if (!params.filePath) {
|
|
209
|
+
result.errors.push('filePath is required for file operations');
|
|
210
|
+
result.suggestions.push('Provide the path to the file relative to the repository root');
|
|
211
|
+
result.isValid = false;
|
|
212
|
+
}
|
|
213
|
+
break;
|
|
214
|
+
case 'create':
|
|
215
|
+
if (!params.filePath) {
|
|
216
|
+
result.errors.push('filePath is required for file creation');
|
|
217
|
+
result.suggestions.push('Provide the path for the new file relative to the repository root');
|
|
218
|
+
result.isValid = false;
|
|
219
|
+
}
|
|
220
|
+
if (params.content === undefined) {
|
|
221
|
+
result.errors.push('content is required for file creation');
|
|
222
|
+
result.suggestions.push('Provide the content for the new file');
|
|
223
|
+
result.isValid = false;
|
|
224
|
+
}
|
|
225
|
+
break;
|
|
226
|
+
case 'update':
|
|
227
|
+
if (!params.filePath) {
|
|
228
|
+
result.errors.push('filePath is required for file update');
|
|
229
|
+
result.suggestions.push('Provide the path to the file relative to the repository root');
|
|
230
|
+
result.isValid = false;
|
|
231
|
+
}
|
|
232
|
+
if (params.content === undefined) {
|
|
233
|
+
result.errors.push('content is required for file update');
|
|
234
|
+
result.suggestions.push('Provide the new content for the file');
|
|
235
|
+
result.isValid = false;
|
|
236
|
+
}
|
|
237
|
+
break;
|
|
238
|
+
case 'search':
|
|
239
|
+
if (!params.query) {
|
|
240
|
+
result.errors.push('query is required for file search');
|
|
241
|
+
result.suggestions.push('Provide a search query to find in files');
|
|
242
|
+
result.isValid = false;
|
|
243
|
+
}
|
|
244
|
+
break;
|
|
245
|
+
case 'backup':
|
|
246
|
+
// No required parameters for backup - it can use defaults
|
|
247
|
+
if (params.backupPath && !path_1.default.isAbsolute(params.backupPath)) {
|
|
248
|
+
result.warnings.push('backupPath should be an absolute path for better reliability');
|
|
249
|
+
}
|
|
250
|
+
break;
|
|
251
|
+
}
|
|
252
|
+
return result;
|
|
253
|
+
}
|
|
254
|
+
static validateBranchesParams(action, params) {
|
|
255
|
+
const result = {
|
|
256
|
+
isValid: true,
|
|
257
|
+
errors: [],
|
|
258
|
+
warnings: [],
|
|
259
|
+
suggestions: []
|
|
260
|
+
};
|
|
261
|
+
switch (action) {
|
|
262
|
+
case 'create':
|
|
263
|
+
if (!params.branchName) {
|
|
264
|
+
result.errors.push('branchName is required for branch creation');
|
|
265
|
+
result.suggestions.push('Provide a name for the new branch');
|
|
266
|
+
result.isValid = false;
|
|
267
|
+
}
|
|
268
|
+
break;
|
|
269
|
+
case 'delete':
|
|
270
|
+
case 'merge':
|
|
271
|
+
if (!params.branchName) {
|
|
272
|
+
result.errors.push('branchName is required for branch operation');
|
|
273
|
+
result.isValid = false;
|
|
274
|
+
}
|
|
275
|
+
break;
|
|
276
|
+
case 'compare':
|
|
277
|
+
if (!params.baseBranch || !params.compareBranch) {
|
|
278
|
+
result.errors.push('baseBranch and compareBranch are required for comparison');
|
|
279
|
+
result.suggestions.push('Provide both branch names to compare');
|
|
280
|
+
result.isValid = false;
|
|
281
|
+
}
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
return result;
|
|
285
|
+
}
|
|
286
|
+
static validateIssuesParams(action, params) {
|
|
287
|
+
const result = {
|
|
288
|
+
isValid: true,
|
|
289
|
+
errors: [],
|
|
290
|
+
warnings: [],
|
|
291
|
+
suggestions: []
|
|
292
|
+
};
|
|
293
|
+
switch (action) {
|
|
294
|
+
case 'create':
|
|
295
|
+
if (!params.title) {
|
|
296
|
+
result.errors.push('title is required for issue creation');
|
|
297
|
+
result.suggestions.push('Provide a descriptive title for the issue');
|
|
298
|
+
result.isValid = false;
|
|
299
|
+
}
|
|
300
|
+
break;
|
|
301
|
+
case 'get':
|
|
302
|
+
case 'update':
|
|
303
|
+
case 'close':
|
|
304
|
+
if (params.issue_number === undefined) {
|
|
305
|
+
result.errors.push('issue_number is required for issue operations');
|
|
306
|
+
result.suggestions.push('Provide the issue number');
|
|
307
|
+
result.isValid = false;
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
case 'comment':
|
|
311
|
+
if (params.issue_number === undefined) {
|
|
312
|
+
result.errors.push('issue_number is required for commenting on issues');
|
|
313
|
+
result.suggestions.push('Provide the issue number');
|
|
314
|
+
result.isValid = false;
|
|
315
|
+
}
|
|
316
|
+
if (!params.comment_body) {
|
|
317
|
+
result.errors.push('comment_body is required for commenting on issues');
|
|
318
|
+
result.suggestions.push('Provide the comment text');
|
|
319
|
+
result.isValid = false;
|
|
320
|
+
}
|
|
321
|
+
break;
|
|
322
|
+
case 'search':
|
|
323
|
+
if (!params.query) {
|
|
324
|
+
result.errors.push('query is required for issue search');
|
|
325
|
+
result.suggestions.push('Provide a search query to find issues');
|
|
326
|
+
result.isValid = false;
|
|
327
|
+
}
|
|
328
|
+
break;
|
|
329
|
+
}
|
|
330
|
+
return result;
|
|
331
|
+
}
|
|
332
|
+
static validatePullsParams(action, params) {
|
|
333
|
+
const result = {
|
|
334
|
+
isValid: true,
|
|
335
|
+
errors: [],
|
|
336
|
+
warnings: [],
|
|
337
|
+
suggestions: []
|
|
338
|
+
};
|
|
339
|
+
switch (action) {
|
|
340
|
+
case 'create':
|
|
341
|
+
if (!params.title) {
|
|
342
|
+
result.errors.push('title is required for pull request creation');
|
|
343
|
+
result.suggestions.push('Provide a descriptive title for the pull request');
|
|
344
|
+
result.isValid = false;
|
|
345
|
+
}
|
|
346
|
+
if (!params.head || !params.base) {
|
|
347
|
+
result.errors.push('head and base branches are required for pull request creation');
|
|
348
|
+
result.suggestions.push('Specify the source (head) and target (base) branches');
|
|
349
|
+
result.isValid = false;
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
case 'get':
|
|
353
|
+
case 'update':
|
|
354
|
+
case 'merge':
|
|
355
|
+
case 'close':
|
|
356
|
+
if (params.pull_number === undefined) {
|
|
357
|
+
result.errors.push('pull_number is required for pull request operations');
|
|
358
|
+
result.suggestions.push('Provide the pull request number');
|
|
359
|
+
result.isValid = false;
|
|
360
|
+
}
|
|
361
|
+
break;
|
|
362
|
+
case 'review':
|
|
363
|
+
if (params.pull_number === undefined) {
|
|
364
|
+
result.errors.push('pull_number is required for reviewing pull requests');
|
|
365
|
+
result.suggestions.push('Provide the pull request number');
|
|
366
|
+
result.isValid = false;
|
|
367
|
+
}
|
|
368
|
+
if (!params.event) {
|
|
369
|
+
result.errors.push('event is required for pull request reviews');
|
|
370
|
+
result.suggestions.push('Specify review event: APPROVE, REQUEST_CHANGES, or COMMENT');
|
|
371
|
+
result.isValid = false;
|
|
372
|
+
}
|
|
373
|
+
if (params.event === 'REQUEST_CHANGES' && !params.review_body) {
|
|
374
|
+
result.warnings.push('review_body is recommended for REQUEST_CHANGES reviews');
|
|
375
|
+
}
|
|
376
|
+
break;
|
|
377
|
+
case 'search':
|
|
378
|
+
if (!params.query) {
|
|
379
|
+
result.errors.push('query is required for pull request search');
|
|
380
|
+
result.suggestions.push('Provide a search query to find pull requests');
|
|
381
|
+
result.isValid = false;
|
|
382
|
+
}
|
|
383
|
+
break;
|
|
384
|
+
}
|
|
385
|
+
return result;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Provides usage examples for correct parameter format
|
|
389
|
+
*/
|
|
390
|
+
static getUsageExamples(toolName, action) {
|
|
391
|
+
const examples = [];
|
|
392
|
+
if (!action) {
|
|
393
|
+
examples.push(`${toolName} usage examples:`);
|
|
394
|
+
const operations = this.TOOL_OPERATIONS[toolName] || [];
|
|
395
|
+
operations.slice(0, 3).forEach(op => {
|
|
396
|
+
examples.push(` ${toolName} with action="${op}"`);
|
|
397
|
+
});
|
|
398
|
+
return examples;
|
|
399
|
+
}
|
|
400
|
+
switch (toolName) {
|
|
401
|
+
case 'git-workflow':
|
|
402
|
+
switch (action) {
|
|
403
|
+
case 'commit':
|
|
404
|
+
examples.push('git-workflow commit: { "action": "commit", "projectPath": "/path/to/project", "message": "Fix bug in authentication" }');
|
|
405
|
+
break;
|
|
406
|
+
case 'create':
|
|
407
|
+
examples.push('git-workflow create: { "action": "create", "projectPath": "/path/to/project", "provider": "github", "name": "my-repo", "description": "My new repository" }');
|
|
408
|
+
break;
|
|
409
|
+
case 'get':
|
|
410
|
+
examples.push('git-workflow get: { "action": "get", "projectPath": "/path/to/project", "provider": "github", "owner": "username", "repo": "repository-name" }');
|
|
411
|
+
break;
|
|
412
|
+
case 'list':
|
|
413
|
+
examples.push('git-workflow list: { "action": "list", "projectPath": "/path/to/project", "provider": "github" }');
|
|
414
|
+
break;
|
|
415
|
+
case 'update':
|
|
416
|
+
examples.push('git-workflow update: { "action": "update", "projectPath": "/path/to/project", "provider": "github", "owner": "username", "repo": "repository-name", "description": "Updated description" }');
|
|
417
|
+
break;
|
|
418
|
+
case 'delete':
|
|
419
|
+
examples.push('git-workflow delete: { "action": "delete", "projectPath": "/path/to/project", "provider": "github", "owner": "username", "repo": "repository-name" }');
|
|
420
|
+
break;
|
|
421
|
+
case 'fork':
|
|
422
|
+
examples.push('git-workflow fork: { "action": "fork", "projectPath": "/path/to/project", "provider": "github", "owner": "original-owner", "repo": "repository-name" }');
|
|
423
|
+
break;
|
|
424
|
+
case 'search':
|
|
425
|
+
examples.push('git-workflow search: { "action": "search", "projectPath": "/path/to/project", "provider": "github", "query": "javascript framework" }');
|
|
426
|
+
break;
|
|
427
|
+
}
|
|
428
|
+
break;
|
|
429
|
+
case 'git-files':
|
|
430
|
+
switch (action) {
|
|
431
|
+
case 'read':
|
|
432
|
+
examples.push('git-files read: { "action": "read", "projectPath": "/path/to/project", "filePath": "src/index.js" }');
|
|
433
|
+
examples.push('git-files read (remote): { "action": "read", "projectPath": "/path/to/project", "provider": "github", "filePath": "README.md", "owner": "username", "repo": "repository" }');
|
|
434
|
+
break;
|
|
435
|
+
case 'create':
|
|
436
|
+
examples.push('git-files create: { "action": "create", "projectPath": "/path/to/project", "filePath": "README.md", "content": "# My Project" }');
|
|
437
|
+
examples.push('git-files create (remote): { "action": "create", "projectPath": "/path/to/project", "provider": "github", "filePath": "docs/api.md", "content": "# API Documentation", "message": "Add API docs" }');
|
|
438
|
+
break;
|
|
439
|
+
case 'update':
|
|
440
|
+
examples.push('git-files update: { "action": "update", "projectPath": "/path/to/project", "filePath": "package.json", "content": "{\\"name\\": \\"my-package\\"}" }');
|
|
441
|
+
examples.push('git-files update (remote): { "action": "update", "projectPath": "/path/to/project", "provider": "github", "filePath": "README.md", "content": "Updated content", "message": "Update README", "sha": "abc123" }');
|
|
442
|
+
break;
|
|
443
|
+
case 'delete':
|
|
444
|
+
examples.push('git-files delete: { "action": "delete", "projectPath": "/path/to/project", "filePath": "temp.txt" }');
|
|
445
|
+
examples.push('git-files delete (remote): { "action": "delete", "projectPath": "/path/to/project", "provider": "github", "filePath": "old-file.txt", "message": "Remove old file", "sha": "def456" }');
|
|
446
|
+
break;
|
|
447
|
+
case 'search':
|
|
448
|
+
examples.push('git-files search: { "action": "search", "projectPath": "/path/to/project", "query": "function authenticate" }');
|
|
449
|
+
examples.push('git-files search (remote): { "action": "search", "projectPath": "/path/to/project", "provider": "github", "query": "TODO" }');
|
|
450
|
+
break;
|
|
451
|
+
case 'backup':
|
|
452
|
+
examples.push('git-files backup: { "action": "backup", "projectPath": "/path/to/project" }');
|
|
453
|
+
examples.push('git-files backup (custom): { "action": "backup", "projectPath": "/path/to/project", "backupPath": "/backup/location", "includePattern": "*.js" }');
|
|
454
|
+
break;
|
|
455
|
+
}
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
if (examples.length === 0) {
|
|
459
|
+
examples.push(`${toolName} ${action}: { "action": "${action}", "projectPath": "/path/to/project" }`);
|
|
460
|
+
}
|
|
461
|
+
return examples;
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
exports.ParameterValidator = ParameterValidator;
|
|
465
|
+
//# sourceMappingURL=parameter-validator.js.map
|
|
@@ -0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AQ;wBACX,QAAQ,CAAC,IAAI,CAAC,iIAAiI,CAAC,CAAC;wBACjJ,QAAQ,CAAC,IAAI,CAAC,oMAAoM,CAAC,CAAC;wBACpN,MAAM;oBACR,KAAK,QAAQ;wBACX,QAAQ,CAAC,IAAI,CAAC,sJAAsJ,CAAC,CAAC;wBACtK,QAAQ,CAAC,IAAI,CAAC,gNAAgN,CAAC,CAAC;wBAChO,MAAM;oBACR,KAAK,QAAQ;wBACX,QAAQ,CAAC,IAAI,CAAC,qGAAqG,CAAC,CAAC;wBACrH,QAAQ,CAAC,IAAI,CAAC,uLAAuL,CAAC,CAAC;wBACvM,MAAM;oBACR,KAAK,QAAQ;wBACX,QAAQ,CAAC,IAAI,CAAC,+GAA+G,CAAC,CAAC;wBAC/H,QAAQ,CAAC,IAAI,CAAC,6HAA6H,CAAC,CAAC;wBAC7I,MAAM;oBACR,KAAK,QAAQ;wBACX,QAAQ,CAAC,IAAI,CAAC,6EAA6E,CAAC,CAAC;wBAC7F,QAAQ,CAAC,IAAI,CAAC,kJAAkJ,CAAC,CAAC;wBAClK,MAAM;gBACV,CAAC;gBACD,MAAM;QACV,CAAC;QAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAC1B,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,MAAM,kBAAkB,MAAM,wCAAwC,CAAC,CAAC;QACvG,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;;AAleH,gDAmeC"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Repository Detector
|
|
3
|
+
*
|
|
4
|
+
* Utility for detecting Git repositories, extracting repository information,
|
|
5
|
+
* and auto-detecting project context for Git operations.
|
|
6
|
+
*/
|
|
7
|
+
export interface RepositoryInfo {
|
|
8
|
+
isGitRepository: boolean;
|
|
9
|
+
repositoryPath?: string;
|
|
10
|
+
repositoryName?: string;
|
|
11
|
+
remoteOrigin?: string;
|
|
12
|
+
currentBranch?: string;
|
|
13
|
+
detectedProvider?: 'github' | 'gitea' | 'unknown';
|
|
14
|
+
hasRemotes?: boolean;
|
|
15
|
+
remotes?: Array<{
|
|
16
|
+
name: string;
|
|
17
|
+
url: string;
|
|
18
|
+
provider?: 'github' | 'gitea' | 'unknown';
|
|
19
|
+
}>;
|
|
20
|
+
workingDirectory?: string;
|
|
21
|
+
gitDirectory?: string;
|
|
22
|
+
isBare?: boolean;
|
|
23
|
+
hasUncommittedChanges?: boolean;
|
|
24
|
+
lastCommit?: {
|
|
25
|
+
hash: string;
|
|
26
|
+
message: string;
|
|
27
|
+
author: string;
|
|
28
|
+
date: string;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export interface ProjectContext {
|
|
32
|
+
projectPath: string;
|
|
33
|
+
projectName: string;
|
|
34
|
+
repositoryInfo: RepositoryInfo;
|
|
35
|
+
autoDetectedSettings?: {
|
|
36
|
+
owner?: string;
|
|
37
|
+
repository?: string;
|
|
38
|
+
provider?: 'github' | 'gitea';
|
|
39
|
+
remoteUrl?: string;
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
export declare class RepositoryDetector {
|
|
43
|
+
private gitExecutor;
|
|
44
|
+
private terminal;
|
|
45
|
+
constructor();
|
|
46
|
+
/**
|
|
47
|
+
* Detect repository information for a given path
|
|
48
|
+
*/
|
|
49
|
+
detectRepository(projectPath: string): Promise<RepositoryInfo>;
|
|
50
|
+
/**
|
|
51
|
+
* Get complete project context with auto-detection
|
|
52
|
+
*/
|
|
53
|
+
getProjectContext(projectPath: string): Promise<ProjectContext>;
|
|
54
|
+
/**
|
|
55
|
+
* Find Git repository in current directory or parent directories
|
|
56
|
+
*/
|
|
57
|
+
findGitRepository(startPath: string): Promise<RepositoryInfo | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Check if path is within a Git repository
|
|
60
|
+
*/
|
|
61
|
+
isWithinGitRepository(filePath: string): Promise<{
|
|
62
|
+
isWithin: boolean;
|
|
63
|
+
repositoryInfo?: RepositoryInfo;
|
|
64
|
+
relativePath?: string;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Validate project path and ensure it's suitable for Git operations
|
|
68
|
+
*/
|
|
69
|
+
validateProjectPath(projectPath: string): Promise<{
|
|
70
|
+
valid: boolean;
|
|
71
|
+
error?: string;
|
|
72
|
+
suggestion?: string;
|
|
73
|
+
repositoryInfo?: RepositoryInfo;
|
|
74
|
+
}>;
|
|
75
|
+
/**
|
|
76
|
+
* Extract repository name from various sources
|
|
77
|
+
*/
|
|
78
|
+
extractRepositoryName(projectPath: string, remoteUrl?: string): string;
|
|
79
|
+
/**
|
|
80
|
+
* Extract owner/username from repository URL or environment
|
|
81
|
+
*/
|
|
82
|
+
extractOwnerFromContext(repositoryInfo: RepositoryInfo): string | undefined;
|
|
83
|
+
/**
|
|
84
|
+
* Detect provider from remote URL
|
|
85
|
+
*/
|
|
86
|
+
detectProviderFromUrl(url?: string): 'github' | 'gitea' | 'unknown';
|
|
87
|
+
/**
|
|
88
|
+
* Get information about all remotes
|
|
89
|
+
*/
|
|
90
|
+
private getRemotesInfo;
|
|
91
|
+
/**
|
|
92
|
+
* Get last commit information
|
|
93
|
+
*/
|
|
94
|
+
private getLastCommitInfo;
|
|
95
|
+
/**
|
|
96
|
+
* Extract auto-detected settings from repository info
|
|
97
|
+
*/
|
|
98
|
+
private extractAutoDetectedSettings;
|
|
99
|
+
/**
|
|
100
|
+
* Extract repository name from URL
|
|
101
|
+
*/
|
|
102
|
+
private extractRepoNameFromUrl;
|
|
103
|
+
/**
|
|
104
|
+
* Extract owner/username from URL
|
|
105
|
+
*/
|
|
106
|
+
private extractOwnerFromUrl;
|
|
107
|
+
/**
|
|
108
|
+
* Check if directory has Git-related files
|
|
109
|
+
*/
|
|
110
|
+
hasGitFiles(directoryPath: string): Promise<{
|
|
111
|
+
hasGitDir: boolean;
|
|
112
|
+
hasGitignore: boolean;
|
|
113
|
+
hasGitAttributes: boolean;
|
|
114
|
+
gitFiles: string[];
|
|
115
|
+
}>;
|
|
116
|
+
/**
|
|
117
|
+
* Suggest Git initialization for non-Git directories
|
|
118
|
+
*/
|
|
119
|
+
suggestGitInit(projectPath: string): Promise<{
|
|
120
|
+
shouldInit: boolean;
|
|
121
|
+
reason: string;
|
|
122
|
+
suggestion: string;
|
|
123
|
+
hasExistingFiles: boolean;
|
|
124
|
+
fileCount: number;
|
|
125
|
+
}>;
|
|
126
|
+
}
|
|
127
|
+
export declare const repositoryDetector: RepositoryDetector;
|
|
128
|
+
//# sourceMappingURL=repository-detector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository-detector.d.ts","sourceRoot":"","sources":["../../src/utils/repository-detector.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAOH,MAAM,WAAW,cAAc;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;IAClD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,KAAK,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,GAAG,EAAE,MAAM,CAAC;QACZ,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;KAC3C,CAAC,CAAC;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,UAAU,CAAC,EAAE;QACX,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,I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