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.
- package/bin/prior.js +15 -24
- 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
|
-
// ──
|
|
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.
|
|
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
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
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
|
};
|