prior-cli 1.7.0 → 1.7.1

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 +29 -6
  2. package/package.json +1 -1
package/bin/prior.js CHANGED
@@ -1079,7 +1079,9 @@ async function startChat(opts = {}) {
1079
1079
  }
1080
1080
  try {
1081
1081
  writeSession(user, saveName, chatHistory, currentModel);
1082
- console.log(c.ok(` ✓ Saved "${saveName}"`) + c.muted(` · ${chatHistory.length} messages · ~/.prior/saves/${user}/\n`));
1082
+ const savedPath = path.join(savesDir(user), sanitizeName(saveName) + '.json');
1083
+ console.log(c.ok(` ✓ Saved "${saveName}"`) + c.muted(` · ${chatHistory.length} messages`));
1084
+ console.log(c.muted(` ${savedPath}\n`));
1083
1085
  } catch (err) {
1084
1086
  console.log(c.err(` Failed to save: ${err.message}\n`));
1085
1087
  }
@@ -1089,7 +1091,7 @@ async function startChat(opts = {}) {
1089
1091
  case '/load': {
1090
1092
  const saves = listSaves(user);
1091
1093
  if (saves.length === 0) {
1092
- console.log(c.muted('\n No saved conversations yet.\n'));
1094
+ console.log(c.muted('\n No saved conversations yet. Use /save <name> to create one.\n'));
1093
1095
  return loop();
1094
1096
  }
1095
1097
 
@@ -1102,7 +1104,6 @@ async function startChat(opts = {}) {
1102
1104
  if (!isNaN(num) && num >= 1 && num <= saves.length) {
1103
1105
  chosen = saves[num - 1];
1104
1106
  } else {
1105
- // fuzzy name match
1106
1107
  const q = query.toLowerCase();
1107
1108
  chosen = saves.find(s => sanitizeName(s.name) === sanitizeName(query))
1108
1109
  || saves.find(s => s.name.toLowerCase().includes(q));
@@ -1112,14 +1113,36 @@ async function startChat(opts = {}) {
1112
1113
  return loop();
1113
1114
  }
1114
1115
  } else {
1115
- // Interactive picker
1116
+ // Numbered list prompt — reliable across all terminals
1116
1117
  console.log('');
1117
1118
  console.log(c.bold(' Load a conversation:'));
1118
- chosen = await showPicker(saves, rl);
1119
- if (!chosen) {
1119
+ console.log(DIVIDER);
1120
+ saves.forEach((s, i) => {
1121
+ const num = c.brand(` ${String(i + 1).padStart(2)}. `);
1122
+ const name = c.white(s.name.padEnd(28));
1123
+ const meta = c.muted(`${s.msgCount} msgs · ${new Date(s.savedAt).toLocaleDateString('en-PH', { month: 'short', day: 'numeric', year: 'numeric' })}`);
1124
+ console.log(num + name + meta);
1125
+ });
1126
+ console.log(DIVIDER);
1127
+
1128
+ const answer = await new Promise(res => rl.question(c.muted(' Enter number or name (Esc to cancel): '), res));
1129
+ const trimmed = (answer || '').trim();
1130
+ if (!trimmed) {
1120
1131
  console.log(c.muted(' Cancelled.\n'));
1121
1132
  return loop();
1122
1133
  }
1134
+ const n = parseInt(trimmed, 10);
1135
+ if (!isNaN(n) && n >= 1 && n <= saves.length) {
1136
+ chosen = saves[n - 1];
1137
+ } else {
1138
+ const q = trimmed.toLowerCase();
1139
+ chosen = saves.find(s => sanitizeName(s.name) === sanitizeName(trimmed))
1140
+ || saves.find(s => s.name.toLowerCase().includes(q));
1141
+ }
1142
+ if (!chosen) {
1143
+ console.log(c.err(` No save found matching "${trimmed}"\n`));
1144
+ return loop();
1145
+ }
1123
1146
  }
1124
1147
 
1125
1148
  // Load it
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "prior-cli",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "description": "Prior Network AI — command-line interface",
5
5
  "bin": {
6
6
  "prior": "bin/prior.js"