@andrebuzeli/git-mcp 5.0.5 → 5.0.6
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 +487 -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 +641 -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 +280 -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 +682 -222
- 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 +326 -0
- package/dist/utils/git-command-executor.d.ts.map +1 -0
- package/dist/utils/git-command-executor.js +877 -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 +464 -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 +234 -459
- 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
|
@@ -1,307 +1,670 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GitHub Provider
|
|
4
|
+
*
|
|
5
|
+
* Implementation of BaseProvider for GitHub API operations.
|
|
6
|
+
* Handles authentication, repository management, issues, PRs, and more.
|
|
7
|
+
*/
|
|
2
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
9
|
exports.GitHubProvider = void 0;
|
|
10
|
+
const rest_1 = require("@octokit/rest");
|
|
4
11
|
const base_provider_js_1 = require("./base-provider.js");
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
12
|
+
const retry_js_1 = require("../utils/retry.js");
|
|
13
|
+
class GitHubProvider extends base_provider_js_1.BaseProvider {
|
|
14
|
+
octokit = null;
|
|
15
|
+
githubConfig;
|
|
9
16
|
constructor(config) {
|
|
10
|
-
super(config);
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
'Accept': 'application/vnd.github.v3+json',
|
|
19
|
-
'User-Agent': 'Git-MCP-Server/5.0.2'
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
// Implementação básica dos métodos essenciais
|
|
23
|
-
async createRepository(params) {
|
|
24
|
-
const { name, description, private: isPrivate } = params;
|
|
25
|
-
const response = await this.client.post('/user/repos', {
|
|
26
|
-
name,
|
|
27
|
-
description: description || '',
|
|
28
|
-
private: isPrivate || false,
|
|
29
|
-
auto_init: true
|
|
30
|
-
});
|
|
31
|
-
return this.normalizeRepository(response.data);
|
|
32
|
-
}
|
|
33
|
-
async listRepositories(username, page = 1, limit = 30) {
|
|
34
|
-
const url = username ? `/users/${username}/repos` : '/user/repos';
|
|
35
|
-
const response = await this.client.get(url, {
|
|
36
|
-
params: { page, per_page: limit }
|
|
37
|
-
});
|
|
38
|
-
return response.data.map((repo) => this.normalizeRepository(repo));
|
|
39
|
-
}
|
|
40
|
-
async getRepository(owner, repo) {
|
|
41
|
-
const response = await this.client.get(`/repos/${owner}/${repo}`);
|
|
42
|
-
return this.normalizeRepository(response.data);
|
|
17
|
+
super('github', config);
|
|
18
|
+
this.githubConfig = config;
|
|
19
|
+
if (this.isConfigured()) {
|
|
20
|
+
this.octokit = new rest_1.Octokit({
|
|
21
|
+
auth: this.githubConfig.token,
|
|
22
|
+
userAgent: 'git-mcp/1.0.0'
|
|
23
|
+
});
|
|
24
|
+
}
|
|
43
25
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
26
|
+
/**
|
|
27
|
+
* Check if GitHub provider is properly configured
|
|
28
|
+
*/
|
|
29
|
+
isConfigured() {
|
|
30
|
+
return !!(this.githubConfig.token && this.githubConfig.username);
|
|
47
31
|
}
|
|
48
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Validate GitHub credentials by making a test API call
|
|
34
|
+
*/
|
|
35
|
+
async validateCredentials() {
|
|
36
|
+
if (!this.isConfigured() || !this.octokit) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
49
39
|
try {
|
|
50
|
-
await this.
|
|
40
|
+
await this.octokit.rest.users.getAuthenticated();
|
|
51
41
|
return true;
|
|
52
42
|
}
|
|
53
43
|
catch (error) {
|
|
54
44
|
return false;
|
|
55
45
|
}
|
|
56
46
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
normalizeBranch(data) {
|
|
93
|
-
return {
|
|
94
|
-
name: data.name,
|
|
95
|
-
commit: {
|
|
96
|
-
sha: data.commit.sha,
|
|
97
|
-
url: data.commit.url
|
|
98
|
-
},
|
|
99
|
-
protected: data.protected || false,
|
|
100
|
-
raw: data
|
|
101
|
-
};
|
|
47
|
+
/**
|
|
48
|
+
* Execute a GitHub operation
|
|
49
|
+
*/
|
|
50
|
+
async executeOperation(operation, params) {
|
|
51
|
+
if (!this.isConfigured()) {
|
|
52
|
+
return this.formatError('GITHUB_NOT_CONFIGURED', 'GitHub provider is not configured. Please set GITHUB_TOKEN and GITHUB_USERNAME environment variables.', { missingFields: this.getMissingConfigFields() });
|
|
53
|
+
}
|
|
54
|
+
if (!this.octokit) {
|
|
55
|
+
return this.formatError('GITHUB_CLIENT_ERROR', 'GitHub client is not initialized');
|
|
56
|
+
}
|
|
57
|
+
if (!this.isOperationSupported(operation)) {
|
|
58
|
+
return this.formatError('UNSUPPORTED_OPERATION', `Operation '${operation}' is not supported by GitHub provider`, { supportedOperations: this.getSupportedOperations() });
|
|
59
|
+
}
|
|
60
|
+
try {
|
|
61
|
+
const result = await (0, retry_js_1.retry)(() => this.executeGitHubOperation(operation, params), {
|
|
62
|
+
retries: 3,
|
|
63
|
+
factor: 2,
|
|
64
|
+
minTimeout: 200,
|
|
65
|
+
maxTimeout: 2000,
|
|
66
|
+
retryOn: (err) => {
|
|
67
|
+
// Retry on network errors and 5xx responses
|
|
68
|
+
if (!err)
|
|
69
|
+
return false;
|
|
70
|
+
const status = err.status || err.statusCode || (err.response && err.response.status);
|
|
71
|
+
if (!status)
|
|
72
|
+
return true; // network or unknown error
|
|
73
|
+
return status >= 500 || status === 429;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return this.formatSuccess(result);
|
|
77
|
+
}
|
|
78
|
+
catch (error) {
|
|
79
|
+
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
|
|
80
|
+
return this.formatError('GITHUB_API_ERROR', `GitHub API error: ${errorMessage}`, error);
|
|
81
|
+
}
|
|
102
82
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
83
|
+
/**
|
|
84
|
+
* Get supported operations for GitHub provider
|
|
85
|
+
*/
|
|
86
|
+
getSupportedOperations() {
|
|
87
|
+
return [
|
|
88
|
+
// Repository operations
|
|
89
|
+
'repo-create', 'repo-list', 'repo-get', 'repo-update', 'repo-delete', 'repo-fork', 'repo-search',
|
|
90
|
+
// Issue operations
|
|
91
|
+
'issue-create', 'issue-list', 'issue-get', 'issue-update', 'issue-close', 'issue-comment', 'issue-search',
|
|
92
|
+
// Pull request operations
|
|
93
|
+
'pr-create', 'pr-list', 'pr-get', 'pr-update', 'pr-merge', 'pr-close', 'pr-review', 'pr-search',
|
|
94
|
+
// Branch operations
|
|
95
|
+
'branch-create', 'branch-list', 'branch-get', 'branch-delete', 'branch-compare',
|
|
96
|
+
// Tag operations
|
|
97
|
+
'tag-create', 'tag-list', 'tag-get', 'tag-delete', 'tag-search',
|
|
98
|
+
// Release operations
|
|
99
|
+
'release-create', 'release-list', 'release-get', 'release-update', 'release-delete', 'release-publish', 'release-download',
|
|
100
|
+
// File operations
|
|
101
|
+
'file-read', 'file-create', 'file-update', 'file-delete', 'file-search',
|
|
102
|
+
// Backwards/IDE compatibility aliases used by some MCP clients
|
|
103
|
+
'listFiles', 'getFile',
|
|
104
|
+
// Package operations
|
|
105
|
+
'package-list', 'package-get', 'package-create', 'package-update', 'package-delete', 'package-publish', 'package-download'
|
|
106
|
+
];
|
|
118
107
|
}
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
108
|
+
/**
|
|
109
|
+
* Get missing configuration fields
|
|
110
|
+
*/
|
|
111
|
+
getMissingConfigFields() {
|
|
112
|
+
const missing = [];
|
|
113
|
+
if (!this.githubConfig.token) {
|
|
114
|
+
missing.push('GITHUB_TOKEN');
|
|
115
|
+
}
|
|
116
|
+
if (!this.githubConfig.username) {
|
|
117
|
+
missing.push('GITHUB_USERNAME');
|
|
118
|
+
}
|
|
119
|
+
return missing;
|
|
131
120
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
121
|
+
/**
|
|
122
|
+
* Execute specific GitHub operations
|
|
123
|
+
*/
|
|
124
|
+
async executeGitHubOperation(operation, params) {
|
|
125
|
+
if (!this.octokit) {
|
|
126
|
+
throw new Error('GitHub client not initialized');
|
|
127
|
+
}
|
|
128
|
+
// Repository operations
|
|
129
|
+
if (operation.startsWith('repo-')) {
|
|
130
|
+
return this.executeRepositoryOperation(operation, params);
|
|
131
|
+
}
|
|
132
|
+
// Issue operations
|
|
133
|
+
if (operation.startsWith('issue-')) {
|
|
134
|
+
return this.executeIssueOperation(operation, params);
|
|
135
|
+
}
|
|
136
|
+
// Pull request operations
|
|
137
|
+
if (operation.startsWith('pr-')) {
|
|
138
|
+
return this.executePullRequestOperation(operation, params);
|
|
139
|
+
}
|
|
140
|
+
// Branch operations
|
|
141
|
+
if (operation.startsWith('branch-')) {
|
|
142
|
+
return this.executeBranchOperation(operation, params);
|
|
143
|
+
}
|
|
144
|
+
// Tag operations
|
|
145
|
+
if (operation.startsWith('tag-')) {
|
|
146
|
+
return this.executeTagOperation(operation, params);
|
|
147
|
+
}
|
|
148
|
+
// Release operations
|
|
149
|
+
if (operation.startsWith('release-')) {
|
|
150
|
+
return this.executeReleaseOperation(operation, params);
|
|
151
|
+
}
|
|
152
|
+
// File operations
|
|
153
|
+
if (operation.startsWith('file-')) {
|
|
154
|
+
return this.executeFileOperation(operation, params);
|
|
155
|
+
}
|
|
156
|
+
// Package operations
|
|
157
|
+
if (operation.startsWith('package-')) {
|
|
158
|
+
return this.executePackageOperation(operation, params);
|
|
159
|
+
}
|
|
160
|
+
throw new Error(`Unsupported operation: ${operation}`);
|
|
150
161
|
}
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
162
|
+
/**
|
|
163
|
+
* Execute repository operations
|
|
164
|
+
*/
|
|
165
|
+
async executeRepositoryOperation(operation, params) {
|
|
166
|
+
const { owner = this.githubConfig.username, repo, ...otherParams } = params;
|
|
167
|
+
switch (operation) {
|
|
168
|
+
case 'repo-create':
|
|
169
|
+
return this.octokit.rest.repos.createForAuthenticatedUser({
|
|
170
|
+
name: params.name,
|
|
171
|
+
description: params.description,
|
|
172
|
+
private: params.private || false,
|
|
173
|
+
...otherParams
|
|
174
|
+
});
|
|
175
|
+
case 'repo-list':
|
|
176
|
+
return this.octokit.rest.repos.listForUser({
|
|
177
|
+
username: owner,
|
|
178
|
+
type: params.type || 'all',
|
|
179
|
+
...otherParams
|
|
180
|
+
});
|
|
181
|
+
case 'repo-get':
|
|
182
|
+
return this.octokit.rest.repos.get({
|
|
183
|
+
owner,
|
|
184
|
+
repo,
|
|
185
|
+
...otherParams
|
|
186
|
+
});
|
|
187
|
+
case 'repo-update':
|
|
188
|
+
return this.octokit.rest.repos.update({
|
|
189
|
+
owner,
|
|
190
|
+
repo,
|
|
191
|
+
...otherParams
|
|
192
|
+
});
|
|
193
|
+
case 'repo-delete':
|
|
194
|
+
return this.octokit.rest.repos.delete({
|
|
195
|
+
owner,
|
|
196
|
+
repo,
|
|
197
|
+
...otherParams
|
|
198
|
+
});
|
|
199
|
+
case 'repo-fork':
|
|
200
|
+
return this.octokit.rest.repos.createFork({
|
|
201
|
+
owner,
|
|
202
|
+
repo,
|
|
203
|
+
organization: params.organization,
|
|
204
|
+
...otherParams
|
|
205
|
+
});
|
|
206
|
+
case 'repo-search':
|
|
207
|
+
return this.octokit.rest.search.repos({
|
|
208
|
+
q: params.query,
|
|
209
|
+
sort: params.sort,
|
|
210
|
+
order: params.order,
|
|
211
|
+
...otherParams
|
|
212
|
+
});
|
|
213
|
+
default:
|
|
214
|
+
throw new Error(`Unsupported repository operation: ${operation}`);
|
|
215
|
+
}
|
|
185
216
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Execute issue operations
|
|
219
|
+
*/
|
|
220
|
+
async executeIssueOperation(operation, params) {
|
|
221
|
+
const { owner = this.githubConfig.username, repo, issue_number, ...otherParams } = params;
|
|
222
|
+
switch (operation) {
|
|
223
|
+
case 'issue-create':
|
|
224
|
+
return this.octokit.rest.issues.create({
|
|
225
|
+
owner,
|
|
226
|
+
repo,
|
|
227
|
+
title: params.title,
|
|
228
|
+
body: params.body,
|
|
229
|
+
labels: params.labels,
|
|
230
|
+
...otherParams
|
|
231
|
+
});
|
|
232
|
+
case 'issue-list':
|
|
233
|
+
return this.octokit.rest.issues.listForRepo({
|
|
234
|
+
owner,
|
|
235
|
+
repo,
|
|
236
|
+
state: params.state || 'open',
|
|
237
|
+
...otherParams
|
|
238
|
+
});
|
|
239
|
+
case 'issue-get':
|
|
240
|
+
return this.octokit.rest.issues.get({
|
|
241
|
+
owner,
|
|
242
|
+
repo,
|
|
243
|
+
issue_number,
|
|
244
|
+
...otherParams
|
|
245
|
+
});
|
|
246
|
+
case 'issue-update':
|
|
247
|
+
return this.octokit.rest.issues.update({
|
|
248
|
+
owner,
|
|
249
|
+
repo,
|
|
250
|
+
issue_number,
|
|
251
|
+
...otherParams
|
|
252
|
+
});
|
|
253
|
+
case 'issue-close':
|
|
254
|
+
return this.octokit.rest.issues.update({
|
|
255
|
+
owner,
|
|
256
|
+
repo,
|
|
257
|
+
issue_number,
|
|
258
|
+
state: 'closed',
|
|
259
|
+
...otherParams
|
|
260
|
+
});
|
|
261
|
+
case 'issue-comment':
|
|
262
|
+
return this.octokit.rest.issues.createComment({
|
|
263
|
+
owner,
|
|
264
|
+
repo,
|
|
265
|
+
issue_number,
|
|
266
|
+
body: params.body,
|
|
267
|
+
...otherParams
|
|
268
|
+
});
|
|
269
|
+
case 'issue-search':
|
|
270
|
+
return this.octokit.rest.search.issuesAndPullRequests({
|
|
271
|
+
q: `${params.query} type:issue`,
|
|
272
|
+
sort: params.sort,
|
|
273
|
+
order: params.order,
|
|
274
|
+
...otherParams
|
|
275
|
+
});
|
|
276
|
+
default:
|
|
277
|
+
throw new Error(`Unsupported issue operation: ${operation}`);
|
|
278
|
+
}
|
|
201
279
|
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
280
|
+
/**
|
|
281
|
+
* Execute pull request operations
|
|
282
|
+
*/
|
|
283
|
+
async executePullRequestOperation(operation, params) {
|
|
284
|
+
const { owner = this.githubConfig.username, repo, pull_number, ...otherParams } = params;
|
|
285
|
+
switch (operation) {
|
|
286
|
+
case 'pr-create':
|
|
287
|
+
return this.octokit.rest.pulls.create({
|
|
288
|
+
owner,
|
|
289
|
+
repo,
|
|
290
|
+
title: params.title,
|
|
291
|
+
head: params.head,
|
|
292
|
+
base: params.base,
|
|
293
|
+
body: params.body,
|
|
294
|
+
...otherParams
|
|
295
|
+
});
|
|
296
|
+
case 'pr-list':
|
|
297
|
+
return this.octokit.rest.pulls.list({
|
|
298
|
+
owner,
|
|
299
|
+
repo,
|
|
300
|
+
state: params.state || 'open',
|
|
301
|
+
...otherParams
|
|
302
|
+
});
|
|
303
|
+
case 'pr-get':
|
|
304
|
+
return this.octokit.rest.pulls.get({
|
|
305
|
+
owner,
|
|
306
|
+
repo,
|
|
307
|
+
pull_number,
|
|
308
|
+
...otherParams
|
|
309
|
+
});
|
|
310
|
+
case 'pr-update':
|
|
311
|
+
return this.octokit.rest.pulls.update({
|
|
312
|
+
owner,
|
|
313
|
+
repo,
|
|
314
|
+
pull_number,
|
|
315
|
+
...otherParams
|
|
316
|
+
});
|
|
317
|
+
case 'pr-merge':
|
|
318
|
+
return this.octokit.rest.pulls.merge({
|
|
319
|
+
owner,
|
|
320
|
+
repo,
|
|
321
|
+
pull_number,
|
|
322
|
+
commit_title: params.commit_title,
|
|
323
|
+
commit_message: params.commit_message,
|
|
324
|
+
merge_method: params.merge_method || 'merge',
|
|
325
|
+
...otherParams
|
|
326
|
+
});
|
|
327
|
+
case 'pr-close':
|
|
328
|
+
return this.octokit.rest.pulls.update({
|
|
329
|
+
owner,
|
|
330
|
+
repo,
|
|
331
|
+
pull_number,
|
|
332
|
+
state: 'closed',
|
|
333
|
+
...otherParams
|
|
334
|
+
});
|
|
335
|
+
case 'pr-review':
|
|
336
|
+
return this.octokit.rest.pulls.createReview({
|
|
337
|
+
owner,
|
|
338
|
+
repo,
|
|
339
|
+
pull_number,
|
|
340
|
+
event: params.event,
|
|
341
|
+
body: params.body,
|
|
342
|
+
...otherParams
|
|
343
|
+
});
|
|
344
|
+
case 'pr-search':
|
|
345
|
+
return this.octokit.rest.search.issuesAndPullRequests({
|
|
346
|
+
q: `${params.query} type:pr`,
|
|
347
|
+
sort: params.sort,
|
|
348
|
+
order: params.order,
|
|
349
|
+
...otherParams
|
|
350
|
+
});
|
|
351
|
+
default:
|
|
352
|
+
throw new Error(`Unsupported pull request operation: ${operation}`);
|
|
353
|
+
}
|
|
213
354
|
}
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
355
|
+
/**
|
|
356
|
+
* Execute branch operations
|
|
357
|
+
*/
|
|
358
|
+
async executeBranchOperation(operation, params) {
|
|
359
|
+
const { owner = this.githubConfig.username, repo, ...otherParams } = params;
|
|
360
|
+
switch (operation) {
|
|
361
|
+
case 'branch-create':
|
|
362
|
+
return this.octokit.rest.git.createRef({
|
|
363
|
+
owner,
|
|
364
|
+
repo,
|
|
365
|
+
ref: `refs/heads/${params.branch}`,
|
|
366
|
+
sha: params.sha,
|
|
367
|
+
...otherParams
|
|
368
|
+
});
|
|
369
|
+
case 'branch-list':
|
|
370
|
+
return this.octokit.rest.repos.listBranches({
|
|
371
|
+
owner,
|
|
372
|
+
repo,
|
|
373
|
+
...otherParams
|
|
374
|
+
});
|
|
375
|
+
case 'branch-get':
|
|
376
|
+
return this.octokit.rest.repos.getBranch({
|
|
377
|
+
owner,
|
|
378
|
+
repo,
|
|
379
|
+
branch: params.branch,
|
|
380
|
+
...otherParams
|
|
381
|
+
});
|
|
382
|
+
case 'branch-delete':
|
|
383
|
+
return this.octokit.rest.git.deleteRef({
|
|
384
|
+
owner,
|
|
385
|
+
repo,
|
|
386
|
+
ref: `heads/${params.branch}`,
|
|
387
|
+
...otherParams
|
|
388
|
+
});
|
|
389
|
+
case 'branch-compare':
|
|
390
|
+
return this.octokit.rest.repos.compareCommits({
|
|
391
|
+
owner,
|
|
392
|
+
repo,
|
|
393
|
+
base: params.base,
|
|
394
|
+
head: params.head,
|
|
395
|
+
...otherParams
|
|
396
|
+
});
|
|
397
|
+
default:
|
|
398
|
+
throw new Error(`Unsupported branch operation: ${operation}`);
|
|
399
|
+
}
|
|
226
400
|
}
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
401
|
+
/**
|
|
402
|
+
* Execute tag operations
|
|
403
|
+
*/
|
|
404
|
+
async executeTagOperation(operation, params) {
|
|
405
|
+
const { owner = this.githubConfig.username, repo, ...otherParams } = params;
|
|
406
|
+
switch (operation) {
|
|
407
|
+
case 'tag-create':
|
|
408
|
+
return this.octokit.rest.git.createTag({
|
|
409
|
+
owner,
|
|
410
|
+
repo,
|
|
411
|
+
tag: params.tag,
|
|
412
|
+
message: params.message,
|
|
413
|
+
object: params.object,
|
|
414
|
+
type: params.type || 'commit',
|
|
415
|
+
...otherParams
|
|
416
|
+
});
|
|
417
|
+
case 'tag-list':
|
|
418
|
+
return this.octokit.rest.repos.listTags({
|
|
419
|
+
owner,
|
|
420
|
+
repo,
|
|
421
|
+
...otherParams
|
|
422
|
+
});
|
|
423
|
+
case 'tag-get':
|
|
424
|
+
return this.octokit.rest.git.getTag({
|
|
425
|
+
owner,
|
|
426
|
+
repo,
|
|
427
|
+
tag_sha: params.tag_sha,
|
|
428
|
+
...otherParams
|
|
429
|
+
});
|
|
430
|
+
case 'tag-delete':
|
|
431
|
+
return this.octokit.rest.git.deleteRef({
|
|
432
|
+
owner,
|
|
433
|
+
repo,
|
|
434
|
+
ref: `tags/${params.tag}`,
|
|
435
|
+
...otherParams
|
|
436
|
+
});
|
|
437
|
+
case 'tag-search':
|
|
438
|
+
return this.octokit.rest.repos.listTags({
|
|
439
|
+
owner,
|
|
440
|
+
repo,
|
|
441
|
+
...otherParams
|
|
442
|
+
});
|
|
443
|
+
default:
|
|
444
|
+
throw new Error(`Unsupported tag operation: ${operation}`);
|
|
445
|
+
}
|
|
238
446
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
447
|
+
/**
|
|
448
|
+
* Execute release operations
|
|
449
|
+
*/
|
|
450
|
+
async executeReleaseOperation(operation, params) {
|
|
451
|
+
const { owner = this.githubConfig.username, repo, release_id, ...otherParams } = params;
|
|
452
|
+
switch (operation) {
|
|
453
|
+
case 'release-create':
|
|
454
|
+
return this.octokit.rest.repos.createRelease({
|
|
455
|
+
owner,
|
|
456
|
+
repo,
|
|
457
|
+
tag_name: params.tag_name,
|
|
458
|
+
name: params.name,
|
|
459
|
+
body: params.body,
|
|
460
|
+
draft: params.draft || false,
|
|
461
|
+
prerelease: params.prerelease || false,
|
|
462
|
+
...otherParams
|
|
463
|
+
});
|
|
464
|
+
case 'release-list':
|
|
465
|
+
return this.octokit.rest.repos.listReleases({
|
|
466
|
+
owner,
|
|
467
|
+
repo,
|
|
468
|
+
...otherParams
|
|
469
|
+
});
|
|
470
|
+
case 'release-get':
|
|
471
|
+
return this.octokit.rest.repos.getRelease({
|
|
472
|
+
owner,
|
|
473
|
+
repo,
|
|
474
|
+
release_id,
|
|
475
|
+
...otherParams
|
|
476
|
+
});
|
|
477
|
+
case 'release-update':
|
|
478
|
+
return this.octokit.rest.repos.updateRelease({
|
|
479
|
+
owner,
|
|
480
|
+
repo,
|
|
481
|
+
release_id,
|
|
482
|
+
...otherParams
|
|
483
|
+
});
|
|
484
|
+
case 'release-delete':
|
|
485
|
+
return this.octokit.rest.repos.deleteRelease({
|
|
486
|
+
owner,
|
|
487
|
+
repo,
|
|
488
|
+
release_id,
|
|
489
|
+
...otherParams
|
|
490
|
+
});
|
|
491
|
+
case 'release-publish':
|
|
492
|
+
return this.octokit.rest.repos.updateRelease({
|
|
493
|
+
owner,
|
|
494
|
+
repo,
|
|
495
|
+
release_id,
|
|
496
|
+
draft: false,
|
|
497
|
+
...otherParams
|
|
498
|
+
});
|
|
499
|
+
case 'release-download':
|
|
500
|
+
return this.octokit.rest.repos.getReleaseAsset({
|
|
501
|
+
owner,
|
|
502
|
+
repo,
|
|
503
|
+
asset_id: params.asset_id,
|
|
504
|
+
...otherParams
|
|
505
|
+
});
|
|
506
|
+
default:
|
|
507
|
+
throw new Error(`Unsupported release operation: ${operation}`);
|
|
508
|
+
}
|
|
243
509
|
}
|
|
244
|
-
|
|
245
|
-
|
|
510
|
+
/**
|
|
511
|
+
* Execute file operations
|
|
512
|
+
*/
|
|
513
|
+
async executeFileOperation(operation, params) {
|
|
514
|
+
const { owner = this.githubConfig.username, repo, path, ...otherParams } = params;
|
|
515
|
+
switch (operation) {
|
|
516
|
+
case 'file-read':
|
|
517
|
+
return this.octokit.rest.repos.getContent({
|
|
518
|
+
owner,
|
|
519
|
+
repo,
|
|
520
|
+
path,
|
|
521
|
+
...otherParams
|
|
522
|
+
});
|
|
523
|
+
// Compatibility alias: return directory listing or file content metadata
|
|
524
|
+
case 'listFiles': {
|
|
525
|
+
// If path is omitted, list repository root
|
|
526
|
+
const listPath = path || '';
|
|
527
|
+
const response = await this.octokit.rest.repos.getContent({
|
|
528
|
+
owner,
|
|
529
|
+
repo,
|
|
530
|
+
path: listPath,
|
|
531
|
+
...otherParams
|
|
532
|
+
});
|
|
533
|
+
// If response is an array, it's a directory listing
|
|
534
|
+
const data = Array.isArray(response.data)
|
|
535
|
+
? response.data.map((item) => ({
|
|
536
|
+
name: item.name,
|
|
537
|
+
path: item.path,
|
|
538
|
+
sha: item.sha,
|
|
539
|
+
type: item.type,
|
|
540
|
+
size: item.size,
|
|
541
|
+
url: item.html_url || item.url
|
|
542
|
+
}))
|
|
543
|
+
: ({
|
|
544
|
+
name: response.data.name,
|
|
545
|
+
path: response.data.path,
|
|
546
|
+
sha: response.data.sha,
|
|
547
|
+
type: response.data.type,
|
|
548
|
+
size: response.data.size,
|
|
549
|
+
url: response.data.html_url || response.data.url
|
|
550
|
+
});
|
|
551
|
+
return { status: 200, data };
|
|
552
|
+
}
|
|
553
|
+
// Compatibility alias: get raw file content and normalize return
|
|
554
|
+
case 'getFile': {
|
|
555
|
+
const res = await this.octokit.rest.repos.getContent({
|
|
556
|
+
owner,
|
|
557
|
+
repo,
|
|
558
|
+
path,
|
|
559
|
+
...otherParams
|
|
560
|
+
});
|
|
561
|
+
// GitHub returns base64 content for files
|
|
562
|
+
if (!res || !res.data) {
|
|
563
|
+
throw new Error('Empty response from GitHub getContent');
|
|
564
|
+
}
|
|
565
|
+
// If this is a file object
|
|
566
|
+
const fileData = Array.isArray(res.data) ? res.data[0] : res.data;
|
|
567
|
+
const contentEncoded = fileData.content;
|
|
568
|
+
let contentDecoded = null;
|
|
569
|
+
if (contentEncoded) {
|
|
570
|
+
contentDecoded = Buffer.from(contentEncoded, 'base64').toString('utf8');
|
|
571
|
+
}
|
|
572
|
+
return {
|
|
573
|
+
status: 200,
|
|
574
|
+
data: {
|
|
575
|
+
filePath: fileData.path,
|
|
576
|
+
sha: fileData.sha,
|
|
577
|
+
encoding: fileData.encoding || (contentEncoded ? 'base64' : undefined),
|
|
578
|
+
content: contentDecoded,
|
|
579
|
+
size: fileData.size,
|
|
580
|
+
url: fileData.html_url || fileData.url
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
}
|
|
584
|
+
case 'file-create':
|
|
585
|
+
return this.octokit.rest.repos.createOrUpdateFileContents({
|
|
586
|
+
owner,
|
|
587
|
+
repo,
|
|
588
|
+
path,
|
|
589
|
+
message: params.message,
|
|
590
|
+
content: params.content,
|
|
591
|
+
...otherParams
|
|
592
|
+
});
|
|
593
|
+
case 'file-update':
|
|
594
|
+
return this.octokit.rest.repos.createOrUpdateFileContents({
|
|
595
|
+
owner,
|
|
596
|
+
repo,
|
|
597
|
+
path,
|
|
598
|
+
message: params.message,
|
|
599
|
+
content: params.content,
|
|
600
|
+
sha: params.sha,
|
|
601
|
+
...otherParams
|
|
602
|
+
});
|
|
603
|
+
case 'file-delete':
|
|
604
|
+
return this.octokit.rest.repos.deleteFile({
|
|
605
|
+
owner,
|
|
606
|
+
repo,
|
|
607
|
+
path,
|
|
608
|
+
message: params.message,
|
|
609
|
+
sha: params.sha,
|
|
610
|
+
...otherParams
|
|
611
|
+
});
|
|
612
|
+
case 'file-search':
|
|
613
|
+
return this.octokit.rest.search.code({
|
|
614
|
+
q: `${params.query} repo:${owner}/${repo}`,
|
|
615
|
+
...otherParams
|
|
616
|
+
});
|
|
617
|
+
default:
|
|
618
|
+
throw new Error(`Unsupported file operation: ${operation}`);
|
|
619
|
+
}
|
|
246
620
|
}
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
async
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
621
|
+
/**
|
|
622
|
+
* Execute package operations
|
|
623
|
+
*/
|
|
624
|
+
async executePackageOperation(operation, params) {
|
|
625
|
+
const { owner = this.githubConfig.username, ...otherParams } = params;
|
|
626
|
+
switch (operation) {
|
|
627
|
+
case 'package-list':
|
|
628
|
+
return this.octokit.rest.packages.listPackagesForUser({
|
|
629
|
+
username: owner,
|
|
630
|
+
package_type: params.package_type || 'npm',
|
|
631
|
+
...otherParams
|
|
632
|
+
});
|
|
633
|
+
case 'package-get':
|
|
634
|
+
return this.octokit.rest.packages.getPackageForUser({
|
|
635
|
+
username: owner,
|
|
636
|
+
package_type: params.package_type || 'npm',
|
|
637
|
+
package_name: params.package_name,
|
|
638
|
+
...otherParams
|
|
639
|
+
});
|
|
640
|
+
case 'package-create':
|
|
641
|
+
// Package creation is typically done through package managers, not GitHub API
|
|
642
|
+
throw new Error('Package creation should be done through package managers (npm, etc.)');
|
|
643
|
+
case 'package-update':
|
|
644
|
+
// Package updates are typically done through package managers
|
|
645
|
+
throw new Error('Package updates should be done through package managers (npm, etc.)');
|
|
646
|
+
case 'package-delete':
|
|
647
|
+
return this.octokit.rest.packages.deletePackageForUser({
|
|
648
|
+
username: owner,
|
|
649
|
+
package_type: params.package_type || 'npm',
|
|
650
|
+
package_name: params.package_name,
|
|
651
|
+
...otherParams
|
|
652
|
+
});
|
|
653
|
+
case 'package-publish':
|
|
654
|
+
// Package publishing is typically done through package managers
|
|
655
|
+
throw new Error('Package publishing should be done through package managers (npm, etc.)');
|
|
656
|
+
case 'package-download':
|
|
657
|
+
return this.octokit.rest.packages.getPackageVersionForUser({
|
|
658
|
+
username: owner,
|
|
659
|
+
package_type: params.package_type || 'npm',
|
|
660
|
+
package_name: params.package_name,
|
|
661
|
+
package_version_id: params.package_version_id,
|
|
662
|
+
...otherParams
|
|
663
|
+
});
|
|
664
|
+
default:
|
|
665
|
+
throw new Error(`Unsupported package operation: ${operation}`);
|
|
666
|
+
}
|
|
257
667
|
}
|
|
258
|
-
async listPullRequests() { return []; }
|
|
259
|
-
async getPullRequest() { throw new Error('Not implemented'); }
|
|
260
|
-
async createPullRequest() { throw new Error('Not implemented'); }
|
|
261
|
-
async updatePullRequest() { throw new Error('Not implemented'); }
|
|
262
|
-
async mergePullRequest() { return false; }
|
|
263
|
-
async closePullRequest() { return false; }
|
|
264
|
-
async listReleases() { return []; }
|
|
265
|
-
async getRelease() { throw new Error('Not implemented'); }
|
|
266
|
-
async createRelease() { throw new Error('Not implemented'); }
|
|
267
|
-
async updateRelease() { throw new Error('Not implemented'); }
|
|
268
|
-
async deleteRelease() { return false; }
|
|
269
|
-
async listBranches() { return []; }
|
|
270
|
-
async getBranch() { throw new Error('Not implemented'); }
|
|
271
|
-
async createBranch() { throw new Error('Not implemented'); }
|
|
272
|
-
async deleteBranch() { return false; }
|
|
273
|
-
async listTags() { return []; }
|
|
274
|
-
async getTag() { throw new Error('Not implemented'); }
|
|
275
|
-
async createTag() { throw new Error('Not implemented'); }
|
|
276
|
-
async deleteTag() { return false; }
|
|
277
|
-
async getFileContent() { throw new Error('Not implemented'); }
|
|
278
|
-
async createFile() { throw new Error('Not implemented'); }
|
|
279
|
-
async updateFile() { throw new Error('Not implemented'); }
|
|
280
|
-
async deleteFile() { return false; }
|
|
281
|
-
async searchFiles() { return []; }
|
|
282
|
-
async listCommits() { return []; }
|
|
283
|
-
async getCommit() { throw new Error('Not implemented'); }
|
|
284
|
-
async compareCommits() { throw new Error('Not implemented'); }
|
|
285
|
-
async compareBranches() { throw new Error('Not implemented'); }
|
|
286
|
-
async transferRepository() { throw new Error('Not implemented'); }
|
|
287
|
-
async listJobs() { throw new Error('Not implemented'); }
|
|
288
|
-
async getUserRepositories() { return []; }
|
|
289
|
-
async listPackages() { return []; }
|
|
290
|
-
async getPackage() { throw new Error('Not implemented'); }
|
|
291
|
-
async createPackage() { throw new Error('Not implemented'); }
|
|
292
|
-
async updatePackage() { throw new Error('Not implemented'); }
|
|
293
|
-
async deletePackage() { return false; }
|
|
294
|
-
async publishPackage() { return false; }
|
|
295
|
-
async downloadPackage() { throw new Error('Not implemented'); }
|
|
296
|
-
async listProjects() { return []; }
|
|
297
|
-
async getProject() { throw new Error('Not implemented'); }
|
|
298
|
-
async createProject() { throw new Error('Not implemented'); }
|
|
299
|
-
async updateProject() { throw new Error('Not implemented'); }
|
|
300
|
-
async deleteProject() { return false; }
|
|
301
|
-
async addProjectItem() { throw new Error('Not implemented'); }
|
|
302
|
-
async updateProjectItem() { throw new Error('Not implemented'); }
|
|
303
|
-
async deleteProjectItem() { return false; }
|
|
304
|
-
async listProjectItems() { return []; }
|
|
305
668
|
}
|
|
306
669
|
exports.GitHubProvider = GitHubProvider;
|
|
307
670
|
//# sourceMappingURL=github-provider.js.map
|