lazycommitt 1.0.12 → 1.0.13

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 CHANGED
@@ -248,11 +248,10 @@ lazycommit config set proxy=
248
248
 
249
249
  #### model
250
250
 
251
- Default: `llama-3.1-8b-instant`
251
+ Default: `llama-3.3-70b-versatile`
252
252
 
253
253
  The Groq model to use for generating commit messages. Available models include:
254
- - `llama-3.1-8b-instant` (default) - Fast, efficient for conventional commits
255
- - `llama-3.1-70b-versatile` - More detailed but slower
254
+ - `llama-3.3-70b-versatile` (default) - Fast, efficient for conventional commits
256
255
  - `llama-3.1-120b-versatile` - Most capable but slowest
257
256
 
258
257
  For conventional commit generation, the 8B instant model provides the best balance of speed and quality.
@@ -344,7 +343,7 @@ If you get a 413 error, your diff is too large for the API. Try these solutions:
344
343
 
345
344
  ### Slow performance with large diffs
346
345
 
347
- - **Use the 8B instant model** (default): `lazycommit config set model "llama-3.1-8b-instant"`
346
+ - **Use the 8B instant model** (default): `lazycommit config set model "llama-3.3-70b-versatile"`
348
347
  - Exclude unnecessary files: `lazycommit --exclude "*.log" --exclude "*.tmp"`
349
348
  - Use automatic multi-commit mode to split large changes into logical groups
350
349
  - Lower generate count: `lazycommit config set generate=1` (default)
package/dist/cli.mjs CHANGED
@@ -1,12 +1,12 @@
1
1
  #!/usr/bin/env node
2
- var we=Object.defineProperty;var l=(t,e)=>we(t,"name",{value:e,configurable:!0});import{command as B,cli as $e}from"cleye";import{readFileSync as be}from"fs";import{fileURLToPath as q,pathToFileURL as ve}from"url";import G,{dirname as ke,join as Ae}from"path";import{execa as k}from"execa";import{dim as O,bgCyan as J,black as X,green as _,red as F}from"kolorist";import{intro as V,spinner as D,outro as x,confirm as Z,isCancel as Y,select as xe}from"@clack/prompts";import $ from"fs/promises";import Pe from"os";import ee from"ini";import te from"groq-sdk";var Ce="1.0.12",_e={version:Ce};const Q=class Q extends Error{};l(Q,"KnownError");let w=Q;const z=" ",T=l(t=>{t instanceof Error&&!(t instanceof w)&&(t.stack&&console.error(O(t.stack.split(`
2
+ var we=Object.defineProperty;var l=(t,e)=>we(t,"name",{value:e,configurable:!0});import{command as B,cli as $e}from"cleye";import{readFileSync as be}from"fs";import{fileURLToPath as q,pathToFileURL as ve}from"url";import G,{dirname as ke,join as Ae}from"path";import{execa as k}from"execa";import{dim as O,bgCyan as J,black as X,green as _,red as F}from"kolorist";import{intro as V,spinner as D,outro as x,confirm as Z,isCancel as Y,select as xe}from"@clack/prompts";import $ from"fs/promises";import Pe from"os";import ee from"ini";import te from"groq-sdk";var Ce="1.0.13",_e={version:Ce};const Q=class Q extends Error{};l(Q,"KnownError");let w=Q;const z=" ",T=l(t=>{t instanceof Error&&!(t instanceof w)&&(t.stack&&console.error(O(t.stack.split(`
3
3
  `).slice(1).join(`
4
4
  `))),console.error(`
5
5
  ${z}${O(`lazycommit v${_e.version}`)}`),console.error(`
6
6
  ${z}Please open a Bug report with the information above:`),console.error(`${z}https://github.com/KartikLabhshetwar/lazycommit/issues/new/choose`))},"handleCliError"),se=l(async()=>{const{stdout:t,failed:e}=await k("git",["rev-parse","--show-toplevel"],{reject:!1});if(e)throw new w("The current directory must be a Git repository!");return t},"assertGitRepo"),M=l(t=>`:(exclude)${t}`,"excludeFromDiff"),N=["package-lock.json","pnpm-lock.yaml","node_modules/**","dist/**","build/**",".next/**","coverage/**",".nyc_output/**","*.log","*.tmp","*.temp","*.cache",".DS_Store","Thumbs.db","*.min.js","*.min.css","*.bundle.js","*.bundle.css","*.lock"].map(M),oe=l(async t=>{const e=["diff","--cached","--diff-algorithm=minimal"],{stdout:s}=await k("git",[...e,"--name-only",...N,...t?t.map(M):[]]);if(!s)return;const{stdout:i}=await k("git",[...e,...N,...t?t.map(M):[]]);return{files:s.split(`
7
7
  `),diff:i}},"getStagedDiff"),ie=l(t=>`Detected ${t.length.toLocaleString()} staged file${t.length>1?"s":""}`,"getDetectedMessage"),ne=l(async t=>{const e=["diff","--cached","--diff-algorithm=minimal"],{stdout:s}=await k("git",[...e,"--name-only",...N,...t?t.map(M):[]]);if(!s)return null;const i=s.split(`
8
8
  `).filter(Boolean),o=await Promise.all(i.map(async n=>{try{const{stdout:u}=await k("git",[...e,"--numstat","--",n]),[a,r]=u.split(" ").slice(0,2).map(Number);return{file:n,additions:a||0,deletions:r||0,changes:(a||0)+(r||0)}}catch{return{file:n,additions:0,deletions:0,changes:0}}}));return{files:i,fileStats:o,totalChanges:o.reduce((n,u)=>n+u.changes,0)}},"getDiffSummary"),ue=l(async(t,e=20)=>{const s=await ne(t);if(!s)return null;const{fileStats:i}=s,o=[...i].sort((p,m)=>m.changes-p.changes),n=o.slice(0,Math.max(1,e)),u=s.files.length,a=s.totalChanges,r=i.reduce((p,m)=>p+(m.additions||0),0),h=i.reduce((p,m)=>p+(m.deletions||0),0),y=[];y.push(`Files changed: ${u}`),y.push(`Additions: ${r}, Deletions: ${h}, Total changes: ${a}`),y.push("Top files by changes:");for(const p of n)y.push(`- ${p.file} (+${p.additions} / -${p.deletions}, ${p.changes} changes)`);return o.length>n.length&&y.push(`\u2026and ${o.length-n.length} more files`),y.join(`
9
- `)},"buildCompactSummary"),ae=l(t=>$.lstat(t).then(()=>!0,()=>!1),"fileExists"),De=["","conventional"],{hasOwnProperty:We}=Object.prototype,re=l((t,e)=>We.call(t,e),"hasOwn"),v=l((t,e,s)=>{if(!e)throw new w(`Invalid config property ${t}: ${s}`)},"parseAssert"),E={GROQ_API_KEY(t){if(!t)throw new w("Please set your Groq API key via `lazycommit config set GROQ_API_KEY=<your token>`");return v("GROQ_API_KEY",t.startsWith("gsk_"),'Must start with "gsk_"'),t},locale(t){return t?(v("locale",t,"Cannot be empty"),v("locale",/^[a-z-]+$/i.test(t),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),t):"en"},generate(t){if(!t)return 1;v("generate",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("generate",e>0,"Must be greater than 0"),v("generate",e<=5,"Must be less or equal to 5"),e},type(t){return t?(v("type",De.includes(t),"Invalid commit type"),t):""},proxy(t){if(!(!t||t.length===0))return v("proxy",/^https?:\/\//.test(t),"Must be a valid URL"),t},model(t){return!t||t.length===0?"llama-3.1-8b-instant":t},timeout(t){if(!t)return 1e4;v("timeout",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("timeout",e>=500,"Must be greater than 500ms"),e},"max-length"(t){if(!t)return 50;v("max-length",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("max-length",e>=20,"Must be greater than 20 characters"),e}},L=G.join(Pe.homedir(),".lazycommit"),ce=l(async()=>{if(!await ae(L))return Object.create(null);const e=await $.readFile(L,"utf8");return ee.parse(e)},"readConfigFile"),U=l(async(t,e)=>{const s=await ce(),i={};for(const o of Object.keys(E)){const n=E[o],u=t?.[o]??s[o];if(e)try{i[o]=n(u)}catch{}else i[o]=n(u)}return i},"getConfig"),Se=l(async t=>{const e=await ce();for(const[s,i]of t){if(!re(E,s))throw new w(`Invalid config property: ${s}`);const o=E[s](i);e[s]=o}await $.writeFile(L,ee.stringify(e),"utf8")},"setConfigs"),Ie={"":"<commit message>",conventional:"<type>(<optional scope>): <commit message>"},le={"":"",conventional:`Choose the most appropriate type from the following categories that best describes the git diff:
9
+ `)},"buildCompactSummary"),ae=l(t=>$.lstat(t).then(()=>!0,()=>!1),"fileExists"),De=["","conventional"],{hasOwnProperty:We}=Object.prototype,re=l((t,e)=>We.call(t,e),"hasOwn"),v=l((t,e,s)=>{if(!e)throw new w(`Invalid config property ${t}: ${s}`)},"parseAssert"),E={GROQ_API_KEY(t){if(!t)throw new w("Please set your Groq API key via `lazycommit config set GROQ_API_KEY=<your token>`");return v("GROQ_API_KEY",t.startsWith("gsk_"),'Must start with "gsk_"'),t},locale(t){return t?(v("locale",t,"Cannot be empty"),v("locale",/^[a-z-]+$/i.test(t),"Must be a valid locale (letters and dashes/underscores). You can consult the list of codes in: https://wikipedia.org/wiki/List_of_ISO_639-1_codes"),t):"en"},generate(t){if(!t)return 1;v("generate",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("generate",e>0,"Must be greater than 0"),v("generate",e<=5,"Must be less or equal to 5"),e},type(t){return t?(v("type",De.includes(t),"Invalid commit type"),t):""},proxy(t){if(!(!t||t.length===0))return v("proxy",/^https?:\/\//.test(t),"Must be a valid URL"),t},model(t){return!t||t.length===0?"llama-3.3-70b-versatile":t},timeout(t){if(!t)return 1e4;v("timeout",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("timeout",e>=500,"Must be greater than 500ms"),e},"max-length"(t){if(!t)return 50;v("max-length",/^\d+$/.test(t),"Must be an integer");const e=Number(t);return v("max-length",e>=20,"Must be greater than 20 characters"),e}},L=G.join(Pe.homedir(),".lazycommit"),ce=l(async()=>{if(!await ae(L))return Object.create(null);const e=await $.readFile(L,"utf8");return ee.parse(e)},"readConfigFile"),U=l(async(t,e)=>{const s=await ce(),i={};for(const o of Object.keys(E)){const n=E[o],u=t?.[o]??s[o];if(e)try{i[o]=n(u)}catch{}else i[o]=n(u)}return i},"getConfig"),Se=l(async t=>{const e=await ce();for(const[s,i]of t){if(!re(E,s))throw new w(`Invalid config property: ${s}`);const o=E[s](i);e[s]=o}await $.writeFile(L,ee.stringify(e),"utf8")},"setConfigs"),Ie={"":"<commit message>",conventional:"<type>(<optional scope>): <commit message>"},le={"":"",conventional:`Choose the most appropriate type from the following categories that best describes the git diff:
10
10
 
11
11
  ${JSON.stringify({feat:"A new feature for the user",fix:"A bug fix",docs:"Documentation only changes",style:"Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)",refactor:"A code change that neither fixes a bug nor adds a feature",perf:"A code change that improves performance",test:"Adding missing tests or correcting existing tests",build:"Changes that affect the build system or external dependencies",ci:"Changes to our CI configuration files and scripts",chore:"Other changes that don't modify src or test files",revert:"Reverts a previous commit"},null,2)}
12
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lazycommitt",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Writes your git commit messages for you with AI using Groq",
5
5
  "main": "index.js",
6
6
  "keywords": [