@@ -43,34 +43,34 @@ var (
4343)
4444
4545func init () {
46- commitCmd .PersistentFlags ().StringP ("file" , "f" , "" , "commit message file " )
47- commitCmd .PersistentFlags ().BoolVar (& preview , "preview" , false , "preview commit message" )
46+ commitCmd .PersistentFlags ().StringP ("file" , "f" , "" , "output file for commit message" )
47+ commitCmd .PersistentFlags ().BoolVar (& preview , "preview" , false , "preview commit message before committing " )
4848 commitCmd .PersistentFlags ().IntVar (& diffUnified , "diff_unified" , 3 ,
49- "generate diffs with <n> lines of context, default is 3 " )
50- commitCmd .PersistentFlags ().StringVar (& commitModel , "model" , "gpt-4o" , "select openai model" )
51- commitCmd .PersistentFlags ().StringVar (& commitLang , "lang" , "en" , "summarizing language uses English by default" )
49+ "generate diffs with <n> lines of context ( default: 3) " )
50+ commitCmd .PersistentFlags ().StringVar (& commitModel , "model" , "gpt-4o" , "OpenAI model to use for generation " )
51+ commitCmd .PersistentFlags ().StringVar (& commitLang , "lang" , "en" , "output language for the commit message ( default: English) " )
5252 commitCmd .PersistentFlags ().StringSliceVar (& excludeList , "exclude_list" , []string {},
53- "exclude file from git diff command " )
54- commitCmd .PersistentFlags ().StringVar (& httpsProxy , "proxy" , "" , "http proxy" )
55- commitCmd .PersistentFlags ().StringVar (& socksProxy , "socks" , "" , "socks proxy" )
56- commitCmd .PersistentFlags ().StringVar (& templateFile , "template_file" , "" , "git commit message file " )
57- commitCmd .PersistentFlags ().StringVar (& templateString , "template_string" , "" , "git commit message string " )
58- commitCmd .PersistentFlags ().StringSliceVar (& templateVars , "template_vars" , []string {}, "template variables" )
59- commitCmd .PersistentFlags ().StringVar (& templateVarsFile , "template_vars_file" , "" , "template variables file " )
53+ "files to exclude from git diff" )
54+ commitCmd .PersistentFlags ().StringVar (& httpsProxy , "proxy" , "" , "HTTP proxy URL " )
55+ commitCmd .PersistentFlags ().StringVar (& socksProxy , "socks" , "" , "SOCKS proxy URL " )
56+ commitCmd .PersistentFlags ().StringVar (& templateFile , "template_file" , "" , "template file for commit message format " )
57+ commitCmd .PersistentFlags ().StringVar (& templateString , "template_string" , "" , "inline template string for commit message format " )
58+ commitCmd .PersistentFlags ().StringSliceVar (& templateVars , "template_vars" , []string {}, "custom variables for templates " )
59+ commitCmd .PersistentFlags ().StringVar (& templateVarsFile , "template_vars_file" , "" , "file containing template variables" )
6060 commitCmd .PersistentFlags ().BoolVar (& commitAmend , "amend" , false ,
61- "replace the tip of the current branch by creating a new commit. " )
62- commitCmd .PersistentFlags ().DurationVarP (& timeout , "timeout" , "t" , defaultTimeout , "request timeout" )
61+ "amend the previous commit instead of creating a new one " )
62+ commitCmd .PersistentFlags ().DurationVarP (& timeout , "timeout" , "t" , defaultTimeout , "API request timeout duration " )
6363 commitCmd .PersistentFlags ().BoolVar (& promptOnly , "prompt_only" , false ,
64- "show prompt only, don't send request to openai " )
64+ "display the prompt without sending to OpenAI " )
6565 commitCmd .PersistentFlags ().BoolVar (& noConfirm , "no_confirm" , false ,
66- "skip confirmation prompt " )
66+ "skip all confirmation prompts " )
6767 _ = viper .BindPFlag ("output.file" , commitCmd .PersistentFlags ().Lookup ("file" ))
6868}
6969
7070// commitCmd represents the commit command.
7171var commitCmd = & cobra.Command {
7272 Use : "commit" ,
73- Short : "Auto generate commit message" ,
73+ Short : "Automatically generate commit message" ,
7474 RunE : func (cmd * cobra.Command , args []string ) error {
7575 if err := check (); err != nil {
7676 return err
@@ -92,25 +92,25 @@ var commitCmd = &cobra.Command{
9292 viper .Set ("openai.timeout" , timeout )
9393 }
9494
95- // check provider
95+ // Check provider
9696 provider := core .Platform (viper .GetString ("openai.provider" ))
9797 client , err := GetClient (cmd .Context (), provider )
9898 if err != nil && ! promptOnly {
9999 return err
100100 }
101101
102102 currentModel := viper .GetString ("openai.model" )
103- color .Green ("Summarize the commit message use " + currentModel + " model" )
103+ color .Green ("Summarizing commit message using " + currentModel + " model" )
104104
105105 data := util.Data {}
106- // add template vars
106+ // Add template variables
107107 if vars := util .ConvertToMap (templateVars ); len (vars ) > 0 {
108108 for k , v := range vars {
109109 data [k ] = v
110110 }
111111 }
112112
113- // add template vars from file
113+ // Add template variables from file
114114 if templateVarsFile != "" {
115115 allENV , err := godotenv .Read (templateVarsFile )
116116 if err != nil {
@@ -121,7 +121,7 @@ var commitCmd = &cobra.Command{
121121 }
122122 }
123123
124- // Get code review message from diff datas
124+ // Get code review message from diff data
125125 if _ , ok := data [prompt .SummarizeMessageKey ]; ! ok {
126126 out , err := util .GetTemplateByString (
127127 prompt .SummarizeFileDiffTemplate ,
@@ -133,16 +133,16 @@ var commitCmd = &cobra.Command{
133133 return err
134134 }
135135
136- // determine if the user wants to use the prompt only
136+ // Determine if the user wants to use the prompt only
137137 if promptOnly {
138138 color .Yellow ("====================Prompt========================" )
139139 color .Yellow ("\n " + strings .TrimSpace (out ) + "\n \n " )
140140 color .Yellow ("==================================================" )
141141 return nil
142142 }
143143
144- // Get summarize comment from diff datas
145- color .Cyan ("We are trying to summarize a git diff" )
144+ // Get summarized comment from diff data
145+ color .Cyan ("Summarizing git diff... " )
146146 resp , err := client .Completion (cmd .Context (), out )
147147 if err != nil {
148148 return err
@@ -151,7 +151,7 @@ var commitCmd = &cobra.Command{
151151 color .Magenta (resp .Usage .String ())
152152 }
153153
154- // Get summarize title from diff datas
154+ // Get summarized title from diff data
155155 if _ , ok := data [prompt .SummarizeTitleKey ]; ! ok {
156156 out , err := util .GetTemplateByString (
157157 prompt .SummarizeTitleTemplate ,
@@ -163,16 +163,16 @@ var commitCmd = &cobra.Command{
163163 return err
164164 }
165165
166- // Get summarize title from diff datas
167- color .Cyan ("We are trying to summarize a title for pull request" )
166+ // Generate title for pull request
167+ color .Cyan ("Generating title for pull request... " )
168168 resp , err := client .Completion (cmd .Context (), out )
169169 if err != nil {
170170 return err
171171 }
172172 summarizeTitle := resp .Content
173173 color .Magenta (resp .Usage .String ())
174174
175- // lowercase the first character of first word of the commit message and remove last period
175+ // Lowercase the first character of first word of the commit message and remove the trailing period
176176 summarizeTitle = strings .TrimRight (strings .ToLower (string (summarizeTitle [0 ]))+ summarizeTitle [1 :], "." )
177177 data [prompt .SummarizeTitleKey ] = strings .TrimSpace (summarizeTitle )
178178 }
@@ -187,7 +187,7 @@ var commitCmd = &cobra.Command{
187187 if err != nil {
188188 return err
189189 }
190- message := "We are trying to get conventional commit prefix"
190+ message := "Generating conventional commit prefix"
191191 summaryPrix := ""
192192 color .Cyan (message + " (Tools)" )
193193 resp , err := client .GetSummaryPrefix (cmd .Context (), out )
@@ -244,8 +244,8 @@ var commitCmd = &cobra.Command{
244244 return err
245245 }
246246
247- // translate a git commit message
248- color .Cyan ("We are trying to translate a git commit message to " + prompt .GetLanguage (viper .GetString ("output.lang" )) + " language" )
247+ // Translate git commit message
248+ color .Cyan ("Translating git commit message to " + prompt .GetLanguage (viper .GetString ("output.lang" )))
249249 resp , err := client .Completion (cmd .Context (), out )
250250 if err != nil {
251251 return err
@@ -254,7 +254,7 @@ var commitCmd = &cobra.Command{
254254 commitMessage = resp .Content
255255 }
256256
257- // unescape html entities in commit message
257+ // Unescape HTML entities in commit message
258258 commitMessage = html .UnescapeString (commitMessage )
259259 commitMessage = strings .TrimSpace (commitMessage )
260260
@@ -271,8 +271,8 @@ var commitCmd = &cobra.Command{
271271 }
272272 outputFile = path .Join (strings .TrimSpace (out ), "COMMIT_EDITMSG" )
273273 }
274- color .Cyan ("Write the commit message to " + outputFile + " file" )
275- // write commit message to git staging file
274+ color .Cyan ("Writing commit message to " + outputFile )
275+ // Write commit message to git staging file
276276 err = os .WriteFile (outputFile , []byte (commitMessage ), 0o600 )
277277 if err != nil {
278278 return err
@@ -283,7 +283,7 @@ var commitCmd = &cobra.Command{
283283 if noConfirm {
284284 return nil
285285 }
286- if ready , err := confirmation .New ("Commit preview summary?" , confirmation .Yes ).RunPrompt (); err != nil || ! ready {
286+ if ready , err := confirmation .New ("Commit this preview summary?" , confirmation .Yes ).RunPrompt (); err != nil || ! ready {
287287 if err != nil {
288288 return err
289289 }
@@ -293,7 +293,7 @@ var commitCmd = &cobra.Command{
293293
294294 // Handle commit message change prompt when confirmation is enabled
295295 if ! noConfirm {
296- if change , err := confirmation .New ("Do you want to change the commit message?" , confirmation .No ).RunPrompt (); err != nil {
296+ if change , err := confirmation .New ("Do you want to modify the commit message?" , confirmation .No ).RunPrompt (); err != nil {
297297 return err
298298 } else if change {
299299 m := initialPrompt (commitMessage )
@@ -306,8 +306,8 @@ var commitCmd = &cobra.Command{
306306 }
307307 }
308308
309- // git commit automatically
310- color .Cyan ("Git record changes to the repository" )
309+ // Commit changes to repository
310+ color .Cyan ("Recording changes to the repository" )
311311 output , err := g .Commit (commitMessage )
312312 if err != nil {
313313 return err
0 commit comments