@loopstack/github-module 0.2.5 → 0.3.1
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/github-oauth.provider.js +9 -12
- package/dist/github-oauth.provider.js.map +1 -1
- package/dist/github.module.js +59 -62
- package/dist/github.module.js.map +1 -1
- package/dist/index.d.ts +27 -27
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +27 -43
- package/dist/index.js.map +1 -1
- package/dist/tools/actions/github-get-workflow-run.tool.js +17 -20
- package/dist/tools/actions/github-get-workflow-run.tool.js.map +1 -1
- package/dist/tools/actions/github-list-workflow-runs.tool.js +20 -23
- package/dist/tools/actions/github-list-workflow-runs.tool.js.map +1 -1
- package/dist/tools/actions/github-trigger-workflow.tool.js +19 -22
- package/dist/tools/actions/github-trigger-workflow.tool.js.map +1 -1
- package/dist/tools/content/github-create-or-update-file.tool.js +21 -24
- package/dist/tools/content/github-create-or-update-file.tool.js.map +1 -1
- package/dist/tools/content/github-get-commit.tool.js +17 -20
- package/dist/tools/content/github-get-commit.tool.js.map +1 -1
- package/dist/tools/content/github-get-file-content.tool.js +18 -21
- package/dist/tools/content/github-get-file-content.tool.js.map +1 -1
- package/dist/tools/content/github-list-directory.tool.js +18 -21
- package/dist/tools/content/github-list-directory.tool.js.map +1 -1
- package/dist/tools/issues/github-create-issue-comment.tool.js +18 -21
- package/dist/tools/issues/github-create-issue-comment.tool.js.map +1 -1
- package/dist/tools/issues/github-create-issue.tool.js +20 -23
- package/dist/tools/issues/github-create-issue.tool.js.map +1 -1
- package/dist/tools/issues/github-get-issue.tool.js +17 -20
- package/dist/tools/issues/github-get-issue.tool.js.map +1 -1
- package/dist/tools/issues/github-list-issues.tool.js +21 -24
- package/dist/tools/issues/github-list-issues.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-create-pull-request.tool.js +21 -24
- package/dist/tools/pull-requests/github-create-pull-request.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-get-pull-request.tool.js +17 -20
- package/dist/tools/pull-requests/github-get-pull-request.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js +17 -20
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js +20 -23
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js.map +1 -1
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js +20 -23
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js.map +1 -1
- package/dist/tools/repos/github-create-repo.tool.js +18 -21
- package/dist/tools/repos/github-create-repo.tool.js.map +1 -1
- package/dist/tools/repos/github-get-repo.tool.js +16 -19
- package/dist/tools/repos/github-get-repo.tool.js.map +1 -1
- package/dist/tools/repos/github-list-branches.tool.js +17 -20
- package/dist/tools/repos/github-list-branches.tool.js.map +1 -1
- package/dist/tools/repos/github-list-repos.tool.js +18 -21
- package/dist/tools/repos/github-list-repos.tool.js.map +1 -1
- package/dist/tools/search/github-search-code.tool.js +17 -20
- package/dist/tools/search/github-search-code.tool.js.map +1 -1
- package/dist/tools/search/github-search-issues.tool.js +18 -21
- package/dist/tools/search/github-search-issues.tool.js.map +1 -1
- package/dist/tools/search/github-search-repos.tool.js +18 -21
- package/dist/tools/search/github-search-repos.tool.js.map +1 -1
- package/dist/tools/users/github-get-authenticated-user.tool.js +14 -17
- package/dist/tools/users/github-get-authenticated-user.tool.js.map +1 -1
- package/dist/tools/users/github-list-user-orgs.tool.js +15 -18
- package/dist/tools/users/github-list-user-orgs.tool.js.map +1 -1
- package/package.json +8 -26
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,27 +8,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubListPullRequestsTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
owner:
|
|
21
|
-
repo:
|
|
22
|
-
state:
|
|
23
|
-
base:
|
|
24
|
-
perPage:
|
|
25
|
-
page:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
state: z.enum(['open', 'closed', 'all']).default('open'),
|
|
20
|
+
base: z.string().optional(),
|
|
21
|
+
perPage: z.number().default(30),
|
|
22
|
+
page: z.number().default(1),
|
|
26
23
|
})
|
|
27
24
|
.strict();
|
|
28
|
-
let GitHubListPullRequestsTool = GitHubListPullRequestsTool_1 = class GitHubListPullRequestsTool extends
|
|
29
|
-
logger = new
|
|
25
|
+
let GitHubListPullRequestsTool = GitHubListPullRequestsTool_1 = class GitHubListPullRequestsTool extends BaseTool {
|
|
26
|
+
logger = new Logger(GitHubListPullRequestsTool_1.name);
|
|
30
27
|
tokenStore;
|
|
31
28
|
async call(args) {
|
|
32
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
29
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
33
30
|
if (!accessToken) {
|
|
34
31
|
return {
|
|
35
32
|
data: {
|
|
@@ -54,7 +51,7 @@ let GitHubListPullRequestsTool = GitHubListPullRequestsTool_1 = class GitHubList
|
|
|
54
51
|
},
|
|
55
52
|
});
|
|
56
53
|
if (response.status === 401 || response.status === 403) {
|
|
57
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
54
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
58
55
|
return {
|
|
59
56
|
data: {
|
|
60
57
|
error: '401',
|
|
@@ -92,17 +89,17 @@ let GitHubListPullRequestsTool = GitHubListPullRequestsTool_1 = class GitHubList
|
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
};
|
|
95
|
-
exports.GitHubListPullRequestsTool = GitHubListPullRequestsTool;
|
|
96
92
|
__decorate([
|
|
97
|
-
|
|
98
|
-
__metadata("design:type",
|
|
93
|
+
Inject(),
|
|
94
|
+
__metadata("design:type", OAuthTokenStore)
|
|
99
95
|
], GitHubListPullRequestsTool.prototype, "tokenStore", void 0);
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
GitHubListPullRequestsTool = GitHubListPullRequestsTool_1 = __decorate([
|
|
97
|
+
Tool({
|
|
102
98
|
uiConfig: {
|
|
103
99
|
description: 'Lists pull requests for a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
104
100
|
},
|
|
105
101
|
schema: inputSchema,
|
|
106
102
|
})
|
|
107
103
|
], GitHubListPullRequestsTool);
|
|
104
|
+
export { GitHubListPullRequestsTool };
|
|
108
105
|
//# sourceMappingURL=github-list-pull-requests.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-pull-requests.tool.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/github-list-pull-requests.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-list-pull-requests.tool.js","sourceRoot":"","sources":["../../../src/tools/pull-requests/github-list-pull-requests.tool.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE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AAW;oBAClB,OAAO,EAAE,qBAAqB,QAAQ,CAAC,UAAU,EAAE;iBACpD;aACF,CAAC;QACJ,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAYjC,CAAC;QAEH,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YACrC,EAAE,EAAE,EAAE,CAAC,EAAE;YACT,MAAM,EAAE,EAAE,CAAC,MAAM;YACjB,KAAK,EAAE,EAAE,CAAC,KAAK;YACf,KAAK,EAAE,EAAE,CAAC,KAAK;YACf,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK;YACnB,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACjB,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACpB,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG;YACjB,SAAS,EAAE,EAAE,CAAC,UAAU;YACxB,SAAS,EAAE,EAAE,CAAC,UAAU;YACxB,OAAO,EAAE,EAAE,CAAC,QAAQ;YACpB,KAAK,EAAE,EAAE,CAAC,KAAK;SAChB,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,YAAY,EAAE;SACvB,CAAC;IACJ,CAAC;CACF,CAAA;AArFS;IADP,MAAM,EAAE;8BACW,eAAe;8DAAC;AAJzB,0BAA0B;IAPtC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,gHAAgH;SACnH;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,0BAA0B,CAyFtC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,27 +8,25 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubMergePullRequestTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
owner:
|
|
21
|
-
repo:
|
|
22
|
-
pullNumber:
|
|
23
|
-
mergeMethod:
|
|
24
|
-
commitTitle:
|
|
25
|
-
commitMessage:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
pullNumber: z.number(),
|
|
20
|
+
mergeMethod: z.enum(['merge', 'squash', 'rebase']).default('merge'),
|
|
21
|
+
commitTitle: z.string().optional(),
|
|
22
|
+
commitMessage: z.string().optional(),
|
|
26
23
|
})
|
|
27
24
|
.strict();
|
|
28
|
-
let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMergePullRequestTool extends
|
|
29
|
-
logger = new
|
|
25
|
+
let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMergePullRequestTool extends BaseTool {
|
|
26
|
+
logger = new Logger(GitHubMergePullRequestTool_1.name);
|
|
30
27
|
tokenStore;
|
|
31
28
|
async call(args) {
|
|
32
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
29
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
33
30
|
if (!accessToken) {
|
|
34
31
|
return {
|
|
35
32
|
data: {
|
|
@@ -57,7 +54,7 @@ let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMerg
|
|
|
57
54
|
body: JSON.stringify(requestBody),
|
|
58
55
|
});
|
|
59
56
|
if (response.status === 401 || response.status === 403) {
|
|
60
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
57
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
61
58
|
return {
|
|
62
59
|
data: {
|
|
63
60
|
error: '401',
|
|
@@ -87,17 +84,17 @@ let GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = class GitHubMerg
|
|
|
87
84
|
};
|
|
88
85
|
}
|
|
89
86
|
};
|
|
90
|
-
exports.GitHubMergePullRequestTool = GitHubMergePullRequestTool;
|
|
91
87
|
__decorate([
|
|
92
|
-
|
|
93
|
-
__metadata("design:type",
|
|
88
|
+
Inject(),
|
|
89
|
+
__metadata("design:type", OAuthTokenStore)
|
|
94
90
|
], GitHubMergePullRequestTool.prototype, "tokenStore", void 0);
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
GitHubMergePullRequestTool = GitHubMergePullRequestTool_1 = __decorate([
|
|
92
|
+
Tool({
|
|
97
93
|
uiConfig: {
|
|
98
94
|
description: 'Merges a GitHub pull request. Returns { error: "unauthorized" } if no valid token is available.',
|
|
99
95
|
},
|
|
100
96
|
schema: inputSchema,
|
|
101
97
|
})
|
|
102
98
|
], GitHubMergePullRequestTool);
|
|
99
|
+
export { GitHubMergePullRequestTool };
|
|
103
100
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"github-merge-pull-request.tool.js","sourceRoot":"","sources":["../../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C;YACvE,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,WAAW;oBAClB,OAAO,EAAE,qBAAqB,QAAQ,CAAC,UAAU,EAAE;iBACpD;aACF,CAAC;QACJ,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,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;AAtES;IADP,MAAM,EAAE;8BACW,eAAe;8DAAC;AAJzB,0BAA0B;IANtC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EAAE,iGAAiG;SAC/G;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,0BAA0B,CA0EtC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,25 +8,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubCreateRepoTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
name:
|
|
21
|
-
description:
|
|
22
|
-
private:
|
|
23
|
-
autoInit:
|
|
17
|
+
name: z.string(),
|
|
18
|
+
description: z.string().optional(),
|
|
19
|
+
private: z.boolean().default(false),
|
|
20
|
+
autoInit: z.boolean().default(false),
|
|
24
21
|
})
|
|
25
22
|
.strict();
|
|
26
|
-
let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool extends
|
|
27
|
-
logger = new
|
|
23
|
+
let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool extends BaseTool {
|
|
24
|
+
logger = new Logger(GitHubCreateRepoTool_1.name);
|
|
28
25
|
tokenStore;
|
|
29
26
|
async call(args) {
|
|
30
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
27
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
31
28
|
if (!accessToken) {
|
|
32
29
|
return {
|
|
33
30
|
data: {
|
|
@@ -54,7 +51,7 @@ let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool e
|
|
|
54
51
|
body: JSON.stringify(body),
|
|
55
52
|
});
|
|
56
53
|
if (response.status === 401 || response.status === 403) {
|
|
57
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
54
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
58
55
|
return {
|
|
59
56
|
data: {
|
|
60
57
|
error: '401',
|
|
@@ -87,17 +84,17 @@ let GitHubCreateRepoTool = GitHubCreateRepoTool_1 = class GitHubCreateRepoTool e
|
|
|
87
84
|
};
|
|
88
85
|
}
|
|
89
86
|
};
|
|
90
|
-
exports.GitHubCreateRepoTool = GitHubCreateRepoTool;
|
|
91
87
|
__decorate([
|
|
92
|
-
|
|
93
|
-
__metadata("design:type",
|
|
88
|
+
Inject(),
|
|
89
|
+
__metadata("design:type", OAuthTokenStore)
|
|
94
90
|
], GitHubCreateRepoTool.prototype, "tokenStore", void 0);
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
GitHubCreateRepoTool = GitHubCreateRepoTool_1 = __decorate([
|
|
92
|
+
Tool({
|
|
97
93
|
uiConfig: {
|
|
98
94
|
description: 'Creates a new GitHub repository for the authenticated user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
99
95
|
},
|
|
100
96
|
schema: inputSchema,
|
|
101
97
|
})
|
|
102
98
|
], GitHubCreateRepoTool);
|
|
99
|
+
export { GitHubCreateRepoTool };
|
|
103
100
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"github-create-repo.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-create-repo.tool.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAClC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACnC,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KA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AAa,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC;YAC3F,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,KAAK;oBACZ,OAAO,EAAE,oDAAoD;iBAC9D;aACF,CAAC;QACJ,CAAC;QAED,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,QAAQ,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;YACvE,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,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;AA5ES;IADP,MAAM,EAAE;8BACW,eAAe;wDAAC;AAJzB,oBAAoB;IAPhC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,+HAA+H;SAClI;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,oBAAoB,CAgFhC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,23 +8,21 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubGetRepoTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
owner:
|
|
21
|
-
repo:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
22
19
|
})
|
|
23
20
|
.strict();
|
|
24
|
-
let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool extends
|
|
25
|
-
logger = new
|
|
21
|
+
let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool extends BaseTool {
|
|
22
|
+
logger = new Logger(GitHubGetRepoTool_1.name);
|
|
26
23
|
tokenStore;
|
|
27
24
|
async call(args) {
|
|
28
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
25
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
29
26
|
if (!accessToken) {
|
|
30
27
|
return {
|
|
31
28
|
data: {
|
|
@@ -42,7 +39,7 @@ let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool extends co
|
|
|
42
39
|
},
|
|
43
40
|
});
|
|
44
41
|
if (response.status === 401 || response.status === 403) {
|
|
45
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
42
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
46
43
|
return {
|
|
47
44
|
data: {
|
|
48
45
|
error: '401',
|
|
@@ -86,17 +83,17 @@ let GitHubGetRepoTool = GitHubGetRepoTool_1 = class GitHubGetRepoTool extends co
|
|
|
86
83
|
};
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
|
-
exports.GitHubGetRepoTool = GitHubGetRepoTool;
|
|
90
86
|
__decorate([
|
|
91
|
-
|
|
92
|
-
__metadata("design:type",
|
|
87
|
+
Inject(),
|
|
88
|
+
__metadata("design:type", OAuthTokenStore)
|
|
93
89
|
], GitHubGetRepoTool.prototype, "tokenStore", void 0);
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
GitHubGetRepoTool = GitHubGetRepoTool_1 = __decorate([
|
|
91
|
+
Tool({
|
|
96
92
|
uiConfig: {
|
|
97
93
|
description: 'Gets detailed information about a specific GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
98
94
|
},
|
|
99
95
|
schema: inputSchema,
|
|
100
96
|
})
|
|
101
97
|
], GitHubGetRepoTool);
|
|
98
|
+
export { GitHubGetRepoTool };
|
|
102
99
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"github-get-repo.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-get-repo.tool.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAA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EAAE,IAAI,CAAC,OAAO,EAAE,OAAO,IAAI,IAAI;iBACvC;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAzFS;IADP,MAAM,EAAE;8BACW,eAAe;qDAAC;AAJzB,iBAAiB;IAP7B,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,iIAAiI;SACpI;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,iBAAiB,CA6F7B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,24 +8,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubListBranchesTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
owner:
|
|
21
|
-
repo:
|
|
22
|
-
perPage:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
perPage: z.number().default(30),
|
|
23
20
|
})
|
|
24
21
|
.strict();
|
|
25
|
-
let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranchesTool extends
|
|
26
|
-
logger = new
|
|
22
|
+
let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranchesTool extends BaseTool {
|
|
23
|
+
logger = new Logger(GitHubListBranchesTool_1.name);
|
|
27
24
|
tokenStore;
|
|
28
25
|
async call(args) {
|
|
29
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
26
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
30
27
|
if (!accessToken) {
|
|
31
28
|
return {
|
|
32
29
|
data: {
|
|
@@ -47,7 +44,7 @@ let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranches
|
|
|
47
44
|
},
|
|
48
45
|
});
|
|
49
46
|
if (response.status === 401 || response.status === 403) {
|
|
50
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
47
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
51
48
|
return {
|
|
52
49
|
data: {
|
|
53
50
|
error: '401',
|
|
@@ -76,17 +73,17 @@ let GitHubListBranchesTool = GitHubListBranchesTool_1 = class GitHubListBranches
|
|
|
76
73
|
};
|
|
77
74
|
}
|
|
78
75
|
};
|
|
79
|
-
exports.GitHubListBranchesTool = GitHubListBranchesTool;
|
|
80
76
|
__decorate([
|
|
81
|
-
|
|
82
|
-
__metadata("design:type",
|
|
77
|
+
Inject(),
|
|
78
|
+
__metadata("design:type", OAuthTokenStore)
|
|
83
79
|
], GitHubListBranchesTool.prototype, "tokenStore", void 0);
|
|
84
|
-
|
|
85
|
-
|
|
80
|
+
GitHubListBranchesTool = GitHubListBranchesTool_1 = __decorate([
|
|
81
|
+
Tool({
|
|
86
82
|
uiConfig: {
|
|
87
83
|
description: 'Lists branches for a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
88
84
|
},
|
|
89
85
|
schema: inputSchema,
|
|
90
86
|
})
|
|
91
87
|
], GitHubListBranchesTool);
|
|
88
|
+
export { GitHubListBranchesTool };
|
|
92
89
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"github-list-branches.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-list-branches.tool.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;CAChC,CAAC;KACD,MAAM,EAAE,CAAC;AAWL,IAAM,sBAAsB,8BAA5B,MAAM,sBAAuB,SAAQ,QAAQ;IACjC,MAAM,GAAG,IAAI,MAAM,CAAC,wBAAsB,CAAC,IAAI,CAAC,CAAC;IAG1D,UAAU,CAAkB;IAEpC,KAAK,CAAC,IAAI,CAAC,IAA4B;QACrC,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAE7F,IAAI,CAAC,WAAW,EAAE,CAAC;YACjB,OAAO;gBACL,IAAI,EAAE;oBACJ,KAAK,EAAE,cAAc;oBACrB,OAAO,EAAE,yDAAyD;iBACnE;aACF,CAAC;QACJ,CAAC;Q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CAAC;QAEH,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACrC,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG;YAC5B,SAAS,EAAE,MAAM,CAAC,WAAW,CAAC;SAC/B,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,QAAQ,EAAE;SACnB,CAAC;IACJ,CAAC;CACF,CAAA;AAhES;IADP,MAAM,EAAE;8BACW,eAAe;0DAAC;AAJzB,sBAAsB;IAPlC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,2GAA2G;SAC9G;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,sBAAsB,CAoElC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,25 +8,23 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubListReposTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
visibility:
|
|
21
|
-
sort:
|
|
22
|
-
perPage:
|
|
23
|
-
page:
|
|
17
|
+
visibility: z.enum(['all', 'public', 'private']).default('all'),
|
|
18
|
+
sort: z.enum(['created', 'updated', 'pushed', 'full_name']).default('updated'),
|
|
19
|
+
perPage: z.number().default(30),
|
|
20
|
+
page: z.number().default(1),
|
|
24
21
|
})
|
|
25
22
|
.strict();
|
|
26
|
-
let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool extends
|
|
27
|
-
logger = new
|
|
23
|
+
let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool extends BaseTool {
|
|
24
|
+
logger = new Logger(GitHubListReposTool_1.name);
|
|
28
25
|
tokenStore;
|
|
29
26
|
async call(args) {
|
|
30
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
27
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
31
28
|
if (!accessToken) {
|
|
32
29
|
return {
|
|
33
30
|
data: {
|
|
@@ -50,7 +47,7 @@ let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool exte
|
|
|
50
47
|
},
|
|
51
48
|
});
|
|
52
49
|
if (response.status === 401 || response.status === 403) {
|
|
53
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
50
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
54
51
|
return {
|
|
55
52
|
data: {
|
|
56
53
|
error: '401',
|
|
@@ -86,17 +83,17 @@ let GitHubListReposTool = GitHubListReposTool_1 = class GitHubListReposTool exte
|
|
|
86
83
|
};
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
|
-
exports.GitHubListReposTool = GitHubListReposTool;
|
|
90
86
|
__decorate([
|
|
91
|
-
|
|
92
|
-
__metadata("design:type",
|
|
87
|
+
Inject(),
|
|
88
|
+
__metadata("design:type", OAuthTokenStore)
|
|
93
89
|
], GitHubListReposTool.prototype, "tokenStore", void 0);
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
GitHubListReposTool = GitHubListReposTool_1 = __decorate([
|
|
91
|
+
Tool({
|
|
96
92
|
uiConfig: {
|
|
97
93
|
description: 'Lists repositories for the authenticated GitHub user. Returns { error: "unauthorized" } if no valid token is available.',
|
|
98
94
|
},
|
|
99
95
|
schema: inputSchema,
|
|
100
96
|
})
|
|
101
97
|
], GitHubListReposTool);
|
|
98
|
+
export { GitHubListReposTool };
|
|
102
99
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"github-list-repos.tool.js","sourceRoot":"","sources":["../../../src/tools/repos/github-list-repos.tool.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAc,MAAM,mBAAmB,CAAC;AAC/D,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,WAAW,GAAG,CAAC;KAClB,MAAM,CAAC;IACN,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAC/D,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9E,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC/B,IAAI,EAAE,CAAC,CAAC,MAAM,E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AAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,yHAAyH;SAC5H;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,mBAAmB,CAoF/B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
"use strict";
|
|
2
1
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
2
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
3
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -9,24 +8,22 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
9
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
9
|
};
|
|
11
10
|
var GitHubSearchCodeTool_1;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
17
|
-
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
-
const inputSchema = zod_1.z
|
|
11
|
+
import { Inject, Logger } from '@nestjs/common';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { BaseTool, Tool } from '@loopstack/common';
|
|
14
|
+
import { OAuthTokenStore } from '@loopstack/oauth-module';
|
|
15
|
+
const inputSchema = z
|
|
19
16
|
.object({
|
|
20
|
-
query:
|
|
21
|
-
perPage:
|
|
22
|
-
page:
|
|
17
|
+
query: z.string(),
|
|
18
|
+
perPage: z.number().default(30),
|
|
19
|
+
page: z.number().default(1),
|
|
23
20
|
})
|
|
24
21
|
.strict();
|
|
25
|
-
let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool extends
|
|
26
|
-
logger = new
|
|
22
|
+
let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool extends BaseTool {
|
|
23
|
+
logger = new Logger(GitHubSearchCodeTool_1.name);
|
|
27
24
|
tokenStore;
|
|
28
25
|
async call(args) {
|
|
29
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
26
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
30
27
|
if (!accessToken) {
|
|
31
28
|
return {
|
|
32
29
|
data: {
|
|
@@ -48,7 +45,7 @@ let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool e
|
|
|
48
45
|
},
|
|
49
46
|
});
|
|
50
47
|
if (response.status === 401 || response.status === 403) {
|
|
51
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
48
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
52
49
|
return {
|
|
53
50
|
data: {
|
|
54
51
|
error: '401',
|
|
@@ -79,17 +76,17 @@ let GitHubSearchCodeTool = GitHubSearchCodeTool_1 = class GitHubSearchCodeTool e
|
|
|
79
76
|
};
|
|
80
77
|
}
|
|
81
78
|
};
|
|
82
|
-
exports.GitHubSearchCodeTool = GitHubSearchCodeTool;
|
|
83
79
|
__decorate([
|
|
84
|
-
|
|
85
|
-
__metadata("design:type",
|
|
80
|
+
Inject(),
|
|
81
|
+
__metadata("design:type", OAuthTokenStore)
|
|
86
82
|
], GitHubSearchCodeTool.prototype, "tokenStore", void 0);
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
GitHubSearchCodeTool = GitHubSearchCodeTool_1 = __decorate([
|
|
84
|
+
Tool({
|
|
89
85
|
uiConfig: {
|
|
90
86
|
description: 'Searches for code across GitHub repositories using the GitHub search syntax. Returns { error: "unauthorized" } if no valid token is available.',
|
|
91
87
|
},
|
|
92
88
|
schema: inputSchema,
|
|
93
89
|
})
|
|
94
90
|
], GitHubSearchCodeTool);
|
|
91
|
+
export { GitHubSearchCodeTool };
|
|
95
92
|
//# sourceMappingURL=github-search-code.tool.js.map
|