@github-tools/eve-extension 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024-present Vercel, Inc.
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,80 @@
1
+ <img src="https://github.com/vercel-labs/github-tools/blob/main/assets/banner.jpg" width="100%" alt="GitHub Tools banner" />
2
+
3
+ # @github-tools/eve-extension
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@github-tools/eve-extension?color=black)](https://npmjs.com/package/@github-tools/eve-extension)
6
+ [![npm downloads](https://img.shields.io/npm/dm/@github-tools/eve-extension?color=black)](https://npm.chart.dev/@github-tools/eve-extension)
7
+ [![TypeScript](https://img.shields.io/badge/TypeScript-black?logo=typescript&logoColor=white)](https://www.typescriptlang.org/)
8
+ [![license](https://img.shields.io/github/license/vercel-labs/github-tools?color=black)](https://github.com/vercel-labs/github-tools/blob/main/LICENSE)
9
+
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
+
12
+ Docs: **[github-tools.com/frameworks/eve](https://github-tools.com/frameworks/eve#eve-extension)**
13
+
14
+ This is the recommended direction for adding GitHub tools to an eve agent going forward. The direct [`@github-tools/sdk/eve`](../github-tools#eve) import remains supported for agents that prefer importing tools directly into `agent/tools/`.
15
+
16
+ ## Installation
17
+
18
+ ```sh
19
+ pnpm add @github-tools/eve-extension
20
+ ```
21
+
22
+ `eve` is a required peer dependency; `@vercel/connect` is optional (install it only when using `connector`):
23
+
24
+ ```sh
25
+ pnpm add eve
26
+ ```
27
+
28
+ ## Mount it
29
+
30
+ ```ts
31
+ // agent/extensions/github.ts
32
+ import githubExtension from '@github-tools/eve-extension'
33
+
34
+ export default githubExtension({
35
+ connector: 'github/my-connector', // or token: process.env.GITHUB_TOKEN
36
+ preset: 'code-review',
37
+ requireApproval: {
38
+ addPullRequestComment: ({ toolInput }) => toolInput?.owner !== 'vercel-labs',
39
+ },
40
+ })
41
+ ```
42
+
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
+
45
+ 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.
46
+
47
+ See the runnable consumer at [`examples/eve-extension-agent`](../../examples/eve-extension-agent).
48
+
49
+ ## Structure
50
+
51
+ ```
52
+ extension/
53
+ extension.ts # defineExtension() config schema (token, connector, preset, requireApproval, ...)
54
+ tools/
55
+ github.ts # defineDynamic() returning buildEveToolMap(...) filtered by preset
56
+ ```
57
+
58
+ ## Config schema (`extension/extension.ts`)
59
+
60
+ | Field | Type | Notes |
61
+ |---|---|---|
62
+ | `token` | `string?` | Falls back to `GITHUB_TOKEN` when omitted and `connector` is not set |
63
+ | `connector` | `string?` | Vercel Connect connector name; takes priority over `token` |
64
+ | `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` |
66
+ | `requireApproval` | `boolean \| record` | Global or per-tool; per-tool values may be predicate functions |
67
+ | `overrides` | `record` | Per-tool `description` / `approval` / `toModelOutput` / `outputSchema` |
68
+ | `author` / `committer` / `coAuthors` | commit identity | Attribution for commit-creating tools |
69
+
70
+ ## Build (contributors)
71
+
72
+ ```sh
73
+ pnpm --filter @github-tools/eve-extension build # runs `eve extension build`
74
+ ```
75
+
76
+ ## License
77
+
78
+ [MIT](../../LICENSE)
79
+
80
+ Made by [@HugoRCD](https://github.com/HugoRCD)
@@ -0,0 +1,11 @@
1
+ {
2
+ "kind": "eve-extension",
3
+ "formatVersion": 1,
4
+ "builtWithEve": "0.26.2",
5
+ "requires": {
6
+ "extension": 1,
7
+ "tool": 1,
8
+ "dynamicTool": 2,
9
+ "config": 1
10
+ }
11
+ }
@@ -0,0 +1,35 @@
1
+ import { z } from 'zod';
2
+ declare const _default: import("eve/extension").ExtensionHandle<z.ZodObject<{
3
+ token: z.ZodOptional<z.ZodString>;
4
+ connector: z.ZodOptional<z.ZodString>;
5
+ connect: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
6
+ preset: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
7
+ "code-review": "code-review";
8
+ "issue-triage": "issue-triage";
9
+ "ci-ops": "ci-ops";
10
+ "repo-explorer": "repo-explorer";
11
+ maintainer: "maintainer";
12
+ }>, z.ZodArray<z.ZodEnum<{
13
+ "code-review": "code-review";
14
+ "issue-triage": "issue-triage";
15
+ "ci-ops": "ci-ops";
16
+ "repo-explorer": "repo-explorer";
17
+ maintainer: "maintainer";
18
+ }>>]>>;
19
+ requireApproval: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodRecord<z.ZodString, z.ZodUnknown>]>>;
20
+ overrides: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
21
+ author: z.ZodOptional<z.ZodObject<{
22
+ name: z.ZodString;
23
+ email: z.ZodString;
24
+ }, z.core.$strip>>;
25
+ committer: z.ZodOptional<z.ZodObject<{
26
+ name: z.ZodString;
27
+ email: z.ZodString;
28
+ }, z.core.$strip>>;
29
+ coAuthors: z.ZodOptional<z.ZodArray<z.ZodObject<{
30
+ name: z.ZodString;
31
+ email: z.ZodString;
32
+ }, z.core.$strip>>>;
33
+ }, z.core.$strip>>;
34
+ export default _default;
35
+ //# sourceMappingURL=extension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.d.ts","sourceRoot":"","sources":["../../../extension/extension.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASvB,wBAkBE"}
@@ -0,0 +1,30 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ __eveDirname(__eveFileURLToPath(import.meta.url));
5
+ __eveCreateRequire(import.meta.url);
6
+ import { defineExtension } from "eve/extension";
7
+ import { z } from "zod";
8
+ const presetNameSchema = z.enum([
9
+ "code-review",
10
+ "issue-triage",
11
+ "ci-ops",
12
+ "repo-explorer",
13
+ "maintainer"
14
+ ]);
15
+ const commitIdentitySchema = z.object({
16
+ name: z.string(),
17
+ email: z.string()
18
+ });
19
+ var extension_default = defineExtension({ config: z.object({
20
+ token: z.string().optional(),
21
+ connector: z.string().optional(),
22
+ connect: z.record(z.string(), z.unknown()).optional(),
23
+ preset: z.union([presetNameSchema, z.array(presetNameSchema)]).optional(),
24
+ requireApproval: z.union([z.boolean(), z.record(z.string(), z.unknown())]).optional(),
25
+ overrides: z.record(z.string(), z.unknown()).optional(),
26
+ author: commitIdentitySchema.optional(),
27
+ committer: commitIdentitySchema.optional(),
28
+ coAuthors: z.array(commitIdentitySchema).optional()
29
+ }) });
30
+ export { extension_default as default };
@@ -0,0 +1,3 @@
1
+ declare const _default: import("eve/tools").DynamicSentinel<Partial<Record<import("@github-tools/sdk/eve").GithubToolName, import("eve/tools").ToolDefinition<unknown, unknown>>>>;
2
+ export default _default;
3
+ //# sourceMappingURL=github.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github.d.ts","sourceRoot":"","sources":["../../../../extension/tools/github.ts"],"names":[],"mappings":";AAKA,wBAoBE"}
@@ -0,0 +1,25 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ __eveDirname(__eveFileURLToPath(import.meta.url));
5
+ __eveCreateRequire(import.meta.url);
6
+ import extension_default from "../extension.mjs";
7
+ import { connectGithubToken } from "@github-tools/sdk/connect";
8
+ import { buildEveToolMap } from "@github-tools/sdk/eve";
9
+ import { defineDynamic } from "eve/tools";
10
+ var github_default = defineDynamic({ events: { "session.started": async () => {
11
+ const { token, connector, connect, preset, requireApproval, overrides, author, committer, coAuthors } = extension_default.config;
12
+ return buildEveToolMap({
13
+ token: connector ? connectGithubToken(connector, {
14
+ preset,
15
+ params: connect
16
+ }) : token,
17
+ preset,
18
+ requireApproval,
19
+ overrides,
20
+ author,
21
+ committer,
22
+ coAuthors
23
+ });
24
+ } } });
25
+ export { github_default as default };
@@ -0,0 +1,4 @@
1
+ // Generated by eve. Do not edit by hand.
2
+
3
+ export { default } from "./extension/extension.js";
4
+ export { default as eve_extension } from "./extension/extension.js";
package/dist/index.mjs ADDED
@@ -0,0 +1,7 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ __eveDirname(__eveFileURLToPath(import.meta.url));
5
+ __eveCreateRequire(import.meta.url);
6
+ import extension_default from "./extension/extension.mjs";
7
+ export { extension_default as default, extension_default as eve_extension };
@@ -0,0 +1,3 @@
1
+ // Generated by eve. Do not edit by hand.
2
+
3
+ export { default as github } from "../extension/tools/github.js";
@@ -0,0 +1,7 @@
1
+ import { fileURLToPath as __eveFileURLToPath } from "node:url";
2
+ import { dirname as __eveDirname } from "node:path";
3
+ import { createRequire as __eveCreateRequire } from "node:module";
4
+ __eveDirname(__eveFileURLToPath(import.meta.url));
5
+ __eveCreateRequire(import.meta.url);
6
+ import github_default from "../extension/tools/github.mjs";
7
+ export { github_default as github };
package/package.json ADDED
@@ -0,0 +1,77 @@
1
+ {
2
+ "name": "@github-tools/eve-extension",
3
+ "version": "0.1.0",
4
+ "description": "GitHub tools for eve, distributed as a mountable eve extension (https://eve.dev/docs/extensions)",
5
+ "author": "HugoRCD <hugo.richard@vercel.com>",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/vercel-labs/github-tools.git",
9
+ "directory": "packages/github-tools-eve-extension"
10
+ },
11
+ "homepage": "https://github-tools.com",
12
+ "bugs": {
13
+ "url": "https://github.com/vercel-labs/github-tools/issues"
14
+ },
15
+ "type": "module",
16
+ "engines": {
17
+ "node": "24.x"
18
+ },
19
+ "eve": {
20
+ "extension": {
21
+ "source": "./extension",
22
+ "dist": "./dist/extension"
23
+ }
24
+ },
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "default": "./dist/index.mjs"
29
+ },
30
+ "./tools": {
31
+ "types": "./dist/tools/index.d.ts",
32
+ "default": "./dist/tools/index.mjs"
33
+ }
34
+ },
35
+ "files": [
36
+ "dist"
37
+ ],
38
+ "keywords": [
39
+ "ai",
40
+ "eve",
41
+ "eve-extension",
42
+ "github",
43
+ "tools",
44
+ "agent"
45
+ ],
46
+ "license": "MIT",
47
+ "dependencies": {
48
+ "zod": "^4.3.6",
49
+ "@github-tools/sdk": "1.8.2"
50
+ },
51
+ "peerDependencies": {
52
+ "@vercel/connect": ">=0.3.2",
53
+ "eve": "*"
54
+ },
55
+ "peerDependenciesMeta": {
56
+ "@vercel/connect": {
57
+ "optional": true
58
+ }
59
+ },
60
+ "devDependencies": {
61
+ "@types/node": "^25.6.0",
62
+ "@vercel/connect": "^0.4.2",
63
+ "eslint": "^10.3.0",
64
+ "eve": "^0.26.2",
65
+ "typescript": "^6.0.3",
66
+ "typescript-eslint": "^8.59.2"
67
+ },
68
+ "publishConfig": {
69
+ "access": "public"
70
+ },
71
+ "scripts": {
72
+ "build": "eve extension build",
73
+ "lint": "eslint .",
74
+ "lint:fix": "eslint . --fix",
75
+ "typecheck": "tsc --noEmit"
76
+ }
77
+ }