@snapcommit/cli 2.0.4 → 2.0.5

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.
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  exports.executeCursorStyle = executeCursorStyle;
11
11
  const chalk_1 = __importDefault(require("chalk"));
12
12
  const child_process_1 = require("child_process");
13
+ const readline_1 = __importDefault(require("readline"));
13
14
  const git_1 = require("../utils/git");
14
15
  const auth_1 = require("../lib/auth");
15
16
  async function executeCursorStyle(userInput) {
@@ -35,20 +36,24 @@ async function executeCursorStyle(userInput) {
35
36
  console.log(chalk_1.default.gray('šŸ“ Commit message: ') + chalk_1.default.cyan(`"${plan.commitMessage}"`));
36
37
  console.log();
37
38
  }
38
- // Ask for confirmation
39
+ // Ask for confirmation (natural language!)
39
40
  const needsConfirm = plan.actions.some(a => a.requiresConfirmation);
40
41
  if (needsConfirm) {
41
- const confirmOptions = plan.commitMessage
42
- ? chalk_1.default.yellow('Continue? (Y/n/e to edit message): ')
43
- : chalk_1.default.yellow('Continue? (Y/n): ');
44
- const answer = await askQuestion(confirmOptions);
45
- if (answer.toLowerCase() === 'n') {
42
+ const confirmPrompt = plan.commitMessage
43
+ ? chalk_1.default.cyan('What next? ') + chalk_1.default.gray('(') + chalk_1.default.white('continue') + chalk_1.default.gray(' • ') + chalk_1.default.white('cancel') + chalk_1.default.gray(' • ') + chalk_1.default.white('edit message') + chalk_1.default.gray('): ')
44
+ : chalk_1.default.cyan('What next? ') + chalk_1.default.gray('(') + chalk_1.default.white('continue') + chalk_1.default.gray(' • ') + chalk_1.default.white('cancel') + chalk_1.default.gray('): ');
45
+ const answer = await askQuestion(confirmPrompt);
46
+ const input = answer.toLowerCase().trim();
47
+ // Cancel commands
48
+ if (input === 'cancel' || input === 'no' || input === 'n' || input === 'stop' || input === 'abort') {
46
49
  console.log(chalk_1.default.gray('\nāœ— Cancelled\n'));
47
50
  return;
48
51
  }
49
- if (answer.toLowerCase() === 'e' && plan.commitMessage) {
52
+ // Edit commands
53
+ if (plan.commitMessage && (input === 'edit' || input === 'e' || input === 'change' || input === 'edit message')) {
50
54
  plan.commitMessage = await editMessage(plan.commitMessage);
51
55
  }
56
+ // Everything else (including "continue", "yes", "go ahead", "do it", "y", or just Enter) → proceed
52
57
  }
53
58
  // Execute the plan
54
59
  console.log(chalk_1.default.blue('\nāš™ļø Executing...\n'));
@@ -287,17 +292,19 @@ async function tryAutoFix(error, action) {
287
292
  return false;
288
293
  }
289
294
  function askQuestion(query) {
295
+ const rl = readline_1.default.createInterface({
296
+ input: process.stdin,
297
+ output: process.stdout,
298
+ terminal: false, // Don't process terminal escape sequences
299
+ });
290
300
  return new Promise((resolve) => {
301
+ // Write prompt manually
291
302
  process.stdout.write(query);
292
- process.stdin.setRawMode(false);
293
- process.stdin.resume();
294
- process.stdin.setEncoding('utf8');
295
- const onData = (data) => {
296
- process.stdin.removeListener('data', onData);
297
- process.stdin.pause();
298
- resolve(data.toString().trim());
299
- };
300
- process.stdin.once('data', onData);
303
+ // Listen for ONE line of input
304
+ rl.once('line', (answer) => {
305
+ rl.close();
306
+ resolve(answer.trim());
307
+ });
301
308
  });
302
309
  }
303
310
  async function editMessage(originalMessage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@snapcommit/cli",
3
- "version": "2.0.4",
3
+ "version": "2.0.5",
4
4
  "description": "Instant AI commits. Beautiful progress tracking. Never write commit messages again.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {