@gemstack/connector-github 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/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/client.d.ts +14 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +41 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +174 -0
- package/dist/index.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Suleiman Shahbari
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# @gemstack/connector-github
|
|
2
|
+
|
|
3
|
+
A GitHub connector for GemStack AI orchestration. Read and act on issues, pull requests, and repository files over the GitHub REST API. Built with [`@gemstack/connectors`](../connectors); the result is a standard `@gemstack/mcp` server.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm i @gemstack/connector-github @gemstack/connectors @gemstack/mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Use
|
|
12
|
+
|
|
13
|
+
```ts
|
|
14
|
+
import { mountConnectors } from '@gemstack/connectors'
|
|
15
|
+
import { Mcp } from '@gemstack/mcp'
|
|
16
|
+
import github from '@gemstack/connector-github'
|
|
17
|
+
|
|
18
|
+
const Server = mountConnectors([github], {
|
|
19
|
+
// A token with `repo` scope. A PAT or an OAuth bearer both work.
|
|
20
|
+
credentials: () => ({ token: process.env.GITHUB_TOKEN }),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
Mcp.web('/mcp/github', Server)
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Tools are exposed namespaced by connector id, e.g. `github_list-issues`.
|
|
27
|
+
|
|
28
|
+
## Auth
|
|
29
|
+
|
|
30
|
+
The connector declares `auth: { type: 'pat', env: 'GITHUB_TOKEN' }`. It only consumes a bearer token from `ctx.auth.token` — it does no OAuth handshake itself. To protect a web endpoint with OAuth 2.1, wrap it with `@gemstack/mcp`'s `oauth2McpMiddleware` + `registerOAuth2Metadata` and feed the verified token through the mount `credentials` option.
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
| Tool | Kind | Description |
|
|
35
|
+
|---|---|---|
|
|
36
|
+
| `get-repo` | read | Repository metadata |
|
|
37
|
+
| `list-issues` | read | Issues (excludes PRs) |
|
|
38
|
+
| `get-issue` | read | One issue by number |
|
|
39
|
+
| `list-pull-requests` | read | Pull requests |
|
|
40
|
+
| `get-pull-request` | read | One PR by number |
|
|
41
|
+
| `get-file` | read | File contents (base64-decoded) |
|
|
42
|
+
| `search-issues` | read | Search issues/PRs (GitHub search syntax) |
|
|
43
|
+
| `comment-on-issue` | write | Comment on an issue or PR |
|
|
44
|
+
| `create-issue` | write | Open a new issue |
|
|
45
|
+
|
|
46
|
+
Read tools are annotated `readOnly` so an agent can auto-approve them; write tools are not.
|
|
47
|
+
|
|
48
|
+
Responses are slimmed to the fields an agent needs (no raw API envelopes) to keep token usage down.
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ConnectorContext } from '@gemstack/connectors';
|
|
2
|
+
/** Thrown when the GitHub API returns a non-2xx response. */
|
|
3
|
+
export declare class GitHubError extends Error {
|
|
4
|
+
status: number;
|
|
5
|
+
constructor(status: number, message: string);
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Minimal GitHub REST client over global `fetch`. The bearer token comes from
|
|
9
|
+
* the connector context (`ctx.auth.token`) — a PAT or an OAuth token; GitHub
|
|
10
|
+
* accepts either as `Authorization: Bearer`. No SDK dependency, so the connector
|
|
11
|
+
* stays light.
|
|
12
|
+
*/
|
|
13
|
+
export declare function gh<T = unknown>(ctx: ConnectorContext, method: string, path: string, body?: unknown): Promise<T>;
|
|
14
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAI5D,6DAA6D;AAC7D,qBAAa,WAAY,SAAQ,KAAK;IAE3B,MAAM,EAAE,MAAM;gBAAd,MAAM,EAAE,MAAM,EACrB,OAAO,EAAE,MAAM;CAKlB;AAED;;;;;GAKG;AACH,wBAAsB,EAAE,CAAC,CAAC,GAAG,OAAO,EAClC,GAAG,EAAE,gBAAgB,EACrB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,GACb,OAAO,CAAC,CAAC,CAAC,CAyBZ"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const API = 'https://api.github.com';
|
|
2
|
+
/** Thrown when the GitHub API returns a non-2xx response. */
|
|
3
|
+
export class GitHubError extends Error {
|
|
4
|
+
status;
|
|
5
|
+
constructor(status, message) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.status = status;
|
|
8
|
+
this.name = 'GitHubError';
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Minimal GitHub REST client over global `fetch`. The bearer token comes from
|
|
13
|
+
* the connector context (`ctx.auth.token`) — a PAT or an OAuth token; GitHub
|
|
14
|
+
* accepts either as `Authorization: Bearer`. No SDK dependency, so the connector
|
|
15
|
+
* stays light.
|
|
16
|
+
*/
|
|
17
|
+
export async function gh(ctx, method, path, body) {
|
|
18
|
+
const token = ctx.auth.token;
|
|
19
|
+
if (!token) {
|
|
20
|
+
throw new GitHubError(401, 'no GitHub token available — set GITHUB_TOKEN or provide one via the mount `credentials` option');
|
|
21
|
+
}
|
|
22
|
+
const res = await fetch(`${API}${path}`, {
|
|
23
|
+
method,
|
|
24
|
+
headers: {
|
|
25
|
+
Authorization: `Bearer ${token}`,
|
|
26
|
+
Accept: 'application/vnd.github+json',
|
|
27
|
+
'X-GitHub-Api-Version': '2022-11-28',
|
|
28
|
+
'User-Agent': 'gemstack-connector-github',
|
|
29
|
+
...(body !== undefined ? { 'Content-Type': 'application/json' } : {}),
|
|
30
|
+
},
|
|
31
|
+
...(body !== undefined ? { body: JSON.stringify(body) } : {}),
|
|
32
|
+
});
|
|
33
|
+
if (!res.ok) {
|
|
34
|
+
const detail = await res.text().catch(() => '');
|
|
35
|
+
throw new GitHubError(res.status, `${method} ${path} -> ${res.status} ${res.statusText}${detail ? `: ${detail}` : ''}`);
|
|
36
|
+
}
|
|
37
|
+
if (res.status === 204)
|
|
38
|
+
return undefined;
|
|
39
|
+
return (await res.json());
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAEA,MAAM,GAAG,GAAG,wBAAwB,CAAA;AAEpC,6DAA6D;AAC7D,MAAM,OAAO,WAAY,SAAQ,KAAK;IAE3B;IADT,YACS,MAAc,EACrB,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAA;QAHP,WAAM,GAAN,MAAM,CAAQ;QAIrB,IAAI,CAAC,IAAI,GAAG,aAAa,CAAA;IAC3B,CAAC;CACF;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,EAAE,CACtB,GAAqB,EACrB,MAAc,EACd,IAAY,EACZ,IAAc;IAEd,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAA;IAC5B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,WAAW,CACnB,GAAG,EACH,gGAAgG,CACjG,CAAA;IACH,CAAC;IACD,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,GAAG,GAAG,IAAI,EAAE,EAAE;QACvC,MAAM;QACN,OAAO,EAAE;YACP,aAAa,EAAE,UAAU,KAAK,EAAE;YAChC,MAAM,EAAE,6BAA6B;YACrC,sBAAsB,EAAE,YAAY;YACpC,YAAY,EAAE,2BAA2B;YACzC,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,kBAAkB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtE;QACD,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D,CAAC,CAAA;IACF,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAA;QAC/C,MAAM,IAAI,WAAW,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,MAAM,IAAI,IAAI,OAAO,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,UAAU,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAA;IACzH,CAAC;IACD,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,SAAc,CAAA;IAC7C,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAA;AAChC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { GitHubError } from './client.js';
|
|
2
|
+
/**
|
|
3
|
+
* GitHub connector: read and act on issues, pull requests, and repo files.
|
|
4
|
+
*
|
|
5
|
+
* Auth is a token with `repo` scope. Declared as `pat` (set `GITHUB_TOKEN`),
|
|
6
|
+
* but an OAuth bearer works identically — the orchestrator supplies whichever
|
|
7
|
+
* via the mount `credentials` option.
|
|
8
|
+
*/
|
|
9
|
+
declare const _default: import("@gemstack/connectors").Connector;
|
|
10
|
+
export default _default;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAkCzC;;;;;;GAMG;;AACH,wBAmKE"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { defineConnector } from '@gemstack/connectors';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { gh } from './client.js';
|
|
4
|
+
export { GitHubError } from './client.js';
|
|
5
|
+
const repo = { owner: z.string().min(1), repo: z.string().min(1) };
|
|
6
|
+
const enc = encodeURIComponent;
|
|
7
|
+
/** Slim an API issue (or PR-as-issue) down to the fields an agent needs. */
|
|
8
|
+
function slimIssue(i) {
|
|
9
|
+
return {
|
|
10
|
+
number: i.number,
|
|
11
|
+
title: i.title,
|
|
12
|
+
state: i.state,
|
|
13
|
+
author: i.user?.login,
|
|
14
|
+
labels: Array.isArray(i.labels) ? i.labels.map((l) => (typeof l === 'string' ? l : l?.name)) : [],
|
|
15
|
+
comments: i.comments,
|
|
16
|
+
isPullRequest: i.pull_request != null,
|
|
17
|
+
url: i.html_url,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
function slimPull(p) {
|
|
21
|
+
return {
|
|
22
|
+
number: p.number,
|
|
23
|
+
title: p.title,
|
|
24
|
+
state: p.state,
|
|
25
|
+
draft: p.draft,
|
|
26
|
+
author: p.user?.login,
|
|
27
|
+
head: p.head?.ref,
|
|
28
|
+
base: p.base?.ref,
|
|
29
|
+
merged: p.merged,
|
|
30
|
+
mergeable: p.mergeable,
|
|
31
|
+
url: p.html_url,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* GitHub connector: read and act on issues, pull requests, and repo files.
|
|
36
|
+
*
|
|
37
|
+
* Auth is a token with `repo` scope. Declared as `pat` (set `GITHUB_TOKEN`),
|
|
38
|
+
* but an OAuth bearer works identically — the orchestrator supplies whichever
|
|
39
|
+
* via the mount `credentials` option.
|
|
40
|
+
*/
|
|
41
|
+
export default defineConnector({
|
|
42
|
+
id: 'github',
|
|
43
|
+
name: 'GitHub',
|
|
44
|
+
instructions: 'Read and act on GitHub issues, pull requests, and repository files.',
|
|
45
|
+
auth: { type: 'pat', env: 'GITHUB_TOKEN', description: 'GitHub token with `repo` scope (PAT or OAuth bearer)' },
|
|
46
|
+
tools: [
|
|
47
|
+
{
|
|
48
|
+
name: 'get-repo',
|
|
49
|
+
description: 'Get metadata for a repository.',
|
|
50
|
+
schema: z.object({ ...repo }),
|
|
51
|
+
annotations: { readOnly: true, openWorld: true },
|
|
52
|
+
handle: async (input, ctx) => {
|
|
53
|
+
const r = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}`);
|
|
54
|
+
return {
|
|
55
|
+
fullName: r.full_name,
|
|
56
|
+
description: r.description,
|
|
57
|
+
private: r.private,
|
|
58
|
+
defaultBranch: r.default_branch,
|
|
59
|
+
stars: r.stargazers_count,
|
|
60
|
+
openIssues: r.open_issues_count,
|
|
61
|
+
url: r.html_url,
|
|
62
|
+
};
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'list-issues',
|
|
67
|
+
description: 'List issues in a repository (newest first). Excludes pull requests.',
|
|
68
|
+
schema: z.object({
|
|
69
|
+
...repo,
|
|
70
|
+
state: z.enum(['open', 'closed', 'all']).optional(),
|
|
71
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
72
|
+
}),
|
|
73
|
+
annotations: { readOnly: true, openWorld: true },
|
|
74
|
+
handle: async (input, ctx) => {
|
|
75
|
+
const q = new URLSearchParams({ state: input.state ?? 'open', per_page: String(input.limit ?? 30) });
|
|
76
|
+
const issues = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}/issues?${q}`);
|
|
77
|
+
return issues.filter((i) => i.pull_request == null).map(slimIssue);
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'get-issue',
|
|
82
|
+
description: 'Get a single issue by number.',
|
|
83
|
+
schema: z.object({ ...repo, number: z.number().int().positive() }),
|
|
84
|
+
annotations: { readOnly: true, openWorld: true },
|
|
85
|
+
handle: async (input, ctx) => {
|
|
86
|
+
const i = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}/issues/${input.number}`);
|
|
87
|
+
return { ...slimIssue(i), body: i.body };
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'list-pull-requests',
|
|
92
|
+
description: 'List pull requests in a repository.',
|
|
93
|
+
schema: z.object({
|
|
94
|
+
...repo,
|
|
95
|
+
state: z.enum(['open', 'closed', 'all']).optional(),
|
|
96
|
+
limit: z.number().int().min(1).max(100).optional(),
|
|
97
|
+
}),
|
|
98
|
+
annotations: { readOnly: true, openWorld: true },
|
|
99
|
+
handle: async (input, ctx) => {
|
|
100
|
+
const q = new URLSearchParams({ state: input.state ?? 'open', per_page: String(input.limit ?? 30) });
|
|
101
|
+
const pulls = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}/pulls?${q}`);
|
|
102
|
+
return pulls.map(slimPull);
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'get-pull-request',
|
|
107
|
+
description: 'Get a single pull request by number.',
|
|
108
|
+
schema: z.object({ ...repo, number: z.number().int().positive() }),
|
|
109
|
+
annotations: { readOnly: true, openWorld: true },
|
|
110
|
+
handle: async (input, ctx) => {
|
|
111
|
+
const p = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}/pulls/${input.number}`);
|
|
112
|
+
return { ...slimPull(p), body: p.body, additions: p.additions, deletions: p.deletions, changedFiles: p.changed_files };
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: 'get-file',
|
|
117
|
+
description: 'Read the contents of a file in a repository.',
|
|
118
|
+
schema: z.object({ ...repo, path: z.string().min(1), ref: z.string().optional() }),
|
|
119
|
+
annotations: { readOnly: true, openWorld: true },
|
|
120
|
+
handle: async (input, ctx) => {
|
|
121
|
+
const q = input.ref ? `?ref=${enc(input.ref)}` : '';
|
|
122
|
+
const f = await gh(ctx, 'GET', `/repos/${enc(input.owner)}/${enc(input.repo)}/contents/${input.path.split('/').map(enc).join('/')}${q}`);
|
|
123
|
+
if (Array.isArray(f))
|
|
124
|
+
return { error: `path "${input.path}" is a directory, not a file` };
|
|
125
|
+
const content = f.encoding === 'base64' && typeof f.content === 'string'
|
|
126
|
+
? Buffer.from(f.content, 'base64').toString('utf8')
|
|
127
|
+
: f.content;
|
|
128
|
+
return { path: f.path, size: f.size, sha: f.sha, content };
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
name: 'search-issues',
|
|
133
|
+
description: 'Search issues and pull requests across GitHub with a query (GitHub search syntax).',
|
|
134
|
+
schema: z.object({ query: z.string().min(1), limit: z.number().int().min(1).max(100).optional() }),
|
|
135
|
+
annotations: { readOnly: true, openWorld: true },
|
|
136
|
+
handle: async (input, ctx) => {
|
|
137
|
+
const q = new URLSearchParams({ q: input.query, per_page: String(input.limit ?? 20) });
|
|
138
|
+
const res = await gh(ctx, 'GET', `/search/issues?${q}`);
|
|
139
|
+
return { totalCount: res.total_count, items: res.items.map(slimIssue) };
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: 'comment-on-issue',
|
|
144
|
+
description: 'Add a comment to an issue or pull request.',
|
|
145
|
+
schema: z.object({ ...repo, number: z.number().int().positive(), body: z.string().min(1) }),
|
|
146
|
+
annotations: { openWorld: true },
|
|
147
|
+
handle: async (input, ctx) => {
|
|
148
|
+
const c = await gh(ctx, 'POST', `/repos/${enc(input.owner)}/${enc(input.repo)}/issues/${input.number}/comments`, { body: input.body });
|
|
149
|
+
return { id: c.id, url: c.html_url };
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
name: 'create-issue',
|
|
154
|
+
description: 'Open a new issue in a repository.',
|
|
155
|
+
schema: z.object({
|
|
156
|
+
...repo,
|
|
157
|
+
title: z.string().min(1),
|
|
158
|
+
body: z.string().optional(),
|
|
159
|
+
labels: z.array(z.string()).optional(),
|
|
160
|
+
}),
|
|
161
|
+
annotations: { openWorld: true },
|
|
162
|
+
handle: async (input, ctx) => {
|
|
163
|
+
const payload = { title: input.title };
|
|
164
|
+
if (input.body != null)
|
|
165
|
+
payload.body = input.body;
|
|
166
|
+
if (input.labels != null)
|
|
167
|
+
payload.labels = input.labels;
|
|
168
|
+
const i = await gh(ctx, 'POST', `/repos/${enc(input.owner)}/${enc(input.repo)}/issues`, payload);
|
|
169
|
+
return { number: i.number, url: i.html_url };
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AACtD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AAEzC,MAAM,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAA;AAClE,MAAM,GAAG,GAAG,kBAAkB,CAAA;AAE9B,4EAA4E;AAC5E,SAAS,SAAS,CAAC,CAAsB;IACvC,OAAO;QACL,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,KAAK,EAAE,CAAC,CAAC,KAAK;QACd,MAAM,EAAE,CAAC,CAAC,IAAI,EAAE,KAAK;QACrB,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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G,KAAK,CAAC,IAAI,CAAA;gBACjD,IAAI,KAAK,CAAC,MAAM,IAAI,IAAI;oBAAE,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,CAAA;gBACvD,MAAM,CAAC,GAAG,MAAM,EAAE,CAChB,GAAG,EACH,MAAM,EACN,UAAU,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EACtD,OAAO,CACR,CAAA;gBACD,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAA;YAC9C,CAAC;SACF;KACF;CACF,CAAC,CAAA"}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gemstack/connector-github",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "GitHub connector for GemStack AI orchestration: read and act on issues, pull requests, and repo files over the GitHub REST API. Built with @gemstack/connectors.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"mcp",
|
|
7
|
+
"connector",
|
|
8
|
+
"github",
|
|
9
|
+
"ai",
|
|
10
|
+
"agents",
|
|
11
|
+
"orchestration",
|
|
12
|
+
"gemstack"
|
|
13
|
+
],
|
|
14
|
+
"license": "MIT",
|
|
15
|
+
"homepage": "https://github.com/gemstack-land/gemstack/tree/main/packages/connector-github#readme",
|
|
16
|
+
"bugs": {
|
|
17
|
+
"url": "https://github.com/gemstack-land/gemstack/issues"
|
|
18
|
+
},
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/gemstack-land/gemstack",
|
|
22
|
+
"directory": "packages/connector-github"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"engines": {
|
|
26
|
+
"node": ">=22.12.0"
|
|
27
|
+
},
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"main": "./dist/index.js",
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"exports": {
|
|
34
|
+
".": {
|
|
35
|
+
"import": "./dist/index.js",
|
|
36
|
+
"types": "./dist/index.d.ts"
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"zod": "^4.0.0",
|
|
41
|
+
"@gemstack/connectors": "^0.1.0",
|
|
42
|
+
"@gemstack/mcp": "^0.2.1"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^20.0.0",
|
|
46
|
+
"reflect-metadata": "^0.2.0",
|
|
47
|
+
"typescript": "^5.4.0"
|
|
48
|
+
},
|
|
49
|
+
"author": "Suleiman Shahbari",
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -p tsconfig.build.json",
|
|
52
|
+
"dev": "tsc -p tsconfig.build.json --watch",
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test": "tsc -p tsconfig.test.json && cd dist-test && node --test",
|
|
55
|
+
"clean": "rm -rf dist dist-test"
|
|
56
|
+
}
|
|
57
|
+
}
|