prior-cli 1.2.0 → 1.2.2

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.
Files changed (2) hide show
  1. package/bin/prior.js +15 -24
  2. package/package.json +1 -1
package/bin/prior.js CHANGED
@@ -401,33 +401,24 @@ function renderToolSkip(name) {
401
401
  process.stdout.write(` ${c.warn('⊘')} ${c.muted(name)} ${c.dim('skipped')}\n`);
402
402
  }
403
403
 
404
- // ── Single-keypress confirm prompt ────────────────────────────
405
- function askConfirmKey(promptText) {
404
+ // ── Confirm prompt (Enter-based, no raw mode) ─────────────────
405
+ function askConfirmKey(promptText, rl) {
406
406
  return new Promise(resolve => {
407
- process.stdout.write(` ${c.muted('┤')} ${promptText} ${c.muted('[Y/n]')} `);
408
-
409
- if (!process.stdout.isTTY || !process.stdin.isTTY) {
410
- process.stdout.write(c.ok('y') + '\n');
407
+ if (!process.stdout.isTTY || !process.stdin.isTTY || !rl) {
408
+ process.stdout.write(` ${c.muted('┤')} ${promptText} ${c.muted('[Y/n]')} ${c.ok('y')}\n\n`);
411
409
  return resolve(true);
412
410
  }
413
411
 
414
- process.stdin.setRawMode(true);
415
- process.stdin.resume();
416
- process.stdin.setEncoding('utf8');
417
-
418
- function handler(ch) {
419
- process.stdin.setRawMode(false);
420
- process.stdin.pause();
421
- process.stdin.removeListener('data', handler);
422
-
423
- const key = ch.toLowerCase();
424
- if (key === '\u0003') { process.stdout.write('\n'); process.exit(0); }
425
- if (key === 'n') { process.stdout.write(c.err('n') + '\n\n'); return resolve(false); }
426
- process.stdout.write(c.ok('y') + '\n\n');
427
- resolve(true);
428
- }
429
-
430
- process.stdin.on('data', handler);
412
+ rl.question(` ${c.muted('┤')} ${promptText} ${c.muted('[Y/n]')} `, ans => {
413
+ const key = (ans || '').trim().toLowerCase();
414
+ if (key === 'n' || key === 'no') {
415
+ process.stdout.write('\n');
416
+ resolve(false);
417
+ } else {
418
+ process.stdout.write('\n');
419
+ resolve(true);
420
+ }
421
+ });
431
422
  });
432
423
  }
433
424
 
@@ -929,7 +920,7 @@ Keep it under 350 words. Write prior.md now.`;
929
920
  file_write: 'Write this file?',
930
921
  file_delete: 'Delete this file?',
931
922
  };
932
- const approved = await askConfirmKey(PROMPTS[name] || `Execute ${name}?`);
923
+ const approved = await askConfirmKey(PROMPTS[name] || `Execute ${name}?`, rl);
933
924
  if (approved) spinStart('working…');
934
925
  return approved;
935
926
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prior-cli",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "Prior Network AI — command-line interface",
5
5
  "bin": {
6
6
  "prior": "bin/prior.js"