@loopstack/github-module 0.1.0 → 0.2.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/dist/tools/actions/github-get-workflow-run.tool.d.ts +11 -9
- package/dist/tools/actions/github-get-workflow-run.tool.d.ts.map +1 -1
- package/dist/tools/actions/github-get-workflow-run.tool.js +13 -18
- package/dist/tools/actions/github-get-workflow-run.tool.js.map +1 -1
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts +29 -12
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts.map +1 -1
- package/dist/tools/actions/github-list-workflow-runs.tool.js +33 -38
- package/dist/tools/actions/github-list-workflow-runs.tool.js.map +1 -1
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts +13 -11
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts.map +1 -1
- package/dist/tools/actions/github-trigger-workflow.tool.js +15 -20
- package/dist/tools/actions/github-trigger-workflow.tool.js.map +1 -1
- package/dist/tools/content/github-create-or-update-file.tool.d.ts +15 -13
- package/dist/tools/content/github-create-or-update-file.tool.d.ts.map +1 -1
- package/dist/tools/content/github-create-or-update-file.tool.js +17 -22
- package/dist/tools/content/github-create-or-update-file.tool.js.map +1 -1
- package/dist/tools/content/github-get-commit.tool.d.ts +11 -9
- package/dist/tools/content/github-get-commit.tool.d.ts.map +1 -1
- package/dist/tools/content/github-get-commit.tool.js +13 -18
- package/dist/tools/content/github-get-commit.tool.js.map +1 -1
- package/dist/tools/content/github-get-file-content.tool.d.ts +12 -10
- package/dist/tools/content/github-get-file-content.tool.d.ts.map +1 -1
- package/dist/tools/content/github-get-file-content.tool.js +14 -19
- package/dist/tools/content/github-get-file-content.tool.js.map +1 -1
- package/dist/tools/content/github-list-directory.tool.d.ts +12 -10
- package/dist/tools/content/github-list-directory.tool.d.ts.map +1 -1
- package/dist/tools/content/github-list-directory.tool.js +14 -19
- package/dist/tools/content/github-list-directory.tool.js.map +1 -1
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts +12 -10
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts.map +1 -1
- package/dist/tools/issues/github-create-issue-comment.tool.js +14 -19
- package/dist/tools/issues/github-create-issue-comment.tool.js.map +1 -1
- package/dist/tools/issues/github-create-issue.tool.d.ts +14 -12
- package/dist/tools/issues/github-create-issue.tool.d.ts.map +1 -1
- package/dist/tools/issues/github-create-issue.tool.js +16 -21
- package/dist/tools/issues/github-create-issue.tool.js.map +1 -1
- package/dist/tools/issues/github-get-issue.tool.d.ts +11 -9
- package/dist/tools/issues/github-get-issue.tool.d.ts.map +1 -1
- package/dist/tools/issues/github-get-issue.tool.js +13 -18
- package/dist/tools/issues/github-get-issue.tool.js.map +1 -1
- package/dist/tools/issues/github-list-issues.tool.d.ts +19 -13
- package/dist/tools/issues/github-list-issues.tool.d.ts.map +1 -1
- package/dist/tools/issues/github-list-issues.tool.js +17 -22
- package/dist/tools/issues/github-list-issues.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts +15 -13
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts.map +1 -1
- package/dist/tools/pull-requests/github-create-pull-request.tool.js +17 -22
- package/dist/tools/pull-requests/github-create-pull-request.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts +11 -9
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts.map +1 -1
- package/dist/tools/pull-requests/github-get-pull-request.tool.js +13 -18
- package/dist/tools/pull-requests/github-get-pull-request.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts +11 -9
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts.map +1 -1
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js +13 -18
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts +18 -12
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts.map +1 -1
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js +16 -21
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts +18 -12
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts.map +1 -1
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js +16 -21
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js.map +1 -1
- package/dist/tools/repos/github-create-repo.tool.d.ts +12 -10
- package/dist/tools/repos/github-create-repo.tool.d.ts.map +1 -1
- package/dist/tools/repos/github-create-repo.tool.js +14 -19
- package/dist/tools/repos/github-create-repo.tool.js.map +1 -1
- package/dist/tools/repos/github-get-repo.tool.d.ts +10 -8
- package/dist/tools/repos/github-get-repo.tool.d.ts.map +1 -1
- package/dist/tools/repos/github-get-repo.tool.js +12 -17
- package/dist/tools/repos/github-get-repo.tool.js.map +1 -1
- package/dist/tools/repos/github-list-branches.tool.d.ts +11 -9
- package/dist/tools/repos/github-list-branches.tool.d.ts.map +1 -1
- package/dist/tools/repos/github-list-branches.tool.js +13 -18
- package/dist/tools/repos/github-list-branches.tool.js.map +1 -1
- package/dist/tools/repos/github-list-repos.tool.d.ts +21 -10
- package/dist/tools/repos/github-list-repos.tool.d.ts.map +1 -1
- package/dist/tools/repos/github-list-repos.tool.js +14 -19
- package/dist/tools/repos/github-list-repos.tool.js.map +1 -1
- package/dist/tools/search/github-search-code.tool.d.ts +11 -9
- package/dist/tools/search/github-search-code.tool.d.ts.map +1 -1
- package/dist/tools/search/github-search-code.tool.js +13 -18
- package/dist/tools/search/github-search-code.tool.js.map +1 -1
- package/dist/tools/search/github-search-issues.tool.d.ts +20 -10
- package/dist/tools/search/github-search-issues.tool.d.ts.map +1 -1
- package/dist/tools/search/github-search-issues.tool.js +16 -21
- package/dist/tools/search/github-search-issues.tool.js.map +1 -1
- package/dist/tools/search/github-search-repos.tool.d.ts +17 -10
- package/dist/tools/search/github-search-repos.tool.d.ts.map +1 -1
- package/dist/tools/search/github-search-repos.tool.js +14 -19
- package/dist/tools/search/github-search-repos.tool.js.map +1 -1
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts +7 -5
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts.map +1 -1
- package/dist/tools/users/github-get-authenticated-user.tool.js +7 -12
- package/dist/tools/users/github-get-authenticated-user.tool.js.map +1 -1
- package/dist/tools/users/github-list-user-orgs.tool.d.ts +9 -7
- package/dist/tools/users/github-list-user-orgs.tool.d.ts.map +1 -1
- package/dist/tools/users/github-list-user-orgs.tool.js +11 -16
- package/dist/tools/users/github-list-user-orgs.tool.js.map +1 -1
- package/package.json +2 -2
- package/src/tools/actions/github-get-workflow-run.tool.ts +16 -22
- package/src/tools/actions/github-list-workflow-runs.tool.ts +36 -45
- package/src/tools/actions/github-trigger-workflow.tool.ts +18 -26
- package/src/tools/content/github-create-or-update-file.tool.ts +20 -30
- package/src/tools/content/github-get-commit.tool.ts +16 -22
- package/src/tools/content/github-get-file-content.tool.ts +17 -24
- package/src/tools/content/github-list-directory.tool.ts +17 -24
- package/src/tools/issues/github-create-issue-comment.tool.ts +17 -24
- package/src/tools/issues/github-create-issue.tool.ts +19 -28
- package/src/tools/issues/github-get-issue.tool.ts +16 -22
- package/src/tools/issues/github-list-issues.tool.ts +20 -30
- package/src/tools/pull-requests/github-create-pull-request.tool.ts +20 -30
- package/src/tools/pull-requests/github-get-pull-request.tool.ts +16 -22
- package/src/tools/pull-requests/github-list-pr-reviews.tool.ts +16 -22
- package/src/tools/pull-requests/github-list-pull-requests.tool.ts +19 -28
- package/src/tools/pull-requests/github-merge-pull-request.tool.ts +19 -28
- package/src/tools/repos/github-create-repo.tool.ts +17 -24
- package/src/tools/repos/github-get-repo.tool.ts +15 -20
- package/src/tools/repos/github-list-branches.tool.ts +16 -22
- package/src/tools/repos/github-list-repos.tool.ts +17 -24
- package/src/tools/search/github-search-code.tool.ts +16 -22
- package/src/tools/search/github-search-issues.tool.ts +19 -26
- package/src/tools/search/github-search-repos.tool.ts +17 -24
- package/src/tools/users/github-get-authenticated-user.tool.ts +10 -12
- package/src/tools/users/github-list-user-orgs.tool.ts +14 -18
|
@@ -15,12 +15,21 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
owner: zod_1.z.string(),
|
|
21
|
+
repo: zod_1.z.string(),
|
|
22
|
+
pullNumber: zod_1.z.number(),
|
|
23
|
+
mergeMethod: zod_1.z.enum(['merge', 'squash', 'rebase']).default('merge'),
|
|
24
|
+
commitTitle: zod_1.z.string().optional(),
|
|
25
|
+
commitMessage: zod_1.z.string().optional(),
|
|
26
|
+
})
|
|
27
|
+
.strict();
|
|
28
|
+
let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMergePullRequestTool extends common_2.BaseTool {
|
|
19
29
|
logger = new common_1.Logger(GitHubMergePullRequestTool_1.name);
|
|
20
30
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
31
|
+
async call(args) {
|
|
32
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
33
|
if (!accessToken) {
|
|
25
34
|
return {
|
|
26
35
|
data: {
|
|
@@ -48,7 +57,7 @@ let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMerg
|
|
|
48
57
|
body: JSON.stringify(requestBody),
|
|
49
58
|
});
|
|
50
59
|
if (response.status === 401 || response.status === 403) {
|
|
51
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
60
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
52
61
|
return {
|
|
53
62
|
data: {
|
|
54
63
|
error: '401',
|
|
@@ -83,26 +92,12 @@ __decorate([
|
|
|
83
92
|
(0, common_1.Inject)(),
|
|
84
93
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
85
94
|
], GitHubMergePullRequestTool.prototype, "tokenStore", void 0);
|
|
86
|
-
__decorate([
|
|
87
|
-
(0, common_2.Input)({
|
|
88
|
-
schema: zod_1.z
|
|
89
|
-
.object({
|
|
90
|
-
owner: zod_1.z.string(),
|
|
91
|
-
repo: zod_1.z.string(),
|
|
92
|
-
pullNumber: zod_1.z.number(),
|
|
93
|
-
mergeMethod: zod_1.z.enum(['merge', 'squash', 'rebase']).default('merge'),
|
|
94
|
-
commitTitle: zod_1.z.string().optional(),
|
|
95
|
-
commitMessage: zod_1.z.string().optional(),
|
|
96
|
-
})
|
|
97
|
-
.strict(),
|
|
98
|
-
}),
|
|
99
|
-
__metadata("design:type", Object)
|
|
100
|
-
], GitHubMergePullRequestTool.prototype, "args", void 0);
|
|
101
95
|
exports.GitHubMergePullRequestTool = GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = __decorate([
|
|
102
96
|
(0, common_2.Tool)({
|
|
103
|
-
|
|
97
|
+
uiConfig: {
|
|
104
98
|
description: 'Merges a GitHub pull request. Returns { error: "unauthorized" } if no valid token is available.',
|
|
105
99
|
},
|
|
100
|
+
schema: inputSchema,
|
|
106
101
|
})
|
|
107
102
|
], GitHubMergePullRequestTool);
|
|
108
103
|
//# sourceMappingURL=github-merge-pull-request.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-merge-pull-request.tool.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/github-merge-pull-request.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"github-merge-pull-request.tool.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/github-merge-pull-request.tool.ts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EAAE,CAIpC,CAAC;QAEF,OAAO;YACL,IAAI,EAAE;gBACJ,KAAK,EAAE;oBACL,GAAG,EAAE,MAAM,CAAC,GAAG;oBACf,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;iBACxB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1EY,gEAA0B;AAI7B;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;8DAAC;qCAJzB,0BAA0B;IANtC,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EAAE,iGAAiG;SAC/G;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,0BAA0B,CA0EtC"}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
name: z.ZodString;
|
|
5
|
+
description: z.ZodOptional<z.ZodString>;
|
|
6
|
+
private: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
autoInit: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
+
}, z.core.$strict>;
|
|
9
|
+
export type GitHubCreateRepoArgs = z.input<typeof inputSchema>;
|
|
10
|
+
export declare class GitHubCreateRepoTool extends BaseTool {
|
|
9
11
|
private readonly logger;
|
|
10
12
|
private tokenStore;
|
|
11
|
-
args: GitHubCreateRepoArgs
|
|
12
|
-
execute(args: GitHubCreateRepoArgs, ctx: RunContext): Promise<ToolResult>;
|
|
13
|
+
call(args: GitHubCreateRepoArgs): Promise<ToolResult>;
|
|
13
14
|
}
|
|
15
|
+
export {};
|
|
14
16
|
//# sourceMappingURL=github-create-repo.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-create-repo.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-create-repo.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-create-repo.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-create-repo.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,QAAA,MAAM,WAAW;;;;;kBAON,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE/D,qBAOa,oBAAqB,SAAQ,QAAQ;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAGhE,OAAO,CAAC,UAAU,CAAkB;IAE9B,IAAI,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;CA0E5D"}
|
|
@@ -15,12 +15,19 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
name: zod_1.z.string(),
|
|
21
|
+
description: zod_1.z.string().optional(),
|
|
22
|
+
private: zod_1.z.boolean().default(false),
|
|
23
|
+
autoInit: zod_1.z.boolean().default(false),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool extends common_2.BaseTool {
|
|
19
27
|
logger = new common_1.Logger(GitHubCreateRepoTool_1.name);
|
|
20
28
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
29
|
+
async call(args) {
|
|
30
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
31
|
if (!accessToken) {
|
|
25
32
|
return {
|
|
26
33
|
data: {
|
|
@@ -47,7 +54,7 @@ let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool {
|
|
|
47
54
|
body: JSON.stringify(body),
|
|
48
55
|
});
|
|
49
56
|
if (response.status === 401 || response.status === 403) {
|
|
50
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
57
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
51
58
|
return {
|
|
52
59
|
data: {
|
|
53
60
|
error: '401',
|
|
@@ -85,24 +92,12 @@ __decorate([
|
|
|
85
92
|
(0, common_1.Inject)(),
|
|
86
93
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
87
94
|
], GitHubCreateRepoTool.prototype, "tokenStore", void 0);
|
|
88
|
-
__decorate([
|
|
89
|
-
(0, common_2.Input)({
|
|
90
|
-
schema: zod_1.z
|
|
91
|
-
.object({
|
|
92
|
-
name: zod_1.z.string(),
|
|
93
|
-
description: zod_1.z.string().optional(),
|
|
94
|
-
private: zod_1.z.boolean().default(false),
|
|
95
|
-
autoInit: zod_1.z.boolean().default(false),
|
|
96
|
-
})
|
|
97
|
-
.strict(),
|
|
98
|
-
}),
|
|
99
|
-
__metadata("design:type", Object)
|
|
100
|
-
], GitHubCreateRepoTool.prototype, "args", void 0);
|
|
101
95
|
exports.GitHubCreateRepoTool = GitHubCreateRepoTool = GitHubCreateRepoTool_1 = __decorate([
|
|
102
96
|
(0, common_2.Tool)({
|
|
103
|
-
|
|
97
|
+
uiConfig: {
|
|
104
98
|
description: 'Creates a new GitHub repository for the authenticated user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
105
99
|
},
|
|
100
|
+
schema: inputSchema,
|
|
106
101
|
})
|
|
107
102
|
], GitHubCreateRepoTool);
|
|
108
103
|
//# sourceMappingURL=github-create-repo.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-create-repo.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-create-repo.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"github-create-repo.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-create-repo.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAA+D;AAC/D,0DAA0D;AAE1D,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,QAAQ,EAAE,OAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;CACrC,CAAC;KACD,MAAM,EAAE,CAAC;AAWL,IAAM,oBAAoB,4BAA1B,MAAM,oBAAqB,SAAQ,iBAAQ;IAC/B,MAAM,GAAG,IAAI,eAAM,CAAC,sBAAoB,CAAC,IAAI,CAAC,CAAC;IAGxD,UAAU,CAAkB;IAEpC,KAAK,CAAC,IAAI,CAAC,IAA0B;QACnC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEjG,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,IAAI,GAA4B;YACpC,IAAI,EAAE,IAAI,CAAC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CAAC,IAAI,EAAE,CAOlC,CAAC;QAEF,OAAO;YACL,IAAI,EAAE;gBACJ,IAAI,EAAE;oBACJ,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,QAAQ,EAAE,IAAI,CAAC,SAAS;oBACxB,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO,EAAE,IAAI,CAAC,QAAQ;oBACtB,OAAO,EAAE,IAAI,CAAC,OAAO;oBACrB,aAAa,EAAE,IAAI,CAAC,cAAc;iBACnC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAhFY,oDAAoB;AAIvB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;wDAAC;+BAJzB,oBAAoB;IAPhC,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,+HAA+H;SAClI;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,oBAAoB,CAgFhC"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
owner: z.ZodString;
|
|
5
|
+
repo: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type GitHubGetRepoArgs = z.infer<typeof inputSchema>;
|
|
8
|
+
export declare class GitHubGetRepoTool extends BaseTool {
|
|
7
9
|
private readonly logger;
|
|
8
10
|
private tokenStore;
|
|
9
|
-
args: GitHubGetRepoArgs
|
|
10
|
-
execute(args: GitHubGetRepoArgs, ctx: RunContext): Promise<ToolResult>;
|
|
11
|
+
call(args: GitHubGetRepoArgs): Promise<ToolResult>;
|
|
11
12
|
}
|
|
13
|
+
export {};
|
|
12
14
|
//# sourceMappingURL=github-get-repo.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-get-repo.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-get-repo.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-get-repo.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-get-repo.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,QAAA,MAAM,WAAW;;;kBAKN,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE5D,qBAOa,iBAAkB,SAAQ,QAAQ;IAC7C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAsC;IAG7D,OAAO,CAAC,UAAU,CAAkB;IAE9B,IAAI,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;CAuFzD"}
|
|
@@ -15,12 +15,17 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
owner: zod_1.z.string(),
|
|
21
|
+
repo: zod_1.z.string(),
|
|
22
|
+
})
|
|
23
|
+
.strict();
|
|
24
|
+
let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool extends common_2.BaseTool {
|
|
19
25
|
logger = new common_1.Logger(GitHubGetRepoTool_1.name);
|
|
20
26
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
27
|
+
async call(args) {
|
|
28
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
29
|
if (!accessToken) {
|
|
25
30
|
return {
|
|
26
31
|
data: {
|
|
@@ -37,7 +42,7 @@ let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool {
|
|
|
37
42
|
},
|
|
38
43
|
});
|
|
39
44
|
if (response.status === 401 || response.status === 403) {
|
|
40
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
45
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
41
46
|
return {
|
|
42
47
|
data: {
|
|
43
48
|
error: '401',
|
|
@@ -86,22 +91,12 @@ __decorate([
|
|
|
86
91
|
(0, common_1.Inject)(),
|
|
87
92
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
88
93
|
], GitHubGetRepoTool.prototype, "tokenStore", void 0);
|
|
89
|
-
__decorate([
|
|
90
|
-
(0, common_2.Input)({
|
|
91
|
-
schema: zod_1.z
|
|
92
|
-
.object({
|
|
93
|
-
owner: zod_1.z.string(),
|
|
94
|
-
repo: zod_1.z.string(),
|
|
95
|
-
})
|
|
96
|
-
.strict(),
|
|
97
|
-
}),
|
|
98
|
-
__metadata("design:type", Object)
|
|
99
|
-
], GitHubGetRepoTool.prototype, "args", void 0);
|
|
100
94
|
exports.GitHubGetRepoTool = GitHubGetRepoTool = GitHubGetRepoTool_1 = __decorate([
|
|
101
95
|
(0, common_2.Tool)({
|
|
102
|
-
|
|
96
|
+
uiConfig: {
|
|
103
97
|
description: 'Gets detailed information about a specific GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
104
98
|
},
|
|
99
|
+
schema: inputSchema,
|
|
105
100
|
})
|
|
106
101
|
], GitHubGetRepoTool);
|
|
107
102
|
//# sourceMappingURL=github-get-repo.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-get-repo.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-get-repo.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA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S,EAAE,IAAI,CAAC,UAAU;oBAC1B,SAAS,EAAE,IAAI,CAAC,UAAU;oBAC1B,MAAM,EAAE,IAAI,CAAC,MAAM;oBACnB,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI;iBACvC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7FY,8CAAiB;AAIpB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;qDAAC;4BAJzB,iBAAiB;IAP7B,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,iIAAiI;SACpI;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,iBAAiB,CA6F7B"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
owner: z.ZodString;
|
|
5
|
+
repo: z.ZodString;
|
|
6
|
+
perPage: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type GitHubListBranchesArgs = z.input<typeof inputSchema>;
|
|
9
|
+
export declare class GitHubListBranchesTool extends BaseTool {
|
|
8
10
|
private readonly logger;
|
|
9
11
|
private tokenStore;
|
|
10
|
-
args: GitHubListBranchesArgs
|
|
11
|
-
execute(args: GitHubListBranchesArgs, ctx: RunContext): Promise<ToolResult>;
|
|
12
|
+
call(args: GitHubListBranchesArgs): Promise<ToolResult>;
|
|
12
13
|
}
|
|
14
|
+
export {};
|
|
13
15
|
//# sourceMappingURL=github-list-branches.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-branches.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-list-branches.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-list-branches.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-list-branches.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,QAAA,MAAM,WAAW;;;;kBAMN,CAAC;AAEZ,MAAM,MAAM,sBAAsB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAEjE,qBAOa,sBAAuB,SAAQ,QAAQ;IAClD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA2C;IAGlE,OAAO,CAAC,UAAU,CAAkB;IAE9B,IAAI,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,UAAU,CAAC;CA8D9D"}
|
|
@@ -15,12 +15,18 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
owner: zod_1.z.string(),
|
|
21
|
+
repo: zod_1.z.string(),
|
|
22
|
+
perPage: zod_1.z.number().default(30),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranchesTool extends common_2.BaseTool {
|
|
19
26
|
logger = new common_1.Logger(GitHubListBranchesTool_1.name);
|
|
20
27
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
28
|
+
async call(args) {
|
|
29
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
30
|
if (!accessToken) {
|
|
25
31
|
return {
|
|
26
32
|
data: {
|
|
@@ -41,7 +47,7 @@ let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranches
|
|
|
41
47
|
},
|
|
42
48
|
});
|
|
43
49
|
if (response.status === 401 || response.status === 403) {
|
|
44
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
50
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
45
51
|
return {
|
|
46
52
|
data: {
|
|
47
53
|
error: '401',
|
|
@@ -75,23 +81,12 @@ __decorate([
|
|
|
75
81
|
(0, common_1.Inject)(),
|
|
76
82
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
77
83
|
], GitHubListBranchesTool.prototype, "tokenStore", void 0);
|
|
78
|
-
__decorate([
|
|
79
|
-
(0, common_2.Input)({
|
|
80
|
-
schema: zod_1.z
|
|
81
|
-
.object({
|
|
82
|
-
owner: zod_1.z.string(),
|
|
83
|
-
repo: zod_1.z.string(),
|
|
84
|
-
perPage: zod_1.z.number().default(30),
|
|
85
|
-
})
|
|
86
|
-
.strict(),
|
|
87
|
-
}),
|
|
88
|
-
__metadata("design:type", Object)
|
|
89
|
-
], GitHubListBranchesTool.prototype, "args", void 0);
|
|
90
84
|
exports.GitHubListBranchesTool = GitHubListBranchesTool = GitHubListBranchesTool_1 = __decorate([
|
|
91
85
|
(0, common_2.Tool)({
|
|
92
|
-
|
|
86
|
+
uiConfig: {
|
|
93
87
|
description: 'Lists branches for a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
94
88
|
},
|
|
89
|
+
schema: inputSchema,
|
|
95
90
|
})
|
|
96
91
|
], GitHubListBranchesTool);
|
|
97
92
|
//# sourceMappingURL=github-list-branches.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-branches.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-list-branches.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB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IzB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;0DAAC;iCAJzB,sBAAsB;IAPlC,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,2GAA2G;SAC9G;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,sBAAsB,CAoElC"}
|
|
@@ -1,14 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
visibility: z.ZodDefault<z.ZodEnum<{
|
|
5
|
+
all: "all";
|
|
6
|
+
private: "private";
|
|
7
|
+
public: "public";
|
|
8
|
+
}>>;
|
|
9
|
+
sort: z.ZodDefault<z.ZodEnum<{
|
|
10
|
+
created: "created";
|
|
11
|
+
updated: "updated";
|
|
12
|
+
pushed: "pushed";
|
|
13
|
+
full_name: "full_name";
|
|
14
|
+
}>>;
|
|
15
|
+
perPage: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
}, z.core.$strict>;
|
|
18
|
+
export type GitHubListReposArgs = z.input<typeof inputSchema>;
|
|
19
|
+
export declare class GitHubListReposTool extends BaseTool {
|
|
9
20
|
private readonly logger;
|
|
10
21
|
private tokenStore;
|
|
11
|
-
args: GitHubListReposArgs
|
|
12
|
-
execute(args: GitHubListReposArgs, ctx: RunContext): Promise<ToolResult>;
|
|
22
|
+
call(args: GitHubListReposArgs): Promise<ToolResult>;
|
|
13
23
|
}
|
|
24
|
+
export {};
|
|
14
25
|
//# sourceMappingURL=github-list-repos.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-repos.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-list-repos.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-list-repos.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/repos/github-list-repos.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,QAAA,MAAM,WAAW;;;;;;;;;;;;;;kBAON,CAAC;AAEZ,MAAM,MAAM,mBAAmB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE9D,qBAOa,mBAAoB,SAAQ,QAAQ;IAC/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAG/D,OAAO,CAAC,UAAU,CAAkB;IAE9B,IAAI,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,UAAU,CAAC;CA8E3D"}
|
|
@@ -15,12 +15,19 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
visibility: zod_1.z.enum(['all', 'public', 'private']).default('all'),
|
|
21
|
+
sort: zod_1.z.enum(['created', 'updated', 'pushed', 'full_name']).default('updated'),
|
|
22
|
+
perPage: zod_1.z.number().default(30),
|
|
23
|
+
page: zod_1.z.number().default(1),
|
|
24
|
+
})
|
|
25
|
+
.strict();
|
|
26
|
+
let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool extends common_2.BaseTool {
|
|
19
27
|
logger = new common_1.Logger(GitHubListReposTool_1.name);
|
|
20
28
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
29
|
+
async call(args) {
|
|
30
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
31
|
if (!accessToken) {
|
|
25
32
|
return {
|
|
26
33
|
data: {
|
|
@@ -43,7 +50,7 @@ let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool {
|
|
|
43
50
|
},
|
|
44
51
|
});
|
|
45
52
|
if (response.status === 401 || response.status === 403) {
|
|
46
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
53
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
47
54
|
return {
|
|
48
55
|
data: {
|
|
49
56
|
error: '401',
|
|
@@ -84,24 +91,12 @@ __decorate([
|
|
|
84
91
|
(0, common_1.Inject)(),
|
|
85
92
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
86
93
|
], GitHubListReposTool.prototype, "tokenStore", void 0);
|
|
87
|
-
__decorate([
|
|
88
|
-
(0, common_2.Input)({
|
|
89
|
-
schema: zod_1.z
|
|
90
|
-
.object({
|
|
91
|
-
visibility: zod_1.z.enum(['all', 'public', 'private']).default('all'),
|
|
92
|
-
sort: zod_1.z.enum(['created', 'updated', 'pushed', 'full_name']).default('updated'),
|
|
93
|
-
perPage: zod_1.z.number().default(30),
|
|
94
|
-
page: zod_1.z.number().default(1),
|
|
95
|
-
})
|
|
96
|
-
.strict(),
|
|
97
|
-
}),
|
|
98
|
-
__metadata("design:type", Object)
|
|
99
|
-
], GitHubListReposTool.prototype, "args", void 0);
|
|
100
94
|
exports.GitHubListReposTool = GitHubListReposTool = GitHubListReposTool_1 = __decorate([
|
|
101
95
|
(0, common_2.Tool)({
|
|
102
|
-
|
|
96
|
+
uiConfig: {
|
|
103
97
|
description: 'Lists repositories for the authenticated GitHub user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
104
98
|
},
|
|
99
|
+
schema: inputSchema,
|
|
105
100
|
})
|
|
106
101
|
], GitHubListReposTool);
|
|
107
102
|
//# sourceMappingURL=github-list-repos.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-repos.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-list-repos.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"github-list-repos.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-list-repos.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAA+D;AAC/D,0DAA0D;AAE1D,MAAM,WAAW,GAAG,OAAC;KAClB,MAAM,CAAC;IACN,UAAU,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/D,IAAI,EAAE,OAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9E,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;CAC5B,CAAC;KACD,MAAM,EAAE,CAAC;AAWL,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,iBAAQ;IAC9B,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAGvD,UAAU,CAAkB;IAEpC,KAAK,CAAC,IAAI,CAAC,IAAyB;QAClC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAEjG,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EA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qB,QAAQ,CAAC,UAAU,EAAE;iBACpD;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAWjC,CAAC;QAEH,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAChC,EAAE,EAAE,IAAI,CAAC,EAAE;YACX,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK;YACvB,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,aAAa,EAAE,IAAI,CAAC,cAAc;YAClC,SAAS,EAAE,IAAI,CAAC,UAAU;SAC3B,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,KAAK,EAAE;SAChB,CAAC;IACJ,CAAC;CACF,CAAA;AApFY,kDAAmB;AAItB;IADP,IAAA,eAAM,GAAE;8BACW,8BAAe;uDAAC;8BAJzB,mBAAmB;IAP/B,IAAA,aAAI,EAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,yHAAyH;SAC5H;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,mBAAmB,CAoF/B"}
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { BaseTool, ToolResult } from '@loopstack/common';
|
|
3
|
+
declare const inputSchema: z.ZodObject<{
|
|
4
|
+
query: z.ZodString;
|
|
5
|
+
perPage: z.ZodDefault<z.ZodNumber>;
|
|
6
|
+
page: z.ZodDefault<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
export type GitHubSearchCodeArgs = z.input<typeof inputSchema>;
|
|
9
|
+
export declare class GitHubSearchCodeTool extends BaseTool {
|
|
8
10
|
private readonly logger;
|
|
9
11
|
private tokenStore;
|
|
10
|
-
args: GitHubSearchCodeArgs
|
|
11
|
-
execute(args: GitHubSearchCodeArgs, ctx: RunContext): Promise<ToolResult>;
|
|
12
|
+
call(args: GitHubSearchCodeArgs): Promise<ToolResult>;
|
|
12
13
|
}
|
|
14
|
+
export {};
|
|
13
15
|
//# sourceMappingURL=github-search-code.tool.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-search-code.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/github-search-code.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-search-code.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/search/github-search-code.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAQ,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAG/D,QAAA,MAAM,WAAW;;;;kBAMN,CAAC;AAEZ,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC;AAE/D,qBAOa,oBAAqB,SAAQ,QAAQ;IAChD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAGhE,OAAO,CAAC,UAAU,CAAkB;IAE9B,IAAI,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;CAsE5D"}
|
|
@@ -15,12 +15,18 @@ const common_1 = require("@nestjs/common");
|
|
|
15
15
|
const zod_1 = require("zod");
|
|
16
16
|
const common_2 = require("@loopstack/common");
|
|
17
17
|
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
|
|
18
|
+
const inputSchema = zod_1.z
|
|
19
|
+
.object({
|
|
20
|
+
query: zod_1.z.string(),
|
|
21
|
+
perPage: zod_1.z.number().default(30),
|
|
22
|
+
page: zod_1.z.number().default(1),
|
|
23
|
+
})
|
|
24
|
+
.strict();
|
|
25
|
+
let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool extends common_2.BaseTool {
|
|
19
26
|
logger = new common_1.Logger(GitHubSearchCodeTool_1.name);
|
|
20
27
|
tokenStore;
|
|
21
|
-
args
|
|
22
|
-
|
|
23
|
-
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
28
|
+
async call(args) {
|
|
29
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.context.userId, 'github');
|
|
24
30
|
if (!accessToken) {
|
|
25
31
|
return {
|
|
26
32
|
data: {
|
|
@@ -42,7 +48,7 @@ let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool {
|
|
|
42
48
|
},
|
|
43
49
|
});
|
|
44
50
|
if (response.status === 401 || response.status === 403) {
|
|
45
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
51
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.context.userId}`);
|
|
46
52
|
return {
|
|
47
53
|
data: {
|
|
48
54
|
error: '401',
|
|
@@ -78,23 +84,12 @@ __decorate([
|
|
|
78
84
|
(0, common_1.Inject)(),
|
|
79
85
|
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
80
86
|
], 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
87
|
exports.GitHubSearchCodeTool = GitHubSearchCodeTool = GitHubSearchCodeTool_1 = __decorate([
|
|
94
88
|
(0, common_2.Tool)({
|
|
95
|
-
|
|
89
|
+
uiConfig: {
|
|
96
90
|
description: 'Searches for code across GitHub repositories using the GitHub search syntax. Returns { error: "unauthorized" } if no valid token is available.',
|
|
97
91
|
},
|
|
92
|
+
schema: inputSchema,
|
|
98
93
|
})
|
|
99
94
|
], GitHubSearchCodeTool);
|
|
100
95
|
//# sourceMappingURL=github-search-code.tool.js.map
|