prior-cli 1.5.7 → 1.5.8
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 +20 -2
- package/package.json +1 -1
package/bin/prior.js
CHANGED
|
@@ -51,16 +51,34 @@ function fmtElapsed(ms) {
|
|
|
51
51
|
return `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
const THINK_LABELS = [
|
|
55
|
+
'thinking…',
|
|
56
|
+
'prioring…',
|
|
57
|
+
'processing…',
|
|
58
|
+
'reasoning…',
|
|
59
|
+
'cooking…',
|
|
60
|
+
'figuring it out…',
|
|
61
|
+
'on it…',
|
|
62
|
+
'analyzing…',
|
|
63
|
+
];
|
|
64
|
+
|
|
54
65
|
function spinStart(label = '') {
|
|
55
66
|
spinStop();
|
|
56
67
|
if (!process.stdout.isTTY) return;
|
|
57
68
|
_spinLabel = label;
|
|
58
69
|
_spinStart = Date.now();
|
|
70
|
+
let labelIdx = 0;
|
|
59
71
|
_spinTimer = setInterval(() => {
|
|
60
72
|
process.stdout.clearLine(0);
|
|
61
73
|
process.stdout.cursorTo(0);
|
|
62
|
-
const
|
|
63
|
-
|
|
74
|
+
const ms = Date.now() - _spinStart;
|
|
75
|
+
// Cycle through think labels every 4s only when in thinking mode
|
|
76
|
+
if (_spinLabel === 'thinking…') {
|
|
77
|
+
labelIdx = Math.floor(ms / 4000) % THINK_LABELS.length;
|
|
78
|
+
}
|
|
79
|
+
const displayLabel = _spinLabel === 'thinking…' ? THINK_LABELS[labelIdx] : _spinLabel;
|
|
80
|
+
const elapsedStr = ` ${c.dim('(' + fmtElapsed(ms) + ')')}`;
|
|
81
|
+
process.stdout.write(` ${c.brand(SPIN_FRAMES[_spinIdx++ % 4])} ${c.dim(displayLabel)}${elapsedStr}`);
|
|
64
82
|
}, 100);
|
|
65
83
|
}
|
|
66
84
|
|