@loopstack/github-module 0.1.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 +67 -0
- package/dist/github-oauth.provider.d.ts +19 -0
- package/dist/github-oauth.provider.d.ts.map +1 -0
- package/dist/github-oauth.provider.js +91 -0
- package/dist/github-oauth.provider.js.map +1 -0
- package/dist/github.module.d.ts +3 -0
- package/dist/github.module.d.ts.map +1 -0
- package/dist/github.module.js +75 -0
- package/dist/github.module.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/actions/github-get-workflow-run.tool.d.ts +13 -0
- package/dist/tools/actions/github-get-workflow-run.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-get-workflow-run.tool.js +106 -0
- package/dist/tools/actions/github-get-workflow-run.tool.js.map +1 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts +16 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.js +129 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.js.map +1 -0
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts +15 -0
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-trigger-workflow.tool.js +101 -0
- package/dist/tools/actions/github-trigger-workflow.tool.js.map +1 -0
- package/dist/tools/content/github-create-or-update-file.tool.d.ts +17 -0
- package/dist/tools/content/github-create-or-update-file.tool.d.ts.map +1 -0
- package/dist/tools/content/github-create-or-update-file.tool.js +115 -0
- package/dist/tools/content/github-create-or-update-file.tool.js.map +1 -0
- package/dist/tools/content/github-get-commit.tool.d.ts +13 -0
- package/dist/tools/content/github-get-commit.tool.d.ts.map +1 -0
- package/dist/tools/content/github-get-commit.tool.js +113 -0
- package/dist/tools/content/github-get-commit.tool.js.map +1 -0
- package/dist/tools/content/github-get-file-content.tool.d.ts +14 -0
- package/dist/tools/content/github-get-file-content.tool.d.ts.map +1 -0
- package/dist/tools/content/github-get-file-content.tool.js +107 -0
- package/dist/tools/content/github-get-file-content.tool.js.map +1 -0
- package/dist/tools/content/github-list-directory.tool.d.ts +14 -0
- package/dist/tools/content/github-list-directory.tool.d.ts.map +1 -0
- package/dist/tools/content/github-list-directory.tool.js +102 -0
- package/dist/tools/content/github-list-directory.tool.js.map +1 -0
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts +14 -0
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-create-issue-comment.tool.js +100 -0
- package/dist/tools/issues/github-create-issue-comment.tool.js.map +1 -0
- package/dist/tools/issues/github-create-issue.tool.d.ts +16 -0
- package/dist/tools/issues/github-create-issue.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-create-issue.tool.js +112 -0
- package/dist/tools/issues/github-create-issue.tool.js.map +1 -0
- package/dist/tools/issues/github-get-issue.tool.d.ts +13 -0
- package/dist/tools/issues/github-get-issue.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-get-issue.tool.js +106 -0
- package/dist/tools/issues/github-get-issue.tool.js.map +1 -0
- package/dist/tools/issues/github-list-issues.tool.d.ts +17 -0
- package/dist/tools/issues/github-list-issues.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-list-issues.tool.js +115 -0
- package/dist/tools/issues/github-list-issues.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts +17 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.js +113 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts +13 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.js +113 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts +13 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js +97 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts +16 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js +113 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts +16 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js +108 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js.map +1 -0
- package/dist/tools/repos/github-create-repo.tool.d.ts +14 -0
- package/dist/tools/repos/github-create-repo.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-create-repo.tool.js +108 -0
- package/dist/tools/repos/github-create-repo.tool.js.map +1 -0
- package/dist/tools/repos/github-get-repo.tool.d.ts +12 -0
- package/dist/tools/repos/github-get-repo.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-get-repo.tool.js +107 -0
- package/dist/tools/repos/github-get-repo.tool.js.map +1 -0
- package/dist/tools/repos/github-list-branches.tool.d.ts +13 -0
- package/dist/tools/repos/github-list-branches.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-list-branches.tool.js +97 -0
- package/dist/tools/repos/github-list-branches.tool.js.map +1 -0
- package/dist/tools/repos/github-list-repos.tool.d.ts +14 -0
- package/dist/tools/repos/github-list-repos.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-list-repos.tool.js +107 -0
- package/dist/tools/repos/github-list-repos.tool.js.map +1 -0
- package/dist/tools/search/github-search-code.tool.d.ts +13 -0
- package/dist/tools/search/github-search-code.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-code.tool.js +100 -0
- package/dist/tools/search/github-search-code.tool.js.map +1 -0
- package/dist/tools/search/github-search-issues.tool.d.ts +14 -0
- package/dist/tools/search/github-search-issues.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-issues.tool.js +109 -0
- package/dist/tools/search/github-search-issues.tool.js.map +1 -0
- package/dist/tools/search/github-search-repos.tool.d.ts +14 -0
- package/dist/tools/search/github-search-repos.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-repos.tool.js +106 -0
- package/dist/tools/search/github-search-repos.tool.js.map +1 -0
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts +9 -0
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts.map +1 -0
- package/dist/tools/users/github-get-authenticated-user.tool.js +96 -0
- package/dist/tools/users/github-get-authenticated-user.tool.js.map +1 -0
- package/dist/tools/users/github-list-user-orgs.tool.d.ts +11 -0
- package/dist/tools/users/github-list-user-orgs.tool.d.ts.map +1 -0
- package/dist/tools/users/github-list-user-orgs.tool.js +95 -0
- package/dist/tools/users/github-list-user-orgs.tool.js.map +1 -0
- package/package.json +81 -0
- package/src/github-oauth.provider.ts +85 -0
- package/src/github.module.ts +63 -0
- package/src/index.ts +27 -0
- package/src/tools/actions/github-get-workflow-run.tool.ts +115 -0
- package/src/tools/actions/github-list-workflow-runs.tool.ts +141 -0
- package/src/tools/actions/github-trigger-workflow.tool.ts +97 -0
- package/src/tools/content/github-create-or-update-file.tool.ts +124 -0
- package/src/tools/content/github-get-commit.tool.ts +124 -0
- package/src/tools/content/github-get-file-content.tool.ts +112 -0
- package/src/tools/content/github-list-directory.tool.ts +105 -0
- package/src/tools/issues/github-create-issue-comment.tool.ts +100 -0
- package/src/tools/issues/github-create-issue.tool.ts +114 -0
- package/src/tools/issues/github-get-issue.tool.ts +115 -0
- package/src/tools/issues/github-list-issues.tool.ts +126 -0
- package/src/tools/pull-requests/github-create-pull-request.tool.ts +119 -0
- package/src/tools/pull-requests/github-get-pull-request.tool.ts +128 -0
- package/src/tools/pull-requests/github-list-pr-reviews.tool.ts +99 -0
- package/src/tools/pull-requests/github-list-pull-requests.tool.ts +124 -0
- package/src/tools/pull-requests/github-merge-pull-request.tool.ts +108 -0
- package/src/tools/repos/github-create-repo.tool.ts +111 -0
- package/src/tools/repos/github-get-repo.tool.ts +120 -0
- package/src/tools/repos/github-list-branches.tool.ts +97 -0
- package/src/tools/repos/github-list-repos.tool.ts +115 -0
- package/src/tools/search/github-search-code.tool.ts +105 -0
- package/src/tools/search/github-search-issues.tool.ts +120 -0
- package/src/tools/search/github-search-repos.tool.ts +115 -0
- package/src/tools/users/github-get-authenticated-user.tool.ts +98 -0
- package/src/tools/users/github-list-user-orgs.tool.ts +94 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubListDirectoryTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubListDirectoryTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubListDirectoryTool = GitHubListDirectoryTool_1 = class GitHubListDirectoryTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubListDirectoryTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const params = new URLSearchParams();
|
|
33
|
+
if (args.ref)
|
|
34
|
+
params.set('ref', args.ref);
|
|
35
|
+
const dirPath = args.path ?? '';
|
|
36
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/contents/${dirPath}${params.toString() ? `?${params.toString()}` : ''}`;
|
|
37
|
+
const response = await fetch(url, {
|
|
38
|
+
headers: {
|
|
39
|
+
Authorization: `Bearer ${accessToken}`,
|
|
40
|
+
Accept: 'application/vnd.github+json',
|
|
41
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
if (response.status === 401 || response.status === 403) {
|
|
45
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
46
|
+
return {
|
|
47
|
+
data: {
|
|
48
|
+
error: '401',
|
|
49
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
const body = await response.text();
|
|
55
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
56
|
+
return {
|
|
57
|
+
data: {
|
|
58
|
+
error: 'api_error',
|
|
59
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
const data = (await response.json());
|
|
64
|
+
const entries = data.map((entry) => ({
|
|
65
|
+
name: entry.name,
|
|
66
|
+
path: entry.path,
|
|
67
|
+
sha: entry.sha,
|
|
68
|
+
size: entry.size,
|
|
69
|
+
type: entry.type,
|
|
70
|
+
htmlUrl: entry.html_url,
|
|
71
|
+
}));
|
|
72
|
+
return {
|
|
73
|
+
data: { entries },
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
exports.GitHubListDirectoryTool = GitHubListDirectoryTool;
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, common_1.Inject)(),
|
|
80
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
81
|
+
], GitHubListDirectoryTool.prototype, "tokenStore", void 0);
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, common_2.Input)({
|
|
84
|
+
schema: zod_1.z
|
|
85
|
+
.object({
|
|
86
|
+
owner: zod_1.z.string(),
|
|
87
|
+
repo: zod_1.z.string(),
|
|
88
|
+
path: zod_1.z.string().default(''),
|
|
89
|
+
ref: zod_1.z.string().optional(),
|
|
90
|
+
})
|
|
91
|
+
.strict(),
|
|
92
|
+
}),
|
|
93
|
+
__metadata("design:type", Object)
|
|
94
|
+
], GitHubListDirectoryTool.prototype, "args", void 0);
|
|
95
|
+
exports.GitHubListDirectoryTool = GitHubListDirectoryTool = GitHubListDirectoryTool_1 = __decorate([
|
|
96
|
+
(0, common_2.Tool)({
|
|
97
|
+
config: {
|
|
98
|
+
description: 'Lists the contents of a directory in a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
99
|
+
},
|
|
100
|
+
})
|
|
101
|
+
], GitHubListDirectoryTool);
|
|
102
|
+
//# sourceMappingURL=github-list-directory.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-list-directory.tool.js","sourceRoot":"","sources":["../../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K,EAAC;QACL,MAAM,EAAE,OAAC;aACN,MAAM,CAAC;YACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;YAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;YAC5B,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;SAC3B,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;;qDAC4B;kCAhBnB,uBAAuB;IANnC,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,6HAA6H;SAChI;KACF,CAAC;GACW,uBAAuB,CAsFnC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubCreateIssueCommentArgs = {
|
|
3
|
+
owner: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
issueNumber: number;
|
|
6
|
+
body: string;
|
|
7
|
+
};
|
|
8
|
+
export declare class GitHubCreateIssueCommentTool implements ToolInterface {
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private tokenStore;
|
|
11
|
+
args: GitHubCreateIssueCommentArgs;
|
|
12
|
+
execute(args: GitHubCreateIssueCommentArgs, ctx: RunContext): Promise<ToolResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=github-create-issue-comment.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-create-issue-comment.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/github-create-issue-comment.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,4BAA4B,GAAG;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,qBAMa,4BAA6B,YAAW,aAAa;IAChE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAiD;IAGxE,OAAO,CAAC,UAAU,CAAkB;IAYpC,IAAI,EAAE,4BAA4B,CAAC;IAE7B,OAAO,CAAC,IAAI,EAAE,4BAA4B,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CA+DxF"}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubCreateIssueCommentTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubCreateIssueCommentTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = class GitHubCreateIssueCommentTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubCreateIssueCommentTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/issues/${args.issueNumber}/comments`;
|
|
33
|
+
const response = await fetch(url, {
|
|
34
|
+
method: 'POST',
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: `Bearer ${accessToken}`,
|
|
37
|
+
Accept: 'application/vnd.github+json',
|
|
38
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
39
|
+
'Content-Type': 'application/json',
|
|
40
|
+
},
|
|
41
|
+
body: JSON.stringify({ body: args.body }),
|
|
42
|
+
});
|
|
43
|
+
if (response.status === 401 || response.status === 403) {
|
|
44
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
45
|
+
return {
|
|
46
|
+
data: {
|
|
47
|
+
error: '401',
|
|
48
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
49
|
+
},
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
if (!response.ok) {
|
|
53
|
+
const errorBody = await response.text();
|
|
54
|
+
this.logger.error(`GitHub API error: ${response.status} ${errorBody}`);
|
|
55
|
+
return {
|
|
56
|
+
data: {
|
|
57
|
+
error: 'api_error',
|
|
58
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
59
|
+
},
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
const comment = (await response.json());
|
|
63
|
+
return {
|
|
64
|
+
data: {
|
|
65
|
+
comment: {
|
|
66
|
+
id: comment.id,
|
|
67
|
+
htmlUrl: comment.html_url,
|
|
68
|
+
createdAt: comment.created_at,
|
|
69
|
+
user: comment.user.login,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
exports.GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool;
|
|
76
|
+
__decorate([
|
|
77
|
+
(0, common_1.Inject)(),
|
|
78
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
79
|
+
], GitHubCreateIssueCommentTool.prototype, "tokenStore", void 0);
|
|
80
|
+
__decorate([
|
|
81
|
+
(0, common_2.Input)({
|
|
82
|
+
schema: zod_1.z
|
|
83
|
+
.object({
|
|
84
|
+
owner: zod_1.z.string(),
|
|
85
|
+
repo: zod_1.z.string(),
|
|
86
|
+
issueNumber: zod_1.z.number(),
|
|
87
|
+
body: zod_1.z.string(),
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
}),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], GitHubCreateIssueCommentTool.prototype, "args", void 0);
|
|
93
|
+
exports.GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = __decorate([
|
|
94
|
+
(0, common_2.Tool)({
|
|
95
|
+
config: {
|
|
96
|
+
description: 'Creates a comment on a GitHub issue or pull request. Returns { error: "unauthorized" } if no valid token is available.',
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
|
+
], GitHubCreateIssueCommentTool);
|
|
100
|
+
//# sourceMappingURL=github-create-issue-comment.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-create-issue-comment.tool.js","sourceRoot":"","sources":["../../../src/tools/issues/github-create-issue-comment.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAenD,IAAM,4BAA4B,oCAAlC,MAAM,4BAA4B;IACtB,MAAM,GAAG,IAAI,eAAM,CAAC,8BAA4B,CAAC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4
|
+
repo: string;
|
|
5
|
+
title: string;
|
|
6
|
+
body?: string;
|
|
7
|
+
labels?: string[];
|
|
8
|
+
assignees?: string[];
|
|
9
|
+
};
|
|
10
|
+
export declare class GitHubCreateIssueTool implements ToolInterface {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private tokenStore;
|
|
13
|
+
args: GitHubCreateIssueArgs;
|
|
14
|
+
execute(args: GitHubCreateIssueArgs, ctx: RunContext): Promise<ToolResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=github-create-issue.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-create-issue.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/github-create-issue.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;CACtB,CAAC;AAEF,qBAMa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;IAGjE,OAAO,CAAC,UAAU,CAAkB;IAcpC,IAAI,EAAE,qBAAqB,CAAC;IAEtB,OAAO,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAyEjF"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubCreateIssueTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubCreateIssueTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubCreateIssueTool = GitHubCreateIssueTool_1 = class GitHubCreateIssueTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubCreateIssueTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const requestBody = {
|
|
33
|
+
title: args.title,
|
|
34
|
+
};
|
|
35
|
+
if (args.body)
|
|
36
|
+
requestBody.body = args.body;
|
|
37
|
+
if (args.labels)
|
|
38
|
+
requestBody.labels = args.labels;
|
|
39
|
+
if (args.assignees)
|
|
40
|
+
requestBody.assignees = args.assignees;
|
|
41
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/issues`;
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
method: 'POST',
|
|
44
|
+
headers: {
|
|
45
|
+
Authorization: `Bearer ${accessToken}`,
|
|
46
|
+
Accept: 'application/vnd.github+json',
|
|
47
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
48
|
+
'Content-Type': 'application/json',
|
|
49
|
+
},
|
|
50
|
+
body: JSON.stringify(requestBody),
|
|
51
|
+
});
|
|
52
|
+
if (response.status === 401 || response.status === 403) {
|
|
53
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
54
|
+
return {
|
|
55
|
+
data: {
|
|
56
|
+
error: '401',
|
|
57
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
if (!response.ok) {
|
|
62
|
+
const errorBody = await response.text();
|
|
63
|
+
this.logger.error(`GitHub API error: ${response.status} ${errorBody}`);
|
|
64
|
+
return {
|
|
65
|
+
data: {
|
|
66
|
+
error: 'api_error',
|
|
67
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
68
|
+
},
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
const issue = (await response.json());
|
|
72
|
+
return {
|
|
73
|
+
data: {
|
|
74
|
+
issue: {
|
|
75
|
+
id: issue.id,
|
|
76
|
+
number: issue.number,
|
|
77
|
+
title: issue.title,
|
|
78
|
+
htmlUrl: issue.html_url,
|
|
79
|
+
state: issue.state,
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.GitHubCreateIssueTool = GitHubCreateIssueTool;
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, common_1.Inject)(),
|
|
88
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
89
|
+
], GitHubCreateIssueTool.prototype, "tokenStore", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, common_2.Input)({
|
|
92
|
+
schema: zod_1.z
|
|
93
|
+
.object({
|
|
94
|
+
owner: zod_1.z.string(),
|
|
95
|
+
repo: zod_1.z.string(),
|
|
96
|
+
title: zod_1.z.string(),
|
|
97
|
+
body: zod_1.z.string().optional(),
|
|
98
|
+
labels: zod_1.z.array(zod_1.z.string()).optional(),
|
|
99
|
+
assignees: zod_1.z.array(zod_1.z.string()).optional(),
|
|
100
|
+
})
|
|
101
|
+
.strict(),
|
|
102
|
+
}),
|
|
103
|
+
__metadata("design:type", Object)
|
|
104
|
+
], GitHubCreateIssueTool.prototype, "args", void 0);
|
|
105
|
+
exports.GitHubCreateIssueTool = GitHubCreateIssueTool = GitHubCreateIssueTool_1 = __decorate([
|
|
106
|
+
(0, common_2.Tool)({
|
|
107
|
+
config: {
|
|
108
|
+
description: 'Creates a new issue in a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
109
|
+
},
|
|
110
|
+
})
|
|
111
|
+
], GitHubCreateIssueTool);
|
|
112
|
+
//# sourceMappingURL=github-create-issue.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-create-issue.tool.js","sourceRoot":"","sources":["../../../src/tools/issues/github-create-issue.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAiBnD,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IACf,MAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAGzD,UAAU,CAAkB;IAcpC,IAAI,CAAwB;IAE5B,KAAK,CAAC,OAAO,CAAC,IAA2B,EAAE,GAAe;QACxD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEpF,IAAI,CAAC,WA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B,qBAAqB;IANjC,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,+GAA+G;SAClH;KACF,CAAC;GACW,qBAAqB,CA6FjC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubGetIssueArgs = {
|
|
3
|
+
owner: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
issueNumber: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class GitHubGetIssueTool implements ToolInterface {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private tokenStore;
|
|
10
|
+
args: GitHubGetIssueArgs;
|
|
11
|
+
execute(args: GitHubGetIssueArgs, ctx: RunContext): Promise<ToolResult>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=github-get-issue.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-issue.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/github-get-issue.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,qBAMa,kBAAmB,YAAW,aAAa;IACtD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAuC;IAG9D,OAAO,CAAC,UAAU,CAAkB;IAWpC,IAAI,EAAE,kBAAkB,CAAC;IAEnB,OAAO,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAgF9E"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubGetIssueTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubGetIssueTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubGetIssueTool = GitHubGetIssueTool_1 = class GitHubGetIssueTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubGetIssueTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/issues/${args.issueNumber}`;
|
|
33
|
+
const response = await fetch(url, {
|
|
34
|
+
headers: {
|
|
35
|
+
Authorization: `Bearer ${accessToken}`,
|
|
36
|
+
Accept: 'application/vnd.github+json',
|
|
37
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
if (response.status === 401 || response.status === 403) {
|
|
41
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
42
|
+
return {
|
|
43
|
+
data: {
|
|
44
|
+
error: '401',
|
|
45
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const body = await response.text();
|
|
51
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
52
|
+
return {
|
|
53
|
+
data: {
|
|
54
|
+
error: 'api_error',
|
|
55
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const issue = (await response.json());
|
|
60
|
+
return {
|
|
61
|
+
data: {
|
|
62
|
+
issue: {
|
|
63
|
+
id: issue.id,
|
|
64
|
+
number: issue.number,
|
|
65
|
+
title: issue.title,
|
|
66
|
+
body: issue.body,
|
|
67
|
+
state: issue.state,
|
|
68
|
+
user: issue.user.login,
|
|
69
|
+
labels: issue.labels.map((l) => l.name),
|
|
70
|
+
assignees: issue.assignees.map((a) => a.login),
|
|
71
|
+
milestone: issue.milestone?.title ?? null,
|
|
72
|
+
createdAt: issue.created_at,
|
|
73
|
+
updatedAt: issue.updated_at,
|
|
74
|
+
closedAt: issue.closed_at,
|
|
75
|
+
htmlUrl: issue.html_url,
|
|
76
|
+
comments: issue.comments,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.GitHubGetIssueTool = GitHubGetIssueTool;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, common_1.Inject)(),
|
|
85
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
86
|
+
], GitHubGetIssueTool.prototype, "tokenStore", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, common_2.Input)({
|
|
89
|
+
schema: zod_1.z
|
|
90
|
+
.object({
|
|
91
|
+
owner: zod_1.z.string(),
|
|
92
|
+
repo: zod_1.z.string(),
|
|
93
|
+
issueNumber: zod_1.z.number(),
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
}),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], GitHubGetIssueTool.prototype, "args", void 0);
|
|
99
|
+
exports.GitHubGetIssueTool = GitHubGetIssueTool = GitHubGetIssueTool_1 = __decorate([
|
|
100
|
+
(0, common_2.Tool)({
|
|
101
|
+
config: {
|
|
102
|
+
description: 'Gets detailed information about a specific GitHub issue. Returns { error: "unauthorized" } if no valid token is available.',
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
], GitHubGetIssueTool);
|
|
106
|
+
//# sourceMappingURL=github-get-issue.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-issue.tool.js","sourceRoot":"","sources":["../../../src/tools/issues/github-get-issue.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAcnD,IAAM,kBAAkB,0BAAxB,MAAM,kBAAkB;IACZ,MAAM,GAAG,IAAI,eAAM,CAAC,oBAAkB,CAAC,IAAI,CAAC,CAAC;IAGtD,UAAU,CAAkB;IAWpC,IAAI,CAAqB;IAEzB,KAAK,CAAC,OAAO,CAAC,IAAwB,EAAE,GAAe;QACrD,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEpF,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,cAAc;oBACrB,OAA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Args = {
|
|
3
|
+
owner: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
state?: string;
|
|
6
|
+
labels?: string;
|
|
7
|
+
assignee?: string;
|
|
8
|
+
perPage?: number;
|
|
9
|
+
page?: number;
|
|
10
|
+
};
|
|
11
|
+
export declare class GitHubListIssuesTool implements ToolInterface {
|
|
12
|
+
private readonly logger;
|
|
13
|
+
private tokenStore;
|
|
14
|
+
args: GitHubListIssuesArgs;
|
|
15
|
+
execute(args: GitHubListIssuesArgs, ctx: RunContext): Promise<ToolResult>;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=github-list-issues.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-list-issues.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/issues/github-list-issues.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,oBAAoB,GAAG;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAMa,oBAAqB,YAAW,aAAa;IACxD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAGhE,OAAO,CAAC,UAAU,CAAkB;IAepC,IAAI,EAAE,oBAAoB,CAAC;IAErB,OAAO,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAmFhF"}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubListIssuesTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubListIssuesTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubListIssuesTool = GitHubListIssuesTool_1 = class GitHubListIssuesTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubListIssuesTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const params = new URLSearchParams({
|
|
33
|
+
state: args.state ?? 'open',
|
|
34
|
+
per_page: String(args.perPage ?? 30),
|
|
35
|
+
page: String(args.page ?? 1),
|
|
36
|
+
});
|
|
37
|
+
if (args.labels)
|
|
38
|
+
params.set('labels', args.labels);
|
|
39
|
+
if (args.assignee)
|
|
40
|
+
params.set('assignee', args.assignee);
|
|
41
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/issues?${params.toString()}`;
|
|
42
|
+
const response = await fetch(url, {
|
|
43
|
+
headers: {
|
|
44
|
+
Authorization: `Bearer ${accessToken}`,
|
|
45
|
+
Accept: 'application/vnd.github+json',
|
|
46
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
if (response.status === 401 || response.status === 403) {
|
|
50
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
51
|
+
return {
|
|
52
|
+
data: {
|
|
53
|
+
error: '401',
|
|
54
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
if (!response.ok) {
|
|
59
|
+
const body = await response.text();
|
|
60
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
61
|
+
return {
|
|
62
|
+
data: {
|
|
63
|
+
error: 'api_error',
|
|
64
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
const data = (await response.json());
|
|
69
|
+
const issues = data.map((issue) => ({
|
|
70
|
+
id: issue.id,
|
|
71
|
+
number: issue.number,
|
|
72
|
+
title: issue.title,
|
|
73
|
+
state: issue.state,
|
|
74
|
+
user: issue.user.login,
|
|
75
|
+
labels: issue.labels.map((l) => l.name),
|
|
76
|
+
assignees: issue.assignees.map((a) => a.login),
|
|
77
|
+
createdAt: issue.created_at,
|
|
78
|
+
updatedAt: issue.updated_at,
|
|
79
|
+
htmlUrl: issue.html_url,
|
|
80
|
+
isPullRequest: !!issue.pull_request,
|
|
81
|
+
}));
|
|
82
|
+
return {
|
|
83
|
+
data: { issues },
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.GitHubListIssuesTool = GitHubListIssuesTool;
|
|
88
|
+
__decorate([
|
|
89
|
+
(0, common_1.Inject)(),
|
|
90
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
91
|
+
], GitHubListIssuesTool.prototype, "tokenStore", void 0);
|
|
92
|
+
__decorate([
|
|
93
|
+
(0, common_2.Input)({
|
|
94
|
+
schema: zod_1.z
|
|
95
|
+
.object({
|
|
96
|
+
owner: zod_1.z.string(),
|
|
97
|
+
repo: zod_1.z.string(),
|
|
98
|
+
state: zod_1.z.enum(['open', 'closed', 'all']).default('open'),
|
|
99
|
+
labels: zod_1.z.string().optional(),
|
|
100
|
+
assignee: zod_1.z.string().optional(),
|
|
101
|
+
perPage: zod_1.z.number().default(30),
|
|
102
|
+
page: zod_1.z.number().default(1),
|
|
103
|
+
})
|
|
104
|
+
.strict(),
|
|
105
|
+
}),
|
|
106
|
+
__metadata("design:type", Object)
|
|
107
|
+
], GitHubListIssuesTool.prototype, "args", void 0);
|
|
108
|
+
exports.GitHubListIssuesTool = GitHubListIssuesTool = GitHubListIssuesTool_1 = __decorate([
|
|
109
|
+
(0, common_2.Tool)({
|
|
110
|
+
config: {
|
|
111
|
+
description: 'Lists issues for a GitHub repository. Note: the GitHub API returns both issues and pull requests; pull requests have a pull_request key. Returns { error: "unauthorized" } if no valid token is available.',
|
|
112
|
+
},
|
|
113
|
+
})
|
|
114
|
+
], GitHubListIssuesTool);
|
|
115
|
+
//# sourceMappingURL=github-list-issues.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-list-issues.tool.js","sourceRoot":"","sources":["../../../src/tools/issues/github-list-issues.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAkBnD,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IACd,MAAM,GAAG,IAAI,eAAM,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