@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 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-code.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/github-search-code.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,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;IAWpC,IAAI,EAAE,oBAAoB,CAAC;IAErB,OAAO,CAAC,IAAI,EAAE,oBAAoB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAsEhF"}
|
|
@@ -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 GitHubSearchCodeTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubSearchCodeTool = 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 GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubSearchCodeTool_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
|
+
q: args.query,
|
|
34
|
+
per_page: String(args.perPage ?? 30),
|
|
35
|
+
page: String(args.page ?? 1),
|
|
36
|
+
});
|
|
37
|
+
const response = await fetch(`https://api.github.com/search/code?${params.toString()}`, {
|
|
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 results = data.items.map((item) => ({
|
|
65
|
+
name: item.name,
|
|
66
|
+
path: item.path,
|
|
67
|
+
sha: item.sha,
|
|
68
|
+
htmlUrl: item.html_url,
|
|
69
|
+
repository: item.repository.full_name,
|
|
70
|
+
}));
|
|
71
|
+
return {
|
|
72
|
+
data: { totalCount: data.total_count, results },
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
exports.GitHubSearchCodeTool = GitHubSearchCodeTool;
|
|
77
|
+
__decorate([
|
|
78
|
+
(0, common_1.Inject)(),
|
|
79
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
80
|
+
], GitHubSearchCodeTool.prototype, "tokenStore", void 0);
|
|
81
|
+
__decorate([
|
|
82
|
+
(0, common_2.Input)({
|
|
83
|
+
schema: zod_1.z
|
|
84
|
+
.object({
|
|
85
|
+
query: zod_1.z.string(),
|
|
86
|
+
perPage: zod_1.z.number().default(30),
|
|
87
|
+
page: zod_1.z.number().default(1),
|
|
88
|
+
})
|
|
89
|
+
.strict(),
|
|
90
|
+
}),
|
|
91
|
+
__metadata("design:type", Object)
|
|
92
|
+
], GitHubSearchCodeTool.prototype, "args", void 0);
|
|
93
|
+
exports.GitHubSearchCodeTool = GitHubSearchCodeTool = GitHubSearchCodeTool_1 = __decorate([
|
|
94
|
+
(0, common_2.Tool)({
|
|
95
|
+
config: {
|
|
96
|
+
description: 'Searches for code across GitHub repositories using the GitHub search syntax. Returns { error: "unauthorized" } if no valid token is available.',
|
|
97
|
+
},
|
|
98
|
+
})
|
|
99
|
+
], GitHubSearchCodeTool);
|
|
100
|
+
//# sourceMappingURL=github-search-code.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-code.tool.js","sourceRoot":"","sources":["../../../src/tools/search/github-search-code.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAcnD,IAAM,oBAAoB,4BAA1B,MAAM,oBAAoB;IACd,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAGxD,UAAU,CAAkB;IAWpC,IAAI,CAAuB;IAE3B,KAAK,CAAC,OAAO,CAAC,IAA0B,EAAE,GAAe;QACvD,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,OAAO,EAAE,yDAAyD;iBACnE;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,CAAC,EAAE,IAAI,CAAC,KAAK;YACb,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YACpC,IAAI,EAAE,MAAM,C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,EAAE,IAAI,CAAC,QAAQ;YACtB,UAAU,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS;SACtC,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;SAChD,CAAC;IACJ,CAAC;CACF,CAAA;AAvFY,oDAAoB;AAIvB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;wDAAC;AAWpC;IATC,IAAA,cAAK,EAAC;QACL,MAAM,EAAE,OAAC;aACN,MAAM,CAAC;YACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;SAC5B,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;;kDACyB;+BAfhB,oBAAoB;IANhC,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,gJAAgJ;SACnJ;KACF,CAAC;GACW,oBAAoB,CAuFhC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubSearchIssuesArgs = {
|
|
3
|
+
query: string;
|
|
4
|
+
sort?: string;
|
|
5
|
+
perPage?: number;
|
|
6
|
+
page?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare class GitHubSearchIssuesTool implements ToolInterface {
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private tokenStore;
|
|
11
|
+
args: GitHubSearchIssuesArgs;
|
|
12
|
+
execute(args: GitHubSearchIssuesArgs, ctx: RunContext): Promise<ToolResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=github-search-issues.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-issues.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/github-search-issues.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAMa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAGlE,OAAO,CAAC,UAAU,CAAkB;IAcpC,IAAI,EAAE,sBAAsB,CAAC;IAEvB,OAAO,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAiFlF"}
|
|
@@ -0,0 +1,109 @@
|
|
|
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 GitHubSearchIssuesTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubSearchIssuesTool = 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 GitHubSearchIssuesTool = GitHubSearchIssuesTool_1 = class GitHubSearchIssuesTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubSearchIssuesTool_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
|
+
q: args.query,
|
|
34
|
+
per_page: String(args.perPage ?? 30),
|
|
35
|
+
page: String(args.page ?? 1),
|
|
36
|
+
});
|
|
37
|
+
if (args.sort)
|
|
38
|
+
params.set('sort', args.sort);
|
|
39
|
+
const response = await fetch(`https://api.github.com/search/issues?${params.toString()}`, {
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `Bearer ${accessToken}`,
|
|
42
|
+
Accept: 'application/vnd.github+json',
|
|
43
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (response.status === 401 || response.status === 403) {
|
|
47
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
48
|
+
return {
|
|
49
|
+
data: {
|
|
50
|
+
error: '401',
|
|
51
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
const body = await response.text();
|
|
57
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
58
|
+
return {
|
|
59
|
+
data: {
|
|
60
|
+
error: 'api_error',
|
|
61
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const data = (await response.json());
|
|
66
|
+
const results = data.items.map((item) => ({
|
|
67
|
+
id: item.id,
|
|
68
|
+
number: item.number,
|
|
69
|
+
title: item.title,
|
|
70
|
+
state: item.state,
|
|
71
|
+
user: item.user.login,
|
|
72
|
+
htmlUrl: item.html_url,
|
|
73
|
+
createdAt: item.created_at,
|
|
74
|
+
updatedAt: item.updated_at,
|
|
75
|
+
isPullRequest: !!item.pull_request,
|
|
76
|
+
}));
|
|
77
|
+
return {
|
|
78
|
+
data: { totalCount: data.total_count, results },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.GitHubSearchIssuesTool = GitHubSearchIssuesTool;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, common_1.Inject)(),
|
|
85
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
86
|
+
], GitHubSearchIssuesTool.prototype, "tokenStore", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, common_2.Input)({
|
|
89
|
+
schema: zod_1.z
|
|
90
|
+
.object({
|
|
91
|
+
query: zod_1.z.string(),
|
|
92
|
+
sort: zod_1.z
|
|
93
|
+
.enum(['comments', 'reactions', 'reactions-+1', 'reactions--1', 'interactions', 'created', 'updated'])
|
|
94
|
+
.optional(),
|
|
95
|
+
perPage: zod_1.z.number().default(30),
|
|
96
|
+
page: zod_1.z.number().default(1),
|
|
97
|
+
})
|
|
98
|
+
.strict(),
|
|
99
|
+
}),
|
|
100
|
+
__metadata("design:type", Object)
|
|
101
|
+
], GitHubSearchIssuesTool.prototype, "args", void 0);
|
|
102
|
+
exports.GitHubSearchIssuesTool = GitHubSearchIssuesTool = GitHubSearchIssuesTool_1 = __decorate([
|
|
103
|
+
(0, common_2.Tool)({
|
|
104
|
+
config: {
|
|
105
|
+
description: 'Searches for issues and pull requests across GitHub using the GitHub search syntax. Returns { error: "unauthorized" } if no valid token is available.',
|
|
106
|
+
},
|
|
107
|
+
})
|
|
108
|
+
], GitHubSearchIssuesTool);
|
|
109
|
+
//# sourceMappingURL=github-search-issues.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-issues.tool.js","sourceRoot":"","sources":["../../../src/tools/search/github-search-issues.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAenD,IAAM,sBAAsB,8BAA5B,MAAM,sBAAsB;IAChB,MAAM,GAAG,IAAI,eAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IAG1D,UAAU,CAAkB;IAcpC,IAAI,CAAyB;IAE7B,KAAK,CAAC,OAAO,CAAC,IAA4B,EAAE,GAAe;QACzD,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,OAAO,EAAE,yDAAyD;iBACnE;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,CAAC,EAAE,IAAI,CAAC,KAAK;YACb,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;SAC7B,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;QAE7C,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,wCAAwC,MAAM,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,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,aAAa,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY;SACnC,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;SAChD,CAAC;IACJ,CAAC;CACF,CAAA;AArGY,wDAAsB;AAIzB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;0DAAC;AAcpC;IAZC,IAAA,cAAK,EAAC;QACL,MAAM,EAAE,OAAC;aACN,MAAM,CAAC;YACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,OAAC;iBACJ,IAAI,CAAC,CAAC,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;iBACrG,QAAQ,EAAE;YACb,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;SAC5B,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;;oDAC2B;iCAlBlB,sBAAsB;IANlC,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,uJAAuJ;SAC1J;KACF,CAAC;GACW,sBAAsB,CAqGlC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubSearchReposArgs = {
|
|
3
|
+
query: string;
|
|
4
|
+
sort?: string;
|
|
5
|
+
perPage?: number;
|
|
6
|
+
page?: number;
|
|
7
|
+
};
|
|
8
|
+
export declare class GitHubSearchReposTool implements ToolInterface {
|
|
9
|
+
private readonly logger;
|
|
10
|
+
private tokenStore;
|
|
11
|
+
args: GitHubSearchReposArgs;
|
|
12
|
+
execute(args: GitHubSearchReposArgs, ctx: RunContext): Promise<ToolResult>;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=github-search-repos.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-repos.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/github-search-repos.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,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAMa,qBAAsB,YAAW,aAAa;IACzD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA0C;IAGjE,OAAO,CAAC,UAAU,CAAkB;IAYpC,IAAI,EAAE,qBAAqB,CAAC;IAEtB,OAAO,CAAC,IAAI,EAAE,qBAAqB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CA8EjF"}
|
|
@@ -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 GitHubSearchReposTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubSearchReposTool = 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 GitHubSearchReposTool = GitHubSearchReposTool_1 = class GitHubSearchReposTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubSearchReposTool_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
|
+
q: args.query,
|
|
34
|
+
per_page: String(args.perPage ?? 30),
|
|
35
|
+
page: String(args.page ?? 1),
|
|
36
|
+
});
|
|
37
|
+
if (args.sort)
|
|
38
|
+
params.set('sort', args.sort);
|
|
39
|
+
const response = await fetch(`https://api.github.com/search/repositories?${params.toString()}`, {
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `Bearer ${accessToken}`,
|
|
42
|
+
Accept: 'application/vnd.github+json',
|
|
43
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
if (response.status === 401 || response.status === 403) {
|
|
47
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
48
|
+
return {
|
|
49
|
+
data: {
|
|
50
|
+
error: '401',
|
|
51
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
if (!response.ok) {
|
|
56
|
+
const body = await response.text();
|
|
57
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
58
|
+
return {
|
|
59
|
+
data: {
|
|
60
|
+
error: 'api_error',
|
|
61
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
const data = (await response.json());
|
|
66
|
+
const results = data.items.map((item) => ({
|
|
67
|
+
id: item.id,
|
|
68
|
+
fullName: item.full_name,
|
|
69
|
+
description: item.description,
|
|
70
|
+
htmlUrl: item.html_url,
|
|
71
|
+
language: item.language,
|
|
72
|
+
stars: item.stargazers_count,
|
|
73
|
+
forks: item.forks_count,
|
|
74
|
+
updatedAt: item.updated_at,
|
|
75
|
+
}));
|
|
76
|
+
return {
|
|
77
|
+
data: { totalCount: data.total_count, results },
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
exports.GitHubSearchReposTool = GitHubSearchReposTool;
|
|
82
|
+
__decorate([
|
|
83
|
+
(0, common_1.Inject)(),
|
|
84
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
85
|
+
], GitHubSearchReposTool.prototype, "tokenStore", void 0);
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, common_2.Input)({
|
|
88
|
+
schema: zod_1.z
|
|
89
|
+
.object({
|
|
90
|
+
query: zod_1.z.string(),
|
|
91
|
+
sort: zod_1.z.enum(['stars', 'forks', 'help-wanted-issues', 'updated']).optional(),
|
|
92
|
+
perPage: zod_1.z.number().default(30),
|
|
93
|
+
page: zod_1.z.number().default(1),
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
}),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], GitHubSearchReposTool.prototype, "args", void 0);
|
|
99
|
+
exports.GitHubSearchReposTool = GitHubSearchReposTool = GitHubSearchReposTool_1 = __decorate([
|
|
100
|
+
(0, common_2.Tool)({
|
|
101
|
+
config: {
|
|
102
|
+
description: 'Searches for repositories on GitHub using the GitHub search syntax. Returns { error: "unauthorized" } if no valid token is available.',
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
], GitHubSearchReposTool);
|
|
106
|
+
//# sourceMappingURL=github-search-repos.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-search-repos.tool.js","sourceRoot":"","sources":["../../../src/tools/search/github-search-repos.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAenD,IAAM,qBAAqB,6BAA3B,MAAM,qBAAqB;IACf,MAAM,GAAG,IAAI,eAAM,CAAC,uBAAqB,CAAC,IAAI,CAAC,CAAC;IAGzD,UAAU,CAAkB;IAYpC,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,WAAW,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,cAAc;oBACrB,OAAO,EAAE,yDAAyD;iBACnE;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;YACjC,CAAC,EAAE,IAAI,CAAC,KAAK;YACb,QAAQ,EAAE,MAAM,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC;YACpC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC;SAC7B,CAAC,CAAC;QAEH,IAAI,IAAI,CAAC,IAAI;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,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ACtB,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,KAAK,EAAE,IAAI,CAAC,gBAAgB;YAC5B,KAAK,EAAE,IAAI,CAAC,WAAW;YACvB,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,UAAU,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,EAAE;SAChD,CAAC;IACJ,CAAC;CACF,CAAA;AAhGY,sDAAqB;AAIxB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;yDAAC;AAYpC;IAVC,IAAA,cAAK,EAAC;QACL,MAAM,EAAE,OAAC;aACN,MAAM,CAAC;YACN,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE;YACjB,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,SAAS,CAAC,CAAC,CAAC,QAAQ,EAAE;YAC5E,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;YAC/B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;SAC5B,CAAC;aACD,MAAM,EAAE;KACZ,CAAC;;mDAC0B;gCAhBjB,qBAAqB;IANjC,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,uIAAuI;SAC1I;KACF,CAAC;GACW,qBAAqB,CAgGjC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubGetAuthenticatedUserArgs = Record<string, never>;
|
|
3
|
+
export declare class GitHubGetAuthenticatedUserTool implements ToolInterface {
|
|
4
|
+
private readonly logger;
|
|
5
|
+
private tokenStore;
|
|
6
|
+
args: GitHubGetAuthenticatedUserArgs;
|
|
7
|
+
execute(_args: GitHubGetAuthenticatedUserArgs, ctx: RunContext): Promise<ToolResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=github-get-authenticated-user.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-authenticated-user.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/users/github-get-authenticated-user.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,8BAA8B,GAAG,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAEnE,qBAMa,8BAA+B,YAAW,aAAa;IAClE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmD;IAG1E,OAAO,CAAC,UAAU,CAAkB;IAKpC,IAAI,EAAE,8BAA8B,CAAC;IAE/B,OAAO,CAAC,KAAK,EAAE,8BAA8B,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAyE3F"}
|
|
@@ -0,0 +1,96 @@
|
|
|
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 GitHubGetAuthenticatedUserTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubGetAuthenticatedUserTool = 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 GitHubGetAuthenticatedUserTool = GitHubGetAuthenticatedUserTool_1 = class GitHubGetAuthenticatedUserTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubGetAuthenticatedUserTool_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 response = await fetch('https://api.github.com/user', {
|
|
33
|
+
headers: {
|
|
34
|
+
Authorization: `Bearer ${accessToken}`,
|
|
35
|
+
Accept: 'application/vnd.github+json',
|
|
36
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
if (response.status === 401 || response.status === 403) {
|
|
40
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
41
|
+
return {
|
|
42
|
+
data: {
|
|
43
|
+
error: '401',
|
|
44
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (!response.ok) {
|
|
49
|
+
const body = await response.text();
|
|
50
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
51
|
+
return {
|
|
52
|
+
data: {
|
|
53
|
+
error: 'api_error',
|
|
54
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
const user = (await response.json());
|
|
59
|
+
return {
|
|
60
|
+
data: {
|
|
61
|
+
user: {
|
|
62
|
+
id: user.id,
|
|
63
|
+
login: user.login,
|
|
64
|
+
name: user.name,
|
|
65
|
+
email: user.email,
|
|
66
|
+
avatarUrl: user.avatar_url,
|
|
67
|
+
htmlUrl: user.html_url,
|
|
68
|
+
bio: user.bio,
|
|
69
|
+
publicRepos: user.public_repos,
|
|
70
|
+
followers: user.followers,
|
|
71
|
+
following: user.following,
|
|
72
|
+
createdAt: user.created_at,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
exports.GitHubGetAuthenticatedUserTool = GitHubGetAuthenticatedUserTool;
|
|
79
|
+
__decorate([
|
|
80
|
+
(0, common_1.Inject)(),
|
|
81
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
82
|
+
], GitHubGetAuthenticatedUserTool.prototype, "tokenStore", void 0);
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, common_2.Input)({
|
|
85
|
+
schema: zod_1.z.object({}).strict(),
|
|
86
|
+
}),
|
|
87
|
+
__metadata("design:type", Object)
|
|
88
|
+
], GitHubGetAuthenticatedUserTool.prototype, "args", void 0);
|
|
89
|
+
exports.GitHubGetAuthenticatedUserTool = GitHubGetAuthenticatedUserTool = GitHubGetAuthenticatedUserTool_1 = __decorate([
|
|
90
|
+
(0, common_2.Tool)({
|
|
91
|
+
config: {
|
|
92
|
+
description: 'Gets the profile of the currently authenticated GitHub user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
93
|
+
},
|
|
94
|
+
})
|
|
95
|
+
], GitHubGetAuthenticatedUserTool);
|
|
96
|
+
//# sourceMappingURL=github-get-authenticated-user.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-authenticated-user.tool.js","sourceRoot":"","sources":["../../../src/tools/users/github-get-authenticated-user.tool.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AAC,MAAM,IAAI,IAAI,EAAE,CAAC,CAAC;YAClE,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,WAAW;oBAClB,OAAO,EAAE,qBAAqB,QAAQ,CAAC,UAAU,EAAE;iBACpD;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAYlC,CAAC;QAEF,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,SAAS,EAAE,IAAI,CAAC,UAAU;oBAC1B,OAAO,EAAE,IAAI,CAAC,QAAQ;oBACtB,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,WAAW,EAAE,IAAI,CAAC,YAAY;oBAC9B,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,SAAS,EAAE,IAAI,CAAC,SAAS;oBACzB,SAAS,EAAE,IAAI,CAAC,UAAU;iBAC3B;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AApFY,wEAA8B;AAIjC;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;kEAAC;AAKpC;IAHC,IAAA,cAAK,EAAC;QACL,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE;KAC9B,CAAC;;4DACmC;yCAT1B,8BAA8B;IAN1C,IAAA,aAAI,EAAC;QACJ,MAAM,EAAE;YACN,WAAW,EACT,gIAAgI;SACnI;KACF,CAAC;GACW,8BAA8B,CAoF1C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubListUserOrgsArgs = {
|
|
3
|
+
perPage?: number;
|
|
4
|
+
};
|
|
5
|
+
export declare class GitHubListUserOrgsTool implements ToolInterface {
|
|
6
|
+
private readonly logger;
|
|
7
|
+
private tokenStore;
|
|
8
|
+
args: GitHubListUserOrgsArgs;
|
|
9
|
+
execute(args: GitHubListUserOrgsArgs, ctx: RunContext): Promise<ToolResult>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=github-list-user-orgs.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-list-user-orgs.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/users/github-list-user-orgs.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,sBAAsB,GAAG;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,qBAMa,sBAAuB,YAAW,aAAa;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAGlE,OAAO,CAAC,UAAU,CAAkB;IASpC,IAAI,EAAE,sBAAsB,CAAC;IAEvB,OAAO,CAAC,IAAI,EAAE,sBAAsB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CA+DlF"}
|
|
@@ -0,0 +1,95 @@
|
|
|
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 GitHubListUserOrgsTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubListUserOrgsTool = 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 GitHubListUserOrgsTool = GitHubListUserOrgsTool_1 = class GitHubListUserOrgsTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubListUserOrgsTool_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
|
+
per_page: String(args.perPage ?? 30),
|
|
34
|
+
});
|
|
35
|
+
const response = await fetch(`https://api.github.com/user/orgs?${params.toString()}`, {
|
|
36
|
+
headers: {
|
|
37
|
+
Authorization: `Bearer ${accessToken}`,
|
|
38
|
+
Accept: 'application/vnd.github+json',
|
|
39
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
if (response.status === 401 || response.status === 403) {
|
|
43
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
44
|
+
return {
|
|
45
|
+
data: {
|
|
46
|
+
error: '401',
|
|
47
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
if (!response.ok) {
|
|
52
|
+
const body = await response.text();
|
|
53
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
54
|
+
return {
|
|
55
|
+
data: {
|
|
56
|
+
error: 'api_error',
|
|
57
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const data = (await response.json());
|
|
62
|
+
const orgs = data.map((org) => ({
|
|
63
|
+
id: org.id,
|
|
64
|
+
login: org.login,
|
|
65
|
+
description: org.description,
|
|
66
|
+
avatarUrl: org.avatar_url,
|
|
67
|
+
}));
|
|
68
|
+
return {
|
|
69
|
+
data: { orgs },
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
exports.GitHubListUserOrgsTool = GitHubListUserOrgsTool;
|
|
74
|
+
__decorate([
|
|
75
|
+
(0, common_1.Inject)(),
|
|
76
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
77
|
+
], GitHubListUserOrgsTool.prototype, "tokenStore", void 0);
|
|
78
|
+
__decorate([
|
|
79
|
+
(0, common_2.Input)({
|
|
80
|
+
schema: zod_1.z
|
|
81
|
+
.object({
|
|
82
|
+
perPage: zod_1.z.number().default(30),
|
|
83
|
+
})
|
|
84
|
+
.strict(),
|
|
85
|
+
}),
|
|
86
|
+
__metadata("design:type", Object)
|
|
87
|
+
], GitHubListUserOrgsTool.prototype, "args", void 0);
|
|
88
|
+
exports.GitHubListUserOrgsTool = GitHubListUserOrgsTool = GitHubListUserOrgsTool_1 = __decorate([
|
|
89
|
+
(0, common_2.Tool)({
|
|
90
|
+
config: {
|
|
91
|
+
description: 'Lists organizations for the authenticated GitHub user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
92
|
+
},
|
|
93
|
+
})
|
|
94
|
+
], GitHubListUserOrgsTool);
|
|
95
|
+
//# sourceMappingURL=github-list-user-orgs.tool.js.map
|
|
@@ -0,0 +1 @@
|
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