@inkeep/agents-work-apps 0.0.0-dev-20260203033642
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.md +49 -0
- package/dist/db/index.d.ts +2 -0
- package/dist/db/index.js +3 -0
- package/dist/db/runDbClient.d.ts +6 -0
- package/dist/db/runDbClient.js +9 -0
- package/dist/env.d.ts +47 -0
- package/dist/env.js +48 -0
- package/dist/github/config.d.ts +22 -0
- package/dist/github/config.js +79 -0
- package/dist/github/index.d.ts +13 -0
- package/dist/github/index.js +23 -0
- package/dist/github/installation.d.ts +66 -0
- package/dist/github/installation.js +293 -0
- package/dist/github/jwks.d.ts +20 -0
- package/dist/github/jwks.js +85 -0
- package/dist/github/mcp/auth.d.ts +10 -0
- package/dist/github/mcp/auth.js +43 -0
- package/dist/github/mcp/index.d.ts +11 -0
- package/dist/github/mcp/index.js +670 -0
- package/dist/github/mcp/schemas.d.ts +87 -0
- package/dist/github/mcp/schemas.js +69 -0
- package/dist/github/mcp/utils.d.ts +228 -0
- package/dist/github/mcp/utils.js +464 -0
- package/dist/github/oidcToken.d.ts +22 -0
- package/dist/github/oidcToken.js +140 -0
- package/dist/github/routes/setup.d.ts +7 -0
- package/dist/github/routes/setup.js +217 -0
- package/dist/github/routes/tokenExchange.d.ts +7 -0
- package/dist/github/routes/tokenExchange.js +233 -0
- package/dist/github/routes/webhooks.d.ts +12 -0
- package/dist/github/routes/webhooks.js +278 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +3 -0
- package/package.json +65 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/github/mcp/schemas.d.ts
|
|
4
|
+
declare const GitHubUserSchema: z.ZodObject<{
|
|
5
|
+
login: z.ZodString;
|
|
6
|
+
id: z.ZodNumber;
|
|
7
|
+
avatarUrl: z.ZodString;
|
|
8
|
+
url: z.ZodURL;
|
|
9
|
+
}, z.core.$strip>;
|
|
10
|
+
declare const RepositorySchema: z.ZodObject<{
|
|
11
|
+
owner: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
fullName: z.ZodString;
|
|
14
|
+
url: z.ZodString;
|
|
15
|
+
defaultBranch: z.ZodString;
|
|
16
|
+
}, z.core.$strip>;
|
|
17
|
+
declare const PullRequestSchema: z.ZodObject<{
|
|
18
|
+
number: z.ZodNumber;
|
|
19
|
+
title: z.ZodString;
|
|
20
|
+
body: z.ZodNullable<z.ZodString>;
|
|
21
|
+
author: z.ZodObject<{
|
|
22
|
+
login: z.ZodString;
|
|
23
|
+
id: z.ZodNumber;
|
|
24
|
+
avatarUrl: z.ZodString;
|
|
25
|
+
url: z.ZodURL;
|
|
26
|
+
}, z.core.$strip>;
|
|
27
|
+
url: z.ZodString;
|
|
28
|
+
state: z.ZodString;
|
|
29
|
+
base: z.ZodObject<{
|
|
30
|
+
ref: z.ZodString;
|
|
31
|
+
sha: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
head: z.ZodObject<{
|
|
34
|
+
ref: z.ZodString;
|
|
35
|
+
sha: z.ZodString;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
createdAt: z.ZodString;
|
|
38
|
+
updatedAt: z.ZodString;
|
|
39
|
+
}, z.core.$strip>;
|
|
40
|
+
declare const ChangedFileSchema: z.ZodObject<{
|
|
41
|
+
commit_messages: z.ZodArray<z.ZodString>;
|
|
42
|
+
path: z.ZodString;
|
|
43
|
+
status: z.ZodEnum<{
|
|
44
|
+
added: "added";
|
|
45
|
+
modified: "modified";
|
|
46
|
+
removed: "removed";
|
|
47
|
+
renamed: "renamed";
|
|
48
|
+
copied: "copied";
|
|
49
|
+
changed: "changed";
|
|
50
|
+
unchanged: "unchanged";
|
|
51
|
+
}>;
|
|
52
|
+
additions: z.ZodNumber;
|
|
53
|
+
deletions: z.ZodNumber;
|
|
54
|
+
patch: z.ZodOptional<z.ZodString>;
|
|
55
|
+
previousPath: z.ZodOptional<z.ZodString>;
|
|
56
|
+
contents: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>;
|
|
58
|
+
declare const CommentSchema: z.ZodObject<{
|
|
59
|
+
id: z.ZodNumber;
|
|
60
|
+
body: z.ZodString;
|
|
61
|
+
author: z.ZodObject<{
|
|
62
|
+
login: z.ZodString;
|
|
63
|
+
id: z.ZodNumber;
|
|
64
|
+
avatarUrl: z.ZodString;
|
|
65
|
+
url: z.ZodURL;
|
|
66
|
+
}, z.core.$strip>;
|
|
67
|
+
createdAt: z.ZodString;
|
|
68
|
+
updatedAt: z.ZodString;
|
|
69
|
+
type: z.ZodEnum<{
|
|
70
|
+
issue: "issue";
|
|
71
|
+
review: "review";
|
|
72
|
+
}>;
|
|
73
|
+
path: z.ZodOptional<z.ZodString>;
|
|
74
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
}, z.core.$strip>;
|
|
76
|
+
declare const GitHubEventSchema: z.ZodObject<{
|
|
77
|
+
type: z.ZodString;
|
|
78
|
+
action: z.ZodString;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
type GitHubUser = z.infer<typeof GitHubUserSchema>;
|
|
81
|
+
type Repository = z.infer<typeof RepositorySchema>;
|
|
82
|
+
type PullRequest = z.infer<typeof PullRequestSchema>;
|
|
83
|
+
type ChangedFile = z.infer<typeof ChangedFileSchema>;
|
|
84
|
+
type Comment = z.infer<typeof CommentSchema>;
|
|
85
|
+
type GitHubEvent = z.infer<typeof GitHubEventSchema>;
|
|
86
|
+
//#endregion
|
|
87
|
+
export { ChangedFile, ChangedFileSchema, Comment, CommentSchema, GitHubEvent, GitHubEventSchema, GitHubUser, GitHubUserSchema, PullRequest, PullRequestSchema, Repository, RepositorySchema };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
//#region src/github/mcp/schemas.ts
|
|
4
|
+
const GitHubUserSchema = z.object({
|
|
5
|
+
login: z.string(),
|
|
6
|
+
id: z.number(),
|
|
7
|
+
avatarUrl: z.string().url(),
|
|
8
|
+
url: z.url()
|
|
9
|
+
});
|
|
10
|
+
const RepositorySchema = z.object({
|
|
11
|
+
owner: z.string(),
|
|
12
|
+
name: z.string(),
|
|
13
|
+
fullName: z.string(),
|
|
14
|
+
url: z.string().url(),
|
|
15
|
+
defaultBranch: z.string()
|
|
16
|
+
});
|
|
17
|
+
const PullRequestSchema = z.object({
|
|
18
|
+
number: z.number(),
|
|
19
|
+
title: z.string(),
|
|
20
|
+
body: z.string().nullable(),
|
|
21
|
+
author: GitHubUserSchema,
|
|
22
|
+
url: z.string().url(),
|
|
23
|
+
state: z.string(),
|
|
24
|
+
base: z.object({
|
|
25
|
+
ref: z.string(),
|
|
26
|
+
sha: z.string()
|
|
27
|
+
}),
|
|
28
|
+
head: z.object({
|
|
29
|
+
ref: z.string(),
|
|
30
|
+
sha: z.string()
|
|
31
|
+
}),
|
|
32
|
+
createdAt: z.string(),
|
|
33
|
+
updatedAt: z.string()
|
|
34
|
+
});
|
|
35
|
+
const ChangedFileSchema = z.object({
|
|
36
|
+
commit_messages: z.array(z.string()),
|
|
37
|
+
path: z.string(),
|
|
38
|
+
status: z.enum([
|
|
39
|
+
"added",
|
|
40
|
+
"modified",
|
|
41
|
+
"removed",
|
|
42
|
+
"renamed",
|
|
43
|
+
"copied",
|
|
44
|
+
"changed",
|
|
45
|
+
"unchanged"
|
|
46
|
+
]),
|
|
47
|
+
additions: z.number(),
|
|
48
|
+
deletions: z.number(),
|
|
49
|
+
patch: z.string().optional(),
|
|
50
|
+
previousPath: z.string().optional(),
|
|
51
|
+
contents: z.string().optional()
|
|
52
|
+
});
|
|
53
|
+
const CommentSchema = z.object({
|
|
54
|
+
id: z.number(),
|
|
55
|
+
body: z.string(),
|
|
56
|
+
author: GitHubUserSchema,
|
|
57
|
+
createdAt: z.string(),
|
|
58
|
+
updatedAt: z.string(),
|
|
59
|
+
type: z.enum(["issue", "review"]),
|
|
60
|
+
path: z.string().optional(),
|
|
61
|
+
line: z.number().optional()
|
|
62
|
+
});
|
|
63
|
+
const GitHubEventSchema = z.object({
|
|
64
|
+
type: z.string(),
|
|
65
|
+
action: z.string()
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
export { ChangedFileSchema, CommentSchema, GitHubEventSchema, GitHubUserSchema, PullRequestSchema, RepositorySchema };
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { ChangedFile, PullRequest } from "./schemas.js";
|
|
2
|
+
import { Octokit } from "@octokit/rest";
|
|
3
|
+
|
|
4
|
+
//#region src/github/mcp/utils.d.ts
|
|
5
|
+
interface CommitData {
|
|
6
|
+
commit_sha: string;
|
|
7
|
+
commit_message: string;
|
|
8
|
+
file_info: {
|
|
9
|
+
filename: string;
|
|
10
|
+
additions: number;
|
|
11
|
+
deletions: number;
|
|
12
|
+
changes: number;
|
|
13
|
+
status: string;
|
|
14
|
+
raw_url: string;
|
|
15
|
+
blob_url: string;
|
|
16
|
+
patch?: string;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
interface PullCommit {
|
|
20
|
+
sha: string;
|
|
21
|
+
commit: {
|
|
22
|
+
message: string;
|
|
23
|
+
author?: {
|
|
24
|
+
name?: string;
|
|
25
|
+
email?: string;
|
|
26
|
+
date?: string;
|
|
27
|
+
} | null;
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
declare function getGitHubClientFromRepo(owner: string, repo: string, installationIdMap: Map<string, string>): Octokit;
|
|
31
|
+
declare function getGitHubClientFromInstallationId(installationId: string): Octokit;
|
|
32
|
+
/**
|
|
33
|
+
* Fetch pull request details
|
|
34
|
+
*/
|
|
35
|
+
declare function fetchPrInfo(octokit: Octokit, owner: string, repo: string, prNumber: number): Promise<PullRequest>;
|
|
36
|
+
/**
|
|
37
|
+
* Fetch all commits in a pull request.
|
|
38
|
+
*/
|
|
39
|
+
declare function fetchPrCommits(octokit: Octokit, owner: string, repo: string, prNumber: number): Promise<PullCommit[]>;
|
|
40
|
+
/**
|
|
41
|
+
* Fetch detailed information about a specific commit including its diff.
|
|
42
|
+
*/
|
|
43
|
+
declare function fetchCommitDetails(octokit: Octokit, owner: string, repo: string, commitSha: string): Promise<{
|
|
44
|
+
url: string;
|
|
45
|
+
sha: string;
|
|
46
|
+
node_id: string;
|
|
47
|
+
html_url: string;
|
|
48
|
+
comments_url: string;
|
|
49
|
+
commit: {
|
|
50
|
+
url: string;
|
|
51
|
+
author: {
|
|
52
|
+
name?: string;
|
|
53
|
+
email?: string;
|
|
54
|
+
date?: string;
|
|
55
|
+
} | null;
|
|
56
|
+
committer: {
|
|
57
|
+
name?: string;
|
|
58
|
+
email?: string;
|
|
59
|
+
date?: string;
|
|
60
|
+
} | null;
|
|
61
|
+
message: string;
|
|
62
|
+
comment_count: number;
|
|
63
|
+
tree: {
|
|
64
|
+
sha: string;
|
|
65
|
+
url: string;
|
|
66
|
+
};
|
|
67
|
+
verification?: {
|
|
68
|
+
verified: boolean;
|
|
69
|
+
reason: string;
|
|
70
|
+
payload: string | null;
|
|
71
|
+
signature: string | null;
|
|
72
|
+
verified_at: string | null;
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
author: {
|
|
76
|
+
name?: string | null;
|
|
77
|
+
email?: string | null;
|
|
78
|
+
login: string;
|
|
79
|
+
id: number;
|
|
80
|
+
node_id: string;
|
|
81
|
+
avatar_url: string;
|
|
82
|
+
gravatar_id: string | null;
|
|
83
|
+
url: string;
|
|
84
|
+
html_url: string;
|
|
85
|
+
followers_url: string;
|
|
86
|
+
following_url: string;
|
|
87
|
+
gists_url: string;
|
|
88
|
+
starred_url: string;
|
|
89
|
+
subscriptions_url: string;
|
|
90
|
+
organizations_url: string;
|
|
91
|
+
repos_url: string;
|
|
92
|
+
events_url: string;
|
|
93
|
+
received_events_url: string;
|
|
94
|
+
type: string;
|
|
95
|
+
site_admin: boolean;
|
|
96
|
+
starred_at?: string;
|
|
97
|
+
user_view_type?: string;
|
|
98
|
+
} | Record<string, never> | null;
|
|
99
|
+
committer: {
|
|
100
|
+
name?: string | null;
|
|
101
|
+
email?: string | null;
|
|
102
|
+
login: string;
|
|
103
|
+
id: number;
|
|
104
|
+
node_id: string;
|
|
105
|
+
avatar_url: string;
|
|
106
|
+
gravatar_id: string | null;
|
|
107
|
+
url: string;
|
|
108
|
+
html_url: string;
|
|
109
|
+
followers_url: string;
|
|
110
|
+
following_url: string;
|
|
111
|
+
gists_url: string;
|
|
112
|
+
starred_url: string;
|
|
113
|
+
subscriptions_url: string;
|
|
114
|
+
organizations_url: string;
|
|
115
|
+
repos_url: string;
|
|
116
|
+
events_url: string;
|
|
117
|
+
received_events_url: string;
|
|
118
|
+
type: string;
|
|
119
|
+
site_admin: boolean;
|
|
120
|
+
starred_at?: string;
|
|
121
|
+
user_view_type?: string;
|
|
122
|
+
} | Record<string, never> | null;
|
|
123
|
+
parents: {
|
|
124
|
+
sha: string;
|
|
125
|
+
url: string;
|
|
126
|
+
html_url?: string;
|
|
127
|
+
}[];
|
|
128
|
+
stats?: {
|
|
129
|
+
additions?: number;
|
|
130
|
+
deletions?: number;
|
|
131
|
+
total?: number;
|
|
132
|
+
};
|
|
133
|
+
files?: {
|
|
134
|
+
sha: string | null;
|
|
135
|
+
filename: string;
|
|
136
|
+
status: "added" | "removed" | "modified" | "renamed" | "copied" | "changed" | "unchanged";
|
|
137
|
+
additions: number;
|
|
138
|
+
deletions: number;
|
|
139
|
+
changes: number;
|
|
140
|
+
blob_url: string;
|
|
141
|
+
raw_url: string;
|
|
142
|
+
contents_url: string;
|
|
143
|
+
patch?: string;
|
|
144
|
+
previous_filename?: string;
|
|
145
|
+
}[];
|
|
146
|
+
}>;
|
|
147
|
+
/**
|
|
148
|
+
* Fetch changed files with optional path filtering and content fetching
|
|
149
|
+
*/
|
|
150
|
+
declare function fetchPrFiles(octokit: Octokit, owner: string, repo: string, prNumber: number, pathFilters?: string[], includeContents?: boolean, includePatch?: boolean): Promise<ChangedFile[]>;
|
|
151
|
+
/**
|
|
152
|
+
* Get file-based diffs with all commit messages that impacted each file.
|
|
153
|
+
*/
|
|
154
|
+
declare function fetchPrFileDiffs(octokit: Octokit, owner: string, repo: string, prNumber: number): Promise<ChangedFile[]>;
|
|
155
|
+
/**
|
|
156
|
+
* Generate a markdown representation of a pull request with file diffs
|
|
157
|
+
*/
|
|
158
|
+
declare function generatePrMarkdown(pr: PullRequest, fileDiffs: ChangedFile[], owner: string, repo: string): string;
|
|
159
|
+
interface LLMUpdateOperation {
|
|
160
|
+
operation: 'replace_lines' | 'insert_after' | 'insert_before' | 'delete_lines';
|
|
161
|
+
lineStart: number;
|
|
162
|
+
lineEnd?: number;
|
|
163
|
+
content?: string;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Validates that line numbers are within valid range
|
|
167
|
+
*/
|
|
168
|
+
declare function validateLineNumbers(startLine: number, endLine: number, totalLines: number): void;
|
|
169
|
+
declare function getFilePathsInRepo(githubClient: Octokit, owner: string, repo: string, path?: string): Promise<string[]>;
|
|
170
|
+
/**
|
|
171
|
+
* Apply the operations to the document.
|
|
172
|
+
*
|
|
173
|
+
* Operations are applied in reverse order (by line number) to avoid
|
|
174
|
+
* line number shifts affecting subsequent operations.
|
|
175
|
+
*/
|
|
176
|
+
declare function applyOperations(fileContent: string, operations: LLMUpdateOperation[]): string;
|
|
177
|
+
/**
|
|
178
|
+
* Convenience function to apply a single operation to file content
|
|
179
|
+
*/
|
|
180
|
+
declare function applyOperation(fileContent: string, operation: LLMUpdateOperation): string;
|
|
181
|
+
/**
|
|
182
|
+
* Apply a list of operations to a piece of documentation and return a mapping of line number to line content.
|
|
183
|
+
* This function is useful for visualizing what the operations would do before applying them.
|
|
184
|
+
*
|
|
185
|
+
* @param fileContent - The original content of the file
|
|
186
|
+
* @param operations - A list of operations to apply to the file
|
|
187
|
+
* @returns A mapping of line number to line content, or an error message string if operations fail
|
|
188
|
+
*/
|
|
189
|
+
declare function visualizeUpdateOperations(fileContent: string, operations: LLMUpdateOperation[]): Record<number, string> | string;
|
|
190
|
+
declare function commitFileChanges({
|
|
191
|
+
githubClient,
|
|
192
|
+
owner,
|
|
193
|
+
repo,
|
|
194
|
+
fileContent,
|
|
195
|
+
filePath,
|
|
196
|
+
branchName,
|
|
197
|
+
operations,
|
|
198
|
+
commitMessage
|
|
199
|
+
}: {
|
|
200
|
+
githubClient: Octokit;
|
|
201
|
+
owner: string;
|
|
202
|
+
repo: string;
|
|
203
|
+
fileContent: string;
|
|
204
|
+
filePath: string;
|
|
205
|
+
branchName: string;
|
|
206
|
+
operations: LLMUpdateOperation[];
|
|
207
|
+
commitMessage: string;
|
|
208
|
+
}): Promise<string>;
|
|
209
|
+
declare function commitNewFile({
|
|
210
|
+
githubClient,
|
|
211
|
+
owner,
|
|
212
|
+
repo,
|
|
213
|
+
filePath,
|
|
214
|
+
branchName,
|
|
215
|
+
content,
|
|
216
|
+
commitMessage
|
|
217
|
+
}: {
|
|
218
|
+
githubClient: Octokit;
|
|
219
|
+
owner: string;
|
|
220
|
+
repo: string;
|
|
221
|
+
filePath: string;
|
|
222
|
+
branchName: string;
|
|
223
|
+
content: string;
|
|
224
|
+
commitMessage: string;
|
|
225
|
+
}): Promise<string>;
|
|
226
|
+
declare function formatFileDiff(pullRequestNumber: number, files: ChangedFile[], includeContents?: boolean): Promise<string>;
|
|
227
|
+
//#endregion
|
|
228
|
+
export { CommitData, LLMUpdateOperation, PullCommit, applyOperation, applyOperations, commitFileChanges, commitNewFile, fetchCommitDetails, fetchPrCommits, fetchPrFileDiffs, fetchPrFiles, fetchPrInfo, formatFileDiff, generatePrMarkdown, getFilePathsInRepo, getGitHubClientFromInstallationId, getGitHubClientFromRepo, validateLineNumbers, visualizeUpdateOperations };
|