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 +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/ai/commit/cli.rb +46 -6
- data/lib/ai/commit/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c5ca2379f204a0910193c4e9c26b10fab50d99283b62d71d91cac0c254308c2f
|
4
|
+
data.tar.gz: bba3bd959f87dee60a3706ccc81976d6c03f4c7f7edb309601c164b88b92e478
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
102
|
+
result = system("git", "commit", "-m", message)
|
103
103
|
|
104
|
-
if
|
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
|
data/lib/ai/commit/version.rb
CHANGED
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.
|
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-
|
10
|
+
date: 2025-08-28 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: thor
|