@negoziator/ai-commit
Version:
Writes your git commit messages for you with AI
5 lines (4 loc) • 1.75 kB
JavaScript
var c=Object.defineProperty;var o=(t,e)=>c(t,"name",{value:e,configurable:!0});const n=class n{constructor(e){this.config=e,this.validateConfig()}getConfig(){return this.config}updateConfig(e){this.config={...this.config,...e},this.validateConfig()}};o(n,"LLMProvider");let s=n;const r={"":"<commit message>",conventional:"<type>(<optional scope>): <commit message>"},m=o(t=>`The output response must be in format:
${r[t]}`,"specifyCommitFormat"),g={"":"",conventional:`Choose a type from the type-to-description JSON below that best describes the git diff:
${JSON.stringify({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",feat:"A new feature",fix:"A bug fix",data:"Data only changes"},null,2)}`},h=o((t,e,i,a)=>["Generate a concise git commit message written in present tense for the following code diff with the given specifications below:",`Message language: ${t}`,`Commit message must be a maximum of ${e} characters.`,"Exclude anything unnecessary such as translation. Your entire response will be passed directly into git commit.","Try to focus on why the code changes was made and not only summarize the changes.",a?.projectPrompt?`Project context: ${a.projectPrompt}`:null,g[i],m(i)].filter(Boolean).join(`
`),"generatePrompt");export{s as L,h as g};