@github-tools/eve-extension 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -10
- package/dist/extension/_manifest.json +3 -3
- package/dist/extension/extension.d.ts +124 -1
- package/dist/extension/extension.d.ts.map +1 -1
- package/dist/extension/extension.mjs +7 -1
- package/dist/extension/tools/github.d.ts +2 -1
- package/dist/extension/tools/github.d.ts.map +1 -1
- package/dist/extension/tools/github.mjs +4 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<img src="https://github.com/vercel-labs/github-tools/blob/main/assets/banner.jpg" width="100%" alt="GitHub
|
|
1
|
+
<img src="https://github.com/vercel-labs/github-tools/blob/main/assets/banner.jpg" width="100%" alt="GitHub tools banner" />
|
|
2
2
|
|
|
3
3
|
# @github-tools/eve-extension
|
|
4
4
|
|
|
@@ -7,11 +7,11 @@
|
|
|
7
7
|
[](https://www.typescriptlang.org/)
|
|
8
8
|
[](https://github.com/vercel-labs/github-tools/blob/main/LICENSE)
|
|
9
9
|
|
|
10
|
-
GitHub tools for [eve](https://eve.dev), packaged as a mountable [eve extension](https://eve.dev/docs/extensions)
|
|
10
|
+
GitHub tools for [eve](https://eve.dev), packaged as a mountable [eve extension](https://eve.dev/docs/extensions): a single `pnpm add` and a one-line mount, with no CLI setup. Built on top of [`@github-tools/sdk/eve`](../github-tools#eve).
|
|
11
11
|
|
|
12
|
-
Docs: **[github-tools.com/frameworks/eve](https://github-tools.com/frameworks/eve
|
|
12
|
+
Docs: **[github-tools.com/frameworks/eve-extension](https://github-tools.com/frameworks/eve-extension)**
|
|
13
13
|
|
|
14
|
-
This is the recommended
|
|
14
|
+
This is **the recommended way** to add GitHub tools to an eve agent. The direct [`@github-tools/sdk/eve`](../github-tools#eve) import is **deprecated** in its favor. It keeps working for agents that already import tools directly into `agent/tools/`, but new agents should mount this extension instead.
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -40,9 +40,35 @@ export default githubExtension({
|
|
|
40
40
|
})
|
|
41
41
|
```
|
|
42
42
|
|
|
43
|
-
> `code-review` pairs cleanly with a Connect `connector
|
|
43
|
+
> `code-review` pairs cleanly with a Connect `connector`. `maintainer` and `repo-explorer` include gist tools, and GitHub only grants gist access to user access tokens, never the installation tokens Connect mints, so gist calls 403 over Connect. Write tools already require approval via `always()` by default, so a plain `{ someTool: true }` is a no-op, use a predicate (as above) when you actually want to narrow or loosen the default.
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
`connector` also accepts a `() => string | Promise<string>` resolver, so the same config can pick a connector dynamically (e.g. by environment):
|
|
46
|
+
|
|
47
|
+
```ts
|
|
48
|
+
export default githubExtension({
|
|
49
|
+
connector: () => (process.env.VERCEL_ENV === 'production' ? 'github/prod-connector' : 'github/preview-connector'),
|
|
50
|
+
preset: 'code-review',
|
|
51
|
+
})
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Tools are exposed to the model as `<namespace>__<toolName>`, where `<namespace>` comes from the mount file's name: `agent/extensions/github.ts` yields `github__listPullRequests`, `github__createIssue`, and so on.
|
|
55
|
+
|
|
56
|
+
To hand-pick an exact set of tools instead of a preset, pass `include`:
|
|
57
|
+
|
|
58
|
+
```ts
|
|
59
|
+
export default githubExtension({
|
|
60
|
+
include: ['getRepository', 'listPullRequests', 'mergePullRequest'],
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
`include` **adds** to `preset` (union), use it to pull in a tool a preset is missing. `exclude` **removes** tool names from the resolved `preset` + `include` set, use it to drop a couple of tools from a larger preset:
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
export default githubExtension({
|
|
68
|
+
preset: 'maintainer',
|
|
69
|
+
exclude: ['createRepository', 'deleteGist'],
|
|
70
|
+
})
|
|
71
|
+
```
|
|
46
72
|
|
|
47
73
|
See the runnable consumer at [`examples/eve-extension-agent`](../../examples/eve-extension-agent).
|
|
48
74
|
|
|
@@ -50,9 +76,9 @@ See the runnable consumer at [`examples/eve-extension-agent`](../../examples/eve
|
|
|
50
76
|
|
|
51
77
|
```
|
|
52
78
|
extension/
|
|
53
|
-
extension.ts # defineExtension() config schema (token, connector, preset, requireApproval, ...)
|
|
79
|
+
extension.ts # defineExtension() config schema (token, connector, preset, include, exclude, requireApproval, ...)
|
|
54
80
|
tools/
|
|
55
|
-
github.ts # defineDynamic() returning buildEveToolMap(...)
|
|
81
|
+
github.ts # defineDynamic() returning buildEveToolMap(...) scoped by preset/include/exclude
|
|
56
82
|
```
|
|
57
83
|
|
|
58
84
|
## Config schema (`extension/extension.ts`)
|
|
@@ -60,9 +86,11 @@ extension/
|
|
|
60
86
|
| Field | Type | Notes |
|
|
61
87
|
|---|---|---|
|
|
62
88
|
| `token` | `string?` | Falls back to `GITHUB_TOKEN` when omitted and `connector` is not set |
|
|
63
|
-
| `connector` | `string
|
|
89
|
+
| `connector` | `string \| (() => string \| Promise<string>)` (optional) | Vercel Connect connector name, or a resolver to pick one dynamically (e.g. per environment/tenant); takes priority over `token` |
|
|
64
90
|
| `connect` | `record?` | Passed through to `getToken` when `connector` is set |
|
|
65
|
-
| `preset` | preset name or array | `code-review`, `issue-triage`, `ci-ops`, `repo-explorer`, `maintainer` |
|
|
91
|
+
| `preset` | preset name or array | `code-review`, `issue-triage`, `ci-ops`, `repo-explorer`, `security-audit`, `release-manager`, `maintainer` |
|
|
92
|
+
| `include` | `string[]?` | Tool names to add on top of `preset` (union), or the full set standalone |
|
|
93
|
+
| `exclude` | `string[]?` | Tool names to remove from the resolved `preset` + `include` set |
|
|
66
94
|
| `requireApproval` | `boolean \| record` | Global or per-tool; per-tool values may be predicate functions |
|
|
67
95
|
| `overrides` | `record` | Per-tool `description` / `approval` / `toModelOutput` / `outputSchema` |
|
|
68
96
|
| `author` / `committer` / `coAuthors` | commit identity | Attribution for commit-creating tools |
|
|
@@ -1,21 +1,144 @@
|
|
|
1
|
+
import type { GithubConnectorInput } from '@github-tools/sdk/connect';
|
|
1
2
|
import { z } from 'zod';
|
|
2
3
|
declare const _default: import("eve/extension").ExtensionHandle<z.ZodObject<{
|
|
3
4
|
token: z.ZodOptional<z.ZodString>;
|
|
4
|
-
connector: z.ZodOptional<z.
|
|
5
|
+
connector: z.ZodOptional<z.ZodCustom<GithubConnectorInput, GithubConnectorInput>>;
|
|
5
6
|
connect: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
6
7
|
preset: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
7
8
|
"code-review": "code-review";
|
|
8
9
|
"issue-triage": "issue-triage";
|
|
9
10
|
"ci-ops": "ci-ops";
|
|
10
11
|
"repo-explorer": "repo-explorer";
|
|
12
|
+
"security-audit": "security-audit";
|
|
13
|
+
"release-manager": "release-manager";
|
|
11
14
|
maintainer: "maintainer";
|
|
12
15
|
}>, z.ZodArray<z.ZodEnum<{
|
|
13
16
|
"code-review": "code-review";
|
|
14
17
|
"issue-triage": "issue-triage";
|
|
15
18
|
"ci-ops": "ci-ops";
|
|
16
19
|
"repo-explorer": "repo-explorer";
|
|
20
|
+
"security-audit": "security-audit";
|
|
21
|
+
"release-manager": "release-manager";
|
|
17
22
|
maintainer: "maintainer";
|
|
18
23
|
}>>]>>;
|
|
24
|
+
include: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
25
|
+
getRepository: "getRepository";
|
|
26
|
+
listBranches: "listBranches";
|
|
27
|
+
getFileContent: "getFileContent";
|
|
28
|
+
getRepositoryTree: "getRepositoryTree";
|
|
29
|
+
createBranch: "createBranch";
|
|
30
|
+
forkRepository: "forkRepository";
|
|
31
|
+
createRepository: "createRepository";
|
|
32
|
+
createOrUpdateFile: "createOrUpdateFile";
|
|
33
|
+
listPullRequests: "listPullRequests";
|
|
34
|
+
getPullRequest: "getPullRequest";
|
|
35
|
+
createPullRequest: "createPullRequest";
|
|
36
|
+
mergePullRequest: "mergePullRequest";
|
|
37
|
+
addPullRequestComment: "addPullRequestComment";
|
|
38
|
+
listPullRequestFiles: "listPullRequestFiles";
|
|
39
|
+
listPullRequestReviews: "listPullRequestReviews";
|
|
40
|
+
createPullRequestReview: "createPullRequestReview";
|
|
41
|
+
requestReviewers: "requestReviewers";
|
|
42
|
+
getPullRequestContext: "getPullRequestContext";
|
|
43
|
+
listIssues: "listIssues";
|
|
44
|
+
getIssue: "getIssue";
|
|
45
|
+
getIssueContext: "getIssueContext";
|
|
46
|
+
createIssue: "createIssue";
|
|
47
|
+
addIssueComment: "addIssueComment";
|
|
48
|
+
closeIssue: "closeIssue";
|
|
49
|
+
listLabels: "listLabels";
|
|
50
|
+
addLabels: "addLabels";
|
|
51
|
+
removeLabel: "removeLabel";
|
|
52
|
+
addAssignees: "addAssignees";
|
|
53
|
+
removeAssignees: "removeAssignees";
|
|
54
|
+
searchCode: "searchCode";
|
|
55
|
+
searchRepositories: "searchRepositories";
|
|
56
|
+
listCommits: "listCommits";
|
|
57
|
+
getCommit: "getCommit";
|
|
58
|
+
getBlame: "getBlame";
|
|
59
|
+
compareCommits: "compareCommits";
|
|
60
|
+
listGists: "listGists";
|
|
61
|
+
getGist: "getGist";
|
|
62
|
+
listGistComments: "listGistComments";
|
|
63
|
+
createGist: "createGist";
|
|
64
|
+
updateGist: "updateGist";
|
|
65
|
+
deleteGist: "deleteGist";
|
|
66
|
+
createGistComment: "createGistComment";
|
|
67
|
+
listWorkflows: "listWorkflows";
|
|
68
|
+
listWorkflowRuns: "listWorkflowRuns";
|
|
69
|
+
getWorkflowRun: "getWorkflowRun";
|
|
70
|
+
listWorkflowJobs: "listWorkflowJobs";
|
|
71
|
+
triggerWorkflow: "triggerWorkflow";
|
|
72
|
+
cancelWorkflowRun: "cancelWorkflowRun";
|
|
73
|
+
rerunWorkflowRun: "rerunWorkflowRun";
|
|
74
|
+
listCheckRuns: "listCheckRuns";
|
|
75
|
+
getCombinedStatus: "getCombinedStatus";
|
|
76
|
+
getCiFailureContext: "getCiFailureContext";
|
|
77
|
+
listReleases: "listReleases";
|
|
78
|
+
getLatestRelease: "getLatestRelease";
|
|
79
|
+
getRelease: "getRelease";
|
|
80
|
+
getReleaseContext: "getReleaseContext";
|
|
81
|
+
createRelease: "createRelease";
|
|
82
|
+
}>>>;
|
|
83
|
+
exclude: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
84
|
+
getRepository: "getRepository";
|
|
85
|
+
listBranches: "listBranches";
|
|
86
|
+
getFileContent: "getFileContent";
|
|
87
|
+
getRepositoryTree: "getRepositoryTree";
|
|
88
|
+
createBranch: "createBranch";
|
|
89
|
+
forkRepository: "forkRepository";
|
|
90
|
+
createRepository: "createRepository";
|
|
91
|
+
createOrUpdateFile: "createOrUpdateFile";
|
|
92
|
+
listPullRequests: "listPullRequests";
|
|
93
|
+
getPullRequest: "getPullRequest";
|
|
94
|
+
createPullRequest: "createPullRequest";
|
|
95
|
+
mergePullRequest: "mergePullRequest";
|
|
96
|
+
addPullRequestComment: "addPullRequestComment";
|
|
97
|
+
listPullRequestFiles: "listPullRequestFiles";
|
|
98
|
+
listPullRequestReviews: "listPullRequestReviews";
|
|
99
|
+
createPullRequestReview: "createPullRequestReview";
|
|
100
|
+
requestReviewers: "requestReviewers";
|
|
101
|
+
getPullRequestContext: "getPullRequestContext";
|
|
102
|
+
listIssues: "listIssues";
|
|
103
|
+
getIssue: "getIssue";
|
|
104
|
+
getIssueContext: "getIssueContext";
|
|
105
|
+
createIssue: "createIssue";
|
|
106
|
+
addIssueComment: "addIssueComment";
|
|
107
|
+
closeIssue: "closeIssue";
|
|
108
|
+
listLabels: "listLabels";
|
|
109
|
+
addLabels: "addLabels";
|
|
110
|
+
removeLabel: "removeLabel";
|
|
111
|
+
addAssignees: "addAssignees";
|
|
112
|
+
removeAssignees: "removeAssignees";
|
|
113
|
+
searchCode: "searchCode";
|
|
114
|
+
searchRepositories: "searchRepositories";
|
|
115
|
+
listCommits: "listCommits";
|
|
116
|
+
getCommit: "getCommit";
|
|
117
|
+
getBlame: "getBlame";
|
|
118
|
+
compareCommits: "compareCommits";
|
|
119
|
+
listGists: "listGists";
|
|
120
|
+
getGist: "getGist";
|
|
121
|
+
listGistComments: "listGistComments";
|
|
122
|
+
createGist: "createGist";
|
|
123
|
+
updateGist: "updateGist";
|
|
124
|
+
deleteGist: "deleteGist";
|
|
125
|
+
createGistComment: "createGistComment";
|
|
126
|
+
listWorkflows: "listWorkflows";
|
|
127
|
+
listWorkflowRuns: "listWorkflowRuns";
|
|
128
|
+
getWorkflowRun: "getWorkflowRun";
|
|
129
|
+
listWorkflowJobs: "listWorkflowJobs";
|
|
130
|
+
triggerWorkflow: "triggerWorkflow";
|
|
131
|
+
cancelWorkflowRun: "cancelWorkflowRun";
|
|
132
|
+
rerunWorkflowRun: "rerunWorkflowRun";
|
|
133
|
+
listCheckRuns: "listCheckRuns";
|
|
134
|
+
getCombinedStatus: "getCombinedStatus";
|
|
135
|
+
getCiFailureContext: "getCiFailureContext";
|
|
136
|
+
listReleases: "listReleases";
|
|
137
|
+
getLatestRelease: "getLatestRelease";
|
|
138
|
+
getRelease: "getRelease";
|
|
139
|
+
getReleaseContext: "getReleaseContext";
|
|
140
|
+
createRelease: "createRelease";
|
|
141
|
+
}>>>;
|
|
19
142
|
requireApproval: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
|
|
20
143
|
overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
21
144
|
author: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../extension/extension.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../extension/extension.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AAGrE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUvB,wBA+BE"}
|
|
@@ -3,6 +3,7 @@ import { dirname as __eveDirname } from "node:path";
|
|
|
3
3
|
import { createRequire as __eveCreateRequire } from "node:module";
|
|
4
4
|
__eveDirname(__eveFileURLToPath(import.meta.url));
|
|
5
5
|
__eveCreateRequire(import.meta.url);
|
|
6
|
+
import { GITHUB_TOOL_NAMES } from "@github-tools/sdk/eve";
|
|
6
7
|
import { defineExtension } from "eve/extension";
|
|
7
8
|
import { z } from "zod";
|
|
8
9
|
const presetNameSchema = z.enum([
|
|
@@ -10,17 +11,22 @@ const presetNameSchema = z.enum([
|
|
|
10
11
|
"issue-triage",
|
|
11
12
|
"ci-ops",
|
|
12
13
|
"repo-explorer",
|
|
14
|
+
"security-audit",
|
|
15
|
+
"release-manager",
|
|
13
16
|
"maintainer"
|
|
14
17
|
]);
|
|
18
|
+
const toolNameSchema = z.enum(Object.values(GITHUB_TOOL_NAMES));
|
|
15
19
|
const commitIdentitySchema = z.object({
|
|
16
20
|
name: z.string(),
|
|
17
21
|
email: z.string()
|
|
18
22
|
});
|
|
19
23
|
var extension_default = defineExtension({ config: z.object({
|
|
20
24
|
token: z.string().optional(),
|
|
21
|
-
connector: z.
|
|
25
|
+
connector: z.custom((value) => typeof value === "string" || typeof value === "function").optional(),
|
|
22
26
|
connect: z.record(z.string(), z.unknown()).optional(),
|
|
23
27
|
preset: z.union([presetNameSchema, z.array(presetNameSchema)]).optional(),
|
|
28
|
+
include: z.array(toolNameSchema).optional(),
|
|
29
|
+
exclude: z.array(toolNameSchema).optional(),
|
|
24
30
|
requireApproval: z.union([z.boolean(), z.record(z.string(), z.unknown())]).optional(),
|
|
25
31
|
overrides: z.record(z.string(), z.unknown()).optional(),
|
|
26
32
|
author: commitIdentitySchema.optional(),
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { type GithubToolName } from '@github-tools/sdk/eve';
|
|
2
|
+
declare const _default: import("eve/tools").DynamicSentinel<Partial<Record<GithubToolName, import("eve/tools").ToolDefinition<unknown, unknown>>>>;
|
|
2
3
|
export default _default;
|
|
3
4
|
//# sourceMappingURL=github.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":"AACA,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAA;;AAI3H,wBAsBE"}
|
|
@@ -4,17 +4,19 @@ import { createRequire as __eveCreateRequire } from "node:module";
|
|
|
4
4
|
__eveDirname(__eveFileURLToPath(import.meta.url));
|
|
5
5
|
__eveCreateRequire(import.meta.url);
|
|
6
6
|
import extension_default from "../extension.mjs";
|
|
7
|
-
import { connectGithubToken } from "@github-tools/sdk/connect";
|
|
8
7
|
import { buildEveToolMap } from "@github-tools/sdk/eve";
|
|
8
|
+
import { connectGithubToken } from "@github-tools/sdk/connect";
|
|
9
9
|
import { defineDynamic } from "eve/tools";
|
|
10
10
|
var github_default = defineDynamic({ events: { "session.started": async () => {
|
|
11
|
-
const { token, connector, connect, preset, requireApproval, overrides, author, committer, coAuthors } = extension_default.config;
|
|
11
|
+
const { token, connector, connect, preset, include, exclude, requireApproval, overrides, author, committer, coAuthors } = extension_default.config;
|
|
12
12
|
return buildEveToolMap({
|
|
13
13
|
token: connector ? connectGithubToken(connector, {
|
|
14
14
|
preset,
|
|
15
15
|
params: connect
|
|
16
16
|
}) : token,
|
|
17
17
|
preset,
|
|
18
|
+
include,
|
|
19
|
+
exclude,
|
|
18
20
|
requireApproval,
|
|
19
21
|
overrides,
|
|
20
22
|
author,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@github-tools/eve-extension",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "GitHub tools for eve, distributed as a mountable eve extension (https://eve.dev/docs/extensions)",
|
|
5
5
|
"author": "HugoRCD <hugo.richard@vercel.com>",
|
|
6
6
|
"repository": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"license": "MIT",
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"zod": "^4.3.6",
|
|
49
|
-
"@github-tools/sdk": "1.
|
|
49
|
+
"@github-tools/sdk": "1.9.0"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@vercel/connect": ">=0.3.2",
|
|
@@ -58,12 +58,12 @@
|
|
|
58
58
|
}
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
|
-
"@types/node": "^
|
|
62
|
-
"@vercel/connect": "^0.
|
|
63
|
-
"eslint": "^10.
|
|
64
|
-
"eve": "^0.
|
|
61
|
+
"@types/node": "^26.1.2",
|
|
62
|
+
"@vercel/connect": "^0.6.1",
|
|
63
|
+
"eslint": "^10.8.0",
|
|
64
|
+
"eve": "^0.30.6",
|
|
65
65
|
"typescript": "^6.0.3",
|
|
66
|
-
"typescript-eslint": "^8.
|
|
66
|
+
"typescript-eslint": "^8.65.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|