@andrebuzeli/git-mcp 10.0.9 → 11.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/README.md +34 -428
- package/bin/git-mcp.js +21 -0
- package/docs/TOOLS.md +110 -0
- package/mcp.json.template +12 -0
- package/package.json +9 -76
- package/src/local/git.js +14 -0
- package/src/providers/gitea.js +13 -0
- package/src/providers/github.js +13 -0
- package/src/server.js +63 -0
- package/src/tools/git-actions.js +19 -0
- package/src/tools/git-activity.js +28 -0
- package/src/tools/git-admin.js +20 -0
- package/src/tools/git-checks.js +14 -0
- package/src/tools/git-commits.js +34 -0
- package/src/tools/git-contents.js +30 -0
- package/src/tools/git-deployments.js +21 -0
- package/src/tools/git-gists.js +15 -0
- package/src/tools/git-gitdata.js +19 -0
- package/src/tools/git-issues-prs.js +44 -0
- package/src/tools/git-issues.js +12 -0
- package/src/tools/git-local.js +66 -0
- package/src/tools/git-meta.js +19 -0
- package/src/tools/git-misc.js +21 -0
- package/src/tools/git-orgs.js +26 -0
- package/src/tools/git-packages.js +12 -0
- package/src/tools/git-raw.js +14 -0
- package/src/tools/git-releases.js +17 -0
- package/src/tools/git-remote.js +29 -0
- package/src/tools/git-repos.js +60 -0
- package/src/tools/git-search.js +18 -0
- package/src/tools/git-sync.js +40 -0
- package/src/tools/git-user.js +26 -0
- package/src/tools/schema.js +3 -0
- package/src/utils/fs.js +29 -0
- package/src/utils/project.js +7 -0
- package/tests/errors.js +26 -0
- package/tests/full_suite.js +98 -0
- package/tests/run.js +50 -0
- package/LICENSE +0 -21
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -224
- package/dist/prompts/gitPrompts.d.ts +0 -93
- package/dist/prompts/gitPrompts.js +0 -177
- package/dist/providers/giteaProvider.d.ts +0 -3
- package/dist/providers/giteaProvider.js +0 -6
- package/dist/providers/githubProvider.d.ts +0 -2
- package/dist/providers/githubProvider.js +0 -4
- package/dist/providers/providerManager.d.ts +0 -11
- package/dist/providers/providerManager.js +0 -49
- package/dist/resources/toolsGuide.d.ts +0 -12
- package/dist/resources/toolsGuide.js +0 -1713
- package/dist/scripts/test_e2e.d.ts +0 -1
- package/dist/scripts/test_e2e.js +0 -199
- package/dist/scripts/test_exhaustive.d.ts +0 -1
- package/dist/scripts/test_exhaustive.js +0 -275
- package/dist/scripts/test_gitea_creation.d.ts +0 -1
- package/dist/scripts/test_gitea_creation.js +0 -116
- package/dist/scripts/verify_setup.d.ts +0 -1
- package/dist/scripts/verify_setup.js +0 -61
- package/dist/server.d.ts +0 -9
- package/dist/server.js +0 -73
- package/dist/tools/gitAnalytics.d.ts +0 -35
- package/dist/tools/gitAnalytics.js +0 -220
- package/dist/tools/gitArchive.d.ts +0 -119
- package/dist/tools/gitArchive.js +0 -150
- package/dist/tools/gitBackup.d.ts +0 -116
- package/dist/tools/gitBackup.js +0 -156
- package/dist/tools/gitBranches.d.ts +0 -54
- package/dist/tools/gitBranches.js +0 -282
- package/dist/tools/gitChangelog.d.ts +0 -37
- package/dist/tools/gitChangelog.js +0 -67
- package/dist/tools/gitConfig.d.ts +0 -97
- package/dist/tools/gitConfig.js +0 -125
- package/dist/tools/gitFiles.d.ts +0 -129
- package/dist/tools/gitFiles.js +0 -213
- package/dist/tools/gitFix.d.ts +0 -4
- package/dist/tools/gitFix.js +0 -159
- package/dist/tools/gitFix.tool.d.ts +0 -31
- package/dist/tools/gitFix.tool.js +0 -92
- package/dist/tools/gitHistory.d.ts +0 -41
- package/dist/tools/gitHistory.js +0 -349
- package/dist/tools/gitIgnore.d.ts +0 -214
- package/dist/tools/gitIgnore.js +0 -338
- package/dist/tools/gitIssues.d.ts +0 -80
- package/dist/tools/gitIssues.js +0 -363
- package/dist/tools/gitLog.d.ts +0 -30
- package/dist/tools/gitLog.js +0 -46
- package/dist/tools/gitMonitor.d.ts +0 -30
- package/dist/tools/gitMonitor.js +0 -284
- package/dist/tools/gitPackages.d.ts +0 -180
- package/dist/tools/gitPackages.js +0 -214
- package/dist/tools/gitPulls.d.ts +0 -66
- package/dist/tools/gitPulls.js +0 -347
- package/dist/tools/gitPush.d.ts +0 -40
- package/dist/tools/gitPush.js +0 -59
- package/dist/tools/gitRelease.d.ts +0 -49
- package/dist/tools/gitRelease.js +0 -359
- package/dist/tools/gitRemote.d.ts +0 -47
- package/dist/tools/gitRemote.js +0 -111
- package/dist/tools/gitReset.d.ts +0 -57
- package/dist/tools/gitReset.js +0 -79
- package/dist/tools/gitStash.d.ts +0 -61
- package/dist/tools/gitStash.js +0 -80
- package/dist/tools/gitSync.d.ts +0 -34
- package/dist/tools/gitSync.js +0 -182
- package/dist/tools/gitTags.d.ts +0 -45
- package/dist/tools/gitTags.js +0 -251
- package/dist/tools/gitUpdate.d.ts +0 -60
- package/dist/tools/gitUpdate.js +0 -474
- package/dist/tools/gitUpload.d.ts +0 -35
- package/dist/tools/gitUpload.js +0 -385
- package/dist/tools/gitWorkflow.d.ts +0 -117
- package/dist/tools/gitWorkflow.js +0 -472
- package/dist/types.d.ts +0 -20
- package/dist/types.js +0 -1
- package/dist/utils/agentHelpers.d.ts +0 -11
- package/dist/utils/agentHelpers.js +0 -41
- package/dist/utils/apiHelpers.d.ts +0 -29
- package/dist/utils/apiHelpers.js +0 -125
- package/dist/utils/cache.d.ts +0 -96
- package/dist/utils/cache.js +0 -208
- package/dist/utils/contextDetector.d.ts +0 -0
- package/dist/utils/contextDetector.js +0 -1
- package/dist/utils/errors.d.ts +0 -13
- package/dist/utils/errors.js +0 -17
- package/dist/utils/gitAdapter.d.ts +0 -224
- package/dist/utils/gitAdapter.js +0 -1162
- package/dist/utils/logger.d.ts +0 -45
- package/dist/utils/logger.js +0 -140
- package/dist/utils/rateLimiter.d.ts +0 -113
- package/dist/utils/rateLimiter.js +0 -257
- package/dist/utils/repoHelpers.d.ts +0 -44
- package/dist/utils/repoHelpers.js +0 -122
- package/dist/utils/safetyController.d.ts +0 -1
- package/dist/utils/safetyController.js +0 -12
- package/dist/utils/validation.d.ts +0 -115
- package/dist/utils/validation.js +0 -270
package/dist/index.js
DELETED
|
@@ -1,224 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
3
|
-
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
4
|
-
import { CallToolRequestSchema, ListToolsRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
-
import { ProviderManager } from './providers/providerManager.js';
|
|
6
|
-
import { MCPError } from './utils/errors.js';
|
|
7
|
-
import { IsomorphicGitAdapter } from './utils/gitAdapter.js';
|
|
8
|
-
import { GitFilesTool } from './tools/gitFiles.js';
|
|
9
|
-
import { GitWorkflowTool } from './tools/gitWorkflow.js';
|
|
10
|
-
import { GitBranchesTool } from './tools/gitBranches.js';
|
|
11
|
-
import { GitIssuesTool } from './tools/gitIssues.js';
|
|
12
|
-
import { GitPullsTool } from './tools/gitPulls.js';
|
|
13
|
-
import { GitTagsTool } from './tools/gitTags.js';
|
|
14
|
-
import { GitReleaseTool } from './tools/gitRelease.js';
|
|
15
|
-
import { GitRemoteTool } from './tools/gitRemote.js';
|
|
16
|
-
import { GitResetTool } from './tools/gitReset.js';
|
|
17
|
-
import { GitStashTool } from './tools/gitStash.js';
|
|
18
|
-
import { GitConfigTool } from './tools/gitConfig.js';
|
|
19
|
-
import { GitMonitorTool } from './tools/gitMonitor.js';
|
|
20
|
-
import { GitBackupTool } from './tools/gitBackup.js';
|
|
21
|
-
import { GitArchiveTool } from './tools/gitArchive.js';
|
|
22
|
-
import { GitSyncTool } from './tools/gitSync.js';
|
|
23
|
-
import { GitPackagesTool } from './tools/gitPackages.js';
|
|
24
|
-
import { GitAnalyticsTool } from './tools/gitAnalytics.js';
|
|
25
|
-
import { GitUploadTool } from './tools/gitUpload.js';
|
|
26
|
-
import { GitUpdateTool } from './tools/gitUpdate.js';
|
|
27
|
-
import { GitHistoryTool } from './tools/gitHistory.js';
|
|
28
|
-
import { GitFixTool } from './tools/gitFix.tool.js';
|
|
29
|
-
import { GitIgnoreTool } from './tools/gitIgnore.js';
|
|
30
|
-
import { GIT_PROMPTS } from './prompts/gitPrompts.js';
|
|
31
|
-
import TOOLS_GUIDE from './resources/toolsGuide.js';
|
|
32
|
-
import { Logger, logToolExecution, logSecurityEvent, logPerformanceMetric } from './utils/logger.js';
|
|
33
|
-
async function main() {
|
|
34
|
-
const providerManager = new ProviderManager();
|
|
35
|
-
const gitAdapter = new IsomorphicGitAdapter(providerManager);
|
|
36
|
-
const logger = Logger.getInstance();
|
|
37
|
-
// Skip validation on startup to prevent hanging (validation happens on first use)
|
|
38
|
-
// Provider validation moved to lazy initialization
|
|
39
|
-
// Register all 22 Git tools
|
|
40
|
-
const tools = [
|
|
41
|
-
new GitWorkflowTool(),
|
|
42
|
-
new GitFilesTool(),
|
|
43
|
-
new GitBranchesTool(),
|
|
44
|
-
new GitIssuesTool(),
|
|
45
|
-
new GitPullsTool(),
|
|
46
|
-
new GitTagsTool(),
|
|
47
|
-
new GitReleaseTool(),
|
|
48
|
-
new GitRemoteTool(),
|
|
49
|
-
new GitResetTool(),
|
|
50
|
-
new GitStashTool(),
|
|
51
|
-
new GitConfigTool(),
|
|
52
|
-
new GitMonitorTool(),
|
|
53
|
-
new GitBackupTool(),
|
|
54
|
-
new GitArchiveTool(),
|
|
55
|
-
new GitSyncTool(),
|
|
56
|
-
new GitPackagesTool(),
|
|
57
|
-
new GitAnalyticsTool(),
|
|
58
|
-
new GitUploadTool(),
|
|
59
|
-
new GitUpdateTool(),
|
|
60
|
-
new GitHistoryTool(),
|
|
61
|
-
new GitFixTool(),
|
|
62
|
-
new GitIgnoreTool(),
|
|
63
|
-
];
|
|
64
|
-
// Register resources
|
|
65
|
-
const resources = [
|
|
66
|
-
TOOLS_GUIDE
|
|
67
|
-
];
|
|
68
|
-
// Silent mode for MCP clients - only log to stderr in debug mode
|
|
69
|
-
if (process.env.DEBUG) {
|
|
70
|
-
logger.info(`Registered ${tools.length} Git tools`);
|
|
71
|
-
logger.info(`Registered ${resources.length} resource(s)`);
|
|
72
|
-
logger.info(`Registered ${GIT_PROMPTS.length} prompt(s)`);
|
|
73
|
-
}
|
|
74
|
-
// Create MCP Server with STDIO transport
|
|
75
|
-
const server = new Server({
|
|
76
|
-
name: '@andrebuzeli/git-mcp',
|
|
77
|
-
version: '10.0.6',
|
|
78
|
-
});
|
|
79
|
-
// Register tool list handler
|
|
80
|
-
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
81
|
-
logger.debug('Listing available tools');
|
|
82
|
-
return {
|
|
83
|
-
tools: tools.map(tool => ({
|
|
84
|
-
name: tool.name,
|
|
85
|
-
description: tool.description,
|
|
86
|
-
inputSchema: tool.inputSchema || {
|
|
87
|
-
type: 'object',
|
|
88
|
-
properties: {},
|
|
89
|
-
additionalProperties: true,
|
|
90
|
-
},
|
|
91
|
-
})),
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
// Register tool execution handler with logging e segurança aprimorados
|
|
95
|
-
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
96
|
-
const toolName = request.params.name;
|
|
97
|
-
const tool = tools.find(t => t.name === toolName);
|
|
98
|
-
const startTime = Date.now();
|
|
99
|
-
if (!tool) {
|
|
100
|
-
logSecurityEvent('TOOL_NOT_FOUND', { toolName });
|
|
101
|
-
throw new Error(`Tool not found: ${toolName}`);
|
|
102
|
-
}
|
|
103
|
-
try {
|
|
104
|
-
// Validar argumentos contra o schema da ferramenta
|
|
105
|
-
const args = request.params.arguments ?? {};
|
|
106
|
-
// Validação básica de segurança
|
|
107
|
-
if (typeof args !== 'object' || args === null) {
|
|
108
|
-
logSecurityEvent('INVALID_ARGUMENTS', { toolName, args });
|
|
109
|
-
throw new MCPError('VALIDATION_ERROR', 'Arguments must be an object');
|
|
110
|
-
}
|
|
111
|
-
// Validar projectPath se existir
|
|
112
|
-
if ('projectPath' in args) {
|
|
113
|
-
const projectPath = args.projectPath;
|
|
114
|
-
if (typeof projectPath !== 'string') {
|
|
115
|
-
logSecurityEvent('INVALID_PROJECT_PATH_TYPE', { toolName, projectPath });
|
|
116
|
-
throw new MCPError('VALIDATION_ERROR', 'projectPath must be a string');
|
|
117
|
-
}
|
|
118
|
-
if (!projectPath || projectPath.includes('..')) {
|
|
119
|
-
logSecurityEvent('PATH_TRAVERSION_ATTEMPT', { toolName, projectPath });
|
|
120
|
-
throw new MCPError('VALIDATION_ERROR', 'Invalid project path');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
// Log da execução
|
|
124
|
-
logger.info(`Executing tool: ${toolName}`, { args }, toolName);
|
|
125
|
-
// Executar a ferramenta
|
|
126
|
-
const result = await tool.handle(args, { providerManager, gitAdapter });
|
|
127
|
-
const duration = Date.now() - startTime;
|
|
128
|
-
logPerformanceMetric(`tool_${toolName}`, duration, { success: true });
|
|
129
|
-
logToolExecution(toolName, args, result);
|
|
130
|
-
return {
|
|
131
|
-
content: [
|
|
132
|
-
{
|
|
133
|
-
type: 'text',
|
|
134
|
-
text: typeof result === 'string' ? result : JSON.stringify(result, null, 2),
|
|
135
|
-
},
|
|
136
|
-
],
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
catch (error) {
|
|
140
|
-
const duration = Date.now() - startTime;
|
|
141
|
-
logPerformanceMetric(`tool_${toolName}`, duration, { success: false, error: error.message });
|
|
142
|
-
logToolExecution(toolName, request.params.arguments ?? {}, undefined, error);
|
|
143
|
-
return {
|
|
144
|
-
content: [
|
|
145
|
-
{
|
|
146
|
-
type: 'text',
|
|
147
|
-
text: `Error: ${error.message || String(error)}`,
|
|
148
|
-
},
|
|
149
|
-
],
|
|
150
|
-
isError: true,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
// Register resource list handler
|
|
155
|
-
server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
156
|
-
logger.debug('Listing available resources');
|
|
157
|
-
return {
|
|
158
|
-
resources: resources.map(resource => ({
|
|
159
|
-
uri: resource.uri,
|
|
160
|
-
name: resource.name,
|
|
161
|
-
description: resource.description,
|
|
162
|
-
mimeType: resource.mimeType,
|
|
163
|
-
})),
|
|
164
|
-
};
|
|
165
|
-
});
|
|
166
|
-
// Register resource read handler
|
|
167
|
-
server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
168
|
-
const uri = request.params.uri;
|
|
169
|
-
const resource = resources.find(r => r.uri === uri);
|
|
170
|
-
if (!resource) {
|
|
171
|
-
logger.warn(`Resource not found: ${uri}`);
|
|
172
|
-
throw new Error(`Resource not found: ${uri}`);
|
|
173
|
-
}
|
|
174
|
-
logger.debug(`Reading resource: ${uri}`);
|
|
175
|
-
return {
|
|
176
|
-
contents: [
|
|
177
|
-
{
|
|
178
|
-
uri: resource.uri,
|
|
179
|
-
mimeType: resource.mimeType,
|
|
180
|
-
text: resource.content,
|
|
181
|
-
},
|
|
182
|
-
],
|
|
183
|
-
};
|
|
184
|
-
});
|
|
185
|
-
// Register prompt list handler
|
|
186
|
-
server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
187
|
-
logger.debug('Listing available prompts');
|
|
188
|
-
return {
|
|
189
|
-
prompts: GIT_PROMPTS.map(prompt => ({
|
|
190
|
-
name: prompt.name,
|
|
191
|
-
description: prompt.description,
|
|
192
|
-
arguments: prompt.arguments,
|
|
193
|
-
})),
|
|
194
|
-
};
|
|
195
|
-
});
|
|
196
|
-
// Register prompt get handler
|
|
197
|
-
server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
198
|
-
const promptName = request.params.name;
|
|
199
|
-
const prompt = GIT_PROMPTS.find(p => p.name === promptName);
|
|
200
|
-
if (!prompt) {
|
|
201
|
-
logger.warn(`Prompt not found: ${promptName}`);
|
|
202
|
-
throw new Error(`Prompt not found: ${promptName}`);
|
|
203
|
-
}
|
|
204
|
-
logger.debug(`Generating prompt: ${promptName}`);
|
|
205
|
-
const result = await prompt.generate(request.params.arguments ?? {}, { providerManager, gitAdapter });
|
|
206
|
-
return {
|
|
207
|
-
description: result.description,
|
|
208
|
-
messages: result.messages,
|
|
209
|
-
};
|
|
210
|
-
});
|
|
211
|
-
const transport = new StdioServerTransport();
|
|
212
|
-
await server.connect(transport);
|
|
213
|
-
// Only log in debug mode
|
|
214
|
-
if (process.env.DEBUG) {
|
|
215
|
-
logger.info(`✅ git-mcp MCP server running via STDIO`);
|
|
216
|
-
logger.info(`Tools: ${tools.length} registered`);
|
|
217
|
-
logger.info(`Resources: ${resources.length} registered`);
|
|
218
|
-
logger.info(`Prompts: ${GIT_PROMPTS.length} registered`);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
main().catch(err => {
|
|
222
|
-
console.error('❌ Failed to start git-mcp:', err);
|
|
223
|
-
process.exit(1);
|
|
224
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { MCPContext } from '../types.js';
|
|
2
|
-
export interface Prompt {
|
|
3
|
-
name: string;
|
|
4
|
-
title?: string;
|
|
5
|
-
description?: string;
|
|
6
|
-
arguments?: Array<{
|
|
7
|
-
name: string;
|
|
8
|
-
description?: string;
|
|
9
|
-
required?: boolean;
|
|
10
|
-
}>;
|
|
11
|
-
generate(args: Record<string, any>, ctx: MCPContext): Promise<{
|
|
12
|
-
description?: string;
|
|
13
|
-
messages: Array<{
|
|
14
|
-
role: "user" | "assistant";
|
|
15
|
-
content: {
|
|
16
|
-
type: "text";
|
|
17
|
-
text: string;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
}>;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* /gitupdate - Complete update workflow with remote traceability
|
|
24
|
-
*/
|
|
25
|
-
export declare class GitUpdatePrompt implements Prompt {
|
|
26
|
-
name: string;
|
|
27
|
-
title: string;
|
|
28
|
-
description: string;
|
|
29
|
-
generate(args: Record<string, any>, ctx: MCPContext): Promise<{
|
|
30
|
-
description: string;
|
|
31
|
-
messages: {
|
|
32
|
-
role: "user";
|
|
33
|
-
content: {
|
|
34
|
-
type: "text";
|
|
35
|
-
text: string;
|
|
36
|
-
};
|
|
37
|
-
}[];
|
|
38
|
-
}>;
|
|
39
|
-
} /**
|
|
40
|
-
* /gitfix - Fix repository configuration
|
|
41
|
-
*/
|
|
42
|
-
export declare class GitFixPrompt implements Prompt {
|
|
43
|
-
name: string;
|
|
44
|
-
title: string;
|
|
45
|
-
description: string;
|
|
46
|
-
generate(args: Record<string, any>, ctx: MCPContext): Promise<{
|
|
47
|
-
description: string;
|
|
48
|
-
messages: {
|
|
49
|
-
role: "user";
|
|
50
|
-
content: {
|
|
51
|
-
type: "text";
|
|
52
|
-
text: string;
|
|
53
|
-
};
|
|
54
|
-
}[];
|
|
55
|
-
}>;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* /gitlog - Generate changelog in repository
|
|
59
|
-
*/
|
|
60
|
-
export declare class GitLogPrompt implements Prompt {
|
|
61
|
-
name: string;
|
|
62
|
-
title: string;
|
|
63
|
-
description: string;
|
|
64
|
-
generate(args: Record<string, any>, ctx: MCPContext): Promise<{
|
|
65
|
-
description: string;
|
|
66
|
-
messages: {
|
|
67
|
-
role: "user";
|
|
68
|
-
content: {
|
|
69
|
-
type: "text";
|
|
70
|
-
text: string;
|
|
71
|
-
};
|
|
72
|
-
}[];
|
|
73
|
-
}>;
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* /gitrelease - Create release with changelog
|
|
77
|
-
*/
|
|
78
|
-
export declare class GitReleasePrompt implements Prompt {
|
|
79
|
-
name: string;
|
|
80
|
-
title: string;
|
|
81
|
-
description: string;
|
|
82
|
-
generate(args: Record<string, any>, ctx: MCPContext): Promise<{
|
|
83
|
-
description: string;
|
|
84
|
-
messages: {
|
|
85
|
-
role: "user";
|
|
86
|
-
content: {
|
|
87
|
-
type: "text";
|
|
88
|
-
text: string;
|
|
89
|
-
};
|
|
90
|
-
}[];
|
|
91
|
-
}>;
|
|
92
|
-
}
|
|
93
|
-
export declare const GIT_PROMPTS: Prompt[];
|
|
@@ -1,177 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* /gitupdate - Complete update workflow with remote traceability
|
|
3
|
-
*/
|
|
4
|
-
export class GitUpdatePrompt {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.name = "gitupdate";
|
|
7
|
-
this.title = "Git Update - Complete Workflow";
|
|
8
|
-
this.description = "Execute complete Git update (add, commit, push) with full remote traceability via issues";
|
|
9
|
-
}
|
|
10
|
-
async generate(args, ctx) {
|
|
11
|
-
// PROMPT só instrui o AI AGENT - não detecta nada
|
|
12
|
-
// AI AGENT é responsável por detectar workspace e passar projectPath obrigatório
|
|
13
|
-
return {
|
|
14
|
-
description: "Git update workflow with remote traceability",
|
|
15
|
-
messages: [
|
|
16
|
-
{
|
|
17
|
-
role: "user",
|
|
18
|
-
content: {
|
|
19
|
-
type: "text",
|
|
20
|
-
text: `Execute the git-update tool to update the current project.
|
|
21
|
-
|
|
22
|
-
You must call the git-update tool with:
|
|
23
|
-
- projectPath: (REQUIRED) Detect the user's current workspace folder path
|
|
24
|
-
- message: (optional) Generate appropriate conventional commit message
|
|
25
|
-
- files: (optional) Default is ["."]
|
|
26
|
-
|
|
27
|
-
The tool will automatically:
|
|
28
|
-
1. Stage all changes
|
|
29
|
-
2. Create commit
|
|
30
|
-
3. Push to GitHub and Gitea
|
|
31
|
-
4. Create traceability issues
|
|
32
|
-
5. Return tracking report
|
|
33
|
-
|
|
34
|
-
Call the tool now with the workspace path you detect from context.`
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
]
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
} /**
|
|
41
|
-
* /gitfix - Fix repository configuration
|
|
42
|
-
*/
|
|
43
|
-
export class GitFixPrompt {
|
|
44
|
-
constructor() {
|
|
45
|
-
this.name = "gitfix";
|
|
46
|
-
this.title = "Git Fix - Repository Configuration";
|
|
47
|
-
this.description = "Automatically fix and configure Git repository for dual-provider system";
|
|
48
|
-
}
|
|
49
|
-
async generate(args, ctx) {
|
|
50
|
-
// PROMPT só instrui o AI AGENT - não detecta nada
|
|
51
|
-
return {
|
|
52
|
-
description: "Fix Git repository configuration",
|
|
53
|
-
messages: [
|
|
54
|
-
{
|
|
55
|
-
role: "user",
|
|
56
|
-
content: {
|
|
57
|
-
type: "text",
|
|
58
|
-
text: `Execute the git-fix tool to fix Git repository configuration.
|
|
59
|
-
|
|
60
|
-
You must call the git-fix tool with:
|
|
61
|
-
- projectPath: (REQUIRED) Detect the user's current workspace folder path
|
|
62
|
-
- autoDetect: true (optional)
|
|
63
|
-
|
|
64
|
-
The tool will automatically:
|
|
65
|
-
1. Detect existing GitHub/Gitea remotes from URLs
|
|
66
|
-
2. Remove broken/duplicate remotes
|
|
67
|
-
3. Configure dual-provider setup (github, gitea, origin)
|
|
68
|
-
4. Create .gitignore if missing
|
|
69
|
-
5. Return configuration report
|
|
70
|
-
|
|
71
|
-
Call the tool now with the workspace path you detect from context.`
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
]
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* /gitlog - Generate changelog in repository
|
|
80
|
-
*/
|
|
81
|
-
export class GitLogPrompt {
|
|
82
|
-
constructor() {
|
|
83
|
-
this.name = "gitlog";
|
|
84
|
-
this.title = "Git Log - Generate Changelog";
|
|
85
|
-
this.description = "Generate Keep a Changelog format changelog and commit it to the repository";
|
|
86
|
-
}
|
|
87
|
-
async generate(args, ctx) {
|
|
88
|
-
// PROMPT só instrui o AI AGENT - não detecta nada
|
|
89
|
-
return {
|
|
90
|
-
description: "Generate changelog in repository",
|
|
91
|
-
messages: [
|
|
92
|
-
{
|
|
93
|
-
role: "user",
|
|
94
|
-
content: {
|
|
95
|
-
type: "text",
|
|
96
|
-
text: `Execute the git-history tool to generate a changelog.
|
|
97
|
-
|
|
98
|
-
You must call the git-history tool with:
|
|
99
|
-
- projectPath: (REQUIRED) Detect the user's current workspace folder path
|
|
100
|
-
- action: "generate_changelog" (REQUIRED)
|
|
101
|
-
- outputFile: "CHANGELOG.md" (optional)
|
|
102
|
-
- since: "last-tag" (optional)
|
|
103
|
-
- format: "keepachangelog" (optional)
|
|
104
|
-
|
|
105
|
-
The tool will automatically:
|
|
106
|
-
1. Analyze commits since last tag
|
|
107
|
-
2. Generate Keep a Changelog format
|
|
108
|
-
3. Save to repository
|
|
109
|
-
4. Commit and push
|
|
110
|
-
|
|
111
|
-
Call the tool now with the workspace path you detect from context.`
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
]
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* /gitrelease - Create release with changelog
|
|
120
|
-
*/
|
|
121
|
-
export class GitReleasePrompt {
|
|
122
|
-
constructor() {
|
|
123
|
-
this.name = "gitrelease";
|
|
124
|
-
this.title = "Git Release - Create Release";
|
|
125
|
-
this.description = "Create new release with automatic or manual version and changelog (always uses force)";
|
|
126
|
-
}
|
|
127
|
-
async generate(args, ctx) {
|
|
128
|
-
// PROMPT só instrui o AI AGENT - não detecta nada
|
|
129
|
-
return {
|
|
130
|
-
description: "Create new release with changelog",
|
|
131
|
-
messages: [
|
|
132
|
-
{
|
|
133
|
-
role: "user",
|
|
134
|
-
content: {
|
|
135
|
-
type: "text",
|
|
136
|
-
text: `Execute the release workflow to create a new version.
|
|
137
|
-
|
|
138
|
-
Workflow steps:
|
|
139
|
-
|
|
140
|
-
1. Generate changelog using git-history tool:
|
|
141
|
-
- projectPath: (REQUIRED) Detect workspace
|
|
142
|
-
- action: "generate_changelog"
|
|
143
|
-
|
|
144
|
-
2. Determine next version from commits (semver)
|
|
145
|
-
|
|
146
|
-
3. Create tag using git-tags tool:
|
|
147
|
-
- projectPath: (REQUIRED) Detect workspace
|
|
148
|
-
- action: "create"
|
|
149
|
-
- tagName: Next version
|
|
150
|
-
- force: true
|
|
151
|
-
|
|
152
|
-
4. Push tag using git-tags tool:
|
|
153
|
-
- projectPath: (REQUIRED) Detect workspace
|
|
154
|
-
- action: "push"
|
|
155
|
-
- tagName: Same version
|
|
156
|
-
- force: true
|
|
157
|
-
|
|
158
|
-
5. Create releases using git-release tool:
|
|
159
|
-
- projectPath: (REQUIRED) Detect workspace
|
|
160
|
-
- action: "create"
|
|
161
|
-
- tagName: Same version
|
|
162
|
-
- body: Changelog content
|
|
163
|
-
|
|
164
|
-
Execute all steps with the workspace path you detect from context.`
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
]
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
// Export all prompts
|
|
172
|
-
export const GIT_PROMPTS = [
|
|
173
|
-
new GitUpdatePrompt(),
|
|
174
|
-
new GitFixPrompt(),
|
|
175
|
-
new GitLogPrompt(),
|
|
176
|
-
new GitReleasePrompt(),
|
|
177
|
-
];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Octokit } from '@octokit/rest';
|
|
2
|
-
export declare class ProviderManager {
|
|
3
|
-
github?: Octokit;
|
|
4
|
-
giteaBaseUrl?: string;
|
|
5
|
-
giteaToken?: string;
|
|
6
|
-
constructor();
|
|
7
|
-
validateConfiguredProviders(): Promise<Record<string, {
|
|
8
|
-
ok: boolean;
|
|
9
|
-
error?: string;
|
|
10
|
-
}>>;
|
|
11
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { Octokit } from '@octokit/rest';
|
|
2
|
-
import axios from 'axios';
|
|
3
|
-
export class ProviderManager {
|
|
4
|
-
constructor() {
|
|
5
|
-
const ghToken = process.env.GITHUB_TOKEN;
|
|
6
|
-
if (ghToken) {
|
|
7
|
-
this.github = new Octokit({ auth: ghToken });
|
|
8
|
-
}
|
|
9
|
-
if (process.env.GITEA_URL && process.env.GITEA_TOKEN) {
|
|
10
|
-
this.giteaBaseUrl = process.env.GITEA_URL;
|
|
11
|
-
this.giteaToken = process.env.GITEA_TOKEN;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
async validateConfiguredProviders() {
|
|
15
|
-
const results = {};
|
|
16
|
-
const timeout = 5000; // 5 second timeout per provider
|
|
17
|
-
if (this.github) {
|
|
18
|
-
try {
|
|
19
|
-
const controller = new AbortController();
|
|
20
|
-
const timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
21
|
-
await Promise.race([
|
|
22
|
-
this.github.rest.users.getAuthenticated(),
|
|
23
|
-
new Promise((_, reject) => setTimeout(() => reject(new Error('Timeout')), timeout))
|
|
24
|
-
]);
|
|
25
|
-
clearTimeout(timeoutId);
|
|
26
|
-
results.github = { ok: true };
|
|
27
|
-
}
|
|
28
|
-
catch (err) {
|
|
29
|
-
results.github = { ok: false, error: err.message };
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (this.giteaBaseUrl && this.giteaToken) {
|
|
33
|
-
try {
|
|
34
|
-
const resp = await axios.get(`${this.giteaBaseUrl}/api/v1/user`, {
|
|
35
|
-
headers: { Authorization: `token ${this.giteaToken}` },
|
|
36
|
-
timeout: timeout,
|
|
37
|
-
});
|
|
38
|
-
if (resp.status === 200)
|
|
39
|
-
results.gitea = { ok: true };
|
|
40
|
-
else
|
|
41
|
-
results.gitea = { ok: false, error: `Status ${resp.status}` };
|
|
42
|
-
}
|
|
43
|
-
catch (err) {
|
|
44
|
-
results.gitea = { ok: false, error: err.message };
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
return results;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Git-MCP Tools Guide Resource
|
|
3
|
-
* Comprehensive documentation for all 20 Git tools available in the MCP server
|
|
4
|
-
*/
|
|
5
|
-
export declare const TOOLS_GUIDE: {
|
|
6
|
-
uri: string;
|
|
7
|
-
name: string;
|
|
8
|
-
description: string;
|
|
9
|
-
mimeType: string;
|
|
10
|
-
content: string;
|
|
11
|
-
};
|
|
12
|
-
export default TOOLS_GUIDE;
|