pushai 1.0.4 → 1.0.6
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.mjs +11 -6
- package/package.json +2 -1
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import{Command as
|
|
2
|
+
import{Command as Ke}from"commander";import P from"chalk";import{confirm as xe,intro as Ie,isCancel as Ae,outro as T}from"@clack/prompts";import ne from"os";import q from"path";import y from"fs";import V from"keytar";var H="pushai",J="api-key";async function W(){let t=O(),o={};if(y.existsSync(t))try{o=JSON.parse(y.readFileSync(t,"utf-8"))}catch{}let i=await V.getPassword(H,J);return i&&(o.apiKey=i),o}async function ae(t){let o=O(),{apiKey:i,...g}=t;i&&await V.setPassword(H,J,i);let a={};if(y.existsSync(o))try{a=JSON.parse(y.readFileSync(o,"utf-8"))}catch{}let c={...a,...g};y.writeFileSync(o,JSON.stringify(c,null,2),"utf-8")}async function se(){try{let t=ne.homedir(),o=q.join(t,".config","pushai"),i=!1;return y.existsSync(o)&&(y.rmSync(o,{recursive:!0,force:!0}),i=!0),await V.deletePassword(H,J),i}catch(t){return console.error("Failed to reset config:",t),!1}}function O(){let t=q.join(ne.homedir(),".config","pushai");return y.existsSync(t)||y.mkdirSync(t,{recursive:!0}),q.join(t,"config.json")}import w from"chalk";var e={common:{operationCancelled:"Operation cancelled.",interrupted:"Request interrupted.",dryRun:{header:"[DRY RUN] No changes were committed or pushed.",proposed:t=>`Here's the generated commit message:
|
|
3
3
|
${t}`},noRemote:{header:"There's no Git remote repository configured.",instruction:"Try adding a remote repository (e.g. `git remote add origin <url>`) and run the command again."},success:{committed:"Changes committed successfully.",pushed:"Changes pushed successfully."}},commit:{intro:(t,o)=>`${w.cyan("\u25CF")} ${w.bgCyan.black.bold(` ${t.toUpperCase()} `)} ${w.dim("\u2022")} ${w.white(o)}
|
|
4
4
|
`,outro:"Successfully synced with the remote repository.",noteTitle:"Commit message preview",gitRepoMissing:"There's no Git repository in this directory.",initConfirm:"Would you like to initialize a new Git repository?",initSuccess:"Git repository initialized successfully.",abortNoRepo:"A Git repository is required to continue.",noChanges:"No changes were found to commit.",generating:"Putting together a commit message..",generatingSlow10:"Please wait.. This might take a moment.",generatingSlow60:"This is taking longer than usual..",generated:"Commit message generated.",generationFailed:"Couldn't generate a commit message.",generationCancelled:"Commit message generation cancelled.",emptyMessageTitle:"Empty commit message",emptyMessagePrompt:"AI returned an empty commit message. What would you like to do?",emptyRegenerate:"Regenerate",emptyManual:"Enter manually",emptyCancel:"Cancel",stillEmptyWarning:"Still empty, try manual entry.",manualMessagePrompt:"Enter commit message manually:",manualMessageRequired:"Message cannot be empty",manualAccepted:"Manual message accepted.",actionPrompt:"What would you like to do next?",actions:{accept:"Commit and push changes",edit:"Edit commit message",regenerate:"Generate another message",cancel:"Cancel operation"},editPrompt:"Update the commit message:",regenerating:"Regenerating a new commit message..",regenerated:"New commit message ready.",regenerationFailed:t=>`Couldn't generate another message: ${t}`,processStopped:"Process stopped. No changes were committed or pushed.",committing:"Creating commit..",committingSlow10:"Almost there..",committingSlow60:"Still processing your request..",pushing:"Pushing changes to remote..",pushingSlow10:"Syncing changes..",pushingSlow60:"Still syncing changes.. Please wait.",operationFailed:"Something went wrong while completing the operation.",gitError:t=>`Git reported an error: ${t}`},config:{intro:"Welcome to PushAI. Let's get things set up.",outro:"Configuration complete. You're ready to go!",providerPrompt:"Choose from the available AI providers:",apiKeyPrompt:t=>`Enter your ${w.cyan.bold(t)} API key:`,apiKeyRequired:"You'll need an API key to continue. Simply copy and paste to proceed.",modelPrompt:"Which model would you like to use?",customModelSeparator:"Use a custom model ID",customModelPrompt:"Enter the custom model ID:",customModelRequired:"A model ID is required.",baseUrlPrompt:"Enter a base URL",baseUrlPromptPlaceholder:"Optional \u2014 press Enter to skip",saved:"Configuration saved successfully.",providerLabel:t=>`${w.white.bold("Provider:")} ${t}`,modelLabel:t=>`${w.white.bold("Model: ")} ${t}`,apiKeyLabel:t=>`${w.white.bold("API Key: ")} ****${t}`,configFile:t=>`
|
|
5
5
|
File: ${t}`,commandsHint:"Here are a few commands to try:",hintCommit:"Generate AI-powered commit messages",hintConfig:"Update provider or API settings",hintReset:"Clear saved configuration"},reset:{intro:"Resetting PushAI configuration",confirm:"Remove all PushAI configurations and API keys?",outro:"PushAI configuration removed successfully.",nothingToDelete:"There's no configuration data to remove."},errors:{authInvalid:"Authentication failed. The API key or token appears to be invalid.",authFix:"Try running `pai reset` to update your credentials.",unknown:t=>`
|
|
6
|
-
${t||"Something unexpected went wrong."}`}};async function
|
|
6
|
+
${t||"Something unexpected went wrong."}`}};async function me(){Ie(P.yellow.bold(e.reset.intro));try{let t=await xe({message:P.red(e.reset.confirm),initialValue:!1});if(Ae(t)){T(P.red(e.common.operationCancelled));return}if(!t){T(P.red(e.common.operationCancelled));return}await se()?T(P.green.bold(e.reset.outro)):T(P.dim(e.reset.nothingToDelete))}catch(t){if(t.name==="ExitPromptError"||t.name==="AbortError"){T(P.red(e.common.operationCancelled));return}throw t}}import d from"chalk";import{select as pe,password as Ee,isCancel as U,text as ke,intro as Me,note as ge,outro as G}from"@clack/prompts";var v=class{apiKey;model;constructor(o,i){this.apiKey=o,this.model=i}};var b=(t,o=!1)=>{let i=`You are a Senior Software Engineer. Your task is to write a concise, technical, and impactful commit message based on a git diff.
|
|
7
7
|
|
|
8
8
|
### CONSTRAINTS
|
|
9
9
|
- Format: <type>(<scope>): <description>
|
|
@@ -19,12 +19,17 @@ ${t||"Something unexpected went wrong."}`}};async function te(){he(P.yellow.bold
|
|
|
19
19
|
- If multiple changes are present, focus on the most significant one.
|
|
20
20
|
|
|
21
21
|
### GIT DIFF TO ANALYZE:
|
|
22
|
-
${t}`;return o&&(
|
|
22
|
+
${t}`;return o&&(i+=`
|
|
23
23
|
|
|
24
24
|
### ADDITIONAL INSTRUCTION FOR REGENERATION:
|
|
25
|
-
You already generated a commit message for this diff. Now please provide a **different, alternative** commit message. It should still follow the same constraints but approach the change from a slightly different perspective or emphasize a different aspect of the changes.`),
|
|
25
|
+
You already generated a commit message for this diff. Now please provide a **different, alternative** commit message. It should still follow the same constraints but approach the change from a slightly different perspective or emphasize a different aspect of the changes.`),i};var F=class extends v{async generateCommitMessage(o,i,g){let a=g?.regenerate||!1,c=`https://generativelanguage.googleapis.com/v1beta/models/${this.model}:generateContent?key=${this.apiKey}`,s={contents:[{parts:[{text:b(o,a)}]}],generationConfig:{temperature:a?.8:.2,maxOutputTokens:100}},l=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(s),signal:i});if(!l.ok){let n=await l.text(),h=`Gemini API error (${l.status})`;try{let x=JSON.parse(n);x.error?.message&&(h=x.error.message)}catch{h=n}throw new Error(h)}return((await l.json()).candidates?.[0]?.content?.parts?.[0]?.text||"").trim().replace(/['"]/g,"")}};import{InferenceClient as ce}from"@huggingface/inference";var L=class extends v{async generateCommitMessage(o,i,g){let a=g?.regenerate||!1;try{return((await new ce(this.apiKey,{endpointUrl:"https://router.huggingface.co/v1"}).chatCompletion({model:this.model,messages:[{role:"user",content:b(o,a)}],max_tokens:100,temperature:a?.8:.2},{signal:i})).choices[0]?.message.content||"").trim().replace(/['"]/g,"").replace(/^commit:\s*/i,"")}catch{try{return(await new ce(this.apiKey).textGeneration({model:this.model,inputs:b(o,a),parameters:{max_new_tokens:100,temperature:a?.8:.2,return_full_text:!1}},{signal:i})).generated_text.trim().replace(/['"]/g,"").replace(/^commit:\s*/i,"")}catch{throw new Error(`Model "${this.model}" does not support chat or text generation. For Hugging Face, please use a model that supports "text-generation" or "conversational", e.g., "mistralai/Mistral-7B-Instruct-v0.3" or "microsoft/Phi-3-mini-4k-instruct".`)}}}};import Re from"openai";var _=class extends v{constructor(o,i){super(o,i)}async generateCommitMessage(o,i,g){let a=g?.regenerate||!1;return(await new Re({apiKey:this.apiKey}).chat.completions.create({model:this.model,messages:[{role:"user",content:b(o,a)}],temperature:a?.8:.7,max_tokens:100},{signal:i})).choices[0]?.message.content?.trim().replace(/['"]/g,"")||""}};var K=[{name:"Google Gemini",value:"gemini",models:[{name:"Gemini 3.1 Flash Lite",value:"gemini-3.1-flash-lite",hint:"free \u2022 recommended"},{name:"Gemini Flash Lite Latest",value:"gemini-flash-lite-latest",hint:"free"},{name:"Gemini 2.0 Flash Lite",value:"gemini-2.0-flash-lite",hint:"free"},{name:"Gemini 2.5 Flash",value:"gemini-2.5-flash",hint:"free \u2022 fast"},{name:"Gemini 2.5 Pro",value:"gemini-2.5-pro",hint:"paid \u2022 best quality"},{name:"Gemini 1.5 Flash",value:"gemini-1.5-flash",hint:"free \u2022 stable"},{name:"Gemini 1.5 Pro",value:"gemini-1.5-pro",hint:"paid"}]},{name:"OpenAI",value:"openai",models:[{name:"GPT-4.1 Mini",value:"gpt-4.1-mini",hint:"paid \u2022 recommended"},{name:"GPT-4.1",value:"gpt-4.1",hint:"paid \u2022 best quality"},{name:"GPT-4.1 Nano",value:"gpt-4.1-nano",hint:"paid \u2022 lightweight"},{name:"GPT-4o",value:"gpt-4o",hint:"paid \u2022 multimodal"},{name:"GPT-4o Mini",value:"gpt-4o-mini",hint:"free \u2022 fast"},{name:"GPT-4 Turbo",value:"gpt-4-turbo",hint:"paid"}]},{name:"Hugging Face",value:"huggingface",models:[{name:"Llama 3 8B Instruct",value:"meta-llama/Meta-Llama-3-8B-Instruct",hint:"free \u2022 recommended"},{name:"Llama 3.1 8B Instruct",value:"meta-llama/Llama-3.1-8B-Instruct",hint:"free"},{name:"Llama 3.1 70B Instruct",value:"meta-llama/Llama-3.1-70B-Instruct",hint:"free \u2022 high quality"},{name:"Mistral 7B Instruct",value:"mistralai/Mistral-7B-Instruct-v0.3",hint:"free \u2022 lightweight"},{name:"Mixtral 8x7B Instruct",value:"mistralai/Mixtral-8x7B-Instruct-v0.1",hint:"free \u2022 powerful"},{name:"Qwen 2 7B Instruct",value:"Qwen/Qwen2-7B-Instruct",hint:"free"},{name:"Qwen 2.5 7B Instruct",value:"Qwen/Qwen2.5-7B-Instruct",hint:"free \u2022 improved"},{name:"DeepSeek Coder 33B",value:"deepseek-ai/deepseek-coder-33b-instruct",hint:"free \u2022 coding"},{name:"Phi-3 Mini 4K",value:"microsoft/Phi-3-mini-4k-instruct",hint:"free \u2022 compact"}]}];function le(t){switch(t.provider){case"gemini":return Promise.resolve(new F(t.apiKey,t.model));case"huggingface":return Promise.resolve(new L(t.apiKey,t.model));case"openai":return Promise.resolve(new _(t.apiKey,t.model));default:throw new Error(`Provider ${t.provider} is not supported.`)}}async function D(){Me(d.blue.bold(e.config.intro));try{let t=await pe({message:e.config.providerPrompt,options:K.map(n=>({label:n.name,value:n.value}))});if(U(t)){G(d.red(e.common.operationCancelled));return}let o=t,i=K.find(n=>n.value===o),g=await Ee({message:e.config.apiKeyPrompt(o),mask:"*",validate:n=>{if(!n||n.trim()==="")return e.config.apiKeyRequired}});if(U(g)){G(d.red(e.common.operationCancelled));return}let a=g,c=await pe({message:e.config.modelPrompt,options:[...i?.models.map(n=>({label:n.name,value:n.value,hint:n.hint}))||[],{label:e.config.customModelSeparator,value:"custom_id"}]});if(U(c)){G(d.red(e.common.operationCancelled));return}let s=c;if(s==="custom_id"){let n=await ke({message:e.config.customModelPrompt,placeholder:"...",validate:h=>{if(!h||h.trim()==="")return e.config.customModelRequired}});if(U(n)){G(d.red(e.common.operationCancelled));return}s=n}await ae({provider:o,apiKey:a,model:s});let l=O(),u=`${e.config.providerLabel(K.find(n=>o===n.value)?.name||o)}
|
|
26
26
|
${e.config.modelLabel(s)}
|
|
27
27
|
${e.config.apiKeyLabel(a.slice(-4))}
|
|
28
|
-
${d.dim(e.config.configFile(l))}`;
|
|
28
|
+
${d.dim(e.config.configFile(l))}`;ge(u,d.cyan(e.config.saved));let m=`${d.white.bold("pai commit:")} ${d.white(e.config.hintCommit)}
|
|
29
29
|
${d.white.bold("pai config:")} ${d.white(e.config.hintConfig)}
|
|
30
|
-
${d.white.bold("pai reset:")} ${d.white(e.config.hintReset)}`;
|
|
30
|
+
${d.white.bold("pai reset:")} ${d.white(e.config.hintReset)}`;ge(m,d.cyan(e.config.commandsHint)),G(d.green.bold(e.config.outro))}catch(t){if(t.name==="ExitPromptError"){console.log(d.dim(e.common.operationCancelled));return}throw t}}import Fe from"ora";import r from"chalk";import Le from"simple-git";import{confirm as _e,select as be,text as Se,isCancel as $,note as ve,outro as p}from"@clack/prompts";import Y from"chalk";function Q(t){if(t.name==="ExitPromptError")return;t.message?.includes("API key not valid")||t.message?.includes("Authorization header")||[400,401,403].includes(t.status)?(console.log(Y.red(e.errors.authInvalid)),console.log(Y.yellow(e.errors.authFix))):console.log(Y.red(e.errors.unknown(t.message)))}import{simpleGit as Te}from"simple-git";var I=Te();async function z(){if(!await I.checkIsRepo())return{isRepo:!1};let o=await I.status();return(o.not_added.length>0||o.modified.length>0||o.deleted.length>0)&&await I.add("--all"),{isRepo:!0,diff:await I.diff(["--cached"])}}async function de(){await I.init()}async function ue(){try{return(await I.getRemotes()).length>0}catch{return!1}}import we from"chalk";import N from"fs";import he from"path";import Ge from"os";import B from"chalk";var X="pushai",A="1.0.4",ee="Stop writing manual commit messages.";var oe=he.join(Ge.homedir(),".config","pushai"),ie=he.join(oe,"update-check.json"),Ne=3600*1e3;function $e(){if(!N.existsSync(ie))return{lastCheck:0,latestVersion:null};try{return JSON.parse(N.readFileSync(ie,"utf-8"))}catch{return{lastCheck:0,latestVersion:null}}}function te(t){N.existsSync(oe)||N.mkdirSync(oe,{recursive:!0});let o={lastCheck:Date.now(),latestVersion:t};N.writeFileSync(ie,JSON.stringify(o,null,2),"utf-8")}async function Oe(){try{let t=await fetch("https://registry.npmjs.org/pushai/latest");return t.ok&&(await t.json()).version||null}catch{return null}}async function ye(){let t=$e(),o=Date.now();if(t.lastCheck&&o-t.lastCheck<Ne&&t.latestVersion){t.latestVersion!==A&&fe(t.latestVersion);return}Oe().then(i=>{i&&i!==A?(te(i),fe(i)):te(i||null)}).catch(()=>{})}function fe(t){console.log(B.yellow(`
|
|
31
|
+
\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E
|
|
32
|
+
\u2502 Update available! ${B.dim(A)} \u2192 ${B.green.bold(t)}
|
|
33
|
+
\u2502 Run ${B.cyan("npm install -g pushai")} to upgrade.
|
|
34
|
+
\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F
|
|
35
|
+
`))}function R(t,o,i){let g=setTimeout(()=>{t.isSpinning&&(t.color="yellow",t.text=we.yellow(o))},1e4),a=setTimeout(()=>{t.isSpinning&&(t.color="red",t.text=we.red(i))},6e4);return()=>{clearTimeout(g),clearTimeout(a),t.color="cyan"}}async function E(t){try{await t()}finally{ye().catch(()=>{})}}var Ce=Le();async function Pe(t,o,i,g,a){let c=t;for(;!c||c.trim()==="";){a.fail(r.red(e.commit.emptyMessageTitle));let s=await be({message:e.commit.emptyMessagePrompt,options:[{label:e.commit.emptyRegenerate,value:"regenerate"},{label:e.commit.emptyManual,value:"manual"},{label:e.commit.emptyCancel,value:"cancel"}]});if(($(s)||s==="cancel")&&(p(r.dim(e.commit.processStopped)),process.exit(0)),s==="regenerate"){a.start(r.blue(e.commit.regenerating));let l=R(a,e.commit.generatingSlow10,e.commit.generatingSlow60);try{if(c=await o.generateCommitMessage(i,g,{regenerate:!0}),l(),!c||c.trim()===""){a.warn(r.yellow(e.commit.stillEmptyWarning));continue}a.succeed(r.green(e.commit.regenerated))}catch(u){l(),a.fail(r.red(e.commit.regenerationFailed(u.message))),u.name==="AbortError"&&(p(r.yellow(e.commit.generationCancelled)),process.exit(0))}}else if(s==="manual"){let l=await Se({message:e.commit.manualMessagePrompt,validate:u=>!u||u.trim()===""?e.commit.manualMessageRequired:void 0});$(l)&&(p(r.dim(e.commit.processStopped)),process.exit(0)),c=l,a.succeed(r.green(e.commit.manualAccepted))}}return c}async function j(t=!1,o){let i=new AbortController;process.stdin.setRawMode?.(!0),process.stdin.resume(),process.stdin.setEncoding("utf8");let g=()=>{i.abort(),p(r.red(e.common.operationCancelled)),process.exit(0)},a=s=>{s===""&&g()};process.stdin.on("data",a),o?.(i);let c=()=>{i.abort(),p(r.red(e.common.operationCancelled)),process.exit(0)};process.once("SIGINT",c);try{let s=await W();if(!s.apiKey||!s.provider||!s.model){await D(),Object.assign(s,await W());return}console.log(e.commit.intro(s.provider.toUpperCase(),s.model));let l=await z();if(!l.isRepo){console.log(r.yellow(e.commit.gitRepoMissing));let f=await _e({message:e.commit.initConfirm,initialValue:!0});$(f)&&(p(r.red(e.common.operationCancelled)),process.exit(0)),f?(await de(),console.log(r.green(e.commit.initSuccess)),l=await z()):(p(r.dim(e.commit.abortNoRepo)),process.exit(0))}let u=l.diff;u||(p(r.red(e.commit.noChanges)),process.exit(0));let m=Fe({color:"cyan"}),n="",h;try{m.start(r.blue(e.commit.generating));let f=R(m,e.commit.generatingSlow10,e.commit.generatingSlow60);h=await le(s),n=await h.generateCommitMessage(u,i.signal),f(),n=await Pe(n,h,u,i.signal,m),m.succeed(r.green(e.commit.generated))}catch(f){m.fail(r.red.bold(e.commit.generationFailed)),f.name==="AbortError"&&(p(r.yellow(e.commit.generationCancelled)),process.exit(0)),Q(f),process.exit(1)}let x=!1;for(;!x;){ve(r.bold(n),e.commit.noteTitle);let f=await be({message:e.commit.actionPrompt,options:[{label:e.commit.actions.accept,value:"accept"},{label:e.commit.actions.edit,value:"edit"},{label:e.commit.actions.regenerate,value:"regenerate"},{label:e.commit.actions.cancel,value:"cancel"}]});$(f)&&(p(r.dim(e.commit.processStopped)),process.exit(0));let k=f;if(k==="accept")x=!0;else if(k==="edit"){let M=await Se({message:e.commit.editPrompt,initialValue:n});$(M)&&(p(r.dim(e.commit.processStopped)),process.exit(0)),n=M,x=!0}else if(k==="regenerate"){m.start(r.blue(e.commit.regenerating));let M=R(m,e.commit.generatingSlow10,e.commit.generatingSlow60);try{n=await h.generateCommitMessage(u,i.signal,{regenerate:!0}),M(),n=await Pe(n,h,u,i.signal,m),m.succeed(r.green(e.commit.regenerated))}catch(re){M(),m.fail(r.red(e.commit.regenerationFailed(re.message))),re.name==="AbortError"&&(p(r.yellow(e.commit.generationCancelled)),process.exit(0))}}else p(r.dim(e.commit.processStopped)),process.exit(0)}t&&(ve(r.dim(e.common.dryRun.proposed(n)),r.yellow(e.common.dryRun.header)),process.exit(0)),await ue()||(m.fail(r.red.bold(e.common.noRemote.header)),p(r.yellow(e.common.noRemote.instruction)),process.exit(1));try{m.start(r.blue(e.commit.committing));let f=R(m,e.commit.committingSlow10,e.commit.committingSlow60);await Ce.commit(n),f(),m.succeed(r.green(e.common.success.committed)),m.start(r.blue(e.commit.pushing));let k=R(m,e.commit.pushingSlow10,e.commit.pushingSlow60);await Ce.push(),k(),m.succeed(r.green.bold(e.common.success.pushed)),p(r.green(e.commit.outro))}catch(f){m.fail(r.red.bold(e.commit.operationFailed)),p(r.red(e.commit.gitError(f.message))),process.exit(1)}}catch(s){(s.name==="ExitPromptError"||s.name==="AbortError")&&(p(r.red(e.common.operationCancelled)),process.exit(0)),Q(s),process.exit(1)}finally{process.stdin.removeListener("data",a),process.stdin.setRawMode?.(!1),o?.(null)}}import Ue from"chalk";var C=null,S=new Ke;S.name(X).description(ee).option("--dry-run","Generate commit message but do not commit or push").action(async t=>{await E(async()=>{await j(t.dryRun,o=>{C=o}),C=null})});S.name(X).description(ee).version(A,"-v, --version","output the version number");S.action(async()=>{await E(async()=>{await j(!1,t=>{C=t}),C=null})});S.command("commit").description("Stage changes, generate a message, and push").option("--dry-run","Generate commit message but do not commit or push").action(async t=>{await E(async()=>{await j(t.dryRun,o=>{C=o}),C=null})});S.command("config").description("Configure AI providers and API keys").action(()=>E(D));S.command("reset").description("Delete the local config.json file").action(()=>E(me));process.on("SIGINT",()=>{console.log(Ue.yellow(e.common.interrupted)),C?C.abort():process.exit(0)});S.parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pushai",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Stop writing manual commit messages.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pai": "./dist/index.mjs"
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
"commander": "^14.0.3",
|
|
47
47
|
"conf": "^15.1.0",
|
|
48
48
|
"keytar": "^7.9.0",
|
|
49
|
+
"latest-version": "^9.0.0",
|
|
49
50
|
"openai": "^6.37.0",
|
|
50
51
|
"ora": "^9.4.0",
|
|
51
52
|
"simple-git": "^3.36.0",
|