smart-commit 0.1.0 → 0.2.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fc1d59ff49319c54e1f73ced0cbf81c80546300a72c2fbdcc167fb0fbbbf8424
4
- data.tar.gz: 72c46e4dbc7a18fa36c786416b39fa7ef54e664d551f0569f137c2ece8ddce2a
3
+ metadata.gz: c5ca2379f204a0910193c4e9c26b10fab50d99283b62d71d91cac0c254308c2f
4
+ data.tar.gz: bba3bd959f87dee60a3706ccc81976d6c03f4c7f7edb309601c164b88b92e478
5
5
  SHA512:
6
- metadata.gz: 9e3f8c6187d3162752779729cb2e2c57736e5fa7df6ee949569b36c15f3452df1e06cf819e2459de97b82f5a4071572c29d961ce6fcc39b85e598e257ce09b5a
7
- data.tar.gz: 112fdd778c200dbf88a0f91cf4ac643e891aa5d98cf925e30f953f9ceb39d1d4a510b1d3922e8962957ec5d25fe3dfdb5c21067bf98055f915cf3e8f93c3963e
6
+ metadata.gz: e0790e0bb9c471760658ee60306c5636e9c01434b7b5a3f72bf27012df906f1f42d0ee74783c1d83301bde718cf76459388d5258852a0170bb240fc5eb4488c0
7
+ data.tar.gz: 8b88ae68e035fdd316672301f074062104f65eb211366dd67801d6eb50298d405961173b20a06649f98c81834d73d4030bea6ee8a978cb5d57a90ec326f3f393
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.2.0] - 2025-01-27
4
+
5
+ ### Added
6
+ - Edit functionality for commit messages in the `commit` command
7
+ - Users can now modify AI-generated commit messages before committing
8
+ - Support for custom editor via `$EDITOR` or `$VISUAL` environment variables
9
+ - Fallback to `nano` editor if no default editor is configured
10
+
3
11
  ## [0.1.0] - 2025-08-25
4
12
 
5
13
  - Initial release
data/lib/ai/commit/cli.rb CHANGED
@@ -94,21 +94,35 @@ module Ai
94
94
  puts message
95
95
  puts "=" * 50
96
96
 
97
- print "\nCommit with this message? (y/N): "
97
+ print "\nCommit with this message? (y/N/e to edit): "
98
98
  response = STDIN.gets.chomp.downcase
99
99
 
100
100
  if response == 'y' || response == 'yes'
101
101
  puts "\nšŸš€ Committing..."
102
- result = `git commit -m "#{message}"`
102
+ result = system("git", "commit", "-m", message)
103
103
 
104
- if $?.exitstatus == 0
104
+ if result
105
105
  puts "āœ… Successfully committed!"
106
- puts result
107
106
  else
108
- puts "āŒ Failed to commit:"
109
- puts result
107
+ puts "āŒ Failed to commit"
110
108
  exit 1
111
109
  end
110
+ elsif response == 'e' || response == 'edit'
111
+ edited_message = edit_message(message)
112
+ if edited_message && !edited_message.strip.empty?
113
+ puts "\nšŸš€ Committing with edited message..."
114
+ result = system("git", "commit", "-m", edited_message)
115
+
116
+ if result
117
+ puts "āœ… Successfully committed!"
118
+ else
119
+ puts "āŒ Failed to commit"
120
+ exit 1
121
+ end
122
+ else
123
+ puts "āŒ Commit cancelled."
124
+ exit 0
125
+ end
112
126
  else
113
127
  puts "āŒ Commit cancelled."
114
128
  exit 0
@@ -172,6 +186,32 @@ module Ai
172
186
  puts "āœ… Created #{prompts_file} with sample content"
173
187
  puts "šŸ“ Edit the file to add your custom prompts"
174
188
  end
189
+
190
+ private
191
+
192
+ def edit_message(original_message)
193
+ puts "\nšŸ“ Opening editor to modify commit message..."
194
+ puts "Original message will be loaded in your default editor."
195
+ puts "Save and close the editor to commit, or close without saving to cancel."
196
+
197
+ # Create a temporary file with the original message
198
+ require 'tempfile'
199
+ temp_file = Tempfile.new(['commit_message', '.txt'])
200
+ temp_file.write(original_message)
201
+ temp_file.close
202
+
203
+ # Get the default editor
204
+ editor = ENV['EDITOR'] || ENV['VISUAL'] || 'nano'
205
+
206
+ # Open the file in the editor
207
+ system("#{editor} #{temp_file.path}")
208
+
209
+ # Read the edited content
210
+ edited_content = File.read(temp_file.path)
211
+ temp_file.unlink
212
+
213
+ edited_content
214
+ end
175
215
  end
176
216
  end
177
217
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Ai
4
4
  module Commit
5
- VERSION = "0.1.0"
5
+ VERSION = "0.2.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart-commit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Behrang Mirzamani
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-08-27 00:00:00.000000000 Z
10
+ date: 2025-08-28 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: thor