gut-cli 0.1.14 → 0.1.15
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/dist/index.js +41 -18
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +300 -0
- package/dist/lib/index.js +583 -0
- package/dist/lib/index.js.map +1 -0
- package/package.json +17 -2
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
type Provider = 'gemini' | 'openai' | 'anthropic' | 'ollama';
|
|
4
|
+
declare function saveApiKey(provider: Provider, apiKey: string): Promise<void>;
|
|
5
|
+
declare function getApiKey(provider: Provider): Promise<string | null>;
|
|
6
|
+
declare function deleteApiKey(provider: Provider): Promise<boolean>;
|
|
7
|
+
declare function listProviders(): Promise<{
|
|
8
|
+
provider: Provider;
|
|
9
|
+
hasKey: boolean;
|
|
10
|
+
}[]>;
|
|
11
|
+
|
|
12
|
+
interface AIOptions {
|
|
13
|
+
provider: Provider;
|
|
14
|
+
model?: string;
|
|
15
|
+
ollamaBaseUrl?: string;
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Find a user's project template from .gut/ folder
|
|
20
|
+
* @param repoRoot - The root directory of the user's repository
|
|
21
|
+
* @param templateName - Name of the template file (without .md extension)
|
|
22
|
+
* @returns Template content if found, null otherwise
|
|
23
|
+
*/
|
|
24
|
+
declare function findTemplate(repoRoot: string, templateName: string): string | null;
|
|
25
|
+
declare function generateCommitMessage(diff: string, options: AIOptions, template?: string): Promise<string>;
|
|
26
|
+
declare function generatePRDescription(context: {
|
|
27
|
+
baseBranch: string;
|
|
28
|
+
currentBranch: string;
|
|
29
|
+
commits: string[];
|
|
30
|
+
diff: string;
|
|
31
|
+
}, options: AIOptions, template?: string): Promise<{
|
|
32
|
+
title: string;
|
|
33
|
+
body: string;
|
|
34
|
+
}>;
|
|
35
|
+
declare const CodeReviewSchema: z.ZodObject<{
|
|
36
|
+
summary: z.ZodString;
|
|
37
|
+
issues: z.ZodArray<z.ZodObject<{
|
|
38
|
+
severity: z.ZodEnum<["critical", "warning", "suggestion"]>;
|
|
39
|
+
file: z.ZodString;
|
|
40
|
+
line: z.ZodOptional<z.ZodNumber>;
|
|
41
|
+
message: z.ZodString;
|
|
42
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
message: string;
|
|
45
|
+
severity: "critical" | "warning" | "suggestion";
|
|
46
|
+
file: string;
|
|
47
|
+
suggestion?: string | undefined;
|
|
48
|
+
line?: number | undefined;
|
|
49
|
+
}, {
|
|
50
|
+
message: string;
|
|
51
|
+
severity: "critical" | "warning" | "suggestion";
|
|
52
|
+
file: string;
|
|
53
|
+
suggestion?: string | undefined;
|
|
54
|
+
line?: number | undefined;
|
|
55
|
+
}>, "many">;
|
|
56
|
+
positives: z.ZodArray<z.ZodString, "many">;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
summary: string;
|
|
59
|
+
issues: {
|
|
60
|
+
message: string;
|
|
61
|
+
severity: "critical" | "warning" | "suggestion";
|
|
62
|
+
file: string;
|
|
63
|
+
suggestion?: string | undefined;
|
|
64
|
+
line?: number | undefined;
|
|
65
|
+
}[];
|
|
66
|
+
positives: string[];
|
|
67
|
+
}, {
|
|
68
|
+
summary: string;
|
|
69
|
+
issues: {
|
|
70
|
+
message: string;
|
|
71
|
+
severity: "critical" | "warning" | "suggestion";
|
|
72
|
+
file: string;
|
|
73
|
+
suggestion?: string | undefined;
|
|
74
|
+
line?: number | undefined;
|
|
75
|
+
}[];
|
|
76
|
+
positives: string[];
|
|
77
|
+
}>;
|
|
78
|
+
type CodeReview = z.infer<typeof CodeReviewSchema>;
|
|
79
|
+
declare function generateCodeReview(diff: string, options: AIOptions, template?: string): Promise<CodeReview>;
|
|
80
|
+
declare const ChangelogSchema: z.ZodObject<{
|
|
81
|
+
version: z.ZodOptional<z.ZodString>;
|
|
82
|
+
date: z.ZodString;
|
|
83
|
+
sections: z.ZodArray<z.ZodObject<{
|
|
84
|
+
type: z.ZodString;
|
|
85
|
+
items: z.ZodArray<z.ZodString, "many">;
|
|
86
|
+
}, "strip", z.ZodTypeAny, {
|
|
87
|
+
type: string;
|
|
88
|
+
items: string[];
|
|
89
|
+
}, {
|
|
90
|
+
type: string;
|
|
91
|
+
items: string[];
|
|
92
|
+
}>, "many">;
|
|
93
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
94
|
+
}, "strip", z.ZodTypeAny, {
|
|
95
|
+
date: string;
|
|
96
|
+
sections: {
|
|
97
|
+
type: string;
|
|
98
|
+
items: string[];
|
|
99
|
+
}[];
|
|
100
|
+
summary?: string | undefined;
|
|
101
|
+
version?: string | undefined;
|
|
102
|
+
}, {
|
|
103
|
+
date: string;
|
|
104
|
+
sections: {
|
|
105
|
+
type: string;
|
|
106
|
+
items: string[];
|
|
107
|
+
}[];
|
|
108
|
+
summary?: string | undefined;
|
|
109
|
+
version?: string | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
type Changelog = z.infer<typeof ChangelogSchema>;
|
|
112
|
+
declare function generateChangelog(context: {
|
|
113
|
+
commits: Array<{
|
|
114
|
+
hash: string;
|
|
115
|
+
message: string;
|
|
116
|
+
author: string;
|
|
117
|
+
date: string;
|
|
118
|
+
}>;
|
|
119
|
+
diff: string;
|
|
120
|
+
fromRef: string;
|
|
121
|
+
toRef: string;
|
|
122
|
+
}, options: AIOptions, template?: string): Promise<Changelog>;
|
|
123
|
+
declare const ConflictResolutionSchema: z.ZodObject<{
|
|
124
|
+
resolvedContent: z.ZodString;
|
|
125
|
+
explanation: z.ZodString;
|
|
126
|
+
strategy: z.ZodEnum<["ours", "theirs", "combined", "rewritten"]>;
|
|
127
|
+
}, "strip", z.ZodTypeAny, {
|
|
128
|
+
resolvedContent: string;
|
|
129
|
+
explanation: string;
|
|
130
|
+
strategy: "ours" | "theirs" | "combined" | "rewritten";
|
|
131
|
+
}, {
|
|
132
|
+
resolvedContent: string;
|
|
133
|
+
explanation: string;
|
|
134
|
+
strategy: "ours" | "theirs" | "combined" | "rewritten";
|
|
135
|
+
}>;
|
|
136
|
+
type ConflictResolution = z.infer<typeof ConflictResolutionSchema>;
|
|
137
|
+
declare const ExplanationSchema: z.ZodObject<{
|
|
138
|
+
summary: z.ZodString;
|
|
139
|
+
purpose: z.ZodString;
|
|
140
|
+
changes: z.ZodArray<z.ZodObject<{
|
|
141
|
+
file: z.ZodString;
|
|
142
|
+
description: z.ZodString;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
file: string;
|
|
145
|
+
description: string;
|
|
146
|
+
}, {
|
|
147
|
+
file: string;
|
|
148
|
+
description: string;
|
|
149
|
+
}>, "many">;
|
|
150
|
+
impact: z.ZodString;
|
|
151
|
+
notes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
152
|
+
}, "strip", z.ZodTypeAny, {
|
|
153
|
+
summary: string;
|
|
154
|
+
purpose: string;
|
|
155
|
+
changes: {
|
|
156
|
+
file: string;
|
|
157
|
+
description: string;
|
|
158
|
+
}[];
|
|
159
|
+
impact: string;
|
|
160
|
+
notes?: string[] | undefined;
|
|
161
|
+
}, {
|
|
162
|
+
summary: string;
|
|
163
|
+
purpose: string;
|
|
164
|
+
changes: {
|
|
165
|
+
file: string;
|
|
166
|
+
description: string;
|
|
167
|
+
}[];
|
|
168
|
+
impact: string;
|
|
169
|
+
notes?: string[] | undefined;
|
|
170
|
+
}>;
|
|
171
|
+
type Explanation = z.infer<typeof ExplanationSchema>;
|
|
172
|
+
declare function generateExplanation(context: {
|
|
173
|
+
type: 'commit' | 'pr' | 'file-history' | 'file-content' | 'uncommitted' | 'staged';
|
|
174
|
+
title: string;
|
|
175
|
+
diff?: string;
|
|
176
|
+
content?: string;
|
|
177
|
+
metadata: {
|
|
178
|
+
hash?: string;
|
|
179
|
+
author?: string;
|
|
180
|
+
date?: string;
|
|
181
|
+
prNumber?: string;
|
|
182
|
+
baseBranch?: string;
|
|
183
|
+
headBranch?: string;
|
|
184
|
+
commits?: string[];
|
|
185
|
+
filePath?: string;
|
|
186
|
+
};
|
|
187
|
+
}, options: AIOptions, template?: string): Promise<Explanation>;
|
|
188
|
+
interface CommitSearchResult {
|
|
189
|
+
matches: Array<{
|
|
190
|
+
hash: string;
|
|
191
|
+
message: string;
|
|
192
|
+
author: string;
|
|
193
|
+
email: string;
|
|
194
|
+
date: string;
|
|
195
|
+
reason: string;
|
|
196
|
+
relevance?: 'high' | 'medium' | 'low';
|
|
197
|
+
}>;
|
|
198
|
+
summary?: string;
|
|
199
|
+
}
|
|
200
|
+
declare function searchCommits(query: string, commits: Array<{
|
|
201
|
+
hash: string;
|
|
202
|
+
message: string;
|
|
203
|
+
author: string;
|
|
204
|
+
email: string;
|
|
205
|
+
date: string;
|
|
206
|
+
}>, options: AIOptions, maxResults?: number, template?: string): Promise<CommitSearchResult>;
|
|
207
|
+
declare function generateBranchName(description: string, options: AIOptions, context?: {
|
|
208
|
+
type?: string;
|
|
209
|
+
issue?: string;
|
|
210
|
+
}, template?: string): Promise<string>;
|
|
211
|
+
declare function generateBranchNameFromDiff(diff: string, options: AIOptions, template?: string | null): Promise<string>;
|
|
212
|
+
declare function generateStashName(diff: string, options: AIOptions, template?: string): Promise<string>;
|
|
213
|
+
declare const WorkSummarySchema: z.ZodObject<{
|
|
214
|
+
title: z.ZodString;
|
|
215
|
+
overview: z.ZodString;
|
|
216
|
+
highlights: z.ZodArray<z.ZodString, "many">;
|
|
217
|
+
details: z.ZodArray<z.ZodObject<{
|
|
218
|
+
category: z.ZodString;
|
|
219
|
+
items: z.ZodArray<z.ZodString, "many">;
|
|
220
|
+
}, "strip", z.ZodTypeAny, {
|
|
221
|
+
items: string[];
|
|
222
|
+
category: string;
|
|
223
|
+
}, {
|
|
224
|
+
items: string[];
|
|
225
|
+
category: string;
|
|
226
|
+
}>, "many">;
|
|
227
|
+
stats: z.ZodOptional<z.ZodObject<{
|
|
228
|
+
commits: z.ZodNumber;
|
|
229
|
+
filesChanged: z.ZodOptional<z.ZodNumber>;
|
|
230
|
+
additions: z.ZodOptional<z.ZodNumber>;
|
|
231
|
+
deletions: z.ZodOptional<z.ZodNumber>;
|
|
232
|
+
}, "strip", z.ZodTypeAny, {
|
|
233
|
+
commits: number;
|
|
234
|
+
filesChanged?: number | undefined;
|
|
235
|
+
additions?: number | undefined;
|
|
236
|
+
deletions?: number | undefined;
|
|
237
|
+
}, {
|
|
238
|
+
commits: number;
|
|
239
|
+
filesChanged?: number | undefined;
|
|
240
|
+
additions?: number | undefined;
|
|
241
|
+
deletions?: number | undefined;
|
|
242
|
+
}>>;
|
|
243
|
+
}, "strip", z.ZodTypeAny, {
|
|
244
|
+
title: string;
|
|
245
|
+
overview: string;
|
|
246
|
+
highlights: string[];
|
|
247
|
+
details: {
|
|
248
|
+
items: string[];
|
|
249
|
+
category: string;
|
|
250
|
+
}[];
|
|
251
|
+
stats?: {
|
|
252
|
+
commits: number;
|
|
253
|
+
filesChanged?: number | undefined;
|
|
254
|
+
additions?: number | undefined;
|
|
255
|
+
deletions?: number | undefined;
|
|
256
|
+
} | undefined;
|
|
257
|
+
}, {
|
|
258
|
+
title: string;
|
|
259
|
+
overview: string;
|
|
260
|
+
highlights: string[];
|
|
261
|
+
details: {
|
|
262
|
+
items: string[];
|
|
263
|
+
category: string;
|
|
264
|
+
}[];
|
|
265
|
+
stats?: {
|
|
266
|
+
commits: number;
|
|
267
|
+
filesChanged?: number | undefined;
|
|
268
|
+
additions?: number | undefined;
|
|
269
|
+
deletions?: number | undefined;
|
|
270
|
+
} | undefined;
|
|
271
|
+
}>;
|
|
272
|
+
type WorkSummary = z.infer<typeof WorkSummarySchema>;
|
|
273
|
+
declare function generateWorkSummary(context: {
|
|
274
|
+
commits: Array<{
|
|
275
|
+
hash: string;
|
|
276
|
+
message: string;
|
|
277
|
+
date: string;
|
|
278
|
+
}>;
|
|
279
|
+
author: string;
|
|
280
|
+
since: string;
|
|
281
|
+
until?: string;
|
|
282
|
+
diff?: string;
|
|
283
|
+
}, options: AIOptions, format?: 'daily' | 'weekly' | 'custom', template?: string): Promise<WorkSummary>;
|
|
284
|
+
declare function resolveConflict(conflictedContent: string, context: {
|
|
285
|
+
filename: string;
|
|
286
|
+
oursRef: string;
|
|
287
|
+
theirsRef: string;
|
|
288
|
+
}, options: AIOptions, template?: string): Promise<ConflictResolution>;
|
|
289
|
+
declare function generateGitignore(context: {
|
|
290
|
+
files: string;
|
|
291
|
+
configFiles?: string;
|
|
292
|
+
existingGitignore?: string;
|
|
293
|
+
}, options: AIOptions, template?: string): Promise<string>;
|
|
294
|
+
|
|
295
|
+
type Language = 'en' | 'ja';
|
|
296
|
+
declare function getLanguage(): Language;
|
|
297
|
+
declare function setLanguage(lang: Language, local?: boolean): void;
|
|
298
|
+
declare function getLanguageInstruction(lang: Language): string;
|
|
299
|
+
|
|
300
|
+
export { type AIOptions, type Changelog, type CodeReview, type CommitSearchResult, type ConflictResolution, type Explanation, type Provider, type WorkSummary, deleteApiKey, findTemplate, generateBranchName, generateBranchNameFromDiff, generateChangelog, generateCodeReview, generateCommitMessage, generateExplanation, generateGitignore, generatePRDescription, generateStashName, generateWorkSummary, getApiKey, getLanguage, getLanguageInstruction, listProviders, resolveConflict, saveApiKey, searchCommits, setLanguage };
|