prior-cli 1.7.2 → 1.7.3
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 +38 -1
- package/package.json +1 -1
package/bin/prior.js
CHANGED
|
@@ -844,7 +844,7 @@ async function startChat(opts = {}) {
|
|
|
844
844
|
console.log(c.ok(' ◉') + c.muted(' Agent mode ') + c.dim('· file web shell image prior-network'));
|
|
845
845
|
|
|
846
846
|
console.log(DIVIDER);
|
|
847
|
-
console.log(c.muted(' /help /clear /compact /timer /save /load /saves /delete /exit'));
|
|
847
|
+
console.log(c.muted(' /help /clear /update /compact /timer /save /load /saves /delete /exit'));
|
|
848
848
|
console.log(DIVIDER);
|
|
849
849
|
console.log('');
|
|
850
850
|
|
|
@@ -861,6 +861,7 @@ async function startChat(opts = {}) {
|
|
|
861
861
|
readline.emitKeypressEvents(process.stdin, rl);
|
|
862
862
|
|
|
863
863
|
const SLASH_CMDS = [
|
|
864
|
+
{ cmd: '/update', desc: 'Check for updates and install if available' },
|
|
864
865
|
{ cmd: '/compact', desc: 'Compact conversation to save context' },
|
|
865
866
|
{ cmd: '/timer', desc: 'Set a countdown timer e.g. /timer 30s' },
|
|
866
867
|
{ cmd: '/saves', desc: 'List all saved conversations' },
|
|
@@ -1403,6 +1404,41 @@ Keep it under 350 words. Write prior.md now.`;
|
|
|
1403
1404
|
return loop();
|
|
1404
1405
|
}
|
|
1405
1406
|
|
|
1407
|
+
case '/update': {
|
|
1408
|
+
console.log('');
|
|
1409
|
+
process.stdout.write(c.dim(' Checking for updates…'));
|
|
1410
|
+
const _fetch = require('node-fetch');
|
|
1411
|
+
let _latest;
|
|
1412
|
+
try {
|
|
1413
|
+
const _res = await _fetch('https://registry.npmjs.org/prior-cli/latest', { timeout: 8000 });
|
|
1414
|
+
if (!_res.ok) throw new Error(`HTTP ${_res.status}`);
|
|
1415
|
+
_latest = (await _res.json()).version;
|
|
1416
|
+
} catch (err) {
|
|
1417
|
+
process.stdout.clearLine(0); process.stdout.cursorTo(0);
|
|
1418
|
+
console.log(c.err(` ✗ Could not reach npm registry: ${err.message}\n`));
|
|
1419
|
+
return loop();
|
|
1420
|
+
}
|
|
1421
|
+
process.stdout.clearLine(0); process.stdout.cursorTo(0);
|
|
1422
|
+
if (_latest === version) {
|
|
1423
|
+
console.log(c.ok(' ✓ Already up to date ') + c.muted(`v${version}\n`));
|
|
1424
|
+
return loop();
|
|
1425
|
+
}
|
|
1426
|
+
console.log(` ${c.muted('Current :')} ${c.white(`v${version}`)}`);
|
|
1427
|
+
console.log(` ${c.muted('Latest :')} ${c.bold(`v${_latest}`)}`);
|
|
1428
|
+
console.log('');
|
|
1429
|
+
process.stdout.write(c.dim(' Installing update…'));
|
|
1430
|
+
try {
|
|
1431
|
+
require('child_process').execSync('npm install -g prior-cli@latest', { stdio: 'ignore' });
|
|
1432
|
+
process.stdout.clearLine(0); process.stdout.cursorTo(0);
|
|
1433
|
+
console.log(c.ok(` ✓ Updated to v${_latest} `) + c.muted('restart prior to apply\n'));
|
|
1434
|
+
} catch (err) {
|
|
1435
|
+
process.stdout.clearLine(0); process.stdout.cursorTo(0);
|
|
1436
|
+
console.log(c.err(` ✗ Install failed: ${err.message}`));
|
|
1437
|
+
console.log(c.muted(' Try manually: npm install -g prior-cli@latest\n'));
|
|
1438
|
+
}
|
|
1439
|
+
return loop();
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1406
1442
|
case '/compact': {
|
|
1407
1443
|
if (chatHistory.length === 0) {
|
|
1408
1444
|
console.log(c.muted(' Nothing to compact yet.\n'));
|
|
@@ -1548,6 +1584,7 @@ Be concise but thorough — this summary replaces the full history to save conte
|
|
|
1548
1584
|
case '/help':
|
|
1549
1585
|
console.log('');
|
|
1550
1586
|
console.log(c.bold(' Commands'));
|
|
1587
|
+
console.log(c.muted(' /update ') + 'Check for updates and install if available');
|
|
1551
1588
|
console.log(c.muted(' /compact ') + 'Compact conversation to save context');
|
|
1552
1589
|
console.log(c.muted(' /timer <duration> ') + 'Countdown timer e.g. /timer 30s, /timer 5m');
|
|
1553
1590
|
console.log(c.muted(' /saves ') + 'List all saved conversations');
|