@loopstack/github-module 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +67 -0
- package/dist/github-oauth.provider.d.ts +19 -0
- package/dist/github-oauth.provider.d.ts.map +1 -0
- package/dist/github-oauth.provider.js +91 -0
- package/dist/github-oauth.provider.js.map +1 -0
- package/dist/github.module.d.ts +3 -0
- package/dist/github.module.d.ts.map +1 -0
- package/dist/github.module.js +75 -0
- package/dist/github.module.js.map +1 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/actions/github-get-workflow-run.tool.d.ts +13 -0
- package/dist/tools/actions/github-get-workflow-run.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-get-workflow-run.tool.js +106 -0
- package/dist/tools/actions/github-get-workflow-run.tool.js.map +1 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts +16 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.js +129 -0
- package/dist/tools/actions/github-list-workflow-runs.tool.js.map +1 -0
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts +15 -0
- package/dist/tools/actions/github-trigger-workflow.tool.d.ts.map +1 -0
- package/dist/tools/actions/github-trigger-workflow.tool.js +101 -0
- package/dist/tools/actions/github-trigger-workflow.tool.js.map +1 -0
- package/dist/tools/content/github-create-or-update-file.tool.d.ts +17 -0
- package/dist/tools/content/github-create-or-update-file.tool.d.ts.map +1 -0
- package/dist/tools/content/github-create-or-update-file.tool.js +115 -0
- package/dist/tools/content/github-create-or-update-file.tool.js.map +1 -0
- package/dist/tools/content/github-get-commit.tool.d.ts +13 -0
- package/dist/tools/content/github-get-commit.tool.d.ts.map +1 -0
- package/dist/tools/content/github-get-commit.tool.js +113 -0
- package/dist/tools/content/github-get-commit.tool.js.map +1 -0
- package/dist/tools/content/github-get-file-content.tool.d.ts +14 -0
- package/dist/tools/content/github-get-file-content.tool.d.ts.map +1 -0
- package/dist/tools/content/github-get-file-content.tool.js +107 -0
- package/dist/tools/content/github-get-file-content.tool.js.map +1 -0
- package/dist/tools/content/github-list-directory.tool.d.ts +14 -0
- package/dist/tools/content/github-list-directory.tool.d.ts.map +1 -0
- package/dist/tools/content/github-list-directory.tool.js +102 -0
- package/dist/tools/content/github-list-directory.tool.js.map +1 -0
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts +14 -0
- package/dist/tools/issues/github-create-issue-comment.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-create-issue-comment.tool.js +100 -0
- package/dist/tools/issues/github-create-issue-comment.tool.js.map +1 -0
- package/dist/tools/issues/github-create-issue.tool.d.ts +16 -0
- package/dist/tools/issues/github-create-issue.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-create-issue.tool.js +112 -0
- package/dist/tools/issues/github-create-issue.tool.js.map +1 -0
- package/dist/tools/issues/github-get-issue.tool.d.ts +13 -0
- package/dist/tools/issues/github-get-issue.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-get-issue.tool.js +106 -0
- package/dist/tools/issues/github-get-issue.tool.js.map +1 -0
- package/dist/tools/issues/github-list-issues.tool.d.ts +17 -0
- package/dist/tools/issues/github-list-issues.tool.d.ts.map +1 -0
- package/dist/tools/issues/github-list-issues.tool.js +115 -0
- package/dist/tools/issues/github-list-issues.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts +17 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.js +113 -0
- package/dist/tools/pull-requests/github-create-pull-request.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts +13 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.js +113 -0
- package/dist/tools/pull-requests/github-get-pull-request.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts +13 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js +97 -0
- package/dist/tools/pull-requests/github-list-pr-reviews.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts +16 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js +113 -0
- package/dist/tools/pull-requests/github-list-pull-requests.tool.js.map +1 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts +16 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.d.ts.map +1 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js +108 -0
- package/dist/tools/pull-requests/github-merge-pull-request.tool.js.map +1 -0
- package/dist/tools/repos/github-create-repo.tool.d.ts +14 -0
- package/dist/tools/repos/github-create-repo.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-create-repo.tool.js +108 -0
- package/dist/tools/repos/github-create-repo.tool.js.map +1 -0
- package/dist/tools/repos/github-get-repo.tool.d.ts +12 -0
- package/dist/tools/repos/github-get-repo.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-get-repo.tool.js +107 -0
- package/dist/tools/repos/github-get-repo.tool.js.map +1 -0
- package/dist/tools/repos/github-list-branches.tool.d.ts +13 -0
- package/dist/tools/repos/github-list-branches.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-list-branches.tool.js +97 -0
- package/dist/tools/repos/github-list-branches.tool.js.map +1 -0
- package/dist/tools/repos/github-list-repos.tool.d.ts +14 -0
- package/dist/tools/repos/github-list-repos.tool.d.ts.map +1 -0
- package/dist/tools/repos/github-list-repos.tool.js +107 -0
- package/dist/tools/repos/github-list-repos.tool.js.map +1 -0
- package/dist/tools/search/github-search-code.tool.d.ts +13 -0
- package/dist/tools/search/github-search-code.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-code.tool.js +100 -0
- package/dist/tools/search/github-search-code.tool.js.map +1 -0
- package/dist/tools/search/github-search-issues.tool.d.ts +14 -0
- package/dist/tools/search/github-search-issues.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-issues.tool.js +109 -0
- package/dist/tools/search/github-search-issues.tool.js.map +1 -0
- package/dist/tools/search/github-search-repos.tool.d.ts +14 -0
- package/dist/tools/search/github-search-repos.tool.d.ts.map +1 -0
- package/dist/tools/search/github-search-repos.tool.js +106 -0
- package/dist/tools/search/github-search-repos.tool.js.map +1 -0
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts +9 -0
- package/dist/tools/users/github-get-authenticated-user.tool.d.ts.map +1 -0
- package/dist/tools/users/github-get-authenticated-user.tool.js +96 -0
- package/dist/tools/users/github-get-authenticated-user.tool.js.map +1 -0
- package/dist/tools/users/github-list-user-orgs.tool.d.ts +11 -0
- package/dist/tools/users/github-list-user-orgs.tool.d.ts.map +1 -0
- package/dist/tools/users/github-list-user-orgs.tool.js +95 -0
- package/dist/tools/users/github-list-user-orgs.tool.js.map +1 -0
- package/package.json +81 -0
- package/src/github-oauth.provider.ts +85 -0
- package/src/github.module.ts +63 -0
- package/src/index.ts +27 -0
- package/src/tools/actions/github-get-workflow-run.tool.ts +115 -0
- package/src/tools/actions/github-list-workflow-runs.tool.ts +141 -0
- package/src/tools/actions/github-trigger-workflow.tool.ts +97 -0
- package/src/tools/content/github-create-or-update-file.tool.ts +124 -0
- package/src/tools/content/github-get-commit.tool.ts +124 -0
- package/src/tools/content/github-get-file-content.tool.ts +112 -0
- package/src/tools/content/github-list-directory.tool.ts +105 -0
- package/src/tools/issues/github-create-issue-comment.tool.ts +100 -0
- package/src/tools/issues/github-create-issue.tool.ts +114 -0
- package/src/tools/issues/github-get-issue.tool.ts +115 -0
- package/src/tools/issues/github-list-issues.tool.ts +126 -0
- package/src/tools/pull-requests/github-create-pull-request.tool.ts +119 -0
- package/src/tools/pull-requests/github-get-pull-request.tool.ts +128 -0
- package/src/tools/pull-requests/github-list-pr-reviews.tool.ts +99 -0
- package/src/tools/pull-requests/github-list-pull-requests.tool.ts +124 -0
- package/src/tools/pull-requests/github-merge-pull-request.tool.ts +108 -0
- package/src/tools/repos/github-create-repo.tool.ts +111 -0
- package/src/tools/repos/github-get-repo.tool.ts +120 -0
- package/src/tools/repos/github-list-branches.tool.ts +97 -0
- package/src/tools/repos/github-list-repos.tool.ts +115 -0
- package/src/tools/search/github-search-code.tool.ts +105 -0
- package/src/tools/search/github-search-issues.tool.ts +120 -0
- package/src/tools/search/github-search-repos.tool.ts +115 -0
- package/src/tools/users/github-get-authenticated-user.tool.ts +98 -0
- package/src/tools/users/github-list-user-orgs.tool.ts +94 -0
package/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# @loopstack/github-module
|
|
2
|
+
|
|
3
|
+
GitHub integration for the Loopstack automation framework. Provides a GitHub OAuth provider and 25 tools across 7 domains: repositories, issues, pull requests, content/git ops, actions, search, and users/orgs.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
loopstack add @loopstack/github-module
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Configuration
|
|
12
|
+
|
|
13
|
+
Set the following environment variables:
|
|
14
|
+
|
|
15
|
+
```env
|
|
16
|
+
GITHUB_CLIENT_ID=your_client_id
|
|
17
|
+
GITHUB_CLIENT_SECRET=your_client_secret
|
|
18
|
+
GITHUB_OAUTH_REDIRECT_URI=/oauth/callback
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Tools
|
|
22
|
+
|
|
23
|
+
### Repositories
|
|
24
|
+
|
|
25
|
+
- **GitHubListReposTool** — List repositories for the authenticated user
|
|
26
|
+
- **GitHubGetRepoTool** — Get detailed repository information
|
|
27
|
+
- **GitHubCreateRepoTool** — Create a new repository
|
|
28
|
+
- **GitHubListBranchesTool** — List branches for a repository
|
|
29
|
+
|
|
30
|
+
### Issues
|
|
31
|
+
|
|
32
|
+
- **GitHubListIssuesTool** — List issues for a repository
|
|
33
|
+
- **GitHubGetIssueTool** — Get detailed issue information
|
|
34
|
+
- **GitHubCreateIssueTool** — Create a new issue
|
|
35
|
+
- **GitHubCreateIssueCommentTool** — Comment on an issue or pull request
|
|
36
|
+
|
|
37
|
+
### Pull Requests
|
|
38
|
+
|
|
39
|
+
- **GitHubListPullRequestsTool** — List pull requests for a repository
|
|
40
|
+
- **GitHubGetPullRequestTool** — Get detailed pull request information
|
|
41
|
+
- **GitHubCreatePullRequestTool** — Create a new pull request
|
|
42
|
+
- **GitHubMergePullRequestTool** — Merge a pull request
|
|
43
|
+
- **GitHubListPrReviewsTool** — List reviews on a pull request
|
|
44
|
+
|
|
45
|
+
### Content / Git Ops
|
|
46
|
+
|
|
47
|
+
- **GitHubGetFileContentTool** — Get file content (base64-decoded)
|
|
48
|
+
- **GitHubCreateOrUpdateFileTool** — Create or update a file
|
|
49
|
+
- **GitHubListDirectoryTool** — List directory contents
|
|
50
|
+
- **GitHubGetCommitTool** — Get commit details
|
|
51
|
+
|
|
52
|
+
### Actions
|
|
53
|
+
|
|
54
|
+
- **GitHubListWorkflowRunsTool** — List workflow runs
|
|
55
|
+
- **GitHubTriggerWorkflowTool** — Trigger a workflow dispatch
|
|
56
|
+
- **GitHubGetWorkflowRunTool** — Get workflow run details
|
|
57
|
+
|
|
58
|
+
### Search
|
|
59
|
+
|
|
60
|
+
- **GitHubSearchCodeTool** — Search code across repositories
|
|
61
|
+
- **GitHubSearchReposTool** — Search repositories
|
|
62
|
+
- **GitHubSearchIssuesTool** — Search issues and pull requests
|
|
63
|
+
|
|
64
|
+
### Users & Orgs
|
|
65
|
+
|
|
66
|
+
- **GitHubGetAuthenticatedUserTool** — Get authenticated user profile
|
|
67
|
+
- **GitHubListUserOrgsTool** — List user organizations
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { OnModuleInit } from '@nestjs/common';
|
|
2
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
|
+
import { OAuthProviderInterface, OAuthProviderRegistry, OAuthTokenSet } from '@loopstack/oauth-module';
|
|
4
|
+
export declare class GitHubOAuthProvider implements OAuthProviderInterface, OnModuleInit {
|
|
5
|
+
private readonly configService;
|
|
6
|
+
private readonly providerRegistry;
|
|
7
|
+
private readonly logger;
|
|
8
|
+
readonly providerId = "github";
|
|
9
|
+
readonly defaultScopes: string[];
|
|
10
|
+
constructor(configService: ConfigService, providerRegistry: OAuthProviderRegistry);
|
|
11
|
+
onModuleInit(): void;
|
|
12
|
+
private get clientId();
|
|
13
|
+
private get clientSecret();
|
|
14
|
+
private get redirectUri();
|
|
15
|
+
buildAuthUrl(scopes: string[], state: string): string;
|
|
16
|
+
exchangeCode(code: string): Promise<OAuthTokenSet>;
|
|
17
|
+
refreshToken(): Promise<OAuthTokenSet>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=github-oauth.provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-oauth.provider.d.ts","sourceRoot":"","sources":["../src/github-oauth.provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAEvG,qBACa,mBAAoB,YAAW,sBAAsB,EAAE,YAAY;IAO5E,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,gBAAgB;IAPnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAwC;IAE/D,QAAQ,CAAC,UAAU,YAAY;IAC/B,QAAQ,CAAC,aAAa,WAA4C;gBAG/C,aAAa,EAAE,aAAa,EAC5B,gBAAgB,EAAE,qBAAqB;IAG1D,YAAY,IAAI,IAAI;IAKpB,OAAO,KAAK,QAAQ,GAInB;IAED,OAAO,KAAK,YAAY,GAIvB;IAED,OAAO,KAAK,WAAW,GAEtB;IAED,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM;IAU/C,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAkCxD,YAAY,IAAI,OAAO,CAAC,aAAa,CAAC;CAGvC"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubOAuthProvider_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubOAuthProvider = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const config_1 = require("@nestjs/config");
|
|
16
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
17
|
+
let GitHubOAuthProvider = GitHubOAuthProvider_1 = class GitHubOAuthProvider {
|
|
18
|
+
configService;
|
|
19
|
+
providerRegistry;
|
|
20
|
+
logger = new common_1.Logger(GitHubOAuthProvider_1.name);
|
|
21
|
+
providerId = 'github';
|
|
22
|
+
defaultScopes = ['repo', 'user', 'workflow', 'read:org'];
|
|
23
|
+
constructor(configService, providerRegistry) {
|
|
24
|
+
this.configService = configService;
|
|
25
|
+
this.providerRegistry = providerRegistry;
|
|
26
|
+
}
|
|
27
|
+
onModuleInit() {
|
|
28
|
+
this.providerRegistry.register(this);
|
|
29
|
+
this.logger.log('GitHub OAuth provider registered');
|
|
30
|
+
}
|
|
31
|
+
get clientId() {
|
|
32
|
+
const id = this.configService.get('GITHUB_CLIENT_ID');
|
|
33
|
+
if (!id)
|
|
34
|
+
throw new Error('GITHUB_CLIENT_ID is not configured');
|
|
35
|
+
return id;
|
|
36
|
+
}
|
|
37
|
+
get clientSecret() {
|
|
38
|
+
const secret = this.configService.get('GITHUB_CLIENT_SECRET');
|
|
39
|
+
if (!secret)
|
|
40
|
+
throw new Error('GITHUB_CLIENT_SECRET is not configured');
|
|
41
|
+
return secret;
|
|
42
|
+
}
|
|
43
|
+
get redirectUri() {
|
|
44
|
+
return this.configService.get('GITHUB_OAUTH_REDIRECT_URI', '/oauth/callback');
|
|
45
|
+
}
|
|
46
|
+
buildAuthUrl(scopes, state) {
|
|
47
|
+
const params = new URLSearchParams({
|
|
48
|
+
client_id: this.clientId,
|
|
49
|
+
redirect_uri: this.redirectUri,
|
|
50
|
+
scope: scopes.join(' '),
|
|
51
|
+
state,
|
|
52
|
+
});
|
|
53
|
+
return `https://github.com/login/oauth/authorize?${params.toString()}`;
|
|
54
|
+
}
|
|
55
|
+
async exchangeCode(code) {
|
|
56
|
+
const response = await fetch('https://github.com/login/oauth/access_token', {
|
|
57
|
+
method: 'POST',
|
|
58
|
+
headers: {
|
|
59
|
+
'Content-Type': 'application/x-www-form-urlencoded',
|
|
60
|
+
Accept: 'application/json',
|
|
61
|
+
},
|
|
62
|
+
body: new URLSearchParams({
|
|
63
|
+
code,
|
|
64
|
+
client_id: this.clientId,
|
|
65
|
+
client_secret: this.clientSecret,
|
|
66
|
+
redirect_uri: this.redirectUri,
|
|
67
|
+
}),
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
const errorBody = await response.text();
|
|
71
|
+
this.logger.error(`Token exchange failed: ${response.status} ${errorBody}`);
|
|
72
|
+
throw new Error(`GitHub token exchange failed: ${response.statusText}`);
|
|
73
|
+
}
|
|
74
|
+
const tokens = (await response.json());
|
|
75
|
+
return {
|
|
76
|
+
accessToken: tokens.access_token,
|
|
77
|
+
expiresIn: 315360000,
|
|
78
|
+
scope: tokens.scope,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
refreshToken() {
|
|
82
|
+
throw new Error('GitHub tokens do not expire and cannot be refreshed.');
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.GitHubOAuthProvider = GitHubOAuthProvider;
|
|
86
|
+
exports.GitHubOAuthProvider = GitHubOAuthProvider = GitHubOAuthProvider_1 = __decorate([
|
|
87
|
+
(0, common_1.Injectable)(),
|
|
88
|
+
__metadata("design:paramtypes", [config_1.ConfigService,
|
|
89
|
+
oauth_module_1.OAuthProviderRegistry])
|
|
90
|
+
], GitHubOAuthProvider);
|
|
91
|
+
//# sourceMappingURL=github-oauth.provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-oauth.provider.js","sourceRoot":"","sources":["../src/github-oauth.provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAkE;AAClE,2CAA+C;AAC/C,0DAAuG;AAGhG,IAAM,mBAAmB,2BAAzB,MAAM,mBAAmB;IAOX;IACA;IAPF,MAAM,GAAG,IAAI,eAAM,CAAC,qBAAmB,CAAC,IAAI,CAAC,CAAC;IAEtD,UAAU,GAAG,QAAQ,CAAC;IACtB,aAAa,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;IAElE,YACmB,aAA4B,EAC5B,gBAAuC;QADvC,kBAAa,GAAb,aAAa,CAAe;QAC5B,qBAAgB,GAAhB,gBAAgB,CAAuB;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gBACxB,IAAI;gBACJ,SAAS,EAAE,IAAI,CAAC,QAAQ;gBACxB,aAAa,EAAE,IAAI,CAAC,YAAY;gBAChC,YAAY,EAAE,IAAI,CAAC,WAAW;aAC/B,CAAC;SACH,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACxC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,0BAA0B,QAAQ,CAAC,MAAM,IAAI,SAAS,EAAE,CAAC,CAAC;YAC5E,MAAM,IAAI,KAAK,CAAC,iCAAiC,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC;QAC1E,CAAC;QAED,MAAM,MAAM,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAIpC,CAAC;QAEF,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,YAAY;YAChC,SAAS,EAAE,SAAS;YACpB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB,CAAC;IACJ,CAAC;IAED,YAAY;QACV,MAAM,IAAI,KAAK,CAAC,sDAAsD,CAAC,CAAC;IAC1E,CAAC;CACF,CAAA;AA/EY,kDAAmB;8BAAnB,mBAAmB;IAD/B,IAAA,mBAAU,GAAE;qCAQuB,sBAAa;QACV,oCAAqB;GAR/C,mBAAmB,CA+E/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.module.d.ts","sourceRoot":"","sources":["../src/github.module.ts"],"names":[],"mappings":"AAyDA,qBAKa,YAAY;CAAG"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.GitHubModule = void 0;
|
|
10
|
+
const common_1 = require("@nestjs/common");
|
|
11
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
12
|
+
const github_oauth_provider_1 = require("./github-oauth.provider");
|
|
13
|
+
const github_get_workflow_run_tool_1 = require("./tools/actions/github-get-workflow-run.tool");
|
|
14
|
+
const github_list_workflow_runs_tool_1 = require("./tools/actions/github-list-workflow-runs.tool");
|
|
15
|
+
const github_trigger_workflow_tool_1 = require("./tools/actions/github-trigger-workflow.tool");
|
|
16
|
+
const github_create_or_update_file_tool_1 = require("./tools/content/github-create-or-update-file.tool");
|
|
17
|
+
const github_get_commit_tool_1 = require("./tools/content/github-get-commit.tool");
|
|
18
|
+
const github_get_file_content_tool_1 = require("./tools/content/github-get-file-content.tool");
|
|
19
|
+
const github_list_directory_tool_1 = require("./tools/content/github-list-directory.tool");
|
|
20
|
+
const github_create_issue_comment_tool_1 = require("./tools/issues/github-create-issue-comment.tool");
|
|
21
|
+
const github_create_issue_tool_1 = require("./tools/issues/github-create-issue.tool");
|
|
22
|
+
const github_get_issue_tool_1 = require("./tools/issues/github-get-issue.tool");
|
|
23
|
+
const github_list_issues_tool_1 = require("./tools/issues/github-list-issues.tool");
|
|
24
|
+
const github_create_pull_request_tool_1 = require("./tools/pull-requests/github-create-pull-request.tool");
|
|
25
|
+
const github_get_pull_request_tool_1 = require("./tools/pull-requests/github-get-pull-request.tool");
|
|
26
|
+
const github_list_pr_reviews_tool_1 = require("./tools/pull-requests/github-list-pr-reviews.tool");
|
|
27
|
+
const github_list_pull_requests_tool_1 = require("./tools/pull-requests/github-list-pull-requests.tool");
|
|
28
|
+
const github_merge_pull_request_tool_1 = require("./tools/pull-requests/github-merge-pull-request.tool");
|
|
29
|
+
const github_create_repo_tool_1 = require("./tools/repos/github-create-repo.tool");
|
|
30
|
+
const github_get_repo_tool_1 = require("./tools/repos/github-get-repo.tool");
|
|
31
|
+
const github_list_branches_tool_1 = require("./tools/repos/github-list-branches.tool");
|
|
32
|
+
const github_list_repos_tool_1 = require("./tools/repos/github-list-repos.tool");
|
|
33
|
+
const github_search_code_tool_1 = require("./tools/search/github-search-code.tool");
|
|
34
|
+
const github_search_issues_tool_1 = require("./tools/search/github-search-issues.tool");
|
|
35
|
+
const github_search_repos_tool_1 = require("./tools/search/github-search-repos.tool");
|
|
36
|
+
const github_get_authenticated_user_tool_1 = require("./tools/users/github-get-authenticated-user.tool");
|
|
37
|
+
const github_list_user_orgs_tool_1 = require("./tools/users/github-list-user-orgs.tool");
|
|
38
|
+
const tools = [
|
|
39
|
+
github_list_repos_tool_1.GitHubListReposTool,
|
|
40
|
+
github_get_repo_tool_1.GitHubGetRepoTool,
|
|
41
|
+
github_create_repo_tool_1.GitHubCreateRepoTool,
|
|
42
|
+
github_list_branches_tool_1.GitHubListBranchesTool,
|
|
43
|
+
github_list_issues_tool_1.GitHubListIssuesTool,
|
|
44
|
+
github_get_issue_tool_1.GitHubGetIssueTool,
|
|
45
|
+
github_create_issue_tool_1.GitHubCreateIssueTool,
|
|
46
|
+
github_create_issue_comment_tool_1.GitHubCreateIssueCommentTool,
|
|
47
|
+
github_list_pull_requests_tool_1.GitHubListPullRequestsTool,
|
|
48
|
+
github_get_pull_request_tool_1.GitHubGetPullRequestTool,
|
|
49
|
+
github_create_pull_request_tool_1.GitHubCreatePullRequestTool,
|
|
50
|
+
github_merge_pull_request_tool_1.GitHubMergePullRequestTool,
|
|
51
|
+
github_list_pr_reviews_tool_1.GitHubListPrReviewsTool,
|
|
52
|
+
github_get_file_content_tool_1.GitHubGetFileContentTool,
|
|
53
|
+
github_create_or_update_file_tool_1.GitHubCreateOrUpdateFileTool,
|
|
54
|
+
github_list_directory_tool_1.GitHubListDirectoryTool,
|
|
55
|
+
github_get_commit_tool_1.GitHubGetCommitTool,
|
|
56
|
+
github_list_workflow_runs_tool_1.GitHubListWorkflowRunsTool,
|
|
57
|
+
github_trigger_workflow_tool_1.GitHubTriggerWorkflowTool,
|
|
58
|
+
github_get_workflow_run_tool_1.GitHubGetWorkflowRunTool,
|
|
59
|
+
github_search_code_tool_1.GitHubSearchCodeTool,
|
|
60
|
+
github_search_repos_tool_1.GitHubSearchReposTool,
|
|
61
|
+
github_search_issues_tool_1.GitHubSearchIssuesTool,
|
|
62
|
+
github_get_authenticated_user_tool_1.GitHubGetAuthenticatedUserTool,
|
|
63
|
+
github_list_user_orgs_tool_1.GitHubListUserOrgsTool,
|
|
64
|
+
];
|
|
65
|
+
let GitHubModule = class GitHubModule {
|
|
66
|
+
};
|
|
67
|
+
exports.GitHubModule = GitHubModule;
|
|
68
|
+
exports.GitHubModule = GitHubModule = __decorate([
|
|
69
|
+
(0, common_1.Module)({
|
|
70
|
+
imports: [oauth_module_1.OAuthModule],
|
|
71
|
+
providers: [github_oauth_provider_1.GitHubOAuthProvider, ...tools],
|
|
72
|
+
exports: [github_oauth_provider_1.GitHubOAuthProvider, ...tools],
|
|
73
|
+
})
|
|
74
|
+
], GitHubModule);
|
|
75
|
+
//# sourceMappingURL=github.module.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github.module.js","sourceRoot":"","sources":["../src/github.module.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,0DAAsD;AACtD,mEAA8D;AAC9D,+FAAwF;AACxF,mGAA4F;AAC5F,+FAAyF;AACzF,yGAAiG;AACjG,mFAA6E;AAC7E,+FAAwF;AACxF,2FAAqF;AACrF,sGAA+F;AAC/F,sFAAgF;AAChF,gFAA0E;AAC1E,oFAA8E;AAC9E,2GAAoG;AACpG,qGAA8F;AAC9F,mGAA4F;AAC5F,yGAAkG;AAClG,yGAAkG;AAClG,mFAA6E;AAC7E,6EAAuE;AACvE,uFAAiF;AACjF,iFAA2E;AAC3E,oFAA8E;AAC9E,wFAAkF;AAClF,sFAAgF;AAChF,yGAAkG;AAClG,yFAAkF;AAElF,MAAM,KAAK,GAAG;IACZ,4CAAmB;IACnB,wCAAiB;IACjB,8CAAoB;IACpB,kDAAsB;IACtB,8CAAoB;IACpB,0CAAkB;IAClB,gDAAqB;IACrB,+DAA4B;IAC5B,2DAA0B;IAC1B,uDAAwB;IACxB,6DAA2B;IAC3B,2DAA0B;IAC1B,qDAAuB;IACvB,uDAAwB;IACxB,gEAA4B;IAC5B,oDAAuB;IACvB,4CAAmB;IACnB,2DAA0B;IAC1B,wDAAyB;IACzB,uDAAwB;IACxB,8CAAoB;IACpB,gDAAqB;IACrB,kDAAsB;IACtB,mEAA8B;IAC9B,mDAAsB;CACvB,CAAC;AAOK,IAAM,YAAY,GAAlB,MAAM,YAAY;CAAG,CAAA;AAAf,oCAAY;uBAAZ,YAAY;IALxB,IAAA,eAAM,EAAC;QACN,OAAO,EAAE,CAAC,0BAAW,CAAC;QACtB,SAAS,EAAE,CAAC,2CAAmB,EAAE,GAAG,KAAK,CAAC;QAC1C,OAAO,EAAE,CAAC,2CAAmB,EAAE,GAAG,KAAK,CAAC;KACzC,CAAC;GACW,YAAY,CAAG"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export * from './github.module';
|
|
2
|
+
export * from './github-oauth.provider';
|
|
3
|
+
export * from './tools/repos/github-list-repos.tool';
|
|
4
|
+
export * from './tools/repos/github-get-repo.tool';
|
|
5
|
+
export * from './tools/repos/github-create-repo.tool';
|
|
6
|
+
export * from './tools/repos/github-list-branches.tool';
|
|
7
|
+
export * from './tools/issues/github-list-issues.tool';
|
|
8
|
+
export * from './tools/issues/github-get-issue.tool';
|
|
9
|
+
export * from './tools/issues/github-create-issue.tool';
|
|
10
|
+
export * from './tools/issues/github-create-issue-comment.tool';
|
|
11
|
+
export * from './tools/pull-requests/github-list-pull-requests.tool';
|
|
12
|
+
export * from './tools/pull-requests/github-get-pull-request.tool';
|
|
13
|
+
export * from './tools/pull-requests/github-create-pull-request.tool';
|
|
14
|
+
export * from './tools/pull-requests/github-merge-pull-request.tool';
|
|
15
|
+
export * from './tools/pull-requests/github-list-pr-reviews.tool';
|
|
16
|
+
export * from './tools/content/github-get-file-content.tool';
|
|
17
|
+
export * from './tools/content/github-create-or-update-file.tool';
|
|
18
|
+
export * from './tools/content/github-list-directory.tool';
|
|
19
|
+
export * from './tools/content/github-get-commit.tool';
|
|
20
|
+
export * from './tools/actions/github-list-workflow-runs.tool';
|
|
21
|
+
export * from './tools/actions/github-trigger-workflow.tool';
|
|
22
|
+
export * from './tools/actions/github-get-workflow-run.tool';
|
|
23
|
+
export * from './tools/search/github-search-code.tool';
|
|
24
|
+
export * from './tools/search/github-search-repos.tool';
|
|
25
|
+
export * from './tools/search/github-search-issues.tool';
|
|
26
|
+
export * from './tools/users/github-get-authenticated-user.tool';
|
|
27
|
+
export * from './tools/users/github-list-user-orgs.tool';
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sCAAsC,CAAC;AACrD,cAAc,oCAAoC,CAAC;AACnD,cAAc,uCAAuC,CAAC;AACtD,cAAc,yCAAyC,CAAC;AACxD,cAAc,wCAAwC,CAAC;AACvD,cAAc,sCAAsC,CAAC;AACrD,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,sDAAsD,CAAC;AACrE,cAAc,oDAAoD,CAAC;AACnE,cAAc,uDAAuD,CAAC;AACtE,cAAc,sDAAsD,CAAC;AACrE,cAAc,mDAAmD,CAAC;AAClE,cAAc,8CAA8C,CAAC;AAC7D,cAAc,mDAAmD,CAAC;AAClE,cAAc,4CAA4C,CAAC;AAC3D,cAAc,wCAAwC,CAAC;AACvD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,8CAA8C,CAAC;AAC7D,cAAc,wCAAwC,CAAC;AACvD,cAAc,yCAAyC,CAAC;AACxD,cAAc,0CAA0C,CAAC;AACzD,cAAc,kDAAkD,CAAC;AACjE,cAAc,0CAA0C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./github.module"), exports);
|
|
18
|
+
__exportStar(require("./github-oauth.provider"), exports);
|
|
19
|
+
__exportStar(require("./tools/repos/github-list-repos.tool"), exports);
|
|
20
|
+
__exportStar(require("./tools/repos/github-get-repo.tool"), exports);
|
|
21
|
+
__exportStar(require("./tools/repos/github-create-repo.tool"), exports);
|
|
22
|
+
__exportStar(require("./tools/repos/github-list-branches.tool"), exports);
|
|
23
|
+
__exportStar(require("./tools/issues/github-list-issues.tool"), exports);
|
|
24
|
+
__exportStar(require("./tools/issues/github-get-issue.tool"), exports);
|
|
25
|
+
__exportStar(require("./tools/issues/github-create-issue.tool"), exports);
|
|
26
|
+
__exportStar(require("./tools/issues/github-create-issue-comment.tool"), exports);
|
|
27
|
+
__exportStar(require("./tools/pull-requests/github-list-pull-requests.tool"), exports);
|
|
28
|
+
__exportStar(require("./tools/pull-requests/github-get-pull-request.tool"), exports);
|
|
29
|
+
__exportStar(require("./tools/pull-requests/github-create-pull-request.tool"), exports);
|
|
30
|
+
__exportStar(require("./tools/pull-requests/github-merge-pull-request.tool"), exports);
|
|
31
|
+
__exportStar(require("./tools/pull-requests/github-list-pr-reviews.tool"), exports);
|
|
32
|
+
__exportStar(require("./tools/content/github-get-file-content.tool"), exports);
|
|
33
|
+
__exportStar(require("./tools/content/github-create-or-update-file.tool"), exports);
|
|
34
|
+
__exportStar(require("./tools/content/github-list-directory.tool"), exports);
|
|
35
|
+
__exportStar(require("./tools/content/github-get-commit.tool"), exports);
|
|
36
|
+
__exportStar(require("./tools/actions/github-list-workflow-runs.tool"), exports);
|
|
37
|
+
__exportStar(require("./tools/actions/github-trigger-workflow.tool"), exports);
|
|
38
|
+
__exportStar(require("./tools/actions/github-get-workflow-run.tool"), exports);
|
|
39
|
+
__exportStar(require("./tools/search/github-search-code.tool"), exports);
|
|
40
|
+
__exportStar(require("./tools/search/github-search-repos.tool"), exports);
|
|
41
|
+
__exportStar(require("./tools/search/github-search-issues.tool"), exports);
|
|
42
|
+
__exportStar(require("./tools/users/github-get-authenticated-user.tool"), exports);
|
|
43
|
+
__exportStar(require("./tools/users/github-list-user-orgs.tool"), exports);
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kDAAgC;AAChC,0DAAwC;AACxC,uEAAqD;AACrD,qEAAmD;AACnD,wEAAsD;AACtD,0EAAwD;AACxD,yEAAuD;AACvD,uEAAqD;AACrD,0EAAwD;AACxD,kFAAgE;AAChE,uFAAqE;AACrE,qFAAmE;AACnE,wFAAsE;AACtE,uFAAqE;AACrE,oFAAkE;AAClE,+EAA6D;AAC7D,oFAAkE;AAClE,6EAA2D;AAC3D,yEAAuD;AACvD,iFAA+D;AAC/D,+EAA6D;AAC7D,+EAA6D;AAC7D,yEAAuD;AACvD,0EAAwD;AACxD,2EAAyD;AACzD,mFAAiE;AACjE,2EAAyD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubGetWorkflowRunArgs = {
|
|
3
|
+
owner: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
runId: number;
|
|
6
|
+
};
|
|
7
|
+
export declare class GitHubGetWorkflowRunTool implements ToolInterface {
|
|
8
|
+
private readonly logger;
|
|
9
|
+
private tokenStore;
|
|
10
|
+
args: GitHubGetWorkflowRunArgs;
|
|
11
|
+
execute(args: GitHubGetWorkflowRunArgs, ctx: RunContext): Promise<ToolResult>;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=github-get-workflow-run.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-workflow-run.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/actions/github-get-workflow-run.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,wBAAwB,GAAG;IACrC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAMa,wBAAyB,YAAW,aAAa;IAC5D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6C;IAGpE,OAAO,CAAC,UAAU,CAAkB;IAWpC,IAAI,EAAE,wBAAwB,CAAC;IAEzB,OAAO,CAAC,IAAI,EAAE,wBAAwB,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAgFpF"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubGetWorkflowRunTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubGetWorkflowRunTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubGetWorkflowRunTool = GitHubGetWorkflowRunTool_1 = class GitHubGetWorkflowRunTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubGetWorkflowRunTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/actions/runs/${args.runId}`;
|
|
33
|
+
const response = await fetch(url, {
|
|
34
|
+
headers: {
|
|
35
|
+
Authorization: `Bearer ${accessToken}`,
|
|
36
|
+
Accept: 'application/vnd.github+json',
|
|
37
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
if (response.status === 401 || response.status === 403) {
|
|
41
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
42
|
+
return {
|
|
43
|
+
data: {
|
|
44
|
+
error: '401',
|
|
45
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
if (!response.ok) {
|
|
50
|
+
const body = await response.text();
|
|
51
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
52
|
+
return {
|
|
53
|
+
data: {
|
|
54
|
+
error: 'api_error',
|
|
55
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
const run = (await response.json());
|
|
60
|
+
return {
|
|
61
|
+
data: {
|
|
62
|
+
run: {
|
|
63
|
+
id: run.id,
|
|
64
|
+
name: run.name,
|
|
65
|
+
status: run.status,
|
|
66
|
+
conclusion: run.conclusion,
|
|
67
|
+
headBranch: run.head_branch,
|
|
68
|
+
headSha: run.head_sha,
|
|
69
|
+
event: run.event,
|
|
70
|
+
workflowId: run.workflow_id,
|
|
71
|
+
runNumber: run.run_number,
|
|
72
|
+
runAttempt: run.run_attempt,
|
|
73
|
+
createdAt: run.created_at,
|
|
74
|
+
updatedAt: run.updated_at,
|
|
75
|
+
runStartedAt: run.run_started_at,
|
|
76
|
+
htmlUrl: run.html_url,
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
exports.GitHubGetWorkflowRunTool = GitHubGetWorkflowRunTool;
|
|
83
|
+
__decorate([
|
|
84
|
+
(0, common_1.Inject)(),
|
|
85
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
86
|
+
], GitHubGetWorkflowRunTool.prototype, "tokenStore", void 0);
|
|
87
|
+
__decorate([
|
|
88
|
+
(0, common_2.Input)({
|
|
89
|
+
schema: zod_1.z
|
|
90
|
+
.object({
|
|
91
|
+
owner: zod_1.z.string(),
|
|
92
|
+
repo: zod_1.z.string(),
|
|
93
|
+
runId: zod_1.z.number(),
|
|
94
|
+
})
|
|
95
|
+
.strict(),
|
|
96
|
+
}),
|
|
97
|
+
__metadata("design:type", Object)
|
|
98
|
+
], GitHubGetWorkflowRunTool.prototype, "args", void 0);
|
|
99
|
+
exports.GitHubGetWorkflowRunTool = GitHubGetWorkflowRunTool = GitHubGetWorkflowRunTool_1 = __decorate([
|
|
100
|
+
(0, common_2.Tool)({
|
|
101
|
+
config: {
|
|
102
|
+
description: 'Gets detailed information about a specific GitHub Actions workflow run. Returns { error: "unauthorized" } if no valid token is available.',
|
|
103
|
+
},
|
|
104
|
+
})
|
|
105
|
+
], GitHubGetWorkflowRunTool);
|
|
106
|
+
//# sourceMappingURL=github-get-workflow-run.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-get-workflow-run.tool.js","sourceRoot":"","sources":["../../../src/tools/actions/github-get-workflow-run.tool.ts"],"names":[],"mappings":";;;;;;;;;;;;;AAAA,2CAAgD;AAChD,6BAAwB;AACxB,8CAAuF;AACvF,0DAA0D;AAcnD,IAAM,wBAAwB,gCAA9B,MAAM,wBAAwB;IAClB,MAAM,GAAG,IAAI,eAAM,CAAC,0BAAwB,CAAC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2I;SAC9I;KACF,CAAC;GACW,wBAAwB,CAiGpC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { RunContext, ToolInterface, ToolResult } from '@loopstack/common';
|
|
2
|
+
export type GitHubListWorkflowRunsArgs = {
|
|
3
|
+
owner: string;
|
|
4
|
+
repo: string;
|
|
5
|
+
branch?: string;
|
|
6
|
+
status?: string;
|
|
7
|
+
perPage?: number;
|
|
8
|
+
page?: number;
|
|
9
|
+
};
|
|
10
|
+
export declare class GitHubListWorkflowRunsTool implements ToolInterface {
|
|
11
|
+
private readonly logger;
|
|
12
|
+
private tokenStore;
|
|
13
|
+
args: GitHubListWorkflowRunsArgs;
|
|
14
|
+
execute(args: GitHubListWorkflowRunsArgs, ctx: RunContext): Promise<ToolResult>;
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=github-list-workflow-runs.tool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"github-list-workflow-runs.tool.d.ts","sourceRoot":"","sources":["../../../src/tools/actions/github-list-workflow-runs.tool.ts"],"names":[],"mappings":"AAEA,OAAO,EAAS,UAAU,EAAQ,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAGvF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,qBAMa,0BAA2B,YAAW,aAAa;IAC9D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;IAGtE,OAAO,CAAC,UAAU,CAAkB;IA+BpC,IAAI,EAAE,0BAA0B,CAAC;IAE3B,OAAO,CAAC,IAAI,EAAE,0BAA0B,EAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAmFtF"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var GitHubListWorkflowRunsTool_1;
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.GitHubListWorkflowRunsTool = void 0;
|
|
14
|
+
const common_1 = require("@nestjs/common");
|
|
15
|
+
const zod_1 = require("zod");
|
|
16
|
+
const common_2 = require("@loopstack/common");
|
|
17
|
+
const oauth_module_1 = require("@loopstack/oauth-module");
|
|
18
|
+
let GitHubListWorkflowRunsTool = GitHubListWorkflowRunsTool_1 = class GitHubListWorkflowRunsTool {
|
|
19
|
+
logger = new common_1.Logger(GitHubListWorkflowRunsTool_1.name);
|
|
20
|
+
tokenStore;
|
|
21
|
+
args;
|
|
22
|
+
async execute(args, ctx) {
|
|
23
|
+
const accessToken = await this.tokenStore.getValidAccessToken(ctx.userId, 'github');
|
|
24
|
+
if (!accessToken) {
|
|
25
|
+
return {
|
|
26
|
+
data: {
|
|
27
|
+
error: 'unauthorized',
|
|
28
|
+
message: 'No valid GitHub token found. Please authenticate first.',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
const params = new URLSearchParams({
|
|
33
|
+
per_page: String(args.perPage ?? 30),
|
|
34
|
+
page: String(args.page ?? 1),
|
|
35
|
+
});
|
|
36
|
+
if (args.branch)
|
|
37
|
+
params.set('branch', args.branch);
|
|
38
|
+
if (args.status)
|
|
39
|
+
params.set('status', args.status);
|
|
40
|
+
const url = `https://api.github.com/repos/${encodeURIComponent(args.owner)}/${encodeURIComponent(args.repo)}/actions/runs?${params.toString()}`;
|
|
41
|
+
const response = await fetch(url, {
|
|
42
|
+
headers: {
|
|
43
|
+
Authorization: `Bearer ${accessToken}`,
|
|
44
|
+
Accept: 'application/vnd.github+json',
|
|
45
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
if (response.status === 401 || response.status === 403) {
|
|
49
|
+
this.logger.warn(`GitHub API returned ${response.status} for user ${ctx.userId}`);
|
|
50
|
+
return {
|
|
51
|
+
data: {
|
|
52
|
+
error: '401',
|
|
53
|
+
message: 'GitHub token was rejected. Please re-authenticate.',
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
if (!response.ok) {
|
|
58
|
+
const body = await response.text();
|
|
59
|
+
this.logger.error(`GitHub API error: ${response.status} ${body}`);
|
|
60
|
+
return {
|
|
61
|
+
data: {
|
|
62
|
+
error: 'api_error',
|
|
63
|
+
message: `GitHub API error: ${response.statusText}`,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
const data = (await response.json());
|
|
68
|
+
const runs = data.workflow_runs.map((run) => ({
|
|
69
|
+
id: run.id,
|
|
70
|
+
name: run.name,
|
|
71
|
+
status: run.status,
|
|
72
|
+
conclusion: run.conclusion,
|
|
73
|
+
headBranch: run.head_branch,
|
|
74
|
+
headSha: run.head_sha,
|
|
75
|
+
event: run.event,
|
|
76
|
+
createdAt: run.created_at,
|
|
77
|
+
updatedAt: run.updated_at,
|
|
78
|
+
htmlUrl: run.html_url,
|
|
79
|
+
}));
|
|
80
|
+
return {
|
|
81
|
+
data: { totalCount: data.total_count, runs },
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
};
|
|
85
|
+
exports.GitHubListWorkflowRunsTool = GitHubListWorkflowRunsTool;
|
|
86
|
+
__decorate([
|
|
87
|
+
(0, common_1.Inject)(),
|
|
88
|
+
__metadata("design:type", oauth_module_1.OAuthTokenStore)
|
|
89
|
+
], GitHubListWorkflowRunsTool.prototype, "tokenStore", void 0);
|
|
90
|
+
__decorate([
|
|
91
|
+
(0, common_2.Input)({
|
|
92
|
+
schema: zod_1.z
|
|
93
|
+
.object({
|
|
94
|
+
owner: zod_1.z.string(),
|
|
95
|
+
repo: zod_1.z.string(),
|
|
96
|
+
branch: zod_1.z.string().optional(),
|
|
97
|
+
status: zod_1.z
|
|
98
|
+
.enum([
|
|
99
|
+
'completed',
|
|
100
|
+
'action_required',
|
|
101
|
+
'cancelled',
|
|
102
|
+
'failure',
|
|
103
|
+
'neutral',
|
|
104
|
+
'skipped',
|
|
105
|
+
'stale',
|
|
106
|
+
'success',
|
|
107
|
+
'timed_out',
|
|
108
|
+
'in_progress',
|
|
109
|
+
'queued',
|
|
110
|
+
'requested',
|
|
111
|
+
'waiting',
|
|
112
|
+
'pending',
|
|
113
|
+
])
|
|
114
|
+
.optional(),
|
|
115
|
+
perPage: zod_1.z.number().default(30),
|
|
116
|
+
page: zod_1.z.number().default(1),
|
|
117
|
+
})
|
|
118
|
+
.strict(),
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Object)
|
|
121
|
+
], GitHubListWorkflowRunsTool.prototype, "args", void 0);
|
|
122
|
+
exports.GitHubListWorkflowRunsTool = GitHubListWorkflowRunsTool = GitHubListWorkflowRunsTool_1 = __decorate([
|
|
123
|
+
(0, common_2.Tool)({
|
|
124
|
+
config: {
|
|
125
|
+
description: 'Lists workflow runs for a GitHub repository. Returns { error: "unauthorized" } if no valid token is available.',
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
], GitHubListWorkflowRunsTool);
|
|
129
|
+
//# sourceMappingURL=github-list-workflow-runs.tool.js.map
|