prompts-gpt 0.2.16 → 0.2.17

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/dist/cli.js CHANGED
@@ -1397,7 +1397,7 @@ async function runCommand(command, flags) {
1397
1397
  console.log(`${colorize(V, "\x1b[36m")} ${colorize(warnTrunc, "\x1b[33m")}${" ".repeat(Math.max(0, innerW - warnTrunc.length - 2))}${colorize(V, "\x1b[36m")}`);
1398
1398
  }
1399
1399
  if (costTier === "very-high") {
1400
- const costWarn = uc ? `${sym("\u26a0", "!")} Very high cost model \u2014 consider using a versioned alias (e.g. opus-4.6)` : "! Very high cost model -- consider using a versioned alias";
1400
+ const costWarn = uc ? `${sym("\u26a0", "!")} High cost model; keep iterations low.` : "! High cost model; keep iterations low.";
1401
1401
  const costTrunc = costWarn.length > innerW - 4 ? `${costWarn.slice(0, innerW - 7)}...` : costWarn;
1402
1402
  console.log(`${colorize(V, "\x1b[36m")} ${colorize(costTrunc, "\x1b[33m")}${" ".repeat(Math.max(0, innerW - costTrunc.length - 2))}${colorize(V, "\x1b[36m")}`);
1403
1403
  }
@@ -1465,7 +1465,7 @@ async function runCommand(command, flags) {
1465
1465
  }
1466
1466
  catch { /* not a git repo */ }
1467
1467
  console.log(`\n${colorize(divider, "\x1b[35m")}`);
1468
- console.log(colorize(`[${new Date().toLocaleTimeString()}] Iteration ${event.iteration}/${event.total}: ${event.provider} (${event.model})${branchLabel} ${sym("\u23f1", "T")} ${totalElapsed}`, "\x1b[1;35m"));
1468
+ console.log(colorize(`[${new Date().toLocaleTimeString()}] Sweep iteration ${event.iteration}/${event.total} | provider=${event.provider} | model=${event.model}${branchLabel} | elapsed=${totalElapsed}`, "\x1b[1;35m"));
1469
1469
  console.log(` ${progressBar}`);
1470
1470
  console.log(colorize(divider, "\x1b[35m"));
1471
1471
  }
@@ -1832,7 +1832,7 @@ async function runCommand(command, flags) {
1832
1832
  console.log(` ${orchUc ? "📊" : "[score]"} Score: ${event.score}/100`);
1833
1833
  }
1834
1834
  else if (event.type === "orchestrate_end") {
1835
- console.log(`\n${colorize(orchBar, "\x1b[35m")} Done in ${formatDuration(event.totalDurationMs)}${event.winner ? ` | Winner: ${event.winner}` : ""} ${colorize(orchBar, "\x1b[35m")}\n`);
1835
+ console.log(`\n${colorize(orchBar, "\x1b[35m")} Done in ${formatDuration(event.totalDurationMs)}${event.winner ? ` | winner=${event.winner}` : ""} ${colorize(orchBar, "\x1b[35m")}\n`);
1836
1836
  }
1837
1837
  };
1838
1838
  if (mode === "parallel") {
@@ -1866,7 +1866,7 @@ async function runCommand(command, flags) {
1866
1866
  console.log("Results:");
1867
1867
  for (const run of result.runs) {
1868
1868
  const icon = run.result.exitCode === 0 ? sym("✓", "+") : sym("✗", "x");
1869
- console.log(` ${icon} ${run.provider}: ${run.score}/100 ${run.reasoning}`);
1869
+ console.log(` ${icon} ${run.provider}: ${run.score}/100 - ${run.reasoning}`);
1870
1870
  }
1871
1871
  if (result.winner) {
1872
1872
  console.log(`\n ${sym("🏆", "[W]")} Winner: ${result.winner.provider} (${result.winner.score}/100)`);
@@ -3525,6 +3525,7 @@ const PROVIDER_MODELS = Object.freeze({
3525
3525
  { value: "claude-opus-4-7", label: "claude-opus-4-7 — most capable model", tier: "frontier" },
3526
3526
  { value: "claude-sonnet-4-6", label: "claude-sonnet-4-6 — speed + intelligence ★", tier: "standard" },
3527
3527
  { value: "claude-opus-4-6", label: "claude-opus-4-6 — previous gen frontier", tier: "frontier" },
3528
+ { value: "claude-sonnet-4-5", label: "claude-sonnet-4-5 — previous gen balanced", tier: "standard" },
3528
3529
  { value: "claude-opus-4-5", label: "claude-opus-4-5 — legacy opus", tier: "standard" },
3529
3530
  { value: "claude-haiku-4-5", label: "claude-haiku-4-5 — fastest near-frontier", tier: "fast" },
3530
3531
  ],
@@ -4244,9 +4245,19 @@ function colorize(text, code) {
4244
4245
  return supportsColor() ? `${code}${text}\x1b[0m` : text;
4245
4246
  }
4246
4247
  function supportsUnicode() {
4248
+ if (process.env.NO_UNICODE === "1")
4249
+ return false;
4247
4250
  if (process.platform === "win32") {
4248
4251
  return Boolean(process.env.WT_SESSION || process.env.TERM_PROGRAM);
4249
4252
  }
4253
+ return Boolean(process.stdout.isTTY);
4254
+ }
4255
+ function supportsAnsiCursor(stdout = process.stdout) {
4256
+ if (!stdout.isTTY || process.env.TERM === "dumb")
4257
+ return false;
4258
+ if (process.platform === "win32") {
4259
+ return Boolean(process.env.WT_SESSION || process.env.TERM_PROGRAM || process.env.ConEmuANSI === "ON" || process.env.ANSICON);
4260
+ }
4250
4261
  return true;
4251
4262
  }
4252
4263
  function sym(unicode, ascii) {
@@ -4263,7 +4274,7 @@ function buildProgressBar(completed, total, width) {
4263
4274
  const filled = Math.min(Math.floor(fraction * width), width);
4264
4275
  const empty = width - filled;
4265
4276
  const pct = safeCompleted >= safeTotal ? 100 : Math.min(Math.floor(fraction * 100), 99);
4266
- if (supportsColor()) {
4277
+ if (supportsColor() && supportsUnicode()) {
4267
4278
  const bar = "\u2588".repeat(filled) + "\u2591".repeat(empty);
4268
4279
  return `\x1b[32m${bar}\x1b[0m ${pct}% (${safeCompleted}/${safeTotal})`;
4269
4280
  }
@@ -4323,10 +4334,11 @@ function interactiveSelect(prompt, options) {
4323
4334
  const maxVisible = Math.min(options.length, Math.max(3, termRows - 4));
4324
4335
  const useUnicode = supportsUnicode();
4325
4336
  const pointer = useUnicode ? "\u276f" : ">";
4337
+ const numberWidth = String(options.length).length;
4326
4338
  const formatLine = (i, selected) => {
4327
4339
  if (i >= options.length)
4328
4340
  return "";
4329
- const num = i < 9 ? `${i + 1}` : " ";
4341
+ const num = String(i + 1).padStart(numberWidth, " ");
4330
4342
  const prefix = selected ? colorize(pointer, "\x1b[36m") : " ";
4331
4343
  const label = selected ? colorize(options[i].label, "\x1b[1m") : options[i].label;
4332
4344
  return ` ${prefix} ${num}. ${label}`;
@@ -4359,14 +4371,13 @@ function interactiveSelect(prompt, options) {
4359
4371
  stdout.write(lines.join("\n") + "\n");
4360
4372
  totalLinesWritten = lines.length;
4361
4373
  };
4362
- const supportsAnsiCursor = supportsColor() || (process.platform === "win32" && Boolean(process.env.WT_SESSION || process.env.TERM_PROGRAM || process.env.ConEmuANSI));
4374
+ const canMoveCursor = supportsAnsiCursor(stdout);
4363
4375
  const render = () => {
4364
- if (totalLinesWritten > 0 && supportsAnsiCursor) {
4365
- stdout.write(`\x1b[${totalLinesWritten}A\x1b[J`);
4376
+ if (totalLinesWritten > 0 && canMoveCursor) {
4377
+ stdout.write(`\x1b[${totalLinesWritten}F\x1b[J`);
4366
4378
  }
4367
4379
  else if (totalLinesWritten > 0) {
4368
- for (let i = 0; i < totalLinesWritten; i++)
4369
- stdout.write("\x1b[A\x1b[2K");
4380
+ stdout.write("\n");
4370
4381
  }
4371
4382
  writeLines(computeLines());
4372
4383
  };