prior-cli 1.7.1 → 1.7.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 +76 -2
  2. 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 /exit'));
847
+ console.log(c.muted(' /help /clear /compact /timer /save /load /saves /delete /exit'));
848
848
  console.log(DIVIDER);
849
849
  console.log('');
850
850
 
@@ -866,6 +866,7 @@ async function startChat(opts = {}) {
866
866
  { cmd: '/saves', desc: 'List all saved conversations' },
867
867
  { cmd: '/save', desc: 'Save current conversation e.g. /save my session' },
868
868
  { cmd: '/load', desc: 'Load a saved conversation' },
869
+ { cmd: '/delete', desc: 'Delete a saved conversation' },
869
870
  { cmd: '/help', desc: 'Show help' },
870
871
  { cmd: '/clear', desc: 'Clear screen' },
871
872
  { cmd: '/censored', desc: 'Load standard model (qwen)' },
@@ -1062,7 +1063,79 @@ async function startChat(opts = {}) {
1062
1063
  console.log(num + name + meta);
1063
1064
  });
1064
1065
  console.log(DIVIDER);
1065
- console.log(c.muted(' Use /load <name> or /load <number> to restore\n'));
1066
+ console.log(c.muted(' /load <name|#> · /delete <name|#>\n'));
1067
+ }
1068
+ return loop();
1069
+ }
1070
+
1071
+ case '/delete': {
1072
+ const saves = listSaves(user);
1073
+ if (saves.length === 0) {
1074
+ console.log(c.muted('\n No saved conversations to delete.\n'));
1075
+ return loop();
1076
+ }
1077
+
1078
+ let target = null;
1079
+ const query = args.join(' ').trim();
1080
+
1081
+ if (query) {
1082
+ const num = parseInt(query, 10);
1083
+ if (!isNaN(num) && num >= 1 && num <= saves.length) {
1084
+ target = saves[num - 1];
1085
+ } else {
1086
+ const q = query.toLowerCase();
1087
+ target = saves.find(s => sanitizeName(s.name) === sanitizeName(query))
1088
+ || saves.find(s => s.name.toLowerCase().includes(q));
1089
+ }
1090
+ if (!target) {
1091
+ console.log(c.err(` No save found matching "${query}"\n`));
1092
+ return loop();
1093
+ }
1094
+ } else {
1095
+ // Show list and ask
1096
+ console.log('');
1097
+ console.log(c.bold(' Delete a conversation:'));
1098
+ console.log(DIVIDER);
1099
+ saves.forEach((s, i) => {
1100
+ const num = c.brand(` ${String(i + 1).padStart(2)}. `);
1101
+ const name = c.white(s.name.padEnd(28));
1102
+ const meta = c.muted(`${s.msgCount} msgs · ${new Date(s.savedAt).toLocaleDateString('en-PH', { month: 'short', day: 'numeric', year: 'numeric' })}`);
1103
+ console.log(num + name + meta);
1104
+ });
1105
+ console.log(DIVIDER);
1106
+ const answer = await new Promise(res => rl.question(c.muted(' Enter number or name (Enter to cancel): '), res));
1107
+ const trimmed = (answer || '').trim();
1108
+ if (!trimmed) {
1109
+ console.log(c.muted(' Cancelled.\n'));
1110
+ return loop();
1111
+ }
1112
+ const n = parseInt(trimmed, 10);
1113
+ if (!isNaN(n) && n >= 1 && n <= saves.length) {
1114
+ target = saves[n - 1];
1115
+ } else {
1116
+ const q = trimmed.toLowerCase();
1117
+ target = saves.find(s => sanitizeName(s.name) === sanitizeName(trimmed))
1118
+ || saves.find(s => s.name.toLowerCase().includes(q));
1119
+ }
1120
+ if (!target) {
1121
+ console.log(c.err(` No save found matching "${trimmed}"\n`));
1122
+ return loop();
1123
+ }
1124
+ }
1125
+
1126
+ // Confirm
1127
+ const confirm = await new Promise(res => rl.question(c.warn(` Delete "${target.name}"? [y/N] `), res));
1128
+ if ((confirm || '').trim().toLowerCase() !== 'y') {
1129
+ console.log(c.muted(' Cancelled.\n'));
1130
+ return loop();
1131
+ }
1132
+
1133
+ try {
1134
+ const filePath = path.join(savesDir(user), sanitizeName(target.name) + '.json');
1135
+ fs.unlinkSync(filePath);
1136
+ console.log(c.ok(` ✓ Deleted "${target.name}"\n`));
1137
+ } catch (err) {
1138
+ console.log(c.err(` Failed to delete: ${err.message}\n`));
1066
1139
  }
1067
1140
  return loop();
1068
1141
  }
@@ -1480,6 +1553,7 @@ Be concise but thorough — this summary replaces the full history to save conte
1480
1553
  console.log(c.muted(' /saves ') + 'List all saved conversations');
1481
1554
  console.log(c.muted(' /save <name> ') + 'Save current conversation');
1482
1555
  console.log(c.muted(' /load [name|number] ') + 'Load a saved conversation (picker if no arg)');
1556
+ console.log(c.muted(' /delete [name|number]') + 'Delete a saved conversation');
1483
1557
  console.log(c.muted(' /clear ') + 'Clear screen');
1484
1558
  console.log(c.muted(' /censored ') + 'Load standard model (qwen)');
1485
1559
  console.log(c.muted(' /uncensored ') + 'Load uncensored model (dolphin)');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prior-cli",
3
- "version": "1.7.1",
3
+ "version": "1.7.2",
4
4
  "description": "Prior Network AI — command-line interface",
5
5
  "bin": {
6
6
  "prior": "bin/prior.js"