git-coco 0.22.6 → 0.22.8
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 +2 -0
- package/dist/index.esm.mjs +11 -21
- package/dist/index.js +10 -20
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
import * as yargs from 'yargs';
|
|
2
3
|
import { Arguments } from 'yargs';
|
|
3
4
|
import { OllamaInput } from '@langchain/community/llms/ollama';
|
|
@@ -336,6 +337,7 @@ interface BaseParserOptions {
|
|
|
336
337
|
llm: ReturnType<typeof getLlm>;
|
|
337
338
|
git: SimpleGit;
|
|
338
339
|
logger: Logger;
|
|
340
|
+
maxTokens?: number;
|
|
339
341
|
}
|
|
340
342
|
interface BaseParserInput {
|
|
341
343
|
options: BaseParserOptions;
|
package/dist/index.esm.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import yargs from 'yargs';
|
|
|
5
5
|
import chalk from 'chalk';
|
|
6
6
|
import * as fs from 'fs';
|
|
7
7
|
import fs__default, { promises, existsSync, readFileSync } from 'fs';
|
|
8
|
-
import { confirm, editor, select,
|
|
8
|
+
import { confirm, editor, select, input, password } from '@inquirer/prompts';
|
|
9
9
|
import * as ini from 'ini';
|
|
10
10
|
import * as os from 'os';
|
|
11
11
|
import os__default from 'os';
|
|
@@ -47,7 +47,7 @@ import { pathToFileURL } from 'url';
|
|
|
47
47
|
/**
|
|
48
48
|
* Current build version from package.json
|
|
49
49
|
*/
|
|
50
|
-
const BUILD_VERSION = "0.22.
|
|
50
|
+
const BUILD_VERSION = "0.22.8";
|
|
51
51
|
|
|
52
52
|
const isInteractive = (config) => {
|
|
53
53
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -231,7 +231,7 @@ function validateRequired(value, paramName, functionName) {
|
|
|
231
231
|
function validateNonEmptyString(value, paramName, functionName) {
|
|
232
232
|
validateRequired(value, paramName, functionName);
|
|
233
233
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
234
|
-
throw new LangChainValidationError(`${
|
|
234
|
+
throw new LangChainValidationError(`${`${functionName}: ` }Parameter '${paramName}' must be a non-empty string`, { paramName, functionName, value, type: typeof value });
|
|
235
235
|
}
|
|
236
236
|
}
|
|
237
237
|
/**
|
|
@@ -240,7 +240,7 @@ function validateNonEmptyString(value, paramName, functionName) {
|
|
|
240
240
|
function validateNonEmptyArray(value, paramName, functionName) {
|
|
241
241
|
validateRequired(value, paramName, functionName);
|
|
242
242
|
if (!Array.isArray(value) || value.length === 0) {
|
|
243
|
-
throw new LangChainValidationError(`${
|
|
243
|
+
throw new LangChainValidationError(`${`${functionName}: ` }Parameter '${paramName}' must be a non-empty array`, { paramName, functionName, value, isArray: Array.isArray(value), length: Array.isArray(value) ? value.length : undefined });
|
|
244
244
|
}
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
@@ -2627,9 +2627,8 @@ const errorMap = (issue, _ctx) => {
|
|
|
2627
2627
|
}
|
|
2628
2628
|
return { message };
|
|
2629
2629
|
};
|
|
2630
|
-
var defaultErrorMap = errorMap;
|
|
2631
2630
|
|
|
2632
|
-
let overrideErrorMap =
|
|
2631
|
+
let overrideErrorMap = errorMap;
|
|
2633
2632
|
function getErrorMap() {
|
|
2634
2633
|
return overrideErrorMap;
|
|
2635
2634
|
}
|
|
@@ -2672,7 +2671,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
2672
2671
|
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
2673
2672
|
ctx.schemaErrorMap, // then schema-bound map if available
|
|
2674
2673
|
overrideMap, // then global override map
|
|
2675
|
-
overrideMap ===
|
|
2674
|
+
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
2676
2675
|
].filter((x) => !!x),
|
|
2677
2676
|
});
|
|
2678
2677
|
ctx.common.issues.push(issue);
|
|
@@ -5988,9 +5987,6 @@ ZodReadonly.create = (type, params) => {
|
|
|
5988
5987
|
...processCreateParams(params),
|
|
5989
5988
|
});
|
|
5990
5989
|
};
|
|
5991
|
-
({
|
|
5992
|
-
object: ZodObject.lazycreate,
|
|
5993
|
-
});
|
|
5994
5990
|
var ZodFirstPartyTypeKind;
|
|
5995
5991
|
(function (ZodFirstPartyTypeKind) {
|
|
5996
5992
|
ZodFirstPartyTypeKind["ZodString"] = "ZodString";
|
|
@@ -6034,7 +6030,6 @@ const stringType = ZodString.create;
|
|
|
6034
6030
|
ZodNever.create;
|
|
6035
6031
|
const arrayType = ZodArray.create;
|
|
6036
6032
|
const objectType = ZodObject.create;
|
|
6037
|
-
ZodObject.strictCreate;
|
|
6038
6033
|
const unionType = ZodUnion.create;
|
|
6039
6034
|
ZodIntersection.create;
|
|
6040
6035
|
ZodTuple.create;
|
|
@@ -7721,7 +7716,7 @@ const handler$4 = async (argv, logger) => {
|
|
|
7721
7716
|
logger.verbose(`Generating commit log since the last tag`, { color: 'yellow' });
|
|
7722
7717
|
// This function returns string[], needs to be adapted or replaced
|
|
7723
7718
|
// For now, this path will have limited details.
|
|
7724
|
-
const commitMessages = await getChangesSinceLastTag({ git
|
|
7719
|
+
const commitMessages = await getChangesSinceLastTag({ git});
|
|
7725
7720
|
commits = commitMessages.map(msg => ({ message: msg }));
|
|
7726
7721
|
}
|
|
7727
7722
|
else if (config.range && config.range.includes(':')) {
|
|
@@ -11145,10 +11140,7 @@ for (var i = 0; i < 256; i++) {
|
|
|
11145
11140
|
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
11146
11141
|
}
|
|
11147
11142
|
|
|
11148
|
-
|
|
11149
|
-
// const MAX_TOKENS_PER_SUMMARY = 4096
|
|
11150
|
-
const MAX_TOKENS_PER_SUMMARY = 12288;
|
|
11151
|
-
async function fileChangeParser({ changes, commit, options: { tokenizer, git, llm: model, logger }, }) {
|
|
11143
|
+
async function fileChangeParser({ changes, commit, options: { tokenizer, git, llm: model, logger, maxTokens }, }) {
|
|
11152
11144
|
const textSplitter = new RecursiveCharacterTextSplitter({ chunkSize: 10000, chunkOverlap: 250 });
|
|
11153
11145
|
const summarizationChain = loadSummarizationChain(model, {
|
|
11154
11146
|
type: 'map_reduce',
|
|
@@ -11166,7 +11158,7 @@ async function fileChangeParser({ changes, commit, options: { tokenizer, git, ll
|
|
|
11166
11158
|
logger.startTimer();
|
|
11167
11159
|
const summary = await summarizeDiffs(diffs, {
|
|
11168
11160
|
tokenizer,
|
|
11169
|
-
maxTokens:
|
|
11161
|
+
maxTokens: maxTokens || 4096,
|
|
11170
11162
|
textSplitter,
|
|
11171
11163
|
chain: summarizationChain,
|
|
11172
11164
|
logger,
|
|
@@ -11469,7 +11461,7 @@ const handler$3 = async (argv, logger) => {
|
|
|
11469
11461
|
return await fileChangeParser({
|
|
11470
11462
|
changes,
|
|
11471
11463
|
commit: '--staged',
|
|
11472
|
-
options: { tokenizer, git, llm, logger },
|
|
11464
|
+
options: { tokenizer, git, llm, logger, maxTokens: config.service.tokenLimit },
|
|
11473
11465
|
});
|
|
11474
11466
|
}
|
|
11475
11467
|
const commitMsg = await generateAndReviewLoop({
|
|
@@ -12885,9 +12877,7 @@ var review = {
|
|
|
12885
12877
|
command,
|
|
12886
12878
|
desc: 'Perform a code review on your changes',
|
|
12887
12879
|
builder,
|
|
12888
|
-
handler: commandExecutor(handler)
|
|
12889
|
-
options,
|
|
12890
|
-
};
|
|
12880
|
+
handler: commandExecutor(handler)};
|
|
12891
12881
|
|
|
12892
12882
|
var types = /*#__PURE__*/Object.freeze({
|
|
12893
12883
|
__proto__: null
|
package/dist/index.js
CHANGED
|
@@ -69,7 +69,7 @@ var readline__namespace = /*#__PURE__*/_interopNamespaceDefault(readline);
|
|
|
69
69
|
/**
|
|
70
70
|
* Current build version from package.json
|
|
71
71
|
*/
|
|
72
|
-
const BUILD_VERSION = "0.22.
|
|
72
|
+
const BUILD_VERSION = "0.22.8";
|
|
73
73
|
|
|
74
74
|
const isInteractive = (config) => {
|
|
75
75
|
return config?.mode === 'interactive' || !!config?.interactive;
|
|
@@ -253,7 +253,7 @@ function validateRequired(value, paramName, functionName) {
|
|
|
253
253
|
function validateNonEmptyString(value, paramName, functionName) {
|
|
254
254
|
validateRequired(value, paramName, functionName);
|
|
255
255
|
if (typeof value !== 'string' || value.trim() === '') {
|
|
256
|
-
throw new LangChainValidationError(`${
|
|
256
|
+
throw new LangChainValidationError(`${`${functionName}: ` }Parameter '${paramName}' must be a non-empty string`, { paramName, functionName, value, type: typeof value });
|
|
257
257
|
}
|
|
258
258
|
}
|
|
259
259
|
/**
|
|
@@ -262,7 +262,7 @@ function validateNonEmptyString(value, paramName, functionName) {
|
|
|
262
262
|
function validateNonEmptyArray(value, paramName, functionName) {
|
|
263
263
|
validateRequired(value, paramName, functionName);
|
|
264
264
|
if (!Array.isArray(value) || value.length === 0) {
|
|
265
|
-
throw new LangChainValidationError(`${
|
|
265
|
+
throw new LangChainValidationError(`${`${functionName}: ` }Parameter '${paramName}' must be a non-empty array`, { paramName, functionName, value, isArray: Array.isArray(value), length: Array.isArray(value) ? value.length : undefined });
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
/**
|
|
@@ -2649,9 +2649,8 @@ const errorMap = (issue, _ctx) => {
|
|
|
2649
2649
|
}
|
|
2650
2650
|
return { message };
|
|
2651
2651
|
};
|
|
2652
|
-
var defaultErrorMap = errorMap;
|
|
2653
2652
|
|
|
2654
|
-
let overrideErrorMap =
|
|
2653
|
+
let overrideErrorMap = errorMap;
|
|
2655
2654
|
function getErrorMap() {
|
|
2656
2655
|
return overrideErrorMap;
|
|
2657
2656
|
}
|
|
@@ -2694,7 +2693,7 @@ function addIssueToContext(ctx, issueData) {
|
|
|
2694
2693
|
ctx.common.contextualErrorMap, // contextual error map is first priority
|
|
2695
2694
|
ctx.schemaErrorMap, // then schema-bound map if available
|
|
2696
2695
|
overrideMap, // then global override map
|
|
2697
|
-
overrideMap ===
|
|
2696
|
+
overrideMap === errorMap ? undefined : errorMap, // then global default map
|
|
2698
2697
|
].filter((x) => !!x),
|
|
2699
2698
|
});
|
|
2700
2699
|
ctx.common.issues.push(issue);
|
|
@@ -6010,9 +6009,6 @@ ZodReadonly.create = (type, params) => {
|
|
|
6010
6009
|
...processCreateParams(params),
|
|
6011
6010
|
});
|
|
6012
6011
|
};
|
|
6013
|
-
({
|
|
6014
|
-
object: ZodObject.lazycreate,
|
|
6015
|
-
});
|
|
6016
6012
|
var ZodFirstPartyTypeKind;
|
|
6017
6013
|
(function (ZodFirstPartyTypeKind) {
|
|
6018
6014
|
ZodFirstPartyTypeKind["ZodString"] = "ZodString";
|
|
@@ -6056,7 +6052,6 @@ const stringType = ZodString.create;
|
|
|
6056
6052
|
ZodNever.create;
|
|
6057
6053
|
const arrayType = ZodArray.create;
|
|
6058
6054
|
const objectType = ZodObject.create;
|
|
6059
|
-
ZodObject.strictCreate;
|
|
6060
6055
|
const unionType = ZodUnion.create;
|
|
6061
6056
|
ZodIntersection.create;
|
|
6062
6057
|
ZodTuple.create;
|
|
@@ -7743,7 +7738,7 @@ const handler$4 = async (argv, logger) => {
|
|
|
7743
7738
|
logger.verbose(`Generating commit log since the last tag`, { color: 'yellow' });
|
|
7744
7739
|
// This function returns string[], needs to be adapted or replaced
|
|
7745
7740
|
// For now, this path will have limited details.
|
|
7746
|
-
const commitMessages = await getChangesSinceLastTag({ git
|
|
7741
|
+
const commitMessages = await getChangesSinceLastTag({ git});
|
|
7747
7742
|
commits = commitMessages.map(msg => ({ message: msg }));
|
|
7748
7743
|
}
|
|
7749
7744
|
else if (config.range && config.range.includes(':')) {
|
|
@@ -11167,10 +11162,7 @@ for (var i = 0; i < 256; i++) {
|
|
|
11167
11162
|
simpleEscapeMap[i] = simpleEscapeSequence(i);
|
|
11168
11163
|
}
|
|
11169
11164
|
|
|
11170
|
-
|
|
11171
|
-
// const MAX_TOKENS_PER_SUMMARY = 4096
|
|
11172
|
-
const MAX_TOKENS_PER_SUMMARY = 12288;
|
|
11173
|
-
async function fileChangeParser({ changes, commit, options: { tokenizer, git, llm: model, logger }, }) {
|
|
11165
|
+
async function fileChangeParser({ changes, commit, options: { tokenizer, git, llm: model, logger, maxTokens }, }) {
|
|
11174
11166
|
const textSplitter = new RecursiveCharacterTextSplitter({ chunkSize: 10000, chunkOverlap: 250 });
|
|
11175
11167
|
const summarizationChain = loadSummarizationChain(model, {
|
|
11176
11168
|
type: 'map_reduce',
|
|
@@ -11188,7 +11180,7 @@ async function fileChangeParser({ changes, commit, options: { tokenizer, git, ll
|
|
|
11188
11180
|
logger.startTimer();
|
|
11189
11181
|
const summary = await summarizeDiffs(diffs, {
|
|
11190
11182
|
tokenizer,
|
|
11191
|
-
maxTokens:
|
|
11183
|
+
maxTokens: maxTokens || 4096,
|
|
11192
11184
|
textSplitter,
|
|
11193
11185
|
chain: summarizationChain,
|
|
11194
11186
|
logger,
|
|
@@ -11491,7 +11483,7 @@ const handler$3 = async (argv, logger) => {
|
|
|
11491
11483
|
return await fileChangeParser({
|
|
11492
11484
|
changes,
|
|
11493
11485
|
commit: '--staged',
|
|
11494
|
-
options: { tokenizer, git, llm, logger },
|
|
11486
|
+
options: { tokenizer, git, llm, logger, maxTokens: config.service.tokenLimit },
|
|
11495
11487
|
});
|
|
11496
11488
|
}
|
|
11497
11489
|
const commitMsg = await generateAndReviewLoop({
|
|
@@ -12907,9 +12899,7 @@ var review = {
|
|
|
12907
12899
|
command,
|
|
12908
12900
|
desc: 'Perform a code review on your changes',
|
|
12909
12901
|
builder,
|
|
12910
|
-
handler: commandExecutor(handler)
|
|
12911
|
-
options,
|
|
12912
|
-
};
|
|
12902
|
+
handler: commandExecutor(handler)};
|
|
12913
12903
|
|
|
12914
12904
|
var types = /*#__PURE__*/Object.freeze({
|
|
12915
12905
|
__proto__: null
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "git-coco",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.8",
|
|
4
4
|
"description": "zero-effort git commits with coco.",
|
|
5
5
|
"author": "gfargo <ghfargo@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"eslint": "^8.54.0",
|
|
61
61
|
"jest": "^30.0.5",
|
|
62
62
|
"release-it": "^19.0.4",
|
|
63
|
-
"rollup": "^
|
|
63
|
+
"rollup": "^4.50.0",
|
|
64
64
|
"rollup-plugin-dts": "^6.1.0",
|
|
65
65
|
"rollup-plugin-executable": "^1.6.3",
|
|
66
66
|
"rollup-plugin-peer-deps-external": "^2.2.4",
|