git-coco 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/dist/index.js CHANGED
@@ -15,6 +15,7 @@ var ora = require('ora');
15
15
  var now = require('performance-now');
16
16
  var prettyMilliseconds = require('pretty-ms');
17
17
  var document = require('langchain/document');
18
+ var hf = require('langchain/llms/hf');
18
19
  var chains = require('langchain/chains');
19
20
  var openai = require('langchain/llms/openai');
20
21
  var text_splitter = require('langchain/text_splitter');
@@ -63,7 +64,9 @@ function removeUndefined(obj) {
63
64
  **/
64
65
  function loadEnvConfig(config) {
65
66
  const envConfig = {
67
+ model: process.env.COCO_MODEL || undefined,
66
68
  openAIApiKey: process.env.OPENAI_API_KEY || undefined,
69
+ huggingFaceHubApiKey: process.env.HUGGINGFACE_HUB_API_KEY || undefined,
67
70
  tokenLimit: process.env.COCO_TOKEN_LIMIT
68
71
  ? parseInt(process.env.COCO_TOKEN_LIMIT)
69
72
  : undefined,
@@ -94,7 +97,9 @@ function loadGitConfig(config) {
94
97
  const gitConfigParsed = ini__namespace.parse(gitConfigRaw);
95
98
  config = {
96
99
  ...config,
100
+ model: gitConfigParsed.coco?.model || config.model,
97
101
  openAIApiKey: gitConfigParsed.coco?.openAIApiKey || config.openAIApiKey,
102
+ huggingFaceHubApiKey: gitConfigParsed.coco?.huggingFaceHubApiKey || config.huggingFaceHubApiKey,
98
103
  tokenLimit: parseInt(gitConfigParsed.coco?.tokenLimit) || config.tokenLimit,
99
104
  prompt: gitConfigParsed.coco?.prompt || config.prompt,
100
105
  mode: gitConfigParsed.coco?.mode || config.mode,
@@ -174,7 +179,9 @@ function loadXDGConfig(config) {
174
179
  * Command line options via yargs
175
180
  */
176
181
  const options = {
182
+ model: { type: 'string', description: 'LLM/Model-Name' },
177
183
  openAIApiKey: { type: 'string', description: 'OpenAI API Key' },
184
+ huggingFaceHubApiKey: { type: 'string', description: 'HuggingFace Hub API Key' },
178
185
  tokenLimit: { type: 'number', description: 'Token limit' },
179
186
  prompt: {
180
187
  type: 'string',
@@ -271,7 +278,7 @@ const SUMMARIZE_PROMPT = new prompts.PromptTemplate({
271
278
  * @type {Config}
272
279
  */
273
280
  const DEFAULT_CONFIG = {
274
- openAIApiKey: '',
281
+ model: 'openai/gpt-3.5-turbo',
275
282
  verbose: false,
276
283
  tokenLimit: 1024,
277
284
  prompt: COMMIT_PROMPT.template,
@@ -281,7 +288,6 @@ const DEFAULT_CONFIG = {
281
288
  ignoredFiles: ['package-lock.json'],
282
289
  ignoredExtensions: ['.map', '.lock'],
283
290
  };
284
-
285
291
  /**
286
292
  * Load application config
287
293
  *
@@ -565,18 +571,34 @@ async function collectDiffs(node, getFileDiff, tokenizer, logger = new Logger(co
565
571
  };
566
572
  }
567
573
 
568
- // TODO: Extend this to support other models! 🎉
574
+ /**
575
+ * Get LLM Model Based on Configuration
576
+ *
577
+ * @param fields
578
+ * @param configuration
579
+ * @returns LLM Model
580
+ */
569
581
  function getModel(fields, configuration) {
570
- return new openai.OpenAI(fields, configuration);
571
- // return new HuggingFaceInference({
572
- // // model: 'gpt2',
573
- // // model: 'bigcode/starcoder',
574
- // model: 'bigscience/bloom',
575
- // apiKey: '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',
576
- // maxConcurrency: 4,
577
- // cache: true,
578
- // // maxTokens: 2046,
579
- // })
582
+ const [llm, model] = config.model.split(/\/(.*)/s);
583
+ if (!model) {
584
+ throw new Error(`Invalid model: ${config.model}`);
585
+ }
586
+ switch (llm) {
587
+ case 'huggingface':
588
+ return new hf.HuggingFaceInference({
589
+ model: model,
590
+ apiKey: config.huggingFaceHubApiKey,
591
+ maxConcurrency: 4,
592
+ ...fields,
593
+ });
594
+ case 'openai':
595
+ default:
596
+ return new openai.OpenAI({
597
+ openAIApiKey: config.openAIApiKey,
598
+ modelName: model,
599
+ ...fields,
600
+ }, configuration);
601
+ }
580
602
  }
581
603
  function getTextSplitter(options = {}) {
582
604
  return new text_splitter.RecursiveCharacterTextSplitter(options);
@@ -705,10 +727,25 @@ const getTokenizer = () => {
705
727
  };
706
728
 
707
729
  const llm = async ({ llm, prompt, variables }) => {
730
+ if (!llm || !prompt || !variables) {
731
+ throw new Error('The input parameters "llm", "prompt", and "variables" are all required.');
732
+ }
708
733
  const chain = new chains.LLMChain({ llm, prompt });
709
- const res = await chain.call(variables);
710
- if (res.error)
711
- throw new Error(res.error);
734
+ let res;
735
+ try {
736
+ res = await chain.call(variables);
737
+ }
738
+ catch (error) {
739
+ if (error instanceof Error) {
740
+ throw new Error(`LLMChain call error: ${error.message}`);
741
+ }
742
+ }
743
+ if (!res) {
744
+ throw new Error('Empty response from LLMChain call');
745
+ }
746
+ if (res.error) {
747
+ throw new Error(`LLMChain response error: ${res.error}`);
748
+ }
712
749
  return res.text.trim();
713
750
  };
714
751
 
@@ -1,4 +1,10 @@
1
1
  import { Config } from './types';
2
+ /**
3
+ * Default Config
4
+ *
5
+ * @type {Config}
6
+ */
7
+ export declare const DEFAULT_CONFIG: Config;
2
8
  /**
3
9
  * Load application config
4
10
  *
@@ -1,8 +1,22 @@
1
1
  export interface Config {
2
+ /**
3
+ * The LLM model to use for generating results.
4
+ *
5
+ * @default 'openai/gpt-3.5-turbo'
6
+ *
7
+ * @example 'openai/gpt-4'
8
+ * @example 'openai/gpt-3.5-turbo'
9
+ * @example 'huggingface/bigscience/bloom'
10
+ **/
11
+ model: string;
2
12
  /**
3
13
  * The OpenAI API key.
4
14
  */
5
- openAIApiKey: string;
15
+ openAIApiKey?: string;
16
+ /**
17
+ * The HuggingFace Hub API key.
18
+ */
19
+ huggingFaceHubApiKey?: string;
6
20
  /**
7
21
  * The maximum number of tokens per request.
8
22
  *
@@ -5,6 +5,13 @@ import { BaseLLMParams } from 'langchain/llms/base';
5
5
  import { AzureOpenAIInput, OpenAIInput, OpenAI } from 'langchain/llms/openai';
6
6
  import { RecursiveCharacterTextSplitter, RecursiveCharacterTextSplitterParams } from 'langchain/text_splitter';
7
7
  import { ConfigurationParameters } from 'openai';
8
+ /**
9
+ * Get LLM Model Based on Configuration
10
+ *
11
+ * @param fields
12
+ * @param configuration
13
+ * @returns LLM Model
14
+ */
8
15
  export declare function getModel(fields?: (Partial<OpenAIInput> & Partial<AzureOpenAIInput> & BaseLLMParams & {
9
16
  configuration?: ConfigurationParameters | undefined;
10
17
  }) | undefined, configuration?: ConfigurationParameters | undefined): OpenAI | HuggingFaceInference;
package/dist/stats.html CHANGED
@@ -5285,7 +5285,7 @@ var drawChart = (function (exports) {
5285
5285
  </script>
5286
5286
  <script>
5287
5287
  /*<!--*/
5288
- const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"name":"lib","children":[{"name":"utils","children":[{"uid":"7909-80","name":"removeUndefined.ts"},{"uid":"7909-102","name":"logger.ts"},{"uid":"7909-104","name":"getPathFromFilePath.ts"},{"uid":"7909-122","name":"getTokenizer.ts"}]},{"name":"config","children":[{"name":"services","children":[{"uid":"7909-82","name":"env.ts"},{"uid":"7909-84","name":"git.ts"},{"uid":"7909-86","name":"ignore.ts"},{"uid":"7909-88","name":"project.ts"},{"uid":"7909-90","name":"xdg.ts"},{"uid":"7909-92","name":"yargs.ts"}]},{"uid":"7909-98","name":"default.ts"},{"uid":"7909-100","name":"index.ts"}]},{"name":"langchain","children":[{"name":"prompts","children":[{"uid":"7909-94","name":"commitDefault.ts"},{"uid":"7909-96","name":"summarize.ts"}]},{"name":"chains","children":[{"uid":"7909-106","name":"summarize.ts"},{"uid":"7909-124","name":"llm.ts"}]},{"uid":"7909-114","name":"utils.ts"}]},{"name":"parsers","children":[{"name":"default","children":[{"name":"utils","children":[{"uid":"7909-108","name":"summarizeDiffs.ts"},{"uid":"7909-110","name":"createDiffTree.ts"},{"uid":"7909-112","name":"collectDiffs.ts"}]},{"uid":"7909-118","name":"index.ts"}]},{"uid":"7909-132","name":"noResult.ts"}]},{"name":"simple-git","children":[{"uid":"7909-116","name":"getDiff.ts"},{"uid":"7909-126","name":"getStatus.ts"},{"uid":"7909-128","name":"getSummaryText.ts"},{"uid":"7909-130","name":"getChanges.ts"},{"uid":"7909-134","name":"createCommit.ts"}]},{"uid":"7909-120","name":"ui.ts"}]},{"uid":"7909-136","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"7909-80":{"renderedLength":258,"gzipLength":0,"brotliLength":141,"metaUid":"7909-79"},"7909-82":{"renderedLength":858,"gzipLength":0,"brotliLength":282,"metaUid":"7909-81"},"7909-84":{"renderedLength":1183,"gzipLength":0,"brotliLength":354,"metaUid":"7909-83"},"7909-86":{"renderedLength":927,"gzipLength":0,"brotliLength":271,"metaUid":"7909-85"},"7909-88":{"renderedLength":367,"gzipLength":0,"brotliLength":172,"metaUid":"7909-87"},"7909-90":{"renderedLength":539,"gzipLength":0,"brotliLength":260,"metaUid":"7909-89"},"7909-92":{"renderedLength":1588,"gzipLength":0,"brotliLength":524,"metaUid":"7909-91"},"7909-94":{"renderedLength":752,"gzipLength":0,"brotliLength":329,"metaUid":"7909-93"},"7909-96":{"renderedLength":369,"gzipLength":0,"brotliLength":200,"metaUid":"7909-95"},"7909-98":{"renderedLength":347,"gzipLength":0,"brotliLength":210,"metaUid":"7909-97"},"7909-100":{"renderedLength":719,"gzipLength":0,"brotliLength":256,"metaUid":"7909-99"},"7909-102":{"renderedLength":1634,"gzipLength":0,"brotliLength":400,"metaUid":"7909-101"},"7909-104":{"renderedLength":256,"gzipLength":0,"brotliLength":151,"metaUid":"7909-103"},"7909-106":{"renderedLength":442,"gzipLength":0,"brotliLength":201,"metaUid":"7909-105"},"7909-108":{"renderedLength":3948,"gzipLength":0,"brotliLength":1183,"metaUid":"7909-107"},"7909-110":{"renderedLength":1262,"gzipLength":0,"brotliLength":380,"metaUid":"7909-109"},"7909-112":{"renderedLength":1199,"gzipLength":0,"brotliLength":428,"metaUid":"7909-111"},"7909-114":{"renderedLength":1374,"gzipLength":0,"brotliLength":559,"metaUid":"7909-113"},"7909-116":{"renderedLength":1586,"gzipLength":0,"brotliLength":527,"metaUid":"7909-115"},"7909-118":{"renderedLength":1143,"gzipLength":0,"brotliLength":468,"metaUid":"7909-117"},"7909-120":{"renderedLength":290,"gzipLength":0,"brotliLength":177,"metaUid":"7909-119"},"7909-122":{"renderedLength":573,"gzipLength":0,"brotliLength":239,"metaUid":"7909-121"},"7909-124":{"renderedLength":238,"gzipLength":0,"brotliLength":141,"metaUid":"7909-123"},"7909-126":{"renderedLength":602,"gzipLength":0,"brotliLength":177,"metaUid":"7909-125"},"7909-128":{"renderedLength":239,"gzipLength":0,"brotliLength":140,"metaUid":"7909-127"},"7909-130":{"renderedLength":2504,"gzipLength":0,"brotliLength":529,"metaUid":"7909-129"},"7909-132":{"renderedLength":1088,"gzipLength":0,"brotliLength":343,"metaUid":"7909-131"},"7909-134":{"renderedLength":87,"gzipLength":0,"brotliLength":71,"metaUid":"7909-133"},"7909-136":{"renderedLength":5706,"gzipLength":0,"brotliLength":1318,"metaUid":"7909-135"}},"nodeMetas":{"7909-79":{"id":"/src/lib/utils/removeUndefined.ts","moduleParts":{"index.js":"7909-80"},"imported":[],"importedBy":[{"uid":"7909-81"}]},"7909-81":{"id":"/src/lib/config/services/env.ts","moduleParts":{"index.js":"7909-82"},"imported":[{"uid":"7909-79"}],"importedBy":[{"uid":"7909-99"}]},"7909-83":{"id":"/src/lib/config/services/git.ts","moduleParts":{"index.js":"7909-84"},"imported":[{"uid":"7909-152"},{"uid":"7909-153"},{"uid":"7909-150"},{"uid":"7909-154"}],"importedBy":[{"uid":"7909-99"}]},"7909-85":{"id":"/src/lib/config/services/ignore.ts","moduleParts":{"index.js":"7909-86"},"imported":[{"uid":"7909-152"}],"importedBy":[{"uid":"7909-99"}]},"7909-87":{"id":"/src/lib/config/services/project.ts","moduleParts":{"index.js":"7909-88"},"imported":[{"uid":"7909-152"}],"importedBy":[{"uid":"7909-99"}]},"7909-89":{"id":"/src/lib/config/services/xdg.ts","moduleParts":{"index.js":"7909-90"},"imported":[{"uid":"7909-152"},{"uid":"7909-150"},{"uid":"7909-153"}],"importedBy":[{"uid":"7909-99"}]},"7909-91":{"id":"/src/lib/config/services/yargs.ts","moduleParts":{"index.js":"7909-92"},"imported":[{"uid":"7909-140"},{"uid":"7909-141"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-99"}]},"7909-93":{"id":"/src/lib/langchain/prompts/commitDefault.ts","moduleParts":{"index.js":"7909-94"},"imported":[{"uid":"7909-146"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-97"}]},"7909-95":{"id":"/src/lib/langchain/prompts/summarize.ts","moduleParts":{"index.js":"7909-96"},"imported":[{"uid":"7909-146"}],"importedBy":[{"uid":"7909-117"},{"uid":"7909-97"}]},"7909-97":{"id":"/src/lib/config/default.ts","moduleParts":{"index.js":"7909-98"},"imported":[{"uid":"7909-93"},{"uid":"7909-95"}],"importedBy":[{"uid":"7909-99"}]},"7909-99":{"id":"/src/lib/config/index.ts","moduleParts":{"index.js":"7909-100"},"imported":[{"uid":"7909-81"},{"uid":"7909-83"},{"uid":"7909-85"},{"uid":"7909-87"},{"uid":"7909-89"},{"uid":"7909-91"},{"uid":"7909-97"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-117"},{"uid":"7909-129"},{"uid":"7909-107"},{"uid":"7909-111"}]},"7909-101":{"id":"/src/lib/utils/logger.ts","moduleParts":{"index.js":"7909-102"},"imported":[{"uid":"7909-139"},{"uid":"7909-143"},{"uid":"7909-144"},{"uid":"7909-145"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-117"},{"uid":"7909-107"},{"uid":"7909-111"}]},"7909-103":{"id":"/src/lib/utils/getPathFromFilePath.ts","moduleParts":{"index.js":"7909-104"},"imported":[],"importedBy":[{"uid":"7909-107"}]},"7909-105":{"id":"/src/lib/langchain/chains/summarize.ts","moduleParts":{"index.js":"7909-106"},"imported":[{"uid":"7909-157"}],"importedBy":[{"uid":"7909-107"}]},"7909-107":{"id":"/src/lib/parsers/default/utils/summarizeDiffs.ts","moduleParts":{"index.js":"7909-108"},"imported":[{"uid":"7909-155"},{"uid":"7909-101"},{"uid":"7909-99"},{"uid":"7909-103"},{"uid":"7909-105"}],"importedBy":[{"uid":"7909-117"}]},"7909-109":{"id":"/src/lib/parsers/default/utils/createDiffTree.ts","moduleParts":{"index.js":"7909-110"},"imported":[],"importedBy":[{"uid":"7909-117"}]},"7909-111":{"id":"/src/lib/parsers/default/utils/collectDiffs.ts","moduleParts":{"index.js":"7909-112"},"imported":[{"uid":"7909-99"},{"uid":"7909-101"}],"importedBy":[{"uid":"7909-117"}]},"7909-113":{"id":"/src/lib/langchain/utils.ts","moduleParts":{"index.js":"7909-114"},"imported":[{"uid":"7909-146"},{"uid":"7909-147"},{"uid":"7909-148"},{"uid":"7909-149"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-117"}]},"7909-115":{"id":"/src/lib/simple-git/getDiff.ts","moduleParts":{"index.js":"7909-116"},"imported":[{"uid":"7909-156"}],"importedBy":[{"uid":"7909-117"}]},"7909-117":{"id":"/src/lib/parsers/default/index.ts","moduleParts":{"index.js":"7909-118"},"imported":[{"uid":"7909-99"},{"uid":"7909-107"},{"uid":"7909-101"},{"uid":"7909-109"},{"uid":"7909-111"},{"uid":"7909-113"},{"uid":"7909-95"},{"uid":"7909-115"}],"importedBy":[{"uid":"7909-135"}]},"7909-119":{"id":"/src/lib/ui.ts","moduleParts":{"index.js":"7909-120"},"imported":[{"uid":"7909-139"}],"importedBy":[{"uid":"7909-135"}]},"7909-121":{"id":"/src/lib/utils/getTokenizer.ts","moduleParts":{"index.js":"7909-122"},"imported":[{"uid":"7909-142"}],"importedBy":[{"uid":"7909-135"}]},"7909-123":{"id":"/src/lib/langchain/chains/llm.ts","moduleParts":{"index.js":"7909-124"},"imported":[{"uid":"7909-147"}],"importedBy":[{"uid":"7909-135"}]},"7909-125":{"id":"/src/lib/simple-git/getStatus.ts","moduleParts":{"index.js":"7909-126"},"imported":[],"importedBy":[{"uid":"7909-129"},{"uid":"7909-127"}]},"7909-127":{"id":"/src/lib/simple-git/getSummaryText.ts","moduleParts":{"index.js":"7909-128"},"imported":[{"uid":"7909-125"}],"importedBy":[{"uid":"7909-129"}]},"7909-129":{"id":"/src/lib/simple-git/getChanges.ts","moduleParts":{"index.js":"7909-130"},"imported":[{"uid":"7909-150"},{"uid":"7909-151"},{"uid":"7909-99"},{"uid":"7909-125"},{"uid":"7909-127"}],"importedBy":[{"uid":"7909-135"},{"uid":"7909-131"}]},"7909-131":{"id":"/src/lib/parsers/noResult.ts","moduleParts":{"index.js":"7909-132"},"imported":[{"uid":"7909-129"}],"importedBy":[{"uid":"7909-135"}]},"7909-133":{"id":"/src/lib/simple-git/createCommit.ts","moduleParts":{"index.js":"7909-134"},"imported":[],"importedBy":[{"uid":"7909-135"}]},"7909-135":{"id":"/src/index.ts","moduleParts":{"index.js":"7909-136"},"imported":[{"uid":"7909-137"},{"uid":"7909-99"},{"uid":"7909-117"},{"uid":"7909-119"},{"uid":"7909-91"},{"uid":"7909-121"},{"uid":"7909-101"},{"uid":"7909-93"},{"uid":"7909-113"},{"uid":"7909-123"},{"uid":"7909-131"},{"uid":"7909-129"},{"uid":"7909-133"},{"uid":"7909-138"}],"importedBy":[],"isEntry":true},"7909-137":{"id":"@inquirer/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-135"}],"isExternal":true},"7909-138":{"id":"simple-git","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-135"}],"isExternal":true},"7909-139":{"id":"chalk","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-119"},{"uid":"7909-101"}],"isExternal":true},"7909-140":{"id":"yargs","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-91"}],"isExternal":true},"7909-141":{"id":"yargs/helpers","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-91"}],"isExternal":true},"7909-142":{"id":"gpt3-tokenizer","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-121"}],"isExternal":true},"7909-143":{"id":"ora","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-101"}],"isExternal":true},"7909-144":{"id":"performance-now","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-101"}],"isExternal":true},"7909-145":{"id":"pretty-ms","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-101"}],"isExternal":true},"7909-146":{"id":"langchain/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-93"},{"uid":"7909-113"},{"uid":"7909-95"}],"isExternal":true},"7909-147":{"id":"langchain/chains","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-113"},{"uid":"7909-123"}],"isExternal":true},"7909-148":{"id":"langchain/llms/openai","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-113"}],"isExternal":true},"7909-149":{"id":"langchain/text_splitter","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-113"}],"isExternal":true},"7909-150":{"id":"path","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-129"},{"uid":"7909-83"},{"uid":"7909-89"}],"isExternal":true},"7909-151":{"id":"minimatch","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-129"}],"isExternal":true},"7909-152":{"id":"fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-83"},{"uid":"7909-85"},{"uid":"7909-87"},{"uid":"7909-89"}],"isExternal":true},"7909-153":{"id":"os","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-83"},{"uid":"7909-89"}],"isExternal":true},"7909-154":{"id":"ini","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-83"}],"isExternal":true},"7909-155":{"id":"p-queue","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-107"}],"isExternal":true},"7909-156":{"id":"diff","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-115"}],"isExternal":true},"7909-157":{"id":"langchain/document","moduleParts":{},"imported":[],"importedBy":[{"uid":"7909-105"}],"isExternal":true}},"env":{"rollup":"3.26.1"},"options":{"gzip":false,"brotli":true,"sourcemap":false}};
5288
+ const data = {"version":2,"tree":{"name":"root","children":[{"name":"index.js","children":[{"name":"src","children":[{"name":"lib","children":[{"name":"utils","children":[{"uid":"ea0f-79","name":"removeUndefined.ts"},{"uid":"ea0f-99","name":"logger.ts"},{"uid":"ea0f-101","name":"getPathFromFilePath.ts"},{"uid":"ea0f-119","name":"getTokenizer.ts"}]},{"name":"config","children":[{"name":"services","children":[{"uid":"ea0f-81","name":"env.ts"},{"uid":"ea0f-83","name":"git.ts"},{"uid":"ea0f-85","name":"ignore.ts"},{"uid":"ea0f-87","name":"project.ts"},{"uid":"ea0f-89","name":"xdg.ts"},{"uid":"ea0f-91","name":"yargs.ts"}]},{"uid":"ea0f-97","name":"index.ts"}]},{"name":"langchain","children":[{"name":"prompts","children":[{"uid":"ea0f-93","name":"commitDefault.ts"},{"uid":"ea0f-95","name":"summarize.ts"}]},{"name":"chains","children":[{"uid":"ea0f-103","name":"summarize.ts"},{"uid":"ea0f-121","name":"llm.ts"}]},{"uid":"ea0f-111","name":"utils.ts"}]},{"name":"parsers","children":[{"name":"default","children":[{"name":"utils","children":[{"uid":"ea0f-105","name":"summarizeDiffs.ts"},{"uid":"ea0f-107","name":"createDiffTree.ts"},{"uid":"ea0f-109","name":"collectDiffs.ts"}]},{"uid":"ea0f-115","name":"index.ts"}]},{"uid":"ea0f-129","name":"noResult.ts"}]},{"name":"simple-git","children":[{"uid":"ea0f-113","name":"getDiff.ts"},{"uid":"ea0f-123","name":"getStatus.ts"},{"uid":"ea0f-125","name":"getSummaryText.ts"},{"uid":"ea0f-127","name":"getChanges.ts"},{"uid":"ea0f-131","name":"createCommit.ts"}]},{"uid":"ea0f-117","name":"ui.ts"}]},{"uid":"ea0f-133","name":"index.ts"}]}]}],"isRoot":true},"nodeParts":{"ea0f-79":{"renderedLength":258,"gzipLength":0,"brotliLength":141,"metaUid":"ea0f-78"},"ea0f-81":{"renderedLength":990,"gzipLength":0,"brotliLength":352,"metaUid":"ea0f-80"},"ea0f-83":{"renderedLength":1356,"gzipLength":0,"brotliLength":377,"metaUid":"ea0f-82"},"ea0f-85":{"renderedLength":927,"gzipLength":0,"brotliLength":271,"metaUid":"ea0f-84"},"ea0f-87":{"renderedLength":367,"gzipLength":0,"brotliLength":172,"metaUid":"ea0f-86"},"ea0f-89":{"renderedLength":539,"gzipLength":0,"brotliLength":260,"metaUid":"ea0f-88"},"ea0f-91":{"renderedLength":1736,"gzipLength":0,"brotliLength":534,"metaUid":"ea0f-90"},"ea0f-93":{"renderedLength":752,"gzipLength":0,"brotliLength":329,"metaUid":"ea0f-92"},"ea0f-95":{"renderedLength":369,"gzipLength":0,"brotliLength":200,"metaUid":"ea0f-94"},"ea0f-97":{"renderedLength":1080,"gzipLength":0,"brotliLength":412,"metaUid":"ea0f-96"},"ea0f-99":{"renderedLength":1634,"gzipLength":0,"brotliLength":400,"metaUid":"ea0f-98"},"ea0f-101":{"renderedLength":256,"gzipLength":0,"brotliLength":151,"metaUid":"ea0f-100"},"ea0f-103":{"renderedLength":442,"gzipLength":0,"brotliLength":201,"metaUid":"ea0f-102"},"ea0f-105":{"renderedLength":3948,"gzipLength":0,"brotliLength":1183,"metaUid":"ea0f-104"},"ea0f-107":{"renderedLength":1262,"gzipLength":0,"brotliLength":380,"metaUid":"ea0f-106"},"ea0f-109":{"renderedLength":1199,"gzipLength":0,"brotliLength":428,"metaUid":"ea0f-108"},"ea0f-111":{"renderedLength":1717,"gzipLength":0,"brotliLength":585,"metaUid":"ea0f-110"},"ea0f-113":{"renderedLength":1586,"gzipLength":0,"brotliLength":527,"metaUid":"ea0f-112"},"ea0f-115":{"renderedLength":1143,"gzipLength":0,"brotliLength":468,"metaUid":"ea0f-114"},"ea0f-117":{"renderedLength":290,"gzipLength":0,"brotliLength":177,"metaUid":"ea0f-116"},"ea0f-119":{"renderedLength":573,"gzipLength":0,"brotliLength":239,"metaUid":"ea0f-118"},"ea0f-121":{"renderedLength":678,"gzipLength":0,"brotliLength":281,"metaUid":"ea0f-120"},"ea0f-123":{"renderedLength":602,"gzipLength":0,"brotliLength":177,"metaUid":"ea0f-122"},"ea0f-125":{"renderedLength":239,"gzipLength":0,"brotliLength":140,"metaUid":"ea0f-124"},"ea0f-127":{"renderedLength":2504,"gzipLength":0,"brotliLength":529,"metaUid":"ea0f-126"},"ea0f-129":{"renderedLength":1088,"gzipLength":0,"brotliLength":343,"metaUid":"ea0f-128"},"ea0f-131":{"renderedLength":87,"gzipLength":0,"brotliLength":71,"metaUid":"ea0f-130"},"ea0f-133":{"renderedLength":5706,"gzipLength":0,"brotliLength":1318,"metaUid":"ea0f-132"}},"nodeMetas":{"ea0f-78":{"id":"/src/lib/utils/removeUndefined.ts","moduleParts":{"index.js":"ea0f-79"},"imported":[],"importedBy":[{"uid":"ea0f-80"}]},"ea0f-80":{"id":"/src/lib/config/services/env.ts","moduleParts":{"index.js":"ea0f-81"},"imported":[{"uid":"ea0f-78"}],"importedBy":[{"uid":"ea0f-96"}]},"ea0f-82":{"id":"/src/lib/config/services/git.ts","moduleParts":{"index.js":"ea0f-83"},"imported":[{"uid":"ea0f-150"},{"uid":"ea0f-151"},{"uid":"ea0f-148"},{"uid":"ea0f-152"}],"importedBy":[{"uid":"ea0f-96"}]},"ea0f-84":{"id":"/src/lib/config/services/ignore.ts","moduleParts":{"index.js":"ea0f-85"},"imported":[{"uid":"ea0f-150"}],"importedBy":[{"uid":"ea0f-96"}]},"ea0f-86":{"id":"/src/lib/config/services/project.ts","moduleParts":{"index.js":"ea0f-87"},"imported":[{"uid":"ea0f-150"}],"importedBy":[{"uid":"ea0f-96"}]},"ea0f-88":{"id":"/src/lib/config/services/xdg.ts","moduleParts":{"index.js":"ea0f-89"},"imported":[{"uid":"ea0f-150"},{"uid":"ea0f-148"},{"uid":"ea0f-151"}],"importedBy":[{"uid":"ea0f-96"}]},"ea0f-90":{"id":"/src/lib/config/services/yargs.ts","moduleParts":{"index.js":"ea0f-91"},"imported":[{"uid":"ea0f-137"},{"uid":"ea0f-138"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-96"}]},"ea0f-92":{"id":"/src/lib/langchain/prompts/commitDefault.ts","moduleParts":{"index.js":"ea0f-93"},"imported":[{"uid":"ea0f-143"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-96"}]},"ea0f-94":{"id":"/src/lib/langchain/prompts/summarize.ts","moduleParts":{"index.js":"ea0f-95"},"imported":[{"uid":"ea0f-143"}],"importedBy":[{"uid":"ea0f-96"},{"uid":"ea0f-114"}]},"ea0f-96":{"id":"/src/lib/config/index.ts","moduleParts":{"index.js":"ea0f-97"},"imported":[{"uid":"ea0f-80"},{"uid":"ea0f-82"},{"uid":"ea0f-84"},{"uid":"ea0f-86"},{"uid":"ea0f-88"},{"uid":"ea0f-90"},{"uid":"ea0f-92"},{"uid":"ea0f-94"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-114"},{"uid":"ea0f-110"},{"uid":"ea0f-126"},{"uid":"ea0f-104"},{"uid":"ea0f-108"}]},"ea0f-98":{"id":"/src/lib/utils/logger.ts","moduleParts":{"index.js":"ea0f-99"},"imported":[{"uid":"ea0f-136"},{"uid":"ea0f-140"},{"uid":"ea0f-141"},{"uid":"ea0f-142"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-114"},{"uid":"ea0f-104"},{"uid":"ea0f-108"}]},"ea0f-100":{"id":"/src/lib/utils/getPathFromFilePath.ts","moduleParts":{"index.js":"ea0f-101"},"imported":[],"importedBy":[{"uid":"ea0f-104"}]},"ea0f-102":{"id":"/src/lib/langchain/chains/summarize.ts","moduleParts":{"index.js":"ea0f-103"},"imported":[{"uid":"ea0f-155"}],"importedBy":[{"uid":"ea0f-104"}]},"ea0f-104":{"id":"/src/lib/parsers/default/utils/summarizeDiffs.ts","moduleParts":{"index.js":"ea0f-105"},"imported":[{"uid":"ea0f-153"},{"uid":"ea0f-98"},{"uid":"ea0f-96"},{"uid":"ea0f-100"},{"uid":"ea0f-102"}],"importedBy":[{"uid":"ea0f-114"}]},"ea0f-106":{"id":"/src/lib/parsers/default/utils/createDiffTree.ts","moduleParts":{"index.js":"ea0f-107"},"imported":[],"importedBy":[{"uid":"ea0f-114"}]},"ea0f-108":{"id":"/src/lib/parsers/default/utils/collectDiffs.ts","moduleParts":{"index.js":"ea0f-109"},"imported":[{"uid":"ea0f-96"},{"uid":"ea0f-98"}],"importedBy":[{"uid":"ea0f-114"}]},"ea0f-110":{"id":"/src/lib/langchain/utils.ts","moduleParts":{"index.js":"ea0f-111"},"imported":[{"uid":"ea0f-144"},{"uid":"ea0f-143"},{"uid":"ea0f-145"},{"uid":"ea0f-146"},{"uid":"ea0f-147"},{"uid":"ea0f-96"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-114"}]},"ea0f-112":{"id":"/src/lib/simple-git/getDiff.ts","moduleParts":{"index.js":"ea0f-113"},"imported":[{"uid":"ea0f-154"}],"importedBy":[{"uid":"ea0f-114"}]},"ea0f-114":{"id":"/src/lib/parsers/default/index.ts","moduleParts":{"index.js":"ea0f-115"},"imported":[{"uid":"ea0f-96"},{"uid":"ea0f-104"},{"uid":"ea0f-98"},{"uid":"ea0f-106"},{"uid":"ea0f-108"},{"uid":"ea0f-110"},{"uid":"ea0f-94"},{"uid":"ea0f-112"}],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-116":{"id":"/src/lib/ui.ts","moduleParts":{"index.js":"ea0f-117"},"imported":[{"uid":"ea0f-136"}],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-118":{"id":"/src/lib/utils/getTokenizer.ts","moduleParts":{"index.js":"ea0f-119"},"imported":[{"uid":"ea0f-139"}],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-120":{"id":"/src/lib/langchain/chains/llm.ts","moduleParts":{"index.js":"ea0f-121"},"imported":[{"uid":"ea0f-145"}],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-122":{"id":"/src/lib/simple-git/getStatus.ts","moduleParts":{"index.js":"ea0f-123"},"imported":[],"importedBy":[{"uid":"ea0f-126"},{"uid":"ea0f-124"}]},"ea0f-124":{"id":"/src/lib/simple-git/getSummaryText.ts","moduleParts":{"index.js":"ea0f-125"},"imported":[{"uid":"ea0f-122"}],"importedBy":[{"uid":"ea0f-126"}]},"ea0f-126":{"id":"/src/lib/simple-git/getChanges.ts","moduleParts":{"index.js":"ea0f-127"},"imported":[{"uid":"ea0f-148"},{"uid":"ea0f-149"},{"uid":"ea0f-96"},{"uid":"ea0f-122"},{"uid":"ea0f-124"}],"importedBy":[{"uid":"ea0f-132"},{"uid":"ea0f-128"}]},"ea0f-128":{"id":"/src/lib/parsers/noResult.ts","moduleParts":{"index.js":"ea0f-129"},"imported":[{"uid":"ea0f-126"}],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-130":{"id":"/src/lib/simple-git/createCommit.ts","moduleParts":{"index.js":"ea0f-131"},"imported":[],"importedBy":[{"uid":"ea0f-132"}]},"ea0f-132":{"id":"/src/index.ts","moduleParts":{"index.js":"ea0f-133"},"imported":[{"uid":"ea0f-134"},{"uid":"ea0f-96"},{"uid":"ea0f-114"},{"uid":"ea0f-116"},{"uid":"ea0f-90"},{"uid":"ea0f-118"},{"uid":"ea0f-98"},{"uid":"ea0f-92"},{"uid":"ea0f-110"},{"uid":"ea0f-120"},{"uid":"ea0f-128"},{"uid":"ea0f-126"},{"uid":"ea0f-130"},{"uid":"ea0f-135"}],"importedBy":[],"isEntry":true},"ea0f-134":{"id":"@inquirer/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-132"}],"isExternal":true},"ea0f-135":{"id":"simple-git","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-132"}],"isExternal":true},"ea0f-136":{"id":"chalk","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-116"},{"uid":"ea0f-98"}],"isExternal":true},"ea0f-137":{"id":"yargs","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-90"}],"isExternal":true},"ea0f-138":{"id":"yargs/helpers","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-90"}],"isExternal":true},"ea0f-139":{"id":"gpt3-tokenizer","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-118"}],"isExternal":true},"ea0f-140":{"id":"ora","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-98"}],"isExternal":true},"ea0f-141":{"id":"performance-now","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-98"}],"isExternal":true},"ea0f-142":{"id":"pretty-ms","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-98"}],"isExternal":true},"ea0f-143":{"id":"langchain/prompts","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-92"},{"uid":"ea0f-110"},{"uid":"ea0f-94"}],"isExternal":true},"ea0f-144":{"id":"langchain/llms/hf","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-110"}],"isExternal":true},"ea0f-145":{"id":"langchain/chains","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-110"},{"uid":"ea0f-120"}],"isExternal":true},"ea0f-146":{"id":"langchain/llms/openai","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-110"}],"isExternal":true},"ea0f-147":{"id":"langchain/text_splitter","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-110"}],"isExternal":true},"ea0f-148":{"id":"path","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-126"},{"uid":"ea0f-82"},{"uid":"ea0f-88"}],"isExternal":true},"ea0f-149":{"id":"minimatch","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-126"}],"isExternal":true},"ea0f-150":{"id":"fs","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-82"},{"uid":"ea0f-84"},{"uid":"ea0f-86"},{"uid":"ea0f-88"}],"isExternal":true},"ea0f-151":{"id":"os","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-82"},{"uid":"ea0f-88"}],"isExternal":true},"ea0f-152":{"id":"ini","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-82"}],"isExternal":true},"ea0f-153":{"id":"p-queue","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-104"}],"isExternal":true},"ea0f-154":{"id":"diff","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-112"}],"isExternal":true},"ea0f-155":{"id":"langchain/document","moduleParts":{},"imported":[],"importedBy":[{"uid":"ea0f-102"}],"isExternal":true}},"env":{"rollup":"3.26.2"},"options":{"gzip":false,"brotli":true,"sourcemap":false}};
5289
5289
 
5290
5290
  const run = () => {
5291
5291
  const width = window.innerWidth;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "git-coco",
3
- "version": "0.2.1",
3
+ "version": "0.3.0",
4
4
  "description": "zero-effort git commits with commit copilot, or coco for short.",
5
5
  "author": "gfargo <ghfargo@gmail.com>",
6
6
  "license": "MIT",
@@ -1,7 +0,0 @@
1
- import { Config } from './types';
2
- /**
3
- * Default Config
4
- *
5
- * @type {Config}
6
- */
7
- export declare const DEFAULT_CONFIG: Config;
@@ -1 +0,0 @@
1
- export declare function getTruncatedFilePath(filePath: string, maxLength?: number): string;
@@ -1,3 +0,0 @@
1
- /// <reference types="node" />
2
- import * as fs from 'fs';
3
- export declare const readFile: typeof fs.readFile.__promisify__;