@morphllm/gitmorph-sdk 0.2.1 → 0.3.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 +429 -0
- package/dist/ai/index.d.ts +48 -0
- package/dist/ai/index.js +25 -0
- package/dist/ai/index.js.map +1 -0
- package/dist/anthropic/index.d.ts +85 -0
- package/dist/anthropic/index.js +64 -0
- package/dist/anthropic/index.js.map +1 -0
- package/dist/chunk-A3AOZFPE.js +474 -0
- package/dist/chunk-A3AOZFPE.js.map +1 -0
- package/dist/chunk-FXEX72CO.js +43 -0
- package/dist/chunk-FXEX72CO.js.map +1 -0
- package/dist/chunk-JXXUBMF6.js +61 -0
- package/dist/chunk-JXXUBMF6.js.map +1 -0
- package/dist/chunk-QT3Y4ZIS.js +547 -0
- package/dist/chunk-QT3Y4ZIS.js.map +1 -0
- package/dist/{types.d.ts → client-B_I_0i1T.d.ts} +69 -37
- package/dist/index.d.ts +21 -5
- package/dist/index.js +3 -547
- package/dist/index.js.map +1 -0
- package/dist/instructions-BE0g1eFs.d.ts +284 -0
- package/dist/mcp/bin.d.ts +1 -0
- package/dist/mcp/bin.js +21 -0
- package/dist/mcp/bin.js.map +1 -0
- package/dist/mcp/index.d.ts +29 -0
- package/dist/mcp/index.js +5 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/openai/index.d.ts +60 -0
- package/dist/openai/index.js +75 -0
- package/dist/openai/index.js.map +1 -0
- package/package.json +56 -8
- package/dist/api.d.ts +0 -10
- package/dist/api.d.ts.map +0 -1
- package/dist/client.d.ts +0 -13
- package/dist/client.d.ts.map +0 -1
- package/dist/config.d.ts +0 -8
- package/dist/config.d.ts.map +0 -1
- package/dist/errors.d.ts +0 -18
- package/dist/errors.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mirror.d.ts +0 -6
- package/dist/mirror.d.ts.map +0 -1
- package/dist/repo.d.ts +0 -28
- package/dist/repo.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -5
- package/dist/utils.d.ts.map +0 -1
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import { G as GitMorph, e as GitMorphRepo, F as FileContent, c as FileContentEntry, m as GrepResult, g as GlobResult, s as ListDirResult, B as Branch, C as Commit, j as GrepAllResult, u as Repository } from './client-B_I_0i1T.js';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Execution context passed to every tool's `execute` function.
|
|
6
|
+
*
|
|
7
|
+
* `getRepo` resolves a `GitMorphRepo` handle. In pinned mode (set via
|
|
8
|
+
* `createGitmorphRepoTools`), it ignores its argument and always returns the
|
|
9
|
+
* pinned repo. In multi-repo mode, it requires the tool's `repo` input field.
|
|
10
|
+
*/
|
|
11
|
+
interface ToolCtx {
|
|
12
|
+
readonly gm: GitMorph;
|
|
13
|
+
readonly getRepo: (slugFromInput?: string) => GitMorphRepo;
|
|
14
|
+
}
|
|
15
|
+
declare const GITMORPH_TOOLS: readonly [{
|
|
16
|
+
readonly name: "gm_read_file";
|
|
17
|
+
readonly description: string;
|
|
18
|
+
readonly schema: z.ZodObject<{
|
|
19
|
+
path: z.ZodString;
|
|
20
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
21
|
+
startLine: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
endLine: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
path: string;
|
|
25
|
+
ref?: string | undefined;
|
|
26
|
+
startLine?: number | undefined;
|
|
27
|
+
endLine?: number | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
path: string;
|
|
30
|
+
ref?: string | undefined;
|
|
31
|
+
startLine?: number | undefined;
|
|
32
|
+
endLine?: number | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
readonly repoScoped: true;
|
|
35
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<FileContent>;
|
|
36
|
+
}, {
|
|
37
|
+
readonly name: "gm_read_files";
|
|
38
|
+
readonly description: string;
|
|
39
|
+
readonly schema: z.ZodObject<{
|
|
40
|
+
paths: z.ZodArray<z.ZodString, "many">;
|
|
41
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
42
|
+
}, "strip", z.ZodTypeAny, {
|
|
43
|
+
paths: string[];
|
|
44
|
+
ref?: string | undefined;
|
|
45
|
+
}, {
|
|
46
|
+
paths: string[];
|
|
47
|
+
ref?: string | undefined;
|
|
48
|
+
}>;
|
|
49
|
+
readonly repoScoped: true;
|
|
50
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<(FileContentEntry | null)[]>;
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "gm_grep";
|
|
53
|
+
readonly description: string;
|
|
54
|
+
readonly schema: z.ZodObject<{
|
|
55
|
+
pattern: z.ZodString;
|
|
56
|
+
language: z.ZodOptional<z.ZodString>;
|
|
57
|
+
caseSensitive: z.ZodOptional<z.ZodBoolean>;
|
|
58
|
+
maxMatches: z.ZodOptional<z.ZodNumber>;
|
|
59
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
60
|
+
}, "strip", z.ZodTypeAny, {
|
|
61
|
+
pattern: string;
|
|
62
|
+
language?: string | undefined;
|
|
63
|
+
caseSensitive?: boolean | undefined;
|
|
64
|
+
maxMatches?: number | undefined;
|
|
65
|
+
page?: number | undefined;
|
|
66
|
+
}, {
|
|
67
|
+
pattern: string;
|
|
68
|
+
language?: string | undefined;
|
|
69
|
+
caseSensitive?: boolean | undefined;
|
|
70
|
+
maxMatches?: number | undefined;
|
|
71
|
+
page?: number | undefined;
|
|
72
|
+
}>;
|
|
73
|
+
readonly repoScoped: true;
|
|
74
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<GrepResult>;
|
|
75
|
+
}, {
|
|
76
|
+
readonly name: "gm_glob";
|
|
77
|
+
readonly description: string;
|
|
78
|
+
readonly schema: z.ZodObject<{
|
|
79
|
+
patterns: z.ZodArray<z.ZodString, "many">;
|
|
80
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
81
|
+
prefix: z.ZodOptional<z.ZodString>;
|
|
82
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
patterns: string[];
|
|
85
|
+
ref?: string | undefined;
|
|
86
|
+
prefix?: string | undefined;
|
|
87
|
+
limit?: number | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
patterns: string[];
|
|
90
|
+
ref?: string | undefined;
|
|
91
|
+
prefix?: string | undefined;
|
|
92
|
+
limit?: number | undefined;
|
|
93
|
+
}>;
|
|
94
|
+
readonly repoScoped: true;
|
|
95
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<GlobResult>;
|
|
96
|
+
}, {
|
|
97
|
+
readonly name: "gm_list_dir";
|
|
98
|
+
readonly description: string;
|
|
99
|
+
readonly schema: z.ZodObject<{
|
|
100
|
+
path: z.ZodOptional<z.ZodString>;
|
|
101
|
+
ref: z.ZodOptional<z.ZodString>;
|
|
102
|
+
recursive: z.ZodOptional<z.ZodBoolean>;
|
|
103
|
+
}, "strip", z.ZodTypeAny, {
|
|
104
|
+
path?: string | undefined;
|
|
105
|
+
ref?: string | undefined;
|
|
106
|
+
recursive?: boolean | undefined;
|
|
107
|
+
}, {
|
|
108
|
+
path?: string | undefined;
|
|
109
|
+
ref?: string | undefined;
|
|
110
|
+
recursive?: boolean | undefined;
|
|
111
|
+
}>;
|
|
112
|
+
readonly repoScoped: true;
|
|
113
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<ListDirResult>;
|
|
114
|
+
}, {
|
|
115
|
+
readonly name: "gm_list_branches";
|
|
116
|
+
readonly description: string;
|
|
117
|
+
readonly schema: z.ZodObject<{
|
|
118
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
119
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
120
|
+
}, "strip", z.ZodTypeAny, {
|
|
121
|
+
page?: number | undefined;
|
|
122
|
+
limit?: number | undefined;
|
|
123
|
+
}, {
|
|
124
|
+
page?: number | undefined;
|
|
125
|
+
limit?: number | undefined;
|
|
126
|
+
}>;
|
|
127
|
+
readonly repoScoped: true;
|
|
128
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<Branch[]>;
|
|
129
|
+
}, {
|
|
130
|
+
readonly name: "gm_list_commits";
|
|
131
|
+
readonly description: string;
|
|
132
|
+
readonly schema: z.ZodObject<{
|
|
133
|
+
sha: z.ZodOptional<z.ZodString>;
|
|
134
|
+
path: z.ZodOptional<z.ZodString>;
|
|
135
|
+
since: z.ZodOptional<z.ZodString>;
|
|
136
|
+
until: z.ZodOptional<z.ZodString>;
|
|
137
|
+
page: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
path?: string | undefined;
|
|
141
|
+
page?: number | undefined;
|
|
142
|
+
limit?: number | undefined;
|
|
143
|
+
sha?: string | undefined;
|
|
144
|
+
since?: string | undefined;
|
|
145
|
+
until?: string | undefined;
|
|
146
|
+
}, {
|
|
147
|
+
path?: string | undefined;
|
|
148
|
+
page?: number | undefined;
|
|
149
|
+
limit?: number | undefined;
|
|
150
|
+
sha?: string | undefined;
|
|
151
|
+
since?: string | undefined;
|
|
152
|
+
until?: string | undefined;
|
|
153
|
+
}>;
|
|
154
|
+
readonly repoScoped: true;
|
|
155
|
+
readonly execute: ({ getRepo }: ToolCtx, input: any) => Promise<Commit[]>;
|
|
156
|
+
}, {
|
|
157
|
+
readonly name: "gm_grep_all";
|
|
158
|
+
readonly description: string;
|
|
159
|
+
readonly schema: z.ZodObject<{
|
|
160
|
+
pattern: z.ZodString;
|
|
161
|
+
language: z.ZodOptional<z.ZodString>;
|
|
162
|
+
sortByStars: z.ZodOptional<z.ZodBoolean>;
|
|
163
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
164
|
+
}, "strip", z.ZodTypeAny, {
|
|
165
|
+
pattern: string;
|
|
166
|
+
language?: string | undefined;
|
|
167
|
+
limit?: number | undefined;
|
|
168
|
+
sortByStars?: boolean | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
pattern: string;
|
|
171
|
+
language?: string | undefined;
|
|
172
|
+
limit?: number | undefined;
|
|
173
|
+
sortByStars?: boolean | undefined;
|
|
174
|
+
}>;
|
|
175
|
+
readonly repoScoped: false;
|
|
176
|
+
readonly execute: ({ gm }: ToolCtx, input: any) => Promise<GrepAllResult>;
|
|
177
|
+
}, {
|
|
178
|
+
readonly name: "gm_get_repo_info";
|
|
179
|
+
readonly description: string;
|
|
180
|
+
readonly schema: z.ZodObject<{
|
|
181
|
+
repo: z.ZodString;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
repo: string;
|
|
184
|
+
}, {
|
|
185
|
+
repo: string;
|
|
186
|
+
}>;
|
|
187
|
+
readonly repoScoped: false;
|
|
188
|
+
readonly execute: ({ gm }: ToolCtx, input: any) => Promise<Repository>;
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "gm_mirror";
|
|
191
|
+
readonly description: string;
|
|
192
|
+
readonly schema: z.ZodObject<{
|
|
193
|
+
source: z.ZodString;
|
|
194
|
+
repoName: z.ZodOptional<z.ZodString>;
|
|
195
|
+
private: z.ZodOptional<z.ZodBoolean>;
|
|
196
|
+
issues: z.ZodOptional<z.ZodBoolean>;
|
|
197
|
+
pullRequests: z.ZodOptional<z.ZodBoolean>;
|
|
198
|
+
releases: z.ZodOptional<z.ZodBoolean>;
|
|
199
|
+
}, "strip", z.ZodTypeAny, {
|
|
200
|
+
source: string;
|
|
201
|
+
issues?: boolean | undefined;
|
|
202
|
+
repoName?: string | undefined;
|
|
203
|
+
private?: boolean | undefined;
|
|
204
|
+
pullRequests?: boolean | undefined;
|
|
205
|
+
releases?: boolean | undefined;
|
|
206
|
+
}, {
|
|
207
|
+
source: string;
|
|
208
|
+
issues?: boolean | undefined;
|
|
209
|
+
repoName?: string | undefined;
|
|
210
|
+
private?: boolean | undefined;
|
|
211
|
+
pullRequests?: boolean | undefined;
|
|
212
|
+
releases?: boolean | undefined;
|
|
213
|
+
}>;
|
|
214
|
+
readonly repoScoped: false;
|
|
215
|
+
readonly execute: ({ gm }: ToolCtx, input: any) => Promise<{
|
|
216
|
+
full_name: string;
|
|
217
|
+
default_branch: string;
|
|
218
|
+
stars_count: number;
|
|
219
|
+
language: string;
|
|
220
|
+
}>;
|
|
221
|
+
}];
|
|
222
|
+
/** Union of every built-in tool name. */
|
|
223
|
+
type GitmorphToolName = (typeof GITMORPH_TOOLS)[number]["name"];
|
|
224
|
+
/** Tool names that are included by default (excludes opt-in `gm_mirror`). */
|
|
225
|
+
type DefaultGitmorphToolName = Exclude<GitmorphToolName, "gm_mirror">;
|
|
226
|
+
/** Names of tools included by default — use for filtering. */
|
|
227
|
+
declare const DEFAULT_TOOL_NAMES: readonly ["gm_read_file", "gm_read_files", "gm_grep", "gm_glob", "gm_list_dir", "gm_list_branches", "gm_list_commits", "gm_grep_all", "gm_get_repo_info"];
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Options accepted by every adapter's `createGitmorphTools` factory.
|
|
231
|
+
*
|
|
232
|
+
* @typeParam Only - Literal tuple of tool names. When passed as a `const`
|
|
233
|
+
* array, the return type of the factory narrows to exactly those tools.
|
|
234
|
+
*/
|
|
235
|
+
interface CreateToolsOptions<Only extends readonly GitmorphToolName[] = readonly GitmorphToolName[]> {
|
|
236
|
+
/**
|
|
237
|
+
* Restrict to these tool names. Narrows the factory's return type.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* createGitmorphTools(gm, { only: ["gm_grep", "gm_read_file"] as const })
|
|
241
|
+
*/
|
|
242
|
+
only?: Only;
|
|
243
|
+
/** Remove these tools. Applied after `only`. */
|
|
244
|
+
exclude?: readonly GitmorphToolName[];
|
|
245
|
+
/**
|
|
246
|
+
* Rename tools. Keys are built-in names; values are the new names.
|
|
247
|
+
* Names must be unique after renaming.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* createGitmorphTools(gm, { rename: { gm_grep: "search_code" } })
|
|
251
|
+
*/
|
|
252
|
+
rename?: Partial<Record<GitmorphToolName, string>>;
|
|
253
|
+
/**
|
|
254
|
+
* Include `gm_mirror` in the tool set. Off by default because mirroring
|
|
255
|
+
* triggers a server-side clone — don't let agents fire it speculatively.
|
|
256
|
+
*/
|
|
257
|
+
includeMirror?: boolean;
|
|
258
|
+
/**
|
|
259
|
+
* Maximum serialized bytes per tool result (Anthropic/OpenAI/MCP only).
|
|
260
|
+
* Larger results are replaced with a truncation notice. Default: 262144 (256 KB).
|
|
261
|
+
*/
|
|
262
|
+
maxOutputBytes?: number;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* Optional system prompt snippet to append to your agent's system message.
|
|
267
|
+
* Gives the model explicit guidance on when to reach for each GitMorph tool.
|
|
268
|
+
*
|
|
269
|
+
* Re-exported from every adapter subpath (`/ai`, `/anthropic`, `/openai`,
|
|
270
|
+
* `/mcp`) so you can import it alongside the tools.
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* import { createGitmorphTools, GITMORPH_SYSTEM_PROMPT } from "@morphllm/gitmorph-sdk/ai";
|
|
274
|
+
*
|
|
275
|
+
* const result = await generateText({
|
|
276
|
+
* model,
|
|
277
|
+
* system: `You are a code reading assistant.\n\n${GITMORPH_SYSTEM_PROMPT}`,
|
|
278
|
+
* tools: createGitmorphTools(gm),
|
|
279
|
+
* prompt: "Find every useEffect in facebook/react",
|
|
280
|
+
* });
|
|
281
|
+
*/
|
|
282
|
+
declare const GITMORPH_SYSTEM_PROMPT: string;
|
|
283
|
+
|
|
284
|
+
export { type CreateToolsOptions as C, DEFAULT_TOOL_NAMES as D, type GitmorphToolName as G, type DefaultGitmorphToolName as a, GITMORPH_SYSTEM_PROMPT as b };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
package/dist/mcp/bin.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { GitMorph } from '../chunk-QT3Y4ZIS.js';
|
|
3
|
+
import { startGitmorphMcpServer } from '../chunk-JXXUBMF6.js';
|
|
4
|
+
import '../chunk-FXEX72CO.js';
|
|
5
|
+
import '../chunk-A3AOZFPE.js';
|
|
6
|
+
|
|
7
|
+
// src/mcp/bin.ts
|
|
8
|
+
async function main() {
|
|
9
|
+
try {
|
|
10
|
+
const gm = new GitMorph();
|
|
11
|
+
await startGitmorphMcpServer(gm);
|
|
12
|
+
} catch (err) {
|
|
13
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
14
|
+
process.stderr.write(`[gitmorph-mcp] ${message}
|
|
15
|
+
`);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
void main();
|
|
20
|
+
//# sourceMappingURL=bin.js.map
|
|
21
|
+
//# sourceMappingURL=bin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/mcp/bin.ts"],"names":[],"mappings":";;;;;;;AAIA,eAAe,IAAA,GAAO;AACpB,EAAA,IAAI;AACF,IAAA,MAAM,EAAA,GAAK,IAAI,QAAA,EAAS;AACxB,IAAA,MAAM,uBAAuB,EAAE,CAAA;AAAA,EACjC,SAAS,GAAA,EAAK;AACZ,IAAA,MAAM,UAAU,GAAA,YAAe,KAAA,GAAQ,GAAA,CAAI,OAAA,GAAU,OAAO,GAAG,CAAA;AAC/D,IAAA,OAAA,CAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,eAAA,EAAkB,OAAO;AAAA,CAAI,CAAA;AAClD,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA,EAChB;AACF;AAEA,KAAK,IAAA,EAAK","file":"bin.js","sourcesContent":["#!/usr/bin/env node\nimport { GitMorph } from \"../client.js\";\nimport { startGitmorphMcpServer } from \"./index.js\";\n\nasync function main() {\n try {\n const gm = new GitMorph();\n await startGitmorphMcpServer(gm);\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n process.stderr.write(`[gitmorph-mcp] ${message}\\n`);\n process.exit(1);\n }\n}\n\nvoid main();\n"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { G as GitMorph } from '../client-B_I_0i1T.js';
|
|
3
|
+
import { C as CreateToolsOptions } from '../instructions-BE0g1eFs.js';
|
|
4
|
+
export { D as DEFAULT_TOOL_NAMES, b as GITMORPH_SYSTEM_PROMPT, G as GitmorphToolName } from '../instructions-BE0g1eFs.js';
|
|
5
|
+
import 'zod';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Build an MCP server that exposes the GitMorph toolkit over stdio.
|
|
9
|
+
*
|
|
10
|
+
* Use this when you want to register GitMorph with any MCP-compatible client
|
|
11
|
+
* (Claude Desktop, Cursor, Claude Code, etc.). For the common case, prefer
|
|
12
|
+
* the shipped CLI: `npx @morphllm/gitmorph-sdk mcp`.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* import { GitMorph } from "@morphllm/gitmorph-sdk";
|
|
17
|
+
* import { startGitmorphMcpServer } from "@morphllm/gitmorph-sdk/mcp";
|
|
18
|
+
*
|
|
19
|
+
* await startGitmorphMcpServer(new GitMorph());
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
declare function createGitmorphMcpServer(gm: GitMorph, opts?: CreateToolsOptions): Server;
|
|
23
|
+
/**
|
|
24
|
+
* Start an MCP stdio server for the GitMorph toolkit. Resolves when the
|
|
25
|
+
* server's transport disconnects.
|
|
26
|
+
*/
|
|
27
|
+
declare function startGitmorphMcpServer(gm: GitMorph, opts?: CreateToolsOptions): Promise<void>;
|
|
28
|
+
|
|
29
|
+
export { CreateToolsOptions, createGitmorphMcpServer, startGitmorphMcpServer };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { createGitmorphMcpServer, startGitmorphMcpServer } from '../chunk-JXXUBMF6.js';
|
|
2
|
+
import '../chunk-FXEX72CO.js';
|
|
3
|
+
export { DEFAULT_TOOL_NAMES, GITMORPH_SYSTEM_PROMPT } from '../chunk-A3AOZFPE.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
5
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import OpenAI from 'openai';
|
|
2
|
+
import { G as GitMorph } from '../client-B_I_0i1T.js';
|
|
3
|
+
import { G as GitmorphToolName, C as CreateToolsOptions } from '../instructions-BE0g1eFs.js';
|
|
4
|
+
export { D as DEFAULT_TOOL_NAMES, a as DefaultGitmorphToolName, b as GITMORPH_SYSTEM_PROMPT } from '../instructions-BE0g1eFs.js';
|
|
5
|
+
import 'zod';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Return value of {@link createGitmorphTools} for OpenAI. `tools` is a drop-in
|
|
9
|
+
* for `chat.completions.create({ tools })`; `handleToolCall` consumes one
|
|
10
|
+
* `tool_call` from the assistant message and returns a ready-to-send tool
|
|
11
|
+
* message.
|
|
12
|
+
*/
|
|
13
|
+
interface GitmorphOpenAITools {
|
|
14
|
+
readonly tools: OpenAI.Chat.Completions.ChatCompletionTool[];
|
|
15
|
+
/**
|
|
16
|
+
* Execute a tool_call and return a `tool` role message. Never throws —
|
|
17
|
+
* errors are serialized into the message content so the model can recover.
|
|
18
|
+
*/
|
|
19
|
+
handleToolCall(call: OpenAI.Chat.Completions.ChatCompletionMessageToolCall): Promise<OpenAI.Chat.Completions.ChatCompletionToolMessageParam>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Create OpenAI SDK tools + dispatcher for a {@link GitMorph} client.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* import OpenAI from "openai";
|
|
27
|
+
* import { GitMorph } from "@morphllm/gitmorph-sdk";
|
|
28
|
+
* import { createGitmorphTools, GITMORPH_SYSTEM_PROMPT } from "@morphllm/gitmorph-sdk/openai";
|
|
29
|
+
*
|
|
30
|
+
* const openai = new OpenAI();
|
|
31
|
+
* const gm = new GitMorph();
|
|
32
|
+
* const { tools, handleToolCall } = createGitmorphTools(gm);
|
|
33
|
+
*
|
|
34
|
+
* const messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [
|
|
35
|
+
* { role: "system", content: GITMORPH_SYSTEM_PROMPT },
|
|
36
|
+
* { role: "user", content: "Find every useEffect in facebook/react" },
|
|
37
|
+
* ];
|
|
38
|
+
*
|
|
39
|
+
* for (let step = 0; step < 10; step++) {
|
|
40
|
+
* const res = await openai.chat.completions.create({ model: "gpt-4o", tools, messages });
|
|
41
|
+
* const msg = res.choices[0]!.message;
|
|
42
|
+
* messages.push(msg);
|
|
43
|
+
* if (!msg.tool_calls?.length) break;
|
|
44
|
+
* const results = await Promise.all(msg.tool_calls.map(handleToolCall));
|
|
45
|
+
* messages.push(...results);
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
declare function createGitmorphTools<const Only extends readonly GitmorphToolName[] = readonly GitmorphToolName[]>(gm: GitMorph, opts?: CreateToolsOptions<Only>): GitmorphOpenAITools;
|
|
50
|
+
/**
|
|
51
|
+
* Pinned variant — every tool operates on a single repository.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* const { tools, handleToolCall } = createGitmorphRepoTools(gm, "facebook/react");
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
declare function createGitmorphRepoTools<const Only extends readonly GitmorphToolName[] = readonly GitmorphToolName[]>(gm: GitMorph, slug: string, opts?: CreateToolsOptions<Only>): GitmorphOpenAITools;
|
|
59
|
+
|
|
60
|
+
export { CreateToolsOptions, type GitmorphOpenAITools, GitmorphToolName, createGitmorphRepoTools, createGitmorphTools };
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { toJsonSchema, clampOutput } from '../chunk-FXEX72CO.js';
|
|
2
|
+
import { resolveToolSet } from '../chunk-A3AOZFPE.js';
|
|
3
|
+
export { DEFAULT_TOOL_NAMES, GITMORPH_SYSTEM_PROMPT } from '../chunk-A3AOZFPE.js';
|
|
4
|
+
|
|
5
|
+
// src/openai/index.ts
|
|
6
|
+
function createGitmorphTools(gm, opts = {}) {
|
|
7
|
+
return build(resolveToolSet(gm, opts), opts);
|
|
8
|
+
}
|
|
9
|
+
function createGitmorphRepoTools(gm, slug, opts = {}) {
|
|
10
|
+
return build(resolveToolSet(gm, opts, slug), opts);
|
|
11
|
+
}
|
|
12
|
+
function build(normalized, opts) {
|
|
13
|
+
const byName = new Map(normalized.map((t) => [t.name, t]));
|
|
14
|
+
const maxBytes = opts.maxOutputBytes;
|
|
15
|
+
const tools = normalized.map(
|
|
16
|
+
(t) => ({
|
|
17
|
+
type: "function",
|
|
18
|
+
function: {
|
|
19
|
+
name: t.name,
|
|
20
|
+
description: t.description,
|
|
21
|
+
parameters: toJsonSchema(t.schema)
|
|
22
|
+
}
|
|
23
|
+
})
|
|
24
|
+
);
|
|
25
|
+
const handleToolCall = async (call) => {
|
|
26
|
+
const name = call.function.name;
|
|
27
|
+
const def = byName.get(name);
|
|
28
|
+
if (!def) return errorMessage(call.id, `Unknown tool: ${name}`);
|
|
29
|
+
let args;
|
|
30
|
+
try {
|
|
31
|
+
args = call.function.arguments ? JSON.parse(call.function.arguments) : {};
|
|
32
|
+
} catch (err) {
|
|
33
|
+
return errorMessage(
|
|
34
|
+
call.id,
|
|
35
|
+
`Invalid JSON arguments for ${name}: ${err instanceof Error ? err.message : String(err)}`
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
const parsed = def.schema.safeParse(args);
|
|
39
|
+
if (!parsed.success) {
|
|
40
|
+
return errorMessage(
|
|
41
|
+
call.id,
|
|
42
|
+
`Invalid input for ${name}: ${parsed.error.message}`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const result = await def.execute(parsed.data);
|
|
47
|
+
return {
|
|
48
|
+
role: "tool",
|
|
49
|
+
tool_call_id: call.id,
|
|
50
|
+
content: clampOutput(result, maxBytes)
|
|
51
|
+
};
|
|
52
|
+
} catch (err) {
|
|
53
|
+
return errorMessage(call.id, describeError(err));
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
return { tools, handleToolCall };
|
|
57
|
+
}
|
|
58
|
+
function errorMessage(tool_call_id, message) {
|
|
59
|
+
return {
|
|
60
|
+
role: "tool",
|
|
61
|
+
tool_call_id,
|
|
62
|
+
content: JSON.stringify({ error: message })
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function describeError(err) {
|
|
66
|
+
if (err instanceof Error) {
|
|
67
|
+
const name = err.name && err.name !== "Error" ? `${err.name}: ` : "";
|
|
68
|
+
return `${name}${err.message}`;
|
|
69
|
+
}
|
|
70
|
+
return typeof err === "string" ? err : JSON.stringify(err);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export { createGitmorphRepoTools, createGitmorphTools };
|
|
74
|
+
//# sourceMappingURL=index.js.map
|
|
75
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/openai/index.ts"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import type OpenAI from \"openai\";\nimport type { GitMorph } from \"../client.js\";\nimport {\n resolveToolSet,\n type CreateToolsOptions,\n type NormalizedTool,\n} from \"../tools/core.js\";\nimport { toJsonSchema } from \"../tools/json-schema.js\";\nimport { clampOutput } from \"../tools/truncate.js\";\nimport type { GitmorphToolName } from \"../tools/registry.js\";\n\nexport { GITMORPH_SYSTEM_PROMPT } from \"../tools/instructions.js\";\nexport { DEFAULT_TOOL_NAMES } from \"../tools/registry.js\";\nexport type { CreateToolsOptions } from \"../tools/core.js\";\nexport type { GitmorphToolName, DefaultGitmorphToolName } from \"../tools/registry.js\";\n\n/**\n * Return value of {@link createGitmorphTools} for OpenAI. `tools` is a drop-in\n * for `chat.completions.create({ tools })`; `handleToolCall` consumes one\n * `tool_call` from the assistant message and returns a ready-to-send tool\n * message.\n */\nexport interface GitmorphOpenAITools {\n readonly tools: OpenAI.Chat.Completions.ChatCompletionTool[];\n /**\n * Execute a tool_call and return a `tool` role message. Never throws —\n * errors are serialized into the message content so the model can recover.\n */\n handleToolCall(\n call: OpenAI.Chat.Completions.ChatCompletionMessageToolCall,\n ): Promise<OpenAI.Chat.Completions.ChatCompletionToolMessageParam>;\n}\n\n/**\n * Create OpenAI SDK tools + dispatcher for a {@link GitMorph} client.\n *\n * @example\n * ```ts\n * import OpenAI from \"openai\";\n * import { GitMorph } from \"@morphllm/gitmorph-sdk\";\n * import { createGitmorphTools, GITMORPH_SYSTEM_PROMPT } from \"@morphllm/gitmorph-sdk/openai\";\n *\n * const openai = new OpenAI();\n * const gm = new GitMorph();\n * const { tools, handleToolCall } = createGitmorphTools(gm);\n *\n * const messages: OpenAI.Chat.Completions.ChatCompletionMessageParam[] = [\n * { role: \"system\", content: GITMORPH_SYSTEM_PROMPT },\n * { role: \"user\", content: \"Find every useEffect in facebook/react\" },\n * ];\n *\n * for (let step = 0; step < 10; step++) {\n * const res = await openai.chat.completions.create({ model: \"gpt-4o\", tools, messages });\n * const msg = res.choices[0]!.message;\n * messages.push(msg);\n * if (!msg.tool_calls?.length) break;\n * const results = await Promise.all(msg.tool_calls.map(handleToolCall));\n * messages.push(...results);\n * }\n * ```\n */\nexport function createGitmorphTools<\n const Only extends readonly GitmorphToolName[] = readonly GitmorphToolName[],\n>(\n gm: GitMorph,\n opts: CreateToolsOptions<Only> = {},\n): GitmorphOpenAITools {\n return build(resolveToolSet(gm, opts), opts);\n}\n\n/**\n * Pinned variant — every tool operates on a single repository.\n *\n * @example\n * ```ts\n * const { tools, handleToolCall } = createGitmorphRepoTools(gm, \"facebook/react\");\n * ```\n */\nexport function createGitmorphRepoTools<\n const Only extends readonly GitmorphToolName[] = readonly GitmorphToolName[],\n>(\n gm: GitMorph,\n slug: string,\n opts: CreateToolsOptions<Only> = {},\n): GitmorphOpenAITools {\n return build(resolveToolSet(gm, opts, slug), opts);\n}\n\n// ── Internals ────────────────────────────────────────────────────────────────\n\nfunction build(\n normalized: NormalizedTool[],\n opts: CreateToolsOptions,\n): GitmorphOpenAITools {\n const byName = new Map(normalized.map((t) => [t.name, t]));\n const maxBytes = opts.maxOutputBytes;\n\n const tools: OpenAI.Chat.Completions.ChatCompletionTool[] = normalized.map(\n (t) => ({\n type: \"function\",\n function: {\n name: t.name,\n description: t.description,\n parameters: toJsonSchema(t.schema) as Record<string, unknown>,\n },\n }),\n );\n\n const handleToolCall: GitmorphOpenAITools[\"handleToolCall\"] = async (call) => {\n const name = call.function.name;\n const def = byName.get(name);\n if (!def) return errorMessage(call.id, `Unknown tool: ${name}`);\n\n let args: unknown;\n try {\n args = call.function.arguments\n ? JSON.parse(call.function.arguments)\n : {};\n } catch (err) {\n return errorMessage(\n call.id,\n `Invalid JSON arguments for ${name}: ${\n err instanceof Error ? err.message : String(err)\n }`,\n );\n }\n\n const parsed = def.schema.safeParse(args);\n if (!parsed.success) {\n return errorMessage(\n call.id,\n `Invalid input for ${name}: ${parsed.error.message}`,\n );\n }\n\n try {\n const result = await def.execute(parsed.data);\n return {\n role: \"tool\",\n tool_call_id: call.id,\n content: clampOutput(result, maxBytes),\n };\n } catch (err) {\n return errorMessage(call.id, describeError(err));\n }\n };\n\n return { tools, handleToolCall };\n}\n\nfunction errorMessage(\n tool_call_id: string,\n message: string,\n): OpenAI.Chat.Completions.ChatCompletionToolMessageParam {\n return {\n role: \"tool\",\n tool_call_id,\n content: JSON.stringify({ error: message }),\n };\n}\n\nfunction describeError(err: unknown): string {\n if (err instanceof Error) {\n const name = err.name && err.name !== \"Error\" ? `${err.name}: ` : \"\";\n return `${name}${err.message}`;\n }\n return typeof err === \"string\" ? err : JSON.stringify(err);\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,30 +1,78 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@morphllm/gitmorph-sdk",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "TypeScript SDK for
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Agent-native TypeScript SDK for reading Git repositories. Drop-in tools for the Vercel AI SDK, Anthropic, OpenAI, and MCP.",
|
|
5
5
|
"type": "module",
|
|
6
|
+
"sideEffects": false,
|
|
6
7
|
"main": "./dist/index.js",
|
|
7
8
|
"module": "./dist/index.js",
|
|
8
9
|
"types": "./dist/index.d.ts",
|
|
9
10
|
"exports": {
|
|
10
11
|
".": {
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
}
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"import": "./dist/index.js"
|
|
14
|
+
},
|
|
15
|
+
"./ai": {
|
|
16
|
+
"types": "./dist/ai/index.d.ts",
|
|
17
|
+
"import": "./dist/ai/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./anthropic": {
|
|
20
|
+
"types": "./dist/anthropic/index.d.ts",
|
|
21
|
+
"import": "./dist/anthropic/index.js"
|
|
22
|
+
},
|
|
23
|
+
"./openai": {
|
|
24
|
+
"types": "./dist/openai/index.d.ts",
|
|
25
|
+
"import": "./dist/openai/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./mcp": {
|
|
28
|
+
"types": "./dist/mcp/index.d.ts",
|
|
29
|
+
"import": "./dist/mcp/index.js"
|
|
30
|
+
},
|
|
31
|
+
"./package.json": "./package.json"
|
|
32
|
+
},
|
|
33
|
+
"bin": {
|
|
34
|
+
"gitmorph-mcp": "./dist/mcp/bin.js"
|
|
14
35
|
},
|
|
15
36
|
"files": [
|
|
16
|
-
"dist"
|
|
37
|
+
"dist",
|
|
38
|
+
"README.md",
|
|
39
|
+
"LICENSE"
|
|
17
40
|
],
|
|
18
41
|
"scripts": {
|
|
19
|
-
"build": "
|
|
42
|
+
"build": "tsup && chmod +x dist/mcp/bin.js",
|
|
43
|
+
"test": "bun test",
|
|
44
|
+
"typecheck": "tsc --noEmit && tsc -p tsconfig.test.json",
|
|
20
45
|
"prepublishOnly": "bun run build"
|
|
21
46
|
},
|
|
22
47
|
"publishConfig": {
|
|
23
48
|
"access": "public"
|
|
24
49
|
},
|
|
50
|
+
"peerDependencies": {
|
|
51
|
+
"zod": "^3.23.0",
|
|
52
|
+
"zod-to-json-schema": "^3.23.0",
|
|
53
|
+
"ai": "^5.0.0",
|
|
54
|
+
"@anthropic-ai/sdk": "^0.30.0",
|
|
55
|
+
"openai": "^4.55.0",
|
|
56
|
+
"@modelcontextprotocol/sdk": "^1.0.0"
|
|
57
|
+
},
|
|
58
|
+
"peerDependenciesMeta": {
|
|
59
|
+
"zod": { "optional": true },
|
|
60
|
+
"zod-to-json-schema": { "optional": true },
|
|
61
|
+
"ai": { "optional": true },
|
|
62
|
+
"@anthropic-ai/sdk": { "optional": true },
|
|
63
|
+
"openai": { "optional": true },
|
|
64
|
+
"@modelcontextprotocol/sdk": { "optional": true }
|
|
65
|
+
},
|
|
25
66
|
"devDependencies": {
|
|
67
|
+
"@anthropic-ai/sdk": "^0.30.0",
|
|
68
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
69
|
+
"ai": "^5.0.0",
|
|
26
70
|
"bun-types": "latest",
|
|
27
|
-
"
|
|
71
|
+
"openai": "^4.55.0",
|
|
72
|
+
"tsup": "^8.3.0",
|
|
73
|
+
"typescript": "^5.6.0",
|
|
74
|
+
"zod": "^3.23.0",
|
|
75
|
+
"zod-to-json-schema": "^3.23.0"
|
|
28
76
|
},
|
|
29
77
|
"repository": {
|
|
30
78
|
"type": "git",
|
package/dist/api.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
interface RequestOptions {
|
|
2
|
-
host: string;
|
|
3
|
-
token: string;
|
|
4
|
-
body?: unknown;
|
|
5
|
-
params?: Record<string, string>;
|
|
6
|
-
}
|
|
7
|
-
export declare function apiRequest<T = unknown>(method: string, path: string, options: RequestOptions): Promise<T>;
|
|
8
|
-
export declare function apiRequestRaw(method: string, path: string, options: RequestOptions): Promise<string>;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=api.d.ts.map
|
package/dist/api.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAEA,UAAU,cAAc;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAmCD,wBAAsB,UAAU,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,CAAC,CAAC,CAcZ;AAED,wBAAsB,aAAa,CACjC,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,MAAM,CAAC,CAWjB"}
|
package/dist/client.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { GitMorphRepo } from "./repo.js";
|
|
2
|
-
import type { GitMorphOptions, Repository, MirrorOptions, MirrorResult, GrepAllOptions, GrepAllResult } from "./types.js";
|
|
3
|
-
export declare class GitMorph {
|
|
4
|
-
private token;
|
|
5
|
-
private host;
|
|
6
|
-
constructor(options?: GitMorphOptions);
|
|
7
|
-
private get auth();
|
|
8
|
-
repo(slug: string): GitMorphRepo;
|
|
9
|
-
getRepositoryInfo(slug: string): Promise<Repository>;
|
|
10
|
-
mirror(source: string, options?: MirrorOptions): Promise<MirrorResult>;
|
|
11
|
-
grepAll(options: GrepAllOptions): Promise<GrepAllResult>;
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EACV,eAAe,EACf,UAAU,EACV,aAAa,EACb,YAAY,EACZ,cAAc,EACd,aAAa,EAEd,MAAM,YAAY,CAAC;AAyBpB,qBAAa,QAAQ;IACnB,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,IAAI,CAAS;gBAET,OAAO,CAAC,EAAE,eAAe;IAMrC,OAAO,KAAK,IAAI,GAEf;IAED,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY;IAK1B,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAKpD,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,YAAY,CAAC;IAMtE,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC;CA0B/D"}
|
package/dist/config.d.ts
DELETED
package/dist/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AA6BA,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IACxE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAoBA"}
|
package/dist/errors.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export declare class GitMorphError extends Error {
|
|
2
|
-
constructor(message: string);
|
|
3
|
-
}
|
|
4
|
-
export declare class AuthenticationError extends GitMorphError {
|
|
5
|
-
constructor(message?: string);
|
|
6
|
-
}
|
|
7
|
-
export declare class ApiError extends GitMorphError {
|
|
8
|
-
status: number;
|
|
9
|
-
url: string;
|
|
10
|
-
constructor(message: string, status: number, url: string);
|
|
11
|
-
}
|
|
12
|
-
export declare class MirrorError extends GitMorphError {
|
|
13
|
-
constructor(message: string);
|
|
14
|
-
}
|
|
15
|
-
export declare class GrepError extends GitMorphError {
|
|
16
|
-
constructor(message: string);
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,aAAc,SAAQ,KAAK;gBAC1B,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,mBAAoB,SAAQ,aAAa;gBACxC,OAAO,CAAC,EAAE,MAAM;CAO7B;AAED,qBAAa,QAAS,SAAQ,aAAa;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;gBAEA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM;CAMzD;AAED,qBAAa,WAAY,SAAQ,aAAa;gBAChC,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,SAAU,SAAQ,aAAa;gBAC9B,OAAO,EAAE,MAAM;CAI5B"}
|