@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,26 +8,24 @@ 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 GitHubTriggerWorkflowTool_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
|
-
workflowId:
|
|
23
|
-
ref:
|
|
24
|
-
inputs:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
workflowId: z.string(),
|
|
20
|
+
ref: z.string(),
|
|
21
|
+
inputs: z.record(z.string(), z.string()).optional(),
|
|
25
22
|
})
|
|
26
23
|
.strict();
|
|
27
|
-
let GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool_1 = class GitHubTriggerWorkflowTool extends
|
|
28
|
-
logger = new
|
|
24
|
+
let GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool_1 = class GitHubTriggerWorkflowTool extends BaseTool {
|
|
25
|
+
logger = new Logger(GitHubTriggerWorkflowTool_1.name);
|
|
29
26
|
tokenStore;
|
|
30
27
|
async call(args) {
|
|
31
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
28
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
32
29
|
if (!accessToken) {
|
|
33
30
|
return {
|
|
34
31
|
data: {
|
|
@@ -54,7 +51,7 @@ let GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool_1 = class GitHubTrigge
|
|
|
54
51
|
body: JSON.stringify(requestBody),
|
|
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',
|
|
@@ -80,17 +77,17 @@ let GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool_1 = class GitHubTrigge
|
|
|
80
77
|
};
|
|
81
78
|
}
|
|
82
79
|
};
|
|
83
|
-
exports.GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool;
|
|
84
80
|
__decorate([
|
|
85
|
-
|
|
86
|
-
__metadata("design:type",
|
|
81
|
+
Inject(),
|
|
82
|
+
__metadata("design:type", OAuthTokenStore)
|
|
87
83
|
], GitHubTriggerWorkflowTool.prototype, "tokenStore", void 0);
|
|
88
|
-
|
|
89
|
-
|
|
84
|
+
GitHubTriggerWorkflowTool = GitHubTriggerWorkflowTool_1 = __decorate([
|
|
85
|
+
Tool({
|
|
90
86
|
uiConfig: {
|
|
91
87
|
description: 'Triggers a GitHub Actions workflow dispatch event. Returns 204 No Content on success. Returns { error: "unauthorized" } if no valid token is available.',
|
|
92
88
|
},
|
|
93
89
|
schema: inputSchema,
|
|
94
90
|
})
|
|
95
91
|
], GitHubTriggerWorkflowTool);
|
|
92
|
+
export { GitHubTriggerWorkflowTool };
|
|
96
93
|
//# sourceMappingURL=github-trigger-workflow.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-trigger-workflow.tool.js","sourceRoot":"","sources":["../../../src/tools/actions/github-trigger-workflow.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-trigger-workflow.tool.js","sourceRoot":"","sources":["../../../src/tools/actions/github-trigger-workflow.tool.ts"],"names":[],"mappings":";;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J,SAAS,EAAE,IAAI;gBACf,OAAO,EAAE,iDAAiD;aAC3D;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA5DS;IADP,MAAM,EAAE;8BACW,eAAe;6DAAC;AAJzB,yBAAyB;IAPrC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,yJAAyJ;SAC5J;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,yBAAyB,CAgErC"}
|
|
@@ -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,28 +8,26 @@ 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 GitHubCreateOrUpdateFileTool_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
|
-
path:
|
|
23
|
-
content:
|
|
24
|
-
message:
|
|
25
|
-
sha:
|
|
26
|
-
branch:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
path: z.string(),
|
|
20
|
+
content: z.string(),
|
|
21
|
+
message: z.string(),
|
|
22
|
+
sha: z.string().optional(),
|
|
23
|
+
branch: z.string().optional(),
|
|
27
24
|
})
|
|
28
25
|
.strict();
|
|
29
|
-
let GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool_1 = class GitHubCreateOrUpdateFileTool extends
|
|
30
|
-
logger = new
|
|
26
|
+
let GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool_1 = class GitHubCreateOrUpdateFileTool extends BaseTool {
|
|
27
|
+
logger = new Logger(GitHubCreateOrUpdateFileTool_1.name);
|
|
31
28
|
tokenStore;
|
|
32
29
|
async call(args) {
|
|
33
|
-
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.
|
|
30
|
+
const accessToken = await this.tokenStore.getValidAccessToken(this.ctx.app.userId, 'github');
|
|
34
31
|
if (!accessToken) {
|
|
35
32
|
return {
|
|
36
33
|
data: {
|
|
@@ -59,7 +56,7 @@ let GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool_1 = class GitHub
|
|
|
59
56
|
body: JSON.stringify(requestBody),
|
|
60
57
|
});
|
|
61
58
|
if (response.status === 401 || response.status === 403) {
|
|
62
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
59
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
63
60
|
return {
|
|
64
61
|
data: {
|
|
65
62
|
error: '401',
|
|
@@ -94,17 +91,17 @@ let GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool_1 = class GitHub
|
|
|
94
91
|
};
|
|
95
92
|
}
|
|
96
93
|
};
|
|
97
|
-
exports.GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool;
|
|
98
94
|
__decorate([
|
|
99
|
-
|
|
100
|
-
__metadata("design:type",
|
|
95
|
+
Inject(),
|
|
96
|
+
__metadata("design:type", OAuthTokenStore)
|
|
101
97
|
], GitHubCreateOrUpdateFileTool.prototype, "tokenStore", void 0);
|
|
102
|
-
|
|
103
|
-
|
|
98
|
+
GitHubCreateOrUpdateFileTool = GitHubCreateOrUpdateFileTool_1 = __decorate([
|
|
99
|
+
Tool({
|
|
104
100
|
uiConfig: {
|
|
105
101
|
description: 'Creates or updates a file in a GitHub repository. Content is provided as plain text and encoded to base64 before sending. To update an existing file, provide the sha of the file being replaced. Returns { error: "unauthorized" } if no valid token is available.',
|
|
106
102
|
},
|
|
107
103
|
schema: inputSchema,
|
|
108
104
|
})
|
|
109
105
|
], GitHubCreateOrUpdateFileTool);
|
|
106
|
+
export { GitHubCreateOrUpdateFileTool };
|
|
110
107
|
//# sourceMappingURL=github-create-or-update-file.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-create-or-update-file.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-create-or-update-file.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-create-or-update-file.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-create-or-update-file.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,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,MAAM,EAAE,CAAC,CAAC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AC7B;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAnFS;IADP,MAAM,EAAE;8BACW,eAAe;gEAAC;AAJzB,4BAA4B;IAPxC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,qQAAqQ;SACxQ;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,4BAA4B,CAuFxC"}
|
|
@@ -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 GitHubGetCommitTool_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
|
-
ref:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
ref: z.string(),
|
|
23
20
|
})
|
|
24
21
|
.strict();
|
|
25
|
-
let GitHubGetCommitTool = GitHubGetCommitTool_1 = class GitHubGetCommitTool extends
|
|
26
|
-
logger = new
|
|
22
|
+
let GitHubGetCommitTool = GitHubGetCommitTool_1 = class GitHubGetCommitTool extends BaseTool {
|
|
23
|
+
logger = new Logger(GitHubGetCommitTool_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: {
|
|
@@ -44,7 +41,7 @@ let GitHubGetCommitTool = GitHubGetCommitTool_1 = class GitHubGetCommitTool exte
|
|
|
44
41
|
},
|
|
45
42
|
});
|
|
46
43
|
if (response.status === 401 || response.status === 403) {
|
|
47
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
44
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
48
45
|
return {
|
|
49
46
|
data: {
|
|
50
47
|
error: '401',
|
|
@@ -92,17 +89,17 @@ let GitHubGetCommitTool = GitHubGetCommitTool_1 = class GitHubGetCommitTool exte
|
|
|
92
89
|
};
|
|
93
90
|
}
|
|
94
91
|
};
|
|
95
|
-
exports.GitHubGetCommitTool = GitHubGetCommitTool;
|
|
96
92
|
__decorate([
|
|
97
|
-
|
|
98
|
-
__metadata("design:type",
|
|
93
|
+
Inject(),
|
|
94
|
+
__metadata("design:type", OAuthTokenStore)
|
|
99
95
|
], GitHubGetCommitTool.prototype, "tokenStore", void 0);
|
|
100
|
-
|
|
101
|
-
|
|
96
|
+
GitHubGetCommitTool = GitHubGetCommitTool_1 = __decorate([
|
|
97
|
+
Tool({
|
|
102
98
|
uiConfig: {
|
|
103
99
|
description: 'Gets detailed information about a specific commit in a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
104
100
|
},
|
|
105
101
|
schema: inputSchema,
|
|
106
102
|
})
|
|
107
103
|
], GitHubGetCommitTool);
|
|
104
|
+
export { GitHubGetCommitTool };
|
|
108
105
|
//# sourceMappingURL=github-get-commit.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-get-commit.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-get-commit.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-get-commit.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-get-commit.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,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;CAChB,CAAC;KACD,MAAM,EAAE,CAAC;AAWL,IAAM,mBAAmB,2BAAzB,MAAM,mBAAoB,SAAQ,QAAQ;IAC9B,MAAM,GAAG,IAAI,MAAM,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,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;QAED,MAAM,GAAG,GAAG,gCAAgC,kBAAkB,CAAC,IAAI,CAAC,KAAK,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,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;wBAC7B,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK;wBAC/B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;wBAC7B,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,IAAI;qBAClC;oBACD,SAAS,EAAE;wBACT,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI;wBAChC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,IAAI;qBACjC;oBACD,OAAO,EAAE,IAAI,CAAC,QAAQ;oBACtB,KAAK,EAAE,IAAI,CAAC,KAAK;oBACjB,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;wBAC5B,QAAQ,EAAE,CAAC,CAAC,QAAQ;wBACpB,MAAM,EAAE,CAAC,CAAC,MAAM;wBAChB,SAAS,EAAE,CAAC,CAAC,SAAS;wBACtB,SAAS,EAAE,CAAC,CAAC,SAAS;wBACtB,OAAO,EAAE,CAAC,CAAC,OAAO;qBACnB,CAAC,CAAC;iBACJ;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA3FS;IADP,MAAM,EAAE;8BACW,eAAe;uDAAC;AAJzB,mBAAmB;IAP/B,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,6IAA6I;SAChJ;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,mBAAmB,CA+F/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,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 GitHubGetFileContentTool_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
|
-
path:
|
|
23
|
-
ref:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
path: z.string(),
|
|
20
|
+
ref: z.string().optional(),
|
|
24
21
|
})
|
|
25
22
|
.strict();
|
|
26
|
-
let GitHubGetFileContentTool = GitHubGetFileContentTool_1 = class GitHubGetFileContentTool extends
|
|
27
|
-
logger = new
|
|
23
|
+
let GitHubGetFileContentTool = GitHubGetFileContentTool_1 = class GitHubGetFileContentTool extends BaseTool {
|
|
24
|
+
logger = new Logger(GitHubGetFileContentTool_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: {
|
|
@@ -48,7 +45,7 @@ let GitHubGetFileContentTool = GitHubGetFileContentTool_1 = class GitHubGetFileC
|
|
|
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',
|
|
@@ -86,17 +83,17 @@ let GitHubGetFileContentTool = GitHubGetFileContentTool_1 = class GitHubGetFileC
|
|
|
86
83
|
};
|
|
87
84
|
}
|
|
88
85
|
};
|
|
89
|
-
exports.GitHubGetFileContentTool = GitHubGetFileContentTool;
|
|
90
86
|
__decorate([
|
|
91
|
-
|
|
92
|
-
__metadata("design:type",
|
|
87
|
+
Inject(),
|
|
88
|
+
__metadata("design:type", OAuthTokenStore)
|
|
93
89
|
], GitHubGetFileContentTool.prototype, "tokenStore", void 0);
|
|
94
|
-
|
|
95
|
-
|
|
90
|
+
GitHubGetFileContentTool = GitHubGetFileContentTool_1 = __decorate([
|
|
91
|
+
Tool({
|
|
96
92
|
uiConfig: {
|
|
97
93
|
description: 'Gets the content of a file from a GitHub repository. Decodes base64-encoded content from the API. Returns { error: "unauthorized" } if no valid token is available.',
|
|
98
94
|
},
|
|
99
95
|
schema: inputSchema,
|
|
100
96
|
})
|
|
101
97
|
], GitHubGetFileContentTool);
|
|
98
|
+
export { GitHubGetFileContentTool };
|
|
102
99
|
//# sourceMappingURL=github-get-file-content.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-get-file-content.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-get-file-content.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-get-file-content.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-get-file-content.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;gBACJ,IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,GAAG,EAAE,IAAI,CAAC,GAAG;oBACb,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,OAAO;oBACP,OAAO,EAAE,IAAI,CAAC,QAAQ;iBACvB;aACF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA7ES;IADP,MAAM,EAAE;8BACW,eAAe;4DAAC;AAJzB,wBAAwB;IAPpC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,qKAAqK;SACxK;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,wBAAwB,CAiFpC"}
|
|
@@ -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 GitHubListDirectoryTool_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
|
-
path:
|
|
23
|
-
ref:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
path: z.string().default(''),
|
|
20
|
+
ref: z.string().optional(),
|
|
24
21
|
})
|
|
25
22
|
.strict();
|
|
26
|
-
let GitHubListDirectoryTool = GitHubListDirectoryTool_1 = class GitHubListDirectoryTool extends
|
|
27
|
-
logger = new
|
|
23
|
+
let GitHubListDirectoryTool = GitHubListDirectoryTool_1 = class GitHubListDirectoryTool extends BaseTool {
|
|
24
|
+
logger = new Logger(GitHubListDirectoryTool_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: {
|
|
@@ -49,7 +46,7 @@ let GitHubListDirectoryTool = GitHubListDirectoryTool_1 = class GitHubListDirect
|
|
|
49
46
|
},
|
|
50
47
|
});
|
|
51
48
|
if (response.status === 401 || response.status === 403) {
|
|
52
|
-
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.
|
|
49
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${this.ctx.app.userId}`);
|
|
53
50
|
return {
|
|
54
51
|
data: {
|
|
55
52
|
error: '401',
|
|
@@ -81,17 +78,17 @@ let GitHubListDirectoryTool = GitHubListDirectoryTool_1 = class GitHubListDirect
|
|
|
81
78
|
};
|
|
82
79
|
}
|
|
83
80
|
};
|
|
84
|
-
exports.GitHubListDirectoryTool = GitHubListDirectoryTool;
|
|
85
81
|
__decorate([
|
|
86
|
-
|
|
87
|
-
__metadata("design:type",
|
|
82
|
+
Inject(),
|
|
83
|
+
__metadata("design:type", OAuthTokenStore)
|
|
88
84
|
], GitHubListDirectoryTool.prototype, "tokenStore", void 0);
|
|
89
|
-
|
|
90
|
-
|
|
85
|
+
GitHubListDirectoryTool = GitHubListDirectoryTool_1 = __decorate([
|
|
86
|
+
Tool({
|
|
91
87
|
uiConfig: {
|
|
92
88
|
description: 'Lists the contents of a directory in a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
93
89
|
},
|
|
94
90
|
schema: inputSchema,
|
|
95
91
|
})
|
|
96
92
|
], GitHubListDirectoryTool);
|
|
93
|
+
export { GitHubListDirectoryTool };
|
|
97
94
|
//# sourceMappingURL=github-list-directory.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-list-directory.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-list-directory.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-list-directory.tool.js","sourceRoot":"","sources":["../../../src/tools/content/github-list-directory.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,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;IAC5B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAC3B,CAAC;KACD,MAAM,EAAE,CAAC;AAWL,IAAM,uBAAuB,+BAA7B,MAAM,uBAAwB,SAAQ,QAAQ;IAClC,MAAM,GAAG,IAAI,MAAM,CAAC,yBAAuB,CAAC,IAAI,CAAC,CAAC;IAG3D,UA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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,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACnC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,QAAQ,CAAC,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,CAOjC,CAAC;QAEH,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;YACnC,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,OAAO,EAAE,KAAK,CAAC,QAAQ;SACxB,CAAC,CAAC,CAAC;QAEJ,OAAO;YACL,IAAI,EAAE,EAAE,OAAO,EAAE;SAClB,CAAC;IACJ,CAAC;CACF,CAAA;AAtES;IADP,MAAM,EAAE;8BACW,eAAe;2DAAC;AAJzB,uBAAuB;IAPnC,IAAI,CAAC;QACJ,QAAQ,EAAE;YACR,WAAW,EACT,6HAA6H;SAChI;QACD,MAAM,EAAE,WAAW;KACpB,CAAC;GACW,uBAAuB,CA0EnC"}
|
|
@@ -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 GitHubCreateIssueCommentTool_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
|
-
issueNumber:
|
|
23
|
-
body:
|
|
17
|
+
owner: z.string(),
|
|
18
|
+
repo: z.string(),
|
|
19
|
+
issueNumber: z.number(),
|
|
20
|
+
body: z.string(),
|
|
24
21
|
})
|
|
25
22
|
.strict();
|
|
26
|
-
let GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = class GitHubCreateIssueCommentTool extends
|
|
27
|
-
logger = new
|
|
23
|
+
let GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = class GitHubCreateIssueCommentTool extends BaseTool {
|
|
24
|
+
logger = new Logger(GitHubCreateIssueCommentTool_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: {
|
|
@@ -48,7 +45,7 @@ let GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = class GitHub
|
|
|
48
45
|
body: JSON.stringify({ body: args.body }),
|
|
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 GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = class GitHub
|
|
|
79
76
|
};
|
|
80
77
|
}
|
|
81
78
|
};
|
|
82
|
-
exports.GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool;
|
|
83
79
|
__decorate([
|
|
84
|
-
|
|
85
|
-
__metadata("design:type",
|
|
80
|
+
Inject(),
|
|
81
|
+
__metadata("design:type", OAuthTokenStore)
|
|
86
82
|
], GitHubCreateIssueCommentTool.prototype, "tokenStore", void 0);
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
GitHubCreateIssueCommentTool = GitHubCreateIssueCommentTool_1 = __decorate([
|
|
84
|
+
Tool({
|
|
89
85
|
uiConfig: {
|
|
90
86
|
description: 'Creates a comment on a GitHub issue or pull request. Returns { error: "unauthorized" } if no valid token is available.',
|
|
91
87
|
},
|
|
92
88
|
schema: inputSchema,
|
|
93
89
|
})
|
|
94
90
|
], GitHubCreateIssueCommentTool);
|
|
91
|
+
export { GitHubCreateIssueCommentTool };
|
|
95
92
|
//# sourceMappingURL=github-create-issue-comment.tool.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github-create-issue-comment.tool.js","sourceRoot":"","sources":["../../../src/tools/issues/github-create-issue-comment.tool.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github-create-issue-comment.tool.js","sourceRoot":"","sources":["../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