git-coco 0.5.0 → 0.6.1
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.d.ts +263 -2
- package/dist/index.esm.mjs +427 -52
- package/dist/index.js +428 -51
- package/package.json +12 -5
- package/dist/commands/changelog/handler.d.ts +0 -3
- package/dist/commands/changelog/index.d.ts +0 -10
- package/dist/commands/changelog/options.d.ts +0 -16
- package/dist/commands/commit/handler.d.ts +0 -3
- package/dist/commands/commit/index.d.ts +0 -10
- package/dist/commands/commit/options.d.ts +0 -15
- package/dist/commands/types.d.ts +0 -14
- package/dist/index.esm.mjs.map +0 -1
- package/dist/lib/config/loadConfig.d.ts +0 -25
- package/dist/lib/config/services/env.d.ts +0 -8
- package/dist/lib/config/services/git.d.ts +0 -8
- package/dist/lib/config/services/ignore.d.ts +0 -15
- package/dist/lib/config/services/project.d.ts +0 -8
- package/dist/lib/config/services/xdg.d.ts +0 -8
- package/dist/lib/config/types.d.ts +0 -83
- package/dist/lib/langchain/chains/summarize.d.ts +0 -11
- package/dist/lib/langchain/executeChain.d.ts +0 -6
- package/dist/lib/langchain/prompts/changelog.d.ts +0 -3
- package/dist/lib/langchain/prompts/commitDefault.d.ts +0 -3
- package/dist/lib/langchain/prompts/summarize.d.ts +0 -3
- package/dist/lib/langchain/utils.d.ts +0 -48
- package/dist/lib/parsers/default/index.d.ts +0 -2
- package/dist/lib/parsers/default/utils/collectDiffs.d.ts +0 -8
- package/dist/lib/parsers/default/utils/createDiffTree.d.ts +0 -13
- package/dist/lib/parsers/default/utils/summarizeDiffs.d.ts +0 -26
- package/dist/lib/parsers/noResult.d.ts +0 -8
- package/dist/lib/simple-git/createCommit.d.ts +0 -2
- package/dist/lib/simple-git/getChanges.d.ts +0 -15
- package/dist/lib/simple-git/getChangesByCommit.d.ts +0 -13
- package/dist/lib/simple-git/getCommitLogCurrentBranch.d.ts +0 -9
- package/dist/lib/simple-git/getCommitLogRange.d.ts +0 -7
- package/dist/lib/simple-git/getCurrentBranchName.d.ts +0 -5
- package/dist/lib/simple-git/getDiff.d.ts +0 -7
- package/dist/lib/simple-git/getDiffFromCommmit.d.ts +0 -10
- package/dist/lib/simple-git/getRepo.d.ts +0 -2
- package/dist/lib/simple-git/getStatus.d.ts +0 -3
- package/dist/lib/simple-git/getSummaryText.d.ts +0 -3
- package/dist/lib/simple-git/helpers.d.ts +0 -6
- package/dist/lib/types.d.ts +0 -47
- package/dist/lib/ui/editPrompt.d.ts +0 -2
- package/dist/lib/ui/editResult.d.ts +0 -2
- package/dist/lib/ui/generateAndReviewLoop.d.ts +0 -16
- package/dist/lib/ui/getUserReviewDecision.d.ts +0 -2
- package/dist/lib/ui/handleResult.d.ts +0 -5
- package/dist/lib/ui/helpers.d.ts +0 -3
- package/dist/lib/ui/logResult.d.ts +0 -1
- package/dist/lib/ui/logSuccess.d.ts +0 -1
- package/dist/lib/utils/getPathFromFilePath.d.ts +0 -6
- package/dist/lib/utils/getTokenizer.d.ts +0 -9
- package/dist/lib/utils/logger.d.ts +0 -23
- package/dist/lib/utils/removeUndefined.d.ts +0 -9
- package/dist/stats.html +0 -5305
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,263 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/// <reference types="yargs" />
|
|
2
|
+
import * as yargs from 'yargs';
|
|
3
|
+
import { Argv } from 'yargs';
|
|
4
|
+
import { HuggingFaceInference } from 'langchain/llms/hf';
|
|
5
|
+
import { BaseLLMParams } from 'langchain/llms/base';
|
|
6
|
+
import { OpenAIInput, AzureOpenAIInput, OpenAI } from 'langchain/llms/openai';
|
|
7
|
+
import { SimpleGit } from 'simple-git';
|
|
8
|
+
import { Color } from 'chalk';
|
|
9
|
+
import GPT3NodeTokenizer from 'gpt3-tokenizer';
|
|
10
|
+
|
|
11
|
+
interface Config$1 {
|
|
12
|
+
/**
|
|
13
|
+
* The LLM model to use for generating results.
|
|
14
|
+
*
|
|
15
|
+
* @default 'openai/gpt-4'
|
|
16
|
+
*
|
|
17
|
+
* @example 'openai/gpt-4'
|
|
18
|
+
* @example 'openai/gpt-3.5-turbo'
|
|
19
|
+
* @example 'huggingface/bigscience/bloom'
|
|
20
|
+
**/
|
|
21
|
+
model: string;
|
|
22
|
+
/**
|
|
23
|
+
* The OpenAI API key.
|
|
24
|
+
*/
|
|
25
|
+
openAIApiKey?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The HuggingFace Hub API key.
|
|
28
|
+
*/
|
|
29
|
+
huggingFaceHubApiKey?: string;
|
|
30
|
+
/**
|
|
31
|
+
* The maximum number of tokens per request.
|
|
32
|
+
*
|
|
33
|
+
* @default 1024
|
|
34
|
+
*/
|
|
35
|
+
tokenLimit?: number;
|
|
36
|
+
/**
|
|
37
|
+
* The prompt text used for generating results.
|
|
38
|
+
*/
|
|
39
|
+
prompt?: string;
|
|
40
|
+
/**
|
|
41
|
+
* The temperature value controls the randomness of the generated output.
|
|
42
|
+
* Higher values (e.g., 0.8) make the output more random, while lower values (e.g., 0.2) make it more deterministic.
|
|
43
|
+
*
|
|
44
|
+
* @default 0.4
|
|
45
|
+
*/
|
|
46
|
+
temperature?: number;
|
|
47
|
+
/**
|
|
48
|
+
* The output destination for the generated result.
|
|
49
|
+
* - 'stdout': Prints the result to the standard output. This is the default behavior.
|
|
50
|
+
* - 'interactive': Provides an interactive prompt for editing the result & committing the changes.
|
|
51
|
+
*
|
|
52
|
+
* @default 'stdout'
|
|
53
|
+
*/
|
|
54
|
+
mode?: 'stdout' | 'interactive';
|
|
55
|
+
/**
|
|
56
|
+
* Enable verbose logging.
|
|
57
|
+
*
|
|
58
|
+
* @default false
|
|
59
|
+
*/
|
|
60
|
+
verbose?: boolean;
|
|
61
|
+
/**
|
|
62
|
+
* Open the commit message in an editor for editing before proceeding.
|
|
63
|
+
*
|
|
64
|
+
* @default false
|
|
65
|
+
*/
|
|
66
|
+
openInEditor?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* The prompt text used specifically for generating summaries of large files.
|
|
69
|
+
*/
|
|
70
|
+
summarizePrompt?: string;
|
|
71
|
+
/**
|
|
72
|
+
* An array of file paths or patterns to be ignored during processing.
|
|
73
|
+
*
|
|
74
|
+
* Note: This is a list of patterns interpreted by the `minimatch` library.
|
|
75
|
+
* @see https://github.com/isaacs/minimatch
|
|
76
|
+
*
|
|
77
|
+
* @example ['package-lock.json', 'node_modules']
|
|
78
|
+
* @default ['package-lock.json', contents of .gitignore, contents of .ignore]
|
|
79
|
+
*/
|
|
80
|
+
ignoredFiles?: string[];
|
|
81
|
+
/**
|
|
82
|
+
* An array of file extensions to be ignored during processing.
|
|
83
|
+
*
|
|
84
|
+
* @default ['.map', '.lock']
|
|
85
|
+
*/
|
|
86
|
+
ignoredExtensions?: string[];
|
|
87
|
+
/**
|
|
88
|
+
* Default git branch for the repository.
|
|
89
|
+
*
|
|
90
|
+
* @default 'main'
|
|
91
|
+
*/
|
|
92
|
+
defaultBranch?: string;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
interface BaseArgvOptions {
|
|
96
|
+
interactive: boolean;
|
|
97
|
+
help: boolean;
|
|
98
|
+
verbose: boolean;
|
|
99
|
+
}
|
|
100
|
+
interface BaseCommandOptions extends BaseArgvOptions {
|
|
101
|
+
[x: string]: unknown;
|
|
102
|
+
model: string;
|
|
103
|
+
openAIApiKey: string;
|
|
104
|
+
huggingFaceHubApiKey: string;
|
|
105
|
+
tokenLimit: number;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
interface CommitOptions$1 extends BaseCommandOptions {
|
|
109
|
+
prompt: string;
|
|
110
|
+
commit: boolean;
|
|
111
|
+
summarizePrompt: string;
|
|
112
|
+
openInEditor: boolean;
|
|
113
|
+
ignoredFiles: string[];
|
|
114
|
+
ignoredExtensions: string[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
declare function handler$2(argv: Argv<CommitOptions$1>['argv']): Promise<void>;
|
|
118
|
+
|
|
119
|
+
declare const _default$2: {
|
|
120
|
+
command: string;
|
|
121
|
+
desc: string;
|
|
122
|
+
builder: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{}, string> & yargs.InferredOptionTypes<Record<string, yargs.Options>>>;
|
|
123
|
+
handler: typeof handler$2;
|
|
124
|
+
options: Record<string, yargs.Options>;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
interface ChangelogOptions extends BaseCommandOptions {
|
|
128
|
+
range: string;
|
|
129
|
+
prompt: string;
|
|
130
|
+
commit: boolean;
|
|
131
|
+
summarizePrompt: string;
|
|
132
|
+
openInEditor: boolean;
|
|
133
|
+
ignoredFiles: string[];
|
|
134
|
+
ignoredExtensions: string[];
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
declare function handler$1(argv: Argv<ChangelogOptions>['argv']): Promise<void>;
|
|
138
|
+
|
|
139
|
+
declare const _default$1: {
|
|
140
|
+
command: string;
|
|
141
|
+
desc: string;
|
|
142
|
+
builder: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{}, string> & yargs.InferredOptionTypes<Record<string, yargs.Options>>>;
|
|
143
|
+
handler: typeof handler$1;
|
|
144
|
+
options: Record<string, yargs.Options>;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
interface CommitOptions extends BaseCommandOptions {
|
|
148
|
+
prompt: string;
|
|
149
|
+
commit: boolean;
|
|
150
|
+
summarizePrompt: string;
|
|
151
|
+
openInEditor: boolean;
|
|
152
|
+
ignoredFiles: string[];
|
|
153
|
+
ignoredExtensions: string[];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
declare function handler(argv: Argv<CommitOptions>['argv']): Promise<void>;
|
|
157
|
+
|
|
158
|
+
declare const _default: {
|
|
159
|
+
command: string;
|
|
160
|
+
desc: string;
|
|
161
|
+
builder: (yargs: yargs.Argv<{}>) => yargs.Argv<yargs.Omit<{}, string> & yargs.InferredOptionTypes<Record<string, yargs.Options>>>;
|
|
162
|
+
handler: typeof handler;
|
|
163
|
+
options: Record<string, yargs.Options>;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Get LLM Model Based on Configuration
|
|
168
|
+
* @param fields
|
|
169
|
+
* @param configuration
|
|
170
|
+
* @returns LLM Model
|
|
171
|
+
*/
|
|
172
|
+
declare function getModel(name: string, key: string, fields?: (Partial<OpenAIInput> & Partial<AzureOpenAIInput> & BaseLLMParams) | undefined): OpenAI | HuggingFaceInference;
|
|
173
|
+
|
|
174
|
+
interface LoggerOptions {
|
|
175
|
+
color?: typeof Color;
|
|
176
|
+
}
|
|
177
|
+
interface SpinnerOptions {
|
|
178
|
+
mode?: undefined | 'stop' | 'succeed' | 'warn' | 'fail';
|
|
179
|
+
color?: typeof Color;
|
|
180
|
+
}
|
|
181
|
+
interface Config {
|
|
182
|
+
verbose?: boolean;
|
|
183
|
+
}
|
|
184
|
+
declare class Logger {
|
|
185
|
+
private config;
|
|
186
|
+
private timerStart;
|
|
187
|
+
private spinner;
|
|
188
|
+
constructor(config: Config);
|
|
189
|
+
log(message: string, options?: LoggerOptions): Logger;
|
|
190
|
+
verbose(message: string, options?: LoggerOptions): Logger;
|
|
191
|
+
startTimer(): Logger;
|
|
192
|
+
stopTimer(message?: string, options?: LoggerOptions): Logger;
|
|
193
|
+
startSpinner(message: string, options?: Omit<SpinnerOptions, 'mode'>): Logger;
|
|
194
|
+
stopSpinner(message?: string | undefined, options?: SpinnerOptions): Logger;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Wrapper around GPT3NodeTokenizer to handle default export.
|
|
199
|
+
*
|
|
200
|
+
* @see https://github.com/botisan-ai/gpt3-tokenizer/issues/18
|
|
201
|
+
*
|
|
202
|
+
* @returns {GPT3NodeTokenizer} The GPT3NodeTokenizer instance.
|
|
203
|
+
*/
|
|
204
|
+
declare const getTokenizer: () => GPT3NodeTokenizer;
|
|
205
|
+
|
|
206
|
+
type FileChangeStatus = 'modified' | 'renamed' | 'added' | 'deleted' | 'untracked' | 'unknown';
|
|
207
|
+
interface FileChange {
|
|
208
|
+
summary: string;
|
|
209
|
+
filePath: string;
|
|
210
|
+
oldFilePath?: string;
|
|
211
|
+
status: FileChangeStatus;
|
|
212
|
+
}
|
|
213
|
+
interface FileDiff {
|
|
214
|
+
file: string;
|
|
215
|
+
diff: string;
|
|
216
|
+
summary: string;
|
|
217
|
+
tokenCount: number;
|
|
218
|
+
}
|
|
219
|
+
interface DiffNode {
|
|
220
|
+
path: string;
|
|
221
|
+
diffs: FileDiff[];
|
|
222
|
+
children: DiffNode[];
|
|
223
|
+
}
|
|
224
|
+
interface DirectoryDiff {
|
|
225
|
+
path: string;
|
|
226
|
+
diffs: FileDiff[];
|
|
227
|
+
summary?: string;
|
|
228
|
+
tokenCount: number;
|
|
229
|
+
}
|
|
230
|
+
interface BaseParserOptions {
|
|
231
|
+
tokenizer: ReturnType<typeof getTokenizer>;
|
|
232
|
+
model: ReturnType<typeof getModel>;
|
|
233
|
+
git: SimpleGit;
|
|
234
|
+
logger: Logger;
|
|
235
|
+
}
|
|
236
|
+
interface BaseParserInput {
|
|
237
|
+
options: BaseParserOptions;
|
|
238
|
+
}
|
|
239
|
+
interface FileChangeParserInput extends BaseParserInput {
|
|
240
|
+
changes: FileChange[];
|
|
241
|
+
commit: '--staged' | string;
|
|
242
|
+
}
|
|
243
|
+
interface CommitLogParserInput extends BaseParserInput {
|
|
244
|
+
range: {
|
|
245
|
+
from: string;
|
|
246
|
+
to: string;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
type types_d_BaseParserInput = BaseParserInput;
|
|
251
|
+
type types_d_BaseParserOptions = BaseParserOptions;
|
|
252
|
+
type types_d_CommitLogParserInput = CommitLogParserInput;
|
|
253
|
+
type types_d_DiffNode = DiffNode;
|
|
254
|
+
type types_d_DirectoryDiff = DirectoryDiff;
|
|
255
|
+
type types_d_FileChange = FileChange;
|
|
256
|
+
type types_d_FileChangeParserInput = FileChangeParserInput;
|
|
257
|
+
type types_d_FileChangeStatus = FileChangeStatus;
|
|
258
|
+
type types_d_FileDiff = FileDiff;
|
|
259
|
+
declare namespace types_d {
|
|
260
|
+
export type { types_d_BaseParserInput as BaseParserInput, types_d_BaseParserOptions as BaseParserOptions, types_d_CommitLogParserInput as CommitLogParserInput, types_d_DiffNode as DiffNode, types_d_DirectoryDiff as DirectoryDiff, types_d_FileChange as FileChange, types_d_FileChangeParserInput as FileChangeParserInput, types_d_FileChangeStatus as FileChangeStatus, types_d_FileDiff as FileDiff };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export { type Config$1 as Config, _default$1 as changelog, _default$2 as commit, _default as init, types_d as types };
|