@snapcommit/cli 2.3.1 → 2.4.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.
@@ -129,6 +129,7 @@ async function showStatus() {
129
129
  }
130
130
  /**
131
131
  * Execute commit with AI-generated message
132
+ * Shows message and allows editing (like Cursor!)
132
133
  */
133
134
  async function executeCommitWithAI(intent) {
134
135
  const status = (0, git_1.getGitStatus)();
@@ -147,11 +148,30 @@ async function executeCommitWithAI(intent) {
147
148
  }
148
149
  // Generate AI commit message
149
150
  const diff = (0, git_1.getGitDiff)(true);
150
- const commitMessage = await generateCommitMessage(diff);
151
+ let commitMessage = await generateCommitMessage(diff);
152
+ // Show message and ask if they want to edit (like Cursor!)
153
+ console.log(chalk_1.default.cyan('\nšŸ“ Commit message:'));
154
+ console.log(chalk_1.default.white(` ${commitMessage.split('\n')[0]}\n`));
155
+ const readline = await Promise.resolve().then(() => __importStar(require('readline')));
156
+ const rl = readline.createInterface({
157
+ input: process.stdin,
158
+ output: process.stdout,
159
+ });
160
+ const answer = await new Promise((resolve) => {
161
+ rl.question(chalk_1.default.gray('Press Enter to commit, or type new message: '), (ans) => {
162
+ rl.close();
163
+ resolve(ans);
164
+ });
165
+ });
166
+ // If user typed something, use that instead
167
+ if (answer.trim()) {
168
+ commitMessage = answer.trim();
169
+ console.log(chalk_1.default.green('\nāœ“ Message updated\n'));
170
+ }
151
171
  // Commit
152
172
  try {
153
173
  (0, child_process_1.execSync)(`git commit -m "${commitMessage.replace(/"/g, '\\"')}"`, { encoding: 'utf-8', stdio: 'pipe' });
154
- console.log(chalk_1.default.green(`āœ“ ${commitMessage.split('\n')[0]}`));
174
+ console.log(chalk_1.default.green(`āœ“ Committed`));
155
175
  }
156
176
  catch (error) {
157
177
  console.log(chalk_1.default.red(`āŒ Commit failed`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "2.3.1",
3
+ "version": "2.4.0",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {